function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = ["assets/react-B_E9Zu0Z.js","assets/custom-media-element-oIvx3u1j.js","assets/mixin-LgzrpyjZ.js","assets/hls-BVrUXCDN.js","assets/react-BO-1k3Fo.js","assets/index-BnaQdAqy.js","assets/index-BT-uvNHS.js","assets/index-CtuZOU_2.css"]
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value2) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __publicField = (obj, key, value2) => {
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value2);
  return value2;
};
var _a, _b, _c;
function _mergeNamespaces(n2, m2) {
  for (var i2 = 0; i2 < m2.length; i2++) {
    const e2 = m2[i2];
    if (typeof e2 !== "string" && !Array.isArray(e2)) {
      for (const k2 in e2) {
        if (k2 !== "default" && !(k2 in n2)) {
          const d2 = Object.getOwnPropertyDescriptor(e2, k2);
          if (d2) {
            Object.defineProperty(n2, k2, d2.get ? d2 : {
              enumerable: true,
              get: () => e2[k2]
            });
          }
        }
      }
    }
  }
  return Object.freeze(Object.defineProperty(n2, Symbol.toStringTag, { value: "Module" }));
}
(function polyfill() {
  const relList = document.createElement("link").relList;
  if (relList && relList.supports && relList.supports("modulepreload")) {
    return;
  }
  for (const link2 of document.querySelectorAll('link[rel="modulepreload"]')) {
    processPreload(link2);
  }
  new MutationObserver((mutations) => {
    for (const mutation of mutations) {
      if (mutation.type !== "childList") {
        continue;
      }
      for (const node2 of mutation.addedNodes) {
        if (node2.tagName === "LINK" && node2.rel === "modulepreload")
          processPreload(node2);
      }
    }
  }).observe(document, { childList: true, subtree: true });
  function getFetchOpts(link2) {
    const fetchOpts = {};
    if (link2.integrity)
      fetchOpts.integrity = link2.integrity;
    if (link2.referrerPolicy)
      fetchOpts.referrerPolicy = link2.referrerPolicy;
    if (link2.crossOrigin === "use-credentials")
      fetchOpts.credentials = "include";
    else if (link2.crossOrigin === "anonymous")
      fetchOpts.credentials = "omit";
    else
      fetchOpts.credentials = "same-origin";
    return fetchOpts;
  }
  function processPreload(link2) {
    if (link2.ep)
      return;
    link2.ep = true;
    const fetchOpts = getFetchOpts(link2);
    fetch(link2.href, fetchOpts);
  }
})();
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function getDefaultExportFromCjs(x2) {
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
}
function getAugmentedNamespace(n2) {
  if (n2.__esModule)
    return n2;
  var f2 = n2.default;
  if (typeof f2 == "function") {
    var a2 = function a3() {
      if (this instanceof a3) {
        return Reflect.construct(f2, arguments, this.constructor);
      }
      return f2.apply(this, arguments);
    };
    a2.prototype = f2.prototype;
  } else
    a2 = {};
  Object.defineProperty(a2, "__esModule", { value: true });
  Object.keys(n2).forEach(function(k2) {
    var d2 = Object.getOwnPropertyDescriptor(n2, k2);
    Object.defineProperty(a2, k2, d2.get ? d2 : {
      enumerable: true,
      get: function() {
        return n2[k2];
      }
    });
  });
  return a2;
}
var jsxRuntime = { exports: {} };
var reactJsxRuntime_production_min = {};
var react = { exports: {} };
var react_production_min = {};
/**
 * @license React
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var l$a = Symbol.for("react.element"), n$8 = Symbol.for("react.portal"), p$9 = Symbol.for("react.fragment"), q$5 = Symbol.for("react.strict_mode"), r$a = Symbol.for("react.profiler"), t$9 = Symbol.for("react.provider"), u$7 = Symbol.for("react.context"), v$6 = Symbol.for("react.forward_ref"), w$4 = Symbol.for("react.suspense"), x$7 = Symbol.for("react.memo"), y$6 = Symbol.for("react.lazy"), z$4 = Symbol.iterator;
function A$5(a2) {
  if (null === a2 || "object" !== typeof a2)
    return null;
  a2 = z$4 && a2[z$4] || a2["@@iterator"];
  return "function" === typeof a2 ? a2 : null;
}
var B$4 = { isMounted: function() {
  return false;
}, enqueueForceUpdate: function() {
}, enqueueReplaceState: function() {
}, enqueueSetState: function() {
} }, C$2 = Object.assign, D$3 = {};
function E$4(a2, b2, e2) {
  this.props = a2;
  this.context = b2;
  this.refs = D$3;
  this.updater = e2 || B$4;
}
E$4.prototype.isReactComponent = {};
E$4.prototype.setState = function(a2, b2) {
  if ("object" !== typeof a2 && "function" !== typeof a2 && null != a2)
    throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
  this.updater.enqueueSetState(this, a2, b2, "setState");
};
E$4.prototype.forceUpdate = function(a2) {
  this.updater.enqueueForceUpdate(this, a2, "forceUpdate");
};
function F$2() {
}
F$2.prototype = E$4.prototype;
function G$3(a2, b2, e2) {
  this.props = a2;
  this.context = b2;
  this.refs = D$3;
  this.updater = e2 || B$4;
}
var H$4 = G$3.prototype = new F$2();
H$4.constructor = G$3;
C$2(H$4, E$4.prototype);
H$4.isPureReactComponent = true;
var I$4 = Array.isArray, J$3 = Object.prototype.hasOwnProperty, K$3 = { current: null }, L$4 = { key: true, ref: true, __self: true, __source: true };
function M$6(a2, b2, e2) {
  var d2, c2 = {}, k2 = null, h3 = null;
  if (null != b2)
    for (d2 in void 0 !== b2.ref && (h3 = b2.ref), void 0 !== b2.key && (k2 = "" + b2.key), b2)
      J$3.call(b2, d2) && !L$4.hasOwnProperty(d2) && (c2[d2] = b2[d2]);
  var g2 = arguments.length - 2;
  if (1 === g2)
    c2.children = e2;
  else if (1 < g2) {
    for (var f2 = Array(g2), m2 = 0; m2 < g2; m2++)
      f2[m2] = arguments[m2 + 2];
    c2.children = f2;
  }
  if (a2 && a2.defaultProps)
    for (d2 in g2 = a2.defaultProps, g2)
      void 0 === c2[d2] && (c2[d2] = g2[d2]);
  return { $$typeof: l$a, type: a2, key: k2, ref: h3, props: c2, _owner: K$3.current };
}
function N$5(a2, b2) {
  return { $$typeof: l$a, type: a2.type, key: b2, ref: a2.ref, props: a2.props, _owner: a2._owner };
}
function O$4(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === l$a;
}
function escape$1(a2) {
  var b2 = { "=": "=0", ":": "=2" };
  return "$" + a2.replace(/[=:]/g, function(a3) {
    return b2[a3];
  });
}
var P$5 = /\/+/g;
function Q$4(a2, b2) {
  return "object" === typeof a2 && null !== a2 && null != a2.key ? escape$1("" + a2.key) : b2.toString(36);
}
function R$5(a2, b2, e2, d2, c2) {
  var k2 = typeof a2;
  if ("undefined" === k2 || "boolean" === k2)
    a2 = null;
  var h3 = false;
  if (null === a2)
    h3 = true;
  else
    switch (k2) {
      case "string":
      case "number":
        h3 = true;
        break;
      case "object":
        switch (a2.$$typeof) {
          case l$a:
          case n$8:
            h3 = true;
        }
    }
  if (h3)
    return h3 = a2, c2 = c2(h3), a2 = "" === d2 ? "." + Q$4(h3, 0) : d2, I$4(c2) ? (e2 = "", null != a2 && (e2 = a2.replace(P$5, "$&/") + "/"), R$5(c2, b2, e2, "", function(a3) {
      return a3;
    })) : null != c2 && (O$4(c2) && (c2 = N$5(c2, e2 + (!c2.key || h3 && h3.key === c2.key ? "" : ("" + c2.key).replace(P$5, "$&/") + "/") + a2)), b2.push(c2)), 1;
  h3 = 0;
  d2 = "" === d2 ? "." : d2 + ":";
  if (I$4(a2))
    for (var g2 = 0; g2 < a2.length; g2++) {
      k2 = a2[g2];
      var f2 = d2 + Q$4(k2, g2);
      h3 += R$5(k2, b2, e2, f2, c2);
    }
  else if (f2 = A$5(a2), "function" === typeof f2)
    for (a2 = f2.call(a2), g2 = 0; !(k2 = a2.next()).done; )
      k2 = k2.value, f2 = d2 + Q$4(k2, g2++), h3 += R$5(k2, b2, e2, f2, c2);
  else if ("object" === k2)
    throw b2 = String(a2), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b2 ? "object with keys {" + Object.keys(a2).join(", ") + "}" : b2) + "). If you meant to render a collection of children, use an array instead.");
  return h3;
}
function S$4(a2, b2, e2) {
  if (null == a2)
    return a2;
  var d2 = [], c2 = 0;
  R$5(a2, d2, "", "", function(a3) {
    return b2.call(e2, a3, c2++);
  });
  return d2;
}
function T$3(a2) {
  if (-1 === a2._status) {
    var b2 = a2._result;
    b2 = b2();
    b2.then(function(b3) {
      if (0 === a2._status || -1 === a2._status)
        a2._status = 1, a2._result = b3;
    }, function(b3) {
      if (0 === a2._status || -1 === a2._status)
        a2._status = 2, a2._result = b3;
    });
    -1 === a2._status && (a2._status = 0, a2._result = b2);
  }
  if (1 === a2._status)
    return a2._result.default;
  throw a2._result;
}
var U$5 = { current: null }, V$4 = { transition: null }, W$5 = { ReactCurrentDispatcher: U$5, ReactCurrentBatchConfig: V$4, ReactCurrentOwner: K$3 };
function X$4() {
  throw Error("act(...) is not supported in production builds of React.");
}
react_production_min.Children = { map: S$4, forEach: function(a2, b2, e2) {
  S$4(a2, function() {
    b2.apply(this, arguments);
  }, e2);
}, count: function(a2) {
  var b2 = 0;
  S$4(a2, function() {
    b2++;
  });
  return b2;
}, toArray: function(a2) {
  return S$4(a2, function(a3) {
    return a3;
  }) || [];
}, only: function(a2) {
  if (!O$4(a2))
    throw Error("React.Children.only expected to receive a single React element child.");
  return a2;
} };
react_production_min.Component = E$4;
react_production_min.Fragment = p$9;
react_production_min.Profiler = r$a;
react_production_min.PureComponent = G$3;
react_production_min.StrictMode = q$5;
react_production_min.Suspense = w$4;
react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W$5;
react_production_min.act = X$4;
react_production_min.cloneElement = function(a2, b2, e2) {
  if (null === a2 || void 0 === a2)
    throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a2 + ".");
  var d2 = C$2({}, a2.props), c2 = a2.key, k2 = a2.ref, h3 = a2._owner;
  if (null != b2) {
    void 0 !== b2.ref && (k2 = b2.ref, h3 = K$3.current);
    void 0 !== b2.key && (c2 = "" + b2.key);
    if (a2.type && a2.type.defaultProps)
      var g2 = a2.type.defaultProps;
    for (f2 in b2)
      J$3.call(b2, f2) && !L$4.hasOwnProperty(f2) && (d2[f2] = void 0 === b2[f2] && void 0 !== g2 ? g2[f2] : b2[f2]);
  }
  var f2 = arguments.length - 2;
  if (1 === f2)
    d2.children = e2;
  else if (1 < f2) {
    g2 = Array(f2);
    for (var m2 = 0; m2 < f2; m2++)
      g2[m2] = arguments[m2 + 2];
    d2.children = g2;
  }
  return { $$typeof: l$a, type: a2.type, key: c2, ref: k2, props: d2, _owner: h3 };
};
react_production_min.createContext = function(a2) {
  a2 = { $$typeof: u$7, _currentValue: a2, _currentValue2: a2, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null };
  a2.Provider = { $$typeof: t$9, _context: a2 };
  return a2.Consumer = a2;
};
react_production_min.createElement = M$6;
react_production_min.createFactory = function(a2) {
  var b2 = M$6.bind(null, a2);
  b2.type = a2;
  return b2;
};
react_production_min.createRef = function() {
  return { current: null };
};
react_production_min.forwardRef = function(a2) {
  return { $$typeof: v$6, render: a2 };
};
react_production_min.isValidElement = O$4;
react_production_min.lazy = function(a2) {
  return { $$typeof: y$6, _payload: { _status: -1, _result: a2 }, _init: T$3 };
};
react_production_min.memo = function(a2, b2) {
  return { $$typeof: x$7, type: a2, compare: void 0 === b2 ? null : b2 };
};
react_production_min.startTransition = function(a2) {
  var b2 = V$4.transition;
  V$4.transition = {};
  try {
    a2();
  } finally {
    V$4.transition = b2;
  }
};
react_production_min.unstable_act = X$4;
react_production_min.useCallback = function(a2, b2) {
  return U$5.current.useCallback(a2, b2);
};
react_production_min.useContext = function(a2) {
  return U$5.current.useContext(a2);
};
react_production_min.useDebugValue = function() {
};
react_production_min.useDeferredValue = function(a2) {
  return U$5.current.useDeferredValue(a2);
};
react_production_min.useEffect = function(a2, b2) {
  return U$5.current.useEffect(a2, b2);
};
react_production_min.useId = function() {
  return U$5.current.useId();
};
react_production_min.useImperativeHandle = function(a2, b2, e2) {
  return U$5.current.useImperativeHandle(a2, b2, e2);
};
react_production_min.useInsertionEffect = function(a2, b2) {
  return U$5.current.useInsertionEffect(a2, b2);
};
react_production_min.useLayoutEffect = function(a2, b2) {
  return U$5.current.useLayoutEffect(a2, b2);
};
react_production_min.useMemo = function(a2, b2) {
  return U$5.current.useMemo(a2, b2);
};
react_production_min.useReducer = function(a2, b2, e2) {
  return U$5.current.useReducer(a2, b2, e2);
};
react_production_min.useRef = function(a2) {
  return U$5.current.useRef(a2);
};
react_production_min.useState = function(a2) {
  return U$5.current.useState(a2);
};
react_production_min.useSyncExternalStore = function(a2, b2, e2) {
  return U$5.current.useSyncExternalStore(a2, b2, e2);
};
react_production_min.useTransition = function() {
  return U$5.current.useTransition();
};
react_production_min.version = "18.3.1";
{
  react.exports = react_production_min;
}
var reactExports = react.exports;
const React$6 = /* @__PURE__ */ getDefaultExportFromCjs(reactExports);
const React$7 = /* @__PURE__ */ _mergeNamespaces({
  __proto__: null,
  default: React$6
}, [reactExports]);
/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var f$5 = reactExports, k$5 = Symbol.for("react.element"), l$9 = Symbol.for("react.fragment"), m$5 = Object.prototype.hasOwnProperty, n$7 = f$5.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$8 = { key: true, ref: true, __self: true, __source: true };
function q$4(c2, a2, g2) {
  var b2, d2 = {}, e2 = null, h3 = null;
  void 0 !== g2 && (e2 = "" + g2);
  void 0 !== a2.key && (e2 = "" + a2.key);
  void 0 !== a2.ref && (h3 = a2.ref);
  for (b2 in a2)
    m$5.call(a2, b2) && !p$8.hasOwnProperty(b2) && (d2[b2] = a2[b2]);
  if (c2 && c2.defaultProps)
    for (b2 in a2 = c2.defaultProps, a2)
      void 0 === d2[b2] && (d2[b2] = a2[b2]);
  return { $$typeof: k$5, type: c2, key: e2, ref: h3, props: d2, _owner: n$7.current };
}
reactJsxRuntime_production_min.Fragment = l$9;
reactJsxRuntime_production_min.jsx = q$4;
reactJsxRuntime_production_min.jsxs = q$4;
{
  jsxRuntime.exports = reactJsxRuntime_production_min;
}
var jsxRuntimeExports = jsxRuntime.exports;
var client = {};
var reactDom = { exports: {} };
var reactDom_production_min = {};
var scheduler = { exports: {} };
var scheduler_production_min = {};
/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
(function(exports2) {
  function f2(a2, b2) {
    var c2 = a2.length;
    a2.push(b2);
    a:
      for (; 0 < c2; ) {
        var d2 = c2 - 1 >>> 1, e2 = a2[d2];
        if (0 < g2(e2, b2))
          a2[d2] = b2, a2[c2] = e2, c2 = d2;
        else
          break a;
      }
  }
  function h3(a2) {
    return 0 === a2.length ? null : a2[0];
  }
  function k2(a2) {
    if (0 === a2.length)
      return null;
    var b2 = a2[0], c2 = a2.pop();
    if (c2 !== b2) {
      a2[0] = c2;
      a:
        for (var d2 = 0, e2 = a2.length, w2 = e2 >>> 1; d2 < w2; ) {
          var m2 = 2 * (d2 + 1) - 1, C2 = a2[m2], n2 = m2 + 1, x2 = a2[n2];
          if (0 > g2(C2, c2))
            n2 < e2 && 0 > g2(x2, C2) ? (a2[d2] = x2, a2[n2] = c2, d2 = n2) : (a2[d2] = C2, a2[m2] = c2, d2 = m2);
          else if (n2 < e2 && 0 > g2(x2, c2))
            a2[d2] = x2, a2[n2] = c2, d2 = n2;
          else
            break a;
        }
    }
    return b2;
  }
  function g2(a2, b2) {
    var c2 = a2.sortIndex - b2.sortIndex;
    return 0 !== c2 ? c2 : a2.id - b2.id;
  }
  if ("object" === typeof performance && "function" === typeof performance.now) {
    var l2 = performance;
    exports2.unstable_now = function() {
      return l2.now();
    };
  } else {
    var p2 = Date, q2 = p2.now();
    exports2.unstable_now = function() {
      return p2.now() - q2;
    };
  }
  var r2 = [], t2 = [], u2 = 1, v2 = null, y2 = 3, z2 = false, A2 = false, B2 = false, D2 = "function" === typeof setTimeout ? setTimeout : null, E2 = "function" === typeof clearTimeout ? clearTimeout : null, F2 = "undefined" !== typeof setImmediate ? setImmediate : null;
  "undefined" !== typeof navigator && void 0 !== navigator.scheduling && void 0 !== navigator.scheduling.isInputPending && navigator.scheduling.isInputPending.bind(navigator.scheduling);
  function G2(a2) {
    for (var b2 = h3(t2); null !== b2; ) {
      if (null === b2.callback)
        k2(t2);
      else if (b2.startTime <= a2)
        k2(t2), b2.sortIndex = b2.expirationTime, f2(r2, b2);
      else
        break;
      b2 = h3(t2);
    }
  }
  function H2(a2) {
    B2 = false;
    G2(a2);
    if (!A2)
      if (null !== h3(r2))
        A2 = true, I2(J2);
      else {
        var b2 = h3(t2);
        null !== b2 && K2(H2, b2.startTime - a2);
      }
  }
  function J2(a2, b2) {
    A2 = false;
    B2 && (B2 = false, E2(L2), L2 = -1);
    z2 = true;
    var c2 = y2;
    try {
      G2(b2);
      for (v2 = h3(r2); null !== v2 && (!(v2.expirationTime > b2) || a2 && !M2()); ) {
        var d2 = v2.callback;
        if ("function" === typeof d2) {
          v2.callback = null;
          y2 = v2.priorityLevel;
          var e2 = d2(v2.expirationTime <= b2);
          b2 = exports2.unstable_now();
          "function" === typeof e2 ? v2.callback = e2 : v2 === h3(r2) && k2(r2);
          G2(b2);
        } else
          k2(r2);
        v2 = h3(r2);
      }
      if (null !== v2)
        var w2 = true;
      else {
        var m2 = h3(t2);
        null !== m2 && K2(H2, m2.startTime - b2);
        w2 = false;
      }
      return w2;
    } finally {
      v2 = null, y2 = c2, z2 = false;
    }
  }
  var N2 = false, O2 = null, L2 = -1, P2 = 5, Q2 = -1;
  function M2() {
    return exports2.unstable_now() - Q2 < P2 ? false : true;
  }
  function R2() {
    if (null !== O2) {
      var a2 = exports2.unstable_now();
      Q2 = a2;
      var b2 = true;
      try {
        b2 = O2(true, a2);
      } finally {
        b2 ? S2() : (N2 = false, O2 = null);
      }
    } else
      N2 = false;
  }
  var S2;
  if ("function" === typeof F2)
    S2 = function() {
      F2(R2);
    };
  else if ("undefined" !== typeof MessageChannel) {
    var T2 = new MessageChannel(), U2 = T2.port2;
    T2.port1.onmessage = R2;
    S2 = function() {
      U2.postMessage(null);
    };
  } else
    S2 = function() {
      D2(R2, 0);
    };
  function I2(a2) {
    O2 = a2;
    N2 || (N2 = true, S2());
  }
  function K2(a2, b2) {
    L2 = D2(function() {
      a2(exports2.unstable_now());
    }, b2);
  }
  exports2.unstable_IdlePriority = 5;
  exports2.unstable_ImmediatePriority = 1;
  exports2.unstable_LowPriority = 4;
  exports2.unstable_NormalPriority = 3;
  exports2.unstable_Profiling = null;
  exports2.unstable_UserBlockingPriority = 2;
  exports2.unstable_cancelCallback = function(a2) {
    a2.callback = null;
  };
  exports2.unstable_continueExecution = function() {
    A2 || z2 || (A2 = true, I2(J2));
  };
  exports2.unstable_forceFrameRate = function(a2) {
    0 > a2 || 125 < a2 ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : P2 = 0 < a2 ? Math.floor(1e3 / a2) : 5;
  };
  exports2.unstable_getCurrentPriorityLevel = function() {
    return y2;
  };
  exports2.unstable_getFirstCallbackNode = function() {
    return h3(r2);
  };
  exports2.unstable_next = function(a2) {
    switch (y2) {
      case 1:
      case 2:
      case 3:
        var b2 = 3;
        break;
      default:
        b2 = y2;
    }
    var c2 = y2;
    y2 = b2;
    try {
      return a2();
    } finally {
      y2 = c2;
    }
  };
  exports2.unstable_pauseExecution = function() {
  };
  exports2.unstable_requestPaint = function() {
  };
  exports2.unstable_runWithPriority = function(a2, b2) {
    switch (a2) {
      case 1:
      case 2:
      case 3:
      case 4:
      case 5:
        break;
      default:
        a2 = 3;
    }
    var c2 = y2;
    y2 = a2;
    try {
      return b2();
    } finally {
      y2 = c2;
    }
  };
  exports2.unstable_scheduleCallback = function(a2, b2, c2) {
    var d2 = exports2.unstable_now();
    "object" === typeof c2 && null !== c2 ? (c2 = c2.delay, c2 = "number" === typeof c2 && 0 < c2 ? d2 + c2 : d2) : c2 = d2;
    switch (a2) {
      case 1:
        var e2 = -1;
        break;
      case 2:
        e2 = 250;
        break;
      case 5:
        e2 = 1073741823;
        break;
      case 4:
        e2 = 1e4;
        break;
      default:
        e2 = 5e3;
    }
    e2 = c2 + e2;
    a2 = { id: u2++, callback: b2, priorityLevel: a2, startTime: c2, expirationTime: e2, sortIndex: -1 };
    c2 > d2 ? (a2.sortIndex = c2, f2(t2, a2), null === h3(r2) && a2 === h3(t2) && (B2 ? (E2(L2), L2 = -1) : B2 = true, K2(H2, c2 - d2))) : (a2.sortIndex = e2, f2(r2, a2), A2 || z2 || (A2 = true, I2(J2)));
    return a2;
  };
  exports2.unstable_shouldYield = M2;
  exports2.unstable_wrapCallback = function(a2) {
    var b2 = y2;
    return function() {
      var c2 = y2;
      y2 = b2;
      try {
        return a2.apply(this, arguments);
      } finally {
        y2 = c2;
      }
    };
  };
})(scheduler_production_min);
{
  scheduler.exports = scheduler_production_min;
}
var schedulerExports = scheduler.exports;
/**
 * @license React
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var aa$2 = reactExports, ca$1 = schedulerExports;
function p$7(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var da$1 = /* @__PURE__ */ new Set(), ea$1 = {};
function fa$2(a2, b2) {
  ha$2(a2, b2);
  ha$2(a2 + "Capture", b2);
}
function ha$2(a2, b2) {
  ea$1[a2] = b2;
  for (a2 = 0; a2 < b2.length; a2++)
    da$1.add(b2[a2]);
}
var ia$2 = !("undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement), ja$2 = Object.prototype.hasOwnProperty, ka$2 = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, la$2 = {}, ma$1 = {};
function oa$2(a2) {
  if (ja$2.call(ma$1, a2))
    return true;
  if (ja$2.call(la$2, a2))
    return false;
  if (ka$2.test(a2))
    return ma$1[a2] = true;
  la$2[a2] = true;
  return false;
}
function pa$2(a2, b2, c2, d2) {
  if (null !== c2 && 0 === c2.type)
    return false;
  switch (typeof b2) {
    case "function":
    case "symbol":
      return true;
    case "boolean":
      if (d2)
        return false;
      if (null !== c2)
        return !c2.acceptsBooleans;
      a2 = a2.toLowerCase().slice(0, 5);
      return "data-" !== a2 && "aria-" !== a2;
    default:
      return false;
  }
}
function qa$2(a2, b2, c2, d2) {
  if (null === b2 || "undefined" === typeof b2 || pa$2(a2, b2, c2, d2))
    return true;
  if (d2)
    return false;
  if (null !== c2)
    switch (c2.type) {
      case 3:
        return !b2;
      case 4:
        return false === b2;
      case 5:
        return isNaN(b2);
      case 6:
        return isNaN(b2) || 1 > b2;
    }
  return false;
}
function v$5(a2, b2, c2, d2, e2, f2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = e2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = f2;
  this.removeEmptyString = g2;
}
var z$3 = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  z$3[a2] = new v$5(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  z$3[b2] = new v$5(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 2, false, a2, null, false, false);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a2) {
  z$3[a2] = new v$5(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ra$2 = /[\-:]([a-z])/g;
function sa$2(a2) {
  return a2[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a2) {
  var b2 = a2.replace(
    ra$2,
    sa$2
  );
  z$3[b2] = new v$5(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ra$2, sa$2);
  z$3[b2] = new v$5(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ra$2, sa$2);
  z$3[b2] = new v$5(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 1, false, a2.toLowerCase(), null, false, false);
});
z$3.xlinkHref = new v$5("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  z$3[a2] = new v$5(a2, 1, false, a2.toLowerCase(), null, true, true);
});
function ta$2(a2, b2, c2, d2) {
  var e2 = z$3.hasOwnProperty(b2) ? z$3[b2] : null;
  if (null !== e2 ? 0 !== e2.type : d2 || !(2 < b2.length) || "o" !== b2[0] && "O" !== b2[0] || "n" !== b2[1] && "N" !== b2[1])
    qa$2(b2, c2, e2, d2) && (c2 = null), d2 || null === e2 ? oa$2(b2) && (null === c2 ? a2.removeAttribute(b2) : a2.setAttribute(b2, "" + c2)) : e2.mustUseProperty ? a2[e2.propertyName] = null === c2 ? 3 === e2.type ? false : "" : c2 : (b2 = e2.attributeName, d2 = e2.attributeNamespace, null === c2 ? a2.removeAttribute(b2) : (e2 = e2.type, c2 = 3 === e2 || 4 === e2 && true === c2 ? "" : "" + c2, d2 ? a2.setAttributeNS(d2, b2, c2) : a2.setAttribute(b2, c2)));
}
var ua$2 = aa$2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, va$2 = Symbol.for("react.element"), wa$2 = Symbol.for("react.portal"), ya$2 = Symbol.for("react.fragment"), za$2 = Symbol.for("react.strict_mode"), Aa$2 = Symbol.for("react.profiler"), Ba$2 = Symbol.for("react.provider"), Ca$2 = Symbol.for("react.context"), Da$2 = Symbol.for("react.forward_ref"), Ea$2 = Symbol.for("react.suspense"), Fa$2 = Symbol.for("react.suspense_list"), Ga$2 = Symbol.for("react.memo"), Ha$2 = Symbol.for("react.lazy");
var Ia$2 = Symbol.for("react.offscreen");
var Ja$2 = Symbol.iterator;
function Ka$2(a2) {
  if (null === a2 || "object" !== typeof a2)
    return null;
  a2 = Ja$2 && a2[Ja$2] || a2["@@iterator"];
  return "function" === typeof a2 ? a2 : null;
}
var A$4 = Object.assign, La$2;
function Ma$2(a2) {
  if (void 0 === La$2)
    try {
      throw Error();
    } catch (c2) {
      var b2 = c2.stack.trim().match(/\n( *(at )?)/);
      La$2 = b2 && b2[1] || "";
    }
  return "\n" + La$2 + a2;
}
var Na$2 = false;
function Oa$2(a2, b2) {
  if (!a2 || Na$2)
    return "";
  Na$2 = true;
  var c2 = Error.prepareStackTrace;
  Error.prepareStackTrace = void 0;
  try {
    if (b2)
      if (b2 = function() {
        throw Error();
      }, Object.defineProperty(b2.prototype, "props", { set: function() {
        throw Error();
      } }), "object" === typeof Reflect && Reflect.construct) {
        try {
          Reflect.construct(b2, []);
        } catch (l2) {
          var d2 = l2;
        }
        Reflect.construct(a2, [], b2);
      } else {
        try {
          b2.call();
        } catch (l2) {
          d2 = l2;
        }
        a2.call(b2.prototype);
      }
    else {
      try {
        throw Error();
      } catch (l2) {
        d2 = l2;
      }
      a2();
    }
  } catch (l2) {
    if (l2 && d2 && "string" === typeof l2.stack) {
      for (var e2 = l2.stack.split("\n"), f2 = d2.stack.split("\n"), g2 = e2.length - 1, h3 = f2.length - 1; 1 <= g2 && 0 <= h3 && e2[g2] !== f2[h3]; )
        h3--;
      for (; 1 <= g2 && 0 <= h3; g2--, h3--)
        if (e2[g2] !== f2[h3]) {
          if (1 !== g2 || 1 !== h3) {
            do
              if (g2--, h3--, 0 > h3 || e2[g2] !== f2[h3]) {
                var k2 = "\n" + e2[g2].replace(" at new ", " at ");
                a2.displayName && k2.includes("<anonymous>") && (k2 = k2.replace("<anonymous>", a2.displayName));
                return k2;
              }
            while (1 <= g2 && 0 <= h3);
          }
          break;
        }
    }
  } finally {
    Na$2 = false, Error.prepareStackTrace = c2;
  }
  return (a2 = a2 ? a2.displayName || a2.name : "") ? Ma$2(a2) : "";
}
function Pa$2(a2) {
  switch (a2.tag) {
    case 5:
      return Ma$2(a2.type);
    case 16:
      return Ma$2("Lazy");
    case 13:
      return Ma$2("Suspense");
    case 19:
      return Ma$2("SuspenseList");
    case 0:
    case 2:
    case 15:
      return a2 = Oa$2(a2.type, false), a2;
    case 11:
      return a2 = Oa$2(a2.type.render, false), a2;
    case 1:
      return a2 = Oa$2(a2.type, true), a2;
    default:
      return "";
  }
}
function Qa$2(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case ya$2:
      return "Fragment";
    case wa$2:
      return "Portal";
    case Aa$2:
      return "Profiler";
    case za$2:
      return "StrictMode";
    case Ea$2:
      return "Suspense";
    case Fa$2:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Ca$2:
        return (a2.displayName || "Context") + ".Consumer";
      case Ba$2:
        return (a2._context.displayName || "Context") + ".Provider";
      case Da$2:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case Ga$2:
        return b2 = a2.displayName || null, null !== b2 ? b2 : Qa$2(a2.type) || "Memo";
      case Ha$2:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return Qa$2(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
function Ra$2(a2) {
  var b2 = a2.type;
  switch (a2.tag) {
    case 24:
      return "Cache";
    case 9:
      return (b2.displayName || "Context") + ".Consumer";
    case 10:
      return (b2._context.displayName || "Context") + ".Provider";
    case 18:
      return "DehydratedFragment";
    case 11:
      return a2 = b2.render, a2 = a2.displayName || a2.name || "", b2.displayName || ("" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
    case 7:
      return "Fragment";
    case 5:
      return b2;
    case 4:
      return "Portal";
    case 3:
      return "Root";
    case 6:
      return "Text";
    case 16:
      return Qa$2(b2);
    case 8:
      return b2 === za$2 ? "StrictMode" : "Mode";
    case 22:
      return "Offscreen";
    case 12:
      return "Profiler";
    case 21:
      return "Scope";
    case 13:
      return "Suspense";
    case 19:
      return "SuspenseList";
    case 25:
      return "TracingMarker";
    case 1:
    case 0:
    case 17:
    case 2:
    case 14:
    case 15:
      if ("function" === typeof b2)
        return b2.displayName || b2.name || null;
      if ("string" === typeof b2)
        return b2;
  }
  return null;
}
function Sa$2(a2) {
  switch (typeof a2) {
    case "boolean":
    case "number":
    case "string":
    case "undefined":
      return a2;
    case "object":
      return a2;
    default:
      return "";
  }
}
function Ta$2(a2) {
  var b2 = a2.type;
  return (a2 = a2.nodeName) && "input" === a2.toLowerCase() && ("checkbox" === b2 || "radio" === b2);
}
function Ua$2(a2) {
  var b2 = Ta$2(a2) ? "checked" : "value", c2 = Object.getOwnPropertyDescriptor(a2.constructor.prototype, b2), d2 = "" + a2[b2];
  if (!a2.hasOwnProperty(b2) && "undefined" !== typeof c2 && "function" === typeof c2.get && "function" === typeof c2.set) {
    var e2 = c2.get, f2 = c2.set;
    Object.defineProperty(a2, b2, { configurable: true, get: function() {
      return e2.call(this);
    }, set: function(a3) {
      d2 = "" + a3;
      f2.call(this, a3);
    } });
    Object.defineProperty(a2, b2, { enumerable: c2.enumerable });
    return { getValue: function() {
      return d2;
    }, setValue: function(a3) {
      d2 = "" + a3;
    }, stopTracking: function() {
      a2._valueTracker = null;
      delete a2[b2];
    } };
  }
}
function Va$2(a2) {
  a2._valueTracker || (a2._valueTracker = Ua$2(a2));
}
function Wa$2(a2) {
  if (!a2)
    return false;
  var b2 = a2._valueTracker;
  if (!b2)
    return true;
  var c2 = b2.getValue();
  var d2 = "";
  a2 && (d2 = Ta$2(a2) ? a2.checked ? "true" : "false" : a2.value);
  a2 = d2;
  return a2 !== c2 ? (b2.setValue(a2), true) : false;
}
function Xa$2(a2) {
  a2 = a2 || ("undefined" !== typeof document ? document : void 0);
  if ("undefined" === typeof a2)
    return null;
  try {
    return a2.activeElement || a2.body;
  } catch (b2) {
    return a2.body;
  }
}
function Ya$2(a2, b2) {
  var c2 = b2.checked;
  return A$4({}, b2, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: null != c2 ? c2 : a2._wrapperState.initialChecked });
}
function Za$2(a2, b2) {
  var c2 = null == b2.defaultValue ? "" : b2.defaultValue, d2 = null != b2.checked ? b2.checked : b2.defaultChecked;
  c2 = Sa$2(null != b2.value ? b2.value : c2);
  a2._wrapperState = { initialChecked: d2, initialValue: c2, controlled: "checkbox" === b2.type || "radio" === b2.type ? null != b2.checked : null != b2.value };
}
function ab$2(a2, b2) {
  b2 = b2.checked;
  null != b2 && ta$2(a2, "checked", b2, false);
}
function bb$2(a2, b2) {
  ab$2(a2, b2);
  var c2 = Sa$2(b2.value), d2 = b2.type;
  if (null != c2)
    if ("number" === d2) {
      if (0 === c2 && "" === a2.value || a2.value != c2)
        a2.value = "" + c2;
    } else
      a2.value !== "" + c2 && (a2.value = "" + c2);
  else if ("submit" === d2 || "reset" === d2) {
    a2.removeAttribute("value");
    return;
  }
  b2.hasOwnProperty("value") ? cb$2(a2, b2.type, c2) : b2.hasOwnProperty("defaultValue") && cb$2(a2, b2.type, Sa$2(b2.defaultValue));
  null == b2.checked && null != b2.defaultChecked && (a2.defaultChecked = !!b2.defaultChecked);
}
function db$2(a2, b2, c2) {
  if (b2.hasOwnProperty("value") || b2.hasOwnProperty("defaultValue")) {
    var d2 = b2.type;
    if (!("submit" !== d2 && "reset" !== d2 || void 0 !== b2.value && null !== b2.value))
      return;
    b2 = "" + a2._wrapperState.initialValue;
    c2 || b2 === a2.value || (a2.value = b2);
    a2.defaultValue = b2;
  }
  c2 = a2.name;
  "" !== c2 && (a2.name = "");
  a2.defaultChecked = !!a2._wrapperState.initialChecked;
  "" !== c2 && (a2.name = c2);
}
function cb$2(a2, b2, c2) {
  if ("number" !== b2 || Xa$2(a2.ownerDocument) !== a2)
    null == c2 ? a2.defaultValue = "" + a2._wrapperState.initialValue : a2.defaultValue !== "" + c2 && (a2.defaultValue = "" + c2);
}
var eb$2 = Array.isArray;
function fb$2(a2, b2, c2, d2) {
  a2 = a2.options;
  if (b2) {
    b2 = {};
    for (var e2 = 0; e2 < c2.length; e2++)
      b2["$" + c2[e2]] = true;
    for (c2 = 0; c2 < a2.length; c2++)
      e2 = b2.hasOwnProperty("$" + a2[c2].value), a2[c2].selected !== e2 && (a2[c2].selected = e2), e2 && d2 && (a2[c2].defaultSelected = true);
  } else {
    c2 = "" + Sa$2(c2);
    b2 = null;
    for (e2 = 0; e2 < a2.length; e2++) {
      if (a2[e2].value === c2) {
        a2[e2].selected = true;
        d2 && (a2[e2].defaultSelected = true);
        return;
      }
      null !== b2 || a2[e2].disabled || (b2 = a2[e2]);
    }
    null !== b2 && (b2.selected = true);
  }
}
function gb$2(a2, b2) {
  if (null != b2.dangerouslySetInnerHTML)
    throw Error(p$7(91));
  return A$4({}, b2, { value: void 0, defaultValue: void 0, children: "" + a2._wrapperState.initialValue });
}
function hb$2(a2, b2) {
  var c2 = b2.value;
  if (null == c2) {
    c2 = b2.children;
    b2 = b2.defaultValue;
    if (null != c2) {
      if (null != b2)
        throw Error(p$7(92));
      if (eb$2(c2)) {
        if (1 < c2.length)
          throw Error(p$7(93));
        c2 = c2[0];
      }
      b2 = c2;
    }
    null == b2 && (b2 = "");
    c2 = b2;
  }
  a2._wrapperState = { initialValue: Sa$2(c2) };
}
function ib$2(a2, b2) {
  var c2 = Sa$2(b2.value), d2 = Sa$2(b2.defaultValue);
  null != c2 && (c2 = "" + c2, c2 !== a2.value && (a2.value = c2), null == b2.defaultValue && a2.defaultValue !== c2 && (a2.defaultValue = c2));
  null != d2 && (a2.defaultValue = "" + d2);
}
function jb$2(a2) {
  var b2 = a2.textContent;
  b2 === a2._wrapperState.initialValue && "" !== b2 && null !== b2 && (a2.value = b2);
}
function kb$2(a2) {
  switch (a2) {
    case "svg":
      return "http://www.w3.org/2000/svg";
    case "math":
      return "http://www.w3.org/1998/Math/MathML";
    default:
      return "http://www.w3.org/1999/xhtml";
  }
}
function lb$2(a2, b2) {
  return null == a2 || "http://www.w3.org/1999/xhtml" === a2 ? kb$2(b2) : "http://www.w3.org/2000/svg" === a2 && "foreignObject" === b2 ? "http://www.w3.org/1999/xhtml" : a2;
}
var mb$1, nb$1 = function(a2) {
  return "undefined" !== typeof MSApp && MSApp.execUnsafeLocalFunction ? function(b2, c2, d2, e2) {
    MSApp.execUnsafeLocalFunction(function() {
      return a2(b2, c2, d2, e2);
    });
  } : a2;
}(function(a2, b2) {
  if ("http://www.w3.org/2000/svg" !== a2.namespaceURI || "innerHTML" in a2)
    a2.innerHTML = b2;
  else {
    mb$1 = mb$1 || document.createElement("div");
    mb$1.innerHTML = "<svg>" + b2.valueOf().toString() + "</svg>";
    for (b2 = mb$1.firstChild; a2.firstChild; )
      a2.removeChild(a2.firstChild);
    for (; b2.firstChild; )
      a2.appendChild(b2.firstChild);
  }
});
function ob$2(a2, b2) {
  if (b2) {
    var c2 = a2.firstChild;
    if (c2 && c2 === a2.lastChild && 3 === c2.nodeType) {
      c2.nodeValue = b2;
      return;
    }
  }
  a2.textContent = b2;
}
var pb$2 = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, qb$2 = ["Webkit", "ms", "Moz", "O"];
Object.keys(pb$2).forEach(function(a2) {
  qb$2.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    pb$2[b2] = pb$2[a2];
  });
});
function rb$2(a2, b2, c2) {
  return null == b2 || "boolean" === typeof b2 || "" === b2 ? "" : c2 || "number" !== typeof b2 || 0 === b2 || pb$2.hasOwnProperty(a2) && pb$2[a2] ? ("" + b2).trim() : b2 + "px";
}
function sb$2(a2, b2) {
  a2 = a2.style;
  for (var c2 in b2)
    if (b2.hasOwnProperty(c2)) {
      var d2 = 0 === c2.indexOf("--"), e2 = rb$2(c2, b2[c2], d2);
      "float" === c2 && (c2 = "cssFloat");
      d2 ? a2.setProperty(c2, e2) : a2[c2] = e2;
    }
}
var tb$2 = A$4({ menuitem: true }, { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true });
function ub$2(a2, b2) {
  if (b2) {
    if (tb$2[a2] && (null != b2.children || null != b2.dangerouslySetInnerHTML))
      throw Error(p$7(137, a2));
    if (null != b2.dangerouslySetInnerHTML) {
      if (null != b2.children)
        throw Error(p$7(60));
      if ("object" !== typeof b2.dangerouslySetInnerHTML || !("__html" in b2.dangerouslySetInnerHTML))
        throw Error(p$7(61));
    }
    if (null != b2.style && "object" !== typeof b2.style)
      throw Error(p$7(62));
  }
}
function vb$2(a2, b2) {
  if (-1 === a2.indexOf("-"))
    return "string" === typeof b2.is;
  switch (a2) {
    case "annotation-xml":
    case "color-profile":
    case "font-face":
    case "font-face-src":
    case "font-face-uri":
    case "font-face-format":
    case "font-face-name":
    case "missing-glyph":
      return false;
    default:
      return true;
  }
}
var wb$2 = null;
function xb$2(a2) {
  a2 = a2.target || a2.srcElement || window;
  a2.correspondingUseElement && (a2 = a2.correspondingUseElement);
  return 3 === a2.nodeType ? a2.parentNode : a2;
}
var yb$2 = null, zb$2 = null, Ab$2 = null;
function Bb$2(a2) {
  if (a2 = Cb$2(a2)) {
    if ("function" !== typeof yb$2)
      throw Error(p$7(280));
    var b2 = a2.stateNode;
    b2 && (b2 = Db$2(b2), yb$2(a2.stateNode, a2.type, b2));
  }
}
function Eb$2(a2) {
  zb$2 ? Ab$2 ? Ab$2.push(a2) : Ab$2 = [a2] : zb$2 = a2;
}
function Fb$1() {
  if (zb$2) {
    var a2 = zb$2, b2 = Ab$2;
    Ab$2 = zb$2 = null;
    Bb$2(a2);
    if (b2)
      for (a2 = 0; a2 < b2.length; a2++)
        Bb$2(b2[a2]);
  }
}
function Gb$2(a2, b2) {
  return a2(b2);
}
function Hb$2() {
}
var Ib$2 = false;
function Jb$2(a2, b2, c2) {
  if (Ib$2)
    return a2(b2, c2);
  Ib$2 = true;
  try {
    return Gb$2(a2, b2, c2);
  } finally {
    if (Ib$2 = false, null !== zb$2 || null !== Ab$2)
      Hb$2(), Fb$1();
  }
}
function Kb$2(a2, b2) {
  var c2 = a2.stateNode;
  if (null === c2)
    return null;
  var d2 = Db$2(c2);
  if (null === d2)
    return null;
  c2 = d2[b2];
  a:
    switch (b2) {
      case "onClick":
      case "onClickCapture":
      case "onDoubleClick":
      case "onDoubleClickCapture":
      case "onMouseDown":
      case "onMouseDownCapture":
      case "onMouseMove":
      case "onMouseMoveCapture":
      case "onMouseUp":
      case "onMouseUpCapture":
      case "onMouseEnter":
        (d2 = !d2.disabled) || (a2 = a2.type, d2 = !("button" === a2 || "input" === a2 || "select" === a2 || "textarea" === a2));
        a2 = !d2;
        break a;
      default:
        a2 = false;
    }
  if (a2)
    return null;
  if (c2 && "function" !== typeof c2)
    throw Error(p$7(231, b2, typeof c2));
  return c2;
}
var Lb$2 = false;
if (ia$2)
  try {
    var Mb$2 = {};
    Object.defineProperty(Mb$2, "passive", { get: function() {
      Lb$2 = true;
    } });
    window.addEventListener("test", Mb$2, Mb$2);
    window.removeEventListener("test", Mb$2, Mb$2);
  } catch (a2) {
    Lb$2 = false;
  }
function Nb$2(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  var l2 = Array.prototype.slice.call(arguments, 3);
  try {
    b2.apply(c2, l2);
  } catch (m2) {
    this.onError(m2);
  }
}
var Ob$2 = false, Pb$2 = null, Qb$2 = false, Rb$2 = null, Sb$2 = { onError: function(a2) {
  Ob$2 = true;
  Pb$2 = a2;
} };
function Tb$2(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  Ob$2 = false;
  Pb$2 = null;
  Nb$2.apply(Sb$2, arguments);
}
function Ub$1(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  Tb$2.apply(this, arguments);
  if (Ob$2) {
    if (Ob$2) {
      var l2 = Pb$2;
      Ob$2 = false;
      Pb$2 = null;
    } else
      throw Error(p$7(198));
    Qb$2 || (Qb$2 = true, Rb$2 = l2);
  }
}
function Vb$1(a2) {
  var b2 = a2, c2 = a2;
  if (a2.alternate)
    for (; b2.return; )
      b2 = b2.return;
  else {
    a2 = b2;
    do
      b2 = a2, 0 !== (b2.flags & 4098) && (c2 = b2.return), a2 = b2.return;
    while (a2);
  }
  return 3 === b2.tag ? c2 : null;
}
function Wb$1(a2) {
  if (13 === a2.tag) {
    var b2 = a2.memoizedState;
    null === b2 && (a2 = a2.alternate, null !== a2 && (b2 = a2.memoizedState));
    if (null !== b2)
      return b2.dehydrated;
  }
  return null;
}
function Xb$1(a2) {
  if (Vb$1(a2) !== a2)
    throw Error(p$7(188));
}
function Yb$1(a2) {
  var b2 = a2.alternate;
  if (!b2) {
    b2 = Vb$1(a2);
    if (null === b2)
      throw Error(p$7(188));
    return b2 !== a2 ? null : a2;
  }
  for (var c2 = a2, d2 = b2; ; ) {
    var e2 = c2.return;
    if (null === e2)
      break;
    var f2 = e2.alternate;
    if (null === f2) {
      d2 = e2.return;
      if (null !== d2) {
        c2 = d2;
        continue;
      }
      break;
    }
    if (e2.child === f2.child) {
      for (f2 = e2.child; f2; ) {
        if (f2 === c2)
          return Xb$1(e2), a2;
        if (f2 === d2)
          return Xb$1(e2), b2;
        f2 = f2.sibling;
      }
      throw Error(p$7(188));
    }
    if (c2.return !== d2.return)
      c2 = e2, d2 = f2;
    else {
      for (var g2 = false, h3 = e2.child; h3; ) {
        if (h3 === c2) {
          g2 = true;
          c2 = e2;
          d2 = f2;
          break;
        }
        if (h3 === d2) {
          g2 = true;
          d2 = e2;
          c2 = f2;
          break;
        }
        h3 = h3.sibling;
      }
      if (!g2) {
        for (h3 = f2.child; h3; ) {
          if (h3 === c2) {
            g2 = true;
            c2 = f2;
            d2 = e2;
            break;
          }
          if (h3 === d2) {
            g2 = true;
            d2 = f2;
            c2 = e2;
            break;
          }
          h3 = h3.sibling;
        }
        if (!g2)
          throw Error(p$7(189));
      }
    }
    if (c2.alternate !== d2)
      throw Error(p$7(190));
  }
  if (3 !== c2.tag)
    throw Error(p$7(188));
  return c2.stateNode.current === c2 ? a2 : b2;
}
function Zb$1(a2) {
  a2 = Yb$1(a2);
  return null !== a2 ? $b$1(a2) : null;
}
function $b$1(a2) {
  if (5 === a2.tag || 6 === a2.tag)
    return a2;
  for (a2 = a2.child; null !== a2; ) {
    var b2 = $b$1(a2);
    if (null !== b2)
      return b2;
    a2 = a2.sibling;
  }
  return null;
}
var ac$1 = ca$1.unstable_scheduleCallback, bc$1 = ca$1.unstable_cancelCallback, cc$1 = ca$1.unstable_shouldYield, dc$1 = ca$1.unstable_requestPaint, B$3 = ca$1.unstable_now, ec$1 = ca$1.unstable_getCurrentPriorityLevel, fc$1 = ca$1.unstable_ImmediatePriority, gc$1 = ca$1.unstable_UserBlockingPriority, hc$1 = ca$1.unstable_NormalPriority, ic$1 = ca$1.unstable_LowPriority, jc$1 = ca$1.unstable_IdlePriority, kc$1 = null, lc$1 = null;
function mc$1(a2) {
  if (lc$1 && "function" === typeof lc$1.onCommitFiberRoot)
    try {
      lc$1.onCommitFiberRoot(kc$1, a2, void 0, 128 === (a2.current.flags & 128));
    } catch (b2) {
    }
}
var oc$1 = Math.clz32 ? Math.clz32 : nc$1, pc$1 = Math.log, qc$1 = Math.LN2;
function nc$1(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (pc$1(a2) / qc$1 | 0) | 0;
}
var rc$1 = 64, sc$1 = 4194304;
function tc$1(a2) {
  switch (a2 & -a2) {
    case 1:
      return 1;
    case 2:
      return 2;
    case 4:
      return 4;
    case 8:
      return 8;
    case 16:
      return 16;
    case 32:
      return 32;
    case 64:
    case 128:
    case 256:
    case 512:
    case 1024:
    case 2048:
    case 4096:
    case 8192:
    case 16384:
    case 32768:
    case 65536:
    case 131072:
    case 262144:
    case 524288:
    case 1048576:
    case 2097152:
      return a2 & 4194240;
    case 4194304:
    case 8388608:
    case 16777216:
    case 33554432:
    case 67108864:
      return a2 & 130023424;
    case 134217728:
      return 134217728;
    case 268435456:
      return 268435456;
    case 536870912:
      return 536870912;
    case 1073741824:
      return 1073741824;
    default:
      return a2;
  }
}
function uc$1(a2, b2) {
  var c2 = a2.pendingLanes;
  if (0 === c2)
    return 0;
  var d2 = 0, e2 = a2.suspendedLanes, f2 = a2.pingedLanes, g2 = c2 & 268435455;
  if (0 !== g2) {
    var h3 = g2 & ~e2;
    0 !== h3 ? d2 = tc$1(h3) : (f2 &= g2, 0 !== f2 && (d2 = tc$1(f2)));
  } else
    g2 = c2 & ~e2, 0 !== g2 ? d2 = tc$1(g2) : 0 !== f2 && (d2 = tc$1(f2));
  if (0 === d2)
    return 0;
  if (0 !== b2 && b2 !== d2 && 0 === (b2 & e2) && (e2 = d2 & -d2, f2 = b2 & -b2, e2 >= f2 || 16 === e2 && 0 !== (f2 & 4194240)))
    return b2;
  0 !== (d2 & 4) && (d2 |= c2 & 16);
  b2 = a2.entangledLanes;
  if (0 !== b2)
    for (a2 = a2.entanglements, b2 &= d2; 0 < b2; )
      c2 = 31 - oc$1(b2), e2 = 1 << c2, d2 |= a2[c2], b2 &= ~e2;
  return d2;
}
function vc$1(a2, b2) {
  switch (a2) {
    case 1:
    case 2:
    case 4:
      return b2 + 250;
    case 8:
    case 16:
    case 32:
    case 64:
    case 128:
    case 256:
    case 512:
    case 1024:
    case 2048:
    case 4096:
    case 8192:
    case 16384:
    case 32768:
    case 65536:
    case 131072:
    case 262144:
    case 524288:
    case 1048576:
    case 2097152:
      return b2 + 5e3;
    case 4194304:
    case 8388608:
    case 16777216:
    case 33554432:
    case 67108864:
      return -1;
    case 134217728:
    case 268435456:
    case 536870912:
    case 1073741824:
      return -1;
    default:
      return -1;
  }
}
function wc$1(a2, b2) {
  for (var c2 = a2.suspendedLanes, d2 = a2.pingedLanes, e2 = a2.expirationTimes, f2 = a2.pendingLanes; 0 < f2; ) {
    var g2 = 31 - oc$1(f2), h3 = 1 << g2, k2 = e2[g2];
    if (-1 === k2) {
      if (0 === (h3 & c2) || 0 !== (h3 & d2))
        e2[g2] = vc$1(h3, b2);
    } else
      k2 <= b2 && (a2.expiredLanes |= h3);
    f2 &= ~h3;
  }
}
function xc$1(a2) {
  a2 = a2.pendingLanes & -1073741825;
  return 0 !== a2 ? a2 : a2 & 1073741824 ? 1073741824 : 0;
}
function yc$1() {
  var a2 = rc$1;
  rc$1 <<= 1;
  0 === (rc$1 & 4194240) && (rc$1 = 64);
  return a2;
}
function zc$1(a2) {
  for (var b2 = [], c2 = 0; 31 > c2; c2++)
    b2.push(a2);
  return b2;
}
function Ac$1(a2, b2, c2) {
  a2.pendingLanes |= b2;
  536870912 !== b2 && (a2.suspendedLanes = 0, a2.pingedLanes = 0);
  a2 = a2.eventTimes;
  b2 = 31 - oc$1(b2);
  a2[b2] = c2;
}
function Bc$1(a2, b2) {
  var c2 = a2.pendingLanes & ~b2;
  a2.pendingLanes = b2;
  a2.suspendedLanes = 0;
  a2.pingedLanes = 0;
  a2.expiredLanes &= b2;
  a2.mutableReadLanes &= b2;
  a2.entangledLanes &= b2;
  b2 = a2.entanglements;
  var d2 = a2.eventTimes;
  for (a2 = a2.expirationTimes; 0 < c2; ) {
    var e2 = 31 - oc$1(c2), f2 = 1 << e2;
    b2[e2] = 0;
    d2[e2] = -1;
    a2[e2] = -1;
    c2 &= ~f2;
  }
}
function Cc$1(a2, b2) {
  var c2 = a2.entangledLanes |= b2;
  for (a2 = a2.entanglements; c2; ) {
    var d2 = 31 - oc$1(c2), e2 = 1 << d2;
    e2 & b2 | a2[d2] & b2 && (a2[d2] |= b2);
    c2 &= ~e2;
  }
}
var C$1 = 0;
function Dc$1(a2) {
  a2 &= -a2;
  return 1 < a2 ? 4 < a2 ? 0 !== (a2 & 268435455) ? 16 : 536870912 : 4 : 1;
}
var Ec$1, Fc$1, Gc$1, Hc$1, Ic$1, Jc$1 = false, Kc$1 = [], Lc$1 = null, Mc$1 = null, Nc$1 = null, Oc$1 = /* @__PURE__ */ new Map(), Pc$1 = /* @__PURE__ */ new Map(), Qc$1 = [], Rc$1 = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
function Sc$1(a2, b2) {
  switch (a2) {
    case "focusin":
    case "focusout":
      Lc$1 = null;
      break;
    case "dragenter":
    case "dragleave":
      Mc$1 = null;
      break;
    case "mouseover":
    case "mouseout":
      Nc$1 = null;
      break;
    case "pointerover":
    case "pointerout":
      Oc$1.delete(b2.pointerId);
      break;
    case "gotpointercapture":
    case "lostpointercapture":
      Pc$1.delete(b2.pointerId);
  }
}
function Tc$1(a2, b2, c2, d2, e2, f2) {
  if (null === a2 || a2.nativeEvent !== f2)
    return a2 = { blockedOn: b2, domEventName: c2, eventSystemFlags: d2, nativeEvent: f2, targetContainers: [e2] }, null !== b2 && (b2 = Cb$2(b2), null !== b2 && Fc$1(b2)), a2;
  a2.eventSystemFlags |= d2;
  b2 = a2.targetContainers;
  null !== e2 && -1 === b2.indexOf(e2) && b2.push(e2);
  return a2;
}
function Uc$1(a2, b2, c2, d2, e2) {
  switch (b2) {
    case "focusin":
      return Lc$1 = Tc$1(Lc$1, a2, b2, c2, d2, e2), true;
    case "dragenter":
      return Mc$1 = Tc$1(Mc$1, a2, b2, c2, d2, e2), true;
    case "mouseover":
      return Nc$1 = Tc$1(Nc$1, a2, b2, c2, d2, e2), true;
    case "pointerover":
      var f2 = e2.pointerId;
      Oc$1.set(f2, Tc$1(Oc$1.get(f2) || null, a2, b2, c2, d2, e2));
      return true;
    case "gotpointercapture":
      return f2 = e2.pointerId, Pc$1.set(f2, Tc$1(Pc$1.get(f2) || null, a2, b2, c2, d2, e2)), true;
  }
  return false;
}
function Vc$1(a2) {
  var b2 = Wc$1(a2.target);
  if (null !== b2) {
    var c2 = Vb$1(b2);
    if (null !== c2) {
      if (b2 = c2.tag, 13 === b2) {
        if (b2 = Wb$1(c2), null !== b2) {
          a2.blockedOn = b2;
          Ic$1(a2.priority, function() {
            Gc$1(c2);
          });
          return;
        }
      } else if (3 === b2 && c2.stateNode.current.memoizedState.isDehydrated) {
        a2.blockedOn = 3 === c2.tag ? c2.stateNode.containerInfo : null;
        return;
      }
    }
  }
  a2.blockedOn = null;
}
function Xc$1(a2) {
  if (null !== a2.blockedOn)
    return false;
  for (var b2 = a2.targetContainers; 0 < b2.length; ) {
    var c2 = Yc$1(a2.domEventName, a2.eventSystemFlags, b2[0], a2.nativeEvent);
    if (null === c2) {
      c2 = a2.nativeEvent;
      var d2 = new c2.constructor(c2.type, c2);
      wb$2 = d2;
      c2.target.dispatchEvent(d2);
      wb$2 = null;
    } else
      return b2 = Cb$2(c2), null !== b2 && Fc$1(b2), a2.blockedOn = c2, false;
    b2.shift();
  }
  return true;
}
function Zc$1(a2, b2, c2) {
  Xc$1(a2) && c2.delete(b2);
}
function $c$1() {
  Jc$1 = false;
  null !== Lc$1 && Xc$1(Lc$1) && (Lc$1 = null);
  null !== Mc$1 && Xc$1(Mc$1) && (Mc$1 = null);
  null !== Nc$1 && Xc$1(Nc$1) && (Nc$1 = null);
  Oc$1.forEach(Zc$1);
  Pc$1.forEach(Zc$1);
}
function ad$1(a2, b2) {
  a2.blockedOn === b2 && (a2.blockedOn = null, Jc$1 || (Jc$1 = true, ca$1.unstable_scheduleCallback(ca$1.unstable_NormalPriority, $c$1)));
}
function bd$1(a2) {
  function b2(b3) {
    return ad$1(b3, a2);
  }
  if (0 < Kc$1.length) {
    ad$1(Kc$1[0], a2);
    for (var c2 = 1; c2 < Kc$1.length; c2++) {
      var d2 = Kc$1[c2];
      d2.blockedOn === a2 && (d2.blockedOn = null);
    }
  }
  null !== Lc$1 && ad$1(Lc$1, a2);
  null !== Mc$1 && ad$1(Mc$1, a2);
  null !== Nc$1 && ad$1(Nc$1, a2);
  Oc$1.forEach(b2);
  Pc$1.forEach(b2);
  for (c2 = 0; c2 < Qc$1.length; c2++)
    d2 = Qc$1[c2], d2.blockedOn === a2 && (d2.blockedOn = null);
  for (; 0 < Qc$1.length && (c2 = Qc$1[0], null === c2.blockedOn); )
    Vc$1(c2), null === c2.blockedOn && Qc$1.shift();
}
var cd$1 = ua$2.ReactCurrentBatchConfig, dd$1 = true;
function ed$1(a2, b2, c2, d2) {
  var e2 = C$1, f2 = cd$1.transition;
  cd$1.transition = null;
  try {
    C$1 = 1, fd$1(a2, b2, c2, d2);
  } finally {
    C$1 = e2, cd$1.transition = f2;
  }
}
function gd$1(a2, b2, c2, d2) {
  var e2 = C$1, f2 = cd$1.transition;
  cd$1.transition = null;
  try {
    C$1 = 4, fd$1(a2, b2, c2, d2);
  } finally {
    C$1 = e2, cd$1.transition = f2;
  }
}
function fd$1(a2, b2, c2, d2) {
  if (dd$1) {
    var e2 = Yc$1(a2, b2, c2, d2);
    if (null === e2)
      hd$1(a2, b2, d2, id$3, c2), Sc$1(a2, d2);
    else if (Uc$1(e2, a2, b2, c2, d2))
      d2.stopPropagation();
    else if (Sc$1(a2, d2), b2 & 4 && -1 < Rc$1.indexOf(a2)) {
      for (; null !== e2; ) {
        var f2 = Cb$2(e2);
        null !== f2 && Ec$1(f2);
        f2 = Yc$1(a2, b2, c2, d2);
        null === f2 && hd$1(a2, b2, d2, id$3, c2);
        if (f2 === e2)
          break;
        e2 = f2;
      }
      null !== e2 && d2.stopPropagation();
    } else
      hd$1(a2, b2, d2, null, c2);
  }
}
var id$3 = null;
function Yc$1(a2, b2, c2, d2) {
  id$3 = null;
  a2 = xb$2(d2);
  a2 = Wc$1(a2);
  if (null !== a2)
    if (b2 = Vb$1(a2), null === b2)
      a2 = null;
    else if (c2 = b2.tag, 13 === c2) {
      a2 = Wb$1(b2);
      if (null !== a2)
        return a2;
      a2 = null;
    } else if (3 === c2) {
      if (b2.stateNode.current.memoizedState.isDehydrated)
        return 3 === b2.tag ? b2.stateNode.containerInfo : null;
      a2 = null;
    } else
      b2 !== a2 && (a2 = null);
  id$3 = a2;
  return null;
}
function jd$1(a2) {
  switch (a2) {
    case "cancel":
    case "click":
    case "close":
    case "contextmenu":
    case "copy":
    case "cut":
    case "auxclick":
    case "dblclick":
    case "dragend":
    case "dragstart":
    case "drop":
    case "focusin":
    case "focusout":
    case "input":
    case "invalid":
    case "keydown":
    case "keypress":
    case "keyup":
    case "mousedown":
    case "mouseup":
    case "paste":
    case "pause":
    case "play":
    case "pointercancel":
    case "pointerdown":
    case "pointerup":
    case "ratechange":
    case "reset":
    case "resize":
    case "seeked":
    case "submit":
    case "touchcancel":
    case "touchend":
    case "touchstart":
    case "volumechange":
    case "change":
    case "selectionchange":
    case "textInput":
    case "compositionstart":
    case "compositionend":
    case "compositionupdate":
    case "beforeblur":
    case "afterblur":
    case "beforeinput":
    case "blur":
    case "fullscreenchange":
    case "focus":
    case "hashchange":
    case "popstate":
    case "select":
    case "selectstart":
      return 1;
    case "drag":
    case "dragenter":
    case "dragexit":
    case "dragleave":
    case "dragover":
    case "mousemove":
    case "mouseout":
    case "mouseover":
    case "pointermove":
    case "pointerout":
    case "pointerover":
    case "scroll":
    case "toggle":
    case "touchmove":
    case "wheel":
    case "mouseenter":
    case "mouseleave":
    case "pointerenter":
    case "pointerleave":
      return 4;
    case "message":
      switch (ec$1()) {
        case fc$1:
          return 1;
        case gc$1:
          return 4;
        case hc$1:
        case ic$1:
          return 16;
        case jc$1:
          return 536870912;
        default:
          return 16;
      }
    default:
      return 16;
  }
}
var kd$1 = null, ld$1 = null, md = null;
function nd() {
  if (md)
    return md;
  var a2, b2 = ld$1, c2 = b2.length, d2, e2 = "value" in kd$1 ? kd$1.value : kd$1.textContent, f2 = e2.length;
  for (a2 = 0; a2 < c2 && b2[a2] === e2[a2]; a2++)
    ;
  var g2 = c2 - a2;
  for (d2 = 1; d2 <= g2 && b2[c2 - d2] === e2[f2 - d2]; d2++)
    ;
  return md = e2.slice(a2, 1 < d2 ? 1 - d2 : void 0);
}
function od(a2) {
  var b2 = a2.keyCode;
  "charCode" in a2 ? (a2 = a2.charCode, 0 === a2 && 13 === b2 && (a2 = 13)) : a2 = b2;
  10 === a2 && (a2 = 13);
  return 32 <= a2 || 13 === a2 ? a2 : 0;
}
function pd() {
  return true;
}
function qd() {
  return false;
}
function rd(a2) {
  function b2(b3, d2, e2, f2, g2) {
    this._reactName = b3;
    this._targetInst = e2;
    this.type = d2;
    this.nativeEvent = f2;
    this.target = g2;
    this.currentTarget = null;
    for (var c2 in a2)
      a2.hasOwnProperty(c2) && (b3 = a2[c2], this[c2] = b3 ? b3(f2) : f2[c2]);
    this.isDefaultPrevented = (null != f2.defaultPrevented ? f2.defaultPrevented : false === f2.returnValue) ? pd : qd;
    this.isPropagationStopped = qd;
    return this;
  }
  A$4(b2.prototype, { preventDefault: function() {
    this.defaultPrevented = true;
    var a3 = this.nativeEvent;
    a3 && (a3.preventDefault ? a3.preventDefault() : "unknown" !== typeof a3.returnValue && (a3.returnValue = false), this.isDefaultPrevented = pd);
  }, stopPropagation: function() {
    var a3 = this.nativeEvent;
    a3 && (a3.stopPropagation ? a3.stopPropagation() : "unknown" !== typeof a3.cancelBubble && (a3.cancelBubble = true), this.isPropagationStopped = pd);
  }, persist: function() {
  }, isPersistent: pd });
  return b2;
}
var sd = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function(a2) {
  return a2.timeStamp || Date.now();
}, defaultPrevented: 0, isTrusted: 0 }, td = rd(sd), ud = A$4({}, sd, { view: 0, detail: 0 }), vd = rd(ud), wd, xd, yd, Ad = A$4({}, ud, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: zd, button: 0, buttons: 0, relatedTarget: function(a2) {
  return void 0 === a2.relatedTarget ? a2.fromElement === a2.srcElement ? a2.toElement : a2.fromElement : a2.relatedTarget;
}, movementX: function(a2) {
  if ("movementX" in a2)
    return a2.movementX;
  a2 !== yd && (yd && "mousemove" === a2.type ? (wd = a2.screenX - yd.screenX, xd = a2.screenY - yd.screenY) : xd = wd = 0, yd = a2);
  return wd;
}, movementY: function(a2) {
  return "movementY" in a2 ? a2.movementY : xd;
} }), Bd = rd(Ad), Cd = A$4({}, Ad, { dataTransfer: 0 }), Dd = rd(Cd), Ed = A$4({}, ud, { relatedTarget: 0 }), Fd = rd(Ed), Gd = A$4({}, sd, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Hd = rd(Gd), Id = A$4({}, sd, { clipboardData: function(a2) {
  return "clipboardData" in a2 ? a2.clipboardData : window.clipboardData;
} }), Jd = rd(Id), Kd = A$4({}, sd, { data: 0 }), Ld = rd(Kd), Md = {
  Esc: "Escape",
  Spacebar: " ",
  Left: "ArrowLeft",
  Up: "ArrowUp",
  Right: "ArrowRight",
  Down: "ArrowDown",
  Del: "Delete",
  Win: "OS",
  Menu: "ContextMenu",
  Apps: "ContextMenu",
  Scroll: "ScrollLock",
  MozPrintableKey: "Unidentified"
}, Nd = {
  8: "Backspace",
  9: "Tab",
  12: "Clear",
  13: "Enter",
  16: "Shift",
  17: "Control",
  18: "Alt",
  19: "Pause",
  20: "CapsLock",
  27: "Escape",
  32: " ",
  33: "PageUp",
  34: "PageDown",
  35: "End",
  36: "Home",
  37: "ArrowLeft",
  38: "ArrowUp",
  39: "ArrowRight",
  40: "ArrowDown",
  45: "Insert",
  46: "Delete",
  112: "F1",
  113: "F2",
  114: "F3",
  115: "F4",
  116: "F5",
  117: "F6",
  118: "F7",
  119: "F8",
  120: "F9",
  121: "F10",
  122: "F11",
  123: "F12",
  144: "NumLock",
  145: "ScrollLock",
  224: "Meta"
}, Od = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" };
function Pd(a2) {
  var b2 = this.nativeEvent;
  return b2.getModifierState ? b2.getModifierState(a2) : (a2 = Od[a2]) ? !!b2[a2] : false;
}
function zd() {
  return Pd;
}
var Qd = A$4({}, ud, { key: function(a2) {
  if (a2.key) {
    var b2 = Md[a2.key] || a2.key;
    if ("Unidentified" !== b2)
      return b2;
  }
  return "keypress" === a2.type ? (a2 = od(a2), 13 === a2 ? "Enter" : String.fromCharCode(a2)) : "keydown" === a2.type || "keyup" === a2.type ? Nd[a2.keyCode] || "Unidentified" : "";
}, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: zd, charCode: function(a2) {
  return "keypress" === a2.type ? od(a2) : 0;
}, keyCode: function(a2) {
  return "keydown" === a2.type || "keyup" === a2.type ? a2.keyCode : 0;
}, which: function(a2) {
  return "keypress" === a2.type ? od(a2) : "keydown" === a2.type || "keyup" === a2.type ? a2.keyCode : 0;
} }), Rd = rd(Qd), Sd = A$4({}, Ad, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Td = rd(Sd), Ud = A$4({}, ud, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: zd }), Vd = rd(Ud), Wd = A$4({}, sd, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Xd = rd(Wd), Yd = A$4({}, Ad, {
  deltaX: function(a2) {
    return "deltaX" in a2 ? a2.deltaX : "wheelDeltaX" in a2 ? -a2.wheelDeltaX : 0;
  },
  deltaY: function(a2) {
    return "deltaY" in a2 ? a2.deltaY : "wheelDeltaY" in a2 ? -a2.wheelDeltaY : "wheelDelta" in a2 ? -a2.wheelDelta : 0;
  },
  deltaZ: 0,
  deltaMode: 0
}), Zd = rd(Yd), $d = [9, 13, 27, 32], ae = ia$2 && "CompositionEvent" in window, be$1 = null;
ia$2 && "documentMode" in document && (be$1 = document.documentMode);
var ce$1 = ia$2 && "TextEvent" in window && !be$1, de$1 = ia$2 && (!ae || be$1 && 8 < be$1 && 11 >= be$1), ee = String.fromCharCode(32), fe$1 = false;
function ge$1(a2, b2) {
  switch (a2) {
    case "keyup":
      return -1 !== $d.indexOf(b2.keyCode);
    case "keydown":
      return 229 !== b2.keyCode;
    case "keypress":
    case "mousedown":
    case "focusout":
      return true;
    default:
      return false;
  }
}
function he$1(a2) {
  a2 = a2.detail;
  return "object" === typeof a2 && "data" in a2 ? a2.data : null;
}
var ie$1 = false;
function je(a2, b2) {
  switch (a2) {
    case "compositionend":
      return he$1(b2);
    case "keypress":
      if (32 !== b2.which)
        return null;
      fe$1 = true;
      return ee;
    case "textInput":
      return a2 = b2.data, a2 === ee && fe$1 ? null : a2;
    default:
      return null;
  }
}
function ke(a2, b2) {
  if (ie$1)
    return "compositionend" === a2 || !ae && ge$1(a2, b2) ? (a2 = nd(), md = ld$1 = kd$1 = null, ie$1 = false, a2) : null;
  switch (a2) {
    case "paste":
      return null;
    case "keypress":
      if (!(b2.ctrlKey || b2.altKey || b2.metaKey) || b2.ctrlKey && b2.altKey) {
        if (b2.char && 1 < b2.char.length)
          return b2.char;
        if (b2.which)
          return String.fromCharCode(b2.which);
      }
      return null;
    case "compositionend":
      return de$1 && "ko" !== b2.locale ? null : b2.data;
    default:
      return null;
  }
}
var le$1 = { color: true, date: true, datetime: true, "datetime-local": true, email: true, month: true, number: true, password: true, range: true, search: true, tel: true, text: true, time: true, url: true, week: true };
function me(a2) {
  var b2 = a2 && a2.nodeName && a2.nodeName.toLowerCase();
  return "input" === b2 ? !!le$1[a2.type] : "textarea" === b2 ? true : false;
}
function ne$1(a2, b2, c2, d2) {
  Eb$2(d2);
  b2 = oe$1(b2, "onChange");
  0 < b2.length && (c2 = new td("onChange", "change", null, c2, d2), a2.push({ event: c2, listeners: b2 }));
}
var pe$1 = null, qe = null;
function re$2(a2) {
  se$1(a2, 0);
}
function te(a2) {
  var b2 = ue$1(a2);
  if (Wa$2(b2))
    return a2;
}
function ve(a2, b2) {
  if ("change" === a2)
    return b2;
}
var we = false;
if (ia$2) {
  var xe$1;
  if (ia$2) {
    var ye$1 = "oninput" in document;
    if (!ye$1) {
      var ze = document.createElement("div");
      ze.setAttribute("oninput", "return;");
      ye$1 = "function" === typeof ze.oninput;
    }
    xe$1 = ye$1;
  } else
    xe$1 = false;
  we = xe$1 && (!document.documentMode || 9 < document.documentMode);
}
function Ae$1() {
  pe$1 && (pe$1.detachEvent("onpropertychange", Be), qe = pe$1 = null);
}
function Be(a2) {
  if ("value" === a2.propertyName && te(qe)) {
    var b2 = [];
    ne$1(b2, qe, a2, xb$2(a2));
    Jb$2(re$2, b2);
  }
}
function Ce(a2, b2, c2) {
  "focusin" === a2 ? (Ae$1(), pe$1 = b2, qe = c2, pe$1.attachEvent("onpropertychange", Be)) : "focusout" === a2 && Ae$1();
}
function De(a2) {
  if ("selectionchange" === a2 || "keyup" === a2 || "keydown" === a2)
    return te(qe);
}
function Ee(a2, b2) {
  if ("click" === a2)
    return te(b2);
}
function Fe(a2, b2) {
  if ("input" === a2 || "change" === a2)
    return te(b2);
}
function Ge(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var He = "function" === typeof Object.is ? Object.is : Ge;
function Ie(a2, b2) {
  if (He(a2, b2))
    return true;
  if ("object" !== typeof a2 || null === a2 || "object" !== typeof b2 || null === b2)
    return false;
  var c2 = Object.keys(a2), d2 = Object.keys(b2);
  if (c2.length !== d2.length)
    return false;
  for (d2 = 0; d2 < c2.length; d2++) {
    var e2 = c2[d2];
    if (!ja$2.call(b2, e2) || !He(a2[e2], b2[e2]))
      return false;
  }
  return true;
}
function Je(a2) {
  for (; a2 && a2.firstChild; )
    a2 = a2.firstChild;
  return a2;
}
function Ke(a2, b2) {
  var c2 = Je(a2);
  a2 = 0;
  for (var d2; c2; ) {
    if (3 === c2.nodeType) {
      d2 = a2 + c2.textContent.length;
      if (a2 <= b2 && d2 >= b2)
        return { node: c2, offset: b2 - a2 };
      a2 = d2;
    }
    a: {
      for (; c2; ) {
        if (c2.nextSibling) {
          c2 = c2.nextSibling;
          break a;
        }
        c2 = c2.parentNode;
      }
      c2 = void 0;
    }
    c2 = Je(c2);
  }
}
function Le(a2, b2) {
  return a2 && b2 ? a2 === b2 ? true : a2 && 3 === a2.nodeType ? false : b2 && 3 === b2.nodeType ? Le(a2, b2.parentNode) : "contains" in a2 ? a2.contains(b2) : a2.compareDocumentPosition ? !!(a2.compareDocumentPosition(b2) & 16) : false : false;
}
function Me() {
  for (var a2 = window, b2 = Xa$2(); b2 instanceof a2.HTMLIFrameElement; ) {
    try {
      var c2 = "string" === typeof b2.contentWindow.location.href;
    } catch (d2) {
      c2 = false;
    }
    if (c2)
      a2 = b2.contentWindow;
    else
      break;
    b2 = Xa$2(a2.document);
  }
  return b2;
}
function Ne(a2) {
  var b2 = a2 && a2.nodeName && a2.nodeName.toLowerCase();
  return b2 && ("input" === b2 && ("text" === a2.type || "search" === a2.type || "tel" === a2.type || "url" === a2.type || "password" === a2.type) || "textarea" === b2 || "true" === a2.contentEditable);
}
function Oe(a2) {
  var b2 = Me(), c2 = a2.focusedElem, d2 = a2.selectionRange;
  if (b2 !== c2 && c2 && c2.ownerDocument && Le(c2.ownerDocument.documentElement, c2)) {
    if (null !== d2 && Ne(c2)) {
      if (b2 = d2.start, a2 = d2.end, void 0 === a2 && (a2 = b2), "selectionStart" in c2)
        c2.selectionStart = b2, c2.selectionEnd = Math.min(a2, c2.value.length);
      else if (a2 = (b2 = c2.ownerDocument || document) && b2.defaultView || window, a2.getSelection) {
        a2 = a2.getSelection();
        var e2 = c2.textContent.length, f2 = Math.min(d2.start, e2);
        d2 = void 0 === d2.end ? f2 : Math.min(d2.end, e2);
        !a2.extend && f2 > d2 && (e2 = d2, d2 = f2, f2 = e2);
        e2 = Ke(c2, f2);
        var g2 = Ke(
          c2,
          d2
        );
        e2 && g2 && (1 !== a2.rangeCount || a2.anchorNode !== e2.node || a2.anchorOffset !== e2.offset || a2.focusNode !== g2.node || a2.focusOffset !== g2.offset) && (b2 = b2.createRange(), b2.setStart(e2.node, e2.offset), a2.removeAllRanges(), f2 > d2 ? (a2.addRange(b2), a2.extend(g2.node, g2.offset)) : (b2.setEnd(g2.node, g2.offset), a2.addRange(b2)));
      }
    }
    b2 = [];
    for (a2 = c2; a2 = a2.parentNode; )
      1 === a2.nodeType && b2.push({ element: a2, left: a2.scrollLeft, top: a2.scrollTop });
    "function" === typeof c2.focus && c2.focus();
    for (c2 = 0; c2 < b2.length; c2++)
      a2 = b2[c2], a2.element.scrollLeft = a2.left, a2.element.scrollTop = a2.top;
  }
}
var Pe = ia$2 && "documentMode" in document && 11 >= document.documentMode, Qe = null, Re = null, Se$1 = null, Te$1 = false;
function Ue(a2, b2, c2) {
  var d2 = c2.window === c2 ? c2.document : 9 === c2.nodeType ? c2 : c2.ownerDocument;
  Te$1 || null == Qe || Qe !== Xa$2(d2) || (d2 = Qe, "selectionStart" in d2 && Ne(d2) ? d2 = { start: d2.selectionStart, end: d2.selectionEnd } : (d2 = (d2.ownerDocument && d2.ownerDocument.defaultView || window).getSelection(), d2 = { anchorNode: d2.anchorNode, anchorOffset: d2.anchorOffset, focusNode: d2.focusNode, focusOffset: d2.focusOffset }), Se$1 && Ie(Se$1, d2) || (Se$1 = d2, d2 = oe$1(Re, "onSelect"), 0 < d2.length && (b2 = new td("onSelect", "select", null, b2, c2), a2.push({ event: b2, listeners: d2 }), b2.target = Qe)));
}
function Ve(a2, b2) {
  var c2 = {};
  c2[a2.toLowerCase()] = b2.toLowerCase();
  c2["Webkit" + a2] = "webkit" + b2;
  c2["Moz" + a2] = "moz" + b2;
  return c2;
}
var We = { animationend: Ve("Animation", "AnimationEnd"), animationiteration: Ve("Animation", "AnimationIteration"), animationstart: Ve("Animation", "AnimationStart"), transitionend: Ve("Transition", "TransitionEnd") }, Xe = {}, Ye = {};
ia$2 && (Ye = document.createElement("div").style, "AnimationEvent" in window || (delete We.animationend.animation, delete We.animationiteration.animation, delete We.animationstart.animation), "TransitionEvent" in window || delete We.transitionend.transition);
function Ze(a2) {
  if (Xe[a2])
    return Xe[a2];
  if (!We[a2])
    return a2;
  var b2 = We[a2], c2;
  for (c2 in b2)
    if (b2.hasOwnProperty(c2) && c2 in Ye)
      return Xe[a2] = b2[c2];
  return a2;
}
var $e = Ze("animationend"), af = Ze("animationiteration"), bf = Ze("animationstart"), cf = Ze("transitionend"), df = /* @__PURE__ */ new Map(), ef = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
function ff(a2, b2) {
  df.set(a2, b2);
  fa$2(b2, [a2]);
}
for (var gf = 0; gf < ef.length; gf++) {
  var hf = ef[gf], jf = hf.toLowerCase(), kf = hf[0].toUpperCase() + hf.slice(1);
  ff(jf, "on" + kf);
}
ff($e, "onAnimationEnd");
ff(af, "onAnimationIteration");
ff(bf, "onAnimationStart");
ff("dblclick", "onDoubleClick");
ff("focusin", "onFocus");
ff("focusout", "onBlur");
ff(cf, "onTransitionEnd");
ha$2("onMouseEnter", ["mouseout", "mouseover"]);
ha$2("onMouseLeave", ["mouseout", "mouseover"]);
ha$2("onPointerEnter", ["pointerout", "pointerover"]);
ha$2("onPointerLeave", ["pointerout", "pointerover"]);
fa$2("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" "));
fa$2("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));
fa$2("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
fa$2("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" "));
fa$2("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" "));
fa$2("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
var lf = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), mf = new Set("cancel close invalid load scroll toggle".split(" ").concat(lf));
function nf(a2, b2, c2) {
  var d2 = a2.type || "unknown-event";
  a2.currentTarget = c2;
  Ub$1(d2, b2, void 0, a2);
  a2.currentTarget = null;
}
function se$1(a2, b2) {
  b2 = 0 !== (b2 & 4);
  for (var c2 = 0; c2 < a2.length; c2++) {
    var d2 = a2[c2], e2 = d2.event;
    d2 = d2.listeners;
    a: {
      var f2 = void 0;
      if (b2)
        for (var g2 = d2.length - 1; 0 <= g2; g2--) {
          var h3 = d2[g2], k2 = h3.instance, l2 = h3.currentTarget;
          h3 = h3.listener;
          if (k2 !== f2 && e2.isPropagationStopped())
            break a;
          nf(e2, h3, l2);
          f2 = k2;
        }
      else
        for (g2 = 0; g2 < d2.length; g2++) {
          h3 = d2[g2];
          k2 = h3.instance;
          l2 = h3.currentTarget;
          h3 = h3.listener;
          if (k2 !== f2 && e2.isPropagationStopped())
            break a;
          nf(e2, h3, l2);
          f2 = k2;
        }
    }
  }
  if (Qb$2)
    throw a2 = Rb$2, Qb$2 = false, Rb$2 = null, a2;
}
function D$2(a2, b2) {
  var c2 = b2[of];
  void 0 === c2 && (c2 = b2[of] = /* @__PURE__ */ new Set());
  var d2 = a2 + "__bubble";
  c2.has(d2) || (pf(b2, a2, 2, false), c2.add(d2));
}
function qf(a2, b2, c2) {
  var d2 = 0;
  b2 && (d2 |= 4);
  pf(c2, a2, d2, b2);
}
var rf = "_reactListening" + Math.random().toString(36).slice(2);
function sf(a2) {
  if (!a2[rf]) {
    a2[rf] = true;
    da$1.forEach(function(b3) {
      "selectionchange" !== b3 && (mf.has(b3) || qf(b3, false, a2), qf(b3, true, a2));
    });
    var b2 = 9 === a2.nodeType ? a2 : a2.ownerDocument;
    null === b2 || b2[rf] || (b2[rf] = true, qf("selectionchange", false, b2));
  }
}
function pf(a2, b2, c2, d2) {
  switch (jd$1(b2)) {
    case 1:
      var e2 = ed$1;
      break;
    case 4:
      e2 = gd$1;
      break;
    default:
      e2 = fd$1;
  }
  c2 = e2.bind(null, b2, c2, a2);
  e2 = void 0;
  !Lb$2 || "touchstart" !== b2 && "touchmove" !== b2 && "wheel" !== b2 || (e2 = true);
  d2 ? void 0 !== e2 ? a2.addEventListener(b2, c2, { capture: true, passive: e2 }) : a2.addEventListener(b2, c2, true) : void 0 !== e2 ? a2.addEventListener(b2, c2, { passive: e2 }) : a2.addEventListener(b2, c2, false);
}
function hd$1(a2, b2, c2, d2, e2) {
  var f2 = d2;
  if (0 === (b2 & 1) && 0 === (b2 & 2) && null !== d2)
    a:
      for (; ; ) {
        if (null === d2)
          return;
        var g2 = d2.tag;
        if (3 === g2 || 4 === g2) {
          var h3 = d2.stateNode.containerInfo;
          if (h3 === e2 || 8 === h3.nodeType && h3.parentNode === e2)
            break;
          if (4 === g2)
            for (g2 = d2.return; null !== g2; ) {
              var k2 = g2.tag;
              if (3 === k2 || 4 === k2) {
                if (k2 = g2.stateNode.containerInfo, k2 === e2 || 8 === k2.nodeType && k2.parentNode === e2)
                  return;
              }
              g2 = g2.return;
            }
          for (; null !== h3; ) {
            g2 = Wc$1(h3);
            if (null === g2)
              return;
            k2 = g2.tag;
            if (5 === k2 || 6 === k2) {
              d2 = f2 = g2;
              continue a;
            }
            h3 = h3.parentNode;
          }
        }
        d2 = d2.return;
      }
  Jb$2(function() {
    var d3 = f2, e3 = xb$2(c2), g3 = [];
    a: {
      var h4 = df.get(a2);
      if (void 0 !== h4) {
        var k3 = td, n2 = a2;
        switch (a2) {
          case "keypress":
            if (0 === od(c2))
              break a;
          case "keydown":
          case "keyup":
            k3 = Rd;
            break;
          case "focusin":
            n2 = "focus";
            k3 = Fd;
            break;
          case "focusout":
            n2 = "blur";
            k3 = Fd;
            break;
          case "beforeblur":
          case "afterblur":
            k3 = Fd;
            break;
          case "click":
            if (2 === c2.button)
              break a;
          case "auxclick":
          case "dblclick":
          case "mousedown":
          case "mousemove":
          case "mouseup":
          case "mouseout":
          case "mouseover":
          case "contextmenu":
            k3 = Bd;
            break;
          case "drag":
          case "dragend":
          case "dragenter":
          case "dragexit":
          case "dragleave":
          case "dragover":
          case "dragstart":
          case "drop":
            k3 = Dd;
            break;
          case "touchcancel":
          case "touchend":
          case "touchmove":
          case "touchstart":
            k3 = Vd;
            break;
          case $e:
          case af:
          case bf:
            k3 = Hd;
            break;
          case cf:
            k3 = Xd;
            break;
          case "scroll":
            k3 = vd;
            break;
          case "wheel":
            k3 = Zd;
            break;
          case "copy":
          case "cut":
          case "paste":
            k3 = Jd;
            break;
          case "gotpointercapture":
          case "lostpointercapture":
          case "pointercancel":
          case "pointerdown":
          case "pointermove":
          case "pointerout":
          case "pointerover":
          case "pointerup":
            k3 = Td;
        }
        var t2 = 0 !== (b2 & 4), J2 = !t2 && "scroll" === a2, x2 = t2 ? null !== h4 ? h4 + "Capture" : null : h4;
        t2 = [];
        for (var w2 = d3, u2; null !== w2; ) {
          u2 = w2;
          var F2 = u2.stateNode;
          5 === u2.tag && null !== F2 && (u2 = F2, null !== x2 && (F2 = Kb$2(w2, x2), null != F2 && t2.push(tf(w2, F2, u2))));
          if (J2)
            break;
          w2 = w2.return;
        }
        0 < t2.length && (h4 = new k3(h4, n2, null, c2, e3), g3.push({ event: h4, listeners: t2 }));
      }
    }
    if (0 === (b2 & 7)) {
      a: {
        h4 = "mouseover" === a2 || "pointerover" === a2;
        k3 = "mouseout" === a2 || "pointerout" === a2;
        if (h4 && c2 !== wb$2 && (n2 = c2.relatedTarget || c2.fromElement) && (Wc$1(n2) || n2[uf]))
          break a;
        if (k3 || h4) {
          h4 = e3.window === e3 ? e3 : (h4 = e3.ownerDocument) ? h4.defaultView || h4.parentWindow : window;
          if (k3) {
            if (n2 = c2.relatedTarget || c2.toElement, k3 = d3, n2 = n2 ? Wc$1(n2) : null, null !== n2 && (J2 = Vb$1(n2), n2 !== J2 || 5 !== n2.tag && 6 !== n2.tag))
              n2 = null;
          } else
            k3 = null, n2 = d3;
          if (k3 !== n2) {
            t2 = Bd;
            F2 = "onMouseLeave";
            x2 = "onMouseEnter";
            w2 = "mouse";
            if ("pointerout" === a2 || "pointerover" === a2)
              t2 = Td, F2 = "onPointerLeave", x2 = "onPointerEnter", w2 = "pointer";
            J2 = null == k3 ? h4 : ue$1(k3);
            u2 = null == n2 ? h4 : ue$1(n2);
            h4 = new t2(F2, w2 + "leave", k3, c2, e3);
            h4.target = J2;
            h4.relatedTarget = u2;
            F2 = null;
            Wc$1(e3) === d3 && (t2 = new t2(x2, w2 + "enter", n2, c2, e3), t2.target = u2, t2.relatedTarget = J2, F2 = t2);
            J2 = F2;
            if (k3 && n2)
              b: {
                t2 = k3;
                x2 = n2;
                w2 = 0;
                for (u2 = t2; u2; u2 = vf(u2))
                  w2++;
                u2 = 0;
                for (F2 = x2; F2; F2 = vf(F2))
                  u2++;
                for (; 0 < w2 - u2; )
                  t2 = vf(t2), w2--;
                for (; 0 < u2 - w2; )
                  x2 = vf(x2), u2--;
                for (; w2--; ) {
                  if (t2 === x2 || null !== x2 && t2 === x2.alternate)
                    break b;
                  t2 = vf(t2);
                  x2 = vf(x2);
                }
                t2 = null;
              }
            else
              t2 = null;
            null !== k3 && wf(g3, h4, k3, t2, false);
            null !== n2 && null !== J2 && wf(g3, J2, n2, t2, true);
          }
        }
      }
      a: {
        h4 = d3 ? ue$1(d3) : window;
        k3 = h4.nodeName && h4.nodeName.toLowerCase();
        if ("select" === k3 || "input" === k3 && "file" === h4.type)
          var na2 = ve;
        else if (me(h4))
          if (we)
            na2 = Fe;
          else {
            na2 = De;
            var xa2 = Ce;
          }
        else
          (k3 = h4.nodeName) && "input" === k3.toLowerCase() && ("checkbox" === h4.type || "radio" === h4.type) && (na2 = Ee);
        if (na2 && (na2 = na2(a2, d3))) {
          ne$1(g3, na2, c2, e3);
          break a;
        }
        xa2 && xa2(a2, h4, d3);
        "focusout" === a2 && (xa2 = h4._wrapperState) && xa2.controlled && "number" === h4.type && cb$2(h4, "number", h4.value);
      }
      xa2 = d3 ? ue$1(d3) : window;
      switch (a2) {
        case "focusin":
          if (me(xa2) || "true" === xa2.contentEditable)
            Qe = xa2, Re = d3, Se$1 = null;
          break;
        case "focusout":
          Se$1 = Re = Qe = null;
          break;
        case "mousedown":
          Te$1 = true;
          break;
        case "contextmenu":
        case "mouseup":
        case "dragend":
          Te$1 = false;
          Ue(g3, c2, e3);
          break;
        case "selectionchange":
          if (Pe)
            break;
        case "keydown":
        case "keyup":
          Ue(g3, c2, e3);
      }
      var $a2;
      if (ae)
        b: {
          switch (a2) {
            case "compositionstart":
              var ba2 = "onCompositionStart";
              break b;
            case "compositionend":
              ba2 = "onCompositionEnd";
              break b;
            case "compositionupdate":
              ba2 = "onCompositionUpdate";
              break b;
          }
          ba2 = void 0;
        }
      else
        ie$1 ? ge$1(a2, c2) && (ba2 = "onCompositionEnd") : "keydown" === a2 && 229 === c2.keyCode && (ba2 = "onCompositionStart");
      ba2 && (de$1 && "ko" !== c2.locale && (ie$1 || "onCompositionStart" !== ba2 ? "onCompositionEnd" === ba2 && ie$1 && ($a2 = nd()) : (kd$1 = e3, ld$1 = "value" in kd$1 ? kd$1.value : kd$1.textContent, ie$1 = true)), xa2 = oe$1(d3, ba2), 0 < xa2.length && (ba2 = new Ld(ba2, a2, null, c2, e3), g3.push({ event: ba2, listeners: xa2 }), $a2 ? ba2.data = $a2 : ($a2 = he$1(c2), null !== $a2 && (ba2.data = $a2))));
      if ($a2 = ce$1 ? je(a2, c2) : ke(a2, c2))
        d3 = oe$1(d3, "onBeforeInput"), 0 < d3.length && (e3 = new Ld("onBeforeInput", "beforeinput", null, c2, e3), g3.push({ event: e3, listeners: d3 }), e3.data = $a2);
    }
    se$1(g3, b2);
  });
}
function tf(a2, b2, c2) {
  return { instance: a2, listener: b2, currentTarget: c2 };
}
function oe$1(a2, b2) {
  for (var c2 = b2 + "Capture", d2 = []; null !== a2; ) {
    var e2 = a2, f2 = e2.stateNode;
    5 === e2.tag && null !== f2 && (e2 = f2, f2 = Kb$2(a2, c2), null != f2 && d2.unshift(tf(a2, f2, e2)), f2 = Kb$2(a2, b2), null != f2 && d2.push(tf(a2, f2, e2)));
    a2 = a2.return;
  }
  return d2;
}
function vf(a2) {
  if (null === a2)
    return null;
  do
    a2 = a2.return;
  while (a2 && 5 !== a2.tag);
  return a2 ? a2 : null;
}
function wf(a2, b2, c2, d2, e2) {
  for (var f2 = b2._reactName, g2 = []; null !== c2 && c2 !== d2; ) {
    var h3 = c2, k2 = h3.alternate, l2 = h3.stateNode;
    if (null !== k2 && k2 === d2)
      break;
    5 === h3.tag && null !== l2 && (h3 = l2, e2 ? (k2 = Kb$2(c2, f2), null != k2 && g2.unshift(tf(c2, k2, h3))) : e2 || (k2 = Kb$2(c2, f2), null != k2 && g2.push(tf(c2, k2, h3))));
    c2 = c2.return;
  }
  0 !== g2.length && a2.push({ event: b2, listeners: g2 });
}
var xf = /\r\n?/g, yf = /\u0000|\uFFFD/g;
function zf(a2) {
  return ("string" === typeof a2 ? a2 : "" + a2).replace(xf, "\n").replace(yf, "");
}
function Af(a2, b2, c2) {
  b2 = zf(b2);
  if (zf(a2) !== b2 && c2)
    throw Error(p$7(425));
}
function Bf() {
}
var Cf = null, Df = null;
function Ef(a2, b2) {
  return "textarea" === a2 || "noscript" === a2 || "string" === typeof b2.children || "number" === typeof b2.children || "object" === typeof b2.dangerouslySetInnerHTML && null !== b2.dangerouslySetInnerHTML && null != b2.dangerouslySetInnerHTML.__html;
}
var Ff = "function" === typeof setTimeout ? setTimeout : void 0, Gf = "function" === typeof clearTimeout ? clearTimeout : void 0, Hf = "function" === typeof Promise ? Promise : void 0, Jf = "function" === typeof queueMicrotask ? queueMicrotask : "undefined" !== typeof Hf ? function(a2) {
  return Hf.resolve(null).then(a2).catch(If);
} : Ff;
function If(a2) {
  setTimeout(function() {
    throw a2;
  });
}
function Kf(a2, b2) {
  var c2 = b2, d2 = 0;
  do {
    var e2 = c2.nextSibling;
    a2.removeChild(c2);
    if (e2 && 8 === e2.nodeType)
      if (c2 = e2.data, "/$" === c2) {
        if (0 === d2) {
          a2.removeChild(e2);
          bd$1(b2);
          return;
        }
        d2--;
      } else
        "$" !== c2 && "$?" !== c2 && "$!" !== c2 || d2++;
    c2 = e2;
  } while (c2);
  bd$1(b2);
}
function Lf(a2) {
  for (; null != a2; a2 = a2.nextSibling) {
    var b2 = a2.nodeType;
    if (1 === b2 || 3 === b2)
      break;
    if (8 === b2) {
      b2 = a2.data;
      if ("$" === b2 || "$!" === b2 || "$?" === b2)
        break;
      if ("/$" === b2)
        return null;
    }
  }
  return a2;
}
function Mf(a2) {
  a2 = a2.previousSibling;
  for (var b2 = 0; a2; ) {
    if (8 === a2.nodeType) {
      var c2 = a2.data;
      if ("$" === c2 || "$!" === c2 || "$?" === c2) {
        if (0 === b2)
          return a2;
        b2--;
      } else
        "/$" === c2 && b2++;
    }
    a2 = a2.previousSibling;
  }
  return null;
}
var Nf = Math.random().toString(36).slice(2), Of = "__reactFiber$" + Nf, Pf = "__reactProps$" + Nf, uf = "__reactContainer$" + Nf, of = "__reactEvents$" + Nf, Qf = "__reactListeners$" + Nf, Rf = "__reactHandles$" + Nf;
function Wc$1(a2) {
  var b2 = a2[Of];
  if (b2)
    return b2;
  for (var c2 = a2.parentNode; c2; ) {
    if (b2 = c2[uf] || c2[Of]) {
      c2 = b2.alternate;
      if (null !== b2.child || null !== c2 && null !== c2.child)
        for (a2 = Mf(a2); null !== a2; ) {
          if (c2 = a2[Of])
            return c2;
          a2 = Mf(a2);
        }
      return b2;
    }
    a2 = c2;
    c2 = a2.parentNode;
  }
  return null;
}
function Cb$2(a2) {
  a2 = a2[Of] || a2[uf];
  return !a2 || 5 !== a2.tag && 6 !== a2.tag && 13 !== a2.tag && 3 !== a2.tag ? null : a2;
}
function ue$1(a2) {
  if (5 === a2.tag || 6 === a2.tag)
    return a2.stateNode;
  throw Error(p$7(33));
}
function Db$2(a2) {
  return a2[Pf] || null;
}
var Sf = [], Tf = -1;
function Uf(a2) {
  return { current: a2 };
}
function E$3(a2) {
  0 > Tf || (a2.current = Sf[Tf], Sf[Tf] = null, Tf--);
}
function G$2(a2, b2) {
  Tf++;
  Sf[Tf] = a2.current;
  a2.current = b2;
}
var Vf = {}, H$3 = Uf(Vf), Wf = Uf(false), Xf = Vf;
function Yf(a2, b2) {
  var c2 = a2.type.contextTypes;
  if (!c2)
    return Vf;
  var d2 = a2.stateNode;
  if (d2 && d2.__reactInternalMemoizedUnmaskedChildContext === b2)
    return d2.__reactInternalMemoizedMaskedChildContext;
  var e2 = {}, f2;
  for (f2 in c2)
    e2[f2] = b2[f2];
  d2 && (a2 = a2.stateNode, a2.__reactInternalMemoizedUnmaskedChildContext = b2, a2.__reactInternalMemoizedMaskedChildContext = e2);
  return e2;
}
function Zf(a2) {
  a2 = a2.childContextTypes;
  return null !== a2 && void 0 !== a2;
}
function $f() {
  E$3(Wf);
  E$3(H$3);
}
function ag(a2, b2, c2) {
  if (H$3.current !== Vf)
    throw Error(p$7(168));
  G$2(H$3, b2);
  G$2(Wf, c2);
}
function bg(a2, b2, c2) {
  var d2 = a2.stateNode;
  b2 = b2.childContextTypes;
  if ("function" !== typeof d2.getChildContext)
    return c2;
  d2 = d2.getChildContext();
  for (var e2 in d2)
    if (!(e2 in b2))
      throw Error(p$7(108, Ra$2(a2) || "Unknown", e2));
  return A$4({}, c2, d2);
}
function cg(a2) {
  a2 = (a2 = a2.stateNode) && a2.__reactInternalMemoizedMergedChildContext || Vf;
  Xf = H$3.current;
  G$2(H$3, a2);
  G$2(Wf, Wf.current);
  return true;
}
function dg(a2, b2, c2) {
  var d2 = a2.stateNode;
  if (!d2)
    throw Error(p$7(169));
  c2 ? (a2 = bg(a2, b2, Xf), d2.__reactInternalMemoizedMergedChildContext = a2, E$3(Wf), E$3(H$3), G$2(H$3, a2)) : E$3(Wf);
  G$2(Wf, c2);
}
var eg = null, fg = false, gg = false;
function hg(a2) {
  null === eg ? eg = [a2] : eg.push(a2);
}
function ig(a2) {
  fg = true;
  hg(a2);
}
function jg() {
  if (!gg && null !== eg) {
    gg = true;
    var a2 = 0, b2 = C$1;
    try {
      var c2 = eg;
      for (C$1 = 1; a2 < c2.length; a2++) {
        var d2 = c2[a2];
        do
          d2 = d2(true);
        while (null !== d2);
      }
      eg = null;
      fg = false;
    } catch (e2) {
      throw null !== eg && (eg = eg.slice(a2 + 1)), ac$1(fc$1, jg), e2;
    } finally {
      C$1 = b2, gg = false;
    }
  }
  return null;
}
var kg = [], lg = 0, mg = null, ng = 0, og = [], pg = 0, qg = null, rg = 1, sg = "";
function tg(a2, b2) {
  kg[lg++] = ng;
  kg[lg++] = mg;
  mg = a2;
  ng = b2;
}
function ug(a2, b2, c2) {
  og[pg++] = rg;
  og[pg++] = sg;
  og[pg++] = qg;
  qg = a2;
  var d2 = rg;
  a2 = sg;
  var e2 = 32 - oc$1(d2) - 1;
  d2 &= ~(1 << e2);
  c2 += 1;
  var f2 = 32 - oc$1(b2) + e2;
  if (30 < f2) {
    var g2 = e2 - e2 % 5;
    f2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    e2 -= g2;
    rg = 1 << 32 - oc$1(b2) + e2 | c2 << e2 | d2;
    sg = f2 + a2;
  } else
    rg = 1 << f2 | c2 << e2 | d2, sg = a2;
}
function vg(a2) {
  null !== a2.return && (tg(a2, 1), ug(a2, 1, 0));
}
function wg(a2) {
  for (; a2 === mg; )
    mg = kg[--lg], kg[lg] = null, ng = kg[--lg], kg[lg] = null;
  for (; a2 === qg; )
    qg = og[--pg], og[pg] = null, sg = og[--pg], og[pg] = null, rg = og[--pg], og[pg] = null;
}
var xg = null, yg = null, I$3 = false, zg = null;
function Ag(a2, b2) {
  var c2 = Bg(5, null, null, 0);
  c2.elementType = "DELETED";
  c2.stateNode = b2;
  c2.return = a2;
  b2 = a2.deletions;
  null === b2 ? (a2.deletions = [c2], a2.flags |= 16) : b2.push(c2);
}
function Cg(a2, b2) {
  switch (a2.tag) {
    case 5:
      var c2 = a2.type;
      b2 = 1 !== b2.nodeType || c2.toLowerCase() !== b2.nodeName.toLowerCase() ? null : b2;
      return null !== b2 ? (a2.stateNode = b2, xg = a2, yg = Lf(b2.firstChild), true) : false;
    case 6:
      return b2 = "" === a2.pendingProps || 3 !== b2.nodeType ? null : b2, null !== b2 ? (a2.stateNode = b2, xg = a2, yg = null, true) : false;
    case 13:
      return b2 = 8 !== b2.nodeType ? null : b2, null !== b2 ? (c2 = null !== qg ? { id: rg, overflow: sg } : null, a2.memoizedState = { dehydrated: b2, treeContext: c2, retryLane: 1073741824 }, c2 = Bg(18, null, null, 0), c2.stateNode = b2, c2.return = a2, a2.child = c2, xg = a2, yg = null, true) : false;
    default:
      return false;
  }
}
function Dg(a2) {
  return 0 !== (a2.mode & 1) && 0 === (a2.flags & 128);
}
function Eg(a2) {
  if (I$3) {
    var b2 = yg;
    if (b2) {
      var c2 = b2;
      if (!Cg(a2, b2)) {
        if (Dg(a2))
          throw Error(p$7(418));
        b2 = Lf(c2.nextSibling);
        var d2 = xg;
        b2 && Cg(a2, b2) ? Ag(d2, c2) : (a2.flags = a2.flags & -4097 | 2, I$3 = false, xg = a2);
      }
    } else {
      if (Dg(a2))
        throw Error(p$7(418));
      a2.flags = a2.flags & -4097 | 2;
      I$3 = false;
      xg = a2;
    }
  }
}
function Fg(a2) {
  for (a2 = a2.return; null !== a2 && 5 !== a2.tag && 3 !== a2.tag && 13 !== a2.tag; )
    a2 = a2.return;
  xg = a2;
}
function Gg(a2) {
  if (a2 !== xg)
    return false;
  if (!I$3)
    return Fg(a2), I$3 = true, false;
  var b2;
  (b2 = 3 !== a2.tag) && !(b2 = 5 !== a2.tag) && (b2 = a2.type, b2 = "head" !== b2 && "body" !== b2 && !Ef(a2.type, a2.memoizedProps));
  if (b2 && (b2 = yg)) {
    if (Dg(a2))
      throw Hg(), Error(p$7(418));
    for (; b2; )
      Ag(a2, b2), b2 = Lf(b2.nextSibling);
  }
  Fg(a2);
  if (13 === a2.tag) {
    a2 = a2.memoizedState;
    a2 = null !== a2 ? a2.dehydrated : null;
    if (!a2)
      throw Error(p$7(317));
    a: {
      a2 = a2.nextSibling;
      for (b2 = 0; a2; ) {
        if (8 === a2.nodeType) {
          var c2 = a2.data;
          if ("/$" === c2) {
            if (0 === b2) {
              yg = Lf(a2.nextSibling);
              break a;
            }
            b2--;
          } else
            "$" !== c2 && "$!" !== c2 && "$?" !== c2 || b2++;
        }
        a2 = a2.nextSibling;
      }
      yg = null;
    }
  } else
    yg = xg ? Lf(a2.stateNode.nextSibling) : null;
  return true;
}
function Hg() {
  for (var a2 = yg; a2; )
    a2 = Lf(a2.nextSibling);
}
function Ig() {
  yg = xg = null;
  I$3 = false;
}
function Jg(a2) {
  null === zg ? zg = [a2] : zg.push(a2);
}
var Kg = ua$2.ReactCurrentBatchConfig;
function Lg(a2, b2, c2) {
  a2 = c2.ref;
  if (null !== a2 && "function" !== typeof a2 && "object" !== typeof a2) {
    if (c2._owner) {
      c2 = c2._owner;
      if (c2) {
        if (1 !== c2.tag)
          throw Error(p$7(309));
        var d2 = c2.stateNode;
      }
      if (!d2)
        throw Error(p$7(147, a2));
      var e2 = d2, f2 = "" + a2;
      if (null !== b2 && null !== b2.ref && "function" === typeof b2.ref && b2.ref._stringRef === f2)
        return b2.ref;
      b2 = function(a3) {
        var b3 = e2.refs;
        null === a3 ? delete b3[f2] : b3[f2] = a3;
      };
      b2._stringRef = f2;
      return b2;
    }
    if ("string" !== typeof a2)
      throw Error(p$7(284));
    if (!c2._owner)
      throw Error(p$7(290, a2));
  }
  return a2;
}
function Mg(a2, b2) {
  a2 = Object.prototype.toString.call(b2);
  throw Error(p$7(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(b2).join(", ") + "}" : a2));
}
function Ng(a2) {
  var b2 = a2._init;
  return b2(a2._payload);
}
function Og(a2) {
  function b2(b3, c3) {
    if (a2) {
      var d3 = b3.deletions;
      null === d3 ? (b3.deletions = [c3], b3.flags |= 16) : d3.push(c3);
    }
  }
  function c2(c3, d3) {
    if (!a2)
      return null;
    for (; null !== d3; )
      b2(c3, d3), d3 = d3.sibling;
    return null;
  }
  function d2(a3, b3) {
    for (a3 = /* @__PURE__ */ new Map(); null !== b3; )
      null !== b3.key ? a3.set(b3.key, b3) : a3.set(b3.index, b3), b3 = b3.sibling;
    return a3;
  }
  function e2(a3, b3) {
    a3 = Pg(a3, b3);
    a3.index = 0;
    a3.sibling = null;
    return a3;
  }
  function f2(b3, c3, d3) {
    b3.index = d3;
    if (!a2)
      return b3.flags |= 1048576, c3;
    d3 = b3.alternate;
    if (null !== d3)
      return d3 = d3.index, d3 < c3 ? (b3.flags |= 2, c3) : d3;
    b3.flags |= 2;
    return c3;
  }
  function g2(b3) {
    a2 && null === b3.alternate && (b3.flags |= 2);
    return b3;
  }
  function h3(a3, b3, c3, d3) {
    if (null === b3 || 6 !== b3.tag)
      return b3 = Qg(c3, a3.mode, d3), b3.return = a3, b3;
    b3 = e2(b3, c3);
    b3.return = a3;
    return b3;
  }
  function k2(a3, b3, c3, d3) {
    var f3 = c3.type;
    if (f3 === ya$2)
      return m2(a3, b3, c3.props.children, d3, c3.key);
    if (null !== b3 && (b3.elementType === f3 || "object" === typeof f3 && null !== f3 && f3.$$typeof === Ha$2 && Ng(f3) === b3.type))
      return d3 = e2(b3, c3.props), d3.ref = Lg(a3, b3, c3), d3.return = a3, d3;
    d3 = Rg(c3.type, c3.key, c3.props, null, a3.mode, d3);
    d3.ref = Lg(a3, b3, c3);
    d3.return = a3;
    return d3;
  }
  function l2(a3, b3, c3, d3) {
    if (null === b3 || 4 !== b3.tag || b3.stateNode.containerInfo !== c3.containerInfo || b3.stateNode.implementation !== c3.implementation)
      return b3 = Sg(c3, a3.mode, d3), b3.return = a3, b3;
    b3 = e2(b3, c3.children || []);
    b3.return = a3;
    return b3;
  }
  function m2(a3, b3, c3, d3, f3) {
    if (null === b3 || 7 !== b3.tag)
      return b3 = Tg(c3, a3.mode, d3, f3), b3.return = a3, b3;
    b3 = e2(b3, c3);
    b3.return = a3;
    return b3;
  }
  function q2(a3, b3, c3) {
    if ("string" === typeof b3 && "" !== b3 || "number" === typeof b3)
      return b3 = Qg("" + b3, a3.mode, c3), b3.return = a3, b3;
    if ("object" === typeof b3 && null !== b3) {
      switch (b3.$$typeof) {
        case va$2:
          return c3 = Rg(b3.type, b3.key, b3.props, null, a3.mode, c3), c3.ref = Lg(a3, null, b3), c3.return = a3, c3;
        case wa$2:
          return b3 = Sg(b3, a3.mode, c3), b3.return = a3, b3;
        case Ha$2:
          var d3 = b3._init;
          return q2(a3, d3(b3._payload), c3);
      }
      if (eb$2(b3) || Ka$2(b3))
        return b3 = Tg(b3, a3.mode, c3, null), b3.return = a3, b3;
      Mg(a3, b3);
    }
    return null;
  }
  function r2(a3, b3, c3, d3) {
    var e3 = null !== b3 ? b3.key : null;
    if ("string" === typeof c3 && "" !== c3 || "number" === typeof c3)
      return null !== e3 ? null : h3(a3, b3, "" + c3, d3);
    if ("object" === typeof c3 && null !== c3) {
      switch (c3.$$typeof) {
        case va$2:
          return c3.key === e3 ? k2(a3, b3, c3, d3) : null;
        case wa$2:
          return c3.key === e3 ? l2(a3, b3, c3, d3) : null;
        case Ha$2:
          return e3 = c3._init, r2(
            a3,
            b3,
            e3(c3._payload),
            d3
          );
      }
      if (eb$2(c3) || Ka$2(c3))
        return null !== e3 ? null : m2(a3, b3, c3, d3, null);
      Mg(a3, c3);
    }
    return null;
  }
  function y2(a3, b3, c3, d3, e3) {
    if ("string" === typeof d3 && "" !== d3 || "number" === typeof d3)
      return a3 = a3.get(c3) || null, h3(b3, a3, "" + d3, e3);
    if ("object" === typeof d3 && null !== d3) {
      switch (d3.$$typeof) {
        case va$2:
          return a3 = a3.get(null === d3.key ? c3 : d3.key) || null, k2(b3, a3, d3, e3);
        case wa$2:
          return a3 = a3.get(null === d3.key ? c3 : d3.key) || null, l2(b3, a3, d3, e3);
        case Ha$2:
          var f3 = d3._init;
          return y2(a3, b3, c3, f3(d3._payload), e3);
      }
      if (eb$2(d3) || Ka$2(d3))
        return a3 = a3.get(c3) || null, m2(b3, a3, d3, e3, null);
      Mg(b3, d3);
    }
    return null;
  }
  function n2(e3, g3, h4, k3) {
    for (var l3 = null, m3 = null, u2 = g3, w2 = g3 = 0, x2 = null; null !== u2 && w2 < h4.length; w2++) {
      u2.index > w2 ? (x2 = u2, u2 = null) : x2 = u2.sibling;
      var n3 = r2(e3, u2, h4[w2], k3);
      if (null === n3) {
        null === u2 && (u2 = x2);
        break;
      }
      a2 && u2 && null === n3.alternate && b2(e3, u2);
      g3 = f2(n3, g3, w2);
      null === m3 ? l3 = n3 : m3.sibling = n3;
      m3 = n3;
      u2 = x2;
    }
    if (w2 === h4.length)
      return c2(e3, u2), I$3 && tg(e3, w2), l3;
    if (null === u2) {
      for (; w2 < h4.length; w2++)
        u2 = q2(e3, h4[w2], k3), null !== u2 && (g3 = f2(u2, g3, w2), null === m3 ? l3 = u2 : m3.sibling = u2, m3 = u2);
      I$3 && tg(e3, w2);
      return l3;
    }
    for (u2 = d2(e3, u2); w2 < h4.length; w2++)
      x2 = y2(u2, e3, w2, h4[w2], k3), null !== x2 && (a2 && null !== x2.alternate && u2.delete(null === x2.key ? w2 : x2.key), g3 = f2(x2, g3, w2), null === m3 ? l3 = x2 : m3.sibling = x2, m3 = x2);
    a2 && u2.forEach(function(a3) {
      return b2(e3, a3);
    });
    I$3 && tg(e3, w2);
    return l3;
  }
  function t2(e3, g3, h4, k3) {
    var l3 = Ka$2(h4);
    if ("function" !== typeof l3)
      throw Error(p$7(150));
    h4 = l3.call(h4);
    if (null == h4)
      throw Error(p$7(151));
    for (var u2 = l3 = null, m3 = g3, w2 = g3 = 0, x2 = null, n3 = h4.next(); null !== m3 && !n3.done; w2++, n3 = h4.next()) {
      m3.index > w2 ? (x2 = m3, m3 = null) : x2 = m3.sibling;
      var t3 = r2(e3, m3, n3.value, k3);
      if (null === t3) {
        null === m3 && (m3 = x2);
        break;
      }
      a2 && m3 && null === t3.alternate && b2(e3, m3);
      g3 = f2(t3, g3, w2);
      null === u2 ? l3 = t3 : u2.sibling = t3;
      u2 = t3;
      m3 = x2;
    }
    if (n3.done)
      return c2(
        e3,
        m3
      ), I$3 && tg(e3, w2), l3;
    if (null === m3) {
      for (; !n3.done; w2++, n3 = h4.next())
        n3 = q2(e3, n3.value, k3), null !== n3 && (g3 = f2(n3, g3, w2), null === u2 ? l3 = n3 : u2.sibling = n3, u2 = n3);
      I$3 && tg(e3, w2);
      return l3;
    }
    for (m3 = d2(e3, m3); !n3.done; w2++, n3 = h4.next())
      n3 = y2(m3, e3, w2, n3.value, k3), null !== n3 && (a2 && null !== n3.alternate && m3.delete(null === n3.key ? w2 : n3.key), g3 = f2(n3, g3, w2), null === u2 ? l3 = n3 : u2.sibling = n3, u2 = n3);
    a2 && m3.forEach(function(a3) {
      return b2(e3, a3);
    });
    I$3 && tg(e3, w2);
    return l3;
  }
  function J2(a3, d3, f3, h4) {
    "object" === typeof f3 && null !== f3 && f3.type === ya$2 && null === f3.key && (f3 = f3.props.children);
    if ("object" === typeof f3 && null !== f3) {
      switch (f3.$$typeof) {
        case va$2:
          a: {
            for (var k3 = f3.key, l3 = d3; null !== l3; ) {
              if (l3.key === k3) {
                k3 = f3.type;
                if (k3 === ya$2) {
                  if (7 === l3.tag) {
                    c2(a3, l3.sibling);
                    d3 = e2(l3, f3.props.children);
                    d3.return = a3;
                    a3 = d3;
                    break a;
                  }
                } else if (l3.elementType === k3 || "object" === typeof k3 && null !== k3 && k3.$$typeof === Ha$2 && Ng(k3) === l3.type) {
                  c2(a3, l3.sibling);
                  d3 = e2(l3, f3.props);
                  d3.ref = Lg(a3, l3, f3);
                  d3.return = a3;
                  a3 = d3;
                  break a;
                }
                c2(a3, l3);
                break;
              } else
                b2(a3, l3);
              l3 = l3.sibling;
            }
            f3.type === ya$2 ? (d3 = Tg(f3.props.children, a3.mode, h4, f3.key), d3.return = a3, a3 = d3) : (h4 = Rg(f3.type, f3.key, f3.props, null, a3.mode, h4), h4.ref = Lg(a3, d3, f3), h4.return = a3, a3 = h4);
          }
          return g2(a3);
        case wa$2:
          a: {
            for (l3 = f3.key; null !== d3; ) {
              if (d3.key === l3)
                if (4 === d3.tag && d3.stateNode.containerInfo === f3.containerInfo && d3.stateNode.implementation === f3.implementation) {
                  c2(a3, d3.sibling);
                  d3 = e2(d3, f3.children || []);
                  d3.return = a3;
                  a3 = d3;
                  break a;
                } else {
                  c2(a3, d3);
                  break;
                }
              else
                b2(a3, d3);
              d3 = d3.sibling;
            }
            d3 = Sg(f3, a3.mode, h4);
            d3.return = a3;
            a3 = d3;
          }
          return g2(a3);
        case Ha$2:
          return l3 = f3._init, J2(a3, d3, l3(f3._payload), h4);
      }
      if (eb$2(f3))
        return n2(a3, d3, f3, h4);
      if (Ka$2(f3))
        return t2(a3, d3, f3, h4);
      Mg(a3, f3);
    }
    return "string" === typeof f3 && "" !== f3 || "number" === typeof f3 ? (f3 = "" + f3, null !== d3 && 6 === d3.tag ? (c2(a3, d3.sibling), d3 = e2(d3, f3), d3.return = a3, a3 = d3) : (c2(a3, d3), d3 = Qg(f3, a3.mode, h4), d3.return = a3, a3 = d3), g2(a3)) : c2(a3, d3);
  }
  return J2;
}
var Ug = Og(true), Vg = Og(false), Wg = Uf(null), Xg = null, Yg = null, Zg = null;
function $g() {
  Zg = Yg = Xg = null;
}
function ah(a2) {
  var b2 = Wg.current;
  E$3(Wg);
  a2._currentValue = b2;
}
function bh(a2, b2, c2) {
  for (; null !== a2; ) {
    var d2 = a2.alternate;
    (a2.childLanes & b2) !== b2 ? (a2.childLanes |= b2, null !== d2 && (d2.childLanes |= b2)) : null !== d2 && (d2.childLanes & b2) !== b2 && (d2.childLanes |= b2);
    if (a2 === c2)
      break;
    a2 = a2.return;
  }
}
function ch(a2, b2) {
  Xg = a2;
  Zg = Yg = null;
  a2 = a2.dependencies;
  null !== a2 && null !== a2.firstContext && (0 !== (a2.lanes & b2) && (dh = true), a2.firstContext = null);
}
function eh(a2) {
  var b2 = a2._currentValue;
  if (Zg !== a2)
    if (a2 = { context: a2, memoizedValue: b2, next: null }, null === Yg) {
      if (null === Xg)
        throw Error(p$7(308));
      Yg = a2;
      Xg.dependencies = { lanes: 0, firstContext: a2 };
    } else
      Yg = Yg.next = a2;
  return b2;
}
var fh = null;
function gh(a2) {
  null === fh ? fh = [a2] : fh.push(a2);
}
function hh(a2, b2, c2, d2) {
  var e2 = b2.interleaved;
  null === e2 ? (c2.next = c2, gh(b2)) : (c2.next = e2.next, e2.next = c2);
  b2.interleaved = c2;
  return ih(a2, d2);
}
function ih(a2, b2) {
  a2.lanes |= b2;
  var c2 = a2.alternate;
  null !== c2 && (c2.lanes |= b2);
  c2 = a2;
  for (a2 = a2.return; null !== a2; )
    a2.childLanes |= b2, c2 = a2.alternate, null !== c2 && (c2.childLanes |= b2), c2 = a2, a2 = a2.return;
  return 3 === c2.tag ? c2.stateNode : null;
}
var jh = false;
function kh(a2) {
  a2.updateQueue = { baseState: a2.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null };
}
function lh(a2, b2) {
  a2 = a2.updateQueue;
  b2.updateQueue === a2 && (b2.updateQueue = { baseState: a2.baseState, firstBaseUpdate: a2.firstBaseUpdate, lastBaseUpdate: a2.lastBaseUpdate, shared: a2.shared, effects: a2.effects });
}
function mh(a2, b2) {
  return { eventTime: a2, lane: b2, tag: 0, payload: null, callback: null, next: null };
}
function nh(a2, b2, c2) {
  var d2 = a2.updateQueue;
  if (null === d2)
    return null;
  d2 = d2.shared;
  if (0 !== (K$2 & 2)) {
    var e2 = d2.pending;
    null === e2 ? b2.next = b2 : (b2.next = e2.next, e2.next = b2);
    d2.pending = b2;
    return ih(a2, c2);
  }
  e2 = d2.interleaved;
  null === e2 ? (b2.next = b2, gh(d2)) : (b2.next = e2.next, e2.next = b2);
  d2.interleaved = b2;
  return ih(a2, c2);
}
function oh(a2, b2, c2) {
  b2 = b2.updateQueue;
  if (null !== b2 && (b2 = b2.shared, 0 !== (c2 & 4194240))) {
    var d2 = b2.lanes;
    d2 &= a2.pendingLanes;
    c2 |= d2;
    b2.lanes = c2;
    Cc$1(a2, c2);
  }
}
function ph(a2, b2) {
  var c2 = a2.updateQueue, d2 = a2.alternate;
  if (null !== d2 && (d2 = d2.updateQueue, c2 === d2)) {
    var e2 = null, f2 = null;
    c2 = c2.firstBaseUpdate;
    if (null !== c2) {
      do {
        var g2 = { eventTime: c2.eventTime, lane: c2.lane, tag: c2.tag, payload: c2.payload, callback: c2.callback, next: null };
        null === f2 ? e2 = f2 = g2 : f2 = f2.next = g2;
        c2 = c2.next;
      } while (null !== c2);
      null === f2 ? e2 = f2 = b2 : f2 = f2.next = b2;
    } else
      e2 = f2 = b2;
    c2 = { baseState: d2.baseState, firstBaseUpdate: e2, lastBaseUpdate: f2, shared: d2.shared, effects: d2.effects };
    a2.updateQueue = c2;
    return;
  }
  a2 = c2.lastBaseUpdate;
  null === a2 ? c2.firstBaseUpdate = b2 : a2.next = b2;
  c2.lastBaseUpdate = b2;
}
function qh(a2, b2, c2, d2) {
  var e2 = a2.updateQueue;
  jh = false;
  var f2 = e2.firstBaseUpdate, g2 = e2.lastBaseUpdate, h3 = e2.shared.pending;
  if (null !== h3) {
    e2.shared.pending = null;
    var k2 = h3, l2 = k2.next;
    k2.next = null;
    null === g2 ? f2 = l2 : g2.next = l2;
    g2 = k2;
    var m2 = a2.alternate;
    null !== m2 && (m2 = m2.updateQueue, h3 = m2.lastBaseUpdate, h3 !== g2 && (null === h3 ? m2.firstBaseUpdate = l2 : h3.next = l2, m2.lastBaseUpdate = k2));
  }
  if (null !== f2) {
    var q2 = e2.baseState;
    g2 = 0;
    m2 = l2 = k2 = null;
    h3 = f2;
    do {
      var r2 = h3.lane, y2 = h3.eventTime;
      if ((d2 & r2) === r2) {
        null !== m2 && (m2 = m2.next = {
          eventTime: y2,
          lane: 0,
          tag: h3.tag,
          payload: h3.payload,
          callback: h3.callback,
          next: null
        });
        a: {
          var n2 = a2, t2 = h3;
          r2 = b2;
          y2 = c2;
          switch (t2.tag) {
            case 1:
              n2 = t2.payload;
              if ("function" === typeof n2) {
                q2 = n2.call(y2, q2, r2);
                break a;
              }
              q2 = n2;
              break a;
            case 3:
              n2.flags = n2.flags & -65537 | 128;
            case 0:
              n2 = t2.payload;
              r2 = "function" === typeof n2 ? n2.call(y2, q2, r2) : n2;
              if (null === r2 || void 0 === r2)
                break a;
              q2 = A$4({}, q2, r2);
              break a;
            case 2:
              jh = true;
          }
        }
        null !== h3.callback && 0 !== h3.lane && (a2.flags |= 64, r2 = e2.effects, null === r2 ? e2.effects = [h3] : r2.push(h3));
      } else
        y2 = { eventTime: y2, lane: r2, tag: h3.tag, payload: h3.payload, callback: h3.callback, next: null }, null === m2 ? (l2 = m2 = y2, k2 = q2) : m2 = m2.next = y2, g2 |= r2;
      h3 = h3.next;
      if (null === h3)
        if (h3 = e2.shared.pending, null === h3)
          break;
        else
          r2 = h3, h3 = r2.next, r2.next = null, e2.lastBaseUpdate = r2, e2.shared.pending = null;
    } while (1);
    null === m2 && (k2 = q2);
    e2.baseState = k2;
    e2.firstBaseUpdate = l2;
    e2.lastBaseUpdate = m2;
    b2 = e2.shared.interleaved;
    if (null !== b2) {
      e2 = b2;
      do
        g2 |= e2.lane, e2 = e2.next;
      while (e2 !== b2);
    } else
      null === f2 && (e2.shared.lanes = 0);
    rh |= g2;
    a2.lanes = g2;
    a2.memoizedState = q2;
  }
}
function sh(a2, b2, c2) {
  a2 = b2.effects;
  b2.effects = null;
  if (null !== a2)
    for (b2 = 0; b2 < a2.length; b2++) {
      var d2 = a2[b2], e2 = d2.callback;
      if (null !== e2) {
        d2.callback = null;
        d2 = c2;
        if ("function" !== typeof e2)
          throw Error(p$7(191, e2));
        e2.call(d2);
      }
    }
}
var th = {}, uh = Uf(th), vh$1 = Uf(th), wh = Uf(th);
function xh(a2) {
  if (a2 === th)
    throw Error(p$7(174));
  return a2;
}
function yh(a2, b2) {
  G$2(wh, b2);
  G$2(vh$1, a2);
  G$2(uh, th);
  a2 = b2.nodeType;
  switch (a2) {
    case 9:
    case 11:
      b2 = (b2 = b2.documentElement) ? b2.namespaceURI : lb$2(null, "");
      break;
    default:
      a2 = 8 === a2 ? b2.parentNode : b2, b2 = a2.namespaceURI || null, a2 = a2.tagName, b2 = lb$2(b2, a2);
  }
  E$3(uh);
  G$2(uh, b2);
}
function zh() {
  E$3(uh);
  E$3(vh$1);
  E$3(wh);
}
function Ah(a2) {
  xh(wh.current);
  var b2 = xh(uh.current);
  var c2 = lb$2(b2, a2.type);
  b2 !== c2 && (G$2(vh$1, a2), G$2(uh, c2));
}
function Bh(a2) {
  vh$1.current === a2 && (E$3(uh), E$3(vh$1));
}
var L$3 = Uf(0);
function Ch(a2) {
  for (var b2 = a2; null !== b2; ) {
    if (13 === b2.tag) {
      var c2 = b2.memoizedState;
      if (null !== c2 && (c2 = c2.dehydrated, null === c2 || "$?" === c2.data || "$!" === c2.data))
        return b2;
    } else if (19 === b2.tag && void 0 !== b2.memoizedProps.revealOrder) {
      if (0 !== (b2.flags & 128))
        return b2;
    } else if (null !== b2.child) {
      b2.child.return = b2;
      b2 = b2.child;
      continue;
    }
    if (b2 === a2)
      break;
    for (; null === b2.sibling; ) {
      if (null === b2.return || b2.return === a2)
        return null;
      b2 = b2.return;
    }
    b2.sibling.return = b2.return;
    b2 = b2.sibling;
  }
  return null;
}
var Dh = [];
function Eh() {
  for (var a2 = 0; a2 < Dh.length; a2++)
    Dh[a2]._workInProgressVersionPrimary = null;
  Dh.length = 0;
}
var Fh = ua$2.ReactCurrentDispatcher, Gh = ua$2.ReactCurrentBatchConfig, Hh = 0, M$5 = null, N$4 = null, O$3 = null, Ih = false, Jh = false, Kh = 0, Lh = 0;
function P$4() {
  throw Error(p$7(321));
}
function Mh(a2, b2) {
  if (null === b2)
    return false;
  for (var c2 = 0; c2 < b2.length && c2 < a2.length; c2++)
    if (!He(a2[c2], b2[c2]))
      return false;
  return true;
}
function Nh(a2, b2, c2, d2, e2, f2) {
  Hh = f2;
  M$5 = b2;
  b2.memoizedState = null;
  b2.updateQueue = null;
  b2.lanes = 0;
  Fh.current = null === a2 || null === a2.memoizedState ? Oh : Ph;
  a2 = c2(d2, e2);
  if (Jh) {
    f2 = 0;
    do {
      Jh = false;
      Kh = 0;
      if (25 <= f2)
        throw Error(p$7(301));
      f2 += 1;
      O$3 = N$4 = null;
      b2.updateQueue = null;
      Fh.current = Qh;
      a2 = c2(d2, e2);
    } while (Jh);
  }
  Fh.current = Rh;
  b2 = null !== N$4 && null !== N$4.next;
  Hh = 0;
  O$3 = N$4 = M$5 = null;
  Ih = false;
  if (b2)
    throw Error(p$7(300));
  return a2;
}
function Sh() {
  var a2 = 0 !== Kh;
  Kh = 0;
  return a2;
}
function Th() {
  var a2 = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
  null === O$3 ? M$5.memoizedState = O$3 = a2 : O$3 = O$3.next = a2;
  return O$3;
}
function Uh() {
  if (null === N$4) {
    var a2 = M$5.alternate;
    a2 = null !== a2 ? a2.memoizedState : null;
  } else
    a2 = N$4.next;
  var b2 = null === O$3 ? M$5.memoizedState : O$3.next;
  if (null !== b2)
    O$3 = b2, N$4 = a2;
  else {
    if (null === a2)
      throw Error(p$7(310));
    N$4 = a2;
    a2 = { memoizedState: N$4.memoizedState, baseState: N$4.baseState, baseQueue: N$4.baseQueue, queue: N$4.queue, next: null };
    null === O$3 ? M$5.memoizedState = O$3 = a2 : O$3 = O$3.next = a2;
  }
  return O$3;
}
function Vh(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function Wh(a2) {
  var b2 = Uh(), c2 = b2.queue;
  if (null === c2)
    throw Error(p$7(311));
  c2.lastRenderedReducer = a2;
  var d2 = N$4, e2 = d2.baseQueue, f2 = c2.pending;
  if (null !== f2) {
    if (null !== e2) {
      var g2 = e2.next;
      e2.next = f2.next;
      f2.next = g2;
    }
    d2.baseQueue = e2 = f2;
    c2.pending = null;
  }
  if (null !== e2) {
    f2 = e2.next;
    d2 = d2.baseState;
    var h3 = g2 = null, k2 = null, l2 = f2;
    do {
      var m2 = l2.lane;
      if ((Hh & m2) === m2)
        null !== k2 && (k2 = k2.next = { lane: 0, action: l2.action, hasEagerState: l2.hasEagerState, eagerState: l2.eagerState, next: null }), d2 = l2.hasEagerState ? l2.eagerState : a2(d2, l2.action);
      else {
        var q2 = {
          lane: m2,
          action: l2.action,
          hasEagerState: l2.hasEagerState,
          eagerState: l2.eagerState,
          next: null
        };
        null === k2 ? (h3 = k2 = q2, g2 = d2) : k2 = k2.next = q2;
        M$5.lanes |= m2;
        rh |= m2;
      }
      l2 = l2.next;
    } while (null !== l2 && l2 !== f2);
    null === k2 ? g2 = d2 : k2.next = h3;
    He(d2, b2.memoizedState) || (dh = true);
    b2.memoizedState = d2;
    b2.baseState = g2;
    b2.baseQueue = k2;
    c2.lastRenderedState = d2;
  }
  a2 = c2.interleaved;
  if (null !== a2) {
    e2 = a2;
    do
      f2 = e2.lane, M$5.lanes |= f2, rh |= f2, e2 = e2.next;
    while (e2 !== a2);
  } else
    null === e2 && (c2.lanes = 0);
  return [b2.memoizedState, c2.dispatch];
}
function Xh(a2) {
  var b2 = Uh(), c2 = b2.queue;
  if (null === c2)
    throw Error(p$7(311));
  c2.lastRenderedReducer = a2;
  var d2 = c2.dispatch, e2 = c2.pending, f2 = b2.memoizedState;
  if (null !== e2) {
    c2.pending = null;
    var g2 = e2 = e2.next;
    do
      f2 = a2(f2, g2.action), g2 = g2.next;
    while (g2 !== e2);
    He(f2, b2.memoizedState) || (dh = true);
    b2.memoizedState = f2;
    null === b2.baseQueue && (b2.baseState = f2);
    c2.lastRenderedState = f2;
  }
  return [f2, d2];
}
function Yh() {
}
function Zh(a2, b2) {
  var c2 = M$5, d2 = Uh(), e2 = b2(), f2 = !He(d2.memoizedState, e2);
  f2 && (d2.memoizedState = e2, dh = true);
  d2 = d2.queue;
  $h(ai.bind(null, c2, d2, a2), [a2]);
  if (d2.getSnapshot !== b2 || f2 || null !== O$3 && O$3.memoizedState.tag & 1) {
    c2.flags |= 2048;
    bi(9, ci.bind(null, c2, d2, e2, b2), void 0, null);
    if (null === Q$3)
      throw Error(p$7(349));
    0 !== (Hh & 30) || di(c2, b2, e2);
  }
  return e2;
}
function di(a2, b2, c2) {
  a2.flags |= 16384;
  a2 = { getSnapshot: b2, value: c2 };
  b2 = M$5.updateQueue;
  null === b2 ? (b2 = { lastEffect: null, stores: null }, M$5.updateQueue = b2, b2.stores = [a2]) : (c2 = b2.stores, null === c2 ? b2.stores = [a2] : c2.push(a2));
}
function ci(a2, b2, c2, d2) {
  b2.value = c2;
  b2.getSnapshot = d2;
  ei(b2) && fi(a2);
}
function ai(a2, b2, c2) {
  return c2(function() {
    ei(b2) && fi(a2);
  });
}
function ei(a2) {
  var b2 = a2.getSnapshot;
  a2 = a2.value;
  try {
    var c2 = b2();
    return !He(a2, c2);
  } catch (d2) {
    return true;
  }
}
function fi(a2) {
  var b2 = ih(a2, 1);
  null !== b2 && gi(b2, a2, 1, -1);
}
function hi(a2) {
  var b2 = Th();
  "function" === typeof a2 && (a2 = a2());
  b2.memoizedState = b2.baseState = a2;
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: Vh, lastRenderedState: a2 };
  b2.queue = a2;
  a2 = a2.dispatch = ii.bind(null, M$5, a2);
  return [b2.memoizedState, a2];
}
function bi(a2, b2, c2, d2) {
  a2 = { tag: a2, create: b2, destroy: c2, deps: d2, next: null };
  b2 = M$5.updateQueue;
  null === b2 ? (b2 = { lastEffect: null, stores: null }, M$5.updateQueue = b2, b2.lastEffect = a2.next = a2) : (c2 = b2.lastEffect, null === c2 ? b2.lastEffect = a2.next = a2 : (d2 = c2.next, c2.next = a2, a2.next = d2, b2.lastEffect = a2));
  return a2;
}
function ji() {
  return Uh().memoizedState;
}
function ki(a2, b2, c2, d2) {
  var e2 = Th();
  M$5.flags |= a2;
  e2.memoizedState = bi(1 | b2, c2, void 0, void 0 === d2 ? null : d2);
}
function li(a2, b2, c2, d2) {
  var e2 = Uh();
  d2 = void 0 === d2 ? null : d2;
  var f2 = void 0;
  if (null !== N$4) {
    var g2 = N$4.memoizedState;
    f2 = g2.destroy;
    if (null !== d2 && Mh(d2, g2.deps)) {
      e2.memoizedState = bi(b2, c2, f2, d2);
      return;
    }
  }
  M$5.flags |= a2;
  e2.memoizedState = bi(1 | b2, c2, f2, d2);
}
function mi(a2, b2) {
  return ki(8390656, 8, a2, b2);
}
function $h(a2, b2) {
  return li(2048, 8, a2, b2);
}
function ni(a2, b2) {
  return li(4, 2, a2, b2);
}
function oi(a2, b2) {
  return li(4, 4, a2, b2);
}
function pi(a2, b2) {
  if ("function" === typeof b2)
    return a2 = a2(), b2(a2), function() {
      b2(null);
    };
  if (null !== b2 && void 0 !== b2)
    return a2 = a2(), b2.current = a2, function() {
      b2.current = null;
    };
}
function qi(a2, b2, c2) {
  c2 = null !== c2 && void 0 !== c2 ? c2.concat([a2]) : null;
  return li(4, 4, pi.bind(null, b2, a2), c2);
}
function ri() {
}
function si(a2, b2) {
  var c2 = Uh();
  b2 = void 0 === b2 ? null : b2;
  var d2 = c2.memoizedState;
  if (null !== d2 && null !== b2 && Mh(b2, d2[1]))
    return d2[0];
  c2.memoizedState = [a2, b2];
  return a2;
}
function ti(a2, b2) {
  var c2 = Uh();
  b2 = void 0 === b2 ? null : b2;
  var d2 = c2.memoizedState;
  if (null !== d2 && null !== b2 && Mh(b2, d2[1]))
    return d2[0];
  a2 = a2();
  c2.memoizedState = [a2, b2];
  return a2;
}
function ui(a2, b2, c2) {
  if (0 === (Hh & 21))
    return a2.baseState && (a2.baseState = false, dh = true), a2.memoizedState = c2;
  He(c2, b2) || (c2 = yc$1(), M$5.lanes |= c2, rh |= c2, a2.baseState = true);
  return b2;
}
function vi(a2, b2) {
  var c2 = C$1;
  C$1 = 0 !== c2 && 4 > c2 ? c2 : 4;
  a2(true);
  var d2 = Gh.transition;
  Gh.transition = {};
  try {
    a2(false), b2();
  } finally {
    C$1 = c2, Gh.transition = d2;
  }
}
function wi() {
  return Uh().memoizedState;
}
function xi(a2, b2, c2) {
  var d2 = yi(a2);
  c2 = { lane: d2, action: c2, hasEagerState: false, eagerState: null, next: null };
  if (zi(a2))
    Ai(b2, c2);
  else if (c2 = hh(a2, b2, c2, d2), null !== c2) {
    var e2 = R$4();
    gi(c2, a2, d2, e2);
    Bi(c2, b2, d2);
  }
}
function ii(a2, b2, c2) {
  var d2 = yi(a2), e2 = { lane: d2, action: c2, hasEagerState: false, eagerState: null, next: null };
  if (zi(a2))
    Ai(b2, e2);
  else {
    var f2 = a2.alternate;
    if (0 === a2.lanes && (null === f2 || 0 === f2.lanes) && (f2 = b2.lastRenderedReducer, null !== f2))
      try {
        var g2 = b2.lastRenderedState, h3 = f2(g2, c2);
        e2.hasEagerState = true;
        e2.eagerState = h3;
        if (He(h3, g2)) {
          var k2 = b2.interleaved;
          null === k2 ? (e2.next = e2, gh(b2)) : (e2.next = k2.next, k2.next = e2);
          b2.interleaved = e2;
          return;
        }
      } catch (l2) {
      } finally {
      }
    c2 = hh(a2, b2, e2, d2);
    null !== c2 && (e2 = R$4(), gi(c2, a2, d2, e2), Bi(c2, b2, d2));
  }
}
function zi(a2) {
  var b2 = a2.alternate;
  return a2 === M$5 || null !== b2 && b2 === M$5;
}
function Ai(a2, b2) {
  Jh = Ih = true;
  var c2 = a2.pending;
  null === c2 ? b2.next = b2 : (b2.next = c2.next, c2.next = b2);
  a2.pending = b2;
}
function Bi(a2, b2, c2) {
  if (0 !== (c2 & 4194240)) {
    var d2 = b2.lanes;
    d2 &= a2.pendingLanes;
    c2 |= d2;
    b2.lanes = c2;
    Cc$1(a2, c2);
  }
}
var Rh = { readContext: eh, useCallback: P$4, useContext: P$4, useEffect: P$4, useImperativeHandle: P$4, useInsertionEffect: P$4, useLayoutEffect: P$4, useMemo: P$4, useReducer: P$4, useRef: P$4, useState: P$4, useDebugValue: P$4, useDeferredValue: P$4, useTransition: P$4, useMutableSource: P$4, useSyncExternalStore: P$4, useId: P$4, unstable_isNewReconciler: false }, Oh = { readContext: eh, useCallback: function(a2, b2) {
  Th().memoizedState = [a2, void 0 === b2 ? null : b2];
  return a2;
}, useContext: eh, useEffect: mi, useImperativeHandle: function(a2, b2, c2) {
  c2 = null !== c2 && void 0 !== c2 ? c2.concat([a2]) : null;
  return ki(
    4194308,
    4,
    pi.bind(null, b2, a2),
    c2
  );
}, useLayoutEffect: function(a2, b2) {
  return ki(4194308, 4, a2, b2);
}, useInsertionEffect: function(a2, b2) {
  return ki(4, 2, a2, b2);
}, useMemo: function(a2, b2) {
  var c2 = Th();
  b2 = void 0 === b2 ? null : b2;
  a2 = a2();
  c2.memoizedState = [a2, b2];
  return a2;
}, useReducer: function(a2, b2, c2) {
  var d2 = Th();
  b2 = void 0 !== c2 ? c2(b2) : b2;
  d2.memoizedState = d2.baseState = b2;
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: a2, lastRenderedState: b2 };
  d2.queue = a2;
  a2 = a2.dispatch = xi.bind(null, M$5, a2);
  return [d2.memoizedState, a2];
}, useRef: function(a2) {
  var b2 = Th();
  a2 = { current: a2 };
  return b2.memoizedState = a2;
}, useState: hi, useDebugValue: ri, useDeferredValue: function(a2) {
  return Th().memoizedState = a2;
}, useTransition: function() {
  var a2 = hi(false), b2 = a2[0];
  a2 = vi.bind(null, a2[1]);
  Th().memoizedState = a2;
  return [b2, a2];
}, useMutableSource: function() {
}, useSyncExternalStore: function(a2, b2, c2) {
  var d2 = M$5, e2 = Th();
  if (I$3) {
    if (void 0 === c2)
      throw Error(p$7(407));
    c2 = c2();
  } else {
    c2 = b2();
    if (null === Q$3)
      throw Error(p$7(349));
    0 !== (Hh & 30) || di(d2, b2, c2);
  }
  e2.memoizedState = c2;
  var f2 = { value: c2, getSnapshot: b2 };
  e2.queue = f2;
  mi(ai.bind(
    null,
    d2,
    f2,
    a2
  ), [a2]);
  d2.flags |= 2048;
  bi(9, ci.bind(null, d2, f2, c2, b2), void 0, null);
  return c2;
}, useId: function() {
  var a2 = Th(), b2 = Q$3.identifierPrefix;
  if (I$3) {
    var c2 = sg;
    var d2 = rg;
    c2 = (d2 & ~(1 << 32 - oc$1(d2) - 1)).toString(32) + c2;
    b2 = ":" + b2 + "R" + c2;
    c2 = Kh++;
    0 < c2 && (b2 += "H" + c2.toString(32));
    b2 += ":";
  } else
    c2 = Lh++, b2 = ":" + b2 + "r" + c2.toString(32) + ":";
  return a2.memoizedState = b2;
}, unstable_isNewReconciler: false }, Ph = {
  readContext: eh,
  useCallback: si,
  useContext: eh,
  useEffect: $h,
  useImperativeHandle: qi,
  useInsertionEffect: ni,
  useLayoutEffect: oi,
  useMemo: ti,
  useReducer: Wh,
  useRef: ji,
  useState: function() {
    return Wh(Vh);
  },
  useDebugValue: ri,
  useDeferredValue: function(a2) {
    var b2 = Uh();
    return ui(b2, N$4.memoizedState, a2);
  },
  useTransition: function() {
    var a2 = Wh(Vh)[0], b2 = Uh().memoizedState;
    return [a2, b2];
  },
  useMutableSource: Yh,
  useSyncExternalStore: Zh,
  useId: wi,
  unstable_isNewReconciler: false
}, Qh = { readContext: eh, useCallback: si, useContext: eh, useEffect: $h, useImperativeHandle: qi, useInsertionEffect: ni, useLayoutEffect: oi, useMemo: ti, useReducer: Xh, useRef: ji, useState: function() {
  return Xh(Vh);
}, useDebugValue: ri, useDeferredValue: function(a2) {
  var b2 = Uh();
  return null === N$4 ? b2.memoizedState = a2 : ui(b2, N$4.memoizedState, a2);
}, useTransition: function() {
  var a2 = Xh(Vh)[0], b2 = Uh().memoizedState;
  return [a2, b2];
}, useMutableSource: Yh, useSyncExternalStore: Zh, useId: wi, unstable_isNewReconciler: false };
function Ci(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = A$4({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Di(a2, b2, c2, d2) {
  b2 = a2.memoizedState;
  c2 = c2(d2, b2);
  c2 = null === c2 || void 0 === c2 ? b2 : A$4({}, b2, c2);
  a2.memoizedState = c2;
  0 === a2.lanes && (a2.updateQueue.baseState = c2);
}
var Ei = { isMounted: function(a2) {
  return (a2 = a2._reactInternals) ? Vb$1(a2) === a2 : false;
}, enqueueSetState: function(a2, b2, c2) {
  a2 = a2._reactInternals;
  var d2 = R$4(), e2 = yi(a2), f2 = mh(d2, e2);
  f2.payload = b2;
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
  b2 = nh(a2, f2, e2);
  null !== b2 && (gi(b2, a2, e2, d2), oh(b2, a2, e2));
}, enqueueReplaceState: function(a2, b2, c2) {
  a2 = a2._reactInternals;
  var d2 = R$4(), e2 = yi(a2), f2 = mh(d2, e2);
  f2.tag = 1;
  f2.payload = b2;
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
  b2 = nh(a2, f2, e2);
  null !== b2 && (gi(b2, a2, e2, d2), oh(b2, a2, e2));
}, enqueueForceUpdate: function(a2, b2) {
  a2 = a2._reactInternals;
  var c2 = R$4(), d2 = yi(a2), e2 = mh(c2, d2);
  e2.tag = 2;
  void 0 !== b2 && null !== b2 && (e2.callback = b2);
  b2 = nh(a2, e2, d2);
  null !== b2 && (gi(b2, a2, d2, c2), oh(b2, a2, d2));
} };
function Fi(a2, b2, c2, d2, e2, f2, g2) {
  a2 = a2.stateNode;
  return "function" === typeof a2.shouldComponentUpdate ? a2.shouldComponentUpdate(d2, f2, g2) : b2.prototype && b2.prototype.isPureReactComponent ? !Ie(c2, d2) || !Ie(e2, f2) : true;
}
function Gi(a2, b2, c2) {
  var d2 = false, e2 = Vf;
  var f2 = b2.contextType;
  "object" === typeof f2 && null !== f2 ? f2 = eh(f2) : (e2 = Zf(b2) ? Xf : H$3.current, d2 = b2.contextTypes, f2 = (d2 = null !== d2 && void 0 !== d2) ? Yf(a2, e2) : Vf);
  b2 = new b2(c2, f2);
  a2.memoizedState = null !== b2.state && void 0 !== b2.state ? b2.state : null;
  b2.updater = Ei;
  a2.stateNode = b2;
  b2._reactInternals = a2;
  d2 && (a2 = a2.stateNode, a2.__reactInternalMemoizedUnmaskedChildContext = e2, a2.__reactInternalMemoizedMaskedChildContext = f2);
  return b2;
}
function Hi(a2, b2, c2, d2) {
  a2 = b2.state;
  "function" === typeof b2.componentWillReceiveProps && b2.componentWillReceiveProps(c2, d2);
  "function" === typeof b2.UNSAFE_componentWillReceiveProps && b2.UNSAFE_componentWillReceiveProps(c2, d2);
  b2.state !== a2 && Ei.enqueueReplaceState(b2, b2.state, null);
}
function Ii(a2, b2, c2, d2) {
  var e2 = a2.stateNode;
  e2.props = c2;
  e2.state = a2.memoizedState;
  e2.refs = {};
  kh(a2);
  var f2 = b2.contextType;
  "object" === typeof f2 && null !== f2 ? e2.context = eh(f2) : (f2 = Zf(b2) ? Xf : H$3.current, e2.context = Yf(a2, f2));
  e2.state = a2.memoizedState;
  f2 = b2.getDerivedStateFromProps;
  "function" === typeof f2 && (Di(a2, b2, f2, c2), e2.state = a2.memoizedState);
  "function" === typeof b2.getDerivedStateFromProps || "function" === typeof e2.getSnapshotBeforeUpdate || "function" !== typeof e2.UNSAFE_componentWillMount && "function" !== typeof e2.componentWillMount || (b2 = e2.state, "function" === typeof e2.componentWillMount && e2.componentWillMount(), "function" === typeof e2.UNSAFE_componentWillMount && e2.UNSAFE_componentWillMount(), b2 !== e2.state && Ei.enqueueReplaceState(e2, e2.state, null), qh(a2, c2, e2, d2), e2.state = a2.memoizedState);
  "function" === typeof e2.componentDidMount && (a2.flags |= 4194308);
}
function Ji(a2, b2) {
  try {
    var c2 = "", d2 = b2;
    do
      c2 += Pa$2(d2), d2 = d2.return;
    while (d2);
    var e2 = c2;
  } catch (f2) {
    e2 = "\nError generating stack: " + f2.message + "\n" + f2.stack;
  }
  return { value: a2, source: b2, stack: e2, digest: null };
}
function Ki(a2, b2, c2) {
  return { value: a2, source: null, stack: null != c2 ? c2 : null, digest: null != b2 ? b2 : null };
}
function Li(a2, b2) {
  try {
    console.error(b2.value);
  } catch (c2) {
    setTimeout(function() {
      throw c2;
    });
  }
}
var Mi = "function" === typeof WeakMap ? WeakMap : Map;
function Ni(a2, b2, c2) {
  c2 = mh(-1, c2);
  c2.tag = 3;
  c2.payload = { element: null };
  var d2 = b2.value;
  c2.callback = function() {
    Oi || (Oi = true, Pi = d2);
    Li(a2, b2);
  };
  return c2;
}
function Qi(a2, b2, c2) {
  c2 = mh(-1, c2);
  c2.tag = 3;
  var d2 = a2.type.getDerivedStateFromError;
  if ("function" === typeof d2) {
    var e2 = b2.value;
    c2.payload = function() {
      return d2(e2);
    };
    c2.callback = function() {
      Li(a2, b2);
    };
  }
  var f2 = a2.stateNode;
  null !== f2 && "function" === typeof f2.componentDidCatch && (c2.callback = function() {
    Li(a2, b2);
    "function" !== typeof d2 && (null === Ri ? Ri = /* @__PURE__ */ new Set([this]) : Ri.add(this));
    var c3 = b2.stack;
    this.componentDidCatch(b2.value, { componentStack: null !== c3 ? c3 : "" });
  });
  return c2;
}
function Si(a2, b2, c2) {
  var d2 = a2.pingCache;
  if (null === d2) {
    d2 = a2.pingCache = new Mi();
    var e2 = /* @__PURE__ */ new Set();
    d2.set(b2, e2);
  } else
    e2 = d2.get(b2), void 0 === e2 && (e2 = /* @__PURE__ */ new Set(), d2.set(b2, e2));
  e2.has(c2) || (e2.add(c2), a2 = Ti.bind(null, a2, b2, c2), b2.then(a2, a2));
}
function Ui(a2) {
  do {
    var b2;
    if (b2 = 13 === a2.tag)
      b2 = a2.memoizedState, b2 = null !== b2 ? null !== b2.dehydrated ? true : false : true;
    if (b2)
      return a2;
    a2 = a2.return;
  } while (null !== a2);
  return null;
}
function Vi(a2, b2, c2, d2, e2) {
  if (0 === (a2.mode & 1))
    return a2 === b2 ? a2.flags |= 65536 : (a2.flags |= 128, c2.flags |= 131072, c2.flags &= -52805, 1 === c2.tag && (null === c2.alternate ? c2.tag = 17 : (b2 = mh(-1, 1), b2.tag = 2, nh(c2, b2, 1))), c2.lanes |= 1), a2;
  a2.flags |= 65536;
  a2.lanes = e2;
  return a2;
}
var Wi = ua$2.ReactCurrentOwner, dh = false;
function Xi(a2, b2, c2, d2) {
  b2.child = null === a2 ? Vg(b2, null, c2, d2) : Ug(b2, a2.child, c2, d2);
}
function Yi(a2, b2, c2, d2, e2) {
  c2 = c2.render;
  var f2 = b2.ref;
  ch(b2, e2);
  d2 = Nh(a2, b2, c2, d2, f2, e2);
  c2 = Sh();
  if (null !== a2 && !dh)
    return b2.updateQueue = a2.updateQueue, b2.flags &= -2053, a2.lanes &= ~e2, Zi(a2, b2, e2);
  I$3 && c2 && vg(b2);
  b2.flags |= 1;
  Xi(a2, b2, d2, e2);
  return b2.child;
}
function $i(a2, b2, c2, d2, e2) {
  if (null === a2) {
    var f2 = c2.type;
    if ("function" === typeof f2 && !aj(f2) && void 0 === f2.defaultProps && null === c2.compare && void 0 === c2.defaultProps)
      return b2.tag = 15, b2.type = f2, bj(a2, b2, f2, d2, e2);
    a2 = Rg(c2.type, null, d2, b2, b2.mode, e2);
    a2.ref = b2.ref;
    a2.return = b2;
    return b2.child = a2;
  }
  f2 = a2.child;
  if (0 === (a2.lanes & e2)) {
    var g2 = f2.memoizedProps;
    c2 = c2.compare;
    c2 = null !== c2 ? c2 : Ie;
    if (c2(g2, d2) && a2.ref === b2.ref)
      return Zi(a2, b2, e2);
  }
  b2.flags |= 1;
  a2 = Pg(f2, d2);
  a2.ref = b2.ref;
  a2.return = b2;
  return b2.child = a2;
}
function bj(a2, b2, c2, d2, e2) {
  if (null !== a2) {
    var f2 = a2.memoizedProps;
    if (Ie(f2, d2) && a2.ref === b2.ref)
      if (dh = false, b2.pendingProps = d2 = f2, 0 !== (a2.lanes & e2))
        0 !== (a2.flags & 131072) && (dh = true);
      else
        return b2.lanes = a2.lanes, Zi(a2, b2, e2);
  }
  return cj(a2, b2, c2, d2, e2);
}
function dj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = d2.children, f2 = null !== a2 ? a2.memoizedState : null;
  if ("hidden" === d2.mode)
    if (0 === (b2.mode & 1))
      b2.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, G$2(ej, fj), fj |= c2;
    else {
      if (0 === (c2 & 1073741824))
        return a2 = null !== f2 ? f2.baseLanes | c2 : c2, b2.lanes = b2.childLanes = 1073741824, b2.memoizedState = { baseLanes: a2, cachePool: null, transitions: null }, b2.updateQueue = null, G$2(ej, fj), fj |= a2, null;
      b2.memoizedState = { baseLanes: 0, cachePool: null, transitions: null };
      d2 = null !== f2 ? f2.baseLanes : c2;
      G$2(ej, fj);
      fj |= d2;
    }
  else
    null !== f2 ? (d2 = f2.baseLanes | c2, b2.memoizedState = null) : d2 = c2, G$2(ej, fj), fj |= d2;
  Xi(a2, b2, e2, c2);
  return b2.child;
}
function gj(a2, b2) {
  var c2 = b2.ref;
  if (null === a2 && null !== c2 || null !== a2 && a2.ref !== c2)
    b2.flags |= 512, b2.flags |= 2097152;
}
function cj(a2, b2, c2, d2, e2) {
  var f2 = Zf(c2) ? Xf : H$3.current;
  f2 = Yf(b2, f2);
  ch(b2, e2);
  c2 = Nh(a2, b2, c2, d2, f2, e2);
  d2 = Sh();
  if (null !== a2 && !dh)
    return b2.updateQueue = a2.updateQueue, b2.flags &= -2053, a2.lanes &= ~e2, Zi(a2, b2, e2);
  I$3 && d2 && vg(b2);
  b2.flags |= 1;
  Xi(a2, b2, c2, e2);
  return b2.child;
}
function hj(a2, b2, c2, d2, e2) {
  if (Zf(c2)) {
    var f2 = true;
    cg(b2);
  } else
    f2 = false;
  ch(b2, e2);
  if (null === b2.stateNode)
    ij(a2, b2), Gi(b2, c2, d2), Ii(b2, c2, d2, e2), d2 = true;
  else if (null === a2) {
    var g2 = b2.stateNode, h3 = b2.memoizedProps;
    g2.props = h3;
    var k2 = g2.context, l2 = c2.contextType;
    "object" === typeof l2 && null !== l2 ? l2 = eh(l2) : (l2 = Zf(c2) ? Xf : H$3.current, l2 = Yf(b2, l2));
    var m2 = c2.getDerivedStateFromProps, q2 = "function" === typeof m2 || "function" === typeof g2.getSnapshotBeforeUpdate;
    q2 || "function" !== typeof g2.UNSAFE_componentWillReceiveProps && "function" !== typeof g2.componentWillReceiveProps || (h3 !== d2 || k2 !== l2) && Hi(b2, g2, d2, l2);
    jh = false;
    var r2 = b2.memoizedState;
    g2.state = r2;
    qh(b2, d2, g2, e2);
    k2 = b2.memoizedState;
    h3 !== d2 || r2 !== k2 || Wf.current || jh ? ("function" === typeof m2 && (Di(b2, c2, m2, d2), k2 = b2.memoizedState), (h3 = jh || Fi(b2, c2, h3, d2, r2, k2, l2)) ? (q2 || "function" !== typeof g2.UNSAFE_componentWillMount && "function" !== typeof g2.componentWillMount || ("function" === typeof g2.componentWillMount && g2.componentWillMount(), "function" === typeof g2.UNSAFE_componentWillMount && g2.UNSAFE_componentWillMount()), "function" === typeof g2.componentDidMount && (b2.flags |= 4194308)) : ("function" === typeof g2.componentDidMount && (b2.flags |= 4194308), b2.memoizedProps = d2, b2.memoizedState = k2), g2.props = d2, g2.state = k2, g2.context = l2, d2 = h3) : ("function" === typeof g2.componentDidMount && (b2.flags |= 4194308), d2 = false);
  } else {
    g2 = b2.stateNode;
    lh(a2, b2);
    h3 = b2.memoizedProps;
    l2 = b2.type === b2.elementType ? h3 : Ci(b2.type, h3);
    g2.props = l2;
    q2 = b2.pendingProps;
    r2 = g2.context;
    k2 = c2.contextType;
    "object" === typeof k2 && null !== k2 ? k2 = eh(k2) : (k2 = Zf(c2) ? Xf : H$3.current, k2 = Yf(b2, k2));
    var y2 = c2.getDerivedStateFromProps;
    (m2 = "function" === typeof y2 || "function" === typeof g2.getSnapshotBeforeUpdate) || "function" !== typeof g2.UNSAFE_componentWillReceiveProps && "function" !== typeof g2.componentWillReceiveProps || (h3 !== q2 || r2 !== k2) && Hi(b2, g2, d2, k2);
    jh = false;
    r2 = b2.memoizedState;
    g2.state = r2;
    qh(b2, d2, g2, e2);
    var n2 = b2.memoizedState;
    h3 !== q2 || r2 !== n2 || Wf.current || jh ? ("function" === typeof y2 && (Di(b2, c2, y2, d2), n2 = b2.memoizedState), (l2 = jh || Fi(b2, c2, l2, d2, r2, n2, k2) || false) ? (m2 || "function" !== typeof g2.UNSAFE_componentWillUpdate && "function" !== typeof g2.componentWillUpdate || ("function" === typeof g2.componentWillUpdate && g2.componentWillUpdate(d2, n2, k2), "function" === typeof g2.UNSAFE_componentWillUpdate && g2.UNSAFE_componentWillUpdate(d2, n2, k2)), "function" === typeof g2.componentDidUpdate && (b2.flags |= 4), "function" === typeof g2.getSnapshotBeforeUpdate && (b2.flags |= 1024)) : ("function" !== typeof g2.componentDidUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 4), "function" !== typeof g2.getSnapshotBeforeUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 1024), b2.memoizedProps = d2, b2.memoizedState = n2), g2.props = d2, g2.state = n2, g2.context = k2, d2 = l2) : ("function" !== typeof g2.componentDidUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 4), "function" !== typeof g2.getSnapshotBeforeUpdate || h3 === a2.memoizedProps && r2 === a2.memoizedState || (b2.flags |= 1024), d2 = false);
  }
  return jj(a2, b2, c2, d2, f2, e2);
}
function jj(a2, b2, c2, d2, e2, f2) {
  gj(a2, b2);
  var g2 = 0 !== (b2.flags & 128);
  if (!d2 && !g2)
    return e2 && dg(b2, c2, false), Zi(a2, b2, f2);
  d2 = b2.stateNode;
  Wi.current = b2;
  var h3 = g2 && "function" !== typeof c2.getDerivedStateFromError ? null : d2.render();
  b2.flags |= 1;
  null !== a2 && g2 ? (b2.child = Ug(b2, a2.child, null, f2), b2.child = Ug(b2, null, h3, f2)) : Xi(a2, b2, h3, f2);
  b2.memoizedState = d2.state;
  e2 && dg(b2, c2, true);
  return b2.child;
}
function kj(a2) {
  var b2 = a2.stateNode;
  b2.pendingContext ? ag(a2, b2.pendingContext, b2.pendingContext !== b2.context) : b2.context && ag(a2, b2.context, false);
  yh(a2, b2.containerInfo);
}
function lj(a2, b2, c2, d2, e2) {
  Ig();
  Jg(e2);
  b2.flags |= 256;
  Xi(a2, b2, c2, d2);
  return b2.child;
}
var mj = { dehydrated: null, treeContext: null, retryLane: 0 };
function nj(a2) {
  return { baseLanes: a2, cachePool: null, transitions: null };
}
function oj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = L$3.current, f2 = false, g2 = 0 !== (b2.flags & 128), h3;
  (h3 = g2) || (h3 = null !== a2 && null === a2.memoizedState ? false : 0 !== (e2 & 2));
  if (h3)
    f2 = true, b2.flags &= -129;
  else if (null === a2 || null !== a2.memoizedState)
    e2 |= 1;
  G$2(L$3, e2 & 1);
  if (null === a2) {
    Eg(b2);
    a2 = b2.memoizedState;
    if (null !== a2 && (a2 = a2.dehydrated, null !== a2))
      return 0 === (b2.mode & 1) ? b2.lanes = 1 : "$!" === a2.data ? b2.lanes = 8 : b2.lanes = 1073741824, null;
    g2 = d2.children;
    a2 = d2.fallback;
    return f2 ? (d2 = b2.mode, f2 = b2.child, g2 = { mode: "hidden", children: g2 }, 0 === (d2 & 1) && null !== f2 ? (f2.childLanes = 0, f2.pendingProps = g2) : f2 = pj(g2, d2, 0, null), a2 = Tg(a2, d2, c2, null), f2.return = b2, a2.return = b2, f2.sibling = a2, b2.child = f2, b2.child.memoizedState = nj(c2), b2.memoizedState = mj, a2) : qj(b2, g2);
  }
  e2 = a2.memoizedState;
  if (null !== e2 && (h3 = e2.dehydrated, null !== h3))
    return rj(a2, b2, g2, d2, h3, e2, c2);
  if (f2) {
    f2 = d2.fallback;
    g2 = b2.mode;
    e2 = a2.child;
    h3 = e2.sibling;
    var k2 = { mode: "hidden", children: d2.children };
    0 === (g2 & 1) && b2.child !== e2 ? (d2 = b2.child, d2.childLanes = 0, d2.pendingProps = k2, b2.deletions = null) : (d2 = Pg(e2, k2), d2.subtreeFlags = e2.subtreeFlags & 14680064);
    null !== h3 ? f2 = Pg(h3, f2) : (f2 = Tg(f2, g2, c2, null), f2.flags |= 2);
    f2.return = b2;
    d2.return = b2;
    d2.sibling = f2;
    b2.child = d2;
    d2 = f2;
    f2 = b2.child;
    g2 = a2.child.memoizedState;
    g2 = null === g2 ? nj(c2) : { baseLanes: g2.baseLanes | c2, cachePool: null, transitions: g2.transitions };
    f2.memoizedState = g2;
    f2.childLanes = a2.childLanes & ~c2;
    b2.memoizedState = mj;
    return d2;
  }
  f2 = a2.child;
  a2 = f2.sibling;
  d2 = Pg(f2, { mode: "visible", children: d2.children });
  0 === (b2.mode & 1) && (d2.lanes = c2);
  d2.return = b2;
  d2.sibling = null;
  null !== a2 && (c2 = b2.deletions, null === c2 ? (b2.deletions = [a2], b2.flags |= 16) : c2.push(a2));
  b2.child = d2;
  b2.memoizedState = null;
  return d2;
}
function qj(a2, b2) {
  b2 = pj({ mode: "visible", children: b2 }, a2.mode, 0, null);
  b2.return = a2;
  return a2.child = b2;
}
function sj(a2, b2, c2, d2) {
  null !== d2 && Jg(d2);
  Ug(b2, a2.child, null, c2);
  a2 = qj(b2, b2.pendingProps.children);
  a2.flags |= 2;
  b2.memoizedState = null;
  return a2;
}
function rj(a2, b2, c2, d2, e2, f2, g2) {
  if (c2) {
    if (b2.flags & 256)
      return b2.flags &= -257, d2 = Ki(Error(p$7(422))), sj(a2, b2, g2, d2);
    if (null !== b2.memoizedState)
      return b2.child = a2.child, b2.flags |= 128, null;
    f2 = d2.fallback;
    e2 = b2.mode;
    d2 = pj({ mode: "visible", children: d2.children }, e2, 0, null);
    f2 = Tg(f2, e2, g2, null);
    f2.flags |= 2;
    d2.return = b2;
    f2.return = b2;
    d2.sibling = f2;
    b2.child = d2;
    0 !== (b2.mode & 1) && Ug(b2, a2.child, null, g2);
    b2.child.memoizedState = nj(g2);
    b2.memoizedState = mj;
    return f2;
  }
  if (0 === (b2.mode & 1))
    return sj(a2, b2, g2, null);
  if ("$!" === e2.data) {
    d2 = e2.nextSibling && e2.nextSibling.dataset;
    if (d2)
      var h3 = d2.dgst;
    d2 = h3;
    f2 = Error(p$7(419));
    d2 = Ki(f2, d2, void 0);
    return sj(a2, b2, g2, d2);
  }
  h3 = 0 !== (g2 & a2.childLanes);
  if (dh || h3) {
    d2 = Q$3;
    if (null !== d2) {
      switch (g2 & -g2) {
        case 4:
          e2 = 2;
          break;
        case 16:
          e2 = 8;
          break;
        case 64:
        case 128:
        case 256:
        case 512:
        case 1024:
        case 2048:
        case 4096:
        case 8192:
        case 16384:
        case 32768:
        case 65536:
        case 131072:
        case 262144:
        case 524288:
        case 1048576:
        case 2097152:
        case 4194304:
        case 8388608:
        case 16777216:
        case 33554432:
        case 67108864:
          e2 = 32;
          break;
        case 536870912:
          e2 = 268435456;
          break;
        default:
          e2 = 0;
      }
      e2 = 0 !== (e2 & (d2.suspendedLanes | g2)) ? 0 : e2;
      0 !== e2 && e2 !== f2.retryLane && (f2.retryLane = e2, ih(a2, e2), gi(d2, a2, e2, -1));
    }
    tj();
    d2 = Ki(Error(p$7(421)));
    return sj(a2, b2, g2, d2);
  }
  if ("$?" === e2.data)
    return b2.flags |= 128, b2.child = a2.child, b2 = uj.bind(null, a2), e2._reactRetry = b2, null;
  a2 = f2.treeContext;
  yg = Lf(e2.nextSibling);
  xg = b2;
  I$3 = true;
  zg = null;
  null !== a2 && (og[pg++] = rg, og[pg++] = sg, og[pg++] = qg, rg = a2.id, sg = a2.overflow, qg = b2);
  b2 = qj(b2, d2.children);
  b2.flags |= 4096;
  return b2;
}
function vj(a2, b2, c2) {
  a2.lanes |= b2;
  var d2 = a2.alternate;
  null !== d2 && (d2.lanes |= b2);
  bh(a2.return, b2, c2);
}
function wj(a2, b2, c2, d2, e2) {
  var f2 = a2.memoizedState;
  null === f2 ? a2.memoizedState = { isBackwards: b2, rendering: null, renderingStartTime: 0, last: d2, tail: c2, tailMode: e2 } : (f2.isBackwards = b2, f2.rendering = null, f2.renderingStartTime = 0, f2.last = d2, f2.tail = c2, f2.tailMode = e2);
}
function xj(a2, b2, c2) {
  var d2 = b2.pendingProps, e2 = d2.revealOrder, f2 = d2.tail;
  Xi(a2, b2, d2.children, c2);
  d2 = L$3.current;
  if (0 !== (d2 & 2))
    d2 = d2 & 1 | 2, b2.flags |= 128;
  else {
    if (null !== a2 && 0 !== (a2.flags & 128))
      a:
        for (a2 = b2.child; null !== a2; ) {
          if (13 === a2.tag)
            null !== a2.memoizedState && vj(a2, c2, b2);
          else if (19 === a2.tag)
            vj(a2, c2, b2);
          else if (null !== a2.child) {
            a2.child.return = a2;
            a2 = a2.child;
            continue;
          }
          if (a2 === b2)
            break a;
          for (; null === a2.sibling; ) {
            if (null === a2.return || a2.return === b2)
              break a;
            a2 = a2.return;
          }
          a2.sibling.return = a2.return;
          a2 = a2.sibling;
        }
    d2 &= 1;
  }
  G$2(L$3, d2);
  if (0 === (b2.mode & 1))
    b2.memoizedState = null;
  else
    switch (e2) {
      case "forwards":
        c2 = b2.child;
        for (e2 = null; null !== c2; )
          a2 = c2.alternate, null !== a2 && null === Ch(a2) && (e2 = c2), c2 = c2.sibling;
        c2 = e2;
        null === c2 ? (e2 = b2.child, b2.child = null) : (e2 = c2.sibling, c2.sibling = null);
        wj(b2, false, e2, c2, f2);
        break;
      case "backwards":
        c2 = null;
        e2 = b2.child;
        for (b2.child = null; null !== e2; ) {
          a2 = e2.alternate;
          if (null !== a2 && null === Ch(a2)) {
            b2.child = e2;
            break;
          }
          a2 = e2.sibling;
          e2.sibling = c2;
          c2 = e2;
          e2 = a2;
        }
        wj(b2, true, c2, null, f2);
        break;
      case "together":
        wj(b2, false, null, null, void 0);
        break;
      default:
        b2.memoizedState = null;
    }
  return b2.child;
}
function ij(a2, b2) {
  0 === (b2.mode & 1) && null !== a2 && (a2.alternate = null, b2.alternate = null, b2.flags |= 2);
}
function Zi(a2, b2, c2) {
  null !== a2 && (b2.dependencies = a2.dependencies);
  rh |= b2.lanes;
  if (0 === (c2 & b2.childLanes))
    return null;
  if (null !== a2 && b2.child !== a2.child)
    throw Error(p$7(153));
  if (null !== b2.child) {
    a2 = b2.child;
    c2 = Pg(a2, a2.pendingProps);
    b2.child = c2;
    for (c2.return = b2; null !== a2.sibling; )
      a2 = a2.sibling, c2 = c2.sibling = Pg(a2, a2.pendingProps), c2.return = b2;
    c2.sibling = null;
  }
  return b2.child;
}
function yj(a2, b2, c2) {
  switch (b2.tag) {
    case 3:
      kj(b2);
      Ig();
      break;
    case 5:
      Ah(b2);
      break;
    case 1:
      Zf(b2.type) && cg(b2);
      break;
    case 4:
      yh(b2, b2.stateNode.containerInfo);
      break;
    case 10:
      var d2 = b2.type._context, e2 = b2.memoizedProps.value;
      G$2(Wg, d2._currentValue);
      d2._currentValue = e2;
      break;
    case 13:
      d2 = b2.memoizedState;
      if (null !== d2) {
        if (null !== d2.dehydrated)
          return G$2(L$3, L$3.current & 1), b2.flags |= 128, null;
        if (0 !== (c2 & b2.child.childLanes))
          return oj(a2, b2, c2);
        G$2(L$3, L$3.current & 1);
        a2 = Zi(a2, b2, c2);
        return null !== a2 ? a2.sibling : null;
      }
      G$2(L$3, L$3.current & 1);
      break;
    case 19:
      d2 = 0 !== (c2 & b2.childLanes);
      if (0 !== (a2.flags & 128)) {
        if (d2)
          return xj(a2, b2, c2);
        b2.flags |= 128;
      }
      e2 = b2.memoizedState;
      null !== e2 && (e2.rendering = null, e2.tail = null, e2.lastEffect = null);
      G$2(L$3, L$3.current);
      if (d2)
        break;
      else
        return null;
    case 22:
    case 23:
      return b2.lanes = 0, dj(a2, b2, c2);
  }
  return Zi(a2, b2, c2);
}
var zj, Aj, Bj, Cj;
zj = function(a2, b2) {
  for (var c2 = b2.child; null !== c2; ) {
    if (5 === c2.tag || 6 === c2.tag)
      a2.appendChild(c2.stateNode);
    else if (4 !== c2.tag && null !== c2.child) {
      c2.child.return = c2;
      c2 = c2.child;
      continue;
    }
    if (c2 === b2)
      break;
    for (; null === c2.sibling; ) {
      if (null === c2.return || c2.return === b2)
        return;
      c2 = c2.return;
    }
    c2.sibling.return = c2.return;
    c2 = c2.sibling;
  }
};
Aj = function() {
};
Bj = function(a2, b2, c2, d2) {
  var e2 = a2.memoizedProps;
  if (e2 !== d2) {
    a2 = b2.stateNode;
    xh(uh.current);
    var f2 = null;
    switch (c2) {
      case "input":
        e2 = Ya$2(a2, e2);
        d2 = Ya$2(a2, d2);
        f2 = [];
        break;
      case "select":
        e2 = A$4({}, e2, { value: void 0 });
        d2 = A$4({}, d2, { value: void 0 });
        f2 = [];
        break;
      case "textarea":
        e2 = gb$2(a2, e2);
        d2 = gb$2(a2, d2);
        f2 = [];
        break;
      default:
        "function" !== typeof e2.onClick && "function" === typeof d2.onClick && (a2.onclick = Bf);
    }
    ub$2(c2, d2);
    var g2;
    c2 = null;
    for (l2 in e2)
      if (!d2.hasOwnProperty(l2) && e2.hasOwnProperty(l2) && null != e2[l2])
        if ("style" === l2) {
          var h3 = e2[l2];
          for (g2 in h3)
            h3.hasOwnProperty(g2) && (c2 || (c2 = {}), c2[g2] = "");
        } else
          "dangerouslySetInnerHTML" !== l2 && "children" !== l2 && "suppressContentEditableWarning" !== l2 && "suppressHydrationWarning" !== l2 && "autoFocus" !== l2 && (ea$1.hasOwnProperty(l2) ? f2 || (f2 = []) : (f2 = f2 || []).push(l2, null));
    for (l2 in d2) {
      var k2 = d2[l2];
      h3 = null != e2 ? e2[l2] : void 0;
      if (d2.hasOwnProperty(l2) && k2 !== h3 && (null != k2 || null != h3))
        if ("style" === l2)
          if (h3) {
            for (g2 in h3)
              !h3.hasOwnProperty(g2) || k2 && k2.hasOwnProperty(g2) || (c2 || (c2 = {}), c2[g2] = "");
            for (g2 in k2)
              k2.hasOwnProperty(g2) && h3[g2] !== k2[g2] && (c2 || (c2 = {}), c2[g2] = k2[g2]);
          } else
            c2 || (f2 || (f2 = []), f2.push(
              l2,
              c2
            )), c2 = k2;
        else
          "dangerouslySetInnerHTML" === l2 ? (k2 = k2 ? k2.__html : void 0, h3 = h3 ? h3.__html : void 0, null != k2 && h3 !== k2 && (f2 = f2 || []).push(l2, k2)) : "children" === l2 ? "string" !== typeof k2 && "number" !== typeof k2 || (f2 = f2 || []).push(l2, "" + k2) : "suppressContentEditableWarning" !== l2 && "suppressHydrationWarning" !== l2 && (ea$1.hasOwnProperty(l2) ? (null != k2 && "onScroll" === l2 && D$2("scroll", a2), f2 || h3 === k2 || (f2 = [])) : (f2 = f2 || []).push(l2, k2));
    }
    c2 && (f2 = f2 || []).push("style", c2);
    var l2 = f2;
    if (b2.updateQueue = l2)
      b2.flags |= 4;
  }
};
Cj = function(a2, b2, c2, d2) {
  c2 !== d2 && (b2.flags |= 4);
};
function Dj(a2, b2) {
  if (!I$3)
    switch (a2.tailMode) {
      case "hidden":
        b2 = a2.tail;
        for (var c2 = null; null !== b2; )
          null !== b2.alternate && (c2 = b2), b2 = b2.sibling;
        null === c2 ? a2.tail = null : c2.sibling = null;
        break;
      case "collapsed":
        c2 = a2.tail;
        for (var d2 = null; null !== c2; )
          null !== c2.alternate && (d2 = c2), c2 = c2.sibling;
        null === d2 ? b2 || null === a2.tail ? a2.tail = null : a2.tail.sibling = null : d2.sibling = null;
    }
}
function S$3(a2) {
  var b2 = null !== a2.alternate && a2.alternate.child === a2.child, c2 = 0, d2 = 0;
  if (b2)
    for (var e2 = a2.child; null !== e2; )
      c2 |= e2.lanes | e2.childLanes, d2 |= e2.subtreeFlags & 14680064, d2 |= e2.flags & 14680064, e2.return = a2, e2 = e2.sibling;
  else
    for (e2 = a2.child; null !== e2; )
      c2 |= e2.lanes | e2.childLanes, d2 |= e2.subtreeFlags, d2 |= e2.flags, e2.return = a2, e2 = e2.sibling;
  a2.subtreeFlags |= d2;
  a2.childLanes = c2;
  return b2;
}
function Ej(a2, b2, c2) {
  var d2 = b2.pendingProps;
  wg(b2);
  switch (b2.tag) {
    case 2:
    case 16:
    case 15:
    case 0:
    case 11:
    case 7:
    case 8:
    case 12:
    case 9:
    case 14:
      return S$3(b2), null;
    case 1:
      return Zf(b2.type) && $f(), S$3(b2), null;
    case 3:
      d2 = b2.stateNode;
      zh();
      E$3(Wf);
      E$3(H$3);
      Eh();
      d2.pendingContext && (d2.context = d2.pendingContext, d2.pendingContext = null);
      if (null === a2 || null === a2.child)
        Gg(b2) ? b2.flags |= 4 : null === a2 || a2.memoizedState.isDehydrated && 0 === (b2.flags & 256) || (b2.flags |= 1024, null !== zg && (Fj(zg), zg = null));
      Aj(a2, b2);
      S$3(b2);
      return null;
    case 5:
      Bh(b2);
      var e2 = xh(wh.current);
      c2 = b2.type;
      if (null !== a2 && null != b2.stateNode)
        Bj(a2, b2, c2, d2, e2), a2.ref !== b2.ref && (b2.flags |= 512, b2.flags |= 2097152);
      else {
        if (!d2) {
          if (null === b2.stateNode)
            throw Error(p$7(166));
          S$3(b2);
          return null;
        }
        a2 = xh(uh.current);
        if (Gg(b2)) {
          d2 = b2.stateNode;
          c2 = b2.type;
          var f2 = b2.memoizedProps;
          d2[Of] = b2;
          d2[Pf] = f2;
          a2 = 0 !== (b2.mode & 1);
          switch (c2) {
            case "dialog":
              D$2("cancel", d2);
              D$2("close", d2);
              break;
            case "iframe":
            case "object":
            case "embed":
              D$2("load", d2);
              break;
            case "video":
            case "audio":
              for (e2 = 0; e2 < lf.length; e2++)
                D$2(lf[e2], d2);
              break;
            case "source":
              D$2("error", d2);
              break;
            case "img":
            case "image":
            case "link":
              D$2(
                "error",
                d2
              );
              D$2("load", d2);
              break;
            case "details":
              D$2("toggle", d2);
              break;
            case "input":
              Za$2(d2, f2);
              D$2("invalid", d2);
              break;
            case "select":
              d2._wrapperState = { wasMultiple: !!f2.multiple };
              D$2("invalid", d2);
              break;
            case "textarea":
              hb$2(d2, f2), D$2("invalid", d2);
          }
          ub$2(c2, f2);
          e2 = null;
          for (var g2 in f2)
            if (f2.hasOwnProperty(g2)) {
              var h3 = f2[g2];
              "children" === g2 ? "string" === typeof h3 ? d2.textContent !== h3 && (true !== f2.suppressHydrationWarning && Af(d2.textContent, h3, a2), e2 = ["children", h3]) : "number" === typeof h3 && d2.textContent !== "" + h3 && (true !== f2.suppressHydrationWarning && Af(
                d2.textContent,
                h3,
                a2
              ), e2 = ["children", "" + h3]) : ea$1.hasOwnProperty(g2) && null != h3 && "onScroll" === g2 && D$2("scroll", d2);
            }
          switch (c2) {
            case "input":
              Va$2(d2);
              db$2(d2, f2, true);
              break;
            case "textarea":
              Va$2(d2);
              jb$2(d2);
              break;
            case "select":
            case "option":
              break;
            default:
              "function" === typeof f2.onClick && (d2.onclick = Bf);
          }
          d2 = e2;
          b2.updateQueue = d2;
          null !== d2 && (b2.flags |= 4);
        } else {
          g2 = 9 === e2.nodeType ? e2 : e2.ownerDocument;
          "http://www.w3.org/1999/xhtml" === a2 && (a2 = kb$2(c2));
          "http://www.w3.org/1999/xhtml" === a2 ? "script" === c2 ? (a2 = g2.createElement("div"), a2.innerHTML = "<script><\/script>", a2 = a2.removeChild(a2.firstChild)) : "string" === typeof d2.is ? a2 = g2.createElement(c2, { is: d2.is }) : (a2 = g2.createElement(c2), "select" === c2 && (g2 = a2, d2.multiple ? g2.multiple = true : d2.size && (g2.size = d2.size))) : a2 = g2.createElementNS(a2, c2);
          a2[Of] = b2;
          a2[Pf] = d2;
          zj(a2, b2, false, false);
          b2.stateNode = a2;
          a: {
            g2 = vb$2(c2, d2);
            switch (c2) {
              case "dialog":
                D$2("cancel", a2);
                D$2("close", a2);
                e2 = d2;
                break;
              case "iframe":
              case "object":
              case "embed":
                D$2("load", a2);
                e2 = d2;
                break;
              case "video":
              case "audio":
                for (e2 = 0; e2 < lf.length; e2++)
                  D$2(lf[e2], a2);
                e2 = d2;
                break;
              case "source":
                D$2("error", a2);
                e2 = d2;
                break;
              case "img":
              case "image":
              case "link":
                D$2(
                  "error",
                  a2
                );
                D$2("load", a2);
                e2 = d2;
                break;
              case "details":
                D$2("toggle", a2);
                e2 = d2;
                break;
              case "input":
                Za$2(a2, d2);
                e2 = Ya$2(a2, d2);
                D$2("invalid", a2);
                break;
              case "option":
                e2 = d2;
                break;
              case "select":
                a2._wrapperState = { wasMultiple: !!d2.multiple };
                e2 = A$4({}, d2, { value: void 0 });
                D$2("invalid", a2);
                break;
              case "textarea":
                hb$2(a2, d2);
                e2 = gb$2(a2, d2);
                D$2("invalid", a2);
                break;
              default:
                e2 = d2;
            }
            ub$2(c2, e2);
            h3 = e2;
            for (f2 in h3)
              if (h3.hasOwnProperty(f2)) {
                var k2 = h3[f2];
                "style" === f2 ? sb$2(a2, k2) : "dangerouslySetInnerHTML" === f2 ? (k2 = k2 ? k2.__html : void 0, null != k2 && nb$1(a2, k2)) : "children" === f2 ? "string" === typeof k2 ? ("textarea" !== c2 || "" !== k2) && ob$2(a2, k2) : "number" === typeof k2 && ob$2(a2, "" + k2) : "suppressContentEditableWarning" !== f2 && "suppressHydrationWarning" !== f2 && "autoFocus" !== f2 && (ea$1.hasOwnProperty(f2) ? null != k2 && "onScroll" === f2 && D$2("scroll", a2) : null != k2 && ta$2(a2, f2, k2, g2));
              }
            switch (c2) {
              case "input":
                Va$2(a2);
                db$2(a2, d2, false);
                break;
              case "textarea":
                Va$2(a2);
                jb$2(a2);
                break;
              case "option":
                null != d2.value && a2.setAttribute("value", "" + Sa$2(d2.value));
                break;
              case "select":
                a2.multiple = !!d2.multiple;
                f2 = d2.value;
                null != f2 ? fb$2(a2, !!d2.multiple, f2, false) : null != d2.defaultValue && fb$2(
                  a2,
                  !!d2.multiple,
                  d2.defaultValue,
                  true
                );
                break;
              default:
                "function" === typeof e2.onClick && (a2.onclick = Bf);
            }
            switch (c2) {
              case "button":
              case "input":
              case "select":
              case "textarea":
                d2 = !!d2.autoFocus;
                break a;
              case "img":
                d2 = true;
                break a;
              default:
                d2 = false;
            }
          }
          d2 && (b2.flags |= 4);
        }
        null !== b2.ref && (b2.flags |= 512, b2.flags |= 2097152);
      }
      S$3(b2);
      return null;
    case 6:
      if (a2 && null != b2.stateNode)
        Cj(a2, b2, a2.memoizedProps, d2);
      else {
        if ("string" !== typeof d2 && null === b2.stateNode)
          throw Error(p$7(166));
        c2 = xh(wh.current);
        xh(uh.current);
        if (Gg(b2)) {
          d2 = b2.stateNode;
          c2 = b2.memoizedProps;
          d2[Of] = b2;
          if (f2 = d2.nodeValue !== c2) {
            if (a2 = xg, null !== a2)
              switch (a2.tag) {
                case 3:
                  Af(d2.nodeValue, c2, 0 !== (a2.mode & 1));
                  break;
                case 5:
                  true !== a2.memoizedProps.suppressHydrationWarning && Af(d2.nodeValue, c2, 0 !== (a2.mode & 1));
              }
          }
          f2 && (b2.flags |= 4);
        } else
          d2 = (9 === c2.nodeType ? c2 : c2.ownerDocument).createTextNode(d2), d2[Of] = b2, b2.stateNode = d2;
      }
      S$3(b2);
      return null;
    case 13:
      E$3(L$3);
      d2 = b2.memoizedState;
      if (null === a2 || null !== a2.memoizedState && null !== a2.memoizedState.dehydrated) {
        if (I$3 && null !== yg && 0 !== (b2.mode & 1) && 0 === (b2.flags & 128))
          Hg(), Ig(), b2.flags |= 98560, f2 = false;
        else if (f2 = Gg(b2), null !== d2 && null !== d2.dehydrated) {
          if (null === a2) {
            if (!f2)
              throw Error(p$7(318));
            f2 = b2.memoizedState;
            f2 = null !== f2 ? f2.dehydrated : null;
            if (!f2)
              throw Error(p$7(317));
            f2[Of] = b2;
          } else
            Ig(), 0 === (b2.flags & 128) && (b2.memoizedState = null), b2.flags |= 4;
          S$3(b2);
          f2 = false;
        } else
          null !== zg && (Fj(zg), zg = null), f2 = true;
        if (!f2)
          return b2.flags & 65536 ? b2 : null;
      }
      if (0 !== (b2.flags & 128))
        return b2.lanes = c2, b2;
      d2 = null !== d2;
      d2 !== (null !== a2 && null !== a2.memoizedState) && d2 && (b2.child.flags |= 8192, 0 !== (b2.mode & 1) && (null === a2 || 0 !== (L$3.current & 1) ? 0 === T$2 && (T$2 = 3) : tj()));
      null !== b2.updateQueue && (b2.flags |= 4);
      S$3(b2);
      return null;
    case 4:
      return zh(), Aj(a2, b2), null === a2 && sf(b2.stateNode.containerInfo), S$3(b2), null;
    case 10:
      return ah(b2.type._context), S$3(b2), null;
    case 17:
      return Zf(b2.type) && $f(), S$3(b2), null;
    case 19:
      E$3(L$3);
      f2 = b2.memoizedState;
      if (null === f2)
        return S$3(b2), null;
      d2 = 0 !== (b2.flags & 128);
      g2 = f2.rendering;
      if (null === g2)
        if (d2)
          Dj(f2, false);
        else {
          if (0 !== T$2 || null !== a2 && 0 !== (a2.flags & 128))
            for (a2 = b2.child; null !== a2; ) {
              g2 = Ch(a2);
              if (null !== g2) {
                b2.flags |= 128;
                Dj(f2, false);
                d2 = g2.updateQueue;
                null !== d2 && (b2.updateQueue = d2, b2.flags |= 4);
                b2.subtreeFlags = 0;
                d2 = c2;
                for (c2 = b2.child; null !== c2; )
                  f2 = c2, a2 = d2, f2.flags &= 14680066, g2 = f2.alternate, null === g2 ? (f2.childLanes = 0, f2.lanes = a2, f2.child = null, f2.subtreeFlags = 0, f2.memoizedProps = null, f2.memoizedState = null, f2.updateQueue = null, f2.dependencies = null, f2.stateNode = null) : (f2.childLanes = g2.childLanes, f2.lanes = g2.lanes, f2.child = g2.child, f2.subtreeFlags = 0, f2.deletions = null, f2.memoizedProps = g2.memoizedProps, f2.memoizedState = g2.memoizedState, f2.updateQueue = g2.updateQueue, f2.type = g2.type, a2 = g2.dependencies, f2.dependencies = null === a2 ? null : { lanes: a2.lanes, firstContext: a2.firstContext }), c2 = c2.sibling;
                G$2(L$3, L$3.current & 1 | 2);
                return b2.child;
              }
              a2 = a2.sibling;
            }
          null !== f2.tail && B$3() > Gj && (b2.flags |= 128, d2 = true, Dj(f2, false), b2.lanes = 4194304);
        }
      else {
        if (!d2)
          if (a2 = Ch(g2), null !== a2) {
            if (b2.flags |= 128, d2 = true, c2 = a2.updateQueue, null !== c2 && (b2.updateQueue = c2, b2.flags |= 4), Dj(f2, true), null === f2.tail && "hidden" === f2.tailMode && !g2.alternate && !I$3)
              return S$3(b2), null;
          } else
            2 * B$3() - f2.renderingStartTime > Gj && 1073741824 !== c2 && (b2.flags |= 128, d2 = true, Dj(f2, false), b2.lanes = 4194304);
        f2.isBackwards ? (g2.sibling = b2.child, b2.child = g2) : (c2 = f2.last, null !== c2 ? c2.sibling = g2 : b2.child = g2, f2.last = g2);
      }
      if (null !== f2.tail)
        return b2 = f2.tail, f2.rendering = b2, f2.tail = b2.sibling, f2.renderingStartTime = B$3(), b2.sibling = null, c2 = L$3.current, G$2(L$3, d2 ? c2 & 1 | 2 : c2 & 1), b2;
      S$3(b2);
      return null;
    case 22:
    case 23:
      return Hj(), d2 = null !== b2.memoizedState, null !== a2 && null !== a2.memoizedState !== d2 && (b2.flags |= 8192), d2 && 0 !== (b2.mode & 1) ? 0 !== (fj & 1073741824) && (S$3(b2), b2.subtreeFlags & 6 && (b2.flags |= 8192)) : S$3(b2), null;
    case 24:
      return null;
    case 25:
      return null;
  }
  throw Error(p$7(156, b2.tag));
}
function Ij(a2, b2) {
  wg(b2);
  switch (b2.tag) {
    case 1:
      return Zf(b2.type) && $f(), a2 = b2.flags, a2 & 65536 ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 3:
      return zh(), E$3(Wf), E$3(H$3), Eh(), a2 = b2.flags, 0 !== (a2 & 65536) && 0 === (a2 & 128) ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 5:
      return Bh(b2), null;
    case 13:
      E$3(L$3);
      a2 = b2.memoizedState;
      if (null !== a2 && null !== a2.dehydrated) {
        if (null === b2.alternate)
          throw Error(p$7(340));
        Ig();
      }
      a2 = b2.flags;
      return a2 & 65536 ? (b2.flags = a2 & -65537 | 128, b2) : null;
    case 19:
      return E$3(L$3), null;
    case 4:
      return zh(), null;
    case 10:
      return ah(b2.type._context), null;
    case 22:
    case 23:
      return Hj(), null;
    case 24:
      return null;
    default:
      return null;
  }
}
var Jj = false, U$4 = false, Kj = "function" === typeof WeakSet ? WeakSet : Set, V$3 = null;
function Lj(a2, b2) {
  var c2 = a2.ref;
  if (null !== c2)
    if ("function" === typeof c2)
      try {
        c2(null);
      } catch (d2) {
        W$4(a2, b2, d2);
      }
    else
      c2.current = null;
}
function Mj(a2, b2, c2) {
  try {
    c2();
  } catch (d2) {
    W$4(a2, b2, d2);
  }
}
var Nj = false;
function Oj(a2, b2) {
  Cf = dd$1;
  a2 = Me();
  if (Ne(a2)) {
    if ("selectionStart" in a2)
      var c2 = { start: a2.selectionStart, end: a2.selectionEnd };
    else
      a: {
        c2 = (c2 = a2.ownerDocument) && c2.defaultView || window;
        var d2 = c2.getSelection && c2.getSelection();
        if (d2 && 0 !== d2.rangeCount) {
          c2 = d2.anchorNode;
          var e2 = d2.anchorOffset, f2 = d2.focusNode;
          d2 = d2.focusOffset;
          try {
            c2.nodeType, f2.nodeType;
          } catch (F2) {
            c2 = null;
            break a;
          }
          var g2 = 0, h3 = -1, k2 = -1, l2 = 0, m2 = 0, q2 = a2, r2 = null;
          b:
            for (; ; ) {
              for (var y2; ; ) {
                q2 !== c2 || 0 !== e2 && 3 !== q2.nodeType || (h3 = g2 + e2);
                q2 !== f2 || 0 !== d2 && 3 !== q2.nodeType || (k2 = g2 + d2);
                3 === q2.nodeType && (g2 += q2.nodeValue.length);
                if (null === (y2 = q2.firstChild))
                  break;
                r2 = q2;
                q2 = y2;
              }
              for (; ; ) {
                if (q2 === a2)
                  break b;
                r2 === c2 && ++l2 === e2 && (h3 = g2);
                r2 === f2 && ++m2 === d2 && (k2 = g2);
                if (null !== (y2 = q2.nextSibling))
                  break;
                q2 = r2;
                r2 = q2.parentNode;
              }
              q2 = y2;
            }
          c2 = -1 === h3 || -1 === k2 ? null : { start: h3, end: k2 };
        } else
          c2 = null;
      }
    c2 = c2 || { start: 0, end: 0 };
  } else
    c2 = null;
  Df = { focusedElem: a2, selectionRange: c2 };
  dd$1 = false;
  for (V$3 = b2; null !== V$3; )
    if (b2 = V$3, a2 = b2.child, 0 !== (b2.subtreeFlags & 1028) && null !== a2)
      a2.return = b2, V$3 = a2;
    else
      for (; null !== V$3; ) {
        b2 = V$3;
        try {
          var n2 = b2.alternate;
          if (0 !== (b2.flags & 1024))
            switch (b2.tag) {
              case 0:
              case 11:
              case 15:
                break;
              case 1:
                if (null !== n2) {
                  var t2 = n2.memoizedProps, J2 = n2.memoizedState, x2 = b2.stateNode, w2 = x2.getSnapshotBeforeUpdate(b2.elementType === b2.type ? t2 : Ci(b2.type, t2), J2);
                  x2.__reactInternalSnapshotBeforeUpdate = w2;
                }
                break;
              case 3:
                var u2 = b2.stateNode.containerInfo;
                1 === u2.nodeType ? u2.textContent = "" : 9 === u2.nodeType && u2.documentElement && u2.removeChild(u2.documentElement);
                break;
              case 5:
              case 6:
              case 4:
              case 17:
                break;
              default:
                throw Error(p$7(163));
            }
        } catch (F2) {
          W$4(b2, b2.return, F2);
        }
        a2 = b2.sibling;
        if (null !== a2) {
          a2.return = b2.return;
          V$3 = a2;
          break;
        }
        V$3 = b2.return;
      }
  n2 = Nj;
  Nj = false;
  return n2;
}
function Pj(a2, b2, c2) {
  var d2 = b2.updateQueue;
  d2 = null !== d2 ? d2.lastEffect : null;
  if (null !== d2) {
    var e2 = d2 = d2.next;
    do {
      if ((e2.tag & a2) === a2) {
        var f2 = e2.destroy;
        e2.destroy = void 0;
        void 0 !== f2 && Mj(b2, c2, f2);
      }
      e2 = e2.next;
    } while (e2 !== d2);
  }
}
function Qj(a2, b2) {
  b2 = b2.updateQueue;
  b2 = null !== b2 ? b2.lastEffect : null;
  if (null !== b2) {
    var c2 = b2 = b2.next;
    do {
      if ((c2.tag & a2) === a2) {
        var d2 = c2.create;
        c2.destroy = d2();
      }
      c2 = c2.next;
    } while (c2 !== b2);
  }
}
function Rj(a2) {
  var b2 = a2.ref;
  if (null !== b2) {
    var c2 = a2.stateNode;
    switch (a2.tag) {
      case 5:
        a2 = c2;
        break;
      default:
        a2 = c2;
    }
    "function" === typeof b2 ? b2(a2) : b2.current = a2;
  }
}
function Sj(a2) {
  var b2 = a2.alternate;
  null !== b2 && (a2.alternate = null, Sj(b2));
  a2.child = null;
  a2.deletions = null;
  a2.sibling = null;
  5 === a2.tag && (b2 = a2.stateNode, null !== b2 && (delete b2[Of], delete b2[Pf], delete b2[of], delete b2[Qf], delete b2[Rf]));
  a2.stateNode = null;
  a2.return = null;
  a2.dependencies = null;
  a2.memoizedProps = null;
  a2.memoizedState = null;
  a2.pendingProps = null;
  a2.stateNode = null;
  a2.updateQueue = null;
}
function Tj(a2) {
  return 5 === a2.tag || 3 === a2.tag || 4 === a2.tag;
}
function Uj(a2) {
  a:
    for (; ; ) {
      for (; null === a2.sibling; ) {
        if (null === a2.return || Tj(a2.return))
          return null;
        a2 = a2.return;
      }
      a2.sibling.return = a2.return;
      for (a2 = a2.sibling; 5 !== a2.tag && 6 !== a2.tag && 18 !== a2.tag; ) {
        if (a2.flags & 2)
          continue a;
        if (null === a2.child || 4 === a2.tag)
          continue a;
        else
          a2.child.return = a2, a2 = a2.child;
      }
      if (!(a2.flags & 2))
        return a2.stateNode;
    }
}
function Vj(a2, b2, c2) {
  var d2 = a2.tag;
  if (5 === d2 || 6 === d2)
    a2 = a2.stateNode, b2 ? 8 === c2.nodeType ? c2.parentNode.insertBefore(a2, b2) : c2.insertBefore(a2, b2) : (8 === c2.nodeType ? (b2 = c2.parentNode, b2.insertBefore(a2, c2)) : (b2 = c2, b2.appendChild(a2)), c2 = c2._reactRootContainer, null !== c2 && void 0 !== c2 || null !== b2.onclick || (b2.onclick = Bf));
  else if (4 !== d2 && (a2 = a2.child, null !== a2))
    for (Vj(a2, b2, c2), a2 = a2.sibling; null !== a2; )
      Vj(a2, b2, c2), a2 = a2.sibling;
}
function Wj(a2, b2, c2) {
  var d2 = a2.tag;
  if (5 === d2 || 6 === d2)
    a2 = a2.stateNode, b2 ? c2.insertBefore(a2, b2) : c2.appendChild(a2);
  else if (4 !== d2 && (a2 = a2.child, null !== a2))
    for (Wj(a2, b2, c2), a2 = a2.sibling; null !== a2; )
      Wj(a2, b2, c2), a2 = a2.sibling;
}
var X$3 = null, Xj = false;
function Yj(a2, b2, c2) {
  for (c2 = c2.child; null !== c2; )
    Zj(a2, b2, c2), c2 = c2.sibling;
}
function Zj(a2, b2, c2) {
  if (lc$1 && "function" === typeof lc$1.onCommitFiberUnmount)
    try {
      lc$1.onCommitFiberUnmount(kc$1, c2);
    } catch (h3) {
    }
  switch (c2.tag) {
    case 5:
      U$4 || Lj(c2, b2);
    case 6:
      var d2 = X$3, e2 = Xj;
      X$3 = null;
      Yj(a2, b2, c2);
      X$3 = d2;
      Xj = e2;
      null !== X$3 && (Xj ? (a2 = X$3, c2 = c2.stateNode, 8 === a2.nodeType ? a2.parentNode.removeChild(c2) : a2.removeChild(c2)) : X$3.removeChild(c2.stateNode));
      break;
    case 18:
      null !== X$3 && (Xj ? (a2 = X$3, c2 = c2.stateNode, 8 === a2.nodeType ? Kf(a2.parentNode, c2) : 1 === a2.nodeType && Kf(a2, c2), bd$1(a2)) : Kf(X$3, c2.stateNode));
      break;
    case 4:
      d2 = X$3;
      e2 = Xj;
      X$3 = c2.stateNode.containerInfo;
      Xj = true;
      Yj(a2, b2, c2);
      X$3 = d2;
      Xj = e2;
      break;
    case 0:
    case 11:
    case 14:
    case 15:
      if (!U$4 && (d2 = c2.updateQueue, null !== d2 && (d2 = d2.lastEffect, null !== d2))) {
        e2 = d2 = d2.next;
        do {
          var f2 = e2, g2 = f2.destroy;
          f2 = f2.tag;
          void 0 !== g2 && (0 !== (f2 & 2) ? Mj(c2, b2, g2) : 0 !== (f2 & 4) && Mj(c2, b2, g2));
          e2 = e2.next;
        } while (e2 !== d2);
      }
      Yj(a2, b2, c2);
      break;
    case 1:
      if (!U$4 && (Lj(c2, b2), d2 = c2.stateNode, "function" === typeof d2.componentWillUnmount))
        try {
          d2.props = c2.memoizedProps, d2.state = c2.memoizedState, d2.componentWillUnmount();
        } catch (h3) {
          W$4(c2, b2, h3);
        }
      Yj(a2, b2, c2);
      break;
    case 21:
      Yj(a2, b2, c2);
      break;
    case 22:
      c2.mode & 1 ? (U$4 = (d2 = U$4) || null !== c2.memoizedState, Yj(a2, b2, c2), U$4 = d2) : Yj(a2, b2, c2);
      break;
    default:
      Yj(a2, b2, c2);
  }
}
function ak(a2) {
  var b2 = a2.updateQueue;
  if (null !== b2) {
    a2.updateQueue = null;
    var c2 = a2.stateNode;
    null === c2 && (c2 = a2.stateNode = new Kj());
    b2.forEach(function(b3) {
      var d2 = bk.bind(null, a2, b3);
      c2.has(b3) || (c2.add(b3), b3.then(d2, d2));
    });
  }
}
function ck(a2, b2) {
  var c2 = b2.deletions;
  if (null !== c2)
    for (var d2 = 0; d2 < c2.length; d2++) {
      var e2 = c2[d2];
      try {
        var f2 = a2, g2 = b2, h3 = g2;
        a:
          for (; null !== h3; ) {
            switch (h3.tag) {
              case 5:
                X$3 = h3.stateNode;
                Xj = false;
                break a;
              case 3:
                X$3 = h3.stateNode.containerInfo;
                Xj = true;
                break a;
              case 4:
                X$3 = h3.stateNode.containerInfo;
                Xj = true;
                break a;
            }
            h3 = h3.return;
          }
        if (null === X$3)
          throw Error(p$7(160));
        Zj(f2, g2, e2);
        X$3 = null;
        Xj = false;
        var k2 = e2.alternate;
        null !== k2 && (k2.return = null);
        e2.return = null;
      } catch (l2) {
        W$4(e2, b2, l2);
      }
    }
  if (b2.subtreeFlags & 12854)
    for (b2 = b2.child; null !== b2; )
      dk(b2, a2), b2 = b2.sibling;
}
function dk(a2, b2) {
  var c2 = a2.alternate, d2 = a2.flags;
  switch (a2.tag) {
    case 0:
    case 11:
    case 14:
    case 15:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4) {
        try {
          Pj(3, a2, a2.return), Qj(3, a2);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
        try {
          Pj(5, a2, a2.return);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      break;
    case 1:
      ck(b2, a2);
      ek(a2);
      d2 & 512 && null !== c2 && Lj(c2, c2.return);
      break;
    case 5:
      ck(b2, a2);
      ek(a2);
      d2 & 512 && null !== c2 && Lj(c2, c2.return);
      if (a2.flags & 32) {
        var e2 = a2.stateNode;
        try {
          ob$2(e2, "");
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      if (d2 & 4 && (e2 = a2.stateNode, null != e2)) {
        var f2 = a2.memoizedProps, g2 = null !== c2 ? c2.memoizedProps : f2, h3 = a2.type, k2 = a2.updateQueue;
        a2.updateQueue = null;
        if (null !== k2)
          try {
            "input" === h3 && "radio" === f2.type && null != f2.name && ab$2(e2, f2);
            vb$2(h3, g2);
            var l2 = vb$2(h3, f2);
            for (g2 = 0; g2 < k2.length; g2 += 2) {
              var m2 = k2[g2], q2 = k2[g2 + 1];
              "style" === m2 ? sb$2(e2, q2) : "dangerouslySetInnerHTML" === m2 ? nb$1(e2, q2) : "children" === m2 ? ob$2(e2, q2) : ta$2(e2, m2, q2, l2);
            }
            switch (h3) {
              case "input":
                bb$2(e2, f2);
                break;
              case "textarea":
                ib$2(e2, f2);
                break;
              case "select":
                var r2 = e2._wrapperState.wasMultiple;
                e2._wrapperState.wasMultiple = !!f2.multiple;
                var y2 = f2.value;
                null != y2 ? fb$2(e2, !!f2.multiple, y2, false) : r2 !== !!f2.multiple && (null != f2.defaultValue ? fb$2(
                  e2,
                  !!f2.multiple,
                  f2.defaultValue,
                  true
                ) : fb$2(e2, !!f2.multiple, f2.multiple ? [] : "", false));
            }
            e2[Pf] = f2;
          } catch (t2) {
            W$4(a2, a2.return, t2);
          }
      }
      break;
    case 6:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4) {
        if (null === a2.stateNode)
          throw Error(p$7(162));
        e2 = a2.stateNode;
        f2 = a2.memoizedProps;
        try {
          e2.nodeValue = f2;
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      }
      break;
    case 3:
      ck(b2, a2);
      ek(a2);
      if (d2 & 4 && null !== c2 && c2.memoizedState.isDehydrated)
        try {
          bd$1(b2.containerInfo);
        } catch (t2) {
          W$4(a2, a2.return, t2);
        }
      break;
    case 4:
      ck(b2, a2);
      ek(a2);
      break;
    case 13:
      ck(b2, a2);
      ek(a2);
      e2 = a2.child;
      e2.flags & 8192 && (f2 = null !== e2.memoizedState, e2.stateNode.isHidden = f2, !f2 || null !== e2.alternate && null !== e2.alternate.memoizedState || (fk = B$3()));
      d2 & 4 && ak(a2);
      break;
    case 22:
      m2 = null !== c2 && null !== c2.memoizedState;
      a2.mode & 1 ? (U$4 = (l2 = U$4) || m2, ck(b2, a2), U$4 = l2) : ck(b2, a2);
      ek(a2);
      if (d2 & 8192) {
        l2 = null !== a2.memoizedState;
        if ((a2.stateNode.isHidden = l2) && !m2 && 0 !== (a2.mode & 1))
          for (V$3 = a2, m2 = a2.child; null !== m2; ) {
            for (q2 = V$3 = m2; null !== V$3; ) {
              r2 = V$3;
              y2 = r2.child;
              switch (r2.tag) {
                case 0:
                case 11:
                case 14:
                case 15:
                  Pj(4, r2, r2.return);
                  break;
                case 1:
                  Lj(r2, r2.return);
                  var n2 = r2.stateNode;
                  if ("function" === typeof n2.componentWillUnmount) {
                    d2 = r2;
                    c2 = r2.return;
                    try {
                      b2 = d2, n2.props = b2.memoizedProps, n2.state = b2.memoizedState, n2.componentWillUnmount();
                    } catch (t2) {
                      W$4(d2, c2, t2);
                    }
                  }
                  break;
                case 5:
                  Lj(r2, r2.return);
                  break;
                case 22:
                  if (null !== r2.memoizedState) {
                    gk(q2);
                    continue;
                  }
              }
              null !== y2 ? (y2.return = r2, V$3 = y2) : gk(q2);
            }
            m2 = m2.sibling;
          }
        a:
          for (m2 = null, q2 = a2; ; ) {
            if (5 === q2.tag) {
              if (null === m2) {
                m2 = q2;
                try {
                  e2 = q2.stateNode, l2 ? (f2 = e2.style, "function" === typeof f2.setProperty ? f2.setProperty("display", "none", "important") : f2.display = "none") : (h3 = q2.stateNode, k2 = q2.memoizedProps.style, g2 = void 0 !== k2 && null !== k2 && k2.hasOwnProperty("display") ? k2.display : null, h3.style.display = rb$2("display", g2));
                } catch (t2) {
                  W$4(a2, a2.return, t2);
                }
              }
            } else if (6 === q2.tag) {
              if (null === m2)
                try {
                  q2.stateNode.nodeValue = l2 ? "" : q2.memoizedProps;
                } catch (t2) {
                  W$4(a2, a2.return, t2);
                }
            } else if ((22 !== q2.tag && 23 !== q2.tag || null === q2.memoizedState || q2 === a2) && null !== q2.child) {
              q2.child.return = q2;
              q2 = q2.child;
              continue;
            }
            if (q2 === a2)
              break a;
            for (; null === q2.sibling; ) {
              if (null === q2.return || q2.return === a2)
                break a;
              m2 === q2 && (m2 = null);
              q2 = q2.return;
            }
            m2 === q2 && (m2 = null);
            q2.sibling.return = q2.return;
            q2 = q2.sibling;
          }
      }
      break;
    case 19:
      ck(b2, a2);
      ek(a2);
      d2 & 4 && ak(a2);
      break;
    case 21:
      break;
    default:
      ck(
        b2,
        a2
      ), ek(a2);
  }
}
function ek(a2) {
  var b2 = a2.flags;
  if (b2 & 2) {
    try {
      a: {
        for (var c2 = a2.return; null !== c2; ) {
          if (Tj(c2)) {
            var d2 = c2;
            break a;
          }
          c2 = c2.return;
        }
        throw Error(p$7(160));
      }
      switch (d2.tag) {
        case 5:
          var e2 = d2.stateNode;
          d2.flags & 32 && (ob$2(e2, ""), d2.flags &= -33);
          var f2 = Uj(a2);
          Wj(a2, f2, e2);
          break;
        case 3:
        case 4:
          var g2 = d2.stateNode.containerInfo, h3 = Uj(a2);
          Vj(a2, h3, g2);
          break;
        default:
          throw Error(p$7(161));
      }
    } catch (k2) {
      W$4(a2, a2.return, k2);
    }
    a2.flags &= -3;
  }
  b2 & 4096 && (a2.flags &= -4097);
}
function hk(a2, b2, c2) {
  V$3 = a2;
  ik(a2);
}
function ik(a2, b2, c2) {
  for (var d2 = 0 !== (a2.mode & 1); null !== V$3; ) {
    var e2 = V$3, f2 = e2.child;
    if (22 === e2.tag && d2) {
      var g2 = null !== e2.memoizedState || Jj;
      if (!g2) {
        var h3 = e2.alternate, k2 = null !== h3 && null !== h3.memoizedState || U$4;
        h3 = Jj;
        var l2 = U$4;
        Jj = g2;
        if ((U$4 = k2) && !l2)
          for (V$3 = e2; null !== V$3; )
            g2 = V$3, k2 = g2.child, 22 === g2.tag && null !== g2.memoizedState ? jk(e2) : null !== k2 ? (k2.return = g2, V$3 = k2) : jk(e2);
        for (; null !== f2; )
          V$3 = f2, ik(f2), f2 = f2.sibling;
        V$3 = e2;
        Jj = h3;
        U$4 = l2;
      }
      kk(a2);
    } else
      0 !== (e2.subtreeFlags & 8772) && null !== f2 ? (f2.return = e2, V$3 = f2) : kk(a2);
  }
}
function kk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    if (0 !== (b2.flags & 8772)) {
      var c2 = b2.alternate;
      try {
        if (0 !== (b2.flags & 8772))
          switch (b2.tag) {
            case 0:
            case 11:
            case 15:
              U$4 || Qj(5, b2);
              break;
            case 1:
              var d2 = b2.stateNode;
              if (b2.flags & 4 && !U$4)
                if (null === c2)
                  d2.componentDidMount();
                else {
                  var e2 = b2.elementType === b2.type ? c2.memoizedProps : Ci(b2.type, c2.memoizedProps);
                  d2.componentDidUpdate(e2, c2.memoizedState, d2.__reactInternalSnapshotBeforeUpdate);
                }
              var f2 = b2.updateQueue;
              null !== f2 && sh(b2, f2, d2);
              break;
            case 3:
              var g2 = b2.updateQueue;
              if (null !== g2) {
                c2 = null;
                if (null !== b2.child)
                  switch (b2.child.tag) {
                    case 5:
                      c2 = b2.child.stateNode;
                      break;
                    case 1:
                      c2 = b2.child.stateNode;
                  }
                sh(b2, g2, c2);
              }
              break;
            case 5:
              var h3 = b2.stateNode;
              if (null === c2 && b2.flags & 4) {
                c2 = h3;
                var k2 = b2.memoizedProps;
                switch (b2.type) {
                  case "button":
                  case "input":
                  case "select":
                  case "textarea":
                    k2.autoFocus && c2.focus();
                    break;
                  case "img":
                    k2.src && (c2.src = k2.src);
                }
              }
              break;
            case 6:
              break;
            case 4:
              break;
            case 12:
              break;
            case 13:
              if (null === b2.memoizedState) {
                var l2 = b2.alternate;
                if (null !== l2) {
                  var m2 = l2.memoizedState;
                  if (null !== m2) {
                    var q2 = m2.dehydrated;
                    null !== q2 && bd$1(q2);
                  }
                }
              }
              break;
            case 19:
            case 17:
            case 21:
            case 22:
            case 23:
            case 25:
              break;
            default:
              throw Error(p$7(163));
          }
        U$4 || b2.flags & 512 && Rj(b2);
      } catch (r2) {
        W$4(b2, b2.return, r2);
      }
    }
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    c2 = b2.sibling;
    if (null !== c2) {
      c2.return = b2.return;
      V$3 = c2;
      break;
    }
    V$3 = b2.return;
  }
}
function gk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    var c2 = b2.sibling;
    if (null !== c2) {
      c2.return = b2.return;
      V$3 = c2;
      break;
    }
    V$3 = b2.return;
  }
}
function jk(a2) {
  for (; null !== V$3; ) {
    var b2 = V$3;
    try {
      switch (b2.tag) {
        case 0:
        case 11:
        case 15:
          var c2 = b2.return;
          try {
            Qj(4, b2);
          } catch (k2) {
            W$4(b2, c2, k2);
          }
          break;
        case 1:
          var d2 = b2.stateNode;
          if ("function" === typeof d2.componentDidMount) {
            var e2 = b2.return;
            try {
              d2.componentDidMount();
            } catch (k2) {
              W$4(b2, e2, k2);
            }
          }
          var f2 = b2.return;
          try {
            Rj(b2);
          } catch (k2) {
            W$4(b2, f2, k2);
          }
          break;
        case 5:
          var g2 = b2.return;
          try {
            Rj(b2);
          } catch (k2) {
            W$4(b2, g2, k2);
          }
      }
    } catch (k2) {
      W$4(b2, b2.return, k2);
    }
    if (b2 === a2) {
      V$3 = null;
      break;
    }
    var h3 = b2.sibling;
    if (null !== h3) {
      h3.return = b2.return;
      V$3 = h3;
      break;
    }
    V$3 = b2.return;
  }
}
var lk = Math.ceil, mk = ua$2.ReactCurrentDispatcher, nk = ua$2.ReactCurrentOwner, ok$2 = ua$2.ReactCurrentBatchConfig, K$2 = 0, Q$3 = null, Y$3 = null, Z$3 = 0, fj = 0, ej = Uf(0), T$2 = 0, pk = null, rh = 0, qk = 0, rk = 0, sk = null, tk = null, fk = 0, Gj = Infinity, uk = null, Oi = false, Pi = null, Ri = null, vk = false, wk = null, xk = 0, yk = 0, zk = null, Ak = -1, Bk = 0;
function R$4() {
  return 0 !== (K$2 & 6) ? B$3() : -1 !== Ak ? Ak : Ak = B$3();
}
function yi(a2) {
  if (0 === (a2.mode & 1))
    return 1;
  if (0 !== (K$2 & 2) && 0 !== Z$3)
    return Z$3 & -Z$3;
  if (null !== Kg.transition)
    return 0 === Bk && (Bk = yc$1()), Bk;
  a2 = C$1;
  if (0 !== a2)
    return a2;
  a2 = window.event;
  a2 = void 0 === a2 ? 16 : jd$1(a2.type);
  return a2;
}
function gi(a2, b2, c2, d2) {
  if (50 < yk)
    throw yk = 0, zk = null, Error(p$7(185));
  Ac$1(a2, c2, d2);
  if (0 === (K$2 & 2) || a2 !== Q$3)
    a2 === Q$3 && (0 === (K$2 & 2) && (qk |= c2), 4 === T$2 && Ck(a2, Z$3)), Dk(a2, d2), 1 === c2 && 0 === K$2 && 0 === (b2.mode & 1) && (Gj = B$3() + 500, fg && jg());
}
function Dk(a2, b2) {
  var c2 = a2.callbackNode;
  wc$1(a2, b2);
  var d2 = uc$1(a2, a2 === Q$3 ? Z$3 : 0);
  if (0 === d2)
    null !== c2 && bc$1(c2), a2.callbackNode = null, a2.callbackPriority = 0;
  else if (b2 = d2 & -d2, a2.callbackPriority !== b2) {
    null != c2 && bc$1(c2);
    if (1 === b2)
      0 === a2.tag ? ig(Ek.bind(null, a2)) : hg(Ek.bind(null, a2)), Jf(function() {
        0 === (K$2 & 6) && jg();
      }), c2 = null;
    else {
      switch (Dc$1(d2)) {
        case 1:
          c2 = fc$1;
          break;
        case 4:
          c2 = gc$1;
          break;
        case 16:
          c2 = hc$1;
          break;
        case 536870912:
          c2 = jc$1;
          break;
        default:
          c2 = hc$1;
      }
      c2 = Fk(c2, Gk.bind(null, a2));
    }
    a2.callbackPriority = b2;
    a2.callbackNode = c2;
  }
}
function Gk(a2, b2) {
  Ak = -1;
  Bk = 0;
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  var c2 = a2.callbackNode;
  if (Hk() && a2.callbackNode !== c2)
    return null;
  var d2 = uc$1(a2, a2 === Q$3 ? Z$3 : 0);
  if (0 === d2)
    return null;
  if (0 !== (d2 & 30) || 0 !== (d2 & a2.expiredLanes) || b2)
    b2 = Ik(a2, d2);
  else {
    b2 = d2;
    var e2 = K$2;
    K$2 |= 2;
    var f2 = Jk();
    if (Q$3 !== a2 || Z$3 !== b2)
      uk = null, Gj = B$3() + 500, Kk(a2, b2);
    do
      try {
        Lk();
        break;
      } catch (h3) {
        Mk(a2, h3);
      }
    while (1);
    $g();
    mk.current = f2;
    K$2 = e2;
    null !== Y$3 ? b2 = 0 : (Q$3 = null, Z$3 = 0, b2 = T$2);
  }
  if (0 !== b2) {
    2 === b2 && (e2 = xc$1(a2), 0 !== e2 && (d2 = e2, b2 = Nk(a2, e2)));
    if (1 === b2)
      throw c2 = pk, Kk(a2, 0), Ck(a2, d2), Dk(a2, B$3()), c2;
    if (6 === b2)
      Ck(a2, d2);
    else {
      e2 = a2.current.alternate;
      if (0 === (d2 & 30) && !Ok(e2) && (b2 = Ik(a2, d2), 2 === b2 && (f2 = xc$1(a2), 0 !== f2 && (d2 = f2, b2 = Nk(a2, f2))), 1 === b2))
        throw c2 = pk, Kk(a2, 0), Ck(a2, d2), Dk(a2, B$3()), c2;
      a2.finishedWork = e2;
      a2.finishedLanes = d2;
      switch (b2) {
        case 0:
        case 1:
          throw Error(p$7(345));
        case 2:
          Pk(a2, tk, uk);
          break;
        case 3:
          Ck(a2, d2);
          if ((d2 & 130023424) === d2 && (b2 = fk + 500 - B$3(), 10 < b2)) {
            if (0 !== uc$1(a2, 0))
              break;
            e2 = a2.suspendedLanes;
            if ((e2 & d2) !== d2) {
              R$4();
              a2.pingedLanes |= a2.suspendedLanes & e2;
              break;
            }
            a2.timeoutHandle = Ff(Pk.bind(null, a2, tk, uk), b2);
            break;
          }
          Pk(a2, tk, uk);
          break;
        case 4:
          Ck(a2, d2);
          if ((d2 & 4194240) === d2)
            break;
          b2 = a2.eventTimes;
          for (e2 = -1; 0 < d2; ) {
            var g2 = 31 - oc$1(d2);
            f2 = 1 << g2;
            g2 = b2[g2];
            g2 > e2 && (e2 = g2);
            d2 &= ~f2;
          }
          d2 = e2;
          d2 = B$3() - d2;
          d2 = (120 > d2 ? 120 : 480 > d2 ? 480 : 1080 > d2 ? 1080 : 1920 > d2 ? 1920 : 3e3 > d2 ? 3e3 : 4320 > d2 ? 4320 : 1960 * lk(d2 / 1960)) - d2;
          if (10 < d2) {
            a2.timeoutHandle = Ff(Pk.bind(null, a2, tk, uk), d2);
            break;
          }
          Pk(a2, tk, uk);
          break;
        case 5:
          Pk(a2, tk, uk);
          break;
        default:
          throw Error(p$7(329));
      }
    }
  }
  Dk(a2, B$3());
  return a2.callbackNode === c2 ? Gk.bind(null, a2) : null;
}
function Nk(a2, b2) {
  var c2 = sk;
  a2.current.memoizedState.isDehydrated && (Kk(a2, b2).flags |= 256);
  a2 = Ik(a2, b2);
  2 !== a2 && (b2 = tk, tk = c2, null !== b2 && Fj(b2));
  return a2;
}
function Fj(a2) {
  null === tk ? tk = a2 : tk.push.apply(tk, a2);
}
function Ok(a2) {
  for (var b2 = a2; ; ) {
    if (b2.flags & 16384) {
      var c2 = b2.updateQueue;
      if (null !== c2 && (c2 = c2.stores, null !== c2))
        for (var d2 = 0; d2 < c2.length; d2++) {
          var e2 = c2[d2], f2 = e2.getSnapshot;
          e2 = e2.value;
          try {
            if (!He(f2(), e2))
              return false;
          } catch (g2) {
            return false;
          }
        }
    }
    c2 = b2.child;
    if (b2.subtreeFlags & 16384 && null !== c2)
      c2.return = b2, b2 = c2;
    else {
      if (b2 === a2)
        break;
      for (; null === b2.sibling; ) {
        if (null === b2.return || b2.return === a2)
          return true;
        b2 = b2.return;
      }
      b2.sibling.return = b2.return;
      b2 = b2.sibling;
    }
  }
  return true;
}
function Ck(a2, b2) {
  b2 &= ~rk;
  b2 &= ~qk;
  a2.suspendedLanes |= b2;
  a2.pingedLanes &= ~b2;
  for (a2 = a2.expirationTimes; 0 < b2; ) {
    var c2 = 31 - oc$1(b2), d2 = 1 << c2;
    a2[c2] = -1;
    b2 &= ~d2;
  }
}
function Ek(a2) {
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  Hk();
  var b2 = uc$1(a2, 0);
  if (0 === (b2 & 1))
    return Dk(a2, B$3()), null;
  var c2 = Ik(a2, b2);
  if (0 !== a2.tag && 2 === c2) {
    var d2 = xc$1(a2);
    0 !== d2 && (b2 = d2, c2 = Nk(a2, d2));
  }
  if (1 === c2)
    throw c2 = pk, Kk(a2, 0), Ck(a2, b2), Dk(a2, B$3()), c2;
  if (6 === c2)
    throw Error(p$7(345));
  a2.finishedWork = a2.current.alternate;
  a2.finishedLanes = b2;
  Pk(a2, tk, uk);
  Dk(a2, B$3());
  return null;
}
function Qk(a2, b2) {
  var c2 = K$2;
  K$2 |= 1;
  try {
    return a2(b2);
  } finally {
    K$2 = c2, 0 === K$2 && (Gj = B$3() + 500, fg && jg());
  }
}
function Rk(a2) {
  null !== wk && 0 === wk.tag && 0 === (K$2 & 6) && Hk();
  var b2 = K$2;
  K$2 |= 1;
  var c2 = ok$2.transition, d2 = C$1;
  try {
    if (ok$2.transition = null, C$1 = 1, a2)
      return a2();
  } finally {
    C$1 = d2, ok$2.transition = c2, K$2 = b2, 0 === (K$2 & 6) && jg();
  }
}
function Hj() {
  fj = ej.current;
  E$3(ej);
}
function Kk(a2, b2) {
  a2.finishedWork = null;
  a2.finishedLanes = 0;
  var c2 = a2.timeoutHandle;
  -1 !== c2 && (a2.timeoutHandle = -1, Gf(c2));
  if (null !== Y$3)
    for (c2 = Y$3.return; null !== c2; ) {
      var d2 = c2;
      wg(d2);
      switch (d2.tag) {
        case 1:
          d2 = d2.type.childContextTypes;
          null !== d2 && void 0 !== d2 && $f();
          break;
        case 3:
          zh();
          E$3(Wf);
          E$3(H$3);
          Eh();
          break;
        case 5:
          Bh(d2);
          break;
        case 4:
          zh();
          break;
        case 13:
          E$3(L$3);
          break;
        case 19:
          E$3(L$3);
          break;
        case 10:
          ah(d2.type._context);
          break;
        case 22:
        case 23:
          Hj();
      }
      c2 = c2.return;
    }
  Q$3 = a2;
  Y$3 = a2 = Pg(a2.current, null);
  Z$3 = fj = b2;
  T$2 = 0;
  pk = null;
  rk = qk = rh = 0;
  tk = sk = null;
  if (null !== fh) {
    for (b2 = 0; b2 < fh.length; b2++)
      if (c2 = fh[b2], d2 = c2.interleaved, null !== d2) {
        c2.interleaved = null;
        var e2 = d2.next, f2 = c2.pending;
        if (null !== f2) {
          var g2 = f2.next;
          f2.next = e2;
          d2.next = g2;
        }
        c2.pending = d2;
      }
    fh = null;
  }
  return a2;
}
function Mk(a2, b2) {
  do {
    var c2 = Y$3;
    try {
      $g();
      Fh.current = Rh;
      if (Ih) {
        for (var d2 = M$5.memoizedState; null !== d2; ) {
          var e2 = d2.queue;
          null !== e2 && (e2.pending = null);
          d2 = d2.next;
        }
        Ih = false;
      }
      Hh = 0;
      O$3 = N$4 = M$5 = null;
      Jh = false;
      Kh = 0;
      nk.current = null;
      if (null === c2 || null === c2.return) {
        T$2 = 1;
        pk = b2;
        Y$3 = null;
        break;
      }
      a: {
        var f2 = a2, g2 = c2.return, h3 = c2, k2 = b2;
        b2 = Z$3;
        h3.flags |= 32768;
        if (null !== k2 && "object" === typeof k2 && "function" === typeof k2.then) {
          var l2 = k2, m2 = h3, q2 = m2.tag;
          if (0 === (m2.mode & 1) && (0 === q2 || 11 === q2 || 15 === q2)) {
            var r2 = m2.alternate;
            r2 ? (m2.updateQueue = r2.updateQueue, m2.memoizedState = r2.memoizedState, m2.lanes = r2.lanes) : (m2.updateQueue = null, m2.memoizedState = null);
          }
          var y2 = Ui(g2);
          if (null !== y2) {
            y2.flags &= -257;
            Vi(y2, g2, h3, f2, b2);
            y2.mode & 1 && Si(f2, l2, b2);
            b2 = y2;
            k2 = l2;
            var n2 = b2.updateQueue;
            if (null === n2) {
              var t2 = /* @__PURE__ */ new Set();
              t2.add(k2);
              b2.updateQueue = t2;
            } else
              n2.add(k2);
            break a;
          } else {
            if (0 === (b2 & 1)) {
              Si(f2, l2, b2);
              tj();
              break a;
            }
            k2 = Error(p$7(426));
          }
        } else if (I$3 && h3.mode & 1) {
          var J2 = Ui(g2);
          if (null !== J2) {
            0 === (J2.flags & 65536) && (J2.flags |= 256);
            Vi(J2, g2, h3, f2, b2);
            Jg(Ji(k2, h3));
            break a;
          }
        }
        f2 = k2 = Ji(k2, h3);
        4 !== T$2 && (T$2 = 2);
        null === sk ? sk = [f2] : sk.push(f2);
        f2 = g2;
        do {
          switch (f2.tag) {
            case 3:
              f2.flags |= 65536;
              b2 &= -b2;
              f2.lanes |= b2;
              var x2 = Ni(f2, k2, b2);
              ph(f2, x2);
              break a;
            case 1:
              h3 = k2;
              var w2 = f2.type, u2 = f2.stateNode;
              if (0 === (f2.flags & 128) && ("function" === typeof w2.getDerivedStateFromError || null !== u2 && "function" === typeof u2.componentDidCatch && (null === Ri || !Ri.has(u2)))) {
                f2.flags |= 65536;
                b2 &= -b2;
                f2.lanes |= b2;
                var F2 = Qi(f2, h3, b2);
                ph(f2, F2);
                break a;
              }
          }
          f2 = f2.return;
        } while (null !== f2);
      }
      Sk(c2);
    } catch (na2) {
      b2 = na2;
      Y$3 === c2 && null !== c2 && (Y$3 = c2 = c2.return);
      continue;
    }
    break;
  } while (1);
}
function Jk() {
  var a2 = mk.current;
  mk.current = Rh;
  return null === a2 ? Rh : a2;
}
function tj() {
  if (0 === T$2 || 3 === T$2 || 2 === T$2)
    T$2 = 4;
  null === Q$3 || 0 === (rh & 268435455) && 0 === (qk & 268435455) || Ck(Q$3, Z$3);
}
function Ik(a2, b2) {
  var c2 = K$2;
  K$2 |= 2;
  var d2 = Jk();
  if (Q$3 !== a2 || Z$3 !== b2)
    uk = null, Kk(a2, b2);
  do
    try {
      Tk();
      break;
    } catch (e2) {
      Mk(a2, e2);
    }
  while (1);
  $g();
  K$2 = c2;
  mk.current = d2;
  if (null !== Y$3)
    throw Error(p$7(261));
  Q$3 = null;
  Z$3 = 0;
  return T$2;
}
function Tk() {
  for (; null !== Y$3; )
    Uk(Y$3);
}
function Lk() {
  for (; null !== Y$3 && !cc$1(); )
    Uk(Y$3);
}
function Uk(a2) {
  var b2 = Vk(a2.alternate, a2, fj);
  a2.memoizedProps = a2.pendingProps;
  null === b2 ? Sk(a2) : Y$3 = b2;
  nk.current = null;
}
function Sk(a2) {
  var b2 = a2;
  do {
    var c2 = b2.alternate;
    a2 = b2.return;
    if (0 === (b2.flags & 32768)) {
      if (c2 = Ej(c2, b2, fj), null !== c2) {
        Y$3 = c2;
        return;
      }
    } else {
      c2 = Ij(c2, b2);
      if (null !== c2) {
        c2.flags &= 32767;
        Y$3 = c2;
        return;
      }
      if (null !== a2)
        a2.flags |= 32768, a2.subtreeFlags = 0, a2.deletions = null;
      else {
        T$2 = 6;
        Y$3 = null;
        return;
      }
    }
    b2 = b2.sibling;
    if (null !== b2) {
      Y$3 = b2;
      return;
    }
    Y$3 = b2 = a2;
  } while (null !== b2);
  0 === T$2 && (T$2 = 5);
}
function Pk(a2, b2, c2) {
  var d2 = C$1, e2 = ok$2.transition;
  try {
    ok$2.transition = null, C$1 = 1, Wk(a2, b2, c2, d2);
  } finally {
    ok$2.transition = e2, C$1 = d2;
  }
  return null;
}
function Wk(a2, b2, c2, d2) {
  do
    Hk();
  while (null !== wk);
  if (0 !== (K$2 & 6))
    throw Error(p$7(327));
  c2 = a2.finishedWork;
  var e2 = a2.finishedLanes;
  if (null === c2)
    return null;
  a2.finishedWork = null;
  a2.finishedLanes = 0;
  if (c2 === a2.current)
    throw Error(p$7(177));
  a2.callbackNode = null;
  a2.callbackPriority = 0;
  var f2 = c2.lanes | c2.childLanes;
  Bc$1(a2, f2);
  a2 === Q$3 && (Y$3 = Q$3 = null, Z$3 = 0);
  0 === (c2.subtreeFlags & 2064) && 0 === (c2.flags & 2064) || vk || (vk = true, Fk(hc$1, function() {
    Hk();
    return null;
  }));
  f2 = 0 !== (c2.flags & 15990);
  if (0 !== (c2.subtreeFlags & 15990) || f2) {
    f2 = ok$2.transition;
    ok$2.transition = null;
    var g2 = C$1;
    C$1 = 1;
    var h3 = K$2;
    K$2 |= 4;
    nk.current = null;
    Oj(a2, c2);
    dk(c2, a2);
    Oe(Df);
    dd$1 = !!Cf;
    Df = Cf = null;
    a2.current = c2;
    hk(c2);
    dc$1();
    K$2 = h3;
    C$1 = g2;
    ok$2.transition = f2;
  } else
    a2.current = c2;
  vk && (vk = false, wk = a2, xk = e2);
  f2 = a2.pendingLanes;
  0 === f2 && (Ri = null);
  mc$1(c2.stateNode);
  Dk(a2, B$3());
  if (null !== b2)
    for (d2 = a2.onRecoverableError, c2 = 0; c2 < b2.length; c2++)
      e2 = b2[c2], d2(e2.value, { componentStack: e2.stack, digest: e2.digest });
  if (Oi)
    throw Oi = false, a2 = Pi, Pi = null, a2;
  0 !== (xk & 1) && 0 !== a2.tag && Hk();
  f2 = a2.pendingLanes;
  0 !== (f2 & 1) ? a2 === zk ? yk++ : (yk = 0, zk = a2) : yk = 0;
  jg();
  return null;
}
function Hk() {
  if (null !== wk) {
    var a2 = Dc$1(xk), b2 = ok$2.transition, c2 = C$1;
    try {
      ok$2.transition = null;
      C$1 = 16 > a2 ? 16 : a2;
      if (null === wk)
        var d2 = false;
      else {
        a2 = wk;
        wk = null;
        xk = 0;
        if (0 !== (K$2 & 6))
          throw Error(p$7(331));
        var e2 = K$2;
        K$2 |= 4;
        for (V$3 = a2.current; null !== V$3; ) {
          var f2 = V$3, g2 = f2.child;
          if (0 !== (V$3.flags & 16)) {
            var h3 = f2.deletions;
            if (null !== h3) {
              for (var k2 = 0; k2 < h3.length; k2++) {
                var l2 = h3[k2];
                for (V$3 = l2; null !== V$3; ) {
                  var m2 = V$3;
                  switch (m2.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Pj(8, m2, f2);
                  }
                  var q2 = m2.child;
                  if (null !== q2)
                    q2.return = m2, V$3 = q2;
                  else
                    for (; null !== V$3; ) {
                      m2 = V$3;
                      var r2 = m2.sibling, y2 = m2.return;
                      Sj(m2);
                      if (m2 === l2) {
                        V$3 = null;
                        break;
                      }
                      if (null !== r2) {
                        r2.return = y2;
                        V$3 = r2;
                        break;
                      }
                      V$3 = y2;
                    }
                }
              }
              var n2 = f2.alternate;
              if (null !== n2) {
                var t2 = n2.child;
                if (null !== t2) {
                  n2.child = null;
                  do {
                    var J2 = t2.sibling;
                    t2.sibling = null;
                    t2 = J2;
                  } while (null !== t2);
                }
              }
              V$3 = f2;
            }
          }
          if (0 !== (f2.subtreeFlags & 2064) && null !== g2)
            g2.return = f2, V$3 = g2;
          else
            b:
              for (; null !== V$3; ) {
                f2 = V$3;
                if (0 !== (f2.flags & 2048))
                  switch (f2.tag) {
                    case 0:
                    case 11:
                    case 15:
                      Pj(9, f2, f2.return);
                  }
                var x2 = f2.sibling;
                if (null !== x2) {
                  x2.return = f2.return;
                  V$3 = x2;
                  break b;
                }
                V$3 = f2.return;
              }
        }
        var w2 = a2.current;
        for (V$3 = w2; null !== V$3; ) {
          g2 = V$3;
          var u2 = g2.child;
          if (0 !== (g2.subtreeFlags & 2064) && null !== u2)
            u2.return = g2, V$3 = u2;
          else
            b:
              for (g2 = w2; null !== V$3; ) {
                h3 = V$3;
                if (0 !== (h3.flags & 2048))
                  try {
                    switch (h3.tag) {
                      case 0:
                      case 11:
                      case 15:
                        Qj(9, h3);
                    }
                  } catch (na2) {
                    W$4(h3, h3.return, na2);
                  }
                if (h3 === g2) {
                  V$3 = null;
                  break b;
                }
                var F2 = h3.sibling;
                if (null !== F2) {
                  F2.return = h3.return;
                  V$3 = F2;
                  break b;
                }
                V$3 = h3.return;
              }
        }
        K$2 = e2;
        jg();
        if (lc$1 && "function" === typeof lc$1.onPostCommitFiberRoot)
          try {
            lc$1.onPostCommitFiberRoot(kc$1, a2);
          } catch (na2) {
          }
        d2 = true;
      }
      return d2;
    } finally {
      C$1 = c2, ok$2.transition = b2;
    }
  }
  return false;
}
function Xk(a2, b2, c2) {
  b2 = Ji(c2, b2);
  b2 = Ni(a2, b2, 1);
  a2 = nh(a2, b2, 1);
  b2 = R$4();
  null !== a2 && (Ac$1(a2, 1, b2), Dk(a2, b2));
}
function W$4(a2, b2, c2) {
  if (3 === a2.tag)
    Xk(a2, a2, c2);
  else
    for (; null !== b2; ) {
      if (3 === b2.tag) {
        Xk(b2, a2, c2);
        break;
      } else if (1 === b2.tag) {
        var d2 = b2.stateNode;
        if ("function" === typeof b2.type.getDerivedStateFromError || "function" === typeof d2.componentDidCatch && (null === Ri || !Ri.has(d2))) {
          a2 = Ji(c2, a2);
          a2 = Qi(b2, a2, 1);
          b2 = nh(b2, a2, 1);
          a2 = R$4();
          null !== b2 && (Ac$1(b2, 1, a2), Dk(b2, a2));
          break;
        }
      }
      b2 = b2.return;
    }
}
function Ti(a2, b2, c2) {
  var d2 = a2.pingCache;
  null !== d2 && d2.delete(b2);
  b2 = R$4();
  a2.pingedLanes |= a2.suspendedLanes & c2;
  Q$3 === a2 && (Z$3 & c2) === c2 && (4 === T$2 || 3 === T$2 && (Z$3 & 130023424) === Z$3 && 500 > B$3() - fk ? Kk(a2, 0) : rk |= c2);
  Dk(a2, b2);
}
function Yk(a2, b2) {
  0 === b2 && (0 === (a2.mode & 1) ? b2 = 1 : (b2 = sc$1, sc$1 <<= 1, 0 === (sc$1 & 130023424) && (sc$1 = 4194304)));
  var c2 = R$4();
  a2 = ih(a2, b2);
  null !== a2 && (Ac$1(a2, b2, c2), Dk(a2, c2));
}
function uj(a2) {
  var b2 = a2.memoizedState, c2 = 0;
  null !== b2 && (c2 = b2.retryLane);
  Yk(a2, c2);
}
function bk(a2, b2) {
  var c2 = 0;
  switch (a2.tag) {
    case 13:
      var d2 = a2.stateNode;
      var e2 = a2.memoizedState;
      null !== e2 && (c2 = e2.retryLane);
      break;
    case 19:
      d2 = a2.stateNode;
      break;
    default:
      throw Error(p$7(314));
  }
  null !== d2 && d2.delete(b2);
  Yk(a2, c2);
}
var Vk;
Vk = function(a2, b2, c2) {
  if (null !== a2)
    if (a2.memoizedProps !== b2.pendingProps || Wf.current)
      dh = true;
    else {
      if (0 === (a2.lanes & c2) && 0 === (b2.flags & 128))
        return dh = false, yj(a2, b2, c2);
      dh = 0 !== (a2.flags & 131072) ? true : false;
    }
  else
    dh = false, I$3 && 0 !== (b2.flags & 1048576) && ug(b2, ng, b2.index);
  b2.lanes = 0;
  switch (b2.tag) {
    case 2:
      var d2 = b2.type;
      ij(a2, b2);
      a2 = b2.pendingProps;
      var e2 = Yf(b2, H$3.current);
      ch(b2, c2);
      e2 = Nh(null, b2, d2, a2, e2, c2);
      var f2 = Sh();
      b2.flags |= 1;
      "object" === typeof e2 && null !== e2 && "function" === typeof e2.render && void 0 === e2.$$typeof ? (b2.tag = 1, b2.memoizedState = null, b2.updateQueue = null, Zf(d2) ? (f2 = true, cg(b2)) : f2 = false, b2.memoizedState = null !== e2.state && void 0 !== e2.state ? e2.state : null, kh(b2), e2.updater = Ei, b2.stateNode = e2, e2._reactInternals = b2, Ii(b2, d2, a2, c2), b2 = jj(null, b2, d2, true, f2, c2)) : (b2.tag = 0, I$3 && f2 && vg(b2), Xi(null, b2, e2, c2), b2 = b2.child);
      return b2;
    case 16:
      d2 = b2.elementType;
      a: {
        ij(a2, b2);
        a2 = b2.pendingProps;
        e2 = d2._init;
        d2 = e2(d2._payload);
        b2.type = d2;
        e2 = b2.tag = Zk(d2);
        a2 = Ci(d2, a2);
        switch (e2) {
          case 0:
            b2 = cj(null, b2, d2, a2, c2);
            break a;
          case 1:
            b2 = hj(null, b2, d2, a2, c2);
            break a;
          case 11:
            b2 = Yi(null, b2, d2, a2, c2);
            break a;
          case 14:
            b2 = $i(null, b2, d2, Ci(d2.type, a2), c2);
            break a;
        }
        throw Error(p$7(
          306,
          d2,
          ""
        ));
      }
      return b2;
    case 0:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), cj(a2, b2, d2, e2, c2);
    case 1:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), hj(a2, b2, d2, e2, c2);
    case 3:
      a: {
        kj(b2);
        if (null === a2)
          throw Error(p$7(387));
        d2 = b2.pendingProps;
        f2 = b2.memoizedState;
        e2 = f2.element;
        lh(a2, b2);
        qh(b2, d2, null, c2);
        var g2 = b2.memoizedState;
        d2 = g2.element;
        if (f2.isDehydrated)
          if (f2 = { element: d2, isDehydrated: false, cache: g2.cache, pendingSuspenseBoundaries: g2.pendingSuspenseBoundaries, transitions: g2.transitions }, b2.updateQueue.baseState = f2, b2.memoizedState = f2, b2.flags & 256) {
            e2 = Ji(Error(p$7(423)), b2);
            b2 = lj(a2, b2, d2, c2, e2);
            break a;
          } else if (d2 !== e2) {
            e2 = Ji(Error(p$7(424)), b2);
            b2 = lj(a2, b2, d2, c2, e2);
            break a;
          } else
            for (yg = Lf(b2.stateNode.containerInfo.firstChild), xg = b2, I$3 = true, zg = null, c2 = Vg(b2, null, d2, c2), b2.child = c2; c2; )
              c2.flags = c2.flags & -3 | 4096, c2 = c2.sibling;
        else {
          Ig();
          if (d2 === e2) {
            b2 = Zi(a2, b2, c2);
            break a;
          }
          Xi(a2, b2, d2, c2);
        }
        b2 = b2.child;
      }
      return b2;
    case 5:
      return Ah(b2), null === a2 && Eg(b2), d2 = b2.type, e2 = b2.pendingProps, f2 = null !== a2 ? a2.memoizedProps : null, g2 = e2.children, Ef(d2, e2) ? g2 = null : null !== f2 && Ef(d2, f2) && (b2.flags |= 32), gj(a2, b2), Xi(a2, b2, g2, c2), b2.child;
    case 6:
      return null === a2 && Eg(b2), null;
    case 13:
      return oj(a2, b2, c2);
    case 4:
      return yh(b2, b2.stateNode.containerInfo), d2 = b2.pendingProps, null === a2 ? b2.child = Ug(b2, null, d2, c2) : Xi(a2, b2, d2, c2), b2.child;
    case 11:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), Yi(a2, b2, d2, e2, c2);
    case 7:
      return Xi(a2, b2, b2.pendingProps, c2), b2.child;
    case 8:
      return Xi(a2, b2, b2.pendingProps.children, c2), b2.child;
    case 12:
      return Xi(a2, b2, b2.pendingProps.children, c2), b2.child;
    case 10:
      a: {
        d2 = b2.type._context;
        e2 = b2.pendingProps;
        f2 = b2.memoizedProps;
        g2 = e2.value;
        G$2(Wg, d2._currentValue);
        d2._currentValue = g2;
        if (null !== f2)
          if (He(f2.value, g2)) {
            if (f2.children === e2.children && !Wf.current) {
              b2 = Zi(a2, b2, c2);
              break a;
            }
          } else
            for (f2 = b2.child, null !== f2 && (f2.return = b2); null !== f2; ) {
              var h3 = f2.dependencies;
              if (null !== h3) {
                g2 = f2.child;
                for (var k2 = h3.firstContext; null !== k2; ) {
                  if (k2.context === d2) {
                    if (1 === f2.tag) {
                      k2 = mh(-1, c2 & -c2);
                      k2.tag = 2;
                      var l2 = f2.updateQueue;
                      if (null !== l2) {
                        l2 = l2.shared;
                        var m2 = l2.pending;
                        null === m2 ? k2.next = k2 : (k2.next = m2.next, m2.next = k2);
                        l2.pending = k2;
                      }
                    }
                    f2.lanes |= c2;
                    k2 = f2.alternate;
                    null !== k2 && (k2.lanes |= c2);
                    bh(
                      f2.return,
                      c2,
                      b2
                    );
                    h3.lanes |= c2;
                    break;
                  }
                  k2 = k2.next;
                }
              } else if (10 === f2.tag)
                g2 = f2.type === b2.type ? null : f2.child;
              else if (18 === f2.tag) {
                g2 = f2.return;
                if (null === g2)
                  throw Error(p$7(341));
                g2.lanes |= c2;
                h3 = g2.alternate;
                null !== h3 && (h3.lanes |= c2);
                bh(g2, c2, b2);
                g2 = f2.sibling;
              } else
                g2 = f2.child;
              if (null !== g2)
                g2.return = f2;
              else
                for (g2 = f2; null !== g2; ) {
                  if (g2 === b2) {
                    g2 = null;
                    break;
                  }
                  f2 = g2.sibling;
                  if (null !== f2) {
                    f2.return = g2.return;
                    g2 = f2;
                    break;
                  }
                  g2 = g2.return;
                }
              f2 = g2;
            }
        Xi(a2, b2, e2.children, c2);
        b2 = b2.child;
      }
      return b2;
    case 9:
      return e2 = b2.type, d2 = b2.pendingProps.children, ch(b2, c2), e2 = eh(e2), d2 = d2(e2), b2.flags |= 1, Xi(a2, b2, d2, c2), b2.child;
    case 14:
      return d2 = b2.type, e2 = Ci(d2, b2.pendingProps), e2 = Ci(d2.type, e2), $i(a2, b2, d2, e2, c2);
    case 15:
      return bj(a2, b2, b2.type, b2.pendingProps, c2);
    case 17:
      return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Ci(d2, e2), ij(a2, b2), b2.tag = 1, Zf(d2) ? (a2 = true, cg(b2)) : a2 = false, ch(b2, c2), Gi(b2, d2, e2), Ii(b2, d2, e2, c2), jj(null, b2, d2, true, a2, c2);
    case 19:
      return xj(a2, b2, c2);
    case 22:
      return dj(a2, b2, c2);
  }
  throw Error(p$7(156, b2.tag));
};
function Fk(a2, b2) {
  return ac$1(a2, b2);
}
function $k(a2, b2, c2, d2) {
  this.tag = a2;
  this.key = c2;
  this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null;
  this.index = 0;
  this.ref = null;
  this.pendingProps = b2;
  this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null;
  this.mode = d2;
  this.subtreeFlags = this.flags = 0;
  this.deletions = null;
  this.childLanes = this.lanes = 0;
  this.alternate = null;
}
function Bg(a2, b2, c2, d2) {
  return new $k(a2, b2, c2, d2);
}
function aj(a2) {
  a2 = a2.prototype;
  return !(!a2 || !a2.isReactComponent);
}
function Zk(a2) {
  if ("function" === typeof a2)
    return aj(a2) ? 1 : 0;
  if (void 0 !== a2 && null !== a2) {
    a2 = a2.$$typeof;
    if (a2 === Da$2)
      return 11;
    if (a2 === Ga$2)
      return 14;
  }
  return 2;
}
function Pg(a2, b2) {
  var c2 = a2.alternate;
  null === c2 ? (c2 = Bg(a2.tag, b2, a2.key, a2.mode), c2.elementType = a2.elementType, c2.type = a2.type, c2.stateNode = a2.stateNode, c2.alternate = a2, a2.alternate = c2) : (c2.pendingProps = b2, c2.type = a2.type, c2.flags = 0, c2.subtreeFlags = 0, c2.deletions = null);
  c2.flags = a2.flags & 14680064;
  c2.childLanes = a2.childLanes;
  c2.lanes = a2.lanes;
  c2.child = a2.child;
  c2.memoizedProps = a2.memoizedProps;
  c2.memoizedState = a2.memoizedState;
  c2.updateQueue = a2.updateQueue;
  b2 = a2.dependencies;
  c2.dependencies = null === b2 ? null : { lanes: b2.lanes, firstContext: b2.firstContext };
  c2.sibling = a2.sibling;
  c2.index = a2.index;
  c2.ref = a2.ref;
  return c2;
}
function Rg(a2, b2, c2, d2, e2, f2) {
  var g2 = 2;
  d2 = a2;
  if ("function" === typeof a2)
    aj(a2) && (g2 = 1);
  else if ("string" === typeof a2)
    g2 = 5;
  else
    a:
      switch (a2) {
        case ya$2:
          return Tg(c2.children, e2, f2, b2);
        case za$2:
          g2 = 8;
          e2 |= 8;
          break;
        case Aa$2:
          return a2 = Bg(12, c2, b2, e2 | 2), a2.elementType = Aa$2, a2.lanes = f2, a2;
        case Ea$2:
          return a2 = Bg(13, c2, b2, e2), a2.elementType = Ea$2, a2.lanes = f2, a2;
        case Fa$2:
          return a2 = Bg(19, c2, b2, e2), a2.elementType = Fa$2, a2.lanes = f2, a2;
        case Ia$2:
          return pj(c2, e2, f2, b2);
        default:
          if ("object" === typeof a2 && null !== a2)
            switch (a2.$$typeof) {
              case Ba$2:
                g2 = 10;
                break a;
              case Ca$2:
                g2 = 9;
                break a;
              case Da$2:
                g2 = 11;
                break a;
              case Ga$2:
                g2 = 14;
                break a;
              case Ha$2:
                g2 = 16;
                d2 = null;
                break a;
            }
          throw Error(p$7(130, null == a2 ? a2 : typeof a2, ""));
      }
  b2 = Bg(g2, c2, b2, e2);
  b2.elementType = a2;
  b2.type = d2;
  b2.lanes = f2;
  return b2;
}
function Tg(a2, b2, c2, d2) {
  a2 = Bg(7, a2, d2, b2);
  a2.lanes = c2;
  return a2;
}
function pj(a2, b2, c2, d2) {
  a2 = Bg(22, a2, d2, b2);
  a2.elementType = Ia$2;
  a2.lanes = c2;
  a2.stateNode = { isHidden: false };
  return a2;
}
function Qg(a2, b2, c2) {
  a2 = Bg(6, a2, null, b2);
  a2.lanes = c2;
  return a2;
}
function Sg(a2, b2, c2) {
  b2 = Bg(4, null !== a2.children ? a2.children : [], a2.key, b2);
  b2.lanes = c2;
  b2.stateNode = { containerInfo: a2.containerInfo, pendingChildren: null, implementation: a2.implementation };
  return b2;
}
function al(a2, b2, c2, d2, e2) {
  this.tag = b2;
  this.containerInfo = a2;
  this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
  this.timeoutHandle = -1;
  this.callbackNode = this.pendingContext = this.context = null;
  this.callbackPriority = 0;
  this.eventTimes = zc$1(0);
  this.expirationTimes = zc$1(-1);
  this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
  this.entanglements = zc$1(0);
  this.identifierPrefix = d2;
  this.onRecoverableError = e2;
  this.mutableSourceEagerHydrationData = null;
}
function bl(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  a2 = new al(a2, b2, c2, h3, k2);
  1 === b2 ? (b2 = 1, true === f2 && (b2 |= 8)) : b2 = 0;
  f2 = Bg(3, null, null, b2);
  a2.current = f2;
  f2.stateNode = a2;
  f2.memoizedState = { element: d2, isDehydrated: c2, cache: null, transitions: null, pendingSuspenseBoundaries: null };
  kh(f2);
  return a2;
}
function cl(a2, b2, c2) {
  var d2 = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
  return { $$typeof: wa$2, key: null == d2 ? null : "" + d2, children: a2, containerInfo: b2, implementation: c2 };
}
function dl(a2) {
  if (!a2)
    return Vf;
  a2 = a2._reactInternals;
  a: {
    if (Vb$1(a2) !== a2 || 1 !== a2.tag)
      throw Error(p$7(170));
    var b2 = a2;
    do {
      switch (b2.tag) {
        case 3:
          b2 = b2.stateNode.context;
          break a;
        case 1:
          if (Zf(b2.type)) {
            b2 = b2.stateNode.__reactInternalMemoizedMergedChildContext;
            break a;
          }
      }
      b2 = b2.return;
    } while (null !== b2);
    throw Error(p$7(171));
  }
  if (1 === a2.tag) {
    var c2 = a2.type;
    if (Zf(c2))
      return bg(a2, c2, b2);
  }
  return b2;
}
function el(a2, b2, c2, d2, e2, f2, g2, h3, k2) {
  a2 = bl(c2, d2, true, a2, e2, f2, g2, h3, k2);
  a2.context = dl(null);
  c2 = a2.current;
  d2 = R$4();
  e2 = yi(c2);
  f2 = mh(d2, e2);
  f2.callback = void 0 !== b2 && null !== b2 ? b2 : null;
  nh(c2, f2, e2);
  a2.current.lanes = e2;
  Ac$1(a2, e2, d2);
  Dk(a2, d2);
  return a2;
}
function fl(a2, b2, c2, d2) {
  var e2 = b2.current, f2 = R$4(), g2 = yi(e2);
  c2 = dl(c2);
  null === b2.context ? b2.context = c2 : b2.pendingContext = c2;
  b2 = mh(f2, g2);
  b2.payload = { element: a2 };
  d2 = void 0 === d2 ? null : d2;
  null !== d2 && (b2.callback = d2);
  a2 = nh(e2, b2, g2);
  null !== a2 && (gi(a2, e2, g2, f2), oh(a2, e2, g2));
  return g2;
}
function gl(a2) {
  a2 = a2.current;
  if (!a2.child)
    return null;
  switch (a2.child.tag) {
    case 5:
      return a2.child.stateNode;
    default:
      return a2.child.stateNode;
  }
}
function hl(a2, b2) {
  a2 = a2.memoizedState;
  if (null !== a2 && null !== a2.dehydrated) {
    var c2 = a2.retryLane;
    a2.retryLane = 0 !== c2 && c2 < b2 ? c2 : b2;
  }
}
function il(a2, b2) {
  hl(a2, b2);
  (a2 = a2.alternate) && hl(a2, b2);
}
function jl() {
  return null;
}
var kl = "function" === typeof reportError ? reportError : function(a2) {
  console.error(a2);
};
function ll(a2) {
  this._internalRoot = a2;
}
ml.prototype.render = ll.prototype.render = function(a2) {
  var b2 = this._internalRoot;
  if (null === b2)
    throw Error(p$7(409));
  fl(a2, b2, null, null);
};
ml.prototype.unmount = ll.prototype.unmount = function() {
  var a2 = this._internalRoot;
  if (null !== a2) {
    this._internalRoot = null;
    var b2 = a2.containerInfo;
    Rk(function() {
      fl(null, a2, null, null);
    });
    b2[uf] = null;
  }
};
function ml(a2) {
  this._internalRoot = a2;
}
ml.prototype.unstable_scheduleHydration = function(a2) {
  if (a2) {
    var b2 = Hc$1();
    a2 = { blockedOn: null, target: a2, priority: b2 };
    for (var c2 = 0; c2 < Qc$1.length && 0 !== b2 && b2 < Qc$1[c2].priority; c2++)
      ;
    Qc$1.splice(c2, 0, a2);
    0 === c2 && Vc$1(a2);
  }
};
function nl(a2) {
  return !(!a2 || 1 !== a2.nodeType && 9 !== a2.nodeType && 11 !== a2.nodeType);
}
function ol(a2) {
  return !(!a2 || 1 !== a2.nodeType && 9 !== a2.nodeType && 11 !== a2.nodeType && (8 !== a2.nodeType || " react-mount-point-unstable " !== a2.nodeValue));
}
function pl() {
}
function ql(a2, b2, c2, d2, e2) {
  if (e2) {
    if ("function" === typeof d2) {
      var f2 = d2;
      d2 = function() {
        var a3 = gl(g2);
        f2.call(a3);
      };
    }
    var g2 = el(b2, d2, a2, 0, null, false, false, "", pl);
    a2._reactRootContainer = g2;
    a2[uf] = g2.current;
    sf(8 === a2.nodeType ? a2.parentNode : a2);
    Rk();
    return g2;
  }
  for (; e2 = a2.lastChild; )
    a2.removeChild(e2);
  if ("function" === typeof d2) {
    var h3 = d2;
    d2 = function() {
      var a3 = gl(k2);
      h3.call(a3);
    };
  }
  var k2 = bl(a2, 0, false, null, null, false, false, "", pl);
  a2._reactRootContainer = k2;
  a2[uf] = k2.current;
  sf(8 === a2.nodeType ? a2.parentNode : a2);
  Rk(function() {
    fl(b2, k2, c2, d2);
  });
  return k2;
}
function rl(a2, b2, c2, d2, e2) {
  var f2 = c2._reactRootContainer;
  if (f2) {
    var g2 = f2;
    if ("function" === typeof e2) {
      var h3 = e2;
      e2 = function() {
        var a3 = gl(g2);
        h3.call(a3);
      };
    }
    fl(b2, g2, a2, e2);
  } else
    g2 = ql(c2, b2, a2, e2, d2);
  return gl(g2);
}
Ec$1 = function(a2) {
  switch (a2.tag) {
    case 3:
      var b2 = a2.stateNode;
      if (b2.current.memoizedState.isDehydrated) {
        var c2 = tc$1(b2.pendingLanes);
        0 !== c2 && (Cc$1(b2, c2 | 1), Dk(b2, B$3()), 0 === (K$2 & 6) && (Gj = B$3() + 500, jg()));
      }
      break;
    case 13:
      Rk(function() {
        var b3 = ih(a2, 1);
        if (null !== b3) {
          var c3 = R$4();
          gi(b3, a2, 1, c3);
        }
      }), il(a2, 1);
  }
};
Fc$1 = function(a2) {
  if (13 === a2.tag) {
    var b2 = ih(a2, 134217728);
    if (null !== b2) {
      var c2 = R$4();
      gi(b2, a2, 134217728, c2);
    }
    il(a2, 134217728);
  }
};
Gc$1 = function(a2) {
  if (13 === a2.tag) {
    var b2 = yi(a2), c2 = ih(a2, b2);
    if (null !== c2) {
      var d2 = R$4();
      gi(c2, a2, b2, d2);
    }
    il(a2, b2);
  }
};
Hc$1 = function() {
  return C$1;
};
Ic$1 = function(a2, b2) {
  var c2 = C$1;
  try {
    return C$1 = a2, b2();
  } finally {
    C$1 = c2;
  }
};
yb$2 = function(a2, b2, c2) {
  switch (b2) {
    case "input":
      bb$2(a2, c2);
      b2 = c2.name;
      if ("radio" === c2.type && null != b2) {
        for (c2 = a2; c2.parentNode; )
          c2 = c2.parentNode;
        c2 = c2.querySelectorAll("input[name=" + JSON.stringify("" + b2) + '][type="radio"]');
        for (b2 = 0; b2 < c2.length; b2++) {
          var d2 = c2[b2];
          if (d2 !== a2 && d2.form === a2.form) {
            var e2 = Db$2(d2);
            if (!e2)
              throw Error(p$7(90));
            Wa$2(d2);
            bb$2(d2, e2);
          }
        }
      }
      break;
    case "textarea":
      ib$2(a2, c2);
      break;
    case "select":
      b2 = c2.value, null != b2 && fb$2(a2, !!c2.multiple, b2, false);
  }
};
Gb$2 = Qk;
Hb$2 = Rk;
var sl = { usingClientEntryPoint: false, Events: [Cb$2, ue$1, Db$2, Eb$2, Fb$1, Qk] }, tl = { findFiberByHostInstance: Wc$1, bundleType: 0, version: "18.3.1", rendererPackageName: "react-dom" };
var ul = { bundleType: tl.bundleType, version: tl.version, rendererPackageName: tl.rendererPackageName, rendererConfig: tl.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, overrideProps: null, overridePropsDeletePath: null, overridePropsRenamePath: null, setErrorHandler: null, setSuspenseHandler: null, scheduleUpdate: null, currentDispatcherRef: ua$2.ReactCurrentDispatcher, findHostInstanceByFiber: function(a2) {
  a2 = Zb$1(a2);
  return null === a2 ? null : a2.stateNode;
}, findFiberByHostInstance: tl.findFiberByHostInstance || jl, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, reconcilerVersion: "18.3.1-next-f1338f8080-20240426" };
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
  var vl = __REACT_DEVTOOLS_GLOBAL_HOOK__;
  if (!vl.isDisabled && vl.supportsFiber)
    try {
      kc$1 = vl.inject(ul), lc$1 = vl;
    } catch (a2) {
    }
}
reactDom_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = sl;
reactDom_production_min.createPortal = function(a2, b2) {
  var c2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
  if (!nl(b2))
    throw Error(p$7(200));
  return cl(a2, b2, null, c2);
};
reactDom_production_min.createRoot = function(a2, b2) {
  if (!nl(a2))
    throw Error(p$7(299));
  var c2 = false, d2 = "", e2 = kl;
  null !== b2 && void 0 !== b2 && (true === b2.unstable_strictMode && (c2 = true), void 0 !== b2.identifierPrefix && (d2 = b2.identifierPrefix), void 0 !== b2.onRecoverableError && (e2 = b2.onRecoverableError));
  b2 = bl(a2, 1, false, null, null, c2, false, d2, e2);
  a2[uf] = b2.current;
  sf(8 === a2.nodeType ? a2.parentNode : a2);
  return new ll(b2);
};
reactDom_production_min.findDOMNode = function(a2) {
  if (null == a2)
    return null;
  if (1 === a2.nodeType)
    return a2;
  var b2 = a2._reactInternals;
  if (void 0 === b2) {
    if ("function" === typeof a2.render)
      throw Error(p$7(188));
    a2 = Object.keys(a2).join(",");
    throw Error(p$7(268, a2));
  }
  a2 = Zb$1(b2);
  a2 = null === a2 ? null : a2.stateNode;
  return a2;
};
reactDom_production_min.flushSync = function(a2) {
  return Rk(a2);
};
reactDom_production_min.hydrate = function(a2, b2, c2) {
  if (!ol(b2))
    throw Error(p$7(200));
  return rl(null, a2, b2, true, c2);
};
reactDom_production_min.hydrateRoot = function(a2, b2, c2) {
  if (!nl(a2))
    throw Error(p$7(405));
  var d2 = null != c2 && c2.hydratedSources || null, e2 = false, f2 = "", g2 = kl;
  null !== c2 && void 0 !== c2 && (true === c2.unstable_strictMode && (e2 = true), void 0 !== c2.identifierPrefix && (f2 = c2.identifierPrefix), void 0 !== c2.onRecoverableError && (g2 = c2.onRecoverableError));
  b2 = el(b2, null, a2, 1, null != c2 ? c2 : null, e2, false, f2, g2);
  a2[uf] = b2.current;
  sf(a2);
  if (d2)
    for (a2 = 0; a2 < d2.length; a2++)
      c2 = d2[a2], e2 = c2._getVersion, e2 = e2(c2._source), null == b2.mutableSourceEagerHydrationData ? b2.mutableSourceEagerHydrationData = [c2, e2] : b2.mutableSourceEagerHydrationData.push(
        c2,
        e2
      );
  return new ml(b2);
};
reactDom_production_min.render = function(a2, b2, c2) {
  if (!ol(b2))
    throw Error(p$7(200));
  return rl(null, a2, b2, false, c2);
};
reactDom_production_min.unmountComponentAtNode = function(a2) {
  if (!ol(a2))
    throw Error(p$7(40));
  return a2._reactRootContainer ? (Rk(function() {
    rl(null, null, a2, false, function() {
      a2._reactRootContainer = null;
      a2[uf] = null;
    });
  }), true) : false;
};
reactDom_production_min.unstable_batchedUpdates = Qk;
reactDom_production_min.unstable_renderSubtreeIntoContainer = function(a2, b2, c2, d2) {
  if (!ol(c2))
    throw Error(p$7(200));
  if (null == a2 || void 0 === a2._reactInternals)
    throw Error(p$7(38));
  return rl(a2, b2, c2, false, d2);
};
reactDom_production_min.version = "18.3.1-next-f1338f8080-20240426";
function checkDCE() {
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined" || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== "function") {
    return;
  }
  try {
    __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
  } catch (err) {
    console.error(err);
  }
}
{
  checkDCE();
  reactDom.exports = reactDom_production_min;
}
var reactDomExports = reactDom.exports;
const ReactDOM = /* @__PURE__ */ getDefaultExportFromCjs(reactDomExports);
var m$4 = reactDomExports;
{
  client.createRoot = m$4.createRoot;
  client.hydrateRoot = m$4.hydrateRoot;
}
/**
 * @remix-run/router v1.16.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function _extends$m() {
  _extends$m = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$m.apply(this, arguments);
}
var Action$1;
(function(Action2) {
  Action2["Pop"] = "POP";
  Action2["Push"] = "PUSH";
  Action2["Replace"] = "REPLACE";
})(Action$1 || (Action$1 = {}));
const PopStateEventType = "popstate";
function createHashHistory(options) {
  if (options === void 0) {
    options = {};
  }
  function createHashLocation(window2, globalHistory) {
    let {
      pathname = "/",
      search: search2 = "",
      hash = ""
    } = parsePath(window2.location.hash.substr(1));
    if (!pathname.startsWith("/") && !pathname.startsWith(".")) {
      pathname = "/" + pathname;
    }
    return createLocation(
      "",
      {
        pathname,
        search: search2,
        hash
      },
      // state defaults to `null` because `window.history.state` does
      globalHistory.state && globalHistory.state.usr || null,
      globalHistory.state && globalHistory.state.key || "default"
    );
  }
  function createHashHref(window2, to2) {
    let base = window2.document.querySelector("base");
    let href = "";
    if (base && base.getAttribute("href")) {
      let url2 = window2.location.href;
      let hashIndex = url2.indexOf("#");
      href = hashIndex === -1 ? url2 : url2.slice(0, hashIndex);
    }
    return href + "#" + (typeof to2 === "string" ? to2 : createPath(to2));
  }
  function validateHashLocation(location2, to2) {
    warning$4(location2.pathname.charAt(0) === "/", "relative pathnames are not supported in hash history.push(" + JSON.stringify(to2) + ")");
  }
  return getUrlBasedHistory(createHashLocation, createHashHref, validateHashLocation, options);
}
function invariant$3(value2, message) {
  if (value2 === false || value2 === null || typeof value2 === "undefined") {
    throw new Error(message);
  }
}
function warning$4(cond, message) {
  if (!cond) {
    if (typeof console !== "undefined")
      console.warn(message);
    try {
      throw new Error(message);
    } catch (e2) {
    }
  }
}
function createKey() {
  return Math.random().toString(36).substr(2, 8);
}
function getHistoryState(location2, index2) {
  return {
    usr: location2.state,
    key: location2.key,
    idx: index2
  };
}
function createLocation(current, to2, state, key) {
  if (state === void 0) {
    state = null;
  }
  let location2 = _extends$m({
    pathname: typeof current === "string" ? current : current.pathname,
    search: "",
    hash: ""
  }, typeof to2 === "string" ? parsePath(to2) : to2, {
    state,
    // TODO: This could be cleaned up.  push/replace should probably just take
    // full Locations now and avoid the need to run through this flow at all
    // But that's a pretty big refactor to the current test suite so going to
    // keep as is for the time being and just let any incoming keys take precedence
    key: to2 && to2.key || key || createKey()
  });
  return location2;
}
function createPath(_ref) {
  let {
    pathname = "/",
    search: search2 = "",
    hash = ""
  } = _ref;
  if (search2 && search2 !== "?")
    pathname += search2.charAt(0) === "?" ? search2 : "?" + search2;
  if (hash && hash !== "#")
    pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
  return pathname;
}
function parsePath(path) {
  let parsedPath = {};
  if (path) {
    let hashIndex = path.indexOf("#");
    if (hashIndex >= 0) {
      parsedPath.hash = path.substr(hashIndex);
      path = path.substr(0, hashIndex);
    }
    let searchIndex = path.indexOf("?");
    if (searchIndex >= 0) {
      parsedPath.search = path.substr(searchIndex);
      path = path.substr(0, searchIndex);
    }
    if (path) {
      parsedPath.pathname = path;
    }
  }
  return parsedPath;
}
function getUrlBasedHistory(getLocation, createHref, validateLocation, options) {
  if (options === void 0) {
    options = {};
  }
  let {
    window: window2 = document.defaultView,
    v5Compat = false
  } = options;
  let globalHistory = window2.history;
  let action = Action$1.Pop;
  let listener = null;
  let index2 = getIndex();
  if (index2 == null) {
    index2 = 0;
    globalHistory.replaceState(_extends$m({}, globalHistory.state, {
      idx: index2
    }), "");
  }
  function getIndex() {
    let state = globalHistory.state || {
      idx: null
    };
    return state.idx;
  }
  function handlePop() {
    action = Action$1.Pop;
    let nextIndex = getIndex();
    let delta = nextIndex == null ? null : nextIndex - index2;
    index2 = nextIndex;
    if (listener) {
      listener({
        action,
        location: history.location,
        delta
      });
    }
  }
  function push2(to2, state) {
    action = Action$1.Push;
    let location2 = createLocation(history.location, to2, state);
    if (validateLocation)
      validateLocation(location2, to2);
    index2 = getIndex() + 1;
    let historyState = getHistoryState(location2, index2);
    let url2 = history.createHref(location2);
    try {
      globalHistory.pushState(historyState, "", url2);
    } catch (error2) {
      if (error2 instanceof DOMException && error2.name === "DataCloneError") {
        throw error2;
      }
      window2.location.assign(url2);
    }
    if (v5Compat && listener) {
      listener({
        action,
        location: history.location,
        delta: 1
      });
    }
  }
  function replace2(to2, state) {
    action = Action$1.Replace;
    let location2 = createLocation(history.location, to2, state);
    if (validateLocation)
      validateLocation(location2, to2);
    index2 = getIndex();
    let historyState = getHistoryState(location2, index2);
    let url2 = history.createHref(location2);
    globalHistory.replaceState(historyState, "", url2);
    if (v5Compat && listener) {
      listener({
        action,
        location: history.location,
        delta: 0
      });
    }
  }
  function createURL(to2) {
    let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
    let href = typeof to2 === "string" ? to2 : createPath(to2);
    href = href.replace(/ $/, "%20");
    invariant$3(base, "No window.location.(origin|href) available to create URL for href: " + href);
    return new URL(href, base);
  }
  let history = {
    get action() {
      return action;
    },
    get location() {
      return getLocation(window2, globalHistory);
    },
    listen(fn) {
      if (listener) {
        throw new Error("A history only accepts one active listener");
      }
      window2.addEventListener(PopStateEventType, handlePop);
      listener = fn;
      return () => {
        window2.removeEventListener(PopStateEventType, handlePop);
        listener = null;
      };
    },
    createHref(to2) {
      return createHref(window2, to2);
    },
    createURL,
    encodeLocation(to2) {
      let url2 = createURL(to2);
      return {
        pathname: url2.pathname,
        search: url2.search,
        hash: url2.hash
      };
    },
    push: push2,
    replace: replace2,
    go(n2) {
      return globalHistory.go(n2);
    }
  };
  return history;
}
var ResultType;
(function(ResultType2) {
  ResultType2["data"] = "data";
  ResultType2["deferred"] = "deferred";
  ResultType2["redirect"] = "redirect";
  ResultType2["error"] = "error";
})(ResultType || (ResultType = {}));
function matchRoutes(routes, locationArg, basename2) {
  if (basename2 === void 0) {
    basename2 = "/";
  }
  let location2 = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
  let pathname = stripBasename(location2.pathname || "/", basename2);
  if (pathname == null) {
    return null;
  }
  let branches = flattenRoutes$1(routes);
  rankRouteBranches(branches);
  let matches = null;
  for (let i2 = 0; matches == null && i2 < branches.length; ++i2) {
    let decoded = decodePath(pathname);
    matches = matchRouteBranch(branches[i2], decoded);
  }
  return matches;
}
function flattenRoutes$1(routes, branches, parentsMeta, parentPath) {
  if (branches === void 0) {
    branches = [];
  }
  if (parentsMeta === void 0) {
    parentsMeta = [];
  }
  if (parentPath === void 0) {
    parentPath = "";
  }
  let flattenRoute = (route2, index2, relativePath) => {
    let meta = {
      relativePath: relativePath === void 0 ? route2.path || "" : relativePath,
      caseSensitive: route2.caseSensitive === true,
      childrenIndex: index2,
      route: route2
    };
    if (meta.relativePath.startsWith("/")) {
      invariant$3(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
      meta.relativePath = meta.relativePath.slice(parentPath.length);
    }
    let path = joinPaths([parentPath, meta.relativePath]);
    let routesMeta = parentsMeta.concat(meta);
    if (route2.children && route2.children.length > 0) {
      invariant$3(
        // Our types know better, but runtime JS may not!
        // @ts-expect-error
        route2.index !== true,
        "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')
      );
      flattenRoutes$1(route2.children, branches, routesMeta, path);
    }
    if (route2.path == null && !route2.index) {
      return;
    }
    branches.push({
      path,
      score: computeScore(path, route2.index),
      routesMeta
    });
  };
  routes.forEach((route2, index2) => {
    var _route$path;
    if (route2.path === "" || !((_route$path = route2.path) != null && _route$path.includes("?"))) {
      flattenRoute(route2, index2);
    } else {
      for (let exploded of explodeOptionalSegments(route2.path)) {
        flattenRoute(route2, index2, exploded);
      }
    }
  });
  return branches;
}
function explodeOptionalSegments(path) {
  let segments = path.split("/");
  if (segments.length === 0)
    return [];
  let [first, ...rest] = segments;
  let isOptional = first.endsWith("?");
  let required4 = first.replace(/\?$/, "");
  if (rest.length === 0) {
    return isOptional ? [required4, ""] : [required4];
  }
  let restExploded = explodeOptionalSegments(rest.join("/"));
  let result = [];
  result.push(...restExploded.map((subpath) => subpath === "" ? required4 : [required4, subpath].join("/")));
  if (isOptional) {
    result.push(...restExploded);
  }
  return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
}
function rankRouteBranches(branches) {
  branches.sort((a2, b2) => a2.score !== b2.score ? b2.score - a2.score : compareIndexes(a2.routesMeta.map((meta) => meta.childrenIndex), b2.routesMeta.map((meta) => meta.childrenIndex)));
}
const paramRe = /^:[\w-]+$/;
const dynamicSegmentValue = 3;
const indexRouteValue = 2;
const emptySegmentValue = 1;
const staticSegmentValue = 10;
const splatPenalty = -2;
const isSplat = (s2) => s2 === "*";
function computeScore(path, index2) {
  let segments = path.split("/");
  let initialScore = segments.length;
  if (segments.some(isSplat)) {
    initialScore += splatPenalty;
  }
  if (index2) {
    initialScore += indexRouteValue;
  }
  return segments.filter((s2) => !isSplat(s2)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
}
function compareIndexes(a2, b2) {
  let siblings = a2.length === b2.length && a2.slice(0, -1).every((n2, i2) => n2 === b2[i2]);
  return siblings ? (
    // If two routes are siblings, we should try to match the earlier sibling
    // first. This allows people to have fine-grained control over the matching
    // behavior by simply putting routes with identical paths in the order they
    // want them tried.
    a2[a2.length - 1] - b2[b2.length - 1]
  ) : (
    // Otherwise, it doesn't really make sense to rank non-siblings by index,
    // so they sort equally.
    0
  );
}
function matchRouteBranch(branch, pathname) {
  let {
    routesMeta
  } = branch;
  let matchedParams = {};
  let matchedPathname = "/";
  let matches = [];
  for (let i2 = 0; i2 < routesMeta.length; ++i2) {
    let meta = routesMeta[i2];
    let end = i2 === routesMeta.length - 1;
    let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
    let match5 = matchPath({
      path: meta.relativePath,
      caseSensitive: meta.caseSensitive,
      end
    }, remainingPathname);
    if (!match5)
      return null;
    Object.assign(matchedParams, match5.params);
    let route2 = meta.route;
    matches.push({
      // TODO: Can this as be avoided?
      params: matchedParams,
      pathname: joinPaths([matchedPathname, match5.pathname]),
      pathnameBase: normalizePathname(joinPaths([matchedPathname, match5.pathnameBase])),
      route: route2
    });
    if (match5.pathnameBase !== "/") {
      matchedPathname = joinPaths([matchedPathname, match5.pathnameBase]);
    }
  }
  return matches;
}
function matchPath(pattern4, pathname) {
  if (typeof pattern4 === "string") {
    pattern4 = {
      path: pattern4,
      caseSensitive: false,
      end: true
    };
  }
  let [matcher, compiledParams] = compilePath(pattern4.path, pattern4.caseSensitive, pattern4.end);
  let match5 = pathname.match(matcher);
  if (!match5)
    return null;
  let matchedPathname = match5[0];
  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
  let captureGroups = match5.slice(1);
  let params = compiledParams.reduce((memo2, _ref, index2) => {
    let {
      paramName,
      isOptional
    } = _ref;
    if (paramName === "*") {
      let splatValue = captureGroups[index2] || "";
      pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
    }
    const value2 = captureGroups[index2];
    if (isOptional && !value2) {
      memo2[paramName] = void 0;
    } else {
      memo2[paramName] = (value2 || "").replace(/%2F/g, "/");
    }
    return memo2;
  }, {});
  return {
    params,
    pathname: matchedPathname,
    pathnameBase,
    pattern: pattern4
  };
}
function compilePath(path, caseSensitive, end) {
  if (caseSensitive === void 0) {
    caseSensitive = false;
  }
  if (end === void 0) {
    end = true;
  }
  warning$4(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
  let params = [];
  let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_24, paramName, isOptional) => {
    params.push({
      paramName,
      isOptional: isOptional != null
    });
    return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
  });
  if (path.endsWith("*")) {
    params.push({
      paramName: "*"
    });
    regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
  } else if (end) {
    regexpSource += "\\/*$";
  } else if (path !== "" && path !== "/") {
    regexpSource += "(?:(?=\\/|$))";
  } else
    ;
  let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
  return [matcher, params];
}
function decodePath(value2) {
  try {
    return value2.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
  } catch (error2) {
    warning$4(false, 'The URL path "' + value2 + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error2 + ")."));
    return value2;
  }
}
function stripBasename(pathname, basename2) {
  if (basename2 === "/")
    return pathname;
  if (!pathname.toLowerCase().startsWith(basename2.toLowerCase())) {
    return null;
  }
  let startIndex = basename2.endsWith("/") ? basename2.length - 1 : basename2.length;
  let nextChar = pathname.charAt(startIndex);
  if (nextChar && nextChar !== "/") {
    return null;
  }
  return pathname.slice(startIndex) || "/";
}
function resolvePath(to2, fromPathname) {
  if (fromPathname === void 0) {
    fromPathname = "/";
  }
  let {
    pathname: toPathname,
    search: search2 = "",
    hash = ""
  } = typeof to2 === "string" ? parsePath(to2) : to2;
  let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
  return {
    pathname,
    search: normalizeSearch(search2),
    hash: normalizeHash(hash)
  };
}
function resolvePathname(relativePath, fromPathname) {
  let segments = fromPathname.replace(/\/+$/, "").split("/");
  let relativeSegments = relativePath.split("/");
  relativeSegments.forEach((segment) => {
    if (segment === "..") {
      if (segments.length > 1)
        segments.pop();
    } else if (segment !== ".") {
      segments.push(segment);
    }
  });
  return segments.length > 1 ? segments.join("/") : "/";
}
function getInvalidPathError(char2, field, dest, path) {
  return "Cannot include a '" + char2 + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "].  Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
}
function getPathContributingMatches(matches) {
  return matches.filter((match5, index2) => index2 === 0 || match5.route.path && match5.route.path.length > 0);
}
function getResolveToMatches(matches, v7_relativeSplatPath) {
  let pathMatches = getPathContributingMatches(matches);
  if (v7_relativeSplatPath) {
    return pathMatches.map((match5, idx) => idx === matches.length - 1 ? match5.pathname : match5.pathnameBase);
  }
  return pathMatches.map((match5) => match5.pathnameBase);
}
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
  if (isPathRelative === void 0) {
    isPathRelative = false;
  }
  let to2;
  if (typeof toArg === "string") {
    to2 = parsePath(toArg);
  } else {
    to2 = _extends$m({}, toArg);
    invariant$3(!to2.pathname || !to2.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to2));
    invariant$3(!to2.pathname || !to2.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to2));
    invariant$3(!to2.search || !to2.search.includes("#"), getInvalidPathError("#", "search", "hash", to2));
  }
  let isEmptyPath = toArg === "" || to2.pathname === "";
  let toPathname = isEmptyPath ? "/" : to2.pathname;
  let from2;
  if (toPathname == null) {
    from2 = locationPathname;
  } else {
    let routePathnameIndex = routePathnames.length - 1;
    if (!isPathRelative && toPathname.startsWith("..")) {
      let toSegments = toPathname.split("/");
      while (toSegments[0] === "..") {
        toSegments.shift();
        routePathnameIndex -= 1;
      }
      to2.pathname = toSegments.join("/");
    }
    from2 = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
  }
  let path = resolvePath(to2, from2);
  let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
  let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
  if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
    path.pathname += "/";
  }
  return path;
}
const joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
const normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
const normalizeSearch = (search2) => !search2 || search2 === "?" ? "" : search2.startsWith("?") ? search2 : "?" + search2;
const normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
function isRouteErrorResponse(error2) {
  return error2 != null && typeof error2.status === "number" && typeof error2.statusText === "string" && typeof error2.internal === "boolean" && "data" in error2;
}
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
new Set(validMutationMethodsArr);
const validRequestMethodsArr = ["get", ...validMutationMethodsArr];
new Set(validRequestMethodsArr);
/**
 * React Router v6.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function _extends$l() {
  _extends$l = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$l.apply(this, arguments);
}
const DataRouterContext = /* @__PURE__ */ reactExports.createContext(null);
const DataRouterStateContext = /* @__PURE__ */ reactExports.createContext(null);
const NavigationContext = /* @__PURE__ */ reactExports.createContext(null);
const LocationContext = /* @__PURE__ */ reactExports.createContext(null);
const RouteContext = /* @__PURE__ */ reactExports.createContext({
  outlet: null,
  matches: [],
  isDataRoute: false
});
const RouteErrorContext = /* @__PURE__ */ reactExports.createContext(null);
function useHref(to2, _temp) {
  let {
    relative
  } = _temp === void 0 ? {} : _temp;
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    basename: basename2,
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    hash,
    pathname,
    search: search2
  } = useResolvedPath(to2, {
    relative
  });
  let joinedPathname = pathname;
  if (basename2 !== "/") {
    joinedPathname = pathname === "/" ? basename2 : joinPaths([basename2, pathname]);
  }
  return navigator2.createHref({
    pathname: joinedPathname,
    search: search2,
    hash
  });
}
function useInRouterContext() {
  return reactExports.useContext(LocationContext) != null;
}
function useLocation() {
  !useInRouterContext() ? invariant$3(false) : void 0;
  return reactExports.useContext(LocationContext).location;
}
function useIsomorphicLayoutEffect$5(cb2) {
  let isStatic = reactExports.useContext(NavigationContext).static;
  if (!isStatic) {
    reactExports.useLayoutEffect(cb2);
  }
}
function useNavigate() {
  let {
    isDataRoute
  } = reactExports.useContext(RouteContext);
  return isDataRoute ? useNavigateStable() : useNavigateUnstable();
}
function useNavigateUnstable() {
  !useInRouterContext() ? invariant$3(false) : void 0;
  let dataRouterContext = reactExports.useContext(DataRouterContext);
  let {
    basename: basename2,
    future,
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
  let activeRef = reactExports.useRef(false);
  useIsomorphicLayoutEffect$5(() => {
    activeRef.current = true;
  });
  let navigate = reactExports.useCallback(function(to2, options) {
    if (options === void 0) {
      options = {};
    }
    if (!activeRef.current)
      return;
    if (typeof to2 === "number") {
      navigator2.go(to2);
      return;
    }
    let path = resolveTo(to2, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
    if (dataRouterContext == null && basename2 !== "/") {
      path.pathname = path.pathname === "/" ? basename2 : joinPaths([basename2, path.pathname]);
    }
    (!!options.replace ? navigator2.replace : navigator2.push)(path, options.state, options);
  }, [basename2, navigator2, routePathnamesJson, locationPathname, dataRouterContext]);
  return navigate;
}
function useResolvedPath(to2, _temp2) {
  let {
    relative
  } = _temp2 === void 0 ? {} : _temp2;
  let {
    future
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
  return reactExports.useMemo(() => resolveTo(to2, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to2, routePathnamesJson, locationPathname, relative]);
}
function useRoutes(routes, locationArg) {
  return useRoutesImpl(routes);
}
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    navigator: navigator2
  } = reactExports.useContext(NavigationContext);
  let {
    matches: parentMatches
  } = reactExports.useContext(RouteContext);
  let routeMatch = parentMatches[parentMatches.length - 1];
  let parentParams = routeMatch ? routeMatch.params : {};
  routeMatch ? routeMatch.pathname : "/";
  let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
  routeMatch && routeMatch.route;
  let locationFromContext = useLocation();
  let location2;
  {
    location2 = locationFromContext;
  }
  let pathname = location2.pathname || "/";
  let remainingPathname = pathname;
  if (parentPathnameBase !== "/") {
    let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
    let segments = pathname.replace(/^\//, "").split("/");
    remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
  }
  let matches = matchRoutes(routes, {
    pathname: remainingPathname
  });
  let renderedMatches = _renderMatches(matches && matches.map((match5) => Object.assign({}, match5, {
    params: Object.assign({}, parentParams, match5.params),
    pathname: joinPaths([
      parentPathnameBase,
      // Re-encode pathnames that were decoded inside matchRoutes
      navigator2.encodeLocation ? navigator2.encodeLocation(match5.pathname).pathname : match5.pathname
    ]),
    pathnameBase: match5.pathnameBase === "/" ? parentPathnameBase : joinPaths([
      parentPathnameBase,
      // Re-encode pathnames that were decoded inside matchRoutes
      navigator2.encodeLocation ? navigator2.encodeLocation(match5.pathnameBase).pathname : match5.pathnameBase
    ])
  })), parentMatches, dataRouterState, future);
  return renderedMatches;
}
function DefaultErrorComponent() {
  let error2 = useRouteError();
  let message = isRouteErrorResponse(error2) ? error2.status + " " + error2.statusText : error2 instanceof Error ? error2.message : JSON.stringify(error2);
  let stack = error2 instanceof Error ? error2.stack : null;
  let lightgrey = "rgba(200,200,200, 0.5)";
  let preStyles = {
    padding: "0.5rem",
    backgroundColor: lightgrey
  };
  let devInfo = null;
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", {
    style: {
      fontStyle: "italic"
    }
  }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", {
    style: preStyles
  }, stack) : null, devInfo);
}
const defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null);
class RenderErrorBoundary extends reactExports.Component {
  constructor(props) {
    super(props);
    this.state = {
      location: props.location,
      revalidation: props.revalidation,
      error: props.error
    };
  }
  static getDerivedStateFromError(error2) {
    return {
      error: error2
    };
  }
  static getDerivedStateFromProps(props, state) {
    if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
      return {
        error: props.error,
        location: props.location,
        revalidation: props.revalidation
      };
    }
    return {
      error: props.error !== void 0 ? props.error : state.error,
      location: state.location,
      revalidation: props.revalidation || state.revalidation
    };
  }
  componentDidCatch(error2, errorInfo) {
    console.error("React Router caught the following error during render", error2, errorInfo);
  }
  render() {
    return this.state.error !== void 0 ? /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, {
      value: this.props.routeContext
    }, /* @__PURE__ */ reactExports.createElement(RouteErrorContext.Provider, {
      value: this.state.error,
      children: this.props.component
    })) : this.props.children;
  }
}
function RenderedRoute(_ref) {
  let {
    routeContext,
    match: match5,
    children
  } = _ref;
  let dataRouterContext = reactExports.useContext(DataRouterContext);
  if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match5.route.errorElement || match5.route.ErrorBoundary)) {
    dataRouterContext.staticContext._deepestRenderedBoundaryId = match5.route.id;
  }
  return /* @__PURE__ */ reactExports.createElement(RouteContext.Provider, {
    value: routeContext
  }, children);
}
function _renderMatches(matches, parentMatches, dataRouterState, future) {
  var _dataRouterState2;
  if (parentMatches === void 0) {
    parentMatches = [];
  }
  if (dataRouterState === void 0) {
    dataRouterState = null;
  }
  if (future === void 0) {
    future = null;
  }
  if (matches == null) {
    var _dataRouterState;
    if ((_dataRouterState = dataRouterState) != null && _dataRouterState.errors) {
      matches = dataRouterState.matches;
    } else {
      return null;
    }
  }
  let renderedMatches = matches;
  let errors = (_dataRouterState2 = dataRouterState) == null ? void 0 : _dataRouterState2.errors;
  if (errors != null) {
    let errorIndex = renderedMatches.findIndex((m2) => m2.route.id && (errors == null ? void 0 : errors[m2.route.id]) !== void 0);
    !(errorIndex >= 0) ? invariant$3(false) : void 0;
    renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
  }
  let renderFallback = false;
  let fallbackIndex = -1;
  if (dataRouterState && future && future.v7_partialHydration) {
    for (let i2 = 0; i2 < renderedMatches.length; i2++) {
      let match5 = renderedMatches[i2];
      if (match5.route.HydrateFallback || match5.route.hydrateFallbackElement) {
        fallbackIndex = i2;
      }
      if (match5.route.id) {
        let {
          loaderData,
          errors: errors2
        } = dataRouterState;
        let needsToRunLoader = match5.route.loader && loaderData[match5.route.id] === void 0 && (!errors2 || errors2[match5.route.id] === void 0);
        if (match5.route.lazy || needsToRunLoader) {
          renderFallback = true;
          if (fallbackIndex >= 0) {
            renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
          } else {
            renderedMatches = [renderedMatches[0]];
          }
          break;
        }
      }
    }
  }
  return renderedMatches.reduceRight((outlet, match5, index2) => {
    let error2;
    let shouldRenderHydrateFallback = false;
    let errorElement = null;
    let hydrateFallbackElement = null;
    if (dataRouterState) {
      error2 = errors && match5.route.id ? errors[match5.route.id] : void 0;
      errorElement = match5.route.errorElement || defaultErrorElement;
      if (renderFallback) {
        if (fallbackIndex < 0 && index2 === 0) {
          warningOnce$1("route-fallback");
          shouldRenderHydrateFallback = true;
          hydrateFallbackElement = null;
        } else if (fallbackIndex === index2) {
          shouldRenderHydrateFallback = true;
          hydrateFallbackElement = match5.route.hydrateFallbackElement || null;
        }
      }
    }
    let matches2 = parentMatches.concat(renderedMatches.slice(0, index2 + 1));
    let getChildren2 = () => {
      let children;
      if (error2) {
        children = errorElement;
      } else if (shouldRenderHydrateFallback) {
        children = hydrateFallbackElement;
      } else if (match5.route.Component) {
        children = /* @__PURE__ */ reactExports.createElement(match5.route.Component, null);
      } else if (match5.route.element) {
        children = match5.route.element;
      } else {
        children = outlet;
      }
      return /* @__PURE__ */ reactExports.createElement(RenderedRoute, {
        match: match5,
        routeContext: {
          outlet,
          matches: matches2,
          isDataRoute: dataRouterState != null
        },
        children
      });
    };
    return dataRouterState && (match5.route.ErrorBoundary || match5.route.errorElement || index2 === 0) ? /* @__PURE__ */ reactExports.createElement(RenderErrorBoundary, {
      location: dataRouterState.location,
      revalidation: dataRouterState.revalidation,
      component: errorElement,
      error: error2,
      children: getChildren2(),
      routeContext: {
        outlet: null,
        matches: matches2,
        isDataRoute: true
      }
    }) : getChildren2();
  }, null);
}
var DataRouterHook$1 = /* @__PURE__ */ function(DataRouterHook2) {
  DataRouterHook2["UseBlocker"] = "useBlocker";
  DataRouterHook2["UseRevalidator"] = "useRevalidator";
  DataRouterHook2["UseNavigateStable"] = "useNavigate";
  return DataRouterHook2;
}(DataRouterHook$1 || {});
var DataRouterStateHook$1 = /* @__PURE__ */ function(DataRouterStateHook2) {
  DataRouterStateHook2["UseBlocker"] = "useBlocker";
  DataRouterStateHook2["UseLoaderData"] = "useLoaderData";
  DataRouterStateHook2["UseActionData"] = "useActionData";
  DataRouterStateHook2["UseRouteError"] = "useRouteError";
  DataRouterStateHook2["UseNavigation"] = "useNavigation";
  DataRouterStateHook2["UseRouteLoaderData"] = "useRouteLoaderData";
  DataRouterStateHook2["UseMatches"] = "useMatches";
  DataRouterStateHook2["UseRevalidator"] = "useRevalidator";
  DataRouterStateHook2["UseNavigateStable"] = "useNavigate";
  DataRouterStateHook2["UseRouteId"] = "useRouteId";
  return DataRouterStateHook2;
}(DataRouterStateHook$1 || {});
function useDataRouterContext(hookName) {
  let ctx = reactExports.useContext(DataRouterContext);
  !ctx ? invariant$3(false) : void 0;
  return ctx;
}
function useDataRouterState(hookName) {
  let state = reactExports.useContext(DataRouterStateContext);
  !state ? invariant$3(false) : void 0;
  return state;
}
function useRouteContext(hookName) {
  let route2 = reactExports.useContext(RouteContext);
  !route2 ? invariant$3(false) : void 0;
  return route2;
}
function useCurrentRouteId(hookName) {
  let route2 = useRouteContext();
  let thisRoute = route2.matches[route2.matches.length - 1];
  !thisRoute.route.id ? invariant$3(false) : void 0;
  return thisRoute.route.id;
}
function useRouteError() {
  var _state$errors;
  let error2 = reactExports.useContext(RouteErrorContext);
  let state = useDataRouterState();
  let routeId = useCurrentRouteId();
  if (error2 !== void 0) {
    return error2;
  }
  return (_state$errors = state.errors) == null ? void 0 : _state$errors[routeId];
}
function useNavigateStable() {
  let {
    router
  } = useDataRouterContext(DataRouterHook$1.UseNavigateStable);
  let id2 = useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable);
  let activeRef = reactExports.useRef(false);
  useIsomorphicLayoutEffect$5(() => {
    activeRef.current = true;
  });
  let navigate = reactExports.useCallback(function(to2, options) {
    if (options === void 0) {
      options = {};
    }
    if (!activeRef.current)
      return;
    if (typeof to2 === "number") {
      router.navigate(to2);
    } else {
      router.navigate(to2, _extends$l({
        fromRouteId: id2
      }, options));
    }
  }, [router, id2]);
  return navigate;
}
const alreadyWarned$1 = {};
function warningOnce$1(key, cond, message) {
  if (!alreadyWarned$1[key]) {
    alreadyWarned$1[key] = true;
  }
}
function Navigate(_ref4) {
  let {
    to: to2,
    replace: replace2,
    state,
    relative
  } = _ref4;
  !useInRouterContext() ? invariant$3(false) : void 0;
  let {
    future,
    static: isStatic
  } = reactExports.useContext(NavigationContext);
  let {
    matches
  } = reactExports.useContext(RouteContext);
  let {
    pathname: locationPathname
  } = useLocation();
  let navigate = useNavigate();
  let path = resolveTo(to2, getResolveToMatches(matches, future.v7_relativeSplatPath), locationPathname, relative === "path");
  let jsonPath = JSON.stringify(path);
  reactExports.useEffect(() => navigate(JSON.parse(jsonPath), {
    replace: replace2,
    state,
    relative
  }), [navigate, jsonPath, relative, replace2, state]);
  return null;
}
function Router(_ref5) {
  let {
    basename: basenameProp = "/",
    children = null,
    location: locationProp,
    navigationType = Action$1.Pop,
    navigator: navigator2,
    static: staticProp = false,
    future
  } = _ref5;
  !!useInRouterContext() ? invariant$3(false) : void 0;
  let basename2 = basenameProp.replace(/^\/*/, "/");
  let navigationContext = reactExports.useMemo(() => ({
    basename: basename2,
    navigator: navigator2,
    static: staticProp,
    future: _extends$l({
      v7_relativeSplatPath: false
    }, future)
  }), [basename2, future, navigator2, staticProp]);
  if (typeof locationProp === "string") {
    locationProp = parsePath(locationProp);
  }
  let {
    pathname = "/",
    search: search2 = "",
    hash = "",
    state = null,
    key = "default"
  } = locationProp;
  let locationContext = reactExports.useMemo(() => {
    let trailingPathname = stripBasename(pathname, basename2);
    if (trailingPathname == null) {
      return null;
    }
    return {
      location: {
        pathname: trailingPathname,
        search: search2,
        hash,
        state,
        key
      },
      navigationType
    };
  }, [basename2, pathname, search2, hash, state, key, navigationType]);
  if (locationContext == null) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(NavigationContext.Provider, {
    value: navigationContext
  }, /* @__PURE__ */ reactExports.createElement(LocationContext.Provider, {
    children,
    value: locationContext
  }));
}
new Promise(() => {
});
/**
 * React Router DOM v6.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
function _extends$k() {
  _extends$k = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$k.apply(this, arguments);
}
function _objectWithoutPropertiesLoose$3(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source2);
  var key, i2;
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
    key = sourceKeys[i2];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source2[key];
  }
  return target;
}
function isModifiedEvent(event) {
  return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
function shouldProcessLinkClick(event, target) {
  return event.button === 0 && // Ignore everything but left clicks
  (!target || target === "_self") && // Let browser handle "target=_blank" etc.
  !isModifiedEvent(event);
}
function createSearchParams(init2) {
  if (init2 === void 0) {
    init2 = "";
  }
  return new URLSearchParams(typeof init2 === "string" || Array.isArray(init2) || init2 instanceof URLSearchParams ? init2 : Object.keys(init2).reduce((memo2, key) => {
    let value2 = init2[key];
    return memo2.concat(Array.isArray(value2) ? value2.map((v2) => [key, v2]) : [[key, value2]]);
  }, []));
}
function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
  let searchParams = createSearchParams(locationSearch);
  if (defaultSearchParams) {
    defaultSearchParams.forEach((_24, key) => {
      if (!searchParams.has(key)) {
        defaultSearchParams.getAll(key).forEach((value2) => {
          searchParams.append(key, value2);
        });
      }
    });
  }
  return searchParams;
}
const _excluded$A = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "unstable_viewTransition"];
const REACT_ROUTER_VERSION = "6";
try {
  window.__reactRouterVersion = REACT_ROUTER_VERSION;
} catch (e2) {
}
const START_TRANSITION = "startTransition";
const startTransitionImpl = React$7[START_TRANSITION];
function HashRouter(_ref5) {
  let {
    basename: basename2,
    children,
    future,
    window: window2
  } = _ref5;
  let historyRef = reactExports.useRef();
  if (historyRef.current == null) {
    historyRef.current = createHashHistory({
      window: window2,
      v5Compat: true
    });
  }
  let history = historyRef.current;
  let [state, setStateImpl] = reactExports.useState({
    action: history.action,
    location: history.location
  });
  let {
    v7_startTransition
  } = future || {};
  let setState = reactExports.useCallback((newState) => {
    v7_startTransition && startTransitionImpl ? startTransitionImpl(() => setStateImpl(newState)) : setStateImpl(newState);
  }, [setStateImpl, v7_startTransition]);
  reactExports.useLayoutEffect(() => history.listen(setState), [history, setState]);
  return /* @__PURE__ */ reactExports.createElement(Router, {
    basename: basename2,
    children,
    location: state.location,
    navigationType: state.action,
    navigator: history,
    future
  });
}
const isBrowser$4 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
const Link$1 = /* @__PURE__ */ reactExports.forwardRef(function LinkWithRef(_ref7, ref) {
  let {
    onClick,
    relative,
    reloadDocument,
    replace: replace2,
    state,
    target,
    to: to2,
    preventScrollReset,
    unstable_viewTransition
  } = _ref7, rest = _objectWithoutPropertiesLoose$3(_ref7, _excluded$A);
  let {
    basename: basename2
  } = reactExports.useContext(NavigationContext);
  let absoluteHref;
  let isExternal = false;
  if (typeof to2 === "string" && ABSOLUTE_URL_REGEX.test(to2)) {
    absoluteHref = to2;
    if (isBrowser$4) {
      try {
        let currentUrl = new URL(window.location.href);
        let targetUrl = to2.startsWith("//") ? new URL(currentUrl.protocol + to2) : new URL(to2);
        let path = stripBasename(targetUrl.pathname, basename2);
        if (targetUrl.origin === currentUrl.origin && path != null) {
          to2 = path + targetUrl.search + targetUrl.hash;
        } else {
          isExternal = true;
        }
      } catch (e2) {
      }
    }
  }
  let href = useHref(to2, {
    relative
  });
  let internalOnClick = useLinkClickHandler(to2, {
    replace: replace2,
    state,
    target,
    preventScrollReset,
    relative,
    unstable_viewTransition
  });
  function handleClick(event) {
    if (onClick)
      onClick(event);
    if (!event.defaultPrevented) {
      internalOnClick(event);
    }
  }
  return (
    // eslint-disable-next-line jsx-a11y/anchor-has-content
    /* @__PURE__ */ reactExports.createElement("a", _extends$k({}, rest, {
      href: absoluteHref || href,
      onClick: isExternal || reloadDocument ? onClick : handleClick,
      ref,
      target
    }))
  );
});
var DataRouterHook;
(function(DataRouterHook2) {
  DataRouterHook2["UseScrollRestoration"] = "useScrollRestoration";
  DataRouterHook2["UseSubmit"] = "useSubmit";
  DataRouterHook2["UseSubmitFetcher"] = "useSubmitFetcher";
  DataRouterHook2["UseFetcher"] = "useFetcher";
  DataRouterHook2["useViewTransitionState"] = "useViewTransitionState";
})(DataRouterHook || (DataRouterHook = {}));
var DataRouterStateHook;
(function(DataRouterStateHook2) {
  DataRouterStateHook2["UseFetcher"] = "useFetcher";
  DataRouterStateHook2["UseFetchers"] = "useFetchers";
  DataRouterStateHook2["UseScrollRestoration"] = "useScrollRestoration";
})(DataRouterStateHook || (DataRouterStateHook = {}));
function useLinkClickHandler(to2, _temp) {
  let {
    target,
    replace: replaceProp,
    state,
    preventScrollReset,
    relative,
    unstable_viewTransition
  } = _temp === void 0 ? {} : _temp;
  let navigate = useNavigate();
  let location2 = useLocation();
  let path = useResolvedPath(to2, {
    relative
  });
  return reactExports.useCallback((event) => {
    if (shouldProcessLinkClick(event, target)) {
      event.preventDefault();
      let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location2) === createPath(path);
      navigate(to2, {
        replace: replace2,
        state,
        preventScrollReset,
        relative,
        unstable_viewTransition
      });
    }
  }, [location2, navigate, path, replaceProp, state, target, to2, preventScrollReset, relative, unstable_viewTransition]);
}
function useSearchParams(defaultInit) {
  let defaultSearchParamsRef = reactExports.useRef(createSearchParams(defaultInit));
  let hasSetSearchParamsRef = reactExports.useRef(false);
  let location2 = useLocation();
  let searchParams = reactExports.useMemo(() => (
    // Only merge in the defaults if we haven't yet called setSearchParams.
    // Once we call that we want those to take precedence, otherwise you can't
    // remove a param with setSearchParams({}) if it has an initial value
    getSearchParamsForLocation(location2.search, hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current)
  ), [location2.search]);
  let navigate = useNavigate();
  let setSearchParams = reactExports.useCallback((nextInit, navigateOptions) => {
    const newSearchParams = createSearchParams(typeof nextInit === "function" ? nextInit(searchParams) : nextInit);
    hasSetSearchParamsRef.current = true;
    navigate("?" + newSearchParams, navigateOptions);
  }, [navigate, searchParams]);
  return [searchParams, setSearchParams];
}
function createContext2(options = {}) {
  const {
    strict = true,
    errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
    name: name2
  } = options;
  const Context2 = reactExports.createContext(void 0);
  Context2.displayName = name2;
  function useContext2() {
    var _a2;
    const context = reactExports.useContext(Context2);
    if (!context && strict) {
      const error2 = new Error(errorMessage);
      error2.name = "ContextError";
      (_a2 = Error.captureStackTrace) == null ? void 0 : _a2.call(Error, error2, useContext2);
      throw error2;
    }
    return context;
  }
  return [Context2.Provider, useContext2, Context2];
}
function createDOMRef(ref) {
  return {
    UNSAFE_getDOMNode() {
      return ref.current;
    }
  };
}
function useDOMRef(ref) {
  const domRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, () => domRef.current);
  return domRef;
}
var getInertValue = (v2) => {
  return v2 ? "" : void 0;
};
function isArray$j(value2) {
  return Array.isArray(value2);
}
function isEmptyArray(value2) {
  return isArray$j(value2) && value2.length === 0;
}
function isObject$d(value2) {
  const type4 = typeof value2;
  return value2 != null && (type4 === "object" || type4 === "function") && !isArray$j(value2);
}
function isEmptyObject$1(value2) {
  return isObject$d(value2) && Object.keys(value2).length === 0;
}
function isEmpty(value2) {
  if (isArray$j(value2))
    return isEmptyArray(value2);
  if (isObject$d(value2))
    return isEmptyObject$1(value2);
  if (value2 == null || value2 === "")
    return true;
  return false;
}
function isFunction$9(value2) {
  return typeof value2 === "function";
}
var dataAttr = (condition) => condition ? "true" : void 0;
function toVal(mix2) {
  var k2, y2, str = "";
  if (typeof mix2 === "string" || typeof mix2 === "number") {
    str += mix2;
  } else if (typeof mix2 === "object") {
    if (Array.isArray(mix2)) {
      for (k2 = 0; k2 < mix2.length; k2++) {
        if (mix2[k2]) {
          if (y2 = toVal(mix2[k2])) {
            str && (str += " ");
            str += y2;
          }
        }
      }
    } else {
      for (k2 in mix2) {
        if (mix2[k2]) {
          str && (str += " ");
          str += k2;
        }
      }
    }
  }
  return str;
}
function clsx$5(...args) {
  var i2 = 0, tmp, x2, str = "";
  while (i2 < args.length) {
    if (tmp = args[i2++]) {
      if (x2 = toVal(tmp)) {
        str && (str += " ");
        str += x2;
      }
    }
  }
  return str;
}
var safeAriaLabel = (...texts) => {
  let ariaLabel = " ";
  for (const text2 of texts) {
    if (typeof text2 === "string" && text2.length > 0) {
      ariaLabel = text2;
      break;
    }
  }
  return ariaLabel;
};
var capitalize$2 = (s2) => {
  return s2 ? s2.charAt(0).toUpperCase() + s2.slice(1).toLowerCase() : "";
};
function callAllHandlers(...fns) {
  return function func(event) {
    fns.some((fn) => {
      fn == null ? void 0 : fn(event);
      return event == null ? void 0 : event.defaultPrevented;
    });
  };
}
function getUniqueID(prefix) {
  return `${prefix}-${Math.floor(Math.random() * 1e6)}`;
}
function removeEvents(input2) {
  for (const key in input2) {
    if (key.startsWith("on")) {
      delete input2[key];
    }
  }
  return input2;
}
function objectToDeps(obj) {
  if (!obj || typeof obj !== "object") {
    return "";
  }
  try {
    return JSON.stringify(obj);
  } catch {
    return "";
  }
}
function debounce$5(func, waitMilliseconds = 0) {
  let timeout;
  return function(...args) {
    const later = () => {
      timeout = void 0;
      func.apply(this, args);
    };
    if (timeout !== void 0) {
      clearTimeout(timeout);
    }
    timeout = setTimeout(later, waitMilliseconds);
  };
}
function range$1(start, end) {
  const length2 = end - start + 1;
  return Array.from({ length: length2 }, (_24, index2) => index2 + start);
}
function clamp$3(value2, min2, max2) {
  return Math.min(Math.max(value2, min2), max2);
}
function clampPercentage(value2, max2 = 100) {
  return Math.min(Math.max(value2, 0), max2);
}
var warningStack = {};
function warn$2(message, component, ...args) {
  const tag = component ? ` [${component}]` : " ";
  const log3 = `[Hero UI]${tag}: ${message}`;
  if (typeof console === "undefined")
    return;
  if (warningStack[log3])
    return;
  warningStack[log3] = true;
}
function getGregorianYearOffset(identifier2) {
  switch (identifier2) {
    case "buddhist":
      return 543;
    case "ethiopic":
    case "ethioaa":
      return -8;
    case "coptic":
      return -284;
    case "hebrew":
      return 3760;
    case "indian":
      return -78;
    case "islamic-civil":
    case "islamic-tbla":
    case "islamic-umalqura":
      return -579;
    case "persian":
      return -600;
    case "roc":
    case "japanese":
    case "gregory":
    default:
      return 0;
  }
}
function chain(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks) {
      if (typeof callback2 === "function") {
        callback2(...args);
      }
    }
  };
}
var idsUpdaterMap = /* @__PURE__ */ new Map();
function mergeIds(idA, idB) {
  if (idA === idB) {
    return idA;
  }
  let setIdsA = idsUpdaterMap.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = idsUpdaterMap.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function mergeProps$3(...args) {
  let result = { ...args[0] };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90) {
        result[key] = chain(a2, b2);
      } else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string") {
        result[key] = clsx$5(a2, b2);
      } else if (key === "id" && a2 && b2) {
        result.id = mergeIds(a2, b2);
      } else {
        result[key] = b2 !== void 0 ? b2 : a2;
      }
    }
  }
  return result;
}
function mergeRefs$1(...refs) {
  if (refs.length === 1 && refs[0]) {
    return refs[0];
  }
  return (value2) => {
    let hasCleanup = false;
    const cleanups = refs.map((ref) => {
      const cleanup2 = setRef$1(ref, value2);
      hasCleanup || (hasCleanup = typeof cleanup2 == "function");
      return cleanup2;
    });
    if (hasCleanup) {
      return () => {
        cleanups.forEach((cleanup2, i2) => {
          if (typeof cleanup2 === "function") {
            cleanup2 == null ? void 0 : cleanup2();
          } else {
            setRef$1(refs[i2], null);
          }
        });
      };
    }
  };
}
function setRef$1(ref, value2) {
  if (typeof ref === "function") {
    return () => ref(value2);
  } else if (ref != null) {
    if ("current" in ref) {
      ref.current = value2;
    }
  }
}
function assignRef(ref, value2) {
  if (ref == null)
    return;
  if (isFunction$9(ref)) {
    ref(value2);
    return;
  }
  try {
    ref.current = value2;
  } catch {
    throw new Error(`Cannot assign value '${value2}' to ref '${ref}'`);
  }
}
function mergeRefs(...refs) {
  return (node2) => {
    refs.forEach((ref) => assignRef(ref, node2));
  };
}
function useIsHydrated() {
  const subscribe2 = () => () => {
  };
  return reactExports.useSyncExternalStore(
    subscribe2,
    () => true,
    () => false
  );
}
var pickChildren = (children, targetChild) => {
  var _a2;
  let target = [];
  const withoutTargetChildren = (_a2 = reactExports.Children.map(children, (item) => {
    if (!reactExports.isValidElement(item))
      return item;
    if (item.type === targetChild) {
      target.push(item);
      return null;
    }
    return item;
  })) == null ? void 0 : _a2.filter(Boolean);
  const targetChildren = target.length >= 0 ? target : void 0;
  return [withoutTargetChildren, targetChildren];
};
var DOMPropNames = /* @__PURE__ */ new Set([
  "id",
  "type",
  "style",
  "title",
  "role",
  "tabIndex",
  "htmlFor",
  "width",
  "height",
  "abbr",
  "accept",
  "acceptCharset",
  "accessKey",
  "action",
  "allowFullScreen",
  "allowTransparency",
  "alt",
  "async",
  "autoComplete",
  "autoFocus",
  "autoPlay",
  "cellPadding",
  "cellSpacing",
  "challenge",
  "charset",
  "checked",
  "cite",
  "class",
  "className",
  "cols",
  "colSpan",
  "command",
  "content",
  "contentEditable",
  "contextMenu",
  "controls",
  "coords",
  "crossOrigin",
  "data",
  "dateTime",
  "default",
  "defer",
  "dir",
  "disabled",
  "download",
  "draggable",
  "dropzone",
  "encType",
  "enterKeyHint",
  "for",
  "form",
  "formAction",
  "formEncType",
  "formMethod",
  "formNoValidate",
  "formTarget",
  "frameBorder",
  "headers",
  "hidden",
  "high",
  "href",
  "hrefLang",
  "httpEquiv",
  "icon",
  "inputMode",
  "isMap",
  "itemId",
  "itemProp",
  "itemRef",
  "itemScope",
  "itemType",
  "kind",
  "label",
  "lang",
  "list",
  "loop",
  "manifest",
  "max",
  "maxLength",
  "media",
  "mediaGroup",
  "method",
  "min",
  "minLength",
  "multiple",
  "muted",
  "name",
  "noValidate",
  "open",
  "optimum",
  "pattern",
  "ping",
  "placeholder",
  "poster",
  "preload",
  "radioGroup",
  "referrerPolicy",
  "readOnly",
  "rel",
  "required",
  "rows",
  "rowSpan",
  "sandbox",
  "scope",
  "scoped",
  "scrolling",
  "seamless",
  "selected",
  "shape",
  "size",
  "sizes",
  "slot",
  "sortable",
  "span",
  "spellCheck",
  "src",
  "srcDoc",
  "srcSet",
  "start",
  "step",
  "target",
  "translate",
  "typeMustMatch",
  "useMap",
  "value",
  "wmode",
  "wrap"
]);
var DOMEventNames = /* @__PURE__ */ new Set([
  "onCopy",
  "onCut",
  "onPaste",
  "onLoad",
  "onError",
  "onWheel",
  "onScroll",
  "onCompositionEnd",
  "onCompositionStart",
  "onCompositionUpdate",
  "onKeyDown",
  "onKeyPress",
  "onKeyUp",
  "onFocus",
  "onBlur",
  "onChange",
  "onInput",
  "onSubmit",
  "onClick",
  "onContextMenu",
  "onDoubleClick",
  "onDrag",
  "onDragEnd",
  "onDragEnter",
  "onDragExit",
  "onDragLeave",
  "onDragOver",
  "onDragStart",
  "onDrop",
  "onMouseDown",
  "onMouseEnter",
  "onMouseLeave",
  "onMouseMove",
  "onMouseOut",
  "onMouseOver",
  "onMouseUp",
  "onPointerDown",
  "onPointerEnter",
  "onPointerLeave",
  "onPointerUp",
  "onSelect",
  "onTouchCancel",
  "onTouchEnd",
  "onTouchMove",
  "onTouchStart",
  "onAnimationStart",
  "onAnimationEnd",
  "onAnimationIteration",
  "onTransitionEnd"
]);
var propRe = /^(data-.*)$/;
var ariaRe = /^(aria-.*)$/;
var funcRe = /^(on[A-Z].*)$/;
function filterDOMProps(props, opts2 = {}) {
  let {
    labelable = true,
    enabled = true,
    propNames,
    omitPropNames,
    omitEventNames,
    omitDataProps,
    omitEventProps
  } = opts2;
  let filteredProps = {};
  if (!enabled) {
    return props;
  }
  for (const prop in props) {
    if (omitPropNames == null ? void 0 : omitPropNames.has(prop)) {
      continue;
    }
    if ((omitEventNames == null ? void 0 : omitEventNames.has(prop)) && funcRe.test(prop)) {
      continue;
    }
    if (funcRe.test(prop) && !DOMEventNames.has(prop)) {
      continue;
    }
    if (omitDataProps && propRe.test(prop)) {
      continue;
    }
    if (omitEventProps && funcRe.test(prop)) {
      continue;
    }
    if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || labelable && ariaRe.test(prop) || (propNames == null ? void 0 : propNames.has(prop)) || propRe.test(prop)) || funcRe.test(prop)) {
      filteredProps[prop] = props[prop];
    }
  }
  return filteredProps;
}
function renderFn({ Component: Component2, props, renderCustom }) {
  if (renderCustom && typeof renderCustom === "function") {
    return renderCustom(props);
  } else {
    return reactExports.createElement(Component2, props);
  }
}
var [ProviderContext, useProviderContext] = createContext2({
  name: "ProviderContext",
  strict: false
});
const $148a7a147e38ea7f$var$RTL_SCRIPTS$a = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$a = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$a(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$a.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$a.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$e = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$e = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$e);
const $b5e257d569688ac6$var$IsSSRContext$e = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$e = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$e(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$e);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$e.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$e.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$e.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$e(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$e);
  let counter = $b5e257d569688ac6$var$useCounter$e(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$e(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$e());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$e.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$e : $b5e257d569688ac6$var$useLegacySSRSafeId$e;
function $b5e257d569688ac6$var$getSnapshot$e() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$e() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$e(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$e() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$e, $b5e257d569688ac6$var$getSnapshot$e, $b5e257d569688ac6$var$getServerSnapshot$e);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$e);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$a = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$a] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$a(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$a = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a();
let $1e5a04cdaf7d1af8$var$listeners$a = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$a() {
  $1e5a04cdaf7d1af8$var$currentLocale$a = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$a();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$a)
    listener($1e5a04cdaf7d1af8$var$currentLocale$a);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$a() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$e();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$a);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$a.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$a);
    $1e5a04cdaf7d1af8$var$listeners$a.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$a.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$a.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$a);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$a = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {
  let { locale: locale2, children } = props;
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$a();
  let value2 = React$6.useMemo(() => {
    if (!locale2)
      return defaultLocale;
    return {
      locale: locale2,
      direction: $148a7a147e38ea7f$export$702d680b21cbd764$a(locale2) ? "rtl" : "ltr"
    };
  }, [
    defaultLocale,
    locale2
  ]);
  return /* @__PURE__ */ React$6.createElement($18f2051aff69b9bf$var$I18nContext$a.Provider, {
    value: value2
  }, children);
}
const $5b160d28a433310d$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
const $5b160d28a433310d$var$stringsSymbol = Symbol.for("react-aria.i18n.strings");
let $5b160d28a433310d$var$cachedGlobalStrings = void 0;
class $5b160d28a433310d$export$c17fa47878dc55b6 {
  /** Returns a localized string for the given key and locale. */
  getStringForLocale(key, locale2) {
    let strings = this.getStringsForLocale(locale2);
    let string3 = strings[key];
    if (!string3)
      throw new Error(`Could not find intl message ${key} in ${locale2} locale`);
    return string3;
  }
  /** Returns all localized strings for the given locale. */
  getStringsForLocale(locale2) {
    let strings = this.strings[locale2];
    if (!strings) {
      strings = $5b160d28a433310d$var$getStringsForLocale(locale2, this.strings, this.defaultLocale);
      this.strings[locale2] = strings;
    }
    return strings;
  }
  static getGlobalDictionaryForPackage(packageName) {
    if (typeof window === "undefined")
      return null;
    let locale2 = window[$5b160d28a433310d$var$localeSymbol];
    if ($5b160d28a433310d$var$cachedGlobalStrings === void 0) {
      let globalStrings = window[$5b160d28a433310d$var$stringsSymbol];
      if (!globalStrings)
        return null;
      $5b160d28a433310d$var$cachedGlobalStrings = {};
      for (let pkg in globalStrings)
        $5b160d28a433310d$var$cachedGlobalStrings[pkg] = new $5b160d28a433310d$export$c17fa47878dc55b6({
          [locale2]: globalStrings[pkg]
        }, locale2);
    }
    let dictionary = $5b160d28a433310d$var$cachedGlobalStrings === null || $5b160d28a433310d$var$cachedGlobalStrings === void 0 ? void 0 : $5b160d28a433310d$var$cachedGlobalStrings[packageName];
    if (!dictionary)
      throw new Error(`Strings for package "${packageName}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);
    return dictionary;
  }
  constructor(messages2, defaultLocale = "en-US") {
    this.strings = Object.fromEntries(Object.entries(messages2).filter(([, v2]) => v2));
    this.defaultLocale = defaultLocale;
  }
}
function $5b160d28a433310d$var$getStringsForLocale(locale2, strings, defaultLocale = "en-US") {
  if (strings[locale2])
    return strings[locale2];
  let language = $5b160d28a433310d$var$getLanguage(locale2);
  if (strings[language])
    return strings[language];
  for (let key in strings) {
    if (key.startsWith(language + "-"))
      return strings[key];
  }
  return strings[defaultLocale];
}
function $5b160d28a433310d$var$getLanguage(locale2) {
  if (Intl.Locale)
    return new Intl.Locale(locale2).language;
  return locale2.split("-")[0];
}
const $6db58dc88e78b024$var$pluralRulesCache = /* @__PURE__ */ new Map();
const $6db58dc88e78b024$var$numberFormatCache = /* @__PURE__ */ new Map();
class $6db58dc88e78b024$export$2f817fcdc4b89ae0 {
  /** Formats a localized string for the given key with the provided variables. */
  format(key, variables) {
    let message = this.strings.getStringForLocale(key, this.locale);
    return typeof message === "function" ? message(variables, this) : message;
  }
  plural(count, options, type4 = "cardinal") {
    let opt = options["=" + count];
    if (opt)
      return typeof opt === "function" ? opt() : opt;
    let key = this.locale + ":" + type4;
    let pluralRules = $6db58dc88e78b024$var$pluralRulesCache.get(key);
    if (!pluralRules) {
      pluralRules = new Intl.PluralRules(this.locale, {
        type: type4
      });
      $6db58dc88e78b024$var$pluralRulesCache.set(key, pluralRules);
    }
    let selected = pluralRules.select(count);
    opt = options[selected] || options.other;
    return typeof opt === "function" ? opt() : opt;
  }
  number(value2) {
    let numberFormat = $6db58dc88e78b024$var$numberFormatCache.get(this.locale);
    if (!numberFormat) {
      numberFormat = new Intl.NumberFormat(this.locale);
      $6db58dc88e78b024$var$numberFormatCache.set(this.locale, numberFormat);
    }
    return numberFormat.format(value2);
  }
  select(options, value2) {
    let opt = options[value2] || options.other;
    return typeof opt === "function" ? opt() : opt;
  }
  constructor(locale2, strings) {
    this.locale = locale2;
    this.strings = strings;
  }
}
function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
  return amount - numerator * Math.floor(amount / numerator);
}
const $3b62074eb05584b2$var$EPOCH = 1721426;
function $3b62074eb05584b2$export$f297eb839006d339(era, year, month, day) {
  year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year);
  let y1 = year - 1;
  let monthOffset = -2;
  if (month <= 2)
    monthOffset = 0;
  else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
    monthOffset = -1;
  return $3b62074eb05584b2$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $3b62074eb05584b2$export$553d7fa8e3805fc0(year) {
  return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $3b62074eb05584b2$export$c36e0ecb2d4fa69d(era, year) {
  return era === "BC" ? 1 - year : year;
}
function $3b62074eb05584b2$export$4475b7e617eb123c(year) {
  let era = "AD";
  if (year <= 0) {
    era = "BC";
    year = 1 - year;
  }
  return [
    era,
    year
  ];
}
const $3b62074eb05584b2$var$daysInMonth = {
  standard: [
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
  ],
  leapyear: [
    31,
    29,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
  ]
};
class $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let jd0 = jd2;
    let depoch = jd0 - $3b62074eb05584b2$var$EPOCH;
    let quadricent = Math.floor(depoch / 146097);
    let dqc = $2b4dce13dd5a17fa$export$842a2cf37af977e1(depoch, 146097);
    let cent = Math.floor(dqc / 36524);
    let dcent = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dqc, 36524);
    let quad = Math.floor(dcent / 1461);
    let dquad = $2b4dce13dd5a17fa$export$842a2cf37af977e1(dcent, 1461);
    let yindex = Math.floor(dquad / 365);
    let extendedYear = quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0);
    let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
    let yearDay = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, 1, 1);
    let leapAdj = 2;
    if (jd0 < $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 1))
      leapAdj = 0;
    else if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year))
      leapAdj = 1;
    let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
    let day = jd0 - $3b62074eb05584b2$export$f297eb839006d339(era, year, month, 1) + 1;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, month, day);
  }
  toJulianDay(date4) {
    return $3b62074eb05584b2$export$f297eb839006d339(date4.era, date4.year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    return $3b62074eb05584b2$var$daysInMonth[$3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? "leapyear" : "standard"][date4.month - 1];
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getMonthsInYear(date4) {
    return 12;
  }
  getDaysInYear(date4) {
    return $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? 366 : 365;
  }
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  getYearsInEra(date4) {
    return 9999;
  }
  getEras() {
    return [
      "BC",
      "AD"
    ];
  }
  isInverseEra(date4) {
    return date4.era === "BC";
  }
  balanceDate(date4) {
    if (date4.year <= 0) {
      date4.era = date4.era === "BC" ? "AD" : "BC";
      date4.year = 1 - date4.year;
    }
  }
  constructor() {
    this.identifier = "gregory";
  }
}
const $2fe286d2fb449abb$export$7a5acbd77d414bd9 = {
  "001": 1,
  AD: 1,
  AE: 6,
  AF: 6,
  AI: 1,
  AL: 1,
  AM: 1,
  AN: 1,
  AR: 1,
  AT: 1,
  AU: 1,
  AX: 1,
  AZ: 1,
  BA: 1,
  BE: 1,
  BG: 1,
  BH: 6,
  BM: 1,
  BN: 1,
  BY: 1,
  CH: 1,
  CL: 1,
  CM: 1,
  CN: 1,
  CR: 1,
  CY: 1,
  CZ: 1,
  DE: 1,
  DJ: 6,
  DK: 1,
  DZ: 6,
  EC: 1,
  EE: 1,
  EG: 6,
  ES: 1,
  FI: 1,
  FJ: 1,
  FO: 1,
  FR: 1,
  GB: 1,
  GE: 1,
  GF: 1,
  GP: 1,
  GR: 1,
  HR: 1,
  HU: 1,
  IE: 1,
  IQ: 6,
  IR: 6,
  IS: 1,
  IT: 1,
  JO: 6,
  KG: 1,
  KW: 6,
  KZ: 1,
  LB: 1,
  LI: 1,
  LK: 1,
  LT: 1,
  LU: 1,
  LV: 1,
  LY: 6,
  MC: 1,
  MD: 1,
  ME: 1,
  MK: 1,
  MN: 1,
  MQ: 1,
  MV: 5,
  MY: 1,
  NL: 1,
  NO: 1,
  NZ: 1,
  OM: 6,
  PL: 1,
  QA: 6,
  RE: 1,
  RO: 1,
  RS: 1,
  RU: 1,
  SD: 6,
  SE: 1,
  SI: 1,
  SK: 1,
  SM: 1,
  SY: 6,
  TJ: 1,
  TM: 1,
  TR: 1,
  UA: 1,
  UY: 1,
  UZ: 1,
  VA: 1,
  VN: 1,
  XK: 1
};
function $14e0f24ef4ac5c92$export$ea39ec197993aef0(a2, b2) {
  b2 = $11d87f3f76e88657$export$b4a036af3fc0b032(b2, a2.calendar);
  return a2.era === b2.era && a2.year === b2.year && a2.month === b2.month && a2.day === b2.day;
}
function $14e0f24ef4ac5c92$export$a18c89cbd24170ff(a2, b2) {
  b2 = $11d87f3f76e88657$export$b4a036af3fc0b032(b2, a2.calendar);
  a2 = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(a2);
  b2 = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(b2);
  return a2.era === b2.era && a2.year === b2.year && a2.month === b2.month;
}
function $14e0f24ef4ac5c92$export$91b62ebf2ba703ee(a2, b2) {
  return $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a2.calendar, b2.calendar) && $14e0f24ef4ac5c92$export$ea39ec197993aef0(a2, b2);
}
function $14e0f24ef4ac5c92$export$dbc69fd56b53d5e(a2, b2) {
  var _a_isEqual, _b_isEqual;
  var _a_isEqual1, _ref;
  return (_ref = (_a_isEqual1 = (_a_isEqual = a2.isEqual) === null || _a_isEqual === void 0 ? void 0 : _a_isEqual.call(a2, b2)) !== null && _a_isEqual1 !== void 0 ? _a_isEqual1 : (_b_isEqual = b2.isEqual) === null || _b_isEqual === void 0 ? void 0 : _b_isEqual.call(b2, a2)) !== null && _ref !== void 0 ? _ref : a2.identifier === b2.identifier;
}
function $14e0f24ef4ac5c92$export$629b0a497aa65267(date4, timeZone) {
  return $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone));
}
const $14e0f24ef4ac5c92$var$DAY_MAP = {
  sun: 0,
  mon: 1,
  tue: 2,
  wed: 3,
  thu: 4,
  fri: 5,
  sat: 6
};
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek) {
  let julian = date4.calendar.toJulianDay(date4);
  let weekStart = firstDayOfWeek ? $14e0f24ef4ac5c92$var$DAY_MAP[firstDayOfWeek] : $14e0f24ef4ac5c92$var$getWeekStart(locale2);
  let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
  if (dayOfWeek < 0)
    dayOfWeek += 7;
  return dayOfWeek;
}
function $14e0f24ef4ac5c92$export$461939dd4422153(timeZone) {
  return $11d87f3f76e88657$export$1b96692a1ba042ac(Date.now(), timeZone);
}
function $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone) {
  return $11d87f3f76e88657$export$93522d1a439f3617($14e0f24ef4ac5c92$export$461939dd4422153(timeZone));
}
function $14e0f24ef4ac5c92$export$68781ddf31c0090f(a2, b2) {
  return a2.calendar.toJulianDay(a2) - b2.calendar.toJulianDay(b2);
}
function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a2, b2) {
  return $14e0f24ef4ac5c92$var$timeToMs(a2) - $14e0f24ef4ac5c92$var$timeToMs(b2);
}
function $14e0f24ef4ac5c92$var$timeToMs(a2) {
  return a2.hour * 36e5 + a2.minute * 6e4 + a2.second * 1e3 + a2.millisecond;
}
let $14e0f24ef4ac5c92$var$localTimeZone = null;
function $14e0f24ef4ac5c92$export$aa8b41735afcabd2() {
  if ($14e0f24ef4ac5c92$var$localTimeZone == null)
    $14e0f24ef4ac5c92$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
  return $14e0f24ef4ac5c92$var$localTimeZone;
}
function $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4) {
  return date4.subtract({
    days: date4.day - 1
  });
}
function $14e0f24ef4ac5c92$export$a2258d9c4118825c(date4) {
  return date4.add({
    days: date4.calendar.getDaysInMonth(date4) - date4.day
  });
}
function $14e0f24ef4ac5c92$export$f91e89d3d0406102(date4) {
  return $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4.subtract({
    months: date4.month - 1
  }));
}
function $14e0f24ef4ac5c92$export$5412ac11713b72ad(date4) {
  if (date4.calendar.getMinimumMonthInYear)
    return date4.calendar.getMinimumMonthInYear(date4);
  return 1;
}
function $14e0f24ef4ac5c92$export$b2f4953d301981d5(date4) {
  if (date4.calendar.getMinimumDayInMonth)
    return date4.calendar.getMinimumDayInMonth(date4);
  return 1;
}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek) {
  let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek);
  return date4.subtract({
    days: dayOfWeek
  });
}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date4, locale2, firstDayOfWeek) {
  return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek).add({
    days: 6
  });
}
const $14e0f24ef4ac5c92$var$cachedRegions = /* @__PURE__ */ new Map();
function $14e0f24ef4ac5c92$var$getRegion(locale2) {
  if (Intl.Locale) {
    let region = $14e0f24ef4ac5c92$var$cachedRegions.get(locale2);
    if (!region) {
      region = new Intl.Locale(locale2).maximize().region;
      if (region)
        $14e0f24ef4ac5c92$var$cachedRegions.set(locale2, region);
    }
    return region;
  }
  let part = locale2.split("-")[1];
  return part === "u" ? void 0 : part;
}
function $14e0f24ef4ac5c92$var$getWeekStart(locale2) {
  let region = $14e0f24ef4ac5c92$var$getRegion(locale2);
  return region ? $2fe286d2fb449abb$export$7a5acbd77d414bd9[region] || 0 : 0;
}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date4, locale2, firstDayOfWeek) {
  let days2 = date4.calendar.getDaysInMonth(date4);
  return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4), locale2, firstDayOfWeek) + days2) / 7);
}
function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a2, b2) {
  if (a2 && b2)
    return a2.compare(b2) <= 0 ? a2 : b2;
  return a2 || b2;
}
function $14e0f24ef4ac5c92$export$a75f2bff57811055(a2, b2) {
  if (a2 && b2)
    return a2.compare(b2) >= 0 ? a2 : b2;
  return a2 || b2;
}
function $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) {
  date4 = $11d87f3f76e88657$export$b4a036af3fc0b032(date4, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date4.era, date4.year);
  return $11d87f3f76e88657$var$epochFromParts(year, date4.month, date4.day, date4.hour, date4.minute, date4.second, date4.millisecond);
}
function $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
  let date4 = /* @__PURE__ */ new Date();
  date4.setUTCHours(hour, minute, second, millisecond);
  date4.setUTCFullYear(year, month - 1, day);
  return date4.getTime();
}
function $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone) {
  if (timeZone === "UTC")
    return 0;
  if (ms > 0 && timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2())
    return new Date(ms).getTimezoneOffset() * -6e4;
  let { year, month, day, hour, minute, second } = $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone);
  let utc = $11d87f3f76e88657$var$epochFromParts(year, month, day, hour, minute, second, 0);
  return utc - Math.floor(ms / 1e3) * 1e3;
}
const $11d87f3f76e88657$var$formattersByTimeZone = /* @__PURE__ */ new Map();
function $11d87f3f76e88657$var$getTimeZoneParts(ms, timeZone) {
  let formatter = $11d87f3f76e88657$var$formattersByTimeZone.get(timeZone);
  if (!formatter) {
    formatter = new Intl.DateTimeFormat("en-US", {
      timeZone,
      hour12: false,
      era: "short",
      year: "numeric",
      month: "numeric",
      day: "numeric",
      hour: "numeric",
      minute: "numeric",
      second: "numeric"
    });
    $11d87f3f76e88657$var$formattersByTimeZone.set(timeZone, formatter);
  }
  let parts = formatter.formatToParts(new Date(ms));
  let namedParts = {};
  for (let part of parts)
    if (part.type !== "literal")
      namedParts[part.type] = part.value;
  return {
    // Firefox returns B instead of BC... https://bugzilla.mozilla.org/show_bug.cgi?id=1752253
    year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
    month: +namedParts.month,
    day: +namedParts.day,
    hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
    minute: +namedParts.minute,
    second: +namedParts.second
  };
}
const $11d87f3f76e88657$var$DAYMILLIS = 864e5;
function $11d87f3f76e88657$var$getValidWallTimes(date4, timeZone, earlier, later) {
  let found = earlier === later ? [
    earlier
  ] : [
    earlier,
    later
  ];
  return found.filter((absolute2) => $11d87f3f76e88657$var$isValidWallTime(date4, timeZone, absolute2));
}
function $11d87f3f76e88657$var$isValidWallTime(date4, timeZone, absolute2) {
  let parts = $11d87f3f76e88657$var$getTimeZoneParts(absolute2, timeZone);
  return date4.year === parts.year && date4.month === parts.month && date4.day === parts.day && date4.hour === parts.hour && date4.minute === parts.minute && date4.second === parts.second;
}
function $11d87f3f76e88657$export$5107c82f94518f5c(date4, timeZone, disambiguation = "compatible") {
  let dateTime = $11d87f3f76e88657$export$b21e0b124e224484(date4);
  if (timeZone === "UTC")
    return $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
  if (timeZone === $14e0f24ef4ac5c92$export$aa8b41735afcabd2() && disambiguation === "compatible") {
    dateTime = $11d87f3f76e88657$export$b4a036af3fc0b032(dateTime, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
    let date5 = /* @__PURE__ */ new Date();
    let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
    date5.setFullYear(year, dateTime.month - 1, dateTime.day);
    date5.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
    return date5.getTime();
  }
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime);
  let offsetBefore = $11d87f3f76e88657$export$59c99f3515d3493f(ms - $11d87f3f76e88657$var$DAYMILLIS, timeZone);
  let offsetAfter = $11d87f3f76e88657$export$59c99f3515d3493f(ms + $11d87f3f76e88657$var$DAYMILLIS, timeZone);
  let valid2 = $11d87f3f76e88657$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
  if (valid2.length === 1)
    return valid2[0];
  if (valid2.length > 1)
    switch (disambiguation) {
      case "compatible":
      case "earlier":
        return valid2[0];
      case "later":
        return valid2[valid2.length - 1];
      case "reject":
        throw new RangeError("Multiple possible absolute times found");
    }
  switch (disambiguation) {
    case "earlier":
      return Math.min(ms - offsetBefore, ms - offsetAfter);
    case "compatible":
    case "later":
      return Math.max(ms - offsetBefore, ms - offsetAfter);
    case "reject":
      throw new RangeError("No such absolute time found");
  }
}
function $11d87f3f76e88657$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
  return new Date($11d87f3f76e88657$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone) {
  let offset2 = $11d87f3f76e88657$export$59c99f3515d3493f(ms, timeZone);
  let date4 = new Date(ms + offset2);
  let year = date4.getUTCFullYear();
  let month = date4.getUTCMonth() + 1;
  let day = date4.getUTCDate();
  let hour = date4.getUTCHours();
  let minute = date4.getUTCMinutes();
  let second = date4.getUTCSeconds();
  let millisecond = date4.getUTCMilliseconds();
  return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset2, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$93522d1a439f3617(dateTime) {
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $11d87f3f76e88657$export$b21e0b124e224484(date4, time2) {
  let hour = 0, minute = 0, second = 0, millisecond = 0;
  if ("timeZone" in date4)
    ({ hour, minute, second, millisecond } = date4);
  else if ("hour" in date4 && !time2)
    return date4;
  if (time2)
    ({ hour, minute, second, millisecond } = time2);
  return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(date4.calendar, date4.era, date4.year, date4.month, date4.day, hour, minute, second, millisecond);
}
function $11d87f3f76e88657$export$d33f79e3ffc3dc83(dateTime) {
  return new $35ea8db9cb2ccb90$export$680ea196effce5f(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
}
function $11d87f3f76e88657$export$b4a036af3fc0b032(date4, calendar2) {
  if ($14e0f24ef4ac5c92$export$dbc69fd56b53d5e(date4.calendar, calendar2))
    return date4;
  let calendarDate = calendar2.fromJulianDay(date4.calendar.toJulianDay(date4));
  let copy2 = date4.copy();
  copy2.calendar = calendar2;
  copy2.era = calendarDate.era;
  copy2.year = calendarDate.year;
  copy2.month = calendarDate.month;
  copy2.day = calendarDate.day;
  $735220c2d4774dd3$export$c4e2ecac49351ef2(copy2);
  return copy2;
}
function $11d87f3f76e88657$export$84c95a83c799e074(date4, timeZone, disambiguation) {
  if (date4 instanceof $35ea8db9cb2ccb90$export$d3b7288e7994edea) {
    if (date4.timeZone === timeZone)
      return date4;
    return $11d87f3f76e88657$export$538b00033cc11c75(date4, timeZone);
  }
  let ms = $11d87f3f76e88657$export$5107c82f94518f5c(date4, timeZone, disambiguation);
  return $11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone);
}
function $11d87f3f76e88657$export$83aac07b4c37b25(date4) {
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) - date4.offset;
  return new Date(ms);
}
function $11d87f3f76e88657$export$538b00033cc11c75(date4, timeZone) {
  let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(date4) - date4.offset;
  return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, timeZone), date4.calendar);
}
const $735220c2d4774dd3$var$ONE_HOUR = 36e5;
function $735220c2d4774dd3$export$e16d8520af44a096(date4, duration2) {
  let mutableDate = date4.copy();
  let days2 = "hour" in mutableDate ? $735220c2d4774dd3$var$addTimeFields(mutableDate, duration2) : 0;
  $735220c2d4774dd3$var$addYears(mutableDate, duration2.years || 0);
  if (mutableDate.calendar.balanceYearMonth)
    mutableDate.calendar.balanceYearMonth(mutableDate, date4);
  mutableDate.month += duration2.months || 0;
  $735220c2d4774dd3$var$balanceYearMonth(mutableDate);
  $735220c2d4774dd3$var$constrainMonthDay(mutableDate);
  mutableDate.day += (duration2.weeks || 0) * 7;
  mutableDate.day += duration2.days || 0;
  mutableDate.day += days2;
  $735220c2d4774dd3$var$balanceDay(mutableDate);
  if (mutableDate.calendar.balanceDate)
    mutableDate.calendar.balanceDate(mutableDate);
  if (mutableDate.year < 1) {
    mutableDate.year = 1;
    mutableDate.month = 1;
    mutableDate.day = 1;
  }
  let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
  if (mutableDate.year > maxYear) {
    var _mutableDate_calendar_isInverseEra, _mutableDate_calendar;
    let isInverseEra = (_mutableDate_calendar_isInverseEra = (_mutableDate_calendar = mutableDate.calendar).isInverseEra) === null || _mutableDate_calendar_isInverseEra === void 0 ? void 0 : _mutableDate_calendar_isInverseEra.call(_mutableDate_calendar, mutableDate);
    mutableDate.year = maxYear;
    mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
    mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
  }
  if (mutableDate.month < 1) {
    mutableDate.month = 1;
    mutableDate.day = 1;
  }
  let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
  if (mutableDate.month > maxMonth) {
    mutableDate.month = maxMonth;
    mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
  }
  mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
  return mutableDate;
}
function $735220c2d4774dd3$var$addYears(date4, years2) {
  var _date_calendar_isInverseEra, _date_calendar;
  if ((_date_calendar_isInverseEra = (_date_calendar = date4.calendar).isInverseEra) === null || _date_calendar_isInverseEra === void 0 ? void 0 : _date_calendar_isInverseEra.call(_date_calendar, date4))
    years2 = -years2;
  date4.year += years2;
}
function $735220c2d4774dd3$var$balanceYearMonth(date4) {
  while (date4.month < 1) {
    $735220c2d4774dd3$var$addYears(date4, -1);
    date4.month += date4.calendar.getMonthsInYear(date4);
  }
  let monthsInYear = 0;
  while (date4.month > (monthsInYear = date4.calendar.getMonthsInYear(date4))) {
    date4.month -= monthsInYear;
    $735220c2d4774dd3$var$addYears(date4, 1);
  }
}
function $735220c2d4774dd3$var$balanceDay(date4) {
  while (date4.day < 1) {
    date4.month--;
    $735220c2d4774dd3$var$balanceYearMonth(date4);
    date4.day += date4.calendar.getDaysInMonth(date4);
  }
  while (date4.day > date4.calendar.getDaysInMonth(date4)) {
    date4.day -= date4.calendar.getDaysInMonth(date4);
    date4.month++;
    $735220c2d4774dd3$var$balanceYearMonth(date4);
  }
}
function $735220c2d4774dd3$var$constrainMonthDay(date4) {
  date4.month = Math.max(1, Math.min(date4.calendar.getMonthsInYear(date4), date4.month));
  date4.day = Math.max(1, Math.min(date4.calendar.getDaysInMonth(date4), date4.day));
}
function $735220c2d4774dd3$export$c4e2ecac49351ef2(date4) {
  if (date4.calendar.constrainDate)
    date4.calendar.constrainDate(date4);
  date4.year = Math.max(1, Math.min(date4.calendar.getYearsInEra(date4), date4.year));
  $735220c2d4774dd3$var$constrainMonthDay(date4);
}
function $735220c2d4774dd3$export$3e2544e88a25bff8(duration2) {
  let inverseDuration = {};
  for (let key in duration2)
    if (typeof duration2[key] === "number")
      inverseDuration[key] = -duration2[key];
  return inverseDuration;
}
function $735220c2d4774dd3$export$4e2d2ead65e5f7e3(date4, duration2) {
  return $735220c2d4774dd3$export$e16d8520af44a096(date4, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$adaa4cf7ef1b65be(date4, fields) {
  let mutableDate = date4.copy();
  if (fields.era != null)
    mutableDate.era = fields.era;
  if (fields.year != null)
    mutableDate.year = fields.year;
  if (fields.month != null)
    mutableDate.month = fields.month;
  if (fields.day != null)
    mutableDate.day = fields.day;
  $735220c2d4774dd3$export$c4e2ecac49351ef2(mutableDate);
  return mutableDate;
}
function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value2, fields) {
  let mutableValue = value2.copy();
  if (fields.hour != null)
    mutableValue.hour = fields.hour;
  if (fields.minute != null)
    mutableValue.minute = fields.minute;
  if (fields.second != null)
    mutableValue.second = fields.second;
  if (fields.millisecond != null)
    mutableValue.millisecond = fields.millisecond;
  $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
  return mutableValue;
}
function $735220c2d4774dd3$var$balanceTime(time2) {
  time2.second += Math.floor(time2.millisecond / 1e3);
  time2.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time2.millisecond, 1e3);
  time2.minute += Math.floor(time2.second / 60);
  time2.second = $735220c2d4774dd3$var$nonNegativeMod(time2.second, 60);
  time2.hour += Math.floor(time2.minute / 60);
  time2.minute = $735220c2d4774dd3$var$nonNegativeMod(time2.minute, 60);
  let days2 = Math.floor(time2.hour / 24);
  time2.hour = $735220c2d4774dd3$var$nonNegativeMod(time2.hour, 24);
  return days2;
}
function $735220c2d4774dd3$export$7555de1e070510cb(time2) {
  time2.millisecond = Math.max(0, Math.min(time2.millisecond, 1e3));
  time2.second = Math.max(0, Math.min(time2.second, 59));
  time2.minute = Math.max(0, Math.min(time2.minute, 59));
  time2.hour = Math.max(0, Math.min(time2.hour, 23));
}
function $735220c2d4774dd3$var$nonNegativeMod(a2, b2) {
  let result = a2 % b2;
  if (result < 0)
    result += b2;
  return result;
}
function $735220c2d4774dd3$var$addTimeFields(time2, duration2) {
  time2.hour += duration2.hours || 0;
  time2.minute += duration2.minutes || 0;
  time2.second += duration2.seconds || 0;
  time2.millisecond += duration2.milliseconds || 0;
  return $735220c2d4774dd3$var$balanceTime(time2);
}
function $735220c2d4774dd3$export$7ed87b6bc2506470(time2, duration2) {
  let res = time2.copy();
  $735220c2d4774dd3$var$addTimeFields(res, duration2);
  return res;
}
function $735220c2d4774dd3$export$fe34d3a381cd7501(time2, duration2) {
  return $735220c2d4774dd3$export$7ed87b6bc2506470(time2, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$d52ced6badfb9a4c(value2, field, amount, options) {
  let mutable = value2.copy();
  switch (field) {
    case "era": {
      let eras = value2.calendar.getEras();
      let eraIndex = eras.indexOf(value2.era);
      if (eraIndex < 0)
        throw new Error("Invalid era: " + value2.era);
      eraIndex = $735220c2d4774dd3$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options === null || options === void 0 ? void 0 : options.round);
      mutable.era = eras[eraIndex];
      $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
      break;
    }
    case "year":
      var _mutable_calendar_isInverseEra, _mutable_calendar;
      if ((_mutable_calendar_isInverseEra = (_mutable_calendar = mutable.calendar).isInverseEra) === null || _mutable_calendar_isInverseEra === void 0 ? void 0 : _mutable_calendar_isInverseEra.call(_mutable_calendar, mutable))
        amount = -amount;
      mutable.year = $735220c2d4774dd3$var$cycleValue(value2.year, amount, -Infinity, 9999, options === null || options === void 0 ? void 0 : options.round);
      if (mutable.year === -Infinity)
        mutable.year = 1;
      if (mutable.calendar.balanceYearMonth)
        mutable.calendar.balanceYearMonth(mutable, value2);
      break;
    case "month":
      mutable.month = $735220c2d4774dd3$var$cycleValue(value2.month, amount, 1, value2.calendar.getMonthsInYear(value2), options === null || options === void 0 ? void 0 : options.round);
      break;
    case "day":
      mutable.day = $735220c2d4774dd3$var$cycleValue(value2.day, amount, 1, value2.calendar.getDaysInMonth(value2), options === null || options === void 0 ? void 0 : options.round);
      break;
    default:
      throw new Error("Unsupported field " + field);
  }
  if (value2.calendar.balanceDate)
    value2.calendar.balanceDate(mutable);
  $735220c2d4774dd3$export$c4e2ecac49351ef2(mutable);
  return mutable;
}
function $735220c2d4774dd3$export$dd02b3e0007dfe28(value2, field, amount, options) {
  let mutable = value2.copy();
  switch (field) {
    case "hour": {
      let hours2 = value2.hour;
      let min2 = 0;
      let max2 = 23;
      if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
        let isPM = hours2 >= 12;
        min2 = isPM ? 12 : 0;
        max2 = isPM ? 23 : 11;
      }
      mutable.hour = $735220c2d4774dd3$var$cycleValue(hours2, amount, min2, max2, options === null || options === void 0 ? void 0 : options.round);
      break;
    }
    case "minute":
      mutable.minute = $735220c2d4774dd3$var$cycleValue(value2.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
      break;
    case "second":
      mutable.second = $735220c2d4774dd3$var$cycleValue(value2.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
      break;
    case "millisecond":
      mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value2.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
      break;
    default:
      throw new Error("Unsupported field " + field);
  }
  return mutable;
}
function $735220c2d4774dd3$var$cycleValue(value2, amount, min2, max2, round2 = false) {
  if (round2) {
    value2 += Math.sign(amount);
    if (value2 < min2)
      value2 = max2;
    let div = Math.abs(amount);
    if (amount > 0)
      value2 = Math.ceil(value2 / div) * div;
    else
      value2 = Math.floor(value2 / div) * div;
    if (value2 > max2)
      value2 = min2;
  } else {
    value2 += amount;
    if (value2 < min2)
      value2 = max2 - (min2 - value2 - 1);
    else if (value2 > max2)
      value2 = min2 + (value2 - max2 - 1);
  }
  return value2;
}
function $735220c2d4774dd3$export$96b1d28349274637(dateTime, duration2) {
  let ms;
  if (duration2.years != null && duration2.years !== 0 || duration2.months != null && duration2.months !== 0 || duration2.weeks != null && duration2.weeks !== 0 || duration2.days != null && duration2.days !== 0) {
    let res2 = $735220c2d4774dd3$export$e16d8520af44a096($11d87f3f76e88657$export$b21e0b124e224484(dateTime), {
      years: duration2.years,
      months: duration2.months,
      weeks: duration2.weeks,
      days: duration2.days
    });
    ms = $11d87f3f76e88657$export$5107c82f94518f5c(res2, dateTime.timeZone);
  } else
    ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
  ms += duration2.milliseconds || 0;
  ms += (duration2.seconds || 0) * 1e3;
  ms += (duration2.minutes || 0) * 6e4;
  ms += (duration2.hours || 0) * 36e5;
  let res = $11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone);
  return $11d87f3f76e88657$export$b4a036af3fc0b032(res, dateTime.calendar);
}
function $735220c2d4774dd3$export$6814caac34ca03c7(dateTime, duration2) {
  return $735220c2d4774dd3$export$96b1d28349274637(dateTime, $735220c2d4774dd3$export$3e2544e88a25bff8(duration2));
}
function $735220c2d4774dd3$export$9a297d111fc86b79(dateTime, field, amount, options) {
  switch (field) {
    case "hour": {
      let min2 = 0;
      let max2 = 23;
      if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
        let isPM = dateTime.hour >= 12;
        min2 = isPM ? 12 : 0;
        max2 = isPM ? 23 : 11;
      }
      let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
      let minDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
        hour: min2
      }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      let minAbsolute = [
        $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "earlier"),
        $11d87f3f76e88657$export$5107c82f94518f5c(minDate, dateTime.timeZone, "later")
      ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === minDate.day)[0];
      let maxDate = $11d87f3f76e88657$export$b4a036af3fc0b032($735220c2d4774dd3$export$e5d5e1c1822b6e56(plainDateTime, {
        hour: max2
      }), new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      let maxAbsolute = [
        $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "earlier"),
        $11d87f3f76e88657$export$5107c82f94518f5c(maxDate, dateTime.timeZone, "later")
      ].filter((ms2) => $11d87f3f76e88657$export$1b96692a1ba042ac(ms2, dateTime.timeZone).day === maxDate.day).pop();
      let ms = $11d87f3f76e88657$export$bd4fb2bc8bb06fb(dateTime) - dateTime.offset;
      let hours2 = Math.floor(ms / $735220c2d4774dd3$var$ONE_HOUR);
      let remainder = ms % $735220c2d4774dd3$var$ONE_HOUR;
      ms = $735220c2d4774dd3$var$cycleValue(hours2, amount, Math.floor(minAbsolute / $735220c2d4774dd3$var$ONE_HOUR), Math.floor(maxAbsolute / $735220c2d4774dd3$var$ONE_HOUR), options === null || options === void 0 ? void 0 : options.round) * $735220c2d4774dd3$var$ONE_HOUR + remainder;
      return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
    }
    case "minute":
    case "second":
    case "millisecond":
      return $735220c2d4774dd3$export$dd02b3e0007dfe28(dateTime, field, amount, options);
    case "era":
    case "year":
    case "month":
    case "day": {
      let res = $735220c2d4774dd3$export$d52ced6badfb9a4c($11d87f3f76e88657$export$b21e0b124e224484(dateTime), field, amount, options);
      let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone);
      return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
    }
    default:
      throw new Error("Unsupported field " + field);
  }
}
function $735220c2d4774dd3$export$31b5430eb18be4f8(dateTime, fields, disambiguation) {
  let plainDateTime = $11d87f3f76e88657$export$b21e0b124e224484(dateTime);
  let res = $735220c2d4774dd3$export$e5d5e1c1822b6e56($735220c2d4774dd3$export$adaa4cf7ef1b65be(plainDateTime, fields), fields);
  if (res.compare(plainDateTime) === 0)
    return dateTime;
  let ms = $11d87f3f76e88657$export$5107c82f94518f5c(res, dateTime.timeZone, disambiguation);
  return $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$1b96692a1ba042ac(ms, dateTime.timeZone), dateTime.calendar);
}
function $fae977aafc393c5c$export$f59dee82248f5ad4(time2) {
  return `${String(time2.hour).padStart(2, "0")}:${String(time2.minute).padStart(2, "0")}:${String(time2.second).padStart(2, "0")}${time2.millisecond ? String(time2.millisecond / 1e3).slice(1) : ""}`;
}
function $fae977aafc393c5c$export$60dfd74aa96791bd(date4) {
  let gregorianDate = $11d87f3f76e88657$export$b4a036af3fc0b032(date4, new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  let year;
  if (gregorianDate.era === "BC")
    year = gregorianDate.year === 1 ? "0000" : "-" + String(Math.abs(1 - gregorianDate.year)).padStart(6, "00");
  else
    year = String(gregorianDate.year).padStart(4, "0");
  return `${year}-${String(gregorianDate.month).padStart(2, "0")}-${String(gregorianDate.day).padStart(2, "0")}`;
}
function $fae977aafc393c5c$export$4223de14708adc63(date4) {
  return `${$fae977aafc393c5c$export$60dfd74aa96791bd(date4)}T${$fae977aafc393c5c$export$f59dee82248f5ad4(date4)}`;
}
function $fae977aafc393c5c$var$offsetToString(offset2) {
  let sign2 = Math.sign(offset2) < 0 ? "-" : "+";
  offset2 = Math.abs(offset2);
  let offsetHours = Math.floor(offset2 / 36e5);
  let offsetMinutes = offset2 % 36e5 / 6e4;
  return `${sign2}${String(offsetHours).padStart(2, "0")}:${String(offsetMinutes).padStart(2, "0")}`;
}
function $fae977aafc393c5c$export$bf79f1ebf4b18792(date4) {
  return `${$fae977aafc393c5c$export$4223de14708adc63(date4)}${$fae977aafc393c5c$var$offsetToString(date4.offset)}[${date4.timeZone}]`;
}
function _check_private_redeclaration(obj, privateCollection) {
  if (privateCollection.has(obj)) {
    throw new TypeError("Cannot initialize the same private elements twice on an object");
  }
}
function _class_private_field_init(obj, privateMap, value2) {
  _check_private_redeclaration(obj, privateMap);
  privateMap.set(obj, value2);
}
function $35ea8db9cb2ccb90$var$shiftArgs(args) {
  let calendar2 = typeof args[0] === "object" ? args.shift() : new $3b62074eb05584b2$export$80ee6245ec4f29ec();
  let era;
  if (typeof args[0] === "string")
    era = args.shift();
  else {
    let eras = calendar2.getEras();
    era = eras[eras.length - 1];
  }
  let year = args.shift();
  let month = args.shift();
  let day = args.shift();
  return [
    calendar2,
    era,
    year,
    month,
    day
  ];
}
var $35ea8db9cb2ccb90$var$_type = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$99faa760c7908e4f {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.era, this.year, this.month, this.day);
    else
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this.calendar, this.year, this.month, this.day);
  }
  /** Returns a new `CalendarDate` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$e16d8520af44a096(this, duration2);
  }
  /** Returns a new `CalendarDate` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration2);
  }
  /** Returns a new `CalendarDate` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$adaa4cf7ef1b65be(this, fields);
  }
  /**
  * Returns a new `CalendarDate` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
  }
  /** Converts the date to a native JavaScript Date object, with the time set to midnight in the given time zone. */
  toDate(timeZone) {
    return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone);
  }
  /** Converts the date to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$60dfd74aa96791bd(this);
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    return $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b2);
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
var $35ea8db9cb2ccb90$var$_type1 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$680ea196effce5f {
  /** Returns a copy of this time. */
  copy() {
    return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `Time` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$7ed87b6bc2506470(this, duration2);
  }
  /** Returns a new `Time` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$fe34d3a381cd7501(this, duration2);
  }
  /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields);
  }
  /**
  * Returns a new `Time` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
  }
  /** Converts the time to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$f59dee82248f5ad4(this);
  }
  /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */
  compare(b2) {
    return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, b2);
  }
  constructor(hour = 0, minute = 0, second = 0, millisecond = 0) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type1, {
      writable: true,
      value: void 0
    });
    this.hour = hour;
    this.minute = minute;
    this.second = second;
    this.millisecond = millisecond;
    $735220c2d4774dd3$export$7555de1e070510cb(this);
  }
}
var $35ea8db9cb2ccb90$var$_type2 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$ca871e8dbb80966f {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.era, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
    else
      return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(this.calendar, this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `CalendarDateTime` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$e16d8520af44a096(this, duration2);
  }
  /** Returns a new `CalendarDateTime` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$4e2d2ead65e5f7e3(this, duration2);
  }
  /** Returns a new `CalendarDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields) {
    return $735220c2d4774dd3$export$adaa4cf7ef1b65be($735220c2d4774dd3$export$e5d5e1c1822b6e56(this, fields), fields);
  }
  /**
  * Returns a new `CalendarDateTime` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    switch (field) {
      case "era":
      case "year":
      case "month":
      case "day":
        return $735220c2d4774dd3$export$d52ced6badfb9a4c(this, field, amount, options);
      default:
        return $735220c2d4774dd3$export$dd02b3e0007dfe28(this, field, amount, options);
    }
  }
  /** Converts the date to a native JavaScript Date object in the given time zone. */
  toDate(timeZone, disambiguation) {
    return $11d87f3f76e88657$export$e67a095c620b86fe(this, timeZone, disambiguation);
  }
  /** Converts the date to an ISO 8601 formatted string. */
  toString() {
    return $fae977aafc393c5c$export$4223de14708adc63(this);
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    let res = $14e0f24ef4ac5c92$export$68781ddf31c0090f(this, b2);
    if (res === 0)
      return $14e0f24ef4ac5c92$export$c19a80a9721b80f6(this, $11d87f3f76e88657$export$b21e0b124e224484(b2));
    return res;
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type2, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    this.hour = args.shift() || 0;
    this.minute = args.shift() || 0;
    this.second = args.shift() || 0;
    this.millisecond = args.shift() || 0;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
var $35ea8db9cb2ccb90$var$_type3 = /* @__PURE__ */ new WeakMap();
class $35ea8db9cb2ccb90$export$d3b7288e7994edea {
  /** Returns a copy of this date. */
  copy() {
    if (this.era)
      return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.era, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
    else
      return new $35ea8db9cb2ccb90$export$d3b7288e7994edea(this.calendar, this.year, this.month, this.day, this.timeZone, this.offset, this.hour, this.minute, this.second, this.millisecond);
  }
  /** Returns a new `ZonedDateTime` with the given duration added to it. */
  add(duration2) {
    return $735220c2d4774dd3$export$96b1d28349274637(this, duration2);
  }
  /** Returns a new `ZonedDateTime` with the given duration subtracted from it. */
  subtract(duration2) {
    return $735220c2d4774dd3$export$6814caac34ca03c7(this, duration2);
  }
  /** Returns a new `ZonedDateTime` with the given fields set to the provided values. Other fields will be constrained accordingly. */
  set(fields, disambiguation) {
    return $735220c2d4774dd3$export$31b5430eb18be4f8(this, fields, disambiguation);
  }
  /**
  * Returns a new `ZonedDateTime` with the given field adjusted by a specified amount.
  * When the resulting value reaches the limits of the field, it wraps around.
  */
  cycle(field, amount, options) {
    return $735220c2d4774dd3$export$9a297d111fc86b79(this, field, amount, options);
  }
  /** Converts the date to a native JavaScript Date object. */
  toDate() {
    return $11d87f3f76e88657$export$83aac07b4c37b25(this);
  }
  /** Converts the date to an ISO 8601 formatted string, including the UTC offset and time zone identifier. */
  toString() {
    return $fae977aafc393c5c$export$bf79f1ebf4b18792(this);
  }
  /** Converts the date to an ISO 8601 formatted string in UTC. */
  toAbsoluteString() {
    return this.toDate().toISOString();
  }
  /** Compares this date with another. A negative result indicates that this date is before the given one, and a positive date indicates that it is after. */
  compare(b2) {
    return this.toDate().getTime() - $11d87f3f76e88657$export$84c95a83c799e074(b2, this.timeZone).toDate().getTime();
  }
  constructor(...args) {
    _class_private_field_init(this, $35ea8db9cb2ccb90$var$_type3, {
      writable: true,
      value: void 0
    });
    let [calendar2, era, year, month, day] = $35ea8db9cb2ccb90$var$shiftArgs(args);
    let timeZone = args.shift();
    let offset2 = args.shift();
    this.calendar = calendar2;
    this.era = era;
    this.year = year;
    this.month = month;
    this.day = day;
    this.timeZone = timeZone;
    this.offset = offset2;
    this.hour = args.shift() || 0;
    this.minute = args.shift() || 0;
    this.second = args.shift() || 0;
    this.millisecond = args.shift() || 0;
    $735220c2d4774dd3$export$c4e2ecac49351ef2(this);
  }
}
const $62225008020f0a13$var$ERA_START_DATES = [
  [
    1868,
    9,
    8
  ],
  [
    1912,
    7,
    30
  ],
  [
    1926,
    12,
    25
  ],
  [
    1989,
    1,
    8
  ],
  [
    2019,
    5,
    1
  ]
];
const $62225008020f0a13$var$ERA_END_DATES = [
  [
    1912,
    7,
    29
  ],
  [
    1926,
    12,
    24
  ],
  [
    1989,
    1,
    7
  ],
  [
    2019,
    4,
    30
  ]
];
const $62225008020f0a13$var$ERA_ADDENDS = [
  1867,
  1911,
  1925,
  1988,
  2018
];
const $62225008020f0a13$var$ERA_NAMES = [
  "meiji",
  "taisho",
  "showa",
  "heisei",
  "reiwa"
];
function $62225008020f0a13$var$findEraFromGregorianDate(date4) {
  const idx = $62225008020f0a13$var$ERA_START_DATES.findIndex(([year, month, day]) => {
    if (date4.year < year)
      return true;
    if (date4.year === year && date4.month < month)
      return true;
    if (date4.year === year && date4.month === month && date4.day < day)
      return true;
    return false;
  });
  if (idx === -1)
    return $62225008020f0a13$var$ERA_START_DATES.length - 1;
  if (idx === 0)
    return 0;
  return idx - 1;
}
function $62225008020f0a13$var$toGregorian(date4) {
  let eraAddend = $62225008020f0a13$var$ERA_ADDENDS[$62225008020f0a13$var$ERA_NAMES.indexOf(date4.era)];
  if (!eraAddend)
    throw new Error("Unknown era: " + date4.era);
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(date4.year + eraAddend, date4.month, date4.day);
}
class $62225008020f0a13$export$b746ab2b60cdffbf extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let era = $62225008020f0a13$var$findEraFromGregorianDate(date4);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, $62225008020f0a13$var$ERA_NAMES[era], date4.year - $62225008020f0a13$var$ERA_ADDENDS[era], date4.month, date4.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($62225008020f0a13$var$toGregorian(date4));
  }
  balanceDate(date4) {
    let gregorianDate = $62225008020f0a13$var$toGregorian(date4);
    let era = $62225008020f0a13$var$findEraFromGregorianDate(gregorianDate);
    if ($62225008020f0a13$var$ERA_NAMES[era] !== date4.era) {
      date4.era = $62225008020f0a13$var$ERA_NAMES[era];
      date4.year = gregorianDate.year - $62225008020f0a13$var$ERA_ADDENDS[era];
    }
    this.constrainDate(date4);
  }
  constrainDate(date4) {
    let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    let end = $62225008020f0a13$var$ERA_END_DATES[idx];
    if (end != null) {
      let [endYear, endMonth, endDay] = end;
      let maxYear = endYear - $62225008020f0a13$var$ERA_ADDENDS[idx];
      date4.year = Math.max(1, Math.min(maxYear, date4.year));
      if (date4.year === maxYear) {
        date4.month = Math.min(endMonth, date4.month);
        if (date4.month === endMonth)
          date4.day = Math.min(endDay, date4.day);
      }
    }
    if (date4.year === 1 && idx >= 0) {
      let [, startMonth, startDay] = $62225008020f0a13$var$ERA_START_DATES[idx];
      date4.month = Math.max(startMonth, date4.month);
      if (date4.month === startMonth)
        date4.day = Math.max(startDay, date4.day);
    }
  }
  getEras() {
    return $62225008020f0a13$var$ERA_NAMES;
  }
  getYearsInEra(date4) {
    let era = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    let cur = $62225008020f0a13$var$ERA_START_DATES[era];
    let next2 = $62225008020f0a13$var$ERA_START_DATES[era + 1];
    if (next2 == null)
      return 9999 - cur[0] + 1;
    let years2 = next2[0] - cur[0];
    if (date4.month < next2[1] || date4.month === next2[1] && date4.day < next2[2])
      years2++;
    return years2;
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($62225008020f0a13$var$toGregorian(date4));
  }
  getMinimumMonthInYear(date4) {
    let start = $62225008020f0a13$var$getMinimums(date4);
    return start ? start[1] : 1;
  }
  getMinimumDayInMonth(date4) {
    let start = $62225008020f0a13$var$getMinimums(date4);
    return start && date4.month === start[1] ? start[2] : 1;
  }
  constructor(...args) {
    super(...args), this.identifier = "japanese";
  }
}
function $62225008020f0a13$var$getMinimums(date4) {
  if (date4.year === 1) {
    let idx = $62225008020f0a13$var$ERA_NAMES.indexOf(date4.era);
    return $62225008020f0a13$var$ERA_START_DATES[idx];
  }
}
const $8d73d47422ca7302$var$BUDDHIST_ERA_START = -543;
class $8d73d47422ca7302$export$42d20a78301dee44 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let gregorianDate = super.fromJulianDay(jd2);
    let year = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(gregorianDate.era, gregorianDate.year);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year - $8d73d47422ca7302$var$BUDDHIST_ERA_START, gregorianDate.month, gregorianDate.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($8d73d47422ca7302$var$toGregorian(date4));
  }
  getEras() {
    return [
      "BE"
    ];
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($8d73d47422ca7302$var$toGregorian(date4));
  }
  balanceDate() {
  }
  constructor(...args) {
    super(...args), this.identifier = "buddhist";
  }
}
function $8d73d47422ca7302$var$toGregorian(date4) {
  let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(date4.year + $8d73d47422ca7302$var$BUDDHIST_ERA_START);
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date4.month, date4.day);
}
const $5f31bd6f0c8940b2$var$TAIWAN_ERA_START = 1911;
function $5f31bd6f0c8940b2$var$gregorianYear(date4) {
  return date4.era === "minguo" ? date4.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START : 1 - date4.year + $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
}
function $5f31bd6f0c8940b2$var$gregorianToTaiwan(year) {
  let y2 = year - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
  if (y2 > 0)
    return [
      "minguo",
      y2
    ];
  else
    return [
      "before_minguo",
      1 - y2
    ];
}
class $5f31bd6f0c8940b2$export$65e01080afcb0799 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let extendedYear = $3b62074eb05584b2$export$c36e0ecb2d4fa69d(date4.era, date4.year);
    let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan(extendedYear);
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, date4.month, date4.day);
  }
  toJulianDay(date4) {
    return super.toJulianDay($5f31bd6f0c8940b2$var$toGregorian(date4));
  }
  getEras() {
    return [
      "before_minguo",
      "minguo"
    ];
  }
  balanceDate(date4) {
    let [era, year] = $5f31bd6f0c8940b2$var$gregorianToTaiwan($5f31bd6f0c8940b2$var$gregorianYear(date4));
    date4.era = era;
    date4.year = year;
  }
  isInverseEra(date4) {
    return date4.era === "before_minguo";
  }
  getDaysInMonth(date4) {
    return super.getDaysInMonth($5f31bd6f0c8940b2$var$toGregorian(date4));
  }
  getYearsInEra(date4) {
    return date4.era === "before_minguo" ? 9999 : 9999 - $5f31bd6f0c8940b2$var$TAIWAN_ERA_START;
  }
  constructor(...args) {
    super(...args), this.identifier = "roc";
  }
}
function $5f31bd6f0c8940b2$var$toGregorian(date4) {
  let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c($5f31bd6f0c8940b2$var$gregorianYear(date4));
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(era, year, date4.month, date4.day);
}
const $f3ed2e4472ae7e25$var$PERSIAN_EPOCH = 1948320;
const $f3ed2e4472ae7e25$var$MONTH_START = [
  0,
  31,
  62,
  93,
  124,
  155,
  186,
  216,
  246,
  276,
  306,
  336
  // Esfand
];
class $f3ed2e4472ae7e25$export$37fccdbfd14c5939 {
  fromJulianDay(jd2) {
    let daysSinceEpoch = jd2 - $f3ed2e4472ae7e25$var$PERSIAN_EPOCH;
    let year = 1 + Math.floor((33 * daysSinceEpoch + 3) / 12053);
    let farvardin1 = 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
    let dayOfYear = daysSinceEpoch - farvardin1;
    let month = dayOfYear < 216 ? Math.floor(dayOfYear / 31) : Math.floor((dayOfYear - 6) / 30);
    let day = dayOfYear - $f3ed2e4472ae7e25$var$MONTH_START[month] + 1;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month + 1, day);
  }
  toJulianDay(date4) {
    let jd2 = $f3ed2e4472ae7e25$var$PERSIAN_EPOCH - 1 + 365 * (date4.year - 1) + Math.floor((8 * date4.year + 21) / 33);
    jd2 += $f3ed2e4472ae7e25$var$MONTH_START[date4.month - 1];
    jd2 += date4.day;
    return jd2;
  }
  getMonthsInYear() {
    return 12;
  }
  getDaysInMonth(date4) {
    if (date4.month <= 6)
      return 31;
    if (date4.month <= 11)
      return 30;
    let isLeapYear2 = $2b4dce13dd5a17fa$export$842a2cf37af977e1(25 * date4.year + 11, 33) < 8;
    return isLeapYear2 ? 30 : 29;
  }
  getEras() {
    return [
      "AP"
    ];
  }
  getYearsInEra() {
    return 9377;
  }
  constructor() {
    this.identifier = "persian";
  }
}
const $82c358003bdda0a8$var$INDIAN_ERA_START = 78;
const $82c358003bdda0a8$var$INDIAN_YEAR_START = 80;
class $82c358003bdda0a8$export$39f31c639fa15726 extends $3b62074eb05584b2$export$80ee6245ec4f29ec {
  fromJulianDay(jd2) {
    let date4 = super.fromJulianDay(jd2);
    let indianYear = date4.year - $82c358003bdda0a8$var$INDIAN_ERA_START;
    let yDay = jd2 - $3b62074eb05584b2$export$f297eb839006d339(date4.era, date4.year, 1, 1);
    let leapMonth;
    if (yDay < $82c358003bdda0a8$var$INDIAN_YEAR_START) {
      indianYear--;
      leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year - 1) ? 31 : 30;
      yDay += leapMonth + 155 + 90 + 10;
    } else {
      leapMonth = $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year) ? 31 : 30;
      yDay -= $82c358003bdda0a8$var$INDIAN_YEAR_START;
    }
    let indianMonth;
    let indianDay;
    if (yDay < leapMonth) {
      indianMonth = 1;
      indianDay = yDay + 1;
    } else {
      let mDay = yDay - leapMonth;
      if (mDay < 155) {
        indianMonth = Math.floor(mDay / 31) + 2;
        indianDay = mDay % 31 + 1;
      } else {
        mDay -= 155;
        indianMonth = Math.floor(mDay / 30) + 7;
        indianDay = mDay % 30 + 1;
      }
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, indianYear, indianMonth, indianDay);
  }
  toJulianDay(date4) {
    let extendedYear = date4.year + $82c358003bdda0a8$var$INDIAN_ERA_START;
    let [era, year] = $3b62074eb05584b2$export$4475b7e617eb123c(extendedYear);
    let leapMonth;
    let jd2;
    if ($3b62074eb05584b2$export$553d7fa8e3805fc0(year)) {
      leapMonth = 31;
      jd2 = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 21);
    } else {
      leapMonth = 30;
      jd2 = $3b62074eb05584b2$export$f297eb839006d339(era, year, 3, 22);
    }
    if (date4.month === 1)
      return jd2 + date4.day - 1;
    jd2 += leapMonth + Math.min(date4.month - 2, 5) * 31;
    if (date4.month >= 8)
      jd2 += (date4.month - 7) * 30;
    jd2 += date4.day - 1;
    return jd2;
  }
  getDaysInMonth(date4) {
    if (date4.month === 1 && $3b62074eb05584b2$export$553d7fa8e3805fc0(date4.year + $82c358003bdda0a8$var$INDIAN_ERA_START))
      return 31;
    if (date4.month >= 2 && date4.month <= 6)
      return 31;
    return 30;
  }
  getYearsInEra() {
    return 9919;
  }
  getEras() {
    return [
      "saka"
    ];
  }
  balanceDate() {
  }
  constructor(...args) {
    super(...args), this.identifier = "indian";
  }
}
const $f2f3e0e3a817edbd$var$CIVIL_EPOC = 1948440;
const $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC = 1948439;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START = 1300;
const $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END = 1600;
const $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS = 460322;
function $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, day) {
  return day + Math.ceil(29.5 * (month - 1)) + (year - 1) * 354 + Math.floor((3 + 11 * year) / 30) + epoch - 1;
}
function $f2f3e0e3a817edbd$var$julianDayToIslamic(calendar2, epoch, jd2) {
  let year = Math.floor((30 * (jd2 - epoch) + 10646) / 10631);
  let month = Math.min(12, Math.ceil((jd2 - (29 + $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
  let day = jd2 - $f2f3e0e3a817edbd$var$islamicToJulianDay(epoch, year, month, 1) + 1;
  return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendar2, year, month, day);
}
function $f2f3e0e3a817edbd$var$isLeapYear(year) {
  return (14 + 11 * year) % 30 < 11;
}
class $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$CIVIL_EPOC, jd2);
  }
  toJulianDay(date4) {
    return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$CIVIL_EPOC, date4.year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    let length2 = 29 + date4.month % 2;
    if (date4.month === 12 && $f2f3e0e3a817edbd$var$isLeapYear(date4.year))
      length2++;
    return length2;
  }
  getMonthsInYear() {
    return 12;
  }
  getDaysInYear(date4) {
    return $f2f3e0e3a817edbd$var$isLeapYear(date4.year) ? 355 : 354;
  }
  getYearsInEra() {
    return 9665;
  }
  getEras() {
    return [
      "AH"
    ];
  }
  constructor() {
    this.identifier = "islamic-civil";
  }
}
class $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    return $f2f3e0e3a817edbd$var$julianDayToIslamic(this, $f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, jd2);
  }
  toJulianDay(date4) {
    return $f2f3e0e3a817edbd$var$islamicToJulianDay($f2f3e0e3a817edbd$var$ASTRONOMICAL_EPOC, date4.year, date4.month, date4.day);
  }
  constructor(...args) {
    super(...args), this.identifier = "islamic-tbla";
  }
}
const $f2f3e0e3a817edbd$var$UMALQURA_DATA = "qgpUDckO1AbqBmwDrQpVBakGkgepC9QF2gpcBS0NlQZKB1QLagutBa4ETwoXBYsGpQbVCtYCWwmdBE0KJg2VDawFtgm6AlsKKwWVCsoG6Qr0AnYJtgJWCcoKpAvSC9kF3AJtCU0FpQpSC6ULtAW2CVcFlwJLBaMGUgdlC2oFqworBZUMSg2lDcoF1gpXCasESwmlClILagt1BXYCtwhbBFUFqQW0BdoJ3QRuAjYJqgpUDbIN1QXaAlsJqwRVCkkLZAtxC7QFtQpVCiUNkg7JDtQG6QprCasEkwpJDaQNsg25CroEWworBZUKKgtVC1wFvQQ9Ah0JlQpKC1oLbQW2AjsJmwRVBqkGVAdqC2wFrQpVBSkLkgupC9QF2gpaBasKlQVJB2QHqgu1BbYCVgpNDiULUgtqC60FrgIvCZcESwalBqwG1gpdBZ0ETQoWDZUNqgW1BdoCWwmtBJUFygbkBuoK9QS2AlYJqgpUC9IL2QXqAm0JrQSVCkoLpQuyBbUJ1gSXCkcFkwZJB1ULagVrCisFiwpGDaMNygXWCtsEawJLCaUKUgtpC3UFdgG3CFsCKwVlBbQF2gntBG0BtgimClINqQ3UBdoKWwmrBFMGKQdiB6kLsgW1ClUFJQuSDckO0gbpCmsFqwRVCikNVA2qDbUJugQ7CpsETQqqCtUK2gJdCV4ELgqaDFUNsga5BroEXQotBZUKUguoC7QLuQXaAloJSgukDdEO6AZqC20FNQWVBkoNqA3UDdoGWwWdAisGFQtKC5ULqgWuCi4JjwwnBZUGqgbWCl0FnQI=";
let $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH;
let $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE;
function $f2f3e0e3a817edbd$var$umalquraYearStart(year) {
  return $f2f3e0e3a817edbd$var$UMALQURA_START_DAYS + $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
function $f2f3e0e3a817edbd$var$umalquraMonthLength(year, month) {
  let idx = year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START;
  let mask = 1 << 11 - (month - 1);
  if (($f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH[idx] & mask) === 0)
    return 29;
  else
    return 30;
}
function $f2f3e0e3a817edbd$var$umalquraMonthStart(year, month) {
  let day = $f2f3e0e3a817edbd$var$umalquraYearStart(year);
  for (let i2 = 1; i2 < month; i2++)
    day += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i2);
  return day;
}
function $f2f3e0e3a817edbd$var$umalquraYearLength(year) {
  return $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year + 1 - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START];
}
class $f2f3e0e3a817edbd$export$5baab4758c231076 extends $f2f3e0e3a817edbd$export$2066795aadd37bfc {
  fromJulianDay(jd2) {
    let days2 = jd2 - $f2f3e0e3a817edbd$var$CIVIL_EPOC;
    let startDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_START);
    let endDays = $f2f3e0e3a817edbd$var$umalquraYearStart($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END);
    if (days2 < startDays || days2 > endDays)
      return super.fromJulianDay(jd2);
    else {
      let y2 = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START - 1;
      let m2 = 1;
      let d2 = 1;
      while (d2 > 0) {
        y2++;
        d2 = days2 - $f2f3e0e3a817edbd$var$umalquraYearStart(y2) + 1;
        let yearLength = $f2f3e0e3a817edbd$var$umalquraYearLength(y2);
        if (d2 === yearLength) {
          m2 = 12;
          break;
        } else if (d2 < yearLength) {
          let monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y2, m2);
          m2 = 1;
          while (d2 > monthLength) {
            d2 -= monthLength;
            m2++;
            monthLength = $f2f3e0e3a817edbd$var$umalquraMonthLength(y2, m2);
          }
          break;
        }
      }
      return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, y2, m2, days2 - $f2f3e0e3a817edbd$var$umalquraMonthStart(y2, m2) + 1);
    }
  }
  toJulianDay(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.toJulianDay(date4);
    return $f2f3e0e3a817edbd$var$CIVIL_EPOC + $f2f3e0e3a817edbd$var$umalquraMonthStart(date4.year, date4.month) + (date4.day - 1);
  }
  getDaysInMonth(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.getDaysInMonth(date4);
    return $f2f3e0e3a817edbd$var$umalquraMonthLength(date4.year, date4.month);
  }
  getDaysInYear(date4) {
    if (date4.year < $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START || date4.year > $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END)
      return super.getDaysInYear(date4);
    return $f2f3e0e3a817edbd$var$umalquraYearLength(date4.year);
  }
  constructor() {
    super(), this.identifier = "islamic-umalqura";
    if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH)
      $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c2) => c2.charCodeAt(0)).buffer);
    if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {
      $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE = new Uint32Array($f2f3e0e3a817edbd$var$UMALQURA_YEAR_END - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START + 1);
      let yearStart = 0;
      for (let year = $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START; year <= $f2f3e0e3a817edbd$var$UMALQURA_YEAR_END; year++) {
        $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE[year - $f2f3e0e3a817edbd$var$UMALQURA_YEAR_START] = yearStart;
        for (let i2 = 1; i2 <= 12; i2++)
          yearStart += $f2f3e0e3a817edbd$var$umalquraMonthLength(year, i2);
      }
    }
  }
}
const $7c5f6fbf42389787$var$HEBREW_EPOCH = 347997;
const $7c5f6fbf42389787$var$HOUR_PARTS = 1080;
const $7c5f6fbf42389787$var$DAY_PARTS = 24 * $7c5f6fbf42389787$var$HOUR_PARTS;
const $7c5f6fbf42389787$var$MONTH_DAYS = 29;
const $7c5f6fbf42389787$var$MONTH_FRACT = 12 * $7c5f6fbf42389787$var$HOUR_PARTS + 793;
const $7c5f6fbf42389787$var$MONTH_PARTS = $7c5f6fbf42389787$var$MONTH_DAYS * $7c5f6fbf42389787$var$DAY_PARTS + $7c5f6fbf42389787$var$MONTH_FRACT;
function $7c5f6fbf42389787$var$isLeapYear(year) {
  return $2b4dce13dd5a17fa$export$842a2cf37af977e1(year * 7 + 1, 19) < 7;
}
function $7c5f6fbf42389787$var$hebrewDelay1(year) {
  let months2 = Math.floor((235 * year - 234) / 19);
  let parts = 12084 + 13753 * months2;
  let day = months2 * 29 + Math.floor(parts / 25920);
  if ($2b4dce13dd5a17fa$export$842a2cf37af977e1(3 * (day + 1), 7) < 3)
    day += 1;
  return day;
}
function $7c5f6fbf42389787$var$hebrewDelay2(year) {
  let last = $7c5f6fbf42389787$var$hebrewDelay1(year - 1);
  let present = $7c5f6fbf42389787$var$hebrewDelay1(year);
  let next2 = $7c5f6fbf42389787$var$hebrewDelay1(year + 1);
  if (next2 - present === 356)
    return 2;
  if (present - last === 382)
    return 1;
  return 0;
}
function $7c5f6fbf42389787$var$startOfYear(year) {
  return $7c5f6fbf42389787$var$hebrewDelay1(year) + $7c5f6fbf42389787$var$hebrewDelay2(year);
}
function $7c5f6fbf42389787$var$getDaysInYear(year) {
  return $7c5f6fbf42389787$var$startOfYear(year + 1) - $7c5f6fbf42389787$var$startOfYear(year);
}
function $7c5f6fbf42389787$var$getYearType(year) {
  let yearLength = $7c5f6fbf42389787$var$getDaysInYear(year);
  if (yearLength > 380)
    yearLength -= 30;
  switch (yearLength) {
    case 353:
      return 0;
    case 354:
      return 1;
    case 355:
      return 2;
  }
}
function $7c5f6fbf42389787$var$getDaysInMonth(year, month) {
  if (month >= 6 && !$7c5f6fbf42389787$var$isLeapYear(year))
    month++;
  if (month === 4 || month === 7 || month === 9 || month === 11 || month === 13)
    return 29;
  let yearType = $7c5f6fbf42389787$var$getYearType(year);
  if (month === 2)
    return yearType === 2 ? 30 : 29;
  if (month === 3)
    return yearType === 0 ? 29 : 30;
  if (month === 6)
    return $7c5f6fbf42389787$var$isLeapYear(year) ? 30 : 0;
  return 30;
}
class $7c5f6fbf42389787$export$ca405048b8fb5af {
  fromJulianDay(jd2) {
    let d2 = jd2 - $7c5f6fbf42389787$var$HEBREW_EPOCH;
    let m2 = d2 * $7c5f6fbf42389787$var$DAY_PARTS / $7c5f6fbf42389787$var$MONTH_PARTS;
    let year = Math.floor((19 * m2 + 234) / 235) + 1;
    let ys = $7c5f6fbf42389787$var$startOfYear(year);
    let dayOfYear = Math.floor(d2 - ys);
    while (dayOfYear < 1) {
      year--;
      ys = $7c5f6fbf42389787$var$startOfYear(year);
      dayOfYear = Math.floor(d2 - ys);
    }
    let month = 1;
    let monthStart = 0;
    while (monthStart < dayOfYear) {
      monthStart += $7c5f6fbf42389787$var$getDaysInMonth(year, month);
      month++;
    }
    month--;
    monthStart -= $7c5f6fbf42389787$var$getDaysInMonth(year, month);
    let day = dayOfYear - monthStart;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, year, month, day);
  }
  toJulianDay(date4) {
    let jd2 = $7c5f6fbf42389787$var$startOfYear(date4.year);
    for (let month = 1; month < date4.month; month++)
      jd2 += $7c5f6fbf42389787$var$getDaysInMonth(date4.year, month);
    return jd2 + date4.day + $7c5f6fbf42389787$var$HEBREW_EPOCH;
  }
  getDaysInMonth(date4) {
    return $7c5f6fbf42389787$var$getDaysInMonth(date4.year, date4.month);
  }
  getMonthsInYear(date4) {
    return $7c5f6fbf42389787$var$isLeapYear(date4.year) ? 13 : 12;
  }
  getDaysInYear(date4) {
    return $7c5f6fbf42389787$var$getDaysInYear(date4.year);
  }
  getYearsInEra() {
    return 9999;
  }
  getEras() {
    return [
      "AM"
    ];
  }
  balanceYearMonth(date4, previousDate) {
    if (previousDate.year !== date4.year) {
      if ($7c5f6fbf42389787$var$isLeapYear(previousDate.year) && !$7c5f6fbf42389787$var$isLeapYear(date4.year) && previousDate.month > 6)
        date4.month--;
      else if (!$7c5f6fbf42389787$var$isLeapYear(previousDate.year) && $7c5f6fbf42389787$var$isLeapYear(date4.year) && previousDate.month > 6)
        date4.month++;
    }
  }
  constructor() {
    this.identifier = "hebrew";
  }
}
const $b956b2d7a6cf451f$var$ETHIOPIC_EPOCH = 1723856;
const $b956b2d7a6cf451f$var$COPTIC_EPOCH = 1824665;
const $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA = 5500;
function $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, day) {
  return epoch + 365 * year + Math.floor(year / 4) + 30 * (month - 1) + day - 1;
}
function $b956b2d7a6cf451f$var$julianDayToCE(epoch, jd2) {
  let year = Math.floor(4 * (jd2 - epoch) / 1461);
  let month = 1 + Math.floor((jd2 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, 1, 1)) / 30);
  let day = jd2 + 1 - $b956b2d7a6cf451f$var$ceToJulianDay(epoch, year, month, 1);
  return [
    year,
    month,
    day
  ];
}
function $b956b2d7a6cf451f$var$getLeapDay(year) {
  return Math.floor(year % 4 / 3);
}
function $b956b2d7a6cf451f$var$getDaysInMonth(year, month) {
  if (month % 13 !== 0)
    return 30;
  else
    return $b956b2d7a6cf451f$var$getLeapDay(year) + 5;
}
class $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd2);
    let era = "AM";
    if (year <= 0) {
      era = "AA";
      year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
  }
  toJulianDay(date4) {
    let year = date4.year;
    if (date4.era === "AA")
      year -= $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    return $b956b2d7a6cf451f$var$getDaysInMonth(date4.year, date4.month);
  }
  getMonthsInYear() {
    return 13;
  }
  getDaysInYear(date4) {
    return 365 + $b956b2d7a6cf451f$var$getLeapDay(date4.year);
  }
  getYearsInEra(date4) {
    return date4.era === "AA" ? 9999 : 9991;
  }
  getEras() {
    return [
      "AA",
      "AM"
    ];
  }
  constructor() {
    this.identifier = "ethiopic";
  }
}
class $b956b2d7a6cf451f$export$d72e0c37005a4914 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$ETHIOPIC_EPOCH, jd2);
    year += $b956b2d7a6cf451f$var$AMETE_MIHRET_DELTA;
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, "AA", year, month, day);
  }
  getEras() {
    return [
      "AA"
    ];
  }
  getYearsInEra() {
    return 9999;
  }
  constructor(...args) {
    super(...args), this.identifier = "ethioaa";
  }
}
class $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 extends $b956b2d7a6cf451f$export$26ba6eab5e20cd7d {
  fromJulianDay(jd2) {
    let [year, month, day] = $b956b2d7a6cf451f$var$julianDayToCE($b956b2d7a6cf451f$var$COPTIC_EPOCH, jd2);
    let era = "CE";
    if (year <= 0) {
      era = "BCE";
      year = 1 - year;
    }
    return new $35ea8db9cb2ccb90$export$99faa760c7908e4f(this, era, year, month, day);
  }
  toJulianDay(date4) {
    let year = date4.year;
    if (date4.era === "BCE")
      year = 1 - year;
    return $b956b2d7a6cf451f$var$ceToJulianDay($b956b2d7a6cf451f$var$COPTIC_EPOCH, year, date4.month, date4.day);
  }
  getDaysInMonth(date4) {
    let year = date4.year;
    if (date4.era === "BCE")
      year = 1 - year;
    return $b956b2d7a6cf451f$var$getDaysInMonth(year, date4.month);
  }
  isInverseEra(date4) {
    return date4.era === "BCE";
  }
  balanceDate(date4) {
    if (date4.year <= 0) {
      date4.era = date4.era === "BCE" ? "CE" : "BCE";
      date4.year = 1 - date4.year;
    }
  }
  getEras() {
    return [
      "BCE",
      "CE"
    ];
  }
  getYearsInEra(date4) {
    return date4.era === "BCE" ? 9999 : 9715;
  }
  constructor(...args) {
    super(...args), this.identifier = "coptic";
  }
}
function $64244302c3013299$export$dd0bbc9b26defe37(name2) {
  switch (name2) {
    case "buddhist":
      return new $8d73d47422ca7302$export$42d20a78301dee44();
    case "ethiopic":
      return new $b956b2d7a6cf451f$export$26ba6eab5e20cd7d();
    case "ethioaa":
      return new $b956b2d7a6cf451f$export$d72e0c37005a4914();
    case "coptic":
      return new $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1();
    case "hebrew":
      return new $7c5f6fbf42389787$export$ca405048b8fb5af();
    case "indian":
      return new $82c358003bdda0a8$export$39f31c639fa15726();
    case "islamic-civil":
      return new $f2f3e0e3a817edbd$export$2066795aadd37bfc();
    case "islamic-tbla":
      return new $f2f3e0e3a817edbd$export$37f0887f2f9d22f7();
    case "islamic-umalqura":
      return new $f2f3e0e3a817edbd$export$5baab4758c231076();
    case "japanese":
      return new $62225008020f0a13$export$b746ab2b60cdffbf();
    case "persian":
      return new $f3ed2e4472ae7e25$export$37fccdbfd14c5939();
    case "roc":
      return new $5f31bd6f0c8940b2$export$65e01080afcb0799();
    case "gregory":
    default:
      return new $3b62074eb05584b2$export$80ee6245ec4f29ec();
  }
}
let $fb18d541ea1ad717$var$formatterCache = /* @__PURE__ */ new Map();
class $fb18d541ea1ad717$export$ad991b66133851cf {
  /** Formats a date as a string according to the locale and format options passed to the constructor. */
  format(value2) {
    return this.formatter.format(value2);
  }
  /** Formats a date to an array of parts such as separators, numbers, punctuation, and more. */
  formatToParts(value2) {
    return this.formatter.formatToParts(value2);
  }
  /** Formats a date range as a string. */
  formatRange(start, end) {
    if (typeof this.formatter.formatRange === "function")
      return this.formatter.formatRange(start, end);
    if (end < start)
      throw new RangeError("End date must be >= start date");
    return `${this.formatter.format(start)} – ${this.formatter.format(end)}`;
  }
  /** Formats a date range as an array of parts. */
  formatRangeToParts(start, end) {
    if (typeof this.formatter.formatRangeToParts === "function")
      return this.formatter.formatRangeToParts(start, end);
    if (end < start)
      throw new RangeError("End date must be >= start date");
    let startParts = this.formatter.formatToParts(start);
    let endParts = this.formatter.formatToParts(end);
    return [
      ...startParts.map((p2) => ({
        ...p2,
        source: "startRange"
      })),
      {
        type: "literal",
        value: " – ",
        source: "shared"
      },
      ...endParts.map((p2) => ({
        ...p2,
        source: "endRange"
      }))
    ];
  }
  /** Returns the resolved formatting options based on the values passed to the constructor. */
  resolvedOptions() {
    let resolvedOptions = this.formatter.resolvedOptions();
    if ($fb18d541ea1ad717$var$hasBuggyResolvedHourCycle()) {
      if (!this.resolvedHourCycle)
        this.resolvedHourCycle = $fb18d541ea1ad717$var$getResolvedHourCycle(resolvedOptions.locale, this.options);
      resolvedOptions.hourCycle = this.resolvedHourCycle;
      resolvedOptions.hour12 = this.resolvedHourCycle === "h11" || this.resolvedHourCycle === "h12";
    }
    if (resolvedOptions.calendar === "ethiopic-amete-alem")
      resolvedOptions.calendar = "ethioaa";
    return resolvedOptions;
  }
  constructor(locale2, options = {}) {
    this.formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, options);
    this.options = options;
  }
}
const $fb18d541ea1ad717$var$hour12Preferences = {
  true: {
    // Only Japanese uses the h11 style for 12 hour time. All others use h12.
    ja: "h11"
  },
  false: {}
};
function $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, options = {}) {
  if (typeof options.hour12 === "boolean" && $fb18d541ea1ad717$var$hasBuggyHour12Behavior()) {
    options = {
      ...options
    };
    let pref = $fb18d541ea1ad717$var$hour12Preferences[String(options.hour12)][locale2.split("-")[0]];
    let defaultHourCycle = options.hour12 ? "h12" : "h23";
    options.hourCycle = pref !== null && pref !== void 0 ? pref : defaultHourCycle;
    delete options.hour12;
  }
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($fb18d541ea1ad717$var$formatterCache.has(cacheKey))
    return $fb18d541ea1ad717$var$formatterCache.get(cacheKey);
  let numberFormatter = new Intl.DateTimeFormat(locale2, options);
  $fb18d541ea1ad717$var$formatterCache.set(cacheKey, numberFormatter);
  return numberFormatter;
}
let $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = null;
function $fb18d541ea1ad717$var$hasBuggyHour12Behavior() {
  if ($fb18d541ea1ad717$var$_hasBuggyHour12Behavior == null)
    $fb18d541ea1ad717$var$_hasBuggyHour12Behavior = new Intl.DateTimeFormat("en-US", {
      hour: "numeric",
      hour12: false
    }).format(new Date(2020, 2, 3, 0)) === "24";
  return $fb18d541ea1ad717$var$_hasBuggyHour12Behavior;
}
let $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = null;
function $fb18d541ea1ad717$var$hasBuggyResolvedHourCycle() {
  if ($fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle == null)
    $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat("fr", {
      hour: "numeric",
      hour12: false
    }).resolvedOptions().hourCycle === "h12";
  return $fb18d541ea1ad717$var$_hasBuggyResolvedHourCycle;
}
function $fb18d541ea1ad717$var$getResolvedHourCycle(locale2, options) {
  if (!options.timeStyle && !options.hour)
    return void 0;
  locale2 = locale2.replace(/(-u-)?-nu-[a-zA-Z0-9]+/, "");
  locale2 += (locale2.includes("-u-") ? "" : "-u") + "-nu-latn";
  let formatter = $fb18d541ea1ad717$var$getCachedDateFormatter(locale2, {
    ...options,
    timeZone: void 0
    // use local timezone
  });
  let min2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 0)).find((p2) => p2.type === "hour").value, 10);
  let max2 = parseInt(formatter.formatToParts(new Date(2020, 2, 3, 23)).find((p2) => p2.type === "hour").value, 10);
  if (min2 === 0 && max2 === 23)
    return "h23";
  if (min2 === 24 && max2 === 23)
    return "h24";
  if (min2 === 0 && max2 === 11)
    return "h11";
  if (min2 === 12 && max2 === 11)
    return "h12";
  throw new Error("Unexpected hour cycle result");
}
let $f4e2df6bd15f8569$var$_tableNestedRows = false;
let $f4e2df6bd15f8569$var$_shadowDOM = false;
function $f4e2df6bd15f8569$export$1b00cb14a96194e6() {
  return $f4e2df6bd15f8569$var$_tableNestedRows;
}
function $f4e2df6bd15f8569$export$98658e8c59125e6a() {
  return $f4e2df6bd15f8569$var$_shadowDOM;
}
function r$9(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2)) {
      var o2 = e2.length;
      for (t2 = 0; t2 < o2; t2++)
        e2[t2] && (f2 = r$9(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    } else
      for (f2 in e2)
        e2[f2] && (n2 && (n2 += " "), n2 += f2);
  return n2;
}
function clsx$4() {
  for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++)
    (e2 = arguments[f2]) && (t2 = r$9(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, min2 = -Infinity, max2 = Infinity) {
  let newValue = Math.min(Math.max(value2, min2), max2);
  return newValue;
}
function $9446cca9a3875146$export$e1a7b8e69ef6c52f(value2, step) {
  let roundedValue = value2;
  let precision = 0;
  let stepString = step.toString();
  let eIndex = stepString.toLowerCase().indexOf("e-");
  if (eIndex > 0)
    precision = Math.abs(Math.floor(Math.log10(Math.abs(step)))) + eIndex;
  else {
    let pointIndex = stepString.indexOf(".");
    if (pointIndex >= 0)
      precision = stepString.length - pointIndex;
  }
  if (precision > 0) {
    let pow = Math.pow(10, precision);
    roundedValue = Math.round(roundedValue * pow) / pow;
  }
  return roundedValue;
}
function $9446cca9a3875146$export$cb6e0bb50bc19463(value2, min2, max2, step) {
  min2 = Number(min2);
  max2 = Number(max2);
  let remainder = (value2 - (isNaN(min2) ? 0 : min2)) % step;
  let snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(Math.abs(remainder) * 2 >= step ? value2 + Math.sign(remainder) * (step - Math.abs(remainder)) : value2 - remainder, step);
  if (!isNaN(min2)) {
    if (snappedValue < min2)
      snappedValue = min2;
    else if (!isNaN(max2) && snappedValue > max2)
      snappedValue = min2 + Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f((max2 - min2) / step, step)) * step;
  } else if (!isNaN(max2) && snappedValue > max2)
    snappedValue = Math.floor($9446cca9a3875146$export$e1a7b8e69ef6c52f(max2 / step, step)) * step;
  snappedValue = $9446cca9a3875146$export$e1a7b8e69ef6c52f(snappedValue, step);
  return snappedValue;
}
let $488c6ddbf4ef74c2$var$formatterCache = /* @__PURE__ */ new Map();
let $488c6ddbf4ef74c2$var$supportsSignDisplay = false;
try {
  $488c6ddbf4ef74c2$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
    signDisplay: "exceptZero"
  }).resolvedOptions().signDisplay === "exceptZero";
} catch {
}
let $488c6ddbf4ef74c2$var$supportsUnit = false;
try {
  $488c6ddbf4ef74c2$var$supportsUnit = new Intl.NumberFormat("de-DE", {
    style: "unit",
    unit: "degree"
  }).resolvedOptions().style === "unit";
} catch {
}
const $488c6ddbf4ef74c2$var$UNITS = {
  degree: {
    narrow: {
      default: "°",
      "ja-JP": " 度",
      "zh-TW": "度",
      "sl-SI": " °"
    }
  }
};
class $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 {
  /** Formats a number value as a string, according to the locale and options provided to the constructor. */
  format(value2) {
    let res = "";
    if (!$488c6ddbf4ef74c2$var$supportsSignDisplay && this.options.signDisplay != null)
      res = $488c6ddbf4ef74c2$export$711b50b3c525e0f2(this.numberFormatter, this.options.signDisplay, value2);
    else
      res = this.numberFormatter.format(value2);
    if (this.options.style === "unit" && !$488c6ddbf4ef74c2$var$supportsUnit) {
      var _UNITS_unit;
      let { unit: unit2, unitDisplay = "short", locale: locale2 } = this.resolvedOptions();
      if (!unit2)
        return res;
      let values = (_UNITS_unit = $488c6ddbf4ef74c2$var$UNITS[unit2]) === null || _UNITS_unit === void 0 ? void 0 : _UNITS_unit[unitDisplay];
      res += values[locale2] || values.default;
    }
    return res;
  }
  /** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
  formatToParts(value2) {
    return this.numberFormatter.formatToParts(value2);
  }
  /** Formats a number range as a string. */
  formatRange(start, end) {
    if (typeof this.numberFormatter.formatRange === "function")
      return this.numberFormatter.formatRange(start, end);
    if (end < start)
      throw new RangeError("End date must be >= start date");
    return `${this.format(start)} – ${this.format(end)}`;
  }
  /** Formats a number range as an array of parts. */
  formatRangeToParts(start, end) {
    if (typeof this.numberFormatter.formatRangeToParts === "function")
      return this.numberFormatter.formatRangeToParts(start, end);
    if (end < start)
      throw new RangeError("End date must be >= start date");
    let startParts = this.numberFormatter.formatToParts(start);
    let endParts = this.numberFormatter.formatToParts(end);
    return [
      ...startParts.map((p2) => ({
        ...p2,
        source: "startRange"
      })),
      {
        type: "literal",
        value: " – ",
        source: "shared"
      },
      ...endParts.map((p2) => ({
        ...p2,
        source: "endRange"
      }))
    ];
  }
  /** Returns the resolved formatting options based on the values passed to the constructor. */
  resolvedOptions() {
    let options = this.numberFormatter.resolvedOptions();
    if (!$488c6ddbf4ef74c2$var$supportsSignDisplay && this.options.signDisplay != null)
      options = {
        ...options,
        signDisplay: this.options.signDisplay
      };
    if (!$488c6ddbf4ef74c2$var$supportsUnit && this.options.style === "unit")
      options = {
        ...options,
        style: "unit",
        unit: this.options.unit,
        unitDisplay: this.options.unitDisplay
      };
    return options;
  }
  constructor(locale2, options = {}) {
    this.numberFormatter = $488c6ddbf4ef74c2$var$getCachedNumberFormatter(locale2, options);
    this.options = options;
  }
}
function $488c6ddbf4ef74c2$var$getCachedNumberFormatter(locale2, options = {}) {
  let { numberingSystem } = options;
  if (numberingSystem && locale2.includes("-nu-")) {
    if (!locale2.includes("-u-"))
      locale2 += "-u-";
    locale2 += `-nu-${numberingSystem}`;
  }
  if (options.style === "unit" && !$488c6ddbf4ef74c2$var$supportsUnit) {
    var _UNITS_unit;
    let { unit: unit2, unitDisplay = "short" } = options;
    if (!unit2)
      throw new Error('unit option must be provided with style: "unit"');
    if (!((_UNITS_unit = $488c6ddbf4ef74c2$var$UNITS[unit2]) === null || _UNITS_unit === void 0 ? void 0 : _UNITS_unit[unitDisplay]))
      throw new Error(`Unsupported unit ${unit2} with unitDisplay = ${unitDisplay}`);
    options = {
      ...options,
      style: "decimal"
    };
  }
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($488c6ddbf4ef74c2$var$formatterCache.has(cacheKey))
    return $488c6ddbf4ef74c2$var$formatterCache.get(cacheKey);
  let numberFormatter = new Intl.NumberFormat(locale2, options);
  $488c6ddbf4ef74c2$var$formatterCache.set(cacheKey, numberFormatter);
  return numberFormatter;
}
function $488c6ddbf4ef74c2$export$711b50b3c525e0f2(numberFormat, signDisplay, num) {
  if (signDisplay === "auto")
    return numberFormat.format(num);
  else if (signDisplay === "never")
    return numberFormat.format(Math.abs(num));
  else {
    let needsPositiveSign = false;
    if (signDisplay === "always")
      needsPositiveSign = num > 0 || Object.is(num, 0);
    else if (signDisplay === "exceptZero") {
      if (Object.is(num, -0) || Object.is(num, 0))
        num = Math.abs(num);
      else
        needsPositiveSign = num > 0;
    }
    if (needsPositiveSign) {
      let negative = numberFormat.format(-num);
      let noSign = numberFormat.format(num);
      let minus = negative.replace(noSign, "").replace(/\u200e|\u061C/, "");
      if ([
        ...minus
      ].length !== 1)
        console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case");
      let positive = negative.replace(noSign, "!!!").replace(minus, "+").replace("!!!", noSign);
      return positive;
    } else
      return numberFormat.format(num);
  }
}
const $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX = new RegExp("^.*\\(.*\\).*$");
const $6c7bd7858deea686$var$NUMBERING_SYSTEMS = [
  "latn",
  "arab",
  "hanidec",
  "deva",
  "beng",
  "fullwide"
];
class $6c7bd7858deea686$export$cd11ab140839f11d {
  /**
  * Parses the given string to a number. Returns NaN if a valid number could not be parsed.
  */
  parse(value2) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).parse(value2);
  }
  /**
  * Returns whether the given string could potentially be a valid number. This should be used to
  * validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
  * of the minus/plus sign characters can be checked.
  */
  isValidPartialNumber(value2, minValue, maxValue) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).isValidPartialNumber(value2, minValue, maxValue);
  }
  /**
  * Returns a numbering system for which the given string is valid in the current locale.
  * If no numbering system could be detected, the default numbering system for the current
  * locale is returned.
  */
  getNumberingSystem(value2) {
    return $6c7bd7858deea686$var$getNumberParserImpl(this.locale, this.options, value2).options.numberingSystem;
  }
  constructor(locale2, options = {}) {
    this.locale = locale2;
    this.options = options;
  }
}
const $6c7bd7858deea686$var$numberParserCache = /* @__PURE__ */ new Map();
function $6c7bd7858deea686$var$getNumberParserImpl(locale2, options, value2) {
  let defaultParser = $6c7bd7858deea686$var$getCachedNumberParser(locale2, options);
  if (!locale2.includes("-nu-") && !defaultParser.isValidPartialNumber(value2)) {
    for (let numberingSystem of $6c7bd7858deea686$var$NUMBERING_SYSTEMS)
      if (numberingSystem !== defaultParser.options.numberingSystem) {
        let parser = $6c7bd7858deea686$var$getCachedNumberParser(locale2 + (locale2.includes("-u-") ? "-nu-" : "-u-nu-") + numberingSystem, options);
        if (parser.isValidPartialNumber(value2))
          return parser;
      }
  }
  return defaultParser;
}
function $6c7bd7858deea686$var$getCachedNumberParser(locale2, options) {
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  let parser = $6c7bd7858deea686$var$numberParserCache.get(cacheKey);
  if (!parser) {
    parser = new $6c7bd7858deea686$var$NumberParserImpl(locale2, options);
    $6c7bd7858deea686$var$numberParserCache.set(cacheKey, parser);
  }
  return parser;
}
class $6c7bd7858deea686$var$NumberParserImpl {
  parse(value2) {
    let fullySanitizedValue = this.sanitize(value2);
    if (this.symbols.group)
      fullySanitizedValue = $6c7bd7858deea686$var$replaceAll(fullySanitizedValue, this.symbols.group, "");
    if (this.symbols.decimal)
      fullySanitizedValue = fullySanitizedValue.replace(this.symbols.decimal, ".");
    if (this.symbols.minusSign)
      fullySanitizedValue = fullySanitizedValue.replace(this.symbols.minusSign, "-");
    fullySanitizedValue = fullySanitizedValue.replace(this.symbols.numeral, this.symbols.index);
    if (this.options.style === "percent") {
      let isNegative = fullySanitizedValue.indexOf("-");
      fullySanitizedValue = fullySanitizedValue.replace("-", "");
      fullySanitizedValue = fullySanitizedValue.replace("+", "");
      let index2 = fullySanitizedValue.indexOf(".");
      if (index2 === -1)
        index2 = fullySanitizedValue.length;
      fullySanitizedValue = fullySanitizedValue.replace(".", "");
      if (index2 - 2 === 0)
        fullySanitizedValue = `0.${fullySanitizedValue}`;
      else if (index2 - 2 === -1)
        fullySanitizedValue = `0.0${fullySanitizedValue}`;
      else if (index2 - 2 === -2)
        fullySanitizedValue = "0.00";
      else
        fullySanitizedValue = `${fullySanitizedValue.slice(0, index2 - 2)}.${fullySanitizedValue.slice(index2 - 2)}`;
      if (isNegative > -1)
        fullySanitizedValue = `-${fullySanitizedValue}`;
    }
    let newValue = fullySanitizedValue ? +fullySanitizedValue : NaN;
    if (isNaN(newValue))
      return NaN;
    if (this.options.style === "percent") {
      var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
      let options = {
        ...this.options,
        style: "decimal",
        minimumFractionDigits: Math.min(((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) + 2, 20),
        maximumFractionDigits: Math.min(((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) + 2, 20)
      };
      return new $6c7bd7858deea686$export$cd11ab140839f11d(this.locale, options).parse(new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(this.locale, options).format(newValue));
    }
    if (this.options.currencySign === "accounting" && $6c7bd7858deea686$var$CURRENCY_SIGN_REGEX.test(value2))
      newValue = -1 * newValue;
    return newValue;
  }
  sanitize(value2) {
    value2 = value2.replace(this.symbols.literals, "");
    if (this.symbols.minusSign)
      value2 = value2.replace("-", this.symbols.minusSign);
    if (this.options.numberingSystem === "arab") {
      if (this.symbols.decimal) {
        value2 = value2.replace(",", this.symbols.decimal);
        value2 = value2.replace(String.fromCharCode(1548), this.symbols.decimal);
      }
      if (this.symbols.group)
        value2 = $6c7bd7858deea686$var$replaceAll(value2, ".", this.symbols.group);
    }
    if (this.options.locale === "fr-FR" && this.symbols.group) {
      value2 = $6c7bd7858deea686$var$replaceAll(value2, " ", this.symbols.group);
      value2 = $6c7bd7858deea686$var$replaceAll(value2, /\u00A0/g, this.symbols.group);
    }
    return value2;
  }
  isValidPartialNumber(value2, minValue = -Infinity, maxValue = Infinity) {
    value2 = this.sanitize(value2);
    if (this.symbols.minusSign && value2.startsWith(this.symbols.minusSign) && minValue < 0)
      value2 = value2.slice(this.symbols.minusSign.length);
    else if (this.symbols.plusSign && value2.startsWith(this.symbols.plusSign) && maxValue > 0)
      value2 = value2.slice(this.symbols.plusSign.length);
    if (this.symbols.group && value2.startsWith(this.symbols.group))
      return false;
    if (this.symbols.decimal && value2.indexOf(this.symbols.decimal) > -1 && this.options.maximumFractionDigits === 0)
      return false;
    if (this.symbols.group)
      value2 = $6c7bd7858deea686$var$replaceAll(value2, this.symbols.group, "");
    value2 = value2.replace(this.symbols.numeral, "");
    if (this.symbols.decimal)
      value2 = value2.replace(this.symbols.decimal, "");
    return value2.length === 0;
  }
  constructor(locale2, options = {}) {
    this.locale = locale2;
    if (options.roundingIncrement !== 1 && options.roundingIncrement != null) {
      if (options.maximumFractionDigits == null && options.minimumFractionDigits == null) {
        options.maximumFractionDigits = 0;
        options.minimumFractionDigits = 0;
      } else if (options.maximumFractionDigits == null)
        options.maximumFractionDigits = options.minimumFractionDigits;
      else if (options.minimumFractionDigits == null)
        options.minimumFractionDigits = options.maximumFractionDigits;
    }
    this.formatter = new Intl.NumberFormat(locale2, options);
    this.options = this.formatter.resolvedOptions();
    this.symbols = $6c7bd7858deea686$var$getSymbols(locale2, this.formatter, this.options, options);
    var _this_options_minimumFractionDigits, _this_options_maximumFractionDigits;
    if (this.options.style === "percent" && (((_this_options_minimumFractionDigits = this.options.minimumFractionDigits) !== null && _this_options_minimumFractionDigits !== void 0 ? _this_options_minimumFractionDigits : 0) > 18 || ((_this_options_maximumFractionDigits = this.options.maximumFractionDigits) !== null && _this_options_maximumFractionDigits !== void 0 ? _this_options_maximumFractionDigits : 0) > 18))
      console.warn("NumberParser cannot handle percentages with greater than 18 decimal places, please reduce the number in your options.");
  }
}
const $6c7bd7858deea686$var$nonLiteralParts = /* @__PURE__ */ new Set([
  "decimal",
  "fraction",
  "integer",
  "minusSign",
  "plusSign",
  "group"
]);
const $6c7bd7858deea686$var$pluralNumbers = [
  0,
  4,
  2,
  1,
  11,
  20,
  3,
  7,
  100,
  21,
  0.1,
  1.1
];
function $6c7bd7858deea686$var$getSymbols(locale2, formatter, intlOptions, originalOptions) {
  var _allParts_find, _posAllParts_find, _decimalParts_find, _allParts_find1;
  let symbolFormatter = new Intl.NumberFormat(locale2, {
    ...intlOptions,
    // Resets so we get the full range of symbols
    minimumSignificantDigits: 1,
    maximumSignificantDigits: 21,
    roundingIncrement: 1,
    roundingPriority: "auto",
    roundingMode: "halfExpand"
  });
  let allParts = symbolFormatter.formatToParts(-10000.111);
  let posAllParts = symbolFormatter.formatToParts(10000.111);
  let pluralParts = $6c7bd7858deea686$var$pluralNumbers.map((n2) => symbolFormatter.formatToParts(n2));
  var _allParts_find_value;
  let minusSign = (_allParts_find_value = (_allParts_find = allParts.find((p2) => p2.type === "minusSign")) === null || _allParts_find === void 0 ? void 0 : _allParts_find.value) !== null && _allParts_find_value !== void 0 ? _allParts_find_value : "-";
  let plusSign = (_posAllParts_find = posAllParts.find((p2) => p2.type === "plusSign")) === null || _posAllParts_find === void 0 ? void 0 : _posAllParts_find.value;
  if (!plusSign && ((originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "exceptZero" || (originalOptions === null || originalOptions === void 0 ? void 0 : originalOptions.signDisplay) === "always"))
    plusSign = "+";
  let decimalParts = new Intl.NumberFormat(locale2, {
    ...intlOptions,
    minimumFractionDigits: 2,
    maximumFractionDigits: 2
  }).formatToParts(1e-3);
  let decimal = (_decimalParts_find = decimalParts.find((p2) => p2.type === "decimal")) === null || _decimalParts_find === void 0 ? void 0 : _decimalParts_find.value;
  let group = (_allParts_find1 = allParts.find((p2) => p2.type === "group")) === null || _allParts_find1 === void 0 ? void 0 : _allParts_find1.value;
  let allPartsLiterals = allParts.filter((p2) => !$6c7bd7858deea686$var$nonLiteralParts.has(p2.type)).map((p2) => $6c7bd7858deea686$var$escapeRegex(p2.value));
  let pluralPartsLiterals = pluralParts.flatMap((p2) => p2.filter((p3) => !$6c7bd7858deea686$var$nonLiteralParts.has(p3.type)).map((p3) => $6c7bd7858deea686$var$escapeRegex(p3.value)));
  let sortedLiterals = [
    .../* @__PURE__ */ new Set([
      ...allPartsLiterals,
      ...pluralPartsLiterals
    ])
  ].sort((a2, b2) => b2.length - a2.length);
  let literals = sortedLiterals.length === 0 ? new RegExp("[\\p{White_Space}]", "gu") : new RegExp(`${sortedLiterals.join("|")}|[\\p{White_Space}]`, "gu");
  let numerals = [
    ...new Intl.NumberFormat(intlOptions.locale, {
      useGrouping: false
    }).format(9876543210)
  ].reverse();
  let indexes = new Map(numerals.map((d2, i2) => [
    d2,
    i2
  ]));
  let numeral = new RegExp(`[${numerals.join("")}]`, "g");
  let index2 = (d2) => String(indexes.get(d2));
  return {
    minusSign,
    plusSign,
    decimal,
    group,
    literals,
    numeral,
    index: index2
  };
}
function $6c7bd7858deea686$var$replaceAll(str, find2, replace2) {
  if (str.replaceAll)
    return str.replaceAll(find2, replace2);
  return str.split(find2).join(replace2);
}
function $6c7bd7858deea686$var$escapeRegex(string3) {
  return string3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
const LayoutGroupContext = reactExports.createContext({});
function useConstant(init2) {
  const ref = reactExports.useRef(null);
  if (ref.current === null) {
    ref.current = init2();
  }
  return ref.current;
}
const PresenceContext = reactExports.createContext(null);
const MotionConfigContext = reactExports.createContext({
  transformPagePoint: (p2) => p2,
  isStatic: false,
  reducedMotion: "never"
});
class PopChildMeasure extends reactExports.Component {
  getSnapshotBeforeUpdate(prevProps) {
    const element2 = this.props.childRef.current;
    if (element2 && prevProps.isPresent && !this.props.isPresent) {
      const size2 = this.props.sizeRef.current;
      size2.height = element2.offsetHeight || 0;
      size2.width = element2.offsetWidth || 0;
      size2.top = element2.offsetTop;
      size2.left = element2.offsetLeft;
    }
    return null;
  }
  /**
   * Required with getSnapshotBeforeUpdate to stop React complaining.
   */
  componentDidUpdate() {
  }
  render() {
    return this.props.children;
  }
}
function PopChild({ children, isPresent: isPresent2 }) {
  const id2 = reactExports.useId();
  const ref = reactExports.useRef(null);
  const size2 = reactExports.useRef({
    width: 0,
    height: 0,
    top: 0,
    left: 0
  });
  const { nonce } = reactExports.useContext(MotionConfigContext);
  reactExports.useInsertionEffect(() => {
    const { width, height, top: top2, left: left2 } = size2.current;
    if (isPresent2 || !ref.current || !width || !height)
      return;
    ref.current.dataset.motionPopId = id2;
    const style2 = document.createElement("style");
    if (nonce)
      style2.nonce = nonce;
    document.head.appendChild(style2);
    if (style2.sheet) {
      style2.sheet.insertRule(`
          [data-motion-pop-id="${id2}"] {
            position: absolute !important;
            width: ${width}px !important;
            height: ${height}px !important;
            top: ${top2}px !important;
            left: ${left2}px !important;
          }
        `);
    }
    return () => {
      document.head.removeChild(style2);
    };
  }, [isPresent2]);
  return jsxRuntimeExports.jsx(PopChildMeasure, { isPresent: isPresent2, childRef: ref, sizeRef: size2, children: reactExports.cloneElement(children, { ref }) });
}
const PresenceChild = ({ children, initial, isPresent: isPresent2, onExitComplete, custom, presenceAffectsLayout, mode }) => {
  const presenceChildren = useConstant(newChildrenMap);
  const id2 = reactExports.useId();
  const memoizedOnExitComplete = reactExports.useCallback((childId) => {
    presenceChildren.set(childId, true);
    for (const isComplete of presenceChildren.values()) {
      if (!isComplete)
        return;
    }
    onExitComplete && onExitComplete();
  }, [presenceChildren, onExitComplete]);
  const context = reactExports.useMemo(
    () => ({
      id: id2,
      initial,
      isPresent: isPresent2,
      custom,
      onExitComplete: memoizedOnExitComplete,
      register: (childId) => {
        presenceChildren.set(childId, false);
        return () => presenceChildren.delete(childId);
      }
    }),
    /**
     * If the presence of a child affects the layout of the components around it,
     * we want to make a new context value to ensure they get re-rendered
     * so they can detect that layout change.
     */
    presenceAffectsLayout ? [Math.random(), memoizedOnExitComplete] : [isPresent2, memoizedOnExitComplete]
  );
  reactExports.useMemo(() => {
    presenceChildren.forEach((_24, key) => presenceChildren.set(key, false));
  }, [isPresent2]);
  reactExports.useEffect(() => {
    !isPresent2 && !presenceChildren.size && onExitComplete && onExitComplete();
  }, [isPresent2]);
  if (mode === "popLayout") {
    children = jsxRuntimeExports.jsx(PopChild, { isPresent: isPresent2, children });
  }
  return jsxRuntimeExports.jsx(PresenceContext.Provider, { value: context, children });
};
function newChildrenMap() {
  return /* @__PURE__ */ new Map();
}
function usePresence(subscribe2 = true) {
  const context = reactExports.useContext(PresenceContext);
  if (context === null)
    return [true, null];
  const { isPresent: isPresent2, onExitComplete, register: register2 } = context;
  const id2 = reactExports.useId();
  reactExports.useEffect(() => {
    if (subscribe2)
      register2(id2);
  }, [subscribe2]);
  const safeToRemove = reactExports.useCallback(() => subscribe2 && onExitComplete && onExitComplete(id2), [id2, onExitComplete, subscribe2]);
  return !isPresent2 && onExitComplete ? [false, safeToRemove] : [true];
}
function useIsPresent() {
  return isPresent(reactExports.useContext(PresenceContext));
}
function isPresent(context) {
  return context === null ? true : context.isPresent;
}
const getChildKey = (child) => child.key || "";
function onlyElements(children) {
  const filtered = [];
  reactExports.Children.forEach(children, (child) => {
    if (reactExports.isValidElement(child))
      filtered.push(child);
  });
  return filtered;
}
const isBrowser$3 = typeof window !== "undefined";
const useIsomorphicLayoutEffect$4 = isBrowser$3 ? reactExports.useLayoutEffect : reactExports.useEffect;
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false }) => {
  const [isParentPresent, safeToRemove] = usePresence(propagate);
  const presentChildren = reactExports.useMemo(() => onlyElements(children), [children]);
  const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
  const isInitialRender = reactExports.useRef(true);
  const pendingPresentChildren = reactExports.useRef(presentChildren);
  const exitComplete = useConstant(() => /* @__PURE__ */ new Map());
  const [diffedChildren, setDiffedChildren] = reactExports.useState(presentChildren);
  const [renderedChildren, setRenderedChildren] = reactExports.useState(presentChildren);
  useIsomorphicLayoutEffect$4(() => {
    isInitialRender.current = false;
    pendingPresentChildren.current = presentChildren;
    for (let i2 = 0; i2 < renderedChildren.length; i2++) {
      const key = getChildKey(renderedChildren[i2]);
      if (!presentKeys.includes(key)) {
        if (exitComplete.get(key) !== true) {
          exitComplete.set(key, false);
        }
      } else {
        exitComplete.delete(key);
      }
    }
  }, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
  const exitingChildren = [];
  if (presentChildren !== diffedChildren) {
    let nextChildren = [...presentChildren];
    for (let i2 = 0; i2 < renderedChildren.length; i2++) {
      const child = renderedChildren[i2];
      const key = getChildKey(child);
      if (!presentKeys.includes(key)) {
        nextChildren.splice(i2, 0, child);
        exitingChildren.push(child);
      }
    }
    if (mode === "wait" && exitingChildren.length) {
      nextChildren = exitingChildren;
    }
    setRenderedChildren(onlyElements(nextChildren));
    setDiffedChildren(presentChildren);
    return;
  }
  const { forceRender } = reactExports.useContext(LayoutGroupContext);
  return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderedChildren.map((child) => {
    const key = getChildKey(child);
    const isPresent2 = propagate && !isParentPresent ? false : presentChildren === renderedChildren || presentKeys.includes(key);
    const onExit = () => {
      if (exitComplete.has(key)) {
        exitComplete.set(key, true);
      } else {
        return;
      }
      let isEveryExitComplete = true;
      exitComplete.forEach((isExitComplete) => {
        if (!isExitComplete)
          isEveryExitComplete = false;
      });
      if (isEveryExitComplete) {
        forceRender === null || forceRender === void 0 ? void 0 : forceRender();
        setRenderedChildren(pendingPresentChildren.current);
        propagate && (safeToRemove === null || safeToRemove === void 0 ? void 0 : safeToRemove());
        onExitComplete && onExitComplete();
      }
    };
    return jsxRuntimeExports.jsx(PresenceChild, { isPresent: isPresent2, initial: !isInitialRender.current || initial ? void 0 : false, custom: isPresent2 ? void 0 : custom, presenceAffectsLayout, mode, onExitComplete: isPresent2 ? void 0 : onExit, children: child }, key);
  }) });
};
const DeprecatedLayoutGroupContext = reactExports.createContext(null);
function useIsMounted$1() {
  const isMounted = reactExports.useRef(false);
  useIsomorphicLayoutEffect$4(() => {
    isMounted.current = true;
    return () => {
      isMounted.current = false;
    };
  }, []);
  return isMounted;
}
const noop$a = /* @__NO_SIDE_EFFECTS__ */ (any3) => any3;
let warning$3 = noop$a;
let invariant$2 = noop$a;
// @__NO_SIDE_EFFECTS__
function memo$1(callback2) {
  let result;
  return () => {
    if (result === void 0)
      result = callback2();
    return result;
  };
}
const progress$1 = /* @__NO_SIDE_EFFECTS__ */ (from2, to2, value2) => {
  const toFromDifference = to2 - from2;
  return toFromDifference === 0 ? 1 : (value2 - from2) / toFromDifference;
};
const secondsToMilliseconds = /* @__NO_SIDE_EFFECTS__ */ (seconds2) => seconds2 * 1e3;
const millisecondsToSeconds = /* @__NO_SIDE_EFFECTS__ */ (milliseconds2) => milliseconds2 / 1e3;
const MotionGlobalConfig = {
  skipAnimations: false,
  useManualTiming: false
};
function createRenderStep(runNextFrame) {
  let thisFrame = /* @__PURE__ */ new Set();
  let nextFrame = /* @__PURE__ */ new Set();
  let isProcessing = false;
  let flushNextFrame = false;
  const toKeepAlive = /* @__PURE__ */ new WeakSet();
  let latestFrameData = {
    delta: 0,
    timestamp: 0,
    isProcessing: false
  };
  function triggerCallback(callback2) {
    if (toKeepAlive.has(callback2)) {
      step.schedule(callback2);
      runNextFrame();
    }
    callback2(latestFrameData);
  }
  const step = {
    /**
     * Schedule a process to run on the next frame.
     */
    schedule: (callback2, keepAlive = false, immediate = false) => {
      const addToCurrentFrame = immediate && isProcessing;
      const queue = addToCurrentFrame ? thisFrame : nextFrame;
      if (keepAlive)
        toKeepAlive.add(callback2);
      if (!queue.has(callback2))
        queue.add(callback2);
      return callback2;
    },
    /**
     * Cancel the provided callback from running on the next frame.
     */
    cancel: (callback2) => {
      nextFrame.delete(callback2);
      toKeepAlive.delete(callback2);
    },
    /**
     * Execute all schedule callbacks.
     */
    process: (frameData2) => {
      latestFrameData = frameData2;
      if (isProcessing) {
        flushNextFrame = true;
        return;
      }
      isProcessing = true;
      [thisFrame, nextFrame] = [nextFrame, thisFrame];
      thisFrame.forEach(triggerCallback);
      thisFrame.clear();
      isProcessing = false;
      if (flushNextFrame) {
        flushNextFrame = false;
        step.process(frameData2);
      }
    }
  };
  return step;
}
const stepsOrder = [
  "read",
  // Read
  "resolveKeyframes",
  // Write/Read/Write/Read
  "update",
  // Compute
  "preRender",
  // Compute
  "render",
  // Write
  "postRender"
  // Compute
];
const maxElapsed = 40;
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
  let runNextFrame = false;
  let useDefaultElapsed = true;
  const state = {
    delta: 0,
    timestamp: 0,
    isProcessing: false
  };
  const flagRunNextFrame = () => runNextFrame = true;
  const steps = stepsOrder.reduce((acc, key) => {
    acc[key] = createRenderStep(flagRunNextFrame);
    return acc;
  }, {});
  const { read, resolveKeyframes, update, preRender, render: render3, postRender } = steps;
  const processBatch = () => {
    const timestamp = MotionGlobalConfig.useManualTiming ? state.timestamp : performance.now();
    runNextFrame = false;
    state.delta = useDefaultElapsed ? 1e3 / 60 : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
    state.timestamp = timestamp;
    state.isProcessing = true;
    read.process(state);
    resolveKeyframes.process(state);
    update.process(state);
    preRender.process(state);
    render3.process(state);
    postRender.process(state);
    state.isProcessing = false;
    if (runNextFrame && allowKeepAlive) {
      useDefaultElapsed = false;
      scheduleNextBatch(processBatch);
    }
  };
  const wake = () => {
    runNextFrame = true;
    useDefaultElapsed = true;
    if (!state.isProcessing) {
      scheduleNextBatch(processBatch);
    }
  };
  const schedule = stepsOrder.reduce((acc, key) => {
    const step = steps[key];
    acc[key] = (process2, keepAlive = false, immediate = false) => {
      if (!runNextFrame)
        wake();
      return step.schedule(process2, keepAlive, immediate);
    };
    return acc;
  }, {});
  const cancel2 = (process2) => {
    for (let i2 = 0; i2 < stepsOrder.length; i2++) {
      steps[stepsOrder[i2]].cancel(process2);
    }
  };
  return { schedule, cancel: cancel2, state, steps };
}
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop$a, true);
function useForceUpdate() {
  const isMounted = useIsMounted$1();
  const [forcedRenderCount, setForcedRenderCount] = reactExports.useState(0);
  const forceRender = reactExports.useCallback(() => {
    isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
  }, [forcedRenderCount]);
  const deferredForceRender = reactExports.useCallback(() => frame.postRender(forceRender), [forceRender]);
  return [deferredForceRender, forcedRenderCount];
}
const notify = (node2) => !node2.isLayoutDirty && node2.willUpdate(false);
function nodeGroup() {
  const nodes = /* @__PURE__ */ new Set();
  const subscriptions = /* @__PURE__ */ new WeakMap();
  const dirtyAll = () => nodes.forEach(notify);
  return {
    add: (node2) => {
      nodes.add(node2);
      subscriptions.set(node2, node2.addEventListener("willUpdate", dirtyAll));
    },
    remove: (node2) => {
      nodes.delete(node2);
      const unsubscribe = subscriptions.get(node2);
      if (unsubscribe) {
        unsubscribe();
        subscriptions.delete(node2);
      }
      dirtyAll();
    },
    dirty: dirtyAll
  };
}
const shouldInheritGroup = (inherit) => inherit === true;
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
const LayoutGroup = ({ children, id: id2, inherit = true }) => {
  const layoutGroupContext = reactExports.useContext(LayoutGroupContext);
  const deprecatedLayoutGroupContext = reactExports.useContext(DeprecatedLayoutGroupContext);
  const [forceRender, key] = useForceUpdate();
  const context = reactExports.useRef(null);
  const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
  if (context.current === null) {
    if (shouldInheritId(inherit) && upstreamId) {
      id2 = id2 ? upstreamId + "-" + id2 : upstreamId;
    }
    context.current = {
      id: id2,
      group: shouldInheritGroup(inherit) ? layoutGroupContext.group || nodeGroup() : nodeGroup()
    };
  }
  const memoizedContext = reactExports.useMemo(() => ({ ...context.current, forceRender }), [key]);
  return jsxRuntimeExports.jsx(LayoutGroupContext.Provider, { value: memoizedContext, children });
};
const LazyContext = reactExports.createContext({ strict: false });
const featureProps = {
  animation: [
    "animate",
    "variants",
    "whileHover",
    "whileTap",
    "exit",
    "whileInView",
    "whileFocus",
    "whileDrag"
  ],
  exit: ["exit"],
  drag: ["drag", "dragControls"],
  focus: ["whileFocus"],
  hover: ["whileHover", "onHoverStart", "onHoverEnd"],
  tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
  pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
  inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
  layout: ["layout", "layoutId"]
};
const featureDefinitions = {};
for (const key in featureProps) {
  featureDefinitions[key] = {
    isEnabled: (props) => featureProps[key].some((name2) => !!props[name2])
  };
}
function loadFeatures$1(features) {
  for (const key in features) {
    featureDefinitions[key] = {
      ...featureDefinitions[key],
      ...features[key]
    };
  }
}
function LazyMotion({ children, features, strict = false }) {
  const [, setIsLoaded] = reactExports.useState(!isLazyBundle(features));
  const loadedRenderer = reactExports.useRef(void 0);
  if (!isLazyBundle(features)) {
    const { renderer, ...loadedFeatures } = features;
    loadedRenderer.current = renderer;
    loadFeatures$1(loadedFeatures);
  }
  reactExports.useEffect(() => {
    if (isLazyBundle(features)) {
      features().then(({ renderer, ...loadedFeatures }) => {
        loadFeatures$1(loadedFeatures);
        loadedRenderer.current = renderer;
        setIsLoaded(true);
      });
    }
  }, []);
  return jsxRuntimeExports.jsx(LazyContext.Provider, { value: { renderer: loadedRenderer.current, strict }, children });
}
function isLazyBundle(features) {
  return typeof features === "function";
}
const validMotionProps = /* @__PURE__ */ new Set([
  "animate",
  "exit",
  "variants",
  "initial",
  "style",
  "values",
  "variants",
  "transition",
  "transformTemplate",
  "custom",
  "inherit",
  "onBeforeLayoutMeasure",
  "onAnimationStart",
  "onAnimationComplete",
  "onUpdate",
  "onDragStart",
  "onDrag",
  "onDragEnd",
  "onMeasureDragConstraints",
  "onDirectionLock",
  "onDragTransitionEnd",
  "_dragX",
  "_dragY",
  "onHoverStart",
  "onHoverEnd",
  "onViewportEnter",
  "onViewportLeave",
  "globalTapTarget",
  "ignoreStrict",
  "viewport"
]);
function isValidMotionProp(key) {
  return key.startsWith("while") || key.startsWith("drag") && key !== "draggable" || key.startsWith("layout") || key.startsWith("onTap") || key.startsWith("onPan") || key.startsWith("onLayout") || validMotionProps.has(key);
}
let shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
  if (!isValidProp)
    return;
  shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
try {
  loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
} catch (_a2) {
}
function filterProps(props, isDom, forwardMotionProps) {
  const filteredProps = {};
  for (const key in props) {
    if (key === "values" && typeof props.values === "object")
      continue;
    if (shouldForward(key) || forwardMotionProps === true && isValidMotionProp(key) || !isDom && !isValidMotionProp(key) || // If trying to use native HTML drag events, forward drag listeners
    props["draggable"] && key.startsWith("onDrag")) {
      filteredProps[key] = props[key];
    }
  }
  return filteredProps;
}
function MotionConfig({ children, isValidProp, ...config2 }) {
  isValidProp && loadExternalIsValidProp(isValidProp);
  config2 = { ...reactExports.useContext(MotionConfigContext), ...config2 };
  config2.isStatic = useConstant(() => config2.isStatic);
  const context = reactExports.useMemo(() => config2, [
    JSON.stringify(config2.transition),
    config2.transformPagePoint,
    config2.reducedMotion
  ]);
  return jsxRuntimeExports.jsx(MotionConfigContext.Provider, { value: context, children });
}
function createDOMMotionComponentProxy(componentFactory) {
  if (typeof Proxy === "undefined") {
    return componentFactory;
  }
  const componentCache = /* @__PURE__ */ new Map();
  const deprecatedFactoryFunction = (...args) => {
    return componentFactory(...args);
  };
  return new Proxy(deprecatedFactoryFunction, {
    /**
     * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
     * The prop name is passed through as `key` and we can use that to generate a `motion`
     * DOM component with that name.
     */
    get: (_target, key) => {
      if (key === "create")
        return componentFactory;
      if (!componentCache.has(key)) {
        componentCache.set(key, componentFactory(key));
      }
      return componentCache.get(key);
    }
  });
}
const MotionContext = reactExports.createContext({});
function isVariantLabel(v2) {
  return typeof v2 === "string" || Array.isArray(v2);
}
function isAnimationControls(v2) {
  return v2 !== null && typeof v2 === "object" && typeof v2.start === "function";
}
const variantPriorityOrder = [
  "animate",
  "whileInView",
  "whileFocus",
  "whileHover",
  "whileTap",
  "whileDrag",
  "exit"
];
const variantProps = ["initial", ...variantPriorityOrder];
function isControllingVariants(props) {
  return isAnimationControls(props.animate) || variantProps.some((name2) => isVariantLabel(props[name2]));
}
function isVariantNode(props) {
  return Boolean(isControllingVariants(props) || props.variants);
}
function getCurrentTreeVariants(props, context) {
  if (isControllingVariants(props)) {
    const { initial, animate } = props;
    return {
      initial: initial === false || isVariantLabel(initial) ? initial : void 0,
      animate: isVariantLabel(animate) ? animate : void 0
    };
  }
  return props.inherit !== false ? context : {};
}
function useCreateMotionContext(props) {
  const { initial, animate } = getCurrentTreeVariants(props, reactExports.useContext(MotionContext));
  return reactExports.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
  return Array.isArray(prop) ? prop.join(" ") : prop;
}
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
function isRefObject(ref) {
  return ref && typeof ref === "object" && Object.prototype.hasOwnProperty.call(ref, "current");
}
function useMotionRef(visualState, visualElement, externalRef) {
  return reactExports.useCallback(
    (instance2) => {
      if (instance2) {
        visualState.onMount && visualState.onMount(instance2);
      }
      if (visualElement) {
        if (instance2) {
          visualElement.mount(instance2);
        } else {
          visualElement.unmount();
        }
      }
      if (externalRef) {
        if (typeof externalRef === "function") {
          externalRef(instance2);
        } else if (isRefObject(externalRef)) {
          externalRef.current = instance2;
        }
      }
    },
    /**
     * Only pass a new ref callback to React if we've received a visual element
     * factory. Otherwise we'll be mounting/remounting every time externalRef
     * or other dependencies change.
     */
    [visualElement]
  );
}
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
const optimizedAppearDataId = "framerAppearId";
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
const { schedule: microtask } = createRenderBatcher(queueMicrotask, false);
const SwitchLayoutGroupContext = reactExports.createContext({});
function useVisualElement(Component2, visualState, props, createVisualElement, ProjectionNodeConstructor) {
  var _a2, _b2;
  const { visualElement: parent } = reactExports.useContext(MotionContext);
  const lazyContext = reactExports.useContext(LazyContext);
  const presenceContext = reactExports.useContext(PresenceContext);
  const reducedMotionConfig = reactExports.useContext(MotionConfigContext).reducedMotion;
  const visualElementRef = reactExports.useRef(null);
  createVisualElement = createVisualElement || lazyContext.renderer;
  if (!visualElementRef.current && createVisualElement) {
    visualElementRef.current = createVisualElement(Component2, {
      visualState,
      parent,
      props,
      presenceContext,
      blockInitialAnimation: presenceContext ? presenceContext.initial === false : false,
      reducedMotionConfig
    });
  }
  const visualElement = visualElementRef.current;
  const initialLayoutGroupConfig = reactExports.useContext(SwitchLayoutGroupContext);
  if (visualElement && !visualElement.projection && ProjectionNodeConstructor && (visualElement.type === "html" || visualElement.type === "svg")) {
    createProjectionNode$1(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
  }
  const isMounted = reactExports.useRef(false);
  reactExports.useInsertionEffect(() => {
    if (visualElement && isMounted.current) {
      visualElement.update(props, presenceContext);
    }
  });
  const optimisedAppearId = props[optimizedAppearDataAttribute];
  const wantsHandoff = reactExports.useRef(Boolean(optimisedAppearId) && !((_a2 = window.MotionHandoffIsComplete) === null || _a2 === void 0 ? void 0 : _a2.call(window, optimisedAppearId)) && ((_b2 = window.MotionHasOptimisedAnimation) === null || _b2 === void 0 ? void 0 : _b2.call(window, optimisedAppearId)));
  useIsomorphicLayoutEffect$4(() => {
    if (!visualElement)
      return;
    isMounted.current = true;
    window.MotionIsMounted = true;
    visualElement.updateFeatures();
    microtask.render(visualElement.render);
    if (wantsHandoff.current && visualElement.animationState) {
      visualElement.animationState.animateChanges();
    }
  });
  reactExports.useEffect(() => {
    if (!visualElement)
      return;
    if (!wantsHandoff.current && visualElement.animationState) {
      visualElement.animationState.animateChanges();
    }
    if (wantsHandoff.current) {
      queueMicrotask(() => {
        var _a3;
        (_a3 = window.MotionHandoffMarkAsComplete) === null || _a3 === void 0 ? void 0 : _a3.call(window, optimisedAppearId);
      });
      wantsHandoff.current = false;
    }
  });
  return visualElement;
}
function createProjectionNode$1(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
  const { layoutId, layout: layout2, drag: drag2, dragConstraints, layoutScroll, layoutRoot } = props;
  visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"] ? void 0 : getClosestProjectingNode(visualElement.parent));
  visualElement.projection.setOptions({
    layoutId,
    layout: layout2,
    alwaysMeasureLayout: Boolean(drag2) || dragConstraints && isRefObject(dragConstraints),
    visualElement,
    /**
     * TODO: Update options in an effect. This could be tricky as it'll be too late
     * to update by the time layout animations run.
     * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
     * ensuring it gets called if there's no potential layout animations.
     *
     */
    animationType: typeof layout2 === "string" ? layout2 : "both",
    initialPromotionConfig,
    layoutScroll,
    layoutRoot
  });
}
function getClosestProjectingNode(visualElement) {
  if (!visualElement)
    return void 0;
  return visualElement.options.allowProjection !== false ? visualElement.projection : getClosestProjectingNode(visualElement.parent);
}
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component: Component2 }) {
  var _a2, _b2;
  preloadedFeatures && loadFeatures$1(preloadedFeatures);
  function MotionComponent(props, externalRef) {
    let MeasureLayout2;
    const configAndProps = {
      ...reactExports.useContext(MotionConfigContext),
      ...props,
      layoutId: useLayoutId(props)
    };
    const { isStatic } = configAndProps;
    const context = useCreateMotionContext(props);
    const visualState = useVisualState(props, isStatic);
    if (!isStatic && isBrowser$3) {
      useStrictMode();
      const layoutProjection = getProjectionFunctionality(configAndProps);
      MeasureLayout2 = layoutProjection.MeasureLayout;
      context.visualElement = useVisualElement(Component2, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
    }
    return jsxRuntimeExports.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout2 && context.visualElement ? jsxRuntimeExports.jsx(MeasureLayout2, { visualElement: context.visualElement, ...configAndProps }) : null, useRender(Component2, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] });
  }
  MotionComponent.displayName = `motion.${typeof Component2 === "string" ? Component2 : `create(${(_b2 = (_a2 = Component2.displayName) !== null && _a2 !== void 0 ? _a2 : Component2.name) !== null && _b2 !== void 0 ? _b2 : ""})`}`;
  const ForwardRefMotionComponent = reactExports.forwardRef(MotionComponent);
  ForwardRefMotionComponent[motionComponentSymbol] = Component2;
  return ForwardRefMotionComponent;
}
function useLayoutId({ layoutId }) {
  const layoutGroupId = reactExports.useContext(LayoutGroupContext).id;
  return layoutGroupId && layoutId !== void 0 ? layoutGroupId + "-" + layoutId : layoutId;
}
function useStrictMode(configAndProps, preloadedFeatures) {
  reactExports.useContext(LazyContext).strict;
}
function getProjectionFunctionality(props) {
  const { drag: drag2, layout: layout2 } = featureDefinitions;
  if (!drag2 && !layout2)
    return {};
  const combined = { ...drag2, ...layout2 };
  return {
    MeasureLayout: (drag2 === null || drag2 === void 0 ? void 0 : drag2.isEnabled(props)) || (layout2 === null || layout2 === void 0 ? void 0 : layout2.isEnabled(props)) ? combined.MeasureLayout : void 0,
    ProjectionNode: combined.ProjectionNode
  };
}
const lowercaseSVGElements = [
  "animate",
  "circle",
  "defs",
  "desc",
  "ellipse",
  "g",
  "image",
  "line",
  "filter",
  "marker",
  "mask",
  "metadata",
  "path",
  "pattern",
  "polygon",
  "polyline",
  "rect",
  "stop",
  "switch",
  "symbol",
  "svg",
  "text",
  "tspan",
  "use",
  "view"
];
function isSVGComponent(Component2) {
  if (
    /**
     * If it's not a string, it's a custom React component. Currently we only support
     * HTML custom React components.
     */
    typeof Component2 !== "string" || /**
     * If it contains a dash, the element is a custom HTML webcomponent.
     */
    Component2.includes("-")
  ) {
    return false;
  } else if (
    /**
     * If it's in our list of lowercase SVG tags, it's an SVG component
     */
    lowercaseSVGElements.indexOf(Component2) > -1 || /**
     * If it contains a capital letter, it's an SVG component
     */
    /[A-Z]/u.test(Component2)
  ) {
    return true;
  }
  return false;
}
function getValueState(visualElement) {
  const state = [{}, {}];
  visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value2, key) => {
    state[0][key] = value2.get();
    state[1][key] = value2.getVelocity();
  });
  return state;
}
function resolveVariantFromProps(props, definition2, custom, visualElement) {
  if (typeof definition2 === "function") {
    const [current, velocity] = getValueState(visualElement);
    definition2 = definition2(custom !== void 0 ? custom : props.custom, current, velocity);
  }
  if (typeof definition2 === "string") {
    definition2 = props.variants && props.variants[definition2];
  }
  if (typeof definition2 === "function") {
    const [current, velocity] = getValueState(visualElement);
    definition2 = definition2(custom !== void 0 ? custom : props.custom, current, velocity);
  }
  return definition2;
}
const isKeyframesTarget = (v2) => {
  return Array.isArray(v2);
};
const isCustomValue = (v2) => {
  return Boolean(v2 && typeof v2 === "object" && v2.mix && v2.toValue);
};
const resolveFinalValueInKeyframes = (v2) => {
  return isKeyframesTarget(v2) ? v2[v2.length - 1] || 0 : v2;
};
const isMotionValue = (value2) => Boolean(value2 && value2.getVelocity);
function resolveMotionValue(value2) {
  const unwrappedValue = isMotionValue(value2) ? value2.get() : value2;
  return isCustomValue(unwrappedValue) ? unwrappedValue.toValue() : unwrappedValue;
}
function makeState({ scrapeMotionValuesFromProps: scrapeMotionValuesFromProps2, createRenderState, onUpdate }, props, context, presenceContext) {
  const state = {
    latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps2),
    renderState: createRenderState()
  };
  if (onUpdate) {
    state.onMount = (instance2) => onUpdate({ props, current: instance2, ...state });
    state.onUpdate = (visualElement) => onUpdate(visualElement);
  }
  return state;
}
const makeUseVisualState = (config2) => (props, isStatic) => {
  const context = reactExports.useContext(MotionContext);
  const presenceContext = reactExports.useContext(PresenceContext);
  const make = () => makeState(config2, props, context, presenceContext);
  return isStatic ? make() : useConstant(make);
};
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
  const values = {};
  const motionValues = scrapeMotionValues(props, {});
  for (const key in motionValues) {
    values[key] = resolveMotionValue(motionValues[key]);
  }
  let { initial, animate } = props;
  const isControllingVariants$1 = isControllingVariants(props);
  const isVariantNode$1 = isVariantNode(props);
  if (context && isVariantNode$1 && !isControllingVariants$1 && props.inherit !== false) {
    if (initial === void 0)
      initial = context.initial;
    if (animate === void 0)
      animate = context.animate;
  }
  let isInitialAnimationBlocked = presenceContext ? presenceContext.initial === false : false;
  isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
  const variantToSet = isInitialAnimationBlocked ? animate : initial;
  if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
    const list2 = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
    for (let i2 = 0; i2 < list2.length; i2++) {
      const resolved = resolveVariantFromProps(props, list2[i2]);
      if (resolved) {
        const { transitionEnd, transition: transition3, ...target } = resolved;
        for (const key in target) {
          let valueTarget = target[key];
          if (Array.isArray(valueTarget)) {
            const index2 = isInitialAnimationBlocked ? valueTarget.length - 1 : 0;
            valueTarget = valueTarget[index2];
          }
          if (valueTarget !== null) {
            values[key] = valueTarget;
          }
        }
        for (const key in transitionEnd) {
          values[key] = transitionEnd[key];
        }
      }
    }
  }
  return values;
}
const transformPropOrder = [
  "transformPerspective",
  "x",
  "y",
  "z",
  "translateX",
  "translateY",
  "translateZ",
  "scale",
  "scaleX",
  "scaleY",
  "rotate",
  "rotateX",
  "rotateY",
  "rotateZ",
  "skew",
  "skewX",
  "skewY"
];
const transformProps = new Set(transformPropOrder);
const checkStringStartsWith = (token2) => (key) => typeof key === "string" && key.startsWith(token2);
const isCSSVariableName = /* @__PURE__ */ checkStringStartsWith("--");
const startsAsVariableToken = /* @__PURE__ */ checkStringStartsWith("var(--");
const isCSSVariableToken = (value2) => {
  const startsWithToken = startsAsVariableToken(value2);
  if (!startsWithToken)
    return false;
  return singleCssVariableRegex.test(value2.split("/*")[0].trim());
};
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;
const getValueAsType = (value2, type4) => {
  return type4 && typeof value2 === "number" ? type4.transform(value2) : value2;
};
const clamp$2 = (min2, max2, v2) => {
  if (v2 > max2)
    return max2;
  if (v2 < min2)
    return min2;
  return v2;
};
const number$2 = {
  test: (v2) => typeof v2 === "number",
  parse: parseFloat,
  transform: (v2) => v2
};
const alpha$1 = {
  ...number$2,
  transform: (v2) => clamp$2(0, 1, v2)
};
const scale = {
  ...number$2,
  default: 1
};
const createUnitType = (unit2) => ({
  test: (v2) => typeof v2 === "string" && v2.endsWith(unit2) && v2.split(" ").length === 1,
  parse: parseFloat,
  transform: (v2) => `${v2}${unit2}`
});
const degrees = /* @__PURE__ */ createUnitType("deg");
const percent = /* @__PURE__ */ createUnitType("%");
const px = /* @__PURE__ */ createUnitType("px");
const vh = /* @__PURE__ */ createUnitType("vh");
const vw = /* @__PURE__ */ createUnitType("vw");
const progressPercentage = {
  ...percent,
  parse: (v2) => percent.parse(v2) / 100,
  transform: (v2) => percent.transform(v2 * 100)
};
const browserNumberValueTypes = {
  // Border props
  borderWidth: px,
  borderTopWidth: px,
  borderRightWidth: px,
  borderBottomWidth: px,
  borderLeftWidth: px,
  borderRadius: px,
  radius: px,
  borderTopLeftRadius: px,
  borderTopRightRadius: px,
  borderBottomRightRadius: px,
  borderBottomLeftRadius: px,
  // Positioning props
  width: px,
  maxWidth: px,
  height: px,
  maxHeight: px,
  top: px,
  right: px,
  bottom: px,
  left: px,
  // Spacing props
  padding: px,
  paddingTop: px,
  paddingRight: px,
  paddingBottom: px,
  paddingLeft: px,
  margin: px,
  marginTop: px,
  marginRight: px,
  marginBottom: px,
  marginLeft: px,
  // Misc
  backgroundPositionX: px,
  backgroundPositionY: px
};
const transformValueTypes = {
  rotate: degrees,
  rotateX: degrees,
  rotateY: degrees,
  rotateZ: degrees,
  scale,
  scaleX: scale,
  scaleY: scale,
  scaleZ: scale,
  skew: degrees,
  skewX: degrees,
  skewY: degrees,
  distance: px,
  translateX: px,
  translateY: px,
  translateZ: px,
  x: px,
  y: px,
  z: px,
  perspective: px,
  transformPerspective: px,
  opacity: alpha$1,
  originX: progressPercentage,
  originY: progressPercentage,
  originZ: px
};
const int$1 = {
  ...number$2,
  transform: Math.round
};
const numberValueTypes = {
  ...browserNumberValueTypes,
  ...transformValueTypes,
  zIndex: int$1,
  size: px,
  // SVG
  fillOpacity: alpha$1,
  strokeOpacity: alpha$1,
  numOctaves: int$1
};
const translateAlias = {
  x: "translateX",
  y: "translateY",
  z: "translateZ",
  transformPerspective: "perspective"
};
const numTransforms = transformPropOrder.length;
function buildTransform(latestValues, transform2, transformTemplate) {
  let transformString = "";
  let transformIsDefault = true;
  for (let i2 = 0; i2 < numTransforms; i2++) {
    const key = transformPropOrder[i2];
    const value2 = latestValues[key];
    if (value2 === void 0)
      continue;
    let valueIsDefault = true;
    if (typeof value2 === "number") {
      valueIsDefault = value2 === (key.startsWith("scale") ? 1 : 0);
    } else {
      valueIsDefault = parseFloat(value2) === 0;
    }
    if (!valueIsDefault || transformTemplate) {
      const valueAsType = getValueAsType(value2, numberValueTypes[key]);
      if (!valueIsDefault) {
        transformIsDefault = false;
        const transformName = translateAlias[key] || key;
        transformString += `${transformName}(${valueAsType}) `;
      }
      if (transformTemplate) {
        transform2[key] = valueAsType;
      }
    }
  }
  transformString = transformString.trim();
  if (transformTemplate) {
    transformString = transformTemplate(transform2, transformIsDefault ? "" : transformString);
  } else if (transformIsDefault) {
    transformString = "none";
  }
  return transformString;
}
function buildHTMLStyles(state, latestValues, transformTemplate) {
  const { style: style2, vars, transformOrigin } = state;
  let hasTransform2 = false;
  let hasTransformOrigin = false;
  for (const key in latestValues) {
    const value2 = latestValues[key];
    if (transformProps.has(key)) {
      hasTransform2 = true;
      continue;
    } else if (isCSSVariableName(key)) {
      vars[key] = value2;
      continue;
    } else {
      const valueAsType = getValueAsType(value2, numberValueTypes[key]);
      if (key.startsWith("origin")) {
        hasTransformOrigin = true;
        transformOrigin[key] = valueAsType;
      } else {
        style2[key] = valueAsType;
      }
    }
  }
  if (!latestValues.transform) {
    if (hasTransform2 || transformTemplate) {
      style2.transform = buildTransform(latestValues, state.transform, transformTemplate);
    } else if (style2.transform) {
      style2.transform = "none";
    }
  }
  if (hasTransformOrigin) {
    const { originX = "50%", originY = "50%", originZ = 0 } = transformOrigin;
    style2.transformOrigin = `${originX} ${originY} ${originZ}`;
  }
}
const dashKeys = {
  offset: "stroke-dashoffset",
  array: "stroke-dasharray"
};
const camelKeys = {
  offset: "strokeDashoffset",
  array: "strokeDasharray"
};
function buildSVGPath(attrs, length2, spacing2 = 1, offset2 = 0, useDashCase = true) {
  attrs.pathLength = 1;
  const keys2 = useDashCase ? dashKeys : camelKeys;
  attrs[keys2.offset] = px.transform(-offset2);
  const pathLength = px.transform(length2);
  const pathSpacing = px.transform(spacing2);
  attrs[keys2.array] = `${pathLength} ${pathSpacing}`;
}
function calcOrigin$1(origin2, offset2, size2) {
  return typeof origin2 === "string" ? origin2 : px.transform(offset2 + size2 * origin2);
}
function calcSVGTransformOrigin(dimensions, originX, originY) {
  const pxOriginX = calcOrigin$1(originX, dimensions.x, dimensions.width);
  const pxOriginY = calcOrigin$1(originY, dimensions.y, dimensions.height);
  return `${pxOriginX} ${pxOriginY}`;
}
function buildSVGAttrs(state, {
  attrX,
  attrY,
  attrScale,
  originX,
  originY,
  pathLength,
  pathSpacing = 1,
  pathOffset = 0,
  // This is object creation, which we try to avoid per-frame.
  ...latest
}, isSVGTag2, transformTemplate) {
  buildHTMLStyles(state, latest, transformTemplate);
  if (isSVGTag2) {
    if (state.style.viewBox) {
      state.attrs.viewBox = state.style.viewBox;
    }
    return;
  }
  state.attrs = state.style;
  state.style = {};
  const { attrs, style: style2, dimensions } = state;
  if (attrs.transform) {
    if (dimensions)
      style2.transform = attrs.transform;
    delete attrs.transform;
  }
  if (dimensions && (originX !== void 0 || originY !== void 0 || style2.transform)) {
    style2.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== void 0 ? originX : 0.5, originY !== void 0 ? originY : 0.5);
  }
  if (attrX !== void 0)
    attrs.x = attrX;
  if (attrY !== void 0)
    attrs.y = attrY;
  if (attrScale !== void 0)
    attrs.scale = attrScale;
  if (pathLength !== void 0) {
    buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
  }
}
const createHtmlRenderState = () => ({
  style: {},
  transform: {},
  transformOrigin: {},
  vars: {}
});
const createSvgRenderState = () => ({
  ...createHtmlRenderState(),
  attrs: {}
});
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
function renderHTML(element2, { style: style2, vars }, styleProp, projection) {
  Object.assign(element2.style, style2, projection && projection.getProjectionStyles(styleProp));
  for (const key in vars) {
    element2.style.setProperty(key, vars[key]);
  }
}
const camelCaseAttributes = /* @__PURE__ */ new Set([
  "baseFrequency",
  "diffuseConstant",
  "kernelMatrix",
  "kernelUnitLength",
  "keySplines",
  "keyTimes",
  "limitingConeAngle",
  "markerHeight",
  "markerWidth",
  "numOctaves",
  "targetX",
  "targetY",
  "surfaceScale",
  "specularConstant",
  "specularExponent",
  "stdDeviation",
  "tableValues",
  "viewBox",
  "gradientTransform",
  "pathLength",
  "startOffset",
  "textLength",
  "lengthAdjust"
]);
function renderSVG(element2, renderState, _styleProp, projection) {
  renderHTML(element2, renderState, void 0, projection);
  for (const key in renderState.attrs) {
    element2.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
  }
}
const scaleCorrectors = {};
function addScaleCorrector(correctors) {
  Object.assign(scaleCorrectors, correctors);
}
function isForcedMotionValue(key, { layout: layout2, layoutId }) {
  return transformProps.has(key) || key.startsWith("origin") || (layout2 || layoutId !== void 0) && (!!scaleCorrectors[key] || key === "opacity");
}
function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
  var _a2;
  const { style: style2 } = props;
  const newValues = {};
  for (const key in style2) {
    if (isMotionValue(style2[key]) || prevProps.style && isMotionValue(prevProps.style[key]) || isForcedMotionValue(key, props) || ((_a2 = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.liveStyle) !== void 0) {
      newValues[key] = style2[key];
    }
  }
  return newValues;
}
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
  const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
  for (const key in props) {
    if (isMotionValue(props[key]) || isMotionValue(prevProps[key])) {
      const targetKey = transformPropOrder.indexOf(key) !== -1 ? "attr" + key.charAt(0).toUpperCase() + key.substring(1) : key;
      newValues[targetKey] = props[key];
    }
  }
  return newValues;
}
function updateSVGDimensions(instance2, renderState) {
  try {
    renderState.dimensions = typeof instance2.getBBox === "function" ? instance2.getBBox() : instance2.getBoundingClientRect();
  } catch (e2) {
    renderState.dimensions = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
}
const layoutProps = ["x", "y", "width", "height", "cx", "cy", "r"];
const svgMotionConfig = {
  useVisualState: makeUseVisualState({
    scrapeMotionValuesFromProps,
    createRenderState: createSvgRenderState,
    onUpdate: ({ props, prevProps, current, renderState, latestValues }) => {
      if (!current)
        return;
      let hasTransform2 = !!props.drag;
      if (!hasTransform2) {
        for (const key in latestValues) {
          if (transformProps.has(key)) {
            hasTransform2 = true;
            break;
          }
        }
      }
      if (!hasTransform2)
        return;
      let needsMeasure = !prevProps;
      if (prevProps) {
        for (let i2 = 0; i2 < layoutProps.length; i2++) {
          const key = layoutProps[i2];
          if (props[key] !== prevProps[key]) {
            needsMeasure = true;
          }
        }
      }
      if (!needsMeasure)
        return;
      frame.read(() => {
        updateSVGDimensions(current, renderState);
        frame.render(() => {
          buildSVGAttrs(renderState, latestValues, isSVGTag(current.tagName), props.transformTemplate);
          renderSVG(current, renderState);
        });
      });
    }
  })
};
const htmlMotionConfig = {
  useVisualState: makeUseVisualState({
    scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
    createRenderState: createHtmlRenderState
  })
};
function copyRawValuesOnly(target, source2, props) {
  for (const key in source2) {
    if (!isMotionValue(source2[key]) && !isForcedMotionValue(key, props)) {
      target[key] = source2[key];
    }
  }
}
function useInitialMotionValues({ transformTemplate }, visualState) {
  return reactExports.useMemo(() => {
    const state = createHtmlRenderState();
    buildHTMLStyles(state, visualState, transformTemplate);
    return Object.assign({}, state.vars, state.style);
  }, [visualState]);
}
function useStyle$4(props, visualState) {
  const styleProp = props.style || {};
  const style2 = {};
  copyRawValuesOnly(style2, styleProp, props);
  Object.assign(style2, useInitialMotionValues(props, visualState));
  return style2;
}
function useHTMLProps(props, visualState) {
  const htmlProps = {};
  const style2 = useStyle$4(props, visualState);
  if (props.drag && props.dragListener !== false) {
    htmlProps.draggable = false;
    style2.userSelect = style2.WebkitUserSelect = style2.WebkitTouchCallout = "none";
    style2.touchAction = props.drag === true ? "none" : `pan-${props.drag === "x" ? "y" : "x"}`;
  }
  if (props.tabIndex === void 0 && (props.onTap || props.onTapStart || props.whileTap)) {
    htmlProps.tabIndex = 0;
  }
  htmlProps.style = style2;
  return htmlProps;
}
function useSVGProps(props, visualState, _isStatic, Component2) {
  const visualProps = reactExports.useMemo(() => {
    const state = createSvgRenderState();
    buildSVGAttrs(state, visualState, isSVGTag(Component2), props.transformTemplate);
    return {
      ...state.attrs,
      style: { ...state.style }
    };
  }, [visualState]);
  if (props.style) {
    const rawStyles = {};
    copyRawValuesOnly(rawStyles, props.style, props);
    visualProps.style = { ...rawStyles, ...visualProps.style };
  }
  return visualProps;
}
function createUseRender(forwardMotionProps = false) {
  const useRender = (Component2, props, ref, { latestValues }, isStatic) => {
    const useVisualProps = isSVGComponent(Component2) ? useSVGProps : useHTMLProps;
    const visualProps = useVisualProps(props, latestValues, isStatic, Component2);
    const filteredProps = filterProps(props, typeof Component2 === "string", forwardMotionProps);
    const elementProps = Component2 !== reactExports.Fragment ? { ...filteredProps, ...visualProps, ref } : {};
    const { children } = props;
    const renderedChildren = reactExports.useMemo(() => isMotionValue(children) ? children.get() : children, [children]);
    return reactExports.createElement(Component2, {
      ...elementProps,
      children: renderedChildren
    });
  };
  return useRender;
}
function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
  return function createMotionComponent(Component2, { forwardMotionProps } = { forwardMotionProps: false }) {
    const baseConfig2 = isSVGComponent(Component2) ? svgMotionConfig : htmlMotionConfig;
    const config2 = {
      ...baseConfig2,
      preloadedFeatures,
      useRender: createUseRender(forwardMotionProps),
      createVisualElement,
      Component: Component2
    };
    return createRendererMotionComponent(config2);
  };
}
const createMinimalMotionComponent = /* @__PURE__ */ createMotionComponentFactory();
const m$3 = /* @__PURE__ */ createDOMMotionComponentProxy(createMinimalMotionComponent);
function shallowCompare(next2, prev2) {
  if (!Array.isArray(prev2))
    return false;
  const prevLength = prev2.length;
  if (prevLength !== next2.length)
    return false;
  for (let i2 = 0; i2 < prevLength; i2++) {
    if (prev2[i2] !== next2[i2])
      return false;
  }
  return true;
}
function resolveVariant(visualElement, definition2, custom) {
  const props = visualElement.getProps();
  return resolveVariantFromProps(props, definition2, custom !== void 0 ? custom : props.custom, visualElement);
}
const supportsScrollTimeline = /* @__PURE__ */ memo$1(() => window.ScrollTimeline !== void 0);
class BaseGroupPlaybackControls {
  constructor(animations2) {
    this.stop = () => this.runAll("stop");
    this.animations = animations2.filter(Boolean);
  }
  get finished() {
    return Promise.all(this.animations.map((animation) => "finished" in animation ? animation.finished : animation));
  }
  /**
   * TODO: Filter out cancelled or stopped animations before returning
   */
  getAll(propName) {
    return this.animations[0][propName];
  }
  setAll(propName, newValue) {
    for (let i2 = 0; i2 < this.animations.length; i2++) {
      this.animations[i2][propName] = newValue;
    }
  }
  attachTimeline(timeline, fallback2) {
    const subscriptions = this.animations.map((animation) => {
      if (supportsScrollTimeline() && animation.attachTimeline) {
        return animation.attachTimeline(timeline);
      } else if (typeof fallback2 === "function") {
        return fallback2(animation);
      }
    });
    return () => {
      subscriptions.forEach((cancel2, i2) => {
        cancel2 && cancel2();
        this.animations[i2].stop();
      });
    };
  }
  get time() {
    return this.getAll("time");
  }
  set time(time2) {
    this.setAll("time", time2);
  }
  get speed() {
    return this.getAll("speed");
  }
  set speed(speed) {
    this.setAll("speed", speed);
  }
  get startTime() {
    return this.getAll("startTime");
  }
  get duration() {
    let max2 = 0;
    for (let i2 = 0; i2 < this.animations.length; i2++) {
      max2 = Math.max(max2, this.animations[i2].duration);
    }
    return max2;
  }
  runAll(methodName) {
    this.animations.forEach((controls) => controls[methodName]());
  }
  flatten() {
    this.runAll("flatten");
  }
  play() {
    this.runAll("play");
  }
  pause() {
    this.runAll("pause");
  }
  cancel() {
    this.runAll("cancel");
  }
  complete() {
    this.runAll("complete");
  }
}
class GroupPlaybackControls extends BaseGroupPlaybackControls {
  then(onResolve, onReject) {
    return Promise.all(this.animations).then(onResolve).catch(onReject);
  }
}
function getValueTransition(transition3, key) {
  return transition3 ? transition3[key] || transition3["default"] || transition3 : void 0;
}
const maxGeneratorDuration = 2e4;
function calcGeneratorDuration(generator) {
  let duration2 = 0;
  const timeStep = 50;
  let state = generator.next(duration2);
  while (!state.done && duration2 < maxGeneratorDuration) {
    duration2 += timeStep;
    state = generator.next(duration2);
  }
  return duration2 >= maxGeneratorDuration ? Infinity : duration2;
}
function isGenerator(type4) {
  return typeof type4 === "function";
}
function attachTimeline(animation, timeline) {
  animation.timeline = timeline;
  animation.onfinish = null;
}
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
const supportsFlags = {
  linearEasing: void 0
};
function memoSupports(callback2, supportsFlag) {
  const memoized = /* @__PURE__ */ memo$1(callback2);
  return () => {
    var _a2;
    return (_a2 = supportsFlags[supportsFlag]) !== null && _a2 !== void 0 ? _a2 : memoized();
  };
}
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
  try {
    document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
  } catch (e2) {
    return false;
  }
  return true;
}, "linearEasing");
const generateLinearEasing = (easing, duration2, resolution = 10) => {
  let points = "";
  const numPoints = Math.max(Math.round(duration2 / resolution), 2);
  for (let i2 = 0; i2 < numPoints; i2++) {
    points += easing(/* @__PURE__ */ progress$1(0, numPoints - 1, i2)) + ", ";
  }
  return `linear(${points.substring(0, points.length - 2)})`;
};
function isWaapiSupportedEasing(easing) {
  return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
}
const cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`;
const supportedWaapiEasing = {
  linear: "linear",
  ease: "ease",
  easeIn: "ease-in",
  easeOut: "ease-out",
  easeInOut: "ease-in-out",
  circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
  circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
  backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
  backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
};
function mapEasingToNativeEasing(easing, duration2) {
  if (!easing) {
    return void 0;
  } else if (typeof easing === "function" && supportsLinearEasing()) {
    return generateLinearEasing(easing, duration2);
  } else if (isBezierDefinition(easing)) {
    return cubicBezierAsString(easing);
  } else if (Array.isArray(easing)) {
    return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration2) || supportedWaapiEasing.easeOut);
  } else {
    return supportedWaapiEasing[easing];
  }
}
const isDragging = {
  x: false,
  y: false
};
function isDragActive() {
  return isDragging.x || isDragging.y;
}
function resolveElements(elementOrSelector, scope, selectorCache) {
  var _a2;
  if (elementOrSelector instanceof Element) {
    return [elementOrSelector];
  } else if (typeof elementOrSelector === "string") {
    let root2 = document;
    if (scope) {
      root2 = scope.current;
    }
    const elements = (_a2 = selectorCache === null || selectorCache === void 0 ? void 0 : selectorCache[elementOrSelector]) !== null && _a2 !== void 0 ? _a2 : root2.querySelectorAll(elementOrSelector);
    return elements ? Array.from(elements) : [];
  }
  return Array.from(elementOrSelector);
}
function setupGesture(elementOrSelector, options) {
  const elements = resolveElements(elementOrSelector);
  const gestureAbortController = new AbortController();
  const eventOptions = {
    passive: true,
    ...options,
    signal: gestureAbortController.signal
  };
  const cancel2 = () => gestureAbortController.abort();
  return [elements, eventOptions, cancel2];
}
function filterEvents$1(callback2) {
  return (event) => {
    if (event.pointerType === "touch" || isDragActive())
      return;
    callback2(event);
  };
}
function hover$2(elementOrSelector, onHoverStart, options = {}) {
  const [elements, eventOptions, cancel2] = setupGesture(elementOrSelector, options);
  const onPointerEnter = filterEvents$1((enterEvent) => {
    const { target } = enterEvent;
    const onHoverEnd = onHoverStart(enterEvent);
    if (typeof onHoverEnd !== "function" || !target)
      return;
    const onPointerLeave = filterEvents$1((leaveEvent) => {
      onHoverEnd(leaveEvent);
      target.removeEventListener("pointerleave", onPointerLeave);
    });
    target.addEventListener("pointerleave", onPointerLeave, eventOptions);
  });
  elements.forEach((element2) => {
    element2.addEventListener("pointerenter", onPointerEnter, eventOptions);
  });
  return cancel2;
}
const isNodeOrChild = (parent, child) => {
  if (!child) {
    return false;
  } else if (parent === child) {
    return true;
  } else {
    return isNodeOrChild(parent, child.parentElement);
  }
};
const isPrimaryPointer = (event) => {
  if (event.pointerType === "mouse") {
    return typeof event.button !== "number" || event.button <= 0;
  } else {
    return event.isPrimary !== false;
  }
};
const focusableElements = /* @__PURE__ */ new Set([
  "BUTTON",
  "INPUT",
  "SELECT",
  "TEXTAREA",
  "A"
]);
function isElementKeyboardAccessible(element2) {
  return focusableElements.has(element2.tagName) || element2.tabIndex !== -1;
}
const isPressing = /* @__PURE__ */ new WeakSet();
function filterEvents(callback2) {
  return (event) => {
    if (event.key !== "Enter")
      return;
    callback2(event);
  };
}
function firePointerEvent(target, type4) {
  target.dispatchEvent(new PointerEvent("pointer" + type4, { isPrimary: true, bubbles: true }));
}
const enableKeyboardPress = (focusEvent, eventOptions) => {
  const element2 = focusEvent.currentTarget;
  if (!element2)
    return;
  const handleKeydown = filterEvents(() => {
    if (isPressing.has(element2))
      return;
    firePointerEvent(element2, "down");
    const handleKeyup = filterEvents(() => {
      firePointerEvent(element2, "up");
    });
    const handleBlur = () => firePointerEvent(element2, "cancel");
    element2.addEventListener("keyup", handleKeyup, eventOptions);
    element2.addEventListener("blur", handleBlur, eventOptions);
  });
  element2.addEventListener("keydown", handleKeydown, eventOptions);
  element2.addEventListener("blur", () => element2.removeEventListener("keydown", handleKeydown), eventOptions);
};
function isValidPressEvent(event) {
  return isPrimaryPointer(event) && !isDragActive();
}
function press(elementOrSelector, onPressStart, options = {}) {
  const [elements, eventOptions, cancelEvents] = setupGesture(elementOrSelector, options);
  const startPress = (startEvent) => {
    const element2 = startEvent.currentTarget;
    if (!isValidPressEvent(startEvent) || isPressing.has(element2))
      return;
    isPressing.add(element2);
    const onPressEnd = onPressStart(startEvent);
    const onPointerEnd = (endEvent, success) => {
      window.removeEventListener("pointerup", onPointerUp);
      window.removeEventListener("pointercancel", onPointerCancel);
      if (!isValidPressEvent(endEvent) || !isPressing.has(element2)) {
        return;
      }
      isPressing.delete(element2);
      if (typeof onPressEnd === "function") {
        onPressEnd(endEvent, { success });
      }
    };
    const onPointerUp = (upEvent) => {
      onPointerEnd(upEvent, options.useGlobalTarget || isNodeOrChild(element2, upEvent.target));
    };
    const onPointerCancel = (cancelEvent) => {
      onPointerEnd(cancelEvent, false);
    };
    window.addEventListener("pointerup", onPointerUp, eventOptions);
    window.addEventListener("pointercancel", onPointerCancel, eventOptions);
  };
  elements.forEach((element2) => {
    if (!isElementKeyboardAccessible(element2) && element2.getAttribute("tabindex") === null) {
      element2.tabIndex = 0;
    }
    const target = options.useGlobalTarget ? window : element2;
    target.addEventListener("pointerdown", startPress, eventOptions);
    element2.addEventListener("focus", (event) => enableKeyboardPress(event, eventOptions), eventOptions);
  });
  return cancelEvents;
}
function setDragLock(axis) {
  if (axis === "x" || axis === "y") {
    if (isDragging[axis]) {
      return null;
    } else {
      isDragging[axis] = true;
      return () => {
        isDragging[axis] = false;
      };
    }
  } else {
    if (isDragging.x || isDragging.y) {
      return null;
    } else {
      isDragging.x = isDragging.y = true;
      return () => {
        isDragging.x = isDragging.y = false;
      };
    }
  }
}
const positionalKeys = /* @__PURE__ */ new Set([
  "width",
  "height",
  "top",
  "left",
  "right",
  "bottom",
  ...transformPropOrder
]);
let now$2;
function clearTime() {
  now$2 = void 0;
}
const time = {
  now: () => {
    if (now$2 === void 0) {
      time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming ? frameData.timestamp : performance.now());
    }
    return now$2;
  },
  set: (newTime) => {
    now$2 = newTime;
    queueMicrotask(clearTime);
  }
};
function addUniqueItem(arr, item) {
  if (arr.indexOf(item) === -1)
    arr.push(item);
}
function removeItem(arr, item) {
  const index2 = arr.indexOf(item);
  if (index2 > -1)
    arr.splice(index2, 1);
}
function moveItem([...arr], fromIndex, toIndex) {
  const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
  if (startIndex >= 0 && startIndex < arr.length) {
    const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
    const [item] = arr.splice(fromIndex, 1);
    arr.splice(endIndex, 0, item);
  }
  return arr;
}
class SubscriptionManager {
  constructor() {
    this.subscriptions = [];
  }
  add(handler) {
    addUniqueItem(this.subscriptions, handler);
    return () => removeItem(this.subscriptions, handler);
  }
  notify(a2, b2, c2) {
    const numSubscriptions = this.subscriptions.length;
    if (!numSubscriptions)
      return;
    if (numSubscriptions === 1) {
      this.subscriptions[0](a2, b2, c2);
    } else {
      for (let i2 = 0; i2 < numSubscriptions; i2++) {
        const handler = this.subscriptions[i2];
        handler && handler(a2, b2, c2);
      }
    }
  }
  getSize() {
    return this.subscriptions.length;
  }
  clear() {
    this.subscriptions.length = 0;
  }
}
function velocityPerSecond(velocity, frameDuration) {
  return frameDuration ? velocity * (1e3 / frameDuration) : 0;
}
const MAX_VELOCITY_DELTA = 30;
const isFloat = (value2) => {
  return !isNaN(parseFloat(value2));
};
const collectMotionValues = {
  current: void 0
};
class MotionValue {
  /**
   * @param init - The initiating value
   * @param config - Optional configuration options
   *
   * -  `transformer`: A function to transform incoming values with.
   *
   * @internal
   */
  constructor(init2, options = {}) {
    this.version = "11.18.2";
    this.canTrackVelocity = null;
    this.events = {};
    this.updateAndNotify = (v2, render3 = true) => {
      const currentTime = time.now();
      if (this.updatedAt !== currentTime) {
        this.setPrevFrameValue();
      }
      this.prev = this.current;
      this.setCurrent(v2);
      if (this.current !== this.prev && this.events.change) {
        this.events.change.notify(this.current);
      }
      if (render3 && this.events.renderRequest) {
        this.events.renderRequest.notify(this.current);
      }
    };
    this.hasAnimated = false;
    this.setCurrent(init2);
    this.owner = options.owner;
  }
  setCurrent(current) {
    this.current = current;
    this.updatedAt = time.now();
    if (this.canTrackVelocity === null && current !== void 0) {
      this.canTrackVelocity = isFloat(this.current);
    }
  }
  setPrevFrameValue(prevFrameValue = this.current) {
    this.prevFrameValue = prevFrameValue;
    this.prevUpdatedAt = this.updatedAt;
  }
  /**
   * Adds a function that will be notified when the `MotionValue` is updated.
   *
   * It returns a function that, when called, will cancel the subscription.
   *
   * When calling `onChange` inside a React component, it should be wrapped with the
   * `useEffect` hook. As it returns an unsubscribe function, this should be returned
   * from the `useEffect` function to ensure you don't add duplicate subscribers..
   *
   * ```jsx
   * export const MyComponent = () => {
   *   const x = useMotionValue(0)
   *   const y = useMotionValue(0)
   *   const opacity = useMotionValue(1)
   *
   *   useEffect(() => {
   *     function updateOpacity() {
   *       const maxXY = Math.max(x.get(), y.get())
   *       const newOpacity = transform(maxXY, [0, 100], [1, 0])
   *       opacity.set(newOpacity)
   *     }
   *
   *     const unsubscribeX = x.on("change", updateOpacity)
   *     const unsubscribeY = y.on("change", updateOpacity)
   *
   *     return () => {
   *       unsubscribeX()
   *       unsubscribeY()
   *     }
   *   }, [])
   *
   *   return <motion.div style={{ x }} />
   * }
   * ```
   *
   * @param subscriber - A function that receives the latest value.
   * @returns A function that, when called, will cancel this subscription.
   *
   * @deprecated
   */
  onChange(subscription) {
    return this.on("change", subscription);
  }
  on(eventName, callback2) {
    if (!this.events[eventName]) {
      this.events[eventName] = new SubscriptionManager();
    }
    const unsubscribe = this.events[eventName].add(callback2);
    if (eventName === "change") {
      return () => {
        unsubscribe();
        frame.read(() => {
          if (!this.events.change.getSize()) {
            this.stop();
          }
        });
      };
    }
    return unsubscribe;
  }
  clearListeners() {
    for (const eventManagers in this.events) {
      this.events[eventManagers].clear();
    }
  }
  /**
   * Attaches a passive effect to the `MotionValue`.
   *
   * @internal
   */
  attach(passiveEffect, stopPassiveEffect) {
    this.passiveEffect = passiveEffect;
    this.stopPassiveEffect = stopPassiveEffect;
  }
  /**
   * Sets the state of the `MotionValue`.
   *
   * @remarks
   *
   * ```jsx
   * const x = useMotionValue(0)
   * x.set(10)
   * ```
   *
   * @param latest - Latest value to set.
   * @param render - Whether to notify render subscribers. Defaults to `true`
   *
   * @public
   */
  set(v2, render3 = true) {
    if (!render3 || !this.passiveEffect) {
      this.updateAndNotify(v2, render3);
    } else {
      this.passiveEffect(v2, this.updateAndNotify);
    }
  }
  setWithVelocity(prev2, current, delta) {
    this.set(current);
    this.prev = void 0;
    this.prevFrameValue = prev2;
    this.prevUpdatedAt = this.updatedAt - delta;
  }
  /**
   * Set the state of the `MotionValue`, stopping any active animations,
   * effects, and resets velocity to `0`.
   */
  jump(v2, endAnimation = true) {
    this.updateAndNotify(v2);
    this.prev = v2;
    this.prevUpdatedAt = this.prevFrameValue = void 0;
    endAnimation && this.stop();
    if (this.stopPassiveEffect)
      this.stopPassiveEffect();
  }
  /**
   * Returns the latest state of `MotionValue`
   *
   * @returns - The latest state of `MotionValue`
   *
   * @public
   */
  get() {
    if (collectMotionValues.current) {
      collectMotionValues.current.push(this);
    }
    return this.current;
  }
  /**
   * @public
   */
  getPrevious() {
    return this.prev;
  }
  /**
   * Returns the latest velocity of `MotionValue`
   *
   * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
   *
   * @public
   */
  getVelocity() {
    const currentTime = time.now();
    if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
      return 0;
    }
    const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
    return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
  }
  /**
   * Registers a new animation to control this `MotionValue`. Only one
   * animation can drive a `MotionValue` at one time.
   *
   * ```jsx
   * value.start()
   * ```
   *
   * @param animation - A function that starts the provided animation
   *
   * @internal
   */
  start(startAnimation) {
    this.stop();
    return new Promise((resolve2) => {
      this.hasAnimated = true;
      this.animation = startAnimation(resolve2);
      if (this.events.animationStart) {
        this.events.animationStart.notify();
      }
    }).then(() => {
      if (this.events.animationComplete) {
        this.events.animationComplete.notify();
      }
      this.clearAnimation();
    });
  }
  /**
   * Stop the currently active animation.
   *
   * @public
   */
  stop() {
    if (this.animation) {
      this.animation.stop();
      if (this.events.animationCancel) {
        this.events.animationCancel.notify();
      }
    }
    this.clearAnimation();
  }
  /**
   * Returns `true` if this value is currently animating.
   *
   * @public
   */
  isAnimating() {
    return !!this.animation;
  }
  clearAnimation() {
    delete this.animation;
  }
  /**
   * Destroy and clean up subscribers to this `MotionValue`.
   *
   * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
   * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
   * created a `MotionValue` via the `motionValue` function.
   *
   * @public
   */
  destroy() {
    this.clearListeners();
    this.stop();
    if (this.stopPassiveEffect) {
      this.stopPassiveEffect();
    }
  }
}
function motionValue(init2, options) {
  return new MotionValue(init2, options);
}
function setMotionValue(visualElement, key, value2) {
  if (visualElement.hasValue(key)) {
    visualElement.getValue(key).set(value2);
  } else {
    visualElement.addValue(key, motionValue(value2));
  }
}
function setTarget(visualElement, definition2) {
  const resolved = resolveVariant(visualElement, definition2);
  let { transitionEnd = {}, transition: transition3 = {}, ...target } = resolved || {};
  target = { ...target, ...transitionEnd };
  for (const key in target) {
    const value2 = resolveFinalValueInKeyframes(target[key]);
    setMotionValue(visualElement, key, value2);
  }
}
function isWillChangeMotionValue(value2) {
  return Boolean(isMotionValue(value2) && value2.add);
}
function addValueToWillChange(visualElement, key) {
  const willChange = visualElement.getValue("willChange");
  if (isWillChangeMotionValue(willChange)) {
    return willChange.add(key);
  }
}
function getOptimisedAppearId(visualElement) {
  return visualElement.props[optimizedAppearDataAttribute];
}
const instantAnimationState = {
  current: false
};
const calcBezier = (t2, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t2 + (3 * a2 - 6 * a1)) * t2 + 3 * a1) * t2;
const subdivisionPrecision = 1e-7;
const subdivisionMaxIterations = 12;
function binarySubdivide(x2, lowerBound, upperBound, mX1, mX2) {
  let currentX;
  let currentT;
  let i2 = 0;
  do {
    currentT = lowerBound + (upperBound - lowerBound) / 2;
    currentX = calcBezier(currentT, mX1, mX2) - x2;
    if (currentX > 0) {
      upperBound = currentT;
    } else {
      lowerBound = currentT;
    }
  } while (Math.abs(currentX) > subdivisionPrecision && ++i2 < subdivisionMaxIterations);
  return currentT;
}
function cubicBezier(mX1, mY1, mX2, mY2) {
  if (mX1 === mY1 && mX2 === mY2)
    return noop$a;
  const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
  return (t2) => t2 === 0 || t2 === 1 ? t2 : calcBezier(getTForX(t2), mY1, mY2);
}
const mirrorEasing = (easing) => (p2) => p2 <= 0.5 ? easing(2 * p2) / 2 : (2 - easing(2 * (1 - p2))) / 2;
const reverseEasing = (easing) => (p2) => 1 - easing(1 - p2);
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
const backIn = /* @__PURE__ */ reverseEasing(backOut);
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
const anticipate = (p2) => (p2 *= 2) < 1 ? 0.5 * backIn(p2) : 0.5 * (2 - Math.pow(2, -10 * (p2 - 1)));
const circIn = (p2) => 1 - Math.sin(Math.acos(p2));
const circOut = reverseEasing(circIn);
const circInOut = mirrorEasing(circIn);
const isZeroValueString = (v2) => /^0[^.\s]+$/u.test(v2);
function isNone(value2) {
  if (typeof value2 === "number") {
    return value2 === 0;
  } else if (value2 !== null) {
    return value2 === "none" || value2 === "0" || isZeroValueString(value2);
  } else {
    return true;
  }
}
const sanitize = (v2) => Math.round(v2 * 1e5) / 1e5;
const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;
function isNullish(v2) {
  return v2 == null;
}
const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;
const isColorString = (type4, testProp) => (v2) => {
  return Boolean(typeof v2 === "string" && singleColorRegex.test(v2) && v2.startsWith(type4) || testProp && !isNullish(v2) && Object.prototype.hasOwnProperty.call(v2, testProp));
};
const splitColor = (aName, bName, cName) => (v2) => {
  if (typeof v2 !== "string")
    return v2;
  const [a2, b2, c2, alpha2] = v2.match(floatRegex);
  return {
    [aName]: parseFloat(a2),
    [bName]: parseFloat(b2),
    [cName]: parseFloat(c2),
    alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
  };
};
const clampRgbUnit = (v2) => clamp$2(0, 255, v2);
const rgbUnit = {
  ...number$2,
  transform: (v2) => Math.round(clampRgbUnit(v2))
};
const rgba = {
  test: /* @__PURE__ */ isColorString("rgb", "red"),
  parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
  transform: ({ red: red2, green: green2, blue: blue2, alpha: alpha$1$1 = 1 }) => "rgba(" + rgbUnit.transform(red2) + ", " + rgbUnit.transform(green2) + ", " + rgbUnit.transform(blue2) + ", " + sanitize(alpha$1.transform(alpha$1$1)) + ")"
};
function parseHex(v2) {
  let r2 = "";
  let g2 = "";
  let b2 = "";
  let a2 = "";
  if (v2.length > 5) {
    r2 = v2.substring(1, 3);
    g2 = v2.substring(3, 5);
    b2 = v2.substring(5, 7);
    a2 = v2.substring(7, 9);
  } else {
    r2 = v2.substring(1, 2);
    g2 = v2.substring(2, 3);
    b2 = v2.substring(3, 4);
    a2 = v2.substring(4, 5);
    r2 += r2;
    g2 += g2;
    b2 += b2;
    a2 += a2;
  }
  return {
    red: parseInt(r2, 16),
    green: parseInt(g2, 16),
    blue: parseInt(b2, 16),
    alpha: a2 ? parseInt(a2, 16) / 255 : 1
  };
}
const hex$1 = {
  test: /* @__PURE__ */ isColorString("#"),
  parse: parseHex,
  transform: rgba.transform
};
const hsla = {
  test: /* @__PURE__ */ isColorString("hsl", "hue"),
  parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
  transform: ({ hue: hue2, saturation, lightness, alpha: alpha$1$1 = 1 }) => {
    return "hsla(" + Math.round(hue2) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha$1.transform(alpha$1$1)) + ")";
  }
};
const color$2 = {
  test: (v2) => rgba.test(v2) || hex$1.test(v2) || hsla.test(v2),
  parse: (v2) => {
    if (rgba.test(v2)) {
      return rgba.parse(v2);
    } else if (hsla.test(v2)) {
      return hsla.parse(v2);
    } else {
      return hex$1.parse(v2);
    }
  },
  transform: (v2) => {
    return typeof v2 === "string" ? v2 : v2.hasOwnProperty("red") ? rgba.transform(v2) : hsla.transform(v2);
  }
};
const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;
function test$1(v2) {
  var _a2, _b2;
  return isNaN(v2) && typeof v2 === "string" && (((_a2 = v2.match(floatRegex)) === null || _a2 === void 0 ? void 0 : _a2.length) || 0) + (((_b2 = v2.match(colorRegex)) === null || _b2 === void 0 ? void 0 : _b2.length) || 0) > 0;
}
const NUMBER_TOKEN = "number";
const COLOR_TOKEN = "color";
const VAR_TOKEN = "var";
const VAR_FUNCTION_TOKEN = "var(";
const SPLIT_TOKEN = "${}";
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
function analyseComplexValue(value2) {
  const originalValue = value2.toString();
  const values = [];
  const indexes = {
    color: [],
    number: [],
    var: []
  };
  const types2 = [];
  let i2 = 0;
  const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
    if (color$2.test(parsedValue)) {
      indexes.color.push(i2);
      types2.push(COLOR_TOKEN);
      values.push(color$2.parse(parsedValue));
    } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
      indexes.var.push(i2);
      types2.push(VAR_TOKEN);
      values.push(parsedValue);
    } else {
      indexes.number.push(i2);
      types2.push(NUMBER_TOKEN);
      values.push(parseFloat(parsedValue));
    }
    ++i2;
    return SPLIT_TOKEN;
  });
  const split2 = tokenised.split(SPLIT_TOKEN);
  return { values, split: split2, indexes, types: types2 };
}
function parseComplexValue(v2) {
  return analyseComplexValue(v2).values;
}
function createTransformer(source2) {
  const { split: split2, types: types2 } = analyseComplexValue(source2);
  const numSections = split2.length;
  return (v2) => {
    let output2 = "";
    for (let i2 = 0; i2 < numSections; i2++) {
      output2 += split2[i2];
      if (v2[i2] !== void 0) {
        const type4 = types2[i2];
        if (type4 === NUMBER_TOKEN) {
          output2 += sanitize(v2[i2]);
        } else if (type4 === COLOR_TOKEN) {
          output2 += color$2.transform(v2[i2]);
        } else {
          output2 += v2[i2];
        }
      }
    }
    return output2;
  };
}
const convertNumbersToZero = (v2) => typeof v2 === "number" ? 0 : v2;
function getAnimatableNone$1(v2) {
  const parsed = parseComplexValue(v2);
  const transformer = createTransformer(v2);
  return transformer(parsed.map(convertNumbersToZero));
}
const complex = {
  test: test$1,
  parse: parseComplexValue,
  createTransformer,
  getAnimatableNone: getAnimatableNone$1
};
const maxDefaults = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
function applyDefaultFilter(v2) {
  const [name2, value2] = v2.slice(0, -1).split("(");
  if (name2 === "drop-shadow")
    return v2;
  const [number4] = value2.match(floatRegex) || [];
  if (!number4)
    return v2;
  const unit2 = value2.replace(number4, "");
  let defaultValue2 = maxDefaults.has(name2) ? 1 : 0;
  if (number4 !== value2)
    defaultValue2 *= 100;
  return name2 + "(" + defaultValue2 + unit2 + ")";
}
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
const filter = {
  ...complex,
  getAnimatableNone: (v2) => {
    const functions = v2.match(functionRegex);
    return functions ? functions.map(applyDefaultFilter).join(" ") : v2;
  }
};
const defaultValueTypes = {
  ...numberValueTypes,
  // Color props
  color: color$2,
  backgroundColor: color$2,
  outlineColor: color$2,
  fill: color$2,
  stroke: color$2,
  // Border props
  borderColor: color$2,
  borderTopColor: color$2,
  borderRightColor: color$2,
  borderBottomColor: color$2,
  borderLeftColor: color$2,
  filter,
  WebkitFilter: filter
};
const getDefaultValueType = (key) => defaultValueTypes[key];
function getAnimatableNone(key, value2) {
  let defaultValueType = getDefaultValueType(key);
  if (defaultValueType !== filter)
    defaultValueType = complex;
  return defaultValueType.getAnimatableNone ? defaultValueType.getAnimatableNone(value2) : void 0;
}
const invalidTemplates = /* @__PURE__ */ new Set(["auto", "none", "0"]);
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name2) {
  let i2 = 0;
  let animatableTemplate = void 0;
  while (i2 < unresolvedKeyframes.length && !animatableTemplate) {
    const keyframe = unresolvedKeyframes[i2];
    if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) {
      animatableTemplate = unresolvedKeyframes[i2];
    }
    i2++;
  }
  if (animatableTemplate && name2) {
    for (const noneIndex of noneKeyframeIndexes) {
      unresolvedKeyframes[noneIndex] = getAnimatableNone(name2, animatableTemplate);
    }
  }
}
const isNumOrPxType = (v2) => v2 === number$2 || v2 === px;
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform: transform2 }) => {
  if (transform2 === "none" || !transform2)
    return 0;
  const matrix3d = transform2.match(/^matrix3d\((.+)\)$/u);
  if (matrix3d) {
    return getPosFromMatrix(matrix3d[1], pos3);
  } else {
    const matrix = transform2.match(/^matrix\((.+)\)$/u);
    if (matrix) {
      return getPosFromMatrix(matrix[1], pos2);
    } else {
      return 0;
    }
  }
};
const transformKeys = /* @__PURE__ */ new Set(["x", "y", "z"]);
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
function removeNonTranslationalTransform(visualElement) {
  const removedTransforms = [];
  nonTranslationalTransformKeys.forEach((key) => {
    const value2 = visualElement.getValue(key);
    if (value2 !== void 0) {
      removedTransforms.push([key, value2.get()]);
      value2.set(key.startsWith("scale") ? 1 : 0);
    }
  });
  return removedTransforms;
}
const positionalValues = {
  // Dimensions
  width: ({ x: x2 }, { paddingLeft = "0", paddingRight = "0" }) => x2.max - x2.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
  height: ({ y: y2 }, { paddingTop = "0", paddingBottom = "0" }) => y2.max - y2.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
  top: (_bbox, { top: top2 }) => parseFloat(top2),
  left: (_bbox, { left: left2 }) => parseFloat(left2),
  bottom: ({ y: y2 }, { top: top2 }) => parseFloat(top2) + (y2.max - y2.min),
  right: ({ x: x2 }, { left: left2 }) => parseFloat(left2) + (x2.max - x2.min),
  // Transform
  x: getTranslateFromMatrix(4, 13),
  y: getTranslateFromMatrix(5, 14)
};
positionalValues.translateX = positionalValues.x;
positionalValues.translateY = positionalValues.y;
const toResolve = /* @__PURE__ */ new Set();
let isScheduled = false;
let anyNeedsMeasurement = false;
function measureAllKeyframes() {
  if (anyNeedsMeasurement) {
    const resolversToMeasure = Array.from(toResolve).filter((resolver2) => resolver2.needsMeasurement);
    const elementsToMeasure = new Set(resolversToMeasure.map((resolver2) => resolver2.element));
    const transformsToRestore = /* @__PURE__ */ new Map();
    elementsToMeasure.forEach((element2) => {
      const removedTransforms = removeNonTranslationalTransform(element2);
      if (!removedTransforms.length)
        return;
      transformsToRestore.set(element2, removedTransforms);
      element2.render();
    });
    resolversToMeasure.forEach((resolver2) => resolver2.measureInitialState());
    elementsToMeasure.forEach((element2) => {
      element2.render();
      const restore = transformsToRestore.get(element2);
      if (restore) {
        restore.forEach(([key, value2]) => {
          var _a2;
          (_a2 = element2.getValue(key)) === null || _a2 === void 0 ? void 0 : _a2.set(value2);
        });
      }
    });
    resolversToMeasure.forEach((resolver2) => resolver2.measureEndState());
    resolversToMeasure.forEach((resolver2) => {
      if (resolver2.suspendedScrollY !== void 0) {
        window.scrollTo(0, resolver2.suspendedScrollY);
      }
    });
  }
  anyNeedsMeasurement = false;
  isScheduled = false;
  toResolve.forEach((resolver2) => resolver2.complete());
  toResolve.clear();
}
function readAllKeyframes() {
  toResolve.forEach((resolver2) => {
    resolver2.readKeyframes();
    if (resolver2.needsMeasurement) {
      anyNeedsMeasurement = true;
    }
  });
}
function flushKeyframeResolvers() {
  readAllKeyframes();
  measureAllKeyframes();
}
class KeyframeResolver {
  constructor(unresolvedKeyframes, onComplete, name2, motionValue2, element2, isAsync = false) {
    this.isComplete = false;
    this.isAsync = false;
    this.needsMeasurement = false;
    this.isScheduled = false;
    this.unresolvedKeyframes = [...unresolvedKeyframes];
    this.onComplete = onComplete;
    this.name = name2;
    this.motionValue = motionValue2;
    this.element = element2;
    this.isAsync = isAsync;
  }
  scheduleResolve() {
    this.isScheduled = true;
    if (this.isAsync) {
      toResolve.add(this);
      if (!isScheduled) {
        isScheduled = true;
        frame.read(readAllKeyframes);
        frame.resolveKeyframes(measureAllKeyframes);
      }
    } else {
      this.readKeyframes();
      this.complete();
    }
  }
  readKeyframes() {
    const { unresolvedKeyframes, name: name2, element: element2, motionValue: motionValue2 } = this;
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      if (unresolvedKeyframes[i2] === null) {
        if (i2 === 0) {
          const currentValue = motionValue2 === null || motionValue2 === void 0 ? void 0 : motionValue2.get();
          const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
          if (currentValue !== void 0) {
            unresolvedKeyframes[0] = currentValue;
          } else if (element2 && name2) {
            const valueAsRead = element2.readValue(name2, finalKeyframe);
            if (valueAsRead !== void 0 && valueAsRead !== null) {
              unresolvedKeyframes[0] = valueAsRead;
            }
          }
          if (unresolvedKeyframes[0] === void 0) {
            unresolvedKeyframes[0] = finalKeyframe;
          }
          if (motionValue2 && currentValue === void 0) {
            motionValue2.set(unresolvedKeyframes[0]);
          }
        } else {
          unresolvedKeyframes[i2] = unresolvedKeyframes[i2 - 1];
        }
      }
    }
  }
  setFinalKeyframe() {
  }
  measureInitialState() {
  }
  renderEndStyles() {
  }
  measureEndState() {
  }
  complete() {
    this.isComplete = true;
    this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
    toResolve.delete(this);
  }
  cancel() {
    if (!this.isComplete) {
      this.isScheduled = false;
      toResolve.delete(this);
    }
  }
  resume() {
    if (!this.isComplete)
      this.scheduleResolve();
  }
}
const isNumericalString = (v2) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v2);
const splitCSSVariableRegex = (
  // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
  /^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u
);
function parseCSSVariable(current) {
  const match5 = splitCSSVariableRegex.exec(current);
  if (!match5)
    return [,];
  const [, token1, token2, fallback2] = match5;
  return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback2];
}
function getVariableValue(current, element2, depth = 1) {
  const [token2, fallback2] = parseCSSVariable(current);
  if (!token2)
    return;
  const resolved = window.getComputedStyle(element2).getPropertyValue(token2);
  if (resolved) {
    const trimmed = resolved.trim();
    return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
  }
  return isCSSVariableToken(fallback2) ? getVariableValue(fallback2, element2, depth + 1) : fallback2;
}
const testValueType = (v2) => (type4) => type4.test(v2);
const auto = {
  test: (v2) => v2 === "auto",
  parse: (v2) => v2
};
const dimensionValueTypes = [number$2, px, percent, degrees, vw, vh, auto];
const findDimensionValueType = (v2) => dimensionValueTypes.find(testValueType(v2));
class DOMKeyframesResolver extends KeyframeResolver {
  constructor(unresolvedKeyframes, onComplete, name2, motionValue2, element2) {
    super(unresolvedKeyframes, onComplete, name2, motionValue2, element2, true);
  }
  readKeyframes() {
    const { unresolvedKeyframes, element: element2, name: name2 } = this;
    if (!element2 || !element2.current)
      return;
    super.readKeyframes();
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      let keyframe = unresolvedKeyframes[i2];
      if (typeof keyframe === "string") {
        keyframe = keyframe.trim();
        if (isCSSVariableToken(keyframe)) {
          const resolved = getVariableValue(keyframe, element2.current);
          if (resolved !== void 0) {
            unresolvedKeyframes[i2] = resolved;
          }
          if (i2 === unresolvedKeyframes.length - 1) {
            this.finalKeyframe = keyframe;
          }
        }
      }
    }
    this.resolveNoneKeyframes();
    if (!positionalKeys.has(name2) || unresolvedKeyframes.length !== 2) {
      return;
    }
    const [origin2, target] = unresolvedKeyframes;
    const originType = findDimensionValueType(origin2);
    const targetType = findDimensionValueType(target);
    if (originType === targetType)
      return;
    if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
      for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
        const value2 = unresolvedKeyframes[i2];
        if (typeof value2 === "string") {
          unresolvedKeyframes[i2] = parseFloat(value2);
        }
      }
    } else {
      this.needsMeasurement = true;
    }
  }
  resolveNoneKeyframes() {
    const { unresolvedKeyframes, name: name2 } = this;
    const noneKeyframeIndexes = [];
    for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
      if (isNone(unresolvedKeyframes[i2])) {
        noneKeyframeIndexes.push(i2);
      }
    }
    if (noneKeyframeIndexes.length) {
      makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name2);
    }
  }
  measureInitialState() {
    const { element: element2, unresolvedKeyframes, name: name2 } = this;
    if (!element2 || !element2.current)
      return;
    if (name2 === "height") {
      this.suspendedScrollY = window.pageYOffset;
    }
    this.measuredOrigin = positionalValues[name2](element2.measureViewportBox(), window.getComputedStyle(element2.current));
    unresolvedKeyframes[0] = this.measuredOrigin;
    const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
    if (measureKeyframe !== void 0) {
      element2.getValue(name2, measureKeyframe).jump(measureKeyframe, false);
    }
  }
  measureEndState() {
    var _a2;
    const { element: element2, name: name2, unresolvedKeyframes } = this;
    if (!element2 || !element2.current)
      return;
    const value2 = element2.getValue(name2);
    value2 && value2.jump(this.measuredOrigin, false);
    const finalKeyframeIndex = unresolvedKeyframes.length - 1;
    const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
    unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name2](element2.measureViewportBox(), window.getComputedStyle(element2.current));
    if (finalKeyframe !== null && this.finalKeyframe === void 0) {
      this.finalKeyframe = finalKeyframe;
    }
    if ((_a2 = this.removedTransforms) === null || _a2 === void 0 ? void 0 : _a2.length) {
      this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
        element2.getValue(unsetTransformName).set(unsetTransformValue);
      });
    }
    this.resolveNoneKeyframes();
  }
}
const isAnimatable = (value2, name2) => {
  if (name2 === "zIndex")
    return false;
  if (typeof value2 === "number" || Array.isArray(value2))
    return true;
  if (typeof value2 === "string" && // It's animatable if we have a string
  (complex.test(value2) || value2 === "0") && // And it contains numbers and/or colors
  !value2.startsWith("url(")) {
    return true;
  }
  return false;
};
function hasKeyframesChanged(keyframes2) {
  const current = keyframes2[0];
  if (keyframes2.length === 1)
    return true;
  for (let i2 = 0; i2 < keyframes2.length; i2++) {
    if (keyframes2[i2] !== current)
      return true;
  }
}
function canAnimate(keyframes2, name2, type4, velocity) {
  const originKeyframe = keyframes2[0];
  if (originKeyframe === null)
    return false;
  if (name2 === "display" || name2 === "visibility")
    return true;
  const targetKeyframe = keyframes2[keyframes2.length - 1];
  const isOriginAnimatable = isAnimatable(originKeyframe, name2);
  const isTargetAnimatable = isAnimatable(targetKeyframe, name2);
  if (!isOriginAnimatable || !isTargetAnimatable) {
    return false;
  }
  return hasKeyframesChanged(keyframes2) || (type4 === "spring" || isGenerator(type4)) && velocity;
}
const isNotNull = (value2) => value2 !== null;
function getFinalKeyframe(keyframes2, { repeat, repeatType = "loop" }, finalKeyframe) {
  const resolvedKeyframes = keyframes2.filter(isNotNull);
  const index2 = repeat && repeatType !== "loop" && repeat % 2 === 1 ? 0 : resolvedKeyframes.length - 1;
  return !index2 || finalKeyframe === void 0 ? resolvedKeyframes[index2] : finalKeyframe;
}
const MAX_RESOLVE_DELAY = 40;
class BaseAnimation {
  constructor({ autoplay = true, delay: delay2 = 0, type: type4 = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
    this.isStopped = false;
    this.hasAttemptedResolve = false;
    this.createdAt = time.now();
    this.options = {
      autoplay,
      delay: delay2,
      type: type4,
      repeat,
      repeatDelay,
      repeatType,
      ...options
    };
    this.updateFinishedPromise();
  }
  /**
   * This method uses the createdAt and resolvedAt to calculate the
   * animation startTime. *Ideally*, we would use the createdAt time as t=0
   * as the following frame would then be the first frame of the animation in
   * progress, which would feel snappier.
   *
   * However, if there's a delay (main thread work) between the creation of
   * the animation and the first commited frame, we prefer to use resolvedAt
   * to avoid a sudden jump into the animation.
   */
  calcStartTime() {
    if (!this.resolvedAt)
      return this.createdAt;
    return this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY ? this.resolvedAt : this.createdAt;
  }
  /**
   * A getter for resolved data. If keyframes are not yet resolved, accessing
   * this.resolved will synchronously flush all pending keyframe resolvers.
   * This is a deoptimisation, but at its worst still batches read/writes.
   */
  get resolved() {
    if (!this._resolved && !this.hasAttemptedResolve) {
      flushKeyframeResolvers();
    }
    return this._resolved;
  }
  /**
   * A method to be called when the keyframes resolver completes. This method
   * will check if its possible to run the animation and, if not, skip it.
   * Otherwise, it will call initPlayback on the implementing class.
   */
  onKeyframesResolved(keyframes2, finalKeyframe) {
    this.resolvedAt = time.now();
    this.hasAttemptedResolve = true;
    const { name: name2, type: type4, velocity, delay: delay2, onComplete, onUpdate, isGenerator: isGenerator2 } = this.options;
    if (!isGenerator2 && !canAnimate(keyframes2, name2, type4, velocity)) {
      if (instantAnimationState.current || !delay2) {
        onUpdate && onUpdate(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
        onComplete && onComplete();
        this.resolveFinishedPromise();
        return;
      } else {
        this.options.duration = 0;
      }
    }
    const resolvedAnimation = this.initPlayback(keyframes2, finalKeyframe);
    if (resolvedAnimation === false)
      return;
    this._resolved = {
      keyframes: keyframes2,
      finalKeyframe,
      ...resolvedAnimation
    };
    this.onPostResolved();
  }
  onPostResolved() {
  }
  /**
   * Allows the returned animation to be awaited or promise-chained. Currently
   * resolves when the animation finishes at all but in a future update could/should
   * reject if its cancels.
   */
  then(resolve2, reject) {
    return this.currentFinishedPromise.then(resolve2, reject);
  }
  flatten() {
    this.options.type = "keyframes";
    this.options.ease = "linear";
  }
  updateFinishedPromise() {
    this.currentFinishedPromise = new Promise((resolve2) => {
      this.resolveFinishedPromise = resolve2;
    });
  }
}
const mixNumber$1 = (from2, to2, progress2) => {
  return from2 + (to2 - from2) * progress2;
};
function hueToRgb(p2, q2, t2) {
  if (t2 < 0)
    t2 += 1;
  if (t2 > 1)
    t2 -= 1;
  if (t2 < 1 / 6)
    return p2 + (q2 - p2) * 6 * t2;
  if (t2 < 1 / 2)
    return q2;
  if (t2 < 2 / 3)
    return p2 + (q2 - p2) * (2 / 3 - t2) * 6;
  return p2;
}
function hslaToRgba({ hue: hue2, saturation, lightness, alpha: alpha2 }) {
  hue2 /= 360;
  saturation /= 100;
  lightness /= 100;
  let red2 = 0;
  let green2 = 0;
  let blue2 = 0;
  if (!saturation) {
    red2 = green2 = blue2 = lightness;
  } else {
    const q2 = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
    const p2 = 2 * lightness - q2;
    red2 = hueToRgb(p2, q2, hue2 + 1 / 3);
    green2 = hueToRgb(p2, q2, hue2);
    blue2 = hueToRgb(p2, q2, hue2 - 1 / 3);
  }
  return {
    red: Math.round(red2 * 255),
    green: Math.round(green2 * 255),
    blue: Math.round(blue2 * 255),
    alpha: alpha2
  };
}
function mixImmediate(a2, b2) {
  return (p2) => p2 > 0 ? b2 : a2;
}
const mixLinearColor = (from2, to2, v2) => {
  const fromExpo = from2 * from2;
  const expo = v2 * (to2 * to2 - fromExpo) + fromExpo;
  return expo < 0 ? 0 : Math.sqrt(expo);
};
const colorTypes = [hex$1, rgba, hsla];
const getColorType = (v2) => colorTypes.find((type4) => type4.test(v2));
function asRGBA(color2) {
  const type4 = getColorType(color2);
  if (!Boolean(type4))
    return false;
  let model = type4.parse(color2);
  if (type4 === hsla) {
    model = hslaToRgba(model);
  }
  return model;
}
const mixColor = (from2, to2) => {
  const fromRGBA = asRGBA(from2);
  const toRGBA = asRGBA(to2);
  if (!fromRGBA || !toRGBA) {
    return mixImmediate(from2, to2);
  }
  const blended = { ...fromRGBA };
  return (v2) => {
    blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v2);
    blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v2);
    blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v2);
    blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v2);
    return rgba.transform(blended);
  };
};
const combineFunctions = (a2, b2) => (v2) => b2(a2(v2));
const pipe = (...transformers) => transformers.reduce(combineFunctions);
const invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
function mixVisibility(origin2, target) {
  if (invisibleValues.has(origin2)) {
    return (p2) => p2 <= 0 ? origin2 : target;
  } else {
    return (p2) => p2 >= 1 ? target : origin2;
  }
}
function mixNumber(a2, b2) {
  return (p2) => mixNumber$1(a2, b2, p2);
}
function getMixer(a2) {
  if (typeof a2 === "number") {
    return mixNumber;
  } else if (typeof a2 === "string") {
    return isCSSVariableToken(a2) ? mixImmediate : color$2.test(a2) ? mixColor : mixComplex;
  } else if (Array.isArray(a2)) {
    return mixArray;
  } else if (typeof a2 === "object") {
    return color$2.test(a2) ? mixColor : mixObject;
  }
  return mixImmediate;
}
function mixArray(a2, b2) {
  const output2 = [...a2];
  const numValues = output2.length;
  const blendValue = a2.map((v2, i2) => getMixer(v2)(v2, b2[i2]));
  return (p2) => {
    for (let i2 = 0; i2 < numValues; i2++) {
      output2[i2] = blendValue[i2](p2);
    }
    return output2;
  };
}
function mixObject(a2, b2) {
  const output2 = { ...a2, ...b2 };
  const blendValue = {};
  for (const key in output2) {
    if (a2[key] !== void 0 && b2[key] !== void 0) {
      blendValue[key] = getMixer(a2[key])(a2[key], b2[key]);
    }
  }
  return (v2) => {
    for (const key in blendValue) {
      output2[key] = blendValue[key](v2);
    }
    return output2;
  };
}
function matchOrder(origin2, target) {
  var _a2;
  const orderedOrigin = [];
  const pointers = { color: 0, var: 0, number: 0 };
  for (let i2 = 0; i2 < target.values.length; i2++) {
    const type4 = target.types[i2];
    const originIndex = origin2.indexes[type4][pointers[type4]];
    const originValue = (_a2 = origin2.values[originIndex]) !== null && _a2 !== void 0 ? _a2 : 0;
    orderedOrigin[i2] = originValue;
    pointers[type4]++;
  }
  return orderedOrigin;
}
const mixComplex = (origin2, target) => {
  const template2 = complex.createTransformer(target);
  const originStats = analyseComplexValue(origin2);
  const targetStats = analyseComplexValue(target);
  const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length && originStats.indexes.color.length === targetStats.indexes.color.length && originStats.indexes.number.length >= targetStats.indexes.number.length;
  if (canInterpolate) {
    if (invisibleValues.has(origin2) && !targetStats.values.length || invisibleValues.has(target) && !originStats.values.length) {
      return mixVisibility(origin2, target);
    }
    return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template2);
  } else {
    return mixImmediate(origin2, target);
  }
};
function mix(from2, to2, p2) {
  if (typeof from2 === "number" && typeof to2 === "number" && typeof p2 === "number") {
    return mixNumber$1(from2, to2, p2);
  }
  const mixer = getMixer(from2);
  return mixer(from2, to2);
}
const velocitySampleDuration = 5;
function calcGeneratorVelocity(resolveValue, t2, current) {
  const prevT = Math.max(t2 - velocitySampleDuration, 0);
  return velocityPerSecond(current - resolveValue(prevT), t2 - prevT);
}
const springDefaults = {
  // Default spring physics
  stiffness: 100,
  damping: 10,
  mass: 1,
  velocity: 0,
  // Default duration/bounce-based options
  duration: 800,
  // in ms
  bounce: 0.3,
  visualDuration: 0.3,
  // in seconds
  // Rest thresholds
  restSpeed: {
    granular: 0.01,
    default: 2
  },
  restDelta: {
    granular: 5e-3,
    default: 0.5
  },
  // Limits
  minDuration: 0.01,
  // in seconds
  maxDuration: 10,
  // in seconds
  minDamping: 0.05,
  maxDamping: 1
};
const safeMin = 1e-3;
function findSpring({ duration: duration2 = springDefaults.duration, bounce = springDefaults.bounce, velocity = springDefaults.velocity, mass = springDefaults.mass }) {
  let envelope;
  let derivative2;
  let dampingRatio = 1 - bounce;
  dampingRatio = clamp$2(springDefaults.minDamping, springDefaults.maxDamping, dampingRatio);
  duration2 = clamp$2(springDefaults.minDuration, springDefaults.maxDuration, /* @__PURE__ */ millisecondsToSeconds(duration2));
  if (dampingRatio < 1) {
    envelope = (undampedFreq2) => {
      const exponentialDecay = undampedFreq2 * dampingRatio;
      const delta = exponentialDecay * duration2;
      const a2 = exponentialDecay - velocity;
      const b2 = calcAngularFreq(undampedFreq2, dampingRatio);
      const c2 = Math.exp(-delta);
      return safeMin - a2 / b2 * c2;
    };
    derivative2 = (undampedFreq2) => {
      const exponentialDecay = undampedFreq2 * dampingRatio;
      const delta = exponentialDecay * duration2;
      const d2 = delta * velocity + velocity;
      const e2 = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration2;
      const f2 = Math.exp(-delta);
      const g2 = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
      const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
      return factor * ((d2 - e2) * f2) / g2;
    };
  } else {
    envelope = (undampedFreq2) => {
      const a2 = Math.exp(-undampedFreq2 * duration2);
      const b2 = (undampedFreq2 - velocity) * duration2 + 1;
      return -safeMin + a2 * b2;
    };
    derivative2 = (undampedFreq2) => {
      const a2 = Math.exp(-undampedFreq2 * duration2);
      const b2 = (velocity - undampedFreq2) * (duration2 * duration2);
      return a2 * b2;
    };
  }
  const initialGuess = 5 / duration2;
  const undampedFreq = approximateRoot(envelope, derivative2, initialGuess);
  duration2 = /* @__PURE__ */ secondsToMilliseconds(duration2);
  if (isNaN(undampedFreq)) {
    return {
      stiffness: springDefaults.stiffness,
      damping: springDefaults.damping,
      duration: duration2
    };
  } else {
    const stiffness = Math.pow(undampedFreq, 2) * mass;
    return {
      stiffness,
      damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
      duration: duration2
    };
  }
}
const rootIterations = 12;
function approximateRoot(envelope, derivative2, initialGuess) {
  let result = initialGuess;
  for (let i2 = 1; i2 < rootIterations; i2++) {
    result = result - envelope(result) / derivative2(result);
  }
  return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
  return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}
const durationKeys = ["duration", "bounce"];
const physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys2) {
  return keys2.some((key) => options[key] !== void 0);
}
function getSpringOptions(options) {
  let springOptions = {
    velocity: springDefaults.velocity,
    stiffness: springDefaults.stiffness,
    damping: springDefaults.damping,
    mass: springDefaults.mass,
    isResolvedFromDuration: false,
    ...options
  };
  if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
    if (options.visualDuration) {
      const visualDuration = options.visualDuration;
      const root2 = 2 * Math.PI / (visualDuration * 1.2);
      const stiffness = root2 * root2;
      const damping = 2 * clamp$2(0.05, 1, 1 - (options.bounce || 0)) * Math.sqrt(stiffness);
      springOptions = {
        ...springOptions,
        mass: springDefaults.mass,
        stiffness,
        damping
      };
    } else {
      const derived = findSpring(options);
      springOptions = {
        ...springOptions,
        ...derived,
        mass: springDefaults.mass
      };
      springOptions.isResolvedFromDuration = true;
    }
  }
  return springOptions;
}
function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce = springDefaults.bounce) {
  const options = typeof optionsOrVisualDuration !== "object" ? {
    visualDuration: optionsOrVisualDuration,
    keyframes: [0, 1],
    bounce
  } : optionsOrVisualDuration;
  let { restSpeed, restDelta } = options;
  const origin2 = options.keyframes[0];
  const target = options.keyframes[options.keyframes.length - 1];
  const state = { done: false, value: origin2 };
  const { stiffness, damping, mass, duration: duration2, velocity, isResolvedFromDuration } = getSpringOptions({
    ...options,
    velocity: -/* @__PURE__ */ millisecondsToSeconds(options.velocity || 0)
  });
  const initialVelocity = velocity || 0;
  const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
  const initialDelta = target - origin2;
  const undampedAngularFreq = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(stiffness / mass));
  const isGranularScale = Math.abs(initialDelta) < 5;
  restSpeed || (restSpeed = isGranularScale ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default);
  restDelta || (restDelta = isGranularScale ? springDefaults.restDelta.granular : springDefaults.restDelta.default);
  let resolveSpring;
  if (dampingRatio < 1) {
    const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
    resolveSpring = (t2) => {
      const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
      return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t2) + initialDelta * Math.cos(angularFreq * t2));
    };
  } else if (dampingRatio === 1) {
    resolveSpring = (t2) => target - Math.exp(-undampedAngularFreq * t2) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t2);
  } else {
    const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
    resolveSpring = (t2) => {
      const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
      const freqForT = Math.min(dampedAngularFreq * t2, 300);
      return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
    };
  }
  const generator = {
    calculatedDuration: isResolvedFromDuration ? duration2 || null : null,
    next: (t2) => {
      const current = resolveSpring(t2);
      if (!isResolvedFromDuration) {
        let currentVelocity = 0;
        if (dampingRatio < 1) {
          currentVelocity = t2 === 0 ? /* @__PURE__ */ secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t2, current);
        }
        const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
        const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
        state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
      } else {
        state.done = t2 >= duration2;
      }
      state.value = state.done ? target : current;
      return state;
    },
    toString: () => {
      const calculatedDuration = Math.min(calcGeneratorDuration(generator), maxGeneratorDuration);
      const easing = generateLinearEasing((progress2) => generator.next(calculatedDuration * progress2).value, calculatedDuration, 30);
      return calculatedDuration + "ms " + easing;
    }
  };
  return generator;
}
function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min: min2, max: max2, restDelta = 0.5, restSpeed }) {
  const origin2 = keyframes2[0];
  const state = {
    done: false,
    value: origin2
  };
  const isOutOfBounds = (v2) => min2 !== void 0 && v2 < min2 || max2 !== void 0 && v2 > max2;
  const nearestBoundary = (v2) => {
    if (min2 === void 0)
      return max2;
    if (max2 === void 0)
      return min2;
    return Math.abs(min2 - v2) < Math.abs(max2 - v2) ? min2 : max2;
  };
  let amplitude = power * velocity;
  const ideal = origin2 + amplitude;
  const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
  if (target !== ideal)
    amplitude = target - origin2;
  const calcDelta = (t2) => -amplitude * Math.exp(-t2 / timeConstant);
  const calcLatest = (t2) => target + calcDelta(t2);
  const applyFriction = (t2) => {
    const delta = calcDelta(t2);
    const latest = calcLatest(t2);
    state.done = Math.abs(delta) <= restDelta;
    state.value = state.done ? target : latest;
  };
  let timeReachedBoundary;
  let spring$1;
  const checkCatchBoundary = (t2) => {
    if (!isOutOfBounds(state.value))
      return;
    timeReachedBoundary = t2;
    spring$1 = spring({
      keyframes: [state.value, nearestBoundary(state.value)],
      velocity: calcGeneratorVelocity(calcLatest, t2, state.value),
      // TODO: This should be passing * 1000
      damping: bounceDamping,
      stiffness: bounceStiffness,
      restDelta,
      restSpeed
    });
  };
  checkCatchBoundary(0);
  return {
    calculatedDuration: null,
    next: (t2) => {
      let hasUpdatedFrame = false;
      if (!spring$1 && timeReachedBoundary === void 0) {
        hasUpdatedFrame = true;
        applyFriction(t2);
        checkCatchBoundary(t2);
      }
      if (timeReachedBoundary !== void 0 && t2 >= timeReachedBoundary) {
        return spring$1.next(t2 - timeReachedBoundary);
      } else {
        !hasUpdatedFrame && applyFriction(t2);
        return state;
      }
    }
  };
}
const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1);
const easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1);
const easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1);
const isEasingArray = (ease2) => {
  return Array.isArray(ease2) && typeof ease2[0] !== "number";
};
const easingLookup = {
  linear: noop$a,
  easeIn,
  easeInOut,
  easeOut,
  circIn,
  circInOut,
  circOut,
  backIn,
  backInOut,
  backOut,
  anticipate
};
const easingDefinitionToFunction = (definition2) => {
  if (isBezierDefinition(definition2)) {
    invariant$2(definition2.length === 4);
    const [x1, y1, x2, y2] = definition2;
    return cubicBezier(x1, y1, x2, y2);
  } else if (typeof definition2 === "string") {
    return easingLookup[definition2];
  }
  return definition2;
};
function createMixers(output2, ease2, customMixer) {
  const mixers = [];
  const mixerFactory = customMixer || mix;
  const numMixers = output2.length - 1;
  for (let i2 = 0; i2 < numMixers; i2++) {
    let mixer = mixerFactory(output2[i2], output2[i2 + 1]);
    if (ease2) {
      const easingFunction = Array.isArray(ease2) ? ease2[i2] || noop$a : ease2;
      mixer = pipe(easingFunction, mixer);
    }
    mixers.push(mixer);
  }
  return mixers;
}
function interpolate$2(input2, output2, { clamp: isClamp = true, ease: ease2, mixer } = {}) {
  const inputLength = input2.length;
  invariant$2(inputLength === output2.length);
  if (inputLength === 1)
    return () => output2[0];
  if (inputLength === 2 && output2[0] === output2[1])
    return () => output2[1];
  const isZeroDeltaRange = input2[0] === input2[1];
  if (input2[0] > input2[inputLength - 1]) {
    input2 = [...input2].reverse();
    output2 = [...output2].reverse();
  }
  const mixers = createMixers(output2, ease2, mixer);
  const numMixers = mixers.length;
  const interpolator = (v2) => {
    if (isZeroDeltaRange && v2 < input2[0])
      return output2[0];
    let i2 = 0;
    if (numMixers > 1) {
      for (; i2 < input2.length - 2; i2++) {
        if (v2 < input2[i2 + 1])
          break;
      }
    }
    const progressInRange = /* @__PURE__ */ progress$1(input2[i2], input2[i2 + 1], v2);
    return mixers[i2](progressInRange);
  };
  return isClamp ? (v2) => interpolator(clamp$2(input2[0], input2[inputLength - 1], v2)) : interpolator;
}
function fillOffset(offset2, remaining) {
  const min2 = offset2[offset2.length - 1];
  for (let i2 = 1; i2 <= remaining; i2++) {
    const offsetProgress = /* @__PURE__ */ progress$1(0, remaining, i2);
    offset2.push(mixNumber$1(min2, 1, offsetProgress));
  }
}
function defaultOffset(arr) {
  const offset2 = [0];
  fillOffset(offset2, arr.length - 1);
  return offset2;
}
function convertOffsetToTimes(offset2, duration2) {
  return offset2.map((o2) => o2 * duration2);
}
function defaultEasing(values, easing) {
  return values.map(() => easing || easeInOut).splice(0, values.length - 1);
}
function keyframes({ duration: duration2 = 300, keyframes: keyframeValues, times, ease: ease2 = "easeInOut" }) {
  const easingFunctions = isEasingArray(ease2) ? ease2.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease2);
  const state = {
    done: false,
    value: keyframeValues[0]
  };
  const absoluteTimes = convertOffsetToTimes(
    // Only use the provided offsets if they're the correct length
    // TODO Maybe we should warn here if there's a length mismatch
    times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues),
    duration2
  );
  const mapTimeToKeyframe = interpolate$2(absoluteTimes, keyframeValues, {
    ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions)
  });
  return {
    calculatedDuration: duration2,
    next: (t2) => {
      state.value = mapTimeToKeyframe(t2);
      state.done = t2 >= duration2;
      return state;
    }
  };
}
const frameloopDriver = (update) => {
  const passTimestamp = ({ timestamp }) => update(timestamp);
  return {
    start: () => frame.update(passTimestamp, true),
    stop: () => cancelFrame(passTimestamp),
    /**
     * If we're processing this frame we can use the
     * framelocked timestamp to keep things in sync.
     */
    now: () => frameData.isProcessing ? frameData.timestamp : time.now()
  };
};
const generators = {
  decay: inertia,
  inertia,
  tween: keyframes,
  keyframes,
  spring
};
const percentToProgress = (percent2) => percent2 / 100;
class MainThreadAnimation extends BaseAnimation {
  constructor(options) {
    super(options);
    this.holdTime = null;
    this.cancelTime = null;
    this.currentTime = 0;
    this.playbackSpeed = 1;
    this.pendingPlayState = "running";
    this.startTime = null;
    this.state = "idle";
    this.stop = () => {
      this.resolver.cancel();
      this.isStopped = true;
      if (this.state === "idle")
        return;
      this.teardown();
      const { onStop } = this.options;
      onStop && onStop();
    };
    const { name: name2, motionValue: motionValue2, element: element2, keyframes: keyframes2 } = this.options;
    const KeyframeResolver$1 = (element2 === null || element2 === void 0 ? void 0 : element2.KeyframeResolver) || KeyframeResolver;
    const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
    this.resolver = new KeyframeResolver$1(keyframes2, onResolved, name2, motionValue2, element2);
    this.resolver.scheduleResolve();
  }
  flatten() {
    super.flatten();
    if (this._resolved) {
      Object.assign(this._resolved, this.initPlayback(this._resolved.keyframes));
    }
  }
  initPlayback(keyframes$1) {
    const { type: type4 = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options;
    const generatorFactory = isGenerator(type4) ? type4 : generators[type4] || keyframes;
    let mapPercentToKeyframes;
    let mirroredGenerator;
    if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
      mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
      keyframes$1 = [0, 100];
    }
    const generator = generatorFactory({ ...this.options, keyframes: keyframes$1 });
    if (repeatType === "mirror") {
      mirroredGenerator = generatorFactory({
        ...this.options,
        keyframes: [...keyframes$1].reverse(),
        velocity: -velocity
      });
    }
    if (generator.calculatedDuration === null) {
      generator.calculatedDuration = calcGeneratorDuration(generator);
    }
    const { calculatedDuration } = generator;
    const resolvedDuration = calculatedDuration + repeatDelay;
    const totalDuration = resolvedDuration * (repeat + 1) - repeatDelay;
    return {
      generator,
      mirroredGenerator,
      mapPercentToKeyframes,
      calculatedDuration,
      resolvedDuration,
      totalDuration
    };
  }
  onPostResolved() {
    const { autoplay = true } = this.options;
    this.play();
    if (this.pendingPlayState === "paused" || !autoplay) {
      this.pause();
    } else {
      this.state = this.pendingPlayState;
    }
  }
  tick(timestamp, sample2 = false) {
    const { resolved } = this;
    if (!resolved) {
      const { keyframes: keyframes3 } = this.options;
      return { done: true, value: keyframes3[keyframes3.length - 1] };
    }
    const { finalKeyframe, generator, mirroredGenerator, mapPercentToKeyframes, keyframes: keyframes2, calculatedDuration, totalDuration, resolvedDuration } = resolved;
    if (this.startTime === null)
      return generator.next(0);
    const { delay: delay2, repeat, repeatType, repeatDelay, onUpdate } = this.options;
    if (this.speed > 0) {
      this.startTime = Math.min(this.startTime, timestamp);
    } else if (this.speed < 0) {
      this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
    }
    if (sample2) {
      this.currentTime = timestamp;
    } else if (this.holdTime !== null) {
      this.currentTime = this.holdTime;
    } else {
      this.currentTime = Math.round(timestamp - this.startTime) * this.speed;
    }
    const timeWithoutDelay = this.currentTime - delay2 * (this.speed >= 0 ? 1 : -1);
    const isInDelayPhase = this.speed >= 0 ? timeWithoutDelay < 0 : timeWithoutDelay > totalDuration;
    this.currentTime = Math.max(timeWithoutDelay, 0);
    if (this.state === "finished" && this.holdTime === null) {
      this.currentTime = totalDuration;
    }
    let elapsed = this.currentTime;
    let frameGenerator = generator;
    if (repeat) {
      const progress2 = Math.min(this.currentTime, totalDuration) / resolvedDuration;
      let currentIteration = Math.floor(progress2);
      let iterationProgress = progress2 % 1;
      if (!iterationProgress && progress2 >= 1) {
        iterationProgress = 1;
      }
      iterationProgress === 1 && currentIteration--;
      currentIteration = Math.min(currentIteration, repeat + 1);
      const isOddIteration = Boolean(currentIteration % 2);
      if (isOddIteration) {
        if (repeatType === "reverse") {
          iterationProgress = 1 - iterationProgress;
          if (repeatDelay) {
            iterationProgress -= repeatDelay / resolvedDuration;
          }
        } else if (repeatType === "mirror") {
          frameGenerator = mirroredGenerator;
        }
      }
      elapsed = clamp$2(0, 1, iterationProgress) * resolvedDuration;
    }
    const state = isInDelayPhase ? { done: false, value: keyframes2[0] } : frameGenerator.next(elapsed);
    if (mapPercentToKeyframes) {
      state.value = mapPercentToKeyframes(state.value);
    }
    let { done } = state;
    if (!isInDelayPhase && calculatedDuration !== null) {
      done = this.speed >= 0 ? this.currentTime >= totalDuration : this.currentTime <= 0;
    }
    const isAnimationFinished = this.holdTime === null && (this.state === "finished" || this.state === "running" && done);
    if (isAnimationFinished && finalKeyframe !== void 0) {
      state.value = getFinalKeyframe(keyframes2, this.options, finalKeyframe);
    }
    if (onUpdate) {
      onUpdate(state.value);
    }
    if (isAnimationFinished) {
      this.finish();
    }
    return state;
  }
  get duration() {
    const { resolved } = this;
    return resolved ? /* @__PURE__ */ millisecondsToSeconds(resolved.calculatedDuration) : 0;
  }
  get time() {
    return /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
  }
  set time(newTime) {
    newTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
    this.currentTime = newTime;
    if (this.holdTime !== null || this.speed === 0) {
      this.holdTime = newTime;
    } else if (this.driver) {
      this.startTime = this.driver.now() - newTime / this.speed;
    }
  }
  get speed() {
    return this.playbackSpeed;
  }
  set speed(newSpeed) {
    const hasChanged = this.playbackSpeed !== newSpeed;
    this.playbackSpeed = newSpeed;
    if (hasChanged) {
      this.time = /* @__PURE__ */ millisecondsToSeconds(this.currentTime);
    }
  }
  play() {
    if (!this.resolver.isScheduled) {
      this.resolver.resume();
    }
    if (!this._resolved) {
      this.pendingPlayState = "running";
      return;
    }
    if (this.isStopped)
      return;
    const { driver = frameloopDriver, onPlay, startTime } = this.options;
    if (!this.driver) {
      this.driver = driver((timestamp) => this.tick(timestamp));
    }
    onPlay && onPlay();
    const now2 = this.driver.now();
    if (this.holdTime !== null) {
      this.startTime = now2 - this.holdTime;
    } else if (!this.startTime) {
      this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
    } else if (this.state === "finished") {
      this.startTime = now2;
    }
    if (this.state === "finished") {
      this.updateFinishedPromise();
    }
    this.cancelTime = this.startTime;
    this.holdTime = null;
    this.state = "running";
    this.driver.start();
  }
  pause() {
    var _a2;
    if (!this._resolved) {
      this.pendingPlayState = "paused";
      return;
    }
    this.state = "paused";
    this.holdTime = (_a2 = this.currentTime) !== null && _a2 !== void 0 ? _a2 : 0;
  }
  complete() {
    if (this.state !== "running") {
      this.play();
    }
    this.pendingPlayState = this.state = "finished";
    this.holdTime = null;
  }
  finish() {
    this.teardown();
    this.state = "finished";
    const { onComplete } = this.options;
    onComplete && onComplete();
  }
  cancel() {
    if (this.cancelTime !== null) {
      this.tick(this.cancelTime);
    }
    this.teardown();
    this.updateFinishedPromise();
  }
  teardown() {
    this.state = "idle";
    this.stopDriver();
    this.resolveFinishedPromise();
    this.updateFinishedPromise();
    this.startTime = this.cancelTime = null;
    this.resolver.cancel();
  }
  stopDriver() {
    if (!this.driver)
      return;
    this.driver.stop();
    this.driver = void 0;
  }
  sample(time2) {
    this.startTime = 0;
    return this.tick(time2, true);
  }
}
function animateValue(options) {
  return new MainThreadAnimation(options);
}
const acceleratedValues = /* @__PURE__ */ new Set([
  "opacity",
  "clipPath",
  "filter",
  "transform"
  // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
  // or until we implement support for linear() easing.
  // "background-color"
]);
function startWaapiAnimation(element2, valueName, keyframes2, { delay: delay2 = 0, duration: duration2 = 300, repeat = 0, repeatType = "loop", ease: ease2 = "easeInOut", times } = {}) {
  const keyframeOptions = { [valueName]: keyframes2 };
  if (times)
    keyframeOptions.offset = times;
  const easing = mapEasingToNativeEasing(ease2, duration2);
  if (Array.isArray(easing))
    keyframeOptions.easing = easing;
  return element2.animate(keyframeOptions, {
    delay: delay2,
    duration: duration2,
    easing: !Array.isArray(easing) ? easing : "linear",
    fill: "both",
    iterations: repeat + 1,
    direction: repeatType === "reverse" ? "alternate" : "normal"
  });
}
const supportsWaapi = /* @__PURE__ */ memo$1(() => Object.hasOwnProperty.call(Element.prototype, "animate"));
const sampleDelta = 10;
const maxDuration = 2e4;
function requiresPregeneratedKeyframes(options) {
  return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
}
function pregenerateKeyframes(keyframes2, options) {
  const sampleAnimation = new MainThreadAnimation({
    ...options,
    keyframes: keyframes2,
    repeat: 0,
    delay: 0,
    isGenerator: true
  });
  let state = { done: false, value: keyframes2[0] };
  const pregeneratedKeyframes = [];
  let t2 = 0;
  while (!state.done && t2 < maxDuration) {
    state = sampleAnimation.sample(t2);
    pregeneratedKeyframes.push(state.value);
    t2 += sampleDelta;
  }
  return {
    times: void 0,
    keyframes: pregeneratedKeyframes,
    duration: t2 - sampleDelta,
    ease: "linear"
  };
}
const unsupportedEasingFunctions = {
  anticipate,
  backInOut,
  circInOut
};
function isUnsupportedEase(key) {
  return key in unsupportedEasingFunctions;
}
class AcceleratedAnimation extends BaseAnimation {
  constructor(options) {
    super(options);
    const { name: name2, motionValue: motionValue2, element: element2, keyframes: keyframes2 } = this.options;
    this.resolver = new DOMKeyframesResolver(keyframes2, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name2, motionValue2, element2);
    this.resolver.scheduleResolve();
  }
  initPlayback(keyframes2, finalKeyframe) {
    let { duration: duration2 = 300, times, ease: ease2, type: type4, motionValue: motionValue2, name: name2, startTime } = this.options;
    if (!motionValue2.owner || !motionValue2.owner.current) {
      return false;
    }
    if (typeof ease2 === "string" && supportsLinearEasing() && isUnsupportedEase(ease2)) {
      ease2 = unsupportedEasingFunctions[ease2];
    }
    if (requiresPregeneratedKeyframes(this.options)) {
      const { onComplete, onUpdate, motionValue: motionValue3, element: element2, ...options } = this.options;
      const pregeneratedAnimation = pregenerateKeyframes(keyframes2, options);
      keyframes2 = pregeneratedAnimation.keyframes;
      if (keyframes2.length === 1) {
        keyframes2[1] = keyframes2[0];
      }
      duration2 = pregeneratedAnimation.duration;
      times = pregeneratedAnimation.times;
      ease2 = pregeneratedAnimation.ease;
      type4 = "keyframes";
    }
    const animation = startWaapiAnimation(motionValue2.owner.current, name2, keyframes2, { ...this.options, duration: duration2, times, ease: ease2 });
    animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
    if (this.pendingTimeline) {
      attachTimeline(animation, this.pendingTimeline);
      this.pendingTimeline = void 0;
    } else {
      animation.onfinish = () => {
        const { onComplete } = this.options;
        motionValue2.set(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
        onComplete && onComplete();
        this.cancel();
        this.resolveFinishedPromise();
      };
    }
    return {
      animation,
      duration: duration2,
      times,
      type: type4,
      ease: ease2,
      keyframes: keyframes2
    };
  }
  get duration() {
    const { resolved } = this;
    if (!resolved)
      return 0;
    const { duration: duration2 } = resolved;
    return /* @__PURE__ */ millisecondsToSeconds(duration2);
  }
  get time() {
    const { resolved } = this;
    if (!resolved)
      return 0;
    const { animation } = resolved;
    return /* @__PURE__ */ millisecondsToSeconds(animation.currentTime || 0);
  }
  set time(newTime) {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.currentTime = /* @__PURE__ */ secondsToMilliseconds(newTime);
  }
  get speed() {
    const { resolved } = this;
    if (!resolved)
      return 1;
    const { animation } = resolved;
    return animation.playbackRate;
  }
  set speed(newSpeed) {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.playbackRate = newSpeed;
  }
  get state() {
    const { resolved } = this;
    if (!resolved)
      return "idle";
    const { animation } = resolved;
    return animation.playState;
  }
  get startTime() {
    const { resolved } = this;
    if (!resolved)
      return null;
    const { animation } = resolved;
    return animation.startTime;
  }
  /**
   * Replace the default DocumentTimeline with another AnimationTimeline.
   * Currently used for scroll animations.
   */
  attachTimeline(timeline) {
    if (!this._resolved) {
      this.pendingTimeline = timeline;
    } else {
      const { resolved } = this;
      if (!resolved)
        return noop$a;
      const { animation } = resolved;
      attachTimeline(animation, timeline);
    }
    return noop$a;
  }
  play() {
    if (this.isStopped)
      return;
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    if (animation.playState === "finished") {
      this.updateFinishedPromise();
    }
    animation.play();
  }
  pause() {
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation } = resolved;
    animation.pause();
  }
  stop() {
    this.resolver.cancel();
    this.isStopped = true;
    if (this.state === "idle")
      return;
    this.resolveFinishedPromise();
    this.updateFinishedPromise();
    const { resolved } = this;
    if (!resolved)
      return;
    const { animation, keyframes: keyframes2, duration: duration2, type: type4, ease: ease2, times } = resolved;
    if (animation.playState === "idle" || animation.playState === "finished") {
      return;
    }
    if (this.time) {
      const { motionValue: motionValue2, onUpdate, onComplete, element: element2, ...options } = this.options;
      const sampleAnimation = new MainThreadAnimation({
        ...options,
        keyframes: keyframes2,
        duration: duration2,
        type: type4,
        ease: ease2,
        times,
        isGenerator: true
      });
      const sampleTime = /* @__PURE__ */ secondsToMilliseconds(this.time);
      motionValue2.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
    }
    const { onStop } = this.options;
    onStop && onStop();
    this.cancel();
  }
  complete() {
    const { resolved } = this;
    if (!resolved)
      return;
    resolved.animation.finish();
  }
  cancel() {
    const { resolved } = this;
    if (!resolved)
      return;
    resolved.animation.cancel();
  }
  static supports(options) {
    const { motionValue: motionValue2, name: name2, repeatDelay, repeatType, damping, type: type4 } = options;
    if (!motionValue2 || !motionValue2.owner || !(motionValue2.owner.current instanceof HTMLElement)) {
      return false;
    }
    const { onUpdate, transformTemplate } = motionValue2.owner.getProps();
    return supportsWaapi() && name2 && acceleratedValues.has(name2) && /**
     * If we're outputting values to onUpdate then we can't use WAAPI as there's
     * no way to read the value from WAAPI every frame.
     */
    !onUpdate && !transformTemplate && !repeatDelay && repeatType !== "mirror" && damping !== 0 && type4 !== "inertia";
  }
}
const underDampedSpring = {
  type: "spring",
  stiffness: 500,
  damping: 25,
  restSpeed: 10
};
const criticallyDampedSpring = (target) => ({
  type: "spring",
  stiffness: 550,
  damping: target === 0 ? 2 * Math.sqrt(550) : 30,
  restSpeed: 10
});
const keyframesTransition = {
  type: "keyframes",
  duration: 0.8
};
const ease = {
  type: "keyframes",
  ease: [0.25, 0.1, 0.35, 1],
  duration: 0.3
};
const getDefaultTransition = (valueKey, { keyframes: keyframes2 }) => {
  if (keyframes2.length > 2) {
    return keyframesTransition;
  } else if (transformProps.has(valueKey)) {
    return valueKey.startsWith("scale") ? criticallyDampedSpring(keyframes2[1]) : underDampedSpring;
  }
  return ease;
};
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from: from2, elapsed, ...transition3 }) {
  return !!Object.keys(transition3).length;
}
const animateMotionValue = (name2, value2, target, transition3 = {}, element2, isHandoff) => (onComplete) => {
  const valueTransition = getValueTransition(transition3, name2) || {};
  const delay2 = valueTransition.delay || transition3.delay || 0;
  let { elapsed = 0 } = transition3;
  elapsed = elapsed - /* @__PURE__ */ secondsToMilliseconds(delay2);
  let options = {
    keyframes: Array.isArray(target) ? target : [null, target],
    ease: "easeOut",
    velocity: value2.getVelocity(),
    ...valueTransition,
    delay: -elapsed,
    onUpdate: (v2) => {
      value2.set(v2);
      valueTransition.onUpdate && valueTransition.onUpdate(v2);
    },
    onComplete: () => {
      onComplete();
      valueTransition.onComplete && valueTransition.onComplete();
    },
    name: name2,
    motionValue: value2,
    element: isHandoff ? void 0 : element2
  };
  if (!isTransitionDefined(valueTransition)) {
    options = {
      ...options,
      ...getDefaultTransition(name2, options)
    };
  }
  if (options.duration) {
    options.duration = /* @__PURE__ */ secondsToMilliseconds(options.duration);
  }
  if (options.repeatDelay) {
    options.repeatDelay = /* @__PURE__ */ secondsToMilliseconds(options.repeatDelay);
  }
  if (options.from !== void 0) {
    options.keyframes[0] = options.from;
  }
  let shouldSkip2 = false;
  if (options.type === false || options.duration === 0 && !options.repeatDelay) {
    options.duration = 0;
    if (options.delay === 0) {
      shouldSkip2 = true;
    }
  }
  if (instantAnimationState.current || MotionGlobalConfig.skipAnimations) {
    shouldSkip2 = true;
    options.duration = 0;
    options.delay = 0;
  }
  if (shouldSkip2 && !isHandoff && value2.get() !== void 0) {
    const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
    if (finalKeyframe !== void 0) {
      frame.update(() => {
        options.onUpdate(finalKeyframe);
        options.onComplete();
      });
      return new GroupPlaybackControls([]);
    }
  }
  if (!isHandoff && AcceleratedAnimation.supports(options)) {
    return new AcceleratedAnimation(options);
  } else {
    return new MainThreadAnimation(options);
  }
};
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
  const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
  needsAnimating[key] = false;
  return shouldBlock;
}
function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0, transitionOverride, type: type4 } = {}) {
  var _a2;
  let { transition: transition3 = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
  if (transitionOverride)
    transition3 = transitionOverride;
  const animations2 = [];
  const animationTypeState = type4 && visualElement.animationState && visualElement.animationState.getState()[type4];
  for (const key in target) {
    const value2 = visualElement.getValue(key, (_a2 = visualElement.latestValues[key]) !== null && _a2 !== void 0 ? _a2 : null);
    const valueTarget = target[key];
    if (valueTarget === void 0 || animationTypeState && shouldBlockAnimation(animationTypeState, key)) {
      continue;
    }
    const valueTransition = {
      delay: delay2,
      ...getValueTransition(transition3 || {}, key)
    };
    let isHandoff = false;
    if (window.MotionHandoffAnimation) {
      const appearId = getOptimisedAppearId(visualElement);
      if (appearId) {
        const startTime = window.MotionHandoffAnimation(appearId, key, frame);
        if (startTime !== null) {
          valueTransition.startTime = startTime;
          isHandoff = true;
        }
      }
    }
    addValueToWillChange(visualElement, key);
    value2.start(animateMotionValue(key, value2, valueTarget, visualElement.shouldReduceMotion && positionalKeys.has(key) ? { type: false } : valueTransition, visualElement, isHandoff));
    const animation = value2.animation;
    if (animation) {
      animations2.push(animation);
    }
  }
  if (transitionEnd) {
    Promise.all(animations2).then(() => {
      frame.update(() => {
        transitionEnd && setTarget(visualElement, transitionEnd);
      });
    });
  }
  return animations2;
}
function animateVariant(visualElement, variant, options = {}) {
  var _a2;
  const resolved = resolveVariant(visualElement, variant, options.type === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
  let { transition: transition3 = visualElement.getDefaultTransition() || {} } = resolved || {};
  if (options.transitionOverride) {
    transition3 = options.transitionOverride;
  }
  const getAnimation = resolved ? () => Promise.all(animateTarget(visualElement, resolved, options)) : () => Promise.resolve();
  const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size ? (forwardDelay = 0) => {
    const { delayChildren = 0, staggerChildren, staggerDirection } = transition3;
    return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
  } : () => Promise.resolve();
  const { when } = transition3;
  if (when) {
    const [first, last] = when === "beforeChildren" ? [getAnimation, getChildAnimations] : [getChildAnimations, getAnimation];
    return first().then(() => last());
  } else {
    return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
  }
}
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
  const animations2 = [];
  const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
  const generateStaggerDuration = staggerDirection === 1 ? (i2 = 0) => i2 * staggerChildren : (i2 = 0) => maxStaggerDuration - i2 * staggerChildren;
  Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i2) => {
    child.notify("AnimationStart", variant);
    animations2.push(animateVariant(child, variant, {
      ...options,
      delay: delayChildren + generateStaggerDuration(i2)
    }).then(() => child.notify("AnimationComplete", variant)));
  });
  return Promise.all(animations2);
}
function sortByTreeOrder(a2, b2) {
  return a2.sortNodePosition(b2);
}
function animateVisualElement(visualElement, definition2, options = {}) {
  visualElement.notify("AnimationStart", definition2);
  let animation;
  if (Array.isArray(definition2)) {
    const animations2 = definition2.map((variant) => animateVariant(visualElement, variant, options));
    animation = Promise.all(animations2);
  } else if (typeof definition2 === "string") {
    animation = animateVariant(visualElement, definition2, options);
  } else {
    const resolvedDefinition = typeof definition2 === "function" ? resolveVariant(visualElement, definition2, options.custom) : definition2;
    animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
  }
  return animation.then(() => {
    visualElement.notify("AnimationComplete", definition2);
  });
}
const numVariantProps = variantProps.length;
function getVariantContext(visualElement) {
  if (!visualElement)
    return void 0;
  if (!visualElement.isControllingVariants) {
    const context2 = visualElement.parent ? getVariantContext(visualElement.parent) || {} : {};
    if (visualElement.props.initial !== void 0) {
      context2.initial = visualElement.props.initial;
    }
    return context2;
  }
  const context = {};
  for (let i2 = 0; i2 < numVariantProps; i2++) {
    const name2 = variantProps[i2];
    const prop = visualElement.props[name2];
    if (isVariantLabel(prop) || prop === false) {
      context[name2] = prop;
    }
  }
  return context;
}
const reversePriorityOrder = [...variantPriorityOrder].reverse();
const numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
  return (animations2) => Promise.all(animations2.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
}
function createAnimationState(visualElement) {
  let animate = animateList(visualElement);
  let state = createState$1();
  let isInitialRender = true;
  const buildResolvedTypeValues = (type4) => (acc, definition2) => {
    var _a2;
    const resolved = resolveVariant(visualElement, definition2, type4 === "exit" ? (_a2 = visualElement.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom : void 0);
    if (resolved) {
      const { transition: transition3, transitionEnd, ...target } = resolved;
      acc = { ...acc, ...target, ...transitionEnd };
    }
    return acc;
  };
  function setAnimateFunction(makeAnimator) {
    animate = makeAnimator(visualElement);
  }
  function animateChanges(changedActiveType) {
    const { props } = visualElement;
    const context = getVariantContext(visualElement.parent) || {};
    const animations2 = [];
    const removedKeys = /* @__PURE__ */ new Set();
    let encounteredKeys = {};
    let removedVariantIndex = Infinity;
    for (let i2 = 0; i2 < numAnimationTypes; i2++) {
      const type4 = reversePriorityOrder[i2];
      const typeState = state[type4];
      const prop = props[type4] !== void 0 ? props[type4] : context[type4];
      const propIsVariant = isVariantLabel(prop);
      const activeDelta = type4 === changedActiveType ? typeState.isActive : null;
      if (activeDelta === false)
        removedVariantIndex = i2;
      let isInherited = prop === context[type4] && prop !== props[type4] && propIsVariant;
      if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
        isInherited = false;
      }
      typeState.protectedKeys = { ...encounteredKeys };
      if (
        // If it isn't active and hasn't *just* been set as inactive
        !typeState.isActive && activeDelta === null || // If we didn't and don't have any defined prop for this animation type
        !prop && !typeState.prevProp || // Or if the prop doesn't define an animation
        isAnimationControls(prop) || typeof prop === "boolean"
      ) {
        continue;
      }
      const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
      let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active
      type4 === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order)
      i2 > removedVariantIndex && propIsVariant;
      let handledRemovedValues = false;
      const definitionList = Array.isArray(prop) ? prop : [prop];
      let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type4), {});
      if (activeDelta === false)
        resolvedValues = {};
      const { prevResolvedValues = {} } = typeState;
      const allKeys = {
        ...prevResolvedValues,
        ...resolvedValues
      };
      const markToAnimate = (key) => {
        shouldAnimateType = true;
        if (removedKeys.has(key)) {
          handledRemovedValues = true;
          removedKeys.delete(key);
        }
        typeState.needsAnimating[key] = true;
        const motionValue2 = visualElement.getValue(key);
        if (motionValue2)
          motionValue2.liveStyle = false;
      };
      for (const key in allKeys) {
        const next2 = resolvedValues[key];
        const prev2 = prevResolvedValues[key];
        if (encounteredKeys.hasOwnProperty(key))
          continue;
        let valueHasChanged = false;
        if (isKeyframesTarget(next2) && isKeyframesTarget(prev2)) {
          valueHasChanged = !shallowCompare(next2, prev2);
        } else {
          valueHasChanged = next2 !== prev2;
        }
        if (valueHasChanged) {
          if (next2 !== void 0 && next2 !== null) {
            markToAnimate(key);
          } else {
            removedKeys.add(key);
          }
        } else if (next2 !== void 0 && removedKeys.has(key)) {
          markToAnimate(key);
        } else {
          typeState.protectedKeys[key] = true;
        }
      }
      typeState.prevProp = prop;
      typeState.prevResolvedValues = resolvedValues;
      if (typeState.isActive) {
        encounteredKeys = { ...encounteredKeys, ...resolvedValues };
      }
      if (isInitialRender && visualElement.blockInitialAnimation) {
        shouldAnimateType = false;
      }
      const willAnimateViaParent = isInherited && variantDidChange;
      const needsAnimating = !willAnimateViaParent || handledRemovedValues;
      if (shouldAnimateType && needsAnimating) {
        animations2.push(...definitionList.map((animation) => ({
          animation,
          options: { type: type4 }
        })));
      }
    }
    if (removedKeys.size) {
      const fallbackAnimation = {};
      removedKeys.forEach((key) => {
        const fallbackTarget = visualElement.getBaseTarget(key);
        const motionValue2 = visualElement.getValue(key);
        if (motionValue2)
          motionValue2.liveStyle = true;
        fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
      });
      animations2.push({ animation: fallbackAnimation });
    }
    let shouldAnimate = Boolean(animations2.length);
    if (isInitialRender && (props.initial === false || props.initial === props.animate) && !visualElement.manuallyAnimateOnMount) {
      shouldAnimate = false;
    }
    isInitialRender = false;
    return shouldAnimate ? animate(animations2) : Promise.resolve();
  }
  function setActive(type4, isActive2) {
    var _a2;
    if (state[type4].isActive === isActive2)
      return Promise.resolve();
    (_a2 = visualElement.variantChildren) === null || _a2 === void 0 ? void 0 : _a2.forEach((child) => {
      var _a3;
      return (_a3 = child.animationState) === null || _a3 === void 0 ? void 0 : _a3.setActive(type4, isActive2);
    });
    state[type4].isActive = isActive2;
    const animations2 = animateChanges(type4);
    for (const key in state) {
      state[key].protectedKeys = {};
    }
    return animations2;
  }
  return {
    animateChanges,
    setActive,
    setAnimateFunction,
    getState: () => state,
    reset: () => {
      state = createState$1();
      isInitialRender = true;
    }
  };
}
function checkVariantsDidChange(prev2, next2) {
  if (typeof next2 === "string") {
    return next2 !== prev2;
  } else if (Array.isArray(next2)) {
    return !shallowCompare(next2, prev2);
  }
  return false;
}
function createTypeState(isActive2 = false) {
  return {
    isActive: isActive2,
    protectedKeys: {},
    needsAnimating: {},
    prevResolvedValues: {}
  };
}
function createState$1() {
  return {
    animate: createTypeState(true),
    whileInView: createTypeState(),
    whileHover: createTypeState(),
    whileTap: createTypeState(),
    whileDrag: createTypeState(),
    whileFocus: createTypeState(),
    exit: createTypeState()
  };
}
class Feature {
  constructor(node2) {
    this.isMounted = false;
    this.node = node2;
  }
  update() {
  }
}
class AnimationFeature extends Feature {
  /**
   * We dynamically generate the AnimationState manager as it contains a reference
   * to the underlying animation library. We only want to load that if we load this,
   * so people can optionally code split it out using the `m` component.
   */
  constructor(node2) {
    super(node2);
    node2.animationState || (node2.animationState = createAnimationState(node2));
  }
  updateAnimationControlsSubscription() {
    const { animate } = this.node.getProps();
    if (isAnimationControls(animate)) {
      this.unmountControls = animate.subscribe(this.node);
    }
  }
  /**
   * Subscribe any provided AnimationControls to the component's VisualElement
   */
  mount() {
    this.updateAnimationControlsSubscription();
  }
  update() {
    const { animate } = this.node.getProps();
    const { animate: prevAnimate } = this.node.prevProps || {};
    if (animate !== prevAnimate) {
      this.updateAnimationControlsSubscription();
    }
  }
  unmount() {
    var _a2;
    this.node.animationState.reset();
    (_a2 = this.unmountControls) === null || _a2 === void 0 ? void 0 : _a2.call(this);
  }
}
let id$2 = 0;
class ExitAnimationFeature extends Feature {
  constructor() {
    super(...arguments);
    this.id = id$2++;
  }
  update() {
    if (!this.node.presenceContext)
      return;
    const { isPresent: isPresent2, onExitComplete } = this.node.presenceContext;
    const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
    if (!this.node.animationState || isPresent2 === prevIsPresent) {
      return;
    }
    const exitAnimation = this.node.animationState.setActive("exit", !isPresent2);
    if (onExitComplete && !isPresent2) {
      exitAnimation.then(() => onExitComplete(this.id));
    }
  }
  mount() {
    const { register: register2 } = this.node.presenceContext || {};
    if (register2) {
      this.unmount = register2(this.id);
    }
  }
  unmount() {
  }
}
const animations = {
  animation: {
    Feature: AnimationFeature
  },
  exit: {
    Feature: ExitAnimationFeature
  }
};
function addDomEvent(target, eventName, handler, options = { passive: true }) {
  target.addEventListener(eventName, handler, options);
  return () => target.removeEventListener(eventName, handler);
}
function extractEventInfo(event) {
  return {
    point: {
      x: event.pageX,
      y: event.pageY
    }
  };
}
const addPointerInfo = (handler) => {
  return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
};
function addPointerEvent(target, eventName, handler, options) {
  return addDomEvent(target, eventName, addPointerInfo(handler), options);
}
const distance = (a2, b2) => Math.abs(a2 - b2);
function distance2D(a2, b2) {
  const xDelta = distance(a2.x, b2.x);
  const yDelta = distance(a2.y, b2.y);
  return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}
class PanSession {
  constructor(event, handlers2, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
    this.startEvent = null;
    this.lastMoveEvent = null;
    this.lastMoveEventInfo = null;
    this.handlers = {};
    this.contextWindow = window;
    this.updatePoint = () => {
      if (!(this.lastMoveEvent && this.lastMoveEventInfo))
        return;
      const info2 = getPanInfo(this.lastMoveEventInfo, this.history);
      const isPanStarted = this.startEvent !== null;
      const isDistancePastThreshold = distance2D(info2.offset, { x: 0, y: 0 }) >= 3;
      if (!isPanStarted && !isDistancePastThreshold)
        return;
      const { point: point3 } = info2;
      const { timestamp: timestamp2 } = frameData;
      this.history.push({ ...point3, timestamp: timestamp2 });
      const { onStart, onMove } = this.handlers;
      if (!isPanStarted) {
        onStart && onStart(this.lastMoveEvent, info2);
        this.startEvent = this.lastMoveEvent;
      }
      onMove && onMove(this.lastMoveEvent, info2);
    };
    this.handlePointerMove = (event2, info2) => {
      this.lastMoveEvent = event2;
      this.lastMoveEventInfo = transformPoint(info2, this.transformPagePoint);
      frame.update(this.updatePoint, true);
    };
    this.handlePointerUp = (event2, info2) => {
      this.end();
      const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;
      if (this.dragSnapToOrigin)
        resumeAnimation && resumeAnimation();
      if (!(this.lastMoveEvent && this.lastMoveEventInfo))
        return;
      const panInfo = getPanInfo(event2.type === "pointercancel" ? this.lastMoveEventInfo : transformPoint(info2, this.transformPagePoint), this.history);
      if (this.startEvent && onEnd) {
        onEnd(event2, panInfo);
      }
      onSessionEnd && onSessionEnd(event2, panInfo);
    };
    if (!isPrimaryPointer(event))
      return;
    this.dragSnapToOrigin = dragSnapToOrigin;
    this.handlers = handlers2;
    this.transformPagePoint = transformPagePoint;
    this.contextWindow = contextWindow || window;
    const info = extractEventInfo(event);
    const initialInfo = transformPoint(info, this.transformPagePoint);
    const { point: point2 } = initialInfo;
    const { timestamp } = frameData;
    this.history = [{ ...point2, timestamp }];
    const { onSessionStart } = handlers2;
    onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
    this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
  }
  updateHandlers(handlers2) {
    this.handlers = handlers2;
  }
  end() {
    this.removeListeners && this.removeListeners();
    cancelFrame(this.updatePoint);
  }
}
function transformPoint(info, transformPagePoint) {
  return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
}
function subtractPoint(a2, b2) {
  return { x: a2.x - b2.x, y: a2.y - b2.y };
}
function getPanInfo({ point: point2 }, history) {
  return {
    point: point2,
    delta: subtractPoint(point2, lastDevicePoint(history)),
    offset: subtractPoint(point2, startDevicePoint(history)),
    velocity: getVelocity(history, 0.1)
  };
}
function startDevicePoint(history) {
  return history[0];
}
function lastDevicePoint(history) {
  return history[history.length - 1];
}
function getVelocity(history, timeDelta) {
  if (history.length < 2) {
    return { x: 0, y: 0 };
  }
  let i2 = history.length - 1;
  let timestampedPoint = null;
  const lastPoint = lastDevicePoint(history);
  while (i2 >= 0) {
    timestampedPoint = history[i2];
    if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
      break;
    }
    i2--;
  }
  if (!timestampedPoint) {
    return { x: 0, y: 0 };
  }
  const time2 = /* @__PURE__ */ millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
  if (time2 === 0) {
    return { x: 0, y: 0 };
  }
  const currentVelocity = {
    x: (lastPoint.x - timestampedPoint.x) / time2,
    y: (lastPoint.y - timestampedPoint.y) / time2
  };
  if (currentVelocity.x === Infinity) {
    currentVelocity.x = 0;
  }
  if (currentVelocity.y === Infinity) {
    currentVelocity.y = 0;
  }
  return currentVelocity;
}
const SCALE_PRECISION = 1e-4;
const SCALE_MIN = 1 - SCALE_PRECISION;
const SCALE_MAX = 1 + SCALE_PRECISION;
const TRANSLATE_PRECISION = 0.01;
const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;
const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
function calcLength(axis) {
  return axis.max - axis.min;
}
function isNear(value2, target, maxDistance) {
  return Math.abs(value2 - target) <= maxDistance;
}
function calcAxisDelta(delta, source2, target, origin2 = 0.5) {
  delta.origin = origin2;
  delta.originPoint = mixNumber$1(source2.min, source2.max, delta.origin);
  delta.scale = calcLength(target) / calcLength(source2);
  delta.translate = mixNumber$1(target.min, target.max, delta.origin) - delta.originPoint;
  if (delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX || isNaN(delta.scale)) {
    delta.scale = 1;
  }
  if (delta.translate >= TRANSLATE_MIN && delta.translate <= TRANSLATE_MAX || isNaN(delta.translate)) {
    delta.translate = 0;
  }
}
function calcBoxDelta(delta, source2, target, origin2) {
  calcAxisDelta(delta.x, source2.x, target.x, origin2 ? origin2.originX : void 0);
  calcAxisDelta(delta.y, source2.y, target.y, origin2 ? origin2.originY : void 0);
}
function calcRelativeAxis(target, relative, parent) {
  target.min = parent.min + relative.min;
  target.max = target.min + calcLength(relative);
}
function calcRelativeBox(target, relative, parent) {
  calcRelativeAxis(target.x, relative.x, parent.x);
  calcRelativeAxis(target.y, relative.y, parent.y);
}
function calcRelativeAxisPosition(target, layout2, parent) {
  target.min = layout2.min - parent.min;
  target.max = target.min + calcLength(layout2);
}
function calcRelativePosition(target, layout2, parent) {
  calcRelativeAxisPosition(target.x, layout2.x, parent.x);
  calcRelativeAxisPosition(target.y, layout2.y, parent.y);
}
function applyConstraints(point2, { min: min2, max: max2 }, elastic) {
  if (min2 !== void 0 && point2 < min2) {
    point2 = elastic ? mixNumber$1(min2, point2, elastic.min) : Math.max(point2, min2);
  } else if (max2 !== void 0 && point2 > max2) {
    point2 = elastic ? mixNumber$1(max2, point2, elastic.max) : Math.min(point2, max2);
  }
  return point2;
}
function calcRelativeAxisConstraints(axis, min2, max2) {
  return {
    min: min2 !== void 0 ? axis.min + min2 : void 0,
    max: max2 !== void 0 ? axis.max + max2 - (axis.max - axis.min) : void 0
  };
}
function calcRelativeConstraints(layoutBox, { top: top2, left: left2, bottom: bottom2, right }) {
  return {
    x: calcRelativeAxisConstraints(layoutBox.x, left2, right),
    y: calcRelativeAxisConstraints(layoutBox.y, top2, bottom2)
  };
}
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
  let min2 = constraintsAxis.min - layoutAxis.min;
  let max2 = constraintsAxis.max - layoutAxis.max;
  if (constraintsAxis.max - constraintsAxis.min < layoutAxis.max - layoutAxis.min) {
    [min2, max2] = [max2, min2];
  }
  return { min: min2, max: max2 };
}
function calcViewportConstraints(layoutBox, constraintsBox) {
  return {
    x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
    y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y)
  };
}
function calcOrigin(source2, target) {
  let origin2 = 0.5;
  const sourceLength = calcLength(source2);
  const targetLength = calcLength(target);
  if (targetLength > sourceLength) {
    origin2 = /* @__PURE__ */ progress$1(target.min, target.max - sourceLength, source2.min);
  } else if (sourceLength > targetLength) {
    origin2 = /* @__PURE__ */ progress$1(source2.min, source2.max - targetLength, target.min);
  }
  return clamp$2(0, 1, origin2);
}
function rebaseAxisConstraints(layout2, constraints) {
  const relativeConstraints = {};
  if (constraints.min !== void 0) {
    relativeConstraints.min = constraints.min - layout2.min;
  }
  if (constraints.max !== void 0) {
    relativeConstraints.max = constraints.max - layout2.min;
  }
  return relativeConstraints;
}
const defaultElastic = 0.35;
function resolveDragElastic(dragElastic = defaultElastic) {
  if (dragElastic === false) {
    dragElastic = 0;
  } else if (dragElastic === true) {
    dragElastic = defaultElastic;
  }
  return {
    x: resolveAxisElastic(dragElastic, "left", "right"),
    y: resolveAxisElastic(dragElastic, "top", "bottom")
  };
}
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
  return {
    min: resolvePointElastic(dragElastic, minLabel),
    max: resolvePointElastic(dragElastic, maxLabel)
  };
}
function resolvePointElastic(dragElastic, label) {
  return typeof dragElastic === "number" ? dragElastic : dragElastic[label] || 0;
}
const createAxisDelta = () => ({
  translate: 0,
  scale: 1,
  origin: 0,
  originPoint: 0
});
const createDelta = () => ({
  x: createAxisDelta(),
  y: createAxisDelta()
});
const createAxis = () => ({ min: 0, max: 0 });
const createBox = () => ({
  x: createAxis(),
  y: createAxis()
});
function eachAxis(callback2) {
  return [callback2("x"), callback2("y")];
}
function convertBoundingBoxToBox({ top: top2, left: left2, right, bottom: bottom2 }) {
  return {
    x: { min: left2, max: right },
    y: { min: top2, max: bottom2 }
  };
}
function convertBoxToBoundingBox({ x: x2, y: y2 }) {
  return { top: y2.min, right: x2.max, bottom: y2.max, left: x2.min };
}
function transformBoxPoints(point2, transformPoint2) {
  if (!transformPoint2)
    return point2;
  const topLeft = transformPoint2({ x: point2.left, y: point2.top });
  const bottomRight = transformPoint2({ x: point2.right, y: point2.bottom });
  return {
    top: topLeft.y,
    left: topLeft.x,
    bottom: bottomRight.y,
    right: bottomRight.x
  };
}
function isIdentityScale(scale2) {
  return scale2 === void 0 || scale2 === 1;
}
function hasScale({ scale: scale2, scaleX, scaleY }) {
  return !isIdentityScale(scale2) || !isIdentityScale(scaleX) || !isIdentityScale(scaleY);
}
function hasTransform(values) {
  return hasScale(values) || has2DTranslate(values) || values.z || values.rotate || values.rotateX || values.rotateY || values.skewX || values.skewY;
}
function has2DTranslate(values) {
  return is2DTranslate(values.x) || is2DTranslate(values.y);
}
function is2DTranslate(value2) {
  return value2 && value2 !== "0%";
}
function scalePoint(point2, scale2, originPoint) {
  const distanceFromOrigin = point2 - originPoint;
  const scaled = scale2 * distanceFromOrigin;
  return originPoint + scaled;
}
function applyPointDelta(point2, translate, scale2, originPoint, boxScale) {
  if (boxScale !== void 0) {
    point2 = scalePoint(point2, boxScale, originPoint);
  }
  return scalePoint(point2, scale2, originPoint) + translate;
}
function applyAxisDelta(axis, translate = 0, scale2 = 1, originPoint, boxScale) {
  axis.min = applyPointDelta(axis.min, translate, scale2, originPoint, boxScale);
  axis.max = applyPointDelta(axis.max, translate, scale2, originPoint, boxScale);
}
function applyBoxDelta(box, { x: x2, y: y2 }) {
  applyAxisDelta(box.x, x2.translate, x2.scale, x2.originPoint);
  applyAxisDelta(box.y, y2.translate, y2.scale, y2.originPoint);
}
const TREE_SCALE_SNAP_MIN = 0.999999999999;
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
  const treeLength = treePath.length;
  if (!treeLength)
    return;
  treeScale.x = treeScale.y = 1;
  let node2;
  let delta;
  for (let i2 = 0; i2 < treeLength; i2++) {
    node2 = treePath[i2];
    delta = node2.projectionDelta;
    const { visualElement } = node2.options;
    if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") {
      continue;
    }
    if (isSharedTransition && node2.options.layoutScroll && node2.scroll && node2 !== node2.root) {
      transformBox(box, {
        x: -node2.scroll.offset.x,
        y: -node2.scroll.offset.y
      });
    }
    if (delta) {
      treeScale.x *= delta.x.scale;
      treeScale.y *= delta.y.scale;
      applyBoxDelta(box, delta);
    }
    if (isSharedTransition && hasTransform(node2.latestValues)) {
      transformBox(box, node2.latestValues);
    }
  }
  if (treeScale.x < TREE_SCALE_SNAP_MAX && treeScale.x > TREE_SCALE_SNAP_MIN) {
    treeScale.x = 1;
  }
  if (treeScale.y < TREE_SCALE_SNAP_MAX && treeScale.y > TREE_SCALE_SNAP_MIN) {
    treeScale.y = 1;
  }
}
function translateAxis(axis, distance2) {
  axis.min = axis.min + distance2;
  axis.max = axis.max + distance2;
}
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
  const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
  applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
}
function transformBox(box, transform2) {
  transformAxis(box.x, transform2.x, transform2.scaleX, transform2.scale, transform2.originX);
  transformAxis(box.y, transform2.y, transform2.scaleY, transform2.scale, transform2.originY);
}
function measureViewportBox(instance2, transformPoint2) {
  return convertBoundingBoxToBox(transformBoxPoints(instance2.getBoundingClientRect(), transformPoint2));
}
function measurePageBox(element2, rootProjectionNode2, transformPagePoint) {
  const viewportBox = measureViewportBox(element2, transformPagePoint);
  const { scroll } = rootProjectionNode2;
  if (scroll) {
    translateAxis(viewportBox.x, scroll.offset.x);
    translateAxis(viewportBox.y, scroll.offset.y);
  }
  return viewportBox;
}
const getContextWindow = ({ current }) => {
  return current ? current.ownerDocument.defaultView : null;
};
const elementDragControls = /* @__PURE__ */ new WeakMap();
class VisualElementDragControls {
  constructor(visualElement) {
    this.openDragLock = null;
    this.isDragging = false;
    this.currentDirection = null;
    this.originPoint = { x: 0, y: 0 };
    this.constraints = false;
    this.hasMutatedConstraints = false;
    this.elastic = createBox();
    this.visualElement = visualElement;
  }
  start(originEvent, { snapToCursor = false } = {}) {
    const { presenceContext } = this.visualElement;
    if (presenceContext && presenceContext.isPresent === false)
      return;
    const onSessionStart = (event) => {
      const { dragSnapToOrigin: dragSnapToOrigin2 } = this.getProps();
      dragSnapToOrigin2 ? this.pauseAnimation() : this.stopAnimation();
      if (snapToCursor) {
        this.snapToCursor(extractEventInfo(event).point);
      }
    };
    const onStart = (event, info) => {
      const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
      if (drag2 && !dragPropagation) {
        if (this.openDragLock)
          this.openDragLock();
        this.openDragLock = setDragLock(drag2);
        if (!this.openDragLock)
          return;
      }
      this.isDragging = true;
      this.currentDirection = null;
      this.resolveConstraints();
      if (this.visualElement.projection) {
        this.visualElement.projection.isAnimationBlocked = true;
        this.visualElement.projection.target = void 0;
      }
      eachAxis((axis) => {
        let current = this.getAxisMotionValue(axis).get() || 0;
        if (percent.test(current)) {
          const { projection } = this.visualElement;
          if (projection && projection.layout) {
            const measuredAxis = projection.layout.layoutBox[axis];
            if (measuredAxis) {
              const length2 = calcLength(measuredAxis);
              current = length2 * (parseFloat(current) / 100);
            }
          }
        }
        this.originPoint[axis] = current;
      });
      if (onDragStart) {
        frame.postRender(() => onDragStart(event, info));
      }
      addValueToWillChange(this.visualElement, "transform");
      const { animationState } = this.visualElement;
      animationState && animationState.setActive("whileDrag", true);
    };
    const onMove = (event, info) => {
      const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag } = this.getProps();
      if (!dragPropagation && !this.openDragLock)
        return;
      const { offset: offset2 } = info;
      if (dragDirectionLock && this.currentDirection === null) {
        this.currentDirection = getCurrentDirection(offset2);
        if (this.currentDirection !== null) {
          onDirectionLock && onDirectionLock(this.currentDirection);
        }
        return;
      }
      this.updateAxis("x", info.point, offset2);
      this.updateAxis("y", info.point, offset2);
      this.visualElement.render();
      onDrag && onDrag(event, info);
    };
    const onSessionEnd = (event, info) => this.stop(event, info);
    const resumeAnimation = () => eachAxis((axis) => {
      var _a2;
      return this.getAnimationState(axis) === "paused" && ((_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.play());
    });
    const { dragSnapToOrigin } = this.getProps();
    this.panSession = new PanSession(originEvent, {
      onSessionStart,
      onStart,
      onMove,
      onSessionEnd,
      resumeAnimation
    }, {
      transformPagePoint: this.visualElement.getTransformPagePoint(),
      dragSnapToOrigin,
      contextWindow: getContextWindow(this.visualElement)
    });
  }
  stop(event, info) {
    const isDragging2 = this.isDragging;
    this.cancel();
    if (!isDragging2)
      return;
    const { velocity } = info;
    this.startAnimation(velocity);
    const { onDragEnd } = this.getProps();
    if (onDragEnd) {
      frame.postRender(() => onDragEnd(event, info));
    }
  }
  cancel() {
    this.isDragging = false;
    const { projection, animationState } = this.visualElement;
    if (projection) {
      projection.isAnimationBlocked = false;
    }
    this.panSession && this.panSession.end();
    this.panSession = void 0;
    const { dragPropagation } = this.getProps();
    if (!dragPropagation && this.openDragLock) {
      this.openDragLock();
      this.openDragLock = null;
    }
    animationState && animationState.setActive("whileDrag", false);
  }
  updateAxis(axis, _point, offset2) {
    const { drag: drag2 } = this.getProps();
    if (!offset2 || !shouldDrag(axis, drag2, this.currentDirection))
      return;
    const axisValue = this.getAxisMotionValue(axis);
    let next2 = this.originPoint[axis] + offset2[axis];
    if (this.constraints && this.constraints[axis]) {
      next2 = applyConstraints(next2, this.constraints[axis], this.elastic[axis]);
    }
    axisValue.set(next2);
  }
  resolveConstraints() {
    var _a2;
    const { dragConstraints, dragElastic } = this.getProps();
    const layout2 = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(false) : (_a2 = this.visualElement.projection) === null || _a2 === void 0 ? void 0 : _a2.layout;
    const prevConstraints = this.constraints;
    if (dragConstraints && isRefObject(dragConstraints)) {
      if (!this.constraints) {
        this.constraints = this.resolveRefConstraints();
      }
    } else {
      if (dragConstraints && layout2) {
        this.constraints = calcRelativeConstraints(layout2.layoutBox, dragConstraints);
      } else {
        this.constraints = false;
      }
    }
    this.elastic = resolveDragElastic(dragElastic);
    if (prevConstraints !== this.constraints && layout2 && this.constraints && !this.hasMutatedConstraints) {
      eachAxis((axis) => {
        if (this.constraints !== false && this.getAxisMotionValue(axis)) {
          this.constraints[axis] = rebaseAxisConstraints(layout2.layoutBox[axis], this.constraints[axis]);
        }
      });
    }
  }
  resolveRefConstraints() {
    const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
    if (!constraints || !isRefObject(constraints))
      return false;
    const constraintsElement = constraints.current;
    const { projection } = this.visualElement;
    if (!projection || !projection.layout)
      return false;
    const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
    let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
    if (onMeasureDragConstraints) {
      const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
      this.hasMutatedConstraints = !!userConstraints;
      if (userConstraints) {
        measuredConstraints = convertBoundingBoxToBox(userConstraints);
      }
    }
    return measuredConstraints;
  }
  startAnimation(velocity) {
    const { drag: drag2, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd } = this.getProps();
    const constraints = this.constraints || {};
    const momentumAnimations = eachAxis((axis) => {
      if (!shouldDrag(axis, drag2, this.currentDirection)) {
        return;
      }
      let transition3 = constraints && constraints[axis] || {};
      if (dragSnapToOrigin)
        transition3 = { min: 0, max: 0 };
      const bounceStiffness = dragElastic ? 200 : 1e6;
      const bounceDamping = dragElastic ? 40 : 1e7;
      const inertia2 = {
        type: "inertia",
        velocity: dragMomentum ? velocity[axis] : 0,
        bounceStiffness,
        bounceDamping,
        timeConstant: 750,
        restDelta: 1,
        restSpeed: 10,
        ...dragTransition,
        ...transition3
      };
      return this.startAxisValueAnimation(axis, inertia2);
    });
    return Promise.all(momentumAnimations).then(onDragTransitionEnd);
  }
  startAxisValueAnimation(axis, transition3) {
    const axisValue = this.getAxisMotionValue(axis);
    addValueToWillChange(this.visualElement, axis);
    return axisValue.start(animateMotionValue(axis, axisValue, 0, transition3, this.visualElement, false));
  }
  stopAnimation() {
    eachAxis((axis) => this.getAxisMotionValue(axis).stop());
  }
  pauseAnimation() {
    eachAxis((axis) => {
      var _a2;
      return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.pause();
    });
  }
  getAnimationState(axis) {
    var _a2;
    return (_a2 = this.getAxisMotionValue(axis).animation) === null || _a2 === void 0 ? void 0 : _a2.state;
  }
  /**
   * Drag works differently depending on which props are provided.
   *
   * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
   * - Otherwise, we apply the delta to the x/y motion values.
   */
  getAxisMotionValue(axis) {
    const dragKey = `_drag${axis.toUpperCase()}`;
    const props = this.visualElement.getProps();
    const externalMotionValue = props[dragKey];
    return externalMotionValue ? externalMotionValue : this.visualElement.getValue(axis, (props.initial ? props.initial[axis] : void 0) || 0);
  }
  snapToCursor(point2) {
    eachAxis((axis) => {
      const { drag: drag2 } = this.getProps();
      if (!shouldDrag(axis, drag2, this.currentDirection))
        return;
      const { projection } = this.visualElement;
      const axisValue = this.getAxisMotionValue(axis);
      if (projection && projection.layout) {
        const { min: min2, max: max2 } = projection.layout.layoutBox[axis];
        axisValue.set(point2[axis] - mixNumber$1(min2, max2, 0.5));
      }
    });
  }
  /**
   * When the viewport resizes we want to check if the measured constraints
   * have changed and, if so, reposition the element within those new constraints
   * relative to where it was before the resize.
   */
  scalePositionWithinConstraints() {
    if (!this.visualElement.current)
      return;
    const { drag: drag2, dragConstraints } = this.getProps();
    const { projection } = this.visualElement;
    if (!isRefObject(dragConstraints) || !projection || !this.constraints)
      return;
    this.stopAnimation();
    const boxProgress = { x: 0, y: 0 };
    eachAxis((axis) => {
      const axisValue = this.getAxisMotionValue(axis);
      if (axisValue && this.constraints !== false) {
        const latest = axisValue.get();
        boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]);
      }
    });
    const { transformTemplate } = this.visualElement.getProps();
    this.visualElement.current.style.transform = transformTemplate ? transformTemplate({}, "") : "none";
    projection.root && projection.root.updateScroll();
    projection.updateLayout();
    this.resolveConstraints();
    eachAxis((axis) => {
      if (!shouldDrag(axis, drag2, null))
        return;
      const axisValue = this.getAxisMotionValue(axis);
      const { min: min2, max: max2 } = this.constraints[axis];
      axisValue.set(mixNumber$1(min2, max2, boxProgress[axis]));
    });
  }
  addListeners() {
    if (!this.visualElement.current)
      return;
    elementDragControls.set(this.visualElement, this);
    const element2 = this.visualElement.current;
    const stopPointerListener = addPointerEvent(element2, "pointerdown", (event) => {
      const { drag: drag2, dragListener = true } = this.getProps();
      drag2 && dragListener && this.start(event);
    });
    const measureDragConstraints = () => {
      const { dragConstraints } = this.getProps();
      if (isRefObject(dragConstraints) && dragConstraints.current) {
        this.constraints = this.resolveRefConstraints();
      }
    };
    const { projection } = this.visualElement;
    const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
    if (projection && !projection.layout) {
      projection.root && projection.root.updateScroll();
      projection.updateLayout();
    }
    frame.read(measureDragConstraints);
    const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
    const stopLayoutUpdateListener = projection.addEventListener("didUpdate", ({ delta, hasLayoutChanged }) => {
      if (this.isDragging && hasLayoutChanged) {
        eachAxis((axis) => {
          const motionValue2 = this.getAxisMotionValue(axis);
          if (!motionValue2)
            return;
          this.originPoint[axis] += delta[axis].translate;
          motionValue2.set(motionValue2.get() + delta[axis].translate);
        });
        this.visualElement.render();
      }
    });
    return () => {
      stopResizeListener();
      stopPointerListener();
      stopMeasureLayoutListener();
      stopLayoutUpdateListener && stopLayoutUpdateListener();
    };
  }
  getProps() {
    const props = this.visualElement.getProps();
    const { drag: drag2 = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true } = props;
    return {
      ...props,
      drag: drag2,
      dragDirectionLock,
      dragPropagation,
      dragConstraints,
      dragElastic,
      dragMomentum
    };
  }
}
function shouldDrag(direction, drag2, currentDirection) {
  return (drag2 === true || drag2 === direction) && (currentDirection === null || currentDirection === direction);
}
function getCurrentDirection(offset2, lockThreshold = 10) {
  let direction = null;
  if (Math.abs(offset2.y) > lockThreshold) {
    direction = "y";
  } else if (Math.abs(offset2.x) > lockThreshold) {
    direction = "x";
  }
  return direction;
}
class DragGesture extends Feature {
  constructor(node2) {
    super(node2);
    this.removeGroupControls = noop$a;
    this.removeListeners = noop$a;
    this.controls = new VisualElementDragControls(node2);
  }
  mount() {
    const { dragControls } = this.node.getProps();
    if (dragControls) {
      this.removeGroupControls = dragControls.subscribe(this.controls);
    }
    this.removeListeners = this.controls.addListeners() || noop$a;
  }
  unmount() {
    this.removeGroupControls();
    this.removeListeners();
  }
}
const asyncHandler = (handler) => (event, info) => {
  if (handler) {
    frame.postRender(() => handler(event, info));
  }
};
class PanGesture extends Feature {
  constructor() {
    super(...arguments);
    this.removePointerDownListener = noop$a;
  }
  onPointerDown(pointerDownEvent) {
    this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
      transformPagePoint: this.node.getTransformPagePoint(),
      contextWindow: getContextWindow(this.node)
    });
  }
  createPanHandlers() {
    const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
    return {
      onSessionStart: asyncHandler(onPanSessionStart),
      onStart: asyncHandler(onPanStart),
      onMove: onPan,
      onEnd: (event, info) => {
        delete this.session;
        if (onPanEnd) {
          frame.postRender(() => onPanEnd(event, info));
        }
      }
    };
  }
  mount() {
    this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
  }
  update() {
    this.session && this.session.updateHandlers(this.createPanHandlers());
  }
  unmount() {
    this.removePointerDownListener();
    this.session && this.session.end();
  }
}
const globalProjectionState = {
  /**
   * Global flag as to whether the tree has animated since the last time
   * we resized the window
   */
  hasAnimatedSinceResize: true,
  /**
   * We set this to true once, on the first update. Any nodes added to the tree beyond that
   * update will be given a `data-projection-id` attribute.
   */
  hasEverUpdated: false
};
function pixelsToPercent(pixels, axis) {
  if (axis.max === axis.min)
    return 0;
  return pixels / (axis.max - axis.min) * 100;
}
const correctBorderRadius = {
  correct: (latest, node2) => {
    if (!node2.target)
      return latest;
    if (typeof latest === "string") {
      if (px.test(latest)) {
        latest = parseFloat(latest);
      } else {
        return latest;
      }
    }
    const x2 = pixelsToPercent(latest, node2.target.x);
    const y2 = pixelsToPercent(latest, node2.target.y);
    return `${x2}% ${y2}%`;
  }
};
const correctBoxShadow = {
  correct: (latest, { treeScale, projectionDelta }) => {
    const original = latest;
    const shadow2 = complex.parse(latest);
    if (shadow2.length > 5)
      return original;
    const template2 = complex.createTransformer(latest);
    const offset2 = typeof shadow2[0] !== "number" ? 1 : 0;
    const xScale = projectionDelta.x.scale * treeScale.x;
    const yScale = projectionDelta.y.scale * treeScale.y;
    shadow2[0 + offset2] /= xScale;
    shadow2[1 + offset2] /= yScale;
    const averageScale = mixNumber$1(xScale, yScale, 0.5);
    if (typeof shadow2[2 + offset2] === "number")
      shadow2[2 + offset2] /= averageScale;
    if (typeof shadow2[3 + offset2] === "number")
      shadow2[3 + offset2] /= averageScale;
    return template2(shadow2);
  }
};
class MeasureLayoutWithContext extends reactExports.Component {
  /**
   * This only mounts projection nodes for components that
   * need measuring, we might want to do it for all components
   * in order to incorporate transforms
   */
  componentDidMount() {
    const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
    const { projection } = visualElement;
    addScaleCorrector(defaultScaleCorrectors);
    if (projection) {
      if (layoutGroup.group)
        layoutGroup.group.add(projection);
      if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
        switchLayoutGroup.register(projection);
      }
      projection.root.didUpdate();
      projection.addEventListener("animationComplete", () => {
        this.safeToRemove();
      });
      projection.setOptions({
        ...projection.options,
        onExitComplete: () => this.safeToRemove()
      });
    }
    globalProjectionState.hasEverUpdated = true;
  }
  getSnapshotBeforeUpdate(prevProps) {
    const { layoutDependency, visualElement, drag: drag2, isPresent: isPresent2 } = this.props;
    const projection = visualElement.projection;
    if (!projection)
      return null;
    projection.isPresent = isPresent2;
    if (drag2 || prevProps.layoutDependency !== layoutDependency || layoutDependency === void 0) {
      projection.willUpdate();
    } else {
      this.safeToRemove();
    }
    if (prevProps.isPresent !== isPresent2) {
      if (isPresent2) {
        projection.promote();
      } else if (!projection.relegate()) {
        frame.postRender(() => {
          const stack = projection.getStack();
          if (!stack || !stack.members.length) {
            this.safeToRemove();
          }
        });
      }
    }
    return null;
  }
  componentDidUpdate() {
    const { projection } = this.props.visualElement;
    if (projection) {
      projection.root.didUpdate();
      microtask.postRender(() => {
        if (!projection.currentAnimation && projection.isLead()) {
          this.safeToRemove();
        }
      });
    }
  }
  componentWillUnmount() {
    const { visualElement, layoutGroup, switchLayoutGroup: promoteContext } = this.props;
    const { projection } = visualElement;
    if (projection) {
      projection.scheduleCheckAfterUnmount();
      if (layoutGroup && layoutGroup.group)
        layoutGroup.group.remove(projection);
      if (promoteContext && promoteContext.deregister)
        promoteContext.deregister(projection);
    }
  }
  safeToRemove() {
    const { safeToRemove } = this.props;
    safeToRemove && safeToRemove();
  }
  render() {
    return null;
  }
}
function MeasureLayout(props) {
  const [isPresent2, safeToRemove] = usePresence();
  const layoutGroup = reactExports.useContext(LayoutGroupContext);
  return jsxRuntimeExports.jsx(MeasureLayoutWithContext, { ...props, layoutGroup, switchLayoutGroup: reactExports.useContext(SwitchLayoutGroupContext), isPresent: isPresent2, safeToRemove });
}
const defaultScaleCorrectors = {
  borderRadius: {
    ...correctBorderRadius,
    applyTo: [
      "borderTopLeftRadius",
      "borderTopRightRadius",
      "borderBottomLeftRadius",
      "borderBottomRightRadius"
    ]
  },
  borderTopLeftRadius: correctBorderRadius,
  borderTopRightRadius: correctBorderRadius,
  borderBottomLeftRadius: correctBorderRadius,
  borderBottomRightRadius: correctBorderRadius,
  boxShadow: correctBoxShadow
};
function animateSingleValue(value2, keyframes2, options) {
  const motionValue$1 = isMotionValue(value2) ? value2 : motionValue(value2);
  motionValue$1.start(animateMotionValue("", motionValue$1, keyframes2, options));
  return motionValue$1.animation;
}
function isSVGElement$1(element2) {
  return element2 instanceof SVGElement && element2.tagName !== "svg";
}
const compareByDepth = (a2, b2) => a2.depth - b2.depth;
class FlatTree {
  constructor() {
    this.children = [];
    this.isDirty = false;
  }
  add(child) {
    addUniqueItem(this.children, child);
    this.isDirty = true;
  }
  remove(child) {
    removeItem(this.children, child);
    this.isDirty = true;
  }
  forEach(callback2) {
    this.isDirty && this.children.sort(compareByDepth);
    this.isDirty = false;
    this.children.forEach(callback2);
  }
}
function delay$1(callback2, timeout) {
  const start = time.now();
  const checkElapsed = ({ timestamp }) => {
    const elapsed = timestamp - start;
    if (elapsed >= timeout) {
      cancelFrame(checkElapsed);
      callback2(elapsed - timeout);
    }
  };
  frame.read(checkElapsed, true);
  return () => cancelFrame(checkElapsed);
}
const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
const numBorders = borders.length;
const asNumber = (value2) => typeof value2 === "string" ? parseFloat(value2) : value2;
const isPx = (value2) => typeof value2 === "number" || px.test(value2);
function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOnlyMember) {
  if (shouldCrossfadeOpacity) {
    target.opacity = mixNumber$1(
      0,
      // TODO Reinstate this if only child
      lead.opacity !== void 0 ? lead.opacity : 1,
      easeCrossfadeIn(progress2)
    );
    target.opacityExit = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, 0, easeCrossfadeOut(progress2));
  } else if (isOnlyMember) {
    target.opacity = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2);
  }
  for (let i2 = 0; i2 < numBorders; i2++) {
    const borderLabel = `border${borders[i2]}Radius`;
    let followRadius = getRadius(follow, borderLabel);
    let leadRadius = getRadius(lead, borderLabel);
    if (followRadius === void 0 && leadRadius === void 0)
      continue;
    followRadius || (followRadius = 0);
    leadRadius || (leadRadius = 0);
    const canMix = followRadius === 0 || leadRadius === 0 || isPx(followRadius) === isPx(leadRadius);
    if (canMix) {
      target[borderLabel] = Math.max(mixNumber$1(asNumber(followRadius), asNumber(leadRadius), progress2), 0);
      if (percent.test(leadRadius) || percent.test(followRadius)) {
        target[borderLabel] += "%";
      }
    } else {
      target[borderLabel] = leadRadius;
    }
  }
  if (follow.rotate || lead.rotate) {
    target.rotate = mixNumber$1(follow.rotate || 0, lead.rotate || 0, progress2);
  }
}
function getRadius(values, radiusName) {
  return values[radiusName] !== void 0 ? values[radiusName] : values.borderRadius;
}
const easeCrossfadeIn = /* @__PURE__ */ compress(0, 0.5, circOut);
const easeCrossfadeOut = /* @__PURE__ */ compress(0.5, 0.95, noop$a);
function compress(min2, max2, easing) {
  return (p2) => {
    if (p2 < min2)
      return 0;
    if (p2 > max2)
      return 1;
    return easing(/* @__PURE__ */ progress$1(min2, max2, p2));
  };
}
function copyAxisInto(axis, originAxis) {
  axis.min = originAxis.min;
  axis.max = originAxis.max;
}
function copyBoxInto(box, originBox) {
  copyAxisInto(box.x, originBox.x);
  copyAxisInto(box.y, originBox.y);
}
function copyAxisDeltaInto(delta, originDelta) {
  delta.translate = originDelta.translate;
  delta.scale = originDelta.scale;
  delta.originPoint = originDelta.originPoint;
  delta.origin = originDelta.origin;
}
function removePointDelta(point2, translate, scale2, originPoint, boxScale) {
  point2 -= translate;
  point2 = scalePoint(point2, 1 / scale2, originPoint);
  if (boxScale !== void 0) {
    point2 = scalePoint(point2, 1 / boxScale, originPoint);
  }
  return point2;
}
function removeAxisDelta(axis, translate = 0, scale2 = 1, origin2 = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
  if (percent.test(translate)) {
    translate = parseFloat(translate);
    const relativeProgress = mixNumber$1(sourceAxis.min, sourceAxis.max, translate / 100);
    translate = relativeProgress - sourceAxis.min;
  }
  if (typeof translate !== "number")
    return;
  let originPoint = mixNumber$1(originAxis.min, originAxis.max, origin2);
  if (axis === originAxis)
    originPoint -= translate;
  axis.min = removePointDelta(axis.min, translate, scale2, originPoint, boxScale);
  axis.max = removePointDelta(axis.max, translate, scale2, originPoint, boxScale);
}
function removeAxisTransforms(axis, transforms2, [key, scaleKey, originKey], origin2, sourceAxis) {
  removeAxisDelta(axis, transforms2[key], transforms2[scaleKey], transforms2[originKey], transforms2.scale, origin2, sourceAxis);
}
const xKeys = ["x", "scaleX", "originX"];
const yKeys = ["y", "scaleY", "originY"];
function removeBoxTransforms(box, transforms2, originBox, sourceBox) {
  removeAxisTransforms(box.x, transforms2, xKeys, originBox ? originBox.x : void 0, sourceBox ? sourceBox.x : void 0);
  removeAxisTransforms(box.y, transforms2, yKeys, originBox ? originBox.y : void 0, sourceBox ? sourceBox.y : void 0);
}
function isAxisDeltaZero(delta) {
  return delta.translate === 0 && delta.scale === 1;
}
function isDeltaZero(delta) {
  return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
}
function axisEquals(a2, b2) {
  return a2.min === b2.min && a2.max === b2.max;
}
function boxEquals(a2, b2) {
  return axisEquals(a2.x, b2.x) && axisEquals(a2.y, b2.y);
}
function axisEqualsRounded(a2, b2) {
  return Math.round(a2.min) === Math.round(b2.min) && Math.round(a2.max) === Math.round(b2.max);
}
function boxEqualsRounded(a2, b2) {
  return axisEqualsRounded(a2.x, b2.x) && axisEqualsRounded(a2.y, b2.y);
}
function aspectRatio(box) {
  return calcLength(box.x) / calcLength(box.y);
}
function axisDeltaEquals(a2, b2) {
  return a2.translate === b2.translate && a2.scale === b2.scale && a2.originPoint === b2.originPoint;
}
class NodeStack {
  constructor() {
    this.members = [];
  }
  add(node2) {
    addUniqueItem(this.members, node2);
    node2.scheduleRender();
  }
  remove(node2) {
    removeItem(this.members, node2);
    if (node2 === this.prevLead) {
      this.prevLead = void 0;
    }
    if (node2 === this.lead) {
      const prevLead = this.members[this.members.length - 1];
      if (prevLead) {
        this.promote(prevLead);
      }
    }
  }
  relegate(node2) {
    const indexOfNode2 = this.members.findIndex((member) => node2 === member);
    if (indexOfNode2 === 0)
      return false;
    let prevLead;
    for (let i2 = indexOfNode2; i2 >= 0; i2--) {
      const member = this.members[i2];
      if (member.isPresent !== false) {
        prevLead = member;
        break;
      }
    }
    if (prevLead) {
      this.promote(prevLead);
      return true;
    } else {
      return false;
    }
  }
  promote(node2, preserveFollowOpacity) {
    const prevLead = this.lead;
    if (node2 === prevLead)
      return;
    this.prevLead = prevLead;
    this.lead = node2;
    node2.show();
    if (prevLead) {
      prevLead.instance && prevLead.scheduleRender();
      node2.scheduleRender();
      node2.resumeFrom = prevLead;
      if (preserveFollowOpacity) {
        node2.resumeFrom.preserveOpacity = true;
      }
      if (prevLead.snapshot) {
        node2.snapshot = prevLead.snapshot;
        node2.snapshot.latestValues = prevLead.animationValues || prevLead.latestValues;
      }
      if (node2.root && node2.root.isUpdating) {
        node2.isLayoutDirty = true;
      }
      const { crossfade } = node2.options;
      if (crossfade === false) {
        prevLead.hide();
      }
    }
  }
  exitAnimationComplete() {
    this.members.forEach((node2) => {
      const { options, resumingFrom } = node2;
      options.onExitComplete && options.onExitComplete();
      if (resumingFrom) {
        resumingFrom.options.onExitComplete && resumingFrom.options.onExitComplete();
      }
    });
  }
  scheduleRender() {
    this.members.forEach((node2) => {
      node2.instance && node2.scheduleRender(false);
    });
  }
  /**
   * Clear any leads that have been removed this render to prevent them from being
   * used in future animations and to prevent memory leaks
   */
  removeLeadSnapshot() {
    if (this.lead && this.lead.snapshot) {
      this.lead.snapshot = void 0;
    }
  }
}
function buildProjectionTransform(delta, treeScale, latestTransform) {
  let transform2 = "";
  const xTranslate = delta.x.translate / treeScale.x;
  const yTranslate = delta.y.translate / treeScale.y;
  const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
  if (xTranslate || yTranslate || zTranslate) {
    transform2 = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
  }
  if (treeScale.x !== 1 || treeScale.y !== 1) {
    transform2 += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
  }
  if (latestTransform) {
    const { transformPerspective, rotate: rotate2, rotateX, rotateY, skewX, skewY } = latestTransform;
    if (transformPerspective)
      transform2 = `perspective(${transformPerspective}px) ${transform2}`;
    if (rotate2)
      transform2 += `rotate(${rotate2}deg) `;
    if (rotateX)
      transform2 += `rotateX(${rotateX}deg) `;
    if (rotateY)
      transform2 += `rotateY(${rotateY}deg) `;
    if (skewX)
      transform2 += `skewX(${skewX}deg) `;
    if (skewY)
      transform2 += `skewY(${skewY}deg) `;
  }
  const elementScaleX = delta.x.scale * treeScale.x;
  const elementScaleY = delta.y.scale * treeScale.y;
  if (elementScaleX !== 1 || elementScaleY !== 1) {
    transform2 += `scale(${elementScaleX}, ${elementScaleY})`;
  }
  return transform2 || "none";
}
const metrics = {
  type: "projectionFrame",
  totalNodes: 0,
  resolvedTargetDeltas: 0,
  recalculatedProjection: 0
};
const isDebug = typeof window !== "undefined" && window.MotionDebug !== void 0;
const transformAxes = ["", "X", "Y", "Z"];
const hiddenVisibility = { visibility: "hidden" };
const animationTarget = 1e3;
let id$1 = 0;
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
  const { latestValues } = visualElement;
  if (latestValues[key]) {
    values[key] = latestValues[key];
    visualElement.setStaticValue(key, 0);
    if (sharedAnimationValues) {
      sharedAnimationValues[key] = 0;
    }
  }
}
function cancelTreeOptimisedTransformAnimations(projectionNode) {
  projectionNode.hasCheckedOptimisedAppear = true;
  if (projectionNode.root === projectionNode)
    return;
  const { visualElement } = projectionNode.options;
  if (!visualElement)
    return;
  const appearId = getOptimisedAppearId(visualElement);
  if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
    const { layout: layout2, layoutId } = projectionNode.options;
    window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout2 || layoutId));
  }
  const { parent } = projectionNode;
  if (parent && !parent.hasCheckedOptimisedAppear) {
    cancelTreeOptimisedTransformAnimations(parent);
  }
}
function createProjectionNode({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform }) {
  return class ProjectionNode {
    constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
      this.id = id$1++;
      this.animationId = 0;
      this.children = /* @__PURE__ */ new Set();
      this.options = {};
      this.isTreeAnimating = false;
      this.isAnimationBlocked = false;
      this.isLayoutDirty = false;
      this.isProjectionDirty = false;
      this.isSharedProjectionDirty = false;
      this.isTransformDirty = false;
      this.updateManuallyBlocked = false;
      this.updateBlockedByResize = false;
      this.isUpdating = false;
      this.isSVG = false;
      this.needsReset = false;
      this.shouldResetTransform = false;
      this.hasCheckedOptimisedAppear = false;
      this.treeScale = { x: 1, y: 1 };
      this.eventHandlers = /* @__PURE__ */ new Map();
      this.hasTreeAnimated = false;
      this.updateScheduled = false;
      this.scheduleUpdate = () => this.update();
      this.projectionUpdateScheduled = false;
      this.checkUpdateFailed = () => {
        if (this.isUpdating) {
          this.isUpdating = false;
          this.clearAllSnapshots();
        }
      };
      this.updateProjection = () => {
        this.projectionUpdateScheduled = false;
        if (isDebug) {
          metrics.totalNodes = metrics.resolvedTargetDeltas = metrics.recalculatedProjection = 0;
        }
        this.nodes.forEach(propagateDirtyNodes);
        this.nodes.forEach(resolveTargetDelta);
        this.nodes.forEach(calcProjection);
        this.nodes.forEach(cleanDirtyNodes);
        if (isDebug) {
          window.MotionDebug.record(metrics);
        }
      };
      this.resolvedRelativeTargetAt = 0;
      this.hasProjected = false;
      this.isVisible = true;
      this.animationProgress = 0;
      this.sharedNodes = /* @__PURE__ */ new Map();
      this.latestValues = latestValues;
      this.root = parent ? parent.root || parent : this;
      this.path = parent ? [...parent.path, parent] : [];
      this.parent = parent;
      this.depth = parent ? parent.depth + 1 : 0;
      for (let i2 = 0; i2 < this.path.length; i2++) {
        this.path[i2].shouldResetTransform = true;
      }
      if (this.root === this)
        this.nodes = new FlatTree();
    }
    addEventListener(name2, handler) {
      if (!this.eventHandlers.has(name2)) {
        this.eventHandlers.set(name2, new SubscriptionManager());
      }
      return this.eventHandlers.get(name2).add(handler);
    }
    notifyListeners(name2, ...args) {
      const subscriptionManager = this.eventHandlers.get(name2);
      subscriptionManager && subscriptionManager.notify(...args);
    }
    hasListeners(name2) {
      return this.eventHandlers.has(name2);
    }
    /**
     * Lifecycles
     */
    mount(instance2, isLayoutDirty = this.root.hasTreeAnimated) {
      if (this.instance)
        return;
      this.isSVG = isSVGElement$1(instance2);
      this.instance = instance2;
      const { layoutId, layout: layout2, visualElement } = this.options;
      if (visualElement && !visualElement.current) {
        visualElement.mount(instance2);
      }
      this.root.nodes.add(this);
      this.parent && this.parent.children.add(this);
      if (isLayoutDirty && (layout2 || layoutId)) {
        this.isLayoutDirty = true;
      }
      if (attachResizeListener) {
        let cancelDelay;
        const resizeUnblockUpdate = () => this.root.updateBlockedByResize = false;
        attachResizeListener(instance2, () => {
          this.root.updateBlockedByResize = true;
          cancelDelay && cancelDelay();
          cancelDelay = delay$1(resizeUnblockUpdate, 250);
          if (globalProjectionState.hasAnimatedSinceResize) {
            globalProjectionState.hasAnimatedSinceResize = false;
            this.nodes.forEach(finishAnimation);
          }
        });
      }
      if (layoutId) {
        this.root.registerSharedNode(layoutId, this);
      }
      if (this.options.animate !== false && visualElement && (layoutId || layout2)) {
        this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout }) => {
          if (this.isTreeAnimationBlocked()) {
            this.target = void 0;
            this.relativeTarget = void 0;
            return;
          }
          const layoutTransition = this.options.transition || visualElement.getDefaultTransition() || defaultLayoutTransition;
          const { onLayoutAnimationStart, onLayoutAnimationComplete } = visualElement.getProps();
          const targetChanged = !this.targetLayout || !boxEqualsRounded(this.targetLayout, newLayout) || hasRelativeTargetChanged;
          const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
          if (this.options.layoutRoot || this.resumeFrom && this.resumeFrom.instance || hasOnlyRelativeTargetChanged || hasLayoutChanged && (targetChanged || !this.currentAnimation)) {
            if (this.resumeFrom) {
              this.resumingFrom = this.resumeFrom;
              this.resumingFrom.resumingFrom = void 0;
            }
            this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
            const animationOptions = {
              ...getValueTransition(layoutTransition, "layout"),
              onPlay: onLayoutAnimationStart,
              onComplete: onLayoutAnimationComplete
            };
            if (visualElement.shouldReduceMotion || this.options.layoutRoot) {
              animationOptions.delay = 0;
              animationOptions.type = false;
            }
            this.startAnimation(animationOptions);
          } else {
            if (!hasLayoutChanged) {
              finishAnimation(this);
            }
            if (this.isLead() && this.options.onExitComplete) {
              this.options.onExitComplete();
            }
          }
          this.targetLayout = newLayout;
        });
      }
    }
    unmount() {
      this.options.layoutId && this.willUpdate();
      this.root.nodes.remove(this);
      const stack = this.getStack();
      stack && stack.remove(this);
      this.parent && this.parent.children.delete(this);
      this.instance = void 0;
      cancelFrame(this.updateProjection);
    }
    // only on the root
    blockUpdate() {
      this.updateManuallyBlocked = true;
    }
    unblockUpdate() {
      this.updateManuallyBlocked = false;
    }
    isUpdateBlocked() {
      return this.updateManuallyBlocked || this.updateBlockedByResize;
    }
    isTreeAnimationBlocked() {
      return this.isAnimationBlocked || this.parent && this.parent.isTreeAnimationBlocked() || false;
    }
    // Note: currently only running on root node
    startUpdate() {
      if (this.isUpdateBlocked())
        return;
      this.isUpdating = true;
      this.nodes && this.nodes.forEach(resetSkewAndRotation);
      this.animationId++;
    }
    getTransformTemplate() {
      const { visualElement } = this.options;
      return visualElement && visualElement.getProps().transformTemplate;
    }
    willUpdate(shouldNotifyListeners = true) {
      this.root.hasTreeAnimated = true;
      if (this.root.isUpdateBlocked()) {
        this.options.onExitComplete && this.options.onExitComplete();
        return;
      }
      if (window.MotionCancelOptimisedAnimation && !this.hasCheckedOptimisedAppear) {
        cancelTreeOptimisedTransformAnimations(this);
      }
      !this.root.isUpdating && this.root.startUpdate();
      if (this.isLayoutDirty)
        return;
      this.isLayoutDirty = true;
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        node2.shouldResetTransform = true;
        node2.updateScroll("snapshot");
        if (node2.options.layoutRoot) {
          node2.willUpdate(false);
        }
      }
      const { layoutId, layout: layout2 } = this.options;
      if (layoutId === void 0 && !layout2)
        return;
      const transformTemplate = this.getTransformTemplate();
      this.prevTransformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
      this.updateSnapshot();
      shouldNotifyListeners && this.notifyListeners("willUpdate");
    }
    update() {
      this.updateScheduled = false;
      const updateWasBlocked = this.isUpdateBlocked();
      if (updateWasBlocked) {
        this.unblockUpdate();
        this.clearAllSnapshots();
        this.nodes.forEach(clearMeasurements);
        return;
      }
      if (!this.isUpdating) {
        this.nodes.forEach(clearIsLayoutDirty);
      }
      this.isUpdating = false;
      this.nodes.forEach(resetTransformStyle);
      this.nodes.forEach(updateLayout);
      this.nodes.forEach(notifyLayoutUpdate);
      this.clearAllSnapshots();
      const now2 = time.now();
      frameData.delta = clamp$2(0, 1e3 / 60, now2 - frameData.timestamp);
      frameData.timestamp = now2;
      frameData.isProcessing = true;
      frameSteps.update.process(frameData);
      frameSteps.preRender.process(frameData);
      frameSteps.render.process(frameData);
      frameData.isProcessing = false;
    }
    didUpdate() {
      if (!this.updateScheduled) {
        this.updateScheduled = true;
        microtask.read(this.scheduleUpdate);
      }
    }
    clearAllSnapshots() {
      this.nodes.forEach(clearSnapshot);
      this.sharedNodes.forEach(removeLeadSnapshots);
    }
    scheduleUpdateProjection() {
      if (!this.projectionUpdateScheduled) {
        this.projectionUpdateScheduled = true;
        frame.preRender(this.updateProjection, false, true);
      }
    }
    scheduleCheckAfterUnmount() {
      frame.postRender(() => {
        if (this.isLayoutDirty) {
          this.root.didUpdate();
        } else {
          this.root.checkUpdateFailed();
        }
      });
    }
    /**
     * Update measurements
     */
    updateSnapshot() {
      if (this.snapshot || !this.instance)
        return;
      this.snapshot = this.measure();
    }
    updateLayout() {
      if (!this.instance)
        return;
      this.updateScroll();
      if (!(this.options.alwaysMeasureLayout && this.isLead()) && !this.isLayoutDirty) {
        return;
      }
      if (this.resumeFrom && !this.resumeFrom.instance) {
        for (let i2 = 0; i2 < this.path.length; i2++) {
          const node2 = this.path[i2];
          node2.updateScroll();
        }
      }
      const prevLayout = this.layout;
      this.layout = this.measure(false);
      this.layoutCorrected = createBox();
      this.isLayoutDirty = false;
      this.projectionDelta = void 0;
      this.notifyListeners("measure", this.layout.layoutBox);
      const { visualElement } = this.options;
      visualElement && visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : void 0);
    }
    updateScroll(phase = "measure") {
      let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
      if (this.scroll && this.scroll.animationId === this.root.animationId && this.scroll.phase === phase) {
        needsMeasurement = false;
      }
      if (needsMeasurement) {
        const isRoot = checkIsScrollRoot(this.instance);
        this.scroll = {
          animationId: this.root.animationId,
          phase,
          isRoot,
          offset: measureScroll(this.instance),
          wasRoot: this.scroll ? this.scroll.isRoot : isRoot
        };
      }
    }
    resetTransform() {
      if (!resetTransform)
        return;
      const isResetRequested = this.isLayoutDirty || this.shouldResetTransform || this.options.alwaysMeasureLayout;
      const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
      const transformTemplate = this.getTransformTemplate();
      const transformTemplateValue = transformTemplate ? transformTemplate(this.latestValues, "") : void 0;
      const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
      if (isResetRequested && (hasProjection || hasTransform(this.latestValues) || transformTemplateHasChanged)) {
        resetTransform(this.instance, transformTemplateValue);
        this.shouldResetTransform = false;
        this.scheduleRender();
      }
    }
    measure(removeTransform = true) {
      const pageBox = this.measurePageBox();
      let layoutBox = this.removeElementScroll(pageBox);
      if (removeTransform) {
        layoutBox = this.removeTransform(layoutBox);
      }
      roundBox(layoutBox);
      return {
        animationId: this.root.animationId,
        measuredBox: pageBox,
        layoutBox,
        latestValues: {},
        source: this.id
      };
    }
    measurePageBox() {
      var _a2;
      const { visualElement } = this.options;
      if (!visualElement)
        return createBox();
      const box = visualElement.measureViewportBox();
      const wasInScrollRoot = ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) || this.path.some(checkNodeWasScrollRoot);
      if (!wasInScrollRoot) {
        const { scroll } = this.root;
        if (scroll) {
          translateAxis(box.x, scroll.offset.x);
          translateAxis(box.y, scroll.offset.y);
        }
      }
      return box;
    }
    removeElementScroll(box) {
      var _a2;
      const boxWithoutScroll = createBox();
      copyBoxInto(boxWithoutScroll, box);
      if ((_a2 = this.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot) {
        return boxWithoutScroll;
      }
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        const { scroll, options } = node2;
        if (node2 !== this.root && scroll && options.layoutScroll) {
          if (scroll.wasRoot) {
            copyBoxInto(boxWithoutScroll, box);
          }
          translateAxis(boxWithoutScroll.x, scroll.offset.x);
          translateAxis(boxWithoutScroll.y, scroll.offset.y);
        }
      }
      return boxWithoutScroll;
    }
    applyTransform(box, transformOnly = false) {
      const withTransforms = createBox();
      copyBoxInto(withTransforms, box);
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        if (!transformOnly && node2.options.layoutScroll && node2.scroll && node2 !== node2.root) {
          transformBox(withTransforms, {
            x: -node2.scroll.offset.x,
            y: -node2.scroll.offset.y
          });
        }
        if (!hasTransform(node2.latestValues))
          continue;
        transformBox(withTransforms, node2.latestValues);
      }
      if (hasTransform(this.latestValues)) {
        transformBox(withTransforms, this.latestValues);
      }
      return withTransforms;
    }
    removeTransform(box) {
      const boxWithoutTransform = createBox();
      copyBoxInto(boxWithoutTransform, box);
      for (let i2 = 0; i2 < this.path.length; i2++) {
        const node2 = this.path[i2];
        if (!node2.instance)
          continue;
        if (!hasTransform(node2.latestValues))
          continue;
        hasScale(node2.latestValues) && node2.updateSnapshot();
        const sourceBox = createBox();
        const nodeBox = node2.measurePageBox();
        copyBoxInto(sourceBox, nodeBox);
        removeBoxTransforms(boxWithoutTransform, node2.latestValues, node2.snapshot ? node2.snapshot.layoutBox : void 0, sourceBox);
      }
      if (hasTransform(this.latestValues)) {
        removeBoxTransforms(boxWithoutTransform, this.latestValues);
      }
      return boxWithoutTransform;
    }
    setTargetDelta(delta) {
      this.targetDelta = delta;
      this.root.scheduleUpdateProjection();
      this.isProjectionDirty = true;
    }
    setOptions(options) {
      this.options = {
        ...this.options,
        ...options,
        crossfade: options.crossfade !== void 0 ? options.crossfade : true
      };
    }
    clearMeasurements() {
      this.scroll = void 0;
      this.layout = void 0;
      this.snapshot = void 0;
      this.prevTransformTemplateValue = void 0;
      this.targetDelta = void 0;
      this.target = void 0;
      this.isLayoutDirty = false;
    }
    forceRelativeParentToResolveTarget() {
      if (!this.relativeParent)
        return;
      if (this.relativeParent.resolvedRelativeTargetAt !== frameData.timestamp) {
        this.relativeParent.resolveTargetDelta(true);
      }
    }
    resolveTargetDelta(forceRecalculation = false) {
      var _a2;
      const lead = this.getLead();
      this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
      this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
      this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
      const isShared = Boolean(this.resumingFrom) || this !== lead;
      const canSkip = !(forceRecalculation || isShared && this.isSharedProjectionDirty || this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty) || this.attemptToResolveRelativeTarget || this.root.updateBlockedByResize);
      if (canSkip)
        return;
      const { layout: layout2, layoutId } = this.options;
      if (!this.layout || !(layout2 || layoutId))
        return;
      this.resolvedRelativeTargetAt = frameData.timestamp;
      if (!this.targetDelta && !this.relativeTarget) {
        const relativeParent = this.getClosestProjectingParent();
        if (relativeParent && relativeParent.layout && this.animationProgress !== 1) {
          this.relativeParent = relativeParent;
          this.forceRelativeParentToResolveTarget();
          this.relativeTarget = createBox();
          this.relativeTargetOrigin = createBox();
          calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
          copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
        } else {
          this.relativeParent = this.relativeTarget = void 0;
        }
      }
      if (!this.relativeTarget && !this.targetDelta)
        return;
      if (!this.target) {
        this.target = createBox();
        this.targetWithTransforms = createBox();
      }
      if (this.relativeTarget && this.relativeTargetOrigin && this.relativeParent && this.relativeParent.target) {
        this.forceRelativeParentToResolveTarget();
        calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
      } else if (this.targetDelta) {
        if (Boolean(this.resumingFrom)) {
          this.target = this.applyTransform(this.layout.layoutBox);
        } else {
          copyBoxInto(this.target, this.layout.layoutBox);
        }
        applyBoxDelta(this.target, this.targetDelta);
      } else {
        copyBoxInto(this.target, this.layout.layoutBox);
      }
      if (this.attemptToResolveRelativeTarget) {
        this.attemptToResolveRelativeTarget = false;
        const relativeParent = this.getClosestProjectingParent();
        if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
          this.relativeParent = relativeParent;
          this.forceRelativeParentToResolveTarget();
          this.relativeTarget = createBox();
          this.relativeTargetOrigin = createBox();
          calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
          copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
        } else {
          this.relativeParent = this.relativeTarget = void 0;
        }
      }
      if (isDebug) {
        metrics.resolvedTargetDeltas++;
      }
    }
    getClosestProjectingParent() {
      if (!this.parent || hasScale(this.parent.latestValues) || has2DTranslate(this.parent.latestValues)) {
        return void 0;
      }
      if (this.parent.isProjecting()) {
        return this.parent;
      } else {
        return this.parent.getClosestProjectingParent();
      }
    }
    isProjecting() {
      return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
    }
    calcProjection() {
      var _a2;
      const lead = this.getLead();
      const isShared = Boolean(this.resumingFrom) || this !== lead;
      let canSkip = true;
      if (this.isProjectionDirty || ((_a2 = this.parent) === null || _a2 === void 0 ? void 0 : _a2.isProjectionDirty)) {
        canSkip = false;
      }
      if (isShared && (this.isSharedProjectionDirty || this.isTransformDirty)) {
        canSkip = false;
      }
      if (this.resolvedRelativeTargetAt === frameData.timestamp) {
        canSkip = false;
      }
      if (canSkip)
        return;
      const { layout: layout2, layoutId } = this.options;
      this.isTreeAnimating = Boolean(this.parent && this.parent.isTreeAnimating || this.currentAnimation || this.pendingAnimation);
      if (!this.isTreeAnimating) {
        this.targetDelta = this.relativeTarget = void 0;
      }
      if (!this.layout || !(layout2 || layoutId))
        return;
      copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
      const prevTreeScaleX = this.treeScale.x;
      const prevTreeScaleY = this.treeScale.y;
      applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
      if (lead.layout && !lead.target && (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
        lead.target = lead.layout.layoutBox;
        lead.targetWithTransforms = createBox();
      }
      const { target } = lead;
      if (!target) {
        if (this.prevProjectionDelta) {
          this.createProjectionDeltas();
          this.scheduleRender();
        }
        return;
      }
      if (!this.projectionDelta || !this.prevProjectionDelta) {
        this.createProjectionDeltas();
      } else {
        copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
        copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
      }
      calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
      if (this.treeScale.x !== prevTreeScaleX || this.treeScale.y !== prevTreeScaleY || !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) || !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
        this.hasProjected = true;
        this.scheduleRender();
        this.notifyListeners("projectionUpdate", target);
      }
      if (isDebug) {
        metrics.recalculatedProjection++;
      }
    }
    hide() {
      this.isVisible = false;
    }
    show() {
      this.isVisible = true;
    }
    scheduleRender(notifyAll = true) {
      var _a2;
      (_a2 = this.options.visualElement) === null || _a2 === void 0 ? void 0 : _a2.scheduleRender();
      if (notifyAll) {
        const stack = this.getStack();
        stack && stack.scheduleRender();
      }
      if (this.resumingFrom && !this.resumingFrom.instance) {
        this.resumingFrom = void 0;
      }
    }
    createProjectionDeltas() {
      this.prevProjectionDelta = createDelta();
      this.projectionDelta = createDelta();
      this.projectionDeltaWithTransform = createDelta();
    }
    setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
      const snapshot = this.snapshot;
      const snapshotLatestValues = snapshot ? snapshot.latestValues : {};
      const mixedValues = { ...this.latestValues };
      const targetDelta = createDelta();
      if (!this.relativeParent || !this.relativeParent.options.layoutRoot) {
        this.relativeTarget = this.relativeTargetOrigin = void 0;
      }
      this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
      const relativeLayout = createBox();
      const snapshotSource = snapshot ? snapshot.source : void 0;
      const layoutSource = this.layout ? this.layout.source : void 0;
      const isSharedLayoutAnimation = snapshotSource !== layoutSource;
      const stack = this.getStack();
      const isOnlyMember = !stack || stack.members.length <= 1;
      const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation && !isOnlyMember && this.options.crossfade === true && !this.path.some(hasOpacityCrossfade));
      this.animationProgress = 0;
      let prevRelativeTarget;
      this.mixTargetDelta = (latest) => {
        const progress2 = latest / 1e3;
        mixAxisDelta(targetDelta.x, delta.x, progress2);
        mixAxisDelta(targetDelta.y, delta.y, progress2);
        this.setTargetDelta(targetDelta);
        if (this.relativeTarget && this.relativeTargetOrigin && this.layout && this.relativeParent && this.relativeParent.layout) {
          calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
          mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress2);
          if (prevRelativeTarget && boxEquals(this.relativeTarget, prevRelativeTarget)) {
            this.isProjectionDirty = false;
          }
          if (!prevRelativeTarget)
            prevRelativeTarget = createBox();
          copyBoxInto(prevRelativeTarget, this.relativeTarget);
        }
        if (isSharedLayoutAnimation) {
          this.animationValues = mixedValues;
          mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress2, shouldCrossfadeOpacity, isOnlyMember);
        }
        this.root.scheduleUpdateProjection();
        this.scheduleRender();
        this.animationProgress = progress2;
      };
      this.mixTargetDelta(this.options.layoutRoot ? 1e3 : 0);
    }
    startAnimation(options) {
      this.notifyListeners("animationStart");
      this.currentAnimation && this.currentAnimation.stop();
      if (this.resumingFrom && this.resumingFrom.currentAnimation) {
        this.resumingFrom.currentAnimation.stop();
      }
      if (this.pendingAnimation) {
        cancelFrame(this.pendingAnimation);
        this.pendingAnimation = void 0;
      }
      this.pendingAnimation = frame.update(() => {
        globalProjectionState.hasAnimatedSinceResize = true;
        this.currentAnimation = animateSingleValue(0, animationTarget, {
          ...options,
          onUpdate: (latest) => {
            this.mixTargetDelta(latest);
            options.onUpdate && options.onUpdate(latest);
          },
          onComplete: () => {
            options.onComplete && options.onComplete();
            this.completeAnimation();
          }
        });
        if (this.resumingFrom) {
          this.resumingFrom.currentAnimation = this.currentAnimation;
        }
        this.pendingAnimation = void 0;
      });
    }
    completeAnimation() {
      if (this.resumingFrom) {
        this.resumingFrom.currentAnimation = void 0;
        this.resumingFrom.preserveOpacity = void 0;
      }
      const stack = this.getStack();
      stack && stack.exitAnimationComplete();
      this.resumingFrom = this.currentAnimation = this.animationValues = void 0;
      this.notifyListeners("animationComplete");
    }
    finishAnimation() {
      if (this.currentAnimation) {
        this.mixTargetDelta && this.mixTargetDelta(animationTarget);
        this.currentAnimation.stop();
      }
      this.completeAnimation();
    }
    applyTransformsToTarget() {
      const lead = this.getLead();
      let { targetWithTransforms, target, layout: layout2, latestValues } = lead;
      if (!targetWithTransforms || !target || !layout2)
        return;
      if (this !== lead && this.layout && layout2 && shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout2.layoutBox)) {
        target = this.target || createBox();
        const xLength = calcLength(this.layout.layoutBox.x);
        target.x.min = lead.target.x.min;
        target.x.max = target.x.min + xLength;
        const yLength = calcLength(this.layout.layoutBox.y);
        target.y.min = lead.target.y.min;
        target.y.max = target.y.min + yLength;
      }
      copyBoxInto(targetWithTransforms, target);
      transformBox(targetWithTransforms, latestValues);
      calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
    }
    registerSharedNode(layoutId, node2) {
      if (!this.sharedNodes.has(layoutId)) {
        this.sharedNodes.set(layoutId, new NodeStack());
      }
      const stack = this.sharedNodes.get(layoutId);
      stack.add(node2);
      const config2 = node2.options.initialPromotionConfig;
      node2.promote({
        transition: config2 ? config2.transition : void 0,
        preserveFollowOpacity: config2 && config2.shouldPreserveFollowOpacity ? config2.shouldPreserveFollowOpacity(node2) : void 0
      });
    }
    isLead() {
      const stack = this.getStack();
      return stack ? stack.lead === this : true;
    }
    getLead() {
      var _a2;
      const { layoutId } = this.options;
      return layoutId ? ((_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.lead) || this : this;
    }
    getPrevLead() {
      var _a2;
      const { layoutId } = this.options;
      return layoutId ? (_a2 = this.getStack()) === null || _a2 === void 0 ? void 0 : _a2.prevLead : void 0;
    }
    getStack() {
      const { layoutId } = this.options;
      if (layoutId)
        return this.root.sharedNodes.get(layoutId);
    }
    promote({ needsReset, transition: transition3, preserveFollowOpacity } = {}) {
      const stack = this.getStack();
      if (stack)
        stack.promote(this, preserveFollowOpacity);
      if (needsReset) {
        this.projectionDelta = void 0;
        this.needsReset = true;
      }
      if (transition3)
        this.setOptions({ transition: transition3 });
    }
    relegate() {
      const stack = this.getStack();
      if (stack) {
        return stack.relegate(this);
      } else {
        return false;
      }
    }
    resetSkewAndRotation() {
      const { visualElement } = this.options;
      if (!visualElement)
        return;
      let hasDistortingTransform = false;
      const { latestValues } = visualElement;
      if (latestValues.z || latestValues.rotate || latestValues.rotateX || latestValues.rotateY || latestValues.rotateZ || latestValues.skewX || latestValues.skewY) {
        hasDistortingTransform = true;
      }
      if (!hasDistortingTransform)
        return;
      const resetValues = {};
      if (latestValues.z) {
        resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
      }
      for (let i2 = 0; i2 < transformAxes.length; i2++) {
        resetDistortingTransform(`rotate${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
        resetDistortingTransform(`skew${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
      }
      visualElement.render();
      for (const key in resetValues) {
        visualElement.setStaticValue(key, resetValues[key]);
        if (this.animationValues) {
          this.animationValues[key] = resetValues[key];
        }
      }
      visualElement.scheduleRender();
    }
    getProjectionStyles(styleProp) {
      var _a2, _b2;
      if (!this.instance || this.isSVG)
        return void 0;
      if (!this.isVisible) {
        return hiddenVisibility;
      }
      const styles2 = {
        visibility: ""
      };
      const transformTemplate = this.getTransformTemplate();
      if (this.needsReset) {
        this.needsReset = false;
        styles2.opacity = "";
        styles2.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
        styles2.transform = transformTemplate ? transformTemplate(this.latestValues, "") : "none";
        return styles2;
      }
      const lead = this.getLead();
      if (!this.projectionDelta || !this.layout || !lead.target) {
        const emptyStyles = {};
        if (this.options.layoutId) {
          emptyStyles.opacity = this.latestValues.opacity !== void 0 ? this.latestValues.opacity : 1;
          emptyStyles.pointerEvents = resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
        }
        if (this.hasProjected && !hasTransform(this.latestValues)) {
          emptyStyles.transform = transformTemplate ? transformTemplate({}, "") : "none";
          this.hasProjected = false;
        }
        return emptyStyles;
      }
      const valuesToRender = lead.animationValues || lead.latestValues;
      this.applyTransformsToTarget();
      styles2.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
      if (transformTemplate) {
        styles2.transform = transformTemplate(valuesToRender, styles2.transform);
      }
      const { x: x2, y: y2 } = this.projectionDelta;
      styles2.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
      if (lead.animationValues) {
        styles2.opacity = lead === this ? (_b2 = (_a2 = valuesToRender.opacity) !== null && _a2 !== void 0 ? _a2 : this.latestValues.opacity) !== null && _b2 !== void 0 ? _b2 : 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
      } else {
        styles2.opacity = lead === this ? valuesToRender.opacity !== void 0 ? valuesToRender.opacity : "" : valuesToRender.opacityExit !== void 0 ? valuesToRender.opacityExit : 0;
      }
      for (const key in scaleCorrectors) {
        if (valuesToRender[key] === void 0)
          continue;
        const { correct, applyTo } = scaleCorrectors[key];
        const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
        if (applyTo) {
          const num = applyTo.length;
          for (let i2 = 0; i2 < num; i2++) {
            styles2[applyTo[i2]] = corrected;
          }
        } else {
          styles2[key] = corrected;
        }
      }
      if (this.options.layoutId) {
        styles2.pointerEvents = lead === this ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "" : "none";
      }
      return styles2;
    }
    clearSnapshot() {
      this.resumeFrom = this.snapshot = void 0;
    }
    // Only run on root
    resetTree() {
      this.root.nodes.forEach((node2) => {
        var _a2;
        return (_a2 = node2.currentAnimation) === null || _a2 === void 0 ? void 0 : _a2.stop();
      });
      this.root.nodes.forEach(clearMeasurements);
      this.root.sharedNodes.clear();
    }
  };
}
function updateLayout(node2) {
  node2.updateLayout();
}
function notifyLayoutUpdate(node2) {
  var _a2;
  const snapshot = ((_a2 = node2.resumeFrom) === null || _a2 === void 0 ? void 0 : _a2.snapshot) || node2.snapshot;
  if (node2.isLead() && node2.layout && snapshot && node2.hasListeners("didUpdate")) {
    const { layoutBox: layout2, measuredBox: measuredLayout } = node2.layout;
    const { animationType } = node2.options;
    const isShared = snapshot.source !== node2.layout.source;
    if (animationType === "size") {
      eachAxis((axis) => {
        const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
        const length2 = calcLength(axisSnapshot);
        axisSnapshot.min = layout2[axis].min;
        axisSnapshot.max = axisSnapshot.min + length2;
      });
    } else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout2)) {
      eachAxis((axis) => {
        const axisSnapshot = isShared ? snapshot.measuredBox[axis] : snapshot.layoutBox[axis];
        const length2 = calcLength(layout2[axis]);
        axisSnapshot.max = axisSnapshot.min + length2;
        if (node2.relativeTarget && !node2.currentAnimation) {
          node2.isProjectionDirty = true;
          node2.relativeTarget[axis].max = node2.relativeTarget[axis].min + length2;
        }
      });
    }
    const layoutDelta = createDelta();
    calcBoxDelta(layoutDelta, layout2, snapshot.layoutBox);
    const visualDelta = createDelta();
    if (isShared) {
      calcBoxDelta(visualDelta, node2.applyTransform(measuredLayout, true), snapshot.measuredBox);
    } else {
      calcBoxDelta(visualDelta, layout2, snapshot.layoutBox);
    }
    const hasLayoutChanged = !isDeltaZero(layoutDelta);
    let hasRelativeTargetChanged = false;
    if (!node2.resumeFrom) {
      const relativeParent = node2.getClosestProjectingParent();
      if (relativeParent && !relativeParent.resumeFrom) {
        const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
        if (parentSnapshot && parentLayout) {
          const relativeSnapshot = createBox();
          calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
          const relativeLayout = createBox();
          calcRelativePosition(relativeLayout, layout2, parentLayout.layoutBox);
          if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
            hasRelativeTargetChanged = true;
          }
          if (relativeParent.options.layoutRoot) {
            node2.relativeTarget = relativeLayout;
            node2.relativeTargetOrigin = relativeSnapshot;
            node2.relativeParent = relativeParent;
          }
        }
      }
    }
    node2.notifyListeners("didUpdate", {
      layout: layout2,
      snapshot,
      delta: visualDelta,
      layoutDelta,
      hasLayoutChanged,
      hasRelativeTargetChanged
    });
  } else if (node2.isLead()) {
    const { onExitComplete } = node2.options;
    onExitComplete && onExitComplete();
  }
  node2.options.transition = void 0;
}
function propagateDirtyNodes(node2) {
  if (isDebug) {
    metrics.totalNodes++;
  }
  if (!node2.parent)
    return;
  if (!node2.isProjecting()) {
    node2.isProjectionDirty = node2.parent.isProjectionDirty;
  }
  node2.isSharedProjectionDirty || (node2.isSharedProjectionDirty = Boolean(node2.isProjectionDirty || node2.parent.isProjectionDirty || node2.parent.isSharedProjectionDirty));
  node2.isTransformDirty || (node2.isTransformDirty = node2.parent.isTransformDirty);
}
function cleanDirtyNodes(node2) {
  node2.isProjectionDirty = node2.isSharedProjectionDirty = node2.isTransformDirty = false;
}
function clearSnapshot(node2) {
  node2.clearSnapshot();
}
function clearMeasurements(node2) {
  node2.clearMeasurements();
}
function clearIsLayoutDirty(node2) {
  node2.isLayoutDirty = false;
}
function resetTransformStyle(node2) {
  const { visualElement } = node2.options;
  if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
    visualElement.notify("BeforeLayoutMeasure");
  }
  node2.resetTransform();
}
function finishAnimation(node2) {
  node2.finishAnimation();
  node2.targetDelta = node2.relativeTarget = node2.target = void 0;
  node2.isProjectionDirty = true;
}
function resolveTargetDelta(node2) {
  node2.resolveTargetDelta();
}
function calcProjection(node2) {
  node2.calcProjection();
}
function resetSkewAndRotation(node2) {
  node2.resetSkewAndRotation();
}
function removeLeadSnapshots(stack) {
  stack.removeLeadSnapshot();
}
function mixAxisDelta(output2, delta, p2) {
  output2.translate = mixNumber$1(delta.translate, 0, p2);
  output2.scale = mixNumber$1(delta.scale, 1, p2);
  output2.origin = delta.origin;
  output2.originPoint = delta.originPoint;
}
function mixAxis(output2, from2, to2, p2) {
  output2.min = mixNumber$1(from2.min, to2.min, p2);
  output2.max = mixNumber$1(from2.max, to2.max, p2);
}
function mixBox(output2, from2, to2, p2) {
  mixAxis(output2.x, from2.x, to2.x, p2);
  mixAxis(output2.y, from2.y, to2.y, p2);
}
function hasOpacityCrossfade(node2) {
  return node2.animationValues && node2.animationValues.opacityExit !== void 0;
}
const defaultLayoutTransition = {
  duration: 0.45,
  ease: [0.4, 0, 0.1, 1]
};
const userAgentContains = (string3) => typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().includes(string3);
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/") ? Math.round : noop$a;
function roundAxis(axis) {
  axis.min = roundPoint(axis.min);
  axis.max = roundPoint(axis.max);
}
function roundBox(box) {
  roundAxis(box.x);
  roundAxis(box.y);
}
function shouldAnimatePositionOnly(animationType, snapshot, layout2) {
  return animationType === "position" || animationType === "preserve-aspect" && !isNear(aspectRatio(snapshot), aspectRatio(layout2), 0.2);
}
function checkNodeWasScrollRoot(node2) {
  var _a2;
  return node2 !== node2.root && ((_a2 = node2.scroll) === null || _a2 === void 0 ? void 0 : _a2.wasRoot);
}
const DocumentProjectionNode = createProjectionNode({
  attachResizeListener: (ref, notify2) => addDomEvent(ref, "resize", notify2),
  measureScroll: () => ({
    x: document.documentElement.scrollLeft || document.body.scrollLeft,
    y: document.documentElement.scrollTop || document.body.scrollTop
  }),
  checkIsScrollRoot: () => true
});
const rootProjectionNode = {
  current: void 0
};
const HTMLProjectionNode = createProjectionNode({
  measureScroll: (instance2) => ({
    x: instance2.scrollLeft,
    y: instance2.scrollTop
  }),
  defaultParent: () => {
    if (!rootProjectionNode.current) {
      const documentNode = new DocumentProjectionNode({});
      documentNode.mount(window);
      documentNode.setOptions({ layoutScroll: true });
      rootProjectionNode.current = documentNode;
    }
    return rootProjectionNode.current;
  },
  resetTransform: (instance2, value2) => {
    instance2.style.transform = value2 !== void 0 ? value2 : "none";
  },
  checkIsScrollRoot: (instance2) => Boolean(window.getComputedStyle(instance2).position === "fixed")
});
const drag = {
  pan: {
    Feature: PanGesture
  },
  drag: {
    Feature: DragGesture,
    ProjectionNode: HTMLProjectionNode,
    MeasureLayout
  }
};
function handleHoverEvent(node2, event, lifecycle) {
  const { props } = node2;
  if (node2.animationState && props.whileHover) {
    node2.animationState.setActive("whileHover", lifecycle === "Start");
  }
  const eventName = "onHover" + lifecycle;
  const callback2 = props[eventName];
  if (callback2) {
    frame.postRender(() => callback2(event, extractEventInfo(event)));
  }
}
class HoverGesture extends Feature {
  mount() {
    const { current } = this.node;
    if (!current)
      return;
    this.unmount = hover$2(current, (startEvent) => {
      handleHoverEvent(this.node, startEvent, "Start");
      return (endEvent) => handleHoverEvent(this.node, endEvent, "End");
    });
  }
  unmount() {
  }
}
class FocusGesture extends Feature {
  constructor() {
    super(...arguments);
    this.isActive = false;
  }
  onFocus() {
    let isFocusVisible = false;
    try {
      isFocusVisible = this.node.current.matches(":focus-visible");
    } catch (e2) {
      isFocusVisible = true;
    }
    if (!isFocusVisible || !this.node.animationState)
      return;
    this.node.animationState.setActive("whileFocus", true);
    this.isActive = true;
  }
  onBlur() {
    if (!this.isActive || !this.node.animationState)
      return;
    this.node.animationState.setActive("whileFocus", false);
    this.isActive = false;
  }
  mount() {
    this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
  }
  unmount() {
  }
}
function handlePressEvent(node2, event, lifecycle) {
  const { props } = node2;
  if (node2.animationState && props.whileTap) {
    node2.animationState.setActive("whileTap", lifecycle === "Start");
  }
  const eventName = "onTap" + (lifecycle === "End" ? "" : lifecycle);
  const callback2 = props[eventName];
  if (callback2) {
    frame.postRender(() => callback2(event, extractEventInfo(event)));
  }
}
class PressGesture extends Feature {
  mount() {
    const { current } = this.node;
    if (!current)
      return;
    this.unmount = press(current, (startEvent) => {
      handlePressEvent(this.node, startEvent, "Start");
      return (endEvent, { success }) => handlePressEvent(this.node, endEvent, success ? "End" : "Cancel");
    }, { useGlobalTarget: this.node.props.globalTapTarget });
  }
  unmount() {
  }
}
const observerCallbacks = /* @__PURE__ */ new WeakMap();
const observers$1 = /* @__PURE__ */ new WeakMap();
const fireObserverCallback = (entry) => {
  const callback2 = observerCallbacks.get(entry.target);
  callback2 && callback2(entry);
};
const fireAllObserverCallbacks = (entries) => {
  entries.forEach(fireObserverCallback);
};
function initIntersectionObserver({ root: root2, ...options }) {
  const lookupRoot = root2 || document;
  if (!observers$1.has(lookupRoot)) {
    observers$1.set(lookupRoot, {});
  }
  const rootObservers = observers$1.get(lookupRoot);
  const key = JSON.stringify(options);
  if (!rootObservers[key]) {
    rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root: root2, ...options });
  }
  return rootObservers[key];
}
function observeIntersection(element2, options, callback2) {
  const rootInteresectionObserver = initIntersectionObserver(options);
  observerCallbacks.set(element2, callback2);
  rootInteresectionObserver.observe(element2);
  return () => {
    observerCallbacks.delete(element2);
    rootInteresectionObserver.unobserve(element2);
  };
}
const thresholdNames = {
  some: 0,
  all: 1
};
class InViewFeature extends Feature {
  constructor() {
    super(...arguments);
    this.hasEnteredView = false;
    this.isInView = false;
  }
  startObserver() {
    this.unmount();
    const { viewport = {} } = this.node.getProps();
    const { root: root2, margin: rootMargin, amount = "some", once } = viewport;
    const options = {
      root: root2 ? root2.current : void 0,
      rootMargin,
      threshold: typeof amount === "number" ? amount : thresholdNames[amount]
    };
    const onIntersectionUpdate = (entry) => {
      const { isIntersecting } = entry;
      if (this.isInView === isIntersecting)
        return;
      this.isInView = isIntersecting;
      if (once && !isIntersecting && this.hasEnteredView) {
        return;
      } else if (isIntersecting) {
        this.hasEnteredView = true;
      }
      if (this.node.animationState) {
        this.node.animationState.setActive("whileInView", isIntersecting);
      }
      const { onViewportEnter, onViewportLeave } = this.node.getProps();
      const callback2 = isIntersecting ? onViewportEnter : onViewportLeave;
      callback2 && callback2(entry);
    };
    return observeIntersection(this.node.current, options, onIntersectionUpdate);
  }
  mount() {
    this.startObserver();
  }
  update() {
    if (typeof IntersectionObserver === "undefined")
      return;
    const { props, prevProps } = this.node;
    const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
    if (hasOptionsChanged) {
      this.startObserver();
    }
  }
  unmount() {
  }
}
function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
  return (name2) => viewport[name2] !== prevViewport[name2];
}
const gestureAnimations = {
  inView: {
    Feature: InViewFeature
  },
  tap: {
    Feature: PressGesture
  },
  focus: {
    Feature: FocusGesture
  },
  hover: {
    Feature: HoverGesture
  }
};
const layout = {
  layout: {
    ProjectionNode: HTMLProjectionNode,
    MeasureLayout
  }
};
const prefersReducedMotion = { current: null };
const hasReducedMotionListener = { current: false };
function initPrefersReducedMotion() {
  hasReducedMotionListener.current = true;
  if (!isBrowser$3)
    return;
  if (window.matchMedia) {
    const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
    const setReducedMotionPreferences = () => prefersReducedMotion.current = motionMediaQuery.matches;
    motionMediaQuery.addListener(setReducedMotionPreferences);
    setReducedMotionPreferences();
  } else {
    prefersReducedMotion.current = false;
  }
}
const valueTypes = [...dimensionValueTypes, color$2, complex];
const findValueType = (v2) => valueTypes.find(testValueType(v2));
const visualElementStore = /* @__PURE__ */ new WeakMap();
function updateMotionValuesFromProps(element2, next2, prev2) {
  for (const key in next2) {
    const nextValue = next2[key];
    const prevValue = prev2[key];
    if (isMotionValue(nextValue)) {
      element2.addValue(key, nextValue);
    } else if (isMotionValue(prevValue)) {
      element2.addValue(key, motionValue(nextValue, { owner: element2 }));
    } else if (prevValue !== nextValue) {
      if (element2.hasValue(key)) {
        const existingValue = element2.getValue(key);
        if (existingValue.liveStyle === true) {
          existingValue.jump(nextValue);
        } else if (!existingValue.hasAnimated) {
          existingValue.set(nextValue);
        }
      } else {
        const latestValue = element2.getStaticValue(key);
        element2.addValue(key, motionValue(latestValue !== void 0 ? latestValue : nextValue, { owner: element2 }));
      }
    }
  }
  for (const key in prev2) {
    if (next2[key] === void 0)
      element2.removeValue(key);
  }
  return next2;
}
const propEventHandlers = [
  "AnimationStart",
  "AnimationComplete",
  "Update",
  "BeforeLayoutMeasure",
  "LayoutMeasure",
  "LayoutAnimationStart",
  "LayoutAnimationComplete"
];
class VisualElement {
  /**
   * This method takes React props and returns found MotionValues. For example, HTML
   * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
   *
   * This isn't an abstract method as it needs calling in the constructor, but it is
   * intended to be one.
   */
  scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
    return {};
  }
  constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState }, options = {}) {
    this.current = null;
    this.children = /* @__PURE__ */ new Set();
    this.isVariantNode = false;
    this.isControllingVariants = false;
    this.shouldReduceMotion = null;
    this.values = /* @__PURE__ */ new Map();
    this.KeyframeResolver = KeyframeResolver;
    this.features = {};
    this.valueSubscriptions = /* @__PURE__ */ new Map();
    this.prevMotionValues = {};
    this.events = {};
    this.propEventSubscriptions = {};
    this.notifyUpdate = () => this.notify("Update", this.latestValues);
    this.render = () => {
      if (!this.current)
        return;
      this.triggerBuild();
      this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
    };
    this.renderScheduledAt = 0;
    this.scheduleRender = () => {
      const now2 = time.now();
      if (this.renderScheduledAt < now2) {
        this.renderScheduledAt = now2;
        frame.render(this.render, false, true);
      }
    };
    const { latestValues, renderState, onUpdate } = visualState;
    this.onUpdate = onUpdate;
    this.latestValues = latestValues;
    this.baseTarget = { ...latestValues };
    this.initialValues = props.initial ? { ...latestValues } : {};
    this.renderState = renderState;
    this.parent = parent;
    this.props = props;
    this.presenceContext = presenceContext;
    this.depth = parent ? parent.depth + 1 : 0;
    this.reducedMotionConfig = reducedMotionConfig;
    this.options = options;
    this.blockInitialAnimation = Boolean(blockInitialAnimation);
    this.isControllingVariants = isControllingVariants(props);
    this.isVariantNode = isVariantNode(props);
    if (this.isVariantNode) {
      this.variantChildren = /* @__PURE__ */ new Set();
    }
    this.manuallyAnimateOnMount = Boolean(parent && parent.current);
    const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
    for (const key in initialMotionValues) {
      const value2 = initialMotionValues[key];
      if (latestValues[key] !== void 0 && isMotionValue(value2)) {
        value2.set(latestValues[key], false);
      }
    }
  }
  mount(instance2) {
    this.current = instance2;
    visualElementStore.set(instance2, this);
    if (this.projection && !this.projection.instance) {
      this.projection.mount(instance2);
    }
    if (this.parent && this.isVariantNode && !this.isControllingVariants) {
      this.removeFromVariantTree = this.parent.addVariantChild(this);
    }
    this.values.forEach((value2, key) => this.bindToMotionValue(key, value2));
    if (!hasReducedMotionListener.current) {
      initPrefersReducedMotion();
    }
    this.shouldReduceMotion = this.reducedMotionConfig === "never" ? false : this.reducedMotionConfig === "always" ? true : prefersReducedMotion.current;
    if (this.parent)
      this.parent.children.add(this);
    this.update(this.props, this.presenceContext);
  }
  unmount() {
    visualElementStore.delete(this.current);
    this.projection && this.projection.unmount();
    cancelFrame(this.notifyUpdate);
    cancelFrame(this.render);
    this.valueSubscriptions.forEach((remove) => remove());
    this.valueSubscriptions.clear();
    this.removeFromVariantTree && this.removeFromVariantTree();
    this.parent && this.parent.children.delete(this);
    for (const key in this.events) {
      this.events[key].clear();
    }
    for (const key in this.features) {
      const feature = this.features[key];
      if (feature) {
        feature.unmount();
        feature.isMounted = false;
      }
    }
    this.current = null;
  }
  bindToMotionValue(key, value2) {
    if (this.valueSubscriptions.has(key)) {
      this.valueSubscriptions.get(key)();
    }
    const valueIsTransform = transformProps.has(key);
    const removeOnChange = value2.on("change", (latestValue) => {
      this.latestValues[key] = latestValue;
      this.props.onUpdate && frame.preRender(this.notifyUpdate);
      if (valueIsTransform && this.projection) {
        this.projection.isTransformDirty = true;
      }
    });
    const removeOnRenderRequest = value2.on("renderRequest", this.scheduleRender);
    let removeSyncCheck;
    if (window.MotionCheckAppearSync) {
      removeSyncCheck = window.MotionCheckAppearSync(this, key, value2);
    }
    this.valueSubscriptions.set(key, () => {
      removeOnChange();
      removeOnRenderRequest();
      if (removeSyncCheck)
        removeSyncCheck();
      if (value2.owner)
        value2.stop();
    });
  }
  sortNodePosition(other) {
    if (!this.current || !this.sortInstanceNodePosition || this.type !== other.type) {
      return 0;
    }
    return this.sortInstanceNodePosition(this.current, other.current);
  }
  updateFeatures() {
    let key = "animation";
    for (key in featureDefinitions) {
      const featureDefinition = featureDefinitions[key];
      if (!featureDefinition)
        continue;
      const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
      if (!this.features[key] && FeatureConstructor && isEnabled(this.props)) {
        this.features[key] = new FeatureConstructor(this);
      }
      if (this.features[key]) {
        const feature = this.features[key];
        if (feature.isMounted) {
          feature.update();
        } else {
          feature.mount();
          feature.isMounted = true;
        }
      }
    }
  }
  triggerBuild() {
    this.build(this.renderState, this.latestValues, this.props);
  }
  /**
   * Measure the current viewport box with or without transforms.
   * Only measures axis-aligned boxes, rotate and skew must be manually
   * removed with a re-render to work.
   */
  measureViewportBox() {
    return this.current ? this.measureInstanceViewportBox(this.current, this.props) : createBox();
  }
  getStaticValue(key) {
    return this.latestValues[key];
  }
  setStaticValue(key, value2) {
    this.latestValues[key] = value2;
  }
  /**
   * Update the provided props. Ensure any newly-added motion values are
   * added to our map, old ones removed, and listeners updated.
   */
  update(props, presenceContext) {
    if (props.transformTemplate || this.props.transformTemplate) {
      this.scheduleRender();
    }
    this.prevProps = this.props;
    this.props = props;
    this.prevPresenceContext = this.presenceContext;
    this.presenceContext = presenceContext;
    for (let i2 = 0; i2 < propEventHandlers.length; i2++) {
      const key = propEventHandlers[i2];
      if (this.propEventSubscriptions[key]) {
        this.propEventSubscriptions[key]();
        delete this.propEventSubscriptions[key];
      }
      const listenerName = "on" + key;
      const listener = props[listenerName];
      if (listener) {
        this.propEventSubscriptions[key] = this.on(key, listener);
      }
    }
    this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
    if (this.handleChildMotionValue) {
      this.handleChildMotionValue();
    }
    this.onUpdate && this.onUpdate(this);
  }
  getProps() {
    return this.props;
  }
  /**
   * Returns the variant definition with a given name.
   */
  getVariant(name2) {
    return this.props.variants ? this.props.variants[name2] : void 0;
  }
  /**
   * Returns the defined default transition on this component.
   */
  getDefaultTransition() {
    return this.props.transition;
  }
  getTransformPagePoint() {
    return this.props.transformPagePoint;
  }
  getClosestVariantNode() {
    return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
  }
  /**
   * Add a child visual element to our set of children.
   */
  addVariantChild(child) {
    const closestVariantNode = this.getClosestVariantNode();
    if (closestVariantNode) {
      closestVariantNode.variantChildren && closestVariantNode.variantChildren.add(child);
      return () => closestVariantNode.variantChildren.delete(child);
    }
  }
  /**
   * Add a motion value and bind it to this visual element.
   */
  addValue(key, value2) {
    const existingValue = this.values.get(key);
    if (value2 !== existingValue) {
      if (existingValue)
        this.removeValue(key);
      this.bindToMotionValue(key, value2);
      this.values.set(key, value2);
      this.latestValues[key] = value2.get();
    }
  }
  /**
   * Remove a motion value and unbind any active subscriptions.
   */
  removeValue(key) {
    this.values.delete(key);
    const unsubscribe = this.valueSubscriptions.get(key);
    if (unsubscribe) {
      unsubscribe();
      this.valueSubscriptions.delete(key);
    }
    delete this.latestValues[key];
    this.removeValueFromRenderState(key, this.renderState);
  }
  /**
   * Check whether we have a motion value for this key
   */
  hasValue(key) {
    return this.values.has(key);
  }
  getValue(key, defaultValue2) {
    if (this.props.values && this.props.values[key]) {
      return this.props.values[key];
    }
    let value2 = this.values.get(key);
    if (value2 === void 0 && defaultValue2 !== void 0) {
      value2 = motionValue(defaultValue2 === null ? void 0 : defaultValue2, { owner: this });
      this.addValue(key, value2);
    }
    return value2;
  }
  /**
   * If we're trying to animate to a previously unencountered value,
   * we need to check for it in our state and as a last resort read it
   * directly from the instance (which might have performance implications).
   */
  readValue(key, target) {
    var _a2;
    let value2 = this.latestValues[key] !== void 0 || !this.current ? this.latestValues[key] : (_a2 = this.getBaseTargetFromProps(this.props, key)) !== null && _a2 !== void 0 ? _a2 : this.readValueFromInstance(this.current, key, this.options);
    if (value2 !== void 0 && value2 !== null) {
      if (typeof value2 === "string" && (isNumericalString(value2) || isZeroValueString(value2))) {
        value2 = parseFloat(value2);
      } else if (!findValueType(value2) && complex.test(target)) {
        value2 = getAnimatableNone(key, target);
      }
      this.setBaseTarget(key, isMotionValue(value2) ? value2.get() : value2);
    }
    return isMotionValue(value2) ? value2.get() : value2;
  }
  /**
   * Set the base target to later animate back to. This is currently
   * only hydrated on creation and when we first read a value.
   */
  setBaseTarget(key, value2) {
    this.baseTarget[key] = value2;
  }
  /**
   * Find the base target for a value thats been removed from all animation
   * props.
   */
  getBaseTarget(key) {
    var _a2;
    const { initial } = this.props;
    let valueFromInitial;
    if (typeof initial === "string" || typeof initial === "object") {
      const variant = resolveVariantFromProps(this.props, initial, (_a2 = this.presenceContext) === null || _a2 === void 0 ? void 0 : _a2.custom);
      if (variant) {
        valueFromInitial = variant[key];
      }
    }
    if (initial && valueFromInitial !== void 0) {
      return valueFromInitial;
    }
    const target = this.getBaseTargetFromProps(this.props, key);
    if (target !== void 0 && !isMotionValue(target))
      return target;
    return this.initialValues[key] !== void 0 && valueFromInitial === void 0 ? void 0 : this.baseTarget[key];
  }
  on(eventName, callback2) {
    if (!this.events[eventName]) {
      this.events[eventName] = new SubscriptionManager();
    }
    return this.events[eventName].add(callback2);
  }
  notify(eventName, ...args) {
    if (this.events[eventName]) {
      this.events[eventName].notify(...args);
    }
  }
}
class DOMVisualElement extends VisualElement {
  constructor() {
    super(...arguments);
    this.KeyframeResolver = DOMKeyframesResolver;
  }
  sortInstanceNodePosition(a2, b2) {
    return a2.compareDocumentPosition(b2) & 2 ? 1 : -1;
  }
  getBaseTargetFromProps(props, key) {
    return props.style ? props.style[key] : void 0;
  }
  removeValueFromRenderState(key, { vars, style: style2 }) {
    delete vars[key];
    delete style2[key];
  }
  handleChildMotionValue() {
    if (this.childSubscription) {
      this.childSubscription();
      delete this.childSubscription;
    }
    const { children } = this.props;
    if (isMotionValue(children)) {
      this.childSubscription = children.on("change", (latest) => {
        if (this.current) {
          this.current.textContent = `${latest}`;
        }
      });
    }
  }
}
function getComputedStyle$2(element2) {
  return window.getComputedStyle(element2);
}
class HTMLVisualElement extends DOMVisualElement {
  constructor() {
    super(...arguments);
    this.type = "html";
    this.renderInstance = renderHTML;
  }
  readValueFromInstance(instance2, key) {
    if (transformProps.has(key)) {
      const defaultType = getDefaultValueType(key);
      return defaultType ? defaultType.default || 0 : 0;
    } else {
      const computedStyle = getComputedStyle$2(instance2);
      const value2 = (isCSSVariableName(key) ? computedStyle.getPropertyValue(key) : computedStyle[key]) || 0;
      return typeof value2 === "string" ? value2.trim() : value2;
    }
  }
  measureInstanceViewportBox(instance2, { transformPagePoint }) {
    return measureViewportBox(instance2, transformPagePoint);
  }
  build(renderState, latestValues, props) {
    buildHTMLStyles(renderState, latestValues, props.transformTemplate);
  }
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
  }
}
class SVGVisualElement extends DOMVisualElement {
  constructor() {
    super(...arguments);
    this.type = "svg";
    this.isSVGTag = false;
    this.measureInstanceViewportBox = createBox;
  }
  getBaseTargetFromProps(props, key) {
    return props[key];
  }
  readValueFromInstance(instance2, key) {
    if (transformProps.has(key)) {
      const defaultType = getDefaultValueType(key);
      return defaultType ? defaultType.default || 0 : 0;
    }
    key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
    return instance2.getAttribute(key);
  }
  scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    return scrapeMotionValuesFromProps(props, prevProps, visualElement);
  }
  build(renderState, latestValues, props) {
    buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
  }
  renderInstance(instance2, renderState, styleProp, projection) {
    renderSVG(instance2, renderState, styleProp, projection);
  }
  mount(instance2) {
    this.isSVGTag = isSVGTag(instance2.tagName);
    super.mount(instance2);
  }
}
const createDomVisualElement = (Component2, options) => {
  return isSVGComponent(Component2) ? new SVGVisualElement(options) : new HTMLVisualElement(options, {
    allowProjection: Component2 !== reactExports.Fragment
  });
};
const domAnimation$8 = {
  renderer: createDomVisualElement,
  ...animations,
  ...gestureAnimations
};
const domMax = {
  ...domAnimation$8,
  ...drag,
  ...layout
};
function getWillChangeName(name2) {
  if (transformProps.has(name2)) {
    return "transform";
  } else if (acceleratedValues.has(name2)) {
    return camelToDash(name2);
  }
}
class WillChangeMotionValue extends MotionValue {
  constructor() {
    super(...arguments);
    this.values = [];
  }
  add(name2) {
    const styleName = getWillChangeName(name2);
    if (styleName) {
      addUniqueItem(this.values, styleName);
      this.update();
    }
  }
  update() {
    this.set(this.values.length ? this.values.join(", ") : "auto");
  }
}
function useWillChange() {
  return useConstant(() => new WillChangeMotionValue("auto"));
}
function $7215afc6de606d6b$export$de79e2c695e052f3$6(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$6())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$6(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$6(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$6 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$6() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$6 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$6 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$6 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$6;
}
function $7215afc6de606d6b$var$getScrollableElements$6(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$6(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$7(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$7(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$7(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$7 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testPlatform$7(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testPlatform$7(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$7() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$6();
});
const $c87311424ea30a05$export$6446a186d09e379e$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$6 = $c87311424ea30a05$var$cached$7(function() {
  return $c87311424ea30a05$var$testUserAgent$7(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$3 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$3,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$323e4fc2fa4753fb(props) {
  let { children, navigate, useHref: useHref2 } = props;
  let ctx = reactExports.useMemo(() => ({
    isNative: false,
    open: (target, modifiers, href, routerOptions) => {
      $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, (link2) => {
        if ($ea8dcbcb9ea1b556$export$efa8c9099e530235$3(link2, modifiers))
          navigate(href, routerOptions);
        else
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(link2, modifiers);
      });
    },
    useHref: useHref2 || ((href) => href)
  }), [
    navigate,
    useHref2
  ]);
  return /* @__PURE__ */ React$6.createElement($ea8dcbcb9ea1b556$var$RouterContext$3.Provider, {
    value: ctx
  }, children);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235$3(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$6() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$7())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$6() && $c87311424ea30a05$export$9ac100e40613ea10$7() && !$c87311424ea30a05$export$7bef049ce92e4224$6() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$6(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$6.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$3(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$3(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$6(link2, modifiers));
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4;
const $8ae05eaa5c114e9c$var$useEarlyEffect$4 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 = React$6["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$4 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$4(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
function $1dbecbe27a04f9af$export$14d238f342723f25$1(defaultValue2) {
  let [value2, setValue] = reactExports.useState(defaultValue2);
  let effect = reactExports.useRef(null);
  let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (!effect.current)
      return;
    let newValue = effect.current.next();
    if (newValue.done) {
      effect.current = null;
      return;
    }
    if (value2 === newValue.value)
      nextRef();
    else
      setValue(newValue.value);
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (effect.current)
      nextRef();
  });
  let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((fn) => {
    effect.current = fn(value2);
    nextRef();
  });
  return [
    value2,
    queue
  ];
}
const $b5e257d569688ac6$var$defaultContext$d = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$d = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$d);
const $b5e257d569688ac6$var$IsSSRContext$d = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$d = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$d(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$d);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$d.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$d.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$d.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$d(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$d);
  let counter = $b5e257d569688ac6$var$useCounter$d(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$d(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$d());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$d.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
const $b5e257d569688ac6$export$619500959fc48b26$1 = typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$d : $b5e257d569688ac6$var$useLegacySSRSafeId$d;
function $b5e257d569688ac6$var$getSnapshot$d() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$d() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$d(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$d() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$d, $b5e257d569688ac6$var$getSnapshot$d, $b5e257d569688ac6$var$getServerSnapshot$d);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$d);
}
let $bdb11010cef70236$var$canUseDOM$2 = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$9 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry$2;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry$2 = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$9.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37$2(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26$1(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry$2)
    $bdb11010cef70236$var$registry$2.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM$2) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$9.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry$2)
        $bdb11010cef70236$var$registry$2.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$9.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$9(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$9.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $bdb11010cef70236$export$b4cc09c592e8fdb8$1(depArray = []) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25$1(id2);
  let updateId = reactExports.useCallback(() => {
    setResolvedId(function* () {
      yield id2;
      yield document.getElementById(id2) ? id2 : void 0;
    });
  }, [
    id2,
    setResolvedId
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(updateId, [
    id2,
    updateId,
    ...depArray
  ]);
  return resolvedId;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$9(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$4 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$4 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$4(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$3(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$3(node2) {
  return $431fbd86ca7dc216$var$isNode$3(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$3(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$3(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
const $d4ee10de306f2510$export$cd4e5573fbe2b576 = (doc = document) => {
  var _activeElement_shadowRoot;
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return doc.activeElement;
  let activeElement = doc.activeElement;
  while (activeElement && "shadowRoot" in activeElement && ((_activeElement_shadowRoot = activeElement.shadowRoot) === null || _activeElement_shadowRoot === void 0 ? void 0 : _activeElement_shadowRoot.activeElement))
    activeElement = activeElement.shadowRoot.activeElement;
  return activeElement;
};
function $d4ee10de306f2510$export$e58f029f0fbfdb29$3(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
class $dfc540311bf7f109$export$63eb3ababa9c55c4 {
  get currentNode() {
    return this._currentNode;
  }
  set currentNode(node2) {
    if (!$d4ee10de306f2510$export$4282f70798064fe0$3(this.root, node2))
      throw new Error("Cannot set currentNode to a node that is not contained by the root node.");
    const walkers = [];
    let curNode = node2;
    let currentWalkerCurrentNode = node2;
    this._currentNode = node2;
    while (curNode && curNode !== this.root)
      if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
        const shadowRoot = curNode;
        const walker2 = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
          acceptNode: this._acceptNode
        });
        walkers.push(walker2);
        walker2.currentNode = currentWalkerCurrentNode;
        this._currentSetFor.add(walker2);
        curNode = currentWalkerCurrentNode = shadowRoot.host;
      } else
        curNode = curNode.parentNode;
    const walker = this._doc.createTreeWalker(this.root, this.whatToShow, {
      acceptNode: this._acceptNode
    });
    walkers.push(walker);
    walker.currentNode = currentWalkerCurrentNode;
    this._currentSetFor.add(walker);
    this._walkerStack = walkers;
  }
  get doc() {
    return this._doc;
  }
  firstChild() {
    let currentNode = this.currentNode;
    let newNode = this.nextNode();
    if (!$d4ee10de306f2510$export$4282f70798064fe0$3(currentNode, newNode)) {
      this.currentNode = currentNode;
      return null;
    }
    if (newNode)
      this.currentNode = newNode;
    return newNode;
  }
  lastChild() {
    let walker = this._walkerStack[0];
    let newNode = walker.lastChild();
    if (newNode)
      this.currentNode = newNode;
    return newNode;
  }
  nextNode() {
    const nextNode = this._walkerStack[0].nextNode();
    if (nextNode) {
      const shadowRoot = nextNode.shadowRoot;
      if (shadowRoot) {
        var _this_filter;
        let nodeResult;
        if (typeof this.filter === "function")
          nodeResult = this.filter(nextNode);
        else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
          nodeResult = this.filter.acceptNode(nextNode);
        if (nodeResult === NodeFilter.FILTER_ACCEPT) {
          this.currentNode = nextNode;
          return nextNode;
        }
        let newNode = this.nextNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      }
      if (nextNode)
        this.currentNode = nextNode;
      return nextNode;
    } else {
      if (this._walkerStack.length > 1) {
        this._walkerStack.shift();
        let newNode = this.nextNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      } else
        return null;
    }
  }
  previousNode() {
    const currentWalker = this._walkerStack[0];
    if (currentWalker.currentNode === currentWalker.root) {
      if (this._currentSetFor.has(currentWalker)) {
        this._currentSetFor.delete(currentWalker);
        if (this._walkerStack.length > 1) {
          this._walkerStack.shift();
          let newNode = this.previousNode();
          if (newNode)
            this.currentNode = newNode;
          return newNode;
        } else
          return null;
      }
      return null;
    }
    const previousNode = currentWalker.previousNode();
    if (previousNode) {
      const shadowRoot = previousNode.shadowRoot;
      if (shadowRoot) {
        var _this_filter;
        let nodeResult;
        if (typeof this.filter === "function")
          nodeResult = this.filter(previousNode);
        else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
          nodeResult = this.filter.acceptNode(previousNode);
        if (nodeResult === NodeFilter.FILTER_ACCEPT) {
          if (previousNode)
            this.currentNode = previousNode;
          return previousNode;
        }
        let newNode = this.lastChild();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      }
      if (previousNode)
        this.currentNode = previousNode;
      return previousNode;
    } else {
      if (this._walkerStack.length > 1) {
        this._walkerStack.shift();
        let newNode = this.previousNode();
        if (newNode)
          this.currentNode = newNode;
        return newNode;
      } else
        return null;
    }
  }
  /**
   * @deprecated
   */
  nextSibling() {
    return null;
  }
  /**
   * @deprecated
   */
  previousSibling() {
    return null;
  }
  /**
   * @deprecated
   */
  parentNode() {
    return null;
  }
  constructor(doc, root2, whatToShow, filter3) {
    this._walkerStack = [];
    this._currentSetFor = /* @__PURE__ */ new Set();
    this._acceptNode = (node2) => {
      if (node2.nodeType === Node.ELEMENT_NODE) {
        const shadowRoot2 = node2.shadowRoot;
        if (shadowRoot2) {
          const walker = this._doc.createTreeWalker(shadowRoot2, this.whatToShow, {
            acceptNode: this._acceptNode
          });
          this._walkerStack.unshift(walker);
          return NodeFilter.FILTER_ACCEPT;
        } else {
          var _this_filter;
          if (typeof this.filter === "function")
            return this.filter(node2);
          else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode)
            return this.filter.acceptNode(node2);
          else if (this.filter === null)
            return NodeFilter.FILTER_ACCEPT;
        }
      }
      return NodeFilter.FILTER_SKIP;
    };
    this._doc = doc;
    this.root = root2;
    this.filter = filter3 !== null && filter3 !== void 0 ? filter3 : null;
    this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
    this._currentNode = root2;
    this._walkerStack.unshift(doc.createTreeWalker(root2, whatToShow, this._acceptNode));
    const shadowRoot = root2.shadowRoot;
    if (shadowRoot) {
      const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, {
        acceptNode: this._acceptNode
      });
      this._walkerStack.unshift(walker);
    }
  }
}
function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2, whatToShow, filter3) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a())
    return new $dfc540311bf7f109$export$63eb3ababa9c55c4(doc, root2, whatToShow, filter3);
  return doc.createTreeWalker(root2, whatToShow, filter3);
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$9(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$9(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$9(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$4 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$4 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$4 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$globalAttrs = /* @__PURE__ */ new Set([
  "dir",
  "lang",
  "hidden",
  "inert",
  "translate"
]);
const $65484d02dcb7eb3e$var$globalEvents = /* @__PURE__ */ new Set([
  "onClick",
  "onAuxClick",
  "onContextMenu",
  "onDoubleClick",
  "onMouseDown",
  "onMouseEnter",
  "onMouseLeave",
  "onMouseMove",
  "onMouseOut",
  "onMouseOver",
  "onMouseUp",
  "onTouchCancel",
  "onTouchEnd",
  "onTouchMove",
  "onTouchStart",
  "onPointerDown",
  "onPointerMove",
  "onPointerUp",
  "onPointerCancel",
  "onPointerEnter",
  "onPointerLeave",
  "onPointerOver",
  "onPointerOut",
  "onGotPointerCapture",
  "onLostPointerCapture",
  "onScroll",
  "onWheel",
  "onAnimationStart",
  "onAnimationEnd",
  "onAnimationIteration",
  "onTransitionCancel",
  "onTransitionEnd",
  "onTransitionRun",
  "onTransitionStart"
]);
const $65484d02dcb7eb3e$var$propRe$4 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, opts2 = {}) {
  let { labelable, isLink, global: global2, events: events2 = global2, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$4.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$4.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$4.has(prop) || global2 && $65484d02dcb7eb3e$var$globalAttrs.has(prop) || events2 && $65484d02dcb7eb3e$var$globalEvents.has(prop) || prop.endsWith("Capture") && $65484d02dcb7eb3e$var$globalEvents.has(prop.slice(0, -7)) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$4.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$5(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$5())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$5(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$5(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$5 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$5() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$5 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$5 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$5 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$5;
}
function $7215afc6de606d6b$var$getScrollableElements$5(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$5(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$6(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$6(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$6(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$6 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$3 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testPlatform$6(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$6() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$3 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$3() || $c87311424ea30a05$export$7bef049ce92e4224$5();
});
const $c87311424ea30a05$export$e1865c3bedcd822b = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$export$9ac100e40613ea10$6() || $c87311424ea30a05$export$fedb369cb70207f1$3();
});
const $c87311424ea30a05$export$78551043582a6a98$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$5();
});
const $c87311424ea30a05$export$6446a186d09e379e$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$4 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$5 = $c87311424ea30a05$var$cached$6(function() {
  return $c87311424ea30a05$var$testUserAgent$6(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$2 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$2,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext$2);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235$2(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$5() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$6())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$5() && $c87311424ea30a05$export$9ac100e40613ea10$6() && !$c87311424ea30a05$export$7bef049ce92e4224$5() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$5(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$2(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$2(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$2(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(link2, modifiers));
}
function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  var _props_href;
  const href = router.useHref((_props_href = props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    "data-href": props.href ? href : void 0,
    "data-target": props.target,
    "data-rel": props.rel,
    "data-download": props.download,
    "data-ping": props.ping,
    "data-referrer-policy": props.referrerPolicy
  };
}
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  var _props_href;
  const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    href: (props === null || props === void 0 ? void 0 : props.href) ? href : void 0,
    target: props === null || props === void 0 ? void 0 : props.target,
    rel: props === null || props === void 0 ? void 0 : props.rel,
    download: props === null || props === void 0 ? void 0 : props.download,
    ping: props === null || props === void 0 ? void 0 : props.ping,
    referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
  };
}
function $ea8dcbcb9ea1b556$export$13aea1a3cb5e3f1f(e2, router, href, routerOptions) {
  if (!router.isNative && e2.currentTarget instanceof HTMLAnchorElement && e2.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
  !e2.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235$2(e2.currentTarget, e2) && href) {
    e2.preventDefault();
    router.open(e2.currentTarget, e2, href, routerOptions);
  }
}
let $bbed8b41f857bcc0$var$transitionsByElement$3 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$3 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$3() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$3.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$3.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$3.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$3.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$3.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$3)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$3.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$3();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$3);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$3() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$3)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$3.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$3(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$3();
    if ($bbed8b41f857bcc0$var$transitionsByElement$3.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$3.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$3() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $313b98861ee5dd6c$export$d6875122194c7b44$1(props, defaultLabel) {
  let { id: id2, "aria-label": label, "aria-labelledby": labelledBy } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  if (labelledBy && label) {
    let ids2 = /* @__PURE__ */ new Set([
      id2,
      ...labelledBy.trim().split(/\s+/)
    ]);
    labelledBy = [
      ...ids2
    ].join(" ");
  } else if (labelledBy)
    labelledBy = labelledBy.trim().split(/\s+/).join(" ");
  if (!label && !labelledBy && defaultLabel)
    label = defaultLabel;
  return {
    id: id2,
    "aria-label": label,
    "aria-labelledby": labelledBy
  };
}
function $4f58c5f72bcf79f7$export$496315a1608d9602(effect, dependencies) {
  const isInitialMount = reactExports.useRef(true);
  const lastDeps = reactExports.useRef(null);
  reactExports.useEffect(() => {
    isInitialMount.current = true;
    return () => {
      isInitialMount.current = false;
    };
  }, []);
  reactExports.useEffect(() => {
    let prevDeps = lastDeps.current;
    if (isInitialMount.current)
      isInitialMount.current = false;
    else if (!prevDeps || dependencies.some((dep, i2) => !Object.is(dep, prevDeps[i2])))
      effect();
    lastDeps.current = dependencies;
  }, dependencies);
}
function $ca9b37712f007381$export$72ef708ab07251f1(effect, dependencies) {
  const isInitialMount = reactExports.useRef(true);
  const lastDeps = reactExports.useRef(null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    isInitialMount.current = true;
    return () => {
      isInitialMount.current = false;
    };
  }, []);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (isInitialMount.current)
      isInitialMount.current = false;
    else if (!lastDeps.current || dependencies.some((dep, i2) => !Object.is(dep, lastDeps[i2])))
      effect();
    lastDeps.current = dependencies;
  }, dependencies);
}
function $9daab02d461809db$var$hasResizeObserver() {
  return typeof window.ResizeObserver !== "undefined";
}
function $9daab02d461809db$export$683480f191c0e3ea(options) {
  const { ref, box, onResize: onResize4 } = options;
  reactExports.useEffect(() => {
    let element2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!element2)
      return;
    if (!$9daab02d461809db$var$hasResizeObserver()) {
      window.addEventListener("resize", onResize4, false);
      return () => {
        window.removeEventListener("resize", onResize4, false);
      };
    } else {
      const resizeObserverInstance = new window.ResizeObserver((entries) => {
        if (!entries.length)
          return;
        onResize4();
      });
      resizeObserverInstance.observe(element2, {
        box
      });
      return () => {
        if (element2)
          resizeObserverInstance.unobserve(element2);
      };
    }
  }, [
    onResize4,
    ref,
    box
  ]);
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $cc38e7bd3fc7b213$export$2bb74740c4e19def$1(node2, checkForOverflow) {
  if (!node2)
    return false;
  let style2 = window.getComputedStyle(node2);
  let isScrollable2 = /(auto|scroll)/.test(style2.overflow + style2.overflowX + style2.overflowY);
  if (isScrollable2 && checkForOverflow)
    isScrollable2 = node2.scrollHeight !== node2.clientHeight || node2.scrollWidth !== node2.clientWidth;
  return isScrollable2;
}
function $62d8ded9296f3872$export$cfa2225e87938781(node2, checkForOverflow) {
  let scrollableNode = node2;
  if ($cc38e7bd3fc7b213$export$2bb74740c4e19def$1(scrollableNode, checkForOverflow))
    scrollableNode = scrollableNode.parentElement;
  while (scrollableNode && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(scrollableNode, checkForOverflow))
    scrollableNode = scrollableNode.parentElement;
  return scrollableNode || document.scrollingElement || document.documentElement;
}
function $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(node2, checkForOverflow) {
  const scrollParents = [];
  while (node2 && node2 !== document.documentElement) {
    if ($cc38e7bd3fc7b213$export$2bb74740c4e19def$1(node2, checkForOverflow))
      scrollParents.push(node2);
    node2 = node2.parentElement;
  }
  return scrollParents;
}
let $ef06256079686ba0$var$descriptionId = 0;
const $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
  let [id2, setId] = reactExports.useState();
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (!description)
      return;
    let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
    if (!desc) {
      let id3 = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
      setId(id3);
      let node2 = document.createElement("div");
      node2.id = id3;
      node2.style.display = "none";
      node2.textContent = description;
      document.body.appendChild(node2);
      desc = {
        refCount: 0,
        element: node2
      };
      $ef06256079686ba0$var$descriptionNodes.set(description, desc);
    } else
      setId(desc.element.id);
    desc.refCount++;
    return () => {
      if (desc && --desc.refCount === 0) {
        desc.element.remove();
        $ef06256079686ba0$var$descriptionNodes.delete(description);
      }
    };
  }, [
    description
  ]);
  return {
    "aria-describedby": description ? id2 : void 0
  };
}
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler, options) {
  let handleEvent = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(handler);
  let isDisabled = handler == null;
  reactExports.useEffect(() => {
    if (isDisabled || !ref.current)
      return;
    let element2 = ref.current;
    element2.addEventListener(event, handleEvent, options);
    return () => {
      element2.removeEventListener(event, handleEvent, options);
    };
  }, [
    ref,
    event,
    options,
    isDisabled,
    handleEvent
  ]);
}
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element2) {
  let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element2, "left");
  let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element2, "top");
  let width = element2.offsetWidth;
  let height = element2.offsetHeight;
  let x2 = scrollView.scrollLeft;
  let y2 = scrollView.scrollTop;
  let { borderTopWidth, borderLeftWidth, scrollPaddingTop, scrollPaddingRight, scrollPaddingBottom, scrollPaddingLeft } = getComputedStyle(scrollView);
  let borderAdjustedX = x2 + parseInt(borderLeftWidth, 10);
  let borderAdjustedY = y2 + parseInt(borderTopWidth, 10);
  let maxX = borderAdjustedX + scrollView.clientWidth;
  let maxY = borderAdjustedY + scrollView.clientHeight;
  let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
  let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
  let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
  let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
  if (offsetX <= x2 + scrollPaddingLeftNumber)
    x2 = offsetX - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
  else if (offsetX + width > maxX - scrollPaddingRightNumber)
    x2 += offsetX + width - maxX + scrollPaddingRightNumber;
  if (offsetY <= borderAdjustedY + scrollPaddingTopNumber)
    y2 = offsetY - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
  else if (offsetY + height > maxY - scrollPaddingBottomNumber)
    y2 += offsetY + height - maxY + scrollPaddingBottomNumber;
  scrollView.scrollLeft = x2;
  scrollView.scrollTop = y2;
}
function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
  const prop = axis === "left" ? "offsetLeft" : "offsetTop";
  let sum = 0;
  while (child.offsetParent) {
    sum += child[prop];
    if (child.offsetParent === ancestor)
      break;
    else if (child.offsetParent.contains(ancestor)) {
      sum -= ancestor[prop];
      break;
    }
    child = child.offsetParent;
  }
  return sum;
}
function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts2) {
  if (targetElement && document.contains(targetElement)) {
    let root2 = document.scrollingElement || document.documentElement;
    let isScrollPrevented = window.getComputedStyle(root2).overflow === "hidden";
    if (!isScrollPrevented) {
      var _targetElement_scrollIntoView;
      let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
      targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
        block: "nearest"
      });
      let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
      if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
        var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
        opts2 === null || opts2 === void 0 ? void 0 : (_opts_containingElement = opts2.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
          block: "center",
          inline: "center"
        });
        (_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
          block: "nearest"
        });
      }
    } else {
      let scrollParents = $a40c673dc9f6d9c7$export$94ed1c92c7beeb22(targetElement);
      for (let scrollParent of scrollParents)
        $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
    }
  }
}
function $6a7db85432448f7f$export$60278871457622de$4(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$4() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$3(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$4() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
function $5a387cc49350e6db$export$722debc0e56fea39(value2, isEqual2) {
  let lastValue = reactExports.useRef(null);
  if (value2 && lastValue.current && isEqual2(value2, lastValue.current))
    value2 = lastValue.current;
  lastValue.current = value2;
  return value2;
}
function $99facab73266f662$export$5add1d006293d136(ref, initialValue, onReset) {
  let handleReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (onReset)
      onReset(initialValue);
  });
  reactExports.useEffect(() => {
    var _ref_current;
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", handleReset);
    return () => {
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", handleReset);
    };
  }, [
    ref,
    handleReset
  ]);
}
const $5671b20cf9b562b2$export$447a38995de2c711 = "react-aria-clear-focus";
const $5671b20cf9b562b2$export$831c820ad60f9d12 = "react-aria-focus";
function $21f1aa98acb08317$export$16792effe837dba3(e2) {
  if ($c87311424ea30a05$export$9ac100e40613ea10$6())
    return e2.metaKey;
  return e2.ctrlKey;
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$3 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$3(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$3(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$3)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$3(element2) && $7d2416ea0959daaa$var$isAttributeVisible$3(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$3 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$3 = $b4b717babfbb907b$var$focusableElements$3.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$3.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
const $b4b717babfbb907b$var$TABBABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements$3.join(':not([hidden]):not([tabindex="-1"]),');
function $b4b717babfbb907b$export$4c063cf1350e6fed$3(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$3) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2) && !$b4b717babfbb907b$var$isInert$3(element2);
}
function $b4b717babfbb907b$export$bebd5a1431fec25d(element2) {
  return element2.matches($b4b717babfbb907b$var$TABBABLE_ELEMENT_SELECTOR) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$3(element2) && !$b4b717babfbb907b$var$isInert$3(element2);
}
function $b4b717babfbb907b$var$isInert$3(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
const $edcf132a9284368a$var$AXIS = {
  top: "top",
  bottom: "top",
  left: "left",
  right: "left"
};
const $edcf132a9284368a$var$FLIPPED_DIRECTION = {
  top: "bottom",
  bottom: "top",
  left: "right",
  right: "left"
};
const $edcf132a9284368a$var$CROSS_AXIS = {
  top: "left",
  left: "top"
};
const $edcf132a9284368a$var$AXIS_SIZE = {
  top: "height",
  left: "width"
};
const $edcf132a9284368a$var$TOTAL_SIZE = {
  width: "totalWidth",
  height: "totalHeight"
};
const $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE = {};
let $edcf132a9284368a$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
function $edcf132a9284368a$var$getContainerDimensions(containerNode) {
  let width = 0, height = 0, totalWidth = 0, totalHeight = 0, top2 = 0, left2 = 0;
  let scroll = {};
  var _visualViewport_scale;
  let isPinchZoomedIn = ((_visualViewport_scale = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.scale) !== null && _visualViewport_scale !== void 0 ? _visualViewport_scale : 1) > 1;
  if (containerNode.tagName === "BODY") {
    let documentElement = document.documentElement;
    totalWidth = documentElement.clientWidth;
    totalHeight = documentElement.clientHeight;
    var _visualViewport_width;
    width = (_visualViewport_width = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.width) !== null && _visualViewport_width !== void 0 ? _visualViewport_width : totalWidth;
    var _visualViewport_height;
    height = (_visualViewport_height = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.height) !== null && _visualViewport_height !== void 0 ? _visualViewport_height : totalHeight;
    scroll.top = documentElement.scrollTop || containerNode.scrollTop;
    scroll.left = documentElement.scrollLeft || containerNode.scrollLeft;
    if ($edcf132a9284368a$var$visualViewport) {
      top2 = $edcf132a9284368a$var$visualViewport.offsetTop;
      left2 = $edcf132a9284368a$var$visualViewport.offsetLeft;
    }
  } else {
    ({ width, height, top: top2, left: left2 } = $edcf132a9284368a$var$getOffset(containerNode));
    scroll.top = containerNode.scrollTop;
    scroll.left = containerNode.scrollLeft;
    totalWidth = width;
    totalHeight = height;
  }
  if ($c87311424ea30a05$export$78551043582a6a98$5() && (containerNode.tagName === "BODY" || containerNode.tagName === "HTML") && isPinchZoomedIn) {
    scroll.top = 0;
    scroll.left = 0;
    var _visualViewport_pageTop;
    top2 = (_visualViewport_pageTop = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageTop) !== null && _visualViewport_pageTop !== void 0 ? _visualViewport_pageTop : 0;
    var _visualViewport_pageLeft;
    left2 = (_visualViewport_pageLeft = $edcf132a9284368a$var$visualViewport === null || $edcf132a9284368a$var$visualViewport === void 0 ? void 0 : $edcf132a9284368a$var$visualViewport.pageLeft) !== null && _visualViewport_pageLeft !== void 0 ? _visualViewport_pageLeft : 0;
  }
  return {
    width,
    height,
    totalWidth,
    totalHeight,
    scroll,
    top: top2,
    left: left2
  };
}
function $edcf132a9284368a$var$getScroll(node2) {
  return {
    top: node2.scrollTop,
    left: node2.scrollLeft,
    width: node2.scrollWidth,
    height: node2.scrollHeight
  };
}
function $edcf132a9284368a$var$getDelta(axis, offset2, size2, boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary) {
  var _containerDimensions_scroll_axis;
  let containerScroll = (_containerDimensions_scroll_axis = containerDimensions.scroll[axis]) !== null && _containerDimensions_scroll_axis !== void 0 ? _containerDimensions_scroll_axis : 0;
  let boundarySize = boundaryDimensions[$edcf132a9284368a$var$AXIS_SIZE[axis]];
  let boundaryStartEdge = boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] + padding;
  let boundaryEndEdge = boundarySize + boundaryDimensions.scroll[$edcf132a9284368a$var$AXIS[axis]] - padding;
  let startEdgeOffset = offset2 - containerScroll + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
  let endEdgeOffset = offset2 - containerScroll + size2 + containerOffsetWithBoundary[axis] - boundaryDimensions[$edcf132a9284368a$var$AXIS[axis]];
  if (startEdgeOffset < boundaryStartEdge)
    return boundaryStartEdge - startEdgeOffset;
  else if (endEdgeOffset > boundaryEndEdge)
    return Math.max(boundaryEndEdge - endEdgeOffset, boundaryStartEdge - startEdgeOffset);
  else
    return 0;
}
function $edcf132a9284368a$var$getMargins(node2) {
  let style2 = window.getComputedStyle(node2);
  return {
    top: parseInt(style2.marginTop, 10) || 0,
    bottom: parseInt(style2.marginBottom, 10) || 0,
    left: parseInt(style2.marginLeft, 10) || 0,
    right: parseInt(style2.marginRight, 10) || 0
  };
}
function $edcf132a9284368a$var$parsePlacement(input2) {
  if ($edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2])
    return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2];
  let [placement, crossPlacement] = input2.split(" ");
  let axis = $edcf132a9284368a$var$AXIS[placement] || "right";
  let crossAxis = $edcf132a9284368a$var$CROSS_AXIS[axis];
  if (!$edcf132a9284368a$var$AXIS[crossPlacement])
    crossPlacement = "center";
  let size2 = $edcf132a9284368a$var$AXIS_SIZE[axis];
  let crossSize = $edcf132a9284368a$var$AXIS_SIZE[crossAxis];
  $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2] = {
    placement,
    crossPlacement,
    axis,
    crossAxis,
    size: size2,
    crossSize
  };
  return $edcf132a9284368a$var$PARSED_PLACEMENT_CACHE[input2];
}
function $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset) {
  let { placement, crossPlacement, axis, crossAxis, size: size2, crossSize } = placementInfo;
  let position2 = {};
  var _childOffset_crossAxis;
  position2[crossAxis] = (_childOffset_crossAxis = childOffset[crossAxis]) !== null && _childOffset_crossAxis !== void 0 ? _childOffset_crossAxis : 0;
  var _childOffset_crossSize, _overlaySize_crossSize, _childOffset_crossSize1, _overlaySize_crossSize1;
  if (crossPlacement === "center")
    position2[crossAxis] += (((_childOffset_crossSize = childOffset[crossSize]) !== null && _childOffset_crossSize !== void 0 ? _childOffset_crossSize : 0) - ((_overlaySize_crossSize = overlaySize[crossSize]) !== null && _overlaySize_crossSize !== void 0 ? _overlaySize_crossSize : 0)) / 2;
  else if (crossPlacement !== crossAxis)
    position2[crossAxis] += ((_childOffset_crossSize1 = childOffset[crossSize]) !== null && _childOffset_crossSize1 !== void 0 ? _childOffset_crossSize1 : 0) - ((_overlaySize_crossSize1 = overlaySize[crossSize]) !== null && _overlaySize_crossSize1 !== void 0 ? _overlaySize_crossSize1 : 0);
  position2[crossAxis] += crossOffset;
  const minPosition = childOffset[crossAxis] - overlaySize[crossSize] + arrowSize + arrowBoundaryOffset;
  const maxPosition = childOffset[crossAxis] + childOffset[crossSize] - arrowSize - arrowBoundaryOffset;
  position2[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(position2[crossAxis], minPosition, maxPosition);
  if (placement === axis) {
    const containerHeight = isContainerPositioned ? containerOffsetWithBoundary[size2] : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE[size2]];
    position2[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] = Math.floor(containerHeight - childOffset[axis] + offset2);
  } else
    position2[axis] = Math.floor(childOffset[axis] + childOffset[size2] + offset2);
  return position2;
}
function $edcf132a9284368a$var$getMaxHeight(position2, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlayHeight, heightGrowthDirection) {
  const containerHeight = isContainerPositioned ? containerOffsetWithBoundary.height : boundaryDimensions[$edcf132a9284368a$var$TOTAL_SIZE.height];
  var _position_bottom;
  let overlayTop = position2.top != null ? containerOffsetWithBoundary.top + position2.top : containerOffsetWithBoundary.top + (containerHeight - ((_position_bottom = position2.bottom) !== null && _position_bottom !== void 0 ? _position_bottom : 0) - overlayHeight);
  var _boundaryDimensions_scroll_top, _margins_top, _margins_bottom, _boundaryDimensions_scroll_top1, _margins_top1, _margins_bottom1;
  let maxHeight = heightGrowthDirection !== "top" ? (
    // We want the distance between the top of the overlay to the bottom of the boundary
    Math.max(0, boundaryDimensions.height + boundaryDimensions.top + ((_boundaryDimensions_scroll_top = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top !== void 0 ? _boundaryDimensions_scroll_top : 0) - overlayTop - (((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0) + padding))
  ) : Math.max(0, overlayTop + overlayHeight - (boundaryDimensions.top + ((_boundaryDimensions_scroll_top1 = boundaryDimensions.scroll.top) !== null && _boundaryDimensions_scroll_top1 !== void 0 ? _boundaryDimensions_scroll_top1 : 0)) - (((_margins_top1 = margins.top) !== null && _margins_top1 !== void 0 ? _margins_top1 : 0) + ((_margins_bottom1 = margins.bottom) !== null && _margins_bottom1 !== void 0 ? _margins_bottom1 : 0) + padding));
  return Math.min(boundaryDimensions.height - padding * 2, maxHeight);
}
function $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding, placementInfo) {
  let { placement, axis, size: size2 } = placementInfo;
  var _boundaryDimensions_scroll_axis, _margins_axis;
  if (placement === axis)
    return Math.max(0, childOffset[axis] - boundaryDimensions[axis] - ((_boundaryDimensions_scroll_axis = boundaryDimensions.scroll[axis]) !== null && _boundaryDimensions_scroll_axis !== void 0 ? _boundaryDimensions_scroll_axis : 0) + containerOffsetWithBoundary[axis] - ((_margins_axis = margins[axis]) !== null && _margins_axis !== void 0 ? _margins_axis : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
  var _margins_axis1;
  return Math.max(0, boundaryDimensions[size2] + boundaryDimensions[axis] + boundaryDimensions.scroll[axis] - containerOffsetWithBoundary[axis] - childOffset[axis] - childOffset[size2] - ((_margins_axis1 = margins[axis]) !== null && _margins_axis1 !== void 0 ? _margins_axis1 : 0) - margins[$edcf132a9284368a$var$FLIPPED_DIRECTION[axis]] - padding);
}
function $edcf132a9284368a$export$6839422d1f33cee9(placementInput, childOffset, overlaySize, scrollSize, margins, padding, flip2, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, userSetMaxHeight, arrowSize, arrowBoundaryOffset) {
  let placementInfo = $edcf132a9284368a$var$parsePlacement(placementInput);
  let { size: size2, crossAxis, crossSize, placement, crossPlacement } = placementInfo;
  let position2 = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
  let normalizedOffset = offset2;
  let space2 = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, placementInfo);
  if (flip2 && scrollSize[size2] > space2) {
    let flippedPlacementInfo = $edcf132a9284368a$var$parsePlacement(`${$edcf132a9284368a$var$FLIPPED_DIRECTION[placement]} ${crossPlacement}`);
    let flippedPosition = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, flippedPlacementInfo, offset2, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
    let flippedSpace = $edcf132a9284368a$var$getAvailableSpace(boundaryDimensions, containerOffsetWithBoundary, childOffset, margins, padding + offset2, flippedPlacementInfo);
    if (flippedSpace > space2) {
      placementInfo = flippedPlacementInfo;
      position2 = flippedPosition;
      normalizedOffset = offset2;
    }
  }
  let heightGrowthDirection = "bottom";
  if (placementInfo.axis === "top") {
    if (placementInfo.placement === "top")
      heightGrowthDirection = "top";
    else if (placementInfo.placement === "bottom")
      heightGrowthDirection = "bottom";
  } else if (placementInfo.crossAxis === "top") {
    if (placementInfo.crossPlacement === "top")
      heightGrowthDirection = "bottom";
    else if (placementInfo.crossPlacement === "bottom")
      heightGrowthDirection = "top";
  }
  let delta = $edcf132a9284368a$var$getDelta(crossAxis, position2[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
  position2[crossAxis] += delta;
  let maxHeight = $edcf132a9284368a$var$getMaxHeight(position2, boundaryDimensions, containerOffsetWithBoundary, isContainerPositioned, margins, padding, overlaySize.height, heightGrowthDirection);
  if (userSetMaxHeight && userSetMaxHeight < maxHeight)
    maxHeight = userSetMaxHeight;
  overlaySize.height = Math.min(overlaySize.height, maxHeight);
  position2 = $edcf132a9284368a$var$computePosition(childOffset, boundaryDimensions, overlaySize, placementInfo, normalizedOffset, crossOffset, containerOffsetWithBoundary, isContainerPositioned, arrowSize, arrowBoundaryOffset);
  delta = $edcf132a9284368a$var$getDelta(crossAxis, position2[crossAxis], overlaySize[crossSize], boundaryDimensions, containerDimensions, padding, containerOffsetWithBoundary);
  position2[crossAxis] += delta;
  let arrowPosition = {};
  let preferredArrowPosition = childOffset[crossAxis] + 0.5 * childOffset[crossSize] - position2[crossAxis] - margins[$edcf132a9284368a$var$AXIS[crossAxis]];
  const arrowMinPosition = arrowSize / 2 + arrowBoundaryOffset;
  var _margins_left, _margins_right, _margins_top, _margins_bottom;
  const overlayMargin = $edcf132a9284368a$var$AXIS[crossAxis] === "left" ? ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0) : ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
  const arrowMaxPosition = overlaySize[crossSize] - overlayMargin - arrowSize / 2 - arrowBoundaryOffset;
  const arrowOverlappingChildMinEdge = childOffset[crossAxis] + arrowSize / 2 - (position2[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
  const arrowOverlappingChildMaxEdge = childOffset[crossAxis] + childOffset[crossSize] - arrowSize / 2 - (position2[crossAxis] + margins[$edcf132a9284368a$var$AXIS[crossAxis]]);
  const arrowPositionOverlappingChild = $9446cca9a3875146$export$7d15b64cf5a3a4c4(preferredArrowPosition, arrowOverlappingChildMinEdge, arrowOverlappingChildMaxEdge);
  arrowPosition[crossAxis] = $9446cca9a3875146$export$7d15b64cf5a3a4c4(arrowPositionOverlappingChild, arrowMinPosition, arrowMaxPosition);
  return {
    position: position2,
    maxHeight,
    arrowOffsetLeft: arrowPosition.left,
    arrowOffsetTop: arrowPosition.top,
    placement: placementInfo.placement
  };
}
function $edcf132a9284368a$export$b3ceb0cbf1056d98(opts2) {
  let { placement, targetNode, overlayNode, scrollNode, padding, shouldFlip, boundaryElement, offset: offset2, crossOffset, maxHeight, arrowSize = 0, arrowBoundaryOffset = 0 } = opts2;
  let container = overlayNode instanceof HTMLElement ? $edcf132a9284368a$var$getContainingBlock(overlayNode) : document.documentElement;
  let isViewportContainer = container === document.documentElement;
  const containerPositionStyle = window.getComputedStyle(container).position;
  let isContainerPositioned = !!containerPositionStyle && containerPositionStyle !== "static";
  let childOffset = isViewportContainer ? $edcf132a9284368a$var$getOffset(targetNode) : $edcf132a9284368a$var$getPosition(targetNode, container);
  if (!isViewportContainer) {
    let { marginTop, marginLeft } = window.getComputedStyle(targetNode);
    childOffset.top += parseInt(marginTop, 10) || 0;
    childOffset.left += parseInt(marginLeft, 10) || 0;
  }
  let overlaySize = $edcf132a9284368a$var$getOffset(overlayNode);
  let margins = $edcf132a9284368a$var$getMargins(overlayNode);
  var _margins_left, _margins_right;
  overlaySize.width += ((_margins_left = margins.left) !== null && _margins_left !== void 0 ? _margins_left : 0) + ((_margins_right = margins.right) !== null && _margins_right !== void 0 ? _margins_right : 0);
  var _margins_top, _margins_bottom;
  overlaySize.height += ((_margins_top = margins.top) !== null && _margins_top !== void 0 ? _margins_top : 0) + ((_margins_bottom = margins.bottom) !== null && _margins_bottom !== void 0 ? _margins_bottom : 0);
  let scrollSize = $edcf132a9284368a$var$getScroll(scrollNode);
  let boundaryDimensions = $edcf132a9284368a$var$getContainerDimensions(boundaryElement);
  let containerDimensions = $edcf132a9284368a$var$getContainerDimensions(container);
  let containerOffsetWithBoundary = boundaryElement.tagName === "BODY" ? $edcf132a9284368a$var$getOffset(container) : $edcf132a9284368a$var$getPosition(container, boundaryElement);
  if (container.tagName === "HTML" && boundaryElement.tagName === "BODY") {
    containerDimensions.scroll.top = 0;
    containerDimensions.scroll.left = 0;
  }
  return $edcf132a9284368a$export$6839422d1f33cee9(placement, childOffset, overlaySize, scrollSize, margins, padding, shouldFlip, boundaryDimensions, containerDimensions, containerOffsetWithBoundary, offset2, crossOffset, isContainerPositioned, maxHeight, arrowSize, arrowBoundaryOffset);
}
function $edcf132a9284368a$var$getOffset(node2) {
  let { top: top2, left: left2, width, height } = node2.getBoundingClientRect();
  let { scrollTop, scrollLeft, clientTop, clientLeft } = document.documentElement;
  return {
    top: top2 + scrollTop - clientTop,
    left: left2 + scrollLeft - clientLeft,
    width,
    height
  };
}
function $edcf132a9284368a$var$getPosition(node2, parent) {
  let style2 = window.getComputedStyle(node2);
  let offset2;
  if (style2.position === "fixed") {
    let { top: top2, left: left2, width, height } = node2.getBoundingClientRect();
    offset2 = {
      top: top2,
      left: left2,
      width,
      height
    };
  } else {
    offset2 = $edcf132a9284368a$var$getOffset(node2);
    let parentOffset = $edcf132a9284368a$var$getOffset(parent);
    let parentStyle = window.getComputedStyle(parent);
    parentOffset.top += (parseInt(parentStyle.borderTopWidth, 10) || 0) - parent.scrollTop;
    parentOffset.left += (parseInt(parentStyle.borderLeftWidth, 10) || 0) - parent.scrollLeft;
    offset2.top -= parentOffset.top;
    offset2.left -= parentOffset.left;
  }
  offset2.top -= parseInt(style2.marginTop, 10) || 0;
  offset2.left -= parseInt(style2.marginLeft, 10) || 0;
  return offset2;
}
function $edcf132a9284368a$var$getContainingBlock(node2) {
  let offsetParent = node2.offsetParent;
  if (offsetParent && offsetParent === document.body && window.getComputedStyle(offsetParent).position === "static" && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
    offsetParent = document.documentElement;
  if (offsetParent == null) {
    offsetParent = node2.parentElement;
    while (offsetParent && !$edcf132a9284368a$var$isContainingBlock(offsetParent))
      offsetParent = offsetParent.parentElement;
  }
  return offsetParent || document.documentElement;
}
function $edcf132a9284368a$var$isContainingBlock(node2) {
  let style2 = window.getComputedStyle(node2);
  return style2.transform !== "none" || /transform|perspective/.test(style2.willChange) || style2.filter !== "none" || style2.contain === "paint" || "backdropFilter" in style2 && style2.backdropFilter !== "none" || "WebkitBackdropFilter" in style2 && style2.WebkitBackdropFilter !== "none";
}
const $dd149f63282afbbf$export$f6211563215e3b37$2 = /* @__PURE__ */ new WeakMap();
function $dd149f63282afbbf$export$18fc8428861184da(opts2) {
  let { triggerRef, isOpen, onClose } = opts2;
  reactExports.useEffect(() => {
    if (!isOpen || onClose === null)
      return;
    let onScroll6 = (e2) => {
      let target = e2.target;
      if (!triggerRef.current || target instanceof Node && !target.contains(triggerRef.current))
        return;
      if (e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement)
        return;
      let onCloseHandler = onClose || $dd149f63282afbbf$export$f6211563215e3b37$2.get(triggerRef.current);
      if (onCloseHandler)
        onCloseHandler();
    };
    window.addEventListener("scroll", onScroll6, true);
    return () => {
      window.removeEventListener("scroll", onScroll6, true);
    };
  }, [
    isOpen,
    onClose,
    triggerRef
  ]);
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$9 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$9 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$9(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$9.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$9.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$c = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$c = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$c);
const $b5e257d569688ac6$var$IsSSRContext$c = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$c = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$c(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$c);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$c.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$c.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$c.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$c(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$c);
  let counter = $b5e257d569688ac6$var$useCounter$c(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$c(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$c());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$c.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$c : $b5e257d569688ac6$var$useLegacySSRSafeId$c;
function $b5e257d569688ac6$var$getSnapshot$c() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$c() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$c(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$c() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$c, $b5e257d569688ac6$var$getSnapshot$c, $b5e257d569688ac6$var$getServerSnapshot$c);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$c);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$9 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$9] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$9(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$9 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9();
let $1e5a04cdaf7d1af8$var$listeners$9 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$9() {
  $1e5a04cdaf7d1af8$var$currentLocale$9 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$9();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$9)
    listener($1e5a04cdaf7d1af8$var$currentLocale$9);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$9() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$c();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$9);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$9.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$9);
    $1e5a04cdaf7d1af8$var$listeners$9.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$9.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$9.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$9);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$9 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$9();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$9);
  return context || defaultLocale;
}
const $fca6afa0e843324b$var$cache$1 = /* @__PURE__ */ new WeakMap();
function $fca6afa0e843324b$var$getCachedDictionary$1(strings) {
  let dictionary = $fca6afa0e843324b$var$cache$1.get(strings);
  if (!dictionary) {
    dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6(strings);
    $fca6afa0e843324b$var$cache$1.set(strings, dictionary);
  }
  return dictionary;
}
function $fca6afa0e843324b$export$87b761675e8eaa10$1(strings, packageName) {
  return packageName && $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage(packageName) || $fca6afa0e843324b$var$getCachedDictionary$1(strings);
}
function $fca6afa0e843324b$export$f12b703ca79dfbb1$1(strings, packageName) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10$1(strings, packageName);
  return reactExports.useMemo(() => new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, dictionary), [
    locale2,
    dictionary
  ]);
}
function $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1(options) {
  options = $5a387cc49350e6db$export$722debc0e56fea39(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual$1);
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  return reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, options), [
    locale2,
    options
  ]);
}
function $896ba0a80a8f4d36$var$isEqual$1(a2, b2) {
  if (a2 === b2)
    return true;
  let aKeys = Object.keys(a2);
  let bKeys = Object.keys(b2);
  if (aKeys.length !== bKeys.length)
    return false;
  for (let key of aKeys) {
    if (b2[key] !== a2[key])
      return false;
  }
  return true;
}
function $a916eb452884faea$export$b7a616150fdb9f44$1(options = {}) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  return reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, options), [
    locale2,
    options
  ]);
}
let $325a3faab7a68acd$var$cache$2 = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d$2(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache$2.has(cacheKey))
    return $325a3faab7a68acd$var$cache$2.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache$2.set(cacheKey, formatter);
  return formatter;
}
function $bb77f239b46e8c72$export$3274cf84b703fff$1(options) {
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    ...options
  });
  let startsWith = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(0, substring.length), substring) === 0;
  }, [
    collator
  ]);
  let endsWith2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(-substring.length), substring) === 0;
  }, [
    collator
  ]);
  let contains2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    let scan = 0;
    let sliceLen = substring.length;
    for (; scan + sliceLen <= string3.length; scan++) {
      let slice2 = string3.slice(scan, scan + sliceLen);
      if (collator.compare(substring, slice2) === 0)
        return true;
    }
    return false;
  }, [
    collator
  ]);
  return reactExports.useMemo(() => ({
    startsWith,
    endsWith: endsWith2,
    contains: contains2
  }), [
    startsWith,
    endsWith2,
    contains2
  ]);
}
let $2a41e45df1593e64$var$visualViewport = typeof document !== "undefined" ? window.visualViewport : null;
function $2a41e45df1593e64$export$d39e1813b3bdd0e1(props) {
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { arrowSize = 0, targetRef, overlayRef, scrollRef = overlayRef, placement = "bottom", containerPadding = 12, shouldFlip = true, boundaryElement = typeof document !== "undefined" ? document.body : null, offset: offset2 = 0, crossOffset = 0, shouldUpdatePosition = true, isOpen = true, onClose, maxHeight, arrowBoundaryOffset = 0 } = props;
  let [position2, setPosition] = reactExports.useState(null);
  let deps = [
    shouldUpdatePosition,
    placement,
    overlayRef.current,
    targetRef.current,
    scrollRef.current,
    containerPadding,
    shouldFlip,
    boundaryElement,
    offset2,
    crossOffset,
    isOpen,
    direction,
    maxHeight,
    arrowBoundaryOffset,
    arrowSize
  ];
  let lastScale = reactExports.useRef($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale);
  reactExports.useEffect(() => {
    if (isOpen)
      lastScale.current = $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale;
  }, [
    isOpen
  ]);
  let updatePosition = reactExports.useCallback(() => {
    if (shouldUpdatePosition === false || !isOpen || !overlayRef.current || !targetRef.current || !boundaryElement)
      return;
    if (($2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.scale) !== lastScale.current)
      return;
    let anchor = null;
    if (scrollRef.current && scrollRef.current.contains(document.activeElement)) {
      var _document_activeElement;
      let anchorRect = (_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.getBoundingClientRect();
      let scrollRect = scrollRef.current.getBoundingClientRect();
      var _anchorRect_top;
      anchor = {
        type: "top",
        offset: ((_anchorRect_top = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.top) !== null && _anchorRect_top !== void 0 ? _anchorRect_top : 0) - scrollRect.top
      };
      if (anchor.offset > scrollRect.height / 2) {
        anchor.type = "bottom";
        var _anchorRect_bottom;
        anchor.offset = ((_anchorRect_bottom = anchorRect === null || anchorRect === void 0 ? void 0 : anchorRect.bottom) !== null && _anchorRect_bottom !== void 0 ? _anchorRect_bottom : 0) - scrollRect.bottom;
      }
    }
    let overlay = overlayRef.current;
    if (!maxHeight && overlayRef.current) {
      var _window_visualViewport;
      overlay.style.top = "0px";
      overlay.style.bottom = "";
      var _window_visualViewport_height;
      overlay.style.maxHeight = ((_window_visualViewport_height = (_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) !== null && _window_visualViewport_height !== void 0 ? _window_visualViewport_height : window.innerHeight) + "px";
    }
    let position3 = $edcf132a9284368a$export$b3ceb0cbf1056d98({
      placement: $2a41e45df1593e64$var$translateRTL(placement, direction),
      overlayNode: overlayRef.current,
      targetNode: targetRef.current,
      scrollNode: scrollRef.current || overlayRef.current,
      padding: containerPadding,
      shouldFlip,
      boundaryElement,
      offset: offset2,
      crossOffset,
      maxHeight,
      arrowSize,
      arrowBoundaryOffset
    });
    if (!position3.position)
      return;
    overlay.style.top = "";
    overlay.style.bottom = "";
    overlay.style.left = "";
    overlay.style.right = "";
    Object.keys(position3.position).forEach((key) => overlay.style[key] = position3.position[key] + "px");
    overlay.style.maxHeight = position3.maxHeight != null ? position3.maxHeight + "px" : "";
    if (anchor && document.activeElement && scrollRef.current) {
      let anchorRect = document.activeElement.getBoundingClientRect();
      let scrollRect = scrollRef.current.getBoundingClientRect();
      let newOffset = anchorRect[anchor.type] - scrollRect[anchor.type];
      scrollRef.current.scrollTop += newOffset - anchor.offset;
    }
    setPosition(position3);
  }, deps);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(updatePosition, deps);
  $2a41e45df1593e64$var$useResize(updatePosition);
  $9daab02d461809db$export$683480f191c0e3ea({
    ref: overlayRef,
    onResize: updatePosition
  });
  $9daab02d461809db$export$683480f191c0e3ea({
    ref: targetRef,
    onResize: updatePosition
  });
  let isResizing = reactExports.useRef(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let timeout;
    let onResize4 = () => {
      isResizing.current = true;
      clearTimeout(timeout);
      timeout = setTimeout(() => {
        isResizing.current = false;
      }, 500);
      updatePosition();
    };
    let onScroll6 = () => {
      if (isResizing.current)
        onResize4();
    };
    $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("resize", onResize4);
    $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.addEventListener("scroll", onScroll6);
    return () => {
      $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("resize", onResize4);
      $2a41e45df1593e64$var$visualViewport === null || $2a41e45df1593e64$var$visualViewport === void 0 ? void 0 : $2a41e45df1593e64$var$visualViewport.removeEventListener("scroll", onScroll6);
    };
  }, [
    updatePosition
  ]);
  let close = reactExports.useCallback(() => {
    if (!isResizing.current)
      onClose === null || onClose === void 0 ? void 0 : onClose();
  }, [
    onClose,
    isResizing
  ]);
  $dd149f63282afbbf$export$18fc8428861184da({
    triggerRef: targetRef,
    isOpen,
    onClose: onClose && close
  });
  var _position_maxHeight, _position_placement;
  return {
    overlayProps: {
      style: {
        position: "absolute",
        zIndex: 1e5,
        ...position2 === null || position2 === void 0 ? void 0 : position2.position,
        maxHeight: (_position_maxHeight = position2 === null || position2 === void 0 ? void 0 : position2.maxHeight) !== null && _position_maxHeight !== void 0 ? _position_maxHeight : "100vh"
      }
    },
    placement: (_position_placement = position2 === null || position2 === void 0 ? void 0 : position2.placement) !== null && _position_placement !== void 0 ? _position_placement : null,
    arrowProps: {
      "aria-hidden": "true",
      role: "presentation",
      style: {
        left: position2 === null || position2 === void 0 ? void 0 : position2.arrowOffsetLeft,
        top: position2 === null || position2 === void 0 ? void 0 : position2.arrowOffsetTop
      }
    },
    updatePosition
  };
}
function $2a41e45df1593e64$var$useResize(onResize4) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    window.addEventListener("resize", onResize4, false);
    return () => {
      window.removeEventListener("resize", onResize4, false);
    };
  }, [
    onResize4
  ]);
}
function $2a41e45df1593e64$var$translateRTL(position2, direction) {
  if (direction === "rtl")
    return position2.replace("start", "right").replace("end", "left");
  return position2.replace("start", "left").replace("end", "right");
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$d(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$d(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = false;
function $8a9cb279dc87e130$export$cabe61c495ee3649$b(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = true;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 = false;
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$b = "default";
let $14c0b72509d70225$var$savedUserSelect$b = "";
let $14c0b72509d70225$var$modifiedElementMap$b = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$b(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$b === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$b = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$b = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$b.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$b(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$b !== "disabled")
      return;
    $14c0b72509d70225$var$state$b = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$b === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$b || "";
          $14c0b72509d70225$var$savedUserSelect$b = "";
          $14c0b72509d70225$var$state$b = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$b.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$b.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$b.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$b = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$b.displayName = "PressResponderContext";
function _class_apply_descriptor_get(receiver, descriptor) {
  if (descriptor.get)
    return descriptor.get.call(receiver);
  return descriptor.value;
}
function _class_extract_field_descriptor(receiver, privateMap, action) {
  if (!privateMap.has(receiver))
    throw new TypeError("attempted to " + action + " private field on non-instance");
  return privateMap.get(receiver);
}
function _class_private_field_get(receiver, privateMap) {
  var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
  return _class_apply_descriptor_get(receiver, descriptor);
}
function _class_apply_descriptor_set(receiver, descriptor, value2) {
  if (descriptor.set)
    descriptor.set.call(receiver, value2);
  else {
    if (!descriptor.writable) {
      throw new TypeError("attempted to set read only private field");
    }
    descriptor.value = value2;
  }
}
function _class_private_field_set(receiver, privateMap, value2) {
  var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
  _class_apply_descriptor_set(receiver, descriptor, value2);
  return value2;
}
function $f6c31cce2adf654f$var$usePressResponderContext$b(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$b);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$b = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$b = class $f6c31cce2adf654f$var$PressEvent {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$b, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$b = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$b = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$b(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$b(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$b("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$b("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$b(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$d(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$b(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$b(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$b(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$b(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$b(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$b(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$b]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$b] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$b(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$b(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$b(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$b))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$b;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$b((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$b]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$b(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$b(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$b(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$b(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$b(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$b(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$b(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$b(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$b(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$b(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$b = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$b(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$b.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext$b = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$b = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$b);
const $b5e257d569688ac6$var$IsSSRContext$b = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$b = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$b(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$b);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$b.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$b.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$b.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$b(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$b);
  let counter = $b5e257d569688ac6$var$useCounter$b(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$b(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$b());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$b.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$b : $b5e257d569688ac6$var$useLegacySSRSafeId$b;
function $b5e257d569688ac6$var$getSnapshot$b() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$b() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$b(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$b() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$b, $b5e257d569688ac6$var$getSnapshot$b, $b5e257d569688ac6$var$getServerSnapshot$b);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$b);
}
let $507fabe10e71c6fb$var$currentModality$3 = null;
let $507fabe10e71c6fb$var$changeHandlers$5 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$5 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = false;
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS$1 = {
  Tab: true,
  Escape: true
};
function $507fabe10e71c6fb$var$triggerChangeHandlers$5(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$5)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$5(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$5(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
  if ($507fabe10e71c6fb$var$isValidKey$5(e2)) {
    $507fabe10e71c6fb$var$currentModality$3 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$5(e2) {
  $507fabe10e71c6fb$var$currentModality$3 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$5(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    $507fabe10e71c6fb$var$currentModality$3 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$5(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$5 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$5 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$5) {
    $507fabe10e71c6fb$var$currentModality$3 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$5("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$5() {
  if ($8a9cb279dc87e130$export$fda7da73ab5d4c48$5)
    return;
  $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$5 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$5.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$5 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$5, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$5, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$5, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$5.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$5.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$5.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$5, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$5, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$5, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$5, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$5, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$5.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$5(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$5(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$5(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$5();
function $507fabe10e71c6fb$export$b9b3dfddab17db27$2() {
  return $507fabe10e71c6fb$var$currentModality$3 !== "pointer";
}
function $507fabe10e71c6fb$export$630ff653c5ada6a9$2() {
  return $507fabe10e71c6fb$var$currentModality$3;
}
function $507fabe10e71c6fb$export$8397ddfc504fdb9a$2(modality) {
  $507fabe10e71c6fb$var$currentModality$3 = modality;
  $507fabe10e71c6fb$var$triggerChangeHandlers$5(modality, null);
}
function $507fabe10e71c6fb$export$98e20ec92f614cfe() {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents$5();
  let [modality, setModality] = reactExports.useState($507fabe10e71c6fb$var$currentModality$3);
  reactExports.useEffect(() => {
    let handler = () => {
      setModality($507fabe10e71c6fb$var$currentModality$3);
    };
    $507fabe10e71c6fb$var$changeHandlers$5.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers$5.delete(handler);
    };
  }, []);
  return $b5e257d569688ac6$export$535bd6ca7f90a273$b() ? null : modality;
}
const $507fabe10e71c6fb$var$nonTextInputTypes$1 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $507fabe10e71c6fb$var$isKeyboardFocusEvent$1(isTextInput, modality, e2) {
  let document1 = $431fbd86ca7dc216$export$b204af158042fbac$4(e2 === null || e2 === void 0 ? void 0 : e2.target);
  const IHTMLInputElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLInputElement : HTMLInputElement;
  const IHTMLTextAreaElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLTextAreaElement : HTMLTextAreaElement;
  const IHTMLElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLElement : HTMLElement;
  const IKeyboardEvent = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).KeyboardEvent : KeyboardEvent;
  isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes$1.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
  return !(isTextInput && modality === "keyboard" && e2 instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS$1[e2.key]);
}
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3$1(fn, deps, opts2) {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents$5();
  reactExports.useEffect(() => {
    let handler = (modality, e2) => {
      if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent$1(!!(opts2 === null || opts2 === void 0 ? void 0 : opts2.isTextInput), modality, e2))
        return;
      fn($507fabe10e71c6fb$export$b9b3dfddab17db27$2());
    };
    $507fabe10e71c6fb$var$changeHandlers$5.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers$5.delete(handler);
    };
  }, deps);
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c$2(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260$2(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd$2(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260$2(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260$2(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb$2 = /* @__PURE__ */ React$6.createContext(null);
function $f645667febf57a63$var$useFocusableContext$2(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb$2) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c$2(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext$2(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $f1ab8c75478c6f73$export$cf75428e0b9ed1ea({ children }) {
  let context = reactExports.useMemo(() => ({
    register: () => {
    }
  }), []);
  return /* @__PURE__ */ React$6.createElement($ae1eeba8b9eafd08$export$5165eccb35aaadb5$b.Provider, {
    value: context
  }, children);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$4(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$5(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$c(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$d(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = false;
let $6179b936705e76d3$var$hoverCount$h = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$h() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$h(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$h();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$h() {
  if (typeof document === "undefined")
    return;
  if ($6179b936705e76d3$var$hoverCount$h === 0) {
    if (typeof PointerEvent !== "undefined")
      document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$h);
  }
  $6179b936705e76d3$var$hoverCount$h++;
  return () => {
    $6179b936705e76d3$var$hoverCount$h--;
    if ($6179b936705e76d3$var$hoverCount$h > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$h);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$h(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$h, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$h && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $e8a7022cf87cba2a$export$36da96379f79f245(props) {
  let { onMoveStart, onMove, onMoveEnd } = props;
  let state = reactExports.useRef({
    didMove: false,
    lastPosition: null,
    id: null
  });
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let move2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, deltaX, deltaY) => {
    if (deltaX === 0 && deltaY === 0)
      return;
    if (!state.current.didMove) {
      state.current.didMove = true;
      onMoveStart === null || onMoveStart === void 0 ? void 0 : onMoveStart({
        type: "movestart",
        pointerType,
        shiftKey: originalEvent.shiftKey,
        metaKey: originalEvent.metaKey,
        ctrlKey: originalEvent.ctrlKey,
        altKey: originalEvent.altKey
      });
    }
    onMove === null || onMove === void 0 ? void 0 : onMove({
      type: "move",
      pointerType,
      deltaX,
      deltaY,
      shiftKey: originalEvent.shiftKey,
      metaKey: originalEvent.metaKey,
      ctrlKey: originalEvent.ctrlKey,
      altKey: originalEvent.altKey
    });
  });
  let end = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    $14c0b72509d70225$export$b0d6fa1ab32e3295$b();
    if (state.current.didMove)
      onMoveEnd === null || onMoveEnd === void 0 ? void 0 : onMoveEnd({
        type: "moveend",
        pointerType,
        shiftKey: originalEvent.shiftKey,
        metaKey: originalEvent.metaKey,
        ctrlKey: originalEvent.ctrlKey,
        altKey: originalEvent.altKey
      });
  });
  let moveProps = reactExports.useMemo(() => {
    let moveProps2 = {};
    let start = () => {
      $14c0b72509d70225$export$16a4697467175487$b();
      state.current.didMove = false;
    };
    {
      let onPointerMove = (e2) => {
        if (e2.pointerId === state.current.id) {
          var _state_current_lastPosition, _state_current_lastPosition1;
          let pointerType = e2.pointerType || "mouse";
          var _state_current_lastPosition_pageX, _state_current_lastPosition_pageY;
          move2(e2, pointerType, e2.pageX - ((_state_current_lastPosition_pageX = (_state_current_lastPosition = state.current.lastPosition) === null || _state_current_lastPosition === void 0 ? void 0 : _state_current_lastPosition.pageX) !== null && _state_current_lastPosition_pageX !== void 0 ? _state_current_lastPosition_pageX : 0), e2.pageY - ((_state_current_lastPosition_pageY = (_state_current_lastPosition1 = state.current.lastPosition) === null || _state_current_lastPosition1 === void 0 ? void 0 : _state_current_lastPosition1.pageY) !== null && _state_current_lastPosition_pageY !== void 0 ? _state_current_lastPosition_pageY : 0));
          state.current.lastPosition = {
            pageX: e2.pageX,
            pageY: e2.pageY
          };
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.current.id) {
          let pointerType = e2.pointerType || "mouse";
          end(e2, pointerType);
          state.current.id = null;
          removeGlobalListener(window, "pointermove", onPointerMove, false);
          removeGlobalListener(window, "pointerup", onPointerUp, false);
          removeGlobalListener(window, "pointercancel", onPointerUp, false);
        }
      };
      moveProps2.onPointerDown = (e2) => {
        if (e2.button === 0 && state.current.id == null) {
          start();
          e2.stopPropagation();
          e2.preventDefault();
          state.current.lastPosition = {
            pageX: e2.pageX,
            pageY: e2.pageY
          };
          state.current.id = e2.pointerId;
          addGlobalListener(window, "pointermove", onPointerMove, false);
          addGlobalListener(window, "pointerup", onPointerUp, false);
          addGlobalListener(window, "pointercancel", onPointerUp, false);
        }
      };
    }
    let triggerKeyboardMove = (e2, deltaX, deltaY) => {
      start();
      move2(e2, "keyboard", deltaX, deltaY);
      end(e2, "keyboard");
    };
    moveProps2.onKeyDown = (e2) => {
      switch (e2.key) {
        case "Left":
        case "ArrowLeft":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, -1, 0);
          break;
        case "Right":
        case "ArrowRight":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 1, 0);
          break;
        case "Up":
        case "ArrowUp":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 0, -1);
          break;
        case "Down":
        case "ArrowDown":
          e2.preventDefault();
          e2.stopPropagation();
          triggerKeyboardMove(e2, 0, 1);
          break;
      }
    };
    return moveProps2;
  }, [
    state,
    addGlobalListener,
    removeGlobalListener,
    move2,
    end
  ]);
  return {
    moveProps
  };
}
function $7d0a636d7a4dcefd$export$2123ff2b87c81ca(props, ref) {
  let { onScroll: onScroll6, isDisabled } = props;
  let onScrollHandler = reactExports.useCallback((e2) => {
    if (e2.ctrlKey)
      return;
    e2.preventDefault();
    e2.stopPropagation();
    if (onScroll6)
      onScroll6({
        deltaX: e2.deltaX,
        deltaY: e2.deltaY
      });
  }, [
    onScroll6
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "wheel", isDisabled ? void 0 : onScrollHandler);
}
const $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
  let { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
  const timeRef = reactExports.useRef(void 0);
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled,
    onPressStart(e2) {
      e2.continuePropagation();
      if (e2.pointerType === "mouse" || e2.pointerType === "touch") {
        if (onLongPressStart)
          onLongPressStart({
            ...e2,
            type: "longpressstart"
          });
        timeRef.current = setTimeout(() => {
          e2.target.dispatchEvent(new PointerEvent("pointercancel", {
            bubbles: true
          }));
          if ($431fbd86ca7dc216$export$b204af158042fbac$4(e2.target).activeElement !== e2.target)
            $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
          if (onLongPress)
            onLongPress({
              ...e2,
              type: "longpress"
            });
          timeRef.current = void 0;
        }, threshold);
        if (e2.pointerType === "touch") {
          let onContextMenu = (e3) => {
            e3.preventDefault();
          };
          addGlobalListener(e2.target, "contextmenu", onContextMenu, {
            once: true
          });
          addGlobalListener(window, "pointerup", () => {
            setTimeout(() => {
              removeGlobalListener(e2.target, "contextmenu", onContextMenu);
            }, 30);
          }, {
            once: true
          });
        }
      }
    },
    onPressEnd(e2) {
      if (timeRef.current)
        clearTimeout(timeRef.current);
      if (onLongPressEnd && (e2.pointerType === "mouse" || e2.pointerType === "touch"))
        onLongPressEnd({
          ...e2,
          type: "longpressend"
        });
    }
  });
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : void 0);
  return {
    longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, descriptionProps)
  };
}
const $9bf71ea28793e738$var$FocusContext$1 = /* @__PURE__ */ React$6.createContext(null);
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1 = "react-aria-focus-scope-restore";
let $9bf71ea28793e738$var$activeScope$1 = null;
function $9bf71ea28793e738$export$20e40289641fbbb6$1(props) {
  let { children, contain, restoreFocus, autoFocus } = props;
  let startRef = reactExports.useRef(null);
  let endRef = reactExports.useRef(null);
  let scopeRef = reactExports.useRef([]);
  let { parentNode } = reactExports.useContext($9bf71ea28793e738$var$FocusContext$1) || {};
  let node2 = reactExports.useMemo(() => new $9bf71ea28793e738$var$TreeNode$7({
    scopeRef
  }), [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e$1.root;
    if ($9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope$1 && !$9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, parent.scopeRef)) {
      let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
      if (activeNode)
        parent = activeNode;
    }
    parent.addChild(node2);
    $9bf71ea28793e738$export$d06fae2ee68b101e$1.addNode(node2);
  }, [
    node2,
    parentNode
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let node3 = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
    if (node3)
      node3.contain = !!contain;
  }, [
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    var _startRef_current;
    let node3 = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
    let nodes = [];
    let stopPropagation2 = (e2) => e2.stopPropagation();
    while (node3 && node3 !== endRef.current) {
      nodes.push(node3);
      node3.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, stopPropagation2);
      node3 = node3.nextSibling;
    }
    scopeRef.current = nodes;
    return () => {
      for (let node4 of nodes)
        node4.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, stopPropagation2);
    };
  }, [
    children
  ]);
  $9bf71ea28793e738$var$useActiveScopeTracker$1(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useFocusContainment$1(scopeRef, contain);
  $9bf71ea28793e738$var$useRestoreFocus$1(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useAutoFocus$1(scopeRef, autoFocus);
  reactExports.useEffect(() => {
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0));
    let scope = null;
    if ($9bf71ea28793e738$var$isElementInScope$7(activeElement, scopeRef.current)) {
      for (let node3 of $9bf71ea28793e738$export$d06fae2ee68b101e$1.traverse())
        if (node3.scopeRef && $9bf71ea28793e738$var$isElementInScope$7(activeElement, node3.scopeRef.current))
          scope = node3;
      if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef))
        $9bf71ea28793e738$var$activeScope$1 = scope.scopeRef;
    }
  }, [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
      var _focusScopeTree_getTreeNode_parent_scopeRef;
      let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
      if ((scopeRef === $9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1(scopeRef, $9bf71ea28793e738$var$activeScope$1)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(parentScope)))
        $9bf71ea28793e738$var$activeScope$1 = parentScope;
      $9bf71ea28793e738$export$d06fae2ee68b101e$1.removeTreeNode(scopeRef);
    };
  }, [
    scopeRef
  ]);
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$var$createFocusManagerForScope$1(scopeRef), []);
  let value2 = reactExports.useMemo(() => ({
    focusManager,
    parentNode: node2
  }), [
    node2,
    focusManager
  ]);
  return /* @__PURE__ */ React$6.createElement($9bf71ea28793e738$var$FocusContext$1.Provider, {
    value: value2
  }, /* @__PURE__ */ React$6.createElement("span", {
    "data-focus-scope-start": true,
    hidden: true,
    ref: startRef
  }), children, /* @__PURE__ */ React$6.createElement("span", {
    "data-focus-scope-end": true,
    hidden: true,
    ref: endRef
  }));
}
function $9bf71ea28793e738$var$createFocusManagerForScope$1(scopeRef) {
  return {
    focusNext(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[0].previousElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$7(node2, scope) ? node2 : sentinel;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = sentinel;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$2(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[scope.length - 1].nextElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$7(node2, scope) ? node2 : sentinel;
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = sentinel;
        previousNode = walker.previousNode();
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$2(previousNode, true);
      return previousNode;
    },
    focusFirst(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[0].previousElementSibling;
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$2(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[scope.length - 1].nextElementSibling;
      let previousNode = walker.previousNode();
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$2(previousNode, true);
      return previousNode;
    }
  };
}
function $9bf71ea28793e738$var$getScopeRoot$1(scope) {
  return scope[0].parentElement;
}
function $9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.contain)
      return false;
    scope = scope.parent;
  }
  return true;
}
function $9bf71ea28793e738$var$isTabbableRadio$6(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$useFocusContainment$1(scopeRef, contain) {
  let focusedNode = reactExports.useRef(void 0);
  let raf3 = reactExports.useRef(void 0);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    if (!contain) {
      if (raf3.current) {
        cancelAnimationFrame(raf3.current);
        raf3.current = void 0;
      }
      return;
    }
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) || e2.isComposing)
        return;
      let focusedElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      let scope2 = scopeRef.current;
      if (!scope2 || !$9bf71ea28793e738$var$isElementInScope$7(focusedElement, scope2))
        return;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope2);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
        tabbable: true
      }, scope2);
      if (!focusedElement)
        return;
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nextElement) {
        walker.currentNode = e2.shiftKey ? scope2[scope2.length - 1].nextElementSibling : scope2[0].previousElementSibling;
        nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      }
      e2.preventDefault();
      if (nextElement)
        $9bf71ea28793e738$var$focusElement$2(nextElement, true);
    };
    let onFocus = (e2) => {
      if ((!$9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef.current)) {
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      } else if ($9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef)) {
        if (focusedNode.current)
          focusedNode.current.focus();
        else if ($9bf71ea28793e738$var$activeScope$1 && $9bf71ea28793e738$var$activeScope$1.current)
          $9bf71ea28793e738$var$focusFirstInScope$1($9bf71ea28793e738$var$activeScope$1.current);
      } else if ($9bf71ea28793e738$var$shouldContainFocus$1(scopeRef))
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
    };
    let onBlur = (e2) => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
      raf3.current = requestAnimationFrame(() => {
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        let shouldSkipFocusRestore = (modality === "virtual" || modality === null) && $c87311424ea30a05$export$a11b0059900ceec8$4() && $c87311424ea30a05$export$6446a186d09e379e$5();
        let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
        if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope$1(activeElement, scopeRef)) {
          $9bf71ea28793e738$var$activeScope$1 = scopeRef;
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
          if (target && target.isConnected) {
            var _focusedNode_current;
            focusedNode.current = target;
            (_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
          } else if ($9bf71ea28793e738$var$activeScope$1.current)
            $9bf71ea28793e738$var$focusFirstInScope$1($9bf71ea28793e738$var$activeScope$1.current);
        }
      });
    };
    ownerDocument.addEventListener("keydown", onKeyDown, false);
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusout", onBlur, false));
    return () => {
      ownerDocument.removeEventListener("keydown", onKeyDown, false);
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusout", onBlur, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, [
    raf3
  ]);
}
function $9bf71ea28793e738$var$isElementInAnyScope$1(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope$1(element2);
}
function $9bf71ea28793e738$var$isElementInScope$7(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$isElementInChildScope$1(element2, scope = null) {
  if (element2 instanceof Element && element2.closest("[data-react-aria-top-layer]"))
    return true;
  for (let { scopeRef: s2 } of $9bf71ea28793e738$export$d06fae2ee68b101e$1.traverse($9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scope))) {
    if (s2 && $9bf71ea28793e738$var$isElementInScope$7(element2, s2.current))
      return true;
  }
  return false;
}
function $9bf71ea28793e738$var$isAncestorScope$1(ancestor, scope) {
  var _focusScopeTree_getTreeNode;
  let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
  while (parent) {
    if (parent.scopeRef === ancestor)
      return true;
    parent = parent.parent;
  }
  return false;
}
function $9bf71ea28793e738$var$focusElement$2(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$var$getFirstInScope$1(scope, tabbable = true) {
  let sentinel = scope[0].previousElementSibling;
  let scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
    tabbable
  }, scope);
  walker.currentNode = sentinel;
  let nextNode = walker.nextNode();
  if (tabbable && !nextNode) {
    scopeRoot = $9bf71ea28793e738$var$getScopeRoot$1(scope);
    walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(scopeRoot, {
      tabbable: false
    }, scope);
    walker.currentNode = sentinel;
    nextNode = walker.nextNode();
  }
  return nextNode;
}
function $9bf71ea28793e738$var$focusFirstInScope$1(scope, tabbable = true) {
  $9bf71ea28793e738$var$focusElement$2($9bf71ea28793e738$var$getFirstInScope$1(scope, tabbable));
}
function $9bf71ea28793e738$var$useAutoFocus$1(scopeRef, autoFocus) {
  const autoFocusRef = React$6.useRef(autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      $9bf71ea28793e738$var$activeScope$1 = scopeRef;
      const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
      if (!$9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), $9bf71ea28793e738$var$activeScope$1.current) && scopeRef.current)
        $9bf71ea28793e738$var$focusFirstInScope$1(scopeRef.current);
    }
    autoFocusRef.current = false;
  }, [
    scopeRef
  ]);
}
function $9bf71ea28793e738$var$useActiveScopeTracker$1(scopeRef, restore, contain) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (restore || contain)
      return;
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onFocus = (e2) => {
      let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      if ($9bf71ea28793e738$var$isElementInScope$7(target, scopeRef.current))
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
      else if (!$9bf71ea28793e738$var$isElementInAnyScope$1(target))
        $9bf71ea28793e738$var$activeScope$1 = null;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    restore,
    contain
  ]);
}
function $9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode($9bf71ea28793e738$var$activeScope$1);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.nodeToRestore)
      return false;
    scope = scope.parent;
  }
  return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
}
function $9bf71ea28793e738$var$useRestoreFocus$1(scopeRef, restoreFocus, contain) {
  const nodeToRestoreRef = reactExports.useRef(typeof document !== "undefined" ? $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0)) : null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    if (!restoreFocus || contain)
      return;
    let onFocus = () => {
      if ((!$9bf71ea28793e738$var$activeScope$1 || $9bf71ea28793e738$var$isAncestorScope$1($9bf71ea28793e738$var$activeScope$1, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$7($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), scopeRef.current))
        $9bf71ea28793e738$var$activeScope$1 = scopeRef;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus$1(scopeRef) || e2.isComposing)
        return;
      let focusedElement = ownerDocument.activeElement;
      if (!$9bf71ea28793e738$var$isElementInChildScope$1(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef))
        return;
      let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
      if (!treeNode)
        return;
      let nodeToRestore = treeNode.nodeToRestore;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(ownerDocument.body, {
        tabbable: true
      });
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
        nodeToRestore = void 0;
        treeNode.nodeToRestore = void 0;
      }
      if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope$1(nextElement, scopeRef)) && nodeToRestore) {
        walker.currentNode = nodeToRestore;
        do
          nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
        while ($9bf71ea28793e738$var$isElementInChildScope$1(nextElement, scopeRef));
        e2.preventDefault();
        e2.stopPropagation();
        if (nextElement)
          $9bf71ea28793e738$var$focusElement$2(nextElement, true);
        else if (!$9bf71ea28793e738$var$isElementInAnyScope$1(nodeToRestore))
          focusedElement.blur();
        else
          $9bf71ea28793e738$var$focusElement$2(nodeToRestore, true);
      }
    };
    if (!contain)
      ownerDocument.addEventListener("keydown", onKeyDown, true);
    return () => {
      if (!contain)
        ownerDocument.removeEventListener("keydown", onKeyDown, true);
    };
  }, [
    scopeRef,
    restoreFocus,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
    if (!treeNode)
      return;
    var _nodeToRestoreRef_current;
    treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : void 0;
    return () => {
      let treeNode2 = $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(scopeRef);
      if (!treeNode2)
        return;
      let nodeToRestore = treeNode2.nodeToRestore;
      let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope$1(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus$1(scopeRef))) {
        let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e$1.clone();
        requestAnimationFrame(() => {
          if (ownerDocument.activeElement === ownerDocument.body) {
            let treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.nodeToRestore && treeNode3.nodeToRestore.isConnected) {
                $9bf71ea28793e738$var$restoreFocusToElement$1(treeNode3.nodeToRestore);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
            treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.scopeRef && treeNode3.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e$1.getTreeNode(treeNode3.scopeRef)) {
                let node2 = $9bf71ea28793e738$var$getFirstInScope$1(treeNode3.scopeRef.current, true);
                $9bf71ea28793e738$var$restoreFocusToElement$1(node2);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
          }
        });
      }
    };
  }, [
    scopeRef,
    restoreFocus
  ]);
}
function $9bf71ea28793e738$var$restoreFocusToElement$1(node2) {
  if (node2.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT$1, {
    bubbles: true,
    cancelable: true
  })))
    $9bf71ea28793e738$var$focusElement$2(node2);
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$7(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$6(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$7(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$7 = class $9bf71ea28793e738$var$Tree {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$7({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$7(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$7({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$7 = class $9bf71ea28793e738$var$TreeNode {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
let $9bf71ea28793e738$export$d06fae2ee68b101e$1 = new $9bf71ea28793e738$var$Tree$7();
function $628037886ba31236$export$f9d5c8beee7d008d$2(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37$2.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
const $49c51c25361d4cd2$var$visualViewport = typeof document !== "undefined" && window.visualViewport;
const $49c51c25361d4cd2$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
let $49c51c25361d4cd2$var$preventScrollCount = 0;
let $49c51c25361d4cd2$var$restore;
function $49c51c25361d4cd2$export$ee0f7cc6afcd1c18(options = {}) {
  let { isDisabled } = options;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (isDisabled)
      return;
    $49c51c25361d4cd2$var$preventScrollCount++;
    if ($49c51c25361d4cd2$var$preventScrollCount === 1) {
      if ($c87311424ea30a05$export$fedb369cb70207f1$3())
        $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollMobileSafari();
      else
        $49c51c25361d4cd2$var$restore = $49c51c25361d4cd2$var$preventScrollStandard();
    }
    return () => {
      $49c51c25361d4cd2$var$preventScrollCount--;
      if ($49c51c25361d4cd2$var$preventScrollCount === 0)
        $49c51c25361d4cd2$var$restore();
    };
  }, [
    isDisabled
  ]);
}
function $49c51c25361d4cd2$var$preventScrollStandard() {
  let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
  return $ff5963eb1fccf552$export$e08e3b67e392101e$9(scrollbarWidth > 0 && // Use scrollbar-gutter when supported because it also works for fixed positioned elements.
  ("scrollbarGutter" in document.documentElement.style ? $49c51c25361d4cd2$var$setStyle(document.documentElement, "scrollbarGutter", "stable") : $49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${scrollbarWidth}px`)), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"));
}
function $49c51c25361d4cd2$var$preventScrollMobileSafari() {
  let scrollable;
  let restoreScrollableStyles;
  let onTouchStart = (e2) => {
    scrollable = $62d8ded9296f3872$export$cfa2225e87938781(e2.target, true);
    if (scrollable === document.documentElement && scrollable === document.body)
      return;
    if (scrollable instanceof HTMLElement && window.getComputedStyle(scrollable).overscrollBehavior === "auto")
      restoreScrollableStyles = $49c51c25361d4cd2$var$setStyle(scrollable, "overscrollBehavior", "contain");
  };
  let onTouchMove = (e2) => {
    if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
      e2.preventDefault();
      return;
    }
    if (scrollable.scrollHeight === scrollable.clientHeight && scrollable.scrollWidth === scrollable.clientWidth)
      e2.preventDefault();
  };
  let onTouchEnd = () => {
    if (restoreScrollableStyles)
      restoreScrollableStyles();
  };
  let onFocus = (e2) => {
    let target = e2.target;
    if ($49c51c25361d4cd2$var$willOpenKeyboard(target)) {
      setupStyles();
      target.style.transform = "translateY(-2000px)";
      requestAnimationFrame(() => {
        target.style.transform = "";
        if ($49c51c25361d4cd2$var$visualViewport) {
          if ($49c51c25361d4cd2$var$visualViewport.height < window.innerHeight)
            requestAnimationFrame(() => {
              $49c51c25361d4cd2$var$scrollIntoView(target);
            });
          else
            $49c51c25361d4cd2$var$visualViewport.addEventListener("resize", () => $49c51c25361d4cd2$var$scrollIntoView(target), {
              once: true
            });
        }
      });
    }
  };
  let restoreStyles = null;
  let setupStyles = () => {
    if (restoreStyles)
      return;
    let onWindowScroll = () => {
      window.scrollTo(0, 0);
    };
    let scrollX = window.pageXOffset;
    let scrollY = window.pageYOffset;
    restoreStyles = $ff5963eb1fccf552$export$e08e3b67e392101e$9($49c51c25361d4cd2$var$addEvent(window, "scroll", onWindowScroll), $49c51c25361d4cd2$var$setStyle(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), $49c51c25361d4cd2$var$setStyle(document.documentElement, "overflow", "hidden"), $49c51c25361d4cd2$var$setStyle(document.body, "marginTop", `-${scrollY}px`), () => {
      window.scrollTo(scrollX, scrollY);
    });
    window.scrollTo(0, 0);
  };
  let removeEvents2 = $ff5963eb1fccf552$export$e08e3b67e392101e$9($49c51c25361d4cd2$var$addEvent(document, "touchstart", onTouchStart, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "touchmove", onTouchMove, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "touchend", onTouchEnd, {
    passive: false,
    capture: true
  }), $49c51c25361d4cd2$var$addEvent(document, "focus", onFocus, true));
  return () => {
    restoreScrollableStyles === null || restoreScrollableStyles === void 0 ? void 0 : restoreScrollableStyles();
    restoreStyles === null || restoreStyles === void 0 ? void 0 : restoreStyles();
    removeEvents2();
  };
}
function $49c51c25361d4cd2$var$setStyle(element2, style2, value2) {
  let cur = element2.style[style2];
  element2.style[style2] = value2;
  return () => {
    element2.style[style2] = cur;
  };
}
function $49c51c25361d4cd2$var$addEvent(target, event, handler, options) {
  target.addEventListener(event, handler, options);
  return () => {
    target.removeEventListener(event, handler, options);
  };
}
function $49c51c25361d4cd2$var$scrollIntoView(target) {
  let root2 = document.scrollingElement || document.documentElement;
  let nextTarget = target;
  while (nextTarget && nextTarget !== root2) {
    let scrollable = $62d8ded9296f3872$export$cfa2225e87938781(nextTarget);
    if (scrollable !== document.documentElement && scrollable !== document.body && scrollable !== nextTarget) {
      let scrollableTop = scrollable.getBoundingClientRect().top;
      let targetTop = nextTarget.getBoundingClientRect().top;
      if (targetTop > scrollableTop + nextTarget.clientHeight)
        scrollable.scrollTop += targetTop - scrollableTop;
    }
    nextTarget = scrollable.parentElement;
  }
}
function $49c51c25361d4cd2$var$willOpenKeyboard(target) {
  return target instanceof HTMLInputElement && !$49c51c25361d4cd2$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
}
const $96b38030c423d352$export$60d741e20e0aa309 = /* @__PURE__ */ reactExports.createContext({});
function $96b38030c423d352$export$9fc1347d4195ccb3() {
  var _useContext;
  return (_useContext = reactExports.useContext($96b38030c423d352$export$60d741e20e0aa309)) !== null && _useContext !== void 0 ? _useContext : {};
}
const $b5e257d569688ac6$var$defaultContext$a = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$a = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$a);
const $b5e257d569688ac6$var$IsSSRContext$a = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$a = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$a(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$a);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$a.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$a.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$a.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$a(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$a);
  let counter = $b5e257d569688ac6$var$useCounter$a(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$a(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$a());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$a.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$a : $b5e257d569688ac6$var$useLegacySSRSafeId$a;
function $b5e257d569688ac6$var$getSnapshot$a() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$a() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$a(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$a() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$a, $b5e257d569688ac6$var$getSnapshot$a, $b5e257d569688ac6$var$getServerSnapshot$a);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$a);
}
const $f57aed4a881a3485$var$Context = /* @__PURE__ */ React$6.createContext(null);
function $f57aed4a881a3485$export$178405afcd8c5eb(props) {
  let { children } = props;
  let parent = reactExports.useContext($f57aed4a881a3485$var$Context);
  let [modalCount, setModalCount] = reactExports.useState(0);
  let context = reactExports.useMemo(() => ({
    parent,
    modalCount,
    addModal() {
      setModalCount((count) => count + 1);
      if (parent)
        parent.addModal();
    },
    removeModal() {
      setModalCount((count) => count - 1);
      if (parent)
        parent.removeModal();
    }
  }), [
    parent,
    modalCount
  ]);
  return /* @__PURE__ */ React$6.createElement($f57aed4a881a3485$var$Context.Provider, {
    value: context
  }, children);
}
function $f57aed4a881a3485$export$d9aaed4c3ece1bc0() {
  let context = reactExports.useContext($f57aed4a881a3485$var$Context);
  return {
    modalProviderProps: {
      "aria-hidden": context && context.modalCount > 0 ? true : void 0
    }
  };
}
function $f57aed4a881a3485$var$OverlayContainerDOM(props) {
  let { modalProviderProps } = $f57aed4a881a3485$export$d9aaed4c3ece1bc0();
  return /* @__PURE__ */ React$6.createElement("div", {
    "data-overlay-container": true,
    ...props,
    ...modalProviderProps
  });
}
function $f57aed4a881a3485$export$bf688221f59024e5(props) {
  return /* @__PURE__ */ React$6.createElement($f57aed4a881a3485$export$178405afcd8c5eb, null, /* @__PURE__ */ React$6.createElement($f57aed4a881a3485$var$OverlayContainerDOM, props));
}
function $f57aed4a881a3485$export$b47c3594eab58386(props) {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$a();
  let { portalContainer = isSSR ? null : document.body, ...rest } = props;
  let { getContainer: getContainer2 } = $96b38030c423d352$export$9fc1347d4195ccb3();
  if (!props.portalContainer && getContainer2)
    portalContainer = getContainer2();
  React$6.useEffect(() => {
    if (portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.closest("[data-overlay-container]"))
      throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
  }, [
    portalContainer
  ]);
  if (!portalContainer)
    return null;
  let contents = /* @__PURE__ */ React$6.createElement($f57aed4a881a3485$export$bf688221f59024e5, rest);
  return /* @__PURE__ */ ReactDOM.createPortal(contents, portalContainer);
}
var $773d5888b972f1cf$exports = {};
$773d5888b972f1cf$exports = {
  "dismiss": `تجاهل`
};
var $d11f19852b941573$exports = {};
$d11f19852b941573$exports = {
  "dismiss": `Отхвърляне`
};
var $b983974c2ee1efb3$exports = {};
$b983974c2ee1efb3$exports = {
  "dismiss": `Odstranit`
};
var $5809cc9d4e92de73$exports = {};
$5809cc9d4e92de73$exports = {
  "dismiss": `Luk`
};
var $c68c2e4fc74398d1$exports = {};
$c68c2e4fc74398d1$exports = {
  "dismiss": `Schließen`
};
var $0898b4c153db2b77$exports = {};
$0898b4c153db2b77$exports = {
  "dismiss": `Απόρριψη`
};
var $6d74810286a15183$exports = {};
$6d74810286a15183$exports = {
  "dismiss": `Dismiss`
};
var $309d73dc65f78055$exports = {};
$309d73dc65f78055$exports = {
  "dismiss": `Descartar`
};
var $44ad94f7205cf593$exports = {};
$44ad94f7205cf593$exports = {
  "dismiss": `Lõpeta`
};
var $7c28f5687f0779a9$exports = {};
$7c28f5687f0779a9$exports = {
  "dismiss": `Hylkää`
};
var $e6d75df4b68bd73a$exports = {};
$e6d75df4b68bd73a$exports = {
  "dismiss": `Rejeter`
};
var $87505c9dab186d0f$exports = {};
$87505c9dab186d0f$exports = {
  "dismiss": `התעלם`
};
var $553439c3ffb3e492$exports = {};
$553439c3ffb3e492$exports = {
  "dismiss": `Odbaci`
};
var $74cf411061b983a2$exports = {};
$74cf411061b983a2$exports = {
  "dismiss": `Elutasítás`
};
var $e933f298574dc435$exports = {};
$e933f298574dc435$exports = {
  "dismiss": `Ignora`
};
var $ac91fc9fe02f71f6$exports = {};
$ac91fc9fe02f71f6$exports = {
  "dismiss": `閉じる`
};
var $52b96f86422025af$exports = {};
$52b96f86422025af$exports = {
  "dismiss": `무시`
};
var $c0d724c3e51dafa6$exports = {};
$c0d724c3e51dafa6$exports = {
  "dismiss": `Atmesti`
};
var $c92899672a3fe72e$exports = {};
$c92899672a3fe72e$exports = {
  "dismiss": `Nerādīt`
};
var $9f576b39d8e7a9d6$exports = {};
$9f576b39d8e7a9d6$exports = {
  "dismiss": `Lukk`
};
var $9d025808aeec81a7$exports = {};
$9d025808aeec81a7$exports = {
  "dismiss": `Negeren`
};
var $fce709921e2c0fa6$exports = {};
$fce709921e2c0fa6$exports = {
  "dismiss": `Zignoruj`
};
var $2599cf0c4ab37f59$exports = {};
$2599cf0c4ab37f59$exports = {
  "dismiss": `Descartar`
};
var $3c220ae7ef8a35fd$exports = {};
$3c220ae7ef8a35fd$exports = {
  "dismiss": `Dispensar`
};
var $93562b5094072f54$exports = {};
$93562b5094072f54$exports = {
  "dismiss": `Revocare`
};
var $cd9e2abd0d06c7b4$exports = {};
$cd9e2abd0d06c7b4$exports = {
  "dismiss": `Пропустить`
};
var $45375701f409adf1$exports = {};
$45375701f409adf1$exports = {
  "dismiss": `Zrušiť`
};
var $27fab53a576de9dd$exports = {};
$27fab53a576de9dd$exports = {
  "dismiss": `Opusti`
};
var $4438748d9952e7c7$exports = {};
$4438748d9952e7c7$exports = {
  "dismiss": `Odbaci`
};
var $0936d7347ef4da4c$exports = {};
$0936d7347ef4da4c$exports = {
  "dismiss": `Avvisa`
};
var $29700c92185d38f8$exports = {};
$29700c92185d38f8$exports = {
  "dismiss": `Kapat`
};
var $662ccaf2be4c25b3$exports = {};
$662ccaf2be4c25b3$exports = {
  "dismiss": `Скасувати`
};
var $d80a27deda7cdb3c$exports = {};
$d80a27deda7cdb3c$exports = {
  "dismiss": `取消`
};
var $2b2734393847c884$exports = {};
$2b2734393847c884$exports = {
  "dismiss": `關閉`
};
var $a2f21f5f14f60553$exports = {};
$a2f21f5f14f60553$exports = {
  "ar-AE": $773d5888b972f1cf$exports,
  "bg-BG": $d11f19852b941573$exports,
  "cs-CZ": $b983974c2ee1efb3$exports,
  "da-DK": $5809cc9d4e92de73$exports,
  "de-DE": $c68c2e4fc74398d1$exports,
  "el-GR": $0898b4c153db2b77$exports,
  "en-US": $6d74810286a15183$exports,
  "es-ES": $309d73dc65f78055$exports,
  "et-EE": $44ad94f7205cf593$exports,
  "fi-FI": $7c28f5687f0779a9$exports,
  "fr-FR": $e6d75df4b68bd73a$exports,
  "he-IL": $87505c9dab186d0f$exports,
  "hr-HR": $553439c3ffb3e492$exports,
  "hu-HU": $74cf411061b983a2$exports,
  "it-IT": $e933f298574dc435$exports,
  "ja-JP": $ac91fc9fe02f71f6$exports,
  "ko-KR": $52b96f86422025af$exports,
  "lt-LT": $c0d724c3e51dafa6$exports,
  "lv-LV": $c92899672a3fe72e$exports,
  "nb-NO": $9f576b39d8e7a9d6$exports,
  "nl-NL": $9d025808aeec81a7$exports,
  "pl-PL": $fce709921e2c0fa6$exports,
  "pt-BR": $2599cf0c4ab37f59$exports,
  "pt-PT": $3c220ae7ef8a35fd$exports,
  "ro-RO": $93562b5094072f54$exports,
  "ru-RU": $cd9e2abd0d06c7b4$exports,
  "sk-SK": $45375701f409adf1$exports,
  "sl-SI": $27fab53a576de9dd$exports,
  "sr-SP": $4438748d9952e7c7$exports,
  "sv-SE": $0936d7347ef4da4c$exports,
  "tr-TR": $29700c92185d38f8$exports,
  "uk-UA": $662ccaf2be4c25b3$exports,
  "zh-CN": $d80a27deda7cdb3c$exports,
  "zh-TW": $2b2734393847c884$exports
};
const $5c3e21d68f1c4674$var$styles$1 = {
  border: 0,
  clip: "rect(0 0 0 0)",
  clipPath: "inset(50%)",
  height: "1px",
  margin: "-1px",
  overflow: "hidden",
  padding: 0,
  position: "absolute",
  width: "1px",
  whiteSpace: "nowrap"
};
function $5c3e21d68f1c4674$export$a966af930f325cab$1(props = {}) {
  let { style: style2, isFocusable } = props;
  let [isFocused, setFocused] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !isFocusable,
    onFocusWithinChange: (val) => setFocused(val)
  });
  let combinedStyles = reactExports.useMemo(() => {
    if (isFocused)
      return style2;
    else if (style2)
      return {
        ...$5c3e21d68f1c4674$var$styles$1,
        ...style2
      };
    else
      return $5c3e21d68f1c4674$var$styles$1;
  }, [
    isFocused
  ]);
  return {
    visuallyHiddenProps: {
      ...focusWithinProps,
      style: combinedStyles
    }
  };
}
function $5c3e21d68f1c4674$export$439d29a4e110a164$1(props) {
  let { children, elementType: Element2 = "div", isFocusable, style: style2, ...otherProps } = props;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab$1(props);
  return /* @__PURE__ */ React$6.createElement(Element2, $3ef42575df84b30b$export$9d1611c77c2fe928$9(otherProps, visuallyHiddenProps), children);
}
function $parcel$interopDefault$l(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $86ea4cb521eb2e37$export$2317d149ed6f78c4(props) {
  let { onDismiss, ...otherProps } = props;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$l($a2f21f5f14f60553$exports), "@react-aria/overlays");
  let labels = $313b98861ee5dd6c$export$d6875122194c7b44$1(otherProps, stringFormatter.format("dismiss"));
  let onClick = () => {
    if (onDismiss)
      onDismiss();
  };
  return /* @__PURE__ */ React$6.createElement($5c3e21d68f1c4674$export$439d29a4e110a164$1, null, /* @__PURE__ */ React$6.createElement("button", {
    ...labels,
    tabIndex: -1,
    onClick,
    style: {
      width: 1,
      height: 1
    }
  }));
}
let $5e3802645cc19319$var$refCountMap$1 = /* @__PURE__ */ new WeakMap();
let $5e3802645cc19319$var$observerStack$1 = [];
function $5e3802645cc19319$export$1c3ebcada18427bf$1(targets, root2 = document.body) {
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let walk = (root3) => {
    for (let element2 of root3.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
      visibleNodes.add(element2);
    let acceptNode = (node2) => {
      if (visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row")
        return NodeFilter.FILTER_REJECT;
      for (let target of visibleNodes) {
        if (node2.contains(target))
          return NodeFilter.FILTER_SKIP;
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root3, NodeFilter.SHOW_ELEMENT, {
      acceptNode
    });
    let acceptRoot = acceptNode(root3);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT)
      hide(root3);
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _refCountMap_get;
    let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap$1.get(node2)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
    if (node2.getAttribute("aria-hidden") === "true" && refCount === 0)
      return;
    if (refCount === 0)
      node2.setAttribute("aria-hidden", "true");
    hiddenNodes.add(node2);
    $5e3802645cc19319$var$refCountMap$1.set(node2, refCount + 1);
  };
  if ($5e3802645cc19319$var$observerStack$1.length)
    $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1].disconnect();
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList" || change.addedNodes.length === 0)
        continue;
      if (![
        ...visibleNodes,
        ...hiddenNodes
      ].some((node2) => node2.contains(change.target))) {
        for (let node2 of change.removedNodes)
          if (node2 instanceof Element) {
            visibleNodes.delete(node2);
            hiddenNodes.delete(node2);
          }
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true"))
            visibleNodes.add(node2);
          else if (node2 instanceof Element)
            walk(node2);
        }
      }
    }
  });
  observer.observe(root2, {
    childList: true,
    subtree: true
  });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, {
        childList: true,
        subtree: true
      });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  $5e3802645cc19319$var$observerStack$1.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = $5e3802645cc19319$var$refCountMap$1.get(node2);
      if (count == null)
        continue;
      if (count === 1) {
        node2.removeAttribute("aria-hidden");
        $5e3802645cc19319$var$refCountMap$1.delete(node2);
      } else
        $5e3802645cc19319$var$refCountMap$1.set(node2, count - 1);
    }
    if (observerWrapper === $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1]) {
      $5e3802645cc19319$var$observerStack$1.pop();
      if ($5e3802645cc19319$var$observerStack$1.length)
        $5e3802645cc19319$var$observerStack$1[$5e3802645cc19319$var$observerStack$1.length - 1].observe();
    } else
      $5e3802645cc19319$var$observerStack$1.splice($5e3802645cc19319$var$observerStack$1.indexOf(observerWrapper), 1);
  };
}
const $337b884510726a0d$export$a2200b96afd16271$1 = /* @__PURE__ */ React$6.createContext(null);
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$a();
  let { portalContainer = isSSR ? null : document.body, isExiting } = props;
  let [contain, setContain] = reactExports.useState(false);
  let contextValue = reactExports.useMemo(() => ({
    contain,
    setContain
  }), [
    contain,
    setContain
  ]);
  let { getContainer: getContainer2 } = $96b38030c423d352$export$9fc1347d4195ccb3();
  if (!props.portalContainer && getContainer2)
    portalContainer = getContainer2();
  if (!portalContainer)
    return null;
  let contents = props.children;
  if (!props.disableFocusManagement)
    contents = /* @__PURE__ */ React$6.createElement($9bf71ea28793e738$export$20e40289641fbbb6$1, {
      restoreFocus: true,
      contain: (props.shouldContainFocus || contain) && !isExiting
    }, contents);
  contents = /* @__PURE__ */ React$6.createElement($337b884510726a0d$export$a2200b96afd16271$1.Provider, {
    value: contextValue
  }, /* @__PURE__ */ React$6.createElement($f1ab8c75478c6f73$export$cf75428e0b9ed1ea, null, contents));
  return /* @__PURE__ */ ReactDOM.createPortal(contents, portalContainer);
}
function $337b884510726a0d$export$14c98a7594375490$1() {
  let ctx = reactExports.useContext($337b884510726a0d$export$a2200b96afd16271$1);
  let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    setContain === null || setContain === void 0 ? void 0 : setContain(true);
  }, [
    setContain
  ]);
}
var HeroUIProvider = ({
  children,
  navigate,
  disableAnimation,
  useHref: useHref2,
  disableRipple = false,
  skipFramerMotionAnimations = disableAnimation,
  reducedMotion = "never",
  validationBehavior,
  locale: locale2 = "en-US",
  labelPlacement,
  // if minDate / maxDate are not specified in `defaultDates`
  // then they will be set in `use-date-input.ts` or `use-calendar-base.ts`
  defaultDates,
  createCalendar,
  spinnerVariant,
  ...otherProps
}) => {
  let contents = children;
  if (navigate) {
    contents = /* @__PURE__ */ jsxRuntimeExports.jsx($ea8dcbcb9ea1b556$export$323e4fc2fa4753fb, { navigate, useHref: useHref2, children: contents });
  }
  const context = reactExports.useMemo(() => {
    if (disableAnimation && skipFramerMotionAnimations) {
      MotionGlobalConfig.skipAnimations = true;
    }
    return {
      createCalendar,
      defaultDates,
      disableAnimation,
      disableRipple,
      validationBehavior,
      labelPlacement,
      spinnerVariant
    };
  }, [
    createCalendar,
    defaultDates == null ? void 0 : defaultDates.maxDate,
    defaultDates == null ? void 0 : defaultDates.minDate,
    disableAnimation,
    disableRipple,
    validationBehavior,
    labelPlacement,
    spinnerVariant
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ProviderContext, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx($18f2051aff69b9bf$export$a54013f0d02a8f82, { locale: locale2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MotionConfig, { reducedMotion, children: /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$bf688221f59024e5, { ...otherProps, children: contents }) }) }) });
};
function useLabelPlacement(props) {
  const globalContext = useProviderContext();
  const globalLabelPlacement = globalContext == null ? void 0 : globalContext.labelPlacement;
  return reactExports.useMemo(() => {
    var _a2, _b2;
    const labelPlacement = (_b2 = (_a2 = props.labelPlacement) != null ? _a2 : globalLabelPlacement) != null ? _b2 : "inside";
    if (labelPlacement === "inside" && !props.label) {
      return "outside";
    }
    return labelPlacement;
  }, [props.labelPlacement, globalLabelPlacement, props.label]);
}
function useInputLabelPlacement(props) {
  const globalContext = useProviderContext();
  const globalLabelPlacement = globalContext == null ? void 0 : globalContext.labelPlacement;
  return reactExports.useMemo(() => {
    var _a2, _b2;
    const labelPlacement = (_b2 = (_a2 = props.labelPlacement) != null ? _a2 : globalLabelPlacement) != null ? _b2 : "inside";
    if (labelPlacement === "inside" && !props.label) {
      return "outside";
    }
    return labelPlacement;
  }, [props.labelPlacement, globalLabelPlacement, props.label]);
}
function forwardRef(component) {
  return reactExports.forwardRef(component);
}
var mapPropsVariants = (props, variantKeys, removeVariantProps = true) => {
  if (!variantKeys) {
    return [props, {}];
  }
  const picked = variantKeys.reduce((acc, key) => {
    if (key in props) {
      return { ...acc, [key]: props[key] };
    } else {
      return acc;
    }
  }, {});
  if (removeVariantProps) {
    const omitted = Object.keys(props).filter((key) => !variantKeys.includes(key)).reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
    return [omitted, picked];
  } else {
    return [props, picked];
  }
};
var solid = {
  default: "bg-default text-default-foreground",
  primary: "bg-primary text-primary-foreground",
  secondary: "bg-secondary text-secondary-foreground",
  success: "bg-success text-success-foreground",
  warning: "bg-warning text-warning-foreground",
  danger: "bg-danger text-danger-foreground",
  foreground: "bg-foreground text-background"
};
var shadow = {
  default: "shadow-lg shadow-default/50 bg-default text-default-foreground",
  primary: "shadow-lg shadow-primary/40 bg-primary text-primary-foreground",
  secondary: "shadow-lg shadow-secondary/40 bg-secondary text-secondary-foreground",
  success: "shadow-lg shadow-success/40 bg-success text-success-foreground",
  warning: "shadow-lg shadow-warning/40 bg-warning text-warning-foreground",
  danger: "shadow-lg shadow-danger/40 bg-danger text-danger-foreground"
};
var bordered = {
  default: "bg-transparent border-default text-foreground",
  primary: "bg-transparent border-primary text-primary",
  secondary: "bg-transparent border-secondary text-secondary",
  success: "bg-transparent border-success text-success",
  warning: "bg-transparent border-warning text-warning",
  danger: "bg-transparent border-danger text-danger"
};
var flat = {
  default: "bg-default/40 text-default-700",
  primary: "bg-primary/20 text-primary-600",
  secondary: "bg-secondary/20 text-secondary-600",
  success: "bg-success/20 text-success-700 dark:text-success",
  warning: "bg-warning/20 text-warning-700 dark:text-warning",
  danger: "bg-danger/20 text-danger-600 dark:text-danger-500"
};
var faded = {
  default: "border-default bg-default-100 text-default-foreground",
  primary: "border-default bg-default-100 text-primary",
  secondary: "border-default bg-default-100 text-secondary",
  success: "border-default bg-default-100 text-success",
  warning: "border-default bg-default-100 text-warning",
  danger: "border-default bg-default-100 text-danger"
};
var light = {
  default: "bg-transparent text-default-foreground",
  primary: "bg-transparent text-primary",
  secondary: "bg-transparent text-secondary",
  success: "bg-transparent text-success",
  warning: "bg-transparent text-warning",
  danger: "bg-transparent text-danger"
};
var ghost = {
  default: "border-default text-default-foreground",
  primary: "border-primary text-primary",
  secondary: "border-secondary text-secondary",
  success: "border-success text-success",
  warning: "border-warning text-warning",
  danger: "border-danger text-danger"
};
var colorVariants = {
  solid,
  shadow,
  bordered,
  flat,
  faded,
  light,
  ghost
};
var animation_default = {
  /** Animation Utilities */
  ".spinner-bar-animation": {
    "animation-delay": "calc(-1.2s + (0.1s * var(--bar-index)))",
    transform: "rotate(calc(30deg * var(--bar-index)))translate(140%)"
  },
  ".spinner-dot-animation": {
    "animation-delay": "calc(250ms * var(--dot-index))"
  },
  ".spinner-dot-blink-animation": {
    "animation-delay": "calc(200ms * var(--dot-index))"
  }
};
var custom_default = {
  /**
   * Custom utilities
   */
  ".leading-inherit": {
    "line-height": "inherit"
  },
  ".bg-img-inherit": {
    "background-image": "inherit"
  },
  ".bg-clip-inherit": {
    "background-clip": "inherit"
  },
  ".text-fill-inherit": {
    "-webkit-text-fill-color": "inherit"
  },
  ".tap-highlight-transparent": {
    "-webkit-tap-highlight-color": "transparent"
  },
  ".input-search-cancel-button-none": {
    "&::-webkit-search-cancel-button": {
      "-webkit-appearance": "none"
    }
  }
};
var scrollbar_hide_default = {
  /**
   * Scroll Hide
   */
  ".scrollbar-hide": {
    /* IE and Edge */
    "-ms-overflow-style": "none",
    /* Firefox */
    "scrollbar-width": "none",
    /* Safari and Chrome */
    "&::-webkit-scrollbar": {
      display: "none"
    }
  },
  ".scrollbar-default": {
    /* IE and Edge */
    "-ms-overflow-style": "auto",
    /* Firefox */
    "scrollbar-width": "auto",
    /* Safari and Chrome */
    "&::-webkit-scrollbar": {
      display: "block"
    }
  }
};
var text_default = {
  /**
   * Text utilities
   */
  ".text-tiny": {
    "font-size": "var(--heroui-font-size-tiny)",
    "line-height": "var(--heroui-line-height-tiny)"
  },
  ".text-small": {
    "font-size": "var(--heroui-font-size-small)",
    "line-height": "var(--heroui-line-height-small)"
  },
  ".text-medium": {
    "font-size": "var(--heroui-font-size-medium)",
    "line-height": "var(--heroui-line-height-medium)"
  },
  ".text-large": {
    "font-size": "var(--heroui-font-size-large)",
    "line-height": "var(--heroui-line-height-large)"
  }
};
var DEFAULT_TRANSITION_DURATION = "250ms";
var transition_default = {
  /**
   * Transition utilities
   */
  ".transition-background": {
    "transition-property": "background",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-colors-opacity": {
    "transition-property": "color, background-color, border-color, text-decoration-color, fill, stroke, opacity",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-width": {
    "transition-property": "width",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-height": {
    "transition-property": "height",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-size": {
    "transition-property": "width, height",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-left": {
    "transition-property": "left",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-opacity": {
    "transition-property": "transform, scale, opacity rotate",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-background": {
    "transition-property": "transform, scale, background",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-colors": {
    "transition-property": "transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  },
  ".transition-transform-colors-opacity": {
    "transition-property": "transform, scale, color, background, background-color, border-color, text-decoration-color, fill, stroke, opacity",
    "transition-timing-function": "ease",
    "transition-duration": DEFAULT_TRANSITION_DURATION
  }
};
var utilities$1 = {
  ...custom_default,
  ...transition_default,
  ...scrollbar_hide_default,
  ...text_default,
  ...animation_default
};
var COMMON_UNITS = ["small", "medium", "large"];
var twMergeConfig = {
  theme: {
    spacing: ["divider"],
    radius: COMMON_UNITS
  },
  classGroups: {
    shadow: [{ shadow: COMMON_UNITS }],
    opacity: [{ opacity: ["disabled"] }],
    "font-size": [{ text: ["tiny", ...COMMON_UNITS] }],
    "border-w": [{ border: COMMON_UNITS }],
    "bg-image": [
      "bg-stripe-gradient-default",
      "bg-stripe-gradient-primary",
      "bg-stripe-gradient-secondary",
      "bg-stripe-gradient-success",
      "bg-stripe-gradient-warning",
      "bg-stripe-gradient-danger"
    ],
    transition: Object.keys(utilities$1).filter((key) => key.includes(".transition")).map((key) => key.replace(".", ""))
    // remove the dot from the key, .transition-background -> transition-background
  }
};
var l$8 = (e2) => typeof e2 == "boolean" ? `${e2}` : e2 === 0 ? "0" : e2, u$6 = (e2) => !e2 || typeof e2 != "object" || Object.keys(e2).length === 0, x$6 = (e2, o2) => JSON.stringify(e2) === JSON.stringify(o2);
function i$3(e2, o2) {
  e2.forEach(function(r2) {
    Array.isArray(r2) ? i$3(r2, o2) : o2.push(r2);
  });
}
function y$5(e2) {
  let o2 = [];
  return i$3(e2, o2), o2;
}
var a$3 = (...e2) => y$5(e2).filter(Boolean), p$6 = (e2, o2) => {
  let r2 = {}, c2 = Object.keys(e2), f2 = Object.keys(o2);
  for (let t2 of c2)
    if (f2.includes(t2)) {
      let s2 = e2[t2], n2 = o2[t2];
      Array.isArray(s2) || Array.isArray(n2) ? r2[t2] = a$3(n2, s2) : typeof s2 == "object" && typeof n2 == "object" ? r2[t2] = p$6(s2, n2) : r2[t2] = n2 + " " + s2;
    } else
      r2[t2] = e2[t2];
  for (let t2 of f2)
    c2.includes(t2) || (r2[t2] = o2[t2]);
  return r2;
}, g$4 = (e2) => !e2 || typeof e2 != "string" ? e2 : e2.replace(/\s+/g, " ").trim();
const CLASS_PART_SEPARATOR = "-";
const createClassGroupUtils = (config2) => {
  const classMap = createClassMap(config2);
  const {
    conflictingClassGroups,
    conflictingClassGroupModifiers
  } = config2;
  const getClassGroupId = (className) => {
    const classParts = className.split(CLASS_PART_SEPARATOR);
    if (classParts[0] === "" && classParts.length !== 1) {
      classParts.shift();
    }
    return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
  };
  const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
    const conflicts = conflictingClassGroups[classGroupId] || [];
    if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
      return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]];
    }
    return conflicts;
  };
  return {
    getClassGroupId,
    getConflictingClassGroupIds
  };
};
const getGroupRecursive = (classParts, classPartObject) => {
  var _a2;
  if (classParts.length === 0) {
    return classPartObject.classGroupId;
  }
  const currentClassPart = classParts[0];
  const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
  const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : void 0;
  if (classGroupFromNextClassPart) {
    return classGroupFromNextClassPart;
  }
  if (classPartObject.validators.length === 0) {
    return void 0;
  }
  const classRest = classParts.join(CLASS_PART_SEPARATOR);
  return (_a2 = classPartObject.validators.find(({
    validator: validator2
  }) => validator2(classRest))) == null ? void 0 : _a2.classGroupId;
};
const arbitraryPropertyRegex = /^\[(.+)\]$/;
const getGroupIdForArbitraryProperty = (className) => {
  if (arbitraryPropertyRegex.test(className)) {
    const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
    const property2 = arbitraryPropertyClassName == null ? void 0 : arbitraryPropertyClassName.substring(0, arbitraryPropertyClassName.indexOf(":"));
    if (property2) {
      return "arbitrary.." + property2;
    }
  }
};
const createClassMap = (config2) => {
  const {
    theme: theme2,
    classGroups
  } = config2;
  const classMap = {
    nextPart: /* @__PURE__ */ new Map(),
    validators: []
  };
  for (const classGroupId in classGroups) {
    processClassesRecursively(classGroups[classGroupId], classMap, classGroupId, theme2);
  }
  return classMap;
};
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme2) => {
  classGroup.forEach((classDefinition) => {
    if (typeof classDefinition === "string") {
      const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
      classPartObjectToEdit.classGroupId = classGroupId;
      return;
    }
    if (typeof classDefinition === "function") {
      if (isThemeGetter(classDefinition)) {
        processClassesRecursively(classDefinition(theme2), classPartObject, classGroupId, theme2);
        return;
      }
      classPartObject.validators.push({
        validator: classDefinition,
        classGroupId
      });
      return;
    }
    Object.entries(classDefinition).forEach(([key, classGroup2]) => {
      processClassesRecursively(classGroup2, getPart(classPartObject, key), classGroupId, theme2);
    });
  });
};
const getPart = (classPartObject, path) => {
  let currentClassPartObject = classPartObject;
  path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
    if (!currentClassPartObject.nextPart.has(pathPart)) {
      currentClassPartObject.nextPart.set(pathPart, {
        nextPart: /* @__PURE__ */ new Map(),
        validators: []
      });
    }
    currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
  });
  return currentClassPartObject;
};
const isThemeGetter = (func) => func.isThemeGetter;
const createLruCache = (maxCacheSize) => {
  if (maxCacheSize < 1) {
    return {
      get: () => void 0,
      set: () => {
      }
    };
  }
  let cacheSize = 0;
  let cache2 = /* @__PURE__ */ new Map();
  let previousCache = /* @__PURE__ */ new Map();
  const update = (key, value2) => {
    cache2.set(key, value2);
    cacheSize++;
    if (cacheSize > maxCacheSize) {
      cacheSize = 0;
      previousCache = cache2;
      cache2 = /* @__PURE__ */ new Map();
    }
  };
  return {
    get(key) {
      let value2 = cache2.get(key);
      if (value2 !== void 0) {
        return value2;
      }
      if ((value2 = previousCache.get(key)) !== void 0) {
        update(key, value2);
        return value2;
      }
    },
    set(key, value2) {
      if (cache2.has(key)) {
        cache2.set(key, value2);
      } else {
        update(key, value2);
      }
    }
  };
};
const IMPORTANT_MODIFIER = "!";
const MODIFIER_SEPARATOR = ":";
const MODIFIER_SEPARATOR_LENGTH = MODIFIER_SEPARATOR.length;
const createParseClassName = (config2) => {
  const {
    prefix,
    experimentalParseClassName
  } = config2;
  let parseClassName = (className) => {
    const modifiers = [];
    let bracketDepth = 0;
    let parenDepth = 0;
    let modifierStart = 0;
    let postfixModifierPosition;
    for (let index2 = 0; index2 < className.length; index2++) {
      let currentCharacter = className[index2];
      if (bracketDepth === 0 && parenDepth === 0) {
        if (currentCharacter === MODIFIER_SEPARATOR) {
          modifiers.push(className.slice(modifierStart, index2));
          modifierStart = index2 + MODIFIER_SEPARATOR_LENGTH;
          continue;
        }
        if (currentCharacter === "/") {
          postfixModifierPosition = index2;
          continue;
        }
      }
      if (currentCharacter === "[") {
        bracketDepth++;
      } else if (currentCharacter === "]") {
        bracketDepth--;
      } else if (currentCharacter === "(") {
        parenDepth++;
      } else if (currentCharacter === ")") {
        parenDepth--;
      }
    }
    const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
    const baseClassName2 = stripImportantModifier(baseClassNameWithImportantModifier);
    const hasImportantModifier = baseClassName2 !== baseClassNameWithImportantModifier;
    const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
    return {
      modifiers,
      hasImportantModifier,
      baseClassName: baseClassName2,
      maybePostfixModifierPosition
    };
  };
  if (prefix) {
    const fullPrefix = prefix + MODIFIER_SEPARATOR;
    const parseClassNameOriginal = parseClassName;
    parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.substring(fullPrefix.length)) : {
      isExternal: true,
      modifiers: [],
      hasImportantModifier: false,
      baseClassName: className,
      maybePostfixModifierPosition: void 0
    };
  }
  if (experimentalParseClassName) {
    const parseClassNameOriginal = parseClassName;
    parseClassName = (className) => experimentalParseClassName({
      className,
      parseClassName: parseClassNameOriginal
    });
  }
  return parseClassName;
};
const stripImportantModifier = (baseClassName2) => {
  if (baseClassName2.endsWith(IMPORTANT_MODIFIER)) {
    return baseClassName2.substring(0, baseClassName2.length - 1);
  }
  if (baseClassName2.startsWith(IMPORTANT_MODIFIER)) {
    return baseClassName2.substring(1);
  }
  return baseClassName2;
};
const createSortModifiers = (config2) => {
  const orderSensitiveModifiers = Object.fromEntries(config2.orderSensitiveModifiers.map((modifier) => [modifier, true]));
  const sortModifiers = (modifiers) => {
    if (modifiers.length <= 1) {
      return modifiers;
    }
    const sortedModifiers = [];
    let unsortedModifiers = [];
    modifiers.forEach((modifier) => {
      const isPositionSensitive = modifier[0] === "[" || orderSensitiveModifiers[modifier];
      if (isPositionSensitive) {
        sortedModifiers.push(...unsortedModifiers.sort(), modifier);
        unsortedModifiers = [];
      } else {
        unsortedModifiers.push(modifier);
      }
    });
    sortedModifiers.push(...unsortedModifiers.sort());
    return sortedModifiers;
  };
  return sortModifiers;
};
const createConfigUtils = (config2) => ({
  cache: createLruCache(config2.cacheSize),
  parseClassName: createParseClassName(config2),
  sortModifiers: createSortModifiers(config2),
  ...createClassGroupUtils(config2)
});
const SPLIT_CLASSES_REGEX = /\s+/;
const mergeClassList = (classList, configUtils) => {
  const {
    parseClassName,
    getClassGroupId,
    getConflictingClassGroupIds,
    sortModifiers
  } = configUtils;
  const classGroupsInConflict = [];
  const classNames2 = classList.trim().split(SPLIT_CLASSES_REGEX);
  let result = "";
  for (let index2 = classNames2.length - 1; index2 >= 0; index2 -= 1) {
    const originalClassName = classNames2[index2];
    const {
      isExternal,
      modifiers,
      hasImportantModifier,
      baseClassName: baseClassName2,
      maybePostfixModifierPosition
    } = parseClassName(originalClassName);
    if (isExternal) {
      result = originalClassName + (result.length > 0 ? " " + result : result);
      continue;
    }
    let hasPostfixModifier = !!maybePostfixModifierPosition;
    let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName2.substring(0, maybePostfixModifierPosition) : baseClassName2);
    if (!classGroupId) {
      if (!hasPostfixModifier) {
        result = originalClassName + (result.length > 0 ? " " + result : result);
        continue;
      }
      classGroupId = getClassGroupId(baseClassName2);
      if (!classGroupId) {
        result = originalClassName + (result.length > 0 ? " " + result : result);
        continue;
      }
      hasPostfixModifier = false;
    }
    const variantModifier = sortModifiers(modifiers).join(":");
    const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
    const classId = modifierId + classGroupId;
    if (classGroupsInConflict.includes(classId)) {
      continue;
    }
    classGroupsInConflict.push(classId);
    const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
    for (let i2 = 0; i2 < conflictGroups.length; ++i2) {
      const group = conflictGroups[i2];
      classGroupsInConflict.push(modifierId + group);
    }
    result = originalClassName + (result.length > 0 ? " " + result : result);
  }
  return result;
};
function twJoin() {
  let index2 = 0;
  let argument;
  let resolvedValue;
  let string3 = "";
  while (index2 < arguments.length) {
    if (argument = arguments[index2++]) {
      if (resolvedValue = toValue(argument)) {
        string3 && (string3 += " ");
        string3 += resolvedValue;
      }
    }
  }
  return string3;
}
const toValue = (mix2) => {
  if (typeof mix2 === "string") {
    return mix2;
  }
  let resolvedValue;
  let string3 = "";
  for (let k2 = 0; k2 < mix2.length; k2++) {
    if (mix2[k2]) {
      if (resolvedValue = toValue(mix2[k2])) {
        string3 && (string3 += " ");
        string3 += resolvedValue;
      }
    }
  }
  return string3;
};
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
  let configUtils;
  let cacheGet;
  let cacheSet;
  let functionToCall = initTailwindMerge;
  function initTailwindMerge(classList) {
    const config2 = createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst());
    configUtils = createConfigUtils(config2);
    cacheGet = configUtils.cache.get;
    cacheSet = configUtils.cache.set;
    functionToCall = tailwindMerge;
    return tailwindMerge(classList);
  }
  function tailwindMerge(classList) {
    const cachedResult = cacheGet(classList);
    if (cachedResult) {
      return cachedResult;
    }
    const result = mergeClassList(classList, configUtils);
    cacheSet(classList, result);
    return result;
  }
  return function callTailwindMerge() {
    return functionToCall(twJoin.apply(null, arguments));
  };
}
const fromTheme = (key) => {
  const themeGetter = (theme2) => theme2[key] || [];
  themeGetter.isThemeGetter = true;
  return themeGetter;
};
const arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
const arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
const fractionRegex = /^\d+\/\d+$/;
const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
const isFraction = (value2) => fractionRegex.test(value2);
const isNumber$3 = (value2) => Boolean(value2) && !Number.isNaN(Number(value2));
const isInteger = (value2) => Boolean(value2) && Number.isInteger(Number(value2));
const isPercent = (value2) => value2.endsWith("%") && isNumber$3(value2.slice(0, -1));
const isTshirtSize = (value2) => tshirtUnitRegex.test(value2);
const isAny = () => true;
const isLengthOnly = (value2) => (
  // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
  lengthUnitRegex.test(value2) && !colorFunctionRegex.test(value2)
);
const isNever = () => false;
const isShadow = (value2) => shadowRegex.test(value2);
const isImage = (value2) => imageRegex.test(value2);
const isAnyNonArbitrary = (value2) => !isArbitraryValue(value2) && !isArbitraryVariable(value2);
const isArbitrarySize = (value2) => getIsArbitraryValue(value2, isLabelSize, isNever);
const isArbitraryValue = (value2) => arbitraryValueRegex.test(value2);
const isArbitraryLength = (value2) => getIsArbitraryValue(value2, isLabelLength, isLengthOnly);
const isArbitraryNumber = (value2) => getIsArbitraryValue(value2, isLabelNumber, isNumber$3);
const isArbitraryPosition = (value2) => getIsArbitraryValue(value2, isLabelPosition, isNever);
const isArbitraryImage = (value2) => getIsArbitraryValue(value2, isLabelImage, isImage);
const isArbitraryShadow = (value2) => getIsArbitraryValue(value2, isNever, isShadow);
const isArbitraryVariable = (value2) => arbitraryVariableRegex.test(value2);
const isArbitraryVariableLength = (value2) => getIsArbitraryVariable(value2, isLabelLength);
const isArbitraryVariableFamilyName = (value2) => getIsArbitraryVariable(value2, isLabelFamilyName);
const isArbitraryVariablePosition = (value2) => getIsArbitraryVariable(value2, isLabelPosition);
const isArbitraryVariableSize = (value2) => getIsArbitraryVariable(value2, isLabelSize);
const isArbitraryVariableImage = (value2) => getIsArbitraryVariable(value2, isLabelImage);
const isArbitraryVariableShadow = (value2) => getIsArbitraryVariable(value2, isLabelShadow, true);
const getIsArbitraryValue = (value2, testLabel, testValue) => {
  const result = arbitraryValueRegex.exec(value2);
  if (result) {
    if (result[1]) {
      return testLabel(result[1]);
    }
    return testValue(result[2]);
  }
  return false;
};
const getIsArbitraryVariable = (value2, testLabel, shouldMatchNoLabel = false) => {
  const result = arbitraryVariableRegex.exec(value2);
  if (result) {
    if (result[1]) {
      return testLabel(result[1]);
    }
    return shouldMatchNoLabel;
  }
  return false;
};
const isLabelPosition = (label) => label === "position";
const imageLabels = /* @__PURE__ */ new Set(["image", "url"]);
const isLabelImage = (label) => imageLabels.has(label);
const sizeLabels = /* @__PURE__ */ new Set(["length", "size", "percentage"]);
const isLabelSize = (label) => sizeLabels.has(label);
const isLabelLength = (label) => label === "length";
const isLabelNumber = (label) => label === "number";
const isLabelFamilyName = (label) => label === "family-name";
const isLabelShadow = (label) => label === "shadow";
const getDefaultConfig = () => {
  const themeColor = fromTheme("color");
  const themeFont = fromTheme("font");
  const themeText = fromTheme("text");
  const themeFontWeight = fromTheme("font-weight");
  const themeTracking = fromTheme("tracking");
  const themeLeading = fromTheme("leading");
  const themeBreakpoint = fromTheme("breakpoint");
  const themeContainer = fromTheme("container");
  const themeSpacing = fromTheme("spacing");
  const themeRadius = fromTheme("radius");
  const themeShadow = fromTheme("shadow");
  const themeInsetShadow = fromTheme("inset-shadow");
  const themeDropShadow = fromTheme("drop-shadow");
  const themeBlur = fromTheme("blur");
  const themePerspective = fromTheme("perspective");
  const themeAspect = fromTheme("aspect");
  const themeEase = fromTheme("ease");
  const themeAnimate = fromTheme("animate");
  const scaleBreak = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"];
  const scalePosition = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"];
  const scaleOverflow = () => ["auto", "hidden", "clip", "visible", "scroll"];
  const scaleOverscroll = () => ["auto", "contain", "none"];
  const scaleUnambiguousSpacing = () => [isArbitraryVariable, isArbitraryValue, themeSpacing];
  const scaleInset = () => [isFraction, "full", "auto", ...scaleUnambiguousSpacing()];
  const scaleGridTemplateColsRows = () => [isInteger, "none", "subgrid", isArbitraryVariable, isArbitraryValue];
  const scaleGridColRowStartAndEnd = () => ["auto", {
    span: ["full", isInteger, isArbitraryVariable, isArbitraryValue]
  }, isArbitraryVariable, isArbitraryValue];
  const scaleGridColRowStartOrEnd = () => [isInteger, "auto", isArbitraryVariable, isArbitraryValue];
  const scaleGridAutoColsRows = () => ["auto", "min", "max", "fr", isArbitraryVariable, isArbitraryValue];
  const scaleAlignPrimaryAxis = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline"];
  const scaleAlignSecondaryAxis = () => ["start", "end", "center", "stretch"];
  const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
  const scaleSizing = () => [isFraction, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...scaleUnambiguousSpacing()];
  const scaleColor = () => [themeColor, isArbitraryVariable, isArbitraryValue];
  const scaleGradientStopPosition = () => [isPercent, isArbitraryLength];
  const scaleRadius = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    "full",
    themeRadius,
    isArbitraryVariable,
    isArbitraryValue
  ];
  const scaleBorderWidth = () => ["", isNumber$3, isArbitraryVariableLength, isArbitraryLength];
  const scaleLineStyle = () => ["solid", "dashed", "dotted", "double"];
  const scaleBlendMode = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
  const scaleBlur = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    themeBlur,
    isArbitraryVariable,
    isArbitraryValue
  ];
  const scaleOrigin = () => ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", isArbitraryVariable, isArbitraryValue];
  const scaleRotate = () => ["none", isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleScale = () => ["none", isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleSkew = () => [isNumber$3, isArbitraryVariable, isArbitraryValue];
  const scaleTranslate = () => [isFraction, "full", ...scaleUnambiguousSpacing()];
  return {
    cacheSize: 500,
    theme: {
      animate: ["spin", "ping", "pulse", "bounce"],
      aspect: ["video"],
      blur: [isTshirtSize],
      breakpoint: [isTshirtSize],
      color: [isAny],
      container: [isTshirtSize],
      "drop-shadow": [isTshirtSize],
      ease: ["in", "out", "in-out"],
      font: [isAnyNonArbitrary],
      "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
      "inset-shadow": [isTshirtSize],
      leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
      perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
      radius: [isTshirtSize],
      shadow: [isTshirtSize],
      spacing: ["px", isNumber$3],
      text: [isTshirtSize],
      tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
    },
    classGroups: {
      // --------------
      // --- Layout ---
      // --------------
      /**
       * Aspect Ratio
       * @see https://tailwindcss.com/docs/aspect-ratio
       */
      aspect: [{
        aspect: ["auto", "square", isFraction, isArbitraryValue, isArbitraryVariable, themeAspect]
      }],
      /**
       * Container
       * @see https://tailwindcss.com/docs/container
       * @deprecated since Tailwind CSS v4.0.0
       */
      container: ["container"],
      /**
       * Columns
       * @see https://tailwindcss.com/docs/columns
       */
      columns: [{
        columns: [isNumber$3, isArbitraryValue, isArbitraryVariable, themeContainer]
      }],
      /**
       * Break After
       * @see https://tailwindcss.com/docs/break-after
       */
      "break-after": [{
        "break-after": scaleBreak()
      }],
      /**
       * Break Before
       * @see https://tailwindcss.com/docs/break-before
       */
      "break-before": [{
        "break-before": scaleBreak()
      }],
      /**
       * Break Inside
       * @see https://tailwindcss.com/docs/break-inside
       */
      "break-inside": [{
        "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
      }],
      /**
       * Box Decoration Break
       * @see https://tailwindcss.com/docs/box-decoration-break
       */
      "box-decoration": [{
        "box-decoration": ["slice", "clone"]
      }],
      /**
       * Box Sizing
       * @see https://tailwindcss.com/docs/box-sizing
       */
      box: [{
        box: ["border", "content"]
      }],
      /**
       * Display
       * @see https://tailwindcss.com/docs/display
       */
      display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
      /**
       * Screen Reader Only
       * @see https://tailwindcss.com/docs/display#screen-reader-only
       */
      sr: ["sr-only", "not-sr-only"],
      /**
       * Floats
       * @see https://tailwindcss.com/docs/float
       */
      float: [{
        float: ["right", "left", "none", "start", "end"]
      }],
      /**
       * Clear
       * @see https://tailwindcss.com/docs/clear
       */
      clear: [{
        clear: ["left", "right", "both", "none", "start", "end"]
      }],
      /**
       * Isolation
       * @see https://tailwindcss.com/docs/isolation
       */
      isolation: ["isolate", "isolation-auto"],
      /**
       * Object Fit
       * @see https://tailwindcss.com/docs/object-fit
       */
      "object-fit": [{
        object: ["contain", "cover", "fill", "none", "scale-down"]
      }],
      /**
       * Object Position
       * @see https://tailwindcss.com/docs/object-position
       */
      "object-position": [{
        object: [...scalePosition(), isArbitraryValue, isArbitraryVariable]
      }],
      /**
       * Overflow
       * @see https://tailwindcss.com/docs/overflow
       */
      overflow: [{
        overflow: scaleOverflow()
      }],
      /**
       * Overflow X
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-x": [{
        "overflow-x": scaleOverflow()
      }],
      /**
       * Overflow Y
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-y": [{
        "overflow-y": scaleOverflow()
      }],
      /**
       * Overscroll Behavior
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      overscroll: [{
        overscroll: scaleOverscroll()
      }],
      /**
       * Overscroll Behavior X
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-x": [{
        "overscroll-x": scaleOverscroll()
      }],
      /**
       * Overscroll Behavior Y
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-y": [{
        "overscroll-y": scaleOverscroll()
      }],
      /**
       * Position
       * @see https://tailwindcss.com/docs/position
       */
      position: ["static", "fixed", "absolute", "relative", "sticky"],
      /**
       * Top / Right / Bottom / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      inset: [{
        inset: scaleInset()
      }],
      /**
       * Right / Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-x": [{
        "inset-x": scaleInset()
      }],
      /**
       * Top / Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-y": [{
        "inset-y": scaleInset()
      }],
      /**
       * Start
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      start: [{
        start: scaleInset()
      }],
      /**
       * End
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      end: [{
        end: scaleInset()
      }],
      /**
       * Top
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      top: [{
        top: scaleInset()
      }],
      /**
       * Right
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      right: [{
        right: scaleInset()
      }],
      /**
       * Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      bottom: [{
        bottom: scaleInset()
      }],
      /**
       * Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      left: [{
        left: scaleInset()
      }],
      /**
       * Visibility
       * @see https://tailwindcss.com/docs/visibility
       */
      visibility: ["visible", "invisible", "collapse"],
      /**
       * Z-Index
       * @see https://tailwindcss.com/docs/z-index
       */
      z: [{
        z: [isInteger, "auto", isArbitraryVariable, isArbitraryValue]
      }],
      // ------------------------
      // --- Flexbox and Grid ---
      // ------------------------
      /**
       * Flex Basis
       * @see https://tailwindcss.com/docs/flex-basis
       */
      basis: [{
        basis: [isFraction, "full", "auto", themeContainer, ...scaleUnambiguousSpacing()]
      }],
      /**
       * Flex Direction
       * @see https://tailwindcss.com/docs/flex-direction
       */
      "flex-direction": [{
        flex: ["row", "row-reverse", "col", "col-reverse"]
      }],
      /**
       * Flex Wrap
       * @see https://tailwindcss.com/docs/flex-wrap
       */
      "flex-wrap": [{
        flex: ["nowrap", "wrap", "wrap-reverse"]
      }],
      /**
       * Flex
       * @see https://tailwindcss.com/docs/flex
       */
      flex: [{
        flex: [isNumber$3, isFraction, "auto", "initial", "none", isArbitraryValue]
      }],
      /**
       * Flex Grow
       * @see https://tailwindcss.com/docs/flex-grow
       */
      grow: [{
        grow: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Flex Shrink
       * @see https://tailwindcss.com/docs/flex-shrink
       */
      shrink: [{
        shrink: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Order
       * @see https://tailwindcss.com/docs/order
       */
      order: [{
        order: [isInteger, "first", "last", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Grid Template Columns
       * @see https://tailwindcss.com/docs/grid-template-columns
       */
      "grid-cols": [{
        "grid-cols": scaleGridTemplateColsRows()
      }],
      /**
       * Grid Column Start / End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start-end": [{
        col: scaleGridColRowStartAndEnd()
      }],
      /**
       * Grid Column Start
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start": [{
        "col-start": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Column End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-end": [{
        "col-end": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Template Rows
       * @see https://tailwindcss.com/docs/grid-template-rows
       */
      "grid-rows": [{
        "grid-rows": scaleGridTemplateColsRows()
      }],
      /**
       * Grid Row Start / End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start-end": [{
        row: scaleGridColRowStartAndEnd()
      }],
      /**
       * Grid Row Start
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start": [{
        "row-start": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Row End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-end": [{
        "row-end": scaleGridColRowStartOrEnd()
      }],
      /**
       * Grid Auto Flow
       * @see https://tailwindcss.com/docs/grid-auto-flow
       */
      "grid-flow": [{
        "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
      }],
      /**
       * Grid Auto Columns
       * @see https://tailwindcss.com/docs/grid-auto-columns
       */
      "auto-cols": [{
        "auto-cols": scaleGridAutoColsRows()
      }],
      /**
       * Grid Auto Rows
       * @see https://tailwindcss.com/docs/grid-auto-rows
       */
      "auto-rows": [{
        "auto-rows": scaleGridAutoColsRows()
      }],
      /**
       * Gap
       * @see https://tailwindcss.com/docs/gap
       */
      gap: [{
        gap: scaleUnambiguousSpacing()
      }],
      /**
       * Gap X
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-x": [{
        "gap-x": scaleUnambiguousSpacing()
      }],
      /**
       * Gap Y
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-y": [{
        "gap-y": scaleUnambiguousSpacing()
      }],
      /**
       * Justify Content
       * @see https://tailwindcss.com/docs/justify-content
       */
      "justify-content": [{
        justify: [...scaleAlignPrimaryAxis(), "normal"]
      }],
      /**
       * Justify Items
       * @see https://tailwindcss.com/docs/justify-items
       */
      "justify-items": [{
        "justify-items": [...scaleAlignSecondaryAxis(), "normal"]
      }],
      /**
       * Justify Self
       * @see https://tailwindcss.com/docs/justify-self
       */
      "justify-self": [{
        "justify-self": ["auto", ...scaleAlignSecondaryAxis()]
      }],
      /**
       * Align Content
       * @see https://tailwindcss.com/docs/align-content
       */
      "align-content": [{
        content: ["normal", ...scaleAlignPrimaryAxis()]
      }],
      /**
       * Align Items
       * @see https://tailwindcss.com/docs/align-items
       */
      "align-items": [{
        items: [...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Align Self
       * @see https://tailwindcss.com/docs/align-self
       */
      "align-self": [{
        self: ["auto", ...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Place Content
       * @see https://tailwindcss.com/docs/place-content
       */
      "place-content": [{
        "place-content": scaleAlignPrimaryAxis()
      }],
      /**
       * Place Items
       * @see https://tailwindcss.com/docs/place-items
       */
      "place-items": [{
        "place-items": [...scaleAlignSecondaryAxis(), "baseline"]
      }],
      /**
       * Place Self
       * @see https://tailwindcss.com/docs/place-self
       */
      "place-self": [{
        "place-self": ["auto", ...scaleAlignSecondaryAxis()]
      }],
      // Spacing
      /**
       * Padding
       * @see https://tailwindcss.com/docs/padding
       */
      p: [{
        p: scaleUnambiguousSpacing()
      }],
      /**
       * Padding X
       * @see https://tailwindcss.com/docs/padding
       */
      px: [{
        px: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Y
       * @see https://tailwindcss.com/docs/padding
       */
      py: [{
        py: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Start
       * @see https://tailwindcss.com/docs/padding
       */
      ps: [{
        ps: scaleUnambiguousSpacing()
      }],
      /**
       * Padding End
       * @see https://tailwindcss.com/docs/padding
       */
      pe: [{
        pe: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Top
       * @see https://tailwindcss.com/docs/padding
       */
      pt: [{
        pt: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Right
       * @see https://tailwindcss.com/docs/padding
       */
      pr: [{
        pr: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Bottom
       * @see https://tailwindcss.com/docs/padding
       */
      pb: [{
        pb: scaleUnambiguousSpacing()
      }],
      /**
       * Padding Left
       * @see https://tailwindcss.com/docs/padding
       */
      pl: [{
        pl: scaleUnambiguousSpacing()
      }],
      /**
       * Margin
       * @see https://tailwindcss.com/docs/margin
       */
      m: [{
        m: scaleMargin()
      }],
      /**
       * Margin X
       * @see https://tailwindcss.com/docs/margin
       */
      mx: [{
        mx: scaleMargin()
      }],
      /**
       * Margin Y
       * @see https://tailwindcss.com/docs/margin
       */
      my: [{
        my: scaleMargin()
      }],
      /**
       * Margin Start
       * @see https://tailwindcss.com/docs/margin
       */
      ms: [{
        ms: scaleMargin()
      }],
      /**
       * Margin End
       * @see https://tailwindcss.com/docs/margin
       */
      me: [{
        me: scaleMargin()
      }],
      /**
       * Margin Top
       * @see https://tailwindcss.com/docs/margin
       */
      mt: [{
        mt: scaleMargin()
      }],
      /**
       * Margin Right
       * @see https://tailwindcss.com/docs/margin
       */
      mr: [{
        mr: scaleMargin()
      }],
      /**
       * Margin Bottom
       * @see https://tailwindcss.com/docs/margin
       */
      mb: [{
        mb: scaleMargin()
      }],
      /**
       * Margin Left
       * @see https://tailwindcss.com/docs/margin
       */
      ml: [{
        ml: scaleMargin()
      }],
      /**
       * Space Between X
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x": [{
        "space-x": scaleUnambiguousSpacing()
      }],
      /**
       * Space Between X Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x-reverse": ["space-x-reverse"],
      /**
       * Space Between Y
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y": [{
        "space-y": scaleUnambiguousSpacing()
      }],
      /**
       * Space Between Y Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y-reverse": ["space-y-reverse"],
      // --------------
      // --- Sizing ---
      // --------------
      /**
       * Size
       * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
       */
      size: [{
        size: scaleSizing()
      }],
      /**
       * Width
       * @see https://tailwindcss.com/docs/width
       */
      w: [{
        w: [themeContainer, "screen", ...scaleSizing()]
      }],
      /**
       * Min-Width
       * @see https://tailwindcss.com/docs/min-width
       */
      "min-w": [{
        "min-w": [
          themeContainer,
          "screen",
          /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "none",
          ...scaleSizing()
        ]
      }],
      /**
       * Max-Width
       * @see https://tailwindcss.com/docs/max-width
       */
      "max-w": [{
        "max-w": [
          themeContainer,
          "screen",
          "none",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "prose",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          {
            screen: [themeBreakpoint]
          },
          ...scaleSizing()
        ]
      }],
      /**
       * Height
       * @see https://tailwindcss.com/docs/height
       */
      h: [{
        h: ["screen", ...scaleSizing()]
      }],
      /**
       * Min-Height
       * @see https://tailwindcss.com/docs/min-height
       */
      "min-h": [{
        "min-h": ["screen", "none", ...scaleSizing()]
      }],
      /**
       * Max-Height
       * @see https://tailwindcss.com/docs/max-height
       */
      "max-h": [{
        "max-h": ["screen", ...scaleSizing()]
      }],
      // ------------------
      // --- Typography ---
      // ------------------
      /**
       * Font Size
       * @see https://tailwindcss.com/docs/font-size
       */
      "font-size": [{
        text: ["base", themeText, isArbitraryVariableLength, isArbitraryLength]
      }],
      /**
       * Font Smoothing
       * @see https://tailwindcss.com/docs/font-smoothing
       */
      "font-smoothing": ["antialiased", "subpixel-antialiased"],
      /**
       * Font Style
       * @see https://tailwindcss.com/docs/font-style
       */
      "font-style": ["italic", "not-italic"],
      /**
       * Font Weight
       * @see https://tailwindcss.com/docs/font-weight
       */
      "font-weight": [{
        font: [themeFontWeight, isArbitraryVariable, isArbitraryNumber]
      }],
      /**
       * Font Stretch
       * @see https://tailwindcss.com/docs/font-stretch
       */
      "font-stretch": [{
        "font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded", isPercent, isArbitraryValue]
      }],
      /**
       * Font Family
       * @see https://tailwindcss.com/docs/font-family
       */
      "font-family": [{
        font: [isArbitraryVariableFamilyName, isArbitraryValue, themeFont]
      }],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-normal": ["normal-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-ordinal": ["ordinal"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-slashed-zero": ["slashed-zero"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-figure": ["lining-nums", "oldstyle-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-spacing": ["proportional-nums", "tabular-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
      /**
       * Letter Spacing
       * @see https://tailwindcss.com/docs/letter-spacing
       */
      tracking: [{
        tracking: [themeTracking, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Line Clamp
       * @see https://tailwindcss.com/docs/line-clamp
       */
      "line-clamp": [{
        "line-clamp": [isNumber$3, "none", isArbitraryVariable, isArbitraryNumber]
      }],
      /**
       * Line Height
       * @see https://tailwindcss.com/docs/line-height
       */
      leading: [{
        leading: [
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          themeLeading,
          ...scaleUnambiguousSpacing()
        ]
      }],
      /**
       * List Style Image
       * @see https://tailwindcss.com/docs/list-style-image
       */
      "list-image": [{
        "list-image": ["none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * List Style Position
       * @see https://tailwindcss.com/docs/list-style-position
       */
      "list-style-position": [{
        list: ["inside", "outside"]
      }],
      /**
       * List Style Type
       * @see https://tailwindcss.com/docs/list-style-type
       */
      "list-style-type": [{
        list: ["disc", "decimal", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Text Alignment
       * @see https://tailwindcss.com/docs/text-align
       */
      "text-alignment": [{
        text: ["left", "center", "right", "justify", "start", "end"]
      }],
      /**
       * Placeholder Color
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://v3.tailwindcss.com/docs/placeholder-color
       */
      "placeholder-color": [{
        placeholder: scaleColor()
      }],
      /**
       * Text Color
       * @see https://tailwindcss.com/docs/text-color
       */
      "text-color": [{
        text: scaleColor()
      }],
      /**
       * Text Decoration
       * @see https://tailwindcss.com/docs/text-decoration
       */
      "text-decoration": ["underline", "overline", "line-through", "no-underline"],
      /**
       * Text Decoration Style
       * @see https://tailwindcss.com/docs/text-decoration-style
       */
      "text-decoration-style": [{
        decoration: [...scaleLineStyle(), "wavy"]
      }],
      /**
       * Text Decoration Thickness
       * @see https://tailwindcss.com/docs/text-decoration-thickness
       */
      "text-decoration-thickness": [{
        decoration: [isNumber$3, "from-font", "auto", isArbitraryVariable, isArbitraryLength]
      }],
      /**
       * Text Decoration Color
       * @see https://tailwindcss.com/docs/text-decoration-color
       */
      "text-decoration-color": [{
        decoration: scaleColor()
      }],
      /**
       * Text Underline Offset
       * @see https://tailwindcss.com/docs/text-underline-offset
       */
      "underline-offset": [{
        "underline-offset": [isNumber$3, "auto", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Text Transform
       * @see https://tailwindcss.com/docs/text-transform
       */
      "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"],
      /**
       * Text Overflow
       * @see https://tailwindcss.com/docs/text-overflow
       */
      "text-overflow": ["truncate", "text-ellipsis", "text-clip"],
      /**
       * Text Wrap
       * @see https://tailwindcss.com/docs/text-wrap
       */
      "text-wrap": [{
        text: ["wrap", "nowrap", "balance", "pretty"]
      }],
      /**
       * Text Indent
       * @see https://tailwindcss.com/docs/text-indent
       */
      indent: [{
        indent: scaleUnambiguousSpacing()
      }],
      /**
       * Vertical Alignment
       * @see https://tailwindcss.com/docs/vertical-align
       */
      "vertical-align": [{
        align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Whitespace
       * @see https://tailwindcss.com/docs/whitespace
       */
      whitespace: [{
        whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"]
      }],
      /**
       * Word Break
       * @see https://tailwindcss.com/docs/word-break
       */
      break: [{
        break: ["normal", "words", "all", "keep"]
      }],
      /**
       * Hyphens
       * @see https://tailwindcss.com/docs/hyphens
       */
      hyphens: [{
        hyphens: ["none", "manual", "auto"]
      }],
      /**
       * Content
       * @see https://tailwindcss.com/docs/content
       */
      content: [{
        content: ["none", isArbitraryVariable, isArbitraryValue]
      }],
      // -------------------
      // --- Backgrounds ---
      // -------------------
      /**
       * Background Attachment
       * @see https://tailwindcss.com/docs/background-attachment
       */
      "bg-attachment": [{
        bg: ["fixed", "local", "scroll"]
      }],
      /**
       * Background Clip
       * @see https://tailwindcss.com/docs/background-clip
       */
      "bg-clip": [{
        "bg-clip": ["border", "padding", "content", "text"]
      }],
      /**
       * Background Origin
       * @see https://tailwindcss.com/docs/background-origin
       */
      "bg-origin": [{
        "bg-origin": ["border", "padding", "content"]
      }],
      /**
       * Background Position
       * @see https://tailwindcss.com/docs/background-position
       */
      "bg-position": [{
        bg: [...scalePosition(), isArbitraryVariablePosition, isArbitraryPosition]
      }],
      /**
       * Background Repeat
       * @see https://tailwindcss.com/docs/background-repeat
       */
      "bg-repeat": [{
        bg: ["no-repeat", {
          repeat: ["", "x", "y", "space", "round"]
        }]
      }],
      /**
       * Background Size
       * @see https://tailwindcss.com/docs/background-size
       */
      "bg-size": [{
        bg: ["auto", "cover", "contain", isArbitraryVariableSize, isArbitrarySize]
      }],
      /**
       * Background Image
       * @see https://tailwindcss.com/docs/background-image
       */
      "bg-image": [{
        bg: ["none", {
          linear: [{
            to: ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
          }, isInteger, isArbitraryVariable, isArbitraryValue],
          radial: ["", isArbitraryVariable, isArbitraryValue],
          conic: [isInteger, isArbitraryVariable, isArbitraryValue]
        }, isArbitraryVariableImage, isArbitraryImage]
      }],
      /**
       * Background Color
       * @see https://tailwindcss.com/docs/background-color
       */
      "bg-color": [{
        bg: scaleColor()
      }],
      /**
       * Gradient Color Stops From Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from-pos": [{
        from: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops Via Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via-pos": [{
        via: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops To Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to-pos": [{
        to: scaleGradientStopPosition()
      }],
      /**
       * Gradient Color Stops From
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from": [{
        from: scaleColor()
      }],
      /**
       * Gradient Color Stops Via
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via": [{
        via: scaleColor()
      }],
      /**
       * Gradient Color Stops To
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to": [{
        to: scaleColor()
      }],
      // ---------------
      // --- Borders ---
      // ---------------
      /**
       * Border Radius
       * @see https://tailwindcss.com/docs/border-radius
       */
      rounded: [{
        rounded: scaleRadius()
      }],
      /**
       * Border Radius Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-s": [{
        "rounded-s": scaleRadius()
      }],
      /**
       * Border Radius End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-e": [{
        "rounded-e": scaleRadius()
      }],
      /**
       * Border Radius Top
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-t": [{
        "rounded-t": scaleRadius()
      }],
      /**
       * Border Radius Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-r": [{
        "rounded-r": scaleRadius()
      }],
      /**
       * Border Radius Bottom
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-b": [{
        "rounded-b": scaleRadius()
      }],
      /**
       * Border Radius Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-l": [{
        "rounded-l": scaleRadius()
      }],
      /**
       * Border Radius Start Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ss": [{
        "rounded-ss": scaleRadius()
      }],
      /**
       * Border Radius Start End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-se": [{
        "rounded-se": scaleRadius()
      }],
      /**
       * Border Radius End End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ee": [{
        "rounded-ee": scaleRadius()
      }],
      /**
       * Border Radius End Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-es": [{
        "rounded-es": scaleRadius()
      }],
      /**
       * Border Radius Top Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tl": [{
        "rounded-tl": scaleRadius()
      }],
      /**
       * Border Radius Top Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tr": [{
        "rounded-tr": scaleRadius()
      }],
      /**
       * Border Radius Bottom Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-br": [{
        "rounded-br": scaleRadius()
      }],
      /**
       * Border Radius Bottom Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-bl": [{
        "rounded-bl": scaleRadius()
      }],
      /**
       * Border Width
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w": [{
        border: scaleBorderWidth()
      }],
      /**
       * Border Width X
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-x": [{
        "border-x": scaleBorderWidth()
      }],
      /**
       * Border Width Y
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-y": [{
        "border-y": scaleBorderWidth()
      }],
      /**
       * Border Width Start
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-s": [{
        "border-s": scaleBorderWidth()
      }],
      /**
       * Border Width End
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-e": [{
        "border-e": scaleBorderWidth()
      }],
      /**
       * Border Width Top
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-t": [{
        "border-t": scaleBorderWidth()
      }],
      /**
       * Border Width Right
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-r": [{
        "border-r": scaleBorderWidth()
      }],
      /**
       * Border Width Bottom
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-b": [{
        "border-b": scaleBorderWidth()
      }],
      /**
       * Border Width Left
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-l": [{
        "border-l": scaleBorderWidth()
      }],
      /**
       * Divide Width X
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x": [{
        "divide-x": scaleBorderWidth()
      }],
      /**
       * Divide Width X Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x-reverse": ["divide-x-reverse"],
      /**
       * Divide Width Y
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y": [{
        "divide-y": scaleBorderWidth()
      }],
      /**
       * Divide Width Y Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y-reverse": ["divide-y-reverse"],
      /**
       * Border Style
       * @see https://tailwindcss.com/docs/border-style
       */
      "border-style": [{
        border: [...scaleLineStyle(), "hidden", "none"]
      }],
      /**
       * Divide Style
       * @see https://tailwindcss.com/docs/border-style#setting-the-divider-style
       */
      "divide-style": [{
        divide: [...scaleLineStyle(), "hidden", "none"]
      }],
      /**
       * Border Color
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color": [{
        border: scaleColor()
      }],
      /**
       * Border Color X
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-x": [{
        "border-x": scaleColor()
      }],
      /**
       * Border Color Y
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-y": [{
        "border-y": scaleColor()
      }],
      /**
       * Border Color S
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-s": [{
        "border-s": scaleColor()
      }],
      /**
       * Border Color E
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-e": [{
        "border-e": scaleColor()
      }],
      /**
       * Border Color Top
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-t": [{
        "border-t": scaleColor()
      }],
      /**
       * Border Color Right
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-r": [{
        "border-r": scaleColor()
      }],
      /**
       * Border Color Bottom
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-b": [{
        "border-b": scaleColor()
      }],
      /**
       * Border Color Left
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-l": [{
        "border-l": scaleColor()
      }],
      /**
       * Divide Color
       * @see https://tailwindcss.com/docs/divide-color
       */
      "divide-color": [{
        divide: scaleColor()
      }],
      /**
       * Outline Style
       * @see https://tailwindcss.com/docs/outline-style
       */
      "outline-style": [{
        outline: [...scaleLineStyle(), "none", "hidden"]
      }],
      /**
       * Outline Offset
       * @see https://tailwindcss.com/docs/outline-offset
       */
      "outline-offset": [{
        "outline-offset": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Outline Width
       * @see https://tailwindcss.com/docs/outline-width
       */
      "outline-w": [{
        outline: ["", isNumber$3, isArbitraryVariableLength, isArbitraryLength]
      }],
      /**
       * Outline Color
       * @see https://tailwindcss.com/docs/outline-color
       */
      "outline-color": [{
        outline: [themeColor]
      }],
      // ---------------
      // --- Effects ---
      // ---------------
      /**
       * Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow
       */
      shadow: [{
        shadow: [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          themeShadow,
          isArbitraryVariableShadow,
          isArbitraryShadow
        ]
      }],
      /**
       * Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-shadow-color
       */
      "shadow-color": [{
        shadow: scaleColor()
      }],
      /**
       * Inset Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-shadow
       */
      "inset-shadow": [{
        "inset-shadow": ["none", isArbitraryVariable, isArbitraryValue, themeInsetShadow]
      }],
      /**
       * Inset Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-shadow-color
       */
      "inset-shadow-color": [{
        "inset-shadow": scaleColor()
      }],
      /**
       * Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
       */
      "ring-w": [{
        ring: scaleBorderWidth()
      }],
      /**
       * Ring Width Inset
       * @see https://v3.tailwindcss.com/docs/ring-width#inset-rings
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-w-inset": ["ring-inset"],
      /**
       * Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-ring-color
       */
      "ring-color": [{
        ring: scaleColor()
      }],
      /**
       * Ring Offset Width
       * @see https://v3.tailwindcss.com/docs/ring-offset-width
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-w": [{
        "ring-offset": [isNumber$3, isArbitraryLength]
      }],
      /**
       * Ring Offset Color
       * @see https://v3.tailwindcss.com/docs/ring-offset-color
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-color": [{
        "ring-offset": scaleColor()
      }],
      /**
       * Inset Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
       */
      "inset-ring-w": [{
        "inset-ring": scaleBorderWidth()
      }],
      /**
       * Inset Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-ring-color
       */
      "inset-ring-color": [{
        "inset-ring": scaleColor()
      }],
      /**
       * Opacity
       * @see https://tailwindcss.com/docs/opacity
       */
      opacity: [{
        opacity: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Mix Blend Mode
       * @see https://tailwindcss.com/docs/mix-blend-mode
       */
      "mix-blend": [{
        "mix-blend": [...scaleBlendMode(), "plus-darker", "plus-lighter"]
      }],
      /**
       * Background Blend Mode
       * @see https://tailwindcss.com/docs/background-blend-mode
       */
      "bg-blend": [{
        "bg-blend": scaleBlendMode()
      }],
      // ---------------
      // --- Filters ---
      // ---------------
      /**
       * Filter
       * @see https://tailwindcss.com/docs/filter
       */
      filter: [{
        filter: [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Blur
       * @see https://tailwindcss.com/docs/blur
       */
      blur: [{
        blur: scaleBlur()
      }],
      /**
       * Brightness
       * @see https://tailwindcss.com/docs/brightness
       */
      brightness: [{
        brightness: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Contrast
       * @see https://tailwindcss.com/docs/contrast
       */
      contrast: [{
        contrast: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Drop Shadow
       * @see https://tailwindcss.com/docs/drop-shadow
       */
      "drop-shadow": [{
        "drop-shadow": [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          themeDropShadow,
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Grayscale
       * @see https://tailwindcss.com/docs/grayscale
       */
      grayscale: [{
        grayscale: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Hue Rotate
       * @see https://tailwindcss.com/docs/hue-rotate
       */
      "hue-rotate": [{
        "hue-rotate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Invert
       * @see https://tailwindcss.com/docs/invert
       */
      invert: [{
        invert: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Saturate
       * @see https://tailwindcss.com/docs/saturate
       */
      saturate: [{
        saturate: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Sepia
       * @see https://tailwindcss.com/docs/sepia
       */
      sepia: [{
        sepia: ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Filter
       * @see https://tailwindcss.com/docs/backdrop-filter
       */
      "backdrop-filter": [{
        "backdrop-filter": [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          isArbitraryVariable,
          isArbitraryValue
        ]
      }],
      /**
       * Backdrop Blur
       * @see https://tailwindcss.com/docs/backdrop-blur
       */
      "backdrop-blur": [{
        "backdrop-blur": scaleBlur()
      }],
      /**
       * Backdrop Brightness
       * @see https://tailwindcss.com/docs/backdrop-brightness
       */
      "backdrop-brightness": [{
        "backdrop-brightness": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Contrast
       * @see https://tailwindcss.com/docs/backdrop-contrast
       */
      "backdrop-contrast": [{
        "backdrop-contrast": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Grayscale
       * @see https://tailwindcss.com/docs/backdrop-grayscale
       */
      "backdrop-grayscale": [{
        "backdrop-grayscale": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Hue Rotate
       * @see https://tailwindcss.com/docs/backdrop-hue-rotate
       */
      "backdrop-hue-rotate": [{
        "backdrop-hue-rotate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Invert
       * @see https://tailwindcss.com/docs/backdrop-invert
       */
      "backdrop-invert": [{
        "backdrop-invert": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Opacity
       * @see https://tailwindcss.com/docs/backdrop-opacity
       */
      "backdrop-opacity": [{
        "backdrop-opacity": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Saturate
       * @see https://tailwindcss.com/docs/backdrop-saturate
       */
      "backdrop-saturate": [{
        "backdrop-saturate": [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Backdrop Sepia
       * @see https://tailwindcss.com/docs/backdrop-sepia
       */
      "backdrop-sepia": [{
        "backdrop-sepia": ["", isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      // --------------
      // --- Tables ---
      // --------------
      /**
       * Border Collapse
       * @see https://tailwindcss.com/docs/border-collapse
       */
      "border-collapse": [{
        border: ["collapse", "separate"]
      }],
      /**
       * Border Spacing
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing": [{
        "border-spacing": scaleUnambiguousSpacing()
      }],
      /**
       * Border Spacing X
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-x": [{
        "border-spacing-x": scaleUnambiguousSpacing()
      }],
      /**
       * Border Spacing Y
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-y": [{
        "border-spacing-y": scaleUnambiguousSpacing()
      }],
      /**
       * Table Layout
       * @see https://tailwindcss.com/docs/table-layout
       */
      "table-layout": [{
        table: ["auto", "fixed"]
      }],
      /**
       * Caption Side
       * @see https://tailwindcss.com/docs/caption-side
       */
      caption: [{
        caption: ["top", "bottom"]
      }],
      // ---------------------------------
      // --- Transitions and Animation ---
      // ---------------------------------
      /**
       * Transition Property
       * @see https://tailwindcss.com/docs/transition-property
       */
      transition: [{
        transition: ["", "all", "colors", "opacity", "shadow", "transform", "none", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Behavior
       * @see https://tailwindcss.com/docs/transition-behavior
       */
      "transition-behavior": [{
        transition: ["normal", "discrete"]
      }],
      /**
       * Transition Duration
       * @see https://tailwindcss.com/docs/transition-duration
       */
      duration: [{
        duration: [isNumber$3, "initial", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Timing Function
       * @see https://tailwindcss.com/docs/transition-timing-function
       */
      ease: [{
        ease: ["linear", "initial", themeEase, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Transition Delay
       * @see https://tailwindcss.com/docs/transition-delay
       */
      delay: [{
        delay: [isNumber$3, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Animation
       * @see https://tailwindcss.com/docs/animation
       */
      animate: [{
        animate: ["none", themeAnimate, isArbitraryVariable, isArbitraryValue]
      }],
      // ------------------
      // --- Transforms ---
      // ------------------
      /**
       * Backface Visibility
       * @see https://tailwindcss.com/docs/backface-visibility
       */
      backface: [{
        backface: ["hidden", "visible"]
      }],
      /**
       * Perspective
       * @see https://tailwindcss.com/docs/perspective
       */
      perspective: [{
        perspective: [themePerspective, isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Perspective Origin
       * @see https://tailwindcss.com/docs/perspective-origin
       */
      "perspective-origin": [{
        "perspective-origin": scaleOrigin()
      }],
      /**
       * Rotate
       * @see https://tailwindcss.com/docs/rotate
       */
      rotate: [{
        rotate: scaleRotate()
      }],
      /**
       * Rotate X
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-x": [{
        "rotate-x": scaleRotate()
      }],
      /**
       * Rotate Y
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-y": [{
        "rotate-y": scaleRotate()
      }],
      /**
       * Rotate Z
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-z": [{
        "rotate-z": scaleRotate()
      }],
      /**
       * Scale
       * @see https://tailwindcss.com/docs/scale
       */
      scale: [{
        scale: scaleScale()
      }],
      /**
       * Scale X
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-x": [{
        "scale-x": scaleScale()
      }],
      /**
       * Scale Y
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-y": [{
        "scale-y": scaleScale()
      }],
      /**
       * Scale Z
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-z": [{
        "scale-z": scaleScale()
      }],
      /**
       * Scale 3D
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-3d": ["scale-3d"],
      /**
       * Skew
       * @see https://tailwindcss.com/docs/skew
       */
      skew: [{
        skew: scaleSkew()
      }],
      /**
       * Skew X
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-x": [{
        "skew-x": scaleSkew()
      }],
      /**
       * Skew Y
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-y": [{
        "skew-y": scaleSkew()
      }],
      /**
       * Transform
       * @see https://tailwindcss.com/docs/transform
       */
      transform: [{
        transform: [isArbitraryVariable, isArbitraryValue, "", "none", "gpu", "cpu"]
      }],
      /**
       * Transform Origin
       * @see https://tailwindcss.com/docs/transform-origin
       */
      "transform-origin": [{
        origin: scaleOrigin()
      }],
      /**
       * Transform Style
       * @see https://tailwindcss.com/docs/transform-style
       */
      "transform-style": [{
        transform: ["3d", "flat"]
      }],
      /**
       * Translate
       * @see https://tailwindcss.com/docs/translate
       */
      translate: [{
        translate: scaleTranslate()
      }],
      /**
       * Translate X
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-x": [{
        "translate-x": scaleTranslate()
      }],
      /**
       * Translate Y
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-y": [{
        "translate-y": scaleTranslate()
      }],
      /**
       * Translate Z
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-z": [{
        "translate-z": scaleTranslate()
      }],
      /**
       * Translate None
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-none": ["translate-none"],
      // ---------------------
      // --- Interactivity ---
      // ---------------------
      /**
       * Accent Color
       * @see https://tailwindcss.com/docs/accent-color
       */
      accent: [{
        accent: scaleColor()
      }],
      /**
       * Appearance
       * @see https://tailwindcss.com/docs/appearance
       */
      appearance: [{
        appearance: ["none", "auto"]
      }],
      /**
       * Caret Color
       * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
       */
      "caret-color": [{
        caret: scaleColor()
      }],
      /**
       * Color Scheme
       * @see https://tailwindcss.com/docs/color-scheme
       */
      "color-scheme": [{
        scheme: ["normal", "dark", "light", "light-dark", "only-dark", "only-light"]
      }],
      /**
       * Cursor
       * @see https://tailwindcss.com/docs/cursor
       */
      cursor: [{
        cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", isArbitraryVariable, isArbitraryValue]
      }],
      /**
       * Field Sizing
       * @see https://tailwindcss.com/docs/field-sizing
       */
      "field-sizing": [{
        "field-sizing": ["fixed", "content"]
      }],
      /**
       * Pointer Events
       * @see https://tailwindcss.com/docs/pointer-events
       */
      "pointer-events": [{
        "pointer-events": ["auto", "none"]
      }],
      /**
       * Resize
       * @see https://tailwindcss.com/docs/resize
       */
      resize: [{
        resize: ["none", "", "y", "x"]
      }],
      /**
       * Scroll Behavior
       * @see https://tailwindcss.com/docs/scroll-behavior
       */
      "scroll-behavior": [{
        scroll: ["auto", "smooth"]
      }],
      /**
       * Scroll Margin
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-m": [{
        "scroll-m": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin X
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mx": [{
        "scroll-mx": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Y
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-my": [{
        "scroll-my": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Start
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ms": [{
        "scroll-ms": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin End
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-me": [{
        "scroll-me": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Top
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mt": [{
        "scroll-mt": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Right
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mr": [{
        "scroll-mr": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Bottom
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mb": [{
        "scroll-mb": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Margin Left
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ml": [{
        "scroll-ml": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-p": [{
        "scroll-p": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding X
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-px": [{
        "scroll-px": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Y
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-py": [{
        "scroll-py": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Start
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-ps": [{
        "scroll-ps": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding End
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pe": [{
        "scroll-pe": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Top
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pt": [{
        "scroll-pt": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Right
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pr": [{
        "scroll-pr": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Bottom
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pb": [{
        "scroll-pb": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Padding Left
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pl": [{
        "scroll-pl": scaleUnambiguousSpacing()
      }],
      /**
       * Scroll Snap Align
       * @see https://tailwindcss.com/docs/scroll-snap-align
       */
      "snap-align": [{
        snap: ["start", "end", "center", "align-none"]
      }],
      /**
       * Scroll Snap Stop
       * @see https://tailwindcss.com/docs/scroll-snap-stop
       */
      "snap-stop": [{
        snap: ["normal", "always"]
      }],
      /**
       * Scroll Snap Type
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-type": [{
        snap: ["none", "x", "y", "both"]
      }],
      /**
       * Scroll Snap Type Strictness
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-strictness": [{
        snap: ["mandatory", "proximity"]
      }],
      /**
       * Touch Action
       * @see https://tailwindcss.com/docs/touch-action
       */
      touch: [{
        touch: ["auto", "none", "manipulation"]
      }],
      /**
       * Touch Action X
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-x": [{
        "touch-pan": ["x", "left", "right"]
      }],
      /**
       * Touch Action Y
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-y": [{
        "touch-pan": ["y", "up", "down"]
      }],
      /**
       * Touch Action Pinch Zoom
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-pz": ["touch-pinch-zoom"],
      /**
       * User Select
       * @see https://tailwindcss.com/docs/user-select
       */
      select: [{
        select: ["none", "text", "all", "auto"]
      }],
      /**
       * Will Change
       * @see https://tailwindcss.com/docs/will-change
       */
      "will-change": [{
        "will-change": ["auto", "scroll", "contents", "transform", isArbitraryVariable, isArbitraryValue]
      }],
      // -----------
      // --- SVG ---
      // -----------
      /**
       * Fill
       * @see https://tailwindcss.com/docs/fill
       */
      fill: [{
        fill: ["none", ...scaleColor()]
      }],
      /**
       * Stroke Width
       * @see https://tailwindcss.com/docs/stroke-width
       */
      "stroke-w": [{
        stroke: [isNumber$3, isArbitraryVariableLength, isArbitraryLength, isArbitraryNumber]
      }],
      /**
       * Stroke
       * @see https://tailwindcss.com/docs/stroke
       */
      stroke: [{
        stroke: ["none", ...scaleColor()]
      }],
      // ---------------------
      // --- Accessibility ---
      // ---------------------
      /**
       * Forced Color Adjust
       * @see https://tailwindcss.com/docs/forced-color-adjust
       */
      "forced-color-adjust": [{
        "forced-color-adjust": ["auto", "none"]
      }]
    },
    conflictingClassGroups: {
      overflow: ["overflow-x", "overflow-y"],
      overscroll: ["overscroll-x", "overscroll-y"],
      inset: ["inset-x", "inset-y", "start", "end", "top", "right", "bottom", "left"],
      "inset-x": ["right", "left"],
      "inset-y": ["top", "bottom"],
      flex: ["basis", "grow", "shrink"],
      gap: ["gap-x", "gap-y"],
      p: ["px", "py", "ps", "pe", "pt", "pr", "pb", "pl"],
      px: ["pr", "pl"],
      py: ["pt", "pb"],
      m: ["mx", "my", "ms", "me", "mt", "mr", "mb", "ml"],
      mx: ["mr", "ml"],
      my: ["mt", "mb"],
      size: ["w", "h"],
      "font-size": ["leading"],
      "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
      "fvn-ordinal": ["fvn-normal"],
      "fvn-slashed-zero": ["fvn-normal"],
      "fvn-figure": ["fvn-normal"],
      "fvn-spacing": ["fvn-normal"],
      "fvn-fraction": ["fvn-normal"],
      "line-clamp": ["display", "overflow"],
      rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
      "rounded-s": ["rounded-ss", "rounded-es"],
      "rounded-e": ["rounded-se", "rounded-ee"],
      "rounded-t": ["rounded-tl", "rounded-tr"],
      "rounded-r": ["rounded-tr", "rounded-br"],
      "rounded-b": ["rounded-br", "rounded-bl"],
      "rounded-l": ["rounded-tl", "rounded-bl"],
      "border-spacing": ["border-spacing-x", "border-spacing-y"],
      "border-w": ["border-w-s", "border-w-e", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
      "border-w-x": ["border-w-r", "border-w-l"],
      "border-w-y": ["border-w-t", "border-w-b"],
      "border-color": ["border-color-s", "border-color-e", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
      "border-color-x": ["border-color-r", "border-color-l"],
      "border-color-y": ["border-color-t", "border-color-b"],
      translate: ["translate-x", "translate-y", "translate-none"],
      "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
      "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
      "scroll-mx": ["scroll-mr", "scroll-ml"],
      "scroll-my": ["scroll-mt", "scroll-mb"],
      "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
      "scroll-px": ["scroll-pr", "scroll-pl"],
      "scroll-py": ["scroll-pt", "scroll-pb"],
      touch: ["touch-x", "touch-y", "touch-pz"],
      "touch-x": ["touch"],
      "touch-y": ["touch"],
      "touch-pz": ["touch"]
    },
    conflictingClassGroupModifiers: {
      "font-size": ["leading"]
    },
    orderSensitiveModifiers: ["before", "after", "placeholder", "file", "marker", "selection", "first-line", "first-letter", "backdrop", "*", "**"]
  };
};
const mergeConfigs$1 = (baseConfig2, {
  cacheSize,
  prefix,
  experimentalParseClassName,
  extend: extend4 = {},
  override = {}
}) => {
  overrideProperty(baseConfig2, "cacheSize", cacheSize);
  overrideProperty(baseConfig2, "prefix", prefix);
  overrideProperty(baseConfig2, "experimentalParseClassName", experimentalParseClassName);
  overrideConfigProperties(baseConfig2.theme, override.theme);
  overrideConfigProperties(baseConfig2.classGroups, override.classGroups);
  overrideConfigProperties(baseConfig2.conflictingClassGroups, override.conflictingClassGroups);
  overrideConfigProperties(baseConfig2.conflictingClassGroupModifiers, override.conflictingClassGroupModifiers);
  overrideProperty(baseConfig2, "orderSensitiveModifiers", override.orderSensitiveModifiers);
  mergeConfigProperties(baseConfig2.theme, extend4.theme);
  mergeConfigProperties(baseConfig2.classGroups, extend4.classGroups);
  mergeConfigProperties(baseConfig2.conflictingClassGroups, extend4.conflictingClassGroups);
  mergeConfigProperties(baseConfig2.conflictingClassGroupModifiers, extend4.conflictingClassGroupModifiers);
  mergeArrayProperties(baseConfig2, extend4, "orderSensitiveModifiers");
  return baseConfig2;
};
const overrideProperty = (baseObject, overrideKey, overrideValue) => {
  if (overrideValue !== void 0) {
    baseObject[overrideKey] = overrideValue;
  }
};
const overrideConfigProperties = (baseObject, overrideObject) => {
  if (overrideObject) {
    for (const key in overrideObject) {
      overrideProperty(baseObject, key, overrideObject[key]);
    }
  }
};
const mergeConfigProperties = (baseObject, mergeObject) => {
  if (mergeObject) {
    for (const key in mergeObject) {
      mergeArrayProperties(baseObject, mergeObject, key);
    }
  }
};
const mergeArrayProperties = (baseObject, mergeObject, key) => {
  const mergeValue = mergeObject[key];
  if (mergeValue !== void 0) {
    baseObject[key] = baseObject[key] ? baseObject[key].concat(mergeValue) : mergeValue;
  }
};
const extendTailwindMerge = (configExtension, ...createConfig) => typeof configExtension === "function" ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(() => mergeConfigs$1(getDefaultConfig(), configExtension), ...createConfig);
const twMerge$1 = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
var ie = { twMerge: true, twMergeConfig: {}, responsiveVariants: false }, x$5 = (s2) => s2 || void 0, N$3 = (...s2) => x$5(y$5(s2).filter(Boolean).join(" ")), R$3 = null, v$4 = {}, q$3 = false, M$4 = (...s2) => (b$12) => b$12.twMerge ? ((!R$3 || q$3) && (q$3 = false, R$3 = u$6(v$4) ? twMerge$1 : extendTailwindMerge({ ...v$4, extend: { theme: v$4.theme, classGroups: v$4.classGroups, conflictingClassGroupModifiers: v$4.conflictingClassGroupModifiers, conflictingClassGroups: v$4.conflictingClassGroups, ...v$4.extend } })), x$5(R$3(N$3(s2)))) : N$3(s2), _$3 = (s2, b2) => {
  for (let e2 in b2)
    s2.hasOwnProperty(e2) ? s2[e2] = N$3(s2[e2], b2[e2]) : s2[e2] = b2[e2];
  return s2;
}, ce = (s2, b$12) => {
  let { extend: e2 = null, slots: O2 = {}, variants: U2 = {}, compoundVariants: W2 = [], compoundSlots: C2 = [], defaultVariants: z2 = {} } = s2, m2 = { ...ie, ...b$12 }, k2 = e2 != null && e2.base ? N$3(e2.base, s2 == null ? void 0 : s2.base) : s2 == null ? void 0 : s2.base, g$12 = e2 != null && e2.variants && !u$6(e2.variants) ? p$6(U2, e2.variants) : U2, w2 = e2 != null && e2.defaultVariants && !u$6(e2.defaultVariants) ? { ...e2.defaultVariants, ...z2 } : z2;
  !u$6(m2.twMergeConfig) && !x$6(m2.twMergeConfig, v$4) && (q$3 = true, v$4 = m2.twMergeConfig);
  let S2 = u$6(e2 == null ? void 0 : e2.slots), T2 = u$6(O2) ? {} : { base: N$3(s2 == null ? void 0 : s2.base, S2 && (e2 == null ? void 0 : e2.base)), ...O2 }, j2 = S2 ? T2 : _$3({ ...e2 == null ? void 0 : e2.slots }, u$6(T2) ? { base: s2 == null ? void 0 : s2.base } : T2), h$12 = u$6(e2 == null ? void 0 : e2.compoundVariants) ? W2 : a$3(e2 == null ? void 0 : e2.compoundVariants, W2), V3 = (l2) => {
    if (u$6(g$12) && u$6(O2) && S2)
      return M$4(k2, l2 == null ? void 0 : l2.class, l2 == null ? void 0 : l2.className)(m2);
    if (h$12 && !Array.isArray(h$12))
      throw new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof h$12}`);
    if (C2 && !Array.isArray(C2))
      throw new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof C2}`);
    let P2 = (a2, n2, t2 = [], i2) => {
      let r2 = t2;
      if (typeof n2 == "string")
        r2 = r2.concat(g$4(n2).split(" ").map((o2) => `${a2}:${o2}`));
      else if (Array.isArray(n2))
        r2 = r2.concat(n2.reduce((o2, c2) => o2.concat(`${a2}:${c2}`), []));
      else if (typeof n2 == "object" && typeof i2 == "string") {
        for (let o2 in n2)
          if (n2.hasOwnProperty(o2) && o2 === i2) {
            let c2 = n2[o2];
            if (c2 && typeof c2 == "string") {
              let u2 = g$4(c2);
              r2[i2] ? r2[i2] = r2[i2].concat(u2.split(" ").map((f2) => `${a2}:${f2}`)) : r2[i2] = u2.split(" ").map((f2) => `${a2}:${f2}`);
            } else
              Array.isArray(c2) && c2.length > 0 && (r2[i2] = c2.reduce((u2, f2) => u2.concat(`${a2}:${f2}`), []));
          }
      }
      return r2;
    }, D2 = (a$12, n2 = g$12, t2 = null, i2 = null) => {
      var L2;
      let r2 = n2[a$12];
      if (!r2 || u$6(r2))
        return null;
      let o2 = (L2 = i2 == null ? void 0 : i2[a$12]) != null ? L2 : l2 == null ? void 0 : l2[a$12];
      if (o2 === null)
        return null;
      let c2 = l$8(o2), u2 = Array.isArray(m2.responsiveVariants) && m2.responsiveVariants.length > 0 || m2.responsiveVariants === true, f2 = w2 == null ? void 0 : w2[a$12], d2 = [];
      if (typeof c2 == "object" && u2)
        for (let [E2, Q2] of Object.entries(c2)) {
          let ne2 = r2[Q2];
          if (E2 === "initial") {
            f2 = Q2;
            continue;
          }
          Array.isArray(m2.responsiveVariants) && !m2.responsiveVariants.includes(E2) || (d2 = P2(E2, ne2, d2, t2));
        }
      let $ = c2 != null && typeof c2 != "object" ? c2 : l$8(f2), A2 = r2[$ || "false"];
      return typeof d2 == "object" && typeof t2 == "string" && d2[t2] ? _$3(d2, A2) : d2.length > 0 ? (d2.push(A2), t2 === "base" ? d2.join(" ") : d2) : A2;
    }, p2 = () => g$12 ? Object.keys(g$12).map((a2) => D2(a2, g$12)) : null, ee2 = (a2, n2) => {
      if (!g$12 || typeof g$12 != "object")
        return null;
      let t2 = new Array();
      for (let i2 in g$12) {
        let r2 = D2(i2, g$12, a2, n2), o2 = a2 === "base" && typeof r2 == "string" ? r2 : r2 && r2[a2];
        o2 && (t2[t2.length] = o2);
      }
      return t2;
    }, H2 = {};
    for (let a2 in l2)
      l2[a2] !== void 0 && (H2[a2] = l2[a2]);
    let I2 = (a2, n2) => {
      var i2;
      let t2 = typeof (l2 == null ? void 0 : l2[a2]) == "object" ? { [a2]: (i2 = l2[a2]) == null ? void 0 : i2.initial } : {};
      return { ...w2, ...H2, ...t2, ...n2 };
    }, J2 = (a2 = [], n2) => {
      let t2 = [];
      for (let { class: i2, className: r2, ...o2 } of a2) {
        let c2 = true;
        for (let [u2, f2] of Object.entries(o2)) {
          let d2 = I2(u2, n2)[u2];
          if (Array.isArray(f2)) {
            if (!f2.includes(d2)) {
              c2 = false;
              break;
            }
          } else {
            let $ = (A2) => A2 == null || A2 === false;
            if ($(f2) && $(d2))
              continue;
            if (d2 !== f2) {
              c2 = false;
              break;
            }
          }
        }
        c2 && (i2 && t2.push(i2), r2 && t2.push(r2));
      }
      return t2;
    }, te2 = (a2) => {
      let n2 = J2(h$12, a2);
      if (!Array.isArray(n2))
        return n2;
      let t2 = {};
      for (let i2 of n2)
        if (typeof i2 == "string" && (t2.base = M$4(t2.base, i2)(m2)), typeof i2 == "object")
          for (let [r2, o2] of Object.entries(i2))
            t2[r2] = M$4(t2[r2], o2)(m2);
      return t2;
    }, ae2 = (a2) => {
      if (C2.length < 1)
        return null;
      let n2 = {};
      for (let { slots: t2 = [], class: i2, className: r2, ...o2 } of C2) {
        if (!u$6(o2)) {
          let c2 = true;
          for (let u2 of Object.keys(o2)) {
            let f2 = I2(u2, a2)[u2];
            if (f2 === void 0 || (Array.isArray(o2[u2]) ? !o2[u2].includes(f2) : o2[u2] !== f2)) {
              c2 = false;
              break;
            }
          }
          if (!c2)
            continue;
        }
        for (let c2 of t2)
          n2[c2] = n2[c2] || [], n2[c2].push([i2, r2]);
      }
      return n2;
    };
    if (!u$6(O2) || !S2) {
      let a2 = {};
      if (typeof j2 == "object" && !u$6(j2))
        for (let n2 of Object.keys(j2))
          a2[n2] = (t2) => {
            var i2, r2;
            return M$4(j2[n2], ee2(n2, t2), ((i2 = te2(t2)) != null ? i2 : [])[n2], ((r2 = ae2(t2)) != null ? r2 : [])[n2], t2 == null ? void 0 : t2.class, t2 == null ? void 0 : t2.className)(m2);
          };
      return a2;
    }
    return M$4(k2, p2(), J2(h$12), l2 == null ? void 0 : l2.class, l2 == null ? void 0 : l2.className)(m2);
  }, K2 = () => {
    if (!(!g$12 || typeof g$12 != "object"))
      return Object.keys(g$12);
  };
  return V3.variantKeys = K2(), V3.extend = e2, V3.base = k2, V3.slots = j2, V3.variants = g$12, V3.defaultVariants = w2, V3.compoundSlots = C2, V3.compoundVariants = h$12, V3;
};
var tv = (options, config2) => {
  var _a2, _b2, _c2;
  return ce(options, {
    ...config2,
    twMerge: (_a2 = config2 == null ? void 0 : config2.twMerge) != null ? _a2 : true,
    twMergeConfig: {
      ...config2 == null ? void 0 : config2.twMergeConfig,
      theme: {
        ...(_b2 = config2 == null ? void 0 : config2.twMergeConfig) == null ? void 0 : _b2.theme,
        ...twMergeConfig.theme
      },
      classGroups: {
        ...(_c2 = config2 == null ? void 0 : config2.twMergeConfig) == null ? void 0 : _c2.classGroups,
        ...twMergeConfig.classGroups
      }
    }
  });
};
var snippet = tv({
  slots: {
    base: "inline-flex items-center justify-between h-fit rounded-large gap-2",
    pre: "bg-transparent text-inherit font-mono font-normal inline-block whitespace-nowrap",
    content: "flex flex-col",
    symbol: "select-none",
    copyButton: [
      "group",
      "relative",
      "z-10",
      "text-large",
      "text-inherit",
      "data-[hover=true]:bg-transparent"
    ],
    copyIcon: [
      "absolute text-inherit opacity-100 scale-100 group-data-[copied=true]:opacity-0 group-data-[copied=true]:scale-50"
    ],
    checkIcon: [
      "absolute text-inherit opacity-0 scale-50 group-data-[copied=true]:opacity-100 group-data-[copied=true]:scale-100"
    ]
  },
  variants: {
    variant: {
      flat: "",
      solid: "",
      bordered: "border-medium bg-transparent",
      shadow: ""
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        base: "px-1.5 py-0.5 text-tiny rounded-small"
      },
      md: {
        base: "px-3 py-1.5 text-small rounded-medium"
      },
      lg: {
        base: "px-4 py-2 text-medium rounded-large"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        copyIcon: "transition-transform-opacity",
        checkIcon: "transition-transform-opacity"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "flat",
    size: "md",
    fullWidth: false
  },
  compoundVariants: [
    // solid - shadow / color
    {
      variant: ["solid", "shadow"],
      color: "default",
      class: {
        copyButton: "data-[focus-visible]:outline-default-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "primary",
      class: {
        copyButton: "data-[focus-visible]:outline-primary-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "secondary",
      class: {
        copyButton: "data-[focus-visible]:outline-secondary-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "success",
      class: {
        copyButton: "data-[focus-visible]:outline-success-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "warning",
      class: {
        copyButton: "data-[focus-visible]:outline-warning-foreground"
      }
    },
    {
      variant: ["solid", "shadow"],
      color: "danger",
      class: {
        copyButton: "data-[focus-visible]:outline-danger-foreground"
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: colorVariants.flat.danger
      }
    },
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: colorVariants.shadow.danger
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: colorVariants.bordered.default
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: colorVariants.bordered.primary
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: colorVariants.bordered.secondary
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: colorVariants.bordered.success
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: colorVariants.bordered.warning
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: colorVariants.bordered.danger
      }
    }
  ]
});
var spacer = tv({
  base: "w-px h-px inline-block",
  variants: {
    isInline: {
      true: "inline-block",
      false: "block"
    }
  },
  defaultVariants: {
    isInline: false
  }
});
var spinner = tv({
  slots: {
    base: "relative inline-flex flex-col gap-2 items-center justify-center",
    wrapper: "relative flex",
    label: "text-foreground dark:text-foreground-dark font-regular",
    circle1: "absolute w-full h-full rounded-full",
    circle2: "absolute w-full h-full rounded-full",
    dots: "relative rounded-full mx-auto",
    spinnerBars: [
      "absolute",
      "animate-fade-out",
      "rounded-full",
      "w-[25%]",
      "h-[8%]",
      "left-[calc(37.5%)]",
      "top-[calc(46%)]",
      "spinner-bar-animation"
    ]
  },
  variants: {
    size: {
      sm: {
        wrapper: "w-5 h-5",
        circle1: "border-2",
        circle2: "border-2",
        dots: "size-1",
        label: "text-small"
      },
      md: {
        wrapper: "w-8 h-8",
        circle1: "border-3",
        circle2: "border-3",
        dots: "size-1.5",
        label: "text-medium"
      },
      lg: {
        wrapper: "w-10 h-10",
        circle1: "border-3",
        circle2: "border-3",
        dots: "size-2",
        label: "text-large"
      }
    },
    color: {
      current: {
        circle1: "border-b-current",
        circle2: "border-b-current",
        dots: "bg-current",
        spinnerBars: "bg-current"
      },
      white: {
        circle1: "border-b-white",
        circle2: "border-b-white",
        dots: "bg-white",
        spinnerBars: "bg-white"
      },
      default: {
        circle1: "border-b-default",
        circle2: "border-b-default",
        dots: "bg-default",
        spinnerBars: "bg-default"
      },
      primary: {
        circle1: "border-b-primary",
        circle2: "border-b-primary",
        dots: "bg-primary",
        spinnerBars: "bg-primary"
      },
      secondary: {
        circle1: "border-b-secondary",
        circle2: "border-b-secondary",
        dots: "bg-secondary",
        spinnerBars: "bg-secondary"
      },
      success: {
        circle1: "border-b-success",
        circle2: "border-b-success",
        dots: "bg-success",
        spinnerBars: "bg-success"
      },
      warning: {
        circle1: "border-b-warning",
        circle2: "border-b-warning",
        dots: "bg-warning",
        spinnerBars: "bg-warning"
      },
      danger: {
        circle1: "border-b-danger",
        circle2: "border-b-danger",
        dots: "bg-danger",
        spinnerBars: "bg-danger"
      }
    },
    labelColor: {
      foreground: {
        label: "text-foreground"
      },
      primary: {
        label: "text-primary"
      },
      secondary: {
        label: "text-secondary"
      },
      success: {
        label: "text-success"
      },
      warning: {
        label: "text-warning"
      },
      danger: {
        label: "text-danger"
      }
    },
    variant: {
      default: {
        circle1: [
          "animate-spinner-ease-spin",
          "border-solid",
          "border-t-transparent",
          "border-l-transparent",
          "border-r-transparent"
        ],
        circle2: [
          "opacity-75",
          "animate-spinner-linear-spin",
          "border-dotted",
          "border-t-transparent",
          "border-l-transparent",
          "border-r-transparent"
        ]
      },
      gradient: {
        circle1: [
          "border-0",
          "bg-gradient-to-b",
          "from-transparent",
          "via-transparent",
          "to-primary",
          "animate-spinner-linear-spin",
          "[animation-duration:1s]",
          "[-webkit-mask:radial-gradient(closest-side,rgba(0,0,0,0.0)calc(100%-3px),rgba(0,0,0,1)calc(100%-3px))]"
        ],
        circle2: ["hidden"]
      },
      wave: {
        wrapper: "translate-y-3/4",
        dots: ["animate-sway", "spinner-dot-animation"]
      },
      dots: {
        wrapper: "translate-y-2/4",
        dots: ["animate-blink", "spinner-dot-blink-animation"]
      },
      spinner: {},
      simple: {
        wrapper: "text-foreground h-5 w-5 animate-spin",
        circle1: "opacity-25",
        circle2: "opacity-75"
      }
    }
  },
  defaultVariants: {
    size: "md",
    color: "primary",
    labelColor: "foreground",
    variant: "default"
  },
  compoundVariants: [
    { variant: "gradient", color: "current", class: { circle1: "to-current" } },
    { variant: "gradient", color: "white", class: { circle1: "to-white" } },
    { variant: "gradient", color: "default", class: { circle1: "to-default" } },
    { variant: "gradient", color: "primary", class: { circle1: "to-primary" } },
    { variant: "gradient", color: "secondary", class: { circle1: "to-secondary" } },
    { variant: "gradient", color: "success", class: { circle1: "to-success" } },
    { variant: "gradient", color: "warning", class: { circle1: "to-warning" } },
    { variant: "gradient", color: "danger", class: { circle1: "to-danger" } },
    {
      variant: "wave",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "wave",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "wave",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    {
      variant: "dots",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "dots",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "dots",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    // Simple variants
    // Size
    {
      variant: "simple",
      size: "sm",
      class: {
        wrapper: "w-5 h-5"
      }
    },
    {
      variant: "simple",
      size: "md",
      class: {
        wrapper: "w-8 h-8"
      }
    },
    {
      variant: "simple",
      size: "lg",
      class: {
        wrapper: "w-12 h-12"
      }
    },
    // Color
    {
      variant: "simple",
      color: "current",
      class: {
        wrapper: "text-current"
      }
    },
    {
      variant: "simple",
      color: "white",
      class: {
        wrapper: "text-white"
      }
    },
    {
      variant: "simple",
      color: "default",
      class: {
        wrapper: "text-default"
      }
    },
    {
      variant: "simple",
      color: "primary",
      class: {
        wrapper: "text-primary"
      }
    },
    {
      variant: "simple",
      color: "secondary",
      class: {
        wrapper: "text-secondary"
      }
    },
    {
      variant: "simple",
      color: "success",
      class: {
        wrapper: "text-success"
      }
    },
    {
      variant: "simple",
      color: "warning",
      class: {
        wrapper: "text-warning"
      }
    },
    {
      variant: "simple",
      color: "danger",
      class: {
        wrapper: "text-danger"
      }
    }
  ]
});
var dataFocusVisibleClasses = [
  "outline-hidden",
  "data-[focus-visible=true]:z-10",
  "data-[focus-visible=true]:outline-2",
  "data-[focus-visible=true]:outline-focus",
  "data-[focus-visible=true]:outline-offset-2"
];
var groupDataFocusVisibleClasses = [
  "outline-hidden",
  "group-data-[focus-visible=true]:z-10",
  "group-data-[focus-visible=true]:ring-2",
  "group-data-[focus-visible=true]:ring-focus",
  "group-data-[focus-visible=true]:ring-offset-2",
  "group-data-[focus-visible=true]:ring-offset-background"
];
var ringClasses = [
  "outline-hidden",
  "ring-2",
  "ring-focus",
  "ring-offset-2",
  "ring-offset-background"
];
var collapseAdjacentVariantBorders = {
  default: ["[&+.border-medium.border-default]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  primary: ["[&+.border-medium.border-primary]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  secondary: [
    "[&+.border-medium.border-secondary]:ms-[calc(var(--heroui-border-width-medium)*-1)]"
  ],
  success: ["[&+.border-medium.border-success]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  warning: ["[&+.border-medium.border-warning]:ms-[calc(var(--heroui-border-width-medium)*-1)]"],
  danger: ["[&+.border-medium.border-danger]:ms-[calc(var(--heroui-border-width-medium)*-1)]"]
};
var hiddenInputClasses = [
  // Font styles
  "font-inherit",
  "text-[100%]",
  "leading-[1.15]",
  // Reset margins and padding
  "m-0",
  "p-0",
  // Overflow and box-sizing
  "overflow-visible",
  "box-border",
  // Positioning & Hit area
  "absolute",
  "top-0",
  "w-full",
  "h-full",
  // Opacity and z-index
  "opacity-[0.0001]",
  "z-[1]",
  // Cursor
  "cursor-pointer",
  // Disabled state
  "disabled:cursor-default"
];
var table$1 = tv({
  slots: {
    base: "flex flex-col relative gap-4",
    wrapper: [
      "p-4",
      "z-0",
      "flex",
      "flex-col",
      "relative",
      "justify-between",
      "gap-4",
      "shadow-small",
      "bg-content1",
      "overflow-auto"
    ],
    table: "min-w-full h-auto",
    thead: "[&>tr]:first:rounded-lg",
    tbody: "after:block",
    tr: ["group/tr", "outline-hidden", ...dataFocusVisibleClasses],
    th: [
      "group/th",
      "px-3",
      "h-10",
      "text-start",
      "align-middle",
      "bg-default-100",
      "whitespace-nowrap",
      "text-foreground-500",
      "text-tiny",
      "font-semibold",
      "first:rounded-s-lg",
      "last:rounded-e-lg",
      "outline-hidden",
      "data-[sortable=true]:cursor-pointer",
      "data-[hover=true]:text-foreground-400",
      ...dataFocusVisibleClasses
    ],
    td: [
      "py-2",
      "px-3",
      "relative",
      "align-middle",
      "whitespace-normal",
      "text-small",
      "font-normal",
      "outline-hidden",
      "[&>*]:z-1",
      "[&>*]:relative",
      ...dataFocusVisibleClasses,
      // before content for selection
      "before:pointer-events-none",
      "before:content-['']",
      "before:absolute",
      "before:z-0",
      "before:inset-0",
      "before:opacity-0",
      "data-[selected=true]:before:opacity-100",
      // disabled
      "group-data-[disabled=true]/tr:text-foreground-300",
      "group-data-[disabled=true]/tr:cursor-not-allowed"
    ],
    tfoot: "",
    sortIcon: [
      "ms-2",
      "mb-px",
      "opacity-0",
      "text-inherit",
      "inline-block",
      "transition-transform-opacity",
      "data-[visible=true]:opacity-100",
      "group-data-[hover=true]/th:opacity-100",
      "data-[direction=ascending]:rotate-180"
    ],
    emptyWrapper: "text-foreground-400 align-middle text-center h-40",
    loadingWrapper: "absolute inset-0 flex items-center justify-center"
  },
  variants: {
    color: {
      default: {
        td: "before:bg-default/60 data-[selected=true]:text-default-foreground"
      },
      primary: {
        td: "before:bg-primary/20 data-[selected=true]:text-primary"
      },
      secondary: {
        td: "before:bg-secondary/20 data-[selected=true]:text-secondary"
      },
      success: {
        td: "before:bg-success/20 data-[selected=true]:text-success-600 dark:data-[selected=true]:text-success"
      },
      warning: {
        td: "before:bg-warning/20 data-[selected=true]:text-warning-600 dark:data-[selected=true]:text-warning"
      },
      danger: {
        td: "before:bg-danger/20 data-[selected=true]:text-danger dark:data-[selected=true]:text-danger-500"
      }
    },
    layout: {
      auto: {
        table: "table-auto"
      },
      fixed: {
        table: "table-fixed"
      }
    },
    shadow: {
      none: {
        wrapper: "shadow-none"
      },
      sm: {
        wrapper: "shadow-small"
      },
      md: {
        wrapper: "shadow-medium"
      },
      lg: {
        wrapper: "shadow-large"
      }
    },
    hideHeader: {
      true: {
        thead: "hidden"
      }
    },
    isStriped: {
      true: {
        td: [
          "group-data-[odd=true]/tr:before:bg-default-100",
          "group-data-[odd=true]/tr:before:opacity-100",
          "group-data-[odd=true]/tr:before:-z-10"
        ]
      }
    },
    isCompact: {
      true: {
        td: "py-1"
      },
      false: {}
    },
    isHeaderSticky: {
      true: {
        thead: "sticky top-0 z-20 [&>tr]:first:shadow-small"
      }
    },
    isSelectable: {
      true: {
        tr: "cursor-default",
        td: [
          "group-aria-[selected=false]/tr:group-data-[hover=true]/tr:before:bg-default-100",
          "group-aria-[selected=false]/tr:group-data-[hover=true]/tr:before:opacity-70"
        ]
      }
    },
    isMultiSelectable: {
      true: {
        td: [
          // first
          "group-data-[first=true]/tr:first:before:rounded-ss-lg",
          "group-data-[first=true]/tr:last:before:rounded-se-lg",
          // middle
          "group-data-[middle=true]/tr:before:rounded-none",
          // last
          "group-data-[last=true]/tr:first:before:rounded-es-lg",
          "group-data-[last=true]/tr:last:before:rounded-ee-lg"
        ]
      },
      false: {
        td: ["first:before:rounded-s-lg", "last:before:rounded-e-lg"]
      }
    },
    radius: {
      none: {
        wrapper: "rounded-none",
        th: [
          "first:rounded-s-none",
          "first:before:rounded-s-none",
          "last:rounded-e-none",
          "last:before:rounded-e-none"
        ],
        td: [
          "first:before:rounded-s-none",
          "last:before:rounded-e-none",
          "group-data-[first=true]/tr:first:before:rounded-ss-none",
          "group-data-[first=true]/tr:last:before:rounded-se-none",
          "group-data-[last=true]/tr:first:before:rounded-es-none",
          "group-data-[last=true]/tr:last:before:rounded-ee-none"
        ]
      },
      sm: {
        wrapper: "rounded-small"
      },
      md: {
        wrapper: "rounded-medium"
      },
      lg: {
        wrapper: "rounded-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        wrapper: "w-full",
        table: "w-full"
      }
    },
    align: {
      start: {
        th: "text-start",
        td: "text-start"
      },
      center: {
        th: "text-center",
        td: "text-center"
      },
      end: {
        th: "text-end",
        td: "text-end"
      }
    }
  },
  defaultVariants: {
    layout: "auto",
    shadow: "sm",
    radius: "lg",
    color: "default",
    isCompact: false,
    hideHeader: false,
    isStriped: false,
    fullWidth: true,
    align: "start"
  },
  compoundVariants: [
    {
      isStriped: true,
      color: "default",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-default/60"
      }
    },
    {
      isStriped: true,
      color: "primary",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-primary/20"
      }
    },
    {
      isStriped: true,
      color: "secondary",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-secondary/20"
      }
    },
    {
      isStriped: true,
      color: "success",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-success/20"
      }
    },
    {
      isStriped: true,
      color: "warning",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-warning/20"
      }
    },
    {
      isStriped: true,
      color: "danger",
      class: {
        td: "group-data-[odd=true]/tr:data-[selected=true]/tr:before:bg-danger/20"
      }
    }
  ]
});
var tabs = tv({
  slots: {
    base: "inline-flex",
    tabList: [
      "flex",
      "p-1",
      "h-fit",
      "gap-2",
      "items-center",
      "flex-nowrap",
      "overflow-x-scroll",
      "scrollbar-hide",
      "bg-default-100"
    ],
    tab: [
      "z-0",
      "w-full",
      "px-3",
      "py-1",
      "flex",
      "group",
      "relative",
      "justify-center",
      "items-center",
      "outline-hidden",
      "cursor-pointer",
      "transition-opacity",
      "tap-highlight-transparent",
      "data-[disabled=true]:cursor-not-allowed",
      "data-[disabled=true]:opacity-30",
      "data-[hover-unselected=true]:opacity-disabled",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    tabContent: [
      "relative",
      "z-10",
      "text-inherit",
      "whitespace-nowrap",
      "transition-colors",
      "text-default-500",
      "group-data-[selected=true]:text-foreground"
    ],
    cursor: ["absolute", "z-0", "bg-white"],
    panel: [
      "py-3",
      "px-1",
      "outline-hidden",
      "data-[inert=true]:hidden",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    tabWrapper: []
  },
  variants: {
    variant: {
      solid: {
        cursor: "inset-0"
      },
      light: {
        tabList: "bg-transparent dark:bg-transparent",
        cursor: "inset-0"
      },
      underlined: {
        tabList: "bg-transparent dark:bg-transparent",
        cursor: "h-[2px] w-[80%] bottom-0 shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]"
      },
      bordered: {
        tabList: "bg-transparent dark:bg-transparent border-medium border-default-200 shadow-xs",
        cursor: "inset-0"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        tabList: "rounded-medium",
        tab: "h-7 text-tiny rounded-small",
        cursor: "rounded-small"
      },
      md: {
        tabList: "rounded-medium",
        tab: "h-8 text-small rounded-small",
        cursor: "rounded-small"
      },
      lg: {
        tabList: "rounded-large",
        tab: "h-9 text-medium rounded-medium",
        cursor: "rounded-medium"
      }
    },
    radius: {
      none: {
        tabList: "rounded-none",
        tab: "rounded-none",
        cursor: "rounded-none"
      },
      sm: {
        tabList: "rounded-medium",
        tab: "rounded-small",
        cursor: "rounded-small"
      },
      md: {
        tabList: "rounded-medium",
        tab: "rounded-small",
        cursor: "rounded-small"
      },
      lg: {
        tabList: "rounded-large",
        tab: "rounded-medium",
        cursor: "rounded-medium"
      },
      full: {
        tabList: "rounded-full",
        tab: "rounded-full",
        cursor: "rounded-full"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        tabList: "w-full"
      }
    },
    isDisabled: {
      true: {
        tabList: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        tab: "transition-none",
        tabContent: "transition-none"
      }
    },
    placement: {
      top: {},
      start: {
        tabList: "flex-col",
        panel: "py-0 px-3",
        tabWrapper: "flex"
      },
      end: {
        tabList: "flex-col",
        panel: "py-0 px-3",
        tabWrapper: "flex flex-row-reverse"
      },
      bottom: {
        tabWrapper: "flex flex-col-reverse"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "solid",
    size: "md",
    fullWidth: false,
    isDisabled: false
  },
  compoundVariants: [
    /**
     * Variants & Colors
     */
    // solid + bordered + light && color
    {
      variant: ["solid", "bordered", "light"],
      color: "default",
      class: {
        cursor: ["bg-background", "dark:bg-default", "shadow-small"],
        tabContent: "group-data-[selected=true]:text-default-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "primary",
      class: {
        cursor: colorVariants.solid.primary,
        tabContent: "group-data-[selected=true]:text-primary-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "secondary",
      class: {
        cursor: colorVariants.solid.secondary,
        tabContent: "group-data-[selected=true]:text-secondary-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "success",
      class: {
        cursor: colorVariants.solid.success,
        tabContent: "group-data-[selected=true]:text-success-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "warning",
      class: {
        cursor: colorVariants.solid.warning,
        tabContent: "group-data-[selected=true]:text-warning-foreground"
      }
    },
    {
      variant: ["solid", "bordered", "light"],
      color: "danger",
      class: {
        cursor: colorVariants.solid.danger,
        tabContent: "group-data-[selected=true]:text-danger-foreground"
      }
    },
    // underlined && color
    {
      variant: "underlined",
      color: "default",
      class: {
        cursor: "bg-foreground",
        tabContent: "group-data-[selected=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        cursor: "bg-primary",
        tabContent: "group-data-[selected=true]:text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        cursor: "bg-secondary",
        tabContent: "group-data-[selected=true]:text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        cursor: "bg-success",
        tabContent: "group-data-[selected=true]:text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        cursor: "bg-warning",
        tabContent: "group-data-[selected=true]:text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        cursor: "bg-danger",
        tabContent: "group-data-[selected=true]:text-danger"
      }
    },
    /**
     * Disable animation & Variants & Colors
     */
    // disabledAnimation && underlined
    {
      disableAnimation: true,
      variant: "underlined",
      class: {
        tab: [
          "after:content-['']",
          "after:absolute",
          "after:bottom-0",
          "after:h-[2px]",
          "after:w-[80%]",
          "after:opacity-0",
          "after:shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "data-[selected=true]:after:opacity-100"
        ]
      }
    },
    // disableAnimation && color && solid/bordered
    {
      disableAnimation: true,
      color: "default",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-default data-[selected=true]:text-default-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "primary",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "secondary",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-secondary data-[selected=true]:text-secondary-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "success",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-success data-[selected=true]:text-success-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "warning",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-warning data-[selected=true]:text-warning-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "danger",
      variant: ["solid", "bordered", "light"],
      class: {
        tab: "data-[selected=true]:bg-danger data-[selected=true]:text-danger-foreground"
      }
    },
    // disableAnimation && color && underlined
    {
      disableAnimation: true,
      color: "default",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-foreground"
      }
    },
    {
      disableAnimation: true,
      color: "primary",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-primary"
      }
    },
    {
      disableAnimation: true,
      color: "secondary",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-secondary"
      }
    },
    {
      disableAnimation: true,
      color: "success",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-success"
      }
    },
    {
      disableAnimation: true,
      color: "warning",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-warning"
      }
    },
    {
      disableAnimation: true,
      color: "danger",
      variant: "underlined",
      class: {
        tab: "data-[selected=true]:after:bg-danger"
      }
    }
  ],
  compoundSlots: [
    {
      variant: "underlined",
      slots: ["tab", "tabList", "cursor"],
      class: ["rounded-none"]
    }
  ]
});
var toastRegion = tv({
  slots: {
    base: "relative z-[100]"
  },
  variants: {
    disableAnimation: {
      false: {
        base: ""
      },
      true: {
        base: [
          "data-[placement=bottom-right]:bottom-0 data-[placement=bottom-right]:right-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-right]:fixed data-[placement=bottom-right]:flex data-[placement=bottom-right]:flex-col",
          "data-[placement=bottom-left]:bottom-0 data-[placement=bottom-left]:left-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-left]:fixed data-[placement=bottom-left]:flex data-[placement=bottom-left]:flex-col",
          "data-[placement=bottom-center]:bottom-0 data-[placement=bottom-center]:fixed w-full px-2 sm:w-auto sm:px-0 data-[placement=bottom-center]:flex data-[placement=bottom-center]:flex-col data-[placement=bottom-center]:left-1/2 data-[placement=bottom-center]:-translate-x-1/2",
          "data-[placement=top-right]:top-0 data-[placement=top-right]:right-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=top-right]:fixed data-[placement=top-right]:flex data-[placement=top-right]:flex-col",
          "data-[placement=top-left]:top-0 data-[placement=top-left]:left-0 w-full px-2 sm:w-auto sm:px-0 data-[placement=top-left]:fixed data-[placement=top-left]:flex data-[placement=top-left]:flex-col",
          "data-[placement=top-center]:top-0 data-[placement=top-center]:fixed w-full px-2 sm:w-auto sm:px-0 data-[placement=top-center]:flex data-[placement=top-center]:flex-col data-[placement=top-center]:left-1/2 data-[placement=top-center]:-translate-x-1/2"
        ]
      }
    }
  },
  defaultVariants: {
    disableAnimation: false
  }
});
var toast$1 = tv({
  slots: {
    base: [
      "flex gap-x-4 items-center",
      "group",
      "cursor-pointer",
      "relative",
      "z-50",
      "box-border",
      "outline-hidden",
      "p-3 sm:mx-1",
      "my-1",
      "w-full sm:w-[356px]",
      "min-h-4",
      "before:content-['']",
      "before:absolute",
      "before:left-0",
      "before:right-0",
      "data-[placement=bottom-right]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-left]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-center]:before:h-[var(--top-extension,16px)]",
      "data-[placement=bottom-right]:before:top-[calc(-1*var(--top-extension,16px))]",
      "data-[placement=bottom-left]:before:top-[calc(-1*var(--top-extension,16px))]",
      "data-[placement=bottom-center]:before:top-[calc(-1*var(--top-extension,16px))]",
      "before:z-[-1]",
      "before:pointer-events-auto",
      "before:bg-transparent",
      "after:content-['']",
      "after:absolute",
      "after:left-0",
      "after:right-0",
      "data-[placement=bottom-right]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-left]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-center]:after:h-[var(--bottom-extension,16px)]",
      "data-[placement=bottom-right]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "data-[placement=bottom-left]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "data-[placement=bottom-center]:after:bottom-[calc(-1*var(--bottom-extension,16px))]",
      "after:z-[-1]",
      "after:pointer-events-auto",
      "after:bg-transparent",
      "transform-gpu",
      "will-change-transform",
      "backface-visibility-hidden"
    ],
    wrapper: ["flex flex-col gap-y-0"],
    title: ["text-sm", "me-4", "font-medium", "text-foreground"],
    description: ["text-sm", "me-4", "text-default-500"],
    icon: ["w-6 h-6 flex-none fill-current"],
    loadingComponent: ["w-6 h-6 flex-none fill-current"],
    content: ["flex flex-grow flex-row gap-x-4 items-center relative"],
    progressTrack: ["absolute inset-0 pointer-events-none bg-transparent overflow-hidden"],
    progressIndicator: ["h-full bg-default-400 opacity-20"],
    motionDiv: [
      "fixed",
      "px-4 sm:px-0",
      "data-[placement=bottom-right]:bottom-0 data-[placement=bottom-right]:right-0 data-[placement=bottom-right]:mx-auto w-full sm:data-[placement=bottom-right]:w-max mb-1 sm:data-[placement=bottom-right]:mr-2",
      "data-[placement=bottom-left]:bottom-0 data-[placement=bottom-left]:left-0 data-[placement=bottom-left]:mx-auto w-full sm:data-[placement=bottom-left]:w-max mb-1 sm:data-[placement=bottom-left]:ml-2",
      "data-[placement=bottom-center]:bottom-0 data-[placement=bottom-center]:left-0 data-[placement=bottom-center]:right-0 w-full sm:data-[placement=bottom-center]:w-max sm:data-[placement=bottom-center]:mx-auto",
      "data-[placement=top-right]:top-0 data-[placement=top-right]:right-0 data-[placement=top-right]:mx-auto w-full sm:data-[placement=top-right]:w-max sm:data-[placement=top-right]:mr-2",
      "data-[placement=top-left]:top-0 data-[placement=top-left]:left-0 data-[placement=top-left]:mx-auto w-full sm:data-[placement=top-left]:w-max sm:data-[placement=top-left]:ml-2",
      "data-[placement=top-center]:top-0 data-[placement=top-center]:left-0 data-[placement=top-center]:right-0 w-full sm:data-[placement=top-center]:w-max sm:data-[placement=top-center]:mx-auto"
    ],
    closeButton: [
      "opacity-0 group-hover:opacity-100",
      "transform-gpu",
      "transition-all duration-200 ease-out",
      "will-change-opacity will-change-transform",
      "p-0 group-hover:pointer-events-auto w-6 h-6 min-w-4 absolute -right-2 -top-2 items-center justify-center bg-transparent text-default-400 hover:text-default-600 border border-3 border-transparent",
      "data-[hidden=true]:hidden"
    ],
    closeIcon: ["rounded-full w-full h-full p-0.5 border border-default-400 bg-default-100"]
  },
  variants: {
    size: {
      sm: {
        icon: "w-5 h-5",
        loadingComponent: "w-5 h-5"
      },
      md: {},
      lg: {}
    },
    variant: {
      flat: "bg-content1 border border-default-100",
      solid: colorVariants.solid.default,
      bordered: "bg-background border border-default-200"
    },
    color: {
      default: "",
      foreground: {
        progressIndicator: "h-full opacity-20 bg-foreground-400"
      },
      primary: {
        progressIndicator: "h-full opacity-20 bg-primary-400"
      },
      secondary: {
        progressIndicator: "h-full opacity-20 bg-secondary-400"
      },
      success: {
        progressIndicator: "h-full opacity-20 bg-success-400"
      },
      warning: {
        progressIndicator: "h-full opacity-20 bg-warning-400"
      },
      danger: {
        progressIndicator: "h-full opacity-20 bg-danger-400"
      }
    },
    radius: {
      none: {
        base: "rounded-none",
        progressTrack: "rounded-none"
      },
      sm: {
        base: "rounded-small",
        progressTrack: "rounded-small"
      },
      md: {
        base: "rounded-medium",
        progressTrack: "rounded-medium"
      },
      lg: {
        base: "rounded-large",
        progressTrack: "rounded-large"
      },
      full: {
        base: "rounded-full",
        closeButton: "-top-px -right-px",
        progressTrack: "rounded-full"
      }
    },
    disableAnimation: {
      true: {
        closeButton: "transition-none",
        base: "data-[animation=exiting]:opacity-0 transition-none"
      },
      false: {
        closeButton: "transition-all ease-out duration-200",
        base: [
          "data-[toast-exiting=true]:transform-gpu",
          "data-[toast-exiting=true]:will-change-transform",
          "data-[toast-exiting=true]:transition-all",
          "data-[toast-exiting=true]:ease-out",
          "data-[toast-exiting=true]:data-[placement=bottom-right]:translate-x-full",
          "data-[toast-exiting=true]:data-[placement=bottom-left]:-translate-x-full",
          "data-[toast-exiting=true]:data-[placement=bottom-center]:translate-y-full",
          "data-[toast-exiting=true]:data-[placement=top-right]:translate-x-full",
          "data-[toast-exiting=true]:data-[placement=top-left]:-translate-x-full",
          "data-[toast-exiting=true]:data-[placement=top-center]:-translate-y-full",
          "data-[toast-exiting=true]:opacity-0",
          "data-[toast-exiting=true]:duration-300",
          "data-[toast-exiting=true]:ease-out"
        ]
      }
    },
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    }
  },
  defaultVariants: {
    size: "md",
    variant: "flat",
    radius: "md",
    shadow: "sm"
  },
  compoundVariants: [
    // flat and color
    {
      variant: "flat",
      color: "foreground",
      class: {
        base: "bg-foreground text-background",
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background-600",
        description: "text-background-500"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: "bg-primary-50 text-primary-600 border-primary-100",
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-600",
        description: "text-primary-500"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: "bg-secondary-50 text-secondary-600 border-secondary-100",
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-600",
        description: "text-secondary-500"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: "bg-success-50 text-success-600 border-success-100",
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-600",
        description: "text-success-500"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: "bg-warning-50 text-warning-600 border-warning-100",
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-600",
        description: "text-warning-500"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: "bg-danger-50 text-danger-600 border-danger-100",
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-600",
        description: "text-danger-500"
      }
    },
    // bordered and color
    {
      variant: "bordered",
      color: "foreground",
      class: {
        base: "bg-foreground border-foreground-400 text-background",
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background-600",
        description: "text-background-500"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: "border-primary-400 text-primary-600",
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-600",
        description: "text-primary-500"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: "border-secondary-400 text-secondary-600",
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-600",
        description: "text-secondary-500"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: "border-success-400 text-success-600",
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-600",
        description: "text-success-500"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: "border-warning-400 text-warning-600",
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-600",
        description: "text-warning-500"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: "border-danger-400 text-danger-600",
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-600",
        description: "text-danger-500"
      }
    },
    // solid and color
    {
      variant: "solid",
      color: "foreground",
      class: {
        base: colorVariants.solid.foreground,
        closeButton: "text-foreground-400 hover:text-foreground-600",
        closeIcon: "border border-foreground-400 bg-foreground-100",
        title: "text-background",
        description: "text-background"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary,
        closeButton: "text-primary-400 hover:text-primary-600",
        closeIcon: "border border-primary-400 bg-primary-100",
        title: "text-primary-foreground",
        description: "text-primary-foreground"
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary,
        closeButton: "text-secondary-400 hover:text-secondary-600",
        closeIcon: "border border-secondary-400 bg-secondary-100",
        title: "text-secondary-foreground",
        description: "text-secondary-foreground"
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success,
        closeButton: "text-success-400 hover:text-success-600",
        closeIcon: "border border-success-400 bg-success-100",
        title: "text-success-foreground",
        description: "text-success-foreground"
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning,
        closeButton: "text-warning-400 hover:text-warning-600",
        closeIcon: "border border-warning-400 bg-warning-100",
        title: "text-warning-foreground",
        description: "text-warning-foreground"
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger,
        closeButton: "text-danger-400 hover:text-danger-600",
        closeIcon: "border border-danger-400 bg-danger-100",
        title: "text-danger-foreground",
        description: "text-danger-foreground"
      }
    }
  ]
});
var toggle = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer touch-none tap-highlight-transparent select-none",
    wrapper: [
      "px-1",
      "relative",
      "inline-flex",
      "items-center",
      "justify-start",
      "shrink-0",
      "overflow-hidden",
      "bg-default-200",
      "rounded-full",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    thumb: [
      "z-10",
      "flex",
      "items-center",
      "justify-center",
      "bg-white",
      "shadow-small",
      "rounded-full",
      "origin-right",
      "pointer-events-none"
    ],
    hiddenInput: hiddenInputClasses,
    startContent: "z-0 absolute start-1.5 text-current",
    endContent: "z-0 absolute end-1.5 text-default-600",
    thumbIcon: "text-black",
    label: "relative text-foreground select-none ms-2"
  },
  variants: {
    color: {
      default: {
        wrapper: [
          "group-data-[selected=true]:bg-default-400",
          "group-data-[selected=true]:text-default-foreground"
        ]
      },
      primary: {
        wrapper: [
          "group-data-[selected=true]:bg-primary",
          "group-data-[selected=true]:text-primary-foreground"
        ]
      },
      secondary: {
        wrapper: [
          "group-data-[selected=true]:bg-secondary",
          "group-data-[selected=true]:text-secondary-foreground"
        ]
      },
      success: {
        wrapper: [
          "group-data-[selected=true]:bg-success",
          "group-data-[selected=true]:text-success-foreground"
        ]
      },
      warning: {
        wrapper: [
          "group-data-[selected=true]:bg-warning",
          "group-data-[selected=true]:text-warning-foreground"
        ]
      },
      danger: {
        wrapper: [
          "group-data-[selected=true]:bg-danger",
          "data-[selected=true]:text-danger-foreground"
        ]
      }
    },
    size: {
      sm: {
        wrapper: "w-10 h-6",
        thumb: [
          "w-4 h-4 text-tiny",
          //selected
          "group-data-[selected=true]:ms-4"
        ],
        endContent: "text-tiny",
        startContent: "text-tiny",
        label: "text-small"
      },
      md: {
        wrapper: "w-12 h-7",
        thumb: [
          "w-5 h-5 text-small",
          //selected
          "group-data-[selected=true]:ms-5"
        ],
        endContent: "text-small",
        startContent: "text-small",
        label: "text-medium"
      },
      lg: {
        wrapper: "w-14 h-8",
        thumb: [
          "w-6 h-6 text-medium",
          //selected
          "group-data-[selected=true]:ms-6"
        ],
        endContent: "text-medium",
        startContent: "text-medium",
        label: "text-large"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        wrapper: "transition-none",
        thumb: "transition-none"
      },
      false: {
        wrapper: "transition-background",
        thumb: "transition-all",
        startContent: [
          "opacity-0",
          "scale-50",
          "transition-transform-opacity",
          "group-data-[selected=true]:scale-100",
          "group-data-[selected=true]:opacity-100"
        ],
        endContent: [
          "opacity-100",
          "transition-transform-opacity",
          "group-data-[selected=true]:translate-x-3",
          "group-data-[selected=true]:opacity-0"
        ]
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false
  },
  compoundVariants: [
    {
      disableAnimation: false,
      size: "sm",
      class: {
        thumb: ["group-data-[pressed=true]:w-5", "group-data-[selected]:group-data-[pressed]:ml-3"]
      }
    },
    {
      disableAnimation: false,
      size: "md",
      class: {
        thumb: ["group-data-[pressed=true]:w-6", "group-data-[selected]:group-data-[pressed]:ml-4"]
      }
    },
    {
      disableAnimation: false,
      size: "lg",
      class: {
        thumb: ["group-data-[pressed=true]:w-7", "group-data-[selected]:group-data-[pressed]:ml-5"]
      }
    }
  ]
});
var pagination = tv({
  slots: {
    base: ["p-2.5", "-m-2.5", "overflow-x-scroll", "scrollbar-hide"],
    wrapper: [
      "flex",
      "flex-nowrap",
      "h-fit",
      "max-w-fit",
      "relative",
      "gap-1",
      "items-center",
      "overflow-visible"
    ],
    item: ["tap-highlight-transparent", "select-none", "touch-none"],
    prev: "",
    next: "",
    cursor: [
      "absolute",
      "flex",
      "overflow-visible",
      "items-center",
      "justify-center",
      "origin-center",
      "left-0",
      "select-none",
      "touch-none",
      "pointer-events-none",
      "z-20"
    ],
    forwardIcon: [
      "hidden",
      "group-hover:block",
      "group-data-[focus-visible=true]:block",
      "data-[before=true]:rotate-180"
    ],
    ellipsis: "group-hover:hidden group-data-[focus-visible=true]:hidden",
    chevronNext: "rotate-180"
  },
  variants: {
    variant: {
      bordered: {
        item: [
          "border-medium",
          "border-default",
          "bg-transparent",
          "data-[hover=true]:bg-default-100"
        ]
      },
      light: {
        item: "bg-transparent"
      },
      flat: {},
      faded: {
        item: ["border-medium", "border-default"]
      }
    },
    color: {
      default: {
        cursor: colorVariants.solid.default
      },
      primary: {
        cursor: colorVariants.solid.primary
      },
      secondary: {
        cursor: colorVariants.solid.secondary
      },
      success: {
        cursor: colorVariants.solid.success
      },
      warning: {
        cursor: colorVariants.solid.warning
      },
      danger: {
        cursor: colorVariants.solid.danger
      }
    },
    size: {
      sm: {},
      md: {},
      lg: {}
    },
    radius: {
      none: {},
      sm: {},
      md: {},
      lg: {},
      full: {}
    },
    isCompact: {
      true: {
        wrapper: "gap-0 shadow-xs",
        item: [
          "shadow-none",
          "first-of-type:rounded-e-none",
          "last-of-type:rounded-s-none",
          "[&:not(:first-of-type):not(:last-of-type)]:rounded-none"
        ],
        prev: "!rounded-e-none",
        next: "!rounded-s-none"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    showShadow: {
      true: {}
    },
    disableCursorAnimation: {
      true: {
        cursor: "hidden"
      }
    },
    disableAnimation: {
      true: {
        item: "transition-none",
        cursor: "transition-none"
      },
      false: {
        item: ["data-[pressed=true]:scale-[0.97]", "transition-transform-background"],
        cursor: [
          "data-[moving=true]:transition-transform",
          "!data-[moving=true]:duration-300",
          // this hides the cursor and only shows it once it has been moved to its initial position
          "opacity-0",
          "data-[moving]:opacity-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "primary",
    size: "md",
    radius: "md",
    isCompact: false,
    isDisabled: false,
    showShadow: false,
    disableCursorAnimation: false
  },
  compoundVariants: [
    // showShadow / color
    {
      showShadow: true,
      color: "default",
      class: {
        cursor: [colorVariants.shadow.default, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "primary",
      class: {
        cursor: [colorVariants.shadow.primary, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "secondary",
      class: {
        cursor: [colorVariants.shadow.secondary, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "success",
      class: {
        cursor: [colorVariants.shadow.success, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "warning",
      class: {
        cursor: [colorVariants.shadow.warning, "shadow-md"]
      }
    },
    {
      showShadow: true,
      color: "danger",
      class: {
        cursor: [colorVariants.shadow.danger, "shadow-md"]
      }
    },
    // isCompact / bordered
    {
      isCompact: true,
      variant: "bordered",
      class: {
        item: "[&:not(:first-of-type)]:ms-[calc(theme(borderWidth.2)*-1)]"
      }
    },
    /**
     * --------------------------------------------------------
     * disableCursorAnimation
     * the classNames will be applied to the active item
     * --------------------------------------------------------
     */
    // disableCursorAnimation / color
    {
      disableCursorAnimation: true,
      color: "default",
      class: {
        item: [
          "data-[active=true]:bg-default-400",
          "data-[active=true]:border-default-400",
          "data-[active=true]:text-default-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "primary",
      class: {
        item: [
          "data-[active=true]:bg-primary",
          "data-[active=true]:border-primary",
          "data-[active=true]:text-primary-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "secondary",
      class: {
        item: [
          "data-[active=true]:bg-secondary",
          "data-[active=true]:border-secondary",
          "data-[active=true]:text-secondary-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "success",
      class: {
        item: [
          "data-[active=true]:bg-success",
          "data-[active=true]:border-success",
          "data-[active=true]:text-success-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "warning",
      class: {
        item: [
          "data-[active=true]:bg-warning",
          "data-[active=true]:border-warning",
          "data-[active=true]:text-warning-foreground"
        ]
      }
    },
    {
      disableCursorAnimation: true,
      color: "danger",
      class: {
        item: [
          "data-[active=true]:bg-danger",
          "data-[active=true]:border-danger",
          "data-[active=true]:text-danger-foreground"
        ]
      }
    },
    // shadow / color
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "default",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-default/50"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "primary",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-primary/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "secondary",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-secondary/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "success",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-success/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "warning",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-warning/40"]
      }
    },
    {
      disableCursorAnimation: true,
      showShadow: true,
      color: "danger",
      class: {
        item: ["data-[active=true]:shadow-md", "data-[active=true]:shadow-danger/40"]
      }
    }
  ],
  compoundSlots: [
    // without variant
    {
      slots: ["item", "prev", "next"],
      class: [
        "flex",
        "flex-wrap",
        "truncate",
        "box-border",
        "outline-hidden",
        "items-center",
        "justify-center",
        "text-default-foreground",
        // focus ring
        ...dataFocusVisibleClasses,
        // disabled
        "data-[disabled=true]:text-default-300",
        "data-[disabled=true]:pointer-events-none"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: ["flat", "bordered", "faded"],
      class: ["shadow-xs"]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "flat",
      class: [
        "bg-default-100",
        "[&[data-hover=true]:not([data-active=true])]:bg-default-200",
        "active:bg-default-300"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "faded",
      class: [
        "bg-default-50",
        "[&[data-hover=true]:not([data-active=true])]:bg-default-100",
        "active:bg-default-200"
      ]
    },
    {
      slots: ["item", "prev", "next"],
      variant: "light",
      class: [
        "[&[data-hover=true]:not([data-active=true])]:bg-default-100",
        "active:bg-default-200"
      ]
    },
    // size
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "sm",
      class: "min-w-8 w-8 h-8 text-tiny"
    },
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "md",
      class: "min-w-9 w-9 h-9 text-small"
    },
    {
      slots: ["item", "cursor", "prev", "next"],
      size: "lg",
      class: "min-w-10 w-10 h-10 text-medium"
    },
    // radius
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "none",
      class: "rounded-none"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "sm",
      class: "rounded-small"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "md",
      class: "rounded-medium"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "lg",
      class: "rounded-large"
    },
    {
      slots: ["wrapper", "item", "cursor", "prev", "next"],
      radius: "full",
      class: "rounded-full"
    }
  ]
});
var popover = tv({
  slots: {
    base: [
      "z-0",
      "relative",
      "bg-transparent",
      // arrow
      "before:content-['']",
      "before:hidden",
      "before:z-[-1]",
      "before:absolute",
      "before:rotate-45",
      "before:w-2.5",
      "before:h-2.5",
      "before:rounded-sm",
      // visibility
      "data-[arrow=true]:before:block",
      // top
      "data-[placement=top]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top]:before:left-1/2",
      "data-[placement=top]:before:-translate-x-1/2",
      "data-[placement=top-start]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top-start]:before:left-3",
      "data-[placement=top-end]:before:-bottom-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=top-end]:before:right-3",
      // bottom
      "data-[placement=bottom]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom]:before:left-1/2",
      "data-[placement=bottom]:before:-translate-x-1/2",
      "data-[placement=bottom-start]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom-start]:before:left-3",
      "data-[placement=bottom-end]:before:-top-[calc(theme(spacing.5)/4_-_1.5px)]",
      "data-[placement=bottom-end]:before:right-3",
      // left
      "data-[placement=left]:before:-right-[calc(theme(spacing.5)/4_-_2px)]",
      "data-[placement=left]:before:top-1/2",
      "data-[placement=left]:before:-translate-y-1/2",
      "data-[placement=left-start]:before:-right-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=left-start]:before:top-1/4",
      "data-[placement=left-end]:before:-right-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=left-end]:before:bottom-1/4",
      // right
      "data-[placement=right]:before:-left-[calc(theme(spacing.5)/4_-_2px)]",
      "data-[placement=right]:before:top-1/2",
      "data-[placement=right]:before:-translate-y-1/2",
      "data-[placement=right-start]:before:-left-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=right-start]:before:top-1/4",
      "data-[placement=right-end]:before:-left-[calc(theme(spacing.5)/4_-_3px)]",
      "data-[placement=right-end]:before:bottom-1/4",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    content: [
      "z-10",
      "px-2.5",
      "py-1",
      "w-full",
      "inline-flex",
      "flex-col",
      "items-center",
      "justify-center",
      "box-border",
      "subpixel-antialiased",
      "outline-hidden",
      "box-border"
    ],
    trigger: ["z-10"],
    backdrop: ["hidden"],
    arrow: []
  },
  variants: {
    size: {
      sm: { content: "text-tiny" },
      md: { content: "text-small" },
      lg: { content: "text-medium" }
    },
    color: {
      default: {
        base: "before:bg-content1 before:shadow-small",
        content: "bg-content1"
      },
      foreground: {
        base: "before:bg-foreground",
        content: colorVariants.solid.foreground
      },
      primary: {
        base: "before:bg-primary",
        content: colorVariants.solid.primary
      },
      secondary: {
        base: "before:bg-secondary",
        content: colorVariants.solid.secondary
      },
      success: {
        base: "before:bg-success",
        content: colorVariants.solid.success
      },
      warning: {
        base: "before:bg-warning",
        content: colorVariants.solid.warning
      },
      danger: {
        base: "before:bg-danger",
        content: colorVariants.solid.danger
      }
    },
    radius: {
      none: { content: "rounded-none" },
      sm: { content: "rounded-small" },
      md: { content: "rounded-medium" },
      lg: { content: "rounded-large" },
      full: { content: "rounded-full" }
    },
    shadow: {
      none: {
        content: "shadow-none"
      },
      sm: {
        content: "shadow-small"
      },
      md: {
        content: "shadow-medium"
      },
      lg: {
        content: "shadow-large"
      }
    },
    backdrop: {
      transparent: {},
      opaque: {
        backdrop: "bg-overlay/50 backdrop-opacity-disabled"
      },
      blur: {
        backdrop: "backdrop-blur-sm backdrop-saturate-150 bg-overlay/30"
      }
    },
    triggerScaleOnOpen: {
      true: {
        trigger: ["aria-expanded:scale-[0.97]", "aria-expanded:opacity-70", "subpixel-antialiased"]
      },
      false: {}
    },
    disableAnimation: {
      true: {
        base: "animate-none"
      }
    },
    isTriggerDisabled: {
      true: {
        trigger: "opacity-disabled pointer-events-none"
      },
      false: {}
    }
  },
  defaultVariants: {
    color: "default",
    radius: "lg",
    size: "md",
    shadow: "md",
    backdrop: "transparent",
    triggerScaleOnOpen: true
  },
  compoundVariants: [
    // backdrop (opaque/blur)
    {
      backdrop: ["opaque", "blur"],
      class: {
        backdrop: "block w-full h-full fixed inset-0 -z-30"
      }
    }
  ]
});
var progress = tv(
  {
    slots: {
      base: "flex flex-col gap-2 w-full",
      label: "",
      labelWrapper: "flex justify-between",
      value: "",
      track: "z-0 relative bg-default-300/50 overflow-hidden rtl:rotate-180",
      indicator: "h-full"
    },
    variants: {
      color: {
        default: {
          indicator: "bg-default-400"
        },
        primary: {
          indicator: "bg-primary"
        },
        secondary: {
          indicator: "bg-secondary"
        },
        success: {
          indicator: "bg-success"
        },
        warning: {
          indicator: "bg-warning"
        },
        danger: {
          indicator: "bg-danger"
        }
      },
      size: {
        sm: {
          label: "text-small",
          value: "text-small",
          track: "h-1"
        },
        md: {
          label: "text-medium",
          value: "text-medium",
          track: "h-3"
        },
        lg: {
          label: "text-large",
          value: "text-large",
          track: "h-5"
        }
      },
      radius: {
        none: {
          track: "rounded-none",
          indicator: "rounded-none"
        },
        sm: {
          track: "rounded-small",
          indicator: "rounded-small"
        },
        md: {
          track: "rounded-medium",
          indicator: "rounded-medium"
        },
        lg: {
          track: "rounded-large",
          indicator: "rounded-large"
        },
        full: {
          track: "rounded-full",
          indicator: "rounded-full"
        }
      },
      isStriped: {
        true: {
          indicator: "bg-stripe-gradient-default bg-stripe-size"
        }
      },
      isIndeterminate: {
        true: {
          indicator: ["absolute", "w-full", "origin-left", "animate-indeterminate-bar"]
        }
      },
      isDisabled: {
        true: {
          base: "opacity-disabled cursor-not-allowed"
        }
      },
      disableAnimation: {
        true: {},
        false: {
          indicator: "transition-transform !duration-500"
        }
      }
    },
    defaultVariants: {
      color: "primary",
      size: "md",
      radius: "full",
      isStriped: false,
      isIndeterminate: false,
      isDisabled: false
    },
    compoundVariants: [
      // disableAnimation && !isIndeterminate
      {
        disableAnimation: true,
        isIndeterminate: false,
        class: {
          indicator: "!transition-none motion-reduce:transition-none"
        }
      },
      {
        color: "primary",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-primary bg-stripe-size"
        }
      },
      {
        color: "secondary",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-secondary bg-stripe-size"
        }
      },
      {
        color: "success",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-success bg-stripe-size"
        }
      },
      {
        color: "warning",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-warning bg-stripe-size"
        }
      },
      {
        color: "danger",
        isStriped: true,
        class: {
          indicator: "bg-stripe-gradient-danger bg-stripe-size"
        }
      }
    ]
  },
  {
    twMerge: true
  }
);
var circularProgress = tv({
  slots: {
    base: "flex flex-col justify-center gap-1 max-w-fit items-center",
    label: "",
    svgWrapper: "relative block",
    svg: "z-0 relative overflow-hidden",
    track: "h-full stroke-default-300/50",
    indicator: "h-full stroke-current",
    value: "absolute font-normal inset-0 flex items-center justify-center"
  },
  variants: {
    color: {
      default: {
        svg: "text-default-400"
      },
      primary: {
        svg: "text-primary"
      },
      secondary: {
        svg: "text-secondary"
      },
      success: {
        svg: "text-success"
      },
      warning: {
        svg: "text-warning"
      },
      danger: {
        svg: "text-danger"
      }
    },
    size: {
      sm: {
        svg: "w-8 h-8",
        label: "text-small",
        value: "text-[0.5rem]"
      },
      md: {
        svg: "w-10 h-10",
        label: "text-small",
        value: "text-[0.55rem]"
      },
      lg: {
        svg: "w-12 h-12",
        label: "text-medium",
        value: "text-[0.6rem]"
      }
    },
    isIndeterminate: {
      true: {
        svg: "animate-spinner-ease-spin"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled cursor-not-allowed"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        indicator: "transition-all !duration-500"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false
  },
  compoundVariants: [
    // disableAnimation && !isIndeterminate
    {
      disableAnimation: true,
      isIndeterminate: false,
      class: {
        svg: "!transition-none motion-reduce:transition-none"
      }
    }
  ]
});
var radio = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
    wrapper: [
      "relative",
      "inline-flex",
      "items-center",
      "justify-center",
      "shrink-0",
      "overflow-hidden",
      "border-solid",
      "border-medium",
      "box-border",
      "border-default",
      "rounded-full",
      "group-data-[hover-unselected=true]:bg-default-100",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    hiddenInput: hiddenInputClasses,
    labelWrapper: "flex flex-col ml-1",
    control: [
      "z-10",
      "w-2",
      "h-2",
      "opacity-0",
      "scale-0",
      "origin-center",
      "rounded-full",
      "group-data-[selected=true]:opacity-100",
      "group-data-[selected=true]:scale-100"
    ],
    label: "relative text-foreground select-none",
    description: "relative text-foreground-400"
  },
  variants: {
    color: {
      default: {
        control: "bg-default-500 text-default-foreground",
        wrapper: "group-data-[selected=true]:border-default-500"
      },
      primary: {
        control: "bg-primary text-primary-foreground",
        wrapper: "group-data-[selected=true]:border-primary"
      },
      secondary: {
        control: "bg-secondary text-secondary-foreground",
        wrapper: "group-data-[selected=true]:border-secondary"
      },
      success: {
        control: "bg-success text-success-foreground",
        wrapper: "group-data-[selected=true]:border-success"
      },
      warning: {
        control: "bg-warning text-warning-foreground",
        wrapper: "group-data-[selected=true]:border-warning"
      },
      danger: {
        control: "bg-danger text-danger-foreground",
        wrapper: "group-data-[selected=true]:border-danger"
      }
    },
    size: {
      sm: {
        wrapper: "w-4 h-4",
        control: "w-1.5 h-1.5",
        labelWrapper: "ml-1",
        label: "text-small",
        description: "text-tiny"
      },
      md: {
        wrapper: "w-5 h-5",
        control: "w-2 h-2",
        labelWrapper: "ms-2",
        label: "text-medium",
        description: "text-small"
      },
      lg: {
        wrapper: "w-6 h-6",
        control: "w-2.5 h-2.5",
        labelWrapper: "ms-2",
        label: "text-large",
        description: "text-medium"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        control: "bg-danger text-danger-foreground",
        wrapper: "border-danger group-data-[selected=true]:border-danger",
        label: "text-danger",
        description: "text-danger-300"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        wrapper: [
          "group-data-[pressed=true]:scale-95",
          "transition-transform-colors",
          "motion-reduce:transition-none"
        ],
        control: "transition-transform-opacity motion-reduce:transition-none",
        label: "transition-colors motion-reduce:transition-none",
        description: "transition-colors motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false,
    isInvalid: false
  }
});
var radioGroup = tv({
  slots: {
    base: "relative flex flex-col gap-2",
    label: "relative text-foreground-500",
    wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ml-0.5"
      }
    },
    isInvalid: {
      true: {
        description: "text-danger"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        description: "transition-colors !duration-150 motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    isInvalid: false,
    isRequired: false
  }
});
var verticalShadow = [
  "data-[top-scroll=true]:[mask-image:linear-gradient(0deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[bottom-scroll=true]:[mask-image:linear-gradient(180deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[top-bottom-scroll=true]:[mask-image:linear-gradient(#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
];
var horizontalShadow = [
  "data-[left-scroll=true]:[mask-image:linear-gradient(270deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[right-scroll=true]:[mask-image:linear-gradient(90deg,#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]",
  "data-[left-right-scroll=true]:[mask-image:linear-gradient(to_right,#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
];
var scrollShadow = tv({
  base: [],
  variants: {
    orientation: {
      vertical: ["overflow-y-auto", ...verticalShadow],
      horizontal: ["overflow-x-auto", ...horizontalShadow]
    },
    hideScrollBar: {
      true: "scrollbar-hide",
      false: ""
    }
  },
  defaultVariants: {
    orientation: "vertical",
    hideScrollBar: false
  }
});
var select = tv({
  slots: {
    base: ["group inline-flex flex-col relative"],
    label: [
      "block",
      "absolute",
      "z-10",
      "origin-top-left",
      "flex-shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "text-small",
      "text-foreground-500",
      "pointer-events-none",
      "group-data-[has-label-outside=true]:pointer-events-auto"
    ],
    mainWrapper: "w-full flex flex-col",
    trigger: "relative px-3 gap-3 w-full inline-flex flex-row items-center shadow-xs outline-hidden tap-highlight-transparent",
    innerWrapper: "inline-flex h-fit w-[calc(100%_-theme(spacing.6))] min-h-4 items-center gap-1.5 box-border",
    selectorIcon: "absolute end-3 w-4 h-4",
    spinner: "absolute end-3",
    value: ["text-foreground-500", "font-normal", "w-full", "text-start"],
    listboxWrapper: "scroll-py-6 w-full",
    listbox: "",
    popoverContent: "w-full p-1 overflow-hidden",
    clearButton: [
      "w-4",
      "h-4",
      "z-10",
      "mb-4",
      "relative",
      "start-auto",
      "appearance-none",
      "outline-none",
      "select-none",
      "opacity-70",
      "hover:!opacity-100",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "p-1 flex relative flex-col gap-1.5 group-data-[has-helper=true]:flex",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger",
    endWrapper: "flex end-18",
    endContent: "mb-4"
  },
  variants: {
    variant: {
      flat: {
        trigger: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-200"
        ],
        clearButton: "mb-4"
      },
      faded: {
        trigger: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 data-[focus=true]:border-default-400 data-[open=true]:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4"
      },
      bordered: {
        trigger: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "data-[open=true]:border-default-foreground",
          "data-[focus=true]:border-default-foreground"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4"
      },
      underlined: {
        trigger: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "data-[open=true]:after:w-full",
          "data-[focus=true]:after:w-full"
        ],
        value: "group-data-[has-value=true]:text-default-foreground",
        clearButton: "mb-4 me-2"
      }
    },
    color: {
      default: {},
      primary: {
        selectorIcon: "text-primary"
      },
      secondary: {
        selectorIcon: "text-secondary"
      },
      success: {
        selectorIcon: "text-success"
      },
      warning: {
        selectorIcon: "text-warning"
      },
      danger: {
        selectorIcon: "text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        trigger: "h-8 min-h-8 px-2 rounded-small",
        value: "text-small",
        clearButton: "text-medium"
      },
      md: {
        trigger: "h-10 min-h-10 rounded-medium",
        value: "text-small",
        clearButton: "text-large"
      },
      lg: {
        trigger: "h-12 min-h-12 rounded-large",
        value: "text-medium",
        clearButton: "mb-5 text-large"
      }
    },
    radius: {
      none: {
        trigger: "rounded-none"
      },
      sm: {
        trigger: "rounded-small"
      },
      md: {
        trigger: "rounded-medium"
      },
      lg: {
        trigger: "rounded-large"
      },
      full: {
        trigger: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        base: "flex flex-col",
        clearButton: "mb-0"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        label: "relative pe-2 text-foreground",
        clearButton: "mb-0"
      },
      inside: {
        label: "text-tiny cursor-pointer",
        trigger: "flex-col items-start justify-center gap-0"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {
        base: "min-w-40"
      }
    },
    isClearable: {
      true: {
        clearButton: "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
        endContent: "ms-3"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        trigger: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        value: "!text-danger",
        selectorIcon: "text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    isMultiline: {
      true: {
        label: "relative",
        trigger: "!h-auto"
      },
      false: {
        value: "truncate"
      }
    },
    disableAnimation: {
      true: {
        trigger: "after:transition-none",
        base: "transition-none",
        label: "transition-none",
        selectorIcon: "transition-none"
      },
      false: {
        base: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "origin-top-left",
          // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
          "rtl:origin-top-right",
          "!duration-200",
          "!ease-out",
          "transition-[transform,color,left,opacity,translate,scale]",
          "motion-reduce:transition-none"
        ],
        selectorIcon: "transition-transform duration-150 ease motion-reduce:transition-none",
        clearButton: ["transition-opacity", "motion-reduce:transition-none"]
      }
    },
    disableSelectorIconRotation: {
      true: {},
      false: {
        selectorIcon: "data-[open=true]:rotate-180"
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false,
    isMultiline: false,
    disableSelectorIconRotation: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        value: "group-data-[has-value=true]:text-default-foreground",
        trigger: ["bg-default-100", "data-[hover=true]:bg-default-200"]
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        trigger: [
          "bg-primary-100",
          "text-primary",
          "data-[hover=true]:bg-primary-50",
          "group-data-[focus=true]:bg-primary-50"
        ],
        value: "text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        trigger: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50"
        ],
        value: "text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        trigger: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        value: "text-success-600 dark:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        trigger: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        value: "text-warning-600 dark:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        trigger: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        value: "text-danger dark:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        trigger: "data-[hover=true]:border-primary data-[focus=true]:border-primary data-[open=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        trigger: "data-[hover=true]:border-secondary data-[focus=true]:border-secondary data-[open=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        trigger: "data-[hover=true]:border-success data-[focus=true]:border-success data-[open=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        trigger: "data-[hover=true]:border-warning data-[focus=true]:border-warning data-[open=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        trigger: "data-[hover=true]:border-danger data-[focus=true]:border-danger data-[open=true]:border-danger",
        label: "text-danger"
      }
    },
    // underlined & color
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        value: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        trigger: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        trigger: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        trigger: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        trigger: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        trigger: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        trigger: ["data-[open=true]:border-primary", "data-[focus=true]:border-primary"],
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        trigger: ["data-[open=true]:border-secondary", "data-[focus=true]:border-secondary"],
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        trigger: ["data-[open=true]:border-success", "data-[focus=true]:border-success"],
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        trigger: ["data-[open=true]:border-warning", "data-[focus=true]:border-warning"],
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        trigger: ["data-[open=true]:border-danger", "data-[focus=true]:border-danger"],
        label: "text-danger"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        trigger: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        trigger: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        trigger: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        trigger: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        trigger: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        trigger: [
          // focus ring
          ...dataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        trigger: [
          "bg-danger-50",
          "data-[hover=true]:bg-danger-100",
          "group-data-[focus=true]:bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        trigger: "!border-danger group-data-[focus=true]:border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        trigger: "after:bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        trigger: "h-12 min-h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        trigger: "h-14 min-h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: "text-medium",
        trigger: "h-16 min-h-16 py-2.5 gap-0"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      class: {
        base: "group relative justify-end",
        label: ["pb-0", "z-20", "top-1/2", "-translate-y-1/2", "group-data-[filled=true]:start-0"]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: "group-data-[filled=true]:scale-85"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-4"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-4"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ],
        innerWrapper: "group-data-[has-label=true]:pt-5"
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      isMultiline: false,
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled=true]:-translate-y-[calc(100%_+var(--heroui-font-size-tiny)/2_+_16px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_26px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "start-3",
          "text-small",
          "group-data-[filled=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_30px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "start-3",
          "text-medium",
          "group-data-[filled=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]",
          "group-data-[has-helper=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_34px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]"
      }
    },
    // outside-left & size
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4"
      }
    },
    // isMultiline & labelPlacement="outside"
    {
      labelPlacement: "outside",
      isMultiline: true,
      class: {
        label: "pb-1.5"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    },
    // isClearable & labelPlacement
    {
      labelPlacement: ["outside", "outside-left"],
      isClearable: true,
      class: {
        endContent: ["mt-4"],
        clearButton: ["group-data-[has-end-content=true]:mt-4"]
      }
    },
    {
      isClearable: false,
      labelPlacement: ["outside", "outside-left"],
      class: {
        endContent: ["mt-4"]
      }
    },
    // isClearable + variant
    {
      isClearable: true,
      variant: ["underlined"],
      class: {
        clearButton: ["relative group-data-[has-end-content=true]:left-2"],
        endContent: ["me-2"]
      }
    },
    {
      isClearable: false,
      variant: ["underlined"],
      class: {
        endContent: ["me-2"]
      }
    },
    // isClearable + size
    {
      isClearable: true,
      size: "sm",
      class: {
        endContent: "ms-2"
      }
    }
  ]
});
var slider = tv({
  slots: {
    base: "flex flex-col w-full gap-1",
    labelWrapper: "w-full flex justify-between items-center",
    label: "",
    value: "",
    step: [
      "h-1.5",
      "w-1.5",
      "absolute",
      "rounded-full",
      "bg-default-300/50",
      "data-[in-range=true]:bg-background/50"
    ],
    mark: [
      "absolute",
      "text-small",
      "cursor-default",
      "opacity-50",
      "data-[in-range=true]:opacity-100"
    ],
    trackWrapper: "relative flex gap-2",
    track: ["flex", "w-full", "relative", "rounded-full", "bg-default-300/50"],
    filler: "h-full absolute",
    thumb: [
      "flex",
      "justify-center",
      "items-center",
      "before:absolute",
      "before:w-11",
      "before:h-11",
      "before:rounded-full",
      "after:shadow-small",
      "after:shadow-small",
      "after:bg-background",
      "data-[focused=true]:z-10",
      dataFocusVisibleClasses
    ],
    startContent: [],
    endContent: []
  },
  variants: {
    size: {
      sm: {
        label: "text-small",
        value: "text-small",
        thumb: "w-5 h-5 after:w-4 after:h-4",
        step: "data-[in-range=false]:bg-default-200"
      },
      md: {
        thumb: "w-6 h-6 after:w-5 after:h-5",
        label: "text-small",
        value: "text-small"
      },
      lg: {
        thumb: "h-7 w-7 after:w-5 after:h-5",
        step: "w-2 h-2",
        label: "text-medium",
        value: "text-medium",
        mark: "mt-2"
      }
    },
    radius: {
      none: {
        thumb: "rounded-none after:rounded-none"
      },
      sm: {
        thumb: "rounded-[calc(var(--heroui-radius-small)/2)] after:rounded-[calc(var(--heroui-radius-small)/3)]"
      },
      md: {
        thumb: "rounded-[calc(var(--heroui-radius-medium)/2)] after:rounded-[calc(var(--heroui-radius-medium)/3)]"
      },
      lg: {
        thumb: "rounded-[calc(var(--heroui-radius-large)/1.5)] after:rounded-[calc(var(--heroui-radius-large)/2)]"
      },
      full: {
        thumb: "rounded-full after:rounded-full"
      }
    },
    color: {
      foreground: {
        filler: "bg-foreground",
        thumb: "bg-foreground"
      },
      primary: {
        filler: "bg-primary",
        thumb: "bg-primary"
      },
      secondary: {
        filler: "bg-secondary",
        thumb: "bg-secondary"
      },
      success: {
        filler: "bg-success",
        thumb: "bg-success"
      },
      warning: {
        filler: "bg-warning",
        thumb: "bg-warning"
      },
      danger: {
        filler: "bg-danger",
        thumb: "bg-danger"
      }
    },
    isVertical: {
      true: {
        base: "w-auto h-full flex-col-reverse items-center",
        trackWrapper: "flex-col h-full justify-center items-center",
        filler: "w-full h-auto",
        thumb: "left-1/2",
        track: "h-full border-y-transparent",
        labelWrapper: "flex-col justify-center items-center",
        step: ["left-1/2", "-translate-x-1/2", "translate-y-1/2"],
        mark: ["left-1/2", "ml-1", "translate-x-1/2", "translate-y-1/2"]
      },
      false: {
        thumb: "top-1/2",
        trackWrapper: "items-center",
        track: "border-x-transparent",
        step: ["top-1/2", "-translate-x-1/2", "-translate-y-1/2"],
        mark: ["top-1/2", "mt-1", "-translate-x-1/2", "translate-y-1/2"]
      }
    },
    isDisabled: {
      false: {
        thumb: ["cursor-grab", "data-[dragging=true]:cursor-grabbing"]
      },
      true: {
        base: "opacity-disabled",
        thumb: "cursor-default"
      }
    },
    hasMarks: {
      true: {
        base: "mb-5",
        mark: "cursor-pointer"
      },
      false: {}
    },
    showOutline: {
      true: {
        thumb: "ring-2 ring-background"
      },
      false: {
        thumb: "ring-transparent border-0"
      }
    },
    hideValue: {
      true: {
        value: "sr-only"
      }
    },
    hideThumb: {
      true: {
        thumb: "sr-only",
        track: "cursor-pointer"
      }
    },
    hasSingleThumb: {
      true: {},
      false: {}
    },
    disableAnimation: {
      true: {
        thumb: "data-[dragging=true]:after:scale-100"
      },
      false: {
        thumb: "after:transition-all motion-reduce:after:transition-none",
        mark: "transition-opacity motion-reduce:transition-none"
      }
    },
    disableThumbScale: {
      true: {},
      false: {
        thumb: "data-[dragging=true]:after:scale-80"
      }
    }
  },
  compoundVariants: [
    // size="sm" || size="md" && showOutline={false}
    {
      size: ["sm", "md"],
      showOutline: false,
      class: {
        thumb: "shadow-small"
      }
    },
    // size && color
    {
      size: "sm",
      color: "foreground",
      class: {
        step: "data-[in-range=true]:bg-foreground"
      }
    },
    {
      size: "sm",
      color: "primary",
      class: {
        step: "data-[in-range=true]:bg-primary"
      }
    },
    {
      size: "sm",
      color: "secondary",
      class: {
        step: "data-[in-range=true]:bg-secondary"
      }
    },
    {
      size: "sm",
      color: "success",
      class: {
        step: "data-[in-range=true]:bg-success"
      }
    },
    {
      size: "sm",
      color: "warning",
      class: {
        step: "data-[in-range=true]:bg-warning"
      }
    },
    {
      size: "sm",
      color: "danger",
      class: {
        step: "data-[in-range=true]:bg-danger"
      }
    },
    // size && !isVertical
    {
      size: "sm",
      isVertical: false,
      class: {
        track: "h-1 my-[calc((theme(spacing.5)-theme(spacing.1))/2)] border-x-[calc(theme(spacing.5)/2)]"
      }
    },
    {
      size: "md",
      isVertical: false,
      class: {
        track: "h-3 my-[calc((theme(spacing.6)-theme(spacing.3))/2)] border-x-[calc(theme(spacing.6)/2)]"
      }
    },
    {
      size: "lg",
      isVertical: false,
      class: {
        track: "h-7 my-[calc((theme(spacing.7)-theme(spacing.5))/2)] border-x-[calc(theme(spacing.7)/2)]"
      }
    },
    // size && isVertical
    {
      size: "sm",
      isVertical: true,
      class: {
        track: "w-1 mx-[calc((theme(spacing.5)-theme(spacing.1))/2)] border-y-[calc(theme(spacing.5)/2)]"
      }
    },
    {
      size: "md",
      isVertical: true,
      class: {
        track: "w-3 mx-[calc((theme(spacing.6)-theme(spacing.3))/2)] border-y-[calc(theme(spacing.6)/2)]"
      }
    },
    {
      size: "lg",
      isVertical: true,
      class: {
        track: "w-7 mx-[calc((theme(spacing.7)-theme(spacing.5))/2)] border-y-[calc(theme(spacing.7)/2)]"
      }
    },
    // color && !isVertical
    {
      color: "foreground",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-foreground data-[fill-end=true]:border-e-foreground"
      }
    },
    {
      color: "primary",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-primary data-[fill-end=true]:border-e-primary"
      }
    },
    {
      color: "secondary",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-secondary data-[fill-end=true]:border-e-secondary"
      }
    },
    {
      color: "success",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-success data-[fill-end=true]:border-e-success"
      }
    },
    {
      color: "warning",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-warning data-[fill-end=true]:border-e-warning"
      }
    },
    {
      color: "danger",
      isVertical: false,
      class: {
        track: "data-[fill-start=true]:border-s-danger data-[fill-end=true]:border-e-danger"
      }
    },
    // color && isVertical
    {
      color: "foreground",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-foreground data-[fill-end=true]:border-t-foreground"
      }
    },
    {
      color: "primary",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-primary data-[fill-end=true]:border-t-primary"
      }
    },
    {
      color: "secondary",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-secondary data-[fill-end=true]:border-t-secondary"
      }
    },
    {
      color: "success",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-success data-[fill-end=true]:border-t-success"
      }
    },
    {
      color: "warning",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-warning data-[fill-end=true]:border-t-warning"
      }
    },
    {
      color: "danger",
      isVertical: true,
      class: {
        track: "data-[fill-start=true]:border-b-danger data-[fill-end=true]:border-t-danger"
      }
    }
  ],
  defaultVariants: {
    size: "md",
    color: "primary",
    radius: "full",
    hideValue: false,
    hideThumb: false,
    isDisabled: false,
    disableThumbScale: false,
    showOutline: false
  }
});
var input = tv({
  slots: {
    base: "group flex flex-col data-[hidden=true]:hidden",
    label: [
      "absolute",
      "z-10",
      "pointer-events-none",
      "origin-top-left",
      "shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "block",
      "text-small",
      "text-foreground-500"
    ],
    mainWrapper: "h-full",
    inputWrapper: "relative w-full inline-flex tap-highlight-transparent flex-row items-center shadow-xs px-3 gap-3",
    innerWrapper: "inline-flex w-full items-center h-full box-border",
    input: [
      "w-full font-normal bg-transparent !outline-hidden placeholder:text-foreground-500 focus-visible:outline-hidden",
      "data-[has-start-content=true]:ps-1.5",
      "data-[has-end-content=true]:pe-1.5",
      "data-[type=color]:rounded-none",
      "file:cursor-pointer file:bg-transparent file:border-0",
      "autofill:bg-transparent bg-clip-text"
    ],
    clearButton: [
      "p-2",
      "-m-2",
      "z-10",
      "absolute",
      "end-3",
      "start-auto",
      "pointer-events-none",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "opacity-0",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-100"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 focus-within:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground"
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "group-data-[focus=true]:border-default-foreground"
        ]
      },
      underlined: {
        inputWrapper: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "group-data-[focus=true]:after:w-full"
        ],
        innerWrapper: "pb-1",
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        label: "text-tiny",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small",
        input: "text-small",
        clearButton: "text-medium"
      },
      md: {
        inputWrapper: "h-10 min-h-10 rounded-medium",
        input: "text-small",
        clearButton: "text-large hover:!opacity-100"
      },
      lg: {
        label: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large",
        input: "text-medium",
        clearButton: "text-large hover:!opacity-100"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        mainWrapper: "flex flex-col"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        inputWrapper: "flex-1",
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pe-2 ps-2 pointer-events-auto"
      },
      "outside-top": {
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pb-2 pointer-events-auto"
      },
      inside: {
        label: "cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0",
        innerWrapper: "group-data-[has-label=true]:items-end"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {}
    },
    isClearable: {
      true: {
        input: "peer pe-6 input-search-cancel-button-none",
        clearButton: [
          "peer-data-[filled=true]:pointer-events-auto",
          "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
          "peer-data-[filled=true]:scale-100"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        input: "!placeholder:text-danger !text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    isMultiline: {
      true: {
        label: "relative",
        inputWrapper: "!h-auto",
        innerWrapper: "items-start group-data-[has-label=true]:items-start",
        input: "resize-none data-[hide-scroll=true]:scrollbar-hide",
        clearButton: "absolute top-2 right-2 rtl:right-auto rtl:left-2 z-10"
      }
    },
    disableAnimation: {
      true: {
        input: "transition-none",
        inputWrapper: "transition-none",
        label: "transition-none"
      },
      false: {
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "!duration-200",
          "!ease-out",
          "motion-reduce:transition-none",
          "transition-[transform,color,left,opacity,translate,scale]"
        ],
        clearButton: [
          "scale-90",
          "ease-out",
          "duration-150",
          "transition-[opacity,transform]",
          "motion-reduce:transition-none",
          "motion-reduce:scale-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false,
    isMultiline: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        inputWrapper: [
          "bg-primary-100",
          "data-[hover=true]:bg-primary-50",
          "text-primary",
          "group-data-[focus=true]:bg-primary-50",
          "placeholder:text-primary"
        ],
        input: "placeholder:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        inputWrapper: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50",
          "placeholder:text-secondary"
        ],
        input: "placeholder:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        inputWrapper: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "placeholder:text-success-600",
          "dark:placeholder:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        input: "placeholder:text-success-600 dark:placeholder:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        inputWrapper: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "placeholder:text-warning-600",
          "dark:placeholder:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        input: "placeholder:text-warning-600 dark:placeholder:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        inputWrapper: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "placeholder:text-danger",
          "dark:placeholder:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        input: "placeholder:text-danger dark:placeholder:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        label: "text-primary",
        inputWrapper: "data-[hover=true]:border-primary focus-within:border-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        label: "text-secondary",
        inputWrapper: "data-[hover=true]:border-secondary focus-within:border-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        label: "text-success",
        inputWrapper: "data-[hover=true]:border-success focus-within:border-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        label: "text-warning",
        inputWrapper: "data-[hover=true]:border-warning focus-within:border-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        label: "text-danger",
        inputWrapper: "data-[hover=true]:border-danger focus-within:border-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        inputWrapper: "group-data-[focus=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        inputWrapper: "group-data-[focus=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        inputWrapper: "group-data-[focus=true]:border-danger",
        label: "text-danger"
      }
    },
    // labelPlacement=inside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        inputWrapper: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        inputWrapper: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        inputWrapper: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        inputWrapper: [
          // focus ring
          ...groupDataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        inputWrapper: [
          "!bg-danger-50",
          "data-[hover=true]:!bg-danger-100",
          "group-data-[focus=true]:!bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        inputWrapper: "!border-danger group-data-[focus=true]:!border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        inputWrapper: "after:!bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // size & labelPlacement & variant=[faded, bordered]
    {
      labelPlacement: "inside",
      size: "sm",
      variant: ["bordered", "faded"],
      class: {
        inputWrapper: "py-1"
      }
    },
    // labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["group-data-[filled-within=true]:pointer-events-auto"]
      }
    },
    // labelPlacement=[outside] & isMultiline
    {
      labelPlacement: "outside",
      isMultiline: false,
      class: {
        base: "relative justify-end",
        label: [
          "pb-0",
          "z-20",
          "top-1/2",
          "-translate-y-1/2",
          "group-data-[filled-within=true]:start-0"
        ]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: ["group-data-[filled-within=true]:scale-85"]
      }
    },
    // labelPlacement=[inside] & variant=flat
    {
      labelPlacement: ["inside"],
      variant: "flat",
      class: {
        innerWrapper: "pb-0.5"
      }
    },
    // variant=underlined & size
    {
      variant: "underlined",
      size: "sm",
      class: {
        innerWrapper: "pb-1"
      }
    },
    {
      variant: "underlined",
      size: ["md", "lg"],
      class: {
        innerWrapper: "pb-1.5"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small"
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ]
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "lg",
      isMultiline: false,
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      isMultiline: false,
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-tiny)/2_+_16px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "md",
      isMultiline: false,
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-small",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "lg",
      isMultiline: false,
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]"
      }
    },
    // outside-left & size & hasHelper
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4"
      }
    },
    // labelPlacement=[outside, outside-left] & isMultiline
    {
      labelPlacement: ["outside", "outside-left"],
      isMultiline: true,
      class: {
        inputWrapper: "py-2"
      }
    },
    // isMultiline & labelPlacement="outside"
    {
      labelPlacement: "outside",
      isMultiline: true,
      class: {
        label: "pb-1.5"
      }
    },
    // isMultiline & labelPlacement="inside"
    {
      labelPlacement: "inside",
      isMultiline: true,
      class: {
        label: "pb-0.5",
        input: "pt-0"
      }
    },
    // isMultiline & !disableAnimation
    {
      isMultiline: true,
      disableAnimation: false,
      class: {
        input: "transition-height !duration-100 motion-reduce:transition-none"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    },
    // isMultiline & radius=full
    {
      isMultiline: true,
      radius: "full",
      class: {
        inputWrapper: "data-[has-multiple-rows=true]:rounded-large"
      }
    },
    // isClearable & isMultiline
    {
      isClearable: true,
      isMultiline: true,
      class: {
        clearButton: [
          "group-data-[has-value=true]:opacity-70 group-data-[has-value=true]:block",
          "group-data-[has-value=true]:scale-100",
          "group-data-[has-value=true]:pointer-events-auto"
        ]
      }
    }
  ]
});
var kbd = tv({
  slots: {
    base: [
      "px-1.5",
      "py-0.5",
      "inline-flex",
      "space-x-0.5",
      "rtl:space-x-reverse",
      "items-center",
      "font-sans",
      "font-normal",
      "text-center",
      "text-small",
      "shadow-small",
      "bg-default-100",
      "text-foreground-600",
      "rounded-small"
    ],
    abbr: "no-underline",
    content: ""
  },
  variants: {},
  defaultVariants: {}
});
var link$1 = tv({
  base: [
    "relative inline-flex items-center outline-hidden tap-highlight-transparent",
    // focus ring
    ...dataFocusVisibleClasses
  ],
  variants: {
    size: {
      sm: "text-small",
      md: "text-medium",
      lg: "text-large"
    },
    color: {
      foreground: "text-foreground",
      primary: "text-primary",
      secondary: "text-secondary",
      success: "text-success",
      warning: "text-warning",
      danger: "text-danger"
    },
    underline: {
      none: "no-underline",
      hover: "hover:underline",
      always: "underline",
      active: "active:underline",
      focus: "focus:underline"
    },
    isBlock: {
      true: [
        "px-2",
        "py-1",
        "hover:after:opacity-100",
        "after:content-['']",
        "after:inset-0",
        "after:opacity-0",
        "after:w-full",
        "after:h-full",
        "after:rounded-xl",
        "after:transition-background",
        "after:absolute"
      ],
      false: "hover:opacity-hover active:opacity-disabled transition-opacity"
    },
    isDisabled: {
      true: "opacity-disabled cursor-default pointer-events-none"
    },
    disableAnimation: {
      true: "after:transition-none transition-none"
    }
  },
  compoundVariants: [
    {
      isBlock: true,
      color: "foreground",
      class: "hover:after:bg-foreground/10"
    },
    {
      isBlock: true,
      color: "primary",
      class: "hover:after:bg-primary/20"
    },
    {
      isBlock: true,
      color: "secondary",
      class: "hover:after:bg-secondary/20"
    },
    {
      isBlock: true,
      color: "success",
      class: "hover:after:bg-success/20"
    },
    {
      isBlock: true,
      color: "warning",
      class: "hover:after:bg-warning/20"
    },
    {
      isBlock: true,
      color: "danger",
      class: "hover:after:bg-danger/20"
    },
    {
      underline: ["hover", "always", "active", "focus"],
      class: "underline-offset-4"
    }
  ],
  defaultVariants: {
    color: "primary",
    size: "md",
    isBlock: false,
    underline: "none",
    isDisabled: false
  }
});
var linkAnchorClasses = "flex mx-1 text-current self-center";
var menu$1 = tv({
  slots: {
    base: "w-full relative flex flex-col gap-1 p-1 overflow-clip",
    list: "w-full flex flex-col gap-0.5 outline-hidden",
    emptyContent: [
      "h-10",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "text-foreground-400",
      "text-start"
    ]
  }
});
var menuItem = tv({
  slots: {
    base: [
      "flex",
      "group",
      "gap-2",
      "items-center",
      "justify-between",
      "relative",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "box-border",
      "rounded-small",
      "subpixel-antialiased",
      "outline-hidden",
      "cursor-pointer",
      "tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses,
      "data-[focus-visible=true]:dark:ring-offset-background-content1"
    ],
    wrapper: "w-full flex flex-col items-start justify-center",
    title: "flex-1 text-small font-normal",
    description: ["w-full", "text-tiny", "text-foreground-500", "group-hover:text-current"],
    selectedIcon: ["text-inherit", "w-3", "h-3", "shrink-0"],
    shortcut: [
      "px-1",
      "py-0.5",
      "rounded-sm",
      "font-sans",
      "text-foreground-500",
      "text-tiny",
      "border-small",
      "border-default-300",
      "group-hover:border-current"
    ]
  },
  variants: {
    variant: {
      solid: {
        base: ""
      },
      bordered: {
        base: "border-medium border-transparent bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      faded: {
        base: [
          "border-small border-transparent hover:border-default data-[hover=true]:bg-default-100",
          "data-[selectable=true]:focus:border-default data-[selectable=true]:focus:bg-default-100"
        ]
      },
      flat: {
        base: ""
      },
      shadow: {
        base: "data-[hover=true]:shadow-lg"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    showDivider: {
      true: {
        base: [
          "mb-1.5",
          "after:content-['']",
          "after:absolute",
          "after:-bottom-1",
          "after:left-0",
          "after:right-0",
          "after:h-divider",
          "after:bg-divider"
        ]
      },
      false: {}
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        base: "data-[hover=true]:transition-colors"
      }
    },
    // If the child isn't a string, the truncate such as `overflow, white-space, text-overflow` css won't be extended to the child, so we remove the truncate class here
    hasTitleTextChild: {
      true: {
        title: "truncate"
      }
    },
    hasDescriptionTextChild: {
      true: {
        description: "truncate"
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    showDivider: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:bg-default",
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:bg-default",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground",
          "data-[selectable=true]:focus:bg-primary data-[selectable=true]:focus:text-primary-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground",
          "data-[selectable=true]:focus:bg-secondary data-[selectable=true]:focus:text-secondary-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:bg-success data-[hover=true]:text-success-foreground",
          "data-[selectable=true]:focus:bg-success data-[selectable=true]:focus:text-success-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground",
          "data-[selectable=true]:focus:bg-warning data-[selectable=true]:focus:text-warning-foreground"
        ]
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground",
          "data-[selectable=true]:focus:bg-danger data-[selectable=true]:focus:text-danger-foreground"
        ]
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:shadow-default/50 data-[selectable=true]:focus:bg-default data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground",
          "data-[selectable=true]:focus:shadow-primary/30 data-[selectable=true]:focus:bg-primary data-[selectable=true]:focus:text-primary-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground",
          "data-[selectable=true]:focus:shadow-secondary/30 data-[selectable=true]:focus:bg-secondary data-[selectable=true]:focus:text-secondary-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground",
          "data-[selectable=true]:focus:shadow-success/30 data-[selectable=true]:focus:bg-success data-[selectable=true]:focus:text-success-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground",
          "data-[selectable=true]:focus:shadow-warning/30 data-[selectable=true]:focus:bg-warning data-[selectable=true]:focus:text-warning-foreground"
        ]
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground",
          "data-[selectable=true]:focus:shadow-danger/30 data-[selectable=true]:focus:bg-danger data-[selectable=true]:focus:text-danger-foreground"
        ]
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: ["data-[hover=true]:border-default", "data-[selectable=true]:focus:border-default"]
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:border-primary data-[hover=true]:text-primary",
          "data-[selectable=true]:focus:border-primary data-[selectable=true]:focus:text-primary"
        ]
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:border-secondary data-[hover=true]:text-secondary",
          "data-[selectable=true]:focus:border-secondary data-[selectable=true]:focus:text-secondary"
        ]
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:border-success data-[hover=true]:text-success",
          "data-[selectable=true]:focus:border-success data-[selectable=true]:focus:text-success"
        ]
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:border-warning data-[hover=true]:text-warning",
          "data-[selectable=true]:focus:border-warning data-[selectable=true]:focus:text-warning"
        ]
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:border-danger data-[hover=true]:text-danger",
          "data-[selectable=true]:focus:border-danger data-[selectable=true]:focus:text-danger"
        ]
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:bg-default/40",
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:bg-default/40",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: [
          "data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary",
          "data-[selectable=true]:focus:bg-primary/20 data-[selectable=true]:focus:text-primary"
        ]
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: [
          "data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary",
          "data-[selectable=true]:focus:bg-secondary/20 data-[selectable=true]:focus:text-secondary"
        ]
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: [
          "data-[hover=true]:bg-success/20 data-[hover=true]:text-success",
          "data-[selectable=true]:focus:bg-success/20 data-[selectable=true]:focus:text-success"
        ]
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: [
          "data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning",
          "data-[selectable=true]:focus:bg-warning/20 data-[selectable=true]:focus:text-warning"
        ]
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: [
          "data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger",
          "data-[selectable=true]:focus:bg-danger/20 data-[selectable=true]:focus:text-danger"
        ]
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:text-default-foreground",
          "data-[selectable=true]:focus:text-default-foreground"
        ]
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: ["data-[hover=true]:text-primary", "data-[selectable=true]:focus:text-primary"]
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: ["data-[hover=true]:text-secondary", "data-[selectable=true]:focus:text-secondary"]
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: ["data-[hover=true]:text-success", "data-[selectable=true]:focus:text-success"]
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: ["data-[hover=true]:text-warning", "data-[selectable=true]:focus:text-warning"]
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: ["data-[hover=true]:text-danger", "data-[selectable=true]:focus:text-danger"]
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: [
          "data-[hover=true]:text-default-500",
          "data-[selectable=true]:focus:text-default-500"
        ]
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: ["data-[hover=true]:text-primary", "data-[selectable=true]:focus:text-primary"]
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: ["data-[hover=true]:text-secondary", "data-[selectable=true]:focus:text-secondary"]
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: ["data-[hover=true]:text-success", "data-[selectable=true]:focus:text-success"]
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: ["data-[hover=true]:text-warning", "data-[selectable=true]:focus:text-warning"]
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: ["data-[hover=true]:text-danger", "data-[selectable=true]:focus:text-danger"]
      }
    }
  ]
});
var menuSection = tv({
  slots: {
    base: "relative mb-2",
    heading: "pl-1 text-tiny text-foreground-500",
    group: "data-[has-title=true]:pt-1",
    divider: "mt-2"
  }
});
var modal = tv({
  slots: {
    wrapper: [
      "flex",
      "w-screen",
      "h-[100dvh]",
      "fixed",
      "inset-0",
      "z-50",
      "overflow-x-auto",
      "justify-center",
      "h-[--visual-viewport-height]"
    ],
    base: [
      "flex",
      "flex-col",
      "relative",
      "bg-white",
      "z-50",
      "w-full",
      "box-border",
      "bg-content1",
      "outline-hidden",
      "mx-1",
      "my-1",
      "sm:mx-6",
      "sm:my-16"
    ],
    backdrop: "z-50",
    header: "flex py-4 px-6 flex-initial text-large font-semibold",
    body: "flex flex-1 flex-col gap-3 px-6 py-2",
    footer: "flex flex-row gap-2 px-6 py-4 justify-end",
    closeButton: [
      "absolute",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "top-1",
      "end-1",
      "p-2",
      "text-foreground-500",
      "rounded-full",
      "hover:bg-default-100",
      "active:bg-default-200",
      "tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses
    ]
  },
  variants: {
    size: {
      xs: {
        base: "max-w-xs"
      },
      sm: {
        base: "max-w-sm"
      },
      md: {
        base: "max-w-md"
      },
      lg: {
        base: "max-w-lg"
      },
      xl: {
        base: "max-w-xl"
      },
      "2xl": {
        base: "max-w-2xl"
      },
      "3xl": {
        base: "max-w-3xl"
      },
      "4xl": {
        base: "max-w-4xl"
      },
      "5xl": {
        base: "max-w-5xl"
      },
      full: {
        base: "my-0 mx-0 sm:mx-0 sm:my-0 max-w-full h-[100dvh] min-h-[100dvh] !rounded-none"
      }
    },
    radius: {
      none: { base: "rounded-none" },
      sm: { base: "rounded-small" },
      md: { base: "rounded-medium" },
      lg: { base: "rounded-large" }
    },
    placement: {
      auto: {
        wrapper: "items-end sm:items-center"
      },
      center: {
        wrapper: "items-center sm:items-center"
      },
      top: {
        wrapper: "items-start sm:items-start"
      },
      "top-center": {
        wrapper: "items-start sm:items-center"
      },
      bottom: {
        wrapper: "items-end sm:items-end"
      },
      "bottom-center": {
        wrapper: "items-end sm:items-center"
      }
    },
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    },
    backdrop: {
      transparent: {
        backdrop: "hidden"
      },
      opaque: {
        backdrop: "bg-overlay/50 backdrop-opacity-disabled"
      },
      blur: {
        backdrop: "backdrop-blur-md backdrop-saturate-150 bg-overlay/30"
      }
    },
    scrollBehavior: {
      normal: {
        base: "overflow-y-hidden"
      },
      inside: {
        base: "max-h-[calc(100%_-_8rem)]",
        body: "overflow-y-auto"
      },
      outside: {
        wrapper: "items-start sm:items-start overflow-y-auto",
        base: "my-16"
      }
    },
    disableAnimation: {
      false: {
        wrapper: [
          //  mobile animation vars
          "[--scale-enter:100%]",
          "[--scale-exit:100%]",
          "[--slide-enter:0px]",
          "[--slide-exit:80px]",
          // tablet/desktop animation vars
          "sm:[--scale-enter:100%]",
          "sm:[--scale-exit:103%]",
          "sm:[--slide-enter:0px]",
          "sm:[--slide-exit:0px]"
        ]
      }
    }
  },
  defaultVariants: {
    size: "md",
    radius: "lg",
    shadow: "sm",
    placement: "auto",
    backdrop: "opaque",
    scrollBehavior: "normal"
  },
  compoundVariants: [
    // backdrop (opaque/blur)
    {
      backdrop: ["opaque", "blur"],
      class: {
        backdrop: "w-screen h-screen fixed inset-0"
      }
    }
  ]
});
var numberInput = tv({
  slots: {
    base: "group flex flex-col data-[hidden=true]:hidden",
    label: [
      "absolute",
      "z-10",
      "pointer-events-none",
      "origin-top-left",
      "flex-shrink-0",
      // Using RTL here as Tailwind CSS doesn't support `start` and `end` logical properties for transforms yet.
      "rtl:origin-top-right",
      "subpixel-antialiased",
      "block",
      "text-small",
      "text-foreground-500"
    ],
    mainWrapper: "h-full",
    inputWrapper: "relative w-full inline-flex tap-highlight-transparent flex-row items-center shadow-sm px-3 gap-3",
    innerWrapper: "inline-flex w-full items-center h-full box-border",
    input: [
      "w-full font-normal bg-transparent !outline-hidden placeholder:text-foreground-500 focus-visible:outline-hidden",
      "data-[has-start-content=true]:ps-1.5",
      "data-[has-end-content=true]:pe-1.5",
      "autofill:bg-transparent bg-clip-text"
    ],
    clearButton: [
      "p-2",
      "-m-2",
      "z-10",
      "end-3",
      "start-auto",
      "pointer-events-none",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "opacity-0",
      "hover:!opacity-100",
      "cursor-pointer",
      "active:!opacity-70",
      "rounded-full",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    stepperButton: [
      "bg-transparent",
      "flex",
      "justify-center",
      "items-center",
      "before:absolute",
      "before:w-8",
      // the max width that won't block clear button
      "before:h-8",
      "before:rounded-full",
      "after:shadow-small",
      "after:bg-background",
      "data-[focused=true]:z-10",
      "min-w-5",
      "w-5",
      "h-5",
      "overflow-visible",
      "transition-opacity",
      "data-[hover=true]:opacity-70",
      "data-[pressed=true]:opacity-disabled"
    ],
    stepperWrapper: ["flex", "flex-col", "ps-1", "h-full", "justify-center"],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "data-[hover=true]:bg-default-200",
          "group-data-[focus=true]:bg-default-100"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400 focus-within:border-default-400"
        ],
        value: "group-data-[has-value=true]:text-default-foreground"
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "data-[hover=true]:border-default-400",
          "group-data-[focus=true]:border-default-foreground"
        ]
      },
      underlined: {
        inputWrapper: [
          "!px-1",
          "!pb-0",
          "!gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "group-data-[focus=true]:after:w-full"
        ],
        innerWrapper: "pb-1",
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    color: {
      default: {},
      primary: {
        stepperButton: "text-primary"
      },
      secondary: {
        stepperButton: "text-secondary"
      },
      success: {
        stepperButton: "text-success"
      },
      warning: {
        stepperButton: "text-warning"
      },
      danger: {
        stepperButton: "text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small",
        input: "text-small",
        clearButton: "text-medium"
      },
      md: {
        inputWrapper: "h-10 min-h-10 rounded-medium",
        input: "text-small",
        clearButton: "text-large"
      },
      lg: {
        label: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large",
        input: "text-medium",
        clearButton: "text-large"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        mainWrapper: "flex flex-col",
        stepperButton: "min-w-3 w-3 h-3"
      },
      "outside-left": {
        base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
        inputWrapper: "flex-1",
        mainWrapper: "flex flex-col",
        label: "relative text-foreground pe-2 ps-2 pointer-events-auto",
        stepperButton: "min-w-3 w-3 h-3"
      },
      inside: {
        label: "cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0",
        innerWrapper: "group-data-[has-label=true]:items-end"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      },
      false: {}
    },
    isClearable: {
      true: {
        input: "peer pe-6 input-search-cancel-button-none",
        clearButton: [
          "peer-data-[filled=true]:pointer-events-auto",
          "peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
          "peer-data-[filled=true]:scale-100"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        label: "!text-danger",
        input: "!placeholder:text-danger !text-danger"
      }
    },
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ms-0.5"
      }
    },
    disableAnimation: {
      true: {
        input: "transition-none",
        inputWrapper: "transition-none",
        label: "transition-none"
      },
      false: {
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        label: [
          "will-change-auto",
          "!duration-200",
          "!ease-out",
          "motion-reduce:transition-none",
          "transition-[transform,color,left,opacity,translate,scale]"
        ],
        clearButton: [
          "scale-90",
          "ease-out",
          "duration-150",
          "transition-[opacity,transform]",
          "motion-reduce:transition-none",
          "motion-reduce:scale-100"
        ]
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    labelPlacement: "inside",
    isDisabled: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        inputWrapper: [
          "bg-primary-100",
          "data-[hover=true]:bg-primary-50",
          "text-primary",
          "group-data-[focus=true]:bg-primary-50",
          "placeholder:text-primary"
        ],
        input: "placeholder:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        inputWrapper: [
          "bg-secondary-100",
          "text-secondary",
          "data-[hover=true]:bg-secondary-50",
          "group-data-[focus=true]:bg-secondary-50",
          "placeholder:text-secondary"
        ],
        input: "placeholder:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        inputWrapper: [
          "bg-success-100",
          "text-success-600",
          "dark:text-success",
          "placeholder:text-success-600",
          "dark:placeholder:text-success",
          "data-[hover=true]:bg-success-50",
          "group-data-[focus=true]:bg-success-50"
        ],
        input: "placeholder:text-success-600 dark:placeholder:text-success",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        inputWrapper: [
          "bg-warning-100",
          "text-warning-600",
          "dark:text-warning",
          "placeholder:text-warning-600",
          "dark:placeholder:text-warning",
          "data-[hover=true]:bg-warning-50",
          "group-data-[focus=true]:bg-warning-50"
        ],
        input: "placeholder:text-warning-600 dark:placeholder:text-warning",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        inputWrapper: [
          "bg-danger-100",
          "text-danger",
          "dark:text-danger-500",
          "placeholder:text-danger",
          "dark:placeholder:text-danger-500",
          "data-[hover=true]:bg-danger-50",
          "group-data-[focus=true]:bg-danger-50"
        ],
        input: "placeholder:text-danger dark:placeholder:text-danger-500",
        label: "text-danger dark:text-danger-500"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        label: "text-primary",
        inputWrapper: "data-[hover=true]:border-primary focus-within:border-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        label: "text-secondary",
        inputWrapper: "data-[hover=true]:border-secondary focus-within:border-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        label: "text-success",
        inputWrapper: "data-[hover=true]:border-success focus-within:border-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        label: "text-warning",
        inputWrapper: "data-[hover=true]:border-warning focus-within:border-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        label: "text-danger",
        inputWrapper: "data-[hover=true]:border-danger focus-within:border-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "default",
      class: {
        input: "group-data-[has-value=true]:text-foreground"
      }
    },
    {
      variant: "underlined",
      color: "primary",
      class: {
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-primary",
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        inputWrapper: "group-data-[focus=true]:border-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        inputWrapper: "group-data-[focus=true]:border-success",
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        inputWrapper: "group-data-[focus=true]:border-warning",
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        inputWrapper: "group-data-[focus=true]:border-danger",
        label: "text-danger"
      }
    },
    // labelPlacement=inside & default
    {
      labelPlacement: "inside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-default-600"
      }
    },
    // labelPlacement=outside & default
    {
      labelPlacement: "outside",
      color: "default",
      class: {
        label: "group-data-[filled-within=true]:text-foreground"
      }
    },
    // radius-full & size
    {
      radius: "full",
      size: ["sm"],
      class: {
        inputWrapper: "px-3"
      }
    },
    {
      radius: "full",
      size: "md",
      class: {
        inputWrapper: "px-4"
      }
    },
    {
      radius: "full",
      size: "lg",
      class: {
        inputWrapper: "px-5"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        inputWrapper: [
          // focus ring
          ...groupDataFocusVisibleClasses
        ]
      }
    },
    // isInvalid & variant
    {
      isInvalid: true,
      variant: "flat",
      class: {
        inputWrapper: [
          "!bg-danger-50",
          "data-[hover=true]:!bg-danger-100",
          "group-data-[focus=true]:!bg-danger-50"
        ]
      }
    },
    {
      isInvalid: true,
      variant: "bordered",
      class: {
        inputWrapper: "!border-danger group-data-[focus=true]:!border-danger"
      }
    },
    {
      isInvalid: true,
      variant: "underlined",
      class: {
        inputWrapper: "after:!bg-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // size & labelPlacement & variant=[faded, bordered]
    {
      labelPlacement: "inside",
      size: "sm",
      variant: ["bordered", "faded"],
      class: {
        inputWrapper: "py-1"
      }
    },
    // labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["group-data-[filled-within=true]:pointer-events-auto"]
      }
    },
    // labelPlacement=[outside]
    {
      labelPlacement: "outside",
      class: {
        base: "relative justify-end",
        label: [
          "pb-0",
          "z-20",
          "top-1/2",
          "-translate-y-1/2",
          "group-data-[filled-within=true]:start-0"
        ]
      }
    },
    // labelPlacement=[inside]
    {
      labelPlacement: ["inside"],
      class: {
        label: ["group-data-[filled-within=true]:scale-85"]
      }
    },
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px)]"
        ]
      }
    },
    // labelPlacement=[inside] & variant=flat
    {
      labelPlacement: ["inside"],
      variant: "flat",
      class: {
        innerWrapper: "pb-0.5"
      }
    },
    // variant=underlined & size
    {
      variant: "underlined",
      size: "sm",
      class: {
        innerWrapper: "pb-1"
      }
    },
    {
      variant: "underlined",
      size: ["md", "lg"],
      class: {
        innerWrapper: "pb-1.5"
      }
    },
    // inside & size
    {
      labelPlacement: "inside",
      size: ["sm", "md"],
      class: {
        label: "text-small",
        stepperButton: "before:h-6"
      }
    },
    // inside & size & [faded, bordered]
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      isMultiline: false,
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_6px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: ["faded", "bordered"],
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_8px_-_var(--heroui-border-width-medium))]"
        ]
      }
    },
    // inside & size & underlined
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "sm",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-tiny)/2_-_5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "md",
      class: {
        label: [
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_3.5px)]"
        ]
      }
    },
    {
      labelPlacement: "inside",
      variant: "underlined",
      size: "lg",
      class: {
        label: [
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(50%_+_var(--heroui-font-size-small)/2_-_4px)]"
        ]
      }
    },
    // outside & size
    {
      labelPlacement: "outside",
      size: "sm",
      class: {
        label: [
          "start-2",
          "text-tiny",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-tiny)/2_+_16px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_8px)]",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside",
      size: "md",
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-small",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_20px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_10px)]"
      }
    },
    {
      labelPlacement: "outside",
      size: "lg",
      class: {
        label: [
          "start-3",
          "end-auto",
          "text-medium",
          "group-data-[filled-within=true]:-translate-y-[calc(100%_+_var(--heroui-font-size-small)/2_+_24px)]"
        ],
        base: "data-[has-label=true]:mt-[calc(var(--heroui-font-size-small)_+_12px)]",
        stepperButton: "min-4 w-4 h-4 before:h-6"
      }
    },
    // outside-left & size & hasHelper
    {
      labelPlacement: "outside-left",
      size: "sm",
      class: {
        label: "group-data-[has-helper=true]:pt-2",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "md",
      class: {
        label: "group-data-[has-helper=true]:pt-3",
        stepperButton: "before:h-4"
      }
    },
    {
      labelPlacement: "outside-left",
      size: "lg",
      class: {
        label: "group-data-[has-helper=true]:pt-4",
        stepperButton: "min-4 w-4 h-4 before:h-6"
      }
    },
    // text truncate labelPlacement=[inside,outside]
    {
      labelPlacement: ["inside", "outside"],
      class: {
        label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
      }
    }
  ]
});
var divider = tv({
  base: "shrink-0 bg-divider border-none",
  variants: {
    orientation: {
      horizontal: "w-full h-divider",
      vertical: "h-full w-divider"
    }
  },
  defaultVariants: {
    orientation: "horizontal"
  }
});
var drawer = tv({
  slots: {
    base: ["absolute", "m-0", "sm:m-0", "overflow-y-auto"]
  },
  variants: {
    size: {
      xs: {
        base: "max-w-xs max-h-[20rem]"
      },
      sm: {
        base: "max-w-sm max-h-[24rem]"
      },
      md: {
        base: "max-w-md max-h-[28rem]"
      },
      lg: {
        base: "max-w-lg max-h-[32rem]"
      },
      xl: {
        base: "max-w-xl max-h-[36rem]"
      },
      "2xl": {
        base: "max-w-2xl max-h-[42rem]"
      },
      "3xl": {
        base: "max-w-3xl max-h-[48rem]"
      },
      "4xl": {
        base: "max-w-4xl max-h-[56rem]"
      },
      "5xl": {
        base: "max-w-5xl max-h-[64rem]"
      },
      full: {
        base: "max-w-full max-h-full h-[100dvh] !rounded-none"
      }
    },
    placement: {
      top: {
        base: "inset-x-0 top-0 max-w-[none] rounded-t-none"
      },
      right: {
        base: "inset-y-0 right-0 max-h-[none] rounded-r-none"
      },
      bottom: {
        base: "inset-x-0 bottom-0 max-w-[none] rounded-b-none"
      },
      left: {
        base: "inset-y-0 left-0 max-h-[none] rounded-l-none"
      }
    }
  }
});
var dropdown = tv({
  base: ["w-full", "p-1", "min-w-[200px]"]
});
tv({
  slots: {
    base: [
      "flex",
      "group",
      "gap-2",
      "items-center",
      "justify-between",
      "relative",
      "px-2",
      "py-1.5",
      "w-full",
      "h-full",
      "box-border",
      "rounded-small",
      "outline-hidden",
      "cursor-pointer",
      "tap-highlight-transparent",
      "data-[pressed=true]:opacity-70",
      // focus ring
      ...dataFocusVisibleClasses,
      "data-[focus-visible=true]:dark:ring-offset-background-content1"
    ],
    wrapper: "w-full flex flex-col items-start justify-center",
    title: "flex-1 text-small font-normal truncate",
    description: ["w-full", "text-tiny", "text-foreground-500", "group-hover:text-current"],
    selectedIcon: ["text-inherit", "w-3", "h-3", "shrink-0"],
    shortcut: [
      "px-1",
      "py-0.5",
      "rounded-sm",
      "font-sans",
      "text-foreground-500",
      "text-tiny",
      "border-small",
      "border-default-300",
      "group-hover:border-current"
    ]
  },
  variants: {
    variant: {
      solid: {
        base: ""
      },
      bordered: {
        base: "border-medium border-transparent bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      faded: {
        base: "border-small border-transparent hover:border-default data-[hover=true]:bg-default-100"
      },
      flat: {
        base: ""
      },
      shadow: {
        base: "data-[hover=true]:shadow-lg"
      }
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    disableAnimation: {
      true: {},
      false: {}
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default"
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: "data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: "data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: "data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: "data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: "data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: "data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: "data-[hover=true]:shadow-default/50 data-[hover=true]:bg-default data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: "data-[hover=true]:shadow-primary/30 data-[hover=true]:bg-primary data-[hover=true]:text-primary-foreground"
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: "data-[hover=true]:shadow-secondary/30 data-[hover=true]:bg-secondary data-[hover=true]:text-secondary-foreground"
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: "data-[hover=true]:shadow-success/30 data-[hover=true]:bg-success data-[hover=true]:text-success-foreground"
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: "data-[hover=true]:shadow-warning/30 data-[hover=true]:bg-warning data-[hover=true]:text-warning-foreground"
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: "data-[hover=true]:shadow-danger/30 data-[hover=true]:bg-danger data-[hover=true]:text-danger-foreground"
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: "data-[hover=true]:border-default"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: "data-[hover=true]:border-primary data-[hover=true]:text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: "data-[hover=true]:border-secondary data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: "data-[hover=true]:border-success data-[hover=true]:text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: "data-[hover=true]:border-warning data-[hover=true]:text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: "data-[hover=true]:border-danger data-[hover=true]:text-danger"
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: "data-[hover=true]:bg-default/40 data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: "data-[hover=true]:bg-primary/20 data-[hover=true]:text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: "data-[hover=true]:bg-secondary/20 data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: "data-[hover=true]:bg-success/20 data-[hover=true]:text-success "
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: "data-[hover=true]:bg-warning/20 data-[hover=true]:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: "data-[hover=true]:bg-danger/20 data-[hover=true]:text-danger"
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: "data-[hover=true]:text-default-foreground"
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: "data-[hover=true]:text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: "data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: "data-[hover=true]:text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: "data-[hover=true]:text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: "data-[hover=true]:text-danger"
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: "data-[hover=true]:text-default-500"
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: "data-[hover=true]:text-primary"
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: "data-[hover=true]:text-secondary"
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: "data-[hover=true]:text-success"
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: "data-[hover=true]:text-warning"
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: "data-[hover=true]:text-danger"
      }
    }
  ]
});
tv({
  slots: {
    base: "relative mb-2",
    heading: "pl-1 text-tiny text-foreground-500",
    group: "data-[has-title=true]:pt-1",
    divider: "mt-2"
  }
});
tv({
  base: "w-full flex flex-col gap-0.5 p-1"
});
var form = tv({
  base: "flex flex-col gap-2 items-start"
});
var image$1 = tv({
  slots: {
    wrapper: "relative shadow-black/5",
    zoomedWrapper: "relative overflow-hidden rounded-inherit",
    img: "relative z-10 opacity-0 shadow-black/5 data-[loaded=true]:opacity-100",
    blurredImg: [
      "absolute",
      "z-0",
      "inset-0",
      "w-full",
      "h-full",
      "object-cover",
      "filter",
      "blur-lg",
      "scale-105",
      "saturate-150",
      "opacity-30",
      "translate-y-1"
    ]
  },
  variants: {
    radius: {
      none: {},
      sm: {},
      md: {},
      lg: {},
      full: {}
    },
    shadow: {
      none: {
        wrapper: "shadow-none",
        img: "shadow-none"
      },
      sm: {
        wrapper: "shadow-small",
        img: "shadow-small"
      },
      md: {
        wrapper: "shadow-medium",
        img: "shadow-medium"
      },
      lg: {
        wrapper: "shadow-large",
        img: "shadow-large"
      }
    },
    isZoomed: {
      true: {
        img: ["object-cover", "transform", "hover:scale-125"]
      }
    },
    showSkeleton: {
      true: {
        wrapper: ["group", "relative", "overflow-hidden", "bg-content3 dark:bg-content2"],
        img: "opacity-0"
      }
    },
    disableAnimation: {
      true: {
        img: "transition-none"
      },
      false: {
        img: "transition-transform-opacity motion-reduce:transition-none !duration-300"
      }
    }
  },
  defaultVariants: {
    radius: "lg",
    shadow: "none",
    isZoomed: false,
    isBlurred: false,
    showSkeleton: false
  },
  compoundVariants: [
    {
      showSkeleton: true,
      disableAnimation: false,
      class: {
        wrapper: [
          // before
          "before:opacity-100",
          "before:absolute",
          "before:inset-0",
          "before:-translate-x-full",
          "before:animate-shimmer",
          "before:border-t",
          "before:border-content4/30",
          "before:bg-gradient-to-r",
          "before:from-transparent",
          "before:via-content4",
          "dark:before:via-default-700/10",
          "before:to-transparent",
          //after
          "after:opacity-100",
          "after:absolute",
          "after:inset-0",
          "after:-z-10",
          "after:bg-content3",
          "dark:after:bg-content2"
        ]
      }
    }
  ],
  compoundSlots: [
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "none",
      class: "rounded-none"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "full",
      class: "rounded-full"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "sm",
      class: "rounded-small"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "md",
      class: "rounded-md"
    },
    {
      slots: ["wrapper", "img", "blurredImg", "zoomedWrapper"],
      radius: "lg",
      class: "rounded-large"
    }
  ]
});
var button = tv({
  base: [
    "z-0",
    "group",
    "relative",
    "inline-flex",
    "items-center",
    "justify-center",
    "box-border",
    "appearance-none",
    "outline-hidden",
    "select-none",
    "whitespace-nowrap",
    "min-w-max",
    "font-normal",
    "subpixel-antialiased",
    "overflow-hidden",
    "tap-highlight-transparent",
    "transform-gpu data-[pressed=true]:scale-[0.97]",
    "cursor-pointer",
    // focus ring
    ...dataFocusVisibleClasses
  ],
  variants: {
    variant: {
      solid: "",
      bordered: "border-medium bg-transparent",
      light: "bg-transparent",
      flat: "",
      faded: "border-medium",
      shadow: "",
      ghost: "border-medium bg-transparent"
    },
    size: {
      sm: "px-3 min-w-16 h-8 text-tiny gap-2 rounded-small",
      md: "px-4 min-w-20 h-10 text-small gap-2 rounded-medium",
      lg: "px-6 min-w-24 h-12 text-medium gap-3 rounded-large"
    },
    color: {
      default: "",
      primary: "",
      secondary: "",
      success: "",
      warning: "",
      danger: ""
    },
    radius: {
      none: "rounded-none",
      sm: "rounded-small",
      md: "rounded-medium",
      lg: "rounded-large",
      full: "rounded-full"
    },
    fullWidth: {
      true: "w-full"
    },
    isDisabled: {
      true: "opacity-disabled pointer-events-none"
    },
    isInGroup: {
      true: "[&:not(:first-child):not(:last-child)]:rounded-none"
    },
    isIconOnly: {
      true: "px-0 !gap-0",
      false: "[&>svg]:max-w-[theme(spacing.8)]"
    },
    disableAnimation: {
      true: "!transition-none data-[pressed=true]:scale-100",
      false: "transition-transform-colors-opacity motion-reduce:transition-none"
    }
  },
  defaultVariants: {
    size: "md",
    variant: "solid",
    color: "default",
    fullWidth: false,
    isDisabled: false,
    isInGroup: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: colorVariants.solid.default
    },
    {
      variant: "solid",
      color: "primary",
      class: colorVariants.solid.primary
    },
    {
      variant: "solid",
      color: "secondary",
      class: colorVariants.solid.secondary
    },
    {
      variant: "solid",
      color: "success",
      class: colorVariants.solid.success
    },
    {
      variant: "solid",
      color: "warning",
      class: colorVariants.solid.warning
    },
    {
      variant: "solid",
      color: "danger",
      class: colorVariants.solid.danger
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: colorVariants.shadow.default
    },
    {
      variant: "shadow",
      color: "primary",
      class: colorVariants.shadow.primary
    },
    {
      variant: "shadow",
      color: "secondary",
      class: colorVariants.shadow.secondary
    },
    {
      variant: "shadow",
      color: "success",
      class: colorVariants.shadow.success
    },
    {
      variant: "shadow",
      color: "warning",
      class: colorVariants.shadow.warning
    },
    {
      variant: "shadow",
      color: "danger",
      class: colorVariants.shadow.danger
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: colorVariants.bordered.default
    },
    {
      variant: "bordered",
      color: "primary",
      class: colorVariants.bordered.primary
    },
    {
      variant: "bordered",
      color: "secondary",
      class: colorVariants.bordered.secondary
    },
    {
      variant: "bordered",
      color: "success",
      class: colorVariants.bordered.success
    },
    {
      variant: "bordered",
      color: "warning",
      class: colorVariants.bordered.warning
    },
    {
      variant: "bordered",
      color: "danger",
      class: colorVariants.bordered.danger
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: colorVariants.flat.default
    },
    {
      variant: "flat",
      color: "primary",
      class: colorVariants.flat.primary
    },
    {
      variant: "flat",
      color: "secondary",
      class: colorVariants.flat.secondary
    },
    {
      variant: "flat",
      color: "success",
      class: colorVariants.flat.success
    },
    {
      variant: "flat",
      color: "warning",
      class: colorVariants.flat.warning
    },
    {
      variant: "flat",
      color: "danger",
      class: colorVariants.flat.danger
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: colorVariants.faded.default
    },
    {
      variant: "faded",
      color: "primary",
      class: colorVariants.faded.primary
    },
    {
      variant: "faded",
      color: "secondary",
      class: colorVariants.faded.secondary
    },
    {
      variant: "faded",
      color: "success",
      class: colorVariants.faded.success
    },
    {
      variant: "faded",
      color: "warning",
      class: colorVariants.faded.warning
    },
    {
      variant: "faded",
      color: "danger",
      class: colorVariants.faded.danger
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: [colorVariants.light.default, "data-[hover=true]:bg-default/40"]
    },
    {
      variant: "light",
      color: "primary",
      class: [colorVariants.light.primary, "data-[hover=true]:bg-primary/20"]
    },
    {
      variant: "light",
      color: "secondary",
      class: [colorVariants.light.secondary, "data-[hover=true]:bg-secondary/20"]
    },
    {
      variant: "light",
      color: "success",
      class: [colorVariants.light.success, "data-[hover=true]:bg-success/20"]
    },
    {
      variant: "light",
      color: "warning",
      class: [colorVariants.light.warning, "data-[hover=true]:bg-warning/20"]
    },
    {
      variant: "light",
      color: "danger",
      class: [colorVariants.light.danger, "data-[hover=true]:bg-danger/20"]
    },
    // ghost / color
    {
      variant: "ghost",
      color: "default",
      class: [colorVariants.ghost.default, "data-[hover=true]:!bg-default"]
    },
    {
      variant: "ghost",
      color: "primary",
      class: [
        colorVariants.ghost.primary,
        "data-[hover=true]:!bg-primary data-[hover=true]:!text-primary-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "secondary",
      class: [
        colorVariants.ghost.secondary,
        "data-[hover=true]:!bg-secondary data-[hover=true]:!text-secondary-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "success",
      class: [
        colorVariants.ghost.success,
        "data-[hover=true]:!bg-success data-[hover=true]:!text-success-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "warning",
      class: [
        colorVariants.ghost.warning,
        "data-[hover=true]:!bg-warning data-[hover=true]:!text-warning-foreground"
      ]
    },
    {
      variant: "ghost",
      color: "danger",
      class: [
        colorVariants.ghost.danger,
        "data-[hover=true]:!bg-danger data-[hover=true]:!text-danger-foreground"
      ]
    },
    // isInGroup / radius / size <-- radius not provided
    {
      isInGroup: true,
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      size: "sm",
      class: "rounded-none first:rounded-s-small last:rounded-e-small"
    },
    {
      isInGroup: true,
      size: "md",
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      size: "lg",
      class: "rounded-none first:rounded-s-large last:rounded-e-large"
    },
    {
      isInGroup: true,
      isRounded: true,
      class: "rounded-none first:rounded-s-full last:rounded-e-full"
    },
    // isInGroup / radius <-- radius provided
    {
      isInGroup: true,
      radius: "none",
      class: "rounded-none first:rounded-s-none last:rounded-e-none"
    },
    {
      isInGroup: true,
      radius: "sm",
      class: "rounded-none first:rounded-s-small last:rounded-e-small"
    },
    {
      isInGroup: true,
      radius: "md",
      class: "rounded-none first:rounded-s-medium last:rounded-e-medium"
    },
    {
      isInGroup: true,
      radius: "lg",
      class: "rounded-none first:rounded-s-large last:rounded-e-large"
    },
    {
      isInGroup: true,
      radius: "full",
      class: "rounded-none first:rounded-s-full last:rounded-e-full"
    },
    // isInGroup / bordered / ghost
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "default",
      className: collapseAdjacentVariantBorders.default
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "primary",
      className: collapseAdjacentVariantBorders.primary
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "secondary",
      className: collapseAdjacentVariantBorders.secondary
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "success",
      className: collapseAdjacentVariantBorders.success
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "warning",
      className: collapseAdjacentVariantBorders.warning
    },
    {
      isInGroup: true,
      variant: ["ghost", "bordered"],
      color: "danger",
      className: collapseAdjacentVariantBorders.danger
    },
    {
      isIconOnly: true,
      size: "sm",
      class: "min-w-8 w-8 h-8"
    },
    {
      isIconOnly: true,
      size: "md",
      class: "min-w-10 w-10 h-10"
    },
    {
      isIconOnly: true,
      size: "lg",
      class: "min-w-12 w-12 h-12"
    },
    // variant / hover
    {
      variant: ["solid", "faded", "flat", "bordered", "shadow"],
      class: "data-[hover=true]:opacity-hover"
    }
  ]
});
var buttonGroup = tv({
  base: "inline-flex items-center justify-center h-auto",
  variants: {
    fullWidth: {
      true: "w-full"
    }
  },
  defaultVariants: {
    fullWidth: false
  }
});
var calendar$2 = tv({
  slots: {
    base: [
      "relative w-fit max-w-full shadow-small inline-block overflow-y-hidden",
      "rounded-large overflow-x-auto bg-default-50 dark:bg-background",
      "w-[calc(var(--visible-months)_*_var(--calendar-width))]"
    ],
    prevButton: ["order-1"],
    nextButton: ["order-3"],
    headerWrapper: [
      "px-4 py-2 flex items-center justify-between gap-2 bg-content1 overflow-hidden rtl:flex-row-reverse",
      "[&_.chevron-icon]:flex-none",
      // month/year picker wrapper
      "after:content-['']",
      "after:bg-content1 origin-top",
      "after:w-full after:h-0",
      "after:absolute after:top-0 after:left-0"
    ],
    header: "flex w-full items-center justify-center gap-2 z-10 order-2",
    title: "text-default-500 text-small font-medium",
    content: "w-[calc(var(--visible-months)_*_var(--calendar-width))]",
    gridWrapper: "flex max-w-full overflow-hidden pb-2 h-auto relative",
    grid: "w-full border-collapse z-0",
    gridHeader: "bg-content1 shadow-[0px_20px_20px_0px_rgb(0_0_0/0.05)]",
    gridHeaderRow: "px-4 pb-2 flex justify-center text-default-400",
    gridHeaderCell: "flex w-8 justify-center items-center font-medium text-small",
    gridBody: "",
    gridBodyRow: "flex justify-center items-center first:mt-2",
    cell: "py-0.5 px-0",
    cellButton: [
      "w-8 h-8 flex items-center text-foreground justify-center rounded-full",
      "box-border appearance-none select-none whitespace-nowrap font-normal",
      "subpixel-antialiased overflow-hidden tap-highlight-transparent",
      "data-[disabled=true]:text-default-300",
      "data-[disabled=true]:cursor-default",
      "data-[readonly=true]:cursor-default",
      "data-[disabled=true]:transition-none",
      "data-[unavailable=true]:text-default-300",
      "data-[unavailable=true]:cursor-default",
      "data-[unavailable=true]:line-through",
      ...dataFocusVisibleClasses
    ],
    pickerWrapper: "absolute inset-x-0 top-0 flex w-full h-[var(--picker-height)] justify-center opacity-0 pointer-events-none",
    pickerMonthList: "items-start",
    pickerYearList: "items-center",
    pickerHighlight: "h-8 bg-default-200 absolute w-[calc(100%_-_16px)] rounded-medium z-0 top-1/2 -translate-y-1/2 pointer-events-none",
    pickerItem: [
      "w-full flex text-foreground items-center h-8 leading-[32px] min-h-[32px] snap-center text-large z-20",
      "data-[pressed=true]:opacity-50",
      ...dataFocusVisibleClasses
    ],
    helperWrapper: "px-4 pb-2 max-w-[270px] flex justify-start flex-wrap items-center",
    errorMessage: "text-small text-danger break-words max-w-full"
  },
  variants: {
    color: {
      foreground: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    // @internal
    isRange: {
      true: {
        cellButton: [
          // base
          "relative",
          "overflow-visible",
          // before pseudo element
          "before:content-[''] before:absolute before:inset-0 before:z-[-1] before:rounded-none",
          // hide before pseudo element when the selected cell is outside the month
          "data-[outside-month=true]:before:hidden",
          "data-[selected=true]:data-[range-selection=true]:data-[outside-month=true]:bg-transparent",
          "data-[selected=true]:data-[range-selection=true]:data-[outside-month=true]:text-default-300",
          // middle
          // "data-[selected=true]:data-[range-selection=true]:bg-transparent",
          // start (pseudo)
          "data-[range-start=true]:before:rounded-s-full",
          "data-[selection-start=true]:before:rounded-s-full",
          // end (pseudo)
          "data-[range-end=true]:before:rounded-e-full",
          "data-[selection-end=true]:before:rounded-e-full",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:rounded-full",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:rounded-full"
        ]
      },
      false: {}
    },
    hideDisabledDates: {
      true: {
        cellButton: "data-[disabled=true]:data-[outside-month=true]:opacity-0"
      },
      false: {}
    },
    isHeaderWrapperExpanded: {
      true: {
        headerWrapper: ["[&_.chevron-icon]:rotate-180", "after:h-full", "after:z-0"],
        pickerWrapper: "opacity-100 pointer-events-auto z-10",
        gridWrapper: "h-[var(--picker-height)] overflow-y-hidden",
        grid: "opacity-0 pointer-events-none",
        nextButton: "opacity-0 pointer-events-none",
        prevButton: "opacity-0 pointer-events-none"
      },
      false: {}
    },
    showMonthAndYearPickers: {
      true: {
        base: "[--picker-height:224px]",
        header: "h-8 bg-default-100 rounded-full"
      },
      false: {}
    },
    showShadow: {
      true: {
        cellButton: "data-[selected=true]:shadow-md"
      },
      false: {
        cellButton: "shadow-none data-[selected=true]:shadow-none"
      }
    },
    disableAnimation: {
      true: {
        cellButton: "transition-none"
      },
      false: {
        headerWrapper: ["[&_.chevron-icon]:transition-transform", "after:transition-height"],
        grid: "transition-opacity",
        cellButton: ["origin-center transition-[transform,background-color,color] !duration-150"],
        pickerWrapper: "transition-opacity !duration-250",
        pickerItem: "transition-opacity"
      }
    },
    isRTL: {
      true: {
        nextButton: "order-1",
        prevButton: "order-3"
      },
      false: {}
    }
  },
  defaultVariants: {
    color: "primary",
    showShadow: false,
    hideDisabledDates: false,
    showMonthAndYearPickers: false,
    isRTL: false
  },
  compoundVariants: [
    // !isRange & colors --> Calendar
    {
      isRange: false,
      color: "foreground",
      class: {
        cellButton: [
          "data-[hover=true]:bg-default-200",
          "data-[selected=true]:bg-foreground",
          "data-[selected=true]:text-background",
          "data-[hover=true]:bg-foreground-200",
          "data-[hover=true]:text-foreground-600",
          "data-[selected=true]:data-[hover=true]:bg-foreground",
          "data-[selected=true]:data-[hover=true]:text-background"
        ]
      }
    },
    {
      isRange: false,
      color: "primary",
      class: {
        cellButton: [
          "data-[selected=true]:bg-primary",
          "data-[selected=true]:text-primary-foreground",
          "data-[hover=true]:bg-primary-50",
          "data-[hover=true]:text-primary-400",
          "data-[selected=true]:data-[hover=true]:bg-primary",
          "data-[selected=true]:data-[hover=true]:text-primary-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "secondary",
      class: {
        cellButton: [
          "data-[selected=true]:bg-secondary",
          "data-[selected=true]:text-secondary-foreground",
          "data-[hover=true]:bg-secondary-50",
          "data-[hover=true]:text-secondary-400",
          "data-[selected=true]:data-[hover=true]:bg-secondary",
          "data-[selected=true]:data-[hover=true]:text-secondary-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "success",
      class: {
        cellButton: [
          "data-[selected=true]:bg-success",
          "data-[selected=true]:text-success-foreground",
          "data-[hover=true]:bg-success-100",
          "data-[hover=true]:text-success-600",
          "dark:data-[hover=true]:bg-success-50",
          "dark:data-[hover=true]:text-success-500",
          "data-[selected=true]:data-[hover=true]:bg-success",
          "dark:data-[selected=true]:data-[hover=true]:bg-success",
          "dark:data-[selected=true]:data-[hover=true]:text-success-foreground",
          "data-[selected=true]:data-[hover=true]:text-success-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "warning",
      class: {
        cellButton: [
          "data-[selected=true]:bg-warning",
          "data-[selected=true]:text-warning-foreground",
          "data-[hover=true]:bg-warning-100",
          "data-[hover=true]:text-warning-600",
          "dark:data-[hover=true]:bg-warning-50",
          "dark:data-[hover=true]:text-warning-500",
          "data-[selected=true]:data-[hover=true]:bg-warning",
          "dark:data-[selected=true]:data-[hover=true]:bg-warning",
          "dark:data-[selected=true]:data-[hover=true]:text-warning-foreground",
          "data-[selected=true]:data-[hover=true]:text-warning-foreground"
        ]
      }
    },
    {
      isRange: false,
      color: "danger",
      class: {
        cellButton: [
          "data-[selected=true]:bg-danger",
          "data-[selected=true]:text-danger-foreground",
          "data-[hover=true]:bg-danger-100",
          "data-[hover=true]:text-danger-500",
          "dark:data-[hover=true]:bg-danger-50",
          "dark:data-[hover=true]:text-danger-500",
          "data-[selected=true]:data-[hover=true]:bg-danger",
          "dark:data-[selected=true]:data-[hover=true]:bg-danger",
          "dark:data-[selected=true]:data-[hover=true]:text-danger-foreground",
          "data-[selected=true]:data-[hover=true]:text-danger-foreground"
        ]
      }
    },
    // isRange & colors --> RangeCalendar
    {
      isRange: true,
      color: "foreground",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-foreground/10",
          "data-[selected=true]:data-[range-selection=true]:text-foreground",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-foreground",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-background",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-foreground",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-background"
        ]
      }
    },
    {
      isRange: true,
      color: "primary",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-primary-50",
          "data-[selected=true]:data-[range-selection=true]:text-primary",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-primary",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-primary-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-primary",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-primary-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "secondary",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-secondary-50",
          "data-[selected=true]:data-[range-selection=true]:text-secondary",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-secondary",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-secondary-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-secondary",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-secondary-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "success",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-success-100",
          "data-[selected=true]:data-[range-selection=true]:text-success-600",
          "dark:data-[selected=true]:data-[range-selection=true]:before:bg-success-50",
          "dark:data-[selected=true]:data-[range-selection=true]:text-success-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-success",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-success-foreground",
          "dark:data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-success-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-success",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-success-foreground",
          "dark:data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-success-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "warning",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-warning-100",
          "dark:data-[selected=true]:data-[range-selection=true]:before:bg-warning-50",
          "data-[selected=true]:data-[range-selection=true]:text-warning-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-warning",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-warning-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-warning",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-warning-foreground"
        ]
      }
    },
    {
      isRange: true,
      color: "danger",
      class: {
        cellButton: [
          // middle
          "data-[selected=true]:data-[range-selection=true]:before:bg-danger-50",
          "data-[selected=true]:data-[range-selection=true]:text-danger-500",
          // start (selected)
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:bg-danger",
          "data-[selected=true]:data-[selection-start=true]:data-[range-selection=true]:text-danger-foreground",
          // end (selected)
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:bg-danger",
          "data-[selected=true]:data-[selection-end=true]:data-[range-selection=true]:text-danger-foreground"
        ]
      }
    },
    // showShadow & colors
    {
      showShadow: true,
      color: "foreground",
      class: {
        cellButton: "data-[selected=true]:shadow-foreground/40"
      }
    },
    {
      showShadow: true,
      color: "primary",
      class: {
        cellButton: "data-[selected=true]:shadow-primary/40"
      }
    },
    {
      showShadow: true,
      color: "secondary",
      class: {
        cellButton: "data-[selected=true]:shadow-secondary/40"
      }
    },
    {
      showShadow: true,
      color: "success",
      class: {
        cellButton: "data-[selected=true]:shadow-success/40"
      }
    },
    {
      showShadow: true,
      color: "warning",
      class: {
        cellButton: "data-[selected=true]:shadow-warning/40"
      }
    },
    {
      showShadow: true,
      color: "danger",
      class: {
        cellButton: "data-[selected=true]:shadow-danger/40"
      }
    },
    // showShadow & isRange
    {
      showShadow: true,
      isRange: true,
      class: {
        cellButton: [
          // remove shadow from middle
          "data-[selected=true]:shadow-none",
          // add shadow to start (selected)
          "data-[selected=true]:data-[selection-start=true]:shadow-md",
          // add shadow to end (selected)
          "data-[selected=true]:data-[selection-end=true]:shadow-md"
        ]
      }
    }
  ],
  compoundSlots: [
    {
      slots: ["prevButton", "nextButton"],
      class: ["text-medium", "text-default-400"]
    },
    {
      slots: ["pickerMonthList", "pickerYearList"],
      class: [
        // styles
        "flex flex-col px-4 overflow-y-scroll scrollbar-hide snap-y snap-mandatory",
        // scroll shadow
        "[--scroll-shadow-size:100px]",
        "[mask-image:linear-gradient(#000,#000,transparent_0,#000_var(--scroll-shadow-size),#000_calc(100%_-_var(--scroll-shadow-size)),transparent)]"
      ]
    }
  ]
});
var card = tv({
  slots: {
    base: [
      "flex",
      "flex-col",
      "relative",
      "overflow-hidden",
      "h-auto",
      "outline-hidden",
      "text-foreground",
      "box-border",
      "bg-content1",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    header: [
      "flex",
      "p-3",
      "z-10",
      "w-full",
      "justify-start",
      "items-center",
      "shrink-0",
      "overflow-inherit",
      "color-inherit",
      "subpixel-antialiased"
    ],
    body: [
      "relative",
      "flex",
      "flex-1",
      "w-full",
      "p-3",
      "flex-auto",
      "flex-col",
      "place-content-inherit",
      "align-items-inherit",
      "h-auto",
      "break-words",
      "text-left",
      "overflow-y-auto",
      "subpixel-antialiased"
    ],
    footer: [
      "p-3",
      "h-auto",
      "flex",
      "w-full",
      "items-center",
      "overflow-hidden",
      "color-inherit",
      "subpixel-antialiased"
    ]
  },
  variants: {
    shadow: {
      none: {
        base: "shadow-none"
      },
      sm: {
        base: "shadow-small"
      },
      md: {
        base: "shadow-medium"
      },
      lg: {
        base: "shadow-large"
      }
    },
    radius: {
      none: {
        base: "rounded-none",
        header: "rounded-none",
        footer: "rounded-none"
      },
      sm: {
        base: "rounded-small",
        header: "rounded-t-small",
        footer: "rounded-b-small"
      },
      md: {
        base: "rounded-medium",
        header: "rounded-t-medium",
        footer: "rounded-b-medium"
      },
      lg: {
        base: "rounded-large",
        header: "rounded-t-large",
        footer: "rounded-b-large"
      }
    },
    fullWidth: {
      true: {
        base: "w-full"
      }
    },
    isHoverable: {
      true: {
        base: "data-[hover=true]:bg-content2 dark:data-[hover=true]:bg-content2"
      }
    },
    isPressable: {
      true: { base: "cursor-pointer" }
    },
    isBlurred: {
      true: {
        base: [
          "bg-background/80",
          "dark:bg-background/20",
          "backdrop-blur-md",
          "backdrop-saturate-150"
        ]
      }
    },
    isFooterBlurred: {
      true: {
        footer: ["bg-background/10", "backdrop-blur", "backdrop-saturate-150"]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled cursor-not-allowed"
      }
    },
    disableAnimation: {
      true: "",
      false: { base: "transition-transform-background motion-reduce:transition-none" }
    }
  },
  compoundVariants: [
    {
      isPressable: true,
      class: "data-[pressed=true]:scale-[0.97] tap-highlight-transparent"
    }
  ],
  defaultVariants: {
    radius: "lg",
    shadow: "md",
    fullWidth: false,
    isHoverable: false,
    isPressable: false,
    isDisabled: false,
    isFooterBlurred: false
  }
});
var checkbox = tv({
  slots: {
    base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
    wrapper: [
      "relative",
      "inline-flex",
      "items-center",
      "justify-center",
      "shrink-0",
      "overflow-hidden",
      // before
      "before:content-['']",
      "before:absolute",
      "before:inset-0",
      "before:border-solid",
      "before:border-2",
      "before:box-border",
      "before:border-default",
      // after
      "after:content-['']",
      "after:absolute",
      "after:inset-0",
      "after:scale-50",
      "after:opacity-0",
      "after:origin-center",
      "group-data-[selected=true]:after:scale-100",
      "group-data-[selected=true]:after:opacity-100",
      // hover
      "group-data-[hover=true]:before:bg-default-100",
      // focus ring
      ...groupDataFocusVisibleClasses
    ],
    hiddenInput: hiddenInputClasses,
    icon: "z-10 w-4 h-3 opacity-0 group-data-[selected=true]:opacity-100 pointer-events-none",
    label: "relative text-foreground select-none"
  },
  variants: {
    color: {
      default: {
        wrapper: "after:bg-default after:text-default-foreground text-default-foreground"
      },
      primary: {
        wrapper: "after:bg-primary after:text-primary-foreground text-primary-foreground"
      },
      secondary: {
        wrapper: "after:bg-secondary after:text-secondary-foreground text-secondary-foreground"
      },
      success: {
        wrapper: "after:bg-success after:text-success-foreground text-success-foreground"
      },
      warning: {
        wrapper: "after:bg-warning after:text-warning-foreground text-warning-foreground"
      },
      danger: {
        wrapper: "after:bg-danger after:text-danger-foreground text-danger-foreground"
      }
    },
    size: {
      sm: {
        wrapper: [
          "w-4 h-4 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.5)]"
        ],
        label: "text-small",
        icon: "w-3 h-2"
      },
      md: {
        wrapper: [
          "w-5 h-5 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.6)]"
        ],
        label: "text-medium",
        icon: "w-4 h-3"
      },
      lg: {
        wrapper: [
          "w-6 h-6 me-2",
          "rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.7)]"
        ],
        label: "text-large",
        icon: "w-5 h-4"
      }
    },
    radius: {
      none: {
        wrapper: "rounded-none before:rounded-none after:rounded-none"
      },
      sm: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.5)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.5)]"
        ]
      },
      md: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.6)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.6)]"
        ]
      },
      lg: {
        wrapper: [
          "rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "before:rounded-[calc(var(--heroui-radius-medium)*0.7)]",
          "after:rounded-[calc(var(--heroui-radius-medium)*0.7)]"
        ]
      },
      full: {
        wrapper: "rounded-full before:rounded-full after:rounded-full"
      }
    },
    lineThrough: {
      true: {
        label: [
          "inline-flex",
          "items-center",
          "justify-center",
          "before:content-['']",
          "before:absolute",
          "before:bg-foreground",
          "before:w-0",
          "before:h-0.5",
          "group-data-[selected=true]:opacity-60",
          "group-data-[selected=true]:before:w-full"
        ]
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    isInvalid: {
      true: {
        wrapper: "before:border-danger",
        label: "text-danger"
      }
    },
    disableAnimation: {
      true: {
        wrapper: "transition-none",
        icon: "transition-none",
        label: "transition-none"
      },
      false: {
        wrapper: [
          "before:transition-colors",
          "group-data-[pressed=true]:scale-95",
          "transition-transform",
          "after:transition-transform-opacity",
          "after:!ease-linear",
          "after:!duration-200",
          "motion-reduce:transition-none"
        ],
        icon: "transition-opacity motion-reduce:transition-none",
        label: "transition-colors-opacity before:transition-width motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    color: "primary",
    size: "md",
    isDisabled: false,
    lineThrough: false
  }
});
var checkboxGroup = tv({
  slots: {
    base: "relative flex flex-col gap-2",
    label: "relative text-medium text-foreground-500",
    wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row",
    description: "text-small text-foreground-400",
    errorMessage: "text-small text-danger"
  },
  variants: {
    isRequired: {
      true: {
        label: "after:content-['*'] after:text-danger after:ml-0.5"
      }
    },
    isInvalid: {
      true: {
        description: "text-danger"
      }
    },
    disableAnimation: {
      true: {},
      false: {
        description: "transition-colors !duration-150 motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    isInvalid: false,
    isRequired: false
  }
});
var chip = tv({
  slots: {
    base: [
      "relative",
      "max-w-fit",
      "min-w-min",
      "inline-flex",
      "items-center",
      "justify-between",
      "box-border",
      "whitespace-nowrap"
    ],
    content: "flex-1 text-inherit font-normal",
    dot: ["w-2", "h-2", "ml-1", "rounded-full"],
    avatar: "shrink-0",
    closeButton: [
      "z-10",
      "appearance-none",
      "outline-hidden",
      "select-none",
      "transition-opacity",
      "opacity-70",
      "hover:opacity-100",
      "cursor-pointer",
      "active:opacity-disabled",
      "tap-highlight-transparent"
    ]
  },
  variants: {
    variant: {
      solid: {},
      bordered: {
        base: "border-medium bg-transparent"
      },
      light: {
        base: "bg-transparent"
      },
      flat: {},
      faded: {
        base: "border-medium"
      },
      shadow: {},
      dot: {
        base: "border-medium border-default text-foreground bg-transparent"
      }
    },
    color: {
      default: {
        dot: "bg-default-400"
      },
      primary: {
        dot: "bg-primary"
      },
      secondary: {
        dot: "bg-secondary"
      },
      success: {
        dot: "bg-success"
      },
      warning: {
        dot: "bg-warning"
      },
      danger: {
        dot: "bg-danger"
      }
    },
    size: {
      sm: {
        base: "px-1 h-6 text-tiny",
        content: "px-1",
        closeButton: "text-medium",
        avatar: "w-4 h-4"
      },
      md: {
        base: "px-1 h-7 text-small",
        content: "px-2",
        closeButton: "text-large",
        avatar: "w-5 h-5"
      },
      lg: {
        base: "px-2 h-8 text-medium",
        content: "px-2",
        closeButton: "text-xl",
        avatar: "w-6 h-6"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      },
      full: {
        base: "rounded-full"
      }
    },
    isOneChar: {
      true: {},
      false: {}
    },
    isCloseable: {
      true: {},
      false: {}
    },
    hasStartContent: {
      true: {}
    },
    hasEndContent: {
      true: {}
    },
    isDisabled: {
      true: { base: "opacity-disabled pointer-events-none" }
    },
    isCloseButtonFocusVisible: {
      true: {
        closeButton: [...ringClasses, "ring-1", "rounded-full"]
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    size: "md",
    radius: "full",
    isDisabled: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        base: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        base: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        base: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        base: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        base: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        base: colorVariants.shadow.danger
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: colorVariants.bordered.default
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: colorVariants.bordered.primary
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: colorVariants.bordered.secondary
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: colorVariants.bordered.success
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: colorVariants.bordered.warning
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: colorVariants.bordered.danger
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        base: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        base: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        base: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        base: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        base: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        base: colorVariants.flat.danger
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: colorVariants.faded.default
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: colorVariants.faded.primary
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: colorVariants.faded.secondary
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: colorVariants.faded.success
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: colorVariants.faded.warning
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: colorVariants.faded.danger
      }
    },
    // light / color
    {
      variant: "light",
      color: "default",
      class: {
        base: colorVariants.light.default
      }
    },
    {
      variant: "light",
      color: "primary",
      class: {
        base: colorVariants.light.primary
      }
    },
    {
      variant: "light",
      color: "secondary",
      class: {
        base: colorVariants.light.secondary
      }
    },
    {
      variant: "light",
      color: "success",
      class: {
        base: colorVariants.light.success
      }
    },
    {
      variant: "light",
      color: "warning",
      class: {
        base: colorVariants.light.warning
      }
    },
    {
      variant: "light",
      color: "danger",
      class: {
        base: colorVariants.light.danger
      }
    },
    // isOneChar / size
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "sm",
      class: {
        base: "w-5 h-5 min-w-5 min-h-5"
      }
    },
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "md",
      class: {
        base: "w-6 h-6 min-w-6 min-h-6"
      }
    },
    {
      isOneChar: true,
      hasStartContent: false,
      hasEndContent: false,
      size: "lg",
      class: {
        base: "w-7 h-7 min-w-7 min-h-7"
      }
    },
    // isOneChar / isCloseable
    {
      isOneChar: true,
      isCloseable: false,
      hasStartContent: false,
      hasEndContent: false,
      class: {
        base: "px-0 justify-center",
        content: "px-0 flex-none"
      }
    },
    {
      isOneChar: true,
      isCloseable: true,
      hasStartContent: false,
      hasEndContent: false,
      class: {
        base: "w-auto"
      }
    },
    // isOneChar / dot
    {
      isOneChar: true,
      variant: "dot",
      class: {
        base: "w-auto h-7 px-1 items-center",
        content: "px-2"
      }
    },
    // hasStartContent / size
    {
      hasStartContent: true,
      size: "sm",
      class: {
        content: "pl-0.5"
      }
    },
    {
      hasStartContent: true,
      size: ["md", "lg"],
      class: {
        content: "pl-1"
      }
    },
    // hasEndContent / size
    {
      hasEndContent: true,
      size: "sm",
      class: {
        content: "pr-0.5"
      }
    },
    {
      hasEndContent: true,
      size: ["md", "lg"],
      class: {
        content: "pr-1"
      }
    }
  ]
});
var code$1 = tv({
  base: ["px-2", "py-1", "h-fit", "font-mono", "font-normal", "inline-block", "whitespace-nowrap"],
  variants: {
    color: {
      default: colorVariants.flat.default,
      primary: colorVariants.flat.primary,
      secondary: colorVariants.flat.secondary,
      success: colorVariants.flat.success,
      warning: colorVariants.flat.warning,
      danger: colorVariants.flat.danger
    },
    size: {
      sm: "text-small",
      md: "text-medium",
      lg: "text-large"
    },
    radius: {
      none: "rounded-none",
      sm: "rounded-small",
      md: "rounded-medium",
      lg: "rounded-large",
      full: "rounded-full"
    }
  },
  defaultVariants: {
    color: "default",
    size: "sm",
    radius: "sm"
  }
});
var dateInput = tv({
  slots: {
    base: "group flex flex-col",
    label: [
      "block subpixel-antialiased text-small text-default-600",
      // isRequired=true
      "group-data-[required=true]:after:content-['*'] group-data-[required=true]:after:text-danger group-data-[required=true]:after:ml-0.5",
      // isInValid=true
      "group-data-[invalid=true]:text-danger"
    ],
    inputWrapper: [
      "relative px-3 gap-3 w-full inline-flex flex-row items-center",
      "cursor-text tap-highlight-transparent shadow-xs"
    ],
    input: "flex h-full gap-x-0.5 w-full font-normal",
    innerWrapper: [
      "flex items-center text-default-400 w-full gap-x-2 h-6",
      // isInValid=true
      "group-data-[invalid=true]:text-danger"
    ],
    // this wraps the input and the start/end content
    segment: [
      "group first:-ml-0.5 [&:not(:first-child)]:-ml-1 px-0.5 my-auto box-content tabular-nums text-start",
      "inline-block outline-hidden focus:shadow-xs rounded-md",
      "text-foreground-500 data-[editable=true]:text-foreground",
      "data-[editable=true]:data-[placeholder=true]:text-foreground-500",
      // isInvalid=true
      "data-[invalid=true]:text-danger-300 data-[invalid=true]:data-[editable=true]:text-danger",
      "data-[invalid=true]:focus:bg-danger-400/50 dark:data-[invalid=true]:focus:bg-danger-400/20",
      "data-[invalid=true]:data-[editable=true]:focus:text-danger"
    ],
    helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
    description: "text-tiny text-foreground-400",
    errorMessage: "text-tiny text-danger"
  },
  variants: {
    variant: {
      flat: {
        inputWrapper: [
          "bg-default-100",
          "hover:bg-default-200",
          "focus-within:hover:bg-default-100",
          // isInvalid=true
          "group-data-[invalid=true]:bg-danger-50",
          "group-data-[invalid=true]:hover:bg-danger-100",
          "group-data-[invalid=true]:focus-within:hover:bg-danger-50"
        ]
      },
      faded: {
        inputWrapper: [
          "bg-default-100",
          "border-medium",
          "border-default-200",
          "hover:border-default-400"
        ]
      },
      bordered: {
        inputWrapper: [
          "border-medium",
          "border-default-200",
          "hover:border-default-400",
          "focus-within:border-default-foreground",
          "focus-within:hover:border-default-foreground",
          // isInvalid=true
          "group-data-[invalid=true]:border-danger",
          "group-data-[invalid=true]:hover:border-danger",
          "group-data-[invalid=true]:focus-within:hover:border-danger"
        ]
      },
      underlined: {
        inputWrapper: [
          "px-1",
          "pb-1",
          "gap-0",
          "relative",
          "box-border",
          "border-b-medium",
          "shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
          "border-default-200",
          "!rounded-none",
          "hover:border-default-300",
          "after:content-['']",
          "after:w-0",
          "after:origin-center",
          "after:bg-default-foreground",
          "after:absolute",
          "after:left-1/2",
          "after:-translate-x-1/2",
          "after:-bottom-[2px]",
          "after:h-[2px]",
          "focus-within:after:w-full",
          // isInvalid=true
          "group-data-[invalid=true]:after:bg-danger"
        ]
      }
    },
    color: {
      default: {
        segment: "focus:bg-default-400/50 data-[editable=true]:focus:text-default-foreground"
      },
      primary: {
        segment: "focus:bg-primary-400/50 data-[editable=true]:focus:text-primary"
      },
      secondary: {
        segment: "focus:bg-secondary-400/50 data-[editable=true]:focus:text-secondary"
      },
      success: {
        segment: "focus:bg-success-400/50 dark:focus:bg-success-400/20 data-[editable=true]:focus:text-success"
      },
      warning: {
        segment: "focus:bg-warning-400/50 dark:focus:bg-warning-400/20 data-[editable=true]:focus:text-warning"
      },
      danger: {
        segment: "focus:bg-danger-400/50 dark:focus:bg-danger-400/20 data-[editable=true]:focus:text-danger"
      }
    },
    size: {
      sm: {
        label: "text-tiny",
        input: "text-small",
        inputWrapper: "h-8 min-h-8 px-2 rounded-small"
      },
      md: {
        input: "text-small",
        inputWrapper: "h-10 min-h-10 rounded-medium",
        clearButton: "text-large"
      },
      lg: {
        label: "text-medium",
        input: "text-medium",
        inputWrapper: "h-12 min-h-12 rounded-large"
      }
    },
    radius: {
      none: {
        inputWrapper: "rounded-none"
      },
      sm: {
        inputWrapper: "rounded-small"
      },
      md: {
        inputWrapper: "rounded-medium"
      },
      lg: {
        inputWrapper: "rounded-large"
      },
      full: {
        inputWrapper: "rounded-full"
      }
    },
    labelPlacement: {
      outside: {
        base: "flex flex-col data-[has-helper=true]:pb-[calc(var(--heroui-font-size-tiny)_+8px)] gap-y-1.5",
        label: "w-full text-foreground",
        helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
      },
      "outside-left": {
        base: "flex-row items-center data-[has-helper=true]:pb-[calc(var(--heroui-font-size-tiny)_+_8px)] gap-x-2 flex-nowrap",
        label: "relative text-foreground",
        inputWrapper: "relative flex-1",
        helperWrapper: "absolute top-[calc(100%_+_2px)] start-0"
      },
      inside: {
        label: "w-full text-tiny cursor-text",
        inputWrapper: "flex-col items-start justify-center gap-0"
      }
    },
    fullWidth: {
      true: {
        base: "w-full",
        inputWrapper: "w-full"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none",
        inputWrapper: "pointer-events-none",
        label: "pointer-events-none"
      }
    },
    disableAnimation: {
      true: {
        label: "transition-none",
        input: "transition-none",
        inputWrapper: "transition-none"
      },
      false: {
        label: [
          "!ease-out",
          "!duration-200",
          "will-change-auto",
          "motion-reduce:transition-none",
          "transition-[color,opacity]"
        ],
        inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
        segment: "transition-colors motion-reduce:transition-none"
      }
    }
  },
  defaultVariants: {
    variant: "flat",
    color: "default",
    size: "md",
    fullWidth: true,
    isDisabled: false
  },
  compoundVariants: [
    // flat & color
    {
      variant: "flat",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: ["bg-primary-100", "hover:bg-primary-50", "focus-within:bg-primary-50"],
        segment: "text-primary-300 data-[editable=true]:data-[placeholder=true]:text-primary-300 data-[editable=true]:text-primary",
        label: "text-primary"
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: ["bg-secondary-100", "hover:bg-secondary-50", "focus-within:bg-secondary-50"],
        segment: "text-secondary-300 data-[editable=true]:data-[placeholder=true]:text-secondary-300 data-[editable=true]:text-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        innerWrapper: "text-success-600 dark:text-success",
        inputWrapper: ["bg-success-100", "hover:bg-success-50", "focus-within:bg-success-50"],
        segment: "text-success-400 data-[editable=true]:data-[placeholder=true]:text-success-400 data-[editable=true]:text-success-600 data-[editable=true]:focus:text-success-600",
        label: "text-success-600 dark:text-success"
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        innerWrapper: "text-warning-600 dark:text-warning",
        inputWrapper: ["bg-warning-100", "hover:bg-warning-50", "focus-within:bg-warning-50"],
        segment: "text-warning-400 data-[editable=true]:data-[placeholder=true]:text-warning-400 data-[editable=true]:text-warning-600 data-[editable=true]:focus:text-warning-600",
        label: "text-warning-600 dark:text-warning"
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: ["bg-danger-100", "hover:bg-danger-50", "focus-within:bg-danger-50"],
        segment: "text-danger-300 data-[editable=true]:data-[placeholder=true]:text-danger-300 data-[editable=true]:text-danger",
        label: "text-danger"
      }
    },
    // faded & color
    {
      variant: "faded",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: [
          "hover:border-primary",
          "focus-within:border-primary",
          "focus-within:hover:border-primary"
        ],
        label: "text-primary"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: [
          "hover:border-secondary",
          "focus-within:border-secondary",
          "focus-within:hover:border-secondary"
        ],
        label: "text-secondary"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: [
          "hover:border-success",
          "focus-within:border-success",
          "focus-within:hover:border-success"
        ],
        label: "text-success"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: [
          "hover:border-warning",
          "focus-within:border-warning",
          "focus-within:hover:border-warning"
        ],
        label: "text-warning"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: [
          "hover:border-danger",
          "focus-within:border-danger",
          "focus-within:hover:border-danger"
        ],
        label: "text-danger"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: ["focus-within:border-primary", "focus-within:hover:border-primary"],
        label: "text-primary"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: ["focus-within:border-secondary", "focus-within:hover:border-secondary"],
        label: "text-secondary"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: ["focus-within:border-success", "focus-within:hover:border-success"],
        label: "text-success"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: ["focus-within:border-warning", "focus-within:hover:border-warning"],
        label: "text-warning"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: ["focus-within:border-danger", "focus-within:hover:border-danger"],
        label: "text-danger"
      }
    },
    // underlined & color
    {
      variant: "underlined",
      color: "primary",
      class: {
        innerWrapper: "text-primary",
        inputWrapper: "after:bg-primary",
        label: "text-primary"
      }
    },
    {
      variant: "underlined",
      color: "secondary",
      class: {
        innerWrapper: "text-secondary",
        inputWrapper: "after:bg-secondary",
        label: "text-secondary"
      }
    },
    {
      variant: "underlined",
      color: "success",
      class: {
        innerWrapper: "text-success",
        inputWrapper: "after:bg-success",
        label: "text-success"
      }
    },
    {
      variant: "underlined",
      color: "warning",
      class: {
        innerWrapper: "text-warning",
        inputWrapper: "after:bg-warning",
        label: "text-warning"
      }
    },
    {
      variant: "underlined",
      color: "danger",
      class: {
        innerWrapper: "text-danger",
        inputWrapper: "after:bg-danger",
        label: "text-danger"
      }
    },
    // size & labelPlacement
    {
      labelPlacement: "inside",
      size: "sm",
      class: {
        inputWrapper: "h-12 py-1.5 px-3"
      }
    },
    {
      labelPlacement: "inside",
      size: "md",
      class: {
        inputWrapper: "h-14 py-2"
      }
    },
    {
      labelPlacement: "inside",
      size: "lg",
      class: {
        label: "text-medium",
        inputWrapper: "h-16 py-2.5 gap-0"
      }
    },
    // !disableAnimation & variant
    {
      disableAnimation: false,
      variant: ["faded", "bordered"],
      class: {
        inputWrapper: "transition-colors motion-reduce:transition-none"
      }
    },
    {
      disableAnimation: false,
      variant: "underlined",
      class: {
        inputWrapper: "after:transition-width motion-reduce:after:transition-none"
      }
    }
  ]
});
var datePicker = tv({
  slots: {
    base: "group w-full",
    selectorButton: "-mx-2 text-inherit",
    selectorIcon: "text-lg text-inherit pointer-events-none shrink-0",
    popoverContent: "p-0 w-full",
    calendar: "w-[calc(var(--visible-months)_*_var(--calendar-width))] shadow-none",
    calendarContent: "w-[calc(var(--visible-months)_*_var(--calendar-width))]",
    timeInputLabel: "font-medium",
    timeInput: "px-5 pb-4 flex-wrap gap-x-6"
  }
});
var dateRangePicker = tv({
  extend: datePicker,
  slots: {
    calendar: "group",
    bottomContent: "flex flex-col gap-y-2",
    timeInputWrapper: "flex flex-col group-data-[has-multiple-months=true]:flex-row",
    separator: "-mx-1 text-inherit"
  }
});
var accordion = tv({
  base: "px-2",
  variants: {
    variant: {
      light: "",
      shadow: "px-4 shadow-medium rounded-medium bg-content1",
      bordered: "px-4 border-medium border-divider rounded-medium",
      splitted: "flex flex-col gap-2"
    },
    fullWidth: {
      true: "w-full"
    }
  },
  defaultVariants: {
    variant: "light",
    fullWidth: true
  }
});
var accordionItem = tv({
  slots: {
    base: "",
    heading: "",
    trigger: [
      "flex py-4 w-full h-full gap-3 outline-hidden items-center tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    startContent: "shrink-0",
    indicator: "text-default-400",
    titleWrapper: "flex-1 flex flex-col text-start",
    title: "text-foreground text-medium",
    subtitle: "text-small text-foreground-500 font-normal",
    content: "py-2"
  },
  variants: {
    variant: {
      splitted: {
        base: "px-4 bg-content1 shadow-medium rounded-medium"
      }
    },
    isCompact: {
      true: {
        trigger: "py-2",
        title: "text-medium",
        subtitle: "text-small",
        indicator: "text-medium",
        content: "py-1"
      }
    },
    isDisabled: {
      true: {
        base: "opacity-disabled pointer-events-none"
      }
    },
    hideIndicator: {
      true: {
        indicator: "hidden"
      }
    },
    disableAnimation: {
      true: {
        content: "hidden data-[open=true]:block"
      },
      false: {
        indicator: "transition-transform",
        trigger: "transition-opacity"
      }
    },
    disableIndicatorAnimation: {
      true: {
        indicator: "transition-none"
      },
      false: {
        indicator: "rotate-0 data-[open=true]:-rotate-90 rtl:-rotate-180 rtl:data-[open=true]:-rotate-90"
      }
    }
  },
  defaultVariants: {
    size: "md",
    radius: "lg",
    isDisabled: false,
    hideIndicator: false,
    disableIndicatorAnimation: false
  }
});
var alert = tv({
  slots: {
    base: "flex flex-grow flex-row w-full items-start py-3 px-4 gap-x-1",
    mainWrapper: "h-full flex-grow min-h-10 ms-2 flex flex-col box-border items-start text-inherit justify-center",
    title: "text-small w-full font-medium block text-inherit leading-5",
    description: "pl-[1px] text-small font-normal text-inherit",
    closeButton: "relative text-inherit translate-x-1 -translate-y-1",
    iconWrapper: "flex-none relative w-9 h-9 rounded-full grid place-items-center",
    alertIcon: "fill-current w-6 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
  },
  variants: {
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    variant: {
      solid: {},
      flat: {},
      faded: {
        base: "border-small"
      },
      bordered: {
        base: "border-small bg-transparent"
      }
    },
    radius: {
      none: {
        base: "rounded-none"
      },
      sm: {
        base: "rounded-small"
      },
      md: {
        base: "rounded-medium"
      },
      lg: {
        base: "rounded-large"
      },
      full: {
        base: "rounded-full"
      }
    },
    hideIcon: {
      true: {
        iconWrapper: "hidden"
      }
    },
    hideIconWrapper: {
      true: {
        base: "gap-x-0",
        iconWrapper: "!bg-transparent !shadow-none !border-none"
      }
    },
    hasContent: {
      false: {
        base: "items-start",
        mainWrapper: "justify-center items-center"
      }
    }
  },
  defaultVariants: {
    color: "default",
    variant: "flat",
    radius: "md",
    hideIcon: false,
    hideIconWrapper: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        base: colorVariants.solid.default,
        closeButton: "data-[hover]:bg-default-100",
        alertIcon: "text-default-foreground"
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        base: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        base: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        base: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        base: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        base: colorVariants.solid.danger
      }
    },
    // flat & faded / color
    {
      variant: ["flat", "faded"],
      color: "default",
      class: {
        base: [
          colorVariants.flat.default,
          "bg-default-100 dark:bg-default-50/50",
          "text-default-foreground"
        ],
        description: "text-default-600",
        closeButton: "text-default-400",
        iconWrapper: "bg-default-50 dark:bg-default-100 border-default-200"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "primary",
      class: {
        base: [colorVariants.flat.primary, "bg-primary-50 dark:bg-primary-50/50"],
        closeButton: "text-primary-500 data-[hover]:bg-primary-200",
        iconWrapper: "bg-primary-50 dark:bg-primary-100 border-primary-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "secondary",
      class: {
        base: [colorVariants.flat.secondary, "bg-secondary-50 dark:bg-secondary-50/50"],
        closeButton: "text-secondary-500 data-[hover]:bg-secondary-200",
        iconWrapper: "bg-secondary-50 dark:bg-secondary-100 border-secondary-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "success",
      class: {
        base: [colorVariants.flat.success, "bg-success-50 dark:bg-success-50/50"],
        closeButton: "text-success-500 data-[hover]:bg-success-200",
        iconWrapper: "bg-success-50 dark:bg-success-100 border-success-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "warning",
      class: {
        base: [colorVariants.flat.warning, "bg-warning-50 dark:bg-warning-50/50"],
        closeButton: "text-warning-500 data-[hover]:bg-warning-200",
        iconWrapper: "bg-warning-50 dark:bg-warning-100 border-warning-100"
      }
    },
    {
      variant: ["flat", "faded"],
      color: "danger",
      class: {
        base: [colorVariants.flat.danger, "bg-danger-50 dark:bg-danger-50/50"],
        closeButton: "text-danger-500 data-[hover]:bg-danger-200",
        iconWrapper: "bg-danger-50 dark:bg-danger-100 border-danger-100"
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        base: "border-default-300 dark:border-default-200"
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        base: "border-primary-200 dark:border-primary-100"
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        base: "border-secondary-200"
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        base: "border-success-300 dark:border-success-100"
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        base: "border-warning-300 dark:border-warning-100"
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        base: "border-danger-200 dark:border-danger-100"
      }
    },
    // bordered / color
    {
      variant: "bordered",
      color: "default",
      class: {
        base: [colorVariants.bordered.default],
        description: "text-default-600",
        closeButton: "text-default-400"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        base: [colorVariants.bordered.primary],
        closeButton: "data-[hover]:bg-primary-50"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        base: [colorVariants.bordered.secondary],
        closeButton: "data-[hover]:bg-secondary-50"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        base: [colorVariants.bordered.success],
        closeButton: "data-[hover]:bg-success-50"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        base: [colorVariants.bordered.warning],
        closeButton: "data-[hover]:bg-warning-100"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        base: [colorVariants.bordered.danger],
        closeButton: "data-[hover]:bg-danger-50"
      }
    },
    // flat & bordered & faded
    {
      variant: ["flat", "bordered", "faded"],
      class: {
        iconWrapper: "shadow-small"
      }
    },
    // flat & faded
    {
      variant: ["flat", "faded"],
      class: {
        iconWrapper: "shadow-small border-1"
      }
    },
    // bordered & color
    {
      variant: "bordered",
      color: "default",
      class: {
        iconWrapper: "bg-default-200 dark:bg-default-100"
      }
    },
    {
      variant: "bordered",
      color: "primary",
      class: {
        iconWrapper: "bg-primary-100 dark:bg-primary-50"
      }
    },
    {
      variant: "bordered",
      color: "secondary",
      class: {
        iconWrapper: "bg-secondary-100 dark:bg-secondary-50"
      }
    },
    {
      variant: "bordered",
      color: "success",
      class: {
        iconWrapper: "bg-success-100 dark:bg-success-50"
      }
    },
    {
      variant: "bordered",
      color: "warning",
      class: {
        iconWrapper: "bg-warning-100 dark:bg-warning-50"
      }
    },
    {
      variant: "bordered",
      color: "danger",
      class: {
        iconWrapper: "bg-danger-100 dark:bg-danger-50"
      }
    }
  ]
});
var autocomplete = tv({
  slots: {
    base: "group inline-flex flex-column w-full",
    listboxWrapper: "scroll-py-6 w-full",
    listbox: "",
    popoverContent: "w-full p-1 overflow-hidden",
    endContentWrapper: "relative flex h-full items-center -mr-2",
    clearButton: [
      "text-medium",
      "translate-x-1",
      "cursor-text",
      "opacity-0",
      "pointer-events-none",
      "text-default-500",
      "group-data-[invalid=true]:text-danger",
      "data-[visible=true]:opacity-100",
      // on mobile is always visible when there is a value
      "data-[visible=true]:pointer-events-auto",
      "data-[visible=true]:cursor-pointer",
      "sm:data-[visible=true]:opacity-0",
      // only visible on hover
      "sm:data-[visible=true]:pointer-events-none",
      "sm:group-data-[hover=true]:data-[visible=true]:opacity-100",
      "sm:group-data-[hover=true]:data-[visible=true]:pointer-events-auto"
    ],
    selectorButton: "text-medium"
  },
  variants: {
    isClearable: {
      true: {},
      false: {
        clearButton: "hidden"
      }
    },
    disableAnimation: {
      true: {
        selectorButton: "transition-none"
      },
      false: {
        selectorButton: "transition-transform duration-150 ease motion-reduce:transition-none"
      }
    },
    disableSelectorIconRotation: {
      true: {},
      false: {
        selectorButton: "data-[open=true]:rotate-180"
      }
    }
  },
  defaultVariants: {
    isClearable: true,
    disableSelectorIconRotation: false
  }
});
var badge = tv({
  slots: {
    base: ["relative", "inline-flex", "shrink-0"],
    badge: [
      "flex",
      "z-10",
      "flex-wrap",
      "absolute",
      "box-border",
      "rounded-full",
      "whitespace-nowrap",
      "place-content-center",
      "origin-center",
      "items-center",
      "text-inherit",
      "select-none",
      "font-regular",
      "scale-100",
      "opacity-100",
      "subpixel-antialiased",
      "data-[invisible=true]:scale-0",
      "data-[invisible=true]:opacity-0"
    ]
  },
  variants: {
    variant: {
      solid: {},
      flat: {},
      faded: {
        badge: "border-medium"
      },
      shadow: {}
    },
    color: {
      default: {},
      primary: {},
      secondary: {},
      success: {},
      warning: {},
      danger: {}
    },
    size: {
      sm: {
        badge: "px-1 text-tiny"
      },
      md: {
        badge: "px-1 text-small"
      },
      lg: {
        badge: "px-1 text-small"
      }
    },
    placement: {
      "top-right": {},
      "top-left": {},
      "bottom-right": {},
      "bottom-left": {}
    },
    shape: {
      circle: {},
      rectangle: {}
    },
    isInvisible: {
      true: {}
    },
    isOneChar: {
      true: {
        badge: "px-0"
      }
    },
    isDot: {
      true: {}
    },
    disableAnimation: {
      true: {
        badge: "transition-none"
      },
      false: {
        badge: "transition-transform-opacity !ease-soft-spring !duration-300"
      }
    },
    showOutline: {
      true: {
        badge: "border-2 border-background"
      },
      false: {
        badge: "border-transparent border-0"
      }
    }
  },
  defaultVariants: {
    variant: "solid",
    color: "default",
    size: "md",
    shape: "rectangle",
    placement: "top-right",
    showOutline: true,
    isInvisible: false
  },
  compoundVariants: [
    // solid / color
    {
      variant: "solid",
      color: "default",
      class: {
        badge: colorVariants.solid.default
      }
    },
    {
      variant: "solid",
      color: "primary",
      class: {
        badge: colorVariants.solid.primary
      }
    },
    {
      variant: "solid",
      color: "secondary",
      class: {
        badge: colorVariants.solid.secondary
      }
    },
    {
      variant: "solid",
      color: "success",
      class: {
        badge: colorVariants.solid.success
      }
    },
    {
      variant: "solid",
      color: "warning",
      class: {
        badge: colorVariants.solid.warning
      }
    },
    {
      variant: "solid",
      color: "danger",
      class: {
        badge: colorVariants.solid.danger
      }
    },
    // shadow / color
    {
      variant: "shadow",
      color: "default",
      class: {
        badge: colorVariants.shadow.default
      }
    },
    {
      variant: "shadow",
      color: "primary",
      class: {
        badge: colorVariants.shadow.primary
      }
    },
    {
      variant: "shadow",
      color: "secondary",
      class: {
        badge: colorVariants.shadow.secondary
      }
    },
    {
      variant: "shadow",
      color: "success",
      class: {
        badge: colorVariants.shadow.success
      }
    },
    {
      variant: "shadow",
      color: "warning",
      class: {
        badge: colorVariants.shadow.warning
      }
    },
    {
      variant: "shadow",
      color: "danger",
      class: {
        badge: colorVariants.shadow.danger
      }
    },
    // flat / color
    {
      variant: "flat",
      color: "default",
      class: {
        badge: colorVariants.flat.default
      }
    },
    {
      variant: "flat",
      color: "primary",
      class: {
        badge: colorVariants.flat.primary
      }
    },
    {
      variant: "flat",
      color: "secondary",
      class: {
        badge: colorVariants.flat.secondary
      }
    },
    {
      variant: "flat",
      color: "success",
      class: {
        badge: colorVariants.flat.success
      }
    },
    {
      variant: "flat",
      color: "warning",
      class: {
        badge: colorVariants.flat.warning
      }
    },
    {
      variant: "flat",
      color: "danger",
      class: {
        badge: colorVariants.flat.danger
      }
    },
    // faded / color
    {
      variant: "faded",
      color: "default",
      class: {
        badge: colorVariants.faded.default
      }
    },
    {
      variant: "faded",
      color: "primary",
      class: {
        badge: colorVariants.faded.primary
      }
    },
    {
      variant: "faded",
      color: "secondary",
      class: {
        badge: colorVariants.faded.secondary
      }
    },
    {
      variant: "faded",
      color: "success",
      class: {
        badge: colorVariants.faded.success
      }
    },
    {
      variant: "faded",
      color: "warning",
      class: {
        badge: colorVariants.faded.warning
      }
    },
    {
      variant: "faded",
      color: "danger",
      class: {
        badge: colorVariants.faded.danger
      }
    },
    // isOneChar / size
    {
      isOneChar: true,
      size: "sm",
      class: {
        badge: "w-4 h-4 min-w-4 min-h-4"
      }
    },
    {
      isOneChar: true,
      size: "md",
      class: {
        badge: "w-5 h-5 min-w-5 min-h-5"
      }
    },
    {
      isOneChar: true,
      size: "lg",
      class: {
        badge: "w-6 h-6 min-w-6 min-h-6"
      }
    },
    // isDot / size
    {
      isDot: true,
      size: "sm",
      class: {
        badge: "w-3 h-3 min-w-3 min-h-3"
      }
    },
    {
      isDot: true,
      size: "md",
      class: {
        badge: "w-3.5 h-3.5 min-w-3.5 min-h-3.5"
      }
    },
    {
      isDot: true,
      size: "lg",
      class: {
        badge: "w-4 h-4 min-w-4 min-h-4"
      }
    },
    // placement / rectangle
    {
      placement: "top-right",
      shape: "rectangle",
      class: {
        badge: "top-[5%] right-[5%] translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "top-left",
      shape: "rectangle",
      class: {
        badge: "top-[5%] left-[5%] -translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "bottom-right",
      shape: "rectangle",
      class: {
        badge: "bottom-[5%] right-[5%] translate-x-1/2 translate-y-1/2"
      }
    },
    {
      placement: "bottom-left",
      shape: "rectangle",
      class: {
        badge: "bottom-[5%] left-[5%] -translate-x-1/2 translate-y-1/2"
      }
    },
    // placement / circle
    {
      placement: "top-right",
      shape: "circle",
      class: {
        badge: "top-[10%] right-[10%] translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "top-left",
      shape: "circle",
      class: {
        badge: "top-[10%] left-[10%] -translate-x-1/2 -translate-y-1/2"
      }
    },
    {
      placement: "bottom-right",
      shape: "circle",
      class: {
        badge: "bottom-[10%] right-[10%] translate-x-1/2 translate-y-1/2"
      }
    },
    {
      placement: "bottom-left",
      shape: "circle",
      class: {
        badge: "bottom-[10%] left-[10%] -translate-x-1/2 translate-y-1/2"
      }
    }
  ]
});
var breadcrumbItem = tv({
  slots: {
    base: "flex items-center",
    item: [
      "flex gap-1 items-center",
      "cursor-pointer",
      "whitespace-nowrap",
      "outline-hidden",
      "tap-highlight-transparent",
      // focus ring
      ...dataFocusVisibleClasses
    ],
    separator: "text-default-400 px-1 rtl:rotate-180"
  },
  variants: {
    color: {
      foreground: {
        item: "text-foreground/50",
        separator: "text-foreground/50"
      },
      primary: {
        item: "text-primary/80",
        separator: "text-primary/80"
      },
      secondary: {
        item: "text-secondary/80",
        separator: "text-secondary/80"
      },
      success: {
        item: "text-success/80",
        separator: "text-success/80"
      },
      warning: {
        item: "text-warning/80",
        separator: "text-warning/80"
      },
      danger: {
        item: "text-danger/80",
        separator: "text-danger/80"
      }
    },
    size: {
      sm: {
        item: "text-tiny"
      },
      md: {
        item: "text-small"
      },
      lg: {
        item: "text-medium"
      }
    },
    underline: {
      none: {
        item: "no-underline"
      },
      hover: {
        item: "hover:underline"
      },
      always: {
        item: "underline"
      },
      active: {
        item: "active:underline"
      },
      focus: {
        item: "focus:underline"
      }
    },
    isCurrent: {
      true: {
        item: "cursor-default"
      },
      false: {
        item: ["hover:opacity-hover", "active:opacity-disabled"]
      }
    },
    isDisabled: {
      true: {
        item: "opacity-disabled pointer-events-none",
        separator: "opacity-disabled"
      }
    },
    disableAnimation: {
      false: {
        item: "transition-opacity"
      },
      true: {
        item: "transition-none"
      }
    }
  },
  defaultVariants: {
    size: "md",
    color: "foreground",
    underline: "hover",
    isDisabled: false
  },
  compoundVariants: [
    // isCurrent && color
    {
      isCurrent: true,
      color: "foreground",
      class: {
        item: "text-foreground"
      }
    },
    {
      isCurrent: true,
      color: "primary",
      class: {
        item: "text-primary"
      }
    },
    {
      isCurrent: true,
      color: "secondary",
      class: {
        item: "text-secondary"
      }
    },
    {
      isCurrent: true,
      color: "success",
      class: {
        item: "text-success"
      }
    },
    {
      isCurrent: true,
      color: "warning",
      class: {
        item: "text-warning"
      }
    },
    {
      isCurrent: true,
      color: "danger",
      class: {
        item: "text-danger"
      }
    },
    // !isCurrent && underline
    {
      isCurrent: false,
      underline: "none",
      class: {
        item: "no-underline"
      }
    },
    // Underline
    {
      underline: ["hover", "always", "active", "focus"],
      class: "underline-offset-4"
    }
  ]
});
var breadcrumbs = tv({
  slots: {
    base: "",
    list: "flex flex-wrap list-none",
    ellipsis: "text-medium",
    separator: "text-default-400 px-1"
  },
  variants: {
    size: {
      sm: {},
      md: {},
      lg: {}
    },
    radius: {
      none: {
        list: "rounded-none"
      },
      sm: {
        list: "rounded-small"
      },
      md: {
        list: "rounded-medium"
      },
      lg: {
        list: "rounded-large"
      },
      full: {
        list: "rounded-full"
      }
    },
    variant: {
      solid: {
        list: "bg-default-100"
      },
      bordered: {
        list: "border-medium border-default-200 shadow-xs"
      },
      light: {}
    }
  },
  defaultVariants: {
    size: "md",
    radius: "sm",
    variant: "light"
  },
  compoundVariants: [
    // variant
    {
      variant: ["solid", "bordered"],
      class: {
        list: "max-w-fit"
      }
    },
    // variant={solid,bordered} && size
    {
      variant: ["solid", "bordered"],
      size: "sm",
      class: {
        list: "px-2 py-1"
      }
    },
    {
      variant: ["solid", "bordered"],
      size: "md",
      class: {
        list: "px-2.5 py-1.5"
      }
    },
    {
      variant: ["solid", "bordered"],
      size: "lg",
      class: {
        list: "px-3 py-2"
      }
    }
  ]
});
var mergeClasses$2 = (itemClasses, itemPropsClasses) => {
  if (!itemClasses && !itemPropsClasses)
    return {};
  const keys2 = /* @__PURE__ */ new Set([...Object.keys(itemClasses || {}), ...Object.keys(itemPropsClasses || {})]);
  return Array.from(keys2).reduce(
    (acc, key) => ({
      ...acc,
      [key]: clsx$5(itemClasses == null ? void 0 : itemClasses[key], itemPropsClasses == null ? void 0 : itemPropsClasses[key])
    }),
    {}
  );
};
function r$8(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2))
      for (t2 = 0; t2 < e2.length; t2++)
        e2[t2] && (f2 = r$8(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    else
      for (t2 in e2)
        e2[t2] && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function clsx$3() {
  for (var e2, t2, f2 = 0, n2 = ""; f2 < arguments.length; )
    (e2 = arguments[f2++]) && (t2 = r$8(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
var twMerge = extendTailwindMerge({ extend: twMergeConfig });
function cn(...inputs) {
  return twMerge(clsx$3(inputs));
}
var colorName;
var hasRequiredColorName;
function requireColorName() {
  if (hasRequiredColorName)
    return colorName;
  hasRequiredColorName = 1;
  colorName = {
    "aliceblue": [240, 248, 255],
    "antiquewhite": [250, 235, 215],
    "aqua": [0, 255, 255],
    "aquamarine": [127, 255, 212],
    "azure": [240, 255, 255],
    "beige": [245, 245, 220],
    "bisque": [255, 228, 196],
    "black": [0, 0, 0],
    "blanchedalmond": [255, 235, 205],
    "blue": [0, 0, 255],
    "blueviolet": [138, 43, 226],
    "brown": [165, 42, 42],
    "burlywood": [222, 184, 135],
    "cadetblue": [95, 158, 160],
    "chartreuse": [127, 255, 0],
    "chocolate": [210, 105, 30],
    "coral": [255, 127, 80],
    "cornflowerblue": [100, 149, 237],
    "cornsilk": [255, 248, 220],
    "crimson": [220, 20, 60],
    "cyan": [0, 255, 255],
    "darkblue": [0, 0, 139],
    "darkcyan": [0, 139, 139],
    "darkgoldenrod": [184, 134, 11],
    "darkgray": [169, 169, 169],
    "darkgreen": [0, 100, 0],
    "darkgrey": [169, 169, 169],
    "darkkhaki": [189, 183, 107],
    "darkmagenta": [139, 0, 139],
    "darkolivegreen": [85, 107, 47],
    "darkorange": [255, 140, 0],
    "darkorchid": [153, 50, 204],
    "darkred": [139, 0, 0],
    "darksalmon": [233, 150, 122],
    "darkseagreen": [143, 188, 143],
    "darkslateblue": [72, 61, 139],
    "darkslategray": [47, 79, 79],
    "darkslategrey": [47, 79, 79],
    "darkturquoise": [0, 206, 209],
    "darkviolet": [148, 0, 211],
    "deeppink": [255, 20, 147],
    "deepskyblue": [0, 191, 255],
    "dimgray": [105, 105, 105],
    "dimgrey": [105, 105, 105],
    "dodgerblue": [30, 144, 255],
    "firebrick": [178, 34, 34],
    "floralwhite": [255, 250, 240],
    "forestgreen": [34, 139, 34],
    "fuchsia": [255, 0, 255],
    "gainsboro": [220, 220, 220],
    "ghostwhite": [248, 248, 255],
    "gold": [255, 215, 0],
    "goldenrod": [218, 165, 32],
    "gray": [128, 128, 128],
    "green": [0, 128, 0],
    "greenyellow": [173, 255, 47],
    "grey": [128, 128, 128],
    "honeydew": [240, 255, 240],
    "hotpink": [255, 105, 180],
    "indianred": [205, 92, 92],
    "indigo": [75, 0, 130],
    "ivory": [255, 255, 240],
    "khaki": [240, 230, 140],
    "lavender": [230, 230, 250],
    "lavenderblush": [255, 240, 245],
    "lawngreen": [124, 252, 0],
    "lemonchiffon": [255, 250, 205],
    "lightblue": [173, 216, 230],
    "lightcoral": [240, 128, 128],
    "lightcyan": [224, 255, 255],
    "lightgoldenrodyellow": [250, 250, 210],
    "lightgray": [211, 211, 211],
    "lightgreen": [144, 238, 144],
    "lightgrey": [211, 211, 211],
    "lightpink": [255, 182, 193],
    "lightsalmon": [255, 160, 122],
    "lightseagreen": [32, 178, 170],
    "lightskyblue": [135, 206, 250],
    "lightslategray": [119, 136, 153],
    "lightslategrey": [119, 136, 153],
    "lightsteelblue": [176, 196, 222],
    "lightyellow": [255, 255, 224],
    "lime": [0, 255, 0],
    "limegreen": [50, 205, 50],
    "linen": [250, 240, 230],
    "magenta": [255, 0, 255],
    "maroon": [128, 0, 0],
    "mediumaquamarine": [102, 205, 170],
    "mediumblue": [0, 0, 205],
    "mediumorchid": [186, 85, 211],
    "mediumpurple": [147, 112, 219],
    "mediumseagreen": [60, 179, 113],
    "mediumslateblue": [123, 104, 238],
    "mediumspringgreen": [0, 250, 154],
    "mediumturquoise": [72, 209, 204],
    "mediumvioletred": [199, 21, 133],
    "midnightblue": [25, 25, 112],
    "mintcream": [245, 255, 250],
    "mistyrose": [255, 228, 225],
    "moccasin": [255, 228, 181],
    "navajowhite": [255, 222, 173],
    "navy": [0, 0, 128],
    "oldlace": [253, 245, 230],
    "olive": [128, 128, 0],
    "olivedrab": [107, 142, 35],
    "orange": [255, 165, 0],
    "orangered": [255, 69, 0],
    "orchid": [218, 112, 214],
    "palegoldenrod": [238, 232, 170],
    "palegreen": [152, 251, 152],
    "paleturquoise": [175, 238, 238],
    "palevioletred": [219, 112, 147],
    "papayawhip": [255, 239, 213],
    "peachpuff": [255, 218, 185],
    "peru": [205, 133, 63],
    "pink": [255, 192, 203],
    "plum": [221, 160, 221],
    "powderblue": [176, 224, 230],
    "purple": [128, 0, 128],
    "rebeccapurple": [102, 51, 153],
    "red": [255, 0, 0],
    "rosybrown": [188, 143, 143],
    "royalblue": [65, 105, 225],
    "saddlebrown": [139, 69, 19],
    "salmon": [250, 128, 114],
    "sandybrown": [244, 164, 96],
    "seagreen": [46, 139, 87],
    "seashell": [255, 245, 238],
    "sienna": [160, 82, 45],
    "silver": [192, 192, 192],
    "skyblue": [135, 206, 235],
    "slateblue": [106, 90, 205],
    "slategray": [112, 128, 144],
    "slategrey": [112, 128, 144],
    "snow": [255, 250, 250],
    "springgreen": [0, 255, 127],
    "steelblue": [70, 130, 180],
    "tan": [210, 180, 140],
    "teal": [0, 128, 128],
    "thistle": [216, 191, 216],
    "tomato": [255, 99, 71],
    "turquoise": [64, 224, 208],
    "violet": [238, 130, 238],
    "wheat": [245, 222, 179],
    "white": [255, 255, 255],
    "whitesmoke": [245, 245, 245],
    "yellow": [255, 255, 0],
    "yellowgreen": [154, 205, 50]
  };
  return colorName;
}
var conversions;
var hasRequiredConversions;
function requireConversions() {
  if (hasRequiredConversions)
    return conversions;
  hasRequiredConversions = 1;
  const cssKeywords = requireColorName();
  const reverseKeywords = {};
  for (const key of Object.keys(cssKeywords)) {
    reverseKeywords[cssKeywords[key]] = key;
  }
  const convert2 = {
    rgb: { channels: 3, labels: "rgb" },
    hsl: { channels: 3, labels: "hsl" },
    hsv: { channels: 3, labels: "hsv" },
    hwb: { channels: 3, labels: "hwb" },
    cmyk: { channels: 4, labels: "cmyk" },
    xyz: { channels: 3, labels: "xyz" },
    lab: { channels: 3, labels: "lab" },
    lch: { channels: 3, labels: "lch" },
    hex: { channels: 1, labels: ["hex"] },
    keyword: { channels: 1, labels: ["keyword"] },
    ansi16: { channels: 1, labels: ["ansi16"] },
    ansi256: { channels: 1, labels: ["ansi256"] },
    hcg: { channels: 3, labels: ["h", "c", "g"] },
    apple: { channels: 3, labels: ["r16", "g16", "b16"] },
    gray: { channels: 1, labels: ["gray"] }
  };
  conversions = convert2;
  for (const model of Object.keys(convert2)) {
    if (!("channels" in convert2[model])) {
      throw new Error("missing channels property: " + model);
    }
    if (!("labels" in convert2[model])) {
      throw new Error("missing channel labels property: " + model);
    }
    if (convert2[model].labels.length !== convert2[model].channels) {
      throw new Error("channel and label counts mismatch: " + model);
    }
    const { channels, labels } = convert2[model];
    delete convert2[model].channels;
    delete convert2[model].labels;
    Object.defineProperty(convert2[model], "channels", { value: channels });
    Object.defineProperty(convert2[model], "labels", { value: labels });
  }
  convert2.rgb.hsl = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const min2 = Math.min(r2, g2, b2);
    const max2 = Math.max(r2, g2, b2);
    const delta = max2 - min2;
    let h3;
    let s2;
    if (max2 === min2) {
      h3 = 0;
    } else if (r2 === max2) {
      h3 = (g2 - b2) / delta;
    } else if (g2 === max2) {
      h3 = 2 + (b2 - r2) / delta;
    } else if (b2 === max2) {
      h3 = 4 + (r2 - g2) / delta;
    }
    h3 = Math.min(h3 * 60, 360);
    if (h3 < 0) {
      h3 += 360;
    }
    const l2 = (min2 + max2) / 2;
    if (max2 === min2) {
      s2 = 0;
    } else if (l2 <= 0.5) {
      s2 = delta / (max2 + min2);
    } else {
      s2 = delta / (2 - max2 - min2);
    }
    return [h3, s2 * 100, l2 * 100];
  };
  convert2.rgb.hsv = function(rgb) {
    let rdif;
    let gdif;
    let bdif;
    let h3;
    let s2;
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const v2 = Math.max(r2, g2, b2);
    const diff2 = v2 - Math.min(r2, g2, b2);
    const diffc = function(c2) {
      return (v2 - c2) / 6 / diff2 + 1 / 2;
    };
    if (diff2 === 0) {
      h3 = 0;
      s2 = 0;
    } else {
      s2 = diff2 / v2;
      rdif = diffc(r2);
      gdif = diffc(g2);
      bdif = diffc(b2);
      if (r2 === v2) {
        h3 = bdif - gdif;
      } else if (g2 === v2) {
        h3 = 1 / 3 + rdif - bdif;
      } else if (b2 === v2) {
        h3 = 2 / 3 + gdif - rdif;
      }
      if (h3 < 0) {
        h3 += 1;
      } else if (h3 > 1) {
        h3 -= 1;
      }
    }
    return [
      h3 * 360,
      s2 * 100,
      v2 * 100
    ];
  };
  convert2.rgb.hwb = function(rgb) {
    const r2 = rgb[0];
    const g2 = rgb[1];
    let b2 = rgb[2];
    const h3 = convert2.rgb.hsl(rgb)[0];
    const w2 = 1 / 255 * Math.min(r2, Math.min(g2, b2));
    b2 = 1 - 1 / 255 * Math.max(r2, Math.max(g2, b2));
    return [h3, w2 * 100, b2 * 100];
  };
  convert2.rgb.cmyk = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const k2 = Math.min(1 - r2, 1 - g2, 1 - b2);
    const c2 = (1 - r2 - k2) / (1 - k2) || 0;
    const m2 = (1 - g2 - k2) / (1 - k2) || 0;
    const y2 = (1 - b2 - k2) / (1 - k2) || 0;
    return [c2 * 100, m2 * 100, y2 * 100, k2 * 100];
  };
  function comparativeDistance(x2, y2) {
    return (x2[0] - y2[0]) ** 2 + (x2[1] - y2[1]) ** 2 + (x2[2] - y2[2]) ** 2;
  }
  convert2.rgb.keyword = function(rgb) {
    const reversed = reverseKeywords[rgb];
    if (reversed) {
      return reversed;
    }
    let currentClosestDistance = Infinity;
    let currentClosestKeyword;
    for (const keyword of Object.keys(cssKeywords)) {
      const value2 = cssKeywords[keyword];
      const distance2 = comparativeDistance(rgb, value2);
      if (distance2 < currentClosestDistance) {
        currentClosestDistance = distance2;
        currentClosestKeyword = keyword;
      }
    }
    return currentClosestKeyword;
  };
  convert2.keyword.rgb = function(keyword) {
    return cssKeywords[keyword];
  };
  convert2.rgb.xyz = function(rgb) {
    let r2 = rgb[0] / 255;
    let g2 = rgb[1] / 255;
    let b2 = rgb[2] / 255;
    r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055) ** 2.4 : r2 / 12.92;
    g2 = g2 > 0.04045 ? ((g2 + 0.055) / 1.055) ** 2.4 : g2 / 12.92;
    b2 = b2 > 0.04045 ? ((b2 + 0.055) / 1.055) ** 2.4 : b2 / 12.92;
    const x2 = r2 * 0.4124 + g2 * 0.3576 + b2 * 0.1805;
    const y2 = r2 * 0.2126 + g2 * 0.7152 + b2 * 0.0722;
    const z2 = r2 * 0.0193 + g2 * 0.1192 + b2 * 0.9505;
    return [x2 * 100, y2 * 100, z2 * 100];
  };
  convert2.rgb.lab = function(rgb) {
    const xyz = convert2.rgb.xyz(rgb);
    let x2 = xyz[0];
    let y2 = xyz[1];
    let z2 = xyz[2];
    x2 /= 95.047;
    y2 /= 100;
    z2 /= 108.883;
    x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116;
    y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116;
    z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
    const l2 = 116 * y2 - 16;
    const a2 = 500 * (x2 - y2);
    const b2 = 200 * (y2 - z2);
    return [l2, a2, b2];
  };
  convert2.hsl.rgb = function(hsl) {
    const h3 = hsl[0] / 360;
    const s2 = hsl[1] / 100;
    const l2 = hsl[2] / 100;
    let t2;
    let t3;
    let val;
    if (s2 === 0) {
      val = l2 * 255;
      return [val, val, val];
    }
    if (l2 < 0.5) {
      t2 = l2 * (1 + s2);
    } else {
      t2 = l2 + s2 - l2 * s2;
    }
    const t1 = 2 * l2 - t2;
    const rgb = [0, 0, 0];
    for (let i2 = 0; i2 < 3; i2++) {
      t3 = h3 + 1 / 3 * -(i2 - 1);
      if (t3 < 0) {
        t3++;
      }
      if (t3 > 1) {
        t3--;
      }
      if (6 * t3 < 1) {
        val = t1 + (t2 - t1) * 6 * t3;
      } else if (2 * t3 < 1) {
        val = t2;
      } else if (3 * t3 < 2) {
        val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
      } else {
        val = t1;
      }
      rgb[i2] = val * 255;
    }
    return rgb;
  };
  convert2.hsl.hsv = function(hsl) {
    const h3 = hsl[0];
    let s2 = hsl[1] / 100;
    let l2 = hsl[2] / 100;
    let smin = s2;
    const lmin = Math.max(l2, 0.01);
    l2 *= 2;
    s2 *= l2 <= 1 ? l2 : 2 - l2;
    smin *= lmin <= 1 ? lmin : 2 - lmin;
    const v2 = (l2 + s2) / 2;
    const sv = l2 === 0 ? 2 * smin / (lmin + smin) : 2 * s2 / (l2 + s2);
    return [h3, sv * 100, v2 * 100];
  };
  convert2.hsv.rgb = function(hsv) {
    const h3 = hsv[0] / 60;
    const s2 = hsv[1] / 100;
    let v2 = hsv[2] / 100;
    const hi2 = Math.floor(h3) % 6;
    const f2 = h3 - Math.floor(h3);
    const p2 = 255 * v2 * (1 - s2);
    const q2 = 255 * v2 * (1 - s2 * f2);
    const t2 = 255 * v2 * (1 - s2 * (1 - f2));
    v2 *= 255;
    switch (hi2) {
      case 0:
        return [v2, t2, p2];
      case 1:
        return [q2, v2, p2];
      case 2:
        return [p2, v2, t2];
      case 3:
        return [p2, q2, v2];
      case 4:
        return [t2, p2, v2];
      case 5:
        return [v2, p2, q2];
    }
  };
  convert2.hsv.hsl = function(hsv) {
    const h3 = hsv[0];
    const s2 = hsv[1] / 100;
    const v2 = hsv[2] / 100;
    const vmin = Math.max(v2, 0.01);
    let sl2;
    let l2;
    l2 = (2 - s2) * v2;
    const lmin = (2 - s2) * vmin;
    sl2 = s2 * vmin;
    sl2 /= lmin <= 1 ? lmin : 2 - lmin;
    sl2 = sl2 || 0;
    l2 /= 2;
    return [h3, sl2 * 100, l2 * 100];
  };
  convert2.hwb.rgb = function(hwb) {
    const h3 = hwb[0] / 360;
    let wh2 = hwb[1] / 100;
    let bl2 = hwb[2] / 100;
    const ratio = wh2 + bl2;
    let f2;
    if (ratio > 1) {
      wh2 /= ratio;
      bl2 /= ratio;
    }
    const i2 = Math.floor(6 * h3);
    const v2 = 1 - bl2;
    f2 = 6 * h3 - i2;
    if ((i2 & 1) !== 0) {
      f2 = 1 - f2;
    }
    const n2 = wh2 + f2 * (v2 - wh2);
    let r2;
    let g2;
    let b2;
    switch (i2) {
      default:
      case 6:
      case 0:
        r2 = v2;
        g2 = n2;
        b2 = wh2;
        break;
      case 1:
        r2 = n2;
        g2 = v2;
        b2 = wh2;
        break;
      case 2:
        r2 = wh2;
        g2 = v2;
        b2 = n2;
        break;
      case 3:
        r2 = wh2;
        g2 = n2;
        b2 = v2;
        break;
      case 4:
        r2 = n2;
        g2 = wh2;
        b2 = v2;
        break;
      case 5:
        r2 = v2;
        g2 = wh2;
        b2 = n2;
        break;
    }
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.cmyk.rgb = function(cmyk) {
    const c2 = cmyk[0] / 100;
    const m2 = cmyk[1] / 100;
    const y2 = cmyk[2] / 100;
    const k2 = cmyk[3] / 100;
    const r2 = 1 - Math.min(1, c2 * (1 - k2) + k2);
    const g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
    const b2 = 1 - Math.min(1, y2 * (1 - k2) + k2);
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.xyz.rgb = function(xyz) {
    const x2 = xyz[0] / 100;
    const y2 = xyz[1] / 100;
    const z2 = xyz[2] / 100;
    let r2;
    let g2;
    let b2;
    r2 = x2 * 3.2406 + y2 * -1.5372 + z2 * -0.4986;
    g2 = x2 * -0.9689 + y2 * 1.8758 + z2 * 0.0415;
    b2 = x2 * 0.0557 + y2 * -0.204 + z2 * 1.057;
    r2 = r2 > 31308e-7 ? 1.055 * r2 ** (1 / 2.4) - 0.055 : r2 * 12.92;
    g2 = g2 > 31308e-7 ? 1.055 * g2 ** (1 / 2.4) - 0.055 : g2 * 12.92;
    b2 = b2 > 31308e-7 ? 1.055 * b2 ** (1 / 2.4) - 0.055 : b2 * 12.92;
    r2 = Math.min(Math.max(0, r2), 1);
    g2 = Math.min(Math.max(0, g2), 1);
    b2 = Math.min(Math.max(0, b2), 1);
    return [r2 * 255, g2 * 255, b2 * 255];
  };
  convert2.xyz.lab = function(xyz) {
    let x2 = xyz[0];
    let y2 = xyz[1];
    let z2 = xyz[2];
    x2 /= 95.047;
    y2 /= 100;
    z2 /= 108.883;
    x2 = x2 > 8856e-6 ? x2 ** (1 / 3) : 7.787 * x2 + 16 / 116;
    y2 = y2 > 8856e-6 ? y2 ** (1 / 3) : 7.787 * y2 + 16 / 116;
    z2 = z2 > 8856e-6 ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
    const l2 = 116 * y2 - 16;
    const a2 = 500 * (x2 - y2);
    const b2 = 200 * (y2 - z2);
    return [l2, a2, b2];
  };
  convert2.lab.xyz = function(lab) {
    const l2 = lab[0];
    const a2 = lab[1];
    const b2 = lab[2];
    let x2;
    let y2;
    let z2;
    y2 = (l2 + 16) / 116;
    x2 = a2 / 500 + y2;
    z2 = y2 - b2 / 200;
    const y22 = y2 ** 3;
    const x22 = x2 ** 3;
    const z22 = z2 ** 3;
    y2 = y22 > 8856e-6 ? y22 : (y2 - 16 / 116) / 7.787;
    x2 = x22 > 8856e-6 ? x22 : (x2 - 16 / 116) / 7.787;
    z2 = z22 > 8856e-6 ? z22 : (z2 - 16 / 116) / 7.787;
    x2 *= 95.047;
    y2 *= 100;
    z2 *= 108.883;
    return [x2, y2, z2];
  };
  convert2.lab.lch = function(lab) {
    const l2 = lab[0];
    const a2 = lab[1];
    const b2 = lab[2];
    let h3;
    const hr = Math.atan2(b2, a2);
    h3 = hr * 360 / 2 / Math.PI;
    if (h3 < 0) {
      h3 += 360;
    }
    const c2 = Math.sqrt(a2 * a2 + b2 * b2);
    return [l2, c2, h3];
  };
  convert2.lch.lab = function(lch) {
    const l2 = lch[0];
    const c2 = lch[1];
    const h3 = lch[2];
    const hr = h3 / 360 * 2 * Math.PI;
    const a2 = c2 * Math.cos(hr);
    const b2 = c2 * Math.sin(hr);
    return [l2, a2, b2];
  };
  convert2.rgb.ansi16 = function(args, saturation = null) {
    const [r2, g2, b2] = args;
    let value2 = saturation === null ? convert2.rgb.hsv(args)[2] : saturation;
    value2 = Math.round(value2 / 50);
    if (value2 === 0) {
      return 30;
    }
    let ansi = 30 + (Math.round(b2 / 255) << 2 | Math.round(g2 / 255) << 1 | Math.round(r2 / 255));
    if (value2 === 2) {
      ansi += 60;
    }
    return ansi;
  };
  convert2.hsv.ansi16 = function(args) {
    return convert2.rgb.ansi16(convert2.hsv.rgb(args), args[2]);
  };
  convert2.rgb.ansi256 = function(args) {
    const r2 = args[0];
    const g2 = args[1];
    const b2 = args[2];
    if (r2 === g2 && g2 === b2) {
      if (r2 < 8) {
        return 16;
      }
      if (r2 > 248) {
        return 231;
      }
      return Math.round((r2 - 8) / 247 * 24) + 232;
    }
    const ansi = 16 + 36 * Math.round(r2 / 255 * 5) + 6 * Math.round(g2 / 255 * 5) + Math.round(b2 / 255 * 5);
    return ansi;
  };
  convert2.ansi16.rgb = function(args) {
    let color2 = args % 10;
    if (color2 === 0 || color2 === 7) {
      if (args > 50) {
        color2 += 3.5;
      }
      color2 = color2 / 10.5 * 255;
      return [color2, color2, color2];
    }
    const mult = (~~(args > 50) + 1) * 0.5;
    const r2 = (color2 & 1) * mult * 255;
    const g2 = (color2 >> 1 & 1) * mult * 255;
    const b2 = (color2 >> 2 & 1) * mult * 255;
    return [r2, g2, b2];
  };
  convert2.ansi256.rgb = function(args) {
    if (args >= 232) {
      const c2 = (args - 232) * 10 + 8;
      return [c2, c2, c2];
    }
    args -= 16;
    let rem;
    const r2 = Math.floor(args / 36) / 5 * 255;
    const g2 = Math.floor((rem = args % 36) / 6) / 5 * 255;
    const b2 = rem % 6 / 5 * 255;
    return [r2, g2, b2];
  };
  convert2.rgb.hex = function(args) {
    const integer4 = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
    const string3 = integer4.toString(16).toUpperCase();
    return "000000".substring(string3.length) + string3;
  };
  convert2.hex.rgb = function(args) {
    const match5 = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
    if (!match5) {
      return [0, 0, 0];
    }
    let colorString = match5[0];
    if (match5[0].length === 3) {
      colorString = colorString.split("").map((char2) => {
        return char2 + char2;
      }).join("");
    }
    const integer4 = parseInt(colorString, 16);
    const r2 = integer4 >> 16 & 255;
    const g2 = integer4 >> 8 & 255;
    const b2 = integer4 & 255;
    return [r2, g2, b2];
  };
  convert2.rgb.hcg = function(rgb) {
    const r2 = rgb[0] / 255;
    const g2 = rgb[1] / 255;
    const b2 = rgb[2] / 255;
    const max2 = Math.max(Math.max(r2, g2), b2);
    const min2 = Math.min(Math.min(r2, g2), b2);
    const chroma = max2 - min2;
    let grayscale;
    let hue2;
    if (chroma < 1) {
      grayscale = min2 / (1 - chroma);
    } else {
      grayscale = 0;
    }
    if (chroma <= 0) {
      hue2 = 0;
    } else if (max2 === r2) {
      hue2 = (g2 - b2) / chroma % 6;
    } else if (max2 === g2) {
      hue2 = 2 + (b2 - r2) / chroma;
    } else {
      hue2 = 4 + (r2 - g2) / chroma;
    }
    hue2 /= 6;
    hue2 %= 1;
    return [hue2 * 360, chroma * 100, grayscale * 100];
  };
  convert2.hsl.hcg = function(hsl) {
    const s2 = hsl[1] / 100;
    const l2 = hsl[2] / 100;
    const c2 = l2 < 0.5 ? 2 * s2 * l2 : 2 * s2 * (1 - l2);
    let f2 = 0;
    if (c2 < 1) {
      f2 = (l2 - 0.5 * c2) / (1 - c2);
    }
    return [hsl[0], c2 * 100, f2 * 100];
  };
  convert2.hsv.hcg = function(hsv) {
    const s2 = hsv[1] / 100;
    const v2 = hsv[2] / 100;
    const c2 = s2 * v2;
    let f2 = 0;
    if (c2 < 1) {
      f2 = (v2 - c2) / (1 - c2);
    }
    return [hsv[0], c2 * 100, f2 * 100];
  };
  convert2.hcg.rgb = function(hcg) {
    const h3 = hcg[0] / 360;
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    if (c2 === 0) {
      return [g2 * 255, g2 * 255, g2 * 255];
    }
    const pure = [0, 0, 0];
    const hi2 = h3 % 1 * 6;
    const v2 = hi2 % 1;
    const w2 = 1 - v2;
    let mg2 = 0;
    switch (Math.floor(hi2)) {
      case 0:
        pure[0] = 1;
        pure[1] = v2;
        pure[2] = 0;
        break;
      case 1:
        pure[0] = w2;
        pure[1] = 1;
        pure[2] = 0;
        break;
      case 2:
        pure[0] = 0;
        pure[1] = 1;
        pure[2] = v2;
        break;
      case 3:
        pure[0] = 0;
        pure[1] = w2;
        pure[2] = 1;
        break;
      case 4:
        pure[0] = v2;
        pure[1] = 0;
        pure[2] = 1;
        break;
      default:
        pure[0] = 1;
        pure[1] = 0;
        pure[2] = w2;
    }
    mg2 = (1 - c2) * g2;
    return [
      (c2 * pure[0] + mg2) * 255,
      (c2 * pure[1] + mg2) * 255,
      (c2 * pure[2] + mg2) * 255
    ];
  };
  convert2.hcg.hsv = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const v2 = c2 + g2 * (1 - c2);
    let f2 = 0;
    if (v2 > 0) {
      f2 = c2 / v2;
    }
    return [hcg[0], f2 * 100, v2 * 100];
  };
  convert2.hcg.hsl = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const l2 = g2 * (1 - c2) + 0.5 * c2;
    let s2 = 0;
    if (l2 > 0 && l2 < 0.5) {
      s2 = c2 / (2 * l2);
    } else if (l2 >= 0.5 && l2 < 1) {
      s2 = c2 / (2 * (1 - l2));
    }
    return [hcg[0], s2 * 100, l2 * 100];
  };
  convert2.hcg.hwb = function(hcg) {
    const c2 = hcg[1] / 100;
    const g2 = hcg[2] / 100;
    const v2 = c2 + g2 * (1 - c2);
    return [hcg[0], (v2 - c2) * 100, (1 - v2) * 100];
  };
  convert2.hwb.hcg = function(hwb) {
    const w2 = hwb[1] / 100;
    const b2 = hwb[2] / 100;
    const v2 = 1 - b2;
    const c2 = v2 - w2;
    let g2 = 0;
    if (c2 < 1) {
      g2 = (v2 - c2) / (1 - c2);
    }
    return [hwb[0], c2 * 100, g2 * 100];
  };
  convert2.apple.rgb = function(apple) {
    return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  };
  convert2.rgb.apple = function(rgb) {
    return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  };
  convert2.gray.rgb = function(args) {
    return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  };
  convert2.gray.hsl = function(args) {
    return [0, 0, args[0]];
  };
  convert2.gray.hsv = convert2.gray.hsl;
  convert2.gray.hwb = function(gray) {
    return [0, 100, gray[0]];
  };
  convert2.gray.cmyk = function(gray) {
    return [0, 0, 0, gray[0]];
  };
  convert2.gray.lab = function(gray) {
    return [gray[0], 0, 0];
  };
  convert2.gray.hex = function(gray) {
    const val = Math.round(gray[0] / 100 * 255) & 255;
    const integer4 = (val << 16) + (val << 8) + val;
    const string3 = integer4.toString(16).toUpperCase();
    return "000000".substring(string3.length) + string3;
  };
  convert2.rgb.gray = function(rgb) {
    const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
    return [val / 255 * 100];
  };
  return conversions;
}
var route;
var hasRequiredRoute;
function requireRoute() {
  if (hasRequiredRoute)
    return route;
  hasRequiredRoute = 1;
  const conversions2 = requireConversions();
  function buildGraph() {
    const graph = {};
    const models = Object.keys(conversions2);
    for (let len = models.length, i2 = 0; i2 < len; i2++) {
      graph[models[i2]] = {
        // http://jsperf.com/1-vs-infinity
        // micro-opt, but this is simple.
        distance: -1,
        parent: null
      };
    }
    return graph;
  }
  function deriveBFS(fromModel) {
    const graph = buildGraph();
    const queue = [fromModel];
    graph[fromModel].distance = 0;
    while (queue.length) {
      const current = queue.pop();
      const adjacents = Object.keys(conversions2[current]);
      for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
        const adjacent = adjacents[i2];
        const node2 = graph[adjacent];
        if (node2.distance === -1) {
          node2.distance = graph[current].distance + 1;
          node2.parent = current;
          queue.unshift(adjacent);
        }
      }
    }
    return graph;
  }
  function link2(from2, to2) {
    return function(args) {
      return to2(from2(args));
    };
  }
  function wrapConversion(toModel, graph) {
    const path = [graph[toModel].parent, toModel];
    let fn = conversions2[graph[toModel].parent][toModel];
    let cur = graph[toModel].parent;
    while (graph[cur].parent) {
      path.unshift(graph[cur].parent);
      fn = link2(conversions2[graph[cur].parent][cur], fn);
      cur = graph[cur].parent;
    }
    fn.conversion = path;
    return fn;
  }
  route = function(fromModel) {
    const graph = deriveBFS(fromModel);
    const conversion = {};
    const models = Object.keys(graph);
    for (let len = models.length, i2 = 0; i2 < len; i2++) {
      const toModel = models[i2];
      const node2 = graph[toModel];
      if (node2.parent === null) {
        continue;
      }
      conversion[toModel] = wrapConversion(toModel, graph);
    }
    return conversion;
  };
  return route;
}
var colorConvert;
var hasRequiredColorConvert;
function requireColorConvert() {
  if (hasRequiredColorConvert)
    return colorConvert;
  hasRequiredColorConvert = 1;
  const conversions2 = requireConversions();
  const route2 = requireRoute();
  const convert2 = {};
  const models = Object.keys(conversions2);
  function wrapRaw(fn) {
    const wrappedFn = function(...args) {
      const arg0 = args[0];
      if (arg0 === void 0 || arg0 === null) {
        return arg0;
      }
      if (arg0.length > 1) {
        args = arg0;
      }
      return fn(args);
    };
    if ("conversion" in fn) {
      wrappedFn.conversion = fn.conversion;
    }
    return wrappedFn;
  }
  function wrapRounded(fn) {
    const wrappedFn = function(...args) {
      const arg0 = args[0];
      if (arg0 === void 0 || arg0 === null) {
        return arg0;
      }
      if (arg0.length > 1) {
        args = arg0;
      }
      const result = fn(args);
      if (typeof result === "object") {
        for (let len = result.length, i2 = 0; i2 < len; i2++) {
          result[i2] = Math.round(result[i2]);
        }
      }
      return result;
    };
    if ("conversion" in fn) {
      wrappedFn.conversion = fn.conversion;
    }
    return wrappedFn;
  }
  models.forEach((fromModel) => {
    convert2[fromModel] = {};
    Object.defineProperty(convert2[fromModel], "channels", { value: conversions2[fromModel].channels });
    Object.defineProperty(convert2[fromModel], "labels", { value: conversions2[fromModel].labels });
    const routes = route2(fromModel);
    const routeModels = Object.keys(routes);
    routeModels.forEach((toModel) => {
      const fn = routes[toModel];
      convert2[fromModel][toModel] = wrapRounded(fn);
      convert2[fromModel][toModel].raw = wrapRaw(fn);
    });
  });
  colorConvert = convert2;
  return colorConvert;
}
const scriptRel = "modulepreload";
const assetsURL = function(dep) {
  return "/" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
  let promise = Promise.resolve();
  if (deps && deps.length > 0) {
    document.getElementsByTagName("link");
    const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
    const cspNonce = (cspNonceMeta == null ? void 0 : cspNonceMeta.nonce) || (cspNonceMeta == null ? void 0 : cspNonceMeta.getAttribute("nonce"));
    promise = Promise.all(deps.map((dep) => {
      dep = assetsURL(dep);
      if (dep in seen)
        return;
      seen[dep] = true;
      const isCss = dep.endsWith(".css");
      const cssSelector = isCss ? '[rel="stylesheet"]' : "";
      if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) {
        return;
      }
      const link2 = document.createElement("link");
      link2.rel = isCss ? "stylesheet" : scriptRel;
      if (!isCss) {
        link2.as = "script";
        link2.crossOrigin = "";
      }
      link2.href = dep;
      if (cspNonce) {
        link2.setAttribute("nonce", cspNonce);
      }
      document.head.appendChild(link2);
      if (isCss) {
        return new Promise((res, rej) => {
          link2.addEventListener("load", res);
          link2.addEventListener("error", () => rej(new Error(`Unable to preload CSS for ${dep}`)));
        });
      }
    }));
  }
  return promise.then(() => baseModule()).catch((err) => {
    const e2 = new Event("vite:preloadError", { cancelable: true });
    e2.payload = err;
    window.dispatchEvent(e2);
    if (!e2.defaultPrevented) {
      throw err;
    }
  });
};
function $645f2e67b85a24c9$var$isStyleVisible(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $645f2e67b85a24c9$var$isAttributeVisible(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $645f2e67b85a24c9$export$e989c0fffaa6b27a(element2, childElement) {
  return element2.nodeName !== "#comment" && $645f2e67b85a24c9$var$isStyleVisible(element2) && $645f2e67b85a24c9$var$isAttributeVisible(element2, childElement) && (!element2.parentElement || $645f2e67b85a24c9$export$e989c0fffaa6b27a(element2.parentElement, element2));
}
const $9bf71ea28793e738$var$FocusContext = /* @__PURE__ */ React$6.createContext(null);
const $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = "react-aria-focus-scope-restore";
let $9bf71ea28793e738$var$activeScope = null;
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
  let { children, contain, restoreFocus, autoFocus } = props;
  let startRef = reactExports.useRef(null);
  let endRef = reactExports.useRef(null);
  let scopeRef = reactExports.useRef([]);
  let { parentNode } = reactExports.useContext($9bf71ea28793e738$var$FocusContext) || {};
  let node2 = reactExports.useMemo(() => new $9bf71ea28793e738$var$TreeNode$6({
    scopeRef
  }), [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
    if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
      let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
      if (activeNode)
        parent = activeNode;
    }
    parent.addChild(node2);
    $9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node2);
  }, [
    node2,
    parentNode
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let node3 = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
    if (node3)
      node3.contain = !!contain;
  }, [
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    var _startRef_current;
    let node3 = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
    let nodes = [];
    let stopPropagation2 = (e2) => e2.stopPropagation();
    while (node3 && node3 !== endRef.current) {
      nodes.push(node3);
      node3.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation2);
      node3 = node3.nextSibling;
    }
    scopeRef.current = nodes;
    return () => {
      for (let node4 of nodes)
        node4.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation2);
    };
  }, [
    children
  ]);
  $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
  $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
  $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
  reactExports.useEffect(() => {
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0));
    let scope = null;
    if ($9bf71ea28793e738$var$isElementInScope$6(activeElement, scopeRef.current)) {
      for (let node3 of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse())
        if (node3.scopeRef && $9bf71ea28793e738$var$isElementInScope$6(activeElement, node3.scopeRef.current))
          scope = node3;
      if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef))
        $9bf71ea28793e738$var$activeScope = scope.scopeRef;
    }
  }, [
    scopeRef
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
      var _focusScopeTree_getTreeNode_parent_scopeRef;
      let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
      if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope)))
        $9bf71ea28793e738$var$activeScope = parentScope;
      $9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
    };
  }, [
    scopeRef
  ]);
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
  let value2 = reactExports.useMemo(() => ({
    focusManager,
    parentNode: node2
  }), [
    node2,
    focusManager
  ]);
  return /* @__PURE__ */ React$6.createElement($9bf71ea28793e738$var$FocusContext.Provider, {
    value: value2
  }, /* @__PURE__ */ React$6.createElement("span", {
    "data-focus-scope-start": true,
    hidden: true,
    ref: startRef
  }), children, /* @__PURE__ */ React$6.createElement("span", {
    "data-focus-scope-end": true,
    hidden: true,
    ref: endRef
  }));
}
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
  return {
    focusNext(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[0].previousElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$6(node2, scope) ? node2 : sentinel;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = sentinel;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$1(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = {}) {
      let scope = scopeRef.current;
      let { from: from2, tabbable, wrap: wrap2, accept } = opts2;
      var _scope_;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
      let sentinel = scope[scope.length - 1].nextElementSibling;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = $9bf71ea28793e738$var$isElementInScope$6(node2, scope) ? node2 : sentinel;
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = sentinel;
        previousNode = walker.previousNode();
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$1(previousNode, true);
      return previousNode;
    },
    focusFirst(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[0].previousElementSibling;
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement$1(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = {}) {
      let scope = scopeRef.current;
      let { tabbable, accept } = opts2;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable,
        accept
      }, scope);
      walker.currentNode = scope[scope.length - 1].nextElementSibling;
      let previousNode = walker.previousNode();
      if (previousNode)
        $9bf71ea28793e738$var$focusElement$1(previousNode, true);
      return previousNode;
    }
  };
}
function $9bf71ea28793e738$var$getScopeRoot(scope) {
  return scope[0].parentElement;
}
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.contain)
      return false;
    scope = scope.parent;
  }
  return true;
}
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
  let focusedNode = reactExports.useRef(void 0);
  let raf3 = reactExports.useRef(void 0);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    if (!contain) {
      if (raf3.current) {
        cancelAnimationFrame(raf3.current);
        raf3.current = void 0;
      }
      return;
    }
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e2.isComposing)
        return;
      let focusedElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      let scope2 = scopeRef.current;
      if (!scope2 || !$9bf71ea28793e738$var$isElementInScope$6(focusedElement, scope2))
        return;
      let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope2);
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
        tabbable: true
      }, scope2);
      if (!focusedElement)
        return;
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nextElement) {
        walker.currentNode = e2.shiftKey ? scope2[scope2.length - 1].nextElementSibling : scope2[0].previousElementSibling;
        nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      }
      e2.preventDefault();
      if (nextElement)
        $9bf71ea28793e738$var$focusElement$1(nextElement, true);
    };
    let onFocus = (e2) => {
      if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef.current)) {
        $9bf71ea28793e738$var$activeScope = scopeRef;
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      } else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), scopeRef)) {
        if (focusedNode.current)
          focusedNode.current.focus();
        else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current)
          $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
      } else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef))
        focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
    };
    let onBlur = (e2) => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
      raf3.current = requestAnimationFrame(() => {
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        let shouldSkipFocusRestore = (modality === "virtual" || modality === null) && $c87311424ea30a05$export$a11b0059900ceec8$4() && $c87311424ea30a05$export$6446a186d09e379e$5();
        let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
        if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef)) {
          $9bf71ea28793e738$var$activeScope = scopeRef;
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
          if (target && target.isConnected) {
            var _focusedNode_current;
            focusedNode.current = target;
            (_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 ? void 0 : _focusedNode_current.focus();
          } else if ($9bf71ea28793e738$var$activeScope.current)
            $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
        }
      });
    };
    ownerDocument.addEventListener("keydown", onKeyDown, false);
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusout", onBlur, false));
    return () => {
      ownerDocument.removeEventListener("keydown", onKeyDown, false);
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusout", onBlur, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, [
    raf3
  ]);
}
function $9bf71ea28793e738$var$isElementInAnyScope(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope(element2);
}
function $9bf71ea28793e738$var$isElementInScope$6(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$isElementInChildScope(element2, scope = null) {
  if (element2 instanceof Element && element2.closest("[data-react-aria-top-layer]"))
    return true;
  for (let { scopeRef: s2 } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))) {
    if (s2 && $9bf71ea28793e738$var$isElementInScope$6(element2, s2.current))
      return true;
  }
  return false;
}
function $9bf71ea28793e738$export$1258395f99bf9cbf(element2) {
  return $9bf71ea28793e738$var$isElementInChildScope(element2, $9bf71ea28793e738$var$activeScope);
}
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
  var _focusScopeTree_getTreeNode;
  let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
  while (parent) {
    if (parent.scopeRef === ancestor)
      return true;
    parent = parent.parent;
  }
  return false;
}
function $9bf71ea28793e738$var$focusElement$1(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
  let sentinel = scope[0].previousElementSibling;
  let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
    tabbable
  }, scope);
  walker.currentNode = sentinel;
  let nextNode = walker.nextNode();
  if (tabbable && !nextNode) {
    scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
    walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(scopeRoot, {
      tabbable: false
    }, scope);
    walker.currentNode = sentinel;
    nextNode = walker.nextNode();
  }
  return nextNode;
}
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
  $9bf71ea28793e738$var$focusElement$1($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
}
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
  const autoFocusRef = React$6.useRef(autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      $9bf71ea28793e738$var$activeScope = scopeRef;
      const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
      if (!$9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), $9bf71ea28793e738$var$activeScope.current) && scopeRef.current)
        $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
    }
    autoFocusRef.current = false;
  }, [
    scopeRef
  ]);
}
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (restore || contain)
      return;
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    let onFocus = (e2) => {
      let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
      if ($9bf71ea28793e738$var$isElementInScope$6(target, scopeRef.current))
        $9bf71ea28793e738$var$activeScope = scopeRef;
      else if (!$9bf71ea28793e738$var$isElementInAnyScope(target))
        $9bf71ea28793e738$var$activeScope = null;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    restore,
    contain
  ]);
}
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
  let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
  while (scope && scope.scopeRef !== scopeRef) {
    if (scope.nodeToRestore)
      return false;
    scope = scope.parent;
  }
  return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
}
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
  const nodeToRestoreRef = reactExports.useRef(typeof document !== "undefined" ? $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0)) : null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let scope = scopeRef.current;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scope ? scope[0] : void 0);
    if (!restoreFocus || contain)
      return;
    let onFocus = () => {
      if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope$6($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), scopeRef.current))
        $9bf71ea28793e738$var$activeScope = scopeRef;
    };
    ownerDocument.addEventListener("focusin", onFocus, false);
    scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.addEventListener("focusin", onFocus, false));
    return () => {
      ownerDocument.removeEventListener("focusin", onFocus, false);
      scope === null || scope === void 0 ? void 0 : scope.forEach((element2) => element2.removeEventListener("focusin", onFocus, false));
    };
  }, [
    scopeRef,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let onKeyDown = (e2) => {
      if (e2.key !== "Tab" || e2.altKey || e2.ctrlKey || e2.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e2.isComposing)
        return;
      let focusedElement = ownerDocument.activeElement;
      if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))
        return;
      let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
      if (!treeNode)
        return;
      let nodeToRestore = treeNode.nodeToRestore;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(ownerDocument.body, {
        tabbable: true
      });
      walker.currentNode = focusedElement;
      let nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
      if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
        nodeToRestore = void 0;
        treeNode.nodeToRestore = void 0;
      }
      if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
        walker.currentNode = nodeToRestore;
        do
          nextElement = e2.shiftKey ? walker.previousNode() : walker.nextNode();
        while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
        e2.preventDefault();
        e2.stopPropagation();
        if (nextElement)
          $9bf71ea28793e738$var$focusElement$1(nextElement, true);
        else if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore))
          focusedElement.blur();
        else
          $9bf71ea28793e738$var$focusElement$1(nodeToRestore, true);
      }
    };
    if (!contain)
      ownerDocument.addEventListener("keydown", onKeyDown, true);
    return () => {
      if (!contain)
        ownerDocument.removeEventListener("keydown", onKeyDown, true);
    };
  }, [
    scopeRef,
    restoreFocus,
    contain
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(scopeRef.current ? scopeRef.current[0] : void 0);
    if (!restoreFocus)
      return;
    let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
    if (!treeNode)
      return;
    var _nodeToRestoreRef_current;
    treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : void 0;
    return () => {
      let treeNode2 = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
      if (!treeNode2)
        return;
      let nodeToRestore = treeNode2.nodeToRestore;
      let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
      if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
        let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
        requestAnimationFrame(() => {
          if (ownerDocument.activeElement === ownerDocument.body) {
            let treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.nodeToRestore && treeNode3.nodeToRestore.isConnected) {
                $9bf71ea28793e738$var$restoreFocusToElement(treeNode3.nodeToRestore);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
            treeNode3 = clonedTree.getTreeNode(scopeRef);
            while (treeNode3) {
              if (treeNode3.scopeRef && treeNode3.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode3.scopeRef)) {
                let node2 = $9bf71ea28793e738$var$getFirstInScope(treeNode3.scopeRef.current, true);
                $9bf71ea28793e738$var$restoreFocusToElement(node2);
                return;
              }
              treeNode3 = treeNode3.parent;
            }
          }
        });
      }
    };
  }, [
    scopeRef,
    restoreFocus
  ]);
}
function $9bf71ea28793e738$var$restoreFocusToElement(node2) {
  if (node2.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
    bubbles: true,
    cancelable: true
  })))
    $9bf71ea28793e738$var$focusElement$1(node2);
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$6(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if (filter3(node2) && $645f2e67b85a24c9$export$e989c0fffaa6b27a(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$6(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$6 = class $9bf71ea28793e738$var$Tree2 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$6({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$6(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree2();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$6({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$6 = class $9bf71ea28793e738$var$TreeNode2 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
let $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree$6();
function $f7dceffc5ad7768b$export$4e328f61c538687f$1(props = {}) {
  let { autoFocus = false, isTextInput, within } = props;
  let state = reactExports.useRef({
    isFocused: false,
    isFocusVisible: autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27$2()
  });
  let [isFocused, setFocused] = reactExports.useState(false);
  let [isFocusVisibleState, setFocusVisible] = reactExports.useState(() => state.current.isFocused && state.current.isFocusVisible);
  let updateState3 = reactExports.useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
  let onFocusChange = reactExports.useCallback((isFocused2) => {
    state.current.isFocused = isFocused2;
    setFocused(isFocused2);
    updateState3();
  }, [
    updateState3
  ]);
  $507fabe10e71c6fb$export$ec71b4b83ac08ec3$1((isFocusVisible) => {
    state.current.isFocusVisible = isFocusVisible;
    updateState3();
  }, [], {
    isTextInput
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    isDisabled: within,
    onFocusChange
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !within,
    onFocusWithinChange: onFocusChange
  });
  return {
    isFocused,
    isFocusVisible: isFocusVisibleState,
    focusProps: within ? focusWithinProps : focusProps
  };
}
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) {
  let { elementType = "button", isDisabled, onPress, onPressStart, onPressEnd, onPressUp, onPressChange, preventFocusOnPress, allowFocusWhenDisabled, onClick, href, target, rel, type: type4 = "button" } = props;
  let additionalProps;
  if (elementType === "button")
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  else
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPress,
    onPressUp,
    onClick,
    isDisabled,
    preventFocusOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  if (allowFocusWhenDisabled)
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, pressProps, $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  }));
  return {
    isPressed,
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
function useReactAriaAccordionItem(props, state, ref) {
  let { item, isDisabled: isDisabledProp } = props;
  let key = item.key;
  let manager = state.selectionManager;
  let buttonId = reactExports.useId();
  let regionId = reactExports.useId();
  let isDisabled = state.disabledKeys.has(item.key) || isDisabledProp;
  reactExports.useEffect(() => {
    let isFocused = key === state.focusedKey;
    if (isFocused && document.activeElement !== ref.current) {
      ref.current && $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    }
  }, [ref, key, state.focusedKey]);
  let onSelect = reactExports.useCallback(
    (e2) => {
      if (!manager.canSelectItem(key)) {
        return;
      }
      manager.select(key, e2);
      state.toggleKey(key);
    },
    [key, manager]
  );
  const extendFocusSelection = reactExports.useCallback(
    (toKey2) => {
      if (manager.selectionBehavior === "replace") {
        manager.extendSelection(toKey2);
      }
      manager.setFocusedKey(toKey2);
    },
    [manager]
  );
  const onKeyDown = reactExports.useCallback(
    (event) => {
      const keyMap = {
        ArrowDown: () => {
          const nextKey = state.collection.getKeyAfter(key);
          if (nextKey && state.disabledKeys.has(nextKey)) {
            const nextEnabledKey = state.collection.getKeyAfter(nextKey);
            nextEnabledKey && extendFocusSelection(nextEnabledKey);
          } else {
            nextKey && extendFocusSelection(nextKey);
          }
        },
        ArrowUp: () => {
          const prevKey = state.collection.getKeyBefore(key);
          if (prevKey && state.disabledKeys.has(prevKey)) {
            const prevEnabledKey = state.collection.getKeyBefore(prevKey);
            prevEnabledKey && extendFocusSelection(prevEnabledKey);
          } else {
            prevKey && extendFocusSelection(prevKey);
          }
        },
        Home: () => {
          const firstKey = state.collection.getFirstKey();
          firstKey && extendFocusSelection(firstKey);
        },
        End: () => {
          const lastKey = state.collection.getLastKey();
          lastKey && extendFocusSelection(lastKey);
        }
      };
      const action = keyMap[event.key];
      if (action) {
        event.preventDefault();
        if (manager.canSelectItem(key)) {
          action(event);
        }
      }
    },
    [key, manager]
  );
  let { buttonProps } = $701a24aa0da5b062$export$ea18c227d4417cc3(
    {
      id: buttonId,
      elementType: "button",
      isDisabled,
      onKeyDown,
      onPress: onSelect
    },
    ref
  );
  let isExpanded = state.selectionManager.isSelected(item.key);
  return {
    buttonProps: {
      ...buttonProps,
      "aria-expanded": isExpanded,
      "aria-controls": isExpanded ? regionId : void 0
    },
    regionProps: {
      id: regionId,
      role: "region",
      "aria-labelledby": buttonId
    }
  };
}
function $feb5ffebff200149$export$d3e3bd3e26688c04$1(e2) {
  return $c87311424ea30a05$export$e1865c3bedcd822b() ? e2.altKey : e2.ctrlKey;
}
function $feb5ffebff200149$export$c3d8340acf92597f$2(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $feb5ffebff200149$var$collectionMap$1 = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$881eb0d9f3605d9d$1(collection) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  $feb5ffebff200149$var$collectionMap$1.set(collection, id2);
  return id2;
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$2 = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8$2(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey$2(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target))
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$2);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey$2(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
function $9bf71ea28793e738$var$isTabbableRadio$5(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$5(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$5(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$5(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$5(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$5 = class $9bf71ea28793e738$var$Tree3 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$5({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$5(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree3();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$5({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$5 = class $9bf71ea28793e738$var$TreeNode3 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$5();
function $55f9b1ae81f22853$export$76e4e37e5339496d$1(to2) {
  let from2 = $55f9b1ae81f22853$export$759df0d867455a91$1($431fbd86ca7dc216$export$b204af158042fbac$4(to2));
  if (from2 !== to2) {
    if (from2)
      $55f9b1ae81f22853$export$6c5dc7e81d2cc29a$1(from2, to2);
    if (to2)
      $55f9b1ae81f22853$export$2b35b76d2e30e129$2(to2, from2);
  }
}
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a$1(from2, to2) {
  from2.dispatchEvent(new FocusEvent("blur", {
    relatedTarget: to2
  }));
  from2.dispatchEvent(new FocusEvent("focusout", {
    bubbles: true,
    relatedTarget: to2
  }));
}
function $55f9b1ae81f22853$export$2b35b76d2e30e129$2(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $55f9b1ae81f22853$export$759df0d867455a91$1(document2) {
  let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(document2);
  let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute("aria-activedescendant");
  if (activeDescendant)
    return document2.getElementById(activeDescendant) || activeElement;
  return activeElement;
}
function $ae20dd8cbca75726$export$d6daf82dcd84e87c$1(options) {
  let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref, linkBehavior = "action" } = options;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    var _ref_current;
    if (e2.altKey && e2.key === "Tab")
      e2.preventDefault();
    if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e2.target)))
      return;
    const navigateToKey = (key, childFocus) => {
      if (key != null) {
        if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04$1(e2)) {
          reactDomExports.flushSync(() => {
            manager.setFocusedKey(key, childFocus);
          });
          let item = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, key);
          let itemProps = manager.getItemProps(key);
          if (item)
            router.open(item, e2, itemProps.href, itemProps.routerOptions);
          return;
        }
        manager.setFocusedKey(key, childFocus);
        if (manager.isLink(key) && linkBehavior === "override")
          return;
        if (e2.shiftKey && manager.selectionMode === "multiple")
          manager.extendSelection(key);
        else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04$1(e2))
          manager.replaceSelection(key);
      }
    };
    switch (e2.key) {
      case "ArrowDown":
        if (delegate.getKeyBelow) {
          var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowUp":
        if (delegate.getKeyAbove) {
          var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowLeft":
        if (delegate.getKeyLeftOf) {
          var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
          }
        }
        break;
      case "ArrowRight":
        if (delegate.getKeyRightOf) {
          var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
          }
        }
        break;
      case "Home":
        if (delegate.getFirstKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let firstKey = delegate.getFirstKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(firstKey);
          if (firstKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(firstKey);
            else if (selectOnFocus)
              manager.replaceSelection(firstKey);
          }
        }
        break;
      case "End":
        if (delegate.getLastKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let lastKey = delegate.getLastKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(lastKey);
          if (lastKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(lastKey);
            else if (selectOnFocus)
              manager.replaceSelection(lastKey);
          }
        }
        break;
      case "PageDown":
        if (delegate.getKeyPageBelow && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "PageUp":
        if (delegate.getKeyPageAbove && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "a":
        if ($21f1aa98acb08317$export$16792effe837dba3(e2) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
          e2.preventDefault();
          manager.selectAll();
        }
        break;
      case "Escape":
        if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
          e2.stopPropagation();
          e2.preventDefault();
          manager.clearSelection();
        }
        break;
      case "Tab":
        if (!allowsTabNavigation) {
          if (e2.shiftKey)
            ref.current.focus();
          else {
            let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$5(ref.current, {
              tabbable: true
            });
            let next2 = void 0;
            let last;
            do {
              last = walker.lastChild();
              if (last)
                next2 = last;
            } while (last);
            if (next2 && !next2.contains(document.activeElement))
              $7215afc6de606d6b$export$de79e2c695e052f3$5(next2);
          }
          break;
        }
    }
  };
  let scrollPos = reactExports.useRef({
    top: 0,
    left: 0
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? void 0 : () => {
    var _scrollRef_current, _scrollRef_current1;
    var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
    scrollPos.current = {
      top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
      left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
    };
  });
  let onFocus = (e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
    if (manager.focusedKey == null) {
      var _delegate_getLastKey, _delegate_getFirstKey;
      let navigateToKey = (key) => {
        if (key != null) {
          manager.setFocusedKey(key);
          if (selectOnFocus && !manager.isSelected(key))
            manager.replaceSelection(key);
        }
      };
      let relatedTarget = e2.relatedTarget;
      var _manager_lastSelectedKey, _manager_firstSelectedKey;
      if (relatedTarget && e2.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
        navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
      else
        navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
    } else if (!isVirtualized && scrollRef.current) {
      scrollRef.current.scrollTop = scrollPos.current.top;
      scrollRef.current.scrollLeft = scrollPos.current.left;
    }
    if (manager.focusedKey != null && scrollRef.current) {
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, manager.focusedKey);
      if (element2 instanceof HTMLElement) {
        if (!element2.contains(document.activeElement) && !shouldUseVirtualFocus)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        if (modality === "keyboard")
          $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
            containingElement: ref.current
          });
      }
    }
  };
  let onBlur = (e2) => {
    if (!e2.currentTarget.contains(e2.relatedTarget))
      manager.setFocused(false);
  };
  let shouldVirtualFocusFirst = reactExports.useRef(false);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e2) => {
    let { detail } = e2;
    e2.stopPropagation();
    manager.setFocused(true);
    if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === "first")
      shouldVirtualFocusFirst.current = true;
  });
  let updateActiveDescendant = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _delegate_getFirstKey;
    var _delegate_getFirstKey1;
    let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
    if (keyToFocus == null) {
      $55f9b1ae81f22853$export$76e4e37e5339496d$1(ref.current);
      if (manager.collection.size > 0)
        shouldVirtualFocusFirst.current = false;
    } else {
      manager.setFocusedKey(keyToFocus);
      shouldVirtualFocusFirst.current = false;
    }
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    if (shouldVirtualFocusFirst.current)
      updateActiveDescendant();
  }, [
    manager.collection,
    updateActiveDescendant
  ]);
  let resetFocusFirstFlag = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (manager.collection.size > 0)
      shouldVirtualFocusFirst.current = false;
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    resetFocusFirstFlag();
  }, [
    manager.focusedKey,
    resetFocusFirstFlag
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e2) => {
    var _e_detail;
    e2.stopPropagation();
    manager.setFocused(false);
    if ((_e_detail = e2.detail) === null || _e_detail === void 0 ? void 0 : _e_detail.clearFocusKey)
      manager.setFocusedKey(null);
  });
  const autoFocusRef = reactExports.useRef(autoFocus);
  const didAutoFocusRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      var _delegate_getFirstKey, _delegate_getLastKey;
      let focusedKey = null;
      var _delegate_getFirstKey1;
      if (autoFocus === "first")
        focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
      var _delegate_getLastKey1;
      if (autoFocus === "last")
        focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
      let selectedKeys = manager.selectedKeys;
      if (selectedKeys.size) {
        for (let key of selectedKeys)
          if (manager.canSelectItem(key)) {
            focusedKey = key;
            break;
          }
      }
      manager.setFocused(true);
      manager.setFocusedKey(focusedKey);
      if (focusedKey == null && !shouldUseVirtualFocus && ref.current)
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      if (manager.collection.size > 0) {
        autoFocusRef.current = false;
        didAutoFocusRef.current = true;
      }
    }
  });
  let lastFocusedKey = reactExports.useRef(manager.focusedKey);
  let raf3 = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
      let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$2(ref, manager.focusedKey);
      if (!(element2 instanceof HTMLElement))
        return;
      if (modality === "keyboard" || didAutoFocusRef.current) {
        if (raf3.current)
          cancelAnimationFrame(raf3.current);
        raf3.current = requestAnimationFrame(() => {
          if (scrollRef.current) {
            $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element2);
            if (modality !== "virtual")
              $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
                containingElement: ref.current
              });
          }
        });
      }
    }
    if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    lastFocusedKey.current = manager.focusedKey;
    didAutoFocusRef.current = false;
  });
  reactExports.useEffect(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, []);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e2) => {
    e2.preventDefault();
    manager.setFocused(true);
  });
  let handlers2 = {
    onKeyDown,
    onFocus,
    onBlur,
    onMouseDown(e2) {
      if (scrollRef.current === e2.target)
        e2.preventDefault();
    }
  };
  let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8$2({
    keyboardDelegate: delegate,
    selectionManager: manager
  });
  if (!disallowTypeAhead)
    handlers2 = $3ef42575df84b30b$export$9d1611c77c2fe928$9(typeSelectProps, handlers2);
  let tabIndex = void 0;
  if (!shouldUseVirtualFocus)
    tabIndex = manager.focusedKey == null ? 0 : -1;
  let collectionId = $feb5ffebff200149$export$881eb0d9f3605d9d$1(manager.collection);
  return {
    collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(handlers2, {
      tabIndex,
      "data-collection": collectionId
    })
  };
}
let $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2 = class $657e4dc4a6e88df0$export$8f5ed9ff9f511381 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f$2(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
};
let $2a25aae57d74318e$export$a05409b8bb224a5a$2 = class $2a25aae57d74318e$export$a05409b8bb224a5a {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$2(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
};
function $982254629710d113$export$b95089534ab7c1fd$1(props) {
  let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, layoutDelegate } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let disabledBehavior = selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$2({
    collection,
    disabledKeys,
    disabledBehavior,
    ref,
    collator,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    ref,
    collator,
    disabledBehavior
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c$1({
    ...props,
    ref,
    selectionManager,
    keyboardDelegate: delegate
  });
  return {
    listProps: collectionProps
  };
}
function useReactAriaAccordion(props, state, ref) {
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd$1({
    ...props,
    ...state,
    allowsTabNavigation: true,
    disallowSelectAll: true,
    ref
  });
  delete listProps.onKeyDownCapture;
  return {
    accordionProps: {
      ...listProps,
      tabIndex: void 0
    }
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$c(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$b(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$a(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$a = "default";
let $14c0b72509d70225$var$savedUserSelect$a = "";
let $14c0b72509d70225$var$modifiedElementMap$a = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$a(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$a === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$a = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$a = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$a.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$a(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$a !== "disabled")
      return;
    $14c0b72509d70225$var$state$a = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$a === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$a || "";
          $14c0b72509d70225$var$savedUserSelect$a = "";
          $14c0b72509d70225$var$state$a = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$a.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$a.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$a.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$a = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$a.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$a(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$a);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$a = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$a = class $f6c31cce2adf654f$var$PressEvent2 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$a, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$a = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$a = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$a(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$a(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$a("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$a("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$a(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$b(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$c(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$a(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$a(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$a(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$a(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$a(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$a(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$a]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$a] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$a(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$a(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$a(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$a))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$a;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$a((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$a]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$a(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$a(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$a(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$a(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$a(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$a(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$a(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$a(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$a(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$a(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$a = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$a(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$a.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = false;
let $6179b936705e76d3$var$hoverCount$g = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$g() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$g(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$g();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$g() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$g);
  $6179b936705e76d3$var$hoverCount$g++;
  return () => {
    $6179b936705e76d3$var$hoverCount$g--;
    if ($6179b936705e76d3$var$hoverCount$g > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$g);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$g(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$g, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$g && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useAccordionItem(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { ref, as: as2, item, onFocusChange } = props;
  const {
    state,
    className,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    motionProps,
    focusedKey,
    variant,
    isCompact = false,
    classNames: classNamesProp = {},
    isDisabled: isDisabledProp = false,
    hideIndicator = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    keepContentMounted = false,
    disableIndicatorAnimation = false,
    HeadingComponent = as2 || "h2",
    onPress,
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const isDisabled = state.disabledKeys.has(item.key) || isDisabledProp;
  const isOpen = state.selectionManager.isSelected(item.key);
  const { buttonProps: buttonCompleteProps, regionProps } = useReactAriaAccordionItem(
    { item, isDisabled },
    { ...state, focusedKey },
    domRef
  );
  const { onFocus: onFocusButton, onBlur: onBlurButton, ...buttonProps } = buttonCompleteProps;
  const { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus: (_b2 = item.props) == null ? void 0 : _b2.autoFocus
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$g({ isDisabled });
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$a({
    ref: domRef,
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp
  });
  const handleFocus3 = reactExports.useCallback(() => {
    onFocusChange == null ? void 0 : onFocusChange(true, item.key);
  }, []);
  const handleBlur = reactExports.useCallback(() => {
    onFocusChange == null ? void 0 : onFocusChange(false, item.key);
  }, []);
  const classNames2 = reactExports.useMemo(
    () => ({
      ...classNamesProp
    }),
    [objectToDeps(classNamesProp)]
  );
  const slots = reactExports.useMemo(
    () => accordionItem({
      isCompact,
      isDisabled,
      hideIndicator,
      disableAnimation,
      disableIndicatorAnimation,
      variant
    }),
    [isCompact, isDisabled, hideIndicator, disableAnimation, disableIndicatorAnimation, variant]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "base",
        className: slots.base({ class: baseStyles }),
        ...mergeProps$3(
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          props2
        )
      };
    },
    [baseStyles, shouldFilterDOMProps, otherProps, slots, item.props, isOpen, isDisabled]
  );
  const getButtonProps = (props2 = {}) => {
    var _a22, _b22;
    return {
      ref: domRef,
      "data-open": dataAttr(isOpen),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-disabled": dataAttr(isDisabled),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-slot": "trigger",
      className: slots.trigger({ class: classNames2 == null ? void 0 : classNames2.trigger }),
      onFocus: callAllHandlers(
        handleFocus3,
        onFocusButton,
        focusProps.onFocus,
        otherProps.onFocus,
        (_a22 = item.props) == null ? void 0 : _a22.onFocus
      ),
      onBlur: callAllHandlers(
        handleBlur,
        onBlurButton,
        focusProps.onBlur,
        otherProps.onBlur,
        (_b22 = item.props) == null ? void 0 : _b22.onBlur
      ),
      ...mergeProps$3(buttonProps, hoverProps, pressProps, props2, {
        onClick: chain(pressProps.onClick, onClick)
      })
    };
  };
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "content",
        className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
        ...mergeProps$3(regionProps, props2)
      };
    },
    [slots, classNames2, regionProps, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.content]
  );
  const getIndicatorProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "indicator",
        className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.indicator, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.indicator]
  );
  const getHeadingProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "heading",
        className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.heading, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.heading]
  );
  const getTitleProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "title",
        className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
        ...props2
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.title, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.title]
  );
  const getSubtitleProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-open": dataAttr(isOpen),
        "data-disabled": dataAttr(isDisabled),
        "data-slot": "subtitle",
        className: slots.subtitle({ class: classNames2 == null ? void 0 : classNames2.subtitle }),
        ...props2
      };
    },
    [slots, classNames2, isOpen, isDisabled, classNames2 == null ? void 0 : classNames2.subtitle]
  );
  return {
    Component: Component2,
    HeadingComponent,
    item,
    slots,
    classNames: classNames2,
    domRef,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    isOpen,
    isDisabled,
    hideIndicator,
    keepContentMounted,
    disableAnimation,
    motionProps,
    getBaseProps,
    getHeadingProps,
    getButtonProps,
    getContentProps,
    getIndicatorProps,
    getTitleProps,
    getSubtitleProps
  };
}
var CheckLinearIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: 2,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "20 6 9 17 4 12" })
  }
);
var CopyLinearIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16 17.1c0 3.5-1.4 4.9-4.9 4.9H6.9C3.4 22 2 20.6 2 17.1v-4.2C2 9.4 3.4 8 6.9 8h4.2c3.5 0 4.9 1.4 4.9 4.9Z" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M8 8V6.9C8 3.4 9.4 2 12.9 2h4.2C20.6 2 22 3.4 22 6.9v4.2c0 3.5-1.4 4.9-4.9 4.9H16" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M16 12.9C16 9.4 14.6 8 11.1 8" })
    ]
  }
);
var CalendarBoldIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          d: "M7.75 2.5a.75.75 0 0 0-1.5 0v1.58c-1.44.115-2.384.397-3.078 1.092c-.695.694-.977 1.639-1.093 3.078h19.842c-.116-1.44-.398-2.384-1.093-3.078c-.694-.695-1.639-.977-3.078-1.093V2.5a.75.75 0 0 0-1.5 0v1.513C15.585 4 14.839 4 14 4h-4c-.839 0-1.585 0-2.25.013z",
          fill: "currentColor"
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          clipRule: "evenodd",
          d: "M2 12c0-.839 0-1.585.013-2.25h19.974C22 10.415 22 11.161 22 12v2c0 3.771 0 5.657-1.172 6.828C19.657 22 17.771 22 14 22h-4c-3.771 0-5.657 0-6.828-1.172C2 19.657 2 17.771 2 14zm15 2a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2m-4-5a1 1 0 1 1-2 0a1 1 0 0 1 2 0m0 4a1 1 0 1 1-2 0a1 1 0 0 1 2 0m-6-3a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 4a1 1 0 1 0 0-2a1 1 0 0 0 0 2",
          fill: "currentColor",
          fillRule: "evenodd"
        }
      )
    ]
  }
);
var SuccessIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          d: "\n          M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2Z\n          M16.78 9.7L11.11 15.37C10.97 15.51 10.78 15.59 10.58 15.59C10.38 15.59 10.19 15.51 10.05 15.37L7.22 12.54\n          C6.93 12.25 6.93 11.77 7.22 11.48C7.51 11.19 7.99 11.19 8.28 11.48L10.58 13.78L15.72 8.64\n          C16.01 8.35 16.49 8.35 16.78 8.64C17.07 8.93 17.07 9.4 16.78 9.7Z\n        "
        }
      )
    }
  );
};
var WarningIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      className: "fill-current",
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "path",
        {
          clipRule: "evenodd",
          d: "M3 10.417C3 7.219 3 5.62 3.378 5.082C3.755 4.545 5.258 4.03 8.265 3.001L8.838 2.805C10.405 2.268 11.188 2 12 2C12.812 2 13.595 2.268 15.162 2.805L15.735 3.001C18.742 4.03 20.245 4.545 20.622 5.082C21 5.62 21 7.22 21 10.417V11.991C21 17.629 16.761 20.366 14.101 21.527C13.38 21.842 13.02 22 12 22C10.98 22 10.62 21.842 9.899 21.527C7.239 20.365 3 17.63 3 11.991V10.417ZM12 7.25C12.1989 7.25 12.3897 7.32902 12.5303 7.46967C12.671 7.61032 12.75 7.80109 12.75 8V12C12.75 12.1989 12.671 12.3897 12.5303 12.5303C12.3897 12.671 12.1989 12.75 12 12.75C11.8011 12.75 11.6103 12.671 11.4697 12.5303C11.329 12.3897 11.25 12.1989 11.25 12V8C11.25 7.80109 11.329 7.61032 11.4697 7.46967C11.6103 7.32902 11.8011 7.25 12 7.25ZM12 16C12.2652 16 12.5196 15.8946 12.7071 15.7071C12.8946 15.5196 13 15.2652 13 15C13 14.7348 12.8946 14.4804 12.7071 14.2929C12.5196 14.1054 12.2652 14 12 14C11.7348 14 11.4804 14.1054 11.2929 14.2929C11.1054 14.4804 11 14.7348 11 15C11 15.2652 11.1054 15.5196 11.2929 15.7071C11.4804 15.8946 11.7348 16 12 16Z",
          fill: "currentColor",
          fillRule: "evenodd"
        }
      )
    }
  );
};
var InfoCircleIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22ZM12.75 16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16L11.25 11C11.25 10.59 11.59 10.25 12 10.25C12.41 10.25 12.75 10.59 12.75 11L12.75 16ZM11.08 7.62C11.13 7.49 11.2 7.39 11.29 7.29C11.39 7.2 11.5 7.13 11.62 7.08C11.74 7.03 11.87 7 12 7C12.13 7 12.26 7.03 12.38 7.08C12.5 7.13 12.61 7.2 12.71 7.29C12.8 7.39 12.87 7.49 12.92 7.62C12.97 7.74 13 7.87 13 8C13 8.13 12.97 8.26 12.92 8.38C12.87 8.5 12.8 8.61 12.71 8.71C12.61 8.8 12.5 8.87 12.38 8.92C12.14 9.02 11.86 9.02 11.62 8.92C11.5 8.87 11.39 8.8 11.29 8.71C11.2 8.61 11.13 8.5 11.08 8.38C11.03 8.26 11 8.13 11 8C11 7.87 11.03 7.74 11.08 7.62Z" })
    }
  );
};
var InfoFilledIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      fill: "none",
      height: "24",
      viewBox: "0 0 24 24",
      width: "24",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22ZM12.75 16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16L11.25 11C11.25 10.59 11.59 10.25 12 10.25C12.41 10.25 12.75 10.59 12.75 11L12.75 16ZM11.08 7.62C11.13 7.49 11.2 7.39 11.29 7.29C11.39 7.2 11.5 7.13 11.62 7.08C11.74 7.03 11.87 7 12 7C12.13 7 12.26 7.03 12.38 7.08C12.5 7.13 12.61 7.2 12.71 7.29C12.8 7.39 12.87 7.49 12.92 7.62C12.97 7.74 13 7.87 13 8C13 8.13 12.97 8.26 12.92 8.38C12.87 8.5 12.8 8.61 12.71 8.71C12.61 8.8 12.5 8.87 12.38 8.92C12.14 9.02 11.86 9.02 11.62 8.92C11.5 8.87 11.39 8.8 11.29 8.71C11.2 8.61 11.13 8.5 11.08 8.38C11.03 8.26 11 8.13 11 8C11 7.87 11.03 7.74 11.08 7.62Z" })
    }
  );
};
var LinkIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    shapeRendering: "geometricPrecision",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15 3h6v6" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M10 14L21 3" })
    ]
  }
);
var EllipsisIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    height: "1em",
    shapeRendering: "geometricPrecision",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "12", cy: "12", fill: "currentColor", r: "1" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "19", cy: "12", fill: "currentColor", r: "1" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { cx: "5", cy: "12", fill: "currentColor", r: "1" })
    ]
  }
);
var ForwardIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    shapeRendering: "geometricPrecision",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M13 17l5-5-5-5" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M6 17l5-5-5-5" })
    ]
  }
);
var ChevronUpIcon = ({ strokeWidth = 1.5, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "m18 15-6-6-6 6" })
  }
);
var ChevronIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M15.5 19l-7-7 7-7",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var CloseFilledIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z",
        fill: "currentColor"
      }
    )
  }
);
var CloseIcon = (props) => {
  const { isSelected, isIndeterminate, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      className: "fill-current",
      fill: "none",
      focusable: "false",
      height: "1em",
      role: "presentation",
      stroke: "currentColor",
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeWidth: 2,
      viewBox: "0 0 24 24",
      width: "1em",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
    }
  );
};
var DangerIcon = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      className: "fill-current",
      fill: "none",
      height: "20",
      viewBox: "0 0 20 20",
      width: "20",
      xmlns: "http://www.w3.org/2000/svg",
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M17.51 3.85L11.57 0.42C10.6 -0.14 9.4 -0.14 8.42 0.42L2.49 3.85C1.52 4.41 0.919998 5.45 0.919998 6.58V13.42C0.919998 14.54 1.52 15.58 2.49 16.15L8.43 19.58C9.4 20.14 10.6 20.14 11.58 19.58L17.52 16.15C18.49 15.59 19.09 14.55 19.09 13.42V6.58C19.08 5.45 18.48 4.42 17.51 3.85ZM9.25 5.75C9.25 5.34 9.59 5 10 5C10.41 5 10.75 5.34 10.75 5.75V11C10.75 11.41 10.41 11.75 10 11.75C9.59 11.75 9.25 11.41 9.25 11V5.75ZM10.92 14.63C10.87 14.75 10.8 14.86 10.71 14.96C10.52 15.15 10.27 15.25 10 15.25C9.87 15.25 9.74 15.22 9.62 15.17C9.49 15.12 9.39 15.05 9.29 14.96C9.2 14.86 9.13 14.75 9.07 14.63C9.02 14.51 9 14.38 9 14.25C9 13.99 9.1 13.73 9.29 13.54C9.39 13.45 9.49 13.38 9.62 13.33C9.99 13.17 10.43 13.26 10.71 13.54C10.8 13.64 10.87 13.74 10.92 13.87C10.97 13.99 11 14.12 11 14.25C11 14.38 10.97 14.51 10.92 14.63Z" })
    }
  );
};
var ChevronDownIcon$1 = ({ strokeWidth = 1.5, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth,
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "m6 9 6 6 6-6" })
  }
);
var ChevronRightIcon$1 = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: "1.5",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "m9 18 6-6-6-6" })
  }
);
function useMeasure$1() {
  const [dimensions, setDimensions] = reactExports.useState({
    width: null,
    height: null
  });
  const previousObserver = reactExports.useRef(null);
  const customRef = reactExports.useCallback((node2) => {
    if (previousObserver.current) {
      previousObserver.current.disconnect();
      previousObserver.current = null;
    }
    if ((node2 == null ? void 0 : node2.nodeType) === Node.ELEMENT_NODE) {
      const observer = new ResizeObserver(([entry]) => {
        if (entry && entry.borderBoxSize) {
          const { inlineSize: width, blockSize: height } = entry.borderBoxSize[0];
          setDimensions({ width, height });
        }
      });
      observer.observe(node2);
      previousObserver.current = observer;
    }
  }, []);
  return [customRef, dimensions];
}
var ResizablePanel = reactExports.forwardRef(
  (originalProps, ref) => {
    const { children, ...props } = originalProps;
    let [measureRef, bounds2] = useMeasure$1();
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        ref,
        animate: {
          width: bounds2.width && (bounds2 == null ? void 0 : bounds2.width) > 0 ? bounds2.width : "auto",
          height: bounds2.height && bounds2.height > 0 ? bounds2.height : "auto"
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: measureRef, ...props, children })
      }
    ) });
  }
);
ResizablePanel.displayName = "HeroUI - ResizablePanel";
var TRANSITION_EASINGS = {
  ease: [0.36, 0.66, 0.4, 1],
  easeIn: [0.4, 0, 1, 1],
  easeOut: [0, 0, 0.2, 1]
};
var TRANSITION_VARIANTS = {
  scaleSpring: {
    enter: {
      transform: "scale(1)",
      opacity: 1,
      transition: {
        type: "spring",
        bounce: 0,
        duration: 0.2
      }
    },
    exit: {
      transform: "scale(0.85)",
      opacity: 0,
      transition: {
        type: "easeOut",
        duration: 0.15
      }
    }
  },
  scaleSpringOpacity: {
    initial: {
      opacity: 0,
      transform: "scale(0.8)"
    },
    enter: {
      opacity: 1,
      transform: "scale(1)",
      transition: {
        type: "spring",
        bounce: 0,
        duration: 0.3
      }
    },
    exit: {
      opacity: 0,
      transform: "scale(0.96)",
      transition: {
        type: "easeOut",
        bounce: 0,
        duration: 0.15
      }
    }
  },
  fade: {
    enter: {
      opacity: 1,
      transition: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      }
    },
    exit: {
      opacity: 0,
      transition: {
        duration: 0.3,
        ease: TRANSITION_EASINGS.ease
      }
    }
  },
  collapse: {
    enter: {
      opacity: 1,
      height: "auto",
      transition: {
        height: {
          type: "spring",
          bounce: 0,
          duration: 0.3
        },
        opacity: {
          easings: "ease",
          duration: 0.4
        }
      }
    },
    exit: {
      opacity: 0,
      height: 0,
      transition: {
        easings: "ease",
        duration: 0.3
      }
    }
  }
};
var domAnimation$7 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var AccordionItem = forwardRef((props, ref) => {
  const {
    Component: Component2,
    HeadingComponent,
    classNames: classNames2,
    slots,
    indicator,
    children,
    title,
    subtitle,
    startContent,
    isOpen,
    isDisabled,
    hideIndicator,
    keepContentMounted,
    disableAnimation,
    motionProps,
    getBaseProps,
    getHeadingProps,
    getButtonProps,
    getTitleProps,
    getSubtitleProps,
    getContentProps,
    getIndicatorProps
  } = useAccordionItem({ ...props, ref });
  const willChange = useWillChange();
  const indicatorContent = reactExports.useMemo(() => {
    if (typeof indicator === "function") {
      return indicator({ indicator: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {}), isOpen, isDisabled });
    }
    if (indicator)
      return indicator;
    return null;
  }, [indicator, isOpen, isDisabled]);
  const indicatorComponent = indicatorContent || /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {});
  const content2 = reactExports.useMemo(() => {
    if (disableAnimation) {
      if (keepContentMounted) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children });
      }
      return isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children });
    }
    const transitionVariants = {
      exit: { ...TRANSITION_VARIANTS.collapse.exit, overflowY: "hidden" },
      enter: { ...TRANSITION_VARIANTS.collapse.enter, overflowY: "unset" }
    };
    return keepContentMounted ? /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.section,
      {
        animate: isOpen ? "enter" : "exit",
        exit: "exit",
        initial: "exit",
        style: { willChange },
        variants: transitionVariants,
        onKeyDown: (e2) => {
          e2.stopPropagation();
        },
        ...motionProps,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children })
      },
      "accordion-content"
    ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { initial: false, children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$7, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.section,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        style: { willChange },
        variants: transitionVariants,
        onKeyDown: (e2) => {
          e2.stopPropagation();
        },
        ...motionProps,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children })
      },
      "accordion-content"
    ) }) });
  }, [isOpen, disableAnimation, keepContentMounted, children, motionProps]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(HeadingComponent, { ...getHeadingProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { ...getButtonProps(), children: [
      startContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.startContent({ class: classNames2 == null ? void 0 : classNames2.startContent }), children: startContent }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.titleWrapper({ class: classNames2 == null ? void 0 : classNames2.titleWrapper }), children: [
        title && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getTitleProps(), children: title }),
        subtitle && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSubtitleProps(), children: subtitle })
      ] }),
      !hideIndicator && indicatorComponent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getIndicatorProps(), children: indicatorComponent })
    ] }) }),
    content2
  ] });
});
AccordionItem.displayName = "HeroUI.AccordionItem";
var accordion_item_default = AccordionItem;
class $05ca4cd7c4a5a999$export$863faf230ee2118a {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  constructor(nodes, { expandedKeys } = {}) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    expandedKeys = expandedKeys || /* @__PURE__ */ new Set();
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && (node2.type === "section" || expandedKeys.has(node2.key)))
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
}
class $e40ea825a81a3709$export$52baac22726c72bf extends Set {
  constructor(keys2, anchorKey, currentKey) {
    super(keys2);
    if (keys2 instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
      this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys2.anchorKey;
      this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys2.currentKey;
    } else {
      this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : null;
      this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : null;
    }
  }
}
function $7af3f5b51489e0b5$var$equalSets(setA, setB) {
  if (setA.size !== setB.size)
    return false;
  for (let item of setA) {
    if (!setB.has(item))
      return false;
  }
  return true;
}
function $7af3f5b51489e0b5$export$253fe78d46329472(props) {
  let { selectionMode = "none", disallowEmptySelection = false, allowDuplicateSelectionEvents, selectionBehavior: selectionBehaviorProp = "toggle", disabledBehavior = "all" } = props;
  let isFocusedRef = reactExports.useRef(false);
  let [, setFocused] = reactExports.useState(false);
  let focusedKeyRef = reactExports.useRef(null);
  let childFocusStrategyRef = reactExports.useRef(null);
  let [, setFocusedKey] = reactExports.useState(null);
  let selectedKeysProp = reactExports.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.selectedKeys), [
    props.selectedKeys
  ]);
  let defaultSelectedKeys = reactExports.useMemo(() => $7af3f5b51489e0b5$var$convertSelection(props.defaultSelectedKeys, new $e40ea825a81a3709$export$52baac22726c72bf()), [
    props.defaultSelectedKeys
  ]);
  let [selectedKeys, setSelectedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(selectedKeysProp, defaultSelectedKeys, props.onSelectionChange);
  let disabledKeysProp = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let [selectionBehavior, setSelectionBehavior] = reactExports.useState(selectionBehaviorProp);
  if (selectionBehaviorProp === "replace" && selectionBehavior === "toggle" && typeof selectedKeys === "object" && selectedKeys.size === 0)
    setSelectionBehavior("replace");
  let lastSelectionBehavior = reactExports.useRef(selectionBehaviorProp);
  reactExports.useEffect(() => {
    if (selectionBehaviorProp !== lastSelectionBehavior.current) {
      setSelectionBehavior(selectionBehaviorProp);
      lastSelectionBehavior.current = selectionBehaviorProp;
    }
  }, [
    selectionBehaviorProp
  ]);
  return {
    selectionMode,
    disallowEmptySelection,
    selectionBehavior,
    setSelectionBehavior,
    get isFocused() {
      return isFocusedRef.current;
    },
    setFocused(f2) {
      isFocusedRef.current = f2;
      setFocused(f2);
    },
    get focusedKey() {
      return focusedKeyRef.current;
    },
    get childFocusStrategy() {
      return childFocusStrategyRef.current;
    },
    setFocusedKey(k2, childFocusStrategy = "first") {
      focusedKeyRef.current = k2;
      childFocusStrategyRef.current = childFocusStrategy;
      setFocusedKey(k2);
    },
    selectedKeys,
    setSelectedKeys(keys2) {
      if (allowDuplicateSelectionEvents || !$7af3f5b51489e0b5$var$equalSets(keys2, selectedKeys))
        setSelectedKeys(keys2);
    },
    disabledKeys: disabledKeysProp,
    disabledBehavior
  };
}
function $7af3f5b51489e0b5$var$convertSelection(selection, defaultValue2) {
  if (!selection)
    return defaultValue2;
  return selection === "all" ? "all" : new $e40ea825a81a3709$export$52baac22726c72bf(selection);
}
class $eb2240fc39a57fa5$export$bf788dd355e3a401 {
  build(props, context) {
    this.context = context;
    return $eb2240fc39a57fa5$var$iterable(() => this.iterateCollection(props));
  }
  *iterateCollection(props) {
    let { children, items } = props;
    if (React$6.isValidElement(children) && children.type === React$6.Fragment)
      yield* this.iterateCollection({
        children: children.props.children,
        items
      });
    else if (typeof children === "function") {
      if (!items)
        throw new Error("props.children was a function but props.items is missing");
      let index2 = 0;
      for (let item of items) {
        yield* this.getFullNode({
          value: item,
          index: index2
        }, {
          renderer: children
        });
        index2++;
      }
    } else {
      let items2 = [];
      React$6.Children.forEach(children, (child) => {
        if (child)
          items2.push(child);
      });
      let index2 = 0;
      for (let item of items2) {
        let nodes = this.getFullNode({
          element: item,
          index: index2
        }, {});
        for (let node2 of nodes) {
          index2++;
          yield node2;
        }
      }
    }
  }
  getKey(item, partialNode, state, parentKey) {
    if (item.key != null)
      return item.key;
    if (partialNode.type === "cell" && partialNode.key != null)
      return `${parentKey}${partialNode.key}`;
    let v2 = partialNode.value;
    if (v2 != null) {
      var _v_key;
      let key = (_v_key = v2.key) !== null && _v_key !== void 0 ? _v_key : v2.id;
      if (key == null)
        throw new Error("No key found for item");
      return key;
    }
    return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;
  }
  getChildState(state, partialNode) {
    return {
      renderer: partialNode.renderer || state.renderer
    };
  }
  *getFullNode(partialNode, state, parentKey, parentNode) {
    if (React$6.isValidElement(partialNode.element) && partialNode.element.type === React$6.Fragment) {
      let children = [];
      React$6.Children.forEach(partialNode.element.props.children, (child) => {
        children.push(child);
      });
      var _partialNode_index;
      let index2 = (_partialNode_index = partialNode.index) !== null && _partialNode_index !== void 0 ? _partialNode_index : 0;
      for (const child of children)
        yield* this.getFullNode({
          element: child,
          index: index2++
        }, state, parentKey, parentNode);
      return;
    }
    let element2 = partialNode.element;
    if (!element2 && partialNode.value && state && state.renderer) {
      let cached = this.cache.get(partialNode.value);
      if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {
        cached.index = partialNode.index;
        cached.parentKey = parentNode ? parentNode.key : null;
        yield cached;
        return;
      }
      element2 = state.renderer(partialNode.value);
    }
    if (React$6.isValidElement(element2)) {
      let type4 = element2.type;
      if (typeof type4 !== "function" && typeof type4.getCollectionNode !== "function") {
        let name2 = element2.type;
        throw new Error(`Unknown element <${name2}> in collection.`);
      }
      let childNodes = type4.getCollectionNode(element2.props, this.context);
      var _partialNode_index1;
      let index2 = (_partialNode_index1 = partialNode.index) !== null && _partialNode_index1 !== void 0 ? _partialNode_index1 : 0;
      let result = childNodes.next();
      while (!result.done && result.value) {
        let childNode = result.value;
        partialNode.index = index2;
        var _childNode_key;
        let nodeKey = (_childNode_key = childNode.key) !== null && _childNode_key !== void 0 ? _childNode_key : null;
        if (nodeKey == null)
          nodeKey = childNode.element ? null : this.getKey(element2, partialNode, state, parentKey);
        let nodes = this.getFullNode({
          ...childNode,
          key: nodeKey,
          index: index2,
          wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)
        }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element2.key}` : element2.key, parentNode);
        let children = [
          ...nodes
        ];
        for (let node3 of children) {
          var _childNode_value, _ref;
          node3.value = (_ref = (_childNode_value = childNode.value) !== null && _childNode_value !== void 0 ? _childNode_value : partialNode.value) !== null && _ref !== void 0 ? _ref : null;
          if (node3.value)
            this.cache.set(node3.value, node3);
          var _parentNode_type;
          if (partialNode.type && node3.type !== partialNode.type)
            throw new Error(`Unsupported type <${$eb2240fc39a57fa5$var$capitalize(node3.type)}> in <${$eb2240fc39a57fa5$var$capitalize((_parentNode_type = parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== null && _parentNode_type !== void 0 ? _parentNode_type : "unknown parent type")}>. Only <${$eb2240fc39a57fa5$var$capitalize(partialNode.type)}> is supported.`);
          index2++;
          yield node3;
        }
        result = childNodes.next(children);
      }
      return;
    }
    if (partialNode.key == null || partialNode.type == null)
      return;
    let builder = this;
    var _partialNode_value, _partialNode_textValue;
    let node2 = {
      type: partialNode.type,
      props: partialNode.props,
      key: partialNode.key,
      parentKey: parentNode ? parentNode.key : null,
      value: (_partialNode_value = partialNode.value) !== null && _partialNode_value !== void 0 ? _partialNode_value : null,
      level: parentNode ? parentNode.level + 1 : 0,
      index: partialNode.index,
      rendered: partialNode.rendered,
      textValue: (_partialNode_textValue = partialNode.textValue) !== null && _partialNode_textValue !== void 0 ? _partialNode_textValue : "",
      "aria-label": partialNode["aria-label"],
      wrapper: partialNode.wrapper,
      shouldInvalidate: partialNode.shouldInvalidate,
      hasChildNodes: partialNode.hasChildNodes || false,
      childNodes: $eb2240fc39a57fa5$var$iterable(function* () {
        if (!partialNode.hasChildNodes || !partialNode.childNodes)
          return;
        let index2 = 0;
        for (let child of partialNode.childNodes()) {
          if (child.key != null)
            child.key = `${node2.key}${child.key}`;
          let nodes = builder.getFullNode({
            ...child,
            index: index2
          }, builder.getChildState(state, child), node2.key, node2);
          for (let node3 of nodes) {
            index2++;
            yield node3;
          }
        }
      })
    };
    yield node2;
  }
  constructor() {
    this.cache = /* @__PURE__ */ new WeakMap();
  }
}
function $eb2240fc39a57fa5$var$iterable(iterator2) {
  let cache2 = [];
  let iterable = null;
  return {
    *[Symbol.iterator]() {
      for (let item of cache2)
        yield item;
      if (!iterable)
        iterable = iterator2();
      for (let item of iterable) {
        cache2.push(item);
        yield item;
      }
    }
  };
}
function $eb2240fc39a57fa5$var$compose(outer, inner) {
  if (outer && inner)
    return (element2) => outer(inner(element2));
  if (outer)
    return outer;
  if (inner)
    return inner;
}
function $eb2240fc39a57fa5$var$capitalize(str) {
  return str[0].toUpperCase() + str.slice(1);
}
function $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {
  let builder = reactExports.useMemo(() => new $eb2240fc39a57fa5$export$bf788dd355e3a401(), []);
  let { children, items, collection } = props;
  let result = reactExports.useMemo(() => {
    if (collection)
      return collection;
    let nodes = builder.build({
      children,
      items
    }, context);
    return factory(nodes);
  }, [
    builder,
    children,
    items,
    collection,
    context,
    factory
  ]);
  return result;
}
function $c5a24bc478652b5f$export$1005530eda016c13(node2, collection) {
  if (typeof collection.getChildren === "function")
    return collection.getChildren(node2.key);
  return node2.childNodes;
}
function $c5a24bc478652b5f$export$fbdeaa6a76694f71(iterable) {
  return $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, 0);
}
function $c5a24bc478652b5f$export$5f3398f8733f90e2(iterable, index2) {
  if (index2 < 0)
    return void 0;
  let i2 = 0;
  for (let item of iterable) {
    if (i2 === index2)
      return item;
    i2++;
  }
}
function $c5a24bc478652b5f$export$7475b2c64539e4cf(iterable) {
  let lastItem = void 0;
  for (let value2 of iterable)
    lastItem = value2;
  return lastItem;
}
function $c5a24bc478652b5f$export$8c434b3a7a4dad6(collection, a2, b2) {
  if (a2.parentKey === b2.parentKey)
    return a2.index - b2.index;
  let aAncestors = [
    ...$c5a24bc478652b5f$var$getAncestors(collection, a2),
    a2
  ];
  let bAncestors = [
    ...$c5a24bc478652b5f$var$getAncestors(collection, b2),
    b2
  ];
  let firstNonMatchingAncestor = aAncestors.slice(0, bAncestors.length).findIndex((a3, i2) => a3 !== bAncestors[i2]);
  if (firstNonMatchingAncestor !== -1) {
    a2 = aAncestors[firstNonMatchingAncestor];
    b2 = bAncestors[firstNonMatchingAncestor];
    return a2.index - b2.index;
  }
  if (aAncestors.findIndex((node2) => node2 === b2) >= 0)
    return 1;
  else if (bAncestors.findIndex((node2) => node2 === a2) >= 0)
    return -1;
  return -1;
}
function $c5a24bc478652b5f$var$getAncestors(collection, node2) {
  let parents = [];
  let currNode = node2;
  while ((currNode === null || currNode === void 0 ? void 0 : currNode.parentKey) != null) {
    currNode = collection.getItem(currNode.parentKey);
    if (currNode)
      parents.unshift(currNode);
  }
  return parents;
}
const $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
  let count = $453cc9f0df89c0a5$var$cache.get(collection);
  if (count != null)
    return count;
  let counter = 0;
  let countItems = (items) => {
    for (let item of items) {
      if (item.type === "section")
        countItems($c5a24bc478652b5f$export$1005530eda016c13(item, collection));
      else if (item.type === "item")
        counter++;
    }
  };
  countItems(collection);
  $453cc9f0df89c0a5$var$cache.set(collection, counter);
  return counter;
}
class $d496c0a20b6e58ec$export$6c8a5aaad13c9852 {
  /**
  * The type of selection that is allowed in the collection.
  */
  get selectionMode() {
    return this.state.selectionMode;
  }
  /**
  * Whether the collection allows empty selection.
  */
  get disallowEmptySelection() {
    return this.state.disallowEmptySelection;
  }
  /**
  * The selection behavior for the collection.
  */
  get selectionBehavior() {
    return this.state.selectionBehavior;
  }
  /**
  * Sets the selection behavior for the collection.
  */
  setSelectionBehavior(selectionBehavior) {
    this.state.setSelectionBehavior(selectionBehavior);
  }
  /**
  * Whether the collection is currently focused.
  */
  get isFocused() {
    return this.state.isFocused;
  }
  /**
  * Sets whether the collection is focused.
  */
  setFocused(isFocused) {
    this.state.setFocused(isFocused);
  }
  /**
  * The current focused key in the collection.
  */
  get focusedKey() {
    return this.state.focusedKey;
  }
  /** Whether the first or last child of the focused key should receive focus. */
  get childFocusStrategy() {
    return this.state.childFocusStrategy;
  }
  /**
  * Sets the focused key.
  */
  setFocusedKey(key, childFocusStrategy) {
    if (key == null || this.collection.getItem(key))
      this.state.setFocusedKey(key, childFocusStrategy);
  }
  /**
  * The currently selected keys in the collection.
  */
  get selectedKeys() {
    return this.state.selectedKeys === "all" ? new Set(this.getSelectAllKeys()) : this.state.selectedKeys;
  }
  /**
  * The raw selection value for the collection.
  * Either 'all' for select all, or a set of keys.
  */
  get rawSelection() {
    return this.state.selectedKeys;
  }
  /**
  * Returns whether a key is selected.
  */
  isSelected(key) {
    if (this.state.selectionMode === "none")
      return false;
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return false;
    return this.state.selectedKeys === "all" ? this.canSelectItem(mappedKey) : this.state.selectedKeys.has(mappedKey);
  }
  /**
  * Whether the selection is empty.
  */
  get isEmpty() {
    return this.state.selectedKeys !== "all" && this.state.selectedKeys.size === 0;
  }
  /**
  * Whether all items in the collection are selected.
  */
  get isSelectAll() {
    if (this.isEmpty)
      return false;
    if (this.state.selectedKeys === "all")
      return true;
    if (this._isSelectAll != null)
      return this._isSelectAll;
    let allKeys = this.getSelectAllKeys();
    let selectedKeys = this.state.selectedKeys;
    this._isSelectAll = allKeys.every((k2) => selectedKeys.has(k2));
    return this._isSelectAll;
  }
  get firstSelectedKey() {
    let first = null;
    for (let key of this.state.selectedKeys) {
      let item = this.collection.getItem(key);
      if (!first || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, first) < 0)
        first = item;
    }
    var _first_key;
    return (_first_key = first === null || first === void 0 ? void 0 : first.key) !== null && _first_key !== void 0 ? _first_key : null;
  }
  get lastSelectedKey() {
    let last = null;
    for (let key of this.state.selectedKeys) {
      let item = this.collection.getItem(key);
      if (!last || item && $c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, item, last) > 0)
        last = item;
    }
    var _last_key;
    return (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
  get disabledKeys() {
    return this.state.disabledKeys;
  }
  get disabledBehavior() {
    return this.state.disabledBehavior;
  }
  /**
  * Extends the selection to the given key.
  */
  extendSelection(toKey2) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single") {
      this.replaceSelection(toKey2);
      return;
    }
    let mappedToKey = this.getKey(toKey2);
    if (mappedToKey == null)
      return;
    let selection;
    if (this.state.selectedKeys === "all")
      selection = new $e40ea825a81a3709$export$52baac22726c72bf([
        mappedToKey
      ], mappedToKey, mappedToKey);
    else {
      let selectedKeys = this.state.selectedKeys;
      var _selectedKeys_anchorKey;
      let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : mappedToKey;
      selection = new $e40ea825a81a3709$export$52baac22726c72bf(selectedKeys, anchorKey, mappedToKey);
      var _selectedKeys_currentKey;
      for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : mappedToKey))
        selection.delete(key);
      for (let key of this.getKeyRange(mappedToKey, anchorKey))
        if (this.canSelectItem(key))
          selection.add(key);
    }
    this.state.setSelectedKeys(selection);
  }
  getKeyRange(from2, to2) {
    let fromItem = this.collection.getItem(from2);
    let toItem = this.collection.getItem(to2);
    if (fromItem && toItem) {
      if ($c5a24bc478652b5f$export$8c434b3a7a4dad6(this.collection, fromItem, toItem) <= 0)
        return this.getKeyRangeInternal(from2, to2);
      return this.getKeyRangeInternal(to2, from2);
    }
    return [];
  }
  getKeyRangeInternal(from2, to2) {
    var _this_layoutDelegate;
    if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange)
      return this.layoutDelegate.getKeyRange(from2, to2);
    let keys2 = [];
    let key = from2;
    while (key != null) {
      let item = this.collection.getItem(key);
      if (item && (item.type === "item" || item.type === "cell" && this.allowsCellSelection))
        keys2.push(key);
      if (key === to2)
        return keys2;
      key = this.collection.getKeyAfter(key);
    }
    return [];
  }
  getKey(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return key;
    if (item.type === "cell" && this.allowsCellSelection)
      return key;
    while (item && item.type !== "item" && item.parentKey != null)
      item = this.collection.getItem(item.parentKey);
    if (!item || item.type !== "item")
      return null;
    return item.key;
  }
  /**
  * Toggles whether the given key is selected.
  */
  toggleSelection(key) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single" && !this.isSelected(key)) {
      this.replaceSelection(key);
      return;
    }
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return;
    let keys2 = new $e40ea825a81a3709$export$52baac22726c72bf(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
    if (keys2.has(mappedKey))
      keys2.delete(mappedKey);
    else if (this.canSelectItem(mappedKey)) {
      keys2.add(mappedKey);
      keys2.anchorKey = mappedKey;
      keys2.currentKey = mappedKey;
    }
    if (this.disallowEmptySelection && keys2.size === 0)
      return;
    this.state.setSelectedKeys(keys2);
  }
  /**
  * Replaces the selection with only the given key.
  */
  replaceSelection(key) {
    if (this.selectionMode === "none")
      return;
    let mappedKey = this.getKey(key);
    if (mappedKey == null)
      return;
    let selection = this.canSelectItem(mappedKey) ? new $e40ea825a81a3709$export$52baac22726c72bf([
      mappedKey
    ], mappedKey, mappedKey) : new $e40ea825a81a3709$export$52baac22726c72bf();
    this.state.setSelectedKeys(selection);
  }
  /**
  * Replaces the selection with the given keys.
  */
  setSelectedKeys(keys2) {
    if (this.selectionMode === "none")
      return;
    let selection = new $e40ea825a81a3709$export$52baac22726c72bf();
    for (let key of keys2) {
      let mappedKey = this.getKey(key);
      if (mappedKey != null) {
        selection.add(mappedKey);
        if (this.selectionMode === "single")
          break;
      }
    }
    this.state.setSelectedKeys(selection);
  }
  getSelectAllKeys() {
    let keys2 = [];
    let addKeys = (key) => {
      while (key != null) {
        if (this.canSelectItem(key)) {
          var _getFirstItem;
          let item = this.collection.getItem(key);
          if ((item === null || item === void 0 ? void 0 : item.type) === "item")
            keys2.push(key);
          var _getFirstItem_key;
          if ((item === null || item === void 0 ? void 0 : item.hasChildNodes) && (this.allowsCellSelection || item.type !== "item"))
            addKeys((_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null);
        }
        key = this.collection.getKeyAfter(key);
      }
    };
    addKeys(this.collection.getFirstKey());
    return keys2;
  }
  /**
  * Selects all items in the collection.
  */
  selectAll() {
    if (!this.isSelectAll && this.selectionMode === "multiple")
      this.state.setSelectedKeys("all");
  }
  /**
  * Removes all keys from the selection.
  */
  clearSelection() {
    if (!this.disallowEmptySelection && (this.state.selectedKeys === "all" || this.state.selectedKeys.size > 0))
      this.state.setSelectedKeys(new $e40ea825a81a3709$export$52baac22726c72bf());
  }
  /**
  * Toggles between select all and an empty selection.
  */
  toggleSelectAll() {
    if (this.isSelectAll)
      this.clearSelection();
    else
      this.selectAll();
  }
  select(key, e2) {
    if (this.selectionMode === "none")
      return;
    if (this.selectionMode === "single") {
      if (this.isSelected(key) && !this.disallowEmptySelection)
        this.toggleSelection(key);
      else
        this.replaceSelection(key);
    } else if (this.selectionBehavior === "toggle" || e2 && (e2.pointerType === "touch" || e2.pointerType === "virtual"))
      this.toggleSelection(key);
    else
      this.replaceSelection(key);
  }
  /**
  * Returns whether the current selection is equal to the given selection.
  */
  isSelectionEqual(selection) {
    if (selection === this.state.selectedKeys)
      return true;
    let selectedKeys = this.selectedKeys;
    if (selection.size !== selectedKeys.size)
      return false;
    for (let key of selection) {
      if (!selectedKeys.has(key))
        return false;
    }
    for (let key of selectedKeys) {
      if (!selection.has(key))
        return false;
    }
    return true;
  }
  canSelectItem(key) {
    var _item_props;
    if (this.state.selectionMode === "none" || this.state.disabledKeys.has(key))
      return false;
    let item = this.collection.getItem(key);
    if (!item || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || item.type === "cell" && !this.allowsCellSelection)
      return false;
    return true;
  }
  isDisabled(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return this.state.disabledBehavior === "all" && (this.state.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled));
  }
  isLink(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.href);
  }
  getItemProps(key) {
    var _this_collection_getItem;
    return (_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : _this_collection_getItem.props;
  }
  withCollection(collection) {
    return new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, this.state, {
      allowsCellSelection: this.allowsCellSelection,
      layoutDelegate: this.layoutDelegate || void 0
    });
  }
  constructor(collection, state, options) {
    this.collection = collection;
    this.state = state;
    var _options_allowsCellSelection;
    this.allowsCellSelection = (_options_allowsCellSelection = options === null || options === void 0 ? void 0 : options.allowsCellSelection) !== null && _options_allowsCellSelection !== void 0 ? _options_allowsCellSelection : false;
    this._isSelectAll = null;
    this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
  }
}
function $875d6693e12af071$export$728d6ba534403756(props) {
  let { onExpandedChange } = props;
  let [expandedKeys, setExpandedKeys] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.expandedKeys ? new Set(props.expandedKeys) : void 0, props.defaultExpandedKeys ? new Set(props.defaultExpandedKeys) : /* @__PURE__ */ new Set(), onExpandedChange);
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let tree = $7613b1592d41b092$export$6cd28814d92fa9c9(props, reactExports.useCallback((nodes) => new $05ca4cd7c4a5a999$export$863faf230ee2118a(nodes, {
    expandedKeys
  }), [
    expandedKeys
  ]), null);
  reactExports.useEffect(() => {
    if (selectionState.focusedKey != null && !tree.getItem(selectionState.focusedKey))
      selectionState.setFocusedKey(null);
  }, [
    tree,
    selectionState.focusedKey
  ]);
  let onToggle = (key) => {
    setExpandedKeys($875d6693e12af071$var$toggleKey(expandedKeys, key));
  };
  return {
    collection: tree,
    expandedKeys,
    disabledKeys,
    toggleKey: onToggle,
    setExpandedKeys,
    selectionManager: new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(tree, selectionState)
  };
}
function $875d6693e12af071$var$toggleKey(set2, key) {
  let res = new Set(set2);
  if (res.has(key))
    res.delete(key);
  else
    res.add(key);
  return res;
}
function useAccordion(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    ref,
    as: as2,
    className,
    items,
    variant,
    motionProps,
    expandedKeys,
    disabledKeys,
    selectedKeys,
    children: childrenProp,
    defaultExpandedKeys,
    selectionMode = "single",
    selectionBehavior = "toggle",
    keepContentMounted = false,
    disallowEmptySelection,
    defaultSelectedKeys,
    onExpandedChange,
    onSelectionChange,
    dividerProps = {},
    isCompact = false,
    isDisabled = false,
    showDivider = true,
    hideIndicator = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    disableIndicatorAnimation = false,
    itemClasses,
    ...otherProps
  } = props;
  const [focusedKey, setFocusedKey] = reactExports.useState(null);
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const classNames2 = reactExports.useMemo(
    () => accordion({
      variant,
      className
    }),
    [variant, className]
  );
  const children = reactExports.useMemo(() => {
    let treeChildren = [];
    React$6.Children.map(childrenProp, (child) => {
      var _a22;
      if (React$6.isValidElement(child) && typeof ((_a22 = child.props) == null ? void 0 : _a22.children) !== "string") {
        const clonedChild = React$6.cloneElement(child, {
          // @ts-ignore
          hasChildItems: false
        });
        treeChildren.push(clonedChild);
      } else {
        treeChildren.push(child);
      }
    });
    return treeChildren;
  }, [childrenProp]);
  const commonProps2 = {
    children,
    items
  };
  const expandableProps = {
    expandedKeys,
    defaultExpandedKeys,
    onExpandedChange
  };
  const treeProps = {
    disabledKeys,
    selectedKeys,
    selectionMode,
    selectionBehavior,
    disallowEmptySelection,
    defaultSelectedKeys: defaultSelectedKeys != null ? defaultSelectedKeys : defaultExpandedKeys,
    onSelectionChange,
    ...commonProps2,
    ...expandableProps
  };
  const state = $875d6693e12af071$export$728d6ba534403756(treeProps);
  state.selectionManager.setFocusedKey = (key) => {
    setFocusedKey(key);
  };
  const { accordionProps } = useReactAriaAccordion(
    {
      ...commonProps2,
      ...expandableProps
    },
    state,
    domRef
  );
  const values = reactExports.useMemo(
    () => ({
      state,
      focusedKey,
      motionProps,
      isCompact,
      isDisabled,
      hideIndicator,
      disableAnimation,
      keepContentMounted,
      disableIndicatorAnimation
    }),
    [
      focusedKey,
      isCompact,
      isDisabled,
      hideIndicator,
      selectedKeys,
      disableAnimation,
      keepContentMounted,
      state == null ? void 0 : state.expandedKeys.values,
      disableIndicatorAnimation,
      state.expandedKeys.size,
      state.disabledKeys.size,
      motionProps
    ]
  );
  const getBaseProps = reactExports.useCallback((props2 = {}) => {
    return {
      ref: domRef,
      className: classNames2,
      "data-orientation": "vertical",
      ...mergeProps$3(
        accordionProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      )
    };
  }, []);
  const handleFocusChanged = reactExports.useCallback((isFocused, key) => {
    isFocused && setFocusedKey(key);
  }, []);
  return {
    Component: Component2,
    values,
    state,
    focusedKey,
    getBaseProps,
    isSplitted: variant === "splitted",
    classNames: classNames2,
    showDivider,
    dividerProps,
    disableAnimation,
    handleFocusChanged,
    itemClasses
  };
}
function useSeparator(props) {
  let domProps = filterDOMProps(props, {
    enabled: typeof props.elementType === "string"
  });
  let ariaOrientation;
  if (props.orientation === "vertical") {
    ariaOrientation = "vertical";
  }
  if (props.elementType !== "hr") {
    return {
      separatorProps: {
        ...domProps,
        role: "separator",
        "aria-orientation": ariaOrientation
      }
    };
  }
  return { separatorProps: domProps };
}
function useDivider(props) {
  const { as: as2, className, orientation, ...otherProps } = props;
  let Component2 = as2 || "hr";
  if (Component2 === "hr" && orientation === "vertical") {
    Component2 = "div";
  }
  const { separatorProps } = useSeparator({
    elementType: typeof Component2 === "string" ? Component2 : "hr",
    orientation
  });
  const styles2 = reactExports.useMemo(
    () => divider({
      orientation,
      className
    }),
    [orientation, className]
  );
  const getDividerProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: styles2,
      role: "separator",
      "data-orientation": orientation,
      ...separatorProps,
      ...otherProps,
      ...props2
    }),
    [styles2, orientation, separatorProps, otherProps]
  );
  return { Component: Component2, getDividerProps };
}
var Divider$1 = forwardRef((props, ref) => {
  const { Component: Component2, getDividerProps } = useDivider({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getDividerProps() });
});
Divider$1.displayName = "HeroUI.Divider";
var divider_default = Divider$1;
var AccordionGroup = forwardRef((props, ref) => {
  const {
    Component: Component2,
    values,
    state,
    isSplitted,
    showDivider,
    getBaseProps,
    disableAnimation,
    handleFocusChanged: handleFocusChangedProps,
    itemClasses,
    dividerProps
  } = useAccordion({
    ...props,
    ref
  });
  const handleFocusChanged = reactExports.useCallback(
    (isFocused, key) => handleFocusChangedProps(isFocused, key),
    [handleFocusChangedProps]
  );
  const content2 = reactExports.useMemo(() => {
    return [...state.collection].map((item, index2) => {
      const classNames2 = { ...itemClasses, ...item.props.classNames || {} };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          accordion_item_default,
          {
            item,
            variant: props.variant,
            onFocusChange: handleFocusChanged,
            ...values,
            ...item.props,
            classNames: classNames2
          }
        ),
        !item.props.hidden && !isSplitted && showDivider && index2 < state.collection.size - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { ...dividerProps })
      ] }, item.key);
    });
  }, [values, itemClasses, handleFocusChanged, isSplitted, showDivider, state.collection]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children: disableAnimation ? content2 : /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutGroup, { children: content2 }) });
});
AccordionGroup.displayName = "HeroUI.Accordion";
var accordion_default = AccordionGroup;
function $c1d7fb2ec91bae71$var$Item(props) {
  return null;
}
$c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
  let { childItems, title, children } = props;
  let rendered = props.title || props.children;
  let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
  if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning) && false)
    ;
  yield {
    type: "item",
    props,
    rendered,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
    *childNodes() {
      if (childItems)
        for (let child of childItems)
          yield {
            type: "item",
            value: child
          };
      else if (title) {
        let items = [];
        React$6.Children.forEach(children, (child) => {
          items.push({
            type: "item",
            element: child
          });
        });
        yield* items;
      }
    }
  };
};
function $c1d7fb2ec91bae71$var$hasChildItems(props) {
  if (props.hasChildItems != null)
    return props.hasChildItems;
  if (props.childItems)
    return true;
  if (props.title && React$6.Children.count(props.children) > 0)
    return true;
  return false;
}
let $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;
var getTransformOrigins = (placement) => {
  const origins = {
    top: {
      originY: 1
    },
    bottom: {
      originY: 0
    },
    left: {
      originX: 1
    },
    right: {
      originX: 0
    },
    "top-start": {
      originX: 0,
      originY: 1
    },
    "top-end": {
      originX: 1,
      originY: 1
    },
    "bottom-start": {
      originX: 0,
      originY: 0
    },
    "bottom-end": {
      originX: 1,
      originY: 0
    },
    "right-start": {
      originX: 0,
      originY: 0
    },
    "right-end": {
      originX: 0,
      originY: 1
    },
    "left-start": {
      originX: 1,
      originY: 0
    },
    "left-end": {
      originX: 1,
      originY: 1
    }
  };
  return (origins == null ? void 0 : origins[placement]) || {};
};
var toReactAriaPlacement = (placement) => {
  const mapPositions = {
    top: "top",
    bottom: "bottom",
    left: "left",
    right: "right",
    "top-start": "top start",
    "top-end": "top end",
    "bottom-start": "bottom start",
    "bottom-end": "bottom end",
    "left-start": "left top",
    "left-end": "left bottom",
    "right-start": "right top",
    "right-end": "right bottom"
  };
  return mapPositions[placement];
};
var getShouldUseAxisPlacement = (axisPlacement, overlayPlacement) => {
  if (overlayPlacement.includes("-")) {
    const [position2] = overlayPlacement.split("-");
    if (position2.includes(axisPlacement)) {
      return false;
    }
  }
  return true;
};
var getArrowPlacement = (dynamicPlacement, placement) => {
  if (placement.includes("-")) {
    const [, position2] = placement.split("-");
    return `${dynamicPlacement}-${position2}`;
  }
  return dynamicPlacement;
};
var refCountMap = /* @__PURE__ */ new WeakMap();
var observerStack = [];
function ariaHideOutside(targets, root2 = document.body) {
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let walk = (root22) => {
    for (let element2 of root22.querySelectorAll(
      "[data-live-announcer], [data-react-aria-top-layer]"
    )) {
      visibleNodes.add(element2);
    }
    let acceptNode = (node2) => {
      if (visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row") {
        return NodeFilter.FILTER_REJECT;
      }
      for (let target of visibleNodes) {
        if (node2.contains(target)) {
          return NodeFilter.FILTER_SKIP;
        }
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root22, NodeFilter.SHOW_ELEMENT, { acceptNode });
    let acceptRoot = acceptNode(root22);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT) {
      hide(root22);
    }
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _a2;
    let refCount = (_a2 = refCountMap.get(node2)) != null ? _a2 : 0;
    if (node2.getAttribute("aria-hidden") === "true" && refCount === 0) {
      return;
    }
    if (refCount === 0) {
      node2.setAttribute("aria-hidden", "true");
    }
    hiddenNodes.add(node2);
    refCountMap.set(node2, refCount + 1);
  };
  if (observerStack.length) {
    observerStack[observerStack.length - 1].disconnect();
  }
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList" || change.addedNodes.length === 0) {
        continue;
      }
      if (![...visibleNodes, ...hiddenNodes].some((node2) => node2.contains(change.target))) {
        for (let node2 of change.removedNodes) {
          if (node2 instanceof Element) {
            visibleNodes.delete(node2);
            hiddenNodes.delete(node2);
          }
        }
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true")) {
            visibleNodes.add(node2);
          } else if (node2 instanceof Element) {
            walk(node2);
          }
        }
      }
    }
  });
  observer.observe(root2, { childList: true, subtree: true });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, { childList: true, subtree: true });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  observerStack.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = refCountMap.get(node2);
      if (count == null) {
        continue;
      }
      if (count === 1) {
        node2.removeAttribute("aria-hidden");
        refCountMap.delete(node2);
      } else {
        refCountMap.set(node2, count - 1);
      }
    }
    if (observerWrapper === observerStack[observerStack.length - 1]) {
      observerStack.pop();
      if (observerStack.length) {
        observerStack[observerStack.length - 1].observe();
      }
    } else {
      observerStack.splice(observerStack.indexOf(observerWrapper), 1);
    }
  };
}
function keepVisible(element2) {
  let observer = observerStack[observerStack.length - 1];
  if (observer && !observer.visibleNodes.has(element2)) {
    observer.visibleNodes.add(element2);
    return () => {
      observer.visibleNodes.delete(element2);
    };
  }
}
var AccordionItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var accordion_item_base_default = AccordionItemBase;
var useSafeLayoutEffect = Boolean(globalThis == null ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : reactExports.useEffect;
function useImage$2(props = {}) {
  const {
    onLoad,
    onError,
    ignoreFallback,
    src,
    crossOrigin,
    srcSet,
    sizes,
    loading,
    shouldBypassImageLoad = false
  } = props;
  const isHydrated = useIsHydrated();
  const imageRef = reactExports.useRef(isHydrated ? new Image() : null);
  const [status, setStatus] = reactExports.useState("pending");
  reactExports.useEffect(() => {
    if (!imageRef.current)
      return;
    imageRef.current.onload = (event) => {
      flush();
      setStatus("loaded");
      onLoad == null ? void 0 : onLoad(event);
    };
    imageRef.current.onerror = (error2) => {
      flush();
      setStatus("failed");
      onError == null ? void 0 : onError(error2);
    };
  }, [imageRef.current]);
  const flush = () => {
    if (imageRef.current) {
      imageRef.current.onload = null;
      imageRef.current.onerror = null;
      imageRef.current = null;
    }
  };
  const load = reactExports.useCallback(() => {
    if (!src)
      return "pending";
    if (ignoreFallback || shouldBypassImageLoad)
      return "loaded";
    const img = new Image();
    img.src = src;
    if (crossOrigin)
      img.crossOrigin = crossOrigin;
    if (srcSet)
      img.srcset = srcSet;
    if (sizes)
      img.sizes = sizes;
    if (loading)
      img.loading = loading;
    imageRef.current = img;
    if (img.complete && img.naturalWidth) {
      return "loaded";
    }
    return "loading";
  }, [src, crossOrigin, srcSet, sizes, onLoad, onError, loading, shouldBypassImageLoad]);
  useSafeLayoutEffect(() => {
    if (isHydrated) {
      setStatus(load());
    }
  }, [isHydrated, load]);
  return ignoreFallback ? "loaded" : status;
}
function useBadge(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const [props, variantProps2] = mapPropsVariants(originalProps, badge.variantKeys);
  const { as: as2, children, className, content: content2, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "span";
  const isOneChar = reactExports.useMemo(
    () => {
      var _a22;
      return ((_a22 = String(content2)) == null ? void 0 : _a22.length) === 1 || (originalProps == null ? void 0 : originalProps.isOneChar);
    },
    [content2, originalProps == null ? void 0 : originalProps.isOneChar]
  );
  const isDot = reactExports.useMemo(() => {
    var _a22;
    return ((_a22 = String(content2)) == null ? void 0 : _a22.length) === 0;
  }, [content2]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.badge, className);
  const slots = reactExports.useMemo(
    () => badge({
      ...variantProps2,
      showOutline: !!(originalProps == null ? void 0 : originalProps.disableOutline) ? !(originalProps == null ? void 0 : originalProps.disableOutline) : originalProps == null ? void 0 : originalProps.showOutline,
      isOneChar,
      isDot
    }),
    [objectToDeps(variantProps2), isOneChar, isDot]
  );
  const getBadgeProps = () => {
    return {
      className: slots.badge({ class: baseStyles }),
      "data-invisible": originalProps.isInvisible,
      ...otherProps
    };
  };
  return {
    Component: Component2,
    children,
    content: content2,
    slots,
    classNames: classNames2,
    disableAnimation,
    isInvisible: originalProps == null ? void 0 : originalProps.isInvisible,
    getBadgeProps
  };
}
var Badge$1 = forwardRef((props, ref) => {
  const { Component: Component2, children, content: content2, slots, classNames: classNames2, getBadgeProps } = useBadge({
    ...props
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.base({ class: classNames2 == null ? void 0 : classNames2.base }), children: [
    children,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getBadgeProps(), children: content2 })
  ] });
});
Badge$1.displayName = "HeroUI.Badge";
var badge_default = Badge$1;
function useButtonGroup(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, buttonGroup.variantKeys);
  const {
    ref,
    as: as2,
    children,
    color: color2 = "default",
    size: size2 = "md",
    variant = "solid",
    radius,
    isDisabled = false,
    isIconOnly = false,
    disableRipple = (_a2 = globalContext == null ? void 0 : globalContext.disableRipple) != null ? _a2 : false,
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const classNames2 = reactExports.useMemo(
    () => buttonGroup({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      variant,
      radius,
      isIconOnly,
      isDisabled,
      disableAnimation,
      disableRipple,
      fullWidth: !!(originalProps == null ? void 0 : originalProps.fullWidth)
    }),
    [
      size2,
      color2,
      variant,
      radius,
      isDisabled,
      isIconOnly,
      disableAnimation,
      disableRipple,
      originalProps == null ? void 0 : originalProps.fullWidth
    ]
  );
  const getButtonGroupProps = reactExports.useCallback(
    () => ({
      role: "group",
      ...otherProps
    }),
    [otherProps]
  );
  return {
    Component: Component2,
    children,
    domRef,
    context,
    classNames: classNames2,
    getButtonGroupProps
  };
}
var [ButtonGroupProvider$1, useButtonGroupContext$1] = createContext2({
  name: "ButtonGroupContext",
  strict: false
});
var ButtonGroup = forwardRef((props, ref) => {
  const { Component: Component2, domRef, context, children, classNames: classNames2, getButtonGroupProps } = useButtonGroup({
    ...props,
    ref
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupProvider$1, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: classNames2, ...getButtonGroupProps(), children }) });
});
ButtonGroup.displayName = "HeroUI.ButtonGroup";
var button_group_default = ButtonGroup;
let $bdb11010cef70236$export$d41a04c74483c6ef$8 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$8.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$8(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$8.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$8.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$8(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$8(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$8(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$8(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$3 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$3 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$3 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$3 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$3(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$3.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$3.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$3.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$3.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3;
const $8ae05eaa5c114e9c$var$useEarlyEffect$3 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 = React$6["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$3 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$3(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$3(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$7 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$7.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$7(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$7.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$7.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$7(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$3 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$3 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$3(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$2(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$2(node2) {
  return $431fbd86ca7dc216$var$isNode$2(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$2(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$2(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29$2(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$7(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$7(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$7(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$4(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$4())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$4(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$4(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$4 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$4() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$4 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$4 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$4 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$4;
}
function $7215afc6de606d6b$var$getScrollableElements$4(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$4(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$5(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$5(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$5(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$5 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$2 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testPlatform$5(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$5() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$2 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$2() || $c87311424ea30a05$export$7bef049ce92e4224$4();
});
const $c87311424ea30a05$export$78551043582a6a98$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$4();
});
const $c87311424ea30a05$export$6446a186d09e379e$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$3 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$4 = $c87311424ea30a05$var$cached$5(function() {
  return $c87311424ea30a05$var$testUserAgent$5(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$4() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$5())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$4() && $c87311424ea30a05$export$9ac100e40613ea10$5() && !$c87311424ea30a05$export$7bef049ce92e4224$4() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$4(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement$2 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$2 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$2() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$2.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$2.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$2.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$2.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$2.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$2)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$2.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$2();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$2);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$2() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$2)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$2.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$2(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$2();
    if ($bbed8b41f857bcc0$var$transitionsByElement$2.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$2.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$2() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$2(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$4(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$3(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$3() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$2(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$3() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$2 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$2(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$2(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$2)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$2(element2) && $7d2416ea0959daaa$var$isAttributeVisible$2(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$2 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$2 = $b4b717babfbb907b$var$focusableElements$2.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$2.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed$2(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$2) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$2(element2) && !$b4b717babfbb907b$var$isInert$2(element2);
}
function $b4b717babfbb907b$var$isInert$2(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$b(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$a(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$9(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$2(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$3(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$4(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$4(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$9 = "default";
let $14c0b72509d70225$var$savedUserSelect$9 = "";
let $14c0b72509d70225$var$modifiedElementMap$9 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$9(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$2()) {
    if ($14c0b72509d70225$var$state$9 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$3(target);
      $14c0b72509d70225$var$savedUserSelect$9 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$9 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$9.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$9(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$2()) {
    if ($14c0b72509d70225$var$state$9 !== "disabled")
      return;
    $14c0b72509d70225$var$state$9 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$2(() => {
        if ($14c0b72509d70225$var$state$9 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$3(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$9 || "";
          $14c0b72509d70225$var$savedUserSelect$9 = "";
          $14c0b72509d70225$var$state$9 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$9.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$9.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$9.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$9 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$9.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$9(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$9);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$7(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$2(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$9 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$9 = class $f6c31cce2adf654f$var$PressEvent3 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$9, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$9 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$9 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$9(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$9(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$2();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$9("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$9("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$9(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$3((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$a(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$b(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$9(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9($d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$9(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$2(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$9(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$7(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$5())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$4.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$3(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$9(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$9(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9($d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$2(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$9(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$2(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$9]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$9] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$4(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$2(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$9(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$3(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$9(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$9(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$2(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$4(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$2(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$2(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$3(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$9))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$9;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$9((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$7(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$9]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$9(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$9(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$9(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$3(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$9(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$9(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$9(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$9(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$9(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$9(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$9(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$9 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$9(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$9.has(target.type);
}
function useAriaButton$1(props, ref) {
  let {
    elementType = "button",
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    // @ts-ignore - undocumented
    preventFocusOnPress,
    // @ts-ignore - undocumented
    allowFocusWhenDisabled,
    onClick,
    href,
    target,
    rel,
    type: type4 = "button",
    allowTextSelectionOnPress
  } = props;
  let additionalProps;
  if (elementType === "button") {
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  } else {
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$9({
    onClick,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    onPress,
    isDisabled,
    preventFocusOnPress,
    allowTextSelectionOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  if (allowFocusWhenDisabled) {
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  }
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$8(
    focusableProps,
    pressProps,
    $65484d02dcb7eb3e$export$457c3d6518dd4c6f$3(props, { labelable: true })
  );
  return {
    isPressed,
    // Used to indicate press state for visual
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$8(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = false;
let $6179b936705e76d3$var$hoverCount$f = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$f() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$f(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$f();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$f() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$f);
  $6179b936705e76d3$var$hoverCount$f++;
  return () => {
    $6179b936705e76d3$var$hoverCount$f--;
    if ($6179b936705e76d3$var$hoverCount$f > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$f);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$f(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$f, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$f && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var domAnimation$6 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Ripple$1 = (props) => {
  const { ripples = [], motionProps, color: color2 = "currentColor", style: style2, onClear } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ripples.map((ripple) => {
    const duration2 = clamp$3(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$6, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.span,
      {
        animate: { transform: "scale(2)", opacity: 0 },
        className: "heroui-ripple",
        exit: { opacity: 0 },
        initial: { transform: "scale(0)", opacity: 0.35 },
        style: {
          position: "absolute",
          backgroundColor: color2,
          borderRadius: "100%",
          transformOrigin: "center",
          pointerEvents: "none",
          overflow: "hidden",
          inset: 0,
          zIndex: 0,
          top: ripple.y,
          left: ripple.x,
          width: `${ripple.size}px`,
          height: `${ripple.size}px`,
          ...style2
        },
        transition: { duration: duration2 },
        onAnimationComplete: () => {
          onClear(ripple.key);
        },
        ...motionProps
      }
    ) }) }, ripple.key);
  }) });
};
Ripple$1.displayName = "HeroUI.Ripple";
var ripple_default$1 = Ripple$1;
function useRipple$1(props = {}) {
  const [ripples, setRipples] = reactExports.useState([]);
  const onPress = reactExports.useCallback((event) => {
    const trigger = event.target;
    const size2 = Math.max(trigger.clientWidth, trigger.clientHeight);
    setRipples((prevRipples) => [
      ...prevRipples,
      {
        key: getUniqueID(prevRipples.length.toString()),
        size: size2,
        x: event.x - size2 / 2,
        y: event.y - size2 / 2
      }
    ]);
  }, []);
  const onClear = reactExports.useCallback((key) => {
    setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
  }, []);
  return { ripples, onClear, onPress, ...props };
}
function useButton$1(props) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const groupContext = useButtonGroupContext$1();
  const globalContext = useProviderContext();
  const isInGroup = !!groupContext;
  const {
    ref,
    as: as2,
    children,
    startContent: startContentProp,
    endContent: endContentProp,
    autoFocus,
    className,
    spinner: spinner2,
    isLoading = false,
    disableRipple: disableRippleProp = false,
    fullWidth = (_a2 = groupContext == null ? void 0 : groupContext.fullWidth) != null ? _a2 : false,
    radius = groupContext == null ? void 0 : groupContext.radius,
    size: size2 = (_b2 = groupContext == null ? void 0 : groupContext.size) != null ? _b2 : "md",
    color: color2 = (_c2 = groupContext == null ? void 0 : groupContext.color) != null ? _c2 : "default",
    variant = (_d = groupContext == null ? void 0 : groupContext.variant) != null ? _d : "solid",
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    isDisabled: isDisabledProp = (_g = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _g : false,
    isIconOnly = (_h = groupContext == null ? void 0 : groupContext.isIconOnly) != null ? _h : false,
    spinnerPlacement = "start",
    onPress,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableRipple = (_i = disableRippleProp || (globalContext == null ? void 0 : globalContext.disableRipple)) != null ? _i : disableAnimation;
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const isDisabled = isDisabledProp || isLoading;
  const styles2 = reactExports.useMemo(
    () => button({
      size: size2,
      color: color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      disableAnimation,
      isIconOnly,
      className
    }),
    [
      size2,
      color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      isIconOnly,
      disableAnimation,
      className
    ]
  );
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple$1();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || isDisabled || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, isDisabled, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton$1(
    {
      elementType: as2,
      isDisabled,
      onPress: chain(onPress, handlePress),
      onClick,
      ...otherProps
    },
    domRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$f({ isDisabled });
  const getButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-loading": dataAttr(isLoading),
      ...mergeProps$3(
        ariaButtonProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      ),
      className: styles2
    }),
    [
      isLoading,
      isDisabled,
      isFocused,
      isPressed,
      shouldFilterDOMProps,
      isFocusVisible,
      isHovered,
      ariaButtonProps,
      focusProps,
      hoverProps,
      otherProps,
      styles2
    ]
  );
  const getIconClone = (icon) => reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, {
    // @ts-ignore
    "aria-hidden": true,
    focusable: false
  }) : null;
  const startContent = getIconClone(startContentProp);
  const endContent = getIconClone(endContentProp);
  const spinnerSize = reactExports.useMemo(() => {
    const buttonSpinnerSizeMap = {
      sm: "sm",
      md: "sm",
      lg: "md"
    };
    return buttonSpinnerSizeMap[size2];
  }, [size2]);
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    Component: Component2,
    children,
    domRef,
    spinner: spinner2,
    styles: styles2,
    startContent,
    endContent,
    isLoading,
    spinnerPlacement,
    spinnerSize,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  };
}
function useSpinner(originalProps) {
  var _a2, _b2;
  const [props, variantProps2] = mapPropsVariants(originalProps, spinner.variantKeys);
  const globalContext = useProviderContext();
  const variant = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.variant) != null ? _a2 : globalContext == null ? void 0 : globalContext.spinnerVariant) != null ? _b2 : "default";
  const { children, className, classNames: classNames2, label: labelProp, ...otherProps } = props;
  const slots = reactExports.useMemo(() => spinner({ ...variantProps2 }), [objectToDeps(variantProps2)]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const label = labelProp || children;
  const ariaLabel = reactExports.useMemo(() => {
    if (label && typeof label === "string") {
      return label;
    }
    return !otherProps["aria-label"] ? "Loading" : "";
  }, [children, label, otherProps["aria-label"]]);
  const getSpinnerProps = reactExports.useCallback(
    () => ({
      "aria-label": ariaLabel,
      className: slots.base({
        class: baseStyles
      }),
      ...otherProps
    }),
    [ariaLabel, slots, baseStyles, otherProps]
  );
  return { label, slots, classNames: classNames2, variant, getSpinnerProps };
}
var Spinner = forwardRef((props, ref) => {
  const { slots, classNames: classNames2, label, variant, getSpinnerProps } = useSpinner({ ...props });
  if (variant === "wave" || variant === "dots") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [...new Array(3)].map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        "i",
        {
          className: slots.dots({ class: classNames2 == null ? void 0 : classNames2.dots }),
          style: {
            "--dot-index": index2
          }
        },
        `dot-${index2}`
      )) }),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  if (variant === "simple") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "svg",
        {
          className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
          fill: "none",
          viewBox: "0 0 24 24",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "circle",
              {
                className: slots.circle1({ class: classNames2 == null ? void 0 : classNames2.circle1 }),
                cx: "12",
                cy: "12",
                r: "10",
                stroke: "currentColor",
                strokeWidth: "4"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "path",
              {
                className: slots.circle2({ class: classNames2 == null ? void 0 : classNames2.circle2 }),
                d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
                fill: "currentColor"
              }
            )
          ]
        }
      ),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  if (variant === "spinner") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [...new Array(12)].map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        "i",
        {
          className: slots.spinnerBars({ class: classNames2 == null ? void 0 : classNames2.spinnerBars }),
          style: {
            "--bar-index": index2
          }
        },
        `star-${index2}`
      )) }),
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref, ...getSpinnerProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: slots.circle1({ class: classNames2 == null ? void 0 : classNames2.circle1 }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: slots.circle2({ class: classNames2 == null ? void 0 : classNames2.circle2 }) })
    ] }),
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }), children: label })
  ] });
});
Spinner.displayName = "HeroUI.Spinner";
var spinner_default = Spinner;
var Button$2 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    children,
    spinnerSize,
    spinner: spinner2 = /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "current", size: spinnerSize }),
    spinnerPlacement,
    startContent,
    endContent,
    isLoading,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  } = useButton$1({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getButtonProps(), children: [
    startContent,
    isLoading && spinnerPlacement === "start" && spinner2,
    isLoading && isIconOnly ? null : children,
    isLoading && spinnerPlacement === "end" && spinner2,
    endContent,
    !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default$1, { ...getRippleProps() })
  ] });
});
Button$2.displayName = "HeroUI.Button";
var button_default$1 = Button$2;
var [CardProvider, useCardContext] = createContext2({
  name: "CardContext",
  strict: true,
  errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
});
var CardBody = forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { slots, classNames: classNames2 } = useCardContext();
  const bodyStyles = clsx$5(classNames2 == null ? void 0 : classNames2.body, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: (_a2 = slots.body) == null ? void 0 : _a2.call(slots, { class: bodyStyles }), ...otherProps, children });
});
CardBody.displayName = "HeroUI.CardBody";
var card_body_default = CardBody;
var CardHeader = forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { slots, classNames: classNames2 } = useCardContext();
  const headerStyles = clsx$5(classNames2 == null ? void 0 : classNames2.header, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, className: (_a2 = slots.header) == null ? void 0 : _a2.call(slots, { class: headerStyles }), ...otherProps, children });
});
CardHeader.displayName = "HeroUI.CardHeader";
var card_header_default = CardHeader;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = false;
let $6179b936705e76d3$var$hoverCount$e = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$e() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$e(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$e();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$e() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$e);
  $6179b936705e76d3$var$hoverCount$e++;
  return () => {
    $6179b936705e76d3$var$hoverCount$e--;
    if ($6179b936705e76d3$var$hoverCount$e > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$e);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$e(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$e, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$e && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useCard(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, card.variantKeys);
  const {
    ref,
    as: as2,
    children,
    onClick,
    onPress,
    autoFocus,
    className,
    classNames: classNames2,
    allowTextSelectionOnPress = true,
    ...otherProps
  } = props;
  const domRef = useDOMRef(ref);
  const Component2 = as2 || (originalProps.isPressable ? "button" : "div");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const disableRipple = (_d = (_c2 = originalProps.disableRipple) != null ? _c2 : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = useRipple$1();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps, isPressed } = useAriaButton$1(
    {
      onPress: chain(onPress, handlePress),
      elementType: as2,
      isDisabled: !originalProps.isPressable,
      onClick,
      allowTextSelectionOnPress,
      ...otherProps
    },
    domRef
  );
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$e({
    isDisabled: !originalProps.isHoverable,
    ...otherProps
  });
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const slots = reactExports.useMemo(
    () => card({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const context = reactExports.useMemo(
    () => ({
      slots,
      classNames: classNames2,
      disableAnimation,
      isDisabled: originalProps.isDisabled,
      isFooterBlurred: originalProps.isFooterBlurred,
      fullWidth: originalProps.fullWidth
    }),
    [
      slots,
      classNames2,
      originalProps.isDisabled,
      originalProps.isFooterBlurred,
      disableAnimation,
      originalProps.fullWidth
    ]
  );
  const getCardProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: domRef,
        className: slots.base({ class: baseStyles }),
        tabIndex: originalProps.isPressable ? 0 : -1,
        "data-hover": dataAttr(isHovered),
        "data-pressed": dataAttr(isPressed),
        "data-focus": dataAttr(isFocused),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-disabled": dataAttr(originalProps.isDisabled),
        ...mergeProps$3(
          originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
          originalProps.isHoverable ? hoverProps : {},
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          filterDOMProps(props2)
        )
      };
    },
    [
      domRef,
      slots,
      baseStyles,
      shouldFilterDOMProps,
      originalProps.isPressable,
      originalProps.isHoverable,
      originalProps.isDisabled,
      isHovered,
      isPressed,
      isFocusVisible,
      buttonProps,
      focusProps,
      hoverProps,
      otherProps
    ]
  );
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    context,
    domRef,
    Component: Component2,
    classNames: classNames2,
    children,
    isHovered,
    isPressed,
    disableAnimation,
    isPressable: originalProps.isPressable,
    isHoverable: originalProps.isHoverable,
    disableRipple,
    handlePress,
    isFocusVisible,
    getCardProps,
    getRippleProps
  };
}
var Card = forwardRef((props, ref) => {
  const {
    children,
    context,
    Component: Component2,
    isPressable,
    disableAnimation,
    disableRipple,
    getCardProps,
    getRippleProps
  } = useCard({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getCardProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(CardProvider, { value: context, children }),
    isPressable && !disableAnimation && !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default$1, { ...getRippleProps() })
  ] });
});
Card.displayName = "HeroUI.Card";
var card_default = Card;
function $8a9cb279dc87e130$export$525bc4921d56d4a$a(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$9(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$8(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$8 = "default";
let $14c0b72509d70225$var$savedUserSelect$8 = "";
let $14c0b72509d70225$var$modifiedElementMap$8 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$8(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$8 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$8 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$8 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$8.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$8(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$8 !== "disabled")
      return;
    $14c0b72509d70225$var$state$8 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$8 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$8 || "";
          $14c0b72509d70225$var$savedUserSelect$8 = "";
          $14c0b72509d70225$var$state$8 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$8.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$8.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$8.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$8 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$8.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$8(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$8);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$8 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$8 = class $f6c31cce2adf654f$var$PressEvent4 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$8, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$8 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$8 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$8(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$8(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$8("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$8("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$8(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$9(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$a(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$8(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$8(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$8(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$8(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$8(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$8(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$8]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$8] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$8(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$8(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$8(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$8))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$8;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$8((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$8]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$8(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$8(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$8(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$8(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$8(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$8(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$8(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$8(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$8(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$8(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$8 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$8(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$8.has(target.type);
}
function useChip(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, chip.variantKeys);
  const {
    ref,
    as: as2,
    children,
    avatar,
    startContent,
    endContent,
    onClose,
    classNames: classNames2,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const isCloseable = !!onClose;
  const isDotVariant = originalProps.variant === "dot";
  const { focusProps: closeFocusProps, isFocusVisible: isCloseButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isOneChar = reactExports.useMemo(
    () => typeof children === "string" && (children == null ? void 0 : children.length) === 1,
    [children]
  );
  const hasStartContent = reactExports.useMemo(() => !!avatar || !!startContent, [avatar, startContent]);
  const hasEndContent = reactExports.useMemo(() => !!endContent || isCloseable, [endContent, isCloseable]);
  const slots = reactExports.useMemo(
    () => chip({
      ...variantProps2,
      hasStartContent,
      hasEndContent,
      isOneChar,
      isCloseable,
      isCloseButtonFocusVisible
    }),
    [
      objectToDeps(variantProps2),
      isCloseButtonFocusVisible,
      hasStartContent,
      hasEndContent,
      isOneChar,
      isCloseable
    ]
  );
  const { pressProps: closePressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$8({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled),
    onPress: onClose
  });
  const getChipProps = () => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...otherProps
    };
  };
  const getCloseButtonProps = () => {
    return {
      role: "button",
      tabIndex: 0,
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      "aria-label": "close chip",
      ...mergeProps$3(closePressProps, closeFocusProps)
    };
  };
  const getAvatarClone = (avatar2) => {
    if (!reactExports.isValidElement(avatar2))
      return null;
    return reactExports.cloneElement(avatar2, {
      // @ts-ignore
      className: slots.avatar({ class: classNames2 == null ? void 0 : classNames2.avatar })
    });
  };
  const getContentClone = (content2) => reactExports.isValidElement(content2) ? reactExports.cloneElement(content2, {
    // @ts-ignore
    className: clsx$5("max-h-[80%]", content2.props.className)
  }) : null;
  return {
    Component: Component2,
    children,
    slots,
    classNames: classNames2,
    isDot: isDotVariant,
    isCloseable,
    startContent: getAvatarClone(avatar) || getContentClone(startContent),
    endContent: getContentClone(endContent),
    getCloseButtonProps,
    getChipProps
  };
}
var Chip$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    slots,
    classNames: classNames2,
    isDot,
    isCloseable,
    startContent,
    endContent,
    getCloseButtonProps,
    getChipProps
  } = useChip({
    ...props,
    ref
  });
  const start = reactExports.useMemo(() => {
    if (isDot && !startContent) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.dot({ class: classNames2 == null ? void 0 : classNames2.dot }) });
    }
    return startContent;
  }, [slots, startContent, isDot]);
  const end = reactExports.useMemo(() => {
    if (isCloseable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getCloseButtonProps(), children: endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return endContent;
  }, [endContent, isCloseable, getCloseButtonProps]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getChipProps(), children: [
    start,
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children }),
    end
  ] });
});
Chip$1.displayName = "HeroUI.Chip";
var chip_default = Chip$1;
const $e5be200c675c3b3a$export$aca958c65c314e6c$1 = {
  badInput: false,
  customError: false,
  patternMismatch: false,
  rangeOverflow: false,
  rangeUnderflow: false,
  stepMismatch: false,
  tooLong: false,
  tooShort: false,
  typeMismatch: false,
  valueMissing: false,
  valid: true
};
const $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1 = {
  ...$e5be200c675c3b3a$export$aca958c65c314e6c$1,
  customError: true,
  valid: false
};
const $e5be200c675c3b3a$export$dad6ae84456c676a$1 = {
  isInvalid: false,
  validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c$1,
  validationErrors: []
};
const $e5be200c675c3b3a$export$571b5131b7e65c11$2 = reactExports.createContext({});
const $e5be200c675c3b3a$export$a763b9476acd3eb$1 = "__formValidationState" + Date.now();
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1(props) {
  if (props[$e5be200c675c3b3a$export$a763b9476acd3eb$1]) {
    let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb$1];
    return {
      realtimeValidation,
      displayValidation,
      updateValidation,
      resetValidation,
      commitValidation
    };
  }
  return $e5be200c675c3b3a$var$useFormValidationStateImpl$1(props);
}
function $e5be200c675c3b3a$var$useFormValidationStateImpl$1(props) {
  let { isInvalid, validationState, name: name2, value: value2, builtinValidation, validate: validate2, validationBehavior = "aria" } = props;
  if (validationState)
    isInvalid || (isInvalid = validationState === "invalid");
  let controlledError = isInvalid !== void 0 ? {
    isInvalid,
    validationErrors: [],
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1
  } : null;
  let clientError = reactExports.useMemo(() => {
    if (!validate2 || value2 == null)
      return null;
    let validateErrors = $e5be200c675c3b3a$var$runValidate$1(validate2, value2);
    return $e5be200c675c3b3a$var$getValidationResult$1(validateErrors);
  }, [
    validate2,
    value2
  ]);
  if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
    builtinValidation = void 0;
  let serverErrors = reactExports.useContext($e5be200c675c3b3a$export$571b5131b7e65c11$2);
  let serverErrorMessages = reactExports.useMemo(() => {
    if (name2)
      return Array.isArray(name2) ? name2.flatMap((name3) => $e5be200c675c3b3a$var$asArray$1(serverErrors[name3])) : $e5be200c675c3b3a$var$asArray$1(serverErrors[name2]);
    return [];
  }, [
    serverErrors,
    name2
  ]);
  let [lastServerErrors, setLastServerErrors] = reactExports.useState(serverErrors);
  let [isServerErrorCleared, setServerErrorCleared] = reactExports.useState(false);
  if (serverErrors !== lastServerErrors) {
    setLastServerErrors(serverErrors);
    setServerErrorCleared(false);
  }
  let serverError = reactExports.useMemo(() => $e5be200c675c3b3a$var$getValidationResult$1(isServerErrorCleared ? [] : serverErrorMessages), [
    isServerErrorCleared,
    serverErrorMessages
  ]);
  let nextValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let [currentValidity, setCurrentValidity] = reactExports.useState($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let lastError = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let commitValidation = () => {
    if (!commitQueued)
      return;
    setCommitQueued(false);
    let error2 = clientError || builtinValidation || nextValidation.current;
    if (!$e5be200c675c3b3a$var$isEqualValidation$1(error2, lastError.current)) {
      lastError.current = error2;
      setCurrentValidity(error2);
    }
  };
  let [commitQueued, setCommitQueued] = reactExports.useState(false);
  reactExports.useEffect(commitValidation);
  let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a$1;
  let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
  return {
    realtimeValidation,
    displayValidation,
    updateValidation(value3) {
      if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation$1(currentValidity, value3))
        setCurrentValidity(value3);
      else
        nextValidation.current = value3;
    },
    resetValidation() {
      let error2 = $e5be200c675c3b3a$export$dad6ae84456c676a$1;
      if (!$e5be200c675c3b3a$var$isEqualValidation$1(error2, lastError.current)) {
        lastError.current = error2;
        setCurrentValidity(error2);
      }
      if (validationBehavior === "native")
        setCommitQueued(false);
      setServerErrorCleared(true);
    },
    commitValidation() {
      if (validationBehavior === "native")
        setCommitQueued(true);
      setServerErrorCleared(true);
    }
  };
}
function $e5be200c675c3b3a$var$asArray$1(v2) {
  if (!v2)
    return [];
  return Array.isArray(v2) ? v2 : [
    v2
  ];
}
function $e5be200c675c3b3a$var$runValidate$1(validate2, value2) {
  if (typeof validate2 === "function") {
    let e2 = validate2(value2);
    if (e2 && typeof e2 !== "boolean")
      return $e5be200c675c3b3a$var$asArray$1(e2);
  }
  return [];
}
function $e5be200c675c3b3a$var$getValidationResult$1(errors) {
  return errors.length ? {
    isInvalid: true,
    validationErrors: errors,
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE$1
  } : null;
}
function $e5be200c675c3b3a$var$isEqualValidation$1(a2, b2) {
  if (a2 === b2)
    return true;
  return !!a2 && !!b2 && a2.isInvalid === b2.isInvalid && a2.validationErrors.length === b2.validationErrors.length && a2.validationErrors.every((a3, i2) => a3 === b2.validationErrors[i2]) && Object.entries(a2.validationDetails).every(([k2, v2]) => b2.validationDetails[k2] === v2);
}
function $e5be200c675c3b3a$export$75ee7c75d68f5b0e(...results) {
  let errors = /* @__PURE__ */ new Set();
  let isInvalid = false;
  let validationDetails = {
    ...$e5be200c675c3b3a$export$aca958c65c314e6c$1
  };
  for (let v2 of results) {
    var _validationDetails, _key;
    for (let e2 of v2.validationErrors)
      errors.add(e2);
    isInvalid || (isInvalid = v2.isInvalid);
    for (let key in validationDetails)
      (_validationDetails = validationDetails)[_key = key] || (_validationDetails[_key] = v2.validationDetails[key]);
  }
  validationDetails.valid = !isInvalid;
  return {
    isInvalid,
    validationErrors: [
      ...errors
    ],
    validationDetails
  };
}
function $e93e671b31057976$export$b8473d3665f3a75a$1(props, state, ref) {
  let { validationBehavior, focus } = props;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.disabled) {
      let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
      ref.current.setCustomValidity(errorMessage);
      if (!ref.current.hasAttribute("title"))
        ref.current.title = "";
      if (!state.realtimeValidation.isInvalid)
        state.updateValidation($e93e671b31057976$var$getNativeValidity$1(ref.current));
    }
  });
  let isIgnoredReset = reactExports.useRef(false);
  let onReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (!isIgnoredReset.current)
      state.resetValidation();
  });
  let onInvalid = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    var _ref_current;
    if (!state.displayValidation.isInvalid)
      state.commitValidation();
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    if (!e2.defaultPrevented && ref && form2 && $e93e671b31057976$var$getFirstInvalidInput$1(form2) === ref.current) {
      var _ref_current1;
      if (focus)
        focus();
      else
        (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a$2("keyboard");
    }
    e2.preventDefault();
  });
  let onChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.commitValidation();
  });
  reactExports.useEffect(() => {
    let input2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!input2)
      return;
    let form2 = input2.form;
    let reset = form2 === null || form2 === void 0 ? void 0 : form2.reset;
    if (form2)
      form2.reset = () => {
        isIgnoredReset.current = !window.event || window.event.type === "message" && window.event.target instanceof MessagePort;
        reset === null || reset === void 0 ? void 0 : reset.call(form2);
        isIgnoredReset.current = false;
      };
    input2.addEventListener("invalid", onInvalid);
    input2.addEventListener("change", onChange);
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", onReset);
    return () => {
      input2.removeEventListener("invalid", onInvalid);
      input2.removeEventListener("change", onChange);
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", onReset);
      if (form2)
        form2.reset = reset;
    };
  }, [
    ref,
    onInvalid,
    onChange,
    onReset,
    validationBehavior
  ]);
}
function $e93e671b31057976$var$getValidity$1(input2) {
  let validity = input2.validity;
  return {
    badInput: validity.badInput,
    customError: validity.customError,
    patternMismatch: validity.patternMismatch,
    rangeOverflow: validity.rangeOverflow,
    rangeUnderflow: validity.rangeUnderflow,
    stepMismatch: validity.stepMismatch,
    tooLong: validity.tooLong,
    tooShort: validity.tooShort,
    typeMismatch: validity.typeMismatch,
    valueMissing: validity.valueMissing,
    valid: validity.valid
  };
}
function $e93e671b31057976$var$getNativeValidity$1(input2) {
  return {
    isInvalid: !input2.validity.valid,
    validationDetails: $e93e671b31057976$var$getValidity$1(input2),
    validationErrors: input2.validationMessage ? [
      input2.validationMessage
    ] : []
  };
}
function $e93e671b31057976$var$getFirstInvalidInput$1(form2) {
  for (let i2 = 0; i2 < form2.elements.length; i2++) {
    let element2 = form2.elements[i2];
    if (!element2.validity.valid)
      return element2;
  }
  return null;
}
function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
  let { isDisabled = false, isReadOnly = false, value: value2, name: name2, form: form2, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, validationState = "valid", isInvalid, onPressStart, onPressEnd, onPressChange, onPress, onPressUp, onClick } = props;
  let onChange = (e2) => {
    e2.stopPropagation();
    state.setSelected(e2.target.checked);
  };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPress,
    onPressUp,
    onClick,
    isDisabled
  });
  let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPressEnd,
    onPressChange,
    onPressUp,
    onClick,
    onPress(e2) {
      var _ref_current;
      onPress === null || onPress === void 0 ? void 0 : onPress(e2);
      state.toggle();
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
    },
    isDisabled: isDisabled || isReadOnly
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, focusableProps);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  $99facab73266f662$export$5add1d006293d136(ref, state.defaultSelected, state.setSelected);
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      onClick: (e2) => e2.preventDefault()
    }),
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      "aria-invalid": isInvalid || validationState === "invalid" || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-controls": props["aria-controls"],
      "aria-readonly": isReadOnly || void 0,
      onChange,
      disabled: isDisabled,
      ...value2 == null ? {} : {
        value: value2
      },
      name: name2,
      form: form2,
      type: "checkbox",
      ...interactions
    }),
    isSelected: state.isSelected,
    isPressed: isPressed || isLabelPressed,
    isDisabled,
    isReadOnly,
    isInvalid: isInvalid || validationState === "invalid"
  };
}
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: state.isSelected
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
    ...props,
    isInvalid
  }, state, inputRef);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, inputRef);
  let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
  reactExports.useEffect(() => {
    if (inputRef.current)
      inputRef.current.indeterminate = !!isIndeterminate;
  });
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled: isDisabled || isReadOnly,
    onPress() {
      let { [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: groupValidationState } = props;
      let { commitValidation } = groupValidationState ? groupValidationState : validationState;
      commitValidation();
    }
  });
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, pressProps),
    inputProps: {
      ...inputProps,
      checked: isSelected,
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      required: isRequired && validationBehavior === "native"
    },
    isSelected,
    isPressed,
    isDisabled,
    isReadOnly,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
function $d191a55c9702f145$export$8467354a121f1b9f$1(props) {
  let { id: id2, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let labelId = $bdb11010cef70236$export$f680877a34711e37$2();
  let labelProps = {};
  if (label) {
    ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
    labelProps = {
      id: labelId,
      htmlFor: labelElementType === "label" ? id2 : void 0
    };
  }
  let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: id2,
    "aria-label": ariaLabel,
    "aria-labelledby": ariaLabelledby
  });
  return {
    labelProps,
    fieldProps
  };
}
function $2baaea4c71418dea$export$294aa081a6c6f55d$1(props) {
  let { description, errorMessage, isInvalid, validationState } = props;
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1(props);
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  fieldProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, {
    "aria-describedby": [
      descriptionId,
      // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
      errorMessageId,
      props["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  });
  return {
    labelProps,
    fieldProps,
    descriptionProps: {
      id: descriptionId
    },
    errorMessageProps: {
      id: errorMessageId
    }
  };
}
function $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(props, state) {
  let { isDisabled, name: name2, validationBehavior = "aria" } = props;
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    // Checkbox group is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  $1ae600c947479353$export$ec98120685d4f57d.set(state, {
    name: name2,
    descriptionId: descriptionProps.id,
    errorMessageId: errorMessageProps.id,
    validationBehavior
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onBlurWithin: props.onBlur,
    onFocusWithin: props.onFocus,
    onFocusWithinChange: props.onFocusChange
  });
  return {
    groupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      role: "group",
      "aria-disabled": isDisabled || void 0,
      ...fieldProps,
      ...focusWithinProps
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $3017fa7ffdddec74$export$8042c6c013fd5226$2(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  let [initialValue] = reactExports.useState(isSelected);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  var _props_defaultSelected;
  return {
    isSelected,
    defaultSelected: (_props_defaultSelected = props.defaultSelected) !== null && _props_defaultSelected !== void 0 ? _props_defaultSelected : initialValue,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
  const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226$2({
    isReadOnly: props.isReadOnly || state.isReadOnly,
    isSelected: state.isSelected(props.value),
    onChange(isSelected) {
      if (isSelected)
        state.addValue(props.value);
      else
        state.removeValue(props.value);
      if (props.onChange)
        props.onChange(isSelected);
    }
  });
  let { name: name2, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
  var _props_validationBehavior;
  validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
  let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: toggleState.isSelected,
    // Server validation is handled at the group level.
    name: void 0,
    validationBehavior: "aria"
  });
  let nativeValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let updateValidation = () => {
    state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
  };
  reactExports.useEffect(updateValidation);
  let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
  let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
  var _props_isRequired;
  let res = $406796ff087fe49b$export$e375f10ce42261c5({
    ...props,
    isReadOnly: props.isReadOnly || state.isReadOnly,
    isDisabled: props.isDisabled || state.isDisabled,
    name: props.name || name2,
    isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
    validationBehavior,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
      realtimeValidation: combinedRealtimeValidation,
      displayValidation,
      resetValidation: state.resetValidation,
      commitValidation: state.commitValidation,
      updateValidation(v2) {
        nativeValidation.current = v2;
        updateValidation();
      }
    }
  }, toggleState, inputRef);
  return {
    ...res,
    inputProps: {
      ...res.inputProps,
      "aria-describedby": [
        props["aria-describedby"],
        state.isInvalid ? errorMessageId : null,
        descriptionId
      ].filter(Boolean).join(" ") || void 0
    }
  };
}
function $587d3ad58be6d31f$export$daff6da51032a415(props = {}) {
  let [selectedValues, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || [], props.onChange);
  let isRequired = !!props.isRequired && selectedValues.length === 0;
  let invalidValues = reactExports.useRef(/* @__PURE__ */ new Map());
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: selectedValues
  });
  let isInvalid = validation.displayValidation.isInvalid;
  var _props_validationState;
  const state = {
    ...validation,
    value: selectedValues,
    setValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      setValue(value2);
    },
    isDisabled: props.isDisabled || false,
    isReadOnly: props.isReadOnly || false,
    isSelected(value2) {
      return selectedValues.includes(value2);
    },
    addValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (!selectedValues.includes(value2))
        setValue(selectedValues.concat(value2));
    },
    removeValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (selectedValues.includes(value2))
        setValue(selectedValues.filter((existingValue) => existingValue !== value2));
    },
    toggleValue(value2) {
      if (props.isReadOnly || props.isDisabled)
        return;
      if (selectedValues.includes(value2))
        setValue(selectedValues.filter((existingValue) => existingValue !== value2));
      else
        setValue(selectedValues.concat(value2));
    },
    setInvalid(value2, v2) {
      let s2 = new Map(invalidValues.current);
      if (v2.isInvalid)
        s2.set(value2, v2);
      else
        s2.delete(value2);
      invalidValues.current = s2;
      validation.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(...s2.values()));
    },
    validationState: (_props_validationState = props.validationState) !== null && _props_validationState !== void 0 ? _props_validationState : isInvalid ? "invalid" : null,
    isInvalid,
    isRequired
  };
  return state;
}
var DEFAULT_SLOT = Symbol("default");
function useObjectRef(ref) {
  const objRef = reactExports.useRef(null);
  const cleanupRef = reactExports.useRef(void 0);
  const refEffect = reactExports.useCallback(
    (instance2) => {
      if (typeof ref === "function") {
        const refCallback = ref;
        const refCleanup = refCallback(instance2);
        return () => {
          if (typeof refCleanup === "function") {
            refCleanup();
          } else {
            refCallback(null);
          }
        };
      } else if (ref) {
        ref.current = instance2;
        return () => {
          ref.current = null;
        };
      }
    },
    [ref]
  );
  return reactExports.useMemo(
    () => ({
      get current() {
        return objRef.current;
      },
      set current(value2) {
        objRef.current = value2;
        if (cleanupRef.current) {
          cleanupRef.current();
          cleanupRef.current = void 0;
        }
        if (value2 != null) {
          cleanupRef.current = refEffect(value2);
        }
      }
    }),
    [refEffect]
  );
}
function useSlottedContext(context, slot) {
  let ctx = reactExports.useContext(context);
  if (slot === null) {
    return null;
  }
  if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
    let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p2) => `"${p2}"`));
    if (!slot && !ctx.slots[DEFAULT_SLOT]) {
      throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`);
    }
    let slotKey = slot || DEFAULT_SLOT;
    if (!ctx.slots[slotKey]) {
      throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`);
    }
    return ctx.slots[slotKey];
  }
  return ctx;
}
function useContextProps(props, ref, context) {
  let ctx = useSlottedContext(context, props.slot) || {};
  let { ref: contextRef, ...contextProps } = ctx;
  let mergedRef = useObjectRef(reactExports.useMemo(() => mergeRefs$1(ref, contextRef), [ref, contextRef]));
  let mergedProps = mergeProps$3(contextProps, props);
  if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
    if (typeof contextProps.style === "function" || typeof props.style === "function") {
      mergedProps.style = (renderProps) => {
        let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
        let defaultStyle = { ...renderProps.defaultStyle, ...contextStyle };
        let style2 = typeof props.style === "function" ? props.style({ ...renderProps, defaultStyle }) : props.style;
        return { ...defaultStyle, ...style2 };
      };
    } else {
      mergedProps.style = { ...contextProps.style, ...props.style };
    }
  }
  return [mergedProps, mergedRef];
}
const $e5be200c675c3b3a$export$571b5131b7e65c11$1 = reactExports.createContext({});
var FormContext$1 = reactExports.createContext(null);
reactExports.forwardRef(function Form2(props, ref) {
  [props, ref] = useContextProps(props, ref, FormContext$1);
  let { validationErrors, validationBehavior = "native", children, className, ...domProps } = props;
  const styles2 = reactExports.useMemo(() => form({ className }), [className]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { noValidate: validationBehavior !== "native", ...domProps, ref, className: styles2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormContext$1.Provider, { value: { ...props, validationBehavior }, children: /* @__PURE__ */ jsxRuntimeExports.jsx($e5be200c675c3b3a$export$571b5131b7e65c11$1.Provider, { value: validationErrors != null ? validationErrors : {}, children }) }) });
});
function useCheckboxGroup(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const {
    as: as2,
    ref,
    classNames: classNames2,
    children,
    label,
    radius,
    value: value2,
    name: name2,
    defaultValue: defaultValue2,
    isInvalid: isInvalidProp,
    validationState,
    size: size2 = "md",
    color: color2 = "primary",
    orientation = "vertical",
    lineThrough = false,
    isDisabled = false,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    isReadOnly,
    isRequired,
    onValueChange,
    description,
    errorMessage,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const checkboxGroupProps = reactExports.useMemo(() => {
    return {
      ...otherProps,
      value: value2,
      name: name2,
      "aria-label": safeAriaLabel(otherProps["aria-label"], label),
      defaultValue: defaultValue2,
      isRequired,
      isReadOnly,
      orientation,
      validationBehavior,
      isInvalid: validationState === "invalid" || isInvalidProp,
      onChange: chain(props.onChange, onValueChange)
    };
  }, [
    value2,
    name2,
    label,
    defaultValue2,
    isRequired,
    isReadOnly,
    orientation,
    onValueChange,
    isInvalidProp,
    validationState,
    validationBehavior,
    otherProps["aria-label"],
    otherProps
  ]);
  const groupState = $587d3ad58be6d31f$export$daff6da51032a415(checkboxGroupProps);
  const {
    labelProps,
    groupProps,
    descriptionProps,
    errorMessageProps,
    validationErrors,
    validationDetails
  } = $1e9fce0cfacc738b$export$49ff6f28c54f1cbe(checkboxGroupProps, groupState);
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      radius,
      lineThrough,
      isInvalid: groupState.isInvalid,
      isDisabled,
      disableAnimation,
      validationBehavior,
      groupState
    }),
    [
      size2,
      color2,
      radius,
      lineThrough,
      isDisabled,
      disableAnimation,
      validationBehavior,
      groupState.value,
      groupState.isDisabled,
      groupState.isReadOnly,
      groupState.isInvalid,
      groupState.isSelected
    ]
  );
  const slots = reactExports.useMemo(
    () => checkboxGroup({ isRequired, isInvalid: groupState.isInvalid, disableAnimation }),
    [isRequired, groupState.isInvalid, , disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getGroupProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      )
    };
  }, [slots, domRef, baseStyles, groupProps, otherProps]);
  const getLabelProps = reactExports.useCallback(() => {
    return {
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...labelProps
    };
  }, [slots, labelProps, classNames2 == null ? void 0 : classNames2.label]);
  const getWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      role: "presentation",
      "data-orientation": orientation
    };
  }, [slots, orientation, classNames2 == null ? void 0 : classNames2.wrapper]);
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, descriptionProps, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  return {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid: groupState.isInvalid,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid: groupState.isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  };
}
var [CheckboxGroupProvider, useCheckboxGroupContext] = createContext2({
  name: "CheckboxGroupContext",
  strict: false
});
var CheckboxGroup = forwardRef((props, ref) => {
  const {
    children,
    context,
    label,
    description,
    isInvalid,
    errorMessage,
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  } = useCheckboxGroup({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getGroupProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxGroupProvider, { value: context, children }) }),
    isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) : null
  ] });
});
CheckboxGroup.displayName = "HeroUI.CheckboxGroup";
var checkbox_group_default = CheckboxGroup;
function CheckIcon$1(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      fill: "none",
      role: "presentation",
      stroke: "currentColor",
      strokeDasharray: 22,
      strokeDashoffset: isSelected ? 44 : 66,
      strokeLinecap: "round",
      strokeLinejoin: "round",
      strokeWidth: 2,
      style: !disableAnimation && isSelected ? {
        transition: "stroke-dashoffset 250ms linear 0.2s"
      } : {},
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("polyline", { points: "1 9 7 14 15 4" })
    }
  );
}
function IndeterminateIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { stroke: "currentColor", strokeWidth: 3, viewBox: "0 0 24 24", ...otherProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("line", { x1: "21", x2: "3", y1: "12", y2: "12" }) });
}
function CheckboxIcon(props) {
  const { isIndeterminate, ...otherProps } = props;
  const BaseIcon = isIndeterminate ? IndeterminateIcon : CheckIcon$1;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BaseIcon, { ...otherProps });
}
function $3017fa7ffdddec74$export$8042c6c013fd5226$1(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  return {
    isSelected,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function useCallbackRef(fn, deps = []) {
  const ref = reactExports.useRef(fn);
  useSafeLayoutEffect(() => {
    ref.current = fn;
  });
  return reactExports.useCallback((...args) => {
    var _a2;
    return (_a2 = ref.current) == null ? void 0 : _a2.call(ref, ...args);
  }, deps);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = false;
let $6179b936705e76d3$var$hoverCount$d = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$d() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$d(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$d();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$d() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$d);
  $6179b936705e76d3$var$hoverCount$d++;
  return () => {
    $6179b936705e76d3$var$hoverCount$d--;
    if ($6179b936705e76d3$var$hoverCount$d > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$d);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$d(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$d, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$d && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useCheckbox(props = {}) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h;
  const globalContext = useProviderContext();
  const groupContext = useCheckboxGroupContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const isInGroup = !!groupContext;
  const {
    as: as2,
    ref,
    value: value2 = "",
    children,
    icon,
    name: name2,
    isRequired,
    isReadOnly: isReadOnlyProp = false,
    autoFocus = false,
    isSelected: isSelectedProp,
    size: size2 = (_a2 = groupContext == null ? void 0 : groupContext.size) != null ? _a2 : "md",
    color: color2 = (_b2 = groupContext == null ? void 0 : groupContext.color) != null ? _b2 : "primary",
    radius = groupContext == null ? void 0 : groupContext.radius,
    lineThrough = (_c2 = groupContext == null ? void 0 : groupContext.lineThrough) != null ? _c2 : false,
    isDisabled: isDisabledProp = (_d = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _d : false,
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    validationState,
    isInvalid: isInvalidProp = validationState ? validationState === "invalid" : (_g = groupContext == null ? void 0 : groupContext.isInvalid) != null ? _g : false,
    isIndeterminate = false,
    validationBehavior = isInGroup ? groupContext.validationBehavior : (_h = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _h : "native",
    defaultSelected,
    classNames: classNames2,
    className,
    onValueChange,
    validate: validate2,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  let onChange = props.onChange;
  if (isInGroup) {
    const dispatch = () => {
      groupContext.groupState.resetValidation();
    };
    onChange = chain(dispatch, onChange);
  }
  const labelId = reactExports.useId();
  const ariaCheckboxProps = reactExports.useMemo(
    () => ({
      name: name2,
      value: value2,
      children,
      autoFocus,
      defaultSelected,
      isIndeterminate,
      isRequired,
      isInvalid: isInvalidProp,
      isSelected: isSelectedProp,
      isDisabled: isDisabledProp,
      isReadOnly: isReadOnlyProp,
      "aria-label": safeAriaLabel(otherProps["aria-label"], children),
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      onChange: onValueChange
    }),
    [
      name2,
      value2,
      children,
      autoFocus,
      defaultSelected,
      isIndeterminate,
      isRequired,
      isInvalidProp,
      isSelectedProp,
      isDisabledProp,
      isReadOnlyProp,
      otherProps["aria-label"],
      otherProps["aria-labelledby"],
      labelId,
      onValueChange
    ]
  );
  const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226$1(ariaCheckboxProps);
  const validationProps = {
    isInvalid: isInvalidProp,
    isRequired,
    validate: validate2,
    validationState,
    validationBehavior
  };
  const {
    inputProps,
    isSelected,
    isDisabled,
    isReadOnly,
    isPressed,
    isInvalid: isAriaInvalid
  } = isInGroup ? (
    // eslint-disable-next-line
    $fba3e38d5ca8983f$export$353b32fc6898d37d(
      { ...ariaCheckboxProps, ...validationProps },
      groupContext.groupState,
      inputRef
    )
  ) : (
    // eslint-disable-next-line
    $406796ff087fe49b$export$e375f10ce42261c5({ ...ariaCheckboxProps, ...validationProps }, toggleState, inputRef)
  );
  const isInteractionDisabled = isDisabled || isReadOnly;
  const isInvalid = validationState === "invalid" || isInvalidProp || isAriaInvalid;
  const pressed = isInteractionDisabled ? false : isPressed;
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$d({
    isDisabled: inputProps.disabled
  });
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus: inputProps.autoFocus
  });
  const slots = reactExports.useMemo(
    () => checkbox({
      color: color2,
      size: size2,
      radius,
      isInvalid,
      lineThrough,
      isDisabled,
      disableAnimation
    }),
    [color2, size2, radius, isInvalid, lineThrough, isDisabled, disableAnimation]
  );
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const isInputRefChecked = !!inputRef.current.checked;
    toggleState.setSelected(isInputRefChecked);
  }, [inputRef.current]);
  const onChangeProp = useCallbackRef(onChange);
  const handleCheckboxChange = reactExports.useCallback(
    (event) => {
      if (isReadOnly || isDisabled) {
        event.preventDefault();
        return;
      }
      onChangeProp == null ? void 0 : onChangeProp(event);
    },
    [isReadOnly, isDisabled, onChangeProp]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      "data-disabled": dataAttr(isDisabled),
      "data-selected": dataAttr(isSelected || isIndeterminate),
      "data-invalid": dataAttr(isInvalid),
      "data-hover": dataAttr(isHovered),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(pressed),
      "data-readonly": dataAttr(inputProps.readOnly),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-indeterminate": dataAttr(isIndeterminate),
      ...mergeProps$3(hoverProps, otherProps)
    };
  }, [
    slots,
    baseStyles,
    isDisabled,
    isSelected,
    isIndeterminate,
    isInvalid,
    isHovered,
    isFocused,
    pressed,
    inputProps.readOnly,
    isFocusVisible,
    hoverProps,
    otherProps
  ]);
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$5(slots.wrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = reactExports.useCallback(() => {
    return {
      ref: mergeRefs(inputRef, ref),
      ...mergeProps$3(inputProps, focusProps),
      className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
      onChange: chain(inputProps.onChange, handleCheckboxChange)
    };
  }, [inputProps, focusProps, handleCheckboxChange, classNames2 == null ? void 0 : classNames2.hiddenInput]);
  const getLabelProps = reactExports.useCallback(
    () => ({
      id: labelId,
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected, isInvalid]
  );
  const getIconProps = reactExports.useCallback(
    () => ({
      isSelected,
      isIndeterminate,
      disableAnimation,
      className: slots.icon({ class: classNames2 == null ? void 0 : classNames2.icon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.icon, isSelected, isIndeterminate, disableAnimation]
  );
  return {
    Component: Component2,
    icon,
    children,
    isSelected,
    isDisabled,
    isInvalid,
    isFocused,
    isHovered,
    isFocusVisible,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getIconProps
  };
}
var Checkbox = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    icon = /* @__PURE__ */ jsxRuntimeExports.jsx(CheckboxIcon, {}),
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getIconProps,
    getLabelProps
  } = useCheckbox({ ...props, ref });
  const clonedIcon = typeof icon === "function" ? icon(getIconProps()) : reactExports.cloneElement(icon, getIconProps());
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getWrapperProps(), children: clonedIcon }),
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children })
  ] });
});
Checkbox.displayName = "HeroUI.Checkbox";
var checkbox_default = Checkbox;
function useCode(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, code$1.variantKeys);
  const { as: as2, children, className, ...otherProps } = props;
  const Component2 = as2 || "code";
  const styles2 = reactExports.useMemo(
    () => code$1({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getCodeProps = () => {
    return {
      className: styles2,
      ...otherProps
    };
  };
  return { Component: Component2, children, getCodeProps };
}
var Code = forwardRef((props, ref) => {
  const { Component: Component2, children, getCodeProps } = useCode({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getCodeProps(), children });
});
Code.displayName = "HeroUI.Code";
var code_default = Code;
let $bdb11010cef70236$export$d41a04c74483c6ef$6 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$6.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$6(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$6.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$6.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$6(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$6(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$6(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$6(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$2 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$2 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$2 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$2 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$2(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$2.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$2.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$2.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$2.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$3(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$3())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$3(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$3(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$3 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$3() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$3 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$3 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$3 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$3;
}
function $7215afc6de606d6b$var$getScrollableElements$3(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$3(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$4(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$4(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$4(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$4 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testPlatform$4(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testPlatform$4(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$4() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$3();
});
const $c87311424ea30a05$export$6446a186d09e379e$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$3 = $c87311424ea30a05$var$cached$4(function() {
  return $c87311424ea30a05$var$testUserAgent$4(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext$1 = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink$1,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext$1);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235$1(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$3() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$4())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$3() && $c87311424ea30a05$export$9ac100e40613ea10$4() && !$c87311424ea30a05$export$7bef049ce92e4224$3() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$3(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$3.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink$1(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink$1(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink$1(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$3(link2, modifiers));
}
function $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props) {
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1();
  var _props_href;
  const href = router.useHref((_props_href = props === null || props === void 0 ? void 0 : props.href) !== null && _props_href !== void 0 ? _props_href : "");
  return {
    href: (props === null || props === void 0 ? void 0 : props.href) ? href : void 0,
    target: props === null || props === void 0 ? void 0 : props.target,
    rel: props === null || props === void 0 ? void 0 : props.rel,
    download: props === null || props === void 0 ? void 0 : props.download,
    ping: props === null || props === void 0 ? void 0 : props.ping,
    referrerPolicy: props === null || props === void 0 ? void 0 : props.referrerPolicy
  };
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2;
const $8ae05eaa5c114e9c$var$useEarlyEffect$2 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 = React$6["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$2 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$2(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$2(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$5 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$5.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$5(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$5.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$5.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$5(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$2 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$2 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$2(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode$1(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a$1(node2) {
  return $431fbd86ca7dc216$var$isNode$1(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0$1(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a$1(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29$1(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$5(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$5(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$5(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3$2(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$2())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$2(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$2(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$2 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$2() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$2 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$2 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$2 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$2;
}
function $7215afc6de606d6b$var$getScrollableElements$2(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$2(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$3(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$3(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$3(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$3 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99$1 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testPlatform$3(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$3() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1$1 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$export$186c6964ca17d99$1() || $c87311424ea30a05$export$7bef049ce92e4224$2();
});
const $c87311424ea30a05$export$78551043582a6a98$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$2();
});
const $c87311424ea30a05$export$6446a186d09e379e$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$2 = $c87311424ea30a05$var$cached$3(function() {
  return $c87311424ea30a05$var$testUserAgent$3(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$2() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$3())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$2() && $c87311424ea30a05$export$9ac100e40613ea10$3() && !$c87311424ea30a05$export$7bef049ce92e4224$2() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$2(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement$1 = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks$1 = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents$1() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement$1.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement$1.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement$1.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement$1.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement$1.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks$1)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks$1.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents$1();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents$1);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements$1() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement$1)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement$1.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430$1(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements$1();
    if ($bbed8b41f857bcc0$var$transitionsByElement$1.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks$1.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6$1() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e$1(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$3(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$2(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$2() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63$1(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$2() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility$1 = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible$1(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible$1(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility$1)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible$1(element2) && $7d2416ea0959daaa$var$isAttributeVisible$1(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements$1 = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$1 = $b4b717babfbb907b$var$focusableElements$1.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements$1.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed$1(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR$1) && $7d2416ea0959daaa$export$e989c0fffaa6b27a$1(element2) && !$b4b717babfbb907b$var$isInert$1(element2);
}
function $b4b717babfbb907b$var$isInert$1(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$9(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$8(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$7(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$1(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$2(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$2(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$2(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$7 = "default";
let $14c0b72509d70225$var$savedUserSelect$7 = "";
let $14c0b72509d70225$var$modifiedElementMap$7 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$7(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$1()) {
    if ($14c0b72509d70225$var$state$7 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$2(target);
      $14c0b72509d70225$var$savedUserSelect$7 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$7 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$7.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$7(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$1()) {
    if ($14c0b72509d70225$var$state$7 !== "disabled")
      return;
    $14c0b72509d70225$var$state$7 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$1(() => {
        if ($14c0b72509d70225$var$state$7 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$2(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$7 || "";
          $14c0b72509d70225$var$savedUserSelect$7 = "";
          $14c0b72509d70225$var$state$7 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$7.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$7.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$7.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$7 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$7.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$7(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$7);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$5(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$1(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$7 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$7 = class $f6c31cce2adf654f$var$PressEvent5 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$7, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$7 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$7 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$7(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$7(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$1();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$7("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$7("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$7(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$2((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$8(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$9(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$7(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7($d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$7(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$1(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$7(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$5(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$3())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$2.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$2(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$7(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$7(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7($d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$1(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$7(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$1(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$7]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$7] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$2(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$1(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$7(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$2(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$7(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$7(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$1(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$2(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$1(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$1(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$2(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$7))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$7;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$7((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$5(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$7]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$7(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$7(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$7(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$2(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$7(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$7(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$7(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$7(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$7(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$7(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$7(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$7 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$7(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$7.has(target.type);
}
function useAriaLink(props, ref) {
  let {
    elementType = "a",
    onPress,
    onPressStart,
    onPressEnd,
    onClick,
    isDisabled,
    ...otherProps
  } = props;
  let linkProps = {};
  if (elementType !== "a") {
    linkProps = {
      role: "link",
      tabIndex: !isDisabled ? 0 : void 0
    };
  }
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$7({
    onClick,
    onPress,
    onPressStart,
    onPressEnd,
    isDisabled,
    ref
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$2(otherProps, { labelable: true, isLink: elementType === "a" });
  let interactionHandlers = $3ef42575df84b30b$export$9d1611c77c2fe928$6(focusableProps, pressProps);
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$1();
  let routerLinkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18(props);
  return {
    isPressed,
    // Used to indicate press state for visual
    linkProps: $3ef42575df84b30b$export$9d1611c77c2fe928$6(domProps, routerLinkProps, {
      ...interactionHandlers,
      ...linkProps,
      "aria-disabled": isDisabled || void 0,
      "aria-current": props["aria-current"],
      onClick: (e2) => {
        var _a2;
        (_a2 = pressProps.onClick) == null ? void 0 : _a2.call(pressProps, e2);
        if (!router.isNative && e2.currentTarget instanceof HTMLAnchorElement && e2.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
        !e2.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235$1(e2.currentTarget, e2) && props.href) {
          e2.preventDefault();
          router.open(e2.currentTarget, e2, props.href, props.routerOptions);
        }
      }
    })
  };
}
function useLink(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, link$1.variantKeys);
  const {
    ref,
    as: as2,
    children,
    anchorIcon,
    isExternal = false,
    showAnchorIcon = false,
    autoFocus = false,
    className,
    onPress,
    onPressStart,
    onPressEnd,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "a";
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const { linkProps } = useAriaLink(
    {
      ...otherProps,
      onPress,
      onPressStart,
      onPressEnd,
      // @ts-ignore React Aria Link does accept onClick as a prop but it's not in the types
      onClick,
      isDisabled: originalProps.isDisabled,
      elementType: `${as2}`
    },
    domRef
  );
  const { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  if (isExternal) {
    otherProps.rel = (_c2 = otherProps.rel) != null ? _c2 : "noopener noreferrer";
    otherProps.target = (_d = otherProps.target) != null ? _d : "_blank";
  }
  const styles2 = reactExports.useMemo(
    () => link$1({
      ...variantProps2,
      disableAnimation,
      className
    }),
    [objectToDeps(variantProps2), disableAnimation, className]
  );
  const getLinkProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: styles2,
      "data-focus": dataAttr(isFocused),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(focusProps, linkProps, otherProps)
    };
  }, [styles2, isFocused, isFocusVisible, focusProps, linkProps, otherProps]);
  return { Component: Component2, children, anchorIcon, showAnchorIcon, getLinkProps };
}
var Link = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    showAnchorIcon,
    anchorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(LinkIcon, { className: linkAnchorClasses }),
    getLinkProps
  } = useLink({
    ref,
    ...props
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getLinkProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    children,
    showAnchorIcon && anchorIcon
  ] }) });
});
Link.displayName = "HeroUI.Link";
var link_default = Link;
var PaginationCursor = forwardRef((props, ref) => {
  const { as: as2, activePage, ...otherProps } = props;
  const Component2 = as2 || "span";
  const domRef = useDOMRef(ref);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, "aria-hidden": true, ...otherProps, children: activePage });
});
PaginationCursor.displayName = "HeroUI.PaginationCursor";
var pagination_cursor_default = PaginationCursor;
const $b5e257d569688ac6$var$defaultContext$9 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$9 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$9);
const $b5e257d569688ac6$var$IsSSRContext$9 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$9 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$9(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$9);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$9.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$9.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$9.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$9(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$9);
  let counter = $b5e257d569688ac6$var$useCounter$9(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$9(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$9());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$9.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$9 : $b5e257d569688ac6$var$useLegacySSRSafeId$9;
function $b5e257d569688ac6$var$getSnapshot$9() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$9() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$9(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$9() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$9, $b5e257d569688ac6$var$getSnapshot$9, $b5e257d569688ac6$var$getServerSnapshot$9);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$9);
}
function $7215afc6de606d6b$export$de79e2c695e052f3$1(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll$1())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements$1(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition$1(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached$1 = null;
function $7215afc6de606d6b$var$supportsPreventScroll$1() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached$1 == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached$1 = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached$1 = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached$1;
}
function $7215afc6de606d6b$var$getScrollableElements$1(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition$1(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$2(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  return ((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand) => re2.test(brand.brand))) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$2(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$2(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$2 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testPlatform$2(/^Mac/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testPlatform$2(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$2() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$78551043582a6a98$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e$1();
});
const $c87311424ea30a05$export$6446a186d09e379e$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/Chrome/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d$1 = $c87311424ea30a05$var$cached$2(function() {
  return $c87311424ea30a05$var$testUserAgent$2(/Firefox/i);
});
const $ea8dcbcb9ea1b556$var$RouterContext = /* @__PURE__ */ reactExports.createContext({
  isNative: true,
  open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
  useHref: (href) => href
});
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
  return reactExports.useContext($ea8dcbcb9ea1b556$var$RouterContext);
}
function $ea8dcbcb9ea1b556$export$efa8c9099e530235(link2, modifiers) {
  let target = link2.getAttribute("target");
  return (!target || target === "_self") && link2.origin === location.origin && !link2.hasAttribute("download") && !modifiers.metaKey && // open in new tab (mac)
  !modifiers.ctrlKey && // open in new tab (windows)
  !modifiers.altKey && // download
  !modifiers.shiftKey;
}
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d$1() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$2())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98$1() && $c87311424ea30a05$export$9ac100e40613ea10$2() && !$c87311424ea30a05$export$7bef049ce92e4224$1() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3$1(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7$1.isOpening = false;
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
  if (target instanceof HTMLAnchorElement)
    open(target);
  else if (target.hasAttribute("data-href")) {
    let link2 = document.createElement("a");
    link2.href = target.getAttribute("data-href");
    if (target.hasAttribute("data-target"))
      link2.target = target.getAttribute("data-target");
    if (target.hasAttribute("data-rel"))
      link2.rel = target.getAttribute("data-rel");
    if (target.hasAttribute("data-download"))
      link2.download = target.getAttribute("data-download");
    if (target.hasAttribute("data-ping"))
      link2.ping = target.getAttribute("data-ping");
    if (target.hasAttribute("data-referrer-policy"))
      link2.referrerPolicy = target.getAttribute("data-referrer-policy");
    target.appendChild(link2);
    open(link2);
    target.removeChild(link2);
  }
}
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
  $ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link2) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7$1(link2, modifiers));
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1;
const $8ae05eaa5c114e9c$var$useEarlyEffect$1 = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 = React$6["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect$1 : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52$1(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect$1(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
let $bdb11010cef70236$export$d41a04c74483c6ef$4 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$4.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$4(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$4.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$4.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$4(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
const $431fbd86ca7dc216$export$b204af158042fbac$1 = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a$1 = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac$1(el2);
  return doc.defaultView || window;
};
function $431fbd86ca7dc216$var$isNode(value2) {
  return value2 !== null && typeof value2 === "object" && "nodeType" in value2 && typeof value2.nodeType === "number";
}
function $431fbd86ca7dc216$export$af51f0f06c0f328a(node2) {
  return $431fbd86ca7dc216$var$isNode(node2) && node2.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node2;
}
function $d4ee10de306f2510$export$4282f70798064fe0(node2, otherNode) {
  if (!$f4e2df6bd15f8569$export$98658e8c59125e6a())
    return otherNode && node2 ? node2.contains(otherNode) : false;
  if (!node2 || !otherNode)
    return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node2)
      return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($431fbd86ca7dc216$export$af51f0f06c0f328a(currentNode))
      currentNode = currentNode.host;
    else
      currentNode = currentNode.parentNode;
  }
  return false;
}
function $d4ee10de306f2510$export$e58f029f0fbfdb29(event) {
  if ($f4e2df6bd15f8569$export$98658e8c59125e6a() && event.target.shadowRoot) {
    if (event.composedPath)
      return event.composedPath()[0];
  }
  return event.target;
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$4(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$4(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$4(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $7215afc6de606d6b$export$de79e2c695e052f3(element2) {
  if ($7215afc6de606d6b$var$supportsPreventScroll())
    element2.focus({
      preventScroll: true
    });
  else {
    let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element2);
    element2.focus();
    $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
  }
}
let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
function $7215afc6de606d6b$var$supportsPreventScroll() {
  if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
    $7215afc6de606d6b$var$supportsPreventScrollCached = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $7215afc6de606d6b$var$supportsPreventScrollCached = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $7215afc6de606d6b$var$supportsPreventScrollCached;
}
function $7215afc6de606d6b$var$getScrollableElements(element2) {
  let parent = element2.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
      scrollableElements.push({
        element: parent,
        scrollTop: parent.scrollTop,
        scrollLeft: parent.scrollLeft
      });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement)
    scrollableElements.push({
      element: rootScrollingElement,
      scrollTop: rootScrollingElement.scrollTop,
      scrollLeft: rootScrollingElement.scrollLeft
    });
  return scrollableElements;
}
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
  for (let { element: element2, scrollTop, scrollLeft } of scrollableElements) {
    element2.scrollTop = scrollTop;
    element2.scrollLeft = scrollLeft;
  }
}
function $c87311424ea30a05$var$testUserAgent$1(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform$1(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached$1(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10$1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^Mac/i);
});
const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^iPhone/i);
});
const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testPlatform$1(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $c87311424ea30a05$export$9ac100e40613ea10$1() && navigator.maxTouchPoints > 1;
});
const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
});
const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
});
const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Chrome/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8$1 = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Android/i);
});
const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached$1(function() {
  return $c87311424ea30a05$var$testUserAgent$1(/Firefox/i);
});
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
  var _window_event_type, _window_event;
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($c87311424ea30a05$export$b7d78993b74f766d() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith("key")) && target.target === "_blank") {
    if ($c87311424ea30a05$export$9ac100e40613ea10$1())
      metaKey = true;
    else
      ctrlKey = true;
  }
  let event = $c87311424ea30a05$export$78551043582a6a98() && $c87311424ea30a05$export$9ac100e40613ea10$1() && !$c87311424ea30a05$export$7bef049ce92e4224() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    bubbles: true,
    cancelable: true
  });
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
  $7215afc6de606d6b$export$de79e2c695e052f3(target);
  target.dispatchEvent(event);
  $ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
}
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
let $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
let $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
  if (typeof window === "undefined")
    return;
  function isTransitionEvent(event) {
    return "propertyName" in event;
  }
  let onTransitionStart = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
    if (!transitions) {
      transitions = /* @__PURE__ */ new Set();
      $bbed8b41f857bcc0$var$transitionsByElement.set(e2.target, transitions);
      e2.target.addEventListener("transitioncancel", onTransitionEnd, {
        once: true
      });
    }
    transitions.add(e2.propertyName);
  };
  let onTransitionEnd = (e2) => {
    if (!isTransitionEvent(e2) || !e2.target)
      return;
    let properties2 = $bbed8b41f857bcc0$var$transitionsByElement.get(e2.target);
    if (!properties2)
      return;
    properties2.delete(e2.propertyName);
    if (properties2.size === 0) {
      e2.target.removeEventListener("transitioncancel", onTransitionEnd);
      $bbed8b41f857bcc0$var$transitionsByElement.delete(e2.target);
    }
    if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
      for (let cb2 of $bbed8b41f857bcc0$var$transitionCallbacks)
        cb2();
      $bbed8b41f857bcc0$var$transitionCallbacks.clear();
    }
  };
  document.body.addEventListener("transitionrun", onTransitionStart);
  document.body.addEventListener("transitionend", onTransitionEnd);
}
if (typeof document !== "undefined") {
  if (document.readyState !== "loading")
    $bbed8b41f857bcc0$var$setupGlobalEvents();
  else
    document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
}
function $bbed8b41f857bcc0$var$cleanupDetachedElements() {
  for (const [eventTarget] of $bbed8b41f857bcc0$var$transitionsByElement)
    if ("isConnected" in eventTarget && !eventTarget.isConnected)
      $bbed8b41f857bcc0$var$transitionsByElement.delete(eventTarget);
}
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
  requestAnimationFrame(() => {
    $bbed8b41f857bcc0$var$cleanupDetachedElements();
    if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0)
      fn();
    else
      $bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
  });
}
function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
  let globalListeners = reactExports.useRef(/* @__PURE__ */ new Map());
  let addGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type: type4,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type4, fn, options);
  }, []);
  let removeGlobalListener = reactExports.useCallback((eventTarget, type4, listener, options) => {
    var _globalListeners_current_get;
    let fn = ((_globalListeners_current_get = globalListeners.current.get(listener)) === null || _globalListeners_current_get === void 0 ? void 0 : _globalListeners_current_get.fn) || listener;
    eventTarget.removeEventListener(type4, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = reactExports.useCallback(() => {
    globalListeners.current.forEach((value2, key) => {
      removeGlobalListener(value2.eventTarget, value2.type, key, value2.options);
    });
  }, [
    removeGlobalListener
  ]);
  reactExports.useEffect(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$2(() => {
    if (context && context.ref && ref) {
      context.ref.current = ref.current;
      return () => {
        if (context.ref)
          context.ref.current = null;
      };
    }
  });
}
function $6a7db85432448f7f$export$60278871457622de$1(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8$1() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
  return !$c87311424ea30a05$export$a11b0059900ceec8$1() && event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
}
const $7d2416ea0959daaa$var$supportsCheckVisibility = typeof Element !== "undefined" && "checkVisibility" in Element.prototype;
function $7d2416ea0959daaa$var$isStyleVisible(element2) {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2);
  if (!(element2 instanceof windowObject.HTMLElement) && !(element2 instanceof windowObject.SVGElement))
    return false;
  let { display, visibility } = element2.style;
  let isVisible2 = display !== "none" && visibility !== "hidden" && visibility !== "collapse";
  if (isVisible2) {
    const { getComputedStyle: getComputedStyle2 } = element2.ownerDocument.defaultView;
    let { display: computedDisplay, visibility: computedVisibility } = getComputedStyle2(element2);
    isVisible2 = computedDisplay !== "none" && computedVisibility !== "hidden" && computedVisibility !== "collapse";
  }
  return isVisible2;
}
function $7d2416ea0959daaa$var$isAttributeVisible(element2, childElement) {
  return !element2.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
  !element2.hasAttribute("data-react-aria-prevent-focus") && (element2.nodeName === "DETAILS" && childElement && childElement.nodeName !== "SUMMARY" ? element2.hasAttribute("open") : true);
}
function $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2, childElement) {
  if ($7d2416ea0959daaa$var$supportsCheckVisibility)
    return element2.checkVisibility();
  return element2.nodeName !== "#comment" && $7d2416ea0959daaa$var$isStyleVisible(element2) && $7d2416ea0959daaa$var$isAttributeVisible(element2, childElement) && (!element2.parentElement || $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2.parentElement, element2));
}
const $b4b717babfbb907b$var$focusableElements = [
  "input:not([disabled]):not([type=hidden])",
  "select:not([disabled])",
  "textarea:not([disabled])",
  "button:not([disabled])",
  "a[href]",
  "area[href]",
  "summary",
  "iframe",
  "object",
  "embed",
  "audio[controls]",
  "video[controls]",
  '[contenteditable]:not([contenteditable^="false"])',
  "permission"
];
const $b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR = $b4b717babfbb907b$var$focusableElements.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
$b4b717babfbb907b$var$focusableElements.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
function $b4b717babfbb907b$export$4c063cf1350e6fed(element2) {
  return element2.matches($b4b717babfbb907b$var$FOCUSABLE_ELEMENT_SELECTOR) && $7d2416ea0959daaa$export$e989c0fffaa6b27a(element2) && !$b4b717babfbb907b$var$isInert(element2);
}
function $b4b717babfbb907b$var$isInert(element2) {
  let node2 = element2;
  while (node2 != null) {
    if (node2 instanceof node2.ownerDocument.defaultView.HTMLElement && node2.inert)
      return true;
    node2 = node2.parentElement;
  }
  return false;
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$8(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$7(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$6(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$1(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$6 = "default";
let $14c0b72509d70225$var$savedUserSelect$6 = "";
let $14c0b72509d70225$var$modifiedElementMap$6 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$6(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1()) {
    if ($14c0b72509d70225$var$state$6 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$1(target);
      $14c0b72509d70225$var$savedUserSelect$6 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$6 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$6.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$6(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1()) {
    if ($14c0b72509d70225$var$state$6 !== "disabled")
      return;
    $14c0b72509d70225$var$state$6 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430(() => {
        if ($14c0b72509d70225$var$state$6 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$1(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$6 || "";
          $14c0b72509d70225$var$savedUserSelect$6 = "";
          $14c0b72509d70225$var$state$6 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$6.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$6.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$6.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$6 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$6.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$6(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$6);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$4(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$6 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$6 = class $f6c31cce2adf654f$var$PressEvent6 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$6, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$6 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$6 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$6(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$6(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$6("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$6("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$6(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$1((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$7(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$8(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$6(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6($d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$6(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$6(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$4(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$1())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$1(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$6(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$6(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6($d4ee10de306f2510$export$e58f029f0fbfdb29(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$6(state.target) && $d4ee10de306f2510$export$4282f70798064fe0(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$6]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$6] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$6(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$6(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$6(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$1(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$6))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$6;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$6((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$4(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$6]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$6(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$6(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$6(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$1(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$6(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$6(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$6(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$6(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$6(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$6(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$6(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$6 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$6(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$6.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = false;
let $6179b936705e76d3$var$hoverCount$c = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$c() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$c(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$c();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$c() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$c);
  $6179b936705e76d3$var$hoverCount$c++;
  return () => {
    $6179b936705e76d3$var$hoverCount$c--;
    if ($6179b936705e76d3$var$hoverCount$c > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$c);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$c(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$c, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$1(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$c && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function usePaginationItem(props) {
  const {
    as: as2,
    ref,
    value: value2,
    children,
    isActive: isActive2,
    isDisabled,
    onPress,
    onClick,
    getAriaLabel,
    className,
    ...otherProps
  } = props;
  const isLink = !!(props == null ? void 0 : props.href);
  const Component2 = as2 || isLink ? "a" : "li";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
  const ariaLabel = reactExports.useMemo(
    () => isActive2 ? `${getAriaLabel == null ? void 0 : getAriaLabel(value2)} active` : getAriaLabel == null ? void 0 : getAriaLabel(value2),
    [value2, isActive2]
  );
  const { isPressed, pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$6({
    isDisabled,
    onPress
  });
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({});
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$c({ isDisabled });
  const getItemProps = (props2 = {}) => {
    return {
      ref: domRef,
      role: "button",
      tabIndex: isDisabled ? -1 : 0,
      "aria-label": ariaLabel,
      "aria-current": dataAttr(isActive2),
      "aria-disabled": dataAttr(isDisabled),
      "data-disabled": dataAttr(isDisabled),
      "data-active": dataAttr(isActive2),
      "data-focus": dataAttr(isFocused),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(
        props2,
        pressProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      ),
      className: clsx$5(className, props2.className),
      onClick: (e2) => {
        chain(pressProps == null ? void 0 : pressProps.onClick, onClick)(e2);
        if (!router.isNative && e2.currentTarget instanceof HTMLAnchorElement && e2.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
        !e2.isDefaultPrevented() && $ea8dcbcb9ea1b556$export$efa8c9099e530235(e2.currentTarget, e2) && props2.href) {
          e2.preventDefault();
          router.open(e2.currentTarget, e2, props2.href, props2.routerOptions);
        }
      }
    };
  };
  return {
    Component: Component2,
    children,
    ariaLabel,
    isFocused,
    isFocusVisible,
    getItemProps
  };
}
var PaginationItem = forwardRef((props, ref) => {
  const { Component: Component2, children, getItemProps } = usePaginationItem({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getItemProps(), children });
});
PaginationItem.displayName = "HeroUI.PaginationItem";
var pagination_item_default = PaginationItem;
const $148a7a147e38ea7f$var$RTL_SCRIPTS$8 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$8 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$8(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$8.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$8.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$8 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$8 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$8);
const $b5e257d569688ac6$var$IsSSRContext$8 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$8 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$8(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$8);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$8.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$8.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$8.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$8(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$8);
  let counter = $b5e257d569688ac6$var$useCounter$8(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$8(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$8());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$8.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$8 : $b5e257d569688ac6$var$useLegacySSRSafeId$8;
function $b5e257d569688ac6$var$getSnapshot$8() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$8() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$8(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$8() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$8, $b5e257d569688ac6$var$getSnapshot$8, $b5e257d569688ac6$var$getServerSnapshot$8);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$8);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$8 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$8] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$8(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$8 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8();
let $1e5a04cdaf7d1af8$var$listeners$8 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$8() {
  $1e5a04cdaf7d1af8$var$currentLocale$8 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$8();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$8)
    listener($1e5a04cdaf7d1af8$var$currentLocale$8);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$8() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$8();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$8);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$8.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$8);
    $1e5a04cdaf7d1af8$var$listeners$8.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$8.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$8.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$8);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$8 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$8() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$8();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$8);
  return context || defaultLocale;
}
var PaginationItemType = /* @__PURE__ */ ((PaginationItemType2) => {
  PaginationItemType2["DOTS"] = "dots";
  PaginationItemType2["PREV"] = "prev";
  PaginationItemType2["NEXT"] = "next";
  return PaginationItemType2;
})(PaginationItemType || {});
function usePagination$1(props) {
  const {
    page,
    total,
    siblings = 1,
    boundaries = 1,
    initialPage = 1,
    showControls = false,
    onChange
  } = props;
  const [activePage, setActivePage] = reactExports.useState(page || initialPage);
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$8();
  const isRTL = direction === "rtl";
  const onChangeActivePage = (newPage) => {
    setActivePage(newPage);
    onChange && onChange(newPage);
  };
  reactExports.useEffect(() => {
    if (page && page !== activePage) {
      setActivePage(page);
    }
  }, [page]);
  const setPage = reactExports.useCallback(
    (pageNumber) => {
      if (pageNumber <= 0) {
        onChangeActivePage(1);
      } else if (pageNumber > total) {
        onChangeActivePage(total);
      } else {
        onChangeActivePage(pageNumber);
      }
    },
    [total, activePage, onChangeActivePage]
  );
  const next2 = () => setPage(activePage + 1);
  const previous2 = () => setPage(activePage - 1);
  const first = () => setPage(1);
  const last = () => setPage(total);
  const formatRange = reactExports.useCallback(
    (range22) => {
      if (showControls) {
        return [
          "prev",
          ...range22,
          "next"
          /* NEXT */
        ];
      }
      return range22;
    },
    [isRTL, showControls]
  );
  const paginationRange = reactExports.useMemo(() => {
    const totalPageNumbers = siblings * 2 + 3 + boundaries * 2;
    if (totalPageNumbers >= total) {
      return formatRange(range$1(1, total));
    }
    const leftSiblingIndex = Math.max(activePage - siblings, boundaries);
    const rightSiblingIndex = Math.min(activePage + siblings, total - boundaries);
    const shouldShowLeftDots = leftSiblingIndex > boundaries + 2;
    const shouldShowRightDots = rightSiblingIndex < total - (boundaries + 1);
    if (!shouldShowLeftDots && shouldShowRightDots) {
      const leftItemCount = siblings * 2 + boundaries + 2;
      return formatRange([
        ...range$1(1, leftItemCount),
        "dots",
        ...range$1(total - (boundaries - 1), total)
      ]);
    }
    if (shouldShowLeftDots && !shouldShowRightDots) {
      const rightItemCount = boundaries + 1 + 2 * siblings;
      return formatRange([
        ...range$1(1, boundaries),
        "dots",
        ...range$1(total - rightItemCount, total)
      ]);
    }
    return formatRange([
      ...range$1(1, boundaries),
      "dots",
      ...range$1(leftSiblingIndex, rightSiblingIndex),
      "dots",
      ...range$1(total - boundaries + 1, total)
    ]);
  }, [total, activePage, siblings, boundaries, formatRange]);
  return {
    range: paginationRange,
    activePage,
    setPage,
    next: next2,
    previous: previous2,
    first,
    last
  };
}
const t$8 = (t2) => "object" == typeof t2 && null != t2 && 1 === t2.nodeType, e$4 = (t2, e2) => (!e2 || "hidden" !== t2) && ("visible" !== t2 && "clip" !== t2), n$6 = (t2, n2) => {
  if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
    const o2 = getComputedStyle(t2, null);
    return e$4(o2.overflowY, n2) || e$4(o2.overflowX, n2) || ((t3) => {
      const e2 = ((t4) => {
        if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
          return null;
        try {
          return t4.ownerDocument.defaultView.frameElement;
        } catch (t5) {
          return null;
        }
      })(t3);
      return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);
    })(t2);
  }
  return false;
}, o$3 = (t2, e2, n2, o2, l2, r2, i2, s2) => r2 < t2 && i2 > e2 || r2 > t2 && i2 < e2 ? 0 : r2 <= t2 && s2 <= n2 || i2 >= e2 && s2 >= n2 ? r2 - t2 - o2 : i2 > e2 && s2 < n2 || r2 < t2 && s2 > n2 ? i2 - e2 + l2 : 0, l$7 = (t2) => {
  const e2 = t2.parentElement;
  return null == e2 ? t2.getRootNode().host || null : e2;
}, r$7 = (e2, r2) => {
  var i2, s2, d2, h3;
  if ("undefined" == typeof document)
    return [];
  const { scrollMode: c2, block: f2, inline: u2, boundary: a2, skipOverflowHiddenElements: g2 } = r2, p2 = "function" == typeof a2 ? a2 : (t2) => t2 !== a2;
  if (!t$8(e2))
    throw new TypeError("Invalid target");
  const m2 = document.scrollingElement || document.documentElement, w2 = [];
  let W2 = e2;
  for (; t$8(W2) && p2(W2); ) {
    if (W2 = l$7(W2), W2 === m2) {
      w2.push(W2);
      break;
    }
    null != W2 && W2 === document.body && n$6(W2) && !n$6(document.documentElement) || null != W2 && n$6(W2, g2) && w2.push(W2);
  }
  const b2 = null != (s2 = null == (i2 = window.visualViewport) ? void 0 : i2.width) ? s2 : innerWidth, H2 = null != (h3 = null == (d2 = window.visualViewport) ? void 0 : d2.height) ? h3 : innerHeight, { scrollX: y2, scrollY: M2 } = window, { height: v2, width: E2, top: x2, right: C2, bottom: I2, left: R2 } = e2.getBoundingClientRect(), { top: T2, right: B2, bottom: F2, left: V3 } = ((t2) => {
    const e3 = window.getComputedStyle(t2);
    return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 };
  })(e2);
  let k2 = "start" === f2 || "nearest" === f2 ? x2 - T2 : "end" === f2 ? I2 + F2 : x2 + v2 / 2 - T2 + F2, D2 = "center" === u2 ? R2 + E2 / 2 - V3 + B2 : "end" === u2 ? C2 + B2 : R2 - V3;
  const L2 = [];
  for (let t2 = 0; t2 < w2.length; t2++) {
    const e3 = w2[t2], { height: l2, width: r3, top: i3, right: s3, bottom: d3, left: h4 } = e3.getBoundingClientRect();
    if ("if-needed" === c2 && x2 >= 0 && R2 >= 0 && I2 <= H2 && C2 <= b2 && (e3 === m2 && !n$6(e3) || x2 >= i3 && I2 <= d3 && R2 >= h4 && C2 <= s3))
      return L2;
    const a3 = getComputedStyle(e3), g3 = parseInt(a3.borderLeftWidth, 10), p3 = parseInt(a3.borderTopWidth, 10), W3 = parseInt(a3.borderRightWidth, 10), T3 = parseInt(a3.borderBottomWidth, 10);
    let B3 = 0, F3 = 0;
    const V4 = "offsetWidth" in e3 ? e3.offsetWidth - e3.clientWidth - g3 - W3 : 0, S2 = "offsetHeight" in e3 ? e3.offsetHeight - e3.clientHeight - p3 - T3 : 0, X2 = "offsetWidth" in e3 ? 0 === e3.offsetWidth ? 0 : r3 / e3.offsetWidth : 0, Y2 = "offsetHeight" in e3 ? 0 === e3.offsetHeight ? 0 : l2 / e3.offsetHeight : 0;
    if (m2 === e3)
      B3 = "start" === f2 ? k2 : "end" === f2 ? k2 - H2 : "nearest" === f2 ? o$3(M2, M2 + H2, H2, p3, T3, M2 + k2, M2 + k2 + v2, v2) : k2 - H2 / 2, F3 = "start" === u2 ? D2 : "center" === u2 ? D2 - b2 / 2 : "end" === u2 ? D2 - b2 : o$3(y2, y2 + b2, b2, g3, W3, y2 + D2, y2 + D2 + E2, E2), B3 = Math.max(0, B3 + M2), F3 = Math.max(0, F3 + y2);
    else {
      B3 = "start" === f2 ? k2 - i3 - p3 : "end" === f2 ? k2 - d3 + T3 + S2 : "nearest" === f2 ? o$3(i3, d3, l2, p3, T3 + S2, k2, k2 + v2, v2) : k2 - (i3 + l2 / 2) + S2 / 2, F3 = "start" === u2 ? D2 - h4 - g3 : "center" === u2 ? D2 - (h4 + r3 / 2) + V4 / 2 : "end" === u2 ? D2 - s3 + W3 + V4 : o$3(h4, s3, r3, g3, W3 + V4, D2, D2 + E2, E2);
      const { scrollLeft: t3, scrollTop: n2 } = e3;
      B3 = 0 === Y2 ? 0 : Math.max(0, Math.min(n2 + B3 / Y2, e3.scrollHeight - l2 / Y2 + S2)), F3 = 0 === X2 ? 0 : Math.max(0, Math.min(t3 + F3 / X2, e3.scrollWidth - r3 / X2 + V4)), k2 += n2 - B3, D2 += t3 - F3;
    }
    L2.push({ el: e3, top: B3, left: F3 });
  }
  return L2;
};
const o$2 = (e2) => false === e2 ? { block: "end", inline: "nearest" } : ((e3) => e3 === Object(e3) && 0 !== Object.keys(e3).length)(e2) ? e2 : { block: "start", inline: "nearest" };
function t$7(t2, n2) {
  if (!t2.isConnected || !((e2) => {
    let o2 = e2;
    for (; o2 && o2.parentNode; ) {
      if (o2.parentNode === document)
        return true;
      o2 = o2.parentNode instanceof ShadowRoot ? o2.parentNode.host : o2.parentNode;
    }
    return false;
  })(t2))
    return;
  if (((e2) => "object" == typeof e2 && "function" == typeof e2.behavior)(n2))
    return n2.behavior(r$7(t2, n2));
  const r2 = "boolean" == typeof n2 || null == n2 ? void 0 : n2.behavior;
  for (const { el: i2, top: a2, left: l2 } of r$7(t2, o$2(n2)))
    i2.scroll({ top: a2, left: l2, behavior: r2 });
}
function useIntersectionObserver({
  threshold = 0,
  root: root2 = null,
  rootMargin = "0%",
  isEnabled = true,
  freezeOnceVisible = false,
  initialIsIntersecting = false,
  onChange
} = {}) {
  var _a2;
  const [ref, setRef2] = reactExports.useState(null);
  const [state, setState] = reactExports.useState(() => ({
    isIntersecting: initialIsIntersecting,
    entry: void 0
  }));
  const callbackRef = reactExports.useRef();
  callbackRef.current = onChange;
  const frozen = ((_a2 = state.entry) == null ? void 0 : _a2.isIntersecting) && freezeOnceVisible;
  reactExports.useEffect(() => {
    if (!isEnabled)
      return;
    if (!ref)
      return;
    if (!("IntersectionObserver" in window))
      return;
    if (frozen)
      return;
    const observer = new IntersectionObserver(
      (entries) => {
        const thresholds2 = Array.isArray(observer.thresholds) ? observer.thresholds : [observer.thresholds];
        entries.forEach((entry) => {
          const isIntersecting = entry.isIntersecting && thresholds2.some((threshold2) => entry.intersectionRatio >= threshold2);
          setState({ isIntersecting, entry });
          if (callbackRef.current) {
            callbackRef.current(isIntersecting, entry);
          }
        });
      },
      { threshold, root: root2, rootMargin }
    );
    observer.observe(ref);
    return () => {
      observer.disconnect();
    };
  }, [ref, isEnabled, JSON.stringify(threshold), root2, rootMargin, frozen, freezeOnceVisible]);
  const prevRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    var _a22;
    if (!ref && ((_a22 = state.entry) == null ? void 0 : _a22.target) && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
      prevRef.current = state.entry.target;
      setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
    }
  }, [ref, state.entry, freezeOnceVisible, frozen, initialIsIntersecting]);
  const result = [setRef2, !!state.isIntersecting, state.entry];
  result.ref = result[0];
  result.isIntersecting = result[1];
  result.entry = result[2];
  return result;
}
var CURSOR_TRANSITION_TIMEOUT = 300;
function usePagination(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, pagination.variantKeys);
  const {
    as: as2,
    ref,
    classNames: classNames2,
    dotsJump = 5,
    loop: loop2 = false,
    showControls = false,
    total = 1,
    initialPage = 1,
    page,
    siblings,
    boundaries,
    onChange,
    className,
    renderItem: renderItem2,
    getItemAriaLabel: getItemAriaLabelProp,
    ...otherProps
  } = props;
  const Component2 = as2 || "nav";
  const domRef = useDOMRef(ref);
  const cursorRef = reactExports.useRef(null);
  const itemsRef = reactExports.useRef();
  const cursorTimer = reactExports.useRef();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const disableCursorAnimation = (_d = (_c2 = originalProps == null ? void 0 : originalProps.disableCursorAnimation) != null ? _c2 : disableAnimation) != null ? _d : false;
  function getItemsRefMap() {
    if (!itemsRef.current) {
      itemsRef.current = /* @__PURE__ */ new Map();
    }
    return itemsRef.current;
  }
  function getItemRef(node2, value2) {
    const map2 = getItemsRefMap();
    if (node2) {
      map2.set(value2, node2);
    } else {
      map2.delete(value2);
    }
  }
  function scrollTo(value2, skipAnimation) {
    const map2 = getItemsRefMap();
    const node2 = map2.get(value2);
    if (!node2 || !cursorRef.current)
      return;
    cursorTimer.current && clearTimeout(cursorTimer.current);
    t$7(node2, {
      scrollMode: "always",
      behavior: "smooth",
      block: "start",
      inline: "start",
      boundary: domRef.current
    });
    const { offsetLeft } = node2;
    if (skipAnimation) {
      cursorRef.current.setAttribute("data-moving", "false");
      cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
      return;
    }
    cursorRef.current.setAttribute("data-moving", "true");
    cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1.1)`;
    cursorTimer.current = setTimeout(() => {
      if (cursorRef.current) {
        cursorRef.current.style.transform = `translateX(${offsetLeft}px) scale(1)`;
      }
      cursorTimer.current = setTimeout(() => {
        var _a22;
        (_a22 = cursorRef.current) == null ? void 0 : _a22.setAttribute("data-moving", "false");
        cursorTimer.current && clearTimeout(cursorTimer.current);
      }, CURSOR_TRANSITION_TIMEOUT);
    }, CURSOR_TRANSITION_TIMEOUT);
  }
  const { range: range3, activePage, setPage, previous: previous2, next: next2, first, last } = usePagination$1({
    page,
    total,
    initialPage,
    siblings,
    boundaries,
    showControls,
    onChange
  });
  const [setRef2, isVisible2] = useIntersectionObserver();
  reactExports.useEffect(() => {
    if (domRef.current) {
      setRef2(domRef.current);
    }
  }, [domRef.current]);
  const activePageRef = reactExports.useRef(activePage);
  reactExports.useEffect(() => {
    if (activePage && !disableAnimation && isVisible2) {
      scrollTo(activePage, activePage === activePageRef.current);
    }
    activePageRef.current = activePage;
  }, [
    page,
    activePage,
    disableAnimation,
    disableCursorAnimation,
    isVisible2,
    originalProps.dotsJump,
    originalProps.isCompact,
    originalProps.showControls
  ]);
  const slots = reactExports.useMemo(
    () => pagination({
      ...variantProps2,
      disableAnimation,
      disableCursorAnimation
    }),
    [objectToDeps(variantProps2), disableCursorAnimation, disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const onNext = () => {
    if (loop2 && activePage === total) {
      return first();
    }
    return next2();
  };
  const onPrevious = () => {
    if (loop2 && activePage === 1) {
      return last();
    }
    return previous2();
  };
  const getBaseProps = (props2 = {}) => {
    return {
      ...props2,
      ref: domRef,
      role: "navigation",
      "aria-label": props2["aria-label"] || "pagination navigation",
      "data-slot": "base",
      "data-controls": dataAttr(showControls),
      "data-loop": dataAttr(loop2),
      "data-dots-jump": dotsJump,
      "data-total": total,
      "data-active-page": activePage,
      className: slots.base({ class: clsx$5(baseStyles, props2 == null ? void 0 : props2.className) }),
      ...otherProps
    };
  };
  const getWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      "data-slot": "wrapper",
      className: slots.wrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) })
    };
  };
  const getItemAriaLabel = (page2) => {
    if (!page2)
      return;
    if (getItemAriaLabelProp) {
      return getItemAriaLabelProp(page2);
    }
    switch (page2) {
      case PaginationItemType.DOTS:
        return "dots element";
      case PaginationItemType.PREV:
        return "previous page button";
      case PaginationItemType.NEXT:
        return "next page button";
      case "first":
        return "first page button";
      case "last":
        return "last page button";
      default:
        return `pagination item ${page2}`;
    }
  };
  const getItemProps = (props2 = {}) => {
    return {
      ...props2,
      ref: (node2) => getItemRef(node2, props2.value),
      "data-slot": "item",
      isActive: props2.value === activePage,
      className: slots.item({ class: clsx$5(classNames2 == null ? void 0 : classNames2.item, props2 == null ? void 0 : props2.className) }),
      onPress: () => {
        if (props2.value !== activePage) {
          setPage(props2.value);
        }
      }
    };
  };
  const getCursorProps = (props2 = {}) => {
    return {
      ...props2,
      ref: cursorRef,
      activePage,
      "data-slot": "cursor",
      className: slots.cursor({ class: clsx$5(classNames2 == null ? void 0 : classNames2.cursor, props2 == null ? void 0 : props2.className) })
    };
  };
  return {
    Component: Component2,
    showControls,
    dotsJump,
    slots,
    classNames: classNames2,
    loop: loop2,
    total,
    range: range3,
    activePage,
    getItemRef,
    disableAnimation,
    disableCursorAnimation,
    setPage,
    onPrevious,
    onNext,
    renderItem: renderItem2,
    getBaseProps,
    getWrapperProps,
    getItemProps,
    getCursorProps,
    getItemAriaLabel
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$7 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$7 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$7(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$7.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$7.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$7 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$7] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$7(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$7 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7();
let $1e5a04cdaf7d1af8$var$listeners$7 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$7() {
  $1e5a04cdaf7d1af8$var$currentLocale$7 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$7();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$7)
    listener($1e5a04cdaf7d1af8$var$currentLocale$7);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$7() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$9();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$7);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$7.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$7);
    $1e5a04cdaf7d1af8$var$listeners$7.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$7.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$7.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$7);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$7 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$7() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$7();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$7);
  return context || defaultLocale;
}
var Pagination = forwardRef((props, ref) => {
  const {
    Component: Component2,
    dotsJump,
    slots,
    classNames: classNames2,
    total,
    range: range3,
    loop: loop2,
    activePage,
    disableCursorAnimation,
    disableAnimation,
    renderItem: renderItemProp,
    onNext,
    onPrevious,
    setPage,
    getItemAriaLabel,
    getItemRef,
    getBaseProps,
    getWrapperProps,
    getItemProps,
    getCursorProps
  } = usePagination({ ...props, ref });
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$7();
  const isRTL = direction === "rtl";
  const renderChevronIcon = reactExports.useCallback(
    (key) => {
      if (key === PaginationItemType.PREV && !isRTL || key === PaginationItemType.NEXT && isRTL) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronIcon, {});
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChevronIcon,
        {
          className: slots.chevronNext({
            class: classNames2 == null ? void 0 : classNames2.chevronNext
          })
        }
      );
    },
    [slots, isRTL]
  );
  const renderPrevItem = reactExports.useCallback(
    (value2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_item_default,
        {
          className: slots.prev({
            class: classNames2 == null ? void 0 : classNames2.prev
          }),
          "data-slot": "prev",
          getAriaLabel: getItemAriaLabel,
          isDisabled: !loop2 && activePage === 1,
          value: value2,
          onPress: onPrevious,
          children: renderChevronIcon(PaginationItemType.PREV)
        },
        PaginationItemType.PREV
      );
    },
    [slots, classNames2, loop2, activePage, isRTL, total, getItemAriaLabel, onPrevious]
  );
  const renderNextItem = reactExports.useCallback(
    (value2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_item_default,
        {
          className: slots.next({
            class: clsx$5(classNames2 == null ? void 0 : classNames2.next)
          }),
          "data-slot": "next",
          getAriaLabel: getItemAriaLabel,
          isDisabled: !loop2 && activePage === total,
          value: value2,
          onPress: onNext,
          children: renderChevronIcon(PaginationItemType.NEXT)
        },
        PaginationItemType.NEXT
      );
    },
    [slots, classNames2, loop2, activePage, isRTL, total, getItemAriaLabel, onNext]
  );
  const renderItem2 = reactExports.useCallback(
    (value2, index2) => {
      const isBefore2 = index2 < range3.indexOf(activePage);
      if (renderItemProp && typeof renderItemProp === "function") {
        let page = typeof value2 == "number" ? value2 : index2;
        if (value2 === PaginationItemType.NEXT) {
          page = activePage + 1;
        }
        if (value2 === PaginationItemType.PREV) {
          page = activePage - 1;
        }
        if (value2 === PaginationItemType.DOTS) {
          page = isBefore2 ? activePage - dotsJump >= 1 ? activePage - dotsJump : 1 : activePage + dotsJump <= total ? activePage + dotsJump : total;
        }
        const itemChildren = {
          [PaginationItemType.PREV]: renderChevronIcon(PaginationItemType.PREV),
          [PaginationItemType.NEXT]: renderChevronIcon(PaginationItemType.NEXT),
          [PaginationItemType.DOTS]: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames2 == null ? void 0 : classNames2.ellipsis }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ForwardIcon,
              {
                className: slots == null ? void 0 : slots.forwardIcon({ class: classNames2 == null ? void 0 : classNames2.forwardIcon }),
                "data-before": dataAttr(isBefore2)
              }
            )
          ] })
        };
        return renderItemProp({
          value: value2,
          index: index2,
          key: `${value2}-${index2}`,
          page,
          total,
          children: typeof value2 === "number" ? value2 : itemChildren[value2],
          activePage,
          dotsJump,
          isBefore: isBefore2,
          isActive: value2 === activePage,
          isPrevious: value2 === activePage - 1,
          isNext: value2 === activePage + 1,
          isFirst: value2 === 1,
          isLast: value2 === total,
          onNext,
          onPrevious,
          setPage,
          onPress: () => setPage(page),
          ref: typeof value2 === "number" ? (node2) => getItemRef(node2, value2) : void 0,
          className: slots.item({ class: classNames2 == null ? void 0 : classNames2.item }),
          getAriaLabel: getItemAriaLabel
        });
      }
      if (value2 === PaginationItemType.PREV) {
        return renderPrevItem(value2);
      }
      if (value2 === PaginationItemType.NEXT) {
        return renderNextItem(value2);
      }
      if (value2 === PaginationItemType.DOTS) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          pagination_item_default,
          {
            className: slots.item({
              class: clsx$5(classNames2 == null ? void 0 : classNames2.item, "group")
            }),
            "data-slot": "item",
            getAriaLabel: getItemAriaLabel,
            value: value2,
            onPress: () => isBefore2 ? setPage(activePage - dotsJump >= 1 ? activePage - dotsJump : 1) : setPage(activePage + dotsJump <= total ? activePage + dotsJump : total),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisIcon, { className: slots == null ? void 0 : slots.ellipsis({ class: classNames2 == null ? void 0 : classNames2.ellipsis }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ForwardIcon,
                {
                  className: slots == null ? void 0 : slots.forwardIcon({ class: classNames2 == null ? void 0 : classNames2.forwardIcon }),
                  "data-before": dataAttr(isRTL ? !isBefore2 : isBefore2)
                }
              )
            ]
          },
          PaginationItemType.DOTS + isBefore2
        );
      }
      return /* @__PURE__ */ reactExports.createElement(pagination_item_default, { ...getItemProps({ value: value2 }), key: value2, getAriaLabel: getItemAriaLabel }, value2);
    },
    [
      isRTL,
      activePage,
      dotsJump,
      getItemProps,
      loop2,
      range3,
      renderItemProp,
      slots,
      classNames2,
      total,
      getItemAriaLabel,
      onNext,
      onPrevious,
      setPage,
      renderPrevItem,
      renderNextItem
    ]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { ...getWrapperProps(), children: [
    !disableCursorAnimation && !disableAnimation && /* @__PURE__ */ jsxRuntimeExports.jsx(pagination_cursor_default, { ...getCursorProps() }),
    range3.map(renderItem2)
  ] }) });
});
Pagination.displayName = "HeroUI.Pagination";
var pagination_default = Pagination;
let $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
let $a54cdc5c1942b639$var$i = 0;
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
  let name2 = reactExports.useMemo(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
    props.name
  ]);
  var _props_defaultValue;
  let [selectedValue, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let [lastFocusedValue, setLastFocusedValue] = reactExports.useState(null);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: selectedValue
  });
  let setSelectedValue = (value2) => {
    if (!props.isReadOnly && !props.isDisabled) {
      setSelected(value2);
      validation.commitValidation();
    }
  };
  let isInvalid = validation.displayValidation.isInvalid;
  return {
    ...validation,
    name: name2,
    selectedValue,
    setSelectedValue,
    lastFocusedValue,
    setLastFocusedValue,
    isDisabled: props.isDisabled || false,
    isReadOnly: props.isReadOnly || false,
    isRequired: props.isRequired || false,
    validationState: props.validationState || (isInvalid ? "invalid" : null),
    isInvalid
  };
}
const $884aeceb3d67f00f$export$37b65e5b5444d35c = /* @__PURE__ */ new WeakMap();
function $0d5c49892c1215da$export$37b0961d2f4751e2(props, state, ref) {
  let { value: value2, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby } = props;
  const isDisabled = props.isDisabled || state.isDisabled;
  let checked = state.selectedValue === value2;
  let onChange = (e2) => {
    e2.stopPropagation();
    state.setSelectedValue(value2);
  };
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled
  });
  let { pressProps: labelProps, isPressed: isLabelPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled,
    onPress() {
      var _ref_current;
      state.setSelectedValue(value2);
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
    }
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2($3ef42575df84b30b$export$9d1611c77c2fe928$9(props, {
    onFocus: () => state.setLastFocusedValue(value2)
  }), ref);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, focusableProps);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let tabIndex = -1;
  if (state.selectedValue != null) {
    if (state.selectedValue === value2)
      tabIndex = 0;
  } else if (state.lastFocusedValue === value2 || state.lastFocusedValue == null)
    tabIndex = 0;
  if (isDisabled)
    tabIndex = void 0;
  let { name: name2, descriptionId, errorMessageId, validationBehavior } = $884aeceb3d67f00f$export$37b65e5b5444d35c.get(state);
  $99facab73266f662$export$5add1d006293d136(ref, state.selectedValue, state.setSelectedValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1({
    validationBehavior
  }, state, ref);
  return {
    labelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      onClick: (e2) => e2.preventDefault()
    }),
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      ...interactions,
      type: "radio",
      name: name2,
      tabIndex,
      disabled: isDisabled,
      required: state.isRequired && validationBehavior === "native",
      checked,
      value: value2,
      onChange,
      "aria-describedby": [
        props["aria-describedby"],
        state.isInvalid ? errorMessageId : null,
        descriptionId
      ].filter(Boolean).join(" ") || void 0
    }),
    isDisabled,
    isSelected: checked,
    isPressed: isPressed || isLabelPressed
  };
}
function $9bf71ea28793e738$var$isTabbableRadio$4(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$4(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$4(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$4(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$4(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$4 = class $9bf71ea28793e738$var$Tree4 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$4({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$4(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree4();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$4({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$4 = class $9bf71ea28793e738$var$TreeNode4 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$4();
function $430f30ed08ec25fa$export$62b9571f283ff5c2(props, state) {
  let { name: name2, isReadOnly, isRequired, isDisabled, orientation = "vertical", validationBehavior = "aria" } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    // Radio group is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span",
    isInvalid: state.isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onBlurWithin(e2) {
      var _props_onBlur;
      (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
      if (!state.selectedValue)
        state.setLastFocusedValue(null);
    },
    onFocusWithin: props.onFocus,
    onFocusWithinChange: props.onFocusChange
  });
  let onKeyDown = (e2) => {
    let nextDir;
    switch (e2.key) {
      case "ArrowRight":
        if (direction === "rtl" && orientation !== "vertical")
          nextDir = "prev";
        else
          nextDir = "next";
        break;
      case "ArrowLeft":
        if (direction === "rtl" && orientation !== "vertical")
          nextDir = "next";
        else
          nextDir = "prev";
        break;
      case "ArrowDown":
        nextDir = "next";
        break;
      case "ArrowUp":
        nextDir = "prev";
        break;
      default:
        return;
    }
    e2.preventDefault();
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$4(e2.currentTarget, {
      from: e2.target
    });
    let nextElem;
    if (nextDir === "next") {
      nextElem = walker.nextNode();
      if (!nextElem) {
        walker.currentNode = e2.currentTarget;
        nextElem = walker.firstChild();
      }
    } else {
      nextElem = walker.previousNode();
      if (!nextElem) {
        walker.currentNode = e2.currentTarget;
        nextElem = walker.lastChild();
      }
    }
    if (nextElem) {
      nextElem.focus();
      state.setSelectedValue(nextElem.value);
    }
  };
  let groupName = $bdb11010cef70236$export$f680877a34711e37$2(name2);
  $884aeceb3d67f00f$export$37b65e5b5444d35c.set(state, {
    name: groupName,
    descriptionId: descriptionProps.id,
    errorMessageId: errorMessageProps.id,
    validationBehavior
  });
  return {
    radioGroupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      // https://www.w3.org/TR/wai-aria-1.2/#radiogroup
      role: "radiogroup",
      onKeyDown,
      "aria-invalid": state.isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-readonly": isReadOnly || void 0,
      "aria-required": isRequired || void 0,
      "aria-disabled": isDisabled || void 0,
      "aria-orientation": orientation,
      ...fieldProps,
      ...focusWithinProps
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useRadioGroup(props) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const {
    as: as2,
    ref,
    classNames: classNames2,
    children,
    label,
    value: value2,
    name: name2,
    isInvalid: isInvalidProp,
    validationState,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    size: size2 = "md",
    color: color2 = "primary",
    isDisabled = false,
    disableAnimation = (_b2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false,
    orientation = "vertical",
    isRequired = false,
    isReadOnly,
    errorMessage,
    description,
    className,
    onChange,
    onValueChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const otherPropsWithOrientation = reactExports.useMemo(() => {
    return {
      ...otherProps,
      value: value2,
      name: name2,
      "aria-label": safeAriaLabel(otherProps["aria-label"], label),
      isRequired,
      isReadOnly,
      isInvalid: validationState === "invalid" || isInvalidProp,
      orientation,
      validationBehavior,
      onChange: onValueChange
    };
  }, [
    otherProps,
    value2,
    name2,
    label,
    isRequired,
    isReadOnly,
    isInvalidProp,
    validationState,
    validationBehavior,
    orientation,
    onValueChange
  ]);
  const groupState = $a54cdc5c1942b639$export$bca9d026f8e704eb(otherPropsWithOrientation);
  const {
    labelProps,
    radioGroupProps: groupProps,
    errorMessageProps,
    descriptionProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails
  } = $430f30ed08ec25fa$export$62b9571f283ff5c2(otherPropsWithOrientation, groupState);
  const isInvalid = otherPropsWithOrientation.isInvalid || isAriaInvalid || groupState.isInvalid;
  const context = reactExports.useMemo(
    () => ({
      size: size2,
      color: color2,
      groupState,
      isRequired,
      isInvalid,
      isDisabled,
      disableAnimation,
      onChange
    }),
    [
      size2,
      color2,
      isRequired,
      isDisabled,
      isInvalid,
      onChange,
      disableAnimation,
      groupState.name,
      groupState.isDisabled,
      groupState.isReadOnly,
      groupState.isRequired,
      groupState.selectedValue,
      groupState.lastFocusedValue
    ]
  );
  const slots = reactExports.useMemo(
    () => radioGroup({ isRequired, isInvalid, disableAnimation }),
    [isInvalid, isRequired, disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getGroupProps = reactExports.useCallback(() => {
    return {
      ref: domRef,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      )
    };
  }, [domRef, slots, baseStyles, groupProps, otherProps]);
  const getLabelProps = reactExports.useCallback(() => {
    return {
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...labelProps
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.label, labelProps, classNames2 == null ? void 0 : classNames2.label]);
  const getWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      role: "presentation",
      "data-orientation": orientation
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.wrapper, orientation, slots.wrapper]);
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description, descriptionProps, slots.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.errorMessage, errorMessageProps]
  );
  return {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  };
}
var [RadioGroupProvider, useRadioGroupContext] = createContext2({
  name: "RadioGroupContext",
  strict: false
});
var RadioGroup = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    label,
    context,
    description,
    isInvalid,
    errorMessage,
    getGroupProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getErrorMessageProps
  } = useRadioGroup({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getGroupProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RadioGroupProvider, { value: context, children }) }),
    isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) : null
  ] });
});
RadioGroup.displayName = "HeroUI.RadioGroup";
var radio_group_default = RadioGroup;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = false;
let $6179b936705e76d3$var$hoverCount$b = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$b() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$b(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$b();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$b() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$b);
  $6179b936705e76d3$var$hoverCount$b++;
  return () => {
    $6179b936705e76d3$var$hoverCount$b--;
    if ($6179b936705e76d3$var$hoverCount$b > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$b);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$b(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$b, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$b && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useRadio(props) {
  var _a2, _b2, _c2, _d, _e;
  const globalContext = useProviderContext();
  const groupContext = useRadioGroupContext();
  const {
    as: as2,
    ref,
    classNames: classNames2,
    id: id2,
    value: value2,
    children,
    description,
    size: size2 = (_a2 = groupContext == null ? void 0 : groupContext.size) != null ? _a2 : "md",
    color: color2 = (_b2 = groupContext == null ? void 0 : groupContext.color) != null ? _b2 : "primary",
    isDisabled: isDisabledProp = (_c2 = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _c2 : false,
    disableAnimation = (_e = (_d = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _d : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _e : false,
    onChange = groupContext == null ? void 0 : groupContext.onChange,
    autoFocus = false,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = useDOMRef(ref);
  const inputRef = reactExports.useRef(null);
  const labelId = reactExports.useId();
  const descriptionId = reactExports.useId();
  const isRequired = reactExports.useMemo(() => {
    var _a22;
    return (_a22 = groupContext.isRequired) != null ? _a22 : false;
  }, [groupContext.isRequired]);
  const isInvalid = groupContext.isInvalid;
  const ariaRadioProps = reactExports.useMemo(() => {
    const ariaDescribedBy = [otherProps["aria-describedby"], descriptionId].filter(Boolean).join(" ") || void 0;
    return {
      id: id2,
      isRequired,
      isDisabled: isDisabledProp,
      "aria-label": otherProps["aria-label"],
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      "aria-describedby": ariaDescribedBy
    };
  }, [
    id2,
    isDisabledProp,
    isRequired,
    description,
    otherProps["aria-label"],
    otherProps["aria-labelledby"],
    otherProps["aria-describedby"],
    descriptionId
  ]);
  const { inputProps, isDisabled, isSelected, isPressed } = $0d5c49892c1215da$export$37b0961d2f4751e2(
    {
      value: value2,
      children: typeof children === "function" ? true : children,
      ...ariaRadioProps
    },
    groupContext.groupState,
    inputRef
  );
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const interactionDisabled = isDisabled || inputProps.readOnly;
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$b({
    isDisabled: interactionDisabled
  });
  const pressed = interactionDisabled ? false : isPressed;
  const slots = reactExports.useMemo(
    () => radio({
      color: color2,
      size: size2,
      isInvalid,
      isDisabled,
      disableAnimation
    }),
    [color2, size2, isDisabled, isInvalid, disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ref: domRef,
        className: slots.base({ class: baseStyles }),
        "data-disabled": dataAttr(isDisabled),
        "data-focus": dataAttr(isFocused),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-selected": dataAttr(isSelected),
        "data-invalid": dataAttr(isInvalid),
        "data-hover": dataAttr(isHovered),
        "data-pressed": dataAttr(pressed),
        "data-hover-unselected": dataAttr(isHovered && !isSelected),
        "data-readonly": dataAttr(inputProps.readOnly),
        "aria-required": dataAttr(isRequired),
        ...mergeProps$3(hoverProps, otherProps)
      };
    },
    [
      slots,
      baseStyles,
      domRef,
      isDisabled,
      isFocused,
      isFocusVisible,
      isSelected,
      isInvalid,
      isHovered,
      pressed,
      inputProps.readOnly,
      isRequired,
      otherProps
    ]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$5(slots.wrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.wrapper, props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputRef,
        ...mergeProps$3(props2, inputProps, focusProps),
        className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
        onChange: chain(inputProps.onChange, onChange)
      };
    },
    [inputProps, focusProps, onChange]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: labelId,
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected, isInvalid]
  );
  const getLabelWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.labelWrapper]
  );
  const getControlProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.control({ class: classNames2 == null ? void 0 : classNames2.control })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.control]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: descriptionId,
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  return {
    Component: Component2,
    children,
    isSelected,
    isDisabled,
    isInvalid,
    isFocusVisible,
    description,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getLabelWrapperProps,
    getControlProps,
    getDescriptionProps
  };
}
var Radio = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    description,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getLabelWrapperProps,
    getControlProps,
    getDescriptionProps
  } = useRadio({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getControlProps() }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getLabelWrapperProps(), children: [
      children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children }),
      description && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] })
  ] });
});
Radio.displayName = "HeroUI.Radio";
var radio_default = Radio;
var transformValue = (text2) => {
  return text2.replace(/[\u00A0]/g, " ");
};
function useClipboard({ timeout = 2e3 } = {}) {
  const [error2, setError] = reactExports.useState(null);
  const [copied, setCopied] = reactExports.useState(false);
  const [copyTimeout, setCopyTimeout] = reactExports.useState(null);
  const onClearTimeout = reactExports.useCallback(() => {
    if (copyTimeout) {
      clearTimeout(copyTimeout);
    }
  }, [copyTimeout]);
  const handleCopyResult = reactExports.useCallback(
    (value2) => {
      onClearTimeout();
      setCopyTimeout(setTimeout(() => setCopied(false), timeout));
      setCopied(value2);
    },
    [onClearTimeout, timeout]
  );
  const copy2 = reactExports.useCallback(
    (valueToCopy) => {
      if ("clipboard" in navigator) {
        const transformedValue = typeof valueToCopy === "string" ? transformValue(valueToCopy) : valueToCopy;
        navigator.clipboard.writeText(transformedValue).then(() => handleCopyResult(true)).catch((err) => setError(err));
      } else {
        setError(new Error("useClipboard: navigator.clipboard is not supported"));
      }
    },
    [handleCopyResult]
  );
  const reset = reactExports.useCallback(() => {
    setCopied(false);
    setError(null);
    onClearTimeout();
  }, [onClearTimeout]);
  return { copy: copy2, reset, error: error2, copied };
}
function useSnippet(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, snippet.variantKeys);
  const {
    ref,
    as: as2,
    children,
    symbol = "$",
    classNames: classNames2,
    timeout,
    copyIcon,
    checkIcon,
    codeString,
    disableCopy = false,
    disableTooltip = false,
    hideCopyButton = false,
    autoFocus = false,
    hideSymbol = false,
    onCopy: onCopyProp,
    tooltipProps: userTooltipProps = {},
    copyButtonProps: userButtonProps = {},
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const tooltipProps = {
    offset: 15,
    delay: 1e3,
    content: "Copy to clipboard",
    color: (_d = originalProps == null ? void 0 : originalProps.color) != null ? _d : (_c2 = snippet.defaultVariants) == null ? void 0 : _c2.color,
    isDisabled: props.disableCopy,
    ...userTooltipProps
  };
  const domRef = useDOMRef(ref);
  const preRef = reactExports.useRef(null);
  const { copy: copy2, copied } = useClipboard({ timeout });
  const isMultiLine = children && Array.isArray(children);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const slots = reactExports.useMemo(
    () => snippet({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const symbolBefore = reactExports.useMemo(() => {
    if (!symbol || typeof symbol !== "string")
      return symbol;
    const str = symbol.trim();
    return str ? `${str} ` : "";
  }, [symbol]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getSnippetProps = reactExports.useCallback(
    () => ({
      className: slots.base({
        class: baseStyles
      }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      })
    }),
    [slots, baseStyles, isMultiLine, otherProps]
  );
  const onCopy = reactExports.useCallback(() => {
    var _a22;
    if (disableCopy) {
      return;
    }
    let stringValue = "";
    if (typeof children === "string") {
      stringValue = children;
    } else if (Array.isArray(children)) {
      children.forEach((child) => {
        var _a3, _b22;
        const childString = typeof child === "string" ? child : (_b22 = (_a3 = child == null ? void 0 : child.props) == null ? void 0 : _a3.children) == null ? void 0 : _b22.toString();
        if (childString) {
          stringValue += childString + "\n";
        }
      });
    }
    const valueToCopy = codeString || stringValue || ((_a22 = preRef.current) == null ? void 0 : _a22.textContent) || "";
    copy2(valueToCopy);
    onCopyProp == null ? void 0 : onCopyProp(valueToCopy);
  }, [copy2, codeString, disableCopy, onCopyProp, children]);
  const copyButtonProps = {
    "aria-label": typeof tooltipProps.content === "string" ? tooltipProps.content : "Copy to clipboard",
    size: "sm",
    variant: "light",
    isDisabled: disableCopy,
    onPress: onCopy,
    isIconOnly: true,
    ...userButtonProps
  };
  const getCopyButtonProps = reactExports.useCallback(
    () => ({
      ...copyButtonProps,
      "data-copied": dataAttr(copied),
      className: slots.copyButton({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.copyButton)
      })
    }),
    [
      slots,
      isFocusVisible,
      isFocused,
      disableCopy,
      classNames2 == null ? void 0 : classNames2.copyButton,
      copyButtonProps,
      focusProps
    ]
  );
  return {
    Component: Component2,
    as: as2,
    domRef,
    preRef,
    children,
    slots,
    classNames: classNames2,
    copied,
    onCopy,
    copyIcon,
    checkIcon,
    symbolBefore,
    isMultiLine,
    isFocusVisible,
    hideCopyButton,
    disableCopy,
    disableTooltip,
    hideSymbol,
    tooltipProps,
    getSnippetProps,
    getCopyButtonProps
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6$2(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
const $8796f90736e175cb$var$TOOLTIP_DELAY = 1500;
const $8796f90736e175cb$var$TOOLTIP_COOLDOWN = 500;
let $8796f90736e175cb$var$tooltips = {};
let $8796f90736e175cb$var$tooltipId = 0;
let $8796f90736e175cb$var$globalWarmedUp = false;
let $8796f90736e175cb$var$globalWarmUpTimeout = null;
let $8796f90736e175cb$var$globalCooldownTimeout = null;
function $8796f90736e175cb$export$4d40659c25ecb50b(props = {}) {
  let { delay: delay2 = $8796f90736e175cb$var$TOOLTIP_DELAY, closeDelay = $8796f90736e175cb$var$TOOLTIP_COOLDOWN } = props;
  let { isOpen, open, close } = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let id2 = reactExports.useMemo(() => `${++$8796f90736e175cb$var$tooltipId}`, []);
  let closeTimeout = reactExports.useRef(null);
  let closeCallback = reactExports.useRef(close);
  let ensureTooltipEntry = () => {
    $8796f90736e175cb$var$tooltips[id2] = hideTooltip;
  };
  let closeOpenTooltips = () => {
    for (let hideTooltipId in $8796f90736e175cb$var$tooltips)
      if (hideTooltipId !== id2) {
        $8796f90736e175cb$var$tooltips[hideTooltipId](true);
        delete $8796f90736e175cb$var$tooltips[hideTooltipId];
      }
  };
  let showTooltip = () => {
    if (closeTimeout.current)
      clearTimeout(closeTimeout.current);
    closeTimeout.current = null;
    closeOpenTooltips();
    ensureTooltipEntry();
    $8796f90736e175cb$var$globalWarmedUp = true;
    open();
    if ($8796f90736e175cb$var$globalWarmUpTimeout) {
      clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
      $8796f90736e175cb$var$globalWarmUpTimeout = null;
    }
    if ($8796f90736e175cb$var$globalCooldownTimeout) {
      clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
      $8796f90736e175cb$var$globalCooldownTimeout = null;
    }
  };
  let hideTooltip = (immediate) => {
    if (immediate || closeDelay <= 0) {
      if (closeTimeout.current)
        clearTimeout(closeTimeout.current);
      closeTimeout.current = null;
      closeCallback.current();
    } else if (!closeTimeout.current)
      closeTimeout.current = setTimeout(() => {
        closeTimeout.current = null;
        closeCallback.current();
      }, closeDelay);
    if ($8796f90736e175cb$var$globalWarmUpTimeout) {
      clearTimeout($8796f90736e175cb$var$globalWarmUpTimeout);
      $8796f90736e175cb$var$globalWarmUpTimeout = null;
    }
    if ($8796f90736e175cb$var$globalWarmedUp) {
      if ($8796f90736e175cb$var$globalCooldownTimeout)
        clearTimeout($8796f90736e175cb$var$globalCooldownTimeout);
      $8796f90736e175cb$var$globalCooldownTimeout = setTimeout(() => {
        delete $8796f90736e175cb$var$tooltips[id2];
        $8796f90736e175cb$var$globalCooldownTimeout = null;
        $8796f90736e175cb$var$globalWarmedUp = false;
      }, Math.max($8796f90736e175cb$var$TOOLTIP_COOLDOWN, closeDelay));
    }
  };
  let warmupTooltip = () => {
    closeOpenTooltips();
    ensureTooltipEntry();
    if (!isOpen && !$8796f90736e175cb$var$globalWarmUpTimeout && !$8796f90736e175cb$var$globalWarmedUp)
      $8796f90736e175cb$var$globalWarmUpTimeout = setTimeout(() => {
        $8796f90736e175cb$var$globalWarmUpTimeout = null;
        $8796f90736e175cb$var$globalWarmedUp = true;
        showTooltip();
      }, delay2);
    else if (!isOpen)
      showTooltip();
  };
  reactExports.useEffect(() => {
    closeCallback.current = close;
  }, [
    close
  ]);
  reactExports.useEffect(() => {
    return () => {
      if (closeTimeout.current)
        clearTimeout(closeTimeout.current);
      let tooltip = $8796f90736e175cb$var$tooltips[id2];
      if (tooltip)
        delete $8796f90736e175cb$var$tooltips[id2];
    };
  }, [
    id2
  ]);
  return {
    isOpen,
    open: (immediate) => {
      if (!immediate && delay2 > 0 && !closeTimeout.current)
        warmupTooltip();
      else
        showTooltip();
    },
    close: hideTooltip
  };
}
function $326e436e94273fe1$export$1c4b08e0eca38426(props, state) {
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    onHoverStart: () => state === null || state === void 0 ? void 0 : state.open(true),
    onHoverEnd: () => state === null || state === void 0 ? void 0 : state.close()
  });
  return {
    tooltipProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, hoverProps, {
      role: "tooltip"
    })
  };
}
function $4e1b34546679e357$export$a6da6c504e4bba8b(props, state, ref) {
  let { isDisabled, trigger } = props;
  let tooltipId = $bdb11010cef70236$export$f680877a34711e37$2();
  let isHovered = reactExports.useRef(false);
  let isFocused = reactExports.useRef(false);
  let handleShow = () => {
    if (isHovered.current || isFocused.current)
      state.open(isFocused.current);
  };
  let handleHide = (immediate) => {
    if (!isHovered.current && !isFocused.current)
      state.close(immediate);
  };
  reactExports.useEffect(() => {
    let onKeyDown = (e2) => {
      if (ref && ref.current) {
        if (e2.key === "Escape") {
          e2.stopPropagation();
          state.close(true);
        }
      }
    };
    if (state.isOpen) {
      document.addEventListener("keydown", onKeyDown, true);
      return () => {
        document.removeEventListener("keydown", onKeyDown, true);
      };
    }
  }, [
    ref,
    state
  ]);
  let onHoverStart = () => {
    if (trigger === "focus")
      return;
    if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
      isHovered.current = true;
    else
      isHovered.current = false;
    handleShow();
  };
  let onHoverEnd = () => {
    if (trigger === "focus")
      return;
    isFocused.current = false;
    isHovered.current = false;
    handleHide();
  };
  let onPressStart = () => {
    isFocused.current = false;
    isHovered.current = false;
    handleHide(true);
  };
  let onFocus = () => {
    let isVisible2 = $507fabe10e71c6fb$export$b9b3dfddab17db27$2();
    if (isVisible2) {
      isFocused.current = true;
      handleShow();
    }
  };
  let onBlur = () => {
    isFocused.current = false;
    isHovered.current = false;
    handleHide(true);
  };
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled,
    onHoverStart,
    onHoverEnd
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({
    isDisabled,
    onFocus,
    onBlur
  }, ref);
  return {
    triggerProps: {
      "aria-describedby": state.isOpen ? tooltipId : void 0,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, hoverProps, {
        onPointerDown: onPressStart,
        onKeyDown: onPressStart,
        tabIndex: void 0
      })
    },
    tooltipProps: {
      id: tooltipId
    }
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$7(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$6(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$4(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$7(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$3(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$4(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$6(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$7(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
function $e0b6e0b68ec7f50f$export$872b660ac5a1ff98(props) {
  let { ref, onInteractOutside, isDisabled, onInteractOutsideStart } = props;
  let stateRef = reactExports.useRef({
    isPointerDown: false,
    ignoreEmulatedMouseEvents: false
  });
  let onPointerDown = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (onInteractOutside && $e0b6e0b68ec7f50f$var$isValidEvent(e2, ref)) {
      if (onInteractOutsideStart)
        onInteractOutsideStart(e2);
      stateRef.current.isPointerDown = true;
    }
  });
  let triggerInteractOutside = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (onInteractOutside)
      onInteractOutside(e2);
  });
  reactExports.useEffect(() => {
    let state = stateRef.current;
    if (isDisabled)
      return;
    const element2 = ref.current;
    const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
    if (typeof PointerEvent !== "undefined") {
      let onClick = (e2) => {
        if (state.isPointerDown && $e0b6e0b68ec7f50f$var$isValidEvent(e2, ref))
          triggerInteractOutside(e2);
        state.isPointerDown = false;
      };
      documentObject.addEventListener("pointerdown", onPointerDown, true);
      documentObject.addEventListener("click", onClick, true);
      return () => {
        documentObject.removeEventListener("pointerdown", onPointerDown, true);
        documentObject.removeEventListener("click", onClick, true);
      };
    }
  }, [
    ref,
    isDisabled,
    onPointerDown,
    triggerInteractOutside
  ]);
}
function $e0b6e0b68ec7f50f$var$isValidEvent(event, ref) {
  if (event.button > 0)
    return false;
  if (event.target) {
    const ownerDocument = event.target.ownerDocument;
    if (!ownerDocument || !ownerDocument.documentElement.contains(event.target))
      return false;
    if (event.target.closest("[data-react-aria-top-layer]"))
      return false;
  }
  if (!ref.current)
    return false;
  return !event.composedPath().includes(ref.current);
}
var visibleOverlays = [];
function useAriaOverlay(props, ref) {
  const {
    disableOutsideEvents = true,
    isDismissable = false,
    isKeyboardDismissDisabled = false,
    isOpen,
    onClose,
    shouldCloseOnBlur,
    shouldCloseOnInteractOutside
  } = props;
  reactExports.useEffect(() => {
    if (isOpen) {
      visibleOverlays.push(ref);
    }
    return () => {
      const index2 = visibleOverlays.indexOf(ref);
      if (index2 >= 0) {
        visibleOverlays.splice(index2, 1);
      }
    };
  }, [isOpen, ref]);
  const onHide = () => {
    if (visibleOverlays[visibleOverlays.length - 1] === ref && onClose) {
      onClose();
    }
  };
  const onInteractOutsideStart = (e2) => {
    if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.target)) {
      if (visibleOverlays[visibleOverlays.length - 1] === ref) {
        if (disableOutsideEvents) {
          e2.stopPropagation();
          e2.preventDefault();
        }
      }
      if (e2.pointerType !== "touch") {
        onHide();
      }
    }
  };
  const onInteractOutside = (e2) => {
    if (e2.pointerType !== "touch") {
      return;
    }
    if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.target)) {
      if (visibleOverlays[visibleOverlays.length - 1] === ref) {
        if (disableOutsideEvents) {
          e2.stopPropagation();
          e2.preventDefault();
        }
      }
      onHide();
    }
  };
  const onKeyDown = (e2) => {
    if (e2.key === "Escape" && !isKeyboardDismissDisabled && !e2.nativeEvent.isComposing) {
      e2.stopPropagation();
      e2.preventDefault();
      onHide();
    }
  };
  $e0b6e0b68ec7f50f$export$872b660ac5a1ff98({
    isDisabled: !(isDismissable && isOpen),
    onInteractOutside: isDismissable && isOpen ? onInteractOutside : void 0,
    onInteractOutsideStart,
    ref
  });
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$3({
    isDisabled: !shouldCloseOnBlur,
    onBlurWithin: (e2) => {
      if (!e2.relatedTarget || $9bf71ea28793e738$export$1258395f99bf9cbf(e2.relatedTarget)) {
        return;
      }
      if (!shouldCloseOnInteractOutside || shouldCloseOnInteractOutside(e2.relatedTarget)) {
        onHide();
      }
    }
  });
  const onPointerDownUnderlay = (e2) => {
    if (e2.target === e2.currentTarget) {
      e2.preventDefault();
    }
  };
  return {
    overlayProps: {
      onKeyDown,
      ...focusWithinProps
    },
    underlayProps: {
      onPointerDown: onPointerDownUnderlay
    }
  };
}
function useTooltip(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, popover.variantKeys);
  const {
    ref,
    as: as2,
    isOpen: isOpenProp,
    content: content2,
    children,
    defaultOpen,
    onOpenChange,
    isDisabled,
    trigger: triggerAction,
    shouldFlip = true,
    containerPadding = 12,
    placement: placementProp = "top",
    delay: delay2 = 0,
    closeDelay = 500,
    showArrow = false,
    offset: offset2 = 7,
    crossOffset = 0,
    isDismissable,
    shouldCloseOnBlur = true,
    portalContainer,
    isKeyboardDismissDisabled = false,
    updatePositionDeps = [],
    shouldCloseOnInteractOutside,
    className,
    onClose,
    motionProps,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const state = $8796f90736e175cb$export$4d40659c25ecb50b({
    delay: delay2,
    closeDelay,
    isDisabled,
    defaultOpen,
    isOpen: isOpenProp,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const triggerRef = reactExports.useRef(null);
  const overlayRef = reactExports.useRef(null);
  const tooltipId = reactExports.useId();
  const isOpen = state.isOpen && !isDisabled;
  reactExports.useImperativeHandle(
    ref,
    () => (
      // @ts-ignore
      createDOMRef(overlayRef)
    )
  );
  const { triggerProps, tooltipProps: triggerTooltipProps } = $4e1b34546679e357$export$a6da6c504e4bba8b(
    {
      isDisabled,
      trigger: triggerAction
    },
    state,
    triggerRef
  );
  const { tooltipProps } = $326e436e94273fe1$export$1c4b08e0eca38426(
    {
      isOpen,
      ...mergeProps$3(props, triggerTooltipProps)
    },
    state
  );
  const {
    overlayProps: positionProps,
    placement,
    updatePosition
  } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
    isOpen,
    targetRef: triggerRef,
    placement: toReactAriaPlacement(placementProp),
    overlayRef,
    offset: showArrow ? offset2 + 3 : offset2,
    crossOffset,
    shouldFlip,
    containerPadding
  });
  useSafeLayoutEffect(() => {
    if (!updatePositionDeps.length)
      return;
    updatePosition();
  }, updatePositionDeps);
  const { overlayProps } = useAriaOverlay(
    {
      isOpen,
      onClose: state.close,
      isDismissable,
      shouldCloseOnBlur,
      isKeyboardDismissDisabled,
      shouldCloseOnInteractOutside
    },
    overlayRef
  );
  const slots = reactExports.useMemo(
    () => {
      var _a22, _b22, _c2;
      return popover({
        ...variantProps2,
        disableAnimation,
        radius: (_a22 = originalProps == null ? void 0 : originalProps.radius) != null ? _a22 : "md",
        size: (_b22 = originalProps == null ? void 0 : originalProps.size) != null ? _b22 : "md",
        shadow: (_c2 = originalProps == null ? void 0 : originalProps.shadow) != null ? _c2 : "sm"
      });
    },
    [
      objectToDeps(variantProps2),
      disableAnimation,
      originalProps == null ? void 0 : originalProps.radius,
      originalProps == null ? void 0 : originalProps.size,
      originalProps == null ? void 0 : originalProps.shadow
    ]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}, _ref = null) => ({
      ...mergeProps$3(triggerProps, props2),
      ref: mergeRefs(_ref, triggerRef),
      "aria-describedby": isOpen ? tooltipId : void 0
    }),
    [triggerProps, isOpen, tooltipId, state]
  );
  const getTooltipProps = reactExports.useCallback(
    () => ({
      ref: overlayRef,
      "data-slot": "base",
      "data-open": dataAttr(isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-disabled": dataAttr(isDisabled),
      "data-placement": getArrowPlacement(placement || "top", placementProp),
      ...mergeProps$3(tooltipProps, overlayProps, otherProps),
      style: mergeProps$3(positionProps.style, otherProps.style, props.style),
      className: slots.base({ class: classNames2 == null ? void 0 : classNames2.base }),
      id: tooltipId
    }),
    [
      slots,
      isOpen,
      showArrow,
      isDisabled,
      placement,
      placementProp,
      tooltipProps,
      overlayProps,
      otherProps,
      positionProps,
      props,
      tooltipId
    ]
  );
  const getTooltipContentProps = reactExports.useCallback(
    () => ({
      "data-slot": "content",
      "data-open": dataAttr(isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-disabled": dataAttr(isDisabled),
      "data-placement": getArrowPlacement(placement || "top", placementProp),
      className: slots.content({ class: clsx$5(classNames2 == null ? void 0 : classNames2.content, className) })
    }),
    [slots, isOpen, showArrow, isDisabled, placement, placementProp, classNames2]
  );
  return {
    Component: Component2,
    content: content2,
    children,
    isOpen,
    triggerRef,
    showArrow,
    portalContainer,
    placement: placementProp,
    disableAnimation,
    isDisabled,
    motionProps,
    getTooltipContentProps,
    getTriggerProps,
    getTooltipProps
  };
}
var domAnimation$5 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Tooltip$5 = forwardRef((props, ref) => {
  var _a2;
  const {
    Component: Component2,
    children,
    content: content2,
    isOpen,
    portalContainer,
    placement,
    disableAnimation,
    motionProps,
    getTriggerProps,
    getTooltipProps,
    getTooltipContentProps
  } = useTooltip({
    ...props,
    ref
  });
  let trigger;
  try {
    const childrenNum = reactExports.Children.count(children);
    if (childrenNum !== 1)
      throw new Error();
    if (!reactExports.isValidElement(children)) {
      trigger = /* @__PURE__ */ jsxRuntimeExports.jsx("p", { ...getTriggerProps(), children });
    } else {
      const child = children;
      const childRef = (_a2 = child.props.ref) != null ? _a2 : child.ref;
      trigger = reactExports.cloneElement(child, getTriggerProps(child.props, childRef));
    }
  } catch {
    trigger = /* @__PURE__ */ jsxRuntimeExports.jsx("span", {});
    warn$2("Tooltip must have only one child node. Please, check your code.");
  }
  const { ref: tooltipRef, id: id2, style: style2, ...otherTooltipProps } = getTooltipProps();
  const animatedContent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tooltipRef, id: id2, style: style2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      exit: "exit",
      initial: "exit",
      variants: TRANSITION_VARIANTS.scaleSpring,
      ...mergeProps$3(motionProps, otherTooltipProps),
      style: {
        ...getTransformOrigins(placement)
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTooltipContentProps(), children: content2 })
    },
    `${id2}-tooltip-inner`
  ) }, `${id2}-tooltip-content`);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    trigger,
    disableAnimation ? isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$b47c3594eab58386, { portalContainer, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: tooltipRef, id: id2, style: style2, ...otherTooltipProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTooltipContentProps(), children: content2 }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$5, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntimeExports.jsx($f57aed4a881a3485$export$b47c3594eab58386, { portalContainer, children: animatedContent }) }) })
  ] });
});
Tooltip$5.displayName = "HeroUI.Tooltip";
var tooltip_default = Tooltip$5;
var Snippet = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    preRef,
    children,
    slots,
    classNames: classNames2,
    copied,
    copyIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CopyLinearIcon, {}),
    checkIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CheckLinearIcon, {}),
    symbolBefore,
    disableCopy,
    disableTooltip,
    hideSymbol,
    hideCopyButton,
    tooltipProps,
    isMultiLine,
    onCopy,
    getSnippetProps,
    getCopyButtonProps
  } = useSnippet({ ...props, ref });
  const TooltipContent = reactExports.useCallback(
    ({ children: children2 }) => /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { ...tooltipProps, isDisabled: copied || tooltipProps.isDisabled, children: children2 }),
    [objectToDeps(tooltipProps)]
  );
  const contents = reactExports.useMemo(() => {
    if (hideCopyButton) {
      return null;
    }
    const clonedCheckIcon = checkIcon && reactExports.cloneElement(checkIcon, { className: slots.checkIcon() });
    const clonedCopyIcon = copyIcon && reactExports.cloneElement(copyIcon, { className: slots.copyIcon() });
    const copyButton = /* @__PURE__ */ jsxRuntimeExports.jsxs(button_default$1, { ...getCopyButtonProps(), children: [
      clonedCheckIcon,
      clonedCopyIcon
    ] });
    if (disableTooltip) {
      return copyButton;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: copyButton });
  }, [
    slots,
    classNames2 == null ? void 0 : classNames2.copyButton,
    copied,
    checkIcon,
    copyIcon,
    onCopy,
    TooltipContent,
    disableCopy,
    disableTooltip,
    hideCopyButton
  ]);
  const preContent = reactExports.useMemo(() => {
    if (isMultiLine && children && Array.isArray(children)) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children: children.map((t2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: slots.pre({ class: classNames2 == null ? void 0 : classNames2.pre }), children: [
        !hideSymbol && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.symbol({ class: classNames2 == null ? void 0 : classNames2.symbol }), children: symbolBefore }),
        t2
      ] }, `${index2}-${t2}`)) });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { ref: preRef, className: slots.pre({ class: classNames2 == null ? void 0 : classNames2.pre }), children: [
      !hideSymbol && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.symbol({ class: classNames2 == null ? void 0 : classNames2.symbol }), children: symbolBefore }),
      children
    ] });
  }, [children, hideSymbol, isMultiLine, symbolBefore, classNames2 == null ? void 0 : classNames2.pre, slots]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getSnippetProps(), children: [
    preContent,
    contents
  ] });
});
Snippet.displayName = "HeroUI.Snippet";
var snippet_default = Snippet;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = false;
let $6179b936705e76d3$var$hoverCount$a = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$a() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$a(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$a();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$a() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$a);
  $6179b936705e76d3$var$hoverCount$a++;
  return () => {
    $6179b936705e76d3$var$hoverCount$a--;
    if ($6179b936705e76d3$var$hoverCount$a > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$a);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$a(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$a, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$a && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $b418ec0c85c52f27$export$d853f7095ae95f88(props, state, ref) {
  let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref);
  return {
    labelProps,
    inputProps: {
      ...inputProps,
      role: "switch",
      checked: isSelected
    },
    isSelected,
    isPressed,
    isDisabled,
    isReadOnly
  };
}
function $3017fa7ffdddec74$export$8042c6c013fd5226(props = {}) {
  let { isReadOnly } = props;
  let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isSelected, props.defaultSelected || false, props.onChange);
  function updateSelected(value2) {
    if (!isReadOnly)
      setSelected(value2);
  }
  function toggleState() {
    if (!isReadOnly)
      setSelected(!isSelected);
  }
  return {
    isSelected,
    setSelected: updateSelected,
    toggle: toggleState
  };
}
function useSwitch(originalProps = {}) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, toggle.variantKeys);
  const {
    ref,
    as: as2,
    name: name2,
    value: value2 = "",
    isReadOnly: isReadOnlyProp = false,
    autoFocus = false,
    startContent,
    endContent,
    defaultSelected,
    isSelected: isSelectedProp,
    children,
    thumbIcon,
    className,
    classNames: classNames2,
    onChange,
    onValueChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "label";
  const domRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const labelId = reactExports.useId();
  const ariaSwitchProps = reactExports.useMemo(() => {
    const ariaLabel = otherProps["aria-label"] || typeof children === "string" ? children : void 0;
    return {
      name: name2,
      value: value2,
      children,
      autoFocus,
      defaultSelected,
      isSelected: isSelectedProp,
      isDisabled: !!originalProps.isDisabled,
      isReadOnly: isReadOnlyProp,
      "aria-label": ariaLabel,
      "aria-labelledby": otherProps["aria-labelledby"] || labelId,
      onChange: onValueChange
    };
  }, [
    value2,
    name2,
    labelId,
    children,
    autoFocus,
    isReadOnlyProp,
    isSelectedProp,
    defaultSelected,
    originalProps.isDisabled,
    otherProps["aria-label"],
    otherProps["aria-labelledby"],
    onValueChange
  ]);
  const state = $3017fa7ffdddec74$export$8042c6c013fd5226(ariaSwitchProps);
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const isInputRefChecked = !!inputRef.current.checked;
    state.setSelected(isInputRefChecked);
  }, [inputRef.current]);
  const { inputProps, isPressed, isReadOnly } = $b418ec0c85c52f27$export$d853f7095ae95f88(ariaSwitchProps, state, inputRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({ autoFocus: inputProps.autoFocus });
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$a({
    isDisabled: inputProps.disabled
  });
  const isInteractionDisabled = ariaSwitchProps.isDisabled || isReadOnly;
  const pressed = isInteractionDisabled ? false : isPressed;
  const isSelected = inputProps.checked;
  const isDisabled = inputProps.disabled;
  const slots = reactExports.useMemo(
    () => toggle({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2) => {
    return {
      ...mergeProps$3(hoverProps, otherProps, props2),
      ref: domRef,
      className: slots.base({ class: clsx$5(baseStyles, props2 == null ? void 0 : props2.className) }),
      "data-disabled": dataAttr(isDisabled),
      "data-selected": dataAttr(isSelected),
      "data-readonly": dataAttr(isReadOnly),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(pressed)
    };
  };
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "aria-hidden": true,
        className: clsx$5(slots.wrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) }))
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.wrapper]
  );
  const getInputProps = (props2 = {}) => {
    return {
      ...mergeProps$3(inputProps, focusProps, props2),
      ref: mergeRefs(inputRef, ref),
      id: inputProps.id,
      className: slots.hiddenInput({ class: classNames2 == null ? void 0 : classNames2.hiddenInput }),
      onChange: chain(onChange, inputProps.onChange)
    };
  };
  const getThumbProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      className: slots.thumb({ class: clsx$5(classNames2 == null ? void 0 : classNames2.thumb, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.thumb]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      ...props2,
      id: labelId,
      className: slots.label({ class: clsx$5(classNames2 == null ? void 0 : classNames2.label, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, isDisabled, isSelected]
  );
  const getThumbIconProps = reactExports.useCallback(
    (props2 = {
      includeStateProps: false
    }) => mergeProps$3(
      {
        width: "1em",
        height: "1em",
        className: slots.thumbIcon({ class: clsx$5(classNames2 == null ? void 0 : classNames2.thumbIcon) })
      },
      props2.includeStateProps ? {
        isSelected
      } : {}
    ),
    [slots, classNames2 == null ? void 0 : classNames2.thumbIcon, isSelected]
  );
  const getStartContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      width: "1em",
      height: "1em",
      ...props2,
      className: slots.startContent({ class: clsx$5(classNames2 == null ? void 0 : classNames2.startContent, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.startContent, isSelected]
  );
  const getEndContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      width: "1em",
      height: "1em",
      ...props2,
      className: slots.endContent({ class: clsx$5(classNames2 == null ? void 0 : classNames2.endContent, props2 == null ? void 0 : props2.className) })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.endContent, isSelected]
  );
  return {
    Component: Component2,
    slots,
    classNames: classNames2,
    domRef,
    children,
    thumbIcon,
    startContent,
    endContent,
    isHovered,
    isSelected,
    isPressed: pressed,
    isFocused,
    isFocusVisible,
    isDisabled,
    getBaseProps,
    getWrapperProps,
    getInputProps,
    getLabelProps,
    getThumbProps,
    getThumbIconProps,
    getStartContentProps,
    getEndContentProps
  };
}
var Switch = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    startContent,
    endContent,
    thumbIcon,
    getBaseProps,
    getInputProps,
    getWrapperProps,
    getThumbProps,
    getThumbIconProps,
    getLabelProps,
    getStartContentProps,
    getEndContentProps
  } = useSwitch({ ...props, ref });
  const clonedThumbIcon = typeof thumbIcon === "function" ? thumbIcon(getThumbIconProps({ includeStateProps: true })) : thumbIcon && reactExports.cloneElement(thumbIcon, getThumbIconProps());
  const clonedStartContent = startContent && reactExports.cloneElement(startContent, getStartContentProps());
  const clonedEndContent = endContent && reactExports.cloneElement(endContent, getEndContentProps());
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { ...getWrapperProps(), children: [
      startContent && clonedStartContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getThumbProps(), children: thumbIcon && clonedThumbIcon }),
      endContent && clonedEndContent
    ] }),
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children })
  ] });
});
Switch.displayName = "HeroUI.Switch";
var switch_default = Switch;
function useIsMounted(props = {}) {
  const { rerender = false, delay: delay2 = 0 } = props;
  const isMountedRef = reactExports.useRef(false);
  const [isMounted, setIsMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    isMountedRef.current = true;
    let timer = null;
    if (rerender) {
      if (delay2 > 0) {
        timer = setTimeout(() => {
          setIsMounted(true);
        }, delay2);
      } else {
        setIsMounted(true);
      }
    }
    return () => {
      isMountedRef.current = false;
      if (rerender) {
        setIsMounted(false);
      }
      if (timer) {
        clearTimeout(timer);
      }
    };
  }, [rerender]);
  return [reactExports.useCallback(() => isMountedRef.current, []), isMounted];
}
function $204d9ebcedfb8806$export$ed5abd763a836edc(props) {
  let { value: value2 = 0, minValue = 0, maxValue = 100, valueLabel, isIndeterminate, formatOptions = {
    style: "percent"
  } } = props;
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...props,
    // Progress bar is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span"
  });
  value2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, minValue, maxValue);
  let percentage = (value2 - minValue) / (maxValue - minValue);
  let formatter = $a916eb452884faea$export$b7a616150fdb9f44$1(formatOptions);
  if (!isIndeterminate && !valueLabel) {
    let valueToFormat = formatOptions.style === "percent" ? percentage : value2;
    valueLabel = formatter.format(valueToFormat);
  }
  return {
    progressBarProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      ...fieldProps,
      "aria-valuenow": isIndeterminate ? void 0 : value2,
      "aria-valuemin": minValue,
      "aria-valuemax": maxValue,
      "aria-valuetext": isIndeterminate ? void 0 : valueLabel,
      role: "progressbar"
    }),
    labelProps
  };
}
function useCircularProgress(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, circularProgress.variantKeys);
  const {
    ref,
    as: as2,
    id: id2,
    className,
    classNames: classNames2,
    label,
    valueLabel,
    value: value2 = void 0,
    minValue = 0,
    maxValue = 100,
    strokeWidth: strokeWidthProp,
    showValueLabel = false,
    formatOptions = {
      style: "percent"
    },
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const [, isMounted] = useIsMounted({
    rerender: true,
    delay: 100
  });
  const isIndeterminate = ((_a2 = originalProps.isIndeterminate) != null ? _a2 : true) && value2 === void 0;
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const { progressBarProps, labelProps } = $204d9ebcedfb8806$export$ed5abd763a836edc({
    id: id2,
    label,
    value: value2,
    minValue,
    maxValue,
    valueLabel,
    formatOptions,
    isIndeterminate,
    "aria-labelledby": originalProps["aria-labelledby"],
    "aria-label": originalProps["aria-label"]
  });
  const slots = reactExports.useMemo(
    () => circularProgress({
      ...variantProps2,
      disableAnimation,
      isIndeterminate
    }),
    [objectToDeps(variantProps2), disableAnimation, isIndeterminate]
  );
  const selfMounted = disableAnimation ? true : isMounted;
  const center = 16;
  const strokeWidth = strokeWidthProp || (originalProps.size === "sm" ? 2 : 3);
  const radius = 16 - strokeWidth;
  const circumference = 2 * radius * Math.PI;
  const percentage = reactExports.useMemo(() => {
    if (!selfMounted) {
      return 0;
    }
    if (isIndeterminate) {
      return 0.25;
    }
    return value2 ? clampPercentage((value2 - minValue) / (maxValue - minValue), 1) : 0;
  }, [selfMounted, value2, minValue, maxValue, isIndeterminate]);
  const offset2 = circumference - percentage * circumference;
  const getProgressBarProps = reactExports.useCallback(
    (props2 = {}) => ({
      ref: domRef,
      "data-indeterminate": dataAttr(isIndeterminate),
      "data-disabled": dataAttr(originalProps.isDisabled),
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(progressBarProps, otherProps, props2)
    }),
    [
      domRef,
      slots,
      isIndeterminate,
      originalProps.isDisabled,
      baseStyles,
      progressBarProps,
      otherProps
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...mergeProps$3(labelProps, props2)
    }),
    [slots, classNames2, labelProps]
  );
  const getSvgProps = reactExports.useCallback(
    (props2 = {}) => ({
      viewBox: "0 0 32 32",
      fill: "none",
      strokeWidth,
      className: slots.svg({ class: classNames2 == null ? void 0 : classNames2.svg }),
      ...props2
    }),
    [strokeWidth, slots, classNames2]
  );
  const getIndicatorProps = reactExports.useCallback(
    (props2 = {}) => ({
      cx: center,
      cy: center,
      r: radius,
      role: "presentation",
      strokeDasharray: `${circumference} ${circumference}`,
      strokeDashoffset: offset2,
      transform: "rotate(-90 16 16)",
      strokeLinecap: "round",
      className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
      ...props2
    }),
    [slots, classNames2, offset2, circumference, radius]
  );
  const getTrackProps = reactExports.useCallback(
    (props2 = {}) => ({
      cx: center,
      cy: center,
      r: radius,
      role: "presentation",
      strokeDasharray: `${circumference} ${circumference}`,
      strokeDashoffset: 0,
      transform: "rotate(-90 16 16)",
      strokeLinecap: "round",
      className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }),
      ...props2
    }),
    [slots, classNames2, circumference, radius]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    label,
    showValueLabel,
    getProgressBarProps,
    getLabelProps,
    getSvgProps,
    getIndicatorProps,
    getTrackProps
  };
}
var CircularProgress = forwardRef((props, ref) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    label,
    showValueLabel,
    getProgressBarProps,
    getLabelProps,
    getSvgProps,
    getIndicatorProps,
    getTrackProps
  } = useCircularProgress({ ref, ...props });
  const progressBarProps = getProgressBarProps();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...progressBarProps, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.svgWrapper({ class: classNames2 == null ? void 0 : classNames2.svgWrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { ...getSvgProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { ...getTrackProps() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("circle", { ...getIndicatorProps() })
      ] }),
      showValueLabel && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }), children: progressBarProps["aria-valuetext"] })
    ] }),
    label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label })
  ] });
});
CircularProgress.displayName = "HeroUI.CircularProgress";
var circular_progress_default = CircularProgress;
function useProgress(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, progress.variantKeys);
  const {
    ref,
    as: as2,
    id: id2,
    className,
    classNames: classNames2,
    label,
    valueLabel,
    value: value2 = 0,
    minValue = 0,
    maxValue = 100,
    showValueLabel = false,
    formatOptions = {
      style: "percent"
    },
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const [, isMounted] = useIsMounted({
    rerender: true,
    delay: 100
  });
  const isIndeterminate = originalProps.isIndeterminate;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const { progressBarProps, labelProps } = $204d9ebcedfb8806$export$ed5abd763a836edc({
    id: id2,
    label,
    value: value2,
    minValue,
    maxValue,
    valueLabel,
    formatOptions,
    isIndeterminate,
    "aria-labelledby": originalProps["aria-labelledby"],
    "aria-label": originalProps["aria-label"]
  });
  const slots = reactExports.useMemo(
    () => progress({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const selfMounted = disableAnimation ? true : isMounted;
  const percentage = reactExports.useMemo(
    () => isIndeterminate || !selfMounted ? void 0 : clampPercentage((value2 - minValue) / (maxValue - minValue) * 100),
    [selfMounted, isIndeterminate, value2, minValue, maxValue]
  );
  const getProgressBarProps = reactExports.useCallback(
    (props2 = {}) => ({
      ref: domRef,
      "data-indeterminate": dataAttr(isIndeterminate),
      "data-disabled": dataAttr(originalProps.isDisabled),
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(progressBarProps, otherProps, props2)
    }),
    [
      domRef,
      slots,
      isIndeterminate,
      originalProps.isDisabled,
      baseStyles,
      progressBarProps,
      otherProps
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      ...mergeProps$3(labelProps, props2)
    }),
    [slots, classNames2, labelProps]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    label,
    percentage,
    showValueLabel,
    getProgressBarProps,
    getLabelProps
  };
}
var Progress = forwardRef((props, ref) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    label,
    percentage,
    showValueLabel,
    getProgressBarProps,
    getLabelProps
  } = useProgress({ ...props, ref });
  const progressBarProps = getProgressBarProps();
  const shouldShowLabelWrapper = label || showValueLabel;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...progressBarProps, children: [
    shouldShowLabelWrapper ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper }), children: [
      label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: label }),
      showValueLabel && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }), children: progressBarProps["aria-valuetext"] })
    ] }) : null,
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots.indicator({ class: classNames2 == null ? void 0 : classNames2.indicator }),
        style: {
          transform: `translateX(-${100 - (percentage || 0)}%)`
        }
      }
    ) })
  ] });
});
Progress.displayName = "HeroUI.Progress";
var progress_default = Progress;
function $8a9cb279dc87e130$export$525bc4921d56d4a$6(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$3(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$6(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$5(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$5 = "default";
let $14c0b72509d70225$var$savedUserSelect$5 = "";
let $14c0b72509d70225$var$modifiedElementMap$5 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$5(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$5 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$5 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$5 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$5.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$5(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$5 !== "disabled")
      return;
    $14c0b72509d70225$var$state$5 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$5 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$5 || "";
          $14c0b72509d70225$var$savedUserSelect$5 = "";
          $14c0b72509d70225$var$state$5 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$5.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$5.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$5.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$5 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$5.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$5(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$5);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$5 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$5 = class $f6c31cce2adf654f$var$PressEvent7 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$5, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$5 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$5 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$5(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$5(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$5("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$5("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$5(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$6(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$5(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$5(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$5(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$5(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$5(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$5(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$5]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$5] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$5(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$5(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$5(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$5))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$5;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$5((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$5]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$5(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$5(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$5(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$5(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$5(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$5(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$5(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$5(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$5(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$5(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$5 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$5(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$5.has(target.type);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$2(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$3(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$5(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$6(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = false;
let $6179b936705e76d3$var$hoverCount$9 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$9() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$9(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$9();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$9() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$9);
  $6179b936705e76d3$var$hoverCount$9++;
  return () => {
    $6179b936705e76d3$var$hoverCount$9--;
    if ($6179b936705e76d3$var$hoverCount$9 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$9);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$9(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$9, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$9 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$5(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$4(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$5(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$715c682d09d639cc$2(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$5(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$4 = false;
let $507fabe10e71c6fb$var$currentModality$2 = null;
let $507fabe10e71c6fb$var$changeHandlers$4 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$4 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$4(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$4)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$4(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$4(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
  if ($507fabe10e71c6fb$var$isValidKey$4(e2)) {
    $507fabe10e71c6fb$var$currentModality$2 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$4(e2) {
  $507fabe10e71c6fb$var$currentModality$2 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$4(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    $507fabe10e71c6fb$var$currentModality$2 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$4(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$4 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$4 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$4) {
    $507fabe10e71c6fb$var$currentModality$2 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$4("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$4() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$4 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$4.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$4 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$4, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$4, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$4, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$4.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$4.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$4.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$4, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$4, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$4, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$4, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$4, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$4.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$4(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$4(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$4(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$4();
function $507fabe10e71c6fb$export$630ff653c5ada6a9$1() {
  return $507fabe10e71c6fb$var$currentModality$2;
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c$1(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9$1() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$1(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$2(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260$1(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd$1(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260$1(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260$1(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb$1 = /* @__PURE__ */ React$6.createContext(null);
function $f645667febf57a63$var$useFocusableContext$1(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb$1) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c$1(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$1(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$1(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext$1(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$1(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $2d73ec29415bd339$export$712718f7aec83d5$1(props, ref) {
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type: type4 = "text", validationBehavior = "aria" } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$4(props.value, props.defaultValue || "", props.onChange);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$1(props, ref);
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  const inputOnlyProps = {
    type: type4,
    pattern: props.pattern
  };
  $99facab73266f662$export$5add1d006293d136(ref, value2, setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, ref);
  reactExports.useEffect(() => {
    if (ref.current instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(ref.current).HTMLTextAreaElement) {
      let input2 = ref.current;
      Object.defineProperty(input2, "defaultValue", {
        get: () => input2.value,
        set: () => {
        },
        configurable: true
      });
    }
  }, [
    ref
  ]);
  return {
    labelProps,
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, inputElementType === "input" ? inputOnlyProps : void 0, {
      disabled: isDisabled,
      readOnly: isReadOnly,
      required: isRequired && validationBehavior === "native",
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      "aria-invalid": isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-activedescendant": props["aria-activedescendant"],
      "aria-autocomplete": props["aria-autocomplete"],
      "aria-haspopup": props["aria-haspopup"],
      "aria-controls": props["aria-controls"],
      value: value2,
      onChange: (e2) => setValue(e2.target.value),
      autoComplete: props.autoComplete,
      autoCapitalize: props.autoCapitalize,
      maxLength: props.maxLength,
      minLength: props.minLength,
      name: props.name,
      placeholder: props.placeholder,
      inputMode: props.inputMode,
      autoCorrect: props.autoCorrect,
      spellCheck: props.spellCheck,
      [parseInt(React$6.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: props.enterKeyHint,
      // Clipboard events
      onCopy: props.onCopy,
      onCut: props.onCut,
      onPaste: props.onPaste,
      // Composition events
      onCompositionEnd: props.onCompositionEnd,
      onCompositionStart: props.onCompositionStart,
      onCompositionUpdate: props.onCompositionUpdate,
      // Selection events
      onSelect: props.onSelect,
      // Input events
      onBeforeInput: props.onBeforeInput,
      onInput: props.onInput,
      ...focusableProps,
      ...fieldProps
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useInput(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, input.variantKeys);
  const {
    ref,
    as: as2,
    type: type4,
    label,
    baseRef,
    wrapperRef,
    description,
    className,
    classNames: classNames2,
    autoFocus,
    startContent,
    endContent,
    onClear,
    onChange,
    validationState,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    innerWrapperRef: innerWrapperRefProp,
    onValueChange = () => {
    },
    ...otherProps
  } = props;
  const handleValueChange = reactExports.useCallback(
    (value2) => {
      onValueChange(value2 != null ? value2 : "");
    },
    [onValueChange]
  );
  const [isFocusWithin, setFocusWithin] = reactExports.useState(false);
  const Component2 = as2 || "div";
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const domRef = useDOMRef(ref);
  const baseDomRef = useDOMRef(baseRef);
  const inputWrapperRef = useDOMRef(wrapperRef);
  const innerWrapperRef = useDOMRef(innerWrapperRefProp);
  const [inputValue, setInputValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$5(
    props.value,
    (_d = props.defaultValue) != null ? _d : "",
    handleValueChange
  );
  const isFileTypeInput = type4 === "file";
  const hasUploadedFiles = ((_g = (_f = (_e = domRef == null ? void 0 : domRef.current) == null ? void 0 : _e.files) == null ? void 0 : _f.length) != null ? _g : 0) > 0;
  const isFilledByDefault = ["date", "time", "month", "week", "range"].includes(type4);
  const isFilled = !isEmpty(inputValue) || isFilledByDefault || hasUploadedFiles;
  const isFilledWithin = isFilled || isFocusWithin;
  const isHiddenType = type4 === "hidden";
  const isMultiline = originalProps.isMultiline;
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className, isFilled ? "is-filled" : "");
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    if (isFileTypeInput) {
      domRef.current.value = "";
    } else {
      setInputValue("");
    }
    onClear == null ? void 0 : onClear();
    (_a22 = domRef.current) == null ? void 0 : _a22.focus();
  }, [setInputValue, onClear, isFileTypeInput]);
  useSafeLayoutEffect(() => {
    if (!domRef.current)
      return;
    setInputValue(domRef.current.value);
  }, [domRef.current]);
  const {
    labelProps,
    inputProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps
  } = $2d73ec29415bd339$export$712718f7aec83d5$1(
    {
      ...originalProps,
      validationBehavior,
      autoCapitalize: originalProps.autoCapitalize,
      value: inputValue,
      "aria-label": originalProps.label ? originalProps["aria-label"] : safeAriaLabel(originalProps["aria-label"], originalProps.placeholder),
      inputElementType: isMultiline ? "textarea" : "input",
      onChange: setInputValue
    },
    domRef
  );
  if (isFileTypeInput) {
    delete inputProps.value;
    delete inputProps.onChange;
  }
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus,
    isTextInput: true
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$9({ isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) });
  const { isHovered: isLabelHovered, hoverProps: labelHoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$9({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled)
  });
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$2({
    onFocusWithinChange: setFocusWithin
  });
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$5({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) || !!(originalProps == null ? void 0 : originalProps.isReadOnly),
    onPress: handleClear
  });
  const isInvalid = validationState === "invalid" || isAriaInvalid;
  const labelPlacement = useInputLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const isClearable = !!onClear || originalProps.isClearable;
  const hasElements = !!label || !!description || !!errorMessage;
  const hasPlaceholder = !!props.placeholder;
  const hasLabel = !!label;
  const hasHelper = !!description || !!errorMessage;
  const isOutsideLeft = labelPlacement === "outside-left";
  const isOutsideTop = labelPlacement === "outside-top";
  const shouldLabelBeOutside = (
    // label is outside only when some placeholder is there
    labelPlacement === "outside" || // label is outside regardless of placeholder
    isOutsideLeft || isOutsideTop
  );
  const shouldLabelBeInside = labelPlacement === "inside";
  const isPlaceholderShown = domRef.current ? (!domRef.current.value || domRef.current.value === "" || !inputValue || inputValue === "") && hasPlaceholder : false;
  const hasStartContent = !!startContent;
  const isLabelOutside = shouldLabelBeOutside ? isOutsideLeft || isOutsideTop || hasPlaceholder || labelPlacement === "outside" && hasStartContent : false;
  const isLabelOutsideAsPlaceholder = labelPlacement === "outside" && !hasPlaceholder && !hasStartContent;
  const slots = reactExports.useMemo(
    () => input({
      ...variantProps2,
      isInvalid,
      labelPlacement,
      isClearable,
      disableAnimation
    }),
    [
      objectToDeps(variantProps2),
      isInvalid,
      labelPlacement,
      isClearable,
      hasStartContent,
      disableAnimation
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: baseDomRef,
        className: slots.base({ class: baseStyles }),
        "data-slot": "base",
        "data-filled": dataAttr(
          isFilled || hasPlaceholder || hasStartContent || isPlaceholderShown || isFileTypeInput
        ),
        "data-filled-within": dataAttr(
          isFilledWithin || hasPlaceholder || hasStartContent || isPlaceholderShown || isFileTypeInput
        ),
        "data-focus-within": dataAttr(isFocusWithin),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-readonly": dataAttr(originalProps.isReadOnly),
        "data-focus": dataAttr(isFocused),
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-required": dataAttr(originalProps.isRequired),
        "data-invalid": dataAttr(isInvalid),
        "data-disabled": dataAttr(originalProps.isDisabled),
        "data-has-elements": dataAttr(hasElements),
        "data-has-helper": dataAttr(hasHelper),
        "data-has-label": dataAttr(hasLabel),
        "data-has-value": dataAttr(!isPlaceholderShown),
        "data-hidden": dataAttr(isHiddenType),
        ...focusWithinProps,
        ...props2
      };
    },
    [
      slots,
      baseStyles,
      isFilled,
      isFocused,
      isHovered,
      isLabelHovered,
      isInvalid,
      hasHelper,
      hasLabel,
      hasElements,
      isPlaceholderShown,
      hasStartContent,
      isFocusWithin,
      isFocusVisible,
      isFilledWithin,
      hasPlaceholder,
      focusWithinProps,
      isHiddenType,
      originalProps.isReadOnly,
      originalProps.isRequired,
      originalProps.isDisabled
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "label",
        className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
        ...mergeProps$3(labelProps, labelHoverProps, props2)
      };
    },
    [slots, isLabelHovered, labelProps, classNames2 == null ? void 0 : classNames2.label]
  );
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape" && inputValue && (isClearable || onClear) && !originalProps.isReadOnly) {
        setInputValue("");
        onClear == null ? void 0 : onClear();
      }
    },
    [inputValue, setInputValue, onClear, isClearable, originalProps.isReadOnly]
  );
  const getInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "input",
        "data-filled": dataAttr(isFilled),
        "data-filled-within": dataAttr(isFilledWithin),
        "data-has-start-content": dataAttr(hasStartContent),
        "data-has-end-content": dataAttr(!!endContent),
        "data-type": type4,
        className: slots.input({
          class: clsx$5(
            classNames2 == null ? void 0 : classNames2.input,
            isFilled ? "is-filled" : "",
            isMultiline ? "pe-0" : "",
            type4 === "password" ? "[&::-ms-reveal]:hidden" : ""
          )
        }),
        ...mergeProps$3(
          focusProps,
          inputProps,
          filterDOMProps(otherProps, {
            enabled: true,
            labelable: true,
            omitEventNames: new Set(Object.keys(inputProps))
          }),
          props2
        ),
        "aria-readonly": dataAttr(originalProps.isReadOnly),
        onChange: chain(inputProps.onChange, onChange),
        onKeyDown: chain(inputProps.onKeyDown, props2.onKeyDown, handleKeyDown),
        ref: domRef
      };
    },
    [
      slots,
      inputValue,
      focusProps,
      inputProps,
      otherProps,
      isFilled,
      isFilledWithin,
      hasStartContent,
      endContent,
      classNames2 == null ? void 0 : classNames2.input,
      originalProps.isReadOnly,
      originalProps.isRequired,
      onChange,
      handleKeyDown
    ]
  );
  const getInputWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputWrapperRef,
        "data-slot": "input-wrapper",
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-focus": dataAttr(isFocused),
        className: slots.inputWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.inputWrapper, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(props2, hoverProps),
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        style: {
          cursor: "text",
          ...props2.style
        }
      };
    },
    [
      slots,
      isHovered,
      isLabelHovered,
      isFocusVisible,
      isFocused,
      inputValue,
      classNames2 == null ? void 0 : classNames2.inputWrapper
    ]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ref: innerWrapperRef,
        "data-slot": "inner-wrapper",
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        className: slots.innerWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "main-wrapper",
        className: slots.mainWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helper-wrapper",
        className: slots.helperWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        disabled: originalProps.isDisabled,
        "aria-label": "clear input",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  return {
    Component: Component2,
    classNames: classNames2,
    domRef,
    label,
    description,
    startContent,
    endContent,
    labelPlacement,
    isClearable,
    hasHelper,
    hasStartContent,
    isLabelOutside,
    isOutsideLeft,
    isOutsideTop,
    isLabelOutsideAsPlaceholder,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    hasPlaceholder,
    isInvalid,
    errorMessage,
    getBaseProps,
    getLabelProps,
    getInputProps,
    getMainWrapperProps,
    getInputWrapperProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps
  };
}
var Input = forwardRef((props, ref) => {
  const {
    Component: Component2,
    label,
    description,
    isClearable,
    startContent,
    endContent,
    labelPlacement,
    hasHelper,
    isOutsideLeft,
    isOutsideTop,
    shouldLabelBeOutside,
    errorMessage,
    isInvalid,
    getBaseProps,
    getLabelProps,
    getInputProps,
    getInnerWrapperProps,
    getInputWrapperProps,
    getMainWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps
  } = useInput({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const end = reactExports.useMemo(() => {
    if (isClearable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return endContent;
  }, [isClearable, getClearButtonProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const innerWrapper = reactExports.useMemo(() => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
      startContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }),
      end
    ] });
  }, [startContent, end, getInputProps, getInnerWrapperProps]);
  const mainWrapper = reactExports.useMemo(() => {
    if (shouldLabelBeOutside) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
          !isOutsideLeft && !isOutsideTop ? labelContent : null,
          innerWrapper
        ] }),
        helperWrapper
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
        labelContent,
        innerWrapper
      ] }),
      helperWrapper
    ] });
  }, [
    labelPlacement,
    helperWrapper,
    shouldLabelBeOutside,
    labelContent,
    innerWrapper,
    errorMessage,
    description,
    getMainWrapperProps,
    getInputWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    isOutsideLeft || isOutsideTop ? labelContent : null,
    mainWrapper
  ] });
});
Input.displayName = "HeroUI.Input";
var input_default = Input;
function _extends$j() {
  return _extends$j = Object.assign ? Object.assign.bind() : function(n2) {
    for (var e2 = 1; e2 < arguments.length; e2++) {
      var t2 = arguments[e2];
      for (var r2 in t2)
        ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
    }
    return n2;
  }, _extends$j.apply(null, arguments);
}
function _objectWithoutPropertiesLoose$2(r2, e2) {
  if (null == r2)
    return {};
  var t2 = {};
  for (var n2 in r2)
    if ({}.hasOwnProperty.call(r2, n2)) {
      if (-1 !== e2.indexOf(n2))
        continue;
      t2[n2] = r2[n2];
    }
  return t2;
}
var index$4 = reactExports.useLayoutEffect;
var useLatest = function useLatest2(value2) {
  var ref = React$6.useRef(value2);
  index$4(function() {
    ref.current = value2;
  });
  return ref;
};
var updateRef = function updateRef2(ref, value2) {
  if (typeof ref === "function") {
    ref(value2);
    return;
  }
  ref.current = value2;
};
var useComposedRef = function useComposedRef2(libRef, userRef) {
  var prevUserRef = React$6.useRef();
  return React$6.useCallback(function(instance2) {
    libRef.current = instance2;
    if (prevUserRef.current) {
      updateRef(prevUserRef.current, null);
    }
    prevUserRef.current = userRef;
    if (!userRef) {
      return;
    }
    updateRef(userRef, instance2);
  }, [userRef]);
};
var HIDDEN_TEXTAREA_STYLE = {
  "min-height": "0",
  "max-height": "none",
  height: "0",
  visibility: "hidden",
  overflow: "hidden",
  position: "absolute",
  "z-index": "-1000",
  top: "0",
  right: "0",
  display: "block"
};
var forceHiddenStyles = function forceHiddenStyles2(node2) {
  Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function(key) {
    node2.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], "important");
  });
};
var forceHiddenStyles$1 = forceHiddenStyles;
var hiddenTextarea = null;
var getHeight$1 = function getHeight(node2, sizingData) {
  var height = node2.scrollHeight;
  if (sizingData.sizingStyle.boxSizing === "border-box") {
    return height + sizingData.borderSize;
  }
  return height - sizingData.paddingSize;
};
function calculateNodeHeight(sizingData, value2, minRows, maxRows) {
  if (minRows === void 0) {
    minRows = 1;
  }
  if (maxRows === void 0) {
    maxRows = Infinity;
  }
  if (!hiddenTextarea) {
    hiddenTextarea = document.createElement("textarea");
    hiddenTextarea.setAttribute("tabindex", "-1");
    hiddenTextarea.setAttribute("aria-hidden", "true");
    forceHiddenStyles$1(hiddenTextarea);
  }
  if (hiddenTextarea.parentNode === null) {
    document.body.appendChild(hiddenTextarea);
  }
  var paddingSize = sizingData.paddingSize, borderSize = sizingData.borderSize, sizingStyle = sizingData.sizingStyle;
  var boxSizing = sizingStyle.boxSizing;
  Object.keys(sizingStyle).forEach(function(_key) {
    var key = _key;
    hiddenTextarea.style[key] = sizingStyle[key];
  });
  forceHiddenStyles$1(hiddenTextarea);
  hiddenTextarea.value = value2;
  var height = getHeight$1(hiddenTextarea, sizingData);
  hiddenTextarea.value = value2;
  height = getHeight$1(hiddenTextarea, sizingData);
  hiddenTextarea.value = "x";
  var rowHeight = hiddenTextarea.scrollHeight - paddingSize;
  var minHeight = rowHeight * minRows;
  if (boxSizing === "border-box") {
    minHeight = minHeight + paddingSize + borderSize;
  }
  height = Math.max(minHeight, height);
  var maxHeight = rowHeight * maxRows;
  if (boxSizing === "border-box") {
    maxHeight = maxHeight + paddingSize + borderSize;
  }
  height = Math.min(maxHeight, height);
  return [height, rowHeight];
}
var noop$9 = function noop() {
};
var pick = function pick2(props, obj) {
  return props.reduce(function(acc, prop) {
    acc[prop] = obj[prop];
    return acc;
  }, {});
};
var SIZING_STYLE = [
  "borderBottomWidth",
  "borderLeftWidth",
  "borderRightWidth",
  "borderTopWidth",
  "boxSizing",
  "fontFamily",
  "fontSize",
  "fontStyle",
  "fontWeight",
  "letterSpacing",
  "lineHeight",
  "paddingBottom",
  "paddingLeft",
  "paddingRight",
  "paddingTop",
  // non-standard
  "tabSize",
  "textIndent",
  // non-standard
  "textRendering",
  "textTransform",
  "width",
  "wordBreak",
  "wordSpacing",
  "scrollbarGutter"
];
var isIE = !!document.documentElement.currentStyle;
var getSizingData = function getSizingData2(node2) {
  var style2 = window.getComputedStyle(node2);
  if (style2 === null) {
    return null;
  }
  var sizingStyle = pick(SIZING_STYLE, style2);
  var boxSizing = sizingStyle.boxSizing;
  if (boxSizing === "") {
    return null;
  }
  if (isIE && boxSizing === "border-box") {
    sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(sizingStyle.borderRightWidth) + parseFloat(sizingStyle.borderLeftWidth) + parseFloat(sizingStyle.paddingRight) + parseFloat(sizingStyle.paddingLeft) + "px";
  }
  var paddingSize = parseFloat(sizingStyle.paddingBottom) + parseFloat(sizingStyle.paddingTop);
  var borderSize = parseFloat(sizingStyle.borderBottomWidth) + parseFloat(sizingStyle.borderTopWidth);
  return {
    sizingStyle,
    paddingSize,
    borderSize
  };
};
var getSizingData$1 = getSizingData;
function useListener(target, type4, listener) {
  var latestListener = useLatest(listener);
  reactExports.useLayoutEffect(function() {
    var handler = function handler2(ev) {
      return latestListener.current(ev);
    };
    if (!target) {
      return;
    }
    target.addEventListener(type4, handler);
    return function() {
      return target.removeEventListener(type4, handler);
    };
  }, []);
}
var useFormResetListener = function useFormResetListener2(libRef, listener) {
  useListener(document.body, "reset", function(ev) {
    if (libRef.current.form === ev.target) {
      listener(ev);
    }
  });
};
var useWindowResizeListener = function useWindowResizeListener2(listener) {
  useListener(window, "resize", listener);
};
var useFontsLoadedListener = function useFontsLoadedListener2(listener) {
  useListener(document.fonts, "loadingdone", listener);
};
var _excluded$z = ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"];
var TextareaAutosize = function TextareaAutosize2(_ref, userRef) {
  var cacheMeasurements = _ref.cacheMeasurements, maxRows = _ref.maxRows, minRows = _ref.minRows, _ref$onChange = _ref.onChange, onChange = _ref$onChange === void 0 ? noop$9 : _ref$onChange, _ref$onHeightChange = _ref.onHeightChange, onHeightChange = _ref$onHeightChange === void 0 ? noop$9 : _ref$onHeightChange, props = _objectWithoutPropertiesLoose$2(_ref, _excluded$z);
  var isControlled = props.value !== void 0;
  var libRef = reactExports.useRef(null);
  var ref = useComposedRef(libRef, userRef);
  var heightRef = reactExports.useRef(0);
  var measurementsCacheRef = reactExports.useRef();
  var resizeTextarea = function resizeTextarea2() {
    var node2 = libRef.current;
    var nodeSizingData = cacheMeasurements && measurementsCacheRef.current ? measurementsCacheRef.current : getSizingData$1(node2);
    if (!nodeSizingData) {
      return;
    }
    measurementsCacheRef.current = nodeSizingData;
    var _calculateNodeHeight = calculateNodeHeight(nodeSizingData, node2.value || node2.placeholder || "x", minRows, maxRows), height = _calculateNodeHeight[0], rowHeight = _calculateNodeHeight[1];
    if (heightRef.current !== height) {
      heightRef.current = height;
      node2.style.setProperty("height", height + "px", "important");
      onHeightChange(height, {
        rowHeight
      });
    }
  };
  var handleChange = function handleChange2(event) {
    if (!isControlled) {
      resizeTextarea();
    }
    onChange(event);
  };
  {
    reactExports.useLayoutEffect(resizeTextarea);
    useFormResetListener(libRef, function() {
      if (!isControlled) {
        var currentValue = libRef.current.value;
        requestAnimationFrame(function() {
          var node2 = libRef.current;
          if (node2 && currentValue !== node2.value) {
            resizeTextarea();
          }
        });
      }
    });
    useWindowResizeListener(resizeTextarea);
    useFontsLoadedListener(resizeTextarea);
    return /* @__PURE__ */ reactExports.createElement("textarea", _extends$j({}, props, {
      onChange: handleChange,
      ref
    }));
  }
};
var index$3 = /* @__PURE__ */ reactExports.forwardRef(TextareaAutosize);
var Textarea = forwardRef(
  ({
    style: style2,
    minRows = 3,
    maxRows = 8,
    cacheMeasurements = false,
    disableAutosize = false,
    onHeightChange,
    ...otherProps
  }, ref) => {
    const {
      Component: Component2,
      label,
      description,
      startContent,
      endContent,
      hasHelper,
      shouldLabelBeOutside,
      shouldLabelBeInside,
      isInvalid,
      errorMessage,
      getBaseProps,
      getLabelProps,
      getInputProps,
      getInnerWrapperProps,
      getInputWrapperProps,
      getHelperWrapperProps,
      getDescriptionProps,
      getErrorMessageProps,
      isClearable,
      getClearButtonProps
    } = useInput({ ...otherProps, ref, isMultiline: true });
    const [hasMultipleRows, setIsHasMultipleRows] = reactExports.useState(minRows > 1);
    const [isLimitReached, setIsLimitReached] = reactExports.useState(false);
    const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
    const inputProps = getInputProps();
    const handleHeightChange = (height, meta) => {
      if (minRows === 1) {
        setIsHasMultipleRows(height >= meta.rowHeight * 2);
      }
      if (maxRows > minRows) {
        const limitReached = height >= maxRows * meta.rowHeight;
        setIsLimitReached(limitReached);
      }
      onHeightChange == null ? void 0 : onHeightChange(height, meta);
    };
    const content2 = disableAutosize ? /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { ...inputProps, style: mergeProps$3(inputProps.style, style2 != null ? style2 : {}) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      index$3,
      {
        ...inputProps,
        cacheMeasurements,
        "data-hide-scroll": dataAttr(!isLimitReached),
        maxRows,
        minRows,
        style: mergeProps$3(inputProps.style, style2 != null ? style2 : {}),
        onHeightChange: handleHeightChange
      }
    );
    const clearButtonContent = reactExports.useMemo(() => {
      return isClearable ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) }) : null;
    }, [isClearable, getClearButtonProps]);
    const innerWrapper = reactExports.useMemo(() => {
      if (startContent || endContent) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
          startContent,
          content2,
          endContent
        ] });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getInnerWrapperProps(), children: content2 });
    }, [startContent, inputProps, endContent, getInnerWrapperProps]);
    const shouldShowError = isInvalid && errorMessage;
    const hasHelperContent = shouldShowError || description;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
      shouldLabelBeOutside ? labelContent : null,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), "data-has-multiple-rows": dataAttr(hasMultipleRows), children: [
        shouldLabelBeInside ? labelContent : null,
        innerWrapper,
        clearButtonContent
      ] }),
      hasHelper && hasHelperContent ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) }) : null
    ] });
  }
);
Textarea.displayName = "HeroUI.Textarea";
var textarea_default = Textarea;
function useReactAriaPopover(props, state) {
  const {
    groupRef,
    triggerRef,
    popoverRef,
    showArrow,
    offset: offset2 = 7,
    crossOffset = 0,
    scrollRef,
    shouldFlip,
    boundaryElement,
    isDismissable = true,
    shouldCloseOnBlur = true,
    shouldCloseOnScroll = true,
    placement: placementProp = "top",
    containerPadding,
    shouldCloseOnInteractOutside,
    isNonModal: isNonModalProp,
    isKeyboardDismissDisabled,
    updatePositionDeps = [],
    ...otherProps
  } = props;
  const isNonModal = isNonModalProp != null ? isNonModalProp : true;
  const isSubmenu = otherProps["trigger"] === "SubmenuTrigger";
  const { overlayProps, underlayProps } = useAriaOverlay(
    {
      isOpen: state.isOpen,
      onClose: state.close,
      shouldCloseOnBlur,
      isDismissable: isDismissable || isSubmenu,
      isKeyboardDismissDisabled,
      shouldCloseOnInteractOutside: shouldCloseOnInteractOutside || ((el2) => {
        var _a2;
        return !((_a2 = triggerRef.current) == null ? void 0 : _a2.contains(el2));
      }),
      disableOutsideEvents: !isNonModal
    },
    popoverRef
  );
  const {
    overlayProps: positionProps,
    arrowProps,
    placement,
    updatePosition
  } = $2a41e45df1593e64$export$d39e1813b3bdd0e1({
    ...otherProps,
    shouldFlip,
    crossOffset,
    targetRef: triggerRef,
    overlayRef: popoverRef,
    isOpen: state.isOpen,
    scrollRef,
    boundaryElement,
    containerPadding,
    placement: toReactAriaPlacement(placementProp),
    offset: showArrow ? offset2 + 3 : offset2,
    onClose: isNonModal && !isSubmenu && shouldCloseOnScroll ? state.close : () => {
    }
  });
  useSafeLayoutEffect(() => {
    if (!updatePositionDeps.length)
      return;
    updatePosition();
  }, updatePositionDeps);
  reactExports.useEffect(() => {
    var _a2, _b2;
    if (state.isOpen && popoverRef.current) {
      if (isNonModal) {
        return keepVisible((_a2 = groupRef == null ? void 0 : groupRef.current) != null ? _a2 : popoverRef.current);
      } else {
        return ariaHideOutside([(_b2 = groupRef == null ? void 0 : groupRef.current) != null ? _b2 : popoverRef.current]);
      }
    }
  }, [isNonModal, state.isOpen, popoverRef, groupRef]);
  return {
    popoverProps: mergeProps$3(overlayProps, positionProps),
    arrowProps,
    underlayProps,
    placement
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6$1(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
var DEFAULT_PLACEMENT = "top";
function usePopover(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, popover.variantKeys);
  const {
    as: as2,
    ref,
    children,
    state: stateProp,
    triggerRef: triggerRefProp,
    scrollRef,
    defaultOpen,
    onOpenChange,
    isOpen: isOpenProp,
    isNonModal = true,
    shouldFlip = true,
    containerPadding = 12,
    shouldBlockScroll = false,
    isDismissable = true,
    shouldCloseOnBlur,
    portalContainer,
    updatePositionDeps,
    dialogProps: dialogPropsProp,
    placement: placementProp = DEFAULT_PLACEMENT,
    triggerType = "dialog",
    showArrow = false,
    offset: offset2 = 7,
    crossOffset = 0,
    boundaryElement,
    isKeyboardDismissDisabled,
    shouldCloseOnInteractOutside,
    shouldCloseOnScroll,
    motionProps,
    className,
    classNames: classNames2,
    onClose,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const domTriggerRef = reactExports.useRef(null);
  const wasTriggerPressedRef = reactExports.useRef(false);
  const triggerRef = triggerRefProp || domTriggerRef;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const innerState = $fc909762b330b746$export$61c6a8c84e605fb6$1({
    isOpen: isOpenProp,
    defaultOpen,
    onOpenChange: (isOpen) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen);
      if (!isOpen) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const state = stateProp || innerState;
  const {
    popoverProps,
    underlayProps,
    placement: ariaPlacement
  } = useReactAriaPopover(
    {
      triggerRef,
      isNonModal,
      popoverRef: domRef,
      placement: placementProp,
      offset: offset2,
      scrollRef,
      isDismissable,
      shouldCloseOnBlur,
      boundaryElement,
      crossOffset,
      shouldFlip,
      containerPadding,
      updatePositionDeps,
      isKeyboardDismissDisabled,
      shouldCloseOnScroll,
      shouldCloseOnInteractOutside
    },
    state
  );
  const placement = reactExports.useMemo(() => {
    if (!ariaPlacement) {
      return null;
    }
    return getShouldUseAxisPlacement(ariaPlacement, placementProp) ? ariaPlacement : placementProp;
  }, [ariaPlacement, placementProp]);
  const { triggerProps } = $628037886ba31236$export$f9d5c8beee7d008d$2({ type: triggerType }, state, triggerRef);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const slots = reactExports.useMemo(
    () => popover({
      ...variantProps2
    }),
    [objectToDeps(variantProps2)]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !(shouldBlockScroll && state.isOpen)
  });
  const getPopoverProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(popoverProps, otherProps, props2),
    style: mergeProps$3(popoverProps.style, otherProps.style, props2.style)
  });
  const getDialogProps = (props2 = {}) => ({
    // `ref` and `dialogProps` from `useDialog` are passed from props
    // if we use `useDialog` here, dialogRef won't be focused on mount
    "data-slot": "base",
    "data-open": dataAttr(state.isOpen),
    "data-focus": dataAttr(isFocused),
    "data-arrow": dataAttr(showArrow),
    "data-focus-visible": dataAttr(isFocusVisible),
    "data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
    ...mergeProps$3(focusProps, dialogPropsProp, props2),
    className: slots.base({ class: clsx$5(baseStyles) }),
    style: {
      // this prevent the dialog to have a default outline
      outline: "none"
    }
  });
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "content",
      "data-open": dataAttr(state.isOpen),
      "data-arrow": dataAttr(showArrow),
      "data-placement": ariaPlacement ? getArrowPlacement(ariaPlacement, placementProp) : void 0,
      className: slots.content({ class: clsx$5(classNames2 == null ? void 0 : classNames2.content, props2.className) })
    }),
    [slots, state.isOpen, showArrow, placement, placementProp, classNames2, ariaPlacement]
  );
  const onPress = reactExports.useCallback(
    (e2) => {
      var _a22;
      let pressTimer;
      if (e2.pointerType === "touch" && ((originalProps == null ? void 0 : originalProps.backdrop) === "blur" || (originalProps == null ? void 0 : originalProps.backdrop) === "opaque")) {
        pressTimer = setTimeout(() => {
          wasTriggerPressedRef.current = true;
        }, 100);
      } else {
        wasTriggerPressedRef.current = true;
      }
      (_a22 = triggerProps.onPress) == null ? void 0 : _a22.call(triggerProps, e2);
      return () => {
        clearTimeout(pressTimer);
      };
    },
    [triggerProps == null ? void 0 : triggerProps.onPress]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}, _ref = null) => {
      const { isDisabled, ...otherProps2 } = props2;
      return {
        "data-slot": "trigger",
        ...mergeProps$3({ "aria-haspopup": "dialog" }, triggerProps, otherProps2),
        onPress,
        isDisabled,
        className: slots.trigger({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.trigger, props2.className),
          // apply isDisabled class names to make the trigger child disabled
          // e.g. for elements like div or HeroUI elements that don't have `isDisabled` prop
          isTriggerDisabled: isDisabled
        }),
        ref: mergeRefs$1(_ref, triggerRef)
      };
    },
    [state, triggerProps, onPress, triggerRef]
  );
  const getBackdropProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "backdrop",
      className: slots.backdrop({ class: classNames2 == null ? void 0 : classNames2.backdrop }),
      onClick: (e2) => {
        if (!wasTriggerPressedRef.current) {
          e2.preventDefault();
          return;
        }
        state.close();
        wasTriggerPressedRef.current = false;
      },
      ...underlayProps,
      ...props2
    }),
    [slots, state.isOpen, classNames2, underlayProps]
  );
  return {
    state,
    Component: Component2,
    children,
    classNames: classNames2,
    showArrow,
    triggerRef,
    placement,
    isNonModal,
    popoverRef: domRef,
    portalContainer,
    isOpen: state.isOpen,
    onClose: state.close,
    disableAnimation,
    shouldBlockScroll,
    backdrop: (_c2 = originalProps.backdrop) != null ? _c2 : "transparent",
    motionProps,
    getBackdropProps,
    getPopoverProps,
    getTriggerProps,
    getDialogProps,
    getContentProps
  };
}
const $337b884510726a0d$export$a2200b96afd16271 = /* @__PURE__ */ React$6.createContext(null);
function $337b884510726a0d$export$14c98a7594375490() {
  let ctx = reactExports.useContext($337b884510726a0d$export$a2200b96afd16271);
  let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    setContain === null || setContain === void 0 ? void 0 : setContain(true);
  }, [
    setContain
  ]);
}
function $40df3f8667284809$export$d55e7ee900f34e93(props, ref) {
  let { role = "dialog" } = props;
  let titleId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  titleId = props["aria-label"] ? void 0 : titleId;
  let isRefocusing = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (ref.current && !ref.current.contains(document.activeElement)) {
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      let timeout = setTimeout(() => {
        if (document.activeElement === ref.current) {
          isRefocusing.current = true;
          if (ref.current) {
            ref.current.blur();
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
          }
          isRefocusing.current = false;
        }
      }, 500);
      return () => {
        clearTimeout(timeout);
      };
    }
  }, [
    ref
  ]);
  $337b884510726a0d$export$14c98a7594375490();
  return {
    dialogProps: {
      ...$65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
        labelable: true
      }),
      role,
      tabIndex: -1,
      "aria-labelledby": props["aria-labelledby"] || titleId,
      // Prevent blur events from reaching useOverlay, which may cause
      // popovers to close. Since focus is contained within the dialog,
      // we don't want this to occur due to the above useEffect.
      onBlur: (e2) => {
        if (isRefocusing.current)
          e2.stopPropagation();
      }
    },
    titleProps: {
      id: titleId
    }
  };
}
var domAnimation$4 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var FreeSoloPopoverWrapper = forwardRef(
  ({
    children,
    motionProps,
    placement,
    disableAnimation,
    style: styleProp = {},
    transformOrigin = {},
    ...otherProps
  }, ref) => {
    let style2 = styleProp;
    if (transformOrigin.originX !== void 0 || transformOrigin.originY !== void 0) {
      style2 = {
        ...style2,
        // @ts-ignore
        transformOrigin
      };
    } else if (placement) {
      style2 = {
        ...style2,
        ...getTransformOrigins(placement === "center" ? "top" : placement)
      };
    }
    return disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...otherProps, ref, children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        ref,
        animate: "enter",
        exit: "exit",
        initial: "initial",
        style: style2,
        variants: TRANSITION_VARIANTS.scaleSpringOpacity,
        ...mergeProps$3(otherProps, motionProps),
        children
      }
    ) });
  }
);
FreeSoloPopoverWrapper.displayName = "HeroUI.FreeSoloPopoverWrapper";
var FreeSoloPopover = forwardRef(
  ({ children, transformOrigin, disableDialogFocus = false, ...props }, ref) => {
    const {
      Component: Component2,
      state,
      placement,
      backdrop,
      portalContainer,
      disableAnimation,
      motionProps,
      isNonModal,
      getPopoverProps,
      getBackdropProps,
      getDialogProps,
      getContentProps
    } = usePopover({
      ...props,
      ref
    });
    const dialogRef = reactExports.useRef(null);
    const { dialogProps: ariaDialogProps, titleProps } = $40df3f8667284809$export$d55e7ee900f34e93({}, dialogRef);
    const dialogProps = getDialogProps({
      // by default, focus is moved into the dialog on mount
      // we can use `disableDialogFocus` to disable this behaviour
      // e.g. in autocomplete, the focus should be moved to the input (handled in autocomplete hook) instead of the dialog first
      ...!disableDialogFocus && { ref: dialogRef },
      ...ariaDialogProps
    });
    const backdropContent = reactExports.useMemo(() => {
      if (backdrop === "transparent") {
        return null;
      }
      if (disableAnimation) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$4, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        m$3.div,
        {
          animate: "enter",
          exit: "exit",
          initial: "exit",
          variants: TRANSITION_VARIANTS.fade,
          ...getBackdropProps()
        }
      ) });
    }, [backdrop, disableAnimation, getBackdropProps]);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer, children: [
      !isNonModal && backdropContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        FreeSoloPopoverWrapper,
        {
          disableAnimation,
          motionProps,
          placement,
          tabIndex: -1,
          transformOrigin,
          ...dialogProps,
          children: [
            !isNonModal && /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: state.close }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps(), children: typeof children === "function" ? children(titleProps) : children }),
            /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: state.close })
          ]
        }
      ) })
    ] });
  }
);
FreeSoloPopover.displayName = "HeroUI.FreeSoloPopover";
var free_solo_popover_default = FreeSoloPopover;
var [PopoverProvider, usePopoverContext] = createContext2({
  name: "PopoverContext",
  errorMessage: "usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Popover />`"
});
var domAnimation$3 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var PopoverContent$1 = (props) => {
  const { as: as2, children, className, ...otherProps } = props;
  const {
    Component: OverlayComponent,
    placement,
    backdrop,
    motionProps,
    disableAnimation,
    getPopoverProps,
    getDialogProps,
    getBackdropProps,
    getContentProps,
    isNonModal,
    onClose
  } = usePopoverContext();
  const dialogRef = reactExports.useRef(null);
  const { dialogProps: ariaDialogProps, titleProps } = $40df3f8667284809$export$d55e7ee900f34e93({}, dialogRef);
  const dialogProps = getDialogProps({
    ref: dialogRef,
    ...ariaDialogProps,
    ...otherProps
  });
  const Component2 = as2 || OverlayComponent || "div";
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    !isNonModal && /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...dialogProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getContentProps({ className }), children: typeof children === "function" ? children(titleProps) : children }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose })
  ] });
  const backdropContent = reactExports.useMemo(() => {
    if (backdrop === "transparent") {
      return null;
    }
    if (disableAnimation) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$3, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        variants: TRANSITION_VARIANTS.fade,
        ...getBackdropProps()
      }
    ) });
  }, [backdrop, disableAnimation, getBackdropProps]);
  const style2 = placement ? getTransformOrigins(placement === "center" ? "top" : placement) : void 0;
  const contents = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? content2 : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$3, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      exit: "exit",
      initial: "initial",
      style: style2,
      variants: TRANSITION_VARIANTS.scaleSpringOpacity,
      ...motionProps,
      children: content2
    }
  ) }) });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getPopoverProps(), children: [
    backdropContent,
    contents
  ] });
};
PopoverContent$1.displayName = "HeroUI.PopoverContent";
var popover_content_default = PopoverContent$1;
var PopoverTrigger = (props) => {
  var _a2;
  const { triggerRef, getTriggerProps } = usePopoverContext();
  const { children, ...otherProps } = props;
  const child = reactExports.useMemo(() => {
    if (typeof children === "string")
      return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children });
    return reactExports.Children.only(children);
  }, [children]);
  const childRef = (_a2 = child.props.ref) != null ? _a2 : child.ref;
  const { onPress, isDisabled, ...restProps } = reactExports.useMemo(() => {
    return getTriggerProps(mergeProps$3(otherProps, child.props), childRef);
  }, [getTriggerProps, child.props, otherProps, childRef]);
  const [, triggerChildren] = pickChildren(children, button_default$1);
  const { buttonProps } = useAriaButton$1({ onPress, isDisabled }, triggerRef);
  const hasHeroUIButton = reactExports.useMemo(() => {
    return (triggerChildren == null ? void 0 : triggerChildren[0]) !== void 0;
  }, [triggerChildren]);
  if (!hasHeroUIButton) {
    delete restProps["preventFocusOnPress"];
  }
  return reactExports.cloneElement(
    child,
    mergeProps$3(restProps, hasHeroUIButton ? { onPress, isDisabled } : buttonProps)
  );
};
PopoverTrigger.displayName = "HeroUI.PopoverTrigger";
var popover_trigger_default = PopoverTrigger;
var Popover$1 = forwardRef((props, ref) => {
  const { children, ...otherProps } = props;
  const context = usePopover({ ...otherProps, ref });
  const [trigger, content2] = reactExports.Children.toArray(children);
  const overlay = /* @__PURE__ */ jsxRuntimeExports.jsx($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer: context.portalContainer, children: content2 });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(PopoverProvider, { value: context, children: [
    trigger,
    context.disableAnimation && context.isOpen ? overlay : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: context.isOpen ? overlay : null })
  ] });
});
Popover$1.displayName = "HeroUI.Popover";
var popover_default = Popover$1;
var [DropdownProvider, useDropdownContext] = createContext2({
  name: "DropdownContext",
  errorMessage: "useDropdownContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Dropdown />`"
});
function MenuSelectedIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      "data-selected": isSelected,
      role: "presentation",
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "polyline",
        {
          fill: "none",
          points: "1 9 7 14 15 4",
          stroke: "currentColor",
          strokeDasharray: 22,
          strokeDashoffset: isSelected ? 44 : 66,
          strokeLinecap: "round",
          strokeLinejoin: "round",
          strokeWidth: 1.5,
          style: !disableAnimation ? {
            transition: "stroke-dashoffset 200ms ease"
          } : {}
        }
      )
    }
  );
}
var $c0398ad35c3639b7$exports$1 = {};
$c0398ad35c3639b7$exports$1 = {
  "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
};
var $7af657c4165927c3$exports$1 = {};
$7af657c4165927c3$exports$1 = {
  "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
};
var $d95d4da6d531ab81$exports$1 = {};
$d95d4da6d531ab81$exports$1 = {
  "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
};
var $24ebda9c775dca17$exports$1 = {};
$24ebda9c775dca17$exports$1 = {
  "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
};
var $743e0dfca6cab1e9$exports$1 = {};
$743e0dfca6cab1e9$exports$1 = {
  "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
};
var $a2f41026e05f1c84$exports$1 = {};
$a2f41026e05f1c84$exports$1 = {
  "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
};
var $43b800e97c901737$exports$1 = {};
$43b800e97c901737$exports$1 = {
  "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
};
var $442f5f6ac211e29f$exports$1 = {};
$442f5f6ac211e29f$exports$1 = {
  "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
};
var $dff280acfeb2d8ac$exports$1 = {};
$dff280acfeb2d8ac$exports$1 = {
  "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
};
var $51608325613944d7$exports$1 = {};
$51608325613944d7$exports$1 = {
  "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
};
var $c4a1b1eabeaa87be$exports$1 = {};
$c4a1b1eabeaa87be$exports$1 = {
  "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
};
var $8c74815cdee18d1b$exports$1 = {};
$8c74815cdee18d1b$exports$1 = {
  "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
};
var $fd0e9ef6a7fe0ec9$exports$1 = {};
$fd0e9ef6a7fe0ec9$exports$1 = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
};
var $a89a74a39eba465a$exports$1 = {};
$a89a74a39eba465a$exports$1 = {
  "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
};
var $edc7c66594a0ae8a$exports$1 = {};
$edc7c66594a0ae8a$exports$1 = {
  "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
};
var $f1ab51510712db52$exports$1 = {};
$f1ab51510712db52$exports$1 = {
  "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
};
var $f9b672d9b82fa3d6$exports$1 = {};
$f9b672d9b82fa3d6$exports$1 = {
  "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
};
var $a385f3910feda499$exports$1 = {};
$a385f3910feda499$exports$1 = {
  "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
};
var $4f1bde932c441789$exports$1 = {};
$4f1bde932c441789$exports$1 = {
  "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
};
var $914a51a8a594d5be$exports$1 = {};
$914a51a8a594d5be$exports$1 = {
  "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
};
var $89aaf803103bb500$exports$1 = {};
$89aaf803103bb500$exports$1 = {
  "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
};
var $c685891476dbaaca$exports$1 = {};
$c685891476dbaaca$exports$1 = {
  "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
};
var $885879b9b10c2959$exports$1 = {};
$885879b9b10c2959$exports$1 = {
  "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
};
var $6b39616688a51692$exports$1 = {};
$6b39616688a51692$exports$1 = {
  "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
};
var $f26362aed63f47e2$exports$1 = {};
$f26362aed63f47e2$exports$1 = {
  "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
};
var $06cbade644558bf0$exports$1 = {};
$06cbade644558bf0$exports$1 = {
  "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
};
var $0a391ff68f9d59b1$exports$1 = {};
$0a391ff68f9d59b1$exports$1 = {
  "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
};
var $8193cf0e649c7928$exports$1 = {};
$8193cf0e649c7928$exports$1 = {
  "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
};
var $f398debcce5a5c55$exports$1 = {};
$f398debcce5a5c55$exports$1 = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
};
var $9e9fef000aa4c013$exports$1 = {};
$9e9fef000aa4c013$exports$1 = {
  "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
};
var $c016c8183bbe3d68$exports$1 = {};
$c016c8183bbe3d68$exports$1 = {
  "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
};
var $ca4f6c8462244e62$exports$1 = {};
$ca4f6c8462244e62$exports$1 = {
  "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
};
var $2d9960c02ccac927$exports$1 = {};
$2d9960c02ccac927$exports$1 = {
  "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
};
var $f1b682a4c8c5631c$exports$1 = {};
$f1b682a4c8c5631c$exports$1 = {
  "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
};
var $2cbb7ca666678a14$exports$1 = {};
$2cbb7ca666678a14$exports$1 = {
  "ar-AE": $c0398ad35c3639b7$exports$1,
  "bg-BG": $7af657c4165927c3$exports$1,
  "cs-CZ": $d95d4da6d531ab81$exports$1,
  "da-DK": $24ebda9c775dca17$exports$1,
  "de-DE": $743e0dfca6cab1e9$exports$1,
  "el-GR": $a2f41026e05f1c84$exports$1,
  "en-US": $43b800e97c901737$exports$1,
  "es-ES": $442f5f6ac211e29f$exports$1,
  "et-EE": $dff280acfeb2d8ac$exports$1,
  "fi-FI": $51608325613944d7$exports$1,
  "fr-FR": $c4a1b1eabeaa87be$exports$1,
  "he-IL": $8c74815cdee18d1b$exports$1,
  "hr-HR": $fd0e9ef6a7fe0ec9$exports$1,
  "hu-HU": $a89a74a39eba465a$exports$1,
  "it-IT": $edc7c66594a0ae8a$exports$1,
  "ja-JP": $f1ab51510712db52$exports$1,
  "ko-KR": $f9b672d9b82fa3d6$exports$1,
  "lt-LT": $a385f3910feda499$exports$1,
  "lv-LV": $4f1bde932c441789$exports$1,
  "nb-NO": $914a51a8a594d5be$exports$1,
  "nl-NL": $89aaf803103bb500$exports$1,
  "pl-PL": $c685891476dbaaca$exports$1,
  "pt-BR": $885879b9b10c2959$exports$1,
  "pt-PT": $6b39616688a51692$exports$1,
  "ro-RO": $f26362aed63f47e2$exports$1,
  "ru-RU": $06cbade644558bf0$exports$1,
  "sk-SK": $0a391ff68f9d59b1$exports$1,
  "sl-SI": $8193cf0e649c7928$exports$1,
  "sr-SP": $f398debcce5a5c55$exports$1,
  "sv-SE": $9e9fef000aa4c013$exports$1,
  "tr-TR": $c016c8183bbe3d68$exports$1,
  "uk-UA": $ca4f6c8462244e62$exports$1,
  "zh-CN": $2d9960c02ccac927$exports$1,
  "zh-TW": $f1b682a4c8c5631c$exports$1
};
const $dd149f63282afbbf$export$f6211563215e3b37$1 = /* @__PURE__ */ new WeakMap();
function $628037886ba31236$export$f9d5c8beee7d008d$1(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37$1.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
function $parcel$interopDefault$k(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $168583247155ddda$export$dc9c12ed27dd1b49$1(props, state, ref) {
  let { type: type4 = "menu", isDisabled, trigger = "press" } = props;
  let menuTriggerId = $bdb11010cef70236$export$f680877a34711e37$2();
  let { triggerProps, overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d$1({
    type: type4
  }, state, ref);
  let onKeyDown = (e2) => {
    if (isDisabled)
      return;
    if (trigger === "longPress" && !e2.altKey)
      return;
    if (ref && ref.current)
      switch (e2.key) {
        case "Enter":
        case " ":
          if (trigger === "longPress")
            return;
        case "ArrowDown":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("first");
          break;
        case "ArrowUp":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("last");
          break;
        default:
          if ("continuePropagation" in e2)
            e2.continuePropagation();
      }
  };
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$k($2cbb7ca666678a14$exports$1), "@react-aria/menu");
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: isDisabled || trigger !== "longPress",
    accessibilityDescription: stringFormatter.format("longPressMessage"),
    onLongPressStart() {
      state.close();
    },
    onLongPress() {
      state.open("first");
    }
  });
  let pressProps = {
    preventFocusOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.open(e2.pointerType === "virtual" ? "first" : null);
      }
    },
    onPress(e2) {
      if (e2.pointerType === "touch" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.toggle();
      }
    }
  };
  delete triggerProps.onPress;
  return {
    // @ts-ignore - TODO we pass out both DOMAttributes AND AriaButtonProps, but useButton will discard the longPress event handlers, it's only through PressResponder magic that this works for RSP and RAC. it does not work in aria examples
    menuTriggerProps: {
      ...triggerProps,
      ...trigger === "press" ? pressProps : longPressProps,
      id: menuTriggerId,
      onKeyDown
    },
    menuProps: {
      ...overlayProps,
      "aria-labelledby": menuTriggerId,
      autoFocus: state.focusStrategy || true,
      onClose: state.close
    }
  };
}
const $fc79756100351201$export$6f49b4016bfc8d56 = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$d3e3bd3e26688c04(e2) {
  return $c87311424ea30a05$export$e1865c3bedcd822b() ? e2.altKey : e2.ctrlKey;
}
function $feb5ffebff200149$export$c3d8340acf92597f$1(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $feb5ffebff200149$var$collectionMap = /* @__PURE__ */ new WeakMap();
function $feb5ffebff200149$export$881eb0d9f3605d9d(collection) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  $feb5ffebff200149$var$collectionMap.set(collection, id2);
  return id2;
}
function $feb5ffebff200149$export$6aeb1680a0ae8741(collection) {
  return $feb5ffebff200149$var$collectionMap.get(collection);
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$1 = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8$1(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey$1(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target) || state.search.length === 0 && character2 === " ")
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS$1);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey$1(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
function $9bf71ea28793e738$var$isTabbableRadio$3(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$3(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$3(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$3(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$3(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$3 = class $9bf71ea28793e738$var$Tree5 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$3({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$3(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree5();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$3({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$3 = class $9bf71ea28793e738$var$TreeNode5 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$3();
function $55f9b1ae81f22853$export$76e4e37e5339496d(to2) {
  let from2 = $55f9b1ae81f22853$export$759df0d867455a91($431fbd86ca7dc216$export$b204af158042fbac$4(to2));
  if (from2 !== to2) {
    if (from2)
      $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from2, to2);
    if (to2)
      $55f9b1ae81f22853$export$2b35b76d2e30e129$1(to2, from2);
  }
}
function $55f9b1ae81f22853$export$6c5dc7e81d2cc29a(from2, to2) {
  from2.dispatchEvent(new FocusEvent("blur", {
    relatedTarget: to2
  }));
  from2.dispatchEvent(new FocusEvent("focusout", {
    bubbles: true,
    relatedTarget: to2
  }));
}
function $55f9b1ae81f22853$export$2b35b76d2e30e129$1(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $55f9b1ae81f22853$export$759df0d867455a91(document2) {
  let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(document2);
  let activeDescendant = activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute("aria-activedescendant");
  if (activeDescendant)
    return document2.getElementById(activeDescendant) || activeElement;
  return activeElement;
}
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
  let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, escapeKeyBehavior = "clearSelection", selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref, linkBehavior = "action" } = options;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    var _ref_current;
    if (e2.altKey && e2.key === "Tab")
      e2.preventDefault();
    if (!((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e2.target)))
      return;
    const navigateToKey = (key, childFocus) => {
      if (key != null) {
        if (manager.isLink(key) && linkBehavior === "selection" && selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e2)) {
          reactDomExports.flushSync(() => {
            manager.setFocusedKey(key, childFocus);
          });
          let item = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, key);
          let itemProps = manager.getItemProps(key);
          if (item)
            router.open(item, e2, itemProps.href, itemProps.routerOptions);
          return;
        }
        manager.setFocusedKey(key, childFocus);
        if (manager.isLink(key) && linkBehavior === "override")
          return;
        if (e2.shiftKey && manager.selectionMode === "multiple")
          manager.extendSelection(key);
        else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e2))
          manager.replaceSelection(key);
      }
    };
    switch (e2.key) {
      case "ArrowDown":
        if (delegate.getKeyBelow) {
          var _delegate_getKeyBelow, _delegate_getFirstKey, _delegate_getFirstKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyBelow = delegate.getKeyBelow) === null || _delegate_getKeyBelow === void 0 ? void 0 : _delegate_getKeyBelow.call(delegate, manager.focusedKey) : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getFirstKey1 = delegate.getFirstKey) === null || _delegate_getFirstKey1 === void 0 ? void 0 : _delegate_getFirstKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowUp":
        if (delegate.getKeyAbove) {
          var _delegate_getKeyAbove, _delegate_getLastKey, _delegate_getLastKey1;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyAbove = delegate.getKeyAbove) === null || _delegate_getKeyAbove === void 0 ? void 0 : _delegate_getKeyAbove.call(delegate, manager.focusedKey) : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate);
          if (nextKey == null && shouldFocusWrap)
            nextKey = (_delegate_getLastKey1 = delegate.getLastKey) === null || _delegate_getLastKey1 === void 0 ? void 0 : _delegate_getLastKey1.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "ArrowLeft":
        if (delegate.getKeyLeftOf) {
          var _delegate_getKeyLeftOf, _delegate_getFirstKey2, _delegate_getLastKey2;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyLeftOf = delegate.getKeyLeftOf) === null || _delegate_getKeyLeftOf === void 0 ? void 0 : _delegate_getKeyLeftOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getFirstKey2 = delegate.getFirstKey) === null || _delegate_getFirstKey2 === void 0 ? void 0 : _delegate_getFirstKey2.call(delegate, manager.focusedKey) : (_delegate_getLastKey2 = delegate.getLastKey) === null || _delegate_getLastKey2 === void 0 ? void 0 : _delegate_getLastKey2.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
          }
        }
        break;
      case "ArrowRight":
        if (delegate.getKeyRightOf) {
          var _delegate_getKeyRightOf, _delegate_getLastKey3, _delegate_getFirstKey3;
          let nextKey = manager.focusedKey != null ? (_delegate_getKeyRightOf = delegate.getKeyRightOf) === null || _delegate_getKeyRightOf === void 0 ? void 0 : _delegate_getKeyRightOf.call(delegate, manager.focusedKey) : null;
          if (nextKey == null && shouldFocusWrap)
            nextKey = direction === "rtl" ? (_delegate_getLastKey3 = delegate.getLastKey) === null || _delegate_getLastKey3 === void 0 ? void 0 : _delegate_getLastKey3.call(delegate, manager.focusedKey) : (_delegate_getFirstKey3 = delegate.getFirstKey) === null || _delegate_getFirstKey3 === void 0 ? void 0 : _delegate_getFirstKey3.call(delegate, manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
          }
        }
        break;
      case "Home":
        if (delegate.getFirstKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let firstKey = delegate.getFirstKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(firstKey);
          if (firstKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(firstKey);
            else if (selectOnFocus)
              manager.replaceSelection(firstKey);
          }
        }
        break;
      case "End":
        if (delegate.getLastKey) {
          if (manager.focusedKey === null && e2.shiftKey)
            return;
          e2.preventDefault();
          let lastKey = delegate.getLastKey(manager.focusedKey, $21f1aa98acb08317$export$16792effe837dba3(e2));
          manager.setFocusedKey(lastKey);
          if (lastKey != null) {
            if ($21f1aa98acb08317$export$16792effe837dba3(e2) && e2.shiftKey && manager.selectionMode === "multiple")
              manager.extendSelection(lastKey);
            else if (selectOnFocus)
              manager.replaceSelection(lastKey);
          }
        }
        break;
      case "PageDown":
        if (delegate.getKeyPageBelow && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "PageUp":
        if (delegate.getKeyPageAbove && manager.focusedKey != null) {
          let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
          if (nextKey != null) {
            e2.preventDefault();
            navigateToKey(nextKey);
          }
        }
        break;
      case "a":
        if ($21f1aa98acb08317$export$16792effe837dba3(e2) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
          e2.preventDefault();
          manager.selectAll();
        }
        break;
      case "Escape":
        if (escapeKeyBehavior === "clearSelection" && !disallowEmptySelection && manager.selectedKeys.size !== 0) {
          e2.stopPropagation();
          e2.preventDefault();
          manager.clearSelection();
        }
        break;
      case "Tab":
        if (!allowsTabNavigation) {
          if (e2.shiftKey)
            ref.current.focus();
          else {
            let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$3(ref.current, {
              tabbable: true
            });
            let next2 = void 0;
            let last;
            do {
              last = walker.lastChild();
              if (last)
                next2 = last;
            } while (last);
            if (next2 && !next2.contains(document.activeElement))
              $7215afc6de606d6b$export$de79e2c695e052f3$5(next2);
          }
          break;
        }
    }
  };
  let scrollPos = reactExports.useRef({
    top: 0,
    left: 0
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? void 0 : () => {
    var _scrollRef_current, _scrollRef_current1;
    var _scrollRef_current_scrollTop, _scrollRef_current_scrollLeft;
    scrollPos.current = {
      top: (_scrollRef_current_scrollTop = (_scrollRef_current = scrollRef.current) === null || _scrollRef_current === void 0 ? void 0 : _scrollRef_current.scrollTop) !== null && _scrollRef_current_scrollTop !== void 0 ? _scrollRef_current_scrollTop : 0,
      left: (_scrollRef_current_scrollLeft = (_scrollRef_current1 = scrollRef.current) === null || _scrollRef_current1 === void 0 ? void 0 : _scrollRef_current1.scrollLeft) !== null && _scrollRef_current_scrollLeft !== void 0 ? _scrollRef_current_scrollLeft : 0
    };
  });
  let onFocus = (e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
    if (manager.focusedKey == null) {
      var _delegate_getLastKey, _delegate_getFirstKey;
      let navigateToKey = (key) => {
        if (key != null) {
          manager.setFocusedKey(key);
          if (selectOnFocus && !manager.isSelected(key))
            manager.replaceSelection(key);
        }
      };
      let relatedTarget = e2.relatedTarget;
      var _manager_lastSelectedKey, _manager_firstSelectedKey;
      if (relatedTarget && e2.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
        navigateToKey((_manager_lastSelectedKey = manager.lastSelectedKey) !== null && _manager_lastSelectedKey !== void 0 ? _manager_lastSelectedKey : (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate));
      else
        navigateToKey((_manager_firstSelectedKey = manager.firstSelectedKey) !== null && _manager_firstSelectedKey !== void 0 ? _manager_firstSelectedKey : (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate));
    } else if (!isVirtualized && scrollRef.current) {
      scrollRef.current.scrollTop = scrollPos.current.top;
      scrollRef.current.scrollLeft = scrollPos.current.left;
    }
    if (manager.focusedKey != null && scrollRef.current) {
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, manager.focusedKey);
      if (element2 instanceof HTMLElement) {
        if (!element2.contains(document.activeElement) && !shouldUseVirtualFocus)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
        let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
        if (modality === "keyboard")
          $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
            containingElement: ref.current
          });
      }
    }
  };
  let onBlur = (e2) => {
    if (!e2.currentTarget.contains(e2.relatedTarget))
      manager.setFocused(false);
  };
  let shouldVirtualFocusFirst = reactExports.useRef(false);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$831c820ad60f9d12, !shouldUseVirtualFocus ? void 0 : (e2) => {
    let { detail } = e2;
    e2.stopPropagation();
    manager.setFocused(true);
    if ((detail === null || detail === void 0 ? void 0 : detail.focusStrategy) === "first")
      shouldVirtualFocusFirst.current = true;
  });
  let updateActiveDescendant = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _delegate_getFirstKey;
    var _delegate_getFirstKey1;
    let keyToFocus = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
    if (keyToFocus == null) {
      let previousActiveElement = $d4ee10de306f2510$export$cd4e5573fbe2b576();
      $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
      $55f9b1ae81f22853$export$2b35b76d2e30e129$1(previousActiveElement, null);
      if (manager.collection.size > 0)
        shouldVirtualFocusFirst.current = false;
    } else {
      manager.setFocusedKey(keyToFocus);
      shouldVirtualFocusFirst.current = false;
    }
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    if (shouldVirtualFocusFirst.current)
      updateActiveDescendant();
  }, [
    manager.collection,
    updateActiveDescendant
  ]);
  let resetFocusFirstFlag = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (manager.collection.size > 0)
      shouldVirtualFocusFirst.current = false;
  });
  $ca9b37712f007381$export$72ef708ab07251f1(() => {
    resetFocusFirstFlag();
  }, [
    manager.focusedKey,
    resetFocusFirstFlag
  ]);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, $5671b20cf9b562b2$export$447a38995de2c711, !shouldUseVirtualFocus ? void 0 : (e2) => {
    var _e_detail;
    e2.stopPropagation();
    manager.setFocused(false);
    if ((_e_detail = e2.detail) === null || _e_detail === void 0 ? void 0 : _e_detail.clearFocusKey)
      manager.setFocusedKey(null);
  });
  const autoFocusRef = reactExports.useRef(autoFocus);
  const didAutoFocusRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (autoFocusRef.current) {
      var _delegate_getFirstKey, _delegate_getLastKey;
      let focusedKey = null;
      var _delegate_getFirstKey1;
      if (autoFocus === "first")
        focusedKey = (_delegate_getFirstKey1 = (_delegate_getFirstKey = delegate.getFirstKey) === null || _delegate_getFirstKey === void 0 ? void 0 : _delegate_getFirstKey.call(delegate)) !== null && _delegate_getFirstKey1 !== void 0 ? _delegate_getFirstKey1 : null;
      var _delegate_getLastKey1;
      if (autoFocus === "last")
        focusedKey = (_delegate_getLastKey1 = (_delegate_getLastKey = delegate.getLastKey) === null || _delegate_getLastKey === void 0 ? void 0 : _delegate_getLastKey.call(delegate)) !== null && _delegate_getLastKey1 !== void 0 ? _delegate_getLastKey1 : null;
      let selectedKeys = manager.selectedKeys;
      if (selectedKeys.size) {
        for (let key of selectedKeys)
          if (manager.canSelectItem(key)) {
            focusedKey = key;
            break;
          }
      }
      manager.setFocused(true);
      manager.setFocusedKey(focusedKey);
      if (focusedKey == null && !shouldUseVirtualFocus && ref.current)
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      if (manager.collection.size > 0) {
        autoFocusRef.current = false;
        didAutoFocusRef.current = true;
      }
    }
  });
  let lastFocusedKey = reactExports.useRef(manager.focusedKey);
  let raf3 = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (manager.isFocused && manager.focusedKey != null && (manager.focusedKey !== lastFocusedKey.current || didAutoFocusRef.current) && scrollRef.current && ref.current) {
      let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9$2();
      let element2 = $feb5ffebff200149$export$c3d8340acf92597f$1(ref, manager.focusedKey);
      if (!(element2 instanceof HTMLElement))
        return;
      if (modality === "keyboard" || didAutoFocusRef.current) {
        if (raf3.current)
          cancelAnimationFrame(raf3.current);
        raf3.current = requestAnimationFrame(() => {
          if (scrollRef.current) {
            $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element2);
            if (modality !== "virtual")
              $2f04cbc44ee30ce0$export$c826860796309d1b(element2, {
                containingElement: ref.current
              });
          }
        });
      }
    }
    if (!shouldUseVirtualFocus && manager.isFocused && manager.focusedKey == null && lastFocusedKey.current != null && ref.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    lastFocusedKey.current = manager.focusedKey;
    didAutoFocusRef.current = false;
  });
  reactExports.useEffect(() => {
    return () => {
      if (raf3.current)
        cancelAnimationFrame(raf3.current);
    };
  }, []);
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "react-aria-focus-scope-restore", (e2) => {
    e2.preventDefault();
    manager.setFocused(true);
  });
  let handlers2 = {
    onKeyDown,
    onFocus,
    onBlur,
    onMouseDown(e2) {
      if (scrollRef.current === e2.target)
        e2.preventDefault();
    }
  };
  let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8$1({
    keyboardDelegate: delegate,
    selectionManager: manager
  });
  if (!disallowTypeAhead)
    handlers2 = $3ef42575df84b30b$export$9d1611c77c2fe928$9(typeSelectProps, handlers2);
  let tabIndex = void 0;
  if (!shouldUseVirtualFocus)
    tabIndex = manager.focusedKey == null ? 0 : -1;
  let collectionId = $feb5ffebff200149$export$881eb0d9f3605d9d(manager.collection);
  return {
    collectionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(handlers2, {
      tabIndex,
      "data-collection": collectionId
    })
  };
}
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
  let { id: id2, selectionManager: manager, key, ref, shouldSelectOnPressUp, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin, linkBehavior = "action" } = options;
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  id2 = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let onSelect = (e2) => {
    if (e2.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e2))
      manager.toggleSelection(key);
    else {
      if (manager.selectionMode === "none")
        return;
      if (manager.isLink(key)) {
        if (linkBehavior === "selection" && ref.current) {
          let itemProps2 = manager.getItemProps(key);
          router.open(ref.current, e2, itemProps2.href, itemProps2.routerOptions);
          manager.setSelectedKeys(manager.selectedKeys);
          return;
        } else if (linkBehavior === "override" || linkBehavior === "none")
          return;
      }
      if (manager.selectionMode === "single") {
        if (manager.isSelected(key) && !manager.disallowEmptySelection)
          manager.toggleSelection(key);
        else
          manager.replaceSelection(key);
      } else if (e2 && e2.shiftKey)
        manager.extendSelection(key);
      else if (manager.selectionBehavior === "toggle" || e2 && ($21f1aa98acb08317$export$16792effe837dba3(e2) || e2.pointerType === "touch" || e2.pointerType === "virtual"))
        manager.toggleSelection(key);
      else
        manager.replaceSelection(key);
    }
  };
  reactExports.useEffect(() => {
    let isFocused = key === manager.focusedKey;
    if (isFocused && manager.isFocused) {
      if (!shouldUseVirtualFocus) {
        if (focus)
          focus();
        else if (document.activeElement !== ref.current && ref.current)
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
      } else
        $55f9b1ae81f22853$export$76e4e37e5339496d(ref.current);
    }
  }, [
    ref,
    key,
    manager.focusedKey,
    manager.childFocusStrategy,
    manager.isFocused,
    shouldUseVirtualFocus
  ]);
  isDisabled = isDisabled || manager.isDisabled(key);
  let itemProps = {};
  if (!shouldUseVirtualFocus && !isDisabled)
    itemProps = {
      tabIndex: key === manager.focusedKey ? 0 : -1,
      onFocus(e2) {
        if (e2.target === ref.current)
          manager.setFocusedKey(key);
      }
    };
  else if (isDisabled)
    itemProps.onMouseDown = (e2) => {
      e2.preventDefault();
    };
  let isLinkOverride = manager.isLink(key) && linkBehavior === "override";
  let hasLinkAction = manager.isLink(key) && linkBehavior !== "selection" && linkBehavior !== "none";
  let allowsSelection = !isDisabled && manager.canSelectItem(key) && !isLinkOverride;
  let allowsActions = (onAction || hasLinkAction) && !isDisabled;
  let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : !allowsSelection || manager.isEmpty);
  let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
  let hasAction = hasPrimaryAction || hasSecondaryAction;
  let modality = reactExports.useRef(null);
  let longPressEnabled = hasAction && allowsSelection;
  let longPressEnabledOnPressStart = reactExports.useRef(false);
  let hadPrimaryActionOnPressStart = reactExports.useRef(false);
  let collectionItemProps = manager.getItemProps(key);
  let performAction = (e2) => {
    if (onAction)
      onAction();
    if (hasLinkAction && ref.current)
      router.open(ref.current, e2, collectionItemProps.href, collectionItemProps.routerOptions);
  };
  let itemPressProps = {
    ref
  };
  if (shouldSelectOnPressUp) {
    itemPressProps.onPressStart = (e2) => {
      modality.current = e2.pointerType;
      longPressEnabledOnPressStart.current = longPressEnabled;
      if (e2.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
        onSelect(e2);
    };
    if (!allowsDifferentPressOrigin)
      itemPressProps.onPress = (e2) => {
        if (hasPrimaryAction || hasSecondaryAction && e2.pointerType !== "mouse") {
          if (e2.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
            return;
          performAction(e2);
        } else if (e2.pointerType !== "keyboard" && allowsSelection)
          onSelect(e2);
      };
    else {
      itemPressProps.onPressUp = hasPrimaryAction ? void 0 : (e2) => {
        if (e2.pointerType === "mouse" && allowsSelection)
          onSelect(e2);
      };
      itemPressProps.onPress = hasPrimaryAction ? performAction : (e2) => {
        if (e2.pointerType !== "keyboard" && e2.pointerType !== "mouse" && allowsSelection)
          onSelect(e2);
      };
    }
  } else {
    itemPressProps.onPressStart = (e2) => {
      modality.current = e2.pointerType;
      longPressEnabledOnPressStart.current = longPressEnabled;
      hadPrimaryActionOnPressStart.current = hasPrimaryAction;
      if (allowsSelection && (e2.pointerType === "mouse" && !hasPrimaryAction || e2.pointerType === "keyboard" && (!allowsActions || $880e95eb8b93ba9a$var$isSelectionKey())))
        onSelect(e2);
    };
    itemPressProps.onPress = (e2) => {
      if (e2.pointerType === "touch" || e2.pointerType === "pen" || e2.pointerType === "virtual" || e2.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e2.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
        if (hasAction)
          performAction(e2);
        else if (allowsSelection)
          onSelect(e2);
      }
    };
  }
  itemProps["data-collection"] = $feb5ffebff200149$export$6aeb1680a0ae8741(manager.collection);
  itemProps["data-key"] = key;
  itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
  if (shouldUseVirtualFocus)
    itemPressProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(itemPressProps, {
      onPressStart(e2) {
        if (e2.pointerType !== "touch") {
          manager.setFocused(true);
          manager.setFocusedKey(key);
        }
      },
      onPress(e2) {
        if (e2.pointerType === "touch") {
          manager.setFocused(true);
          manager.setFocusedKey(key);
        }
      }
    });
  if (collectionItemProps) {
    for (let key2 of [
      "onPressStart",
      "onPressEnd",
      "onPressChange",
      "onPress",
      "onPressUp",
      "onClick"
    ])
      if (collectionItemProps[key2])
        itemPressProps[key2] = $ff5963eb1fccf552$export$e08e3b67e392101e$9(itemPressProps[key2], collectionItemProps[key2]);
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b(itemPressProps);
  let onDoubleClick = hasSecondaryAction ? (e2) => {
    if (modality.current === "mouse") {
      e2.stopPropagation();
      e2.preventDefault();
      performAction(e2);
    }
  } : void 0;
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: !longPressEnabled,
    onLongPress(e2) {
      if (e2.pointerType === "touch") {
        onSelect(e2);
        manager.setSelectionBehavior("toggle");
      }
    }
  });
  let onDragStartCapture = (e2) => {
    if (modality.current === "touch" && longPressEnabledOnPressStart.current)
      e2.preventDefault();
  };
  let onClick = linkBehavior !== "none" && manager.isLink(key) ? (e2) => {
    if (!$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening)
      e2.preventDefault();
  } : void 0;
  return {
    itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(
      itemProps,
      allowsSelection || hasPrimaryAction || shouldUseVirtualFocus && !isDisabled ? pressProps : {},
      longPressEnabled ? longPressProps : {},
      {
        onDoubleClick,
        onDragStartCapture,
        onClick,
        id: id2
      },
      // Prevent DOM focus from moving on mouse down when using virtual focus
      shouldUseVirtualFocus ? {
        onMouseDown: (e2) => e2.preventDefault()
      } : void 0
    ),
    isPressed,
    isSelected: manager.isSelected(key),
    isFocused: manager.isFocused && manager.focusedKey === key,
    isDisabled,
    allowsSelection,
    hasAction
  };
}
function $880e95eb8b93ba9a$var$isActionKey() {
  let event = window.event;
  return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
}
function $880e95eb8b93ba9a$var$isSelectionKey() {
  let event = window.event;
  return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
}
let $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1 = class $657e4dc4a6e88df0$export$8f5ed9ff9f5113812 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f$1(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
};
let $2a25aae57d74318e$export$a05409b8bb224a5a$1 = class $2a25aae57d74318e$export$a05409b8bb224a5a2 {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def$1(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
};
function $982254629710d113$export$b95089534ab7c1fd(props) {
  let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, layoutDelegate } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let disabledBehavior = selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$1({
    collection,
    disabledKeys,
    disabledBehavior,
    ref,
    collator,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    ref,
    collator,
    disabledBehavior
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ...props,
    ref,
    selectionManager,
    keyboardDelegate: delegate
  });
  return {
    listProps: collectionProps
  };
}
function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
  let { shouldFocusWrap = true, onKeyDown, onKeyUp, ...otherProps } = props;
  if (!props["aria-label"] && !props["aria-labelledby"] && false)
    ;
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
    ...otherProps,
    ref,
    selectionManager: state.selectionManager,
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    shouldFocusWrap,
    linkBehavior: "override"
  });
  $fc79756100351201$export$6f49b4016bfc8d56.set(state, {
    onClose: props.onClose,
    onAction: props.onAction,
    shouldUseVirtualFocus: props.shouldUseVirtualFocus
  });
  return {
    menuProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, {
      onKeyDown,
      onKeyUp
    }, {
      role: "menu",
      ...listProps,
      onKeyDown: (e2) => {
        var _listProps_onKeyDown;
        if (e2.key !== "Escape" || props.shouldUseVirtualFocus)
          (_listProps_onKeyDown = listProps.onKeyDown) === null || _listProps_onKeyDown === void 0 ? void 0 : _listProps_onKeyDown.call(listProps, e2);
      }
    })
  };
}
function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
  let { id: id2, key, closeOnSelect, isVirtualized, "aria-haspopup": hasPopup, onPressStart: pressStartProp, onPressUp: pressUpProp, onPress: pressProp, onPressChange, onPressEnd, onHoverStart: hoverStartProp, onHoverChange, onHoverEnd, onKeyDown, onKeyUp, onFocus, onFocusChange, onBlur, selectionManager = state.selectionManager } = props;
  let isTrigger = !!hasPopup;
  let isTriggerExpanded = isTrigger && props["aria-expanded"] === "true";
  var _props_isDisabled;
  let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : selectionManager.isDisabled(key);
  var _props_isSelected;
  let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : selectionManager.isSelected(key);
  let data = $fc79756100351201$export$6f49b4016bfc8d56.get(state);
  let item = state.collection.getItem(key);
  let onClose = props.onClose || data.onClose;
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let performAction = (e2) => {
    var _item_props;
    if (isTrigger)
      return;
    if (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.onAction)
      item.props.onAction();
    else if (props.onAction)
      props.onAction(key);
    if (data.onAction) {
      let onAction = data.onAction;
      onAction(key);
    }
    if (e2.target instanceof HTMLAnchorElement && item)
      router.open(e2.target, e2, item.props.href, item.props.routerOptions);
  };
  let role = "menuitem";
  if (!isTrigger) {
    if (selectionManager.selectionMode === "single")
      role = "menuitemradio";
    else if (selectionManager.selectionMode === "multiple")
      role = "menuitemcheckbox";
  }
  let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let keyboardId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let ariaProps = {
    id: id2,
    "aria-disabled": isDisabled || void 0,
    role,
    "aria-label": props["aria-label"],
    "aria-labelledby": labelId,
    "aria-describedby": [
      descriptionId,
      keyboardId
    ].filter(Boolean).join(" ") || void 0,
    "aria-controls": props["aria-controls"],
    "aria-haspopup": hasPopup,
    "aria-expanded": props["aria-expanded"]
  };
  if (selectionManager.selectionMode !== "none" && !isTrigger)
    ariaProps["aria-checked"] = isSelected;
  if (isVirtualized) {
    ariaProps["aria-posinset"] = item === null || item === void 0 ? void 0 : item.index;
    ariaProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  }
  let onPressStart = (e2) => {
    if (e2.pointerType === "keyboard")
      performAction(e2);
    pressStartProp === null || pressStartProp === void 0 ? void 0 : pressStartProp(e2);
  };
  let maybeClose = () => {
    if (!isTrigger && onClose && (closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : selectionManager.selectionMode !== "multiple" || selectionManager.isLink(key)))
      onClose();
  };
  let onPressUp = (e2) => {
    if (e2.pointerType === "mouse") {
      performAction(e2);
      maybeClose();
    }
    pressUpProp === null || pressUpProp === void 0 ? void 0 : pressUpProp(e2);
  };
  let onPress = (e2) => {
    if (e2.pointerType !== "keyboard" && e2.pointerType !== "mouse") {
      performAction(e2);
      maybeClose();
    }
    pressProp === null || pressProp === void 0 ? void 0 : pressProp(e2);
  };
  let { itemProps, isFocused } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    id: id2,
    selectionManager,
    key,
    ref,
    shouldSelectOnPressUp: true,
    allowsDifferentPressOrigin: true,
    // Disable all handling of links in useSelectable item
    // because we handle it ourselves. The behavior of menus
    // is slightly different from other collections because
    // actions are performed on key down rather than key up.
    linkBehavior: "none",
    shouldUseVirtualFocus: data.shouldUseVirtualFocus
  });
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPressStart,
    onPress,
    onPressUp,
    onPressChange,
    onPressEnd,
    isDisabled
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled,
    onHoverStart(e2) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2() && !(isTriggerExpanded && hasPopup)) {
        selectionManager.setFocused(true);
        selectionManager.setFocusedKey(key);
      }
      hoverStartProp === null || hoverStartProp === void 0 ? void 0 : hoverStartProp(e2);
    },
    onHoverChange,
    onHoverEnd
  });
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2({
    onKeyDown: (e2) => {
      if (e2.repeat) {
        e2.continuePropagation();
        return;
      }
      switch (e2.key) {
        case " ":
          if (!isDisabled && selectionManager.selectionMode === "none" && !isTrigger && closeOnSelect !== false && onClose)
            onClose();
          break;
        case "Enter":
          if (!isDisabled && closeOnSelect !== false && !isTrigger && onClose)
            onClose();
          break;
        default:
          if (!isTrigger)
            e2.continuePropagation();
          onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e2);
          break;
      }
    },
    onKeyUp
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    onBlur,
    onFocus,
    onFocusChange
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props);
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  return {
    menuItemProps: {
      ...ariaProps,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(
        domProps,
        linkProps,
        isTrigger ? {
          onFocus: itemProps.onFocus,
          "data-collection": itemProps["data-collection"],
          "data-key": itemProps["data-key"]
        } : itemProps,
        pressProps,
        hoverProps,
        keyboardProps,
        focusProps,
        // Prevent DOM focus from moving on mouse down when using virtual focus or this is a submenu/subdialog trigger.
        data.shouldUseVirtualFocus || isTrigger ? {
          onMouseDown: (e2) => e2.preventDefault()
        } : void 0
      ),
      // If a submenu is expanded, set the tabIndex to -1 so that shift tabbing goes out of the menu instead of the parent menu item.
      tabIndex: itemProps.tabIndex != null && isTriggerExpanded && !data.shouldUseVirtualFocus ? -1 : itemProps.tabIndex
    },
    labelProps: {
      id: labelId
    },
    descriptionProps: {
      id: descriptionId
    },
    keyboardShortcutProps: {
      id: keyboardId
    },
    isFocused,
    isFocusVisible: isFocused && selectionManager.isFocused && $507fabe10e71c6fb$export$b9b3dfddab17db27$2() && !isTriggerExpanded,
    isSelected,
    isPressed,
    isDisabled
  };
}
function $3e5eb2498db5b506$export$73f7a44322579622(props) {
  let { heading: heading2, "aria-label": ariaLabel } = props;
  let headingId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    itemProps: {
      role: "presentation"
    },
    headingProps: heading2 ? {
      // Techincally, menus cannot contain headings according to ARIA.
      // We hide the heading from assistive technology, using role="presentation",
      // and only use it as a label for the nested group.
      id: headingId,
      role: "presentation"
    } : {},
    groupProps: {
      role: "group",
      "aria-label": ariaLabel,
      "aria-labelledby": heading2 ? headingId : void 0
    }
  };
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$3 = false;
let $507fabe10e71c6fb$var$currentModality$1 = null;
let $507fabe10e71c6fb$var$changeHandlers$3 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$3 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$3(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$3)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$3(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$3(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
  if ($507fabe10e71c6fb$var$isValidKey$3(e2)) {
    $507fabe10e71c6fb$var$currentModality$1 = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$3(e2) {
  $507fabe10e71c6fb$var$currentModality$1 = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$3(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    $507fabe10e71c6fb$var$currentModality$1 = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$3(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$3 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$3 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$3) {
    $507fabe10e71c6fb$var$currentModality$1 = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers$3("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$3() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$3 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$3.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$3 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$3, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$3, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$3, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$3.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$3.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$3.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$3, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$3, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$3, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$3, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$3, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$3.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$3(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$3(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$3(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$3();
function $507fabe10e71c6fb$export$b9b3dfddab17db27$1() {
  return $507fabe10e71c6fb$var$currentModality$1 !== "pointer";
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = false;
let $6179b936705e76d3$var$hoverCount$8 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$8() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$8(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$8();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$8() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$8);
  $6179b936705e76d3$var$hoverCount$8++;
  return () => {
    $6179b936705e76d3$var$hoverCount$8--;
    if ($6179b936705e76d3$var$hoverCount$8 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$8);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$8(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$8, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$8 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $b5e257d569688ac6$var$defaultContext$7 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$7 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$7);
const $b5e257d569688ac6$var$IsSSRContext$7 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$7 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$7(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$7);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$7.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$7.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$7.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$7(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$7);
  let counter = $b5e257d569688ac6$var$useCounter$7(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$7(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$7());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$7.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$7 : $b5e257d569688ac6$var$useLegacySSRSafeId$7;
function $b5e257d569688ac6$var$getSnapshot$7() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$7() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$7(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$7() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$7, $b5e257d569688ac6$var$getSnapshot$7, $b5e257d569688ac6$var$getServerSnapshot$7);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$7);
}
var MOBILE_SCREEN_WIDTH = 700;
function useIsMobile() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$7();
  if (isSSR || typeof window === "undefined") {
    return false;
  }
  return window.screen.width <= MOBILE_SCREEN_WIDTH;
}
function useMenuItem(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, menuItem.variantKeys);
  const {
    as: as2,
    item,
    state,
    shortcut,
    description,
    startContent,
    endContent,
    isVirtualized,
    selectedIcon,
    className,
    classNames: classNames2,
    onAction,
    autoFocus,
    onPress,
    onPressStart,
    onPressUp,
    onPressEnd,
    onPressChange,
    onHoverStart: hoverStartProp,
    onHoverChange,
    onHoverEnd,
    hideSelectedIcon = false,
    isReadOnly = false,
    closeOnSelect,
    onClose,
    onClick,
    ...otherProps
  } = props;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = reactExports.useRef(null);
  const Component2 = as2 || ((otherProps == null ? void 0 : otherProps.href) ? "a" : "li");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const { rendered, key } = item;
  const isDisabledProp = state.disabledKeys.has(key) || originalProps.isDisabled;
  const isSelectable = state.selectionManager.selectionMode !== "none";
  const isMobile2 = useIsMobile();
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const handlePress = reactExports.useCallback(
    (e2) => {
      onClick == null ? void 0 : onClick(e2);
      onPress == null ? void 0 : onPress(e2);
    },
    [onClick, onPress]
  );
  const {
    isPressed,
    isFocused,
    isSelected,
    isDisabled,
    menuItemProps,
    labelProps,
    descriptionProps,
    keyboardShortcutProps
  } = $a2e5df62f93c7633$export$9d32628fc2aea7da(
    {
      key,
      onClose,
      isDisabled: isDisabledProp,
      onPress: handlePress,
      onPressStart,
      onPressUp,
      onPressEnd,
      onPressChange,
      "aria-label": props["aria-label"],
      closeOnSelect,
      isVirtualized,
      onAction
    },
    state,
    domRef
  );
  let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$8({
    isDisabled,
    onHoverStart(e2) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$1()) {
        state.selectionManager.setFocused(true);
        state.selectionManager.setFocusedKey(key);
      }
      hoverStartProp == null ? void 0 : hoverStartProp(e2);
    },
    onHoverChange,
    onHoverEnd
  });
  let itemProps = menuItemProps;
  const slots = reactExports.useMemo(
    () => menuItem({
      ...variantProps2,
      isDisabled,
      disableAnimation,
      hasTitleTextChild: typeof rendered === "string",
      hasDescriptionTextChild: typeof description === "string"
    }),
    [objectToDeps(variantProps2), isDisabled, disableAnimation, rendered, description]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  if (isReadOnly) {
    itemProps = removeEvents(itemProps);
  }
  const getItemProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(
      isReadOnly ? {} : focusProps,
      filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      itemProps,
      hoverProps,
      props2
    ),
    "data-focus": dataAttr(isFocused),
    "data-selectable": dataAttr(isSelectable),
    "data-hover": dataAttr(isMobile2 ? isHovered || isPressed : isHovered),
    "data-disabled": dataAttr(isDisabled),
    "data-selected": dataAttr(isSelected),
    "data-pressed": dataAttr(isPressed),
    "data-focus-visible": dataAttr(isFocusVisible),
    className: slots.base({ class: clsx$5(baseStyles, props2.className) })
  });
  const getLabelProps = (props2 = {}) => ({
    ...mergeProps$3(labelProps, props2),
    className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
  });
  const getDescriptionProps = (props2 = {}) => ({
    ...mergeProps$3(descriptionProps, props2),
    className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
  });
  const getKeyboardShortcutProps = (props2 = {}) => ({
    ...mergeProps$3(keyboardShortcutProps, props2),
    className: slots.shortcut({ class: classNames2 == null ? void 0 : classNames2.shortcut })
  });
  const getSelectedIconProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-disabled": dataAttr(isDisabled),
        className: slots.selectedIcon({ class: classNames2 == null ? void 0 : classNames2.selectedIcon }),
        ...props2
      };
    },
    [isDisabled, slots, classNames2]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isSelectable,
    isSelected,
    isDisabled,
    rendered,
    shortcut,
    description,
    startContent,
    endContent,
    selectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    hideSelectedIcon,
    getDescriptionProps,
    getKeyboardShortcutProps,
    getSelectedIconProps
  };
}
var MenuItem$4 = (props) => {
  const {
    Component: Component2,
    slots,
    classNames: classNames2,
    rendered,
    shortcut,
    description,
    isSelectable,
    isSelected,
    isDisabled,
    selectedIcon,
    startContent,
    endContent,
    disableAnimation,
    hideSelectedIcon,
    getItemProps,
    getLabelProps,
    getDescriptionProps,
    getKeyboardShortcutProps,
    getSelectedIconProps
  } = useMenuItem(props);
  const selectedContent = reactExports.useMemo(() => {
    const defaultIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSelectedIcon, { disableAnimation, isSelected });
    if (typeof selectedIcon === "function") {
      return selectedIcon({ icon: defaultIcon, isSelected, isDisabled });
    }
    if (selectedIcon)
      return selectedIcon;
    return defaultIcon;
  }, [selectedIcon, isSelected, isDisabled, disableAnimation]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getItemProps(), children: [
    startContent,
    description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
    shortcut && /* @__PURE__ */ jsxRuntimeExports.jsx("kbd", { ...getKeyboardShortcutProps(), children: shortcut }),
    isSelectable && !hideSelectedIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSelectedIconProps(), children: selectedContent }),
    endContent
  ] });
};
MenuItem$4.displayName = "HeroUI.MenuItem";
var menu_item_default = MenuItem$4;
var MenuSection = forwardRef(
  ({
    item,
    state,
    as: as2,
    variant,
    color: color2,
    disableAnimation,
    onAction,
    closeOnSelect,
    className,
    classNames: classNames2,
    showDivider = false,
    hideSelectedIcon,
    dividerProps = {},
    itemClasses,
    // removed title from props to avoid browsers showing a tooltip on hover
    // the title props is already inside the rendered prop
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    title,
    ...otherProps
  }, _24) => {
    const Component2 = as2 || "li";
    const slots = reactExports.useMemo(() => menuSection(), []);
    const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
    const dividerStyles = clsx$5(classNames2 == null ? void 0 : classNames2.divider, dividerProps == null ? void 0 : dividerProps.className);
    const { itemProps, headingProps, groupProps } = $3e5eb2498db5b506$export$73f7a44322579622({
      heading: item.rendered,
      "aria-label": item["aria-label"]
    });
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Component2,
      {
        "data-slot": "base",
        ...mergeProps$3(itemProps, otherProps),
        className: slots.base({ class: baseStyles }),
        children: [
          item.rendered && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              ...headingProps,
              className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
              "data-slot": "heading",
              children: item.rendered
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "ul",
            {
              ...groupProps,
              className: slots.group({ class: classNames2 == null ? void 0 : classNames2.group }),
              "data-has-title": !!item.rendered,
              "data-slot": "group",
              children: [
                [...item.childNodes].map((node2) => {
                  const { key: nodeKey, props: nodeProps } = node2;
                  let menuItem2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
                    menu_item_default,
                    {
                      classNames: itemClasses,
                      closeOnSelect,
                      color: color2,
                      disableAnimation,
                      hideSelectedIcon,
                      item: node2,
                      state,
                      variant,
                      onAction,
                      ...nodeProps
                    },
                    nodeKey
                  );
                  if (node2.wrapper) {
                    menuItem2 = node2.wrapper(menuItem2);
                  }
                  return menuItem2;
                }),
                showDivider && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  divider_default,
                  {
                    as: "li",
                    className: slots.divider({
                      class: dividerStyles
                    }),
                    ...dividerProps
                  }
                )
              ]
            }
          )
        ]
      }
    );
  }
);
MenuSection.displayName = "HeroUI.MenuSection";
var menu_section_default = MenuSection;
function useMenu(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    as: as2,
    ref,
    variant,
    color: color2,
    children,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    onAction,
    closeOnSelect,
    itemClasses,
    className,
    state: propState,
    topContent,
    bottomContent,
    hideEmptyContent = false,
    hideSelectedIcon = false,
    emptyContent = "No items.",
    menuProps: userMenuProps,
    onClose,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "ul";
  const domRef = useDOMRef(ref);
  const shouldFilterDOMProps = typeof Component2 === "string";
  const innerState = $875d6693e12af071$export$728d6ba534403756({ ...otherProps, ...userMenuProps, children });
  const state = propState || innerState;
  const { menuProps } = $d5336fe17ce95402$export$38eaa17faae8f579({ ...otherProps, ...userMenuProps, onAction }, state, domRef);
  const slots = reactExports.useMemo(() => menu$1({ className }), [className]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "base",
      className: slots.base({ class: baseStyles }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props2
    };
  };
  const getListProps = (props2 = {}) => {
    return {
      "data-slot": "list",
      className: slots.list({ class: classNames2 == null ? void 0 : classNames2.list }),
      ...menuProps,
      ...props2
    };
  };
  const getEmptyContentProps = (props2 = {}) => {
    return {
      children: emptyContent,
      className: slots.emptyContent({ class: classNames2 == null ? void 0 : classNames2.emptyContent }),
      ...props2
    };
  };
  return {
    Component: Component2,
    state,
    variant,
    color: color2,
    disableAnimation,
    onClose,
    topContent,
    bottomContent,
    closeOnSelect,
    className,
    itemClasses,
    getBaseProps,
    getListProps,
    hideEmptyContent,
    hideSelectedIcon,
    getEmptyContentProps
  };
}
var Menu$2 = forwardRef(function Menu2(props, ref) {
  const {
    Component: Component2,
    state,
    closeOnSelect,
    color: color2,
    disableAnimation,
    hideSelectedIcon,
    hideEmptyContent,
    variant,
    onClose,
    topContent,
    bottomContent,
    itemClasses,
    getBaseProps,
    getListProps,
    getEmptyContentProps
  } = useMenu({ ...props, ref });
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getListProps(), children: [
    !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
    [...state.collection].map((item) => {
      const itemProps = {
        closeOnSelect,
        color: color2,
        disableAnimation,
        item,
        state,
        variant,
        onClose,
        hideSelectedIcon,
        ...item.props
      };
      const mergedItemClasses = mergeClasses$2(itemClasses, itemProps == null ? void 0 : itemProps.classNames);
      if (item.type === "section") {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(menu_section_default, { ...itemProps, itemClasses: mergedItemClasses }, item.key);
      }
      let menuItem2 = /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_default, { ...itemProps, classNames: mergedItemClasses }, item.key);
      if (item.wrapper) {
        menuItem2 = item.wrapper(menuItem2);
      }
      return menuItem2;
    })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
});
var menu_default = Menu$2;
var MenuItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var menu_item_base_default = MenuItemBase;
var DropdownMenu = forwardRef(function DropdownMenu2(props, ref) {
  const { getMenuProps } = useDropdownContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(popover_content_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx($9bf71ea28793e738$export$20e40289641fbbb6, { contain: true, restoreFocus: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(menu_default, { ...getMenuProps(props, ref) }) }) });
});
var dropdown_menu_default = DropdownMenu;
var DropdownTrigger = (props) => {
  const { getMenuTriggerProps } = useDropdownContext();
  const { children, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(popover_trigger_default, { ...getMenuTriggerProps(otherProps), children });
};
DropdownTrigger.displayName = "HeroUI.DropdownTrigger";
var dropdown_trigger_default = DropdownTrigger;
function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3$1(props) {
  let overlayTriggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let [expandedKeysStack, setExpandedKeysStack] = reactExports.useState([]);
  let closeAll = () => {
    setExpandedKeysStack([]);
    overlayTriggerState.close();
  };
  let openSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      if (level > oldStack.length)
        return oldStack;
      return [
        ...oldStack.slice(0, level),
        triggerKey
      ];
    });
  };
  let closeSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      let key = oldStack[level];
      if (key === triggerKey)
        return oldStack.slice(0, level);
      else
        return oldStack;
    });
  };
  return {
    focusStrategy,
    ...overlayTriggerState,
    open(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.open();
    },
    toggle(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.toggle();
    },
    close() {
      closeAll();
    },
    expandedKeysStack,
    openSubmenu,
    closeSubmenu
  };
}
var getMenuItem = (props, key) => {
  if (props) {
    const mergedChildren = Array.isArray(props.children) ? props.children : [...(props == null ? void 0 : props.items) || []];
    if (mergedChildren && mergedChildren.length) {
      const item = mergedChildren.find((item2) => {
        if (item2 && item2.key === key) {
          return item2;
        }
      }) || {};
      return item;
    }
  }
  return null;
};
var getCloseOnSelect = (props, key, item) => {
  const mergedItem = item || getMenuItem(props, key);
  if (mergedItem && mergedItem.props && "closeOnSelect" in mergedItem.props) {
    return mergedItem.props.closeOnSelect;
  }
  return props == null ? void 0 : props.closeOnSelect;
};
function useDropdown(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    as: as2,
    triggerRef: triggerRefProp,
    isOpen,
    defaultOpen,
    onOpenChange,
    isDisabled,
    type: type4 = "menu",
    trigger = "press",
    placement = "bottom",
    closeOnSelect = true,
    shouldBlockScroll = true,
    classNames: classNamesProp,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    onClose,
    className,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const triggerRef = reactExports.useRef(null);
  const menuTriggerRef = triggerRefProp || triggerRef;
  const menuRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  const state = $a28c903ee9ad8dc5$export$79fefeb1c2091ac3$1({
    trigger,
    isOpen,
    defaultOpen,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49$1(
    { type: type4, trigger, isDisabled },
    state,
    menuTriggerRef
  );
  const styles2 = reactExports.useMemo(
    () => dropdown({
      className
    }),
    [className]
  );
  const onMenuAction = (menuCloseOnSelect) => {
    if (menuCloseOnSelect !== void 0 && !menuCloseOnSelect) {
      return;
    }
    if (closeOnSelect) {
      state.close();
    }
  };
  const getPopoverProps = (props2 = {}) => {
    const popoverProps = mergeProps$3(otherProps, props2);
    return {
      state,
      placement,
      ref: popoverRef,
      disableAnimation,
      shouldBlockScroll,
      scrollRef: menuRef,
      triggerRef: menuTriggerRef,
      ...popoverProps,
      classNames: {
        ...classNamesProp,
        ...props2.classNames,
        content: clsx$5(styles2, classNamesProp == null ? void 0 : classNamesProp.content, props2.className)
      }
    };
  };
  const getMenuTriggerProps = (originalProps = {}) => {
    const { onPress, onPressStart, ...otherMenuTriggerProps } = menuTriggerProps;
    return mergeProps$3(otherMenuTriggerProps, { isDisabled }, originalProps);
  };
  const getMenuProps = (props2, _ref = null) => {
    return {
      ref: mergeRefs(_ref, menuRef),
      menuProps,
      closeOnSelect,
      ...mergeProps$3(props2, {
        onAction: (key, item) => {
          const closeOnSelect2 = getCloseOnSelect(props2, key, item);
          onMenuAction(closeOnSelect2);
        },
        onClose: state.close
      })
    };
  };
  return {
    Component: Component2,
    menuRef,
    menuProps,
    closeOnSelect,
    onClose: state.close,
    autoFocus: state.focusStrategy || true,
    disableAnimation,
    getPopoverProps,
    getMenuProps,
    getMenuTriggerProps
  };
}
var Dropdown = (props) => {
  const { children, ...otherProps } = props;
  const context = useDropdown(otherProps);
  const [menuTrigger, menu2] = React$6.Children.toArray(children);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownProvider, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(popover_default, { ...context.getPopoverProps(), children: [
    menuTrigger,
    menu2
  ] }) });
};
Dropdown.displayName = "HeroUI.Dropdown";
var dropdown_default = Dropdown;
function useImage$1(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, image$1.variantKeys);
  const {
    ref,
    as: as2,
    src,
    className,
    classNames: classNames2,
    loading,
    isBlurred,
    fallbackSrc,
    isLoading: isLoadingProp,
    disableSkeleton = !!fallbackSrc,
    removeWrapper = false,
    onError,
    onLoad,
    srcSet,
    sizes,
    crossOrigin,
    ...otherProps
  } = props;
  const imageStatus = useImage$2({
    src,
    loading,
    onError,
    onLoad,
    ignoreFallback: false,
    srcSet,
    sizes,
    crossOrigin,
    shouldBypassImageLoad: as2 !== void 0
  });
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isImgLoaded = imageStatus === "loaded" && !isLoadingProp;
  const isLoading = imageStatus === "loading" || isLoadingProp;
  const isZoomed = originalProps.isZoomed;
  const Component2 = as2 || "img";
  const domRef = useDOMRef(ref);
  const { w: w2, h: h3 } = reactExports.useMemo(() => {
    return {
      w: props.width ? typeof props.width === "number" ? `${props.width}px` : props.width : "fit-content",
      h: props.height ? typeof props.height === "number" ? `${props.height}px` : props.height : "auto"
    };
  }, [props == null ? void 0 : props.width, props == null ? void 0 : props.height]);
  const showFallback = (!src || !isImgLoaded) && !!fallbackSrc;
  const showSkeleton = isLoading && !disableSkeleton;
  const slots = reactExports.useMemo(
    () => image$1({
      ...variantProps2,
      disableAnimation,
      showSkeleton
    }),
    [objectToDeps(variantProps2), disableAnimation, showSkeleton]
  );
  const baseStyles = clsx$5(className, classNames2 == null ? void 0 : classNames2.img);
  const getImgProps = (props2 = {}) => {
    const imgStyles = clsx$5(baseStyles, props2 == null ? void 0 : props2.className);
    return {
      src,
      ref: domRef,
      "data-loaded": dataAttr(isImgLoaded),
      className: slots.img({ class: imgStyles }),
      loading,
      srcSet,
      sizes,
      crossOrigin,
      ...otherProps,
      style: {
        // img has `height: auto` by default
        // passing the custom height here to override if it is specified
        ...(otherProps == null ? void 0 : otherProps.height) && { height: h3 },
        ...props2.style,
        ...otherProps.style
      }
    };
  };
  const getWrapperProps = reactExports.useCallback(() => {
    const fallbackStyle = showFallback ? {
      backgroundImage: `url(${fallbackSrc})`
    } : {};
    return {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      style: {
        ...fallbackStyle,
        maxWidth: w2
      }
    };
  }, [slots, showFallback, fallbackSrc, classNames2 == null ? void 0 : classNames2.wrapper, w2]);
  const getBlurredImgProps = reactExports.useCallback(() => {
    return {
      src,
      "aria-hidden": dataAttr(true),
      className: slots.blurredImg({ class: classNames2 == null ? void 0 : classNames2.blurredImg })
    };
  }, [slots, src, classNames2 == null ? void 0 : classNames2.blurredImg]);
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isBlurred,
    disableSkeleton,
    fallbackSrc,
    removeWrapper,
    isZoomed,
    isLoading,
    getImgProps,
    getWrapperProps,
    getBlurredImgProps
  };
}
var Image$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isBlurred,
    isZoomed,
    fallbackSrc,
    removeWrapper,
    disableSkeleton,
    getImgProps,
    getWrapperProps,
    getBlurredImgProps
  } = useImage$1({
    ...props,
    ref
  });
  const img = /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref: domRef, ...getImgProps() });
  if (removeWrapper) {
    return img;
  }
  const zoomed = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.zoomedWrapper({ class: classNames2 == null ? void 0 : classNames2.zoomedWrapper }), children: img });
  if (isBlurred) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      isZoomed ? zoomed : img,
      reactExports.cloneElement(img, getBlurredImgProps())
    ] });
  }
  if (isZoomed || !disableSkeleton || fallbackSrc) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      " ",
      isZoomed ? zoomed : img
    ] });
  }
  return img;
});
Image$1.displayName = "HeroUI.Image";
var image_default = Image$1;
var [ModalProvider, useModalContext] = createContext2({
  name: "ModalContext",
  errorMessage: "useModalContext: `context` is undefined. Seems you forgot to wrap all popover components within `<Modal />`"
});
var ModalBody = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2, bodyId, setBodyMounted } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "div";
  reactExports.useEffect(() => {
    setBodyMounted(true);
    return () => setBodyMounted(false);
  }, [setBodyMounted]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.body({ class: clsx$5(classNames2 == null ? void 0 : classNames2.body, className) }),
      id: bodyId,
      ...otherProps,
      children
    }
  );
});
ModalBody.displayName = "HeroUI.ModalBody";
var modal_body_default = ModalBody;
var scaleInOut = {
  enter: {
    scale: "var(--scale-enter)",
    y: "var(--slide-enter)",
    opacity: 1,
    willChange: "auto",
    transition: {
      scale: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      },
      opacity: {
        duration: 0.4,
        ease: TRANSITION_EASINGS.ease
      },
      y: {
        type: "spring",
        bounce: 0,
        duration: 0.6
      }
    }
  },
  exit: {
    scale: "var(--scale-exit)",
    y: "var(--slide-exit)",
    opacity: 0,
    willChange: "transform",
    transition: {
      duration: 0.3,
      ease: TRANSITION_EASINGS.ease
    }
  }
};
var visualViewport = typeof document !== "undefined" && window.visualViewport;
var IsSSRContext = React$6.createContext(false);
function getSnapshot() {
  return false;
}
function getServerSnapshot() {
  return true;
}
function subscribe(onStoreChange) {
  return () => {
  };
}
function useIsSSR() {
  if (typeof React$6["useSyncExternalStore"] === "function") {
    return React$6["useSyncExternalStore"](subscribe, getSnapshot, getServerSnapshot);
  }
  return reactExports.useContext(IsSSRContext);
}
function useViewportSize() {
  let isSSR = useIsSSR();
  let [size2, setSize] = reactExports.useState(() => isSSR ? { width: 0, height: 0 } : getViewportSize());
  reactExports.useEffect(() => {
    let onResize4 = () => {
      setSize((size22) => {
        let newSize = getViewportSize();
        if (newSize.width === size22.width && newSize.height === size22.height) {
          return size22;
        }
        return newSize;
      });
    };
    if (!visualViewport) {
      window.addEventListener("resize", onResize4);
    } else {
      visualViewport.addEventListener("resize", onResize4);
    }
    return () => {
      if (!visualViewport) {
        window.removeEventListener("resize", onResize4);
      } else {
        visualViewport.removeEventListener("resize", onResize4);
      }
    };
  }, []);
  return size2;
}
function getViewportSize() {
  return {
    width: visualViewport && (visualViewport == null ? void 0 : visualViewport.width) || window.innerWidth,
    height: visualViewport && (visualViewport == null ? void 0 : visualViewport.height) || window.innerHeight
  };
}
var domAnimation$2 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var ModalContent$1 = (props) => {
  const { as: as2, children, role = "dialog", ...otherProps } = props;
  const {
    Component: DialogComponent,
    domRef,
    slots,
    classNames: classNames2,
    motionProps,
    backdrop,
    closeButton,
    hideCloseButton,
    disableAnimation,
    getDialogProps,
    getBackdropProps,
    getCloseButtonProps,
    onClose
  } = useModalContext();
  const Component2 = as2 || DialogComponent || "div";
  const viewport = useViewportSize();
  const { dialogProps } = $40df3f8667284809$export$d55e7ee900f34e93(
    {
      role
    },
    domRef
  );
  const closeButtonContent = reactExports.isValidElement(closeButton) ? reactExports.cloneElement(closeButton, getCloseButtonProps()) : /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getCloseButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, {}) });
  const onKeyDown = reactExports.useCallback((e2) => {
    if (e2.key === "Tab" && e2.nativeEvent.isComposing) {
      e2.stopPropagation();
      e2.preventDefault();
    }
  }, []);
  const contentProps = getDialogProps(mergeProps$3(dialogProps, otherProps));
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...contentProps, onKeyDown: chain(contentProps.onKeyDown, onKeyDown), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose }),
    !hideCloseButton && closeButtonContent,
    typeof children === "function" ? children(onClose) : children,
    /* @__PURE__ */ jsxRuntimeExports.jsx($86ea4cb521eb2e37$export$2317d149ed6f78c4, { onDismiss: onClose })
  ] });
  const backdropContent = reactExports.useMemo(() => {
    if (backdrop === "transparent") {
      return null;
    }
    if (disableAnimation) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBackdropProps() });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.div,
      {
        animate: "enter",
        exit: "exit",
        initial: "exit",
        variants: TRANSITION_VARIANTS.fade,
        ...getBackdropProps()
      }
    ) });
  }, [backdrop, disableAnimation, getBackdropProps]);
  const viewportStyle = {
    "--visual-viewport-height": viewport.height + "px"
  };
  const contents = disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      "data-slot": "wrapper",
      style: viewportStyle,
      children: content2
    }
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: "enter",
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      "data-slot": "wrapper",
      exit: "exit",
      initial: "exit",
      variants: scaleInOut,
      ...motionProps,
      style: viewportStyle,
      children: content2
    }
  ) });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { tabIndex: -1, children: [
    backdropContent,
    contents
  ] });
};
ModalContent$1.displayName = "HeroUI.ModalContent";
var modal_content_default = ModalContent$1;
var ModalFooter = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2 } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "footer";
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.footer({ class: clsx$5(classNames2 == null ? void 0 : classNames2.footer, className) }),
      ...otherProps,
      children
    }
  );
});
ModalFooter.displayName = "HeroUI.ModalFooter";
var modal_footer_default = ModalFooter;
var ModalHeader = forwardRef((props, ref) => {
  const { as: as2, children, className, ...otherProps } = props;
  const { slots, classNames: classNames2, headerId, setHeaderMounted } = useModalContext();
  const domRef = useDOMRef(ref);
  const Component2 = as2 || "header";
  reactExports.useEffect(() => {
    setHeaderMounted(true);
    return () => setHeaderMounted(false);
  }, [setHeaderMounted]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: slots.header({ class: clsx$5(classNames2 == null ? void 0 : classNames2.header, className) }),
      id: headerId,
      ...otherProps,
      children
    }
  );
});
ModalHeader.displayName = "HeroUI.ModalHeader";
var modal_header_default = ModalHeader;
let $bdb11010cef70236$export$d41a04c74483c6ef$3 = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$3.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629$3(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$3.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$3.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$3(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$3(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$3(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$3(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function useAriaModalOverlay(props = {
  shouldBlockScroll: true
}, state, ref) {
  let { overlayProps, underlayProps } = useAriaOverlay(
    {
      ...props,
      isOpen: state.isOpen,
      onClose: state.close
    },
    ref
  );
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !state.isOpen || !props.shouldBlockScroll
  });
  $337b884510726a0d$export$14c98a7594375490$1();
  reactExports.useEffect(() => {
    if (state.isOpen && ref.current) {
      return $5e3802645cc19319$export$1c3ebcada18427bf$1([ref.current]);
    }
  }, [state.isOpen, ref]);
  return {
    modalProps: $3ef42575df84b30b$export$9d1611c77c2fe928$3(overlayProps),
    underlayProps
  };
}
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
  let [isOpen, setOpen] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.isOpen, props.defaultOpen || false, props.onOpenChange);
  const open = reactExports.useCallback(() => {
    setOpen(true);
  }, [
    setOpen
  ]);
  const close = reactExports.useCallback(() => {
    setOpen(false);
  }, [
    setOpen
  ]);
  const toggle2 = reactExports.useCallback(() => {
    setOpen(!isOpen);
  }, [
    setOpen,
    isOpen
  ]);
  return {
    isOpen,
    setOpen,
    open,
    close,
    toggle: toggle2
  };
}
function useModal(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, modal.variantKeys);
  const {
    ref,
    as: as2,
    className,
    classNames: classNames2,
    isOpen,
    defaultOpen,
    onOpenChange,
    motionProps,
    closeButton,
    isDismissable = true,
    hideCloseButton = false,
    shouldBlockScroll = true,
    portalContainer,
    isKeyboardDismissDisabled = false,
    onClose,
    ...otherProps
  } = props;
  const Component2 = as2 || "section";
  const domRef = useDOMRef(ref);
  const closeButtonRef = reactExports.useRef(null);
  const [headerMounted, setHeaderMounted] = reactExports.useState(false);
  const [bodyMounted, setBodyMounted] = reactExports.useState(false);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const dialogId = reactExports.useId();
  const headerId = reactExports.useId();
  const bodyId = reactExports.useId();
  const state = $fc909762b330b746$export$61c6a8c84e605fb6({
    isOpen,
    defaultOpen,
    onOpenChange: (isOpen2) => {
      onOpenChange == null ? void 0 : onOpenChange(isOpen2);
      if (!isOpen2) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  const { modalProps, underlayProps } = useAriaModalOverlay(
    {
      isDismissable,
      shouldBlockScroll,
      isKeyboardDismissDisabled
    },
    state,
    domRef
  );
  const { buttonProps: closeButtonProps } = useAriaButton$1({ onPress: state.close }, closeButtonRef);
  const { isFocusVisible: isCloseButtonFocusVisible, focusProps: closeButtonFocusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => modal({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2), disableAnimation]
  );
  const getDialogProps = (props2 = {}, ref2 = null) => {
    var _a22;
    return {
      ref: mergeRefs$1(ref2, domRef),
      ...mergeProps$3(modalProps, otherProps, props2),
      className: slots.base({ class: clsx$5(baseStyles, props2.className) }),
      id: dialogId,
      "data-open": dataAttr(state.isOpen),
      "data-dismissable": dataAttr(isDismissable),
      "aria-modal": dataAttr(true),
      "data-placement": (_a22 = originalProps == null ? void 0 : originalProps.placement) != null ? _a22 : "right",
      "aria-labelledby": headerMounted ? headerId : void 0,
      "aria-describedby": bodyMounted ? bodyId : void 0
    };
  };
  const getBackdropProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.backdrop({ class: classNames2 == null ? void 0 : classNames2.backdrop }),
      ...underlayProps,
      ...props2
    }),
    [slots, classNames2, underlayProps]
  );
  const getCloseButtonProps = () => {
    return {
      role: "button",
      tabIndex: 0,
      "aria-label": "Close",
      "data-focus-visible": dataAttr(isCloseButtonFocusVisible),
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      ...mergeProps$3(closeButtonProps, closeButtonFocusProps)
    };
  };
  return {
    Component: Component2,
    slots,
    domRef,
    headerId,
    bodyId,
    motionProps,
    classNames: classNames2,
    isDismissable,
    closeButton,
    hideCloseButton,
    portalContainer,
    shouldBlockScroll,
    backdrop: (_c2 = originalProps.backdrop) != null ? _c2 : "opaque",
    isOpen: state.isOpen,
    onClose: state.close,
    disableAnimation,
    setBodyMounted,
    setHeaderMounted,
    getDialogProps,
    getBackdropProps,
    getCloseButtonProps
  };
}
var Modal$1 = forwardRef((props, ref) => {
  const { children, ...otherProps } = props;
  const context = useModal({ ...otherProps, ref });
  const overlay = /* @__PURE__ */ jsxRuntimeExports.jsx($337b884510726a0d$export$c6fdb837b070b4ff, { portalContainer: context.portalContainer, children });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ModalProvider, { value: context, children: context.disableAnimation && context.isOpen ? overlay : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: context.isOpen ? overlay : null }) });
});
Modal$1.displayName = "HeroUI.Modal";
var modal_default = Modal$1;
const $2140fb2337097f2d$export$552312adfd451dab = /* @__PURE__ */ new WeakMap();
function $2140fb2337097f2d$var$normalizeKey(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $2140fb2337097f2d$export$37cd4213f2ad742e(state, columnKey) {
  let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
  if (!gridId)
    throw new Error("Unknown grid");
  return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
}
function $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey) {
  let gridId = $2140fb2337097f2d$export$552312adfd451dab.get(state);
  if (!gridId)
    throw new Error("Unknown grid");
  return `${gridId}-${$2140fb2337097f2d$var$normalizeKey(rowKey)}-${$2140fb2337097f2d$var$normalizeKey(columnKey)}`;
}
function $2140fb2337097f2d$export$85069b70317f543(state, rowKey) {
  return [
    ...state.collection.rowHeaderColumnKeys
  ].map((columnKey) => $2140fb2337097f2d$export$19baff3266315d44(state, rowKey, columnKey)).join(" ");
}
var $ce3de3ff2fd66848$exports = {};
$ce3de3ff2fd66848$exports = {
  "ascending": `تصاعدي`,
  "ascendingSort": (args) => `ترتيب حسب العمود ${args.columnName} بترتيب تصاعدي`,
  "columnSize": (args) => `${args.value} بالبكسل`,
  "descending": `تنازلي`,
  "descendingSort": (args) => `ترتيب حسب العمود ${args.columnName} بترتيب تنازلي`,
  "resizerDescription": `اضغط على مفتاح Enter لبدء تغيير الحجم`,
  "select": `تحديد`,
  "selectAll": `تحديد الكل`,
  "sortable": `عمود قابل للترتيب`
};
var $cb80dcce530985b9$exports = {};
$cb80dcce530985b9$exports = {
  "ascending": `възходящ`,
  "ascendingSort": (args) => `сортирано по колона ${args.columnName} във възходящ ред`,
  "columnSize": (args) => `${args.value} пиксела`,
  "descending": `низходящ`,
  "descendingSort": (args) => `сортирано по колона ${args.columnName} в низходящ ред`,
  "resizerDescription": `Натиснете „Enter“, за да започнете да преоразмерявате`,
  "select": `Изберете`,
  "selectAll": `Изберете всичко`,
  "sortable": `сортираща колона`
};
var $68ac86749db4c0fb$exports = {};
$68ac86749db4c0fb$exports = {
  "ascending": `vzestupně`,
  "ascendingSort": (args) => `řazeno vzestupně podle sloupce ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixelů`,
  "descending": `sestupně`,
  "descendingSort": (args) => `řazeno sestupně podle sloupce ${args.columnName}`,
  "resizerDescription": `Stisknutím klávesy Enter začnete měnit velikost`,
  "select": `Vybrat`,
  "selectAll": `Vybrat vše`,
  "sortable": `sloupec s možností řazení`
};
var $9a6cbac08487e661$exports = {};
$9a6cbac08487e661$exports = {
  "ascending": `stigende`,
  "ascendingSort": (args) => `sorteret efter kolonne ${args.columnName} i stigende rækkefølge`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `faldende`,
  "descendingSort": (args) => `sorteret efter kolonne ${args.columnName} i faldende rækkefølge`,
  "resizerDescription": `Tryk på Enter for at ændre størrelse`,
  "select": `Vælg`,
  "selectAll": `Vælg alle`,
  "sortable": `sorterbar kolonne`
};
var $c963661d89486e72$exports = {};
$c963661d89486e72$exports = {
  "ascending": `aufsteigend`,
  "ascendingSort": (args) => `sortiert nach Spalte ${args.columnName} in aufsteigender Reihenfolge`,
  "columnSize": (args) => `${args.value} Pixel`,
  "descending": `absteigend`,
  "descendingSort": (args) => `sortiert nach Spalte ${args.columnName} in absteigender Reihenfolge`,
  "resizerDescription": `Eingabetaste zum Starten der Größenänderung drücken`,
  "select": `Auswählen`,
  "selectAll": `Alles auswählen`,
  "sortable": `sortierbare Spalte`
};
var $ac03861c6e8605f4$exports = {};
$ac03861c6e8605f4$exports = {
  "ascending": `αύξουσα`,
  "ascendingSort": (args) => `διαλογή ανά στήλη ${args.columnName} σε αύξουσα σειρά`,
  "columnSize": (args) => `${args.value} pixel`,
  "descending": `φθίνουσα`,
  "descendingSort": (args) => `διαλογή ανά στήλη ${args.columnName} σε φθίνουσα σειρά`,
  "resizerDescription": `Πατήστε Enter για έναρξη της αλλαγής μεγέθους`,
  "select": `Επιλογή`,
  "selectAll": `Επιλογή όλων`,
  "sortable": `Στήλη διαλογής`
};
var $09e6b82e0d6e466a$exports = {};
$09e6b82e0d6e466a$exports = {
  "select": `Select`,
  "selectAll": `Select All`,
  "sortable": `sortable column`,
  "ascending": `ascending`,
  "descending": `descending`,
  "ascendingSort": (args) => `sorted by column ${args.columnName} in ascending order`,
  "descendingSort": (args) => `sorted by column ${args.columnName} in descending order`,
  "columnSize": (args) => `${args.value} pixels`,
  "resizerDescription": `Press Enter to start resizing`
};
var $8cc39eb66c2bf220$exports = {};
$8cc39eb66c2bf220$exports = {
  "ascending": `ascendente`,
  "ascendingSort": (args) => `ordenado por columna ${args.columnName} en sentido ascendente`,
  "columnSize": (args) => `${args.value} píxeles`,
  "descending": `descendente`,
  "descendingSort": (args) => `ordenado por columna ${args.columnName} en orden descendente`,
  "resizerDescription": `Pulse Intro para empezar a redimensionar`,
  "select": `Seleccionar`,
  "selectAll": `Seleccionar todos`,
  "sortable": `columna ordenable`
};
var $4e11db3c25a38112$exports = {};
$4e11db3c25a38112$exports = {
  "ascending": `tõusev järjestus`,
  "ascendingSort": (args) => `sorditud veeru järgi ${args.columnName} tõusvas järjestuses`,
  "columnSize": (args) => `${args.value} pikslit`,
  "descending": `laskuv järjestus`,
  "descendingSort": (args) => `sorditud veeru järgi ${args.columnName} laskuvas järjestuses`,
  "resizerDescription": `Suuruse muutmise alustamiseks vajutage klahvi Enter`,
  "select": `Vali`,
  "selectAll": `Vali kõik`,
  "sortable": `sorditav veerg`
};
var $da1e751a92575e02$exports = {};
$da1e751a92575e02$exports = {
  "ascending": `nouseva`,
  "ascendingSort": (args) => `lajiteltu sarakkeen ${args.columnName} mukaan nousevassa järjestyksessä`,
  "columnSize": (args) => `${args.value} pikseliä`,
  "descending": `laskeva`,
  "descendingSort": (args) => `lajiteltu sarakkeen ${args.columnName} mukaan laskevassa järjestyksessä`,
  "resizerDescription": `Aloita koon muutos painamalla Enter-näppäintä`,
  "select": `Valitse`,
  "selectAll": `Valitse kaikki`,
  "sortable": `lajiteltava sarake`
};
var $1b5d6c6c47d55106$exports = {};
$1b5d6c6c47d55106$exports = {
  "ascending": `croissant`,
  "ascendingSort": (args) => `trié en fonction de la colonne ${args.columnName} par ordre croissant`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `décroissant`,
  "descendingSort": (args) => `trié en fonction de la colonne ${args.columnName} par ordre décroissant`,
  "resizerDescription": `Appuyez sur Entrée pour commencer le redimensionnement.`,
  "select": `Sélectionner`,
  "selectAll": `Sélectionner tout`,
  "sortable": `colonne triable`
};
var $7c18ba27b86d3308$exports = {};
$7c18ba27b86d3308$exports = {
  "ascending": `עולה`,
  "ascendingSort": (args) => `מוין לפי עמודה ${args.columnName} בסדר עולה`,
  "columnSize": (args) => `${args.value} פיקסלים`,
  "descending": `יורד`,
  "descendingSort": (args) => `מוין לפי עמודה ${args.columnName} בסדר יורד`,
  "resizerDescription": `הקש Enter כדי לשנות את הגודל`,
  "select": `בחר`,
  "selectAll": `בחר הכול`,
  "sortable": `עמודה שניתן למיין`
};
var $2cb40998e20e8a46$exports = {};
$2cb40998e20e8a46$exports = {
  "ascending": `rastući`,
  "ascendingSort": (args) => `razvrstano po stupcima ${args.columnName} rastućem redoslijedom`,
  "columnSize": (args) => `${args.value} piksela`,
  "descending": `padajući`,
  "descendingSort": (args) => `razvrstano po stupcima ${args.columnName} padajućim redoslijedom`,
  "resizerDescription": `Pritisnite Enter da biste započeli promenu veličine`,
  "select": `Odaberite`,
  "selectAll": `Odaberite sve`,
  "sortable": `stupac koji se može razvrstati`
};
var $189e23eec1d6aa3a$exports = {};
$189e23eec1d6aa3a$exports = {
  "ascending": `növekvő`,
  "ascendingSort": (args) => `rendezve a(z) ${args.columnName} oszlop szerint, növekvő sorrendben`,
  "columnSize": (args) => `${args.value} képpont`,
  "descending": `csökkenő`,
  "descendingSort": (args) => `rendezve a(z) ${args.columnName} oszlop szerint, csökkenő sorrendben`,
  "resizerDescription": `Nyomja le az Enter billentyűt az átméretezés megkezdéséhez`,
  "select": `Kijelölés`,
  "selectAll": `Összes kijelölése`,
  "sortable": `rendezendő oszlop`
};
var $3c5ec8e4f015dfd0$exports = {};
$3c5ec8e4f015dfd0$exports = {
  "ascending": `crescente`,
  "ascendingSort": (args) => `in ordine crescente in base alla colonna ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixel`,
  "descending": `decrescente`,
  "descendingSort": (args) => `in ordine decrescente in base alla colonna ${args.columnName}`,
  "resizerDescription": `Premi Invio per iniziare a ridimensionare`,
  "select": `Seleziona`,
  "selectAll": `Seleziona tutto`,
  "sortable": `colonna ordinabile`
};
var $d021d50e6b315ebb$exports = {};
$d021d50e6b315ebb$exports = {
  "ascending": `昇順`,
  "ascendingSort": (args) => `列 ${args.columnName} を昇順で並べ替え`,
  "columnSize": (args) => `${args.value} ピクセル`,
  "descending": `降順`,
  "descendingSort": (args) => `列 ${args.columnName} を降順で並べ替え`,
  "resizerDescription": `Enter キーを押してサイズ変更を開始`,
  "select": `選択`,
  "selectAll": `すべて選択`,
  "sortable": `並べ替え可能な列`
};
var $52535c35c24ec937$exports = {};
$52535c35c24ec937$exports = {
  "ascending": `오름차순`,
  "ascendingSort": (args) => `${args.columnName} 열을 기준으로 오름차순으로 정렬됨`,
  "columnSize": (args) => `${args.value} 픽셀`,
  "descending": `내림차순`,
  "descendingSort": (args) => `${args.columnName} 열을 기준으로 내림차순으로 정렬됨`,
  "resizerDescription": `크기 조정을 시작하려면 Enter를 누르세요.`,
  "select": `선택`,
  "selectAll": `모두 선택`,
  "sortable": `정렬 가능한 열`
};
var $b37ee03672edfd1d$exports = {};
$b37ee03672edfd1d$exports = {
  "ascending": `didėjančia tvarka`,
  "ascendingSort": (args) => `surikiuota pagal stulpelį ${args.columnName} didėjančia tvarka`,
  "columnSize": (args) => `${args.value} piks.`,
  "descending": `mažėjančia tvarka`,
  "descendingSort": (args) => `surikiuota pagal stulpelį ${args.columnName} mažėjančia tvarka`,
  "resizerDescription": `Paspauskite „Enter“, kad pradėtumėte keisti dydį`,
  "select": `Pasirinkti`,
  "selectAll": `Pasirinkti viską`,
  "sortable": `rikiuojamas stulpelis`
};
var $c7df6686b4189d56$exports = {};
$c7df6686b4189d56$exports = {
  "ascending": `augošā secībā`,
  "ascendingSort": (args) => `kārtots pēc kolonnas ${args.columnName} augošā secībā`,
  "columnSize": (args) => `${args.value} pikseļi`,
  "descending": `dilstošā secībā`,
  "descendingSort": (args) => `kārtots pēc kolonnas ${args.columnName} dilstošā secībā`,
  "resizerDescription": `Nospiediet Enter, lai sāktu izmēru mainīšanu`,
  "select": `Atlasīt`,
  "selectAll": `Atlasīt visu`,
  "sortable": `kārtojamā kolonna`
};
var $da07fe8ec87e6b68$exports = {};
$da07fe8ec87e6b68$exports = {
  "ascending": `stigende`,
  "ascendingSort": (args) => `sortert etter kolonne ${args.columnName} i stigende rekkefølge`,
  "columnSize": (args) => `${args.value} piksler`,
  "descending": `synkende`,
  "descendingSort": (args) => `sortert etter kolonne ${args.columnName} i synkende rekkefølge`,
  "resizerDescription": `Trykk på Enter for å starte størrelsesendring`,
  "select": `Velg`,
  "selectAll": `Velg alle`,
  "sortable": `kolonne som kan sorteres`
};
var $64b7e390f5791490$exports = {};
$64b7e390f5791490$exports = {
  "ascending": `oplopend`,
  "ascendingSort": (args) => `gesorteerd in oplopende volgorde in kolom ${args.columnName}`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `aflopend`,
  "descendingSort": (args) => `gesorteerd in aflopende volgorde in kolom ${args.columnName}`,
  "resizerDescription": `Druk op Enter om het formaat te wijzigen`,
  "select": `Selecteren`,
  "selectAll": `Alles selecteren`,
  "sortable": `sorteerbare kolom`
};
var $2a03621e773f1678$exports = {};
$2a03621e773f1678$exports = {
  "ascending": `rosnąco`,
  "ascendingSort": (args) => `posortowano według kolumny ${args.columnName} w porządku rosnącym`,
  "columnSize": (args) => `Liczba pikseli: ${args.value}`,
  "descending": `malejąco`,
  "descendingSort": (args) => `posortowano według kolumny ${args.columnName} w porządku malejącym`,
  "resizerDescription": `Naciśnij Enter, aby rozpocząć zmienianie rozmiaru`,
  "select": `Zaznacz`,
  "selectAll": `Zaznacz wszystko`,
  "sortable": `kolumna z możliwością sortowania`
};
var $0a79c0aba9e5ecc6$exports = {};
$0a79c0aba9e5ecc6$exports = {
  "ascending": `crescente`,
  "ascendingSort": (args) => `classificado pela coluna ${args.columnName} em ordem crescente`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `decrescente`,
  "descendingSort": (args) => `classificado pela coluna ${args.columnName} em ordem decrescente`,
  "resizerDescription": `Pressione Enter para começar a redimensionar`,
  "select": `Selecionar`,
  "selectAll": `Selecionar tudo`,
  "sortable": `coluna classificável`
};
var $de7b4d0f7dc86fc8$exports = {};
$de7b4d0f7dc86fc8$exports = {
  "ascending": `ascendente`,
  "ascendingSort": (args) => `Ordenar por coluna ${args.columnName} em ordem ascendente`,
  "columnSize": (args) => `${args.value} pixels`,
  "descending": `descendente`,
  "descendingSort": (args) => `Ordenar por coluna ${args.columnName} em ordem descendente`,
  "resizerDescription": `Prima Enter para iniciar o redimensionamento`,
  "select": `Selecionar`,
  "selectAll": `Selecionar tudo`,
  "sortable": `Coluna ordenável`
};
var $28ea7e849d77bd1c$exports = {};
$28ea7e849d77bd1c$exports = {
  "ascending": `crescătoare`,
  "ascendingSort": (args) => `sortate după coloana ${args.columnName} în ordine crescătoare`,
  "columnSize": (args) => `${args.value} pixeli`,
  "descending": `descrescătoare`,
  "descendingSort": (args) => `sortate după coloana ${args.columnName} în ordine descrescătoare`,
  "resizerDescription": `Apăsați pe Enter pentru a începe redimensionarea`,
  "select": `Selectare`,
  "selectAll": `Selectare totală`,
  "sortable": `coloană sortabilă`
};
var $9a09321cf046b187$exports = {};
$9a09321cf046b187$exports = {
  "ascending": `возрастание`,
  "ascendingSort": (args) => `сортировать столбец ${args.columnName} в порядке возрастания`,
  "columnSize": (args) => `${args.value} пикс.`,
  "descending": `убывание`,
  "descendingSort": (args) => `сортировать столбец ${args.columnName} в порядке убывания`,
  "resizerDescription": `Нажмите клавишу Enter для начала изменения размеров`,
  "select": `Выбрать`,
  "selectAll": `Выбрать все`,
  "sortable": `сортируемый столбец`
};
var $5afe469a63fcac7b$exports = {};
$5afe469a63fcac7b$exports = {
  "ascending": `vzostupne`,
  "ascendingSort": (args) => `zoradené zostupne podľa stĺpca ${args.columnName}`,
  "columnSize": (args) => `Počet pixelov: ${args.value}`,
  "descending": `zostupne`,
  "descendingSort": (args) => `zoradené zostupne podľa stĺpca ${args.columnName}`,
  "resizerDescription": `Stlačením klávesu Enter začnete zmenu veľkosti`,
  "select": `Vybrať`,
  "selectAll": `Vybrať všetko`,
  "sortable": `zoraditeľný stĺpec`
};
var $2956757ac31a7ce2$exports = {};
$2956757ac31a7ce2$exports = {
  "ascending": `naraščajoče`,
  "ascendingSort": (args) => `razvrščeno po stolpcu ${args.columnName} v naraščajočem vrstnem redu`,
  "columnSize": (args) => `${args.value} slikovnih pik`,
  "descending": `padajoče`,
  "descendingSort": (args) => `razvrščeno po stolpcu ${args.columnName} v padajočem vrstnem redu`,
  "resizerDescription": `Pritisnite tipko Enter da začnete spreminjati velikost`,
  "select": `Izberite`,
  "selectAll": `Izberite vse`,
  "sortable": `razvrstljivi stolpec`
};
var $cedee0e66b175529$exports = {};
$cedee0e66b175529$exports = {
  "ascending": `rastući`,
  "ascendingSort": (args) => `sortirano po kolonama ${args.columnName} rastućim redosledom`,
  "columnSize": (args) => `${args.value} piksela`,
  "descending": `padajući`,
  "descendingSort": (args) => `sortirano po kolonama ${args.columnName} padajućim redosledom`,
  "resizerDescription": `Pritisnite Enter da biste započeli promenu veličine`,
  "select": `Izaberite`,
  "selectAll": `Izaberite sve`,
  "sortable": `kolona koja se može sortirati`
};
var $6db19998ba4427da$exports = {};
$6db19998ba4427da$exports = {
  "ascending": `stigande`,
  "ascendingSort": (args) => `sorterat på kolumn ${args.columnName} i stigande ordning`,
  "columnSize": (args) => `${args.value} pixlar`,
  "descending": `fallande`,
  "descendingSort": (args) => `sorterat på kolumn ${args.columnName} i fallande ordning`,
  "resizerDescription": `Tryck på Retur för att börja ändra storlek`,
  "select": `Markera`,
  "selectAll": `Markera allt`,
  "sortable": `sorterbar kolumn`
};
var $166b7c9cc1adb1a1$exports = {};
$166b7c9cc1adb1a1$exports = {
  "ascending": `artan sırada`,
  "ascendingSort": (args) => `${args.columnName} sütuna göre artan düzende sırala`,
  "columnSize": (args) => `${args.value} piksel`,
  "descending": `azalan sırada`,
  "descendingSort": (args) => `${args.columnName} sütuna göre azalan düzende sırala`,
  "resizerDescription": `Yeniden boyutlandırmak için Enter'a basın`,
  "select": `Seç`,
  "selectAll": `Tümünü Seç`,
  "sortable": `Sıralanabilir sütun`
};
var $c7ab180b401e49ff$exports = {};
$c7ab180b401e49ff$exports = {
  "ascending": `висхідний`,
  "ascendingSort": (args) => `відсортовано за стовпцем ${args.columnName} у висхідному порядку`,
  "columnSize": (args) => `${args.value} пікс.`,
  "descending": `низхідний`,
  "descendingSort": (args) => `відсортовано за стовпцем ${args.columnName} у низхідному порядку`,
  "resizerDescription": `Натисніть Enter, щоб почати зміну розміру`,
  "select": `Вибрати`,
  "selectAll": `Вибрати все`,
  "sortable": `сортувальний стовпець`
};
var $1648ec00941567f3$exports = {};
$1648ec00941567f3$exports = {
  "ascending": `升序`,
  "ascendingSort": (args) => `按列 ${args.columnName} 升序排序`,
  "columnSize": (args) => `${args.value} 像素`,
  "descending": `降序`,
  "descendingSort": (args) => `按列 ${args.columnName} 降序排序`,
  "resizerDescription": `按“输入”键开始调整大小。`,
  "select": `选择`,
  "selectAll": `全选`,
  "sortable": `可排序的列`
};
var $b26f22384b3c1526$exports = {};
$b26f22384b3c1526$exports = {
  "ascending": `遞增`,
  "ascendingSort": (args) => `已依據「${args.columnName}」欄遞增排序`,
  "columnSize": (args) => `${args.value} 像素`,
  "descending": `遞減`,
  "descendingSort": (args) => `已依據「${args.columnName}」欄遞減排序`,
  "resizerDescription": `按 Enter 鍵以開始調整大小`,
  "select": `選取`,
  "selectAll": `全選`,
  "sortable": `可排序的欄`
};
var $7476b46781682bf5$exports = {};
$7476b46781682bf5$exports = {
  "ar-AE": $ce3de3ff2fd66848$exports,
  "bg-BG": $cb80dcce530985b9$exports,
  "cs-CZ": $68ac86749db4c0fb$exports,
  "da-DK": $9a6cbac08487e661$exports,
  "de-DE": $c963661d89486e72$exports,
  "el-GR": $ac03861c6e8605f4$exports,
  "en-US": $09e6b82e0d6e466a$exports,
  "es-ES": $8cc39eb66c2bf220$exports,
  "et-EE": $4e11db3c25a38112$exports,
  "fi-FI": $da1e751a92575e02$exports,
  "fr-FR": $1b5d6c6c47d55106$exports,
  "he-IL": $7c18ba27b86d3308$exports,
  "hr-HR": $2cb40998e20e8a46$exports,
  "hu-HU": $189e23eec1d6aa3a$exports,
  "it-IT": $3c5ec8e4f015dfd0$exports,
  "ja-JP": $d021d50e6b315ebb$exports,
  "ko-KR": $52535c35c24ec937$exports,
  "lt-LT": $b37ee03672edfd1d$exports,
  "lv-LV": $c7df6686b4189d56$exports,
  "nb-NO": $da07fe8ec87e6b68$exports,
  "nl-NL": $64b7e390f5791490$exports,
  "pl-PL": $2a03621e773f1678$exports,
  "pt-BR": $0a79c0aba9e5ecc6$exports,
  "pt-PT": $de7b4d0f7dc86fc8$exports,
  "ro-RO": $28ea7e849d77bd1c$exports,
  "ru-RU": $9a09321cf046b187$exports,
  "sk-SK": $5afe469a63fcac7b$exports,
  "sl-SI": $2956757ac31a7ce2$exports,
  "sr-SP": $cedee0e66b175529$exports,
  "sv-SE": $6db19998ba4427da$exports,
  "tr-TR": $166b7c9cc1adb1a1$exports,
  "uk-UA": $c7ab180b401e49ff$exports,
  "zh-CN": $1648ec00941567f3$exports,
  "zh-TW": $b26f22384b3c1526$exports
};
class $d1c300d9c497e402$export$de9feff04fda126e {
  isCell(node2) {
    return node2.type === "cell";
  }
  isRow(node2) {
    return node2.type === "row" || node2.type === "item";
  }
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findPreviousKey(fromKey, pred) {
    let key = fromKey != null ? this.collection.getKeyBefore(fromKey) : this.collection.getLastKey();
    while (key != null) {
      let item = this.collection.getItem(key);
      if (!item)
        return null;
      if (!this.isDisabled(item) && (!pred || pred(item)))
        return key;
      key = this.collection.getKeyBefore(key);
    }
    return null;
  }
  findNextKey(fromKey, pred) {
    let key = fromKey != null ? this.collection.getKeyAfter(fromKey) : this.collection.getFirstKey();
    while (key != null) {
      let item = this.collection.getItem(key);
      if (!item)
        return null;
      if (!this.isDisabled(item) && (!pred || pred(item)))
        return key;
      key = this.collection.getKeyAfter(key);
      if (key == null)
        return null;
    }
    return null;
  }
  getKeyForItemInRowByIndex(key, index2 = 0) {
    if (index2 < 0)
      return null;
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    let i2 = 0;
    for (let child of $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)) {
      var _child_key;
      if (child.colSpan && child.colSpan + i2 > index2)
        return (_child_key = child.key) !== null && _child_key !== void 0 ? _child_key : null;
      if (child.colSpan)
        i2 = i2 + child.colSpan - 1;
      var _child_key1;
      if (i2 === index2)
        return (_child_key1 = child.key) !== null && _child_key1 !== void 0 ? _child_key1 : null;
      i2++;
    }
    return null;
  }
  getKeyBelow(fromKey) {
    let key = fromKey;
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (this.isCell(startItem))
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    if (key == null)
      return null;
    key = this.findNextKey(key, (item) => item.type === "item");
    if (key != null) {
      if (this.isCell(startItem)) {
        let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;
        return this.getKeyForItemInRowByIndex(key, startIndex);
      }
      if (this.focusMode === "row")
        return key;
    }
    return null;
  }
  getKeyAbove(fromKey) {
    let key = fromKey;
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (this.isCell(startItem))
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    if (key == null)
      return null;
    key = this.findPreviousKey(key, (item) => item.type === "item");
    if (key != null) {
      if (this.isCell(startItem)) {
        let startIndex = startItem.colIndex ? startItem.colIndex : startItem.index;
        return this.getKeyForItemInRowByIndex(key, startIndex);
      }
      if (this.focusMode === "row")
        return key;
    }
    return null;
  }
  getKeyRightOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (this.isRow(item)) {
      var _getLastItem, _getFirstItem;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection);
      var _ref;
      return (_ref = this.direction === "rtl" ? (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key : (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _ref !== void 0 ? _ref : null;
    }
    if (this.isCell(item) && item.parentKey != null) {
      let parent = this.collection.getItem(item.parentKey);
      if (!parent)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
      var _ref1;
      let next2 = (_ref1 = this.direction === "rtl" ? $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index - 1) : $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index + 1)) !== null && _ref1 !== void 0 ? _ref1 : null;
      var _next_key;
      if (next2)
        return (_next_key = next2.key) !== null && _next_key !== void 0 ? _next_key : null;
      var _item_parentKey;
      if (this.focusMode === "row")
        return (_item_parentKey = item.parentKey) !== null && _item_parentKey !== void 0 ? _item_parentKey : null;
      var _ref2;
      return (_ref2 = this.direction === "rtl" ? this.getFirstKey(key) : this.getLastKey(key)) !== null && _ref2 !== void 0 ? _ref2 : null;
    }
    return null;
  }
  getKeyLeftOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (this.isRow(item)) {
      var _getFirstItem, _getLastItem;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection);
      var _ref;
      return (_ref = this.direction === "rtl" ? (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key : (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _ref !== void 0 ? _ref : null;
    }
    if (this.isCell(item) && item.parentKey != null) {
      let parent = this.collection.getItem(item.parentKey);
      if (!parent)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
      var _ref1;
      let prev2 = (_ref1 = this.direction === "rtl" ? $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index + 1) : $c5a24bc478652b5f$export$5f3398f8733f90e2(children, item.index - 1)) !== null && _ref1 !== void 0 ? _ref1 : null;
      var _prev_key;
      if (prev2)
        return (_prev_key = prev2.key) !== null && _prev_key !== void 0 ? _prev_key : null;
      var _item_parentKey;
      if (this.focusMode === "row")
        return (_item_parentKey = item.parentKey) !== null && _item_parentKey !== void 0 ? _item_parentKey : null;
      var _ref2;
      return (_ref2 = this.direction === "rtl" ? this.getLastKey(key) : this.getFirstKey(key)) !== null && _ref2 !== void 0 ? _ref2 : null;
    }
    return null;
  }
  getFirstKey(fromKey, global2) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    let item;
    if (key != null) {
      item = this.collection.getItem(key);
      if (!item)
        return null;
      if (this.isCell(item) && !global2 && item.parentKey != null) {
        var _getFirstItem;
        let parent = this.collection.getItem(item.parentKey);
        if (!parent)
          return null;
        var _getFirstItem_key;
        return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
      }
    }
    key = this.findNextKey(void 0, (item2) => item2.type === "item");
    if (key != null && (item && this.isCell(item) && global2 || this.focusMode === "cell")) {
      var _getFirstItem1;
      let item2 = this.collection.getItem(key);
      if (!item2)
        return null;
      var _getFirstItem_key1;
      key = (_getFirstItem_key1 = (_getFirstItem1 = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item2, this.collection))) === null || _getFirstItem1 === void 0 ? void 0 : _getFirstItem1.key) !== null && _getFirstItem_key1 !== void 0 ? _getFirstItem_key1 : null;
    }
    return key;
  }
  getLastKey(fromKey, global2) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    let item;
    if (key != null) {
      item = this.collection.getItem(key);
      if (!item)
        return null;
      if (this.isCell(item) && !global2 && item.parentKey != null) {
        var _getLastItem;
        let parent = this.collection.getItem(item.parentKey);
        if (!parent)
          return null;
        let children = $c5a24bc478652b5f$export$1005530eda016c13(parent, this.collection);
        var _getLastItem_key;
        return (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
      }
    }
    key = this.findPreviousKey(void 0, (item2) => item2.type === "item");
    if (key != null && (item && this.isCell(item) && global2 || this.focusMode === "cell")) {
      var _getLastItem1;
      let item2 = this.collection.getItem(key);
      if (!item2)
        return null;
      let children = $c5a24bc478652b5f$export$1005530eda016c13(item2, this.collection);
      var _getLastItem_key1;
      key = (_getLastItem_key1 = (_getLastItem1 = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.key) !== null && _getLastItem_key1 !== void 0 ? _getLastItem_key1 : null;
    }
    return key;
  }
  getKeyPageAbove(fromKey) {
    let key = fromKey;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
    while (itemRect && itemRect.y > pageY && key != null) {
      var _this_getKeyAbove;
      key = (_this_getKeyAbove = this.getKeyAbove(key)) !== null && _this_getKeyAbove !== void 0 ? _this_getKeyAbove : null;
      if (key == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(key);
    }
    return key;
  }
  getKeyPageBelow(fromKey) {
    let key = fromKey;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    let pageHeight = this.layoutDelegate.getVisibleRect().height;
    let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y + pageHeight);
    while (itemRect && itemRect.y + itemRect.height < pageY) {
      let nextKey = this.getKeyBelow(key);
      if (nextKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(nextKey);
      key = nextKey;
    }
    return key;
  }
  getKeyForSearch(search2, fromKey) {
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : null;
    if (!this.collator)
      return null;
    let collection = this.collection;
    key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
    if (key == null)
      return null;
    let startItem = collection.getItem(key);
    if (!startItem)
      return null;
    var _startItem_parentKey;
    if (startItem.type === "cell")
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    let hasWrapped = false;
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      if (item.textValue) {
        let substring = item.textValue.slice(0, search2.length);
        if (this.collator.compare(substring, search2) === 0) {
          var _getFirstItem;
          var _getFirstItem_key;
          if (this.isRow(item) && this.focusMode === "cell")
            return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(item, this.collection))) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
          return item.key;
        }
      }
      key = this.findNextKey(key, (item2) => item2.type === "item");
      if (key == null && !hasWrapped) {
        key = this.getFirstKey();
        hasWrapped = true;
      }
    }
    return null;
  }
  constructor(options) {
    this.collection = options.collection;
    this.disabledKeys = options.disabledKeys;
    this.disabledBehavior = options.disabledBehavior || "all";
    this.direction = options.direction;
    this.collator = options.collator;
    if (!options.layout && !options.ref)
      throw new Error("Either a layout or a ref must be specified.");
    this.layoutDelegate = options.layoutDelegate || (options.layout ? new $d1c300d9c497e402$var$DeprecatedLayoutDelegate(options.layout) : new $657e4dc4a6e88df0$export$8f5ed9ff9f511381$1(options.ref));
    var _options_focusMode;
    this.focusMode = (_options_focusMode = options.focusMode) !== null && _options_focusMode !== void 0 ? _options_focusMode : "row";
  }
}
class $d1c300d9c497e402$var$DeprecatedLayoutDelegate {
  getContentSize() {
    return this.layout.getContentSize();
  }
  getItemRect(key) {
    var _this_layout_getLayoutInfo;
    return ((_this_layout_getLayoutInfo = this.layout.getLayoutInfo(key)) === null || _this_layout_getLayoutInfo === void 0 ? void 0 : _this_layout_getLayoutInfo.rect) || null;
  }
  getVisibleRect() {
    return this.layout.virtualizer.visibleRect;
  }
  constructor(layout2) {
    this.layout = layout2;
  }
}
const $1af922eb41e03c8f$export$e6235c0d09b995d0 = /* @__PURE__ */ new WeakMap();
var $682989befd4f478d$exports = {};
$682989befd4f478d$exports = {
  "deselectedItem": (args) => `${args.item} غير المحدد`,
  "longPressToSelect": `اضغط مطولًا للدخول إلى وضع التحديد.`,
  "select": `تحديد`,
  "selectedAll": `جميع العناصر المحددة.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `لم يتم تحديد عناصر`,
    one: () => `${formatter.number(args.count)} عنصر محدد`,
    other: () => `${formatter.number(args.count)} عنصر محدد`
  })}.`,
  "selectedItem": (args) => `${args.item} المحدد`
};
var $f7fca02019afd941$exports = {};
$f7fca02019afd941$exports = {
  "deselectedItem": (args) => `${args.item} не е избран.`,
  "longPressToSelect": `Натиснете и задръжте за да влезете в избирателен режим.`,
  "select": `Изберете`,
  "selectedAll": `Всички елементи са избрани.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Няма избрани елементи`,
    one: () => `${formatter.number(args.count)} избран елемент`,
    other: () => `${formatter.number(args.count)} избрани елементи`
  })}.`,
  "selectedItem": (args) => `${args.item} избран.`
};
var $8f86f40be75387f1$exports = {};
$8f86f40be75387f1$exports = {
  "deselectedItem": (args) => `Položka ${args.item} není vybrána.`,
  "longPressToSelect": `Dlouhým stisknutím přejdete do režimu výběru.`,
  "select": `Vybrat`,
  "selectedAll": `Vybrány všechny položky.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nevybrány žádné položky`,
    one: () => `Vybrána ${formatter.number(args.count)} položka`,
    other: () => `Vybráno ${formatter.number(args.count)} položek`
  })}.`,
  "selectedItem": (args) => `Vybrána položka ${args.item}.`
};
var $db24ba43c8d652ee$exports = {};
$db24ba43c8d652ee$exports = {
  "deselectedItem": (args) => `${args.item} ikke valgt.`,
  "longPressToSelect": `Lav et langt tryk for at aktivere valgtilstand.`,
  "select": `Vælg`,
  "selectedAll": `Alle elementer valgt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ingen elementer valgt`,
    one: () => `${formatter.number(args.count)} element valgt`,
    other: () => `${formatter.number(args.count)} elementer valgt`
  })}.`,
  "selectedItem": (args) => `${args.item} valgt.`
};
var $f8f1e72c8b5447d6$exports = {};
$f8f1e72c8b5447d6$exports = {
  "deselectedItem": (args) => `${args.item} nicht ausgewählt.`,
  "longPressToSelect": `Gedrückt halten, um Auswahlmodus zu öffnen.`,
  "select": `Auswählen`,
  "selectedAll": `Alle Elemente ausgewählt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Keine Elemente ausgewählt`,
    one: () => `${formatter.number(args.count)} Element ausgewählt`,
    other: () => `${formatter.number(args.count)} Elemente ausgewählt`
  })}.`,
  "selectedItem": (args) => `${args.item} ausgewählt.`
};
var $9a73ed2983c3ab0b$exports = {};
$9a73ed2983c3ab0b$exports = {
  "deselectedItem": (args) => `Δεν επιλέχθηκε το στοιχείο ${args.item}.`,
  "longPressToSelect": `Πατήστε παρατεταμένα για να μπείτε σε λειτουργία επιλογής.`,
  "select": `Επιλογή`,
  "selectedAll": `Επιλέχθηκαν όλα τα στοιχεία.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Δεν επιλέχθηκαν στοιχεία`,
    one: () => `Επιλέχθηκε ${formatter.number(args.count)} στοιχείο`,
    other: () => `Επιλέχθηκαν ${formatter.number(args.count)} στοιχεία`
  })}.`,
  "selectedItem": (args) => `Επιλέχθηκε το στοιχείο ${args.item}.`
};
var $583de0b3587601b9$exports = {};
$583de0b3587601b9$exports = {
  "deselectedItem": (args) => `${args.item} not selected.`,
  "select": `Select`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `No items selected`,
    one: () => `${formatter.number(args.count)} item selected`,
    other: () => `${formatter.number(args.count)} items selected`
  })}.`,
  "selectedAll": `All items selected.`,
  "selectedItem": (args) => `${args.item} selected.`,
  "longPressToSelect": `Long press to enter selection mode.`
};
var $147159c978043442$exports = {};
$147159c978043442$exports = {
  "deselectedItem": (args) => `${args.item} no seleccionado.`,
  "longPressToSelect": `Mantenga pulsado para abrir el modo de selección.`,
  "select": `Seleccionar`,
  "selectedAll": `Todos los elementos seleccionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ningún elemento seleccionado`,
    one: () => `${formatter.number(args.count)} elemento seleccionado`,
    other: () => `${formatter.number(args.count)} elementos seleccionados`
  })}.`,
  "selectedItem": (args) => `${args.item} seleccionado.`
};
var $5cbb62c8a19173ac$exports = {};
$5cbb62c8a19173ac$exports = {
  "deselectedItem": (args) => `${args.item} pole valitud.`,
  "longPressToSelect": `Valikurežiimi sisenemiseks vajutage pikalt.`,
  "select": `Vali`,
  "selectedAll": `Kõik üksused valitud.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Üksusi pole valitud`,
    one: () => `${formatter.number(args.count)} üksus valitud`,
    other: () => `${formatter.number(args.count)} üksust valitud`
  })}.`,
  "selectedItem": (args) => `${args.item} valitud.`
};
var $a33d71dc804cc59e$exports = {};
$a33d71dc804cc59e$exports = {
  "deselectedItem": (args) => `Kohdetta ${args.item} ei valittu.`,
  "longPressToSelect": `Siirry valintatilaan painamalla pitkään.`,
  "select": `Valitse`,
  "selectedAll": `Kaikki kohteet valittu.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ei yhtään kohdetta valittu`,
    one: () => `${formatter.number(args.count)} kohde valittu`,
    other: () => `${formatter.number(args.count)} kohdetta valittu`
  })}.`,
  "selectedItem": (args) => `${args.item} valittu.`
};
var $92d800447793d084$exports = {};
$92d800447793d084$exports = {
  "deselectedItem": (args) => `${args.item} non sélectionné.`,
  "longPressToSelect": `Appuyez de manière prolongée pour passer en mode de sélection.`,
  "select": `Sélectionner`,
  "selectedAll": `Tous les éléments sélectionnés.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Aucun élément sélectionné`,
    one: () => `${formatter.number(args.count)} élément sélectionné`,
    other: () => `${formatter.number(args.count)} éléments sélectionnés`
  })}.`,
  "selectedItem": (args) => `${args.item} sélectionné.`
};
var $fe732cdb32124ea8$exports = {};
$fe732cdb32124ea8$exports = {
  "deselectedItem": (args) => `${args.item} לא נבחר.`,
  "longPressToSelect": `הקשה ארוכה לכניסה למצב בחירה.`,
  "select": `בחר`,
  "selectedAll": `כל הפריטים נבחרו.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `לא נבחרו פריטים`,
    one: () => `פריט ${formatter.number(args.count)} נבחר`,
    other: () => `${formatter.number(args.count)} פריטים נבחרו`
  })}.`,
  "selectedItem": (args) => `${args.item} נבחר.`
};
var $e41234e934efb4f5$exports = {};
$e41234e934efb4f5$exports = {
  "deselectedItem": (args) => `Stavka ${args.item} nije odabrana.`,
  "longPressToSelect": `Dugo pritisnite za ulazak u način odabira.`,
  "select": `Odaberite`,
  "selectedAll": `Odabrane su sve stavke.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nije odabrana nijedna stavka`,
    one: () => `Odabrana je ${formatter.number(args.count)} stavka`,
    other: () => `Odabrano je ${formatter.number(args.count)} stavki`
  })}.`,
  "selectedItem": (args) => `Stavka ${args.item} je odabrana.`
};
var $1b0393182473bf9e$exports = {};
$1b0393182473bf9e$exports = {
  "deselectedItem": (args) => `${args.item} nincs kijelölve.`,
  "longPressToSelect": `Nyomja hosszan a kijelöléshez.`,
  "select": `Kijelölés`,
  "selectedAll": `Az összes elem kijelölve.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Egy elem sincs kijelölve`,
    one: () => `${formatter.number(args.count)} elem kijelölve`,
    other: () => `${formatter.number(args.count)} elem kijelölve`
  })}.`,
  "selectedItem": (args) => `${args.item} kijelölve.`
};
var $2eed782c1c110ce7$exports = {};
$2eed782c1c110ce7$exports = {
  "deselectedItem": (args) => `${args.item} non selezionato.`,
  "longPressToSelect": `Premi a lungo per passare alla modalità di selezione.`,
  "select": `Seleziona`,
  "selectedAll": `Tutti gli elementi selezionati.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nessun elemento selezionato`,
    one: () => `${formatter.number(args.count)} elemento selezionato`,
    other: () => `${formatter.number(args.count)} elementi selezionati`
  })}.`,
  "selectedItem": (args) => `${args.item} selezionato.`
};
var $8b5d459f86e9b23c$exports = {};
$8b5d459f86e9b23c$exports = {
  "deselectedItem": (args) => `${args.item} が選択されていません。`,
  "longPressToSelect": `長押しして選択モードを開きます。`,
  "select": `選択`,
  "selectedAll": `すべての項目を選択しました。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `項目が選択されていません`,
    one: () => `${formatter.number(args.count)} 項目を選択しました`,
    other: () => `${formatter.number(args.count)} 項目を選択しました`
  })}。`,
  "selectedItem": (args) => `${args.item} を選択しました。`
};
var $1949c3ad17295fd4$exports = {};
$1949c3ad17295fd4$exports = {
  "deselectedItem": (args) => `${args.item}이(가) 선택되지 않았습니다.`,
  "longPressToSelect": `선택 모드로 들어가려면 길게 누르십시오.`,
  "select": `선택`,
  "selectedAll": `모든 항목이 선택되었습니다.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `선택된 항목이 없습니다`,
    one: () => `${formatter.number(args.count)}개 항목이 선택되었습니다`,
    other: () => `${formatter.number(args.count)}개 항목이 선택되었습니다`
  })}.`,
  "selectedItem": (args) => `${args.item}이(가) 선택되었습니다.`
};
var $f5e3df4dc8aa7b54$exports = {};
$f5e3df4dc8aa7b54$exports = {
  "deselectedItem": (args) => `${args.item} nepasirinkta.`,
  "longPressToSelect": `Norėdami įjungti pasirinkimo režimą, paspauskite ir palaikykite.`,
  "select": `Pasirinkti`,
  "selectedAll": `Pasirinkti visi elementai.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nepasirinktas nė vienas elementas`,
    one: () => `Pasirinktas ${formatter.number(args.count)} elementas`,
    other: () => `Pasirinkta elementų: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Pasirinkta: ${args.item}.`
};
var $9dd86690a5c2b2c5$exports = {};
$9dd86690a5c2b2c5$exports = {
  "deselectedItem": (args) => `Vienums ${args.item} nav atlasīts.`,
  "longPressToSelect": `Ilgi turiet nospiestu. lai ieslēgtu atlases režīmu.`,
  "select": `Atlasīt`,
  "selectedAll": `Atlasīti visi vienumi.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nav atlasīts neviens vienums`,
    one: () => `Atlasīto vienumu skaits: ${formatter.number(args.count)}`,
    other: () => `Atlasīto vienumu skaits: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Atlasīts vienums ${args.item}.`
};
var $843964c3bf9a7d24$exports = {};
$843964c3bf9a7d24$exports = {
  "deselectedItem": (args) => `${args.item} er ikke valgt.`,
  "longPressToSelect": `Bruk et langt trykk for å gå inn i valgmodus.`,
  "select": `Velg`,
  "selectedAll": `Alle elementer er valgt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Ingen elementer er valgt`,
    one: () => `${formatter.number(args.count)} element er valgt`,
    other: () => `${formatter.number(args.count)} elementer er valgt`
  })}.`,
  "selectedItem": (args) => `${args.item} er valgt.`
};
var $73f50e845f9ef3b4$exports = {};
$73f50e845f9ef3b4$exports = {
  "deselectedItem": (args) => `${args.item} niet geselecteerd.`,
  "longPressToSelect": `Druk lang om de selectiemodus te openen.`,
  "select": `Selecteren`,
  "selectedAll": `Alle items geselecteerd.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Geen items geselecteerd`,
    one: () => `${formatter.number(args.count)} item geselecteerd`,
    other: () => `${formatter.number(args.count)} items geselecteerd`
  })}.`,
  "selectedItem": (args) => `${args.item} geselecteerd.`
};
var $87f92a7e077514b2$exports = {};
$87f92a7e077514b2$exports = {
  "deselectedItem": (args) => `Nie zaznaczono ${args.item}.`,
  "longPressToSelect": `Naciśnij i przytrzymaj, aby wejść do trybu wyboru.`,
  "select": `Zaznacz`,
  "selectedAll": `Wszystkie zaznaczone elementy.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nie zaznaczono żadnych elementów`,
    one: () => `${formatter.number(args.count)} zaznaczony element`,
    other: () => `${formatter.number(args.count)} zaznaczonych elementów`
  })}.`,
  "selectedItem": (args) => `Zaznaczono ${args.item}.`
};
var $c28c98d58ee9ff6f$exports = {};
$c28c98d58ee9ff6f$exports = {
  "deselectedItem": (args) => `${args.item} não selecionado.`,
  "longPressToSelect": `Mantenha pressionado para entrar no modo de seleção.`,
  "select": `Selecionar`,
  "selectedAll": `Todos os itens selecionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nenhum item selecionado`,
    one: () => `${formatter.number(args.count)} item selecionado`,
    other: () => `${formatter.number(args.count)} itens selecionados`
  })}.`,
  "selectedItem": (args) => `${args.item} selecionado.`
};
var $b6b1503b17b2254d$exports = {};
$b6b1503b17b2254d$exports = {
  "deselectedItem": (args) => `${args.item} não selecionado.`,
  "longPressToSelect": `Prima continuamente para entrar no modo de seleção.`,
  "select": `Selecionar`,
  "selectedAll": `Todos os itens selecionados.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nenhum item selecionado`,
    one: () => `${formatter.number(args.count)} item selecionado`,
    other: () => `${formatter.number(args.count)} itens selecionados`
  })}.`,
  "selectedItem": (args) => `${args.item} selecionado.`
};
var $8bdaeb71e50c3e1a$exports = {};
$8bdaeb71e50c3e1a$exports = {
  "deselectedItem": (args) => `${args.item} neselectat.`,
  "longPressToSelect": `Apăsați lung pentru a intra în modul de selectare.`,
  "select": `Selectare`,
  "selectedAll": `Toate elementele selectate.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Niciun element selectat`,
    one: () => `${formatter.number(args.count)} element selectat`,
    other: () => `${formatter.number(args.count)} elemente selectate`
  })}.`,
  "selectedItem": (args) => `${args.item} selectat.`
};
var $ec2b852dd7c3d1f2$exports = {};
$ec2b852dd7c3d1f2$exports = {
  "deselectedItem": (args) => `${args.item} не выбрано.`,
  "longPressToSelect": `Нажмите и удерживайте для входа в режим выбора.`,
  "select": `Выбрать`,
  "selectedAll": `Выбраны все элементы.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Нет выбранных элементов`,
    one: () => `${formatter.number(args.count)} элемент выбран`,
    other: () => `${formatter.number(args.count)} элементов выбрано`
  })}.`,
  "selectedItem": (args) => `${args.item} выбрано.`
};
var $79e6d900d6a4f82d$exports = {};
$79e6d900d6a4f82d$exports = {
  "deselectedItem": (args) => `Nevybraté položky: ${args.item}.`,
  "longPressToSelect": `Dlhším stlačením prejdite do režimu výberu.`,
  "select": `Vybrať`,
  "selectedAll": `Všetky vybraté položky.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Žiadne vybraté položky`,
    one: () => `${formatter.number(args.count)} vybratá položka`,
    other: () => `Počet vybratých položiek:${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `Vybraté položky: ${args.item}.`
};
var $f4c1f0d5d4d03d80$exports = {};
$f4c1f0d5d4d03d80$exports = {
  "deselectedItem": (args) => `Element ${args.item} ni izbran.`,
  "longPressToSelect": `Za izbirni način pritisnite in dlje časa držite.`,
  "select": `Izberite`,
  "selectedAll": `Vsi elementi so izbrani.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Noben element ni izbran`,
    one: () => `${formatter.number(args.count)} element je izbran`,
    other: () => `${formatter.number(args.count)} elementov je izbranih`
  })}.`,
  "selectedItem": (args) => `Element ${args.item} je izbran.`
};
var $46252cd87269b10b$exports = {};
$46252cd87269b10b$exports = {
  "deselectedItem": (args) => `${args.item} nije izabrano.`,
  "longPressToSelect": `Dugo pritisnite za ulazak u režim biranja.`,
  "select": `Izaberite`,
  "selectedAll": `Izabrane su sve stavke.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Nije izabrana nijedna stavka`,
    one: () => `Izabrana je ${formatter.number(args.count)} stavka`,
    other: () => `Izabrano je ${formatter.number(args.count)} stavki`
  })}.`,
  "selectedItem": (args) => `${args.item} je izabrano.`
};
var $d4d5d8dab362555c$exports = {};
$d4d5d8dab362555c$exports = {
  "deselectedItem": (args) => `${args.item} ej markerat.`,
  "longPressToSelect": `Tryck länge när du vill öppna väljarläge.`,
  "select": `Markera`,
  "selectedAll": `Alla markerade objekt.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Inga markerade objekt`,
    one: () => `${formatter.number(args.count)} markerat objekt`,
    other: () => `${formatter.number(args.count)} markerade objekt`
  })}.`,
  "selectedItem": (args) => `${args.item} markerat.`
};
var $3d55d1f97c377e83$exports = {};
$3d55d1f97c377e83$exports = {
  "deselectedItem": (args) => `${args.item} seçilmedi.`,
  "longPressToSelect": `Seçim moduna girmek için uzun basın.`,
  "select": `Seç`,
  "selectedAll": `Tüm ögeler seçildi.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Hiçbir öge seçilmedi`,
    one: () => `${formatter.number(args.count)} öge seçildi`,
    other: () => `${formatter.number(args.count)} öge seçildi`
  })}.`,
  "selectedItem": (args) => `${args.item} seçildi.`
};
var $5368512f1c703a3f$exports = {};
$5368512f1c703a3f$exports = {
  "deselectedItem": (args) => `${args.item} не вибрано.`,
  "longPressToSelect": `Виконайте довге натиснення, щоб перейти в режим вибору.`,
  "select": `Вибрати`,
  "selectedAll": `Усі елементи вибрано.`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `Жодних елементів не вибрано`,
    one: () => `${formatter.number(args.count)} елемент вибрано`,
    other: () => `Вибрано елементів: ${formatter.number(args.count)}`
  })}.`,
  "selectedItem": (args) => `${args.item} вибрано.`
};
var $f1316b1074463583$exports = {};
$f1316b1074463583$exports = {
  "deselectedItem": (args) => `未选择 ${args.item}。`,
  "longPressToSelect": `长按以进入选择模式。`,
  "select": `选择`,
  "selectedAll": `已选择所有项目。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `未选择项目`,
    one: () => `已选择 ${formatter.number(args.count)} 个项目`,
    other: () => `已选择 ${formatter.number(args.count)} 个项目`
  })}。`,
  "selectedItem": (args) => `已选择 ${args.item}。`
};
var $7e60654723031b6f$exports = {};
$7e60654723031b6f$exports = {
  "deselectedItem": (args) => `未選取「${args.item}」。`,
  "longPressToSelect": `長按以進入選擇模式。`,
  "select": `選取`,
  "selectedAll": `已選取所有項目。`,
  "selectedCount": (args, formatter) => `${formatter.plural(args.count, {
    "=0": `未選取任何項目`,
    one: () => `已選取 ${formatter.number(args.count)} 個項目`,
    other: () => `已選取 ${formatter.number(args.count)} 個項目`
  })}。`,
  "selectedItem": (args) => `已選取「${args.item}」。`
};
var $835c96616a7cb4f9$exports = {};
$835c96616a7cb4f9$exports = {
  "ar-AE": $682989befd4f478d$exports,
  "bg-BG": $f7fca02019afd941$exports,
  "cs-CZ": $8f86f40be75387f1$exports,
  "da-DK": $db24ba43c8d652ee$exports,
  "de-DE": $f8f1e72c8b5447d6$exports,
  "el-GR": $9a73ed2983c3ab0b$exports,
  "en-US": $583de0b3587601b9$exports,
  "es-ES": $147159c978043442$exports,
  "et-EE": $5cbb62c8a19173ac$exports,
  "fi-FI": $a33d71dc804cc59e$exports,
  "fr-FR": $92d800447793d084$exports,
  "he-IL": $fe732cdb32124ea8$exports,
  "hr-HR": $e41234e934efb4f5$exports,
  "hu-HU": $1b0393182473bf9e$exports,
  "it-IT": $2eed782c1c110ce7$exports,
  "ja-JP": $8b5d459f86e9b23c$exports,
  "ko-KR": $1949c3ad17295fd4$exports,
  "lt-LT": $f5e3df4dc8aa7b54$exports,
  "lv-LV": $9dd86690a5c2b2c5$exports,
  "nb-NO": $843964c3bf9a7d24$exports,
  "nl-NL": $73f50e845f9ef3b4$exports,
  "pl-PL": $87f92a7e077514b2$exports,
  "pt-BR": $c28c98d58ee9ff6f$exports,
  "pt-PT": $b6b1503b17b2254d$exports,
  "ro-RO": $8bdaeb71e50c3e1a$exports,
  "ru-RU": $ec2b852dd7c3d1f2$exports,
  "sk-SK": $79e6d900d6a4f82d$exports,
  "sl-SI": $f4c1f0d5d4d03d80$exports,
  "sr-SP": $46252cd87269b10b$exports,
  "sv-SE": $d4d5d8dab362555c$exports,
  "tr-TR": $3d55d1f97c377e83$exports,
  "uk-UA": $5368512f1c703a3f$exports,
  "zh-CN": $f1316b1074463583$exports,
  "zh-TW": $7e60654723031b6f$exports
};
const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
let $319e236875307eab$var$liveAnnouncer = null;
function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
  if (!$319e236875307eab$var$liveAnnouncer) {
    $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
    if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined"))
      setTimeout(() => {
        if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached())
          $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
      }, 100);
    else
      $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
  } else
    $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
}
function $319e236875307eab$export$d10ae4f68404609a(assertiveness) {
  if ($319e236875307eab$var$liveAnnouncer)
    $319e236875307eab$var$liveAnnouncer.clear(assertiveness);
}
class $319e236875307eab$var$LiveAnnouncer {
  isAttached() {
    var _this_node;
    return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
  }
  createLog(ariaLive) {
    let node2 = document.createElement("div");
    node2.setAttribute("role", "log");
    node2.setAttribute("aria-live", ariaLive);
    node2.setAttribute("aria-relevant", "additions");
    return node2;
  }
  destroy() {
    if (!this.node)
      return;
    document.body.removeChild(this.node);
    this.node = null;
  }
  announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
    var _this_assertiveLog, _this_politeLog;
    if (!this.node)
      return;
    let node2 = document.createElement("div");
    if (typeof message === "object") {
      node2.setAttribute("role", "img");
      node2.setAttribute("aria-labelledby", message["aria-labelledby"]);
    } else
      node2.textContent = message;
    if (assertiveness === "assertive")
      (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node2);
    else
      (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node2);
    if (message !== "")
      setTimeout(() => {
        node2.remove();
      }, timeout);
  }
  clear(assertiveness) {
    if (!this.node)
      return;
    if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog)
      this.assertiveLog.innerHTML = "";
    if ((!assertiveness || assertiveness === "polite") && this.politeLog)
      this.politeLog.innerHTML = "";
  }
  constructor() {
    this.node = null;
    this.assertiveLog = null;
    this.politeLog = null;
    if (typeof document !== "undefined") {
      this.node = document.createElement("div");
      this.node.dataset.liveAnnouncer = "true";
      Object.assign(this.node.style, {
        border: 0,
        clip: "rect(0 0 0 0)",
        clipPath: "inset(50%)",
        height: "1px",
        margin: "-1px",
        overflow: "hidden",
        padding: 0,
        position: "absolute",
        width: "1px",
        whiteSpace: "nowrap"
      });
      this.assertiveLog = this.createLog("assertive");
      this.node.appendChild(this.assertiveLog);
      this.politeLog = this.createLog("polite");
      this.node.appendChild(this.politeLog);
      document.body.prepend(this.node);
    }
  }
}
function $parcel$interopDefault$j(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $92599c3fd427b763$export$137e594ef3218a10(props, state) {
  let { getRowText = (key) => {
    var _state_collection_getTextValue, _state_collection, _state_collection_getItem;
    var _state_collection_getTextValue1;
    return (_state_collection_getTextValue1 = (_state_collection_getTextValue = (_state_collection = state.collection).getTextValue) === null || _state_collection_getTextValue === void 0 ? void 0 : _state_collection_getTextValue.call(_state_collection, key)) !== null && _state_collection_getTextValue1 !== void 0 ? _state_collection_getTextValue1 : (_state_collection_getItem = state.collection.getItem(key)) === null || _state_collection_getItem === void 0 ? void 0 : _state_collection_getItem.textValue;
  } } = props;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$j($835c96616a7cb4f9$exports), "@react-aria/grid");
  let selection = state.selectionManager.rawSelection;
  let lastSelection = reactExports.useRef(selection);
  let announceSelectionChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    var _lastSelection_current;
    if (!state.selectionManager.isFocused || selection === lastSelection.current) {
      lastSelection.current = selection;
      return;
    }
    let addedKeys = $92599c3fd427b763$var$diffSelection(selection, lastSelection.current);
    let removedKeys = $92599c3fd427b763$var$diffSelection(lastSelection.current, selection);
    let isReplace = state.selectionManager.selectionBehavior === "replace";
    let messages2 = [];
    if (state.selectionManager.selectedKeys.size === 1 && isReplace) {
      let firstKey = state.selectionManager.selectedKeys.keys().next().value;
      if (firstKey != null && state.collection.getItem(firstKey)) {
        let currentSelectionText = getRowText(firstKey);
        if (currentSelectionText)
          messages2.push(stringFormatter.format("selectedItem", {
            item: currentSelectionText
          }));
      }
    } else if (addedKeys.size === 1 && removedKeys.size === 0) {
      let firstKey = addedKeys.keys().next().value;
      if (firstKey != null) {
        let addedText = getRowText(firstKey);
        if (addedText)
          messages2.push(stringFormatter.format("selectedItem", {
            item: addedText
          }));
      }
    } else if (removedKeys.size === 1 && addedKeys.size === 0) {
      let firstKey = removedKeys.keys().next().value;
      if (firstKey != null && state.collection.getItem(firstKey)) {
        let removedText = getRowText(firstKey);
        if (removedText)
          messages2.push(stringFormatter.format("deselectedItem", {
            item: removedText
          }));
      }
    }
    if (state.selectionManager.selectionMode === "multiple") {
      if (messages2.length === 0 || selection === "all" || selection.size > 1 || lastSelection.current === "all" || ((_lastSelection_current = lastSelection.current) === null || _lastSelection_current === void 0 ? void 0 : _lastSelection_current.size) > 1)
        messages2.push(selection === "all" ? stringFormatter.format("selectedAll") : stringFormatter.format("selectedCount", {
          count: selection.size
        }));
    }
    if (messages2.length > 0)
      $319e236875307eab$export$a9b970dcc4ae71a9(messages2.join(" "));
    lastSelection.current = selection;
  });
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (state.selectionManager.isFocused)
      announceSelectionChange();
    else {
      let raf3 = requestAnimationFrame(announceSelectionChange);
      return () => cancelAnimationFrame(raf3);
    }
  }, [
    selection,
    state.selectionManager.isFocused
  ]);
}
function $92599c3fd427b763$var$diffSelection(a2, b2) {
  let res = /* @__PURE__ */ new Set();
  if (a2 === "all" || b2 === "all")
    return res;
  for (let key of a2.keys())
    if (!b2.has(key))
      res.add(key);
  return res;
}
function $parcel$interopDefault$i(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $5b9b5b5723db6ae1$export$be42ebdab07ae4c2(props) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$i($835c96616a7cb4f9$exports), "@react-aria/grid");
  let modality = $507fabe10e71c6fb$export$98e20ec92f614cfe();
  let shouldLongPress = (modality === "pointer" || modality === "virtual" || modality == null) && typeof window !== "undefined" && "ontouchstart" in window;
  let interactionDescription = reactExports.useMemo(() => {
    let selectionMode = props.selectionManager.selectionMode;
    let selectionBehavior = props.selectionManager.selectionBehavior;
    let message;
    if (shouldLongPress)
      message = stringFormatter.format("longPressToSelect");
    return selectionBehavior === "replace" && selectionMode !== "none" && props.hasItemActions ? message : void 0;
  }, [
    props.selectionManager.selectionMode,
    props.selectionManager.selectionBehavior,
    props.hasItemActions,
    stringFormatter,
    shouldLongPress
  ]);
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(interactionDescription);
  return descriptionProps;
}
function $9bf71ea28793e738$var$isTabbableRadio$2(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$2(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$2(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$2(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$2 = class $9bf71ea28793e738$var$Tree6 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$2({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$2(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree6();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$2({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$2 = class $9bf71ea28793e738$var$TreeNode6 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$2();
function $83013635b024ae3d$export$eac1895992b9f3d6$1(ref, options) {
  let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
  let [hasTabbableChild, setHasTabbableChild] = reactExports.useState(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
      let update = () => {
        if (ref.current) {
          let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current, {
            tabbable: true
          });
          setHasTabbableChild(!!walker.nextNode());
        }
      };
      update();
      let observer = new MutationObserver(update);
      observer.observe(ref.current, {
        subtree: true,
        childList: true,
        attributes: true,
        attributeFilter: [
          "tabIndex",
          "disabled"
        ]
      });
      return () => {
        observer.disconnect();
      };
    }
  });
  return isDisabled ? false : hasTabbableChild;
}
function $83c6e2eafa584c67$export$f6b86a04e5d66d90(props, state, ref) {
  let { isVirtualized, disallowTypeAhead, keyboardDelegate, focusMode, scrollRef, getRowText, onRowAction, onCellAction, escapeKeyBehavior = "clearSelection", shouldSelectOnPressUp } = props;
  let { selectionManager: manager } = state;
  if (!props["aria-label"] && !props["aria-labelledby"])
    console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let disabledBehavior = state.selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $d1c300d9c497e402$export$de9feff04fda126e({
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    focusMode
  }), [
    keyboardDelegate,
    state.collection,
    state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    focusMode
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ref,
    selectionManager: manager,
    keyboardDelegate: delegate,
    isVirtualized,
    scrollRef,
    disallowTypeAhead,
    escapeKeyBehavior
  });
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $1af922eb41e03c8f$export$e6235c0d09b995d0.set(state, {
    keyboardDelegate: delegate,
    actions: {
      onRowAction,
      onCellAction
    },
    shouldSelectOnPressUp
  });
  let descriptionProps = $5b9b5b5723db6ae1$export$be42ebdab07ae4c2({
    selectionManager: manager,
    hasItemActions: !!(onRowAction || onCellAction)
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let onFocus = reactExports.useCallback((e2) => {
    if (manager.isFocused) {
      if (!e2.currentTarget.contains(e2.target))
        manager.setFocused(false);
      return;
    }
    if (!e2.currentTarget.contains(e2.target))
      return;
    manager.setFocused(true);
  }, [
    manager
  ]);
  let navDisabledHandlers = reactExports.useMemo(() => ({
    onBlur: collectionProps.onBlur,
    onFocus
  }), [
    onFocus,
    collectionProps.onBlur
  ]);
  let hasTabbableChild = $83013635b024ae3d$export$eac1895992b9f3d6$1(ref, {
    isDisabled: state.collection.size !== 0
  });
  let gridProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(
    domProps,
    {
      role: "grid",
      id: id2,
      "aria-multiselectable": manager.selectionMode === "multiple" ? "true" : void 0
    },
    state.isKeyboardNavigationDisabled ? navDisabledHandlers : collectionProps,
    // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
    state.collection.size === 0 && {
      tabIndex: hasTabbableChild ? -1 : 0
    } || void 0,
    descriptionProps
  );
  if (isVirtualized) {
    gridProps["aria-rowcount"] = state.collection.size;
    gridProps["aria-colcount"] = state.collection.columnCount;
  }
  $92599c3fd427b763$export$137e594ef3218a10({
    getRowText
  }, state);
  return {
    gridProps
  };
}
function $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf() {
  return {
    rowGroupProps: {
      role: "rowgroup"
    }
  };
}
function $4159a7a9cbb0cc18$export$96357d5a73f686fa(props, state, ref) {
  var _node_props, _node_props1;
  let { node: node2, isVirtualized, shouldSelectOnPressUp, onAction } = props;
  let { actions, shouldSelectOnPressUp: gridShouldSelectOnPressUp } = $1af922eb41e03c8f$export$e6235c0d09b995d0.get(state);
  let onRowAction = actions.onRowAction ? () => {
    var _actions_onRowAction;
    return (_actions_onRowAction = actions.onRowAction) === null || _actions_onRowAction === void 0 ? void 0 : _actions_onRowAction.call(actions, node2.key);
  } : onAction;
  let { itemProps, ...states } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key: node2.key,
    ref,
    isVirtualized,
    shouldSelectOnPressUp: gridShouldSelectOnPressUp || shouldSelectOnPressUp,
    onAction: onRowAction || (node2 === null || node2 === void 0 ? void 0 : (_node_props = node2.props) === null || _node_props === void 0 ? void 0 : _node_props.onAction) ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(node2 === null || node2 === void 0 ? void 0 : (_node_props1 = node2.props) === null || _node_props1 === void 0 ? void 0 : _node_props1.onAction, onRowAction) : void 0,
    isDisabled: state.collection.size === 0
  });
  let isSelected = state.selectionManager.isSelected(node2.key);
  let rowProps = {
    role: "row",
    "aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0,
    "aria-disabled": states.isDisabled || void 0,
    ...itemProps
  };
  if (isVirtualized)
    rowProps["aria-rowindex"] = node2.index + 1;
  return {
    rowProps,
    ...states
  };
}
function $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c(props, state, ref) {
  let { node: node2, isVirtualized, focusMode = "child", shouldSelectOnPressUp, onAction } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { keyboardDelegate, actions: { onCellAction } } = $1af922eb41e03c8f$export$e6235c0d09b995d0.get(state);
  let keyWhenFocused = reactExports.useRef(null);
  let focus = () => {
    if (ref.current) {
      let treeWalker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current);
      if (focusMode === "child") {
        if (ref.current.contains(document.activeElement) && ref.current !== document.activeElement)
          return;
        let focusable2 = state.selectionManager.childFocusStrategy === "last" ? $ab90dcbc1b5466d0$var$last(treeWalker) : treeWalker.firstChild();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          return;
        }
      }
      if (keyWhenFocused.current != null && node2.key !== keyWhenFocused.current || !ref.current.contains(document.activeElement))
        $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
    }
  };
  let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key: node2.key,
    ref,
    isVirtualized,
    focus,
    shouldSelectOnPressUp,
    onAction: onCellAction ? () => onCellAction(node2.key) : onAction,
    isDisabled: state.collection.size === 0
  });
  let onKeyDownCapture = (e2) => {
    if (!e2.currentTarget.contains(e2.target) || state.isKeyboardNavigationDisabled || !ref.current || !document.activeElement)
      return;
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$2(ref.current);
    walker.currentNode = document.activeElement;
    switch (e2.key) {
      case "ArrowLeft": {
        let focusable2 = direction === "rtl" ? walker.nextNode() : walker.previousNode();
        if (focusMode === "child" && focusable2 === ref.current)
          focusable2 = null;
        e2.preventDefault();
        e2.stopPropagation();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
            containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
          });
        } else {
          var _keyboardDelegate_getKeyLeftOf;
          let prev2 = (_keyboardDelegate_getKeyLeftOf = keyboardDelegate.getKeyLeftOf) === null || _keyboardDelegate_getKeyLeftOf === void 0 ? void 0 : _keyboardDelegate_getKeyLeftOf.call(keyboardDelegate, node2.key);
          if (prev2 !== node2.key) {
            var _ref_current_parentElement;
            (_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
            break;
          }
          if (focusMode === "cell" && direction === "rtl") {
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
            $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
              containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
            });
          } else {
            walker.currentNode = ref.current;
            focusable2 = direction === "rtl" ? walker.firstChild() : $ab90dcbc1b5466d0$var$last(walker);
            if (focusable2) {
              $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
              $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
                containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
              });
            }
          }
        }
        break;
      }
      case "ArrowRight": {
        let focusable2 = direction === "rtl" ? walker.previousNode() : walker.nextNode();
        if (focusMode === "child" && focusable2 === ref.current)
          focusable2 = null;
        e2.preventDefault();
        e2.stopPropagation();
        if (focusable2) {
          $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
          $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
            containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
          });
        } else {
          var _keyboardDelegate_getKeyRightOf;
          let next2 = (_keyboardDelegate_getKeyRightOf = keyboardDelegate.getKeyRightOf) === null || _keyboardDelegate_getKeyRightOf === void 0 ? void 0 : _keyboardDelegate_getKeyRightOf.call(keyboardDelegate, node2.key);
          if (next2 !== node2.key) {
            var _ref_current_parentElement1;
            (_ref_current_parentElement1 = ref.current.parentElement) === null || _ref_current_parentElement1 === void 0 ? void 0 : _ref_current_parentElement1.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
            break;
          }
          if (focusMode === "cell" && direction === "ltr") {
            $3ad3f6e1647bc98d$export$80f3e147d781571c$2(ref.current);
            $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
              containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
            });
          } else {
            walker.currentNode = ref.current;
            focusable2 = direction === "rtl" ? $ab90dcbc1b5466d0$var$last(walker) : walker.firstChild();
            if (focusable2) {
              $3ad3f6e1647bc98d$export$80f3e147d781571c$2(focusable2);
              $2f04cbc44ee30ce0$export$c826860796309d1b(focusable2, {
                containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
              });
            }
          }
        }
        break;
      }
      case "ArrowUp":
      case "ArrowDown":
        if (!e2.altKey && ref.current.contains(e2.target)) {
          var _ref_current_parentElement2;
          e2.stopPropagation();
          e2.preventDefault();
          (_ref_current_parentElement2 = ref.current.parentElement) === null || _ref_current_parentElement2 === void 0 ? void 0 : _ref_current_parentElement2.dispatchEvent(new KeyboardEvent(e2.nativeEvent.type, e2.nativeEvent));
        }
        break;
    }
  };
  let onFocus = (e2) => {
    keyWhenFocused.current = node2.key;
    if (e2.target !== ref.current) {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2())
        state.selectionManager.setFocusedKey(node2.key);
      return;
    }
    requestAnimationFrame(() => {
      if (focusMode === "child" && document.activeElement === ref.current)
        focus();
    });
  };
  let gridCellProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(itemProps, {
    role: "gridcell",
    onKeyDownCapture,
    "aria-colspan": node2.colSpan,
    "aria-colindex": node2.colIndex != null ? node2.colIndex + 1 : void 0,
    colSpan: isVirtualized ? void 0 : node2.colSpan,
    onFocus
  });
  var _node_colIndex;
  if (isVirtualized)
    gridCellProps["aria-colindex"] = ((_node_colIndex = node2.colIndex) !== null && _node_colIndex !== void 0 ? _node_colIndex : node2.index) + 1;
  if (shouldSelectOnPressUp && gridCellProps.tabIndex != null && gridCellProps.onPointerDown == null)
    gridCellProps.onPointerDown = (e2) => {
      let el2 = e2.currentTarget;
      let tabindex = el2.getAttribute("tabindex");
      el2.removeAttribute("tabindex");
      requestAnimationFrame(() => {
        if (tabindex != null)
          el2.setAttribute("tabindex", tabindex);
      });
    };
  return {
    gridCellProps,
    isPressed
  };
}
function $ab90dcbc1b5466d0$var$last(walker) {
  let next2 = null;
  let last = null;
  do {
    last = walker.lastChild();
    if (last)
      next2 = last;
  } while (last);
  return next2;
}
function $parcel$interopDefault$h(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $7cb39d07f245a780$export$70e2eed1a92976ad(props, state) {
  let { key } = props;
  let manager = state.selectionManager;
  let checkboxId = $bdb11010cef70236$export$f680877a34711e37$2();
  let isDisabled = !state.selectionManager.canSelectItem(key);
  let isSelected = state.selectionManager.isSelected(key);
  let onChange = () => manager.toggleSelection(key);
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$h($835c96616a7cb4f9$exports), "@react-aria/grid");
  return {
    checkboxProps: {
      id: checkboxId,
      "aria-label": stringFormatter.format("select"),
      isSelected,
      isDisabled,
      onChange
    }
  };
}
class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends $d1c300d9c497e402$export$de9feff04fda126e {
  isCell(node2) {
    return node2.type === "cell" || node2.type === "rowheader" || node2.type === "column";
  }
  getKeyBelow(key) {
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    if (startItem.type === "column") {
      let child = $c5a24bc478652b5f$export$fbdeaa6a76694f71($c5a24bc478652b5f$export$1005530eda016c13(startItem, this.collection));
      if (child)
        return child.key;
      let firstKey = this.getFirstKey();
      if (firstKey == null)
        return null;
      let firstItem = this.collection.getItem(firstKey);
      if (!firstItem)
        return null;
      return super.getKeyForItemInRowByIndex(firstKey, startItem.index);
    }
    return super.getKeyBelow(key);
  }
  getKeyAbove(key) {
    let startItem = this.collection.getItem(key);
    if (!startItem)
      return null;
    if (startItem.type === "column") {
      let parent = startItem.parentKey != null ? this.collection.getItem(startItem.parentKey) : null;
      if (parent && parent.type === "column")
        return parent.key;
      return null;
    }
    let superKey = super.getKeyAbove(key);
    let superItem = superKey != null ? this.collection.getItem(superKey) : null;
    if (superItem && superItem.type !== "headerrow")
      return superKey;
    if (this.isCell(startItem))
      return this.collection.columns[startItem.index].key;
    return this.collection.columns[0].key;
  }
  findNextColumnKey(column2) {
    let key = this.findNextKey(column2.key, (item) => item.type === "column");
    if (key != null)
      return key;
    let row = this.collection.headerRows[column2.level];
    for (let item of $c5a24bc478652b5f$export$1005530eda016c13(row, this.collection)) {
      if (item.type === "column")
        return item.key;
    }
    return null;
  }
  findPreviousColumnKey(column2) {
    let key = this.findPreviousKey(column2.key, (item) => item.type === "column");
    if (key != null)
      return key;
    let row = this.collection.headerRows[column2.level];
    let childNodes = [
      ...$c5a24bc478652b5f$export$1005530eda016c13(row, this.collection)
    ];
    for (let i2 = childNodes.length - 1; i2 >= 0; i2--) {
      let item = childNodes[i2];
      if (item.type === "column")
        return item.key;
    }
    return null;
  }
  getKeyRightOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (item.type === "column")
      return this.direction === "rtl" ? this.findPreviousColumnKey(item) : this.findNextColumnKey(item);
    return super.getKeyRightOf(key);
  }
  getKeyLeftOf(key) {
    let item = this.collection.getItem(key);
    if (!item)
      return null;
    if (item.type === "column")
      return this.direction === "rtl" ? this.findNextColumnKey(item) : this.findPreviousColumnKey(item);
    return super.getKeyLeftOf(key);
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey !== null && fromKey !== void 0 ? fromKey : this.getFirstKey();
    if (key == null)
      return null;
    let startItem = collection.getItem(key);
    var _startItem_parentKey;
    if ((startItem === null || startItem === void 0 ? void 0 : startItem.type) === "cell")
      key = (_startItem_parentKey = startItem.parentKey) !== null && _startItem_parentKey !== void 0 ? _startItem_parentKey : null;
    let hasWrapped = false;
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      if (item.textValue) {
        let substring = item.textValue.slice(0, search2.length);
        if (this.collator.compare(substring, search2) === 0)
          return item.key;
      }
      for (let cell of $c5a24bc478652b5f$export$1005530eda016c13(item, this.collection)) {
        let column2 = collection.columns[cell.index];
        if (collection.rowHeaderColumnKeys.has(column2.key) && cell.textValue) {
          let substring = cell.textValue.slice(0, search2.length);
          if (this.collator.compare(substring, search2) === 0) {
            let fromItem = fromKey != null ? collection.getItem(fromKey) : startItem;
            return (fromItem === null || fromItem === void 0 ? void 0 : fromItem.type) === "cell" ? cell.key : item.key;
          }
        }
      }
      key = this.getKeyBelow(key);
      if (key == null && !hasWrapped) {
        key = this.getFirstKey();
        hasWrapped = true;
      }
    }
    return null;
  }
}
function $parcel$interopDefault$g(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
  let { keyboardDelegate, isVirtualized, layoutDelegate, layout: layout2 } = props;
  let collator = $325a3faab7a68acd$export$a16aca283550c30d$2({
    usage: "search",
    sensitivity: "base"
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let disabledBehavior = state.selectionManager.disabledBehavior;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $0ba3c81c7f1caedd$export$da43f8f5cb04028d({
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    layoutDelegate,
    layout: layout2
  }), [
    keyboardDelegate,
    state.collection,
    state.disabledKeys,
    disabledBehavior,
    ref,
    direction,
    collator,
    layoutDelegate,
    layout2
  ]);
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $2140fb2337097f2d$export$552312adfd451dab.set(state, id2);
  let { gridProps } = $83c6e2eafa584c67$export$f6b86a04e5d66d90({
    ...props,
    id: id2,
    keyboardDelegate: delegate
  }, state, ref);
  if (isVirtualized)
    gridProps["aria-rowcount"] = state.collection.size + state.collection.headerRows.length;
  if ($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state)
    gridProps.role = "treegrid";
  let { column: column2, direction: sortDirection } = state.sortDescriptor || {};
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$g($7476b46781682bf5$exports), "@react-aria/table");
  let sortDescription = reactExports.useMemo(() => {
    var _state_collection_columns_find;
    var _state_collection_columns_find_textValue;
    let columnName = (_state_collection_columns_find_textValue = (_state_collection_columns_find = state.collection.columns.find((c2) => c2.key === column2)) === null || _state_collection_columns_find === void 0 ? void 0 : _state_collection_columns_find.textValue) !== null && _state_collection_columns_find_textValue !== void 0 ? _state_collection_columns_find_textValue : "";
    return sortDirection && column2 ? stringFormatter.format(`${sortDirection}Sort`, {
      columnName
    }) : void 0;
  }, [
    sortDirection,
    column2,
    state.collection.columns
  ]);
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(sortDescription);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (sortDescription)
      $319e236875307eab$export$a9b970dcc4ae71a9(sortDescription, "assertive", 500);
  }, [
    sortDescription
  ]);
  return {
    gridProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(gridProps, descriptionProps, {
      // merge sort description with long press information
      "aria-describedby": [
        descriptionProps["aria-describedby"],
        gridProps["aria-describedby"]
      ].filter(Boolean).join(" ")
    })
  };
}
function $parcel$interopDefault$f(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
  var _state_sortDescriptor, _state_sortDescriptor1;
  let { node: node2 } = props;
  let allowsSorting = node2.props.allowsSorting;
  let { gridCellProps } = $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c({
    ...props,
    focusMode: "child"
  }, state, ref);
  let isSelectionCellDisabled = node2.props.isSelectionCell && state.selectionManager.selectionMode === "single";
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    isDisabled: !allowsSorting || isSelectionCellDisabled,
    onPress() {
      state.sort(node2.key);
    },
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({}, ref);
  let ariaSort = void 0;
  let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node2.key;
  let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
  if (node2.props.allowsSorting && !$c87311424ea30a05$export$a11b0059900ceec8$4())
    ariaSort = isSortedColumn ? sortDirection : "none";
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$f($7476b46781682bf5$exports), "@react-aria/table");
  let sortDescription;
  if (allowsSorting) {
    sortDescription = `${stringFormatter.format("sortable")}`;
    if (isSortedColumn && sortDirection && $c87311424ea30a05$export$a11b0059900ceec8$4())
      sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
  }
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(sortDescription);
  let shouldDisableFocus = state.collection.size === 0;
  reactExports.useEffect(() => {
    if (shouldDisableFocus && state.selectionManager.focusedKey === node2.key)
      state.selectionManager.setFocusedKey(null);
  }, [
    shouldDisableFocus,
    state.selectionManager,
    node2.key
  ]);
  return {
    columnHeaderProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(
        focusableProps,
        gridCellProps,
        pressProps,
        descriptionProps,
        // If the table is empty, make all column headers untabbable
        shouldDisableFocus ? {
          tabIndex: -1
        } : null
      ),
      role: "columnheader",
      id: $2140fb2337097f2d$export$37cd4213f2ad742e(state, node2.key),
      "aria-colspan": node2.colSpan && node2.colSpan > 1 ? node2.colSpan : void 0,
      "aria-sort": ariaSort
    }
  };
}
const $b2db214c022798eb$var$EXPANSION_KEYS = {
  expand: {
    ltr: "ArrowRight",
    rtl: "ArrowLeft"
  },
  "collapse": {
    ltr: "ArrowLeft",
    rtl: "ArrowRight"
  }
};
function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
  let { node: node2, isVirtualized } = props;
  let { rowProps, ...states } = $4159a7a9cbb0cc18$export$96357d5a73f686fa(props, state, ref);
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  if (isVirtualized && !($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state))
    rowProps["aria-rowindex"] = node2.index + 1 + state.collection.headerRows.length;
  else
    delete rowProps["aria-rowindex"];
  let treeGridRowProps = {};
  if ($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state) {
    let treeNode = state.keyMap.get(node2.key);
    if (treeNode != null) {
      var _treeNode_props, _treeNode_props_children, _treeNode_props1, _getLastItem, _state_keyMap_get, _getLastItem1;
      let hasChildRows = ((_treeNode_props = treeNode.props) === null || _treeNode_props === void 0 ? void 0 : _treeNode_props.UNSTABLE_childItems) || ((_treeNode_props1 = treeNode.props) === null || _treeNode_props1 === void 0 ? void 0 : (_treeNode_props_children = _treeNode_props1.children) === null || _treeNode_props_children === void 0 ? void 0 : _treeNode_props_children.length) > state.userColumnCount;
      var _treeNode_indexOfType, _state_keyMap_get_childNodes, _getLastItem_indexOfType, _getLastItem_indexOfType1;
      treeGridRowProps = {
        onKeyDown: (e2) => {
          if (e2.key === $b2db214c022798eb$var$EXPANSION_KEYS["expand"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && state.expandedKeys !== "all" && !state.expandedKeys.has(treeNode.key)) {
            state.toggleKey(treeNode.key);
            e2.stopPropagation();
          } else if (e2.key === $b2db214c022798eb$var$EXPANSION_KEYS["collapse"][direction] && state.selectionManager.focusedKey === treeNode.key && hasChildRows && (state.expandedKeys === "all" || state.expandedKeys.has(treeNode.key))) {
            state.toggleKey(treeNode.key);
            e2.stopPropagation();
          }
        },
        "aria-expanded": hasChildRows ? state.expandedKeys === "all" || state.expandedKeys.has(node2.key) : void 0,
        "aria-level": treeNode.level,
        "aria-posinset": ((_treeNode_indexOfType = treeNode.indexOfType) !== null && _treeNode_indexOfType !== void 0 ? _treeNode_indexOfType : 0) + 1,
        "aria-setsize": treeNode.level > 1 ? ((_getLastItem_indexOfType = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf((_state_keyMap_get_childNodes = (_state_keyMap_get = state.keyMap.get(treeNode.parentKey)) === null || _state_keyMap_get === void 0 ? void 0 : _state_keyMap_get.childNodes) !== null && _state_keyMap_get_childNodes !== void 0 ? _state_keyMap_get_childNodes : [])) === null || _getLastItem === void 0 ? void 0 : _getLastItem.indexOfType) !== null && _getLastItem_indexOfType !== void 0 ? _getLastItem_indexOfType : 0) + 1 : ((_getLastItem_indexOfType1 = (_getLastItem1 = $c5a24bc478652b5f$export$7475b2c64539e4cf(state.collection.body.childNodes)) === null || _getLastItem1 === void 0 ? void 0 : _getLastItem1.indexOfType) !== null && _getLastItem_indexOfType1 !== void 0 ? _getLastItem_indexOfType1 : 0) + 1
      };
    }
  }
  let syntheticLinkProps = $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(node2.props);
  let linkProps = states.hasAction ? syntheticLinkProps : {};
  return {
    rowProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(rowProps, treeGridRowProps, linkProps),
      "aria-labelledby": $2140fb2337097f2d$export$85069b70317f543(state, node2.key)
    },
    ...states
  };
}
function $f917ee10f4c32dab$export$1b95a7d2d517b841(props, state, ref) {
  let { node: node2, isVirtualized } = props;
  let rowProps = {
    role: "row"
  };
  if (isVirtualized && !($f4e2df6bd15f8569$export$1b00cb14a96194e6() && "expandedKeys" in state))
    rowProps["aria-rowindex"] = node2.index + 1;
  return {
    rowProps
  };
}
function $7713593715703b24$export$49571c903d73624c(props, state, ref) {
  var _props_node_column;
  let { gridCellProps, isPressed } = $ab90dcbc1b5466d0$export$c7e10bfc0c59f67c(props, state, ref);
  let columnKey = (_props_node_column = props.node.column) === null || _props_node_column === void 0 ? void 0 : _props_node_column.key;
  if (columnKey != null && state.collection.rowHeaderColumnKeys.has(columnKey)) {
    gridCellProps.role = "rowheader";
    gridCellProps.id = $2140fb2337097f2d$export$19baff3266315d44(state, props.node.parentKey, columnKey);
  }
  return {
    gridCellProps,
    isPressed
  };
}
function $parcel$interopDefault$e(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $2a795c53a101c542$export$16ea7f650bd7c1bb(props, state) {
  let { key } = props;
  const { checkboxProps } = $7cb39d07f245a780$export$70e2eed1a92976ad(props, state);
  return {
    checkboxProps: {
      ...checkboxProps,
      "aria-labelledby": `${checkboxProps.id} ${$2140fb2337097f2d$export$85069b70317f543(state, key)}`
    }
  };
}
function $2a795c53a101c542$export$1003db6a7e384b99(state) {
  let { isEmpty: isEmpty2, isSelectAll, selectionMode } = state.selectionManager;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$e($7476b46781682bf5$exports), "@react-aria/table");
  return {
    checkboxProps: {
      "aria-label": stringFormatter.format(selectionMode === "single" ? "select" : "selectAll"),
      isSelected: isSelectAll,
      isDisabled: selectionMode !== "multiple" || state.collection.size === 0 || state.collection.rows.length === 1 && state.collection.rows[0].type === "loader",
      isIndeterminate: !isEmpty2 && !isSelectAll,
      onChange: () => state.selectionManager.toggleSelectAll()
    }
  };
}
function $0047e6c294ea075f$export$6fb1613bd7b28198() {
  return $e45487f8ba1cbdbf$export$d3037f5d3f3e51bf();
}
const $5c3e21d68f1c4674$var$styles = {
  border: 0,
  clip: "rect(0 0 0 0)",
  clipPath: "inset(50%)",
  height: "1px",
  margin: "-1px",
  overflow: "hidden",
  padding: 0,
  position: "absolute",
  width: "1px",
  whiteSpace: "nowrap"
};
function $5c3e21d68f1c4674$export$a966af930f325cab(props = {}) {
  let { style: style2, isFocusable } = props;
  let [isFocused, setFocused] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled: !isFocusable,
    onFocusWithinChange: (val) => setFocused(val)
  });
  let combinedStyles = reactExports.useMemo(() => {
    if (isFocused)
      return style2;
    else if (style2)
      return {
        ...$5c3e21d68f1c4674$var$styles,
        ...style2
      };
    else
      return $5c3e21d68f1c4674$var$styles;
  }, [
    isFocused
  ]);
  return {
    visuallyHiddenProps: {
      ...focusWithinProps,
      style: combinedStyles
    }
  };
}
function $5c3e21d68f1c4674$export$439d29a4e110a164(props) {
  let { children, elementType: Element2 = "div", isFocusable, style: style2, ...otherProps } = props;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab(props);
  return /* @__PURE__ */ React$6.createElement(Element2, $3ef42575df84b30b$export$9d1611c77c2fe928$9(otherProps, visuallyHiddenProps), children);
}
var TableSelectAllCheckbox = forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    as: as2,
    className,
    node: node2,
    slots,
    state,
    selectionMode,
    color: color2,
    checkboxesProps,
    disableAnimation,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "th";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { columnHeaderProps } = $f329116d8ad0aba0$export$9514819a8c81e960({ node: node2 }, state, domRef);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { checkboxProps } = $2a795c53a101c542$export$1003db6a7e384b99(state);
  const thStyles = clsx$5(classNames2 == null ? void 0 : classNames2.th, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const isSingleSelectionMode = selectionMode === "single";
  const { onChange, ...otherCheckboxProps } = checkboxProps;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      ...mergeProps$3(
        columnHeaderProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        })
      ),
      className: (_b2 = slots.th) == null ? void 0 : _b2.call(slots, { class: thStyles }),
      children: isSingleSelectionMode ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: checkboxProps["aria-label"] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          color: color2,
          disableAnimation,
          onValueChange: onChange,
          ...mergeProps$3(checkboxesProps, otherCheckboxProps)
        }
      )
    }
  );
});
TableSelectAllCheckbox.displayName = "HeroUI.TableSelectAllCheckbox";
var table_select_all_checkbox_default = TableSelectAllCheckbox;
function $62967d126f3aa823$export$4007ac09ff9c68ed(props) {
  let { collection, focusMode } = props;
  let selectionState = props.UNSAFE_selectionState || $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let setFocusedKey = selectionState.setFocusedKey;
  selectionState.setFocusedKey = (key, child) => {
    if (focusMode === "cell" && key != null) {
      let item = collection.getItem(key);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item") {
        var _getLastItem, _getFirstItem;
        let children = $c5a24bc478652b5f$export$1005530eda016c13(item, collection);
        var _getLastItem_key, _getFirstItem_key;
        if (child === "last")
          key = (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(children)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
        else
          key = (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(children)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
      }
    }
    setFocusedKey(key, child);
  };
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState), [
    collection,
    selectionState
  ]);
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionState.focusedKey != null && cachedCollection.current && !collection.getItem(selectionState.focusedKey)) {
      const node2 = cachedCollection.current.getItem(selectionState.focusedKey);
      const parentNode = (node2 === null || node2 === void 0 ? void 0 : node2.parentKey) != null && (node2.type === "cell" || node2.type === "rowheader" || node2.type === "column") ? cachedCollection.current.getItem(node2.parentKey) : node2;
      if (!parentNode) {
        selectionState.setFocusedKey(null);
        return;
      }
      const cachedRows = cachedCollection.current.rows;
      const rows = collection.rows;
      const diff2 = cachedRows.length - rows.length;
      let index2 = Math.min(diff2 > 1 ? Math.max(parentNode.index - diff2 + 1, 0) : parentNode.index, rows.length - 1);
      let newRow = null;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(rows[index2].key) && rows[index2].type !== "headerrow") {
          newRow = rows[index2];
          break;
        }
        if (index2 < rows.length - 1)
          index2++;
        else {
          if (index2 > parentNode.index)
            index2 = parentNode.index;
          index2--;
        }
      }
      if (newRow) {
        const childNodes = newRow.hasChildNodes ? [
          ...$c5a24bc478652b5f$export$1005530eda016c13(newRow, collection)
        ] : [];
        const keyToFocus = newRow.hasChildNodes && parentNode !== node2 && node2 && node2.index < childNodes.length ? childNodes[node2.index].key : newRow.key;
        selectionState.setFocusedKey(keyToFocus);
      } else
        selectionState.setFocusedKey(null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager,
    selectionState,
    selectionState.focusedKey
  ]);
  return {
    collection,
    disabledKeys,
    isKeyboardNavigationDisabled: false,
    selectionManager
  };
}
class $16805b1b18093c5f$export$de3fdf6493c353d {
  *[Symbol.iterator]() {
    yield* [
      ...this.rows
    ];
  }
  get size() {
    return [
      ...this.rows
    ].length;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    var _24;
    return (_24 = [
      ...this.rows
    ][0]) === null || _24 === void 0 ? void 0 : _24.key;
  }
  getLastKey() {
    var _rows_;
    let rows = [
      ...this.rows
    ];
    return (_rows_ = rows[rows.length - 1]) === null || _rows_ === void 0 ? void 0 : _rows_.key;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(opts2) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.keyMap = /* @__PURE__ */ new Map();
    this.columnCount = opts2 === null || opts2 === void 0 ? void 0 : opts2.columnCount;
    this.rows = [];
    let visit2 = (node2) => {
      let prevNode = this.keyMap.get(node2.key);
      if (opts2.visitNode)
        node2 = opts2.visitNode(node2);
      this.keyMap.set(node2.key, node2);
      let childKeys = /* @__PURE__ */ new Set();
      let last2 = null;
      let rowHasCellWithColSpan = false;
      if (node2.type === "item") {
        var _child_props;
        for (let child of node2.childNodes)
          if (((_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props.colSpan) !== void 0) {
            rowHasCellWithColSpan = true;
            break;
          }
      }
      for (let child of node2.childNodes) {
        if (child.type === "cell" && rowHasCellWithColSpan) {
          var _child_props1, _child_props2;
          child.colspan = (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.colSpan;
          child.colSpan = (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.colSpan;
          var _last_colIndex, _last_colSpan;
          child.colIndex = !last2 ? child.index : ((_last_colIndex = last2.colIndex) !== null && _last_colIndex !== void 0 ? _last_colIndex : last2.index) + ((_last_colSpan = last2.colSpan) !== null && _last_colSpan !== void 0 ? _last_colSpan : 1);
        }
        if (child.type === "cell" && child.parentKey == null)
          child.parentKey = node2.key;
        childKeys.add(child.key);
        if (last2) {
          last2.nextKey = child.key;
          child.prevKey = last2.key;
        } else
          child.prevKey = null;
        visit2(child);
        last2 = child;
      }
      if (last2)
        last2.nextKey = null;
      if (prevNode) {
        for (let child of prevNode.childNodes)
          if (!childKeys.has(child.key))
            remove(child);
      }
    };
    let remove = (node2) => {
      this.keyMap.delete(node2.key);
      for (let child of node2.childNodes)
        if (this.keyMap.get(child.key) === child)
          remove(child);
    };
    let last = null;
    for (let [i2, node2] of opts2.items.entries()) {
      var _node_level, _node_key, _node_type, _node_value, _node_textValue, _node_index;
      let rowNode = {
        ...node2,
        level: (_node_level = node2.level) !== null && _node_level !== void 0 ? _node_level : 0,
        key: (_node_key = node2.key) !== null && _node_key !== void 0 ? _node_key : "row-" + i2,
        type: (_node_type = node2.type) !== null && _node_type !== void 0 ? _node_type : "row",
        value: (_node_value = node2.value) !== null && _node_value !== void 0 ? _node_value : null,
        hasChildNodes: true,
        childNodes: [
          ...node2.childNodes
        ],
        rendered: node2.rendered,
        textValue: (_node_textValue = node2.textValue) !== null && _node_textValue !== void 0 ? _node_textValue : "",
        index: (_node_index = node2.index) !== null && _node_index !== void 0 ? _node_index : i2
      };
      if (last) {
        last.nextKey = rowNode.key;
        rowNode.prevKey = last.key;
      } else
        rowNode.prevKey = null;
      this.rows.push(rowNode);
      visit2(rowNode);
      last = rowNode;
    }
    if (last)
      last.nextKey = null;
  }
}
const $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2);
let $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
while ($788781baa30117fa$var$ROW_HEADER_COLUMN_KEY === $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG)
  $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
  if (columnNodes.length === 0)
    return [];
  let columns = [];
  let seen2 = /* @__PURE__ */ new Map();
  for (let column2 of columnNodes) {
    let parentKey = column2.parentKey;
    let col = [
      column2
    ];
    while (parentKey) {
      let parent = keyMap.get(parentKey);
      if (!parent)
        break;
      if (seen2.has(parent)) {
        var _parent;
        var _colSpan;
        (_colSpan = (_parent = parent).colSpan) !== null && _colSpan !== void 0 ? _colSpan : _parent.colSpan = 0;
        parent.colSpan++;
        parent.colspan = parent.colSpan;
        let { column: column3, index: index2 } = seen2.get(parent);
        if (index2 > col.length)
          break;
        for (let i3 = index2; i3 < col.length; i3++)
          column3.splice(i3, 0, null);
        for (let i3 = col.length; i3 < column3.length; i3++)
          if (column3[i3] && seen2.has(column3[i3]))
            seen2.get(column3[i3]).index = i3;
      } else {
        parent.colSpan = 1;
        parent.colspan = 1;
        col.push(parent);
        seen2.set(parent, {
          column: col,
          index: col.length - 1
        });
      }
      parentKey = parent.parentKey;
    }
    columns.push(col);
    column2.index = columns.length - 1;
  }
  let maxLength = Math.max(...columns.map((c2) => c2.length));
  let headerRows = Array(maxLength).fill(0).map(() => []);
  let colIndex = 0;
  for (let column2 of columns) {
    let i3 = maxLength - 1;
    for (let item of column2) {
      if (item) {
        let row = headerRows[i3];
        let rowLength = row.reduce((p2, c2) => {
          var _c_colSpan;
          return p2 + ((_c_colSpan = c2.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
        }, 0);
        if (rowLength < colIndex) {
          let placeholder = {
            type: "placeholder",
            key: "placeholder-" + item.key,
            colspan: colIndex - rowLength,
            colSpan: colIndex - rowLength,
            index: rowLength,
            value: null,
            rendered: null,
            level: i3,
            hasChildNodes: false,
            childNodes: [],
            textValue: ""
          };
          if (row.length > 0) {
            row[row.length - 1].nextKey = placeholder.key;
            placeholder.prevKey = row[row.length - 1].key;
          }
          row.push(placeholder);
        }
        if (row.length > 0) {
          row[row.length - 1].nextKey = item.key;
          item.prevKey = row[row.length - 1].key;
        }
        item.level = i3;
        item.colIndex = colIndex;
        row.push(item);
      }
      i3--;
    }
    colIndex++;
  }
  let i2 = 0;
  for (let row of headerRows) {
    let rowLength = row.reduce((p2, c2) => {
      var _c_colSpan;
      return p2 + ((_c_colSpan = c2.colSpan) !== null && _c_colSpan !== void 0 ? _c_colSpan : 1);
    }, 0);
    if (rowLength < columnNodes.length) {
      let placeholder = {
        type: "placeholder",
        key: "placeholder-" + row[row.length - 1].key,
        colSpan: columnNodes.length - rowLength,
        colspan: columnNodes.length - rowLength,
        index: rowLength,
        value: null,
        rendered: null,
        level: i2,
        hasChildNodes: false,
        childNodes: [],
        textValue: "",
        prevKey: row[row.length - 1].key
      };
      row.push(placeholder);
    }
    i2++;
  }
  return headerRows.map((childNodes, index2) => {
    let row = {
      type: "headerrow",
      key: "headerrow-" + index2,
      index: index2,
      value: null,
      rendered: null,
      level: 0,
      hasChildNodes: true,
      childNodes,
      textValue: ""
    };
    return row;
  });
}
class $788781baa30117fa$export$596e1b2e2cf93690 extends $16805b1b18093c5f$export$de3fdf6493c353d {
  *[Symbol.iterator]() {
    yield* this.body.childNodes;
  }
  get size() {
    return this._size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return (_node_prevKey = node2 === null || node2 === void 0 ? void 0 : node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return (_node_nextKey = node2 === null || node2 === void 0 ? void 0 : node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null;
  }
  getFirstKey() {
    var _getFirstItem;
    var _getFirstItem_key;
    return (_getFirstItem_key = (_getFirstItem = $c5a24bc478652b5f$export$fbdeaa6a76694f71(this.body.childNodes)) === null || _getFirstItem === void 0 ? void 0 : _getFirstItem.key) !== null && _getFirstItem_key !== void 0 ? _getFirstItem_key : null;
  }
  getLastKey() {
    var _getLastItem;
    var _getLastItem_key;
    return (_getLastItem_key = (_getLastItem = $c5a24bc478652b5f$export$7475b2c64539e4cf(this.body.childNodes)) === null || _getLastItem === void 0 ? void 0 : _getLastItem.key) !== null && _getLastItem_key !== void 0 ? _getLastItem_key : null;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    if (key === this.body.key)
      return this.body.childNodes;
    return super.getChildren(key);
  }
  getTextValue(key) {
    let row = this.getItem(key);
    if (!row)
      return "";
    if (row.textValue)
      return row.textValue;
    let rowHeaderColumnKeys = this.rowHeaderColumnKeys;
    if (rowHeaderColumnKeys) {
      let text2 = [];
      for (let cell of row.childNodes) {
        let column2 = this.columns[cell.index];
        if (rowHeaderColumnKeys.has(column2.key) && cell.textValue)
          text2.push(cell.textValue);
        if (text2.length === rowHeaderColumnKeys.size)
          break;
      }
      return text2.join(" ");
    }
    return "";
  }
  constructor(nodes, prev2, opts2) {
    let rowHeaderColumnKeys = /* @__PURE__ */ new Set();
    let body = null;
    let columns = [];
    if (opts2 === null || opts2 === void 0 ? void 0 : opts2.showSelectionCheckboxes) {
      let rowHeaderColumn = {
        type: "column",
        key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY,
        value: null,
        textValue: "",
        level: 0,
        index: (opts2 === null || opts2 === void 0 ? void 0 : opts2.showDragButtons) ? 1 : 0,
        hasChildNodes: false,
        rendered: null,
        childNodes: [],
        props: {
          isSelectionCell: true
        }
      };
      columns.unshift(rowHeaderColumn);
    }
    if (opts2 === null || opts2 === void 0 ? void 0 : opts2.showDragButtons) {
      let rowHeaderColumn = {
        type: "column",
        key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG,
        value: null,
        textValue: "",
        level: 0,
        index: 0,
        hasChildNodes: false,
        rendered: null,
        childNodes: [],
        props: {
          isDragButtonCell: true
        }
      };
      columns.unshift(rowHeaderColumn);
    }
    let rows = [];
    let columnKeyMap = /* @__PURE__ */ new Map();
    let visit2 = (node2) => {
      switch (node2.type) {
        case "body":
          body = node2;
          break;
        case "column":
          columnKeyMap.set(node2.key, node2);
          if (!node2.hasChildNodes) {
            columns.push(node2);
            if (node2.props.isRowHeader)
              rowHeaderColumnKeys.add(node2.key);
          }
          break;
        case "item":
          rows.push(node2);
          return;
      }
      for (let child of node2.childNodes)
        visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let headerRows = $788781baa30117fa$export$7c127db850d4e81e(columnKeyMap, columns);
    headerRows.forEach((row, i2) => rows.splice(i2, 0, row));
    super({
      columnCount: columns.length,
      items: rows,
      visitNode: (node2) => {
        node2.column = columns[node2.index];
        return node2;
      }
    }), this._size = 0;
    this.columns = columns;
    this.rowHeaderColumnKeys = rowHeaderColumnKeys;
    this.body = body;
    this.headerRows = headerRows;
    this._size = [
      ...body.childNodes
    ].length;
    if (this.rowHeaderColumnKeys.size === 0) {
      let col = this.columns.find((column2) => {
        var _column_props, _column_props1;
        return !((_column_props = column2.props) === null || _column_props === void 0 ? void 0 : _column_props.isDragButtonCell) && !((_column_props1 = column2.props) === null || _column_props1 === void 0 ? void 0 : _column_props1.isSelectionCell);
      });
      if (col)
        this.rowHeaderColumnKeys.add(col.key);
    }
  }
}
const $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION = {
  ascending: "descending",
  descending: "ascending"
};
function $4a0dd036d492cee4$export$907bcc6c48325fd6(props) {
  let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = reactExports.useState(false);
  let { selectionMode = "none", showSelectionCheckboxes, showDragButtons } = props;
  let context = reactExports.useMemo(() => ({
    showSelectionCheckboxes: showSelectionCheckboxes && selectionMode !== "none",
    showDragButtons,
    selectionMode,
    columns: []
  }), [
    props.children,
    showSelectionCheckboxes,
    selectionMode,
    showDragButtons
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, reactExports.useCallback((nodes) => new $788781baa30117fa$export$596e1b2e2cf93690(nodes, null, context), [
    context
  ]), context);
  let { disabledKeys, selectionManager } = $62967d126f3aa823$export$4007ac09ff9c68ed({
    ...props,
    collection,
    disabledBehavior: props.disabledBehavior || "selection"
  });
  var _props_sortDescriptor;
  return {
    collection,
    disabledKeys,
    selectionManager,
    showSelectionCheckboxes: props.showSelectionCheckboxes || false,
    sortDescriptor: (_props_sortDescriptor = props.sortDescriptor) !== null && _props_sortDescriptor !== void 0 ? _props_sortDescriptor : null,
    isKeyboardNavigationDisabled: collection.size === 0 || isKeyboardNavigationDisabled,
    setKeyboardNavigationDisabled,
    sort(columnKey, direction) {
      var _props_sortDescriptor2, _props_onSortChange;
      (_props_onSortChange = props.onSortChange) === null || _props_onSortChange === void 0 ? void 0 : _props_onSortChange.call(props, {
        column: columnKey,
        direction: direction !== null && direction !== void 0 ? direction : ((_props_sortDescriptor2 = props.sortDescriptor) === null || _props_sortDescriptor2 === void 0 ? void 0 : _props_sortDescriptor2.column) === columnKey ? $4a0dd036d492cee4$var$OPPOSITE_SORT_DIRECTION[props.sortDescriptor.direction] : "ascending"
      });
    }
  };
}
function $312ae3b56a94a86e$var$TableHeader(props) {
  return null;
}
$312ae3b56a94a86e$var$TableHeader.getCollectionNode = function* getCollectionNode2(props, context) {
  let { children, columns } = props;
  context.columns = [];
  if (typeof children === "function") {
    if (!columns)
      throw new Error("props.children was a function but props.columns is missing");
    for (let column2 of columns)
      yield {
        type: "column",
        value: column2,
        renderer: children
      };
  } else {
    let columns2 = [];
    React$6.Children.forEach(children, (column2) => {
      columns2.push({
        type: "column",
        element: column2
      });
    });
    yield* columns2;
  }
};
let $312ae3b56a94a86e$export$f850895b287ef28e = $312ae3b56a94a86e$var$TableHeader;
function $4ae5314bf50db1a3$var$TableBody(props) {
  return null;
}
$4ae5314bf50db1a3$var$TableBody.getCollectionNode = function* getCollectionNode3(props) {
  let { children, items } = props;
  yield {
    type: "body",
    hasChildNodes: true,
    props,
    *childNodes() {
      if (typeof children === "function") {
        if (!items)
          throw new Error("props.children was a function but props.items is missing");
        for (let item of items)
          yield {
            type: "item",
            value: item,
            renderer: children
          };
      } else {
        let items2 = [];
        React$6.Children.forEach(children, (item) => {
          items2.push({
            type: "item",
            element: item
          });
        });
        yield* items2;
      }
    }
  };
};
let $4ae5314bf50db1a3$export$76ccd210b9029917 = $4ae5314bf50db1a3$var$TableBody;
function $1cd244557c2f97d5$var$Column(props) {
  return null;
}
$1cd244557c2f97d5$var$Column.getCollectionNode = function* getCollectionNode4(props, context) {
  let { title, children, childColumns } = props;
  let rendered = title || children;
  let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"];
  let fullNodes = yield {
    type: "column",
    hasChildNodes: !!childColumns || !!title && React$6.Children.count(children) > 0,
    rendered,
    textValue,
    props,
    *childNodes() {
      if (childColumns)
        for (let child of childColumns)
          yield {
            type: "column",
            value: child
          };
      else if (title) {
        let childColumns2 = [];
        React$6.Children.forEach(children, (child) => {
          childColumns2.push({
            type: "column",
            element: child
          });
        });
        yield* childColumns2;
      }
    },
    shouldInvalidate(newContext) {
      updateContext(newContext);
      return false;
    }
  };
  let updateContext = (context2) => {
    for (let node2 of fullNodes)
      if (!node2.hasChildNodes)
        context2.columns.push(node2);
  };
  updateContext(context);
};
let $1cd244557c2f97d5$export$816b5d811295e6bc = $1cd244557c2f97d5$var$Column;
function $70d70eb16ea48428$var$Row(props) {
  return null;
}
$70d70eb16ea48428$var$Row.getCollectionNode = function* getCollectionNode5(props, context) {
  let { children, textValue, UNSTABLE_childItems } = props;
  yield {
    type: "item",
    props,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: true,
    *childNodes() {
      if (context.showDragButtons)
        yield {
          type: "cell",
          key: "header-drag",
          props: {
            isDragButtonCell: true
          }
        };
      if (context.showSelectionCheckboxes && context.selectionMode !== "none")
        yield {
          type: "cell",
          key: "header",
          props: {
            isSelectionCell: true
          }
        };
      if (typeof children === "function") {
        for (let column2 of context.columns)
          yield {
            type: "cell",
            element: children(column2.key),
            key: column2.key
            // this is combined with the row key by CollectionBuilder
          };
        if (UNSTABLE_childItems)
          for (let child of UNSTABLE_childItems)
            yield {
              type: "item",
              value: child
            };
      } else {
        let cells = [];
        let childRows = [];
        let columnCount = 0;
        React$6.Children.forEach(children, (node2) => {
          if (node2.type === $70d70eb16ea48428$var$Row) {
            if (cells.length < context.columns.length)
              throw new Error("All of a Row's child Cells must be positioned before any child Rows.");
            childRows.push({
              type: "item",
              element: node2
            });
          } else {
            cells.push({
              type: "cell",
              element: node2
            });
            var _node_props_colSpan;
            columnCount += (_node_props_colSpan = node2.props.colSpan) !== null && _node_props_colSpan !== void 0 ? _node_props_colSpan : 1;
          }
        });
        if (columnCount !== context.columns.length)
          throw new Error(`Cell count must match column count. Found ${columnCount} cells and ${context.columns.length} columns.`);
        yield* cells;
        yield* childRows;
      }
    },
    shouldInvalidate(newContext) {
      return newContext.columns.length !== context.columns.length || newContext.columns.some((c2, i2) => c2.key !== context.columns[i2].key) || newContext.showSelectionCheckboxes !== context.showSelectionCheckboxes || newContext.showDragButtons !== context.showDragButtons || newContext.selectionMode !== context.selectionMode;
    }
  };
};
let $70d70eb16ea48428$export$b59bdbef9ce70de2 = $70d70eb16ea48428$var$Row;
function $941d1d9a6a28982a$var$Cell(props) {
  return null;
}
$941d1d9a6a28982a$var$Cell.getCollectionNode = function* getCollectionNode6(props) {
  let { children } = props;
  let textValue = props.textValue || (typeof children === "string" ? children : "") || props["aria-label"] || "";
  yield {
    type: "cell",
    props,
    rendered: children,
    textValue,
    "aria-label": props["aria-label"],
    hasChildNodes: false
  };
};
let $941d1d9a6a28982a$export$f6f0c3fe4ec306ea = $941d1d9a6a28982a$var$Cell;
function useTable(originalProps) {
  var _a2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, table$1.variantKeys);
  const {
    ref,
    as: as2,
    baseRef,
    children,
    className,
    classNames: classNames2,
    removeWrapper = false,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    isKeyboardNavigationDisabled = false,
    selectionMode = "none",
    topContentPlacement = "inside",
    bottomContentPlacement = "inside",
    selectionBehavior = selectionMode === "none" ? null : "toggle",
    disabledBehavior = "selection",
    showSelectionCheckboxes = selectionMode === "multiple" && selectionBehavior !== "replace",
    BaseComponent = "div",
    checkboxesProps,
    topContent,
    bottomContent,
    sortIcon,
    onRowAction,
    onCellAction,
    ...otherProps
  } = props;
  const Component2 = as2 || "table";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const domBaseRef = useDOMRef(baseRef);
  const state = $4a0dd036d492cee4$export$907bcc6c48325fd6({
    ...originalProps,
    children,
    showSelectionCheckboxes
  });
  if (isKeyboardNavigationDisabled && !state.isKeyboardNavigationDisabled) {
    state.setKeyboardNavigationDisabled(true);
  }
  const { collection } = state;
  const { layout: layout2, ...otherOriginalProps } = originalProps;
  const { gridProps } = $6e31608fbba75bab$export$25bceaac3c7e4dc7({ ...otherOriginalProps }, state, domRef);
  const isSelectable = selectionMode !== "none";
  const isMultiSelectable = selectionMode === "multiple";
  const slots = reactExports.useMemo(
    () => table$1({
      ...variantProps2,
      isSelectable,
      isMultiSelectable
    }),
    [objectToDeps(variantProps2), isSelectable, isMultiSelectable]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const values = reactExports.useMemo(
    () => {
      var _a22;
      return {
        state,
        slots,
        isSelectable,
        collection,
        classNames: classNames2,
        color: originalProps == null ? void 0 : originalProps.color,
        disableAnimation,
        checkboxesProps,
        isHeaderSticky: (_a22 = originalProps == null ? void 0 : originalProps.isHeaderSticky) != null ? _a22 : false,
        selectionMode,
        selectionBehavior,
        disabledBehavior,
        showSelectionCheckboxes,
        onRowAction,
        onCellAction
      };
    },
    [
      slots,
      state,
      collection,
      isSelectable,
      classNames2,
      selectionMode,
      selectionBehavior,
      checkboxesProps,
      disabledBehavior,
      disableAnimation,
      showSelectionCheckboxes,
      originalProps == null ? void 0 : originalProps.color,
      originalProps == null ? void 0 : originalProps.isHeaderSticky,
      onRowAction,
      onCellAction
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2) => ({
      ...props2,
      ref: domBaseRef,
      className: slots.base({ class: clsx$5(baseStyles, props2 == null ? void 0 : props2.className) })
    }),
    [baseStyles, slots]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2) => ({
      ...props2,
      ref: domBaseRef,
      className: slots.wrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.wrapper, props2 == null ? void 0 : props2.className) })
    }),
    [classNames2 == null ? void 0 : classNames2.wrapper, slots]
  );
  const getTableProps = reactExports.useCallback(
    (props2) => ({
      ...mergeProps$3(
        gridProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      ),
      // avoid typeahead debounce wait for input / textarea
      // so that typing with space won't be blocked
      onKeyDownCapture: void 0,
      ref: domRef,
      className: slots.table({ class: clsx$5(classNames2 == null ? void 0 : classNames2.table, props2 == null ? void 0 : props2.className) })
    }),
    [classNames2 == null ? void 0 : classNames2.table, shouldFilterDOMProps, slots, gridProps, otherProps]
  );
  return {
    BaseComponent,
    Component: Component2,
    children,
    state,
    collection,
    values,
    topContent,
    bottomContent,
    removeWrapper,
    topContentPlacement,
    bottomContentPlacement,
    sortIcon,
    getBaseProps,
    getWrapperProps,
    getTableProps
  };
}
var TableCell$1 = forwardRef((props, ref) => {
  var _a2, _b2, _c2;
  const { as: as2, className, node: node2, rowKey, slots, state, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "td";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { gridCellProps } = $7713593715703b24$export$49571c903d73624c({ node: node2 }, state, domRef);
  const tdStyles = clsx$5(classNames2 == null ? void 0 : classNames2.td, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isRowSelected = state.selectionManager.isSelected(rowKey);
  const cell = reactExports.useMemo(() => {
    const cellType = typeof node2.rendered;
    return cellType !== "object" && cellType !== "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: node2.rendered }) : node2.rendered;
  }, [node2.rendered]);
  const columnProps = ((_b2 = node2.column) == null ? void 0 : _b2.props) || {};
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-selected": dataAttr(isRowSelected),
      ...mergeProps$3(
        gridCellProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_c2 = slots.td) == null ? void 0 : _c2.call(slots, { align: columnProps.align, class: tdStyles }),
      children: cell
    }
  );
});
TableCell$1.displayName = "HeroUI.TableCell";
var table_cell_default$1 = TableCell$1;
var TableCheckboxCell = forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    as: as2,
    className,
    node: node2,
    rowKey,
    slots,
    state,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "td";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { gridCellProps } = $7713593715703b24$export$49571c903d73624c({ node: node2 }, state, domRef);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { checkboxProps } = $2a795c53a101c542$export$16ea7f650bd7c1bb({ key: (node2 == null ? void 0 : node2.parentKey) || node2.key }, state);
  const tdStyles = clsx$5(classNames2 == null ? void 0 : classNames2.td, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const isSingleSelectionMode = selectionMode === "single";
  const { onChange, ...otherCheckboxProps } = checkboxProps;
  const isRowSelected = state.selectionManager.isSelected(rowKey);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-selected": dataAttr(isRowSelected),
      ...mergeProps$3(
        gridCellProps,
        focusProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.td) == null ? void 0 : _b2.call(slots, { class: tdStyles }),
      children: isSingleSelectionMode ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: checkboxProps["aria-label"] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          color: color2,
          disableAnimation,
          onValueChange: onChange,
          ...mergeProps$3(checkboxesProps, otherCheckboxProps)
        }
      )
    }
  );
});
TableCheckboxCell.displayName = "HeroUI.TableCheckboxCell";
var table_checkbox_cell_default = TableCheckboxCell;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = false;
let $6179b936705e76d3$var$hoverCount$7 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$7() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$7(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$7();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$7() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$7);
  $6179b936705e76d3$var$hoverCount$7++;
  return () => {
    $6179b936705e76d3$var$hoverCount$7--;
    if ($6179b936705e76d3$var$hoverCount$7 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$7);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$7(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$7, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$7 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var TableRow$1 = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, className, children, node: node2, slots, state, isSelectable, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || ((props == null ? void 0 : props.href) ? "a" : "tr");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowProps } = $b2db214c022798eb$export$7f2f6ae19e707aa5({ node: node2 }, state, domRef);
  const trStyles = clsx$5(classNames2 == null ? void 0 : classNames2.tr, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const isDisabled = state.disabledKeys.has(node2.key);
  const isSelected = state.selectionManager.isSelected(node2.key);
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$7({ isDisabled });
  const { isFirst, isLast, isMiddle, isOdd } = reactExports.useMemo(() => {
    const isFirst2 = node2.key === state.collection.getFirstKey();
    const isLast2 = node2.key === state.collection.getLastKey();
    const isMiddle2 = !isFirst2 && !isLast2;
    const isOdd2 = (node2 == null ? void 0 : node2.index) ? (node2.index + 1) % 2 === 0 : false;
    return {
      isFirst: isFirst2,
      isLast: isLast2,
      isMiddle: isMiddle2,
      isOdd: isOdd2
    };
  }, [node2, state.collection]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-disabled": dataAttr(isDisabled),
      "data-first": dataAttr(isFirst),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-last": dataAttr(isLast),
      "data-middle": dataAttr(isMiddle),
      "data-odd": dataAttr(isOdd),
      "data-selected": dataAttr(isSelected),
      ...mergeProps$3(
        rowProps,
        focusProps,
        isSelectable ? hoverProps : {},
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.tr) == null ? void 0 : _b2.call(slots, { class: trStyles }),
      children
    }
  );
});
TableRow$1.displayName = "HeroUI.TableRow";
var table_row_default$1 = TableRow$1;
var VirtualizedTableBody = forwardRef((props, ref) => {
  var _a2;
  const {
    as: as2,
    className,
    slots,
    state,
    collection,
    isSelectable,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    rowVirtualizer,
    ...otherProps
  } = props;
  const Component2 = as2 || "tbody";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const tbodyStyles = clsx$5(classNames2 == null ? void 0 : classNames2.tbody, className);
  const bodyProps = collection == null ? void 0 : collection.body.props;
  const isLoading = (bodyProps == null ? void 0 : bodyProps.isLoading) || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loading" || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loadingMore";
  const items = [...collection.body.childNodes];
  const virtualItems = rowVirtualizer.getVirtualItems();
  let emptyContent;
  let loadingContent;
  if (collection.size === 0 && bodyProps.emptyContent) {
    emptyContent = /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { role: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "td",
      {
        className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }),
        colSpan: collection.columnCount,
        role: "gridcell",
        children: !isLoading && bodyProps.emptyContent
      }
    ) });
  }
  if (isLoading && bodyProps.loadingContent) {
    loadingContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { role: "row", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "td",
        {
          className: slots == null ? void 0 : slots.loadingWrapper({ class: classNames2 == null ? void 0 : classNames2.loadingWrapper }),
          colSpan: collection.columnCount,
          role: "gridcell",
          children: bodyProps.loadingContent
        }
      ),
      !emptyContent && collection.size === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }) }) : null
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowGroupProps,
        filterDOMProps(bodyProps, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_a2 = slots.tbody) == null ? void 0 : _a2.call(slots, { class: tbodyStyles }),
      "data-empty": dataAttr(collection.size === 0),
      "data-loading": dataAttr(isLoading),
      children: [
        virtualItems.map((virtualRow, index2) => {
          const row = items[virtualRow.index];
          if (!row) {
            return null;
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_row_default$1,
            {
              classNames: classNames2,
              isSelectable,
              node: row,
              slots,
              state,
              style: {
                transform: `translateY(${virtualRow.start - index2 * virtualRow.size}px)`,
                height: `${virtualRow.size}px`
              },
              children: [...row.childNodes].map(
                (cell) => cell.props.isSelectionCell ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                  table_checkbox_cell_default,
                  {
                    checkboxesProps,
                    classNames: classNames2,
                    color: color2,
                    disableAnimation,
                    node: cell,
                    rowKey: row.key,
                    selectionMode,
                    slots,
                    state
                  },
                  String(cell.key)
                ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                  table_cell_default$1,
                  {
                    classNames: classNames2,
                    node: cell,
                    rowKey: row.key,
                    slots,
                    state
                  },
                  String(cell.key)
                )
              )
            },
            String(row.key)
          );
        }),
        loadingContent,
        emptyContent
      ]
    }
  );
});
VirtualizedTableBody.displayName = "HeroUI.VirtualizedTableBody";
var virtualized_table_body_default = VirtualizedTableBody;
var TableColumnHeader = forwardRef((props, ref) => {
  var _a2, _b2, _c2, _d, _e;
  const { as: as2, className, state, node: node2, slots, classNames: classNames2, sortIcon, ...otherProps } = props;
  const Component2 = as2 || "th";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { columnHeaderProps } = $f329116d8ad0aba0$export$9514819a8c81e960({ node: node2 }, state, domRef);
  const thStyles = clsx$5(classNames2 == null ? void 0 : classNames2.th, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$7({});
  const { hideHeader, align, ...columnProps } = node2.props;
  const allowsSorting = columnProps.allowsSorting;
  const sortIconProps = {
    "aria-hidden": true,
    "data-direction": (_b2 = state.sortDescriptor) == null ? void 0 : _b2.direction,
    "data-visible": dataAttr(((_c2 = state.sortDescriptor) == null ? void 0 : _c2.column) === node2.key),
    className: (_d = slots.sortIcon) == null ? void 0 : _d.call(slots, { class: classNames2 == null ? void 0 : classNames2.sortIcon })
  };
  const customSortIcon = typeof sortIcon === "function" ? sortIcon(sortIconProps) : reactExports.isValidElement(sortIcon) && reactExports.cloneElement(sortIcon, sortIconProps);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      colSpan: node2.colspan,
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-sortable": dataAttr(allowsSorting),
      ...mergeProps$3(
        columnHeaderProps,
        focusProps,
        filterDOMProps(columnProps, {
          enabled: shouldFilterDOMProps
        }),
        allowsSorting ? hoverProps : {},
        otherProps
      ),
      className: (_e = slots.th) == null ? void 0 : _e.call(slots, { align, class: thStyles }),
      children: [
        hideHeader ? /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: node2.rendered }) : node2.rendered,
        allowsSorting && (customSortIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, { strokeWidth: 3, ...sortIconProps }))
      ]
    }
  );
});
TableColumnHeader.displayName = "HeroUI.TableColumnHeader";
var table_column_header_default = TableColumnHeader;
var TableHeaderRow = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, className, children, node: node2, slots, classNames: classNames2, state, ...otherProps } = props;
  const Component2 = as2 || "tr";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowProps } = $f917ee10f4c32dab$export$1b95a7d2d517b841({ node: node2 }, state);
  const trStyles = clsx$5(classNames2 == null ? void 0 : classNames2.tr, className, (_a2 = node2.props) == null ? void 0 : _a2.className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowProps,
        filterDOMProps(node2.props, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_b2 = slots.tr) == null ? void 0 : _b2.call(slots, { class: trStyles }),
      children
    }
  );
});
TableHeaderRow.displayName = "HeroUI.TableHeaderRow";
var table_header_row_default = TableHeaderRow;
var TableRowGroup = reactExports.forwardRef((props, ref) => {
  var _a2;
  const { as: as2, className, children, slots, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "thead";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const theadStyles = clsx$5(classNames2 == null ? void 0 : classNames2.thead, className);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      className: (_a2 = slots.thead) == null ? void 0 : _a2.call(slots, { class: theadStyles }),
      ...mergeProps$3(rowGroupProps, otherProps),
      children
    }
  );
});
TableRowGroup.displayName = "HeroUI.TableRowGroup";
var table_row_group_default = TableRowGroup;
var spacing = {
  px: "1px",
  0: "0px",
  0.5: "0.125rem",
  1: "0.25rem",
  1.5: "0.375rem",
  2: "0.5rem",
  2.5: "0.625rem",
  3: "0.75rem",
  3.5: "0.875rem",
  4: "1rem",
  5: "1.25rem",
  6: "1.5rem",
  7: "1.75rem",
  8: "2rem",
  9: "2.25rem",
  10: "2.5rem",
  11: "2.75rem",
  12: "3rem",
  14: "3.5rem",
  16: "4rem",
  20: "5rem",
  24: "6rem",
  28: "7rem",
  32: "8rem",
  36: "9rem",
  40: "10rem",
  44: "11rem",
  48: "12rem",
  52: "13rem",
  56: "14rem",
  60: "15rem",
  64: "16rem",
  72: "18rem",
  80: "20rem",
  96: "24rem"
};
var getMargin = (value2) => {
  var _a2;
  return (_a2 = spacing[value2]) != null ? _a2 : value2;
};
function useSpacer(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, spacer.variantKeys);
  const { as: as2, className, x: x2 = 1, y: y2 = 1, ...otherProps } = props;
  const Component2 = as2 || "span";
  const styles2 = reactExports.useMemo(
    () => spacer({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const marginLeft = getMargin(x2);
  const marginTop = getMargin(y2);
  const getSpacerProps = (props2 = {}) => ({
    ...props2,
    ...otherProps,
    "aria-hidden": dataAttr(true),
    className: clsx$5(styles2, props2.className),
    style: {
      ...props2.style,
      ...otherProps.style,
      marginLeft,
      marginTop
    }
  });
  return { Component: Component2, getSpacerProps };
}
var Spacer = forwardRef((props, ref) => {
  const { Component: Component2, getSpacerProps } = useSpacer({ ...props });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ref, ...getSpacerProps() });
});
Spacer.displayName = "HeroUI.Spacer";
var spacer_default = Spacer;
function memo(getDeps, fn, opts2) {
  let deps = opts2.initialDeps ?? [];
  let result;
  return () => {
    var _a2, _b2, _c2, _d;
    let depTime;
    if (opts2.key && ((_a2 = opts2.debug) == null ? void 0 : _a2.call(opts2)))
      depTime = Date.now();
    const newDeps = getDeps();
    const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index2) => deps[index2] !== dep);
    if (!depsChanged) {
      return result;
    }
    deps = newDeps;
    let resultTime;
    if (opts2.key && ((_b2 = opts2.debug) == null ? void 0 : _b2.call(opts2)))
      resultTime = Date.now();
    result = fn(...newDeps);
    if (opts2.key && ((_c2 = opts2.debug) == null ? void 0 : _c2.call(opts2))) {
      const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
      const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
      const resultFpsPercentage = resultEndTime / 16;
      const pad = (str, num) => {
        str = String(str);
        while (str.length < num) {
          str = " " + str;
        }
        return str;
      };
      console.info(
        `%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
        `
            font-size: .6rem;
            font-weight: bold;
            color: hsl(${Math.max(
          0,
          Math.min(120 - 120 * resultFpsPercentage, 120)
        )}deg 100% 31%);`,
        opts2 == null ? void 0 : opts2.key
      );
    }
    (_d = opts2 == null ? void 0 : opts2.onChange) == null ? void 0 : _d.call(opts2, result);
    return result;
  };
}
function notUndefined(value2, msg) {
  if (value2 === void 0) {
    throw new Error(`Unexpected undefined${""}`);
  } else {
    return value2;
  }
}
const approxEqual = (a2, b2) => Math.abs(a2 - b2) < 1;
const debounce$4 = (targetWindow, fn, ms) => {
  let timeoutId;
  return function(...args) {
    targetWindow.clearTimeout(timeoutId);
    timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
  };
};
const defaultKeyExtractor = (index2) => index2;
const defaultRangeExtractor = (range3) => {
  const start = Math.max(range3.startIndex - range3.overscan, 0);
  const end = Math.min(range3.endIndex + range3.overscan, range3.count - 1);
  const arr = [];
  for (let i2 = start; i2 <= end; i2++) {
    arr.push(i2);
  }
  return arr;
};
const observeElementRect = (instance2, cb2) => {
  const element2 = instance2.scrollElement;
  if (!element2) {
    return;
  }
  const targetWindow = instance2.targetWindow;
  if (!targetWindow) {
    return;
  }
  const handler = (rect) => {
    const { width, height } = rect;
    cb2({ width: Math.round(width), height: Math.round(height) });
  };
  handler(element2.getBoundingClientRect());
  if (!targetWindow.ResizeObserver) {
    return () => {
    };
  }
  const observer = new targetWindow.ResizeObserver((entries) => {
    const entry = entries[0];
    if (entry == null ? void 0 : entry.borderBoxSize) {
      const box = entry.borderBoxSize[0];
      if (box) {
        handler({ width: box.inlineSize, height: box.blockSize });
        return;
      }
    }
    handler(element2.getBoundingClientRect());
  });
  observer.observe(element2, { box: "border-box" });
  return () => {
    observer.unobserve(element2);
  };
};
const addEventListenerOptions = {
  passive: true
};
const supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
const observeElementOffset = (instance2, cb2) => {
  const element2 = instance2.scrollElement;
  if (!element2) {
    return;
  }
  const targetWindow = instance2.targetWindow;
  if (!targetWindow) {
    return;
  }
  let offset2 = 0;
  const fallback2 = instance2.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce$4(
    targetWindow,
    () => {
      cb2(offset2, false);
    },
    instance2.options.isScrollingResetDelay
  );
  const createHandler = (isScrolling) => () => {
    const { horizontal, isRtl } = instance2.options;
    offset2 = horizontal ? element2["scrollLeft"] * (isRtl && -1 || 1) : element2["scrollTop"];
    fallback2();
    cb2(offset2, isScrolling);
  };
  const handler = createHandler(true);
  const endHandler = createHandler(false);
  endHandler();
  element2.addEventListener("scroll", handler, addEventListenerOptions);
  element2.addEventListener("scrollend", endHandler, addEventListenerOptions);
  return () => {
    element2.removeEventListener("scroll", handler);
    element2.removeEventListener("scrollend", endHandler);
  };
};
const measureElement = (element2, entry, instance2) => {
  if (entry == null ? void 0 : entry.borderBoxSize) {
    const box = entry.borderBoxSize[0];
    if (box) {
      const size2 = Math.round(
        box[instance2.options.horizontal ? "inlineSize" : "blockSize"]
      );
      return size2;
    }
  }
  return Math.round(
    element2.getBoundingClientRect()[instance2.options.horizontal ? "width" : "height"]
  );
};
const elementScroll = (offset2, {
  adjustments = 0,
  behavior
}, instance2) => {
  var _a2, _b2;
  const toOffset = offset2 + adjustments;
  (_b2 = (_a2 = instance2.scrollElement) == null ? void 0 : _a2.scrollTo) == null ? void 0 : _b2.call(_a2, {
    [instance2.options.horizontal ? "left" : "top"]: toOffset,
    behavior
  });
};
class Virtualizer {
  constructor(opts2) {
    this.unsubs = [];
    this.scrollElement = null;
    this.targetWindow = null;
    this.isScrolling = false;
    this.scrollToIndexTimeoutId = null;
    this.measurementsCache = [];
    this.itemSizeCache = /* @__PURE__ */ new Map();
    this.pendingMeasuredCacheIndexes = [];
    this.scrollRect = null;
    this.scrollOffset = null;
    this.scrollDirection = null;
    this.scrollAdjustments = 0;
    this.elementsCache = /* @__PURE__ */ new Map();
    this.observer = /* @__PURE__ */ (() => {
      let _ro = null;
      const get5 = () => {
        if (_ro) {
          return _ro;
        }
        if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
          return null;
        }
        return _ro = new this.targetWindow.ResizeObserver((entries) => {
          entries.forEach((entry) => {
            this._measureElement(entry.target, entry);
          });
        });
      };
      return {
        disconnect: () => {
          var _a2;
          (_a2 = get5()) == null ? void 0 : _a2.disconnect();
          _ro = null;
        },
        observe: (target) => {
          var _a2;
          return (_a2 = get5()) == null ? void 0 : _a2.observe(target, { box: "border-box" });
        },
        unobserve: (target) => {
          var _a2;
          return (_a2 = get5()) == null ? void 0 : _a2.unobserve(target);
        }
      };
    })();
    this.range = null;
    this.setOptions = (opts22) => {
      Object.entries(opts22).forEach(([key, value2]) => {
        if (typeof value2 === "undefined")
          delete opts22[key];
      });
      this.options = {
        debug: false,
        initialOffset: 0,
        overscan: 1,
        paddingStart: 0,
        paddingEnd: 0,
        scrollPaddingStart: 0,
        scrollPaddingEnd: 0,
        horizontal: false,
        getItemKey: defaultKeyExtractor,
        rangeExtractor: defaultRangeExtractor,
        onChange: () => {
        },
        measureElement,
        initialRect: { width: 0, height: 0 },
        scrollMargin: 0,
        gap: 0,
        indexAttribute: "data-index",
        initialMeasurementsCache: [],
        lanes: 1,
        isScrollingResetDelay: 150,
        enabled: true,
        isRtl: false,
        useScrollendEvent: true,
        ...opts22
      };
    };
    this.notify = (sync) => {
      var _a2, _b2;
      (_b2 = (_a2 = this.options).onChange) == null ? void 0 : _b2.call(_a2, this, sync);
    };
    this.maybeNotify = memo(
      () => {
        this.calculateRange();
        return [
          this.isScrolling,
          this.range ? this.range.startIndex : null,
          this.range ? this.range.endIndex : null
        ];
      },
      (isScrolling) => {
        this.notify(isScrolling);
      },
      {
        key: false,
        debug: () => this.options.debug,
        initialDeps: [
          this.isScrolling,
          this.range ? this.range.startIndex : null,
          this.range ? this.range.endIndex : null
        ]
      }
    );
    this.cleanup = () => {
      this.unsubs.filter(Boolean).forEach((d2) => d2());
      this.unsubs = [];
      this.observer.disconnect();
      this.scrollElement = null;
      this.targetWindow = null;
    };
    this._didMount = () => {
      return () => {
        this.cleanup();
      };
    };
    this._willUpdate = () => {
      var _a2;
      const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
      if (this.scrollElement !== scrollElement) {
        this.cleanup();
        if (!scrollElement) {
          this.maybeNotify();
          return;
        }
        this.scrollElement = scrollElement;
        if (this.scrollElement && "ownerDocument" in this.scrollElement) {
          this.targetWindow = this.scrollElement.ownerDocument.defaultView;
        } else {
          this.targetWindow = ((_a2 = this.scrollElement) == null ? void 0 : _a2.window) ?? null;
        }
        this.elementsCache.forEach((cached) => {
          this.observer.observe(cached);
        });
        this._scrollToOffset(this.getScrollOffset(), {
          adjustments: void 0,
          behavior: void 0
        });
        this.unsubs.push(
          this.options.observeElementRect(this, (rect) => {
            this.scrollRect = rect;
            this.maybeNotify();
          })
        );
        this.unsubs.push(
          this.options.observeElementOffset(this, (offset2, isScrolling) => {
            this.scrollAdjustments = 0;
            this.scrollDirection = isScrolling ? this.getScrollOffset() < offset2 ? "forward" : "backward" : null;
            this.scrollOffset = offset2;
            this.isScrolling = isScrolling;
            this.maybeNotify();
          })
        );
      }
    };
    this.getSize = () => {
      if (!this.options.enabled) {
        this.scrollRect = null;
        return 0;
      }
      this.scrollRect = this.scrollRect ?? this.options.initialRect;
      return this.scrollRect[this.options.horizontal ? "width" : "height"];
    };
    this.getScrollOffset = () => {
      if (!this.options.enabled) {
        this.scrollOffset = null;
        return 0;
      }
      this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
      return this.scrollOffset;
    };
    this.getFurthestMeasurement = (measurements, index2) => {
      const furthestMeasurementsFound = /* @__PURE__ */ new Map();
      const furthestMeasurements = /* @__PURE__ */ new Map();
      for (let m2 = index2 - 1; m2 >= 0; m2--) {
        const measurement = measurements[m2];
        if (furthestMeasurementsFound.has(measurement.lane)) {
          continue;
        }
        const previousFurthestMeasurement = furthestMeasurements.get(
          measurement.lane
        );
        if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
          furthestMeasurements.set(measurement.lane, measurement);
        } else if (measurement.end < previousFurthestMeasurement.end) {
          furthestMeasurementsFound.set(measurement.lane, true);
        }
        if (furthestMeasurementsFound.size === this.options.lanes) {
          break;
        }
      }
      return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a2, b2) => {
        if (a2.end === b2.end) {
          return a2.index - b2.index;
        }
        return a2.end - b2.end;
      })[0] : void 0;
    };
    this.getMeasurementOptions = memo(
      () => [
        this.options.count,
        this.options.paddingStart,
        this.options.scrollMargin,
        this.options.getItemKey,
        this.options.enabled
      ],
      (count, paddingStart, scrollMargin, getItemKey, enabled) => {
        this.pendingMeasuredCacheIndexes = [];
        return {
          count,
          paddingStart,
          scrollMargin,
          getItemKey,
          enabled
        };
      },
      {
        key: false
      }
    );
    this.getMeasurements = memo(
      () => [this.getMeasurementOptions(), this.itemSizeCache],
      ({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
        if (!enabled) {
          this.measurementsCache = [];
          this.itemSizeCache.clear();
          return [];
        }
        if (this.measurementsCache.length === 0) {
          this.measurementsCache = this.options.initialMeasurementsCache;
          this.measurementsCache.forEach((item) => {
            this.itemSizeCache.set(item.key, item.size);
          });
        }
        const min2 = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
        this.pendingMeasuredCacheIndexes = [];
        const measurements = this.measurementsCache.slice(0, min2);
        for (let i2 = min2; i2 < count; i2++) {
          const key = getItemKey(i2);
          const furthestMeasurement = this.options.lanes === 1 ? measurements[i2 - 1] : this.getFurthestMeasurement(measurements, i2);
          const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
          const measuredSize = itemSizeCache.get(key);
          const size2 = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i2);
          const end = start + size2;
          const lane = furthestMeasurement ? furthestMeasurement.lane : i2 % this.options.lanes;
          measurements[i2] = {
            index: i2,
            start,
            size: size2,
            end,
            key,
            lane
          };
        }
        this.measurementsCache = measurements;
        return measurements;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.calculateRange = memo(
      () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
      (measurements, outerSize, scrollOffset) => {
        return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
          measurements,
          outerSize,
          scrollOffset
        }) : null;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.getIndexes = memo(
      () => {
        let startIndex = null;
        let endIndex = null;
        const range3 = this.calculateRange();
        if (range3) {
          startIndex = range3.startIndex;
          endIndex = range3.endIndex;
        }
        return [
          this.options.rangeExtractor,
          this.options.overscan,
          this.options.count,
          startIndex,
          endIndex
        ];
      },
      (rangeExtractor, overscan, count, startIndex, endIndex) => {
        return startIndex === null || endIndex === null ? [] : rangeExtractor({
          startIndex,
          endIndex,
          overscan,
          count
        });
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.indexFromElement = (node2) => {
      const attributeName = this.options.indexAttribute;
      const indexStr = node2.getAttribute(attributeName);
      if (!indexStr) {
        console.warn(
          `Missing attribute name '${attributeName}={index}' on measured element.`
        );
        return -1;
      }
      return parseInt(indexStr, 10);
    };
    this._measureElement = (node2, entry) => {
      const index2 = this.indexFromElement(node2);
      const item = this.measurementsCache[index2];
      if (!item) {
        return;
      }
      const key = item.key;
      const prevNode = this.elementsCache.get(key);
      if (prevNode !== node2) {
        if (prevNode) {
          this.observer.unobserve(prevNode);
        }
        this.observer.observe(node2);
        this.elementsCache.set(key, node2);
      }
      if (node2.isConnected) {
        this.resizeItem(index2, this.options.measureElement(node2, entry, this));
      }
    };
    this.resizeItem = (index2, size2) => {
      const item = this.measurementsCache[index2];
      if (!item) {
        return;
      }
      const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
      const delta = size2 - itemSize;
      if (delta !== 0) {
        if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
          this._scrollToOffset(this.getScrollOffset(), {
            adjustments: this.scrollAdjustments += delta,
            behavior: void 0
          });
        }
        this.pendingMeasuredCacheIndexes.push(item.index);
        this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size2));
        this.notify(false);
      }
    };
    this.measureElement = (node2) => {
      if (!node2) {
        this.elementsCache.forEach((cached, key) => {
          if (!cached.isConnected) {
            this.observer.unobserve(cached);
            this.elementsCache.delete(key);
          }
        });
        return;
      }
      this._measureElement(node2, void 0);
    };
    this.getVirtualItems = memo(
      () => [this.getIndexes(), this.getMeasurements()],
      (indexes, measurements) => {
        const virtualItems = [];
        for (let k2 = 0, len = indexes.length; k2 < len; k2++) {
          const i2 = indexes[k2];
          const measurement = measurements[i2];
          virtualItems.push(measurement);
        }
        return virtualItems;
      },
      {
        key: false,
        debug: () => this.options.debug
      }
    );
    this.getVirtualItemForOffset = (offset2) => {
      const measurements = this.getMeasurements();
      if (measurements.length === 0) {
        return void 0;
      }
      return notUndefined(
        measurements[findNearestBinarySearch(
          0,
          measurements.length - 1,
          (index2) => notUndefined(measurements[index2]).start,
          offset2
        )]
      );
    };
    this.getOffsetForAlignment = (toOffset, align) => {
      const size2 = this.getSize();
      const scrollOffset = this.getScrollOffset();
      if (align === "auto") {
        if (toOffset >= scrollOffset + size2) {
          align = "end";
        }
      }
      if (align === "end") {
        toOffset -= size2;
      }
      const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
      const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
      const maxOffset = scrollSize - size2;
      return Math.max(Math.min(maxOffset, toOffset), 0);
    };
    this.getOffsetForIndex = (index2, align = "auto") => {
      index2 = Math.max(0, Math.min(index2, this.options.count - 1));
      const item = this.measurementsCache[index2];
      if (!item) {
        return void 0;
      }
      const size2 = this.getSize();
      const scrollOffset = this.getScrollOffset();
      if (align === "auto") {
        if (item.end >= scrollOffset + size2 - this.options.scrollPaddingEnd) {
          align = "end";
        } else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
          align = "start";
        } else {
          return [scrollOffset, align];
        }
      }
      const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size2) / 2;
      switch (align) {
        case "center":
          return [this.getOffsetForAlignment(centerOffset, align), align];
        case "end":
          return [
            this.getOffsetForAlignment(
              item.end + this.options.scrollPaddingEnd,
              align
            ),
            align
          ];
        default:
          return [
            this.getOffsetForAlignment(
              item.start - this.options.scrollPaddingStart,
              align
            ),
            align
          ];
      }
    };
    this.isDynamicMode = () => this.elementsCache.size > 0;
    this.cancelScrollToIndex = () => {
      if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
        this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
        this.scrollToIndexTimeoutId = null;
      }
    };
    this.scrollToOffset = (toOffset, { align = "start", behavior } = {}) => {
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      this._scrollToOffset(this.getOffsetForAlignment(toOffset, align), {
        adjustments: void 0,
        behavior
      });
    };
    this.scrollToIndex = (index2, { align: initialAlign = "auto", behavior } = {}) => {
      index2 = Math.max(0, Math.min(index2, this.options.count - 1));
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      const offsetAndAlign = this.getOffsetForIndex(index2, initialAlign);
      if (!offsetAndAlign)
        return;
      const [offset2, align] = offsetAndAlign;
      this._scrollToOffset(offset2, { adjustments: void 0, behavior });
      if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
        this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
          this.scrollToIndexTimeoutId = null;
          const elementInDOM = this.elementsCache.has(
            this.options.getItemKey(index2)
          );
          if (elementInDOM) {
            const [latestOffset] = notUndefined(
              this.getOffsetForIndex(index2, align)
            );
            if (!approxEqual(latestOffset, this.getScrollOffset())) {
              this.scrollToIndex(index2, { align, behavior });
            }
          } else {
            this.scrollToIndex(index2, { align, behavior });
          }
        });
      }
    };
    this.scrollBy = (delta, { behavior } = {}) => {
      this.cancelScrollToIndex();
      if (behavior === "smooth" && this.isDynamicMode()) {
        console.warn(
          "The `smooth` scroll behavior is not fully supported with dynamic size."
        );
      }
      this._scrollToOffset(this.getScrollOffset() + delta, {
        adjustments: void 0,
        behavior
      });
    };
    this.getTotalSize = () => {
      var _a2;
      const measurements = this.getMeasurements();
      let end;
      if (measurements.length === 0) {
        end = this.options.paddingStart;
      } else {
        end = this.options.lanes === 1 ? ((_a2 = measurements[measurements.length - 1]) == null ? void 0 : _a2.end) ?? 0 : Math.max(
          ...measurements.slice(-this.options.lanes).map((m2) => m2.end)
        );
      }
      return Math.max(
        end - this.options.scrollMargin + this.options.paddingEnd,
        0
      );
    };
    this._scrollToOffset = (offset2, {
      adjustments,
      behavior
    }) => {
      this.options.scrollToFn(offset2, { behavior, adjustments }, this);
    };
    this.measure = () => {
      this.itemSizeCache = /* @__PURE__ */ new Map();
      this.notify(false);
    };
    this.setOptions(opts2);
  }
}
const findNearestBinarySearch = (low, high, getCurrentValue, value2) => {
  while (low <= high) {
    const middle = (low + high) / 2 | 0;
    const currentValue = getCurrentValue(middle);
    if (currentValue < value2) {
      low = middle + 1;
    } else if (currentValue > value2) {
      high = middle - 1;
    } else {
      return middle;
    }
  }
  if (low > 0) {
    return low - 1;
  } else {
    return 0;
  }
};
function calculateRange({
  measurements,
  outerSize,
  scrollOffset
}) {
  const count = measurements.length - 1;
  const getOffset2 = (index2) => measurements[index2].start;
  const startIndex = findNearestBinarySearch(0, count, getOffset2, scrollOffset);
  let endIndex = startIndex;
  while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
    endIndex++;
  }
  return { startIndex, endIndex };
}
const useIsomorphicLayoutEffect$3 = typeof document !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
function useVirtualizerBase(options) {
  const rerender = reactExports.useReducer(() => ({}), {})[1];
  const resolvedOptions = {
    ...options,
    onChange: (instance22, sync) => {
      var _a2;
      if (sync) {
        reactDomExports.flushSync(rerender);
      } else {
        rerender();
      }
      (_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance22, sync);
    }
  };
  const [instance2] = reactExports.useState(
    () => new Virtualizer(resolvedOptions)
  );
  instance2.setOptions(resolvedOptions);
  useIsomorphicLayoutEffect$3(() => {
    return instance2._didMount();
  }, []);
  useIsomorphicLayoutEffect$3(() => {
    return instance2._willUpdate();
  });
  return instance2;
}
function useVirtualizer(options) {
  return useVirtualizerBase({
    observeElementRect,
    observeElementOffset,
    scrollToFn: elementScroll,
    ...options
  });
}
var VirtualizedTable = forwardRef((props, ref) => {
  const {
    BaseComponent,
    Component: Component2,
    collection,
    values,
    topContent,
    topContentPlacement,
    bottomContentPlacement,
    bottomContent,
    getBaseProps,
    getWrapperProps,
    getTableProps
  } = useTable({
    ...props,
    ref
  });
  const { rowHeight = 40, maxTableHeight = 600 } = props;
  const Wrapper = reactExports.useCallback(
    ({ children }) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        BaseComponent,
        {
          ...getWrapperProps(),
          ref: parentRef,
          style: { height: maxTableHeight, display: "block" },
          children
        }
      );
    },
    [getWrapperProps, maxTableHeight]
  );
  const items = [...collection.body.childNodes];
  const count = items.length;
  const parentRef = reactExports.useRef(null);
  const [headerHeight, setHeaderHeight] = reactExports.useState(0);
  const headerRef = reactExports.useRef(null);
  reactExports.useLayoutEffect(() => {
    if (headerRef.current) {
      setHeaderHeight(headerRef.current.getBoundingClientRect().height);
    }
  }, [headerRef]);
  const rowVirtualizer = useVirtualizer({
    count,
    getScrollElement: () => parentRef.current,
    estimateSize: () => rowHeight,
    overscan: 5
  });
  const tableProps = getTableProps();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContentPlacement === "outside" && topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      topContentPlacement === "inside" && topContent,
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Component2,
        {
          ...tableProps,
          style: {
            height: `calc(${rowVirtualizer.getTotalSize() + headerHeight}px)`,
            ...tableProps.style
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_group_default, { ref: headerRef, classNames: values.classNames, slots: values.slots, children: [
              collection.headerRows.map((headerRow) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                table_header_row_default,
                {
                  classNames: values.classNames,
                  node: headerRow,
                  slots: values.slots,
                  state: values.state,
                  children: [...headerRow.childNodes].map(
                    (column2) => {
                      var _a2;
                      return ((_a2 = column2 == null ? void 0 : column2.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                        table_select_all_checkbox_default,
                        {
                          checkboxesProps: values.checkboxesProps,
                          classNames: values.classNames,
                          color: values.color,
                          disableAnimation: values.disableAnimation,
                          node: column2,
                          selectionMode: values.selectionMode,
                          slots: values.slots,
                          state: values.state
                        },
                        column2 == null ? void 0 : column2.key
                      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                        table_column_header_default,
                        {
                          classNames: values.classNames,
                          node: column2,
                          slots: values.slots,
                          state: values.state
                        },
                        column2 == null ? void 0 : column2.key
                      );
                    }
                  )
                },
                headerRow == null ? void 0 : headerRow.key
              )),
              /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { as: "tr", tabIndex: -1, y: 1 })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              virtualized_table_body_default,
              {
                checkboxesProps: values.checkboxesProps,
                classNames: values.classNames,
                collection: values.collection,
                color: values.color,
                disableAnimation: values.disableAnimation,
                isSelectable: values.isSelectable,
                rowVirtualizer,
                selectionMode: values.selectionMode,
                slots: values.slots,
                state: values.state
              }
            )
          ]
        }
      ),
      bottomContentPlacement === "inside" && bottomContent
    ] }) }),
    bottomContentPlacement === "outside" && bottomContent
  ] });
});
VirtualizedTable.displayName = "HeroUI.VirtualizedTable";
var virtualized_table_default = VirtualizedTable;
var TableBody$1 = forwardRef((props, ref) => {
  var _a2;
  const {
    as: as2,
    className,
    slots,
    state,
    collection,
    isSelectable,
    color: color2,
    disableAnimation,
    checkboxesProps,
    selectionMode,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "tbody";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { rowGroupProps } = $0047e6c294ea075f$export$6fb1613bd7b28198();
  const tbodyStyles = clsx$5(classNames2 == null ? void 0 : classNames2.tbody, className);
  const bodyProps = collection == null ? void 0 : collection.body.props;
  const isLoading = (bodyProps == null ? void 0 : bodyProps.isLoading) || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loading" || (bodyProps == null ? void 0 : bodyProps.loadingState) === "loadingMore";
  const renderRows = reactExports.useMemo(() => {
    return [...collection.body.childNodes].map((row) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      table_row_default$1,
      {
        classNames: classNames2,
        isSelectable,
        node: row,
        slots,
        state,
        children: [...row.childNodes].map(
          (cell) => cell.props.isSelectionCell ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_checkbox_cell_default,
            {
              checkboxesProps,
              classNames: classNames2,
              color: color2,
              disableAnimation,
              node: cell,
              rowKey: row.key,
              selectionMode,
              slots,
              state
            },
            cell.key
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_cell_default$1,
            {
              classNames: classNames2,
              node: cell,
              rowKey: row.key,
              slots,
              state
            },
            cell.key
          )
        )
      },
      row.key
    ));
  }, [collection.body.childNodes, classNames2, isSelectable, slots, state]);
  let emptyContent;
  let loadingContent;
  if (collection.size === 0 && bodyProps.emptyContent) {
    emptyContent = /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { role: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "td",
      {
        className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }),
        colSpan: collection.columnCount,
        role: "gridcell",
        children: !isLoading && bodyProps.emptyContent
      }
    ) });
  }
  if (isLoading && bodyProps.loadingContent) {
    loadingContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { role: "row", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "td",
        {
          className: slots == null ? void 0 : slots.loadingWrapper({ class: classNames2 == null ? void 0 : classNames2.loadingWrapper }),
          colSpan: collection.columnCount,
          role: "gridcell",
          children: bodyProps.loadingContent
        }
      ),
      !emptyContent && collection.size === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.emptyWrapper({ class: classNames2 == null ? void 0 : classNames2.emptyWrapper }) }) : null
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: domRef,
      ...mergeProps$3(
        rowGroupProps,
        filterDOMProps(bodyProps, {
          enabled: shouldFilterDOMProps
        }),
        otherProps
      ),
      className: (_a2 = slots.tbody) == null ? void 0 : _a2.call(slots, { class: tbodyStyles }),
      "data-empty": dataAttr(collection.size === 0),
      "data-loading": dataAttr(isLoading),
      children: [
        renderRows,
        loadingContent,
        emptyContent
      ]
    }
  );
});
TableBody$1.displayName = "HeroUI.TableBody";
var table_body_default$1 = TableBody$1;
var Table$1 = forwardRef((props, ref) => {
  const {
    BaseComponent,
    Component: Component2,
    collection,
    values,
    topContent,
    topContentPlacement,
    bottomContentPlacement,
    bottomContent,
    removeWrapper,
    sortIcon,
    getBaseProps,
    getWrapperProps,
    getTableProps
  } = useTable({
    ...props,
    ref
  });
  const { isVirtualized, rowHeight = 40, maxTableHeight = 600 } = props;
  const shouldVirtualize = isVirtualized;
  const Wrapper = reactExports.useCallback(
    ({ children }) => {
      if (removeWrapper) {
        return children;
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BaseComponent, { ...getWrapperProps(), children });
    },
    [removeWrapper, getWrapperProps]
  );
  if (shouldVirtualize) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      virtualized_table_default,
      {
        ...props,
        ref,
        maxTableHeight,
        rowHeight
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContentPlacement === "outside" && topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      topContentPlacement === "inside" && topContent,
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getTableProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_group_default, { classNames: values.classNames, slots: values.slots, children: [
          collection.headerRows.map((headerRow) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_header_row_default,
            {
              classNames: values.classNames,
              node: headerRow,
              slots: values.slots,
              state: values.state,
              children: [...headerRow.childNodes].map(
                (column2) => {
                  var _a2;
                  return ((_a2 = column2 == null ? void 0 : column2.props) == null ? void 0 : _a2.isSelectionCell) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                    table_select_all_checkbox_default,
                    {
                      checkboxesProps: values.checkboxesProps,
                      classNames: values.classNames,
                      color: values.color,
                      disableAnimation: values.disableAnimation,
                      node: column2,
                      selectionMode: values.selectionMode,
                      slots: values.slots,
                      state: values.state
                    },
                    column2 == null ? void 0 : column2.key
                  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                    table_column_header_default,
                    {
                      classNames: values.classNames,
                      node: column2,
                      slots: values.slots,
                      sortIcon,
                      state: values.state
                    },
                    column2 == null ? void 0 : column2.key
                  );
                }
              )
            },
            headerRow == null ? void 0 : headerRow.key
          )),
          /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, { as: "tr", tabIndex: -1, y: 1 })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          table_body_default$1,
          {
            checkboxesProps: values.checkboxesProps,
            classNames: values.classNames,
            collection: values.collection,
            color: values.color,
            disableAnimation: values.disableAnimation,
            isSelectable: values.isSelectable,
            selectionMode: values.selectionMode,
            slots: values.slots,
            state: values.state
          }
        )
      ] }),
      bottomContentPlacement === "inside" && bottomContent
    ] }) }),
    bottomContentPlacement === "outside" && bottomContent
  ] });
});
Table$1.displayName = "HeroUI.Table";
var table_default = Table$1;
var TableColumn = $1cd244557c2f97d5$export$816b5d811295e6bc;
var table_column_default = TableColumn;
var TableHeader = $312ae3b56a94a86e$export$f850895b287ef28e;
var table_header_default = TableHeader;
var TableRow = $70d70eb16ea48428$export$b59bdbef9ce70de2;
var table_row_default = TableRow;
var TableBody = $4ae5314bf50db1a3$export$76ccd210b9029917;
var table_body_default = TableBody;
var TableCell = $941d1d9a6a28982a$export$f6f0c3fe4ec306ea;
var table_cell_default = TableCell;
function useKbd(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, kbd.variantKeys);
  const { as: as2, children, className, keys: keys2, title, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "kbd";
  const slots = reactExports.useMemo(
    () => kbd({
      ...variantProps2
    }),
    [objectToDeps(variantProps2)]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const keysToRender = typeof keys2 === "string" ? [keys2] : Array.isArray(keys2) ? keys2 : [];
  const getKbdProps = (props2 = {}) => ({
    ...otherProps,
    ...props2,
    className: clsx$5(slots.base({ class: clsx$5(baseStyles, props2.className) }))
  });
  return { Component: Component2, slots, classNames: classNames2, title, children, keysToRender, getKbdProps };
}
var kbdKeysMap = {
  command: "⌘",
  shift: "⇧",
  ctrl: "⌃",
  option: "⌥",
  enter: "↵",
  delete: "⌫",
  escape: "⎋",
  tab: "⇥",
  capslock: "⇪",
  up: "↑",
  right: "→",
  down: "↓",
  left: "←",
  pageup: "⇞",
  pagedown: "⇟",
  home: "↖",
  end: "↘",
  help: "?",
  space: "␣",
  fn: "Fn",
  win: "⌘",
  alt: "⌥"
};
var kbdKeysLabelMap = {
  command: "Command",
  shift: "Shift",
  ctrl: "Control",
  option: "Option",
  enter: "Enter",
  delete: "Delete",
  escape: "Escape",
  tab: "Tab",
  capslock: "Caps Lock",
  up: "Up",
  right: "Right",
  down: "Down",
  left: "Left",
  pageup: "Page Up",
  pagedown: "Page Down",
  home: "Home",
  end: "End",
  help: "Help",
  space: "Space",
  fn: "Fn",
  win: "Win",
  alt: "Alt"
};
var Kbd = forwardRef((props, ref) => {
  const { Component: Component2, children, slots, classNames: classNames2, keysToRender, getKbdProps } = useKbd({
    ...props
  });
  const keysContent = reactExports.useMemo(() => {
    return keysToRender.map((key) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "abbr",
      {
        className: slots.abbr({ class: classNames2 == null ? void 0 : classNames2.abbr }),
        title: kbdKeysLabelMap[key],
        children: kbdKeysMap[key]
      },
      key
    ));
  }, [keysToRender]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref, ...getKbdProps(), children: [
    keysContent,
    children && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), children })
  ] });
});
Kbd.displayName = "HeroUI.Kbd";
var kbd_default = Kbd;
const $99b62ae3ff97ec45$export$c5f62239608282b6 = /* @__PURE__ */ new WeakMap();
function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
  if (!state)
    return "";
  if (typeof key === "string")
    key = key.replace(/\s+/g, "");
  let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
  return `${baseId}-${role}-${key}`;
}
function $9bf71ea28793e738$var$isTabbableRadio$1(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope$1(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa$1(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio$1(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope$1(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
let $9bf71ea28793e738$var$Tree$1 = class $9bf71ea28793e738$var$Tree7 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode$1({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope$1(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree7();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode$1({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
};
let $9bf71ea28793e738$var$TreeNode$1 = class $9bf71ea28793e738$var$TreeNode7 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
};
new $9bf71ea28793e738$var$Tree$1();
function $83013635b024ae3d$export$eac1895992b9f3d6(ref, options) {
  let isDisabled = options === null || options === void 0 ? void 0 : options.isDisabled;
  let [hasTabbableChild, setHasTabbableChild] = reactExports.useState(false);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if ((ref === null || ref === void 0 ? void 0 : ref.current) && !isDisabled) {
      let update = () => {
        if (ref.current) {
          let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa$1(ref.current, {
            tabbable: true
          });
          setHasTabbableChild(!!walker.nextNode());
        }
      };
      update();
      let observer = new MutationObserver(update);
      observer.observe(ref.current, {
        subtree: true,
        childList: true,
        attributes: true,
        attributeFilter: [
          "tabIndex",
          "disabled"
        ]
      });
      return () => {
        observer.disconnect();
      };
    }
  });
  return isDisabled ? false : hasTabbableChild;
}
function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
  let { key, isDisabled: propsDisabled, shouldSelectOnPressUp } = props;
  let { selectionManager: manager, selectedKey } = state;
  let isSelected = key === selectedKey;
  let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
  let { itemProps, isPressed } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: manager,
    key,
    ref,
    isDisabled,
    shouldSelectOnPressUp,
    linkBehavior: "selection"
  });
  let tabId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tab");
  let tabPanelId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, "tabpanel");
  let { tabIndex } = itemProps;
  let item = state.collection.getItem(key);
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props, {
    labelable: true
  });
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2({
    isDisabled
  }, ref);
  return {
    tabProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, focusableProps, linkProps, itemProps, {
      id: tabId,
      "aria-selected": isSelected,
      "aria-disabled": isDisabled || void 0,
      "aria-controls": isSelected ? tabPanelId : void 0,
      tabIndex: isDisabled ? void 0 : tabIndex,
      role: "tab"
    }),
    isSelected,
    isDisabled,
    isPressed
  };
}
function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
  let tabIndex = $83013635b024ae3d$export$eac1895992b9f3d6(ref) ? void 0 : 0;
  var _props_id;
  const id2 = $99b62ae3ff97ec45$export$567fc7097e064344(state, (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : state === null || state === void 0 ? void 0 : state.selectedKey, "tabpanel");
  const tabPanelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    ...props,
    id: id2,
    "aria-labelledby": $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, "tab")
  });
  return {
    tabPanelProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(tabPanelProps, {
      tabIndex,
      role: "tabpanel",
      "aria-describedby": props["aria-describedby"],
      "aria-details": props["aria-details"]
    })
  };
}
class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
  getKeyLeftOf(key) {
    if (this.flipDirection)
      return this.getNextKey(key);
    return this.getPreviousKey(key);
  }
  getKeyRightOf(key) {
    if (this.flipDirection)
      return this.getPreviousKey(key);
    return this.getNextKey(key);
  }
  isDisabled(key) {
    var _this_collection_getItem_props, _this_collection_getItem;
    return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    if (key != null && this.isDisabled(key))
      key = this.getNextKey(key);
    return key;
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    if (key != null && this.isDisabled(key))
      key = this.getPreviousKey(key);
    return key;
  }
  getKeyAbove(key) {
    if (this.tabDirection)
      return null;
    return this.getPreviousKey(key);
  }
  getKeyBelow(key) {
    if (this.tabDirection)
      return null;
    return this.getNextKey(key);
  }
  getNextKey(startKey) {
    let key = startKey;
    do {
      key = this.collection.getKeyAfter(key);
      if (key == null)
        key = this.collection.getFirstKey();
    } while (key != null && this.isDisabled(key));
    return key;
  }
  getPreviousKey(startKey) {
    let key = startKey;
    do {
      key = this.collection.getKeyBefore(key);
      if (key == null)
        key = this.collection.getLastKey();
    } while (key != null && this.isDisabled(key));
    return key;
  }
  constructor(collection, direction, orientation, disabledKeys = /* @__PURE__ */ new Set()) {
    this.collection = collection;
    this.flipDirection = direction === "rtl" && orientation === "horizontal";
    this.disabledKeys = disabledKeys;
    this.tabDirection = orientation === "horizontal";
  }
}
function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
  let { orientation = "horizontal", keyboardActivation = "automatic" } = props;
  let { collection, selectionManager: manager, disabledKeys } = state;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let delegate = reactExports.useMemo(() => new $bfc6f2d60b8a4c40$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys), [
    collection,
    disabledKeys,
    orientation,
    direction
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    ref,
    selectionManager: manager,
    keyboardDelegate: delegate,
    selectOnFocus: keyboardActivation === "automatic",
    disallowEmptySelection: true,
    scrollRef: ref,
    linkBehavior: "selection"
  });
  let tabsId = $bdb11010cef70236$export$f680877a34711e37$2();
  $99b62ae3ff97ec45$export$c5f62239608282b6.set(state, tabsId);
  let tabListLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    ...props,
    id: tabsId
  });
  return {
    tabListProps: {
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(collectionProps, tabListLabelProps),
      role: "tablist",
      "aria-orientation": orientation,
      tabIndex: void 0
    }
  };
}
var TabPanel = forwardRef((props, ref) => {
  var _a2, _b2;
  const { as: as2, tabKey, destroyInactiveTabPanel, state, className, slots, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { tabPanelProps } = $34bce698202e07cb$export$fae0121b5afe572d({ ...props, id: String(tabKey) }, state, domRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const selectedItem = state.selectedItem;
  const content2 = state.collection.getItem(tabKey).props.children;
  const tabPanelStyles = clsx$5(classNames2 == null ? void 0 : classNames2.panel, className, (_a2 = selectedItem == null ? void 0 : selectedItem.props) == null ? void 0 : _a2.className);
  const isSelected = tabKey === (selectedItem == null ? void 0 : selectedItem.key);
  if (!content2 || !isSelected && destroyInactiveTabPanel) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Component2,
    {
      ref: domRef,
      "data-focus": isFocused,
      "data-focus-visible": isFocusVisible,
      "data-inert": !isSelected ? "true" : void 0,
      inert: getInertValue(!isSelected),
      ...isSelected && mergeProps$3(tabPanelProps, focusProps, otherProps),
      className: (_b2 = slots.panel) == null ? void 0 : _b2.call(slots, { class: tabPanelStyles }),
      "data-slot": "panel",
      children: content2
    }
  );
});
TabPanel.displayName = "HeroUI.TabPanel";
var tab_panel_default = TabPanel;
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = false;
let $6179b936705e76d3$var$hoverCount$6 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$6() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$6(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$6();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$6() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$6);
  $6179b936705e76d3$var$hoverCount$6++;
  return () => {
    $6179b936705e76d3$var$hoverCount$6--;
    if ($6179b936705e76d3$var$hoverCount$6 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$6);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$6(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$6, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$6 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var Tab$1 = forwardRef((props, ref) => {
  var _a2;
  const {
    className,
    as: as2,
    item,
    state,
    classNames: classNames2,
    isDisabled: isDisabledProp,
    listRef,
    slots,
    motionProps,
    disableAnimation,
    disableCursorAnimation,
    shouldSelectOnPressUp,
    onClick,
    tabRef,
    ...otherProps
  } = props;
  const { key } = item;
  const domRef = useDOMRef(ref);
  const Component2 = as2 || (props.href ? "a" : "button");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const {
    tabProps,
    isSelected,
    isDisabled: isDisabledItem,
    isPressed
  } = $0175d55c2a017ebc$export$fdf4756d5b8ef90a({ key, isDisabled: isDisabledProp, shouldSelectOnPressUp }, state, domRef);
  if (props.children == null) {
    delete tabProps["aria-controls"];
  }
  const isDisabled = isDisabledProp || isDisabledItem;
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$6({
    isDisabled
  });
  const tabStyles = clsx$5(classNames2 == null ? void 0 : classNames2.tab, className);
  const [, isMounted] = useIsMounted({
    rerender: true
  });
  const handleClick = () => {
    if (!(domRef == null ? void 0 : domRef.current) || !(listRef == null ? void 0 : listRef.current))
      return;
    t$7(domRef.current, {
      scrollMode: "if-needed",
      behavior: "smooth",
      block: "end",
      inline: "end",
      boundary: listRef == null ? void 0 : listRef.current
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ref: mergeRefs(domRef, tabRef),
      "data-disabled": dataAttr(isDisabledItem),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-hover-unselected": dataAttr((isHovered || isPressed) && !isSelected),
      "data-pressed": dataAttr(isPressed),
      "data-selected": dataAttr(isSelected),
      "data-slot": "tab",
      ...mergeProps$3(
        tabProps,
        !isDisabled ? {
          ...focusProps,
          ...hoverProps
        } : {},
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps,
          omitPropNames: /* @__PURE__ */ new Set(["title"])
        }),
        { onClick: chain(handleClick, onClick, tabProps.onClick) }
      ),
      className: (_a2 = slots.tab) == null ? void 0 : _a2.call(slots, { class: tabStyles }),
      title: otherProps == null ? void 0 : otherProps.titleValue,
      type: Component2 === "button" ? "button" : void 0,
      children: [
        isSelected && !disableAnimation && !disableCursorAnimation && isMounted ? (
          // use synchronous loading for domMax here
          // since lazy loading produces different behaviour
          /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domMax, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            m$3.span,
            {
              className: slots.cursor({ class: classNames2 == null ? void 0 : classNames2.cursor }),
              "data-slot": "cursor",
              layoutDependency: false,
              layoutId: "cursor",
              transition: {
                type: "spring",
                bounce: 0.15,
                duration: 0.5
              },
              ...motionProps
            }
          ) })
        ) : null,
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: slots.tabContent({
              class: classNames2 == null ? void 0 : classNames2.tabContent
            }),
            "data-slot": "tabContent",
            children: item.rendered
          }
        )
      ]
    }
  );
});
Tab$1.displayName = "HeroUI.Tab";
var tab_default = Tab$1;
let $a02d57049d202695$export$d085fb9e920b5ca7$2 = class $a02d57049d202695$export$d085fb9e920b5ca7 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
};
function $e72dd72e1c76a225$export$2f645645f7bca764$2(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca7$2(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca7$2(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset$2(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset$2(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
  var _props_defaultSelectedKey;
  let [selectedKey, setSelectedKey] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.selectedKey, (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : null, props.onSelectionChange);
  let selectedKeys = reactExports.useMemo(() => selectedKey != null ? [
    selectedKey
  ] : [], [
    selectedKey
  ]);
  let { collection, disabledKeys, selectionManager } = $e72dd72e1c76a225$export$2f645645f7bca764$2({
    ...props,
    selectionMode: "single",
    disallowEmptySelection: true,
    allowDuplicateSelectionEvents: true,
    selectedKeys,
    onSelectionChange: (keys2) => {
      if (keys2 === "all")
        return;
      var _keys_values_next_value;
      let key = (_keys_values_next_value = keys2.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
      if (key === selectedKey && props.onSelectionChange)
        props.onSelectionChange(key);
      setSelectedKey(key);
    }
  });
  let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
  return {
    collection,
    disabledKeys,
    selectionManager,
    selectedKey,
    setSelectedKey,
    selectedItem
  };
}
function $76f919a04c5a7d14$export$4ba071daf4e486(props) {
  var _props_defaultSelectedKey, _ref;
  let state = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
    ...props,
    onSelectionChange: props.onSelectionChange ? (key) => {
      var _props_onSelectionChange;
      if (key != null)
        (_props_onSelectionChange = props.onSelectionChange) === null || _props_onSelectionChange === void 0 ? void 0 : _props_onSelectionChange.call(props, key);
    } : void 0,
    suppressTextValueWarning: true,
    defaultSelectedKey: (_ref = (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : $76f919a04c5a7d14$var$findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set())) !== null && _ref !== void 0 ? _ref : void 0
  });
  let { selectionManager, collection, selectedKey: currentSelectedKey } = state;
  let lastSelectedKey = reactExports.useRef(currentSelectedKey);
  reactExports.useEffect(() => {
    let selectedKey = currentSelectedKey;
    if (props.selectedKey == null && (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey))) {
      selectedKey = $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, state.disabledKeys);
      if (selectedKey != null)
        selectionManager.setSelectedKeys([
          selectedKey
        ]);
    }
    if (selectedKey != null && selectionManager.focusedKey == null || !selectionManager.isFocused && selectedKey !== lastSelectedKey.current)
      selectionManager.setFocusedKey(selectedKey);
    lastSelectedKey.current = selectedKey;
  });
  return {
    ...state,
    isDisabled: props.isDisabled || false
  };
}
function $76f919a04c5a7d14$var$findDefaultSelectedKey(collection, disabledKeys) {
  let selectedKey = null;
  if (collection) {
    var _collection_getItem_props, _collection_getItem, _collection_getItem_props1, _collection_getItem1;
    selectedKey = collection.getFirstKey();
    while (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem = collection.getItem(selectedKey)) === null || _collection_getItem === void 0 ? void 0 : (_collection_getItem_props = _collection_getItem.props) === null || _collection_getItem_props === void 0 ? void 0 : _collection_getItem_props.isDisabled)) && selectedKey !== collection.getLastKey())
      selectedKey = collection.getKeyAfter(selectedKey);
    if (selectedKey != null && (disabledKeys.has(selectedKey) || ((_collection_getItem1 = collection.getItem(selectedKey)) === null || _collection_getItem1 === void 0 ? void 0 : (_collection_getItem_props1 = _collection_getItem1.props) === null || _collection_getItem_props1 === void 0 ? void 0 : _collection_getItem_props1.isDisabled)) && selectedKey === collection.getLastKey())
      selectedKey = collection.getFirstKey();
  }
  return selectedKey;
}
function useTabs(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, tabs.variantKeys);
  const {
    ref,
    as: as2,
    className,
    classNames: classNames2,
    children,
    disableCursorAnimation,
    motionProps,
    isVertical = false,
    shouldSelectOnPressUp = true,
    destroyInactiveTabPanel = true,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const state = $76f919a04c5a7d14$export$4ba071daf4e486({
    children,
    ...otherProps
  });
  const { tabListProps } = $58d314389b21fa3f$export$773e389e644c5874(otherProps, state, domRef);
  const slots = reactExports.useMemo(
    () => tabs({
      ...variantProps2,
      disableAnimation,
      ...isVertical ? { placement: "start" } : {}
    }),
    [objectToDeps(variantProps2), disableAnimation, isVertical]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const values = reactExports.useMemo(
    () => ({
      state,
      slots,
      classNames: classNames2,
      motionProps,
      disableAnimation,
      listRef: domRef,
      shouldSelectOnPressUp,
      disableCursorAnimation,
      isDisabled: originalProps == null ? void 0 : originalProps.isDisabled
    }),
    [
      state,
      slots,
      domRef,
      motionProps,
      disableAnimation,
      disableCursorAnimation,
      shouldSelectOnPressUp,
      originalProps == null ? void 0 : originalProps.isDisabled,
      classNames2
    ]
  );
  const getBaseProps = reactExports.useCallback(
    (props2) => ({
      "data-slot": "base",
      className: slots.base({ class: clsx$5(baseStyles, props2 == null ? void 0 : props2.className) }),
      ...mergeProps$3(
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        props2
      )
    }),
    [baseStyles, otherProps, slots]
  );
  const placement = (_c2 = variantProps2.placement) != null ? _c2 : isVertical ? "start" : "top";
  const getWrapperProps = reactExports.useCallback(
    (props2) => ({
      "data-slot": "tabWrapper",
      className: slots.tabWrapper({ class: clsx$5(classNames2 == null ? void 0 : classNames2.tabWrapper, props2 == null ? void 0 : props2.className) }),
      "data-placement": placement,
      "data-vertical": isVertical || placement === "start" || placement === "end" ? "vertical" : "horizontal"
    }),
    [classNames2, slots, placement, isVertical]
  );
  const getTabListProps = reactExports.useCallback(
    (props2) => ({
      ref: domRef,
      "data-slot": "tabList",
      className: slots.tabList({ class: clsx$5(classNames2 == null ? void 0 : classNames2.tabList, props2 == null ? void 0 : props2.className) }),
      ...mergeProps$3(tabListProps, props2)
    }),
    [domRef, tabListProps, classNames2, slots]
  );
  return {
    Component: Component2,
    domRef,
    state,
    values,
    destroyInactiveTabPanel,
    getBaseProps,
    getTabListProps,
    getWrapperProps
  };
}
var Tabs$1 = forwardRef(function Tabs2(props, ref) {
  const {
    Component: Component2,
    values,
    state,
    destroyInactiveTabPanel,
    getBaseProps,
    getTabListProps,
    getWrapperProps
  } = useTabs({
    ...props,
    ref
  });
  const layoutId = reactExports.useId();
  const layoutGroupEnabled = !props.disableAnimation && !props.disableCursorAnimation;
  const tabsProps = {
    state,
    listRef: values.listRef,
    slots: values.slots,
    classNames: values.classNames,
    isDisabled: values.isDisabled,
    motionProps: values.motionProps,
    disableAnimation: values.disableAnimation,
    shouldSelectOnPressUp: values.shouldSelectOnPressUp,
    disableCursorAnimation: values.disableCursorAnimation
  };
  const tabs2 = [...state.collection].map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(tab_default, { item, ...tabsProps, ...item.props }, item.key));
  const renderTabs = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getBaseProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getTabListProps(), children: layoutGroupEnabled ? /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutGroup, { id: layoutId, children: tabs2 }) : tabs2 }) }),
    [...state.collection].map((item) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        tab_panel_default,
        {
          classNames: values.classNames,
          destroyInactiveTabPanel,
          slots: values.slots,
          state: values.state,
          tabKey: item.key
        },
        item.key
      );
    })
  ] });
  if ("placement" in props || "isVertical" in props) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getWrapperProps(), children: renderTabs });
  }
  return renderTabs;
});
var tabs_default = Tabs$1;
var TabItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var tab_item_base_default = TabItemBase;
function useDataScrollOverflow$1(props = {}) {
  const {
    domRef,
    isEnabled = true,
    overflowCheck = "vertical",
    visibility = "auto",
    offset: offset2 = 0,
    onVisibilityChange,
    updateDeps = []
  } = props;
  const visibleRef = reactExports.useRef(visibility);
  reactExports.useEffect(() => {
    const el2 = domRef == null ? void 0 : domRef.current;
    if (!el2 || !isEnabled)
      return;
    const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
      if (visibility === "auto") {
        const both = `${prefix}${capitalize$2(suffix)}Scroll`;
        if (hasBefore && hasAfter) {
          el2.dataset[both] = "true";
          el2.removeAttribute(`data-${prefix}-scroll`);
          el2.removeAttribute(`data-${suffix}-scroll`);
        } else {
          el2.dataset[`${prefix}Scroll`] = hasBefore.toString();
          el2.dataset[`${suffix}Scroll`] = hasAfter.toString();
          el2.removeAttribute(`data-${prefix}-${suffix}-scroll`);
        }
      } else {
        const next2 = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
        if (next2 !== visibleRef.current) {
          onVisibilityChange == null ? void 0 : onVisibilityChange(next2);
          visibleRef.current = next2;
        }
      }
    };
    const checkOverflow2 = () => {
      var _a2, _b2;
      const directions2 = [
        { type: "vertical", prefix: "top", suffix: "bottom" },
        { type: "horizontal", prefix: "left", suffix: "right" }
      ];
      const listbox = el2.querySelector('ul[data-slot="list"]');
      const scrollHeight = +((_a2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-height")) != null ? _a2 : el2.scrollHeight);
      const scrollTop = +((_b2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-top")) != null ? _b2 : el2.scrollTop);
      for (const { type: type4, prefix, suffix } of directions2) {
        if (overflowCheck === type4 || overflowCheck === "both") {
          const hasBefore = type4 === "vertical" ? scrollTop > offset2 : el2.scrollLeft > offset2;
          const hasAfter = type4 === "vertical" ? scrollTop + el2.clientHeight + offset2 < scrollHeight : el2.scrollLeft + el2.clientWidth + offset2 < el2.scrollWidth;
          setAttributes(type4, hasBefore, hasAfter, prefix, suffix);
        }
      }
    };
    const clearOverflow = () => {
      ["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
        el2.removeAttribute(`data-${attr}-scroll`);
      });
    };
    checkOverflow2();
    el2.addEventListener("scroll", checkOverflow2, true);
    if (visibility !== "auto") {
      clearOverflow();
      if (visibility === "both") {
        el2.dataset.topBottomScroll = String(overflowCheck === "vertical");
        el2.dataset.leftRightScroll = String(overflowCheck === "horizontal");
      } else {
        el2.dataset.topBottomScroll = "false";
        el2.dataset.leftRightScroll = "false";
        ["top", "bottom", "left", "right"].forEach((attr) => {
          el2.dataset[`${attr}Scroll`] = String(visibility === attr);
        });
      }
    }
    return () => {
      el2.removeEventListener("scroll", checkOverflow2, true);
      clearOverflow();
    };
  }, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
function useScrollShadow$1(originalProps) {
  var _a2;
  const [props, variantProps2] = mapPropsVariants(originalProps, scrollShadow.variantKeys);
  const {
    ref,
    as: as2,
    children,
    className,
    style: style2,
    size: size2 = 40,
    offset: offset2 = 0,
    visibility = "auto",
    isEnabled = true,
    onVisibilityChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  useDataScrollOverflow$1({
    domRef,
    offset: offset2,
    visibility,
    isEnabled,
    onVisibilityChange,
    updateDeps: [children],
    overflowCheck: (_a2 = originalProps.orientation) != null ? _a2 : "vertical"
  });
  const styles2 = reactExports.useMemo(
    () => scrollShadow({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getBaseProps = (props2 = {}) => {
    var _a22;
    return {
      ref: domRef,
      className: styles2,
      "data-orientation": (_a22 = originalProps.orientation) != null ? _a22 : "vertical",
      style: {
        "--scroll-shadow-size": `${size2}px`,
        ...style2,
        ...props2.style
      },
      ...otherProps,
      ...props2
    };
  };
  return { Component: Component2, styles: styles2, domRef, children, getBaseProps };
}
var ScrollShadow = forwardRef((props, ref) => {
  const { Component: Component2, children, getBaseProps } = useScrollShadow$1({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children });
});
ScrollShadow.displayName = "HeroUI.ScrollShadow";
var scroll_shadow_default = ScrollShadow;
function $8a9cb279dc87e130$export$525bc4921d56d4a$4(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$4(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$4(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$4 = "default";
let $14c0b72509d70225$var$savedUserSelect$4 = "";
let $14c0b72509d70225$var$modifiedElementMap$4 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$4(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$4 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$4 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$4 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$4.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$4(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$4 !== "disabled")
      return;
    $14c0b72509d70225$var$state$4 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$4 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$4 || "";
          $14c0b72509d70225$var$savedUserSelect$4 = "";
          $14c0b72509d70225$var$state$4 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$4.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$4.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$4.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$4 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$4.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$4(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$4);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$4 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$4 = class $f6c31cce2adf654f$var$PressEvent8 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$4, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$4 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$4 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$4(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$4(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$4("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$4("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$4(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$4(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$4(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$4(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$4(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$4(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$4(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$4(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$4(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$4]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$4] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$4(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$4(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$4(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$4))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$4;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$4((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$4]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$4(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$4(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$4(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$4(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$4(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$4(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$4(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$4(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$4(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$4(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$4 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$4(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$4.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = false;
let $6179b936705e76d3$var$hoverCount$5 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$5() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$5(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$5();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$5() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$5);
  $6179b936705e76d3$var$hoverCount$5++;
  return () => {
    $6179b936705e76d3$var$hoverCount$5--;
    if ($6179b936705e76d3$var$hoverCount$5 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$5);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$5(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$5, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$5 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
let $a02d57049d202695$export$d085fb9e920b5ca7$1 = class $a02d57049d202695$export$d085fb9e920b5ca72 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
};
function $e72dd72e1c76a225$export$2f645645f7bca764$1(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca7$1(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca7$1(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset$1(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset$1(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function useMultiSelectListState(props) {
  const {
    collection,
    disabledKeys,
    selectionManager,
    selectionManager: { setSelectedKeys, selectedKeys, selectionMode }
  } = $e72dd72e1c76a225$export$2f645645f7bca764$1(props);
  const missingKeys = reactExports.useMemo(() => {
    if (!props.isLoading && selectedKeys.size !== 0) {
      return Array.from(selectedKeys).filter(Boolean).filter((key) => !collection.getItem(key));
    }
    return [];
  }, [selectedKeys, collection]);
  const selectedItems = selectedKeys.size !== 0 ? Array.from(selectedKeys).map((key) => {
    return collection.getItem(key);
  }).filter(Boolean) : null;
  if (missingKeys.length) {
    console.warn(
      `Select: Keys "${missingKeys.join(
        ", "
      )}" passed to "selectedKeys" are not present in the collection.`
    );
  }
  return {
    collection,
    disabledKeys,
    selectionManager,
    selectionMode,
    selectedKeys,
    setSelectedKeys: setSelectedKeys.bind(selectionManager),
    selectedItems
  };
}
function $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props) {
  let overlayTriggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let [expandedKeysStack, setExpandedKeysStack] = reactExports.useState([]);
  let closeAll = () => {
    setExpandedKeysStack([]);
    overlayTriggerState.close();
  };
  let openSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      if (level > oldStack.length)
        return oldStack;
      return [
        ...oldStack.slice(0, level),
        triggerKey
      ];
    });
  };
  let closeSubmenu = (triggerKey, level) => {
    setExpandedKeysStack((oldStack) => {
      let key = oldStack[level];
      if (key === triggerKey)
        return oldStack.slice(0, level);
      else
        return oldStack;
    });
  };
  return {
    focusStrategy,
    ...overlayTriggerState,
    open(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.open();
    },
    toggle(focusStrategy2 = null) {
      setFocusStrategy(focusStrategy2);
      overlayTriggerState.toggle();
    },
    close() {
      closeAll();
    },
    expandedKeysStack,
    openSubmenu,
    closeSubmenu
  };
}
const $e5be200c675c3b3a$export$aca958c65c314e6c = {
  badInput: false,
  customError: false,
  patternMismatch: false,
  rangeOverflow: false,
  rangeUnderflow: false,
  stepMismatch: false,
  tooLong: false,
  tooShort: false,
  typeMismatch: false,
  valueMissing: false,
  valid: true
};
const $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
  ...$e5be200c675c3b3a$export$aca958c65c314e6c,
  customError: true,
  valid: false
};
const $e5be200c675c3b3a$export$dad6ae84456c676a = {
  isInvalid: false,
  validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
  validationErrors: []
};
const $e5be200c675c3b3a$export$571b5131b7e65c11 = reactExports.createContext({});
const $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
  if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
    let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
    return {
      realtimeValidation,
      displayValidation,
      updateValidation,
      resetValidation,
      commitValidation
    };
  }
  return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
}
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
  let { isInvalid, validationState, name: name2, value: value2, builtinValidation, validate: validate2, validationBehavior = "aria" } = props;
  if (validationState)
    isInvalid || (isInvalid = validationState === "invalid");
  let controlledError = isInvalid !== void 0 ? {
    isInvalid,
    validationErrors: [],
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
  } : null;
  let clientError = reactExports.useMemo(() => {
    if (!validate2 || value2 == null)
      return null;
    let validateErrors = $e5be200c675c3b3a$var$runValidate(validate2, value2);
    return $e5be200c675c3b3a$var$getValidationResult(validateErrors);
  }, [
    validate2,
    value2
  ]);
  if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
    builtinValidation = void 0;
  let serverErrors = reactExports.useContext($e5be200c675c3b3a$export$571b5131b7e65c11);
  let serverErrorMessages = reactExports.useMemo(() => {
    if (name2)
      return Array.isArray(name2) ? name2.flatMap((name3) => $e5be200c675c3b3a$var$asArray(serverErrors[name3])) : $e5be200c675c3b3a$var$asArray(serverErrors[name2]);
    return [];
  }, [
    serverErrors,
    name2
  ]);
  let [lastServerErrors, setLastServerErrors] = reactExports.useState(serverErrors);
  let [isServerErrorCleared, setServerErrorCleared] = reactExports.useState(false);
  if (serverErrors !== lastServerErrors) {
    setLastServerErrors(serverErrors);
    setServerErrorCleared(false);
  }
  let serverError = reactExports.useMemo(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
    isServerErrorCleared,
    serverErrorMessages
  ]);
  let nextValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
  let [currentValidity, setCurrentValidity] = reactExports.useState($e5be200c675c3b3a$export$dad6ae84456c676a);
  let lastError = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
  let commitValidation = () => {
    if (!commitQueued)
      return;
    setCommitQueued(false);
    let error2 = clientError || builtinValidation || nextValidation.current;
    if (!$e5be200c675c3b3a$var$isEqualValidation(error2, lastError.current)) {
      lastError.current = error2;
      setCurrentValidity(error2);
    }
  };
  let [commitQueued, setCommitQueued] = reactExports.useState(false);
  reactExports.useEffect(commitValidation);
  let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
  let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
  return {
    realtimeValidation,
    displayValidation,
    updateValidation(value3) {
      if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value3))
        setCurrentValidity(value3);
      else
        nextValidation.current = value3;
    },
    resetValidation() {
      let error2 = $e5be200c675c3b3a$export$dad6ae84456c676a;
      if (!$e5be200c675c3b3a$var$isEqualValidation(error2, lastError.current)) {
        lastError.current = error2;
        setCurrentValidity(error2);
      }
      if (validationBehavior === "native")
        setCommitQueued(false);
      setServerErrorCleared(true);
    },
    commitValidation() {
      if (validationBehavior === "native")
        setCommitQueued(true);
      setServerErrorCleared(true);
    }
  };
}
function $e5be200c675c3b3a$var$asArray(v2) {
  if (!v2)
    return [];
  return Array.isArray(v2) ? v2 : [
    v2
  ];
}
function $e5be200c675c3b3a$var$runValidate(validate2, value2) {
  if (typeof validate2 === "function") {
    let e2 = validate2(value2);
    if (e2 && typeof e2 !== "boolean")
      return $e5be200c675c3b3a$var$asArray(e2);
  }
  return [];
}
function $e5be200c675c3b3a$var$getValidationResult(errors) {
  return errors.length ? {
    isInvalid: true,
    validationErrors: errors,
    validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
  } : null;
}
function $e5be200c675c3b3a$var$isEqualValidation(a2, b2) {
  if (a2 === b2)
    return true;
  return !!a2 && !!b2 && a2.isInvalid === b2.isInvalid && a2.validationErrors.length === b2.validationErrors.length && a2.validationErrors.every((a3, i2) => a3 === b2.validationErrors[i2]) && Object.entries(a2.validationDetails).every(([k2, v2]) => b2.validationDetails[k2] === v2);
}
function useMultiSelectState({
  validate: validate2,
  validationBehavior,
  ...props
}) {
  const [isFocused, setFocused] = reactExports.useState(false);
  const [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  const triggerState = $a28c903ee9ad8dc5$export$79fefeb1c2091ac3(props);
  const listState = useMultiSelectListState({
    ...props,
    onSelectionChange: (keys2) => {
      if (props.onSelectionChange != null) {
        if (keys2 === "all") {
          props.onSelectionChange(new Set(listState.collection.getKeys()));
        } else {
          props.onSelectionChange(keys2);
        }
      }
      if (props.selectionMode === "single") {
        triggerState.close();
      }
    }
  });
  const validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
    ...props,
    validationBehavior,
    validate: (value2) => {
      if (!validate2)
        return;
      const keys2 = Array.from(value2);
      return validate2(props.selectionMode === "single" ? keys2[0] : keys2);
    },
    // @ts-ignore
    value: listState.selectedKeys
  });
  const shouldHideContent = listState.collection.size === 0 && props.hideEmptyContent;
  return {
    ...validationState,
    ...listState,
    ...triggerState,
    focusStrategy,
    close() {
      triggerState.close();
    },
    open(focusStrategy2 = null) {
      if (shouldHideContent)
        return;
      setFocusStrategy(focusStrategy2);
      triggerState.open();
    },
    toggle(focusStrategy2 = null) {
      if (shouldHideContent)
        return;
      setFocusStrategy(focusStrategy2);
      triggerState.toggle();
    },
    isFocused,
    setFocused
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$6 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$6 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$6(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$6.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$6.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$6 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$6 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$6);
const $b5e257d569688ac6$var$IsSSRContext$6 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$6 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$6(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$6);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$6.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$6.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$6.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$6(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$6);
  let counter = $b5e257d569688ac6$var$useCounter$6(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$6(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$6());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$6.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
const $b5e257d569688ac6$export$619500959fc48b26 = typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$6 : $b5e257d569688ac6$var$useLegacySSRSafeId$6;
function $b5e257d569688ac6$var$getSnapshot$6() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$6() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$6(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$6() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$6, $b5e257d569688ac6$var$getSnapshot$6, $b5e257d569688ac6$var$getServerSnapshot$6);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$6);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$6 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$6] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$6(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$6 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6();
let $1e5a04cdaf7d1af8$var$listeners$6 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$6() {
  $1e5a04cdaf7d1af8$var$currentLocale$6 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$6();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$6)
    listener($1e5a04cdaf7d1af8$var$currentLocale$6);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$6() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$6();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$6);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$6.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$6);
    $1e5a04cdaf7d1af8$var$listeners$6.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$6.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$6.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$6);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$6 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$6() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$6();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$6);
  return context || defaultLocale;
}
let $325a3faab7a68acd$var$cache$1 = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d$1(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$6();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache$1.has(cacheKey))
    return $325a3faab7a68acd$var$cache$1.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache$1.set(cacheKey, formatter);
  return formatter;
}
const $431fbd86ca7dc216$export$b204af158042fbac = (el2) => {
  var _el_ownerDocument;
  return (_el_ownerDocument = el2 === null || el2 === void 0 ? void 0 : el2.ownerDocument) !== null && _el_ownerDocument !== void 0 ? _el_ownerDocument : document;
};
const $431fbd86ca7dc216$export$f21a1ffae260145a = (el2) => {
  if (el2 && "window" in el2 && el2.window === el2)
    return el2;
  const doc = $431fbd86ca7dc216$export$b204af158042fbac(el2);
  return doc.defaultView || window;
};
function $c87311424ea30a05$var$testUserAgent(re2) {
  var _window_navigator_userAgentData;
  if (typeof window === "undefined" || window.navigator == null)
    return false;
  let brands = (_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $c87311424ea30a05$var$testPlatform(re2) {
  var _window_navigator_userAgentData;
  return typeof window !== "undefined" && window.navigator != null ? re2.test(((_window_navigator_userAgentData = window.navigator["userAgentData"]) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
}
function $c87311424ea30a05$var$cached(fn) {
  let res = null;
  return () => {
    if (res == null)
      res = fn();
    return res;
  };
}
const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
  return $c87311424ea30a05$var$testPlatform(/^Mac/i);
});
const $c87311424ea30a05$export$a11b0059900ceec8 = $c87311424ea30a05$var$cached(function() {
  return $c87311424ea30a05$var$testUserAgent(/Android/i);
});
function $6a7db85432448f7f$export$60278871457622de(event) {
  if (event.mozInputSource === 0 && event.isTrusted)
    return true;
  if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType)
    return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$2 = false;
let $507fabe10e71c6fb$var$changeHandlers$2 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$2 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$2(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$2)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$2(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$2(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
  if ($507fabe10e71c6fb$var$isValidKey$2(e2)) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$2(e2) {
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$2(e2) {
  if ($6a7db85432448f7f$export$60278871457622de(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$2(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$2 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$2 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$2) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$2("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$2() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$2 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$2.get($431fbd86ca7dc216$export$f21a1ffae260145a(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$2 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$2, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$2, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$2, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$2.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$2.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$2.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$2, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$2, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$2, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$2, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$2, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$2.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$2(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$2(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$2(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$2();
function $507fabe10e71c6fb$export$8397ddfc504fdb9a$1(modality) {
  $507fabe10e71c6fb$var$triggerChangeHandlers$2(modality, null);
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
var $8ae05eaa5c114e9c$var$_React_useInsertionEffect;
const $8ae05eaa5c114e9c$var$useEarlyEffect = ($8ae05eaa5c114e9c$var$_React_useInsertionEffect = React$6["useInsertionEffect"]) !== null && $8ae05eaa5c114e9c$var$_React_useInsertionEffect !== void 0 ? $8ae05eaa5c114e9c$var$_React_useInsertionEffect : $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1;
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
  const ref = reactExports.useRef(null);
  $8ae05eaa5c114e9c$var$useEarlyEffect(() => {
    ref.current = fn;
  }, [
    fn
  ]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 === null || f2 === void 0 ? void 0 : f2(...args);
  }, []);
}
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue2) {
  let [value2, setValue] = reactExports.useState(defaultValue2);
  let effect = reactExports.useRef(null);
  let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
    if (!effect.current)
      return;
    let newValue = effect.current.next();
    if (newValue.done) {
      effect.current = null;
      return;
    }
    if (value2 === newValue.value)
      nextRef();
    else
      setValue(newValue.value);
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(() => {
    if (effect.current)
      nextRef();
  });
  let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52((fn) => {
    effect.current = fn(value2);
    nextRef();
  });
  return [
    value2,
    queue
  ];
}
let $bdb11010cef70236$var$canUseDOM$1 = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$2 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry$1;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry$1 = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$2.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37$1(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry$1)
    $bdb11010cef70236$var$registry$1.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM$1) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$2.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry$1)
        $bdb11010cef70236$var$registry$1.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$2.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$2(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$2.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
  let id2 = $bdb11010cef70236$export$f680877a34711e37$1();
  let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id2);
  let updateId = reactExports.useCallback(() => {
    setResolvedId(function* () {
      yield id2;
      yield document.getElementById(id2) ? id2 : void 0;
    });
  }, [
    id2,
    setResolvedId
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$1(updateId, [
    id2,
    updateId,
    ...depArray
  ]);
  return resolvedId;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$2(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$2(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$2(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$2(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
  let { id: id2, "aria-label": label, "aria-labelledby": labelledBy } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$1(id2);
  if (labelledBy && label) {
    let ids2 = /* @__PURE__ */ new Set([
      id2,
      ...labelledBy.trim().split(/\s+/)
    ]);
    labelledBy = [
      ...ids2
    ].join(" ");
  } else if (labelledBy)
    labelledBy = labelledBy.trim().split(/\s+/).join(" ");
  if (!label && !labelledBy && defaultLabel)
    label = defaultLabel;
  return {
    id: id2,
    "aria-label": label,
    "aria-labelledby": labelledBy
  };
}
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
  let { id: id2, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
  id2 = $bdb11010cef70236$export$f680877a34711e37$1(id2);
  let labelId = $bdb11010cef70236$export$f680877a34711e37$1();
  let labelProps = {};
  if (label) {
    ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
    labelProps = {
      id: labelId,
      htmlFor: labelElementType === "label" ? id2 : void 0
    };
  }
  let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
    id: id2,
    "aria-label": ariaLabel,
    "aria-labelledby": ariaLabelledby
  });
  return {
    labelProps,
    fieldProps
  };
}
function $2baaea4c71418dea$export$294aa081a6c6f55d(props) {
  let { description, errorMessage, isInvalid, validationState } = props;
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f(props);
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8([
    Boolean(description),
    Boolean(errorMessage),
    isInvalid,
    validationState
  ]);
  fieldProps = $3ef42575df84b30b$export$9d1611c77c2fe928$2(fieldProps, {
    "aria-describedby": [
      descriptionId,
      // Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA. See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
      errorMessageId,
      props["aria-describedby"]
    ].filter(Boolean).join(" ") || void 0
  });
  return {
    labelProps,
    fieldProps,
    descriptionProps: {
      id: descriptionId
    },
    errorMessageProps: {
      id: errorMessageId
    }
  };
}
function $cc38e7bd3fc7b213$export$2bb74740c4e19def(node2, checkForOverflow) {
  if (!node2)
    return false;
  let style2 = window.getComputedStyle(node2);
  let isScrollable2 = /(auto|scroll)/.test(style2.overflow + style2.overflowX + style2.overflowY);
  if (isScrollable2 && checkForOverflow)
    isScrollable2 = node2.scrollHeight !== node2.clientHeight || node2.scrollWidth !== node2.clientWidth;
  return isScrollable2;
}
function $feb5ffebff200149$export$c3d8340acf92597f(collectionRef, key) {
  var _collectionRef_current, _collectionRef_current1;
  let selector = `[data-key="${CSS.escape(String(key))}"]`;
  let collection = (_collectionRef_current = collectionRef.current) === null || _collectionRef_current === void 0 ? void 0 : _collectionRef_current.dataset.collection;
  if (collection)
    selector = `[data-collection="${CSS.escape(collection)}"]${selector}`;
  return (_collectionRef_current1 = collectionRef.current) === null || _collectionRef_current1 === void 0 ? void 0 : _collectionRef_current1.querySelector(selector);
}
const $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
  let { keyboardDelegate, selectionManager, onTypeSelect } = options;
  let state = reactExports.useRef({
    search: "",
    timeout: void 0
  }).current;
  let onKeyDown = (e2) => {
    let character2 = $fb3050f43d946246$var$getStringForKey(e2.key);
    if (!character2 || e2.ctrlKey || e2.metaKey || !e2.currentTarget.contains(e2.target))
      return;
    if (character2 === " " && state.search.trim().length > 0) {
      e2.preventDefault();
      if (!("continuePropagation" in e2))
        e2.stopPropagation();
    }
    state.search += character2;
    if (keyboardDelegate.getKeyForSearch != null) {
      let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
      if (key == null)
        key = keyboardDelegate.getKeyForSearch(state.search);
      if (key != null) {
        selectionManager.setFocusedKey(key);
        if (onTypeSelect)
          onTypeSelect(key);
      }
    }
    clearTimeout(state.timeout);
    state.timeout = setTimeout(() => {
      state.search = "";
    }, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
  };
  return {
    typeSelectProps: {
      // Using a capturing listener to catch the keydown event before
      // other hooks in order to handle the Spacebar event.
      onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : void 0
    }
  };
}
function $fb3050f43d946246$var$getStringForKey(key) {
  if (key.length === 1 || !/^[A-Z]/i.test(key))
    return key;
  return "";
}
class $657e4dc4a6e88df0$export$8f5ed9ff9f5113813 {
  getItemRect(key) {
    let container = this.ref.current;
    if (!container)
      return null;
    let item = key != null ? $feb5ffebff200149$export$c3d8340acf92597f(this.ref, key) : null;
    if (!item)
      return null;
    let containerRect = container.getBoundingClientRect();
    let itemRect = item.getBoundingClientRect();
    return {
      x: itemRect.left - containerRect.left + container.scrollLeft,
      y: itemRect.top - containerRect.top + container.scrollTop,
      width: itemRect.width,
      height: itemRect.height
    };
  }
  getContentSize() {
    let container = this.ref.current;
    var _container_scrollWidth, _container_scrollHeight;
    return {
      width: (_container_scrollWidth = container === null || container === void 0 ? void 0 : container.scrollWidth) !== null && _container_scrollWidth !== void 0 ? _container_scrollWidth : 0,
      height: (_container_scrollHeight = container === null || container === void 0 ? void 0 : container.scrollHeight) !== null && _container_scrollHeight !== void 0 ? _container_scrollHeight : 0
    };
  }
  getVisibleRect() {
    let container = this.ref.current;
    var _container_scrollLeft, _container_scrollTop, _container_offsetWidth, _container_offsetHeight;
    return {
      x: (_container_scrollLeft = container === null || container === void 0 ? void 0 : container.scrollLeft) !== null && _container_scrollLeft !== void 0 ? _container_scrollLeft : 0,
      y: (_container_scrollTop = container === null || container === void 0 ? void 0 : container.scrollTop) !== null && _container_scrollTop !== void 0 ? _container_scrollTop : 0,
      width: (_container_offsetWidth = container === null || container === void 0 ? void 0 : container.offsetWidth) !== null && _container_offsetWidth !== void 0 ? _container_offsetWidth : 0,
      height: (_container_offsetHeight = container === null || container === void 0 ? void 0 : container.offsetHeight) !== null && _container_offsetHeight !== void 0 ? _container_offsetHeight : 0
    };
  }
  constructor(ref) {
    this.ref = ref;
  }
}
class $2a25aae57d74318e$export$a05409b8bb224a5a3 {
  isDisabled(item) {
    var _item_props;
    return this.disabledBehavior === "all" && (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.isDisabled) || this.disabledKeys.has(item.key));
  }
  findNextNonDisabled(key, getNext) {
    let nextKey = key;
    while (nextKey != null) {
      let item = this.collection.getItem(nextKey);
      if ((item === null || item === void 0 ? void 0 : item.type) === "item" && !this.isDisabled(item))
        return nextKey;
      nextKey = getNext(nextKey);
    }
    return null;
  }
  getNextKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyAfter(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyAfter(key2));
  }
  getPreviousKey(key) {
    let nextKey = key;
    nextKey = this.collection.getKeyBefore(nextKey);
    return this.findNextNonDisabled(nextKey, (key2) => this.collection.getKeyBefore(key2));
  }
  findKey(key, nextKey, shouldSkip2) {
    let tempKey = key;
    let itemRect = this.layoutDelegate.getItemRect(tempKey);
    if (!itemRect || tempKey == null)
      return null;
    let prevRect = itemRect;
    do {
      tempKey = nextKey(tempKey);
      if (tempKey == null)
        break;
      itemRect = this.layoutDelegate.getItemRect(tempKey);
    } while (itemRect && shouldSkip2(prevRect, itemRect) && tempKey != null);
    return tempKey;
  }
  isSameRow(prevRect, itemRect) {
    return prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
  }
  isSameColumn(prevRect, itemRect) {
    return prevRect.x === itemRect.x || prevRect.y !== itemRect.y;
  }
  getKeyBelow(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getNextKey(key2), this.isSameRow);
    else
      return this.getNextKey(key);
  }
  getKeyAbove(key) {
    if (this.layout === "grid" && this.orientation === "vertical")
      return this.findKey(key, (key2) => this.getPreviousKey(key2), this.isSameRow);
    else
      return this.getPreviousKey(key);
  }
  getNextColumn(key, right) {
    return right ? this.getPreviousKey(key) : this.getNextKey(key);
  }
  getKeyRightOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "rtl");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "rtl"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "rtl");
    return null;
  }
  getKeyLeftOf(key) {
    let layoutDelegateMethod = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
    if (this.layoutDelegate[layoutDelegateMethod]) {
      key = this.layoutDelegate[layoutDelegateMethod](key);
      return this.findNextNonDisabled(key, (key2) => this.layoutDelegate[layoutDelegateMethod](key2));
    }
    if (this.layout === "grid") {
      if (this.orientation === "vertical")
        return this.getNextColumn(key, this.direction === "ltr");
      else
        return this.findKey(key, (key2) => this.getNextColumn(key2, this.direction === "ltr"), this.isSameColumn);
    } else if (this.orientation === "horizontal")
      return this.getNextColumn(key, this.direction === "ltr");
    return null;
  }
  getFirstKey() {
    let key = this.collection.getFirstKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyAfter(key2));
  }
  getLastKey() {
    let key = this.collection.getLastKey();
    return this.findNextNonDisabled(key, (key2) => this.collection.getKeyBefore(key2));
  }
  getKeyPageAbove(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def(menu2))
      return this.getFirstKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.max(0, itemRect.x + itemRect.width - this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x > pageX && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.max(0, itemRect.y + itemRect.height - this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y > pageY && nextKey != null) {
        nextKey = this.getKeyAbove(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getFirstKey();
  }
  getKeyPageBelow(key) {
    let menu2 = this.ref.current;
    let itemRect = this.layoutDelegate.getItemRect(key);
    if (!itemRect)
      return null;
    if (menu2 && !$cc38e7bd3fc7b213$export$2bb74740c4e19def(menu2))
      return this.getLastKey();
    let nextKey = key;
    if (this.orientation === "horizontal") {
      let pageX = Math.min(this.layoutDelegate.getContentSize().width, itemRect.y - itemRect.width + this.layoutDelegate.getVisibleRect().width);
      while (itemRect && itemRect.x < pageX && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    } else {
      let pageY = Math.min(this.layoutDelegate.getContentSize().height, itemRect.y - itemRect.height + this.layoutDelegate.getVisibleRect().height);
      while (itemRect && itemRect.y < pageY && nextKey != null) {
        nextKey = this.getKeyBelow(nextKey);
        itemRect = nextKey == null ? null : this.layoutDelegate.getItemRect(nextKey);
      }
    }
    return nextKey !== null && nextKey !== void 0 ? nextKey : this.getLastKey();
  }
  getKeyForSearch(search2, fromKey) {
    if (!this.collator)
      return null;
    let collection = this.collection;
    let key = fromKey || this.getFirstKey();
    while (key != null) {
      let item = collection.getItem(key);
      if (!item)
        return null;
      let substring = item.textValue.slice(0, search2.length);
      if (item.textValue && this.collator.compare(substring, search2) === 0)
        return key;
      key = this.getNextKey(key);
    }
    return null;
  }
  constructor(...args) {
    if (args.length === 1) {
      let opts2 = args[0];
      this.collection = opts2.collection;
      this.ref = opts2.ref;
      this.collator = opts2.collator;
      this.disabledKeys = opts2.disabledKeys || /* @__PURE__ */ new Set();
      this.disabledBehavior = opts2.disabledBehavior || "all";
      this.orientation = opts2.orientation || "vertical";
      this.direction = opts2.direction;
      this.layout = opts2.layout || "stack";
      this.layoutDelegate = opts2.layoutDelegate || new $657e4dc4a6e88df0$export$8f5ed9ff9f5113813(opts2.ref);
    } else {
      this.collection = args[0];
      this.disabledKeys = args[1];
      this.ref = args[2];
      this.collator = args[3];
      this.layout = "stack";
      this.orientation = "vertical";
      this.disabledBehavior = "all";
      this.layoutDelegate = new $657e4dc4a6e88df0$export$8f5ed9ff9f5113813(this.ref);
    }
    if (this.layout === "stack" && this.orientation === "vertical") {
      this.getKeyLeftOf = void 0;
      this.getKeyRightOf = void 0;
    }
  }
}
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
let $bdb11010cef70236$export$d41a04c74483c6ef$1 = /* @__PURE__ */ new Map();
let $bdb11010cef70236$var$registry;
if (typeof FinalizationRegistry !== "undefined")
  $bdb11010cef70236$var$registry = new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef$1.delete(heldValue);
  });
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
  let [value2, setValue] = reactExports.useState(defaultId);
  let nextId = reactExports.useRef(null);
  let res = $b5e257d569688ac6$export$619500959fc48b26(value2);
  let cleanupRef = reactExports.useRef(null);
  if ($bdb11010cef70236$var$registry)
    $bdb11010cef70236$var$registry.register(cleanupRef, res);
  if ($bdb11010cef70236$var$canUseDOM) {
    const cacheIdRef = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(res);
    if (cacheIdRef && !cacheIdRef.includes(nextId))
      cacheIdRef.push(nextId);
    else
      $bdb11010cef70236$export$d41a04c74483c6ef$1.set(res, [
        nextId
      ]);
  }
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
    let r2 = res;
    return () => {
      if ($bdb11010cef70236$var$registry)
        $bdb11010cef70236$var$registry.unregister(cleanupRef);
      $bdb11010cef70236$export$d41a04c74483c6ef$1.delete(r2);
    };
  }, [
    res
  ]);
  reactExports.useEffect(() => {
    let newId = nextId.current;
    if (newId)
      setValue(newId);
    return () => {
      if (newId)
        nextId.current = null;
    };
  });
  return res;
}
function $bdb11010cef70236$export$cd8c9cb68f842629$1(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef$1.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e$1(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function $3ef42575df84b30b$export$9d1611c77c2fe928$1(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e$1(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx$4(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629$1(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
const $65484d02dcb7eb3e$var$DOMPropNames$1 = /* @__PURE__ */ new Set([
  "id"
]);
const $65484d02dcb7eb3e$var$labelablePropNames$1 = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
const $65484d02dcb7eb3e$var$linkPropNames$1 = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
const $65484d02dcb7eb3e$var$propRe$1 = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f$1(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames$1.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames$1.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames$1.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe$1.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function useMultiSelect(props, state, ref) {
  const { disallowEmptySelection, isDisabled } = props;
  const collator = $325a3faab7a68acd$export$a16aca283550c30d$1({ usage: "search", sensitivity: "base" });
  const delegate = reactExports.useMemo(
    () => new $2a25aae57d74318e$export$a05409b8bb224a5a3(state.collection, state.disabledKeys, null, collator),
    [state.collection, state.disabledKeys, collator]
  );
  const { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49$1(
    {
      isDisabled,
      type: "listbox"
    },
    state,
    ref
  );
  const triggerOnKeyDown = (e2) => {
    if (state.selectionMode === "single") {
      switch (e2.key) {
        case "ArrowLeft": {
          e2.preventDefault();
          const key = state.selectedKeys.size > 0 ? delegate.getKeyAbove(state.selectedKeys.values().next().value) : delegate.getFirstKey();
          if (key) {
            state.setSelectedKeys([key]);
          }
          break;
        }
        case "ArrowRight": {
          e2.preventDefault();
          const key = state.selectedKeys.size > 0 ? delegate.getKeyBelow(state.selectedKeys.values().next().value) : delegate.getFirstKey();
          if (key) {
            state.setSelectedKeys([key]);
          }
          break;
        }
      }
    }
  };
  const { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
    keyboardDelegate: delegate,
    selectionManager: state.selectionManager,
    onTypeSelect(key) {
      state.setSelectedKeys([key]);
    }
  });
  const { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  const { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  typeSelectProps.onKeyDown = typeSelectProps.onKeyDownCapture;
  delete typeSelectProps.onKeyDownCapture;
  menuTriggerProps.onPressStart = (e2) => {
    if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
      state.toggle(e2.pointerType === "virtual" ? "first" : null);
    }
  };
  const domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$1(props, { labelable: true });
  const triggerProps = $3ef42575df84b30b$export$9d1611c77c2fe928$1(typeSelectProps, menuTriggerProps, fieldProps);
  const valueId = $bdb11010cef70236$export$f680877a34711e37();
  return {
    labelProps: {
      ...labelProps,
      onClick: () => {
        var _a2;
        if (!props.isDisabled) {
          (_a2 = ref.current) == null ? void 0 : _a2.focus();
          $507fabe10e71c6fb$export$8397ddfc504fdb9a$1("keyboard");
        }
      }
    },
    triggerProps: $3ef42575df84b30b$export$9d1611c77c2fe928$1(domProps, {
      ...triggerProps,
      onKeyDown: $ff5963eb1fccf552$export$e08e3b67e392101e$1(triggerProps.onKeyDown, triggerOnKeyDown, props.onKeyDown),
      onKeyUp: props.onKeyUp,
      "aria-labelledby": [
        valueId,
        triggerProps["aria-labelledby"],
        triggerProps["aria-label"] && !triggerProps["aria-labelledby"] ? triggerProps.id : null
      ].join(","),
      onFocus(e2) {
        if (state.isFocused) {
          return;
        }
        if (props.onFocus) {
          props.onFocus(e2);
        }
        state.setFocused(true);
      },
      onBlur(e2) {
        if (state.isOpen) {
          return;
        }
        if (props.onBlur) {
          props.onBlur(e2);
        }
        state.setFocused(false);
      }
    }),
    valueProps: {
      id: valueId
    },
    menuProps: {
      ...menuProps,
      disallowEmptySelection,
      autoFocus: state.focusStrategy || true,
      shouldSelectOnPressUp: true,
      shouldFocusOnHover: true,
      onBlur: (e2) => {
        if (e2.currentTarget.contains(e2.relatedTarget)) {
          return;
        }
        if (props.onBlur) {
          props.onBlur(e2);
        }
        state.setFocused(false);
      },
      // @ts-ignore
      onFocus: menuProps == null ? void 0 : menuProps.onFocus,
      "aria-labelledby": [
        fieldProps["aria-labelledby"],
        triggerProps["aria-label"] && !fieldProps["aria-labelledby"] ? triggerProps.id : null
      ].filter(Boolean).join(" ")
    },
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
var selectData = /* @__PURE__ */ new WeakMap();
function useSelect(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, select.variantKeys);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const {
    ref,
    as: as2,
    label,
    name: name2,
    isLoading,
    selectorIcon,
    isOpen,
    defaultOpen,
    onOpenChange,
    startContent,
    endContent,
    description,
    renderValue,
    onSelectionChange,
    placeholder,
    isVirtualized,
    itemHeight = 36,
    maxListboxHeight = 256,
    children,
    disallowEmptySelection = false,
    selectionMode = "single",
    spinnerRef,
    scrollRef: scrollRefProp,
    popoverProps = {},
    scrollShadowProps = {},
    listboxProps = {},
    spinnerProps = {},
    validationState,
    onChange,
    onClose,
    className,
    classNames: classNames2,
    validationBehavior = (_c2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native",
    hideEmptyContent = false,
    onClear,
    ...otherProps
  } = props;
  const scrollShadowRef = useDOMRef(scrollRefProp);
  const slotsProps = {
    popoverProps: mergeProps$3(
      {
        placement: "bottom",
        triggerScaleOnOpen: false,
        offset: 5,
        disableAnimation
      },
      popoverProps
    ),
    scrollShadowProps: mergeProps$3(
      {
        ref: scrollShadowRef,
        isEnabled: (_d = originalProps.showScrollIndicators) != null ? _d : true,
        hideScrollBar: true,
        offset: 15
      },
      scrollShadowProps
    ),
    listboxProps: mergeProps$3(
      {
        disableAnimation
      },
      listboxProps
    )
  };
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const triggerRef = reactExports.useRef(null);
  const listBoxRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  let state = useMultiSelectState({
    ...props,
    isOpen,
    selectionMode,
    disallowEmptySelection,
    validationBehavior,
    children,
    isRequired: originalProps.isRequired,
    isDisabled: originalProps.isDisabled,
    isInvalid: originalProps.isInvalid,
    defaultOpen,
    hideEmptyContent,
    onOpenChange: (open) => {
      onOpenChange == null ? void 0 : onOpenChange(open);
      if (!open) {
        onClose == null ? void 0 : onClose();
      }
    },
    onSelectionChange: (keys2) => {
      onSelectionChange == null ? void 0 : onSelectionChange(keys2);
      if (onChange && typeof onChange === "function") {
        onChange({
          target: {
            ...domRef.current && {
              ...domRef.current,
              name: domRef.current.name
            },
            value: Array.from(keys2).join(",")
          }
        });
      }
      state.commitValidation();
    }
  });
  state = {
    ...state,
    ...originalProps.isDisabled && {
      disabledKeys: /* @__PURE__ */ new Set([...state.collection.getKeys()])
    }
  };
  useSafeLayoutEffect(() => {
    var _a22;
    if (!((_a22 = domRef.current) == null ? void 0 : _a22.value))
      return;
    state.setSelectedKeys(/* @__PURE__ */ new Set([...state.selectedKeys, domRef.current.value]));
  }, [domRef.current]);
  const {
    labelProps,
    triggerProps,
    valueProps,
    menuProps,
    descriptionProps,
    errorMessageProps,
    isInvalid: isAriaInvalid,
    validationErrors,
    validationDetails
  } = useMultiSelect(
    { ...props, disallowEmptySelection, isDisabled: originalProps.isDisabled },
    state,
    triggerRef
  );
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    state.setSelectedKeys(/* @__PURE__ */ new Set([]));
    onClear == null ? void 0 : onClear();
    (_a22 = triggerRef.current) == null ? void 0 : _a22.focus();
  }, [onClear, state]);
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$4({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled),
    onPress: handleClear
  });
  const isInvalid = originalProps.isInvalid || validationState === "invalid" || isAriaInvalid;
  const { isPressed, buttonProps } = useAriaButton$1(triggerProps, triggerRef);
  const { focusProps, isFocused, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$5({ isDisabled: originalProps.isDisabled });
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const hasPlaceholder = !!placeholder;
  const shouldLabelBeOutside = labelPlacement === "outside-left" || labelPlacement === "outside";
  const shouldLabelBeInside = labelPlacement === "inside";
  const isOutsideLeft = labelPlacement === "outside-left";
  const isClearable = originalProps.isClearable;
  const isFilled = state.isOpen || hasPlaceholder || !!((_e = state.selectedItems) == null ? void 0 : _e.length) || !!startContent || !!endContent || !!originalProps.isMultiline;
  const hasValue2 = !!((_f = state.selectedItems) == null ? void 0 : _f.length);
  const hasLabel = !!label;
  const hasLabelOutside = hasLabel && (isOutsideLeft || shouldLabelBeOutside && hasPlaceholder);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => select({
      ...variantProps2,
      isInvalid,
      isClearable,
      labelPlacement,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isInvalid, labelPlacement, disableAnimation]
  );
  $49c51c25361d4cd2$export$ee0f7cc6afcd1c18({
    isDisabled: !state.isOpen
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const hasHelper = !!description || !!errorMessage;
  const hasEndContent = !!endContent;
  reactExports.useEffect(() => {
    if (state.isOpen && popoverRef.current && triggerRef.current) {
      let selectRect = triggerRef.current.getBoundingClientRect();
      let popover2 = popoverRef.current;
      popover2.style.width = selectRect.width + "px";
    }
  }, [state.isOpen]);
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "base",
      "data-filled": dataAttr(isFilled),
      "data-has-value": dataAttr(hasValue2),
      "data-has-label": dataAttr(hasLabel),
      "data-has-helper": dataAttr(hasHelper),
      "data-has-end-content": dataAttr(hasEndContent),
      "data-invalid": dataAttr(isInvalid),
      "data-has-label-outside": dataAttr(hasLabelOutside),
      className: slots.base({
        class: clsx$5(baseStyles, props2.className)
      }),
      ...props2
    }),
    [slots, hasHelper, hasValue2, hasLabel, hasLabelOutside, isFilled, baseStyles]
  );
  const getTriggerProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: triggerRef,
        "data-slot": "trigger",
        "data-open": dataAttr(state.isOpen),
        "data-disabled": dataAttr(originalProps == null ? void 0 : originalProps.isDisabled),
        "data-focus": dataAttr(isFocused),
        "data-pressed": dataAttr(isPressed),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-hover": dataAttr(isHovered),
        className: slots.trigger({ class: classNames2 == null ? void 0 : classNames2.trigger }),
        ...mergeProps$3(
          buttonProps,
          focusProps,
          hoverProps,
          filterDOMProps(otherProps, {
            enabled: shouldFilterDOMProps
          }),
          filterDOMProps(props2)
        )
      };
    },
    [
      slots,
      triggerRef,
      state.isOpen,
      classNames2 == null ? void 0 : classNames2.trigger,
      originalProps == null ? void 0 : originalProps.isDisabled,
      isFocused,
      isPressed,
      isFocusVisible,
      isHovered,
      buttonProps,
      focusProps,
      hoverProps,
      otherProps,
      shouldFilterDOMProps
    ]
  );
  const getHiddenSelectProps = reactExports.useCallback(
    (props2 = {}) => ({
      state,
      triggerRef,
      selectRef: domRef,
      selectionMode,
      label: originalProps == null ? void 0 : originalProps.label,
      name: originalProps == null ? void 0 : originalProps.name,
      isRequired: originalProps == null ? void 0 : originalProps.isRequired,
      autoComplete: originalProps == null ? void 0 : originalProps.autoComplete,
      isDisabled: originalProps == null ? void 0 : originalProps.isDisabled,
      form: originalProps == null ? void 0 : originalProps.form,
      onChange,
      ...props2
    }),
    [
      state,
      selectionMode,
      originalProps == null ? void 0 : originalProps.label,
      originalProps == null ? void 0 : originalProps.autoComplete,
      originalProps == null ? void 0 : originalProps.name,
      originalProps == null ? void 0 : originalProps.isDisabled,
      triggerRef
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "label",
      className: slots.label({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.label, props2.className)
      }),
      ...labelProps,
      ...props2
    }),
    [slots, classNames2 == null ? void 0 : classNames2.label, labelProps]
  );
  const getValueProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "value",
      className: slots.value({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.value, props2.className)
      }),
      ...valueProps,
      ...props2
    }),
    [slots, classNames2 == null ? void 0 : classNames2.value, valueProps]
  );
  const getListboxWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-slot": "listboxWrapper",
      className: slots.listboxWrapper({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.listboxWrapper, props2 == null ? void 0 : props2.className)
      }),
      style: {
        maxHeight: maxListboxHeight != null ? maxListboxHeight : 256,
        ...props2.style
      },
      ...mergeProps$3(slotsProps.scrollShadowProps, props2)
    }),
    [
      slots.listboxWrapper,
      classNames2 == null ? void 0 : classNames2.listboxWrapper,
      slotsProps.scrollShadowProps,
      maxListboxHeight
    ]
  );
  const getListboxProps = (props2 = {}) => {
    const shouldVirtualize = isVirtualized != null ? isVirtualized : state.collection.size > 50;
    return {
      state,
      ref: listBoxRef,
      isVirtualized: shouldVirtualize,
      virtualization: shouldVirtualize ? {
        maxListboxHeight,
        itemHeight
      } : void 0,
      "data-slot": "listbox",
      className: slots.listbox({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.listbox, props2 == null ? void 0 : props2.className)
      }),
      scrollShadowProps: slotsProps.scrollShadowProps,
      ...mergeProps$3(slotsProps.listboxProps, props2, menuProps)
    };
  };
  const getPopoverProps = reactExports.useCallback(
    (props2 = {}) => {
      var _a22, _b22;
      const popoverProps2 = mergeProps$3(slotsProps.popoverProps, props2);
      return {
        state,
        triggerRef,
        ref: popoverRef,
        "data-slot": "popover",
        scrollRef: listBoxRef,
        triggerType: "listbox",
        classNames: {
          content: slots.popoverContent({
            class: clsx$5(classNames2 == null ? void 0 : classNames2.popoverContent, props2.className)
          })
        },
        ...popoverProps2,
        offset: state.selectedItems && state.selectedItems.length > 0 ? (
          // forces the popover to update its position when the selected items change
          state.selectedItems.length * 1e-8 + (((_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.offset) || 0)
        ) : (_b22 = slotsProps.popoverProps) == null ? void 0 : _b22.offset
      };
    },
    [
      slots,
      classNames2 == null ? void 0 : classNames2.popoverContent,
      slotsProps.popoverProps,
      triggerRef,
      state,
      state.selectedItems
    ]
  );
  const getSelectorIconProps = reactExports.useCallback(
    () => ({
      "data-slot": "selectorIcon",
      "aria-hidden": dataAttr(true),
      "data-open": dataAttr(state.isOpen),
      className: slots.selectorIcon({ class: classNames2 == null ? void 0 : classNames2.selectorIcon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.selectorIcon, state.isOpen]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "innerWrapper",
        className: slots.innerWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helperWrapper",
        className: slots.helperWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "mainWrapper",
        className: slots.mainWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getEndWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "end-wrapper",
        className: slots.endWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.endWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.endWrapper]
  );
  const getEndContentProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "end-content",
        className: slots.endContent({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.endContent, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.endContent]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getSpinnerProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-slot": "spinner",
        color: "current",
        size: "sm",
        ...spinnerProps,
        ...props2,
        ref: spinnerRef,
        className: slots.spinner({ class: clsx$5(classNames2 == null ? void 0 : classNames2.spinner, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, spinnerRef, spinnerProps, classNames2 == null ? void 0 : classNames2.spinner]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        "aria-label": "clear selection",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({ class: clsx$5(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className) }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  selectData.set(state, {
    isDisabled: originalProps == null ? void 0 : originalProps.isDisabled,
    isRequired: originalProps == null ? void 0 : originalProps.isRequired,
    name: originalProps == null ? void 0 : originalProps.name,
    isInvalid,
    validationBehavior
  });
  return {
    Component: Component2,
    domRef,
    state,
    label,
    name: name2,
    triggerRef,
    isLoading,
    placeholder,
    startContent,
    endContent,
    description,
    selectorIcon,
    hasHelper,
    labelPlacement,
    hasPlaceholder,
    renderValue,
    selectionMode,
    disableAnimation,
    isOutsideLeft,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    isInvalid,
    errorMessage,
    isClearable,
    getClearButtonProps,
    getBaseProps,
    getTriggerProps,
    getLabelProps,
    getValueProps,
    getListboxProps,
    getPopoverProps,
    getSpinnerProps,
    getMainWrapperProps,
    getListboxWrapperProps,
    getHiddenSelectProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getSelectorIconProps,
    getEndWrapperProps,
    getEndContentProps
  };
}
var useLayoutEffect$3 = typeof document !== "undefined" ? React$6.useLayoutEffect : () => {
};
function useEffectEvent(fn) {
  const ref = reactExports.useRef(null);
  useLayoutEffect$3(() => {
    ref.current = fn;
  }, [fn]);
  return reactExports.useCallback((...args) => {
    const f2 = ref.current;
    return f2 == null ? void 0 : f2(...args);
  }, []);
}
function useFormReset(ref, initialValue, onReset) {
  let resetValue = reactExports.useRef(initialValue);
  let handleReset = useEffectEvent(() => {
    if (onReset) {
      onReset(resetValue.current);
    }
  });
  reactExports.useEffect(() => {
    var _a2;
    let form2 = (_a2 = ref == null ? void 0 : ref.current) == null ? void 0 : _a2.form;
    form2 == null ? void 0 : form2.addEventListener("reset", handleReset);
    return () => {
      form2 == null ? void 0 : form2.removeEventListener("reset", handleReset);
    };
  }, [ref, handleReset]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48$1 = false;
let $507fabe10e71c6fb$var$changeHandlers$1 = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7$1 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = false;
function $507fabe10e71c6fb$var$triggerChangeHandlers$1(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers$1)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey$1(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent$1(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
  if ($507fabe10e71c6fb$var$isValidKey$1(e2)) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent$1(e2) {
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent$1(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent$1(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48$1 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus$1 && !$507fabe10e71c6fb$var$hasBlurredWindowRecently$1) {
    $507fabe10e71c6fb$var$triggerChangeHandlers$1("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur$1() {
  $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently$1 = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7$1.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus$1 = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$1, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$1, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$1, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7$1.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1 = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7$1.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7$1.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent$1, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent$1, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent$1, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur$1, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent$1, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7$1.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d$1(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents$1(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking$1(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d$1();
function $507fabe10e71c6fb$export$8397ddfc504fdb9a(modality) {
  $507fabe10e71c6fb$var$triggerChangeHandlers$1(modality, null);
}
function $e93e671b31057976$export$b8473d3665f3a75a(props, state, ref) {
  let { validationBehavior, focus } = props;
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.disabled) {
      let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : "";
      ref.current.setCustomValidity(errorMessage);
      if (!ref.current.hasAttribute("title"))
        ref.current.title = "";
      if (!state.realtimeValidation.isInvalid)
        state.updateValidation($e93e671b31057976$var$getNativeValidity(ref.current));
    }
  });
  let onReset = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.resetValidation();
  });
  let onInvalid = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    var _ref_current;
    if (!state.displayValidation.isInvalid)
      state.commitValidation();
    let form2 = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form;
    if (!e2.defaultPrevented && ref && form2 && $e93e671b31057976$var$getFirstInvalidInput(form2) === ref.current) {
      var _ref_current1;
      if (focus)
        focus();
      else
        (_ref_current1 = ref.current) === null || _ref_current1 === void 0 ? void 0 : _ref_current1.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard");
    }
    e2.preventDefault();
  });
  let onChange = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    state.commitValidation();
  });
  reactExports.useEffect(() => {
    let input2 = ref === null || ref === void 0 ? void 0 : ref.current;
    if (!input2)
      return;
    let form2 = input2.form;
    input2.addEventListener("invalid", onInvalid);
    input2.addEventListener("change", onChange);
    form2 === null || form2 === void 0 ? void 0 : form2.addEventListener("reset", onReset);
    return () => {
      input2.removeEventListener("invalid", onInvalid);
      input2.removeEventListener("change", onChange);
      form2 === null || form2 === void 0 ? void 0 : form2.removeEventListener("reset", onReset);
    };
  }, [
    ref,
    onInvalid,
    onChange,
    onReset,
    validationBehavior
  ]);
}
function $e93e671b31057976$var$getValidity(input2) {
  let validity = input2.validity;
  return {
    badInput: validity.badInput,
    customError: validity.customError,
    patternMismatch: validity.patternMismatch,
    rangeOverflow: validity.rangeOverflow,
    rangeUnderflow: validity.rangeUnderflow,
    stepMismatch: validity.stepMismatch,
    tooLong: validity.tooLong,
    tooShort: validity.tooShort,
    typeMismatch: validity.typeMismatch,
    valueMissing: validity.valueMissing,
    valid: validity.valid
  };
}
function $e93e671b31057976$var$getNativeValidity(input2) {
  return {
    isInvalid: !input2.validity.valid,
    validationDetails: $e93e671b31057976$var$getValidity(input2),
    validationErrors: input2.validationMessage ? [
      input2.validationMessage
    ] : []
  };
}
function $e93e671b31057976$var$getFirstInvalidInput(form2) {
  for (let i2 = 0; i2 < form2.elements.length; i2++) {
    let element2 = form2.elements[i2];
    if (!element2.validity.valid)
      return element2;
  }
  return null;
}
function useHiddenSelect(props, state, triggerRef) {
  var _a2;
  let data = selectData.get(state) || {};
  let {
    autoComplete,
    name: name2 = data.name,
    isDisabled = data.isDisabled,
    selectionMode,
    onChange,
    form: form2
  } = props;
  let { validationBehavior, isRequired, isInvalid } = data;
  let { visuallyHiddenProps } = $5c3e21d68f1c4674$export$a966af930f325cab();
  useFormReset(props.selectRef, state.selectedKeys, state.setSelectedKeys);
  $e93e671b31057976$export$b8473d3665f3a75a(
    {
      validationBehavior,
      focus: () => {
        var _a22;
        return (_a22 = triggerRef.current) == null ? void 0 : _a22.focus();
      }
    },
    state,
    props.selectRef
  );
  return {
    containerProps: {
      ...visuallyHiddenProps,
      "aria-hidden": true,
      ["data-a11y-ignore"]: "aria-hidden-focus"
    },
    inputProps: {
      style: { display: "none" }
    },
    selectProps: {
      form: form2,
      autoComplete,
      disabled: isDisabled,
      "aria-invalid": isInvalid || void 0,
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      required: isRequired && validationBehavior === "native",
      name: name2,
      tabIndex: -1,
      value: selectionMode === "multiple" ? [...state.selectedKeys].map((k2) => String(k2)) : (_a2 = [...state.selectedKeys][0]) != null ? _a2 : "",
      multiple: selectionMode === "multiple",
      onChange: (e2) => {
        state.setSelectedKeys(e2.target.value);
        onChange == null ? void 0 : onChange(e2);
      }
    }
  };
}
function HiddenSelect(props) {
  var _a2;
  let { state, triggerRef, selectRef, label, name: name2, isDisabled, form: form2 } = props;
  let { containerProps, selectProps } = useHiddenSelect({ ...props, selectRef }, state, triggerRef);
  if (state.collection.size <= 300) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...containerProps, "data-testid": "hidden-select-container", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
      label,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { ...selectProps, ref: selectRef, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("option", {}),
        [...state.collection.getKeys()].map((key) => {
          let item = state.collection.getItem(key);
          if ((item == null ? void 0 : item.type) === "item") {
            return /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item.key, children: item.textValue }, item.key);
          }
        })
      ] })
    ] }) });
  } else if (name2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      "input",
      {
        autoComplete: selectProps.autoComplete,
        disabled: isDisabled,
        form: form2,
        name: name2,
        type: "hidden",
        value: (_a2 = [...state.selectedKeys].join(",")) != null ? _a2 : ""
      }
    );
  }
  return null;
}
var ListboxItemBase = $c1d7fb2ec91bae71$export$6d08773d2e66f8f2;
var listbox_item_base_default = ListboxItemBase;
const $b1f0cad8af73213b$export$3585ede4d035bf14$1 = /* @__PURE__ */ new WeakMap();
function $b1f0cad8af73213b$var$normalizeKey$1(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $b1f0cad8af73213b$export$9145995848b05025$1(state, itemKey2) {
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14$1.get(state);
  if (!data)
    throw new Error("Unknown list");
  return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey$1(itemKey2)}`;
}
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  let selectionBehavior = props.selectionBehavior || "toggle";
  let linkBehavior = props.linkBehavior || (selectionBehavior === "replace" ? "action" : "override");
  if (selectionBehavior === "toggle" && linkBehavior === "action")
    linkBehavior = "override";
  let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
    ...props,
    ref,
    selectionManager: state.selectionManager,
    collection: state.collection,
    disabledKeys: state.disabledKeys,
    linkBehavior
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onFocusWithin: props.onFocus,
    onBlurWithin: props.onBlur,
    onFocusWithinChange: props.onFocusChange
  });
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2(props.id);
  $b1f0cad8af73213b$export$3585ede4d035bf14$1.set(state, {
    id: id2,
    shouldUseVirtualFocus: props.shouldUseVirtualFocus,
    shouldSelectOnPressUp: props.shouldSelectOnPressUp,
    shouldFocusOnHover: props.shouldFocusOnHover,
    isVirtualized: props.isVirtualized,
    onAction: props.onAction,
    linkBehavior
  });
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...props,
    id: id2,
    // listbox is not an HTML input element so it
    // shouldn't be labeled by a <label> element.
    labelElementType: "span"
  });
  return {
    labelProps,
    listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, focusWithinProps, state.selectionManager.selectionMode === "multiple" ? {
      "aria-multiselectable": "true"
    } : {}, {
      role: "listbox",
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, listProps)
    })
  };
}
function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
  var _item_props, _item_props1;
  let { key } = props;
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14$1.get(state);
  var _props_isDisabled;
  let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.selectionManager.isDisabled(key);
  var _props_isSelected;
  let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
  var _props_shouldSelectOnPressUp;
  let shouldSelectOnPressUp = (_props_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _props_shouldSelectOnPressUp !== void 0 ? _props_shouldSelectOnPressUp : data === null || data === void 0 ? void 0 : data.shouldSelectOnPressUp;
  var _props_shouldFocusOnHover;
  let shouldFocusOnHover = (_props_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _props_shouldFocusOnHover !== void 0 ? _props_shouldFocusOnHover : data === null || data === void 0 ? void 0 : data.shouldFocusOnHover;
  var _props_shouldUseVirtualFocus;
  let shouldUseVirtualFocus = (_props_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _props_shouldUseVirtualFocus !== void 0 ? _props_shouldUseVirtualFocus : data === null || data === void 0 ? void 0 : data.shouldUseVirtualFocus;
  var _props_isVirtualized;
  let isVirtualized = (_props_isVirtualized = props.isVirtualized) !== null && _props_isVirtualized !== void 0 ? _props_isVirtualized : data === null || data === void 0 ? void 0 : data.isVirtualized;
  let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let optionProps = {
    role: "option",
    "aria-disabled": isDisabled || void 0,
    "aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0
  };
  if (!($c87311424ea30a05$export$9ac100e40613ea10$6() && $c87311424ea30a05$export$78551043582a6a98$5())) {
    optionProps["aria-label"] = props["aria-label"];
    optionProps["aria-labelledby"] = labelId;
    optionProps["aria-describedby"] = descriptionId;
  }
  let item = state.collection.getItem(key);
  if (isVirtualized) {
    let index2 = Number(item === null || item === void 0 ? void 0 : item.index);
    optionProps["aria-posinset"] = Number.isNaN(index2) ? void 0 : index2 + 1;
    optionProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  }
  let onAction = (data === null || data === void 0 ? void 0 : data.onAction) ? () => {
    var _data_onAction;
    return data === null || data === void 0 ? void 0 : (_data_onAction = data.onAction) === null || _data_onAction === void 0 ? void 0 : _data_onAction.call(data, key);
  } : void 0;
  let id2 = $b1f0cad8af73213b$export$9145995848b05025$1(state, key);
  let { itemProps, isPressed, isFocused, hasAction, allowsSelection } = $880e95eb8b93ba9a$export$ecf600387e221c37({
    selectionManager: state.selectionManager,
    key,
    ref,
    shouldSelectOnPressUp,
    allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,
    isVirtualized,
    shouldUseVirtualFocus,
    isDisabled,
    onAction: onAction || (item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.onAction) ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(item === null || item === void 0 ? void 0 : (_item_props1 = item.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.onAction, onAction) : void 0,
    linkBehavior: data === null || data === void 0 ? void 0 : data.linkBehavior,
    id: id2
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    isDisabled: isDisabled || !shouldFocusOnHover,
    onHoverStart() {
      if (!$507fabe10e71c6fb$export$b9b3dfddab17db27$2()) {
        state.selectionManager.setFocused(true);
        state.selectionManager.setFocusedKey(key);
      }
    }
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(item === null || item === void 0 ? void 0 : item.props);
  delete domProps.id;
  let linkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(item === null || item === void 0 ? void 0 : item.props);
  return {
    optionProps: {
      ...optionProps,
      ...$3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, itemProps, hoverProps, linkProps),
      id: id2
    },
    labelProps: {
      id: labelId
    },
    descriptionProps: {
      id: descriptionId
    },
    isFocused,
    isFocusVisible: isFocused && state.selectionManager.isFocused && $507fabe10e71c6fb$export$b9b3dfddab17db27$2(),
    isSelected,
    isDisabled,
    isPressed,
    allowsSelection,
    hasAction
  };
}
function $af383d3bef1cfdc9$export$c3f9f39876e4bc7(props) {
  let { heading: heading2, "aria-label": ariaLabel } = props;
  let headingId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    itemProps: {
      role: "presentation"
    },
    headingProps: heading2 ? {
      // Techincally, listbox cannot contain headings according to ARIA.
      // We hide the heading from assistive technology, using role="presentation",
      // and only use it as a visual label for the nested group.
      id: headingId,
      role: "presentation"
    } : {},
    groupProps: {
      role: "group",
      "aria-label": ariaLabel,
      "aria-labelledby": heading2 ? headingId : void 0
    }
  };
}
class $a02d57049d202695$export$d085fb9e920b5ca73 {
  *[Symbol.iterator]() {
    yield* this.iterable;
  }
  get size() {
    return this.keyMap.size;
  }
  getKeys() {
    return this.keyMap.keys();
  }
  getKeyBefore(key) {
    let node2 = this.keyMap.get(key);
    var _node_prevKey;
    return node2 ? (_node_prevKey = node2.prevKey) !== null && _node_prevKey !== void 0 ? _node_prevKey : null : null;
  }
  getKeyAfter(key) {
    let node2 = this.keyMap.get(key);
    var _node_nextKey;
    return node2 ? (_node_nextKey = node2.nextKey) !== null && _node_nextKey !== void 0 ? _node_nextKey : null : null;
  }
  getFirstKey() {
    return this.firstKey;
  }
  getLastKey() {
    return this.lastKey;
  }
  getItem(key) {
    var _this_keyMap_get;
    return (_this_keyMap_get = this.keyMap.get(key)) !== null && _this_keyMap_get !== void 0 ? _this_keyMap_get : null;
  }
  at(idx) {
    const keys2 = [
      ...this.getKeys()
    ];
    return this.getItem(keys2[idx]);
  }
  getChildren(key) {
    let node2 = this.keyMap.get(key);
    return (node2 === null || node2 === void 0 ? void 0 : node2.childNodes) || [];
  }
  constructor(nodes) {
    this.keyMap = /* @__PURE__ */ new Map();
    this.firstKey = null;
    this.lastKey = null;
    this.iterable = nodes;
    let visit2 = (node2) => {
      this.keyMap.set(node2.key, node2);
      if (node2.childNodes && node2.type === "section")
        for (let child of node2.childNodes)
          visit2(child);
    };
    for (let node2 of nodes)
      visit2(node2);
    let last = null;
    let index2 = 0;
    for (let [key, node2] of this.keyMap) {
      if (last) {
        last.nextKey = key;
        node2.prevKey = last.key;
      } else {
        this.firstKey = key;
        node2.prevKey = void 0;
      }
      if (node2.type === "item")
        node2.index = index2++;
      last = node2;
      last.nextKey = void 0;
    }
    var _last_key;
    this.lastKey = (_last_key = last === null || last === void 0 ? void 0 : last.key) !== null && _last_key !== void 0 ? _last_key : null;
  }
}
function $e72dd72e1c76a225$export$2f645645f7bca764(props) {
  let { filter: filter3, layoutDelegate } = props;
  let selectionState = $7af3f5b51489e0b5$export$253fe78d46329472(props);
  let disabledKeys = reactExports.useMemo(() => props.disabledKeys ? new Set(props.disabledKeys) : /* @__PURE__ */ new Set(), [
    props.disabledKeys
  ]);
  let factory = reactExports.useCallback((nodes) => filter3 ? new $a02d57049d202695$export$d085fb9e920b5ca73(filter3(nodes)) : new $a02d57049d202695$export$d085fb9e920b5ca73(nodes), [
    filter3
  ]);
  let context = reactExports.useMemo(() => ({
    suppressTextValueWarning: props.suppressTextValueWarning
  }), [
    props.suppressTextValueWarning
  ]);
  let collection = $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context);
  let selectionManager = reactExports.useMemo(() => new $d496c0a20b6e58ec$export$6c8a5aaad13c9852(collection, selectionState, {
    layoutDelegate
  }), [
    collection,
    selectionState,
    layoutDelegate
  ]);
  $e72dd72e1c76a225$var$useFocusedKeyReset(collection, selectionManager);
  return {
    collection,
    disabledKeys,
    selectionManager
  };
}
function $e72dd72e1c76a225$var$useFocusedKeyReset(collection, selectionManager) {
  const cachedCollection = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (selectionManager.focusedKey != null && !collection.getItem(selectionManager.focusedKey) && cachedCollection.current) {
      const startItem = cachedCollection.current.getItem(selectionManager.focusedKey);
      const cachedItemNodes = [
        ...cachedCollection.current.getKeys()
      ].map((key) => {
        const itemNode = cachedCollection.current.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      const itemNodes = [
        ...collection.getKeys()
      ].map((key) => {
        const itemNode = collection.getItem(key);
        return (itemNode === null || itemNode === void 0 ? void 0 : itemNode.type) === "item" ? itemNode : null;
      }).filter((node2) => node2 !== null);
      var _cachedItemNodes_length, _itemNodes_length;
      const diff2 = ((_cachedItemNodes_length = cachedItemNodes === null || cachedItemNodes === void 0 ? void 0 : cachedItemNodes.length) !== null && _cachedItemNodes_length !== void 0 ? _cachedItemNodes_length : 0) - ((_itemNodes_length = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length !== void 0 ? _itemNodes_length : 0);
      var _startItem_index, _startItem_index1, _itemNodes_length1;
      let index2 = Math.min(diff2 > 1 ? Math.max(((_startItem_index = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index !== void 0 ? _startItem_index : 0) - diff2 + 1, 0) : (_startItem_index1 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index1 !== void 0 ? _startItem_index1 : 0, ((_itemNodes_length1 = itemNodes === null || itemNodes === void 0 ? void 0 : itemNodes.length) !== null && _itemNodes_length1 !== void 0 ? _itemNodes_length1 : 0) - 1);
      let newNode = null;
      let isReverseSearching = false;
      while (index2 >= 0) {
        if (!selectionManager.isDisabled(itemNodes[index2].key)) {
          newNode = itemNodes[index2];
          break;
        }
        if (index2 < itemNodes.length - 1 && !isReverseSearching)
          index2++;
        else {
          isReverseSearching = true;
          var _startItem_index2, _startItem_index3;
          if (index2 > ((_startItem_index2 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index2 !== void 0 ? _startItem_index2 : 0))
            index2 = (_startItem_index3 = startItem === null || startItem === void 0 ? void 0 : startItem.index) !== null && _startItem_index3 !== void 0 ? _startItem_index3 : 0;
          index2--;
        }
      }
      selectionManager.setFocusedKey(newNode ? newNode.key : null);
    }
    cachedCollection.current = collection;
  }, [
    collection,
    selectionManager
  ]);
}
function useListbox(props) {
  var _a2;
  const globalContext = useProviderContext();
  const {
    ref,
    as: as2,
    state: propState,
    variant,
    color: color2,
    onAction,
    children,
    onSelectionChange,
    disableAnimation = (_a2 = globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false,
    itemClasses,
    className,
    topContent,
    bottomContent,
    emptyContent = "No items.",
    hideSelectedIcon = false,
    hideEmptyContent = false,
    shouldHighlightOnFocus = false,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "ul";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const innerState = $e72dd72e1c76a225$export$2f645645f7bca764({ ...props, children, onSelectionChange });
  const state = propState || innerState;
  const { listBoxProps } = $c132121280ec012d$export$50eacbbf140a3141({ ...props, onAction }, state, domRef);
  const slots = reactExports.useMemo(() => menu$1(), []);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "base",
      className: slots.base({ class: baseStyles }),
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props2
    };
  };
  const getListProps = (props2 = {}) => {
    return {
      "data-slot": "list",
      className: slots.list({ class: classNames2 == null ? void 0 : classNames2.list }),
      ...listBoxProps,
      ...props2
    };
  };
  const getEmptyContentProps = (props2 = {}) => {
    return {
      "data-slot": "empty-content",
      children: emptyContent,
      className: slots.emptyContent({ class: classNames2 == null ? void 0 : classNames2.emptyContent }),
      ...props2
    };
  };
  return {
    Component: Component2,
    state,
    variant,
    color: color2,
    slots,
    classNames: classNames2,
    topContent,
    bottomContent,
    emptyContent,
    hideEmptyContent,
    shouldHighlightOnFocus,
    hideSelectedIcon,
    disableAnimation,
    className,
    itemClasses,
    getBaseProps,
    getListProps,
    getEmptyContentProps
  };
}
function ListboxSelectedIcon(props) {
  const { isSelected, disableAnimation, ...otherProps } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "svg",
    {
      "aria-hidden": "true",
      "data-selected": isSelected,
      role: "presentation",
      viewBox: "0 0 17 18",
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "polyline",
        {
          fill: "none",
          points: "1 9 7 14 15 4",
          stroke: "currentColor",
          strokeDasharray: 22,
          strokeDashoffset: isSelected ? 44 : 66,
          strokeLinecap: "round",
          strokeLinejoin: "round",
          strokeWidth: 1.5,
          style: !disableAnimation ? {
            transition: "stroke-dashoffset 200ms ease"
          } : {}
        }
      )
    }
  );
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$3(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$3(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$3(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$3 = "default";
let $14c0b72509d70225$var$savedUserSelect$3 = "";
let $14c0b72509d70225$var$modifiedElementMap$3 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$3(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$3 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$3 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$3 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$3.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$3(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$3 !== "disabled")
      return;
    $14c0b72509d70225$var$state$3 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$3 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$3 || "";
          $14c0b72509d70225$var$savedUserSelect$3 = "";
          $14c0b72509d70225$var$state$3 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$3.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$3.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$3.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$3 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$3.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$3(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$3);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$3 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$3 = class $f6c31cce2adf654f$var$PressEvent9 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$3, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$3 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$3 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$3(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$3(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$3("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$3("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$3(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$3(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$3(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$3(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$3(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$3(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$3(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$3(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$3(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$3]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$3] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$3(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$3(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$3(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$3))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$3;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$3((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$3]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$3(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$3(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$3(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$3(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$3(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$3(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$3(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$3(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$3(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$3(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$3 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$3(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$3.has(target.type);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = false;
let $6179b936705e76d3$var$hoverCount$4 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$4() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$4(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$4();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$4() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$4);
  $6179b936705e76d3$var$hoverCount$4++;
  return () => {
    $6179b936705e76d3$var$hoverCount$4--;
    if ($6179b936705e76d3$var$hoverCount$4 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$4);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$4(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$4, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$4 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function useListboxItem(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, menuItem.variantKeys);
  const {
    as: as2,
    item,
    state,
    description,
    startContent,
    endContent,
    isVirtualized,
    selectedIcon,
    className,
    classNames: classNames2,
    autoFocus,
    onPress,
    onPressUp,
    onPressStart,
    onPressEnd,
    onPressChange,
    onClick,
    shouldHighlightOnFocus,
    hideSelectedIcon = false,
    isReadOnly = false,
    ...otherProps
  } = props;
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = reactExports.useRef(null);
  const Component2 = as2 || (originalProps.href ? "a" : "li");
  const shouldFilterDOMProps = typeof Component2 === "string";
  const { rendered, key } = item;
  const isDisabled = state.disabledKeys.has(key) || originalProps.isDisabled;
  const isSelectable = state.selectionManager.selectionMode !== "none";
  const isMobile2 = useIsMobile();
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$3({
    ref: domRef,
    isDisabled,
    onClick,
    onPress,
    onPressUp,
    onPressStart,
    onPressEnd,
    onPressChange
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$4({
    isDisabled
  });
  const { isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const { isFocused, isSelected, optionProps, labelProps, descriptionProps } = $293f70390ea03370$export$497855f14858aa34(
    {
      key,
      isDisabled,
      "aria-label": props["aria-label"],
      isVirtualized
    },
    state,
    domRef
  );
  let itemProps = optionProps;
  const slots = reactExports.useMemo(
    () => menuItem({
      ...variantProps2,
      isDisabled,
      disableAnimation,
      hasTitleTextChild: typeof rendered === "string",
      hasDescriptionTextChild: typeof description === "string"
    }),
    [objectToDeps(variantProps2), isDisabled, disableAnimation, rendered, description]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  if (isReadOnly) {
    itemProps = removeEvents(itemProps);
  }
  const isHighlighted = shouldHighlightOnFocus && isFocused || (isMobile2 ? isHovered || isPressed : isHovered || isFocused && !isFocusVisible);
  const getItemProps = (props2 = {}) => ({
    ref: domRef,
    ...mergeProps$3(
      itemProps,
      isReadOnly ? {} : mergeProps$3(focusProps, pressProps),
      hoverProps,
      filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      props2
    ),
    "data-selectable": dataAttr(isSelectable),
    "data-focus": dataAttr(isFocused),
    "data-hover": dataAttr(isHighlighted),
    "data-disabled": dataAttr(isDisabled),
    "data-selected": dataAttr(isSelected),
    "data-pressed": dataAttr(isPressed),
    "data-focus-visible": dataAttr(isFocusVisible),
    className: slots.base({ class: clsx$5(baseStyles, props2.className) })
  });
  const getLabelProps = (props2 = {}) => ({
    ...mergeProps$3(labelProps, props2),
    "data-label": dataAttr(true),
    className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
  });
  const getDescriptionProps = (props2 = {}) => ({
    ...mergeProps$3(descriptionProps, props2),
    className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
  });
  const getWrapperProps = (props2 = {}) => ({
    ...mergeProps$3(props2),
    className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper })
  });
  const getSelectedIconProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "aria-hidden": dataAttr(true),
        "data-disabled": dataAttr(isDisabled),
        className: slots.selectedIcon({ class: classNames2 == null ? void 0 : classNames2.selectedIcon }),
        ...props2
      };
    },
    [isDisabled, slots, classNames2]
  );
  return {
    Component: Component2,
    domRef,
    slots,
    classNames: classNames2,
    isSelectable,
    isSelected,
    isDisabled,
    rendered,
    description,
    startContent,
    endContent,
    selectedIcon,
    hideSelectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getSelectedIconProps
  };
}
var ListboxItem = (props) => {
  const {
    Component: Component2,
    rendered,
    description,
    isSelectable,
    isSelected,
    isDisabled,
    selectedIcon,
    startContent,
    endContent,
    hideSelectedIcon,
    disableAnimation,
    getItemProps,
    getLabelProps,
    getWrapperProps,
    getDescriptionProps,
    getSelectedIconProps
  } = useListboxItem(props);
  const selectedContent = reactExports.useMemo(() => {
    const defaultIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ListboxSelectedIcon, { disableAnimation, isSelected });
    if (typeof selectedIcon === "function") {
      return selectedIcon({ icon: defaultIcon, isSelected, isDisabled });
    }
    if (selectedIcon)
      return selectedIcon;
    return defaultIcon;
  }, [selectedIcon, isSelected, isDisabled, disableAnimation]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getItemProps(), children: [
    startContent,
    description ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getDescriptionProps(), children: description })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getLabelProps(), children: rendered }),
    isSelectable && !hideSelectedIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSelectedIconProps(), children: selectedContent }),
    endContent
  ] });
};
ListboxItem.displayName = "HeroUI.ListboxItem";
var listbox_item_default = ListboxItem;
var ListboxSection = forwardRef(
  ({
    item,
    state,
    as: as2,
    variant,
    color: color2,
    disableAnimation,
    className,
    classNames: classNames2,
    hideSelectedIcon,
    showDivider = false,
    dividerProps = {},
    itemClasses,
    // removed title from props to avoid browsers showing a tooltip on hover
    // the title props is already inside the rendered prop
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    title,
    // removed items from props to avoid show in html element
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    items,
    ...otherProps
  }, _24) => {
    const Component2 = as2 || "li";
    const slots = reactExports.useMemo(() => menuSection(), []);
    const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
    const dividerStyles = clsx$5(classNames2 == null ? void 0 : classNames2.divider, dividerProps == null ? void 0 : dividerProps.className);
    const { itemProps, headingProps, groupProps } = $af383d3bef1cfdc9$export$c3f9f39876e4bc7({
      heading: item.rendered,
      "aria-label": item["aria-label"]
    });
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Component2,
      {
        "data-slot": "base",
        ...mergeProps$3(itemProps, otherProps),
        className: slots.base({ class: baseStyles }),
        children: [
          item.rendered && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              ...headingProps,
              className: slots.heading({ class: classNames2 == null ? void 0 : classNames2.heading }),
              "data-slot": "heading",
              children: item.rendered
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "ul",
            {
              ...groupProps,
              className: slots.group({ class: classNames2 == null ? void 0 : classNames2.group }),
              "data-has-title": !!item.rendered,
              "data-slot": "group",
              children: [
                [...item.childNodes].map((node2) => {
                  const { key: nodeKey, props: nodeProps } = node2;
                  let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_default,
                    {
                      classNames: itemClasses,
                      color: color2,
                      disableAnimation,
                      hideSelectedIcon,
                      item: node2,
                      state,
                      variant,
                      ...nodeProps
                    },
                    nodeKey
                  );
                  if (node2.wrapper) {
                    listboxItem = node2.wrapper(listboxItem);
                  }
                  return listboxItem;
                }),
                showDivider && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  divider_default,
                  {
                    as: "li",
                    className: slots.divider({
                      class: dividerStyles
                    }),
                    ...dividerProps
                  }
                )
              ]
            }
          )
        ]
      },
      item.key
    );
  }
);
ListboxSection.displayName = "HeroUI.ListboxSection";
var listbox_section_default = ListboxSection;
function useDataScrollOverflow(props = {}) {
  const {
    domRef,
    isEnabled = true,
    overflowCheck = "vertical",
    visibility = "auto",
    offset: offset2 = 0,
    onVisibilityChange,
    updateDeps = []
  } = props;
  const visibleRef = reactExports.useRef(visibility);
  reactExports.useEffect(() => {
    const el2 = domRef == null ? void 0 : domRef.current;
    if (!el2 || !isEnabled)
      return;
    const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
      if (visibility === "auto") {
        const both = `${prefix}${capitalize$2(suffix)}Scroll`;
        if (hasBefore && hasAfter) {
          el2.dataset[both] = "true";
          el2.removeAttribute(`data-${prefix}-scroll`);
          el2.removeAttribute(`data-${suffix}-scroll`);
        } else {
          el2.dataset[`${prefix}Scroll`] = hasBefore.toString();
          el2.dataset[`${suffix}Scroll`] = hasAfter.toString();
          el2.removeAttribute(`data-${prefix}-${suffix}-scroll`);
        }
      } else {
        const next2 = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
        if (next2 !== visibleRef.current) {
          onVisibilityChange == null ? void 0 : onVisibilityChange(next2);
          visibleRef.current = next2;
        }
      }
    };
    const checkOverflow2 = () => {
      var _a2, _b2;
      const directions2 = [
        { type: "vertical", prefix: "top", suffix: "bottom" },
        { type: "horizontal", prefix: "left", suffix: "right" }
      ];
      const listbox = el2.querySelector('ul[data-slot="list"]');
      const scrollHeight = +((_a2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-height")) != null ? _a2 : el2.scrollHeight);
      const scrollTop = +((_b2 = listbox == null ? void 0 : listbox.getAttribute("data-virtual-scroll-top")) != null ? _b2 : el2.scrollTop);
      for (const { type: type4, prefix, suffix } of directions2) {
        if (overflowCheck === type4 || overflowCheck === "both") {
          const hasBefore = type4 === "vertical" ? scrollTop > offset2 : el2.scrollLeft > offset2;
          const hasAfter = type4 === "vertical" ? scrollTop + el2.clientHeight + offset2 < scrollHeight : el2.scrollLeft + el2.clientWidth + offset2 < el2.scrollWidth;
          setAttributes(type4, hasBefore, hasAfter, prefix, suffix);
        }
      }
    };
    const clearOverflow = () => {
      ["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
        el2.removeAttribute(`data-${attr}-scroll`);
      });
    };
    checkOverflow2();
    el2.addEventListener("scroll", checkOverflow2, true);
    if (visibility !== "auto") {
      clearOverflow();
      if (visibility === "both") {
        el2.dataset.topBottomScroll = String(overflowCheck === "vertical");
        el2.dataset.leftRightScroll = String(overflowCheck === "horizontal");
      } else {
        el2.dataset.topBottomScroll = "false";
        el2.dataset.leftRightScroll = "false";
        ["top", "bottom", "left", "right"].forEach((attr) => {
          el2.dataset[`${attr}Scroll`] = String(visibility === attr);
        });
      }
    }
    return () => {
      el2.removeEventListener("scroll", checkOverflow2, true);
      clearOverflow();
    };
  }, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
function useScrollShadow(originalProps) {
  var _a2;
  const [props, variantProps2] = mapPropsVariants(originalProps, scrollShadow.variantKeys);
  const {
    ref,
    as: as2,
    children,
    className,
    style: style2,
    size: size2 = 40,
    offset: offset2 = 0,
    visibility = "auto",
    isEnabled = true,
    onVisibilityChange,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  useDataScrollOverflow({
    domRef,
    offset: offset2,
    visibility,
    isEnabled,
    onVisibilityChange,
    updateDeps: [children],
    overflowCheck: (_a2 = originalProps.orientation) != null ? _a2 : "vertical"
  });
  const styles2 = reactExports.useMemo(
    () => scrollShadow({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const getBaseProps = (props2 = {}) => {
    var _a22;
    return {
      ref: domRef,
      className: styles2,
      "data-orientation": (_a22 = originalProps.orientation) != null ? _a22 : "vertical",
      style: {
        "--scroll-shadow-size": `${size2}px`,
        ...style2,
        ...props2.style
      },
      ...otherProps,
      ...props2
    };
  };
  return { Component: Component2, styles: styles2, domRef, children, getBaseProps };
}
var getItemSizesForCollection = (collection, itemHeight) => {
  const sizes = [];
  for (const item of collection) {
    if (item.type === "section") {
      sizes.push(([...item.childNodes].length + 1) * itemHeight);
    } else {
      sizes.push(itemHeight);
    }
  }
  return sizes;
};
var getScrollState = (element2) => {
  if (!element2 || element2.scrollTop === void 0 || element2.clientHeight === void 0 || element2.scrollHeight === void 0) {
    return {
      isTop: false,
      isBottom: false,
      isMiddle: false
    };
  }
  const isAtTop = element2.scrollTop === 0;
  const isAtBottom = Math.ceil(element2.scrollTop + element2.clientHeight) >= element2.scrollHeight;
  const isInMiddle = !isAtTop && !isAtBottom;
  return {
    isTop: isAtTop,
    isBottom: isAtBottom,
    isMiddle: isInMiddle
  };
};
var VirtualizedListbox = (props) => {
  var _a2;
  const {
    Component: Component2,
    state,
    color: color2,
    variant,
    itemClasses,
    getBaseProps,
    topContent,
    bottomContent,
    hideEmptyContent,
    hideSelectedIcon,
    shouldHighlightOnFocus,
    disableAnimation,
    getEmptyContentProps,
    getListProps,
    scrollShadowProps
  } = props;
  const { virtualization } = props;
  if (!virtualization || !isEmpty(virtualization) && !virtualization.maxListboxHeight && !virtualization.itemHeight) {
    throw new Error(
      "You are using a virtualized listbox. VirtualizedListbox requires 'virtualization' props with 'maxListboxHeight' and 'itemHeight' properties. This error might have originated from autocomplete components that use VirtualizedListbox. Please provide these props to use the virtualized listbox."
    );
  }
  const { maxListboxHeight, itemHeight } = virtualization;
  const listHeight = Math.min(maxListboxHeight, itemHeight * state.collection.size);
  const parentRef = reactExports.useRef(null);
  const itemSizes = reactExports.useMemo(
    () => getItemSizesForCollection([...state.collection], itemHeight),
    [state.collection, itemHeight]
  );
  const rowVirtualizer = useVirtualizer({
    count: [...state.collection].length,
    getScrollElement: () => parentRef.current,
    estimateSize: (i2) => itemSizes[i2]
  });
  const virtualItems = rowVirtualizer.getVirtualItems();
  const virtualScrollHeight = rowVirtualizer.getTotalSize();
  const { getBaseProps: getBasePropsScrollShadow } = useScrollShadow({ ...scrollShadowProps });
  const renderRow = (virtualItem) => {
    var _a22;
    const item = [...state.collection][virtualItem.index];
    if (!item) {
      return null;
    }
    const itemProps = {
      color: color2,
      item,
      state,
      variant,
      disableAnimation,
      hideSelectedIcon,
      ...item.props
    };
    const virtualizerStyle = {
      position: "absolute",
      top: 0,
      left: 0,
      width: "100%",
      height: `${virtualItem.size}px`,
      transform: `translateY(${virtualItem.start}px)`
    };
    if (item.type === "section") {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_section_default,
        {
          ...itemProps,
          itemClasses,
          style: { ...virtualizerStyle, ...itemProps.style }
        },
        item.key
      );
    }
    let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
      listbox_item_default,
      {
        ...itemProps,
        classNames: mergeProps$3(itemClasses, (_a22 = item.props) == null ? void 0 : _a22.classNames),
        shouldHighlightOnFocus,
        style: { ...virtualizerStyle, ...itemProps.style }
      },
      item.key
    );
    if (item.wrapper) {
      listboxItem = item.wrapper(listboxItem);
    }
    return listboxItem;
  };
  const [scrollState, setScrollState] = reactExports.useState({
    isTop: false,
    isBottom: true,
    isMiddle: false
  });
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Component2,
    {
      ...getListProps(),
      "data-virtual-scroll-height": virtualScrollHeight,
      "data-virtual-scroll-top": (_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.scrollTop,
      children: [
        !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ...filterDOMProps(getBasePropsScrollShadow()),
            ref: parentRef,
            style: {
              height: maxListboxHeight,
              overflow: "auto"
            },
            onScroll: (e2) => {
              setScrollState(getScrollState(e2.target));
            },
            children: listHeight > 0 && itemHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                style: {
                  height: `${virtualScrollHeight}px`,
                  width: "100%",
                  position: "relative"
                },
                children: virtualItems.map((virtualItem) => renderRow(virtualItem))
              }
            )
          }
        )
      ]
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
};
var virtualized_listbox_default = VirtualizedListbox;
var Listbox = forwardRef(function Listbox2(props, ref) {
  const { isVirtualized, ...restProps } = props;
  const useListboxProps = useListbox({ ...restProps, ref });
  const {
    Component: Component2,
    state,
    color: color2,
    variant,
    itemClasses,
    getBaseProps,
    topContent,
    bottomContent,
    hideEmptyContent,
    hideSelectedIcon,
    shouldHighlightOnFocus,
    disableAnimation,
    getEmptyContentProps,
    getListProps
  } = useListboxProps;
  if (isVirtualized) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(virtualized_listbox_default, { ...props, ...useListboxProps });
  }
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getListProps(), children: [
    !state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyContentProps() }) }),
    [...state.collection].map((item) => {
      var _a2;
      const itemProps = {
        color: color2,
        item,
        state,
        variant,
        disableAnimation,
        hideSelectedIcon,
        ...item.props
      };
      if (item.type === "section") {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_section_default, { ...itemProps, itemClasses }, item.key);
      }
      let listboxItem = /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_item_default,
        {
          ...itemProps,
          classNames: mergeProps$3(itemClasses, (_a2 = item.props) == null ? void 0 : _a2.classNames),
          shouldHighlightOnFocus
        },
        item.key
      );
      if (item.wrapper) {
        listboxItem = item.wrapper(listboxItem);
      }
      return listboxItem;
    })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    topContent,
    content2,
    bottomContent
  ] });
});
var listbox_default = Listbox;
var Select$1 = forwardRef(function Select2(props, ref) {
  var _a2;
  const {
    Component: Component2,
    state,
    label,
    hasHelper,
    isLoading,
    triggerRef,
    selectorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}),
    description,
    errorMessage,
    isInvalid,
    startContent,
    endContent,
    placeholder,
    renderValue,
    shouldLabelBeOutside,
    disableAnimation,
    getBaseProps,
    getLabelProps,
    getTriggerProps,
    getValueProps,
    getListboxProps,
    getPopoverProps,
    getSpinnerProps,
    getMainWrapperProps,
    getInnerWrapperProps,
    getHiddenSelectProps,
    getHelperWrapperProps,
    getListboxWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getSelectorIconProps,
    isClearable,
    getClearButtonProps,
    getEndWrapperProps,
    getEndContentProps
  } = useSelect({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const clonedIcon = reactExports.cloneElement(selectorIcon, getSelectorIconProps());
  const clearButton = reactExports.useMemo(() => {
    var _a22;
    if (isClearable && ((_a22 = state.selectedItems) == null ? void 0 : _a22.length)) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) });
    }
    return null;
  }, [isClearable, getClearButtonProps, (_a2 = state.selectedItems) == null ? void 0 : _a2.length]);
  const end = reactExports.useMemo(() => {
    if (clearButton) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getEndWrapperProps(), children: [
        clearButton,
        endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getEndContentProps(), children: endContent })
      ] });
    }
    return endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getEndContentProps(), children: endContent });
  }, [clearButton, endContent, getEndWrapperProps, getEndContentProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const renderSelectedItem = reactExports.useMemo(() => {
    var _a22;
    if (!((_a22 = state.selectedItems) == null ? void 0 : _a22.length))
      return placeholder;
    if (renderValue && typeof renderValue === "function") {
      const mappedItems = [...state.selectedItems].map((item) => ({
        key: item.key,
        data: item.value,
        type: item.type,
        props: item.props,
        textValue: item.textValue,
        rendered: item.rendered,
        "aria-label": item["aria-label"]
      }));
      return renderValue(mappedItems);
    }
    return state.selectedItems.map((item) => item.textValue).join(", ");
  }, [state.selectedItems, renderValue, placeholder]);
  const renderIndicator = reactExports.useMemo(() => {
    if (isLoading) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { ...getSpinnerProps() });
    }
    return clonedIcon;
  }, [isLoading, clonedIcon, getSpinnerProps]);
  const popoverContent = reactExports.useMemo(
    () => state.isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(scroll_shadow_default, { ...getListboxWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_default, { ...getListboxProps() }) }) }) : null,
    [state.isOpen, getPopoverProps, state, triggerRef, getListboxWrapperProps, getListboxProps]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(HiddenSelect, { ...getHiddenSelectProps() }),
    shouldLabelBeOutside ? labelContent : null,
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getTriggerProps(), children: [
        !shouldLabelBeOutside ? labelContent : null,
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
          startContent,
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getValueProps(), children: renderSelectedItem }),
          endContent && state.selectedItems && /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { elementType: "span", children: "," }),
          end
        ] }),
        renderIndicator
      ] }),
      helperWrapper
    ] }),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var select_default = Select$1;
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = /* @__PURE__ */ new WeakMap();
function $aa519ee6cf463259$export$68e648cbec363a18(state, index2) {
  let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
  if (!data)
    throw new Error("Unknown slider state");
  return `${data.id}-${index2}`;
}
function $bcca50147b47f54d$export$56b2c08e277f365(props, state, trackRef) {
  let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1(props);
  let isVertical = props.orientation === "vertical";
  var _labelProps_id;
  $aa519ee6cf463259$export$d6c8d9636a3dc49c.set(state, {
    id: (_labelProps_id = labelProps.id) !== null && _labelProps_id !== void 0 ? _labelProps_id : fieldProps.id,
    "aria-describedby": props["aria-describedby"],
    "aria-details": props["aria-details"]
  });
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  const realTimeTrackDraggingIndex = reactExports.useRef(null);
  const reverseX = direction === "rtl";
  const currentPosition = reactExports.useRef(null);
  const { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
    onMoveStart() {
      currentPosition.current = null;
    },
    onMove({ deltaX, deltaY }) {
      if (!trackRef.current)
        return;
      let { height, width } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null)
        currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size2;
      let delta = isVertical ? deltaY : deltaX;
      if (isVertical || reverseX)
        delta = -delta;
      currentPosition.current += delta;
      if (realTimeTrackDraggingIndex.current != null && trackRef.current) {
        const percent2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size2, 0, 1);
        state.setThumbPercent(realTimeTrackDraggingIndex.current, percent2);
      }
    },
    onMoveEnd() {
      if (realTimeTrackDraggingIndex.current != null) {
        state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
        realTimeTrackDraggingIndex.current = null;
      }
    }
  });
  let currentPointer = reactExports.useRef(void 0);
  let onDownTrack = (e2, id2, clientX, clientY) => {
    if (trackRef.current && !props.isDisabled && state.values.every((_24, i2) => !state.isThumbDragging(i2))) {
      let { height, width, top: top2, left: left2 } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      const trackPosition = isVertical ? top2 : left2;
      const clickPosition = isVertical ? clientY : clientX;
      const offset2 = clickPosition - trackPosition;
      let percent2 = offset2 / size2;
      if (direction === "rtl" || isVertical)
        percent2 = 1 - percent2;
      let value2 = state.getPercentValue(percent2);
      let closestThumb;
      let split2 = state.values.findIndex((v2) => value2 - v2 < 0);
      if (split2 === 0)
        closestThumb = split2;
      else if (split2 === -1)
        closestThumb = state.values.length - 1;
      else {
        let lastLeft = state.values[split2 - 1];
        let firstRight = state.values[split2];
        if (Math.abs(lastLeft - value2) < Math.abs(firstRight - value2))
          closestThumb = split2 - 1;
        else
          closestThumb = split2;
      }
      if (closestThumb >= 0 && state.isThumbEditable(closestThumb)) {
        e2.preventDefault();
        realTimeTrackDraggingIndex.current = closestThumb;
        state.setFocusedThumb(closestThumb);
        currentPointer.current = id2;
        state.setThumbDragging(realTimeTrackDraggingIndex.current, true);
        state.setThumbValue(closestThumb, value2);
        addGlobalListener(window, "mouseup", onUpTrack, false);
        addGlobalListener(window, "touchend", onUpTrack, false);
        addGlobalListener(window, "pointerup", onUpTrack, false);
      } else
        realTimeTrackDraggingIndex.current = null;
    }
  };
  let onUpTrack = (e2) => {
    var _e_changedTouches;
    var _e_pointerId;
    let id2 = (_e_pointerId = e2.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e2.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
    if (id2 === currentPointer.current) {
      if (realTimeTrackDraggingIndex.current != null) {
        state.setThumbDragging(realTimeTrackDraggingIndex.current, false);
        realTimeTrackDraggingIndex.current = null;
      }
      removeGlobalListener(window, "mouseup", onUpTrack, false);
      removeGlobalListener(window, "touchend", onUpTrack, false);
      removeGlobalListener(window, "pointerup", onUpTrack, false);
    }
  };
  if ("htmlFor" in labelProps && labelProps.htmlFor) {
    delete labelProps.htmlFor;
    labelProps.onClick = () => {
      var _document_getElementById;
      (_document_getElementById = document.getElementById($aa519ee6cf463259$export$68e648cbec363a18(state, 0))) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
      $507fabe10e71c6fb$export$8397ddfc504fdb9a$2("keyboard");
    };
  }
  return {
    labelProps,
    // The root element of the Slider will have role="group" to group together
    // all the thumb inputs in the Slider.  The label of the Slider will
    // be used to label the group.
    groupProps: {
      role: "group",
      ...fieldProps
    },
    trackProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      onMouseDown(e2) {
        if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
          return;
        onDownTrack(e2, void 0, e2.clientX, e2.clientY);
      },
      onPointerDown(e2) {
        if (e2.pointerType === "mouse" && (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey))
          return;
        onDownTrack(e2, e2.pointerId, e2.clientX, e2.clientY);
      },
      onTouchStart(e2) {
        onDownTrack(e2, e2.changedTouches[0].identifier, e2.changedTouches[0].clientX, e2.changedTouches[0].clientY);
      },
      style: {
        position: "relative",
        touchAction: "none"
      }
    }, moveProps),
    outputProps: {
      htmlFor: state.values.map((_24, index2) => $aa519ee6cf463259$export$68e648cbec363a18(state, index2)).join(" "),
      "aria-live": "off"
    }
  };
}
function $47b897dc8cdb026b$export$8d15029008292ae(opts2, state) {
  let { index: index2 = 0, isRequired, validationState, isInvalid, trackRef, inputRef, orientation = state.orientation, name: name2 } = opts2;
  let isDisabled = opts2.isDisabled || state.isDisabled;
  let isVertical = orientation === "vertical";
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
  var _opts_arialabelledby;
  const { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f$1({
    ...opts2,
    id: $aa519ee6cf463259$export$68e648cbec363a18(state, index2),
    "aria-labelledby": `${data.id} ${(_opts_arialabelledby = opts2["aria-labelledby"]) !== null && _opts_arialabelledby !== void 0 ? _opts_arialabelledby : ""}`.trim()
  });
  const value2 = state.values[index2];
  const focusInput = reactExports.useCallback(() => {
    if (inputRef.current)
      $7215afc6de606d6b$export$de79e2c695e052f3$5(inputRef.current);
  }, [
    inputRef
  ]);
  const isFocused = state.focusedThumb === index2;
  reactExports.useEffect(() => {
    if (isFocused)
      focusInput();
  }, [
    isFocused,
    focusInput
  ]);
  let reverseX = direction === "rtl";
  let currentPosition = reactExports.useRef(null);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd$2({
    onKeyDown(e2) {
      let { getThumbMaxValue, getThumbMinValue, decrementThumb, incrementThumb, setThumbValue, setThumbDragging, pageSize } = state;
      if (!/^(PageUp|PageDown|Home|End)$/.test(e2.key)) {
        e2.continuePropagation();
        return;
      }
      e2.preventDefault();
      setThumbDragging(index2, true);
      switch (e2.key) {
        case "PageUp":
          incrementThumb(index2, pageSize);
          break;
        case "PageDown":
          decrementThumb(index2, pageSize);
          break;
        case "Home":
          setThumbValue(index2, getThumbMinValue(index2));
          break;
        case "End":
          setThumbValue(index2, getThumbMaxValue(index2));
          break;
      }
      setThumbDragging(index2, false);
    }
  });
  let { moveProps } = $e8a7022cf87cba2a$export$36da96379f79f245({
    onMoveStart() {
      currentPosition.current = null;
      state.setThumbDragging(index2, true);
    },
    onMove({ deltaX, deltaY, pointerType, shiftKey }) {
      const { getThumbPercent, setThumbPercent, decrementThumb, incrementThumb, step, pageSize } = state;
      if (!trackRef.current)
        return;
      let { width, height } = trackRef.current.getBoundingClientRect();
      let size2 = isVertical ? height : width;
      if (currentPosition.current == null)
        currentPosition.current = getThumbPercent(index2) * size2;
      if (pointerType === "keyboard") {
        if (deltaX > 0 && reverseX || deltaX < 0 && !reverseX || deltaY > 0)
          decrementThumb(index2, shiftKey ? pageSize : step);
        else
          incrementThumb(index2, shiftKey ? pageSize : step);
      } else {
        let delta = isVertical ? deltaY : deltaX;
        if (isVertical || reverseX)
          delta = -delta;
        currentPosition.current += delta;
        setThumbPercent(index2, $9446cca9a3875146$export$7d15b64cf5a3a4c4(currentPosition.current / size2, 0, 1));
      }
    },
    onMoveEnd() {
      state.setThumbDragging(index2, false);
    }
  });
  state.setThumbEditable(index2, !isDisabled);
  const { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2($3ef42575df84b30b$export$9d1611c77c2fe928$9(opts2, {
    onFocus: () => state.setFocusedThumb(index2),
    onBlur: () => state.setFocusedThumb(void 0)
  }), inputRef);
  let currentPointer = reactExports.useRef(void 0);
  let onDown = (id2) => {
    focusInput();
    currentPointer.current = id2;
    state.setThumbDragging(index2, true);
    addGlobalListener(window, "mouseup", onUp, false);
    addGlobalListener(window, "touchend", onUp, false);
    addGlobalListener(window, "pointerup", onUp, false);
  };
  let onUp = (e2) => {
    var _e_changedTouches;
    var _e_pointerId;
    let id2 = (_e_pointerId = e2.pointerId) !== null && _e_pointerId !== void 0 ? _e_pointerId : (_e_changedTouches = e2.changedTouches) === null || _e_changedTouches === void 0 ? void 0 : _e_changedTouches[0].identifier;
    if (id2 === currentPointer.current) {
      focusInput();
      state.setThumbDragging(index2, false);
      removeGlobalListener(window, "mouseup", onUp, false);
      removeGlobalListener(window, "touchend", onUp, false);
      removeGlobalListener(window, "pointerup", onUp, false);
    }
  };
  let thumbPosition = state.getThumbPercent(index2);
  if (isVertical || direction === "rtl")
    thumbPosition = 1 - thumbPosition;
  let interactions = !isDisabled ? $3ef42575df84b30b$export$9d1611c77c2fe928$9(keyboardProps, moveProps, {
    onMouseDown: (e2) => {
      if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
        return;
      onDown();
    },
    onPointerDown: (e2) => {
      if (e2.button !== 0 || e2.altKey || e2.ctrlKey || e2.metaKey)
        return;
      onDown(e2.pointerId);
    },
    onTouchStart: (e2) => {
      onDown(e2.changedTouches[0].identifier);
    }
  }) : {};
  $99facab73266f662$export$5add1d006293d136(inputRef, value2, (v2) => {
    state.setThumbValue(index2, v2);
  });
  return {
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, fieldProps, {
      type: "range",
      tabIndex: !isDisabled ? 0 : void 0,
      min: state.getThumbMinValue(index2),
      max: state.getThumbMaxValue(index2),
      step: state.step,
      value: value2,
      name: name2,
      disabled: isDisabled,
      "aria-orientation": orientation,
      "aria-valuetext": state.getThumbValueLabel(index2),
      "aria-required": isRequired || void 0,
      "aria-invalid": isInvalid || validationState === "invalid" || void 0,
      "aria-errormessage": opts2["aria-errormessage"],
      "aria-describedby": [
        data["aria-describedby"],
        opts2["aria-describedby"]
      ].filter(Boolean).join(" "),
      "aria-details": [
        data["aria-details"],
        opts2["aria-details"]
      ].filter(Boolean).join(" "),
      onChange: (e2) => {
        state.setThumbValue(index2, parseFloat(e2.target.value));
      }
    }),
    thumbProps: {
      ...interactions,
      style: {
        position: "absolute",
        [isVertical ? "top" : "left"]: `${thumbPosition * 100}%`,
        transform: "translate(-50%, -50%)",
        touchAction: "none"
      }
    },
    labelProps,
    isDragging: state.isThumbDragging(index2),
    isDisabled,
    isFocused
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a$2(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$2(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$2(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$2 = "default";
let $14c0b72509d70225$var$savedUserSelect$2 = "";
let $14c0b72509d70225$var$modifiedElementMap$2 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$2(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$2 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$2 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$2 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$2.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$2(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$2 !== "disabled")
      return;
    $14c0b72509d70225$var$state$2 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$2 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$2 || "";
          $14c0b72509d70225$var$savedUserSelect$2 = "";
          $14c0b72509d70225$var$state$2 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$2.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$2.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$2.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$2 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$2.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$2(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$2);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$2 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$2 = class $f6c31cce2adf654f$var$PressEvent10 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$2, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$2 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$2 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$2(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$2(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$2("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$2("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$2(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$2(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$2(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$2(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$2(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$2(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$2(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$2(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$2(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$2]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$2] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$2(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$2(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$2(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$2))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$2;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$2((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$2]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$2(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$2(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$2(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$2(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$2(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$2(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$2(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$2(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$2(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$2(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$2 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$2(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$2.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext$5 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$5 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$5);
const $b5e257d569688ac6$var$IsSSRContext$5 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$5 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$5(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$5);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$5.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$5.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$5.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$5(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$5);
  let counter = $b5e257d569688ac6$var$useCounter$5(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$5(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$5());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$5.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$5 : $b5e257d569688ac6$var$useLegacySSRSafeId$5;
function $b5e257d569688ac6$var$getSnapshot$5() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$5() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$5(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$5() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$5, $b5e257d569688ac6$var$getSnapshot$5, $b5e257d569688ac6$var$getServerSnapshot$5);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$5);
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = false;
let $6179b936705e76d3$var$hoverCount$3 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$3() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$3(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$3();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$3() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$3);
  $6179b936705e76d3$var$hoverCount$3++;
  return () => {
    $6179b936705e76d3$var$hoverCount$3--;
    if ($6179b936705e76d3$var$hoverCount$3 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$3);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$3(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$3, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$3 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$5 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$5 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$5(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$5.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$5.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$5 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$5] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$5(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$5 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5();
let $1e5a04cdaf7d1af8$var$listeners$5 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$5() {
  $1e5a04cdaf7d1af8$var$currentLocale$5 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$5();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$5)
    listener($1e5a04cdaf7d1af8$var$currentLocale$5);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$5() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$5();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$5);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$5.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$5);
    $1e5a04cdaf7d1af8$var$listeners$5.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$5.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$5.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$5);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$5 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$5();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$5);
  return context || defaultLocale;
}
function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5();
  return reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, options), [
    locale2,
    options
  ]);
}
function useSliderThumb(props) {
  const {
    ref,
    as: as2,
    state,
    index: index2,
    name: name2,
    trackRef,
    className,
    tooltipProps,
    isVertical,
    showTooltip,
    getTooltipValue,
    formatOptions,
    renderThumb,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const inputRef = reactExports.useRef(null);
  const numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44(formatOptions);
  const { thumbProps, inputProps, isDragging: isDragging2, isFocused } = $47b897dc8cdb026b$export$8d15029008292ae(
    {
      index: index2,
      trackRef,
      inputRef,
      name: name2,
      ...otherProps
    },
    state
  );
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$3({
    isDisabled: state.isDisabled
  });
  const { focusProps, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$2({
    isDisabled: state.isDisabled
  });
  const getThumbProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "thumb",
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-dragging": dataAttr(isDragging2),
      "data-focused": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "aria-label": props2["aria-label"] || `Slider thumb ${index2 !== void 0 ? `${index2 + 1}` : ""}`,
      ...mergeProps$3(thumbProps, pressProps, hoverProps, otherProps),
      className,
      ...props2
    };
  };
  const getTooltipProps = () => {
    const stateValue = (tooltipProps == null ? void 0 : tooltipProps.content) ? tooltipProps.content : getTooltipValue ? state.values.length === 1 ? getTooltipValue(state.values[index2 != null ? index2 : 0]) : getTooltipValue(state.values, index2 != null ? index2 : 0) : state.values[index2 != null ? index2 : 0];
    const value2 = numberFormatter && typeof stateValue === "number" ? numberFormatter.format(stateValue) : stateValue;
    return {
      ...tooltipProps,
      placement: (tooltipProps == null ? void 0 : tooltipProps.placement) ? tooltipProps == null ? void 0 : tooltipProps.placement : isVertical ? "right" : "top",
      content: (tooltipProps == null ? void 0 : tooltipProps.content) ? tooltipProps == null ? void 0 : tooltipProps.content : value2,
      updatePositionDeps: [isDragging2, isHovered, isFocused, isFocusVisible, value2],
      isOpen: (tooltipProps == null ? void 0 : tooltipProps.isOpen) !== void 0 ? tooltipProps == null ? void 0 : tooltipProps.isOpen : isHovered || isDragging2 || isFocused || isFocusVisible,
      role: "tooltip",
      "aria-label": `Current value: ${value2}`
    };
  };
  const getInputProps = (props2 = {}) => {
    return {
      ref: inputRef,
      ...mergeProps$3(inputProps, focusProps),
      ...props2
    };
  };
  return {
    Component: Component2,
    index: index2,
    showTooltip,
    renderThumb,
    getThumbProps,
    getTooltipProps,
    getInputProps
  };
}
var SliderThumb = forwardRef((props, ref) => {
  const {
    Component: Component2,
    index: index2,
    renderThumb,
    showTooltip,
    getTooltipProps,
    getThumbProps,
    getInputProps
  } = useSliderThumb({
    ...props,
    ref
  });
  const thumbProps = {
    ...getThumbProps(),
    index: index2,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getInputProps() }) })
  };
  const content2 = renderFn({
    Component: Component2,
    props: thumbProps,
    renderCustom: renderThumb
  });
  return showTooltip ? /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { ...getTooltipProps(), children: content2 }) : content2;
});
SliderThumb.displayName = "HeroUI.SliderThumb";
var slider_thumb_default = SliderThumb;
const $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE = 0;
const $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE = 100;
const $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE = 1;
function $28f99e3e86e6ec45$export$e5fda3247f5d67f9(props) {
  const { isDisabled = false, minValue = $28f99e3e86e6ec45$var$DEFAULT_MIN_VALUE, maxValue = $28f99e3e86e6ec45$var$DEFAULT_MAX_VALUE, numberFormatter: formatter, step = $28f99e3e86e6ec45$var$DEFAULT_STEP_VALUE, orientation = "horizontal" } = props;
  let pageSize = reactExports.useMemo(() => {
    let calcPageSize = (maxValue - minValue) / 10;
    calcPageSize = $9446cca9a3875146$export$cb6e0bb50bc19463(calcPageSize, 0, calcPageSize + step, step);
    return Math.max(calcPageSize, step);
  }, [
    step,
    maxValue,
    minValue
  ]);
  let restrictValues = reactExports.useCallback((values2) => values2 === null || values2 === void 0 ? void 0 : values2.map((val, idx) => {
    let min2 = idx === 0 ? minValue : values2[idx - 1];
    let max2 = idx === values2.length - 1 ? maxValue : values2[idx + 1];
    return $9446cca9a3875146$export$cb6e0bb50bc19463(val, min2, max2, step);
  }), [
    minValue,
    maxValue,
    step
  ]);
  let value2 = reactExports.useMemo(() => restrictValues($28f99e3e86e6ec45$var$convertValue(props.value)), [
    props.value
  ]);
  let defaultValue2 = reactExports.useMemo(() => {
    var _convertValue;
    return restrictValues((_convertValue = $28f99e3e86e6ec45$var$convertValue(props.defaultValue)) !== null && _convertValue !== void 0 ? _convertValue : [
      minValue
    ]);
  }, [
    props.defaultValue,
    minValue
  ]);
  let onChange = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChange);
  let onChangeEnd = $28f99e3e86e6ec45$var$createOnChange(props.value, props.defaultValue, props.onChangeEnd);
  const [values, setValuesState] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, defaultValue2, onChange);
  const [isDraggings, setDraggingsState] = reactExports.useState(new Array(values.length).fill(false));
  const isEditablesRef = reactExports.useRef(new Array(values.length).fill(true));
  const [focusedIndex, setFocusedIndex] = reactExports.useState(void 0);
  const valuesRef = reactExports.useRef(values);
  const isDraggingsRef = reactExports.useRef(isDraggings);
  let setValues = (values2) => {
    valuesRef.current = values2;
    setValuesState(values2);
  };
  let setDraggings = (draggings) => {
    isDraggingsRef.current = draggings;
    setDraggingsState(draggings);
  };
  function getValuePercent(value3) {
    return (value3 - minValue) / (maxValue - minValue);
  }
  function getThumbMinValue(index2) {
    return index2 === 0 ? minValue : values[index2 - 1];
  }
  function getThumbMaxValue(index2) {
    return index2 === values.length - 1 ? maxValue : values[index2 + 1];
  }
  function isThumbEditable(index2) {
    return isEditablesRef.current[index2];
  }
  function setThumbEditable(index2, editable) {
    isEditablesRef.current[index2] = editable;
  }
  function updateValue(index2, value3) {
    if (isDisabled || !isThumbEditable(index2))
      return;
    const thisMin = getThumbMinValue(index2);
    const thisMax = getThumbMaxValue(index2);
    value3 = $9446cca9a3875146$export$cb6e0bb50bc19463(value3, thisMin, thisMax, step);
    let newValues = $28f99e3e86e6ec45$var$replaceIndex(valuesRef.current, index2, value3);
    setValues(newValues);
  }
  function updateDragging(index2, dragging) {
    if (isDisabled || !isThumbEditable(index2))
      return;
    if (dragging)
      valuesRef.current = values;
    const wasDragging = isDraggingsRef.current[index2];
    isDraggingsRef.current = $28f99e3e86e6ec45$var$replaceIndex(isDraggingsRef.current, index2, dragging);
    setDraggings(isDraggingsRef.current);
    if (onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean))
      onChangeEnd(valuesRef.current);
  }
  function getFormattedValue(value3) {
    return formatter.format(value3);
  }
  function setThumbPercent(index2, percent2) {
    updateValue(index2, getPercentValue(percent2));
  }
  function getRoundedValue(value3) {
    return Math.round((value3 - minValue) / step) * step + minValue;
  }
  function getPercentValue(percent2) {
    const val = percent2 * (maxValue - minValue) + minValue;
    return $9446cca9a3875146$export$7d15b64cf5a3a4c4(getRoundedValue(val), minValue, maxValue);
  }
  function incrementThumb(index2, stepSize = 1) {
    let s2 = Math.max(stepSize, step);
    updateValue(index2, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index2] + s2, minValue, maxValue, step));
  }
  function decrementThumb(index2, stepSize = 1) {
    let s2 = Math.max(stepSize, step);
    updateValue(index2, $9446cca9a3875146$export$cb6e0bb50bc19463(values[index2] - s2, minValue, maxValue, step));
  }
  return {
    values,
    getThumbValue: (index2) => values[index2],
    setThumbValue: updateValue,
    setThumbPercent,
    isThumbDragging: (index2) => isDraggings[index2],
    setThumbDragging: updateDragging,
    focusedThumb: focusedIndex,
    setFocusedThumb: setFocusedIndex,
    getThumbPercent: (index2) => getValuePercent(values[index2]),
    getValuePercent,
    getThumbValueLabel: (index2) => getFormattedValue(values[index2]),
    getFormattedValue,
    getThumbMinValue,
    getThumbMaxValue,
    getPercentValue,
    isThumbEditable,
    setThumbEditable,
    incrementThumb,
    decrementThumb,
    step,
    pageSize,
    orientation,
    isDisabled
  };
}
function $28f99e3e86e6ec45$var$replaceIndex(array4, index2, value2) {
  if (array4[index2] === value2)
    return array4;
  return [
    ...array4.slice(0, index2),
    value2,
    ...array4.slice(index2 + 1)
  ];
}
function $28f99e3e86e6ec45$var$convertValue(value2) {
  if (value2 == null)
    return void 0;
  return Array.isArray(value2) ? value2 : [
    value2
  ];
}
function $28f99e3e86e6ec45$var$createOnChange(value2, defaultValue2, onChange) {
  return (newValue) => {
    if (typeof value2 === "number" || typeof defaultValue2 === "number")
      onChange === null || onChange === void 0 ? void 0 : onChange(newValue[0]);
    else
      onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
  };
}
function useSlider(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, slider.variantKeys);
  const {
    ref,
    as: as2,
    name: name2,
    label,
    formatOptions,
    value: valueProp,
    maxValue = 100,
    minValue = 0,
    step = 1,
    showSteps = false,
    showTooltip = false,
    orientation = "horizontal",
    marks = [],
    startContent,
    endContent,
    fillOffset: fillOffset2,
    className,
    classNames: classNames2,
    renderThumb,
    renderLabel,
    renderValue,
    onChange,
    onChangeEnd,
    getValue: getValue2,
    getTooltipValue,
    tooltipValueFormatOptions = formatOptions,
    tooltipProps: userTooltipProps = {},
    ...otherProps
  } = props;
  const isFixedValue = minValue === maxValue;
  if (isFixedValue) {
    warn$2("Min and max values should not be the same. This may cause unexpected behavior.");
  }
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const domRef = useDOMRef(ref);
  const trackRef = reactExports.useRef(null);
  const numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44(formatOptions);
  const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$5();
  const clampValue = reactExports.useCallback(
    (valueToClamp) => {
      return Math.min(Math.max(valueToClamp, minValue), maxValue);
    },
    [minValue, maxValue]
  );
  const validatedValue = reactExports.useMemo(() => {
    if (isFixedValue)
      return minValue;
    if (valueProp === void 0)
      return void 0;
    if (Array.isArray(valueProp)) {
      return valueProp.map(clampValue);
    }
    return clampValue(valueProp);
  }, [valueProp, clampValue, isFixedValue, minValue]);
  const state = $28f99e3e86e6ec45$export$e5fda3247f5d67f9({
    ...otherProps,
    value: validatedValue,
    isDisabled: (_c2 = originalProps == null ? void 0 : originalProps.isDisabled) != null ? _c2 : false,
    orientation,
    step,
    minValue,
    maxValue,
    numberFormatter,
    onChange,
    onChangeEnd
  });
  const tooltipProps = {
    offset: 5,
    delay: 0,
    size: "sm",
    showArrow: true,
    color: (originalProps == null ? void 0 : originalProps.color) ? originalProps == null ? void 0 : originalProps.color : (_d = slider.defaultVariants) == null ? void 0 : _d.color,
    isDisabled: originalProps.isDisabled,
    ...userTooltipProps
  };
  const { groupProps, trackProps, labelProps, outputProps } = $bcca50147b47f54d$export$56b2c08e277f365(
    originalProps,
    state,
    trackRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$3({ isDisabled: originalProps.isDisabled });
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const isVertical = orientation === "vertical";
  const hasMarks = (marks == null ? void 0 : marks.length) > 0;
  const hasSingleThumb = fillOffset2 === void 0 ? state.values.length === 1 : false;
  const slots = reactExports.useMemo(
    () => slider({
      ...variantProps2,
      hasMarks,
      disableAnimation,
      hasSingleThumb,
      isVertical
    }),
    [objectToDeps(variantProps2), isVertical, disableAnimation, hasSingleThumb, hasMarks]
  );
  const [startOffset, endOffset] = [
    state.values.length > 1 ? state.getThumbPercent(0) : fillOffset2 !== void 0 ? state.getValuePercent(fillOffset2) : 0,
    state.getThumbPercent(state.values.length - 1)
  ].sort();
  const value2 = state.values.length === 1 ? numberFormatter.format(state.values[0]) : numberFormatter.formatRange(state.values[0], state.values[state.values.length - 1]);
  const steps = showSteps ? Math.floor((maxValue - minValue) / step) + 1 : 0;
  const getBaseProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-orientation": state.orientation,
      "data-slot": "base",
      "data-hover": isHovered,
      className: slots.base({ class: baseStyles }),
      ...mergeProps$3(
        groupProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      )
    };
  };
  const getLabelWrapperProps = (props2 = {}) => {
    return {
      className: slots.labelWrapper({ class: classNames2 == null ? void 0 : classNames2.labelWrapper }),
      "data-slot": "labelWrapper",
      ...props2
    };
  };
  const getLabelProps = (props2 = {}) => {
    return {
      "data-slot": "label",
      className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
      children: label,
      ...labelProps,
      ...props2
    };
  };
  const getValueProps = (props2 = {}) => {
    return {
      "data-slot": "value",
      className: slots.value({ class: classNames2 == null ? void 0 : classNames2.value }),
      children: getValue2 && typeof getValue2 === "function" ? getValue2(state.values) : value2,
      ...outputProps,
      ...props2
    };
  };
  const getTrackProps = (props2 = {}) => {
    const fillWidth = (endOffset - startOffset) * 100;
    return {
      ref: trackRef,
      "data-slot": "track",
      "data-thumb-hidden": !!(originalProps == null ? void 0 : originalProps.hideThumb),
      "data-vertical": isVertical,
      ...hasSingleThumb ? {
        "data-fill-start": fillWidth > 0,
        "data-fill-end": fillWidth == 100
      } : {
        "data-fill-start": startOffset == 0,
        "data-fill-end": startOffset * 100 + fillWidth == 100
      },
      className: slots.track({ class: classNames2 == null ? void 0 : classNames2.track }),
      ...trackProps,
      ...props2
    };
  };
  const getTrackWrapperProps = (props2 = {}) => {
    return {
      "data-slot": "track-wrapper",
      className: slots.trackWrapper({ class: classNames2 == null ? void 0 : classNames2.trackWrapper }),
      ...props2
    };
  };
  const getFillerProps = (props2 = {}) => {
    return {
      "data-slot": "filler",
      className: slots.filler({ class: classNames2 == null ? void 0 : classNames2.filler }),
      ...props2,
      style: {
        ...props2.style,
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${startOffset * 100}%`,
        ...isVertical ? {
          height: `${(endOffset - startOffset) * 100}%`
        } : {
          width: `${(endOffset - startOffset) * 100}%`
        }
      }
    };
  };
  const getThumbProps = (index2) => {
    return {
      name: name2,
      index: index2,
      state,
      trackRef,
      orientation,
      isVertical,
      tooltipProps,
      getTooltipValue,
      showTooltip,
      renderThumb,
      formatOptions: tooltipValueFormatOptions,
      className: slots.thumb({ class: classNames2 == null ? void 0 : classNames2.thumb })
    };
  };
  const getStepProps = (index2) => {
    const percent2 = state.getValuePercent(index2 * step + minValue);
    return {
      className: slots.step({ class: classNames2 == null ? void 0 : classNames2.step }),
      "data-slot": "step",
      "data-in-range": percent2 <= endOffset && percent2 >= startOffset,
      style: {
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${percent2 * 100}%`
      }
    };
  };
  const getMarkProps = (mark2) => {
    const percent2 = state.getValuePercent(mark2.value);
    return {
      className: slots.mark({ class: classNames2 == null ? void 0 : classNames2.mark }),
      "data-slot": "mark",
      "data-in-range": percent2 <= endOffset && percent2 >= startOffset,
      style: {
        [isVertical ? "bottom" : direction === "rtl" ? "right" : "left"]: `${percent2 * 100}%`
      },
      // avoid `onDownTrack` is being called since when you click the mark,
      // `onDownTrack` will calculate the percent based on the position you click
      // the calculated value will be set instead of the actual value defined in `marks`
      onMouseDown: (e2) => e2.stopPropagation(),
      onPointerDown: (e2) => e2.stopPropagation(),
      onClick: (e2) => {
        e2.stopPropagation();
        if (isFixedValue)
          return;
        if (state.values.length === 1) {
          state.setThumbPercent(0, percent2);
        } else {
          const leftThumbVal = state.values[0];
          const rightThumbVal = state.values[1];
          if (mark2.value < leftThumbVal) {
            state.setThumbPercent(0, percent2);
          } else if (mark2.value > rightThumbVal) {
            state.setThumbPercent(1, percent2);
          } else if (Math.abs(mark2.value - leftThumbVal) < Math.abs(mark2.value - rightThumbVal)) {
            state.setThumbPercent(0, percent2);
          } else {
            state.setThumbPercent(1, percent2);
          }
        }
      }
    };
  };
  const getStartContentProps = (props2 = {}) => ({
    "data-slot": "startContent",
    className: slots.startContent({ class: classNames2 == null ? void 0 : classNames2.startContent }),
    ...props2
  });
  const getEndContentProps = (props2 = {}) => ({
    "data-slot": "endContent",
    className: slots.endContent({ class: classNames2 == null ? void 0 : classNames2.endContent }),
    ...props2
  });
  return {
    Component: Component2,
    state,
    value: value2,
    domRef,
    label,
    steps,
    marks,
    startContent,
    endContent,
    getStepProps,
    getBaseProps,
    getValue: getValue2,
    renderLabel,
    renderValue,
    getTrackWrapperProps,
    getLabelWrapperProps,
    getLabelProps,
    getValueProps,
    getTrackProps,
    getFillerProps,
    getThumbProps,
    getMarkProps,
    getStartContentProps,
    getEndContentProps
  };
}
var Slider$2 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    state,
    label,
    steps,
    marks,
    startContent,
    endContent,
    getStepProps,
    getBaseProps,
    renderValue,
    renderLabel,
    getTrackWrapperProps,
    getLabelWrapperProps,
    getLabelProps,
    getValueProps,
    getTrackProps,
    getFillerProps,
    getThumbProps,
    getMarkProps,
    getStartContentProps,
    getEndContentProps
  } = useSlider({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    label && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getLabelWrapperProps(), children: [
      renderFn({
        Component: "label",
        props: getLabelProps(),
        renderCustom: renderLabel
      }),
      renderFn({
        Component: "output",
        props: getValueProps(),
        renderCustom: renderValue
      })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getTrackWrapperProps(), children: [
      startContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getStartContentProps(), children: startContent }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getTrackProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getFillerProps() }),
        Number.isFinite(steps) && Array.from({ length: steps }, (_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getStepProps(index2) }, index2)),
        state.values.map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(slider_thumb_default, { ...getThumbProps(index2) }, index2)),
        (marks == null ? void 0 : marks.length) > 0 && marks.map((mark2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getMarkProps(mark2), children: mark2.label }, index2))
      ] }),
      endContent && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEndContentProps(), children: endContent })
    ] })
  ] });
});
Slider$2.displayName = "HeroUI.Slider";
var slider_default = Slider$2;
function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
  let { elementType = "a", onPress, onPressStart, onPressEnd, onClick, isDisabled, ...otherProps } = props;
  let linkProps = {};
  if (elementType !== "a")
    linkProps = {
      role: "link",
      tabIndex: !isDisabled ? 0 : void 0
    };
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    onPress,
    onPressStart,
    onPressEnd,
    onClick,
    isDisabled,
    ref
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(otherProps, {
    labelable: true
  });
  let interactionHandlers = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusableProps, pressProps);
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let routerLinkProps = $ea8dcbcb9ea1b556$export$7e924b3091a3bd18$1(props);
  return {
    isPressed,
    linkProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, routerLinkProps, {
      ...interactionHandlers,
      ...linkProps,
      "aria-disabled": isDisabled || void 0,
      "aria-current": props["aria-current"],
      onClick: (e2) => {
        var _pressProps_onClick;
        (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e2);
        $ea8dcbcb9ea1b556$export$13aea1a3cb5e3f1f(e2, router, props.href, props.routerOptions);
      }
    })
  };
}
function $dafd15390222438a$export$452b38fce62c9384(props, ref) {
  let { isCurrent, isDisabled, "aria-current": ariaCurrent, elementType = "a", ...otherProps } = props;
  let { linkProps } = $298d61e98472621b$export$dcf14c9974fe2767({
    isDisabled: isDisabled || isCurrent,
    elementType,
    ...otherProps
  }, ref);
  let isHeading = /^h[1-6]$/.test(elementType);
  let itemProps = {};
  if (!isHeading)
    itemProps = linkProps;
  if (isCurrent) {
    itemProps["aria-current"] = ariaCurrent || "page";
    itemProps.tabIndex = props.autoFocus ? -1 : void 0;
  }
  return {
    itemProps: {
      "aria-disabled": isDisabled,
      ...itemProps
    }
  };
}
var $b91590b2dc47de39$exports = {};
$b91590b2dc47de39$exports = {
  "breadcrumbs": `عناصر الواجهة`
};
var $55b0693b2cf3fe91$exports = {};
$55b0693b2cf3fe91$exports = {
  "breadcrumbs": `Трохи хляб`
};
var $6ec1ed7729e948cc$exports = {};
$6ec1ed7729e948cc$exports = {
  "breadcrumbs": `Popis cesty`
};
var $5a41bb2baa6861e4$exports = {};
$5a41bb2baa6861e4$exports = {
  "breadcrumbs": `Brødkrummer`
};
var $f28bbea439e87eca$exports = {};
$f28bbea439e87eca$exports = {
  "breadcrumbs": `Breadcrumbs`
};
var $b3eca51cb720961a$exports = {};
$b3eca51cb720961a$exports = {
  "breadcrumbs": `Πλοηγήσεις breadcrumb`
};
var $0b39b205118db415$exports = {};
$0b39b205118db415$exports = {
  "breadcrumbs": `Breadcrumbs`
};
var $f467c0ee7bfb0950$exports = {};
$f467c0ee7bfb0950$exports = {
  "breadcrumbs": `Migas de pan`
};
var $ab711d2ffb4cdf3d$exports = {};
$ab711d2ffb4cdf3d$exports = {
  "breadcrumbs": `Lingiread`
};
var $b63105d663e6f9d5$exports = {};
$b63105d663e6f9d5$exports = {
  "breadcrumbs": `Navigointilinkit`
};
var $9d2ed7be7fcdc2a1$exports = {};
$9d2ed7be7fcdc2a1$exports = {
  "breadcrumbs": `Chemin de navigation`
};
var $c5704294d85c7b5d$exports = {};
$c5704294d85c7b5d$exports = {
  "breadcrumbs": `שבילי ניווט`
};
var $20c975671d6bbc63$exports = {};
$20c975671d6bbc63$exports = {
  "breadcrumbs": `Navigacijski putovi`
};
var $2569ca3917233115$exports = {};
$2569ca3917233115$exports = {
  "breadcrumbs": `Morzsamenü`
};
var $caa152f7f8e96c85$exports = {};
$caa152f7f8e96c85$exports = {
  "breadcrumbs": `Breadcrumb`
};
var $cbc6af0cc98fad10$exports = {};
$cbc6af0cc98fad10$exports = {
  "breadcrumbs": `パンくずリスト`
};
var $ad9be5d332b4d607$exports = {};
$ad9be5d332b4d607$exports = {
  "breadcrumbs": `탐색 표시`
};
var $659de19a00ff9617$exports = {};
$659de19a00ff9617$exports = {
  "breadcrumbs": `Naršymo kelias`
};
var $173e9fb4d14fe309$exports = {};
$173e9fb4d14fe309$exports = {
  "breadcrumbs": `Atpakaļceļi`
};
var $d8e2640a066567a9$exports = {};
$d8e2640a066567a9$exports = {
  "breadcrumbs": `Navigasjonsstier`
};
var $d71fd764236c0d12$exports = {};
$d71fd764236c0d12$exports = {
  "breadcrumbs": `Broodkruimels`
};
var $f4ad3faf9f4aaec6$exports = {};
$f4ad3faf9f4aaec6$exports = {
  "breadcrumbs": `Struktura nawigacyjna`
};
var $9703be9d55d8e9c2$exports = {};
$9703be9d55d8e9c2$exports = {
  "breadcrumbs": `Caminho detalhado`
};
var $7e23baec8a14f309$exports = {};
$7e23baec8a14f309$exports = {
  "breadcrumbs": `Categorias`
};
var $568f95594049d56e$exports = {};
$568f95594049d56e$exports = {
  "breadcrumbs": `Miez de pâine`
};
var $625df06cecc70764$exports = {};
$625df06cecc70764$exports = {
  "breadcrumbs": `Навигация`
};
var $b5a67525f3a2f594$exports = {};
$b5a67525f3a2f594$exports = {
  "breadcrumbs": `Navigačné prvky Breadcrumbs`
};
var $16125922964febca$exports = {};
$16125922964febca$exports = {
  "breadcrumbs": `Drobtine`
};
var $de104bf355206bcf$exports = {};
$de104bf355206bcf$exports = {
  "breadcrumbs": `Putanje navigacije`
};
var $d5ab76bcbadc9c07$exports = {};
$d5ab76bcbadc9c07$exports = {
  "breadcrumbs": `Sökvägar`
};
var $a6a1af5968159b55$exports = {};
$a6a1af5968159b55$exports = {
  "breadcrumbs": `İçerik haritaları`
};
var $5204a30f0d17ffec$exports = {};
$5204a30f0d17ffec$exports = {
  "breadcrumbs": `Навігаційна стежка`
};
var $8d15e736e12d3dfd$exports = {};
$8d15e736e12d3dfd$exports = {
  "breadcrumbs": `导航栏`
};
var $f8c49dd804b75140$exports = {};
$f8c49dd804b75140$exports = {
  "breadcrumbs": `導覽列`
};
var $8229b34715874f89$exports = {};
$8229b34715874f89$exports = {
  "ar-AE": $b91590b2dc47de39$exports,
  "bg-BG": $55b0693b2cf3fe91$exports,
  "cs-CZ": $6ec1ed7729e948cc$exports,
  "da-DK": $5a41bb2baa6861e4$exports,
  "de-DE": $f28bbea439e87eca$exports,
  "el-GR": $b3eca51cb720961a$exports,
  "en-US": $0b39b205118db415$exports,
  "es-ES": $f467c0ee7bfb0950$exports,
  "et-EE": $ab711d2ffb4cdf3d$exports,
  "fi-FI": $b63105d663e6f9d5$exports,
  "fr-FR": $9d2ed7be7fcdc2a1$exports,
  "he-IL": $c5704294d85c7b5d$exports,
  "hr-HR": $20c975671d6bbc63$exports,
  "hu-HU": $2569ca3917233115$exports,
  "it-IT": $caa152f7f8e96c85$exports,
  "ja-JP": $cbc6af0cc98fad10$exports,
  "ko-KR": $ad9be5d332b4d607$exports,
  "lt-LT": $659de19a00ff9617$exports,
  "lv-LV": $173e9fb4d14fe309$exports,
  "nb-NO": $d8e2640a066567a9$exports,
  "nl-NL": $d71fd764236c0d12$exports,
  "pl-PL": $f4ad3faf9f4aaec6$exports,
  "pt-BR": $9703be9d55d8e9c2$exports,
  "pt-PT": $7e23baec8a14f309$exports,
  "ro-RO": $568f95594049d56e$exports,
  "ru-RU": $625df06cecc70764$exports,
  "sk-SK": $b5a67525f3a2f594$exports,
  "sl-SI": $16125922964febca$exports,
  "sr-SP": $de104bf355206bcf$exports,
  "sv-SE": $d5ab76bcbadc9c07$exports,
  "tr-TR": $a6a1af5968159b55$exports,
  "uk-UA": $5204a30f0d17ffec$exports,
  "zh-CN": $8d15e736e12d3dfd$exports,
  "zh-TW": $f8c49dd804b75140$exports
};
function $parcel$interopDefault$d(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $848231d7a2b3998e$export$8cefe241bd876ca0(props) {
  let { "aria-label": ariaLabel, ...otherProps } = props;
  let strings = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$d($8229b34715874f89$exports), "@react-aria/breadcrumbs");
  return {
    navProps: {
      ...$65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(otherProps, {
        labelable: true
      }),
      "aria-label": ariaLabel || strings.format("breadcrumbs")
    }
  };
}
function useBreadcrumbItem(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, breadcrumbItem.variantKeys);
  const {
    ref,
    as: as2,
    className,
    children,
    isLast,
    separator,
    startContent,
    endContent,
    classNames: classNames2,
    hideSeparator = false,
    ...otherProps
  } = props;
  const WrapperComponent = as2 || "li";
  const isCurrent = !!(originalProps == null ? void 0 : originalProps.isCurrent);
  const isDisabled = originalProps == null ? void 0 : originalProps.isDisabled;
  const Component2 = (originalProps == null ? void 0 : originalProps.href) && !isCurrent ? "a" : "span";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const { itemProps } = $dafd15390222438a$export$452b38fce62c9384(
    { ...originalProps, isCurrent, elementType: Component2 },
    domRef
  );
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const slots = reactExports.useMemo(
    () => breadcrumbItem({
      ...variantProps2,
      isCurrent,
      underline: (originalProps == null ? void 0 : originalProps.underline) !== void 0 && !isCurrent ? originalProps == null ? void 0 : originalProps.underline : "none",
      className
    }),
    [objectToDeps(variantProps2), isCurrent, className]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const getBaseProps = () => ({
    ref: domRef,
    "data-slot": "base",
    className: slots.base({ class: baseStyles }),
    ...filterDOMProps(otherProps, {
      enabled: shouldFilterDOMProps
    })
  });
  const getItemProps = () => ({
    href: !isCurrent ? originalProps == null ? void 0 : originalProps.href : void 0,
    "data-slot": "item",
    "data-focus": dataAttr(isFocused),
    "data-focus-visible": dataAttr(isFocusVisible),
    "data-disabled": originalProps == null ? void 0 : originalProps.isDisabled,
    "data-current": originalProps == null ? void 0 : originalProps.isCurrent,
    className: slots.item({ class: classNames2 == null ? void 0 : classNames2.item }),
    ...mergeProps$3(itemProps, isDisabled ? {} : focusProps)
  });
  const getSeparatorProps = () => ({
    "data-slot": "separator",
    "aria-hidden": dataAttr(true),
    className: slots.separator({ class: classNames2 == null ? void 0 : classNames2.separator })
  });
  return {
    Component: Component2,
    WrapperComponent,
    children,
    separator,
    startContent,
    endContent,
    isDisabled,
    isCurrent,
    isLast,
    hideSeparator,
    getBaseProps,
    getItemProps,
    getSeparatorProps
  };
}
var Breadcrumbs$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    WrapperComponent,
    children,
    isLast,
    separator,
    startContent,
    endContent,
    hideSeparator,
    getBaseProps,
    getItemProps,
    getSeparatorProps
  } = useBreadcrumbItem({
    ...props,
    ref
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(WrapperComponent, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getItemProps(), children: [
      startContent,
      children,
      endContent
    ] }),
    !isLast && !hideSeparator && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSeparatorProps(), children: separator })
  ] });
});
Breadcrumbs$1.displayName = "HeroUI.Breadcrumbs";
var breadcrumb_item_default = Breadcrumbs$1;
function useBreadcrumbs(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const [props, variantProps2] = mapPropsVariants(originalProps, breadcrumbs.variantKeys);
  const {
    ref,
    as: as2,
    color: color2,
    underline,
    isDisabled,
    separator,
    children: childrenProp,
    itemsBeforeCollapse = 1,
    itemsAfterCollapse = 2,
    maxItems = 8,
    hideSeparator,
    renderEllipsis,
    className,
    classNames: classNames2,
    itemClasses,
    onAction,
    ...otherProps
  } = props;
  const Component2 = as2 || "nav";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const { navProps } = $848231d7a2b3998e$export$8cefe241bd876ca0(originalProps);
  const [, children] = pickChildren(childrenProp, breadcrumb_item_default);
  const childCount = reactExports.Children.count(children);
  const domRef = useDOMRef(ref);
  const slots = reactExports.useMemo(
    () => breadcrumbs({
      ...variantProps2
    }),
    [objectToDeps(variantProps2)]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const itemProps = {
    color: color2,
    underline,
    disableAnimation,
    hideSeparator,
    size: originalProps == null ? void 0 : originalProps.size,
    classNames: itemClasses
  };
  const getBaseProps = () => ({
    ref: domRef,
    "data-slot": "base",
    className: slots.base({ class: baseStyles }),
    ...mergeProps$3(
      navProps,
      filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      })
    )
  });
  const getListProps = () => ({
    "data-slot": "list",
    className: slots.list({ class: classNames2 == null ? void 0 : classNames2.list })
  });
  const getEllipsisProps = () => ({
    "data-slot": "ellipsis",
    className: slots.ellipsis({ class: classNames2 == null ? void 0 : classNames2.ellipsis })
  });
  const getSeparatorProps = () => ({
    "data-slot": "separator",
    "aria-hidden": dataAttr(true),
    className: slots.separator({ class: classNames2 == null ? void 0 : classNames2.separator })
  });
  return {
    Component: Component2,
    children,
    slots,
    separator,
    childCount,
    itemsAfterCollapse,
    itemsBeforeCollapse,
    maxItems,
    classNames: classNames2,
    isDisabled,
    itemProps,
    renderEllipsis,
    getBaseProps,
    getListProps,
    getEllipsisProps,
    getSeparatorProps,
    onAction
  };
}
var Breadcrumbs = forwardRef((props, ref) => {
  const {
    Component: Component2,
    children,
    childCount,
    itemProps,
    separator = /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRightIcon$1, {}),
    maxItems,
    itemsBeforeCollapse,
    itemsAfterCollapse,
    isDisabled,
    renderEllipsis,
    getBaseProps,
    getListProps,
    getEllipsisProps,
    getSeparatorProps,
    onAction
  } = useBreadcrumbs({
    ...props,
    ref
  });
  const content2 = reactExports.useMemo(() => {
    let items = children == null ? void 0 : children.map((child, i2) => {
      var _a2;
      const isLast = i2 === childCount - 1;
      const itemKey2 = (child == null ? void 0 : child.key) || i2;
      return reactExports.cloneElement(child, {
        ...itemProps,
        isLast,
        separator,
        isDisabled: isDisabled && !isLast,
        isCurrent: isLast || child.props.isCurrent,
        ...child.props,
        key: itemKey2,
        onPress: chain((_a2 = child.props) == null ? void 0 : _a2.onPress, () => onAction == null ? void 0 : onAction(itemKey2))
      });
    });
    if (!items)
      return null;
    if (childCount < maxItems) {
      return items;
    }
    if (itemsBeforeCollapse + itemsAfterCollapse >= childCount) {
      warn$2(
        `You have provided an invalid combination of props to the Breadcrumbs. itemsAfterCollapse={${itemsAfterCollapse}} + itemsBeforeCollapse={${itemsBeforeCollapse}} >= itemsCount={${childCount}}`,
        "Breadcrumbs"
      );
      return items;
    }
    const itemsInEllipsis = items.slice(itemsBeforeCollapse, items.length - itemsAfterCollapse);
    if (itemsInEllipsis.length < 1) {
      return items;
    }
    const ellipsisIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(EllipsisIcon, { ...getEllipsisProps() });
    const collapsedItem = reactExports.cloneElement(itemsInEllipsis[0], {
      ...itemsInEllipsis[0].props,
      key: "ellipsis",
      children: ellipsisIcon
    });
    const ellipsisItem = typeof renderEllipsis === "function" ? renderEllipsis({
      collapsedItem,
      items: itemsInEllipsis.map((item) => item.props),
      maxItems,
      ellipsisIcon,
      itemsBeforeCollapse,
      itemsAfterCollapse,
      separator: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSeparatorProps(), children: separator })
    }) : collapsedItem;
    return [
      ...items.slice(0, itemsBeforeCollapse),
      reactExports.isValidElement(ellipsisItem) && reactExports.cloneElement(ellipsisItem, { key: "ellipsis-item" }),
      ...items.slice(items.length - itemsAfterCollapse, items.length)
    ];
  }, [
    children,
    childCount,
    separator,
    itemProps,
    itemsBeforeCollapse,
    itemsAfterCollapse,
    isDisabled
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, { ...getBaseProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx("ol", { ...getListProps(), children: content2 }) });
});
Breadcrumbs.displayName = "HeroUI.Breadcrumbs";
var breadcrumbs_default = Breadcrumbs;
function $a9e7382a7d111cb5$export$b453a3bfd4a5fa9e(props) {
  var _collection_getItem;
  let { defaultFilter, menuTrigger = "input", allowsEmptyCollection = false, allowsCustomValue, shouldCloseOnBlur = true } = props;
  let [showAllItems, setShowAllItems] = reactExports.useState(false);
  let [isFocused, setFocusedState] = reactExports.useState(false);
  let [focusStrategy, setFocusStrategy] = reactExports.useState(null);
  let onSelectionChange = (key) => {
    if (props.onSelectionChange)
      props.onSelectionChange(key);
    if (key === selectedKey) {
      resetInputValue();
      closeMenu();
    }
  };
  var _props_items;
  let { collection, selectionManager, selectedKey, setSelectedKey, selectedItem, disabledKeys } = $a0d645289fe9b86b$export$e7f05e985daf4b5f({
    ...props,
    onSelectionChange,
    items: (_props_items = props.items) !== null && _props_items !== void 0 ? _props_items : props.defaultItems
  });
  let defaultInputValue = props.defaultInputValue;
  if (defaultInputValue == null) {
    var _collection_getItem1;
    var _collection_getItem_textValue;
    if (selectedKey == null)
      defaultInputValue = "";
    else
      defaultInputValue = (_collection_getItem_textValue = (_collection_getItem1 = collection.getItem(selectedKey)) === null || _collection_getItem1 === void 0 ? void 0 : _collection_getItem1.textValue) !== null && _collection_getItem_textValue !== void 0 ? _collection_getItem_textValue : "";
  }
  let [inputValue, setInputValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.inputValue, defaultInputValue, props.onInputChange);
  let originalCollection = collection;
  let filteredCollection = reactExports.useMemo(() => (
    // No default filter if items are controlled.
    props.items != null || !defaultFilter ? collection : $a9e7382a7d111cb5$var$filterCollection(collection, inputValue, defaultFilter)
  ), [
    collection,
    inputValue,
    defaultFilter,
    props.items
  ]);
  let [lastCollection, setLastCollection] = reactExports.useState(filteredCollection);
  let menuOpenTrigger = reactExports.useRef("focus");
  let onOpenChange = (open2) => {
    if (props.onOpenChange)
      props.onOpenChange(open2, open2 ? menuOpenTrigger.current : void 0);
    selectionManager.setFocused(open2);
    if (!open2)
      selectionManager.setFocusedKey(null);
  };
  let triggerState = $fc909762b330b746$export$61c6a8c84e605fb6$2({
    ...props,
    onOpenChange,
    isOpen: void 0,
    defaultOpen: void 0
  });
  let open = (focusStrategy2 = null, trigger) => {
    let displayAllItems = trigger === "manual" || trigger === "focus" && menuTrigger === "focus";
    if (allowsEmptyCollection || filteredCollection.size > 0 || displayAllItems && originalCollection.size > 0 || props.items) {
      if (displayAllItems && !triggerState.isOpen && props.items === void 0)
        setShowAllItems(true);
      menuOpenTrigger.current = trigger;
      setFocusStrategy(focusStrategy2);
      triggerState.open();
    }
  };
  let toggle2 = (focusStrategy2 = null, trigger) => {
    let displayAllItems = trigger === "manual" || trigger === "focus" && menuTrigger === "focus";
    if (!(allowsEmptyCollection || filteredCollection.size > 0 || displayAllItems && originalCollection.size > 0 || props.items) && !triggerState.isOpen)
      return;
    if (displayAllItems && !triggerState.isOpen && props.items === void 0)
      setShowAllItems(true);
    if (!triggerState.isOpen)
      menuOpenTrigger.current = trigger;
    toggleMenu(focusStrategy2);
  };
  let updateLastCollection = reactExports.useCallback(() => {
    setLastCollection(showAllItems ? originalCollection : filteredCollection);
  }, [
    showAllItems,
    originalCollection,
    filteredCollection
  ]);
  let toggleMenu = reactExports.useCallback((focusStrategy2 = null) => {
    if (triggerState.isOpen)
      updateLastCollection();
    setFocusStrategy(focusStrategy2);
    triggerState.toggle();
  }, [
    triggerState,
    updateLastCollection
  ]);
  let closeMenu = reactExports.useCallback(() => {
    if (triggerState.isOpen) {
      updateLastCollection();
      triggerState.close();
    }
  }, [
    triggerState,
    updateLastCollection
  ]);
  let [lastValue, setLastValue] = reactExports.useState(inputValue);
  let resetInputValue = () => {
    var _collection_getItem2;
    var _collection_getItem_textValue2;
    let itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
    setLastValue(itemText);
    setInputValue(itemText);
  };
  var _props_selectedKey, _ref;
  let lastSelectedKey = reactExports.useRef((_ref = (_props_selectedKey = props.selectedKey) !== null && _props_selectedKey !== void 0 ? _props_selectedKey : props.defaultSelectedKey) !== null && _ref !== void 0 ? _ref : null);
  var _collection_getItem_textValue1;
  let lastSelectedKeyText = reactExports.useRef(selectedKey != null ? (_collection_getItem_textValue1 = (_collection_getItem = collection.getItem(selectedKey)) === null || _collection_getItem === void 0 ? void 0 : _collection_getItem.textValue) !== null && _collection_getItem_textValue1 !== void 0 ? _collection_getItem_textValue1 : "" : "");
  reactExports.useEffect(() => {
    var _collection_getItem2;
    if (isFocused && (filteredCollection.size > 0 || allowsEmptyCollection) && !triggerState.isOpen && inputValue !== lastValue && menuTrigger !== "manual")
      open(null, "input");
    if (!showAllItems && !allowsEmptyCollection && triggerState.isOpen && filteredCollection.size === 0)
      closeMenu();
    if (selectedKey != null && selectedKey !== lastSelectedKey.current)
      closeMenu();
    if (inputValue !== lastValue) {
      selectionManager.setFocusedKey(null);
      setShowAllItems(false);
      if (inputValue === "" && (props.inputValue === void 0 || props.selectedKey === void 0))
        setSelectedKey(null);
    }
    if (selectedKey !== lastSelectedKey.current && (props.inputValue === void 0 || props.selectedKey === void 0))
      resetInputValue();
    else if (lastValue !== inputValue)
      setLastValue(inputValue);
    var _collection_getItem_textValue2;
    let selectedItemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
    if (!isFocused && selectedKey != null && props.inputValue === void 0 && selectedKey === lastSelectedKey.current) {
      if (lastSelectedKeyText.current !== selectedItemText) {
        setLastValue(selectedItemText);
        setInputValue(selectedItemText);
      }
    }
    lastSelectedKey.current = selectedKey;
    lastSelectedKeyText.current = selectedItemText;
  });
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: reactExports.useMemo(() => ({
      inputValue,
      selectedKey
    }), [
      inputValue,
      selectedKey
    ])
  });
  let revert2 = () => {
    if (allowsCustomValue && selectedKey == null)
      commitCustomValue();
    else
      commitSelection();
  };
  let commitCustomValue = () => {
    lastSelectedKey.current = null;
    setSelectedKey(null);
    closeMenu();
  };
  let commitSelection = () => {
    if (props.selectedKey !== void 0 && props.inputValue !== void 0) {
      var _props_onSelectionChange, _collection_getItem2;
      (_props_onSelectionChange = props.onSelectionChange) === null || _props_onSelectionChange === void 0 ? void 0 : _props_onSelectionChange.call(props, selectedKey);
      var _collection_getItem_textValue2;
      let itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
      setLastValue(itemText);
      closeMenu();
    } else {
      resetInputValue();
      closeMenu();
    }
  };
  const commitValue = () => {
    if (allowsCustomValue) {
      var _collection_getItem2;
      var _collection_getItem_textValue2;
      const itemText = selectedKey != null ? (_collection_getItem_textValue2 = (_collection_getItem2 = collection.getItem(selectedKey)) === null || _collection_getItem2 === void 0 ? void 0 : _collection_getItem2.textValue) !== null && _collection_getItem_textValue2 !== void 0 ? _collection_getItem_textValue2 : "" : "";
      inputValue === itemText ? commitSelection() : commitCustomValue();
    } else
      commitSelection();
  };
  let commit = () => {
    if (triggerState.isOpen && selectionManager.focusedKey != null) {
      if (selectedKey === selectionManager.focusedKey)
        commitSelection();
      else
        setSelectedKey(selectionManager.focusedKey);
    } else
      commitValue();
  };
  let valueOnFocus = reactExports.useRef(inputValue);
  let setFocused = (isFocused2) => {
    if (isFocused2) {
      valueOnFocus.current = inputValue;
      if (menuTrigger === "focus" && !props.isReadOnly)
        open(null, "focus");
    } else {
      if (shouldCloseOnBlur)
        commitValue();
      if (inputValue !== valueOnFocus.current)
        validation.commitValidation();
    }
    setFocusedState(isFocused2);
  };
  let displayedCollection = reactExports.useMemo(() => {
    if (triggerState.isOpen) {
      if (showAllItems)
        return originalCollection;
      else
        return filteredCollection;
    } else
      return lastCollection;
  }, [
    triggerState.isOpen,
    originalCollection,
    filteredCollection,
    showAllItems,
    lastCollection
  ]);
  return {
    ...validation,
    ...triggerState,
    focusStrategy,
    toggle: toggle2,
    open,
    close: commitValue,
    selectionManager,
    selectedKey,
    setSelectedKey,
    disabledKeys,
    isFocused,
    setFocused,
    selectedItem,
    collection: displayedCollection,
    inputValue,
    setInputValue,
    commit,
    revert: revert2
  };
}
function $a9e7382a7d111cb5$var$filterCollection(collection, inputValue, filter3) {
  return new $a02d57049d202695$export$d085fb9e920b5ca7$2($a9e7382a7d111cb5$var$filterNodes(collection, collection, inputValue, filter3));
}
function $a9e7382a7d111cb5$var$filterNodes(collection, nodes, inputValue, filter3) {
  let filteredNode = [];
  for (let node2 of nodes) {
    if (node2.type === "section" && node2.hasChildNodes) {
      let filtered = $a9e7382a7d111cb5$var$filterNodes(collection, $c5a24bc478652b5f$export$1005530eda016c13(node2, collection), inputValue, filter3);
      if ([
        ...filtered
      ].some((node3) => node3.type === "item"))
        filteredNode.push({
          ...node2,
          childNodes: filtered
        });
    } else if (node2.type === "item" && filter3(node2.textValue, inputValue))
      filteredNode.push({
        ...node2
      });
    else if (node2.type !== "item")
      filteredNode.push({
        ...node2
      });
  }
  return filteredNode;
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$4 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$4 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$4(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$4.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$4.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$4 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$4 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$4);
const $b5e257d569688ac6$var$IsSSRContext$4 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$4 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$4(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$4);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$4.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$4.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$4.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$4(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$4);
  let counter = $b5e257d569688ac6$var$useCounter$4(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$4(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$4());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$4.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$4 : $b5e257d569688ac6$var$useLegacySSRSafeId$4;
function $b5e257d569688ac6$var$getSnapshot$4() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$4() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$4(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$4() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$4, $b5e257d569688ac6$var$getSnapshot$4, $b5e257d569688ac6$var$getServerSnapshot$4);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$4);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$4 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$4] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$4(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$4 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4();
let $1e5a04cdaf7d1af8$var$listeners$4 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$4() {
  $1e5a04cdaf7d1af8$var$currentLocale$4 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$4();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$4)
    listener($1e5a04cdaf7d1af8$var$currentLocale$4);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$4() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$4();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$4);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$4.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$4);
    $1e5a04cdaf7d1af8$var$listeners$4.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$4.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$4.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$4);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$4 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$4() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$4();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$4);
  return context || defaultLocale;
}
let $325a3faab7a68acd$var$cache = /* @__PURE__ */ new Map();
function $325a3faab7a68acd$export$a16aca283550c30d(options) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$4();
  let cacheKey = locale2 + (options ? Object.entries(options).sort((a2, b2) => a2[0] < b2[0] ? -1 : 1).join() : "");
  if ($325a3faab7a68acd$var$cache.has(cacheKey))
    return $325a3faab7a68acd$var$cache.get(cacheKey);
  let formatter = new Intl.Collator(locale2, options);
  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);
  return formatter;
}
function $bb77f239b46e8c72$export$3274cf84b703fff(options) {
  let collator = $325a3faab7a68acd$export$a16aca283550c30d({
    usage: "search",
    ...options
  });
  let startsWith = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(0, substring.length), substring) === 0;
  }, [
    collator
  ]);
  let endsWith2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    return collator.compare(string3.slice(-substring.length), substring) === 0;
  }, [
    collator
  ]);
  let contains2 = reactExports.useCallback((string3, substring) => {
    if (substring.length === 0)
      return true;
    string3 = string3.normalize("NFC");
    substring = substring.normalize("NFC");
    let scan = 0;
    let sliceLen = substring.length;
    for (; scan + sliceLen <= string3.length; scan++) {
      let slice2 = string3.slice(scan, scan + sliceLen);
      if (collator.compare(substring, slice2) === 0)
        return true;
    }
    return false;
  }, [
    collator
  ]);
  return reactExports.useMemo(() => ({
    startsWith,
    endsWith: endsWith2,
    contains: contains2
  }), [
    startsWith,
    endsWith2,
    contains2
  ]);
}
var $02cb4c75c506befe$exports = {};
$02cb4c75c506befe$exports = {
  "buttonLabel": `عرض المقترحات`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} خيار`,
    other: () => `${formatter.number(args.optionCount)} خيارات`
  })} متاحة.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `المجموعة المدخلة ${args.groupTitle}, مع ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} خيار`,
      other: () => `${formatter.number(args.groupCount)} خيارات`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, محدد`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `مقترحات`,
  "selectedAnnouncement": (args) => `${args.optionText}، محدد`
};
var $568b8163f1e56faf$exports = {};
$568b8163f1e56faf$exports = {
  "buttonLabel": `Покажи предложения`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} опция`,
    other: () => `${formatter.number(args.optionCount)} опции`
  })} на разположение.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Въведена група ${args.groupTitle}, с ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} опция`,
      other: () => `${formatter.number(args.groupCount)} опции`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, избрани`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Предложения`,
  "selectedAnnouncement": (args) => `${args.optionText}, избрани`
};
var $87581c0202d106b8$exports = {};
$87581c0202d106b8$exports = {
  "buttonLabel": `Zobrazit doporučení`,
  "countAnnouncement": (args, formatter) => `K dispozici ${formatter.plural(args.optionCount, {
    one: () => `je ${formatter.number(args.optionCount)} možnost`,
    other: () => `jsou/je ${formatter.number(args.optionCount)} možnosti/-í`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Zadaná skupina „${args.groupTitle}“ ${formatter.plural(args.groupCount, {
      one: () => `s ${formatter.number(args.groupCount)} možností`,
      other: () => `se ${formatter.number(args.groupCount)} možnostmi`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: ` (vybráno)`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Návrhy`,
  "selectedAnnouncement": (args) => `${args.optionText}, vybráno`
};
var $a10a0369f5433ed1$exports = {};
$a10a0369f5433ed1$exports = {
  "buttonLabel": `Vis forslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} mulighed tilgængelig`,
    other: () => `${formatter.number(args.optionCount)} muligheder tilgængelige`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Angivet gruppe ${args.groupTitle}, med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} mulighed`,
      other: () => `${formatter.number(args.groupCount)} muligheder`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valgt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Forslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valgt`
};
var $bfd288727d5cb166$exports = {};
$bfd288727d5cb166$exports = {
  "buttonLabel": `Empfehlungen anzeigen`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} Option`,
    other: () => `${formatter.number(args.optionCount)} Optionen`
  })} verfügbar.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Eingetretene Gruppe ${args.groupTitle}, mit ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} Option`,
      other: () => `${formatter.number(args.groupCount)} Optionen`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, ausgewählt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Empfehlungen`,
  "selectedAnnouncement": (args) => `${args.optionText}, ausgewählt`
};
var $ca177778f9a74e3c$exports = {};
$ca177778f9a74e3c$exports = {
  "buttonLabel": `Προβολή προτάσεων`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} επιλογή`,
    other: () => `${formatter.number(args.optionCount)} επιλογές `
  })} διαθέσιμες.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Εισαγμένη ομάδα ${args.groupTitle}, με ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} επιλογή`,
      other: () => `${formatter.number(args.groupCount)} επιλογές`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, επιλεγμένο`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Προτάσεις`,
  "selectedAnnouncement": (args) => `${args.optionText}, επιλέχθηκε`
};
var $9b5aa79ef84beb6c$exports = {};
$9b5aa79ef84beb6c$exports = {
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Entered group ${args.groupTitle}, with ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} option`,
      other: () => `${formatter.number(args.groupCount)} options`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selected`,
    other: ``
  }, args.isSelected)}`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} option`,
    other: () => `${formatter.number(args.optionCount)} options`
  })} available.`,
  "selectedAnnouncement": (args) => `${args.optionText}, selected`,
  "buttonLabel": `Show suggestions`,
  "listboxLabel": `Suggestions`
};
var $57968e8209de2557$exports = {};
$57968e8209de2557$exports = {
  "buttonLabel": `Mostrar sugerencias`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opción`,
    other: () => `${formatter.number(args.optionCount)} opciones`
  })} disponible(s).`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Se ha unido al grupo ${args.groupTitle}, con ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opción`,
      other: () => `${formatter.number(args.groupCount)} opciones`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, seleccionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugerencias`,
  "selectedAnnouncement": (args) => `${args.optionText}, seleccionado`
};
var $60690790bf4c1c6a$exports = {};
$60690790bf4c1c6a$exports = {
  "buttonLabel": `Kuva soovitused`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} valik`,
    other: () => `${formatter.number(args.optionCount)} valikud`
  })} saadaval.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Sisestatud rühm ${args.groupTitle}, valikuga ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} valik`,
      other: () => `${formatter.number(args.groupCount)} valikud`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valitud`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Soovitused`,
  "selectedAnnouncement": (args) => `${args.optionText}, valitud`
};
var $1101246e8c7d9357$exports = {};
$1101246e8c7d9357$exports = {
  "buttonLabel": `Näytä ehdotukset`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} vaihtoehto`,
    other: () => `${formatter.number(args.optionCount)} vaihtoehdot`
  })} saatavilla.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Mentiin ryhmään ${args.groupTitle}, ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} vaihtoehdon`,
      other: () => `${formatter.number(args.groupCount)} vaihtoehdon`
    })} kanssa.`,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valittu`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Ehdotukset`,
  "selectedAnnouncement": (args) => `${args.optionText}, valittu`
};
var $6404b5cb5b241730$exports = {};
$6404b5cb5b241730$exports = {
  "buttonLabel": `Afficher les suggestions`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} option`,
    other: () => `${formatter.number(args.optionCount)} options`
  })} disponible(s).`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Groupe ${args.groupTitle} rejoint, avec ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} option`,
      other: () => `${formatter.number(args.groupCount)} options`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, sélectionné(s)`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggestions`,
  "selectedAnnouncement": (args) => `${args.optionText}, sélectionné`
};
var $dfeafa702e92e31f$exports = {};
$dfeafa702e92e31f$exports = {
  "buttonLabel": `הצג הצעות`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `אפשרות ${formatter.number(args.optionCount)}`,
    other: () => `${formatter.number(args.optionCount)} אפשרויות`
  })} במצב זמין.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `נכנס לקבוצה ${args.groupTitle}, עם ${formatter.plural(args.groupCount, {
      one: () => `אפשרות ${formatter.number(args.groupCount)}`,
      other: () => `${formatter.number(args.groupCount)} אפשרויות`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, נבחר`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `הצעות`,
  "selectedAnnouncement": (args) => `${args.optionText}, נבחר`
};
var $2d125e0b34676352$exports = {};
$2d125e0b34676352$exports = {
  "buttonLabel": `Prikaži prijedloge`,
  "countAnnouncement": (args, formatter) => `Dostupno još: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije/a`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Unesena skupina ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcijom`,
      other: () => `${formatter.number(args.groupCount)} opcije/a`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, odabranih`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Prijedlozi`,
  "selectedAnnouncement": (args) => `${args.optionText}, odabrano`
};
var $ea029611d7634059$exports = {};
$ea029611d7634059$exports = {
  "buttonLabel": `Javaslatok megjelenítése`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} lehetőség`,
    other: () => `${formatter.number(args.optionCount)} lehetőség`
  })} áll rendelkezésre.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Belépett a(z) ${args.groupTitle} csoportba, amely ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} lehetőséget`,
      other: () => `${formatter.number(args.groupCount)} lehetőséget`
    })} tartalmaz. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, kijelölve`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Javaslatok`,
  "selectedAnnouncement": (args) => `${args.optionText}, kijelölve`
};
var $77f075bb86ad7091$exports = {};
$77f075bb86ad7091$exports = {
  "buttonLabel": `Mostra suggerimenti`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opzione disponibile`,
    other: () => `${formatter.number(args.optionCount)} opzioni disponibili`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ingresso nel gruppo ${args.groupTitle}, con ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opzione`,
      other: () => `${formatter.number(args.groupCount)} opzioni`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selezionato`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggerimenti`,
  "selectedAnnouncement": (args) => `${args.optionText}, selezionato`
};
var $6e87462e84907983$exports = {};
$6e87462e84907983$exports = {
  "buttonLabel": `候補を表示`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 個のオプション`,
    other: () => `${formatter.number(args.optionCount)} 個のオプション`
  })}を利用できます。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `入力されたグループ ${args.groupTitle}、${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 個のオプション`,
      other: () => `${formatter.number(args.groupCount)} 個のオプション`
    })}を含む。`,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `、選択済み`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `候補`,
  "selectedAnnouncement": (args) => `${args.optionText}、選択済み`
};
var $9246f2c6edc6b232$exports = {};
$9246f2c6edc6b232$exports = {
  "buttonLabel": `제안 사항 표시`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)}개 옵션`,
    other: () => `${formatter.number(args.optionCount)}개 옵션`
  })}을 사용할 수 있습니다.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `입력한 그룹 ${args.groupTitle}, ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)}개 옵션`,
      other: () => `${formatter.number(args.groupCount)}개 옵션`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 선택됨`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `제안`,
  "selectedAnnouncement": (args) => `${args.optionText}, 선택됨`
};
var $e587accc6c0a434c$exports = {};
$e587accc6c0a434c$exports = {
  "buttonLabel": `Rodyti pasiūlymus`,
  "countAnnouncement": (args, formatter) => `Yra ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} parinktis`,
    other: () => `${formatter.number(args.optionCount)} parinktys (-ių)`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Įvesta grupė ${args.groupTitle}, su ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} parinktimi`,
      other: () => `${formatter.number(args.groupCount)} parinktimis (-ių)`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, pasirinkta`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Pasiūlymai`,
  "selectedAnnouncement": (args) => `${args.optionText}, pasirinkta`
};
var $03a1900e7400b5ab$exports = {};
$03a1900e7400b5ab$exports = {
  "buttonLabel": `Rādīt ieteikumus`,
  "countAnnouncement": (args, formatter) => `Pieejamo opciju skaits: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcijas`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ievadīta grupa ${args.groupTitle}, ar ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opciju`,
      other: () => `${formatter.number(args.groupCount)} opcijām`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, atlasīta`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Ieteikumi`,
  "selectedAnnouncement": (args) => `${args.optionText}, atlasīta`
};
var $1387676441be6cf6$exports = {};
$1387676441be6cf6$exports = {
  "buttonLabel": `Vis forslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} alternativ`,
    other: () => `${formatter.number(args.optionCount)} alternativer`
  })} finnes.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Angitt gruppe ${args.groupTitle}, med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} alternativ`,
      other: () => `${formatter.number(args.groupCount)} alternativer`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valgt`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Forslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valgt`
};
var $17e82ebf0f8ab91f$exports = {};
$17e82ebf0f8ab91f$exports = {
  "buttonLabel": `Suggesties weergeven`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} optie`,
    other: () => `${formatter.number(args.optionCount)} opties`
  })} beschikbaar.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Groep ${args.groupTitle} ingevoerd met ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} optie`,
      other: () => `${formatter.number(args.groupCount)} opties`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, geselecteerd`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Suggesties`,
  "selectedAnnouncement": (args) => `${args.optionText}, geselecteerd`
};
var $2f5377d3471630e5$exports = {};
$2f5377d3471630e5$exports = {
  "buttonLabel": `Wyświetlaj sugestie`,
  "countAnnouncement": (args, formatter) => `dostępna/dostępne(-nych) ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcja`,
    other: () => `${formatter.number(args.optionCount)} opcje(-i)`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Dołączono do grupy ${args.groupTitle}, z ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcją`,
      other: () => `${formatter.number(args.groupCount)} opcjami`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, wybrano`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestie`,
  "selectedAnnouncement": (args) => `${args.optionText}, wybrano`
};
var $dee9868b6fa95ffe$exports = {};
$dee9868b6fa95ffe$exports = {
  "buttonLabel": `Mostrar sugestões`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opção`,
    other: () => `${formatter.number(args.optionCount)} opções`
  })} disponível.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grupo inserido ${args.groupTitle}, com ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opção`,
      other: () => `${formatter.number(args.groupCount)} opções`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selecionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestões`,
  "selectedAnnouncement": (args) => `${args.optionText}, selecionado`
};
var $f8b2e63637cbb5a6$exports = {};
$f8b2e63637cbb5a6$exports = {
  "buttonLabel": `Apresentar sugestões`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opção`,
    other: () => `${formatter.number(args.optionCount)} opções`
  })} disponível.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grupo introduzido ${args.groupTitle}, com ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opção`,
      other: () => `${formatter.number(args.groupCount)} opções`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selecionado`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestões`,
  "selectedAnnouncement": (args) => `${args.optionText}, selecionado`
};
var $46a885db3b44ea95$exports = {};
$46a885db3b44ea95$exports = {
  "buttonLabel": `Afișare sugestii`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opțiune`,
    other: () => `${formatter.number(args.optionCount)} opțiuni`
  })} disponibile.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Grup ${args.groupTitle} introdus, cu ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opțiune`,
      other: () => `${formatter.number(args.groupCount)} opțiuni`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, selectat`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Sugestii`,
  "selectedAnnouncement": (args) => `${args.optionText}, selectat`
};
var $50d8a8f0afa9dee5$exports = {};
$50d8a8f0afa9dee5$exports = {
  "buttonLabel": `Показать предложения`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} параметр`,
    other: () => `${formatter.number(args.optionCount)} параметров`
  })} доступно.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Введенная группа ${args.groupTitle}, с ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} параметром`,
      other: () => `${formatter.number(args.groupCount)} параметрами`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, выбранными`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Предложения`,
  "selectedAnnouncement": (args) => `${args.optionText}, выбрано`
};
var $2867ee6173245507$exports = {};
$2867ee6173245507$exports = {
  "buttonLabel": `Zobraziť návrhy`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} možnosť`,
    other: () => `${formatter.number(args.optionCount)} možnosti/-í`
  })} k dispozícii.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Zadaná skupina ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} možnosťou`,
      other: () => `${formatter.number(args.groupCount)} možnosťami`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, vybraté`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Návrhy`,
  "selectedAnnouncement": (args) => `${args.optionText}, vybraté`
};
var $0631b65beeb09b50$exports = {};
$0631b65beeb09b50$exports = {
  "buttonLabel": `Prikaži predloge`,
  "countAnnouncement": (args, formatter) => `Na voljo je ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Vnesena skupina ${args.groupTitle}, z ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcija`,
      other: () => `${formatter.number(args.groupCount)} opcije`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, izbrano`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Predlogi`,
  "selectedAnnouncement": (args) => `${args.optionText}, izbrano`
};
var $65fc749265dcd686$exports = {};
$65fc749265dcd686$exports = {
  "buttonLabel": `Prikaži predloge`,
  "countAnnouncement": (args, formatter) => `Dostupno još: ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} opcija`,
    other: () => `${formatter.number(args.optionCount)} opcije/a`
  })}.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Unesena grupa ${args.groupTitle}, s ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} opcijom`,
      other: () => `${formatter.number(args.groupCount)} optione/a`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, izabranih`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Predlozi`,
  "selectedAnnouncement": (args) => `${args.optionText}, izabrano`
};
var $69ba655c7853c08e$exports = {};
$69ba655c7853c08e$exports = {
  "buttonLabel": `Visa förslag`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} alternativ`,
    other: () => `${formatter.number(args.optionCount)} alternativ`
  })} tillgängliga.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Ingick i gruppen ${args.groupTitle} med ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} alternativ`,
      other: () => `${formatter.number(args.groupCount)} alternativ`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, valda`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Förslag`,
  "selectedAnnouncement": (args) => `${args.optionText}, valda`
};
var $a79794784d61577c$exports = {};
$a79794784d61577c$exports = {
  "buttonLabel": `Önerileri göster`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} seçenek`,
    other: () => `${formatter.number(args.optionCount)} seçenekler`
  })} kullanılabilir.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Girilen grup ${args.groupTitle}, ile ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} seçenek`,
      other: () => `${formatter.number(args.groupCount)} seçenekler`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, seçildi`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Öneriler`,
  "selectedAnnouncement": (args) => `${args.optionText}, seçildi`
};
var $c2845791417ebaf4$exports = {};
$c2845791417ebaf4$exports = {
  "buttonLabel": `Показати пропозиції`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} параметр`,
    other: () => `${formatter.number(args.optionCount)} параметри(-ів)`
  })} доступно.`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `Введена група ${args.groupTitle}, з ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} параметр`,
      other: () => `${formatter.number(args.groupCount)} параметри(-ів)`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, вибрано`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `Пропозиції`,
  "selectedAnnouncement": (args) => `${args.optionText}, вибрано`
};
var $29b642d0025cc7a4$exports = {};
$29b642d0025cc7a4$exports = {
  "buttonLabel": `显示建议`,
  "countAnnouncement": (args, formatter) => `有 ${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 个选项`,
    other: () => `${formatter.number(args.optionCount)} 个选项`
  })}可用。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `进入了 ${args.groupTitle} 组，其中有 ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 个选项`,
      other: () => `${formatter.number(args.groupCount)} 个选项`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 已选择`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `建议`,
  "selectedAnnouncement": (args) => `${args.optionText}, 已选择`
};
var $cd36dd33f9d46936$exports = {};
$cd36dd33f9d46936$exports = {
  "buttonLabel": `顯示建議`,
  "countAnnouncement": (args, formatter) => `${formatter.plural(args.optionCount, {
    one: () => `${formatter.number(args.optionCount)} 選項`,
    other: () => `${formatter.number(args.optionCount)} 選項`
  })} 可用。`,
  "focusAnnouncement": (args, formatter) => `${formatter.select({
    true: () => `輸入的群組 ${args.groupTitle}, 有 ${formatter.plural(args.groupCount, {
      one: () => `${formatter.number(args.groupCount)} 選項`,
      other: () => `${formatter.number(args.groupCount)} 選項`
    })}. `,
    other: ``
  }, args.isGroupChange)}${args.optionText}${formatter.select({
    true: `, 已選取`,
    other: ``
  }, args.isSelected)}`,
  "listboxLabel": `建議`,
  "selectedAnnouncement": (args) => `${args.optionText}, 已選取`
};
var $de5926a92e8ebc5b$exports = {};
$de5926a92e8ebc5b$exports = {
  "ar-AE": $02cb4c75c506befe$exports,
  "bg-BG": $568b8163f1e56faf$exports,
  "cs-CZ": $87581c0202d106b8$exports,
  "da-DK": $a10a0369f5433ed1$exports,
  "de-DE": $bfd288727d5cb166$exports,
  "el-GR": $ca177778f9a74e3c$exports,
  "en-US": $9b5aa79ef84beb6c$exports,
  "es-ES": $57968e8209de2557$exports,
  "et-EE": $60690790bf4c1c6a$exports,
  "fi-FI": $1101246e8c7d9357$exports,
  "fr-FR": $6404b5cb5b241730$exports,
  "he-IL": $dfeafa702e92e31f$exports,
  "hr-HR": $2d125e0b34676352$exports,
  "hu-HU": $ea029611d7634059$exports,
  "it-IT": $77f075bb86ad7091$exports,
  "ja-JP": $6e87462e84907983$exports,
  "ko-KR": $9246f2c6edc6b232$exports,
  "lt-LT": $e587accc6c0a434c$exports,
  "lv-LV": $03a1900e7400b5ab$exports,
  "nb-NO": $1387676441be6cf6$exports,
  "nl-NL": $17e82ebf0f8ab91f$exports,
  "pl-PL": $2f5377d3471630e5$exports,
  "pt-BR": $dee9868b6fa95ffe$exports,
  "pt-PT": $f8b2e63637cbb5a6$exports,
  "ro-RO": $46a885db3b44ea95$exports,
  "ru-RU": $50d8a8f0afa9dee5$exports,
  "sk-SK": $2867ee6173245507$exports,
  "sl-SI": $0631b65beeb09b50$exports,
  "sr-SP": $65fc749265dcd686$exports,
  "sv-SE": $69ba655c7853c08e$exports,
  "tr-TR": $a79794784d61577c$exports,
  "uk-UA": $c2845791417ebaf4$exports,
  "zh-CN": $29b642d0025cc7a4$exports,
  "zh-TW": $cd36dd33f9d46936$exports
};
const $dd149f63282afbbf$export$f6211563215e3b37 = /* @__PURE__ */ new WeakMap();
function $55f9b1ae81f22853$export$2b35b76d2e30e129(to2, from2) {
  to2.dispatchEvent(new FocusEvent("focus", {
    relatedTarget: from2
  }));
  to2.dispatchEvent(new FocusEvent("focusin", {
    bubbles: true,
    relatedTarget: from2
  }));
}
function $628037886ba31236$export$f9d5c8beee7d008d(props, state, ref) {
  let { type: type4 } = props;
  let { isOpen } = state;
  reactExports.useEffect(() => {
    if (ref && ref.current)
      $dd149f63282afbbf$export$f6211563215e3b37.set(ref.current, state.close);
  });
  let ariaHasPopup = void 0;
  if (type4 === "menu")
    ariaHasPopup = true;
  else if (type4 === "listbox")
    ariaHasPopup = "listbox";
  let overlayId = $bdb11010cef70236$export$f680877a34711e37$2();
  return {
    triggerProps: {
      "aria-haspopup": ariaHasPopup,
      "aria-expanded": isOpen,
      "aria-controls": isOpen ? overlayId : void 0,
      onPress: state.toggle
    },
    overlayProps: {
      id: overlayId
    }
  };
}
const $5e3802645cc19319$var$supportsInert = typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype;
let $5e3802645cc19319$var$refCountMap = /* @__PURE__ */ new WeakMap();
let $5e3802645cc19319$var$observerStack = [];
function $5e3802645cc19319$export$1c3ebcada18427bf(targets, options) {
  let windowObj = $431fbd86ca7dc216$export$f21a1ffae260145a$4(targets === null || targets === void 0 ? void 0 : targets[0]);
  let opts2 = options instanceof windowObj.Element ? {
    root: options
  } : options;
  var _opts_root;
  let root2 = (_opts_root = opts2 === null || opts2 === void 0 ? void 0 : opts2.root) !== null && _opts_root !== void 0 ? _opts_root : document.body;
  let shouldUseInert = (opts2 === null || opts2 === void 0 ? void 0 : opts2.shouldUseInert) && $5e3802645cc19319$var$supportsInert;
  let visibleNodes = new Set(targets);
  let hiddenNodes = /* @__PURE__ */ new Set();
  let getHidden = (element2) => {
    return shouldUseInert && element2 instanceof windowObj.HTMLElement ? element2.inert : element2.getAttribute("aria-hidden") === "true";
  };
  let setHidden = (element2, hidden) => {
    if (shouldUseInert && element2 instanceof windowObj.HTMLElement)
      element2.inert = hidden;
    else if (hidden)
      element2.setAttribute("aria-hidden", "true");
    else
      element2.removeAttribute("aria-hidden");
  };
  let walk = (root3) => {
    for (let element2 of root3.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
      visibleNodes.add(element2);
    let acceptNode = (node2) => {
      if (hiddenNodes.has(node2) || visibleNodes.has(node2) || node2.parentElement && hiddenNodes.has(node2.parentElement) && node2.parentElement.getAttribute("role") !== "row")
        return NodeFilter.FILTER_REJECT;
      for (let target of visibleNodes) {
        if (node2.contains(target))
          return NodeFilter.FILTER_SKIP;
      }
      return NodeFilter.FILTER_ACCEPT;
    };
    let walker = document.createTreeWalker(root3, NodeFilter.SHOW_ELEMENT, {
      acceptNode
    });
    let acceptRoot = acceptNode(root3);
    if (acceptRoot === NodeFilter.FILTER_ACCEPT)
      hide(root3);
    if (acceptRoot !== NodeFilter.FILTER_REJECT) {
      let node2 = walker.nextNode();
      while (node2 != null) {
        hide(node2);
        node2 = walker.nextNode();
      }
    }
  };
  let hide = (node2) => {
    var _refCountMap_get;
    let refCount = (_refCountMap_get = $5e3802645cc19319$var$refCountMap.get(node2)) !== null && _refCountMap_get !== void 0 ? _refCountMap_get : 0;
    if (getHidden(node2) && refCount === 0)
      return;
    if (refCount === 0)
      setHidden(node2, true);
    hiddenNodes.add(node2);
    $5e3802645cc19319$var$refCountMap.set(node2, refCount + 1);
  };
  if ($5e3802645cc19319$var$observerStack.length)
    $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].disconnect();
  walk(root2);
  let observer = new MutationObserver((changes) => {
    for (let change of changes) {
      if (change.type !== "childList")
        continue;
      if (![
        ...visibleNodes,
        ...hiddenNodes
      ].some((node2) => node2.contains(change.target)))
        for (let node2 of change.addedNodes) {
          if ((node2 instanceof HTMLElement || node2 instanceof SVGElement) && (node2.dataset.liveAnnouncer === "true" || node2.dataset.reactAriaTopLayer === "true"))
            visibleNodes.add(node2);
          else if (node2 instanceof Element)
            walk(node2);
        }
    }
  });
  observer.observe(root2, {
    childList: true,
    subtree: true
  });
  let observerWrapper = {
    visibleNodes,
    hiddenNodes,
    observe() {
      observer.observe(root2, {
        childList: true,
        subtree: true
      });
    },
    disconnect() {
      observer.disconnect();
    }
  };
  $5e3802645cc19319$var$observerStack.push(observerWrapper);
  return () => {
    observer.disconnect();
    for (let node2 of hiddenNodes) {
      let count = $5e3802645cc19319$var$refCountMap.get(node2);
      if (count == null)
        continue;
      if (count === 1) {
        setHidden(node2, false);
        $5e3802645cc19319$var$refCountMap.delete(node2);
      } else
        $5e3802645cc19319$var$refCountMap.set(node2, count - 1);
    }
    if (observerWrapper === $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1]) {
      $5e3802645cc19319$var$observerStack.pop();
      if ($5e3802645cc19319$var$observerStack.length)
        $5e3802645cc19319$var$observerStack[$5e3802645cc19319$var$observerStack.length - 1].observe();
    } else
      $5e3802645cc19319$var$observerStack.splice($5e3802645cc19319$var$observerStack.indexOf(observerWrapper), 1);
  };
}
const $b1f0cad8af73213b$export$3585ede4d035bf14 = /* @__PURE__ */ new WeakMap();
function $b1f0cad8af73213b$var$normalizeKey(key) {
  if (typeof key === "string")
    return key.replace(/\s*/g, "");
  return "" + key;
}
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey2) {
  let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
  if (!data)
    throw new Error("Unknown list");
  return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey2)}`;
}
var $c0398ad35c3639b7$exports = {};
$c0398ad35c3639b7$exports = {
  "longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
};
var $7af657c4165927c3$exports = {};
$7af657c4165927c3$exports = {
  "longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
};
var $d95d4da6d531ab81$exports = {};
$d95d4da6d531ab81$exports = {
  "longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
};
var $24ebda9c775dca17$exports = {};
$24ebda9c775dca17$exports = {
  "longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
};
var $743e0dfca6cab1e9$exports = {};
$743e0dfca6cab1e9$exports = {
  "longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
};
var $a2f41026e05f1c84$exports = {};
$a2f41026e05f1c84$exports = {
  "longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
};
var $43b800e97c901737$exports = {};
$43b800e97c901737$exports = {
  "longPressMessage": `Long press or press Alt + ArrowDown to open menu`
};
var $442f5f6ac211e29f$exports = {};
$442f5f6ac211e29f$exports = {
  "longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
};
var $dff280acfeb2d8ac$exports = {};
$dff280acfeb2d8ac$exports = {
  "longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
};
var $51608325613944d7$exports = {};
$51608325613944d7$exports = {
  "longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
};
var $c4a1b1eabeaa87be$exports = {};
$c4a1b1eabeaa87be$exports = {
  "longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
};
var $8c74815cdee18d1b$exports = {};
$8c74815cdee18d1b$exports = {
  "longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
};
var $fd0e9ef6a7fe0ec9$exports = {};
$fd0e9ef6a7fe0ec9$exports = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
};
var $a89a74a39eba465a$exports = {};
$a89a74a39eba465a$exports = {
  "longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
};
var $edc7c66594a0ae8a$exports = {};
$edc7c66594a0ae8a$exports = {
  "longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
};
var $f1ab51510712db52$exports = {};
$f1ab51510712db52$exports = {
  "longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
};
var $f9b672d9b82fa3d6$exports = {};
$f9b672d9b82fa3d6$exports = {
  "longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
};
var $a385f3910feda499$exports = {};
$a385f3910feda499$exports = {
  "longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
};
var $4f1bde932c441789$exports = {};
$4f1bde932c441789$exports = {
  "longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
};
var $914a51a8a594d5be$exports = {};
$914a51a8a594d5be$exports = {
  "longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
};
var $89aaf803103bb500$exports = {};
$89aaf803103bb500$exports = {
  "longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
};
var $c685891476dbaaca$exports = {};
$c685891476dbaaca$exports = {
  "longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
};
var $885879b9b10c2959$exports = {};
$885879b9b10c2959$exports = {
  "longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
};
var $6b39616688a51692$exports = {};
$6b39616688a51692$exports = {
  "longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
};
var $f26362aed63f47e2$exports = {};
$f26362aed63f47e2$exports = {
  "longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
};
var $06cbade644558bf0$exports = {};
$06cbade644558bf0$exports = {
  "longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
};
var $0a391ff68f9d59b1$exports = {};
$0a391ff68f9d59b1$exports = {
  "longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
};
var $8193cf0e649c7928$exports = {};
$8193cf0e649c7928$exports = {
  "longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
};
var $f398debcce5a5c55$exports = {};
$f398debcce5a5c55$exports = {
  "longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
};
var $9e9fef000aa4c013$exports = {};
$9e9fef000aa4c013$exports = {
  "longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
};
var $c016c8183bbe3d68$exports = {};
$c016c8183bbe3d68$exports = {
  "longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
};
var $ca4f6c8462244e62$exports = {};
$ca4f6c8462244e62$exports = {
  "longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
};
var $2d9960c02ccac927$exports = {};
$2d9960c02ccac927$exports = {
  "longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
};
var $f1b682a4c8c5631c$exports = {};
$f1b682a4c8c5631c$exports = {
  "longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
};
var $2cbb7ca666678a14$exports = {};
$2cbb7ca666678a14$exports = {
  "ar-AE": $c0398ad35c3639b7$exports,
  "bg-BG": $7af657c4165927c3$exports,
  "cs-CZ": $d95d4da6d531ab81$exports,
  "da-DK": $24ebda9c775dca17$exports,
  "de-DE": $743e0dfca6cab1e9$exports,
  "el-GR": $a2f41026e05f1c84$exports,
  "en-US": $43b800e97c901737$exports,
  "es-ES": $442f5f6ac211e29f$exports,
  "et-EE": $dff280acfeb2d8ac$exports,
  "fi-FI": $51608325613944d7$exports,
  "fr-FR": $c4a1b1eabeaa87be$exports,
  "he-IL": $8c74815cdee18d1b$exports,
  "hr-HR": $fd0e9ef6a7fe0ec9$exports,
  "hu-HU": $a89a74a39eba465a$exports,
  "it-IT": $edc7c66594a0ae8a$exports,
  "ja-JP": $f1ab51510712db52$exports,
  "ko-KR": $f9b672d9b82fa3d6$exports,
  "lt-LT": $a385f3910feda499$exports,
  "lv-LV": $4f1bde932c441789$exports,
  "nb-NO": $914a51a8a594d5be$exports,
  "nl-NL": $89aaf803103bb500$exports,
  "pl-PL": $c685891476dbaaca$exports,
  "pt-BR": $885879b9b10c2959$exports,
  "pt-PT": $6b39616688a51692$exports,
  "ro-RO": $f26362aed63f47e2$exports,
  "ru-RU": $06cbade644558bf0$exports,
  "sk-SK": $0a391ff68f9d59b1$exports,
  "sl-SI": $8193cf0e649c7928$exports,
  "sr-SP": $f398debcce5a5c55$exports,
  "sv-SE": $9e9fef000aa4c013$exports,
  "tr-TR": $c016c8183bbe3d68$exports,
  "uk-UA": $ca4f6c8462244e62$exports,
  "zh-CN": $2d9960c02ccac927$exports,
  "zh-TW": $f1b682a4c8c5631c$exports
};
function $parcel$interopDefault$c(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
  let { type: type4 = "menu", isDisabled, trigger = "press" } = props;
  let menuTriggerId = $bdb11010cef70236$export$f680877a34711e37$2();
  let { triggerProps, overlayProps } = $628037886ba31236$export$f9d5c8beee7d008d({
    type: type4
  }, state, ref);
  let onKeyDown = (e2) => {
    if (isDisabled)
      return;
    if (trigger === "longPress" && !e2.altKey)
      return;
    if (ref && ref.current)
      switch (e2.key) {
        case "Enter":
        case " ":
          if (trigger === "longPress" || e2.isDefaultPrevented())
            return;
        case "ArrowDown":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("first");
          break;
        case "ArrowUp":
          if (!("continuePropagation" in e2))
            e2.stopPropagation();
          e2.preventDefault();
          state.toggle("last");
          break;
        default:
          if ("continuePropagation" in e2)
            e2.continuePropagation();
      }
  };
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$c($2cbb7ca666678a14$exports), "@react-aria/menu");
  let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
    isDisabled: isDisabled || trigger !== "longPress",
    accessibilityDescription: stringFormatter.format("longPressMessage"),
    onLongPressStart() {
      state.close();
    },
    onLongPress() {
      state.open("first");
    }
  });
  let pressProps = {
    preventFocusOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType !== "touch" && e2.pointerType !== "keyboard" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.open(e2.pointerType === "virtual" ? "first" : null);
      }
    },
    onPress(e2) {
      if (e2.pointerType === "touch" && !isDisabled) {
        $7215afc6de606d6b$export$de79e2c695e052f3$5(e2.target);
        state.toggle();
      }
    }
  };
  delete triggerProps.onPress;
  return {
    // @ts-ignore - TODO we pass out both DOMAttributes AND AriaButtonProps, but useButton will discard the longPress event handlers, it's only through PressResponder magic that this works for RSP and RAC. it does not work in aria examples
    menuTriggerProps: {
      ...triggerProps,
      ...trigger === "press" ? pressProps : longPressProps,
      id: menuTriggerId,
      onKeyDown
    },
    menuProps: {
      ...overlayProps,
      "aria-labelledby": menuTriggerId,
      autoFocus: state.focusStrategy || true,
      onClose: state.close
    }
  };
}
function $2d73ec29415bd339$export$712718f7aec83d5(props, ref) {
  let { inputElementType = "input", isDisabled = false, isRequired = false, isReadOnly = false, type: type4 = "text", validationBehavior = "aria" } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || "", props.onChange);
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c$2(props, ref);
  let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2
  });
  let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  const inputOnlyProps = {
    type: type4,
    pattern: props.pattern
  };
  let [initialValue] = reactExports.useState(value2);
  var _props_defaultValue;
  $99facab73266f662$export$5add1d006293d136(ref, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : initialValue, setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1(props, validationState, ref);
  reactExports.useEffect(() => {
    if (ref.current instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(ref.current).HTMLTextAreaElement) {
      let input2 = ref.current;
      Object.defineProperty(input2, "defaultValue", {
        get: () => input2.value,
        set: () => {
        },
        configurable: true
      });
    }
  }, [
    ref
  ]);
  return {
    labelProps,
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, inputElementType === "input" ? inputOnlyProps : void 0, {
      disabled: isDisabled,
      readOnly: isReadOnly,
      required: isRequired && validationBehavior === "native",
      "aria-required": isRequired && validationBehavior === "aria" || void 0,
      "aria-invalid": isInvalid || void 0,
      "aria-errormessage": props["aria-errormessage"],
      "aria-activedescendant": props["aria-activedescendant"],
      "aria-autocomplete": props["aria-autocomplete"],
      "aria-haspopup": props["aria-haspopup"],
      "aria-controls": props["aria-controls"],
      value: value2,
      onChange: (e2) => setValue(e2.target.value),
      autoComplete: props.autoComplete,
      autoCapitalize: props.autoCapitalize,
      maxLength: props.maxLength,
      minLength: props.minLength,
      name: props.name,
      form: props.form,
      placeholder: props.placeholder,
      inputMode: props.inputMode,
      autoCorrect: props.autoCorrect,
      spellCheck: props.spellCheck,
      [parseInt(React$6.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: props.enterKeyHint,
      // Clipboard events
      onCopy: props.onCopy,
      onCut: props.onCut,
      onPaste: props.onPaste,
      // Composition events
      onCompositionEnd: props.onCompositionEnd,
      onCompositionStart: props.onCompositionStart,
      onCompositionUpdate: props.onCompositionUpdate,
      // Selection events
      onSelect: props.onSelect,
      // Input events
      onBeforeInput: props.onBeforeInput,
      onInput: props.onInput,
      ...focusableProps,
      ...fieldProps
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $d841c8010a73d545$var$supportsNativeBeforeInputEvent() {
  return typeof window !== "undefined" && window.InputEvent && typeof InputEvent.prototype.getTargetRanges === "function";
}
function $d841c8010a73d545$export$4f384c9210e583c3(props, state, inputRef) {
  let onBeforeInputFallback = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let input2 = inputRef.current;
    if (!input2)
      return;
    let nextValue = null;
    switch (e2.inputType) {
      case "historyUndo":
      case "historyRedo":
        return;
      case "insertLineBreak":
        return;
      case "deleteContent":
      case "deleteByCut":
      case "deleteByDrag":
        nextValue = input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteContentForward":
        nextValue = input2.selectionEnd === input2.selectionStart ? input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd + 1) : input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteContentBackward":
        nextValue = input2.selectionEnd === input2.selectionStart ? input2.value.slice(0, input2.selectionStart - 1) + input2.value.slice(input2.selectionStart) : input2.value.slice(0, input2.selectionStart) + input2.value.slice(input2.selectionEnd);
        break;
      case "deleteSoftLineBackward":
      case "deleteHardLineBackward":
        nextValue = input2.value.slice(input2.selectionStart);
        break;
      default:
        if (e2.data != null)
          nextValue = input2.value.slice(0, input2.selectionStart) + e2.data + input2.value.slice(input2.selectionEnd);
        break;
    }
    if (nextValue == null || !state.validate(nextValue))
      e2.preventDefault();
  });
  reactExports.useEffect(() => {
    if (!$d841c8010a73d545$var$supportsNativeBeforeInputEvent() || !inputRef.current)
      return;
    let input2 = inputRef.current;
    input2.addEventListener("beforeinput", onBeforeInputFallback, false);
    return () => {
      input2.removeEventListener("beforeinput", onBeforeInputFallback, false);
    };
  }, [
    inputRef,
    onBeforeInputFallback
  ]);
  let onBeforeInput = !$d841c8010a73d545$var$supportsNativeBeforeInputEvent() ? (e2) => {
    let nextValue = e2.target.value.slice(0, e2.target.selectionStart) + e2.data + e2.target.value.slice(e2.target.selectionEnd);
    if (!state.validate(nextValue))
      e2.preventDefault();
  } : null;
  let { labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps, ...validation } = $2d73ec29415bd339$export$712718f7aec83d5(props, inputRef);
  let compositionStartState = reactExports.useRef(null);
  return {
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(textFieldProps, {
      onBeforeInput,
      onCompositionStart() {
        let { value: value2, selectionStart, selectionEnd } = inputRef.current;
        compositionStartState.current = {
          value: value2,
          selectionStart,
          selectionEnd
        };
      },
      onCompositionEnd() {
        if (inputRef.current && !state.validate(inputRef.current.value)) {
          let { value: value2, selectionStart, selectionEnd } = compositionStartState.current;
          inputRef.current.value = value2;
          inputRef.current.setSelectionRange(selectionStart, selectionEnd);
          state.setInputValue(value2);
        }
      }
    }),
    labelProps,
    descriptionProps,
    errorMessageProps,
    ...validation
  };
}
function $parcel$interopDefault$b(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $c350ade66beef0af$export$8c18d1b4f7232bbf(props, state) {
  let { buttonRef, popoverRef, inputRef, listBoxRef, keyboardDelegate, layoutDelegate, shouldFocusWrap, isReadOnly, isDisabled } = props;
  let backupBtnRef = reactExports.useRef(null);
  buttonRef = buttonRef !== null && buttonRef !== void 0 ? buttonRef : backupBtnRef;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$b($de5926a92e8ebc5b$exports), "@react-aria/combobox");
  let { menuTriggerProps, menuProps } = $168583247155ddda$export$dc9c12ed27dd1b49({
    type: "listbox",
    isDisabled: isDisabled || isReadOnly
  }, state, buttonRef);
  $b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
    id: menuProps.id
  });
  let { collection } = state;
  let { disabledKeys } = state.selectionManager;
  let delegate = reactExports.useMemo(() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a$1({
    collection,
    disabledKeys,
    ref: listBoxRef,
    layoutDelegate
  }), [
    keyboardDelegate,
    layoutDelegate,
    collection,
    disabledKeys,
    listBoxRef
  ]);
  let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
    selectionManager: state.selectionManager,
    keyboardDelegate: delegate,
    disallowTypeAhead: true,
    disallowEmptySelection: true,
    shouldFocusWrap,
    ref: inputRef,
    // Prevent item scroll behavior from being applied here, should be handled in the user's Popover + ListBox component
    isVirtualized: true
  });
  let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572$2();
  let onKeyDown = (e2) => {
    if (e2.nativeEvent.isComposing)
      return;
    switch (e2.key) {
      case "Enter":
      case "Tab":
        if (state.isOpen && e2.key === "Enter")
          e2.preventDefault();
        if (state.isOpen && listBoxRef.current && state.selectionManager.focusedKey != null && state.selectionManager.isLink(state.selectionManager.focusedKey)) {
          let item = listBoxRef.current.querySelector(`[data-key="${CSS.escape(state.selectionManager.focusedKey.toString())}"]`);
          if (e2.key === "Enter" && item instanceof HTMLAnchorElement) {
            let collectionItem = state.collection.getItem(state.selectionManager.focusedKey);
            if (collectionItem)
              router.open(item, e2, collectionItem.props.href, collectionItem.props.routerOptions);
          }
          state.close();
        } else
          state.commit();
        break;
      case "Escape":
        if (state.selectedKey !== null || state.inputValue === "" || props.allowsCustomValue)
          e2.continuePropagation();
        state.revert();
        break;
      case "ArrowDown":
        state.open("first", "manual");
        break;
      case "ArrowUp":
        state.open("last", "manual");
        break;
      case "ArrowLeft":
      case "ArrowRight":
        state.selectionManager.setFocusedKey(null);
        break;
    }
  };
  let onBlur = (e2) => {
    var _popoverRef_current;
    let blurFromButton = (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && buttonRef.current === e2.relatedTarget;
    let blurIntoPopover = (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.contains(e2.relatedTarget);
    if (blurFromButton || blurIntoPopover)
      return;
    if (props.onBlur)
      props.onBlur(e2);
    state.setFocused(false);
  };
  let onFocus = (e2) => {
    if (state.isFocused)
      return;
    if (props.onFocus)
      props.onFocus(e2);
    state.setFocused(true);
  };
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, inputProps, descriptionProps, errorMessageProps } = $2d73ec29415bd339$export$712718f7aec83d5({
    ...props,
    onChange: state.setInputValue,
    onKeyDown: !isReadOnly ? $ff5963eb1fccf552$export$e08e3b67e392101e$9(state.isOpen && collectionProps.onKeyDown, onKeyDown, props.onKeyDown) : props.onKeyDown,
    onBlur,
    value: state.inputValue,
    onFocus,
    autoComplete: "off",
    validate: void 0,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: state
  }, inputRef);
  let onPress = (e2) => {
    if (e2.pointerType === "touch") {
      var _inputRef_current;
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      state.toggle(null, "manual");
    }
  };
  let onPressStart = (e2) => {
    if (e2.pointerType !== "touch") {
      var _inputRef_current;
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      state.toggle(e2.pointerType === "keyboard" || e2.pointerType === "virtual" ? "first" : null, "manual");
    }
  };
  let triggerLabelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: menuTriggerProps.id,
    "aria-label": stringFormatter.format("buttonLabel"),
    "aria-labelledby": props["aria-labelledby"] || labelProps.id
  });
  let listBoxProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: menuProps.id,
    "aria-label": stringFormatter.format("listboxLabel"),
    "aria-labelledby": props["aria-labelledby"] || labelProps.id
  });
  let lastEventTime = reactExports.useRef(0);
  let onTouchEnd = (e2) => {
    if (isDisabled || isReadOnly)
      return;
    if (e2.timeStamp - lastEventTime.current < 500) {
      var _inputRef_current;
      e2.preventDefault();
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
      return;
    }
    let rect = e2.target.getBoundingClientRect();
    let touch = e2.changedTouches[0];
    let centerX = Math.ceil(rect.left + 0.5 * rect.width);
    let centerY = Math.ceil(rect.top + 0.5 * rect.height);
    if (touch.clientX === centerX && touch.clientY === centerY) {
      var _inputRef_current1;
      e2.preventDefault();
      (_inputRef_current1 = inputRef.current) === null || _inputRef_current1 === void 0 ? void 0 : _inputRef_current1.focus();
      state.toggle(null, "manual");
      lastEventTime.current = e2.timeStamp;
    }
  };
  let focusedItem = state.selectionManager.focusedKey != null && state.isOpen ? state.collection.getItem(state.selectionManager.focusedKey) : void 0;
  var _focusedItem_parentKey;
  let sectionKey = (_focusedItem_parentKey = focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) !== null && _focusedItem_parentKey !== void 0 ? _focusedItem_parentKey : null;
  var _state_selectionManager_focusedKey;
  let itemKey2 = (_state_selectionManager_focusedKey = state.selectionManager.focusedKey) !== null && _state_selectionManager_focusedKey !== void 0 ? _state_selectionManager_focusedKey : null;
  let lastSection = reactExports.useRef(sectionKey);
  let lastItem = reactExports.useRef(itemKey2);
  reactExports.useEffect(() => {
    if ($c87311424ea30a05$export$e1865c3bedcd822b() && focusedItem != null && itemKey2 != null && itemKey2 !== lastItem.current) {
      let isSelected = state.selectionManager.isSelected(itemKey2);
      let section = sectionKey != null ? state.collection.getItem(sectionKey) : null;
      let sectionTitle = (section === null || section === void 0 ? void 0 : section["aria-label"]) || (typeof (section === null || section === void 0 ? void 0 : section.rendered) === "string" ? section.rendered : "") || "";
      var _ref;
      let announcement = stringFormatter.format("focusAnnouncement", {
        isGroupChange: (_ref = section && sectionKey !== lastSection.current) !== null && _ref !== void 0 ? _ref : false,
        groupTitle: sectionTitle,
        groupCount: section ? [
          ...$c5a24bc478652b5f$export$1005530eda016c13(section, state.collection)
        ].length : 0,
        optionText: focusedItem["aria-label"] || focusedItem.textValue || "",
        isSelected
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSection.current = sectionKey;
    lastItem.current = itemKey2;
  });
  let optionCount = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
  let lastSize = reactExports.useRef(optionCount);
  let lastOpen = reactExports.useRef(state.isOpen);
  reactExports.useEffect(() => {
    let didOpenWithoutFocusedItem = state.isOpen !== lastOpen.current && (state.selectionManager.focusedKey == null || $c87311424ea30a05$export$e1865c3bedcd822b());
    if (state.isOpen && (didOpenWithoutFocusedItem || optionCount !== lastSize.current)) {
      let announcement = stringFormatter.format("countAnnouncement", {
        optionCount
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSize.current = optionCount;
    lastOpen.current = state.isOpen;
  });
  let lastSelectedKey = reactExports.useRef(state.selectedKey);
  reactExports.useEffect(() => {
    if ($c87311424ea30a05$export$e1865c3bedcd822b() && state.isFocused && state.selectedItem && state.selectedKey !== lastSelectedKey.current) {
      let optionText = state.selectedItem["aria-label"] || state.selectedItem.textValue || "";
      let announcement = stringFormatter.format("selectedAnnouncement", {
        optionText
      });
      $319e236875307eab$export$a9b970dcc4ae71a9(announcement);
    }
    lastSelectedKey.current = state.selectedKey;
  });
  reactExports.useEffect(() => {
    if (state.isOpen)
      return $5e3802645cc19319$export$1c3ebcada18427bf([
        inputRef.current,
        popoverRef.current
      ].filter((element2) => element2 != null));
  }, [
    state.isOpen,
    inputRef,
    popoverRef
  ]);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (!focusedItem && inputRef.current && $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(inputRef.current)) === inputRef.current)
      $55f9b1ae81f22853$export$2b35b76d2e30e129(inputRef.current, null);
  }, [
    focusedItem
  ]);
  return {
    labelProps,
    buttonProps: {
      ...menuTriggerProps,
      ...triggerLabelProps,
      excludeFromTabOrder: true,
      preventFocusOnPress: true,
      onPress,
      onPressStart,
      isDisabled: isDisabled || isReadOnly
    },
    inputProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(inputProps, {
      role: "combobox",
      "aria-expanded": menuTriggerProps["aria-expanded"],
      "aria-controls": state.isOpen ? menuProps.id : void 0,
      // TODO: readd proper logic for completionMode = complete (aria-autocomplete: both)
      "aria-autocomplete": "list",
      "aria-activedescendant": focusedItem ? $b1f0cad8af73213b$export$9145995848b05025(state, focusedItem.key) : void 0,
      onTouchEnd,
      // This disable's iOS's autocorrect suggestions, since the combo box provides its own suggestions.
      autoCorrect: "off",
      // This disable's the macOS Safari spell check auto corrections.
      spellCheck: "false"
    }),
    listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(menuProps, listBoxProps, {
      autoFocus: state.focusStrategy || true,
      shouldUseVirtualFocus: true,
      shouldSelectOnPressUp: true,
      shouldFocusOnHover: true,
      linkBehavior: "selection"
    }),
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useAutocomplete(originalProps) {
  var _a2, _b2, _c2, _d, _e;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, autocomplete.variantKeys);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isClearable = originalProps.disableClearable !== void 0 ? !originalProps.disableClearable : originalProps.isReadOnly ? false : originalProps.isClearable;
  const {
    ref,
    as: as2,
    label,
    isLoading,
    menuTrigger = "focus",
    filterOptions = {
      sensitivity: "base"
    },
    children,
    selectorIcon,
    clearIcon,
    scrollRef: scrollRefProp,
    defaultFilter,
    endContent,
    allowsEmptyCollection = true,
    shouldCloseOnBlur = true,
    popoverProps = {},
    inputProps: userInputProps = {},
    scrollShadowProps = {},
    listboxProps = {},
    selectorButtonProps = {},
    clearButtonProps = {},
    showScrollIndicators = true,
    allowsCustomValue = false,
    isVirtualized,
    maxListboxHeight = 256,
    itemHeight = 32,
    validationBehavior = (_c2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native",
    className,
    classNames: classNames2,
    errorMessage,
    onOpenChange,
    onClose,
    onClear,
    isReadOnly = false,
    ...otherProps
  } = props;
  const { contains: contains2 } = $bb77f239b46e8c72$export$3274cf84b703fff(filterOptions);
  let state = $a9e7382a7d111cb5$export$b453a3bfd4a5fa9e({
    ...originalProps,
    children,
    menuTrigger,
    validationBehavior,
    shouldCloseOnBlur,
    allowsEmptyCollection,
    defaultFilter: defaultFilter && typeof defaultFilter === "function" ? defaultFilter : contains2,
    onOpenChange: (open, menuTrigger2) => {
      onOpenChange == null ? void 0 : onOpenChange(open, menuTrigger2);
      if (!open) {
        onClose == null ? void 0 : onClose();
      }
    }
  });
  state = {
    ...state,
    ...isReadOnly && {
      disabledKeys: /* @__PURE__ */ new Set([...state.collection.getKeys()])
    }
  };
  const buttonRef = reactExports.useRef(null);
  const inputWrapperRef = reactExports.useRef(null);
  const listBoxRef = reactExports.useRef(null);
  const popoverRef = reactExports.useRef(null);
  const inputRef = useDOMRef(ref);
  const scrollShadowRef = useDOMRef(scrollRefProp);
  const {
    buttonProps,
    inputProps,
    listBoxProps,
    isInvalid: isAriaInvalid,
    validationDetails,
    validationErrors
  } = $c350ade66beef0af$export$8c18d1b4f7232bbf(
    {
      validationBehavior,
      ...originalProps,
      inputRef,
      buttonRef,
      listBoxRef,
      popoverRef
    },
    state
  );
  const isInvalid = originalProps.isInvalid || isAriaInvalid;
  const slotsProps = {
    inputProps: mergeProps$3(
      {
        label,
        ref: inputRef,
        wrapperRef: inputWrapperRef,
        onClick: () => {
          if (!state.isOpen && !!state.selectedItem) {
            state.open();
          }
        },
        isClearable: false,
        disableAnimation
      },
      userInputProps
    ),
    popoverProps: mergeProps$3(
      {
        offset: 5,
        placement: "bottom",
        triggerScaleOnOpen: false,
        disableAnimation
      },
      popoverProps
    ),
    scrollShadowProps: mergeProps$3(
      {
        ref: scrollShadowRef,
        isEnabled: (_d = showScrollIndicators && state.collection.size > 5) != null ? _d : true,
        hideScrollBar: true,
        offset: 15
      },
      scrollShadowProps
    ),
    listboxProps: mergeProps$3(
      {
        hideEmptyContent: allowsCustomValue,
        emptyContent: "No results found.",
        disableAnimation
      },
      listboxProps
    ),
    selectorButtonProps: mergeProps$3(
      {
        isLoading,
        size: "sm",
        variant: "light",
        radius: "full",
        color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
        isIconOnly: true,
        disableAnimation
      },
      selectorButtonProps
    ),
    clearButtonProps: mergeProps$3(
      {
        size: "sm",
        variant: "light",
        radius: "full",
        color: isInvalid ? "danger" : originalProps == null ? void 0 : originalProps.color,
        isIconOnly: true,
        disableAnimation
      },
      clearButtonProps
    )
  };
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const isOpen = ((_e = slotsProps.listboxProps) == null ? void 0 : _e.hideEmptyContent) ? state.isOpen && !!state.collection.size : state.isOpen;
  useSafeLayoutEffect(() => {
    if (!inputRef.current)
      return;
    const key = inputRef.current.value;
    const item = state.collection.getItem(key);
    if (item && state.inputValue !== item.textValue) {
      state.setSelectedKey(key);
      state.setInputValue(item.textValue);
    }
  }, [inputRef.current]);
  reactExports.useEffect(() => {
    let keyToFocus;
    if (state.selectedKey !== null && state.collection.getItem(state.selectedKey) && !state.disabledKeys.has(state.selectedKey)) {
      keyToFocus = state.selectedKey;
    } else {
      let firstAvailableKey = state.collection.getFirstKey();
      while (firstAvailableKey && state.disabledKeys.has(firstAvailableKey)) {
        firstAvailableKey = state.collection.getKeyAfter(firstAvailableKey);
      }
      keyToFocus = firstAvailableKey;
    }
    state.selectionManager.setFocusedKey(keyToFocus);
  }, [state.collection, state.disabledKeys, state.selectedKey]);
  reactExports.useEffect(() => {
    if (state.isOpen && popoverRef.current && listBoxRef.current) {
      let selectedItem = listBoxRef.current.querySelector("[aria-selected=true] [data-label=true]");
      let scrollShadow2 = scrollShadowRef.current;
      if (selectedItem && scrollShadow2 && selectedItem.parentElement) {
        let scrollShadowRect = scrollShadow2 == null ? void 0 : scrollShadow2.getBoundingClientRect();
        let scrollShadowHeight = scrollShadowRect.height;
        scrollShadow2.scrollTop = selectedItem.parentElement.offsetTop - scrollShadowHeight / 2 + selectedItem.parentElement.clientHeight / 2;
        state.selectionManager.setFocusedKey(state.selectedKey);
      }
    }
  }, [state.isOpen, disableAnimation]);
  reactExports.useEffect(() => {
    if (isOpen) {
      if (popoverRef.current && inputWrapperRef.current) {
        let rect = inputWrapperRef.current.getBoundingClientRect();
        let popover2 = popoverRef.current;
        popover2.style.width = rect.width + "px";
      }
    }
  }, [isOpen]);
  if (inputProps.onKeyDown) {
    const originalOnKeyDown = inputProps.onKeyDown;
    inputProps.onKeyDown = (e2) => {
      if ("continuePropagation" in e2) {
        e2.stopPropagation = () => {
        };
      }
      return originalOnKeyDown(e2);
    };
  }
  const Component2 = as2 || "div";
  const slots = reactExports.useMemo(
    () => autocomplete({
      ...variantProps2,
      isClearable,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isClearable, disableAnimation]
  );
  const getBaseProps = () => ({
    "data-invalid": dataAttr(isInvalid),
    "data-open": dataAttr(state.isOpen),
    className: slots.base({ class: baseStyles })
  });
  const getSelectorButtonProps = () => {
    var _a22;
    return {
      ref: buttonRef,
      ...mergeProps$3(buttonProps, slotsProps.selectorButtonProps),
      "data-open": dataAttr(state.isOpen),
      className: slots.selectorButton({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.selectorButton, (_a22 = slotsProps.selectorButtonProps) == null ? void 0 : _a22.className)
      })
    };
  };
  const getClearButtonProps = () => {
    var _a22, _b22;
    return {
      ...mergeProps$3(buttonProps, slotsProps.clearButtonProps),
      // disable original focus and state toggle from react aria
      onPressStart: () => {
        var _a3;
        (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
      },
      onPress: (e2) => {
        var _a3, _b3;
        (_b3 = (_a3 = slotsProps.clearButtonProps) == null ? void 0 : _a3.onPress) == null ? void 0 : _b3.call(_a3, e2);
        if (state.selectedItem) {
          state.setSelectedKey(null);
        }
        state.setInputValue("");
        state.open();
        onClear == null ? void 0 : onClear();
      },
      "data-visible": !!state.selectedItem || ((_a22 = state.inputValue) == null ? void 0 : _a22.length) > 0,
      className: slots.clearButton({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.clearButton, (_b22 = slotsProps.clearButtonProps) == null ? void 0 : _b22.className)
      })
    };
  };
  const hasUncommittedValidation = validationBehavior === "native" && state.displayValidation.isInvalid === false && state.realtimeValidation.isInvalid === true;
  const getInputProps = () => ({
    ...otherProps,
    ...inputProps,
    ...slotsProps.inputProps,
    isInvalid: hasUncommittedValidation ? void 0 : isInvalid,
    validationBehavior,
    errorMessage: typeof errorMessage === "function" ? errorMessage({ isInvalid, validationErrors, validationDetails }) : errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" ")),
    onClick: chain(slotsProps.inputProps.onClick, otherProps.onClick)
  });
  const getListBoxProps = () => {
    const shouldVirtualize = isVirtualized != null ? isVirtualized : state.collection.size > 50;
    return {
      state,
      ref: listBoxRef,
      isVirtualized: shouldVirtualize,
      virtualization: shouldVirtualize ? {
        maxListboxHeight,
        itemHeight
      } : void 0,
      scrollShadowProps: slotsProps.scrollShadowProps,
      ...mergeProps$3(slotsProps.listboxProps, listBoxProps, {
        shouldHighlightOnFocus: true
      })
    };
  };
  const getPopoverProps = (props2 = {}) => {
    var _a22, _b22, _c22;
    const popoverProps2 = mergeProps$3(slotsProps.popoverProps, props2);
    return {
      state,
      ref: popoverRef,
      triggerRef: inputWrapperRef,
      scrollRef: listBoxRef,
      triggerType: "listbox",
      ...popoverProps2,
      classNames: {
        ...(_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.classNames,
        content: slots.popoverContent({
          class: clsx$5(
            classNames2 == null ? void 0 : classNames2.popoverContent,
            (_c22 = (_b22 = slotsProps.popoverProps) == null ? void 0 : _b22.classNames) == null ? void 0 : _c22["content"],
            props2.className
          )
        })
      },
      // when the popover is open, the focus should be on input instead of dialog
      // therefore, we skip dialog focus here
      disableDialogFocus: true
    };
  };
  const getEmptyPopoverProps = () => {
    return {
      ref: popoverRef,
      className: "hidden"
    };
  };
  const getListBoxWrapperProps = (props2 = {}) => {
    var _a22, _b22;
    return {
      ...mergeProps$3(slotsProps.scrollShadowProps, props2),
      className: slots.listboxWrapper({
        class: clsx$5(
          classNames2 == null ? void 0 : classNames2.listboxWrapper,
          (_a22 = slotsProps.scrollShadowProps) == null ? void 0 : _a22.className,
          props2 == null ? void 0 : props2.className
        )
      }),
      style: {
        maxHeight: (_b22 = originalProps.maxListboxHeight) != null ? _b22 : 256
      }
    };
  };
  const getEndContentWrapperProps = (props2 = {}) => ({
    className: slots.endContentWrapper({
      class: clsx$5(classNames2 == null ? void 0 : classNames2.endContentWrapper, props2 == null ? void 0 : props2.className)
    }),
    onPointerDown: chain(props2.onPointerDown, (e2) => {
      var _a22;
      if (e2.button === 0 && e2.currentTarget === e2.target) {
        (_a22 = inputRef.current) == null ? void 0 : _a22.focus();
      }
    }),
    onMouseDown: chain(props2.onMouseDown, (e2) => {
      if (e2.button === 0 && e2.currentTarget === e2.target) {
        e2.preventDefault();
      }
    })
  });
  return {
    Component: Component2,
    inputRef,
    label,
    state,
    slots,
    classNames: classNames2,
    isLoading,
    clearIcon,
    isOpen,
    endContent,
    isClearable,
    disableAnimation,
    allowsCustomValue,
    selectorIcon,
    getBaseProps,
    getInputProps,
    getListBoxProps,
    getPopoverProps,
    getEmptyPopoverProps,
    getClearButtonProps,
    getSelectorButtonProps,
    getListBoxWrapperProps,
    getEndContentWrapperProps
  };
}
var Autocomplete = forwardRef(function Autocomplete2(props, ref) {
  var _a2;
  const {
    Component: Component2,
    isOpen,
    disableAnimation,
    selectorIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}),
    clearIcon = /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, {}),
    endContent,
    getBaseProps,
    getSelectorButtonProps,
    getInputProps,
    getListBoxProps,
    getPopoverProps,
    getEmptyPopoverProps,
    getClearButtonProps,
    getListBoxWrapperProps,
    getEndContentWrapperProps
  } = useAutocomplete({ ...props, ref });
  const listboxProps = getListBoxProps();
  const popoverContent = isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(scroll_shadow_default, { ...getListBoxWrapperProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_default, { ...listboxProps }) }) }) : ((_a2 = listboxProps.state) == null ? void 0 : _a2.collection.size) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getEmptyPopoverProps() }) : null;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        ...getInputProps(),
        endContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getEndContentWrapperProps(), children: [
          endContent || /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getClearButtonProps(), children: clearIcon }),
          selectorIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: selectorIcon })
        ] })
      }
    ),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var autocomplete_default = Autocomplete;
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$3(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS$3 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$3 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$3(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$3.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$3.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$3 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$3 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$3);
const $b5e257d569688ac6$var$IsSSRContext$3 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$3 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$3(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$3);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$3.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$3.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$3.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$3(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$3);
  let counter = $b5e257d569688ac6$var$useCounter$3(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$3(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$3());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$3.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$3 : $b5e257d569688ac6$var$useLegacySSRSafeId$3;
function $b5e257d569688ac6$var$getSnapshot$3() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$3() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$3(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$3() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$3, $b5e257d569688ac6$var$getSnapshot$3, $b5e257d569688ac6$var$getServerSnapshot$3);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$3);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$3 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$3] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$3(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$3 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3();
let $1e5a04cdaf7d1af8$var$listeners$3 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$3() {
  $1e5a04cdaf7d1af8$var$currentLocale$3 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$3();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$3)
    listener($1e5a04cdaf7d1af8$var$currentLocale$3);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$3() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$3();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$3);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$3.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$3);
    $1e5a04cdaf7d1af8$var$listeners$3.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$3.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$3.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$3);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$3 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$3();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$3);
  return context || defaultLocale;
}
function $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {
  options = $5a387cc49350e6db$export$722debc0e56fea39(options !== null && options !== void 0 ? options : {}, $896ba0a80a8f4d36$var$isEqual);
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  return reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, options), [
    locale2,
    options
  ]);
}
function $896ba0a80a8f4d36$var$isEqual(a2, b2) {
  if (a2 === b2)
    return true;
  let aKeys = Object.keys(a2);
  let bKeys = Object.keys(b2);
  if (aKeys.length !== bKeys.length)
    return false;
  for (let key of aKeys) {
    if (b2[key] !== a2[key])
      return false;
  }
  return true;
}
function useCalendarBase(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const [props, variantProps2] = mapPropsVariants(originalProps, calendar$2.variantKeys);
  const globalContext = useProviderContext();
  const { locale: locale2, direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const isRTL = direction === "rtl";
  const calendarProp = $64244302c3013299$export$dd0bbc9b26defe37(
    new $fb18d541ea1ad717$export$ad991b66133851cf(locale2).resolvedOptions().calendar
  );
  const gregorianYearOffset = getGregorianYearOffset(calendarProp.identifier);
  const {
    ref,
    as: as2,
    children,
    className,
    topContent,
    bottomContent,
    showHelper = true,
    firstDayOfWeek,
    calendarWidth = 256,
    visibleMonths: visibleMonthsProp = 1,
    weekdayStyle = "narrow",
    navButtonProps = {},
    isHeaderExpanded: isHeaderExpandedProp,
    isHeaderDefaultExpanded,
    onHeaderExpandedChange = () => {
    },
    createCalendar: createCalendarProp = (_a2 = globalContext == null ? void 0 : globalContext.createCalendar) != null ? _a2 : null,
    minValue = (_c2 = (_b2 = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _b2.minDate) != null ? _c2 : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 1900 + gregorianYearOffset, 1, 1),
    maxValue = (_e = (_d = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _d.maxDate) != null ? _e : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 2099 + gregorianYearOffset, 12, 31),
    prevButtonProps: prevButtonPropsProp,
    nextButtonProps: nextButtonPropsProp,
    errorMessage,
    classNames: classNames2,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const visibleMonths = clamp$3(visibleMonthsProp, 1, 3);
  const showMonthAndYearPickers = originalProps.showMonthAndYearPickers && visibleMonths === 1;
  const domRef = useDOMRef(ref);
  const handleHeaderExpandedChange = reactExports.useCallback(
    (isExpanded) => {
      onHeaderExpandedChange(isExpanded || false);
    },
    [onHeaderExpandedChange]
  );
  const [isHeaderExpanded, setIsHeaderExpanded] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$3(
    isHeaderExpandedProp,
    isHeaderDefaultExpanded != null ? isHeaderDefaultExpanded : false,
    handleHeaderExpandedChange
  );
  const visibleDuration = reactExports.useMemo(() => ({ months: visibleMonths }), [visibleMonths]);
  const hasMultipleMonths = visibleMonths > 1;
  const shouldFilterDOMProps = typeof Component2 === "string";
  const slots = reactExports.useMemo(
    () => calendar$2({
      ...variantProps2,
      showMonthAndYearPickers,
      isRange: !!originalProps.isRange,
      isHeaderWrapperExpanded: isHeaderExpanded,
      className,
      isRTL
    }),
    [objectToDeps(variantProps2), showMonthAndYearPickers, isHeaderExpanded, className]
  );
  const disableAnimation = (_g = (_f = originalProps.disableAnimation) != null ? _f : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _g : false;
  const commonButtonProps = {
    size: "sm",
    variant: "light",
    radius: "full",
    isIconOnly: true,
    disableAnimation,
    ...navButtonProps
  };
  const baseProps = {
    "data-slot": "base",
    "data-has-multiple-months": dataAttr(hasMultipleMonths),
    style: {
      // @ts-ignore
      "--visible-months": typeof visibleMonths === "number" ? `${visibleMonths}` : visibleMonths,
      "--calendar-width": typeof calendarWidth === "number" ? `${calendarWidth}px` : calendarWidth
    }
  };
  const getPrevButtonProps = (props2 = {}) => {
    return {
      "data-slot": "prev-button",
      tabIndex: isHeaderExpanded ? -1 : 0,
      className: slots.prevButton({ class: classNames2 == null ? void 0 : classNames2.prevButton }),
      ...mergeProps$3(commonButtonProps, prevButtonPropsProp, props2)
    };
  };
  const getNextButtonProps = (props2 = {}) => {
    return {
      "data-slot": "next-button",
      tabIndex: isHeaderExpanded ? -1 : 0,
      className: slots.nextButton({ class: classNames2 == null ? void 0 : classNames2.nextButton }),
      ...mergeProps$3(commonButtonProps, nextButtonPropsProp, props2)
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      "data-slot": "error-message",
      className: slots.errorMessage({ class: classNames2 == null ? void 0 : classNames2.errorMessage }),
      ...props2
    };
  };
  return {
    Component: Component2,
    children,
    domRef,
    slots,
    locale: locale2,
    minValue,
    maxValue,
    baseProps,
    showHelper,
    firstDayOfWeek,
    weekdayStyle,
    visibleMonths,
    visibleDuration,
    shouldFilterDOMProps,
    isHeaderExpanded,
    showMonthAndYearPickers,
    disableAnimation,
    createCalendar: createCalendarProp,
    getPrevButtonProps,
    getNextButtonProps,
    getErrorMessageProps,
    setIsHeaderExpanded,
    topContent,
    bottomContent,
    errorMessage,
    classNames: classNames2,
    otherProps
  };
}
var $39324ace0d945f59$exports = {};
$39324ace0d945f59$exports = {
  "dateRange": (args) => `${args.startDate} إلى ${args.endDate}`,
  "dateSelected": (args) => `${args.date} المحدد`,
  "finishRangeSelectionPrompt": `انقر لإنهاء عملية تحديد نطاق التاريخ`,
  "maximumDate": `آخر تاريخ متاح`,
  "minimumDate": `أول تاريخ متاح`,
  "next": `التالي`,
  "previous": `السابق`,
  "selectedDateDescription": (args) => `تاريخ محدد: ${args.date}`,
  "selectedRangeDescription": (args) => `المدى الزمني المحدد: ${args.dateRange}`,
  "startRangeSelectionPrompt": `انقر لبدء عملية تحديد نطاق التاريخ`,
  "todayDate": (args) => `اليوم، ${args.date}`,
  "todayDateSelected": (args) => `اليوم، ${args.date} محدد`
};
var $1830a539e98c7baf$exports = {};
$1830a539e98c7baf$exports = {
  "dateRange": (args) => `${args.startDate} до ${args.endDate}`,
  "dateSelected": (args) => `Избрано е ${args.date}`,
  "finishRangeSelectionPrompt": `Натиснете, за да довършите избора на времеви интервал`,
  "maximumDate": `Последна налична дата`,
  "minimumDate": `Първа налична дата`,
  "next": `Напред`,
  "previous": `Назад`,
  "selectedDateDescription": (args) => `Избрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Избран диапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Натиснете, за да пристъпите към избора на времеви интервал`,
  "todayDate": (args) => `Днес, ${args.date}`,
  "todayDateSelected": (args) => `Днес, ${args.date} са избрани`
};
var $f4b92528965aab97$exports = {};
$f4b92528965aab97$exports = {
  "dateRange": (args) => `${args.startDate} až ${args.endDate}`,
  "dateSelected": (args) => `Vybráno ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknutím dokončíte výběr rozsahu dat`,
  "maximumDate": `Poslední dostupné datum`,
  "minimumDate": `První dostupné datum`,
  "next": `Další`,
  "previous": `Předchozí`,
  "selectedDateDescription": (args) => `Vybrané datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybrané období: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknutím zahájíte výběr rozsahu dat`,
  "todayDate": (args) => `Dnes, ${args.date}`,
  "todayDateSelected": (args) => `Dnes, vybráno ${args.date}`
};
var $1cd578ef0547c8f1$exports = {};
$1cd578ef0547c8f1$exports = {
  "dateRange": (args) => `${args.startDate} til ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valgt`,
  "finishRangeSelectionPrompt": `Klik for at fuldføre valg af datoområde`,
  "maximumDate": `Sidste ledige dato`,
  "minimumDate": `Første ledige dato`,
  "next": `Næste`,
  "previous": `Forrige`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt interval: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klik for at starte valg af datoområde`,
  "todayDate": (args) => `I dag, ${args.date}`,
  "todayDateSelected": (args) => `I dag, ${args.date} valgt`
};
var $db55a8973925d619$exports = {};
$db55a8973925d619$exports = {
  "dateRange": (args) => `${args.startDate} bis ${args.endDate}`,
  "dateSelected": (args) => `${args.date} ausgewählt`,
  "finishRangeSelectionPrompt": `Klicken, um die Auswahl des Datumsbereichs zu beenden`,
  "maximumDate": `Letztes verfügbares Datum`,
  "minimumDate": `Erstes verfügbares Datum`,
  "next": `Weiter`,
  "previous": `Zurück`,
  "selectedDateDescription": (args) => `Ausgewähltes Datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Ausgewählter Bereich: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klicken, um die Auswahl des Datumsbereichs zu beginnen`,
  "todayDate": (args) => `Heute, ${args.date}`,
  "todayDateSelected": (args) => `Heute, ${args.date} ausgewählt`
};
var $ec6937d58566d443$exports = {};
$ec6937d58566d443$exports = {
  "dateRange": (args) => `${args.startDate} έως ${args.endDate}`,
  "dateSelected": (args) => `Επιλέχθηκε ${args.date}`,
  "finishRangeSelectionPrompt": `Κάντε κλικ για να ολοκληρώσετε την επιλογή εύρους ημερομηνιών`,
  "maximumDate": `Τελευταία διαθέσιμη ημερομηνία`,
  "minimumDate": `Πρώτη διαθέσιμη ημερομηνία`,
  "next": `Επόμενο`,
  "previous": `Προηγούμενο`,
  "selectedDateDescription": (args) => `Επιλεγμένη ημερομηνία: ${args.date}`,
  "selectedRangeDescription": (args) => `Επιλεγμένο εύρος: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Κάντε κλικ για να ξεκινήσετε την επιλογή εύρους ημερομηνιών`,
  "todayDate": (args) => `Σήμερα, ${args.date}`,
  "todayDateSelected": (args) => `Σήμερα, επιλέχτηκε ${args.date}`
};
var $1f5cea0742dc284a$exports = {};
$1f5cea0742dc284a$exports = {
  "previous": `Previous`,
  "next": `Next`,
  "selectedDateDescription": (args) => `Selected Date: ${args.date}`,
  "selectedRangeDescription": (args) => `Selected Range: ${args.dateRange}`,
  "todayDate": (args) => `Today, ${args.date}`,
  "todayDateSelected": (args) => `Today, ${args.date} selected`,
  "dateSelected": (args) => `${args.date} selected`,
  "startRangeSelectionPrompt": `Click to start selecting date range`,
  "finishRangeSelectionPrompt": `Click to finish selecting date range`,
  "minimumDate": `First available date`,
  "maximumDate": `Last available date`,
  "dateRange": (args) => `${args.startDate} to ${args.endDate}`
};
var $2ca7ea366384817b$exports = {};
$2ca7ea366384817b$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} seleccionado`,
  "finishRangeSelectionPrompt": `Haga clic para terminar de seleccionar rango de fechas`,
  "maximumDate": `Última fecha disponible`,
  "minimumDate": `Primera fecha disponible`,
  "next": `Siguiente`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Fecha seleccionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo seleccionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Haga clic para comenzar a seleccionar un rango de fechas`,
  "todayDate": (args) => `Hoy, ${args.date}`,
  "todayDateSelected": (args) => `Hoy, ${args.date} seleccionado`
};
var $97874a7fe9cd091f$exports = {};
$97874a7fe9cd091f$exports = {
  "dateRange": (args) => `${args.startDate} kuni ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valitud`,
  "finishRangeSelectionPrompt": `Klõpsake kuupäevavahemiku valimise lõpetamiseks`,
  "maximumDate": `Viimane saadaolev kuupäev`,
  "minimumDate": `Esimene saadaolev kuupäev`,
  "next": `Järgmine`,
  "previous": `Eelmine`,
  "selectedDateDescription": (args) => `Valitud kuupäev: ${args.date}`,
  "selectedRangeDescription": (args) => `Valitud vahemik: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klõpsake kuupäevavahemiku valimiseks`,
  "todayDate": (args) => `Täna, ${args.date}`,
  "todayDateSelected": (args) => `Täna, ${args.date} valitud`
};
var $5d376b7fce1a45b2$exports = {};
$5d376b7fce1a45b2$exports = {
  "dateRange": (args) => `${args.startDate} – ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valittu`,
  "finishRangeSelectionPrompt": `Lopeta päivämääräalueen valinta napsauttamalla tätä.`,
  "maximumDate": `Viimeinen varattavissa oleva päivämäärä`,
  "minimumDate": `Ensimmäinen varattavissa oleva päivämäärä`,
  "next": `Seuraava`,
  "previous": `Edellinen`,
  "selectedDateDescription": (args) => `Valittu päivämäärä: ${args.date}`,
  "selectedRangeDescription": (args) => `Valittu aikaväli: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Aloita päivämääräalueen valinta napsauttamalla tätä.`,
  "todayDate": (args) => `Tänään, ${args.date}`,
  "todayDateSelected": (args) => `Tänään, ${args.date} valittu`
};
var $3bf722b362aaf54d$exports = {};
$3bf722b362aaf54d$exports = {
  "dateRange": (args) => `${args.startDate} à ${args.endDate}`,
  "dateSelected": (args) => `${args.date} sélectionné`,
  "finishRangeSelectionPrompt": `Cliquer pour finir de sélectionner la plage de dates`,
  "maximumDate": `Dernière date disponible`,
  "minimumDate": `Première date disponible`,
  "next": `Suivant`,
  "previous": `Précédent`,
  "selectedDateDescription": (args) => `Date sélectionnée : ${args.date}`,
  "selectedRangeDescription": (args) => `Plage sélectionnée : ${args.dateRange}`,
  "startRangeSelectionPrompt": `Cliquer pour commencer à sélectionner la plage de dates`,
  "todayDate": (args) => `Aujourd'hui, ${args.date}`,
  "todayDateSelected": (args) => `Aujourd’hui, ${args.date} sélectionné`
};
var $38c43f8322316031$exports = {};
$38c43f8322316031$exports = {
  "dateRange": (args) => `${args.startDate} עד ${args.endDate}`,
  "dateSelected": (args) => `${args.date} נבחר`,
  "finishRangeSelectionPrompt": `חץ כדי לסיים את בחירת טווח התאריכים`,
  "maximumDate": `תאריך פנוי אחרון`,
  "minimumDate": `תאריך פנוי ראשון`,
  "next": `הבא`,
  "previous": `הקודם`,
  "selectedDateDescription": (args) => `תאריך נבחר: ${args.date}`,
  "selectedRangeDescription": (args) => `טווח נבחר: ${args.dateRange}`,
  "startRangeSelectionPrompt": `לחץ כדי להתחיל בבחירת טווח התאריכים`,
  "todayDate": (args) => `היום, ${args.date}`,
  "todayDateSelected": (args) => `היום, ${args.date} נבחר`
};
var $c90e0f32b44630bf$exports = {};
$c90e0f32b44630bf$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} odabran`,
  "finishRangeSelectionPrompt": `Kliknite da dovršite raspon odabranih datuma`,
  "maximumDate": `Posljednji raspoloživi datum`,
  "minimumDate": `Prvi raspoloživi datum`,
  "next": `Sljedeći`,
  "previous": `Prethodni`,
  "selectedDateDescription": (args) => `Odabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Odabrani raspon: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite da započnete raspon odabranih datuma`,
  "todayDate": (args) => `Danas, ${args.date}`,
  "todayDateSelected": (args) => `Danas, odabran ${args.date}`
};
var $715875e6e7a338f4$exports = {};
$715875e6e7a338f4$exports = {
  "dateRange": (args) => `${args.startDate}–${args.endDate}`,
  "dateSelected": (args) => `${args.date} kiválasztva`,
  "finishRangeSelectionPrompt": `Kattintson a dátumtartomány kijelölésének befejezéséhez`,
  "maximumDate": `Utolsó elérhető dátum`,
  "minimumDate": `Az első elérhető dátum`,
  "next": `Következő`,
  "previous": `Előző`,
  "selectedDateDescription": (args) => `Kijelölt dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Kijelölt tartomány: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kattintson a dátumtartomány kijelölésének indításához`,
  "todayDate": (args) => `Ma, ${args.date}`,
  "todayDateSelected": (args) => `Ma, ${args.date} kijelölve`
};
var $37d77c66e34daccf$exports = {};
$37d77c66e34daccf$exports = {
  "dateRange": (args) => `Da ${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selezionata`,
  "finishRangeSelectionPrompt": `Fai clic per completare la selezione dell’intervallo di date`,
  "maximumDate": `Ultima data disponibile`,
  "minimumDate": `Prima data disponibile`,
  "next": `Successivo`,
  "previous": `Precedente`,
  "selectedDateDescription": (args) => `Data selezionata: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervallo selezionato: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Fai clic per selezionare l’intervallo di date`,
  "todayDate": (args) => `Oggi, ${args.date}`,
  "todayDateSelected": (args) => `Oggi, ${args.date} selezionata`
};
var $542f39aee29303c3$exports = {};
$542f39aee29303c3$exports = {
  "dateRange": (args) => `${args.startDate} から ${args.endDate}`,
  "dateSelected": (args) => `${args.date} を選択`,
  "finishRangeSelectionPrompt": `クリックして日付範囲の選択を終了`,
  "maximumDate": `最終利用可能日`,
  "minimumDate": `最初の利用可能日`,
  "next": `次へ`,
  "previous": `前へ`,
  "selectedDateDescription": (args) => `選択した日付 : ${args.date}`,
  "selectedRangeDescription": (args) => `選択範囲 : ${args.dateRange}`,
  "startRangeSelectionPrompt": `クリックして日付範囲の選択を開始`,
  "todayDate": (args) => `本日、${args.date}`,
  "todayDateSelected": (args) => `本日、${args.date} を選択`
};
var $22a5f0623ea73e4f$exports = {};
$22a5f0623ea73e4f$exports = {
  "dateRange": (args) => `${args.startDate} ~ ${args.endDate}`,
  "dateSelected": (args) => `${args.date} 선택됨`,
  "finishRangeSelectionPrompt": `날짜 범위 선택을 완료하려면 클릭하십시오.`,
  "maximumDate": `마지막으로 사용 가능한 일자`,
  "minimumDate": `처음으로 사용 가능한 일자`,
  "next": `다음`,
  "previous": `이전`,
  "selectedDateDescription": (args) => `선택 일자: ${args.date}`,
  "selectedRangeDescription": (args) => `선택 범위: ${args.dateRange}`,
  "startRangeSelectionPrompt": `날짜 범위 선택을 시작하려면 클릭하십시오.`,
  "todayDate": (args) => `오늘, ${args.date}`,
  "todayDateSelected": (args) => `오늘, ${args.date} 선택됨`
};
var $522380d13d62cba0$exports = {};
$522380d13d62cba0$exports = {
  "dateRange": (args) => `Nuo ${args.startDate} iki ${args.endDate}`,
  "dateSelected": (args) => `Pasirinkta ${args.date}`,
  "finishRangeSelectionPrompt": `Spustelėkite, kad baigtumėte pasirinkti datų intervalą`,
  "maximumDate": `Paskutinė galima data`,
  "minimumDate": `Pirmoji galima data`,
  "next": `Paskesnis`,
  "previous": `Ankstesnis`,
  "selectedDateDescription": (args) => `Pasirinkta data: ${args.date}`,
  "selectedRangeDescription": (args) => `Pasirinktas intervalas: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Spustelėkite, kad pradėtumėte pasirinkti datų intervalą`,
  "todayDate": (args) => `Šiandien, ${args.date}`,
  "todayDateSelected": (args) => `Šiandien, pasirinkta ${args.date}`
};
var $8a7bc830b2fe6485$exports = {};
$8a7bc830b2fe6485$exports = {
  "dateRange": (args) => `No ${args.startDate} līdz ${args.endDate}`,
  "dateSelected": (args) => `Atlasīts: ${args.date}`,
  "finishRangeSelectionPrompt": `Noklikšķiniet, lai pabeigtu datumu diapazona atlasi`,
  "maximumDate": `Pēdējais pieejamais datums`,
  "minimumDate": `Pirmais pieejamais datums`,
  "next": `Tālāk`,
  "previous": `Atpakaļ`,
  "selectedDateDescription": (args) => `Atlasītais datums: ${args.date}`,
  "selectedRangeDescription": (args) => `Atlasītais diapazons: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Noklikšķiniet, lai sāktu datumu diapazona atlasi`,
  "todayDate": (args) => `Šodien, ${args.date}`,
  "todayDateSelected": (args) => `Atlasīta šodiena, ${args.date}`
};
var $9fac9c044470683b$exports = {};
$9fac9c044470683b$exports = {
  "dateRange": (args) => `${args.startDate} til ${args.endDate}`,
  "dateSelected": (args) => `${args.date} valgt`,
  "finishRangeSelectionPrompt": `Klikk for å fullføre valg av datoområde`,
  "maximumDate": `Siste tilgjengelige dato`,
  "minimumDate": `Første tilgjengelige dato`,
  "next": `Neste`,
  "previous": `Forrige`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt område: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klikk for å starte valg av datoområde`,
  "todayDate": (args) => `I dag, ${args.date}`,
  "todayDateSelected": (args) => `I dag, ${args.date} valgt`
};
var $b127d3569efb1449$exports = {};
$b127d3569efb1449$exports = {
  "dateRange": (args) => `${args.startDate} tot ${args.endDate}`,
  "dateSelected": (args) => `${args.date} geselecteerd`,
  "finishRangeSelectionPrompt": `Klik om de selectie van het datumbereik te voltooien`,
  "maximumDate": `Laatste beschikbare datum`,
  "minimumDate": `Eerste beschikbare datum`,
  "next": `Volgende`,
  "previous": `Vorige`,
  "selectedDateDescription": (args) => `Geselecteerde datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Geselecteerd bereik: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klik om het datumbereik te selecteren`,
  "todayDate": (args) => `Vandaag, ${args.date}`,
  "todayDateSelected": (args) => `Vandaag, ${args.date} geselecteerd`
};
var $51404a4090633490$exports = {};
$51404a4090633490$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `Wybrano ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknij, aby zakończyć wybór zakresu dat`,
  "maximumDate": `Ostatnia dostępna data`,
  "minimumDate": `Pierwsza dostępna data`,
  "next": `Dalej`,
  "previous": `Wstecz`,
  "selectedDateDescription": (args) => `Wybrana data: ${args.date}`,
  "selectedRangeDescription": (args) => `Wybrany zakres: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknij, aby rozpocząć wybór zakresu dat`,
  "todayDate": (args) => `Dzisiaj, ${args.date}`,
  "todayDateSelected": (args) => `Dzisiaj wybrano ${args.date}`
};
var $e5e6a3fe3b4527df$exports = {};
$e5e6a3fe3b4527df$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selecionado`,
  "finishRangeSelectionPrompt": `Clique para concluir a seleção do intervalo de datas`,
  "maximumDate": `Última data disponível`,
  "minimumDate": `Primeira data disponível`,
  "next": `Próximo`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Clique para iniciar a seleção do intervalo de datas`,
  "todayDate": (args) => `Hoje, ${args.date}`,
  "todayDateSelected": (args) => `Hoje, ${args.date} selecionado`
};
var $c519dcadcbb1ee47$exports = {};
$c519dcadcbb1ee47$exports = {
  "dateRange": (args) => `${args.startDate} a ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selecionado`,
  "finishRangeSelectionPrompt": `Clique para terminar de selecionar o intervalo de datas`,
  "maximumDate": `Última data disponível`,
  "minimumDate": `Primeira data disponível`,
  "next": `Próximo`,
  "previous": `Anterior`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Clique para começar a selecionar o intervalo de datas`,
  "todayDate": (args) => `Hoje, ${args.date}`,
  "todayDateSelected": (args) => `Hoje, ${args.date} selecionado`
};
var $e5aa0186ca7889c6$exports = {};
$e5aa0186ca7889c6$exports = {
  "dateRange": (args) => `De la ${args.startDate} până la ${args.endDate}`,
  "dateSelected": (args) => `${args.date} selectată`,
  "finishRangeSelectionPrompt": `Apăsaţi pentru a finaliza selecţia razei pentru dată`,
  "maximumDate": `Ultima dată disponibilă`,
  "minimumDate": `Prima dată disponibilă`,
  "next": `Următorul`,
  "previous": `Înainte`,
  "selectedDateDescription": (args) => `Dată selectată: ${args.date}`,
  "selectedRangeDescription": (args) => `Interval selectat: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Apăsaţi pentru a începe selecţia razei pentru dată`,
  "todayDate": (args) => `Astăzi, ${args.date}`,
  "todayDateSelected": (args) => `Azi, ${args.date} selectată`
};
var $5b907f5fa3eee652$exports = {};
$5b907f5fa3eee652$exports = {
  "dateRange": (args) => `С ${args.startDate} по ${args.endDate}`,
  "dateSelected": (args) => `Выбрано ${args.date}`,
  "finishRangeSelectionPrompt": `Щелкните, чтобы завершить выбор диапазона дат`,
  "maximumDate": `Последняя доступная дата`,
  "minimumDate": `Первая доступная дата`,
  "next": `Далее`,
  "previous": `Назад`,
  "selectedDateDescription": (args) => `Выбранная дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Выбранный диапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Щелкните, чтобы начать выбор диапазона дат`,
  "todayDate": (args) => `Сегодня, ${args.date}`,
  "todayDateSelected": (args) => `Сегодня, выбрано ${args.date}`
};
var $1b4c51359c99cf79$exports = {};
$1b4c51359c99cf79$exports = {
  "dateRange": (args) => `Od ${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `Vybratý dátum ${args.date}`,
  "finishRangeSelectionPrompt": `Kliknutím dokončíte výber rozsahu dátumov`,
  "maximumDate": `Posledný dostupný dátum`,
  "minimumDate": `Prvý dostupný dátum`,
  "next": `Nasledujúce`,
  "previous": `Predchádzajúce`,
  "selectedDateDescription": (args) => `Vybratý dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybratý rozsah: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknutím spustíte výber rozsahu dátumov`,
  "todayDate": (args) => `Dnes ${args.date}`,
  "todayDateSelected": (args) => `Vybratý dnešný dátum ${args.date}`
};
var $02e4e6a4608cc6f3$exports = {};
$02e4e6a4608cc6f3$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} izbrano`,
  "finishRangeSelectionPrompt": `Kliknite za dokončanje izbire datumskega obsega`,
  "maximumDate": `Zadnji razpoložljivi datum`,
  "minimumDate": `Prvi razpoložljivi datum`,
  "next": `Naprej`,
  "previous": `Nazaj`,
  "selectedDateDescription": (args) => `Izbrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izbrano območje: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite za začetek izbire datumskega obsega`,
  "todayDate": (args) => `Danes, ${args.date}`,
  "todayDateSelected": (args) => `Danes, ${args.date} izbrano`
};
var $6dd2fbaad93b6878$exports = {};
$6dd2fbaad93b6878$exports = {
  "dateRange": (args) => `${args.startDate} do ${args.endDate}`,
  "dateSelected": (args) => `${args.date} izabran`,
  "finishRangeSelectionPrompt": `Kliknite da dovršite opseg izabranih datuma`,
  "maximumDate": `Zadnji raspoloživi datum`,
  "minimumDate": `Prvi raspoloživi datum`,
  "next": `Sledeći`,
  "previous": `Prethodni`,
  "selectedDateDescription": (args) => `Izabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izabrani period: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Kliknite da započnete opseg izabranih datuma`,
  "todayDate": (args) => `Danas, ${args.date}`,
  "todayDateSelected": (args) => `Danas, izabran ${args.date}`
};
var $33ea59bfe6e804e0$exports = {};
$33ea59bfe6e804e0$exports = {
  "dateRange": (args) => `${args.startDate} till ${args.endDate}`,
  "dateSelected": (args) => `${args.date} har valts`,
  "finishRangeSelectionPrompt": `Klicka för att avsluta val av datumintervall`,
  "maximumDate": `Sista tillgängliga datum`,
  "minimumDate": `Första tillgängliga datum`,
  "next": `Nästa`,
  "previous": `Föregående`,
  "selectedDateDescription": (args) => `Valt datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Valt intervall: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Klicka för att välja datumintervall`,
  "todayDate": (args) => `Idag, ${args.date}`,
  "todayDateSelected": (args) => `Idag, ${args.date} har valts`
};
var $4603b0d0246969b2$exports = {};
$4603b0d0246969b2$exports = {
  "dateRange": (args) => `${args.startDate} - ${args.endDate}`,
  "dateSelected": (args) => `${args.date} seçildi`,
  "finishRangeSelectionPrompt": `Tarih aralığı seçimini tamamlamak için tıklayın`,
  "maximumDate": `Son müsait tarih`,
  "minimumDate": `İlk müsait tarih`,
  "next": `Sonraki`,
  "previous": `Önceki`,
  "selectedDateDescription": (args) => `Seçilen Tarih: ${args.date}`,
  "selectedRangeDescription": (args) => `Seçilen Aralık: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Tarih aralığı seçimini başlatmak için tıklayın`,
  "todayDate": (args) => `Bugün, ${args.date}`,
  "todayDateSelected": (args) => `Bugün, ${args.date} seçildi`
};
var $82649816f530bb1b$exports = {};
$82649816f530bb1b$exports = {
  "dateRange": (args) => `${args.startDate} — ${args.endDate}`,
  "dateSelected": (args) => `Вибрано ${args.date}`,
  "finishRangeSelectionPrompt": `Натисніть, щоб завершити вибір діапазону дат`,
  "maximumDate": `Остання доступна дата`,
  "minimumDate": `Перша доступна дата`,
  "next": `Наступний`,
  "previous": `Попередній`,
  "selectedDateDescription": (args) => `Вибрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Вибраний діапазон: ${args.dateRange}`,
  "startRangeSelectionPrompt": `Натисніть, щоб почати вибір діапазону дат`,
  "todayDate": (args) => `Сьогодні, ${args.date}`,
  "todayDateSelected": (args) => `Сьогодні, вибрано ${args.date}`
};
var $628e140a43dfb330$exports = {};
$628e140a43dfb330$exports = {
  "dateRange": (args) => `${args.startDate} 至 ${args.endDate}`,
  "dateSelected": (args) => `已选择 ${args.date}`,
  "finishRangeSelectionPrompt": `单击以完成选择日期范围`,
  "maximumDate": `最后一个可用日期`,
  "minimumDate": `第一个可用日期`,
  "next": `下一页`,
  "previous": `上一页`,
  "selectedDateDescription": (args) => `选定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `选定的范围：${args.dateRange}`,
  "startRangeSelectionPrompt": `单击以开始选择日期范围`,
  "todayDate": (args) => `今天，即 ${args.date}`,
  "todayDateSelected": (args) => `已选择今天，即 ${args.date}`
};
var $745937250cd4679c$exports = {};
$745937250cd4679c$exports = {
  "dateRange": (args) => `${args.startDate} 至 ${args.endDate}`,
  "dateSelected": (args) => `已選取 ${args.date}`,
  "finishRangeSelectionPrompt": `按一下以完成選取日期範圍`,
  "maximumDate": `最後一個可用日期`,
  "minimumDate": `第一個可用日期`,
  "next": `下一頁`,
  "previous": `上一頁`,
  "selectedDateDescription": (args) => `選定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `選定的範圍：${args.dateRange}`,
  "startRangeSelectionPrompt": `按一下以開始選取日期範圍`,
  "todayDate": (args) => `今天，${args.date}`,
  "todayDateSelected": (args) => `已選取今天，${args.date}`
};
var $3904726b442bd9b2$exports = {};
$3904726b442bd9b2$exports = {
  "ar-AE": $39324ace0d945f59$exports,
  "bg-BG": $1830a539e98c7baf$exports,
  "cs-CZ": $f4b92528965aab97$exports,
  "da-DK": $1cd578ef0547c8f1$exports,
  "de-DE": $db55a8973925d619$exports,
  "el-GR": $ec6937d58566d443$exports,
  "en-US": $1f5cea0742dc284a$exports,
  "es-ES": $2ca7ea366384817b$exports,
  "et-EE": $97874a7fe9cd091f$exports,
  "fi-FI": $5d376b7fce1a45b2$exports,
  "fr-FR": $3bf722b362aaf54d$exports,
  "he-IL": $38c43f8322316031$exports,
  "hr-HR": $c90e0f32b44630bf$exports,
  "hu-HU": $715875e6e7a338f4$exports,
  "it-IT": $37d77c66e34daccf$exports,
  "ja-JP": $542f39aee29303c3$exports,
  "ko-KR": $22a5f0623ea73e4f$exports,
  "lt-LT": $522380d13d62cba0$exports,
  "lv-LV": $8a7bc830b2fe6485$exports,
  "nb-NO": $9fac9c044470683b$exports,
  "nl-NL": $b127d3569efb1449$exports,
  "pl-PL": $51404a4090633490$exports,
  "pt-BR": $e5e6a3fe3b4527df$exports,
  "pt-PT": $c519dcadcbb1ee47$exports,
  "ro-RO": $e5aa0186ca7889c6$exports,
  "ru-RU": $5b907f5fa3eee652$exports,
  "sk-SK": $1b4c51359c99cf79$exports,
  "sl-SI": $02e4e6a4608cc6f3$exports,
  "sr-SP": $6dd2fbaad93b6878$exports,
  "sv-SE": $33ea59bfe6e804e0$exports,
  "tr-TR": $4603b0d0246969b2$exports,
  "uk-UA": $82649816f530bb1b$exports,
  "zh-CN": $628e140a43dfb330$exports,
  "zh-TW": $745937250cd4679c$exports
};
function $parcel$interopDefault$a(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $a074e1e2d0f0a665$export$653eddfc964b0f8a = /* @__PURE__ */ new WeakMap();
function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date4) {
  return (date4 === null || date4 === void 0 ? void 0 : date4.calendar.identifier) === "gregory" && date4.era === "BC" ? "short" : void 0;
}
function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$a($3904726b442bd9b2$exports), "@react-aria/calendar");
  let start, end;
  var _state_value;
  if ("highlightedRange" in state)
    ({ start, end } = state.highlightedRange || {});
  else
    start = end = (_state_value = state.value) !== null && _state_value !== void 0 ? _state_value : void 0;
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: "long",
    month: "long",
    year: "numeric",
    day: "numeric",
    era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(start) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(end),
    timeZone: state.timeZone
  });
  let anchorDate = "anchorDate" in state ? state.anchorDate : null;
  return reactExports.useMemo(() => {
    if (!anchorDate && start && end) {
      if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(start, end)) {
        let date4 = dateFormatter.format(start.toDate(state.timeZone));
        return stringFormatter.format("selectedDateDescription", {
          date: date4
        });
      } else {
        let dateRange = $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);
        return stringFormatter.format("selectedRangeDescription", {
          dateRange
        });
      }
    }
    return "";
  }, [
    start,
    end,
    anchorDate,
    state.timeZone,
    stringFormatter,
    dateFormatter
  ]);
}
function $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$a($3904726b442bd9b2$exports), "@react-aria/calendar");
  let era = $a074e1e2d0f0a665$export$134cbb7fb09a9522(startDate) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(endDate);
  let monthFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    year: "numeric",
    era,
    calendar: startDate.calendar.identifier,
    timeZone
  });
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    year: "numeric",
    day: "numeric",
    era,
    calendar: startDate.calendar.identifier,
    timeZone
  });
  return reactExports.useMemo(() => {
    if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(startDate, $14e0f24ef4ac5c92$export$a5a3b454ada2268e(startDate))) {
      let startMonth = startDate;
      let endMonth = endDate;
      if (startDate.calendar.getFormattableMonth)
        startMonth = startDate.calendar.getFormattableMonth(startDate);
      if (endDate.calendar.getFormattableMonth)
        endMonth = endDate.calendar.getFormattableMonth(endDate);
      if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(endDate, $14e0f24ef4ac5c92$export$a2258d9c4118825c(startDate)))
        return monthFormatter.format(startMonth.toDate(timeZone));
      else if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(endDate, $14e0f24ef4ac5c92$export$a2258d9c4118825c(endDate)))
        return isAria ? $a074e1e2d0f0a665$var$formatRange(monthFormatter, stringFormatter, startMonth, endMonth, timeZone) : monthFormatter.formatRange(startMonth.toDate(timeZone), endMonth.toDate(timeZone));
    }
    return isAria ? $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, startDate, endDate, timeZone) : dateFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
  }, [
    startDate,
    endDate,
    monthFormatter,
    dateFormatter,
    stringFormatter,
    timeZone,
    isAria
  ]);
}
function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, timeZone) {
  let parts = dateFormatter.formatRangeToParts(start.toDate(timeZone), end.toDate(timeZone));
  let separatorIndex = -1;
  for (let i2 = 0; i2 < parts.length; i2++) {
    let part = parts[i2];
    if (part.source === "shared" && part.type === "literal")
      separatorIndex = i2;
    else if (part.source === "endRange")
      break;
  }
  let startValue = "";
  let endValue = "";
  for (let i2 = 0; i2 < parts.length; i2++) {
    if (i2 < separatorIndex)
      startValue += parts[i2].value;
    else if (i2 > separatorIndex)
      endValue += parts[i2].value;
  }
  return stringFormatter.format("dateRange", {
    startDate: startValue,
    endDate: endValue
  });
}
function $parcel$interopDefault$9(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$9($3904726b442bd9b2$exports), "@react-aria/calendar");
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let title = $a074e1e2d0f0a665$export$31afe65d91ef6e8(state.visibleRange.start, state.visibleRange.end, state.timeZone, false);
  let visibleRangeDescription = $a074e1e2d0f0a665$export$31afe65d91ef6e8(state.visibleRange.start, state.visibleRange.end, state.timeZone, true);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (!state.isFocused)
      $319e236875307eab$export$a9b970dcc4ae71a9(visibleRangeDescription);
  }, [
    visibleRangeDescription
  ]);
  let selectedDateDescription = $a074e1e2d0f0a665$export$b6df97c887c38e1a(state);
  $4f58c5f72bcf79f7$export$496315a1608d9602(() => {
    if (selectedDateDescription)
      $319e236875307eab$export$a9b970dcc4ae71a9(selectedDateDescription, "polite", 4e3);
  }, [
    selectedDateDescription
  ]);
  let errorMessageId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1([
    Boolean(props.errorMessage),
    props.isInvalid,
    props.validationState
  ]);
  $a074e1e2d0f0a665$export$653eddfc964b0f8a.set(state, {
    ariaLabel: props["aria-label"],
    ariaLabelledBy: props["aria-labelledby"],
    errorMessageId,
    selectedDateDescription
  });
  let [nextFocused, setNextFocused] = reactExports.useState(false);
  let nextDisabled = props.isDisabled || state.isNextVisibleRangeInvalid();
  if (nextDisabled && nextFocused) {
    setNextFocused(false);
    state.setFocused(true);
  }
  let [previousFocused, setPreviousFocused] = reactExports.useState(false);
  let previousDisabled = props.isDisabled || state.isPreviousVisibleRangeInvalid();
  if (previousDisabled && previousFocused) {
    setPreviousFocused(false);
    state.setFocused(true);
  }
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    id: props["id"],
    "aria-label": [
      props["aria-label"],
      visibleRangeDescription
    ].filter(Boolean).join(", "),
    "aria-labelledby": props["aria-labelledby"]
  });
  return {
    calendarProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, labelProps, {
      role: "application",
      "aria-details": props["aria-details"] || void 0,
      "aria-describedby": props["aria-describedby"] || void 0
    }),
    nextButtonProps: {
      onPress: () => state.focusNextPage(),
      "aria-label": stringFormatter.format("next"),
      isDisabled: nextDisabled,
      onFocusChange: setNextFocused
    },
    prevButtonProps: {
      onPress: () => state.focusPreviousPage(),
      "aria-label": stringFormatter.format("previous"),
      isDisabled: previousDisabled,
      onFocusChange: setPreviousFocused
    },
    errorMessageProps: {
      id: errorMessageId
    },
    title
  };
}
function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
  let res = $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state);
  let isVirtualClick = reactExports.useRef(false);
  let windowRef = reactExports.useRef(typeof window !== "undefined" ? window : null);
  $e9faafb641e167db$export$90fc3a17d93f704c(windowRef, "pointerdown", (e2) => {
    isVirtualClick.current = e2.width === 0 && e2.height === 0;
  });
  let endDragging = (e2) => {
    if (isVirtualClick.current) {
      isVirtualClick.current = false;
      return;
    }
    state.setDragging(false);
    if (!state.anchorDate)
      return;
    let target = e2.target;
    if (ref.current && ref.current.contains(document.activeElement) && (!ref.current.contains(target) || !target.closest('button, [role="button"]')))
      state.selectFocusedDate();
  };
  $e9faafb641e167db$export$90fc3a17d93f704c(windowRef, "pointerup", endDragging);
  res.calendarProps.onBlur = (e2) => {
    if (!ref.current)
      return;
    if ((!e2.relatedTarget || !ref.current.contains(e2.relatedTarget)) && state.anchorDate)
      state.selectFocusedDate();
  };
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "touchmove", (e2) => {
    if (state.isDragging)
      e2.preventDefault();
  }, {
    passive: false,
    capture: true
  });
  return res;
}
function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
  let { startDate = state.visibleRange.start, endDate = state.visibleRange.end, firstDayOfWeek } = props;
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let onKeyDown = (e2) => {
    switch (e2.key) {
      case "Enter":
      case " ":
        e2.preventDefault();
        state.selectFocusedDate();
        break;
      case "PageUp":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusPreviousSection(e2.shiftKey);
        break;
      case "PageDown":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusNextSection(e2.shiftKey);
        break;
      case "End":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusSectionEnd();
        break;
      case "Home":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusSectionStart();
        break;
      case "ArrowLeft":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl")
          state.focusNextDay();
        else
          state.focusPreviousDay();
        break;
      case "ArrowUp":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusPreviousRow();
        break;
      case "ArrowRight":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl")
          state.focusPreviousDay();
        else
          state.focusNextDay();
        break;
      case "ArrowDown":
        e2.preventDefault();
        e2.stopPropagation();
        state.focusNextRow();
        break;
      case "Escape":
        if ("setAnchorDate" in state) {
          e2.preventDefault();
          state.setAnchorDate(null);
        }
        break;
    }
  };
  let visibleRangeDescription = $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, state.timeZone, true);
  let { ariaLabel, ariaLabelledBy } = $a074e1e2d0f0a665$export$653eddfc964b0f8a.get(state);
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    "aria-label": [
      ariaLabel,
      visibleRangeDescription
    ].filter(Boolean).join(", "),
    "aria-labelledby": ariaLabelledBy
  });
  let dayFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: props.weekdayStyle || "narrow",
    timeZone: state.timeZone
  });
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let weekDays = reactExports.useMemo(() => {
    let weekStart = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(state.timeZone), locale2, firstDayOfWeek);
    return [
      ...new Array(7).keys()
    ].map((index2) => {
      let date4 = weekStart.add({
        days: index2
      });
      let dateDay = date4.toDate(state.timeZone);
      return dayFormatter.format(dateDay);
    });
  }, [
    locale2,
    state.timeZone,
    dayFormatter,
    firstDayOfWeek
  ]);
  let weeksInMonth = $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(startDate, locale2, firstDayOfWeek);
  return {
    gridProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(labelProps, {
      role: "grid",
      "aria-readonly": state.isReadOnly || void 0,
      "aria-disabled": state.isDisabled || void 0,
      "aria-multiselectable": "highlightedRange" in state || void 0,
      onKeyDown,
      onFocus: () => state.setFocused(true),
      onBlur: () => state.setFocused(false)
    }),
    headerProps: {
      // Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
      // The day names are already included in the label of each cell, so there's no need to announce them twice.
      "aria-hidden": true
    },
    weekDays,
    weeksInMonth
  };
}
function $parcel$interopDefault$8(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
  let { date: date4, isDisabled } = props;
  let { errorMessageId, selectedDateDescription } = $a074e1e2d0f0a665$export$653eddfc964b0f8a.get(state);
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$8($3904726b442bd9b2$exports), "@react-aria/calendar");
  let dateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    weekday: "long",
    day: "numeric",
    month: "long",
    year: "numeric",
    era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(date4),
    timeZone: state.timeZone
  });
  let isSelected = state.isSelected(date4);
  let isFocused = state.isCellFocused(date4);
  isDisabled = isDisabled || state.isCellDisabled(date4);
  let isUnavailable = state.isCellUnavailable(date4);
  let isSelectable = !isDisabled && !isUnavailable;
  let isInvalid = state.isValueInvalid && Boolean("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date4.compare(state.highlightedRange.start) >= 0 && date4.compare(state.highlightedRange.end) <= 0 : state.value && $14e0f24ef4ac5c92$export$ea39ec197993aef0(state.value, date4));
  if (isInvalid)
    isSelected = true;
  date4 = $5a387cc49350e6db$export$722debc0e56fea39(date4, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee);
  let nativeDate = reactExports.useMemo(() => date4.toDate(state.timeZone), [
    date4,
    state.timeZone
  ]);
  let isDateToday = $14e0f24ef4ac5c92$export$629b0a497aa65267(date4, state.timeZone);
  let label = reactExports.useMemo(() => {
    let label2 = "";
    if ("highlightedRange" in state && state.value && !state.anchorDate && ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.value.start) || $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.value.end)))
      label2 = selectedDateDescription + ", ";
    label2 += dateFormatter.format(nativeDate);
    if (isDateToday)
      label2 = stringFormatter.format(isSelected ? "todayDateSelected" : "todayDate", {
        date: label2
      });
    else if (isSelected)
      label2 = stringFormatter.format("dateSelected", {
        date: label2
      });
    if (state.minValue && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.minValue))
      label2 += ", " + stringFormatter.format("minimumDate");
    else if (state.maxValue && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.maxValue))
      label2 += ", " + stringFormatter.format("maximumDate");
    return label2;
  }, [
    dateFormatter,
    nativeDate,
    stringFormatter,
    isSelected,
    isDateToday,
    date4,
    state,
    selectedDateDescription
  ]);
  let rangeSelectionPrompt = "";
  if ("anchorDate" in state && isFocused && !state.isReadOnly && isSelectable) {
    if (state.anchorDate)
      rangeSelectionPrompt = stringFormatter.format("finishRangeSelectionPrompt");
    else
      rangeSelectionPrompt = stringFormatter.format("startRangeSelectionPrompt");
  }
  let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(rangeSelectionPrompt);
  let isAnchorPressed = reactExports.useRef(false);
  let isRangeBoundaryPressed = reactExports.useRef(false);
  let touchDragTimerRef = reactExports.useRef(void 0);
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    // When dragging to select a range, we don't want dragging over the original anchor
    // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
    shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
    preventFocusOnPress: true,
    isDisabled: !isSelectable || state.isReadOnly,
    onPressStart(e2) {
      if (state.isReadOnly) {
        state.setFocusedDate(date4);
        return;
      }
      if ("highlightedRange" in state && !state.anchorDate && (e2.pointerType === "mouse" || e2.pointerType === "touch")) {
        if (state.highlightedRange && !isInvalid) {
          if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.highlightedRange.start)) {
            state.setAnchorDate(state.highlightedRange.end);
            state.setFocusedDate(date4);
            state.setDragging(true);
            isRangeBoundaryPressed.current = true;
            return;
          } else if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.highlightedRange.end)) {
            state.setAnchorDate(state.highlightedRange.start);
            state.setFocusedDate(date4);
            state.setDragging(true);
            isRangeBoundaryPressed.current = true;
            return;
          }
        }
        let startDragging = () => {
          state.setDragging(true);
          touchDragTimerRef.current = void 0;
          state.selectDate(date4);
          state.setFocusedDate(date4);
          isAnchorPressed.current = true;
        };
        if (e2.pointerType === "touch")
          touchDragTimerRef.current = setTimeout(startDragging, 200);
        else
          startDragging();
      }
    },
    onPressEnd() {
      isRangeBoundaryPressed.current = false;
      isAnchorPressed.current = false;
      clearTimeout(touchDragTimerRef.current);
      touchDragTimerRef.current = void 0;
    },
    onPress() {
      if (!("anchorDate" in state) && !state.isReadOnly) {
        state.selectDate(date4);
        state.setFocusedDate(date4);
      }
    },
    onPressUp(e2) {
      if (state.isReadOnly)
        return;
      if ("anchorDate" in state && touchDragTimerRef.current) {
        state.selectDate(date4);
        state.setFocusedDate(date4);
      }
      if ("anchorDate" in state) {
        if (isRangeBoundaryPressed.current)
          state.setAnchorDate(date4);
        else if (state.anchorDate && !isAnchorPressed.current) {
          state.selectDate(date4);
          state.setFocusedDate(date4);
        } else if (e2.pointerType === "keyboard" && !state.anchorDate) {
          state.selectDate(date4);
          let nextDay = date4.add({
            days: 1
          });
          if (state.isInvalid(nextDay))
            nextDay = date4.subtract({
              days: 1
            });
          if (!state.isInvalid(nextDay))
            state.setFocusedDate(nextDay);
        } else if (e2.pointerType === "virtual") {
          state.selectDate(date4);
          state.setFocusedDate(date4);
        }
      }
    }
  });
  let tabIndex = void 0;
  if (!isDisabled)
    tabIndex = $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, state.focusedDate) ? 0 : -1;
  reactExports.useEffect(() => {
    if (isFocused && ref.current) {
      $7215afc6de606d6b$export$de79e2c695e052f3$5(ref.current);
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() !== "pointer" && document.activeElement === ref.current)
        $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
          containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
        });
    }
  }, [
    isFocused,
    ref
  ]);
  let cellDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    day: "numeric",
    timeZone: state.timeZone,
    calendar: date4.calendar.identifier
  });
  let formattedDate = reactExports.useMemo(() => cellDateFormatter.formatToParts(nativeDate).find((part) => part.type === "day").value, [
    cellDateFormatter,
    nativeDate
  ]);
  return {
    cellProps: {
      role: "gridcell",
      "aria-disabled": !isSelectable || void 0,
      "aria-selected": isSelected || void 0,
      "aria-invalid": isInvalid || void 0
    },
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, {
      onFocus() {
        if (!isDisabled)
          state.setFocusedDate(date4);
      },
      tabIndex,
      role: "button",
      "aria-disabled": !isSelectable || void 0,
      "aria-label": label,
      "aria-invalid": isInvalid || void 0,
      "aria-describedby": [
        isInvalid ? errorMessageId : void 0,
        descriptionProps["aria-describedby"]
      ].filter(Boolean).join(" ") || void 0,
      onPointerEnter(e2) {
        if ("highlightDate" in state && (e2.pointerType !== "touch" || state.isDragging) && isSelectable)
          state.highlightDate(date4);
      },
      onPointerDown(e2) {
        if ("releasePointerCapture" in e2.target)
          e2.target.releasePointerCapture(e2.pointerId);
      },
      onContextMenu(e2) {
        e2.preventDefault();
      }
    }),
    isPressed,
    isFocused,
    isSelected,
    isDisabled,
    isUnavailable,
    isOutsideVisibleRange: date4.compare(state.visibleRange.start) < 0 || date4.compare(state.visibleRange.end) > 0,
    isInvalid,
    formattedDate
  };
}
function $f62d864046160412$export$eac50920cf2fd59a(date4, minValue, maxValue) {
  return minValue != null && date4.compare(minValue) < 0 || maxValue != null && date4.compare(maxValue) > 0;
}
function $f62d864046160412$export$f4a51ff076cc9a09(date4, duration2, locale2, minValue, maxValue) {
  let halfDuration = {};
  for (let key in duration2) {
    halfDuration[key] = Math.floor(duration2[key] / 2);
    if (halfDuration[key] > 0 && duration2[key] % 2 === 0)
      halfDuration[key]--;
  }
  let aligned = $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2).subtract(halfDuration);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2, minValue, maxValue) {
  let aligned = date4;
  if (duration2.years)
    aligned = $14e0f24ef4ac5c92$export$f91e89d3d0406102(date4);
  else if (duration2.months)
    aligned = $14e0f24ef4ac5c92$export$a5a3b454ada2268e(date4);
  else if (duration2.weeks)
    aligned = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$530edbfc915b2b04(date4, duration2, locale2, minValue, maxValue) {
  let d2 = {
    ...duration2
  };
  if (d2.days)
    d2.days--;
  else if (d2.weeks)
    d2.weeks--;
  else if (d2.months)
    d2.months--;
  else if (d2.years)
    d2.years--;
  let aligned = $f62d864046160412$export$144a00ba6044eb9(date4, duration2, locale2).subtract(d2);
  return $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue);
}
function $f62d864046160412$export$5bb865b12696a77d(date4, aligned, duration2, locale2, minValue, maxValue) {
  if (minValue && date4.compare(minValue) >= 0) {
    let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(aligned, $f62d864046160412$export$144a00ba6044eb9($11d87f3f76e88657$export$93522d1a439f3617(minValue), duration2, locale2));
    if (newDate)
      aligned = newDate;
  }
  if (maxValue && date4.compare(maxValue) <= 0) {
    let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(aligned, $f62d864046160412$export$530edbfc915b2b04($11d87f3f76e88657$export$93522d1a439f3617(maxValue), duration2, locale2));
    if (newDate)
      aligned = newDate;
  }
  return aligned;
}
function $f62d864046160412$export$4f5203c0d889109e(date4, minValue, maxValue) {
  if (minValue) {
    let newDate = $14e0f24ef4ac5c92$export$a75f2bff57811055(date4, $11d87f3f76e88657$export$93522d1a439f3617(minValue));
    if (newDate)
      date4 = newDate;
  }
  if (maxValue) {
    let newDate = $14e0f24ef4ac5c92$export$5c333a116e949cdd(date4, $11d87f3f76e88657$export$93522d1a439f3617(maxValue));
    if (newDate)
      date4 = newDate;
  }
  return date4;
}
function $f62d864046160412$export$a1d3911297b952d7(date4, minValue, isDateUnavailable) {
  if (!isDateUnavailable)
    return date4;
  while (date4.compare(minValue) >= 0 && isDateUnavailable(date4))
    date4 = date4.subtract({
      days: 1
    });
  if (date4.compare(minValue) >= 0)
    return date4;
  return null;
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
  let defaultFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(props.locale), [
    props.locale
  ]);
  let resolvedOptions = reactExports.useMemo(() => defaultFormatter.resolvedOptions(), [
    defaultFormatter
  ]);
  let { locale: locale2, createCalendar, visibleDuration = {
    months: 1
  }, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible", firstDayOfWeek } = props;
  let calendar2 = reactExports.useMemo(() => createCalendar(resolvedOptions.calendar), [
    createCalendar,
    resolvedOptions.calendar
  ]);
  var _props_defaultValue;
  let [value2, setControlledValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let calendarDateValue = reactExports.useMemo(() => value2 ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(value2), calendar2) : null, [
    value2,
    calendar2
  ]);
  let timeZone = reactExports.useMemo(() => value2 && "timeZone" in value2 ? value2.timeZone : resolvedOptions.timeZone, [
    value2,
    resolvedOptions.timeZone
  ]);
  let focusedCalendarDate = reactExports.useMemo(() => props.focusedValue ? $f62d864046160412$export$4f5203c0d889109e($11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.focusedValue), calendar2), minValue, maxValue) : void 0, [
    props.focusedValue,
    calendar2,
    minValue,
    maxValue
  ]);
  let defaultFocusedCalendarDate = reactExports.useMemo(() => $f62d864046160412$export$4f5203c0d889109e(props.defaultFocusedValue ? $11d87f3f76e88657$export$b4a036af3fc0b032($11d87f3f76e88657$export$93522d1a439f3617(props.defaultFocusedValue), calendar2) : calendarDateValue || $11d87f3f76e88657$export$b4a036af3fc0b032($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3(timeZone), calendar2), minValue, maxValue), [
    props.defaultFocusedValue,
    calendarDateValue,
    timeZone,
    calendar2,
    minValue,
    maxValue
  ]);
  let [focusedDate, setFocusedDate] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);
  let [startDate, setStartDate] = reactExports.useState(() => {
    switch (selectionAlignment) {
      case "start":
        return $f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale2, minValue, maxValue);
      case "end":
        return $f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale2, minValue, maxValue);
      case "center":
      default:
        return $f62d864046160412$export$f4a51ff076cc9a09(focusedDate, visibleDuration, locale2, minValue, maxValue);
    }
  });
  let [isFocused, setFocused] = reactExports.useState(props.autoFocus || false);
  let endDate = reactExports.useMemo(() => {
    let duration2 = {
      ...visibleDuration
    };
    if (duration2.days)
      duration2.days--;
    else
      duration2.days = -1;
    return startDate.add(duration2);
  }, [
    startDate,
    visibleDuration
  ]);
  let [lastCalendar, setLastCalendar] = reactExports.useState(calendar2);
  if (!$14e0f24ef4ac5c92$export$dbc69fd56b53d5e(calendar2, lastCalendar)) {
    let newFocusedDate = $11d87f3f76e88657$export$b4a036af3fc0b032(focusedDate, calendar2);
    setStartDate($f62d864046160412$export$f4a51ff076cc9a09(newFocusedDate, visibleDuration, locale2, minValue, maxValue));
    setFocusedDate(newFocusedDate);
    setLastCalendar(calendar2);
  }
  if ($f62d864046160412$export$eac50920cf2fd59a(focusedDate, minValue, maxValue))
    setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate, minValue, maxValue));
  else if (focusedDate.compare(startDate) < 0)
    setStartDate($f62d864046160412$export$530edbfc915b2b04(focusedDate, visibleDuration, locale2, minValue, maxValue));
  else if (focusedDate.compare(endDate) > 0)
    setStartDate($f62d864046160412$export$144a00ba6044eb9(focusedDate, visibleDuration, locale2, minValue, maxValue));
  function focusCell(date4) {
    date4 = $f62d864046160412$export$4f5203c0d889109e(date4, minValue, maxValue);
    setFocusedDate(date4);
  }
  function setValue(newValue) {
    if (!props.isDisabled && !props.isReadOnly) {
      let localValue = newValue;
      if (localValue === null) {
        setControlledValue(null);
        return;
      }
      localValue = $f62d864046160412$export$4f5203c0d889109e(localValue, minValue, maxValue);
      localValue = $f62d864046160412$export$a1d3911297b952d7(localValue, startDate, isDateUnavailable);
      if (!localValue)
        return;
      localValue = $11d87f3f76e88657$export$b4a036af3fc0b032(localValue, (value2 === null || value2 === void 0 ? void 0 : value2.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      if (value2 && "hour" in value2)
        setControlledValue(value2.set(localValue));
      else
        setControlledValue(localValue);
    }
  }
  let isUnavailable = reactExports.useMemo(() => {
    if (!calendarDateValue)
      return false;
    if (isDateUnavailable && isDateUnavailable(calendarDateValue))
      return true;
    return $f62d864046160412$export$eac50920cf2fd59a(calendarDateValue, minValue, maxValue);
  }, [
    calendarDateValue,
    isDateUnavailable,
    minValue,
    maxValue
  ]);
  let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isUnavailable;
  let validationState = isValueInvalid ? "invalid" : null;
  let pageDuration = reactExports.useMemo(() => {
    if (pageBehavior === "visible")
      return visibleDuration;
    return $131cf43a05231e1e$var$unitDuration(visibleDuration);
  }, [
    pageBehavior,
    visibleDuration
  ]);
  var _props_isDisabled, _props_isReadOnly;
  return {
    isDisabled: (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : false,
    isReadOnly: (_props_isReadOnly = props.isReadOnly) !== null && _props_isReadOnly !== void 0 ? _props_isReadOnly : false,
    value: calendarDateValue,
    setValue,
    visibleRange: {
      start: startDate,
      end: endDate
    },
    minValue,
    maxValue,
    focusedDate,
    timeZone,
    validationState,
    isValueInvalid,
    setFocusedDate(date4) {
      focusCell(date4);
      setFocused(true);
    },
    focusNextDay() {
      focusCell(focusedDate.add({
        days: 1
      }));
    },
    focusPreviousDay() {
      focusCell(focusedDate.subtract({
        days: 1
      }));
    },
    focusNextRow() {
      if (visibleDuration.days)
        this.focusNextPage();
      else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.add({
          weeks: 1
        }));
    },
    focusPreviousRow() {
      if (visibleDuration.days)
        this.focusPreviousPage();
      else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.subtract({
          weeks: 1
        }));
    },
    focusNextPage() {
      let start = startDate.add(pageDuration);
      setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.add(pageDuration), minValue, maxValue));
      setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, pageDuration, locale2, minValue, maxValue), pageDuration, locale2));
    },
    focusPreviousPage() {
      let start = startDate.subtract(pageDuration);
      setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.subtract(pageDuration), minValue, maxValue));
      setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, pageDuration, locale2, minValue, maxValue), pageDuration, locale2));
    },
    focusSectionStart() {
      if (visibleDuration.days)
        focusCell(startDate);
      else if (visibleDuration.weeks)
        focusCell($14e0f24ef4ac5c92$export$42c81a444fbfb5d4(focusedDate, locale2));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell($14e0f24ef4ac5c92$export$a5a3b454ada2268e(focusedDate));
    },
    focusSectionEnd() {
      if (visibleDuration.days)
        focusCell(endDate);
      else if (visibleDuration.weeks)
        focusCell($14e0f24ef4ac5c92$export$ef8b6d9133084f4e(focusedDate, locale2));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell($14e0f24ef4ac5c92$export$a2258d9c4118825c(focusedDate));
    },
    focusNextSection(larger) {
      if (!larger && !visibleDuration.days) {
        focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
        return;
      }
      if (visibleDuration.days)
        this.focusNextPage();
      else if (visibleDuration.weeks)
        focusCell(focusedDate.add({
          months: 1
        }));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.add({
          years: 1
        }));
    },
    focusPreviousSection(larger) {
      if (!larger && !visibleDuration.days) {
        focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
        return;
      }
      if (visibleDuration.days)
        this.focusPreviousPage();
      else if (visibleDuration.weeks)
        focusCell(focusedDate.subtract({
          months: 1
        }));
      else if (visibleDuration.months || visibleDuration.years)
        focusCell(focusedDate.subtract({
          years: 1
        }));
    },
    selectFocusedDate() {
      if (!(isDateUnavailable && isDateUnavailable(focusedDate)))
        setValue(focusedDate);
    },
    selectDate(date4) {
      setValue(date4);
    },
    isFocused,
    setFocused,
    isInvalid(date4) {
      return $f62d864046160412$export$eac50920cf2fd59a(date4, minValue, maxValue);
    },
    isSelected(date4) {
      return calendarDateValue != null && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, calendarDateValue) && !this.isCellDisabled(date4) && !this.isCellUnavailable(date4);
    },
    isCellFocused(date4) {
      return isFocused && focusedDate && $14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, focusedDate);
    },
    isCellDisabled(date4) {
      return props.isDisabled || date4.compare(startDate) < 0 || date4.compare(endDate) > 0 || this.isInvalid(date4);
    },
    isCellUnavailable(date4) {
      return props.isDateUnavailable ? props.isDateUnavailable(date4) : false;
    },
    isPreviousVisibleRangeInvalid() {
      let prev2 = startDate.subtract({
        days: 1
      });
      return $14e0f24ef4ac5c92$export$ea39ec197993aef0(prev2, startDate) || this.isInvalid(prev2);
    },
    isNextVisibleRangeInvalid() {
      let next2 = endDate.add({
        days: 1
      });
      return $14e0f24ef4ac5c92$export$ea39ec197993aef0(next2, endDate) || this.isInvalid(next2);
    },
    getDatesInWeek(weekIndex, from2 = startDate) {
      let date4 = from2.add({
        weeks: weekIndex
      });
      let dates = [];
      date4 = $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date4, locale2, firstDayOfWeek);
      let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date4, locale2, firstDayOfWeek);
      for (let i2 = 0; i2 < dayOfWeek; i2++)
        dates.push(null);
      while (dates.length < 7) {
        dates.push(date4);
        let nextDate = date4.add({
          days: 1
        });
        if ($14e0f24ef4ac5c92$export$ea39ec197993aef0(date4, nextDate))
          break;
        date4 = nextDate;
      }
      while (dates.length < 7)
        dates.push(null);
      return dates;
    }
  };
}
function $131cf43a05231e1e$var$unitDuration(duration2) {
  let unit2 = {
    ...duration2
  };
  for (let key in duration2)
    unit2[key] = 1;
  return unit2;
}
function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
  let { value: valueProp, defaultValue: defaultValue2, onChange, createCalendar, locale: locale2, visibleDuration = {
    months: 1
  }, minValue, maxValue, ...calendarProps } = props;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$2(valueProp, defaultValue2 || null, onChange);
  let [anchorDate, setAnchorDateState] = reactExports.useState(null);
  let alignment = "center";
  if (value2 && value2.start && value2.end) {
    let start = $f62d864046160412$export$f4a51ff076cc9a09($11d87f3f76e88657$export$93522d1a439f3617(value2.start), visibleDuration, locale2, minValue, maxValue);
    let end = start.add(visibleDuration).subtract({
      days: 1
    });
    if (value2.end.compare(end) > 0)
      alignment = "start";
  }
  let availableRangeRef = reactExports.useRef(null);
  let [availableRange, setAvailableRange] = reactExports.useState(null);
  let min2 = reactExports.useMemo(() => $14e0f24ef4ac5c92$export$a75f2bff57811055(minValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.start), [
    minValue,
    availableRange
  ]);
  let max2 = reactExports.useMemo(() => $14e0f24ef4ac5c92$export$5c333a116e949cdd(maxValue, availableRange === null || availableRange === void 0 ? void 0 : availableRange.end), [
    maxValue,
    availableRange
  ]);
  let calendar2 = $131cf43a05231e1e$export$6d095e787d2b5e1f({
    ...calendarProps,
    value: value2 && value2.start,
    createCalendar,
    locale: locale2,
    visibleDuration,
    minValue: min2,
    maxValue: max2,
    selectionAlignment: alignment
  });
  let updateAvailableRange = (date4) => {
    if (date4 && props.isDateUnavailable && !props.allowsNonContiguousRanges) {
      const nextAvailableStartDate = $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date4, calendar2, -1);
      const nextAvailableEndDate = $9a36b6ba2fb1a7c5$var$nextUnavailableDate(date4, calendar2, 1);
      availableRangeRef.current = {
        start: nextAvailableStartDate,
        end: nextAvailableEndDate
      };
      setAvailableRange(availableRangeRef.current);
    } else {
      availableRangeRef.current = null;
      setAvailableRange(null);
    }
  };
  let [lastVisibleRange, setLastVisibleRange] = reactExports.useState(calendar2.visibleRange);
  if (!$14e0f24ef4ac5c92$export$91b62ebf2ba703ee(calendar2.visibleRange.start, lastVisibleRange.start) || !$14e0f24ef4ac5c92$export$91b62ebf2ba703ee(calendar2.visibleRange.end, lastVisibleRange.end)) {
    updateAvailableRange(anchorDate);
    setLastVisibleRange(calendar2.visibleRange);
  }
  let setAnchorDate = (date4) => {
    if (date4) {
      setAnchorDateState(date4);
      updateAvailableRange(date4);
    } else {
      setAnchorDateState(null);
      updateAvailableRange(null);
    }
  };
  let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar2.focusedDate) : value2 && $9a36b6ba2fb1a7c5$var$makeRange(value2.start, value2.end);
  let selectDate = (date4) => {
    if (props.isReadOnly)
      return;
    const constrainedDate = $f62d864046160412$export$4f5203c0d889109e(date4, min2, max2);
    const previousAvailableConstrainedDate = $f62d864046160412$export$a1d3911297b952d7(constrainedDate, calendar2.visibleRange.start, props.isDateUnavailable);
    if (!previousAvailableConstrainedDate)
      return;
    if (!anchorDate)
      setAnchorDate(previousAvailableConstrainedDate);
    else {
      let range3 = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, previousAvailableConstrainedDate);
      if (range3)
        setValue({
          start: $9a36b6ba2fb1a7c5$var$convertValue(range3.start, value2 === null || value2 === void 0 ? void 0 : value2.start),
          end: $9a36b6ba2fb1a7c5$var$convertValue(range3.end, value2 === null || value2 === void 0 ? void 0 : value2.end)
        });
      setAnchorDate(null);
    }
  };
  let [isDragging2, setDragging] = reactExports.useState(false);
  let { isDateUnavailable } = props;
  let isInvalidSelection = reactExports.useMemo(() => {
    if (!value2 || anchorDate)
      return false;
    if (isDateUnavailable && (isDateUnavailable(value2.start) || isDateUnavailable(value2.end)))
      return true;
    return $f62d864046160412$export$eac50920cf2fd59a(value2.start, minValue, maxValue) || $f62d864046160412$export$eac50920cf2fd59a(value2.end, minValue, maxValue);
  }, [
    isDateUnavailable,
    value2,
    anchorDate,
    minValue,
    maxValue
  ]);
  let isValueInvalid = props.isInvalid || props.validationState === "invalid" || isInvalidSelection;
  let validationState = isValueInvalid ? "invalid" : null;
  return {
    ...calendar2,
    value: value2,
    setValue,
    anchorDate,
    setAnchorDate,
    highlightedRange,
    validationState,
    isValueInvalid,
    selectFocusedDate() {
      selectDate(calendar2.focusedDate);
    },
    selectDate,
    highlightDate(date4) {
      if (anchorDate)
        calendar2.setFocusedDate(date4);
    },
    isSelected(date4) {
      return Boolean(highlightedRange && date4.compare(highlightedRange.start) >= 0 && date4.compare(highlightedRange.end) <= 0 && !calendar2.isCellDisabled(date4) && !calendar2.isCellUnavailable(date4));
    },
    isInvalid(date4) {
      var _availableRangeRef_current, _availableRangeRef_current1;
      return calendar2.isInvalid(date4) || $f62d864046160412$export$eac50920cf2fd59a(date4, (_availableRangeRef_current = availableRangeRef.current) === null || _availableRangeRef_current === void 0 ? void 0 : _availableRangeRef_current.start, (_availableRangeRef_current1 = availableRangeRef.current) === null || _availableRangeRef_current1 === void 0 ? void 0 : _availableRangeRef_current1.end);
    },
    isDragging: isDragging2,
    setDragging
  };
}
function $9a36b6ba2fb1a7c5$var$makeRange(start, end) {
  if (!start || !end)
    return null;
  if (end.compare(start) < 0)
    [start, end] = [
      end,
      start
    ];
  return {
    start: $11d87f3f76e88657$export$93522d1a439f3617(start),
    end: $11d87f3f76e88657$export$93522d1a439f3617(end)
  };
}
function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
  newValue = $11d87f3f76e88657$export$b4a036af3fc0b032(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
  if (oldValue && "hour" in oldValue)
    return oldValue.set(newValue);
  return newValue;
}
function $9a36b6ba2fb1a7c5$var$nextUnavailableDate(anchorDate, state, dir) {
  let nextDate = anchorDate.add({
    days: dir
  });
  while ((dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) && !state.isCellUnavailable(nextDate))
    nextDate = nextDate.add({
      days: dir
    });
  if (state.isCellUnavailable(nextDate))
    return nextDate.add({
      days: -dir
    });
}
var ChevronLeftIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 16 16",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M10 3.33334L6 8.00001L10 12.6667",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var ChevronRightIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 16 16",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M6 3.33334L10 8.00001L6 12.6667",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var ChevronDownIcon = (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
  "svg",
  {
    "aria-hidden": "true",
    fill: "none",
    focusable: "false",
    height: "1em",
    role: "presentation",
    viewBox: "0 0 24 24",
    width: "1em",
    ...props,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "path",
      {
        d: "M19 9L12 15L5 9",
        stroke: "currentColor",
        strokeLinecap: "round",
        strokeLinejoin: "round",
        strokeWidth: "1.5"
      }
    )
  }
);
var [CalendarProvider, useCalendarContext] = createContext2({
  name: "CalendarContext",
  strict: true,
  errorMessage: "useContext: `context` is undefined. Seems you forgot to wrap component within the CalendarProvider"
});
var transition = {
  type: "spring",
  bounce: 0,
  duration: 0.3
};
var slideVariants = {
  enter: (direction) => ({
    x: `${direction * 100}%`
  }),
  center: {
    x: "0%"
  },
  exit: (direction) => ({
    x: `${direction * -100}%`
  })
};
function CalendarHeader(props) {
  const { direction, date: date4, currentMonth, buttonPickerProps } = props;
  const {
    state,
    slots,
    headerRef,
    showMonthAndYearPickers,
    isHeaderExpanded,
    setIsHeaderExpanded,
    disableAnimation,
    classNames: classNames2
  } = useCalendarContext();
  const monthAndYearDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    month: "long",
    era: currentMonth.calendar.identifier === "gregory" && currentMonth.era === "BC" ? "short" : void 0,
    calendar: currentMonth.calendar.identifier,
    timeZone: state.timeZone,
    year: "numeric"
  });
  const monthDateContent = monthAndYearDateFormatter.format(date4.toDate(state.timeZone));
  const headerTitle = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      "aria-hidden": true,
      className: slots == null ? void 0 : slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      "data-slot": "title",
      children: monthDateContent
    },
    currentMonth.month
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.span,
    {
      animate: "center",
      "aria-hidden": true,
      className: slots == null ? void 0 : slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      custom: direction,
      "data-slot": "title",
      exit: "exit",
      initial: "enter",
      variants: isHeaderExpanded ? {} : slideVariants,
      children: monthDateContent
    },
    currentMonth.month
  ) });
  const headerProps = {
    ref: headerRef,
    className: slots == null ? void 0 : slots.header({ class: classNames2 == null ? void 0 : classNames2.header }),
    "data-slot": "header"
  };
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape") {
        e2.preventDefault();
        e2.stopPropagation();
        setIsHeaderExpanded == null ? void 0 : setIsHeaderExpanded(false);
      }
    },
    [setIsHeaderExpanded]
  );
  return showMonthAndYearPickers ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    button_default$1,
    {
      ...headerProps,
      "aria-label": "switch to year and month view",
      disableAnimation,
      endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon, { className: "chevron-icon" }),
      onKeyDown: handleKeyDown,
      ...buttonPickerProps,
      children: headerTitle
    }
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx("header", { ...headerProps, children: headerTitle });
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = false;
let $6179b936705e76d3$var$hoverCount$2 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$2() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$2(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$2();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$2() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$2);
  $6179b936705e76d3$var$hoverCount$2++;
  return () => {
    $6179b936705e76d3$var$hoverCount$2--;
    if ($6179b936705e76d3$var$hoverCount$2 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$2);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$2(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$2, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$2 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
function CalendarCell(originalProps) {
  const { state, slots, isPickerVisible, currentMonth, classNames: classNames2, firstDayOfWeek, ...props } = originalProps;
  const ref = reactExports.useRef(null);
  const {
    cellProps,
    buttonProps,
    isPressed,
    isSelected,
    isDisabled,
    isFocused,
    isInvalid,
    formattedDate
  } = $36a0ac60f04457c5$export$136073280381448e(
    {
      ...props,
      isDisabled: !$14e0f24ef4ac5c92$export$a18c89cbd24170ff(props.date, currentMonth) || isPickerVisible
    },
    state,
    ref
  );
  const isUnavailable = state.isCellUnavailable(props.date);
  const isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({ days: 1 }));
  const isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({ days: 1 }));
  const highlightedRange = "highlightedRange" in state && state.highlightedRange;
  const isSelectionStart = isSelected && highlightedRange ? $14e0f24ef4ac5c92$export$ea39ec197993aef0(props.date, highlightedRange.start) : false;
  const isSelectionEnd = isSelected && highlightedRange ? $14e0f24ef4ac5c92$export$ea39ec197993aef0(props.date, highlightedRange.end) : false;
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(props.date, locale2, firstDayOfWeek);
  const isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
  const isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
  const { focusProps, isFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456$2({
    isDisabled: isDisabled || isUnavailable || state.isReadOnly
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: slots == null ? void 0 : slots.cell({ class: classNames2 == null ? void 0 : classNames2.cell }), "data-slot": "cell", ...cellProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      ...mergeProps$3(buttonProps, hoverProps, focusProps),
      ref,
      className: slots == null ? void 0 : slots.cellButton({ class: classNames2 == null ? void 0 : classNames2.cellButton }),
      "data-disabled": dataAttr(isDisabled && !isInvalid),
      "data-focus-visible": dataAttr(isFocused && isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-invalid": dataAttr(isInvalid),
      "data-outside-month": dataAttr(!$14e0f24ef4ac5c92$export$a18c89cbd24170ff(props.date, currentMonth)),
      "data-pressed": dataAttr(isPressed && !state.isReadOnly),
      "data-range-end": dataAttr(isRangeEnd),
      "data-range-selection": dataAttr(isSelected && "highlightedRange" in state),
      "data-range-start": dataAttr(isRangeStart),
      "data-readonly": dataAttr(state.isReadOnly),
      "data-selected": dataAttr(isSelected),
      "data-selection-end": dataAttr(isSelectionEnd),
      "data-selection-start": dataAttr(isSelectionStart),
      "data-today": dataAttr($14e0f24ef4ac5c92$export$629b0a497aa65267(props.date, state.timeZone)),
      "data-unavailable": dataAttr(isUnavailable),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: formattedDate })
    }
  ) });
}
function CalendarMonth(props) {
  const { startDate, direction, currentMonth, firstDayOfWeek } = props;
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const weeksInMonth = $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(startDate, locale2, firstDayOfWeek);
  const { state, slots, weekdayStyle, isHeaderExpanded, disableAnimation, classNames: classNames2 } = useCalendarContext();
  const { gridProps, headerProps, weekDays } = $e3031d1f8c9d64eb$export$cb95147730a423f5(
    {
      ...props,
      weekdayStyle,
      endDate: $14e0f24ef4ac5c92$export$a2258d9c4118825c(startDate),
      firstDayOfWeek
    },
    state
  );
  const bodyContent = [...new Array(weeksInMonth).keys()].map((weekIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    "tr",
    {
      className: slots == null ? void 0 : slots.gridBodyRow({ class: classNames2 == null ? void 0 : classNames2.gridBodyRow }),
      "data-slot": "grid-body-row",
      inert: getInertValue(!!isHeaderExpanded),
      children: state.getDatesInWeek(weekIndex, startDate).map(
        (date4, i2) => date4 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          CalendarCell,
          {
            classNames: classNames2,
            currentMonth: startDate,
            date: date4,
            firstDayOfWeek,
            isPickerVisible: isHeaderExpanded,
            slots,
            state
          },
          i2
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx("td", {}, i2)
      )
    },
    weekIndex
  ));
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "table",
    {
      ...gridProps,
      "aria-hidden": dataAttr(isHeaderExpanded),
      className: slots == null ? void 0 : slots.grid({ class: classNames2 == null ? void 0 : classNames2.grid }),
      "data-slot": "grid",
      tabIndex: -1,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "thead",
          {
            ...headerProps,
            className: slots == null ? void 0 : slots.gridHeader({ class: classNames2 == null ? void 0 : classNames2.gridHeader }),
            "data-slot": "grid-header",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "tr",
              {
                className: slots == null ? void 0 : slots.gridHeaderRow({ class: classNames2 == null ? void 0 : classNames2.gridHeaderRow }),
                "data-slot": "grid-header-row",
                children: weekDays.map((day, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "th",
                  {
                    className: slots == null ? void 0 : slots.gridHeaderCell({ class: classNames2 == null ? void 0 : classNames2.gridHeaderCell }),
                    "data-slot": "grid-header-cell",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: day })
                  },
                  index2
                ))
              }
            )
          }
        ),
        disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          "tbody",
          {
            className: slots == null ? void 0 : slots.gridBody({ class: classNames2 == null ? void 0 : classNames2.gridBody }),
            "data-slot": "grid-body",
            tabIndex: isHeaderExpanded ? -1 : 0,
            children: bodyContent
          },
          currentMonth
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          m$3.tbody,
          {
            animate: "center",
            className: slots == null ? void 0 : slots.gridBody({ class: classNames2 == null ? void 0 : classNames2.gridBody }),
            custom: direction,
            "data-slot": "grid-body",
            exit: "exit",
            initial: "enter",
            variants: slideVariants,
            children: bodyContent
          },
          currentMonth
        )
      ]
    }
  );
}
function getYearRange(start, end) {
  const years2 = [];
  if (!start || !end) {
    return years2;
  }
  let current = $14e0f24ef4ac5c92$export$f91e89d3d0406102(start);
  while (current.compare(end) <= 0) {
    years2.push(current);
    current = $14e0f24ef4ac5c92$export$f91e89d3d0406102(current.add({ years: 1 }));
  }
  return years2;
}
function addMonths(date4, months2) {
  return date4.add({ months: months2 });
}
function getMonthsInYear(year) {
  const firstMonth = $14e0f24ef4ac5c92$export$f91e89d3d0406102(year);
  const months2 = [firstMonth];
  while (months2.length < 12) {
    const prevMonth = months2[months2.length - 1];
    months2.push(addMonths(prevMonth, 1));
  }
  return months2;
}
var SCROLL_DEBOUNCE_TIME = 200;
function useCalendarPicker(props) {
  var _a2;
  const { date: date4, currentMonth } = props;
  const { slots, state, headerRef, isHeaderExpanded, setIsHeaderExpanded, classNames: classNames2 } = useCalendarContext();
  const highlightRef = reactExports.useRef(null);
  const yearsListRef = reactExports.useRef(null);
  const monthsListRef = reactExports.useRef(null);
  const monthsItemsRef = reactExports.useRef();
  const yearsItemsRef = reactExports.useRef();
  const focusedDateRef = reactExports.useRef(state.focusedDate);
  const monthDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    month: "long",
    era: currentMonth.calendar.identifier === "gregory" && currentMonth.era === "BC" ? "short" : void 0,
    calendar: currentMonth.calendar.identifier,
    timeZone: state.timeZone
  });
  const yearDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79({
    year: "numeric",
    timeZone: state.timeZone
  });
  const years2 = (_a2 = getYearRange(state.minValue, state.maxValue)) == null ? void 0 : _a2.map((y2) => ({
    value: y2.year,
    label: yearDateFormatter.format(y2.toDate(state.timeZone))
  }));
  const months2 = getMonthsInYear(date4).map((m2) => ({
    value: m2.month,
    label: monthDateFormatter.format(m2.toDate(state.timeZone))
  }));
  function getItemsRefMap(itemsRef) {
    if (!itemsRef.current) {
      itemsRef.current = /* @__PURE__ */ new Map();
    }
    return itemsRef.current;
  }
  function getItemRef(node2, value2, list2) {
    const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
    if (node2) {
      map2.set(value2, node2);
    } else {
      map2.delete(value2);
    }
  }
  const handleListScroll = reactExports.useCallback(
    (e2, highlightEl, list2) => {
      if (!(e2.target instanceof HTMLElement) || !highlightEl)
        return;
      const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
      const items = Array.from(map2.entries());
      const highlightRect = highlightEl.getBoundingClientRect();
      const highlightCenter = {
        x: highlightRect.left + highlightRect.width / 2,
        y: highlightRect.top + highlightRect.height / 2
      };
      let closestItem = null;
      let minDistance = Infinity;
      for (const [value2, itemEl] of items) {
        const itemRect = itemEl.getBoundingClientRect();
        const itemCenter = {
          x: itemRect.left + itemRect.width / 2,
          y: itemRect.top + itemRect.height / 2
        };
        const distance2 = Math.sqrt(
          Math.pow(highlightCenter.x - itemCenter.x, 2) + Math.pow(highlightCenter.y - itemCenter.y, 2)
        );
        if (distance2 < minDistance) {
          minDistance = distance2;
          closestItem = [value2, itemEl];
        }
      }
      if (!closestItem)
        return;
      const [itemValue] = closestItem;
      const updatedDate = focusedDateRef.current.set(
        list2 === "months" ? { month: itemValue } : { year: itemValue }
      );
      state.setFocusedDate(updatedDate);
    },
    [isHeaderExpanded]
  );
  reactExports.useEffect(() => {
    focusedDateRef.current = state.focusedDate;
  }, [state.focusedDate]);
  reactExports.useEffect(() => {
    if (!isHeaderExpanded)
      return;
    scrollTo(date4.month, "months", false);
    scrollTo(date4.year, "years", false);
  }, [isHeaderExpanded]);
  reactExports.useEffect(() => {
    const monthsList = monthsListRef.current;
    const yearsList = yearsListRef.current;
    const highlightEl = highlightRef.current;
    if (!highlightEl)
      return;
    const debouncedHandleMonthsScroll = debounce$5(
      (e2) => handleListScroll(e2, highlightEl, "months"),
      SCROLL_DEBOUNCE_TIME
    );
    const debouncedHandleYearsScroll = debounce$5(
      (e2) => handleListScroll(e2, highlightEl, "years"),
      SCROLL_DEBOUNCE_TIME
    );
    monthsList == null ? void 0 : monthsList.addEventListener("scroll", debouncedHandleMonthsScroll);
    yearsList == null ? void 0 : yearsList.addEventListener("scroll", debouncedHandleYearsScroll);
    return () => {
      if (debouncedHandleMonthsScroll) {
        monthsList == null ? void 0 : monthsList.removeEventListener("scroll", debouncedHandleMonthsScroll);
      }
      if (debouncedHandleYearsScroll) {
        yearsList == null ? void 0 : yearsList.removeEventListener("scroll", debouncedHandleYearsScroll);
      }
    };
  }, [handleListScroll]);
  function scrollTo(value2, list2, smooth = true) {
    const mapListRef = list2 === "months" ? monthsItemsRef : yearsItemsRef;
    const listRef = list2 === "months" ? monthsListRef : yearsListRef;
    const map2 = getItemsRefMap(mapListRef);
    const node2 = map2.get(value2);
    if (!node2)
      return;
    t$7(node2, {
      scrollMode: "always",
      behavior: smooth ? "smooth" : "auto",
      boundary: listRef.current
    });
  }
  const onPickerItemPressed = reactExports.useCallback(
    (e2, list2) => {
      const target = e2.target;
      const value2 = Number(target.getAttribute("data-value"));
      if (!value2)
        return;
      scrollTo(value2, list2);
    },
    [state]
  );
  const onPickerItemKeyDown = reactExports.useCallback(
    (e2, value2, list2) => {
      var _a22;
      const map2 = getItemsRefMap(list2 === "months" ? monthsItemsRef : yearsItemsRef);
      const node2 = map2.get(value2);
      if (!node2)
        return;
      let nextValue = value2;
      switch (e2.key) {
        case "ArrowDown":
          nextValue = value2 + 1;
          break;
        case "ArrowUp":
          nextValue = value2 - 1;
          break;
        case "Home":
          nextValue = 0;
          break;
        case "End":
          nextValue = months2.length - 1;
          break;
        case "PageUp":
          nextValue = value2 - 3;
          break;
        case "PageDown":
          nextValue = value2 + 3;
          break;
        case "Escape":
        case "Enter":
        case " ":
          setIsHeaderExpanded == null ? void 0 : setIsHeaderExpanded(false);
          (_a22 = headerRef == null ? void 0 : headerRef.current) == null ? void 0 : _a22.focus();
          return;
      }
      const nextItem = map2.get(nextValue);
      nextItem == null ? void 0 : nextItem.focus();
    },
    [state]
  );
  return {
    state,
    slots,
    classNames: classNames2,
    years: years2,
    months: months2,
    highlightRef,
    monthsListRef,
    yearsListRef,
    getItemRef,
    isHeaderExpanded,
    onPickerItemPressed,
    onPickerItemKeyDown
  };
}
var CalendarPickerItem = reactExports.forwardRef(({ children, autoFocus, isDisabled, onKeyDown, ...otherProps }, ref) => {
  const domRef = useDOMRef(ref);
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton$1(
    {
      elementType: "button",
      isDisabled,
      onKeyDown,
      ...otherProps
    },
    domRef
  );
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$2({ isDisabled });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "button",
    {
      ref: domRef,
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-pressed": dataAttr(isPressed),
      "data-slot": "picker-item",
      ...mergeProps$3(
        focusProps,
        hoverProps,
        ariaButtonProps,
        filterDOMProps(otherProps, { enabled: true })
      ),
      children
    }
  );
});
CalendarPickerItem.displayName = "CalendarPickerItem";
var EMPTY_ITEMS_OFFSET = 3;
function CalendarPicker(props) {
  const {
    state,
    slots,
    months: months2,
    years: years2,
    highlightRef,
    monthsListRef,
    yearsListRef,
    classNames: classNames2,
    getItemRef,
    isHeaderExpanded,
    onPickerItemPressed,
    onPickerItemKeyDown
  } = useCalendarPicker(props);
  const EmptyItem = reactExports.useCallback(
    (props2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        "aria-hidden": "true",
        className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
        "data-slot": "picker-item-empty",
        tabIndex: -1,
        ...props2,
        children: " "
      }
    ),
    [slots, classNames2 == null ? void 0 : classNames2.pickerItem]
  );
  const PickerItemWrapper = reactExports.useCallback(
    ({ children }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      Array.from({ length: EMPTY_ITEMS_OFFSET }, (_24, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyItem, {}, i2)),
      children,
      Array.from({ length: EMPTY_ITEMS_OFFSET }, (_24, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyItem, {}, i2))
    ] }),
    [EmptyItem]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: slots == null ? void 0 : slots.pickerWrapper({
        class: classNames2 == null ? void 0 : classNames2.pickerWrapper
      }),
      "data-slot": "picker-wrapper",
      inert: getInertValue(!isHeaderExpanded),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: highlightRef,
            className: slots == null ? void 0 : slots.pickerHighlight({ class: classNames2 == null ? void 0 : classNames2.pickerHighlight }),
            "data-slot": "picker-highlight"
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: monthsListRef,
            className: slots == null ? void 0 : slots.pickerMonthList({ class: classNames2 == null ? void 0 : classNames2.pickerMonthList }),
            "data-slot": "picker-month-list",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(PickerItemWrapper, { children: months2.map((month) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                CalendarPickerItem,
                {
                  ref: (node2) => getItemRef(node2, month.value, "months"),
                  className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
                  "data-value": month.value,
                  tabIndex: !isHeaderExpanded || ((_a2 = state.focusedDate) == null ? void 0 : _a2.month) !== month.value ? -1 : 0,
                  onKeyDown: (e2) => onPickerItemKeyDown(e2, month.value, "months"),
                  onPress: (e2) => onPickerItemPressed(e2, "months"),
                  children: month.label
                },
                `picker-month-${month.value}`
              );
            }) })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            ref: yearsListRef,
            className: slots == null ? void 0 : slots.pickerYearList({ class: classNames2 == null ? void 0 : classNames2.pickerYearList }),
            "data-slot": "picker-year-list",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(PickerItemWrapper, { children: years2.map((year) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                CalendarPickerItem,
                {
                  ref: (node2) => getItemRef(node2, year.value, "years"),
                  className: slots == null ? void 0 : slots.pickerItem({ class: classNames2 == null ? void 0 : classNames2.pickerItem }),
                  "data-value": year.value,
                  tabIndex: !isHeaderExpanded || ((_a2 = state.focusedDate) == null ? void 0 : _a2.year) !== year.value ? -1 : 0,
                  onKeyDown: (e2) => onPickerItemKeyDown(e2, year.value, "years"),
                  onPress: (e2) => onPickerItemPressed(e2, "years"),
                  children: year.label
                },
                `picker-year-${year.value}`
              );
            }) })
          }
        )
      ]
    }
  );
}
var domAnimation$1 = () => __vitePreload(() => import("./index-D5ptewGc.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var PopLayoutWrapper = reactExports.forwardRef(
  (props, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, ...props });
  }
);
PopLayoutWrapper.displayName = "HeroUI - PopLayoutWrapper";
function CalendarBase(props) {
  const {
    Component: Component2 = "div",
    showHelper,
    topContent,
    bottomContent,
    calendarProps,
    nextButtonProps,
    prevButtonProps,
    buttonPickerProps,
    errorMessageProps,
    calendarRef: ref,
    errorMessage,
    firstDayOfWeek,
    ...otherProps
  } = props;
  const { state, slots, visibleMonths, showMonthAndYearPickers, disableAnimation, classNames: classNames2 } = useCalendarContext();
  const [direction, setDirection] = reactExports.useState(0);
  const { direction: localeDirection } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$3();
  const currentMonth = state.visibleRange.start;
  const headers = [];
  const calendars = [];
  const isRTL = localeDirection === "rtl";
  for (let i2 = 0; i2 < visibleMonths; i2++) {
    let d2 = currentMonth.add({ months: i2 });
    headers.push(
      /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        i2 === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            ...isRTL ? nextButtonProps : prevButtonProps,
            onPress: chain(
              isRTL ? nextButtonProps.onPress : prevButtonProps.onPress,
              () => setDirection(-1)
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeftIcon, {})
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          CalendarHeader,
          {
            buttonPickerProps,
            currentMonth,
            date: d2,
            direction
          }
        ),
        i2 === visibleMonths - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            ...isRTL ? prevButtonProps : nextButtonProps,
            onPress: chain(
              isRTL ? prevButtonProps.onPress : nextButtonProps.onPress,
              () => setDirection(1)
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRightIcon, {})
          }
        )
      ] }, `calendar-header-${i2}`)
    );
    const calendarMonthContent = /* @__PURE__ */ reactExports.createElement(
      CalendarMonth,
      {
        ...props,
        key: `calendar-month-${i2}`,
        currentMonth: currentMonth.month,
        direction,
        firstDayOfWeek,
        startDate: d2
      }
    );
    calendars.push(
      showMonthAndYearPickers ? /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.Fragment, { children: [
        calendarMonthContent,
        /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarPicker, { currentMonth, date: d2 })
      ] }, `calendar-month-with-pickers-${i2}`) : calendarMonthContent
    );
  }
  const calendarContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.headerWrapper({ class: classNames2 == null ? void 0 : classNames2.headerWrapper }),
        "data-slot": "header-wrapper",
        children: headers
      },
      "header-wrapper"
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.gridWrapper({ class: classNames2 == null ? void 0 : classNames2.gridWrapper }),
        "data-slot": "grid-wrapper",
        children: calendars
      },
      "grid-wrapper"
    )
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...mergeProps$3(calendarProps, otherProps), ref, children: [
    topContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: calendarProps["aria-label"] }) }),
    disableAnimation ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots == null ? void 0 : slots.content({ class: classNames2 == null ? void 0 : classNames2.content }), "data-slot": "content", children: calendarContent }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      ResizablePanel,
      {
        className: slots == null ? void 0 : slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
        "data-slot": "content",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { custom: direction, initial: false, mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PopLayoutWrapper, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(MotionConfig, { transition, children: /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation$1, children: calendarContent }) }) }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx($5c3e21d68f1c4674$export$439d29a4e110a164, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        "aria-label": nextButtonProps["aria-label"],
        disabled: nextButtonProps.isDisabled,
        tabIndex: -1,
        onClick: () => state.focusNextPage()
      }
    ) }),
    state.isValueInvalid && showHelper && /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: slots == null ? void 0 : slots.helperWrapper({ class: classNames2 == null ? void 0 : classNames2.helperWrapper }),
        "data-slot": "helper-wrapper",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "span",
          {
            ...errorMessageProps,
            className: slots == null ? void 0 : slots.errorMessage({ class: classNames2 == null ? void 0 : classNames2.errorMessage }),
            "data-slot": "error-message",
            children: errorMessage || "Selected date unavailable."
          }
        )
      }
    ),
    bottomContent
  ] });
}
function useRangeCalendar({
  buttonPickerProps: buttonPickerPropsProp,
  className,
  ...originalProps
}) {
  const {
    Component: Component2,
    slots,
    children,
    domRef,
    locale: locale2,
    showHelper,
    firstDayOfWeek,
    minValue,
    maxValue,
    weekdayStyle,
    visibleDuration,
    shouldFilterDOMProps,
    isHeaderExpanded,
    visibleMonths,
    disableAnimation,
    createCalendar: createCalendarProp,
    showMonthAndYearPickers,
    baseProps,
    getPrevButtonProps,
    getNextButtonProps,
    getErrorMessageProps,
    setIsHeaderExpanded,
    topContent,
    bottomContent,
    errorMessage,
    classNames: classNames2,
    otherProps
  } = useCalendarBase({ ...originalProps, isRange: true });
  const headerRef = reactExports.useRef(null);
  const state = $9a36b6ba2fb1a7c5$export$9a987164d97ecc90({
    ...originalProps,
    locale: locale2,
    minValue,
    maxValue,
    visibleDuration,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const { title, calendarProps, prevButtonProps, nextButtonProps, errorMessageProps } = $46a4342aab3d8076$export$87e0539f600c24e5(originalProps, state, domRef);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const buttonPickerProps = {
    ...buttonPickerPropsProp,
    onPress: chain(buttonPickerPropsProp == null ? void 0 : buttonPickerPropsProp.onPress, () => setIsHeaderExpanded(!isHeaderExpanded))
  };
  const getBaseCalendarProps = (props = {}) => {
    return {
      ...baseProps,
      Component: Component2,
      showHelper,
      firstDayOfWeek,
      topContent,
      bottomContent,
      buttonPickerProps,
      calendarRef: domRef,
      calendarProps,
      prevButtonProps: getPrevButtonProps(prevButtonProps),
      nextButtonProps: getNextButtonProps(nextButtonProps),
      errorMessageProps: getErrorMessageProps(errorMessageProps),
      className: slots.base({ class: baseStyles }),
      errorMessage,
      ...filterDOMProps(otherProps, {
        enabled: shouldFilterDOMProps
      }),
      ...props
    };
  };
  const context = reactExports.useMemo(
    () => ({
      state,
      slots,
      headerRef,
      weekdayStyle,
      isHeaderExpanded,
      setIsHeaderExpanded,
      visibleMonths,
      showMonthAndYearPickers,
      classNames: classNames2,
      disableAnimation
    }),
    [
      state,
      slots,
      classNames2,
      weekdayStyle,
      isHeaderExpanded,
      setIsHeaderExpanded,
      visibleMonths,
      disableAnimation,
      showMonthAndYearPickers
    ]
  );
  return {
    Component: Component2,
    children,
    domRef,
    context,
    state,
    slots,
    title,
    classNames: classNames2,
    getBaseCalendarProps
  };
}
var RangeCalendar = forwardRef(function RangeCalendar2(props, ref) {
  const { context, getBaseCalendarProps } = useRangeCalendar({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarProvider, { value: context, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarBase, { ...getBaseCalendarProps() }) });
});
var range_calendar_default = RangeCalendar;
var $f23889fffbde9058$exports = {};
$f23889fffbde9058$exports = {
  "calendar": `التقويم`,
  "day": `يوم`,
  "dayPeriod": `ص/م`,
  "endDate": `تاريخ الانتهاء`,
  "era": `العصر`,
  "hour": `الساعات`,
  "minute": `الدقائق`,
  "month": `الشهر`,
  "second": `الثواني`,
  "selectedDateDescription": (args) => `تاريخ محدد: ${args.date}`,
  "selectedRangeDescription": (args) => `المدى الزمني المحدد: ${args.startDate} إلى ${args.endDate}`,
  "selectedTimeDescription": (args) => `الوقت المحدد: ${args.time}`,
  "startDate": `تاريخ البدء`,
  "timeZoneName": `التوقيت`,
  "weekday": `اليوم`,
  "year": `السنة`
};
var $09d9badaa8903929$exports = {};
$09d9badaa8903929$exports = {
  "calendar": `Календар`,
  "day": `ден`,
  "dayPeriod": `пр.об./сл.об.`,
  "endDate": `Крайна дата`,
  "era": `ера`,
  "hour": `час`,
  "minute": `минута`,
  "month": `месец`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Избрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Избран диапазон: ${args.startDate} до ${args.endDate}`,
  "selectedTimeDescription": (args) => `Избрано време: ${args.time}`,
  "startDate": `Начална дата`,
  "timeZoneName": `часова зона`,
  "weekday": `ден от седмицата`,
  "year": `година`
};
var $151b77e0fd711730$exports = {};
$151b77e0fd711730$exports = {
  "calendar": `Kalendář`,
  "day": `den`,
  "dayPeriod": `část dne`,
  "endDate": `Konečné datum`,
  "era": `letopočet`,
  "hour": `hodina`,
  "minute": `minuta`,
  "month": `měsíc`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Vybrané datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybrané období: ${args.startDate} až ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vybraný čas: ${args.time}`,
  "startDate": `Počáteční datum`,
  "timeZoneName": `časové pásmo`,
  "weekday": `den v týdnu`,
  "year": `rok`
};
var $61915aa8630b90a2$exports = {};
$61915aa8630b90a2$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `AM/PM`,
  "endDate": `Slutdato`,
  "era": `æra`,
  "hour": `time`,
  "minute": `minut`,
  "month": `måned`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt interval: ${args.startDate} til ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valgt tidspunkt: ${args.time}`,
  "startDate": `Startdato`,
  "timeZoneName": `tidszone`,
  "weekday": `ugedag`,
  "year": `år`
};
var $35cea00159787840$exports = {};
$35cea00159787840$exports = {
  "calendar": `Kalender`,
  "day": `Tag`,
  "dayPeriod": `Tageshälfte`,
  "endDate": `Enddatum`,
  "era": `Epoche`,
  "hour": `Stunde`,
  "minute": `Minute`,
  "month": `Monat`,
  "second": `Sekunde`,
  "selectedDateDescription": (args) => `Ausgewähltes Datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Ausgewählter Bereich: ${args.startDate} bis ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ausgewählte Zeit: ${args.time}`,
  "startDate": `Anfangsdatum`,
  "timeZoneName": `Zeitzone`,
  "weekday": `Wochentag`,
  "year": `Jahr`
};
var $518b4e82b9eacafd$exports = {};
$518b4e82b9eacafd$exports = {
  "calendar": `Ημερολόγιο`,
  "day": `ημέρα`,
  "dayPeriod": `π.μ./μ.μ.`,
  "endDate": `Ημερομηνία λήξης`,
  "era": `περίοδος`,
  "hour": `ώρα`,
  "minute": `λεπτό`,
  "month": `μήνας`,
  "second": `δευτερόλεπτο`,
  "selectedDateDescription": (args) => `Επιλεγμένη ημερομηνία: ${args.date}`,
  "selectedRangeDescription": (args) => `Επιλεγμένο εύρος: ${args.startDate} έως ${args.endDate}`,
  "selectedTimeDescription": (args) => `Επιλεγμένη ώρα: ${args.time}`,
  "startDate": `Ημερομηνία έναρξης`,
  "timeZoneName": `ζώνη ώρας`,
  "weekday": `καθημερινή`,
  "year": `έτος`
};
var $1c2b297f7e2cf474$exports = {};
$1c2b297f7e2cf474$exports = {
  "era": `era`,
  "year": `year`,
  "month": `month`,
  "day": `day`,
  "hour": `hour`,
  "minute": `minute`,
  "second": `second`,
  "dayPeriod": `AM/PM`,
  "calendar": `Calendar`,
  "startDate": `Start Date`,
  "endDate": `End Date`,
  "weekday": `day of the week`,
  "timeZoneName": `time zone`,
  "selectedDateDescription": (args) => `Selected Date: ${args.date}`,
  "selectedRangeDescription": (args) => `Selected Range: ${args.startDate} to ${args.endDate}`,
  "selectedTimeDescription": (args) => `Selected Time: ${args.time}`
};
var $07f628a707cf9b18$exports = {};
$07f628a707cf9b18$exports = {
  "calendar": `Calendario`,
  "day": `día`,
  "dayPeriod": `a. m./p. m.`,
  "endDate": `Fecha final`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mes`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Fecha seleccionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Rango seleccionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora seleccionada: ${args.time}`,
  "startDate": `Fecha de inicio`,
  "timeZoneName": `zona horaria`,
  "weekday": `día de la semana`,
  "year": `año`
};
var $db553ffe17c7f4db$exports = {};
$db553ffe17c7f4db$exports = {
  "calendar": `Kalender`,
  "day": `päev`,
  "dayPeriod": `enne/pärast lõunat`,
  "endDate": `Lõppkuupäev`,
  "era": `ajastu`,
  "hour": `tund`,
  "minute": `minut`,
  "month": `kuu`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valitud kuupäev: ${args.date}`,
  "selectedRangeDescription": (args) => `Valitud vahemik: ${args.startDate} kuni ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valitud aeg: ${args.time}`,
  "startDate": `Alguskuupäev`,
  "timeZoneName": `ajavöönd`,
  "weekday": `nädalapäev`,
  "year": `aasta`
};
var $4afcfe00cd703f83$exports = {};
$4afcfe00cd703f83$exports = {
  "calendar": `Kalenteri`,
  "day": `päivä`,
  "dayPeriod": `vuorokaudenaika`,
  "endDate": `Päättymispäivä`,
  "era": `aikakausi`,
  "hour": `tunti`,
  "minute": `minuutti`,
  "month": `kuukausi`,
  "second": `sekunti`,
  "selectedDateDescription": (args) => `Valittu päivämäärä: ${args.date}`,
  "selectedRangeDescription": (args) => `Valittu aikaväli: ${args.startDate} – ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valittu aika: ${args.time}`,
  "startDate": `Alkamispäivä`,
  "timeZoneName": `aikavyöhyke`,
  "weekday": `viikonpäivä`,
  "year": `vuosi`
};
var $1d2645d18d4c5be0$exports = {};
$1d2645d18d4c5be0$exports = {
  "calendar": `Calendrier`,
  "day": `jour`,
  "dayPeriod": `cadran`,
  "endDate": `Date de fin`,
  "era": `ère`,
  "hour": `heure`,
  "minute": `minute`,
  "month": `mois`,
  "second": `seconde`,
  "selectedDateDescription": (args) => `Date sélectionnée : ${args.date}`,
  "selectedRangeDescription": (args) => `Plage sélectionnée : ${args.startDate} au ${args.endDate}`,
  "selectedTimeDescription": (args) => `Heure choisie : ${args.time}`,
  "startDate": `Date de début`,
  "timeZoneName": `fuseau horaire`,
  "weekday": `jour de la semaine`,
  "year": `année`
};
var $64cb6a9be1f6fa48$exports = {};
$64cb6a9be1f6fa48$exports = {
  "calendar": `לוח שנה`,
  "day": `יום`,
  "dayPeriod": `לפנה״צ/אחה״צ`,
  "endDate": `תאריך סיום`,
  "era": `תקופה`,
  "hour": `שעה`,
  "minute": `דקה`,
  "month": `חודש`,
  "second": `שנייה`,
  "selectedDateDescription": (args) => `תאריך נבחר: ${args.date}`,
  "selectedRangeDescription": (args) => `טווח נבחר: ${args.startDate} עד ${args.endDate}`,
  "selectedTimeDescription": (args) => `זמן נבחר: ${args.time}`,
  "startDate": `תאריך התחלה`,
  "timeZoneName": `אזור זמן`,
  "weekday": `יום בשבוע`,
  "year": `שנה`
};
var $2a1ef2e8050be27a$exports = {};
$2a1ef2e8050be27a$exports = {
  "calendar": `Kalendar`,
  "day": `dan`,
  "dayPeriod": `AM/PM`,
  "endDate": `Datum završetka`,
  "era": `era`,
  "hour": `sat`,
  "minute": `minuta`,
  "month": `mjesec`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Odabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Odabrani raspon: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Odabrano vrijeme: ${args.time}`,
  "startDate": `Datum početka`,
  "timeZoneName": `vremenska zona`,
  "weekday": `dan u tjednu`,
  "year": `godina`
};
var $ad429dca102acd0e$exports = {};
$ad429dca102acd0e$exports = {
  "calendar": `Naptár`,
  "day": `nap`,
  "dayPeriod": `napszak`,
  "endDate": `Befejező dátum`,
  "era": `éra`,
  "hour": `óra`,
  "minute": `perc`,
  "month": `hónap`,
  "second": `másodperc`,
  "selectedDateDescription": (args) => `Kijelölt dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Kijelölt tartomány: ${args.startDate}–${args.endDate}`,
  "selectedTimeDescription": (args) => `Kijelölt idő: ${args.time}`,
  "startDate": `Kezdő dátum`,
  "timeZoneName": `időzóna`,
  "weekday": `hét napja`,
  "year": `év`
};
var $6e68cb5d1cb97bd2$exports = {};
$6e68cb5d1cb97bd2$exports = {
  "calendar": `Calendario`,
  "day": `giorno`,
  "dayPeriod": `AM/PM`,
  "endDate": `Data finale`,
  "era": `era`,
  "hour": `ora`,
  "minute": `minuto`,
  "month": `mese`,
  "second": `secondo`,
  "selectedDateDescription": (args) => `Data selezionata: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervallo selezionato: da ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ora selezionata: ${args.time}`,
  "startDate": `Data iniziale`,
  "timeZoneName": `fuso orario`,
  "weekday": `giorno della settimana`,
  "year": `anno`
};
var $a82ee9af063ee069$exports = {};
$a82ee9af063ee069$exports = {
  "calendar": `カレンダー`,
  "day": `日`,
  "dayPeriod": `午前/午後`,
  "endDate": `終了日`,
  "era": `時代`,
  "hour": `時`,
  "minute": `分`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `選択した日付 : ${args.date}`,
  "selectedRangeDescription": (args) => `選択範囲 : ${args.startDate} から ${args.endDate}`,
  "selectedTimeDescription": (args) => `選択した時間 : ${args.time}`,
  "startDate": `開始日`,
  "timeZoneName": `タイムゾーン`,
  "weekday": `曜日`,
  "year": `年`
};
var $67e9091dbf37d4eb$exports = {};
$67e9091dbf37d4eb$exports = {
  "calendar": `달력`,
  "day": `일`,
  "dayPeriod": `오전/오후`,
  "endDate": `종료일`,
  "era": `연호`,
  "hour": `시`,
  "minute": `분`,
  "month": `월`,
  "second": `초`,
  "selectedDateDescription": (args) => `선택 일자: ${args.date}`,
  "selectedRangeDescription": (args) => `선택 범위: ${args.startDate} ~ ${args.endDate}`,
  "selectedTimeDescription": (args) => `선택 시간: ${args.time}`,
  "startDate": `시작일`,
  "timeZoneName": `시간대`,
  "weekday": `요일`,
  "year": `년`
};
var $75834f9729f653d1$exports = {};
$75834f9729f653d1$exports = {
  "calendar": `Kalendorius`,
  "day": `diena`,
  "dayPeriod": `iki pietų / po pietų`,
  "endDate": `Pabaigos data`,
  "era": `era`,
  "hour": `valanda`,
  "minute": `minutė`,
  "month": `mėnuo`,
  "second": `sekundė`,
  "selectedDateDescription": (args) => `Pasirinkta data: ${args.date}`,
  "selectedRangeDescription": (args) => `Pasirinktas intervalas: nuo ${args.startDate} iki ${args.endDate}`,
  "selectedTimeDescription": (args) => `Pasirinktas laikas: ${args.time}`,
  "startDate": `Pradžios data`,
  "timeZoneName": `laiko juosta`,
  "weekday": `savaitės diena`,
  "year": `metai`
};
var $a2df2c2520b4a7f0$exports = {};
$a2df2c2520b4a7f0$exports = {
  "calendar": `Kalendārs`,
  "day": `diena`,
  "dayPeriod": `priekšpusdienā/pēcpusdienā`,
  "endDate": `Beigu datums`,
  "era": `ēra`,
  "hour": `stundas`,
  "minute": `minūtes`,
  "month": `mēnesis`,
  "second": `sekundes`,
  "selectedDateDescription": (args) => `Atlasītais datums: ${args.date}`,
  "selectedRangeDescription": (args) => `Atlasītais diapazons: no ${args.startDate} līdz ${args.endDate}`,
  "selectedTimeDescription": (args) => `Atlasītais laiks: ${args.time}`,
  "startDate": `Sākuma datums`,
  "timeZoneName": `laika josla`,
  "weekday": `nedēļas diena`,
  "year": `gads`
};
var $aedcd71db4933ed5$exports = {};
$aedcd71db4933ed5$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `a.m./p.m.`,
  "endDate": `Sluttdato`,
  "era": `tidsalder`,
  "hour": `time`,
  "minute": `minutt`,
  "month": `måned`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valgt dato: ${args.date}`,
  "selectedRangeDescription": (args) => `Valgt område: ${args.startDate} til ${args.endDate}`,
  "selectedTimeDescription": (args) => `Valgt tid: ${args.time}`,
  "startDate": `Startdato`,
  "timeZoneName": `tidssone`,
  "weekday": `ukedag`,
  "year": `år`
};
var $3b2df9e54353046c$exports = {};
$3b2df9e54353046c$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `a.m./p.m.`,
  "endDate": `Einddatum`,
  "era": `tijdperk`,
  "hour": `uur`,
  "minute": `minuut`,
  "month": `maand`,
  "second": `seconde`,
  "selectedDateDescription": (args) => `Geselecteerde datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Geselecteerd bereik: ${args.startDate} tot ${args.endDate}`,
  "selectedTimeDescription": (args) => `Geselecteerde tijd: ${args.time}`,
  "startDate": `Startdatum`,
  "timeZoneName": `tijdzone`,
  "weekday": `dag van de week`,
  "year": `jaar`
};
var $c03fe977fcfafe93$exports = {};
$c03fe977fcfafe93$exports = {
  "calendar": `Kalendarz`,
  "day": `dzień`,
  "dayPeriod": `rano / po południu / wieczorem`,
  "endDate": `Data końcowa`,
  "era": `era`,
  "hour": `godzina`,
  "minute": `minuta`,
  "month": `miesiąc`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Wybrana data: ${args.date}`,
  "selectedRangeDescription": (args) => `Wybrany zakres: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Wybrany czas: ${args.time}`,
  "startDate": `Data początkowa`,
  "timeZoneName": `strefa czasowa`,
  "weekday": `dzień tygodnia`,
  "year": `rok`
};
var $569f006fc292345f$exports = {};
$569f006fc292345f$exports = {
  "calendar": `Calendário`,
  "day": `dia`,
  "dayPeriod": `AM/PM`,
  "endDate": `Data final`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mês`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora selecionada: ${args.time}`,
  "startDate": `Data inicial`,
  "timeZoneName": `fuso horário`,
  "weekday": `dia da semana`,
  "year": `ano`
};
var $7c2494e14452f2dd$exports = {};
$7c2494e14452f2dd$exports = {
  "calendar": `Calendário`,
  "day": `dia`,
  "dayPeriod": `am/pm`,
  "endDate": `Data de Término`,
  "era": `era`,
  "hour": `hora`,
  "minute": `minuto`,
  "month": `mês`,
  "second": `segundo`,
  "selectedDateDescription": (args) => `Data selecionada: ${args.date}`,
  "selectedRangeDescription": (args) => `Intervalo selecionado: ${args.startDate} a ${args.endDate}`,
  "selectedTimeDescription": (args) => `Hora selecionada: ${args.time}`,
  "startDate": `Data de Início`,
  "timeZoneName": `fuso horário`,
  "weekday": `dia da semana`,
  "year": `ano`
};
var $eb82ef981b5592bf$exports = {};
$eb82ef981b5592bf$exports = {
  "calendar": `Calendar`,
  "day": `zi`,
  "dayPeriod": `a.m/p.m.`,
  "endDate": `Dată final`,
  "era": `eră`,
  "hour": `oră`,
  "minute": `minut`,
  "month": `lună`,
  "second": `secundă`,
  "selectedDateDescription": (args) => `Dată selectată: ${args.date}`,
  "selectedRangeDescription": (args) => `Interval selectat: de la ${args.startDate} până la ${args.endDate}`,
  "selectedTimeDescription": (args) => `Ora selectată: ${args.time}`,
  "startDate": `Dată început`,
  "timeZoneName": `fus orar`,
  "weekday": `ziua din săptămână`,
  "year": `an`
};
var $6efa0e119f396950$exports = {};
$6efa0e119f396950$exports = {
  "calendar": `Календарь`,
  "day": `день`,
  "dayPeriod": `AM/PM`,
  "endDate": `Дата окончания`,
  "era": `эра`,
  "hour": `час`,
  "minute": `минута`,
  "month": `месяц`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Выбранная дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Выбранный диапазон: с ${args.startDate} по ${args.endDate}`,
  "selectedTimeDescription": (args) => `Выбранное время: ${args.time}`,
  "startDate": `Дата начала`,
  "timeZoneName": `часовой пояс`,
  "weekday": `день недели`,
  "year": `год`
};
var $7f5e57085d7f5049$exports = {};
$7f5e57085d7f5049$exports = {
  "calendar": `Kalendár`,
  "day": `deň`,
  "dayPeriod": `AM/PM`,
  "endDate": `Dátum ukončenia`,
  "era": `letopočet`,
  "hour": `hodina`,
  "minute": `minúta`,
  "month": `mesiac`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Vybratý dátum: ${args.date}`,
  "selectedRangeDescription": (args) => `Vybratý rozsah: od ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vybratý čas: ${args.time}`,
  "startDate": `Dátum začatia`,
  "timeZoneName": `časové pásmo`,
  "weekday": `deň týždňa`,
  "year": `rok`
};
var $578ee7c11dcdde7a$exports = {};
$578ee7c11dcdde7a$exports = {
  "calendar": `Koledar`,
  "day": `dan`,
  "dayPeriod": `dop/pop`,
  "endDate": `Datum konca`,
  "era": `doba`,
  "hour": `ura`,
  "minute": `minuta`,
  "month": `mesec`,
  "second": `sekunda`,
  "selectedDateDescription": (args) => `Izbrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izbrano območje: ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Izbrani čas: ${args.time}`,
  "startDate": `Datum začetka`,
  "timeZoneName": `časovni pas`,
  "weekday": `dan v tednu`,
  "year": `leto`
};
var $bbc3fd6cd0bc9d50$exports = {};
$bbc3fd6cd0bc9d50$exports = {
  "calendar": `Kalendar`,
  "day": `дан`,
  "dayPeriod": `пре подне/по подне`,
  "endDate": `Datum završetka`,
  "era": `ера`,
  "hour": `сат`,
  "minute": `минут`,
  "month": `месец`,
  "second": `секунд`,
  "selectedDateDescription": (args) => `Izabrani datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Izabrani opseg: od ${args.startDate} do ${args.endDate}`,
  "selectedTimeDescription": (args) => `Izabrano vreme: ${args.time}`,
  "startDate": `Datum početka`,
  "timeZoneName": `временска зона`,
  "weekday": `дан у недељи`,
  "year": `година`
};
var $0b04512118591d2a$exports = {};
$0b04512118591d2a$exports = {
  "calendar": `Kalender`,
  "day": `dag`,
  "dayPeriod": `fm/em`,
  "endDate": `Slutdatum`,
  "era": `era`,
  "hour": `timme`,
  "minute": `minut`,
  "month": `månad`,
  "second": `sekund`,
  "selectedDateDescription": (args) => `Valt datum: ${args.date}`,
  "selectedRangeDescription": (args) => `Valt intervall: ${args.startDate} till ${args.endDate}`,
  "selectedTimeDescription": (args) => `Vald tid: ${args.time}`,
  "startDate": `Startdatum`,
  "timeZoneName": `tidszon`,
  "weekday": `veckodag`,
  "year": `år`
};
var $3a49d121fe4c9e1d$exports = {};
$3a49d121fe4c9e1d$exports = {
  "calendar": `Takvim`,
  "day": `gün`,
  "dayPeriod": `ÖÖ/ÖS`,
  "endDate": `Bitiş Tarihi`,
  "era": `çağ`,
  "hour": `saat`,
  "minute": `dakika`,
  "month": `ay`,
  "second": `saniye`,
  "selectedDateDescription": (args) => `Seçilen Tarih: ${args.date}`,
  "selectedRangeDescription": (args) => `Seçilen Aralık: ${args.startDate} - ${args.endDate}`,
  "selectedTimeDescription": (args) => `Seçilen Zaman: ${args.time}`,
  "startDate": `Başlangıç Tarihi`,
  "timeZoneName": `saat dilimi`,
  "weekday": `haftanın günü`,
  "year": `yıl`
};
var $5ba21dbb8914919d$exports = {};
$5ba21dbb8914919d$exports = {
  "calendar": `Календар`,
  "day": `день`,
  "dayPeriod": `дп/пп`,
  "endDate": `Дата завершення`,
  "era": `ера`,
  "hour": `година`,
  "minute": `хвилина`,
  "month": `місяць`,
  "second": `секунда`,
  "selectedDateDescription": (args) => `Вибрана дата: ${args.date}`,
  "selectedRangeDescription": (args) => `Вибраний діапазон: ${args.startDate} — ${args.endDate}`,
  "selectedTimeDescription": (args) => `Вибраний час: ${args.time}`,
  "startDate": `Дата початку`,
  "timeZoneName": `часовий пояс`,
  "weekday": `день тижня`,
  "year": `рік`
};
var $51078838e1b16cd7$exports = {};
$51078838e1b16cd7$exports = {
  "calendar": `日历`,
  "day": `日`,
  "dayPeriod": `上午/下午`,
  "endDate": `结束日期`,
  "era": `纪元`,
  "hour": `小时`,
  "minute": `分钟`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `选定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `选定的范围：${args.startDate} 至 ${args.endDate}`,
  "selectedTimeDescription": (args) => `选定的时间：${args.time}`,
  "startDate": `开始日期`,
  "timeZoneName": `时区`,
  "weekday": `工作日`,
  "year": `年`
};
var $33fab8219207655a$exports = {};
$33fab8219207655a$exports = {
  "calendar": `日曆`,
  "day": `日`,
  "dayPeriod": `上午/下午`,
  "endDate": `結束日期`,
  "era": `纪元`,
  "hour": `小时`,
  "minute": `分钟`,
  "month": `月`,
  "second": `秒`,
  "selectedDateDescription": (args) => `選定的日期：${args.date}`,
  "selectedRangeDescription": (args) => `選定的範圍：${args.startDate} 至 ${args.endDate}`,
  "selectedTimeDescription": (args) => `選定的時間：${args.time}`,
  "startDate": `開始日期`,
  "timeZoneName": `时区`,
  "weekday": `工作日`,
  "year": `年`
};
var $dfb4eba373ed9493$exports = {};
$dfb4eba373ed9493$exports = {
  "ar-AE": $f23889fffbde9058$exports,
  "bg-BG": $09d9badaa8903929$exports,
  "cs-CZ": $151b77e0fd711730$exports,
  "da-DK": $61915aa8630b90a2$exports,
  "de-DE": $35cea00159787840$exports,
  "el-GR": $518b4e82b9eacafd$exports,
  "en-US": $1c2b297f7e2cf474$exports,
  "es-ES": $07f628a707cf9b18$exports,
  "et-EE": $db553ffe17c7f4db$exports,
  "fi-FI": $4afcfe00cd703f83$exports,
  "fr-FR": $1d2645d18d4c5be0$exports,
  "he-IL": $64cb6a9be1f6fa48$exports,
  "hr-HR": $2a1ef2e8050be27a$exports,
  "hu-HU": $ad429dca102acd0e$exports,
  "it-IT": $6e68cb5d1cb97bd2$exports,
  "ja-JP": $a82ee9af063ee069$exports,
  "ko-KR": $67e9091dbf37d4eb$exports,
  "lt-LT": $75834f9729f653d1$exports,
  "lv-LV": $a2df2c2520b4a7f0$exports,
  "nb-NO": $aedcd71db4933ed5$exports,
  "nl-NL": $3b2df9e54353046c$exports,
  "pl-PL": $c03fe977fcfafe93$exports,
  "pt-BR": $569f006fc292345f$exports,
  "pt-PT": $7c2494e14452f2dd$exports,
  "ro-RO": $eb82ef981b5592bf$exports,
  "ru-RU": $6efa0e119f396950$exports,
  "sk-SK": $7f5e57085d7f5049$exports,
  "sl-SI": $578ee7c11dcdde7a$exports,
  "sr-SP": $bbc3fd6cd0bc9d50$exports,
  "sv-SE": $0b04512118591d2a$exports,
  "tr-TR": $3a49d121fe4c9e1d$exports,
  "uk-UA": $5ba21dbb8914919d$exports,
  "zh-CN": $51078838e1b16cd7$exports,
  "zh-TW": $33fab8219207655a$exports
};
function $9bf71ea28793e738$var$isTabbableRadio(element2) {
  if (element2.checked)
    return true;
  let radios = [];
  if (!element2.form)
    radios = [
      ...$431fbd86ca7dc216$export$b204af158042fbac$4(element2).querySelectorAll(`input[type="radio"][name="${CSS.escape(element2.name)}"]`)
    ].filter((radio2) => !radio2.form);
  else {
    var _element_form_elements, _element_form;
    let radioList = (_element_form = element2.form) === null || _element_form === void 0 ? void 0 : (_element_form_elements = _element_form.elements) === null || _element_form_elements === void 0 ? void 0 : _element_form_elements.namedItem(element2.name);
    radios = [
      ...radioList !== null && radioList !== void 0 ? radioList : []
    ];
  }
  if (!radios)
    return false;
  let anyChecked = radios.some((radio2) => radio2.checked);
  return !anyChecked;
}
function $9bf71ea28793e738$var$isElementInScope(element2, scope) {
  if (!element2)
    return false;
  if (!scope)
    return false;
  return scope.some((node2) => node2.contains(element2));
}
function $9bf71ea28793e738$var$focusElement(element2, scroll = false) {
  if (element2 != null && !scroll)
    try {
      (0, $3ad3f6e1647bc98d$export$80f3e147d781571c$2)(element2);
    } catch {
    }
  else if (element2 != null)
    try {
      element2.focus();
    } catch {
    }
}
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, opts2, scope) {
  let filter3 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed$3;
  let rootElement = (root2 === null || root2 === void 0 ? void 0 : root2.nodeType) === Node.ELEMENT_NODE ? root2 : null;
  let doc = $431fbd86ca7dc216$export$b204af158042fbac$4(rootElement);
  let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root2 || doc, NodeFilter.SHOW_ELEMENT, {
    acceptNode(node2) {
      var _opts_from;
      if (opts2 === null || opts2 === void 0 ? void 0 : (_opts_from = opts2.from) === null || _opts_from === void 0 ? void 0 : _opts_from.contains(node2))
        return NodeFilter.FILTER_REJECT;
      if ((opts2 === null || opts2 === void 0 ? void 0 : opts2.tabbable) && node2.tagName === "INPUT" && node2.getAttribute("type") === "radio") {
        if (!$9bf71ea28793e738$var$isTabbableRadio(node2))
          return NodeFilter.FILTER_REJECT;
        if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node2.name)
          return NodeFilter.FILTER_REJECT;
      }
      if (filter3(node2) && (!scope || $9bf71ea28793e738$var$isElementInScope(node2, scope)) && (!(opts2 === null || opts2 === void 0 ? void 0 : opts2.accept) || opts2.accept(node2)))
        return NodeFilter.FILTER_ACCEPT;
      return NodeFilter.FILTER_SKIP;
    }
  });
  if (opts2 === null || opts2 === void 0 ? void 0 : opts2.from)
    walker.currentNode = opts2.from;
  return walker;
}
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions2 = {}) {
  return {
    focusNext(opts2 = {}) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { from: from2, tabbable = defaultOptions2.tabbable, wrap: wrap2 = defaultOptions2.wrap, accept = defaultOptions2.accept } = opts2;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(root2));
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      if (root2.contains(node2))
        walker.currentNode = node2;
      let nextNode = walker.nextNode();
      if (!nextNode && wrap2) {
        walker.currentNode = root2;
        nextNode = walker.nextNode();
      }
      if (nextNode)
        $9bf71ea28793e738$var$focusElement(nextNode, true);
      return nextNode;
    },
    focusPrevious(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { from: from2, tabbable = defaultOptions2.tabbable, wrap: wrap2 = defaultOptions2.wrap, accept = defaultOptions2.accept } = opts2;
      let node2 = from2 || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac$4(root2));
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      if (root2.contains(node2))
        walker.currentNode = node2;
      else {
        let next2 = $9bf71ea28793e738$var$last(walker);
        if (next2)
          $9bf71ea28793e738$var$focusElement(next2, true);
        return next2 !== null && next2 !== void 0 ? next2 : null;
      }
      let previousNode = walker.previousNode();
      if (!previousNode && wrap2) {
        walker.currentNode = root2;
        let lastNode = $9bf71ea28793e738$var$last(walker);
        if (!lastNode)
          return null;
        previousNode = lastNode;
      }
      if (previousNode)
        $9bf71ea28793e738$var$focusElement(previousNode, true);
      return previousNode !== null && previousNode !== void 0 ? previousNode : null;
    },
    focusFirst(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { tabbable = defaultOptions2.tabbable, accept = defaultOptions2.accept } = opts2;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      let nextNode = walker.nextNode();
      if (nextNode)
        $9bf71ea28793e738$var$focusElement(nextNode, true);
      return nextNode;
    },
    focusLast(opts2 = defaultOptions2) {
      let root2 = ref.current;
      if (!root2)
        return null;
      let { tabbable = defaultOptions2.tabbable, accept = defaultOptions2.accept } = opts2;
      let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root2, {
        tabbable,
        accept
      });
      let next2 = $9bf71ea28793e738$var$last(walker);
      if (next2)
        $9bf71ea28793e738$var$focusElement(next2, true);
      return next2 !== null && next2 !== void 0 ? next2 : null;
    }
  };
}
function $9bf71ea28793e738$var$last(walker) {
  let next2 = void 0;
  let last;
  do {
    last = walker.lastChild();
    if (last)
      next2 = last;
  } while (last);
  return next2;
}
class $9bf71ea28793e738$var$Tree8 {
  get size() {
    return this.fastMap.size;
  }
  getTreeNode(data) {
    return this.fastMap.get(data);
  }
  addTreeNode(scopeRef, parent, nodeToRestore) {
    let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
    if (!parentNode)
      return;
    let node2 = new $9bf71ea28793e738$var$TreeNode8({
      scopeRef
    });
    parentNode.addChild(node2);
    node2.parent = parentNode;
    this.fastMap.set(scopeRef, node2);
    if (nodeToRestore)
      node2.nodeToRestore = nodeToRestore;
  }
  addNode(node2) {
    this.fastMap.set(node2.scopeRef, node2);
  }
  removeTreeNode(scopeRef) {
    if (scopeRef === null)
      return;
    let node2 = this.fastMap.get(scopeRef);
    if (!node2)
      return;
    let parentNode = node2.parent;
    for (let current of this.traverse())
      if (current !== node2 && node2.nodeToRestore && current.nodeToRestore && node2.scopeRef && node2.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node2.scopeRef.current))
        current.nodeToRestore = node2.nodeToRestore;
    let children = node2.children;
    if (parentNode) {
      parentNode.removeChild(node2);
      if (children.size > 0)
        children.forEach((child) => parentNode && parentNode.addChild(child));
    }
    this.fastMap.delete(node2.scopeRef);
  }
  // Pre Order Depth First
  *traverse(node2 = this.root) {
    if (node2.scopeRef != null)
      yield node2;
    if (node2.children.size > 0)
      for (let child of node2.children)
        yield* this.traverse(child);
  }
  clone() {
    var _node_parent;
    let newTree = new $9bf71ea28793e738$var$Tree8();
    var _node_parent_scopeRef;
    for (let node2 of this.traverse())
      newTree.addTreeNode(node2.scopeRef, (_node_parent_scopeRef = (_node_parent = node2.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node2.nodeToRestore);
    return newTree;
  }
  constructor() {
    this.fastMap = /* @__PURE__ */ new Map();
    this.root = new $9bf71ea28793e738$var$TreeNode8({
      scopeRef: null
    });
    this.fastMap.set(null, this.root);
  }
}
class $9bf71ea28793e738$var$TreeNode8 {
  addChild(node2) {
    this.children.add(node2);
    node2.parent = this;
  }
  removeChild(node2) {
    this.children.delete(node2);
    node2.parent = void 0;
  }
  constructor(props) {
    this.children = /* @__PURE__ */ new Set();
    this.contain = false;
    this.scopeRef = props.scopeRef;
  }
}
new $9bf71ea28793e738$var$Tree8();
function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
  let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$export$c5251b9e124bf29(ref), [
    ref
  ]);
  let onKeyDown = (e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (e2.altKey && (e2.key === "ArrowDown" || e2.key === "ArrowUp") && "setOpen" in state) {
      e2.preventDefault();
      e2.stopPropagation();
      state.setOpen(true);
    }
    if (disableArrowNavigation)
      return;
    switch (e2.key) {
      case "ArrowLeft":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl") {
          if (ref.current) {
            let target = e2.target;
            let prev2 = $3dfb0f96be0d6a08$var$findNextSegment(ref.current, target.getBoundingClientRect().left, -1);
            if (prev2)
              prev2.focus();
          }
        } else
          focusManager.focusPrevious();
        break;
      case "ArrowRight":
        e2.preventDefault();
        e2.stopPropagation();
        if (direction === "rtl") {
          if (ref.current) {
            let target = e2.target;
            let next2 = $3dfb0f96be0d6a08$var$findNextSegment(ref.current, target.getBoundingClientRect().left, 1);
            if (next2)
              next2.focus();
          }
        } else
          focusManager.focusNext();
        break;
    }
  };
  let focusLast = () => {
    var _window_event;
    if (!ref.current)
      return;
    let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target;
    let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ref.current, {
      tabbable: true
    });
    if (target) {
      walker.currentNode = target;
      target = walker.previousNode();
    }
    if (!target) {
      let last;
      do {
        last = walker.lastChild();
        if (last)
          target = last;
      } while (last);
    }
    while (target === null || target === void 0 ? void 0 : target.hasAttribute("data-placeholder")) {
      let prev2 = walker.previousNode();
      if (prev2 && prev2.hasAttribute("data-placeholder"))
        target = prev2;
      else
        break;
    }
    if (target)
      target.focus();
  };
  let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$b({
    preventFocusOnPress: true,
    allowTextSelectionOnPress: true,
    onPressStart(e2) {
      if (e2.pointerType === "mouse")
        focusLast();
    },
    onPress(e2) {
      if (e2.pointerType === "touch" || e2.pointerType === "pen")
        focusLast();
    }
  });
  return $3ef42575df84b30b$export$9d1611c77c2fe928$9(pressProps, {
    onKeyDown
  });
}
function $3dfb0f96be0d6a08$var$findNextSegment(group, fromX, direction) {
  let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(group, {
    tabbable: true
  });
  let node2 = walker.nextNode();
  let closest2 = null;
  let closestDistance = Infinity;
  while (node2) {
    let x2 = node2.getBoundingClientRect().left;
    let distance2 = x2 - fromX;
    let absoluteDistance = Math.abs(distance2);
    if (Math.sign(distance2) === direction && absoluteDistance < closestDistance) {
      closest2 = node2;
      closestDistance = absoluteDistance;
    }
    node2 = walker.nextNode();
  }
  return closest2;
}
function $parcel$interopDefault$7(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = /* @__PURE__ */ new WeakMap();
const $16f0b7bb276bc17e$export$300019f83c56d282 = "__role_" + Date.now();
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = "__focusManager_" + Date.now();
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
  var _state_value;
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let valueOnFocus = reactExports.useRef(null);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    ...props,
    onFocusWithin(e2) {
      var _props_onFocus;
      valueOnFocus.current = state.value;
      (_props_onFocus = props.onFocus) === null || _props_onFocus === void 0 ? void 0 : _props_onFocus.call(props, e2);
    },
    onBlurWithin: (e2) => {
      var _props_onBlur;
      state.confirmPlaceholder();
      if (state.value !== valueOnFocus.current)
        state.commitValidation();
      (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
    },
    onFocusWithinChange: props.onFocusChange
  });
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$7($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  let message = state.maxGranularity === "hour" ? "selectedTimeDescription" : "selectedDateDescription";
  let field = state.maxGranularity === "hour" ? "time" : "date";
  let description = state.value ? stringFormatter.format(message, {
    [field]: state.formatValue({
      month: "long"
    })
  }) : "";
  let descProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
  let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation" ? fieldProps["aria-describedby"] : [
    descProps["aria-describedby"],
    fieldProps["aria-describedby"]
  ].filter(Boolean).join(" ") || void 0;
  let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
  let focusManager = reactExports.useMemo(() => propsFocusManager || $9bf71ea28793e738$export$c5251b9e124bf29(ref), [
    propsFocusManager,
    ref
  ]);
  let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation");
  $16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
    ariaLabel: props["aria-label"],
    ariaLabelledBy: [
      labelProps.id,
      props["aria-labelledby"]
    ].filter(Boolean).join(" ") || void 0,
    ariaDescribedBy: describedBy,
    focusManager
  });
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  let fieldDOMProps;
  if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === "presentation")
    fieldDOMProps = {
      role: "presentation"
    };
  else
    fieldDOMProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(fieldProps, {
      role: "group",
      "aria-disabled": props.isDisabled || void 0,
      "aria-describedby": describedBy
    });
  reactExports.useEffect(() => {
    if (autoFocusRef.current)
      focusManager.focusFirst();
    autoFocusRef.current = false;
  }, [
    focusManager
  ]);
  $99facab73266f662$export$5add1d006293d136(props.inputRef, state.value, state.setValue);
  $e93e671b31057976$export$b8473d3665f3a75a$1({
    ...props,
    focus() {
      focusManager.focusFirst();
    }
  }, state, props.inputRef);
  let inputProps = {
    type: "hidden",
    name: props.name,
    value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || "",
    disabled: props.isDisabled
  };
  if (props.validationBehavior === "native") {
    inputProps.type = "text";
    inputProps.hidden = true;
    inputProps.required = props.isRequired;
    inputProps.onChange = () => {
    };
  }
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  return {
    labelProps: {
      ...labelProps,
      onClick: () => {
        focusManager.focusFirst();
      }
    },
    fieldProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, fieldDOMProps, groupProps, focusWithinProps, {
      onKeyDown(e2) {
        if (props.onKeyDown)
          props.onKeyDown(e2);
      },
      onKeyUp(e2) {
        if (props.onKeyUp)
          props.onKeyUp(e2);
      },
      style: {
        unicodeBidi: "isolate"
      }
    }),
    inputProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
  var _state_timeValue;
  let res = $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
  res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || "";
  return res;
}
function $parcel$interopDefault$6(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10$1($parcel$interopDefault$6($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  return reactExports.useMemo(() => {
    try {
      return new Intl.DisplayNames(locale2, {
        type: "dateTimeField"
      });
    } catch {
      return new $3aeceb3a64eb8358$var$DisplayNamesPolyfill(locale2, dictionary);
    }
  }, [
    locale2,
    dictionary
  ]);
}
class $3aeceb3a64eb8358$var$DisplayNamesPolyfill {
  of(field) {
    return this.dictionary.getStringForLocale(field, this.locale);
  }
  constructor(locale2, dictionary) {
    this.locale = locale2;
    this.dictionary = dictionary;
  }
}
var $ed6aae4e5f766f1e$exports = {};
$ed6aae4e5f766f1e$exports = {
  "Empty": `فارغ`
};
var $38854e2b175151fa$exports = {};
$38854e2b175151fa$exports = {
  "Empty": `Изпразни`
};
var $15b25ab20f3945b2$exports = {};
$15b25ab20f3945b2$exports = {
  "Empty": `Prázdné`
};
var $692a4298b6b649a2$exports = {};
$692a4298b6b649a2$exports = {
  "Empty": `Tom`
};
var $1c6e1539193f1243$exports = {};
$1c6e1539193f1243$exports = {
  "Empty": `Leer`
};
var $1e8678632c464b6d$exports = {};
$1e8678632c464b6d$exports = {
  "Empty": `Άδειο`
};
var $4adc85d9bf5b9eed$exports = {};
$4adc85d9bf5b9eed$exports = {
  "Empty": `Empty`
};
var $41c4b2bb61dafbca$exports = {};
$41c4b2bb61dafbca$exports = {
  "Empty": `Vacío`
};
var $405f8b24f5dd2a60$exports = {};
$405f8b24f5dd2a60$exports = {
  "Empty": `Tühjenda`
};
var $7efe3ed02b9b9dd4$exports = {};
$7efe3ed02b9b9dd4$exports = {
  "Empty": `Tyhjä`
};
var $99fc4c101d92daf3$exports = {};
$99fc4c101d92daf3$exports = {
  "Empty": `Vide`
};
var $f9e155e6e8cacaa2$exports = {};
$f9e155e6e8cacaa2$exports = {
  "Empty": `ריק`
};
var $c31b5e8e9a249fd5$exports = {};
$c31b5e8e9a249fd5$exports = {
  "Empty": `Prazno`
};
var $9c5435bc17499bd9$exports = {};
$9c5435bc17499bd9$exports = {
  "Empty": `Üres`
};
var $6d1fc8e84d8165e1$exports = {};
$6d1fc8e84d8165e1$exports = {
  "Empty": `Vuoto`
};
var $46ea6b3641b83e71$exports = {};
$46ea6b3641b83e71$exports = {
  "Empty": `空`
};
var $0e3cc9a288289dc5$exports = {};
$0e3cc9a288289dc5$exports = {
  "Empty": `비어 있음`
};
var $4ff2bb25c0089ffb$exports = {};
$4ff2bb25c0089ffb$exports = {
  "Empty": `Tuščias`
};
var $6cf33cd4c010a2fb$exports = {};
$6cf33cd4c010a2fb$exports = {
  "Empty": `Tukšs`
};
var $5a9f8486f8b8837e$exports = {};
$5a9f8486f8b8837e$exports = {
  "Empty": `Tom`
};
var $583f94d807f6ecea$exports = {};
$583f94d807f6ecea$exports = {
  "Empty": `Leeg`
};
var $cc4dcfeea2b4050d$exports = {};
$cc4dcfeea2b4050d$exports = {
  "Empty": `Pusty`
};
var $68ac2954d56e12b4$exports = {};
$68ac2954d56e12b4$exports = {
  "Empty": `Vazio`
};
var $fdb0616f309780b0$exports = {};
$fdb0616f309780b0$exports = {
  "Empty": `Vazio`
};
var $fe1eccf4ee1d6f52$exports = {};
$fe1eccf4ee1d6f52$exports = {
  "Empty": `Gol`
};
var $a38b6c4e18725976$exports = {};
$a38b6c4e18725976$exports = {
  "Empty": `Не заполнено`
};
var $6c14ae2b766b652c$exports = {};
$6c14ae2b766b652c$exports = {
  "Empty": `Prázdne`
};
var $8f1c9692e16dc5eb$exports = {};
$8f1c9692e16dc5eb$exports = {
  "Empty": `Prazen`
};
var $d2aa7abea627cafa$exports = {};
$d2aa7abea627cafa$exports = {
  "Empty": `Prazno`
};
var $676b82e4b56408e6$exports = {};
$676b82e4b56408e6$exports = {
  "Empty": `Tomt`
};
var $14c9042552d7ce08$exports = {};
$14c9042552d7ce08$exports = {
  "Empty": `Boş`
};
var $393254ebcb66c9f5$exports = {};
$393254ebcb66c9f5$exports = {
  "Empty": `Пусто`
};
var $d49d621f310cf6ce$exports = {};
$d49d621f310cf6ce$exports = {
  "Empty": `空`
};
var $94b60c866ca5dfe6$exports = {};
$94b60c866ca5dfe6$exports = {
  "Empty": `空白`
};
var $a99895ee3dc79e61$exports = {};
$a99895ee3dc79e61$exports = {
  "ar-AE": $ed6aae4e5f766f1e$exports,
  "bg-BG": $38854e2b175151fa$exports,
  "cs-CZ": $15b25ab20f3945b2$exports,
  "da-DK": $692a4298b6b649a2$exports,
  "de-DE": $1c6e1539193f1243$exports,
  "el-GR": $1e8678632c464b6d$exports,
  "en-US": $4adc85d9bf5b9eed$exports,
  "es-ES": $41c4b2bb61dafbca$exports,
  "et-EE": $405f8b24f5dd2a60$exports,
  "fi-FI": $7efe3ed02b9b9dd4$exports,
  "fr-FR": $99fc4c101d92daf3$exports,
  "he-IL": $f9e155e6e8cacaa2$exports,
  "hr-HR": $c31b5e8e9a249fd5$exports,
  "hu-HU": $9c5435bc17499bd9$exports,
  "it-IT": $6d1fc8e84d8165e1$exports,
  "ja-JP": $46ea6b3641b83e71$exports,
  "ko-KR": $0e3cc9a288289dc5$exports,
  "lt-LT": $4ff2bb25c0089ffb$exports,
  "lv-LV": $6cf33cd4c010a2fb$exports,
  "nb-NO": $5a9f8486f8b8837e$exports,
  "nl-NL": $583f94d807f6ecea$exports,
  "pl-PL": $cc4dcfeea2b4050d$exports,
  "pt-BR": $68ac2954d56e12b4$exports,
  "pt-PT": $fdb0616f309780b0$exports,
  "ro-RO": $fe1eccf4ee1d6f52$exports,
  "ru-RU": $a38b6c4e18725976$exports,
  "sk-SK": $6c14ae2b766b652c$exports,
  "sl-SI": $8f1c9692e16dc5eb$exports,
  "sr-SP": $d2aa7abea627cafa$exports,
  "sv-SE": $676b82e4b56408e6$exports,
  "tr-TR": $14c9042552d7ce08$exports,
  "uk-UA": $393254ebcb66c9f5$exports,
  "zh-CN": $d49d621f310cf6ce$exports,
  "zh-TW": $94b60c866ca5dfe6$exports
};
function $parcel$interopDefault$5(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $d2e8511e6f209edf$export$e908e06f4b8e3402(props) {
  const _async = reactExports.useRef(void 0);
  let { value: value2, textValue, minValue, maxValue, isDisabled, isReadOnly, isRequired, onIncrement, onIncrementPage, onDecrement, onDecrementPage, onDecrementToMin, onIncrementToMax } = props;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$5($a99895ee3dc79e61$exports), "@react-aria/spinbutton");
  const clearAsync = () => clearTimeout(_async.current);
  reactExports.useEffect(() => {
    return () => clearAsync();
  }, []);
  let onKeyDown = (e2) => {
    if (e2.ctrlKey || e2.metaKey || e2.shiftKey || e2.altKey || isReadOnly || e2.nativeEvent.isComposing)
      return;
    switch (e2.key) {
      case "PageUp":
        if (onIncrementPage) {
          e2.preventDefault();
          onIncrementPage === null || onIncrementPage === void 0 ? void 0 : onIncrementPage();
          break;
        }
      case "ArrowUp":
      case "Up":
        if (onIncrement) {
          e2.preventDefault();
          onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
        }
        break;
      case "PageDown":
        if (onDecrementPage) {
          e2.preventDefault();
          onDecrementPage === null || onDecrementPage === void 0 ? void 0 : onDecrementPage();
          break;
        }
      case "ArrowDown":
      case "Down":
        if (onDecrement) {
          e2.preventDefault();
          onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
        }
        break;
      case "Home":
        if (onDecrementToMin) {
          e2.preventDefault();
          onDecrementToMin === null || onDecrementToMin === void 0 ? void 0 : onDecrementToMin();
        }
        break;
      case "End":
        if (onIncrementToMax) {
          e2.preventDefault();
          onIncrementToMax === null || onIncrementToMax === void 0 ? void 0 : onIncrementToMax();
        }
        break;
    }
  };
  let isFocused = reactExports.useRef(false);
  let onFocus = () => {
    isFocused.current = true;
  };
  let onBlur = () => {
    isFocused.current = false;
  };
  let ariaTextValue = textValue === "" ? stringFormatter.format("Empty") : (textValue || `${value2}`).replace("-", "−");
  reactExports.useEffect(() => {
    if (isFocused.current) {
      $319e236875307eab$export$d10ae4f68404609a("assertive");
      $319e236875307eab$export$a9b970dcc4ae71a9(ariaTextValue, "assertive");
    }
  }, [
    ariaTextValue
  ]);
  const onIncrementPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((initialStepDelay) => {
    clearAsync();
    onIncrement === null || onIncrement === void 0 ? void 0 : onIncrement();
    _async.current = window.setTimeout(() => {
      if (maxValue === void 0 || isNaN(maxValue) || value2 === void 0 || isNaN(value2) || value2 < maxValue)
        onIncrementPressStart(60);
    }, initialStepDelay);
  });
  const onDecrementPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((initialStepDelay) => {
    clearAsync();
    onDecrement === null || onDecrement === void 0 ? void 0 : onDecrement();
    _async.current = window.setTimeout(() => {
      if (minValue === void 0 || isNaN(minValue) || value2 === void 0 || isNaN(value2) || value2 > minValue)
        onDecrementPressStart(60);
    }, initialStepDelay);
  });
  let cancelContextMenu = (e2) => {
    e2.preventDefault();
  };
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  return {
    spinButtonProps: {
      role: "spinbutton",
      "aria-valuenow": value2 !== void 0 && !isNaN(value2) ? value2 : void 0,
      "aria-valuetext": ariaTextValue,
      "aria-valuemin": minValue,
      "aria-valuemax": maxValue,
      "aria-disabled": isDisabled || void 0,
      "aria-readonly": isReadOnly || void 0,
      "aria-required": isRequired || void 0,
      onKeyDown,
      onFocus,
      onBlur
    },
    incrementButtonProps: {
      onPressStart: () => {
        onIncrementPressStart(400);
        addGlobalListener(window, "contextmenu", cancelContextMenu);
      },
      onPressEnd: () => {
        clearAsync();
        removeAllGlobalListeners();
      },
      onFocus,
      onBlur
    },
    decrementButtonProps: {
      onPressStart: () => {
        onDecrementPressStart(400);
        addGlobalListener(window, "contextmenu", cancelContextMenu);
      },
      onPressEnd: () => {
        clearAsync();
        removeAllGlobalListeners();
      },
      onFocus,
      onBlur
    }
  };
}
function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
  let enteredKeys = reactExports.useRef("");
  let { locale: locale2, direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let displayNames = $3aeceb3a64eb8358$export$d42c60378c8168f8();
  let { ariaLabel, ariaLabelledBy, ariaDescribedBy, focusManager } = $16f0b7bb276bc17e$export$653eddfc964b0f8a.get(state);
  let textValue = segment.isPlaceholder ? "" : segment.text;
  let options = reactExports.useMemo(() => state.dateFormatter.resolvedOptions(), [
    state.dateFormatter
  ]);
  let monthDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    month: "long",
    timeZone: options.timeZone
  });
  let hourDateFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    hour: "numeric",
    hour12: options.hour12,
    timeZone: options.timeZone
  });
  if (segment.type === "month" && !segment.isPlaceholder) {
    let monthTextValue = monthDateFormatter.format(state.dateValue);
    textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
  } else if (segment.type === "hour" && !segment.isPlaceholder)
    textValue = hourDateFormatter.format(state.dateValue);
  let { spinButtonProps } = $d2e8511e6f209edf$export$e908e06f4b8e3402({
    // The ARIA spec says aria-valuenow is optional if there's no value, but aXe seems to require it.
    // This doesn't seem to have any negative effects with real AT since we also use aria-valuetext.
    // https://github.com/dequelabs/axe-core/issues/3505
    value: segment.value,
    textValue,
    minValue: segment.minValue,
    maxValue: segment.maxValue,
    isDisabled: state.isDisabled,
    isReadOnly: state.isReadOnly || !segment.isEditable,
    isRequired: state.isRequired,
    onIncrement: () => {
      enteredKeys.current = "";
      state.increment(segment.type);
    },
    onDecrement: () => {
      enteredKeys.current = "";
      state.decrement(segment.type);
    },
    onIncrementPage: () => {
      enteredKeys.current = "";
      state.incrementPage(segment.type);
    },
    onDecrementPage: () => {
      enteredKeys.current = "";
      state.decrementPage(segment.type);
    },
    onIncrementToMax: () => {
      enteredKeys.current = "";
      if (segment.maxValue !== void 0)
        state.setSegment(segment.type, segment.maxValue);
    },
    onDecrementToMin: () => {
      enteredKeys.current = "";
      if (segment.minValue !== void 0)
        state.setSegment(segment.type, segment.minValue);
    }
  });
  let parser = reactExports.useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale2, {
    maximumFractionDigits: 0
  }), [
    locale2
  ]);
  let backspace = () => {
    if (segment.text === segment.placeholder)
      focusManager.focusPrevious();
    if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
      let newValue = segment.text.slice(0, -1);
      let parsed = parser.parse(newValue);
      newValue = parsed === 0 ? "" : newValue;
      if (newValue.length === 0 || parsed === 0)
        state.clearSegment(segment.type);
      else
        state.setSegment(segment.type, parsed);
      enteredKeys.current = newValue;
    } else if (segment.type === "dayPeriod")
      state.clearSegment(segment.type);
  };
  let onKeyDown = (e2) => {
    if (e2.key === "a" && ($c87311424ea30a05$export$9ac100e40613ea10$6() ? e2.metaKey : e2.ctrlKey))
      e2.preventDefault();
    if (e2.ctrlKey || e2.metaKey || e2.shiftKey || e2.altKey)
      return;
    switch (e2.key) {
      case "Backspace":
      case "Delete":
        e2.preventDefault();
        e2.stopPropagation();
        backspace();
        break;
    }
  };
  let { startsWith } = $bb77f239b46e8c72$export$3274cf84b703fff$1({
    sensitivity: "base"
  });
  let amPmFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    hour: "numeric",
    hour12: true
  });
  let am = reactExports.useMemo(() => {
    let date4 = /* @__PURE__ */ new Date();
    date4.setHours(0);
    return amPmFormatter.formatToParts(date4).find((part) => part.type === "dayPeriod").value;
  }, [
    amPmFormatter
  ]);
  let pm = reactExports.useMemo(() => {
    let date4 = /* @__PURE__ */ new Date();
    date4.setHours(12);
    return amPmFormatter.formatToParts(date4).find((part) => part.type === "dayPeriod").value;
  }, [
    amPmFormatter
  ]);
  let eraFormatter = $896ba0a80a8f4d36$export$85fd5fdf27bacc79$1({
    year: "numeric",
    era: "narrow",
    timeZone: "UTC"
  });
  let eras = reactExports.useMemo(() => {
    if (segment.type !== "era")
      return [];
    let date4 = $11d87f3f76e88657$export$b4a036af3fc0b032(new $35ea8db9cb2ccb90$export$99faa760c7908e4f(1, 1, 1), state.calendar);
    let eras2 = state.calendar.getEras().map((era) => {
      let eraDate = date4.set({
        year: 1,
        month: 1,
        day: 1,
        era
      }).toDate("UTC");
      let parts = eraFormatter.formatToParts(eraDate);
      let formatted = parts.find((p2) => p2.type === "era").value;
      return {
        era,
        formatted
      };
    });
    let prefixLength = $32489daedd52963e$var$commonPrefixLength(eras2.map((era) => era.formatted));
    if (prefixLength)
      for (let era of eras2)
        era.formatted = era.formatted.slice(prefixLength);
    return eras2;
  }, [
    eraFormatter,
    state.calendar,
    segment.type
  ]);
  let onInput = (key) => {
    if (state.isDisabled || state.isReadOnly)
      return;
    let newValue = enteredKeys.current + key;
    switch (segment.type) {
      case "dayPeriod":
        if (startsWith(am, key))
          state.setSegment("dayPeriod", 0);
        else if (startsWith(pm, key))
          state.setSegment("dayPeriod", 12);
        else
          break;
        focusManager.focusNext();
        break;
      case "era": {
        let matched = eras.find((e2) => startsWith(e2.formatted, key));
        if (matched) {
          state.setSegment("era", matched.era);
          focusManager.focusNext();
        }
        break;
      }
      case "day":
      case "hour":
      case "minute":
      case "second":
      case "month":
      case "year": {
        if (!parser.isValidPartialNumber(newValue))
          return;
        let numberValue = parser.parse(newValue);
        let segmentValue = numberValue;
        let allowsZero = segment.minValue === 0;
        if (segment.type === "hour" && state.dateFormatter.resolvedOptions().hour12) {
          switch (state.dateFormatter.resolvedOptions().hourCycle) {
            case "h11":
              if (numberValue > 11)
                segmentValue = parser.parse(key);
              break;
            case "h12":
              allowsZero = false;
              if (numberValue > 12)
                segmentValue = parser.parse(key);
              break;
          }
          if (segment.value !== void 0 && segment.value >= 12 && numberValue > 1)
            numberValue += 12;
        } else if (segment.maxValue !== void 0 && numberValue > segment.maxValue)
          segmentValue = parser.parse(key);
        if (isNaN(numberValue))
          return;
        let shouldSetValue = segmentValue !== 0 || allowsZero;
        if (shouldSetValue)
          state.setSegment(segment.type, segmentValue);
        if (segment.maxValue !== void 0 && (Number(numberValue + "0") > segment.maxValue || newValue.length >= String(segment.maxValue).length)) {
          enteredKeys.current = "";
          if (shouldSetValue)
            focusManager.focusNext();
        } else
          enteredKeys.current = newValue;
        break;
      }
    }
  };
  let onFocus = () => {
    enteredKeys.current = "";
    if (ref.current)
      $2f04cbc44ee30ce0$export$c826860796309d1b(ref.current, {
        containingElement: $62d8ded9296f3872$export$cfa2225e87938781(ref.current)
      });
    let selection = window.getSelection();
    selection === null || selection === void 0 ? void 0 : selection.collapse(ref.current);
  };
  let documentRef = reactExports.useRef(typeof document !== "undefined" ? document : null);
  $e9faafb641e167db$export$90fc3a17d93f704c(documentRef, "selectionchange", () => {
    var _ref_current;
    let selection = window.getSelection();
    if ((selection === null || selection === void 0 ? void 0 : selection.anchorNode) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(selection === null || selection === void 0 ? void 0 : selection.anchorNode)))
      selection.collapse(ref.current);
  });
  let compositionRef = reactExports.useRef("");
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "beforeinput", (e2) => {
    if (!ref.current)
      return;
    e2.preventDefault();
    switch (e2.inputType) {
      case "deleteContentBackward":
      case "deleteContentForward":
        if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly)
          backspace();
        break;
      case "insertCompositionText":
        compositionRef.current = ref.current.textContent;
        ref.current.textContent = ref.current.textContent;
        break;
      default:
        if (e2.data != null)
          onInput(e2.data);
        break;
    }
  });
  $e9faafb641e167db$export$90fc3a17d93f704c(ref, "input", (e2) => {
    let { inputType, data } = e2;
    switch (inputType) {
      case "insertCompositionText":
        if (ref.current)
          ref.current.textContent = compositionRef.current;
        if (data != null && (startsWith(am, data) || startsWith(pm, data)))
          onInput(data);
        break;
    }
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    let element2 = ref.current;
    return () => {
      if (document.activeElement === element2) {
        let prev2 = focusManager.focusPrevious();
        if (!prev2)
          focusManager.focusNext();
      }
    };
  }, [
    ref,
    focusManager
  ]);
  let touchPropOverrides = $c87311424ea30a05$export$fedb369cb70207f1$3() || segment.type === "timeZoneName" ? {
    role: "textbox",
    "aria-valuemax": null,
    "aria-valuemin": null,
    "aria-valuetext": null,
    "aria-valuenow": null
  } : {};
  let firstSegment = reactExports.useMemo(() => state.segments.find((s2) => s2.isEditable), [
    state.segments
  ]);
  if (segment !== firstSegment && !state.isInvalid)
    ariaDescribedBy = void 0;
  let id2 = $bdb11010cef70236$export$f680877a34711e37$2();
  let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
  let name2 = segment.type === "literal" ? "" : displayNames.of(segment.type);
  let labelProps = $313b98861ee5dd6c$export$d6875122194c7b44$1({
    "aria-label": `${name2}${ariaLabel ? `, ${ariaLabel}` : ""}${ariaLabelledBy ? ", " : ""}`,
    "aria-labelledby": ariaLabelledBy
  });
  if (segment.type === "literal")
    return {
      segmentProps: {
        "aria-hidden": true
      }
    };
  let segmentStyle = {
    caretColor: "transparent"
  };
  if (direction === "rtl") {
    segmentStyle.unicodeBidi = "embed";
    let format2 = options[segment.type];
    if (format2 === "numeric" || format2 === "2-digit")
      segmentStyle.direction = "ltr";
  }
  return {
    segmentProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(spinButtonProps, labelProps, {
      id: id2,
      ...touchPropOverrides,
      "aria-invalid": state.isInvalid ? "true" : void 0,
      "aria-describedby": ariaDescribedBy,
      "aria-readonly": state.isReadOnly || !segment.isEditable ? "true" : void 0,
      "data-placeholder": segment.isPlaceholder || void 0,
      contentEditable: isEditable,
      suppressContentEditableWarning: isEditable,
      spellCheck: isEditable ? "false" : void 0,
      autoCorrect: isEditable ? "off" : void 0,
      // Capitalization was changed in React 17...
      [parseInt(React$6.version, 10) >= 17 ? "enterKeyHint" : "enterkeyhint"]: isEditable ? "next" : void 0,
      inputMode: state.isDisabled || segment.type === "dayPeriod" || segment.type === "era" || !isEditable ? void 0 : "numeric",
      tabIndex: state.isDisabled ? void 0 : 0,
      onKeyDown,
      onFocus,
      style: segmentStyle,
      // Prevent pointer events from reaching useDatePickerGroup, and allow native browser behavior to focus the segment.
      onPointerDown(e2) {
        e2.stopPropagation();
      },
      onMouseDown(e2) {
        e2.stopPropagation();
      }
    })
  };
}
function $32489daedd52963e$var$commonPrefixLength(strings) {
  strings.sort();
  let first = strings[0];
  let last = strings[strings.length - 1];
  for (let i2 = 0; i2 < first.length; i2++) {
    if (first[i2] !== last[i2])
      return i2;
  }
  return 0;
}
function $parcel$interopDefault$4(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
  var _state_value, _state_value1, _state_dateRange;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$4($dfb4eba373ed9493$exports), "@react-aria/datepicker");
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, fieldProps, descriptionProps, errorMessageProps } = $2baaea4c71418dea$export$294aa081a6c6f55d$1({
    ...props,
    labelElementType: "span",
    isInvalid,
    errorMessage: props.errorMessage || validationErrors
  });
  let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$9();
  let range3 = state.formatValue(locale2, {
    month: "long"
  });
  let description = range3 ? stringFormatter.format("selectedRangeDescription", {
    startDate: range3.start,
    endDate: range3.end
  }) : "";
  let descProps = $ef06256079686ba0$export$f8aeda7b10753fa1(description);
  let startFieldProps = {
    "aria-label": stringFormatter.format("startDate"),
    "aria-labelledby": labelledBy
  };
  let endFieldProps = {
    "aria-label": stringFormatter.format("endDate"),
    "aria-labelledby": labelledBy
  };
  let buttonId = $bdb11010cef70236$export$f680877a34711e37$2();
  let dialogId = $bdb11010cef70236$export$f680877a34711e37$2();
  let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
  let ariaDescribedBy = [
    descProps["aria-describedby"],
    fieldProps["aria-describedby"]
  ].filter(Boolean).join(" ") || void 0;
  let focusManager = reactExports.useMemo(() => $9bf71ea28793e738$export$c5251b9e124bf29(ref, {
    // Exclude the button from the focus manager.
    accept: (element2) => element2.id !== buttonId
  }), [
    ref,
    buttonId
  ]);
  let commonFieldProps = {
    [$16f0b7bb276bc17e$export$7b3062cd49e80452]: focusManager,
    [$16f0b7bb276bc17e$export$300019f83c56d282]: "presentation",
    "aria-describedby": ariaDescribedBy,
    placeholderValue: props.placeholderValue,
    hideTimeZone: props.hideTimeZone,
    hourCycle: props.hourCycle,
    granularity: props.granularity,
    shouldForceLeadingZeros: props.shouldForceLeadingZeros,
    isDisabled: props.isDisabled,
    isReadOnly: props.isReadOnly,
    isRequired: props.isRequired,
    validationBehavior: props.validationBehavior
  };
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let isFocused = reactExports.useRef(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    ...props,
    isDisabled: state.isOpen,
    onBlurWithin: (e2) => {
      let dialog = document.getElementById(dialogId);
      if (!(dialog === null || dialog === void 0 ? void 0 : dialog.contains(e2.relatedTarget))) {
        var _props_onBlur, _props_onFocusChange;
        isFocused.current = false;
        (_props_onBlur = props.onBlur) === null || _props_onBlur === void 0 ? void 0 : _props_onBlur.call(props, e2);
        (_props_onFocusChange = props.onFocusChange) === null || _props_onFocusChange === void 0 ? void 0 : _props_onFocusChange.call(props, false);
      }
    },
    onFocusWithin: (e2) => {
      if (!isFocused.current) {
        var _props_onFocus, _props_onFocusChange;
        isFocused.current = true;
        (_props_onFocus = props.onFocus) === null || _props_onFocus === void 0 ? void 0 : _props_onFocus.call(props, e2);
        (_props_onFocusChange = props.onFocusChange) === null || _props_onFocusChange === void 0 ? void 0 : _props_onFocusChange.call(props, true);
      }
    }
  });
  let startFieldValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  let endFieldValidation = reactExports.useRef($e5be200c675c3b3a$export$dad6ae84456c676a$1);
  var _state_value_start, _state_value_end;
  return {
    groupProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
      role: "group",
      "aria-disabled": props.isDisabled || null,
      "aria-describedby": ariaDescribedBy,
      onKeyDown(e2) {
        if (state.isOpen)
          return;
        if (props.onKeyDown)
          props.onKeyDown(e2);
      },
      onKeyUp(e2) {
        if (state.isOpen)
          return;
        if (props.onKeyUp)
          props.onKeyUp(e2);
      }
    }),
    labelProps: {
      ...labelProps,
      onClick: () => {
        focusManager.focusFirst();
      }
    },
    buttonProps: {
      ...descProps,
      id: buttonId,
      "aria-haspopup": "dialog",
      "aria-label": stringFormatter.format("calendar"),
      "aria-labelledby": `${buttonId} ${labelledBy}`,
      "aria-describedby": ariaDescribedBy,
      "aria-expanded": state.isOpen,
      isDisabled: props.isDisabled || props.isReadOnly,
      onPress: () => state.setOpen(true)
    },
    dialogProps: {
      id: dialogId,
      "aria-labelledby": `${buttonId} ${labelledBy}`
    },
    startFieldProps: {
      ...startFieldProps,
      ...commonFieldProps,
      value: (_state_value_start = (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start) !== null && _state_value_start !== void 0 ? _state_value_start : null,
      onChange: (start) => state.setDateTime("start", start),
      autoFocus: props.autoFocus,
      name: props.startName,
      [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
        realtimeValidation: state.realtimeValidation,
        displayValidation: state.displayValidation,
        updateValidation(e2) {
          startFieldValidation.current = e2;
          state.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(e2, endFieldValidation.current));
        },
        resetValidation: state.resetValidation,
        commitValidation: state.commitValidation
      }
    },
    endFieldProps: {
      ...endFieldProps,
      ...commonFieldProps,
      value: (_state_value_end = (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end) !== null && _state_value_end !== void 0 ? _state_value_end : null,
      onChange: (end) => state.setDateTime("end", end),
      name: props.endName,
      [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: {
        realtimeValidation: state.realtimeValidation,
        displayValidation: state.displayValidation,
        updateValidation(e2) {
          endFieldValidation.current = e2;
          state.updateValidation($e5be200c675c3b3a$export$75ee7c75d68f5b0e(startFieldValidation.current, e2));
        },
        resetValidation: state.resetValidation,
        commitValidation: state.commitValidation
      }
    },
    descriptionProps,
    errorMessageProps,
    calendarProps: {
      autoFocus: true,
      value: ((_state_dateRange = state.dateRange) === null || _state_dateRange === void 0 ? void 0 : _state_dateRange.start) && state.dateRange.end ? state.dateRange : null,
      onChange: state.setDateRange,
      minValue: props.minValue,
      maxValue: props.maxValue,
      isDisabled: props.isDisabled,
      isReadOnly: props.isReadOnly,
      isDateUnavailable: props.isDateUnavailable,
      allowsNonContiguousRanges: props.allowsNonContiguousRanges,
      defaultFocusedValue: state.dateRange ? void 0 : props.placeholderValue,
      isInvalid: state.isInvalid,
      errorMessage: typeof props.errorMessage === "function" ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(" ")
    },
    isInvalid,
    validationErrors,
    validationDetails
  };
}
var DateInputSegment = ({
  state,
  segment,
  slots,
  classNames: classNames2,
  ...otherProps
}) => {
  const ref = reactExports.useRef(null);
  let { segmentProps } = $32489daedd52963e$export$1315d136e6f7581(segment, state, ref);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ...mergeProps$3(segmentProps, otherProps),
      ref,
      className: slots.segment({
        class: classNames2 == null ? void 0 : classNames2.segment
      }),
      "data-editable": dataAttr(segment.isEditable),
      "data-invalid": dataAttr(state.isInvalid),
      "data-placeholder": dataAttr(segment.isPlaceholder),
      "data-slot": "segment",
      "data-type": segment.type,
      style: {
        ...segmentProps.style
      },
      children: segment.text
    }
  );
};
var DateInputField = reactExports.forwardRef((props, ref) => {
  const { as: as2, state, slots, inputProps, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...otherProps, ref, children: [
    state.segments.map((segment, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      DateInputSegment,
      {
        classNames: classNames2,
        segment,
        slots,
        state
      },
      i2
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...inputProps })
  ] });
});
DateInputField.displayName = "HeroUI.DateInputField";
var DateInputGroup = forwardRef((props, ref) => {
  const {
    as: as2,
    label,
    children,
    description,
    startContent,
    endContent,
    errorMessage: errorMessageProp,
    shouldLabelBeOutside,
    isInvalid,
    groupProps,
    labelProps,
    wrapperProps,
    helperWrapperProps,
    errorMessageProps,
    descriptionProps,
    validationErrors,
    validationDetails,
    ...otherProps
  } = props;
  const Component2 = as2 || "div";
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...labelProps, children: label }) : null;
  const errorMessage = typeof errorMessageProp === "function" ? errorMessageProp({
    isInvalid,
    validationErrors,
    validationDetails
  }) : errorMessageProp || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const hasHelper = !!description || !!errorMessage;
  const helperWrapper = reactExports.useMemo(() => {
    if (!hasHelper)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...helperWrapperProps, children: isInvalid && errorMessage ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...errorMessageProps, children: errorMessage }) : description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...descriptionProps, children: description }) : null });
  }, [
    hasHelper,
    errorMessage,
    description,
    helperWrapperProps,
    errorMessageProps,
    descriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...otherProps, ref, "data-has-helper": dataAttr(hasHelper), children: [
    shouldLabelBeOutside ? labelContent : null,
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...groupProps, children: [
      !shouldLabelBeOutside ? labelContent : null,
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...wrapperProps, children: [
        startContent,
        children,
        endContent
      ] }),
      shouldLabelBeOutside ? helperWrapper : null
    ] }),
    !shouldLabelBeOutside ? helperWrapper : null
  ] });
});
DateInputGroup.displayName = "HeroUI.DateInputGroup";
const $148a7a147e38ea7f$var$RTL_SCRIPTS$2 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$2 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$2(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$2.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$2.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$2 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$2 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$2);
const $b5e257d569688ac6$var$IsSSRContext$2 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$2 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$2(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$2);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$2.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$2.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$2.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$2(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$2);
  let counter = $b5e257d569688ac6$var$useCounter$2(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$2(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$2());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$2.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$2 : $b5e257d569688ac6$var$useLegacySSRSafeId$2;
function $b5e257d569688ac6$var$getSnapshot$2() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$2() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$2(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$2() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$2, $b5e257d569688ac6$var$getSnapshot$2, $b5e257d569688ac6$var$getServerSnapshot$2);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$2 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$2] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$2(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$2 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2();
let $1e5a04cdaf7d1af8$var$listeners$2 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$2() {
  $1e5a04cdaf7d1af8$var$currentLocale$2 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$2();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$2)
    listener($1e5a04cdaf7d1af8$var$currentLocale$2);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$2() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$2();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$2);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$2.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$2);
    $1e5a04cdaf7d1af8$var$listeners$2.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$2.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$2.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$2);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$2 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$2();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$2);
  return context || defaultLocale;
}
var $b3427c06585c22a0$exports = {};
$b3427c06585c22a0$exports = {
  "rangeOverflow": (args) => `يجب أن تكون القيمة ${args.maxValue} أو قبل ذلك.`,
  "rangeReversed": `تاريخ البدء يجب أن يكون قبل تاريخ الانتهاء.`,
  "rangeUnderflow": (args) => `يجب أن تكون القيمة ${args.minValue} أو بعد ذلك.`,
  "unavailableDate": `البيانات المحددة غير متاحة.`
};
var $d282528f459122b9$exports = {};
$d282528f459122b9$exports = {
  "rangeOverflow": (args) => `Стойността трябва да е ${args.maxValue} или по-ранна.`,
  "rangeReversed": `Началната дата трябва да е преди крайната.`,
  "rangeUnderflow": (args) => `Стойността трябва да е ${args.minValue} или по-късно.`,
  "unavailableDate": `Избраната дата не е налична.`
};
var $2d5eecd634a9ca45$exports = {};
$2d5eecd634a9ca45$exports = {
  "rangeOverflow": (args) => `Hodnota musí být ${args.maxValue} nebo dřívější.`,
  "rangeReversed": `Datum zahájení musí předcházet datu ukončení.`,
  "rangeUnderflow": (args) => `Hodnota musí být ${args.minValue} nebo pozdější.`,
  "unavailableDate": `Vybrané datum není k dispozici.`
};
var $c8e2288226c24a67$exports = {};
$c8e2288226c24a67$exports = {
  "rangeOverflow": (args) => `Værdien skal være ${args.maxValue} eller tidligere.`,
  "rangeReversed": `Startdatoen skal være før slutdatoen.`,
  "rangeUnderflow": (args) => `Værdien skal være ${args.minValue} eller nyere.`,
  "unavailableDate": `Den valgte dato er ikke tilgængelig.`
};
var $6f5745e389c346d7$exports = {};
$6f5745e389c346d7$exports = {
  "rangeOverflow": (args) => `Der Wert muss ${args.maxValue} oder früher sein.`,
  "rangeReversed": `Das Anfangsdatum muss vor dem Enddatum liegen.`,
  "rangeUnderflow": (args) => `Der Wert muss ${args.minValue} oder später sein.`,
  "unavailableDate": `Das ausgewählte Datum ist nicht verfügbar.`
};
var $8c882ccf4300d1da$exports = {};
$8c882ccf4300d1da$exports = {
  "rangeOverflow": (args) => `Η τιμή πρέπει να είναι ${args.maxValue} ή παλαιότερη.`,
  "rangeReversed": `Η ημερομηνία έναρξης πρέπει να είναι πριν από την ημερομηνία λήξης.`,
  "rangeUnderflow": (args) => `Η τιμή πρέπει να είναι ${args.minValue} ή μεταγενέστερη.`,
  "unavailableDate": `Η επιλεγμένη ημερομηνία δεν είναι διαθέσιμη.`
};
var $22195056771860be$exports = {};
$22195056771860be$exports = {
  "rangeUnderflow": (args) => `Value must be ${args.minValue} or later.`,
  "rangeOverflow": (args) => `Value must be ${args.maxValue} or earlier.`,
  "rangeReversed": `Start date must be before end date.`,
  "unavailableDate": `Selected date unavailable.`
};
var $cedfa43b4e2a5906$exports = {};
$cedfa43b4e2a5906$exports = {
  "rangeOverflow": (args) => `El valor debe ser ${args.maxValue} o anterior.`,
  "rangeReversed": `La fecha de inicio debe ser anterior a la fecha de finalización.`,
  "rangeUnderflow": (args) => `El valor debe ser ${args.minValue} o posterior.`,
  "unavailableDate": `Fecha seleccionada no disponible.`
};
var $eeeaa8daee3601c7$exports = {};
$eeeaa8daee3601c7$exports = {
  "rangeOverflow": (args) => `Väärtus peab olema ${args.maxValue} või varasem.`,
  "rangeReversed": `Alguskuupäev peab olema enne lõppkuupäeva.`,
  "rangeUnderflow": (args) => `Väärtus peab olema ${args.minValue} või hilisem.`,
  "unavailableDate": `Valitud kuupäev pole saadaval.`
};
var $35e0614a49b3bb40$exports = {};
$35e0614a49b3bb40$exports = {
  "rangeOverflow": (args) => `Arvon on oltava ${args.maxValue} tai sitä aikaisempi.`,
  "rangeReversed": `Aloituspäivän on oltava ennen lopetuspäivää.`,
  "rangeUnderflow": (args) => `Arvon on oltava ${args.minValue} tai sitä myöhäisempi.`,
  "unavailableDate": `Valittu päivämäärä ei ole käytettävissä.`
};
var $929bc63f7705a78f$exports = {};
$929bc63f7705a78f$exports = {
  "rangeOverflow": (args) => `La valeur doit être ${args.maxValue} ou antérieure.`,
  "rangeReversed": `La date de début doit être antérieure à la date de fin.`,
  "rangeUnderflow": (args) => `La valeur doit être ${args.minValue} ou ultérieure.`,
  "unavailableDate": `La date sélectionnée n’est pas disponible.`
};
var $9a28d073b034d183$exports = {};
$9a28d073b034d183$exports = {
  "rangeOverflow": (args) => `הערך חייב להיות ${args.maxValue} או מוקדם יותר.`,
  "rangeReversed": `תאריך ההתחלה חייב להיות לפני תאריך הסיום.`,
  "rangeUnderflow": (args) => `הערך חייב להיות ${args.minValue} או מאוחר יותר.`,
  "unavailableDate": `התאריך הנבחר אינו זמין.`
};
var $7743e79780ebcca3$exports = {};
$7743e79780ebcca3$exports = {
  "rangeOverflow": (args) => `Vrijednost mora biti ${args.maxValue} ili ranije.`,
  "rangeReversed": `Datum početka mora biti prije datuma završetka.`,
  "rangeUnderflow": (args) => `Vrijednost mora biti ${args.minValue} ili kasnije.`,
  "unavailableDate": `Odabrani datum nije dostupan.`
};
var $3351817a04898858$exports = {};
$3351817a04898858$exports = {
  "rangeOverflow": (args) => `Az értéknek ${args.maxValue} vagy korábbinak kell lennie.`,
  "rangeReversed": `A kezdő dátumnak a befejező dátumnál korábbinak kell lennie.`,
  "rangeUnderflow": (args) => `Az értéknek ${args.minValue} vagy későbbinek kell lennie.`,
  "unavailableDate": `A kiválasztott dátum nem érhető el.`
};
var $4120bdb1d03484db$exports = {};
$4120bdb1d03484db$exports = {
  "rangeOverflow": (args) => `Il valore deve essere ${args.maxValue} o precedente.`,
  "rangeReversed": `La data di inizio deve essere antecedente alla data di fine.`,
  "rangeUnderflow": (args) => `Il valore deve essere ${args.minValue} o successivo.`,
  "unavailableDate": `Data selezionata non disponibile.`
};
var $65e5e1569f34ea4f$exports = {};
$65e5e1569f34ea4f$exports = {
  "rangeOverflow": (args) => `値は ${args.maxValue} 以下にする必要があります。`,
  "rangeReversed": `開始日は終了日より前にする必要があります。`,
  "rangeUnderflow": (args) => `値は ${args.minValue} 以上にする必要があります。`,
  "unavailableDate": `選択した日付は使用できません。`
};
var $d34552a7550967e7$exports = {};
$d34552a7550967e7$exports = {
  "rangeOverflow": (args) => `값은 ${args.maxValue} 이전이어야 합니다.`,
  "rangeReversed": `시작일은 종료일 이전이어야 합니다.`,
  "rangeUnderflow": (args) => `값은 ${args.minValue} 이상이어야 합니다.`,
  "unavailableDate": `선택한 날짜를 사용할 수 없습니다.`
};
var $8f855bffe63f6eca$exports = {};
$8f855bffe63f6eca$exports = {
  "rangeOverflow": (args) => `Reikšmė turi būti ${args.maxValue} arba ankstesnė.`,
  "rangeReversed": `Pradžios data turi būti ankstesnė nei pabaigos data.`,
  "rangeUnderflow": (args) => `Reikšmė turi būti ${args.minValue} arba naujesnė.`,
  "unavailableDate": `Pasirinkta data nepasiekiama.`
};
var $ce40f46d09034645$exports = {};
$ce40f46d09034645$exports = {
  "rangeOverflow": (args) => `Vērtībai ir jābūt ${args.maxValue} vai agrākai.`,
  "rangeReversed": `Sākuma datumam ir jābūt pirms beigu datuma.`,
  "rangeUnderflow": (args) => `Vērtībai ir jābūt ${args.minValue} vai vēlākai.`,
  "unavailableDate": `Atlasītais datums nav pieejams.`
};
var $dd1a9a73340c793e$exports = {};
$dd1a9a73340c793e$exports = {
  "rangeOverflow": (args) => `Verdien må være ${args.maxValue} eller tidligere.`,
  "rangeReversed": `Startdatoen må være før sluttdatoen.`,
  "rangeUnderflow": (args) => `Verdien må være ${args.minValue} eller senere.`,
  "unavailableDate": `Valgt dato utilgjengelig.`
};
var $4ee1fb3f0cbe6f59$exports = {};
$4ee1fb3f0cbe6f59$exports = {
  "rangeOverflow": (args) => `Waarde moet ${args.maxValue} of eerder zijn.`,
  "rangeReversed": `De startdatum moet voor de einddatum liggen.`,
  "rangeUnderflow": (args) => `Waarde moet ${args.minValue} of later zijn.`,
  "unavailableDate": `Geselecteerde datum niet beschikbaar.`
};
var $c85829aebb0bc94b$exports = {};
$c85829aebb0bc94b$exports = {
  "rangeOverflow": (args) => `Wartość musi mieć wartość ${args.maxValue} lub wcześniejszą.`,
  "rangeReversed": `Data rozpoczęcia musi być wcześniejsza niż data zakończenia.`,
  "rangeUnderflow": (args) => `Wartość musi mieć wartość ${args.minValue} lub późniejszą.`,
  "unavailableDate": `Wybrana data jest niedostępna.`
};
var $27f5cd2291ca8a02$exports = {};
$27f5cd2291ca8a02$exports = {
  "rangeOverflow": (args) => `O valor deve ser ${args.maxValue} ou anterior.`,
  "rangeReversed": `A data inicial deve ser anterior à data final.`,
  "rangeUnderflow": (args) => `O valor deve ser ${args.minValue} ou posterior.`,
  "unavailableDate": `Data selecionada indisponível.`
};
var $e046fdccd69bea8e$exports = {};
$e046fdccd69bea8e$exports = {
  "rangeOverflow": (args) => `O valor tem de ser ${args.maxValue} ou anterior.`,
  "rangeReversed": `A data de início deve ser anterior à data de fim.`,
  "rangeUnderflow": (args) => `O valor tem de ser ${args.minValue} ou posterior.`,
  "unavailableDate": `Data selecionada indisponível.`
};
var $fa5f88e804986547$exports = {};
$fa5f88e804986547$exports = {
  "rangeOverflow": (args) => `Valoarea trebuie să fie ${args.maxValue} sau anterioară.`,
  "rangeReversed": `Data de început trebuie să fie anterioară datei de sfârșit.`,
  "rangeUnderflow": (args) => `Valoarea trebuie să fie ${args.minValue} sau ulterioară.`,
  "unavailableDate": `Data selectată nu este disponibilă.`
};
var $28e4714602d1b568$exports = {};
$28e4714602d1b568$exports = {
  "rangeOverflow": (args) => `Значение должно быть не позже ${args.maxValue}.`,
  "rangeReversed": `Дата начала должна предшествовать дате окончания.`,
  "rangeUnderflow": (args) => `Значение должно быть не раньше ${args.minValue}.`,
  "unavailableDate": `Выбранная дата недоступна.`
};
var $4e3bc8cf783ad569$exports = {};
$4e3bc8cf783ad569$exports = {
  "rangeOverflow": (args) => `Hodnota musí byť ${args.maxValue} alebo skoršia.`,
  "rangeReversed": `Dátum začiatku musí byť skorší ako dátum konca.`,
  "rangeUnderflow": (args) => `Hodnota musí byť ${args.minValue} alebo neskoršia.`,
  "unavailableDate": `Vybratý dátum je nedostupný.`
};
var $bee07513333bdc15$exports = {};
$bee07513333bdc15$exports = {
  "rangeOverflow": (args) => `Vrednost mora biti ${args.maxValue} ali starejša.`,
  "rangeReversed": `Začetni datum mora biti pred končnim datumom.`,
  "rangeUnderflow": (args) => `Vrednost mora biti ${args.minValue} ali novejša.`,
  "unavailableDate": `Izbrani datum ni na voljo.`
};
var $7ed9c6fad16a15ec$exports = {};
$7ed9c6fad16a15ec$exports = {
  "rangeOverflow": (args) => `Vrednost mora da bude ${args.maxValue} ili starija.`,
  "rangeReversed": `Datum početka mora biti pre datuma završetka.`,
  "rangeUnderflow": (args) => `Vrednost mora da bude ${args.minValue} ili novija.`,
  "unavailableDate": `Izabrani datum nije dostupan.`
};
var $8bef6d5a236de86c$exports = {};
$8bef6d5a236de86c$exports = {
  "rangeOverflow": (args) => `Värdet måste vara ${args.maxValue} eller tidigare.`,
  "rangeReversed": `Startdatumet måste vara före slutdatumet.`,
  "rangeUnderflow": (args) => `Värdet måste vara ${args.minValue} eller senare.`,
  "unavailableDate": `Det valda datumet är inte tillgängligt.`
};
var $098b9a2d2340cfc5$exports = {};
$098b9a2d2340cfc5$exports = {
  "rangeOverflow": (args) => `Değer, ${args.maxValue} veya öncesi olmalıdır.`,
  "rangeReversed": `Başlangıç tarihi bitiş tarihinden önce olmalıdır.`,
  "rangeUnderflow": (args) => `Değer, ${args.minValue} veya sonrası olmalıdır.`,
  "unavailableDate": `Seçilen tarih kullanılamıyor.`
};
var $54a862ea7fad7419$exports = {};
$54a862ea7fad7419$exports = {
  "rangeOverflow": (args) => `Значення має бути не пізніше ${args.maxValue}.`,
  "rangeReversed": `Дата початку має передувати даті завершення.`,
  "rangeUnderflow": (args) => `Значення має бути не раніше ${args.minValue}.`,
  "unavailableDate": `Вибрана дата недоступна.`
};
var $e6cc491d590dfda5$exports = {};
$e6cc491d590dfda5$exports = {
  "rangeOverflow": (args) => `值必须是 ${args.maxValue} 或更早日期。`,
  "rangeReversed": `开始日期必须早于结束日期。`,
  "rangeUnderflow": (args) => `值必须是 ${args.minValue} 或更晚日期。`,
  "unavailableDate": `所选日期不可用。`
};
var $9aebf53181a474bd$exports = {};
$9aebf53181a474bd$exports = {
  "rangeOverflow": (args) => `值必須是 ${args.maxValue} 或更早。`,
  "rangeReversed": `開始日期必須在結束日期之前。`,
  "rangeUnderflow": (args) => `值必須是 ${args.minValue} 或更晚。`,
  "unavailableDate": `所選日期無法使用。`
};
var $452ac34de8c2444e$exports = {};
$452ac34de8c2444e$exports = {
  "ar-AE": $b3427c06585c22a0$exports,
  "bg-BG": $d282528f459122b9$exports,
  "cs-CZ": $2d5eecd634a9ca45$exports,
  "da-DK": $c8e2288226c24a67$exports,
  "de-DE": $6f5745e389c346d7$exports,
  "el-GR": $8c882ccf4300d1da$exports,
  "en-US": $22195056771860be$exports,
  "es-ES": $cedfa43b4e2a5906$exports,
  "et-EE": $eeeaa8daee3601c7$exports,
  "fi-FI": $35e0614a49b3bb40$exports,
  "fr-FR": $929bc63f7705a78f$exports,
  "he-IL": $9a28d073b034d183$exports,
  "hr-HR": $7743e79780ebcca3$exports,
  "hu-HU": $3351817a04898858$exports,
  "it-IT": $4120bdb1d03484db$exports,
  "ja-JP": $65e5e1569f34ea4f$exports,
  "ko-KR": $d34552a7550967e7$exports,
  "lt-LT": $8f855bffe63f6eca$exports,
  "lv-LV": $ce40f46d09034645$exports,
  "nb-NO": $dd1a9a73340c793e$exports,
  "nl-NL": $4ee1fb3f0cbe6f59$exports,
  "pl-PL": $c85829aebb0bc94b$exports,
  "pt-BR": $27f5cd2291ca8a02$exports,
  "pt-PT": $e046fdccd69bea8e$exports,
  "ro-RO": $fa5f88e804986547$exports,
  "ru-RU": $28e4714602d1b568$exports,
  "sk-SK": $4e3bc8cf783ad569$exports,
  "sl-SI": $bee07513333bdc15$exports,
  "sr-SP": $7ed9c6fad16a15ec$exports,
  "sv-SE": $8bef6d5a236de86c$exports,
  "tr-TR": $098b9a2d2340cfc5$exports,
  "uk-UA": $54a862ea7fad7419$exports,
  "zh-CN": $e6cc491d590dfda5$exports,
  "zh-TW": $9aebf53181a474bd$exports
};
function $parcel$interopDefault$3(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
const $35a22f14a1f04b11$var$dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6($parcel$interopDefault$3($452ac34de8c2444e$exports));
function $35a22f14a1f04b11$var$getLocale() {
  return typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
}
function $35a22f14a1f04b11$export$f18627323ab57ac0(value2, minValue, maxValue, isDateUnavailable, options) {
  let rangeOverflow = value2 != null && maxValue != null && value2.compare(maxValue) > 0;
  let rangeUnderflow = value2 != null && minValue != null && value2.compare(minValue) < 0;
  let isUnavailable = value2 != null && (isDateUnavailable === null || isDateUnavailable === void 0 ? void 0 : isDateUnavailable(value2)) || false;
  let isInvalid = rangeOverflow || rangeUnderflow || isUnavailable;
  let errors = [];
  if (isInvalid) {
    let locale2 = $35a22f14a1f04b11$var$getLocale();
    let strings = $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage("@react-stately/datepicker") || $35a22f14a1f04b11$var$dictionary;
    let formatter = new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, strings);
    let dateFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, $35a22f14a1f04b11$export$7e319ea407e63bc0({}, options));
    let timeZone = dateFormatter.resolvedOptions().timeZone;
    if (rangeUnderflow && minValue != null)
      errors.push(formatter.format("rangeUnderflow", {
        minValue: dateFormatter.format(minValue.toDate(timeZone))
      }));
    if (rangeOverflow && maxValue != null)
      errors.push(formatter.format("rangeOverflow", {
        maxValue: dateFormatter.format(maxValue.toDate(timeZone))
      }));
    if (isUnavailable)
      errors.push(formatter.format("unavailableDate"));
  }
  return {
    isInvalid,
    validationErrors: errors,
    validationDetails: {
      badInput: isUnavailable,
      customError: false,
      patternMismatch: false,
      rangeOverflow,
      rangeUnderflow,
      stepMismatch: false,
      tooLong: false,
      tooShort: false,
      typeMismatch: false,
      valueMissing: false,
      valid: !isInvalid
    }
  };
}
function $35a22f14a1f04b11$export$80ff8fc0ae339c13(value2, minValue, maxValue, isDateUnavailable, options) {
  var _value_start;
  let startValidation = $35a22f14a1f04b11$export$f18627323ab57ac0((_value_start = value2 === null || value2 === void 0 ? void 0 : value2.start) !== null && _value_start !== void 0 ? _value_start : null, minValue, maxValue, isDateUnavailable, options);
  var _value_end;
  let endValidation = $35a22f14a1f04b11$export$f18627323ab57ac0((_value_end = value2 === null || value2 === void 0 ? void 0 : value2.end) !== null && _value_end !== void 0 ? _value_end : null, minValue, maxValue, isDateUnavailable, options);
  let result = $e5be200c675c3b3a$export$75ee7c75d68f5b0e(startValidation, endValidation);
  if ((value2 === null || value2 === void 0 ? void 0 : value2.end) != null && value2.start != null && value2.end.compare(value2.start) < 0) {
    let strings = $5b160d28a433310d$export$c17fa47878dc55b6.getGlobalDictionaryForPackage("@react-stately/datepicker") || $35a22f14a1f04b11$var$dictionary;
    result = $e5be200c675c3b3a$export$75ee7c75d68f5b0e(result, {
      isInvalid: true,
      validationErrors: [
        strings.getStringForLocale("rangeReversed", $35a22f14a1f04b11$var$getLocale())
      ],
      validationDetails: {
        ...$e5be200c675c3b3a$export$aca958c65c314e6c$1,
        rangeUnderflow: true,
        rangeOverflow: true,
        valid: false
      }
    });
  }
  return result;
}
const $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS = {
  year: "numeric",
  month: "numeric",
  day: "numeric",
  hour: "numeric",
  minute: "2-digit",
  second: "2-digit"
};
const $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
  year: "numeric",
  month: "2-digit",
  day: "2-digit",
  hour: "2-digit",
  minute: "2-digit",
  second: "2-digit"
};
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
  let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
  fieldOptions = {
    ...defaultFieldOptions,
    ...fieldOptions
  };
  let granularity = options.granularity || "minute";
  let keys2 = Object.keys(fieldOptions);
  var _options_maxGranularity;
  let startIdx = keys2.indexOf((_options_maxGranularity = options.maxGranularity) !== null && _options_maxGranularity !== void 0 ? _options_maxGranularity : "year");
  if (startIdx < 0)
    startIdx = 0;
  let endIdx = keys2.indexOf(granularity);
  if (endIdx < 0)
    endIdx = 2;
  if (startIdx > endIdx)
    throw new Error("maxGranularity must be greater than granularity");
  let opts2 = keys2.slice(startIdx, endIdx + 1).reduce((opts3, key) => {
    opts3[key] = fieldOptions[key];
    return opts3;
  }, {});
  if (options.hourCycle != null)
    opts2.hour12 = options.hourCycle === 12;
  opts2.timeZone = options.timeZone || "UTC";
  let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
  if (hasTime && options.timeZone && !options.hideTimeZone)
    opts2.timeZoneName = "short";
  if (options.showEra && startIdx === 0)
    opts2.era = "short";
  return opts2;
}
function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
  if (placeholderValue && "hour" in placeholderValue)
    return placeholderValue;
  return new $35ea8db9cb2ccb90$export$680ea196effce5f();
}
function $35a22f14a1f04b11$export$61a490a80c552550(value2, calendar2) {
  if (value2 === null)
    return null;
  if (!value2)
    return void 0;
  return $11d87f3f76e88657$export$b4a036af3fc0b032(value2, calendar2);
}
function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity, calendar2, timeZone) {
  if (placeholderValue)
    return $35a22f14a1f04b11$export$61a490a80c552550(placeholderValue, calendar2);
  let date4 = $11d87f3f76e88657$export$b4a036af3fc0b032($14e0f24ef4ac5c92$export$461939dd4422153(timeZone !== null && timeZone !== void 0 ? timeZone : $14e0f24ef4ac5c92$export$aa8b41735afcabd2()).set({
    hour: 0,
    minute: 0,
    second: 0,
    millisecond: 0
  }), calendar2);
  if (granularity === "year" || granularity === "month" || granularity === "day")
    return $11d87f3f76e88657$export$93522d1a439f3617(date4);
  if (!timeZone)
    return $11d87f3f76e88657$export$b21e0b124e224484(date4);
  return date4;
}
function $35a22f14a1f04b11$export$2440da353cedad43(v2, granularity) {
  let defaultTimeZone = v2 && "timeZone" in v2 ? v2.timeZone : void 0;
  let defaultGranularity = v2 && "minute" in v2 ? "minute" : "day";
  if (v2 && granularity && !(granularity in v2))
    throw new Error("Invalid granularity " + granularity + " for value " + v2.toString());
  let [lastValue, setLastValue] = reactExports.useState([
    defaultGranularity,
    defaultTimeZone
  ]);
  if (v2 && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
    setLastValue([
      defaultGranularity,
      defaultTimeZone
    ]);
  if (!granularity)
    granularity = v2 ? defaultGranularity : lastValue[0];
  let timeZone = v2 ? defaultTimeZone : lastValue[1];
  return [
    granularity,
    timeZone
  ];
}
const $3e3ed55ab2966714$var$placeholders = new $5b160d28a433310d$export$c17fa47878dc55b6({
  ach: {
    year: "mwaka",
    month: "dwe",
    day: "nino"
  },
  af: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  am: {
    year: "ዓዓዓዓ",
    month: "ሚሜ",
    day: "ቀቀ"
  },
  an: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  ar: {
    year: "سنة",
    month: "شهر",
    day: "يوم"
  },
  ast: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  az: {
    year: "iiii",
    month: "aa",
    day: "gg"
  },
  be: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  bg: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  bn: {
    year: "yyyy",
    month: "মিমি",
    day: "dd"
  },
  br: {
    year: "bbbb",
    month: "mm",
    day: "dd"
  },
  bs: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  ca: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  cak: {
    year: "jjjj",
    month: "ii",
    day: "q'q'"
  },
  ckb: {
    year: "ساڵ",
    month: "مانگ",
    day: "ڕۆژ"
  },
  cs: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  cy: {
    year: "bbbb",
    month: "mm",
    day: "dd"
  },
  da: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  de: {
    year: "jjjj",
    month: "mm",
    day: "tt"
  },
  dsb: {
    year: "llll",
    month: "mm",
    day: "źź"
  },
  el: {
    year: "εεεε",
    month: "μμ",
    day: "ηη"
  },
  en: {
    year: "yyyy",
    month: "mm",
    day: "dd"
  },
  eo: {
    year: "jjjj",
    month: "mm",
    day: "tt"
  },
  es: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  et: {
    year: "aaaa",
    month: "kk",
    day: "pp"
  },
  eu: {
    year: "uuuu",
    month: "hh",
    day: "ee"
  },
  fa: {
    year: "سال",
    month: "ماه",
    day: "روز"
  },
  ff: {
    year: "hhhh",
    month: "ll",
    day: "ññ"
  },
  fi: {
    year: "vvvv",
    month: "kk",
    day: "pp"
  },
  fr: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  fy: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  ga: {
    year: "bbbb",
    month: "mm",
    day: "ll"
  },
  gd: {
    year: "bbbb",
    month: "mm",
    day: "ll"
  },
  gl: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  he: {
    year: "שנה",
    month: "חודש",
    day: "יום"
  },
  hr: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  hsb: {
    year: "llll",
    month: "mm",
    day: "dd"
  },
  hu: {
    year: "éééé",
    month: "hh",
    day: "nn"
  },
  ia: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  id: {
    year: "tttt",
    month: "bb",
    day: "hh"
  },
  it: {
    year: "aaaa",
    month: "mm",
    day: "gg"
  },
  ja: {
    year: "年",
    month: "月",
    day: "日"
  },
  ka: {
    year: "წწწწ",
    month: "თთ",
    day: "რრ"
  },
  kk: {
    year: "жжжж",
    month: "аа",
    day: "кк"
  },
  kn: {
    year: "ವವವವ",
    month: "ಮಿಮೀ",
    day: "ದಿದಿ"
  },
  ko: {
    year: "연도",
    month: "월",
    day: "일"
  },
  lb: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  lo: {
    year: "ປປປປ",
    month: "ດດ",
    day: "ວວ"
  },
  lt: {
    year: "mmmm",
    month: "mm",
    day: "dd"
  },
  lv: {
    year: "gggg",
    month: "mm",
    day: "dd"
  },
  meh: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  ml: {
    year: "വർഷം",
    month: "മാസം",
    day: "തീയതി"
  },
  ms: {
    year: "tttt",
    month: "mm",
    day: "hh"
  },
  nl: {
    year: "jjjj",
    month: "mm",
    day: "dd"
  },
  nn: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  no: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  oc: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  pl: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  pt: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  rm: {
    year: "oooo",
    month: "mm",
    day: "dd"
  },
  ro: {
    year: "aaaa",
    month: "ll",
    day: "zz"
  },
  ru: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  sc: {
    year: "aaaa",
    month: "mm",
    day: "dd"
  },
  scn: {
    year: "aaaa",
    month: "mm",
    day: "jj"
  },
  sk: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  sl: {
    year: "llll",
    month: "mm",
    day: "dd"
  },
  sr: {
    year: "гггг",
    month: "мм",
    day: "дд"
  },
  sv: {
    year: "åååå",
    month: "mm",
    day: "dd"
  },
  szl: {
    year: "rrrr",
    month: "mm",
    day: "dd"
  },
  tg: {
    year: "сссс",
    month: "мм",
    day: "рр"
  },
  th: {
    year: "ปปปป",
    month: "ดด",
    day: "วว"
  },
  tr: {
    year: "yyyy",
    month: "aa",
    day: "gg"
  },
  uk: {
    year: "рррр",
    month: "мм",
    day: "дд"
  },
  "zh-CN": {
    year: "年",
    month: "月",
    day: "日"
  },
  "zh-TW": {
    year: "年",
    month: "月",
    day: "日"
  }
}, "en");
function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value2, locale2) {
  if (field === "era" || field === "dayPeriod")
    return value2;
  if (field === "year" || field === "month" || field === "day")
    return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale2);
  return "––";
}
const $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
  year: true,
  month: true,
  day: true,
  hour: true,
  minute: true,
  second: true,
  dayPeriod: true,
  era: true
};
const $3c0fc76039f1c516$var$PAGE_STEP = {
  year: 5,
  month: 2,
  day: 7,
  hour: 2,
  minute: 15,
  second: 15
};
const $3c0fc76039f1c516$var$TYPE_MAPPING = {
  // Node seems to convert everything to lowercase...
  dayperiod: "dayPeriod",
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts#named_years
  relatedYear: "year",
  yearName: "literal",
  unknown: "literal"
};
function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
  let { locale: locale2, createCalendar, hideTimeZone, isDisabled = false, isReadOnly = false, isRequired = false, minValue, maxValue, isDateUnavailable } = props;
  let v2 = props.value || props.defaultValue || props.placeholderValue || null;
  let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v2, props.granularity);
  let timeZone = defaultTimeZone || "UTC";
  if (v2 && !(granularity in v2))
    throw new Error("Invalid granularity " + granularity + " for value " + v2.toString());
  let defaultFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2), [
    locale2
  ]);
  let calendar2 = reactExports.useMemo(() => createCalendar(defaultFormatter.resolvedOptions().calendar), [
    createCalendar,
    defaultFormatter
  ]);
  var _props_defaultValue;
  let [value2, setDate] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let calendarValue = reactExports.useMemo(() => {
    var _convertValue;
    return (_convertValue = $35a22f14a1f04b11$export$61a490a80c552550(value2, calendar2)) !== null && _convertValue !== void 0 ? _convertValue : null;
  }, [
    value2,
    calendar2
  ]);
  let [placeholderDate, setPlaceholderDate] = reactExports.useState(() => $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
  let val = calendarValue || placeholderDate;
  let showEra = calendar2.identifier === "gregory" && val.era === "BC";
  let formatOpts = reactExports.useMemo(() => {
    var _props_maxGranularity2;
    return {
      granularity,
      maxGranularity: (_props_maxGranularity2 = props.maxGranularity) !== null && _props_maxGranularity2 !== void 0 ? _props_maxGranularity2 : "year",
      timeZone: defaultTimeZone,
      hideTimeZone,
      hourCycle: props.hourCycle,
      showEra,
      shouldForceLeadingZeros: props.shouldForceLeadingZeros
    };
  }, [
    props.maxGranularity,
    granularity,
    props.hourCycle,
    props.shouldForceLeadingZeros,
    defaultTimeZone,
    hideTimeZone,
    showEra
  ]);
  let opts2 = reactExports.useMemo(() => $35a22f14a1f04b11$export$7e319ea407e63bc0({}, formatOpts), [
    formatOpts
  ]);
  let dateFormatter = reactExports.useMemo(() => new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, opts2), [
    locale2,
    opts2
  ]);
  let resolvedOptions = reactExports.useMemo(() => dateFormatter.resolvedOptions(), [
    dateFormatter
  ]);
  let allSegments = reactExports.useMemo(() => dateFormatter.formatToParts(/* @__PURE__ */ new Date()).filter((seg) => $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]).reduce((p2, seg) => (p2[$3c0fc76039f1c516$var$TYPE_MAPPING[seg.type] || seg.type] = true, p2), {}), [
    dateFormatter
  ]);
  let [validSegments, setValidSegments] = reactExports.useState(() => props.value || props.defaultValue ? {
    ...allSegments
  } : {});
  let clearedSegment = reactExports.useRef(null);
  let lastCalendar = reactExports.useRef(calendar2);
  reactExports.useEffect(() => {
    if (!$14e0f24ef4ac5c92$export$dbc69fd56b53d5e(calendar2, lastCalendar.current)) {
      lastCalendar.current = calendar2;
      setPlaceholderDate((placeholder) => Object.keys(validSegments).length > 0 ? $11d87f3f76e88657$export$b4a036af3fc0b032(placeholder, calendar2) : $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
    }
  }, [
    calendar2,
    granularity,
    validSegments,
    defaultTimeZone,
    props.placeholderValue
  ]);
  if (value2 && Object.keys(validSegments).length < Object.keys(allSegments).length) {
    validSegments = {
      ...allSegments
    };
    setValidSegments(validSegments);
  }
  if (value2 == null && Object.keys(validSegments).length === Object.keys(allSegments).length) {
    validSegments = {};
    setValidSegments(validSegments);
    setPlaceholderDate($35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
  }
  let displayValue = calendarValue && Object.keys(validSegments).length >= Object.keys(allSegments).length ? calendarValue : placeholderDate;
  let setValue = (newValue) => {
    if (props.isDisabled || props.isReadOnly)
      return;
    let validKeys = Object.keys(validSegments);
    let allKeys = Object.keys(allSegments);
    if (newValue == null) {
      setDate(null);
      setPlaceholderDate($35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone));
      setValidSegments({});
    } else if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod && clearedSegment.current !== "dayPeriod") {
      newValue = $11d87f3f76e88657$export$b4a036af3fc0b032(newValue, (v2 === null || v2 === void 0 ? void 0 : v2.calendar) || new $3b62074eb05584b2$export$80ee6245ec4f29ec());
      setDate(newValue);
    } else
      setPlaceholderDate(newValue);
    clearedSegment.current = null;
  };
  let dateValue = reactExports.useMemo(() => displayValue.toDate(timeZone), [
    displayValue,
    timeZone
  ]);
  let segments = reactExports.useMemo(() => $3c0fc76039f1c516$var$processSegments(dateValue, validSegments, dateFormatter, resolvedOptions, displayValue, calendar2, locale2, granularity), [
    dateValue,
    validSegments,
    dateFormatter,
    resolvedOptions,
    displayValue,
    calendar2,
    locale2,
    granularity
  ]);
  if (allSegments.era && validSegments.year && !validSegments.era) {
    validSegments.era = true;
    setValidSegments({
      ...validSegments
    });
  } else if (!allSegments.era && validSegments.era) {
    delete validSegments.era;
    setValidSegments({
      ...validSegments
    });
  }
  let markValid = (part) => {
    validSegments[part] = true;
    if (part === "year" && allSegments.era)
      validSegments.era = true;
    setValidSegments({
      ...validSegments
    });
  };
  let adjustSegment = (type4, amount) => {
    if (!validSegments[type4]) {
      markValid(type4);
      let validKeys = Object.keys(validSegments);
      let allKeys = Object.keys(allSegments);
      if (validKeys.length >= allKeys.length || validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod)
        setValue(displayValue);
    } else
      setValue($3c0fc76039f1c516$var$addSegment(displayValue, type4, amount, resolvedOptions));
  };
  let builtinValidation = reactExports.useMemo(() => $35a22f14a1f04b11$export$f18627323ab57ac0(value2, minValue, maxValue, isDateUnavailable, formatOpts), [
    value2,
    minValue,
    maxValue,
    isDateUnavailable,
    formatOpts
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: value2,
    builtinValidation
  });
  let isValueInvalid = validation.displayValidation.isInvalid;
  let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
  var _props_maxGranularity;
  return {
    ...validation,
    value: calendarValue,
    dateValue,
    calendar: calendar2,
    setValue,
    segments,
    dateFormatter,
    validationState,
    isInvalid: isValueInvalid,
    granularity,
    maxGranularity: (_props_maxGranularity = props.maxGranularity) !== null && _props_maxGranularity !== void 0 ? _props_maxGranularity : "year",
    isDisabled,
    isReadOnly,
    isRequired,
    increment(part) {
      adjustSegment(part, 1);
    },
    decrement(part) {
      adjustSegment(part, -1);
    },
    incrementPage(part) {
      adjustSegment(part, $3c0fc76039f1c516$var$PAGE_STEP[part] || 1);
    },
    decrementPage(part) {
      adjustSegment(part, -($3c0fc76039f1c516$var$PAGE_STEP[part] || 1));
    },
    setSegment(part, v3) {
      markValid(part);
      setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v3, resolvedOptions));
    },
    confirmPlaceholder() {
      if (props.isDisabled || props.isReadOnly)
        return;
      let validKeys = Object.keys(validSegments);
      let allKeys = Object.keys(allSegments);
      if (validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) {
        validSegments = {
          ...allSegments
        };
        setValidSegments(validSegments);
        setValue(displayValue.copy());
      }
    },
    clearSegment(part) {
      delete validSegments[part];
      clearedSegment.current = part;
      setValidSegments({
        ...validSegments
      });
      let placeholder = $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar2, defaultTimeZone);
      let value3 = displayValue;
      if (part === "dayPeriod" && "hour" in displayValue && "hour" in placeholder) {
        let isPM = displayValue.hour >= 12;
        let shouldBePM = placeholder.hour >= 12;
        if (isPM && !shouldBePM)
          value3 = displayValue.set({
            hour: displayValue.hour - 12
          });
        else if (!isPM && shouldBePM)
          value3 = displayValue.set({
            hour: displayValue.hour + 12
          });
      } else if (part === "hour" && "hour" in displayValue && displayValue.hour >= 12 && validSegments.dayPeriod)
        value3 = displayValue.set({
          hour: placeholder["hour"] + 12
        });
      else if (part in displayValue)
        value3 = displayValue.set({
          [part]: placeholder[part]
        });
      setDate(null);
      setValue(value3);
    },
    formatValue(fieldOptions) {
      if (!calendarValue)
        return "";
      let formatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, formatOpts);
      let formatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, formatOptions);
      return formatter.format(dateValue);
    },
    getDateFormatter(locale3, formatOptions) {
      let newOptions = {
        ...formatOpts,
        ...formatOptions
      };
      let newFormatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0({}, newOptions);
      return new $fb18d541ea1ad717$export$ad991b66133851cf(locale3, newFormatOptions);
    }
  };
}
function $3c0fc76039f1c516$var$processSegments(dateValue, validSegments, dateFormatter, resolvedOptions, displayValue, calendar2, locale2, granularity) {
  let timeValue = [
    "hour",
    "minute",
    "second"
  ];
  let segments = dateFormatter.formatToParts(dateValue);
  let processedSegments = [];
  for (let segment of segments) {
    let type4 = $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type;
    let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4];
    if (type4 === "era" && calendar2.getEras().length === 1)
      isEditable = false;
    let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4] && !validSegments[type4];
    let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[type4] ? $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(type4, segment.value, locale2) : null;
    let dateSegment = {
      type: type4,
      text: isPlaceholder ? placeholder : segment.value,
      ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, type4, resolvedOptions),
      isPlaceholder,
      placeholder,
      isEditable
    };
    if (type4 === "hour") {
      processedSegments.push({
        type: "literal",
        text: "⁦",
        ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
        isPlaceholder: false,
        placeholder: "",
        isEditable: false
      });
      processedSegments.push(dateSegment);
      if (type4 === granularity)
        processedSegments.push({
          type: "literal",
          text: "⁩",
          ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
          isPlaceholder: false,
          placeholder: "",
          isEditable: false
        });
    } else if (timeValue.includes(type4) && type4 === granularity) {
      processedSegments.push(dateSegment);
      processedSegments.push({
        type: "literal",
        text: "⁩",
        ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, "literal", resolvedOptions),
        isPlaceholder: false,
        placeholder: "",
        isEditable: false
      });
    } else
      processedSegments.push(dateSegment);
  }
  return processedSegments;
}
function $3c0fc76039f1c516$var$getSegmentLimits(date4, type4, options) {
  switch (type4) {
    case "era": {
      let eras = date4.calendar.getEras();
      return {
        value: eras.indexOf(date4.era),
        minValue: 0,
        maxValue: eras.length - 1
      };
    }
    case "year":
      return {
        value: date4.year,
        minValue: 1,
        maxValue: date4.calendar.getYearsInEra(date4)
      };
    case "month":
      return {
        value: date4.month,
        minValue: $14e0f24ef4ac5c92$export$5412ac11713b72ad(date4),
        maxValue: date4.calendar.getMonthsInYear(date4)
      };
    case "day":
      return {
        value: date4.day,
        minValue: $14e0f24ef4ac5c92$export$b2f4953d301981d5(date4),
        maxValue: date4.calendar.getDaysInMonth(date4)
      };
  }
  if ("hour" in date4)
    switch (type4) {
      case "dayPeriod":
        return {
          value: date4.hour >= 12 ? 12 : 0,
          minValue: 0,
          maxValue: 12
        };
      case "hour":
        if (options.hour12) {
          let isPM = date4.hour >= 12;
          return {
            value: date4.hour,
            minValue: isPM ? 12 : 0,
            maxValue: isPM ? 23 : 11
          };
        }
        return {
          value: date4.hour,
          minValue: 0,
          maxValue: 23
        };
      case "minute":
        return {
          value: date4.minute,
          minValue: 0,
          maxValue: 59
        };
      case "second":
        return {
          value: date4.second,
          minValue: 0,
          maxValue: 59
        };
    }
  return {};
}
function $3c0fc76039f1c516$var$addSegment(value2, part, amount, options) {
  switch (part) {
    case "era":
    case "year":
    case "month":
    case "day":
      return value2.cycle(part, amount, {
        round: part === "year"
      });
  }
  if ("hour" in value2)
    switch (part) {
      case "dayPeriod": {
        let hours2 = value2.hour;
        let isPM = hours2 >= 12;
        return value2.set({
          hour: isPM ? hours2 - 12 : hours2 + 12
        });
      }
      case "hour":
      case "minute":
      case "second":
        return value2.cycle(part, amount, {
          round: part !== "hour",
          hourCycle: options.hour12 ? 12 : 24
        });
    }
  throw new Error("Unknown segment: " + part);
}
function $3c0fc76039f1c516$var$setSegment(value2, part, segmentValue, options) {
  switch (part) {
    case "day":
    case "month":
    case "year":
    case "era":
      return value2.set({
        [part]: segmentValue
      });
  }
  if ("hour" in value2 && typeof segmentValue === "number")
    switch (part) {
      case "dayPeriod": {
        let hours2 = value2.hour;
        let wasPM = hours2 >= 12;
        let isPM = segmentValue >= 12;
        if (isPM === wasPM)
          return value2;
        return value2.set({
          hour: wasPM ? hours2 - 12 : hours2 + 12
        });
      }
      case "hour":
        if (options.hour12) {
          let hours2 = value2.hour;
          let wasPM = hours2 >= 12;
          if (!wasPM && segmentValue === 12)
            segmentValue = 0;
          if (wasPM && segmentValue < 12)
            segmentValue += 12;
        }
      case "minute":
      case "second":
        return value2.set({
          [part]: segmentValue
        });
    }
  throw new Error("Unknown segment: " + part);
}
function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
  var _value_start, _value_end;
  let overlayState = $fc909762b330b746$export$61c6a8c84e605fb6$2(props);
  let [controlledValue, setControlledValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, props.defaultValue || null, props.onChange);
  let [placeholderValue, setPlaceholderValue] = reactExports.useState(() => controlledValue || {
    start: null,
    end: null
  });
  if (controlledValue == null && placeholderValue.start && placeholderValue.end) {
    placeholderValue = {
      start: null,
      end: null
    };
    setPlaceholderValue(placeholderValue);
  }
  let value2 = controlledValue || placeholderValue;
  let setValue = (value3) => {
    setPlaceholderValue(value3 || {
      start: null,
      end: null
    });
    if ($93c38a5e28be6249$var$isCompleteRange(value3))
      setControlledValue(value3);
    else
      setControlledValue(null);
  };
  let v2 = (value2 === null || value2 === void 0 ? void 0 : value2.start) || (value2 === null || value2 === void 0 ? void 0 : value2.end) || props.placeholderValue || null;
  let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v2, props.granularity);
  let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
  var _props_shouldCloseOnSelect;
  let shouldCloseOnSelect = (_props_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _props_shouldCloseOnSelect !== void 0 ? _props_shouldCloseOnSelect : true;
  let [dateRange, setSelectedDateRange] = reactExports.useState(null);
  let [timeRange, setSelectedTimeRange] = reactExports.useState(null);
  if (value2 && $93c38a5e28be6249$var$isCompleteRange(value2)) {
    dateRange = value2;
    if ("hour" in value2.start)
      timeRange = value2;
  }
  let commitValue = (dateRange2, timeRange2) => {
    setValue({
      start: "timeZone" in timeRange2.start ? timeRange2.start.set($11d87f3f76e88657$export$93522d1a439f3617(dateRange2.start)) : $11d87f3f76e88657$export$b21e0b124e224484(dateRange2.start, timeRange2.start),
      end: "timeZone" in timeRange2.end ? timeRange2.end.set($11d87f3f76e88657$export$93522d1a439f3617(dateRange2.end)) : $11d87f3f76e88657$export$b21e0b124e224484(dateRange2.end, timeRange2.end)
    });
    setSelectedDateRange(null);
    setSelectedTimeRange(null);
    validation.commitValidation();
  };
  let setDateRange = (range3) => {
    let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
    if (hasTime) {
      if ($93c38a5e28be6249$var$isCompleteRange(range3) && (shouldClose || (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) && (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end)))
        commitValue(range3, {
          start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
          end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
        });
      else
        setSelectedDateRange(range3);
    } else if ($93c38a5e28be6249$var$isCompleteRange(range3)) {
      setValue(range3);
      validation.commitValidation();
    } else
      setSelectedDateRange(range3);
    if (shouldClose)
      overlayState.setOpen(false);
  };
  let setTimeRange = (range3) => {
    if ($93c38a5e28be6249$var$isCompleteRange(dateRange) && $93c38a5e28be6249$var$isCompleteRange(range3))
      commitValue(dateRange, range3);
    else
      setSelectedTimeRange(range3);
  };
  let showEra = (value2 === null || value2 === void 0 ? void 0 : (_value_start = value2.start) === null || _value_start === void 0 ? void 0 : _value_start.calendar.identifier) === "gregory" && value2.start.era === "BC" || (value2 === null || value2 === void 0 ? void 0 : (_value_end = value2.end) === null || _value_end === void 0 ? void 0 : _value_end.calendar.identifier) === "gregory" && value2.end.era === "BC";
  let formatOpts = reactExports.useMemo(() => ({
    granularity,
    timeZone: defaultTimeZone,
    hideTimeZone: props.hideTimeZone,
    hourCycle: props.hourCycle,
    shouldForceLeadingZeros: props.shouldForceLeadingZeros,
    showEra
  }), [
    granularity,
    props.hourCycle,
    props.shouldForceLeadingZeros,
    defaultTimeZone,
    props.hideTimeZone,
    showEra
  ]);
  let { minValue, maxValue, isDateUnavailable } = props;
  let builtinValidation = reactExports.useMemo(() => $35a22f14a1f04b11$export$80ff8fc0ae339c13(value2, minValue, maxValue, isDateUnavailable, formatOpts), [
    value2,
    minValue,
    maxValue,
    isDateUnavailable,
    formatOpts
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: controlledValue,
    name: reactExports.useMemo(() => [
      props.startName,
      props.endName
    ].filter((n2) => n2 != null), [
      props.startName,
      props.endName
    ]),
    builtinValidation
  });
  let isValueInvalid = validation.displayValidation.isInvalid;
  let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
  return {
    ...validation,
    value: value2,
    setValue,
    dateRange,
    timeRange,
    granularity,
    hasTime,
    setDate(part, date4) {
      var _dateRange_end, _dateRange_start;
      if (part === "start")
        setDateRange({
          start: date4,
          end: (_dateRange_end = dateRange === null || dateRange === void 0 ? void 0 : dateRange.end) !== null && _dateRange_end !== void 0 ? _dateRange_end : null
        });
      else
        setDateRange({
          start: (_dateRange_start = dateRange === null || dateRange === void 0 ? void 0 : dateRange.start) !== null && _dateRange_start !== void 0 ? _dateRange_start : null,
          end: date4
        });
    },
    setTime(part, time2) {
      var _timeRange_end, _timeRange_start;
      if (part === "start")
        setTimeRange({
          start: time2,
          end: (_timeRange_end = timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) !== null && _timeRange_end !== void 0 ? _timeRange_end : null
        });
      else
        setTimeRange({
          start: (_timeRange_start = timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) !== null && _timeRange_start !== void 0 ? _timeRange_start : null,
          end: time2
        });
    },
    setDateTime(part, dateTime) {
      var _value_end2, _value_start2;
      if (part === "start")
        setValue({
          start: dateTime,
          end: (_value_end2 = value2 === null || value2 === void 0 ? void 0 : value2.end) !== null && _value_end2 !== void 0 ? _value_end2 : null
        });
      else
        setValue({
          start: (_value_start2 = value2 === null || value2 === void 0 ? void 0 : value2.start) !== null && _value_start2 !== void 0 ? _value_start2 : null,
          end: dateTime
        });
    },
    setDateRange,
    setTimeRange,
    ...overlayState,
    setOpen(isOpen) {
      if (!isOpen && !((value2 === null || value2 === void 0 ? void 0 : value2.start) && (value2 === null || value2 === void 0 ? void 0 : value2.end)) && $93c38a5e28be6249$var$isCompleteRange(dateRange) && hasTime)
        commitValue(dateRange, {
          start: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.start) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue),
          end: (timeRange === null || timeRange === void 0 ? void 0 : timeRange.end) || $35a22f14a1f04b11$export$c5221a78ef73c5e9(props.placeholderValue)
        });
      overlayState.setOpen(isOpen);
    },
    validationState,
    isInvalid: isValueInvalid,
    formatValue(locale2, fieldOptions) {
      if (!value2 || !value2.start || !value2.end)
        return null;
      let startTimeZone = "timeZone" in value2.start ? value2.start.timeZone : void 0;
      let startGranularity = props.granularity || (value2.start && "minute" in value2.start ? "minute" : "day");
      let endTimeZone = "timeZone" in value2.end ? value2.end.timeZone : void 0;
      let endGranularity = props.granularity || (value2.end && "minute" in value2.end ? "minute" : "day");
      let startOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
        granularity: startGranularity,
        timeZone: startTimeZone,
        hideTimeZone: props.hideTimeZone,
        hourCycle: props.hourCycle,
        showEra: value2.start.calendar.identifier === "gregory" && value2.start.era === "BC" || value2.end.calendar.identifier === "gregory" && value2.end.era === "BC"
      });
      let startDate = value2.start.toDate(startTimeZone || "UTC");
      let endDate = value2.end.toDate(endTimeZone || "UTC");
      let startFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, startOptions);
      let endFormatter;
      if (startTimeZone === endTimeZone && startGranularity === endGranularity && value2.start.compare(value2.end) !== 0) {
        try {
          let parts = startFormatter.formatRangeToParts(startDate, endDate);
          let separatorIndex = -1;
          for (let i2 = 0; i2 < parts.length; i2++) {
            let part = parts[i2];
            if (part.source === "shared" && part.type === "literal")
              separatorIndex = i2;
            else if (part.source === "endRange")
              break;
          }
          let start = "";
          let end = "";
          for (let i2 = 0; i2 < parts.length; i2++) {
            if (i2 < separatorIndex)
              start += parts[i2].value;
            else if (i2 > separatorIndex)
              end += parts[i2].value;
          }
          return {
            start,
            end
          };
        } catch {
        }
        endFormatter = startFormatter;
      } else {
        let endOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, {
          granularity: endGranularity,
          timeZone: endTimeZone,
          hideTimeZone: props.hideTimeZone,
          hourCycle: props.hourCycle
        });
        endFormatter = new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, endOptions);
      }
      return {
        start: startFormatter.format(startDate),
        end: endFormatter.format(endDate)
      };
    },
    getDateFormatter(locale2, formatOptions) {
      let newOptions = {
        ...formatOpts,
        ...formatOptions
      };
      let newFormatOptions = $35a22f14a1f04b11$export$7e319ea407e63bc0({}, newOptions);
      return new $fb18d541ea1ad717$export$ad991b66133851cf(locale2, newFormatOptions);
    }
  };
}
function $93c38a5e28be6249$var$isCompleteRange(value2) {
  return (value2 === null || value2 === void 0 ? void 0 : value2.start) != null && value2.end != null;
}
function $eff5d8ee529ac4bb$export$fd53cef0cc796101(props) {
  let { placeholderValue = new $35ea8db9cb2ccb90$export$680ea196effce5f(), minValue, maxValue, granularity, validate: validate2 } = props;
  var _props_defaultValue;
  let [value2, setValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
  let v2 = value2 || placeholderValue;
  let day = v2 && "day" in v2 ? v2 : void 0;
  let defaultValueTimeZone = props.defaultValue && "timeZone" in props.defaultValue ? props.defaultValue.timeZone : void 0;
  let placeholderDate = reactExports.useMemo(() => {
    let valueTimeZone = v2 && "timeZone" in v2 ? v2.timeZone : void 0;
    return (valueTimeZone || defaultValueTimeZone) && placeholderValue ? $11d87f3f76e88657$export$84c95a83c799e074($eff5d8ee529ac4bb$var$convertValue(placeholderValue), valueTimeZone || defaultValueTimeZone) : $eff5d8ee529ac4bb$var$convertValue(placeholderValue);
  }, [
    placeholderValue,
    v2,
    defaultValueTimeZone
  ]);
  let minDate = reactExports.useMemo(() => $eff5d8ee529ac4bb$var$convertValue(minValue, day), [
    minValue,
    day
  ]);
  let maxDate = reactExports.useMemo(() => $eff5d8ee529ac4bb$var$convertValue(maxValue, day), [
    maxValue,
    day
  ]);
  let timeValue = reactExports.useMemo(() => value2 && "day" in value2 ? $11d87f3f76e88657$export$d33f79e3ffc3dc83(value2) : value2, [
    value2
  ]);
  let dateTime = reactExports.useMemo(() => value2 == null ? null : $eff5d8ee529ac4bb$var$convertValue(value2), [
    value2
  ]);
  let onChange = (newValue) => {
    setValue(day || defaultValueTimeZone ? newValue : newValue && $11d87f3f76e88657$export$d33f79e3ffc3dc83(newValue));
  };
  let state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...props,
    value: dateTime,
    defaultValue: void 0,
    minValue: minDate,
    maxValue: maxDate,
    onChange,
    granularity: granularity || "minute",
    maxGranularity: "hour",
    placeholderValue: placeholderDate !== null && placeholderDate !== void 0 ? placeholderDate : void 0,
    // Calendar should not matter for time fields.
    createCalendar: () => new $3b62074eb05584b2$export$80ee6245ec4f29ec(),
    validate: reactExports.useCallback(() => validate2 === null || validate2 === void 0 ? void 0 : validate2(value2), [
      validate2,
      value2
    ])
  });
  return {
    ...state,
    timeValue
  };
}
function $eff5d8ee529ac4bb$var$convertValue(value2, date4 = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) {
  if (!value2)
    return null;
  if ("day" in value2)
    return value2;
  return $11d87f3f76e88657$export$b21e0b124e224484(date4, value2);
}
function useDateInput(originalProps) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2();
  const calendarProp = $64244302c3013299$export$dd0bbc9b26defe37(
    new $fb18d541ea1ad717$export$ad991b66133851cf(locale2).resolvedOptions().calendar
  );
  const gregorianYearOffset = getGregorianYearOffset(calendarProp.identifier);
  const {
    ref,
    as: as2,
    label,
    inputRef: inputRefProp,
    description,
    startContent,
    endContent,
    className,
    classNames: classNames2,
    validationState,
    groupProps = {},
    labelProps: labelPropsProp,
    fieldProps: fieldPropsProp,
    innerWrapperProps: innerWrapperPropsProp,
    errorMessageProps: errorMessagePropsProp,
    descriptionProps: descriptionPropsProp,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    shouldForceLeadingZeros = true,
    minValue = (_c2 = (_b2 = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _b2.minDate) != null ? _c2 : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 1900 + gregorianYearOffset, 1, 1),
    maxValue = (_e = (_d = globalContext == null ? void 0 : globalContext.defaultDates) == null ? void 0 : _d.maxDate) != null ? _e : new $35ea8db9cb2ccb90$export$99faa760c7908e4f(calendarProp, 2099 + gregorianYearOffset, 12, 31),
    createCalendar: createCalendarProp = (_f = globalContext == null ? void 0 : globalContext.createCalendar) != null ? _f : null,
    isInvalid: isInvalidProp = validationState ? validationState === "invalid" : false,
    errorMessage
  } = props;
  const domRef = useDOMRef(ref);
  const inputRef = useDOMRef(inputRefProp);
  const disableAnimation = (_g = originalProps.disableAnimation) != null ? _g : globalContext == null ? void 0 : globalContext.disableAnimation;
  const state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...originalProps,
    label,
    locale: locale2,
    minValue,
    maxValue,
    validationBehavior,
    shouldForceLeadingZeros,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const {
    labelProps,
    fieldProps,
    inputProps,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps,
    isInvalid: ariaIsInvalid
  } = $16f0b7bb276bc17e$export$5591b0b878c1a989({ ...originalProps, label, validationBehavior, inputRef }, state, domRef);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const isInvalid = isInvalidProp || ariaIsInvalid;
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const slots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      disableAnimation,
      labelPlacement
    }),
    [objectToDeps(variantProps2), disableAnimation, labelPlacement]
  );
  const getLabelProps = (props2) => {
    return {
      ...mergeProps$3(labelProps, labelPropsProp, props2),
      "data-slot": "label",
      className: slots.label({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputProps = (props2) => {
    return {
      ...props2,
      ...inputProps,
      ref: inputRef
    };
  };
  const getFieldProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "input-field",
      ...mergeProps$3(fieldProps, fieldPropsProp, props2),
      className: slots.input({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.input, props2 == null ? void 0 : props2.className)
      })
    };
  };
  const getInputWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: slots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: fieldProps.onClick
    };
  };
  const getInnerWrapperProps = (props2) => {
    const innerWrapperProps = mergeProps$3(innerWrapperPropsProp, props2);
    return {
      ...innerWrapperProps,
      "data-slot": "inner-wrapper",
      className: slots.innerWrapper({
        class: cn(classNames2 == null ? void 0 : classNames2.innerWrapper, innerWrapperProps == null ? void 0 : innerWrapperProps.className)
      })
    };
  };
  const getHelperWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "helper-wrapper",
      className: slots.helperWrapper({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      ...mergeProps$3(errorMessageProps, errorMessagePropsProp, props2),
      "data-slot": "error-message",
      className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
    };
  };
  const getDescriptionProps = (props2 = {}) => {
    return {
      ...mergeProps$3(descriptionProps, descriptionPropsProp, props2),
      "data-slot": "description",
      className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
    };
  };
  const getBaseGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      startContent,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: slots.base({ class: baseStyles })
    };
  };
  return {
    state,
    domRef,
    slots,
    classNames: classNames2,
    labelPlacement,
    getBaseGroupProps,
    getFieldProps,
    getInputProps
  };
}
var DateInput$1 = forwardRef(function DateInput2(props, ref) {
  const { state, slots, classNames: classNames2, getBaseGroupProps, getInputProps, getFieldProps } = useDateInput({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DateInputGroup, { ...getBaseGroupProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInputField,
    {
      classNames: classNames2,
      inputProps: getInputProps(),
      slots,
      state,
      ...getFieldProps()
    }
  ) });
});
var date_input_default = DateInput$1;
function useTimeInput(originalProps) {
  var _a2, _b2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const {
    ref,
    as: as2,
    label,
    inputRef: inputRefProp,
    description,
    startContent,
    endContent,
    className,
    classNames: classNames2,
    groupProps = {},
    labelProps: labelPropsProp,
    fieldProps: fieldPropsProp,
    errorMessageProps: errorMessagePropsProp,
    descriptionProps: descriptionPropsProp,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    shouldForceLeadingZeros = true,
    minValue,
    maxValue,
    isInvalid: isInvalidProp,
    errorMessage
  } = props;
  const domRef = useDOMRef(ref);
  const inputRef = useDOMRef(inputRefProp);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$2();
  const disableAnimation = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation;
  const state = $eff5d8ee529ac4bb$export$fd53cef0cc796101({
    ...originalProps,
    label,
    locale: locale2,
    minValue,
    maxValue,
    validationBehavior,
    isInvalid: isInvalidProp,
    shouldForceLeadingZeros
  });
  const {
    labelProps,
    fieldProps,
    inputProps,
    validationErrors,
    validationDetails,
    descriptionProps,
    errorMessageProps,
    isInvalid
  } = $16f0b7bb276bc17e$export$4c842f6a241dc825({ ...originalProps, label, validationBehavior, inputRef }, state, domRef);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const slots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      disableAnimation,
      labelPlacement
    }),
    [objectToDeps(variantProps2), labelPlacement, disableAnimation]
  );
  const getLabelProps = (props2) => {
    return {
      ...mergeProps$3(labelProps, labelPropsProp, props2),
      "data-slot": "label",
      className: slots.label({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputProps = (props2) => {
    return {
      ...props2,
      ...inputProps,
      ref: inputRef
    };
  };
  const getFieldProps = (props2 = {}) => {
    return {
      ref: domRef,
      "data-slot": "input",
      ...mergeProps$3(fieldProps, fieldPropsProp, props2),
      className: slots.input({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.input, props2 == null ? void 0 : props2.className)
      })
    };
  };
  const getInputWrapperProps = (props2 = {}) => {
    return {
      ...props2,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: slots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: fieldProps.onClick
    };
  };
  const getInnerWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "inner-wrapper",
      className: slots.innerWrapper({
        class: classNames2 == null ? void 0 : classNames2.innerWrapper
      })
    };
  };
  const getHelperWrapperProps = (props2) => {
    return {
      ...props2,
      "data-slot": "helper-wrapper",
      className: slots.helperWrapper({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props2 = {}) => {
    return {
      ...mergeProps$3(errorMessageProps, errorMessagePropsProp, props2),
      "data-slot": "error-message",
      className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
    };
  };
  const getDescriptionProps = (props2 = {}) => {
    return {
      ...mergeProps$3(descriptionProps, descriptionPropsProp, props2),
      "data-slot": "description",
      className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props2 == null ? void 0 : props2.className) })
    };
  };
  const getBaseGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      startContent,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: slots.base({ class: baseStyles })
    };
  };
  return {
    state,
    domRef,
    slots,
    classNames: classNames2,
    labelPlacement,
    getBaseGroupProps,
    getFieldProps,
    getInputProps
  };
}
var TimeInput$1 = forwardRef(function TimeInput2(props, ref) {
  const { state, slots, classNames: classNames2, getBaseGroupProps, getInputProps, getFieldProps } = useTimeInput({
    ...props,
    ref
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DateInputGroup, { ...getBaseGroupProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInputField,
    {
      classNames: classNames2,
      inputProps: getInputProps(),
      slots,
      state,
      ...getFieldProps()
    }
  ) });
});
var time_input_default = TimeInput$1;
const $148a7a147e38ea7f$var$RTL_SCRIPTS$1 = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS$1 = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764$1(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS$1.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS$1.has(lang2);
}
const $b5e257d569688ac6$var$defaultContext$1 = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext$1 = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext$1);
const $b5e257d569688ac6$var$IsSSRContext$1 = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds$1 = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter$1(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$1);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds$1.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds$1.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds$1.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId$1(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext$1);
  let counter = $b5e257d569688ac6$var$useCounter$1(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId$1(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273$1());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext$1.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId$1 : $b5e257d569688ac6$var$useLegacySSRSafeId$1;
function $b5e257d569688ac6$var$getSnapshot$1() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot$1() {
  return true;
}
function $b5e257d569688ac6$var$subscribe$1(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273$1() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe$1, $b5e257d569688ac6$var$getSnapshot$1, $b5e257d569688ac6$var$getServerSnapshot$1);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext$1);
}
const $1e5a04cdaf7d1af8$var$localeSymbol$1 = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol$1] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764$1(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale$1 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1();
let $1e5a04cdaf7d1af8$var$listeners$1 = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale$1() {
  $1e5a04cdaf7d1af8$var$currentLocale$1 = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5$1();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners$1)
    listener($1e5a04cdaf7d1af8$var$currentLocale$1);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$1() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273$1();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale$1);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners$1.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$1);
    $1e5a04cdaf7d1af8$var$listeners$1.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners$1.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners$1.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale$1);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext$1 = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a$1();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext$1);
  return context || defaultLocale;
}
const $fca6afa0e843324b$var$cache = /* @__PURE__ */ new WeakMap();
function $fca6afa0e843324b$var$getCachedDictionary(strings) {
  let dictionary = $fca6afa0e843324b$var$cache.get(strings);
  if (!dictionary) {
    dictionary = new $5b160d28a433310d$export$c17fa47878dc55b6(strings);
    $fca6afa0e843324b$var$cache.set(strings, dictionary);
  }
  return dictionary;
}
function $fca6afa0e843324b$export$87b761675e8eaa10(strings, packageName) {
  return $fca6afa0e843324b$var$getCachedDictionary(strings);
}
function $fca6afa0e843324b$export$f12b703ca79dfbb1(strings, packageName) {
  let { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1();
  let dictionary = $fca6afa0e843324b$export$87b761675e8eaa10(strings);
  return reactExports.useMemo(() => new $6db58dc88e78b024$export$2f817fcdc4b89ae0(locale2, dictionary), [
    locale2,
    dictionary
  ]);
}
function $458b0a5536c1a7cf$export$40bfa8c7b0832715$1(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
var messages_default = {
  "ar-AE": {
    endTime: "وقت الانتهاء",
    startTime: "وقت البدء",
    time: "الوقت"
  },
  "bg-BG": {
    endTime: "Краен час",
    startTime: "Начален час",
    time: "Време"
  },
  "cs-CZ": {
    endTime: "Konečný čas",
    startTime: "Počáteční čas",
    time: "Čas"
  },
  "da-DK": {
    endTime: "Sluttidspunkt",
    startTime: "Starttidspunkt",
    time: "Klokkeslæt"
  },
  "de-DE": {
    endTime: "Endzeit",
    startTime: "Startzeit",
    time: "Uhrzeit"
  },
  "el-GR": {
    endTime: "Χρόνος λήξης",
    startTime: "Ώρα έναρξης",
    time: "Χρόνος"
  },
  "en-US": {
    time: "Time",
    startTime: "Start time",
    endTime: "End time"
  },
  "es-ES": {
    endTime: "Hora de finalización",
    startTime: "Hora de inicio",
    time: "Hora"
  },
  "et-EE": {
    endTime: "Lõpuaeg",
    startTime: "Algusaeg",
    time: "Aeg"
  },
  "fi-FI": {
    endTime: "Päättymisaika",
    startTime: "Alkamisaika",
    time: "Aika"
  },
  "fr-FR": {
    endTime: "Heure de fin",
    startTime: "Heure de début",
    time: "Heure"
  },
  "he-IL": {
    endTime: "שעת סיום",
    startTime: "שעת התחלה",
    time: "זמן"
  },
  "hr-HR": {
    endTime: "Vrijeme završetka",
    startTime: "Vrijeme početka",
    time: "Vrijeme"
  },
  "hu-HU": {
    endTime: "Befejezés ideje",
    startTime: "Kezdés ideje",
    time: "Idő"
  },
  "it-IT": {
    endTime: "Ora di fine",
    startTime: "Ora di inizio",
    time: "Ora"
  },
  "ja-JP": {
    endTime: "終了時刻",
    startTime: "開始時刻",
    time: "時刻"
  },
  "ko-KR": {
    endTime: "종료 시간",
    startTime: "시작 시간",
    time: "시간"
  },
  "it-LT": {
    endTime: "Pabaigos laikas",
    startTime: "Pradžios laikas",
    time: "Laikas"
  },
  "lv-LV": {
    endTime: "Beigu laiks",
    startTime: "Sākuma laiks",
    time: "Laiks"
  },
  "nb-NO": {
    endTime: "Sluttid",
    startTime: "Starttid",
    time: "Tid"
  },
  "nl-NL": {
    endTime: "Eindtijd",
    startTime: "Starttijd",
    time: "Tijd"
  },
  "pl-PL": {
    endTime: "Godzina końcowa",
    startTime: "Godzina początkowa",
    time: "Godzina"
  },
  "pt-BR": {
    endTime: "Hora final",
    startTime: "Hora inicial",
    time: "Hora"
  },
  "pt-PT": {
    endTime: "Terminar tempo",
    startTime: "Iniciar tempo",
    time: "Tempo"
  },
  "ro-RO": {
    endTime: "Ora de sfârșit",
    startTime: "Ora de început",
    time: "Ora"
  },
  "ru-RU": {
    endTime: "Время окончания",
    startTime: "Время начала",
    time: "Время"
  },
  "sk-SK": {
    endTime: "Čas ukončenia",
    startTime: "Čas začiatku",
    time: "Čas"
  },
  "sl-SI": {
    endTime: "Končni čas",
    startTime: "Začetni čas",
    time: "Čas"
  },
  "sr-SP": {
    endTime: "Završno vreme",
    startTime: "Početno vreme",
    time: "Vreme"
  },
  "sv-SE": {
    endTime: "Sluttid",
    startTime: "Starttid",
    time: "Tid"
  },
  "tr-TR": {
    endTime: "Bitiş saati",
    startTime: "Başlangıç saati",
    time: "Saat"
  },
  "uk-UA": {
    endTime: "Час завершення",
    startTime: "Час початку",
    time: "Час"
  },
  "zh-CN": {
    endTime: "结束时间",
    startTime: "开始时间",
    time: "时间"
  },
  "zh-TW": {
    endTime: "結束時間",
    startTime: "開始時間",
    time: "時間"
  }
};
function useDatePickerBase(originalProps) {
  var _a2, _b2, _c2, _d;
  const globalContext = useProviderContext();
  const [props, variantProps2] = mapPropsVariants(originalProps, dateInput.variantKeys);
  const {
    as: as2,
    ref,
    label,
    endContent,
    selectorIcon,
    inputRef,
    isInvalid,
    errorMessage,
    description,
    startContent,
    validationState,
    validationBehavior,
    visibleMonths = 1,
    firstDayOfWeek,
    pageBehavior = "visible",
    calendarWidth = 256,
    isDateUnavailable,
    shouldForceLeadingZeros,
    showMonthAndYearPickers = false,
    selectorButtonProps: userSelectorButtonProps = {},
    popoverProps: userPopoverProps = {},
    timeInputProps: userTimeInputProps = {},
    calendarProps: userCalendarProps = {},
    CalendarTopContent,
    CalendarBottomContent,
    createCalendar
  } = props;
  const {
    isHeaderExpanded,
    isHeaderDefaultExpanded,
    onHeaderExpandedChange,
    ...restUserCalendarProps
  } = userCalendarProps;
  const handleHeaderExpandedChange = reactExports.useCallback(
    (isExpanded) => {
      onHeaderExpandedChange == null ? void 0 : onHeaderExpandedChange(isExpanded || false);
    },
    [onHeaderExpandedChange]
  );
  const [isCalendarHeaderExpanded, setIsCalendarHeaderExpanded] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$1(isHeaderExpanded, isHeaderDefaultExpanded != null ? isHeaderDefaultExpanded : false, handleHeaderExpandedChange);
  const domRef = useDOMRef(ref);
  const disableAnimation = (_b2 = (_a2 = originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1(messages_default);
  const isDefaultColor = originalProps.color === "default" || !originalProps.color;
  const hasMultipleMonths = visibleMonths > 1;
  const placeholder = originalProps == null ? void 0 : originalProps.placeholderValue;
  const timePlaceholder = placeholder && "hour" in placeholder ? placeholder : null;
  const timeMinValue = originalProps.minValue && "hour" in originalProps.minValue ? originalProps.minValue : null;
  const timeMaxValue = originalProps.maxValue && "hour" in originalProps.maxValue ? originalProps.maxValue : null;
  const slotsProps = {
    popoverProps: mergeProps$3(
      {
        offset: 13,
        placement: "bottom",
        triggerScaleOnOpen: false,
        disableAnimation
      },
      userPopoverProps
    ),
    selectorButtonProps: mergeProps$3(
      {
        isIconOnly: true,
        radius: "full",
        size: "sm",
        variant: "light",
        disableAnimation
      },
      userSelectorButtonProps
    ),
    calendarProps: mergeProps$3(
      {
        showHelper: false,
        visibleMonths,
        pageBehavior,
        isDateUnavailable,
        showMonthAndYearPickers,
        isHeaderExpanded: isCalendarHeaderExpanded,
        onHeaderExpandedChange: setIsCalendarHeaderExpanded,
        color: isDefaultColor ? "primary" : originalProps.color,
        disableAnimation,
        firstDayOfWeek
      },
      restUserCalendarProps
    )
  };
  const dateInputProps = {
    as: as2,
    label,
    ref: domRef,
    inputRef,
    description,
    validationState,
    shouldForceLeadingZeros,
    isInvalid,
    errorMessage,
    validationBehavior,
    "data-invalid": dataAttr(originalProps == null ? void 0 : originalProps.isInvalid)
  };
  const timeInputProps = {
    ...userTimeInputProps,
    size: "sm",
    labelPlacement: "outside-left",
    label: (userTimeInputProps == null ? void 0 : userTimeInputProps.label) || stringFormatter.format("time"),
    placeholderValue: timePlaceholder,
    hourCycle: props.hourCycle,
    hideTimeZone: props.hideTimeZone,
    validationBehavior
  };
  const popoverProps = {
    ...slotsProps.popoverProps,
    children: (_d = (_c2 = slotsProps.popoverProps) == null ? void 0 : _c2.children) != null ? _d : [],
    triggerRef: domRef
  };
  const calendarProps = {
    ...slotsProps.calendarProps,
    calendarWidth,
    "data-slot": "calendar"
  };
  const selectorButtonProps = {
    ...slotsProps.selectorButtonProps,
    "data-slot": "selector-button"
  };
  const selectorIconProps = {
    "data-slot": "selector-icon"
  };
  const onClose = () => {
    if (isHeaderExpanded === void 0) {
      setIsCalendarHeaderExpanded(false);
    }
  };
  return {
    domRef,
    startContent,
    endContent,
    selectorIcon,
    createCalendar,
    stringFormatter,
    hasMultipleMonths,
    slotsProps,
    timeMinValue,
    timeMaxValue,
    visibleMonths,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    variantProps: variantProps2,
    dateInputProps,
    timeInputProps,
    popoverProps,
    calendarProps,
    userTimeInputProps,
    selectorButtonProps,
    selectorIconProps,
    onClose
  };
}
var DateRangePickerField = reactExports.forwardRef(function DateRangePickerField2(props, ref) {
  const { as: as2, slots, createCalendar: createCalendarProp, classNames: classNames2, ...otherProps } = props;
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7$1();
  let state = $3c0fc76039f1c516$export$60e84778edff6d26({
    ...otherProps,
    locale: locale2,
    createCalendar: !createCalendarProp || typeof createCalendarProp !== "function" ? $64244302c3013299$export$dd0bbc9b26defe37 : createCalendarProp
  });
  const inputRef = reactExports.useRef(null);
  const {
    fieldProps,
    inputProps,
    isInvalid: ariaIsInvalid
  } = $16f0b7bb276bc17e$export$5591b0b878c1a989({ ...otherProps, inputRef }, state, domRef);
  const isInvalid = props.isInvalid || ariaIsInvalid;
  state.isInvalid = isInvalid;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...mergeProps$3(fieldProps, filterDOMProps(otherProps)), ref: domRef, children: [
    state.segments.map((segment, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      DateInputSegment,
      {
        classNames: classNames2,
        segment,
        slots,
        state
      },
      i2
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...inputProps, ref: inputRef })
  ] });
});
var date_range_picker_field_default = DateRangePickerField;
function useDateRangePicker({
  as: as2,
  label,
  isInvalid: isInvalidProp,
  description,
  startContent,
  endContent,
  selectorIcon,
  errorMessage,
  className,
  classNames: classNames2,
  ...originalProps
}) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const validationBehavior = (_c2 = (_b2 = (_a2 = originalProps.validationBehavior) != null ? _a2 : formValidationBehavior) != null ? _b2 : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _c2 : "native";
  const {
    domRef,
    slotsProps,
    createCalendar,
    stringFormatter,
    timeMinValue,
    timeMaxValue,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    timeInputProps,
    popoverProps,
    calendarProps,
    variantProps: variantProps2,
    userTimeInputProps,
    hasMultipleMonths,
    selectorButtonProps,
    selectorIconProps
  } = useDatePickerBase({ ...originalProps, validationBehavior });
  let state = $93c38a5e28be6249$export$e50a61c1de9f574({
    ...originalProps,
    validationBehavior,
    shouldCloseOnSelect: () => !state.hasTime
  });
  const popoverTriggerRef = reactExports.useRef(null);
  let {
    groupProps,
    labelProps,
    startFieldProps,
    endFieldProps,
    buttonProps,
    dialogProps,
    calendarProps: ariaCalendarProps,
    validationDetails,
    validationErrors,
    descriptionProps,
    errorMessageProps,
    isInvalid: isAriaInvalid
  } = $887cac91b7cc8801$export$12fd5f0e9f4bb192({ ...originalProps, validationBehavior }, state, domRef);
  reactExports.useEffect(() => {
    state.commitValidation();
  }, [state.value, state.commitValidation]);
  const isInvalid = isInvalidProp || isAriaInvalid;
  const slots = reactExports.useMemo(
    () => dateRangePicker({
      ...variantProps2,
      className
    }),
    [objectToDeps(variantProps2), className]
  );
  const timeGranularity = state.granularity === "hour" || state.granularity === "minute" || state.granularity === "second" ? state.granularity : null;
  const showTimeField = !!timeGranularity;
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const getStartTimeInputProps = () => {
    var _a22, _b22, _c22;
    if (!showTimeField)
      return {};
    return {
      ...timeInputProps,
      label: stringFormatter.format("startTime"),
      value: ((_a22 = state.timeRange) == null ? void 0 : _a22.start) || null,
      onChange: (v2) => state.setTime("start", v2),
      granularity: timeGranularity,
      minValue: timeMinValue,
      maxValue: timeMaxValue,
      classNames: {
        base: slots.timeInput({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.timeInput, (_b22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _b22.base)
        }),
        label: slots.timeInputLabel({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.timeInputLabel, (_c22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _c22.label)
        })
      }
    };
  };
  const getEndTimeInputProps = () => {
    var _a22, _b22, _c22;
    if (!showTimeField)
      return {};
    return {
      ...timeInputProps,
      label: stringFormatter.format("endTime"),
      value: ((_a22 = state.timeRange) == null ? void 0 : _a22.end) || null,
      onChange: (v2) => state.setTime("end", v2),
      granularity: timeGranularity,
      minValue: timeMinValue,
      maxValue: timeMaxValue,
      classNames: {
        base: slots.timeInput({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.timeInput, (_b22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _b22.base)
        }),
        label: slots.timeInputLabel({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.timeInputLabel, (_c22 = userTimeInputProps == null ? void 0 : userTimeInputProps.classNames) == null ? void 0 : _c22.label)
        })
      }
    };
  };
  const getPopoverProps = (props = {}) => {
    var _a22, _b22;
    return {
      state,
      dialogProps,
      ...props,
      ...popoverProps,
      triggerRef: popoverTriggerRef,
      classNames: {
        content: slots.popoverContent({
          class: clsx$5(
            classNames2 == null ? void 0 : classNames2.popoverContent,
            (_b22 = (_a22 = slotsProps.popoverProps) == null ? void 0 : _a22.classNames) == null ? void 0 : _b22["content"],
            props.className
          )
        })
      }
    };
  };
  const getCalendarProps = () => {
    var _a22, _b22;
    return {
      ...ariaCalendarProps,
      ...calendarProps,
      classNames: {
        ...calendarProps.classNames,
        base: slots.calendar({ class: cn((_a22 = calendarProps == null ? void 0 : calendarProps.classNames) == null ? void 0 : _a22.base, classNames2 == null ? void 0 : classNames2.calendar) }),
        content: slots.calendarContent({
          class: cn((_b22 = calendarProps == null ? void 0 : calendarProps.classNames) == null ? void 0 : _b22.content, classNames2 == null ? void 0 : classNames2.calendarContent)
        })
      }
    };
  };
  const getSelectorButtonProps = () => {
    return {
      ...buttonProps,
      ...selectorButtonProps,
      onPress: state.toggle,
      className: slots.selectorButton({ class: classNames2 == null ? void 0 : classNames2.selectorButton })
    };
  };
  const getSeparatorProps = () => {
    return {
      "data-slot": "separator",
      className: slots.separator({ class: classNames2 == null ? void 0 : classNames2.separator })
    };
  };
  const getSelectorIconProps = () => {
    return {
      ...selectorIconProps,
      className: slots.selectorIcon({ class: classNames2 == null ? void 0 : classNames2.selectorIcon })
    };
  };
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const dateInputSlots = reactExports.useMemo(
    () => dateInput({
      ...variantProps2,
      labelPlacement
    }),
    [objectToDeps(variantProps2)]
  );
  const getStartDateInputProps = (props = {}) => {
    return {
      ...startFieldProps,
      isInvalid,
      "data-slot": "start-input",
      slots: dateInputSlots,
      createCalendar,
      ...mergeProps$3(variantProps2, startFieldProps, {
        fullWidth: true,
        disableAnimation
      }),
      "data-open": dataAttr(state.isOpen),
      classNames: classNames2,
      style: {
        ...props.style,
        maxWidth: "fit-content"
      },
      className: dateInputSlots.input({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.input, props == null ? void 0 : props.className)
      })
    };
  };
  const getEndDateInputProps = (props = {}) => {
    return {
      ...endFieldProps,
      isInvalid,
      "data-slot": "end-input",
      slots: dateInputSlots,
      createCalendar,
      ...mergeProps$3(variantProps2, endFieldProps, {
        fullWidth: true,
        disableAnimation
      }),
      "data-open": dataAttr(state.isOpen),
      classNames: classNames2,
      className: dateInputSlots.input({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.input, props == null ? void 0 : props.className)
      })
    };
  };
  const getLabelProps = (props) => {
    return {
      ...props,
      ...labelProps,
      "data-slot": "label",
      className: dateInputSlots.label({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.label, void 0)
      })
    };
  };
  const getInputWrapperProps = (props = {}) => {
    return {
      ref: domRef,
      ...props,
      ...groupProps,
      "data-slot": "input-wrapper",
      className: dateInputSlots.inputWrapper({
        class: classNames2 == null ? void 0 : classNames2.inputWrapper
      }),
      onClick: labelProps.onClick
    };
  };
  const getInnerWrapperProps = (props) => {
    return {
      ...props,
      ref: popoverTriggerRef,
      "data-slot": "inner-wrapper",
      className: dateInputSlots.innerWrapper({
        class: classNames2 == null ? void 0 : classNames2.innerWrapper
      })
    };
  };
  const getHelperWrapperProps = (props) => {
    return {
      ...props,
      "data-slot": "helper-wrapper",
      className: dateInputSlots.helperWrapper({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, void 0)
      })
    };
  };
  const getErrorMessageProps = (props = {}) => {
    return {
      ...props,
      ...errorMessageProps,
      "data-slot": "error-message",
      className: dateInputSlots.errorMessage({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props == null ? void 0 : props.className)
      })
    };
  };
  const getDescriptionProps = (props = {}) => {
    return {
      ...props,
      ...descriptionProps,
      "data-slot": "description",
      className: dateInputSlots.description({
        class: clsx$5(classNames2 == null ? void 0 : classNames2.description, props == null ? void 0 : props.className)
      })
    };
  };
  const getDateInputGroupProps = () => {
    return {
      as: as2,
      label,
      description,
      endContent,
      errorMessage,
      isInvalid,
      validationDetails,
      validationErrors,
      shouldLabelBeOutside,
      "data-slot": "base",
      "data-required": dataAttr(originalProps.isRequired),
      "data-disabled": dataAttr(originalProps.isDisabled),
      "data-readonly": dataAttr(originalProps.isReadOnly),
      "data-invalid": dataAttr(isInvalid),
      "data-has-start-content": dataAttr(!!startContent),
      "data-has-multiple-months": dataAttr(hasMultipleMonths),
      "data-has-end-content": dataAttr(!!endContent),
      descriptionProps: getDescriptionProps(),
      errorMessageProps: getErrorMessageProps(),
      groupProps: getInputWrapperProps(),
      helperWrapperProps: getHelperWrapperProps(),
      labelProps: getLabelProps(),
      wrapperProps: getInnerWrapperProps(),
      className: dateInputSlots.base({ class: baseStyles })
    };
  };
  return {
    state,
    label,
    slots,
    classNames: classNames2,
    startContent,
    endContent,
    selectorIcon,
    showTimeField,
    isCalendarHeaderExpanded,
    disableAnimation,
    CalendarTopContent,
    CalendarBottomContent,
    getStartDateInputProps,
    getEndDateInputProps,
    getStartTimeInputProps,
    getEndTimeInputProps,
    getPopoverProps,
    getSelectorButtonProps,
    getCalendarProps,
    getSeparatorProps,
    getSelectorIconProps,
    getDateInputGroupProps
  };
}
var DateRangePicker = forwardRef(function DateRangePicker2(props, ref) {
  const { selectorButtonPlacement = "end", ...otherProps } = props;
  const {
    state,
    slots,
    startContent,
    endContent,
    selectorIcon,
    showTimeField,
    classNames: classNames2,
    disableAnimation,
    isCalendarHeaderExpanded,
    getDateInputGroupProps,
    getStartDateInputProps,
    getEndDateInputProps,
    getPopoverProps,
    getSeparatorProps,
    getStartTimeInputProps,
    getEndTimeInputProps,
    getSelectorButtonProps,
    getSelectorIconProps,
    getCalendarProps,
    CalendarTopContent,
    CalendarBottomContent
  } = useDateRangePicker({ ...otherProps, ref });
  const selectorContent = reactExports.isValidElement(selectorIcon) ? reactExports.cloneElement(selectorIcon, getSelectorIconProps()) : /* @__PURE__ */ jsxRuntimeExports.jsx(CalendarBoldIcon, { ...getSelectorIconProps() });
  const calendarBottomContent = reactExports.useMemo(() => {
    if (isCalendarHeaderExpanded)
      return null;
    return showTimeField ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots == null ? void 0 : slots.bottomContent({ class: classNames2 == null ? void 0 : classNames2.bottomContent }), children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: slots == null ? void 0 : slots.timeInputWrapper({ class: classNames2 == null ? void 0 : classNames2.timeInputWrapper }), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(time_input_default, { ...getStartTimeInputProps() }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(time_input_default, { ...getEndTimeInputProps() })
      ] }),
      CalendarBottomContent
    ] }) : CalendarBottomContent;
  }, [state, showTimeField, CalendarBottomContent, isCalendarHeaderExpanded]);
  const calendarTopContent = reactExports.useMemo(() => {
    if (isCalendarHeaderExpanded)
      return null;
    return CalendarTopContent;
  }, [showTimeField, CalendarTopContent, isCalendarHeaderExpanded]);
  const popoverContent = state.isOpen ? /* @__PURE__ */ jsxRuntimeExports.jsx(free_solo_popover_default, { ...getPopoverProps(), offset: 20, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    range_calendar_default,
    {
      ...getCalendarProps(),
      bottomContent: calendarBottomContent,
      topContent: calendarTopContent
    }
  ) }) : null;
  const dateInputGroupProps = {
    ...getDateInputGroupProps(),
    endContent: selectorButtonPlacement === "end" ? /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: endContent || selectorContent }) : endContent,
    startContent: selectorButtonPlacement === "start" ? /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { ...getSelectorButtonProps(), children: startContent || selectorContent }) : startContent
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(DateInputGroup, { ...dateInputGroupProps, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(date_range_picker_field_default, { ...getStartDateInputProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...getSeparatorProps(), "aria-hidden": "true", role: "separator", children: "-" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(date_range_picker_field_default, { ...getEndDateInputProps() })
    ] }),
    disableAnimation ? popoverContent : /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: popoverContent })
  ] });
});
var date_range_picker_default = DateRangePicker;
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value2, defaultValue2, onChange) {
  let [stateValue, setStateValue] = reactExports.useState(value2 || defaultValue2);
  let isControlledRef = reactExports.useRef(value2 !== void 0);
  let isControlled = value2 !== void 0;
  reactExports.useEffect(() => {
    isControlledRef.current;
    isControlledRef.current = isControlled;
  }, [
    isControlled
  ]);
  let currentValue = isControlled ? value2 : stateValue;
  let setValue = reactExports.useCallback((value22, ...args) => {
    let onChangeCaller = (value3, ...onChangeArgs) => {
      if (onChange) {
        if (!Object.is(currentValue, value3))
          onChange(value3, ...onChangeArgs);
      }
      if (!isControlled)
        currentValue = value3;
    };
    if (typeof value22 === "function") {
      let updateFunction = (oldValue, ...functionArgs) => {
        let interceptedValue = value22(isControlled ? currentValue : oldValue, ...functionArgs);
        onChangeCaller(interceptedValue, ...args);
        if (!isControlled)
          return interceptedValue;
        return oldValue;
      };
      setStateValue(updateFunction);
    } else {
      if (!isControlled)
        setStateValue(value22);
      onChangeCaller(value22, ...args);
    }
  }, [
    isControlled,
    currentValue,
    onChange
  ]);
  return [
    currentValue,
    setValue
  ];
}
function useAlert(originalProps) {
  const [props, variantProps2] = mapPropsVariants(originalProps, alert.variantKeys);
  const {
    as: as2,
    title,
    children,
    description,
    onClose,
    isClosable,
    ref,
    icon,
    startContent,
    endContent,
    isVisible: isVisibleProp,
    isDefaultVisible,
    onVisibleChange,
    closeButtonProps = {
      size: "sm"
    },
    className,
    classNames: classNames2,
    ...otherProps
  } = props;
  const [isVisible2, setIsVisible] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(
    isVisibleProp,
    isDefaultVisible != null ? isDefaultVisible : true,
    onVisibleChange
  );
  const Component2 = as2 || "div";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const handleClose = reactExports.useCallback(() => {
    setIsVisible(false);
    onClose == null ? void 0 : onClose();
  }, [setIsVisible, onClose]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => alert({ hasContent: !isEmpty(description) || !isEmpty(children), ...variantProps2 }),
    [description, objectToDeps(variantProps2)]
  );
  const getBaseProps = reactExports.useCallback(() => {
    return {
      "data-visible": dataAttr(isVisible2),
      "data-closeable": dataAttr(isClosable),
      "data-has-title": dataAttr(!isEmpty(title)),
      "data-has-description": dataAttr(!isEmpty(description)),
      ...mergeProps$3(
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props)
      ),
      className: slots.base({ class: baseStyles })
    };
  }, [slots, baseStyles]);
  const getMainWrapperProps = reactExports.useCallback(() => {
    return {
      className: slots.mainWrapper({ class: classNames2 == null ? void 0 : classNames2.mainWrapper })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]);
  const getDescriptionProps = reactExports.useCallback(() => {
    return {
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.description]);
  const getTitleProps = reactExports.useCallback(() => {
    return {
      className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title })
    };
  }, [slots, classNames2 == null ? void 0 : classNames2.title]);
  const getCloseButtonProps = reactExports.useCallback(
    () => ({
      ...closeButtonProps,
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.closeButton]
  );
  const getAlertIconProps = reactExports.useCallback(
    () => ({
      className: slots.alertIcon({ class: classNames2 == null ? void 0 : classNames2.alertIcon })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.alertIcon]
  );
  const getIconWrapperProps = reactExports.useCallback(
    () => ({
      className: slots.iconWrapper({ class: classNames2 == null ? void 0 : classNames2.iconWrapper })
    }),
    [slots, classNames2 == null ? void 0 : classNames2.iconWrapper]
  );
  return {
    title,
    icon,
    children,
    description,
    isClosable,
    domRef,
    endContent,
    startContent,
    getBaseProps,
    getMainWrapperProps,
    getDescriptionProps,
    getTitleProps,
    color: variantProps2["color"],
    getCloseButtonProps,
    handleClose,
    isVisible: isVisible2,
    onClose,
    getAlertIconProps,
    getIconWrapperProps
  };
}
var iconMap$1 = {
  primary: InfoCircleIcon,
  secondary: InfoCircleIcon,
  success: SuccessIcon,
  warning: WarningIcon,
  danger: DangerIcon
};
var Alert = forwardRef((props, ref) => {
  const {
    title,
    icon,
    children,
    description,
    endContent,
    startContent,
    isClosable,
    domRef,
    handleClose,
    getBaseProps,
    getMainWrapperProps,
    getDescriptionProps,
    getTitleProps,
    getCloseButtonProps,
    color: color2,
    isVisible: isVisible2,
    onClose,
    getAlertIconProps,
    getIconWrapperProps
  } = useAlert({ ...props, ref });
  if (!isVisible2)
    return null;
  const customIcon = icon && reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, getAlertIconProps()) : null;
  const IconComponent = iconMap$1[color2] || iconMap$1.primary;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: domRef, role: "alert", ...getBaseProps(), children: [
    startContent,
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getIconWrapperProps(), children: customIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { ...getAlertIconProps() }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
      !isEmpty(title) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getTitleProps(), children: title }),
      !isEmpty(description) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }),
      children
    ] }),
    endContent,
    (isClosable || onClose) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      button_default$1,
      {
        isIconOnly: true,
        "aria-label": "Close",
        radius: "full",
        variant: "light",
        onPress: handleClose,
        ...getCloseButtonProps(),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, { height: 20, width: 20 })
      }
    )
  ] });
});
Alert.displayName = "HeroUI.Alert";
var alert_default = Alert;
function useDrawer(originalProps) {
  const {
    ref,
    className,
    classNames: classNames2,
    placement = "right",
    scrollBehavior = "inside",
    size: size2 = "md",
    motionProps: drawerMotionProps,
    ...otherProps
  } = originalProps;
  const domRef = useDOMRef(ref);
  const motionProps = reactExports.useMemo(() => {
    if (!isEmpty(drawerMotionProps))
      return drawerMotionProps;
    const key = placement === "left" || placement === "right" ? "x" : "y";
    return {
      variants: {
        enter: {
          [key]: 0,
          transition: {
            [key]: {
              duration: 0.2,
              ease: TRANSITION_EASINGS.easeOut
            }
          }
        },
        exit: {
          [key]: placement === "top" || placement === "left" ? "-100%" : "100%",
          transition: {
            [key]: {
              duration: 0.1,
              ease: TRANSITION_EASINGS.easeIn
            }
          }
        }
      }
    };
  }, [placement, drawerMotionProps]);
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  const slots = reactExports.useMemo(
    () => drawer({
      size: size2,
      placement
    }),
    [size2, placement]
  );
  const getModalProps = reactExports.useCallback(() => {
    return {
      classNames: {
        ...classNames2,
        base: slots.base({ class: baseStyles })
      },
      motionProps,
      scrollBehavior,
      size: size2,
      ...otherProps
    };
  }, [baseStyles, classNames2, motionProps, scrollBehavior, size2, otherProps]);
  return { domRef, getModalProps };
}
var Drawer = forwardRef(({ children, ...props }, ref) => {
  const { domRef, getModalProps } = useDrawer({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(modal_default, { ref: domRef, ...getModalProps(), children });
});
Drawer.displayName = "HeroUI.Drawer";
var drawer_default = Drawer;
var NumberInputStepper = ({ direction, ...otherProps }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(button_default$1, { disableRipple: true, isIconOnly: true, ...otherProps, children: direction == "up" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronUpIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDownIcon$1, {}) });
};
NumberInputStepper.displayName = "HeroUI.NumberInputStepper";
var number_input_stepper_default = NumberInputStepper;
function $8a9cb279dc87e130$export$525bc4921d56d4a$1(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc$1(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$1(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
function $8a9cb279dc87e130$export$cabe61c495ee3649$1(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state$1 = "default";
let $14c0b72509d70225$var$savedUserSelect$1 = "";
let $14c0b72509d70225$var$modifiedElementMap$1 = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487$1(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$1 === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect$1 = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state$1 = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap$1.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295$1(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state$1 !== "disabled")
      return;
    $14c0b72509d70225$var$state$1 = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state$1 === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect$1 || "";
          $14c0b72509d70225$var$savedUserSelect$1 = "";
          $14c0b72509d70225$var$state$1 = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap$1.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap$1.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap$1.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5$1 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5$1.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext$1(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5$1);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation$1 = /* @__PURE__ */ new WeakMap();
let $f6c31cce2adf654f$var$PressEvent$1 = class $f6c31cce2adf654f$var$PressEvent11 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation$1, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
};
const $f6c31cce2adf654f$var$LINK_CLICKED$1 = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID$1 = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1 = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21$1(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext$1(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent$1("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent$1("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$1(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a$1(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent$1(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent$1(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent$1(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent$1(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent$1(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink$1(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED$1]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED$1] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487$1(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649$1(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent$1(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID$1))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID$1;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295$1((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE$1]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink$1(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent$1(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey$1(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink$1(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent$1(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp$1(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink$1(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard$1(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey$1(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp$1(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes$1 = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey$1(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes$1.has(target.type);
}
const $b5e257d569688ac6$var$defaultContext = {
  prefix: String(Math.round(Math.random() * 1e10)),
  current: 0
};
const $b5e257d569688ac6$var$SSRContext = /* @__PURE__ */ React$6.createContext($b5e257d569688ac6$var$defaultContext);
const $b5e257d569688ac6$var$IsSSRContext = /* @__PURE__ */ React$6.createContext(false);
let $b5e257d569688ac6$var$componentIds = /* @__PURE__ */ new WeakMap();
function $b5e257d569688ac6$var$useCounter(isDisabled = false) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext);
  let ref = reactExports.useRef(null);
  if (ref.current === null && !isDisabled) {
    var _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner, _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    let currentOwner = (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = React$6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED === void 0 ? void 0 : (_React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner = _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner) === null || _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner === void 0 ? void 0 : _React___SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED_ReactCurrentOwner.current;
    if (currentOwner) {
      let prevComponentValue = $b5e257d569688ac6$var$componentIds.get(currentOwner);
      if (prevComponentValue == null)
        $b5e257d569688ac6$var$componentIds.set(currentOwner, {
          id: ctx.current,
          state: currentOwner.memoizedState
        });
      else if (currentOwner.memoizedState !== prevComponentValue.state) {
        ctx.current = prevComponentValue.id;
        $b5e257d569688ac6$var$componentIds.delete(currentOwner);
      }
    }
    ref.current = ++ctx.current;
  }
  return ref.current;
}
function $b5e257d569688ac6$var$useLegacySSRSafeId(defaultId) {
  let ctx = reactExports.useContext($b5e257d569688ac6$var$SSRContext);
  let counter = $b5e257d569688ac6$var$useCounter(!!defaultId);
  let prefix = `react-aria${ctx.prefix}`;
  return defaultId || `${prefix}-${counter}`;
}
function $b5e257d569688ac6$var$useModernSSRSafeId(defaultId) {
  let id2 = React$6.useId();
  let [didSSR] = reactExports.useState($b5e257d569688ac6$export$535bd6ca7f90a273());
  let prefix = didSSR || false ? "react-aria" : `react-aria${$b5e257d569688ac6$var$defaultContext.prefix}`;
  return defaultId || `${prefix}-${id2}`;
}
typeof React$6["useId"] === "function" ? $b5e257d569688ac6$var$useModernSSRSafeId : $b5e257d569688ac6$var$useLegacySSRSafeId;
function $b5e257d569688ac6$var$getSnapshot() {
  return false;
}
function $b5e257d569688ac6$var$getServerSnapshot() {
  return true;
}
function $b5e257d569688ac6$var$subscribe(onStoreChange) {
  return () => {
  };
}
function $b5e257d569688ac6$export$535bd6ca7f90a273() {
  if (typeof React$6["useSyncExternalStore"] === "function")
    return React$6["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
  return reactExports.useContext($b5e257d569688ac6$var$IsSSRContext);
}
function $9ab94262bd0047c7$export$420e68273165f4ec$1(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc$1(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696$1(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a$1(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = false;
let $6179b936705e76d3$var$hoverCount$1 = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$1() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent$1(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents$1();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents$1() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$1);
  $6179b936705e76d3$var$hoverCount$1++;
  return () => {
    $6179b936705e76d3$var$hoverCount$1--;
    if ($6179b936705e76d3$var$hoverCount$1 > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent$1);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456$1(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents$1, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents$1 && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
const $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
  "Arab",
  "Syrc",
  "Samr",
  "Mand",
  "Thaa",
  "Mend",
  "Nkoo",
  "Adlm",
  "Rohg",
  "Hebr"
]);
const $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([
  "ae",
  "ar",
  "arc",
  "bcc",
  "bqi",
  "ckb",
  "dv",
  "fa",
  "glk",
  "he",
  "ku",
  "mzn",
  "nqo",
  "pnb",
  "ps",
  "sd",
  "ug",
  "ur",
  "yi"
]);
function $148a7a147e38ea7f$export$702d680b21cbd764(localeString) {
  if (Intl.Locale) {
    let locale2 = new Intl.Locale(localeString).maximize();
    let textInfo = typeof locale2.getTextInfo === "function" ? locale2.getTextInfo() : locale2.textInfo;
    if (textInfo)
      return textInfo.direction === "rtl";
    if (locale2.script)
      return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(locale2.script);
  }
  let lang2 = localeString.split("-")[0];
  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang2);
}
const $1e5a04cdaf7d1af8$var$localeSymbol = Symbol.for("react-aria.i18n.locale");
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
  let locale2 = typeof window !== "undefined" && window[$1e5a04cdaf7d1af8$var$localeSymbol] || typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
  try {
    Intl.DateTimeFormat.supportedLocalesOf([
      locale2
    ]);
  } catch {
    locale2 = "en-US";
  }
  return {
    locale: locale2,
    direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale2) ? "rtl" : "ltr"
  };
}
let $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
let $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set();
function $1e5a04cdaf7d1af8$var$updateLocale() {
  $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
  for (let listener of $1e5a04cdaf7d1af8$var$listeners)
    listener($1e5a04cdaf7d1af8$var$currentLocale);
}
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
  let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
  let [defaultLocale, setDefaultLocale] = reactExports.useState($1e5a04cdaf7d1af8$var$currentLocale);
  reactExports.useEffect(() => {
    if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
      window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
    $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
    return () => {
      $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
      if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
        window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
    };
  }, []);
  if (isSSR)
    return {
      locale: "en-US",
      direction: "ltr"
    };
  return defaultLocale;
}
const $18f2051aff69b9bf$var$I18nContext = /* @__PURE__ */ React$6.createContext(null);
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
  let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
  let context = reactExports.useContext($18f2051aff69b9bf$var$I18nContext);
  return context || defaultLocale;
}
function $de67e98908f0c6ee$export$7f629e9dc1ecf37c(props) {
  let { minValue, maxValue, step, formatOptions, value: value2, defaultValue: defaultValue2 = NaN, onChange, locale: locale2, isDisabled, isReadOnly } = props;
  if (value2 === null)
    value2 = NaN;
  if (value2 !== void 0 && !isNaN(value2)) {
    if (step !== void 0 && !isNaN(step))
      value2 = $9446cca9a3875146$export$cb6e0bb50bc19463(value2, minValue, maxValue, step);
    else
      value2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(value2, minValue, maxValue);
  }
  if (!isNaN(defaultValue2)) {
    if (step !== void 0 && !isNaN(step))
      defaultValue2 = $9446cca9a3875146$export$cb6e0bb50bc19463(defaultValue2, minValue, maxValue, step);
    else
      defaultValue2 = $9446cca9a3875146$export$7d15b64cf5a3a4c4(defaultValue2, minValue, maxValue);
  }
  let [numberValue, setNumberValue] = $458b0a5536c1a7cf$export$40bfa8c7b0832715$6(value2, isNaN(defaultValue2) ? NaN : defaultValue2, onChange);
  let [inputValue, setInputValue] = reactExports.useState(() => isNaN(numberValue) ? "" : new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, formatOptions).format(numberValue));
  let numberParser = reactExports.useMemo(() => new $6c7bd7858deea686$export$cd11ab140839f11d(locale2, formatOptions), [
    locale2,
    formatOptions
  ]);
  let numberingSystem = reactExports.useMemo(() => numberParser.getNumberingSystem(inputValue), [
    numberParser,
    inputValue
  ]);
  let formatter = reactExports.useMemo(() => new $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5(locale2, {
    ...formatOptions,
    numberingSystem
  }), [
    locale2,
    formatOptions,
    numberingSystem
  ]);
  let intlOptions = reactExports.useMemo(() => formatter.resolvedOptions(), [
    formatter
  ]);
  let format2 = reactExports.useCallback((value3) => isNaN(value3) || value3 === null ? "" : formatter.format(value3), [
    formatter
  ]);
  let validation = $e5be200c675c3b3a$export$fc1a364ae1f3ff10$1({
    ...props,
    value: numberValue
  });
  let clampStep = step !== void 0 && !isNaN(step) ? step : 1;
  if (intlOptions.style === "percent" && (step === void 0 || isNaN(step)))
    clampStep = 0.01;
  let [prevValue, setPrevValue] = reactExports.useState(numberValue);
  let [prevLocale, setPrevLocale] = reactExports.useState(locale2);
  let [prevFormatOptions, setPrevFormatOptions] = reactExports.useState(formatOptions);
  if (!Object.is(numberValue, prevValue) || locale2 !== prevLocale || formatOptions !== prevFormatOptions) {
    setInputValue(format2(numberValue));
    setPrevValue(numberValue);
    setPrevLocale(locale2);
    setPrevFormatOptions(formatOptions);
  }
  let parsedValue = reactExports.useMemo(() => numberParser.parse(inputValue), [
    numberParser,
    inputValue
  ]);
  let commit = () => {
    if (!inputValue.length) {
      setNumberValue(NaN);
      setInputValue(value2 === void 0 ? "" : format2(numberValue));
      return;
    }
    if (isNaN(parsedValue)) {
      setInputValue(format2(numberValue));
      return;
    }
    let clampedValue;
    if (step === void 0 || isNaN(step))
      clampedValue = $9446cca9a3875146$export$7d15b64cf5a3a4c4(parsedValue, minValue, maxValue);
    else
      clampedValue = $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, step);
    clampedValue = numberParser.parse(format2(clampedValue));
    setNumberValue(clampedValue);
    setInputValue(format2(value2 === void 0 ? clampedValue : numberValue));
  };
  let safeNextStep = (operation, minMax = 0) => {
    let prev2 = parsedValue;
    if (isNaN(prev2)) {
      let newValue = isNaN(minMax) ? 0 : minMax;
      return $9446cca9a3875146$export$cb6e0bb50bc19463(newValue, minValue, maxValue, clampStep);
    } else {
      let newValue = $9446cca9a3875146$export$cb6e0bb50bc19463(prev2, minValue, maxValue, clampStep);
      if (operation === "+" && newValue > prev2 || operation === "-" && newValue < prev2)
        return newValue;
      return $9446cca9a3875146$export$cb6e0bb50bc19463($de67e98908f0c6ee$var$handleDecimalOperation(operation, prev2, clampStep), minValue, maxValue, clampStep);
    }
  };
  let increment2 = () => {
    let newValue = safeNextStep("+", minValue);
    if (newValue === numberValue)
      setInputValue(format2(newValue));
    setNumberValue(newValue);
    validation.commitValidation();
  };
  let decrement = () => {
    let newValue = safeNextStep("-", maxValue);
    if (newValue === numberValue)
      setInputValue(format2(newValue));
    setNumberValue(newValue);
    validation.commitValidation();
  };
  let incrementToMax = () => {
    if (maxValue != null) {
      setNumberValue($9446cca9a3875146$export$cb6e0bb50bc19463(maxValue, minValue, maxValue, clampStep));
      validation.commitValidation();
    }
  };
  let decrementToMin = () => {
    if (minValue != null) {
      setNumberValue(minValue);
      validation.commitValidation();
    }
  };
  let canIncrement = reactExports.useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || maxValue === void 0 || isNaN(maxValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) > parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("+", parsedValue, clampStep) <= maxValue), [
    isDisabled,
    isReadOnly,
    minValue,
    maxValue,
    clampStep,
    parsedValue
  ]);
  let canDecrement = reactExports.useMemo(() => !isDisabled && !isReadOnly && (isNaN(parsedValue) || minValue === void 0 || isNaN(minValue) || $9446cca9a3875146$export$cb6e0bb50bc19463(parsedValue, minValue, maxValue, clampStep) < parsedValue || $de67e98908f0c6ee$var$handleDecimalOperation("-", parsedValue, clampStep) >= minValue), [
    isDisabled,
    isReadOnly,
    minValue,
    maxValue,
    clampStep,
    parsedValue
  ]);
  let validate2 = (value3) => numberParser.isValidPartialNumber(value3, minValue, maxValue);
  return {
    ...validation,
    validate: validate2,
    increment: increment2,
    incrementToMax,
    decrement,
    decrementToMin,
    canIncrement,
    canDecrement,
    minValue,
    maxValue,
    numberValue: parsedValue,
    setNumberValue,
    setInputValue,
    inputValue,
    commit
  };
}
function $de67e98908f0c6ee$var$handleDecimalOperation(operator, value1, value2) {
  let result = operator === "+" ? value1 + value2 : value1 - value2;
  if (value1 % 1 !== 0 || value2 % 1 !== 0) {
    const value1Decimal = value1.toString().split(".");
    const value2Decimal = value2.toString().split(".");
    const value1DecimalLength = value1Decimal[1] && value1Decimal[1].length || 0;
    const value2DecimalLength = value2Decimal[1] && value2Decimal[1].length || 0;
    const multiplier = Math.pow(10, Math.max(value1DecimalLength, value2DecimalLength));
    value1 = Math.round(value1 * multiplier);
    value2 = Math.round(value2 * multiplier);
    result = operator === "+" ? value1 + value2 : value1 - value2;
    result /= multiplier;
  }
  return result;
}
var $fb78e0f6ab6349ed$exports = {};
$fb78e0f6ab6349ed$exports = {
  "decrease": (args) => `خفض ${args.fieldLabel}`,
  "increase": (args) => `زيادة ${args.fieldLabel}`,
  "numberField": `حقل رقمي`
};
var $2776acdd9959a647$exports = {};
$2776acdd9959a647$exports = {
  "decrease": (args) => `Намаляване ${args.fieldLabel}`,
  "increase": (args) => `Усилване ${args.fieldLabel}`,
  "numberField": `Номер на полето`
};
var $741954410a365ad3$exports = {};
$741954410a365ad3$exports = {
  "decrease": (args) => `Snížit ${args.fieldLabel}`,
  "increase": (args) => `Zvýšit ${args.fieldLabel}`,
  "numberField": `Číselné pole`
};
var $8321ed0f8ab642f0$exports = {};
$8321ed0f8ab642f0$exports = {
  "decrease": (args) => `Reducer ${args.fieldLabel}`,
  "increase": (args) => `Øg ${args.fieldLabel}`,
  "numberField": `Talfelt`
};
var $92978e0c4ecafa32$exports = {};
$92978e0c4ecafa32$exports = {
  "decrease": (args) => `${args.fieldLabel} verringern`,
  "increase": (args) => `${args.fieldLabel} erhöhen`,
  "numberField": `Nummernfeld`
};
var $ac5ff71962864a84$exports = {};
$ac5ff71962864a84$exports = {
  "decrease": (args) => `Μείωση ${args.fieldLabel}`,
  "increase": (args) => `Αύξηση ${args.fieldLabel}`,
  "numberField": `Πεδίο αριθμού`
};
var $efe4685e2440d8be$exports = {};
$efe4685e2440d8be$exports = {
  "decrease": (args) => `Decrease ${args.fieldLabel}`,
  "increase": (args) => `Increase ${args.fieldLabel}`,
  "numberField": `Number field`
};
var $e50a9a48739b90e1$exports = {};
$e50a9a48739b90e1$exports = {
  "decrease": (args) => `Reducir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo de número`
};
var $6e0d5294ecbb8ab6$exports = {};
$6e0d5294ecbb8ab6$exports = {
  "decrease": (args) => `Vähenda ${args.fieldLabel}`,
  "increase": (args) => `Suurenda ${args.fieldLabel}`,
  "numberField": `Numbri väli`
};
var $e7129d65f607f77f$exports = {};
$e7129d65f607f77f$exports = {
  "decrease": (args) => `Vähennä ${args.fieldLabel}`,
  "increase": (args) => `Lisää ${args.fieldLabel}`,
  "numberField": `Numerokenttä`
};
var $d72adf5b20573e34$exports = {};
$d72adf5b20573e34$exports = {
  "decrease": (args) => `Diminuer ${args.fieldLabel}`,
  "increase": (args) => `Augmenter ${args.fieldLabel}`,
  "numberField": `Champ de nombre`
};
var $a25c707e88b844a7$exports = {};
$a25c707e88b844a7$exports = {
  "decrease": (args) => `הקטן ${args.fieldLabel}`,
  "increase": (args) => `הגדל ${args.fieldLabel}`,
  "numberField": `שדה מספר`
};
var $69b41140b9a4ca54$exports = {};
$69b41140b9a4ca54$exports = {
  "decrease": (args) => `Smanji ${args.fieldLabel}`,
  "increase": (args) => `Povećaj ${args.fieldLabel}`,
  "numberField": `Polje broja`
};
var $81dab28f37f59d1a$exports = {};
$81dab28f37f59d1a$exports = {
  "decrease": (args) => `${args.fieldLabel} csökkentése`,
  "increase": (args) => `${args.fieldLabel} növelése`,
  "numberField": `Számmező`
};
var $866555b31f2d7711$exports = {};
$866555b31f2d7711$exports = {
  "decrease": (args) => `Riduci ${args.fieldLabel}`,
  "increase": (args) => `Aumenta ${args.fieldLabel}`,
  "numberField": `Campo numero`
};
var $dafcd55d52b9d371$exports = {};
$dafcd55d52b9d371$exports = {
  "decrease": (args) => `${args.fieldLabel}を縮小`,
  "increase": (args) => `${args.fieldLabel}を拡大`,
  "numberField": `数値フィールド`
};
var $f090c1f8c5da0145$exports = {};
$f090c1f8c5da0145$exports = {
  "decrease": (args) => `${args.fieldLabel} 감소`,
  "increase": (args) => `${args.fieldLabel} 증가`,
  "numberField": `번호 필드`
};
var $6f10f3a13360a75c$exports = {};
$6f10f3a13360a75c$exports = {
  "decrease": (args) => `Sumažinti ${args.fieldLabel}`,
  "increase": (args) => `Padidinti ${args.fieldLabel}`,
  "numberField": `Numerio laukas`
};
var $47432cefd4b7bd1b$exports = {};
$47432cefd4b7bd1b$exports = {
  "decrease": (args) => `Samazināšana ${args.fieldLabel}`,
  "increase": (args) => `Palielināšana ${args.fieldLabel}`,
  "numberField": `Skaitļu lauks`
};
var $dc578a950a2bf23d$exports = {};
$dc578a950a2bf23d$exports = {
  "decrease": (args) => `Reduser ${args.fieldLabel}`,
  "increase": (args) => `Øk ${args.fieldLabel}`,
  "numberField": `Tallfelt`
};
var $353f1bfca4dc395a$exports = {};
$353f1bfca4dc395a$exports = {
  "decrease": (args) => `${args.fieldLabel} verlagen`,
  "increase": (args) => `${args.fieldLabel} verhogen`,
  "numberField": `Getalveld`
};
var $241bc0bbd870e982$exports = {};
$241bc0bbd870e982$exports = {
  "decrease": (args) => `Zmniejsz ${args.fieldLabel}`,
  "increase": (args) => `Zwiększ ${args.fieldLabel}`,
  "numberField": `Pole numeru`
};
var $da3005c7bd72b0a8$exports = {};
$da3005c7bd72b0a8$exports = {
  "decrease": (args) => `Diminuir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo de número`
};
var $cf48bfc540882310$exports = {};
$cf48bfc540882310$exports = {
  "decrease": (args) => `Diminuir ${args.fieldLabel}`,
  "increase": (args) => `Aumentar ${args.fieldLabel}`,
  "numberField": `Campo numérico`
};
var $b63a28c481ab9ee3$exports = {};
$b63a28c481ab9ee3$exports = {
  "decrease": (args) => `Scădere ${args.fieldLabel}`,
  "increase": (args) => `Creștere ${args.fieldLabel}`,
  "numberField": `Câmp numeric`
};
var $19f9df95c2464ab6$exports = {};
$19f9df95c2464ab6$exports = {
  "decrease": (args) => `Уменьшение ${args.fieldLabel}`,
  "increase": (args) => `Увеличение ${args.fieldLabel}`,
  "numberField": `Числовое поле`
};
var $b272932a685e8482$exports = {};
$b272932a685e8482$exports = {
  "decrease": (args) => `Znížiť ${args.fieldLabel}`,
  "increase": (args) => `Zvýšiť ${args.fieldLabel}`,
  "numberField": `Číselné pole`
};
var $cbaf8b5b61f9e544$exports = {};
$cbaf8b5b61f9e544$exports = {
  "decrease": (args) => `Upadati ${args.fieldLabel}`,
  "increase": (args) => `Povečajte ${args.fieldLabel}`,
  "numberField": `Številčno polje`
};
var $e0a3af6ac1449b2f$exports = {};
$e0a3af6ac1449b2f$exports = {
  "decrease": (args) => `Smanji ${args.fieldLabel}`,
  "increase": (args) => `Povećaj ${args.fieldLabel}`,
  "numberField": `Polje broja`
};
var $71e167d2458a6019$exports = {};
$71e167d2458a6019$exports = {
  "decrease": (args) => `Minska ${args.fieldLabel}`,
  "increase": (args) => `Öka ${args.fieldLabel}`,
  "numberField": `Nummerfält`
};
var $3719245abc082946$exports = {};
$3719245abc082946$exports = {
  "decrease": (args) => `${args.fieldLabel} azalt`,
  "increase": (args) => `${args.fieldLabel} arttır`,
  "numberField": `Sayı alanı`
};
var $2ccc589e2f51824d$exports = {};
$2ccc589e2f51824d$exports = {
  "decrease": (args) => `Зменшити ${args.fieldLabel}`,
  "increase": (args) => `Збільшити ${args.fieldLabel}`,
  "numberField": `Поле номера`
};
var $e1103cb9b4c13942$exports = {};
$e1103cb9b4c13942$exports = {
  "decrease": (args) => `降低 ${args.fieldLabel}`,
  "increase": (args) => `提高 ${args.fieldLabel}`,
  "numberField": `数字字段`
};
var $448607634f80dccb$exports = {};
$448607634f80dccb$exports = {
  "decrease": (args) => `縮小 ${args.fieldLabel}`,
  "increase": (args) => `放大 ${args.fieldLabel}`,
  "numberField": `數字欄位`
};
var $280a227d7cb94b92$exports = {};
$280a227d7cb94b92$exports = {
  "ar-AE": $fb78e0f6ab6349ed$exports,
  "bg-BG": $2776acdd9959a647$exports,
  "cs-CZ": $741954410a365ad3$exports,
  "da-DK": $8321ed0f8ab642f0$exports,
  "de-DE": $92978e0c4ecafa32$exports,
  "el-GR": $ac5ff71962864a84$exports,
  "en-US": $efe4685e2440d8be$exports,
  "es-ES": $e50a9a48739b90e1$exports,
  "et-EE": $6e0d5294ecbb8ab6$exports,
  "fi-FI": $e7129d65f607f77f$exports,
  "fr-FR": $d72adf5b20573e34$exports,
  "he-IL": $a25c707e88b844a7$exports,
  "hr-HR": $69b41140b9a4ca54$exports,
  "hu-HU": $81dab28f37f59d1a$exports,
  "it-IT": $866555b31f2d7711$exports,
  "ja-JP": $dafcd55d52b9d371$exports,
  "ko-KR": $f090c1f8c5da0145$exports,
  "lt-LT": $6f10f3a13360a75c$exports,
  "lv-LV": $47432cefd4b7bd1b$exports,
  "nb-NO": $dc578a950a2bf23d$exports,
  "nl-NL": $353f1bfca4dc395a$exports,
  "pl-PL": $241bc0bbd870e982$exports,
  "pt-BR": $da3005c7bd72b0a8$exports,
  "pt-PT": $cf48bfc540882310$exports,
  "ro-RO": $b63a28c481ab9ee3$exports,
  "ru-RU": $19f9df95c2464ab6$exports,
  "sk-SK": $b272932a685e8482$exports,
  "sl-SI": $cbaf8b5b61f9e544$exports,
  "sr-SP": $e0a3af6ac1449b2f$exports,
  "sv-SE": $71e167d2458a6019$exports,
  "tr-TR": $3719245abc082946$exports,
  "uk-UA": $2ccc589e2f51824d$exports,
  "zh-CN": $e1103cb9b4c13942$exports,
  "zh-TW": $448607634f80dccb$exports
};
function $parcel$interopDefault$2(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $81397a9303501bda$export$23f548e970bdf099(props, state, inputRef) {
  let { id: id2, decrementAriaLabel, incrementAriaLabel, isDisabled, isReadOnly, isRequired, minValue, maxValue, autoFocus, label, formatOptions, onBlur = () => {
  }, onFocus, onFocusChange, onKeyDown, onKeyUp, description, errorMessage, isWheelDisabled, ...otherProps } = props;
  let { increment: increment2, incrementToMax, decrement, decrementToMin, numberValue, inputValue, commit, commitValidation } = state;
  const stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$2($280a227d7cb94b92$exports), "@react-aria/numberfield");
  let inputId = $bdb11010cef70236$export$f680877a34711e37$2(id2);
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6$2({
    onBlur() {
      commit();
    }
  });
  let numberFormatter = $a916eb452884faea$export$b7a616150fdb9f44$1(formatOptions);
  let intlOptions = reactExports.useMemo(() => numberFormatter.resolvedOptions(), [
    numberFormatter
  ]);
  let textValueFormatter = $a916eb452884faea$export$b7a616150fdb9f44$1({
    ...formatOptions,
    currencySign: void 0
  });
  let textValue = reactExports.useMemo(() => isNaN(numberValue) ? "" : textValueFormatter.format(numberValue), [
    textValueFormatter,
    numberValue
  ]);
  let { spinButtonProps, incrementButtonProps: incButtonProps, decrementButtonProps: decButtonProps } = $d2e8511e6f209edf$export$e908e06f4b8e3402({
    isDisabled,
    isReadOnly,
    isRequired,
    maxValue,
    minValue,
    onIncrement: increment2,
    onIncrementToMax: incrementToMax,
    onDecrement: decrement,
    onDecrementToMin: decrementToMin,
    value: numberValue,
    textValue
  });
  let [focusWithin, setFocusWithin] = reactExports.useState(false);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    isDisabled,
    onFocusWithinChange: setFocusWithin
  });
  let onWheel = reactExports.useCallback((e2) => {
    if (Math.abs(e2.deltaY) <= Math.abs(e2.deltaX))
      return;
    if (e2.deltaY > 0)
      increment2();
    else if (e2.deltaY < 0)
      decrement();
  }, [
    decrement,
    increment2
  ]);
  let scrollingDisabled = isWheelDisabled || isDisabled || isReadOnly || !focusWithin;
  $7d0a636d7a4dcefd$export$2123ff2b87c81ca({
    onScroll: onWheel,
    isDisabled: scrollingDisabled
  }, inputRef);
  var _intlOptions_maximumFractionDigits;
  let hasDecimals = ((_intlOptions_maximumFractionDigits = intlOptions.maximumFractionDigits) !== null && _intlOptions_maximumFractionDigits !== void 0 ? _intlOptions_maximumFractionDigits : 0) > 0;
  let hasNegative = state.minValue === void 0 || isNaN(state.minValue) || state.minValue < 0;
  let inputMode = "numeric";
  if ($c87311424ea30a05$export$186c6964ca17d99$3()) {
    if (hasNegative)
      inputMode = "text";
    else if (hasDecimals)
      inputMode = "decimal";
  } else if ($c87311424ea30a05$export$a11b0059900ceec8$4()) {
    if (hasNegative)
      inputMode = "numeric";
    else if (hasDecimals)
      inputMode = "decimal";
  }
  let onChange = (value2) => {
    if (state.validate(value2))
      state.setInputValue(value2);
  };
  let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props);
  let onKeyDownEnter = reactExports.useCallback((e2) => {
    if (e2.key === "Enter") {
      commit();
      commitValidation();
    } else
      e2.continuePropagation();
  }, [
    commit,
    commitValidation
  ]);
  let { isInvalid, validationErrors, validationDetails } = state.displayValidation;
  let { labelProps, inputProps: textFieldProps, descriptionProps, errorMessageProps } = $d841c8010a73d545$export$4f384c9210e583c3({
    ...otherProps,
    ...domProps,
    name: void 0,
    label,
    autoFocus,
    isDisabled,
    isReadOnly,
    isRequired,
    validate: void 0,
    [$e5be200c675c3b3a$export$a763b9476acd3eb$1]: state,
    value: inputValue,
    defaultValue: void 0,
    autoComplete: "off",
    "aria-label": props["aria-label"] || void 0,
    "aria-labelledby": props["aria-labelledby"] || void 0,
    id: inputId,
    type: "text",
    inputMode,
    onChange,
    onBlur,
    onFocus,
    onFocusChange,
    onKeyDown: reactExports.useMemo(() => $ff5963eb1fccf552$export$e08e3b67e392101e$9(onKeyDownEnter, onKeyDown), [
      onKeyDownEnter,
      onKeyDown
    ]),
    onKeyUp,
    description,
    errorMessage
  }, state, inputRef);
  $99facab73266f662$export$5add1d006293d136(inputRef, state.numberValue, state.setNumberValue);
  let inputProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(spinButtonProps, focusProps, textFieldProps, {
    // override the spinbutton role, we can't focus a spin button with VO
    role: null,
    // ignore aria-roledescription on iOS so that required state will announce when it is present
    "aria-roledescription": !$c87311424ea30a05$export$fedb369cb70207f1$3() ? stringFormatter.format("numberField") : null,
    "aria-valuemax": null,
    "aria-valuemin": null,
    "aria-valuenow": null,
    "aria-valuetext": null,
    autoCorrect: "off",
    spellCheck: "false"
  });
  if (props.validationBehavior === "native")
    inputProps["aria-required"] = void 0;
  let onButtonPressStart = (e2) => {
    var _inputRef_current;
    if (document.activeElement === inputRef.current)
      return;
    if (e2.pointerType === "mouse")
      (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
    else
      e2.target.focus();
  };
  let fieldLabel = props["aria-label"] || (typeof props.label === "string" ? props.label : "");
  let ariaLabelledby;
  if (!fieldLabel)
    ariaLabelledby = props.label != null ? labelProps.id : props["aria-labelledby"];
  let incrementId = $bdb11010cef70236$export$f680877a34711e37$2();
  let decrementId = $bdb11010cef70236$export$f680877a34711e37$2();
  let incrementButtonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(incButtonProps, {
    "aria-label": incrementAriaLabel || stringFormatter.format("increase", {
      fieldLabel
    }).trim(),
    id: ariaLabelledby && !incrementAriaLabel ? incrementId : null,
    "aria-labelledby": ariaLabelledby && !incrementAriaLabel ? `${incrementId} ${ariaLabelledby}` : null,
    "aria-controls": inputId,
    excludeFromTabOrder: true,
    preventFocusOnPress: true,
    allowFocusWhenDisabled: true,
    isDisabled: !state.canIncrement,
    onPressStart: onButtonPressStart
  });
  let decrementButtonProps = $3ef42575df84b30b$export$9d1611c77c2fe928$9(decButtonProps, {
    "aria-label": decrementAriaLabel || stringFormatter.format("decrease", {
      fieldLabel
    }).trim(),
    id: ariaLabelledby && !decrementAriaLabel ? decrementId : null,
    "aria-labelledby": ariaLabelledby && !decrementAriaLabel ? `${decrementId} ${ariaLabelledby}` : null,
    "aria-controls": inputId,
    excludeFromTabOrder: true,
    preventFocusOnPress: true,
    allowFocusWhenDisabled: true,
    isDisabled: !state.canDecrement,
    onPressStart: onButtonPressStart
  });
  return {
    groupProps: {
      ...focusWithinProps,
      role: "group",
      "aria-disabled": isDisabled,
      "aria-invalid": isInvalid ? "true" : void 0
    },
    labelProps,
    inputProps,
    incrementButtonProps,
    decrementButtonProps,
    errorMessageProps,
    descriptionProps,
    isInvalid,
    validationErrors,
    validationDetails
  };
}
function useNumberInput(originalProps) {
  var _a2, _b2, _c2;
  const globalContext = useProviderContext();
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext$1) || {};
  const [props, variantProps2] = mapPropsVariants(originalProps, numberInput.variantKeys);
  const {
    ref,
    as: as2,
    type: type4,
    label,
    baseRef,
    wrapperRef,
    description,
    className,
    classNames: classNames2,
    autoFocus,
    startContent,
    endContent,
    onClear,
    onChange,
    validationBehavior = (_a2 = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _a2 : "native",
    innerWrapperRef: innerWrapperRefProp,
    onValueChange,
    hideStepper,
    ...otherProps
  } = props;
  const [isFocusWithin, setFocusWithin] = reactExports.useState(false);
  const Component2 = as2 || "div";
  const disableAnimation = (_c2 = (_b2 = originalProps.disableAnimation) != null ? _b2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _c2 : false;
  const domRef = useDOMRef(ref);
  const baseDomRef = useDOMRef(baseRef);
  const inputWrapperRef = useDOMRef(wrapperRef);
  const innerWrapperRef = useDOMRef(innerWrapperRefProp);
  const { locale: locale2 } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
  const state = $de67e98908f0c6ee$export$7f629e9dc1ecf37c({
    ...originalProps,
    validationBehavior,
    locale: locale2,
    onChange: chain(onValueChange, onChange)
  });
  const {
    groupProps,
    labelProps,
    inputProps,
    incrementButtonProps,
    decrementButtonProps,
    descriptionProps,
    errorMessageProps,
    isInvalid,
    validationErrors,
    validationDetails
  } = $81397a9303501bda$export$23f548e970bdf099({ ...originalProps, validationBehavior }, state, domRef);
  const inputValue = isNaN(state.numberValue) ? "" : state.numberValue;
  const isFilled = !isEmpty(inputValue);
  const isFilledWithin = isFilled || isFocusWithin;
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className, isFilled ? "is-filled" : "");
  const handleClear = reactExports.useCallback(() => {
    var _a22;
    state.setInputValue("");
    onClear == null ? void 0 : onClear();
    (_a22 = domRef.current) == null ? void 0 : _a22.focus();
  }, [state.setInputValue, onClear]);
  useSafeLayoutEffect(() => {
    if (!domRef.current)
      return;
    state.setInputValue(domRef.current.value);
  }, [domRef.current]);
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f$1({
    autoFocus,
    isTextInput: true
  });
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$1({ isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) });
  const { isHovered: isLabelHovered, hoverProps: labelHoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$1({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled)
  });
  const { focusProps: clearFocusProps, isFocusVisible: isClearButtonFocusVisible } = $f7dceffc5ad7768b$export$4e328f61c538687f$1();
  const { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$1({
    onFocusWithinChange: setFocusWithin
  });
  const { pressProps: clearPressProps } = $f6c31cce2adf654f$export$45712eceda6fad21$1({
    isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled) || !!(originalProps == null ? void 0 : originalProps.isReadOnly),
    onPress: handleClear
  });
  const labelPlacement = useLabelPlacement({
    labelPlacement: originalProps.labelPlacement,
    label
  });
  const errorMessage = typeof props.errorMessage === "function" ? props.errorMessage({ isInvalid, validationErrors, validationDetails }) : props.errorMessage || (validationErrors == null ? void 0 : validationErrors.join(" "));
  const isClearable = !!onClear || originalProps.isClearable;
  const hasElements = !!label || !!description || !!errorMessage;
  const hasPlaceholder = !!props.placeholder;
  const hasLabel = !!label;
  const hasHelper = !!description || !!errorMessage;
  const shouldLabelBeOutside = labelPlacement === "outside" || labelPlacement === "outside-left";
  const shouldLabelBeInside = labelPlacement === "inside";
  const isPlaceholderShown = domRef.current ? (!domRef.current.value || domRef.current.value === "" || !inputValue) && hasPlaceholder : false;
  const isOutsideLeft = labelPlacement === "outside-left";
  const hasStartContent = !!startContent;
  const isLabelOutside = shouldLabelBeOutside ? labelPlacement === "outside-left" || hasPlaceholder || labelPlacement === "outside" && hasStartContent : false;
  const isLabelOutsideAsPlaceholder = labelPlacement === "outside" && !hasPlaceholder && !hasStartContent;
  const slots = reactExports.useMemo(
    () => numberInput({
      ...variantProps2,
      isInvalid,
      isClearable,
      disableAnimation
    }),
    [objectToDeps(variantProps2), isInvalid, isClearable, hasStartContent, disableAnimation]
  );
  const handleKeyDown = reactExports.useCallback(
    (e2) => {
      if (e2.key === "Escape" && inputValue && (isClearable || onClear) && !originalProps.isReadOnly) {
        state.setInputValue("");
        onClear == null ? void 0 : onClear();
      }
    },
    [inputValue, state.setInputValue, onClear, isClearable, originalProps.isReadOnly]
  );
  const getBaseProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: baseDomRef,
        className: slots.base({ class: baseStyles }),
        "data-slot": "base",
        "data-filled": dataAttr(
          isFilled || hasPlaceholder || hasStartContent || isPlaceholderShown
        ),
        "data-filled-within": dataAttr(
          isFilledWithin || hasPlaceholder || hasStartContent || isPlaceholderShown
        ),
        "data-focus-within": dataAttr(isFocusWithin),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-readonly": dataAttr(originalProps.isReadOnly),
        "data-focus": dataAttr(isFocused),
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-required": dataAttr(originalProps.isRequired),
        "data-invalid": dataAttr(isInvalid),
        "data-disabled": dataAttr(originalProps.isDisabled),
        "data-has-elements": dataAttr(hasElements),
        "data-has-helper": dataAttr(hasHelper),
        "data-has-label": dataAttr(hasLabel),
        "data-has-value": dataAttr(!isPlaceholderShown),
        ...focusWithinProps,
        ...props2
      };
    },
    [
      slots,
      baseStyles,
      isFilled,
      isFocused,
      isHovered,
      isLabelHovered,
      isInvalid,
      hasHelper,
      hasLabel,
      hasElements,
      isPlaceholderShown,
      hasStartContent,
      isFocusWithin,
      isFocusVisible,
      hasPlaceholder,
      focusWithinProps,
      originalProps.isReadOnly,
      originalProps.isRequired,
      originalProps.isDisabled
    ]
  );
  const getLabelProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "label",
        className: slots.label({ class: classNames2 == null ? void 0 : classNames2.label }),
        ...mergeProps$3(labelProps, labelHoverProps, props2)
      };
    },
    [slots, isLabelHovered, labelProps, classNames2 == null ? void 0 : classNames2.label]
  );
  const getNumberInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        "data-slot": "input",
        "data-filled": dataAttr(isFilled),
        "data-has-start-content": dataAttr(hasStartContent),
        "data-has-end-content": dataAttr(!!endContent),
        className: slots.input({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.input, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(
          focusProps,
          inputProps,
          filterDOMProps(otherProps, {
            enabled: true,
            labelable: true,
            omitEventNames: new Set(Object.keys(inputProps)),
            omitPropNames: /* @__PURE__ */ new Set(["value"])
          }),
          props2
        ),
        "aria-readonly": dataAttr(originalProps.isReadOnly),
        onChange: chain(inputProps.onChange, onChange),
        onKeyDown: chain(inputProps.onKeyDown, props2.onKeyDown, handleKeyDown),
        ref: domRef
      };
    },
    [
      slots,
      focusProps,
      inputProps,
      otherProps,
      isFilled,
      hasStartContent,
      endContent,
      classNames2 == null ? void 0 : classNames2.input,
      originalProps.isReadOnly,
      originalProps.isRequired,
      onChange,
      handleKeyDown
    ]
  );
  const getHiddenNumberInputProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        name: originalProps.name,
        value: inputValue,
        "data-slot": "hidden-input",
        type: "hidden",
        ...props2
      };
    },
    [inputValue, originalProps.name]
  );
  const getInputWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: inputWrapperRef,
        "data-slot": "input-wrapper",
        "data-hover": dataAttr(isHovered || isLabelHovered),
        "data-focus-visible": dataAttr(isFocusVisible),
        "data-focus": dataAttr(isFocused),
        className: slots.inputWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.inputWrapper, isFilled ? "is-filled" : "")
        }),
        ...mergeProps$3(props2, hoverProps),
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        style: {
          cursor: "text",
          ...props2.style
        }
      };
    },
    [
      slots,
      isHovered,
      isLabelHovered,
      isFocusVisible,
      isFocused,
      inputValue,
      classNames2 == null ? void 0 : classNames2.inputWrapper
    ]
  );
  const getInnerWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ref: innerWrapperRef,
        "data-slot": "inner-wrapper",
        onClick: (e2) => {
          if (domRef.current && e2.currentTarget === e2.target) {
            domRef.current.focus();
          }
        },
        className: slots.innerWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.innerWrapper, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(groupProps, props2)
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.innerWrapper]
  );
  const getMainWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "main-wrapper",
        className: slots.mainWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.mainWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.mainWrapper]
  );
  const getHelperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "helper-wrapper",
        className: slots.helperWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.helperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.helperWrapper]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...descriptionProps,
        "data-slot": "description",
        className: slots.description({ class: clsx$5(classNames2 == null ? void 0 : classNames2.label, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, classNames2 == null ? void 0 : classNames2.description]
  );
  const getErrorMessageProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        ...errorMessageProps,
        "data-slot": "error-message",
        className: slots.errorMessage({ class: clsx$5(classNames2 == null ? void 0 : classNames2.errorMessage, props2 == null ? void 0 : props2.className) })
      };
    },
    [slots, errorMessageProps, classNames2 == null ? void 0 : classNames2.errorMessage]
  );
  const getClearButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        tabIndex: -1,
        disabled: originalProps.isDisabled,
        "aria-label": "clear input",
        "data-slot": "clear-button",
        "data-focus-visible": dataAttr(isClearButtonFocusVisible),
        className: slots.clearButton({ class: clsx$5(classNames2 == null ? void 0 : classNames2.clearButton, props2 == null ? void 0 : props2.className) }),
        ...mergeProps$3(clearPressProps, clearFocusProps)
      };
    },
    [slots, isClearButtonFocusVisible, clearPressProps, clearFocusProps, classNames2 == null ? void 0 : classNames2.clearButton]
  );
  const getStepperWrapperProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        "data-slot": "stepper-wrapper",
        className: slots.stepperWrapper({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.stepperWrapper, props2 == null ? void 0 : props2.className)
        })
      };
    },
    [slots]
  );
  const getStepperIncreaseButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        ...props2,
        type: "button",
        disabled: originalProps.isDisabled,
        "data-slot": "increase-button",
        className: slots.stepperButton({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.stepperButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(incrementButtonProps, props2)
      };
    },
    [slots, incrementButtonProps, classNames2 == null ? void 0 : classNames2.stepperButton]
  );
  const getStepperDecreaseButtonProps = reactExports.useCallback(
    (props2 = {}) => {
      return {
        type: "button",
        disabled: originalProps.isDisabled,
        "data-slot": "decrease-button",
        className: slots.stepperButton({
          class: clsx$5(classNames2 == null ? void 0 : classNames2.stepperButton, props2 == null ? void 0 : props2.className)
        }),
        ...mergeProps$3(decrementButtonProps, props2)
      };
    },
    [slots, decrementButtonProps, classNames2 == null ? void 0 : classNames2.stepperButton]
  );
  return {
    Component: Component2,
    classNames: classNames2,
    type: type4,
    domRef,
    label,
    description,
    startContent,
    endContent,
    labelPlacement,
    isClearable,
    hasHelper,
    hasStartContent,
    isLabelOutside,
    isOutsideLeft,
    isLabelOutsideAsPlaceholder,
    shouldLabelBeOutside,
    shouldLabelBeInside,
    hasPlaceholder,
    isInvalid,
    errorMessage,
    hideStepper,
    incrementButtonProps,
    decrementButtonProps,
    getBaseProps,
    getLabelProps,
    getNumberInputProps,
    getHiddenNumberInputProps,
    getMainWrapperProps,
    getInputWrapperProps,
    getInnerWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps,
    getStepperIncreaseButtonProps,
    getStepperDecreaseButtonProps,
    getStepperWrapperProps
  };
}
var NumberInput = forwardRef((props, ref) => {
  const {
    Component: Component2,
    label,
    description,
    isClearable,
    startContent,
    endContent,
    labelPlacement,
    hasHelper,
    isOutsideLeft,
    shouldLabelBeOutside,
    errorMessage,
    isInvalid,
    hideStepper,
    getBaseProps,
    getLabelProps,
    getNumberInputProps,
    getHiddenNumberInputProps,
    getInnerWrapperProps,
    getInputWrapperProps,
    getMainWrapperProps,
    getHelperWrapperProps,
    getDescriptionProps,
    getErrorMessageProps,
    getClearButtonProps,
    getStepperIncreaseButtonProps,
    getStepperDecreaseButtonProps,
    getStepperWrapperProps
  } = useNumberInput({ ...props, ref });
  const labelContent = label ? /* @__PURE__ */ jsxRuntimeExports.jsx("label", { ...getLabelProps(), children: label }) : null;
  const end = reactExports.useMemo(() => {
    if (isClearable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("button", { ...getClearButtonProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseFilledIcon, {}) }),
        endContent
      ] });
    }
    return endContent;
  }, [isClearable, getClearButtonProps]);
  const helperWrapper = reactExports.useMemo(() => {
    const shouldShowError = isInvalid && errorMessage;
    const hasContent = shouldShowError || description;
    if (!hasHelper || !hasContent)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getHelperWrapperProps(), children: shouldShowError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getErrorMessageProps(), children: errorMessage }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: description }) });
  }, [
    hasHelper,
    isInvalid,
    errorMessage,
    description,
    getHelperWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  const innerWrapper = reactExports.useMemo(() => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInnerWrapperProps(), children: [
      startContent,
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getNumberInputProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...getHiddenNumberInputProps() }),
      end,
      !hideStepper && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getStepperWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_stepper_default, { ...getStepperIncreaseButtonProps(), direction: "up" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_stepper_default, { ...getStepperDecreaseButtonProps(), direction: "down" })
      ] })
    ] });
  }, [startContent, end, getNumberInputProps, getInnerWrapperProps]);
  const mainWrapper = reactExports.useMemo(() => {
    if (shouldLabelBeOutside) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getMainWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
          !isOutsideLeft ? labelContent : null,
          innerWrapper
        ] }),
        helperWrapper
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getInputWrapperProps(), children: [
        labelContent,
        innerWrapper
      ] }),
      helperWrapper
    ] });
  }, [
    labelPlacement,
    helperWrapper,
    shouldLabelBeOutside,
    labelContent,
    innerWrapper,
    errorMessage,
    description,
    getMainWrapperProps,
    getInputWrapperProps,
    getErrorMessageProps,
    getDescriptionProps
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ...getBaseProps(), children: [
    isOutsideLeft ? labelContent : null,
    mainWrapper
  ] });
});
NumberInput.displayName = "HeroUI.NumberInput";
var number_input_default = NumberInput;
var $ff9177efc58547ad$exports = {};
$ff9177efc58547ad$exports = {
  "close": `إغلاق`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} إشعار`,
    other: () => `${formatter.number(args.count)} إشعارات`
  })}.`
};
var $25eb7c0c0c45e544$exports = {};
$25eb7c0c0c45e544$exports = {
  "close": `Затвори`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} известие`,
    other: () => `${formatter.number(args.count)} известия`
  })}.`
};
var $28feffc3d61a8691$exports = {};
$28feffc3d61a8691$exports = {
  "close": `Zavřít`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} oznámení`,
    other: () => `${formatter.number(args.count)} oznámení`
  })}.`
};
var $390d441203d25ff4$exports = {};
$390d441203d25ff4$exports = {
  "close": `Luk`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} besked`,
    other: () => `${formatter.number(args.count)} beskeder`
  })}.`
};
var $7063c2d0f14f979a$exports = {};
$7063c2d0f14f979a$exports = {
  "close": `Schließen`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} Benachrichtigung`,
    other: () => `${formatter.number(args.count)} Benachrichtigungen`
  })}.`
};
var $2dfc1dbb6590af88$exports = {};
$2dfc1dbb6590af88$exports = {
  "close": `Κλείσιμο`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} ειδοποίηση`,
    other: () => `${formatter.number(args.count)} ειδοποιήσεις`
  })}.`
};
var $9a12ff1caae5a7a5$exports = {};
$9a12ff1caae5a7a5$exports = {
  "close": `Close`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notification`,
    other: () => `${formatter.number(args.count)} notifications`
  })}.`
};
var $f4095fb5a72adbe6$exports = {};
$f4095fb5a72adbe6$exports = {
  "close": `Cerrar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificación`,
    other: () => `${formatter.number(args.count)} notificaciones`
  })}.`
};
var $75bc5191b9d7826a$exports = {};
$75bc5191b9d7826a$exports = {
  "close": `Sule`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} teatis`,
    other: () => `${formatter.number(args.count)} teatist`
  })}.`
};
var $e4b9aef18b0db8dc$exports = {};
$e4b9aef18b0db8dc$exports = {
  "close": `Sulje`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} ilmoitus`,
    other: () => `${formatter.number(args.count)} ilmoitusta`
  })}.`
};
var $888756784d832bd7$exports = {};
$888756784d832bd7$exports = {
  "close": `Fermer`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notification`,
    other: () => `${formatter.number(args.count)} notifications`
  })}.`
};
var $6835949b68a1fabf$exports = {};
$6835949b68a1fabf$exports = {
  "close": `סגור`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} התראה`,
    other: () => `${formatter.number(args.count)} התראות`
  })}.`
};
var $87ffcbc0b651e40b$exports = {};
$87ffcbc0b651e40b$exports = {
  "close": `Zatvori`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obavijest`,
    other: () => `${formatter.number(args.count)} obavijesti`
  })}.`
};
var $dc6e3b2813600d69$exports = {};
$dc6e3b2813600d69$exports = {
  "close": `Bezárás`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} értesítés`,
    other: () => `${formatter.number(args.count)} értesítés`
  })}.`
};
var $fe136bcbacfcfa14$exports = {};
$fe136bcbacfcfa14$exports = {
  "close": `Chiudi`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notifica`,
    other: () => `${formatter.number(args.count)} notifiche`
  })}.`
};
var $8fb53a929b46df83$exports = {};
$8fb53a929b46df83$exports = {
  "close": `閉じる`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 個の通知`,
    other: () => `${formatter.number(args.count)} 個の通知`
  })}。`
};
var $2c38dbfaf041a865$exports = {};
$2c38dbfaf041a865$exports = {
  "close": `닫기`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)}개 알림`,
    other: () => `${formatter.number(args.count)}개 알림`
  })}.`
};
var $48f3f33a29908d4c$exports = {};
$48f3f33a29908d4c$exports = {
  "close": `Uždaryti`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} pranešimas`,
    other: () => `${formatter.number(args.count)} pranešimai`
  })}.`
};
var $9867160d996455a0$exports = {};
$9867160d996455a0$exports = {
  "close": `Aizvērt`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} paziņojums`,
    other: () => `${formatter.number(args.count)} paziņojumi`
  })}.`
};
var $196258ea25c96487$exports = {};
$196258ea25c96487$exports = {
  "close": `Lukk`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} varsling`,
    other: () => `${formatter.number(args.count)} varsler`
  })}.`
};
var $949061cb954e8000$exports = {};
$949061cb954e8000$exports = {
  "close": `Sluiten`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} melding`,
    other: () => `${formatter.number(args.count)} meldingen`
  })}.`
};
var $8189bed27add1ad3$exports = {};
$8189bed27add1ad3$exports = {
  "close": `Zamknij`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} powiadomienie`,
    few: () => `${formatter.number(args.count)} powiadomienia`,
    many: () => `${formatter.number(args.count)} powiadomień`,
    other: () => `${formatter.number(args.count)} powiadomienia`
  })}.`
};
var $a361756a93b6e28c$exports = {};
$a361756a93b6e28c$exports = {
  "close": `Fechar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificação`,
    other: () => `${formatter.number(args.count)} notificações`
  })}.`
};
var $034c7393857c8db0$exports = {};
$034c7393857c8db0$exports = {
  "close": `Fechar`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificação`,
    other: () => `${formatter.number(args.count)} notificações`
  })}.`
};
var $e33d3b3868478b04$exports = {};
$e33d3b3868478b04$exports = {
  "close": `Închideţi`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} notificare`,
    other: () => `${formatter.number(args.count)} notificări`
  })}.`
};
var $9a7dcb914b29cd9f$exports = {};
$9a7dcb914b29cd9f$exports = {
  "close": `Закрыть`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} уведомление`,
    other: () => `${formatter.number(args.count)} уведомления`
  })}.`
};
var $e43d964a0c7f1266$exports = {};
$e43d964a0c7f1266$exports = {
  "close": `Zatvoriť`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} oznámenie`,
    few: () => `${formatter.number(args.count)} oznámenia`,
    other: () => `${formatter.number(args.count)} oznámení`
  })}.`
};
var $0bc56cee3275bcaa$exports = {};
$0bc56cee3275bcaa$exports = {
  "close": `Zapri`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obvestilo`,
    two: () => `${formatter.number(args.count)} obvestili`,
    few: () => `${formatter.number(args.count)} obvestila`,
    other: () => `${formatter.number(args.count)} obvestil`
  })}.`
};
var $7dbdd7289c10d2ba$exports = {};
$7dbdd7289c10d2ba$exports = {
  "close": `Zatvori`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} obaveštenje`,
    other: () => `${formatter.number(args.count)} obaveštenja`
  })}.`
};
var $ccbe6066c10b1e53$exports = {};
$ccbe6066c10b1e53$exports = {
  "close": `Stäng`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} meddelande`,
    other: () => `${formatter.number(args.count)} meddelanden`
  })}.`
};
var $9d503476b9d858b7$exports = {};
$9d503476b9d858b7$exports = {
  "close": `Kapat`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} bildirim`,
    other: () => `${formatter.number(args.count)} bildirim`
  })}.`
};
var $32ee419c7b9b7a83$exports = {};
$32ee419c7b9b7a83$exports = {
  "close": `Закрити`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} сповіщення`,
    other: () => `${formatter.number(args.count)} сповіщення`
  })}.`
};
var $122525af1cb737c7$exports = {};
$122525af1cb737c7$exports = {
  "close": `关闭`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 个通知`,
    other: () => `${formatter.number(args.count)} 个通知`
  })}。`
};
var $52e8b1b00094e5a3$exports = {};
$52e8b1b00094e5a3$exports = {
  "close": `關閉`,
  "notifications": (args, formatter) => `${formatter.plural(args.count, {
    one: () => `${formatter.number(args.count)} 個通知`,
    other: () => `${formatter.number(args.count)} 個通知`
  })}。`
};
var $7853651519a70071$exports = {};
$7853651519a70071$exports = {
  "ar-AE": $ff9177efc58547ad$exports,
  "bg-BG": $25eb7c0c0c45e544$exports,
  "cs-CZ": $28feffc3d61a8691$exports,
  "da-DK": $390d441203d25ff4$exports,
  "de-DE": $7063c2d0f14f979a$exports,
  "el-GR": $2dfc1dbb6590af88$exports,
  "en-US": $9a12ff1caae5a7a5$exports,
  "es-ES": $f4095fb5a72adbe6$exports,
  "et-EE": $75bc5191b9d7826a$exports,
  "fi-FI": $e4b9aef18b0db8dc$exports,
  "fr-FR": $888756784d832bd7$exports,
  "he-IL": $6835949b68a1fabf$exports,
  "hr-HR": $87ffcbc0b651e40b$exports,
  "hu-HU": $dc6e3b2813600d69$exports,
  "it-IT": $fe136bcbacfcfa14$exports,
  "ja-JP": $8fb53a929b46df83$exports,
  "ko-KR": $2c38dbfaf041a865$exports,
  "lt-LT": $48f3f33a29908d4c$exports,
  "lv-LV": $9867160d996455a0$exports,
  "nb-NO": $196258ea25c96487$exports,
  "nl-NL": $949061cb954e8000$exports,
  "pl-PL": $8189bed27add1ad3$exports,
  "pt-BR": $a361756a93b6e28c$exports,
  "pt-PT": $034c7393857c8db0$exports,
  "ro-RO": $e33d3b3868478b04$exports,
  "ru-RU": $9a7dcb914b29cd9f$exports,
  "sk-SK": $e43d964a0c7f1266$exports,
  "sl-SI": $0bc56cee3275bcaa$exports,
  "sr-SP": $7dbdd7289c10d2ba$exports,
  "sv-SE": $ccbe6066c10b1e53$exports,
  "tr-TR": $9d503476b9d858b7$exports,
  "uk-UA": $32ee419c7b9b7a83$exports,
  "zh-CN": $122525af1cb737c7$exports,
  "zh-TW": $52e8b1b00094e5a3$exports
};
function $parcel$interopDefault$1(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $d6542812f0669241$export$a407b657d3044108(props, state, ref) {
  let { key, timer, timeout } = props.toast;
  reactExports.useEffect(() => {
    if (timer == null || timeout == null)
      return;
    timer.reset(timeout);
    return () => {
      timer.pause();
    };
  }, [
    timer,
    timeout
  ]);
  let titleId = $bdb11010cef70236$export$f680877a34711e37$2();
  let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8$1();
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault$1($7853651519a70071$exports), "@react-aria/toast");
  let [isVisible2, setIsVisible] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setIsVisible(true);
  }, []);
  let toastProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f$4(props, {
    labelable: true
  });
  return {
    toastProps: {
      ...toastProps,
      role: "alertdialog",
      "aria-modal": "false",
      "aria-labelledby": props["aria-labelledby"] || titleId,
      "aria-describedby": props["aria-describedby"] || descriptionId,
      tabIndex: 0
    },
    contentProps: {
      role: "alert",
      "aria-atomic": "true",
      "aria-hidden": isVisible2 ? void 0 : "true"
    },
    titleProps: {
      id: titleId
    },
    descriptionProps: {
      id: descriptionId
    },
    closeButtonProps: {
      "aria-label": stringFormatter.format("close"),
      onPress: () => state.close(key)
    }
  };
}
var shim$1 = { exports: {} };
var useSyncExternalStoreShim_production = {};
/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var React$5 = reactExports;
function is(x2, y2) {
  return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
}
var objectIs = "function" === typeof Object.is ? Object.is : is, useState$1 = React$5.useState, useEffect = React$5.useEffect, useLayoutEffect$2 = React$5.useLayoutEffect, useDebugValue = React$5.useDebugValue;
function useSyncExternalStore$2(subscribe2, getSnapshot2) {
  var value2 = getSnapshot2(), _useState = useState$1({ inst: { value: value2, getSnapshot: getSnapshot2 } }), inst = _useState[0].inst, forceUpdate = _useState[1];
  useLayoutEffect$2(
    function() {
      inst.value = value2;
      inst.getSnapshot = getSnapshot2;
      checkIfSnapshotChanged(inst) && forceUpdate({ inst });
    },
    [subscribe2, value2, getSnapshot2]
  );
  useEffect(
    function() {
      checkIfSnapshotChanged(inst) && forceUpdate({ inst });
      return subscribe2(function() {
        checkIfSnapshotChanged(inst) && forceUpdate({ inst });
      });
    },
    [subscribe2]
  );
  useDebugValue(value2);
  return value2;
}
function checkIfSnapshotChanged(inst) {
  var latestGetSnapshot = inst.getSnapshot;
  inst = inst.value;
  try {
    var nextValue = latestGetSnapshot();
    return !objectIs(inst, nextValue);
  } catch (error2) {
    return true;
  }
}
function useSyncExternalStore$1(subscribe2, getSnapshot2) {
  return getSnapshot2();
}
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React$5.useSyncExternalStore ? React$5.useSyncExternalStore : shim;
{
  shim$1.exports = useSyncExternalStoreShim_production;
}
var shimExports = shim$1.exports;
const $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION = 1;
const $a86207c5d7f7e1fb$var$landmarkSymbol = Symbol.for("react-aria-landmark-manager");
function $a86207c5d7f7e1fb$var$subscribe(fn) {
  document.addEventListener("react-aria-landmark-manager-change", fn);
  return () => document.removeEventListener("react-aria-landmark-manager-change", fn);
}
function $a86207c5d7f7e1fb$var$getLandmarkManager() {
  if (typeof document === "undefined")
    return null;
  let instance2 = document[$a86207c5d7f7e1fb$var$landmarkSymbol];
  if (instance2 && instance2.version >= $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION)
    return instance2;
  document[$a86207c5d7f7e1fb$var$landmarkSymbol] = new $a86207c5d7f7e1fb$var$LandmarkManager();
  document.dispatchEvent(new CustomEvent("react-aria-landmark-manager-change"));
  return document[$a86207c5d7f7e1fb$var$landmarkSymbol];
}
function $a86207c5d7f7e1fb$var$useLandmarkManager() {
  return shimExports.useSyncExternalStore($a86207c5d7f7e1fb$var$subscribe, $a86207c5d7f7e1fb$var$getLandmarkManager, $a86207c5d7f7e1fb$var$getLandmarkManager);
}
class $a86207c5d7f7e1fb$var$LandmarkManager {
  setupIfNeeded() {
    if (this.isListening)
      return;
    document.addEventListener("keydown", this.f6Handler, {
      capture: true
    });
    document.addEventListener("focusin", this.focusinHandler, {
      capture: true
    });
    document.addEventListener("focusout", this.focusoutHandler, {
      capture: true
    });
    this.isListening = true;
  }
  teardownIfNeeded() {
    if (!this.isListening || this.landmarks.length > 0 || this.refCount > 0)
      return;
    document.removeEventListener("keydown", this.f6Handler, {
      capture: true
    });
    document.removeEventListener("focusin", this.focusinHandler, {
      capture: true
    });
    document.removeEventListener("focusout", this.focusoutHandler, {
      capture: true
    });
    this.isListening = false;
  }
  focusLandmark(landmark, direction) {
    var _this_landmarks_find_focus, _this_landmarks_find;
    (_this_landmarks_find = this.landmarks.find((l2) => l2.ref.current === landmark)) === null || _this_landmarks_find === void 0 ? void 0 : (_this_landmarks_find_focus = _this_landmarks_find.focus) === null || _this_landmarks_find_focus === void 0 ? void 0 : _this_landmarks_find_focus.call(_this_landmarks_find, direction);
  }
  /**
  * Return set of landmarks with a specific role.
  */
  getLandmarksByRole(role) {
    return new Set(this.landmarks.filter((l2) => l2.role === role));
  }
  /**
  * Return first landmark with a specific role.
  */
  getLandmarkByRole(role) {
    return this.landmarks.find((l2) => l2.role === role);
  }
  addLandmark(newLandmark) {
    this.setupIfNeeded();
    if (this.landmarks.find((landmark) => landmark.ref === newLandmark.ref) || !newLandmark.ref.current)
      return;
    if (this.landmarks.filter((landmark) => landmark.role === "main").length > 1 && false)
      ;
    if (this.landmarks.length === 0) {
      this.landmarks = [
        newLandmark
      ];
      this.checkLabels(newLandmark.role);
      return;
    }
    let start = 0;
    let end = this.landmarks.length - 1;
    while (start <= end) {
      let mid = Math.floor((start + end) / 2);
      let comparedPosition = newLandmark.ref.current.compareDocumentPosition(this.landmarks[mid].ref.current);
      let isNewAfterExisting = Boolean(comparedPosition & Node.DOCUMENT_POSITION_PRECEDING || comparedPosition & Node.DOCUMENT_POSITION_CONTAINS);
      if (isNewAfterExisting)
        start = mid + 1;
      else
        end = mid - 1;
    }
    this.landmarks.splice(start, 0, newLandmark);
    this.checkLabels(newLandmark.role);
  }
  updateLandmark(landmark) {
    let index2 = this.landmarks.findIndex((l2) => l2.ref === landmark.ref);
    if (index2 >= 0) {
      this.landmarks[index2] = {
        ...this.landmarks[index2],
        ...landmark
      };
      this.checkLabels(this.landmarks[index2].role);
    }
  }
  removeLandmark(ref) {
    this.landmarks = this.landmarks.filter((landmark) => landmark.ref !== ref);
    this.teardownIfNeeded();
  }
  /**
  * Warn if there are 2+ landmarks with the same role but no label.
  * Labels for landmarks with the same role must also be unique.
  *
  * See https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/.
  */
  checkLabels(role) {
    let landmarksWithRole = this.getLandmarksByRole(role);
    if (landmarksWithRole.size > 1) {
      [
        ...landmarksWithRole
      ].filter((landmark) => !landmark.label);
    }
  }
  /**
  * Get the landmark that is the closest parent in the DOM.
  * Returns undefined if no parent is a landmark.
  */
  closestLandmark(element2) {
    let landmarkMap = new Map(this.landmarks.map((l2) => [
      l2.ref.current,
      l2
    ]));
    let currentElement = element2;
    while (currentElement && !landmarkMap.has(currentElement) && currentElement !== document.body && currentElement.parentElement)
      currentElement = currentElement.parentElement;
    return landmarkMap.get(currentElement);
  }
  /**
  * Gets the next landmark, in DOM focus order, or previous if backwards is specified.
  * If last landmark, next should be the first landmark.
  * If not inside a landmark, will return first landmark.
  * Returns undefined if there are no landmarks.
  */
  getNextLandmark(element2, { backward }) {
    var _this_landmarks_nextLandmarkIndex_ref_current;
    let currentLandmark = this.closestLandmark(element2);
    let nextLandmarkIndex = backward ? this.landmarks.length - 1 : 0;
    if (currentLandmark)
      nextLandmarkIndex = this.landmarks.indexOf(currentLandmark) + (backward ? -1 : 1);
    let wrapIfNeeded = () => {
      if (nextLandmarkIndex < 0) {
        if (!element2.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
          detail: {
            direction: "backward"
          },
          bubbles: true,
          cancelable: true
        })))
          return true;
        nextLandmarkIndex = this.landmarks.length - 1;
      } else if (nextLandmarkIndex >= this.landmarks.length) {
        if (!element2.dispatchEvent(new CustomEvent("react-aria-landmark-navigation", {
          detail: {
            direction: "forward"
          },
          bubbles: true,
          cancelable: true
        })))
          return true;
        nextLandmarkIndex = 0;
      }
      if (nextLandmarkIndex < 0 || nextLandmarkIndex >= this.landmarks.length)
        return true;
      return false;
    };
    if (wrapIfNeeded())
      return void 0;
    let i2 = nextLandmarkIndex;
    while ((_this_landmarks_nextLandmarkIndex_ref_current = this.landmarks[nextLandmarkIndex].ref.current) === null || _this_landmarks_nextLandmarkIndex_ref_current === void 0 ? void 0 : _this_landmarks_nextLandmarkIndex_ref_current.closest("[aria-hidden=true]")) {
      nextLandmarkIndex += backward ? -1 : 1;
      if (wrapIfNeeded())
        return void 0;
      if (nextLandmarkIndex === i2)
        break;
    }
    return this.landmarks[nextLandmarkIndex];
  }
  /**
  * Look at next landmark. If an element was previously focused inside, restore focus there.
  * If not, focus the landmark itself.
  * If no landmarks at all, or none with focusable elements, don't move focus.
  */
  f6Handler(e2) {
    if (e2.key === "F6") {
      let handled = e2.altKey ? this.focusMain() : this.navigate(e2.target, e2.shiftKey);
      if (handled) {
        e2.preventDefault();
        e2.stopPropagation();
      }
    }
  }
  focusMain() {
    let main2 = this.getLandmarkByRole("main");
    if (main2 && main2.ref.current && document.contains(main2.ref.current)) {
      this.focusLandmark(main2.ref.current, "forward");
      return true;
    }
    return false;
  }
  navigate(from2, backward) {
    let nextLandmark = this.getNextLandmark(from2, {
      backward
    });
    if (!nextLandmark)
      return false;
    if (nextLandmark.lastFocused) {
      let lastFocused = nextLandmark.lastFocused;
      if (document.body.contains(lastFocused)) {
        lastFocused.focus();
        return true;
      }
    }
    if (nextLandmark.ref.current && document.contains(nextLandmark.ref.current)) {
      this.focusLandmark(nextLandmark.ref.current, backward ? "backward" : "forward");
      return true;
    }
    return false;
  }
  /**
  * Sets lastFocused for a landmark, if focus is moved within that landmark.
  * Lets the last focused landmark know it was blurred if something else is focused.
  */
  focusinHandler(e2) {
    let currentLandmark = this.closestLandmark(e2.target);
    if (currentLandmark && currentLandmark.ref.current !== e2.target)
      this.updateLandmark({
        ref: currentLandmark.ref,
        lastFocused: e2.target
      });
    let previousFocusedElement = e2.relatedTarget;
    if (previousFocusedElement) {
      let closestPreviousLandmark = this.closestLandmark(previousFocusedElement);
      if (closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement)
        closestPreviousLandmark.blur();
    }
  }
  /**
  * Track if the focus is lost to the body. If it is, do cleanup on the landmark that last had focus.
  */
  focusoutHandler(e2) {
    let previousFocusedElement = e2.target;
    let nextFocusedElement = e2.relatedTarget;
    if (!nextFocusedElement || nextFocusedElement === document) {
      let closestPreviousLandmark = this.closestLandmark(previousFocusedElement);
      if (closestPreviousLandmark && closestPreviousLandmark.ref.current === previousFocusedElement)
        closestPreviousLandmark.blur();
    }
  }
  createLandmarkController() {
    let instance2 = this;
    instance2.refCount++;
    instance2.setupIfNeeded();
    return {
      navigate(direction, opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, direction === "backward");
      },
      focusNext(opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, false);
      },
      focusPrevious(opts2) {
        let element2 = (opts2 === null || opts2 === void 0 ? void 0 : opts2.from) || document.activeElement;
        return instance2.navigate(element2, true);
      },
      focusMain() {
        return instance2.focusMain();
      },
      dispose() {
        if (instance2) {
          instance2.refCount--;
          instance2.teardownIfNeeded();
          instance2 = null;
        }
      }
    };
  }
  registerLandmark(landmark) {
    if (this.landmarks.find((l2) => l2.ref === landmark.ref))
      this.updateLandmark(landmark);
    else
      this.addLandmark(landmark);
    return () => this.removeLandmark(landmark.ref);
  }
  constructor() {
    this.landmarks = [];
    this.isListening = false;
    this.refCount = 0;
    this.version = $a86207c5d7f7e1fb$var$LANDMARK_API_VERSION;
    this.f6Handler = this.f6Handler.bind(this);
    this.focusinHandler = this.focusinHandler.bind(this);
    this.focusoutHandler = this.focusoutHandler.bind(this);
  }
}
function $a86207c5d7f7e1fb$export$4cc632584fd87fae(props, ref) {
  const { role, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, focus } = props;
  let manager = $a86207c5d7f7e1fb$var$useLandmarkManager();
  let label = ariaLabel || ariaLabelledby;
  let [isLandmarkFocused, setIsLandmarkFocused] = reactExports.useState(false);
  let defaultFocus = reactExports.useCallback(() => {
    setIsLandmarkFocused(true);
  }, [
    setIsLandmarkFocused
  ]);
  let blur = reactExports.useCallback(() => {
    setIsLandmarkFocused(false);
  }, [
    setIsLandmarkFocused
  ]);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (manager)
      return manager.registerLandmark({
        ref,
        label,
        role,
        focus: focus || defaultFocus,
        blur
      });
  }, [
    manager,
    label,
    ref,
    role,
    focus,
    defaultFocus,
    blur
  ]);
  reactExports.useEffect(() => {
    var _ref_current;
    if (isLandmarkFocused)
      (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.focus();
  }, [
    isLandmarkFocused,
    ref
  ]);
  return {
    landmarkProps: {
      role,
      tabIndex: isLandmarkFocused ? -1 : void 0,
      "aria-label": ariaLabel,
      "aria-labelledby": ariaLabelledby
    }
  };
}
function $parcel$interopDefault(a2) {
  return a2 && a2.__esModule ? a2.default : a2;
}
function $6cc546b19ee7130a$export$b8cbbb20a51697de(props, state, ref) {
  let stringFormatter = $fca6afa0e843324b$export$f12b703ca79dfbb1$1($parcel$interopDefault($7853651519a70071$exports), "@react-aria/toast");
  let { landmarkProps } = $a86207c5d7f7e1fb$export$4cc632584fd87fae({
    role: "region",
    "aria-label": props["aria-label"] || stringFormatter.format("notifications", {
      count: state.visibleToasts.length
    })
  }, ref);
  let isHovered = reactExports.useRef(false);
  let isFocused = reactExports.useRef(false);
  let updateTimers = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4(() => {
    if (isHovered.current || isFocused.current)
      state.pauseAll();
    else
      state.resumeAll();
  });
  let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456$h({
    onHoverStart: () => {
      isHovered.current = true;
      updateTimers();
    },
    onHoverEnd: () => {
      isHovered.current = false;
      updateTimers();
    }
  });
  let toasts = reactExports.useRef([]);
  let prevVisibleToasts = reactExports.useRef(state.visibleToasts);
  let focusedToast = reactExports.useRef(null);
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    if (focusedToast.current === -1 || state.visibleToasts.length === 0 || !ref.current) {
      toasts.current = [];
      prevVisibleToasts.current = state.visibleToasts;
      return;
    }
    toasts.current = [
      ...ref.current.querySelectorAll('[role="alertdialog"]')
    ];
    if (prevVisibleToasts.current.length === state.visibleToasts.length && state.visibleToasts.every((t2, i2) => t2.key === prevVisibleToasts.current[i2].key)) {
      prevVisibleToasts.current = state.visibleToasts;
      return;
    }
    let allToasts = prevVisibleToasts.current.map((t2, i2) => ({
      ...t2,
      i: i2,
      isRemoved: !state.visibleToasts.some((t22) => t2.key === t22.key)
    }));
    let removedFocusedToastIndex = allToasts.findIndex((t2) => t2.i === focusedToast.current && t2.isRemoved);
    if (removedFocusedToastIndex > -1) {
      var _lastFocused_current;
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer" && ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected))
        $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
      else {
        let i2 = 0;
        let nextToast;
        let prevToast;
        while (i2 <= removedFocusedToastIndex) {
          if (!allToasts[i2].isRemoved)
            prevToast = Math.max(0, i2 - 1);
          i2++;
        }
        while (i2 < allToasts.length) {
          if (!allToasts[i2].isRemoved) {
            nextToast = i2 - 1;
            break;
          }
          i2++;
        }
        if (prevToast === void 0 && nextToast === void 0)
          prevToast = 0;
        if (prevToast >= 0 && prevToast < toasts.current.length)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(toasts.current[prevToast]);
        else if (nextToast >= 0 && nextToast < toasts.current.length)
          $7215afc6de606d6b$export$de79e2c695e052f3$5(toasts.current[nextToast]);
      }
    }
    prevVisibleToasts.current = state.visibleToasts;
  }, [
    state.visibleToasts,
    ref,
    updateTimers
  ]);
  let lastFocused = reactExports.useRef(null);
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec$4({
    onFocusWithin: (e2) => {
      isFocused.current = true;
      lastFocused.current = e2.relatedTarget;
      updateTimers();
    },
    onBlurWithin: () => {
      isFocused.current = false;
      lastFocused.current = null;
      updateTimers();
    }
  });
  reactExports.useEffect(() => {
    var _lastFocused_current;
    if (state.visibleToasts.length === 0 && ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected)) {
      if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
        $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
      else
        lastFocused.current.focus();
      lastFocused.current = null;
    }
  }, [
    ref,
    state.visibleToasts.length
  ]);
  reactExports.useEffect(() => {
    return () => {
      var _lastFocused_current;
      if ((_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.isConnected) {
        if ($507fabe10e71c6fb$export$630ff653c5ada6a9$2() === "pointer")
          $7215afc6de606d6b$export$de79e2c695e052f3$5(lastFocused.current);
        else
          lastFocused.current.focus();
        lastFocused.current = null;
      }
    };
  }, [
    ref
  ]);
  return {
    regionProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(landmarkProps, hoverProps, focusWithinProps, {
      tabIndex: -1,
      // Mark the toast region as a "top layer", so that it:
      //   - is not aria-hidden when opening an overlay
      //   - allows focus even outside a containing focus scope
      //   - doesn’t dismiss overlays when clicking on it, even though it is outside
      // @ts-ignore
      "data-react-aria-top-layer": true,
      // listen to focus events separate from focuswithin because that will only fire once
      // and we need to follow all focus changes
      onFocus: (e2) => {
        let target = e2.target.closest('[role="alertdialog"]');
        focusedToast.current = toasts.current.findIndex((t2) => t2 === target);
      },
      onBlur: () => {
        focusedToast.current = -1;
      }
    })
  };
}
function $8a9cb279dc87e130$export$525bc4921d56d4a(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
  let stateRef = reactExports.useRef({
    isFocused: false,
    observer: null
  });
  $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c$5(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  let dispatchBlur = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onBlur === null || onBlur === void 0 ? void 0 : onBlur(e2);
  });
  return reactExports.useCallback((e2) => {
    if (e2.target instanceof HTMLButtonElement || e2.target instanceof HTMLInputElement || e2.target instanceof HTMLTextAreaElement || e2.target instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = e2.target;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a(e3);
          dispatchBlur(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          var _stateRef_current_observer;
          (_stateRef_current_observer = stateRef.current.observer) === null || _stateRef_current_observer === void 0 ? void 0 : _stateRef_current_observer.disconnect();
          let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    dispatchBlur
  ]);
}
let $8a9cb279dc87e130$export$fda7da73ab5d4c48 = false;
function $8a9cb279dc87e130$export$cabe61c495ee3649(target) {
  while (target && !$b4b717babfbb907b$export$4c063cf1350e6fed$3(target))
    target = target.parentElement;
  let window2 = $431fbd86ca7dc216$export$f21a1ffae260145a$4(target);
  let activeElement = window2.document.activeElement;
  if (!activeElement || activeElement === target)
    return;
  $8a9cb279dc87e130$export$fda7da73ab5d4c48 = true;
  let isRefocusing = false;
  let onBlur = (e2) => {
    if (e2.target === activeElement || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusOut = (e2) => {
    if (e2.target === activeElement || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!target && !isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  let onFocus = (e2) => {
    if (e2.target === target || isRefocusing)
      e2.stopImmediatePropagation();
  };
  let onFocusIn = (e2) => {
    if (e2.target === target || isRefocusing) {
      e2.stopImmediatePropagation();
      if (!isRefocusing) {
        isRefocusing = true;
        $7215afc6de606d6b$export$de79e2c695e052f3$5(activeElement);
        cleanup2();
      }
    }
  };
  window2.addEventListener("blur", onBlur, true);
  window2.addEventListener("focusout", onFocusOut, true);
  window2.addEventListener("focusin", onFocusIn, true);
  window2.addEventListener("focus", onFocus, true);
  let cleanup2 = () => {
    cancelAnimationFrame(raf3);
    window2.removeEventListener("blur", onBlur, true);
    window2.removeEventListener("focusout", onFocusOut, true);
    window2.removeEventListener("focusin", onFocusIn, true);
    window2.removeEventListener("focus", onFocus, true);
    $8a9cb279dc87e130$export$fda7da73ab5d4c48 = false;
    isRefocusing = false;
  };
  let raf3 = requestAnimationFrame(cleanup2);
  return cleanup2;
}
let $14c0b72509d70225$var$state = "default";
let $14c0b72509d70225$var$savedUserSelect = "";
let $14c0b72509d70225$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
function $14c0b72509d70225$export$16a4697467175487(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state === "default") {
      const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
      $14c0b72509d70225$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
      documentObject.documentElement.style.webkitUserSelect = "none";
    }
    $14c0b72509d70225$var$state = "disabled";
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
    $14c0b72509d70225$var$modifiedElementMap.set(target, target.style[property2]);
    target.style[property2] = "none";
  }
}
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
  if ($c87311424ea30a05$export$fedb369cb70207f1$3()) {
    if ($14c0b72509d70225$var$state !== "disabled")
      return;
    $14c0b72509d70225$var$state = "restoring";
    setTimeout(() => {
      $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
        if ($14c0b72509d70225$var$state === "restoring") {
          const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(target);
          if (documentObject.documentElement.style.webkitUserSelect === "none")
            documentObject.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
          $14c0b72509d70225$var$savedUserSelect = "";
          $14c0b72509d70225$var$state = "default";
        }
      });
    }, 300);
  } else if (target instanceof HTMLElement || target instanceof SVGElement) {
    if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
      let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
      let property2 = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
      if (target.style[property2] === "none")
        target.style[property2] = targetOldUserSelect;
      if (target.getAttribute("style") === "")
        target.removeAttribute("style");
      $14c0b72509d70225$var$modifiedElementMap.delete(target);
    }
  }
}
const $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = React$6.createContext({
  register: () => {
  }
});
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
function $f6c31cce2adf654f$var$usePressResponderContext(props) {
  let context = reactExports.useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5);
  if (context) {
    let { register: register2, ...contextProps } = context;
    props = $3ef42575df84b30b$export$9d1611c77c2fe928$9(contextProps, props);
    register2();
  }
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, props.ref);
  return props;
}
var $f6c31cce2adf654f$var$_shouldStopPropagation = /* @__PURE__ */ new WeakMap();
class $f6c31cce2adf654f$var$PressEvent12 {
  continuePropagation() {
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, false);
  }
  get shouldStopPropagation() {
    return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation);
  }
  constructor(type4, pointerType, originalEvent, state) {
    _class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation, {
      writable: true,
      value: void 0
    });
    _class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, true);
    var _state_target;
    let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
    const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
    let x2, y2 = 0;
    let clientX, clientY = null;
    if (originalEvent.clientX != null && originalEvent.clientY != null) {
      clientX = originalEvent.clientX;
      clientY = originalEvent.clientY;
    }
    if (rect) {
      if (clientX != null && clientY != null) {
        x2 = clientX - rect.left;
        y2 = clientY - rect.top;
      } else {
        x2 = rect.width / 2;
        y2 = rect.height / 2;
      }
    }
    this.type = type4;
    this.pointerType = pointerType;
    this.target = originalEvent.currentTarget;
    this.shiftKey = originalEvent.shiftKey;
    this.metaKey = originalEvent.metaKey;
    this.ctrlKey = originalEvent.ctrlKey;
    this.altKey = originalEvent.altKey;
    this.x = x2;
    this.y = y2;
  }
}
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol("linkClicked");
const $f6c31cce2adf654f$var$STYLE_ID = "react-aria-pressable-style";
const $f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE = "data-react-aria-pressable";
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
  let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $f6c31cce2adf654f$var$usePressResponderContext(props);
  let [isPressed, setPressed] = reactExports.useState(false);
  let ref = reactExports.useRef({
    isPressed: false,
    ignoreEmulatedMouseEvents: false,
    didFirePressStart: false,
    isTriggeringEvent: false,
    activePointerId: null,
    target: null,
    isOverTarget: false,
    pointerType: null,
    disposables: []
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let triggerPressStart = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled || state.didFirePressStart)
      return false;
    let shouldStopPropagation = true;
    state.isTriggeringEvent = true;
    if (onPressStart) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressstart", pointerType, originalEvent);
      onPressStart(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(true);
    state.isTriggeringEvent = false;
    state.didFirePressStart = true;
    setPressed(true);
    return shouldStopPropagation;
  });
  let triggerPressEnd = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType, wasPressed = true) => {
    let state = ref.current;
    if (!state.didFirePressStart)
      return false;
    state.didFirePressStart = false;
    state.isTriggeringEvent = true;
    let shouldStopPropagation = true;
    if (onPressEnd) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressend", pointerType, originalEvent);
      onPressEnd(event);
      shouldStopPropagation = event.shouldStopPropagation;
    }
    if (onPressChange)
      onPressChange(false);
    setPressed(false);
    if (onPress && wasPressed && !isDisabled) {
      let event = new $f6c31cce2adf654f$var$PressEvent12("press", pointerType, originalEvent);
      onPress(event);
      shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
    }
    state.isTriggeringEvent = false;
    return shouldStopPropagation;
  });
  let triggerPressUp = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((originalEvent, pointerType) => {
    let state = ref.current;
    if (isDisabled)
      return false;
    if (onPressUp) {
      state.isTriggeringEvent = true;
      let event = new $f6c31cce2adf654f$var$PressEvent12("pressup", pointerType, originalEvent);
      onPressUp(event);
      state.isTriggeringEvent = false;
      return event.shouldStopPropagation;
    }
    return true;
  });
  let cancel2 = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    let state = ref.current;
    if (state.isPressed && state.target) {
      if (state.didFirePressStart && state.pointerType != null)
        triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, false);
      state.isPressed = false;
      state.isOverTarget = false;
      state.activePointerId = null;
      state.pointerType = null;
      removeAllGlobalListeners();
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    }
  });
  let cancelOnPointerExit = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    if (shouldCancelOnPointerExit)
      cancel2(e2);
  });
  let triggerClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2) => {
    onClick === null || onClick === void 0 ? void 0 : onClick(e2);
  });
  let triggerSyntheticClick = $8ae05eaa5c114e9c$export$7f54fc3180508a52$4((e2, target) => {
    if (onClick) {
      let event = new MouseEvent("click", e2);
      $8a9cb279dc87e130$export$c2b7abe5d61ec696(event, target);
      onClick($8a9cb279dc87e130$export$525bc4921d56d4a(event));
    }
  });
  let pressProps = reactExports.useMemo(() => {
    let state = ref.current;
    let pressProps2 = {
      onKeyDown(e2) {
        if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e2.nativeEvent, e2.currentTarget) && $d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent))) {
          var _state_metaKeyEvents;
          if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent), e2.key))
            e2.preventDefault();
          let shouldStopPropagation = true;
          if (!state.isPressed && !e2.repeat) {
            state.target = e2.currentTarget;
            state.isPressed = true;
            state.pointerType = "keyboard";
            shouldStopPropagation = triggerPressStart(e2, "keyboard");
            let originalTarget = e2.currentTarget;
            let pressUp = (e22) => {
              if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e22, originalTarget) && !e22.repeat && $d4ee10de306f2510$export$4282f70798064fe0$3(originalTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e22)) && state.target)
                triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e22), "keyboard");
            };
            addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "keyup", $ff5963eb1fccf552$export$e08e3b67e392101e$9(pressUp, onKeyUp), true);
          }
          if (shouldStopPropagation)
            e2.stopPropagation();
          if (e2.metaKey && $c87311424ea30a05$export$9ac100e40613ea10$6())
            (_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.set(e2.key, e2.nativeEvent);
        } else if (e2.key === "Meta")
          state.metaKeyEvents = /* @__PURE__ */ new Map();
      },
      onClick(e2) {
        if (e2 && !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2 && e2.button === 0 && !state.isTriggeringEvent && !$ea8dcbcb9ea1b556$export$95185d699e05d4d7$5.isOpening) {
          let shouldStopPropagation = true;
          if (isDisabled)
            e2.preventDefault();
          if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de$4(e2.nativeEvent))) {
            let stopPressStart = triggerPressStart(e2, "virtual");
            let stopPressUp = triggerPressUp(e2, "virtual");
            let stopPressEnd = triggerPressEnd(e2, "virtual");
            triggerClick(e2);
            shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
          } else if (state.isPressed && state.pointerType !== "keyboard") {
            let pointerType = state.pointerType || e2.nativeEvent.pointerType || "virtual";
            let stopPressUp = triggerPressUp($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType);
            let stopPressEnd = triggerPressEnd($f6c31cce2adf654f$var$createEvent(e2.currentTarget, e2), pointerType, true);
            shouldStopPropagation = stopPressUp && stopPressEnd;
            state.isOverTarget = false;
            triggerClick(e2);
            cancel2(e2);
          }
          state.ignoreEmulatedMouseEvents = false;
          if (shouldStopPropagation)
            e2.stopPropagation();
        }
      }
    };
    let onKeyUp = (e2) => {
      var _state_metaKeyEvents;
      if (state.isPressed && state.target && $f6c31cce2adf654f$var$isValidKeyboardEvent(e2, state.target)) {
        var _state_metaKeyEvents1;
        if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard($d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2), e2.key))
          e2.preventDefault();
        let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2);
        let wasPressed = $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2));
        triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), "keyboard", wasPressed);
        if (wasPressed)
          triggerSyntheticClick(e2, state.target);
        removeAllGlobalListeners();
        if (e2.key !== "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) && $d4ee10de306f2510$export$4282f70798064fe0$3(state.target, target) && !e2[$f6c31cce2adf654f$var$LINK_CLICKED]) {
          e2[$f6c31cce2adf654f$var$LINK_CLICKED] = true;
          $ea8dcbcb9ea1b556$export$95185d699e05d4d7$5(state.target, e2, false);
        }
        state.isPressed = false;
        (_state_metaKeyEvents1 = state.metaKeyEvents) === null || _state_metaKeyEvents1 === void 0 ? void 0 : _state_metaKeyEvents1.delete(e2.key);
      } else if (e2.key === "Meta" && ((_state_metaKeyEvents = state.metaKeyEvents) === null || _state_metaKeyEvents === void 0 ? void 0 : _state_metaKeyEvents.size)) {
        var _state_target;
        let events2 = state.metaKeyEvents;
        state.metaKeyEvents = void 0;
        for (let event of events2.values())
          (_state_target = state.target) === null || _state_target === void 0 ? void 0 : _state_target.dispatchEvent(new KeyboardEvent("keyup", event));
      }
    };
    if (typeof PointerEvent !== "undefined") {
      pressProps2.onPointerDown = (e2) => {
        if (e2.button !== 0 || !$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if ($6a7db85432448f7f$export$29bf1b5f2c56cf63$3(e2.nativeEvent)) {
          state.pointerType = "virtual";
          return;
        }
        state.pointerType = e2.pointerType;
        let shouldStopPropagation = true;
        if (!state.isPressed) {
          state.isPressed = true;
          state.isOverTarget = true;
          state.activePointerId = e2.pointerId;
          state.target = e2.currentTarget;
          if (!allowTextSelectionOnPress)
            $14c0b72509d70225$export$16a4697467175487(state.target);
          shouldStopPropagation = triggerPressStart(e2, state.pointerType);
          let target = $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent);
          if ("releasePointerCapture" in target)
            target.releasePointerCapture(e2.pointerId);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointerup", onPointerUp, false);
          addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(e2.currentTarget), "pointercancel", onPointerCancel, false);
        }
        if (shouldStopPropagation)
          e2.stopPropagation();
      };
      pressProps2.onMouseDown = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        if (e2.button === 0) {
          if (preventFocusOnPress) {
            let dispose = $8a9cb279dc87e130$export$cabe61c495ee3649(e2.target);
            if (dispose)
              state.disposables.push(dispose);
          }
          e2.stopPropagation();
        }
      };
      pressProps2.onPointerUp = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) || state.pointerType === "virtual")
          return;
        if (e2.button === 0 && !state.isPressed)
          triggerPressUp(e2, state.pointerType || e2.pointerType);
      };
      pressProps2.onPointerEnter = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = true;
          triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType);
        }
      };
      pressProps2.onPointerLeave = (e2) => {
        if (e2.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
          state.isOverTarget = false;
          triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e2), state.pointerType, false);
          cancelOnPointerExit(e2);
        }
      };
      let onPointerUp = (e2) => {
        if (e2.pointerId === state.activePointerId && state.isPressed && e2.button === 0 && state.target) {
          if ($d4ee10de306f2510$export$4282f70798064fe0$3(state.target, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2)) && state.pointerType != null) {
            let clicked = false;
            let timeout = setTimeout(() => {
              if (state.isPressed && state.target instanceof HTMLElement) {
                if (clicked)
                  cancel2(e2);
                else {
                  $7215afc6de606d6b$export$de79e2c695e052f3$5(state.target);
                  state.target.click();
                }
              }
            }, 80);
            addGlobalListener(e2.currentTarget, "click", () => clicked = true, true);
            state.disposables.push(() => clearTimeout(timeout));
          } else
            cancel2(e2);
          state.isOverTarget = false;
        }
      };
      let onPointerCancel = (e2) => {
        cancel2(e2);
      };
      pressProps2.onDragStart = (e2) => {
        if (!$d4ee10de306f2510$export$4282f70798064fe0$3(e2.currentTarget, $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)))
          return;
        cancel2(e2);
      };
    }
    return pressProps2;
  }, [
    addGlobalListener,
    isDisabled,
    preventFocusOnPress,
    removeAllGlobalListeners,
    allowTextSelectionOnPress,
    cancel2,
    cancelOnPointerExit,
    triggerPressEnd,
    triggerPressStart,
    triggerPressUp,
    triggerClick,
    triggerSyntheticClick
  ]);
  reactExports.useEffect(() => {
    if (!domRef || false)
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(domRef.current);
    if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($f6c31cce2adf654f$var$STYLE_ID))
      return;
    const style2 = ownerDocument.createElement("style");
    style2.id = $f6c31cce2adf654f$var$STYLE_ID;
    style2.textContent = `
@layer {
  [${$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE}] {
    touch-action: pan-x pan-y pinch-zoom;
  }
}
    `.trim();
    ownerDocument.head.prepend(style2);
  }, [
    domRef
  ]);
  reactExports.useEffect(() => {
    let state = ref.current;
    return () => {
      var _state_target;
      if (!allowTextSelectionOnPress)
        $14c0b72509d70225$export$b0d6fa1ab32e3295((_state_target = state.target) !== null && _state_target !== void 0 ? _state_target : void 0);
      for (let dispose of state.disposables)
        dispose();
      state.disposables = [];
    };
  }, [
    allowTextSelectionOnPress
  ]);
  return {
    isPressed: isPressedProp || isPressed,
    pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9(domProps, pressProps, {
      [$f6c31cce2adf654f$var$PRESSABLE_ATTRIBUTE]: true
    })
  };
}
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
  return target.tagName === "A" && target.hasAttribute("href");
}
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
  const { key, code: code2 } = event;
  const element2 = currentTarget;
  const role = element2.getAttribute("role");
  return (key === "Enter" || key === " " || key === "Spacebar" || code2 === "Space") && !(element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element2, key) || element2 instanceof $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2).HTMLTextAreaElement || element2.isContentEditable) && // Links should only trigger with Enter key
  !((role === "link" || !role && $f6c31cce2adf654f$var$isHTMLAnchorLink(element2)) && key !== "Enter");
}
function $f6c31cce2adf654f$var$createEvent(target, e2) {
  let clientX = e2.clientX;
  let clientY = e2.clientY;
  return {
    currentTarget: target,
    shiftKey: e2.shiftKey,
    ctrlKey: e2.ctrlKey,
    metaKey: e2.metaKey,
    altKey: e2.altKey,
    clientX,
    clientY
  };
}
function $f6c31cce2adf654f$var$shouldPreventDefaultUp(target) {
  if (target instanceof HTMLInputElement)
    return false;
  if (target instanceof HTMLButtonElement)
    return target.type !== "submit" && target.type !== "reset";
  if ($f6c31cce2adf654f$var$isHTMLAnchorLink(target))
    return false;
  return true;
}
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
  if (target instanceof HTMLInputElement)
    return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
  return $f6c31cce2adf654f$var$shouldPreventDefaultUp(target);
}
const $f6c31cce2adf654f$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
  return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
}
let $507fabe10e71c6fb$var$currentModality = null;
let $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
let $507fabe10e71c6fb$export$d90243b58daecda7 = /* @__PURE__ */ new Map();
let $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
let $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
const $507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS = {
  Tab: true,
  Escape: true
};
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e2) {
  for (let handler of $507fabe10e71c6fb$var$changeHandlers)
    handler(modality, e2);
}
function $507fabe10e71c6fb$var$isValidKey(e2) {
  return !(e2.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10$6() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $507fabe10e71c6fb$var$handleKeyboardEvent(e2) {
  $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
  if ($507fabe10e71c6fb$var$isValidKey(e2)) {
    $507fabe10e71c6fb$var$currentModality = "keyboard";
    $507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e2);
  }
}
function $507fabe10e71c6fb$var$handlePointerEvent(e2) {
  $507fabe10e71c6fb$var$currentModality = "pointer";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    $507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e2);
  }
}
function $507fabe10e71c6fb$var$handleClickEvent(e2) {
  if ($6a7db85432448f7f$export$60278871457622de$4(e2)) {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    $507fabe10e71c6fb$var$currentModality = "virtual";
  }
}
function $507fabe10e71c6fb$var$handleFocusEvent(e2) {
  if (e2.target === window || e2.target === document || $8a9cb279dc87e130$export$fda7da73ab5d4c48 || !e2.isTrusted)
    return;
  if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
    $507fabe10e71c6fb$var$currentModality = "virtual";
    $507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e2);
  }
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
}
function $507fabe10e71c6fb$var$handleWindowBlur() {
  if ($8a9cb279dc87e130$export$fda7da73ab5d4c48)
    return;
  $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
  $507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
}
function $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2) {
  if (typeof window === "undefined" || typeof document === "undefined" || $507fabe10e71c6fb$export$d90243b58daecda7.get($431fbd86ca7dc216$export$f21a1ffae260145a$4(element2)))
    return;
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $507fabe10e71c6fb$var$hasEventBeforeFocus = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
  windowObject.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
  windowObject.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element2);
  }, {
    once: true
  });
  $507fabe10e71c6fb$export$d90243b58daecda7.set(windowObject, {
    focus
  });
}
const $507fabe10e71c6fb$var$tearDownWindowFocusTracking = (element2, loadListener) => {
  const windowObject = $431fbd86ca7dc216$export$f21a1ffae260145a$4(element2);
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  if (loadListener)
    documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$507fabe10e71c6fb$export$d90243b58daecda7.has(windowObject))
    return;
  windowObject.HTMLElement.prototype.focus = $507fabe10e71c6fb$export$d90243b58daecda7.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
  windowObject.removeEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
  windowObject.removeEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
  }
  $507fabe10e71c6fb$export$d90243b58daecda7.delete(windowObject);
};
function $507fabe10e71c6fb$export$2f1888112f558a7d(element2) {
  const documentObject = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  let loadListener;
  if (documentObject.readyState !== "loading")
    $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2);
  else {
    loadListener = () => {
      $507fabe10e71c6fb$var$setupGlobalFocusEvents(element2);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $507fabe10e71c6fb$var$tearDownWindowFocusTracking(element2, loadListener);
}
if (typeof document !== "undefined")
  $507fabe10e71c6fb$export$2f1888112f558a7d();
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
  return $507fabe10e71c6fb$var$currentModality !== "pointer";
}
function $507fabe10e71c6fb$export$630ff653c5ada6a9() {
  return $507fabe10e71c6fb$var$currentModality;
}
const $507fabe10e71c6fb$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $507fabe10e71c6fb$var$isKeyboardFocusEvent(isTextInput, modality, e2) {
  let document1 = $431fbd86ca7dc216$export$b204af158042fbac$4(e2 === null || e2 === void 0 ? void 0 : e2.target);
  const IHTMLInputElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLInputElement : HTMLInputElement;
  const IHTMLTextAreaElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLTextAreaElement : HTMLTextAreaElement;
  const IHTMLElement = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).HTMLElement : HTMLElement;
  const IKeyboardEvent = typeof window !== "undefined" ? $431fbd86ca7dc216$export$f21a1ffae260145a$4(e2 === null || e2 === void 0 ? void 0 : e2.target).KeyboardEvent : KeyboardEvent;
  isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$507fabe10e71c6fb$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
  return !(isTextInput && modality === "keyboard" && e2 instanceof IKeyboardEvent && !$507fabe10e71c6fb$var$FOCUS_VISIBLE_INPUT_KEYS[e2.key]);
}
function $507fabe10e71c6fb$export$ec71b4b83ac08ec3(fn, deps, opts2) {
  $507fabe10e71c6fb$var$setupGlobalFocusEvents();
  reactExports.useEffect(() => {
    let handler = (modality, e2) => {
      if (!$507fabe10e71c6fb$var$isKeyboardFocusEvent(!!(opts2 === null || opts2 === void 0 ? void 0 : opts2.isTextInput), modality, e2))
        return;
      fn($507fabe10e71c6fb$export$b9b3dfddab17db27());
    };
    $507fabe10e71c6fb$var$changeHandlers.add(handler);
    return () => {
      $507fabe10e71c6fb$var$changeHandlers.delete(handler);
    };
  }, deps);
}
function $3ad3f6e1647bc98d$export$80f3e147d781571c(element2) {
  const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(element2);
  const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
  if ($507fabe10e71c6fb$export$630ff653c5ada6a9() === "virtual") {
    let lastFocusedElement = activeElement;
    $bbed8b41f857bcc0$export$24490316f764c430$3(() => {
      if ($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) === lastFocusedElement && element2.isConnected)
        $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
    });
  } else
    $7215afc6de606d6b$export$de79e2c695e052f3$5(element2);
}
function $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = reactExports.useCallback((e2) => {
    if (e2.target === e2.currentTarget) {
      if (onBlurProp)
        onBlurProp(e2);
      if (onFocusChange)
        onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
  const onFocus = reactExports.useCallback((e2) => {
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = ownerDocument ? $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument) : $d4ee10de306f2510$export$cd4e5573fbe2b576();
    if (e2.target === e2.currentTarget && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusProp)
        onFocusProp(e2);
      if (onFocusChange)
        onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $93925083ecbb358c$export$48d1ea6320830260(handler) {
  if (!handler)
    return void 0;
  let shouldStopPropagation = true;
  return (e2) => {
    let event = {
      ...e2,
      preventDefault() {
        e2.preventDefault();
      },
      isDefaultPrevented() {
        return e2.isDefaultPrevented();
      },
      stopPropagation() {
        shouldStopPropagation = true;
      },
      continuePropagation() {
        shouldStopPropagation = false;
      },
      isPropagationStopped() {
        return shouldStopPropagation;
      }
    };
    handler(event);
    if (shouldStopPropagation)
      e2.stopPropagation();
  };
}
function $46d819fcbaf35654$export$8f71654801c2f7cd(props) {
  return {
    keyboardProps: props.isDisabled ? {} : {
      onKeyDown: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyDown),
      onKeyUp: $93925083ecbb358c$export$48d1ea6320830260(props.onKeyUp)
    }
  };
}
let $f645667febf57a63$export$f9762fab77588ecb = /* @__PURE__ */ React$6.createContext(null);
function $f645667febf57a63$var$useFocusableContext(ref) {
  let context = reactExports.useContext($f645667febf57a63$export$f9762fab77588ecb) || {};
  $e7801be82b4b2a53$export$4debdb1a3f0fa79e$3(context, ref);
  let { ref: _24, ...otherProps } = context;
  return otherProps;
}
function $f645667febf57a63$export$4c014de7c8940b4c(props, domRef) {
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6(props);
  let { keyboardProps } = $46d819fcbaf35654$export$8f71654801c2f7cd(props);
  let interactions = $3ef42575df84b30b$export$9d1611c77c2fe928$9(focusProps, keyboardProps);
  let domProps = $f645667febf57a63$var$useFocusableContext(domRef);
  let interactionProps = props.isDisabled ? {} : domProps;
  let autoFocusRef = reactExports.useRef(props.autoFocus);
  reactExports.useEffect(() => {
    if (autoFocusRef.current && domRef.current)
      $3ad3f6e1647bc98d$export$80f3e147d781571c(domRef.current);
    autoFocusRef.current = false;
  }, [
    domRef
  ]);
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
  if (props.isDisabled)
    tabIndex = void 0;
  return {
    focusableProps: $3ef42575df84b30b$export$9d1611c77c2fe928$9({
      ...interactions,
      tabIndex
    }, interactionProps)
  };
}
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = reactExports.useRef({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let onBlur = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    if (state.current.isFocusWithin && !e2.currentTarget.contains(e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin)
        onBlurWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
  let onFocus = reactExports.useCallback((e2) => {
    if (!e2.currentTarget.contains(e2.target))
      return;
    const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac$4(e2.target);
    const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === $d4ee10de306f2510$export$e58f029f0fbfdb29$3(e2.nativeEvent)) {
      if (onFocusWithin)
        onFocusWithin(e2);
      if (onFocusWithinChange)
        onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        if (state.current.isFocusWithin && !$d4ee10de306f2510$export$4282f70798064fe0$3(currentTarget, e3.target)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: e3.target
          });
          $8a9cb279dc87e130$export$c2b7abe5d61ec696(nativeEvent, currentTarget);
          let event = $8a9cb279dc87e130$export$525bc4921d56d4a(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled)
    return {
      focusWithinProps: {
        // These cannot be null, that would conflict in mergeProps
        onFocus: void 0,
        onBlur: void 0
      }
    };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
let $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
let $6179b936705e76d3$var$hoverCount = 0;
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
  $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
  setTimeout(() => {
    $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
  }, 50);
}
function $6179b936705e76d3$var$handleGlobalPointerEvent(e2) {
  if (e2.pointerType === "touch")
    $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
}
function $6179b936705e76d3$var$setupGlobalTouchEvents() {
  if (typeof document === "undefined")
    return;
  if (typeof PointerEvent !== "undefined")
    document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
  $6179b936705e76d3$var$hoverCount++;
  return () => {
    $6179b936705e76d3$var$hoverCount--;
    if ($6179b936705e76d3$var$hoverCount > 0)
      return;
    if (typeof PointerEvent !== "undefined")
      document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
  };
}
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = reactExports.useState(false);
  let state = reactExports.useRef({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  reactExports.useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
  let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6$3();
  let { hoverProps, triggerHoverEnd } = reactExports.useMemo(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
        return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($431fbd86ca7dc216$export$b204af158042fbac$4(event.target), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$d4ee10de306f2510$export$4282f70798064fe0$3(state.target, e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart)
        onHoverStart({
          type: "hoverstart",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target)
        return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd)
        onHoverEnd({
          type: "hoverend",
          target,
          pointerType
        });
      if (onHoverChange)
        onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e2.pointerType === "mouse")
          return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && e2.currentTarget.contains(e2.target))
          triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  reactExports.useEffect(() => {
    if (isDisabled)
      triggerHoverEnd({
        currentTarget: state.target
      }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var SWIPE_THRESHOLD_X = 100;
var SWIPE_THRESHOLD_Y = 20;
function useToast(originalProps) {
  var _a2, _b2;
  const [props, variantProps2] = mapPropsVariants(originalProps, toast$1.variantKeys);
  const {
    ref,
    as: as2,
    title,
    description,
    className,
    classNames: classNames2,
    toast: toast2,
    endContent,
    closeIcon,
    hideIcon = false,
    placement: placementProp = "bottom-right",
    isRegionExpanded,
    hideCloseButton = false,
    state,
    total = 1,
    index: index2 = 0,
    heights,
    promise: promiseProp,
    setHeights,
    toastOffset = 0,
    motionProps,
    timeout = 6e3,
    shouldShowTimeoutProgress = false,
    icon,
    onClose,
    severity,
    maxVisibleToasts,
    loadingComponent,
    ...otherProps
  } = props;
  const { isHovered: isToastHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
    isDisabled: false
  });
  const globalContext = useProviderContext();
  const disableAnimation = (_b2 = (_a2 = originalProps == null ? void 0 : originalProps.disableAnimation) != null ? _a2 : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b2 : false;
  const isMobile2 = useIsMobile();
  let placement = placementProp;
  if (isMobile2) {
    if (placementProp.includes("top")) {
      placement = "top-center";
    } else {
      placement = "bottom-center";
    }
  }
  const animationRef = reactExports.useRef(null);
  const startTime = reactExports.useRef(null);
  const progressRef = reactExports.useRef(0);
  const progressBarRef = reactExports.useRef(null);
  const pausedTime = reactExports.useRef(0);
  const timeElapsed = reactExports.useRef(0);
  reactExports.useEffect(() => {
    if (progressBarRef.current) {
      progressBarRef.current.style.width = "0%";
    }
  }, []);
  const [isLoading, setIsLoading] = reactExports.useState(!!promiseProp);
  const [isToastExiting, setIsToastExiting] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (!promiseProp)
      return;
    promiseProp.finally(() => {
      setIsLoading(false);
    });
  }, [promiseProp]);
  reactExports.useEffect(() => {
    const updateProgress = (timestamp) => {
      if (!timeout || isLoading) {
        return;
      }
      if (startTime.current === null) {
        startTime.current = timestamp;
      }
      if (isToastHovered || isRegionExpanded) {
        pausedTime.current += timestamp - startTime.current;
        startTime.current = null;
        animationRef.current = requestAnimationFrame(updateProgress);
        return;
      }
      const elapsed = timestamp - startTime.current + pausedTime.current;
      timeElapsed.current = elapsed;
      if (timeElapsed.current >= timeout) {
        setIsToastExiting(true);
      }
      progressRef.current = Math.min(elapsed / timeout * 100, 100);
      if (progressBarRef.current) {
        progressBarRef.current.style.width = `${shouldShowTimeoutProgress ? progressRef.current : 0}%`;
      }
      if (progressRef.current < 100) {
        animationRef.current = requestAnimationFrame(updateProgress);
      }
    };
    animationRef.current = requestAnimationFrame(updateProgress);
    return () => {
      if (animationRef.current !== null) {
        cancelAnimationFrame(animationRef.current);
      }
    };
  }, [
    timeout,
    shouldShowTimeoutProgress,
    state,
    isToastHovered,
    index2,
    total,
    isRegionExpanded,
    isLoading,
    setIsToastExiting
  ]);
  const Component2 = as2 || "div";
  const domRef = useDOMRef(ref);
  const baseStyles = clsx$5(className, classNames2 == null ? void 0 : classNames2.base);
  const { toastProps, contentProps, titleProps, descriptionProps } = $d6542812f0669241$export$a407b657d3044108(
    props,
    state
  );
  const [mounted, setMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setMounted(true);
  }, []);
  const [initialHeight, setInitialHeight] = reactExports.useState(0);
  reactExports.useLayoutEffect(() => {
    if (!domRef.current || !mounted || isToastExiting) {
      return;
    }
    const toastNode = domRef.current;
    const originalHeight = toastNode.style.height;
    toastNode.style.height = "auto";
    const computedStyle = getComputedStyle(toastNode);
    const marginTop = parseFloat(computedStyle.marginTop);
    const marginBottom = parseFloat(computedStyle.marginBottom);
    const newHeight = toastNode.getBoundingClientRect().height + marginTop + marginBottom;
    toastNode.style.height = originalHeight;
    setInitialHeight((prevHeight) => prevHeight !== newHeight ? newHeight : prevHeight);
    const updatedHeights = [...heights];
    if (updatedHeights.length > index2) {
      updatedHeights[index2] = newHeight;
    } else {
      updatedHeights.push(newHeight);
    }
    setHeights(updatedHeights);
  }, [mounted, total, setHeights, index2, isToastExiting]);
  let liftHeight = 4;
  for (let idx = index2 + 1; idx < total; idx++) {
    liftHeight += heights[idx];
  }
  const frontHeight = heights[heights.length - 1];
  const slots = reactExports.useMemo(
    () => toast$1({
      ...variantProps2,
      disableAnimation
    }),
    [objectToDeps(variantProps2)]
  );
  const multiplier = placement.includes("top") ? 1 : -1;
  const toastVariants = {
    hidden: { opacity: 0, y: -50 * multiplier },
    visible: { opacity: 1, y: 0 },
    exit: { opacity: 0, y: -50 * multiplier }
  };
  const [drag2, setDrag] = reactExports.useState(false);
  const [dragValue, setDragValue] = reactExports.useState(0);
  const shouldCloseToast = (offsetX, offsetY) => {
    const isRight = placement.includes("right");
    const isLeft = placement.includes("left");
    const isCenterTop = placement === "top-center";
    const isCenterBottom = placement === "bottom-center";
    if (isRight && offsetX >= SWIPE_THRESHOLD_X || isLeft && offsetX <= -SWIPE_THRESHOLD_X || isCenterTop && offsetY <= -SWIPE_THRESHOLD_Y || isCenterBottom && offsetY >= SWIPE_THRESHOLD_Y) {
      return true;
    }
  };
  const getDragElasticConstraints = (placement2) => {
    const elasticConstraint = { top: 0, bottom: 0, right: 0, left: 0 };
    if (placement2 === "bottom-center") {
      elasticConstraint.bottom = 1;
      return elasticConstraint;
    }
    if (placement2 === "top-center") {
      elasticConstraint.top = 1;
      return elasticConstraint;
    }
    if (placement2.includes("right")) {
      elasticConstraint.right = 1;
      return elasticConstraint;
    }
    if (placement2.includes("left")) {
      elasticConstraint.left = 1;
      return elasticConstraint;
    }
    elasticConstraint.left = 1;
    elasticConstraint.right = 1;
    return elasticConstraint;
  };
  let opacityValue = void 0;
  if (drag2 && placement === "bottom-center" || placement === "top-center") {
    opacityValue = Math.max(0, 1 - dragValue / (SWIPE_THRESHOLD_Y + 5));
  } else if (drag2) {
    opacityValue = Math.max(0, 1 - dragValue / (SWIPE_THRESHOLD_X + 20));
  }
  const getToastProps = reactExports.useCallback(
    (props2 = {}) => {
      const topExtension = 16;
      const bottomExtension = 16;
      const pseudoElementStyles = {
        "--top-extension": `${topExtension}px`,
        "--bottom-extension": `${bottomExtension}px`
      };
      return {
        ref: domRef,
        className: slots.base({ class: clsx$5(baseStyles, classNames2 == null ? void 0 : classNames2.base) }),
        "data-has-title": dataAttr(!isEmpty(title)),
        "data-has-description": dataAttr(!isEmpty(description)),
        "data-placement": placement,
        "data-drag-value": dragValue,
        "data-toast": true,
        "aria-label": "toast",
        "data-toast-exiting": dataAttr(isToastExiting),
        onTransitionEnd: () => {
          if (isToastExiting) {
            const updatedHeights = heights;
            updatedHeights.splice(index2, 1);
            setHeights([...updatedHeights]);
            state.close(toast2.key);
          }
        },
        style: {
          opacity: opacityValue,
          ...pseudoElementStyles
        },
        ...mergeProps$3(props2, otherProps, toastProps, hoverProps)
      };
    },
    [
      slots,
      classNames2,
      toastProps,
      hoverProps,
      toast2,
      toast2.key,
      opacityValue,
      isToastExiting,
      state,
      toast2.key
    ]
  );
  const getWrapperProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.wrapper({ class: classNames2 == null ? void 0 : classNames2.wrapper }),
      ...props2
    }),
    []
  );
  const getIconProps = reactExports.useCallback(
    (props2 = {}) => ({
      "aria-label": "descriptionIcon",
      className: slots.icon({ class: classNames2 == null ? void 0 : classNames2.icon }),
      ...props2
    }),
    []
  );
  const getLoadingComponentProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.loadingComponent({ class: classNames2 == null ? void 0 : classNames2.loadingComponent }),
      "aria-label": "loadingIcon",
      color: "current",
      ...props2
    }),
    []
  );
  const getSpinnerComponentProps = reactExports.useCallback(
    (props2 = {}) => ({
      classNames: { wrapper: slots.loadingComponent({ class: classNames2 == null ? void 0 : classNames2.loadingComponent }) },
      "aria-label": "loadingIcon",
      color: "current",
      ...props2
    }),
    []
  );
  const getContentProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.content({ class: classNames2 == null ? void 0 : classNames2.content }),
      ...mergeProps$3(props2, otherProps, contentProps)
    }),
    [contentProps]
  );
  const getTitleProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.title({ class: classNames2 == null ? void 0 : classNames2.title }),
      ...mergeProps$3(props2, otherProps, titleProps)
    }),
    [titleProps]
  );
  const getDescriptionProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.description({ class: classNames2 == null ? void 0 : classNames2.description }),
      ...mergeProps$3(props2, otherProps, descriptionProps)
    }),
    [descriptionProps]
  );
  const getCloseButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.closeButton({ class: classNames2 == null ? void 0 : classNames2.closeButton }),
      "aria-label": "closeButton",
      "data-hidden": dataAttr(hideCloseButton),
      ...mergeProps$3(props2, {
        onPress: chain(() => {
          setIsToastExiting(true);
          setTimeout(() => document.body.focus(), 0);
        }, onClose)
      })
    }),
    [setIsToastExiting, onClose, state, toast2]
  );
  const getCloseIconProps = reactExports.useCallback(
    (props2 = {}) => ({
      className: slots.closeIcon({ class: classNames2 == null ? void 0 : classNames2.closeIcon }),
      "aria-label": "closeIcon",
      ...props2
    }),
    []
  );
  const getMotionDivProps = reactExports.useCallback(
    (props2 = {}) => {
      const comparingValue = isRegionExpanded ? maxVisibleToasts - 1 : Math.min(2, maxVisibleToasts - 1);
      const isCloseToEnd = total - index2 - 1 <= comparingValue;
      const dragDirection = placement === "bottom-center" || placement === "top-center" ? "y" : "x";
      const dragConstraints = { left: 0, right: 0, top: 0, bottom: 0 };
      const dragElastic = getDragElasticConstraints(placement);
      const animateProps = (() => {
        if (placement.includes("top")) {
          return {
            top: isRegionExpanded || drag2 ? liftHeight + toastOffset : (total - 1 - index2) * 8 + toastOffset,
            bottom: "auto"
          };
        } else if (placement.includes("bottom")) {
          return {
            bottom: isRegionExpanded || drag2 ? liftHeight + toastOffset : (total - 1 - index2) * 8 + toastOffset,
            top: "auto"
          };
        }
        return {};
      })();
      return {
        animate: {
          opacity: isCloseToEnd ? 1 : 0,
          pointerEvents: isCloseToEnd ? "all" : "none",
          scaleX: isRegionExpanded || drag2 ? 1 : 1 - (total - 1 - index2) * 0.1,
          height: isRegionExpanded || drag2 ? initialHeight : frontHeight,
          y: 0,
          ...animateProps
        },
        drag: dragDirection,
        dragConstraints,
        exit: { opacity: 0 },
        initial: { opacity: 0, scale: 1, y: -40 * multiplier },
        transition: { duration: 0.3, ease: "easeOut" },
        variants: toastVariants,
        dragElastic,
        onDragEnd: (_24, info) => {
          const { x: offsetX, y: offsetY } = info.offset;
          setDrag(false);
          if (shouldCloseToast(offsetX, offsetY)) {
            const updatedHeights = heights;
            updatedHeights.splice(index2, 1);
            setHeights([...updatedHeights]);
            state.close(toast2.key);
            return;
          }
          setDragValue(0);
        },
        onDrag: (_24, info) => {
          let updatedDragValue = 0;
          if (placement === "top-center") {
            updatedDragValue = -info.offset.y;
          } else if (placement === "bottom-center") {
            updatedDragValue = info.offset.y;
          } else if (placement.includes("right")) {
            updatedDragValue = info.offset.x;
          } else if (placement.includes("left")) {
            updatedDragValue = -info.offset.x;
          }
          if (updatedDragValue >= 0) {
            setDragValue(updatedDragValue);
          }
        },
        onDragStart: () => {
          setDrag(true);
        },
        "data-drag": dataAttr(drag2),
        "data-placement": placement,
        "data-drag-value": dragValue,
        className: slots.motionDiv({ class: classNames2 == null ? void 0 : classNames2.motionDiv }),
        ...props2,
        ...motionProps
      };
    },
    [
      total,
      index2,
      placement,
      isRegionExpanded,
      isToastExiting,
      liftHeight,
      multiplier,
      initialHeight,
      frontHeight,
      toastVariants,
      classNames2,
      drag2,
      dataAttr,
      setDrag,
      shouldCloseToast,
      slots,
      toastOffset,
      maxVisibleToasts
    ]
  );
  return {
    Component: Component2,
    title,
    description,
    icon,
    loadingComponent,
    domRef,
    severity,
    closeIcon,
    classNames: classNames2,
    color: variantProps2["color"],
    hideIcon,
    placement,
    state,
    toast: toast2,
    disableAnimation,
    isProgressBarVisible: !!timeout,
    total,
    index: index2,
    getWrapperProps,
    getToastProps,
    getTitleProps,
    getContentProps,
    getDescriptionProps,
    getCloseButtonProps,
    getIconProps,
    getMotionDivProps,
    getCloseIconProps,
    getLoadingComponentProps,
    getSpinnerComponentProps,
    progressBarRef,
    endContent,
    slots,
    isRegionExpanded,
    liftHeight,
    frontHeight,
    initialHeight,
    isLoading
  };
}
var domAnimation = () => __vitePreload(() => import("./src-UW24ZMRV-BVL2m81G.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.default);
var Ripple = (props) => {
  const { ripples = [], motionProps, color: color2 = "currentColor", style: style2, onClear } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ripples.map((ripple) => {
    const duration2 = clamp$3(0.01 * ripple.size, 0.2, ripple.size > 100 ? 0.75 : 0.5);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: domAnimation, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      m$3.span,
      {
        animate: { transform: "scale(2)", opacity: 0 },
        className: "heroui-ripple",
        exit: { opacity: 0 },
        initial: { transform: "scale(0)", opacity: 0.35 },
        style: {
          position: "absolute",
          backgroundColor: color2,
          borderRadius: "100%",
          transformOrigin: "center",
          pointerEvents: "none",
          overflow: "hidden",
          inset: 0,
          zIndex: 0,
          top: ripple.y,
          left: ripple.x,
          width: `${ripple.size}px`,
          height: `${ripple.size}px`,
          ...style2
        },
        transition: { duration: duration2 },
        onAnimationComplete: () => {
          onClear(ripple.key);
        },
        ...motionProps
      }
    ) }) }, ripple.key);
  }) });
};
Ripple.displayName = "HeroUI.Ripple";
var ripple_default = Ripple;
function useRipple(props = {}) {
  const [ripples, setRipples] = reactExports.useState([]);
  const onPress = reactExports.useCallback((event) => {
    const trigger = event.target;
    const size2 = Math.max(trigger.clientWidth, trigger.clientHeight);
    setRipples((prevRipples) => [
      ...prevRipples,
      {
        key: getUniqueID(prevRipples.length.toString()),
        size: size2,
        x: event.x - size2 / 2,
        y: event.y - size2 / 2
      }
    ]);
  }, []);
  const onClear = reactExports.useCallback((key) => {
    setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
  }, []);
  return { ripples, onClear, onPress, ...props };
}
var $bdb11010cef70236$export$d41a04c74483c6ef = /* @__PURE__ */ new Map();
if (typeof FinalizationRegistry !== "undefined")
  new FinalizationRegistry((heldValue) => {
    $bdb11010cef70236$export$d41a04c74483c6ef.delete(heldValue);
  });
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
  if (idA === idB)
    return idA;
  let setIdsA = $bdb11010cef70236$export$d41a04c74483c6ef.get(idA);
  if (setIdsA) {
    setIdsA.forEach((ref) => ref.current = idB);
    return idB;
  }
  let setIdsB = $bdb11010cef70236$export$d41a04c74483c6ef.get(idB);
  if (setIdsB) {
    setIdsB.forEach((ref) => ref.current = idA);
    return idA;
  }
  return idB;
}
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
  return (...args) => {
    for (let callback2 of callbacks)
      if (typeof callback2 === "function")
        callback2(...args);
  };
}
function r$6(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2)) {
      var o2 = e2.length;
      for (t2 = 0; t2 < o2; t2++)
        e2[t2] && (f2 = r$6(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    } else
      for (f2 in e2)
        e2[f2] && (n2 && (n2 += " "), n2 += f2);
  return n2;
}
function clsx$2() {
  for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++)
    (e2 = arguments[f2]) && (t2 = r$6(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
var clsx_default = clsx$2;
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
  let result = {
    ...args[0]
  };
  for (let i2 = 1; i2 < args.length; i2++) {
    let props = args[i2];
    for (let key in props) {
      let a2 = result[key];
      let b2 = props[key];
      if (typeof a2 === "function" && typeof b2 === "function" && // This is a lot faster than a regex.
      key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= /* 'A' */
      65 && key.charCodeAt(2) <= /* 'Z' */
      90)
        result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a2, b2);
      else if ((key === "className" || key === "UNSAFE_className") && typeof a2 === "string" && typeof b2 === "string")
        result[key] = clsx_default(a2, b2);
      else if (key === "id" && a2 && b2)
        result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a2, b2);
      else
        result[key] = b2 !== void 0 ? b2 : a2;
    }
  }
  return result;
}
var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([
  "id"
]);
var $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([
  "aria-label",
  "aria-labelledby",
  "aria-describedby",
  "aria-details"
]);
var $65484d02dcb7eb3e$var$linkPropNames = /* @__PURE__ */ new Set([
  "href",
  "hrefLang",
  "target",
  "rel",
  "download",
  "ping",
  "referrerPolicy"
]);
var $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts2 = {}) {
  let { labelable, isLink, propNames } = opts2;
  let filteredProps = {};
  for (const prop in props)
    if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || isLink && $65484d02dcb7eb3e$var$linkPropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop)))
      filteredProps[prop] = props[prop];
  return filteredProps;
}
function $f7dceffc5ad7768b$export$4e328f61c538687f(props = {}) {
  let { autoFocus = false, isTextInput, within } = props;
  let state = reactExports.useRef({
    isFocused: false,
    isFocusVisible: autoFocus || $507fabe10e71c6fb$export$b9b3dfddab17db27()
  });
  let [isFocused, setFocused] = reactExports.useState(false);
  let [isFocusVisibleState, setFocusVisible] = reactExports.useState(() => state.current.isFocused && state.current.isFocusVisible);
  let updateState3 = reactExports.useCallback(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
  let onFocusChange = reactExports.useCallback((isFocused2) => {
    state.current.isFocused = isFocused2;
    setFocused(isFocused2);
    updateState3();
  }, [
    updateState3
  ]);
  $507fabe10e71c6fb$export$ec71b4b83ac08ec3((isFocusVisible) => {
    state.current.isFocusVisible = isFocusVisible;
    updateState3();
  }, [], {
    isTextInput
  });
  let { focusProps } = $a1ea59d68270f0dd$export$f8168d8dd8fd66e6({
    isDisabled: within,
    onFocusChange
  });
  let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
    isDisabled: !within,
    onFocusWithinChange: onFocusChange
  });
  return {
    isFocused,
    isFocusVisible: isFocusVisibleState,
    focusProps: within ? focusWithinProps : focusProps
  };
}
function useAriaButton(props, ref) {
  let {
    elementType = "button",
    isDisabled,
    onPress,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    // @ts-ignore - undocumented
    preventFocusOnPress,
    // @ts-ignore - undocumented
    allowFocusWhenDisabled,
    onClick,
    href,
    target,
    rel,
    type: type4 = "button",
    allowTextSelectionOnPress
  } = props;
  let additionalProps;
  if (elementType === "button") {
    additionalProps = {
      type: type4,
      disabled: isDisabled
    };
  } else {
    additionalProps = {
      role: "button",
      href: elementType === "a" && !isDisabled ? href : void 0,
      target: elementType === "a" ? target : void 0,
      type: elementType === "input" ? type4 : void 0,
      disabled: elementType === "input" ? isDisabled : void 0,
      "aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
      rel: elementType === "a" ? rel : void 0
    };
  }
  let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21({
    onClick,
    onPressStart,
    onPressEnd,
    onPressUp,
    onPressChange,
    onPress,
    isDisabled,
    preventFocusOnPress,
    allowTextSelectionOnPress,
    ref
  });
  let { focusableProps } = $f645667febf57a63$export$4c014de7c8940b4c(props, ref);
  if (allowFocusWhenDisabled) {
    focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
  }
  let buttonProps = $3ef42575df84b30b$export$9d1611c77c2fe928(
    focusableProps,
    pressProps,
    $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, { labelable: true })
  );
  return {
    isPressed,
    // Used to indicate press state for visual
    buttonProps: $3ef42575df84b30b$export$9d1611c77c2fe928(additionalProps, buttonProps, {
      "aria-haspopup": props["aria-haspopup"],
      "aria-expanded": props["aria-expanded"],
      "aria-controls": props["aria-controls"],
      "aria-pressed": props["aria-pressed"],
      "aria-current": props["aria-current"]
    })
  };
}
var [ButtonGroupProvider, useButtonGroupContext] = createContext2({
  name: "ButtonGroupContext",
  strict: false
});
function useButton(props) {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const groupContext = useButtonGroupContext();
  const globalContext = useProviderContext();
  const isInGroup = !!groupContext;
  const {
    ref,
    as: as2,
    children,
    startContent: startContentProp,
    endContent: endContentProp,
    autoFocus,
    className,
    spinner: spinner2,
    isLoading = false,
    disableRipple: disableRippleProp = false,
    fullWidth = (_a2 = groupContext == null ? void 0 : groupContext.fullWidth) != null ? _a2 : false,
    radius = groupContext == null ? void 0 : groupContext.radius,
    size: size2 = (_b2 = groupContext == null ? void 0 : groupContext.size) != null ? _b2 : "md",
    color: color2 = (_c2 = groupContext == null ? void 0 : groupContext.color) != null ? _c2 : "default",
    variant = (_d = groupContext == null ? void 0 : groupContext.variant) != null ? _d : "solid",
    disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
    isDisabled: isDisabledProp = (_g = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _g : false,
    isIconOnly = (_h = groupContext == null ? void 0 : groupContext.isIconOnly) != null ? _h : false,
    spinnerPlacement = "start",
    onPress,
    onClick,
    ...otherProps
  } = props;
  const Component2 = as2 || "button";
  const shouldFilterDOMProps = typeof Component2 === "string";
  const domRef = useDOMRef(ref);
  const disableRipple = (_i = disableRippleProp || (globalContext == null ? void 0 : globalContext.disableRipple)) != null ? _i : disableAnimation;
  const { isFocusVisible, isFocused, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
    autoFocus
  });
  const isDisabled = isDisabledProp || isLoading;
  const styles2 = reactExports.useMemo(
    () => button({
      size: size2,
      color: color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      disableAnimation,
      isIconOnly,
      className
    }),
    [
      size2,
      color2,
      variant,
      radius,
      fullWidth,
      isDisabled,
      isInGroup,
      isIconOnly,
      disableAnimation,
      className
    ]
  );
  const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
  const handlePress = reactExports.useCallback(
    (e2) => {
      if (disableRipple || isDisabled || disableAnimation)
        return;
      domRef.current && onRipplePressHandler(e2);
    },
    [disableRipple, isDisabled, disableAnimation, domRef, onRipplePressHandler]
  );
  const { buttonProps: ariaButtonProps, isPressed } = useAriaButton(
    {
      elementType: as2,
      isDisabled,
      onPress: chain(onPress, handlePress),
      onClick,
      ...otherProps
    },
    domRef
  );
  const { isHovered, hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({ isDisabled });
  const getButtonProps = reactExports.useCallback(
    (props2 = {}) => ({
      "data-disabled": dataAttr(isDisabled),
      "data-focus": dataAttr(isFocused),
      "data-pressed": dataAttr(isPressed),
      "data-focus-visible": dataAttr(isFocusVisible),
      "data-hover": dataAttr(isHovered),
      "data-loading": dataAttr(isLoading),
      ...mergeProps$3(
        ariaButtonProps,
        focusProps,
        hoverProps,
        filterDOMProps(otherProps, {
          enabled: shouldFilterDOMProps
        }),
        filterDOMProps(props2)
      ),
      className: styles2
    }),
    [
      isLoading,
      isDisabled,
      isFocused,
      isPressed,
      shouldFilterDOMProps,
      isFocusVisible,
      isHovered,
      ariaButtonProps,
      focusProps,
      hoverProps,
      otherProps,
      styles2
    ]
  );
  const getIconClone = (icon) => reactExports.isValidElement(icon) ? reactExports.cloneElement(icon, {
    // @ts-ignore
    "aria-hidden": true,
    focusable: false
  }) : null;
  const startContent = getIconClone(startContentProp);
  const endContent = getIconClone(endContentProp);
  const spinnerSize = reactExports.useMemo(() => {
    const buttonSpinnerSizeMap = {
      sm: "sm",
      md: "sm",
      lg: "md"
    };
    return buttonSpinnerSizeMap[size2];
  }, [size2]);
  const getRippleProps = reactExports.useCallback(
    () => ({ ripples, onClear: onClearRipple }),
    [ripples, onClearRipple]
  );
  return {
    Component: Component2,
    children,
    domRef,
    spinner: spinner2,
    styles: styles2,
    startContent,
    endContent,
    isLoading,
    spinnerPlacement,
    spinnerSize,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  };
}
var Button$1 = forwardRef((props, ref) => {
  const {
    Component: Component2,
    domRef,
    children,
    spinnerSize,
    spinner: spinner2 = /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "current", size: spinnerSize }),
    spinnerPlacement,
    startContent,
    endContent,
    isLoading,
    disableRipple,
    getButtonProps,
    getRippleProps,
    isIconOnly
  } = useButton({ ...props, ref });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getButtonProps(), children: [
    startContent,
    isLoading && spinnerPlacement === "start" && spinner2,
    isLoading && isIconOnly ? null : children,
    isLoading && spinnerPlacement === "end" && spinner2,
    endContent,
    !disableRipple && /* @__PURE__ */ jsxRuntimeExports.jsx(ripple_default, { ...getRippleProps() })
  ] });
});
Button$1.displayName = "HeroUI.Button";
var button_default = Button$1;
var iconMap = {
  default: InfoFilledIcon,
  primary: InfoFilledIcon,
  secondary: InfoFilledIcon,
  success: SuccessIcon,
  warning: WarningIcon,
  danger: DangerIcon
};
var Toast = forwardRef((props, ref) => {
  const {
    severity,
    Component: Component2,
    icon,
    loadingComponent,
    domRef,
    endContent,
    color: color2,
    hideIcon,
    closeIcon,
    disableAnimation,
    progressBarRef,
    classNames: classNames2,
    slots,
    getWrapperProps,
    isProgressBarVisible,
    getToastProps,
    getContentProps,
    getTitleProps,
    getDescriptionProps,
    getCloseButtonProps,
    getIconProps,
    getMotionDivProps,
    getCloseIconProps,
    getLoadingComponentProps,
    getSpinnerComponentProps,
    isLoading
  } = useToast({
    ...props,
    ref
  });
  const customIcon = typeof icon === "function" ? icon(getIconProps()) : reactExports.isValidElement(icon) && reactExports.cloneElement(icon, getIconProps());
  const IconComponent = severity ? iconMap[severity] : iconMap[color2] || iconMap.default;
  const customLoadingComponent = loadingComponent && reactExports.isValidElement(loadingComponent) ? reactExports.cloneElement(loadingComponent, getLoadingComponentProps()) : null;
  const loadingIconComponent = isLoading ? customLoadingComponent || /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { ...getSpinnerComponentProps() }) : null;
  const customCloseIcon = typeof closeIcon === "function" ? closeIcon({}) : reactExports.isValidElement(closeIcon) && reactExports.cloneElement(closeIcon, {});
  const toastContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(Component2, { ref: domRef, ...getToastProps(), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getContentProps(), children: [
      hideIcon && !isLoading ? null : loadingIconComponent || customIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(IconComponent, { ...getIconProps() }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...getWrapperProps(), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getTitleProps(), children: props.toast.content.title }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...getDescriptionProps(), children: props.toast.content.description })
      ] })
    ] }),
    isProgressBarVisible && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: slots.progressTrack({ class: classNames2 == null ? void 0 : classNames2.progressTrack }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: progressBarRef,
        className: slots.progressIndicator({ class: classNames2 == null ? void 0 : classNames2.progressIndicator })
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(button_default, { isIconOnly: true, ...getCloseButtonProps(), children: customCloseIcon || /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, { ...getCloseIconProps() }) }),
    endContent
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: disableAnimation ? toastContent : /* @__PURE__ */ jsxRuntimeExports.jsx(m$3.div, { ...getMotionDivProps(), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    m$3.div,
    {
      animate: { opacity: 1 },
      exit: { opacity: 0 },
      initial: { opacity: 0 },
      transition: { duration: 0.25, ease: "easeOut", delay: 0.1 },
      children: toastContent
    },
    "inner-div"
  ) }) });
});
Toast.displayName = "HeroUI.Toast";
var toast_default = Toast;
function ToastRegion({
  toastQueue,
  placement,
  disableAnimation,
  maxVisibleToasts,
  toastOffset,
  toastProps = {},
  className,
  classNames: classNames2,
  ...props
}) {
  var _a2, _b2;
  const ref = reactExports.useRef(null);
  const { regionProps } = $6cc546b19ee7130a$export$b8cbbb20a51697de(props, toastQueue, ref);
  const { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
    isDisabled: false
  });
  const [isTouched, setIsTouched] = reactExports.useState(false);
  const slots = reactExports.useMemo(
    () => toastRegion({
      disableAnimation
    }),
    [disableAnimation]
  );
  const baseStyles = clsx$5(classNames2 == null ? void 0 : classNames2.base, className);
  reactExports.useEffect(() => {
    function handleTouchOutside(event) {
      if (ref.current && !ref.current.contains(event.target)) {
        setIsTouched(false);
      }
    }
    document.addEventListener("touchstart", handleTouchOutside);
    return () => {
      document.removeEventListener("touchstart", handleTouchOutside);
    };
  }, []);
  const [heights, setHeights] = reactExports.useState([]);
  const total = (_b2 = (_a2 = toastQueue.visibleToasts) == null ? void 0 : _a2.length) != null ? _b2 : 0;
  const handleTouchStart = reactExports.useCallback(() => {
    setIsTouched(true);
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ...mergeProps$3(regionProps, hoverProps),
      ref,
      className: slots.base({ class: baseStyles }),
      "data-placement": placement,
      onTouchStart: handleTouchStart,
      children: [...toastQueue.visibleToasts].reverse().map((toast2, index2) => {
        if (disableAnimation && total - index2 > maxVisibleToasts) {
          return null;
        }
        if (disableAnimation || total - index2 <= 4 || isHovered && total - index2 <= maxVisibleToasts + 1) {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            toast_default,
            {
              state: toastQueue,
              toast: toast2,
              ...mergeProps$3(toastProps, toast2.content),
              disableAnimation,
              heights,
              index: index2,
              isRegionExpanded: isHovered || isTouched,
              maxVisibleToasts,
              placement,
              setHeights,
              toastOffset,
              total
            },
            toast2.key
          );
        }
        return null;
      })
    }
  );
}
function $77b352cf12efcf73$export$84726ef35ca2129a(queue) {
  let subscribe2 = reactExports.useCallback((fn) => queue.subscribe(fn), [
    queue
  ]);
  let getSnapshot2 = reactExports.useCallback(() => queue.visibleToasts, [
    queue
  ]);
  let visibleToasts = shimExports.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
  return {
    visibleToasts,
    add: (content2, options) => queue.add(content2, options),
    close: (key) => queue.close(key),
    pauseAll: () => queue.pauseAll(),
    resumeAll: () => queue.resumeAll()
  };
}
class $77b352cf12efcf73$export$f1f8569633bbbec4 {
  runWithWrapUpdate(fn, action) {
    if (this.wrapUpdate)
      this.wrapUpdate(fn, action);
    else
      fn();
  }
  /** Subscribes to updates to the visible toasts. */
  subscribe(fn) {
    this.subscriptions.add(fn);
    return () => this.subscriptions.delete(fn);
  }
  /** Adds a new toast to the queue. */
  add(content2, options = {}) {
    let toastKey = "_" + Math.random().toString(36).slice(2);
    let toast2 = {
      ...options,
      content: content2,
      key: toastKey,
      timer: options.timeout ? new $77b352cf12efcf73$var$Timer(() => this.close(toastKey), options.timeout) : void 0
    };
    this.queue.unshift(toast2);
    this.updateVisibleToasts("add");
    return toastKey;
  }
  /**
  * Closes a toast.
  */
  close(key) {
    let index2 = this.queue.findIndex((t2) => t2.key === key);
    if (index2 >= 0) {
      var _this_queue_index_onClose, _this_queue_index;
      (_this_queue_index_onClose = (_this_queue_index = this.queue[index2]).onClose) === null || _this_queue_index_onClose === void 0 ? void 0 : _this_queue_index_onClose.call(_this_queue_index);
      this.queue.splice(index2, 1);
    }
    this.updateVisibleToasts("remove");
  }
  updateVisibleToasts(action) {
    this.visibleToasts = this.queue.slice(0, this.maxVisibleToasts);
    this.runWithWrapUpdate(() => {
      for (let fn of this.subscriptions)
        fn();
    }, action);
  }
  /** Pauses the timers for all visible toasts. */
  pauseAll() {
    for (let toast2 of this.visibleToasts)
      if (toast2.timer)
        toast2.timer.pause();
  }
  /** Resumes the timers for all visible toasts. */
  resumeAll() {
    for (let toast2 of this.visibleToasts)
      if (toast2.timer)
        toast2.timer.resume();
  }
  clear() {
    this.queue = [];
    this.updateVisibleToasts("clear");
  }
  constructor(options) {
    this.queue = [];
    this.subscriptions = /* @__PURE__ */ new Set();
    this.visibleToasts = [];
    var _options_maxVisibleToasts;
    this.maxVisibleToasts = (_options_maxVisibleToasts = options === null || options === void 0 ? void 0 : options.maxVisibleToasts) !== null && _options_maxVisibleToasts !== void 0 ? _options_maxVisibleToasts : Infinity;
    this.wrapUpdate = options === null || options === void 0 ? void 0 : options.wrapUpdate;
  }
}
class $77b352cf12efcf73$var$Timer {
  reset(delay2) {
    this.remaining = delay2;
    this.resume();
  }
  pause() {
    if (this.timerId == null)
      return;
    clearTimeout(this.timerId);
    this.timerId = null;
    this.remaining -= Date.now() - this.startTime;
  }
  resume() {
    if (this.remaining <= 0)
      return;
    this.startTime = Date.now();
    this.timerId = setTimeout(() => {
      this.timerId = null;
      this.remaining = 0;
      this.callback();
    }, this.remaining);
  }
  constructor(callback2, delay2) {
    this.startTime = null;
    this.remaining = delay2;
    this.callback = callback2;
  }
}
var loadFeatures = () => __vitePreload(() => import("./index-ZXzIdDnb.js"), true ? __vite__mapDeps([]) : void 0).then((res) => res.domMax);
var globalToastQueue = null;
var getToastQueue = () => {
  if (!globalToastQueue) {
    globalToastQueue = new $77b352cf12efcf73$export$f1f8569633bbbec4({
      maxVisibleToasts: Infinity
    });
  }
  return globalToastQueue;
};
var ToastProvider = ({
  placement = "bottom-right",
  disableAnimation: disableAnimationProp = false,
  maxVisibleToasts = 3,
  toastOffset = 0,
  toastProps = {},
  regionProps
}) => {
  var _a2;
  const toastQueue = $77b352cf12efcf73$export$84726ef35ca2129a(getToastQueue());
  const globalContext = useProviderContext();
  const disableAnimation = (_a2 = disableAnimationProp != null ? disableAnimationProp : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _a2 : false;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LazyMotion, { features: loadFeatures, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatePresence, { children: toastQueue.visibleToasts.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
    ToastRegion,
    {
      disableAnimation,
      maxVisibleToasts,
      placement,
      toastOffset,
      toastProps,
      toastQueue,
      ...regionProps
    }
  ) : null }) });
};
var addToast = ({ ...props }) => {
  if (!globalToastQueue) {
    return null;
  }
  return globalToastQueue.add(props);
};
function injectScript(projectId) {
  try {
    (function(c2, l2, a2, r2, i2, t2, y2) {
      if (l2.getElementById("clarity-script")) {
        return;
      }
      c2[a2] = c2[a2] || function() {
        (c2[a2].q = c2[a2].q || []).push(arguments);
      };
      t2 = l2.createElement(r2);
      t2.async = 1;
      t2.src = "https://www.clarity.ms/tag/" + i2 + "?ref=npm";
      t2.id = "clarity-script";
      y2 = l2.getElementsByTagName(r2)[0];
      y2.parentNode.insertBefore(t2, y2);
    })(window, document, "clarity", "script", projectId);
    return;
  } catch (error2) {
    return;
  }
}
const Clarity = {
  init(projectId) {
    injectScript(projectId);
  },
  setTag(key, value2) {
    window.clarity("set", key, value2);
  },
  identify(customerId, customSessionId, customPageId, friendlyName) {
    window.clarity("identify", customerId, customSessionId, customPageId, friendlyName);
  },
  consent(consent = true) {
    window.clarity("consent", consent);
  },
  upgrade(reason) {
    window.clarity("upgrade", reason);
  },
  event(eventName) {
    window.clarity("event", eventName);
  }
};
var classnames = { exports: {} };
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/
(function(module2) {
  (function() {
    var hasOwn2 = {}.hasOwnProperty;
    function classNames2() {
      var classes = "";
      for (var i2 = 0; i2 < arguments.length; i2++) {
        var arg = arguments[i2];
        if (arg) {
          classes = appendClass(classes, parseValue2(arg));
        }
      }
      return classes;
    }
    function parseValue2(arg) {
      if (typeof arg === "string" || typeof arg === "number") {
        return arg;
      }
      if (typeof arg !== "object") {
        return "";
      }
      if (Array.isArray(arg)) {
        return classNames2.apply(null, arg);
      }
      if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
        return arg.toString();
      }
      var classes = "";
      for (var key in arg) {
        if (hasOwn2.call(arg, key) && arg[key]) {
          classes = appendClass(classes, key);
        }
      }
      return classes;
    }
    function appendClass(value2, newClass) {
      if (!newClass) {
        return value2;
      }
      if (value2) {
        return value2 + " " + newClass;
      }
      return value2 + newClass;
    }
    if (module2.exports) {
      classNames2.default = classNames2;
      module2.exports = classNames2;
    } else {
      window.classNames = classNames2;
    }
  })();
})(classnames);
var classnamesExports = classnames.exports;
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
function _typeof$2(o2) {
  "@babel/helpers - typeof";
  return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
    return typeof o3;
  } : function(o3) {
    return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
  }, _typeof$2(o2);
}
const _typeof$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  get default() {
    return _typeof$2;
  }
}, Symbol.toStringTag, { value: "Module" }));
var REACT_ELEMENT_TYPE_18 = Symbol.for("react.element");
var REACT_ELEMENT_TYPE_19 = Symbol.for("react.transitional.element");
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
function isFragment$1(object4) {
  return (
    // Base object type
    object4 && _typeof$2(object4) === "object" && // React Element type
    (object4.$$typeof === REACT_ELEMENT_TYPE_18 || object4.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type
    object4.type === REACT_FRAGMENT_TYPE
  );
}
function toArray$4(children) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var ret = [];
  React$6.Children.forEach(children, function(child) {
    if ((child === void 0 || child === null) && !option.keepEmpty) {
      return;
    }
    if (Array.isArray(child)) {
      ret = ret.concat(toArray$4(child));
    } else if (isFragment$1(child) && child.props) {
      ret = ret.concat(toArray$4(child.props.children, option));
    } else {
      ret.push(child);
    }
  });
  return ret;
}
var warned = {};
var preMessage = function preMessage2(fn) {
};
function warning$2(valid2, message) {
}
function note(valid2, message) {
}
function resetWarned() {
  warned = {};
}
function call(method4, valid2, message) {
  if (!valid2 && !warned[message]) {
    method4(false, message);
    warned[message] = true;
  }
}
function warningOnce(valid2, message) {
  call(warning$2, valid2, message);
}
function noteOnce(valid2, message) {
  call(note, valid2, message);
}
warningOnce.preMessage = preMessage;
warningOnce.resetWarned = resetWarned;
warningOnce.noteOnce = noteOnce;
function toPrimitive$1(t2, r2) {
  if ("object" != _typeof$2(t2) || !t2)
    return t2;
  var e2 = t2[Symbol.toPrimitive];
  if (void 0 !== e2) {
    var i2 = e2.call(t2, r2);
    if ("object" != _typeof$2(i2))
      return i2;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r2 ? String : Number)(t2);
}
function toPropertyKey$1(t2) {
  var i2 = toPrimitive$1(t2, "string");
  return "symbol" == _typeof$2(i2) ? i2 : i2 + "";
}
function _defineProperty$4(e2, r2, t2) {
  return (r2 = toPropertyKey$1(r2)) in e2 ? Object.defineProperty(e2, r2, {
    value: t2,
    enumerable: true,
    configurable: true,
    writable: true
  }) : e2[r2] = t2, e2;
}
const defineProperty$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: _defineProperty$4
}, Symbol.toStringTag, { value: "Module" }));
function ownKeys$f(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread2(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$f(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$f(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function isDOM(node2) {
  return node2 instanceof HTMLElement || node2 instanceof SVGElement;
}
function getDOM(node2) {
  if (node2 && _typeof$2(node2) === "object" && isDOM(node2.nativeElement)) {
    return node2.nativeElement;
  }
  if (isDOM(node2)) {
    return node2;
  }
  return null;
}
function findDOMNode$1(node2) {
  var domNode = getDOM(node2);
  if (domNode) {
    return domNode;
  }
  if (node2 instanceof React$6.Component) {
    var _ReactDOM$findDOMNode;
    return (_ReactDOM$findDOMNode = ReactDOM.findDOMNode) === null || _ReactDOM$findDOMNode === void 0 ? void 0 : _ReactDOM$findDOMNode.call(ReactDOM, node2);
  }
  return null;
}
var reactIs$2 = { exports: {} };
var reactIs_production_min$1 = {};
/**
 * @license React
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var b$2 = Symbol.for("react.element"), c$5 = Symbol.for("react.portal"), d$3 = Symbol.for("react.fragment"), e$3 = Symbol.for("react.strict_mode"), f$4 = Symbol.for("react.profiler"), g$3 = Symbol.for("react.provider"), h$3 = Symbol.for("react.context"), k$4 = Symbol.for("react.server_context"), l$6 = Symbol.for("react.forward_ref"), m$2 = Symbol.for("react.suspense"), n$5 = Symbol.for("react.suspense_list"), p$5 = Symbol.for("react.memo"), q$2 = Symbol.for("react.lazy"), t$6 = Symbol.for("react.offscreen"), u$5;
u$5 = Symbol.for("react.module.reference");
function v$3(a2) {
  if ("object" === typeof a2 && null !== a2) {
    var r2 = a2.$$typeof;
    switch (r2) {
      case b$2:
        switch (a2 = a2.type, a2) {
          case d$3:
          case f$4:
          case e$3:
          case m$2:
          case n$5:
            return a2;
          default:
            switch (a2 = a2 && a2.$$typeof, a2) {
              case k$4:
              case h$3:
              case l$6:
              case q$2:
              case p$5:
              case g$3:
                return a2;
              default:
                return r2;
            }
        }
      case c$5:
        return r2;
    }
  }
}
reactIs_production_min$1.ContextConsumer = h$3;
reactIs_production_min$1.ContextProvider = g$3;
reactIs_production_min$1.Element = b$2;
reactIs_production_min$1.ForwardRef = l$6;
reactIs_production_min$1.Fragment = d$3;
reactIs_production_min$1.Lazy = q$2;
reactIs_production_min$1.Memo = p$5;
reactIs_production_min$1.Portal = c$5;
reactIs_production_min$1.Profiler = f$4;
reactIs_production_min$1.StrictMode = e$3;
reactIs_production_min$1.Suspense = m$2;
reactIs_production_min$1.SuspenseList = n$5;
reactIs_production_min$1.isAsyncMode = function() {
  return false;
};
reactIs_production_min$1.isConcurrentMode = function() {
  return false;
};
reactIs_production_min$1.isContextConsumer = function(a2) {
  return v$3(a2) === h$3;
};
reactIs_production_min$1.isContextProvider = function(a2) {
  return v$3(a2) === g$3;
};
reactIs_production_min$1.isElement = function(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === b$2;
};
reactIs_production_min$1.isForwardRef = function(a2) {
  return v$3(a2) === l$6;
};
reactIs_production_min$1.isFragment = function(a2) {
  return v$3(a2) === d$3;
};
reactIs_production_min$1.isLazy = function(a2) {
  return v$3(a2) === q$2;
};
reactIs_production_min$1.isMemo = function(a2) {
  return v$3(a2) === p$5;
};
reactIs_production_min$1.isPortal = function(a2) {
  return v$3(a2) === c$5;
};
reactIs_production_min$1.isProfiler = function(a2) {
  return v$3(a2) === f$4;
};
reactIs_production_min$1.isStrictMode = function(a2) {
  return v$3(a2) === e$3;
};
reactIs_production_min$1.isSuspense = function(a2) {
  return v$3(a2) === m$2;
};
reactIs_production_min$1.isSuspenseList = function(a2) {
  return v$3(a2) === n$5;
};
reactIs_production_min$1.isValidElementType = function(a2) {
  return "string" === typeof a2 || "function" === typeof a2 || a2 === d$3 || a2 === f$4 || a2 === e$3 || a2 === m$2 || a2 === n$5 || a2 === t$6 || "object" === typeof a2 && null !== a2 && (a2.$$typeof === q$2 || a2.$$typeof === p$5 || a2.$$typeof === g$3 || a2.$$typeof === h$3 || a2.$$typeof === l$6 || a2.$$typeof === u$5 || void 0 !== a2.getModuleId) ? true : false;
};
reactIs_production_min$1.typeOf = v$3;
{
  reactIs$2.exports = reactIs_production_min$1;
}
var reactIsExports$1 = reactIs$2.exports;
function useMemo(getValue2, condition, shouldUpdate) {
  var cacheRef = reactExports.useRef({});
  if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
    cacheRef.current.value = getValue2();
    cacheRef.current.condition = condition;
  }
  return cacheRef.current.value;
}
var ReactMajorVersion = Number(reactExports.version.split(".")[0]);
var fillRef = function fillRef2(ref, node2) {
  if (typeof ref === "function") {
    ref(node2);
  } else if (_typeof$2(ref) === "object" && ref && "current" in ref) {
    ref.current = node2;
  }
};
var composeRef = function composeRef2() {
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
    refs[_key] = arguments[_key];
  }
  var refList = refs.filter(Boolean);
  if (refList.length <= 1) {
    return refList[0];
  }
  return function(node2) {
    refs.forEach(function(ref) {
      fillRef(ref, node2);
    });
  };
};
var useComposeRef = function useComposeRef2() {
  for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    refs[_key2] = arguments[_key2];
  }
  return useMemo(function() {
    return composeRef.apply(void 0, refs);
  }, refs, function(prev2, next2) {
    return prev2.length !== next2.length || prev2.every(function(ref, i2) {
      return ref !== next2[i2];
    });
  });
};
var supportRef = function supportRef2(nodeOrComponent) {
  var _type$prototype, _nodeOrComponent$prot;
  if (!nodeOrComponent) {
    return false;
  }
  if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) {
    return true;
  }
  var type4 = reactIsExports$1.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
  if (typeof type4 === "function" && !((_type$prototype = type4.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type4.$$typeof !== reactIsExports$1.ForwardRef) {
    return false;
  }
  if (typeof nodeOrComponent === "function" && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== reactIsExports$1.ForwardRef) {
    return false;
  }
  return true;
};
function isReactElement(node2) {
  return /* @__PURE__ */ reactExports.isValidElement(node2) && !isFragment$1(node2);
}
var getNodeRef = function getNodeRef2(node2) {
  if (node2 && isReactElement(node2)) {
    var ele = node2;
    return ele.props.propertyIsEnumerable("ref") ? ele.props.ref : ele.ref;
  }
  return null;
};
var CollectionContext = /* @__PURE__ */ reactExports.createContext(null);
function Collection$2(_ref) {
  var children = _ref.children, onBatchResize = _ref.onBatchResize;
  var resizeIdRef = reactExports.useRef(0);
  var resizeInfosRef = reactExports.useRef([]);
  var onCollectionResize = reactExports.useContext(CollectionContext);
  var onResize4 = reactExports.useCallback(function(size2, element2, data) {
    resizeIdRef.current += 1;
    var currentId = resizeIdRef.current;
    resizeInfosRef.current.push({
      size: size2,
      element: element2,
      data
    });
    Promise.resolve().then(function() {
      if (currentId === resizeIdRef.current) {
        onBatchResize === null || onBatchResize === void 0 || onBatchResize(resizeInfosRef.current);
        resizeInfosRef.current = [];
      }
    });
    onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(size2, element2, data);
  }, [onBatchResize, onCollectionResize]);
  return /* @__PURE__ */ reactExports.createElement(CollectionContext.Provider, {
    value: onResize4
  }, children);
}
var MapShim = function() {
  if (typeof Map !== "undefined") {
    return Map;
  }
  function getIndex(arr, key) {
    var result = -1;
    arr.some(function(entry, index2) {
      if (entry[0] === key) {
        result = index2;
        return true;
      }
      return false;
    });
    return result;
  }
  return (
    /** @class */
    function() {
      function class_1() {
        this.__entries__ = [];
      }
      Object.defineProperty(class_1.prototype, "size", {
        /**
         * @returns {boolean}
         */
        get: function() {
          return this.__entries__.length;
        },
        enumerable: true,
        configurable: true
      });
      class_1.prototype.get = function(key) {
        var index2 = getIndex(this.__entries__, key);
        var entry = this.__entries__[index2];
        return entry && entry[1];
      };
      class_1.prototype.set = function(key, value2) {
        var index2 = getIndex(this.__entries__, key);
        if (~index2) {
          this.__entries__[index2][1] = value2;
        } else {
          this.__entries__.push([key, value2]);
        }
      };
      class_1.prototype.delete = function(key) {
        var entries = this.__entries__;
        var index2 = getIndex(entries, key);
        if (~index2) {
          entries.splice(index2, 1);
        }
      };
      class_1.prototype.has = function(key) {
        return !!~getIndex(this.__entries__, key);
      };
      class_1.prototype.clear = function() {
        this.__entries__.splice(0);
      };
      class_1.prototype.forEach = function(callback2, ctx) {
        if (ctx === void 0) {
          ctx = null;
        }
        for (var _i = 0, _a2 = this.__entries__; _i < _a2.length; _i++) {
          var entry = _a2[_i];
          callback2.call(ctx, entry[1], entry[0]);
        }
      };
      return class_1;
    }()
  );
}();
var isBrowser$2 = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
var global$1 = function() {
  if (typeof global !== "undefined" && global.Math === Math) {
    return global;
  }
  if (typeof self !== "undefined" && self.Math === Math) {
    return self;
  }
  if (typeof window !== "undefined" && window.Math === Math) {
    return window;
  }
  return Function("return this")();
}();
var requestAnimationFrame$1 = function() {
  if (typeof requestAnimationFrame === "function") {
    return requestAnimationFrame.bind(global$1);
  }
  return function(callback2) {
    return setTimeout(function() {
      return callback2(Date.now());
    }, 1e3 / 60);
  };
}();
var trailingTimeout = 2;
function throttle$3(callback2, delay2) {
  var leadingCall = false, trailingCall = false, lastCallTime = 0;
  function resolvePending() {
    if (leadingCall) {
      leadingCall = false;
      callback2();
    }
    if (trailingCall) {
      proxy();
    }
  }
  function timeoutCallback() {
    requestAnimationFrame$1(resolvePending);
  }
  function proxy() {
    var timeStamp = Date.now();
    if (leadingCall) {
      if (timeStamp - lastCallTime < trailingTimeout) {
        return;
      }
      trailingCall = true;
    } else {
      leadingCall = true;
      trailingCall = false;
      setTimeout(timeoutCallback, delay2);
    }
    lastCallTime = timeStamp;
  }
  return proxy;
}
var REFRESH_DELAY = 20;
var transitionKeys = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
var mutationObserverSupported = typeof MutationObserver !== "undefined";
var ResizeObserverController = (
  /** @class */
  function() {
    function ResizeObserverController2() {
      this.connected_ = false;
      this.mutationEventsAdded_ = false;
      this.mutationsObserver_ = null;
      this.observers_ = [];
      this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
      this.refresh = throttle$3(this.refresh.bind(this), REFRESH_DELAY);
    }
    ResizeObserverController2.prototype.addObserver = function(observer) {
      if (!~this.observers_.indexOf(observer)) {
        this.observers_.push(observer);
      }
      if (!this.connected_) {
        this.connect_();
      }
    };
    ResizeObserverController2.prototype.removeObserver = function(observer) {
      var observers2 = this.observers_;
      var index2 = observers2.indexOf(observer);
      if (~index2) {
        observers2.splice(index2, 1);
      }
      if (!observers2.length && this.connected_) {
        this.disconnect_();
      }
    };
    ResizeObserverController2.prototype.refresh = function() {
      var changesDetected = this.updateObservers_();
      if (changesDetected) {
        this.refresh();
      }
    };
    ResizeObserverController2.prototype.updateObservers_ = function() {
      var activeObservers = this.observers_.filter(function(observer) {
        return observer.gatherActive(), observer.hasActive();
      });
      activeObservers.forEach(function(observer) {
        return observer.broadcastActive();
      });
      return activeObservers.length > 0;
    };
    ResizeObserverController2.prototype.connect_ = function() {
      if (!isBrowser$2 || this.connected_) {
        return;
      }
      document.addEventListener("transitionend", this.onTransitionEnd_);
      window.addEventListener("resize", this.refresh);
      if (mutationObserverSupported) {
        this.mutationsObserver_ = new MutationObserver(this.refresh);
        this.mutationsObserver_.observe(document, {
          attributes: true,
          childList: true,
          characterData: true,
          subtree: true
        });
      } else {
        document.addEventListener("DOMSubtreeModified", this.refresh);
        this.mutationEventsAdded_ = true;
      }
      this.connected_ = true;
    };
    ResizeObserverController2.prototype.disconnect_ = function() {
      if (!isBrowser$2 || !this.connected_) {
        return;
      }
      document.removeEventListener("transitionend", this.onTransitionEnd_);
      window.removeEventListener("resize", this.refresh);
      if (this.mutationsObserver_) {
        this.mutationsObserver_.disconnect();
      }
      if (this.mutationEventsAdded_) {
        document.removeEventListener("DOMSubtreeModified", this.refresh);
      }
      this.mutationsObserver_ = null;
      this.mutationEventsAdded_ = false;
      this.connected_ = false;
    };
    ResizeObserverController2.prototype.onTransitionEnd_ = function(_a2) {
      var _b2 = _a2.propertyName, propertyName = _b2 === void 0 ? "" : _b2;
      var isReflowProperty = transitionKeys.some(function(key) {
        return !!~propertyName.indexOf(key);
      });
      if (isReflowProperty) {
        this.refresh();
      }
    };
    ResizeObserverController2.getInstance = function() {
      if (!this.instance_) {
        this.instance_ = new ResizeObserverController2();
      }
      return this.instance_;
    };
    ResizeObserverController2.instance_ = null;
    return ResizeObserverController2;
  }()
);
var defineConfigurable = function(target, props) {
  for (var _i = 0, _a2 = Object.keys(props); _i < _a2.length; _i++) {
    var key = _a2[_i];
    Object.defineProperty(target, key, {
      value: props[key],
      enumerable: false,
      writable: false,
      configurable: true
    });
  }
  return target;
};
var getWindowOf = function(target) {
  var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
  return ownerGlobal || global$1;
};
var emptyRect = createRectInit(0, 0, 0, 0);
function toFloat(value2) {
  return parseFloat(value2) || 0;
}
function getBordersSize(styles2) {
  var positions2 = [];
  for (var _i = 1; _i < arguments.length; _i++) {
    positions2[_i - 1] = arguments[_i];
  }
  return positions2.reduce(function(size2, position2) {
    var value2 = styles2["border-" + position2 + "-width"];
    return size2 + toFloat(value2);
  }, 0);
}
function getPaddings(styles2) {
  var positions2 = ["top", "right", "bottom", "left"];
  var paddings = {};
  for (var _i = 0, positions_1 = positions2; _i < positions_1.length; _i++) {
    var position2 = positions_1[_i];
    var value2 = styles2["padding-" + position2];
    paddings[position2] = toFloat(value2);
  }
  return paddings;
}
function getSVGContentRect(target) {
  var bbox = target.getBBox();
  return createRectInit(0, 0, bbox.width, bbox.height);
}
function getHTMLElementContentRect(target) {
  var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
  if (!clientWidth && !clientHeight) {
    return emptyRect;
  }
  var styles2 = getWindowOf(target).getComputedStyle(target);
  var paddings = getPaddings(styles2);
  var horizPad = paddings.left + paddings.right;
  var vertPad = paddings.top + paddings.bottom;
  var width = toFloat(styles2.width), height = toFloat(styles2.height);
  if (styles2.boxSizing === "border-box") {
    if (Math.round(width + horizPad) !== clientWidth) {
      width -= getBordersSize(styles2, "left", "right") + horizPad;
    }
    if (Math.round(height + vertPad) !== clientHeight) {
      height -= getBordersSize(styles2, "top", "bottom") + vertPad;
    }
  }
  if (!isDocumentElement(target)) {
    var vertScrollbar = Math.round(width + horizPad) - clientWidth;
    var horizScrollbar = Math.round(height + vertPad) - clientHeight;
    if (Math.abs(vertScrollbar) !== 1) {
      width -= vertScrollbar;
    }
    if (Math.abs(horizScrollbar) !== 1) {
      height -= horizScrollbar;
    }
  }
  return createRectInit(paddings.left, paddings.top, width, height);
}
var isSVGGraphicsElement = function() {
  if (typeof SVGGraphicsElement !== "undefined") {
    return function(target) {
      return target instanceof getWindowOf(target).SVGGraphicsElement;
    };
  }
  return function(target) {
    return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function";
  };
}();
function isDocumentElement(target) {
  return target === getWindowOf(target).document.documentElement;
}
function getContentRect(target) {
  if (!isBrowser$2) {
    return emptyRect;
  }
  if (isSVGGraphicsElement(target)) {
    return getSVGContentRect(target);
  }
  return getHTMLElementContentRect(target);
}
function createReadOnlyRect(_a2) {
  var x2 = _a2.x, y2 = _a2.y, width = _a2.width, height = _a2.height;
  var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object;
  var rect = Object.create(Constr.prototype);
  defineConfigurable(rect, {
    x: x2,
    y: y2,
    width,
    height,
    top: y2,
    right: x2 + width,
    bottom: height + y2,
    left: x2
  });
  return rect;
}
function createRectInit(x2, y2, width, height) {
  return { x: x2, y: y2, width, height };
}
var ResizeObservation = (
  /** @class */
  function() {
    function ResizeObservation2(target) {
      this.broadcastWidth = 0;
      this.broadcastHeight = 0;
      this.contentRect_ = createRectInit(0, 0, 0, 0);
      this.target = target;
    }
    ResizeObservation2.prototype.isActive = function() {
      var rect = getContentRect(this.target);
      this.contentRect_ = rect;
      return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
    };
    ResizeObservation2.prototype.broadcastRect = function() {
      var rect = this.contentRect_;
      this.broadcastWidth = rect.width;
      this.broadcastHeight = rect.height;
      return rect;
    };
    return ResizeObservation2;
  }()
);
var ResizeObserverEntry = (
  /** @class */
  /* @__PURE__ */ function() {
    function ResizeObserverEntry2(target, rectInit) {
      var contentRect = createReadOnlyRect(rectInit);
      defineConfigurable(this, { target, contentRect });
    }
    return ResizeObserverEntry2;
  }()
);
var ResizeObserverSPI = (
  /** @class */
  function() {
    function ResizeObserverSPI2(callback2, controller, callbackCtx) {
      this.activeObservations_ = [];
      this.observations_ = new MapShim();
      if (typeof callback2 !== "function") {
        throw new TypeError("The callback provided as parameter 1 is not a function.");
      }
      this.callback_ = callback2;
      this.controller_ = controller;
      this.callbackCtx_ = callbackCtx;
    }
    ResizeObserverSPI2.prototype.observe = function(target) {
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      if (typeof Element === "undefined" || !(Element instanceof Object)) {
        return;
      }
      if (!(target instanceof getWindowOf(target).Element)) {
        throw new TypeError('parameter 1 is not of type "Element".');
      }
      var observations = this.observations_;
      if (observations.has(target)) {
        return;
      }
      observations.set(target, new ResizeObservation(target));
      this.controller_.addObserver(this);
      this.controller_.refresh();
    };
    ResizeObserverSPI2.prototype.unobserve = function(target) {
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      if (typeof Element === "undefined" || !(Element instanceof Object)) {
        return;
      }
      if (!(target instanceof getWindowOf(target).Element)) {
        throw new TypeError('parameter 1 is not of type "Element".');
      }
      var observations = this.observations_;
      if (!observations.has(target)) {
        return;
      }
      observations.delete(target);
      if (!observations.size) {
        this.controller_.removeObserver(this);
      }
    };
    ResizeObserverSPI2.prototype.disconnect = function() {
      this.clearActive();
      this.observations_.clear();
      this.controller_.removeObserver(this);
    };
    ResizeObserverSPI2.prototype.gatherActive = function() {
      var _this = this;
      this.clearActive();
      this.observations_.forEach(function(observation) {
        if (observation.isActive()) {
          _this.activeObservations_.push(observation);
        }
      });
    };
    ResizeObserverSPI2.prototype.broadcastActive = function() {
      if (!this.hasActive()) {
        return;
      }
      var ctx = this.callbackCtx_;
      var entries = this.activeObservations_.map(function(observation) {
        return new ResizeObserverEntry(observation.target, observation.broadcastRect());
      });
      this.callback_.call(ctx, entries, ctx);
      this.clearActive();
    };
    ResizeObserverSPI2.prototype.clearActive = function() {
      this.activeObservations_.splice(0);
    };
    ResizeObserverSPI2.prototype.hasActive = function() {
      return this.activeObservations_.length > 0;
    };
    return ResizeObserverSPI2;
  }()
);
var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim();
var ResizeObserver$2 = (
  /** @class */
  /* @__PURE__ */ function() {
    function ResizeObserver2(callback2) {
      if (!(this instanceof ResizeObserver2)) {
        throw new TypeError("Cannot call a class as a function.");
      }
      if (!arguments.length) {
        throw new TypeError("1 argument required, but only 0 present.");
      }
      var controller = ResizeObserverController.getInstance();
      var observer = new ResizeObserverSPI(callback2, controller, this);
      observers.set(this, observer);
    }
    return ResizeObserver2;
  }()
);
[
  "observe",
  "unobserve",
  "disconnect"
].forEach(function(method4) {
  ResizeObserver$2.prototype[method4] = function() {
    var _a2;
    return (_a2 = observers.get(this))[method4].apply(_a2, arguments);
  };
});
var index$2 = function() {
  if (typeof global$1.ResizeObserver !== "undefined") {
    return global$1.ResizeObserver;
  }
  return ResizeObserver$2;
}();
var elementListeners = /* @__PURE__ */ new Map();
function onResize(entities) {
  entities.forEach(function(entity) {
    var _elementListeners$get;
    var target = entity.target;
    (_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 || _elementListeners$get.forEach(function(listener) {
      return listener(target);
    });
  });
}
var resizeObserver = new index$2(onResize);
function observe(element2, callback2) {
  if (!elementListeners.has(element2)) {
    elementListeners.set(element2, /* @__PURE__ */ new Set());
    resizeObserver.observe(element2);
  }
  elementListeners.get(element2).add(callback2);
}
function unobserve(element2, callback2) {
  if (elementListeners.has(element2)) {
    elementListeners.get(element2).delete(callback2);
    if (!elementListeners.get(element2).size) {
      resizeObserver.unobserve(element2);
      elementListeners.delete(element2);
    }
  }
}
function _classCallCheck$a(a2, n2) {
  if (!(a2 instanceof n2))
    throw new TypeError("Cannot call a class as a function");
}
function _defineProperties(e2, r2) {
  for (var t2 = 0; t2 < r2.length; t2++) {
    var o2 = r2[t2];
    o2.enumerable = o2.enumerable || false, o2.configurable = true, "value" in o2 && (o2.writable = true), Object.defineProperty(e2, toPropertyKey$1(o2.key), o2);
  }
}
function _createClass$8(e2, r2, t2) {
  return r2 && _defineProperties(e2.prototype, r2), t2 && _defineProperties(e2, t2), Object.defineProperty(e2, "prototype", {
    writable: false
  }), e2;
}
function _setPrototypeOf(t2, e2) {
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t3, e3) {
    return t3.__proto__ = e3, t3;
  }, _setPrototypeOf(t2, e2);
}
function _inherits$a(t2, e2) {
  if ("function" != typeof e2 && null !== e2)
    throw new TypeError("Super expression must either be null or a function");
  t2.prototype = Object.create(e2 && e2.prototype, {
    constructor: {
      value: t2,
      writable: true,
      configurable: true
    }
  }), Object.defineProperty(t2, "prototype", {
    writable: false
  }), e2 && _setPrototypeOf(t2, e2);
}
function _getPrototypeOf(t2) {
  return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t3) {
    return t3.__proto__ || Object.getPrototypeOf(t3);
  }, _getPrototypeOf(t2);
}
function _isNativeReflectConstruct$g() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$g = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
function _assertThisInitialized(e2) {
  if (void 0 === e2)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e2;
}
function _possibleConstructorReturn$a(t2, e2) {
  if (e2 && ("object" == _typeof$2(e2) || "function" == typeof e2))
    return e2;
  if (void 0 !== e2)
    throw new TypeError("Derived constructors may only return object or undefined");
  return _assertThisInitialized(t2);
}
function _createSuper$4(t2) {
  var r2 = _isNativeReflectConstruct$g();
  return function() {
    var e2, o2 = _getPrototypeOf(t2);
    if (r2) {
      var s2 = _getPrototypeOf(this).constructor;
      e2 = Reflect.construct(o2, arguments, s2);
    } else
      e2 = o2.apply(this, arguments);
    return _possibleConstructorReturn$a(this, e2);
  };
}
var DomWrapper$1 = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(DomWrapper2, _React$Component);
  var _super = _createSuper$4(DomWrapper2);
  function DomWrapper2() {
    _classCallCheck$a(this, DomWrapper2);
    return _super.apply(this, arguments);
  }
  _createClass$8(DomWrapper2, [{
    key: "render",
    value: function render3() {
      return this.props.children;
    }
  }]);
  return DomWrapper2;
}(reactExports.Component);
function SingleObserver(props, ref) {
  var children = props.children, disabled = props.disabled;
  var elementRef = reactExports.useRef(null);
  var wrapperRef = reactExports.useRef(null);
  var onCollectionResize = reactExports.useContext(CollectionContext);
  var isRenderProps = typeof children === "function";
  var mergedChildren = isRenderProps ? children(elementRef) : children;
  var sizeRef = reactExports.useRef({
    width: -1,
    height: -1,
    offsetWidth: -1,
    offsetHeight: -1
  });
  var canRef = !isRenderProps && /* @__PURE__ */ reactExports.isValidElement(mergedChildren) && supportRef(mergedChildren);
  var originRef = canRef ? getNodeRef(mergedChildren) : null;
  var mergedRef = useComposeRef(originRef, elementRef);
  var getDom = function getDom2() {
    var _elementRef$current;
    return findDOMNode$1(elementRef.current) || // Support `nativeElement` format
    (elementRef.current && _typeof$2(elementRef.current) === "object" ? findDOMNode$1((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.nativeElement) : null) || findDOMNode$1(wrapperRef.current);
  };
  reactExports.useImperativeHandle(ref, function() {
    return getDom();
  });
  var propsRef = reactExports.useRef(props);
  propsRef.current = props;
  var onInternalResize = reactExports.useCallback(function(target) {
    var _propsRef$current = propsRef.current, onResize4 = _propsRef$current.onResize, data = _propsRef$current.data;
    var _target$getBoundingCl = target.getBoundingClientRect(), width = _target$getBoundingCl.width, height = _target$getBoundingCl.height;
    var offsetWidth = target.offsetWidth, offsetHeight = target.offsetHeight;
    var fixedWidth = Math.floor(width);
    var fixedHeight = Math.floor(height);
    if (sizeRef.current.width !== fixedWidth || sizeRef.current.height !== fixedHeight || sizeRef.current.offsetWidth !== offsetWidth || sizeRef.current.offsetHeight !== offsetHeight) {
      var size2 = {
        width: fixedWidth,
        height: fixedHeight,
        offsetWidth,
        offsetHeight
      };
      sizeRef.current = size2;
      var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
      var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
      var sizeInfo = _objectSpread2(_objectSpread2({}, size2), {}, {
        offsetWidth: mergedOffsetWidth,
        offsetHeight: mergedOffsetHeight
      });
      onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(sizeInfo, target, data);
      if (onResize4) {
        Promise.resolve().then(function() {
          onResize4(sizeInfo, target);
        });
      }
    }
  }, []);
  reactExports.useEffect(function() {
    var currentElement = getDom();
    if (currentElement && !disabled) {
      observe(currentElement, onInternalResize);
    }
    return function() {
      return unobserve(currentElement, onInternalResize);
    };
  }, [elementRef.current, disabled]);
  return /* @__PURE__ */ reactExports.createElement(DomWrapper$1, {
    ref: wrapperRef
  }, canRef ? /* @__PURE__ */ reactExports.cloneElement(mergedChildren, {
    ref: mergedRef
  }) : mergedChildren);
}
var RefSingleObserver = /* @__PURE__ */ reactExports.forwardRef(SingleObserver);
var INTERNAL_PREFIX_KEY = "rc-observer-key";
function ResizeObserver$1(props, ref) {
  var children = props.children;
  var childNodes = typeof children === "function" ? [children] : toArray$4(children);
  return childNodes.map(function(child, index2) {
    var key = (child === null || child === void 0 ? void 0 : child.key) || "".concat(INTERNAL_PREFIX_KEY, "-").concat(index2);
    return /* @__PURE__ */ reactExports.createElement(RefSingleObserver, _extends$j({}, props, {
      key,
      ref: index2 === 0 ? ref : void 0
    }), child);
  });
}
var RefResizeObserver = /* @__PURE__ */ reactExports.forwardRef(ResizeObserver$1);
RefResizeObserver.Collection = Collection$2;
function _arrayLikeToArray(r2, a2) {
  (null == a2 || a2 > r2.length) && (a2 = r2.length);
  for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++)
    n2[e2] = r2[e2];
  return n2;
}
function _arrayWithoutHoles(r2) {
  if (Array.isArray(r2))
    return _arrayLikeToArray(r2);
}
function _iterableToArray(r2) {
  if ("undefined" != typeof Symbol && null != r2[Symbol.iterator] || null != r2["@@iterator"])
    return Array.from(r2);
}
function _unsupportedIterableToArray(r2, a2) {
  if (r2) {
    if ("string" == typeof r2)
      return _arrayLikeToArray(r2, a2);
    var t2 = {}.toString.call(r2).slice(8, -1);
    return "Object" === t2 && r2.constructor && (t2 = r2.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r2) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r2, a2) : void 0;
  }
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _toConsumableArray(r2) {
  return _arrayWithoutHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableSpread();
}
var raf$1 = function raf2(callback2) {
  return +setTimeout(callback2, 16);
};
var caf$1 = function caf2(num) {
  return clearTimeout(num);
};
if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
  raf$1 = function raf3(callback2) {
    return window.requestAnimationFrame(callback2);
  };
  caf$1 = function caf3(handle2) {
    return window.cancelAnimationFrame(handle2);
  };
}
var rafUUID = 0;
var rafIds = /* @__PURE__ */ new Map();
function cleanup(id2) {
  rafIds.delete(id2);
}
var wrapperRaf = function wrapperRaf2(callback2) {
  var times = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
  rafUUID += 1;
  var id2 = rafUUID;
  function callRef(leftTimes) {
    if (leftTimes === 0) {
      cleanup(id2);
      callback2();
    } else {
      var realId = raf$1(function() {
        callRef(leftTimes - 1);
      });
      rafIds.set(id2, realId);
    }
  }
  callRef(times);
  return id2;
};
wrapperRaf.cancel = function(id2) {
  var realId = rafIds.get(id2);
  cleanup(id2);
  return caf$1(realId);
};
function _arrayWithHoles(r2) {
  if (Array.isArray(r2))
    return r2;
}
function _iterableToArrayLimit(r2, l2) {
  var t2 = null == r2 ? null : "undefined" != typeof Symbol && r2[Symbol.iterator] || r2["@@iterator"];
  if (null != t2) {
    var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
    try {
      if (i2 = (t2 = t2.call(r2)).next, 0 === l2) {
        if (Object(t2) !== t2)
          return;
        f2 = false;
      } else
        for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
          ;
    } catch (r3) {
      o2 = true, n2 = r3;
    } finally {
      try {
        if (!f2 && null != t2["return"] && (u2 = t2["return"](), Object(u2) !== u2))
          return;
      } finally {
        if (o2)
          throw n2;
      }
    }
    return a2;
  }
}
function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _slicedToArray(r2, e2) {
  return _arrayWithHoles(r2) || _iterableToArrayLimit(r2, e2) || _unsupportedIterableToArray(r2, e2) || _nonIterableRest();
}
const slicedToArray = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: _slicedToArray
}, Symbol.toStringTag, { value: "Module" }));
function murmur2(str) {
  var h3 = 0;
  var k2, i2 = 0, len = str.length;
  for (; len >= 4; ++i2, len -= 4) {
    k2 = str.charCodeAt(i2) & 255 | (str.charCodeAt(++i2) & 255) << 8 | (str.charCodeAt(++i2) & 255) << 16 | (str.charCodeAt(++i2) & 255) << 24;
    k2 = /* Math.imul(k, m): */
    (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16);
    k2 ^= /* k >>> r: */
    k2 >>> 24;
    h3 = /* Math.imul(k, m): */
    (k2 & 65535) * 1540483477 + ((k2 >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
    (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  }
  switch (len) {
    case 3:
      h3 ^= (str.charCodeAt(i2 + 2) & 255) << 16;
    case 2:
      h3 ^= (str.charCodeAt(i2 + 1) & 255) << 8;
    case 1:
      h3 ^= str.charCodeAt(i2) & 255;
      h3 = /* Math.imul(h, m): */
      (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  }
  h3 ^= h3 >>> 13;
  h3 = /* Math.imul(h, m): */
  (h3 & 65535) * 1540483477 + ((h3 >>> 16) * 59797 << 16);
  return ((h3 ^ h3 >>> 15) >>> 0).toString(36);
}
function canUseDom$1() {
  return !!(typeof window !== "undefined" && window.document && window.document.createElement);
}
function contains(root2, n2) {
  if (!root2) {
    return false;
  }
  if (root2.contains) {
    return root2.contains(n2);
  }
  var node2 = n2;
  while (node2) {
    if (node2 === root2) {
      return true;
    }
    node2 = node2.parentNode;
  }
  return false;
}
var APPEND_ORDER = "data-rc-order";
var APPEND_PRIORITY = "data-rc-priority";
var MARK_KEY = "rc-util-key";
var containerCache = /* @__PURE__ */ new Map();
function getMark() {
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, mark2 = _ref.mark;
  if (mark2) {
    return mark2.startsWith("data-") ? mark2 : "data-".concat(mark2);
  }
  return MARK_KEY;
}
function getContainer(option) {
  if (option.attachTo) {
    return option.attachTo;
  }
  var head = document.querySelector("head");
  return head || document.body;
}
function getOrder(prepend) {
  if (prepend === "queue") {
    return "prependQueue";
  }
  return prepend ? "prepend" : "append";
}
function findStyles(container) {
  return Array.from((containerCache.get(container) || container).children).filter(function(node2) {
    return node2.tagName === "STYLE";
  });
}
function injectCSS(css) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  if (!canUseDom$1()) {
    return null;
  }
  var csp = option.csp, prepend = option.prepend, _option$priority = option.priority, priority = _option$priority === void 0 ? 0 : _option$priority;
  var mergedOrder = getOrder(prepend);
  var isPrependQueue = mergedOrder === "prependQueue";
  var styleNode = document.createElement("style");
  styleNode.setAttribute(APPEND_ORDER, mergedOrder);
  if (isPrependQueue && priority) {
    styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
  }
  if (csp !== null && csp !== void 0 && csp.nonce) {
    styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
  }
  styleNode.innerHTML = css;
  var container = getContainer(option);
  var firstChild = container.firstChild;
  if (prepend) {
    if (isPrependQueue) {
      var existStyle = (option.styles || findStyles(container)).filter(function(node2) {
        if (!["prepend", "prependQueue"].includes(node2.getAttribute(APPEND_ORDER))) {
          return false;
        }
        var nodePriority = Number(node2.getAttribute(APPEND_PRIORITY) || 0);
        return priority >= nodePriority;
      });
      if (existStyle.length) {
        container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
        return styleNode;
      }
    }
    container.insertBefore(styleNode, firstChild);
  } else {
    container.appendChild(styleNode);
  }
  return styleNode;
}
function findExistNode(key) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var container = getContainer(option);
  return (option.styles || findStyles(container)).find(function(node2) {
    return node2.getAttribute(getMark(option)) === key;
  });
}
function removeCSS(key) {
  var option = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var existNode = findExistNode(key, option);
  if (existNode) {
    var container = getContainer(option);
    container.removeChild(existNode);
  }
}
function syncRealContainer(container, option) {
  var cachedRealContainer = containerCache.get(container);
  if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
    var placeholderStyle = injectCSS("", option);
    var parentNode = placeholderStyle.parentNode;
    containerCache.set(container, parentNode);
    container.removeChild(placeholderStyle);
  }
}
function updateCSS(css, key) {
  var originOption = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var container = getContainer(originOption);
  var styles2 = findStyles(container);
  var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
    styles: styles2
  });
  syncRealContainer(container, option);
  var existNode = findExistNode(key, option);
  if (existNode) {
    var _option$csp, _option$csp2;
    if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
      var _option$csp3;
      existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
    }
    if (existNode.innerHTML !== css) {
      existNode.innerHTML = css;
    }
    return existNode;
  }
  var newNode = injectCSS(css, option);
  newNode.setAttribute(getMark(option), key);
  return newNode;
}
function _objectWithoutProperties$3(e2, t2) {
  if (null == e2)
    return {};
  var o2, r2, i2 = _objectWithoutPropertiesLoose$2(e2, t2);
  if (Object.getOwnPropertySymbols) {
    var n2 = Object.getOwnPropertySymbols(e2);
    for (r2 = 0; r2 < n2.length; r2++)
      o2 = n2[r2], -1 === t2.indexOf(o2) && {}.propertyIsEnumerable.call(e2, o2) && (i2[o2] = e2[o2]);
  }
  return i2;
}
const objectWithoutProperties = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: _objectWithoutProperties$3
}, Symbol.toStringTag, { value: "Module" }));
function isEqual$2(obj1, obj2) {
  var shallow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  var refSet = /* @__PURE__ */ new Set();
  function deepEqual(a2, b2) {
    var level = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
    var circular = refSet.has(a2);
    warningOnce(!circular, "Warning: There may be circular references");
    if (circular) {
      return false;
    }
    if (a2 === b2) {
      return true;
    }
    if (shallow && level > 1) {
      return false;
    }
    refSet.add(a2);
    var newLevel = level + 1;
    if (Array.isArray(a2)) {
      if (!Array.isArray(b2) || a2.length !== b2.length) {
        return false;
      }
      for (var i2 = 0; i2 < a2.length; i2++) {
        if (!deepEqual(a2[i2], b2[i2], newLevel)) {
          return false;
        }
      }
      return true;
    }
    if (a2 && b2 && _typeof$2(a2) === "object" && _typeof$2(b2) === "object") {
      var keys2 = Object.keys(a2);
      if (keys2.length !== Object.keys(b2).length) {
        return false;
      }
      return keys2.every(function(key) {
        return deepEqual(a2[key], b2[key], newLevel);
      });
    }
    return false;
  }
  return deepEqual(obj1, obj2);
}
var SPLIT$1 = "%";
function pathKey(keys2) {
  return keys2.join(SPLIT$1);
}
var Entity = /* @__PURE__ */ function() {
  function Entity2(instanceId) {
    _classCallCheck$a(this, Entity2);
    _defineProperty$4(this, "instanceId", void 0);
    _defineProperty$4(this, "cache", /* @__PURE__ */ new Map());
    _defineProperty$4(this, "extracted", /* @__PURE__ */ new Set());
    this.instanceId = instanceId;
  }
  _createClass$8(Entity2, [{
    key: "get",
    value: function get5(keys2) {
      return this.opGet(pathKey(keys2));
    }
    /** A fast get cache with `get` concat. */
  }, {
    key: "opGet",
    value: function opGet(keyPathStr) {
      return this.cache.get(keyPathStr) || null;
    }
  }, {
    key: "update",
    value: function update(keys2, valueFn) {
      return this.opUpdate(pathKey(keys2), valueFn);
    }
    /** A fast get cache with `get` concat. */
  }, {
    key: "opUpdate",
    value: function opUpdate(keyPathStr, valueFn) {
      var prevValue = this.cache.get(keyPathStr);
      var nextValue = valueFn(prevValue);
      if (nextValue === null) {
        this.cache.delete(keyPathStr);
      } else {
        this.cache.set(keyPathStr, nextValue);
      }
    }
  }]);
  return Entity2;
}();
var ATTR_TOKEN = "data-token-hash";
var ATTR_MARK = "data-css-hash";
var CSS_IN_JS_INSTANCE = "__cssinjs_instance__";
function createCache() {
  var cssinjsInstanceId = Math.random().toString(12).slice(2);
  if (typeof document !== "undefined" && document.head && document.body) {
    var styles2 = document.body.querySelectorAll("style[".concat(ATTR_MARK, "]")) || [];
    var firstChild = document.head.firstChild;
    Array.from(styles2).forEach(function(style2) {
      style2[CSS_IN_JS_INSTANCE] = style2[CSS_IN_JS_INSTANCE] || cssinjsInstanceId;
      if (style2[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
        document.head.insertBefore(style2, firstChild);
      }
    });
    var styleHash = {};
    Array.from(document.querySelectorAll("style[".concat(ATTR_MARK, "]"))).forEach(function(style2) {
      var hash = style2.getAttribute(ATTR_MARK);
      if (styleHash[hash]) {
        if (style2[CSS_IN_JS_INSTANCE] === cssinjsInstanceId) {
          var _style$parentNode;
          (_style$parentNode = style2.parentNode) === null || _style$parentNode === void 0 || _style$parentNode.removeChild(style2);
        }
      } else {
        styleHash[hash] = true;
      }
    });
  }
  return new Entity(cssinjsInstanceId);
}
var StyleContext = /* @__PURE__ */ reactExports.createContext({
  hashPriority: "low",
  cache: createCache(),
  defaultCache: true
});
function sameDerivativeOption(left2, right) {
  if (left2.length !== right.length) {
    return false;
  }
  for (var i2 = 0; i2 < left2.length; i2++) {
    if (left2[i2] !== right[i2]) {
      return false;
    }
  }
  return true;
}
var ThemeCache = /* @__PURE__ */ function() {
  function ThemeCache2() {
    _classCallCheck$a(this, ThemeCache2);
    _defineProperty$4(this, "cache", void 0);
    _defineProperty$4(this, "keys", void 0);
    _defineProperty$4(this, "cacheCallTimes", void 0);
    this.cache = /* @__PURE__ */ new Map();
    this.keys = [];
    this.cacheCallTimes = 0;
  }
  _createClass$8(ThemeCache2, [{
    key: "size",
    value: function size2() {
      return this.keys.length;
    }
  }, {
    key: "internalGet",
    value: function internalGet(derivativeOption) {
      var _cache2, _cache3;
      var updateCallTimes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var cache2 = {
        map: this.cache
      };
      derivativeOption.forEach(function(derivative2) {
        if (!cache2) {
          cache2 = void 0;
        } else {
          var _cache;
          cache2 = (_cache = cache2) === null || _cache === void 0 || (_cache = _cache.map) === null || _cache === void 0 ? void 0 : _cache.get(derivative2);
        }
      });
      if ((_cache2 = cache2) !== null && _cache2 !== void 0 && _cache2.value && updateCallTimes) {
        cache2.value[1] = this.cacheCallTimes++;
      }
      return (_cache3 = cache2) === null || _cache3 === void 0 ? void 0 : _cache3.value;
    }
  }, {
    key: "get",
    value: function get5(derivativeOption) {
      var _this$internalGet;
      return (_this$internalGet = this.internalGet(derivativeOption, true)) === null || _this$internalGet === void 0 ? void 0 : _this$internalGet[0];
    }
  }, {
    key: "has",
    value: function has(derivativeOption) {
      return !!this.internalGet(derivativeOption);
    }
  }, {
    key: "set",
    value: function set2(derivativeOption, value2) {
      var _this = this;
      if (!this.has(derivativeOption)) {
        if (this.size() + 1 > ThemeCache2.MAX_CACHE_SIZE + ThemeCache2.MAX_CACHE_OFFSET) {
          var _this$keys$reduce = this.keys.reduce(function(result, key) {
            var _result = _slicedToArray(result, 2), callTimes = _result[1];
            if (_this.internalGet(key)[1] < callTimes) {
              return [key, _this.internalGet(key)[1]];
            }
            return result;
          }, [this.keys[0], this.cacheCallTimes]), _this$keys$reduce2 = _slicedToArray(_this$keys$reduce, 1), targetKey = _this$keys$reduce2[0];
          this.delete(targetKey);
        }
        this.keys.push(derivativeOption);
      }
      var cache2 = this.cache;
      derivativeOption.forEach(function(derivative2, index2) {
        if (index2 === derivativeOption.length - 1) {
          cache2.set(derivative2, {
            value: [value2, _this.cacheCallTimes++]
          });
        } else {
          var cacheValue = cache2.get(derivative2);
          if (!cacheValue) {
            cache2.set(derivative2, {
              map: /* @__PURE__ */ new Map()
            });
          } else if (!cacheValue.map) {
            cacheValue.map = /* @__PURE__ */ new Map();
          }
          cache2 = cache2.get(derivative2).map;
        }
      });
    }
  }, {
    key: "deleteByPath",
    value: function deleteByPath(currentCache, derivatives) {
      var cache2 = currentCache.get(derivatives[0]);
      if (derivatives.length === 1) {
        var _cache$value;
        if (!cache2.map) {
          currentCache.delete(derivatives[0]);
        } else {
          currentCache.set(derivatives[0], {
            map: cache2.map
          });
        }
        return (_cache$value = cache2.value) === null || _cache$value === void 0 ? void 0 : _cache$value[0];
      }
      var result = this.deleteByPath(cache2.map, derivatives.slice(1));
      if ((!cache2.map || cache2.map.size === 0) && !cache2.value) {
        currentCache.delete(derivatives[0]);
      }
      return result;
    }
  }, {
    key: "delete",
    value: function _delete(derivativeOption) {
      if (this.has(derivativeOption)) {
        this.keys = this.keys.filter(function(item) {
          return !sameDerivativeOption(item, derivativeOption);
        });
        return this.deleteByPath(this.cache, derivativeOption);
      }
      return void 0;
    }
  }]);
  return ThemeCache2;
}();
_defineProperty$4(ThemeCache, "MAX_CACHE_SIZE", 20);
_defineProperty$4(ThemeCache, "MAX_CACHE_OFFSET", 5);
var uuid$2 = 0;
var Theme = /* @__PURE__ */ function() {
  function Theme2(derivatives) {
    _classCallCheck$a(this, Theme2);
    _defineProperty$4(this, "derivatives", void 0);
    _defineProperty$4(this, "id", void 0);
    this.derivatives = Array.isArray(derivatives) ? derivatives : [derivatives];
    this.id = uuid$2;
    if (derivatives.length === 0) {
      warning$2(derivatives.length > 0);
    }
    uuid$2 += 1;
  }
  _createClass$8(Theme2, [{
    key: "getDerivativeToken",
    value: function getDerivativeToken(token2) {
      return this.derivatives.reduce(function(result, derivative2) {
        return derivative2(token2, result);
      }, void 0);
    }
  }]);
  return Theme2;
}();
var cacheThemes = new ThemeCache();
function createTheme(derivatives) {
  var derivativeArr = Array.isArray(derivatives) ? derivatives : [derivatives];
  if (!cacheThemes.has(derivativeArr)) {
    cacheThemes.set(derivativeArr, new Theme(derivativeArr));
  }
  return cacheThemes.get(derivativeArr);
}
var resultCache = /* @__PURE__ */ new WeakMap();
var RESULT_VALUE = {};
function memoResult(callback2, deps) {
  var current = resultCache;
  for (var i2 = 0; i2 < deps.length; i2 += 1) {
    var dep = deps[i2];
    if (!current.has(dep)) {
      current.set(dep, /* @__PURE__ */ new WeakMap());
    }
    current = current.get(dep);
  }
  if (!current.has(RESULT_VALUE)) {
    current.set(RESULT_VALUE, callback2());
  }
  return current.get(RESULT_VALUE);
}
var flattenTokenCache = /* @__PURE__ */ new WeakMap();
function flattenToken(token2) {
  var str = flattenTokenCache.get(token2) || "";
  if (!str) {
    Object.keys(token2).forEach(function(key) {
      var value2 = token2[key];
      str += key;
      if (value2 instanceof Theme) {
        str += value2.id;
      } else if (value2 && _typeof$2(value2) === "object") {
        str += flattenToken(value2);
      } else {
        str += value2;
      }
    });
    str = murmur2(str);
    flattenTokenCache.set(token2, str);
  }
  return str;
}
function token2key(token2, salt) {
  return murmur2("".concat(salt, "_").concat(flattenToken(token2)));
}
var isClientSide = canUseDom$1();
function unit$1(num) {
  if (typeof num === "number") {
    return "".concat(num, "px");
  }
  return num;
}
function toStyleStr(style2, tokenKey, styleId) {
  var customizeAttrs = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
  var plain = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
  if (plain) {
    return style2;
  }
  var attrs = _objectSpread2(_objectSpread2({}, customizeAttrs), {}, _defineProperty$4(_defineProperty$4({}, ATTR_TOKEN, tokenKey), ATTR_MARK, styleId));
  var attrStr = Object.keys(attrs).map(function(attr) {
    var val = attrs[attr];
    return val ? "".concat(attr, '="').concat(val, '"') : null;
  }).filter(function(v2) {
    return v2;
  }).join(" ");
  return "<style ".concat(attrStr, ">").concat(style2, "</style>");
}
var token2CSSVar = function token2CSSVar2(token2) {
  var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
  return "--".concat(prefix ? "".concat(prefix, "-") : "").concat(token2).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, "$1-$2").replace(/([a-z])([A-Z0-9])/g, "$1-$2").toLowerCase();
};
var serializeCSSVar = function serializeCSSVar2(cssVars, hashId, options) {
  if (!Object.keys(cssVars).length) {
    return "";
  }
  return ".".concat(hashId).concat(options !== null && options !== void 0 && options.scope ? ".".concat(options.scope) : "", "{").concat(Object.entries(cssVars).map(function(_ref) {
    var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value2 = _ref2[1];
    return "".concat(key, ":").concat(value2, ";");
  }).join(""), "}");
};
var transformToken = function transformToken2(token2, themeKey, config2) {
  var cssVars = {};
  var result = {};
  Object.entries(token2).forEach(function(_ref3) {
    var _config$preserve, _config$ignore;
    var _ref4 = _slicedToArray(_ref3, 2), key = _ref4[0], value2 = _ref4[1];
    if (config2 !== null && config2 !== void 0 && (_config$preserve = config2.preserve) !== null && _config$preserve !== void 0 && _config$preserve[key]) {
      result[key] = value2;
    } else if ((typeof value2 === "string" || typeof value2 === "number") && !(config2 !== null && config2 !== void 0 && (_config$ignore = config2.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
      var _config$unitless;
      var cssVar = token2CSSVar(key, config2 === null || config2 === void 0 ? void 0 : config2.prefix);
      cssVars[cssVar] = typeof value2 === "number" && !(config2 !== null && config2 !== void 0 && (_config$unitless = config2.unitless) !== null && _config$unitless !== void 0 && _config$unitless[key]) ? "".concat(value2, "px") : String(value2);
      result[key] = "var(".concat(cssVar, ")");
    }
  });
  return [result, serializeCSSVar(cssVars, themeKey, {
    scope: config2 === null || config2 === void 0 ? void 0 : config2.scope
  })];
};
var useInternalLayoutEffect = canUseDom$1() ? reactExports.useLayoutEffect : reactExports.useEffect;
var useLayoutEffect$1 = function useLayoutEffect2(callback2, deps) {
  var firstMountRef = reactExports.useRef(true);
  useInternalLayoutEffect(function() {
    return callback2(firstMountRef.current);
  }, deps);
  useInternalLayoutEffect(function() {
    firstMountRef.current = false;
    return function() {
      firstMountRef.current = true;
    };
  }, []);
};
var useLayoutUpdateEffect = function useLayoutUpdateEffect2(callback2, deps) {
  useLayoutEffect$1(function(firstMount) {
    if (!firstMount) {
      return callback2();
    }
  }, deps);
};
var fullClone$2 = _objectSpread2({}, React$7);
var useInsertionEffect$1 = fullClone$2.useInsertionEffect;
var useInsertionEffectPolyfill = function useInsertionEffectPolyfill2(renderEffect, effect, deps) {
  reactExports.useMemo(renderEffect, deps);
  useLayoutEffect$1(function() {
    return effect(true);
  }, deps);
};
var useCompatibleInsertionEffect = useInsertionEffect$1 ? function(renderEffect, effect, deps) {
  return useInsertionEffect$1(function() {
    renderEffect();
    return effect();
  }, deps);
} : useInsertionEffectPolyfill;
var fullClone$1 = _objectSpread2({}, React$7);
var useInsertionEffect = fullClone$1.useInsertionEffect;
var useCleanupRegister = function useCleanupRegister2(deps) {
  var effectCleanups = [];
  var cleanupFlag = false;
  function register2(fn) {
    if (cleanupFlag) {
      return;
    }
    effectCleanups.push(fn);
  }
  reactExports.useEffect(function() {
    cleanupFlag = false;
    return function() {
      cleanupFlag = true;
      if (effectCleanups.length) {
        effectCleanups.forEach(function(fn) {
          return fn();
        });
      }
    };
  }, deps);
  return register2;
};
var useRun = function useRun2() {
  return function(fn) {
    fn();
  };
};
var useEffectCleanupRegister = typeof useInsertionEffect !== "undefined" ? useCleanupRegister : useRun;
function useGlobalCache(prefix, keyPath, cacheFn, onCacheRemove, onCacheEffect) {
  var _React$useContext = reactExports.useContext(StyleContext), globalCache = _React$useContext.cache;
  var fullPath = [prefix].concat(_toConsumableArray(keyPath));
  var fullPathStr = pathKey(fullPath);
  var register2 = useEffectCleanupRegister([fullPathStr]);
  var buildCache = function buildCache2(updater) {
    globalCache.opUpdate(fullPathStr, function(prevCache) {
      var _ref = prevCache || [void 0, void 0], _ref2 = _slicedToArray(_ref, 2), _ref2$ = _ref2[0], times = _ref2$ === void 0 ? 0 : _ref2$, cache2 = _ref2[1];
      var tmpCache = cache2;
      var mergedCache = tmpCache || cacheFn();
      var data = [times, mergedCache];
      return updater ? updater(data) : data;
    });
  };
  reactExports.useMemo(
    function() {
      buildCache();
    },
    /* eslint-disable react-hooks/exhaustive-deps */
    [fullPathStr]
    /* eslint-enable */
  );
  var cacheEntity = globalCache.opGet(fullPathStr);
  var cacheContent = cacheEntity[1];
  useCompatibleInsertionEffect(function() {
    onCacheEffect === null || onCacheEffect === void 0 || onCacheEffect(cacheContent);
  }, function(polyfill3) {
    buildCache(function(_ref3) {
      var _ref4 = _slicedToArray(_ref3, 2), times = _ref4[0], cache2 = _ref4[1];
      if (polyfill3 && times === 0) {
        onCacheEffect === null || onCacheEffect === void 0 || onCacheEffect(cacheContent);
      }
      return [times + 1, cache2];
    });
    return function() {
      globalCache.opUpdate(fullPathStr, function(prevCache) {
        var _ref5 = prevCache || [], _ref6 = _slicedToArray(_ref5, 2), _ref6$ = _ref6[0], times = _ref6$ === void 0 ? 0 : _ref6$, cache2 = _ref6[1];
        var nextCount = times - 1;
        if (nextCount === 0) {
          register2(function() {
            if (polyfill3 || !globalCache.opGet(fullPathStr)) {
              onCacheRemove === null || onCacheRemove === void 0 || onCacheRemove(cache2, false);
            }
          });
          return null;
        }
        return [times - 1, cache2];
      });
    };
  }, [fullPathStr]);
  return cacheContent;
}
var EMPTY_OVERRIDE = {};
var hashPrefix = "css";
var tokenKeys = /* @__PURE__ */ new Map();
function recordCleanToken(tokenKey) {
  tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) + 1);
}
function removeStyleTags(key, instanceId) {
  if (typeof document !== "undefined") {
    var styles2 = document.querySelectorAll("style[".concat(ATTR_TOKEN, '="').concat(key, '"]'));
    styles2.forEach(function(style2) {
      if (style2[CSS_IN_JS_INSTANCE] === instanceId) {
        var _style$parentNode;
        (_style$parentNode = style2.parentNode) === null || _style$parentNode === void 0 || _style$parentNode.removeChild(style2);
      }
    });
  }
}
var TOKEN_THRESHOLD = 0;
function cleanTokenStyle(tokenKey, instanceId) {
  tokenKeys.set(tokenKey, (tokenKeys.get(tokenKey) || 0) - 1);
  var cleanableKeyList = /* @__PURE__ */ new Set();
  tokenKeys.forEach(function(value2, key) {
    if (value2 <= 0)
      cleanableKeyList.add(key);
  });
  if (tokenKeys.size - cleanableKeyList.size > TOKEN_THRESHOLD) {
    cleanableKeyList.forEach(function(key) {
      removeStyleTags(key, instanceId);
      tokenKeys.delete(key);
    });
  }
}
var getComputedToken$1 = function getComputedToken2(originToken, overrideToken, theme2, format2) {
  var derivativeToken = theme2.getDerivativeToken(originToken);
  var mergedDerivativeToken = _objectSpread2(_objectSpread2({}, derivativeToken), overrideToken);
  if (format2) {
    mergedDerivativeToken = format2(mergedDerivativeToken);
  }
  return mergedDerivativeToken;
};
var TOKEN_PREFIX = "token";
function useCacheToken(theme2, tokens2) {
  var option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var _useContext = reactExports.useContext(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container;
  var _option$salt = option.salt, salt = _option$salt === void 0 ? "" : _option$salt, _option$override = option.override, override = _option$override === void 0 ? EMPTY_OVERRIDE : _option$override, formatToken2 = option.formatToken, compute = option.getComputedToken, cssVar = option.cssVar;
  var mergedToken = memoResult(function() {
    return Object.assign.apply(Object, [{}].concat(_toConsumableArray(tokens2)));
  }, tokens2);
  var tokenStr = flattenToken(mergedToken);
  var overrideTokenStr = flattenToken(override);
  var cssVarStr = cssVar ? flattenToken(cssVar) : "";
  var cachedToken = useGlobalCache(TOKEN_PREFIX, [salt, theme2.id, tokenStr, overrideTokenStr, cssVarStr], function() {
    var _cssVar$key;
    var mergedDerivativeToken = compute ? compute(mergedToken, override, theme2) : getComputedToken$1(mergedToken, override, theme2, formatToken2);
    var actualToken = _objectSpread2({}, mergedDerivativeToken);
    var cssVarsStr = "";
    if (!!cssVar) {
      var _transformToken = transformToken(mergedDerivativeToken, cssVar.key, {
        prefix: cssVar.prefix,
        ignore: cssVar.ignore,
        unitless: cssVar.unitless,
        preserve: cssVar.preserve
      });
      var _transformToken2 = _slicedToArray(_transformToken, 2);
      mergedDerivativeToken = _transformToken2[0];
      cssVarsStr = _transformToken2[1];
    }
    var tokenKey = token2key(mergedDerivativeToken, salt);
    mergedDerivativeToken._tokenKey = tokenKey;
    actualToken._tokenKey = token2key(actualToken, salt);
    var themeKey = (_cssVar$key = cssVar === null || cssVar === void 0 ? void 0 : cssVar.key) !== null && _cssVar$key !== void 0 ? _cssVar$key : tokenKey;
    mergedDerivativeToken._themeKey = themeKey;
    recordCleanToken(themeKey);
    var hashId = "".concat(hashPrefix, "-").concat(murmur2(tokenKey));
    mergedDerivativeToken._hashId = hashId;
    return [mergedDerivativeToken, hashId, actualToken, cssVarsStr, (cssVar === null || cssVar === void 0 ? void 0 : cssVar.key) || ""];
  }, function(cache2) {
    cleanTokenStyle(cache2[0]._themeKey, instanceId);
  }, function(_ref) {
    var _ref2 = _slicedToArray(_ref, 4), token2 = _ref2[0], cssVarsStr = _ref2[3];
    if (cssVar && cssVarsStr) {
      var style2 = updateCSS(cssVarsStr, murmur2("css-variables-".concat(token2._themeKey)), {
        mark: ATTR_MARK,
        prepend: "queue",
        attachTo: container,
        priority: -999
      });
      style2[CSS_IN_JS_INSTANCE] = instanceId;
      style2.setAttribute(ATTR_TOKEN, token2._themeKey);
    }
  });
  return cachedToken;
}
var extract$2 = function extract2(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 5), realToken = _cache[2], styleStr = _cache[3], cssVarKey = _cache[4];
  var _ref3 = options || {}, plain = _ref3.plain;
  if (!styleStr) {
    return null;
  }
  var styleId = realToken._tokenKey;
  var order2 = -999;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  var styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
  return [order2, styleId, styleText];
};
var unitlessKeys = {
  animationIterationCount: 1,
  borderImageOutset: 1,
  borderImageSlice: 1,
  borderImageWidth: 1,
  boxFlex: 1,
  boxFlexGroup: 1,
  boxOrdinalGroup: 1,
  columnCount: 1,
  columns: 1,
  flex: 1,
  flexGrow: 1,
  flexPositive: 1,
  flexShrink: 1,
  flexNegative: 1,
  flexOrder: 1,
  gridRow: 1,
  gridRowEnd: 1,
  gridRowSpan: 1,
  gridRowStart: 1,
  gridColumn: 1,
  gridColumnEnd: 1,
  gridColumnSpan: 1,
  gridColumnStart: 1,
  msGridRow: 1,
  msGridRowSpan: 1,
  msGridColumn: 1,
  msGridColumnSpan: 1,
  fontWeight: 1,
  lineHeight: 1,
  opacity: 1,
  order: 1,
  orphans: 1,
  tabSize: 1,
  widows: 1,
  zIndex: 1,
  zoom: 1,
  WebkitLineClamp: 1,
  // SVG-related properties
  fillOpacity: 1,
  floodOpacity: 1,
  stopOpacity: 1,
  strokeDasharray: 1,
  strokeDashoffset: 1,
  strokeMiterlimit: 1,
  strokeOpacity: 1,
  strokeWidth: 1
};
var COMMENT = "comm";
var RULESET = "rule";
var DECLARATION = "decl";
var IMPORT = "@import";
var NAMESPACE = "@namespace";
var KEYFRAMES = "@keyframes";
var LAYER = "@layer";
var abs$2 = Math.abs;
var from$2 = String.fromCharCode;
function trim$2(value2) {
  return value2.trim();
}
function replace(value2, pattern4, replacement) {
  return value2.replace(pattern4, replacement);
}
function indexof(value2, search2, position2) {
  return value2.indexOf(search2, position2);
}
function charat(value2, index2) {
  return value2.charCodeAt(index2) | 0;
}
function substr(value2, begin, end) {
  return value2.slice(begin, end);
}
function strlen(value2) {
  return value2.length;
}
function sizeof(value2) {
  return value2.length;
}
function append(value2, array4) {
  return array4.push(value2), value2;
}
var line = 1;
var column = 1;
var length = 0;
var position$2 = 0;
var character = 0;
var characters = "";
function node$1(value2, root2, parent, type4, props, children, length2, siblings) {
  return { value: value2, root: root2, parent, type: type4, props, children, line, column, length: length2, return: "", siblings };
}
function char() {
  return character;
}
function prev() {
  character = position$2 > 0 ? charat(characters, --position$2) : 0;
  if (column--, character === 10)
    column = 1, line--;
  return character;
}
function next() {
  character = position$2 < length ? charat(characters, position$2++) : 0;
  if (column++, character === 10)
    column = 1, line++;
  return character;
}
function peek() {
  return charat(characters, position$2);
}
function caret() {
  return position$2;
}
function slice(begin, end) {
  return substr(characters, begin, end);
}
function token$1(type4) {
  switch (type4) {
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    case 59:
    case 123:
    case 125:
      return 4;
    case 58:
      return 3;
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function alloc(value2) {
  return line = column = 1, length = strlen(characters = value2), position$2 = 0, [];
}
function dealloc(value2) {
  return characters = "", value2;
}
function delimit(type4) {
  return trim$2(slice(position$2 - 1, delimiter(type4 === 91 ? type4 + 2 : type4 === 40 ? type4 + 1 : type4)));
}
function whitespace$2(type4) {
  while (character = peek())
    if (character < 33)
      next();
    else
      break;
  return token$1(type4) > 2 || token$1(character) > 3 ? "" : " ";
}
function escaping(index2, count) {
  while (--count && next())
    if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
      break;
  return slice(index2, caret() + (count < 6 && peek() == 32 && next() == 32));
}
function delimiter(type4) {
  while (next())
    switch (character) {
      case type4:
        return position$2;
      case 34:
      case 39:
        if (type4 !== 34 && type4 !== 39)
          delimiter(character);
        break;
      case 40:
        if (type4 === 41)
          delimiter(type4);
        break;
      case 92:
        next();
        break;
    }
  return position$2;
}
function commenter(type4, index2) {
  while (next())
    if (type4 + character === 47 + 10)
      break;
    else if (type4 + character === 42 + 42 && peek() === 47)
      break;
  return "/*" + slice(index2, position$2 - 1) + "*" + from$2(type4 === 47 ? type4 : next());
}
function identifier(index2) {
  while (!token$1(peek()))
    next();
  return slice(index2, position$2);
}
function compile(value2) {
  return dealloc(parse$2("", null, null, null, [""], value2 = alloc(value2), 0, [0], value2));
}
function parse$2(value2, root2, parent, rule, rules2, rulesets, pseudo, points, declarations) {
  var index2 = 0;
  var offset2 = 0;
  var length2 = pseudo;
  var atrule = 0;
  var property2 = 0;
  var previous2 = 0;
  var variable = 1;
  var scanning = 1;
  var ampersand = 1;
  var character2 = 0;
  var type4 = "";
  var props = rules2;
  var children = rulesets;
  var reference = rule;
  var characters2 = type4;
  while (scanning)
    switch (previous2 = character2, character2 = next()) {
      case 40:
        if (previous2 != 108 && charat(characters2, length2 - 1) == 58) {
          if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs$2(index2 ? points[index2 - 1] : 0)) != -1)
            ampersand = -1;
          break;
        }
      case 34:
      case 39:
      case 91:
        characters2 += delimit(character2);
        break;
      case 9:
      case 10:
      case 13:
      case 32:
        characters2 += whitespace$2(previous2);
        break;
      case 92:
        characters2 += escaping(caret() - 1, 7);
        continue;
      case 47:
        switch (peek()) {
          case 42:
          case 47:
            append(comment(commenter(next(), caret()), root2, parent, declarations), declarations);
            if ((token$1(previous2 || 1) == 5 || token$1(peek() || 1) == 5) && strlen(characters2) && substr(characters2, -1, void 0) !== " ")
              characters2 += " ";
            break;
          default:
            characters2 += "/";
        }
        break;
      case 123 * variable:
        points[index2++] = strlen(characters2) * ampersand;
      case 125 * variable:
      case 59:
      case 0:
        switch (character2) {
          case 0:
          case 125:
            scanning = 0;
          case 59 + offset2:
            if (ampersand == -1)
              characters2 = replace(characters2, /\f/g, "");
            if (property2 > 0 && (strlen(characters2) - length2 || variable === 0 && previous2 === 47))
              append(property2 > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations);
            break;
          case 59:
            characters2 += ";";
          default:
            append(reference = ruleset(characters2, root2, parent, index2, offset2, rules2, points, type4, props = [], children = [], length2, rulesets), rulesets);
            if (character2 === 123)
              if (offset2 === 0)
                parse$2(characters2, root2, reference, reference, props, rulesets, length2, points, children);
              else {
                switch (atrule) {
                  case 99:
                    if (charat(characters2, 3) === 110)
                      break;
                  case 108:
                    if (charat(characters2, 2) === 97)
                      break;
                  default:
                    offset2 = 0;
                  case 100:
                  case 109:
                  case 115:
                }
                if (offset2)
                  parse$2(value2, reference, reference, rule && append(ruleset(value2, reference, reference, 0, 0, rules2, points, type4, rules2, props = [], length2, children), children), rules2, children, length2, points, rule ? props : children);
                else
                  parse$2(characters2, reference, reference, reference, [""], children, 0, points, children);
              }
        }
        index2 = offset2 = property2 = 0, variable = ampersand = 1, type4 = characters2 = "", length2 = pseudo;
        break;
      case 58:
        length2 = 1 + strlen(characters2), property2 = previous2;
      default:
        if (variable < 1) {
          if (character2 == 123)
            --variable;
          else if (character2 == 125 && variable++ == 0 && prev() == 125)
            continue;
        }
        switch (characters2 += from$2(character2), character2 * variable) {
          case 38:
            ampersand = offset2 > 0 ? 1 : (characters2 += "\f", -1);
            break;
          case 44:
            points[index2++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
            break;
          case 64:
            if (peek() === 45)
              characters2 += delimit(next());
            atrule = peek(), offset2 = length2 = strlen(type4 = characters2 += identifier(caret())), character2++;
            break;
          case 45:
            if (previous2 === 45 && strlen(characters2) == 2)
              variable = 0;
        }
    }
  return rulesets;
}
function ruleset(value2, root2, parent, index2, offset2, rules2, points, type4, props, children, length2, siblings) {
  var post2 = offset2 - 1;
  var rule = offset2 === 0 ? rules2 : [""];
  var size2 = sizeof(rule);
  for (var i2 = 0, j2 = 0, k2 = 0; i2 < index2; ++i2)
    for (var x2 = 0, y2 = substr(value2, post2 + 1, post2 = abs$2(j2 = points[i2])), z2 = value2; x2 < size2; ++x2)
      if (z2 = trim$2(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
        props[k2++] = z2;
  return node$1(value2, root2, parent, offset2 === 0 ? RULESET : type4, props, children, length2, siblings);
}
function comment(value2, root2, parent, siblings) {
  return node$1(value2, root2, parent, COMMENT, from$2(char()), substr(value2, 2, -2), 0, siblings);
}
function declaration(value2, root2, parent, length2, siblings) {
  return node$1(value2, root2, parent, DECLARATION, substr(value2, 0, length2), substr(value2, length2 + 1, -1), length2, siblings);
}
function serialize$1(children, callback2) {
  var output2 = "";
  for (var i2 = 0; i2 < children.length; i2++)
    output2 += callback2(children[i2], i2, children, callback2) || "";
  return output2;
}
function stringify$3(element2, index2, children, callback2) {
  switch (element2.type) {
    case LAYER:
      if (element2.children.length)
        break;
    case IMPORT:
    case NAMESPACE:
    case DECLARATION:
      return element2.return = element2.return || element2.value;
    case COMMENT:
      return "";
    case KEYFRAMES:
      return element2.return = element2.value + "{" + serialize$1(element2.children, callback2) + "}";
    case RULESET:
      if (!strlen(element2.value = element2.props.join(",")))
        return "";
  }
  return strlen(children = serialize$1(element2.children, callback2)) ? element2.return = element2.value + "{" + children + "}" : "";
}
var ATTR_CACHE_MAP = "data-ant-cssinjs-cache-path";
var CSS_FILE_STYLE = "_FILE_STYLE__";
var cachePathMap;
var fromCSSFile = true;
function prepare() {
  if (!cachePathMap) {
    cachePathMap = {};
    if (canUseDom$1()) {
      var div = document.createElement("div");
      div.className = ATTR_CACHE_MAP;
      div.style.position = "fixed";
      div.style.visibility = "hidden";
      div.style.top = "-9999px";
      document.body.appendChild(div);
      var content2 = getComputedStyle(div).content || "";
      content2 = content2.replace(/^"/, "").replace(/"$/, "");
      content2.split(";").forEach(function(item) {
        var _item$split = item.split(":"), _item$split2 = _slicedToArray(_item$split, 2), path = _item$split2[0], hash = _item$split2[1];
        cachePathMap[path] = hash;
      });
      var inlineMapStyle = document.querySelector("style[".concat(ATTR_CACHE_MAP, "]"));
      if (inlineMapStyle) {
        var _inlineMapStyle$paren;
        fromCSSFile = false;
        (_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);
      }
      document.body.removeChild(div);
    }
  }
}
function existPath(path) {
  prepare();
  return !!cachePathMap[path];
}
function getStyleAndHash(path) {
  var hash = cachePathMap[path];
  var styleStr = null;
  if (hash && canUseDom$1()) {
    if (fromCSSFile) {
      styleStr = CSS_FILE_STYLE;
    } else {
      var _style = document.querySelector("style[".concat(ATTR_MARK, '="').concat(cachePathMap[path], '"]'));
      if (_style) {
        styleStr = _style.innerHTML;
      } else {
        delete cachePathMap[path];
      }
    }
  }
  return [styleStr, hash];
}
var SKIP_CHECK = "_skip_check_";
var MULTI_VALUE = "_multi_value_";
function normalizeStyle(styleStr) {
  var serialized = serialize$1(compile(styleStr), stringify$3);
  return serialized.replace(/\{%%%\:[^;];}/g, ";");
}
function isCompoundCSSProperty(value2) {
  return _typeof$2(value2) === "object" && value2 && (SKIP_CHECK in value2 || MULTI_VALUE in value2);
}
function injectSelectorHash(key, hashId, hashPriority) {
  if (!hashId) {
    return key;
  }
  var hashClassName = ".".concat(hashId);
  var hashSelector = hashPriority === "low" ? ":where(".concat(hashClassName, ")") : hashClassName;
  var keys2 = key.split(",").map(function(k2) {
    var _firstPath$match;
    var fullPath = k2.trim().split(/\s+/);
    var firstPath = fullPath[0] || "";
    var htmlElement = ((_firstPath$match = firstPath.match(/^\w+/)) === null || _firstPath$match === void 0 ? void 0 : _firstPath$match[0]) || "";
    firstPath = "".concat(htmlElement).concat(hashSelector).concat(firstPath.slice(htmlElement.length));
    return [firstPath].concat(_toConsumableArray(fullPath.slice(1))).join(" ");
  });
  return keys2.join(",");
}
var parseStyle$1 = function parseStyle2(interpolation) {
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
    root: true,
    parentSelectors: []
  }, root2 = _ref.root, injectHash = _ref.injectHash, parentSelectors = _ref.parentSelectors;
  var hashId = config2.hashId, layer = config2.layer;
  config2.path;
  var hashPriority = config2.hashPriority, _config$transformers = config2.transformers, transformers = _config$transformers === void 0 ? [] : _config$transformers;
  config2.linters;
  var styleStr = "";
  var effectStyle = {};
  function parseKeyframes(keyframes2) {
    var animationName = keyframes2.getName(hashId);
    if (!effectStyle[animationName]) {
      var _parseStyle = parseStyle2(keyframes2.style, config2, {
        root: false,
        parentSelectors
      }), _parseStyle2 = _slicedToArray(_parseStyle, 1), _parsedStr = _parseStyle2[0];
      effectStyle[animationName] = "@keyframes ".concat(keyframes2.getName(hashId)).concat(_parsedStr);
    }
  }
  function flattenList(list2) {
    var fullList = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
    list2.forEach(function(item) {
      if (Array.isArray(item)) {
        flattenList(item, fullList);
      } else if (item) {
        fullList.push(item);
      }
    });
    return fullList;
  }
  var flattenStyleList = flattenList(Array.isArray(interpolation) ? interpolation : [interpolation]);
  flattenStyleList.forEach(function(originStyle) {
    var style2 = typeof originStyle === "string" && !root2 ? {} : originStyle;
    if (typeof style2 === "string") {
      styleStr += "".concat(style2, "\n");
    } else if (style2._keyframe) {
      parseKeyframes(style2);
    } else {
      var mergedStyle = transformers.reduce(function(prev2, trans) {
        var _trans$visit;
        return (trans === null || trans === void 0 || (_trans$visit = trans.visit) === null || _trans$visit === void 0 ? void 0 : _trans$visit.call(trans, prev2)) || prev2;
      }, style2);
      Object.keys(mergedStyle).forEach(function(key) {
        var value2 = mergedStyle[key];
        if (_typeof$2(value2) === "object" && value2 && (key !== "animationName" || !value2._keyframe) && !isCompoundCSSProperty(value2)) {
          var subInjectHash = false;
          var mergedKey = key.trim();
          var nextRoot = false;
          if ((root2 || injectHash) && hashId) {
            if (mergedKey.startsWith("@")) {
              subInjectHash = true;
            } else if (mergedKey === "&") {
              mergedKey = injectSelectorHash("", hashId, hashPriority);
            } else {
              mergedKey = injectSelectorHash(key, hashId, hashPriority);
            }
          } else if (root2 && !hashId && (mergedKey === "&" || mergedKey === "")) {
            mergedKey = "";
            nextRoot = true;
          }
          var _parseStyle3 = parseStyle2(value2, config2, {
            root: nextRoot,
            injectHash: subInjectHash,
            parentSelectors: [].concat(_toConsumableArray(parentSelectors), [mergedKey])
          }), _parseStyle4 = _slicedToArray(_parseStyle3, 2), _parsedStr2 = _parseStyle4[0], childEffectStyle = _parseStyle4[1];
          effectStyle = _objectSpread2(_objectSpread2({}, effectStyle), childEffectStyle);
          styleStr += "".concat(mergedKey).concat(_parsedStr2);
        } else {
          let appendStyle = function(cssKey, cssValue) {
            var styleName = cssKey.replace(/[A-Z]/g, function(match5) {
              return "-".concat(match5.toLowerCase());
            });
            var formatValue = cssValue;
            if (!unitlessKeys[cssKey] && typeof formatValue === "number" && formatValue !== 0) {
              formatValue = "".concat(formatValue, "px");
            }
            if (cssKey === "animationName" && cssValue !== null && cssValue !== void 0 && cssValue._keyframe) {
              parseKeyframes(cssValue);
              formatValue = cssValue.getName(hashId);
            }
            styleStr += "".concat(styleName, ":").concat(formatValue, ";");
          };
          var _value;
          var actualValue = (_value = value2 === null || value2 === void 0 ? void 0 : value2.value) !== null && _value !== void 0 ? _value : value2;
          if (_typeof$2(value2) === "object" && value2 !== null && value2 !== void 0 && value2[MULTI_VALUE] && Array.isArray(actualValue)) {
            actualValue.forEach(function(item) {
              appendStyle(key, item);
            });
          } else {
            appendStyle(key, actualValue);
          }
        }
      });
    }
  });
  if (!root2) {
    styleStr = "{".concat(styleStr, "}");
  } else if (layer) {
    if (styleStr) {
      styleStr = "@layer ".concat(layer.name, " {").concat(styleStr, "}");
    }
    if (layer.dependencies) {
      effectStyle["@layer ".concat(layer.name)] = layer.dependencies.map(function(deps) {
        return "@layer ".concat(deps, ", ").concat(layer.name, ";");
      }).join("\n");
    }
  }
  return [styleStr, effectStyle];
};
function uniqueHash(path, styleStr) {
  return murmur2("".concat(path.join("%")).concat(styleStr));
}
function Empty() {
  return null;
}
var STYLE_PREFIX = "style";
function useStyleRegister(info, styleFn) {
  var token2 = info.token, path = info.path, hashId = info.hashId, layer = info.layer, nonce = info.nonce, clientOnly = info.clientOnly, _info$order = info.order, order2 = _info$order === void 0 ? 0 : _info$order;
  var _React$useContext = reactExports.useContext(StyleContext), autoClear = _React$useContext.autoClear;
  _React$useContext.mock;
  var defaultCache = _React$useContext.defaultCache, hashPriority = _React$useContext.hashPriority, container = _React$useContext.container, ssrInline = _React$useContext.ssrInline, transformers = _React$useContext.transformers, linters = _React$useContext.linters, cache2 = _React$useContext.cache, enableLayer = _React$useContext.layer;
  var tokenKey = token2._tokenKey;
  var fullPath = [tokenKey];
  if (enableLayer) {
    fullPath.push("layer");
  }
  fullPath.push.apply(fullPath, _toConsumableArray(path));
  var isMergedClientSide = isClientSide;
  var _useGlobalCache = useGlobalCache(
    STYLE_PREFIX,
    fullPath,
    // Create cache if needed
    function() {
      var cachePath = fullPath.join("|");
      if (existPath(cachePath)) {
        var _getStyleAndHash = getStyleAndHash(cachePath), _getStyleAndHash2 = _slicedToArray(_getStyleAndHash, 2), inlineCacheStyleStr = _getStyleAndHash2[0], styleHash = _getStyleAndHash2[1];
        if (inlineCacheStyleStr) {
          return [inlineCacheStyleStr, tokenKey, styleHash, {}, clientOnly, order2];
        }
      }
      var styleObj = styleFn();
      var _parseStyle5 = parseStyle$1(styleObj, {
        hashId,
        hashPriority,
        layer: enableLayer ? layer : void 0,
        path: path.join("-"),
        transformers,
        linters
      }), _parseStyle6 = _slicedToArray(_parseStyle5, 2), parsedStyle = _parseStyle6[0], effectStyle = _parseStyle6[1];
      var styleStr = normalizeStyle(parsedStyle);
      var styleId = uniqueHash(fullPath, styleStr);
      return [styleStr, tokenKey, styleId, effectStyle, clientOnly, order2];
    },
    // Remove cache if no need
    function(_ref2, fromHMR) {
      var _ref3 = _slicedToArray(_ref2, 3), styleId = _ref3[2];
      if ((fromHMR || autoClear) && isClientSide) {
        removeCSS(styleId, {
          mark: ATTR_MARK,
          attachTo: container
        });
      }
    },
    // Effect: Inject style here
    function(_ref4) {
      var _ref5 = _slicedToArray(_ref4, 4), styleStr = _ref5[0];
      _ref5[1];
      var styleId = _ref5[2], effectStyle = _ref5[3];
      if (isMergedClientSide && styleStr !== CSS_FILE_STYLE) {
        var mergedCSSConfig = {
          mark: ATTR_MARK,
          prepend: enableLayer ? false : "queue",
          attachTo: container,
          priority: order2
        };
        var nonceStr = typeof nonce === "function" ? nonce() : nonce;
        if (nonceStr) {
          mergedCSSConfig.csp = {
            nonce: nonceStr
          };
        }
        var effectLayerKeys = [];
        var effectRestKeys = [];
        Object.keys(effectStyle).forEach(function(key) {
          if (key.startsWith("@layer")) {
            effectLayerKeys.push(key);
          } else {
            effectRestKeys.push(key);
          }
        });
        effectLayerKeys.forEach(function(effectKey) {
          updateCSS(normalizeStyle(effectStyle[effectKey]), "_layer-".concat(effectKey), _objectSpread2(_objectSpread2({}, mergedCSSConfig), {}, {
            prepend: true
          }));
        });
        var style2 = updateCSS(styleStr, styleId, mergedCSSConfig);
        style2[CSS_IN_JS_INSTANCE] = cache2.instanceId;
        style2.setAttribute(ATTR_TOKEN, tokenKey);
        effectRestKeys.forEach(function(effectKey) {
          updateCSS(normalizeStyle(effectStyle[effectKey]), "_effect-".concat(effectKey), mergedCSSConfig);
        });
      }
    }
  ), _useGlobalCache2 = _slicedToArray(_useGlobalCache, 3), cachedStyleStr = _useGlobalCache2[0], cachedTokenKey = _useGlobalCache2[1], cachedStyleId = _useGlobalCache2[2];
  return function(node2) {
    var styleNode;
    if (!ssrInline || isMergedClientSide || !defaultCache) {
      styleNode = /* @__PURE__ */ reactExports.createElement(Empty, null);
    } else {
      styleNode = /* @__PURE__ */ reactExports.createElement("style", _extends$j({}, _defineProperty$4(_defineProperty$4({}, ATTR_TOKEN, cachedTokenKey), ATTR_MARK, cachedStyleId), {
        dangerouslySetInnerHTML: {
          __html: cachedStyleStr
        }
      }));
    }
    return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, styleNode, node2);
  };
}
var extract$1 = function extract22(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 6), styleStr = _cache[0], tokenKey = _cache[1], styleId = _cache[2], effectStyle = _cache[3], clientOnly = _cache[4], order2 = _cache[5];
  var _ref7 = options || {}, plain = _ref7.plain;
  if (clientOnly) {
    return null;
  }
  var keyStyleText = styleStr;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  keyStyleText = toStyleStr(styleStr, tokenKey, styleId, sharedAttrs, plain);
  if (effectStyle) {
    Object.keys(effectStyle).forEach(function(effectKey) {
      if (!effectStyles[effectKey]) {
        effectStyles[effectKey] = true;
        var effectStyleStr = normalizeStyle(effectStyle[effectKey]);
        var effectStyleHTML = toStyleStr(effectStyleStr, tokenKey, "_effect-".concat(effectKey), sharedAttrs, plain);
        if (effectKey.startsWith("@layer")) {
          keyStyleText = effectStyleHTML + keyStyleText;
        } else {
          keyStyleText += effectStyleHTML;
        }
      }
    });
  }
  return [order2, styleId, keyStyleText];
};
var CSS_VAR_PREFIX = "cssVar";
var useCSSVarRegister = function useCSSVarRegister2(config2, fn) {
  var key = config2.key, prefix = config2.prefix, unitless2 = config2.unitless, ignore2 = config2.ignore, token2 = config2.token, _config$scope = config2.scope, scope = _config$scope === void 0 ? "" : _config$scope;
  var _useContext = reactExports.useContext(StyleContext), instanceId = _useContext.cache.instanceId, container = _useContext.container;
  var tokenKey = token2._tokenKey;
  var stylePath = [].concat(_toConsumableArray(config2.path), [key, scope, tokenKey]);
  var cache2 = useGlobalCache(CSS_VAR_PREFIX, stylePath, function() {
    var originToken = fn();
    var _transformToken = transformToken(originToken, key, {
      prefix,
      unitless: unitless2,
      ignore: ignore2,
      scope
    }), _transformToken2 = _slicedToArray(_transformToken, 2), mergedToken = _transformToken2[0], cssVarsStr = _transformToken2[1];
    var styleId = uniqueHash(stylePath, cssVarsStr);
    return [mergedToken, cssVarsStr, styleId, key];
  }, function(_ref) {
    var _ref2 = _slicedToArray(_ref, 3), styleId = _ref2[2];
    if (isClientSide) {
      removeCSS(styleId, {
        mark: ATTR_MARK,
        attachTo: container
      });
    }
  }, function(_ref3) {
    var _ref4 = _slicedToArray(_ref3, 3), cssVarsStr = _ref4[1], styleId = _ref4[2];
    if (!cssVarsStr) {
      return;
    }
    var style2 = updateCSS(cssVarsStr, styleId, {
      mark: ATTR_MARK,
      prepend: "queue",
      attachTo: container,
      priority: -999
    });
    style2[CSS_IN_JS_INSTANCE] = instanceId;
    style2.setAttribute(ATTR_TOKEN, key);
  });
  return cache2;
};
var extract = function extract3(cache2, effectStyles, options) {
  var _cache = _slicedToArray(cache2, 4), styleStr = _cache[1], styleId = _cache[2], cssVarKey = _cache[3];
  var _ref5 = options || {}, plain = _ref5.plain;
  if (!styleStr) {
    return null;
  }
  var order2 = -999;
  var sharedAttrs = {
    "data-rc-order": "prependQueue",
    "data-rc-priority": "".concat(order2)
  };
  var styleText = toStyleStr(styleStr, cssVarKey, styleId, sharedAttrs, plain);
  return [order2, styleId, styleText];
};
_defineProperty$4(_defineProperty$4(_defineProperty$4({}, STYLE_PREFIX, extract$1), TOKEN_PREFIX, extract$2), CSS_VAR_PREFIX, extract);
var Keyframe = /* @__PURE__ */ function() {
  function Keyframe2(name2, style2) {
    _classCallCheck$a(this, Keyframe2);
    _defineProperty$4(this, "name", void 0);
    _defineProperty$4(this, "style", void 0);
    _defineProperty$4(this, "_keyframe", true);
    this.name = name2;
    this.style = style2;
  }
  _createClass$8(Keyframe2, [{
    key: "getName",
    value: function getName() {
      var hashId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
      return hashId ? "".concat(hashId, "-").concat(this.name) : this.name;
    }
  }]);
  return Keyframe2;
}();
function noSplit(list2) {
  list2.notSplit = true;
  return list2;
}
({
  // Border
  borderBlock: noSplit(["borderTop", "borderBottom"]),
  borderBlockStart: noSplit(["borderTop"]),
  borderBlockEnd: noSplit(["borderBottom"]),
  borderInline: noSplit(["borderLeft", "borderRight"]),
  borderInlineStart: noSplit(["borderLeft"]),
  borderInlineEnd: noSplit(["borderRight"])
});
var IconContext$1 = /* @__PURE__ */ reactExports.createContext({});
function _toArray(r2) {
  return _arrayWithHoles(r2) || _iterableToArray(r2) || _unsupportedIterableToArray(r2) || _nonIterableRest();
}
function get$8(entity, path) {
  var current = entity;
  for (var i2 = 0; i2 < path.length; i2 += 1) {
    if (current === null || current === void 0) {
      return void 0;
    }
    current = current[path[i2]];
  }
  return current;
}
function internalSet(entity, paths, value2, removeIfUndefined) {
  if (!paths.length) {
    return value2;
  }
  var _paths = _toArray(paths), path = _paths[0], restPath = _paths.slice(1);
  var clone3;
  if (!entity && typeof path === "number") {
    clone3 = [];
  } else if (Array.isArray(entity)) {
    clone3 = _toConsumableArray(entity);
  } else {
    clone3 = _objectSpread2({}, entity);
  }
  if (removeIfUndefined && value2 === void 0 && restPath.length === 1) {
    delete clone3[path][restPath[0]];
  } else {
    clone3[path] = internalSet(clone3[path], restPath, value2, removeIfUndefined);
  }
  return clone3;
}
function set$3(entity, paths, value2) {
  var removeIfUndefined = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
  if (paths.length && removeIfUndefined && value2 === void 0 && !get$8(entity, paths.slice(0, -1))) {
    return entity;
  }
  return internalSet(entity, paths, value2, removeIfUndefined);
}
function isObject$c(obj) {
  return _typeof$2(obj) === "object" && obj !== null && Object.getPrototypeOf(obj) === Object.prototype;
}
function createEmpty(source2) {
  return Array.isArray(source2) ? [] : {};
}
var keys$9 = typeof Reflect === "undefined" ? Object.keys : Reflect.ownKeys;
function merge$5() {
  for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
    sources[_key] = arguments[_key];
  }
  var clone3 = createEmpty(sources[0]);
  sources.forEach(function(src) {
    function internalMerge(path, parentLoopSet) {
      var loopSet = new Set(parentLoopSet);
      var value2 = get$8(src, path);
      var isArr = Array.isArray(value2);
      if (isArr || isObject$c(value2)) {
        if (!loopSet.has(value2)) {
          loopSet.add(value2);
          var originValue = get$8(clone3, path);
          if (isArr) {
            clone3 = set$3(clone3, path, []);
          } else if (!originValue || _typeof$2(originValue) !== "object") {
            clone3 = set$3(clone3, path, createEmpty(value2));
          }
          keys$9(value2).forEach(function(key) {
            internalMerge([].concat(_toConsumableArray(path), [key]), loopSet);
          });
        }
      } else {
        clone3 = set$3(clone3, path, value2);
      }
    }
    internalMerge([]);
  });
  return clone3;
}
function noop$8() {
}
const WarningContext = /* @__PURE__ */ reactExports.createContext({});
const devUseWarning = () => {
  const noopWarning = () => {
  };
  noopWarning.deprecated = noop$8;
  return noopWarning;
};
const ValidateMessagesContext = /* @__PURE__ */ reactExports.createContext(void 0);
const typeTemplate$1 = "${label} is not a valid ${type}";
const localeValues = {
  Modal: {
    okText: "OK",
    cancelText: "Cancel",
    justOkText: "OK"
  },
  Form: {
    optional: "(optional)",
    defaultValidateMessages: {
      default: "Field validation error for ${label}",
      required: "Please enter ${label}",
      enum: "${label} must be one of [${enum}]",
      whitespace: "${label} cannot be a blank character",
      date: {
        format: "${label} date format is invalid",
        parse: "${label} cannot be converted to a date",
        invalid: "${label} is an invalid date"
      },
      types: {
        string: typeTemplate$1,
        method: typeTemplate$1,
        array: typeTemplate$1,
        object: typeTemplate$1,
        number: typeTemplate$1,
        date: typeTemplate$1,
        boolean: typeTemplate$1,
        integer: typeTemplate$1,
        float: typeTemplate$1,
        regexp: typeTemplate$1,
        email: typeTemplate$1,
        url: typeTemplate$1,
        hex: typeTemplate$1
      },
      string: {
        len: "${label} must be ${len} characters",
        min: "${label} must be at least ${min} characters",
        max: "${label} must be up to ${max} characters",
        range: "${label} must be between ${min}-${max} characters"
      },
      number: {
        len: "${label} must be equal to ${len}",
        min: "${label} must be minimum ${min}",
        max: "${label} must be maximum ${max}",
        range: "${label} must be between ${min}-${max}"
      },
      array: {
        len: "Must be ${len} ${label}",
        min: "At least ${min} ${label}",
        max: "At most ${max} ${label}",
        range: "The amount of ${label} must be between ${min}-${max}"
      },
      pattern: {
        mismatch: "${label} does not match the pattern ${pattern}"
      }
    }
  }
};
Object.assign({}, localeValues.Modal);
let localeList = [];
const generateLocale = () => localeList.reduce((merged, locale2) => Object.assign(Object.assign({}, merged), locale2), localeValues.Modal);
function changeConfirmLocale(newLocale) {
  if (newLocale) {
    const cloneLocale = Object.assign({}, newLocale);
    localeList.push(cloneLocale);
    generateLocale();
    return () => {
      localeList = localeList.filter((locale2) => locale2 !== cloneLocale);
      generateLocale();
    };
  }
  Object.assign({}, localeValues.Modal);
}
const LocaleContext = /* @__PURE__ */ reactExports.createContext(void 0);
const ANT_MARK = "internalMark";
const LocaleProvider = (props) => {
  const {
    locale: locale2 = {},
    children,
    _ANT_MARK__
  } = props;
  reactExports.useEffect(() => {
    const clearLocale = changeConfirmLocale(locale2 === null || locale2 === void 0 ? void 0 : locale2.Modal);
    return clearLocale;
  }, [locale2]);
  const getMemoizedContextValue = reactExports.useMemo(() => Object.assign(Object.assign({}, locale2), {
    exist: true
  }), [locale2]);
  return /* @__PURE__ */ reactExports.createElement(LocaleContext.Provider, {
    value: getMemoizedContextValue
  }, children);
};
const defaultPresetColors = {
  blue: "#1677FF",
  purple: "#722ED1",
  cyan: "#13C2C2",
  green: "#52C41A",
  magenta: "#EB2F96",
  /**
   * @deprecated Use magenta instead
   */
  pink: "#EB2F96",
  red: "#F5222D",
  orange: "#FA8C16",
  yellow: "#FADB14",
  volcano: "#FA541C",
  geekblue: "#2F54EB",
  gold: "#FAAD14",
  lime: "#A0D911"
};
const seedToken = Object.assign(Object.assign({}, defaultPresetColors), {
  // Color
  colorPrimary: "#1677ff",
  colorSuccess: "#52c41a",
  colorWarning: "#faad14",
  colorError: "#ff4d4f",
  colorInfo: "#1677ff",
  colorLink: "",
  colorTextBase: "",
  colorBgBase: "",
  // Font
  fontFamily: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji'`,
  fontFamilyCode: `'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace`,
  fontSize: 14,
  // Line
  lineWidth: 1,
  lineType: "solid",
  // Motion
  motionUnit: 0.1,
  motionBase: 0,
  motionEaseOutCirc: "cubic-bezier(0.08, 0.82, 0.17, 1)",
  motionEaseInOutCirc: "cubic-bezier(0.78, 0.14, 0.15, 0.86)",
  motionEaseOut: "cubic-bezier(0.215, 0.61, 0.355, 1)",
  motionEaseInOut: "cubic-bezier(0.645, 0.045, 0.355, 1)",
  motionEaseOutBack: "cubic-bezier(0.12, 0.4, 0.29, 1.46)",
  motionEaseInBack: "cubic-bezier(0.71, -0.46, 0.88, 0.6)",
  motionEaseInQuint: "cubic-bezier(0.755, 0.05, 0.855, 0.06)",
  motionEaseOutQuint: "cubic-bezier(0.23, 1, 0.32, 1)",
  // Radius
  borderRadius: 6,
  // Size
  sizeUnit: 4,
  sizeStep: 4,
  sizePopupArrow: 16,
  // Control Base
  controlHeight: 32,
  // zIndex
  zIndexBase: 0,
  zIndexPopupBase: 1e3,
  // Image
  opacityImage: 1,
  // Wireframe
  wireframe: false,
  // Motion
  motion: true
});
const round$2 = Math.round;
function splitColorStr(str, parseNum) {
  const match5 = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
  const numList = match5.map((item) => parseFloat(item));
  for (let i2 = 0; i2 < 3; i2 += 1) {
    numList[i2] = parseNum(numList[i2] || 0, match5[i2] || "", i2);
  }
  if (match5[3]) {
    numList[3] = match5[3].includes("%") ? numList[3] / 100 : numList[3];
  } else {
    numList[3] = 1;
  }
  return numList;
}
const parseHSVorHSL = (num, _24, index2) => index2 === 0 ? num : num / 100;
function limitRange(value2, max2) {
  const mergedMax = max2 || 255;
  if (value2 > mergedMax) {
    return mergedMax;
  }
  if (value2 < 0) {
    return 0;
  }
  return value2;
}
class FastColor {
  constructor(input2) {
    _defineProperty$4(this, "isValid", true);
    _defineProperty$4(this, "r", 0);
    _defineProperty$4(this, "g", 0);
    _defineProperty$4(this, "b", 0);
    _defineProperty$4(this, "a", 1);
    _defineProperty$4(this, "_h", void 0);
    _defineProperty$4(this, "_s", void 0);
    _defineProperty$4(this, "_l", void 0);
    _defineProperty$4(this, "_v", void 0);
    _defineProperty$4(this, "_max", void 0);
    _defineProperty$4(this, "_min", void 0);
    _defineProperty$4(this, "_brightness", void 0);
    function matchFormat(str) {
      return str[0] in input2 && str[1] in input2 && str[2] in input2;
    }
    if (!input2)
      ;
    else if (typeof input2 === "string") {
      let matchPrefix = function(prefix) {
        return trimStr.startsWith(prefix);
      };
      const trimStr = input2.trim();
      if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
        this.fromHexString(trimStr);
      } else if (matchPrefix("rgb")) {
        this.fromRgbString(trimStr);
      } else if (matchPrefix("hsl")) {
        this.fromHslString(trimStr);
      } else if (matchPrefix("hsv") || matchPrefix("hsb")) {
        this.fromHsvString(trimStr);
      }
    } else if (input2 instanceof FastColor) {
      this.r = input2.r;
      this.g = input2.g;
      this.b = input2.b;
      this.a = input2.a;
      this._h = input2._h;
      this._s = input2._s;
      this._l = input2._l;
      this._v = input2._v;
    } else if (matchFormat("rgb")) {
      this.r = limitRange(input2.r);
      this.g = limitRange(input2.g);
      this.b = limitRange(input2.b);
      this.a = typeof input2.a === "number" ? limitRange(input2.a, 1) : 1;
    } else if (matchFormat("hsl")) {
      this.fromHsl(input2);
    } else if (matchFormat("hsv")) {
      this.fromHsv(input2);
    } else {
      throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input2));
    }
  }
  // ======================= Setter =======================
  setR(value2) {
    return this._sc("r", value2);
  }
  setG(value2) {
    return this._sc("g", value2);
  }
  setB(value2) {
    return this._sc("b", value2);
  }
  setA(value2) {
    return this._sc("a", value2, 1);
  }
  setHue(value2) {
    const hsv = this.toHsv();
    hsv.h = value2;
    return this._c(hsv);
  }
  // ======================= Getter =======================
  /**
   * Returns the perceived luminance of a color, from 0-1.
   * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
   */
  getLuminance() {
    function adjustGamma(raw) {
      const val = raw / 255;
      return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
    }
    const R2 = adjustGamma(this.r);
    const G2 = adjustGamma(this.g);
    const B2 = adjustGamma(this.b);
    return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  }
  getHue() {
    if (typeof this._h === "undefined") {
      const delta = this.getMax() - this.getMin();
      if (delta === 0) {
        this._h = 0;
      } else {
        this._h = round$2(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
      }
    }
    return this._h;
  }
  getSaturation() {
    if (typeof this._s === "undefined") {
      const delta = this.getMax() - this.getMin();
      if (delta === 0) {
        this._s = 0;
      } else {
        this._s = delta / this.getMax();
      }
    }
    return this._s;
  }
  getLightness() {
    if (typeof this._l === "undefined") {
      this._l = (this.getMax() + this.getMin()) / 510;
    }
    return this._l;
  }
  getValue() {
    if (typeof this._v === "undefined") {
      this._v = this.getMax() / 255;
    }
    return this._v;
  }
  /**
   * Returns the perceived brightness of the color, from 0-255.
   * Note: this is not the b of HSB
   * @see http://www.w3.org/TR/AERT#color-contrast
   */
  getBrightness() {
    if (typeof this._brightness === "undefined") {
      this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
    }
    return this._brightness;
  }
  // ======================== Func ========================
  darken(amount = 10) {
    const h3 = this.getHue();
    const s2 = this.getSaturation();
    let l2 = this.getLightness() - amount / 100;
    if (l2 < 0) {
      l2 = 0;
    }
    return this._c({
      h: h3,
      s: s2,
      l: l2,
      a: this.a
    });
  }
  lighten(amount = 10) {
    const h3 = this.getHue();
    const s2 = this.getSaturation();
    let l2 = this.getLightness() + amount / 100;
    if (l2 > 1) {
      l2 = 1;
    }
    return this._c({
      h: h3,
      s: s2,
      l: l2,
      a: this.a
    });
  }
  /**
   * Mix the current color a given amount with another color, from 0 to 100.
   * 0 means no mixing (return current color).
   */
  mix(input2, amount = 50) {
    const color2 = this._c(input2);
    const p2 = amount / 100;
    const calc = (key) => (color2[key] - this[key]) * p2 + this[key];
    const rgba2 = {
      r: round$2(calc("r")),
      g: round$2(calc("g")),
      b: round$2(calc("b")),
      a: round$2(calc("a") * 100) / 100
    };
    return this._c(rgba2);
  }
  /**
   * Mix the color with pure white, from 0 to 100.
   * Providing 0 will do nothing, providing 100 will always return white.
   */
  tint(amount = 10) {
    return this.mix({
      r: 255,
      g: 255,
      b: 255,
      a: 1
    }, amount);
  }
  /**
   * Mix the color with pure black, from 0 to 100.
   * Providing 0 will do nothing, providing 100 will always return black.
   */
  shade(amount = 10) {
    return this.mix({
      r: 0,
      g: 0,
      b: 0,
      a: 1
    }, amount);
  }
  onBackground(background) {
    const bg2 = this._c(background);
    const alpha2 = this.a + bg2.a * (1 - this.a);
    const calc = (key) => {
      return round$2((this[key] * this.a + bg2[key] * bg2.a * (1 - this.a)) / alpha2);
    };
    return this._c({
      r: calc("r"),
      g: calc("g"),
      b: calc("b"),
      a: alpha2
    });
  }
  // ======================= Status =======================
  isDark() {
    return this.getBrightness() < 128;
  }
  isLight() {
    return this.getBrightness() >= 128;
  }
  // ======================== MISC ========================
  equals(other) {
    return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
  }
  clone() {
    return this._c(this);
  }
  // ======================= Format =======================
  toHexString() {
    let hex3 = "#";
    const rHex = (this.r || 0).toString(16);
    hex3 += rHex.length === 2 ? rHex : "0" + rHex;
    const gHex = (this.g || 0).toString(16);
    hex3 += gHex.length === 2 ? gHex : "0" + gHex;
    const bHex = (this.b || 0).toString(16);
    hex3 += bHex.length === 2 ? bHex : "0" + bHex;
    if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
      const aHex = round$2(this.a * 255).toString(16);
      hex3 += aHex.length === 2 ? aHex : "0" + aHex;
    }
    return hex3;
  }
  /** CSS support color pattern */
  toHsl() {
    return {
      h: this.getHue(),
      s: this.getSaturation(),
      l: this.getLightness(),
      a: this.a
    };
  }
  /** CSS support color pattern */
  toHslString() {
    const h3 = this.getHue();
    const s2 = round$2(this.getSaturation() * 100);
    const l2 = round$2(this.getLightness() * 100);
    return this.a !== 1 ? `hsla(${h3},${s2}%,${l2}%,${this.a})` : `hsl(${h3},${s2}%,${l2}%)`;
  }
  /** Same as toHsb */
  toHsv() {
    return {
      h: this.getHue(),
      s: this.getSaturation(),
      v: this.getValue(),
      a: this.a
    };
  }
  toRgb() {
    return {
      r: this.r,
      g: this.g,
      b: this.b,
      a: this.a
    };
  }
  toRgbString() {
    return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
  }
  toString() {
    return this.toRgbString();
  }
  // ====================== Privates ======================
  /** Return a new FastColor object with one channel changed */
  _sc(rgb, value2, max2) {
    const clone3 = this.clone();
    clone3[rgb] = limitRange(value2, max2);
    return clone3;
  }
  _c(input2) {
    return new this.constructor(input2);
  }
  getMax() {
    if (typeof this._max === "undefined") {
      this._max = Math.max(this.r, this.g, this.b);
    }
    return this._max;
  }
  getMin() {
    if (typeof this._min === "undefined") {
      this._min = Math.min(this.r, this.g, this.b);
    }
    return this._min;
  }
  fromHexString(trimStr) {
    const withoutPrefix = trimStr.replace("#", "");
    function connectNum(index1, index2) {
      return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
    }
    if (withoutPrefix.length < 6) {
      this.r = connectNum(0);
      this.g = connectNum(1);
      this.b = connectNum(2);
      this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
    } else {
      this.r = connectNum(0, 1);
      this.g = connectNum(2, 3);
      this.b = connectNum(4, 5);
      this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
    }
  }
  fromHsl({
    h: h3,
    s: s2,
    l: l2,
    a: a2
  }) {
    this._h = h3 % 360;
    this._s = s2;
    this._l = l2;
    this.a = typeof a2 === "number" ? a2 : 1;
    if (s2 <= 0) {
      const rgb = round$2(l2 * 255);
      this.r = rgb;
      this.g = rgb;
      this.b = rgb;
    }
    let r2 = 0, g2 = 0, b2 = 0;
    const huePrime = h3 / 60;
    const chroma = (1 - Math.abs(2 * l2 - 1)) * s2;
    const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
    if (huePrime >= 0 && huePrime < 1) {
      r2 = chroma;
      g2 = secondComponent;
    } else if (huePrime >= 1 && huePrime < 2) {
      r2 = secondComponent;
      g2 = chroma;
    } else if (huePrime >= 2 && huePrime < 3) {
      g2 = chroma;
      b2 = secondComponent;
    } else if (huePrime >= 3 && huePrime < 4) {
      g2 = secondComponent;
      b2 = chroma;
    } else if (huePrime >= 4 && huePrime < 5) {
      r2 = secondComponent;
      b2 = chroma;
    } else if (huePrime >= 5 && huePrime < 6) {
      r2 = chroma;
      b2 = secondComponent;
    }
    const lightnessModification = l2 - chroma / 2;
    this.r = round$2((r2 + lightnessModification) * 255);
    this.g = round$2((g2 + lightnessModification) * 255);
    this.b = round$2((b2 + lightnessModification) * 255);
  }
  fromHsv({
    h: h3,
    s: s2,
    v: v2,
    a: a2
  }) {
    this._h = h3 % 360;
    this._s = s2;
    this._v = v2;
    this.a = typeof a2 === "number" ? a2 : 1;
    const vv = round$2(v2 * 255);
    this.r = vv;
    this.g = vv;
    this.b = vv;
    if (s2 <= 0) {
      return;
    }
    const hh2 = h3 / 60;
    const i2 = Math.floor(hh2);
    const ff2 = hh2 - i2;
    const p2 = round$2(v2 * (1 - s2) * 255);
    const q2 = round$2(v2 * (1 - s2 * ff2) * 255);
    const t2 = round$2(v2 * (1 - s2 * (1 - ff2)) * 255);
    switch (i2) {
      case 0:
        this.g = t2;
        this.b = p2;
        break;
      case 1:
        this.r = q2;
        this.b = p2;
        break;
      case 2:
        this.r = p2;
        this.b = t2;
        break;
      case 3:
        this.r = p2;
        this.g = q2;
        break;
      case 4:
        this.r = t2;
        this.g = p2;
        break;
      case 5:
      default:
        this.g = p2;
        this.b = q2;
        break;
    }
  }
  fromHsvString(trimStr) {
    const cells = splitColorStr(trimStr, parseHSVorHSL);
    this.fromHsv({
      h: cells[0],
      s: cells[1],
      v: cells[2],
      a: cells[3]
    });
  }
  fromHslString(trimStr) {
    const cells = splitColorStr(trimStr, parseHSVorHSL);
    this.fromHsl({
      h: cells[0],
      s: cells[1],
      l: cells[2],
      a: cells[3]
    });
  }
  fromRgbString(trimStr) {
    const cells = splitColorStr(trimStr, (num, txt) => (
      // Convert percentage to number. e.g. 50% -> 128
      txt.includes("%") ? round$2(num / 100 * 255) : num
    ));
    this.r = cells[0];
    this.g = cells[1];
    this.b = cells[2];
    this.a = cells[3];
  }
}
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
  index: 7,
  amount: 15
}, {
  index: 6,
  amount: 25
}, {
  index: 5,
  amount: 30
}, {
  index: 5,
  amount: 45
}, {
  index: 5,
  amount: 65
}, {
  index: 5,
  amount: 85
}, {
  index: 4,
  amount: 90
}, {
  index: 3,
  amount: 95
}, {
  index: 2,
  amount: 97
}, {
  index: 1,
  amount: 98
}];
function getHue(hsv, i2, light2) {
  var hue2;
  if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
    hue2 = light2 ? Math.round(hsv.h) - hueStep * i2 : Math.round(hsv.h) + hueStep * i2;
  } else {
    hue2 = light2 ? Math.round(hsv.h) + hueStep * i2 : Math.round(hsv.h) - hueStep * i2;
  }
  if (hue2 < 0) {
    hue2 += 360;
  } else if (hue2 >= 360) {
    hue2 -= 360;
  }
  return hue2;
}
function getSaturation(hsv, i2, light2) {
  if (hsv.h === 0 && hsv.s === 0) {
    return hsv.s;
  }
  var saturation;
  if (light2) {
    saturation = hsv.s - saturationStep * i2;
  } else if (i2 === darkColorCount) {
    saturation = hsv.s + saturationStep;
  } else {
    saturation = hsv.s + saturationStep2 * i2;
  }
  if (saturation > 1) {
    saturation = 1;
  }
  if (light2 && i2 === lightColorCount && saturation > 0.1) {
    saturation = 0.1;
  }
  if (saturation < 0.06) {
    saturation = 0.06;
  }
  return Math.round(saturation * 100) / 100;
}
function getValue$5(hsv, i2, light2) {
  var value2;
  if (light2) {
    value2 = hsv.v + brightnessStep1 * i2;
  } else {
    value2 = hsv.v - brightnessStep2 * i2;
  }
  value2 = Math.max(0, Math.min(1, value2));
  return Math.round(value2 * 100) / 100;
}
function generate$1(color2) {
  var opts2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var patterns = [];
  var pColor = new FastColor(color2);
  var hsv = pColor.toHsv();
  for (var i2 = lightColorCount; i2 > 0; i2 -= 1) {
    var c2 = new FastColor({
      h: getHue(hsv, i2, true),
      s: getSaturation(hsv, i2, true),
      v: getValue$5(hsv, i2, true)
    });
    patterns.push(c2);
  }
  patterns.push(pColor);
  for (var _i = 1; _i <= darkColorCount; _i += 1) {
    var _c2 = new FastColor({
      h: getHue(hsv, _i),
      s: getSaturation(hsv, _i),
      v: getValue$5(hsv, _i)
    });
    patterns.push(_c2);
  }
  if (opts2.theme === "dark") {
    return darkColorMap.map(function(_ref) {
      var index2 = _ref.index, amount = _ref.amount;
      return new FastColor(opts2.backgroundColor || "#141414").mix(patterns[index2], amount).toHexString();
    });
  }
  return patterns.map(function(c3) {
    return c3.toHexString();
  });
}
var presetPrimaryColors = {
  "red": "#F5222D",
  "volcano": "#FA541C",
  "orange": "#FA8C16",
  "gold": "#FAAD14",
  "yellow": "#FADB14",
  "lime": "#A0D911",
  "green": "#52C41A",
  "cyan": "#13C2C2",
  "blue": "#1677FF",
  "geekblue": "#2F54EB",
  "purple": "#722ED1",
  "magenta": "#EB2F96",
  "grey": "#666666"
};
var red$1 = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
red$1.primary = red$1[5];
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
volcano.primary = volcano[5];
var orange$1 = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
orange$1.primary = orange$1[5];
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
gold.primary = gold[5];
var yellow$1 = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
yellow$1.primary = yellow$1[5];
var lime$1 = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
lime$1.primary = lime$1[5];
var green$1 = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
green$1.primary = green$1[5];
var cyan$1 = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
cyan$1.primary = cyan$1[5];
var blue$1 = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
blue$1.primary = blue$1[5];
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
geekblue.primary = geekblue[5];
var purple$1 = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
purple$1.primary = purple$1[5];
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
magenta.primary = magenta[5];
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
grey.primary = grey[5];
var presetPalettes = {
  red: red$1,
  volcano,
  orange: orange$1,
  gold,
  yellow: yellow$1,
  lime: lime$1,
  green: green$1,
  cyan: cyan$1,
  blue: blue$1,
  geekblue,
  purple: purple$1,
  magenta,
  grey
};
function genColorMapToken(seed, {
  generateColorPalettes: generateColorPalettes2,
  generateNeutralColorPalettes: generateNeutralColorPalettes2
}) {
  const {
    colorSuccess: colorSuccessBase,
    colorWarning: colorWarningBase,
    colorError: colorErrorBase,
    colorInfo: colorInfoBase,
    colorPrimary: colorPrimaryBase,
    colorBgBase,
    colorTextBase
  } = seed;
  const primaryColors = generateColorPalettes2(colorPrimaryBase);
  const successColors = generateColorPalettes2(colorSuccessBase);
  const warningColors = generateColorPalettes2(colorWarningBase);
  const errorColors = generateColorPalettes2(colorErrorBase);
  const infoColors = generateColorPalettes2(colorInfoBase);
  const neutralColors = generateNeutralColorPalettes2(colorBgBase, colorTextBase);
  const colorLink = seed.colorLink || seed.colorInfo;
  const linkColors = generateColorPalettes2(colorLink);
  const colorErrorBgFilledHover = new FastColor(errorColors[1]).mix(new FastColor(errorColors[3]), 50).toHexString();
  return Object.assign(Object.assign({}, neutralColors), {
    colorPrimaryBg: primaryColors[1],
    colorPrimaryBgHover: primaryColors[2],
    colorPrimaryBorder: primaryColors[3],
    colorPrimaryBorderHover: primaryColors[4],
    colorPrimaryHover: primaryColors[5],
    colorPrimary: primaryColors[6],
    colorPrimaryActive: primaryColors[7],
    colorPrimaryTextHover: primaryColors[8],
    colorPrimaryText: primaryColors[9],
    colorPrimaryTextActive: primaryColors[10],
    colorSuccessBg: successColors[1],
    colorSuccessBgHover: successColors[2],
    colorSuccessBorder: successColors[3],
    colorSuccessBorderHover: successColors[4],
    colorSuccessHover: successColors[4],
    colorSuccess: successColors[6],
    colorSuccessActive: successColors[7],
    colorSuccessTextHover: successColors[8],
    colorSuccessText: successColors[9],
    colorSuccessTextActive: successColors[10],
    colorErrorBg: errorColors[1],
    colorErrorBgHover: errorColors[2],
    colorErrorBgFilledHover,
    colorErrorBgActive: errorColors[3],
    colorErrorBorder: errorColors[3],
    colorErrorBorderHover: errorColors[4],
    colorErrorHover: errorColors[5],
    colorError: errorColors[6],
    colorErrorActive: errorColors[7],
    colorErrorTextHover: errorColors[8],
    colorErrorText: errorColors[9],
    colorErrorTextActive: errorColors[10],
    colorWarningBg: warningColors[1],
    colorWarningBgHover: warningColors[2],
    colorWarningBorder: warningColors[3],
    colorWarningBorderHover: warningColors[4],
    colorWarningHover: warningColors[4],
    colorWarning: warningColors[6],
    colorWarningActive: warningColors[7],
    colorWarningTextHover: warningColors[8],
    colorWarningText: warningColors[9],
    colorWarningTextActive: warningColors[10],
    colorInfoBg: infoColors[1],
    colorInfoBgHover: infoColors[2],
    colorInfoBorder: infoColors[3],
    colorInfoBorderHover: infoColors[4],
    colorInfoHover: infoColors[4],
    colorInfo: infoColors[6],
    colorInfoActive: infoColors[7],
    colorInfoTextHover: infoColors[8],
    colorInfoText: infoColors[9],
    colorInfoTextActive: infoColors[10],
    colorLinkHover: linkColors[4],
    colorLink: linkColors[6],
    colorLinkActive: linkColors[7],
    colorBgMask: new FastColor("#000").setA(0.45).toRgbString(),
    colorWhite: "#fff"
  });
}
const genRadius = (radiusBase) => {
  let radiusLG = radiusBase;
  let radiusSM = radiusBase;
  let radiusXS = radiusBase;
  let radiusOuter = radiusBase;
  if (radiusBase < 6 && radiusBase >= 5) {
    radiusLG = radiusBase + 1;
  } else if (radiusBase < 16 && radiusBase >= 6) {
    radiusLG = radiusBase + 2;
  } else if (radiusBase >= 16) {
    radiusLG = 16;
  }
  if (radiusBase < 7 && radiusBase >= 5) {
    radiusSM = 4;
  } else if (radiusBase < 8 && radiusBase >= 7) {
    radiusSM = 5;
  } else if (radiusBase < 14 && radiusBase >= 8) {
    radiusSM = 6;
  } else if (radiusBase < 16 && radiusBase >= 14) {
    radiusSM = 7;
  } else if (radiusBase >= 16) {
    radiusSM = 8;
  }
  if (radiusBase < 6 && radiusBase >= 2) {
    radiusXS = 1;
  } else if (radiusBase >= 6) {
    radiusXS = 2;
  }
  if (radiusBase > 4 && radiusBase < 8) {
    radiusOuter = 4;
  } else if (radiusBase >= 8) {
    radiusOuter = 6;
  }
  return {
    borderRadius: radiusBase,
    borderRadiusXS: radiusXS,
    borderRadiusSM: radiusSM,
    borderRadiusLG: radiusLG,
    borderRadiusOuter: radiusOuter
  };
};
function genCommonMapToken(token2) {
  const {
    motionUnit,
    motionBase,
    borderRadius: borderRadius2,
    lineWidth
  } = token2;
  return Object.assign({
    // motion
    motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
    motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
    motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
    // line
    lineWidthBold: lineWidth + 1
  }, genRadius(borderRadius2));
}
const genControlHeight = (token2) => {
  const {
    controlHeight
  } = token2;
  return {
    controlHeightSM: controlHeight * 0.75,
    controlHeightXS: controlHeight * 0.5,
    controlHeightLG: controlHeight * 1.25
  };
};
function getLineHeight(fontSize) {
  return (fontSize + 8) / fontSize;
}
function getFontSizes(base) {
  const fontSizes = Array.from({
    length: 10
  }).map((_24, index2) => {
    const i2 = index2 - 1;
    const baseSize = base * Math.pow(Math.E, i2 / 5);
    const intSize = index2 > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
    return Math.floor(intSize / 2) * 2;
  });
  fontSizes[1] = base;
  return fontSizes.map((size2) => ({
    size: size2,
    lineHeight: getLineHeight(size2)
  }));
}
const genFontMapToken = (fontSize) => {
  const fontSizePairs = getFontSizes(fontSize);
  const fontSizes = fontSizePairs.map((pair) => pair.size);
  const lineHeights = fontSizePairs.map((pair) => pair.lineHeight);
  const fontSizeMD = fontSizes[1];
  const fontSizeSM = fontSizes[0];
  const fontSizeLG = fontSizes[2];
  const lineHeight2 = lineHeights[1];
  const lineHeightSM = lineHeights[0];
  const lineHeightLG = lineHeights[2];
  return {
    fontSizeSM,
    fontSize: fontSizeMD,
    fontSizeLG,
    fontSizeXL: fontSizes[3],
    fontSizeHeading1: fontSizes[6],
    fontSizeHeading2: fontSizes[5],
    fontSizeHeading3: fontSizes[4],
    fontSizeHeading4: fontSizes[3],
    fontSizeHeading5: fontSizes[2],
    lineHeight: lineHeight2,
    lineHeightLG,
    lineHeightSM,
    fontHeight: Math.round(lineHeight2 * fontSizeMD),
    fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
    fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
    lineHeightHeading1: lineHeights[6],
    lineHeightHeading2: lineHeights[5],
    lineHeightHeading3: lineHeights[4],
    lineHeightHeading4: lineHeights[3],
    lineHeightHeading5: lineHeights[2]
  };
};
function genSizeMapToken(token2) {
  const {
    sizeUnit,
    sizeStep
  } = token2;
  return {
    sizeXXL: sizeUnit * (sizeStep + 8),
    // 48
    sizeXL: sizeUnit * (sizeStep + 4),
    // 32
    sizeLG: sizeUnit * (sizeStep + 2),
    // 24
    sizeMD: sizeUnit * (sizeStep + 1),
    // 20
    sizeMS: sizeUnit * sizeStep,
    // 16
    size: sizeUnit * sizeStep,
    // 16
    sizeSM: sizeUnit * (sizeStep - 1),
    // 12
    sizeXS: sizeUnit * (sizeStep - 2),
    // 8
    sizeXXS: sizeUnit * (sizeStep - 3)
    // 4
  };
}
const getAlphaColor$2 = (baseColor, alpha2) => new FastColor(baseColor).setA(alpha2).toRgbString();
const getSolidColor$1 = (baseColor, brightness) => {
  const instance2 = new FastColor(baseColor);
  return instance2.darken(brightness).toHexString();
};
const generateColorPalettes$1 = (baseColor) => {
  const colors2 = generate$1(baseColor);
  return {
    1: colors2[0],
    2: colors2[1],
    3: colors2[2],
    4: colors2[3],
    5: colors2[4],
    6: colors2[5],
    7: colors2[6],
    8: colors2[4],
    9: colors2[5],
    10: colors2[6]
    // 8: colors[7],
    // 9: colors[8],
    // 10: colors[9],
  };
};
const generateNeutralColorPalettes$1 = (bgBaseColor, textBaseColor) => {
  const colorBgBase = bgBaseColor || "#fff";
  const colorTextBase = textBaseColor || "#000";
  return {
    colorBgBase,
    colorTextBase,
    colorText: getAlphaColor$2(colorTextBase, 0.88),
    colorTextSecondary: getAlphaColor$2(colorTextBase, 0.65),
    colorTextTertiary: getAlphaColor$2(colorTextBase, 0.45),
    colorTextQuaternary: getAlphaColor$2(colorTextBase, 0.25),
    colorFill: getAlphaColor$2(colorTextBase, 0.15),
    colorFillSecondary: getAlphaColor$2(colorTextBase, 0.06),
    colorFillTertiary: getAlphaColor$2(colorTextBase, 0.04),
    colorFillQuaternary: getAlphaColor$2(colorTextBase, 0.02),
    colorBgSolid: getAlphaColor$2(colorTextBase, 1),
    colorBgSolidHover: getAlphaColor$2(colorTextBase, 0.75),
    colorBgSolidActive: getAlphaColor$2(colorTextBase, 0.95),
    colorBgLayout: getSolidColor$1(colorBgBase, 4),
    colorBgContainer: getSolidColor$1(colorBgBase, 0),
    colorBgElevated: getSolidColor$1(colorBgBase, 0),
    colorBgSpotlight: getAlphaColor$2(colorTextBase, 0.85),
    colorBgBlur: "transparent",
    colorBorder: getSolidColor$1(colorBgBase, 15),
    colorBorderSecondary: getSolidColor$1(colorBgBase, 6)
  };
};
function derivative$1(token2) {
  presetPrimaryColors.pink = presetPrimaryColors.magenta;
  presetPalettes.pink = presetPalettes.magenta;
  const colorPalettes = Object.keys(defaultPresetColors).map((colorKey) => {
    const colors2 = token2[colorKey] === presetPrimaryColors[colorKey] ? presetPalettes[colorKey] : generate$1(token2[colorKey]);
    return Array.from({
      length: 10
    }, () => 1).reduce((prev2, _24, i2) => {
      prev2[`${colorKey}-${i2 + 1}`] = colors2[i2];
      prev2[`${colorKey}${i2 + 1}`] = colors2[i2];
      return prev2;
    }, {});
  }).reduce((prev2, cur) => {
    prev2 = Object.assign(Object.assign({}, prev2), cur);
    return prev2;
  }, {});
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, token2), colorPalettes), genColorMapToken(token2, {
    generateColorPalettes: generateColorPalettes$1,
    generateNeutralColorPalettes: generateNeutralColorPalettes$1
  })), genFontMapToken(token2.fontSize)), genSizeMapToken(token2)), genControlHeight(token2)), genCommonMapToken(token2));
}
const defaultTheme = createTheme(derivative$1);
const defaultConfig = {
  token: seedToken,
  override: {
    override: seedToken
  },
  hashed: true
};
const DesignTokenContext = /* @__PURE__ */ React$6.createContext(defaultConfig);
const defaultPrefixCls = "ant";
const defaultIconPrefixCls = "anticon";
const defaultGetPrefixCls = (suffixCls, customizePrefixCls) => {
  if (customizePrefixCls) {
    return customizePrefixCls;
  }
  return suffixCls ? `${defaultPrefixCls}-${suffixCls}` : defaultPrefixCls;
};
const ConfigContext = /* @__PURE__ */ reactExports.createContext({
  // We provide a default function for Context without provider
  getPrefixCls: defaultGetPrefixCls,
  iconPrefixCls: defaultIconPrefixCls
});
const {
  Consumer: ConfigConsumer
} = ConfigContext;
const EMPTY_OBJECT = {};
function useComponentConfig(propName) {
  const context = reactExports.useContext(ConfigContext);
  const {
    getPrefixCls,
    direction,
    getPopupContainer
  } = context;
  const propValue = context[propName];
  return Object.assign(Object.assign({
    classNames: EMPTY_OBJECT,
    styles: EMPTY_OBJECT
  }, propValue), {
    getPrefixCls,
    direction,
    getPopupContainer
  });
}
const dynamicStyleMark = `-ant-${Date.now()}-${Math.random()}`;
function getStyle$2(globalPrefixCls2, theme2) {
  const variables = {};
  const formatColor = (color2, updater) => {
    let clone3 = color2.clone();
    clone3 = (updater === null || updater === void 0 ? void 0 : updater(clone3)) || clone3;
    return clone3.toRgbString();
  };
  const fillColor = (colorVal, type4) => {
    const baseColor = new FastColor(colorVal);
    const colorPalettes = generate$1(baseColor.toRgbString());
    variables[`${type4}-color`] = formatColor(baseColor);
    variables[`${type4}-color-disabled`] = colorPalettes[1];
    variables[`${type4}-color-hover`] = colorPalettes[4];
    variables[`${type4}-color-active`] = colorPalettes[6];
    variables[`${type4}-color-outline`] = baseColor.clone().setA(0.2).toRgbString();
    variables[`${type4}-color-deprecated-bg`] = colorPalettes[0];
    variables[`${type4}-color-deprecated-border`] = colorPalettes[2];
  };
  if (theme2.primaryColor) {
    fillColor(theme2.primaryColor, "primary");
    const primaryColor = new FastColor(theme2.primaryColor);
    const primaryColors = generate$1(primaryColor.toRgbString());
    primaryColors.forEach((color2, index2) => {
      variables[`primary-${index2 + 1}`] = color2;
    });
    variables["primary-color-deprecated-l-35"] = formatColor(primaryColor, (c2) => c2.lighten(35));
    variables["primary-color-deprecated-l-20"] = formatColor(primaryColor, (c2) => c2.lighten(20));
    variables["primary-color-deprecated-t-20"] = formatColor(primaryColor, (c2) => c2.tint(20));
    variables["primary-color-deprecated-t-50"] = formatColor(primaryColor, (c2) => c2.tint(50));
    variables["primary-color-deprecated-f-12"] = formatColor(primaryColor, (c2) => c2.setA(c2.a * 0.12));
    const primaryActiveColor = new FastColor(primaryColors[0]);
    variables["primary-color-active-deprecated-f-30"] = formatColor(primaryActiveColor, (c2) => c2.setA(c2.a * 0.3));
    variables["primary-color-active-deprecated-d-02"] = formatColor(primaryActiveColor, (c2) => c2.darken(2));
  }
  if (theme2.successColor) {
    fillColor(theme2.successColor, "success");
  }
  if (theme2.warningColor) {
    fillColor(theme2.warningColor, "warning");
  }
  if (theme2.errorColor) {
    fillColor(theme2.errorColor, "error");
  }
  if (theme2.infoColor) {
    fillColor(theme2.infoColor, "info");
  }
  const cssList = Object.keys(variables).map((key) => `--${globalPrefixCls2}-${key}: ${variables[key]};`);
  return `
  :root {
    ${cssList.join("\n")}
  }
  `.trim();
}
function registerTheme(globalPrefixCls2, theme2) {
  const style2 = getStyle$2(globalPrefixCls2, theme2);
  if (canUseDom$1()) {
    updateCSS(style2, `${dynamicStyleMark}-dynamic-theme`);
  }
}
const DisabledContext = /* @__PURE__ */ reactExports.createContext(false);
const DisabledContextProvider = ({
  children,
  disabled
}) => {
  const originDisabled = reactExports.useContext(DisabledContext);
  return /* @__PURE__ */ reactExports.createElement(DisabledContext.Provider, {
    value: disabled !== null && disabled !== void 0 ? disabled : originDisabled
  }, children);
};
const SizeContext = /* @__PURE__ */ reactExports.createContext(void 0);
const SizeContextProvider = ({
  children,
  size: size2
}) => {
  const originSize = reactExports.useContext(SizeContext);
  return /* @__PURE__ */ reactExports.createElement(SizeContext.Provider, {
    value: size2 || originSize
  }, children);
};
function useConfig() {
  const componentDisabled = reactExports.useContext(DisabledContext);
  const componentSize = reactExports.useContext(SizeContext);
  return {
    componentDisabled,
    componentSize
  };
}
var AbstractCalculator = /* @__PURE__ */ _createClass$8(function AbstractCalculator2() {
  _classCallCheck$a(this, AbstractCalculator2);
});
var CALC_UNIT = "CALC_UNIT";
var regexp$1 = new RegExp(CALC_UNIT, "g");
function unit(value2) {
  if (typeof value2 === "number") {
    return "".concat(value2).concat(CALC_UNIT);
  }
  return value2;
}
var CSSCalculator = /* @__PURE__ */ function(_AbstractCalculator) {
  _inherits$a(CSSCalculator2, _AbstractCalculator);
  var _super = _createSuper$4(CSSCalculator2);
  function CSSCalculator2(num, unitlessCssVar) {
    var _this;
    _classCallCheck$a(this, CSSCalculator2);
    _this = _super.call(this);
    _defineProperty$4(_assertThisInitialized(_this), "result", "");
    _defineProperty$4(_assertThisInitialized(_this), "unitlessCssVar", void 0);
    _defineProperty$4(_assertThisInitialized(_this), "lowPriority", void 0);
    var numType = _typeof$2(num);
    _this.unitlessCssVar = unitlessCssVar;
    if (num instanceof CSSCalculator2) {
      _this.result = "(".concat(num.result, ")");
    } else if (numType === "number") {
      _this.result = unit(num);
    } else if (numType === "string") {
      _this.result = num;
    }
    return _this;
  }
  _createClass$8(CSSCalculator2, [{
    key: "add",
    value: function add2(num) {
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " + ").concat(num.getResult());
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " + ").concat(unit(num));
      }
      this.lowPriority = true;
      return this;
    }
  }, {
    key: "sub",
    value: function sub(num) {
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " - ").concat(num.getResult());
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " - ").concat(unit(num));
      }
      this.lowPriority = true;
      return this;
    }
  }, {
    key: "mul",
    value: function mul(num) {
      if (this.lowPriority) {
        this.result = "(".concat(this.result, ")");
      }
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " * ").concat(num.getResult(true));
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " * ").concat(num);
      }
      this.lowPriority = false;
      return this;
    }
  }, {
    key: "div",
    value: function div(num) {
      if (this.lowPriority) {
        this.result = "(".concat(this.result, ")");
      }
      if (num instanceof CSSCalculator2) {
        this.result = "".concat(this.result, " / ").concat(num.getResult(true));
      } else if (typeof num === "number" || typeof num === "string") {
        this.result = "".concat(this.result, " / ").concat(num);
      }
      this.lowPriority = false;
      return this;
    }
  }, {
    key: "getResult",
    value: function getResult(force) {
      return this.lowPriority || force ? "(".concat(this.result, ")") : this.result;
    }
  }, {
    key: "equal",
    value: function equal2(options) {
      var _this2 = this;
      var _ref = options || {}, cssUnit = _ref.unit;
      var mergedUnit = true;
      if (typeof cssUnit === "boolean") {
        mergedUnit = cssUnit;
      } else if (Array.from(this.unitlessCssVar).some(function(cssVar) {
        return _this2.result.includes(cssVar);
      })) {
        mergedUnit = false;
      }
      this.result = this.result.replace(regexp$1, mergedUnit ? "px" : "");
      if (typeof this.lowPriority !== "undefined") {
        return "calc(".concat(this.result, ")");
      }
      return this.result;
    }
  }]);
  return CSSCalculator2;
}(AbstractCalculator);
var NumCalculator = /* @__PURE__ */ function(_AbstractCalculator) {
  _inherits$a(NumCalculator2, _AbstractCalculator);
  var _super = _createSuper$4(NumCalculator2);
  function NumCalculator2(num) {
    var _this;
    _classCallCheck$a(this, NumCalculator2);
    _this = _super.call(this);
    _defineProperty$4(_assertThisInitialized(_this), "result", 0);
    if (num instanceof NumCalculator2) {
      _this.result = num.result;
    } else if (typeof num === "number") {
      _this.result = num;
    }
    return _this;
  }
  _createClass$8(NumCalculator2, [{
    key: "add",
    value: function add2(num) {
      if (num instanceof NumCalculator2) {
        this.result += num.result;
      } else if (typeof num === "number") {
        this.result += num;
      }
      return this;
    }
  }, {
    key: "sub",
    value: function sub(num) {
      if (num instanceof NumCalculator2) {
        this.result -= num.result;
      } else if (typeof num === "number") {
        this.result -= num;
      }
      return this;
    }
  }, {
    key: "mul",
    value: function mul(num) {
      if (num instanceof NumCalculator2) {
        this.result *= num.result;
      } else if (typeof num === "number") {
        this.result *= num;
      }
      return this;
    }
  }, {
    key: "div",
    value: function div(num) {
      if (num instanceof NumCalculator2) {
        this.result /= num.result;
      } else if (typeof num === "number") {
        this.result /= num;
      }
      return this;
    }
  }, {
    key: "equal",
    value: function equal2() {
      return this.result;
    }
  }]);
  return NumCalculator2;
}(AbstractCalculator);
var genCalc = function genCalc2(type4, unitlessCssVar) {
  var Calculator = type4 === "css" ? CSSCalculator : NumCalculator;
  return function(num) {
    return new Calculator(num, unitlessCssVar);
  };
};
var getCompVarPrefix = function getCompVarPrefix2(component, prefix) {
  return "".concat([prefix, component.replace(/([A-Z]+)([A-Z][a-z]+)/g, "$1-$2").replace(/([a-z])([A-Z])/g, "$1-$2")].filter(Boolean).join("-"));
};
function useEvent$2(callback2) {
  var fnRef = reactExports.useRef();
  fnRef.current = callback2;
  var memoFn = reactExports.useCallback(function() {
    var _fnRef$current;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
  }, []);
  return memoFn;
}
function useSafeState(defaultValue2) {
  var destroyRef = reactExports.useRef(false);
  var _React$useState = reactExports.useState(defaultValue2), _React$useState2 = _slicedToArray(_React$useState, 2), value2 = _React$useState2[0], setValue = _React$useState2[1];
  reactExports.useEffect(function() {
    destroyRef.current = false;
    return function() {
      destroyRef.current = true;
    };
  }, []);
  function safeSetState(updater, ignoreDestroy) {
    if (ignoreDestroy && destroyRef.current) {
      return;
    }
    setValue(updater);
  }
  return [value2, safeSetState];
}
function hasValue(value2) {
  return value2 !== void 0;
}
function useMergedState$1(defaultStateValue, option) {
  var _ref = option || {}, defaultValue2 = _ref.defaultValue, value2 = _ref.value, onChange = _ref.onChange, postState = _ref.postState;
  var _useState = useSafeState(function() {
    if (hasValue(value2)) {
      return value2;
    } else if (hasValue(defaultValue2)) {
      return typeof defaultValue2 === "function" ? defaultValue2() : defaultValue2;
    } else {
      return typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
    }
  }), _useState2 = _slicedToArray(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1];
  var mergedValue = value2 !== void 0 ? value2 : innerValue;
  var postMergedValue = postState ? postState(mergedValue) : mergedValue;
  var onChangeFn = useEvent$2(onChange);
  var _useState3 = useSafeState([mergedValue]), _useState4 = _slicedToArray(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1];
  useLayoutUpdateEffect(function() {
    var prev2 = prevValue[0];
    if (innerValue !== prev2) {
      onChangeFn(innerValue, prev2);
    }
  }, [prevValue]);
  useLayoutUpdateEffect(function() {
    if (!hasValue(value2)) {
      setInnerValue(value2);
    }
  }, [value2]);
  var triggerChange = useEvent$2(function(updater, ignoreDestroy) {
    setInnerValue(updater, ignoreDestroy);
    setPrevValue([mergedValue], ignoreDestroy);
  });
  return [postMergedValue, triggerChange];
}
function getComponentToken(component, token2, defaultToken, options) {
  var customToken = _objectSpread2({}, token2[component]);
  if (options !== null && options !== void 0 && options.deprecatedTokens) {
    var deprecatedTokens = options.deprecatedTokens;
    deprecatedTokens.forEach(function(_ref) {
      var _ref2 = _slicedToArray(_ref, 2), oldTokenKey = _ref2[0], newTokenKey = _ref2[1];
      if (customToken !== null && customToken !== void 0 && customToken[oldTokenKey] || customToken !== null && customToken !== void 0 && customToken[newTokenKey]) {
        var _customToken$newToken;
        (_customToken$newToken = customToken[newTokenKey]) !== null && _customToken$newToken !== void 0 ? _customToken$newToken : customToken[newTokenKey] = customToken === null || customToken === void 0 ? void 0 : customToken[oldTokenKey];
      }
    });
  }
  var mergedToken = _objectSpread2(_objectSpread2({}, defaultToken), customToken);
  Object.keys(mergedToken).forEach(function(key) {
    if (mergedToken[key] === token2[key]) {
      delete mergedToken[key];
    }
  });
  return mergedToken;
}
var enableStatistic = typeof CSSINJS_STATISTIC !== "undefined";
var recording = true;
function merge$4() {
  for (var _len = arguments.length, objs = new Array(_len), _key = 0; _key < _len; _key++) {
    objs[_key] = arguments[_key];
  }
  if (!enableStatistic) {
    return Object.assign.apply(Object, [{}].concat(objs));
  }
  recording = false;
  var ret = {};
  objs.forEach(function(obj) {
    if (_typeof$2(obj) !== "object") {
      return;
    }
    var keys2 = Object.keys(obj);
    keys2.forEach(function(key) {
      Object.defineProperty(ret, key, {
        configurable: true,
        enumerable: true,
        get: function get5() {
          return obj[key];
        }
      });
    });
  });
  recording = true;
  return ret;
}
var statistic = {};
function noop$7() {
}
var statisticToken = function statisticToken2(token2) {
  var tokenKeys2;
  var proxy = token2;
  var flush = noop$7;
  if (enableStatistic && typeof Proxy !== "undefined") {
    tokenKeys2 = /* @__PURE__ */ new Set();
    proxy = new Proxy(token2, {
      get: function get5(obj, prop) {
        if (recording) {
          var _tokenKeys;
          (_tokenKeys = tokenKeys2) === null || _tokenKeys === void 0 || _tokenKeys.add(prop);
        }
        return obj[prop];
      }
    });
    flush = function flush2(componentName, componentToken) {
      var _statistic$componentN;
      statistic[componentName] = {
        global: Array.from(tokenKeys2),
        component: _objectSpread2(_objectSpread2({}, (_statistic$componentN = statistic[componentName]) === null || _statistic$componentN === void 0 ? void 0 : _statistic$componentN.component), componentToken)
      };
    };
  }
  return {
    token: proxy,
    keys: tokenKeys2,
    flush
  };
};
function getDefaultComponentToken(component, token2, getDefaultToken) {
  if (typeof getDefaultToken === "function") {
    var _token$component;
    return getDefaultToken(merge$4(token2, (_token$component = token2[component]) !== null && _token$component !== void 0 ? _token$component : {}));
  }
  return getDefaultToken !== null && getDefaultToken !== void 0 ? getDefaultToken : {};
}
function genMaxMin(type4) {
  if (type4 === "js") {
    return {
      max: Math.max,
      min: Math.min
    };
  }
  return {
    max: function max2() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return "max(".concat(args.map(function(value2) {
        return unit$1(value2);
      }).join(","), ")");
    },
    min: function min2() {
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      return "min(".concat(args.map(function(value2) {
        return unit$1(value2);
      }).join(","), ")");
    }
  };
}
var BEAT_LIMIT = 1e3 * 60 * 10;
var ArrayKeyMap = /* @__PURE__ */ function() {
  function ArrayKeyMap2() {
    _classCallCheck$a(this, ArrayKeyMap2);
    _defineProperty$4(this, "map", /* @__PURE__ */ new Map());
    _defineProperty$4(this, "objectIDMap", /* @__PURE__ */ new WeakMap());
    _defineProperty$4(this, "nextID", 0);
    _defineProperty$4(this, "lastAccessBeat", /* @__PURE__ */ new Map());
    _defineProperty$4(this, "accessBeat", 0);
  }
  _createClass$8(ArrayKeyMap2, [{
    key: "set",
    value: function set2(keys2, value2) {
      this.clear();
      var compositeKey = this.getCompositeKey(keys2);
      this.map.set(compositeKey, value2);
      this.lastAccessBeat.set(compositeKey, Date.now());
    }
  }, {
    key: "get",
    value: function get5(keys2) {
      var compositeKey = this.getCompositeKey(keys2);
      var cache2 = this.map.get(compositeKey);
      this.lastAccessBeat.set(compositeKey, Date.now());
      this.accessBeat += 1;
      return cache2;
    }
  }, {
    key: "getCompositeKey",
    value: function getCompositeKey(keys2) {
      var _this = this;
      var ids2 = keys2.map(function(key) {
        if (key && _typeof$2(key) === "object") {
          return "obj_".concat(_this.getObjectID(key));
        }
        return "".concat(_typeof$2(key), "_").concat(key);
      });
      return ids2.join("|");
    }
  }, {
    key: "getObjectID",
    value: function getObjectID(obj) {
      if (this.objectIDMap.has(obj)) {
        return this.objectIDMap.get(obj);
      }
      var id2 = this.nextID;
      this.objectIDMap.set(obj, id2);
      this.nextID += 1;
      return id2;
    }
  }, {
    key: "clear",
    value: function clear() {
      var _this2 = this;
      if (this.accessBeat > 1e4) {
        var now2 = Date.now();
        this.lastAccessBeat.forEach(function(beat, key) {
          if (now2 - beat > BEAT_LIMIT) {
            _this2.map.delete(key);
            _this2.lastAccessBeat.delete(key);
          }
        });
        this.accessBeat = 0;
      }
    }
  }]);
  return ArrayKeyMap2;
}();
var uniqueMap = new ArrayKeyMap();
function useUniqueMemo(memoFn, deps) {
  return React$6.useMemo(function() {
    var cachedValue = uniqueMap.get(deps);
    if (cachedValue) {
      return cachedValue;
    }
    var newValue = memoFn();
    uniqueMap.set(deps, newValue);
    return newValue;
  }, deps);
}
var useDefaultCSP = function useDefaultCSP2() {
  return {};
};
function genStyleUtils(config2) {
  var _config$useCSP = config2.useCSP, useCSP = _config$useCSP === void 0 ? useDefaultCSP : _config$useCSP, useToken2 = config2.useToken, usePrefix = config2.usePrefix, getResetStyles = config2.getResetStyles, getCommonStyle = config2.getCommonStyle, getCompUnitless = config2.getCompUnitless;
  function genStyleHooks2(component, styleFn, getDefaultToken, options) {
    var componentName = Array.isArray(component) ? component[0] : component;
    function prefixToken(key) {
      return "".concat(String(componentName)).concat(key.slice(0, 1).toUpperCase()).concat(key.slice(1));
    }
    var originUnitless = (options === null || options === void 0 ? void 0 : options.unitless) || {};
    var originCompUnitless = typeof getCompUnitless === "function" ? getCompUnitless(component) : {};
    var compUnitless = _objectSpread2(_objectSpread2({}, originCompUnitless), {}, _defineProperty$4({}, prefixToken("zIndexPopup"), true));
    Object.keys(originUnitless).forEach(function(key) {
      compUnitless[prefixToken(key)] = originUnitless[key];
    });
    var mergedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
      unitless: compUnitless,
      prefixToken
    });
    var useStyle2 = genComponentStyleHook(component, styleFn, getDefaultToken, mergedOptions);
    var useCSSVar = genCSSVarRegister(componentName, getDefaultToken, mergedOptions);
    return function(prefixCls) {
      var rootCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : prefixCls;
      var _useStyle = useStyle2(prefixCls, rootCls), _useStyle2 = _slicedToArray(_useStyle, 2), hashId = _useStyle2[1];
      var _useCSSVar = useCSSVar(rootCls), _useCSSVar2 = _slicedToArray(_useCSSVar, 2), wrapCSSVar = _useCSSVar2[0], cssVarCls = _useCSSVar2[1];
      return [wrapCSSVar, hashId, cssVarCls];
    };
  }
  function genCSSVarRegister(component, getDefaultToken, options) {
    var compUnitless = options.unitless, _options$injectStyle = options.injectStyle, injectStyle = _options$injectStyle === void 0 ? true : _options$injectStyle, prefixToken = options.prefixToken, ignore2 = options.ignore;
    var CSSVarRegister = function CSSVarRegister2(_ref) {
      var rootCls = _ref.rootCls, _ref$cssVar = _ref.cssVar, cssVar = _ref$cssVar === void 0 ? {} : _ref$cssVar;
      var _useToken = useToken2(), realToken = _useToken.realToken;
      useCSSVarRegister({
        path: [component],
        prefix: cssVar.prefix,
        key: cssVar.key,
        unitless: compUnitless,
        ignore: ignore2,
        token: realToken,
        scope: rootCls
      }, function() {
        var defaultToken = getDefaultComponentToken(component, realToken, getDefaultToken);
        var componentToken = getComponentToken(component, realToken, defaultToken, {
          deprecatedTokens: options === null || options === void 0 ? void 0 : options.deprecatedTokens
        });
        Object.keys(defaultToken).forEach(function(key) {
          componentToken[prefixToken(key)] = componentToken[key];
          delete componentToken[key];
        });
        return componentToken;
      });
      return null;
    };
    var useCSSVar = function useCSSVar2(rootCls) {
      var _useToken2 = useToken2(), cssVar = _useToken2.cssVar;
      return [function(node2) {
        return injectStyle && cssVar ? /* @__PURE__ */ React$6.createElement(React$6.Fragment, null, /* @__PURE__ */ React$6.createElement(CSSVarRegister, {
          rootCls,
          cssVar,
          component
        }), node2) : node2;
      }, cssVar === null || cssVar === void 0 ? void 0 : cssVar.key];
    };
    return useCSSVar;
  }
  function genComponentStyleHook(componentName, styleFn, getDefaultToken) {
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    var cells = Array.isArray(componentName) ? componentName : [componentName, componentName];
    var _cells = _slicedToArray(cells, 1), component = _cells[0];
    var concatComponent = cells.join("-");
    var mergedLayer = config2.layer || {
      name: "antd"
    };
    return function(prefixCls) {
      var rootCls = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : prefixCls;
      var _useToken3 = useToken2(), theme2 = _useToken3.theme, realToken = _useToken3.realToken, hashId = _useToken3.hashId, token2 = _useToken3.token, cssVar = _useToken3.cssVar;
      var _usePrefix = usePrefix(), rootPrefixCls = _usePrefix.rootPrefixCls, iconPrefixCls = _usePrefix.iconPrefixCls;
      var csp = useCSP();
      var type4 = cssVar ? "css" : "js";
      var calc = useUniqueMemo(function() {
        var unitlessCssVar = /* @__PURE__ */ new Set();
        if (cssVar) {
          Object.keys(options.unitless || {}).forEach(function(key) {
            unitlessCssVar.add(token2CSSVar(key, cssVar.prefix));
            unitlessCssVar.add(token2CSSVar(key, getCompVarPrefix(component, cssVar.prefix)));
          });
        }
        return genCalc(type4, unitlessCssVar);
      }, [type4, component, cssVar === null || cssVar === void 0 ? void 0 : cssVar.prefix]);
      var _genMaxMin = genMaxMin(type4), max2 = _genMaxMin.max, min2 = _genMaxMin.min;
      var sharedConfig = {
        theme: theme2,
        token: token2,
        hashId,
        nonce: function nonce() {
          return csp.nonce;
        },
        clientOnly: options.clientOnly,
        layer: mergedLayer,
        // antd is always at top of styles
        order: options.order || -999
      };
      if (typeof getResetStyles === "function") {
        useStyleRegister(_objectSpread2(_objectSpread2({}, sharedConfig), {}, {
          clientOnly: false,
          path: ["Shared", rootPrefixCls]
        }), function() {
          return getResetStyles(token2, {
            prefix: {
              rootPrefixCls,
              iconPrefixCls
            },
            csp
          });
        });
      }
      var wrapSSR = useStyleRegister(_objectSpread2(_objectSpread2({}, sharedConfig), {}, {
        path: [concatComponent, prefixCls, iconPrefixCls]
      }), function() {
        if (options.injectStyle === false) {
          return [];
        }
        var _statisticToken = statisticToken(token2), proxyToken = _statisticToken.token, flush = _statisticToken.flush;
        var defaultComponentToken = getDefaultComponentToken(component, realToken, getDefaultToken);
        var componentCls = ".".concat(prefixCls);
        var componentToken = getComponentToken(component, realToken, defaultComponentToken, {
          deprecatedTokens: options.deprecatedTokens
        });
        if (cssVar && defaultComponentToken && _typeof$2(defaultComponentToken) === "object") {
          Object.keys(defaultComponentToken).forEach(function(key) {
            defaultComponentToken[key] = "var(".concat(token2CSSVar(key, getCompVarPrefix(component, cssVar.prefix)), ")");
          });
        }
        var mergedToken = merge$4(proxyToken, {
          componentCls,
          prefixCls,
          iconCls: ".".concat(iconPrefixCls),
          antCls: ".".concat(rootPrefixCls),
          calc,
          // @ts-ignore
          max: max2,
          // @ts-ignore
          min: min2
        }, cssVar ? defaultComponentToken : componentToken);
        var styleInterpolation = styleFn(mergedToken, {
          hashId,
          prefixCls,
          rootPrefixCls,
          iconPrefixCls
        });
        flush(component, componentToken);
        var commonStyle = typeof getCommonStyle === "function" ? getCommonStyle(mergedToken, prefixCls, rootCls, options.resetFont) : null;
        return [options.resetStyle === false ? null : commonStyle, styleInterpolation];
      });
      return [wrapSSR, hashId];
    };
  }
  function genSubStyleComponent(componentName, styleFn, getDefaultToken) {
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    var useStyle2 = genComponentStyleHook(componentName, styleFn, getDefaultToken, _objectSpread2({
      resetStyle: false,
      // Sub Style should default after root one
      order: -998
    }, options));
    var StyledComponent = function StyledComponent2(_ref2) {
      var prefixCls = _ref2.prefixCls, _ref2$rootCls = _ref2.rootCls, rootCls = _ref2$rootCls === void 0 ? prefixCls : _ref2$rootCls;
      useStyle2(prefixCls, rootCls);
      return null;
    };
    return StyledComponent;
  }
  return {
    genStyleHooks: genStyleHooks2,
    genSubStyleComponent,
    genComponentStyleHook
  };
}
const PresetColors = ["blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
const version$1 = "5.26.6";
function isStableColor(color2) {
  return color2 >= 0 && color2 <= 255;
}
function getAlphaColor$1(frontColor, backgroundColor) {
  const {
    r: fR,
    g: fG,
    b: fB,
    a: originAlpha
  } = new FastColor(frontColor).toRgb();
  if (originAlpha < 1) {
    return frontColor;
  }
  const {
    r: bR,
    g: bG,
    b: bB
  } = new FastColor(backgroundColor).toRgb();
  for (let fA = 0.01; fA <= 1; fA += 0.01) {
    const r2 = Math.round((fR - bR * (1 - fA)) / fA);
    const g2 = Math.round((fG - bG * (1 - fA)) / fA);
    const b2 = Math.round((fB - bB * (1 - fA)) / fA);
    if (isStableColor(r2) && isStableColor(g2) && isStableColor(b2)) {
      return new FastColor({
        r: r2,
        g: g2,
        b: b2,
        a: Math.round(fA * 100) / 100
      }).toRgbString();
    }
  }
  return new FastColor({
    r: fR,
    g: fG,
    b: fB,
    a: 1
  }).toRgbString();
}
var __rest$9 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function formatToken(derivativeToken) {
  const {
    override
  } = derivativeToken, restToken = __rest$9(derivativeToken, ["override"]);
  const overrideTokens = Object.assign({}, override);
  Object.keys(seedToken).forEach((token2) => {
    delete overrideTokens[token2];
  });
  const mergedToken = Object.assign(Object.assign({}, restToken), overrideTokens);
  const screenXS = 480;
  const screenSM = 576;
  const screenMD = 768;
  const screenLG = 992;
  const screenXL = 1200;
  const screenXXL = 1600;
  if (mergedToken.motion === false) {
    const fastDuration = "0s";
    mergedToken.motionDurationFast = fastDuration;
    mergedToken.motionDurationMid = fastDuration;
    mergedToken.motionDurationSlow = fastDuration;
  }
  const aliasToken = Object.assign(Object.assign(Object.assign({}, mergedToken), {
    // ============== Background ============== //
    colorFillContent: mergedToken.colorFillSecondary,
    colorFillContentHover: mergedToken.colorFill,
    colorFillAlter: mergedToken.colorFillQuaternary,
    colorBgContainerDisabled: mergedToken.colorFillTertiary,
    // ============== Split ============== //
    colorBorderBg: mergedToken.colorBgContainer,
    colorSplit: getAlphaColor$1(mergedToken.colorBorderSecondary, mergedToken.colorBgContainer),
    // ============== Text ============== //
    colorTextPlaceholder: mergedToken.colorTextQuaternary,
    colorTextDisabled: mergedToken.colorTextQuaternary,
    colorTextHeading: mergedToken.colorText,
    colorTextLabel: mergedToken.colorTextSecondary,
    colorTextDescription: mergedToken.colorTextTertiary,
    colorTextLightSolid: mergedToken.colorWhite,
    colorHighlight: mergedToken.colorError,
    colorBgTextHover: mergedToken.colorFillSecondary,
    colorBgTextActive: mergedToken.colorFill,
    colorIcon: mergedToken.colorTextTertiary,
    colorIconHover: mergedToken.colorText,
    colorErrorOutline: getAlphaColor$1(mergedToken.colorErrorBg, mergedToken.colorBgContainer),
    colorWarningOutline: getAlphaColor$1(mergedToken.colorWarningBg, mergedToken.colorBgContainer),
    // Font
    fontSizeIcon: mergedToken.fontSizeSM,
    // Line
    lineWidthFocus: mergedToken.lineWidth * 3,
    // Control
    lineWidth: mergedToken.lineWidth,
    controlOutlineWidth: mergedToken.lineWidth * 2,
    // Checkbox size and expand icon size
    controlInteractiveSize: mergedToken.controlHeight / 2,
    controlItemBgHover: mergedToken.colorFillTertiary,
    controlItemBgActive: mergedToken.colorPrimaryBg,
    controlItemBgActiveHover: mergedToken.colorPrimaryBgHover,
    controlItemBgActiveDisabled: mergedToken.colorFill,
    controlTmpOutline: mergedToken.colorFillQuaternary,
    controlOutline: getAlphaColor$1(mergedToken.colorPrimaryBg, mergedToken.colorBgContainer),
    lineType: mergedToken.lineType,
    borderRadius: mergedToken.borderRadius,
    borderRadiusXS: mergedToken.borderRadiusXS,
    borderRadiusSM: mergedToken.borderRadiusSM,
    borderRadiusLG: mergedToken.borderRadiusLG,
    fontWeightStrong: 600,
    opacityLoading: 0.65,
    linkDecoration: "none",
    linkHoverDecoration: "none",
    linkFocusDecoration: "none",
    controlPaddingHorizontal: 12,
    controlPaddingHorizontalSM: 8,
    paddingXXS: mergedToken.sizeXXS,
    paddingXS: mergedToken.sizeXS,
    paddingSM: mergedToken.sizeSM,
    padding: mergedToken.size,
    paddingMD: mergedToken.sizeMD,
    paddingLG: mergedToken.sizeLG,
    paddingXL: mergedToken.sizeXL,
    paddingContentHorizontalLG: mergedToken.sizeLG,
    paddingContentVerticalLG: mergedToken.sizeMS,
    paddingContentHorizontal: mergedToken.sizeMS,
    paddingContentVertical: mergedToken.sizeSM,
    paddingContentHorizontalSM: mergedToken.size,
    paddingContentVerticalSM: mergedToken.sizeXS,
    marginXXS: mergedToken.sizeXXS,
    marginXS: mergedToken.sizeXS,
    marginSM: mergedToken.sizeSM,
    margin: mergedToken.size,
    marginMD: mergedToken.sizeMD,
    marginLG: mergedToken.sizeLG,
    marginXL: mergedToken.sizeXL,
    marginXXL: mergedToken.sizeXXL,
    boxShadow: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowSecondary: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowTertiary: `
      0 1px 2px 0 rgba(0, 0, 0, 0.03),
      0 1px 6px -1px rgba(0, 0, 0, 0.02),
      0 2px 4px 0 rgba(0, 0, 0, 0.02)
    `,
    screenXS,
    screenXSMin: screenXS,
    screenXSMax: screenSM - 1,
    screenSM,
    screenSMMin: screenSM,
    screenSMMax: screenMD - 1,
    screenMD,
    screenMDMin: screenMD,
    screenMDMax: screenLG - 1,
    screenLG,
    screenLGMin: screenLG,
    screenLGMax: screenXL - 1,
    screenXL,
    screenXLMin: screenXL,
    screenXLMax: screenXXL - 1,
    screenXXL,
    screenXXLMin: screenXXL,
    boxShadowPopoverArrow: "2px 2px 5px rgba(0, 0, 0, 0.05)",
    boxShadowCard: `
      0 1px 2px -2px ${new FastColor("rgba(0, 0, 0, 0.16)").toRgbString()},
      0 3px 6px 0 ${new FastColor("rgba(0, 0, 0, 0.12)").toRgbString()},
      0 5px 12px 4px ${new FastColor("rgba(0, 0, 0, 0.09)").toRgbString()}
    `,
    boxShadowDrawerRight: `
      -6px 0 16px 0 rgba(0, 0, 0, 0.08),
      -3px 0 6px -4px rgba(0, 0, 0, 0.12),
      -9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerLeft: `
      6px 0 16px 0 rgba(0, 0, 0, 0.08),
      3px 0 6px -4px rgba(0, 0, 0, 0.12),
      9px 0 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerUp: `
      0 6px 16px 0 rgba(0, 0, 0, 0.08),
      0 3px 6px -4px rgba(0, 0, 0, 0.12),
      0 9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowDrawerDown: `
      0 -6px 16px 0 rgba(0, 0, 0, 0.08),
      0 -3px 6px -4px rgba(0, 0, 0, 0.12),
      0 -9px 28px 8px rgba(0, 0, 0, 0.05)
    `,
    boxShadowTabsOverflowLeft: "inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowRight: "inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowTop: "inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",
    boxShadowTabsOverflowBottom: "inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"
  }), overrideTokens);
  return aliasToken;
}
var __rest$8 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const unitless = {
  lineHeight: true,
  lineHeightSM: true,
  lineHeightLG: true,
  lineHeightHeading1: true,
  lineHeightHeading2: true,
  lineHeightHeading3: true,
  lineHeightHeading4: true,
  lineHeightHeading5: true,
  opacityLoading: true,
  fontWeightStrong: true,
  zIndexPopupBase: true,
  zIndexBase: true,
  opacityImage: true
};
const ignore$1 = {
  size: true,
  sizeSM: true,
  sizeLG: true,
  sizeMD: true,
  sizeXS: true,
  sizeXXS: true,
  sizeMS: true,
  sizeXL: true,
  sizeXXL: true,
  sizeUnit: true,
  sizeStep: true,
  motionBase: true,
  motionUnit: true
};
const preserve = {
  screenXS: true,
  screenXSMin: true,
  screenXSMax: true,
  screenSM: true,
  screenSMMin: true,
  screenSMMax: true,
  screenMD: true,
  screenMDMin: true,
  screenMDMax: true,
  screenLG: true,
  screenLGMin: true,
  screenLGMax: true,
  screenXL: true,
  screenXLMin: true,
  screenXLMax: true,
  screenXXL: true,
  screenXXLMin: true
};
const getComputedToken = (originToken, overrideToken, theme2) => {
  const derivativeToken = theme2.getDerivativeToken(originToken);
  const {
    override
  } = overrideToken, components2 = __rest$8(overrideToken, ["override"]);
  let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), {
    override
  });
  mergedDerivativeToken = formatToken(mergedDerivativeToken);
  if (components2) {
    Object.entries(components2).forEach(([key, value2]) => {
      const {
        theme: componentTheme
      } = value2, componentTokens = __rest$8(value2, ["theme"]);
      let mergedComponentToken = componentTokens;
      if (componentTheme) {
        mergedComponentToken = getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), {
          override: componentTokens
        }, componentTheme);
      }
      mergedDerivativeToken[key] = mergedComponentToken;
    });
  }
  return mergedDerivativeToken;
};
function useToken() {
  const {
    token: rootDesignToken,
    hashed,
    theme: theme2,
    override,
    cssVar
  } = React$6.useContext(DesignTokenContext);
  const salt = `${version$1}-${hashed || ""}`;
  const mergedTheme = theme2 || defaultTheme;
  const [token2, hashId, realToken] = useCacheToken(mergedTheme, [seedToken, rootDesignToken], {
    salt,
    override,
    getComputedToken,
    // formatToken will not be consumed after 1.15.0 with getComputedToken.
    // But token will break if @ant-design/cssinjs is under 1.15.0 without it
    formatToken,
    cssVar: cssVar && {
      prefix: cssVar.prefix,
      key: cssVar.key,
      unitless,
      ignore: ignore$1,
      preserve
    }
  });
  return [mergedTheme, realToken, hashed ? hashId : "", token2, cssVar];
}
const textEllipsis = {
  overflow: "hidden",
  whiteSpace: "nowrap",
  textOverflow: "ellipsis"
};
const resetComponent = (token2, needInheritFontFamily = false) => ({
  boxSizing: "border-box",
  margin: 0,
  padding: 0,
  color: token2.colorText,
  fontSize: token2.fontSize,
  // font-variant: @font-variant-base;
  lineHeight: token2.lineHeight,
  listStyle: "none",
  // font-feature-settings: @font-feature-settings-base;
  fontFamily: needInheritFontFamily ? "inherit" : token2.fontFamily
});
const resetIcon = () => ({
  display: "inline-flex",
  alignItems: "center",
  color: "inherit",
  fontStyle: "normal",
  lineHeight: 0,
  textAlign: "center",
  textTransform: "none",
  // for SVG icon, see https://blog.prototypr.io/align-svg-icons-to-text-and-say-goodbye-to-font-icons-d44b3d7b26b4
  verticalAlign: "-0.125em",
  textRendering: "optimizeLegibility",
  "-webkit-font-smoothing": "antialiased",
  "-moz-osx-font-smoothing": "grayscale",
  "> *": {
    lineHeight: 1
  },
  svg: {
    display: "inline-block"
  }
});
const clearFix = () => ({
  // https://github.com/ant-design/ant-design/issues/21301#issuecomment-583955229
  "&::before": {
    display: "table",
    content: '""'
  },
  "&::after": {
    // https://github.com/ant-design/ant-design/issues/21864
    display: "table",
    clear: "both",
    content: '""'
  }
});
const genLinkStyle = (token2) => ({
  a: {
    color: token2.colorLink,
    textDecoration: token2.linkDecoration,
    backgroundColor: "transparent",
    // remove the gray background on active links in IE 10.
    outline: "none",
    cursor: "pointer",
    transition: `color ${token2.motionDurationSlow}`,
    "-webkit-text-decoration-skip": "objects",
    // remove gaps in links underline in iOS 8+ and Safari 8+.
    "&:hover": {
      color: token2.colorLinkHover
    },
    "&:active": {
      color: token2.colorLinkActive
    },
    "&:active, &:hover": {
      textDecoration: token2.linkHoverDecoration,
      outline: 0
    },
    // https://github.com/ant-design/ant-design/issues/22503
    "&:focus": {
      textDecoration: token2.linkFocusDecoration,
      outline: 0
    },
    "&[disabled]": {
      color: token2.colorTextDisabled,
      cursor: "not-allowed"
    }
  }
});
const genCommonStyle = (token2, componentPrefixCls, rootCls, resetFont) => {
  const prefixSelector = `[class^="${componentPrefixCls}"], [class*=" ${componentPrefixCls}"]`;
  const rootPrefixSelector = rootCls ? `.${rootCls}` : prefixSelector;
  const resetStyle = {
    boxSizing: "border-box",
    "&::before, &::after": {
      boxSizing: "border-box"
    }
  };
  let resetFontStyle = {};
  if (resetFont !== false) {
    resetFontStyle = {
      fontFamily: token2.fontFamily,
      fontSize: token2.fontSize
    };
  }
  return {
    [rootPrefixSelector]: Object.assign(Object.assign(Object.assign({}, resetFontStyle), resetStyle), {
      [prefixSelector]: resetStyle
    })
  };
};
const genFocusOutline = (token2, offset2) => ({
  outline: `${unit$1(token2.lineWidthFocus)} solid ${token2.colorPrimaryBorder}`,
  outlineOffset: offset2 !== null && offset2 !== void 0 ? offset2 : 1,
  transition: "outline-offset 0s, outline 0s"
});
const genIconStyle = (iconPrefixCls) => ({
  [`.${iconPrefixCls}`]: Object.assign(Object.assign({}, resetIcon()), {
    [`.${iconPrefixCls} .${iconPrefixCls}-icon`]: {
      display: "block"
    }
  })
});
const {
  genStyleHooks
} = genStyleUtils({
  usePrefix: () => {
    const {
      getPrefixCls,
      iconPrefixCls
    } = reactExports.useContext(ConfigContext);
    const rootPrefixCls = getPrefixCls();
    return {
      rootPrefixCls,
      iconPrefixCls
    };
  },
  useToken: () => {
    const [theme2, realToken, hashId, token2, cssVar] = useToken();
    return {
      theme: theme2,
      realToken,
      hashId,
      token: token2,
      cssVar
    };
  },
  useCSP: () => {
    const {
      csp
    } = reactExports.useContext(ConfigContext);
    return csp !== null && csp !== void 0 ? csp : {};
  },
  getResetStyles: (token2, config2) => {
    var _a2;
    const linkStyle = genLinkStyle(token2);
    return [linkStyle, {
      "&": linkStyle
    }, genIconStyle((_a2 = config2 === null || config2 === void 0 ? void 0 : config2.prefix.iconPrefixCls) !== null && _a2 !== void 0 ? _a2 : defaultIconPrefixCls)];
  },
  getCommonStyle: genCommonStyle,
  getCompUnitless: () => unitless
});
function genPresetColor(token2, genCss) {
  return PresetColors.reduce((prev2, colorKey) => {
    const lightColor = token2[`${colorKey}1`];
    const lightBorderColor = token2[`${colorKey}3`];
    const darkColor = token2[`${colorKey}6`];
    const textColor = token2[`${colorKey}7`];
    return Object.assign(Object.assign({}, prev2), genCss(colorKey, {
      lightColor,
      lightBorderColor,
      darkColor,
      textColor
    }));
  }, {});
}
const useResetIconStyle = (iconPrefixCls, csp) => {
  const [theme2, token2] = useToken();
  return useStyleRegister({
    token: token2,
    hashId: "",
    path: ["ant-design-icons", iconPrefixCls],
    nonce: () => csp === null || csp === void 0 ? void 0 : csp.nonce,
    layer: {
      name: "antd"
    }
  }, () => [genIconStyle(iconPrefixCls)]);
};
const fullClone = Object.assign({}, React$7);
const {
  useId: useId$1
} = fullClone;
const useEmptyId = () => "";
const useThemeKey = typeof useId$1 === "undefined" ? useEmptyId : useId$1;
function useTheme(theme2, parentTheme, config2) {
  var _a2;
  devUseWarning();
  const themeConfig = theme2 || {};
  const parentThemeConfig = themeConfig.inherit === false || !parentTheme ? Object.assign(Object.assign({}, defaultConfig), {
    hashed: (_a2 = parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.hashed) !== null && _a2 !== void 0 ? _a2 : defaultConfig.hashed,
    cssVar: parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.cssVar
  }) : parentTheme;
  const themeKey = useThemeKey();
  return useMemo(() => {
    var _a22, _b2;
    if (!theme2) {
      return parentTheme;
    }
    const mergedComponents = Object.assign({}, parentThemeConfig.components);
    Object.keys(theme2.components || {}).forEach((componentName) => {
      mergedComponents[componentName] = Object.assign(Object.assign({}, mergedComponents[componentName]), theme2.components[componentName]);
    });
    const cssVarKey = `css-var-${themeKey.replace(/:/g, "")}`;
    const mergedCssVar = ((_a22 = themeConfig.cssVar) !== null && _a22 !== void 0 ? _a22 : parentThemeConfig.cssVar) && Object.assign(Object.assign(Object.assign({
      prefix: config2 === null || config2 === void 0 ? void 0 : config2.prefixCls
    }, typeof parentThemeConfig.cssVar === "object" ? parentThemeConfig.cssVar : {}), typeof themeConfig.cssVar === "object" ? themeConfig.cssVar : {}), {
      key: typeof themeConfig.cssVar === "object" && ((_b2 = themeConfig.cssVar) === null || _b2 === void 0 ? void 0 : _b2.key) || cssVarKey
    });
    return Object.assign(Object.assign(Object.assign({}, parentThemeConfig), themeConfig), {
      token: Object.assign(Object.assign({}, parentThemeConfig.token), themeConfig.token),
      components: mergedComponents,
      cssVar: mergedCssVar
    });
  }, [themeConfig, parentThemeConfig], (prev2, next2) => prev2.some((prevTheme, index2) => {
    const nextTheme = next2[index2];
    return !isEqual$2(prevTheme, nextTheme, true);
  }));
}
var _excluded$y = ["children"];
var Context$2 = /* @__PURE__ */ reactExports.createContext({});
function MotionProvider(_ref) {
  var children = _ref.children, props = _objectWithoutProperties$3(_ref, _excluded$y);
  return /* @__PURE__ */ reactExports.createElement(Context$2.Provider, {
    value: props
  }, children);
}
var DomWrapper = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(DomWrapper2, _React$Component);
  var _super = _createSuper$4(DomWrapper2);
  function DomWrapper2() {
    _classCallCheck$a(this, DomWrapper2);
    return _super.apply(this, arguments);
  }
  _createClass$8(DomWrapper2, [{
    key: "render",
    value: function render3() {
      return this.props.children;
    }
  }]);
  return DomWrapper2;
}(reactExports.Component);
function useSyncState(defaultValue2) {
  var _React$useReducer = reactExports.useReducer(function(x2) {
    return x2 + 1;
  }, 0), _React$useReducer2 = _slicedToArray(_React$useReducer, 2), forceUpdate = _React$useReducer2[1];
  var currentValueRef = reactExports.useRef(defaultValue2);
  var getValue2 = useEvent$2(function() {
    return currentValueRef.current;
  });
  var setValue = useEvent$2(function(updater) {
    currentValueRef.current = typeof updater === "function" ? updater(currentValueRef.current) : updater;
    forceUpdate();
  });
  return [getValue2, setValue];
}
var STATUS_NONE = "none";
var STATUS_APPEAR = "appear";
var STATUS_ENTER = "enter";
var STATUS_LEAVE = "leave";
var STEP_NONE = "none";
var STEP_PREPARE = "prepare";
var STEP_START = "start";
var STEP_ACTIVE = "active";
var STEP_ACTIVATED = "end";
var STEP_PREPARED = "prepared";
function makePrefixMap(styleProp, eventName) {
  var prefixes2 = {};
  prefixes2[styleProp.toLowerCase()] = eventName.toLowerCase();
  prefixes2["Webkit".concat(styleProp)] = "webkit".concat(eventName);
  prefixes2["Moz".concat(styleProp)] = "moz".concat(eventName);
  prefixes2["ms".concat(styleProp)] = "MS".concat(eventName);
  prefixes2["O".concat(styleProp)] = "o".concat(eventName.toLowerCase());
  return prefixes2;
}
function getVendorPrefixes(domSupport, win2) {
  var prefixes2 = {
    animationend: makePrefixMap("Animation", "AnimationEnd"),
    transitionend: makePrefixMap("Transition", "TransitionEnd")
  };
  if (domSupport) {
    if (!("AnimationEvent" in win2)) {
      delete prefixes2.animationend.animation;
    }
    if (!("TransitionEvent" in win2)) {
      delete prefixes2.transitionend.transition;
    }
  }
  return prefixes2;
}
var vendorPrefixes = getVendorPrefixes(canUseDom$1(), typeof window !== "undefined" ? window : {});
var style = {};
if (canUseDom$1()) {
  var _document$createEleme = document.createElement("div");
  style = _document$createEleme.style;
}
var prefixedEventNames = {};
function getVendorPrefixedEventName(eventName) {
  if (prefixedEventNames[eventName]) {
    return prefixedEventNames[eventName];
  }
  var prefixMap = vendorPrefixes[eventName];
  if (prefixMap) {
    var stylePropList = Object.keys(prefixMap);
    var len = stylePropList.length;
    for (var i2 = 0; i2 < len; i2 += 1) {
      var styleProp = stylePropList[i2];
      if (Object.prototype.hasOwnProperty.call(prefixMap, styleProp) && styleProp in style) {
        prefixedEventNames[eventName] = prefixMap[styleProp];
        return prefixedEventNames[eventName];
      }
    }
  }
  return "";
}
var internalAnimationEndName = getVendorPrefixedEventName("animationend");
var internalTransitionEndName = getVendorPrefixedEventName("transitionend");
var supportTransition = !!(internalAnimationEndName && internalTransitionEndName);
var animationEndName = internalAnimationEndName || "animationend";
var transitionEndName = internalTransitionEndName || "transitionend";
function getTransitionName$1(transitionName, transitionType) {
  if (!transitionName)
    return null;
  if (_typeof$2(transitionName) === "object") {
    var type4 = transitionType.replace(/-\w/g, function(match5) {
      return match5[1].toUpperCase();
    });
    return transitionName[type4];
  }
  return "".concat(transitionName, "-").concat(transitionType);
}
const useDomMotionEvents = function(onInternalMotionEnd) {
  var cacheElementRef = reactExports.useRef();
  function removeMotionEvents(element2) {
    if (element2) {
      element2.removeEventListener(transitionEndName, onInternalMotionEnd);
      element2.removeEventListener(animationEndName, onInternalMotionEnd);
    }
  }
  function patchMotionEvents(element2) {
    if (cacheElementRef.current && cacheElementRef.current !== element2) {
      removeMotionEvents(cacheElementRef.current);
    }
    if (element2 && element2 !== cacheElementRef.current) {
      element2.addEventListener(transitionEndName, onInternalMotionEnd);
      element2.addEventListener(animationEndName, onInternalMotionEnd);
      cacheElementRef.current = element2;
    }
  }
  reactExports.useEffect(function() {
    return function() {
      removeMotionEvents(cacheElementRef.current);
    };
  }, []);
  return [patchMotionEvents, removeMotionEvents];
};
var useIsomorphicLayoutEffect$2 = canUseDom$1() ? reactExports.useLayoutEffect : reactExports.useEffect;
const useNextFrame = function() {
  var nextFrameRef = reactExports.useRef(null);
  function cancelNextFrame() {
    wrapperRaf.cancel(nextFrameRef.current);
  }
  function nextFrame(callback2) {
    var delay2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2;
    cancelNextFrame();
    var nextFrameId = wrapperRaf(function() {
      if (delay2 <= 1) {
        callback2({
          isCanceled: function isCanceled() {
            return nextFrameId !== nextFrameRef.current;
          }
        });
      } else {
        nextFrame(callback2, delay2 - 1);
      }
    });
    nextFrameRef.current = nextFrameId;
  }
  reactExports.useEffect(function() {
    return function() {
      cancelNextFrame();
    };
  }, []);
  return [nextFrame, cancelNextFrame];
};
var FULL_STEP_QUEUE = [STEP_PREPARE, STEP_START, STEP_ACTIVE, STEP_ACTIVATED];
var SIMPLE_STEP_QUEUE = [STEP_PREPARE, STEP_PREPARED];
var SkipStep = false;
var DoStep = true;
function isActive(step) {
  return step === STEP_ACTIVE || step === STEP_ACTIVATED;
}
const useStepQueue = function(status, prepareOnly, callback2) {
  var _useState = useSafeState(STEP_NONE), _useState2 = _slicedToArray(_useState, 2), step = _useState2[0], setStep = _useState2[1];
  var _useNextFrame = useNextFrame(), _useNextFrame2 = _slicedToArray(_useNextFrame, 2), nextFrame = _useNextFrame2[0], cancelNextFrame = _useNextFrame2[1];
  function startQueue() {
    setStep(STEP_PREPARE, true);
  }
  var STEP_QUEUE = prepareOnly ? SIMPLE_STEP_QUEUE : FULL_STEP_QUEUE;
  useIsomorphicLayoutEffect$2(function() {
    if (step !== STEP_NONE && step !== STEP_ACTIVATED) {
      var index2 = STEP_QUEUE.indexOf(step);
      var nextStep = STEP_QUEUE[index2 + 1];
      var result = callback2(step);
      if (result === SkipStep) {
        setStep(nextStep, true);
      } else if (nextStep) {
        nextFrame(function(info) {
          function doNext() {
            if (info.isCanceled())
              return;
            setStep(nextStep, true);
          }
          if (result === true) {
            doNext();
          } else {
            Promise.resolve(result).then(doNext);
          }
        });
      }
    }
  }, [status, step]);
  reactExports.useEffect(function() {
    return function() {
      cancelNextFrame();
    };
  }, []);
  return [startQueue, step];
};
function useStatus(supportMotion, visible, getElement, _ref) {
  var _ref$motionEnter = _ref.motionEnter, motionEnter = _ref$motionEnter === void 0 ? true : _ref$motionEnter, _ref$motionAppear = _ref.motionAppear, motionAppear = _ref$motionAppear === void 0 ? true : _ref$motionAppear, _ref$motionLeave = _ref.motionLeave, motionLeave = _ref$motionLeave === void 0 ? true : _ref$motionLeave, motionDeadline = _ref.motionDeadline, motionLeaveImmediately = _ref.motionLeaveImmediately, onAppearPrepare = _ref.onAppearPrepare, onEnterPrepare = _ref.onEnterPrepare, onLeavePrepare = _ref.onLeavePrepare, onAppearStart = _ref.onAppearStart, onEnterStart = _ref.onEnterStart, onLeaveStart = _ref.onLeaveStart, onAppearActive = _ref.onAppearActive, onEnterActive = _ref.onEnterActive, onLeaveActive = _ref.onLeaveActive, onAppearEnd = _ref.onAppearEnd, onEnterEnd = _ref.onEnterEnd, onLeaveEnd = _ref.onLeaveEnd, onVisibleChanged = _ref.onVisibleChanged;
  var _useState = useSafeState(), _useState2 = _slicedToArray(_useState, 2), asyncVisible = _useState2[0], setAsyncVisible = _useState2[1];
  var _useSyncState = useSyncState(STATUS_NONE), _useSyncState2 = _slicedToArray(_useSyncState, 2), getStatus = _useSyncState2[0], setStatus = _useSyncState2[1];
  var _useState3 = useSafeState(null), _useState4 = _slicedToArray(_useState3, 2), style2 = _useState4[0], setStyle2 = _useState4[1];
  var currentStatus = getStatus();
  var mountedRef = reactExports.useRef(false);
  var deadlineRef = reactExports.useRef(null);
  function getDomElement() {
    return getElement();
  }
  var activeRef = reactExports.useRef(false);
  function updateMotionEndStatus() {
    setStatus(STATUS_NONE);
    setStyle2(null, true);
  }
  var onInternalMotionEnd = useEvent$2(function(event) {
    var status = getStatus();
    if (status === STATUS_NONE) {
      return;
    }
    var element2 = getDomElement();
    if (event && !event.deadline && event.target !== element2) {
      return;
    }
    var currentActive = activeRef.current;
    var canEnd;
    if (status === STATUS_APPEAR && currentActive) {
      canEnd = onAppearEnd === null || onAppearEnd === void 0 ? void 0 : onAppearEnd(element2, event);
    } else if (status === STATUS_ENTER && currentActive) {
      canEnd = onEnterEnd === null || onEnterEnd === void 0 ? void 0 : onEnterEnd(element2, event);
    } else if (status === STATUS_LEAVE && currentActive) {
      canEnd = onLeaveEnd === null || onLeaveEnd === void 0 ? void 0 : onLeaveEnd(element2, event);
    }
    if (currentActive && canEnd !== false) {
      updateMotionEndStatus();
    }
  });
  var _useDomMotionEvents = useDomMotionEvents(onInternalMotionEnd), _useDomMotionEvents2 = _slicedToArray(_useDomMotionEvents, 1), patchMotionEvents = _useDomMotionEvents2[0];
  var getEventHandlers = function getEventHandlers2(targetStatus) {
    switch (targetStatus) {
      case STATUS_APPEAR:
        return _defineProperty$4(_defineProperty$4(_defineProperty$4({}, STEP_PREPARE, onAppearPrepare), STEP_START, onAppearStart), STEP_ACTIVE, onAppearActive);
      case STATUS_ENTER:
        return _defineProperty$4(_defineProperty$4(_defineProperty$4({}, STEP_PREPARE, onEnterPrepare), STEP_START, onEnterStart), STEP_ACTIVE, onEnterActive);
      case STATUS_LEAVE:
        return _defineProperty$4(_defineProperty$4(_defineProperty$4({}, STEP_PREPARE, onLeavePrepare), STEP_START, onLeaveStart), STEP_ACTIVE, onLeaveActive);
      default:
        return {};
    }
  };
  var eventHandlers = reactExports.useMemo(function() {
    return getEventHandlers(currentStatus);
  }, [currentStatus]);
  var _useStepQueue = useStepQueue(currentStatus, !supportMotion, function(newStep) {
    if (newStep === STEP_PREPARE) {
      var onPrepare = eventHandlers[STEP_PREPARE];
      if (!onPrepare) {
        return SkipStep;
      }
      return onPrepare(getDomElement());
    }
    if (step in eventHandlers) {
      var _eventHandlers$step;
      setStyle2(((_eventHandlers$step = eventHandlers[step]) === null || _eventHandlers$step === void 0 ? void 0 : _eventHandlers$step.call(eventHandlers, getDomElement(), null)) || null);
    }
    if (step === STEP_ACTIVE && currentStatus !== STATUS_NONE) {
      patchMotionEvents(getDomElement());
      if (motionDeadline > 0) {
        clearTimeout(deadlineRef.current);
        deadlineRef.current = setTimeout(function() {
          onInternalMotionEnd({
            deadline: true
          });
        }, motionDeadline);
      }
    }
    if (step === STEP_PREPARED) {
      updateMotionEndStatus();
    }
    return DoStep;
  }), _useStepQueue2 = _slicedToArray(_useStepQueue, 2), startStep = _useStepQueue2[0], step = _useStepQueue2[1];
  var active3 = isActive(step);
  activeRef.current = active3;
  var visibleRef = reactExports.useRef(null);
  useIsomorphicLayoutEffect$2(function() {
    if (mountedRef.current && visibleRef.current === visible) {
      return;
    }
    setAsyncVisible(visible);
    var isMounted = mountedRef.current;
    mountedRef.current = true;
    var nextStatus;
    if (!isMounted && visible && motionAppear) {
      nextStatus = STATUS_APPEAR;
    }
    if (isMounted && visible && motionEnter) {
      nextStatus = STATUS_ENTER;
    }
    if (isMounted && !visible && motionLeave || !isMounted && motionLeaveImmediately && !visible && motionLeave) {
      nextStatus = STATUS_LEAVE;
    }
    var nextEventHandlers = getEventHandlers(nextStatus);
    if (nextStatus && (supportMotion || nextEventHandlers[STEP_PREPARE])) {
      setStatus(nextStatus);
      startStep();
    } else {
      setStatus(STATUS_NONE);
    }
    visibleRef.current = visible;
  }, [visible]);
  reactExports.useEffect(function() {
    if (
      // Cancel appear
      currentStatus === STATUS_APPEAR && !motionAppear || // Cancel enter
      currentStatus === STATUS_ENTER && !motionEnter || // Cancel leave
      currentStatus === STATUS_LEAVE && !motionLeave
    ) {
      setStatus(STATUS_NONE);
    }
  }, [motionAppear, motionEnter, motionLeave]);
  reactExports.useEffect(function() {
    return function() {
      mountedRef.current = false;
      clearTimeout(deadlineRef.current);
    };
  }, []);
  var firstMountChangeRef = reactExports.useRef(false);
  reactExports.useEffect(function() {
    if (asyncVisible) {
      firstMountChangeRef.current = true;
    }
    if (asyncVisible !== void 0 && currentStatus === STATUS_NONE) {
      if (firstMountChangeRef.current || asyncVisible) {
        onVisibleChanged === null || onVisibleChanged === void 0 || onVisibleChanged(asyncVisible);
      }
      firstMountChangeRef.current = true;
    }
  }, [asyncVisible, currentStatus]);
  var mergedStyle = style2;
  if (eventHandlers[STEP_PREPARE] && step === STEP_START) {
    mergedStyle = _objectSpread2({
      transition: "none"
    }, mergedStyle);
  }
  return [currentStatus, step, mergedStyle, asyncVisible !== null && asyncVisible !== void 0 ? asyncVisible : visible];
}
function genCSSMotion(config2) {
  var transitionSupport = config2;
  if (_typeof$2(config2) === "object") {
    transitionSupport = config2.transitionSupport;
  }
  function isSupportTransition(props, contextMotion) {
    return !!(props.motionName && transitionSupport && contextMotion !== false);
  }
  var CSSMotion2 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var _props$visible = props.visible, visible = _props$visible === void 0 ? true : _props$visible, _props$removeOnLeave = props.removeOnLeave, removeOnLeave = _props$removeOnLeave === void 0 ? true : _props$removeOnLeave, forceRender = props.forceRender, children = props.children, motionName = props.motionName, leavedClassName = props.leavedClassName, eventProps = props.eventProps;
    var _React$useContext = reactExports.useContext(Context$2), contextMotion = _React$useContext.motion;
    var supportMotion = isSupportTransition(props, contextMotion);
    var nodeRef = reactExports.useRef();
    var wrapperNodeRef = reactExports.useRef();
    function getDomElement() {
      try {
        return nodeRef.current instanceof HTMLElement ? nodeRef.current : findDOMNode$1(wrapperNodeRef.current);
      } catch (e2) {
        return null;
      }
    }
    var _useStatus = useStatus(supportMotion, visible, getDomElement, props), _useStatus2 = _slicedToArray(_useStatus, 4), status = _useStatus2[0], statusStep = _useStatus2[1], statusStyle = _useStatus2[2], mergedVisible = _useStatus2[3];
    var renderedRef = reactExports.useRef(mergedVisible);
    if (mergedVisible) {
      renderedRef.current = true;
    }
    var setNodeRef = reactExports.useCallback(function(node2) {
      nodeRef.current = node2;
      fillRef(ref, node2);
    }, [ref]);
    var motionChildren;
    var mergedProps = _objectSpread2(_objectSpread2({}, eventProps), {}, {
      visible
    });
    if (!children) {
      motionChildren = null;
    } else if (status === STATUS_NONE) {
      if (mergedVisible) {
        motionChildren = children(_objectSpread2({}, mergedProps), setNodeRef);
      } else if (!removeOnLeave && renderedRef.current && leavedClassName) {
        motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
          className: leavedClassName
        }), setNodeRef);
      } else if (forceRender || !removeOnLeave && !leavedClassName) {
        motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
          style: {
            display: "none"
          }
        }), setNodeRef);
      } else {
        motionChildren = null;
      }
    } else {
      var statusSuffix;
      if (statusStep === STEP_PREPARE) {
        statusSuffix = "prepare";
      } else if (isActive(statusStep)) {
        statusSuffix = "active";
      } else if (statusStep === STEP_START) {
        statusSuffix = "start";
      }
      var motionCls = getTransitionName$1(motionName, "".concat(status, "-").concat(statusSuffix));
      motionChildren = children(_objectSpread2(_objectSpread2({}, mergedProps), {}, {
        className: classNames(getTransitionName$1(motionName, status), _defineProperty$4(_defineProperty$4({}, motionCls, motionCls && statusSuffix), motionName, typeof motionName === "string")),
        style: statusStyle
      }), setNodeRef);
    }
    if (/* @__PURE__ */ reactExports.isValidElement(motionChildren) && supportRef(motionChildren)) {
      var originNodeRef = getNodeRef(motionChildren);
      if (!originNodeRef) {
        motionChildren = /* @__PURE__ */ reactExports.cloneElement(motionChildren, {
          ref: setNodeRef
        });
      }
    }
    return /* @__PURE__ */ reactExports.createElement(DomWrapper, {
      ref: wrapperNodeRef
    }, motionChildren);
  });
  CSSMotion2.displayName = "CSSMotion";
  return CSSMotion2;
}
const CSSMotion = genCSSMotion(supportTransition);
var STATUS_ADD = "add";
var STATUS_KEEP = "keep";
var STATUS_REMOVE = "remove";
var STATUS_REMOVED = "removed";
function wrapKeyToObject(key) {
  var keyObj;
  if (key && _typeof$2(key) === "object" && "key" in key) {
    keyObj = key;
  } else {
    keyObj = {
      key
    };
  }
  return _objectSpread2(_objectSpread2({}, keyObj), {}, {
    key: String(keyObj.key)
  });
}
function parseKeys() {
  var keys2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  return keys2.map(wrapKeyToObject);
}
function diffKeys() {
  var prevKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var currentKeys = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var list2 = [];
  var currentIndex = 0;
  var currentLen = currentKeys.length;
  var prevKeyObjects = parseKeys(prevKeys);
  var currentKeyObjects = parseKeys(currentKeys);
  prevKeyObjects.forEach(function(keyObj) {
    var hit = false;
    for (var i2 = currentIndex; i2 < currentLen; i2 += 1) {
      var currentKeyObj = currentKeyObjects[i2];
      if (currentKeyObj.key === keyObj.key) {
        if (currentIndex < i2) {
          list2 = list2.concat(currentKeyObjects.slice(currentIndex, i2).map(function(obj) {
            return _objectSpread2(_objectSpread2({}, obj), {}, {
              status: STATUS_ADD
            });
          }));
          currentIndex = i2;
        }
        list2.push(_objectSpread2(_objectSpread2({}, currentKeyObj), {}, {
          status: STATUS_KEEP
        }));
        currentIndex += 1;
        hit = true;
        break;
      }
    }
    if (!hit) {
      list2.push(_objectSpread2(_objectSpread2({}, keyObj), {}, {
        status: STATUS_REMOVE
      }));
    }
  });
  if (currentIndex < currentLen) {
    list2 = list2.concat(currentKeyObjects.slice(currentIndex).map(function(obj) {
      return _objectSpread2(_objectSpread2({}, obj), {}, {
        status: STATUS_ADD
      });
    }));
  }
  var keys2 = {};
  list2.forEach(function(_ref) {
    var key = _ref.key;
    keys2[key] = (keys2[key] || 0) + 1;
  });
  var duplicatedKeys = Object.keys(keys2).filter(function(key) {
    return keys2[key] > 1;
  });
  duplicatedKeys.forEach(function(matchKey) {
    list2 = list2.filter(function(_ref2) {
      var key = _ref2.key, status = _ref2.status;
      return key !== matchKey || status !== STATUS_REMOVE;
    });
    list2.forEach(function(node2) {
      if (node2.key === matchKey) {
        node2.status = STATUS_KEEP;
      }
    });
  });
  return list2;
}
var _excluded$x = ["component", "children", "onVisibleChanged", "onAllRemoved"], _excluded2$6 = ["status"];
var MOTION_PROP_NAMES = ["eventProps", "visible", "children", "motionName", "motionAppear", "motionEnter", "motionLeave", "motionLeaveImmediately", "motionDeadline", "removeOnLeave", "leavedClassName", "onAppearPrepare", "onAppearStart", "onAppearActive", "onAppearEnd", "onEnterStart", "onEnterActive", "onEnterEnd", "onLeaveStart", "onLeaveActive", "onLeaveEnd"];
function genCSSMotionList(transitionSupport) {
  var CSSMotion$1 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CSSMotion;
  var CSSMotionList = /* @__PURE__ */ function(_React$Component) {
    _inherits$a(CSSMotionList2, _React$Component);
    var _super = _createSuper$4(CSSMotionList2);
    function CSSMotionList2() {
      var _this;
      _classCallCheck$a(this, CSSMotionList2);
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      _this = _super.call.apply(_super, [this].concat(args));
      _defineProperty$4(_assertThisInitialized(_this), "state", {
        keyEntities: []
      });
      _defineProperty$4(_assertThisInitialized(_this), "removeKey", function(removeKey) {
        _this.setState(function(prevState) {
          var nextKeyEntities = prevState.keyEntities.map(function(entity) {
            if (entity.key !== removeKey)
              return entity;
            return _objectSpread2(_objectSpread2({}, entity), {}, {
              status: STATUS_REMOVED
            });
          });
          return {
            keyEntities: nextKeyEntities
          };
        }, function() {
          var keyEntities = _this.state.keyEntities;
          var restKeysCount = keyEntities.filter(function(_ref) {
            var status = _ref.status;
            return status !== STATUS_REMOVED;
          }).length;
          if (restKeysCount === 0 && _this.props.onAllRemoved) {
            _this.props.onAllRemoved();
          }
        });
      });
      return _this;
    }
    _createClass$8(CSSMotionList2, [{
      key: "render",
      value: function render3() {
        var _this2 = this;
        var keyEntities = this.state.keyEntities;
        var _this$props = this.props, component = _this$props.component, children = _this$props.children, _onVisibleChanged = _this$props.onVisibleChanged;
        _this$props.onAllRemoved;
        var restProps = _objectWithoutProperties$3(_this$props, _excluded$x);
        var Component2 = component || reactExports.Fragment;
        var motionProps = {};
        MOTION_PROP_NAMES.forEach(function(prop) {
          motionProps[prop] = restProps[prop];
          delete restProps[prop];
        });
        delete restProps.keys;
        return /* @__PURE__ */ reactExports.createElement(Component2, restProps, keyEntities.map(function(_ref2, index2) {
          var status = _ref2.status, eventProps = _objectWithoutProperties$3(_ref2, _excluded2$6);
          var visible = status === STATUS_ADD || status === STATUS_KEEP;
          return /* @__PURE__ */ reactExports.createElement(CSSMotion$1, _extends$j({}, motionProps, {
            key: eventProps.key,
            visible,
            eventProps,
            onVisibleChanged: function onVisibleChanged(changedVisible) {
              _onVisibleChanged === null || _onVisibleChanged === void 0 || _onVisibleChanged(changedVisible, {
                key: eventProps.key
              });
              if (!changedVisible) {
                _this2.removeKey(eventProps.key);
              }
            }
          }), function(props, ref) {
            return children(_objectSpread2(_objectSpread2({}, props), {}, {
              index: index2
            }), ref);
          });
        }));
      }
    }], [{
      key: "getDerivedStateFromProps",
      value: function getDerivedStateFromProps(_ref3, _ref4) {
        var keys2 = _ref3.keys;
        var keyEntities = _ref4.keyEntities;
        var parsedKeyObjects = parseKeys(keys2);
        var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);
        return {
          keyEntities: mixedKeyEntities.filter(function(entity) {
            var prevEntity = keyEntities.find(function(_ref5) {
              var key = _ref5.key;
              return entity.key === key;
            });
            if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {
              return false;
            }
            return true;
          })
        };
      }
    }]);
    return CSSMotionList2;
  }(reactExports.Component);
  _defineProperty$4(CSSMotionList, "defaultProps", {
    component: "div"
  });
  return CSSMotionList;
}
genCSSMotionList(supportTransition);
const MotionCacheContext = /* @__PURE__ */ reactExports.createContext(true);
function MotionWrapper(props) {
  const parentMotion = reactExports.useContext(MotionCacheContext);
  const {
    children
  } = props;
  const [, token2] = useToken();
  const {
    motion
  } = token2;
  const needWrapMotionProviderRef = reactExports.useRef(false);
  needWrapMotionProviderRef.current || (needWrapMotionProviderRef.current = parentMotion !== motion);
  if (needWrapMotionProviderRef.current) {
    return /* @__PURE__ */ reactExports.createElement(MotionCacheContext.Provider, {
      value: motion
    }, /* @__PURE__ */ reactExports.createElement(MotionProvider, {
      motion
    }, children));
  }
  return children;
}
const PropWarning = () => null;
var __rest$7 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const PASSED_PROPS = ["getTargetContainer", "getPopupContainer", "renderEmpty", "input", "pagination", "form", "select", "button"];
let globalPrefixCls;
function getGlobalPrefixCls() {
  return globalPrefixCls || defaultPrefixCls;
}
function isLegacyTheme(theme2) {
  return Object.keys(theme2).some((key) => key.endsWith("Color"));
}
const setGlobalConfig = (props) => {
  const {
    prefixCls,
    iconPrefixCls,
    theme: theme2,
    holderRender
  } = props;
  if (prefixCls !== void 0) {
    globalPrefixCls = prefixCls;
  }
  if (theme2) {
    if (isLegacyTheme(theme2)) {
      registerTheme(getGlobalPrefixCls(), theme2);
    }
  }
};
const ProviderChildren = (props) => {
  const {
    children,
    csp: customCsp,
    autoInsertSpaceInButton,
    alert: alert2,
    anchor,
    form: form2,
    locale: locale2,
    componentSize,
    direction,
    space: space2,
    splitter,
    virtual,
    dropdownMatchSelectWidth,
    popupMatchSelectWidth,
    popupOverflow,
    legacyLocale,
    parentContext,
    iconPrefixCls: customIconPrefixCls,
    theme: theme2,
    componentDisabled,
    segmented,
    statistic: statistic2,
    spin: spin2,
    calendar: calendar2,
    carousel,
    cascader,
    collapse,
    typography,
    checkbox: checkbox2,
    descriptions,
    divider: divider2,
    drawer: drawer2,
    skeleton,
    steps,
    image: image2,
    layout: layout2,
    list: list2,
    mentions,
    modal: modal2,
    progress: progress2,
    result,
    slider: slider2,
    breadcrumb,
    menu: menu2,
    pagination: pagination2,
    input: input2,
    textArea,
    empty: empty2,
    badge: badge2,
    radio: radio2,
    rate,
    switch: SWITCH,
    transfer,
    avatar,
    message,
    tag,
    table: table2,
    card: card2,
    tabs: tabs2,
    timeline,
    timePicker,
    upload,
    notification,
    tree,
    colorPicker,
    datePicker: datePicker2,
    rangePicker,
    flex: flex2,
    wave,
    dropdown: dropdown2,
    warning: warningConfig,
    tour,
    tooltip,
    popover: popover2,
    popconfirm,
    floatButtonGroup,
    variant,
    inputNumber,
    treeSelect
  } = props;
  const getPrefixCls = reactExports.useCallback((suffixCls, customizePrefixCls) => {
    const {
      prefixCls
    } = props;
    if (customizePrefixCls) {
      return customizePrefixCls;
    }
    const mergedPrefixCls = prefixCls || parentContext.getPrefixCls("");
    return suffixCls ? `${mergedPrefixCls}-${suffixCls}` : mergedPrefixCls;
  }, [parentContext.getPrefixCls, props.prefixCls]);
  const iconPrefixCls = customIconPrefixCls || parentContext.iconPrefixCls || defaultIconPrefixCls;
  const csp = customCsp || parentContext.csp;
  useResetIconStyle(iconPrefixCls, csp);
  const mergedTheme = useTheme(theme2, parentContext.theme, {
    prefixCls: getPrefixCls("")
  });
  const baseConfig2 = {
    csp,
    autoInsertSpaceInButton,
    alert: alert2,
    anchor,
    locale: locale2 || legacyLocale,
    direction,
    space: space2,
    splitter,
    virtual,
    popupMatchSelectWidth: popupMatchSelectWidth !== null && popupMatchSelectWidth !== void 0 ? popupMatchSelectWidth : dropdownMatchSelectWidth,
    popupOverflow,
    getPrefixCls,
    iconPrefixCls,
    theme: mergedTheme,
    segmented,
    statistic: statistic2,
    spin: spin2,
    calendar: calendar2,
    carousel,
    cascader,
    collapse,
    typography,
    checkbox: checkbox2,
    descriptions,
    divider: divider2,
    drawer: drawer2,
    skeleton,
    steps,
    image: image2,
    input: input2,
    textArea,
    layout: layout2,
    list: list2,
    mentions,
    modal: modal2,
    progress: progress2,
    result,
    slider: slider2,
    breadcrumb,
    menu: menu2,
    pagination: pagination2,
    empty: empty2,
    badge: badge2,
    radio: radio2,
    rate,
    switch: SWITCH,
    transfer,
    avatar,
    message,
    tag,
    table: table2,
    card: card2,
    tabs: tabs2,
    timeline,
    timePicker,
    upload,
    notification,
    tree,
    colorPicker,
    datePicker: datePicker2,
    rangePicker,
    flex: flex2,
    wave,
    dropdown: dropdown2,
    warning: warningConfig,
    tour,
    tooltip,
    popover: popover2,
    popconfirm,
    floatButtonGroup,
    variant,
    inputNumber,
    treeSelect
  };
  const config2 = Object.assign({}, parentContext);
  Object.keys(baseConfig2).forEach((key) => {
    if (baseConfig2[key] !== void 0) {
      config2[key] = baseConfig2[key];
    }
  });
  PASSED_PROPS.forEach((propName) => {
    const propValue = props[propName];
    if (propValue) {
      config2[propName] = propValue;
    }
  });
  if (typeof autoInsertSpaceInButton !== "undefined") {
    config2.button = Object.assign({
      autoInsertSpace: autoInsertSpaceInButton
    }, config2.button);
  }
  const memoedConfig = useMemo(() => config2, config2, (prevConfig, currentConfig) => {
    const prevKeys = Object.keys(prevConfig);
    const currentKeys = Object.keys(currentConfig);
    return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
  });
  const {
    layer
  } = reactExports.useContext(StyleContext);
  const memoIconContextValue = reactExports.useMemo(() => ({
    prefixCls: iconPrefixCls,
    csp,
    layer: layer ? "antd" : void 0
  }), [iconPrefixCls, csp, layer]);
  let childNode = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(PropWarning, {
    dropdownMatchSelectWidth
  }), children);
  const validateMessages = reactExports.useMemo(() => {
    var _a2, _b2, _c2, _d;
    return merge$5(((_a2 = localeValues.Form) === null || _a2 === void 0 ? void 0 : _a2.defaultValidateMessages) || {}, ((_c2 = (_b2 = memoedConfig.locale) === null || _b2 === void 0 ? void 0 : _b2.Form) === null || _c2 === void 0 ? void 0 : _c2.defaultValidateMessages) || {}, ((_d = memoedConfig.form) === null || _d === void 0 ? void 0 : _d.validateMessages) || {}, (form2 === null || form2 === void 0 ? void 0 : form2.validateMessages) || {});
  }, [memoedConfig, form2 === null || form2 === void 0 ? void 0 : form2.validateMessages]);
  if (Object.keys(validateMessages).length > 0) {
    childNode = /* @__PURE__ */ reactExports.createElement(ValidateMessagesContext.Provider, {
      value: validateMessages
    }, childNode);
  }
  if (locale2) {
    childNode = /* @__PURE__ */ reactExports.createElement(LocaleProvider, {
      locale: locale2,
      _ANT_MARK__: ANT_MARK
    }, childNode);
  }
  {
    childNode = /* @__PURE__ */ reactExports.createElement(IconContext$1.Provider, {
      value: memoIconContextValue
    }, childNode);
  }
  if (componentSize) {
    childNode = /* @__PURE__ */ reactExports.createElement(SizeContextProvider, {
      size: componentSize
    }, childNode);
  }
  childNode = /* @__PURE__ */ reactExports.createElement(MotionWrapper, null, childNode);
  const memoTheme = reactExports.useMemo(() => {
    const _a2 = mergedTheme || {}, {
      algorithm,
      token: token2,
      components: components2,
      cssVar
    } = _a2, rest = __rest$7(_a2, ["algorithm", "token", "components", "cssVar"]);
    const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : defaultTheme;
    const parsedComponents = {};
    Object.entries(components2 || {}).forEach(([componentName, componentToken]) => {
      const parsedToken = Object.assign({}, componentToken);
      if ("algorithm" in parsedToken) {
        if (parsedToken.algorithm === true) {
          parsedToken.theme = themeObj;
        } else if (Array.isArray(parsedToken.algorithm) || typeof parsedToken.algorithm === "function") {
          parsedToken.theme = createTheme(parsedToken.algorithm);
        }
        delete parsedToken.algorithm;
      }
      parsedComponents[componentName] = parsedToken;
    });
    const mergedToken = Object.assign(Object.assign({}, seedToken), token2);
    return Object.assign(Object.assign({}, rest), {
      theme: themeObj,
      token: mergedToken,
      components: parsedComponents,
      override: Object.assign({
        override: mergedToken
      }, parsedComponents),
      cssVar
    });
  }, [mergedTheme]);
  if (theme2) {
    childNode = /* @__PURE__ */ reactExports.createElement(DesignTokenContext.Provider, {
      value: memoTheme
    }, childNode);
  }
  if (memoedConfig.warning) {
    childNode = /* @__PURE__ */ reactExports.createElement(WarningContext.Provider, {
      value: memoedConfig.warning
    }, childNode);
  }
  if (componentDisabled !== void 0) {
    childNode = /* @__PURE__ */ reactExports.createElement(DisabledContextProvider, {
      disabled: componentDisabled
    }, childNode);
  }
  return /* @__PURE__ */ reactExports.createElement(ConfigContext.Provider, {
    value: memoedConfig
  }, childNode);
};
const ConfigProvider = (props) => {
  const context = reactExports.useContext(ConfigContext);
  const antLocale = reactExports.useContext(LocaleContext);
  return /* @__PURE__ */ reactExports.createElement(ProviderChildren, Object.assign({
    parentContext: context,
    legacyLocale: antLocale
  }, props));
};
ConfigProvider.ConfigContext = ConfigContext;
ConfigProvider.SizeContext = SizeContext;
ConfigProvider.config = setGlobalConfig;
ConfigProvider.useConfig = useConfig;
Object.defineProperty(ConfigProvider, "SizeContext", {
  get: () => {
    return SizeContext;
  }
});
var CheckCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" } }] }, "name": "check-circle", "theme": "filled" };
function getRoot(ele) {
  var _ele$getRootNode;
  return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
}
function inShadow(ele) {
  return getRoot(ele) instanceof ShadowRoot;
}
function getShadowRoot(ele) {
  return inShadow(ele) ? getRoot(ele) : null;
}
function camelCase$1(input2) {
  return input2.replace(/-(.)/g, function(match5, g2) {
    return g2.toUpperCase();
  });
}
function warning$1(valid2, message) {
  warningOnce(valid2, "[@ant-design/icons] ".concat(message));
}
function isIconDefinition(target) {
  return _typeof$2(target) === "object" && typeof target.name === "string" && typeof target.theme === "string" && (_typeof$2(target.icon) === "object" || typeof target.icon === "function");
}
function normalizeAttrs() {
  var attrs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  return Object.keys(attrs).reduce(function(acc, key) {
    var val = attrs[key];
    switch (key) {
      case "class":
        acc.className = val;
        delete acc.class;
        break;
      default:
        delete acc[key];
        acc[camelCase$1(key)] = val;
    }
    return acc;
  }, {});
}
function generate(node2, key, rootProps) {
  if (!rootProps) {
    return /* @__PURE__ */ React$6.createElement(node2.tag, _objectSpread2({
      key
    }, normalizeAttrs(node2.attrs)), (node2.children || []).map(function(child, index2) {
      return generate(child, "".concat(key, "-").concat(node2.tag, "-").concat(index2));
    }));
  }
  return /* @__PURE__ */ React$6.createElement(node2.tag, _objectSpread2(_objectSpread2({
    key
  }, normalizeAttrs(node2.attrs)), rootProps), (node2.children || []).map(function(child, index2) {
    return generate(child, "".concat(key, "-").concat(node2.tag, "-").concat(index2));
  }));
}
function getSecondaryColor(primaryColor) {
  return generate$1(primaryColor)[0];
}
function normalizeTwoToneColors(twoToneColor) {
  if (!twoToneColor) {
    return [];
  }
  return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
}
var iconStyles = "\n.anticon {\n  display: inline-flex;\n  align-items: center;\n  color: inherit;\n  font-style: normal;\n  line-height: 0;\n  text-align: center;\n  text-transform: none;\n  vertical-align: -0.125em;\n  text-rendering: optimizeLegibility;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n  line-height: 1;\n}\n\n.anticon svg {\n  display: inline-block;\n}\n\n.anticon::before {\n  display: none;\n}\n\n.anticon .anticon-icon {\n  display: block;\n}\n\n.anticon[tabindex] {\n  cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n  display: inline-block;\n  -webkit-animation: loadingCircle 1s infinite linear;\n  animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n  100% {\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg);\n  }\n}\n\n@keyframes loadingCircle {\n  100% {\n    -webkit-transform: rotate(360deg);\n    transform: rotate(360deg);\n  }\n}\n";
var useInsertStyles = function useInsertStyles2(eleRef) {
  var _useContext = reactExports.useContext(IconContext$1), csp = _useContext.csp, prefixCls = _useContext.prefixCls, layer = _useContext.layer;
  var mergedStyleStr = iconStyles;
  if (prefixCls) {
    mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
  }
  if (layer) {
    mergedStyleStr = "@layer ".concat(layer, " {\n").concat(mergedStyleStr, "\n}");
  }
  reactExports.useEffect(function() {
    var ele = eleRef.current;
    var shadowRoot = getShadowRoot(ele);
    updateCSS(mergedStyleStr, "@ant-design-icons", {
      prepend: !layer,
      csp,
      attachTo: shadowRoot
    });
  }, []);
};
var _excluded$w = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
var twoToneColorPalette = {
  primaryColor: "#333",
  secondaryColor: "#E6E6E6",
  calculated: false
};
function setTwoToneColors(_ref) {
  var primaryColor = _ref.primaryColor, secondaryColor = _ref.secondaryColor;
  twoToneColorPalette.primaryColor = primaryColor;
  twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
  twoToneColorPalette.calculated = !!secondaryColor;
}
function getTwoToneColors() {
  return _objectSpread2({}, twoToneColorPalette);
}
var IconBase$1 = function IconBase(props) {
  var icon = props.icon, className = props.className, onClick = props.onClick, style2 = props.style, primaryColor = props.primaryColor, secondaryColor = props.secondaryColor, restProps = _objectWithoutProperties$3(props, _excluded$w);
  var svgRef = reactExports.useRef();
  var colors2 = twoToneColorPalette;
  if (primaryColor) {
    colors2 = {
      primaryColor,
      secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
    };
  }
  useInsertStyles(svgRef);
  warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
  if (!isIconDefinition(icon)) {
    return null;
  }
  var target = icon;
  if (target && typeof target.icon === "function") {
    target = _objectSpread2(_objectSpread2({}, target), {}, {
      icon: target.icon(colors2.primaryColor, colors2.secondaryColor)
    });
  }
  return generate(target.icon, "svg-".concat(target.name), _objectSpread2(_objectSpread2({
    className,
    onClick,
    style: style2,
    "data-icon": target.name,
    width: "1em",
    height: "1em",
    fill: "currentColor",
    "aria-hidden": "true"
  }, restProps), {}, {
    ref: svgRef
  }));
};
IconBase$1.displayName = "IconReact";
IconBase$1.getTwoToneColors = getTwoToneColors;
IconBase$1.setTwoToneColors = setTwoToneColors;
function setTwoToneColor(twoToneColor) {
  var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
  return IconBase$1.setTwoToneColors({
    primaryColor,
    secondaryColor
  });
}
function getTwoToneColor() {
  var colors2 = IconBase$1.getTwoToneColors();
  if (!colors2.calculated) {
    return colors2.primaryColor;
  }
  return [colors2.primaryColor, colors2.secondaryColor];
}
var _excluded$v = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
setTwoToneColor(blue$1.primary);
var Icon$2 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var className = props.className, icon = props.icon, spin2 = props.spin, rotate2 = props.rotate, tabIndex = props.tabIndex, onClick = props.onClick, twoToneColor = props.twoToneColor, restProps = _objectWithoutProperties$3(props, _excluded$v);
  var _React$useContext = reactExports.useContext(IconContext$1), _React$useContext$pre = _React$useContext.prefixCls, prefixCls = _React$useContext$pre === void 0 ? "anticon" : _React$useContext$pre, rootClassName = _React$useContext.rootClassName;
  var classString = classNames(rootClassName, prefixCls, _defineProperty$4(_defineProperty$4({}, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), "".concat(prefixCls, "-spin"), !!spin2 || icon.name === "loading"), className);
  var iconTabIndex = tabIndex;
  if (iconTabIndex === void 0 && onClick) {
    iconTabIndex = -1;
  }
  var svgStyle = rotate2 ? {
    msTransform: "rotate(".concat(rotate2, "deg)"),
    transform: "rotate(".concat(rotate2, "deg)")
  } : void 0;
  var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor), _normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2), primaryColor = _normalizeTwoToneColo2[0], secondaryColor = _normalizeTwoToneColo2[1];
  return /* @__PURE__ */ reactExports.createElement("span", _extends$j({
    role: "img",
    "aria-label": icon.name
  }, restProps, {
    ref,
    tabIndex: iconTabIndex,
    onClick,
    className: classString
  }), /* @__PURE__ */ reactExports.createElement(IconBase$1, {
    icon,
    primaryColor,
    secondaryColor,
    style: svgStyle
  }));
});
Icon$2.displayName = "AntdIcon";
Icon$2.getTwoToneColor = getTwoToneColor;
Icon$2.setTwoToneColor = setTwoToneColor;
var CheckCircleFilled = function CheckCircleFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CheckCircleFilled$1
  }));
};
var RefIcon$1p = /* @__PURE__ */ reactExports.forwardRef(CheckCircleFilled);
var CloseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
var CloseOutlined = function CloseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CloseOutlined$1
  }));
};
var RefIcon$1o = /* @__PURE__ */ reactExports.forwardRef(CloseOutlined);
var attributes = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n    alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n    charSet checked classID className colSpan cols content contentEditable contextMenu\n    controls coords crossOrigin data dateTime default defer dir disabled download draggable\n    encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n    headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n    is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n    mediaGroup method min minLength multiple muted name noValidate nonce open\n    optimum pattern placeholder poster preload radioGroup readOnly rel required\n    reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n    shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n    summary tabIndex target title type useMap value width wmode wrap";
var eventsName = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n    onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n    onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n    onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n    onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n    onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n    onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
var propList = "".concat(attributes, " ").concat(eventsName).split(/[\s\n]+/);
var ariaPrefix = "aria-";
var dataPrefix = "data-";
function match(key, prefix) {
  return key.indexOf(prefix) === 0;
}
function pickAttrs$1(props) {
  var ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var mergedConfig;
  if (ariaOnly === false) {
    mergedConfig = {
      aria: true,
      data: true,
      attr: true
    };
  } else if (ariaOnly === true) {
    mergedConfig = {
      aria: true
    };
  } else {
    mergedConfig = _objectSpread2({}, ariaOnly);
  }
  var attrs = {};
  Object.keys(props).forEach(function(key) {
    if (
      // Aria
      mergedConfig.aria && (key === "role" || match(key, ariaPrefix)) || // Data
      mergedConfig.data && match(key, dataPrefix) || // Attr
      mergedConfig.attr && propList.includes(key)
    ) {
      attrs[key] = props[key];
    }
  });
  return attrs;
}
function isFragment(child) {
  return child && /* @__PURE__ */ React$6.isValidElement(child) && child.type === React$6.Fragment;
}
const replaceElement = (element2, replacement, props) => {
  if (!/* @__PURE__ */ React$6.isValidElement(element2)) {
    return replacement;
  }
  return /* @__PURE__ */ React$6.cloneElement(element2, typeof props === "function" ? props(element2.props || {}) : props);
};
function cloneElement(element2, props) {
  return replaceElement(element2, element2, props);
}
const useCSSVarCls = (prefixCls) => {
  const [, , , , cssVar] = useToken();
  return cssVar ? `${prefixCls}-css-var` : "";
};
var KeyCode$1 = {
  // NUMLOCK on FF/Safari Mac
  /**
   * ENTER
   */
  ENTER: 13,
  /**
   * ESC
   */
  ESC: 27,
  /**
   * SPACE
   */
  SPACE: 32,
  // also NUM_SOUTH_EAST
  /**
   * END
   */
  END: 35,
  // also NUM_SOUTH_WEST
  /**
   * HOME
   */
  HOME: 36,
  // also NUM_NORTH_WEST
  /**
   * LEFT
   */
  LEFT: 37,
  // also NUM_WEST
  /**
   * UP
   */
  UP: 38,
  // also NUM_NORTH
  /**
   * RIGHT
   */
  RIGHT: 39,
  // also NUM_EAST
  /**
   * DOWN
   */
  DOWN: 40
};
var LoadingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
var LoadingOutlined = function LoadingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: LoadingOutlined$1
  }));
};
var RefIcon$1n = /* @__PURE__ */ reactExports.forwardRef(LoadingOutlined);
const zIndexContext = /* @__PURE__ */ React$6.createContext(void 0);
const CONTAINER_OFFSET = 100;
const containerBaseZIndexOffset = {
  Modal: CONTAINER_OFFSET,
  Drawer: CONTAINER_OFFSET,
  Popover: CONTAINER_OFFSET,
  Popconfirm: CONTAINER_OFFSET,
  Tooltip: CONTAINER_OFFSET,
  Tour: CONTAINER_OFFSET,
  FloatButton: CONTAINER_OFFSET
};
const consumerBaseZIndexOffset = {
  SelectLike: 50,
  Dropdown: 50,
  DatePicker: 50,
  Menu: 50,
  ImagePreview: 1
};
function isContainerType(type4) {
  return type4 in containerBaseZIndexOffset;
}
const useZIndex = (componentType, customZIndex) => {
  const [, token2] = useToken();
  const parentZIndex = React$6.useContext(zIndexContext);
  const isContainer = isContainerType(componentType);
  let result;
  if (customZIndex !== void 0) {
    result = [customZIndex, customZIndex];
  } else {
    let zIndex = parentZIndex !== null && parentZIndex !== void 0 ? parentZIndex : 0;
    if (isContainer) {
      zIndex += // Use preset token zIndex by default but not stack when has parent container
      (parentZIndex ? 0 : token2.zIndexPopupBase) + // Container offset
      containerBaseZIndexOffset[componentType];
    } else {
      zIndex += consumerBaseZIndexOffset[componentType];
    }
    result = [parentZIndex === void 0 ? customZIndex : zIndex, zIndex];
  }
  return result;
};
function _OverloadYield(e2, d2) {
  this.v = e2, this.k = d2;
}
function _regeneratorDefine(e2, r2, n2, t2) {
  var i2 = Object.defineProperty;
  try {
    i2({}, "", {});
  } catch (e3) {
    i2 = 0;
  }
  _regeneratorDefine = function regeneratorDefine(e3, r3, n3, t3) {
    if (r3)
      i2 ? i2(e3, r3, {
        value: n3,
        enumerable: !t3,
        configurable: !t3,
        writable: !t3
      }) : e3[r3] = n3;
    else {
      var o2 = function o3(r4, n4) {
        _regeneratorDefine(e3, r4, function(e4) {
          return this._invoke(r4, n4, e4);
        });
      };
      o2("next", 0), o2("throw", 1), o2("return", 2);
    }
  }, _regeneratorDefine(e2, r2, n2, t2);
}
function _regenerator() {
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
  var e2, t2, r2 = "function" == typeof Symbol ? Symbol : {}, n2 = r2.iterator || "@@iterator", o2 = r2.toStringTag || "@@toStringTag";
  function i2(r3, n3, o3, i3) {
    var c3 = n3 && n3.prototype instanceof Generator ? n3 : Generator, u3 = Object.create(c3.prototype);
    return _regeneratorDefine(u3, "_invoke", function(r4, n4, o4) {
      var i4, c4, u4, f3 = 0, p2 = o4 || [], y2 = false, G2 = {
        p: 0,
        n: 0,
        v: e2,
        a: d2,
        f: d2.bind(e2, 4),
        d: function d3(t3, r5) {
          return i4 = t3, c4 = 0, u4 = e2, G2.n = r5, a2;
        }
      };
      function d2(r5, n5) {
        for (c4 = r5, u4 = n5, t2 = 0; !y2 && f3 && !o5 && t2 < p2.length; t2++) {
          var o5, i5 = p2[t2], d3 = G2.p, l2 = i5[2];
          r5 > 3 ? (o5 = l2 === n5) && (u4 = i5[(c4 = i5[4]) ? 5 : (c4 = 3, 3)], i5[4] = i5[5] = e2) : i5[0] <= d3 && ((o5 = r5 < 2 && d3 < i5[1]) ? (c4 = 0, G2.v = n5, G2.n = i5[1]) : d3 < l2 && (o5 = r5 < 3 || i5[0] > n5 || n5 > l2) && (i5[4] = r5, i5[5] = n5, G2.n = l2, c4 = 0));
        }
        if (o5 || r5 > 1)
          return a2;
        throw y2 = true, n5;
      }
      return function(o5, p3, l2) {
        if (f3 > 1)
          throw TypeError("Generator is already running");
        for (y2 && 1 === p3 && d2(p3, l2), c4 = p3, u4 = l2; (t2 = c4 < 2 ? e2 : u4) || !y2; ) {
          i4 || (c4 ? c4 < 3 ? (c4 > 1 && (G2.n = -1), d2(c4, u4)) : G2.n = u4 : G2.v = u4);
          try {
            if (f3 = 2, i4) {
              if (c4 || (o5 = "next"), t2 = i4[o5]) {
                if (!(t2 = t2.call(i4, u4)))
                  throw TypeError("iterator result is not an object");
                if (!t2.done)
                  return t2;
                u4 = t2.value, c4 < 2 && (c4 = 0);
              } else
                1 === c4 && (t2 = i4["return"]) && t2.call(i4), c4 < 2 && (u4 = TypeError("The iterator does not provide a '" + o5 + "' method"), c4 = 1);
              i4 = e2;
            } else if ((t2 = (y2 = G2.n < 0) ? u4 : r4.call(n4, G2)) !== a2)
              break;
          } catch (t3) {
            i4 = e2, c4 = 1, u4 = t3;
          } finally {
            f3 = 1;
          }
        }
        return {
          value: t2,
          done: y2
        };
      };
    }(r3, o3, i3), true), u3;
  }
  var a2 = {};
  function Generator() {
  }
  function GeneratorFunction() {
  }
  function GeneratorFunctionPrototype() {
  }
  t2 = Object.getPrototypeOf;
  var c2 = [][n2] ? t2(t2([][n2]())) : (_regeneratorDefine(t2 = {}, n2, function() {
    return this;
  }), t2), u2 = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c2);
  function f2(e3) {
    return Object.setPrototypeOf ? Object.setPrototypeOf(e3, GeneratorFunctionPrototype) : (e3.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e3, o2, "GeneratorFunction")), e3.prototype = Object.create(u2), e3;
  }
  return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u2, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o2, "GeneratorFunction"), _regeneratorDefine(u2), _regeneratorDefine(u2, o2, "Generator"), _regeneratorDefine(u2, n2, function() {
    return this;
  }), _regeneratorDefine(u2, "toString", function() {
    return "[object Generator]";
  }), (_regenerator = function _regenerator2() {
    return {
      w: i2,
      m: f2
    };
  })();
}
function AsyncIterator(t2, e2) {
  function n2(r3, o2, i2, f2) {
    try {
      var c2 = t2[r3](o2), u2 = c2.value;
      return u2 instanceof _OverloadYield ? e2.resolve(u2.v).then(function(t3) {
        n2("next", t3, i2, f2);
      }, function(t3) {
        n2("throw", t3, i2, f2);
      }) : e2.resolve(u2).then(function(t3) {
        c2.value = t3, i2(c2);
      }, function(t3) {
        return n2("throw", t3, i2, f2);
      });
    } catch (t3) {
      f2(t3);
    }
  }
  var r2;
  this.next || (_regeneratorDefine(AsyncIterator.prototype), _regeneratorDefine(AsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() {
    return this;
  })), _regeneratorDefine(this, "_invoke", function(t3, o2, i2) {
    function f2() {
      return new e2(function(e3, r3) {
        n2(t3, i2, e3, r3);
      });
    }
    return r2 = r2 ? r2.then(f2, f2) : f2();
  }, true);
}
function _regeneratorAsyncGen(r2, e2, t2, o2, n2) {
  return new AsyncIterator(_regenerator().w(r2, e2, t2, o2), n2 || Promise);
}
function _regeneratorAsync(n2, e2, r2, t2, o2) {
  var a2 = _regeneratorAsyncGen(n2, e2, r2, t2, o2);
  return a2.next().then(function(n3) {
    return n3.done ? n3.value : a2.next();
  });
}
function _regeneratorKeys(e2) {
  var n2 = Object(e2), r2 = [];
  for (var t2 in n2)
    r2.unshift(t2);
  return function e3() {
    for (; r2.length; )
      if ((t2 = r2.pop()) in n2)
        return e3.value = t2, e3.done = false, e3;
    return e3.done = true, e3;
  };
}
function _regeneratorValues(e2) {
  if (null != e2) {
    var t2 = e2["function" == typeof Symbol && Symbol.iterator || "@@iterator"], r2 = 0;
    if (t2)
      return t2.call(e2);
    if ("function" == typeof e2.next)
      return e2;
    if (!isNaN(e2.length))
      return {
        next: function next2() {
          return e2 && r2 >= e2.length && (e2 = void 0), {
            value: e2 && e2[r2++],
            done: !e2
          };
        }
      };
  }
  throw new TypeError(_typeof$2(e2) + " is not iterable");
}
function _regeneratorRuntime() {
  var r2 = _regenerator(), e2 = r2.m(_regeneratorRuntime), t2 = (Object.getPrototypeOf ? Object.getPrototypeOf(e2) : e2.__proto__).constructor;
  function n2(r3) {
    var e3 = "function" == typeof r3 && r3.constructor;
    return !!e3 && (e3 === t2 || "GeneratorFunction" === (e3.displayName || e3.name));
  }
  var o2 = {
    "throw": 1,
    "return": 2,
    "break": 3,
    "continue": 3
  };
  function a2(r3) {
    var e3, t3;
    return function(n3) {
      e3 || (e3 = {
        stop: function stop() {
          return t3(n3.a, 2);
        },
        "catch": function _catch() {
          return n3.v;
        },
        abrupt: function abrupt(r4, e4) {
          return t3(n3.a, o2[r4], e4);
        },
        delegateYield: function delegateYield(r4, o3, a3) {
          return e3.resultName = o3, t3(n3.d, _regeneratorValues(r4), a3);
        },
        finish: function finish(r4) {
          return t3(n3.f, r4);
        }
      }, t3 = function t4(r4, _t, o3) {
        n3.p = e3.prev, n3.n = e3.next;
        try {
          return r4(_t, o3);
        } finally {
          e3.next = n3.n;
        }
      }), e3.resultName && (e3[e3.resultName] = n3.v, e3.resultName = void 0), e3.sent = n3.v, e3.next = n3.n;
      try {
        return r3.call(this, e3);
      } finally {
        n3.p = e3.prev, n3.n = e3.next;
      }
    };
  }
  return (_regeneratorRuntime = function _regeneratorRuntime2() {
    return {
      wrap: function wrap2(e3, t3, n3, o3) {
        return r2.w(a2(e3), t3, n3, o3 && o3.reverse());
      },
      isGeneratorFunction: n2,
      mark: r2.m,
      awrap: function awrap(r3, e3) {
        return new _OverloadYield(r3, e3);
      },
      AsyncIterator,
      async: function async(r3, e3, t3, o3, u2) {
        return (n2(e3) ? _regeneratorAsyncGen : _regeneratorAsync)(a2(r3), e3, t3, o3, u2);
      },
      keys: _regeneratorKeys,
      values: _regeneratorValues
    };
  })();
}
function asyncGeneratorStep(n2, t2, e2, r2, o2, a2, c2) {
  try {
    var i2 = n2[a2](c2), u2 = i2.value;
  } catch (n3) {
    return void e2(n3);
  }
  i2.done ? t2(u2) : Promise.resolve(u2).then(r2, o2);
}
function _asyncToGenerator(n2) {
  return function() {
    var t2 = this, e2 = arguments;
    return new Promise(function(r2, o2) {
      var a2 = n2.apply(t2, e2);
      function _next(n3) {
        asyncGeneratorStep(a2, r2, o2, _next, _throw, "next", n3);
      }
      function _throw(n3) {
        asyncGeneratorStep(a2, r2, o2, _next, _throw, "throw", n3);
      }
      _next(void 0);
    });
  };
}
const getCollapsedHeight = () => ({
  height: 0,
  opacity: 0
});
const getRealHeight = (node2) => {
  const {
    scrollHeight
  } = node2;
  return {
    height: scrollHeight,
    opacity: 1
  };
};
const getCurrentHeight = (node2) => ({
  height: node2 ? node2.offsetHeight : 0
});
const skipOpacityTransition = (_24, event) => (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === "height";
const initCollapseMotion = (rootCls = defaultPrefixCls) => ({
  motionName: `${rootCls}-motion-collapse`,
  onAppearStart: getCollapsedHeight,
  onEnterStart: getCollapsedHeight,
  onAppearActive: getRealHeight,
  onEnterActive: getRealHeight,
  onLeaveStart: getCurrentHeight,
  onLeaveActive: getCollapsedHeight,
  onAppearEnd: skipOpacityTransition,
  onEnterEnd: skipOpacityTransition,
  onLeaveEnd: skipOpacityTransition,
  motionDeadline: 500
});
const getTransitionName = (rootPrefixCls, motion, transitionName) => {
  if (transitionName !== void 0) {
    return transitionName;
  }
  return `${rootPrefixCls}-${motion}`;
};
function omit$1(obj, fields) {
  var clone3 = Object.assign({}, obj);
  if (Array.isArray(fields)) {
    fields.forEach(function(key) {
      delete clone3[key];
    });
  }
  return clone3;
}
const isVisible = function(element2) {
  if (!element2) {
    return false;
  }
  if (element2 instanceof Element) {
    if (element2.offsetParent) {
      return true;
    }
    if (element2.getBBox) {
      var _getBBox = element2.getBBox(), width = _getBBox.width, height = _getBBox.height;
      if (width || height) {
        return true;
      }
    }
    if (element2.getBoundingClientRect) {
      var _element$getBoundingC = element2.getBoundingClientRect(), _width = _element$getBoundingC.width, _height = _element$getBoundingC.height;
      if (_width || _height) {
        return true;
      }
    }
  }
  return false;
};
(function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
});
const SpaceCompactItemContext = /* @__PURE__ */ reactExports.createContext(null);
const NoCompactStyle = (props) => {
  const {
    children
  } = props;
  return /* @__PURE__ */ reactExports.createElement(SpaceCompactItemContext.Provider, {
    value: null
  }, children);
};
var RightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, "name": "right", "theme": "outlined" };
var RightOutlined = function RightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: RightOutlined$1
  }));
};
var RefIcon$1m = /* @__PURE__ */ reactExports.forwardRef(RightOutlined);
const genCollapseMotion = (token2) => ({
  [token2.componentCls]: {
    // For common/openAnimation
    [`${token2.antCls}-motion-collapse-legacy`]: {
      overflow: "hidden",
      "&-active": {
        transition: `height ${token2.motionDurationMid} ${token2.motionEaseInOut},
        opacity ${token2.motionDurationMid} ${token2.motionEaseInOut} !important`
      }
    },
    [`${token2.antCls}-motion-collapse`]: {
      overflow: "hidden",
      transition: `height ${token2.motionDurationMid} ${token2.motionEaseInOut},
        opacity ${token2.motionDurationMid} ${token2.motionEaseInOut} !important`
    }
  }
});
const initMotionCommon = (duration2) => ({
  animationDuration: duration2,
  animationFillMode: "both"
});
const initMotionCommonLeave = (duration2) => ({
  animationDuration: duration2,
  animationFillMode: "both"
});
const initMotion = (motionCls, inKeyframes, outKeyframes, duration2, sameLevel = false) => {
  const sameLevelPrefix = sameLevel ? "&" : "";
  return {
    [`
      ${sameLevelPrefix}${motionCls}-enter,
      ${sameLevelPrefix}${motionCls}-appear
    `]: Object.assign(Object.assign({}, initMotionCommon(duration2)), {
      animationPlayState: "paused"
    }),
    [`${sameLevelPrefix}${motionCls}-leave`]: Object.assign(Object.assign({}, initMotionCommonLeave(duration2)), {
      animationPlayState: "paused"
    }),
    [`
      ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active,
      ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active
    `]: {
      animationName: inKeyframes,
      animationPlayState: "running"
    },
    [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: {
      animationName: outKeyframes,
      animationPlayState: "running",
      pointerEvents: "none"
    }
  };
};
const slideUpIn = new Keyframe("antSlideUpIn", {
  "0%": {
    transform: "scaleY(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleY(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  }
});
const slideUpOut = new Keyframe("antSlideUpOut", {
  "0%": {
    transform: "scaleY(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleY(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  }
});
const slideDownIn = new Keyframe("antSlideDownIn", {
  "0%": {
    transform: "scaleY(0.8)",
    transformOrigin: "100% 100%",
    opacity: 0
  },
  "100%": {
    transform: "scaleY(1)",
    transformOrigin: "100% 100%",
    opacity: 1
  }
});
const slideDownOut = new Keyframe("antSlideDownOut", {
  "0%": {
    transform: "scaleY(1)",
    transformOrigin: "100% 100%",
    opacity: 1
  },
  "100%": {
    transform: "scaleY(0.8)",
    transformOrigin: "100% 100%",
    opacity: 0
  }
});
const slideLeftIn = new Keyframe("antSlideLeftIn", {
  "0%": {
    transform: "scaleX(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleX(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  }
});
const slideLeftOut = new Keyframe("antSlideLeftOut", {
  "0%": {
    transform: "scaleX(1)",
    transformOrigin: "0% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleX(0.8)",
    transformOrigin: "0% 0%",
    opacity: 0
  }
});
const slideRightIn = new Keyframe("antSlideRightIn", {
  "0%": {
    transform: "scaleX(0.8)",
    transformOrigin: "100% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scaleX(1)",
    transformOrigin: "100% 0%",
    opacity: 1
  }
});
const slideRightOut = new Keyframe("antSlideRightOut", {
  "0%": {
    transform: "scaleX(1)",
    transformOrigin: "100% 0%",
    opacity: 1
  },
  "100%": {
    transform: "scaleX(0.8)",
    transformOrigin: "100% 0%",
    opacity: 0
  }
});
const slideMotion = {
  "slide-up": {
    inKeyframes: slideUpIn,
    outKeyframes: slideUpOut
  },
  "slide-down": {
    inKeyframes: slideDownIn,
    outKeyframes: slideDownOut
  },
  "slide-left": {
    inKeyframes: slideLeftIn,
    outKeyframes: slideLeftOut
  },
  "slide-right": {
    inKeyframes: slideRightIn,
    outKeyframes: slideRightOut
  }
};
const initSlideMotion = (token2, motionName) => {
  const {
    antCls
  } = token2;
  const motionCls = `${antCls}-${motionName}`;
  const {
    inKeyframes,
    outKeyframes
  } = slideMotion[motionName];
  return [initMotion(motionCls, inKeyframes, outKeyframes, token2.motionDurationMid), {
    [`
      ${motionCls}-enter,
      ${motionCls}-appear
    `]: {
      transform: "scale(0)",
      transformOrigin: "0% 0%",
      opacity: 0,
      animationTimingFunction: token2.motionEaseOutQuint,
      "&-prepare": {
        transform: "scale(1)"
      }
    },
    [`${motionCls}-leave`]: {
      animationTimingFunction: token2.motionEaseInQuint
    }
  }];
};
const zoomIn = new Keyframe("antZoomIn", {
  "0%": {
    transform: "scale(0.2)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    opacity: 1
  }
});
const zoomOut = new Keyframe("antZoomOut", {
  "0%": {
    transform: "scale(1)"
  },
  "100%": {
    transform: "scale(0.2)",
    opacity: 0
  }
});
const zoomBigIn = new Keyframe("antZoomBigIn", {
  "0%": {
    transform: "scale(0.8)",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    opacity: 1
  }
});
const zoomBigOut = new Keyframe("antZoomBigOut", {
  "0%": {
    transform: "scale(1)"
  },
  "100%": {
    transform: "scale(0.8)",
    opacity: 0
  }
});
const zoomUpIn = new Keyframe("antZoomUpIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 0%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "50% 0%"
  }
});
const zoomUpOut = new Keyframe("antZoomUpOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "50% 0%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 0%",
    opacity: 0
  }
});
const zoomLeftIn = new Keyframe("antZoomLeftIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "0% 50%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "0% 50%"
  }
});
const zoomLeftOut = new Keyframe("antZoomLeftOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "0% 50%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "0% 50%",
    opacity: 0
  }
});
const zoomRightIn = new Keyframe("antZoomRightIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "100% 50%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "100% 50%"
  }
});
const zoomRightOut = new Keyframe("antZoomRightOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "100% 50%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "100% 50%",
    opacity: 0
  }
});
const zoomDownIn = new Keyframe("antZoomDownIn", {
  "0%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 100%",
    opacity: 0
  },
  "100%": {
    transform: "scale(1)",
    transformOrigin: "50% 100%"
  }
});
const zoomDownOut = new Keyframe("antZoomDownOut", {
  "0%": {
    transform: "scale(1)",
    transformOrigin: "50% 100%"
  },
  "100%": {
    transform: "scale(0.8)",
    transformOrigin: "50% 100%",
    opacity: 0
  }
});
const zoomMotion = {
  zoom: {
    inKeyframes: zoomIn,
    outKeyframes: zoomOut
  },
  "zoom-big": {
    inKeyframes: zoomBigIn,
    outKeyframes: zoomBigOut
  },
  "zoom-big-fast": {
    inKeyframes: zoomBigIn,
    outKeyframes: zoomBigOut
  },
  "zoom-left": {
    inKeyframes: zoomLeftIn,
    outKeyframes: zoomLeftOut
  },
  "zoom-right": {
    inKeyframes: zoomRightIn,
    outKeyframes: zoomRightOut
  },
  "zoom-up": {
    inKeyframes: zoomUpIn,
    outKeyframes: zoomUpOut
  },
  "zoom-down": {
    inKeyframes: zoomDownIn,
    outKeyframes: zoomDownOut
  }
};
const initZoomMotion = (token2, motionName) => {
  const {
    antCls
  } = token2;
  const motionCls = `${antCls}-${motionName}`;
  const {
    inKeyframes,
    outKeyframes
  } = zoomMotion[motionName];
  return [initMotion(motionCls, inKeyframes, outKeyframes, motionName === "zoom-big-fast" ? token2.motionDurationFast : token2.motionDurationMid), {
    [`
        ${motionCls}-enter,
        ${motionCls}-appear
      `]: {
      transform: "scale(0)",
      opacity: 0,
      animationTimingFunction: token2.motionEaseOutCirc,
      "&-prepare": {
        transform: "none"
      }
    },
    [`${motionCls}-leave`]: {
      animationTimingFunction: token2.motionEaseInOutCirc
    }
  }];
};
var OrderContext = /* @__PURE__ */ reactExports.createContext(null);
var EMPTY_LIST$1 = [];
function useDom(render3, debug) {
  var _React$useState = reactExports.useState(function() {
    if (!canUseDom$1()) {
      return null;
    }
    var defaultEle = document.createElement("div");
    return defaultEle;
  }), _React$useState2 = _slicedToArray(_React$useState, 1), ele = _React$useState2[0];
  var appendedRef = reactExports.useRef(false);
  var queueCreate = reactExports.useContext(OrderContext);
  var _React$useState3 = reactExports.useState(EMPTY_LIST$1), _React$useState4 = _slicedToArray(_React$useState3, 2), queue = _React$useState4[0], setQueue = _React$useState4[1];
  var mergedQueueCreate = queueCreate || (appendedRef.current ? void 0 : function(appendFn) {
    setQueue(function(origin2) {
      var newQueue = [appendFn].concat(_toConsumableArray(origin2));
      return newQueue;
    });
  });
  function append3() {
    if (!ele.parentElement) {
      document.body.appendChild(ele);
    }
    appendedRef.current = true;
  }
  function cleanup2() {
    var _ele$parentElement;
    (_ele$parentElement = ele.parentElement) === null || _ele$parentElement === void 0 ? void 0 : _ele$parentElement.removeChild(ele);
    appendedRef.current = false;
  }
  useLayoutEffect$1(function() {
    if (render3) {
      if (queueCreate) {
        queueCreate(append3);
      } else {
        append3();
      }
    } else {
      cleanup2();
    }
    return cleanup2;
  }, [render3]);
  useLayoutEffect$1(function() {
    if (queue.length) {
      queue.forEach(function(appendFn) {
        return appendFn();
      });
      setQueue(EMPTY_LIST$1);
    }
  }, [queue]);
  return [ele, mergedQueueCreate];
}
function measureScrollbarSize(ele) {
  var randomId = "rc-scrollbar-measure-".concat(Math.random().toString(36).substring(7));
  var measureEle = document.createElement("div");
  measureEle.id = randomId;
  var measureStyle = measureEle.style;
  measureStyle.position = "absolute";
  measureStyle.left = "0";
  measureStyle.top = "0";
  measureStyle.width = "100px";
  measureStyle.height = "100px";
  measureStyle.overflow = "scroll";
  var fallbackWidth;
  var fallbackHeight;
  if (ele) {
    var targetStyle = getComputedStyle(ele);
    measureStyle.scrollbarColor = targetStyle.scrollbarColor;
    measureStyle.scrollbarWidth = targetStyle.scrollbarWidth;
    var webkitScrollbarStyle = getComputedStyle(ele, "::-webkit-scrollbar");
    var width = parseInt(webkitScrollbarStyle.width, 10);
    var height = parseInt(webkitScrollbarStyle.height, 10);
    try {
      var widthStyle = width ? "width: ".concat(webkitScrollbarStyle.width, ";") : "";
      var heightStyle = height ? "height: ".concat(webkitScrollbarStyle.height, ";") : "";
      updateCSS("\n#".concat(randomId, "::-webkit-scrollbar {\n").concat(widthStyle, "\n").concat(heightStyle, "\n}"), randomId);
    } catch (e2) {
      console.error(e2);
      fallbackWidth = width;
      fallbackHeight = height;
    }
  }
  document.body.appendChild(measureEle);
  var scrollWidth = ele && fallbackWidth && !isNaN(fallbackWidth) ? fallbackWidth : measureEle.offsetWidth - measureEle.clientWidth;
  var scrollHeight = ele && fallbackHeight && !isNaN(fallbackHeight) ? fallbackHeight : measureEle.offsetHeight - measureEle.clientHeight;
  document.body.removeChild(measureEle);
  removeCSS(randomId);
  return {
    width: scrollWidth,
    height: scrollHeight
  };
}
function getTargetScrollBarSize(target) {
  if (typeof document === "undefined" || !target || !(target instanceof Element)) {
    return {
      width: 0,
      height: 0
    };
  }
  return measureScrollbarSize(target);
}
function isBodyOverflowing() {
  return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
}
var UNIQUE_ID = "rc-util-locker-".concat(Date.now());
var uuid$1 = 0;
function useScrollLocker(lock) {
  var mergedLock = !!lock;
  var _React$useState = reactExports.useState(function() {
    uuid$1 += 1;
    return "".concat(UNIQUE_ID, "_").concat(uuid$1);
  }), _React$useState2 = _slicedToArray(_React$useState, 1), id2 = _React$useState2[0];
  useLayoutEffect$1(function() {
    if (mergedLock) {
      var scrollbarSize2 = getTargetScrollBarSize(document.body).width;
      var isOverflow = isBodyOverflowing();
      updateCSS("\nhtml body {\n  overflow-y: hidden;\n  ".concat(isOverflow ? "width: calc(100% - ".concat(scrollbarSize2, "px);") : "", "\n}"), id2);
    } else {
      removeCSS(id2);
    }
    return function() {
      removeCSS(id2);
    };
  }, [mergedLock, id2]);
}
var inline = false;
function inlineMock(nextInline) {
  return inline;
}
var getPortalContainer = function getPortalContainer2(getContainer2) {
  if (getContainer2 === false) {
    return false;
  }
  if (!canUseDom$1() || !getContainer2) {
    return null;
  }
  if (typeof getContainer2 === "string") {
    return document.querySelector(getContainer2);
  }
  if (typeof getContainer2 === "function") {
    return getContainer2();
  }
  return getContainer2;
};
var Portal = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var open = props.open, autoLock = props.autoLock, getContainer2 = props.getContainer;
  props.debug;
  var _props$autoDestroy = props.autoDestroy, autoDestroy = _props$autoDestroy === void 0 ? true : _props$autoDestroy, children = props.children;
  var _React$useState = reactExports.useState(open), _React$useState2 = _slicedToArray(_React$useState, 2), shouldRender = _React$useState2[0], setShouldRender = _React$useState2[1];
  var mergedRender = shouldRender || open;
  reactExports.useEffect(function() {
    if (autoDestroy || open) {
      setShouldRender(open);
    }
  }, [open, autoDestroy]);
  var _React$useState3 = reactExports.useState(function() {
    return getPortalContainer(getContainer2);
  }), _React$useState4 = _slicedToArray(_React$useState3, 2), innerContainer = _React$useState4[0], setInnerContainer = _React$useState4[1];
  reactExports.useEffect(function() {
    var customizeContainer = getPortalContainer(getContainer2);
    setInnerContainer(customizeContainer !== null && customizeContainer !== void 0 ? customizeContainer : null);
  });
  var _useDom = useDom(mergedRender && !innerContainer), _useDom2 = _slicedToArray(_useDom, 2), defaultContainer = _useDom2[0], queueCreate = _useDom2[1];
  var mergedContainer = innerContainer !== null && innerContainer !== void 0 ? innerContainer : defaultContainer;
  useScrollLocker(autoLock && open && canUseDom$1() && (mergedContainer === defaultContainer || mergedContainer === document.body));
  var childRef = null;
  if (children && supportRef(children) && ref) {
    var _ref = children;
    childRef = _ref.ref;
  }
  var mergedRef = useComposeRef(childRef, ref);
  if (!mergedRender || !canUseDom$1() || innerContainer === void 0) {
    return null;
  }
  var renderInline = mergedContainer === false || inlineMock();
  var reffedChildren = children;
  if (ref) {
    reffedChildren = /* @__PURE__ */ reactExports.cloneElement(children, {
      ref: mergedRef
    });
  }
  return /* @__PURE__ */ reactExports.createElement(OrderContext.Provider, {
    value: queueCreate
  }, renderInline ? reffedChildren : /* @__PURE__ */ reactDomExports.createPortal(reffedChildren, mergedContainer));
});
function getUseId() {
  var fullClone2 = _objectSpread2({}, React$7);
  return fullClone2.useId;
}
var uuid = 0;
var useOriginId = getUseId();
const useId = useOriginId ? (
  // Use React `useId`
  function useId2(id2) {
    var reactId = useOriginId();
    if (id2) {
      return id2;
    }
    return reactId;
  }
) : (
  // Use compatible of `useId`
  function useCompatId(id2) {
    var _React$useState = reactExports.useState("ssr-id"), _React$useState2 = _slicedToArray(_React$useState, 2), innerId = _React$useState2[0], setInnerId = _React$useState2[1];
    reactExports.useEffect(function() {
      var nextId = uuid;
      uuid += 1;
      setInnerId("rc_unique_".concat(nextId));
    }, []);
    if (id2) {
      return id2;
    }
    return innerId;
  }
);
var HOOK_MARK = "RC_FORM_INTERNAL_HOOKS";
var warningFunc = function warningFunc2() {
  warningOnce(false, "Can not find FormContext. Please make sure you wrap Field under Form.");
};
var Context$1 = /* @__PURE__ */ reactExports.createContext({
  getFieldValue: warningFunc,
  getFieldsValue: warningFunc,
  getFieldError: warningFunc,
  getFieldWarning: warningFunc,
  getFieldsError: warningFunc,
  isFieldsTouched: warningFunc,
  isFieldTouched: warningFunc,
  isFieldValidating: warningFunc,
  isFieldsValidating: warningFunc,
  resetFields: warningFunc,
  setFields: warningFunc,
  setFieldValue: warningFunc,
  setFieldsValue: warningFunc,
  validateFields: warningFunc,
  submit: warningFunc,
  getInternalHooks: function getInternalHooks() {
    warningFunc();
    return {
      dispatch: warningFunc,
      initEntityValue: warningFunc,
      registerField: warningFunc,
      useSubscribe: warningFunc,
      setInitialValues: warningFunc,
      destroyForm: warningFunc,
      setCallbacks: warningFunc,
      registerWatch: warningFunc,
      getFields: warningFunc,
      setValidateMessages: warningFunc,
      setPreserve: warningFunc,
      getInitialValue: warningFunc
    };
  }
});
var ListContext = /* @__PURE__ */ reactExports.createContext(null);
function toArray$3(value2) {
  if (value2 === void 0 || value2 === null) {
    return [];
  }
  return Array.isArray(value2) ? value2 : [value2];
}
function isFormInstance(form2) {
  return form2 && !!form2._init;
}
function newMessages() {
  return {
    default: "Validation error on field %s",
    required: "%s is required",
    enum: "%s must be one of %s",
    whitespace: "%s cannot be empty",
    date: {
      format: "%s date %s is invalid for format %s",
      parse: "%s date could not be parsed, %s is invalid ",
      invalid: "%s date %s is invalid"
    },
    types: {
      string: "%s is not a %s",
      method: "%s is not a %s (function)",
      array: "%s is not an %s",
      object: "%s is not an %s",
      number: "%s is not a %s",
      date: "%s is not a %s",
      boolean: "%s is not a %s",
      integer: "%s is not an %s",
      float: "%s is not a %s",
      regexp: "%s is not a valid %s",
      email: "%s is not a valid %s",
      url: "%s is not a valid %s",
      hex: "%s is not a valid %s"
    },
    string: {
      len: "%s must be exactly %s characters",
      min: "%s must be at least %s characters",
      max: "%s cannot be longer than %s characters",
      range: "%s must be between %s and %s characters"
    },
    number: {
      len: "%s must equal %s",
      min: "%s cannot be less than %s",
      max: "%s cannot be greater than %s",
      range: "%s must be between %s and %s"
    },
    array: {
      len: "%s must be exactly %s in length",
      min: "%s cannot be less than %s in length",
      max: "%s cannot be greater than %s in length",
      range: "%s must be between %s and %s in length"
    },
    pattern: {
      mismatch: "%s value %s does not match pattern %s"
    },
    clone: function clone3() {
      var cloned = JSON.parse(JSON.stringify(this));
      cloned.clone = this.clone;
      return cloned;
    }
  };
}
var messages = newMessages();
function _isNativeFunction(t2) {
  try {
    return -1 !== Function.toString.call(t2).indexOf("[native code]");
  } catch (n2) {
    return "function" == typeof t2;
  }
}
function _construct(t2, e2, r2) {
  if (_isNativeReflectConstruct$g())
    return Reflect.construct.apply(null, arguments);
  var o2 = [null];
  o2.push.apply(o2, e2);
  var p2 = new (t2.bind.apply(t2, o2))();
  return r2 && _setPrototypeOf(p2, r2.prototype), p2;
}
function _wrapNativeSuper(t2) {
  var r2 = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
  return _wrapNativeSuper = function _wrapNativeSuper2(t3) {
    if (null === t3 || !_isNativeFunction(t3))
      return t3;
    if ("function" != typeof t3)
      throw new TypeError("Super expression must either be null or a function");
    if (void 0 !== r2) {
      if (r2.has(t3))
        return r2.get(t3);
      r2.set(t3, Wrapper);
    }
    function Wrapper() {
      return _construct(t3, arguments, _getPrototypeOf(this).constructor);
    }
    return Wrapper.prototype = Object.create(t3.prototype, {
      constructor: {
        value: Wrapper,
        enumerable: false,
        writable: true,
        configurable: true
      }
    }), _setPrototypeOf(Wrapper, t3);
  }, _wrapNativeSuper(t2);
}
var formatRegExp = /%[sdj%]/g;
var warning = function warning2() {
};
function convertFieldsError(errors) {
  if (!errors || !errors.length)
    return null;
  var fields = {};
  errors.forEach(function(error2) {
    var field = error2.field;
    fields[field] = fields[field] || [];
    fields[field].push(error2);
  });
  return fields;
}
function format$1(template2) {
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }
  var i2 = 0;
  var len = args.length;
  if (typeof template2 === "function") {
    return template2.apply(null, args);
  }
  if (typeof template2 === "string") {
    var str = template2.replace(formatRegExp, function(x2) {
      if (x2 === "%%") {
        return "%";
      }
      if (i2 >= len) {
        return x2;
      }
      switch (x2) {
        case "%s":
          return String(args[i2++]);
        case "%d":
          return Number(args[i2++]);
        case "%j":
          try {
            return JSON.stringify(args[i2++]);
          } catch (_24) {
            return "[Circular]";
          }
          break;
        default:
          return x2;
      }
    });
    return str;
  }
  return template2;
}
function isNativeStringType(type4) {
  return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
}
function isEmptyValue(value2, type4) {
  if (value2 === void 0 || value2 === null) {
    return true;
  }
  if (type4 === "array" && Array.isArray(value2) && !value2.length) {
    return true;
  }
  if (isNativeStringType(type4) && typeof value2 === "string" && !value2) {
    return true;
  }
  return false;
}
function asyncParallelArray(arr, func, callback2) {
  var results = [];
  var total = 0;
  var arrLength = arr.length;
  function count(errors) {
    results.push.apply(results, _toConsumableArray(errors || []));
    total++;
    if (total === arrLength) {
      callback2(results);
    }
  }
  arr.forEach(function(a2) {
    func(a2, count);
  });
}
function asyncSerialArray(arr, func, callback2) {
  var index2 = 0;
  var arrLength = arr.length;
  function next2(errors) {
    if (errors && errors.length) {
      callback2(errors);
      return;
    }
    var original = index2;
    index2 = index2 + 1;
    if (original < arrLength) {
      func(arr[original], next2);
    } else {
      callback2([]);
    }
  }
  next2([]);
}
function flattenObjArr(objArr) {
  var ret = [];
  Object.keys(objArr).forEach(function(k2) {
    ret.push.apply(ret, _toConsumableArray(objArr[k2] || []));
  });
  return ret;
}
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  _inherits$a(AsyncValidationError2, _Error);
  var _super = _createSuper$4(AsyncValidationError2);
  function AsyncValidationError2(errors, fields) {
    var _this;
    _classCallCheck$a(this, AsyncValidationError2);
    _this = _super.call(this, "Async Validation Error");
    _defineProperty$4(_assertThisInitialized(_this), "errors", void 0);
    _defineProperty$4(_assertThisInitialized(_this), "fields", void 0);
    _this.errors = errors;
    _this.fields = fields;
    return _this;
  }
  return _createClass$8(AsyncValidationError2);
}(/* @__PURE__ */ _wrapNativeSuper(Error));
function asyncMap(objArr, option, func, callback2, source2) {
  if (option.first) {
    var _pending = new Promise(function(resolve2, reject) {
      var next2 = function next22(errors) {
        callback2(errors);
        return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve2(source2);
      };
      var flattenArr = flattenObjArr(objArr);
      asyncSerialArray(flattenArr, func, next2);
    });
    _pending.catch(function(e2) {
      return e2;
    });
    return _pending;
  }
  var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  var objArrKeys = Object.keys(objArr);
  var objArrLength = objArrKeys.length;
  var total = 0;
  var results = [];
  var pending = new Promise(function(resolve2, reject) {
    var next2 = function next22(errors) {
      results.push.apply(results, errors);
      total++;
      if (total === objArrLength) {
        callback2(results);
        return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve2(source2);
      }
    };
    if (!objArrKeys.length) {
      callback2(results);
      resolve2(source2);
    }
    objArrKeys.forEach(function(key) {
      var arr = objArr[key];
      if (firstFields.indexOf(key) !== -1) {
        asyncSerialArray(arr, func, next2);
      } else {
        asyncParallelArray(arr, func, next2);
      }
    });
  });
  pending.catch(function(e2) {
    return e2;
  });
  return pending;
}
function isErrorObj(obj) {
  return !!(obj && obj.message !== void 0);
}
function getValue$4(value2, path) {
  var v2 = value2;
  for (var i2 = 0; i2 < path.length; i2++) {
    if (v2 == void 0) {
      return v2;
    }
    v2 = v2[path[i2]];
  }
  return v2;
}
function complementError(rule, source2) {
  return function(oe2) {
    var fieldValue;
    if (rule.fullFields) {
      fieldValue = getValue$4(source2, rule.fullFields);
    } else {
      fieldValue = source2[oe2.field || rule.fullField];
    }
    if (isErrorObj(oe2)) {
      oe2.field = oe2.field || rule.fullField;
      oe2.fieldValue = fieldValue;
      return oe2;
    }
    return {
      message: typeof oe2 === "function" ? oe2() : oe2,
      fieldValue,
      field: oe2.field || rule.fullField
    };
  };
}
function deepMerge(target, source2) {
  if (source2) {
    for (var s2 in source2) {
      if (source2.hasOwnProperty(s2)) {
        var value2 = source2[s2];
        if (_typeof$2(value2) === "object" && _typeof$2(target[s2]) === "object") {
          target[s2] = _objectSpread2(_objectSpread2({}, target[s2]), value2);
        } else {
          target[s2] = value2;
        }
      }
    }
  }
  return target;
}
var ENUM$1 = "enum";
var enumerable$1 = function enumerable(rule, value2, source2, errors, options) {
  rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  if (rule[ENUM$1].indexOf(value2) === -1) {
    errors.push(format$1(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  }
};
var pattern$2 = function pattern(rule, value2, source2, errors, options) {
  if (rule.pattern) {
    if (rule.pattern instanceof RegExp) {
      rule.pattern.lastIndex = 0;
      if (!rule.pattern.test(value2)) {
        errors.push(format$1(options.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
      }
    } else if (typeof rule.pattern === "string") {
      var _pattern = new RegExp(rule.pattern);
      if (!_pattern.test(value2)) {
        errors.push(format$1(options.messages.pattern.mismatch, rule.fullField, value2, rule.pattern));
      }
    }
  }
};
var range = function range2(rule, value2, source2, errors, options) {
  var len = typeof rule.len === "number";
  var min2 = typeof rule.min === "number";
  var max2 = typeof rule.max === "number";
  var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  var val = value2;
  var key = null;
  var num = typeof value2 === "number";
  var str = typeof value2 === "string";
  var arr = Array.isArray(value2);
  if (num) {
    key = "number";
  } else if (str) {
    key = "string";
  } else if (arr) {
    key = "array";
  }
  if (!key) {
    return false;
  }
  if (arr) {
    val = value2.length;
  }
  if (str) {
    val = value2.replace(spRegexp, "_").length;
  }
  if (len) {
    if (val !== rule.len) {
      errors.push(format$1(options.messages[key].len, rule.fullField, rule.len));
    }
  } else if (min2 && !max2 && val < rule.min) {
    errors.push(format$1(options.messages[key].min, rule.fullField, rule.min));
  } else if (max2 && !min2 && val > rule.max) {
    errors.push(format$1(options.messages[key].max, rule.fullField, rule.max));
  } else if (min2 && max2 && (val < rule.min || val > rule.max)) {
    errors.push(format$1(options.messages[key].range, rule.fullField, rule.min, rule.max));
  }
};
var required$1 = function required(rule, value2, source2, errors, options, type4) {
  if (rule.required && (!source2.hasOwnProperty(rule.field) || isEmptyValue(value2, type4 || rule.type))) {
    errors.push(format$1(options.messages.required, rule.fullField));
  }
};
var urlReg;
const getUrlRegex = function() {
  if (urlReg) {
    return urlReg;
  }
  var word = "[a-fA-F\\d:]";
  var b2 = function b3(options) {
    return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=".concat(word, ")|(?<=").concat(word, ")(?=\\s|$))") : "";
  };
  var v42 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  var v6seg = "[a-fA-F\\d]{1,4}";
  var v6List = [
    "(?:".concat(v6seg, ":){7}(?:").concat(v6seg, "|:)"),
    // 1:2:3:4:5:6:7::  1:2:3:4:5:6:7:8
    "(?:".concat(v6seg, ":){6}(?:").concat(v42, "|:").concat(v6seg, "|:)"),
    // 1:2:3:4:5:6::    1:2:3:4:5:6::8   1:2:3:4:5:6::8  1:2:3:4:5:6::
    "(?:".concat(v6seg, ":){5}(?::").concat(v42, "|(?::").concat(v6seg, "){1,2}|:)"),
    // 1:2:3:4:5::      1:2:3:4:5::7:8   1:2:3:4:5::8    1:2:3:4:5::
    "(?:".concat(v6seg, ":){4}(?:(?::").concat(v6seg, "){0,1}:").concat(v42, "|(?::").concat(v6seg, "){1,3}|:)"),
    // 1:2:3:4::        1:2:3:4::6:7:8   1:2:3:4::8      1:2:3:4::
    "(?:".concat(v6seg, ":){3}(?:(?::").concat(v6seg, "){0,2}:").concat(v42, "|(?::").concat(v6seg, "){1,4}|:)"),
    // 1:2:3::          1:2:3::5:6:7:8   1:2:3::8        1:2:3::
    "(?:".concat(v6seg, ":){2}(?:(?::").concat(v6seg, "){0,3}:").concat(v42, "|(?::").concat(v6seg, "){1,5}|:)"),
    // 1:2::            1:2::4:5:6:7:8   1:2::8          1:2::
    "(?:".concat(v6seg, ":){1}(?:(?::").concat(v6seg, "){0,4}:").concat(v42, "|(?::").concat(v6seg, "){1,6}|:)"),
    // 1::              1::3:4:5:6:7:8   1::8            1::
    "(?::(?:(?::".concat(v6seg, "){0,5}:").concat(v42, "|(?::").concat(v6seg, "){1,7}|:))")
    // ::2:3:4:5:6:7:8  ::2:3:4:5:6:7:8  ::8             ::
  ];
  var v6Eth0 = "(?:%[0-9a-zA-Z]{1,})?";
  var v6 = "(?:".concat(v6List.join("|"), ")").concat(v6Eth0);
  var v46Exact = new RegExp("(?:^".concat(v42, "$)|(?:^").concat(v6, "$)"));
  var v4exact = new RegExp("^".concat(v42, "$"));
  var v6exact = new RegExp("^".concat(v6, "$"));
  var ip = function ip2(options) {
    return options && options.exact ? v46Exact : new RegExp("(?:".concat(b2(options)).concat(v42).concat(b2(options), ")|(?:").concat(b2(options)).concat(v6).concat(b2(options), ")"), "g");
  };
  ip.v4 = function(options) {
    return options && options.exact ? v4exact : new RegExp("".concat(b2(options)).concat(v42).concat(b2(options)), "g");
  };
  ip.v6 = function(options) {
    return options && options.exact ? v6exact : new RegExp("".concat(b2(options)).concat(v6).concat(b2(options)), "g");
  };
  var protocol = "(?:(?:[a-z]+:)?//)";
  var auth = "(?:\\S+(?::\\S*)?@)?";
  var ipv4 = ip.v4().source;
  var ipv6 = ip.v6().source;
  var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  var port = "(?::\\d{2,5})?";
  var path = '(?:[/?#][^\\s"]*)?';
  var regex2 = "(?:".concat(protocol, "|www\\.)").concat(auth, "(?:localhost|").concat(ipv4, "|").concat(ipv6, "|").concat(host).concat(domain).concat(tld, ")").concat(port).concat(path);
  urlReg = new RegExp("(?:^".concat(regex2, "$)"), "i");
  return urlReg;
};
var pattern$1 = {
  // http://emailregex.com/
  email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  // url: new RegExp(
  //   '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
  //   'i',
  // ),
  hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
};
var types$1 = {
  integer: function integer(value2) {
    return types$1.number(value2) && parseInt(value2, 10) === value2;
  },
  float: function float(value2) {
    return types$1.number(value2) && !types$1.integer(value2);
  },
  array: function array(value2) {
    return Array.isArray(value2);
  },
  regexp: function regexp(value2) {
    if (value2 instanceof RegExp) {
      return true;
    }
    try {
      return !!new RegExp(value2);
    } catch (e2) {
      return false;
    }
  },
  date: function date(value2) {
    return typeof value2.getTime === "function" && typeof value2.getMonth === "function" && typeof value2.getYear === "function" && !isNaN(value2.getTime());
  },
  number: function number(value2) {
    if (isNaN(value2)) {
      return false;
    }
    return typeof value2 === "number";
  },
  object: function object(value2) {
    return _typeof$2(value2) === "object" && !types$1.array(value2);
  },
  method: function method(value2) {
    return typeof value2 === "function";
  },
  email: function email(value2) {
    return typeof value2 === "string" && value2.length <= 320 && !!value2.match(pattern$1.email);
  },
  url: function url(value2) {
    return typeof value2 === "string" && value2.length <= 2048 && !!value2.match(getUrlRegex());
  },
  hex: function hex(value2) {
    return typeof value2 === "string" && !!value2.match(pattern$1.hex);
  }
};
var type$2 = function type(rule, value2, source2, errors, options) {
  if (rule.required && value2 === void 0) {
    required$1(rule, value2, source2, errors, options);
    return;
  }
  var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  var ruleType = rule.type;
  if (custom.indexOf(ruleType) > -1) {
    if (!types$1[ruleType](value2)) {
      errors.push(format$1(options.messages.types[ruleType], rule.fullField, rule.type));
    }
  } else if (ruleType && _typeof$2(value2) !== rule.type) {
    errors.push(format$1(options.messages.types[ruleType], rule.fullField, rule.type));
  }
};
var whitespace$1 = function whitespace(rule, value2, source2, errors, options) {
  if (/^\s+$/.test(value2) || value2 === "") {
    errors.push(format$1(options.messages.whitespace, rule.fullField));
  }
};
const rules = {
  required: required$1,
  whitespace: whitespace$1,
  type: type$2,
  range,
  enum: enumerable$1,
  pattern: pattern$2
};
var any = function any2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
  }
  callback2(errors);
};
var array2 = function array3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if ((value2 === void 0 || value2 === null) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, "array");
    if (value2 !== void 0 && value2 !== null) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var boolean$1 = function boolean(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var date2 = function date3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "date") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2, "date")) {
      var dateObject;
      if (value2 instanceof Date) {
        dateObject = value2;
      } else {
        dateObject = new Date(value2);
      }
      rules.type(rule, dateObject, source2, errors, options);
      if (dateObject) {
        rules.range(rule, dateObject.getTime(), source2, errors, options);
      }
    }
  }
  callback2(errors);
};
var ENUM = "enum";
var enumerable2 = function enumerable3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules[ENUM](rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var floatFn = function floatFn2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var integer2 = function integer3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var method2 = function method3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var number$1 = function number2(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (value2 === "") {
      value2 = void 0;
    }
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var object2 = function object3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (value2 !== void 0) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var pattern2 = function pattern3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "string") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2, "string")) {
      rules.pattern(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var regexp2 = function regexp3(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options);
    if (!isEmptyValue(value2)) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
var required2 = function required3(rule, value2, callback2, source2, options) {
  var errors = [];
  var type4 = Array.isArray(value2) ? "array" : _typeof$2(value2);
  rules.required(rule, value2, source2, errors, options, type4);
  callback2(errors);
};
var string$2 = function string(rule, value2, callback2, source2, options) {
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, "string") && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, "string");
    if (!isEmptyValue(value2, "string")) {
      rules.type(rule, value2, source2, errors, options);
      rules.range(rule, value2, source2, errors, options);
      rules.pattern(rule, value2, source2, errors, options);
      if (rule.whitespace === true) {
        rules.whitespace(rule, value2, source2, errors, options);
      }
    }
  }
  callback2(errors);
};
var type$1 = function type2(rule, value2, callback2, source2, options) {
  var ruleType = rule.type;
  var errors = [];
  var validate2 = rule.required || !rule.required && source2.hasOwnProperty(rule.field);
  if (validate2) {
    if (isEmptyValue(value2, ruleType) && !rule.required) {
      return callback2();
    }
    rules.required(rule, value2, source2, errors, options, ruleType);
    if (!isEmptyValue(value2, ruleType)) {
      rules.type(rule, value2, source2, errors, options);
    }
  }
  callback2(errors);
};
const validators$2 = {
  string: string$2,
  method: method2,
  number: number$1,
  boolean: boolean$1,
  regexp: regexp2,
  integer: integer2,
  float: floatFn,
  array: array2,
  object: object2,
  enum: enumerable2,
  pattern: pattern2,
  date: date2,
  url: type$1,
  hex: type$1,
  email: type$1,
  required: required2,
  any
};
var Schema$1 = /* @__PURE__ */ function() {
  function Schema2(descriptor) {
    _classCallCheck$a(this, Schema2);
    _defineProperty$4(this, "rules", null);
    _defineProperty$4(this, "_messages", messages);
    this.define(descriptor);
  }
  _createClass$8(Schema2, [{
    key: "define",
    value: function define(rules2) {
      var _this = this;
      if (!rules2) {
        throw new Error("Cannot configure a schema with no rules");
      }
      if (_typeof$2(rules2) !== "object" || Array.isArray(rules2)) {
        throw new Error("Rules must be an object");
      }
      this.rules = {};
      Object.keys(rules2).forEach(function(name2) {
        var item = rules2[name2];
        _this.rules[name2] = Array.isArray(item) ? item : [item];
      });
    }
  }, {
    key: "messages",
    value: function messages2(_messages) {
      if (_messages) {
        this._messages = deepMerge(newMessages(), _messages);
      }
      return this._messages;
    }
  }, {
    key: "validate",
    value: function validate2(source_) {
      var _this2 = this;
      var o2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var oc2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
      };
      var source2 = source_;
      var options = o2;
      var callback2 = oc2;
      if (typeof options === "function") {
        callback2 = options;
        options = {};
      }
      if (!this.rules || Object.keys(this.rules).length === 0) {
        if (callback2) {
          callback2(null, source2);
        }
        return Promise.resolve(source2);
      }
      function complete(results) {
        var errors = [];
        var fields = {};
        function add2(e2) {
          if (Array.isArray(e2)) {
            var _errors;
            errors = (_errors = errors).concat.apply(_errors, _toConsumableArray(e2));
          } else {
            errors.push(e2);
          }
        }
        for (var i2 = 0; i2 < results.length; i2++) {
          add2(results[i2]);
        }
        if (!errors.length) {
          callback2(null, source2);
        } else {
          fields = convertFieldsError(errors);
          callback2(errors, fields);
        }
      }
      if (options.messages) {
        var messages$1 = this.messages();
        if (messages$1 === messages) {
          messages$1 = newMessages();
        }
        deepMerge(messages$1, options.messages);
        options.messages = messages$1;
      } else {
        options.messages = this.messages();
      }
      var series = {};
      var keys2 = options.keys || Object.keys(this.rules);
      keys2.forEach(function(z2) {
        var arr = _this2.rules[z2];
        var value2 = source2[z2];
        arr.forEach(function(r2) {
          var rule = r2;
          if (typeof rule.transform === "function") {
            if (source2 === source_) {
              source2 = _objectSpread2({}, source2);
            }
            value2 = source2[z2] = rule.transform(value2);
            if (value2 !== void 0 && value2 !== null) {
              rule.type = rule.type || (Array.isArray(value2) ? "array" : _typeof$2(value2));
            }
          }
          if (typeof rule === "function") {
            rule = {
              validator: rule
            };
          } else {
            rule = _objectSpread2({}, rule);
          }
          rule.validator = _this2.getValidationMethod(rule);
          if (!rule.validator) {
            return;
          }
          rule.field = z2;
          rule.fullField = rule.fullField || z2;
          rule.type = _this2.getType(rule);
          series[z2] = series[z2] || [];
          series[z2].push({
            rule,
            value: value2,
            source: source2,
            field: z2
          });
        });
      });
      var errorFields = {};
      return asyncMap(series, options, function(data, doIt) {
        var rule = data.rule;
        var deep = (rule.type === "object" || rule.type === "array") && (_typeof$2(rule.fields) === "object" || _typeof$2(rule.defaultField) === "object");
        deep = deep && (rule.required || !rule.required && data.value);
        rule.field = data.field;
        function addFullField(key, schema) {
          return _objectSpread2(_objectSpread2({}, schema), {}, {
            fullField: "".concat(rule.fullField, ".").concat(key),
            fullFields: rule.fullFields ? [].concat(_toConsumableArray(rule.fullFields), [key]) : [key]
          });
        }
        function cb2() {
          var e2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
          var errorList = Array.isArray(e2) ? e2 : [e2];
          if (!options.suppressWarning && errorList.length) {
            Schema2.warning("async-validator:", errorList);
          }
          if (errorList.length && rule.message !== void 0) {
            errorList = [].concat(rule.message);
          }
          var filledErrors = errorList.map(complementError(rule, source2));
          if (options.first && filledErrors.length) {
            errorFields[rule.field] = 1;
            return doIt(filledErrors);
          }
          if (!deep) {
            doIt(filledErrors);
          } else {
            if (rule.required && !data.value) {
              if (rule.message !== void 0) {
                filledErrors = [].concat(rule.message).map(complementError(rule, source2));
              } else if (options.error) {
                filledErrors = [options.error(rule, format$1(options.messages.required, rule.field))];
              }
              return doIt(filledErrors);
            }
            var fieldsSchema = {};
            if (rule.defaultField) {
              Object.keys(data.value).map(function(key) {
                fieldsSchema[key] = rule.defaultField;
              });
            }
            fieldsSchema = _objectSpread2(_objectSpread2({}, fieldsSchema), data.rule.fields);
            var paredFieldsSchema = {};
            Object.keys(fieldsSchema).forEach(function(field) {
              var fieldSchema = fieldsSchema[field];
              var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
              paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
            });
            var schema = new Schema2(paredFieldsSchema);
            schema.messages(options.messages);
            if (data.rule.options) {
              data.rule.options.messages = options.messages;
              data.rule.options.error = options.error;
            }
            schema.validate(data.value, data.rule.options || options, function(errs) {
              var finalErrors = [];
              if (filledErrors && filledErrors.length) {
                finalErrors.push.apply(finalErrors, _toConsumableArray(filledErrors));
              }
              if (errs && errs.length) {
                finalErrors.push.apply(finalErrors, _toConsumableArray(errs));
              }
              doIt(finalErrors.length ? finalErrors : null);
            });
          }
        }
        var res;
        if (rule.asyncValidator) {
          res = rule.asyncValidator(rule, data.value, cb2, data.source, options);
        } else if (rule.validator) {
          try {
            res = rule.validator(rule, data.value, cb2, data.source, options);
          } catch (error2) {
            var _console$error, _console;
            (_console$error = (_console = console).error) === null || _console$error === void 0 || _console$error.call(_console, error2);
            if (!options.suppressValidatorError) {
              setTimeout(function() {
                throw error2;
              }, 0);
            }
            cb2(error2.message);
          }
          if (res === true) {
            cb2();
          } else if (res === false) {
            cb2(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || "".concat(rule.fullField || rule.field, " fails"));
          } else if (res instanceof Array) {
            cb2(res);
          } else if (res instanceof Error) {
            cb2(res.message);
          }
        }
        if (res && res.then) {
          res.then(function() {
            return cb2();
          }, function(e2) {
            return cb2(e2);
          });
        }
      }, function(results) {
        complete(results);
      }, source2);
    }
  }, {
    key: "getType",
    value: function getType(rule) {
      if (rule.type === void 0 && rule.pattern instanceof RegExp) {
        rule.type = "pattern";
      }
      if (typeof rule.validator !== "function" && rule.type && !validators$2.hasOwnProperty(rule.type)) {
        throw new Error(format$1("Unknown rule type %s", rule.type));
      }
      return rule.type || "string";
    }
  }, {
    key: "getValidationMethod",
    value: function getValidationMethod(rule) {
      if (typeof rule.validator === "function") {
        return rule.validator;
      }
      var keys2 = Object.keys(rule);
      var messageIndex = keys2.indexOf("message");
      if (messageIndex !== -1) {
        keys2.splice(messageIndex, 1);
      }
      if (keys2.length === 1 && keys2[0] === "required") {
        return validators$2.required;
      }
      return validators$2[this.getType(rule)] || void 0;
    }
  }]);
  return Schema2;
}();
_defineProperty$4(Schema$1, "register", function register(type4, validator2) {
  if (typeof validator2 !== "function") {
    throw new Error("Cannot register a validator by type, validator is not a function");
  }
  validators$2[type4] = validator2;
});
_defineProperty$4(Schema$1, "warning", warning);
_defineProperty$4(Schema$1, "messages", messages);
_defineProperty$4(Schema$1, "validators", validators$2);
var typeTemplate = "'${name}' is not a valid ${type}";
var defaultValidateMessages = {
  default: "Validation error on field '${name}'",
  required: "'${name}' is required",
  enum: "'${name}' must be one of [${enum}]",
  whitespace: "'${name}' cannot be empty",
  date: {
    format: "'${name}' is invalid for format date",
    parse: "'${name}' could not be parsed as date",
    invalid: "'${name}' is invalid date"
  },
  types: {
    string: typeTemplate,
    method: typeTemplate,
    array: typeTemplate,
    object: typeTemplate,
    number: typeTemplate,
    date: typeTemplate,
    boolean: typeTemplate,
    integer: typeTemplate,
    float: typeTemplate,
    regexp: typeTemplate,
    email: typeTemplate,
    url: typeTemplate,
    hex: typeTemplate
  },
  string: {
    len: "'${name}' must be exactly ${len} characters",
    min: "'${name}' must be at least ${min} characters",
    max: "'${name}' cannot be longer than ${max} characters",
    range: "'${name}' must be between ${min} and ${max} characters"
  },
  number: {
    len: "'${name}' must equal ${len}",
    min: "'${name}' cannot be less than ${min}",
    max: "'${name}' cannot be greater than ${max}",
    range: "'${name}' must be between ${min} and ${max}"
  },
  array: {
    len: "'${name}' must be exactly ${len} in length",
    min: "'${name}' cannot be less than ${min} in length",
    max: "'${name}' cannot be greater than ${max} in length",
    range: "'${name}' must be between ${min} and ${max} in length"
  },
  pattern: {
    mismatch: "'${name}' does not match pattern ${pattern}"
  }
};
var AsyncValidator = Schema$1;
function replaceMessage(template2, kv) {
  return template2.replace(/\\?\$\{\w+\}/g, function(str) {
    if (str.startsWith("\\")) {
      return str.slice(1);
    }
    var key = str.slice(2, -1);
    return kv[key];
  });
}
var CODE_LOGIC_ERROR = "CODE_LOGIC_ERROR";
function validateRule(_x, _x2, _x3, _x4, _x5) {
  return _validateRule.apply(this, arguments);
}
function _validateRule() {
  _validateRule = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(name2, value2, rule, options, messageVariables) {
    var cloneRule, originValidator, subRuleField, validator2, messages2, result, subResults, kv, fillVariableResult;
    return _regeneratorRuntime().wrap(function _callee2$(_context2) {
      while (1)
        switch (_context2.prev = _context2.next) {
          case 0:
            cloneRule = _objectSpread2({}, rule);
            delete cloneRule.ruleIndex;
            AsyncValidator.warning = function() {
              return void 0;
            };
            if (cloneRule.validator) {
              originValidator = cloneRule.validator;
              cloneRule.validator = function() {
                try {
                  return originValidator.apply(void 0, arguments);
                } catch (error2) {
                  console.error(error2);
                  return Promise.reject(CODE_LOGIC_ERROR);
                }
              };
            }
            subRuleField = null;
            if (cloneRule && cloneRule.type === "array" && cloneRule.defaultField) {
              subRuleField = cloneRule.defaultField;
              delete cloneRule.defaultField;
            }
            validator2 = new AsyncValidator(_defineProperty$4({}, name2, [cloneRule]));
            messages2 = merge$5(defaultValidateMessages, options.validateMessages);
            validator2.messages(messages2);
            result = [];
            _context2.prev = 10;
            _context2.next = 13;
            return Promise.resolve(validator2.validate(_defineProperty$4({}, name2, value2), _objectSpread2({}, options)));
          case 13:
            _context2.next = 18;
            break;
          case 15:
            _context2.prev = 15;
            _context2.t0 = _context2["catch"](10);
            if (_context2.t0.errors) {
              result = _context2.t0.errors.map(function(_ref4, index2) {
                var message = _ref4.message;
                var mergedMessage = message === CODE_LOGIC_ERROR ? messages2.default : message;
                return /* @__PURE__ */ reactExports.isValidElement(mergedMessage) ? (
                  // Wrap ReactNode with `key`
                  /* @__PURE__ */ reactExports.cloneElement(mergedMessage, {
                    key: "error_".concat(index2)
                  })
                ) : mergedMessage;
              });
            }
          case 18:
            if (!(!result.length && subRuleField)) {
              _context2.next = 23;
              break;
            }
            _context2.next = 21;
            return Promise.all(value2.map(function(subValue, i2) {
              return validateRule("".concat(name2, ".").concat(i2), subValue, subRuleField, options, messageVariables);
            }));
          case 21:
            subResults = _context2.sent;
            return _context2.abrupt("return", subResults.reduce(function(prev2, errors) {
              return [].concat(_toConsumableArray(prev2), _toConsumableArray(errors));
            }, []));
          case 23:
            kv = _objectSpread2(_objectSpread2({}, rule), {}, {
              name: name2,
              enum: (rule.enum || []).join(", ")
            }, messageVariables);
            fillVariableResult = result.map(function(error2) {
              if (typeof error2 === "string") {
                return replaceMessage(error2, kv);
              }
              return error2;
            });
            return _context2.abrupt("return", fillVariableResult);
          case 26:
          case "end":
            return _context2.stop();
        }
    }, _callee2, null, [[10, 15]]);
  }));
  return _validateRule.apply(this, arguments);
}
function validateRules(namePath, value2, rules2, options, validateFirst, messageVariables) {
  var name2 = namePath.join(".");
  var filledRules = rules2.map(function(currentRule, ruleIndex) {
    var originValidatorFunc = currentRule.validator;
    var cloneRule = _objectSpread2(_objectSpread2({}, currentRule), {}, {
      ruleIndex
    });
    if (originValidatorFunc) {
      cloneRule.validator = function(rule, val, callback2) {
        var hasPromise = false;
        var wrappedCallback = function wrappedCallback2() {
          for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }
          Promise.resolve().then(function() {
            warningOnce(!hasPromise, "Your validator function has already return a promise. `callback` will be ignored.");
            if (!hasPromise) {
              callback2.apply(void 0, args);
            }
          });
        };
        var promise = originValidatorFunc(rule, val, wrappedCallback);
        hasPromise = promise && typeof promise.then === "function" && typeof promise.catch === "function";
        warningOnce(hasPromise, "`callback` is deprecated. Please return a promise instead.");
        if (hasPromise) {
          promise.then(function() {
            callback2();
          }).catch(function(err) {
            callback2(err || " ");
          });
        }
      };
    }
    return cloneRule;
  }).sort(function(_ref, _ref2) {
    var w1 = _ref.warningOnly, i1 = _ref.ruleIndex;
    var w2 = _ref2.warningOnly, i2 = _ref2.ruleIndex;
    if (!!w1 === !!w2) {
      return i1 - i2;
    }
    if (w1) {
      return 1;
    }
    return -1;
  });
  var summaryPromise;
  if (validateFirst === true) {
    summaryPromise = new Promise(/* @__PURE__ */ function() {
      var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(resolve2, reject) {
        var i2, rule, errors;
        return _regeneratorRuntime().wrap(function _callee$(_context) {
          while (1)
            switch (_context.prev = _context.next) {
              case 0:
                i2 = 0;
              case 1:
                if (!(i2 < filledRules.length)) {
                  _context.next = 12;
                  break;
                }
                rule = filledRules[i2];
                _context.next = 5;
                return validateRule(name2, value2, rule, options, messageVariables);
              case 5:
                errors = _context.sent;
                if (!errors.length) {
                  _context.next = 9;
                  break;
                }
                reject([{
                  errors,
                  rule
                }]);
                return _context.abrupt("return");
              case 9:
                i2 += 1;
                _context.next = 1;
                break;
              case 12:
                resolve2([]);
              case 13:
              case "end":
                return _context.stop();
            }
        }, _callee);
      }));
      return function(_x6, _x7) {
        return _ref3.apply(this, arguments);
      };
    }());
  } else {
    var rulePromises = filledRules.map(function(rule) {
      return validateRule(name2, value2, rule, options, messageVariables).then(function(errors) {
        return {
          errors,
          rule
        };
      });
    });
    summaryPromise = (validateFirst ? finishOnFirstFailed(rulePromises) : finishOnAllFailed(rulePromises)).then(function(errors) {
      return Promise.reject(errors);
    });
  }
  summaryPromise.catch(function(e2) {
    return e2;
  });
  return summaryPromise;
}
function finishOnAllFailed(_x8) {
  return _finishOnAllFailed.apply(this, arguments);
}
function _finishOnAllFailed() {
  _finishOnAllFailed = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(rulePromises) {
    return _regeneratorRuntime().wrap(function _callee3$(_context3) {
      while (1)
        switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", Promise.all(rulePromises).then(function(errorsList) {
              var _ref5;
              var errors = (_ref5 = []).concat.apply(_ref5, _toConsumableArray(errorsList));
              return errors;
            }));
          case 1:
          case "end":
            return _context3.stop();
        }
    }, _callee3);
  }));
  return _finishOnAllFailed.apply(this, arguments);
}
function finishOnFirstFailed(_x9) {
  return _finishOnFirstFailed.apply(this, arguments);
}
function _finishOnFirstFailed() {
  _finishOnFirstFailed = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(rulePromises) {
    var count;
    return _regeneratorRuntime().wrap(function _callee4$(_context4) {
      while (1)
        switch (_context4.prev = _context4.next) {
          case 0:
            count = 0;
            return _context4.abrupt("return", new Promise(function(resolve2) {
              rulePromises.forEach(function(promise) {
                promise.then(function(ruleError) {
                  if (ruleError.errors.length) {
                    resolve2([ruleError]);
                  }
                  count += 1;
                  if (count === rulePromises.length) {
                    resolve2([]);
                  }
                });
              });
            }));
          case 2:
          case "end":
            return _context4.stop();
        }
    }, _callee4);
  }));
  return _finishOnFirstFailed.apply(this, arguments);
}
function getNamePath(path) {
  return toArray$3(path);
}
function cloneByNamePathList(store, namePathList) {
  var newStore = {};
  namePathList.forEach(function(namePath) {
    var value2 = get$8(store, namePath);
    newStore = set$3(newStore, namePath, value2);
  });
  return newStore;
}
function containsNamePath(namePathList, namePath) {
  var partialMatch = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  return namePathList && namePathList.some(function(path) {
    return matchNamePath(namePath, path, partialMatch);
  });
}
function matchNamePath(namePath, subNamePath) {
  var partialMatch = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
  if (!namePath || !subNamePath) {
    return false;
  }
  if (!partialMatch && namePath.length !== subNamePath.length) {
    return false;
  }
  return subNamePath.every(function(nameUnit, i2) {
    return namePath[i2] === nameUnit;
  });
}
function isSimilar(source2, target) {
  if (source2 === target) {
    return true;
  }
  if (!source2 && target || source2 && !target) {
    return false;
  }
  if (!source2 || !target || _typeof$2(source2) !== "object" || _typeof$2(target) !== "object") {
    return false;
  }
  var sourceKeys = Object.keys(source2);
  var targetKeys = Object.keys(target);
  var keys2 = new Set([].concat(sourceKeys, targetKeys));
  return _toConsumableArray(keys2).every(function(key) {
    var sourceValue = source2[key];
    var targetValue = target[key];
    if (typeof sourceValue === "function" && typeof targetValue === "function") {
      return true;
    }
    return sourceValue === targetValue;
  });
}
function defaultGetValueFromEvent(valuePropName) {
  var event = arguments.length <= 1 ? void 0 : arguments[1];
  if (event && event.target && _typeof$2(event.target) === "object" && valuePropName in event.target) {
    return event.target[valuePropName];
  }
  return event;
}
function move(array4, moveIndex, toIndex) {
  var length2 = array4.length;
  if (moveIndex < 0 || moveIndex >= length2 || toIndex < 0 || toIndex >= length2) {
    return array4;
  }
  var item = array4[moveIndex];
  var diff2 = moveIndex - toIndex;
  if (diff2 > 0) {
    return [].concat(_toConsumableArray(array4.slice(0, toIndex)), [item], _toConsumableArray(array4.slice(toIndex, moveIndex)), _toConsumableArray(array4.slice(moveIndex + 1, length2)));
  }
  if (diff2 < 0) {
    return [].concat(_toConsumableArray(array4.slice(0, moveIndex)), _toConsumableArray(array4.slice(moveIndex + 1, toIndex + 1)), [item], _toConsumableArray(array4.slice(toIndex + 1, length2)));
  }
  return array4;
}
var _excluded$u = ["name"];
var EMPTY_ERRORS = [];
function requireUpdate(shouldUpdate, prev2, next2, prevValue, nextValue, info) {
  if (typeof shouldUpdate === "function") {
    return shouldUpdate(prev2, next2, "source" in info ? {
      source: info.source
    } : {});
  }
  return prevValue !== nextValue;
}
var Field = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(Field2, _React$Component);
  var _super = _createSuper$4(Field2);
  function Field2(props) {
    var _this;
    _classCallCheck$a(this, Field2);
    _this = _super.call(this, props);
    _defineProperty$4(_assertThisInitialized(_this), "state", {
      resetCount: 0
    });
    _defineProperty$4(_assertThisInitialized(_this), "cancelRegisterFunc", null);
    _defineProperty$4(_assertThisInitialized(_this), "mounted", false);
    _defineProperty$4(_assertThisInitialized(_this), "touched", false);
    _defineProperty$4(_assertThisInitialized(_this), "dirty", false);
    _defineProperty$4(_assertThisInitialized(_this), "validatePromise", void 0);
    _defineProperty$4(_assertThisInitialized(_this), "prevValidating", void 0);
    _defineProperty$4(_assertThisInitialized(_this), "errors", EMPTY_ERRORS);
    _defineProperty$4(_assertThisInitialized(_this), "warnings", EMPTY_ERRORS);
    _defineProperty$4(_assertThisInitialized(_this), "cancelRegister", function() {
      var _this$props = _this.props, preserve2 = _this$props.preserve, isListField = _this$props.isListField, name2 = _this$props.name;
      if (_this.cancelRegisterFunc) {
        _this.cancelRegisterFunc(isListField, preserve2, getNamePath(name2));
      }
      _this.cancelRegisterFunc = null;
    });
    _defineProperty$4(_assertThisInitialized(_this), "getNamePath", function() {
      var _this$props2 = _this.props, name2 = _this$props2.name, fieldContext = _this$props2.fieldContext;
      var _fieldContext$prefixN = fieldContext.prefixName, prefixName = _fieldContext$prefixN === void 0 ? [] : _fieldContext$prefixN;
      return name2 !== void 0 ? [].concat(_toConsumableArray(prefixName), _toConsumableArray(name2)) : [];
    });
    _defineProperty$4(_assertThisInitialized(_this), "getRules", function() {
      var _this$props3 = _this.props, _this$props3$rules = _this$props3.rules, rules2 = _this$props3$rules === void 0 ? [] : _this$props3$rules, fieldContext = _this$props3.fieldContext;
      return rules2.map(function(rule) {
        if (typeof rule === "function") {
          return rule(fieldContext);
        }
        return rule;
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "refresh", function() {
      if (!_this.mounted)
        return;
      _this.setState(function(_ref) {
        var resetCount = _ref.resetCount;
        return {
          resetCount: resetCount + 1
        };
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "metaCache", null);
    _defineProperty$4(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy) {
      var onMetaChange = _this.props.onMetaChange;
      if (onMetaChange) {
        var _meta = _objectSpread2(_objectSpread2({}, _this.getMeta()), {}, {
          destroy
        });
        if (!isEqual$2(_this.metaCache, _meta)) {
          onMetaChange(_meta);
        }
        _this.metaCache = _meta;
      } else {
        _this.metaCache = null;
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "onStoreChange", function(prevStore, namePathList, info) {
      var _this$props4 = _this.props, shouldUpdate = _this$props4.shouldUpdate, _this$props4$dependen = _this$props4.dependencies, dependencies = _this$props4$dependen === void 0 ? [] : _this$props4$dependen, onReset = _this$props4.onReset;
      var store = info.store;
      var namePath = _this.getNamePath();
      var prevValue = _this.getValue(prevStore);
      var curValue = _this.getValue(store);
      var namePathMatch = namePathList && containsNamePath(namePathList, namePath);
      if (info.type === "valueUpdate" && info.source === "external" && !isEqual$2(prevValue, curValue)) {
        _this.touched = true;
        _this.dirty = true;
        _this.validatePromise = null;
        _this.errors = EMPTY_ERRORS;
        _this.warnings = EMPTY_ERRORS;
        _this.triggerMetaEvent();
      }
      switch (info.type) {
        case "reset":
          if (!namePathList || namePathMatch) {
            _this.touched = false;
            _this.dirty = false;
            _this.validatePromise = void 0;
            _this.errors = EMPTY_ERRORS;
            _this.warnings = EMPTY_ERRORS;
            _this.triggerMetaEvent();
            onReset === null || onReset === void 0 || onReset();
            _this.refresh();
            return;
          }
          break;
        case "remove": {
          if (shouldUpdate && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
            _this.reRender();
            return;
          }
          break;
        }
        case "setField": {
          var data = info.data;
          if (namePathMatch) {
            if ("touched" in data) {
              _this.touched = data.touched;
            }
            if ("validating" in data && !("originRCField" in data)) {
              _this.validatePromise = data.validating ? Promise.resolve([]) : null;
            }
            if ("errors" in data) {
              _this.errors = data.errors || EMPTY_ERRORS;
            }
            if ("warnings" in data) {
              _this.warnings = data.warnings || EMPTY_ERRORS;
            }
            _this.dirty = true;
            _this.triggerMetaEvent();
            _this.reRender();
            return;
          } else if ("value" in data && containsNamePath(namePathList, namePath, true)) {
            _this.reRender();
            return;
          }
          if (shouldUpdate && !namePath.length && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
            _this.reRender();
            return;
          }
          break;
        }
        case "dependenciesUpdate": {
          var dependencyList = dependencies.map(getNamePath);
          if (dependencyList.some(function(dependency) {
            return containsNamePath(info.relatedFields, dependency);
          })) {
            _this.reRender();
            return;
          }
          break;
        }
        default:
          if (namePathMatch || (!dependencies.length || namePath.length || shouldUpdate) && requireUpdate(shouldUpdate, prevStore, store, prevValue, curValue, info)) {
            _this.reRender();
            return;
          }
          break;
      }
      if (shouldUpdate === true) {
        _this.reRender();
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "validateRules", function(options) {
      var namePath = _this.getNamePath();
      var currentValue = _this.getValue();
      var _ref2 = options || {}, triggerName = _ref2.triggerName, _ref2$validateOnly = _ref2.validateOnly, validateOnly = _ref2$validateOnly === void 0 ? false : _ref2$validateOnly;
      var rootPromise = Promise.resolve().then(/* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee() {
        var _this$props5, _this$props5$validate, validateFirst, messageVariables, validateDebounce, filteredRules, promise;
        return _regeneratorRuntime().wrap(function _callee$(_context) {
          while (1)
            switch (_context.prev = _context.next) {
              case 0:
                if (_this.mounted) {
                  _context.next = 2;
                  break;
                }
                return _context.abrupt("return", []);
              case 2:
                _this$props5 = _this.props, _this$props5$validate = _this$props5.validateFirst, validateFirst = _this$props5$validate === void 0 ? false : _this$props5$validate, messageVariables = _this$props5.messageVariables, validateDebounce = _this$props5.validateDebounce;
                filteredRules = _this.getRules();
                if (triggerName) {
                  filteredRules = filteredRules.filter(function(rule) {
                    return rule;
                  }).filter(function(rule) {
                    var validateTrigger = rule.validateTrigger;
                    if (!validateTrigger) {
                      return true;
                    }
                    var triggerList = toArray$3(validateTrigger);
                    return triggerList.includes(triggerName);
                  });
                }
                if (!(validateDebounce && triggerName)) {
                  _context.next = 10;
                  break;
                }
                _context.next = 8;
                return new Promise(function(resolve2) {
                  setTimeout(resolve2, validateDebounce);
                });
              case 8:
                if (!(_this.validatePromise !== rootPromise)) {
                  _context.next = 10;
                  break;
                }
                return _context.abrupt("return", []);
              case 10:
                promise = validateRules(namePath, currentValue, filteredRules, options, validateFirst, messageVariables);
                promise.catch(function(e2) {
                  return e2;
                }).then(function() {
                  var ruleErrors = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : EMPTY_ERRORS;
                  if (_this.validatePromise === rootPromise) {
                    var _ruleErrors$forEach;
                    _this.validatePromise = null;
                    var nextErrors = [];
                    var nextWarnings = [];
                    (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function(_ref4) {
                      var warningOnly = _ref4.rule.warningOnly, _ref4$errors = _ref4.errors, errors = _ref4$errors === void 0 ? EMPTY_ERRORS : _ref4$errors;
                      if (warningOnly) {
                        nextWarnings.push.apply(nextWarnings, _toConsumableArray(errors));
                      } else {
                        nextErrors.push.apply(nextErrors, _toConsumableArray(errors));
                      }
                    });
                    _this.errors = nextErrors;
                    _this.warnings = nextWarnings;
                    _this.triggerMetaEvent();
                    _this.reRender();
                  }
                });
                return _context.abrupt("return", promise);
              case 13:
              case "end":
                return _context.stop();
            }
        }, _callee);
      })));
      if (validateOnly) {
        return rootPromise;
      }
      _this.validatePromise = rootPromise;
      _this.dirty = true;
      _this.errors = EMPTY_ERRORS;
      _this.warnings = EMPTY_ERRORS;
      _this.triggerMetaEvent();
      _this.reRender();
      return rootPromise;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isFieldValidating", function() {
      return !!_this.validatePromise;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isFieldTouched", function() {
      return _this.touched;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isFieldDirty", function() {
      if (_this.dirty || _this.props.initialValue !== void 0) {
        return true;
      }
      var fieldContext = _this.props.fieldContext;
      var _fieldContext$getInte = fieldContext.getInternalHooks(HOOK_MARK), getInitialValue = _fieldContext$getInte.getInitialValue;
      if (getInitialValue(_this.getNamePath()) !== void 0) {
        return true;
      }
      return false;
    });
    _defineProperty$4(_assertThisInitialized(_this), "getErrors", function() {
      return _this.errors;
    });
    _defineProperty$4(_assertThisInitialized(_this), "getWarnings", function() {
      return _this.warnings;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isListField", function() {
      return _this.props.isListField;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isList", function() {
      return _this.props.isList;
    });
    _defineProperty$4(_assertThisInitialized(_this), "isPreserve", function() {
      return _this.props.preserve;
    });
    _defineProperty$4(_assertThisInitialized(_this), "getMeta", function() {
      _this.prevValidating = _this.isFieldValidating();
      var meta = {
        touched: _this.isFieldTouched(),
        validating: _this.prevValidating,
        errors: _this.errors,
        warnings: _this.warnings,
        name: _this.getNamePath(),
        validated: _this.validatePromise === null
      };
      return meta;
    });
    _defineProperty$4(_assertThisInitialized(_this), "getOnlyChild", function(children) {
      if (typeof children === "function") {
        var _meta2 = _this.getMeta();
        return _objectSpread2(_objectSpread2({}, _this.getOnlyChild(children(_this.getControlled(), _meta2, _this.props.fieldContext))), {}, {
          isFunction: true
        });
      }
      var childList = toArray$4(children);
      if (childList.length !== 1 || !/* @__PURE__ */ reactExports.isValidElement(childList[0])) {
        return {
          child: childList,
          isFunction: false
        };
      }
      return {
        child: childList[0],
        isFunction: false
      };
    });
    _defineProperty$4(_assertThisInitialized(_this), "getValue", function(store) {
      var getFieldsValue = _this.props.fieldContext.getFieldsValue;
      var namePath = _this.getNamePath();
      return get$8(store || getFieldsValue(true), namePath);
    });
    _defineProperty$4(_assertThisInitialized(_this), "getControlled", function() {
      var childProps = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var _this$props6 = _this.props, name2 = _this$props6.name, trigger = _this$props6.trigger, validateTrigger = _this$props6.validateTrigger, getValueFromEvent = _this$props6.getValueFromEvent, normalize2 = _this$props6.normalize, valuePropName = _this$props6.valuePropName, getValueProps = _this$props6.getValueProps, fieldContext = _this$props6.fieldContext;
      var mergedValidateTrigger = validateTrigger !== void 0 ? validateTrigger : fieldContext.validateTrigger;
      var namePath = _this.getNamePath();
      var getInternalHooks22 = fieldContext.getInternalHooks, getFieldsValue = fieldContext.getFieldsValue;
      var _getInternalHooks = getInternalHooks22(HOOK_MARK), dispatch = _getInternalHooks.dispatch;
      var value2 = _this.getValue();
      var mergedGetValueProps = getValueProps || function(val) {
        return _defineProperty$4({}, valuePropName, val);
      };
      var originTriggerFunc = childProps[trigger];
      var valueProps = name2 !== void 0 ? mergedGetValueProps(value2) : {};
      var control = _objectSpread2(_objectSpread2({}, childProps), valueProps);
      control[trigger] = function() {
        _this.touched = true;
        _this.dirty = true;
        _this.triggerMetaEvent();
        var newValue;
        for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
        if (getValueFromEvent) {
          newValue = getValueFromEvent.apply(void 0, args);
        } else {
          newValue = defaultGetValueFromEvent.apply(void 0, [valuePropName].concat(args));
        }
        if (normalize2) {
          newValue = normalize2(newValue, value2, getFieldsValue(true));
        }
        if (newValue !== value2) {
          dispatch({
            type: "updateValue",
            namePath,
            value: newValue
          });
        }
        if (originTriggerFunc) {
          originTriggerFunc.apply(void 0, args);
        }
      };
      var validateTriggerList = toArray$3(mergedValidateTrigger || []);
      validateTriggerList.forEach(function(triggerName) {
        var originTrigger = control[triggerName];
        control[triggerName] = function() {
          if (originTrigger) {
            originTrigger.apply(void 0, arguments);
          }
          var rules2 = _this.props.rules;
          if (rules2 && rules2.length) {
            dispatch({
              type: "validateField",
              namePath,
              triggerName
            });
          }
        };
      });
      return control;
    });
    if (props.fieldContext) {
      var getInternalHooks2 = props.fieldContext.getInternalHooks;
      var _getInternalHooks2 = getInternalHooks2(HOOK_MARK), initEntityValue = _getInternalHooks2.initEntityValue;
      initEntityValue(_assertThisInitialized(_this));
    }
    return _this;
  }
  _createClass$8(Field2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props7 = this.props, shouldUpdate = _this$props7.shouldUpdate, fieldContext = _this$props7.fieldContext;
      this.mounted = true;
      if (fieldContext) {
        var getInternalHooks2 = fieldContext.getInternalHooks;
        var _getInternalHooks3 = getInternalHooks2(HOOK_MARK), registerField = _getInternalHooks3.registerField;
        this.cancelRegisterFunc = registerField(this);
      }
      if (shouldUpdate === true) {
        this.reRender();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.cancelRegister();
      this.triggerMetaEvent(true);
      this.mounted = false;
    }
  }, {
    key: "reRender",
    value: function reRender() {
      if (!this.mounted)
        return;
      this.forceUpdate();
    }
  }, {
    key: "render",
    value: function render3() {
      var resetCount = this.state.resetCount;
      var children = this.props.children;
      var _this$getOnlyChild = this.getOnlyChild(children), child = _this$getOnlyChild.child, isFunction2 = _this$getOnlyChild.isFunction;
      var returnChildNode;
      if (isFunction2) {
        returnChildNode = child;
      } else if (/* @__PURE__ */ reactExports.isValidElement(child)) {
        returnChildNode = /* @__PURE__ */ reactExports.cloneElement(child, this.getControlled(child.props));
      } else {
        warningOnce(!child, "`children` of Field is not validate ReactElement.");
        returnChildNode = child;
      }
      return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, {
        key: resetCount
      }, returnChildNode);
    }
  }]);
  return Field2;
}(reactExports.Component);
_defineProperty$4(Field, "contextType", Context$1);
_defineProperty$4(Field, "defaultProps", {
  trigger: "onChange",
  valuePropName: "value"
});
function WrapperField(_ref6) {
  var _restProps$isListFiel;
  var name2 = _ref6.name, restProps = _objectWithoutProperties$3(_ref6, _excluded$u);
  var fieldContext = reactExports.useContext(Context$1);
  var listContext = reactExports.useContext(ListContext);
  var namePath = name2 !== void 0 ? getNamePath(name2) : void 0;
  var isMergedListField = (_restProps$isListFiel = restProps.isListField) !== null && _restProps$isListFiel !== void 0 ? _restProps$isListFiel : !!listContext;
  var key = "keep";
  if (!isMergedListField) {
    key = "_".concat((namePath || []).join("_"));
  }
  return /* @__PURE__ */ reactExports.createElement(Field, _extends$j({
    key,
    name: namePath,
    isListField: isMergedListField
  }, restProps, {
    fieldContext
  }));
}
function List$2(_ref) {
  var name2 = _ref.name, initialValue = _ref.initialValue, children = _ref.children, rules2 = _ref.rules, validateTrigger = _ref.validateTrigger, isListField = _ref.isListField;
  var context = reactExports.useContext(Context$1);
  var wrapperListContext = reactExports.useContext(ListContext);
  var keyRef = reactExports.useRef({
    keys: [],
    id: 0
  });
  var keyManager = keyRef.current;
  var prefixName = reactExports.useMemo(function() {
    var parentPrefixName = getNamePath(context.prefixName) || [];
    return [].concat(_toConsumableArray(parentPrefixName), _toConsumableArray(getNamePath(name2)));
  }, [context.prefixName, name2]);
  var fieldContext = reactExports.useMemo(function() {
    return _objectSpread2(_objectSpread2({}, context), {}, {
      prefixName
    });
  }, [context, prefixName]);
  var listContext = reactExports.useMemo(function() {
    return {
      getKey: function getKey3(namePath) {
        var len = prefixName.length;
        var pathName = namePath[len];
        return [keyManager.keys[pathName], namePath.slice(len + 1)];
      }
    };
  }, [prefixName]);
  if (typeof children !== "function") {
    warningOnce(false, "Form.List only accepts function as children.");
    return null;
  }
  var shouldUpdate = function shouldUpdate2(prevValue, nextValue, _ref2) {
    var source2 = _ref2.source;
    if (source2 === "internal") {
      return false;
    }
    return prevValue !== nextValue;
  };
  return /* @__PURE__ */ reactExports.createElement(ListContext.Provider, {
    value: listContext
  }, /* @__PURE__ */ reactExports.createElement(Context$1.Provider, {
    value: fieldContext
  }, /* @__PURE__ */ reactExports.createElement(WrapperField, {
    name: [],
    shouldUpdate,
    rules: rules2,
    validateTrigger,
    initialValue,
    isList: true,
    isListField: isListField !== null && isListField !== void 0 ? isListField : !!wrapperListContext
  }, function(_ref3, meta) {
    var _ref3$value = _ref3.value, value2 = _ref3$value === void 0 ? [] : _ref3$value, onChange = _ref3.onChange;
    var getFieldValue = context.getFieldValue;
    var getNewValue = function getNewValue2() {
      var values = getFieldValue(prefixName || []);
      return values || [];
    };
    var operations = {
      add: function add2(defaultValue2, index2) {
        var newValue = getNewValue();
        if (index2 >= 0 && index2 <= newValue.length) {
          keyManager.keys = [].concat(_toConsumableArray(keyManager.keys.slice(0, index2)), [keyManager.id], _toConsumableArray(keyManager.keys.slice(index2)));
          onChange([].concat(_toConsumableArray(newValue.slice(0, index2)), [defaultValue2], _toConsumableArray(newValue.slice(index2))));
        } else {
          keyManager.keys = [].concat(_toConsumableArray(keyManager.keys), [keyManager.id]);
          onChange([].concat(_toConsumableArray(newValue), [defaultValue2]));
        }
        keyManager.id += 1;
      },
      remove: function remove(index2) {
        var newValue = getNewValue();
        var indexSet = new Set(Array.isArray(index2) ? index2 : [index2]);
        if (indexSet.size <= 0) {
          return;
        }
        keyManager.keys = keyManager.keys.filter(function(_24, keysIndex) {
          return !indexSet.has(keysIndex);
        });
        onChange(newValue.filter(function(_24, valueIndex) {
          return !indexSet.has(valueIndex);
        }));
      },
      move: function move$1(from2, to2) {
        if (from2 === to2) {
          return;
        }
        var newValue = getNewValue();
        if (from2 < 0 || from2 >= newValue.length || to2 < 0 || to2 >= newValue.length) {
          return;
        }
        keyManager.keys = move(keyManager.keys, from2, to2);
        onChange(move(newValue, from2, to2));
      }
    };
    var listValue = value2 || [];
    if (!Array.isArray(listValue)) {
      listValue = [];
    }
    return children(listValue.map(function(__, index2) {
      var key = keyManager.keys[index2];
      if (key === void 0) {
        keyManager.keys[index2] = keyManager.id;
        key = keyManager.keys[index2];
        keyManager.id += 1;
      }
      return {
        name: index2,
        key,
        isListField: true
      };
    }), operations, meta);
  })));
}
function allPromiseFinish(promiseList) {
  var hasError = false;
  var count = promiseList.length;
  var results = [];
  if (!promiseList.length) {
    return Promise.resolve([]);
  }
  return new Promise(function(resolve2, reject) {
    promiseList.forEach(function(promise, index2) {
      promise.catch(function(e2) {
        hasError = true;
        return e2;
      }).then(function(result) {
        count -= 1;
        results[index2] = result;
        if (count > 0) {
          return;
        }
        if (hasError) {
          reject(results);
        }
        resolve2(results);
      });
    });
  });
}
var SPLIT = "__@field_split__";
function normalize$2(namePath) {
  return namePath.map(function(cell) {
    return "".concat(_typeof$2(cell), ":").concat(cell);
  }).join(SPLIT);
}
var NameMap = /* @__PURE__ */ function() {
  function NameMap2() {
    _classCallCheck$a(this, NameMap2);
    _defineProperty$4(this, "kvs", /* @__PURE__ */ new Map());
  }
  _createClass$8(NameMap2, [{
    key: "set",
    value: function set2(key, value2) {
      this.kvs.set(normalize$2(key), value2);
    }
  }, {
    key: "get",
    value: function get5(key) {
      return this.kvs.get(normalize$2(key));
    }
  }, {
    key: "update",
    value: function update(key, updater) {
      var origin2 = this.get(key);
      var next2 = updater(origin2);
      if (!next2) {
        this.delete(key);
      } else {
        this.set(key, next2);
      }
    }
  }, {
    key: "delete",
    value: function _delete(key) {
      this.kvs.delete(normalize$2(key));
    }
    // Since we only use this in test, let simply realize this
  }, {
    key: "map",
    value: function map2(callback2) {
      return _toConsumableArray(this.kvs.entries()).map(function(_ref) {
        var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value2 = _ref2[1];
        var cells = key.split(SPLIT);
        return callback2({
          key: cells.map(function(cell) {
            var _cell$match = cell.match(/^([^:]*):(.*)$/), _cell$match2 = _slicedToArray(_cell$match, 3), type4 = _cell$match2[1], unit2 = _cell$match2[2];
            return type4 === "number" ? Number(unit2) : unit2;
          }),
          value: value2
        });
      });
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      var json = {};
      this.map(function(_ref3) {
        var key = _ref3.key, value2 = _ref3.value;
        json[key.join(".")] = value2;
        return null;
      });
      return json;
    }
  }]);
  return NameMap2;
}();
var _excluded$t = ["name"];
var FormStore = /* @__PURE__ */ _createClass$8(function FormStore2(forceRootUpdate) {
  var _this = this;
  _classCallCheck$a(this, FormStore2);
  _defineProperty$4(this, "formHooked", false);
  _defineProperty$4(this, "forceRootUpdate", void 0);
  _defineProperty$4(this, "subscribable", true);
  _defineProperty$4(this, "store", {});
  _defineProperty$4(this, "fieldEntities", []);
  _defineProperty$4(this, "initialValues", {});
  _defineProperty$4(this, "callbacks", {});
  _defineProperty$4(this, "validateMessages", null);
  _defineProperty$4(this, "preserve", null);
  _defineProperty$4(this, "lastValidatePromise", null);
  _defineProperty$4(this, "getForm", function() {
    return {
      getFieldValue: _this.getFieldValue,
      getFieldsValue: _this.getFieldsValue,
      getFieldError: _this.getFieldError,
      getFieldWarning: _this.getFieldWarning,
      getFieldsError: _this.getFieldsError,
      isFieldsTouched: _this.isFieldsTouched,
      isFieldTouched: _this.isFieldTouched,
      isFieldValidating: _this.isFieldValidating,
      isFieldsValidating: _this.isFieldsValidating,
      resetFields: _this.resetFields,
      setFields: _this.setFields,
      setFieldValue: _this.setFieldValue,
      setFieldsValue: _this.setFieldsValue,
      validateFields: _this.validateFields,
      submit: _this.submit,
      _init: true,
      getInternalHooks: _this.getInternalHooks
    };
  });
  _defineProperty$4(this, "getInternalHooks", function(key) {
    if (key === HOOK_MARK) {
      _this.formHooked = true;
      return {
        dispatch: _this.dispatch,
        initEntityValue: _this.initEntityValue,
        registerField: _this.registerField,
        useSubscribe: _this.useSubscribe,
        setInitialValues: _this.setInitialValues,
        destroyForm: _this.destroyForm,
        setCallbacks: _this.setCallbacks,
        setValidateMessages: _this.setValidateMessages,
        getFields: _this.getFields,
        setPreserve: _this.setPreserve,
        getInitialValue: _this.getInitialValue,
        registerWatch: _this.registerWatch
      };
    }
    warningOnce(false, "`getInternalHooks` is internal usage. Should not call directly.");
    return null;
  });
  _defineProperty$4(this, "useSubscribe", function(subscribable) {
    _this.subscribable = subscribable;
  });
  _defineProperty$4(this, "prevWithoutPreserves", null);
  _defineProperty$4(this, "setInitialValues", function(initialValues, init2) {
    _this.initialValues = initialValues || {};
    if (init2) {
      var _this$prevWithoutPres;
      var nextStore = merge$5(initialValues, _this.store);
      (_this$prevWithoutPres = _this.prevWithoutPreserves) === null || _this$prevWithoutPres === void 0 || _this$prevWithoutPres.map(function(_ref) {
        var namePath = _ref.key;
        nextStore = set$3(nextStore, namePath, get$8(initialValues, namePath));
      });
      _this.prevWithoutPreserves = null;
      _this.updateStore(nextStore);
    }
  });
  _defineProperty$4(this, "destroyForm", function(clearOnDestroy) {
    if (clearOnDestroy) {
      _this.updateStore({});
    } else {
      var prevWithoutPreserves = new NameMap();
      _this.getFieldEntities(true).forEach(function(entity) {
        if (!_this.isMergedPreserve(entity.isPreserve())) {
          prevWithoutPreserves.set(entity.getNamePath(), true);
        }
      });
      _this.prevWithoutPreserves = prevWithoutPreserves;
    }
  });
  _defineProperty$4(this, "getInitialValue", function(namePath) {
    var initValue = get$8(_this.initialValues, namePath);
    return namePath.length ? merge$5(initValue) : initValue;
  });
  _defineProperty$4(this, "setCallbacks", function(callbacks) {
    _this.callbacks = callbacks;
  });
  _defineProperty$4(this, "setValidateMessages", function(validateMessages) {
    _this.validateMessages = validateMessages;
  });
  _defineProperty$4(this, "setPreserve", function(preserve2) {
    _this.preserve = preserve2;
  });
  _defineProperty$4(this, "watchList", []);
  _defineProperty$4(this, "registerWatch", function(callback2) {
    _this.watchList.push(callback2);
    return function() {
      _this.watchList = _this.watchList.filter(function(fn) {
        return fn !== callback2;
      });
    };
  });
  _defineProperty$4(this, "notifyWatch", function() {
    var namePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
    if (_this.watchList.length) {
      var values = _this.getFieldsValue();
      var allValues = _this.getFieldsValue(true);
      _this.watchList.forEach(function(callback2) {
        callback2(values, allValues, namePath);
      });
    }
  });
  _defineProperty$4(this, "timeoutId", null);
  _defineProperty$4(this, "warningUnhooked", function() {
  });
  _defineProperty$4(this, "updateStore", function(nextStore) {
    _this.store = nextStore;
  });
  _defineProperty$4(this, "getFieldEntities", function() {
    var pure = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    if (!pure) {
      return _this.fieldEntities;
    }
    return _this.fieldEntities.filter(function(field) {
      return field.getNamePath().length;
    });
  });
  _defineProperty$4(this, "getFieldsMap", function() {
    var pure = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    var cache2 = new NameMap();
    _this.getFieldEntities(pure).forEach(function(field) {
      var namePath = field.getNamePath();
      cache2.set(namePath, field);
    });
    return cache2;
  });
  _defineProperty$4(this, "getFieldEntitiesForNamePathList", function(nameList) {
    if (!nameList) {
      return _this.getFieldEntities(true);
    }
    var cache2 = _this.getFieldsMap(true);
    return nameList.map(function(name2) {
      var namePath = getNamePath(name2);
      return cache2.get(namePath) || {
        INVALIDATE_NAME_PATH: getNamePath(name2)
      };
    });
  });
  _defineProperty$4(this, "getFieldsValue", function(nameList, filterFunc) {
    _this.warningUnhooked();
    var mergedNameList;
    var mergedFilterFunc;
    var mergedStrict;
    if (nameList === true || Array.isArray(nameList)) {
      mergedNameList = nameList;
      mergedFilterFunc = filterFunc;
    } else if (nameList && _typeof$2(nameList) === "object") {
      mergedStrict = nameList.strict;
      mergedFilterFunc = nameList.filter;
    }
    if (mergedNameList === true && !mergedFilterFunc) {
      return _this.store;
    }
    var fieldEntities = _this.getFieldEntitiesForNamePathList(Array.isArray(mergedNameList) ? mergedNameList : null);
    var filteredNameList = [];
    fieldEntities.forEach(function(entity) {
      var _isListField, _ref3;
      var namePath = "INVALIDATE_NAME_PATH" in entity ? entity.INVALIDATE_NAME_PATH : entity.getNamePath();
      if (mergedStrict) {
        var _isList, _ref2;
        if ((_isList = (_ref2 = entity).isList) !== null && _isList !== void 0 && _isList.call(_ref2)) {
          return;
        }
      } else if (!mergedNameList && (_isListField = (_ref3 = entity).isListField) !== null && _isListField !== void 0 && _isListField.call(_ref3)) {
        return;
      }
      if (!mergedFilterFunc) {
        filteredNameList.push(namePath);
      } else {
        var meta = "getMeta" in entity ? entity.getMeta() : null;
        if (mergedFilterFunc(meta)) {
          filteredNameList.push(namePath);
        }
      }
    });
    return cloneByNamePathList(_this.store, filteredNameList.map(getNamePath));
  });
  _defineProperty$4(this, "getFieldValue", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    return get$8(_this.store, namePath);
  });
  _defineProperty$4(this, "getFieldsError", function(nameList) {
    _this.warningUnhooked();
    var fieldEntities = _this.getFieldEntitiesForNamePathList(nameList);
    return fieldEntities.map(function(entity, index2) {
      if (entity && !("INVALIDATE_NAME_PATH" in entity)) {
        return {
          name: entity.getNamePath(),
          errors: entity.getErrors(),
          warnings: entity.getWarnings()
        };
      }
      return {
        name: getNamePath(nameList[index2]),
        errors: [],
        warnings: []
      };
    });
  });
  _defineProperty$4(this, "getFieldError", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    var fieldError = _this.getFieldsError([namePath])[0];
    return fieldError.errors;
  });
  _defineProperty$4(this, "getFieldWarning", function(name2) {
    _this.warningUnhooked();
    var namePath = getNamePath(name2);
    var fieldError = _this.getFieldsError([namePath])[0];
    return fieldError.warnings;
  });
  _defineProperty$4(this, "isFieldsTouched", function() {
    _this.warningUnhooked();
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    var arg0 = args[0], arg1 = args[1];
    var namePathList;
    var isAllFieldsTouched = false;
    if (args.length === 0) {
      namePathList = null;
    } else if (args.length === 1) {
      if (Array.isArray(arg0)) {
        namePathList = arg0.map(getNamePath);
        isAllFieldsTouched = false;
      } else {
        namePathList = null;
        isAllFieldsTouched = arg0;
      }
    } else {
      namePathList = arg0.map(getNamePath);
      isAllFieldsTouched = arg1;
    }
    var fieldEntities = _this.getFieldEntities(true);
    var isFieldTouched = function isFieldTouched2(field) {
      return field.isFieldTouched();
    };
    if (!namePathList) {
      return isAllFieldsTouched ? fieldEntities.every(function(entity) {
        return isFieldTouched(entity) || entity.isList();
      }) : fieldEntities.some(isFieldTouched);
    }
    var map2 = new NameMap();
    namePathList.forEach(function(shortNamePath) {
      map2.set(shortNamePath, []);
    });
    fieldEntities.forEach(function(field) {
      var fieldNamePath = field.getNamePath();
      namePathList.forEach(function(shortNamePath) {
        if (shortNamePath.every(function(nameUnit, i2) {
          return fieldNamePath[i2] === nameUnit;
        })) {
          map2.update(shortNamePath, function(list2) {
            return [].concat(_toConsumableArray(list2), [field]);
          });
        }
      });
    });
    var isNamePathListTouched = function isNamePathListTouched2(entities) {
      return entities.some(isFieldTouched);
    };
    var namePathListEntities = map2.map(function(_ref4) {
      var value2 = _ref4.value;
      return value2;
    });
    return isAllFieldsTouched ? namePathListEntities.every(isNamePathListTouched) : namePathListEntities.some(isNamePathListTouched);
  });
  _defineProperty$4(this, "isFieldTouched", function(name2) {
    _this.warningUnhooked();
    return _this.isFieldsTouched([name2]);
  });
  _defineProperty$4(this, "isFieldsValidating", function(nameList) {
    _this.warningUnhooked();
    var fieldEntities = _this.getFieldEntities();
    if (!nameList) {
      return fieldEntities.some(function(testField) {
        return testField.isFieldValidating();
      });
    }
    var namePathList = nameList.map(getNamePath);
    return fieldEntities.some(function(testField) {
      var fieldNamePath = testField.getNamePath();
      return containsNamePath(namePathList, fieldNamePath) && testField.isFieldValidating();
    });
  });
  _defineProperty$4(this, "isFieldValidating", function(name2) {
    _this.warningUnhooked();
    return _this.isFieldsValidating([name2]);
  });
  _defineProperty$4(this, "resetWithFieldInitialValue", function() {
    var info = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    var cache2 = new NameMap();
    var fieldEntities = _this.getFieldEntities(true);
    fieldEntities.forEach(function(field) {
      var initialValue = field.props.initialValue;
      var namePath = field.getNamePath();
      if (initialValue !== void 0) {
        var records = cache2.get(namePath) || /* @__PURE__ */ new Set();
        records.add({
          entity: field,
          value: initialValue
        });
        cache2.set(namePath, records);
      }
    });
    var resetWithFields = function resetWithFields2(entities) {
      entities.forEach(function(field) {
        var initialValue = field.props.initialValue;
        if (initialValue !== void 0) {
          var namePath = field.getNamePath();
          var formInitialValue = _this.getInitialValue(namePath);
          if (formInitialValue !== void 0) {
            warningOnce(false, "Form already set 'initialValues' with path '".concat(namePath.join("."), "'. Field can not overwrite it."));
          } else {
            var records = cache2.get(namePath);
            if (records && records.size > 1) {
              warningOnce(false, "Multiple Field with path '".concat(namePath.join("."), "' set 'initialValue'. Can not decide which one to pick."));
            } else if (records) {
              var originValue = _this.getFieldValue(namePath);
              var isListField = field.isListField();
              if (!isListField && (!info.skipExist || originValue === void 0)) {
                _this.updateStore(set$3(_this.store, namePath, _toConsumableArray(records)[0].value));
              }
            }
          }
        }
      });
    };
    var requiredFieldEntities;
    if (info.entities) {
      requiredFieldEntities = info.entities;
    } else if (info.namePathList) {
      requiredFieldEntities = [];
      info.namePathList.forEach(function(namePath) {
        var records = cache2.get(namePath);
        if (records) {
          var _requiredFieldEntitie;
          (_requiredFieldEntitie = requiredFieldEntities).push.apply(_requiredFieldEntitie, _toConsumableArray(_toConsumableArray(records).map(function(r2) {
            return r2.entity;
          })));
        }
      });
    } else {
      requiredFieldEntities = fieldEntities;
    }
    resetWithFields(requiredFieldEntities);
  });
  _defineProperty$4(this, "resetFields", function(nameList) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    if (!nameList) {
      _this.updateStore(merge$5(_this.initialValues));
      _this.resetWithFieldInitialValue();
      _this.notifyObservers(prevStore, null, {
        type: "reset"
      });
      _this.notifyWatch();
      return;
    }
    var namePathList = nameList.map(getNamePath);
    namePathList.forEach(function(namePath) {
      var initialValue = _this.getInitialValue(namePath);
      _this.updateStore(set$3(_this.store, namePath, initialValue));
    });
    _this.resetWithFieldInitialValue({
      namePathList
    });
    _this.notifyObservers(prevStore, namePathList, {
      type: "reset"
    });
    _this.notifyWatch(namePathList);
  });
  _defineProperty$4(this, "setFields", function(fields) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    var namePathList = [];
    fields.forEach(function(fieldData) {
      var name2 = fieldData.name, data = _objectWithoutProperties$3(fieldData, _excluded$t);
      var namePath = getNamePath(name2);
      namePathList.push(namePath);
      if ("value" in data) {
        _this.updateStore(set$3(_this.store, namePath, data.value));
      }
      _this.notifyObservers(prevStore, [namePath], {
        type: "setField",
        data: fieldData
      });
    });
    _this.notifyWatch(namePathList);
  });
  _defineProperty$4(this, "getFields", function() {
    var entities = _this.getFieldEntities(true);
    var fields = entities.map(function(field) {
      var namePath = field.getNamePath();
      var meta = field.getMeta();
      var fieldData = _objectSpread2(_objectSpread2({}, meta), {}, {
        name: namePath,
        value: _this.getFieldValue(namePath)
      });
      Object.defineProperty(fieldData, "originRCField", {
        value: true
      });
      return fieldData;
    });
    return fields;
  });
  _defineProperty$4(this, "initEntityValue", function(entity) {
    var initialValue = entity.props.initialValue;
    if (initialValue !== void 0) {
      var namePath = entity.getNamePath();
      var prevValue = get$8(_this.store, namePath);
      if (prevValue === void 0) {
        _this.updateStore(set$3(_this.store, namePath, initialValue));
      }
    }
  });
  _defineProperty$4(this, "isMergedPreserve", function(fieldPreserve) {
    var mergedPreserve = fieldPreserve !== void 0 ? fieldPreserve : _this.preserve;
    return mergedPreserve !== null && mergedPreserve !== void 0 ? mergedPreserve : true;
  });
  _defineProperty$4(this, "registerField", function(entity) {
    _this.fieldEntities.push(entity);
    var namePath = entity.getNamePath();
    _this.notifyWatch([namePath]);
    if (entity.props.initialValue !== void 0) {
      var prevStore = _this.store;
      _this.resetWithFieldInitialValue({
        entities: [entity],
        skipExist: true
      });
      _this.notifyObservers(prevStore, [entity.getNamePath()], {
        type: "valueUpdate",
        source: "internal"
      });
    }
    return function(isListField, preserve2) {
      var subNamePath = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
      _this.fieldEntities = _this.fieldEntities.filter(function(item) {
        return item !== entity;
      });
      if (!_this.isMergedPreserve(preserve2) && (!isListField || subNamePath.length > 1)) {
        var defaultValue2 = isListField ? void 0 : _this.getInitialValue(namePath);
        if (namePath.length && _this.getFieldValue(namePath) !== defaultValue2 && _this.fieldEntities.every(function(field) {
          return (
            // Only reset when no namePath exist
            !matchNamePath(field.getNamePath(), namePath)
          );
        })) {
          var _prevStore = _this.store;
          _this.updateStore(set$3(_prevStore, namePath, defaultValue2, true));
          _this.notifyObservers(_prevStore, [namePath], {
            type: "remove"
          });
          _this.triggerDependenciesUpdate(_prevStore, namePath);
        }
      }
      _this.notifyWatch([namePath]);
    };
  });
  _defineProperty$4(this, "dispatch", function(action) {
    switch (action.type) {
      case "updateValue": {
        var namePath = action.namePath, value2 = action.value;
        _this.updateValue(namePath, value2);
        break;
      }
      case "validateField": {
        var _namePath = action.namePath, triggerName = action.triggerName;
        _this.validateFields([_namePath], {
          triggerName
        });
        break;
      }
    }
  });
  _defineProperty$4(this, "notifyObservers", function(prevStore, namePathList, info) {
    if (_this.subscribable) {
      var mergedInfo = _objectSpread2(_objectSpread2({}, info), {}, {
        store: _this.getFieldsValue(true)
      });
      _this.getFieldEntities().forEach(function(_ref5) {
        var onStoreChange = _ref5.onStoreChange;
        onStoreChange(prevStore, namePathList, mergedInfo);
      });
    } else {
      _this.forceRootUpdate();
    }
  });
  _defineProperty$4(this, "triggerDependenciesUpdate", function(prevStore, namePath) {
    var childrenFields = _this.getDependencyChildrenFields(namePath);
    if (childrenFields.length) {
      _this.validateFields(childrenFields);
    }
    _this.notifyObservers(prevStore, childrenFields, {
      type: "dependenciesUpdate",
      relatedFields: [namePath].concat(_toConsumableArray(childrenFields))
    });
    return childrenFields;
  });
  _defineProperty$4(this, "updateValue", function(name2, value2) {
    var namePath = getNamePath(name2);
    var prevStore = _this.store;
    _this.updateStore(set$3(_this.store, namePath, value2));
    _this.notifyObservers(prevStore, [namePath], {
      type: "valueUpdate",
      source: "internal"
    });
    _this.notifyWatch([namePath]);
    var childrenFields = _this.triggerDependenciesUpdate(prevStore, namePath);
    var onValuesChange = _this.callbacks.onValuesChange;
    if (onValuesChange) {
      var changedValues = cloneByNamePathList(_this.store, [namePath]);
      onValuesChange(changedValues, _this.getFieldsValue());
    }
    _this.triggerOnFieldsChange([namePath].concat(_toConsumableArray(childrenFields)));
  });
  _defineProperty$4(this, "setFieldsValue", function(store) {
    _this.warningUnhooked();
    var prevStore = _this.store;
    if (store) {
      var nextStore = merge$5(_this.store, store);
      _this.updateStore(nextStore);
    }
    _this.notifyObservers(prevStore, null, {
      type: "valueUpdate",
      source: "external"
    });
    _this.notifyWatch();
  });
  _defineProperty$4(this, "setFieldValue", function(name2, value2) {
    _this.setFields([{
      name: name2,
      value: value2,
      errors: [],
      warnings: []
    }]);
  });
  _defineProperty$4(this, "getDependencyChildrenFields", function(rootNamePath) {
    var children = /* @__PURE__ */ new Set();
    var childrenFields = [];
    var dependencies2fields = new NameMap();
    _this.getFieldEntities().forEach(function(field) {
      var dependencies = field.props.dependencies;
      (dependencies || []).forEach(function(dependency) {
        var dependencyNamePath = getNamePath(dependency);
        dependencies2fields.update(dependencyNamePath, function() {
          var fields = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : /* @__PURE__ */ new Set();
          fields.add(field);
          return fields;
        });
      });
    });
    var fillChildren = function fillChildren2(namePath) {
      var fields = dependencies2fields.get(namePath) || /* @__PURE__ */ new Set();
      fields.forEach(function(field) {
        if (!children.has(field)) {
          children.add(field);
          var fieldNamePath = field.getNamePath();
          if (field.isFieldDirty() && fieldNamePath.length) {
            childrenFields.push(fieldNamePath);
            fillChildren2(fieldNamePath);
          }
        }
      });
    };
    fillChildren(rootNamePath);
    return childrenFields;
  });
  _defineProperty$4(this, "triggerOnFieldsChange", function(namePathList, filedErrors) {
    var onFieldsChange = _this.callbacks.onFieldsChange;
    if (onFieldsChange) {
      var fields = _this.getFields();
      if (filedErrors) {
        var cache2 = new NameMap();
        filedErrors.forEach(function(_ref6) {
          var name2 = _ref6.name, errors = _ref6.errors;
          cache2.set(name2, errors);
        });
        fields.forEach(function(field) {
          field.errors = cache2.get(field.name) || field.errors;
        });
      }
      var changedFields = fields.filter(function(_ref7) {
        var fieldName = _ref7.name;
        return containsNamePath(namePathList, fieldName);
      });
      if (changedFields.length) {
        onFieldsChange(changedFields, fields);
      }
    }
  });
  _defineProperty$4(this, "validateFields", function(arg1, arg2) {
    _this.warningUnhooked();
    var nameList;
    var options;
    if (Array.isArray(arg1) || typeof arg1 === "string" || typeof arg2 === "string") {
      nameList = arg1;
      options = arg2;
    } else {
      options = arg1;
    }
    var provideNameList = !!nameList;
    var namePathList = provideNameList ? nameList.map(getNamePath) : [];
    var promiseList = [];
    var TMP_SPLIT = String(Date.now());
    var validateNamePathList = /* @__PURE__ */ new Set();
    var _ref8 = options || {}, recursive = _ref8.recursive, dirty = _ref8.dirty;
    _this.getFieldEntities(true).forEach(function(field) {
      if (!provideNameList) {
        namePathList.push(field.getNamePath());
      }
      if (!field.props.rules || !field.props.rules.length) {
        return;
      }
      if (dirty && !field.isFieldDirty()) {
        return;
      }
      var fieldNamePath = field.getNamePath();
      validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
      if (!provideNameList || containsNamePath(namePathList, fieldNamePath, recursive)) {
        var promise = field.validateRules(_objectSpread2({
          validateMessages: _objectSpread2(_objectSpread2({}, defaultValidateMessages), _this.validateMessages)
        }, options));
        promiseList.push(promise.then(function() {
          return {
            name: fieldNamePath,
            errors: [],
            warnings: []
          };
        }).catch(function(ruleErrors) {
          var _ruleErrors$forEach;
          var mergedErrors = [];
          var mergedWarnings = [];
          (_ruleErrors$forEach = ruleErrors.forEach) === null || _ruleErrors$forEach === void 0 || _ruleErrors$forEach.call(ruleErrors, function(_ref9) {
            var warningOnly = _ref9.rule.warningOnly, errors = _ref9.errors;
            if (warningOnly) {
              mergedWarnings.push.apply(mergedWarnings, _toConsumableArray(errors));
            } else {
              mergedErrors.push.apply(mergedErrors, _toConsumableArray(errors));
            }
          });
          if (mergedErrors.length) {
            return Promise.reject({
              name: fieldNamePath,
              errors: mergedErrors,
              warnings: mergedWarnings
            });
          }
          return {
            name: fieldNamePath,
            errors: mergedErrors,
            warnings: mergedWarnings
          };
        }));
      }
    });
    var summaryPromise = allPromiseFinish(promiseList);
    _this.lastValidatePromise = summaryPromise;
    summaryPromise.catch(function(results) {
      return results;
    }).then(function(results) {
      var resultNamePathList = results.map(function(_ref10) {
        var name2 = _ref10.name;
        return name2;
      });
      _this.notifyObservers(_this.store, resultNamePathList, {
        type: "validateFinish"
      });
      _this.triggerOnFieldsChange(resultNamePathList, results);
    });
    var returnPromise = summaryPromise.then(function() {
      if (_this.lastValidatePromise === summaryPromise) {
        return Promise.resolve(_this.getFieldsValue(namePathList));
      }
      return Promise.reject([]);
    }).catch(function(results) {
      var errorList = results.filter(function(result) {
        return result && result.errors.length;
      });
      return Promise.reject({
        values: _this.getFieldsValue(namePathList),
        errorFields: errorList,
        outOfDate: _this.lastValidatePromise !== summaryPromise
      });
    });
    returnPromise.catch(function(e2) {
      return e2;
    });
    var triggerNamePathList = namePathList.filter(function(namePath) {
      return validateNamePathList.has(namePath.join(TMP_SPLIT));
    });
    _this.triggerOnFieldsChange(triggerNamePathList);
    return returnPromise;
  });
  _defineProperty$4(this, "submit", function() {
    _this.warningUnhooked();
    _this.validateFields().then(function(values) {
      var onFinish = _this.callbacks.onFinish;
      if (onFinish) {
        try {
          onFinish(values);
        } catch (err) {
          console.error(err);
        }
      }
    }).catch(function(e2) {
      var onFinishFailed = _this.callbacks.onFinishFailed;
      if (onFinishFailed) {
        onFinishFailed(e2);
      }
    });
  });
  this.forceRootUpdate = forceRootUpdate;
});
function useForm(form2) {
  var formRef = reactExports.useRef();
  var _React$useState = reactExports.useState({}), _React$useState2 = _slicedToArray(_React$useState, 2), forceUpdate = _React$useState2[1];
  if (!formRef.current) {
    if (form2) {
      formRef.current = form2;
    } else {
      var forceReRender = function forceReRender2() {
        forceUpdate({});
      };
      var formStore = new FormStore(forceReRender);
      formRef.current = formStore.getForm();
    }
  }
  return [formRef.current];
}
var FormContext = /* @__PURE__ */ reactExports.createContext({
  triggerFormChange: function triggerFormChange() {
  },
  triggerFormFinish: function triggerFormFinish() {
  },
  registerForm: function registerForm() {
  },
  unregisterForm: function unregisterForm() {
  }
});
var FormProvider = function FormProvider2(_ref) {
  var validateMessages = _ref.validateMessages, onFormChange = _ref.onFormChange, onFormFinish = _ref.onFormFinish, children = _ref.children;
  var formContext = reactExports.useContext(FormContext);
  var formsRef = reactExports.useRef({});
  return /* @__PURE__ */ reactExports.createElement(FormContext.Provider, {
    value: _objectSpread2(_objectSpread2({}, formContext), {}, {
      validateMessages: _objectSpread2(_objectSpread2({}, formContext.validateMessages), validateMessages),
      // =========================================================
      // =                  Global Form Control                  =
      // =========================================================
      triggerFormChange: function triggerFormChange2(name2, changedFields) {
        if (onFormChange) {
          onFormChange(name2, {
            changedFields,
            forms: formsRef.current
          });
        }
        formContext.triggerFormChange(name2, changedFields);
      },
      triggerFormFinish: function triggerFormFinish2(name2, values) {
        if (onFormFinish) {
          onFormFinish(name2, {
            values,
            forms: formsRef.current
          });
        }
        formContext.triggerFormFinish(name2, values);
      },
      registerForm: function registerForm2(name2, form2) {
        if (name2) {
          formsRef.current = _objectSpread2(_objectSpread2({}, formsRef.current), {}, _defineProperty$4({}, name2, form2));
        }
        formContext.registerForm(name2, form2);
      },
      unregisterForm: function unregisterForm2(name2) {
        var newForms = _objectSpread2({}, formsRef.current);
        delete newForms[name2];
        formsRef.current = newForms;
        formContext.unregisterForm(name2);
      }
    })
  }, children);
};
var _excluded$s = ["name", "initialValues", "fields", "form", "preserve", "children", "component", "validateMessages", "validateTrigger", "onValuesChange", "onFieldsChange", "onFinish", "onFinishFailed", "clearOnDestroy"];
var Form = function Form3(_ref, ref) {
  var name2 = _ref.name, initialValues = _ref.initialValues, fields = _ref.fields, form2 = _ref.form, preserve2 = _ref.preserve, children = _ref.children, _ref$component = _ref.component, Component2 = _ref$component === void 0 ? "form" : _ref$component, validateMessages = _ref.validateMessages, _ref$validateTrigger = _ref.validateTrigger, validateTrigger = _ref$validateTrigger === void 0 ? "onChange" : _ref$validateTrigger, onValuesChange = _ref.onValuesChange, _onFieldsChange = _ref.onFieldsChange, _onFinish = _ref.onFinish, onFinishFailed = _ref.onFinishFailed, clearOnDestroy = _ref.clearOnDestroy, restProps = _objectWithoutProperties$3(_ref, _excluded$s);
  var nativeElementRef = reactExports.useRef(null);
  var formContext = reactExports.useContext(FormContext);
  var _useForm = useForm(form2), _useForm2 = _slicedToArray(_useForm, 1), formInstance = _useForm2[0];
  var _getInternalHooks = formInstance.getInternalHooks(HOOK_MARK), useSubscribe = _getInternalHooks.useSubscribe, setInitialValues = _getInternalHooks.setInitialValues, setCallbacks = _getInternalHooks.setCallbacks, setValidateMessages = _getInternalHooks.setValidateMessages, setPreserve = _getInternalHooks.setPreserve, destroyForm = _getInternalHooks.destroyForm;
  reactExports.useImperativeHandle(ref, function() {
    return _objectSpread2(_objectSpread2({}, formInstance), {}, {
      nativeElement: nativeElementRef.current
    });
  });
  reactExports.useEffect(function() {
    formContext.registerForm(name2, formInstance);
    return function() {
      formContext.unregisterForm(name2);
    };
  }, [formContext, formInstance, name2]);
  setValidateMessages(_objectSpread2(_objectSpread2({}, formContext.validateMessages), validateMessages));
  setCallbacks({
    onValuesChange,
    onFieldsChange: function onFieldsChange(changedFields) {
      formContext.triggerFormChange(name2, changedFields);
      if (_onFieldsChange) {
        for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          rest[_key - 1] = arguments[_key];
        }
        _onFieldsChange.apply(void 0, [changedFields].concat(rest));
      }
    },
    onFinish: function onFinish(values) {
      formContext.triggerFormFinish(name2, values);
      if (_onFinish) {
        _onFinish(values);
      }
    },
    onFinishFailed
  });
  setPreserve(preserve2);
  var mountRef = reactExports.useRef(null);
  setInitialValues(initialValues, !mountRef.current);
  if (!mountRef.current) {
    mountRef.current = true;
  }
  reactExports.useEffect(
    function() {
      return function() {
        return destroyForm(clearOnDestroy);
      };
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    []
  );
  var childrenNode;
  var childrenRenderProps = typeof children === "function";
  if (childrenRenderProps) {
    var _values = formInstance.getFieldsValue(true);
    childrenNode = children(_values, formInstance);
  } else {
    childrenNode = children;
  }
  useSubscribe(!childrenRenderProps);
  var prevFieldsRef = reactExports.useRef();
  reactExports.useEffect(function() {
    if (!isSimilar(prevFieldsRef.current || [], fields || [])) {
      formInstance.setFields(fields || []);
    }
    prevFieldsRef.current = fields;
  }, [fields, formInstance]);
  var formContextValue = reactExports.useMemo(function() {
    return _objectSpread2(_objectSpread2({}, formInstance), {}, {
      validateTrigger
    });
  }, [formInstance, validateTrigger]);
  var wrapperNode = /* @__PURE__ */ reactExports.createElement(ListContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(Context$1.Provider, {
    value: formContextValue
  }, childrenNode));
  if (Component2 === false) {
    return wrapperNode;
  }
  return /* @__PURE__ */ reactExports.createElement(Component2, _extends$j({}, restProps, {
    ref: nativeElementRef,
    onSubmit: function onSubmit(event) {
      event.preventDefault();
      event.stopPropagation();
      formInstance.submit();
    },
    onReset: function onReset(event) {
      var _restProps$onReset;
      event.preventDefault();
      formInstance.resetFields();
      (_restProps$onReset = restProps.onReset) === null || _restProps$onReset === void 0 || _restProps$onReset.call(restProps, event);
    }
  }), wrapperNode);
};
function stringify$2(value2) {
  try {
    return JSON.stringify(value2);
  } catch (err) {
    return Math.random();
  }
}
function useWatch$1() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  var dependencies = args[0], _args$ = args[1], _form = _args$ === void 0 ? {} : _args$;
  var options = isFormInstance(_form) ? {
    form: _form
  } : _form;
  var form2 = options.form;
  var _useState = reactExports.useState(), _useState2 = _slicedToArray(_useState, 2), value2 = _useState2[0], setValue = _useState2[1];
  var valueStr = reactExports.useMemo(function() {
    return stringify$2(value2);
  }, [value2]);
  var valueStrRef = reactExports.useRef(valueStr);
  valueStrRef.current = valueStr;
  var fieldContext = reactExports.useContext(Context$1);
  var formInstance = form2 || fieldContext;
  var isValidForm = formInstance && formInstance._init;
  var namePath = getNamePath(dependencies);
  var namePathRef = reactExports.useRef(namePath);
  namePathRef.current = namePath;
  reactExports.useEffect(
    function() {
      if (!isValidForm) {
        return;
      }
      var getFieldsValue = formInstance.getFieldsValue, getInternalHooks2 = formInstance.getInternalHooks;
      var _getInternalHooks = getInternalHooks2(HOOK_MARK), registerWatch = _getInternalHooks.registerWatch;
      var getWatchValue = function getWatchValue2(values, allValues) {
        var watchValue = options.preserve ? allValues : values;
        return typeof dependencies === "function" ? dependencies(watchValue) : get$8(watchValue, namePathRef.current);
      };
      var cancelRegister = registerWatch(function(values, allValues) {
        var newValue = getWatchValue(values, allValues);
        var nextValueStr = stringify$2(newValue);
        if (valueStrRef.current !== nextValueStr) {
          valueStrRef.current = nextValueStr;
          setValue(newValue);
        }
      });
      var initialValue = getWatchValue(getFieldsValue(), getFieldsValue(true));
      if (value2 !== initialValue) {
        setValue(initialValue);
      }
      return cancelRegister;
    },
    // We do not need re-register since namePath content is the same
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [isValidForm]
  );
  return value2;
}
var InternalForm = /* @__PURE__ */ reactExports.forwardRef(Form);
var RefForm = InternalForm;
RefForm.FormProvider = FormProvider;
RefForm.Field = WrapperField;
RefForm.List = List$2;
RefForm.useForm = useForm;
RefForm.useWatch = useWatch$1;
const FormItemInputContext = /* @__PURE__ */ reactExports.createContext({});
const NoFormStyle = ({
  children,
  status,
  override
}) => {
  const formItemInputContext = reactExports.useContext(FormItemInputContext);
  const newFormItemInputContext = reactExports.useMemo(() => {
    const newContext = Object.assign({}, formItemInputContext);
    if (override) {
      delete newContext.isFormItemInput;
    }
    if (status) {
      delete newContext.status;
      delete newContext.hasFeedback;
      delete newContext.feedbackIcon;
    }
    return newContext;
  }, [status, override, formItemInputContext]);
  return /* @__PURE__ */ reactExports.createElement(FormItemInputContext.Provider, {
    value: newFormItemInputContext
  }, children);
};
const ContextIsolator = (props) => {
  const {
    space: space2,
    form: form2,
    children
  } = props;
  if (children === void 0 || children === null) {
    return null;
  }
  let result = children;
  if (form2) {
    result = /* @__PURE__ */ React$6.createElement(NoFormStyle, {
      override: true,
      status: true
    }, result);
  }
  if (space2) {
    result = /* @__PURE__ */ React$6.createElement(NoCompactStyle, null, result);
  }
  return result;
};
const isMobile = function() {
  if (typeof navigator === "undefined" || typeof window === "undefined") {
    return false;
  }
  var agent = navigator.userAgent || navigator.vendor || window.opera;
  return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substr(0, 4));
};
var _excluded$r = ["prefixCls", "invalidate", "item", "renderItem", "responsive", "responsiveDisabled", "registerSize", "itemKey", "className", "style", "children", "display", "order", "component"];
var UNDEFINED = void 0;
function InternalItem(props, ref) {
  var prefixCls = props.prefixCls, invalidate = props.invalidate, item = props.item, renderItem2 = props.renderItem, responsive = props.responsive, responsiveDisabled = props.responsiveDisabled, registerSize = props.registerSize, itemKey2 = props.itemKey, className = props.className, style2 = props.style, children = props.children, display = props.display, order2 = props.order, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, restProps = _objectWithoutProperties$3(props, _excluded$r);
  var mergedHidden = responsive && !display;
  function internalRegisterSize(width) {
    registerSize(itemKey2, width);
  }
  reactExports.useEffect(function() {
    return function() {
      internalRegisterSize(null);
    };
  }, []);
  var childNode = renderItem2 && item !== UNDEFINED ? renderItem2(item, {
    index: order2
  }) : children;
  var overflowStyle;
  if (!invalidate) {
    overflowStyle = {
      opacity: mergedHidden ? 0 : 1,
      height: mergedHidden ? 0 : UNDEFINED,
      overflowY: mergedHidden ? "hidden" : UNDEFINED,
      order: responsive ? order2 : UNDEFINED,
      pointerEvents: mergedHidden ? "none" : UNDEFINED,
      position: mergedHidden ? "absolute" : UNDEFINED
    };
  }
  var overflowProps = {};
  if (mergedHidden) {
    overflowProps["aria-hidden"] = true;
  }
  var itemNode = /* @__PURE__ */ reactExports.createElement(Component2, _extends$j({
    className: classNames(!invalidate && prefixCls, className),
    style: _objectSpread2(_objectSpread2({}, overflowStyle), style2)
  }, overflowProps, restProps, {
    ref
  }), childNode);
  if (responsive) {
    itemNode = /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
      onResize: function onResize4(_ref) {
        var offsetWidth = _ref.offsetWidth;
        internalRegisterSize(offsetWidth);
      },
      disabled: responsiveDisabled
    }, itemNode);
  }
  return itemNode;
}
var Item$1 = /* @__PURE__ */ reactExports.forwardRef(InternalItem);
Item$1.displayName = "Item";
function channelUpdate(callback2) {
  if (typeof MessageChannel === "undefined") {
    wrapperRaf(callback2);
  } else {
    var channel = new MessageChannel();
    channel.port1.onmessage = function() {
      return callback2();
    };
    channel.port2.postMessage(void 0);
  }
}
function useBatcher() {
  var updateFuncRef = reactExports.useRef(null);
  var notifyEffectUpdate = function notifyEffectUpdate2(callback2) {
    if (!updateFuncRef.current) {
      updateFuncRef.current = [];
      channelUpdate(function() {
        reactDomExports.unstable_batchedUpdates(function() {
          updateFuncRef.current.forEach(function(fn) {
            fn();
          });
          updateFuncRef.current = null;
        });
      });
    }
    updateFuncRef.current.push(callback2);
  };
  return notifyEffectUpdate;
}
function useEffectState(notifyEffectUpdate, defaultValue2) {
  var _React$useState = reactExports.useState(defaultValue2), _React$useState2 = _slicedToArray(_React$useState, 2), stateValue = _React$useState2[0], setStateValue = _React$useState2[1];
  var setEffectVal = useEvent$2(function(nextValue) {
    notifyEffectUpdate(function() {
      setStateValue(nextValue);
    });
  });
  return [stateValue, setEffectVal];
}
var OverflowContext = /* @__PURE__ */ React$6.createContext(null);
var _excluded$q = ["component"], _excluded2$5 = ["className"], _excluded3$2 = ["className"];
var InternalRawItem = function InternalRawItem2(props, ref) {
  var context = reactExports.useContext(OverflowContext);
  if (!context) {
    var _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, _restProps = _objectWithoutProperties$3(props, _excluded$q);
    return /* @__PURE__ */ reactExports.createElement(Component2, _extends$j({}, _restProps, {
      ref
    }));
  }
  var contextClassName = context.className, restContext = _objectWithoutProperties$3(context, _excluded2$5);
  var className = props.className, restProps = _objectWithoutProperties$3(props, _excluded3$2);
  return /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(Item$1, _extends$j({
    ref,
    className: classNames(contextClassName, className)
  }, restContext, restProps)));
};
var RawItem = /* @__PURE__ */ reactExports.forwardRef(InternalRawItem);
RawItem.displayName = "RawItem";
var _excluded$p = ["prefixCls", "data", "renderItem", "renderRawItem", "itemKey", "itemWidth", "ssr", "style", "className", "maxCount", "renderRest", "renderRawRest", "suffix", "component", "itemComponent", "onVisibleChange"];
var RESPONSIVE = "responsive";
var INVALIDATE = "invalidate";
function defaultRenderRest(omittedItems) {
  return "+ ".concat(omittedItems.length, " ...");
}
function Overflow(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-overflow" : _props$prefixCls, _props$data = props.data, data = _props$data === void 0 ? [] : _props$data, renderItem2 = props.renderItem, renderRawItem = props.renderRawItem, itemKey2 = props.itemKey, _props$itemWidth = props.itemWidth, itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth, ssr = props.ssr, style2 = props.style, className = props.className, maxCount = props.maxCount, renderRest = props.renderRest, renderRawRest = props.renderRawRest, suffix = props.suffix, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, itemComponent = props.itemComponent, onVisibleChange = props.onVisibleChange, restProps = _objectWithoutProperties$3(props, _excluded$p);
  var fullySSR = ssr === "full";
  var notifyEffectUpdate = useBatcher();
  var _useEffectState = useEffectState(notifyEffectUpdate, null), _useEffectState2 = _slicedToArray(_useEffectState, 2), containerWidth = _useEffectState2[0], setContainerWidth = _useEffectState2[1];
  var mergedContainerWidth = containerWidth || 0;
  var _useEffectState3 = useEffectState(notifyEffectUpdate, /* @__PURE__ */ new Map()), _useEffectState4 = _slicedToArray(_useEffectState3, 2), itemWidths = _useEffectState4[0], setItemWidths = _useEffectState4[1];
  var _useEffectState5 = useEffectState(notifyEffectUpdate, 0), _useEffectState6 = _slicedToArray(_useEffectState5, 2), prevRestWidth = _useEffectState6[0], setPrevRestWidth = _useEffectState6[1];
  var _useEffectState7 = useEffectState(notifyEffectUpdate, 0), _useEffectState8 = _slicedToArray(_useEffectState7, 2), restWidth = _useEffectState8[0], setRestWidth = _useEffectState8[1];
  var _useEffectState9 = useEffectState(notifyEffectUpdate, 0), _useEffectState10 = _slicedToArray(_useEffectState9, 2), suffixWidth = _useEffectState10[0], setSuffixWidth = _useEffectState10[1];
  var _useState = reactExports.useState(null), _useState2 = _slicedToArray(_useState, 2), suffixFixedStart = _useState2[0], setSuffixFixedStart = _useState2[1];
  var _useState3 = reactExports.useState(null), _useState4 = _slicedToArray(_useState3, 2), displayCount = _useState4[0], setDisplayCount = _useState4[1];
  var mergedDisplayCount = reactExports.useMemo(function() {
    if (displayCount === null && fullySSR) {
      return Number.MAX_SAFE_INTEGER;
    }
    return displayCount || 0;
  }, [displayCount, containerWidth]);
  var _useState5 = reactExports.useState(false), _useState6 = _slicedToArray(_useState5, 2), restReady = _useState6[0], setRestReady = _useState6[1];
  var itemPrefixCls = "".concat(prefixCls, "-item");
  var mergedRestWidth = Math.max(prevRestWidth, restWidth);
  var isResponsive = maxCount === RESPONSIVE;
  var shouldResponsive = data.length && isResponsive;
  var invalidate = maxCount === INVALIDATE;
  var showRest = shouldResponsive || typeof maxCount === "number" && data.length > maxCount;
  var mergedData = reactExports.useMemo(function() {
    var items = data;
    if (shouldResponsive) {
      if (containerWidth === null && fullySSR) {
        items = data;
      } else {
        items = data.slice(0, Math.min(data.length, mergedContainerWidth / itemWidth));
      }
    } else if (typeof maxCount === "number") {
      items = data.slice(0, maxCount);
    }
    return items;
  }, [data, itemWidth, containerWidth, maxCount, shouldResponsive]);
  var omittedItems = reactExports.useMemo(function() {
    if (shouldResponsive) {
      return data.slice(mergedDisplayCount + 1);
    }
    return data.slice(mergedData.length);
  }, [data, mergedData, shouldResponsive, mergedDisplayCount]);
  var getKey3 = reactExports.useCallback(function(item, index2) {
    var _ref;
    if (typeof itemKey2 === "function") {
      return itemKey2(item);
    }
    return (_ref = itemKey2 && (item === null || item === void 0 ? void 0 : item[itemKey2])) !== null && _ref !== void 0 ? _ref : index2;
  }, [itemKey2]);
  var mergedRenderItem = reactExports.useCallback(renderItem2 || function(item) {
    return item;
  }, [renderItem2]);
  function updateDisplayCount(count, suffixFixedStartVal, notReady) {
    if (displayCount === count && (suffixFixedStartVal === void 0 || suffixFixedStartVal === suffixFixedStart)) {
      return;
    }
    setDisplayCount(count);
    if (!notReady) {
      setRestReady(count < data.length - 1);
      onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(count);
    }
    if (suffixFixedStartVal !== void 0) {
      setSuffixFixedStart(suffixFixedStartVal);
    }
  }
  function onOverflowResize(_24, element2) {
    setContainerWidth(element2.clientWidth);
  }
  function registerSize(key, width) {
    setItemWidths(function(origin2) {
      var clone3 = new Map(origin2);
      if (width === null) {
        clone3.delete(key);
      } else {
        clone3.set(key, width);
      }
      return clone3;
    });
  }
  function registerOverflowSize(_24, width) {
    setRestWidth(width);
    setPrevRestWidth(restWidth);
  }
  function registerSuffixSize(_24, width) {
    setSuffixWidth(width);
  }
  function getItemWidth(index2) {
    return itemWidths.get(getKey3(mergedData[index2], index2));
  }
  useLayoutEffect$1(function() {
    if (mergedContainerWidth && typeof mergedRestWidth === "number" && mergedData) {
      var totalWidth = suffixWidth;
      var len = mergedData.length;
      var lastIndex = len - 1;
      if (!len) {
        updateDisplayCount(0, null);
        return;
      }
      for (var i2 = 0; i2 < len; i2 += 1) {
        var currentItemWidth = getItemWidth(i2);
        if (fullySSR) {
          currentItemWidth = currentItemWidth || 0;
        }
        if (currentItemWidth === void 0) {
          updateDisplayCount(i2 - 1, void 0, true);
          break;
        }
        totalWidth += currentItemWidth;
        if (
          // Only one means `totalWidth` is the final width
          lastIndex === 0 && totalWidth <= mergedContainerWidth || // Last two width will be the final width
          i2 === lastIndex - 1 && totalWidth + getItemWidth(lastIndex) <= mergedContainerWidth
        ) {
          updateDisplayCount(lastIndex, null);
          break;
        } else if (totalWidth + mergedRestWidth > mergedContainerWidth) {
          updateDisplayCount(i2 - 1, totalWidth - currentItemWidth - suffixWidth + restWidth);
          break;
        }
      }
      if (suffix && getItemWidth(0) + suffixWidth > mergedContainerWidth) {
        setSuffixFixedStart(null);
      }
    }
  }, [mergedContainerWidth, itemWidths, restWidth, suffixWidth, getKey3, mergedData]);
  var displayRest = restReady && !!omittedItems.length;
  var suffixStyle = {};
  if (suffixFixedStart !== null && shouldResponsive) {
    suffixStyle = {
      position: "absolute",
      left: suffixFixedStart,
      top: 0
    };
  }
  var itemSharedProps = {
    prefixCls: itemPrefixCls,
    responsive: shouldResponsive,
    component: itemComponent,
    invalidate
  };
  var internalRenderItemNode = renderRawItem ? function(item, index2) {
    var key = getKey3(item, index2);
    return /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
      key,
      value: _objectSpread2(_objectSpread2({}, itemSharedProps), {}, {
        order: index2,
        item,
        itemKey: key,
        registerSize,
        display: index2 <= mergedDisplayCount
      })
    }, renderRawItem(item, index2));
  } : function(item, index2) {
    var key = getKey3(item, index2);
    return /* @__PURE__ */ reactExports.createElement(Item$1, _extends$j({}, itemSharedProps, {
      order: index2,
      key,
      item,
      renderItem: mergedRenderItem,
      itemKey: key,
      registerSize,
      display: index2 <= mergedDisplayCount
    }));
  };
  var restContextProps = {
    order: displayRest ? mergedDisplayCount : Number.MAX_SAFE_INTEGER,
    className: "".concat(itemPrefixCls, "-rest"),
    registerSize: registerOverflowSize,
    display: displayRest
  };
  var mergedRenderRest = renderRest || defaultRenderRest;
  var restNode = renderRawRest ? /* @__PURE__ */ reactExports.createElement(OverflowContext.Provider, {
    value: _objectSpread2(_objectSpread2({}, itemSharedProps), restContextProps)
  }, renderRawRest(omittedItems)) : /* @__PURE__ */ reactExports.createElement(Item$1, _extends$j({}, itemSharedProps, restContextProps), typeof mergedRenderRest === "function" ? mergedRenderRest(omittedItems) : mergedRenderRest);
  var overflowNode = /* @__PURE__ */ reactExports.createElement(Component2, _extends$j({
    className: classNames(!invalidate && prefixCls, className),
    style: style2,
    ref
  }, restProps), mergedData.map(internalRenderItemNode), showRest ? restNode : null, suffix && /* @__PURE__ */ reactExports.createElement(Item$1, _extends$j({}, itemSharedProps, {
    responsive: isResponsive,
    responsiveDisabled: !shouldResponsive,
    order: mergedDisplayCount,
    className: "".concat(itemPrefixCls, "-suffix"),
    registerSize: registerSuffixSize,
    display: true,
    style: suffixStyle
  }), suffix));
  return isResponsive ? /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onOverflowResize,
    disabled: !shouldResponsive
  }, overflowNode) : overflowNode;
}
var ForwardOverflow = /* @__PURE__ */ reactExports.forwardRef(Overflow);
ForwardOverflow.displayName = "Overflow";
ForwardOverflow.Item = RawItem;
ForwardOverflow.RESPONSIVE = RESPONSIVE;
ForwardOverflow.INVALIDATE = INVALIDATE;
function Arrow(props) {
  var prefixCls = props.prefixCls, align = props.align, arrow = props.arrow, arrowPos = props.arrowPos;
  var _ref = arrow || {}, className = _ref.className, content2 = _ref.content;
  var _arrowPos$x = arrowPos.x, x2 = _arrowPos$x === void 0 ? 0 : _arrowPos$x, _arrowPos$y = arrowPos.y, y2 = _arrowPos$y === void 0 ? 0 : _arrowPos$y;
  var arrowRef = reactExports.useRef();
  if (!align || !align.points) {
    return null;
  }
  var alignStyle = {
    position: "absolute"
  };
  if (align.autoArrow !== false) {
    var popupPoints = align.points[0];
    var targetPoints = align.points[1];
    var popupTB = popupPoints[0];
    var popupLR = popupPoints[1];
    var targetTB = targetPoints[0];
    var targetLR = targetPoints[1];
    if (popupTB === targetTB || !["t", "b"].includes(popupTB)) {
      alignStyle.top = y2;
    } else if (popupTB === "t") {
      alignStyle.top = 0;
    } else {
      alignStyle.bottom = 0;
    }
    if (popupLR === targetLR || !["l", "r"].includes(popupLR)) {
      alignStyle.left = x2;
    } else if (popupLR === "l") {
      alignStyle.left = 0;
    } else {
      alignStyle.right = 0;
    }
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    ref: arrowRef,
    className: classNames("".concat(prefixCls, "-arrow"), className),
    style: alignStyle
  }, content2);
}
function Mask$1(props) {
  var prefixCls = props.prefixCls, open = props.open, zIndex = props.zIndex, mask = props.mask, motion = props.motion;
  if (!mask) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$j({}, motion, {
    motionAppear: true,
    visible: open,
    removeOnLeave: true
  }), function(_ref) {
    var className = _ref.className;
    return /* @__PURE__ */ reactExports.createElement("div", {
      style: {
        zIndex
      },
      className: classNames("".concat(prefixCls, "-mask"), className)
    });
  });
}
var PopupContent = /* @__PURE__ */ reactExports.memo(function(_ref) {
  var children = _ref.children;
  return children;
}, function(_24, next2) {
  return next2.cache;
});
var Popup$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var popup = props.popup, className = props.className, prefixCls = props.prefixCls, style2 = props.style, target = props.target, _onVisibleChanged = props.onVisibleChanged, open = props.open, keepDom = props.keepDom, fresh = props.fresh, onClick = props.onClick, mask = props.mask, arrow = props.arrow, arrowPos = props.arrowPos, align = props.align, motion = props.motion, maskMotion = props.maskMotion, forceRender = props.forceRender, getPopupContainer = props.getPopupContainer, autoDestroy = props.autoDestroy, Portal2 = props.portal, zIndex = props.zIndex, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onPointerEnter = props.onPointerEnter, onPointerDownCapture = props.onPointerDownCapture, ready = props.ready, offsetX = props.offsetX, offsetY = props.offsetY, offsetR = props.offsetR, offsetB = props.offsetB, onAlign = props.onAlign, onPrepare = props.onPrepare, stretch = props.stretch, targetWidth = props.targetWidth, targetHeight = props.targetHeight;
  var childNode = typeof popup === "function" ? popup() : popup;
  var isNodeVisible = open || keepDom;
  var getPopupContainerNeedParams = (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer.length) > 0;
  var _React$useState = reactExports.useState(!getPopupContainer || !getPopupContainerNeedParams), _React$useState2 = _slicedToArray(_React$useState, 2), show = _React$useState2[0], setShow = _React$useState2[1];
  useLayoutEffect$1(function() {
    if (!show && getPopupContainerNeedParams && target) {
      setShow(true);
    }
  }, [show, getPopupContainerNeedParams, target]);
  if (!show) {
    return null;
  }
  var AUTO = "auto";
  var offsetStyle = {
    left: "-1000vw",
    top: "-1000vh",
    right: AUTO,
    bottom: AUTO
  };
  if (ready || !open) {
    var _experimental;
    var points = align.points;
    var dynamicInset = align.dynamicInset || ((_experimental = align._experimental) === null || _experimental === void 0 ? void 0 : _experimental.dynamicInset);
    var alignRight = dynamicInset && points[0][1] === "r";
    var alignBottom = dynamicInset && points[0][0] === "b";
    if (alignRight) {
      offsetStyle.right = offsetR;
      offsetStyle.left = AUTO;
    } else {
      offsetStyle.left = offsetX;
      offsetStyle.right = AUTO;
    }
    if (alignBottom) {
      offsetStyle.bottom = offsetB;
      offsetStyle.top = AUTO;
    } else {
      offsetStyle.top = offsetY;
      offsetStyle.bottom = AUTO;
    }
  }
  var miscStyle = {};
  if (stretch) {
    if (stretch.includes("height") && targetHeight) {
      miscStyle.height = targetHeight;
    } else if (stretch.includes("minHeight") && targetHeight) {
      miscStyle.minHeight = targetHeight;
    }
    if (stretch.includes("width") && targetWidth) {
      miscStyle.width = targetWidth;
    } else if (stretch.includes("minWidth") && targetWidth) {
      miscStyle.minWidth = targetWidth;
    }
  }
  if (!open) {
    miscStyle.pointerEvents = "none";
  }
  return /* @__PURE__ */ reactExports.createElement(Portal2, {
    open: forceRender || isNodeVisible,
    getContainer: getPopupContainer && function() {
      return getPopupContainer(target);
    },
    autoDestroy
  }, /* @__PURE__ */ reactExports.createElement(Mask$1, {
    prefixCls,
    open,
    zIndex,
    mask,
    motion: maskMotion
  }), /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onAlign,
    disabled: !open
  }, function(resizeObserverRef) {
    return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$j({
      motionAppear: true,
      motionEnter: true,
      motionLeave: true,
      removeOnLeave: false,
      forceRender,
      leavedClassName: "".concat(prefixCls, "-hidden")
    }, motion, {
      onAppearPrepare: onPrepare,
      onEnterPrepare: onPrepare,
      visible: open,
      onVisibleChanged: function onVisibleChanged(nextVisible) {
        var _motion$onVisibleChan;
        motion === null || motion === void 0 || (_motion$onVisibleChan = motion.onVisibleChanged) === null || _motion$onVisibleChan === void 0 || _motion$onVisibleChan.call(motion, nextVisible);
        _onVisibleChanged(nextVisible);
      }
    }), function(_ref, motionRef) {
      var motionClassName = _ref.className, motionStyle = _ref.style;
      var cls = classNames(prefixCls, motionClassName, className);
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: composeRef(resizeObserverRef, ref, motionRef),
        className: cls,
        style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
          "--arrow-x": "".concat(arrowPos.x || 0, "px"),
          "--arrow-y": "".concat(arrowPos.y || 0, "px")
        }, offsetStyle), miscStyle), motionStyle), {}, {
          boxSizing: "border-box",
          zIndex
        }, style2),
        onMouseEnter,
        onMouseLeave,
        onPointerEnter,
        onClick,
        onPointerDownCapture
      }, arrow && /* @__PURE__ */ reactExports.createElement(Arrow, {
        prefixCls,
        arrow,
        arrowPos,
        align
      }), /* @__PURE__ */ reactExports.createElement(PopupContent, {
        cache: !open && !fresh
      }, childNode));
    });
  }));
});
var TriggerWrapper = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var children = props.children, getTriggerDOMNode = props.getTriggerDOMNode;
  var canUseRef = supportRef(children);
  var setRef2 = reactExports.useCallback(function(node2) {
    fillRef(ref, getTriggerDOMNode ? getTriggerDOMNode(node2) : node2);
  }, [getTriggerDOMNode]);
  var mergedRef = useComposeRef(setRef2, getNodeRef(children));
  return canUseRef ? /* @__PURE__ */ reactExports.cloneElement(children, {
    ref: mergedRef
  }) : children;
});
var TriggerContext = /* @__PURE__ */ reactExports.createContext(null);
function toArray$2(val) {
  return val ? Array.isArray(val) ? val : [val] : [];
}
function useAction(mobile, action, showAction, hideAction) {
  return reactExports.useMemo(function() {
    var mergedShowAction = toArray$2(showAction !== null && showAction !== void 0 ? showAction : action);
    var mergedHideAction = toArray$2(hideAction !== null && hideAction !== void 0 ? hideAction : action);
    var showActionSet = new Set(mergedShowAction);
    var hideActionSet = new Set(mergedHideAction);
    if (mobile) {
      if (showActionSet.has("hover")) {
        showActionSet.delete("hover");
        showActionSet.add("click");
      }
      if (hideActionSet.has("hover")) {
        hideActionSet.delete("hover");
        hideActionSet.add("click");
      }
    }
    return [showActionSet, hideActionSet];
  }, [mobile, action, showAction, hideAction]);
}
function isPointsEq() {
  var a1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var a2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var isAlignPoint = arguments.length > 2 ? arguments[2] : void 0;
  if (isAlignPoint) {
    return a1[0] === a2[0];
  }
  return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {
  var points = align.points;
  var placements2 = Object.keys(builtinPlacements);
  for (var i2 = 0; i2 < placements2.length; i2 += 1) {
    var _builtinPlacements$pl;
    var placement = placements2[i2];
    if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {
      return "".concat(prefixCls, "-placement-").concat(placement);
    }
  }
  return "";
}
function getMotion$1(prefixCls, motion, animation, transitionName) {
  if (motion) {
    return motion;
  }
  if (animation) {
    return {
      motionName: "".concat(prefixCls, "-").concat(animation)
    };
  }
  if (transitionName) {
    return {
      motionName: transitionName
    };
  }
  return null;
}
function getWin(ele) {
  return ele.ownerDocument.defaultView;
}
function collectScroller(ele) {
  var scrollerList = [];
  var current = ele === null || ele === void 0 ? void 0 : ele.parentElement;
  var scrollStyle = ["hidden", "scroll", "clip", "auto"];
  while (current) {
    var _getWin$getComputedSt = getWin(current).getComputedStyle(current), overflowX = _getWin$getComputedSt.overflowX, overflowY = _getWin$getComputedSt.overflowY, overflow = _getWin$getComputedSt.overflow;
    if ([overflowX, overflowY, overflow].some(function(o2) {
      return scrollStyle.includes(o2);
    })) {
      scrollerList.push(current);
    }
    current = current.parentElement;
  }
  return scrollerList;
}
function toNum(num) {
  var defaultValue2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
  return Number.isNaN(num) ? defaultValue2 : num;
}
function getPxValue(val) {
  return toNum(parseFloat(val), 0);
}
function getVisibleArea(initArea, scrollerList) {
  var visibleArea = _objectSpread2({}, initArea);
  (scrollerList || []).forEach(function(ele) {
    if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {
      return;
    }
    var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele), overflow = _getWin$getComputedSt2.overflow, overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin, borderTopWidth = _getWin$getComputedSt2.borderTopWidth, borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth, borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth, borderRightWidth = _getWin$getComputedSt2.borderRightWidth;
    var eleRect = ele.getBoundingClientRect();
    var eleOutHeight = ele.offsetHeight, eleInnerHeight = ele.clientHeight, eleOutWidth = ele.offsetWidth, eleInnerWidth = ele.clientWidth;
    var borderTopNum = getPxValue(borderTopWidth);
    var borderBottomNum = getPxValue(borderBottomWidth);
    var borderLeftNum = getPxValue(borderLeftWidth);
    var borderRightNum = getPxValue(borderRightWidth);
    var scaleX = toNum(Math.round(eleRect.width / eleOutWidth * 1e3) / 1e3);
    var scaleY = toNum(Math.round(eleRect.height / eleOutHeight * 1e3) / 1e3);
    var eleScrollWidth = (eleOutWidth - eleInnerWidth - borderLeftNum - borderRightNum) * scaleX;
    var eleScrollHeight = (eleOutHeight - eleInnerHeight - borderTopNum - borderBottomNum) * scaleY;
    var scaledBorderTopWidth = borderTopNum * scaleY;
    var scaledBorderBottomWidth = borderBottomNum * scaleY;
    var scaledBorderLeftWidth = borderLeftNum * scaleX;
    var scaledBorderRightWidth = borderRightNum * scaleX;
    var clipMarginWidth = 0;
    var clipMarginHeight = 0;
    if (overflow === "clip") {
      var clipNum = getPxValue(overflowClipMargin);
      clipMarginWidth = clipNum * scaleX;
      clipMarginHeight = clipNum * scaleY;
    }
    var eleLeft = eleRect.x + scaledBorderLeftWidth - clipMarginWidth;
    var eleTop = eleRect.y + scaledBorderTopWidth - clipMarginHeight;
    var eleRight = eleLeft + eleRect.width + 2 * clipMarginWidth - scaledBorderLeftWidth - scaledBorderRightWidth - eleScrollWidth;
    var eleBottom = eleTop + eleRect.height + 2 * clipMarginHeight - scaledBorderTopWidth - scaledBorderBottomWidth - eleScrollHeight;
    visibleArea.left = Math.max(visibleArea.left, eleLeft);
    visibleArea.top = Math.max(visibleArea.top, eleTop);
    visibleArea.right = Math.min(visibleArea.right, eleRight);
    visibleArea.bottom = Math.min(visibleArea.bottom, eleBottom);
  });
  return visibleArea;
}
function getUnitOffset(size2) {
  var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var offsetStr = "".concat(offset2);
  var cells = offsetStr.match(/^(.*)\%$/);
  if (cells) {
    return size2 * (parseFloat(cells[1]) / 100);
  }
  return parseFloat(offsetStr);
}
function getNumberOffset(rect, offset2) {
  var _ref = offset2 || [], _ref2 = _slicedToArray(_ref, 2), offsetX = _ref2[0], offsetY = _ref2[1];
  return [getUnitOffset(rect.width, offsetX), getUnitOffset(rect.height, offsetY)];
}
function splitPoints() {
  var points = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
  return [points[0], points[1]];
}
function getAlignPoint(rect, points) {
  var topBottom = points[0];
  var leftRight = points[1];
  var x2;
  var y2;
  if (topBottom === "t") {
    y2 = rect.y;
  } else if (topBottom === "b") {
    y2 = rect.y + rect.height;
  } else {
    y2 = rect.y + rect.height / 2;
  }
  if (leftRight === "l") {
    x2 = rect.x;
  } else if (leftRight === "r") {
    x2 = rect.x + rect.width;
  } else {
    x2 = rect.x + rect.width / 2;
  }
  return {
    x: x2,
    y: y2
  };
}
function reversePoints(points, index2) {
  var reverseMap = {
    t: "b",
    b: "t",
    l: "r",
    r: "l"
  };
  return points.map(function(point2, i2) {
    if (i2 === index2) {
      return reverseMap[point2] || "c";
    }
    return point2;
  }).join("");
}
function useAlign(open, popupEle, target, placement, builtinPlacements, popupAlign, onPopupAlign) {
  var _React$useState = reactExports.useState({
    ready: false,
    offsetX: 0,
    offsetY: 0,
    offsetR: 0,
    offsetB: 0,
    arrowX: 0,
    arrowY: 0,
    scaleX: 1,
    scaleY: 1,
    align: builtinPlacements[placement] || {}
  }), _React$useState2 = _slicedToArray(_React$useState, 2), offsetInfo = _React$useState2[0], setOffsetInfo = _React$useState2[1];
  var alignCountRef = reactExports.useRef(0);
  var scrollerList = reactExports.useMemo(function() {
    if (!popupEle) {
      return [];
    }
    return collectScroller(popupEle);
  }, [popupEle]);
  var prevFlipRef = reactExports.useRef({});
  var resetFlipCache = function resetFlipCache2() {
    prevFlipRef.current = {};
  };
  if (!open) {
    resetFlipCache();
  }
  var onAlign = useEvent$2(function() {
    if (popupEle && target && open) {
      let getIntersectionVisibleArea = function(offsetX, offsetY) {
        var area = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : visibleArea;
        var l2 = popupRect.x + offsetX;
        var t2 = popupRect.y + offsetY;
        var r2 = l2 + popupWidth;
        var b2 = t2 + popupHeight;
        var visibleL = Math.max(l2, area.left);
        var visibleT = Math.max(t2, area.top);
        var visibleR = Math.min(r2, area.right);
        var visibleB = Math.min(b2, area.bottom);
        return Math.max(0, (visibleR - visibleL) * (visibleB - visibleT));
      }, syncNextPopupPosition = function() {
        nextPopupY = popupRect.y + nextOffsetY;
        nextPopupBottom = nextPopupY + popupHeight;
        nextPopupX = popupRect.x + nextOffsetX;
        nextPopupRight = nextPopupX + popupWidth;
      };
      var _popupElement$parentE, _popupRect$x, _popupRect$y, _popupElement$parentE2;
      var popupElement = popupEle;
      var doc = popupElement.ownerDocument;
      var win2 = getWin(popupElement);
      var _win$getComputedStyle = win2.getComputedStyle(popupElement), popupPosition = _win$getComputedStyle.position;
      var originLeft = popupElement.style.left;
      var originTop = popupElement.style.top;
      var originRight = popupElement.style.right;
      var originBottom = popupElement.style.bottom;
      var originOverflow = popupElement.style.overflow;
      var placementInfo = _objectSpread2(_objectSpread2({}, builtinPlacements[placement]), popupAlign);
      var placeholderElement = doc.createElement("div");
      (_popupElement$parentE = popupElement.parentElement) === null || _popupElement$parentE === void 0 || _popupElement$parentE.appendChild(placeholderElement);
      placeholderElement.style.left = "".concat(popupElement.offsetLeft, "px");
      placeholderElement.style.top = "".concat(popupElement.offsetTop, "px");
      placeholderElement.style.position = popupPosition;
      placeholderElement.style.height = "".concat(popupElement.offsetHeight, "px");
      placeholderElement.style.width = "".concat(popupElement.offsetWidth, "px");
      popupElement.style.left = "0";
      popupElement.style.top = "0";
      popupElement.style.right = "auto";
      popupElement.style.bottom = "auto";
      popupElement.style.overflow = "hidden";
      var targetRect;
      if (Array.isArray(target)) {
        targetRect = {
          x: target[0],
          y: target[1],
          width: 0,
          height: 0
        };
      } else {
        var _rect$x, _rect$y;
        var rect = target.getBoundingClientRect();
        rect.x = (_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left;
        rect.y = (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top;
        targetRect = {
          x: rect.x,
          y: rect.y,
          width: rect.width,
          height: rect.height
        };
      }
      var popupRect = popupElement.getBoundingClientRect();
      var _win$getComputedStyle2 = win2.getComputedStyle(popupElement), height = _win$getComputedStyle2.height, width = _win$getComputedStyle2.width;
      popupRect.x = (_popupRect$x = popupRect.x) !== null && _popupRect$x !== void 0 ? _popupRect$x : popupRect.left;
      popupRect.y = (_popupRect$y = popupRect.y) !== null && _popupRect$y !== void 0 ? _popupRect$y : popupRect.top;
      var _doc$documentElement = doc.documentElement, clientWidth = _doc$documentElement.clientWidth, clientHeight = _doc$documentElement.clientHeight, scrollWidth = _doc$documentElement.scrollWidth, scrollHeight = _doc$documentElement.scrollHeight, scrollTop = _doc$documentElement.scrollTop, scrollLeft = _doc$documentElement.scrollLeft;
      var popupHeight = popupRect.height;
      var popupWidth = popupRect.width;
      var targetHeight = targetRect.height;
      var targetWidth = targetRect.width;
      var visibleRegion = {
        left: 0,
        top: 0,
        right: clientWidth,
        bottom: clientHeight
      };
      var scrollRegion = {
        left: -scrollLeft,
        top: -scrollTop,
        right: scrollWidth - scrollLeft,
        bottom: scrollHeight - scrollTop
      };
      var htmlRegion = placementInfo.htmlRegion;
      var VISIBLE = "visible";
      var VISIBLE_FIRST = "visibleFirst";
      if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) {
        htmlRegion = VISIBLE;
      }
      var isVisibleFirst = htmlRegion === VISIBLE_FIRST;
      var scrollRegionArea = getVisibleArea(scrollRegion, scrollerList);
      var visibleRegionArea = getVisibleArea(visibleRegion, scrollerList);
      var visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
      var adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
      popupElement.style.left = "auto";
      popupElement.style.top = "auto";
      popupElement.style.right = "0";
      popupElement.style.bottom = "0";
      var popupMirrorRect = popupElement.getBoundingClientRect();
      popupElement.style.left = originLeft;
      popupElement.style.top = originTop;
      popupElement.style.right = originRight;
      popupElement.style.bottom = originBottom;
      popupElement.style.overflow = originOverflow;
      (_popupElement$parentE2 = popupElement.parentElement) === null || _popupElement$parentE2 === void 0 || _popupElement$parentE2.removeChild(placeholderElement);
      var _scaleX = toNum(Math.round(popupWidth / parseFloat(width) * 1e3) / 1e3);
      var _scaleY = toNum(Math.round(popupHeight / parseFloat(height) * 1e3) / 1e3);
      if (_scaleX === 0 || _scaleY === 0 || isDOM(target) && !isVisible(target)) {
        return;
      }
      var offset2 = placementInfo.offset, targetOffset2 = placementInfo.targetOffset;
      var _getNumberOffset = getNumberOffset(popupRect, offset2), _getNumberOffset2 = _slicedToArray(_getNumberOffset, 2), popupOffsetX = _getNumberOffset2[0], popupOffsetY = _getNumberOffset2[1];
      var _getNumberOffset3 = getNumberOffset(targetRect, targetOffset2), _getNumberOffset4 = _slicedToArray(_getNumberOffset3, 2), targetOffsetX = _getNumberOffset4[0], targetOffsetY = _getNumberOffset4[1];
      targetRect.x -= targetOffsetX;
      targetRect.y -= targetOffsetY;
      var _ref3 = placementInfo.points || [], _ref4 = _slicedToArray(_ref3, 2), popupPoint = _ref4[0], targetPoint = _ref4[1];
      var targetPoints = splitPoints(targetPoint);
      var popupPoints = splitPoints(popupPoint);
      var targetAlignPoint = getAlignPoint(targetRect, targetPoints);
      var popupAlignPoint = getAlignPoint(popupRect, popupPoints);
      var nextAlignInfo = _objectSpread2({}, placementInfo);
      var nextOffsetX = targetAlignPoint.x - popupAlignPoint.x + popupOffsetX;
      var nextOffsetY = targetAlignPoint.y - popupAlignPoint.y + popupOffsetY;
      var originIntersectionVisibleArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY);
      var originIntersectionRecommendArea = getIntersectionVisibleArea(nextOffsetX, nextOffsetY, visibleRegionArea);
      var targetAlignPointTL = getAlignPoint(targetRect, ["t", "l"]);
      var popupAlignPointTL = getAlignPoint(popupRect, ["t", "l"]);
      var targetAlignPointBR = getAlignPoint(targetRect, ["b", "r"]);
      var popupAlignPointBR = getAlignPoint(popupRect, ["b", "r"]);
      var overflow = placementInfo.overflow || {};
      var adjustX = overflow.adjustX, adjustY = overflow.adjustY, shiftX = overflow.shiftX, shiftY = overflow.shiftY;
      var supportAdjust = function supportAdjust2(val) {
        if (typeof val === "boolean") {
          return val;
        }
        return val >= 0;
      };
      var nextPopupY;
      var nextPopupBottom;
      var nextPopupX;
      var nextPopupRight;
      syncNextPopupPosition();
      var needAdjustY = supportAdjust(adjustY);
      var sameTB = popupPoints[0] === targetPoints[0];
      if (needAdjustY && popupPoints[0] === "t" && (nextPopupBottom > adjustCheckVisibleArea.bottom || prevFlipRef.current.bt)) {
        var tmpNextOffsetY = nextOffsetY;
        if (sameTB) {
          tmpNextOffsetY -= popupHeight - targetHeight;
        } else {
          tmpNextOffsetY = targetAlignPointTL.y - popupAlignPointBR.y - popupOffsetY;
        }
        var newVisibleArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY);
        var newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, tmpNextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          newVisibleArea > originIntersectionVisibleArea || newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          newVisibleRecommendArea >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.bt = true;
          nextOffsetY = tmpNextOffsetY;
          popupOffsetY = -popupOffsetY;
          nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
        } else {
          prevFlipRef.current.bt = false;
        }
      }
      if (needAdjustY && popupPoints[0] === "b" && (nextPopupY < adjustCheckVisibleArea.top || prevFlipRef.current.tb)) {
        var _tmpNextOffsetY = nextOffsetY;
        if (sameTB) {
          _tmpNextOffsetY += popupHeight - targetHeight;
        } else {
          _tmpNextOffsetY = targetAlignPointBR.y - popupAlignPointTL.y - popupOffsetY;
        }
        var _newVisibleArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY);
        var _newVisibleRecommendArea = getIntersectionVisibleArea(nextOffsetX, _tmpNextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea > originIntersectionVisibleArea || _newVisibleArea === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.tb = true;
          nextOffsetY = _tmpNextOffsetY;
          popupOffsetY = -popupOffsetY;
          nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
        } else {
          prevFlipRef.current.tb = false;
        }
      }
      var needAdjustX = supportAdjust(adjustX);
      var sameLR = popupPoints[1] === targetPoints[1];
      if (needAdjustX && popupPoints[1] === "l" && (nextPopupRight > adjustCheckVisibleArea.right || prevFlipRef.current.rl)) {
        var tmpNextOffsetX = nextOffsetX;
        if (sameLR) {
          tmpNextOffsetX -= popupWidth - targetWidth;
        } else {
          tmpNextOffsetX = targetAlignPointTL.x - popupAlignPointBR.x - popupOffsetX;
        }
        var _newVisibleArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY);
        var _newVisibleRecommendArea2 = getIntersectionVisibleArea(tmpNextOffsetX, nextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea2 > originIntersectionVisibleArea || _newVisibleArea2 === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea2 >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.rl = true;
          nextOffsetX = tmpNextOffsetX;
          popupOffsetX = -popupOffsetX;
          nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
        } else {
          prevFlipRef.current.rl = false;
        }
      }
      if (needAdjustX && popupPoints[1] === "r" && (nextPopupX < adjustCheckVisibleArea.left || prevFlipRef.current.lr)) {
        var _tmpNextOffsetX = nextOffsetX;
        if (sameLR) {
          _tmpNextOffsetX += popupWidth - targetWidth;
        } else {
          _tmpNextOffsetX = targetAlignPointBR.x - popupAlignPointTL.x - popupOffsetX;
        }
        var _newVisibleArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY);
        var _newVisibleRecommendArea3 = getIntersectionVisibleArea(_tmpNextOffsetX, nextOffsetY, visibleRegionArea);
        if (
          // Of course use larger one
          _newVisibleArea3 > originIntersectionVisibleArea || _newVisibleArea3 === originIntersectionVisibleArea && (!isVisibleFirst || // Choose recommend one
          _newVisibleRecommendArea3 >= originIntersectionRecommendArea)
        ) {
          prevFlipRef.current.lr = true;
          nextOffsetX = _tmpNextOffsetX;
          popupOffsetX = -popupOffsetX;
          nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
        } else {
          prevFlipRef.current.lr = false;
        }
      }
      syncNextPopupPosition();
      var numShiftX = shiftX === true ? 0 : shiftX;
      if (typeof numShiftX === "number") {
        if (nextPopupX < visibleRegionArea.left) {
          nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
          if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
            nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
          }
        }
        if (nextPopupRight > visibleRegionArea.right) {
          nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
          if (targetRect.x > visibleRegionArea.right - numShiftX) {
            nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
          }
        }
      }
      var numShiftY = shiftY === true ? 0 : shiftY;
      if (typeof numShiftY === "number") {
        if (nextPopupY < visibleRegionArea.top) {
          nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
          if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
            nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
          }
        }
        if (nextPopupBottom > visibleRegionArea.bottom) {
          nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
          if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
            nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;
          }
        }
      }
      var popupLeft = popupRect.x + nextOffsetX;
      var popupRight = popupLeft + popupWidth;
      var popupTop = popupRect.y + nextOffsetY;
      var popupBottom = popupTop + popupHeight;
      var targetLeft = targetRect.x;
      var targetRight = targetLeft + targetWidth;
      var targetTop = targetRect.y;
      var targetBottom = targetTop + targetHeight;
      var maxLeft = Math.max(popupLeft, targetLeft);
      var minRight = Math.min(popupRight, targetRight);
      var xCenter = (maxLeft + minRight) / 2;
      var nextArrowX = xCenter - popupLeft;
      var maxTop = Math.max(popupTop, targetTop);
      var minBottom = Math.min(popupBottom, targetBottom);
      var yCenter = (maxTop + minBottom) / 2;
      var nextArrowY = yCenter - popupTop;
      onPopupAlign === null || onPopupAlign === void 0 || onPopupAlign(popupEle, nextAlignInfo);
      var offsetX4Right = popupMirrorRect.right - popupRect.x - (nextOffsetX + popupRect.width);
      var offsetY4Bottom = popupMirrorRect.bottom - popupRect.y - (nextOffsetY + popupRect.height);
      if (_scaleX === 1) {
        nextOffsetX = Math.round(nextOffsetX);
        offsetX4Right = Math.round(offsetX4Right);
      }
      if (_scaleY === 1) {
        nextOffsetY = Math.round(nextOffsetY);
        offsetY4Bottom = Math.round(offsetY4Bottom);
      }
      var nextOffsetInfo = {
        ready: true,
        offsetX: nextOffsetX / _scaleX,
        offsetY: nextOffsetY / _scaleY,
        offsetR: offsetX4Right / _scaleX,
        offsetB: offsetY4Bottom / _scaleY,
        arrowX: nextArrowX / _scaleX,
        arrowY: nextArrowY / _scaleY,
        scaleX: _scaleX,
        scaleY: _scaleY,
        align: nextAlignInfo
      };
      setOffsetInfo(nextOffsetInfo);
    }
  });
  var triggerAlign = function triggerAlign2() {
    alignCountRef.current += 1;
    var id2 = alignCountRef.current;
    Promise.resolve().then(function() {
      if (alignCountRef.current === id2) {
        onAlign();
      }
    });
  };
  var resetReady = function resetReady2() {
    setOffsetInfo(function(ori) {
      return _objectSpread2(_objectSpread2({}, ori), {}, {
        ready: false
      });
    });
  };
  useLayoutEffect$1(resetReady, [placement]);
  useLayoutEffect$1(function() {
    if (!open) {
      resetReady();
    }
  }, [open]);
  return [offsetInfo.ready, offsetInfo.offsetX, offsetInfo.offsetY, offsetInfo.offsetR, offsetInfo.offsetB, offsetInfo.arrowX, offsetInfo.arrowY, offsetInfo.scaleX, offsetInfo.scaleY, offsetInfo.align, triggerAlign];
}
function useWatch(open, target, popup, onAlign, onScroll6) {
  useLayoutEffect$1(function() {
    if (open && target && popup) {
      let notifyScroll = function() {
        onAlign();
        onScroll6();
      };
      var targetElement = target;
      var popupElement = popup;
      var targetScrollList = collectScroller(targetElement);
      var popupScrollList = collectScroller(popupElement);
      var win2 = getWin(popupElement);
      var mergedList = new Set([win2].concat(_toConsumableArray(targetScrollList), _toConsumableArray(popupScrollList)));
      mergedList.forEach(function(scroller) {
        scroller.addEventListener("scroll", notifyScroll, {
          passive: true
        });
      });
      win2.addEventListener("resize", notifyScroll, {
        passive: true
      });
      onAlign();
      return function() {
        mergedList.forEach(function(scroller) {
          scroller.removeEventListener("scroll", notifyScroll);
          win2.removeEventListener("resize", notifyScroll);
        });
      };
    }
  }, [open, target, popup]);
}
function useWinClick(open, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen) {
  var openRef = reactExports.useRef(open);
  openRef.current = open;
  var popupPointerDownRef = reactExports.useRef(false);
  reactExports.useEffect(function() {
    if (clickToHide && popupEle && (!mask || maskClosable)) {
      var onPointerDown = function onPointerDown2() {
        popupPointerDownRef.current = false;
      };
      var onTriggerClose = function onTriggerClose2(e2) {
        var _e$composedPath;
        if (openRef.current && !inPopupOrChild(((_e$composedPath = e2.composedPath) === null || _e$composedPath === void 0 || (_e$composedPath = _e$composedPath.call(e2)) === null || _e$composedPath === void 0 ? void 0 : _e$composedPath[0]) || e2.target) && !popupPointerDownRef.current) {
          triggerOpen(false);
        }
      };
      var win2 = getWin(popupEle);
      win2.addEventListener("pointerdown", onPointerDown, true);
      win2.addEventListener("mousedown", onTriggerClose, true);
      win2.addEventListener("contextmenu", onTriggerClose, true);
      var targetShadowRoot = getShadowRoot(targetEle);
      if (targetShadowRoot) {
        targetShadowRoot.addEventListener("mousedown", onTriggerClose, true);
        targetShadowRoot.addEventListener("contextmenu", onTriggerClose, true);
      }
      return function() {
        win2.removeEventListener("pointerdown", onPointerDown, true);
        win2.removeEventListener("mousedown", onTriggerClose, true);
        win2.removeEventListener("contextmenu", onTriggerClose, true);
        if (targetShadowRoot) {
          targetShadowRoot.removeEventListener("mousedown", onTriggerClose, true);
          targetShadowRoot.removeEventListener("contextmenu", onTriggerClose, true);
        }
      };
    }
  }, [clickToHide, targetEle, popupEle, mask, maskClosable]);
  function onPopupPointerDown() {
    popupPointerDownRef.current = true;
  }
  return onPopupPointerDown;
}
var _excluded$o = ["prefixCls", "children", "action", "showAction", "hideAction", "popupVisible", "defaultPopupVisible", "onPopupVisibleChange", "afterPopupVisibleChange", "mouseEnterDelay", "mouseLeaveDelay", "focusDelay", "blurDelay", "mask", "maskClosable", "getPopupContainer", "forceRender", "autoDestroy", "destroyPopupOnHide", "popup", "popupClassName", "popupStyle", "popupPlacement", "builtinPlacements", "popupAlign", "zIndex", "stretch", "getPopupClassNameFromAlign", "fresh", "alignPoint", "onPopupClick", "onPopupAlign", "arrow", "popupMotion", "maskMotion", "popupTransitionName", "popupAnimation", "maskTransitionName", "maskAnimation", "className", "getTriggerDOMNode"];
function generateTrigger() {
  var PortalComponent = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Portal;
  var Trigger2 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-trigger-popup" : _props$prefixCls, children = props.children, _props$action = props.action, action = _props$action === void 0 ? "hover" : _props$action, showAction = props.showAction, hideAction = props.hideAction, popupVisible = props.popupVisible, defaultPopupVisible = props.defaultPopupVisible, onPopupVisibleChange = props.onPopupVisibleChange, afterPopupVisibleChange = props.afterPopupVisibleChange, mouseEnterDelay = props.mouseEnterDelay, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela, focusDelay = props.focusDelay, blurDelay = props.blurDelay, mask = props.mask, _props$maskClosable = props.maskClosable, maskClosable = _props$maskClosable === void 0 ? true : _props$maskClosable, getPopupContainer = props.getPopupContainer, forceRender = props.forceRender, autoDestroy = props.autoDestroy, destroyPopupOnHide = props.destroyPopupOnHide, popup = props.popup, popupClassName = props.popupClassName, popupStyle = props.popupStyle, popupPlacement = props.popupPlacement, _props$builtinPlaceme = props.builtinPlacements, builtinPlacements = _props$builtinPlaceme === void 0 ? {} : _props$builtinPlaceme, popupAlign = props.popupAlign, zIndex = props.zIndex, stretch = props.stretch, getPopupClassNameFromAlign = props.getPopupClassNameFromAlign, fresh = props.fresh, alignPoint = props.alignPoint, onPopupClick = props.onPopupClick, onPopupAlign = props.onPopupAlign, arrow = props.arrow, popupMotion = props.popupMotion, maskMotion = props.maskMotion, popupTransitionName = props.popupTransitionName, popupAnimation = props.popupAnimation, maskTransitionName = props.maskTransitionName, maskAnimation = props.maskAnimation, className = props.className, getTriggerDOMNode = props.getTriggerDOMNode, restProps = _objectWithoutProperties$3(props, _excluded$o);
    var mergedAutoDestroy = autoDestroy || destroyPopupOnHide || false;
    var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), mobile = _React$useState2[0], setMobile = _React$useState2[1];
    useLayoutEffect$1(function() {
      setMobile(isMobile());
    }, []);
    var subPopupElements = reactExports.useRef({});
    var parentContext = reactExports.useContext(TriggerContext);
    var context = reactExports.useMemo(function() {
      return {
        registerSubPopup: function registerSubPopup(id22, subPopupEle) {
          subPopupElements.current[id22] = subPopupEle;
          parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id22, subPopupEle);
        }
      };
    }, [parentContext]);
    var id2 = useId();
    var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), popupEle = _React$useState4[0], setPopupEle = _React$useState4[1];
    var externalPopupRef = reactExports.useRef(null);
    var setPopupRef = useEvent$2(function(node2) {
      externalPopupRef.current = node2;
      if (isDOM(node2) && popupEle !== node2) {
        setPopupEle(node2);
      }
      parentContext === null || parentContext === void 0 || parentContext.registerSubPopup(id2, node2);
    });
    var _React$useState5 = reactExports.useState(null), _React$useState6 = _slicedToArray(_React$useState5, 2), targetEle = _React$useState6[0], setTargetEle = _React$useState6[1];
    var externalForwardRef = reactExports.useRef(null);
    var setTargetRef = useEvent$2(function(node2) {
      if (isDOM(node2) && targetEle !== node2) {
        setTargetEle(node2);
        externalForwardRef.current = node2;
      }
    });
    var child = reactExports.Children.only(children);
    var originChildProps = (child === null || child === void 0 ? void 0 : child.props) || {};
    var cloneProps = {};
    var inPopupOrChild = useEvent$2(function(ele) {
      var _getShadowRoot, _getShadowRoot2;
      var childDOM = targetEle;
      return (childDOM === null || childDOM === void 0 ? void 0 : childDOM.contains(ele)) || ((_getShadowRoot = getShadowRoot(childDOM)) === null || _getShadowRoot === void 0 ? void 0 : _getShadowRoot.host) === ele || ele === childDOM || (popupEle === null || popupEle === void 0 ? void 0 : popupEle.contains(ele)) || ((_getShadowRoot2 = getShadowRoot(popupEle)) === null || _getShadowRoot2 === void 0 ? void 0 : _getShadowRoot2.host) === ele || ele === popupEle || Object.values(subPopupElements.current).some(function(subPopupEle) {
        return (subPopupEle === null || subPopupEle === void 0 ? void 0 : subPopupEle.contains(ele)) || ele === subPopupEle;
      });
    });
    var mergePopupMotion = getMotion$1(prefixCls, popupMotion, popupAnimation, popupTransitionName);
    var mergeMaskMotion = getMotion$1(prefixCls, maskMotion, maskAnimation, maskTransitionName);
    var _React$useState7 = reactExports.useState(defaultPopupVisible || false), _React$useState8 = _slicedToArray(_React$useState7, 2), internalOpen = _React$useState8[0], setInternalOpen = _React$useState8[1];
    var mergedOpen = popupVisible !== null && popupVisible !== void 0 ? popupVisible : internalOpen;
    var setMergedOpen = useEvent$2(function(nextOpen) {
      if (popupVisible === void 0) {
        setInternalOpen(nextOpen);
      }
    });
    useLayoutEffect$1(function() {
      setInternalOpen(popupVisible || false);
    }, [popupVisible]);
    var openRef = reactExports.useRef(mergedOpen);
    openRef.current = mergedOpen;
    var lastTriggerRef = reactExports.useRef([]);
    lastTriggerRef.current = [];
    var internalTriggerOpen = useEvent$2(function(nextOpen) {
      var _lastTriggerRef$curre;
      setMergedOpen(nextOpen);
      if (((_lastTriggerRef$curre = lastTriggerRef.current[lastTriggerRef.current.length - 1]) !== null && _lastTriggerRef$curre !== void 0 ? _lastTriggerRef$curre : mergedOpen) !== nextOpen) {
        lastTriggerRef.current.push(nextOpen);
        onPopupVisibleChange === null || onPopupVisibleChange === void 0 || onPopupVisibleChange(nextOpen);
      }
    });
    var delayRef = reactExports.useRef();
    var clearDelay = function clearDelay2() {
      clearTimeout(delayRef.current);
    };
    var triggerOpen = function triggerOpen2(nextOpen) {
      var delay2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      clearDelay();
      if (delay2 === 0) {
        internalTriggerOpen(nextOpen);
      } else {
        delayRef.current = setTimeout(function() {
          internalTriggerOpen(nextOpen);
        }, delay2 * 1e3);
      }
    };
    reactExports.useEffect(function() {
      return clearDelay;
    }, []);
    var _React$useState9 = reactExports.useState(false), _React$useState10 = _slicedToArray(_React$useState9, 2), inMotion = _React$useState10[0], setInMotion = _React$useState10[1];
    useLayoutEffect$1(function(firstMount) {
      if (!firstMount || mergedOpen) {
        setInMotion(true);
      }
    }, [mergedOpen]);
    var _React$useState11 = reactExports.useState(null), _React$useState12 = _slicedToArray(_React$useState11, 2), motionPrepareResolve = _React$useState12[0], setMotionPrepareResolve = _React$useState12[1];
    var _React$useState13 = reactExports.useState(null), _React$useState14 = _slicedToArray(_React$useState13, 2), mousePos = _React$useState14[0], setMousePos = _React$useState14[1];
    var setMousePosByEvent = function setMousePosByEvent2(event) {
      setMousePos([event.clientX, event.clientY]);
    };
    var _useAlign = useAlign(mergedOpen, popupEle, alignPoint && mousePos !== null ? mousePos : targetEle, popupPlacement, builtinPlacements, popupAlign, onPopupAlign), _useAlign2 = _slicedToArray(_useAlign, 11), ready = _useAlign2[0], offsetX = _useAlign2[1], offsetY = _useAlign2[2], offsetR = _useAlign2[3], offsetB = _useAlign2[4], arrowX = _useAlign2[5], arrowY = _useAlign2[6], scaleX = _useAlign2[7], scaleY = _useAlign2[8], alignInfo = _useAlign2[9], onAlign = _useAlign2[10];
    var _useAction = useAction(mobile, action, showAction, hideAction), _useAction2 = _slicedToArray(_useAction, 2), showActions = _useAction2[0], hideActions = _useAction2[1];
    var clickToShow = showActions.has("click");
    var clickToHide = hideActions.has("click") || hideActions.has("contextMenu");
    var triggerAlign = useEvent$2(function() {
      if (!inMotion) {
        onAlign();
      }
    });
    var onScroll6 = function onScroll22() {
      if (openRef.current && alignPoint && clickToHide) {
        triggerOpen(false);
      }
    };
    useWatch(mergedOpen, targetEle, popupEle, triggerAlign, onScroll6);
    useLayoutEffect$1(function() {
      triggerAlign();
    }, [mousePos, popupPlacement]);
    useLayoutEffect$1(function() {
      if (mergedOpen && !(builtinPlacements !== null && builtinPlacements !== void 0 && builtinPlacements[popupPlacement])) {
        triggerAlign();
      }
    }, [JSON.stringify(popupAlign)]);
    var alignedClassName = reactExports.useMemo(function() {
      var baseClassName2 = getAlignPopupClassName(builtinPlacements, prefixCls, alignInfo, alignPoint);
      return classNames(baseClassName2, getPopupClassNameFromAlign === null || getPopupClassNameFromAlign === void 0 ? void 0 : getPopupClassNameFromAlign(alignInfo));
    }, [alignInfo, getPopupClassNameFromAlign, builtinPlacements, prefixCls, alignPoint]);
    reactExports.useImperativeHandle(ref, function() {
      return {
        nativeElement: externalForwardRef.current,
        popupElement: externalPopupRef.current,
        forceAlign: triggerAlign
      };
    });
    var _React$useState15 = reactExports.useState(0), _React$useState16 = _slicedToArray(_React$useState15, 2), targetWidth = _React$useState16[0], setTargetWidth = _React$useState16[1];
    var _React$useState17 = reactExports.useState(0), _React$useState18 = _slicedToArray(_React$useState17, 2), targetHeight = _React$useState18[0], setTargetHeight = _React$useState18[1];
    var syncTargetSize = function syncTargetSize2() {
      if (stretch && targetEle) {
        var rect = targetEle.getBoundingClientRect();
        setTargetWidth(rect.width);
        setTargetHeight(rect.height);
      }
    };
    var onTargetResize = function onTargetResize2() {
      syncTargetSize();
      triggerAlign();
    };
    var onVisibleChanged = function onVisibleChanged2(visible) {
      setInMotion(false);
      onAlign();
      afterPopupVisibleChange === null || afterPopupVisibleChange === void 0 || afterPopupVisibleChange(visible);
    };
    var onPrepare = function onPrepare2() {
      return new Promise(function(resolve2) {
        syncTargetSize();
        setMotionPrepareResolve(function() {
          return resolve2;
        });
      });
    };
    useLayoutEffect$1(function() {
      if (motionPrepareResolve) {
        onAlign();
        motionPrepareResolve();
        setMotionPrepareResolve(null);
      }
    }, [motionPrepareResolve]);
    function wrapperAction(eventName, nextOpen, delay2, preEvent) {
      cloneProps[eventName] = function(event) {
        var _originChildProps$eve;
        preEvent === null || preEvent === void 0 || preEvent(event);
        triggerOpen(nextOpen, delay2);
        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
        (_originChildProps$eve = originChildProps[eventName]) === null || _originChildProps$eve === void 0 || _originChildProps$eve.call.apply(_originChildProps$eve, [originChildProps, event].concat(args));
      };
    }
    if (clickToShow || clickToHide) {
      cloneProps.onClick = function(event) {
        var _originChildProps$onC;
        if (openRef.current && clickToHide) {
          triggerOpen(false);
        } else if (!openRef.current && clickToShow) {
          setMousePosByEvent(event);
          triggerOpen(true);
        }
        for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
          args[_key2 - 1] = arguments[_key2];
        }
        (_originChildProps$onC = originChildProps.onClick) === null || _originChildProps$onC === void 0 || _originChildProps$onC.call.apply(_originChildProps$onC, [originChildProps, event].concat(args));
      };
    }
    var onPopupPointerDown = useWinClick(mergedOpen, clickToHide, targetEle, popupEle, mask, maskClosable, inPopupOrChild, triggerOpen);
    var hoverToShow = showActions.has("hover");
    var hoverToHide = hideActions.has("hover");
    var onPopupMouseEnter;
    var onPopupMouseLeave;
    if (hoverToShow) {
      wrapperAction("onMouseEnter", true, mouseEnterDelay, function(event) {
        setMousePosByEvent(event);
      });
      wrapperAction("onPointerEnter", true, mouseEnterDelay, function(event) {
        setMousePosByEvent(event);
      });
      onPopupMouseEnter = function onPopupMouseEnter2(event) {
        if ((mergedOpen || inMotion) && popupEle !== null && popupEle !== void 0 && popupEle.contains(event.target)) {
          triggerOpen(true, mouseEnterDelay);
        }
      };
      if (alignPoint) {
        cloneProps.onMouseMove = function(event) {
          var _originChildProps$onM;
          (_originChildProps$onM = originChildProps.onMouseMove) === null || _originChildProps$onM === void 0 || _originChildProps$onM.call(originChildProps, event);
        };
      }
    }
    if (hoverToHide) {
      wrapperAction("onMouseLeave", false, mouseLeaveDelay);
      wrapperAction("onPointerLeave", false, mouseLeaveDelay);
      onPopupMouseLeave = function onPopupMouseLeave2() {
        triggerOpen(false, mouseLeaveDelay);
      };
    }
    if (showActions.has("focus")) {
      wrapperAction("onFocus", true, focusDelay);
    }
    if (hideActions.has("focus")) {
      wrapperAction("onBlur", false, blurDelay);
    }
    if (showActions.has("contextMenu")) {
      cloneProps.onContextMenu = function(event) {
        var _originChildProps$onC2;
        if (openRef.current && hideActions.has("contextMenu")) {
          triggerOpen(false);
        } else {
          setMousePosByEvent(event);
          triggerOpen(true);
        }
        event.preventDefault();
        for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
          args[_key3 - 1] = arguments[_key3];
        }
        (_originChildProps$onC2 = originChildProps.onContextMenu) === null || _originChildProps$onC2 === void 0 || _originChildProps$onC2.call.apply(_originChildProps$onC2, [originChildProps, event].concat(args));
      };
    }
    if (className) {
      cloneProps.className = classNames(originChildProps.className, className);
    }
    var renderedRef = reactExports.useRef(false);
    renderedRef.current || (renderedRef.current = forceRender || mergedOpen || inMotion);
    var mergedChildrenProps = _objectSpread2(_objectSpread2({}, originChildProps), cloneProps);
    var passedProps = {};
    var passedEventList = ["onContextMenu", "onClick", "onMouseDown", "onTouchStart", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur"];
    passedEventList.forEach(function(eventName) {
      if (restProps[eventName]) {
        passedProps[eventName] = function() {
          var _mergedChildrenProps$;
          for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
            args[_key4] = arguments[_key4];
          }
          (_mergedChildrenProps$ = mergedChildrenProps[eventName]) === null || _mergedChildrenProps$ === void 0 || _mergedChildrenProps$.call.apply(_mergedChildrenProps$, [mergedChildrenProps].concat(args));
          restProps[eventName].apply(restProps, args);
        };
      }
    });
    var triggerNode = /* @__PURE__ */ reactExports.cloneElement(child, _objectSpread2(_objectSpread2({}, mergedChildrenProps), passedProps));
    var arrowPos = {
      x: arrowX,
      y: arrowY
    };
    var innerArrow = arrow ? _objectSpread2({}, arrow !== true ? arrow : {}) : null;
    return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
      disabled: !mergedOpen,
      ref: setTargetRef,
      onResize: onTargetResize
    }, /* @__PURE__ */ reactExports.createElement(TriggerWrapper, {
      getTriggerDOMNode
    }, triggerNode)), renderedRef.current && /* @__PURE__ */ reactExports.createElement(TriggerContext.Provider, {
      value: context
    }, /* @__PURE__ */ reactExports.createElement(Popup$1, {
      portal: PortalComponent,
      ref: setPopupRef,
      prefixCls,
      popup,
      className: classNames(popupClassName, alignedClassName),
      style: popupStyle,
      target: targetEle,
      onMouseEnter: onPopupMouseEnter,
      onMouseLeave: onPopupMouseLeave,
      onPointerEnter: onPopupMouseEnter,
      zIndex,
      open: mergedOpen,
      keepDom: inMotion,
      fresh,
      onClick: onPopupClick,
      onPointerDownCapture: onPopupPointerDown,
      mask,
      motion: mergePopupMotion,
      maskMotion: mergeMaskMotion,
      onVisibleChanged,
      onPrepare,
      forceRender,
      autoDestroy: mergedAutoDestroy,
      getPopupContainer,
      align: alignInfo,
      arrow: innerArrow,
      arrowPos,
      ready,
      offsetX,
      offsetY,
      offsetR,
      offsetB,
      onAlign: triggerAlign,
      stretch,
      targetWidth: targetWidth / scaleX,
      targetHeight: targetHeight / scaleY
    })));
  });
  return Trigger2;
}
const Trigger = generateTrigger(Portal);
var Filler = /* @__PURE__ */ reactExports.forwardRef(function(_ref, ref) {
  var height = _ref.height, offsetY = _ref.offsetY, offsetX = _ref.offsetX, children = _ref.children, prefixCls = _ref.prefixCls, onInnerResize = _ref.onInnerResize, innerProps = _ref.innerProps, rtl = _ref.rtl, extra = _ref.extra;
  var outerStyle = {};
  var innerStyle = {
    display: "flex",
    flexDirection: "column"
  };
  if (offsetY !== void 0) {
    outerStyle = {
      height,
      position: "relative",
      overflow: "hidden"
    };
    innerStyle = _objectSpread2(_objectSpread2({}, innerStyle), {}, _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4({
      transform: "translateY(".concat(offsetY, "px)")
    }, rtl ? "marginRight" : "marginLeft", -offsetX), "position", "absolute"), "left", 0), "right", 0), "top", 0));
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    style: outerStyle
  }, /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: function onResize4(_ref2) {
      var offsetHeight = _ref2.offsetHeight;
      if (offsetHeight && onInnerResize) {
        onInnerResize();
      }
    }
  }, /* @__PURE__ */ reactExports.createElement("div", _extends$j({
    style: innerStyle,
    className: classNames(_defineProperty$4({}, "".concat(prefixCls, "-holder-inner"), prefixCls)),
    ref
  }, innerProps), children, extra)));
});
Filler.displayName = "Filler";
function Item(_ref) {
  var children = _ref.children, setRef2 = _ref.setRef;
  var refFunc = reactExports.useCallback(function(node2) {
    setRef2(node2);
  }, []);
  return /* @__PURE__ */ reactExports.cloneElement(children, {
    ref: refFunc
  });
}
function useChildren(list2, startIndex, endIndex, scrollWidth, offsetX, setNodeRef, renderFunc, _ref) {
  var getKey3 = _ref.getKey;
  return list2.slice(startIndex, endIndex + 1).map(function(item, index2) {
    var eleIndex = startIndex + index2;
    var node2 = renderFunc(item, eleIndex, {
      style: {
        width: scrollWidth
      },
      offsetX
    });
    var key = getKey3(item);
    return /* @__PURE__ */ reactExports.createElement(Item, {
      key,
      setRef: function setRef2(ele) {
        return setNodeRef(item, ele);
      }
    }, node2);
  });
}
function findListDiffIndex(originList, targetList, getKey3) {
  var originLen = originList.length;
  var targetLen = targetList.length;
  var shortList;
  var longList;
  if (originLen === 0 && targetLen === 0) {
    return null;
  }
  if (originLen < targetLen) {
    shortList = originList;
    longList = targetList;
  } else {
    shortList = targetList;
    longList = originList;
  }
  var notExistKey = {
    __EMPTY_ITEM__: true
  };
  function getItemKey(item) {
    if (item !== void 0) {
      return getKey3(item);
    }
    return notExistKey;
  }
  var diffIndex = null;
  var multiple = Math.abs(originLen - targetLen) !== 1;
  for (var i2 = 0; i2 < longList.length; i2 += 1) {
    var shortKey = getItemKey(shortList[i2]);
    var longKey = getItemKey(longList[i2]);
    if (shortKey !== longKey) {
      diffIndex = i2;
      multiple = multiple || shortKey !== getItemKey(longList[i2 + 1]);
      break;
    }
  }
  return diffIndex === null ? null : {
    index: diffIndex,
    multiple
  };
}
function useDiffItem(data, getKey3, onDiff) {
  var _React$useState = reactExports.useState(data), _React$useState2 = _slicedToArray(_React$useState, 2), prevData = _React$useState2[0], setPrevData = _React$useState2[1];
  var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), diffItem = _React$useState4[0], setDiffItem = _React$useState4[1];
  reactExports.useEffect(function() {
    var diff2 = findListDiffIndex(prevData || [], data || [], getKey3);
    if ((diff2 === null || diff2 === void 0 ? void 0 : diff2.index) !== void 0) {
      setDiffItem(data[diff2.index]);
    }
    setPrevData(data);
  }, [data]);
  return [diffItem];
}
var isFF = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === "object" && /Firefox/i.test(navigator.userAgent);
const useOriginScroll = function(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) {
  var lockRef = reactExports.useRef(false);
  var lockTimeoutRef = reactExports.useRef(null);
  function lockScroll() {
    clearTimeout(lockTimeoutRef.current);
    lockRef.current = true;
    lockTimeoutRef.current = setTimeout(function() {
      lockRef.current = false;
    }, 50);
  }
  var scrollPingRef = reactExports.useRef({
    top: isScrollAtTop,
    bottom: isScrollAtBottom,
    left: isScrollAtLeft,
    right: isScrollAtRight
  });
  scrollPingRef.current.top = isScrollAtTop;
  scrollPingRef.current.bottom = isScrollAtBottom;
  scrollPingRef.current.left = isScrollAtLeft;
  scrollPingRef.current.right = isScrollAtRight;
  return function(isHorizontal, delta) {
    var smoothOffset = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
    var originScroll = isHorizontal ? (
      // Pass origin wheel when on the left
      delta < 0 && scrollPingRef.current.left || // Pass origin wheel when on the right
      delta > 0 && scrollPingRef.current.right
    ) : delta < 0 && scrollPingRef.current.top || // Pass origin wheel when on the bottom
    delta > 0 && scrollPingRef.current.bottom;
    if (smoothOffset && originScroll) {
      clearTimeout(lockTimeoutRef.current);
      lockRef.current = false;
    } else if (!originScroll || lockRef.current) {
      lockScroll();
    }
    return !lockRef.current && originScroll;
  };
};
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll, onWheelDelta) {
  var offsetRef = reactExports.useRef(0);
  var nextFrameRef = reactExports.useRef(null);
  var wheelValueRef = reactExports.useRef(null);
  var isMouseScrollRef = reactExports.useRef(false);
  var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
  function onWheelY(e2, deltaY) {
    wrapperRaf.cancel(nextFrameRef.current);
    if (originScroll(false, deltaY))
      return;
    var event = e2;
    if (!event._virtualHandled) {
      event._virtualHandled = true;
    } else {
      return;
    }
    offsetRef.current += deltaY;
    wheelValueRef.current = deltaY;
    if (!isFF) {
      event.preventDefault();
    }
    nextFrameRef.current = wrapperRaf(function() {
      var patchMultiple = isMouseScrollRef.current ? 10 : 1;
      onWheelDelta(offsetRef.current * patchMultiple, false);
      offsetRef.current = 0;
    });
  }
  function onWheelX(event, deltaX) {
    onWheelDelta(deltaX, true);
    if (!isFF) {
      event.preventDefault();
    }
  }
  var wheelDirectionRef = reactExports.useRef(null);
  var wheelDirectionCleanRef = reactExports.useRef(null);
  function onWheel(event) {
    if (!inVirtual)
      return;
    wrapperRaf.cancel(wheelDirectionCleanRef.current);
    wheelDirectionCleanRef.current = wrapperRaf(function() {
      wheelDirectionRef.current = null;
    }, 2);
    var deltaX = event.deltaX, deltaY = event.deltaY, shiftKey = event.shiftKey;
    var mergedDeltaX = deltaX;
    var mergedDeltaY = deltaY;
    if (wheelDirectionRef.current === "sx" || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) {
      mergedDeltaX = deltaY;
      mergedDeltaY = 0;
      wheelDirectionRef.current = "sx";
    }
    var absX = Math.abs(mergedDeltaX);
    var absY = Math.abs(mergedDeltaY);
    if (wheelDirectionRef.current === null) {
      wheelDirectionRef.current = horizontalScroll && absX > absY ? "x" : "y";
    }
    if (wheelDirectionRef.current === "y") {
      onWheelY(event, mergedDeltaY);
    } else {
      onWheelX(event, mergedDeltaX);
    }
  }
  function onFireFoxScroll(event) {
    if (!inVirtual)
      return;
    isMouseScrollRef.current = event.detail === wheelValueRef.current;
  }
  return [onWheel, onFireFoxScroll];
}
function useGetSize(mergedData, getKey3, heights, itemHeight) {
  var _React$useMemo = reactExports.useMemo(function() {
    return [/* @__PURE__ */ new Map(), []];
  }, [mergedData, heights.id, itemHeight]), _React$useMemo2 = _slicedToArray(_React$useMemo, 2), key2Index = _React$useMemo2[0], bottomList = _React$useMemo2[1];
  var getSize = function getSize2(startKey) {
    var endKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : startKey;
    var startIndex = key2Index.get(startKey);
    var endIndex = key2Index.get(endKey);
    if (startIndex === void 0 || endIndex === void 0) {
      var dataLen = mergedData.length;
      for (var i2 = bottomList.length; i2 < dataLen; i2 += 1) {
        var _heights$get;
        var item = mergedData[i2];
        var key = getKey3(item);
        key2Index.set(key, i2);
        var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;
        bottomList[i2] = (bottomList[i2 - 1] || 0) + cacheHeight;
        if (key === startKey) {
          startIndex = i2;
        }
        if (key === endKey) {
          endIndex = i2;
        }
        if (startIndex !== void 0 && endIndex !== void 0) {
          break;
        }
      }
    }
    return {
      top: bottomList[startIndex - 1] || 0,
      bottom: bottomList[endIndex]
    };
  };
  return getSize;
}
var CacheMap = /* @__PURE__ */ function() {
  function CacheMap2() {
    _classCallCheck$a(this, CacheMap2);
    _defineProperty$4(this, "maps", void 0);
    _defineProperty$4(this, "id", 0);
    _defineProperty$4(this, "diffRecords", /* @__PURE__ */ new Map());
    this.maps = /* @__PURE__ */ Object.create(null);
  }
  _createClass$8(CacheMap2, [{
    key: "set",
    value: function set2(key, value2) {
      this.diffRecords.set(key, this.maps[key]);
      this.maps[key] = value2;
      this.id += 1;
    }
  }, {
    key: "get",
    value: function get5(key) {
      return this.maps[key];
    }
    /**
     * CacheMap will record the key changed.
     * To help to know what's update in the next render.
     */
  }, {
    key: "resetRecord",
    value: function resetRecord() {
      this.diffRecords.clear();
    }
  }, {
    key: "getRecord",
    value: function getRecord() {
      return this.diffRecords;
    }
  }]);
  return CacheMap2;
}();
function parseNumber(value2) {
  var num = parseFloat(value2);
  return isNaN(num) ? 0 : num;
}
function useHeights(getKey3, onItemAdd, onItemRemove) {
  var _React$useState = reactExports.useState(0), _React$useState2 = _slicedToArray(_React$useState, 2), updatedMark = _React$useState2[0], setUpdatedMark = _React$useState2[1];
  var instanceRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var heightsRef = reactExports.useRef(new CacheMap());
  var promiseIdRef = reactExports.useRef(0);
  function cancelRaf() {
    promiseIdRef.current += 1;
  }
  function collectHeight() {
    var sync = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
    cancelRaf();
    var doCollect = function doCollect2() {
      var changed = false;
      instanceRef.current.forEach(function(element2, key) {
        if (element2 && element2.offsetParent) {
          var offsetHeight = element2.offsetHeight;
          var _getComputedStyle = getComputedStyle(element2), marginTop = _getComputedStyle.marginTop, marginBottom = _getComputedStyle.marginBottom;
          var marginTopNum = parseNumber(marginTop);
          var marginBottomNum = parseNumber(marginBottom);
          var totalHeight = offsetHeight + marginTopNum + marginBottomNum;
          if (heightsRef.current.get(key) !== totalHeight) {
            heightsRef.current.set(key, totalHeight);
            changed = true;
          }
        }
      });
      if (changed) {
        setUpdatedMark(function(c2) {
          return c2 + 1;
        });
      }
    };
    if (sync) {
      doCollect();
    } else {
      promiseIdRef.current += 1;
      var id2 = promiseIdRef.current;
      Promise.resolve().then(function() {
        if (id2 === promiseIdRef.current) {
          doCollect();
        }
      });
    }
  }
  function setInstanceRef(item, instance2) {
    var key = getKey3(item);
    instanceRef.current.get(key);
    if (instance2) {
      instanceRef.current.set(key, instance2);
      collectHeight();
    } else {
      instanceRef.current.delete(key);
    }
  }
  reactExports.useEffect(function() {
    return cancelRaf;
  }, []);
  return [setInstanceRef, collectHeight, heightsRef.current, updatedMark];
}
var SMOOTH_PTG = 14 / 15;
function useMobileTouchMove(inVirtual, listRef, callback2) {
  var touchedRef = reactExports.useRef(false);
  var touchXRef = reactExports.useRef(0);
  var touchYRef = reactExports.useRef(0);
  var elementRef = reactExports.useRef(null);
  var intervalRef = reactExports.useRef(null);
  var cleanUpEvents;
  var onTouchMove = function onTouchMove2(e2) {
    if (touchedRef.current) {
      var currentX = Math.ceil(e2.touches[0].pageX);
      var currentY = Math.ceil(e2.touches[0].pageY);
      var offsetX = touchXRef.current - currentX;
      var offsetY = touchYRef.current - currentY;
      var _isHorizontal = Math.abs(offsetX) > Math.abs(offsetY);
      if (_isHorizontal) {
        touchXRef.current = currentX;
      } else {
        touchYRef.current = currentY;
      }
      var scrollHandled = callback2(_isHorizontal, _isHorizontal ? offsetX : offsetY, false, e2);
      if (scrollHandled) {
        e2.preventDefault();
      }
      clearInterval(intervalRef.current);
      if (scrollHandled) {
        intervalRef.current = setInterval(function() {
          if (_isHorizontal) {
            offsetX *= SMOOTH_PTG;
          } else {
            offsetY *= SMOOTH_PTG;
          }
          var offset2 = Math.floor(_isHorizontal ? offsetX : offsetY);
          if (!callback2(_isHorizontal, offset2, true) || Math.abs(offset2) <= 0.1) {
            clearInterval(intervalRef.current);
          }
        }, 16);
      }
    }
  };
  var onTouchEnd = function onTouchEnd2() {
    touchedRef.current = false;
    cleanUpEvents();
  };
  var onTouchStart = function onTouchStart2(e2) {
    cleanUpEvents();
    if (e2.touches.length === 1 && !touchedRef.current) {
      touchedRef.current = true;
      touchXRef.current = Math.ceil(e2.touches[0].pageX);
      touchYRef.current = Math.ceil(e2.touches[0].pageY);
      elementRef.current = e2.target;
      elementRef.current.addEventListener("touchmove", onTouchMove, {
        passive: false
      });
      elementRef.current.addEventListener("touchend", onTouchEnd, {
        passive: true
      });
    }
  };
  cleanUpEvents = function cleanUpEvents2() {
    if (elementRef.current) {
      elementRef.current.removeEventListener("touchmove", onTouchMove);
      elementRef.current.removeEventListener("touchend", onTouchEnd);
    }
  };
  useLayoutEffect$1(function() {
    if (inVirtual) {
      listRef.current.addEventListener("touchstart", onTouchStart, {
        passive: true
      });
    }
    return function() {
      var _listRef$current;
      (_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.removeEventListener("touchstart", onTouchStart);
      cleanUpEvents();
      clearInterval(intervalRef.current);
    };
  }, [inVirtual]);
}
function smoothScrollOffset(offset2) {
  return Math.floor(Math.pow(offset2, 0.5));
}
function getPageXY(e2, horizontal) {
  var obj = "touches" in e2 ? e2.touches[0] : e2;
  return obj[horizontal ? "pageX" : "pageY"] - window[horizontal ? "scrollX" : "scrollY"];
}
function useScrollDrag(inVirtual, componentRef, onScrollOffset) {
  reactExports.useEffect(function() {
    var ele = componentRef.current;
    if (inVirtual && ele) {
      var mouseDownLock = false;
      var rafId;
      var _offset;
      var stopScroll = function stopScroll2() {
        wrapperRaf.cancel(rafId);
      };
      var continueScroll = function continueScroll2() {
        stopScroll();
        rafId = wrapperRaf(function() {
          onScrollOffset(_offset);
          continueScroll2();
        });
      };
      var onMouseDown = function onMouseDown2(e2) {
        if (e2.target.draggable || e2.button !== 0) {
          return;
        }
        var event = e2;
        if (!event._virtualHandled) {
          event._virtualHandled = true;
          mouseDownLock = true;
        }
      };
      var onMouseUp = function onMouseUp2() {
        mouseDownLock = false;
        stopScroll();
      };
      var onMouseMove = function onMouseMove2(e2) {
        if (mouseDownLock) {
          var mouseY = getPageXY(e2, false);
          var _ele$getBoundingClien = ele.getBoundingClientRect(), top2 = _ele$getBoundingClien.top, bottom2 = _ele$getBoundingClien.bottom;
          if (mouseY <= top2) {
            var diff2 = top2 - mouseY;
            _offset = -smoothScrollOffset(diff2);
            continueScroll();
          } else if (mouseY >= bottom2) {
            var _diff = mouseY - bottom2;
            _offset = smoothScrollOffset(_diff);
            continueScroll();
          } else {
            stopScroll();
          }
        }
      };
      ele.addEventListener("mousedown", onMouseDown);
      ele.ownerDocument.addEventListener("mouseup", onMouseUp);
      ele.ownerDocument.addEventListener("mousemove", onMouseMove);
      return function() {
        ele.removeEventListener("mousedown", onMouseDown);
        ele.ownerDocument.removeEventListener("mouseup", onMouseUp);
        ele.ownerDocument.removeEventListener("mousemove", onMouseMove);
        stopScroll();
      };
    }
  }, [inVirtual]);
}
var MAX_TIMES = 10;
function useScrollTo(containerRef, data, heights, itemHeight, getKey3, collectHeight, syncScrollTop, triggerFlash) {
  var scrollRef = reactExports.useRef();
  var _React$useState = reactExports.useState(null), _React$useState2 = _slicedToArray(_React$useState, 2), syncState = _React$useState2[0], setSyncState = _React$useState2[1];
  useLayoutEffect$1(function() {
    if (syncState && syncState.times < MAX_TIMES) {
      if (!containerRef.current) {
        setSyncState(function(ori) {
          return _objectSpread2({}, ori);
        });
        return;
      }
      collectHeight();
      var targetAlign = syncState.targetAlign, originAlign = syncState.originAlign, index2 = syncState.index, offset2 = syncState.offset;
      var height = containerRef.current.clientHeight;
      var needCollectHeight = false;
      var newTargetAlign = targetAlign;
      var targetTop = null;
      if (height) {
        var mergedAlign = targetAlign || originAlign;
        var stackTop = 0;
        var itemTop = 0;
        var itemBottom = 0;
        var maxLen = Math.min(data.length - 1, index2);
        for (var i2 = 0; i2 <= maxLen; i2 += 1) {
          var key = getKey3(data[i2]);
          itemTop = stackTop;
          var cacheHeight = heights.get(key);
          itemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
          stackTop = itemBottom;
        }
        var leftHeight = mergedAlign === "top" ? offset2 : height - offset2;
        for (var _i = maxLen; _i >= 0; _i -= 1) {
          var _key = getKey3(data[_i]);
          var _cacheHeight = heights.get(_key);
          if (_cacheHeight === void 0) {
            needCollectHeight = true;
            break;
          }
          leftHeight -= _cacheHeight;
          if (leftHeight <= 0) {
            break;
          }
        }
        switch (mergedAlign) {
          case "top":
            targetTop = itemTop - offset2;
            break;
          case "bottom":
            targetTop = itemBottom - height + offset2;
            break;
          default: {
            var scrollTop = containerRef.current.scrollTop;
            var scrollBottom = scrollTop + height;
            if (itemTop < scrollTop) {
              newTargetAlign = "top";
            } else if (itemBottom > scrollBottom) {
              newTargetAlign = "bottom";
            }
          }
        }
        if (targetTop !== null) {
          syncScrollTop(targetTop);
        }
        if (targetTop !== syncState.lastTop) {
          needCollectHeight = true;
        }
      }
      if (needCollectHeight) {
        setSyncState(_objectSpread2(_objectSpread2({}, syncState), {}, {
          times: syncState.times + 1,
          targetAlign: newTargetAlign,
          lastTop: targetTop
        }));
      }
    }
  }, [syncState, containerRef.current]);
  return function(arg) {
    if (arg === null || arg === void 0) {
      triggerFlash();
      return;
    }
    wrapperRaf.cancel(scrollRef.current);
    if (typeof arg === "number") {
      syncScrollTop(arg);
    } else if (arg && _typeof$2(arg) === "object") {
      var index2;
      var align = arg.align;
      if ("index" in arg) {
        index2 = arg.index;
      } else {
        index2 = data.findIndex(function(item) {
          return getKey3(item) === arg.key;
        });
      }
      var _arg$offset = arg.offset, offset2 = _arg$offset === void 0 ? 0 : _arg$offset;
      setSyncState({
        times: 0,
        index: index2,
        offset: offset2,
        originAlign: align
      });
    }
  };
}
var ScrollBar = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var prefixCls = props.prefixCls, rtl = props.rtl, scrollOffset = props.scrollOffset, scrollRange = props.scrollRange, onStartMove = props.onStartMove, onStopMove = props.onStopMove, onScroll6 = props.onScroll, horizontal = props.horizontal, spinSize = props.spinSize, containerSize = props.containerSize, style2 = props.style, propsThumbStyle = props.thumbStyle, showScrollBar = props.showScrollBar;
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), dragging = _React$useState2[0], setDragging = _React$useState2[1];
  var _React$useState3 = reactExports.useState(null), _React$useState4 = _slicedToArray(_React$useState3, 2), pageXY = _React$useState4[0], setPageXY = _React$useState4[1];
  var _React$useState5 = reactExports.useState(null), _React$useState6 = _slicedToArray(_React$useState5, 2), startTop = _React$useState6[0], setStartTop = _React$useState6[1];
  var isLTR = !rtl;
  var scrollbarRef = reactExports.useRef();
  var thumbRef = reactExports.useRef();
  var _React$useState7 = reactExports.useState(showScrollBar), _React$useState8 = _slicedToArray(_React$useState7, 2), visible = _React$useState8[0], setVisible = _React$useState8[1];
  var visibleTimeoutRef = reactExports.useRef();
  var delayHidden = function delayHidden2() {
    if (showScrollBar === true || showScrollBar === false)
      return;
    clearTimeout(visibleTimeoutRef.current);
    setVisible(true);
    visibleTimeoutRef.current = setTimeout(function() {
      setVisible(false);
    }, 3e3);
  };
  var enableScrollRange = scrollRange - containerSize || 0;
  var enableOffsetRange = containerSize - spinSize || 0;
  var top2 = reactExports.useMemo(function() {
    if (scrollOffset === 0 || enableScrollRange === 0) {
      return 0;
    }
    var ptg = scrollOffset / enableScrollRange;
    return ptg * enableOffsetRange;
  }, [scrollOffset, enableScrollRange, enableOffsetRange]);
  var onContainerMouseDown = function onContainerMouseDown2(e2) {
    e2.stopPropagation();
    e2.preventDefault();
  };
  var stateRef = reactExports.useRef({
    top: top2,
    dragging,
    pageY: pageXY,
    startTop
  });
  stateRef.current = {
    top: top2,
    dragging,
    pageY: pageXY,
    startTop
  };
  var onThumbMouseDown = function onThumbMouseDown2(e2) {
    setDragging(true);
    setPageXY(getPageXY(e2, horizontal));
    setStartTop(stateRef.current.top);
    onStartMove();
    e2.stopPropagation();
    e2.preventDefault();
  };
  reactExports.useEffect(function() {
    var onScrollbarTouchStart = function onScrollbarTouchStart2(e2) {
      e2.preventDefault();
    };
    var scrollbarEle = scrollbarRef.current;
    var thumbEle = thumbRef.current;
    scrollbarEle.addEventListener("touchstart", onScrollbarTouchStart, {
      passive: false
    });
    thumbEle.addEventListener("touchstart", onThumbMouseDown, {
      passive: false
    });
    return function() {
      scrollbarEle.removeEventListener("touchstart", onScrollbarTouchStart);
      thumbEle.removeEventListener("touchstart", onThumbMouseDown);
    };
  }, []);
  var enableScrollRangeRef = reactExports.useRef();
  enableScrollRangeRef.current = enableScrollRange;
  var enableOffsetRangeRef = reactExports.useRef();
  enableOffsetRangeRef.current = enableOffsetRange;
  reactExports.useEffect(function() {
    if (dragging) {
      var moveRafId;
      var onMouseMove = function onMouseMove2(e2) {
        var _stateRef$current = stateRef.current, stateDragging = _stateRef$current.dragging, statePageY = _stateRef$current.pageY, stateStartTop = _stateRef$current.startTop;
        wrapperRaf.cancel(moveRafId);
        var rect = scrollbarRef.current.getBoundingClientRect();
        var scale2 = containerSize / (horizontal ? rect.width : rect.height);
        if (stateDragging) {
          var offset2 = (getPageXY(e2, horizontal) - statePageY) * scale2;
          var newTop = stateStartTop;
          if (!isLTR && horizontal) {
            newTop -= offset2;
          } else {
            newTop += offset2;
          }
          var tmpEnableScrollRange = enableScrollRangeRef.current;
          var tmpEnableOffsetRange = enableOffsetRangeRef.current;
          var ptg = tmpEnableOffsetRange ? newTop / tmpEnableOffsetRange : 0;
          var newScrollTop = Math.ceil(ptg * tmpEnableScrollRange);
          newScrollTop = Math.max(newScrollTop, 0);
          newScrollTop = Math.min(newScrollTop, tmpEnableScrollRange);
          moveRafId = wrapperRaf(function() {
            onScroll6(newScrollTop, horizontal);
          });
        }
      };
      var onMouseUp = function onMouseUp2() {
        setDragging(false);
        onStopMove();
      };
      window.addEventListener("mousemove", onMouseMove, {
        passive: true
      });
      window.addEventListener("touchmove", onMouseMove, {
        passive: true
      });
      window.addEventListener("mouseup", onMouseUp, {
        passive: true
      });
      window.addEventListener("touchend", onMouseUp, {
        passive: true
      });
      return function() {
        window.removeEventListener("mousemove", onMouseMove);
        window.removeEventListener("touchmove", onMouseMove);
        window.removeEventListener("mouseup", onMouseUp);
        window.removeEventListener("touchend", onMouseUp);
        wrapperRaf.cancel(moveRafId);
      };
    }
  }, [dragging]);
  reactExports.useEffect(function() {
    delayHidden();
    return function() {
      clearTimeout(visibleTimeoutRef.current);
    };
  }, [scrollOffset]);
  reactExports.useImperativeHandle(ref, function() {
    return {
      delayHidden
    };
  });
  var scrollbarPrefixCls = "".concat(prefixCls, "-scrollbar");
  var containerStyle = {
    position: "absolute",
    visibility: visible ? null : "hidden"
  };
  var thumbStyle = {
    position: "absolute",
    borderRadius: 99,
    background: "var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))",
    cursor: "pointer",
    userSelect: "none"
  };
  if (horizontal) {
    Object.assign(containerStyle, {
      height: 8,
      left: 0,
      right: 0,
      bottom: 0
    });
    Object.assign(thumbStyle, _defineProperty$4({
      height: "100%",
      width: spinSize
    }, isLTR ? "left" : "right", top2));
  } else {
    Object.assign(containerStyle, _defineProperty$4({
      width: 8,
      top: 0,
      bottom: 0
    }, isLTR ? "right" : "left", 0));
    Object.assign(thumbStyle, {
      width: "100%",
      height: spinSize,
      top: top2
    });
  }
  return /* @__PURE__ */ reactExports.createElement("div", {
    ref: scrollbarRef,
    className: classNames(scrollbarPrefixCls, _defineProperty$4(_defineProperty$4(_defineProperty$4({}, "".concat(scrollbarPrefixCls, "-horizontal"), horizontal), "".concat(scrollbarPrefixCls, "-vertical"), !horizontal), "".concat(scrollbarPrefixCls, "-visible"), visible)),
    style: _objectSpread2(_objectSpread2({}, containerStyle), style2),
    onMouseDown: onContainerMouseDown,
    onMouseMove: delayHidden
  }, /* @__PURE__ */ reactExports.createElement("div", {
    ref: thumbRef,
    className: classNames("".concat(scrollbarPrefixCls, "-thumb"), _defineProperty$4({}, "".concat(scrollbarPrefixCls, "-thumb-moving"), dragging)),
    style: _objectSpread2(_objectSpread2({}, thumbStyle), propsThumbStyle),
    onMouseDown: onThumbMouseDown
  }));
});
var MIN_SIZE = 20;
function getSpinSize() {
  var containerSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
  var scrollRange = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var baseSize = containerSize / scrollRange * containerSize;
  if (isNaN(baseSize)) {
    baseSize = 0;
  }
  baseSize = Math.max(baseSize, MIN_SIZE);
  return Math.floor(baseSize);
}
var _excluded$n = ["prefixCls", "className", "height", "itemHeight", "fullHeight", "style", "data", "children", "itemKey", "virtual", "direction", "scrollWidth", "component", "onScroll", "onVirtualScroll", "onVisibleChange", "innerProps", "extraRender", "styles", "showScrollBar"];
var EMPTY_DATA = [];
var ScrollStyle = {
  overflowY: "auto",
  overflowAnchor: "none"
};
function RawList(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-virtual-list" : _props$prefixCls, className = props.className, height = props.height, itemHeight = props.itemHeight, _props$fullHeight = props.fullHeight, fullHeight = _props$fullHeight === void 0 ? true : _props$fullHeight, style2 = props.style, data = props.data, children = props.children, itemKey2 = props.itemKey, virtual = props.virtual, direction = props.direction, scrollWidth = props.scrollWidth, _props$component = props.component, Component2 = _props$component === void 0 ? "div" : _props$component, onScroll6 = props.onScroll, onVirtualScroll = props.onVirtualScroll, onVisibleChange = props.onVisibleChange, innerProps = props.innerProps, extraRender = props.extraRender, styles2 = props.styles, _props$showScrollBar = props.showScrollBar, showScrollBar = _props$showScrollBar === void 0 ? "optional" : _props$showScrollBar, restProps = _objectWithoutProperties$3(props, _excluded$n);
  var getKey3 = reactExports.useCallback(function(item) {
    if (typeof itemKey2 === "function") {
      return itemKey2(item);
    }
    return item === null || item === void 0 ? void 0 : item[itemKey2];
  }, [itemKey2]);
  var _useHeights = useHeights(getKey3), _useHeights2 = _slicedToArray(_useHeights, 4), setInstanceRef = _useHeights2[0], collectHeight = _useHeights2[1], heights = _useHeights2[2], heightUpdatedMark = _useHeights2[3];
  var useVirtual = !!(virtual !== false && height && itemHeight);
  var containerHeight = reactExports.useMemo(function() {
    return Object.values(heights.maps).reduce(function(total, curr) {
      return total + curr;
    }, 0);
  }, [heights.id, heights.maps]);
  var inVirtual = useVirtual && data && (Math.max(itemHeight * data.length, containerHeight) > height || !!scrollWidth);
  var isRTL = direction === "rtl";
  var mergedClassName = classNames(prefixCls, _defineProperty$4({}, "".concat(prefixCls, "-rtl"), isRTL), className);
  var mergedData = data || EMPTY_DATA;
  var componentRef = reactExports.useRef();
  var fillerInnerRef = reactExports.useRef();
  var containerRef = reactExports.useRef();
  var _useState = reactExports.useState(0), _useState2 = _slicedToArray(_useState, 2), offsetTop = _useState2[0], setOffsetTop = _useState2[1];
  var _useState3 = reactExports.useState(0), _useState4 = _slicedToArray(_useState3, 2), offsetLeft = _useState4[0], setOffsetLeft = _useState4[1];
  var _useState5 = reactExports.useState(false), _useState6 = _slicedToArray(_useState5, 2), scrollMoving = _useState6[0], setScrollMoving = _useState6[1];
  var onScrollbarStartMove = function onScrollbarStartMove2() {
    setScrollMoving(true);
  };
  var onScrollbarStopMove = function onScrollbarStopMove2() {
    setScrollMoving(false);
  };
  var sharedConfig = {
    getKey: getKey3
  };
  function syncScrollTop(newTop) {
    setOffsetTop(function(origin2) {
      var value2;
      if (typeof newTop === "function") {
        value2 = newTop(origin2);
      } else {
        value2 = newTop;
      }
      var alignedTop = keepInRange(value2);
      componentRef.current.scrollTop = alignedTop;
      return alignedTop;
    });
  }
  var rangeRef = reactExports.useRef({
    start: 0,
    end: mergedData.length
  });
  var diffItemRef = reactExports.useRef();
  var _useDiffItem = useDiffItem(mergedData, getKey3), _useDiffItem2 = _slicedToArray(_useDiffItem, 1), diffItem = _useDiffItem2[0];
  diffItemRef.current = diffItem;
  var _React$useMemo = reactExports.useMemo(function() {
    if (!useVirtual) {
      return {
        scrollHeight: void 0,
        start: 0,
        end: mergedData.length - 1,
        offset: void 0
      };
    }
    if (!inVirtual) {
      var _fillerInnerRef$curre;
      return {
        scrollHeight: ((_fillerInnerRef$curre = fillerInnerRef.current) === null || _fillerInnerRef$curre === void 0 ? void 0 : _fillerInnerRef$curre.offsetHeight) || 0,
        start: 0,
        end: mergedData.length - 1,
        offset: void 0
      };
    }
    var itemTop = 0;
    var startIndex;
    var startOffset;
    var endIndex;
    var dataLen = mergedData.length;
    for (var i2 = 0; i2 < dataLen; i2 += 1) {
      var _item = mergedData[i2];
      var key = getKey3(_item);
      var cacheHeight = heights.get(key);
      var currentItemBottom = itemTop + (cacheHeight === void 0 ? itemHeight : cacheHeight);
      if (currentItemBottom >= offsetTop && startIndex === void 0) {
        startIndex = i2;
        startOffset = itemTop;
      }
      if (currentItemBottom > offsetTop + height && endIndex === void 0) {
        endIndex = i2;
      }
      itemTop = currentItemBottom;
    }
    if (startIndex === void 0) {
      startIndex = 0;
      startOffset = 0;
      endIndex = Math.ceil(height / itemHeight);
    }
    if (endIndex === void 0) {
      endIndex = mergedData.length - 1;
    }
    endIndex = Math.min(endIndex + 1, mergedData.length - 1);
    return {
      scrollHeight: itemTop,
      start: startIndex,
      end: endIndex,
      offset: startOffset
    };
  }, [inVirtual, useVirtual, offsetTop, mergedData, heightUpdatedMark, height]), scrollHeight = _React$useMemo.scrollHeight, start = _React$useMemo.start, end = _React$useMemo.end, fillerOffset = _React$useMemo.offset;
  rangeRef.current.start = start;
  rangeRef.current.end = end;
  reactExports.useLayoutEffect(function() {
    var changedRecord = heights.getRecord();
    if (changedRecord.size === 1) {
      var recordKey = Array.from(changedRecord.keys())[0];
      var prevCacheHeight = changedRecord.get(recordKey);
      var startItem = mergedData[start];
      if (startItem && prevCacheHeight === void 0) {
        var startIndexKey = getKey3(startItem);
        if (startIndexKey === recordKey) {
          var realStartHeight = heights.get(recordKey);
          var diffHeight = realStartHeight - itemHeight;
          syncScrollTop(function(ori) {
            return ori + diffHeight;
          });
        }
      }
    }
    heights.resetRecord();
  }, [scrollHeight]);
  var _React$useState = reactExports.useState({
    width: 0,
    height
  }), _React$useState2 = _slicedToArray(_React$useState, 2), size2 = _React$useState2[0], setSize = _React$useState2[1];
  var onHolderResize = function onHolderResize2(sizeInfo) {
    setSize({
      width: sizeInfo.offsetWidth,
      height: sizeInfo.offsetHeight
    });
  };
  var verticalScrollBarRef = reactExports.useRef();
  var horizontalScrollBarRef = reactExports.useRef();
  var horizontalScrollBarSpinSize = reactExports.useMemo(function() {
    return getSpinSize(size2.width, scrollWidth);
  }, [size2.width, scrollWidth]);
  var verticalScrollBarSpinSize = reactExports.useMemo(function() {
    return getSpinSize(size2.height, scrollHeight);
  }, [size2.height, scrollHeight]);
  var maxScrollHeight = scrollHeight - height;
  var maxScrollHeightRef = reactExports.useRef(maxScrollHeight);
  maxScrollHeightRef.current = maxScrollHeight;
  function keepInRange(newScrollTop) {
    var newTop = newScrollTop;
    if (!Number.isNaN(maxScrollHeightRef.current)) {
      newTop = Math.min(newTop, maxScrollHeightRef.current);
    }
    newTop = Math.max(newTop, 0);
    return newTop;
  }
  var isScrollAtTop = offsetTop <= 0;
  var isScrollAtBottom = offsetTop >= maxScrollHeight;
  var isScrollAtLeft = offsetLeft <= 0;
  var isScrollAtRight = offsetLeft >= scrollWidth;
  var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);
  var getVirtualScrollInfo = function getVirtualScrollInfo2() {
    return {
      x: isRTL ? -offsetLeft : offsetLeft,
      y: offsetTop
    };
  };
  var lastVirtualScrollInfoRef = reactExports.useRef(getVirtualScrollInfo());
  var triggerScroll = useEvent$2(function(params) {
    if (onVirtualScroll) {
      var nextInfo = _objectSpread2(_objectSpread2({}, getVirtualScrollInfo()), params);
      if (lastVirtualScrollInfoRef.current.x !== nextInfo.x || lastVirtualScrollInfoRef.current.y !== nextInfo.y) {
        onVirtualScroll(nextInfo);
        lastVirtualScrollInfoRef.current = nextInfo;
      }
    }
  });
  function onScrollBar(newScrollOffset, horizontal) {
    var newOffset = newScrollOffset;
    if (horizontal) {
      reactDomExports.flushSync(function() {
        setOffsetLeft(newOffset);
      });
      triggerScroll();
    } else {
      syncScrollTop(newOffset);
    }
  }
  function onFallbackScroll(e2) {
    var newScrollTop = e2.currentTarget.scrollTop;
    if (newScrollTop !== offsetTop) {
      syncScrollTop(newScrollTop);
    }
    onScroll6 === null || onScroll6 === void 0 || onScroll6(e2);
    triggerScroll();
  }
  var keepInHorizontalRange = function keepInHorizontalRange2(nextOffsetLeft) {
    var tmpOffsetLeft = nextOffsetLeft;
    var max2 = !!scrollWidth ? scrollWidth - size2.width : 0;
    tmpOffsetLeft = Math.max(tmpOffsetLeft, 0);
    tmpOffsetLeft = Math.min(tmpOffsetLeft, max2);
    return tmpOffsetLeft;
  };
  var onWheelDelta = useEvent$2(function(offsetXY, fromHorizontal) {
    if (fromHorizontal) {
      reactDomExports.flushSync(function() {
        setOffsetLeft(function(left2) {
          var nextOffsetLeft = left2 + (isRTL ? -offsetXY : offsetXY);
          return keepInHorizontalRange(nextOffsetLeft);
        });
      });
      triggerScroll();
    } else {
      syncScrollTop(function(top2) {
        var newTop = top2 + offsetXY;
        return newTop;
      });
    }
  });
  var _useFrameWheel = useFrameWheel(useVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, !!scrollWidth, onWheelDelta), _useFrameWheel2 = _slicedToArray(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1];
  useMobileTouchMove(useVirtual, componentRef, function(isHorizontal, delta, smoothOffset, e2) {
    var event = e2;
    if (originScroll(isHorizontal, delta, smoothOffset)) {
      return false;
    }
    if (!event || !event._virtualHandled) {
      if (event) {
        event._virtualHandled = true;
      }
      onRawWheel({
        preventDefault: function preventDefault2() {
        },
        deltaX: isHorizontal ? delta : 0,
        deltaY: isHorizontal ? 0 : delta
      });
      return true;
    }
    return false;
  });
  useScrollDrag(inVirtual, componentRef, function(offset2) {
    syncScrollTop(function(top2) {
      return top2 + offset2;
    });
  });
  useLayoutEffect$1(function() {
    function onMozMousePixelScroll(e2) {
      var scrollingUpAtTop = isScrollAtTop && e2.detail < 0;
      var scrollingDownAtBottom = isScrollAtBottom && e2.detail > 0;
      if (useVirtual && !scrollingUpAtTop && !scrollingDownAtBottom) {
        e2.preventDefault();
      }
    }
    var componentEle = componentRef.current;
    componentEle.addEventListener("wheel", onRawWheel, {
      passive: false
    });
    componentEle.addEventListener("DOMMouseScroll", onFireFoxScroll, {
      passive: true
    });
    componentEle.addEventListener("MozMousePixelScroll", onMozMousePixelScroll, {
      passive: false
    });
    return function() {
      componentEle.removeEventListener("wheel", onRawWheel);
      componentEle.removeEventListener("DOMMouseScroll", onFireFoxScroll);
      componentEle.removeEventListener("MozMousePixelScroll", onMozMousePixelScroll);
    };
  }, [useVirtual, isScrollAtTop, isScrollAtBottom]);
  useLayoutEffect$1(function() {
    if (scrollWidth) {
      var newOffsetLeft = keepInHorizontalRange(offsetLeft);
      setOffsetLeft(newOffsetLeft);
      triggerScroll({
        x: newOffsetLeft
      });
    }
  }, [size2.width, scrollWidth]);
  var delayHideScrollBar = function delayHideScrollBar2() {
    var _verticalScrollBarRef, _horizontalScrollBarR;
    (_verticalScrollBarRef = verticalScrollBarRef.current) === null || _verticalScrollBarRef === void 0 || _verticalScrollBarRef.delayHidden();
    (_horizontalScrollBarR = horizontalScrollBarRef.current) === null || _horizontalScrollBarR === void 0 || _horizontalScrollBarR.delayHidden();
  };
  var _scrollTo = useScrollTo(componentRef, mergedData, heights, itemHeight, getKey3, function() {
    return collectHeight(true);
  }, syncScrollTop, delayHideScrollBar);
  reactExports.useImperativeHandle(ref, function() {
    return {
      nativeElement: containerRef.current,
      getScrollInfo: getVirtualScrollInfo,
      scrollTo: function scrollTo(config2) {
        function isPosScroll(arg) {
          return arg && _typeof$2(arg) === "object" && ("left" in arg || "top" in arg);
        }
        if (isPosScroll(config2)) {
          if (config2.left !== void 0) {
            setOffsetLeft(keepInHorizontalRange(config2.left));
          }
          _scrollTo(config2.top);
        } else {
          _scrollTo(config2);
        }
      }
    };
  });
  useLayoutEffect$1(function() {
    if (onVisibleChange) {
      var renderList = mergedData.slice(start, end + 1);
      onVisibleChange(renderList, mergedData);
    }
  }, [start, end, mergedData]);
  var getSize = useGetSize(mergedData, getKey3, heights, itemHeight);
  var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({
    start,
    end,
    virtual: inVirtual,
    offsetX: offsetLeft,
    offsetY: fillerOffset,
    rtl: isRTL,
    getSize
  });
  var listChildren = useChildren(mergedData, start, end, scrollWidth, offsetLeft, setInstanceRef, children, sharedConfig);
  var componentStyle = null;
  if (height) {
    componentStyle = _objectSpread2(_defineProperty$4({}, fullHeight ? "height" : "maxHeight", height), ScrollStyle);
    if (useVirtual) {
      componentStyle.overflowY = "hidden";
      if (scrollWidth) {
        componentStyle.overflowX = "hidden";
      }
      if (scrollMoving) {
        componentStyle.pointerEvents = "none";
      }
    }
  }
  var containerProps = {};
  if (isRTL) {
    containerProps.dir = "rtl";
  }
  return /* @__PURE__ */ reactExports.createElement("div", _extends$j({
    ref: containerRef,
    style: _objectSpread2(_objectSpread2({}, style2), {}, {
      position: "relative"
    }),
    className: mergedClassName
  }, containerProps, restProps), /* @__PURE__ */ reactExports.createElement(RefResizeObserver, {
    onResize: onHolderResize
  }, /* @__PURE__ */ reactExports.createElement(Component2, {
    className: "".concat(prefixCls, "-holder"),
    style: componentStyle,
    ref: componentRef,
    onScroll: onFallbackScroll,
    onMouseEnter: delayHideScrollBar
  }, /* @__PURE__ */ reactExports.createElement(Filler, {
    prefixCls,
    height: scrollHeight,
    offsetX: offsetLeft,
    offsetY: fillerOffset,
    scrollWidth,
    onInnerResize: collectHeight,
    ref: fillerInnerRef,
    innerProps,
    rtl: isRTL,
    extra: extraContent
  }, listChildren))), inVirtual && scrollHeight > height && /* @__PURE__ */ reactExports.createElement(ScrollBar, {
    ref: verticalScrollBarRef,
    prefixCls,
    scrollOffset: offsetTop,
    scrollRange: scrollHeight,
    rtl: isRTL,
    onScroll: onScrollBar,
    onStartMove: onScrollbarStartMove,
    onStopMove: onScrollbarStopMove,
    spinSize: verticalScrollBarSpinSize,
    containerSize: size2.height,
    style: styles2 === null || styles2 === void 0 ? void 0 : styles2.verticalScrollBar,
    thumbStyle: styles2 === null || styles2 === void 0 ? void 0 : styles2.verticalScrollBarThumb,
    showScrollBar
  }), inVirtual && scrollWidth > size2.width && /* @__PURE__ */ reactExports.createElement(ScrollBar, {
    ref: horizontalScrollBarRef,
    prefixCls,
    scrollOffset: offsetLeft,
    scrollRange: scrollWidth,
    rtl: isRTL,
    onScroll: onScrollBar,
    onStartMove: onScrollbarStartMove,
    onStopMove: onScrollbarStopMove,
    spinSize: horizontalScrollBarSpinSize,
    containerSize: size2.width,
    horizontal: true,
    style: styles2 === null || styles2 === void 0 ? void 0 : styles2.horizontalScrollBar,
    thumbStyle: styles2 === null || styles2 === void 0 ? void 0 : styles2.horizontalScrollBarThumb,
    showScrollBar
  }));
}
var List$1 = /* @__PURE__ */ reactExports.forwardRef(RawList);
List$1.displayName = "List";
var CheckOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" } }] }, "name": "check", "theme": "outlined" };
var CheckOutlined = function CheckOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CheckOutlined$1
  }));
};
var RefIcon$1l = /* @__PURE__ */ reactExports.forwardRef(CheckOutlined);
var DownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
var DownOutlined = function DownOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DownOutlined$1
  }));
};
var RefIcon$1k = /* @__PURE__ */ reactExports.forwardRef(DownOutlined);
var SearchOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
var SearchOutlined = function SearchOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SearchOutlined$1
  }));
};
var RefIcon$1j = /* @__PURE__ */ reactExports.forwardRef(SearchOutlined);
function Popup(props) {
  var children = props.children, prefixCls = props.prefixCls, id2 = props.id, innerStyle = props.overlayInnerStyle, bodyClassName = props.bodyClassName, className = props.className, style2 = props.style;
  return /* @__PURE__ */ reactExports.createElement("div", {
    className: classNames("".concat(prefixCls, "-content"), className),
    style: style2
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: classNames("".concat(prefixCls, "-inner"), bodyClassName),
    id: id2,
    role: "tooltip",
    style: innerStyle
  }, typeof children === "function" ? children() : children));
}
var autoAdjustOverflowTopBottom = {
  shiftX: 64,
  adjustY: 1
};
var autoAdjustOverflowLeftRight = {
  adjustX: 1,
  shiftY: true
};
var targetOffset = [0, 0];
var placements$1 = {
  left: {
    points: ["cr", "cl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  },
  right: {
    points: ["cl", "cr"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  top: {
    points: ["bc", "tc"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  bottom: {
    points: ["tc", "bc"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  leftTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, -4],
    targetOffset
  },
  rightTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  rightBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [4, 0],
    targetOffset
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflowTopBottom,
    offset: [0, 4],
    targetOffset
  },
  leftBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflowLeftRight,
    offset: [-4, 0],
    targetOffset
  }
};
var _excluded$m = ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "children", "onVisibleChange", "afterVisibleChange", "transitionName", "animation", "motion", "placement", "align", "destroyTooltipOnHide", "defaultVisible", "getTooltipContainer", "overlayInnerStyle", "arrowContent", "overlay", "id", "showArrow", "classNames", "styles"];
var Tooltip$3 = function Tooltip(props, ref) {
  var overlayClassName = props.overlayClassName, _props$trigger = props.trigger, trigger = _props$trigger === void 0 ? ["hover"] : _props$trigger, _props$mouseEnterDela = props.mouseEnterDelay, mouseEnterDelay = _props$mouseEnterDela === void 0 ? 0 : _props$mouseEnterDela, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela, overlayStyle = props.overlayStyle, _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-tooltip" : _props$prefixCls, children = props.children, onVisibleChange = props.onVisibleChange, afterVisibleChange = props.afterVisibleChange, transitionName = props.transitionName, animation = props.animation, motion = props.motion, _props$placement = props.placement, placement = _props$placement === void 0 ? "right" : _props$placement, _props$align = props.align, align = _props$align === void 0 ? {} : _props$align, _props$destroyTooltip = props.destroyTooltipOnHide, destroyTooltipOnHide = _props$destroyTooltip === void 0 ? false : _props$destroyTooltip, defaultVisible = props.defaultVisible, getTooltipContainer = props.getTooltipContainer, overlayInnerStyle = props.overlayInnerStyle;
  props.arrowContent;
  var overlay = props.overlay, id2 = props.id, _props$showArrow = props.showArrow, showArrow = _props$showArrow === void 0 ? true : _props$showArrow, tooltipClassNames = props.classNames, tooltipStyles = props.styles, restProps = _objectWithoutProperties$3(props, _excluded$m);
  var mergedId = useId(id2);
  var triggerRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, function() {
    return triggerRef.current;
  });
  var extraProps = _objectSpread2({}, restProps);
  if ("visible" in props) {
    extraProps.popupVisible = props.visible;
  }
  var getPopupElement = function getPopupElement2() {
    return /* @__PURE__ */ reactExports.createElement(Popup, {
      key: "content",
      prefixCls,
      id: mergedId,
      bodyClassName: tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.body,
      overlayInnerStyle: _objectSpread2(_objectSpread2({}, overlayInnerStyle), tooltipStyles === null || tooltipStyles === void 0 ? void 0 : tooltipStyles.body)
    }, overlay);
  };
  var getChildren2 = function getChildren3() {
    var child = reactExports.Children.only(children);
    var originalProps = (child === null || child === void 0 ? void 0 : child.props) || {};
    var childProps = _objectSpread2(_objectSpread2({}, originalProps), {}, {
      "aria-describedby": overlay ? mergedId : null
    });
    return /* @__PURE__ */ reactExports.cloneElement(children, childProps);
  };
  return /* @__PURE__ */ reactExports.createElement(Trigger, _extends$j({
    popupClassName: classNames(overlayClassName, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.root),
    prefixCls,
    popup: getPopupElement,
    action: trigger,
    builtinPlacements: placements$1,
    popupPlacement: placement,
    ref: triggerRef,
    popupAlign: align,
    getPopupContainer: getTooltipContainer,
    onPopupVisibleChange: onVisibleChange,
    afterPopupVisibleChange: afterVisibleChange,
    popupTransitionName: transitionName,
    popupAnimation: animation,
    popupMotion: motion,
    defaultPopupVisible: defaultVisible,
    autoDestroy: destroyTooltipOnHide,
    mouseLeaveDelay,
    popupStyle: _objectSpread2(_objectSpread2({}, overlayStyle), tooltipStyles === null || tooltipStyles === void 0 ? void 0 : tooltipStyles.root),
    mouseEnterDelay,
    arrow: showArrow
  }, extraProps), getChildren2());
};
const Tooltip$4 = /* @__PURE__ */ reactExports.forwardRef(Tooltip$3);
function getArrowToken(token2) {
  const {
    sizePopupArrow,
    borderRadiusXS,
    borderRadiusOuter
  } = token2;
  const unitWidth = sizePopupArrow / 2;
  const ax = 0;
  const ay = unitWidth;
  const bx = borderRadiusOuter * 1 / Math.sqrt(2);
  const by = unitWidth - borderRadiusOuter * (1 - 1 / Math.sqrt(2));
  const cx = unitWidth - borderRadiusXS * (1 / Math.sqrt(2));
  const cy = borderRadiusOuter * (Math.sqrt(2) - 1) + borderRadiusXS * (1 / Math.sqrt(2));
  const dx = 2 * unitWidth - cx;
  const dy = cy;
  const ex = 2 * unitWidth - bx;
  const ey = by;
  const fx = 2 * unitWidth - ax;
  const fy = ay;
  const shadowWidth = unitWidth * Math.sqrt(2) + borderRadiusOuter * (Math.sqrt(2) - 2);
  const polygonOffset = borderRadiusOuter * (Math.sqrt(2) - 1);
  const arrowPolygon = `polygon(${polygonOffset}px 100%, 50% ${polygonOffset}px, ${2 * unitWidth - polygonOffset}px 100%, ${polygonOffset}px 100%)`;
  const arrowPath = `path('M ${ax} ${ay} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${bx} ${by} L ${cx} ${cy} A ${borderRadiusXS} ${borderRadiusXS} 0 0 1 ${dx} ${dy} L ${ex} ${ey} A ${borderRadiusOuter} ${borderRadiusOuter} 0 0 0 ${fx} ${fy} Z')`;
  return {
    arrowShadowWidth: shadowWidth,
    arrowPath,
    arrowPolygon
  };
}
const genRoundedArrow = (token2, bgColor, boxShadow2) => {
  const {
    sizePopupArrow,
    arrowPolygon,
    arrowPath,
    arrowShadowWidth,
    borderRadiusXS,
    calc
  } = token2;
  return {
    pointerEvents: "none",
    width: sizePopupArrow,
    height: sizePopupArrow,
    overflow: "hidden",
    "&::before": {
      position: "absolute",
      bottom: 0,
      insetInlineStart: 0,
      width: sizePopupArrow,
      height: calc(sizePopupArrow).div(2).equal(),
      background: bgColor,
      clipPath: {
        _multi_value_: true,
        value: [arrowPolygon, arrowPath]
      },
      content: '""'
    },
    "&::after": {
      content: '""',
      position: "absolute",
      width: arrowShadowWidth,
      height: arrowShadowWidth,
      bottom: 0,
      insetInline: 0,
      margin: "auto",
      borderRadius: {
        _skip_check_: true,
        value: `0 0 ${unit$1(borderRadiusXS)} 0`
      },
      transform: "translateY(50%) rotate(-135deg)",
      boxShadow: boxShadow2,
      zIndex: 0,
      background: "transparent"
    }
  };
};
const MAX_VERTICAL_CONTENT_RADIUS = 8;
function getArrowOffsetToken(options) {
  const {
    contentRadius,
    limitVerticalRadius
  } = options;
  const arrowOffset = contentRadius > 12 ? contentRadius + 2 : 12;
  const arrowOffsetVertical = limitVerticalRadius ? MAX_VERTICAL_CONTENT_RADIUS : arrowOffset;
  return {
    arrowOffsetHorizontal: arrowOffset,
    arrowOffsetVertical
  };
}
function isInject(valid2, code2) {
  if (!valid2) {
    return {};
  }
  return code2;
}
function getArrowStyle(token2, colorBg, options) {
  const {
    componentCls,
    boxShadowPopoverArrow,
    arrowOffsetVertical,
    arrowOffsetHorizontal
  } = token2;
  const {
    arrowDistance = 0,
    arrowPlacement = {
      left: true,
      right: true,
      top: true,
      bottom: true
    }
  } = {};
  return {
    [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({
      // ============================ Basic ============================
      [`${componentCls}-arrow`]: [Object.assign(Object.assign({
        position: "absolute",
        zIndex: 1,
        display: "block"
      }, genRoundedArrow(token2, colorBg, boxShadowPopoverArrow)), {
        "&:before": {
          background: colorBg
        }
      })]
    }, isInject(!!arrowPlacement.top, {
      [[`&-placement-top > ${componentCls}-arrow`, `&-placement-topLeft > ${componentCls}-arrow`, `&-placement-topRight > ${componentCls}-arrow`].join(",")]: {
        bottom: arrowDistance,
        transform: "translateY(100%) rotate(180deg)"
      },
      [`&-placement-top > ${componentCls}-arrow`]: {
        left: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateX(-50%) translateY(100%) rotate(180deg)"
      },
      "&-placement-topLeft": {
        "--arrow-offset-horizontal": arrowOffsetHorizontal,
        [`> ${componentCls}-arrow`]: {
          left: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      },
      "&-placement-topRight": {
        "--arrow-offset-horizontal": `calc(100% - ${unit$1(arrowOffsetHorizontal)})`,
        [`> ${componentCls}-arrow`]: {
          right: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      }
    })), isInject(!!arrowPlacement.bottom, {
      [[`&-placement-bottom > ${componentCls}-arrow`, `&-placement-bottomLeft > ${componentCls}-arrow`, `&-placement-bottomRight > ${componentCls}-arrow`].join(",")]: {
        top: arrowDistance,
        transform: `translateY(-100%)`
      },
      [`&-placement-bottom > ${componentCls}-arrow`]: {
        left: {
          _skip_check_: true,
          value: "50%"
        },
        transform: `translateX(-50%) translateY(-100%)`
      },
      "&-placement-bottomLeft": {
        "--arrow-offset-horizontal": arrowOffsetHorizontal,
        [`> ${componentCls}-arrow`]: {
          left: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      },
      "&-placement-bottomRight": {
        "--arrow-offset-horizontal": `calc(100% - ${unit$1(arrowOffsetHorizontal)})`,
        [`> ${componentCls}-arrow`]: {
          right: {
            _skip_check_: true,
            value: arrowOffsetHorizontal
          }
        }
      }
    })), isInject(!!arrowPlacement.left, {
      [[`&-placement-left > ${componentCls}-arrow`, `&-placement-leftTop > ${componentCls}-arrow`, `&-placement-leftBottom > ${componentCls}-arrow`].join(",")]: {
        right: {
          _skip_check_: true,
          value: arrowDistance
        },
        transform: "translateX(100%) rotate(90deg)"
      },
      [`&-placement-left > ${componentCls}-arrow`]: {
        top: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(100%) rotate(90deg)"
      },
      [`&-placement-leftTop > ${componentCls}-arrow`]: {
        top: arrowOffsetVertical
      },
      [`&-placement-leftBottom > ${componentCls}-arrow`]: {
        bottom: arrowOffsetVertical
      }
    })), isInject(!!arrowPlacement.right, {
      [[`&-placement-right > ${componentCls}-arrow`, `&-placement-rightTop > ${componentCls}-arrow`, `&-placement-rightBottom > ${componentCls}-arrow`].join(",")]: {
        left: {
          _skip_check_: true,
          value: arrowDistance
        },
        transform: "translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-right > ${componentCls}-arrow`]: {
        top: {
          _skip_check_: true,
          value: "50%"
        },
        transform: "translateY(-50%) translateX(-100%) rotate(-90deg)"
      },
      [`&-placement-rightTop > ${componentCls}-arrow`]: {
        top: arrowOffsetVertical
      },
      [`&-placement-rightBottom > ${componentCls}-arrow`]: {
        bottom: arrowOffsetVertical
      }
    }))
  };
}
function getOverflowOptions(placement, arrowOffset, arrowWidth, autoAdjustOverflow2) {
  if (autoAdjustOverflow2 === false) {
    return {
      adjustX: false,
      adjustY: false
    };
  }
  const overflow = autoAdjustOverflow2 && typeof autoAdjustOverflow2 === "object" ? autoAdjustOverflow2 : {};
  const baseOverflow = {};
  switch (placement) {
    case "top":
    case "bottom":
      baseOverflow.shiftX = arrowOffset.arrowOffsetHorizontal * 2 + arrowWidth;
      baseOverflow.shiftY = true;
      baseOverflow.adjustY = true;
      break;
    case "left":
    case "right":
      baseOverflow.shiftY = arrowOffset.arrowOffsetVertical * 2 + arrowWidth;
      baseOverflow.shiftX = true;
      baseOverflow.adjustX = true;
      break;
  }
  const mergedOverflow = Object.assign(Object.assign({}, baseOverflow), overflow);
  if (!mergedOverflow.shiftX) {
    mergedOverflow.adjustX = true;
  }
  if (!mergedOverflow.shiftY) {
    mergedOverflow.adjustY = true;
  }
  return mergedOverflow;
}
const PlacementAlignMap = {
  left: {
    points: ["cr", "cl"]
  },
  right: {
    points: ["cl", "cr"]
  },
  top: {
    points: ["bc", "tc"]
  },
  bottom: {
    points: ["tc", "bc"]
  },
  topLeft: {
    points: ["bl", "tl"]
  },
  leftTop: {
    points: ["tr", "tl"]
  },
  topRight: {
    points: ["br", "tr"]
  },
  rightTop: {
    points: ["tl", "tr"]
  },
  bottomRight: {
    points: ["tr", "br"]
  },
  rightBottom: {
    points: ["bl", "br"]
  },
  bottomLeft: {
    points: ["tl", "bl"]
  },
  leftBottom: {
    points: ["br", "bl"]
  }
};
const ArrowCenterPlacementAlignMap = {
  topLeft: {
    points: ["bl", "tc"]
  },
  leftTop: {
    points: ["tr", "cl"]
  },
  topRight: {
    points: ["br", "tc"]
  },
  rightTop: {
    points: ["tl", "cr"]
  },
  bottomRight: {
    points: ["tr", "bc"]
  },
  rightBottom: {
    points: ["bl", "cr"]
  },
  bottomLeft: {
    points: ["tl", "bc"]
  },
  leftBottom: {
    points: ["br", "cl"]
  }
};
const DisableAutoArrowList = /* @__PURE__ */ new Set(["topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]);
function getPlacements(config2) {
  const {
    arrowWidth,
    autoAdjustOverflow: autoAdjustOverflow2,
    arrowPointAtCenter,
    offset: offset2,
    borderRadius: borderRadius2
  } = config2;
  const halfArrowWidth = arrowWidth / 2;
  const placementMap = {};
  Object.keys(PlacementAlignMap).forEach((key) => {
    const template2 = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key];
    const placementInfo = Object.assign(Object.assign({}, template2), {
      offset: [0, 0],
      dynamicInset: true
    });
    placementMap[key] = placementInfo;
    if (DisableAutoArrowList.has(key)) {
      placementInfo.autoArrow = false;
    }
    switch (key) {
      case "top":
      case "topLeft":
      case "topRight":
        placementInfo.offset[1] = -halfArrowWidth - offset2;
        break;
      case "bottom":
      case "bottomLeft":
      case "bottomRight":
        placementInfo.offset[1] = halfArrowWidth + offset2;
        break;
      case "left":
      case "leftTop":
      case "leftBottom":
        placementInfo.offset[0] = -halfArrowWidth - offset2;
        break;
      case "right":
      case "rightTop":
      case "rightBottom":
        placementInfo.offset[0] = halfArrowWidth + offset2;
        break;
    }
    const arrowOffset = getArrowOffsetToken({
      contentRadius: borderRadius2,
      limitVerticalRadius: true
    });
    if (arrowPointAtCenter) {
      switch (key) {
        case "topLeft":
        case "bottomLeft":
          placementInfo.offset[0] = -arrowOffset.arrowOffsetHorizontal - halfArrowWidth;
          break;
        case "topRight":
        case "bottomRight":
          placementInfo.offset[0] = arrowOffset.arrowOffsetHorizontal + halfArrowWidth;
          break;
        case "leftTop":
        case "rightTop":
          placementInfo.offset[1] = -arrowOffset.arrowOffsetHorizontal * 2 + halfArrowWidth;
          break;
        case "leftBottom":
        case "rightBottom":
          placementInfo.offset[1] = arrowOffset.arrowOffsetHorizontal * 2 - halfArrowWidth;
          break;
      }
    }
    placementInfo.overflow = getOverflowOptions(key, arrowOffset, arrowWidth, autoAdjustOverflow2);
    {
      placementInfo.htmlRegion = "visibleFirst";
    }
  });
  return placementMap;
}
const genTooltipStyle = (token2) => {
  const {
    calc,
    componentCls,
    // ant-tooltip
    tooltipMaxWidth,
    tooltipColor,
    tooltipBg,
    tooltipBorderRadius,
    zIndexPopup,
    controlHeight,
    boxShadowSecondary,
    paddingSM,
    paddingXS,
    arrowOffsetHorizontal,
    sizePopupArrow
  } = token2;
  const edgeAlignMinWidth = calc(tooltipBorderRadius).add(sizePopupArrow).add(arrowOffsetHorizontal).equal();
  const centerAlignMinWidth = calc(tooltipBorderRadius).mul(2).add(sizePopupArrow).equal();
  return [
    {
      [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token2)), {
        position: "absolute",
        zIndex: zIndexPopup,
        display: "block",
        width: "max-content",
        maxWidth: tooltipMaxWidth,
        visibility: "visible",
        // When use `autoArrow`, origin will follow the arrow position
        "--valid-offset-x": "var(--arrow-offset-horizontal, var(--arrow-x))",
        transformOrigin: [`var(--valid-offset-x, 50%)`, `var(--arrow-y, 50%)`].join(" "),
        "&-hidden": {
          display: "none"
        },
        "--antd-arrow-background-color": tooltipBg,
        // Wrapper for the tooltip content
        [`${componentCls}-inner`]: {
          minWidth: centerAlignMinWidth,
          minHeight: controlHeight,
          padding: `${unit$1(token2.calc(paddingSM).div(2).equal())} ${unit$1(paddingXS)}`,
          color: tooltipColor,
          textAlign: "start",
          textDecoration: "none",
          wordWrap: "break-word",
          backgroundColor: tooltipBg,
          borderRadius: tooltipBorderRadius,
          boxShadow: boxShadowSecondary,
          boxSizing: "border-box"
        },
        // Align placement should have another min width
        [[`&-placement-topLeft`, `&-placement-topRight`, `&-placement-bottomLeft`, `&-placement-bottomRight`].join(",")]: {
          minWidth: edgeAlignMinWidth
        },
        // Limit left and right placement radius
        [[`&-placement-left`, `&-placement-leftTop`, `&-placement-leftBottom`, `&-placement-right`, `&-placement-rightTop`, `&-placement-rightBottom`].join(",")]: {
          [`${componentCls}-inner`]: {
            borderRadius: token2.min(tooltipBorderRadius, MAX_VERTICAL_CONTENT_RADIUS)
          }
        },
        [`${componentCls}-content`]: {
          position: "relative"
        }
      }), genPresetColor(token2, (colorKey, {
        darkColor
      }) => ({
        [`&${componentCls}-${colorKey}`]: {
          [`${componentCls}-inner`]: {
            backgroundColor: darkColor
          },
          [`${componentCls}-arrow`]: {
            "--antd-arrow-background-color": darkColor
          }
        }
      }))), {
        // RTL
        "&-rtl": {
          direction: "rtl"
        }
      })
    },
    // Arrow Style
    getArrowStyle(token2, "var(--antd-arrow-background-color)"),
    // Pure Render
    {
      [`${componentCls}-pure`]: {
        position: "relative",
        maxWidth: "none",
        margin: token2.sizePopupArrow
      }
    }
  ];
};
const prepareComponentToken$3 = (token2) => Object.assign(Object.assign({
  zIndexPopup: token2.zIndexPopupBase + 70
}, getArrowOffsetToken({
  contentRadius: token2.borderRadius,
  limitVerticalRadius: true
})), getArrowToken(merge$4(token2, {
  borderRadiusOuter: Math.min(token2.borderRadiusOuter, 4)
})));
const useStyle$3 = (prefixCls, injectStyle = true) => {
  const useStyle2 = genStyleHooks("Tooltip", (token2) => {
    const {
      borderRadius: borderRadius2,
      colorTextLightSolid,
      colorBgSpotlight
    } = token2;
    const TooltipToken = merge$4(token2, {
      // default variables
      tooltipMaxWidth: 250,
      tooltipColor: colorTextLightSolid,
      tooltipBorderRadius: borderRadius2,
      tooltipBg: colorBgSpotlight
    });
    return [genTooltipStyle(TooltipToken), initZoomMotion(token2, "zoom-big-fast")];
  }, prepareComponentToken$3, {
    resetStyle: false,
    // Popover use Tooltip as internal component. We do not need to handle this.
    injectStyle
  });
  return useStyle2(prefixCls);
};
const inverseColors = PresetColors.map((color2) => `${color2}-inverse`);
function isPresetColor(color2, includeInverse = true) {
  if (includeInverse) {
    return [].concat(_toConsumableArray(inverseColors), _toConsumableArray(PresetColors)).includes(color2);
  }
  return PresetColors.includes(color2);
}
function parseColor(prefixCls, color2) {
  const isInternalColor = isPresetColor(color2);
  const className = classNames({
    [`${prefixCls}-${color2}`]: color2 && isInternalColor
  });
  const overlayStyle = {};
  const arrowStyle = {};
  if (color2 && !isInternalColor) {
    overlayStyle.background = color2;
    arrowStyle["--antd-arrow-background-color"] = color2;
  }
  return {
    className,
    overlayStyle,
    arrowStyle
  };
}
const PurePanel = (props) => {
  const {
    prefixCls: customizePrefixCls,
    className,
    placement = "top",
    title,
    color: color2,
    overlayInnerStyle
  } = props;
  const {
    getPrefixCls
  } = reactExports.useContext(ConfigContext);
  const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$3(prefixCls);
  const colorInfo = parseColor(prefixCls, color2);
  const arrowContentStyle = colorInfo.arrowStyle;
  const formattedOverlayInnerStyle = Object.assign(Object.assign({}, overlayInnerStyle), colorInfo.overlayStyle);
  const cls = classNames(hashId, cssVarCls, prefixCls, `${prefixCls}-pure`, `${prefixCls}-placement-${placement}`, className, colorInfo.className);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", {
    className: cls,
    style: arrowContentStyle
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: `${prefixCls}-arrow`
  }), /* @__PURE__ */ reactExports.createElement(Popup, Object.assign({}, props, {
    className: hashId,
    prefixCls,
    overlayInnerStyle: formattedOverlayInnerStyle
  }), title)));
};
var __rest$6 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const InternalTooltip = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  var _a2, _b2;
  const {
    prefixCls: customizePrefixCls,
    openClassName,
    getTooltipContainer,
    color: color2,
    overlayInnerStyle,
    children,
    afterOpenChange,
    afterVisibleChange,
    destroyTooltipOnHide,
    destroyOnHidden,
    arrow = true,
    title,
    overlay,
    builtinPlacements,
    arrowPointAtCenter = false,
    autoAdjustOverflow: autoAdjustOverflow2 = true,
    motion,
    getPopupContainer,
    placement = "top",
    mouseEnterDelay = 0.1,
    mouseLeaveDelay = 0.1,
    overlayStyle,
    rootClassName,
    overlayClassName,
    styles: styles2,
    classNames: tooltipClassNames
  } = props, restProps = __rest$6(props, ["prefixCls", "openClassName", "getTooltipContainer", "color", "overlayInnerStyle", "children", "afterOpenChange", "afterVisibleChange", "destroyTooltipOnHide", "destroyOnHidden", "arrow", "title", "overlay", "builtinPlacements", "arrowPointAtCenter", "autoAdjustOverflow", "motion", "getPopupContainer", "placement", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "rootClassName", "overlayClassName", "styles", "classNames"]);
  const mergedShowArrow = !!arrow;
  const [, token2] = useToken();
  const {
    getPopupContainer: getContextPopupContainer,
    getPrefixCls,
    direction,
    className: contextClassName,
    style: contextStyle,
    classNames: contextClassNames,
    styles: contextStyles
  } = useComponentConfig("tooltip");
  const warning3 = devUseWarning();
  const tooltipRef = reactExports.useRef(null);
  const forceAlign = () => {
    var _a22;
    (_a22 = tooltipRef.current) === null || _a22 === void 0 ? void 0 : _a22.forceAlign();
  };
  reactExports.useImperativeHandle(ref, () => {
    var _a22, _b22;
    return {
      forceAlign,
      forcePopupAlign: () => {
        warning3.deprecated(false, "forcePopupAlign", "forceAlign");
        forceAlign();
      },
      nativeElement: (_a22 = tooltipRef.current) === null || _a22 === void 0 ? void 0 : _a22.nativeElement,
      popupElement: (_b22 = tooltipRef.current) === null || _b22 === void 0 ? void 0 : _b22.popupElement
    };
  });
  const [open, setOpen] = useMergedState$1(false, {
    value: (_a2 = props.open) !== null && _a2 !== void 0 ? _a2 : props.visible,
    defaultValue: (_b2 = props.defaultOpen) !== null && _b2 !== void 0 ? _b2 : props.defaultVisible
  });
  const noTitle = !title && !overlay && title !== 0;
  const onOpenChange = (vis) => {
    var _a22, _b22;
    setOpen(noTitle ? false : vis);
    if (!noTitle) {
      (_a22 = props.onOpenChange) === null || _a22 === void 0 ? void 0 : _a22.call(props, vis);
      (_b22 = props.onVisibleChange) === null || _b22 === void 0 ? void 0 : _b22.call(props, vis);
    }
  };
  const tooltipPlacements = reactExports.useMemo(() => {
    var _a22, _b22;
    let mergedArrowPointAtCenter = arrowPointAtCenter;
    if (typeof arrow === "object") {
      mergedArrowPointAtCenter = (_b22 = (_a22 = arrow.pointAtCenter) !== null && _a22 !== void 0 ? _a22 : arrow.arrowPointAtCenter) !== null && _b22 !== void 0 ? _b22 : arrowPointAtCenter;
    }
    return builtinPlacements || getPlacements({
      arrowPointAtCenter: mergedArrowPointAtCenter,
      autoAdjustOverflow: autoAdjustOverflow2,
      arrowWidth: mergedShowArrow ? token2.sizePopupArrow : 0,
      borderRadius: token2.borderRadius,
      offset: token2.marginXXS
    });
  }, [arrowPointAtCenter, arrow, builtinPlacements, token2]);
  const memoOverlay = reactExports.useMemo(() => {
    if (title === 0) {
      return title;
    }
    return overlay || title || "";
  }, [overlay, title]);
  const memoOverlayWrapper = /* @__PURE__ */ reactExports.createElement(ContextIsolator, {
    space: true
  }, typeof memoOverlay === "function" ? memoOverlay() : memoOverlay);
  const prefixCls = getPrefixCls("tooltip", customizePrefixCls);
  const rootPrefixCls = getPrefixCls();
  const injectFromPopover = props["data-popover-inject"];
  let tempOpen = open;
  if (!("open" in props) && !("visible" in props) && noTitle) {
    tempOpen = false;
  }
  const child = /* @__PURE__ */ reactExports.isValidElement(children) && !isFragment(children) ? children : /* @__PURE__ */ reactExports.createElement("span", null, children);
  const childProps = child.props;
  const childCls = !childProps.className || typeof childProps.className === "string" ? classNames(childProps.className, openClassName || `${prefixCls}-open`) : childProps.className;
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$3(prefixCls, !injectFromPopover);
  const colorInfo = parseColor(prefixCls, color2);
  const arrowContentStyle = colorInfo.arrowStyle;
  const rootClassNames = classNames(overlayClassName, {
    [`${prefixCls}-rtl`]: direction === "rtl"
  }, colorInfo.className, rootClassName, hashId, cssVarCls, contextClassName, contextClassNames.root, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.root);
  const bodyClassNames = classNames(contextClassNames.body, tooltipClassNames === null || tooltipClassNames === void 0 ? void 0 : tooltipClassNames.body);
  const [zIndex, contextZIndex] = useZIndex("Tooltip", restProps.zIndex);
  const content2 = /* @__PURE__ */ reactExports.createElement(Tooltip$4, Object.assign({}, restProps, {
    zIndex,
    showArrow: mergedShowArrow,
    placement,
    mouseEnterDelay,
    mouseLeaveDelay,
    prefixCls,
    classNames: {
      root: rootClassNames,
      body: bodyClassNames
    },
    styles: {
      root: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, arrowContentStyle), contextStyles.root), contextStyle), overlayStyle), styles2 === null || styles2 === void 0 ? void 0 : styles2.root),
      body: Object.assign(Object.assign(Object.assign(Object.assign({}, contextStyles.body), overlayInnerStyle), styles2 === null || styles2 === void 0 ? void 0 : styles2.body), colorInfo.overlayStyle)
    },
    getTooltipContainer: getPopupContainer || getTooltipContainer || getContextPopupContainer,
    ref: tooltipRef,
    builtinPlacements: tooltipPlacements,
    overlay: memoOverlayWrapper,
    visible: tempOpen,
    onVisibleChange: onOpenChange,
    afterVisibleChange: afterOpenChange !== null && afterOpenChange !== void 0 ? afterOpenChange : afterVisibleChange,
    arrowContent: /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-arrow-content`
    }),
    motion: {
      motionName: getTransitionName(rootPrefixCls, "zoom-big-fast", props.transitionName),
      motionDeadline: 1e3
    },
    // TODO: In the future, destroyTooltipOnHide in rc-tooltip needs to be upgrade to destroyOnHidden
    destroyTooltipOnHide: destroyOnHidden !== null && destroyOnHidden !== void 0 ? destroyOnHidden : !!destroyTooltipOnHide
  }), tempOpen ? cloneElement(child, {
    className: childCls
  }) : child);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(zIndexContext.Provider, {
    value: contextZIndex
  }, content2));
});
const Tooltip$2 = InternalTooltip;
Tooltip$2._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
var VerticalAlignTopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M859.9 168H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM518.3 355a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V848c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V509.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 355z" } }] }, "name": "vertical-align-top", "theme": "outlined" };
var VerticalAlignTopOutlined = function VerticalAlignTopOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: VerticalAlignTopOutlined$1
  }));
};
var RefIcon$1i = /* @__PURE__ */ reactExports.forwardRef(VerticalAlignTopOutlined);
var LeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, "name": "left", "theme": "outlined" };
var LeftOutlined = function LeftOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: LeftOutlined$1
  }));
};
var RefIcon$1h = /* @__PURE__ */ reactExports.forwardRef(LeftOutlined);
var IdContext = /* @__PURE__ */ reactExports.createContext(null);
function getMenuId(uuid2, eventKey) {
  if (uuid2 === void 0) {
    return null;
  }
  return "".concat(uuid2, "-").concat(eventKey);
}
function useMenuId(eventKey) {
  var id2 = reactExports.useContext(IdContext);
  return getMenuId(id2, eventKey);
}
var _excluded$l = ["children", "locked"];
var MenuContext$1 = /* @__PURE__ */ reactExports.createContext(null);
function mergeProps$2(origin2, target) {
  var clone3 = _objectSpread2({}, origin2);
  Object.keys(target).forEach(function(key) {
    var value2 = target[key];
    if (value2 !== void 0) {
      clone3[key] = value2;
    }
  });
  return clone3;
}
function InheritableContextProvider(_ref) {
  var children = _ref.children, locked = _ref.locked, restProps = _objectWithoutProperties$3(_ref, _excluded$l);
  var context = reactExports.useContext(MenuContext$1);
  var inheritableContext = useMemo(function() {
    return mergeProps$2(context, restProps);
  }, [context, restProps], function(prev2, next2) {
    return !locked && (prev2[0] !== next2[0] || !isEqual$2(prev2[1], next2[1], true));
  });
  return /* @__PURE__ */ reactExports.createElement(MenuContext$1.Provider, {
    value: inheritableContext
  }, children);
}
var EmptyList = [];
var PathRegisterContext = /* @__PURE__ */ reactExports.createContext(null);
function useMeasure() {
  return reactExports.useContext(PathRegisterContext);
}
var PathTrackerContext = /* @__PURE__ */ reactExports.createContext(EmptyList);
function useFullPath(eventKey) {
  var parentKeyPath = reactExports.useContext(PathTrackerContext);
  return reactExports.useMemo(function() {
    return eventKey !== void 0 ? [].concat(_toConsumableArray(parentKeyPath), [eventKey]) : parentKeyPath;
  }, [parentKeyPath, eventKey]);
}
var PathUserContext = /* @__PURE__ */ reactExports.createContext(null);
var PrivateContext = /* @__PURE__ */ reactExports.createContext({});
function focusable(node2) {
  var includePositive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  if (isVisible(node2)) {
    var nodeName = node2.nodeName.toLowerCase();
    var isFocusableElement = (
      // Focusable element
      ["input", "select", "textarea", "button"].includes(nodeName) || // Editable element
      node2.isContentEditable || // Anchor with href element
      nodeName === "a" && !!node2.getAttribute("href")
    );
    var tabIndexAttr = node2.getAttribute("tabindex");
    var tabIndexNum = Number(tabIndexAttr);
    var tabIndex = null;
    if (tabIndexAttr && !Number.isNaN(tabIndexNum)) {
      tabIndex = tabIndexNum;
    } else if (isFocusableElement && tabIndex === null) {
      tabIndex = 0;
    }
    if (isFocusableElement && node2.disabled) {
      tabIndex = null;
    }
    return tabIndex !== null && (tabIndex >= 0 || includePositive && tabIndex < 0);
  }
  return false;
}
function getFocusNodeList(node2) {
  var includePositive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var res = _toConsumableArray(node2.querySelectorAll("*")).filter(function(child) {
    return focusable(child, includePositive);
  });
  if (focusable(node2, includePositive)) {
    res.unshift(node2);
  }
  return res;
}
var LEFT = KeyCode$1.LEFT, RIGHT = KeyCode$1.RIGHT, UP = KeyCode$1.UP, DOWN = KeyCode$1.DOWN, ENTER$1 = KeyCode$1.ENTER, ESC = KeyCode$1.ESC, HOME = KeyCode$1.HOME, END = KeyCode$1.END;
var ArrowKeys = [UP, DOWN, LEFT, RIGHT];
function getOffset(mode, isRootLevel, isRtl, which) {
  var _offsets;
  var prev2 = "prev";
  var next2 = "next";
  var children = "children";
  var parent = "parent";
  if (mode === "inline" && which === ENTER$1) {
    return {
      inlineTrigger: true
    };
  }
  var inline2 = _defineProperty$4(_defineProperty$4({}, UP, prev2), DOWN, next2);
  var horizontal = _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4({}, LEFT, isRtl ? next2 : prev2), RIGHT, isRtl ? prev2 : next2), DOWN, children), ENTER$1, children);
  var vertical = _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4({}, UP, prev2), DOWN, next2), ENTER$1, children), ESC, parent), LEFT, isRtl ? children : parent), RIGHT, isRtl ? parent : children);
  var offsets = {
    inline: inline2,
    horizontal,
    vertical,
    inlineSub: inline2,
    horizontalSub: vertical,
    verticalSub: vertical
  };
  var type4 = (_offsets = offsets["".concat(mode).concat(isRootLevel ? "" : "Sub")]) === null || _offsets === void 0 ? void 0 : _offsets[which];
  switch (type4) {
    case prev2:
      return {
        offset: -1,
        sibling: true
      };
    case next2:
      return {
        offset: 1,
        sibling: true
      };
    case parent:
      return {
        offset: -1,
        sibling: false
      };
    case children:
      return {
        offset: 1,
        sibling: false
      };
    default:
      return null;
  }
}
function findContainerUL(element2) {
  var current = element2;
  while (current) {
    if (current.getAttribute("data-menu-list")) {
      return current;
    }
    current = current.parentElement;
  }
  return null;
}
function getFocusElement(activeElement, elements) {
  var current = activeElement || document.activeElement;
  while (current) {
    if (elements.has(current)) {
      return current;
    }
    current = current.parentElement;
  }
  return null;
}
function getFocusableElements(container, elements) {
  var list2 = getFocusNodeList(container, true);
  return list2.filter(function(ele) {
    return elements.has(ele);
  });
}
function getNextFocusElement(parentQueryContainer, elements, focusMenuElement) {
  var offset2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
  if (!parentQueryContainer) {
    return null;
  }
  var sameLevelFocusableMenuElementList = getFocusableElements(parentQueryContainer, elements);
  var count = sameLevelFocusableMenuElementList.length;
  var focusIndex = sameLevelFocusableMenuElementList.findIndex(function(ele) {
    return focusMenuElement === ele;
  });
  if (offset2 < 0) {
    if (focusIndex === -1) {
      focusIndex = count - 1;
    } else {
      focusIndex -= 1;
    }
  } else if (offset2 > 0) {
    focusIndex += 1;
  }
  focusIndex = (focusIndex + count) % count;
  return sameLevelFocusableMenuElementList[focusIndex];
}
var refreshElements = function refreshElements2(keys2, id2) {
  var elements = /* @__PURE__ */ new Set();
  var key2element = /* @__PURE__ */ new Map();
  var element2key = /* @__PURE__ */ new Map();
  keys2.forEach(function(key) {
    var element2 = document.querySelector("[data-menu-id='".concat(getMenuId(id2, key), "']"));
    if (element2) {
      elements.add(element2);
      element2key.set(element2, key);
      key2element.set(key, element2);
    }
  });
  return {
    elements,
    key2element,
    element2key
  };
};
function useAccessibility(mode, activeKey, isRtl, id2, containerRef, getKeys, getKeyPath, triggerActiveKey, triggerAccessibilityOpen, originOnKeyDown) {
  var rafRef = reactExports.useRef();
  var activeRef = reactExports.useRef();
  activeRef.current = activeKey;
  var cleanRaf = function cleanRaf2() {
    wrapperRaf.cancel(rafRef.current);
  };
  reactExports.useEffect(function() {
    return function() {
      cleanRaf();
    };
  }, []);
  return function(e2) {
    var which = e2.which;
    if ([].concat(ArrowKeys, [ENTER$1, ESC, HOME, END]).includes(which)) {
      var keys2 = getKeys();
      var refreshedElements = refreshElements(keys2, id2);
      var _refreshedElements = refreshedElements, elements = _refreshedElements.elements, key2element = _refreshedElements.key2element, element2key = _refreshedElements.element2key;
      var activeElement = key2element.get(activeKey);
      var focusMenuElement = getFocusElement(activeElement, elements);
      var focusMenuKey = element2key.get(focusMenuElement);
      var offsetObj = getOffset(mode, getKeyPath(focusMenuKey, true).length === 1, isRtl, which);
      if (!offsetObj && which !== HOME && which !== END) {
        return;
      }
      if (ArrowKeys.includes(which) || [HOME, END].includes(which)) {
        e2.preventDefault();
      }
      var tryFocus = function tryFocus2(menuElement) {
        if (menuElement) {
          var focusTargetElement = menuElement;
          var link2 = menuElement.querySelector("a");
          if (link2 !== null && link2 !== void 0 && link2.getAttribute("href")) {
            focusTargetElement = link2;
          }
          var targetKey = element2key.get(menuElement);
          triggerActiveKey(targetKey);
          cleanRaf();
          rafRef.current = wrapperRaf(function() {
            if (activeRef.current === targetKey) {
              focusTargetElement.focus();
            }
          });
        }
      };
      if ([HOME, END].includes(which) || offsetObj.sibling || !focusMenuElement) {
        var parentQueryContainer;
        if (!focusMenuElement || mode === "inline") {
          parentQueryContainer = containerRef.current;
        } else {
          parentQueryContainer = findContainerUL(focusMenuElement);
        }
        var targetElement;
        var focusableElements2 = getFocusableElements(parentQueryContainer, elements);
        if (which === HOME) {
          targetElement = focusableElements2[0];
        } else if (which === END) {
          targetElement = focusableElements2[focusableElements2.length - 1];
        } else {
          targetElement = getNextFocusElement(parentQueryContainer, elements, focusMenuElement, offsetObj.offset);
        }
        tryFocus(targetElement);
      } else if (offsetObj.inlineTrigger) {
        triggerAccessibilityOpen(focusMenuKey);
      } else if (offsetObj.offset > 0) {
        triggerAccessibilityOpen(focusMenuKey, true);
        cleanRaf();
        rafRef.current = wrapperRaf(function() {
          refreshedElements = refreshElements(keys2, id2);
          var controlId = focusMenuElement.getAttribute("aria-controls");
          var subQueryContainer = document.getElementById(controlId);
          var targetElement2 = getNextFocusElement(subQueryContainer, refreshedElements.elements);
          tryFocus(targetElement2);
        }, 5);
      } else if (offsetObj.offset < 0) {
        var keyPath = getKeyPath(focusMenuKey, true);
        var parentKey = keyPath[keyPath.length - 2];
        var parentMenuElement = key2element.get(parentKey);
        triggerAccessibilityOpen(parentKey, false);
        tryFocus(parentMenuElement);
      }
    }
    originOnKeyDown === null || originOnKeyDown === void 0 || originOnKeyDown(e2);
  };
}
function nextSlice(callback2) {
  Promise.resolve().then(callback2);
}
var PATH_SPLIT = "__RC_UTIL_PATH_SPLIT__";
var getPathStr = function getPathStr2(keyPath) {
  return keyPath.join(PATH_SPLIT);
};
var getPathKeys = function getPathKeys2(keyPathStr) {
  return keyPathStr.split(PATH_SPLIT);
};
var OVERFLOW_KEY = "rc-menu-more";
function useKeyRecords() {
  var _React$useState = reactExports.useState({}), _React$useState2 = _slicedToArray(_React$useState, 2), internalForceUpdate = _React$useState2[1];
  var key2pathRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var path2keyRef = reactExports.useRef(/* @__PURE__ */ new Map());
  var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), overflowKeys = _React$useState4[0], setOverflowKeys = _React$useState4[1];
  var updateRef3 = reactExports.useRef(0);
  var destroyRef = reactExports.useRef(false);
  var forceUpdate = function forceUpdate2() {
    if (!destroyRef.current) {
      internalForceUpdate({});
    }
  };
  var registerPath = reactExports.useCallback(function(key, keyPath) {
    var connectedPath = getPathStr(keyPath);
    path2keyRef.current.set(connectedPath, key);
    key2pathRef.current.set(key, connectedPath);
    updateRef3.current += 1;
    var id2 = updateRef3.current;
    nextSlice(function() {
      if (id2 === updateRef3.current) {
        forceUpdate();
      }
    });
  }, []);
  var unregisterPath = reactExports.useCallback(function(key, keyPath) {
    var connectedPath = getPathStr(keyPath);
    path2keyRef.current.delete(connectedPath);
    key2pathRef.current.delete(key);
  }, []);
  var refreshOverflowKeys = reactExports.useCallback(function(keys2) {
    setOverflowKeys(keys2);
  }, []);
  var getKeyPath = reactExports.useCallback(function(eventKey, includeOverflow) {
    var fullPath = key2pathRef.current.get(eventKey) || "";
    var keys2 = getPathKeys(fullPath);
    if (includeOverflow && overflowKeys.includes(keys2[0])) {
      keys2.unshift(OVERFLOW_KEY);
    }
    return keys2;
  }, [overflowKeys]);
  var isSubPathKey = reactExports.useCallback(function(pathKeys, eventKey) {
    return pathKeys.filter(function(item) {
      return item !== void 0;
    }).some(function(pathKey2) {
      var pathKeyList = getKeyPath(pathKey2, true);
      return pathKeyList.includes(eventKey);
    });
  }, [getKeyPath]);
  var getKeys = function getKeys2() {
    var keys2 = _toConsumableArray(key2pathRef.current.keys());
    if (overflowKeys.length) {
      keys2.push(OVERFLOW_KEY);
    }
    return keys2;
  };
  var getSubPathKeys = reactExports.useCallback(function(key) {
    var connectedPath = "".concat(key2pathRef.current.get(key)).concat(PATH_SPLIT);
    var pathKeys = /* @__PURE__ */ new Set();
    _toConsumableArray(path2keyRef.current.keys()).forEach(function(pathKey2) {
      if (pathKey2.startsWith(connectedPath)) {
        pathKeys.add(path2keyRef.current.get(pathKey2));
      }
    });
    return pathKeys;
  }, []);
  reactExports.useEffect(function() {
    return function() {
      destroyRef.current = true;
    };
  }, []);
  return {
    // Register
    registerPath,
    unregisterPath,
    refreshOverflowKeys,
    // Util
    isSubPathKey,
    getKeyPath,
    getKeys,
    getSubPathKeys
  };
}
function useMemoCallback(func) {
  var funRef = reactExports.useRef(func);
  funRef.current = func;
  var callback2 = reactExports.useCallback(function() {
    var _funRef$current;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return (_funRef$current = funRef.current) === null || _funRef$current === void 0 ? void 0 : _funRef$current.call.apply(_funRef$current, [funRef].concat(args));
  }, []);
  return func ? callback2 : void 0;
}
var uniquePrefix = Math.random().toFixed(5).toString().slice(2);
var internalId = 0;
function useUUID(id2) {
  var _useMergedState = useMergedState$1(id2, {
    value: id2
  }), _useMergedState2 = _slicedToArray(_useMergedState, 2), uuid2 = _useMergedState2[0], setUUID = _useMergedState2[1];
  reactExports.useEffect(function() {
    internalId += 1;
    var newId = "".concat(uniquePrefix, "-").concat(internalId);
    setUUID("rc-menu-uuid-".concat(newId));
  }, []);
  return uuid2;
}
function useActive(eventKey, disabled, onMouseEnter, onMouseLeave) {
  var _React$useContext = reactExports.useContext(MenuContext$1), activeKey = _React$useContext.activeKey, onActive = _React$useContext.onActive, onInactive = _React$useContext.onInactive;
  var ret = {
    active: activeKey === eventKey
  };
  if (!disabled) {
    ret.onMouseEnter = function(domEvent) {
      onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
        key: eventKey,
        domEvent
      });
      onActive(eventKey);
    };
    ret.onMouseLeave = function(domEvent) {
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
        key: eventKey,
        domEvent
      });
      onInactive(eventKey);
    };
  }
  return ret;
}
function useDirectionStyle(level) {
  var _React$useContext = reactExports.useContext(MenuContext$1), mode = _React$useContext.mode, rtl = _React$useContext.rtl, inlineIndent = _React$useContext.inlineIndent;
  if (mode !== "inline") {
    return null;
  }
  var len = level;
  return rtl ? {
    paddingRight: len * inlineIndent
  } : {
    paddingLeft: len * inlineIndent
  };
}
function Icon$1(_ref) {
  var icon = _ref.icon, props = _ref.props, children = _ref.children;
  var iconNode;
  if (icon === null || icon === false) {
    return null;
  }
  if (typeof icon === "function") {
    iconNode = /* @__PURE__ */ reactExports.createElement(icon, _objectSpread2({}, props));
  } else if (typeof icon !== "boolean") {
    iconNode = icon;
  }
  return iconNode || children || null;
}
var _excluded$k = ["item"];
function warnItemProp(_ref) {
  var item = _ref.item, restInfo = _objectWithoutProperties$3(_ref, _excluded$k);
  Object.defineProperty(restInfo, "item", {
    get: function get5() {
      warningOnce(false, "`info.item` is deprecated since we will move to function component that not provides React Node instance in future.");
      return item;
    }
  });
  return restInfo;
}
var _excluded$j = ["title", "attribute", "elementRef"], _excluded2$4 = ["style", "className", "eventKey", "warnKey", "disabled", "itemIcon", "children", "role", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "onFocus"], _excluded3$1 = ["active"];
var LegacyMenuItem = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(LegacyMenuItem2, _React$Component);
  var _super = _createSuper$4(LegacyMenuItem2);
  function LegacyMenuItem2() {
    _classCallCheck$a(this, LegacyMenuItem2);
    return _super.apply(this, arguments);
  }
  _createClass$8(LegacyMenuItem2, [{
    key: "render",
    value: function render3() {
      var _this$props = this.props, title = _this$props.title, attribute = _this$props.attribute, elementRef = _this$props.elementRef, restProps = _objectWithoutProperties$3(_this$props, _excluded$j);
      var passedProps = omit$1(restProps, ["eventKey", "popupClassName", "popupOffset", "onTitleClick"]);
      warningOnce(!attribute, "`attribute` of Menu.Item is deprecated. Please pass attribute directly.");
      return /* @__PURE__ */ reactExports.createElement(ForwardOverflow.Item, _extends$j({}, attribute, {
        title: typeof title === "string" ? title : void 0
      }, passedProps, {
        ref: elementRef
      }));
    }
  }]);
  return LegacyMenuItem2;
}(reactExports.Component);
var InternalMenuItem = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var style2 = props.style, className = props.className, eventKey = props.eventKey;
  props.warnKey;
  var disabled = props.disabled, itemIcon = props.itemIcon, children = props.children, role = props.role, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onClick = props.onClick, onKeyDown = props.onKeyDown, onFocus = props.onFocus, restProps = _objectWithoutProperties$3(props, _excluded2$4);
  var domDataId = useMenuId(eventKey);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, onItemClick = _React$useContext.onItemClick, contextDisabled = _React$useContext.disabled, overflowDisabled = _React$useContext.overflowDisabled, contextItemIcon = _React$useContext.itemIcon, selectedKeys = _React$useContext.selectedKeys, onActive = _React$useContext.onActive;
  var _React$useContext2 = reactExports.useContext(PrivateContext), _internalRenderMenuItem = _React$useContext2._internalRenderMenuItem;
  var itemCls = "".concat(prefixCls, "-item");
  var legacyMenuItemRef = reactExports.useRef();
  var elementRef = reactExports.useRef();
  var mergedDisabled = contextDisabled || disabled;
  var mergedEleRef = useComposeRef(ref, elementRef);
  var connectedKeys = useFullPath(eventKey);
  var getEventInfo = function getEventInfo2(e2) {
    return {
      key: eventKey,
      // Note: For legacy code is reversed which not like other antd component
      keyPath: _toConsumableArray(connectedKeys).reverse(),
      item: legacyMenuItemRef.current,
      domEvent: e2
    };
  };
  var mergedItemIcon = itemIcon || contextItemIcon;
  var _useActive = useActive(eventKey, mergedDisabled, onMouseEnter, onMouseLeave), active3 = _useActive.active, activeProps = _objectWithoutProperties$3(_useActive, _excluded3$1);
  var selected = selectedKeys.includes(eventKey);
  var directionStyle = useDirectionStyle(connectedKeys.length);
  var onInternalClick = function onInternalClick2(e2) {
    if (mergedDisabled) {
      return;
    }
    var info = getEventInfo(e2);
    onClick === null || onClick === void 0 || onClick(warnItemProp(info));
    onItemClick(info);
  };
  var onInternalKeyDown = function onInternalKeyDown2(e2) {
    onKeyDown === null || onKeyDown === void 0 || onKeyDown(e2);
    if (e2.which === KeyCode$1.ENTER) {
      var info = getEventInfo(e2);
      onClick === null || onClick === void 0 || onClick(warnItemProp(info));
      onItemClick(info);
    }
  };
  var onInternalFocus = function onInternalFocus2(e2) {
    onActive(eventKey);
    onFocus === null || onFocus === void 0 || onFocus(e2);
  };
  var optionRoleProps = {};
  if (props.role === "option") {
    optionRoleProps["aria-selected"] = selected;
  }
  var renderNode = /* @__PURE__ */ reactExports.createElement(LegacyMenuItem, _extends$j({
    ref: legacyMenuItemRef,
    elementRef: mergedEleRef,
    role: role === null ? "none" : role || "menuitem",
    tabIndex: disabled ? null : -1,
    "data-menu-id": overflowDisabled && domDataId ? null : domDataId
  }, omit$1(restProps, ["extra"]), activeProps, optionRoleProps, {
    component: "li",
    "aria-disabled": disabled,
    style: _objectSpread2(_objectSpread2({}, directionStyle), style2),
    className: classNames(itemCls, _defineProperty$4(_defineProperty$4(_defineProperty$4({}, "".concat(itemCls, "-active"), active3), "".concat(itemCls, "-selected"), selected), "".concat(itemCls, "-disabled"), mergedDisabled), className),
    onClick: onInternalClick,
    onKeyDown: onInternalKeyDown,
    onFocus: onInternalFocus
  }), children, /* @__PURE__ */ reactExports.createElement(Icon$1, {
    props: _objectSpread2(_objectSpread2({}, props), {}, {
      isSelected: selected
    }),
    icon: mergedItemIcon
  }));
  if (_internalRenderMenuItem) {
    renderNode = _internalRenderMenuItem(renderNode, props, {
      selected
    });
  }
  return renderNode;
});
function MenuItem$2(props, ref) {
  var eventKey = props.eventKey;
  var measure = useMeasure();
  var connectedKeyPath = useFullPath(eventKey);
  reactExports.useEffect(function() {
    if (measure) {
      measure.registerPath(eventKey, connectedKeyPath);
      return function() {
        measure.unregisterPath(eventKey, connectedKeyPath);
      };
    }
  }, [connectedKeyPath]);
  if (measure) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(InternalMenuItem, _extends$j({}, props, {
    ref
  }));
}
const MenuItem$3 = /* @__PURE__ */ reactExports.forwardRef(MenuItem$2);
var _excluded$i = ["className", "children"];
var InternalSubMenuList = function InternalSubMenuList2(_ref, ref) {
  var className = _ref.className, children = _ref.children, restProps = _objectWithoutProperties$3(_ref, _excluded$i);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, mode = _React$useContext.mode, rtl = _React$useContext.rtl;
  return /* @__PURE__ */ reactExports.createElement("ul", _extends$j({
    className: classNames(prefixCls, rtl && "".concat(prefixCls, "-rtl"), "".concat(prefixCls, "-sub"), "".concat(prefixCls, "-").concat(mode === "inline" ? "inline" : "vertical"), className),
    role: "menu"
  }, restProps, {
    "data-menu-list": true,
    ref
  }), children);
};
var SubMenuList = /* @__PURE__ */ reactExports.forwardRef(InternalSubMenuList);
SubMenuList.displayName = "SubMenuList";
function parseChildren(children, keyPath) {
  return toArray$4(children).map(function(child, index2) {
    if (/* @__PURE__ */ reactExports.isValidElement(child)) {
      var _eventKey, _child$props;
      var key = child.key;
      var eventKey = (_eventKey = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.eventKey) !== null && _eventKey !== void 0 ? _eventKey : key;
      var emptyKey = eventKey === null || eventKey === void 0;
      if (emptyKey) {
        eventKey = "tmp_key-".concat([].concat(_toConsumableArray(keyPath), [index2]).join("-"));
      }
      var cloneProps = {
        key: eventKey,
        eventKey
      };
      return /* @__PURE__ */ reactExports.cloneElement(child, cloneProps);
    }
    return child;
  });
}
var autoAdjustOverflow = {
  adjustX: 1,
  adjustY: 1
};
var placements = {
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflow
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflow
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflow
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflow
  },
  leftTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflow
  },
  leftBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflow
  },
  rightTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflow
  },
  rightBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflow
  }
};
var placementsRtl = {
  topLeft: {
    points: ["bl", "tl"],
    overflow: autoAdjustOverflow
  },
  topRight: {
    points: ["br", "tr"],
    overflow: autoAdjustOverflow
  },
  bottomLeft: {
    points: ["tl", "bl"],
    overflow: autoAdjustOverflow
  },
  bottomRight: {
    points: ["tr", "br"],
    overflow: autoAdjustOverflow
  },
  rightTop: {
    points: ["tr", "tl"],
    overflow: autoAdjustOverflow
  },
  rightBottom: {
    points: ["br", "bl"],
    overflow: autoAdjustOverflow
  },
  leftTop: {
    points: ["tl", "tr"],
    overflow: autoAdjustOverflow
  },
  leftBottom: {
    points: ["bl", "br"],
    overflow: autoAdjustOverflow
  }
};
function getMotion(mode, motion, defaultMotions) {
  if (motion) {
    return motion;
  }
  if (defaultMotions) {
    return defaultMotions[mode] || defaultMotions.other;
  }
  return void 0;
}
var popupPlacementMap = {
  horizontal: "bottomLeft",
  vertical: "rightTop",
  "vertical-left": "rightTop",
  "vertical-right": "leftTop"
};
function PopupTrigger(_ref) {
  var prefixCls = _ref.prefixCls, visible = _ref.visible, children = _ref.children, popup = _ref.popup, popupStyle = _ref.popupStyle, popupClassName = _ref.popupClassName, popupOffset = _ref.popupOffset, disabled = _ref.disabled, mode = _ref.mode, onVisibleChange = _ref.onVisibleChange;
  var _React$useContext = reactExports.useContext(MenuContext$1), getPopupContainer = _React$useContext.getPopupContainer, rtl = _React$useContext.rtl, subMenuOpenDelay = _React$useContext.subMenuOpenDelay, subMenuCloseDelay = _React$useContext.subMenuCloseDelay, builtinPlacements = _React$useContext.builtinPlacements, triggerSubMenuAction = _React$useContext.triggerSubMenuAction, forceSubMenuRender = _React$useContext.forceSubMenuRender, rootClassName = _React$useContext.rootClassName, motion = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions;
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), innerVisible = _React$useState2[0], setInnerVisible = _React$useState2[1];
  var placement = rtl ? _objectSpread2(_objectSpread2({}, placementsRtl), builtinPlacements) : _objectSpread2(_objectSpread2({}, placements), builtinPlacements);
  var popupPlacement = popupPlacementMap[mode];
  var targetMotion = getMotion(mode, motion, defaultMotions);
  var targetMotionRef = reactExports.useRef(targetMotion);
  if (mode !== "inline") {
    targetMotionRef.current = targetMotion;
  }
  var mergedMotion = _objectSpread2(_objectSpread2({}, targetMotionRef.current), {}, {
    leavedClassName: "".concat(prefixCls, "-hidden"),
    removeOnLeave: false,
    motionAppear: true
  });
  var visibleRef = reactExports.useRef();
  reactExports.useEffect(function() {
    visibleRef.current = wrapperRaf(function() {
      setInnerVisible(visible);
    });
    return function() {
      wrapperRaf.cancel(visibleRef.current);
    };
  }, [visible]);
  return /* @__PURE__ */ reactExports.createElement(Trigger, {
    prefixCls,
    popupClassName: classNames("".concat(prefixCls, "-popup"), _defineProperty$4({}, "".concat(prefixCls, "-rtl"), rtl), popupClassName, rootClassName),
    stretch: mode === "horizontal" ? "minWidth" : null,
    getPopupContainer,
    builtinPlacements: placement,
    popupPlacement,
    popupVisible: innerVisible,
    popup,
    popupStyle,
    popupAlign: popupOffset && {
      offset: popupOffset
    },
    action: disabled ? [] : [triggerSubMenuAction],
    mouseEnterDelay: subMenuOpenDelay,
    mouseLeaveDelay: subMenuCloseDelay,
    onPopupVisibleChange: onVisibleChange,
    forceRender: forceSubMenuRender,
    popupMotion: mergedMotion,
    fresh: true
  }, children);
}
function InlineSubMenuList(_ref) {
  var id2 = _ref.id, open = _ref.open, keyPath = _ref.keyPath, children = _ref.children;
  var fixedMode = "inline";
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, forceSubMenuRender = _React$useContext.forceSubMenuRender, motion = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions, mode = _React$useContext.mode;
  var sameModeRef = reactExports.useRef(false);
  sameModeRef.current = mode === fixedMode;
  var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy = _React$useState2[0], setDestroy = _React$useState2[1];
  var mergedOpen = sameModeRef.current ? open : false;
  reactExports.useEffect(function() {
    if (sameModeRef.current) {
      setDestroy(false);
    }
  }, [mode]);
  var mergedMotion = _objectSpread2({}, getMotion(fixedMode, motion, defaultMotions));
  if (keyPath.length > 1) {
    mergedMotion.motionAppear = false;
  }
  var originOnVisibleChanged = mergedMotion.onVisibleChanged;
  mergedMotion.onVisibleChanged = function(newVisible) {
    if (!sameModeRef.current && !newVisible) {
      setDestroy(true);
    }
    return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);
  };
  if (destroy) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    mode: fixedMode,
    locked: !sameModeRef.current
  }, /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$j({
    visible: mergedOpen
  }, mergedMotion, {
    forceRender: forceSubMenuRender,
    removeOnLeave: false,
    leavedClassName: "".concat(prefixCls, "-hidden")
  }), function(_ref2) {
    var motionClassName = _ref2.className, motionStyle = _ref2.style;
    return /* @__PURE__ */ reactExports.createElement(SubMenuList, {
      id: id2,
      className: motionClassName,
      style: motionStyle
    }, children);
  }));
}
var _excluded$h = ["style", "className", "title", "eventKey", "warnKey", "disabled", "internalPopupClose", "children", "itemIcon", "expandIcon", "popupClassName", "popupOffset", "popupStyle", "onClick", "onMouseEnter", "onMouseLeave", "onTitleClick", "onTitleMouseEnter", "onTitleMouseLeave"], _excluded2$3 = ["active"];
var InternalSubMenu = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var style2 = props.style, className = props.className, title = props.title, eventKey = props.eventKey;
  props.warnKey;
  var disabled = props.disabled, internalPopupClose = props.internalPopupClose, children = props.children, itemIcon = props.itemIcon, expandIcon = props.expandIcon, popupClassName = props.popupClassName, popupOffset = props.popupOffset, popupStyle = props.popupStyle, onClick = props.onClick, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onTitleClick = props.onTitleClick, onTitleMouseEnter = props.onTitleMouseEnter, onTitleMouseLeave = props.onTitleMouseLeave, restProps = _objectWithoutProperties$3(props, _excluded$h);
  var domDataId = useMenuId(eventKey);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, mode = _React$useContext.mode, openKeys = _React$useContext.openKeys, contextDisabled = _React$useContext.disabled, overflowDisabled = _React$useContext.overflowDisabled, activeKey = _React$useContext.activeKey, selectedKeys = _React$useContext.selectedKeys, contextItemIcon = _React$useContext.itemIcon, contextExpandIcon = _React$useContext.expandIcon, onItemClick = _React$useContext.onItemClick, onOpenChange = _React$useContext.onOpenChange, onActive = _React$useContext.onActive;
  var _React$useContext2 = reactExports.useContext(PrivateContext), _internalRenderSubMenuItem = _React$useContext2._internalRenderSubMenuItem;
  var _React$useContext3 = reactExports.useContext(PathUserContext), isSubPathKey = _React$useContext3.isSubPathKey;
  var connectedPath = useFullPath();
  var subMenuPrefixCls = "".concat(prefixCls, "-submenu");
  var mergedDisabled = contextDisabled || disabled;
  var elementRef = reactExports.useRef();
  var popupRef = reactExports.useRef();
  var mergedItemIcon = itemIcon !== null && itemIcon !== void 0 ? itemIcon : contextItemIcon;
  var mergedExpandIcon = expandIcon !== null && expandIcon !== void 0 ? expandIcon : contextExpandIcon;
  var originOpen = openKeys.includes(eventKey);
  var open = !overflowDisabled && originOpen;
  var childrenSelected = isSubPathKey(selectedKeys, eventKey);
  var _useActive = useActive(eventKey, mergedDisabled, onTitleMouseEnter, onTitleMouseLeave), active3 = _useActive.active, activeProps = _objectWithoutProperties$3(_useActive, _excluded2$3);
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), childrenActive = _React$useState2[0], setChildrenActive = _React$useState2[1];
  var triggerChildrenActive = function triggerChildrenActive2(newActive) {
    if (!mergedDisabled) {
      setChildrenActive(newActive);
    }
  };
  var onInternalMouseEnter = function onInternalMouseEnter2(domEvent) {
    triggerChildrenActive(true);
    onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
      key: eventKey,
      domEvent
    });
  };
  var onInternalMouseLeave = function onInternalMouseLeave2(domEvent) {
    triggerChildrenActive(false);
    onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
      key: eventKey,
      domEvent
    });
  };
  var mergedActive = reactExports.useMemo(function() {
    if (active3) {
      return active3;
    }
    if (mode !== "inline") {
      return childrenActive || isSubPathKey([activeKey], eventKey);
    }
    return false;
  }, [mode, active3, activeKey, childrenActive, eventKey, isSubPathKey]);
  var directionStyle = useDirectionStyle(connectedPath.length);
  var onInternalTitleClick = function onInternalTitleClick2(e2) {
    if (mergedDisabled) {
      return;
    }
    onTitleClick === null || onTitleClick === void 0 || onTitleClick({
      key: eventKey,
      domEvent: e2
    });
    if (mode === "inline") {
      onOpenChange(eventKey, !originOpen);
    }
  };
  var onMergedItemClick = useMemoCallback(function(info) {
    onClick === null || onClick === void 0 || onClick(warnItemProp(info));
    onItemClick(info);
  });
  var onPopupVisibleChange = function onPopupVisibleChange2(newVisible) {
    if (mode !== "inline") {
      onOpenChange(eventKey, newVisible);
    }
  };
  var onInternalFocus = function onInternalFocus2() {
    onActive(eventKey);
  };
  var popupId = domDataId && "".concat(domDataId, "-popup");
  var expandIconNode = reactExports.useMemo(function() {
    return /* @__PURE__ */ reactExports.createElement(Icon$1, {
      icon: mode !== "horizontal" ? mergedExpandIcon : void 0,
      props: _objectSpread2(_objectSpread2({}, props), {}, {
        isOpen: open,
        // [Legacy] Not sure why need this mark
        isSubMenu: true
      })
    }, /* @__PURE__ */ reactExports.createElement("i", {
      className: "".concat(subMenuPrefixCls, "-arrow")
    }));
  }, [mode, mergedExpandIcon, props, open, subMenuPrefixCls]);
  var titleNode = /* @__PURE__ */ reactExports.createElement("div", _extends$j({
    role: "menuitem",
    style: directionStyle,
    className: "".concat(subMenuPrefixCls, "-title"),
    tabIndex: mergedDisabled ? null : -1,
    ref: elementRef,
    title: typeof title === "string" ? title : null,
    "data-menu-id": overflowDisabled && domDataId ? null : domDataId,
    "aria-expanded": open,
    "aria-haspopup": true,
    "aria-controls": popupId,
    "aria-disabled": mergedDisabled,
    onClick: onInternalTitleClick,
    onFocus: onInternalFocus
  }, activeProps), title, expandIconNode);
  var triggerModeRef = reactExports.useRef(mode);
  if (mode !== "inline" && connectedPath.length > 1) {
    triggerModeRef.current = "vertical";
  } else {
    triggerModeRef.current = mode;
  }
  if (!overflowDisabled) {
    var triggerMode = triggerModeRef.current;
    titleNode = /* @__PURE__ */ reactExports.createElement(PopupTrigger, {
      mode: triggerMode,
      prefixCls: subMenuPrefixCls,
      visible: !internalPopupClose && open && mode !== "inline",
      popupClassName,
      popupOffset,
      popupStyle,
      popup: /* @__PURE__ */ reactExports.createElement(
        InheritableContextProvider,
        {
          mode: triggerMode === "horizontal" ? "vertical" : triggerMode
        },
        /* @__PURE__ */ reactExports.createElement(SubMenuList, {
          id: popupId,
          ref: popupRef
        }, children)
      ),
      disabled: mergedDisabled,
      onVisibleChange: onPopupVisibleChange
    }, titleNode);
  }
  var listNode = /* @__PURE__ */ reactExports.createElement(ForwardOverflow.Item, _extends$j({
    ref,
    role: "none"
  }, restProps, {
    component: "li",
    style: style2,
    className: classNames(subMenuPrefixCls, "".concat(subMenuPrefixCls, "-").concat(mode), className, _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4({}, "".concat(subMenuPrefixCls, "-open"), open), "".concat(subMenuPrefixCls, "-active"), mergedActive), "".concat(subMenuPrefixCls, "-selected"), childrenSelected), "".concat(subMenuPrefixCls, "-disabled"), mergedDisabled)),
    onMouseEnter: onInternalMouseEnter,
    onMouseLeave: onInternalMouseLeave
  }), titleNode, !overflowDisabled && /* @__PURE__ */ reactExports.createElement(InlineSubMenuList, {
    id: popupId,
    open,
    keyPath: connectedPath
  }, children));
  if (_internalRenderSubMenuItem) {
    listNode = _internalRenderSubMenuItem(listNode, props, {
      selected: childrenSelected,
      active: mergedActive,
      open,
      disabled: mergedDisabled
    });
  }
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    onItemClick: onMergedItemClick,
    mode: mode === "horizontal" ? "vertical" : mode,
    itemIcon: mergedItemIcon,
    expandIcon: mergedExpandIcon
  }, listNode);
});
var SubMenu$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var eventKey = props.eventKey, children = props.children;
  var connectedKeyPath = useFullPath(eventKey);
  var childList = parseChildren(children, connectedKeyPath);
  var measure = useMeasure();
  reactExports.useEffect(function() {
    if (measure) {
      measure.registerPath(eventKey, connectedKeyPath);
      return function() {
        measure.unregisterPath(eventKey, connectedKeyPath);
      };
    }
  }, [connectedKeyPath]);
  var renderNode;
  if (measure) {
    renderNode = childList;
  } else {
    renderNode = /* @__PURE__ */ reactExports.createElement(InternalSubMenu, _extends$j({
      ref
    }, props), childList);
  }
  return /* @__PURE__ */ reactExports.createElement(PathTrackerContext.Provider, {
    value: connectedKeyPath
  }, renderNode);
});
function Divider(_ref) {
  var className = _ref.className, style2 = _ref.style;
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls;
  var measure = useMeasure();
  if (measure) {
    return null;
  }
  return /* @__PURE__ */ reactExports.createElement("li", {
    role: "separator",
    className: classNames("".concat(prefixCls, "-item-divider"), className),
    style: style2
  });
}
var _excluded$g = ["className", "title", "eventKey", "children"];
var InternalMenuItemGroup = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var className = props.className, title = props.title;
  props.eventKey;
  var children = props.children, restProps = _objectWithoutProperties$3(props, _excluded$g);
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls;
  var groupPrefixCls = "".concat(prefixCls, "-item-group");
  return /* @__PURE__ */ reactExports.createElement("li", _extends$j({
    ref,
    role: "presentation"
  }, restProps, {
    onClick: function onClick(e2) {
      return e2.stopPropagation();
    },
    className: classNames(groupPrefixCls, className)
  }), /* @__PURE__ */ reactExports.createElement("div", {
    role: "presentation",
    className: "".concat(groupPrefixCls, "-title"),
    title: typeof title === "string" ? title : void 0
  }, title), /* @__PURE__ */ reactExports.createElement("ul", {
    role: "group",
    className: "".concat(groupPrefixCls, "-list")
  }, children));
});
var MenuItemGroup = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var eventKey = props.eventKey, children = props.children;
  var connectedKeyPath = useFullPath(eventKey);
  var childList = parseChildren(children, connectedKeyPath);
  var measure = useMeasure();
  if (measure) {
    return childList;
  }
  return /* @__PURE__ */ reactExports.createElement(InternalMenuItemGroup, _extends$j({
    ref
  }, omit$1(props, ["warnKey"])), childList);
});
var _excluded$f = ["label", "children", "key", "type", "extra"];
function convertItemsToNodes(list2, components2, prefixCls) {
  var MergedMenuItem = components2.item, MergedMenuItemGroup = components2.group, MergedSubMenu = components2.submenu, MergedDivider = components2.divider;
  return (list2 || []).map(function(opt, index2) {
    if (opt && _typeof$2(opt) === "object") {
      var _ref = opt, label = _ref.label, children = _ref.children, key = _ref.key, type4 = _ref.type, extra = _ref.extra, restProps = _objectWithoutProperties$3(_ref, _excluded$f);
      var mergedKey = key !== null && key !== void 0 ? key : "tmp-".concat(index2);
      if (children || type4 === "group") {
        if (type4 === "group") {
          return /* @__PURE__ */ reactExports.createElement(MergedMenuItemGroup, _extends$j({
            key: mergedKey
          }, restProps, {
            title: label
          }), convertItemsToNodes(children, components2, prefixCls));
        }
        return /* @__PURE__ */ reactExports.createElement(MergedSubMenu, _extends$j({
          key: mergedKey
        }, restProps, {
          title: label
        }), convertItemsToNodes(children, components2, prefixCls));
      }
      if (type4 === "divider") {
        return /* @__PURE__ */ reactExports.createElement(MergedDivider, _extends$j({
          key: mergedKey
        }, restProps));
      }
      return /* @__PURE__ */ reactExports.createElement(MergedMenuItem, _extends$j({
        key: mergedKey
      }, restProps, {
        extra
      }), label, (!!extra || extra === 0) && /* @__PURE__ */ reactExports.createElement("span", {
        className: "".concat(prefixCls, "-item-extra")
      }, extra));
    }
    return null;
  }).filter(function(opt) {
    return opt;
  });
}
function parseItems(children, items, keyPath, components2, prefixCls) {
  var childNodes = children;
  var mergedComponents = _objectSpread2({
    divider: Divider,
    item: MenuItem$3,
    group: MenuItemGroup,
    submenu: SubMenu$1
  }, components2);
  if (items) {
    childNodes = convertItemsToNodes(items, mergedComponents, prefixCls);
  }
  return parseChildren(childNodes, keyPath);
}
var _excluded$e = ["prefixCls", "rootClassName", "style", "className", "tabIndex", "items", "children", "direction", "id", "mode", "inlineCollapsed", "disabled", "disabledOverflow", "subMenuOpenDelay", "subMenuCloseDelay", "forceSubMenuRender", "defaultOpenKeys", "openKeys", "activeKey", "defaultActiveFirst", "selectable", "multiple", "defaultSelectedKeys", "selectedKeys", "onSelect", "onDeselect", "inlineIndent", "motion", "defaultMotions", "triggerSubMenuAction", "builtinPlacements", "itemIcon", "expandIcon", "overflowedIndicator", "overflowedIndicatorPopupClassName", "getPopupContainer", "onClick", "onOpenChange", "onKeyDown", "openAnimation", "openTransitionName", "_internalRenderMenuItem", "_internalRenderSubMenuItem", "_internalComponents"];
var EMPTY_LIST = [];
var Menu$1 = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var _childList$;
  var _ref = props, _ref$prefixCls = _ref.prefixCls, prefixCls = _ref$prefixCls === void 0 ? "rc-menu" : _ref$prefixCls, rootClassName = _ref.rootClassName, style2 = _ref.style, className = _ref.className, _ref$tabIndex = _ref.tabIndex, tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex, items = _ref.items, children = _ref.children, direction = _ref.direction, id2 = _ref.id, _ref$mode = _ref.mode, mode = _ref$mode === void 0 ? "vertical" : _ref$mode, inlineCollapsed = _ref.inlineCollapsed, disabled = _ref.disabled, disabledOverflow = _ref.disabledOverflow, _ref$subMenuOpenDelay = _ref.subMenuOpenDelay, subMenuOpenDelay = _ref$subMenuOpenDelay === void 0 ? 0.1 : _ref$subMenuOpenDelay, _ref$subMenuCloseDela = _ref.subMenuCloseDelay, subMenuCloseDelay = _ref$subMenuCloseDela === void 0 ? 0.1 : _ref$subMenuCloseDela, forceSubMenuRender = _ref.forceSubMenuRender, defaultOpenKeys = _ref.defaultOpenKeys, openKeys = _ref.openKeys, activeKey = _ref.activeKey, defaultActiveFirst = _ref.defaultActiveFirst, _ref$selectable = _ref.selectable, selectable = _ref$selectable === void 0 ? true : _ref$selectable, _ref$multiple = _ref.multiple, multiple = _ref$multiple === void 0 ? false : _ref$multiple, defaultSelectedKeys = _ref.defaultSelectedKeys, selectedKeys = _ref.selectedKeys, onSelect = _ref.onSelect, onDeselect = _ref.onDeselect, _ref$inlineIndent = _ref.inlineIndent, inlineIndent = _ref$inlineIndent === void 0 ? 24 : _ref$inlineIndent, motion = _ref.motion, defaultMotions = _ref.defaultMotions, _ref$triggerSubMenuAc = _ref.triggerSubMenuAction, triggerSubMenuAction = _ref$triggerSubMenuAc === void 0 ? "hover" : _ref$triggerSubMenuAc, builtinPlacements = _ref.builtinPlacements, itemIcon = _ref.itemIcon, expandIcon = _ref.expandIcon, _ref$overflowedIndica = _ref.overflowedIndicator, overflowedIndicator = _ref$overflowedIndica === void 0 ? "..." : _ref$overflowedIndica, overflowedIndicatorPopupClassName = _ref.overflowedIndicatorPopupClassName, getPopupContainer = _ref.getPopupContainer, onClick = _ref.onClick, onOpenChange = _ref.onOpenChange, onKeyDown = _ref.onKeyDown;
  _ref.openAnimation;
  _ref.openTransitionName;
  var _internalRenderMenuItem = _ref._internalRenderMenuItem, _internalRenderSubMenuItem = _ref._internalRenderSubMenuItem, _internalComponents = _ref._internalComponents, restProps = _objectWithoutProperties$3(_ref, _excluded$e);
  var _React$useMemo = reactExports.useMemo(function() {
    return [parseItems(children, items, EMPTY_LIST, _internalComponents, prefixCls), parseItems(children, items, EMPTY_LIST, {}, prefixCls)];
  }, [children, items, _internalComponents]), _React$useMemo2 = _slicedToArray(_React$useMemo, 2), childList = _React$useMemo2[0], measureChildList = _React$useMemo2[1];
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), mounted = _React$useState2[0], setMounted = _React$useState2[1];
  var containerRef = reactExports.useRef();
  var uuid2 = useUUID(id2);
  var isRtl = direction === "rtl";
  var _useMergedState = useMergedState$1(defaultOpenKeys, {
    value: openKeys,
    postState: function postState(keys2) {
      return keys2 || EMPTY_LIST;
    }
  }), _useMergedState2 = _slicedToArray(_useMergedState, 2), mergedOpenKeys = _useMergedState2[0], setMergedOpenKeys = _useMergedState2[1];
  var triggerOpenKeys = function triggerOpenKeys2(keys2) {
    var forceFlush = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
    function doUpdate() {
      setMergedOpenKeys(keys2);
      onOpenChange === null || onOpenChange === void 0 || onOpenChange(keys2);
    }
    if (forceFlush) {
      reactDomExports.flushSync(doUpdate);
    } else {
      doUpdate();
    }
  };
  var _React$useState3 = reactExports.useState(mergedOpenKeys), _React$useState4 = _slicedToArray(_React$useState3, 2), inlineCacheOpenKeys = _React$useState4[0], setInlineCacheOpenKeys = _React$useState4[1];
  var mountRef = reactExports.useRef(false);
  var _React$useMemo3 = reactExports.useMemo(function() {
    if ((mode === "inline" || mode === "vertical") && inlineCollapsed) {
      return ["vertical", inlineCollapsed];
    }
    return [mode, false];
  }, [mode, inlineCollapsed]), _React$useMemo4 = _slicedToArray(_React$useMemo3, 2), mergedMode = _React$useMemo4[0], mergedInlineCollapsed = _React$useMemo4[1];
  var isInlineMode = mergedMode === "inline";
  var _React$useState5 = reactExports.useState(mergedMode), _React$useState6 = _slicedToArray(_React$useState5, 2), internalMode = _React$useState6[0], setInternalMode = _React$useState6[1];
  var _React$useState7 = reactExports.useState(mergedInlineCollapsed), _React$useState8 = _slicedToArray(_React$useState7, 2), internalInlineCollapsed = _React$useState8[0], setInternalInlineCollapsed = _React$useState8[1];
  reactExports.useEffect(function() {
    setInternalMode(mergedMode);
    setInternalInlineCollapsed(mergedInlineCollapsed);
    if (!mountRef.current) {
      return;
    }
    if (isInlineMode) {
      setMergedOpenKeys(inlineCacheOpenKeys);
    } else {
      triggerOpenKeys(EMPTY_LIST);
    }
  }, [mergedMode, mergedInlineCollapsed]);
  var _React$useState9 = reactExports.useState(0), _React$useState10 = _slicedToArray(_React$useState9, 2), lastVisibleIndex = _React$useState10[0], setLastVisibleIndex = _React$useState10[1];
  var allVisible = lastVisibleIndex >= childList.length - 1 || internalMode !== "horizontal" || disabledOverflow;
  reactExports.useEffect(function() {
    if (isInlineMode) {
      setInlineCacheOpenKeys(mergedOpenKeys);
    }
  }, [mergedOpenKeys]);
  reactExports.useEffect(function() {
    mountRef.current = true;
    return function() {
      mountRef.current = false;
    };
  }, []);
  var _useKeyRecords = useKeyRecords(), registerPath = _useKeyRecords.registerPath, unregisterPath = _useKeyRecords.unregisterPath, refreshOverflowKeys = _useKeyRecords.refreshOverflowKeys, isSubPathKey = _useKeyRecords.isSubPathKey, getKeyPath = _useKeyRecords.getKeyPath, getKeys = _useKeyRecords.getKeys, getSubPathKeys = _useKeyRecords.getSubPathKeys;
  var registerPathContext = reactExports.useMemo(function() {
    return {
      registerPath,
      unregisterPath
    };
  }, [registerPath, unregisterPath]);
  var pathUserContext = reactExports.useMemo(function() {
    return {
      isSubPathKey
    };
  }, [isSubPathKey]);
  reactExports.useEffect(function() {
    refreshOverflowKeys(allVisible ? EMPTY_LIST : childList.slice(lastVisibleIndex + 1).map(function(child) {
      return child.key;
    }));
  }, [lastVisibleIndex, allVisible]);
  var _useMergedState3 = useMergedState$1(activeKey || defaultActiveFirst && ((_childList$ = childList[0]) === null || _childList$ === void 0 ? void 0 : _childList$.key), {
    value: activeKey
  }), _useMergedState4 = _slicedToArray(_useMergedState3, 2), mergedActiveKey = _useMergedState4[0], setMergedActiveKey = _useMergedState4[1];
  var onActive = useMemoCallback(function(key) {
    setMergedActiveKey(key);
  });
  var onInactive = useMemoCallback(function() {
    setMergedActiveKey(void 0);
  });
  reactExports.useImperativeHandle(ref, function() {
    return {
      list: containerRef.current,
      focus: function focus(options) {
        var _childList$find;
        var keys2 = getKeys();
        var _refreshElements = refreshElements(keys2, uuid2), elements = _refreshElements.elements, key2element = _refreshElements.key2element, element2key = _refreshElements.element2key;
        var focusableElements2 = getFocusableElements(containerRef.current, elements);
        var shouldFocusKey = mergedActiveKey !== null && mergedActiveKey !== void 0 ? mergedActiveKey : focusableElements2[0] ? element2key.get(focusableElements2[0]) : (_childList$find = childList.find(function(node2) {
          return !node2.props.disabled;
        })) === null || _childList$find === void 0 ? void 0 : _childList$find.key;
        var elementToFocus = key2element.get(shouldFocusKey);
        if (shouldFocusKey && elementToFocus) {
          var _elementToFocus$focus;
          elementToFocus === null || elementToFocus === void 0 || (_elementToFocus$focus = elementToFocus.focus) === null || _elementToFocus$focus === void 0 || _elementToFocus$focus.call(elementToFocus, options);
        }
      }
    };
  });
  var _useMergedState52 = useMergedState$1(defaultSelectedKeys || [], {
    value: selectedKeys,
    // Legacy convert key to array
    postState: function postState(keys2) {
      if (Array.isArray(keys2)) {
        return keys2;
      }
      if (keys2 === null || keys2 === void 0) {
        return EMPTY_LIST;
      }
      return [keys2];
    }
  }), _useMergedState6 = _slicedToArray(_useMergedState52, 2), mergedSelectKeys = _useMergedState6[0], setMergedSelectKeys = _useMergedState6[1];
  var triggerSelection = function triggerSelection2(info) {
    if (selectable) {
      var targetKey = info.key;
      var exist = mergedSelectKeys.includes(targetKey);
      var newSelectKeys;
      if (multiple) {
        if (exist) {
          newSelectKeys = mergedSelectKeys.filter(function(key) {
            return key !== targetKey;
          });
        } else {
          newSelectKeys = [].concat(_toConsumableArray(mergedSelectKeys), [targetKey]);
        }
      } else {
        newSelectKeys = [targetKey];
      }
      setMergedSelectKeys(newSelectKeys);
      var selectInfo = _objectSpread2(_objectSpread2({}, info), {}, {
        selectedKeys: newSelectKeys
      });
      if (exist) {
        onDeselect === null || onDeselect === void 0 || onDeselect(selectInfo);
      } else {
        onSelect === null || onSelect === void 0 || onSelect(selectInfo);
      }
    }
    if (!multiple && mergedOpenKeys.length && internalMode !== "inline") {
      triggerOpenKeys(EMPTY_LIST);
    }
  };
  var onInternalClick = useMemoCallback(function(info) {
    onClick === null || onClick === void 0 || onClick(warnItemProp(info));
    triggerSelection(info);
  });
  var onInternalOpenChange = useMemoCallback(function(key, open) {
    var newOpenKeys = mergedOpenKeys.filter(function(k2) {
      return k2 !== key;
    });
    if (open) {
      newOpenKeys.push(key);
    } else if (internalMode !== "inline") {
      var subPathKeys = getSubPathKeys(key);
      newOpenKeys = newOpenKeys.filter(function(k2) {
        return !subPathKeys.has(k2);
      });
    }
    if (!isEqual$2(mergedOpenKeys, newOpenKeys, true)) {
      triggerOpenKeys(newOpenKeys, true);
    }
  });
  var triggerAccessibilityOpen = function triggerAccessibilityOpen2(key, open) {
    var nextOpen = open !== null && open !== void 0 ? open : !mergedOpenKeys.includes(key);
    onInternalOpenChange(key, nextOpen);
  };
  var onInternalKeyDown = useAccessibility(internalMode, mergedActiveKey, isRtl, uuid2, containerRef, getKeys, getKeyPath, setMergedActiveKey, triggerAccessibilityOpen, onKeyDown);
  reactExports.useEffect(function() {
    setMounted(true);
  }, []);
  var privateContext = reactExports.useMemo(function() {
    return {
      _internalRenderMenuItem,
      _internalRenderSubMenuItem
    };
  }, [_internalRenderMenuItem, _internalRenderSubMenuItem]);
  var wrappedChildList = internalMode !== "horizontal" || disabledOverflow ? childList : (
    // Need wrap for overflow dropdown that do not response for open
    childList.map(function(child, index2) {
      return (
        // Always wrap provider to avoid sub node re-mount
        /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
          key: child.key,
          overflowDisabled: index2 > lastVisibleIndex
        }, child)
      );
    })
  );
  var container = /* @__PURE__ */ reactExports.createElement(ForwardOverflow, _extends$j({
    id: id2,
    ref: containerRef,
    prefixCls: "".concat(prefixCls, "-overflow"),
    component: "ul",
    itemComponent: MenuItem$3,
    className: classNames(prefixCls, "".concat(prefixCls, "-root"), "".concat(prefixCls, "-").concat(internalMode), className, _defineProperty$4(_defineProperty$4({}, "".concat(prefixCls, "-inline-collapsed"), internalInlineCollapsed), "".concat(prefixCls, "-rtl"), isRtl), rootClassName),
    dir: direction,
    style: style2,
    role: "menu",
    tabIndex,
    data: wrappedChildList,
    renderRawItem: function renderRawItem(node2) {
      return node2;
    },
    renderRawRest: function renderRawRest(omitItems) {
      var len = omitItems.length;
      var originOmitItems = len ? childList.slice(-len) : null;
      return /* @__PURE__ */ reactExports.createElement(SubMenu$1, {
        eventKey: OVERFLOW_KEY,
        title: overflowedIndicator,
        disabled: allVisible,
        internalPopupClose: len === 0,
        popupClassName: overflowedIndicatorPopupClassName
      }, originOmitItems);
    },
    maxCount: internalMode !== "horizontal" || disabledOverflow ? ForwardOverflow.INVALIDATE : ForwardOverflow.RESPONSIVE,
    ssr: "full",
    "data-menu-list": true,
    onVisibleChange: function onVisibleChange(newLastIndex) {
      setLastVisibleIndex(newLastIndex);
    },
    onKeyDown: onInternalKeyDown
  }, restProps));
  return /* @__PURE__ */ reactExports.createElement(PrivateContext.Provider, {
    value: privateContext
  }, /* @__PURE__ */ reactExports.createElement(IdContext.Provider, {
    value: uuid2
  }, /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
    prefixCls,
    rootClassName,
    mode: internalMode,
    openKeys: mergedOpenKeys,
    rtl: isRtl,
    disabled,
    motion: mounted ? motion : null,
    defaultMotions: mounted ? defaultMotions : null,
    activeKey: mergedActiveKey,
    onActive,
    onInactive,
    selectedKeys: mergedSelectKeys,
    inlineIndent,
    subMenuOpenDelay,
    subMenuCloseDelay,
    forceSubMenuRender,
    builtinPlacements,
    triggerSubMenuAction,
    getPopupContainer,
    itemIcon,
    expandIcon,
    onItemClick: onInternalClick,
    onOpenChange: onInternalOpenChange
  }, /* @__PURE__ */ reactExports.createElement(PathUserContext.Provider, {
    value: pathUserContext
  }, container), /* @__PURE__ */ reactExports.createElement("div", {
    style: {
      display: "none"
    },
    "aria-hidden": true
  }, /* @__PURE__ */ reactExports.createElement(PathRegisterContext.Provider, {
    value: registerPathContext
  }, measureChildList)))));
});
var ExportMenu = Menu$1;
ExportMenu.Item = MenuItem$3;
ExportMenu.SubMenu = SubMenu$1;
ExportMenu.ItemGroup = MenuItemGroup;
ExportMenu.Divider = Divider;
const SiderContext = /* @__PURE__ */ reactExports.createContext({});
var EllipsisOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M176 511a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0zm280 0a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "ellipsis", "theme": "outlined" };
var EllipsisOutlined = function EllipsisOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: EllipsisOutlined$1
  }));
};
var RefIcon$1g = /* @__PURE__ */ reactExports.forwardRef(EllipsisOutlined);
const MenuContext = /* @__PURE__ */ reactExports.createContext({
  prefixCls: "",
  firstLevel: true,
  inlineCollapsed: false
});
var __rest$5 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const MenuDivider = (props) => {
  const {
    prefixCls: customizePrefixCls,
    className,
    dashed
  } = props, restProps = __rest$5(props, ["prefixCls", "className", "dashed"]);
  const {
    getPrefixCls
  } = reactExports.useContext(ConfigContext);
  const prefixCls = getPrefixCls("menu", customizePrefixCls);
  const classString = classNames({
    [`${prefixCls}-item-divider-dashed`]: !!dashed
  }, className);
  return /* @__PURE__ */ reactExports.createElement(Divider, Object.assign({
    className: classString
  }, restProps));
};
const MenuItem$1 = (props) => {
  var _a2;
  const {
    className,
    children,
    icon,
    title,
    danger,
    extra
  } = props;
  const {
    prefixCls,
    firstLevel,
    direction,
    disableMenuItemTitleTooltip,
    inlineCollapsed: isInlineCollapsed
  } = reactExports.useContext(MenuContext);
  const renderItemChildren = (inlineCollapsed) => {
    const label = children === null || children === void 0 ? void 0 : children[0];
    const wrapNode = /* @__PURE__ */ reactExports.createElement("span", {
      className: classNames(`${prefixCls}-title-content`, {
        [`${prefixCls}-title-content-with-extra`]: !!extra || extra === 0
      })
    }, children);
    if (!icon || /* @__PURE__ */ reactExports.isValidElement(children) && children.type === "span") {
      if (children && inlineCollapsed && firstLevel && typeof label === "string") {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: `${prefixCls}-inline-collapsed-noicon`
        }, label.charAt(0));
      }
    }
    return wrapNode;
  };
  const {
    siderCollapsed
  } = reactExports.useContext(SiderContext);
  let tooltipTitle = title;
  if (typeof title === "undefined") {
    tooltipTitle = firstLevel ? children : "";
  } else if (title === false) {
    tooltipTitle = "";
  }
  const tooltipProps = {
    title: tooltipTitle
  };
  if (!siderCollapsed && !isInlineCollapsed) {
    tooltipProps.title = null;
    tooltipProps.open = false;
  }
  const childrenLength = toArray$4(children).length;
  let returnNode = /* @__PURE__ */ reactExports.createElement(MenuItem$3, Object.assign({}, omit$1(props, ["title", "icon", "danger"]), {
    className: classNames({
      [`${prefixCls}-item-danger`]: danger,
      [`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1
    }, className),
    title: typeof title === "string" ? title : void 0
  }), cloneElement(icon, {
    className: classNames(/* @__PURE__ */ reactExports.isValidElement(icon) ? (_a2 = icon.props) === null || _a2 === void 0 ? void 0 : _a2.className : void 0, `${prefixCls}-item-icon`)
  }), renderItemChildren(isInlineCollapsed));
  if (!disableMenuItemTitleTooltip) {
    returnNode = /* @__PURE__ */ reactExports.createElement(Tooltip$2, Object.assign({}, tooltipProps, {
      placement: direction === "rtl" ? "left" : "right",
      classNames: {
        root: `${prefixCls}-inline-collapsed-tooltip`
      }
    }), returnNode);
  }
  return returnNode;
};
(function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
});
const OverrideContext = /* @__PURE__ */ reactExports.createContext(null);
const getHorizontalStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    horizontalLineHeight,
    colorSplit,
    lineWidth,
    lineType,
    itemPaddingInline
  } = token2;
  return {
    [`${componentCls}-horizontal`]: {
      lineHeight: horizontalLineHeight,
      border: 0,
      borderBottom: `${unit$1(lineWidth)} ${lineType} ${colorSplit}`,
      boxShadow: "none",
      "&::after": {
        display: "block",
        clear: "both",
        height: 0,
        content: '"\\20"'
      },
      // ======================= Item =======================
      [`${componentCls}-item, ${componentCls}-submenu`]: {
        position: "relative",
        display: "inline-block",
        verticalAlign: "bottom",
        paddingInline: itemPaddingInline
      },
      [`> ${componentCls}-item:hover,
        > ${componentCls}-item-active,
        > ${componentCls}-submenu ${componentCls}-submenu-title:hover`]: {
        backgroundColor: "transparent"
      },
      [`${componentCls}-item, ${componentCls}-submenu-title`]: {
        transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`].join(",")
      },
      // ===================== Sub Menu =====================
      [`${componentCls}-submenu-arrow`]: {
        display: "none"
      }
    }
  };
};
const getRTLStyle = ({
  componentCls,
  menuArrowOffset,
  calc
}) => ({
  [`${componentCls}-rtl`]: {
    direction: "rtl"
  },
  [`${componentCls}-submenu-rtl`]: {
    transformOrigin: "100% 0"
  },
  // Vertical Arrow
  [`${componentCls}-rtl${componentCls}-vertical,
    ${componentCls}-submenu-rtl ${componentCls}-vertical`]: {
    [`${componentCls}-submenu-arrow`]: {
      "&::before": {
        transform: `rotate(-45deg) translateY(${unit$1(calc(menuArrowOffset).mul(-1).equal())})`
      },
      "&::after": {
        transform: `rotate(45deg) translateY(${unit$1(menuArrowOffset)})`
      }
    }
  }
});
const accessibilityFocus = (token2) => Object.assign({}, genFocusOutline(token2));
const getThemeStyle = (token2, themeSuffix) => {
  const {
    componentCls,
    itemColor,
    itemSelectedColor,
    subMenuItemSelectedColor,
    groupTitleColor,
    itemBg,
    subMenuItemBg,
    itemSelectedBg,
    activeBarHeight,
    activeBarWidth,
    activeBarBorderWidth,
    motionDurationSlow,
    motionEaseInOut,
    motionEaseOut,
    itemPaddingInline,
    motionDurationMid,
    itemHoverColor,
    lineType,
    colorSplit,
    // Disabled
    itemDisabledColor,
    // Danger
    dangerItemColor,
    dangerItemHoverColor,
    dangerItemSelectedColor,
    dangerItemActiveBg,
    dangerItemSelectedBg,
    // Bg
    popupBg,
    itemHoverBg,
    itemActiveBg,
    menuSubMenuBg,
    // Horizontal
    horizontalItemSelectedColor,
    horizontalItemSelectedBg,
    horizontalItemBorderRadius,
    horizontalItemHoverBg
  } = token2;
  return {
    [`${componentCls}-${themeSuffix}, ${componentCls}-${themeSuffix} > ${componentCls}`]: {
      color: itemColor,
      background: itemBg,
      [`&${componentCls}-root:focus-visible`]: Object.assign({}, accessibilityFocus(token2)),
      // ======================== Item ========================
      [`${componentCls}-item`]: {
        "&-group-title, &-extra": {
          color: groupTitleColor
        }
      },
      [`${componentCls}-submenu-selected > ${componentCls}-submenu-title`]: {
        color: subMenuItemSelectedColor
      },
      [`${componentCls}-item, ${componentCls}-submenu-title`]: {
        color: itemColor,
        [`&:not(${componentCls}-item-disabled):focus-visible`]: Object.assign({}, accessibilityFocus(token2))
      },
      // Disabled
      [`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
        color: `${itemDisabledColor} !important`
      },
      // Hover
      [`${componentCls}-item:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
        [`&:hover, > ${componentCls}-submenu-title:hover`]: {
          color: itemHoverColor
        }
      },
      [`&:not(${componentCls}-horizontal)`]: {
        [`${componentCls}-item:not(${componentCls}-item-selected)`]: {
          "&:hover": {
            backgroundColor: itemHoverBg
          },
          "&:active": {
            backgroundColor: itemActiveBg
          }
        },
        [`${componentCls}-submenu-title`]: {
          "&:hover": {
            backgroundColor: itemHoverBg
          },
          "&:active": {
            backgroundColor: itemActiveBg
          }
        }
      },
      // Danger - only Item has
      [`${componentCls}-item-danger`]: {
        color: dangerItemColor,
        [`&${componentCls}-item:hover`]: {
          [`&:not(${componentCls}-item-selected):not(${componentCls}-submenu-selected)`]: {
            color: dangerItemHoverColor
          }
        },
        [`&${componentCls}-item:active`]: {
          background: dangerItemActiveBg
        }
      },
      [`${componentCls}-item a`]: {
        "&, &:hover": {
          color: "inherit"
        }
      },
      [`${componentCls}-item-selected`]: {
        color: itemSelectedColor,
        // Danger
        [`&${componentCls}-item-danger`]: {
          color: dangerItemSelectedColor
        },
        "a, a:hover": {
          color: "inherit"
        }
      },
      [`& ${componentCls}-item-selected`]: {
        backgroundColor: itemSelectedBg,
        // Danger
        [`&${componentCls}-item-danger`]: {
          backgroundColor: dangerItemSelectedBg
        }
      },
      [`&${componentCls}-submenu > ${componentCls}`]: {
        backgroundColor: menuSubMenuBg
      },
      // ===== 设置浮层的颜色 =======
      // ！dark 模式会被popupBg 会被rest 为 darkPopupBg
      [`&${componentCls}-popup > ${componentCls}`]: {
        backgroundColor: popupBg
      },
      [`&${componentCls}-submenu-popup > ${componentCls}`]: {
        backgroundColor: popupBg
      },
      // ===== 设置浮层的颜色 end =======
      // ====================== Horizontal ======================
      [`&${componentCls}-horizontal`]: Object.assign(Object.assign({}, themeSuffix === "dark" ? {
        borderBottom: 0
      } : {}), {
        [`> ${componentCls}-item, > ${componentCls}-submenu`]: {
          top: activeBarBorderWidth,
          marginTop: token2.calc(activeBarBorderWidth).mul(-1).equal(),
          marginBottom: 0,
          borderRadius: horizontalItemBorderRadius,
          "&::after": {
            position: "absolute",
            insetInline: itemPaddingInline,
            bottom: 0,
            borderBottom: `${unit$1(activeBarHeight)} solid transparent`,
            transition: `border-color ${motionDurationSlow} ${motionEaseInOut}`,
            content: '""'
          },
          "&:hover, &-active, &-open": {
            background: horizontalItemHoverBg,
            "&::after": {
              borderBottomWidth: activeBarHeight,
              borderBottomColor: horizontalItemSelectedColor
            }
          },
          "&-selected": {
            color: horizontalItemSelectedColor,
            backgroundColor: horizontalItemSelectedBg,
            "&:hover": {
              backgroundColor: horizontalItemSelectedBg
            },
            "&::after": {
              borderBottomWidth: activeBarHeight,
              borderBottomColor: horizontalItemSelectedColor
            }
          }
        }
      }),
      // ================== Inline & Vertical ===================
      //
      [`&${componentCls}-root`]: {
        [`&${componentCls}-inline, &${componentCls}-vertical`]: {
          borderInlineEnd: `${unit$1(activeBarBorderWidth)} ${lineType} ${colorSplit}`
        }
      },
      // ======================== Inline ========================
      [`&${componentCls}-inline`]: {
        // Sub
        [`${componentCls}-sub${componentCls}-inline`]: {
          background: subMenuItemBg
        },
        [`${componentCls}-item`]: {
          position: "relative",
          "&::after": {
            position: "absolute",
            insetBlock: 0,
            insetInlineEnd: 0,
            borderInlineEnd: `${unit$1(activeBarWidth)} solid ${itemSelectedColor}`,
            transform: "scaleY(0.0001)",
            opacity: 0,
            transition: [`transform ${motionDurationMid} ${motionEaseOut}`, `opacity ${motionDurationMid} ${motionEaseOut}`].join(","),
            content: '""'
          },
          // Danger
          [`&${componentCls}-item-danger`]: {
            "&::after": {
              borderInlineEndColor: dangerItemSelectedColor
            }
          }
        },
        [`${componentCls}-selected, ${componentCls}-item-selected`]: {
          "&::after": {
            transform: "scaleY(1)",
            opacity: 1,
            transition: [`transform ${motionDurationMid} ${motionEaseInOut}`, `opacity ${motionDurationMid} ${motionEaseInOut}`].join(",")
          }
        }
      }
    }
  };
};
const getVerticalInlineStyle = (token2) => {
  const {
    componentCls,
    itemHeight,
    itemMarginInline,
    padding,
    menuArrowSize,
    marginXS,
    itemMarginBlock,
    itemWidth,
    itemPaddingInline
  } = token2;
  const paddingWithArrow = token2.calc(menuArrowSize).add(padding).add(marginXS).equal();
  return {
    [`${componentCls}-item`]: {
      position: "relative",
      overflow: "hidden"
    },
    [`${componentCls}-item, ${componentCls}-submenu-title`]: {
      height: itemHeight,
      lineHeight: unit$1(itemHeight),
      paddingInline: itemPaddingInline,
      overflow: "hidden",
      textOverflow: "ellipsis",
      marginInline: itemMarginInline,
      marginBlock: itemMarginBlock,
      width: itemWidth
    },
    [`> ${componentCls}-item,
            > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
      height: itemHeight,
      lineHeight: unit$1(itemHeight)
    },
    [`${componentCls}-item-group-list ${componentCls}-submenu-title,
            ${componentCls}-submenu-title`]: {
      paddingInlineEnd: paddingWithArrow
    }
  };
};
const getVerticalStyle = (token2) => {
  const {
    componentCls,
    iconCls,
    itemHeight,
    colorTextLightSolid,
    dropdownWidth,
    controlHeightLG,
    motionEaseOut,
    paddingXL,
    itemMarginInline,
    fontSizeLG,
    motionDurationFast,
    motionDurationSlow,
    paddingXS,
    boxShadowSecondary,
    collapsedWidth,
    collapsedIconSize
  } = token2;
  const inlineItemStyle = {
    height: itemHeight,
    lineHeight: unit$1(itemHeight),
    listStylePosition: "inside",
    listStyleType: "disc"
  };
  return [
    {
      [componentCls]: {
        "&-inline, &-vertical": Object.assign({
          [`&${componentCls}-root`]: {
            boxShadow: "none"
          }
        }, getVerticalInlineStyle(token2))
      },
      [`${componentCls}-submenu-popup`]: {
        [`${componentCls}-vertical`]: Object.assign(Object.assign({}, getVerticalInlineStyle(token2)), {
          boxShadow: boxShadowSecondary
        })
      }
    },
    // Vertical only
    {
      [`${componentCls}-submenu-popup ${componentCls}-vertical${componentCls}-sub`]: {
        minWidth: dropdownWidth,
        maxHeight: `calc(100vh - ${unit$1(token2.calc(controlHeightLG).mul(2.5).equal())})`,
        padding: "0",
        overflow: "hidden",
        borderInlineEnd: 0,
        // https://github.com/ant-design/ant-design/issues/22244
        // https://github.com/ant-design/ant-design/issues/26812
        "&:not([class*='-active'])": {
          overflowX: "hidden",
          overflowY: "auto"
        }
      }
    },
    // Inline Only
    {
      [`${componentCls}-inline`]: {
        width: "100%",
        // Motion enhance for first level
        [`&${componentCls}-root`]: {
          [`${componentCls}-item, ${componentCls}-submenu-title`]: {
            display: "flex",
            alignItems: "center",
            transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding ${motionDurationFast} ${motionEaseOut}`].join(","),
            [`> ${componentCls}-title-content`]: {
              flex: "auto",
              minWidth: 0,
              overflow: "hidden",
              textOverflow: "ellipsis"
            },
            "> *": {
              flex: "none"
            }
          }
        },
        // >>>>> Sub
        [`${componentCls}-sub${componentCls}-inline`]: {
          padding: 0,
          border: 0,
          borderRadius: 0,
          boxShadow: "none",
          [`& > ${componentCls}-submenu > ${componentCls}-submenu-title`]: inlineItemStyle,
          [`& ${componentCls}-item-group-title`]: {
            paddingInlineStart: paddingXL
          }
        },
        // >>>>> Item
        [`${componentCls}-item`]: inlineItemStyle
      }
    },
    // Inline Collapse Only
    {
      [`${componentCls}-inline-collapsed`]: {
        width: collapsedWidth,
        [`&${componentCls}-root`]: {
          [`${componentCls}-item, ${componentCls}-submenu ${componentCls}-submenu-title`]: {
            [`> ${componentCls}-inline-collapsed-noicon`]: {
              fontSize: fontSizeLG,
              textAlign: "center"
            }
          }
        },
        [`> ${componentCls}-item,
          > ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-item,
          > ${componentCls}-item-group > ${componentCls}-item-group-list > ${componentCls}-submenu > ${componentCls}-submenu-title,
          > ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
          insetInlineStart: 0,
          paddingInline: `calc(50% - ${unit$1(token2.calc(collapsedIconSize).div(2).equal())} - ${unit$1(itemMarginInline)})`,
          textOverflow: "clip",
          [`
            ${componentCls}-submenu-arrow,
            ${componentCls}-submenu-expand-icon
          `]: {
            opacity: 0
          },
          [`${componentCls}-item-icon, ${iconCls}`]: {
            margin: 0,
            fontSize: collapsedIconSize,
            lineHeight: unit$1(itemHeight),
            "+ span": {
              display: "inline-block",
              opacity: 0
            }
          }
        },
        [`${componentCls}-item-icon, ${iconCls}`]: {
          display: "inline-block"
        },
        "&-tooltip": {
          pointerEvents: "none",
          [`${componentCls}-item-icon, ${iconCls}`]: {
            display: "none"
          },
          "a, a:hover": {
            color: colorTextLightSolid
          }
        },
        [`${componentCls}-item-group-title`]: Object.assign(Object.assign({}, textEllipsis), {
          paddingInline: paddingXS
        })
      }
    }
  ];
};
const genMenuItemStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    motionDurationMid,
    motionEaseInOut,
    motionEaseOut,
    iconCls,
    iconSize,
    iconMarginInlineEnd
  } = token2;
  return {
    // >>>>> Item
    [`${componentCls}-item, ${componentCls}-submenu-title`]: {
      position: "relative",
      display: "block",
      margin: 0,
      whiteSpace: "nowrap",
      cursor: "pointer",
      transition: [`border-color ${motionDurationSlow}`, `background ${motionDurationSlow}`, `padding calc(${motionDurationSlow} + 0.1s) ${motionEaseInOut}`].join(","),
      [`${componentCls}-item-icon, ${iconCls}`]: {
        minWidth: iconSize,
        fontSize: iconSize,
        transition: [`font-size ${motionDurationMid} ${motionEaseOut}`, `margin ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow}`].join(","),
        "+ span": {
          marginInlineStart: iconMarginInlineEnd,
          opacity: 1,
          transition: [`opacity ${motionDurationSlow} ${motionEaseInOut}`, `margin ${motionDurationSlow}`, `color ${motionDurationSlow}`].join(",")
        }
      },
      [`${componentCls}-item-icon`]: Object.assign({}, resetIcon()),
      [`&${componentCls}-item-only-child`]: {
        [`> ${iconCls}, > ${componentCls}-item-icon`]: {
          marginInlineEnd: 0
        }
      }
    },
    // Disabled state sets text to gray and nukes hover/tab effects
    [`${componentCls}-item-disabled, ${componentCls}-submenu-disabled`]: {
      background: "none !important",
      cursor: "not-allowed",
      "&::after": {
        borderColor: "transparent !important"
      },
      a: {
        color: "inherit !important",
        cursor: "not-allowed",
        pointerEvents: "none"
      },
      [`> ${componentCls}-submenu-title`]: {
        color: "inherit !important",
        cursor: "not-allowed"
      }
    }
  };
};
const genSubMenuArrowStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    motionEaseInOut,
    borderRadius: borderRadius2,
    menuArrowSize,
    menuArrowOffset
  } = token2;
  return {
    [`${componentCls}-submenu`]: {
      "&-expand-icon, &-arrow": {
        position: "absolute",
        top: "50%",
        insetInlineEnd: token2.margin,
        width: menuArrowSize,
        color: "currentcolor",
        transform: "translateY(-50%)",
        transition: `transform ${motionDurationSlow} ${motionEaseInOut}, opacity ${motionDurationSlow}`
      },
      "&-arrow": {
        // →
        "&::before, &::after": {
          position: "absolute",
          width: token2.calc(menuArrowSize).mul(0.6).equal(),
          height: token2.calc(menuArrowSize).mul(0.15).equal(),
          backgroundColor: "currentcolor",
          borderRadius: borderRadius2,
          transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `transform ${motionDurationSlow} ${motionEaseInOut}`, `top ${motionDurationSlow} ${motionEaseInOut}`, `color ${motionDurationSlow} ${motionEaseInOut}`].join(","),
          content: '""'
        },
        "&::before": {
          transform: `rotate(45deg) translateY(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
        },
        "&::after": {
          transform: `rotate(-45deg) translateY(${unit$1(menuArrowOffset)})`
        }
      }
    }
  };
};
const getBaseStyle = (token2) => {
  const {
    antCls,
    componentCls,
    fontSize,
    motionDurationSlow,
    motionDurationMid,
    motionEaseInOut,
    paddingXS,
    padding,
    colorSplit,
    lineWidth,
    zIndexPopup,
    borderRadiusLG,
    subMenuItemBorderRadius,
    menuArrowSize,
    menuArrowOffset,
    lineType,
    groupTitleLineHeight,
    groupTitleFontSize
  } = token2;
  return [
    // Misc
    {
      "": {
        [componentCls]: Object.assign(Object.assign({}, clearFix()), {
          // Hidden
          "&-hidden": {
            display: "none"
          }
        })
      },
      [`${componentCls}-submenu-hidden`]: {
        display: "none"
      }
    },
    {
      [componentCls]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, resetComponent(token2)), clearFix()), {
        marginBottom: 0,
        paddingInlineStart: 0,
        // Override default ul/ol
        fontSize,
        lineHeight: 0,
        listStyle: "none",
        outline: "none",
        // Magic cubic here but smooth transition
        transition: `width ${motionDurationSlow} cubic-bezier(0.2, 0, 0, 1) 0s`,
        "ul, ol": {
          margin: 0,
          padding: 0,
          listStyle: "none"
        },
        // Overflow ellipsis
        "&-overflow": {
          display: "flex",
          [`${componentCls}-item`]: {
            flex: "none"
          }
        },
        [`${componentCls}-item, ${componentCls}-submenu, ${componentCls}-submenu-title`]: {
          borderRadius: token2.itemBorderRadius
        },
        [`${componentCls}-item-group-title`]: {
          padding: `${unit$1(paddingXS)} ${unit$1(padding)}`,
          fontSize: groupTitleFontSize,
          lineHeight: groupTitleLineHeight,
          transition: `all ${motionDurationSlow}`
        },
        [`&-horizontal ${componentCls}-submenu`]: {
          transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-submenu, ${componentCls}-submenu-inline`]: {
          transition: [`border-color ${motionDurationSlow} ${motionEaseInOut}`, `background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationMid} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-submenu ${componentCls}-sub`]: {
          cursor: "initial",
          transition: [`background ${motionDurationSlow} ${motionEaseInOut}`, `padding ${motionDurationSlow} ${motionEaseInOut}`].join(",")
        },
        [`${componentCls}-title-content`]: {
          transition: `color ${motionDurationSlow}`,
          "&-with-extra": {
            display: "inline-flex",
            alignItems: "center",
            width: "100%"
          },
          // https://github.com/ant-design/ant-design/issues/41143
          [`> ${antCls}-typography-ellipsis-single-line`]: {
            display: "inline",
            verticalAlign: "unset"
          },
          [`${componentCls}-item-extra`]: {
            marginInlineStart: "auto",
            paddingInlineStart: token2.padding
          }
        },
        [`${componentCls}-item a`]: {
          "&::before": {
            position: "absolute",
            inset: 0,
            backgroundColor: "transparent",
            content: '""'
          }
        },
        // Removed a Badge related style seems it's safe
        // https://github.com/ant-design/ant-design/issues/19809
        // >>>>> Divider
        [`${componentCls}-item-divider`]: {
          overflow: "hidden",
          lineHeight: 0,
          borderColor: colorSplit,
          borderStyle: lineType,
          borderWidth: 0,
          borderTopWidth: lineWidth,
          marginBlock: lineWidth,
          padding: 0,
          "&-dashed": {
            borderStyle: "dashed"
          }
        }
      }), genMenuItemStyle(token2)), {
        [`${componentCls}-item-group`]: {
          [`${componentCls}-item-group-list`]: {
            margin: 0,
            padding: 0,
            [`${componentCls}-item, ${componentCls}-submenu-title`]: {
              paddingInline: `${unit$1(token2.calc(fontSize).mul(2).equal())} ${unit$1(padding)}`
            }
          }
        },
        // ======================= Sub Menu =======================
        "&-submenu": {
          "&-popup": {
            position: "absolute",
            zIndex: zIndexPopup,
            borderRadius: borderRadiusLG,
            boxShadow: "none",
            transformOrigin: "0 0",
            [`&${componentCls}-submenu`]: {
              background: "transparent"
            },
            // https://github.com/ant-design/ant-design/issues/13955
            "&::before": {
              position: "absolute",
              inset: 0,
              zIndex: -1,
              width: "100%",
              height: "100%",
              opacity: 0,
              content: '""'
            },
            [`> ${componentCls}`]: Object.assign(Object.assign(Object.assign({
              borderRadius: borderRadiusLG
            }, genMenuItemStyle(token2)), genSubMenuArrowStyle(token2)), {
              [`${componentCls}-item, ${componentCls}-submenu > ${componentCls}-submenu-title`]: {
                borderRadius: subMenuItemBorderRadius
              },
              [`${componentCls}-submenu-title::after`]: {
                transition: `transform ${motionDurationSlow} ${motionEaseInOut}`
              }
            })
          },
          [`
          &-placement-leftTop,
          &-placement-bottomRight,
          `]: {
            transformOrigin: "100% 0"
          },
          [`
          &-placement-leftBottom,
          &-placement-topRight,
          `]: {
            transformOrigin: "100% 100%"
          },
          [`
          &-placement-rightBottom,
          &-placement-topLeft,
          `]: {
            transformOrigin: "0 100%"
          },
          [`
          &-placement-bottomLeft,
          &-placement-rightTop,
          `]: {
            transformOrigin: "0 0"
          },
          [`
          &-placement-leftTop,
          &-placement-leftBottom
          `]: {
            paddingInlineEnd: token2.paddingXS
          },
          [`
          &-placement-rightTop,
          &-placement-rightBottom
          `]: {
            paddingInlineStart: token2.paddingXS
          },
          [`
          &-placement-topRight,
          &-placement-topLeft
          `]: {
            paddingBottom: token2.paddingXS
          },
          [`
          &-placement-bottomRight,
          &-placement-bottomLeft
          `]: {
            paddingTop: token2.paddingXS
          }
        }
      }), genSubMenuArrowStyle(token2)), {
        [`&-inline-collapsed ${componentCls}-submenu-arrow,
        &-inline ${componentCls}-submenu-arrow`]: {
          // ↓
          "&::before": {
            transform: `rotate(-45deg) translateX(${unit$1(menuArrowOffset)})`
          },
          "&::after": {
            transform: `rotate(45deg) translateX(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
          }
        },
        [`${componentCls}-submenu-open${componentCls}-submenu-inline > ${componentCls}-submenu-title > ${componentCls}-submenu-arrow`]: {
          // ↑
          transform: `translateY(${unit$1(token2.calc(menuArrowSize).mul(0.2).mul(-1).equal())})`,
          "&::after": {
            transform: `rotate(-45deg) translateX(${unit$1(token2.calc(menuArrowOffset).mul(-1).equal())})`
          },
          "&::before": {
            transform: `rotate(45deg) translateX(${unit$1(menuArrowOffset)})`
          }
        }
      })
    },
    // Integration with header element so menu items have the same height
    {
      [`${antCls}-layout-header`]: {
        [componentCls]: {
          lineHeight: "inherit"
        }
      }
    }
  ];
};
const prepareComponentToken$2 = (token2) => {
  var _a2, _b2, _c2;
  const {
    colorPrimary,
    colorError,
    colorTextDisabled,
    colorErrorBg,
    colorText,
    colorTextDescription,
    colorBgContainer,
    colorFillAlter,
    colorFillContent,
    lineWidth,
    lineWidthBold,
    controlItemBgActive,
    colorBgTextHover,
    controlHeightLG,
    lineHeight: lineHeight2,
    colorBgElevated,
    marginXXS,
    padding,
    fontSize,
    controlHeightSM,
    fontSizeLG,
    colorTextLightSolid,
    colorErrorHover
  } = token2;
  const activeBarWidth = (_a2 = token2.activeBarWidth) !== null && _a2 !== void 0 ? _a2 : 0;
  const activeBarBorderWidth = (_b2 = token2.activeBarBorderWidth) !== null && _b2 !== void 0 ? _b2 : lineWidth;
  const itemMarginInline = (_c2 = token2.itemMarginInline) !== null && _c2 !== void 0 ? _c2 : token2.marginXXS;
  const colorTextDark = new FastColor(colorTextLightSolid).setA(0.65).toRgbString();
  return {
    dropdownWidth: 160,
    zIndexPopup: token2.zIndexPopupBase + 50,
    radiusItem: token2.borderRadiusLG,
    itemBorderRadius: token2.borderRadiusLG,
    radiusSubMenuItem: token2.borderRadiusSM,
    subMenuItemBorderRadius: token2.borderRadiusSM,
    colorItemText: colorText,
    itemColor: colorText,
    colorItemTextHover: colorText,
    itemHoverColor: colorText,
    colorItemTextHoverHorizontal: colorPrimary,
    horizontalItemHoverColor: colorPrimary,
    colorGroupTitle: colorTextDescription,
    groupTitleColor: colorTextDescription,
    colorItemTextSelected: colorPrimary,
    itemSelectedColor: colorPrimary,
    subMenuItemSelectedColor: colorPrimary,
    colorItemTextSelectedHorizontal: colorPrimary,
    horizontalItemSelectedColor: colorPrimary,
    colorItemBg: colorBgContainer,
    itemBg: colorBgContainer,
    colorItemBgHover: colorBgTextHover,
    itemHoverBg: colorBgTextHover,
    colorItemBgActive: colorFillContent,
    itemActiveBg: controlItemBgActive,
    colorSubItemBg: colorFillAlter,
    subMenuItemBg: colorFillAlter,
    colorItemBgSelected: controlItemBgActive,
    itemSelectedBg: controlItemBgActive,
    colorItemBgSelectedHorizontal: "transparent",
    horizontalItemSelectedBg: "transparent",
    colorActiveBarWidth: 0,
    activeBarWidth,
    colorActiveBarHeight: lineWidthBold,
    activeBarHeight: lineWidthBold,
    colorActiveBarBorderSize: lineWidth,
    activeBarBorderWidth,
    // Disabled
    colorItemTextDisabled: colorTextDisabled,
    itemDisabledColor: colorTextDisabled,
    // Danger
    colorDangerItemText: colorError,
    dangerItemColor: colorError,
    colorDangerItemTextHover: colorError,
    dangerItemHoverColor: colorError,
    colorDangerItemTextSelected: colorError,
    dangerItemSelectedColor: colorError,
    colorDangerItemBgActive: colorErrorBg,
    dangerItemActiveBg: colorErrorBg,
    colorDangerItemBgSelected: colorErrorBg,
    dangerItemSelectedBg: colorErrorBg,
    itemMarginInline,
    horizontalItemBorderRadius: 0,
    horizontalItemHoverBg: "transparent",
    itemHeight: controlHeightLG,
    groupTitleLineHeight: lineHeight2,
    collapsedWidth: controlHeightLG * 2,
    popupBg: colorBgElevated,
    itemMarginBlock: marginXXS,
    itemPaddingInline: padding,
    horizontalLineHeight: `${controlHeightLG * 1.15}px`,
    iconSize: fontSize,
    iconMarginInlineEnd: controlHeightSM - fontSize,
    collapsedIconSize: fontSizeLG,
    groupTitleFontSize: fontSize,
    // Disabled
    darkItemDisabledColor: new FastColor(colorTextLightSolid).setA(0.25).toRgbString(),
    // Dark
    darkItemColor: colorTextDark,
    darkDangerItemColor: colorError,
    darkItemBg: "#001529",
    darkPopupBg: "#001529",
    darkSubMenuItemBg: "#000c17",
    darkItemSelectedColor: colorTextLightSolid,
    darkItemSelectedBg: colorPrimary,
    darkDangerItemSelectedBg: colorError,
    darkItemHoverBg: "transparent",
    darkGroupTitleColor: colorTextDark,
    darkItemHoverColor: colorTextLightSolid,
    darkDangerItemHoverColor: colorErrorHover,
    darkDangerItemSelectedColor: colorTextLightSolid,
    darkDangerItemActiveBg: colorError,
    // internal
    itemWidth: activeBarWidth ? `calc(100% + ${activeBarBorderWidth}px)` : `calc(100% - ${itemMarginInline * 2}px)`
  };
};
const useStyle$2 = (prefixCls, rootCls = prefixCls, injectStyle = true) => {
  const useStyle2 = genStyleHooks("Menu", (token2) => {
    const {
      colorBgElevated,
      controlHeightLG,
      fontSize,
      darkItemColor,
      darkDangerItemColor,
      darkItemBg,
      darkSubMenuItemBg,
      darkItemSelectedColor,
      darkItemSelectedBg,
      darkDangerItemSelectedBg,
      darkItemHoverBg,
      darkGroupTitleColor,
      darkItemHoverColor,
      darkItemDisabledColor,
      darkDangerItemHoverColor,
      darkDangerItemSelectedColor,
      darkDangerItemActiveBg,
      popupBg,
      darkPopupBg
    } = token2;
    const menuArrowSize = token2.calc(fontSize).div(7).mul(5).equal();
    const menuToken = merge$4(token2, {
      menuArrowSize,
      menuHorizontalHeight: token2.calc(controlHeightLG).mul(1.15).equal(),
      menuArrowOffset: token2.calc(menuArrowSize).mul(0.25).equal(),
      menuSubMenuBg: colorBgElevated,
      calc: token2.calc,
      popupBg
    });
    const menuDarkToken = merge$4(menuToken, {
      itemColor: darkItemColor,
      itemHoverColor: darkItemHoverColor,
      groupTitleColor: darkGroupTitleColor,
      itemSelectedColor: darkItemSelectedColor,
      subMenuItemSelectedColor: darkItemSelectedColor,
      itemBg: darkItemBg,
      popupBg: darkPopupBg,
      subMenuItemBg: darkSubMenuItemBg,
      itemActiveBg: "transparent",
      itemSelectedBg: darkItemSelectedBg,
      activeBarHeight: 0,
      activeBarBorderWidth: 0,
      itemHoverBg: darkItemHoverBg,
      // Disabled
      itemDisabledColor: darkItemDisabledColor,
      // Danger
      dangerItemColor: darkDangerItemColor,
      dangerItemHoverColor: darkDangerItemHoverColor,
      dangerItemSelectedColor: darkDangerItemSelectedColor,
      dangerItemActiveBg: darkDangerItemActiveBg,
      dangerItemSelectedBg: darkDangerItemSelectedBg,
      menuSubMenuBg: darkSubMenuItemBg,
      // Horizontal
      horizontalItemSelectedColor: darkItemSelectedColor,
      horizontalItemSelectedBg: darkItemSelectedBg
    });
    return [
      // Basic
      getBaseStyle(menuToken),
      // Horizontal
      getHorizontalStyle(menuToken),
      // Hard code for some light style
      // Vertical
      getVerticalStyle(menuToken),
      // Hard code for some light style
      // Theme
      getThemeStyle(menuToken, "light"),
      getThemeStyle(menuDarkToken, "dark"),
      // RTL
      getRTLStyle(menuToken),
      // Motion
      genCollapseMotion(menuToken),
      initSlideMotion(menuToken, "slide-up"),
      initSlideMotion(menuToken, "slide-down"),
      initZoomMotion(menuToken, "zoom-big")
    ];
  }, prepareComponentToken$2, {
    deprecatedTokens: [["colorGroupTitle", "groupTitleColor"], ["radiusItem", "itemBorderRadius"], ["radiusSubMenuItem", "subMenuItemBorderRadius"], ["colorItemText", "itemColor"], ["colorItemTextHover", "itemHoverColor"], ["colorItemTextHoverHorizontal", "horizontalItemHoverColor"], ["colorItemTextSelected", "itemSelectedColor"], ["colorItemTextSelectedHorizontal", "horizontalItemSelectedColor"], ["colorItemTextDisabled", "itemDisabledColor"], ["colorDangerItemText", "dangerItemColor"], ["colorDangerItemTextHover", "dangerItemHoverColor"], ["colorDangerItemTextSelected", "dangerItemSelectedColor"], ["colorDangerItemBgActive", "dangerItemActiveBg"], ["colorDangerItemBgSelected", "dangerItemSelectedBg"], ["colorItemBg", "itemBg"], ["colorItemBgHover", "itemHoverBg"], ["colorSubItemBg", "subMenuItemBg"], ["colorItemBgActive", "itemActiveBg"], ["colorItemBgSelectedHorizontal", "horizontalItemSelectedBg"], ["colorActiveBarWidth", "activeBarWidth"], ["colorActiveBarHeight", "activeBarHeight"], ["colorActiveBarBorderSize", "activeBarBorderWidth"], ["colorItemBgSelected", "itemSelectedBg"]],
    // Dropdown will handle menu style self. We do not need to handle this.
    injectStyle,
    unitless: {
      groupTitleLineHeight: true
    }
  });
  return useStyle2(prefixCls, rootCls);
};
const SubMenu = (props) => {
  var _a2;
  const {
    popupClassName,
    icon,
    title,
    theme: customTheme
  } = props;
  const context = reactExports.useContext(MenuContext);
  const {
    prefixCls,
    inlineCollapsed,
    theme: contextTheme
  } = context;
  const parentPath = useFullPath();
  let titleNode;
  if (!icon) {
    titleNode = inlineCollapsed && !parentPath.length && title && typeof title === "string" ? /* @__PURE__ */ reactExports.createElement("div", {
      className: `${prefixCls}-inline-collapsed-noicon`
    }, title.charAt(0)) : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-title-content`
    }, title);
  } else {
    const titleIsSpan = /* @__PURE__ */ reactExports.isValidElement(title) && title.type === "span";
    titleNode = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, cloneElement(icon, {
      className: classNames(/* @__PURE__ */ reactExports.isValidElement(icon) ? (_a2 = icon.props) === null || _a2 === void 0 ? void 0 : _a2.className : void 0, `${prefixCls}-item-icon`)
    }), titleIsSpan ? title : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-title-content`
    }, title));
  }
  const contextValue = reactExports.useMemo(() => Object.assign(Object.assign({}, context), {
    firstLevel: false
  }), [context]);
  const [zIndex] = useZIndex("Menu");
  return /* @__PURE__ */ reactExports.createElement(MenuContext.Provider, {
    value: contextValue
  }, /* @__PURE__ */ reactExports.createElement(SubMenu$1, Object.assign({}, omit$1(props, ["icon"]), {
    title: titleNode,
    popupClassName: classNames(prefixCls, popupClassName, `${prefixCls}-${customTheme || contextTheme}`),
    popupStyle: Object.assign({
      zIndex
    }, props.popupStyle)
  })));
};
var __rest$4 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function isEmptyIcon(icon) {
  return icon === null || icon === false;
}
const MENU_COMPONENTS = {
  item: MenuItem$1,
  submenu: SubMenu,
  divider: MenuDivider
};
const InternalMenu = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  var _a2;
  const override = reactExports.useContext(OverrideContext);
  const overrideObj = override || {};
  const {
    getPrefixCls,
    getPopupContainer,
    direction,
    menu: menu2
  } = reactExports.useContext(ConfigContext);
  const rootPrefixCls = getPrefixCls();
  const {
    prefixCls: customizePrefixCls,
    className,
    style: style2,
    theme: theme2 = "light",
    expandIcon,
    _internalDisableMenuItemTitleTooltip,
    inlineCollapsed,
    siderCollapsed,
    rootClassName,
    mode,
    selectable,
    onClick,
    overflowedIndicatorPopupClassName
  } = props, restProps = __rest$4(props, ["prefixCls", "className", "style", "theme", "expandIcon", "_internalDisableMenuItemTitleTooltip", "inlineCollapsed", "siderCollapsed", "rootClassName", "mode", "selectable", "onClick", "overflowedIndicatorPopupClassName"]);
  const passedProps = omit$1(restProps, ["collapsedWidth"]);
  (_a2 = overrideObj.validator) === null || _a2 === void 0 ? void 0 : _a2.call(overrideObj, {
    mode
  });
  const onItemClick = useEvent$2((...args) => {
    var _a22;
    onClick === null || onClick === void 0 ? void 0 : onClick.apply(void 0, args);
    (_a22 = overrideObj.onClick) === null || _a22 === void 0 ? void 0 : _a22.call(overrideObj);
  });
  const mergedMode = overrideObj.mode || mode;
  const mergedSelectable = selectable !== null && selectable !== void 0 ? selectable : overrideObj.selectable;
  const mergedInlineCollapsed = inlineCollapsed !== null && inlineCollapsed !== void 0 ? inlineCollapsed : siderCollapsed;
  const defaultMotions = {
    horizontal: {
      motionName: `${rootPrefixCls}-slide-up`
    },
    inline: initCollapseMotion(rootPrefixCls),
    other: {
      motionName: `${rootPrefixCls}-zoom-big`
    }
  };
  const prefixCls = getPrefixCls("menu", customizePrefixCls || overrideObj.prefixCls);
  const rootCls = useCSSVarCls(prefixCls);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$2(prefixCls, rootCls, !override);
  const menuClassName = classNames(`${prefixCls}-${theme2}`, menu2 === null || menu2 === void 0 ? void 0 : menu2.className, className);
  const mergedExpandIcon = reactExports.useMemo(() => {
    var _a22, _b2;
    if (typeof expandIcon === "function" || isEmptyIcon(expandIcon)) {
      return expandIcon || null;
    }
    if (typeof overrideObj.expandIcon === "function" || isEmptyIcon(overrideObj.expandIcon)) {
      return overrideObj.expandIcon || null;
    }
    if (typeof (menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon) === "function" || isEmptyIcon(menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon)) {
      return (menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon) || null;
    }
    const mergedIcon = (_a22 = expandIcon !== null && expandIcon !== void 0 ? expandIcon : overrideObj === null || overrideObj === void 0 ? void 0 : overrideObj.expandIcon) !== null && _a22 !== void 0 ? _a22 : menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon;
    return cloneElement(mergedIcon, {
      className: classNames(`${prefixCls}-submenu-expand-icon`, /* @__PURE__ */ reactExports.isValidElement(mergedIcon) ? (_b2 = mergedIcon.props) === null || _b2 === void 0 ? void 0 : _b2.className : void 0)
    });
  }, [expandIcon, overrideObj === null || overrideObj === void 0 ? void 0 : overrideObj.expandIcon, menu2 === null || menu2 === void 0 ? void 0 : menu2.expandIcon, prefixCls]);
  const contextValue = reactExports.useMemo(() => ({
    prefixCls,
    inlineCollapsed: mergedInlineCollapsed || false,
    direction,
    firstLevel: true,
    theme: theme2,
    mode: mergedMode,
    disableMenuItemTitleTooltip: _internalDisableMenuItemTitleTooltip
  }), [prefixCls, mergedInlineCollapsed, direction, _internalDisableMenuItemTitleTooltip, theme2]);
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(OverrideContext.Provider, {
    value: null
  }, /* @__PURE__ */ reactExports.createElement(MenuContext.Provider, {
    value: contextValue
  }, /* @__PURE__ */ reactExports.createElement(ExportMenu, Object.assign({
    getPopupContainer,
    overflowedIndicator: /* @__PURE__ */ reactExports.createElement(RefIcon$1g, null),
    overflowedIndicatorPopupClassName: classNames(prefixCls, `${prefixCls}-${theme2}`, overflowedIndicatorPopupClassName),
    mode: mergedMode,
    selectable: mergedSelectable,
    onClick: onItemClick
  }, passedProps, {
    inlineCollapsed: mergedInlineCollapsed,
    style: Object.assign(Object.assign({}, menu2 === null || menu2 === void 0 ? void 0 : menu2.style), style2),
    className: menuClassName,
    prefixCls,
    direction,
    defaultMotions,
    expandIcon: mergedExpandIcon,
    ref,
    rootClassName: classNames(rootClassName, hashId, overrideObj.rootClassName, cssVarCls, rootCls),
    _internalComponents: MENU_COMPONENTS
  })))));
});
const Menu = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  const menuRef = reactExports.useRef(null);
  const context = reactExports.useContext(SiderContext);
  reactExports.useImperativeHandle(ref, () => ({
    menu: menuRef.current,
    focus: (options) => {
      var _a2;
      (_a2 = menuRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(options);
    }
  }));
  return /* @__PURE__ */ reactExports.createElement(InternalMenu, Object.assign({
    ref: menuRef
  }, props, context));
});
Menu.Item = MenuItem$1;
Menu.SubMenu = SubMenu;
Menu.Divider = MenuDivider;
Menu.ItemGroup = MenuItemGroup;
var dayjs_min = { exports: {} };
(function(module2, exports2) {
  !function(t2, e2) {
    module2.exports = e2();
  }(commonjsGlobal, function() {
    var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h3 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
      var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
      return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
    } }, m2 = function(t3, e3, n3) {
      var r3 = String(t3);
      return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
    }, v2 = { s: m2, z: function(t3) {
      var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
      return (e3 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i3, 2, "0");
    }, m: function t3(e3, n3) {
      if (e3.date() < n3.date())
        return -t3(n3, e3);
      var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
      return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
    }, a: function(t3) {
      return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
    }, p: function(t3) {
      return { M: c2, y: h3, w: o2, d: a2, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
    }, u: function(t3) {
      return void 0 === t3;
    } }, g2 = "en", D2 = {};
    D2[g2] = M2;
    var p2 = "$isDayjsObject", S2 = function(t3) {
      return t3 instanceof _24 || !(!t3 || !t3[p2]);
    }, w2 = function t3(e3, n3, r3) {
      var i3;
      if (!e3)
        return g2;
      if ("string" == typeof e3) {
        var s3 = e3.toLowerCase();
        D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3);
        var u3 = e3.split("-");
        if (!i3 && u3.length > 1)
          return t3(u3[0]);
      } else {
        var a3 = e3.name;
        D2[a3] = e3, i3 = a3;
      }
      return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
    }, O2 = function(t3, e3) {
      if (S2(t3))
        return t3.clone();
      var n3 = "object" == typeof e3 ? e3 : {};
      return n3.date = t3, n3.args = arguments, new _24(n3);
    }, b2 = v2;
    b2.l = w2, b2.i = S2, b2.w = function(t3, e3) {
      return O2(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
    };
    var _24 = function() {
      function M3(t3) {
        this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true;
      }
      var m3 = M3.prototype;
      return m3.parse = function(t3) {
        this.$d = function(t4) {
          var e3 = t4.date, n3 = t4.utc;
          if (null === e3)
            return /* @__PURE__ */ new Date(NaN);
          if (b2.u(e3))
            return /* @__PURE__ */ new Date();
          if (e3 instanceof Date)
            return new Date(e3);
          if ("string" == typeof e3 && !/Z$/i.test(e3)) {
            var r3 = e3.match($);
            if (r3) {
              var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
              return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
            }
          }
          return new Date(e3);
        }(t3), this.init();
      }, m3.init = function() {
        var t3 = this.$d;
        this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
      }, m3.$utils = function() {
        return b2;
      }, m3.isValid = function() {
        return !(this.$d.toString() === l2);
      }, m3.isSame = function(t3, e3) {
        var n3 = O2(t3);
        return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
      }, m3.isAfter = function(t3, e3) {
        return O2(t3) < this.startOf(e3);
      }, m3.isBefore = function(t3, e3) {
        return this.endOf(e3) < O2(t3);
      }, m3.$g = function(t3, e3, n3) {
        return b2.u(t3) ? this[e3] : this.set(n3, t3);
      }, m3.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
      }, m3.valueOf = function() {
        return this.$d.getTime();
      }, m3.startOf = function(t3, e3) {
        var n3 = this, r3 = !!b2.u(e3) || e3, f3 = b2.p(t3), l3 = function(t4, e4) {
          var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
          return r3 ? i3 : i3.endOf(a2);
        }, $2 = function(t4, e4) {
          return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
        }, y3 = this.$W, M4 = this.$M, m4 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
        switch (f3) {
          case h3:
            return r3 ? l3(1, 0) : l3(31, 11);
          case c2:
            return r3 ? l3(1, M4) : l3(0, M4 + 1);
          case o2:
            var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
            return l3(r3 ? m4 - D3 : m4 + (6 - D3), M4);
          case a2:
          case d2:
            return $2(v3 + "Hours", 0);
          case u2:
            return $2(v3 + "Minutes", 1);
          case s2:
            return $2(v3 + "Seconds", 2);
          case i2:
            return $2(v3 + "Milliseconds", 3);
          default:
            return this.clone();
        }
      }, m3.endOf = function(t3) {
        return this.startOf(t3, false);
      }, m3.$set = function(t3, e3) {
        var n3, o3 = b2.p(t3), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a2] = f3 + "Date", n3[d2] = f3 + "Date", n3[c2] = f3 + "Month", n3[h3] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $2 = o3 === a2 ? this.$D + (e3 - this.$W) : e3;
        if (o3 === c2 || o3 === h3) {
          var y3 = this.clone().set(d2, 1);
          y3.$d[l3]($2), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
        } else
          l3 && this.$d[l3]($2);
        return this.init(), this;
      }, m3.set = function(t3, e3) {
        return this.clone().$set(t3, e3);
      }, m3.get = function(t3) {
        return this[b2.p(t3)]();
      }, m3.add = function(r3, f3) {
        var d3, l3 = this;
        r3 = Number(r3);
        var $2 = b2.p(f3), y3 = function(t3) {
          var e3 = O2(l3);
          return b2.w(e3.date(e3.date() + Math.round(t3 * r3)), l3);
        };
        if ($2 === c2)
          return this.set(c2, this.$M + r3);
        if ($2 === h3)
          return this.set(h3, this.$y + r3);
        if ($2 === a2)
          return y3(1);
        if ($2 === o2)
          return y3(7);
        var M4 = (d3 = {}, d3[s2] = e2, d3[u2] = n2, d3[i2] = t2, d3)[$2] || 1, m4 = this.$d.getTime() + r3 * M4;
        return b2.w(m4, this);
      }, m3.subtract = function(t3, e3) {
        return this.add(-1 * t3, e3);
      }, m3.format = function(t3) {
        var e3 = this, n3 = this.$locale();
        if (!this.isValid())
          return n3.invalidDate || l2;
        var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c3 = n3.months, f3 = n3.meridiem, h4 = function(t4, n4, i4, s4) {
          return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
        }, d3 = function(t4) {
          return b2.s(s3 % 12 || 12, t4, "0");
        }, $2 = f3 || function(t4, e4, n4) {
          var r4 = t4 < 12 ? "AM" : "PM";
          return n4 ? r4.toLowerCase() : r4;
        };
        return r3.replace(y2, function(t4, r4) {
          return r4 || function(t5) {
            switch (t5) {
              case "YY":
                return String(e3.$y).slice(-2);
              case "YYYY":
                return b2.s(e3.$y, 4, "0");
              case "M":
                return a3 + 1;
              case "MM":
                return b2.s(a3 + 1, 2, "0");
              case "MMM":
                return h4(n3.monthsShort, a3, c3, 3);
              case "MMMM":
                return h4(c3, a3);
              case "D":
                return e3.$D;
              case "DD":
                return b2.s(e3.$D, 2, "0");
              case "d":
                return String(e3.$W);
              case "dd":
                return h4(n3.weekdaysMin, e3.$W, o3, 2);
              case "ddd":
                return h4(n3.weekdaysShort, e3.$W, o3, 3);
              case "dddd":
                return o3[e3.$W];
              case "H":
                return String(s3);
              case "HH":
                return b2.s(s3, 2, "0");
              case "h":
                return d3(1);
              case "hh":
                return d3(2);
              case "a":
                return $2(s3, u3, true);
              case "A":
                return $2(s3, u3, false);
              case "m":
                return String(u3);
              case "mm":
                return b2.s(u3, 2, "0");
              case "s":
                return String(e3.$s);
              case "ss":
                return b2.s(e3.$s, 2, "0");
              case "SSS":
                return b2.s(e3.$ms, 3, "0");
              case "Z":
                return i3;
            }
            return null;
          }(t4) || i3.replace(":", "");
        });
      }, m3.utcOffset = function() {
        return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
      }, m3.diff = function(r3, d3, l3) {
        var $2, y3 = this, M4 = b2.p(d3), m4 = O2(r3), v3 = (m4.utcOffset() - this.utcOffset()) * e2, g3 = this - m4, D3 = function() {
          return b2.m(y3, m4);
        };
        switch (M4) {
          case h3:
            $2 = D3() / 12;
            break;
          case c2:
            $2 = D3();
            break;
          case f2:
            $2 = D3() / 3;
            break;
          case o2:
            $2 = (g3 - v3) / 6048e5;
            break;
          case a2:
            $2 = (g3 - v3) / 864e5;
            break;
          case u2:
            $2 = g3 / n2;
            break;
          case s2:
            $2 = g3 / e2;
            break;
          case i2:
            $2 = g3 / t2;
            break;
          default:
            $2 = g3;
        }
        return l3 ? $2 : b2.a($2);
      }, m3.daysInMonth = function() {
        return this.endOf(c2).$D;
      }, m3.$locale = function() {
        return D2[this.$L];
      }, m3.locale = function(t3, e3) {
        if (!t3)
          return this.$L;
        var n3 = this.clone(), r3 = w2(t3, e3, true);
        return r3 && (n3.$L = r3), n3;
      }, m3.clone = function() {
        return b2.w(this.$d, this);
      }, m3.toDate = function() {
        return new Date(this.valueOf());
      }, m3.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
      }, m3.toISOString = function() {
        return this.$d.toISOString();
      }, m3.toString = function() {
        return this.$d.toUTCString();
      }, M3;
    }(), k2 = _24.prototype;
    return O2.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h3], ["$D", d2]].forEach(function(t3) {
      k2[t3[1]] = function(e3) {
        return this.$g(e3, t3[0], t3[1]);
      };
    }), O2.extend = function(t3, e3) {
      return t3.$i || (t3(e3, _24, O2), t3.$i = true), O2;
    }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) {
      return O2(1e3 * t3);
    }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
  });
})(dayjs_min);
var dayjs_minExports = dayjs_min.exports;
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
var PlusOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
var PlusOutlined = function PlusOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PlusOutlined$1
  }));
};
var RefIcon$1f = /* @__PURE__ */ reactExports.forwardRef(PlusOutlined);
var initialState$2 = {
  animating: false,
  autoplaying: null,
  currentDirection: 0,
  currentLeft: null,
  currentSlide: 0,
  direction: 1,
  dragging: false,
  edgeDragged: false,
  initialized: false,
  lazyLoadedList: [],
  listHeight: null,
  listWidth: null,
  scrolling: false,
  slideCount: null,
  slideHeight: null,
  slideWidth: null,
  swipeLeft: null,
  swiped: false,
  // used by swipeEvent. differentites between touch and swipe.
  swiping: false,
  touchObject: {
    startX: 0,
    startY: 0,
    curX: 0,
    curY: 0
  },
  trackStyle: {},
  trackWidth: 0,
  targetSlide: 0
};
function throttle$2(delay2, callback2, options) {
  var _ref = options || {}, _ref$noTrailing = _ref.noTrailing, noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing, _ref$noLeading = _ref.noLeading, noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading, _ref$debounceMode = _ref.debounceMode, debounceMode = _ref$debounceMode === void 0 ? void 0 : _ref$debounceMode;
  var timeoutID;
  var cancelled = false;
  var lastExec = 0;
  function clearExistingTimeout() {
    if (timeoutID) {
      clearTimeout(timeoutID);
    }
  }
  function cancel2(options2) {
    var _ref2 = options2 || {}, _ref2$upcomingOnly = _ref2.upcomingOnly, upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;
    clearExistingTimeout();
    cancelled = !upcomingOnly;
  }
  function wrapper() {
    for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
      arguments_[_key] = arguments[_key];
    }
    var self2 = this;
    var elapsed = Date.now() - lastExec;
    if (cancelled) {
      return;
    }
    function exec() {
      lastExec = Date.now();
      callback2.apply(self2, arguments_);
    }
    function clear() {
      timeoutID = void 0;
    }
    if (!noLeading && debounceMode && !timeoutID) {
      exec();
    }
    clearExistingTimeout();
    if (debounceMode === void 0 && elapsed > delay2) {
      if (noLeading) {
        lastExec = Date.now();
        if (!noTrailing) {
          timeoutID = setTimeout(debounceMode ? clear : exec, delay2);
        }
      } else {
        exec();
      }
    } else if (noTrailing !== true) {
      timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === void 0 ? delay2 - elapsed : delay2);
    }
  }
  wrapper.cancel = cancel2;
  return wrapper;
}
function debounce$3(delay2, callback2, options) {
  var _ref = {}, _ref$atBegin = _ref.atBegin, atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;
  return throttle$2(delay2, callback2, {
    debounceMode: atBegin !== false
  });
}
var defaultProps$2 = {
  accessibility: true,
  adaptiveHeight: false,
  afterChange: null,
  appendDots: function appendDots(dots) {
    return /* @__PURE__ */ React$6.createElement("ul", {
      style: {
        display: "block"
      }
    }, dots);
  },
  arrows: true,
  autoplay: false,
  autoplaySpeed: 3e3,
  beforeChange: null,
  centerMode: false,
  centerPadding: "50px",
  className: "",
  cssEase: "ease",
  customPaging: function customPaging(i2) {
    return /* @__PURE__ */ React$6.createElement("button", null, i2 + 1);
  },
  dots: false,
  dotsClass: "slick-dots",
  draggable: true,
  easing: "linear",
  edgeFriction: 0.35,
  fade: false,
  focusOnSelect: false,
  infinite: true,
  initialSlide: 0,
  lazyLoad: null,
  nextArrow: null,
  onEdge: null,
  onInit: null,
  onLazyLoadError: null,
  onReInit: null,
  pauseOnDotsHover: false,
  pauseOnFocus: false,
  pauseOnHover: true,
  prevArrow: null,
  responsive: null,
  rows: 1,
  rtl: false,
  slide: "div",
  slidesPerRow: 1,
  slidesToScroll: 1,
  slidesToShow: 1,
  speed: 500,
  swipe: true,
  swipeEvent: null,
  swipeToSlide: false,
  touchMove: true,
  touchThreshold: 5,
  useCSS: true,
  useTransform: true,
  variableWidth: false,
  vertical: false,
  waitForAnimate: true,
  asNavFor: null
};
function clamp$1(number4, lowerBound, upperBound) {
  return Math.max(lowerBound, Math.min(number4, upperBound));
}
var safePreventDefault = function safePreventDefault2(event) {
  var passiveEvents = ["onTouchStart", "onTouchMove", "onWheel"];
  if (!passiveEvents.includes(event._reactName)) {
    event.preventDefault();
  }
};
var getOnDemandLazySlides = function getOnDemandLazySlides2(spec) {
  var onDemandSlides = [];
  var startIndex = lazyStartIndex(spec);
  var endIndex = lazyEndIndex(spec);
  for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
    if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
      onDemandSlides.push(slideIndex);
    }
  }
  return onDemandSlides;
};
var lazyStartIndex = function lazyStartIndex2(spec) {
  return spec.currentSlide - lazySlidesOnLeft(spec);
};
var lazyEndIndex = function lazyEndIndex2(spec) {
  return spec.currentSlide + lazySlidesOnRight(spec);
};
var lazySlidesOnLeft = function lazySlidesOnLeft2(spec) {
  return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
};
var lazySlidesOnRight = function lazySlidesOnRight2(spec) {
  return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
};
var getWidth = function getWidth2(elem) {
  return elem && elem.offsetWidth || 0;
};
var getHeight2 = function getHeight3(elem) {
  return elem && elem.offsetHeight || 0;
};
var getSwipeDirection = function getSwipeDirection2(touchObject) {
  var verticalSwiping = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
  var xDist, yDist, r2, swipeAngle;
  xDist = touchObject.startX - touchObject.curX;
  yDist = touchObject.startY - touchObject.curY;
  r2 = Math.atan2(yDist, xDist);
  swipeAngle = Math.round(r2 * 180 / Math.PI);
  if (swipeAngle < 0) {
    swipeAngle = 360 - Math.abs(swipeAngle);
  }
  if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
    return "left";
  }
  if (swipeAngle >= 135 && swipeAngle <= 225) {
    return "right";
  }
  if (verticalSwiping === true) {
    if (swipeAngle >= 35 && swipeAngle <= 135) {
      return "up";
    } else {
      return "down";
    }
  }
  return "vertical";
};
var canGoNext = function canGoNext2(spec) {
  var canGo = true;
  if (!spec.infinite) {
    if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
      canGo = false;
    } else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
      canGo = false;
    }
  }
  return canGo;
};
var extractObject = function extractObject2(spec, keys2) {
  var newObject = {};
  keys2.forEach(function(key) {
    return newObject[key] = spec[key];
  });
  return newObject;
};
var initializedState = function initializedState2(spec) {
  var slideCount = React$6.Children.count(spec.children);
  var listNode = spec.listRef;
  var listWidth = Math.ceil(getWidth(listNode));
  var trackNode = spec.trackRef && spec.trackRef.node;
  var trackWidth = Math.ceil(getWidth(trackNode));
  var slideWidth;
  if (!spec.vertical) {
    var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
    if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
      centerPaddingAdj *= listWidth / 100;
    }
    slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
  } else {
    slideWidth = listWidth;
  }
  var slideHeight = listNode && getHeight2(listNode.querySelector('[data-index="0"]'));
  var listHeight = slideHeight * spec.slidesToShow;
  var currentSlide = spec.currentSlide === void 0 ? spec.initialSlide : spec.currentSlide;
  if (spec.rtl && spec.currentSlide === void 0) {
    currentSlide = slideCount - 1 - spec.initialSlide;
  }
  var lazyLoadedList = spec.lazyLoadedList || [];
  var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, spec), {}, {
    currentSlide,
    lazyLoadedList
  }));
  lazyLoadedList = lazyLoadedList.concat(slidesToLoad);
  var state = {
    slideCount,
    slideWidth,
    listWidth,
    trackWidth,
    currentSlide,
    slideHeight,
    listHeight,
    lazyLoadedList
  };
  if (spec.autoplaying === null && spec.autoplay) {
    state["autoplaying"] = "playing";
  }
  return state;
};
var slideHandler = function slideHandler2(spec) {
  var waitForAnimate = spec.waitForAnimate, animating = spec.animating, fade = spec.fade, infinite = spec.infinite, index2 = spec.index, slideCount = spec.slideCount, lazyLoad = spec.lazyLoad, currentSlide = spec.currentSlide, centerMode = spec.centerMode, slidesToScroll = spec.slidesToScroll, slidesToShow = spec.slidesToShow, useCSS = spec.useCSS;
  var lazyLoadedList = spec.lazyLoadedList;
  if (waitForAnimate && animating)
    return {};
  var animationSlide = index2, finalSlide, animationLeft, finalLeft;
  var state = {}, nextState = {};
  var targetSlide = infinite ? index2 : clamp$1(index2, 0, slideCount - 1);
  if (fade) {
    if (!infinite && (index2 < 0 || index2 >= slideCount))
      return {};
    if (index2 < 0) {
      animationSlide = index2 + slideCount;
    } else if (index2 >= slideCount) {
      animationSlide = index2 - slideCount;
    }
    if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
      lazyLoadedList = lazyLoadedList.concat(animationSlide);
    }
    state = {
      animating: true,
      currentSlide: animationSlide,
      lazyLoadedList,
      targetSlide: animationSlide
    };
    nextState = {
      animating: false,
      targetSlide: animationSlide
    };
  } else {
    finalSlide = animationSlide;
    if (animationSlide < 0) {
      finalSlide = animationSlide + slideCount;
      if (!infinite)
        finalSlide = 0;
      else if (slideCount % slidesToScroll !== 0)
        finalSlide = slideCount - slideCount % slidesToScroll;
    } else if (!canGoNext(spec) && animationSlide > currentSlide) {
      animationSlide = finalSlide = currentSlide;
    } else if (centerMode && animationSlide >= slideCount) {
      animationSlide = infinite ? slideCount : slideCount - 1;
      finalSlide = infinite ? 0 : slideCount - 1;
    } else if (animationSlide >= slideCount) {
      finalSlide = animationSlide - slideCount;
      if (!infinite)
        finalSlide = slideCount - slidesToShow;
      else if (slideCount % slidesToScroll !== 0)
        finalSlide = 0;
    }
    if (!infinite && animationSlide + slidesToShow >= slideCount) {
      finalSlide = slideCount - slidesToShow;
    }
    animationLeft = getTrackLeft(_objectSpread2(_objectSpread2({}, spec), {}, {
      slideIndex: animationSlide
    }));
    finalLeft = getTrackLeft(_objectSpread2(_objectSpread2({}, spec), {}, {
      slideIndex: finalSlide
    }));
    if (!infinite) {
      if (animationLeft === finalLeft)
        animationSlide = finalSlide;
      animationLeft = finalLeft;
    }
    if (lazyLoad) {
      lazyLoadedList = lazyLoadedList.concat(getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, spec), {}, {
        currentSlide: animationSlide
      })));
    }
    if (!useCSS) {
      state = {
        currentSlide: finalSlide,
        trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: finalLeft
        })),
        lazyLoadedList,
        targetSlide
      };
    } else {
      state = {
        animating: true,
        currentSlide: finalSlide,
        trackStyle: getTrackAnimateCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: animationLeft
        })),
        lazyLoadedList,
        targetSlide
      };
      nextState = {
        animating: false,
        currentSlide: finalSlide,
        trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
          left: finalLeft
        })),
        swipeLeft: null,
        targetSlide
      };
    }
  }
  return {
    state,
    nextState
  };
};
var changeSlide = function changeSlide2(spec, options) {
  var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
  var slidesToScroll = spec.slidesToScroll, slidesToShow = spec.slidesToShow, slideCount = spec.slideCount, currentSlide = spec.currentSlide, previousTargetSlide = spec.targetSlide, lazyLoad = spec.lazyLoad, infinite = spec.infinite;
  unevenOffset = slideCount % slidesToScroll !== 0;
  indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
  if (options.message === "previous") {
    slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
    targetSlide = currentSlide - slideOffset;
    if (lazyLoad && !infinite) {
      previousInt = currentSlide - slideOffset;
      targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
    }
    if (!infinite) {
      targetSlide = previousTargetSlide - slidesToScroll;
    }
  } else if (options.message === "next") {
    slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
    targetSlide = currentSlide + slideOffset;
    if (lazyLoad && !infinite) {
      targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
    }
    if (!infinite) {
      targetSlide = previousTargetSlide + slidesToScroll;
    }
  } else if (options.message === "dots") {
    targetSlide = options.index * options.slidesToScroll;
  } else if (options.message === "children") {
    targetSlide = options.index;
    if (infinite) {
      var direction = siblingDirection(_objectSpread2(_objectSpread2({}, spec), {}, {
        targetSlide
      }));
      if (targetSlide > options.currentSlide && direction === "left") {
        targetSlide = targetSlide - slideCount;
      } else if (targetSlide < options.currentSlide && direction === "right") {
        targetSlide = targetSlide + slideCount;
      }
    }
  } else if (options.message === "index") {
    targetSlide = Number(options.index);
  }
  return targetSlide;
};
var keyHandler = function keyHandler2(e2, accessibility, rtl) {
  if (e2.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility)
    return "";
  if (e2.keyCode === 37)
    return rtl ? "next" : "previous";
  if (e2.keyCode === 39)
    return rtl ? "previous" : "next";
  return "";
};
var swipeStart = function swipeStart2(e2, swipe, draggable) {
  e2.target.tagName === "IMG" && safePreventDefault(e2);
  if (!swipe || !draggable && e2.type.indexOf("mouse") !== -1)
    return "";
  return {
    dragging: true,
    touchObject: {
      startX: e2.touches ? e2.touches[0].pageX : e2.clientX,
      startY: e2.touches ? e2.touches[0].pageY : e2.clientY,
      curX: e2.touches ? e2.touches[0].pageX : e2.clientX,
      curY: e2.touches ? e2.touches[0].pageY : e2.clientY
    }
  };
};
var swipeMove = function swipeMove2(e2, spec) {
  var scrolling = spec.scrolling, animating = spec.animating, vertical = spec.vertical, swipeToSlide = spec.swipeToSlide, verticalSwiping = spec.verticalSwiping, rtl = spec.rtl, currentSlide = spec.currentSlide, edgeFriction = spec.edgeFriction, edgeDragged = spec.edgeDragged, onEdge = spec.onEdge, swiped = spec.swiped, swiping = spec.swiping, slideCount = spec.slideCount, slidesToScroll = spec.slidesToScroll, infinite = spec.infinite, touchObject = spec.touchObject, swipeEvent = spec.swipeEvent, listHeight = spec.listHeight, listWidth = spec.listWidth;
  if (scrolling)
    return;
  if (animating)
    return safePreventDefault(e2);
  if (vertical && swipeToSlide && verticalSwiping)
    safePreventDefault(e2);
  var swipeLeft, state = {};
  var curLeft = getTrackLeft(spec);
  touchObject.curX = e2.touches ? e2.touches[0].pageX : e2.clientX;
  touchObject.curY = e2.touches ? e2.touches[0].pageY : e2.clientY;
  touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
  var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
  if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
    return {
      scrolling: true
    };
  }
  if (verticalSwiping)
    touchObject.swipeLength = verticalSwipeLength;
  var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
  if (verticalSwiping)
    positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
  var dotCount = Math.ceil(slideCount / slidesToScroll);
  var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
  var touchSwipeLength = touchObject.swipeLength;
  if (!infinite) {
    if (currentSlide === 0 && (swipeDirection === "right" || swipeDirection === "down") || currentSlide + 1 >= dotCount && (swipeDirection === "left" || swipeDirection === "up") || !canGoNext(spec) && (swipeDirection === "left" || swipeDirection === "up")) {
      touchSwipeLength = touchObject.swipeLength * edgeFriction;
      if (edgeDragged === false && onEdge) {
        onEdge(swipeDirection);
        state["edgeDragged"] = true;
      }
    }
  }
  if (!swiped && swipeEvent) {
    swipeEvent(swipeDirection);
    state["swiped"] = true;
  }
  if (!vertical) {
    if (!rtl) {
      swipeLeft = curLeft + touchSwipeLength * positionOffset;
    } else {
      swipeLeft = curLeft - touchSwipeLength * positionOffset;
    }
  } else {
    swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
  }
  if (verticalSwiping) {
    swipeLeft = curLeft + touchSwipeLength * positionOffset;
  }
  state = _objectSpread2(_objectSpread2({}, state), {}, {
    touchObject,
    swipeLeft,
    trackStyle: getTrackCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
      left: swipeLeft
    }))
  });
  if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
    return state;
  }
  if (touchObject.swipeLength > 10) {
    state["swiping"] = true;
    safePreventDefault(e2);
  }
  return state;
};
var swipeEnd = function swipeEnd2(e2, spec) {
  var dragging = spec.dragging, swipe = spec.swipe, touchObject = spec.touchObject, listWidth = spec.listWidth, touchThreshold = spec.touchThreshold, verticalSwiping = spec.verticalSwiping, listHeight = spec.listHeight, swipeToSlide = spec.swipeToSlide, scrolling = spec.scrolling, onSwipe = spec.onSwipe, targetSlide = spec.targetSlide, currentSlide = spec.currentSlide, infinite = spec.infinite;
  if (!dragging) {
    if (swipe)
      safePreventDefault(e2);
    return {};
  }
  var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
  var swipeDirection = getSwipeDirection(touchObject, verticalSwiping);
  var state = {
    dragging: false,
    edgeDragged: false,
    scrolling: false,
    swiping: false,
    swiped: false,
    swipeLeft: null,
    touchObject: {}
  };
  if (scrolling) {
    return state;
  }
  if (!touchObject.swipeLength) {
    return state;
  }
  if (touchObject.swipeLength > minSwipe) {
    safePreventDefault(e2);
    if (onSwipe) {
      onSwipe(swipeDirection);
    }
    var slideCount, newSlide;
    var activeSlide = infinite ? currentSlide : targetSlide;
    switch (swipeDirection) {
      case "left":
      case "up":
        newSlide = activeSlide + getSlideCount(spec);
        slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
        state["currentDirection"] = 0;
        break;
      case "right":
      case "down":
        newSlide = activeSlide - getSlideCount(spec);
        slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
        state["currentDirection"] = 1;
        break;
      default:
        slideCount = activeSlide;
    }
    state["triggerSlideHandler"] = slideCount;
  } else {
    var currentLeft = getTrackLeft(spec);
    state["trackStyle"] = getTrackAnimateCSS(_objectSpread2(_objectSpread2({}, spec), {}, {
      left: currentLeft
    }));
  }
  return state;
};
var getNavigableIndexes = function getNavigableIndexes2(spec) {
  var max2 = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
  var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
  var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
  var indexes = [];
  while (breakpoint < max2) {
    indexes.push(breakpoint);
    breakpoint = counter + spec.slidesToScroll;
    counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
  }
  return indexes;
};
var checkNavigable = function checkNavigable2(spec, index2) {
  var navigables = getNavigableIndexes(spec);
  var prevNavigable = 0;
  if (index2 > navigables[navigables.length - 1]) {
    index2 = navigables[navigables.length - 1];
  } else {
    for (var n2 in navigables) {
      if (index2 < navigables[n2]) {
        index2 = prevNavigable;
        break;
      }
      prevNavigable = navigables[n2];
    }
  }
  return index2;
};
var getSlideCount = function getSlideCount2(spec) {
  var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
  if (spec.swipeToSlide) {
    var swipedSlide;
    var slickList = spec.listRef;
    var slides = slickList.querySelectorAll && slickList.querySelectorAll(".slick-slide") || [];
    Array.from(slides).every(function(slide) {
      if (!spec.vertical) {
        if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
          swipedSlide = slide;
          return false;
        }
      } else {
        if (slide.offsetTop + getHeight2(slide) / 2 > spec.swipeLeft * -1) {
          swipedSlide = slide;
          return false;
        }
      }
      return true;
    });
    if (!swipedSlide) {
      return 0;
    }
    var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
    var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
    return slidesTraversed;
  } else {
    return spec.slidesToScroll;
  }
};
var checkSpecKeys = function checkSpecKeys2(spec, keysArray) {
  return (
    // eslint-disable-next-line no-prototype-builtins
    keysArray.reduce(function(value2, key) {
      return value2 && spec.hasOwnProperty(key);
    }, true) ? null : console.error("Keys Missing:", spec)
  );
};
var getTrackCSS = function getTrackCSS2(spec) {
  checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
  var trackWidth, trackHeight;
  if (!spec.vertical) {
    trackWidth = getTotalSlides(spec) * spec.slideWidth;
  } else {
    var trackChildren = spec.unslick ? spec.slideCount : spec.slideCount + 2 * spec.slidesToShow;
    trackHeight = trackChildren * spec.slideHeight;
  }
  var style2 = {
    opacity: 1,
    transition: "",
    WebkitTransition: ""
  };
  if (spec.useTransform) {
    var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
    var transform2 = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
    var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
    style2 = _objectSpread2(_objectSpread2({}, style2), {}, {
      WebkitTransform,
      transform: transform2,
      msTransform
    });
  } else {
    if (spec.vertical) {
      style2["top"] = spec.left;
    } else {
      style2["left"] = spec.left;
    }
  }
  if (spec.fade)
    style2 = {
      opacity: 1
    };
  if (trackWidth)
    style2.width = trackWidth;
  if (trackHeight)
    style2.height = trackHeight;
  if (window && !window.addEventListener && window.attachEvent) {
    if (!spec.vertical) {
      style2.marginLeft = spec.left + "px";
    } else {
      style2.marginTop = spec.left + "px";
    }
  }
  return style2;
};
var getTrackAnimateCSS = function getTrackAnimateCSS2(spec) {
  checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
  var style2 = getTrackCSS(spec);
  if (spec.useTransform) {
    style2.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
    style2.transition = "transform " + spec.speed + "ms " + spec.cssEase;
  } else {
    if (spec.vertical) {
      style2.transition = "top " + spec.speed + "ms " + spec.cssEase;
    } else {
      style2.transition = "left " + spec.speed + "ms " + spec.cssEase;
    }
  }
  return style2;
};
var getTrackLeft = function getTrackLeft2(spec) {
  if (spec.unslick) {
    return 0;
  }
  checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
  var slideIndex = spec.slideIndex, trackRef = spec.trackRef, infinite = spec.infinite, centerMode = spec.centerMode, slideCount = spec.slideCount, slidesToShow = spec.slidesToShow, slidesToScroll = spec.slidesToScroll, slideWidth = spec.slideWidth, listWidth = spec.listWidth, variableWidth = spec.variableWidth, slideHeight = spec.slideHeight, fade = spec.fade, vertical = spec.vertical;
  var slideOffset = 0;
  var targetLeft;
  var targetSlide;
  var verticalOffset = 0;
  if (fade || spec.slideCount === 1) {
    return 0;
  }
  var slidesToOffset = 0;
  if (infinite) {
    slidesToOffset = -getPreClones(spec);
    if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
      slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
    }
    if (centerMode) {
      slidesToOffset += parseInt(slidesToShow / 2);
    }
  } else {
    if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
      slidesToOffset = slidesToShow - slideCount % slidesToScroll;
    }
    if (centerMode) {
      slidesToOffset = parseInt(slidesToShow / 2);
    }
  }
  slideOffset = slidesToOffset * slideWidth;
  verticalOffset = slidesToOffset * slideHeight;
  if (!vertical) {
    targetLeft = slideIndex * slideWidth * -1 + slideOffset;
  } else {
    targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
  }
  if (variableWidth === true) {
    var targetSlideIndex;
    var trackElem = trackRef && trackRef.node;
    targetSlideIndex = slideIndex + getPreClones(spec);
    targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
    targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
    if (centerMode === true) {
      targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
      targetSlide = trackElem && trackElem.children[targetSlideIndex];
      targetLeft = 0;
      for (var slide = 0; slide < targetSlideIndex; slide++) {
        targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
      }
      targetLeft -= parseInt(spec.centerPadding);
      targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
    }
  }
  return targetLeft;
};
var getPreClones = function getPreClones2(spec) {
  if (spec.unslick || !spec.infinite) {
    return 0;
  }
  if (spec.variableWidth) {
    return spec.slideCount;
  }
  return spec.slidesToShow + (spec.centerMode ? 1 : 0);
};
var getPostClones = function getPostClones2(spec) {
  if (spec.unslick || !spec.infinite) {
    return 0;
  }
  return spec.slideCount;
};
var getTotalSlides = function getTotalSlides2(spec) {
  return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
};
var siblingDirection = function siblingDirection2(spec) {
  if (spec.targetSlide > spec.currentSlide) {
    if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
      return "left";
    }
    return "right";
  } else {
    if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
      return "right";
    }
    return "left";
  }
};
var slidesOnRight = function slidesOnRight2(_ref) {
  var slidesToShow = _ref.slidesToShow, centerMode = _ref.centerMode, rtl = _ref.rtl, centerPadding = _ref.centerPadding;
  if (centerMode) {
    var right = (slidesToShow - 1) / 2 + 1;
    if (parseInt(centerPadding) > 0)
      right += 1;
    if (rtl && slidesToShow % 2 === 0)
      right += 1;
    return right;
  }
  if (rtl) {
    return 0;
  }
  return slidesToShow - 1;
};
var slidesOnLeft = function slidesOnLeft2(_ref2) {
  var slidesToShow = _ref2.slidesToShow, centerMode = _ref2.centerMode, rtl = _ref2.rtl, centerPadding = _ref2.centerPadding;
  if (centerMode) {
    var left2 = (slidesToShow - 1) / 2 + 1;
    if (parseInt(centerPadding) > 0)
      left2 += 1;
    if (!rtl && slidesToShow % 2 === 0)
      left2 += 1;
    return left2;
  }
  if (rtl) {
    return slidesToShow - 1;
  }
  return 0;
};
var canUseDOM$2 = function canUseDOM() {
  return !!(typeof window !== "undefined" && window.document && window.document.createElement);
};
var validSettings = Object.keys(defaultProps$2);
function filterSettings(settings) {
  return validSettings.reduce(function(acc, settingName) {
    if (settings.hasOwnProperty(settingName)) {
      acc[settingName] = settings[settingName];
    }
    return acc;
  }, {});
}
function _callSuper$j(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var getSlideClasses = function getSlideClasses2(spec) {
  var slickActive, slickCenter, slickCloned;
  var centerOffset, index2;
  if (spec.rtl) {
    index2 = spec.slideCount - 1 - spec.index;
  } else {
    index2 = spec.index;
  }
  slickCloned = index2 < 0 || index2 >= spec.slideCount;
  if (spec.centerMode) {
    centerOffset = Math.floor(spec.slidesToShow / 2);
    slickCenter = (index2 - spec.currentSlide) % spec.slideCount === 0;
    if (index2 > spec.currentSlide - centerOffset - 1 && index2 <= spec.currentSlide + centerOffset) {
      slickActive = true;
    }
  } else {
    slickActive = spec.currentSlide <= index2 && index2 < spec.currentSlide + spec.slidesToShow;
  }
  var focusedSlide;
  if (spec.targetSlide < 0) {
    focusedSlide = spec.targetSlide + spec.slideCount;
  } else if (spec.targetSlide >= spec.slideCount) {
    focusedSlide = spec.targetSlide - spec.slideCount;
  } else {
    focusedSlide = spec.targetSlide;
  }
  var slickCurrent = index2 === focusedSlide;
  return {
    "slick-slide": true,
    "slick-active": slickActive,
    "slick-center": slickCenter,
    "slick-cloned": slickCloned,
    "slick-current": slickCurrent
    // dubious in case of RTL
  };
};
var getSlideStyle = function getSlideStyle2(spec) {
  var style2 = {};
  if (spec.variableWidth === void 0 || spec.variableWidth === false) {
    style2.width = spec.slideWidth;
  }
  if (spec.fade) {
    style2.position = "relative";
    if (spec.vertical && spec.slideHeight) {
      style2.top = -spec.index * parseInt(spec.slideHeight);
    } else {
      style2.left = -spec.index * parseInt(spec.slideWidth);
    }
    style2.opacity = spec.currentSlide === spec.index ? 1 : 0;
    style2.zIndex = spec.currentSlide === spec.index ? 999 : 998;
    if (spec.useCSS) {
      style2.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", visibility " + spec.speed + "ms " + spec.cssEase;
    }
  }
  return style2;
};
var getKey$1 = function getKey(child, fallbackKey) {
  return child.key + "-" + fallbackKey;
};
var renderSlides = function renderSlides2(spec) {
  var key;
  var slides = [];
  var preCloneSlides = [];
  var postCloneSlides = [];
  var childrenCount = React$6.Children.count(spec.children);
  var startIndex = lazyStartIndex(spec);
  var endIndex = lazyEndIndex(spec);
  React$6.Children.forEach(spec.children, function(elem, index2) {
    var child;
    var childOnClickOptions = {
      message: "children",
      index: index2,
      slidesToScroll: spec.slidesToScroll,
      currentSlide: spec.currentSlide
    };
    if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index2) >= 0) {
      child = elem;
    } else {
      child = /* @__PURE__ */ React$6.createElement("div", null);
    }
    var childStyle = getSlideStyle(_objectSpread2(_objectSpread2({}, spec), {}, {
      index: index2
    }));
    var slideClass = child.props.className || "";
    var slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
      index: index2
    }));
    slides.push(/* @__PURE__ */ React$6.cloneElement(child, {
      key: "original" + getKey$1(child, index2),
      "data-index": index2,
      className: classNames(slideClasses, slideClass),
      tabIndex: "-1",
      "aria-hidden": !slideClasses["slick-active"],
      style: _objectSpread2(_objectSpread2({
        outline: "none"
      }, child.props.style || {}), childStyle),
      onClick: function onClick(e2) {
        child.props && child.props.onClick && child.props.onClick(e2);
        if (spec.focusOnSelect) {
          spec.focusOnSelect(childOnClickOptions);
        }
      }
    }));
    if (spec.infinite && childrenCount > 1 && spec.fade === false && !spec.unslick) {
      var preCloneNo = childrenCount - index2;
      if (preCloneNo <= getPreClones(spec)) {
        key = -preCloneNo;
        if (key >= startIndex) {
          child = elem;
        }
        slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
          index: key
        }));
        preCloneSlides.push(/* @__PURE__ */ React$6.cloneElement(child, {
          key: "precloned" + getKey$1(child, key),
          "data-index": key,
          tabIndex: "-1",
          className: classNames(slideClasses, slideClass),
          "aria-hidden": !slideClasses["slick-active"],
          style: _objectSpread2(_objectSpread2({}, child.props.style || {}), childStyle),
          onClick: function onClick(e2) {
            child.props && child.props.onClick && child.props.onClick(e2);
            if (spec.focusOnSelect) {
              spec.focusOnSelect(childOnClickOptions);
            }
          }
        }));
      }
      key = childrenCount + index2;
      if (key < endIndex) {
        child = elem;
      }
      slideClasses = getSlideClasses(_objectSpread2(_objectSpread2({}, spec), {}, {
        index: key
      }));
      postCloneSlides.push(/* @__PURE__ */ React$6.cloneElement(child, {
        key: "postcloned" + getKey$1(child, key),
        "data-index": key,
        tabIndex: "-1",
        className: classNames(slideClasses, slideClass),
        "aria-hidden": !slideClasses["slick-active"],
        style: _objectSpread2(_objectSpread2({}, child.props.style || {}), childStyle),
        onClick: function onClick(e2) {
          child.props && child.props.onClick && child.props.onClick(e2);
          if (spec.focusOnSelect) {
            spec.focusOnSelect(childOnClickOptions);
          }
        }
      }));
    }
  });
  if (spec.rtl) {
    return preCloneSlides.concat(slides, postCloneSlides).reverse();
  } else {
    return preCloneSlides.concat(slides, postCloneSlides);
  }
};
var Track = /* @__PURE__ */ function(_React$PureComponent) {
  function Track2() {
    var _this;
    _classCallCheck$a(this, Track2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$j(this, Track2, [].concat(args));
    _defineProperty$4(_this, "node", null);
    _defineProperty$4(_this, "handleRef", function(ref) {
      _this.node = ref;
    });
    return _this;
  }
  _inherits$a(Track2, _React$PureComponent);
  return _createClass$8(Track2, [{
    key: "render",
    value: function render3() {
      var slides = renderSlides(this.props);
      var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, onMouseOver = _this$props.onMouseOver, onMouseLeave = _this$props.onMouseLeave;
      var mouseEvents = {
        onMouseEnter,
        onMouseOver,
        onMouseLeave
      };
      return /* @__PURE__ */ React$6.createElement("div", _extends$j({
        ref: this.handleRef,
        className: "slick-track",
        style: this.props.trackStyle
      }, mouseEvents), slides);
    }
  }]);
}(React$6.PureComponent);
function _callSuper$i(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var getDotCount = function getDotCount2(spec) {
  var dots;
  if (spec.infinite) {
    dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
  } else {
    dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
  }
  return dots;
};
var Dots = /* @__PURE__ */ function(_React$PureComponent) {
  function Dots2() {
    _classCallCheck$a(this, Dots2);
    return _callSuper$i(this, Dots2, arguments);
  }
  _inherits$a(Dots2, _React$PureComponent);
  return _createClass$8(Dots2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      e2.preventDefault();
      this.props.clickHandler(options);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props = this.props, onMouseEnter = _this$props.onMouseEnter, onMouseOver = _this$props.onMouseOver, onMouseLeave = _this$props.onMouseLeave, infinite = _this$props.infinite, slidesToScroll = _this$props.slidesToScroll, slidesToShow = _this$props.slidesToShow, slideCount = _this$props.slideCount, currentSlide = _this$props.currentSlide;
      var dotCount = getDotCount({
        slideCount,
        slidesToScroll,
        slidesToShow,
        infinite
      });
      var mouseEvents = {
        onMouseEnter,
        onMouseOver,
        onMouseLeave
      };
      var dots = [];
      for (var i2 = 0; i2 < dotCount; i2++) {
        var _rightBound = (i2 + 1) * slidesToScroll - 1;
        var rightBound = infinite ? _rightBound : clamp$1(_rightBound, 0, slideCount - 1);
        var _leftBound = rightBound - (slidesToScroll - 1);
        var leftBound = infinite ? _leftBound : clamp$1(_leftBound, 0, slideCount - 1);
        var className = classNames({
          "slick-active": infinite ? currentSlide >= leftBound && currentSlide <= rightBound : currentSlide === leftBound
        });
        var dotOptions = {
          message: "dots",
          index: i2,
          slidesToScroll,
          currentSlide
        };
        var onClick = this.clickHandler.bind(this, dotOptions);
        dots = dots.concat(/* @__PURE__ */ React$6.createElement("li", {
          key: i2,
          className
        }, /* @__PURE__ */ React$6.cloneElement(this.props.customPaging(i2), {
          onClick
        })));
      }
      return /* @__PURE__ */ React$6.cloneElement(this.props.appendDots(dots), _objectSpread2({
        className: this.props.dotsClass
      }, mouseEvents));
    }
  }]);
}(React$6.PureComponent);
function _callSuper$h(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var PrevArrow = /* @__PURE__ */ function(_React$PureComponent) {
  function PrevArrow2() {
    _classCallCheck$a(this, PrevArrow2);
    return _callSuper$h(this, PrevArrow2, arguments);
  }
  _inherits$a(PrevArrow2, _React$PureComponent);
  return _createClass$8(PrevArrow2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      if (e2) {
        e2.preventDefault();
      }
      this.props.clickHandler(options, e2);
    }
  }, {
    key: "render",
    value: function render3() {
      var prevClasses = {
        "slick-arrow": true,
        "slick-prev": true
      };
      var prevHandler = this.clickHandler.bind(this, {
        message: "previous"
      });
      if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
        prevClasses["slick-disabled"] = true;
        prevHandler = null;
      }
      var prevArrowProps = {
        key: "0",
        "data-role": "none",
        className: classNames(prevClasses),
        style: {
          display: "block"
        },
        onClick: prevHandler
      };
      var customProps = {
        currentSlide: this.props.currentSlide,
        slideCount: this.props.slideCount
      };
      var prevArrow;
      if (this.props.prevArrow) {
        prevArrow = /* @__PURE__ */ React$6.cloneElement(this.props.prevArrow, _objectSpread2(_objectSpread2({}, prevArrowProps), customProps));
      } else {
        prevArrow = /* @__PURE__ */ React$6.createElement("button", _extends$j({
          key: "0",
          type: "button"
        }, prevArrowProps), " ", "Previous");
      }
      return prevArrow;
    }
  }]);
}(React$6.PureComponent);
var NextArrow = /* @__PURE__ */ function(_React$PureComponent2) {
  function NextArrow2() {
    _classCallCheck$a(this, NextArrow2);
    return _callSuper$h(this, NextArrow2, arguments);
  }
  _inherits$a(NextArrow2, _React$PureComponent2);
  return _createClass$8(NextArrow2, [{
    key: "clickHandler",
    value: function clickHandler(options, e2) {
      if (e2) {
        e2.preventDefault();
      }
      this.props.clickHandler(options, e2);
    }
  }, {
    key: "render",
    value: function render3() {
      var nextClasses = {
        "slick-arrow": true,
        "slick-next": true
      };
      var nextHandler = this.clickHandler.bind(this, {
        message: "next"
      });
      if (!canGoNext(this.props)) {
        nextClasses["slick-disabled"] = true;
        nextHandler = null;
      }
      var nextArrowProps = {
        key: "1",
        "data-role": "none",
        className: classNames(nextClasses),
        style: {
          display: "block"
        },
        onClick: nextHandler
      };
      var customProps = {
        currentSlide: this.props.currentSlide,
        slideCount: this.props.slideCount
      };
      var nextArrow;
      if (this.props.nextArrow) {
        nextArrow = /* @__PURE__ */ React$6.cloneElement(this.props.nextArrow, _objectSpread2(_objectSpread2({}, nextArrowProps), customProps));
      } else {
        nextArrow = /* @__PURE__ */ React$6.createElement("button", _extends$j({
          key: "1",
          type: "button"
        }, nextArrowProps), " ", "Next");
      }
      return nextArrow;
    }
  }]);
}(React$6.PureComponent);
var _excluded$d = ["animating"];
function _callSuper$g(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var InnerSlider = /* @__PURE__ */ function(_React$Component) {
  function InnerSlider2(props) {
    var _this;
    _classCallCheck$a(this, InnerSlider2);
    _this = _callSuper$g(this, InnerSlider2, [props]);
    _defineProperty$4(_this, "listRefHandler", function(ref) {
      return _this.list = ref;
    });
    _defineProperty$4(_this, "trackRefHandler", function(ref) {
      return _this.track = ref;
    });
    _defineProperty$4(_this, "adaptHeight", function() {
      if (_this.props.adaptiveHeight && _this.list) {
        var elem = _this.list.querySelector('[data-index="'.concat(_this.state.currentSlide, '"]'));
        _this.list.style.height = getHeight2(elem) + "px";
      }
    });
    _defineProperty$4(_this, "componentDidMount", function() {
      _this.props.onInit && _this.props.onInit();
      if (_this.props.lazyLoad) {
        var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, _this.props), _this.state));
        if (slidesToLoad.length > 0) {
          _this.setState(function(prevState) {
            return {
              lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
            };
          });
          if (_this.props.onLazyLoad) {
            _this.props.onLazyLoad(slidesToLoad);
          }
        }
      }
      var spec = _objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props);
      _this.updateState(spec, true, function() {
        _this.adaptHeight();
        _this.props.autoplay && _this.autoPlay("playing");
      });
      if (_this.props.lazyLoad === "progressive") {
        _this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1e3);
      }
      _this.ro = new index$2(function() {
        if (_this.state.animating) {
          _this.onWindowResized(false);
          _this.callbackTimers.push(setTimeout(function() {
            return _this.onWindowResized();
          }, _this.props.speed));
        } else {
          _this.onWindowResized();
        }
      });
      _this.ro.observe(_this.list);
      document.querySelectorAll && Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function(slide) {
        slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
        slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
      });
      if (window.addEventListener) {
        window.addEventListener("resize", _this.onWindowResized);
      } else {
        window.attachEvent("onresize", _this.onWindowResized);
      }
    });
    _defineProperty$4(_this, "componentWillUnmount", function() {
      if (_this.animationEndCallback) {
        clearTimeout(_this.animationEndCallback);
      }
      if (_this.lazyLoadTimer) {
        clearInterval(_this.lazyLoadTimer);
      }
      if (_this.callbackTimers.length) {
        _this.callbackTimers.forEach(function(timer) {
          return clearTimeout(timer);
        });
        _this.callbackTimers = [];
      }
      if (window.addEventListener) {
        window.removeEventListener("resize", _this.onWindowResized);
      } else {
        window.detachEvent("onresize", _this.onWindowResized);
      }
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
      }
      _this.ro.disconnect();
    });
    _defineProperty$4(_this, "componentDidUpdate", function(prevProps) {
      _this.checkImagesLoad();
      _this.props.onReInit && _this.props.onReInit();
      if (_this.props.lazyLoad) {
        var slidesToLoad = getOnDemandLazySlides(_objectSpread2(_objectSpread2({}, _this.props), _this.state));
        if (slidesToLoad.length > 0) {
          _this.setState(function(prevState) {
            return {
              lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
            };
          });
          if (_this.props.onLazyLoad) {
            _this.props.onLazyLoad(slidesToLoad);
          }
        }
      }
      _this.adaptHeight();
      var spec = _objectSpread2(_objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props), _this.state);
      var setTrackStyle = _this.didPropsChange(prevProps);
      setTrackStyle && _this.updateState(spec, setTrackStyle, function() {
        if (_this.state.currentSlide >= React$6.Children.count(_this.props.children)) {
          _this.changeSlide({
            message: "index",
            index: React$6.Children.count(_this.props.children) - _this.props.slidesToShow,
            currentSlide: _this.state.currentSlide
          });
        }
        if (prevProps.autoplay !== _this.props.autoplay || prevProps.autoplaySpeed !== _this.props.autoplaySpeed) {
          if (!prevProps.autoplay && _this.props.autoplay) {
            _this.autoPlay("playing");
          } else if (_this.props.autoplay) {
            _this.autoPlay("update");
          } else {
            _this.pause("paused");
          }
        }
      });
    });
    _defineProperty$4(_this, "onWindowResized", function(setTrackStyle) {
      if (_this.debouncedResize)
        _this.debouncedResize.cancel();
      _this.debouncedResize = debounce$3(50, function() {
        return _this.resizeWindow(setTrackStyle);
      });
      _this.debouncedResize();
    });
    _defineProperty$4(_this, "resizeWindow", function() {
      var setTrackStyle = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
      var isTrackMounted = Boolean(_this.track && _this.track.node);
      if (!isTrackMounted)
        return;
      var spec = _objectSpread2(_objectSpread2({
        listRef: _this.list,
        trackRef: _this.track
      }, _this.props), _this.state);
      _this.updateState(spec, setTrackStyle, function() {
        if (_this.props.autoplay)
          _this.autoPlay("update");
        else
          _this.pause("paused");
      });
      _this.setState({
        animating: false
      });
      clearTimeout(_this.animationEndCallback);
      delete _this.animationEndCallback;
    });
    _defineProperty$4(_this, "updateState", function(spec, setTrackStyle, callback2) {
      var updatedState = initializedState(spec);
      spec = _objectSpread2(_objectSpread2(_objectSpread2({}, spec), updatedState), {}, {
        slideIndex: updatedState.currentSlide
      });
      var targetLeft = getTrackLeft(spec);
      spec = _objectSpread2(_objectSpread2({}, spec), {}, {
        left: targetLeft
      });
      var trackStyle = getTrackCSS(spec);
      if (setTrackStyle || React$6.Children.count(_this.props.children) !== React$6.Children.count(spec.children)) {
        updatedState["trackStyle"] = trackStyle;
      }
      _this.setState(updatedState, callback2);
    });
    _defineProperty$4(_this, "ssrInit", function() {
      if (_this.props.variableWidth) {
        var _trackWidth = 0, _trackLeft = 0;
        var childrenWidths = [];
        var preClones = getPreClones(_objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
          slideCount: _this.props.children.length
        }));
        var postClones = getPostClones(_objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
          slideCount: _this.props.children.length
        }));
        _this.props.children.forEach(function(child) {
          childrenWidths.push(child.props.style.width);
          _trackWidth += child.props.style.width;
        });
        for (var i2 = 0; i2 < preClones; i2++) {
          _trackLeft += childrenWidths[childrenWidths.length - 1 - i2];
          _trackWidth += childrenWidths[childrenWidths.length - 1 - i2];
        }
        for (var _i = 0; _i < postClones; _i++) {
          _trackWidth += childrenWidths[_i];
        }
        for (var _i2 = 0; _i2 < _this.state.currentSlide; _i2++) {
          _trackLeft += childrenWidths[_i2];
        }
        var _trackStyle = {
          width: _trackWidth + "px",
          left: -_trackLeft + "px"
        };
        if (_this.props.centerMode) {
          var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
          _trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
        }
        return {
          trackStyle: _trackStyle
        };
      }
      var childrenCount = React$6.Children.count(_this.props.children);
      var spec = _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        slideCount: childrenCount
      });
      var slideCount = getPreClones(spec) + getPostClones(spec) + childrenCount;
      var trackWidth = 100 / _this.props.slidesToShow * slideCount;
      var slideWidth = 100 / slideCount;
      var trackLeft = -slideWidth * (getPreClones(spec) + _this.state.currentSlide) * trackWidth / 100;
      if (_this.props.centerMode) {
        trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
      }
      var trackStyle = {
        width: trackWidth + "%",
        left: trackLeft + "%"
      };
      return {
        slideWidth: slideWidth + "%",
        trackStyle
      };
    });
    _defineProperty$4(_this, "checkImagesLoad", function() {
      var images = _this.list && _this.list.querySelectorAll && _this.list.querySelectorAll(".slick-slide img") || [];
      var imagesCount = images.length, loadedCount = 0;
      Array.prototype.forEach.call(images, function(image2) {
        var handler = function handler2() {
          return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
        };
        if (!image2.onclick) {
          image2.onclick = function() {
            return image2.parentNode.focus();
          };
        } else {
          var prevClickHandler = image2.onclick;
          image2.onclick = function(e2) {
            prevClickHandler(e2);
            image2.parentNode.focus();
          };
        }
        if (!image2.onload) {
          if (_this.props.lazyLoad) {
            image2.onload = function() {
              _this.adaptHeight();
              _this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
            };
          } else {
            image2.onload = handler;
            image2.onerror = function() {
              handler();
              _this.props.onLazyLoadError && _this.props.onLazyLoadError();
            };
          }
        }
      });
    });
    _defineProperty$4(_this, "progressiveLazyLoad", function() {
      var slidesToLoad = [];
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      for (var index2 = _this.state.currentSlide; index2 < _this.state.slideCount + getPostClones(spec); index2++) {
        if (_this.state.lazyLoadedList.indexOf(index2) < 0) {
          slidesToLoad.push(index2);
          break;
        }
      }
      for (var _index = _this.state.currentSlide - 1; _index >= -getPreClones(spec); _index--) {
        if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
          slidesToLoad.push(_index);
          break;
        }
      }
      if (slidesToLoad.length > 0) {
        _this.setState(function(state) {
          return {
            lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
          };
        });
        if (_this.props.onLazyLoad) {
          _this.props.onLazyLoad(slidesToLoad);
        }
      } else {
        if (_this.lazyLoadTimer) {
          clearInterval(_this.lazyLoadTimer);
          delete _this.lazyLoadTimer;
        }
      }
    });
    _defineProperty$4(_this, "slideHandler", function(index2) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var _this$props = _this.props, asNavFor = _this$props.asNavFor, beforeChange = _this$props.beforeChange, onLazyLoad = _this$props.onLazyLoad, speed = _this$props.speed, afterChange = _this$props.afterChange;
      var currentSlide = _this.state.currentSlide;
      var _slideHandler = slideHandler(_objectSpread2(_objectSpread2(_objectSpread2({
        index: index2
      }, _this.props), _this.state), {}, {
        trackRef: _this.track,
        useCSS: _this.props.useCSS && !dontAnimate
      })), state = _slideHandler.state, nextState = _slideHandler.nextState;
      if (!state)
        return;
      beforeChange && beforeChange(currentSlide, state.currentSlide);
      var slidesToLoad = state.lazyLoadedList.filter(function(value2) {
        return _this.state.lazyLoadedList.indexOf(value2) < 0;
      });
      onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
      if (!_this.props.waitForAnimate && _this.animationEndCallback) {
        clearTimeout(_this.animationEndCallback);
        afterChange && afterChange(currentSlide);
        delete _this.animationEndCallback;
      }
      _this.setState(state, function() {
        if (asNavFor && _this.asNavForIndex !== index2) {
          _this.asNavForIndex = index2;
          asNavFor.innerSlider.slideHandler(index2);
        }
        if (!nextState)
          return;
        _this.animationEndCallback = setTimeout(function() {
          var animating = nextState.animating, firstBatch = _objectWithoutProperties$3(nextState, _excluded$d);
          _this.setState(firstBatch, function() {
            _this.callbackTimers.push(setTimeout(function() {
              return _this.setState({
                animating
              });
            }, 10));
            afterChange && afterChange(state.currentSlide);
            delete _this.animationEndCallback;
          });
        }, speed);
      });
    });
    _defineProperty$4(_this, "changeSlide", function(options) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      var targetSlide = changeSlide(spec, options);
      if (targetSlide !== 0 && !targetSlide)
        return;
      if (dontAnimate === true) {
        _this.slideHandler(targetSlide, dontAnimate);
      } else {
        _this.slideHandler(targetSlide);
      }
      _this.props.autoplay && _this.autoPlay("update");
      if (_this.props.focusOnSelect) {
        var nodes = _this.list.querySelectorAll(".slick-current");
        nodes[0] && nodes[0].focus();
      }
    });
    _defineProperty$4(_this, "clickHandler", function(e2) {
      if (_this.clickable === false) {
        e2.stopPropagation();
        e2.preventDefault();
      }
      _this.clickable = true;
    });
    _defineProperty$4(_this, "keyHandler", function(e2) {
      var dir = keyHandler(e2, _this.props.accessibility, _this.props.rtl);
      dir !== "" && _this.changeSlide({
        message: dir
      });
    });
    _defineProperty$4(_this, "selectHandler", function(options) {
      _this.changeSlide(options);
    });
    _defineProperty$4(_this, "disableBodyScroll", function() {
      var preventDefault2 = function preventDefault3(e2) {
        e2 = e2 || window.event;
        if (e2.preventDefault)
          e2.preventDefault();
        e2.returnValue = false;
      };
      window.ontouchmove = preventDefault2;
    });
    _defineProperty$4(_this, "enableBodyScroll", function() {
      window.ontouchmove = null;
    });
    _defineProperty$4(_this, "swipeStart", function(e2) {
      if (_this.props.verticalSwiping) {
        _this.disableBodyScroll();
      }
      var state = swipeStart(e2, _this.props.swipe, _this.props.draggable);
      state !== "" && _this.setState(state);
    });
    _defineProperty$4(_this, "swipeMove", function(e2) {
      var state = swipeMove(e2, _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        trackRef: _this.track,
        listRef: _this.list,
        slideIndex: _this.state.currentSlide
      }));
      if (!state)
        return;
      if (state["swiping"]) {
        _this.clickable = false;
      }
      _this.setState(state);
    });
    _defineProperty$4(_this, "swipeEnd", function(e2) {
      var state = swipeEnd(e2, _objectSpread2(_objectSpread2(_objectSpread2({}, _this.props), _this.state), {}, {
        trackRef: _this.track,
        listRef: _this.list,
        slideIndex: _this.state.currentSlide
      }));
      if (!state)
        return;
      var triggerSlideHandler = state["triggerSlideHandler"];
      delete state["triggerSlideHandler"];
      _this.setState(state);
      if (triggerSlideHandler === void 0)
        return;
      _this.slideHandler(triggerSlideHandler);
      if (_this.props.verticalSwiping) {
        _this.enableBodyScroll();
      }
    });
    _defineProperty$4(_this, "touchEnd", function(e2) {
      _this.swipeEnd(e2);
      _this.clickable = true;
    });
    _defineProperty$4(_this, "slickPrev", function() {
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "previous"
        });
      }, 0));
    });
    _defineProperty$4(_this, "slickNext", function() {
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "next"
        });
      }, 0));
    });
    _defineProperty$4(_this, "slickGoTo", function(slide) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      slide = Number(slide);
      if (isNaN(slide))
        return "";
      _this.callbackTimers.push(setTimeout(function() {
        return _this.changeSlide({
          message: "index",
          index: slide,
          currentSlide: _this.state.currentSlide
        }, dontAnimate);
      }, 0));
    });
    _defineProperty$4(_this, "play", function() {
      var nextIndex;
      if (_this.props.rtl) {
        nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
      } else {
        if (canGoNext(_objectSpread2(_objectSpread2({}, _this.props), _this.state))) {
          nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
        } else {
          return false;
        }
      }
      _this.slideHandler(nextIndex);
    });
    _defineProperty$4(_this, "autoPlay", function(playType) {
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
      }
      var autoplaying = _this.state.autoplaying;
      if (playType === "update") {
        if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
          return;
        }
      } else if (playType === "leave") {
        if (autoplaying === "paused" || autoplaying === "focused") {
          return;
        }
      } else if (playType === "blur") {
        if (autoplaying === "paused" || autoplaying === "hovered") {
          return;
        }
      }
      _this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
      _this.setState({
        autoplaying: "playing"
      });
    });
    _defineProperty$4(_this, "pause", function(pauseType) {
      if (_this.autoplayTimer) {
        clearInterval(_this.autoplayTimer);
        _this.autoplayTimer = null;
      }
      var autoplaying = _this.state.autoplaying;
      if (pauseType === "paused") {
        _this.setState({
          autoplaying: "paused"
        });
      } else if (pauseType === "focused") {
        if (autoplaying === "hovered" || autoplaying === "playing") {
          _this.setState({
            autoplaying: "focused"
          });
        }
      } else {
        if (autoplaying === "playing") {
          _this.setState({
            autoplaying: "hovered"
          });
        }
      }
    });
    _defineProperty$4(_this, "onDotsOver", function() {
      return _this.props.autoplay && _this.pause("hovered");
    });
    _defineProperty$4(_this, "onDotsLeave", function() {
      return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
    });
    _defineProperty$4(_this, "onTrackOver", function() {
      return _this.props.autoplay && _this.pause("hovered");
    });
    _defineProperty$4(_this, "onTrackLeave", function() {
      return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
    });
    _defineProperty$4(_this, "onSlideFocus", function() {
      return _this.props.autoplay && _this.pause("focused");
    });
    _defineProperty$4(_this, "onSlideBlur", function() {
      return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
    });
    _defineProperty$4(_this, "render", function() {
      var className = classNames("slick-slider", _this.props.className, {
        "slick-vertical": _this.props.vertical,
        "slick-initialized": true
      });
      var spec = _objectSpread2(_objectSpread2({}, _this.props), _this.state);
      var trackProps = extractObject(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding", "targetSlide", "useCSS"]);
      var pauseOnHover = _this.props.pauseOnHover;
      trackProps = _objectSpread2(_objectSpread2({}, trackProps), {}, {
        onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
        onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
        onMouseOver: pauseOnHover ? _this.onTrackOver : null,
        focusOnSelect: _this.props.focusOnSelect && _this.clickable ? _this.selectHandler : null
      });
      var dots;
      if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
        var dotProps = extractObject(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
        var pauseOnDotsHover = _this.props.pauseOnDotsHover;
        dotProps = _objectSpread2(_objectSpread2({}, dotProps), {}, {
          clickHandler: _this.changeSlide,
          onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
          onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
          onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
        });
        dots = /* @__PURE__ */ React$6.createElement(Dots, dotProps);
      }
      var prevArrow, nextArrow;
      var arrowProps = extractObject(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
      arrowProps.clickHandler = _this.changeSlide;
      if (_this.props.arrows) {
        prevArrow = /* @__PURE__ */ React$6.createElement(PrevArrow, arrowProps);
        nextArrow = /* @__PURE__ */ React$6.createElement(NextArrow, arrowProps);
      }
      var verticalHeightStyle = null;
      if (_this.props.vertical) {
        verticalHeightStyle = {
          height: _this.state.listHeight
        };
      }
      var centerPaddingStyle = null;
      if (_this.props.vertical === false) {
        if (_this.props.centerMode === true) {
          centerPaddingStyle = {
            padding: "0px " + _this.props.centerPadding
          };
        }
      } else {
        if (_this.props.centerMode === true) {
          centerPaddingStyle = {
            padding: _this.props.centerPadding + " 0px"
          };
        }
      }
      var listStyle = _objectSpread2(_objectSpread2({}, verticalHeightStyle), centerPaddingStyle);
      var touchMove = _this.props.touchMove;
      var listProps = {
        className: "slick-list",
        style: listStyle,
        onClick: _this.clickHandler,
        onMouseDown: touchMove ? _this.swipeStart : null,
        onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
        onMouseUp: touchMove ? _this.swipeEnd : null,
        onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
        onTouchStart: touchMove ? _this.swipeStart : null,
        onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
        onTouchEnd: touchMove ? _this.touchEnd : null,
        onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
        onKeyDown: _this.props.accessibility ? _this.keyHandler : null
      };
      var innerSliderProps = {
        className,
        dir: "ltr",
        style: _this.props.style
      };
      if (_this.props.unslick) {
        listProps = {
          className: "slick-list"
        };
        innerSliderProps = {
          className,
          style: _this.props.style
        };
      }
      return /* @__PURE__ */ React$6.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /* @__PURE__ */ React$6.createElement("div", _extends$j({
        ref: _this.listRefHandler
      }, listProps), /* @__PURE__ */ React$6.createElement(Track, _extends$j({
        ref: _this.trackRefHandler
      }, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
    });
    _this.list = null;
    _this.track = null;
    _this.state = _objectSpread2(_objectSpread2({}, initialState$2), {}, {
      currentSlide: _this.props.initialSlide,
      targetSlide: _this.props.initialSlide ? _this.props.initialSlide : 0,
      slideCount: React$6.Children.count(_this.props.children)
    });
    _this.callbackTimers = [];
    _this.clickable = true;
    _this.debouncedResize = null;
    var ssrState = _this.ssrInit();
    _this.state = _objectSpread2(_objectSpread2({}, _this.state), ssrState);
    return _this;
  }
  _inherits$a(InnerSlider2, _React$Component);
  return _createClass$8(InnerSlider2, [{
    key: "didPropsChange",
    value: function didPropsChange(prevProps) {
      var setTrackStyle = false;
      for (var _i3 = 0, _Object$keys = Object.keys(this.props); _i3 < _Object$keys.length; _i3++) {
        var key = _Object$keys[_i3];
        if (!prevProps.hasOwnProperty(key)) {
          setTrackStyle = true;
          break;
        }
        if (_typeof$2(prevProps[key]) === "object" || typeof prevProps[key] === "function" || isNaN(prevProps[key])) {
          continue;
        }
        if (prevProps[key] !== this.props[key]) {
          setTrackStyle = true;
          break;
        }
      }
      return setTrackStyle || React$6.Children.count(this.props.children) !== React$6.Children.count(prevProps.children);
    }
  }]);
}(React$6.Component);
var camel2hyphen$1 = function(str) {
  return str.replace(/[A-Z]/g, function(match5) {
    return "-" + match5.toLowerCase();
  }).toLowerCase();
};
var camel2hyphen_1 = camel2hyphen$1;
var camel2hyphen = camel2hyphen_1;
var isDimension = function(feature) {
  var re2 = /[height|width]$/;
  return re2.test(feature);
};
var obj2mq = function(obj) {
  var mq = "";
  var features = Object.keys(obj);
  features.forEach(function(feature, index2) {
    var value2 = obj[feature];
    feature = camel2hyphen(feature);
    if (isDimension(feature) && typeof value2 === "number") {
      value2 = value2 + "px";
    }
    if (value2 === true) {
      mq += feature;
    } else if (value2 === false) {
      mq += "not " + feature;
    } else {
      mq += "(" + feature + ": " + value2 + ")";
    }
    if (index2 < features.length - 1) {
      mq += " and ";
    }
  });
  return mq;
};
var json2mq = function(query) {
  var mq = "";
  if (typeof query === "string") {
    return query;
  }
  if (query instanceof Array) {
    query.forEach(function(q2, index2) {
      mq += obj2mq(q2);
      if (index2 < query.length - 1) {
        mq += ", ";
      }
    });
    return mq;
  }
  return obj2mq(query);
};
var json2mq_1 = json2mq;
const json2mq$1 = /* @__PURE__ */ getDefaultExportFromCjs(json2mq_1);
function _callSuper$f(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$g() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
var Slider$1 = /* @__PURE__ */ function(_React$Component) {
  function Slider22(props) {
    var _this;
    _classCallCheck$a(this, Slider22);
    _this = _callSuper$f(this, Slider22, [props]);
    _defineProperty$4(_this, "innerSliderRefHandler", function(ref) {
      return _this.innerSlider = ref;
    });
    _defineProperty$4(_this, "slickPrev", function() {
      return _this.innerSlider.slickPrev();
    });
    _defineProperty$4(_this, "slickNext", function() {
      return _this.innerSlider.slickNext();
    });
    _defineProperty$4(_this, "slickGoTo", function(slide) {
      var dontAnimate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      return _this.innerSlider.slickGoTo(slide, dontAnimate);
    });
    _defineProperty$4(_this, "slickPause", function() {
      return _this.innerSlider.pause("paused");
    });
    _defineProperty$4(_this, "slickPlay", function() {
      return _this.innerSlider.autoPlay("play");
    });
    _this.state = {
      breakpoint: null
    };
    _this._responsiveMediaHandlers = [];
    return _this;
  }
  _inherits$a(Slider22, _React$Component);
  return _createClass$8(Slider22, [{
    key: "media",
    value: function media(query, handler) {
      var mql = window.matchMedia(query);
      var listener = function listener2(_ref) {
        var matches = _ref.matches;
        if (matches) {
          handler();
        }
      };
      mql.addListener(listener);
      listener(mql);
      this._responsiveMediaHandlers.push({
        mql,
        query,
        listener
      });
    }
    // handles responsive breakpoints
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this2 = this;
      if (this.props.responsive) {
        var breakpoints = this.props.responsive.map(function(breakpt) {
          return breakpt.breakpoint;
        });
        breakpoints.sort(function(x2, y2) {
          return x2 - y2;
        });
        breakpoints.forEach(function(breakpoint, index2) {
          var bQuery;
          if (index2 === 0) {
            bQuery = json2mq$1({
              minWidth: 0,
              maxWidth: breakpoint
            });
          } else {
            bQuery = json2mq$1({
              minWidth: breakpoints[index2 - 1] + 1,
              maxWidth: breakpoint
            });
          }
          canUseDOM$2() && _this2.media(bQuery, function() {
            _this2.setState({
              breakpoint
            });
          });
        });
        var query = json2mq$1({
          minWidth: breakpoints.slice(-1)[0]
        });
        canUseDOM$2() && this.media(query, function() {
          _this2.setState({
            breakpoint: null
          });
        });
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this._responsiveMediaHandlers.forEach(function(obj) {
        obj.mql.removeListener(obj.listener);
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this3 = this;
      var settings;
      var newProps;
      if (this.state.breakpoint) {
        newProps = this.props.responsive.filter(function(resp) {
          return resp.breakpoint === _this3.state.breakpoint;
        });
        settings = newProps[0].settings === "unslick" ? "unslick" : _objectSpread2(_objectSpread2(_objectSpread2({}, defaultProps$2), this.props), newProps[0].settings);
      } else {
        settings = _objectSpread2(_objectSpread2({}, defaultProps$2), this.props);
      }
      if (settings.centerMode) {
        if (settings.slidesToScroll > 1 && false)
          ;
        settings.slidesToScroll = 1;
      }
      if (settings.fade) {
        if (settings.slidesToShow > 1 && false)
          ;
        if (settings.slidesToScroll > 1 && false)
          ;
        settings.slidesToShow = 1;
        settings.slidesToScroll = 1;
      }
      var children = React$6.Children.toArray(this.props.children);
      children = children.filter(function(child) {
        if (typeof child === "string") {
          return !!child.trim();
        }
        return !!child;
      });
      if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
        console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
        settings.variableWidth = false;
      }
      var newChildren = [];
      var currentWidth = null;
      for (var i2 = 0; i2 < children.length; i2 += settings.rows * settings.slidesPerRow) {
        var newSlide = [];
        for (var j2 = i2; j2 < i2 + settings.rows * settings.slidesPerRow; j2 += settings.slidesPerRow) {
          var row = [];
          for (var k2 = j2; k2 < j2 + settings.slidesPerRow; k2 += 1) {
            if (settings.variableWidth && children[k2].props.style) {
              currentWidth = children[k2].props.style.width;
            }
            if (k2 >= children.length)
              break;
            row.push(/* @__PURE__ */ React$6.cloneElement(children[k2], {
              key: 100 * i2 + 10 * j2 + k2,
              tabIndex: -1,
              style: {
                width: "".concat(100 / settings.slidesPerRow, "%"),
                display: "inline-block"
              }
            }));
          }
          newSlide.push(/* @__PURE__ */ React$6.createElement("div", {
            key: 10 * i2 + j2
          }, row));
        }
        if (settings.variableWidth) {
          newChildren.push(/* @__PURE__ */ React$6.createElement("div", {
            key: i2,
            style: {
              width: currentWidth
            }
          }, newSlide));
        } else {
          newChildren.push(/* @__PURE__ */ React$6.createElement("div", {
            key: i2
          }, newSlide));
        }
      }
      if (settings === "unslick") {
        var className = "regular slider " + (this.props.className || "");
        return /* @__PURE__ */ React$6.createElement("div", {
          className
        }, children);
      } else if (newChildren.length <= settings.slidesToShow && !settings.infinite) {
        settings.unslick = true;
      }
      return /* @__PURE__ */ React$6.createElement(InnerSlider, _extends$j({
        style: this.props.style,
        ref: this.innerSliderRefHandler
      }, filterSettings(settings)), newChildren);
    }
  }]);
}(React$6.Component);
const DotDuration = "--dot-duration";
const genCarouselStyle = (token2) => {
  const {
    componentCls,
    antCls
  } = token2;
  return {
    [componentCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
      ".slick-slider": {
        position: "relative",
        display: "block",
        boxSizing: "border-box",
        touchAction: "pan-y",
        WebkitTouchCallout: "none",
        WebkitTapHighlightColor: "transparent",
        ".slick-track, .slick-list": {
          transform: "translate3d(0, 0, 0)",
          touchAction: "pan-y"
        }
      },
      ".slick-list": {
        position: "relative",
        display: "block",
        margin: 0,
        padding: 0,
        overflow: "hidden",
        "&:focus": {
          outline: "none"
        },
        "&.dragging": {
          cursor: "pointer"
        },
        ".slick-slide": {
          pointerEvents: "none",
          // https://github.com/ant-design/ant-design/issues/23294
          [`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
            visibility: "hidden"
          },
          "&.slick-active": {
            pointerEvents: "auto",
            [`input${antCls}-radio-input, input${antCls}-checkbox-input`]: {
              visibility: "visible"
            }
          },
          // fix Carousel content height not match parent node
          // when children is empty node
          // https://github.com/ant-design/ant-design/issues/25878
          "> div > div": {
            verticalAlign: "bottom"
          }
        }
      },
      ".slick-track": {
        position: "relative",
        top: 0,
        insetInlineStart: 0,
        display: "block",
        "&::before, &::after": {
          display: "table",
          content: '""'
        },
        "&::after": {
          clear: "both"
        }
      },
      ".slick-slide": {
        display: "none",
        float: "left",
        height: "100%",
        minHeight: 1,
        img: {
          display: "block"
        },
        "&.dragging img": {
          pointerEvents: "none"
        }
      },
      ".slick-initialized .slick-slide": {
        display: "block"
      },
      ".slick-vertical .slick-slide": {
        display: "block",
        height: "auto"
      }
    })
  };
};
const genArrowsStyle = (token2) => {
  const {
    componentCls,
    motionDurationSlow,
    arrowSize,
    arrowOffset
  } = token2;
  const arrowLength = token2.calc(arrowSize).div(Math.SQRT2).equal();
  return {
    [componentCls]: {
      // Arrows
      ".slick-prev, .slick-next": {
        position: "absolute",
        top: "50%",
        width: arrowSize,
        height: arrowSize,
        transform: "translateY(-50%)",
        color: "#fff",
        opacity: 0.4,
        background: "transparent",
        padding: 0,
        lineHeight: 0,
        border: 0,
        outline: "none",
        cursor: "pointer",
        zIndex: 1,
        transition: `opacity ${motionDurationSlow}`,
        "&:hover, &:focus": {
          opacity: 1
        },
        "&.slick-disabled": {
          pointerEvents: "none",
          opacity: 0
        },
        "&::after": {
          boxSizing: "border-box",
          position: "absolute",
          top: token2.calc(arrowSize).sub(arrowLength).div(2).equal(),
          insetInlineStart: token2.calc(arrowSize).sub(arrowLength).div(2).equal(),
          display: "inline-block",
          width: arrowLength,
          height: arrowLength,
          border: `0 solid currentcolor`,
          borderInlineStartWidth: 2,
          borderBlockStartWidth: 2,
          borderRadius: 1,
          content: '""'
        }
      },
      ".slick-prev": {
        insetInlineStart: arrowOffset,
        "&::after": {
          transform: "rotate(-45deg)"
        }
      },
      ".slick-next": {
        insetInlineEnd: arrowOffset,
        "&::after": {
          transform: "rotate(135deg)"
        }
      }
    }
  };
};
const genDotsStyle = (token2) => {
  const {
    componentCls,
    dotOffset,
    dotWidth,
    dotHeight,
    dotGap,
    colorBgContainer,
    motionDurationSlow
  } = token2;
  return {
    [componentCls]: {
      ".slick-dots": {
        position: "absolute",
        insetInlineEnd: 0,
        bottom: 0,
        insetInlineStart: 0,
        zIndex: 15,
        display: "flex !important",
        justifyContent: "center",
        paddingInlineStart: 0,
        margin: 0,
        listStyle: "none",
        "&-bottom": {
          bottom: dotOffset
        },
        "&-top": {
          top: dotOffset,
          bottom: "auto"
        },
        li: {
          position: "relative",
          display: "inline-block",
          flex: "0 1 auto",
          boxSizing: "content-box",
          width: dotWidth,
          height: dotHeight,
          marginInline: dotGap,
          padding: 0,
          textAlign: "center",
          textIndent: -999,
          verticalAlign: "top",
          transition: `all ${motionDurationSlow}`,
          borderRadius: dotHeight,
          overflow: "hidden",
          "&::after": {
            display: "block",
            position: "absolute",
            top: 0,
            insetInlineStart: 0,
            width: "100%",
            height: dotHeight,
            content: '""',
            background: colorBgContainer,
            borderRadius: dotHeight,
            opacity: 1,
            outline: "none",
            cursor: "pointer",
            overflow: "hidden",
            transform: "translate3d(-100%, 0, 0)"
          },
          button: {
            position: "relative",
            display: "block",
            width: "100%",
            height: dotHeight,
            padding: 0,
            color: "transparent",
            fontSize: 0,
            background: colorBgContainer,
            border: 0,
            borderRadius: dotHeight,
            outline: "none",
            cursor: "pointer",
            opacity: 0.2,
            transition: `all ${motionDurationSlow}`,
            overflow: "hidden",
            "&:hover": {
              opacity: 0.75
            },
            "&::after": {
              position: "absolute",
              inset: token2.calc(dotGap).mul(-1).equal(),
              content: '""'
            }
          },
          "&.slick-active": {
            width: token2.dotActiveWidth,
            position: "relative",
            "&:hover": {
              opacity: 1
            },
            "&::after": {
              transform: "translate3d(0, 0, 0)",
              transition: `transform var(${DotDuration}) ease-out`
            }
          }
        }
      }
    }
  };
};
const genCarouselVerticalStyle = (token2) => {
  const {
    componentCls,
    dotOffset,
    arrowOffset,
    marginXXS
  } = token2;
  const reverseSizeOfDot = {
    width: token2.dotHeight,
    height: token2.dotWidth
  };
  return {
    [`${componentCls}-vertical`]: {
      ".slick-prev, .slick-next": {
        insetInlineStart: "50%",
        marginBlockStart: "unset",
        transform: "translateX(-50%)"
      },
      ".slick-prev": {
        insetBlockStart: arrowOffset,
        insetInlineStart: "50%",
        "&::after": {
          transform: "rotate(45deg)"
        }
      },
      ".slick-next": {
        insetBlockStart: "auto",
        insetBlockEnd: arrowOffset,
        "&::after": {
          transform: "rotate(-135deg)"
        }
      },
      ".slick-dots": {
        top: "50%",
        bottom: "auto",
        flexDirection: "column",
        width: token2.dotHeight,
        height: "auto",
        margin: 0,
        transform: "translateY(-50%)",
        "&-left": {
          insetInlineEnd: "auto",
          insetInlineStart: dotOffset
        },
        "&-right": {
          insetInlineEnd: dotOffset,
          insetInlineStart: "auto"
        },
        li: Object.assign(Object.assign({}, reverseSizeOfDot), {
          margin: `${unit$1(marginXXS)} 0`,
          verticalAlign: "baseline",
          button: reverseSizeOfDot,
          "&::after": Object.assign(Object.assign({}, reverseSizeOfDot), {
            height: 0
          }),
          "&.slick-active": Object.assign(Object.assign({}, reverseSizeOfDot), {
            button: reverseSizeOfDot,
            "&::after": Object.assign(Object.assign({}, reverseSizeOfDot), {
              transition: `height var(${DotDuration}) ease-out`
            })
          })
        })
      }
    }
  };
};
const genCarouselRtlStyle = (token2) => {
  const {
    componentCls
  } = token2;
  return [{
    [`${componentCls}-rtl`]: {
      direction: "rtl",
      // Dots
      ".slick-dots": {
        [`${componentCls}-rtl&`]: {
          flexDirection: "row-reverse"
        }
      }
    }
  }, {
    [`${componentCls}-vertical`]: {
      ".slick-dots": {
        [`${componentCls}-rtl&`]: {
          flexDirection: "column"
        }
      }
    }
  }];
};
const prepareComponentToken$1 = (token2) => {
  const dotActiveWidth = 24;
  return {
    arrowSize: 16,
    arrowOffset: token2.marginXS,
    dotWidth: 16,
    dotHeight: 3,
    dotGap: token2.marginXXS,
    dotOffset: 12,
    dotWidthActive: dotActiveWidth,
    dotActiveWidth
  };
};
const useStyle$1 = genStyleHooks("Carousel", (token2) => [genCarouselStyle(token2), genArrowsStyle(token2), genDotsStyle(token2), genCarouselVerticalStyle(token2), genCarouselRtlStyle(token2)], prepareComponentToken$1, {
  deprecatedTokens: [["dotWidthActive", "dotActiveWidth"]]
});
var __rest$3 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
const dotsClass = "slick-dots";
const ArrowButton = (_a2) => {
  var {
    currentSlide,
    slideCount
  } = _a2, rest = __rest$3(_a2, ["currentSlide", "slideCount"]);
  return /* @__PURE__ */ reactExports.createElement("button", Object.assign({
    type: "button"
  }, rest));
};
const Carousel = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
  const {
    dots = true,
    arrows = false,
    prevArrow = /* @__PURE__ */ reactExports.createElement(ArrowButton, {
      "aria-label": "prev"
    }),
    nextArrow = /* @__PURE__ */ reactExports.createElement(ArrowButton, {
      "aria-label": "next"
    }),
    draggable = false,
    waitForAnimate = false,
    dotPosition = "bottom",
    vertical = dotPosition === "left" || dotPosition === "right",
    rootClassName,
    className: customClassName,
    style: style2,
    id: id2,
    autoplay = false,
    autoplaySpeed = 3e3
  } = props, otherProps = __rest$3(props, ["dots", "arrows", "prevArrow", "nextArrow", "draggable", "waitForAnimate", "dotPosition", "vertical", "rootClassName", "className", "style", "id", "autoplay", "autoplaySpeed"]);
  const {
    getPrefixCls,
    direction,
    className: contextClassName,
    style: contextStyle
  } = useComponentConfig("carousel");
  const slickRef = reactExports.useRef(null);
  const goTo = (slide, dontAnimate = false) => {
    slickRef.current.slickGoTo(slide, dontAnimate);
  };
  reactExports.useImperativeHandle(ref, () => ({
    goTo,
    autoPlay: slickRef.current.innerSlider.autoPlay,
    innerSlider: slickRef.current.innerSlider,
    prev: slickRef.current.slickPrev,
    next: slickRef.current.slickNext
  }), [slickRef.current]);
  const prevCount = reactExports.useRef(reactExports.Children.count(props.children));
  reactExports.useEffect(() => {
    if (prevCount.current !== reactExports.Children.count(props.children)) {
      goTo(props.initialSlide || 0, false);
      prevCount.current = reactExports.Children.count(props.children);
    }
  }, [props.children]);
  const newProps = Object.assign({
    vertical,
    className: classNames(customClassName, contextClassName),
    style: Object.assign(Object.assign({}, contextStyle), style2),
    autoplay: !!autoplay
  }, otherProps);
  if (newProps.effect === "fade") {
    newProps.fade = true;
  }
  const prefixCls = getPrefixCls("carousel", newProps.prefixCls);
  const enableDots = !!dots;
  const dsClass = classNames(dotsClass, `${dotsClass}-${dotPosition}`, typeof dots === "boolean" ? false : dots === null || dots === void 0 ? void 0 : dots.className);
  const [wrapCSSVar, hashId, cssVarCls] = useStyle$1(prefixCls);
  const className = classNames(prefixCls, {
    [`${prefixCls}-rtl`]: direction === "rtl",
    [`${prefixCls}-vertical`]: newProps.vertical
  }, hashId, cssVarCls, rootClassName);
  const mergedShowDuration = autoplay && (typeof autoplay === "object" ? autoplay.dotDuration : false);
  const dotDurationStyle = mergedShowDuration ? {
    [DotDuration]: `${autoplaySpeed}ms`
  } : {};
  return wrapCSSVar(/* @__PURE__ */ reactExports.createElement("div", {
    className,
    id: id2,
    style: dotDurationStyle
  }, /* @__PURE__ */ reactExports.createElement(Slider$1, Object.assign({
    ref: slickRef
  }, newProps, {
    dots: enableDots,
    dotsClass: dsClass,
    arrows,
    prevArrow,
    nextArrow,
    draggable,
    verticalSwiping: vertical,
    autoplaySpeed,
    waitForAnimate
  }))));
});
function getEntity(keyEntities, key) {
  return keyEntities[key];
}
var _excluded$c = ["children"];
function getPosition$1(level, index2) {
  return "".concat(level, "-").concat(index2);
}
function isTreeNode(node2) {
  return node2 && node2.type && node2.type.isTreeNode;
}
function getKey2(key, pos) {
  if (key !== null && key !== void 0) {
    return key;
  }
  return pos;
}
function fillFieldNames(fieldNames) {
  var _ref = fieldNames || {}, title = _ref.title, _title = _ref._title, key = _ref.key, children = _ref.children;
  var mergedTitle = title || "title";
  return {
    title: mergedTitle,
    _title: _title || [mergedTitle],
    key: key || "key",
    children: children || "children"
  };
}
function convertTreeToData(rootNodes) {
  function dig(node2) {
    var treeNodes = toArray$4(node2);
    return treeNodes.map(function(treeNode) {
      if (!isTreeNode(treeNode)) {
        warningOnce(!treeNode, "Tree/TreeNode can only accept TreeNode as children.");
        return null;
      }
      var key = treeNode.key;
      var _treeNode$props = treeNode.props, children = _treeNode$props.children, rest = _objectWithoutProperties$3(_treeNode$props, _excluded$c);
      var dataNode = _objectSpread2({
        key
      }, rest);
      var parsedChildren = dig(children);
      if (parsedChildren.length) {
        dataNode.children = parsedChildren;
      }
      return dataNode;
    }).filter(function(dataNode) {
      return dataNode;
    });
  }
  return dig(rootNodes);
}
function flattenTreeData(treeNodeList, expandedKeys, fieldNames) {
  var _fillFieldNames = fillFieldNames(fieldNames), fieldTitles = _fillFieldNames._title, fieldKey = _fillFieldNames.key, fieldChildren = _fillFieldNames.children;
  var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);
  var flattenList = [];
  function dig(list2) {
    var parent = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
    return list2.map(function(treeNode, index2) {
      var pos = getPosition$1(parent ? parent.pos : "0", index2);
      var mergedKey = getKey2(treeNode[fieldKey], pos);
      var mergedTitle;
      for (var i2 = 0; i2 < fieldTitles.length; i2 += 1) {
        var fieldTitle = fieldTitles[i2];
        if (treeNode[fieldTitle] !== void 0) {
          mergedTitle = treeNode[fieldTitle];
          break;
        }
      }
      var flattenNode = Object.assign(omit$1(treeNode, [].concat(_toConsumableArray(fieldTitles), [fieldKey, fieldChildren])), {
        title: mergedTitle,
        key: mergedKey,
        parent,
        pos,
        children: null,
        data: treeNode,
        isStart: [].concat(_toConsumableArray(parent ? parent.isStart : []), [index2 === 0]),
        isEnd: [].concat(_toConsumableArray(parent ? parent.isEnd : []), [index2 === list2.length - 1])
      });
      flattenList.push(flattenNode);
      if (expandedKeys === true || expandedKeySet.has(mergedKey)) {
        flattenNode.children = dig(treeNode[fieldChildren] || [], flattenNode);
      } else {
        flattenNode.children = [];
      }
      return flattenNode;
    });
  }
  dig(treeNodeList);
  return flattenList;
}
function traverseDataNodes(dataNodes, callback2, config2) {
  var mergedConfig = {};
  if (_typeof$2(config2) === "object") {
    mergedConfig = config2;
  } else {
    mergedConfig = {
      externalGetKey: config2
    };
  }
  mergedConfig = mergedConfig || {};
  var _mergedConfig = mergedConfig, childrenPropName = _mergedConfig.childrenPropName, externalGetKey = _mergedConfig.externalGetKey, fieldNames = _mergedConfig.fieldNames;
  var _fillFieldNames2 = fillFieldNames(fieldNames), fieldKey = _fillFieldNames2.key, fieldChildren = _fillFieldNames2.children;
  var mergeChildrenPropName = childrenPropName || fieldChildren;
  var syntheticGetKey;
  if (externalGetKey) {
    if (typeof externalGetKey === "string") {
      syntheticGetKey = function syntheticGetKey2(node2) {
        return node2[externalGetKey];
      };
    } else if (typeof externalGetKey === "function") {
      syntheticGetKey = function syntheticGetKey2(node2) {
        return externalGetKey(node2);
      };
    }
  } else {
    syntheticGetKey = function syntheticGetKey2(node2, pos) {
      return getKey2(node2[fieldKey], pos);
    };
  }
  function processNode(node2, index2, parent, pathNodes) {
    var children = node2 ? node2[mergeChildrenPropName] : dataNodes;
    var pos = node2 ? getPosition$1(parent.pos, index2) : "0";
    var connectNodes = node2 ? [].concat(_toConsumableArray(pathNodes), [node2]) : [];
    if (node2) {
      var key = syntheticGetKey(node2, pos);
      var _data = {
        node: node2,
        index: index2,
        pos,
        key,
        parentPos: parent.node ? parent.pos : null,
        level: parent.level + 1,
        nodes: connectNodes
      };
      callback2(_data);
    }
    if (children) {
      children.forEach(function(subNode, subIndex) {
        processNode(subNode, subIndex, {
          node: node2,
          pos,
          level: parent ? parent.level + 1 : -1
        }, connectNodes);
      });
    }
  }
  processNode(null);
}
function convertDataToEntities(dataNodes) {
  var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, initWrapper = _ref2.initWrapper, processEntity = _ref2.processEntity, onProcessFinished = _ref2.onProcessFinished, externalGetKey = _ref2.externalGetKey, childrenPropName = _ref2.childrenPropName, fieldNames = _ref2.fieldNames;
  var legacyExternalGetKey = arguments.length > 2 ? arguments[2] : void 0;
  var mergedExternalGetKey = externalGetKey || legacyExternalGetKey;
  var posEntities = {};
  var keyEntities = {};
  var wrapper = {
    posEntities,
    keyEntities
  };
  if (initWrapper) {
    wrapper = initWrapper(wrapper) || wrapper;
  }
  traverseDataNodes(dataNodes, function(item) {
    var node2 = item.node, index2 = item.index, pos = item.pos, key = item.key, parentPos = item.parentPos, level = item.level, nodes = item.nodes;
    var entity = {
      node: node2,
      nodes,
      index: index2,
      key,
      pos,
      level
    };
    var mergedKey = getKey2(key, pos);
    posEntities[pos] = entity;
    keyEntities[mergedKey] = entity;
    entity.parent = posEntities[parentPos];
    if (entity.parent) {
      entity.parent.children = entity.parent.children || [];
      entity.parent.children.push(entity);
    }
    if (processEntity) {
      processEntity(entity, wrapper);
    }
  }, {
    externalGetKey: mergedExternalGetKey,
    childrenPropName,
    fieldNames
  });
  if (onProcessFinished) {
    onProcessFinished(wrapper);
  }
  return wrapper;
}
function getTreeNodeProps(key, _ref3) {
  var expandedKeys = _ref3.expandedKeys, selectedKeys = _ref3.selectedKeys, loadedKeys = _ref3.loadedKeys, loadingKeys = _ref3.loadingKeys, checkedKeys = _ref3.checkedKeys, halfCheckedKeys = _ref3.halfCheckedKeys, dragOverNodeKey = _ref3.dragOverNodeKey, dropPosition = _ref3.dropPosition, keyEntities = _ref3.keyEntities;
  var entity = getEntity(keyEntities, key);
  var treeNodeProps = {
    eventKey: key,
    expanded: expandedKeys.indexOf(key) !== -1,
    selected: selectedKeys.indexOf(key) !== -1,
    loaded: loadedKeys.indexOf(key) !== -1,
    loading: loadingKeys.indexOf(key) !== -1,
    checked: checkedKeys.indexOf(key) !== -1,
    halfChecked: halfCheckedKeys.indexOf(key) !== -1,
    pos: String(entity ? entity.pos : ""),
    // [Legacy] Drag props
    // Since the interaction of drag is changed, the semantic of the props are
    // not accuracy, I think it should be finally removed
    dragOver: dragOverNodeKey === key && dropPosition === 0,
    dragOverGapTop: dragOverNodeKey === key && dropPosition === -1,
    dragOverGapBottom: dragOverNodeKey === key && dropPosition === 1
  };
  return treeNodeProps;
}
function convertNodePropsToEventData(props) {
  var data = props.data, expanded = props.expanded, selected = props.selected, checked = props.checked, loaded = props.loaded, loading = props.loading, halfChecked = props.halfChecked, dragOver = props.dragOver, dragOverGapTop = props.dragOverGapTop, dragOverGapBottom = props.dragOverGapBottom, pos = props.pos, active3 = props.active, eventKey = props.eventKey;
  var eventData = _objectSpread2(_objectSpread2({}, data), {}, {
    expanded,
    selected,
    checked,
    loaded,
    loading,
    halfChecked,
    dragOver,
    dragOverGapTop,
    dragOverGapBottom,
    pos,
    active: active3,
    key: eventKey
  });
  if (!("props" in eventData)) {
    Object.defineProperty(eventData, "props", {
      get: function get5() {
        warningOnce(false, "Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`.");
        return props;
      }
    });
  }
  return eventData;
}
function removeFromCheckedKeys(halfCheckedKeys, checkedKeys) {
  var filteredKeys = /* @__PURE__ */ new Set();
  halfCheckedKeys.forEach(function(key) {
    if (!checkedKeys.has(key)) {
      filteredKeys.add(key);
    }
  });
  return filteredKeys;
}
function isCheckDisabled(node2) {
  var _ref = node2 || {}, disabled = _ref.disabled, disableCheckbox = _ref.disableCheckbox, checkable = _ref.checkable;
  return !!(disabled || disableCheckbox) || checkable === false;
}
function fillConductCheck(keys2, levelEntities, maxLevel, syntheticGetCheckDisabled) {
  var checkedKeys = new Set(keys2);
  var halfCheckedKeys = /* @__PURE__ */ new Set();
  for (var level = 0; level <= maxLevel; level += 1) {
    var entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
    entities.forEach(function(entity) {
      var key = entity.key, node2 = entity.node, _entity$children = entity.children, children = _entity$children === void 0 ? [] : _entity$children;
      if (checkedKeys.has(key) && !syntheticGetCheckDisabled(node2)) {
        children.filter(function(childEntity) {
          return !syntheticGetCheckDisabled(childEntity.node);
        }).forEach(function(childEntity) {
          checkedKeys.add(childEntity.key);
        });
      }
    });
  }
  var visitedKeys = /* @__PURE__ */ new Set();
  for (var _level = maxLevel; _level >= 0; _level -= 1) {
    var _entities = levelEntities.get(_level) || /* @__PURE__ */ new Set();
    _entities.forEach(function(entity) {
      var parent = entity.parent, node2 = entity.node;
      if (syntheticGetCheckDisabled(node2) || !entity.parent || visitedKeys.has(entity.parent.key)) {
        return;
      }
      if (syntheticGetCheckDisabled(entity.parent.node)) {
        visitedKeys.add(parent.key);
        return;
      }
      var allChecked = true;
      var partialChecked = false;
      (parent.children || []).filter(function(childEntity) {
        return !syntheticGetCheckDisabled(childEntity.node);
      }).forEach(function(_ref2) {
        var key = _ref2.key;
        var checked = checkedKeys.has(key);
        if (allChecked && !checked) {
          allChecked = false;
        }
        if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
          partialChecked = true;
        }
      });
      if (allChecked) {
        checkedKeys.add(parent.key);
      }
      if (partialChecked) {
        halfCheckedKeys.add(parent.key);
      }
      visitedKeys.add(parent.key);
    });
  }
  return {
    checkedKeys: Array.from(checkedKeys),
    halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
  };
}
function cleanConductCheck(keys2, halfKeys, levelEntities, maxLevel, syntheticGetCheckDisabled) {
  var checkedKeys = new Set(keys2);
  var halfCheckedKeys = new Set(halfKeys);
  for (var level = 0; level <= maxLevel; level += 1) {
    var entities = levelEntities.get(level) || /* @__PURE__ */ new Set();
    entities.forEach(function(entity) {
      var key = entity.key, node2 = entity.node, _entity$children2 = entity.children, children = _entity$children2 === void 0 ? [] : _entity$children2;
      if (!checkedKeys.has(key) && !halfCheckedKeys.has(key) && !syntheticGetCheckDisabled(node2)) {
        children.filter(function(childEntity) {
          return !syntheticGetCheckDisabled(childEntity.node);
        }).forEach(function(childEntity) {
          checkedKeys.delete(childEntity.key);
        });
      }
    });
  }
  halfCheckedKeys = /* @__PURE__ */ new Set();
  var visitedKeys = /* @__PURE__ */ new Set();
  for (var _level2 = maxLevel; _level2 >= 0; _level2 -= 1) {
    var _entities2 = levelEntities.get(_level2) || /* @__PURE__ */ new Set();
    _entities2.forEach(function(entity) {
      var parent = entity.parent, node2 = entity.node;
      if (syntheticGetCheckDisabled(node2) || !entity.parent || visitedKeys.has(entity.parent.key)) {
        return;
      }
      if (syntheticGetCheckDisabled(entity.parent.node)) {
        visitedKeys.add(parent.key);
        return;
      }
      var allChecked = true;
      var partialChecked = false;
      (parent.children || []).filter(function(childEntity) {
        return !syntheticGetCheckDisabled(childEntity.node);
      }).forEach(function(_ref3) {
        var key = _ref3.key;
        var checked = checkedKeys.has(key);
        if (allChecked && !checked) {
          allChecked = false;
        }
        if (!partialChecked && (checked || halfCheckedKeys.has(key))) {
          partialChecked = true;
        }
      });
      if (!allChecked) {
        checkedKeys.delete(parent.key);
      }
      if (partialChecked) {
        halfCheckedKeys.add(parent.key);
      }
      visitedKeys.add(parent.key);
    });
  }
  return {
    checkedKeys: Array.from(checkedKeys),
    halfCheckedKeys: Array.from(removeFromCheckedKeys(halfCheckedKeys, checkedKeys))
  };
}
function conductCheck(keyList, checked, keyEntities, getCheckDisabled) {
  var warningMissKeys = [];
  var syntheticGetCheckDisabled;
  {
    syntheticGetCheckDisabled = isCheckDisabled;
  }
  var keys2 = new Set(keyList.filter(function(key) {
    var hasEntity = !!getEntity(keyEntities, key);
    if (!hasEntity) {
      warningMissKeys.push(key);
    }
    return hasEntity;
  }));
  var levelEntities = /* @__PURE__ */ new Map();
  var maxLevel = 0;
  Object.keys(keyEntities).forEach(function(key) {
    var entity = keyEntities[key];
    var level = entity.level;
    var levelSet = levelEntities.get(level);
    if (!levelSet) {
      levelSet = /* @__PURE__ */ new Set();
      levelEntities.set(level, levelSet);
    }
    levelSet.add(entity);
    maxLevel = Math.max(maxLevel, level);
  });
  warningOnce(!warningMissKeys.length, "Tree missing follow keys: ".concat(warningMissKeys.slice(0, 100).map(function(key) {
    return "'".concat(key, "'");
  }).join(", ")));
  var result;
  if (checked === true) {
    result = fillConductCheck(keys2, levelEntities, maxLevel, syntheticGetCheckDisabled);
  } else {
    result = cleanConductCheck(keys2, checked.halfCheckedKeys, levelEntities, maxLevel, syntheticGetCheckDisabled);
  }
  return result;
}
const genCheckboxStyle = (token2) => {
  const {
    checkboxCls
  } = token2;
  const wrapperCls = `${checkboxCls}-wrapper`;
  return [
    // ===================== Basic =====================
    {
      // Group
      [`${checkboxCls}-group`]: Object.assign(Object.assign({}, resetComponent(token2)), {
        display: "inline-flex",
        flexWrap: "wrap",
        columnGap: token2.marginXS,
        // Group > Grid
        [`> ${token2.antCls}-row`]: {
          flex: 1
        }
      }),
      // Wrapper
      [wrapperCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
        display: "inline-flex",
        alignItems: "baseline",
        cursor: "pointer",
        // Fix checkbox & radio in flex align #30260
        "&:after": {
          display: "inline-block",
          width: 0,
          overflow: "hidden",
          content: "'\\a0'"
        },
        // Checkbox near checkbox
        [`& + ${wrapperCls}`]: {
          marginInlineStart: 0
        },
        [`&${wrapperCls}-in-form-item`]: {
          'input[type="checkbox"]': {
            width: 14,
            // FIXME: magic
            height: 14
            // FIXME: magic
          }
        }
      }),
      // Wrapper > Checkbox
      [checkboxCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
        position: "relative",
        whiteSpace: "nowrap",
        lineHeight: 1,
        cursor: "pointer",
        borderRadius: token2.borderRadiusSM,
        // To make alignment right when `controlHeight` is changed
        // Ref: https://github.com/ant-design/ant-design/issues/41564
        alignSelf: "center",
        // Wrapper > Checkbox > input
        [`${checkboxCls}-input`]: {
          position: "absolute",
          // Since baseline align will get additional space offset,
          // we need to move input to top to make it align with text.
          // Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
          inset: 0,
          zIndex: 1,
          cursor: "pointer",
          opacity: 0,
          margin: 0,
          [`&:focus-visible + ${checkboxCls}-inner`]: Object.assign({}, genFocusOutline(token2))
        },
        // Wrapper > Checkbox > inner
        [`${checkboxCls}-inner`]: {
          boxSizing: "border-box",
          display: "block",
          width: token2.checkboxSize,
          height: token2.checkboxSize,
          direction: "ltr",
          backgroundColor: token2.colorBgContainer,
          border: `${unit$1(token2.lineWidth)} ${token2.lineType} ${token2.colorBorder}`,
          borderRadius: token2.borderRadiusSM,
          borderCollapse: "separate",
          transition: `all ${token2.motionDurationSlow}`,
          "&:after": {
            boxSizing: "border-box",
            position: "absolute",
            top: "50%",
            insetInlineStart: "25%",
            display: "table",
            width: token2.calc(token2.checkboxSize).div(14).mul(5).equal(),
            height: token2.calc(token2.checkboxSize).div(14).mul(8).equal(),
            border: `${unit$1(token2.lineWidthBold)} solid ${token2.colorWhite}`,
            borderTop: 0,
            borderInlineStart: 0,
            transform: "rotate(45deg) scale(0) translate(-50%,-50%)",
            opacity: 0,
            content: '""',
            transition: `all ${token2.motionDurationFast} ${token2.motionEaseInBack}, opacity ${token2.motionDurationFast}`
          }
        },
        // Wrapper > Checkbox + Text
        "& + span": {
          paddingInlineStart: token2.paddingXS,
          paddingInlineEnd: token2.paddingXS
        }
      })
    },
    // ===================== Hover =====================
    {
      // Wrapper & Wrapper > Checkbox
      [`
        ${wrapperCls}:not(${wrapperCls}-disabled),
        ${checkboxCls}:not(${checkboxCls}-disabled)
      `]: {
        [`&:hover ${checkboxCls}-inner`]: {
          borderColor: token2.colorPrimary
        }
      },
      [`${wrapperCls}:not(${wrapperCls}-disabled)`]: {
        [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled) ${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimaryHover,
          borderColor: "transparent"
        },
        [`&:hover ${checkboxCls}-checked:not(${checkboxCls}-disabled):after`]: {
          borderColor: token2.colorPrimaryHover
        }
      }
    },
    // ==================== Checked ====================
    {
      // Wrapper > Checkbox
      [`${checkboxCls}-checked`]: {
        [`${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimary,
          borderColor: token2.colorPrimary,
          "&:after": {
            opacity: 1,
            transform: "rotate(45deg) scale(1) translate(-50%,-50%)",
            transition: `all ${token2.motionDurationMid} ${token2.motionEaseOutBack} ${token2.motionDurationFast}`
          }
        }
      },
      [`
        ${wrapperCls}-checked:not(${wrapperCls}-disabled),
        ${checkboxCls}-checked:not(${checkboxCls}-disabled)
      `]: {
        [`&:hover ${checkboxCls}-inner`]: {
          backgroundColor: token2.colorPrimaryHover,
          borderColor: "transparent"
        }
      }
    },
    // ================= Indeterminate =================
    {
      [checkboxCls]: {
        "&-indeterminate": {
          "&": {
            // Wrapper > Checkbox > inner
            [`${checkboxCls}-inner`]: {
              backgroundColor: `${token2.colorBgContainer}`,
              borderColor: `${token2.colorBorder}`,
              "&:after": {
                top: "50%",
                insetInlineStart: "50%",
                width: token2.calc(token2.fontSizeLG).div(2).equal(),
                height: token2.calc(token2.fontSizeLG).div(2).equal(),
                backgroundColor: token2.colorPrimary,
                border: 0,
                transform: "translate(-50%, -50%) scale(1)",
                opacity: 1,
                content: '""'
              }
            },
            // https://github.com/ant-design/ant-design/issues/50074
            [`&:hover ${checkboxCls}-inner`]: {
              backgroundColor: `${token2.colorBgContainer}`,
              borderColor: `${token2.colorPrimary}`
            }
          }
        }
      }
    },
    // ==================== Disable ====================
    {
      // Wrapper
      [`${wrapperCls}-disabled`]: {
        cursor: "not-allowed"
      },
      // Wrapper > Checkbox
      [`${checkboxCls}-disabled`]: {
        // Wrapper > Checkbox > input
        [`&, ${checkboxCls}-input`]: {
          cursor: "not-allowed",
          // Disabled for native input to enable Tooltip event handler
          // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
          pointerEvents: "none"
        },
        // Wrapper > Checkbox > inner
        [`${checkboxCls}-inner`]: {
          background: token2.colorBgContainerDisabled,
          borderColor: token2.colorBorder,
          "&:after": {
            borderColor: token2.colorTextDisabled
          }
        },
        "&:after": {
          display: "none"
        },
        "& + span": {
          color: token2.colorTextDisabled
        },
        [`&${checkboxCls}-indeterminate ${checkboxCls}-inner::after`]: {
          background: token2.colorTextDisabled
        }
      }
    }
  ];
};
function getStyle$1(prefixCls, token2) {
  const checkboxToken = merge$4(token2, {
    checkboxCls: `.${prefixCls}`,
    checkboxSize: token2.controlInteractiveSize
  });
  return [genCheckboxStyle(checkboxToken)];
}
genStyleHooks("Checkbox", (token2, {
  prefixCls
}) => [getStyle$1(prefixCls, token2)]);
var UpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, "name": "up", "theme": "outlined" };
var UpOutlined = function UpOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: UpOutlined$1
  }));
};
var RefIcon$1e = /* @__PURE__ */ reactExports.forwardRef(UpOutlined);
var ClockCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" } }] }, "name": "clock-circle", "theme": "outlined" };
var ClockCircleOutlined = function ClockCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ClockCircleOutlined$1
  }));
};
var RefIcon$1d = /* @__PURE__ */ reactExports.forwardRef(ClockCircleOutlined);
var FileTextOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" } }] }, "name": "file-text", "theme": "outlined" };
var FileTextOutlined = function FileTextOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FileTextOutlined$1
  }));
};
var RefIcon$1c = /* @__PURE__ */ reactExports.forwardRef(FileTextOutlined);
var QuestionCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "question-circle", "theme": "outlined" };
var QuestionCircleOutlined = function QuestionCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: QuestionCircleOutlined$1
  }));
};
var RefIcon$1b = /* @__PURE__ */ reactExports.forwardRef(QuestionCircleOutlined);
var EyeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
var EyeOutlined = function EyeOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: EyeOutlined$1
  }));
};
var RefIcon$1a = /* @__PURE__ */ reactExports.forwardRef(EyeOutlined);
var ZoomInOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z" } }] }, "name": "zoom-in", "theme": "outlined" };
var ZoomInOutlined = function ZoomInOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ZoomInOutlined$1
  }));
};
var RefIcon$19 = /* @__PURE__ */ reactExports.forwardRef(ZoomInOutlined);
var EyeInvisibleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z" } }, { "tag": "path", "attrs": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z" } }] }, "name": "eye-invisible", "theme": "outlined" };
var EyeInvisibleOutlined = function EyeInvisibleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: EyeInvisibleOutlined$1
  }));
};
var RefIcon$18 = /* @__PURE__ */ reactExports.forwardRef(EyeInvisibleOutlined);
var ApartmentOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z" } }] }, "name": "apartment", "theme": "outlined" };
var ApartmentOutlined = function ApartmentOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ApartmentOutlined$1
  }));
};
var RefIcon$17 = /* @__PURE__ */ reactExports.forwardRef(ApartmentOutlined);
var ApiOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M917.7 148.8l-42.4-42.4c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-76.1 76.1a199.27 199.27 0 00-112.1-34.3c-51.2 0-102.4 19.5-141.5 58.6L432.3 308.7a8.03 8.03 0 000 11.3L704 591.7c1.6 1.6 3.6 2.3 5.7 2.3 2 0 4.1-.8 5.7-2.3l101.9-101.9c68.9-69 77-175.7 24.3-253.5l76.1-76.1c3.1-3.2 3.1-8.3 0-11.4zM769.1 441.7l-59.4 59.4-186.8-186.8 59.4-59.4c24.9-24.9 58.1-38.7 93.4-38.7 35.3 0 68.4 13.7 93.4 38.7 24.9 24.9 38.7 58.1 38.7 93.4 0 35.3-13.8 68.4-38.7 93.4zm-190.2 105a8.03 8.03 0 00-11.3 0L501 613.3 410.7 523l66.7-66.7c3.1-3.1 3.1-8.2 0-11.3L441 408.6a8.03 8.03 0 00-11.3 0L363 475.3l-43-43a7.85 7.85 0 00-5.7-2.3c-2 0-4.1.8-5.7 2.3L206.8 534.2c-68.9 69-77 175.7-24.3 253.5l-76.1 76.1a8.03 8.03 0 000 11.3l42.4 42.4c1.6 1.6 3.6 2.3 5.7 2.3s4.1-.8 5.7-2.3l76.1-76.1c33.7 22.9 72.9 34.3 112.1 34.3 51.2 0 102.4-19.5 141.5-58.6l101.9-101.9c3.1-3.1 3.1-8.2 0-11.3l-43-43 66.7-66.7c3.1-3.1 3.1-8.2 0-11.3l-36.6-36.2zM441.7 769.1a131.32 131.32 0 01-93.4 38.7c-35.3 0-68.4-13.7-93.4-38.7a131.32 131.32 0 01-38.7-93.4c0-35.3 13.7-68.4 38.7-93.4l59.4-59.4 186.8 186.8-59.4 59.4z" } }] }, "name": "api", "theme": "outlined" };
var ApiOutlined = function ApiOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ApiOutlined$1
  }));
};
var RefIcon$16 = /* @__PURE__ */ reactExports.forwardRef(ApiOutlined);
var AppstoreAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zm52 132H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }] }, "name": "appstore-add", "theme": "outlined" };
var AppstoreAddOutlined = function AppstoreAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: AppstoreAddOutlined$1
  }));
};
var RefIcon$15 = /* @__PURE__ */ reactExports.forwardRef(AppstoreAddOutlined);
var AppstoreOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z" } }] }, "name": "appstore", "theme": "outlined" };
var AppstoreOutlined = function AppstoreOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: AppstoreOutlined$1
  }));
};
var RefIcon$14 = /* @__PURE__ */ reactExports.forwardRef(AppstoreOutlined);
var ArrowLeftOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M872 474H286.9l350.2-304c5.6-4.9 2.2-14-5.2-14h-88.5c-3.9 0-7.6 1.4-10.5 3.9L155 487.8a31.96 31.96 0 000 48.3L535.1 866c1.5 1.3 3.3 2 5.2 2h91.5c7.4 0 10.8-9.2 5.2-14L286.9 550H872c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" } }] }, "name": "arrow-left", "theme": "outlined" };
var ArrowLeftOutlined = function ArrowLeftOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ArrowLeftOutlined$1
  }));
};
var RefIcon$13 = /* @__PURE__ */ reactExports.forwardRef(ArrowLeftOutlined);
var ArrowRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 000-48.4z" } }] }, "name": "arrow-right", "theme": "outlined" };
var ArrowRightOutlined = function ArrowRightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ArrowRightOutlined$1
  }));
};
var RefIcon$12 = /* @__PURE__ */ reactExports.forwardRef(ArrowRightOutlined);
var ArrowUpOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M868 545.5L536.1 163a31.96 31.96 0 00-48.3 0L156 545.5a7.97 7.97 0 006 13.2h81c4.6 0 9-2 12.1-5.5L474 300.9V864c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V300.9l218.9 252.3c3 3.5 7.4 5.5 12.1 5.5h81c6.8 0 10.5-8 6-13.2z" } }] }, "name": "arrow-up", "theme": "outlined" };
var ArrowUpOutlined = function ArrowUpOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ArrowUpOutlined$1
  }));
};
var RefIcon$11 = /* @__PURE__ */ reactExports.forwardRef(ArrowUpOutlined);
var CaretDownFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" } }] }, "name": "caret-down", "theme": "filled" };
var CaretDownFilled = function CaretDownFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CaretDownFilled$1
  }));
};
var RefIcon$10 = /* @__PURE__ */ reactExports.forwardRef(CaretDownFilled);
var CaretRightOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z" } }] }, "name": "caret-right", "theme": "outlined" };
var CaretRightOutlined = function CaretRightOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CaretRightOutlined$1
  }));
};
var RefIcon$$ = /* @__PURE__ */ reactExports.forwardRef(CaretRightOutlined);
var CheckCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "check-circle", "theme": "outlined" };
var CheckCircleOutlined = function CheckCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CheckCircleOutlined$1
  }));
};
var RefIcon$_ = /* @__PURE__ */ reactExports.forwardRef(CheckCircleOutlined);
var ClearOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M899.1 869.6l-53-305.6H864c14.4 0 26-11.6 26-26V346c0-14.4-11.6-26-26-26H618V138c0-14.4-11.6-26-26-26H432c-14.4 0-26 11.6-26 26v182H160c-14.4 0-26 11.6-26 26v192c0 14.4 11.6 26 26 26h17.9l-53 305.6a25.95 25.95 0 0025.6 30.4h723c1.5 0 3-.1 4.4-.4a25.88 25.88 0 0021.2-30zM204 390h272V182h72v208h272v104H204V390zm468 440V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H416V674c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v156H202.8l45.1-260H776l45.1 260H672z" } }] }, "name": "clear", "theme": "outlined" };
var ClearOutlined = function ClearOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ClearOutlined$1
  }));
};
var RefIcon$Z = /* @__PURE__ */ reactExports.forwardRef(ClearOutlined);
var CloseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" } }] }, "name": "close-circle", "theme": "outlined" };
var CloseCircleOutlined = function CloseCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CloseCircleOutlined$1
  }));
};
var RefIcon$Y = /* @__PURE__ */ reactExports.forwardRef(CloseCircleOutlined);
var CopyOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
var CopyOutlined = function CopyOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: CopyOutlined$1
  }));
};
var RefIcon$X = /* @__PURE__ */ reactExports.forwardRef(CopyOutlined);
var DatabaseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0zm0 272a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "database", "theme": "outlined" };
var DatabaseOutlined = function DatabaseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DatabaseOutlined$1
  }));
};
var RefIcon$W = /* @__PURE__ */ reactExports.forwardRef(DatabaseOutlined);
var DeleteColumnOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M651.1 641.9a7.84 7.84 0 00-5.1-1.9h-54.7c-2.4 0-4.6 1.1-6.1 2.9L512 730.7l-73.1-87.8a8.1 8.1 0 00-6.1-2.9H378c-1.9 0-3.7.7-5.1 1.9a7.97 7.97 0 00-1 11.3L474.2 776 371.8 898.9a8.06 8.06 0 006.1 13.2h54.7c2.4 0 4.6-1.1 6.1-2.9l73.1-87.8 73.1 87.8a8.1 8.1 0 006.1 2.9h55c1.9 0 3.7-.7 5.1-1.9 3.4-2.8 3.9-7.9 1-11.3L549.8 776l102.4-122.9c2.8-3.4 2.3-8.4-1.1-11.2zM472 544h80c4.4 0 8-3.6 8-8V120c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v416c0 4.4 3.6 8 8 8zM350 386H184V136c0-3.3-2.7-6-6-6h-60c-3.3 0-6 2.7-6 6v292c0 16.6 13.4 30 30 30h208c3.3 0 6-2.7 6-6v-60c0-3.3-2.7-6-6-6zm556-256h-60c-3.3 0-6 2.7-6 6v250H674c-3.3 0-6 2.7-6 6v60c0 3.3 2.7 6 6 6h208c16.6 0 30-13.4 30-30V136c0-3.3-2.7-6-6-6z" } }] }, "name": "delete-column", "theme": "outlined" };
var DeleteColumnOutlined = function DeleteColumnOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DeleteColumnOutlined$1
  }));
};
var RefIcon$V = /* @__PURE__ */ reactExports.forwardRef(DeleteColumnOutlined);
var DeleteOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
var DeleteOutlined = function DeleteOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DeleteOutlined$1
  }));
};
var RefIcon$U = /* @__PURE__ */ reactExports.forwardRef(DeleteOutlined);
var DisconnectOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 00-11.3 0L209.4 249a8.03 8.03 0 000 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z" } }] }, "name": "disconnect", "theme": "outlined" };
var DisconnectOutlined = function DisconnectOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DisconnectOutlined$1
  }));
};
var RefIcon$T = /* @__PURE__ */ reactExports.forwardRef(DisconnectOutlined);
var DownloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "download", "theme": "outlined" };
var DownloadOutlined = function DownloadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: DownloadOutlined$1
  }));
};
var RefIcon$S = /* @__PURE__ */ reactExports.forwardRef(DownloadOutlined);
var EditOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
var EditOutlined = function EditOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: EditOutlined$1
  }));
};
var RefIcon$R = /* @__PURE__ */ reactExports.forwardRef(EditOutlined);
var EnterOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 000 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" } }] }, "name": "enter", "theme": "outlined" };
var EnterOutlined = function EnterOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: EnterOutlined$1
  }));
};
var RefIcon$Q = /* @__PURE__ */ reactExports.forwardRef(EnterOutlined);
var ExclamationCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
var ExclamationCircleOutlined = function ExclamationCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ExclamationCircleOutlined$1
  }));
};
var RefIcon$P = /* @__PURE__ */ reactExports.forwardRef(ExclamationCircleOutlined);
var ExperimentOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 472a40 40 0 1080 0 40 40 0 10-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 01-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z" } }] }, "name": "experiment", "theme": "outlined" };
var ExperimentOutlined = function ExperimentOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ExperimentOutlined$1
  }));
};
var RefIcon$O = /* @__PURE__ */ reactExports.forwardRef(ExperimentOutlined);
var FileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z" } }] }, "name": "file", "theme": "outlined" };
var FileOutlined = function FileOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FileOutlined$1
  }));
};
var RefIcon$N = /* @__PURE__ */ reactExports.forwardRef(FileOutlined);
var FileUnknownOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.6 288.7L639.4 73.4c-6-6-14.2-9.4-22.7-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.6-9.4-22.6zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM402 549c0 5.4 4.4 9.5 9.8 9.5h32.4c5.4 0 9.8-4.2 9.8-9.4 0-28.2 25.8-51.6 58-51.6s58 23.4 58 51.5c0 25.3-21 47.2-49.3 50.9-19.3 2.8-34.5 20.3-34.7 40.1v32c0 5.5 4.5 10 10 10h32c5.5 0 10-4.5 10-10v-12.2c0-6 4-11.5 9.7-13.3 44.6-14.4 75-54 74.3-98.9-.8-55.5-49.2-100.8-108.5-101.6-61.4-.7-111.5 45.6-111.5 103zm78 195a32 32 0 1064 0 32 32 0 10-64 0z" } }] }, "name": "file-unknown", "theme": "outlined" };
var FileUnknownOutlined = function FileUnknownOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FileUnknownOutlined$1
  }));
};
var RefIcon$M = /* @__PURE__ */ reactExports.forwardRef(FileUnknownOutlined);
var FileZipOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M296 392h64v64h-64zm0 190v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zm-16-302h64v64h-64zm-64-64h64v64h-64zm64 192h64v64h-64zm0-256h64v64h-64zm494.6 88.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h64v64h64v-64h174v216a42 42 0 0042 42h216v494z" } }] }, "name": "file-zip", "theme": "outlined" };
var FileZipOutlined = function FileZipOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FileZipOutlined$1
  }));
};
var RefIcon$L = /* @__PURE__ */ reactExports.forwardRef(FileZipOutlined);
var FilterOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" } }] }, "name": "filter", "theme": "outlined" };
var FilterOutlined = function FilterOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FilterOutlined$1
  }));
};
var RefIcon$K = /* @__PURE__ */ reactExports.forwardRef(FilterOutlined);
var FireOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M834.1 469.2A347.49 347.49 0 00751.2 354l-29.1-26.7a8.09 8.09 0 00-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 01-47.5 46.1 352.6 352.6 0 00-100.3 121.5A347.75 347.75 0 00160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0075.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 00760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0027.7-136c0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9a349.6 349.6 0 0058.6-56.8c25-30.5 44.6-64.5 58.2-101a240 240 0 0012.1-46.5c24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7a74.01 74.01 0 0024.4 59.8 73.36 73.36 0 0053.4 18.8c19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4z" } }] }, "name": "fire", "theme": "outlined" };
var FireOutlined = function FireOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FireOutlined$1
  }));
};
var RefIcon$J = /* @__PURE__ */ reactExports.forwardRef(FireOutlined);
var FolderAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder-add", "theme": "outlined" };
var FolderAddOutlined = function FolderAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FolderAddOutlined$1
  }));
};
var RefIcon$I = /* @__PURE__ */ reactExports.forwardRef(FolderAddOutlined);
var FolderOpenOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" } }] }, "name": "folder-open", "theme": "outlined" };
var FolderOpenOutlined = function FolderOpenOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FolderOpenOutlined$1
  }));
};
var RefIcon$H = /* @__PURE__ */ reactExports.forwardRef(FolderOpenOutlined);
var FolderOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 00-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" } }] }, "name": "folder", "theme": "outlined" };
var FolderOutlined = function FolderOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FolderOutlined$1
  }));
};
var RefIcon$G = /* @__PURE__ */ reactExports.forwardRef(FolderOutlined);
var FullscreenOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M290 236.4l43.9-43.9a8.01 8.01 0 00-4.7-13.6L169 160c-5.1-.6-9.5 3.7-8.9 8.9L179 329.1c.8 6.6 8.9 9.4 13.6 4.7l43.7-43.7L370 423.7c3.1 3.1 8.2 3.1 11.3 0l42.4-42.3c3.1-3.1 3.1-8.2 0-11.3L290 236.4zm352.7 187.3c3.1 3.1 8.2 3.1 11.3 0l133.7-133.6 43.7 43.7a8.01 8.01 0 0013.6-4.7L863.9 169c.6-5.1-3.7-9.5-8.9-8.9L694.8 179c-6.6.8-9.4 8.9-4.7 13.6l43.9 43.9L600.3 370a8.03 8.03 0 000 11.3l42.4 42.4zM845 694.9c-.8-6.6-8.9-9.4-13.6-4.7l-43.7 43.7L654 600.3a8.03 8.03 0 00-11.3 0l-42.4 42.3a8.03 8.03 0 000 11.3L734 787.6l-43.9 43.9a8.01 8.01 0 004.7 13.6L855 864c5.1.6 9.5-3.7 8.9-8.9L845 694.9zm-463.7-94.6a8.03 8.03 0 00-11.3 0L236.3 733.9l-43.7-43.7a8.01 8.01 0 00-13.6 4.7L160.1 855c-.6 5.1 3.7 9.5 8.9 8.9L329.2 845c6.6-.8 9.4-8.9 4.7-13.6L290 787.6 423.7 654c3.1-3.1 3.1-8.2 0-11.3l-42.4-42.4z" } }] }, "name": "fullscreen", "theme": "outlined" };
var FullscreenOutlined = function FullscreenOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: FullscreenOutlined$1
  }));
};
var RefIcon$F = /* @__PURE__ */ reactExports.forwardRef(FullscreenOutlined);
var GithubOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0138.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z" } }] }, "name": "github", "theme": "outlined" };
var GithubOutlined = function GithubOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: GithubOutlined$1
  }));
};
var RefIcon$E = /* @__PURE__ */ reactExports.forwardRef(GithubOutlined);
var GlobalOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M854.4 800.9c.2-.3.5-.6.7-.9C920.6 722.1 960 621.7 960 512s-39.4-210.1-104.8-288c-.2-.3-.5-.5-.7-.8-1.1-1.3-2.1-2.5-3.2-3.7-.4-.5-.8-.9-1.2-1.4l-4.1-4.7-.1-.1c-1.5-1.7-3.1-3.4-4.6-5.1l-.1-.1c-3.2-3.4-6.4-6.8-9.7-10.1l-.1-.1-4.8-4.8-.3-.3c-1.5-1.5-3-2.9-4.5-4.3-.5-.5-1-1-1.6-1.5-1-1-2-1.9-3-2.8-.3-.3-.7-.6-1-1C736.4 109.2 629.5 64 512 64s-224.4 45.2-304.3 119.2c-.3.3-.7.6-1 1-1 .9-2 1.9-3 2.9-.5.5-1 1-1.6 1.5-1.5 1.4-3 2.9-4.5 4.3l-.3.3-4.8 4.8-.1.1c-3.3 3.3-6.5 6.7-9.7 10.1l-.1.1c-1.6 1.7-3.1 3.4-4.6 5.1l-.1.1c-1.4 1.5-2.8 3.1-4.1 4.7-.4.5-.8.9-1.2 1.4-1.1 1.2-2.1 2.5-3.2 3.7-.2.3-.5.5-.7.8C103.4 301.9 64 402.3 64 512s39.4 210.1 104.8 288c.2.3.5.6.7.9l3.1 3.7c.4.5.8.9 1.2 1.4l4.1 4.7c0 .1.1.1.1.2 1.5 1.7 3 3.4 4.6 5l.1.1c3.2 3.4 6.4 6.8 9.6 10.1l.1.1c1.6 1.6 3.1 3.2 4.7 4.7l.3.3c3.3 3.3 6.7 6.5 10.1 9.6 80.1 74 187 119.2 304.5 119.2s224.4-45.2 304.3-119.2a300 300 0 0010-9.6l.3-.3c1.6-1.6 3.2-3.1 4.7-4.7l.1-.1c3.3-3.3 6.5-6.7 9.6-10.1l.1-.1c1.5-1.7 3.1-3.3 4.6-5 0-.1.1-.1.1-.2 1.4-1.5 2.8-3.1 4.1-4.7.4-.5.8-.9 1.2-1.4a99 99 0 003.3-3.7zm4.1-142.6c-13.8 32.6-32 62.8-54.2 90.2a444.07 444.07 0 00-81.5-55.9c11.6-46.9 18.8-98.4 20.7-152.6H887c-3 40.9-12.6 80.6-28.5 118.3zM887 484H743.5c-1.9-54.2-9.1-105.7-20.7-152.6 29.3-15.6 56.6-34.4 81.5-55.9A373.86 373.86 0 01887 484zM658.3 165.5c39.7 16.8 75.8 40 107.6 69.2a394.72 394.72 0 01-59.4 41.8c-15.7-45-35.8-84.1-59.2-115.4 3.7 1.4 7.4 2.9 11 4.4zm-90.6 700.6c-9.2 7.2-18.4 12.7-27.7 16.4V697a389.1 389.1 0 01115.7 26.2c-8.3 24.6-17.9 47.3-29 67.8-17.4 32.4-37.8 58.3-59 75.1zm59-633.1c11 20.6 20.7 43.3 29 67.8A389.1 389.1 0 01540 327V141.6c9.2 3.7 18.5 9.1 27.7 16.4 21.2 16.7 41.6 42.6 59 75zM540 640.9V540h147.5c-1.6 44.2-7.1 87.1-16.3 127.8l-.3 1.2A445.02 445.02 0 00540 640.9zm0-156.9V383.1c45.8-2.8 89.8-12.5 130.9-28.1l.3 1.2c9.2 40.7 14.7 83.5 16.3 127.8H540zm-56 56v100.9c-45.8 2.8-89.8 12.5-130.9 28.1l-.3-1.2c-9.2-40.7-14.7-83.5-16.3-127.8H484zm-147.5-56c1.6-44.2 7.1-87.1 16.3-127.8l.3-1.2c41.1 15.6 85 25.3 130.9 28.1V484H336.5zM484 697v185.4c-9.2-3.7-18.5-9.1-27.7-16.4-21.2-16.7-41.7-42.7-59.1-75.1-11-20.6-20.7-43.3-29-67.8 37.2-14.6 75.9-23.3 115.8-26.1zm0-370a389.1 389.1 0 01-115.7-26.2c8.3-24.6 17.9-47.3 29-67.8 17.4-32.4 37.8-58.4 59.1-75.1 9.2-7.2 18.4-12.7 27.7-16.4V327zM365.7 165.5c3.7-1.5 7.3-3 11-4.4-23.4 31.3-43.5 70.4-59.2 115.4-21-12-40.9-26-59.4-41.8 31.8-29.2 67.9-52.4 107.6-69.2zM165.5 365.7c13.8-32.6 32-62.8 54.2-90.2 24.9 21.5 52.2 40.3 81.5 55.9-11.6 46.9-18.8 98.4-20.7 152.6H137c3-40.9 12.6-80.6 28.5-118.3zM137 540h143.5c1.9 54.2 9.1 105.7 20.7 152.6a444.07 444.07 0 00-81.5 55.9A373.86 373.86 0 01137 540zm228.7 318.5c-39.7-16.8-75.8-40-107.6-69.2 18.5-15.8 38.4-29.7 59.4-41.8 15.7 45 35.8 84.1 59.2 115.4-3.7-1.4-7.4-2.9-11-4.4zm292.6 0c-3.7 1.5-7.3 3-11 4.4 23.4-31.3 43.5-70.4 59.2-115.4 21 12 40.9 26 59.4 41.8a373.81 373.81 0 01-107.6 69.2z" } }] }, "name": "global", "theme": "outlined" };
var GlobalOutlined = function GlobalOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: GlobalOutlined$1
  }));
};
var RefIcon$D = /* @__PURE__ */ reactExports.forwardRef(GlobalOutlined);
var GroupOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M912 820.1V203.9c28-9.9 48-36.6 48-67.9 0-39.8-32.2-72-72-72-31.3 0-58 20-67.9 48H203.9C194 84 167.3 64 136 64c-39.8 0-72 32.2-72 72 0 31.3 20 58 48 67.9v616.2C84 830 64 856.7 64 888c0 39.8 32.2 72 72 72 31.3 0 58-20 67.9-48h616.2c9.9 28 36.6 48 67.9 48 39.8 0 72-32.2 72-72 0-31.3-20-58-48-67.9zM888 112c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zM136 912c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm0-752c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zm704 680H184V184h656v656zm48 72c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24z" } }, { "tag": "path", "attrs": { "d": "M288 474h448c8.8 0 16-7.2 16-16V282c0-8.8-7.2-16-16-16H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16zm56-136h336v64H344v-64zm-56 420h448c8.8 0 16-7.2 16-16V566c0-8.8-7.2-16-16-16H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16zm56-136h336v64H344v-64z" } }] }, "name": "group", "theme": "outlined" };
var GroupOutlined = function GroupOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: GroupOutlined$1
  }));
};
var RefIcon$C = /* @__PURE__ */ reactExports.forwardRef(GroupOutlined);
var HistoryOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M536.1 273H488c-4.4 0-8 3.6-8 8v275.3c0 2.6 1.2 5 3.3 6.5l165.3 120.7c3.6 2.6 8.6 1.9 11.2-1.7l28.6-39c2.7-3.7 1.9-8.7-1.7-11.2L544.1 528.5V281c0-4.4-3.6-8-8-8zm219.8 75.2l156.8 38.3c5 1.2 9.9-2.6 9.9-7.7l.8-161.5c0-6.7-7.7-10.5-12.9-6.3L752.9 334.1a8 8 0 003 14.1zm167.7 301.1l-56.7-19.5a8 8 0 00-10.1 4.8c-1.9 5.1-3.9 10.1-6 15.1-17.8 42.1-43.3 80-75.9 112.5a353 353 0 01-112.5 75.9 352.18 352.18 0 01-137.7 27.8c-47.8 0-94.1-9.3-137.7-27.8a353 353 0 01-112.5-75.9c-32.5-32.5-58-70.4-75.9-112.5A353.44 353.44 0 01171 512c0-47.8 9.3-94.2 27.8-137.8 17.8-42.1 43.3-80 75.9-112.5a353 353 0 01112.5-75.9C430.6 167.3 477 158 524.8 158s94.1 9.3 137.7 27.8A353 353 0 01775 261.7c10.2 10.3 19.8 21 28.6 32.3l59.8-46.8C784.7 146.6 662.2 81.9 524.6 82 285 82.1 92.6 276.7 95 516.4 97.4 751.9 288.9 942 524.8 942c185.5 0 343.5-117.6 403.7-282.3 1.5-4.2-.7-8.9-4.9-10.4z" } }] }, "name": "history", "theme": "outlined" };
var HistoryOutlined = function HistoryOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: HistoryOutlined$1
  }));
};
var RefIcon$B = /* @__PURE__ */ reactExports.forwardRef(HistoryOutlined);
var HolderOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M300 276.5a56 56 0 1056-97 56 56 0 00-56 97zm0 284a56 56 0 1056-97 56 56 0 00-56 97zM640 228a56 56 0 10112 0 56 56 0 00-112 0zm0 284a56 56 0 10112 0 56 56 0 00-112 0zM300 844.5a56 56 0 1056-97 56 56 0 00-56 97zM640 796a56 56 0 10112 0 56 56 0 00-112 0z" } }] }, "name": "holder", "theme": "outlined" };
var HolderOutlined = function HolderOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: HolderOutlined$1
  }));
};
var RefIcon$A = /* @__PURE__ */ reactExports.forwardRef(HolderOutlined);
var ImportOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM653.3 424.6l52.2 52.2a8.01 8.01 0 01-4.7 13.6l-179.4 21c-5.1.6-9.5-3.7-8.9-8.9l21-179.4c.8-6.6 8.9-9.4 13.6-4.7l52.4 52.4 256.2-256.2c3.1-3.1 8.2-3.1 11.3 0l42.4 42.4c3.1 3.1 3.1 8.2 0 11.3L653.3 424.6z" } }] }, "name": "import", "theme": "outlined" };
var ImportOutlined = function ImportOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ImportOutlined$1
  }));
};
var RefIcon$z = /* @__PURE__ */ reactExports.forwardRef(ImportOutlined);
var InfoCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" } }] }, "name": "info-circle", "theme": "outlined" };
var InfoCircleOutlined = function InfoCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: InfoCircleOutlined$1
  }));
};
var RefIcon$y = /* @__PURE__ */ reactExports.forwardRef(InfoCircleOutlined);
var LinkOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M574 665.4a8.03 8.03 0 00-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 00-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 000 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 000 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 00-11.3 0L372.3 598.7a8.03 8.03 0 000 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z" } }] }, "name": "link", "theme": "outlined" };
var LinkOutlined = function LinkOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: LinkOutlined$1
  }));
};
var RefIcon$x = /* @__PURE__ */ reactExports.forwardRef(LinkOutlined);
var LoginOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M521.7 82c-152.5-.4-286.7 78.5-363.4 197.7-3.4 5.3.4 12.3 6.7 12.3h70.3c4.8 0 9.3-2.1 12.3-5.8 7-8.5 14.5-16.7 22.4-24.5 32.6-32.5 70.5-58.1 112.7-75.9 43.6-18.4 90-27.8 137.9-27.8 47.9 0 94.3 9.3 137.9 27.8 42.2 17.8 80.1 43.4 112.7 75.9 32.6 32.5 58.1 70.4 76 112.5C865.7 417.8 875 464.1 875 512c0 47.9-9.4 94.2-27.8 137.8-17.8 42.1-43.4 80-76 112.5s-70.5 58.1-112.7 75.9A352.8 352.8 0 01520.6 866c-47.9 0-94.3-9.4-137.9-27.8A353.84 353.84 0 01270 762.3c-7.9-7.9-15.3-16.1-22.4-24.5-3-3.7-7.6-5.8-12.3-5.8H165c-6.3 0-10.2 7-6.7 12.3C234.9 863.2 368.5 942 520.6 942c236.2 0 428-190.1 430.4-425.6C953.4 277.1 761.3 82.6 521.7 82zM395.02 624v-76h-314c-4.4 0-8-3.6-8-8v-56c0-4.4 3.6-8 8-8h314v-76c0-6.7 7.8-10.5 13-6.3l141.9 112a8 8 0 010 12.6l-141.9 112c-5.2 4.1-13 .4-13-6.3z" } }] }, "name": "login", "theme": "outlined" };
var LoginOutlined = function LoginOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: LoginOutlined$1
  }));
};
var RefIcon$w = /* @__PURE__ */ reactExports.forwardRef(LoginOutlined);
var MenuFoldOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z" } }] }, "name": "menu-fold", "theme": "outlined" };
var MenuFoldOutlined = function MenuFoldOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MenuFoldOutlined$1
  }));
};
var RefIcon$v = /* @__PURE__ */ reactExports.forwardRef(MenuFoldOutlined);
var MenuUnfoldOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z" } }] }, "name": "menu-unfold", "theme": "outlined" };
var MenuUnfoldOutlined = function MenuUnfoldOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MenuUnfoldOutlined$1
  }));
};
var RefIcon$u = /* @__PURE__ */ reactExports.forwardRef(MenuUnfoldOutlined);
var MergeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M248 752h72V264h-72z" } }, { "tag": "path", "attrs": { "d": "M740 863c61.86 0 112-50.14 112-112 0-48.33-30.6-89.5-73.5-105.2l-.01-113.04a50.73 50.73 0 00-34.95-48.2l-434.9-142.41-22.4 68.42 420.25 137.61.01 95.92C661 658.34 628 700.8 628 751c0 61.86 50.14 112 112 112m-456 61c61.86 0 112-50.14 112-112s-50.14-112-112-112-112 50.14-112 112 50.14 112 112 112m456-125a48 48 0 110-96 48 48 0 010 96m-456 61a48 48 0 110-96 48 48 0 010 96m0-536c61.86 0 112-50.14 112-112s-50.14-112-112-112-112 50.14-112 112 50.14 112 112 112m0-64a48 48 0 110-96 48 48 0 010 96" } }] }, "name": "merge", "theme": "outlined" };
var MergeOutlined = function MergeOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MergeOutlined$1
  }));
};
var RefIcon$t = /* @__PURE__ */ reactExports.forwardRef(MergeOutlined);
var MinusCircleFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm192 472c0 4.4-3.6 8-8 8H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h368c4.4 0 8 3.6 8 8v48z" } }] }, "name": "minus-circle", "theme": "filled" };
var MinusCircleFilled = function MinusCircleFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MinusCircleFilled$1
  }));
};
var RefIcon$s = /* @__PURE__ */ reactExports.forwardRef(MinusCircleFilled);
var MinusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "minus-square", "theme": "outlined" };
var MinusSquareOutlined = function MinusSquareOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MinusSquareOutlined$1
  }));
};
var RefIcon$r = /* @__PURE__ */ reactExports.forwardRef(MinusSquareOutlined);
var MoonOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M489.5 111.66c30.65-1.8 45.98 36.44 22.58 56.33A243.35 243.35 0 00426 354c0 134.76 109.24 244 244 244 72.58 0 139.9-31.83 186.01-86.08 19.87-23.38 58.07-8.1 56.34 22.53C900.4 745.82 725.15 912 512.5 912 291.31 912 112 732.69 112 511.5c0-211.39 164.29-386.02 374.2-399.65l.2-.01zm-81.15 79.75l-4.11 1.36C271.1 237.94 176 364.09 176 511.5 176 697.34 326.66 848 512.5 848c148.28 0 274.94-96.2 319.45-230.41l.63-1.93-.11.07a307.06 307.06 0 01-159.73 46.26L670 662c-170.1 0-308-137.9-308-308 0-58.6 16.48-114.54 46.27-162.47z" } }] }, "name": "moon", "theme": "outlined" };
var MoonOutlined = function MoonOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MoonOutlined$1
  }));
};
var RefIcon$q = /* @__PURE__ */ reactExports.forwardRef(MoonOutlined);
var MoreOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M456 231a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0zm0 280a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "more", "theme": "outlined" };
var MoreOutlined = function MoreOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: MoreOutlined$1
  }));
};
var RefIcon$p = /* @__PURE__ */ reactExports.forwardRef(MoreOutlined);
var NodeIndexOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M843.5 737.4c-12.4-75.2-79.2-129.1-155.3-125.4S550.9 676 546 752c-153.5-4.8-208-40.7-199.1-113.7 3.3-27.3 19.8-41.9 50.1-49 18.4-4.3 38.8-4.9 57.3-3.2 1.7.2 3.5.3 5.2.5 11.3 2.7 22.8 5 34.3 6.8 34.1 5.6 68.8 8.4 101.8 6.6 92.8-5 156-45.9 159.2-132.7 3.1-84.1-54.7-143.7-147.9-183.6-29.9-12.8-61.6-22.7-93.3-30.2-14.3-3.4-26.3-5.7-35.2-7.2-7.9-75.9-71.5-133.8-147.8-134.4-76.3-.6-140.9 56.1-150.1 131.9s40 146.3 114.2 163.9c74.2 17.6 149.9-23.3 175.7-95.1 9.4 1.7 18.7 3.6 28 5.8 28.2 6.6 56.4 15.4 82.4 26.6 70.7 30.2 109.3 70.1 107.5 119.9-1.6 44.6-33.6 65.2-96.2 68.6-27.5 1.5-57.6-.9-87.3-5.8-8.3-1.4-15.9-2.8-22.6-4.3-3.9-.8-6.6-1.5-7.8-1.8l-3.1-.6c-2.2-.3-5.9-.8-10.7-1.3-25-2.3-52.1-1.5-78.5 4.6-55.2 12.9-93.9 47.2-101.1 105.8-15.7 126.2 78.6 184.7 276 188.9 29.1 70.4 106.4 107.9 179.6 87 73.3-20.9 119.3-93.4 106.9-168.6zM329.1 345.2a83.3 83.3 0 11.01-166.61 83.3 83.3 0 01-.01 166.61zM695.6 845a83.3 83.3 0 11.01-166.61A83.3 83.3 0 01695.6 845z" } }] }, "name": "node-index", "theme": "outlined" };
var NodeIndexOutlined = function NodeIndexOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: NodeIndexOutlined$1
  }));
};
var RefIcon$o = /* @__PURE__ */ reactExports.forwardRef(NodeIndexOutlined);
var PauseCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372zm-88-532h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8zm224 0h-48c-4.4 0-8 3.6-8 8v304c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V360c0-4.4-3.6-8-8-8z" } }] }, "name": "pause-circle", "theme": "outlined" };
var PauseCircleOutlined = function PauseCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PauseCircleOutlined$1
  }));
};
var RefIcon$n = /* @__PURE__ */ reactExports.forwardRef(PauseCircleOutlined);
var PauseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M304 176h80v672h-80zm408 0h-64c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8z" } }] }, "name": "pause", "theme": "outlined" };
var PauseOutlined = function PauseOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PauseOutlined$1
  }));
};
var RefIcon$m = /* @__PURE__ */ reactExports.forwardRef(PauseOutlined);
var PlayCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z" } }] }, "name": "play-circle", "theme": "outlined" };
var PlayCircleOutlined = function PlayCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PlayCircleOutlined$1
  }));
};
var RefIcon$l = /* @__PURE__ */ reactExports.forwardRef(PlayCircleOutlined);
var PlusCircleOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }] }, "name": "plus-circle", "theme": "outlined" };
var PlusCircleOutlined = function PlusCircleOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PlusCircleOutlined$1
  }));
};
var RefIcon$k = /* @__PURE__ */ reactExports.forwardRef(PlusCircleOutlined);
var PlusSquareOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z" } }, { "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" } }] }, "name": "plus-square", "theme": "outlined" };
var PlusSquareOutlined = function PlusSquareOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PlusSquareOutlined$1
  }));
};
var RefIcon$j = /* @__PURE__ */ reactExports.forwardRef(PlusSquareOutlined);
var ProductOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 144a16 16 0 0116 16v304a16 16 0 01-16 16H160a16 16 0 01-16-16V160a16 16 0 0116-16zm-52 68H212v200h200zm493.33 87.69a16 16 0 010 22.62L724.31 503.33a16 16 0 01-22.62 0L520.67 322.31a16 16 0 010-22.62l181.02-181.02a16 16 0 0122.62 0zm-84.85 11.3L713 203.53 605.52 311 713 418.48zM464 544a16 16 0 0116 16v304a16 16 0 01-16 16H160a16 16 0 01-16-16V560a16 16 0 0116-16zm-52 68H212v200h200zm452-68a16 16 0 0116 16v304a16 16 0 01-16 16H560a16 16 0 01-16-16V560a16 16 0 0116-16zm-52 68H612v200h200z" } }] }, "name": "product", "theme": "outlined" };
var ProductOutlined = function ProductOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ProductOutlined$1
  }));
};
var RefIcon$i = /* @__PURE__ */ reactExports.forwardRef(ProductOutlined);
var ProfileOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM492 400h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0 144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zM340 368a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0zm0 144a40 40 0 1080 0 40 40 0 10-80 0z" } }] }, "name": "profile", "theme": "outlined" };
var ProfileOutlined = function ProfileOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ProfileOutlined$1
  }));
};
var RefIcon$h = /* @__PURE__ */ reactExports.forwardRef(ProfileOutlined);
var PushpinOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 00-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 00-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 01-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z" } }] }, "name": "pushpin", "theme": "outlined" };
var PushpinOutlined = function PushpinOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: PushpinOutlined$1
  }));
};
var RefIcon$g = /* @__PURE__ */ reactExports.forwardRef(PushpinOutlined);
var ReloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z" } }] }, "name": "reload", "theme": "outlined" };
var ReloadOutlined = function ReloadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ReloadOutlined$1
  }));
};
var RefIcon$f = /* @__PURE__ */ reactExports.forwardRef(ReloadOutlined);
var SaveOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M893.3 293.3L730.7 130.7c-7.5-7.5-16.7-13-26.7-16V112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V338.5c0-17-6.7-33.2-18.7-45.2zM384 184h256v104H384V184zm456 656H184V184h136v136c0 17.7 14.3 32 32 32h320c17.7 0 32-14.3 32-32V205.8l136 136V840zM512 442c-79.5 0-144 64.5-144 144s64.5 144 144 144 144-64.5 144-144-64.5-144-144-144zm0 224c-44.2 0-80-35.8-80-80s35.8-80 80-80 80 35.8 80 80-35.8 80-80 80z" } }] }, "name": "save", "theme": "outlined" };
var SaveOutlined = function SaveOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SaveOutlined$1
  }));
};
var RefIcon$e = /* @__PURE__ */ reactExports.forwardRef(SaveOutlined);
var SendOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2a15.99 15.99 0 00-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-.9 3.7-.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 .7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-.8 4.2-2.6 5-5 1.4-4.2-.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z" } }] }, "name": "send", "theme": "outlined" };
var SendOutlined = function SendOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SendOutlined$1
  }));
};
var RefIcon$d = /* @__PURE__ */ reactExports.forwardRef(SendOutlined);
var SettingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z" } }] }, "name": "setting", "theme": "outlined" };
var SettingOutlined = function SettingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SettingOutlined$1
  }));
};
var RefIcon$c = /* @__PURE__ */ reactExports.forwardRef(SettingOutlined);
var SortAscendingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M839.6 433.8L749 150.5a9.24 9.24 0 00-8.9-6.5h-77.4c-4.1 0-7.6 2.6-8.9 6.5l-91.3 283.3c-.3.9-.5 1.9-.5 2.9 0 5.1 4.2 9.3 9.3 9.3h56.4c4.2 0 7.8-2.8 9-6.8l17.5-61.6h89l17.3 61.5c1.1 4 4.8 6.8 9 6.8h61.2c1 0 1.9-.1 2.8-.4 2.4-.8 4.3-2.4 5.5-4.6 1.1-2.2 1.3-4.7.6-7.1zM663.3 325.5l32.8-116.9h6.3l32.1 116.9h-71.2zm143.5 492.9H677.2v-.4l132.6-188.9c1.1-1.6 1.7-3.4 1.7-5.4v-36.4c0-5.1-4.2-9.3-9.3-9.3h-204c-5.1 0-9.3 4.2-9.3 9.3v43c0 5.1 4.2 9.3 9.3 9.3h122.6v.4L587.7 828.9a9.35 9.35 0 00-1.7 5.4v36.4c0 5.1 4.2 9.3 9.3 9.3h211.4c5.1 0 9.3-4.2 9.3-9.3v-43a9.2 9.2 0 00-9.2-9.3zM416 702h-76V172c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v530h-76c-6.7 0-10.5 7.8-6.3 13l112 141.9a8 8 0 0012.6 0l112-141.9c4.1-5.2.4-13-6.3-13z" } }] }, "name": "sort-ascending", "theme": "outlined" };
var SortAscendingOutlined = function SortAscendingOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SortAscendingOutlined$1
  }));
};
var RefIcon$b = /* @__PURE__ */ reactExports.forwardRef(SortAscendingOutlined);
var StarFilled$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" } }] }, "name": "star", "theme": "filled" };
var StarFilled = function StarFilled2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: StarFilled$1
  }));
};
var RefIcon$a = /* @__PURE__ */ reactExports.forwardRef(StarFilled);
var StopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z" } }] }, "name": "stop", "theme": "outlined" };
var StopOutlined = function StopOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: StopOutlined$1
  }));
};
var RefIcon$9 = /* @__PURE__ */ reactExports.forwardRef(StopOutlined);
var SunOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M548 818v126a16 16 0 01-16 16h-40a16 16 0 01-16-16V818c15.85 1.64 27.84 2.46 36 2.46 8.15 0 20.16-.82 36-2.46m205.25-115.66l89.1 89.1a16 16 0 010 22.62l-28.29 28.29a16 16 0 01-22.62 0l-89.1-89.1c12.37-10.04 21.43-17.95 27.2-23.71 5.76-5.77 13.67-14.84 23.71-27.2m-482.5 0c10.04 12.36 17.95 21.43 23.71 27.2 5.77 5.76 14.84 13.67 27.2 23.71l-89.1 89.1a16 16 0 01-22.62 0l-28.29-28.29a16 16 0 010-22.63zM512 278c129.24 0 234 104.77 234 234S641.24 746 512 746 278 641.24 278 512s104.77-234 234-234m0 72c-89.47 0-162 72.53-162 162s72.53 162 162 162 162-72.53 162-162-72.53-162-162-162M206 476c-1.64 15.85-2.46 27.84-2.46 36 0 8.15.82 20.16 2.46 36H80a16 16 0 01-16-16v-40a16 16 0 0116-16zm738 0a16 16 0 0116 16v40a16 16 0 01-16 16H818c1.64-15.85 2.46-27.84 2.46-36 0-8.15-.82-20.16-2.46-36zM814.06 180.65l28.29 28.29a16 16 0 010 22.63l-89.1 89.09c-10.04-12.37-17.95-21.43-23.71-27.2-5.77-5.76-14.84-13.67-27.2-23.71l89.1-89.1a16 16 0 0122.62 0m-581.5 0l89.1 89.1c-12.37 10.04-21.43 17.95-27.2 23.71-5.76 5.77-13.67 14.84-23.71 27.2l-89.1-89.1a16 16 0 010-22.62l28.29-28.29a16 16 0 0122.62 0M532 64a16 16 0 0116 16v126c-15.85-1.64-27.84-2.46-36-2.46-8.15 0-20.16.82-36 2.46V80a16 16 0 0116-16z" } }] }, "name": "sun", "theme": "outlined" };
var SunOutlined = function SunOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SunOutlined$1
  }));
};
var RefIcon$8 = /* @__PURE__ */ reactExports.forwardRef(SunOutlined);
var SyncOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 01755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 008 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 01512.1 856a342.24 342.24 0 01-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 00-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 00-8-8.2z" } }] }, "name": "sync", "theme": "outlined" };
var SyncOutlined = function SyncOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: SyncOutlined$1
  }));
};
var RefIcon$7 = /* @__PURE__ */ reactExports.forwardRef(SyncOutlined);
var ThunderboltOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z" } }] }, "name": "thunderbolt", "theme": "outlined" };
var ThunderboltOutlined = function ThunderboltOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ThunderboltOutlined$1
  }));
};
var RefIcon$6 = /* @__PURE__ */ reactExports.forwardRef(ThunderboltOutlined);
var ToTopOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M885 780H165c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h720c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM400 325.7h73.9V664c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V325.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 171a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13z" } }] }, "name": "to-top", "theme": "outlined" };
var ToTopOutlined = function ToTopOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: ToTopOutlined$1
  }));
};
var RefIcon$5 = /* @__PURE__ */ reactExports.forwardRef(ToTopOutlined);
var UndoOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z" } }] }, "name": "undo", "theme": "outlined" };
var UndoOutlined = function UndoOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: UndoOutlined$1
  }));
};
var RefIcon$4 = /* @__PURE__ */ reactExports.forwardRef(UndoOutlined);
var UploadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" } }] }, "name": "upload", "theme": "outlined" };
var UploadOutlined = function UploadOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: UploadOutlined$1
  }));
};
var RefIcon$3 = /* @__PURE__ */ reactExports.forwardRef(UploadOutlined);
var VerticalAlignBottomOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M859.9 780H164.1c-4.5 0-8.1 3.6-8.1 8v60c0 4.4 3.6 8 8.1 8h695.8c4.5 0 8.1-3.6 8.1-8v-60c0-4.4-3.6-8-8.1-8zM505.7 669a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V176c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8z" } }] }, "name": "vertical-align-bottom", "theme": "outlined" };
var VerticalAlignBottomOutlined = function VerticalAlignBottomOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: VerticalAlignBottomOutlined$1
  }));
};
var RefIcon$2 = /* @__PURE__ */ reactExports.forwardRef(VerticalAlignBottomOutlined);
var VideoCameraAddOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M368 724H252V608c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v116H72c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h116v116c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V788h116c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v352h72V232h576v560H448v72h272c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM888 625l-104-59.8V458.9L888 399v226z" } }, { "tag": "path", "attrs": { "d": "M320 360c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h112z" } }] }, "name": "video-camera-add", "theme": "outlined" };
var VideoCameraAddOutlined = function VideoCameraAddOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: VideoCameraAddOutlined$1
  }));
};
var RefIcon$1 = /* @__PURE__ */ reactExports.forwardRef(VideoCameraAddOutlined);
var WarningOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M464 720a48 48 0 1096 0 48 48 0 10-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z" } }] }, "name": "warning", "theme": "outlined" };
var WarningOutlined = function WarningOutlined2(props, ref) {
  return /* @__PURE__ */ reactExports.createElement(Icon$2, _extends$j({}, props, {
    ref,
    icon: WarningOutlined$2
  }));
};
var RefIcon = /* @__PURE__ */ reactExports.forwardRef(WarningOutlined);
const WarningOutlined$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: RefIcon
}, Symbol.toStringTag, { value: "Module" }));
var TreeContext = /* @__PURE__ */ reactExports.createContext(null);
var UnstableContext = /* @__PURE__ */ reactExports.createContext({});
var Indent = function Indent2(_ref) {
  var prefixCls = _ref.prefixCls, level = _ref.level, isStart = _ref.isStart, isEnd = _ref.isEnd;
  var baseClassName2 = "".concat(prefixCls, "-indent-unit");
  var list2 = [];
  for (var i2 = 0; i2 < level; i2 += 1) {
    list2.push(/* @__PURE__ */ reactExports.createElement("span", {
      key: i2,
      className: classNames(baseClassName2, _defineProperty$4(_defineProperty$4({}, "".concat(baseClassName2, "-start"), isStart[i2]), "".concat(baseClassName2, "-end"), isEnd[i2]))
    }));
  }
  return /* @__PURE__ */ reactExports.createElement("span", {
    "aria-hidden": "true",
    className: "".concat(prefixCls, "-indent")
  }, list2);
};
const Indent$1 = /* @__PURE__ */ reactExports.memo(Indent);
var _excluded$b = ["eventKey", "className", "style", "dragOver", "dragOverGapTop", "dragOverGapBottom", "isLeaf", "isStart", "isEnd", "expanded", "selected", "checked", "halfChecked", "loading", "domRef", "active", "data", "onMouseMove", "selectable"];
var ICON_OPEN = "open";
var ICON_CLOSE = "close";
var defaultTitle = "---";
var TreeNode = function TreeNode2(props) {
  var _unstableContext$node, _context$filterTreeNo, _classNames4;
  var eventKey = props.eventKey, className = props.className, style2 = props.style, dragOver = props.dragOver, dragOverGapTop = props.dragOverGapTop, dragOverGapBottom = props.dragOverGapBottom, isLeaf = props.isLeaf, isStart = props.isStart, isEnd = props.isEnd, expanded = props.expanded, selected = props.selected, checked = props.checked, halfChecked = props.halfChecked, loading = props.loading, domRef = props.domRef, active3 = props.active, data = props.data, onMouseMove = props.onMouseMove, selectable = props.selectable, otherProps = _objectWithoutProperties$3(props, _excluded$b);
  var context = React$6.useContext(TreeContext);
  var unstableContext = React$6.useContext(UnstableContext);
  var selectHandleRef = React$6.useRef(null);
  var _React$useState = React$6.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), dragNodeHighlight = _React$useState2[0], setDragNodeHighlight = _React$useState2[1];
  var isDisabled = !!(context.disabled || props.disabled || (_unstableContext$node = unstableContext.nodeDisabled) !== null && _unstableContext$node !== void 0 && _unstableContext$node.call(unstableContext, data));
  var isCheckable = React$6.useMemo(function() {
    if (!context.checkable || props.checkable === false) {
      return false;
    }
    return context.checkable;
  }, [context.checkable, props.checkable]);
  var onSelect = function onSelect2(e2) {
    if (isDisabled) {
      return;
    }
    context.onNodeSelect(e2, convertNodePropsToEventData(props));
  };
  var onCheck = function onCheck2(e2) {
    if (isDisabled) {
      return;
    }
    if (!isCheckable || props.disableCheckbox) {
      return;
    }
    context.onNodeCheck(e2, convertNodePropsToEventData(props), !checked);
  };
  var isSelectable = React$6.useMemo(function() {
    if (typeof selectable === "boolean") {
      return selectable;
    }
    return context.selectable;
  }, [selectable, context.selectable]);
  var onSelectorClick = function onSelectorClick2(e2) {
    context.onNodeClick(e2, convertNodePropsToEventData(props));
    if (isSelectable) {
      onSelect(e2);
    } else {
      onCheck(e2);
    }
  };
  var onSelectorDoubleClick = function onSelectorDoubleClick2(e2) {
    context.onNodeDoubleClick(e2, convertNodePropsToEventData(props));
  };
  var onMouseEnter = function onMouseEnter2(e2) {
    context.onNodeMouseEnter(e2, convertNodePropsToEventData(props));
  };
  var onMouseLeave = function onMouseLeave2(e2) {
    context.onNodeMouseLeave(e2, convertNodePropsToEventData(props));
  };
  var onContextMenu = function onContextMenu2(e2) {
    context.onNodeContextMenu(e2, convertNodePropsToEventData(props));
  };
  var isDraggable = React$6.useMemo(function() {
    return !!(context.draggable && (!context.draggable.nodeDraggable || context.draggable.nodeDraggable(data)));
  }, [context.draggable, data]);
  var onDragStart = function onDragStart2(e2) {
    e2.stopPropagation();
    setDragNodeHighlight(true);
    context.onNodeDragStart(e2, props);
    try {
      e2.dataTransfer.setData("text/plain", "");
    } catch (_unused) {
    }
  };
  var onDragEnter = function onDragEnter2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    context.onNodeDragEnter(e2, props);
  };
  var onDragOver = function onDragOver2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    context.onNodeDragOver(e2, props);
  };
  var onDragLeave = function onDragLeave2(e2) {
    e2.stopPropagation();
    context.onNodeDragLeave(e2, props);
  };
  var onDragEnd = function onDragEnd2(e2) {
    e2.stopPropagation();
    setDragNodeHighlight(false);
    context.onNodeDragEnd(e2, props);
  };
  var onDrop = function onDrop2(e2) {
    e2.preventDefault();
    e2.stopPropagation();
    setDragNodeHighlight(false);
    context.onNodeDrop(e2, props);
  };
  var onExpand = function onExpand2(e2) {
    if (loading) {
      return;
    }
    context.onNodeExpand(e2, convertNodePropsToEventData(props));
  };
  var hasChildren2 = React$6.useMemo(function() {
    var _ref = getEntity(context.keyEntities, eventKey) || {}, children = _ref.children;
    return Boolean((children || []).length);
  }, [context.keyEntities, eventKey]);
  var memoizedIsLeaf = React$6.useMemo(function() {
    if (isLeaf === false) {
      return false;
    }
    return isLeaf || !context.loadData && !hasChildren2 || context.loadData && props.loaded && !hasChildren2;
  }, [isLeaf, context.loadData, hasChildren2, props.loaded]);
  React$6.useEffect(function() {
    if (loading) {
      return;
    }
    if (typeof context.loadData === "function" && expanded && !memoizedIsLeaf && !props.loaded) {
      context.onNodeLoad(convertNodePropsToEventData(props));
    }
  }, [loading, context.loadData, context.onNodeLoad, expanded, memoizedIsLeaf, props]);
  var dragHandlerNode = React$6.useMemo(function() {
    var _context$draggable;
    if (!((_context$draggable = context.draggable) !== null && _context$draggable !== void 0 && _context$draggable.icon)) {
      return null;
    }
    return /* @__PURE__ */ React$6.createElement("span", {
      className: "".concat(context.prefixCls, "-draggable-icon")
    }, context.draggable.icon);
  }, [context.draggable]);
  var renderSwitcherIconDom = function renderSwitcherIconDom2(isInternalLeaf) {
    var switcherIcon = props.switcherIcon || context.switcherIcon;
    if (typeof switcherIcon === "function") {
      return switcherIcon(_objectSpread2(_objectSpread2({}, props), {}, {
        isLeaf: isInternalLeaf
      }));
    }
    return switcherIcon;
  };
  var renderSwitcher = function renderSwitcher2() {
    if (memoizedIsLeaf) {
      var _switcherIconDom = renderSwitcherIconDom(true);
      return _switcherIconDom !== false ? /* @__PURE__ */ React$6.createElement("span", {
        className: classNames("".concat(context.prefixCls, "-switcher"), "".concat(context.prefixCls, "-switcher-noop"))
      }, _switcherIconDom) : null;
    }
    var switcherIconDom = renderSwitcherIconDom(false);
    return switcherIconDom !== false ? /* @__PURE__ */ React$6.createElement("span", {
      onClick: onExpand,
      className: classNames("".concat(context.prefixCls, "-switcher"), "".concat(context.prefixCls, "-switcher_").concat(expanded ? ICON_OPEN : ICON_CLOSE))
    }, switcherIconDom) : null;
  };
  var checkboxNode = React$6.useMemo(function() {
    if (!isCheckable) {
      return null;
    }
    var $custom = typeof isCheckable !== "boolean" ? isCheckable : null;
    return /* @__PURE__ */ React$6.createElement("span", {
      className: classNames("".concat(context.prefixCls, "-checkbox"), _defineProperty$4(_defineProperty$4(_defineProperty$4({}, "".concat(context.prefixCls, "-checkbox-checked"), checked), "".concat(context.prefixCls, "-checkbox-indeterminate"), !checked && halfChecked), "".concat(context.prefixCls, "-checkbox-disabled"), isDisabled || props.disableCheckbox)),
      onClick: onCheck,
      role: "checkbox",
      "aria-checked": halfChecked ? "mixed" : checked,
      "aria-disabled": isDisabled || props.disableCheckbox,
      "aria-label": "Select ".concat(typeof props.title === "string" ? props.title : "tree node")
    }, $custom);
  }, [isCheckable, checked, halfChecked, isDisabled, props.disableCheckbox, props.title]);
  var nodeState = React$6.useMemo(function() {
    if (memoizedIsLeaf) {
      return null;
    }
    return expanded ? ICON_OPEN : ICON_CLOSE;
  }, [memoizedIsLeaf, expanded]);
  var iconNode = React$6.useMemo(function() {
    return /* @__PURE__ */ React$6.createElement("span", {
      className: classNames("".concat(context.prefixCls, "-iconEle"), "".concat(context.prefixCls, "-icon__").concat(nodeState || "docu"), _defineProperty$4({}, "".concat(context.prefixCls, "-icon_loading"), loading))
    });
  }, [context.prefixCls, nodeState, loading]);
  var dropIndicatorNode = React$6.useMemo(function() {
    var rootDraggable = Boolean(context.draggable);
    var showIndicator = !props.disabled && rootDraggable && context.dragOverNodeKey === eventKey;
    if (!showIndicator) {
      return null;
    }
    return context.dropIndicatorRender({
      dropPosition: context.dropPosition,
      dropLevelOffset: context.dropLevelOffset,
      indent: context.indent,
      prefixCls: context.prefixCls,
      direction: context.direction
    });
  }, [context.dropPosition, context.dropLevelOffset, context.indent, context.prefixCls, context.direction, context.draggable, context.dragOverNodeKey, context.dropIndicatorRender]);
  var selectorNode = React$6.useMemo(function() {
    var _props$title = props.title, title = _props$title === void 0 ? defaultTitle : _props$title;
    var wrapClass = "".concat(context.prefixCls, "-node-content-wrapper");
    var $icon;
    if (context.showIcon) {
      var currentIcon = props.icon || context.icon;
      $icon = currentIcon ? /* @__PURE__ */ React$6.createElement("span", {
        className: classNames("".concat(context.prefixCls, "-iconEle"), "".concat(context.prefixCls, "-icon__customize"))
      }, typeof currentIcon === "function" ? currentIcon(props) : currentIcon) : iconNode;
    } else if (context.loadData && loading) {
      $icon = iconNode;
    }
    var titleNode;
    if (typeof title === "function") {
      titleNode = title(data);
    } else if (context.titleRender) {
      titleNode = context.titleRender(data);
    } else {
      titleNode = title;
    }
    return /* @__PURE__ */ React$6.createElement("span", {
      ref: selectHandleRef,
      title: typeof title === "string" ? title : "",
      className: classNames(wrapClass, "".concat(wrapClass, "-").concat(nodeState || "normal"), _defineProperty$4({}, "".concat(context.prefixCls, "-node-selected"), !isDisabled && (selected || dragNodeHighlight))),
      onMouseEnter,
      onMouseLeave,
      onContextMenu,
      onClick: onSelectorClick,
      onDoubleClick: onSelectorDoubleClick
    }, $icon, /* @__PURE__ */ React$6.createElement("span", {
      className: "".concat(context.prefixCls, "-title")
    }, titleNode), dropIndicatorNode);
  }, [context.prefixCls, context.showIcon, props, context.icon, iconNode, context.titleRender, data, nodeState, onMouseEnter, onMouseLeave, onContextMenu, onSelectorClick, onSelectorDoubleClick]);
  var dataOrAriaAttributeProps = pickAttrs$1(otherProps, {
    aria: true,
    data: true
  });
  var _ref2 = getEntity(context.keyEntities, eventKey) || {}, level = _ref2.level;
  var isEndNode = isEnd[isEnd.length - 1];
  var draggableWithoutDisabled = !isDisabled && isDraggable;
  var dragging = context.draggingNodeKey === eventKey;
  var ariaSelected = selectable !== void 0 ? {
    "aria-selected": !!selectable
  } : void 0;
  return /* @__PURE__ */ React$6.createElement("div", _extends$j({
    ref: domRef,
    role: "treeitem",
    "aria-expanded": isLeaf ? void 0 : expanded,
    className: classNames(className, "".concat(context.prefixCls, "-treenode"), (_classNames4 = {}, _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_classNames4, "".concat(context.prefixCls, "-treenode-disabled"), isDisabled), "".concat(context.prefixCls, "-treenode-switcher-").concat(expanded ? "open" : "close"), !isLeaf), "".concat(context.prefixCls, "-treenode-checkbox-checked"), checked), "".concat(context.prefixCls, "-treenode-checkbox-indeterminate"), halfChecked), "".concat(context.prefixCls, "-treenode-selected"), selected), "".concat(context.prefixCls, "-treenode-loading"), loading), "".concat(context.prefixCls, "-treenode-active"), active3), "".concat(context.prefixCls, "-treenode-leaf-last"), isEndNode), "".concat(context.prefixCls, "-treenode-draggable"), isDraggable), "dragging", dragging), _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4(_classNames4, "drop-target", context.dropTargetKey === eventKey), "drop-container", context.dropContainerKey === eventKey), "drag-over", !isDisabled && dragOver), "drag-over-gap-top", !isDisabled && dragOverGapTop), "drag-over-gap-bottom", !isDisabled && dragOverGapBottom), "filter-node", (_context$filterTreeNo = context.filterTreeNode) === null || _context$filterTreeNo === void 0 ? void 0 : _context$filterTreeNo.call(context, convertNodePropsToEventData(props))), "".concat(context.prefixCls, "-treenode-leaf"), memoizedIsLeaf))),
    style: style2,
    draggable: draggableWithoutDisabled,
    onDragStart: draggableWithoutDisabled ? onDragStart : void 0,
    onDragEnter: isDraggable ? onDragEnter : void 0,
    onDragOver: isDraggable ? onDragOver : void 0,
    onDragLeave: isDraggable ? onDragLeave : void 0,
    onDrop: isDraggable ? onDrop : void 0,
    onDragEnd: isDraggable ? onDragEnd : void 0,
    onMouseMove
  }, ariaSelected, dataOrAriaAttributeProps), /* @__PURE__ */ React$6.createElement(Indent$1, {
    prefixCls: context.prefixCls,
    level,
    isStart,
    isEnd
  }), dragHandlerNode, renderSwitcher(), checkboxNode, selectorNode);
};
TreeNode.isTreeNode = 1;
function arrDel(list2, value2) {
  if (!list2)
    return [];
  var clone3 = list2.slice();
  var index2 = clone3.indexOf(value2);
  if (index2 >= 0) {
    clone3.splice(index2, 1);
  }
  return clone3;
}
function arrAdd(list2, value2) {
  var clone3 = (list2 || []).slice();
  if (clone3.indexOf(value2) === -1) {
    clone3.push(value2);
  }
  return clone3;
}
function posToArr(pos) {
  return pos.split("-");
}
function getDragChildrenKeys(dragNodeKey, keyEntities) {
  var dragChildrenKeys = [];
  var entity = getEntity(keyEntities, dragNodeKey);
  function dig() {
    var list2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
    list2.forEach(function(_ref) {
      var key = _ref.key, children = _ref.children;
      dragChildrenKeys.push(key);
      dig(children);
    });
  }
  dig(entity.children);
  return dragChildrenKeys;
}
function isLastChild(treeNodeEntity) {
  if (treeNodeEntity.parent) {
    var posArr = posToArr(treeNodeEntity.pos);
    return Number(posArr[posArr.length - 1]) === treeNodeEntity.parent.children.length - 1;
  }
  return false;
}
function isFirstChild(treeNodeEntity) {
  var posArr = posToArr(treeNodeEntity.pos);
  return Number(posArr[posArr.length - 1]) === 0;
}
function calcDropPosition(event, dragNodeProps, targetNodeProps, indent, startMousePosition, allowDrop2, flattenedNodes, keyEntities, expandKeys, direction) {
  var _abstractDropNodeEnti;
  var clientX = event.clientX, clientY = event.clientY;
  var _getBoundingClientRec = event.target.getBoundingClientRect(), top2 = _getBoundingClientRec.top, height = _getBoundingClientRec.height;
  var horizontalMouseOffset = (direction === "rtl" ? -1 : 1) * (((startMousePosition === null || startMousePosition === void 0 ? void 0 : startMousePosition.x) || 0) - clientX);
  var rawDropLevelOffset = (horizontalMouseOffset - 12) / indent;
  var filteredExpandKeys = expandKeys.filter(function(key) {
    var _keyEntities$key;
    return (_keyEntities$key = keyEntities[key]) === null || _keyEntities$key === void 0 || (_keyEntities$key = _keyEntities$key.children) === null || _keyEntities$key === void 0 ? void 0 : _keyEntities$key.length;
  });
  var abstractDropNodeEntity = getEntity(keyEntities, targetNodeProps.eventKey);
  if (clientY < top2 + height / 2) {
    var nodeIndex = flattenedNodes.findIndex(function(flattenedNode) {
      return flattenedNode.key === abstractDropNodeEntity.key;
    });
    var prevNodeIndex = nodeIndex <= 0 ? 0 : nodeIndex - 1;
    var prevNodeKey = flattenedNodes[prevNodeIndex].key;
    abstractDropNodeEntity = getEntity(keyEntities, prevNodeKey);
  }
  var initialAbstractDropNodeKey = abstractDropNodeEntity.key;
  var abstractDragOverEntity = abstractDropNodeEntity;
  var dragOverNodeKey = abstractDropNodeEntity.key;
  var dropPosition = 0;
  var dropLevelOffset = 0;
  if (!filteredExpandKeys.includes(initialAbstractDropNodeKey)) {
    for (var i2 = 0; i2 < rawDropLevelOffset; i2 += 1) {
      if (isLastChild(abstractDropNodeEntity)) {
        abstractDropNodeEntity = abstractDropNodeEntity.parent;
        dropLevelOffset += 1;
      } else {
        break;
      }
    }
  }
  var abstractDragDataNode = dragNodeProps.data;
  var abstractDropDataNode = abstractDropNodeEntity.node;
  var dropAllowed = true;
  if (isFirstChild(abstractDropNodeEntity) && abstractDropNodeEntity.level === 0 && clientY < top2 + height / 2 && allowDrop2({
    dragNode: abstractDragDataNode,
    dropNode: abstractDropDataNode,
    dropPosition: -1
  }) && abstractDropNodeEntity.key === targetNodeProps.eventKey) {
    dropPosition = -1;
  } else if ((abstractDragOverEntity.children || []).length && filteredExpandKeys.includes(dragOverNodeKey)) {
    if (allowDrop2({
      dragNode: abstractDragDataNode,
      dropNode: abstractDropDataNode,
      dropPosition: 0
    })) {
      dropPosition = 0;
    } else {
      dropAllowed = false;
    }
  } else if (dropLevelOffset === 0) {
    if (rawDropLevelOffset > -1.5) {
      if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 1
      })) {
        dropPosition = 1;
      } else {
        dropAllowed = false;
      }
    } else {
      if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 0
      })) {
        dropPosition = 0;
      } else if (allowDrop2({
        dragNode: abstractDragDataNode,
        dropNode: abstractDropDataNode,
        dropPosition: 1
      })) {
        dropPosition = 1;
      } else {
        dropAllowed = false;
      }
    }
  } else {
    if (allowDrop2({
      dragNode: abstractDragDataNode,
      dropNode: abstractDropDataNode,
      dropPosition: 1
    })) {
      dropPosition = 1;
    } else {
      dropAllowed = false;
    }
  }
  return {
    dropPosition,
    dropLevelOffset,
    dropTargetKey: abstractDropNodeEntity.key,
    dropTargetPos: abstractDropNodeEntity.pos,
    dragOverNodeKey,
    dropContainerKey: dropPosition === 0 ? null : ((_abstractDropNodeEnti = abstractDropNodeEntity.parent) === null || _abstractDropNodeEnti === void 0 ? void 0 : _abstractDropNodeEnti.key) || null,
    dropAllowed
  };
}
function calcSelectedKeys(selectedKeys, props) {
  if (!selectedKeys)
    return void 0;
  var multiple = props.multiple;
  if (multiple) {
    return selectedKeys.slice();
  }
  if (selectedKeys.length) {
    return [selectedKeys[0]];
  }
  return selectedKeys;
}
function parseCheckedKeys(keys2) {
  if (!keys2) {
    return null;
  }
  var keyProps;
  if (Array.isArray(keys2)) {
    keyProps = {
      checkedKeys: keys2,
      halfCheckedKeys: void 0
    };
  } else if (_typeof$2(keys2) === "object") {
    keyProps = {
      checkedKeys: keys2.checked || void 0,
      halfCheckedKeys: keys2.halfChecked || void 0
    };
  } else {
    warningOnce(false, "`checkedKeys` is not an array or an object");
    return null;
  }
  return keyProps;
}
function conductExpandParent(keyList, keyEntities) {
  var expandedKeys = /* @__PURE__ */ new Set();
  function conductUp(key) {
    if (expandedKeys.has(key))
      return;
    var entity = getEntity(keyEntities, key);
    if (!entity)
      return;
    expandedKeys.add(key);
    var parent = entity.parent, node2 = entity.node;
    if (node2.disabled)
      return;
    if (parent) {
      conductUp(parent.key);
    }
  }
  (keyList || []).forEach(function(key) {
    conductUp(key);
  });
  return _toConsumableArray(expandedKeys);
}
var DropIndicator = function DropIndicator2(props) {
  var dropPosition = props.dropPosition, dropLevelOffset = props.dropLevelOffset, indent = props.indent;
  var style2 = {
    pointerEvents: "none",
    position: "absolute",
    right: 0,
    backgroundColor: "red",
    height: 2
  };
  switch (dropPosition) {
    case -1:
      style2.top = 0;
      style2.left = -dropLevelOffset * indent;
      break;
    case 1:
      style2.bottom = 0;
      style2.left = -dropLevelOffset * indent;
      break;
    case 0:
      style2.bottom = 0;
      style2.left = indent;
      break;
  }
  return /* @__PURE__ */ React$6.createElement("div", {
    style: style2
  });
};
function _objectDestructuringEmpty(t2) {
  if (null == t2)
    throw new TypeError("Cannot destructure " + t2);
}
function useUnmount(triggerStart, triggerEnd) {
  var _React$useState = reactExports.useState(false), _React$useState2 = _slicedToArray(_React$useState, 2), firstMount = _React$useState2[0], setFirstMount = _React$useState2[1];
  useLayoutEffect$1(function() {
    if (firstMount) {
      triggerStart();
      return function() {
        triggerEnd();
      };
    }
  }, [firstMount]);
  useLayoutEffect$1(function() {
    setFirstMount(true);
    return function() {
      setFirstMount(false);
    };
  }, []);
}
var _excluded$a = ["className", "style", "motion", "motionNodes", "motionType", "onMotionStart", "onMotionEnd", "active", "treeNodeRequiredProps"];
var MotionTreeNode = /* @__PURE__ */ reactExports.forwardRef(function(oriProps, ref) {
  var className = oriProps.className, style2 = oriProps.style, motion = oriProps.motion, motionNodes = oriProps.motionNodes, motionType = oriProps.motionType, onOriginMotionStart = oriProps.onMotionStart, onOriginMotionEnd = oriProps.onMotionEnd, active3 = oriProps.active, treeNodeRequiredProps = oriProps.treeNodeRequiredProps, props = _objectWithoutProperties$3(oriProps, _excluded$a);
  var _React$useState = reactExports.useState(true), _React$useState2 = _slicedToArray(_React$useState, 2), visible = _React$useState2[0], setVisible = _React$useState2[1];
  var _React$useContext = reactExports.useContext(TreeContext), prefixCls = _React$useContext.prefixCls;
  var targetVisible = motionNodes && motionType !== "hide";
  useLayoutEffect$1(function() {
    if (motionNodes) {
      if (targetVisible !== visible) {
        setVisible(targetVisible);
      }
    }
  }, [motionNodes]);
  var triggerMotionStart = function triggerMotionStart2() {
    if (motionNodes) {
      onOriginMotionStart();
    }
  };
  var triggerMotionEndRef = reactExports.useRef(false);
  var triggerMotionEnd = function triggerMotionEnd2() {
    if (motionNodes && !triggerMotionEndRef.current) {
      triggerMotionEndRef.current = true;
      onOriginMotionEnd();
    }
  };
  useUnmount(triggerMotionStart, triggerMotionEnd);
  var onVisibleChanged = function onVisibleChanged2(nextVisible) {
    if (targetVisible === nextVisible) {
      triggerMotionEnd();
    }
  };
  if (motionNodes) {
    return /* @__PURE__ */ reactExports.createElement(CSSMotion, _extends$j({
      ref,
      visible
    }, motion, {
      motionAppear: motionType === "show",
      onVisibleChanged
    }), function(_ref, motionRef) {
      var motionClassName = _ref.className, motionStyle = _ref.style;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: motionRef,
        className: classNames("".concat(prefixCls, "-treenode-motion"), motionClassName),
        style: motionStyle
      }, motionNodes.map(function(treeNode) {
        var restProps = Object.assign({}, (_objectDestructuringEmpty(treeNode.data), treeNode.data)), title = treeNode.title, key = treeNode.key, isStart = treeNode.isStart, isEnd = treeNode.isEnd;
        delete restProps.children;
        var treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);
        return /* @__PURE__ */ reactExports.createElement(TreeNode, _extends$j({}, restProps, treeNodeProps, {
          title,
          active: active3,
          data: treeNode.data,
          key,
          isStart,
          isEnd
        }));
      }));
    });
  }
  return /* @__PURE__ */ reactExports.createElement(TreeNode, _extends$j({
    domRef: ref,
    className,
    style: style2
  }, props, {
    active: active3
  }));
});
function findExpandedKeys() {
  var prev2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var next2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var prevLen = prev2.length;
  var nextLen = next2.length;
  if (Math.abs(prevLen - nextLen) !== 1) {
    return {
      add: false,
      key: null
    };
  }
  function find2(shorter, longer) {
    var cache2 = /* @__PURE__ */ new Map();
    shorter.forEach(function(key) {
      cache2.set(key, true);
    });
    var keys2 = longer.filter(function(key) {
      return !cache2.has(key);
    });
    return keys2.length === 1 ? keys2[0] : null;
  }
  if (prevLen < nextLen) {
    return {
      add: true,
      key: find2(prev2, next2)
    };
  }
  return {
    add: false,
    key: find2(next2, prev2)
  };
}
function getExpandRange(shorter, longer, key) {
  var shorterStartIndex = shorter.findIndex(function(data) {
    return data.key === key;
  });
  var shorterEndNode = shorter[shorterStartIndex + 1];
  var longerStartIndex = longer.findIndex(function(data) {
    return data.key === key;
  });
  if (shorterEndNode) {
    var longerEndIndex = longer.findIndex(function(data) {
      return data.key === shorterEndNode.key;
    });
    return longer.slice(longerStartIndex + 1, longerEndIndex);
  }
  return longer.slice(longerStartIndex + 1);
}
var _excluded$9 = ["prefixCls", "data", "selectable", "checkable", "expandedKeys", "selectedKeys", "checkedKeys", "loadedKeys", "loadingKeys", "halfCheckedKeys", "keyEntities", "disabled", "dragging", "dragOverNodeKey", "dropPosition", "motion", "height", "itemHeight", "virtual", "scrollWidth", "focusable", "activeItem", "focused", "tabIndex", "onKeyDown", "onFocus", "onBlur", "onActiveChange", "onListChangeStart", "onListChangeEnd"];
var HIDDEN_STYLE = {
  width: 0,
  height: 0,
  display: "flex",
  overflow: "hidden",
  opacity: 0,
  border: 0,
  padding: 0,
  margin: 0
};
var noop$6 = function noop2() {
};
var MOTION_KEY = "RC_TREE_MOTION_".concat(Math.random());
var MotionNode = {
  key: MOTION_KEY
};
var MotionEntity = {
  key: MOTION_KEY,
  level: 0,
  index: 0,
  pos: "0",
  node: MotionNode,
  nodes: [MotionNode]
};
var MotionFlattenData = {
  parent: null,
  children: [],
  pos: MotionEntity.pos,
  data: MotionNode,
  title: null,
  key: MOTION_KEY,
  /** Hold empty list here since we do not use it */
  isStart: [],
  isEnd: []
};
function getMinimumRangeTransitionRange(list2, virtual, height, itemHeight) {
  if (virtual === false || !height) {
    return list2;
  }
  return list2.slice(0, Math.ceil(height / itemHeight) + 1);
}
function itemKey(item) {
  var key = item.key, pos = item.pos;
  return getKey2(key, pos);
}
function getAccessibilityPath(item) {
  var path = String(item.data.key);
  var current = item;
  while (current.parent) {
    current = current.parent;
    path = "".concat(current.data.key, " > ").concat(path);
  }
  return path;
}
var NodeList = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
  var prefixCls = props.prefixCls, data = props.data;
  props.selectable;
  props.checkable;
  var expandedKeys = props.expandedKeys, selectedKeys = props.selectedKeys, checkedKeys = props.checkedKeys, loadedKeys = props.loadedKeys, loadingKeys = props.loadingKeys, halfCheckedKeys = props.halfCheckedKeys, keyEntities = props.keyEntities, disabled = props.disabled, dragging = props.dragging, dragOverNodeKey = props.dragOverNodeKey, dropPosition = props.dropPosition, motion = props.motion, height = props.height, itemHeight = props.itemHeight, virtual = props.virtual, scrollWidth = props.scrollWidth, focusable2 = props.focusable, activeItem = props.activeItem, focused = props.focused, tabIndex = props.tabIndex, onKeyDown = props.onKeyDown, onFocus = props.onFocus, onBlur = props.onBlur, onActiveChange = props.onActiveChange, onListChangeStart = props.onListChangeStart, onListChangeEnd = props.onListChangeEnd, domProps = _objectWithoutProperties$3(props, _excluded$9);
  var listRef = reactExports.useRef(null);
  var indentMeasurerRef = reactExports.useRef(null);
  reactExports.useImperativeHandle(ref, function() {
    return {
      scrollTo: function scrollTo(scroll) {
        listRef.current.scrollTo(scroll);
      },
      getIndentWidth: function getIndentWidth() {
        return indentMeasurerRef.current.offsetWidth;
      }
    };
  });
  var _React$useState = reactExports.useState(expandedKeys), _React$useState2 = _slicedToArray(_React$useState, 2), prevExpandedKeys = _React$useState2[0], setPrevExpandedKeys = _React$useState2[1];
  var _React$useState3 = reactExports.useState(data), _React$useState4 = _slicedToArray(_React$useState3, 2), prevData = _React$useState4[0], setPrevData = _React$useState4[1];
  var _React$useState5 = reactExports.useState(data), _React$useState6 = _slicedToArray(_React$useState5, 2), transitionData = _React$useState6[0], setTransitionData = _React$useState6[1];
  var _React$useState7 = reactExports.useState([]), _React$useState8 = _slicedToArray(_React$useState7, 2), transitionRange = _React$useState8[0], setTransitionRange = _React$useState8[1];
  var _React$useState9 = reactExports.useState(null), _React$useState10 = _slicedToArray(_React$useState9, 2), motionType = _React$useState10[0], setMotionType = _React$useState10[1];
  var dataRef = reactExports.useRef(data);
  dataRef.current = data;
  function onMotionEnd() {
    var latestData = dataRef.current;
    setPrevData(latestData);
    setTransitionData(latestData);
    setTransitionRange([]);
    setMotionType(null);
    onListChangeEnd();
  }
  useLayoutEffect$1(function() {
    setPrevExpandedKeys(expandedKeys);
    var diffExpanded = findExpandedKeys(prevExpandedKeys, expandedKeys);
    if (diffExpanded.key !== null) {
      if (diffExpanded.add) {
        var keyIndex = prevData.findIndex(function(_ref) {
          var key = _ref.key;
          return key === diffExpanded.key;
        });
        var rangeNodes = getMinimumRangeTransitionRange(getExpandRange(prevData, data, diffExpanded.key), virtual, height, itemHeight);
        var newTransitionData = prevData.slice();
        newTransitionData.splice(keyIndex + 1, 0, MotionFlattenData);
        setTransitionData(newTransitionData);
        setTransitionRange(rangeNodes);
        setMotionType("show");
      } else {
        var _keyIndex = data.findIndex(function(_ref2) {
          var key = _ref2.key;
          return key === diffExpanded.key;
        });
        var _rangeNodes = getMinimumRangeTransitionRange(getExpandRange(data, prevData, diffExpanded.key), virtual, height, itemHeight);
        var _newTransitionData = data.slice();
        _newTransitionData.splice(_keyIndex + 1, 0, MotionFlattenData);
        setTransitionData(_newTransitionData);
        setTransitionRange(_rangeNodes);
        setMotionType("hide");
      }
    } else if (prevData !== data) {
      setPrevData(data);
      setTransitionData(data);
    }
  }, [expandedKeys, data]);
  reactExports.useEffect(function() {
    if (!dragging) {
      onMotionEnd();
    }
  }, [dragging]);
  var mergedData = motion ? transitionData : data;
  var treeNodeRequiredProps = {
    expandedKeys,
    selectedKeys,
    loadedKeys,
    loadingKeys,
    checkedKeys,
    halfCheckedKeys,
    dragOverNodeKey,
    dropPosition,
    keyEntities
  };
  return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, focused && activeItem && /* @__PURE__ */ reactExports.createElement("span", {
    style: HIDDEN_STYLE,
    "aria-live": "assertive"
  }, getAccessibilityPath(activeItem)), /* @__PURE__ */ reactExports.createElement("div", null, /* @__PURE__ */ reactExports.createElement("input", {
    style: HIDDEN_STYLE,
    disabled: focusable2 === false || disabled,
    tabIndex: focusable2 !== false ? tabIndex : null,
    onKeyDown,
    onFocus,
    onBlur,
    value: "",
    onChange: noop$6,
    "aria-label": "for screen reader"
  })), /* @__PURE__ */ reactExports.createElement("div", {
    className: "".concat(prefixCls, "-treenode"),
    "aria-hidden": true,
    style: {
      position: "absolute",
      pointerEvents: "none",
      visibility: "hidden",
      height: 0,
      overflow: "hidden",
      border: 0,
      padding: 0
    }
  }, /* @__PURE__ */ reactExports.createElement("div", {
    className: "".concat(prefixCls, "-indent")
  }, /* @__PURE__ */ reactExports.createElement("div", {
    ref: indentMeasurerRef,
    className: "".concat(prefixCls, "-indent-unit")
  }))), /* @__PURE__ */ reactExports.createElement(List$1, _extends$j({}, domProps, {
    data: mergedData,
    itemKey,
    height,
    fullHeight: false,
    virtual,
    itemHeight,
    scrollWidth,
    prefixCls: "".concat(prefixCls, "-list"),
    ref: listRef,
    role: "tree",
    onVisibleChange: function onVisibleChange(originList) {
      if (originList.every(function(item) {
        return itemKey(item) !== MOTION_KEY;
      })) {
        onMotionEnd();
      }
    }
  }), function(treeNode) {
    var pos = treeNode.pos, restProps = Object.assign({}, (_objectDestructuringEmpty(treeNode.data), treeNode.data)), title = treeNode.title, key = treeNode.key, isStart = treeNode.isStart, isEnd = treeNode.isEnd;
    var mergedKey = getKey2(key, pos);
    delete restProps.key;
    delete restProps.children;
    var treeNodeProps = getTreeNodeProps(mergedKey, treeNodeRequiredProps);
    return /* @__PURE__ */ reactExports.createElement(MotionTreeNode, _extends$j({}, restProps, treeNodeProps, {
      title,
      active: !!activeItem && key === activeItem.key,
      pos,
      data: treeNode.data,
      isStart,
      isEnd,
      motion,
      motionNodes: key === MOTION_KEY ? transitionRange : null,
      motionType,
      onMotionStart: onListChangeStart,
      onMotionEnd,
      treeNodeRequiredProps,
      onMouseMove: function onMouseMove() {
        onActiveChange(null);
      }
    }));
  }));
});
var MAX_RETRY_TIMES = 10;
var Tree$2 = /* @__PURE__ */ function(_React$Component) {
  _inherits$a(Tree2, _React$Component);
  var _super = _createSuper$4(Tree2);
  function Tree2() {
    var _this;
    _classCallCheck$a(this, Tree2);
    for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
      _args[_key] = arguments[_key];
    }
    _this = _super.call.apply(_super, [this].concat(_args));
    _defineProperty$4(_assertThisInitialized(_this), "destroyed", false);
    _defineProperty$4(_assertThisInitialized(_this), "delayedDragEnterLogic", void 0);
    _defineProperty$4(_assertThisInitialized(_this), "loadingRetryTimes", {});
    _defineProperty$4(_assertThisInitialized(_this), "state", {
      keyEntities: {},
      indent: null,
      selectedKeys: [],
      checkedKeys: [],
      halfCheckedKeys: [],
      loadedKeys: [],
      loadingKeys: [],
      expandedKeys: [],
      draggingNodeKey: null,
      dragChildrenKeys: [],
      // dropTargetKey is the key of abstract-drop-node
      // the abstract-drop-node is the real drop node when drag and drop
      // not the DOM drag over node
      dropTargetKey: null,
      dropPosition: null,
      // the drop position of abstract-drop-node, inside 0, top -1, bottom 1
      dropContainerKey: null,
      // the container key of abstract-drop-node if dropPosition is -1 or 1
      dropLevelOffset: null,
      // the drop level offset of abstract-drag-over-node
      dropTargetPos: null,
      // the pos of abstract-drop-node
      dropAllowed: true,
      // if drop to abstract-drop-node is allowed
      // the abstract-drag-over-node
      // if mouse is on the bottom of top dom node or no the top of the bottom dom node
      // abstract-drag-over-node is the top node
      dragOverNodeKey: null,
      treeData: [],
      flattenNodes: [],
      focused: false,
      activeKey: null,
      listChanging: false,
      prevProps: null,
      fieldNames: fillFieldNames()
    });
    _defineProperty$4(_assertThisInitialized(_this), "dragStartMousePosition", null);
    _defineProperty$4(_assertThisInitialized(_this), "dragNodeProps", null);
    _defineProperty$4(_assertThisInitialized(_this), "currentMouseOverDroppableNodeKey", null);
    _defineProperty$4(_assertThisInitialized(_this), "listRef", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDragStart", function(event, nodeProps) {
      var _this$state = _this.state, expandedKeys = _this$state.expandedKeys, keyEntities = _this$state.keyEntities;
      var onDragStart = _this.props.onDragStart;
      var eventKey = nodeProps.eventKey;
      _this.dragNodeProps = nodeProps;
      _this.dragStartMousePosition = {
        x: event.clientX,
        y: event.clientY
      };
      var newExpandedKeys = arrDel(expandedKeys, eventKey);
      _this.setState({
        draggingNodeKey: eventKey,
        dragChildrenKeys: getDragChildrenKeys(eventKey, keyEntities),
        indent: _this.listRef.current.getIndentWidth()
      });
      _this.setExpandedKeys(newExpandedKeys);
      window.addEventListener("dragend", _this.onWindowDragEnd);
      onDragStart === null || onDragStart === void 0 || onDragStart({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDragEnter", function(event, nodeProps) {
      var _this$state2 = _this.state, expandedKeys = _this$state2.expandedKeys, keyEntities = _this$state2.keyEntities, dragChildrenKeys = _this$state2.dragChildrenKeys, flattenNodes = _this$state2.flattenNodes, indent = _this$state2.indent;
      var _this$props = _this.props, onDragEnter = _this$props.onDragEnter, onExpand = _this$props.onExpand, allowDrop2 = _this$props.allowDrop, direction = _this$props.direction;
      var pos = nodeProps.pos, eventKey = nodeProps.eventKey;
      if (_this.currentMouseOverDroppableNodeKey !== eventKey) {
        _this.currentMouseOverDroppableNodeKey = eventKey;
      }
      if (!_this.dragNodeProps) {
        _this.resetDragState();
        return;
      }
      var _calcDropPosition = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop2, flattenNodes, keyEntities, expandedKeys, direction), dropPosition = _calcDropPosition.dropPosition, dropLevelOffset = _calcDropPosition.dropLevelOffset, dropTargetKey = _calcDropPosition.dropTargetKey, dropContainerKey = _calcDropPosition.dropContainerKey, dropTargetPos = _calcDropPosition.dropTargetPos, dropAllowed = _calcDropPosition.dropAllowed, dragOverNodeKey = _calcDropPosition.dragOverNodeKey;
      if (
        // don't allow drop inside its children
        dragChildrenKeys.includes(dropTargetKey) || // don't allow drop when drop is not allowed caculated by calcDropPosition
        !dropAllowed
      ) {
        _this.resetDragState();
        return;
      }
      if (!_this.delayedDragEnterLogic) {
        _this.delayedDragEnterLogic = {};
      }
      Object.keys(_this.delayedDragEnterLogic).forEach(function(key) {
        clearTimeout(_this.delayedDragEnterLogic[key]);
      });
      if (_this.dragNodeProps.eventKey !== nodeProps.eventKey) {
        event.persist();
        _this.delayedDragEnterLogic[pos] = window.setTimeout(function() {
          if (_this.state.draggingNodeKey === null) {
            return;
          }
          var newExpandedKeys = _toConsumableArray(expandedKeys);
          var entity = getEntity(keyEntities, nodeProps.eventKey);
          if (entity && (entity.children || []).length) {
            newExpandedKeys = arrAdd(expandedKeys, nodeProps.eventKey);
          }
          if (!_this.props.hasOwnProperty("expandedKeys")) {
            _this.setExpandedKeys(newExpandedKeys);
          }
          onExpand === null || onExpand === void 0 || onExpand(newExpandedKeys, {
            node: convertNodePropsToEventData(nodeProps),
            expanded: true,
            nativeEvent: event.nativeEvent
          });
        }, 800);
      }
      if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
        _this.resetDragState();
        return;
      }
      _this.setState({
        dragOverNodeKey,
        dropPosition,
        dropLevelOffset,
        dropTargetKey,
        dropContainerKey,
        dropTargetPos,
        dropAllowed
      });
      onDragEnter === null || onDragEnter === void 0 || onDragEnter({
        event,
        node: convertNodePropsToEventData(nodeProps),
        expandedKeys
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDragOver", function(event, nodeProps) {
      var _this$state3 = _this.state, dragChildrenKeys = _this$state3.dragChildrenKeys, flattenNodes = _this$state3.flattenNodes, keyEntities = _this$state3.keyEntities, expandedKeys = _this$state3.expandedKeys, indent = _this$state3.indent;
      var _this$props2 = _this.props, onDragOver = _this$props2.onDragOver, allowDrop2 = _this$props2.allowDrop, direction = _this$props2.direction;
      if (!_this.dragNodeProps) {
        return;
      }
      var _calcDropPosition2 = calcDropPosition(event, _this.dragNodeProps, nodeProps, indent, _this.dragStartMousePosition, allowDrop2, flattenNodes, keyEntities, expandedKeys, direction), dropPosition = _calcDropPosition2.dropPosition, dropLevelOffset = _calcDropPosition2.dropLevelOffset, dropTargetKey = _calcDropPosition2.dropTargetKey, dropContainerKey = _calcDropPosition2.dropContainerKey, dropTargetPos = _calcDropPosition2.dropTargetPos, dropAllowed = _calcDropPosition2.dropAllowed, dragOverNodeKey = _calcDropPosition2.dragOverNodeKey;
      if (dragChildrenKeys.includes(dropTargetKey) || !dropAllowed) {
        return;
      }
      if (_this.dragNodeProps.eventKey === dropTargetKey && dropLevelOffset === 0) {
        if (!(_this.state.dropPosition === null && _this.state.dropLevelOffset === null && _this.state.dropTargetKey === null && _this.state.dropContainerKey === null && _this.state.dropTargetPos === null && _this.state.dropAllowed === false && _this.state.dragOverNodeKey === null)) {
          _this.resetDragState();
        }
      } else if (!(dropPosition === _this.state.dropPosition && dropLevelOffset === _this.state.dropLevelOffset && dropTargetKey === _this.state.dropTargetKey && dropContainerKey === _this.state.dropContainerKey && dropTargetPos === _this.state.dropTargetPos && dropAllowed === _this.state.dropAllowed && dragOverNodeKey === _this.state.dragOverNodeKey)) {
        _this.setState({
          dropPosition,
          dropLevelOffset,
          dropTargetKey,
          dropContainerKey,
          dropTargetPos,
          dropAllowed,
          dragOverNodeKey
        });
      }
      onDragOver === null || onDragOver === void 0 || onDragOver({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDragLeave", function(event, nodeProps) {
      if (_this.currentMouseOverDroppableNodeKey === nodeProps.eventKey && !event.currentTarget.contains(event.relatedTarget)) {
        _this.resetDragState();
        _this.currentMouseOverDroppableNodeKey = null;
      }
      var onDragLeave = _this.props.onDragLeave;
      onDragLeave === null || onDragLeave === void 0 || onDragLeave({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onWindowDragEnd", function(event) {
      _this.onNodeDragEnd(event, null, true);
      window.removeEventListener("dragend", _this.onWindowDragEnd);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDragEnd", function(event, nodeProps) {
      var onDragEnd = _this.props.onDragEnd;
      _this.setState({
        dragOverNodeKey: null
      });
      _this.cleanDragState();
      onDragEnd === null || onDragEnd === void 0 || onDragEnd({
        event,
        node: convertNodePropsToEventData(nodeProps)
      });
      _this.dragNodeProps = null;
      window.removeEventListener("dragend", _this.onWindowDragEnd);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDrop", function(event, _24) {
      var _this$getActiveItem;
      var outsideTree = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
      var _this$state4 = _this.state, dragChildrenKeys = _this$state4.dragChildrenKeys, dropPosition = _this$state4.dropPosition, dropTargetKey = _this$state4.dropTargetKey, dropTargetPos = _this$state4.dropTargetPos, dropAllowed = _this$state4.dropAllowed;
      if (!dropAllowed) {
        return;
      }
      var onDrop = _this.props.onDrop;
      _this.setState({
        dragOverNodeKey: null
      });
      _this.cleanDragState();
      if (dropTargetKey === null)
        return;
      var abstractDropNodeProps = _objectSpread2(_objectSpread2({}, getTreeNodeProps(dropTargetKey, _this.getTreeNodeRequiredProps())), {}, {
        active: ((_this$getActiveItem = _this.getActiveItem()) === null || _this$getActiveItem === void 0 ? void 0 : _this$getActiveItem.key) === dropTargetKey,
        data: getEntity(_this.state.keyEntities, dropTargetKey).node
      });
      var dropToChild = dragChildrenKeys.includes(dropTargetKey);
      warningOnce(!dropToChild, "Can not drop to dragNode's children node. This is a bug of rc-tree. Please report an issue.");
      var posArr = posToArr(dropTargetPos);
      var dropResult = {
        event,
        node: convertNodePropsToEventData(abstractDropNodeProps),
        dragNode: _this.dragNodeProps ? convertNodePropsToEventData(_this.dragNodeProps) : null,
        dragNodesKeys: [_this.dragNodeProps.eventKey].concat(dragChildrenKeys),
        dropToGap: dropPosition !== 0,
        dropPosition: dropPosition + Number(posArr[posArr.length - 1])
      };
      if (!outsideTree) {
        onDrop === null || onDrop === void 0 || onDrop(dropResult);
      }
      _this.dragNodeProps = null;
    });
    _defineProperty$4(_assertThisInitialized(_this), "cleanDragState", function() {
      var draggingNodeKey = _this.state.draggingNodeKey;
      if (draggingNodeKey !== null) {
        _this.setState({
          draggingNodeKey: null,
          dropPosition: null,
          dropContainerKey: null,
          dropTargetKey: null,
          dropLevelOffset: null,
          dropAllowed: true,
          dragOverNodeKey: null
        });
      }
      _this.dragStartMousePosition = null;
      _this.currentMouseOverDroppableNodeKey = null;
    });
    _defineProperty$4(_assertThisInitialized(_this), "triggerExpandActionExpand", function(e2, treeNode) {
      var _this$state5 = _this.state, expandedKeys = _this$state5.expandedKeys, flattenNodes = _this$state5.flattenNodes;
      var expanded = treeNode.expanded, key = treeNode.key, isLeaf = treeNode.isLeaf;
      if (isLeaf || e2.shiftKey || e2.metaKey || e2.ctrlKey) {
        return;
      }
      var node2 = flattenNodes.filter(function(nodeItem) {
        return nodeItem.key === key;
      })[0];
      var eventNode = convertNodePropsToEventData(_objectSpread2(_objectSpread2({}, getTreeNodeProps(key, _this.getTreeNodeRequiredProps())), {}, {
        data: node2.data
      }));
      _this.setExpandedKeys(expanded ? arrDel(expandedKeys, key) : arrAdd(expandedKeys, key));
      _this.onNodeExpand(e2, eventNode);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeClick", function(e2, treeNode) {
      var _this$props3 = _this.props, onClick = _this$props3.onClick, expandAction = _this$props3.expandAction;
      if (expandAction === "click") {
        _this.triggerExpandActionExpand(e2, treeNode);
      }
      onClick === null || onClick === void 0 || onClick(e2, treeNode);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeDoubleClick", function(e2, treeNode) {
      var _this$props4 = _this.props, onDoubleClick = _this$props4.onDoubleClick, expandAction = _this$props4.expandAction;
      if (expandAction === "doubleClick") {
        _this.triggerExpandActionExpand(e2, treeNode);
      }
      onDoubleClick === null || onDoubleClick === void 0 || onDoubleClick(e2, treeNode);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeSelect", function(e2, treeNode) {
      var selectedKeys = _this.state.selectedKeys;
      var _this$state6 = _this.state, keyEntities = _this$state6.keyEntities, fieldNames = _this$state6.fieldNames;
      var _this$props5 = _this.props, onSelect = _this$props5.onSelect, multiple = _this$props5.multiple;
      var selected = treeNode.selected;
      var key = treeNode[fieldNames.key];
      var targetSelected = !selected;
      if (!targetSelected) {
        selectedKeys = arrDel(selectedKeys, key);
      } else if (!multiple) {
        selectedKeys = [key];
      } else {
        selectedKeys = arrAdd(selectedKeys, key);
      }
      var selectedNodes = selectedKeys.map(function(selectedKey) {
        var entity = getEntity(keyEntities, selectedKey);
        return entity ? entity.node : null;
      }).filter(Boolean);
      _this.setUncontrolledState({
        selectedKeys
      });
      onSelect === null || onSelect === void 0 || onSelect(selectedKeys, {
        event: "select",
        selected: targetSelected,
        node: treeNode,
        selectedNodes,
        nativeEvent: e2.nativeEvent
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeCheck", function(e2, treeNode, checked) {
      var _this$state7 = _this.state, keyEntities = _this$state7.keyEntities, oriCheckedKeys = _this$state7.checkedKeys, oriHalfCheckedKeys = _this$state7.halfCheckedKeys;
      var _this$props6 = _this.props, checkStrictly = _this$props6.checkStrictly, onCheck = _this$props6.onCheck;
      var key = treeNode.key;
      var checkedObj;
      var eventObj = {
        event: "check",
        node: treeNode,
        checked,
        nativeEvent: e2.nativeEvent
      };
      if (checkStrictly) {
        var checkedKeys = checked ? arrAdd(oriCheckedKeys, key) : arrDel(oriCheckedKeys, key);
        var halfCheckedKeys = arrDel(oriHalfCheckedKeys, key);
        checkedObj = {
          checked: checkedKeys,
          halfChecked: halfCheckedKeys
        };
        eventObj.checkedNodes = checkedKeys.map(function(checkedKey) {
          return getEntity(keyEntities, checkedKey);
        }).filter(Boolean).map(function(entity) {
          return entity.node;
        });
        _this.setUncontrolledState({
          checkedKeys
        });
      } else {
        var _conductCheck = conductCheck([].concat(_toConsumableArray(oriCheckedKeys), [key]), true, keyEntities), _checkedKeys = _conductCheck.checkedKeys, _halfCheckedKeys = _conductCheck.halfCheckedKeys;
        if (!checked) {
          var keySet = new Set(_checkedKeys);
          keySet.delete(key);
          var _conductCheck2 = conductCheck(Array.from(keySet), {
            halfCheckedKeys: _halfCheckedKeys
          }, keyEntities);
          _checkedKeys = _conductCheck2.checkedKeys;
          _halfCheckedKeys = _conductCheck2.halfCheckedKeys;
        }
        checkedObj = _checkedKeys;
        eventObj.checkedNodes = [];
        eventObj.checkedNodesPositions = [];
        eventObj.halfCheckedKeys = _halfCheckedKeys;
        _checkedKeys.forEach(function(checkedKey) {
          var entity = getEntity(keyEntities, checkedKey);
          if (!entity)
            return;
          var node2 = entity.node, pos = entity.pos;
          eventObj.checkedNodes.push(node2);
          eventObj.checkedNodesPositions.push({
            node: node2,
            pos
          });
        });
        _this.setUncontrolledState({
          checkedKeys: _checkedKeys
        }, false, {
          halfCheckedKeys: _halfCheckedKeys
        });
      }
      onCheck === null || onCheck === void 0 || onCheck(checkedObj, eventObj);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeLoad", function(treeNode) {
      var _entity$children;
      var key = treeNode.key;
      var keyEntities = _this.state.keyEntities;
      var entity = getEntity(keyEntities, key);
      if (entity !== null && entity !== void 0 && (_entity$children = entity.children) !== null && _entity$children !== void 0 && _entity$children.length) {
        return;
      }
      var loadPromise = new Promise(function(resolve2, reject) {
        _this.setState(function(_ref) {
          var _ref$loadedKeys = _ref.loadedKeys, loadedKeys = _ref$loadedKeys === void 0 ? [] : _ref$loadedKeys, _ref$loadingKeys = _ref.loadingKeys, loadingKeys = _ref$loadingKeys === void 0 ? [] : _ref$loadingKeys;
          var _this$props7 = _this.props, loadData = _this$props7.loadData, onLoad = _this$props7.onLoad;
          if (!loadData || loadedKeys.includes(key) || loadingKeys.includes(key)) {
            return null;
          }
          var promise = loadData(treeNode);
          promise.then(function() {
            var currentLoadedKeys = _this.state.loadedKeys;
            var newLoadedKeys = arrAdd(currentLoadedKeys, key);
            onLoad === null || onLoad === void 0 || onLoad(newLoadedKeys, {
              event: "load",
              node: treeNode
            });
            _this.setUncontrolledState({
              loadedKeys: newLoadedKeys
            });
            _this.setState(function(prevState) {
              return {
                loadingKeys: arrDel(prevState.loadingKeys, key)
              };
            });
            resolve2();
          }).catch(function(e2) {
            _this.setState(function(prevState) {
              return {
                loadingKeys: arrDel(prevState.loadingKeys, key)
              };
            });
            _this.loadingRetryTimes[key] = (_this.loadingRetryTimes[key] || 0) + 1;
            if (_this.loadingRetryTimes[key] >= MAX_RETRY_TIMES) {
              var currentLoadedKeys = _this.state.loadedKeys;
              warningOnce(false, "Retry for `loadData` many times but still failed. No more retry.");
              _this.setUncontrolledState({
                loadedKeys: arrAdd(currentLoadedKeys, key)
              });
              resolve2();
            }
            reject(e2);
          });
          return {
            loadingKeys: arrAdd(loadingKeys, key)
          };
        });
      });
      loadPromise.catch(function() {
      });
      return loadPromise;
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeMouseEnter", function(event, node2) {
      var onMouseEnter = _this.props.onMouseEnter;
      onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter({
        event,
        node: node2
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeMouseLeave", function(event, node2) {
      var onMouseLeave = _this.props.onMouseLeave;
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave({
        event,
        node: node2
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeContextMenu", function(event, node2) {
      var onRightClick = _this.props.onRightClick;
      if (onRightClick) {
        event.preventDefault();
        onRightClick({
          event,
          node: node2
        });
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "onFocus", function() {
      var onFocus = _this.props.onFocus;
      _this.setState({
        focused: true
      });
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      onFocus === null || onFocus === void 0 || onFocus.apply(void 0, args);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onBlur", function() {
      var onBlur = _this.props.onBlur;
      _this.setState({
        focused: false
      });
      _this.onActiveChange(null);
      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        args[_key3] = arguments[_key3];
      }
      onBlur === null || onBlur === void 0 || onBlur.apply(void 0, args);
    });
    _defineProperty$4(_assertThisInitialized(_this), "getTreeNodeRequiredProps", function() {
      var _this$state8 = _this.state, expandedKeys = _this$state8.expandedKeys, selectedKeys = _this$state8.selectedKeys, loadedKeys = _this$state8.loadedKeys, loadingKeys = _this$state8.loadingKeys, checkedKeys = _this$state8.checkedKeys, halfCheckedKeys = _this$state8.halfCheckedKeys, dragOverNodeKey = _this$state8.dragOverNodeKey, dropPosition = _this$state8.dropPosition, keyEntities = _this$state8.keyEntities;
      return {
        expandedKeys: expandedKeys || [],
        selectedKeys: selectedKeys || [],
        loadedKeys: loadedKeys || [],
        loadingKeys: loadingKeys || [],
        checkedKeys: checkedKeys || [],
        halfCheckedKeys: halfCheckedKeys || [],
        dragOverNodeKey,
        dropPosition,
        keyEntities
      };
    });
    _defineProperty$4(_assertThisInitialized(_this), "setExpandedKeys", function(expandedKeys) {
      var _this$state9 = _this.state, treeData = _this$state9.treeData, fieldNames = _this$state9.fieldNames;
      var flattenNodes = flattenTreeData(treeData, expandedKeys, fieldNames);
      _this.setUncontrolledState({
        expandedKeys,
        flattenNodes
      }, true);
    });
    _defineProperty$4(_assertThisInitialized(_this), "onNodeExpand", function(e2, treeNode) {
      var expandedKeys = _this.state.expandedKeys;
      var _this$state10 = _this.state, listChanging = _this$state10.listChanging, fieldNames = _this$state10.fieldNames;
      var _this$props8 = _this.props, onExpand = _this$props8.onExpand, loadData = _this$props8.loadData;
      var expanded = treeNode.expanded;
      var key = treeNode[fieldNames.key];
      if (listChanging) {
        return;
      }
      var certain = expandedKeys.includes(key);
      var targetExpanded = !expanded;
      warningOnce(expanded && certain || !expanded && !certain, "Expand state not sync with index check");
      expandedKeys = targetExpanded ? arrAdd(expandedKeys, key) : arrDel(expandedKeys, key);
      _this.setExpandedKeys(expandedKeys);
      onExpand === null || onExpand === void 0 || onExpand(expandedKeys, {
        node: treeNode,
        expanded: targetExpanded,
        nativeEvent: e2.nativeEvent
      });
      if (targetExpanded && loadData) {
        var loadPromise = _this.onNodeLoad(treeNode);
        if (loadPromise) {
          loadPromise.then(function() {
            var newFlattenTreeData = flattenTreeData(_this.state.treeData, expandedKeys, fieldNames);
            _this.setUncontrolledState({
              flattenNodes: newFlattenTreeData
            });
          }).catch(function() {
            var currentExpandedKeys = _this.state.expandedKeys;
            var expandedKeysToRestore = arrDel(currentExpandedKeys, key);
            _this.setExpandedKeys(expandedKeysToRestore);
          });
        }
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "onListChangeStart", function() {
      _this.setUncontrolledState({
        listChanging: true
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onListChangeEnd", function() {
      setTimeout(function() {
        _this.setUncontrolledState({
          listChanging: false
        });
      });
    });
    _defineProperty$4(_assertThisInitialized(_this), "onActiveChange", function(newActiveKey) {
      var activeKey = _this.state.activeKey;
      var _this$props9 = _this.props, onActiveChange = _this$props9.onActiveChange, _this$props9$itemScro = _this$props9.itemScrollOffset, itemScrollOffset = _this$props9$itemScro === void 0 ? 0 : _this$props9$itemScro;
      if (activeKey === newActiveKey) {
        return;
      }
      _this.setState({
        activeKey: newActiveKey
      });
      if (newActiveKey !== null) {
        _this.scrollTo({
          key: newActiveKey,
          offset: itemScrollOffset
        });
      }
      onActiveChange === null || onActiveChange === void 0 || onActiveChange(newActiveKey);
    });
    _defineProperty$4(_assertThisInitialized(_this), "getActiveItem", function() {
      var _this$state11 = _this.state, activeKey = _this$state11.activeKey, flattenNodes = _this$state11.flattenNodes;
      if (activeKey === null) {
        return null;
      }
      return flattenNodes.find(function(_ref2) {
        var key = _ref2.key;
        return key === activeKey;
      }) || null;
    });
    _defineProperty$4(_assertThisInitialized(_this), "offsetActiveKey", function(offset2) {
      var _this$state12 = _this.state, flattenNodes = _this$state12.flattenNodes, activeKey = _this$state12.activeKey;
      var index2 = flattenNodes.findIndex(function(_ref3) {
        var key = _ref3.key;
        return key === activeKey;
      });
      if (index2 === -1 && offset2 < 0) {
        index2 = flattenNodes.length;
      }
      index2 = (index2 + offset2 + flattenNodes.length) % flattenNodes.length;
      var item = flattenNodes[index2];
      if (item) {
        var _key4 = item.key;
        _this.onActiveChange(_key4);
      } else {
        _this.onActiveChange(null);
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "onKeyDown", function(event) {
      var _this$state13 = _this.state, activeKey = _this$state13.activeKey, expandedKeys = _this$state13.expandedKeys, checkedKeys = _this$state13.checkedKeys, fieldNames = _this$state13.fieldNames;
      var _this$props10 = _this.props, onKeyDown = _this$props10.onKeyDown, checkable = _this$props10.checkable, selectable = _this$props10.selectable;
      switch (event.which) {
        case KeyCode$1.UP: {
          _this.offsetActiveKey(-1);
          event.preventDefault();
          break;
        }
        case KeyCode$1.DOWN: {
          _this.offsetActiveKey(1);
          event.preventDefault();
          break;
        }
      }
      var activeItem = _this.getActiveItem();
      if (activeItem && activeItem.data) {
        var treeNodeRequiredProps = _this.getTreeNodeRequiredProps();
        var expandable = activeItem.data.isLeaf === false || !!(activeItem.data[fieldNames.children] || []).length;
        var eventNode = convertNodePropsToEventData(_objectSpread2(_objectSpread2({}, getTreeNodeProps(activeKey, treeNodeRequiredProps)), {}, {
          data: activeItem.data,
          active: true
        }));
        switch (event.which) {
          case KeyCode$1.LEFT: {
            if (expandable && expandedKeys.includes(activeKey)) {
              _this.onNodeExpand({}, eventNode);
            } else if (activeItem.parent) {
              _this.onActiveChange(activeItem.parent.key);
            }
            event.preventDefault();
            break;
          }
          case KeyCode$1.RIGHT: {
            if (expandable && !expandedKeys.includes(activeKey)) {
              _this.onNodeExpand({}, eventNode);
            } else if (activeItem.children && activeItem.children.length) {
              _this.onActiveChange(activeItem.children[0].key);
            }
            event.preventDefault();
            break;
          }
          case KeyCode$1.ENTER:
          case KeyCode$1.SPACE: {
            if (checkable && !eventNode.disabled && eventNode.checkable !== false && !eventNode.disableCheckbox) {
              _this.onNodeCheck({}, eventNode, !checkedKeys.includes(activeKey));
            } else if (!checkable && selectable && !eventNode.disabled && eventNode.selectable !== false) {
              _this.onNodeSelect({}, eventNode);
            }
            break;
          }
        }
      }
      onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
    });
    _defineProperty$4(_assertThisInitialized(_this), "setUncontrolledState", function(state) {
      var atomic = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
      var forceState = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
      if (!_this.destroyed) {
        var needSync = false;
        var allPassed = true;
        var newState = {};
        Object.keys(state).forEach(function(name2) {
          if (_this.props.hasOwnProperty(name2)) {
            allPassed = false;
            return;
          }
          needSync = true;
          newState[name2] = state[name2];
        });
        if (needSync && (!atomic || allPassed)) {
          _this.setState(_objectSpread2(_objectSpread2({}, newState), forceState));
        }
      }
    });
    _defineProperty$4(_assertThisInitialized(_this), "scrollTo", function(scroll) {
      _this.listRef.current.scrollTo(scroll);
    });
    return _this;
  }
  _createClass$8(Tree2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.destroyed = false;
      this.onUpdated();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this.onUpdated();
    }
  }, {
    key: "onUpdated",
    value: function onUpdated() {
      var _this$props11 = this.props, activeKey = _this$props11.activeKey, _this$props11$itemScr = _this$props11.itemScrollOffset, itemScrollOffset = _this$props11$itemScr === void 0 ? 0 : _this$props11$itemScr;
      if (activeKey !== void 0 && activeKey !== this.state.activeKey) {
        this.setState({
          activeKey
        });
        if (activeKey !== null) {
          this.scrollTo({
            key: activeKey,
            offset: itemScrollOffset
          });
        }
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      window.removeEventListener("dragend", this.onWindowDragEnd);
      this.destroyed = true;
    }
  }, {
    key: "resetDragState",
    value: function resetDragState() {
      this.setState({
        dragOverNodeKey: null,
        dropPosition: null,
        dropLevelOffset: null,
        dropTargetKey: null,
        dropContainerKey: null,
        dropTargetPos: null,
        dropAllowed: false
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$state14 = this.state, focused = _this$state14.focused, flattenNodes = _this$state14.flattenNodes, keyEntities = _this$state14.keyEntities, draggingNodeKey = _this$state14.draggingNodeKey, activeKey = _this$state14.activeKey, dropLevelOffset = _this$state14.dropLevelOffset, dropContainerKey = _this$state14.dropContainerKey, dropTargetKey = _this$state14.dropTargetKey, dropPosition = _this$state14.dropPosition, dragOverNodeKey = _this$state14.dragOverNodeKey, indent = _this$state14.indent;
      var _this$props12 = this.props, prefixCls = _this$props12.prefixCls, className = _this$props12.className, style2 = _this$props12.style, showLine = _this$props12.showLine, focusable2 = _this$props12.focusable, _this$props12$tabInde = _this$props12.tabIndex, tabIndex = _this$props12$tabInde === void 0 ? 0 : _this$props12$tabInde, selectable = _this$props12.selectable, showIcon = _this$props12.showIcon, icon = _this$props12.icon, switcherIcon = _this$props12.switcherIcon, draggable = _this$props12.draggable, checkable = _this$props12.checkable, checkStrictly = _this$props12.checkStrictly, disabled = _this$props12.disabled, motion = _this$props12.motion, loadData = _this$props12.loadData, filterTreeNode = _this$props12.filterTreeNode, height = _this$props12.height, itemHeight = _this$props12.itemHeight, scrollWidth = _this$props12.scrollWidth, virtual = _this$props12.virtual, titleRender = _this$props12.titleRender, dropIndicatorRender2 = _this$props12.dropIndicatorRender, onContextMenu = _this$props12.onContextMenu, onScroll6 = _this$props12.onScroll, direction = _this$props12.direction, rootClassName = _this$props12.rootClassName, rootStyle = _this$props12.rootStyle;
      var domProps = pickAttrs$1(this.props, {
        aria: true,
        data: true
      });
      var draggableConfig;
      if (draggable) {
        if (_typeof$2(draggable) === "object") {
          draggableConfig = draggable;
        } else if (typeof draggable === "function") {
          draggableConfig = {
            nodeDraggable: draggable
          };
        } else {
          draggableConfig = {};
        }
      }
      var contextValue = {
        prefixCls,
        selectable,
        showIcon,
        icon,
        switcherIcon,
        draggable: draggableConfig,
        draggingNodeKey,
        checkable,
        checkStrictly,
        disabled,
        keyEntities,
        dropLevelOffset,
        dropContainerKey,
        dropTargetKey,
        dropPosition,
        dragOverNodeKey,
        indent,
        direction,
        dropIndicatorRender: dropIndicatorRender2,
        loadData,
        filterTreeNode,
        titleRender,
        onNodeClick: this.onNodeClick,
        onNodeDoubleClick: this.onNodeDoubleClick,
        onNodeExpand: this.onNodeExpand,
        onNodeSelect: this.onNodeSelect,
        onNodeCheck: this.onNodeCheck,
        onNodeLoad: this.onNodeLoad,
        onNodeMouseEnter: this.onNodeMouseEnter,
        onNodeMouseLeave: this.onNodeMouseLeave,
        onNodeContextMenu: this.onNodeContextMenu,
        onNodeDragStart: this.onNodeDragStart,
        onNodeDragEnter: this.onNodeDragEnter,
        onNodeDragOver: this.onNodeDragOver,
        onNodeDragLeave: this.onNodeDragLeave,
        onNodeDragEnd: this.onNodeDragEnd,
        onNodeDrop: this.onNodeDrop
      };
      return /* @__PURE__ */ reactExports.createElement(TreeContext.Provider, {
        value: contextValue
      }, /* @__PURE__ */ reactExports.createElement("div", {
        className: classNames(prefixCls, className, rootClassName, _defineProperty$4(_defineProperty$4(_defineProperty$4({}, "".concat(prefixCls, "-show-line"), showLine), "".concat(prefixCls, "-focused"), focused), "".concat(prefixCls, "-active-focused"), activeKey !== null)),
        style: rootStyle
      }, /* @__PURE__ */ reactExports.createElement(NodeList, _extends$j({
        ref: this.listRef,
        prefixCls,
        style: style2,
        data: flattenNodes,
        disabled,
        selectable,
        checkable: !!checkable,
        motion,
        dragging: draggingNodeKey !== null,
        height,
        itemHeight,
        virtual,
        focusable: focusable2,
        focused,
        tabIndex,
        activeItem: this.getActiveItem(),
        onFocus: this.onFocus,
        onBlur: this.onBlur,
        onKeyDown: this.onKeyDown,
        onActiveChange: this.onActiveChange,
        onListChangeStart: this.onListChangeStart,
        onListChangeEnd: this.onListChangeEnd,
        onContextMenu,
        onScroll: onScroll6,
        scrollWidth
      }, this.getTreeNodeRequiredProps(), domProps))));
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(props, prevState) {
      var prevProps = prevState.prevProps;
      var newState = {
        prevProps: props
      };
      function needSync(name2) {
        return !prevProps && props.hasOwnProperty(name2) || prevProps && prevProps[name2] !== props[name2];
      }
      var treeData;
      var fieldNames = prevState.fieldNames;
      if (needSync("fieldNames")) {
        fieldNames = fillFieldNames(props.fieldNames);
        newState.fieldNames = fieldNames;
      }
      if (needSync("treeData")) {
        treeData = props.treeData;
      } else if (needSync("children")) {
        warningOnce(false, "`children` of Tree is deprecated. Please use `treeData` instead.");
        treeData = convertTreeToData(props.children);
      }
      if (treeData) {
        newState.treeData = treeData;
        var entitiesMap = convertDataToEntities(treeData, {
          fieldNames
        });
        newState.keyEntities = _objectSpread2(_defineProperty$4({}, MOTION_KEY, MotionEntity), entitiesMap.keyEntities);
      }
      var keyEntities = newState.keyEntities || prevState.keyEntities;
      if (needSync("expandedKeys") || prevProps && needSync("autoExpandParent")) {
        newState.expandedKeys = props.autoExpandParent || !prevProps && props.defaultExpandParent ? conductExpandParent(props.expandedKeys, keyEntities) : props.expandedKeys;
      } else if (!prevProps && props.defaultExpandAll) {
        var cloneKeyEntities = _objectSpread2({}, keyEntities);
        delete cloneKeyEntities[MOTION_KEY];
        var nextExpandedKeys = [];
        Object.keys(cloneKeyEntities).forEach(function(key) {
          var entity = cloneKeyEntities[key];
          if (entity.children && entity.children.length) {
            nextExpandedKeys.push(entity.key);
          }
        });
        newState.expandedKeys = nextExpandedKeys;
      } else if (!prevProps && props.defaultExpandedKeys) {
        newState.expandedKeys = props.autoExpandParent || props.defaultExpandParent ? conductExpandParent(props.defaultExpandedKeys, keyEntities) : props.defaultExpandedKeys;
      }
      if (!newState.expandedKeys) {
        delete newState.expandedKeys;
      }
      if (treeData || newState.expandedKeys) {
        var flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, fieldNames);
        newState.flattenNodes = flattenNodes;
      }
      if (props.selectable) {
        if (needSync("selectedKeys")) {
          newState.selectedKeys = calcSelectedKeys(props.selectedKeys, props);
        } else if (!prevProps && props.defaultSelectedKeys) {
          newState.selectedKeys = calcSelectedKeys(props.defaultSelectedKeys, props);
        }
      }
      if (props.checkable) {
        var checkedKeyEntity;
        if (needSync("checkedKeys")) {
          checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {};
        } else if (!prevProps && props.defaultCheckedKeys) {
          checkedKeyEntity = parseCheckedKeys(props.defaultCheckedKeys) || {};
        } else if (treeData) {
          checkedKeyEntity = parseCheckedKeys(props.checkedKeys) || {
            checkedKeys: prevState.checkedKeys,
            halfCheckedKeys: prevState.halfCheckedKeys
          };
        }
        if (checkedKeyEntity) {
          var _checkedKeyEntity = checkedKeyEntity, _checkedKeyEntity$che = _checkedKeyEntity.checkedKeys, checkedKeys = _checkedKeyEntity$che === void 0 ? [] : _checkedKeyEntity$che, _checkedKeyEntity$hal = _checkedKeyEntity.halfCheckedKeys, halfCheckedKeys = _checkedKeyEntity$hal === void 0 ? [] : _checkedKeyEntity$hal;
          if (!props.checkStrictly) {
            var conductKeys = conductCheck(checkedKeys, true, keyEntities);
            checkedKeys = conductKeys.checkedKeys;
            halfCheckedKeys = conductKeys.halfCheckedKeys;
          }
          newState.checkedKeys = checkedKeys;
          newState.halfCheckedKeys = halfCheckedKeys;
        }
      }
      if (needSync("loadedKeys")) {
        newState.loadedKeys = props.loadedKeys;
      }
      return newState;
    }
  }]);
  return Tree2;
}(reactExports.Component);
_defineProperty$4(Tree$2, "defaultProps", {
  prefixCls: "rc-tree",
  showLine: false,
  showIcon: true,
  selectable: true,
  multiple: false,
  checkable: false,
  disabled: false,
  checkStrictly: false,
  draggable: false,
  defaultExpandParent: true,
  autoExpandParent: false,
  defaultExpandAll: false,
  defaultExpandedKeys: [],
  defaultCheckedKeys: [],
  defaultSelectedKeys: [],
  dropIndicatorRender: DropIndicator,
  allowDrop: function allowDrop() {
    return true;
  },
  expandAction: false
});
_defineProperty$4(Tree$2, "TreeNode", TreeNode);
const genDirectoryStyle = ({
  treeCls,
  treeNodeCls,
  directoryNodeSelectedBg,
  directoryNodeSelectedColor,
  motionDurationMid,
  borderRadius: borderRadius2,
  controlItemBgHover
}) => ({
  [`${treeCls}${treeCls}-directory ${treeNodeCls}`]: {
    // >>> Title
    [`${treeCls}-node-content-wrapper`]: {
      position: "static",
      [`&:has(${treeCls}-drop-indicator)`]: {
        position: "relative"
      },
      [`> *:not(${treeCls}-drop-indicator)`]: {
        position: "relative"
      },
      "&:hover": {
        background: "transparent"
      },
      // Expand interactive area to whole line
      "&:before": {
        position: "absolute",
        inset: 0,
        transition: `background-color ${motionDurationMid}`,
        content: '""',
        borderRadius: borderRadius2
      },
      "&:hover:before": {
        background: controlItemBgHover
      }
    },
    [`${treeCls}-switcher, ${treeCls}-checkbox, ${treeCls}-draggable-icon`]: {
      zIndex: 1
    },
    // ============= Selected =============
    "&-selected": {
      background: directoryNodeSelectedBg,
      borderRadius: borderRadius2,
      [`${treeCls}-switcher, ${treeCls}-draggable-icon`]: {
        color: directoryNodeSelectedColor
      },
      // >>> Title
      [`${treeCls}-node-content-wrapper`]: {
        color: directoryNodeSelectedColor,
        background: "transparent",
        "&:before, &:hover:before": {
          background: directoryNodeSelectedBg
        }
      }
    }
  }
});
const treeNodeFX = new Keyframe("ant-tree-node-fx-do-not-use", {
  "0%": {
    opacity: 0
  },
  "100%": {
    opacity: 1
  }
});
const getSwitchStyle = (prefixCls, token2) => ({
  [`.${prefixCls}-switcher-icon`]: {
    display: "inline-block",
    fontSize: 10,
    verticalAlign: "baseline",
    svg: {
      transition: `transform ${token2.motionDurationSlow}`
    }
  }
});
const getDropIndicatorStyle = (prefixCls, token2) => ({
  [`.${prefixCls}-drop-indicator`]: {
    position: "absolute",
    // it should displayed over the following node
    zIndex: 1,
    height: 2,
    backgroundColor: token2.colorPrimary,
    borderRadius: 1,
    pointerEvents: "none",
    "&:after": {
      position: "absolute",
      top: -3,
      insetInlineStart: -6,
      width: 8,
      height: 8,
      backgroundColor: "transparent",
      border: `${unit$1(token2.lineWidthBold)} solid ${token2.colorPrimary}`,
      borderRadius: "50%",
      content: '""'
    }
  }
});
const genBaseStyle = (prefixCls, token2) => {
  const {
    treeCls,
    treeNodeCls,
    treeNodePadding,
    titleHeight,
    indentSize,
    nodeSelectedBg,
    nodeHoverBg,
    colorTextQuaternary,
    controlItemBgActiveDisabled
  } = token2;
  return {
    [treeCls]: Object.assign(Object.assign({}, resetComponent(token2)), {
      // fix https://github.com/ant-design/ant-design/issues/50316
      ["--rc-virtual-list-scrollbar-bg"]: token2.colorSplit,
      background: token2.colorBgContainer,
      borderRadius: token2.borderRadius,
      transition: `background-color ${token2.motionDurationSlow}`,
      "&-rtl": {
        direction: "rtl"
      },
      [`&${treeCls}-rtl ${treeCls}-switcher_close ${treeCls}-switcher-icon svg`]: {
        transform: "rotate(90deg)"
      },
      [`&-focused:not(:hover):not(${treeCls}-active-focused)`]: Object.assign({}, genFocusOutline(token2)),
      // =================== Virtual List ===================
      [`${treeCls}-list-holder-inner`]: {
        alignItems: "flex-start"
      },
      [`&${treeCls}-block-node`]: {
        [`${treeCls}-list-holder-inner`]: {
          alignItems: "stretch",
          // >>> Title
          [`${treeCls}-node-content-wrapper`]: {
            flex: "auto"
          },
          // >>> Drag
          [`${treeNodeCls}.dragging:after`]: {
            position: "absolute",
            inset: 0,
            border: `1px solid ${token2.colorPrimary}`,
            opacity: 0,
            animationName: treeNodeFX,
            animationDuration: token2.motionDurationSlow,
            animationPlayState: "running",
            animationFillMode: "forwards",
            content: '""',
            pointerEvents: "none",
            borderRadius: token2.borderRadius
          }
        }
      },
      // ===================== TreeNode =====================
      [treeNodeCls]: {
        display: "flex",
        alignItems: "flex-start",
        marginBottom: treeNodePadding,
        lineHeight: unit$1(titleHeight),
        position: "relative",
        // 非常重要，避免 drop-indicator 在拖拽过程中闪烁
        "&:before": {
          content: '""',
          position: "absolute",
          zIndex: 1,
          insetInlineStart: 0,
          width: "100%",
          top: "100%",
          height: treeNodePadding
        },
        // Disabled
        [`&-disabled ${treeCls}-node-content-wrapper`]: {
          color: token2.colorTextDisabled,
          cursor: "not-allowed",
          "&:hover": {
            background: "transparent"
          }
        },
        [`${treeCls}-checkbox-disabled + ${treeCls}-node-selected,&${treeNodeCls}-disabled${treeNodeCls}-selected ${treeCls}-node-content-wrapper`]: {
          backgroundColor: controlItemBgActiveDisabled
        },
        // we can not set pointer-events to none for checkbox in tree
        // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-2605234058
        [`${treeCls}-checkbox-disabled`]: {
          pointerEvents: "unset"
        },
        // not disable
        [`&:not(${treeNodeCls}-disabled)`]: {
          // >>> Title
          [`${treeCls}-node-content-wrapper`]: {
            "&:hover": {
              color: token2.nodeHoverColor
            }
          }
        },
        [`&-active ${treeCls}-node-content-wrapper`]: {
          background: token2.controlItemBgHover
        },
        [`&:not(${treeNodeCls}-disabled).filter-node ${treeCls}-title`]: {
          color: token2.colorPrimary,
          fontWeight: token2.fontWeightStrong
        },
        "&-draggable": {
          cursor: "grab",
          [`${treeCls}-draggable-icon`]: {
            // https://github.com/ant-design/ant-design/issues/41915
            flexShrink: 0,
            width: titleHeight,
            textAlign: "center",
            visibility: "visible",
            color: colorTextQuaternary
          },
          [`&${treeNodeCls}-disabled ${treeCls}-draggable-icon`]: {
            visibility: "hidden"
          }
        }
      },
      // >>> Indent
      [`${treeCls}-indent`]: {
        alignSelf: "stretch",
        whiteSpace: "nowrap",
        userSelect: "none",
        "&-unit": {
          display: "inline-block",
          width: indentSize
        }
      },
      // >>> Drag Handler
      [`${treeCls}-draggable-icon`]: {
        visibility: "hidden"
      },
      // Switcher / Checkbox
      [`${treeCls}-switcher, ${treeCls}-checkbox`]: {
        marginInlineEnd: token2.calc(token2.calc(titleHeight).sub(token2.controlInteractiveSize)).div(2).equal()
      },
      // >>> Switcher
      [`${treeCls}-switcher`]: Object.assign(Object.assign({}, getSwitchStyle(prefixCls, token2)), {
        position: "relative",
        flex: "none",
        alignSelf: "stretch",
        width: titleHeight,
        textAlign: "center",
        cursor: "pointer",
        userSelect: "none",
        transition: `all ${token2.motionDurationSlow}`,
        "&-noop": {
          cursor: "unset"
        },
        "&:before": {
          pointerEvents: "none",
          content: '""',
          width: titleHeight,
          height: titleHeight,
          position: "absolute",
          left: {
            _skip_check_: true,
            value: 0
          },
          top: 0,
          borderRadius: token2.borderRadius,
          transition: `all ${token2.motionDurationSlow}`
        },
        [`&:not(${treeCls}-switcher-noop):hover:before`]: {
          backgroundColor: token2.colorBgTextHover
        },
        [`&_close ${treeCls}-switcher-icon svg`]: {
          transform: "rotate(-90deg)"
        },
        "&-loading-icon": {
          color: token2.colorPrimary
        },
        "&-leaf-line": {
          position: "relative",
          zIndex: 1,
          display: "inline-block",
          width: "100%",
          height: "100%",
          // https://github.com/ant-design/ant-design/issues/31884
          "&:before": {
            position: "absolute",
            top: 0,
            insetInlineEnd: token2.calc(titleHeight).div(2).equal(),
            bottom: token2.calc(treeNodePadding).mul(-1).equal(),
            marginInlineStart: -1,
            borderInlineEnd: `1px solid ${token2.colorBorder}`,
            content: '""'
          },
          "&:after": {
            position: "absolute",
            width: token2.calc(token2.calc(titleHeight).div(2).equal()).mul(0.8).equal(),
            height: token2.calc(titleHeight).div(2).equal(),
            borderBottom: `1px solid ${token2.colorBorder}`,
            content: '""'
          }
        }
      }),
      // >>> Title
      // add `${treeCls}-checkbox + span` to cover checkbox `${checkboxCls} + span`
      [`${treeCls}-node-content-wrapper`]: Object.assign(Object.assign({
        position: "relative",
        minHeight: titleHeight,
        paddingBlock: 0,
        paddingInline: token2.paddingXS,
        background: "transparent",
        borderRadius: token2.borderRadius,
        cursor: "pointer",
        transition: `all ${token2.motionDurationMid}, border 0s, line-height 0s, box-shadow 0s`
      }, getDropIndicatorStyle(prefixCls, token2)), {
        "&:hover": {
          backgroundColor: nodeHoverBg
        },
        [`&${treeCls}-node-selected`]: {
          color: token2.nodeSelectedColor,
          backgroundColor: nodeSelectedBg
        },
        // Icon
        [`${treeCls}-iconEle`]: {
          display: "inline-block",
          width: titleHeight,
          height: titleHeight,
          textAlign: "center",
          verticalAlign: "top",
          "&:empty": {
            display: "none"
          }
        }
      }),
      // https://github.com/ant-design/ant-design/issues/28217
      [`${treeCls}-unselectable ${treeCls}-node-content-wrapper:hover`]: {
        backgroundColor: "transparent"
      },
      [`${treeNodeCls}.drop-container > [draggable]`]: {
        boxShadow: `0 0 0 2px ${token2.colorPrimary}`
      },
      // ==================== Show Line =====================
      "&-show-line": {
        // ================ Indent lines ================
        [`${treeCls}-indent-unit`]: {
          position: "relative",
          height: "100%",
          "&:before": {
            position: "absolute",
            top: 0,
            insetInlineEnd: token2.calc(titleHeight).div(2).equal(),
            bottom: token2.calc(treeNodePadding).mul(-1).equal(),
            borderInlineEnd: `1px solid ${token2.colorBorder}`,
            content: '""'
          },
          "&-end:before": {
            display: "none"
          }
        },
        // ============== Cover Background ==============
        [`${treeCls}-switcher`]: {
          background: "transparent",
          "&-line-icon": {
            // https://github.com/ant-design/ant-design/issues/32813
            verticalAlign: "-0.15em"
          }
        }
      },
      [`${treeNodeCls}-leaf-last ${treeCls}-switcher-leaf-line:before`]: {
        top: "auto !important",
        bottom: "auto !important",
        height: `${unit$1(token2.calc(titleHeight).div(2).equal())} !important`
      }
    })
  };
};
const genTreeStyle = (prefixCls, token2, enableDirectory = true) => {
  const treeCls = `.${prefixCls}`;
  const treeNodeCls = `${treeCls}-treenode`;
  const treeNodePadding = token2.calc(token2.paddingXS).div(2).equal();
  const treeToken = merge$4(token2, {
    treeCls,
    treeNodeCls,
    treeNodePadding
  });
  return [
    // Basic
    genBaseStyle(prefixCls, treeToken),
    // Directory
    enableDirectory && genDirectoryStyle(treeToken)
  ].filter(Boolean);
};
const initComponentToken = (token2) => {
  const {
    controlHeightSM,
    controlItemBgHover,
    controlItemBgActive
  } = token2;
  const titleHeight = controlHeightSM;
  return {
    titleHeight,
    indentSize: titleHeight,
    nodeHoverBg: controlItemBgHover,
    nodeHoverColor: token2.colorText,
    nodeSelectedBg: controlItemBgActive,
    nodeSelectedColor: token2.colorText
  };
};
const prepareComponentToken = (token2) => {
  const {
    colorTextLightSolid,
    colorPrimary
  } = token2;
  return Object.assign(Object.assign({}, initComponentToken(token2)), {
    directoryNodeSelectedColor: colorTextLightSolid,
    directoryNodeSelectedBg: colorPrimary
  });
};
const useStyle = genStyleHooks("Tree", (token2, {
  prefixCls
}) => [{
  [token2.componentCls]: getStyle$1(`${prefixCls}-checkbox`, token2)
}, genTreeStyle(prefixCls, token2), genCollapseMotion(token2)], prepareComponentToken);
const offset$1 = 4;
function dropIndicatorRender(props) {
  const {
    dropPosition,
    dropLevelOffset,
    prefixCls,
    indent,
    direction = "ltr"
  } = props;
  const startPosition = direction === "ltr" ? "left" : "right";
  const endPosition = direction === "ltr" ? "right" : "left";
  const style2 = {
    [startPosition]: -dropLevelOffset * indent + offset$1,
    [endPosition]: 0
  };
  switch (dropPosition) {
    case -1:
      style2.top = -3;
      break;
    case 1:
      style2.bottom = -3;
      break;
    default:
      style2.bottom = -3;
      style2[startPosition] = indent + offset$1;
      break;
  }
  return /* @__PURE__ */ React$6.createElement("div", {
    style: style2,
    className: `${prefixCls}-drop-indicator`
  });
}
const SwitcherIconCom = (props) => {
  var _a2, _b2;
  const {
    prefixCls,
    switcherIcon,
    treeNodeProps,
    showLine,
    switcherLoadingIcon
  } = props;
  const {
    isLeaf,
    expanded,
    loading
  } = treeNodeProps;
  if (loading) {
    if (/* @__PURE__ */ reactExports.isValidElement(switcherLoadingIcon)) {
      return switcherLoadingIcon;
    }
    return /* @__PURE__ */ reactExports.createElement(RefIcon$1n, {
      className: `${prefixCls}-switcher-loading-icon`
    });
  }
  let showLeafIcon;
  if (showLine && typeof showLine === "object") {
    showLeafIcon = showLine.showLeafIcon;
  }
  if (isLeaf) {
    if (!showLine) {
      return null;
    }
    if (typeof showLeafIcon !== "boolean" && !!showLeafIcon) {
      const leafIcon = typeof showLeafIcon === "function" ? showLeafIcon(treeNodeProps) : showLeafIcon;
      const leafCls = `${prefixCls}-switcher-line-custom-icon`;
      if (/* @__PURE__ */ reactExports.isValidElement(leafIcon)) {
        return cloneElement(leafIcon, {
          className: classNames((_a2 = leafIcon.props) === null || _a2 === void 0 ? void 0 : _a2.className, leafCls)
        });
      }
      return leafIcon;
    }
    return showLeafIcon ? /* @__PURE__ */ reactExports.createElement(RefIcon$N, {
      className: `${prefixCls}-switcher-line-icon`
    }) : /* @__PURE__ */ reactExports.createElement("span", {
      className: `${prefixCls}-switcher-leaf-line`
    });
  }
  const switcherCls = `${prefixCls}-switcher-icon`;
  const switcher = typeof switcherIcon === "function" ? switcherIcon(treeNodeProps) : switcherIcon;
  if (/* @__PURE__ */ reactExports.isValidElement(switcher)) {
    return cloneElement(switcher, {
      className: classNames((_b2 = switcher.props) === null || _b2 === void 0 ? void 0 : _b2.className, switcherCls)
    });
  }
  if (switcher !== void 0) {
    return switcher;
  }
  if (showLine) {
    return expanded ? /* @__PURE__ */ reactExports.createElement(RefIcon$r, {
      className: `${prefixCls}-switcher-line-icon`
    }) : /* @__PURE__ */ reactExports.createElement(RefIcon$j, {
      className: `${prefixCls}-switcher-line-icon`
    });
  }
  return /* @__PURE__ */ reactExports.createElement(RefIcon$10, {
    className: switcherCls
  });
};
const Tree$1 = /* @__PURE__ */ React$6.forwardRef((props, ref) => {
  var _a2;
  const {
    getPrefixCls,
    direction,
    virtual,
    tree
  } = React$6.useContext(ConfigContext);
  const {
    prefixCls: customizePrefixCls,
    className,
    showIcon = false,
    showLine,
    switcherIcon,
    switcherLoadingIcon,
    blockNode = false,
    children,
    checkable = false,
    selectable = true,
    draggable,
    motion: customMotion,
    style: style2
  } = props;
  const prefixCls = getPrefixCls("tree", customizePrefixCls);
  const rootPrefixCls = getPrefixCls();
  const motion = customMotion !== null && customMotion !== void 0 ? customMotion : Object.assign(Object.assign({}, initCollapseMotion(rootPrefixCls)), {
    motionAppear: false
  });
  const newProps = Object.assign(Object.assign({}, props), {
    checkable,
    selectable,
    showIcon,
    motion,
    blockNode,
    showLine: Boolean(showLine),
    dropIndicatorRender
  });
  const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);
  const [, token2] = useToken();
  const itemHeight = token2.paddingXS / 2 + (((_a2 = token2.Tree) === null || _a2 === void 0 ? void 0 : _a2.titleHeight) || token2.controlHeightSM);
  const draggableConfig = React$6.useMemo(() => {
    if (!draggable) {
      return false;
    }
    let mergedDraggable = {};
    switch (typeof draggable) {
      case "function":
        mergedDraggable.nodeDraggable = draggable;
        break;
      case "object":
        mergedDraggable = Object.assign({}, draggable);
        break;
    }
    if (mergedDraggable.icon !== false) {
      mergedDraggable.icon = mergedDraggable.icon || /* @__PURE__ */ React$6.createElement(RefIcon$A, null);
    }
    return mergedDraggable;
  }, [draggable]);
  const renderSwitcherIcon = (nodeProps) => /* @__PURE__ */ React$6.createElement(SwitcherIconCom, {
    prefixCls,
    switcherIcon,
    switcherLoadingIcon,
    treeNodeProps: nodeProps,
    showLine
  });
  return wrapCSSVar(
    // @ts-ignore
    /* @__PURE__ */ React$6.createElement(Tree$2, Object.assign({
      itemHeight,
      ref,
      virtual
    }, newProps, {
      // newProps may contain style so declare style below it
      style: Object.assign(Object.assign({}, tree === null || tree === void 0 ? void 0 : tree.style), style2),
      prefixCls,
      className: classNames({
        [`${prefixCls}-icon-hide`]: !showIcon,
        [`${prefixCls}-block-node`]: blockNode,
        [`${prefixCls}-unselectable`]: !selectable,
        [`${prefixCls}-rtl`]: direction === "rtl"
      }, tree === null || tree === void 0 ? void 0 : tree.className, className, hashId, cssVarCls),
      direction,
      checkable: checkable ? /* @__PURE__ */ React$6.createElement("span", {
        className: `${prefixCls}-checkbox-inner`
      }) : checkable,
      selectable,
      switcherIcon: renderSwitcherIcon,
      draggable: draggableConfig
    }), children)
  );
});
const RECORD_NONE = 0;
const RECORD_START = 1;
const RECORD_END = 2;
function traverseNodesKey(treeData, callback2, fieldNames) {
  const {
    key: fieldKey,
    children: fieldChildren
  } = fieldNames;
  function processNode(dataNode) {
    const key = dataNode[fieldKey];
    const children = dataNode[fieldChildren];
    if (callback2(key, dataNode) !== false) {
      traverseNodesKey(children || [], callback2, fieldNames);
    }
  }
  treeData.forEach(processNode);
}
function calcRangeKeys({
  treeData,
  expandedKeys,
  startKey,
  endKey,
  fieldNames
}) {
  const keys2 = [];
  let record = RECORD_NONE;
  if (startKey && startKey === endKey) {
    return [startKey];
  }
  if (!startKey || !endKey) {
    return [];
  }
  function matchKey(key) {
    return key === startKey || key === endKey;
  }
  traverseNodesKey(treeData, (key) => {
    if (record === RECORD_END) {
      return false;
    }
    if (matchKey(key)) {
      keys2.push(key);
      if (record === RECORD_NONE) {
        record = RECORD_START;
      } else if (record === RECORD_START) {
        record = RECORD_END;
        return false;
      }
    } else if (record === RECORD_START) {
      keys2.push(key);
    }
    return expandedKeys.includes(key);
  }, fillFieldNames(fieldNames));
  return keys2;
}
function convertDirectoryKeysToNodes(treeData, keys2, fieldNames) {
  const restKeys = _toConsumableArray(keys2);
  const nodes = [];
  traverseNodesKey(treeData, (key, node2) => {
    const index2 = restKeys.indexOf(key);
    if (index2 !== -1) {
      nodes.push(node2);
      restKeys.splice(index2, 1);
    }
    return !!restKeys.length;
  }, fillFieldNames(fieldNames));
  return nodes;
}
var __rest$2 = function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
function getIcon(props) {
  const {
    isLeaf,
    expanded
  } = props;
  if (isLeaf) {
    return /* @__PURE__ */ reactExports.createElement(RefIcon$N, null);
  }
  return expanded ? /* @__PURE__ */ reactExports.createElement(RefIcon$H, null) : /* @__PURE__ */ reactExports.createElement(RefIcon$G, null);
}
function getTreeData({
  treeData,
  children
}) {
  return treeData || convertTreeToData(children);
}
const DirectoryTree = (_a2, ref) => {
  var {
    defaultExpandAll,
    defaultExpandParent,
    defaultExpandedKeys
  } = _a2, props = __rest$2(_a2, ["defaultExpandAll", "defaultExpandParent", "defaultExpandedKeys"]);
  const lastSelectedKey = reactExports.useRef(null);
  const cachedSelectedKeys = reactExports.useRef(null);
  const getInitExpandedKeys = () => {
    const {
      keyEntities
    } = convertDataToEntities(getTreeData(props));
    let initExpandedKeys;
    if (defaultExpandAll) {
      initExpandedKeys = Object.keys(keyEntities);
    } else if (defaultExpandParent) {
      initExpandedKeys = conductExpandParent(props.expandedKeys || defaultExpandedKeys || [], keyEntities);
    } else {
      initExpandedKeys = props.expandedKeys || defaultExpandedKeys || [];
    }
    return initExpandedKeys;
  };
  const [selectedKeys, setSelectedKeys] = reactExports.useState(props.selectedKeys || props.defaultSelectedKeys || []);
  const [expandedKeys, setExpandedKeys] = reactExports.useState(() => getInitExpandedKeys());
  reactExports.useEffect(() => {
    if ("selectedKeys" in props) {
      setSelectedKeys(props.selectedKeys);
    }
  }, [props.selectedKeys]);
  reactExports.useEffect(() => {
    if ("expandedKeys" in props) {
      setExpandedKeys(props.expandedKeys);
    }
  }, [props.expandedKeys]);
  const onExpand = (keys2, info) => {
    var _a22;
    if (!("expandedKeys" in props)) {
      setExpandedKeys(keys2);
    }
    return (_a22 = props.onExpand) === null || _a22 === void 0 ? void 0 : _a22.call(props, keys2, info);
  };
  const onSelect = (keys2, event) => {
    var _a22;
    const {
      multiple,
      fieldNames
    } = props;
    const {
      node: node2,
      nativeEvent
    } = event;
    const {
      key = ""
    } = node2;
    const treeData = getTreeData(props);
    const newEvent = Object.assign(Object.assign({}, event), {
      selected: true
    });
    const ctrlPick = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.ctrlKey) || (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.metaKey);
    const shiftPick = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.shiftKey;
    let newSelectedKeys;
    if (multiple && ctrlPick) {
      newSelectedKeys = keys2;
      lastSelectedKey.current = key;
      cachedSelectedKeys.current = newSelectedKeys;
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    } else if (multiple && shiftPick) {
      newSelectedKeys = Array.from(new Set([].concat(_toConsumableArray(cachedSelectedKeys.current || []), _toConsumableArray(calcRangeKeys({
        treeData,
        expandedKeys,
        startKey: key,
        endKey: lastSelectedKey.current,
        fieldNames
      })))));
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    } else {
      newSelectedKeys = [key];
      lastSelectedKey.current = key;
      cachedSelectedKeys.current = newSelectedKeys;
      newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys, fieldNames);
    }
    (_a22 = props.onSelect) === null || _a22 === void 0 ? void 0 : _a22.call(props, newSelectedKeys, newEvent);
    if (!("selectedKeys" in props)) {
      setSelectedKeys(newSelectedKeys);
    }
  };
  const {
    getPrefixCls,
    direction
  } = reactExports.useContext(ConfigContext);
  const {
    prefixCls: customizePrefixCls,
    className,
    showIcon = true,
    expandAction = "click"
  } = props, otherProps = __rest$2(props, ["prefixCls", "className", "showIcon", "expandAction"]);
  const prefixCls = getPrefixCls("tree", customizePrefixCls);
  const connectClassName = classNames(`${prefixCls}-directory`, {
    [`${prefixCls}-directory-rtl`]: direction === "rtl"
  }, className);
  return /* @__PURE__ */ reactExports.createElement(Tree$1, Object.assign({
    icon: getIcon,
    ref,
    blockNode: true
  }, otherProps, {
    showIcon,
    expandAction,
    prefixCls,
    className: connectClassName,
    expandedKeys,
    selectedKeys,
    onSelect,
    onExpand
  }));
};
const ForwardDirectoryTree = /* @__PURE__ */ reactExports.forwardRef(DirectoryTree);
const Tree = Tree$1;
Tree.DirectoryTree = ForwardDirectoryTree;
Tree.TreeNode = TreeNode;
const getAlphaColor = (baseColor, alpha2) => new FastColor(baseColor).setA(alpha2).toRgbString();
const getSolidColor = (baseColor, brightness) => {
  const instance2 = new FastColor(baseColor);
  return instance2.lighten(brightness).toHexString();
};
const generateColorPalettes = (baseColor) => {
  const colors2 = generate$1(baseColor, {
    theme: "dark"
  });
  return {
    1: colors2[0],
    2: colors2[1],
    3: colors2[2],
    4: colors2[3],
    5: colors2[6],
    6: colors2[5],
    7: colors2[4],
    8: colors2[6],
    9: colors2[5],
    10: colors2[4]
    // 8: colors[9],
    // 9: colors[8],
    // 10: colors[7],
  };
};
const generateNeutralColorPalettes = (bgBaseColor, textBaseColor) => {
  const colorBgBase = bgBaseColor || "#000";
  const colorTextBase = textBaseColor || "#fff";
  return {
    colorBgBase,
    colorTextBase,
    colorText: getAlphaColor(colorTextBase, 0.85),
    colorTextSecondary: getAlphaColor(colorTextBase, 0.65),
    colorTextTertiary: getAlphaColor(colorTextBase, 0.45),
    colorTextQuaternary: getAlphaColor(colorTextBase, 0.25),
    colorFill: getAlphaColor(colorTextBase, 0.18),
    colorFillSecondary: getAlphaColor(colorTextBase, 0.12),
    colorFillTertiary: getAlphaColor(colorTextBase, 0.08),
    colorFillQuaternary: getAlphaColor(colorTextBase, 0.04),
    colorBgSolid: getAlphaColor(colorTextBase, 0.95),
    colorBgSolidHover: getAlphaColor(colorTextBase, 1),
    colorBgSolidActive: getAlphaColor(colorTextBase, 0.9),
    colorBgElevated: getSolidColor(colorBgBase, 12),
    colorBgContainer: getSolidColor(colorBgBase, 8),
    colorBgLayout: getSolidColor(colorBgBase, 0),
    colorBgSpotlight: getSolidColor(colorBgBase, 26),
    colorBgBlur: getAlphaColor(colorTextBase, 0.04),
    colorBorder: getSolidColor(colorBgBase, 26),
    colorBorderSecondary: getSolidColor(colorBgBase, 19)
  };
};
const derivative = (token2, mapToken) => {
  const colorPalettes = Object.keys(defaultPresetColors).map((colorKey) => {
    const colors2 = generate$1(token2[colorKey], {
      theme: "dark"
    });
    return Array.from({
      length: 10
    }, () => 1).reduce((prev2, _24, i2) => {
      prev2[`${colorKey}-${i2 + 1}`] = colors2[i2];
      prev2[`${colorKey}${i2 + 1}`] = colors2[i2];
      return prev2;
    }, {});
  }).reduce((prev2, cur) => {
    prev2 = Object.assign(Object.assign({}, prev2), cur);
    return prev2;
  }, {});
  const mergedMapToken = mapToken !== null && mapToken !== void 0 ? mapToken : derivative$1(token2);
  const colorMapToken = genColorMapToken(token2, {
    generateColorPalettes,
    generateNeutralColorPalettes
  });
  return Object.assign(Object.assign(Object.assign(Object.assign({}, mergedMapToken), colorPalettes), colorMapToken), {
    // Customize selected item background color
    // https://github.com/ant-design/ant-design/issues/30524#issuecomment-871961867
    colorPrimaryBg: colorMapToken.colorPrimaryBorder,
    colorPrimaryBgHover: colorMapToken.colorPrimaryBorderHover
  });
};
const theme = {
  /** Default seedToken */
  defaultSeed: defaultConfig.token,
  defaultAlgorithm: derivative$1,
  darkAlgorithm: derivative
};
var duration$1 = { exports: {} };
(function(module2, exports2) {
  !function(t2, s2) {
    module2.exports = s2();
  }(commonjsGlobal, function() {
    var t2, s2, n2 = 1e3, i2 = 6e4, e2 = 36e5, r2 = 864e5, o2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, u2 = 31536e6, d2 = 2628e6, a2 = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/, h3 = { years: u2, months: d2, days: r2, hours: e2, minutes: i2, seconds: n2, milliseconds: 1, weeks: 6048e5 }, c2 = function(t3) {
      return t3 instanceof g2;
    }, f2 = function(t3, s3, n3) {
      return new g2(t3, n3, s3.$l);
    }, m2 = function(t3) {
      return s2.p(t3) + "s";
    }, l2 = function(t3) {
      return t3 < 0;
    }, $ = function(t3) {
      return l2(t3) ? Math.ceil(t3) : Math.floor(t3);
    }, y2 = function(t3) {
      return Math.abs(t3);
    }, v2 = function(t3, s3) {
      return t3 ? l2(t3) ? { negative: true, format: "" + y2(t3) + s3 } : { negative: false, format: "" + t3 + s3 } : { negative: false, format: "" };
    }, g2 = function() {
      function l3(t3, s3, n3) {
        var i3 = this;
        if (this.$d = {}, this.$l = n3, void 0 === t3 && (this.$ms = 0, this.parseFromMilliseconds()), s3)
          return f2(t3 * h3[m2(s3)], this);
        if ("number" == typeof t3)
          return this.$ms = t3, this.parseFromMilliseconds(), this;
        if ("object" == typeof t3)
          return Object.keys(t3).forEach(function(s4) {
            i3.$d[m2(s4)] = t3[s4];
          }), this.calMilliseconds(), this;
        if ("string" == typeof t3) {
          var e3 = t3.match(a2);
          if (e3) {
            var r3 = e3.slice(2).map(function(t4) {
              return null != t4 ? Number(t4) : 0;
            });
            return this.$d.years = r3[0], this.$d.months = r3[1], this.$d.weeks = r3[2], this.$d.days = r3[3], this.$d.hours = r3[4], this.$d.minutes = r3[5], this.$d.seconds = r3[6], this.calMilliseconds(), this;
          }
        }
        return this;
      }
      var y3 = l3.prototype;
      return y3.calMilliseconds = function() {
        var t3 = this;
        this.$ms = Object.keys(this.$d).reduce(function(s3, n3) {
          return s3 + (t3.$d[n3] || 0) * h3[n3];
        }, 0);
      }, y3.parseFromMilliseconds = function() {
        var t3 = this.$ms;
        this.$d.years = $(t3 / u2), t3 %= u2, this.$d.months = $(t3 / d2), t3 %= d2, this.$d.days = $(t3 / r2), t3 %= r2, this.$d.hours = $(t3 / e2), t3 %= e2, this.$d.minutes = $(t3 / i2), t3 %= i2, this.$d.seconds = $(t3 / n2), t3 %= n2, this.$d.milliseconds = t3;
      }, y3.toISOString = function() {
        var t3 = v2(this.$d.years, "Y"), s3 = v2(this.$d.months, "M"), n3 = +this.$d.days || 0;
        this.$d.weeks && (n3 += 7 * this.$d.weeks);
        var i3 = v2(n3, "D"), e3 = v2(this.$d.hours, "H"), r3 = v2(this.$d.minutes, "M"), o3 = this.$d.seconds || 0;
        this.$d.milliseconds && (o3 += this.$d.milliseconds / 1e3, o3 = Math.round(1e3 * o3) / 1e3);
        var u3 = v2(o3, "S"), d3 = t3.negative || s3.negative || i3.negative || e3.negative || r3.negative || u3.negative, a3 = e3.format || r3.format || u3.format ? "T" : "", h4 = (d3 ? "-" : "") + "P" + t3.format + s3.format + i3.format + a3 + e3.format + r3.format + u3.format;
        return "P" === h4 || "-P" === h4 ? "P0D" : h4;
      }, y3.toJSON = function() {
        return this.toISOString();
      }, y3.format = function(t3) {
        var n3 = t3 || "YYYY-MM-DDTHH:mm:ss", i3 = { Y: this.$d.years, YY: s2.s(this.$d.years, 2, "0"), YYYY: s2.s(this.$d.years, 4, "0"), M: this.$d.months, MM: s2.s(this.$d.months, 2, "0"), D: this.$d.days, DD: s2.s(this.$d.days, 2, "0"), H: this.$d.hours, HH: s2.s(this.$d.hours, 2, "0"), m: this.$d.minutes, mm: s2.s(this.$d.minutes, 2, "0"), s: this.$d.seconds, ss: s2.s(this.$d.seconds, 2, "0"), SSS: s2.s(this.$d.milliseconds, 3, "0") };
        return n3.replace(o2, function(t4, s3) {
          return s3 || String(i3[t4]);
        });
      }, y3.as = function(t3) {
        return this.$ms / h3[m2(t3)];
      }, y3.get = function(t3) {
        var s3 = this.$ms, n3 = m2(t3);
        return "milliseconds" === n3 ? s3 %= 1e3 : s3 = "weeks" === n3 ? $(s3 / h3[n3]) : this.$d[n3], s3 || 0;
      }, y3.add = function(t3, s3, n3) {
        var i3;
        return i3 = s3 ? t3 * h3[m2(s3)] : c2(t3) ? t3.$ms : f2(t3, this).$ms, f2(this.$ms + i3 * (n3 ? -1 : 1), this);
      }, y3.subtract = function(t3, s3) {
        return this.add(t3, s3, true);
      }, y3.locale = function(t3) {
        var s3 = this.clone();
        return s3.$l = t3, s3;
      }, y3.clone = function() {
        return f2(this.$ms, this);
      }, y3.humanize = function(s3) {
        return t2().add(this.$ms, "ms").locale(this.$l).fromNow(!s3);
      }, y3.valueOf = function() {
        return this.asMilliseconds();
      }, y3.milliseconds = function() {
        return this.get("milliseconds");
      }, y3.asMilliseconds = function() {
        return this.as("milliseconds");
      }, y3.seconds = function() {
        return this.get("seconds");
      }, y3.asSeconds = function() {
        return this.as("seconds");
      }, y3.minutes = function() {
        return this.get("minutes");
      }, y3.asMinutes = function() {
        return this.as("minutes");
      }, y3.hours = function() {
        return this.get("hours");
      }, y3.asHours = function() {
        return this.as("hours");
      }, y3.days = function() {
        return this.get("days");
      }, y3.asDays = function() {
        return this.as("days");
      }, y3.weeks = function() {
        return this.get("weeks");
      }, y3.asWeeks = function() {
        return this.as("weeks");
      }, y3.months = function() {
        return this.get("months");
      }, y3.asMonths = function() {
        return this.as("months");
      }, y3.years = function() {
        return this.get("years");
      }, y3.asYears = function() {
        return this.as("years");
      }, l3;
    }(), p2 = function(t3, s3, n3) {
      return t3.add(s3.years() * n3, "y").add(s3.months() * n3, "M").add(s3.days() * n3, "d").add(s3.hours() * n3, "h").add(s3.minutes() * n3, "m").add(s3.seconds() * n3, "s").add(s3.milliseconds() * n3, "ms");
    };
    return function(n3, i3, e3) {
      t2 = e3, s2 = e3().$utils(), e3.duration = function(t3, s3) {
        var n4 = e3.locale();
        return f2(t3, { $l: n4 }, s3);
      }, e3.isDuration = c2;
      var r3 = i3.prototype.add, o3 = i3.prototype.subtract;
      i3.prototype.add = function(t3, s3) {
        return c2(t3) ? p2(this, t3, 1) : r3.bind(this)(t3, s3);
      }, i3.prototype.subtract = function(t3, s3) {
        return c2(t3) ? p2(this, t3, -1) : o3.bind(this)(t3, s3);
      };
    };
  });
})(duration$1);
var durationExports = duration$1.exports;
const duration = /* @__PURE__ */ getDefaultExportFromCjs(durationExports);
class HttpError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
   *
   * @param {string} errorMessage A descriptive error message.
   * @param {number} statusCode The HTTP status code represented by this error.
   */
  constructor(errorMessage, statusCode) {
    const trueProto = new.target.prototype;
    super(`${errorMessage}: Status code '${statusCode}'`);
    this.statusCode = statusCode;
    this.__proto__ = trueProto;
  }
}
class TimeoutError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.
   *
   * @param {string} errorMessage A descriptive error message.
   */
  constructor(errorMessage = "A timeout occurred.") {
    const trueProto = new.target.prototype;
    super(errorMessage);
    this.__proto__ = trueProto;
  }
}
class AbortError extends Error {
  /** Constructs a new instance of {@link AbortError}.
   *
   * @param {string} errorMessage A descriptive error message.
   */
  constructor(errorMessage = "An abort occurred.") {
    const trueProto = new.target.prototype;
    super(errorMessage);
    this.__proto__ = trueProto;
  }
}
class UnsupportedTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "UnsupportedTransportError";
    this.__proto__ = trueProto;
  }
}
class DisabledTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "DisabledTransportError";
    this.__proto__ = trueProto;
  }
}
class FailedToStartTransportError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.
   *
   * @param {string} message A descriptive error message.
   * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
   */
  constructor(message, transport) {
    const trueProto = new.target.prototype;
    super(message);
    this.transport = transport;
    this.errorType = "FailedToStartTransportError";
    this.__proto__ = trueProto;
  }
}
class FailedToNegotiateWithServerError extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.
   *
   * @param {string} message A descriptive error message.
   */
  constructor(message) {
    const trueProto = new.target.prototype;
    super(message);
    this.errorType = "FailedToNegotiateWithServerError";
    this.__proto__ = trueProto;
  }
}
class AggregateErrors extends Error {
  /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.
   *
   * @param {string} message A descriptive error message.
   * @param {Error[]} innerErrors The collection of errors this error is aggregating.
   */
  constructor(message, innerErrors) {
    const trueProto = new.target.prototype;
    super(message);
    this.innerErrors = innerErrors;
    this.__proto__ = trueProto;
  }
}
class HttpResponse {
  constructor(statusCode, statusText, content2) {
    this.statusCode = statusCode;
    this.statusText = statusText;
    this.content = content2;
  }
}
let HttpClient$1 = class HttpClient {
  get(url2, options) {
    return this.send({
      ...options,
      method: "GET",
      url: url2
    });
  }
  post(url2, options) {
    return this.send({
      ...options,
      method: "POST",
      url: url2
    });
  }
  delete(url2, options) {
    return this.send({
      ...options,
      method: "DELETE",
      url: url2
    });
  }
  /** Gets all cookies that apply to the specified URL.
   *
   * @param url The URL that the cookies are valid for.
   * @returns {string} A string containing all the key-value cookie pairs for the specified URL.
   */
  // @ts-ignore
  getCookieString(url2) {
    return "";
  }
};
var LogLevel$1;
(function(LogLevel2) {
  LogLevel2[LogLevel2["Trace"] = 0] = "Trace";
  LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
  LogLevel2[LogLevel2["Information"] = 2] = "Information";
  LogLevel2[LogLevel2["Warning"] = 3] = "Warning";
  LogLevel2[LogLevel2["Error"] = 4] = "Error";
  LogLevel2[LogLevel2["Critical"] = 5] = "Critical";
  LogLevel2[LogLevel2["None"] = 6] = "None";
})(LogLevel$1 || (LogLevel$1 = {}));
class NullLogger {
  constructor() {
  }
  /** @inheritDoc */
  // eslint-disable-next-line
  log(_logLevel, _message) {
  }
}
NullLogger.instance = new NullLogger();
const VERSION$2 = "7.0.14";
class Arg {
  static isRequired(val, name2) {
    if (val === null || val === void 0) {
      throw new Error(`The '${name2}' argument is required.`);
    }
  }
  static isNotEmpty(val, name2) {
    if (!val || val.match(/^\s*$/)) {
      throw new Error(`The '${name2}' argument should not be empty.`);
    }
  }
  static isIn(val, values, name2) {
    if (!(val in values)) {
      throw new Error(`Unknown ${name2} value: ${val}.`);
    }
  }
}
class Platform {
  // react-native has a window but no document so we should check both
  static get isBrowser() {
    return typeof window === "object" && typeof window.document === "object";
  }
  // WebWorkers don't have a window object so the isBrowser check would fail
  static get isWebWorker() {
    return typeof self === "object" && "importScripts" in self;
  }
  // react-native has a window but no document
  static get isReactNative() {
    return typeof window === "object" && typeof window.document === "undefined";
  }
  // Node apps shouldn't have a window object, but WebWorkers don't either
  // so we need to check for both WebWorker and window
  static get isNode() {
    return !this.isBrowser && !this.isWebWorker && !this.isReactNative;
  }
}
function getDataDetail(data, includeContent) {
  let detail = "";
  if (isArrayBuffer$1(data)) {
    detail = `Binary data of length ${data.byteLength}`;
    if (includeContent) {
      detail += `. Content: '${formatArrayBuffer(data)}'`;
    }
  } else if (typeof data === "string") {
    detail = `String data of length ${data.length}`;
    if (includeContent) {
      detail += `. Content: '${data}'`;
    }
  }
  return detail;
}
function formatArrayBuffer(data) {
  const view = new Uint8Array(data);
  let str = "";
  view.forEach((num) => {
    const pad = num < 16 ? "0" : "";
    str += `0x${pad}${num.toString(16)} `;
  });
  return str.substr(0, str.length - 1);
}
function isArrayBuffer$1(val) {
  return val && typeof ArrayBuffer !== "undefined" && (val instanceof ArrayBuffer || // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof
  val.constructor && val.constructor.name === "ArrayBuffer");
}
async function sendMessage(logger, transportName, httpClient, url2, content2, options) {
  const headers = {};
  const [name2, value2] = getUserAgentHeader();
  headers[name2] = value2;
  logger.log(LogLevel$1.Trace, `(${transportName} transport) sending data. ${getDataDetail(content2, options.logMessageContent)}.`);
  const responseType = isArrayBuffer$1(content2) ? "arraybuffer" : "text";
  const response = await httpClient.post(url2, {
    content: content2,
    headers: { ...headers, ...options.headers },
    responseType,
    timeout: options.timeout,
    withCredentials: options.withCredentials
  });
  logger.log(LogLevel$1.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`);
}
function createLogger(logger) {
  if (logger === void 0) {
    return new ConsoleLogger(LogLevel$1.Information);
  }
  if (logger === null) {
    return NullLogger.instance;
  }
  if (logger.log !== void 0) {
    return logger;
  }
  return new ConsoleLogger(logger);
}
class SubjectSubscription {
  constructor(subject, observer) {
    this._subject = subject;
    this._observer = observer;
  }
  dispose() {
    const index2 = this._subject.observers.indexOf(this._observer);
    if (index2 > -1) {
      this._subject.observers.splice(index2, 1);
    }
    if (this._subject.observers.length === 0 && this._subject.cancelCallback) {
      this._subject.cancelCallback().catch((_24) => {
      });
    }
  }
}
class ConsoleLogger {
  constructor(minimumLogLevel) {
    this._minLevel = minimumLogLevel;
    this.out = console;
  }
  log(logLevel, message) {
    if (logLevel >= this._minLevel) {
      const msg = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${LogLevel$1[logLevel]}: ${message}`;
      switch (logLevel) {
        case LogLevel$1.Critical:
        case LogLevel$1.Error:
          this.out.error(msg);
          break;
        case LogLevel$1.Warning:
          this.out.warn(msg);
          break;
        case LogLevel$1.Information:
          this.out.info(msg);
          break;
        default:
          this.out.log(msg);
          break;
      }
    }
  }
}
function getUserAgentHeader() {
  let userAgentHeaderName = "X-SignalR-User-Agent";
  if (Platform.isNode) {
    userAgentHeaderName = "User-Agent";
  }
  return [userAgentHeaderName, constructUserAgent(VERSION$2, getOsName(), getRuntime(), getRuntimeVersion())];
}
function constructUserAgent(version2, os, runtime, runtimeVersion) {
  let userAgent = "Microsoft SignalR/";
  const majorAndMinor = version2.split(".");
  userAgent += `${majorAndMinor[0]}.${majorAndMinor[1]}`;
  userAgent += ` (${version2}; `;
  if (os && os !== "") {
    userAgent += `${os}; `;
  } else {
    userAgent += "Unknown OS; ";
  }
  userAgent += `${runtime}`;
  if (runtimeVersion) {
    userAgent += `; ${runtimeVersion}`;
  } else {
    userAgent += "; Unknown Runtime Version";
  }
  userAgent += ")";
  return userAgent;
}
function getOsName() {
  if (Platform.isNode) {
    switch (process.platform) {
      case "win32":
        return "Windows NT";
      case "darwin":
        return "macOS";
      case "linux":
        return "Linux";
      default:
        return process.platform;
    }
  } else {
    return "";
  }
}
function getRuntimeVersion() {
  if (Platform.isNode) {
    return process.versions.node;
  }
  return void 0;
}
function getRuntime() {
  if (Platform.isNode) {
    return "NodeJS";
  } else {
    return "Browser";
  }
}
function getErrorString(e2) {
  if (e2.stack) {
    return e2.stack;
  } else if (e2.message) {
    return e2.message;
  }
  return `${e2}`;
}
function getGlobalThis() {
  if (typeof globalThis !== "undefined") {
    return globalThis;
  }
  if (typeof self !== "undefined") {
    return self;
  }
  if (typeof window !== "undefined") {
    return window;
  }
  if (typeof global !== "undefined") {
    return global;
  }
  throw new Error("could not find global");
}
class FetchHttpClient extends HttpClient$1 {
  constructor(logger) {
    super();
    this._logger = logger;
    if (typeof fetch === "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      this._jar = new (requireFunc("tough-cookie")).CookieJar();
      this._fetchType = requireFunc("node-fetch");
      this._fetchType = requireFunc("fetch-cookie")(this._fetchType, this._jar);
    } else {
      this._fetchType = fetch.bind(getGlobalThis());
    }
    if (typeof AbortController === "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      this._abortControllerType = requireFunc("abort-controller");
    } else {
      this._abortControllerType = AbortController;
    }
  }
  /** @inheritDoc */
  async send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      throw new AbortError();
    }
    if (!request2.method) {
      throw new Error("No method defined.");
    }
    if (!request2.url) {
      throw new Error("No url defined.");
    }
    const abortController = new this._abortControllerType();
    let error2;
    if (request2.abortSignal) {
      request2.abortSignal.onabort = () => {
        abortController.abort();
        error2 = new AbortError();
      };
    }
    let timeoutId = null;
    if (request2.timeout) {
      const msTimeout = request2.timeout;
      timeoutId = setTimeout(() => {
        abortController.abort();
        this._logger.log(LogLevel$1.Warning, `Timeout from HTTP request.`);
        error2 = new TimeoutError();
      }, msTimeout);
    }
    if (request2.content === "") {
      request2.content = void 0;
    }
    if (request2.content) {
      request2.headers = request2.headers || {};
      if (isArrayBuffer$1(request2.content)) {
        request2.headers["Content-Type"] = "application/octet-stream";
      } else {
        request2.headers["Content-Type"] = "text/plain;charset=UTF-8";
      }
    }
    let response;
    try {
      response = await this._fetchType(request2.url, {
        body: request2.content,
        cache: "no-cache",
        credentials: request2.withCredentials === true ? "include" : "same-origin",
        headers: {
          "X-Requested-With": "XMLHttpRequest",
          ...request2.headers
        },
        method: request2.method,
        mode: "cors",
        redirect: "follow",
        signal: abortController.signal
      });
    } catch (e2) {
      if (error2) {
        throw error2;
      }
      this._logger.log(LogLevel$1.Warning, `Error from HTTP request. ${e2}.`);
      throw e2;
    } finally {
      if (timeoutId) {
        clearTimeout(timeoutId);
      }
      if (request2.abortSignal) {
        request2.abortSignal.onabort = null;
      }
    }
    if (!response.ok) {
      const errorMessage = await deserializeContent(response, "text");
      throw new HttpError(errorMessage || response.statusText, response.status);
    }
    const content2 = deserializeContent(response, request2.responseType);
    const payload = await content2;
    return new HttpResponse(response.status, response.statusText, payload);
  }
  getCookieString(url2) {
    let cookies2 = "";
    if (Platform.isNode && this._jar) {
      this._jar.getCookies(url2, (e2, c2) => cookies2 = c2.join("; "));
    }
    return cookies2;
  }
}
function deserializeContent(response, responseType) {
  let content2;
  switch (responseType) {
    case "arraybuffer":
      content2 = response.arrayBuffer();
      break;
    case "text":
      content2 = response.text();
      break;
    case "blob":
    case "document":
    case "json":
      throw new Error(`${responseType} is not supported.`);
    default:
      content2 = response.text();
      break;
  }
  return content2;
}
class XhrHttpClient extends HttpClient$1 {
  constructor(logger) {
    super();
    this._logger = logger;
  }
  /** @inheritDoc */
  send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      return Promise.reject(new AbortError());
    }
    if (!request2.method) {
      return Promise.reject(new Error("No method defined."));
    }
    if (!request2.url) {
      return Promise.reject(new Error("No url defined."));
    }
    return new Promise((resolve2, reject) => {
      const xhr = new XMLHttpRequest();
      xhr.open(request2.method, request2.url, true);
      xhr.withCredentials = request2.withCredentials === void 0 ? true : request2.withCredentials;
      xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
      if (request2.content === "") {
        request2.content = void 0;
      }
      if (request2.content) {
        if (isArrayBuffer$1(request2.content)) {
          xhr.setRequestHeader("Content-Type", "application/octet-stream");
        } else {
          xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
        }
      }
      const headers = request2.headers;
      if (headers) {
        Object.keys(headers).forEach((header) => {
          xhr.setRequestHeader(header, headers[header]);
        });
      }
      if (request2.responseType) {
        xhr.responseType = request2.responseType;
      }
      if (request2.abortSignal) {
        request2.abortSignal.onabort = () => {
          xhr.abort();
          reject(new AbortError());
        };
      }
      if (request2.timeout) {
        xhr.timeout = request2.timeout;
      }
      xhr.onload = () => {
        if (request2.abortSignal) {
          request2.abortSignal.onabort = null;
        }
        if (xhr.status >= 200 && xhr.status < 300) {
          resolve2(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));
        } else {
          reject(new HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));
        }
      };
      xhr.onerror = () => {
        this._logger.log(LogLevel$1.Warning, `Error from HTTP request. ${xhr.status}: ${xhr.statusText}.`);
        reject(new HttpError(xhr.statusText, xhr.status));
      };
      xhr.ontimeout = () => {
        this._logger.log(LogLevel$1.Warning, `Timeout from HTTP request.`);
        reject(new TimeoutError());
      };
      xhr.send(request2.content);
    });
  }
}
class DefaultHttpClient extends HttpClient$1 {
  /** Creates a new instance of the {@link @microsoft/signalr.DefaultHttpClient}, using the provided {@link @microsoft/signalr.ILogger} to log messages. */
  constructor(logger) {
    super();
    if (typeof fetch !== "undefined" || Platform.isNode) {
      this._httpClient = new FetchHttpClient(logger);
    } else if (typeof XMLHttpRequest !== "undefined") {
      this._httpClient = new XhrHttpClient(logger);
    } else {
      throw new Error("No usable HttpClient found.");
    }
  }
  /** @inheritDoc */
  send(request2) {
    if (request2.abortSignal && request2.abortSignal.aborted) {
      return Promise.reject(new AbortError());
    }
    if (!request2.method) {
      return Promise.reject(new Error("No method defined."));
    }
    if (!request2.url) {
      return Promise.reject(new Error("No url defined."));
    }
    return this._httpClient.send(request2);
  }
  getCookieString(url2) {
    return this._httpClient.getCookieString(url2);
  }
}
class TextMessageFormat {
  static write(output2) {
    return `${output2}${TextMessageFormat.RecordSeparator}`;
  }
  static parse(input2) {
    if (input2[input2.length - 1] !== TextMessageFormat.RecordSeparator) {
      throw new Error("Message is incomplete.");
    }
    const messages2 = input2.split(TextMessageFormat.RecordSeparator);
    messages2.pop();
    return messages2;
  }
}
TextMessageFormat.RecordSeparatorCode = 30;
TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
class HandshakeProtocol {
  // Handshake request is always JSON
  writeHandshakeRequest(handshakeRequest) {
    return TextMessageFormat.write(JSON.stringify(handshakeRequest));
  }
  parseHandshakeResponse(data) {
    let messageData;
    let remainingData;
    if (isArrayBuffer$1(data)) {
      const binaryData = new Uint8Array(data);
      const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);
      if (separatorIndex === -1) {
        throw new Error("Message is incomplete.");
      }
      const responseLength = separatorIndex + 1;
      messageData = String.fromCharCode.apply(null, Array.prototype.slice.call(binaryData.slice(0, responseLength)));
      remainingData = binaryData.byteLength > responseLength ? binaryData.slice(responseLength).buffer : null;
    } else {
      const textData = data;
      const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);
      if (separatorIndex === -1) {
        throw new Error("Message is incomplete.");
      }
      const responseLength = separatorIndex + 1;
      messageData = textData.substring(0, responseLength);
      remainingData = textData.length > responseLength ? textData.substring(responseLength) : null;
    }
    const messages2 = TextMessageFormat.parse(messageData);
    const response = JSON.parse(messages2[0]);
    if (response.type) {
      throw new Error("Expected a handshake response from the server.");
    }
    const responseMessage = response;
    return [remainingData, responseMessage];
  }
}
var MessageType;
(function(MessageType2) {
  MessageType2[MessageType2["Invocation"] = 1] = "Invocation";
  MessageType2[MessageType2["StreamItem"] = 2] = "StreamItem";
  MessageType2[MessageType2["Completion"] = 3] = "Completion";
  MessageType2[MessageType2["StreamInvocation"] = 4] = "StreamInvocation";
  MessageType2[MessageType2["CancelInvocation"] = 5] = "CancelInvocation";
  MessageType2[MessageType2["Ping"] = 6] = "Ping";
  MessageType2[MessageType2["Close"] = 7] = "Close";
})(MessageType || (MessageType = {}));
class Subject {
  constructor() {
    this.observers = [];
  }
  next(item) {
    for (const observer of this.observers) {
      observer.next(item);
    }
  }
  error(err) {
    for (const observer of this.observers) {
      if (observer.error) {
        observer.error(err);
      }
    }
  }
  complete() {
    for (const observer of this.observers) {
      if (observer.complete) {
        observer.complete();
      }
    }
  }
  subscribe(observer) {
    this.observers.push(observer);
    return new SubjectSubscription(this, observer);
  }
}
const DEFAULT_TIMEOUT_IN_MS = 30 * 1e3;
const DEFAULT_PING_INTERVAL_IN_MS = 15 * 1e3;
var HubConnectionState;
(function(HubConnectionState2) {
  HubConnectionState2["Disconnected"] = "Disconnected";
  HubConnectionState2["Connecting"] = "Connecting";
  HubConnectionState2["Connected"] = "Connected";
  HubConnectionState2["Disconnecting"] = "Disconnecting";
  HubConnectionState2["Reconnecting"] = "Reconnecting";
})(HubConnectionState || (HubConnectionState = {}));
class HubConnection {
  constructor(connection, logger, protocol, reconnectPolicy) {
    this._nextKeepAlive = 0;
    this._freezeEventListener = () => {
      this._logger.log(LogLevel$1.Warning, "The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep");
    };
    Arg.isRequired(connection, "connection");
    Arg.isRequired(logger, "logger");
    Arg.isRequired(protocol, "protocol");
    this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;
    this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;
    this._logger = logger;
    this._protocol = protocol;
    this.connection = connection;
    this._reconnectPolicy = reconnectPolicy;
    this._handshakeProtocol = new HandshakeProtocol();
    this.connection.onreceive = (data) => this._processIncomingData(data);
    this.connection.onclose = (error2) => this._connectionClosed(error2);
    this._callbacks = {};
    this._methods = {};
    this._closedCallbacks = [];
    this._reconnectingCallbacks = [];
    this._reconnectedCallbacks = [];
    this._invocationId = 0;
    this._receivedHandshakeResponse = false;
    this._connectionState = HubConnectionState.Disconnected;
    this._connectionStarted = false;
    this._cachedPingMessage = this._protocol.writeMessage({ type: MessageType.Ping });
  }
  /** @internal */
  // Using a public static factory method means we can have a private constructor and an _internal_
  // create method that can be used by HubConnectionBuilder. An "internal" constructor would just
  // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a
  // public parameter-less constructor.
  static create(connection, logger, protocol, reconnectPolicy) {
    return new HubConnection(connection, logger, protocol, reconnectPolicy);
  }
  /** Indicates the state of the {@link HubConnection} to the server. */
  get state() {
    return this._connectionState;
  }
  /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either
   *  in the disconnected state or if the negotiation step was skipped.
   */
  get connectionId() {
    return this.connection ? this.connection.connectionId || null : null;
  }
  /** Indicates the url of the {@link HubConnection} to the server. */
  get baseUrl() {
    return this.connection.baseUrl || "";
  }
  /**
   * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or
   * Reconnecting states.
   * @param {string} url The url to connect to.
   */
  set baseUrl(url2) {
    if (this._connectionState !== HubConnectionState.Disconnected && this._connectionState !== HubConnectionState.Reconnecting) {
      throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");
    }
    if (!url2) {
      throw new Error("The HubConnection url must be a valid url.");
    }
    this.connection.baseUrl = url2;
  }
  /** Starts the connection.
   *
   * @returns {Promise<void>} A Promise that resolves when the connection has been successfully established, or rejects with an error.
   */
  start() {
    this._startPromise = this._startWithStateTransitions();
    return this._startPromise;
  }
  async _startWithStateTransitions() {
    if (this._connectionState !== HubConnectionState.Disconnected) {
      return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));
    }
    this._connectionState = HubConnectionState.Connecting;
    this._logger.log(LogLevel$1.Debug, "Starting HubConnection.");
    try {
      await this._startInternal();
      if (Platform.isBrowser) {
        window.document.addEventListener("freeze", this._freezeEventListener);
      }
      this._connectionState = HubConnectionState.Connected;
      this._connectionStarted = true;
      this._logger.log(LogLevel$1.Debug, "HubConnection connected successfully.");
    } catch (e2) {
      this._connectionState = HubConnectionState.Disconnected;
      this._logger.log(LogLevel$1.Debug, `HubConnection failed to start successfully because of error '${e2}'.`);
      return Promise.reject(e2);
    }
  }
  async _startInternal() {
    this._stopDuringStartError = void 0;
    this._receivedHandshakeResponse = false;
    const handshakePromise = new Promise((resolve2, reject) => {
      this._handshakeResolver = resolve2;
      this._handshakeRejecter = reject;
    });
    await this.connection.start(this._protocol.transferFormat);
    try {
      const handshakeRequest = {
        protocol: this._protocol.name,
        version: this._protocol.version
      };
      this._logger.log(LogLevel$1.Debug, "Sending handshake request.");
      await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(handshakeRequest));
      this._logger.log(LogLevel$1.Information, `Using HubProtocol '${this._protocol.name}'.`);
      this._cleanupTimeout();
      this._resetTimeoutPeriod();
      this._resetKeepAliveInterval();
      await handshakePromise;
      if (this._stopDuringStartError) {
        throw this._stopDuringStartError;
      }
      if (!this.connection.features.inherentKeepAlive) {
        await this._sendMessage(this._cachedPingMessage);
      }
    } catch (e2) {
      this._logger.log(LogLevel$1.Debug, `Hub handshake failed with error '${e2}' during start(). Stopping HubConnection.`);
      this._cleanupTimeout();
      this._cleanupPingTimer();
      await this.connection.stop(e2);
      throw e2;
    }
  }
  /** Stops the connection.
   *
   * @returns {Promise<void>} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.
   */
  async stop() {
    const startPromise = this._startPromise;
    this._stopPromise = this._stopInternal();
    await this._stopPromise;
    try {
      await startPromise;
    } catch (e2) {
    }
  }
  _stopInternal(error2) {
    if (this._connectionState === HubConnectionState.Disconnected) {
      this._logger.log(LogLevel$1.Debug, `Call to HubConnection.stop(${error2}) ignored because it is already in the disconnected state.`);
      return Promise.resolve();
    }
    if (this._connectionState === HubConnectionState.Disconnecting) {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnecting state.`);
      return this._stopPromise;
    }
    this._connectionState = HubConnectionState.Disconnecting;
    this._logger.log(LogLevel$1.Debug, "Stopping HubConnection.");
    if (this._reconnectDelayHandle) {
      this._logger.log(LogLevel$1.Debug, "Connection stopped during reconnect delay. Done reconnecting.");
      clearTimeout(this._reconnectDelayHandle);
      this._reconnectDelayHandle = void 0;
      this._completeClose();
      return Promise.resolve();
    }
    this._cleanupTimeout();
    this._cleanupPingTimer();
    this._stopDuringStartError = error2 || new AbortError("The connection was stopped before the hub handshake could complete.");
    return this.connection.stop(error2);
  }
  /** Invokes a streaming hub method on the server using the specified name and arguments.
   *
   * @typeparam T The type of the items returned by the server.
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {IStreamResult<T>} An object that yields results from the server as they are received.
   */
  stream(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const invocationDescriptor = this._createStreamInvocation(methodName, args, streamIds);
    let promiseQueue;
    const subject = new Subject();
    subject.cancelCallback = () => {
      const cancelInvocation = this._createCancelInvocation(invocationDescriptor.invocationId);
      delete this._callbacks[invocationDescriptor.invocationId];
      return promiseQueue.then(() => {
        return this._sendWithProtocol(cancelInvocation);
      });
    };
    this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error2) => {
      if (error2) {
        subject.error(error2);
        return;
      } else if (invocationEvent) {
        if (invocationEvent.type === MessageType.Completion) {
          if (invocationEvent.error) {
            subject.error(new Error(invocationEvent.error));
          } else {
            subject.complete();
          }
        } else {
          subject.next(invocationEvent.item);
        }
      }
    };
    promiseQueue = this._sendWithProtocol(invocationDescriptor).catch((e2) => {
      subject.error(e2);
      delete this._callbacks[invocationDescriptor.invocationId];
    });
    this._launchStreams(streams, promiseQueue);
    return subject;
  }
  _sendMessage(message) {
    this._resetKeepAliveInterval();
    return this.connection.send(message);
  }
  /**
   * Sends a js object to the server.
   * @param message The js object to serialize and send.
   */
  _sendWithProtocol(message) {
    return this._sendMessage(this._protocol.writeMessage(message));
  }
  /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
   *
   * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still
   * be processing the invocation.
   *
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {Promise<void>} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.
   */
  send(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const sendPromise = this._sendWithProtocol(this._createInvocation(methodName, args, true, streamIds));
    this._launchStreams(streams, sendPromise);
    return sendPromise;
  }
  /** Invokes a hub method on the server using the specified name and arguments.
   *
   * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise
   * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of
   * resolving the Promise.
   *
   * @typeparam T The expected return type.
   * @param {string} methodName The name of the server method to invoke.
   * @param {any[]} args The arguments used to invoke the server method.
   * @returns {Promise<T>} A Promise that resolves with the result of the server method (if any), or rejects with an error.
   */
  invoke(methodName, ...args) {
    const [streams, streamIds] = this._replaceStreamingParams(args);
    const invocationDescriptor = this._createInvocation(methodName, args, false, streamIds);
    const p2 = new Promise((resolve2, reject) => {
      this._callbacks[invocationDescriptor.invocationId] = (invocationEvent, error2) => {
        if (error2) {
          reject(error2);
          return;
        } else if (invocationEvent) {
          if (invocationEvent.type === MessageType.Completion) {
            if (invocationEvent.error) {
              reject(new Error(invocationEvent.error));
            } else {
              resolve2(invocationEvent.result);
            }
          } else {
            reject(new Error(`Unexpected message type: ${invocationEvent.type}`));
          }
        }
      };
      const promiseQueue = this._sendWithProtocol(invocationDescriptor).catch((e2) => {
        reject(e2);
        delete this._callbacks[invocationDescriptor.invocationId];
      });
      this._launchStreams(streams, promiseQueue);
    });
    return p2;
  }
  on(methodName, newMethod) {
    if (!methodName || !newMethod) {
      return;
    }
    methodName = methodName.toLowerCase();
    if (!this._methods[methodName]) {
      this._methods[methodName] = [];
    }
    if (this._methods[methodName].indexOf(newMethod) !== -1) {
      return;
    }
    this._methods[methodName].push(newMethod);
  }
  off(methodName, method4) {
    if (!methodName) {
      return;
    }
    methodName = methodName.toLowerCase();
    const handlers2 = this._methods[methodName];
    if (!handlers2) {
      return;
    }
    if (method4) {
      const removeIdx = handlers2.indexOf(method4);
      if (removeIdx !== -1) {
        handlers2.splice(removeIdx, 1);
        if (handlers2.length === 0) {
          delete this._methods[methodName];
        }
      }
    } else {
      delete this._methods[methodName];
    }
  }
  /** Registers a handler that will be invoked when the connection is closed.
   *
   * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
   */
  onclose(callback2) {
    if (callback2) {
      this._closedCallbacks.push(callback2);
    }
  }
  /** Registers a handler that will be invoked when the connection starts reconnecting.
   *
   * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).
   */
  onreconnecting(callback2) {
    if (callback2) {
      this._reconnectingCallbacks.push(callback2);
    }
  }
  /** Registers a handler that will be invoked when the connection successfully reconnects.
   *
   * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.
   */
  onreconnected(callback2) {
    if (callback2) {
      this._reconnectedCallbacks.push(callback2);
    }
  }
  _processIncomingData(data) {
    this._cleanupTimeout();
    if (!this._receivedHandshakeResponse) {
      data = this._processHandshakeResponse(data);
      this._receivedHandshakeResponse = true;
    }
    if (data) {
      const messages2 = this._protocol.parseMessages(data, this._logger);
      for (const message of messages2) {
        switch (message.type) {
          case MessageType.Invocation:
            this._invokeClientMethod(message);
            break;
          case MessageType.StreamItem:
          case MessageType.Completion: {
            const callback2 = this._callbacks[message.invocationId];
            if (callback2) {
              if (message.type === MessageType.Completion) {
                delete this._callbacks[message.invocationId];
              }
              try {
                callback2(message);
              } catch (e2) {
                this._logger.log(LogLevel$1.Error, `Stream callback threw error: ${getErrorString(e2)}`);
              }
            }
            break;
          }
          case MessageType.Ping:
            break;
          case MessageType.Close: {
            this._logger.log(LogLevel$1.Information, "Close message received from server.");
            const error2 = message.error ? new Error("Server returned an error on close: " + message.error) : void 0;
            if (message.allowReconnect === true) {
              this.connection.stop(error2);
            } else {
              this._stopPromise = this._stopInternal(error2);
            }
            break;
          }
          default:
            this._logger.log(LogLevel$1.Warning, `Invalid message type: ${message.type}.`);
            break;
        }
      }
    }
    this._resetTimeoutPeriod();
  }
  _processHandshakeResponse(data) {
    let responseMessage;
    let remainingData;
    try {
      [remainingData, responseMessage] = this._handshakeProtocol.parseHandshakeResponse(data);
    } catch (e2) {
      const message = "Error parsing handshake response: " + e2;
      this._logger.log(LogLevel$1.Error, message);
      const error2 = new Error(message);
      this._handshakeRejecter(error2);
      throw error2;
    }
    if (responseMessage.error) {
      const message = "Server returned handshake error: " + responseMessage.error;
      this._logger.log(LogLevel$1.Error, message);
      const error2 = new Error(message);
      this._handshakeRejecter(error2);
      throw error2;
    } else {
      this._logger.log(LogLevel$1.Debug, "Server handshake complete.");
    }
    this._handshakeResolver();
    return remainingData;
  }
  _resetKeepAliveInterval() {
    if (this.connection.features.inherentKeepAlive) {
      return;
    }
    this._nextKeepAlive = (/* @__PURE__ */ new Date()).getTime() + this.keepAliveIntervalInMilliseconds;
    this._cleanupPingTimer();
  }
  _resetTimeoutPeriod() {
    if (!this.connection.features || !this.connection.features.inherentKeepAlive) {
      this._timeoutHandle = setTimeout(() => this.serverTimeout(), this.serverTimeoutInMilliseconds);
      if (this._pingServerHandle === void 0) {
        let nextPing = this._nextKeepAlive - (/* @__PURE__ */ new Date()).getTime();
        if (nextPing < 0) {
          nextPing = 0;
        }
        this._pingServerHandle = setTimeout(async () => {
          if (this._connectionState === HubConnectionState.Connected) {
            try {
              await this._sendMessage(this._cachedPingMessage);
            } catch {
              this._cleanupPingTimer();
            }
          }
        }, nextPing);
      }
    }
  }
  // eslint-disable-next-line @typescript-eslint/naming-convention
  serverTimeout() {
    this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
  }
  async _invokeClientMethod(invocationMessage) {
    const methodName = invocationMessage.target.toLowerCase();
    const methods = this._methods[methodName];
    if (!methods) {
      this._logger.log(LogLevel$1.Warning, `No client method with the name '${methodName}' found.`);
      if (invocationMessage.invocationId) {
        this._logger.log(LogLevel$1.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);
        await this._sendWithProtocol(this._createCompletionMessage(invocationMessage.invocationId, "Client didn't provide a result.", null));
      }
      return;
    }
    const methodsCopy = methods.slice();
    const expectsResponse = invocationMessage.invocationId ? true : false;
    let res;
    let exception;
    let completionMessage;
    for (const m2 of methodsCopy) {
      try {
        const prevRes = res;
        res = await m2.apply(this, invocationMessage.arguments);
        if (expectsResponse && res && prevRes) {
          this._logger.log(LogLevel$1.Error, `Multiple results provided for '${methodName}'. Sending error to server.`);
          completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `Client provided multiple results.`, null);
        }
        exception = void 0;
      } catch (e2) {
        exception = e2;
        this._logger.log(LogLevel$1.Error, `A callback for the method '${methodName}' threw error '${e2}'.`);
      }
    }
    if (completionMessage) {
      await this._sendWithProtocol(completionMessage);
    } else if (expectsResponse) {
      if (exception) {
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, `${exception}`, null);
      } else if (res !== void 0) {
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, null, res);
      } else {
        this._logger.log(LogLevel$1.Warning, `No result given for '${methodName}' method and invocation ID '${invocationMessage.invocationId}'.`);
        completionMessage = this._createCompletionMessage(invocationMessage.invocationId, "Client didn't provide a result.", null);
      }
      await this._sendWithProtocol(completionMessage);
    } else {
      if (res) {
        this._logger.log(LogLevel$1.Error, `Result given for '${methodName}' method but server is not expecting a result.`);
      }
    }
  }
  _connectionClosed(error2) {
    this._logger.log(LogLevel$1.Debug, `HubConnection.connectionClosed(${error2}) called while in state ${this._connectionState}.`);
    this._stopDuringStartError = this._stopDuringStartError || error2 || new AbortError("The underlying connection was closed before the hub handshake could complete.");
    if (this._handshakeResolver) {
      this._handshakeResolver();
    }
    this._cancelCallbacksWithError(error2 || new Error("Invocation canceled due to the underlying connection being closed."));
    this._cleanupTimeout();
    this._cleanupPingTimer();
    if (this._connectionState === HubConnectionState.Disconnecting) {
      this._completeClose(error2);
    } else if (this._connectionState === HubConnectionState.Connected && this._reconnectPolicy) {
      this._reconnect(error2);
    } else if (this._connectionState === HubConnectionState.Connected) {
      this._completeClose(error2);
    }
  }
  _completeClose(error2) {
    if (this._connectionStarted) {
      this._connectionState = HubConnectionState.Disconnected;
      this._connectionStarted = false;
      if (Platform.isBrowser) {
        window.document.removeEventListener("freeze", this._freezeEventListener);
      }
      try {
        this._closedCallbacks.forEach((c2) => c2.apply(this, [error2]));
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `An onclose callback called with error '${error2}' threw error '${e2}'.`);
      }
    }
  }
  async _reconnect(error2) {
    const reconnectStartTime = Date.now();
    let previousReconnectAttempts = 0;
    let retryError = error2 !== void 0 ? error2 : new Error("Attempting to reconnect due to a unknown error.");
    let nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, 0, retryError);
    if (nextRetryDelay === null) {
      this._logger.log(LogLevel$1.Debug, "Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.");
      this._completeClose(error2);
      return;
    }
    this._connectionState = HubConnectionState.Reconnecting;
    if (error2) {
      this._logger.log(LogLevel$1.Information, `Connection reconnecting because of error '${error2}'.`);
    } else {
      this._logger.log(LogLevel$1.Information, "Connection reconnecting.");
    }
    if (this._reconnectingCallbacks.length !== 0) {
      try {
        this._reconnectingCallbacks.forEach((c2) => c2.apply(this, [error2]));
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `An onreconnecting callback called with error '${error2}' threw error '${e2}'.`);
      }
      if (this._connectionState !== HubConnectionState.Reconnecting) {
        this._logger.log(LogLevel$1.Debug, "Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");
        return;
      }
    }
    while (nextRetryDelay !== null) {
      this._logger.log(LogLevel$1.Information, `Reconnect attempt number ${previousReconnectAttempts} will start in ${nextRetryDelay} ms.`);
      await new Promise((resolve2) => {
        this._reconnectDelayHandle = setTimeout(resolve2, nextRetryDelay);
      });
      this._reconnectDelayHandle = void 0;
      if (this._connectionState !== HubConnectionState.Reconnecting) {
        this._logger.log(LogLevel$1.Debug, "Connection left the reconnecting state during reconnect delay. Done reconnecting.");
        return;
      }
      try {
        await this._startInternal();
        this._connectionState = HubConnectionState.Connected;
        this._logger.log(LogLevel$1.Information, "HubConnection reconnected successfully.");
        if (this._reconnectedCallbacks.length !== 0) {
          try {
            this._reconnectedCallbacks.forEach((c2) => c2.apply(this, [this.connection.connectionId]));
          } catch (e2) {
            this._logger.log(LogLevel$1.Error, `An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${e2}'.`);
          }
        }
        return;
      } catch (e2) {
        this._logger.log(LogLevel$1.Information, `Reconnect attempt failed because of error '${e2}'.`);
        if (this._connectionState !== HubConnectionState.Reconnecting) {
          this._logger.log(LogLevel$1.Debug, `Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`);
          if (this._connectionState === HubConnectionState.Disconnecting) {
            this._completeClose();
          }
          return;
        }
        retryError = e2 instanceof Error ? e2 : new Error(e2.toString());
        nextRetryDelay = this._getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);
      }
    }
    this._logger.log(LogLevel$1.Information, `Reconnect retries have been exhausted after ${Date.now() - reconnectStartTime} ms and ${previousReconnectAttempts} failed attempts. Connection disconnecting.`);
    this._completeClose();
  }
  _getNextRetryDelay(previousRetryCount, elapsedMilliseconds, retryReason) {
    try {
      return this._reconnectPolicy.nextRetryDelayInMilliseconds({
        elapsedMilliseconds,
        previousRetryCount,
        retryReason
      });
    } catch (e2) {
      this._logger.log(LogLevel$1.Error, `IRetryPolicy.nextRetryDelayInMilliseconds(${previousRetryCount}, ${elapsedMilliseconds}) threw error '${e2}'.`);
      return null;
    }
  }
  _cancelCallbacksWithError(error2) {
    const callbacks = this._callbacks;
    this._callbacks = {};
    Object.keys(callbacks).forEach((key) => {
      const callback2 = callbacks[key];
      try {
        callback2(null, error2);
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `Stream 'error' callback called with '${error2}' threw error: ${getErrorString(e2)}`);
      }
    });
  }
  _cleanupPingTimer() {
    if (this._pingServerHandle) {
      clearTimeout(this._pingServerHandle);
      this._pingServerHandle = void 0;
    }
  }
  _cleanupTimeout() {
    if (this._timeoutHandle) {
      clearTimeout(this._timeoutHandle);
    }
  }
  _createInvocation(methodName, args, nonblocking, streamIds) {
    if (nonblocking) {
      if (streamIds.length !== 0) {
        return {
          arguments: args,
          streamIds,
          target: methodName,
          type: MessageType.Invocation
        };
      } else {
        return {
          arguments: args,
          target: methodName,
          type: MessageType.Invocation
        };
      }
    } else {
      const invocationId = this._invocationId;
      this._invocationId++;
      if (streamIds.length !== 0) {
        return {
          arguments: args,
          invocationId: invocationId.toString(),
          streamIds,
          target: methodName,
          type: MessageType.Invocation
        };
      } else {
        return {
          arguments: args,
          invocationId: invocationId.toString(),
          target: methodName,
          type: MessageType.Invocation
        };
      }
    }
  }
  _launchStreams(streams, promiseQueue) {
    if (streams.length === 0) {
      return;
    }
    if (!promiseQueue) {
      promiseQueue = Promise.resolve();
    }
    for (const streamId in streams) {
      streams[streamId].subscribe({
        complete: () => {
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId)));
        },
        error: (err) => {
          let message;
          if (err instanceof Error) {
            message = err.message;
          } else if (err && err.toString) {
            message = err.toString();
          } else {
            message = "Unknown error";
          }
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createCompletionMessage(streamId, message)));
        },
        next: (item) => {
          promiseQueue = promiseQueue.then(() => this._sendWithProtocol(this._createStreamItemMessage(streamId, item)));
        }
      });
    }
  }
  _replaceStreamingParams(args) {
    const streams = [];
    const streamIds = [];
    for (let i2 = 0; i2 < args.length; i2++) {
      const argument = args[i2];
      if (this._isObservable(argument)) {
        const streamId = this._invocationId;
        this._invocationId++;
        streams[streamId] = argument;
        streamIds.push(streamId.toString());
        args.splice(i2, 1);
      }
    }
    return [streams, streamIds];
  }
  _isObservable(arg) {
    return arg && arg.subscribe && typeof arg.subscribe === "function";
  }
  _createStreamInvocation(methodName, args, streamIds) {
    const invocationId = this._invocationId;
    this._invocationId++;
    if (streamIds.length !== 0) {
      return {
        arguments: args,
        invocationId: invocationId.toString(),
        streamIds,
        target: methodName,
        type: MessageType.StreamInvocation
      };
    } else {
      return {
        arguments: args,
        invocationId: invocationId.toString(),
        target: methodName,
        type: MessageType.StreamInvocation
      };
    }
  }
  _createCancelInvocation(id2) {
    return {
      invocationId: id2,
      type: MessageType.CancelInvocation
    };
  }
  _createStreamItemMessage(id2, item) {
    return {
      invocationId: id2,
      item,
      type: MessageType.StreamItem
    };
  }
  _createCompletionMessage(id2, error2, result) {
    if (error2) {
      return {
        error: error2,
        invocationId: id2,
        type: MessageType.Completion
      };
    }
    return {
      invocationId: id2,
      result,
      type: MessageType.Completion
    };
  }
}
const DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2e3, 1e4, 3e4, null];
class DefaultReconnectPolicy {
  constructor(retryDelays) {
    this._retryDelays = retryDelays !== void 0 ? [...retryDelays, null] : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS;
  }
  nextRetryDelayInMilliseconds(retryContext) {
    return this._retryDelays[retryContext.previousRetryCount];
  }
}
class HeaderNames {
}
HeaderNames.Authorization = "Authorization";
HeaderNames.Cookie = "Cookie";
class AccessTokenHttpClient extends HttpClient$1 {
  constructor(innerClient, accessTokenFactory) {
    super();
    this._innerClient = innerClient;
    this._accessTokenFactory = accessTokenFactory;
  }
  async send(request2) {
    let allowRetry = true;
    if (this._accessTokenFactory && (!this._accessToken || request2.url && request2.url.indexOf("/negotiate?") > 0)) {
      allowRetry = false;
      this._accessToken = await this._accessTokenFactory();
    }
    this._setAuthorizationHeader(request2);
    const response = await this._innerClient.send(request2);
    if (allowRetry && response.statusCode === 401 && this._accessTokenFactory) {
      this._accessToken = await this._accessTokenFactory();
      this._setAuthorizationHeader(request2);
      return await this._innerClient.send(request2);
    }
    return response;
  }
  _setAuthorizationHeader(request2) {
    if (!request2.headers) {
      request2.headers = {};
    }
    if (this._accessToken) {
      request2.headers[HeaderNames.Authorization] = `Bearer ${this._accessToken}`;
    } else if (this._accessTokenFactory) {
      if (request2.headers[HeaderNames.Authorization]) {
        delete request2.headers[HeaderNames.Authorization];
      }
    }
  }
  getCookieString(url2) {
    return this._innerClient.getCookieString(url2);
  }
}
var HttpTransportType;
(function(HttpTransportType2) {
  HttpTransportType2[HttpTransportType2["None"] = 0] = "None";
  HttpTransportType2[HttpTransportType2["WebSockets"] = 1] = "WebSockets";
  HttpTransportType2[HttpTransportType2["ServerSentEvents"] = 2] = "ServerSentEvents";
  HttpTransportType2[HttpTransportType2["LongPolling"] = 4] = "LongPolling";
})(HttpTransportType || (HttpTransportType = {}));
var TransferFormat;
(function(TransferFormat2) {
  TransferFormat2[TransferFormat2["Text"] = 1] = "Text";
  TransferFormat2[TransferFormat2["Binary"] = 2] = "Binary";
})(TransferFormat || (TransferFormat = {}));
let AbortController$1 = class AbortController2 {
  constructor() {
    this._isAborted = false;
    this.onabort = null;
  }
  abort() {
    if (!this._isAborted) {
      this._isAborted = true;
      if (this.onabort) {
        this.onabort();
      }
    }
  }
  get signal() {
    return this;
  }
  get aborted() {
    return this._isAborted;
  }
};
class LongPollingTransport {
  constructor(httpClient, logger, options) {
    this._httpClient = httpClient;
    this._logger = logger;
    this._pollAbort = new AbortController$1();
    this._options = options;
    this._running = false;
    this.onreceive = null;
    this.onclose = null;
  }
  // This is an internal type, not exported from 'index' so this is really just internal.
  get pollAborted() {
    return this._pollAbort.aborted;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._url = url2;
    this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Connecting.");
    if (transferFormat === TransferFormat.Binary && (typeof XMLHttpRequest !== "undefined" && typeof new XMLHttpRequest().responseType !== "string")) {
      throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");
    }
    const [name2, value2] = getUserAgentHeader();
    const headers = { [name2]: value2, ...this._options.headers };
    const pollOptions = {
      abortSignal: this._pollAbort.signal,
      headers,
      timeout: 1e5,
      withCredentials: this._options.withCredentials
    };
    if (transferFormat === TransferFormat.Binary) {
      pollOptions.responseType = "arraybuffer";
    }
    const pollUrl = `${url2}&_=${Date.now()}`;
    this._logger.log(LogLevel$1.Trace, `(LongPolling transport) polling: ${pollUrl}.`);
    const response = await this._httpClient.get(pollUrl, pollOptions);
    if (response.statusCode !== 200) {
      this._logger.log(LogLevel$1.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);
      this._closeError = new HttpError(response.statusText || "", response.statusCode);
      this._running = false;
    } else {
      this._running = true;
    }
    this._receiving = this._poll(this._url, pollOptions);
  }
  async _poll(url2, pollOptions) {
    try {
      while (this._running) {
        try {
          const pollUrl = `${url2}&_=${Date.now()}`;
          this._logger.log(LogLevel$1.Trace, `(LongPolling transport) polling: ${pollUrl}.`);
          const response = await this._httpClient.get(pollUrl, pollOptions);
          if (response.statusCode === 204) {
            this._logger.log(LogLevel$1.Information, "(LongPolling transport) Poll terminated by server.");
            this._running = false;
          } else if (response.statusCode !== 200) {
            this._logger.log(LogLevel$1.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);
            this._closeError = new HttpError(response.statusText || "", response.statusCode);
            this._running = false;
          } else {
            if (response.content) {
              this._logger.log(LogLevel$1.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this._options.logMessageContent)}.`);
              if (this.onreceive) {
                this.onreceive(response.content);
              }
            } else {
              this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Poll timed out, reissuing.");
            }
          }
        } catch (e2) {
          if (!this._running) {
            this._logger.log(LogLevel$1.Trace, `(LongPolling transport) Poll errored after shutdown: ${e2.message}`);
          } else {
            if (e2 instanceof TimeoutError) {
              this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Poll timed out, reissuing.");
            } else {
              this._closeError = e2;
              this._running = false;
            }
          }
        }
      }
    } finally {
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Polling complete.");
      if (!this.pollAborted) {
        this._raiseOnClose();
      }
    }
  }
  async send(data) {
    if (!this._running) {
      return Promise.reject(new Error("Cannot send until the transport is connected"));
    }
    return sendMessage(this._logger, "LongPolling", this._httpClient, this._url, data, this._options);
  }
  async stop() {
    this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Stopping polling.");
    this._running = false;
    this._pollAbort.abort();
    try {
      await this._receiving;
      this._logger.log(LogLevel$1.Trace, `(LongPolling transport) sending DELETE request to ${this._url}.`);
      const headers = {};
      const [name2, value2] = getUserAgentHeader();
      headers[name2] = value2;
      const deleteOptions = {
        headers: { ...headers, ...this._options.headers },
        timeout: this._options.timeout,
        withCredentials: this._options.withCredentials
      };
      await this._httpClient.delete(this._url, deleteOptions);
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) DELETE request sent.");
    } finally {
      this._logger.log(LogLevel$1.Trace, "(LongPolling transport) Stop finished.");
      this._raiseOnClose();
    }
  }
  _raiseOnClose() {
    if (this.onclose) {
      let logMessage = "(LongPolling transport) Firing onclose event.";
      if (this._closeError) {
        logMessage += " Error: " + this._closeError;
      }
      this._logger.log(LogLevel$1.Trace, logMessage);
      this.onclose(this._closeError);
    }
  }
}
class ServerSentEventsTransport {
  constructor(httpClient, accessToken, logger, options) {
    this._httpClient = httpClient;
    this._accessToken = accessToken;
    this._logger = logger;
    this._options = options;
    this.onreceive = null;
    this.onclose = null;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Trace, "(SSE transport) Connecting.");
    this._url = url2;
    if (this._accessToken) {
      url2 += (url2.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(this._accessToken)}`;
    }
    return new Promise((resolve2, reject) => {
      let opened = false;
      if (transferFormat !== TransferFormat.Text) {
        reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));
        return;
      }
      let eventSource;
      if (Platform.isBrowser || Platform.isWebWorker) {
        eventSource = new this._options.EventSource(url2, { withCredentials: this._options.withCredentials });
      } else {
        const cookies2 = this._httpClient.getCookieString(url2);
        const headers = {};
        headers.Cookie = cookies2;
        const [name2, value2] = getUserAgentHeader();
        headers[name2] = value2;
        eventSource = new this._options.EventSource(url2, { withCredentials: this._options.withCredentials, headers: { ...headers, ...this._options.headers } });
      }
      try {
        eventSource.onmessage = (e2) => {
          if (this.onreceive) {
            try {
              this._logger.log(LogLevel$1.Trace, `(SSE transport) data received. ${getDataDetail(e2.data, this._options.logMessageContent)}.`);
              this.onreceive(e2.data);
            } catch (error2) {
              this._close(error2);
              return;
            }
          }
        };
        eventSource.onerror = (e2) => {
          if (opened) {
            this._close();
          } else {
            reject(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."));
          }
        };
        eventSource.onopen = () => {
          this._logger.log(LogLevel$1.Information, `SSE connected to ${this._url}`);
          this._eventSource = eventSource;
          opened = true;
          resolve2();
        };
      } catch (e2) {
        reject(e2);
        return;
      }
    });
  }
  async send(data) {
    if (!this._eventSource) {
      return Promise.reject(new Error("Cannot send until the transport is connected"));
    }
    return sendMessage(this._logger, "SSE", this._httpClient, this._url, data, this._options);
  }
  stop() {
    this._close();
    return Promise.resolve();
  }
  _close(e2) {
    if (this._eventSource) {
      this._eventSource.close();
      this._eventSource = void 0;
      if (this.onclose) {
        this.onclose(e2);
      }
    }
  }
}
class WebSocketTransport {
  constructor(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {
    this._logger = logger;
    this._accessTokenFactory = accessTokenFactory;
    this._logMessageContent = logMessageContent;
    this._webSocketConstructor = webSocketConstructor;
    this._httpClient = httpClient;
    this.onreceive = null;
    this.onclose = null;
    this._headers = headers;
  }
  async connect(url2, transferFormat) {
    Arg.isRequired(url2, "url");
    Arg.isRequired(transferFormat, "transferFormat");
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Trace, "(WebSockets transport) Connecting.");
    let token2;
    if (this._accessTokenFactory) {
      token2 = await this._accessTokenFactory();
    }
    return new Promise((resolve2, reject) => {
      url2 = url2.replace(/^http/, "ws");
      let webSocket;
      const cookies2 = this._httpClient.getCookieString(url2);
      let opened = false;
      if (Platform.isNode || Platform.isReactNative) {
        const headers = {};
        const [name2, value2] = getUserAgentHeader();
        headers[name2] = value2;
        if (token2) {
          headers[HeaderNames.Authorization] = `Bearer ${token2}`;
        }
        if (cookies2) {
          headers[HeaderNames.Cookie] = cookies2;
        }
        webSocket = new this._webSocketConstructor(url2, void 0, {
          headers: { ...headers, ...this._headers }
        });
      } else {
        if (token2) {
          url2 += (url2.indexOf("?") < 0 ? "?" : "&") + `access_token=${encodeURIComponent(token2)}`;
        }
      }
      if (!webSocket) {
        webSocket = new this._webSocketConstructor(url2);
      }
      if (transferFormat === TransferFormat.Binary) {
        webSocket.binaryType = "arraybuffer";
      }
      webSocket.onopen = (_event) => {
        this._logger.log(LogLevel$1.Information, `WebSocket connected to ${url2}.`);
        this._webSocket = webSocket;
        opened = true;
        resolve2();
      };
      webSocket.onerror = (event) => {
        let error2 = null;
        if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
          error2 = event.error;
        } else {
          error2 = "There was an error with the transport";
        }
        this._logger.log(LogLevel$1.Information, `(WebSockets transport) ${error2}.`);
      };
      webSocket.onmessage = (message) => {
        this._logger.log(LogLevel$1.Trace, `(WebSockets transport) data received. ${getDataDetail(message.data, this._logMessageContent)}.`);
        if (this.onreceive) {
          try {
            this.onreceive(message.data);
          } catch (error2) {
            this._close(error2);
            return;
          }
        }
      };
      webSocket.onclose = (event) => {
        if (opened) {
          this._close(event);
        } else {
          let error2 = null;
          if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
            error2 = event.error;
          } else {
            error2 = "WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.";
          }
          reject(new Error(error2));
        }
      };
    });
  }
  send(data) {
    if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {
      this._logger.log(LogLevel$1.Trace, `(WebSockets transport) sending data. ${getDataDetail(data, this._logMessageContent)}.`);
      this._webSocket.send(data);
      return Promise.resolve();
    }
    return Promise.reject("WebSocket is not in the OPEN state");
  }
  stop() {
    if (this._webSocket) {
      this._close(void 0);
    }
    return Promise.resolve();
  }
  _close(event) {
    if (this._webSocket) {
      this._webSocket.onclose = () => {
      };
      this._webSocket.onmessage = () => {
      };
      this._webSocket.onerror = () => {
      };
      this._webSocket.close();
      this._webSocket = void 0;
    }
    this._logger.log(LogLevel$1.Trace, "(WebSockets transport) socket closed.");
    if (this.onclose) {
      if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1e3)) {
        this.onclose(new Error(`WebSocket closed with status code: ${event.code} (${event.reason || "no reason given"}).`));
      } else if (event instanceof Error) {
        this.onclose(event);
      } else {
        this.onclose();
      }
    }
  }
  _isCloseEvent(event) {
    return event && typeof event.wasClean === "boolean" && typeof event.code === "number";
  }
}
const MAX_REDIRECTS = 100;
class HttpConnection {
  constructor(url2, options = {}) {
    this._stopPromiseResolver = () => {
    };
    this.features = {};
    this._negotiateVersion = 1;
    Arg.isRequired(url2, "url");
    this._logger = createLogger(options.logger);
    this.baseUrl = this._resolveUrl(url2);
    options = options || {};
    options.logMessageContent = options.logMessageContent === void 0 ? false : options.logMessageContent;
    if (typeof options.withCredentials === "boolean" || options.withCredentials === void 0) {
      options.withCredentials = options.withCredentials === void 0 ? true : options.withCredentials;
    } else {
      throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");
    }
    options.timeout = options.timeout === void 0 ? 100 * 1e3 : options.timeout;
    let webSocketModule = null;
    let eventSourceModule = null;
    if (Platform.isNode && typeof require !== "undefined") {
      const requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : require;
      webSocketModule = requireFunc("ws");
      eventSourceModule = requireFunc("eventsource");
    }
    if (!Platform.isNode && typeof WebSocket !== "undefined" && !options.WebSocket) {
      options.WebSocket = WebSocket;
    } else if (Platform.isNode && !options.WebSocket) {
      if (webSocketModule) {
        options.WebSocket = webSocketModule;
      }
    }
    if (!Platform.isNode && typeof EventSource !== "undefined" && !options.EventSource) {
      options.EventSource = EventSource;
    } else if (Platform.isNode && !options.EventSource) {
      if (typeof eventSourceModule !== "undefined") {
        options.EventSource = eventSourceModule;
      }
    }
    this._httpClient = new AccessTokenHttpClient(options.httpClient || new DefaultHttpClient(this._logger), options.accessTokenFactory);
    this._connectionState = "Disconnected";
    this._connectionStarted = false;
    this._options = options;
    this.onreceive = null;
    this.onclose = null;
  }
  async start(transferFormat) {
    transferFormat = transferFormat || TransferFormat.Binary;
    Arg.isIn(transferFormat, TransferFormat, "transferFormat");
    this._logger.log(LogLevel$1.Debug, `Starting connection with transfer format '${TransferFormat[transferFormat]}'.`);
    if (this._connectionState !== "Disconnected") {
      return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));
    }
    this._connectionState = "Connecting";
    this._startInternalPromise = this._startInternal(transferFormat);
    await this._startInternalPromise;
    if (this._connectionState === "Disconnecting") {
      const message = "Failed to start the HttpConnection before stop() was called.";
      this._logger.log(LogLevel$1.Error, message);
      await this._stopPromise;
      return Promise.reject(new AbortError(message));
    } else if (this._connectionState !== "Connected") {
      const message = "HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";
      this._logger.log(LogLevel$1.Error, message);
      return Promise.reject(new AbortError(message));
    }
    this._connectionStarted = true;
  }
  send(data) {
    if (this._connectionState !== "Connected") {
      return Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State."));
    }
    if (!this._sendQueue) {
      this._sendQueue = new TransportSendQueue(this.transport);
    }
    return this._sendQueue.send(data);
  }
  async stop(error2) {
    if (this._connectionState === "Disconnected") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnected state.`);
      return Promise.resolve();
    }
    if (this._connectionState === "Disconnecting") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stop(${error2}) ignored because the connection is already in the disconnecting state.`);
      return this._stopPromise;
    }
    this._connectionState = "Disconnecting";
    this._stopPromise = new Promise((resolve2) => {
      this._stopPromiseResolver = resolve2;
    });
    await this._stopInternal(error2);
    await this._stopPromise;
  }
  async _stopInternal(error2) {
    this._stopError = error2;
    try {
      await this._startInternalPromise;
    } catch (e2) {
    }
    if (this.transport) {
      try {
        await this.transport.stop();
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `HttpConnection.transport.stop() threw error '${e2}'.`);
        this._stopConnection();
      }
      this.transport = void 0;
    } else {
      this._logger.log(LogLevel$1.Debug, "HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.");
    }
  }
  async _startInternal(transferFormat) {
    let url2 = this.baseUrl;
    this._accessTokenFactory = this._options.accessTokenFactory;
    this._httpClient._accessTokenFactory = this._accessTokenFactory;
    try {
      if (this._options.skipNegotiation) {
        if (this._options.transport === HttpTransportType.WebSockets) {
          this.transport = this._constructTransport(HttpTransportType.WebSockets);
          await this._startTransport(url2, transferFormat);
        } else {
          throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");
        }
      } else {
        let negotiateResponse = null;
        let redirects = 0;
        do {
          negotiateResponse = await this._getNegotiationResponse(url2);
          if (this._connectionState === "Disconnecting" || this._connectionState === "Disconnected") {
            throw new AbortError("The connection was stopped during negotiation.");
          }
          if (negotiateResponse.error) {
            throw new Error(negotiateResponse.error);
          }
          if (negotiateResponse.ProtocolVersion) {
            throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");
          }
          if (negotiateResponse.url) {
            url2 = negotiateResponse.url;
          }
          if (negotiateResponse.accessToken) {
            const accessToken = negotiateResponse.accessToken;
            this._accessTokenFactory = () => accessToken;
            this._httpClient._accessToken = accessToken;
            this._httpClient._accessTokenFactory = void 0;
          }
          redirects++;
        } while (negotiateResponse.url && redirects < MAX_REDIRECTS);
        if (redirects === MAX_REDIRECTS && negotiateResponse.url) {
          throw new Error("Negotiate redirection limit exceeded.");
        }
        await this._createTransport(url2, this._options.transport, negotiateResponse, transferFormat);
      }
      if (this.transport instanceof LongPollingTransport) {
        this.features.inherentKeepAlive = true;
      }
      if (this._connectionState === "Connecting") {
        this._logger.log(LogLevel$1.Debug, "The HttpConnection connected successfully.");
        this._connectionState = "Connected";
      }
    } catch (e2) {
      this._logger.log(LogLevel$1.Error, "Failed to start the connection: " + e2);
      this._connectionState = "Disconnected";
      this.transport = void 0;
      this._stopPromiseResolver();
      return Promise.reject(e2);
    }
  }
  async _getNegotiationResponse(url2) {
    const headers = {};
    const [name2, value2] = getUserAgentHeader();
    headers[name2] = value2;
    const negotiateUrl = this._resolveNegotiateUrl(url2);
    this._logger.log(LogLevel$1.Debug, `Sending negotiation request: ${negotiateUrl}.`);
    try {
      const response = await this._httpClient.post(negotiateUrl, {
        content: "",
        headers: { ...headers, ...this._options.headers },
        timeout: this._options.timeout,
        withCredentials: this._options.withCredentials
      });
      if (response.statusCode !== 200) {
        return Promise.reject(new Error(`Unexpected status code returned from negotiate '${response.statusCode}'`));
      }
      const negotiateResponse = JSON.parse(response.content);
      if (!negotiateResponse.negotiateVersion || negotiateResponse.negotiateVersion < 1) {
        negotiateResponse.connectionToken = negotiateResponse.connectionId;
      }
      return negotiateResponse;
    } catch (e2) {
      let errorMessage = "Failed to complete negotiation with the server: " + e2;
      if (e2 instanceof HttpError) {
        if (e2.statusCode === 404) {
          errorMessage = errorMessage + " Either this is not a SignalR endpoint or there is a proxy blocking the connection.";
        }
      }
      this._logger.log(LogLevel$1.Error, errorMessage);
      return Promise.reject(new FailedToNegotiateWithServerError(errorMessage));
    }
  }
  _createConnectUrl(url2, connectionToken) {
    if (!connectionToken) {
      return url2;
    }
    return url2 + (url2.indexOf("?") === -1 ? "?" : "&") + `id=${connectionToken}`;
  }
  async _createTransport(url2, requestedTransport, negotiateResponse, requestedTransferFormat) {
    let connectUrl = this._createConnectUrl(url2, negotiateResponse.connectionToken);
    if (this._isITransport(requestedTransport)) {
      this._logger.log(LogLevel$1.Debug, "Connection was provided an instance of ITransport, using that directly.");
      this.transport = requestedTransport;
      await this._startTransport(connectUrl, requestedTransferFormat);
      this.connectionId = negotiateResponse.connectionId;
      return;
    }
    const transportExceptions = [];
    const transports = negotiateResponse.availableTransports || [];
    let negotiate = negotiateResponse;
    for (const endpoint of transports) {
      const transportOrError = this._resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat);
      if (transportOrError instanceof Error) {
        transportExceptions.push(`${endpoint.transport} failed:`);
        transportExceptions.push(transportOrError);
      } else if (this._isITransport(transportOrError)) {
        this.transport = transportOrError;
        if (!negotiate) {
          try {
            negotiate = await this._getNegotiationResponse(url2);
          } catch (ex) {
            return Promise.reject(ex);
          }
          connectUrl = this._createConnectUrl(url2, negotiate.connectionToken);
        }
        try {
          await this._startTransport(connectUrl, requestedTransferFormat);
          this.connectionId = negotiate.connectionId;
          return;
        } catch (ex) {
          this._logger.log(LogLevel$1.Error, `Failed to start the transport '${endpoint.transport}': ${ex}`);
          negotiate = void 0;
          transportExceptions.push(new FailedToStartTransportError(`${endpoint.transport} failed: ${ex}`, HttpTransportType[endpoint.transport]));
          if (this._connectionState !== "Connecting") {
            const message = "Failed to select transport before stop() was called.";
            this._logger.log(LogLevel$1.Debug, message);
            return Promise.reject(new AbortError(message));
          }
        }
      }
    }
    if (transportExceptions.length > 0) {
      return Promise.reject(new AggregateErrors(`Unable to connect to the server with any of the available transports. ${transportExceptions.join(" ")}`, transportExceptions));
    }
    return Promise.reject(new Error("None of the transports supported by the client are supported by the server."));
  }
  _constructTransport(transport) {
    switch (transport) {
      case HttpTransportType.WebSockets:
        if (!this._options.WebSocket) {
          throw new Error("'WebSocket' is not supported in your environment.");
        }
        return new WebSocketTransport(this._httpClient, this._accessTokenFactory, this._logger, this._options.logMessageContent, this._options.WebSocket, this._options.headers || {});
      case HttpTransportType.ServerSentEvents:
        if (!this._options.EventSource) {
          throw new Error("'EventSource' is not supported in your environment.");
        }
        return new ServerSentEventsTransport(this._httpClient, this._httpClient._accessToken, this._logger, this._options);
      case HttpTransportType.LongPolling:
        return new LongPollingTransport(this._httpClient, this._logger, this._options);
      default:
        throw new Error(`Unknown transport: ${transport}.`);
    }
  }
  _startTransport(url2, transferFormat) {
    this.transport.onreceive = this.onreceive;
    this.transport.onclose = (e2) => this._stopConnection(e2);
    return this.transport.connect(url2, transferFormat);
  }
  _resolveTransportOrError(endpoint, requestedTransport, requestedTransferFormat) {
    const transport = HttpTransportType[endpoint.transport];
    if (transport === null || transport === void 0) {
      this._logger.log(LogLevel$1.Debug, `Skipping transport '${endpoint.transport}' because it is not supported by this client.`);
      return new Error(`Skipping transport '${endpoint.transport}' because it is not supported by this client.`);
    } else {
      if (transportMatches(requestedTransport, transport)) {
        const transferFormats = endpoint.transferFormats.map((s2) => TransferFormat[s2]);
        if (transferFormats.indexOf(requestedTransferFormat) >= 0) {
          if (transport === HttpTransportType.WebSockets && !this._options.WebSocket || transport === HttpTransportType.ServerSentEvents && !this._options.EventSource) {
            this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it is not supported in your environment.'`);
            return new UnsupportedTransportError(`'${HttpTransportType[transport]}' is not supported in your environment.`, transport);
          } else {
            this._logger.log(LogLevel$1.Debug, `Selecting transport '${HttpTransportType[transport]}'.`);
            try {
              return this._constructTransport(transport);
            } catch (ex) {
              return ex;
            }
          }
        } else {
          this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it does not support the requested transfer format '${TransferFormat[requestedTransferFormat]}'.`);
          return new Error(`'${HttpTransportType[transport]}' does not support ${TransferFormat[requestedTransferFormat]}.`);
        }
      } else {
        this._logger.log(LogLevel$1.Debug, `Skipping transport '${HttpTransportType[transport]}' because it was disabled by the client.`);
        return new DisabledTransportError(`'${HttpTransportType[transport]}' is disabled by the client.`, transport);
      }
    }
  }
  _isITransport(transport) {
    return transport && typeof transport === "object" && "connect" in transport;
  }
  _stopConnection(error2) {
    this._logger.log(LogLevel$1.Debug, `HttpConnection.stopConnection(${error2}) called while in state ${this._connectionState}.`);
    this.transport = void 0;
    error2 = this._stopError || error2;
    this._stopError = void 0;
    if (this._connectionState === "Disconnected") {
      this._logger.log(LogLevel$1.Debug, `Call to HttpConnection.stopConnection(${error2}) was ignored because the connection is already in the disconnected state.`);
      return;
    }
    if (this._connectionState === "Connecting") {
      this._logger.log(LogLevel$1.Warning, `Call to HttpConnection.stopConnection(${error2}) was ignored because the connection is still in the connecting state.`);
      throw new Error(`HttpConnection.stopConnection(${error2}) was called while the connection is still in the connecting state.`);
    }
    if (this._connectionState === "Disconnecting") {
      this._stopPromiseResolver();
    }
    if (error2) {
      this._logger.log(LogLevel$1.Error, `Connection disconnected with error '${error2}'.`);
    } else {
      this._logger.log(LogLevel$1.Information, "Connection disconnected.");
    }
    if (this._sendQueue) {
      this._sendQueue.stop().catch((e2) => {
        this._logger.log(LogLevel$1.Error, `TransportSendQueue.stop() threw error '${e2}'.`);
      });
      this._sendQueue = void 0;
    }
    this.connectionId = void 0;
    this._connectionState = "Disconnected";
    if (this._connectionStarted) {
      this._connectionStarted = false;
      try {
        if (this.onclose) {
          this.onclose(error2);
        }
      } catch (e2) {
        this._logger.log(LogLevel$1.Error, `HttpConnection.onclose(${error2}) threw error '${e2}'.`);
      }
    }
  }
  _resolveUrl(url2) {
    if (url2.lastIndexOf("https://", 0) === 0 || url2.lastIndexOf("http://", 0) === 0) {
      return url2;
    }
    if (!Platform.isBrowser) {
      throw new Error(`Cannot resolve '${url2}'.`);
    }
    const aTag = window.document.createElement("a");
    aTag.href = url2;
    this._logger.log(LogLevel$1.Information, `Normalizing '${url2}' to '${aTag.href}'.`);
    return aTag.href;
  }
  _resolveNegotiateUrl(url2) {
    const index2 = url2.indexOf("?");
    let negotiateUrl = url2.substring(0, index2 === -1 ? url2.length : index2);
    if (negotiateUrl[negotiateUrl.length - 1] !== "/") {
      negotiateUrl += "/";
    }
    negotiateUrl += "negotiate";
    negotiateUrl += index2 === -1 ? "" : url2.substring(index2);
    if (negotiateUrl.indexOf("negotiateVersion") === -1) {
      negotiateUrl += index2 === -1 ? "?" : "&";
      negotiateUrl += "negotiateVersion=" + this._negotiateVersion;
    }
    return negotiateUrl;
  }
}
function transportMatches(requestedTransport, actualTransport) {
  return !requestedTransport || (actualTransport & requestedTransport) !== 0;
}
class TransportSendQueue {
  constructor(_transport) {
    this._transport = _transport;
    this._buffer = [];
    this._executing = true;
    this._sendBufferedData = new PromiseSource();
    this._transportResult = new PromiseSource();
    this._sendLoopPromise = this._sendLoop();
  }
  send(data) {
    this._bufferData(data);
    if (!this._transportResult) {
      this._transportResult = new PromiseSource();
    }
    return this._transportResult.promise;
  }
  stop() {
    this._executing = false;
    this._sendBufferedData.resolve();
    return this._sendLoopPromise;
  }
  _bufferData(data) {
    if (this._buffer.length && typeof this._buffer[0] !== typeof data) {
      throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof data}`);
    }
    this._buffer.push(data);
    this._sendBufferedData.resolve();
  }
  async _sendLoop() {
    while (true) {
      await this._sendBufferedData.promise;
      if (!this._executing) {
        if (this._transportResult) {
          this._transportResult.reject("Connection stopped.");
        }
        break;
      }
      this._sendBufferedData = new PromiseSource();
      const transportResult = this._transportResult;
      this._transportResult = void 0;
      const data = typeof this._buffer[0] === "string" ? this._buffer.join("") : TransportSendQueue._concatBuffers(this._buffer);
      this._buffer.length = 0;
      try {
        await this._transport.send(data);
        transportResult.resolve();
      } catch (error2) {
        transportResult.reject(error2);
      }
    }
  }
  static _concatBuffers(arrayBuffers) {
    const totalLength = arrayBuffers.map((b2) => b2.byteLength).reduce((a2, b2) => a2 + b2);
    const result = new Uint8Array(totalLength);
    let offset2 = 0;
    for (const item of arrayBuffers) {
      result.set(new Uint8Array(item), offset2);
      offset2 += item.byteLength;
    }
    return result.buffer;
  }
}
class PromiseSource {
  constructor() {
    this.promise = new Promise((resolve2, reject) => [this._resolver, this._rejecter] = [resolve2, reject]);
  }
  resolve() {
    this._resolver();
  }
  reject(reason) {
    this._rejecter(reason);
  }
}
const JSON_HUB_PROTOCOL_NAME = "json";
class JsonHubProtocol {
  constructor() {
    this.name = JSON_HUB_PROTOCOL_NAME;
    this.version = 1;
    this.transferFormat = TransferFormat.Text;
  }
  /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.
   *
   * @param {string} input A string containing the serialized representation.
   * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
   */
  parseMessages(input2, logger) {
    if (typeof input2 !== "string") {
      throw new Error("Invalid input for JSON hub protocol. Expected a string.");
    }
    if (!input2) {
      return [];
    }
    if (logger === null) {
      logger = NullLogger.instance;
    }
    const messages2 = TextMessageFormat.parse(input2);
    const hubMessages = [];
    for (const message of messages2) {
      const parsedMessage = JSON.parse(message);
      if (typeof parsedMessage.type !== "number") {
        throw new Error("Invalid payload.");
      }
      switch (parsedMessage.type) {
        case MessageType.Invocation:
          this._isInvocationMessage(parsedMessage);
          break;
        case MessageType.StreamItem:
          this._isStreamItemMessage(parsedMessage);
          break;
        case MessageType.Completion:
          this._isCompletionMessage(parsedMessage);
          break;
        case MessageType.Ping:
          break;
        case MessageType.Close:
          break;
        default:
          logger.log(LogLevel$1.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
          continue;
      }
      hubMessages.push(parsedMessage);
    }
    return hubMessages;
  }
  /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.
   *
   * @param {HubMessage} message The message to write.
   * @returns {string} A string containing the serialized representation of the message.
   */
  writeMessage(message) {
    return TextMessageFormat.write(JSON.stringify(message));
  }
  _isInvocationMessage(message) {
    this._assertNotEmptyString(message.target, "Invalid payload for Invocation message.");
    if (message.invocationId !== void 0) {
      this._assertNotEmptyString(message.invocationId, "Invalid payload for Invocation message.");
    }
  }
  _isStreamItemMessage(message) {
    this._assertNotEmptyString(message.invocationId, "Invalid payload for StreamItem message.");
    if (message.item === void 0) {
      throw new Error("Invalid payload for StreamItem message.");
    }
  }
  _isCompletionMessage(message) {
    if (message.result && message.error) {
      throw new Error("Invalid payload for Completion message.");
    }
    if (!message.result && message.error) {
      this._assertNotEmptyString(message.error, "Invalid payload for Completion message.");
    }
    this._assertNotEmptyString(message.invocationId, "Invalid payload for Completion message.");
  }
  _assertNotEmptyString(value2, errorMessage) {
    if (typeof value2 !== "string" || value2 === "") {
      throw new Error(errorMessage);
    }
  }
}
const LogLevelNameMapping = {
  trace: LogLevel$1.Trace,
  debug: LogLevel$1.Debug,
  info: LogLevel$1.Information,
  information: LogLevel$1.Information,
  warn: LogLevel$1.Warning,
  warning: LogLevel$1.Warning,
  error: LogLevel$1.Error,
  critical: LogLevel$1.Critical,
  none: LogLevel$1.None
};
function parseLogLevel(name2) {
  const mapping = LogLevelNameMapping[name2.toLowerCase()];
  if (typeof mapping !== "undefined") {
    return mapping;
  } else {
    throw new Error(`Unknown log level: ${name2}`);
  }
}
class HubConnectionBuilder {
  configureLogging(logging) {
    Arg.isRequired(logging, "logging");
    if (isLogger(logging)) {
      this.logger = logging;
    } else if (typeof logging === "string") {
      const logLevel = parseLogLevel(logging);
      this.logger = new ConsoleLogger(logLevel);
    } else {
      this.logger = new ConsoleLogger(logging);
    }
    return this;
  }
  withUrl(url2, transportTypeOrOptions) {
    Arg.isRequired(url2, "url");
    Arg.isNotEmpty(url2, "url");
    this.url = url2;
    if (typeof transportTypeOrOptions === "object") {
      this.httpConnectionOptions = { ...this.httpConnectionOptions, ...transportTypeOrOptions };
    } else {
      this.httpConnectionOptions = {
        ...this.httpConnectionOptions,
        transport: transportTypeOrOptions
      };
    }
    return this;
  }
  /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.
   *
   * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.
   */
  withHubProtocol(protocol) {
    Arg.isRequired(protocol, "protocol");
    this.protocol = protocol;
    return this;
  }
  withAutomaticReconnect(retryDelaysOrReconnectPolicy) {
    if (this.reconnectPolicy) {
      throw new Error("A reconnectPolicy has already been set.");
    }
    if (!retryDelaysOrReconnectPolicy) {
      this.reconnectPolicy = new DefaultReconnectPolicy();
    } else if (Array.isArray(retryDelaysOrReconnectPolicy)) {
      this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);
    } else {
      this.reconnectPolicy = retryDelaysOrReconnectPolicy;
    }
    return this;
  }
  /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.
   *
   * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.
   */
  build() {
    const httpConnectionOptions = this.httpConnectionOptions || {};
    if (httpConnectionOptions.logger === void 0) {
      httpConnectionOptions.logger = this.logger;
    }
    if (!this.url) {
      throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
    }
    const connection = new HttpConnection(this.url, httpConnectionOptions);
    return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);
  }
}
function isLogger(logger) {
  return logger.log !== void 0;
}
const createAbortError = () => {
  const error2 = new Error("Delay aborted");
  error2.name = "AbortError";
  return error2;
};
const clearMethods = /* @__PURE__ */ new WeakMap();
function createDelay({ clearTimeout: defaultClear, setTimeout: defaultSet } = {}) {
  return (milliseconds2, { value: value2, signal } = {}) => {
    if (signal == null ? void 0 : signal.aborted) {
      return Promise.reject(createAbortError());
    }
    let timeoutId;
    let settle2;
    let rejectFunction;
    const clear = defaultClear ?? clearTimeout;
    const signalListener = () => {
      clear(timeoutId);
      rejectFunction(createAbortError());
    };
    const cleanup2 = () => {
      if (signal) {
        signal.removeEventListener("abort", signalListener);
      }
    };
    const delayPromise = new Promise((resolve2, reject) => {
      settle2 = () => {
        cleanup2();
        resolve2(value2);
      };
      rejectFunction = reject;
      timeoutId = (defaultSet ?? setTimeout)(settle2, milliseconds2);
    });
    if (signal) {
      signal.addEventListener("abort", signalListener, { once: true });
    }
    clearMethods.set(delayPromise, () => {
      clear(timeoutId);
      timeoutId = null;
      settle2();
    });
    return delayPromise;
  };
}
const delay = createDelay();
const byteToHex = [];
for (let i2 = 0; i2 < 256; ++i2) {
  byteToHex.push((i2 + 256).toString(16).slice(1));
}
function unsafeStringify(arr, offset2 = 0) {
  return (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
}
let getRandomValues;
const rnds8 = new Uint8Array(16);
function rng() {
  if (!getRandomValues) {
    if (typeof crypto === "undefined" || !crypto.getRandomValues) {
      throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
    }
    getRandomValues = crypto.getRandomValues.bind(crypto);
  }
  return getRandomValues(rnds8);
}
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
const native = { randomUUID };
function v4(options, buf, offset2) {
  var _a2;
  if (native.randomUUID && true && !options) {
    return native.randomUUID();
  }
  options = options || {};
  const rnds = options.random ?? ((_a2 = options.rng) == null ? void 0 : _a2.call(options)) ?? rng();
  if (rnds.length < 16) {
    throw new Error("Random bytes length must be >= 16");
  }
  rnds[6] = rnds[6] & 15 | 64;
  rnds[8] = rnds[8] & 63 | 128;
  return unsafeStringify(rnds);
}
const Button = reactExports.forwardRef(
  (props, ref) => {
    let nSize;
    if (props.size) {
      switch (props.size) {
        case "sm":
        case "md":
        case "lg":
          nSize = props.size;
          break;
        case "small":
          nSize = "sm";
          break;
        case "medium":
          nSize = "md";
          break;
        case "large":
          nSize = "lg";
          break;
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      button_default$1,
      {
        ref,
        isDisabled: props.disabled,
        ...props,
        size: nSize
      }
    );
  }
);
var voidElements = {
  "area": true,
  "base": true,
  "br": true,
  "col": true,
  "embed": true,
  "hr": true,
  "img": true,
  "input": true,
  "link": true,
  "meta": true,
  "param": true,
  "source": true,
  "track": true,
  "wbr": true
};
const e$2 = /* @__PURE__ */ getDefaultExportFromCjs(voidElements);
var t$5 = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
function n$4(n2) {
  var r2 = { type: "tag", name: "", voidElement: false, attrs: {}, children: [] }, i2 = n2.match(/<\/?([^\s]+?)[/\s>]/);
  if (i2 && (r2.name = i2[1], (e$2[i2[1]] || "/" === n2.charAt(n2.length - 2)) && (r2.voidElement = true), r2.name.startsWith("!--"))) {
    var s2 = n2.indexOf("-->");
    return { type: "comment", comment: -1 !== s2 ? n2.slice(4, s2) : "" };
  }
  for (var a2 = new RegExp(t$5), c2 = null; null !== (c2 = a2.exec(n2)); )
    if (c2[0].trim())
      if (c2[1]) {
        var o2 = c2[1].trim(), l2 = [o2, ""];
        o2.indexOf("=") > -1 && (l2 = o2.split("=")), r2.attrs[l2[0]] = l2[1], a2.lastIndex--;
      } else
        c2[2] && (r2.attrs[c2[2]] = c2[3].trim().substring(1, c2[3].length - 1));
  return r2;
}
var r$5 = /<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g, i$2 = /^\s*$/, s$3 = /* @__PURE__ */ Object.create(null);
function a$2(e2, t2) {
  switch (t2.type) {
    case "text":
      return e2 + t2.content;
    case "tag":
      return e2 += "<" + t2.name + (t2.attrs ? function(e3) {
        var t3 = [];
        for (var n2 in e3)
          t3.push(n2 + '="' + e3[n2] + '"');
        return t3.length ? " " + t3.join(" ") : "";
      }(t2.attrs) : "") + (t2.voidElement ? "/>" : ">"), t2.voidElement ? e2 : e2 + t2.children.reduce(a$2, "") + "</" + t2.name + ">";
    case "comment":
      return e2 + "<!--" + t2.comment + "-->";
  }
}
var c$4 = { parse: function(e2, t2) {
  t2 || (t2 = {}), t2.components || (t2.components = s$3);
  var a2, c2 = [], o2 = [], l2 = -1, m2 = false;
  if (0 !== e2.indexOf("<")) {
    var u2 = e2.indexOf("<");
    c2.push({ type: "text", content: -1 === u2 ? e2 : e2.substring(0, u2) });
  }
  return e2.replace(r$5, function(r2, s2) {
    if (m2) {
      if (r2 !== "</" + a2.name + ">")
        return;
      m2 = false;
    }
    var u3, f2 = "/" !== r2.charAt(1), h3 = r2.startsWith("<!--"), p2 = s2 + r2.length, d2 = e2.charAt(p2);
    if (h3) {
      var v2 = n$4(r2);
      return l2 < 0 ? (c2.push(v2), c2) : ((u3 = o2[l2]).children.push(v2), c2);
    }
    if (f2 && (l2++, "tag" === (a2 = n$4(r2)).type && t2.components[a2.name] && (a2.type = "component", m2 = true), a2.voidElement || m2 || !d2 || "<" === d2 || a2.children.push({ type: "text", content: e2.slice(p2, e2.indexOf("<", p2)) }), 0 === l2 && c2.push(a2), (u3 = o2[l2 - 1]) && u3.children.push(a2), o2[l2] = a2), (!f2 || a2.voidElement) && (l2 > -1 && (a2.voidElement || a2.name === r2.slice(2, -1)) && (l2--, a2 = -1 === l2 ? c2 : o2[l2]), !m2 && "<" !== d2 && d2)) {
      u3 = -1 === l2 ? c2 : o2[l2].children;
      var x2 = e2.indexOf("<", p2), g2 = e2.slice(p2, -1 === x2 ? void 0 : x2);
      i$2.test(g2) && (g2 = " "), (x2 > -1 && l2 + u3.length >= 0 || " " !== g2) && u3.push({ type: "text", content: g2 });
    }
  }), c2;
}, stringify: function(e2) {
  return e2.reduce(function(e3, t2) {
    return e3 + a$2("", t2);
  }, "");
} };
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
var htmlEntities = {
  "&amp;": "&",
  "&#38;": "&",
  "&lt;": "<",
  "&#60;": "<",
  "&gt;": ">",
  "&#62;": ">",
  "&apos;": "'",
  "&#39;": "'",
  "&quot;": '"',
  "&#34;": '"',
  "&nbsp;": " ",
  "&#160;": " ",
  "&copy;": "©",
  "&#169;": "©",
  "&reg;": "®",
  "&#174;": "®",
  "&hellip;": "…",
  "&#8230;": "…",
  "&#x2F;": "/",
  "&#47;": "/"
};
var unescapeHtmlEntity = function unescapeHtmlEntity2(m2) {
  return htmlEntities[m2];
};
var unescape$1 = function unescape2(text2) {
  return text2.replace(matchHtmlEntity, unescapeHtmlEntity);
};
function ownKeys$e(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$f(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$e(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$e(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var defaultOptions$1 = {
  bindI18n: "languageChanged",
  bindI18nStore: "",
  transEmptyNodeValue: "",
  transSupportBasicHtmlNodes: true,
  transWrapTextNodes: "",
  transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
  useSuspense: true,
  unescape: unescape$1
};
var i18nInstance;
var I18nContext = reactExports.createContext();
function setDefaults() {
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  defaultOptions$1 = _objectSpread$f(_objectSpread$f({}, defaultOptions$1), options);
}
function getDefaults() {
  return defaultOptions$1;
}
var ReportNamespaces = function() {
  function ReportNamespaces2() {
    _classCallCheck$a(this, ReportNamespaces2);
    this.usedNamespaces = {};
  }
  _createClass$8(ReportNamespaces2, [{
    key: "addUsedNamespaces",
    value: function addUsedNamespaces(namespaces) {
      var _this = this;
      namespaces.forEach(function(ns) {
        if (!_this.usedNamespaces[ns])
          _this.usedNamespaces[ns] = true;
      });
    }
  }, {
    key: "getUsedNamespaces",
    value: function getUsedNamespaces() {
      return Object.keys(this.usedNamespaces);
    }
  }]);
  return ReportNamespaces2;
}();
function setI18n(instance2) {
  i18nInstance = instance2;
}
function getI18n() {
  return i18nInstance;
}
var initReactI18next = {
  type: "3rdParty",
  init: function init(instance2) {
    setDefaults(instance2.options.react);
    setI18n(instance2);
  }
};
function warn$1() {
  if (console && console.warn) {
    var _console;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    if (typeof args[0] === "string")
      args[0] = "react-i18next:: ".concat(args[0]);
    (_console = console).warn.apply(_console, args);
  }
}
var alreadyWarned = {};
function warnOnce() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }
  if (typeof args[0] === "string" && alreadyWarned[args[0]])
    return;
  if (typeof args[0] === "string")
    alreadyWarned[args[0]] = /* @__PURE__ */ new Date();
  warn$1.apply(void 0, args);
}
function loadNamespaces(i18n, ns, cb2) {
  i18n.loadNamespaces(ns, function() {
    if (i18n.isInitialized) {
      cb2();
    } else {
      var initialized = function initialized2() {
        setTimeout(function() {
          i18n.off("initialized", initialized2);
        }, 0);
        cb2();
      };
      i18n.on("initialized", initialized);
    }
  });
}
function oldI18nextHasLoadedNamespace(ns, i18n) {
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  var lng = i18n.languages[0];
  var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
  var lastLng = i18n.languages[i18n.languages.length - 1];
  if (lng.toLowerCase() === "cimode")
    return true;
  var loadNotPending = function loadNotPending2(l2, n2) {
    var loadState = i18n.services.backendConnector.state["".concat(l2, "|").concat(n2)];
    return loadState === -1 || loadState === 2;
  };
  if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns))
    return false;
  if (i18n.hasResourceBundle(lng, ns))
    return true;
  if (!i18n.services.backendConnector.backend || i18n.options.resources && !i18n.options.partialBundledLanguages)
    return true;
  if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
    return true;
  return false;
}
function hasLoadedNamespace(ns, i18n) {
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  if (!i18n.languages || !i18n.languages.length) {
    warnOnce("i18n.languages were undefined or empty", i18n.languages);
    return true;
  }
  var isNewerI18next = i18n.options.ignoreJSONStructure !== void 0;
  if (!isNewerI18next) {
    return oldI18nextHasLoadedNamespace(ns, i18n, options);
  }
  return i18n.hasLoadedNamespace(ns, {
    precheck: function precheck(i18nInstance2, loadNotPending) {
      if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns))
        return false;
    }
  });
}
var _excluded$8 = ["format"], _excluded2$2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
function ownKeys$d(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$e(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$d(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$d(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function hasChildren(node2, checkLength) {
  if (!node2)
    return false;
  var base = node2.props ? node2.props.children : node2.children;
  if (checkLength)
    return base.length > 0;
  return !!base;
}
function getChildren(node2) {
  if (!node2)
    return [];
  return node2.props ? node2.props.children : node2.children;
}
function hasValidReactChildren(children) {
  if (Object.prototype.toString.call(children) !== "[object Array]")
    return false;
  return children.every(function(child) {
    return reactExports.isValidElement(child);
  });
}
function getAsArray(data) {
  return Array.isArray(data) ? data : [data];
}
function mergeProps$1(source2, target) {
  var newTarget = _objectSpread$e({}, target);
  newTarget.props = Object.assign(source2.props, target.props);
  return newTarget;
}
function nodesToString(children, i18nOptions) {
  if (!children)
    return "";
  var stringNode = "";
  var childrenArray = getAsArray(children);
  var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
  childrenArray.forEach(function(child, childIndex) {
    if (typeof child === "string") {
      stringNode += "".concat(child);
    } else if (reactExports.isValidElement(child)) {
      var childPropsCount = Object.keys(child.props).length;
      var shouldKeepChild = keepArray.indexOf(child.type) > -1;
      var childChildren = child.props.children;
      if (!childChildren && shouldKeepChild && childPropsCount === 0) {
        stringNode += "<".concat(child.type, "/>");
      } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
        stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
      } else if (child.props.i18nIsDynamicList) {
        stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
      } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === "string") {
        stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
      } else {
        var content2 = nodesToString(childChildren, i18nOptions);
        stringNode += "<".concat(childIndex, ">").concat(content2, "</").concat(childIndex, ">");
      }
    } else if (child === null) {
      warn$1("Trans: the passed in value is invalid - seems you passed in a null child.");
    } else if (_typeof$2(child) === "object") {
      var format2 = child.format, clone3 = _objectWithoutProperties$3(child, _excluded$8);
      var keys2 = Object.keys(clone3);
      if (keys2.length === 1) {
        var value2 = format2 ? "".concat(keys2[0], ", ").concat(format2) : keys2[0];
        stringNode += "{{".concat(value2, "}}");
      } else {
        warn$1("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
      }
    } else {
      warn$1("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", child);
    }
  });
  return stringNode;
}
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
  if (targetString === "")
    return [];
  var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
  var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join("|")).test(targetString);
  if (!children && !emptyChildrenButNeedsHandling)
    return [targetString];
  var data = {};
  function getData(childs) {
    var childrenArray = getAsArray(childs);
    childrenArray.forEach(function(child) {
      if (typeof child === "string")
        return;
      if (hasChildren(child))
        getData(getChildren(child));
      else if (_typeof$2(child) === "object" && !reactExports.isValidElement(child))
        Object.assign(data, child);
    });
  }
  getData(children);
  var ast = c$4.parse("<0>".concat(targetString, "</0>"));
  var opts2 = _objectSpread$e(_objectSpread$e({}, data), combinedTOpts);
  function renderInner(child, node2, rootReactNode) {
    var childs = getChildren(child);
    var mappedChildren = mapAST(childs, node2.children, rootReactNode);
    return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
  }
  function pushTranslatedJSX(child, inner, mem, i2, isVoid) {
    if (child.dummy)
      child.children = inner;
    mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
      key: i2
    }), isVoid ? void 0 : inner));
  }
  function mapAST(reactNode, astNode, rootReactNode) {
    var reactNodes = getAsArray(reactNode);
    var astNodes = getAsArray(astNode);
    return astNodes.reduce(function(mem, node2, i2) {
      var translationContent = node2.children && node2.children[0] && node2.children[0].content && i18n.services.interpolator.interpolate(node2.children[0].content, opts2, i18n.language);
      if (node2.type === "tag") {
        var tmp = reactNodes[parseInt(node2.name, 10)];
        if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node2.name])
          tmp = rootReactNode[0][node2.name];
        if (!tmp)
          tmp = {};
        var child = Object.keys(node2.attrs).length !== 0 ? mergeProps$1({
          props: node2.attrs
        }, tmp) : tmp;
        var isElement = reactExports.isValidElement(child);
        var isValidTranslationWithChildren = isElement && hasChildren(node2, true) && !node2.voidElement;
        var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$2(child) === "object" && child.dummy && !isElement;
        var isKnownComponent = _typeof$2(children) === "object" && children !== null && Object.hasOwnProperty.call(children, node2.name);
        if (typeof child === "string") {
          var value2 = i18n.services.interpolator.interpolate(child, opts2, i18n.language);
          mem.push(value2);
        } else if (hasChildren(child) || isValidTranslationWithChildren) {
          var inner = renderInner(child, node2, rootReactNode);
          pushTranslatedJSX(child, inner, mem, i2);
        } else if (isEmptyTransWithHTML) {
          var _inner = mapAST(reactNodes, node2.children, rootReactNode);
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          }), _inner));
        } else if (Number.isNaN(parseFloat(node2.name))) {
          if (isKnownComponent) {
            var _inner2 = renderInner(child, node2, rootReactNode);
            pushTranslatedJSX(child, _inner2, mem, i2, node2.voidElement);
          } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node2.name) > -1) {
            if (node2.voidElement) {
              mem.push(reactExports.createElement(node2.name, {
                key: "".concat(node2.name, "-").concat(i2)
              }));
            } else {
              var _inner3 = mapAST(reactNodes, node2.children, rootReactNode);
              mem.push(reactExports.createElement(node2.name, {
                key: "".concat(node2.name, "-").concat(i2)
              }, _inner3));
            }
          } else if (node2.voidElement) {
            mem.push("<".concat(node2.name, " />"));
          } else {
            var _inner4 = mapAST(reactNodes, node2.children, rootReactNode);
            mem.push("<".concat(node2.name, ">").concat(_inner4, "</").concat(node2.name, ">"));
          }
        } else if (_typeof$2(child) === "object" && !isElement) {
          var content2 = node2.children[0] ? translationContent : null;
          if (content2)
            mem.push(content2);
        } else if (node2.children.length === 1 && translationContent) {
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          }), translationContent));
        } else {
          mem.push(reactExports.cloneElement(child, _objectSpread$e(_objectSpread$e({}, child.props), {}, {
            key: i2
          })));
        }
      } else if (node2.type === "text") {
        var wrapTextNodes = i18nOptions.transWrapTextNodes;
        var _content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node2.content, opts2, i18n.language)) : i18n.services.interpolator.interpolate(node2.content, opts2, i18n.language);
        if (wrapTextNodes) {
          mem.push(reactExports.createElement(wrapTextNodes, {
            key: "".concat(node2.name, "-").concat(i2)
          }, _content));
        } else {
          mem.push(_content);
        }
      }
      return mem;
    }, []);
  }
  var result = mapAST([{
    dummy: true,
    children: children || []
  }], ast, getAsArray(children || []));
  return getChildren(result[0]);
}
function Trans(_ref) {
  var children = _ref.children, count = _ref.count, parent = _ref.parent, i18nKey = _ref.i18nKey, context = _ref.context, _ref$tOptions = _ref.tOptions, tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions, values = _ref.values, defaults2 = _ref.defaults, components2 = _ref.components, ns = _ref.ns, i18nFromProps = _ref.i18n, tFromProps = _ref.t, shouldUnescape = _ref.shouldUnescape, additionalProps = _objectWithoutProperties$3(_ref, _excluded2$2);
  var _ref2 = reactExports.useContext(I18nContext) || {}, i18nFromContext = _ref2.i18n, defaultNSFromContext = _ref2.defaultNS;
  var i18n = i18nFromProps || i18nFromContext || getI18n();
  if (!i18n) {
    warnOnce("You will need to pass in an i18next instance by using i18nextReactModule");
    return children;
  }
  var t2 = tFromProps || i18n.t.bind(i18n) || function(k2) {
    return k2;
  };
  if (context)
    tOptions.context = context;
  var reactI18nextOptions = _objectSpread$e(_objectSpread$e({}, getDefaults()), i18n.options && i18n.options.react);
  var namespaces = ns || t2.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
  namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
  var defaultValue2 = defaults2 || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
  var hashTransKey = reactI18nextOptions.hashTransKey;
  var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue2) : defaultValue2);
  var interpolationOverride = values ? tOptions.interpolation : {
    interpolation: _objectSpread$e(_objectSpread$e({}, tOptions.interpolation), {}, {
      prefix: "#$?",
      suffix: "?$#"
    })
  };
  var combinedTOpts = _objectSpread$e(_objectSpread$e(_objectSpread$e(_objectSpread$e({}, tOptions), {}, {
    count
  }, values), interpolationOverride), {}, {
    defaultValue: defaultValue2,
    ns: namespaces
  });
  var translation = key ? t2(key, combinedTOpts) : defaultValue2;
  var content2 = renderNodes(components2 || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
  var useAsParent = parent !== void 0 ? parent : reactI18nextOptions.defaultTransParent;
  return useAsParent ? reactExports.createElement(useAsParent, additionalProps, content2) : content2;
}
function ownKeys$c(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$d(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$c(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$c(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var usePrevious$2 = function usePrevious(value2, ignore2) {
  var ref = reactExports.useRef();
  reactExports.useEffect(function() {
    ref.current = value2;
  }, [value2, ignore2]);
  return ref.current;
};
function useTranslation(ns) {
  var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
  var i18nFromProps = props.i18n;
  var _ref = reactExports.useContext(I18nContext) || {}, i18nFromContext = _ref.i18n, defaultNSFromContext = _ref.defaultNS;
  var i18n = i18nFromProps || i18nFromContext || getI18n();
  if (i18n && !i18n.reportNamespaces)
    i18n.reportNamespaces = new ReportNamespaces();
  if (!i18n) {
    warnOnce("You will need to pass in an i18next instance by using initReactI18next");
    var notReadyT = function notReadyT2(k2) {
      return Array.isArray(k2) ? k2[k2.length - 1] : k2;
    };
    var retNotReady = [notReadyT, {}, false];
    retNotReady.t = notReadyT;
    retNotReady.i18n = {};
    retNotReady.ready = false;
    return retNotReady;
  }
  if (i18n.options.react && i18n.options.react.wait !== void 0)
    warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
  var i18nOptions = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, getDefaults()), i18n.options.react), props);
  var useSuspense = i18nOptions.useSuspense, keyPrefix = i18nOptions.keyPrefix;
  var namespaces = defaultNSFromContext || i18n.options && i18n.options.defaultNS;
  namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
  if (i18n.reportNamespaces.addUsedNamespaces)
    i18n.reportNamespaces.addUsedNamespaces(namespaces);
  var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function(n2) {
    return hasLoadedNamespace(n2, i18n, i18nOptions);
  });
  function getT() {
    return i18n.getFixedT(null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
  }
  var _useState = reactExports.useState(getT), _useState2 = _slicedToArray(_useState, 2), t2 = _useState2[0], setT = _useState2[1];
  var joinedNS = namespaces.join();
  var previousJoinedNS = usePrevious$2(joinedNS);
  var isMounted = reactExports.useRef(true);
  reactExports.useEffect(function() {
    var bindI18n = i18nOptions.bindI18n, bindI18nStore = i18nOptions.bindI18nStore;
    isMounted.current = true;
    if (!ready && !useSuspense) {
      loadNamespaces(i18n, namespaces, function() {
        if (isMounted.current)
          setT(getT);
      });
    }
    if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
      setT(getT);
    }
    function boundReset() {
      if (isMounted.current)
        setT(getT);
    }
    if (bindI18n && i18n)
      i18n.on(bindI18n, boundReset);
    if (bindI18nStore && i18n)
      i18n.store.on(bindI18nStore, boundReset);
    return function() {
      isMounted.current = false;
      if (bindI18n && i18n)
        bindI18n.split(" ").forEach(function(e2) {
          return i18n.off(e2, boundReset);
        });
      if (bindI18nStore && i18n)
        bindI18nStore.split(" ").forEach(function(e2) {
          return i18n.store.off(e2, boundReset);
        });
    };
  }, [i18n, joinedNS]);
  var isInitial = reactExports.useRef(true);
  reactExports.useEffect(function() {
    if (isMounted.current && !isInitial.current) {
      setT(getT);
    }
    isInitial.current = false;
  }, [i18n, keyPrefix]);
  var ret = [t2, i18n, ready];
  ret.t = t2;
  ret.i18n = i18n;
  ret.ready = ready;
  if (ready)
    return ret;
  if (!ready && !useSuspense)
    return ret;
  throw new Promise(function(resolve2) {
    loadNamespaces(i18n, namespaces, function() {
      resolve2();
    });
  });
}
const Select = ({ dataSource = [], ...props }) => {
  const { t: t2 } = useTranslation();
  const isMultiline = props.selectionMode === "multiple";
  const baseRenderValue = props.renderValue ?? (isMultiline ? (v2) => {
    if (v2.length > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: v2.reduce((s2, x2, i2) => {
        var _a2;
        s2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: props.size ?? void 0, children: ((_a2 = dataSource.find((d2) => {
            var _a3;
            return d2.value === ((_a3 = x2.data) == null ? void 0 : _a3.value);
          })) == null ? void 0 : _a2.label) ?? t2("Unknown label") })
        );
        return s2;
      }, []) });
    }
    return void 0;
  } : void 0);
  const renderValue = baseRenderValue;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    select_default,
    {
      isMultiline,
      items: dataSource ?? [],
      renderValue,
      ...props,
      children: props.children ?? ((data) => {
        var _a2, _b2;
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          listbox_item_base_default,
          {
            "aria-label": (_a2 = data.label) == null ? void 0 : _a2.toString(),
            description: data.description,
            textValue: data.textValue ?? ((_b2 = data.label) == null ? void 0 : _b2.toString()),
            children: data.label
          },
          data.value
        );
      })
    }
  );
};
Select.displayName = "Select";
const Icon = reactExports.forwardRef(({ type: type4, ...otherProps }, ref) => {
  const iconRef = reactExports.useRef(
    reactExports.lazy(
      () => __vitePreload(() => import(
        /* @vite-ignore */
        `@ant-design/icons/es/icons/${type4}.js`
      ), true ? __vite__mapDeps([]) : void 0).catch(
        (err) => __vitePreload(() => Promise.resolve().then(() => WarningOutlined$1), true ? void 0 : void 0)
      )
    )
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}), children: /* @__PURE__ */ jsxRuntimeExports.jsx(iconRef.current, { ref, ...otherProps }) });
});
const Chip = reactExports.forwardRef((props, ref) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(chip_default, { ref, radius: "sm", ...props });
});
const Tooltip$1 = (props) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(tooltip_default, { showArrow: true, ...props, children: props.children });
};
Tooltip$1.displayName = "Tooltip";
var lodash = { exports: {} };
/**
 * @license
 * Lodash <https://lodash.com/>
 * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
 * Released under MIT license <https://lodash.com/license>
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 */
lodash.exports;
(function(module2, exports2) {
  (function() {
    var undefined$1;
    var VERSION2 = "4.17.21";
    var LARGE_ARRAY_SIZE2 = 200;
    var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT2 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
    var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
    var MAX_MEMOIZE_SIZE2 = 500;
    var PLACEHOLDER = "__lodash_placeholder__";
    var CLONE_DEEP_FLAG2 = 1, CLONE_FLAT_FLAG2 = 2, CLONE_SYMBOLS_FLAG2 = 4;
    var COMPARE_PARTIAL_FLAG2 = 1, COMPARE_UNORDERED_FLAG2 = 2;
    var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
    var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
    var HOT_COUNT2 = 800, HOT_SPAN2 = 16;
    var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
    var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER2 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
    var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
    var wrapFlags = [
      ["ary", WRAP_ARY_FLAG],
      ["bind", WRAP_BIND_FLAG],
      ["bindKey", WRAP_BIND_KEY_FLAG],
      ["curry", WRAP_CURRY_FLAG],
      ["curryRight", WRAP_CURRY_RIGHT_FLAG],
      ["flip", WRAP_FLIP_FLAG],
      ["partial", WRAP_PARTIAL_FLAG],
      ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
      ["rearg", WRAP_REARG_FLAG]
    ];
    var argsTag2 = "[object Arguments]", arrayTag2 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag2 = "[object Date]", domExcTag = "[object DOMException]", errorTag2 = "[object Error]", funcTag2 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag2 = "[object Map]", numberTag2 = "[object Number]", nullTag2 = "[object Null]", objectTag2 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag2 = "[object RegExp]", setTag2 = "[object Set]", stringTag2 = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag2 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
    var arrayBufferTag2 = "[object ArrayBuffer]", dataViewTag2 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
    var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
    var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
    var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
    var reIsDeepProp2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp2 = /^\w*$/, rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
    var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
    var reTrimStart2 = /^\s+/;
    var reWhitespace2 = /\s/;
    var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
    var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
    var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
    var reEscapeChar2 = /\\(\\)?/g;
    var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
    var reFlags2 = /\w*$/;
    var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
    var reIsBinary2 = /^0b[01]+$/i;
    var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
    var reIsOctal2 = /^0o[0-7]+$/i;
    var reIsUint2 = /^(?:0|[1-9]\d*)$/;
    var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
    var reNoMatch = /($^)/;
    var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
    var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
    var rsApos = "['’]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
    var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
    var reApos = RegExp(rsApos, "g");
    var reComboMark = RegExp(rsCombo, "g");
    var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
    var reUnicodeWord = RegExp([
      rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
      rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
      rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
      rsUpper + "+" + rsOptContrUpper,
      rsOrdUpper,
      rsOrdLower,
      rsDigits,
      rsEmoji
    ].join("|"), "g");
    var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
    var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
    var contextProps = [
      "Array",
      "Buffer",
      "DataView",
      "Date",
      "Error",
      "Float32Array",
      "Float64Array",
      "Function",
      "Int8Array",
      "Int16Array",
      "Int32Array",
      "Map",
      "Math",
      "Object",
      "Promise",
      "RegExp",
      "Set",
      "String",
      "Symbol",
      "TypeError",
      "Uint8Array",
      "Uint8ClampedArray",
      "Uint16Array",
      "Uint32Array",
      "WeakMap",
      "_",
      "clearTimeout",
      "isFinite",
      "parseInt",
      "setTimeout"
    ];
    var templateCounter = -1;
    var typedArrayTags2 = {};
    typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
    typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false;
    var cloneableTags2 = {};
    cloneableTags2[argsTag2] = cloneableTags2[arrayTag2] = cloneableTags2[arrayBufferTag2] = cloneableTags2[dataViewTag2] = cloneableTags2[boolTag2] = cloneableTags2[dateTag2] = cloneableTags2[float32Tag2] = cloneableTags2[float64Tag2] = cloneableTags2[int8Tag2] = cloneableTags2[int16Tag2] = cloneableTags2[int32Tag2] = cloneableTags2[mapTag2] = cloneableTags2[numberTag2] = cloneableTags2[objectTag2] = cloneableTags2[regexpTag2] = cloneableTags2[setTag2] = cloneableTags2[stringTag2] = cloneableTags2[symbolTag2] = cloneableTags2[uint8Tag2] = cloneableTags2[uint8ClampedTag2] = cloneableTags2[uint16Tag2] = cloneableTags2[uint32Tag2] = true;
    cloneableTags2[errorTag2] = cloneableTags2[funcTag2] = cloneableTags2[weakMapTag2] = false;
    var deburredLetters = {
      // Latin-1 Supplement block.
      "À": "A",
      "Á": "A",
      "Â": "A",
      "Ã": "A",
      "Ä": "A",
      "Å": "A",
      "à": "a",
      "á": "a",
      "â": "a",
      "ã": "a",
      "ä": "a",
      "å": "a",
      "Ç": "C",
      "ç": "c",
      "Ð": "D",
      "ð": "d",
      "È": "E",
      "É": "E",
      "Ê": "E",
      "Ë": "E",
      "è": "e",
      "é": "e",
      "ê": "e",
      "ë": "e",
      "Ì": "I",
      "Í": "I",
      "Î": "I",
      "Ï": "I",
      "ì": "i",
      "í": "i",
      "î": "i",
      "ï": "i",
      "Ñ": "N",
      "ñ": "n",
      "Ò": "O",
      "Ó": "O",
      "Ô": "O",
      "Õ": "O",
      "Ö": "O",
      "Ø": "O",
      "ò": "o",
      "ó": "o",
      "ô": "o",
      "õ": "o",
      "ö": "o",
      "ø": "o",
      "Ù": "U",
      "Ú": "U",
      "Û": "U",
      "Ü": "U",
      "ù": "u",
      "ú": "u",
      "û": "u",
      "ü": "u",
      "Ý": "Y",
      "ý": "y",
      "ÿ": "y",
      "Æ": "Ae",
      "æ": "ae",
      "Þ": "Th",
      "þ": "th",
      "ß": "ss",
      // Latin Extended-A block.
      "Ā": "A",
      "Ă": "A",
      "Ą": "A",
      "ā": "a",
      "ă": "a",
      "ą": "a",
      "Ć": "C",
      "Ĉ": "C",
      "Ċ": "C",
      "Č": "C",
      "ć": "c",
      "ĉ": "c",
      "ċ": "c",
      "č": "c",
      "Ď": "D",
      "Đ": "D",
      "ď": "d",
      "đ": "d",
      "Ē": "E",
      "Ĕ": "E",
      "Ė": "E",
      "Ę": "E",
      "Ě": "E",
      "ē": "e",
      "ĕ": "e",
      "ė": "e",
      "ę": "e",
      "ě": "e",
      "Ĝ": "G",
      "Ğ": "G",
      "Ġ": "G",
      "Ģ": "G",
      "ĝ": "g",
      "ğ": "g",
      "ġ": "g",
      "ģ": "g",
      "Ĥ": "H",
      "Ħ": "H",
      "ĥ": "h",
      "ħ": "h",
      "Ĩ": "I",
      "Ī": "I",
      "Ĭ": "I",
      "Į": "I",
      "İ": "I",
      "ĩ": "i",
      "ī": "i",
      "ĭ": "i",
      "į": "i",
      "ı": "i",
      "Ĵ": "J",
      "ĵ": "j",
      "Ķ": "K",
      "ķ": "k",
      "ĸ": "k",
      "Ĺ": "L",
      "Ļ": "L",
      "Ľ": "L",
      "Ŀ": "L",
      "Ł": "L",
      "ĺ": "l",
      "ļ": "l",
      "ľ": "l",
      "ŀ": "l",
      "ł": "l",
      "Ń": "N",
      "Ņ": "N",
      "Ň": "N",
      "Ŋ": "N",
      "ń": "n",
      "ņ": "n",
      "ň": "n",
      "ŋ": "n",
      "Ō": "O",
      "Ŏ": "O",
      "Ő": "O",
      "ō": "o",
      "ŏ": "o",
      "ő": "o",
      "Ŕ": "R",
      "Ŗ": "R",
      "Ř": "R",
      "ŕ": "r",
      "ŗ": "r",
      "ř": "r",
      "Ś": "S",
      "Ŝ": "S",
      "Ş": "S",
      "Š": "S",
      "ś": "s",
      "ŝ": "s",
      "ş": "s",
      "š": "s",
      "Ţ": "T",
      "Ť": "T",
      "Ŧ": "T",
      "ţ": "t",
      "ť": "t",
      "ŧ": "t",
      "Ũ": "U",
      "Ū": "U",
      "Ŭ": "U",
      "Ů": "U",
      "Ű": "U",
      "Ų": "U",
      "ũ": "u",
      "ū": "u",
      "ŭ": "u",
      "ů": "u",
      "ű": "u",
      "ų": "u",
      "Ŵ": "W",
      "ŵ": "w",
      "Ŷ": "Y",
      "ŷ": "y",
      "Ÿ": "Y",
      "Ź": "Z",
      "Ż": "Z",
      "Ž": "Z",
      "ź": "z",
      "ż": "z",
      "ž": "z",
      "Ĳ": "IJ",
      "ĳ": "ij",
      "Œ": "Oe",
      "œ": "oe",
      "ŉ": "'n",
      "ſ": "s"
    };
    var htmlEscapes = {
      "&": "&amp;",
      "<": "&lt;",
      ">": "&gt;",
      '"': "&quot;",
      "'": "&#39;"
    };
    var htmlUnescapes = {
      "&amp;": "&",
      "&lt;": "<",
      "&gt;": ">",
      "&quot;": '"',
      "&#39;": "'"
    };
    var stringEscapes = {
      "\\": "\\",
      "'": "'",
      "\n": "n",
      "\r": "r",
      "\u2028": "u2028",
      "\u2029": "u2029"
    };
    var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
    var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
    var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
    var root2 = freeGlobal2 || freeSelf2 || Function("return this")();
    var freeExports2 = exports2 && !exports2.nodeType && exports2;
    var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
    var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
    var freeProcess2 = moduleExports2 && freeGlobal2.process;
    var nodeUtil2 = function() {
      try {
        var types2 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
        if (types2) {
          return types2;
        }
        return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
      } catch (e2) {
      }
    }();
    var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap2 = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet2 = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
    function apply2(func, thisArg, args) {
      switch (args.length) {
        case 0:
          return func.call(thisArg);
        case 1:
          return func.call(thisArg, args[0]);
        case 2:
          return func.call(thisArg, args[0], args[1]);
        case 3:
          return func.call(thisArg, args[0], args[1], args[2]);
      }
      return func.apply(thisArg, args);
    }
    function arrayAggregator(array4, setter, iteratee, accumulator) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        var value2 = array4[index2];
        setter(accumulator, value2, iteratee(value2), array4);
      }
      return accumulator;
    }
    function arrayEach2(array4, iteratee) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (iteratee(array4[index2], index2, array4) === false) {
          break;
        }
      }
      return array4;
    }
    function arrayEachRight(array4, iteratee) {
      var length2 = array4 == null ? 0 : array4.length;
      while (length2--) {
        if (iteratee(array4[length2], length2, array4) === false) {
          break;
        }
      }
      return array4;
    }
    function arrayEvery(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (!predicate(array4[index2], index2, array4)) {
          return false;
        }
      }
      return true;
    }
    function arrayFilter2(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
      while (++index2 < length2) {
        var value2 = array4[index2];
        if (predicate(value2, index2, array4)) {
          result[resIndex++] = value2;
        }
      }
      return result;
    }
    function arrayIncludes(array4, value2) {
      var length2 = array4 == null ? 0 : array4.length;
      return !!length2 && baseIndexOf(array4, value2, 0) > -1;
    }
    function arrayIncludesWith(array4, value2, comparator) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (comparator(value2, array4[index2])) {
          return true;
        }
      }
      return false;
    }
    function arrayMap2(array4, iteratee) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
      while (++index2 < length2) {
        result[index2] = iteratee(array4[index2], index2, array4);
      }
      return result;
    }
    function arrayPush2(array4, values) {
      var index2 = -1, length2 = values.length, offset2 = array4.length;
      while (++index2 < length2) {
        array4[offset2 + index2] = values[index2];
      }
      return array4;
    }
    function arrayReduce(array4, iteratee, accumulator, initAccum) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      if (initAccum && length2) {
        accumulator = array4[++index2];
      }
      while (++index2 < length2) {
        accumulator = iteratee(accumulator, array4[index2], index2, array4);
      }
      return accumulator;
    }
    function arrayReduceRight(array4, iteratee, accumulator, initAccum) {
      var length2 = array4 == null ? 0 : array4.length;
      if (initAccum && length2) {
        accumulator = array4[--length2];
      }
      while (length2--) {
        accumulator = iteratee(accumulator, array4[length2], length2, array4);
      }
      return accumulator;
    }
    function arraySome2(array4, predicate) {
      var index2 = -1, length2 = array4 == null ? 0 : array4.length;
      while (++index2 < length2) {
        if (predicate(array4[index2], index2, array4)) {
          return true;
        }
      }
      return false;
    }
    var asciiSize = baseProperty2("length");
    function asciiToArray(string3) {
      return string3.split("");
    }
    function asciiWords(string3) {
      return string3.match(reAsciiWord) || [];
    }
    function baseFindKey(collection, predicate, eachFunc) {
      var result;
      eachFunc(collection, function(value2, key, collection2) {
        if (predicate(value2, key, collection2)) {
          result = key;
          return false;
        }
      });
      return result;
    }
    function baseFindIndex(array4, predicate, fromIndex, fromRight) {
      var length2 = array4.length, index2 = fromIndex + (fromRight ? 1 : -1);
      while (fromRight ? index2-- : ++index2 < length2) {
        if (predicate(array4[index2], index2, array4)) {
          return index2;
        }
      }
      return -1;
    }
    function baseIndexOf(array4, value2, fromIndex) {
      return value2 === value2 ? strictIndexOf(array4, value2, fromIndex) : baseFindIndex(array4, baseIsNaN, fromIndex);
    }
    function baseIndexOfWith(array4, value2, fromIndex, comparator) {
      var index2 = fromIndex - 1, length2 = array4.length;
      while (++index2 < length2) {
        if (comparator(array4[index2], value2)) {
          return index2;
        }
      }
      return -1;
    }
    function baseIsNaN(value2) {
      return value2 !== value2;
    }
    function baseMean(array4, iteratee) {
      var length2 = array4 == null ? 0 : array4.length;
      return length2 ? baseSum(array4, iteratee) / length2 : NAN2;
    }
    function baseProperty2(key) {
      return function(object4) {
        return object4 == null ? undefined$1 : object4[key];
      };
    }
    function basePropertyOf(object4) {
      return function(key) {
        return object4 == null ? undefined$1 : object4[key];
      };
    }
    function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
      eachFunc(collection, function(value2, index2, collection2) {
        accumulator = initAccum ? (initAccum = false, value2) : iteratee(accumulator, value2, index2, collection2);
      });
      return accumulator;
    }
    function baseSortBy(array4, comparer) {
      var length2 = array4.length;
      array4.sort(comparer);
      while (length2--) {
        array4[length2] = array4[length2].value;
      }
      return array4;
    }
    function baseSum(array4, iteratee) {
      var result, index2 = -1, length2 = array4.length;
      while (++index2 < length2) {
        var current = iteratee(array4[index2]);
        if (current !== undefined$1) {
          result = result === undefined$1 ? current : result + current;
        }
      }
      return result;
    }
    function baseTimes2(n2, iteratee) {
      var index2 = -1, result = Array(n2);
      while (++index2 < n2) {
        result[index2] = iteratee(index2);
      }
      return result;
    }
    function baseToPairs(object4, props) {
      return arrayMap2(props, function(key) {
        return [key, object4[key]];
      });
    }
    function baseTrim2(string3) {
      return string3 ? string3.slice(0, trimmedEndIndex2(string3) + 1).replace(reTrimStart2, "") : string3;
    }
    function baseUnary2(func) {
      return function(value2) {
        return func(value2);
      };
    }
    function baseValues(object4, props) {
      return arrayMap2(props, function(key) {
        return object4[key];
      });
    }
    function cacheHas2(cache2, key) {
      return cache2.has(key);
    }
    function charsStartIndex(strSymbols, chrSymbols) {
      var index2 = -1, length2 = strSymbols.length;
      while (++index2 < length2 && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
      }
      return index2;
    }
    function charsEndIndex(strSymbols, chrSymbols) {
      var index2 = strSymbols.length;
      while (index2-- && baseIndexOf(chrSymbols, strSymbols[index2], 0) > -1) {
      }
      return index2;
    }
    function countHolders(array4, placeholder) {
      var length2 = array4.length, result = 0;
      while (length2--) {
        if (array4[length2] === placeholder) {
          ++result;
        }
      }
      return result;
    }
    var deburrLetter = basePropertyOf(deburredLetters);
    var escapeHtmlChar = basePropertyOf(htmlEscapes);
    function escapeStringChar(chr) {
      return "\\" + stringEscapes[chr];
    }
    function getValue2(object4, key) {
      return object4 == null ? undefined$1 : object4[key];
    }
    function hasUnicode(string3) {
      return reHasUnicode.test(string3);
    }
    function hasUnicodeWord(string3) {
      return reHasUnicodeWord.test(string3);
    }
    function iteratorToArray(iterator2) {
      var data, result = [];
      while (!(data = iterator2.next()).done) {
        result.push(data.value);
      }
      return result;
    }
    function mapToArray2(map2) {
      var index2 = -1, result = Array(map2.size);
      map2.forEach(function(value2, key) {
        result[++index2] = [key, value2];
      });
      return result;
    }
    function overArg2(func, transform2) {
      return function(arg) {
        return func(transform2(arg));
      };
    }
    function replaceHolders(array4, placeholder) {
      var index2 = -1, length2 = array4.length, resIndex = 0, result = [];
      while (++index2 < length2) {
        var value2 = array4[index2];
        if (value2 === placeholder || value2 === PLACEHOLDER) {
          array4[index2] = PLACEHOLDER;
          result[resIndex++] = index2;
        }
      }
      return result;
    }
    function setToArray2(set2) {
      var index2 = -1, result = Array(set2.size);
      set2.forEach(function(value2) {
        result[++index2] = value2;
      });
      return result;
    }
    function setToPairs(set2) {
      var index2 = -1, result = Array(set2.size);
      set2.forEach(function(value2) {
        result[++index2] = [value2, value2];
      });
      return result;
    }
    function strictIndexOf(array4, value2, fromIndex) {
      var index2 = fromIndex - 1, length2 = array4.length;
      while (++index2 < length2) {
        if (array4[index2] === value2) {
          return index2;
        }
      }
      return -1;
    }
    function strictLastIndexOf(array4, value2, fromIndex) {
      var index2 = fromIndex + 1;
      while (index2--) {
        if (array4[index2] === value2) {
          return index2;
        }
      }
      return index2;
    }
    function stringSize(string3) {
      return hasUnicode(string3) ? unicodeSize(string3) : asciiSize(string3);
    }
    function stringToArray3(string3) {
      return hasUnicode(string3) ? unicodeToArray(string3) : asciiToArray(string3);
    }
    function trimmedEndIndex2(string3) {
      var index2 = string3.length;
      while (index2-- && reWhitespace2.test(string3.charAt(index2))) {
      }
      return index2;
    }
    var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
    function unicodeSize(string3) {
      var result = reUnicode.lastIndex = 0;
      while (reUnicode.test(string3)) {
        ++result;
      }
      return result;
    }
    function unicodeToArray(string3) {
      return string3.match(reUnicode) || [];
    }
    function unicodeWords(string3) {
      return string3.match(reUnicodeWord) || [];
    }
    var runInContext = function runInContext2(context) {
      context = context == null ? root2 : _24.defaults(root2.Object(), context, _24.pick(root2, contextProps));
      var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
      var arrayProto2 = Array2.prototype, funcProto2 = Function2.prototype, objectProto2 = Object2.prototype;
      var coreJsData2 = context["__core-js_shared__"];
      var funcToString2 = funcProto2.toString;
      var hasOwnProperty2 = objectProto2.hasOwnProperty;
      var idCounter2 = 0;
      var maskSrcKey2 = function() {
        var uid2 = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
        return uid2 ? "Symbol(src)_1." + uid2 : "";
      }();
      var nativeObjectToString2 = objectProto2.toString;
      var objectCtorString2 = funcToString2.call(Object2);
      var oldDash = root2._;
      var reIsNative2 = RegExp2(
        "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
      );
      var Buffer2 = moduleExports2 ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype2 = overArg2(Object2.getPrototypeOf, Object2), objectCreate2 = Object2.create, propertyIsEnumerable2 = objectProto2.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : undefined$1;
      var defineProperty2 = function() {
        try {
          var func = getNative2(Object2, "defineProperty");
          func({}, "", {});
          return func;
        } catch (e2) {
        }
      }();
      var ctxClearTimeout = context.clearTimeout !== root2.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root2.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root2.setTimeout && context.setTimeout;
      var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow2 = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
      var DataView2 = getNative2(context, "DataView"), Map2 = getNative2(context, "Map"), Promise2 = getNative2(context, "Promise"), Set2 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
      var metaMap = WeakMap2 && new WeakMap2();
      var realNames = {};
      var dataViewCtorString2 = toSource2(DataView2), mapCtorString2 = toSource2(Map2), promiseCtorString2 = toSource2(Promise2), setCtorString2 = toSource2(Set2), weakMapCtorString2 = toSource2(WeakMap2);
      var symbolProto2 = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : undefined$1, symbolToString2 = symbolProto2 ? symbolProto2.toString : undefined$1;
      function lodash2(value2) {
        if (isObjectLike2(value2) && !isArray3(value2) && !(value2 instanceof LazyWrapper)) {
          if (value2 instanceof LodashWrapper) {
            return value2;
          }
          if (hasOwnProperty2.call(value2, "__wrapped__")) {
            return wrapperClone(value2);
          }
        }
        return new LodashWrapper(value2);
      }
      var baseCreate2 = /* @__PURE__ */ function() {
        function object4() {
        }
        return function(proto2) {
          if (!isObject2(proto2)) {
            return {};
          }
          if (objectCreate2) {
            return objectCreate2(proto2);
          }
          object4.prototype = proto2;
          var result2 = new object4();
          object4.prototype = undefined$1;
          return result2;
        };
      }();
      function baseLodash() {
      }
      function LodashWrapper(value2, chainAll) {
        this.__wrapped__ = value2;
        this.__actions__ = [];
        this.__chain__ = !!chainAll;
        this.__index__ = 0;
        this.__values__ = undefined$1;
      }
      lodash2.templateSettings = {
        /**
         * Used to detect `data` property values to be HTML-escaped.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "escape": reEscape,
        /**
         * Used to detect code to be evaluated.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "evaluate": reEvaluate,
        /**
         * Used to detect `data` property values to inject.
         *
         * @memberOf _.templateSettings
         * @type {RegExp}
         */
        "interpolate": reInterpolate,
        /**
         * Used to reference the data object in the template text.
         *
         * @memberOf _.templateSettings
         * @type {string}
         */
        "variable": "",
        /**
         * Used to import variables into the compiled template.
         *
         * @memberOf _.templateSettings
         * @type {Object}
         */
        "imports": {
          /**
           * A reference to the `lodash` function.
           *
           * @memberOf _.templateSettings.imports
           * @type {Function}
           */
          "_": lodash2
        }
      };
      lodash2.prototype = baseLodash.prototype;
      lodash2.prototype.constructor = lodash2;
      LodashWrapper.prototype = baseCreate2(baseLodash.prototype);
      LodashWrapper.prototype.constructor = LodashWrapper;
      function LazyWrapper(value2) {
        this.__wrapped__ = value2;
        this.__actions__ = [];
        this.__dir__ = 1;
        this.__filtered__ = false;
        this.__iteratees__ = [];
        this.__takeCount__ = MAX_ARRAY_LENGTH;
        this.__views__ = [];
      }
      function lazyClone() {
        var result2 = new LazyWrapper(this.__wrapped__);
        result2.__actions__ = copyArray2(this.__actions__);
        result2.__dir__ = this.__dir__;
        result2.__filtered__ = this.__filtered__;
        result2.__iteratees__ = copyArray2(this.__iteratees__);
        result2.__takeCount__ = this.__takeCount__;
        result2.__views__ = copyArray2(this.__views__);
        return result2;
      }
      function lazyReverse() {
        if (this.__filtered__) {
          var result2 = new LazyWrapper(this);
          result2.__dir__ = -1;
          result2.__filtered__ = true;
        } else {
          result2 = this.clone();
          result2.__dir__ *= -1;
        }
        return result2;
      }
      function lazyValue() {
        var array4 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray3(array4), isRight = dir < 0, arrLength = isArr ? array4.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length2 = end - start, index2 = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
        if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
          return baseWrapperValue(array4, this.__actions__);
        }
        var result2 = [];
        outer:
          while (length2-- && resIndex < takeCount) {
            index2 += dir;
            var iterIndex = -1, value2 = array4[index2];
            while (++iterIndex < iterLength) {
              var data = iteratees[iterIndex], iteratee2 = data.iteratee, type4 = data.type, computed = iteratee2(value2);
              if (type4 == LAZY_MAP_FLAG) {
                value2 = computed;
              } else if (!computed) {
                if (type4 == LAZY_FILTER_FLAG) {
                  continue outer;
                } else {
                  break outer;
                }
              }
            }
            result2[resIndex++] = value2;
          }
        return result2;
      }
      LazyWrapper.prototype = baseCreate2(baseLodash.prototype);
      LazyWrapper.prototype.constructor = LazyWrapper;
      function Hash2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function hashClear2() {
        this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
        this.size = 0;
      }
      function hashDelete2(key) {
        var result2 = this.has(key) && delete this.__data__[key];
        this.size -= result2 ? 1 : 0;
        return result2;
      }
      function hashGet2(key) {
        var data = this.__data__;
        if (nativeCreate2) {
          var result2 = data[key];
          return result2 === HASH_UNDEFINED2 ? undefined$1 : result2;
        }
        return hasOwnProperty2.call(data, key) ? data[key] : undefined$1;
      }
      function hashHas2(key) {
        var data = this.__data__;
        return nativeCreate2 ? data[key] !== undefined$1 : hasOwnProperty2.call(data, key);
      }
      function hashSet2(key, value2) {
        var data = this.__data__;
        this.size += this.has(key) ? 0 : 1;
        data[key] = nativeCreate2 && value2 === undefined$1 ? HASH_UNDEFINED2 : value2;
        return this;
      }
      Hash2.prototype.clear = hashClear2;
      Hash2.prototype["delete"] = hashDelete2;
      Hash2.prototype.get = hashGet2;
      Hash2.prototype.has = hashHas2;
      Hash2.prototype.set = hashSet2;
      function ListCache2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function listCacheClear2() {
        this.__data__ = [];
        this.size = 0;
      }
      function listCacheDelete2(key) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        if (index2 < 0) {
          return false;
        }
        var lastIndex = data.length - 1;
        if (index2 == lastIndex) {
          data.pop();
        } else {
          splice2.call(data, index2, 1);
        }
        --this.size;
        return true;
      }
      function listCacheGet2(key) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        return index2 < 0 ? undefined$1 : data[index2][1];
      }
      function listCacheHas2(key) {
        return assocIndexOf2(this.__data__, key) > -1;
      }
      function listCacheSet2(key, value2) {
        var data = this.__data__, index2 = assocIndexOf2(data, key);
        if (index2 < 0) {
          ++this.size;
          data.push([key, value2]);
        } else {
          data[index2][1] = value2;
        }
        return this;
      }
      ListCache2.prototype.clear = listCacheClear2;
      ListCache2.prototype["delete"] = listCacheDelete2;
      ListCache2.prototype.get = listCacheGet2;
      ListCache2.prototype.has = listCacheHas2;
      ListCache2.prototype.set = listCacheSet2;
      function MapCache2(entries) {
        var index2 = -1, length2 = entries == null ? 0 : entries.length;
        this.clear();
        while (++index2 < length2) {
          var entry = entries[index2];
          this.set(entry[0], entry[1]);
        }
      }
      function mapCacheClear2() {
        this.size = 0;
        this.__data__ = {
          "hash": new Hash2(),
          "map": new (Map2 || ListCache2)(),
          "string": new Hash2()
        };
      }
      function mapCacheDelete2(key) {
        var result2 = getMapData2(this, key)["delete"](key);
        this.size -= result2 ? 1 : 0;
        return result2;
      }
      function mapCacheGet2(key) {
        return getMapData2(this, key).get(key);
      }
      function mapCacheHas2(key) {
        return getMapData2(this, key).has(key);
      }
      function mapCacheSet2(key, value2) {
        var data = getMapData2(this, key), size3 = data.size;
        data.set(key, value2);
        this.size += data.size == size3 ? 0 : 1;
        return this;
      }
      MapCache2.prototype.clear = mapCacheClear2;
      MapCache2.prototype["delete"] = mapCacheDelete2;
      MapCache2.prototype.get = mapCacheGet2;
      MapCache2.prototype.has = mapCacheHas2;
      MapCache2.prototype.set = mapCacheSet2;
      function SetCache2(values2) {
        var index2 = -1, length2 = values2 == null ? 0 : values2.length;
        this.__data__ = new MapCache2();
        while (++index2 < length2) {
          this.add(values2[index2]);
        }
      }
      function setCacheAdd2(value2) {
        this.__data__.set(value2, HASH_UNDEFINED2);
        return this;
      }
      function setCacheHas2(value2) {
        return this.__data__.has(value2);
      }
      SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
      SetCache2.prototype.has = setCacheHas2;
      function Stack2(entries) {
        var data = this.__data__ = new ListCache2(entries);
        this.size = data.size;
      }
      function stackClear2() {
        this.__data__ = new ListCache2();
        this.size = 0;
      }
      function stackDelete2(key) {
        var data = this.__data__, result2 = data["delete"](key);
        this.size = data.size;
        return result2;
      }
      function stackGet2(key) {
        return this.__data__.get(key);
      }
      function stackHas2(key) {
        return this.__data__.has(key);
      }
      function stackSet2(key, value2) {
        var data = this.__data__;
        if (data instanceof ListCache2) {
          var pairs = data.__data__;
          if (!Map2 || pairs.length < LARGE_ARRAY_SIZE2 - 1) {
            pairs.push([key, value2]);
            this.size = ++data.size;
            return this;
          }
          data = this.__data__ = new MapCache2(pairs);
        }
        data.set(key, value2);
        this.size = data.size;
        return this;
      }
      Stack2.prototype.clear = stackClear2;
      Stack2.prototype["delete"] = stackDelete2;
      Stack2.prototype.get = stackGet2;
      Stack2.prototype.has = stackHas2;
      Stack2.prototype.set = stackSet2;
      function arrayLikeKeys2(value2, inherited) {
        var isArr = isArray3(value2), isArg = !isArr && isArguments2(value2), isBuff = !isArr && !isArg && isBuffer2(value2), isType = !isArr && !isArg && !isBuff && isTypedArray2(value2), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value2.length, String2) : [], length2 = result2.length;
        for (var key in value2) {
          if ((inherited || hasOwnProperty2.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
          (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
          isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
          isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
          isIndex2(key, length2)))) {
            result2.push(key);
          }
        }
        return result2;
      }
      function arraySample(array4) {
        var length2 = array4.length;
        return length2 ? array4[baseRandom(0, length2 - 1)] : undefined$1;
      }
      function arraySampleSize(array4, n2) {
        return shuffleSelf(copyArray2(array4), baseClamp(n2, 0, array4.length));
      }
      function arrayShuffle(array4) {
        return shuffleSelf(copyArray2(array4));
      }
      function assignMergeValue2(object4, key, value2) {
        if (value2 !== undefined$1 && !eq2(object4[key], value2) || value2 === undefined$1 && !(key in object4)) {
          baseAssignValue2(object4, key, value2);
        }
      }
      function assignValue2(object4, key, value2) {
        var objValue = object4[key];
        if (!(hasOwnProperty2.call(object4, key) && eq2(objValue, value2)) || value2 === undefined$1 && !(key in object4)) {
          baseAssignValue2(object4, key, value2);
        }
      }
      function assocIndexOf2(array4, key) {
        var length2 = array4.length;
        while (length2--) {
          if (eq2(array4[length2][0], key)) {
            return length2;
          }
        }
        return -1;
      }
      function baseAggregator(collection, setter, iteratee2, accumulator) {
        baseEach2(collection, function(value2, key, collection2) {
          setter(accumulator, value2, iteratee2(value2), collection2);
        });
        return accumulator;
      }
      function baseAssign2(object4, source2) {
        return object4 && copyObject2(source2, keys2(source2), object4);
      }
      function baseAssignIn2(object4, source2) {
        return object4 && copyObject2(source2, keysIn2(source2), object4);
      }
      function baseAssignValue2(object4, key, value2) {
        if (key == "__proto__" && defineProperty2) {
          defineProperty2(object4, key, {
            "configurable": true,
            "enumerable": true,
            "value": value2,
            "writable": true
          });
        } else {
          object4[key] = value2;
        }
      }
      function baseAt(object4, paths) {
        var index2 = -1, length2 = paths.length, result2 = Array2(length2), skip2 = object4 == null;
        while (++index2 < length2) {
          result2[index2] = skip2 ? undefined$1 : get5(object4, paths[index2]);
        }
        return result2;
      }
      function baseClamp(number4, lower, upper) {
        if (number4 === number4) {
          if (upper !== undefined$1) {
            number4 = number4 <= upper ? number4 : upper;
          }
          if (lower !== undefined$1) {
            number4 = number4 >= lower ? number4 : lower;
          }
        }
        return number4;
      }
      function baseClone2(value2, bitmask, customizer, key, object4, stack) {
        var result2, isDeep = bitmask & CLONE_DEEP_FLAG2, isFlat = bitmask & CLONE_FLAT_FLAG2, isFull = bitmask & CLONE_SYMBOLS_FLAG2;
        if (customizer) {
          result2 = object4 ? customizer(value2, key, object4, stack) : customizer(value2);
        }
        if (result2 !== undefined$1) {
          return result2;
        }
        if (!isObject2(value2)) {
          return value2;
        }
        var isArr = isArray3(value2);
        if (isArr) {
          result2 = initCloneArray2(value2);
          if (!isDeep) {
            return copyArray2(value2, result2);
          }
        } else {
          var tag = getTag2(value2), isFunc = tag == funcTag2 || tag == genTag2;
          if (isBuffer2(value2)) {
            return cloneBuffer2(value2, isDeep);
          }
          if (tag == objectTag2 || tag == argsTag2 || isFunc && !object4) {
            result2 = isFlat || isFunc ? {} : initCloneObject2(value2);
            if (!isDeep) {
              return isFlat ? copySymbolsIn2(value2, baseAssignIn2(result2, value2)) : copySymbols2(value2, baseAssign2(result2, value2));
            }
          } else {
            if (!cloneableTags2[tag]) {
              return object4 ? value2 : {};
            }
            result2 = initCloneByTag2(value2, tag, isDeep);
          }
        }
        stack || (stack = new Stack2());
        var stacked = stack.get(value2);
        if (stacked) {
          return stacked;
        }
        stack.set(value2, result2);
        if (isSet2(value2)) {
          value2.forEach(function(subValue) {
            result2.add(baseClone2(subValue, bitmask, customizer, subValue, value2, stack));
          });
        } else if (isMap2(value2)) {
          value2.forEach(function(subValue, key2) {
            result2.set(key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack));
          });
        }
        var keysFunc = isFull ? isFlat ? getAllKeysIn2 : getAllKeys2 : isFlat ? keysIn2 : keys2;
        var props = isArr ? undefined$1 : keysFunc(value2);
        arrayEach2(props || value2, function(subValue, key2) {
          if (props) {
            key2 = subValue;
            subValue = value2[key2];
          }
          assignValue2(result2, key2, baseClone2(subValue, bitmask, customizer, key2, value2, stack));
        });
        return result2;
      }
      function baseConforms(source2) {
        var props = keys2(source2);
        return function(object4) {
          return baseConformsTo(object4, source2, props);
        };
      }
      function baseConformsTo(object4, source2, props) {
        var length2 = props.length;
        if (object4 == null) {
          return !length2;
        }
        object4 = Object2(object4);
        while (length2--) {
          var key = props[length2], predicate = source2[key], value2 = object4[key];
          if (value2 === undefined$1 && !(key in object4) || !predicate(value2)) {
            return false;
          }
        }
        return true;
      }
      function baseDelay(func, wait, args) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        return setTimeout2(function() {
          func.apply(undefined$1, args);
        }, wait);
      }
      function baseDifference(array4, values2, iteratee2, comparator) {
        var index2 = -1, includes2 = arrayIncludes, isCommon = true, length2 = array4.length, result2 = [], valuesLength = values2.length;
        if (!length2) {
          return result2;
        }
        if (iteratee2) {
          values2 = arrayMap2(values2, baseUnary2(iteratee2));
        }
        if (comparator) {
          includes2 = arrayIncludesWith;
          isCommon = false;
        } else if (values2.length >= LARGE_ARRAY_SIZE2) {
          includes2 = cacheHas2;
          isCommon = false;
          values2 = new SetCache2(values2);
        }
        outer:
          while (++index2 < length2) {
            var value2 = array4[index2], computed = iteratee2 == null ? value2 : iteratee2(value2);
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (isCommon && computed === computed) {
              var valuesIndex = valuesLength;
              while (valuesIndex--) {
                if (values2[valuesIndex] === computed) {
                  continue outer;
                }
              }
              result2.push(value2);
            } else if (!includes2(values2, computed, comparator)) {
              result2.push(value2);
            }
          }
        return result2;
      }
      var baseEach2 = createBaseEach2(baseForOwn2);
      var baseEachRight = createBaseEach2(baseForOwnRight, true);
      function baseEvery(collection, predicate) {
        var result2 = true;
        baseEach2(collection, function(value2, index2, collection2) {
          result2 = !!predicate(value2, index2, collection2);
          return result2;
        });
        return result2;
      }
      function baseExtremum(array4, iteratee2, comparator) {
        var index2 = -1, length2 = array4.length;
        while (++index2 < length2) {
          var value2 = array4[index2], current = iteratee2(value2);
          if (current != null && (computed === undefined$1 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
            var computed = current, result2 = value2;
          }
        }
        return result2;
      }
      function baseFill(array4, value2, start, end) {
        var length2 = array4.length;
        start = toInteger(start);
        if (start < 0) {
          start = -start > length2 ? 0 : length2 + start;
        }
        end = end === undefined$1 || end > length2 ? length2 : toInteger(end);
        if (end < 0) {
          end += length2;
        }
        end = start > end ? 0 : toLength(end);
        while (start < end) {
          array4[start++] = value2;
        }
        return array4;
      }
      function baseFilter(collection, predicate) {
        var result2 = [];
        baseEach2(collection, function(value2, index2, collection2) {
          if (predicate(value2, index2, collection2)) {
            result2.push(value2);
          }
        });
        return result2;
      }
      function baseFlatten(array4, depth, predicate, isStrict, result2) {
        var index2 = -1, length2 = array4.length;
        predicate || (predicate = isFlattenable);
        result2 || (result2 = []);
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (depth > 0 && predicate(value2)) {
            if (depth > 1) {
              baseFlatten(value2, depth - 1, predicate, isStrict, result2);
            } else {
              arrayPush2(result2, value2);
            }
          } else if (!isStrict) {
            result2[result2.length] = value2;
          }
        }
        return result2;
      }
      var baseFor2 = createBaseFor2();
      var baseForRight = createBaseFor2(true);
      function baseForOwn2(object4, iteratee2) {
        return object4 && baseFor2(object4, iteratee2, keys2);
      }
      function baseForOwnRight(object4, iteratee2) {
        return object4 && baseForRight(object4, iteratee2, keys2);
      }
      function baseFunctions(object4, props) {
        return arrayFilter2(props, function(key) {
          return isFunction2(object4[key]);
        });
      }
      function baseGet2(object4, path) {
        path = castPath2(path, object4);
        var index2 = 0, length2 = path.length;
        while (object4 != null && index2 < length2) {
          object4 = object4[toKey2(path[index2++])];
        }
        return index2 && index2 == length2 ? object4 : undefined$1;
      }
      function baseGetAllKeys2(object4, keysFunc, symbolsFunc) {
        var result2 = keysFunc(object4);
        return isArray3(object4) ? result2 : arrayPush2(result2, symbolsFunc(object4));
      }
      function baseGetTag2(value2) {
        if (value2 == null) {
          return value2 === undefined$1 ? undefinedTag2 : nullTag2;
        }
        return symToStringTag2 && symToStringTag2 in Object2(value2) ? getRawTag2(value2) : objectToString2(value2);
      }
      function baseGt(value2, other) {
        return value2 > other;
      }
      function baseHas(object4, key) {
        return object4 != null && hasOwnProperty2.call(object4, key);
      }
      function baseHasIn2(object4, key) {
        return object4 != null && key in Object2(object4);
      }
      function baseInRange(number4, start, end) {
        return number4 >= nativeMin2(start, end) && number4 < nativeMax2(start, end);
      }
      function baseIntersection(arrays, iteratee2, comparator) {
        var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
        while (othIndex--) {
          var array4 = arrays[othIndex];
          if (othIndex && iteratee2) {
            array4 = arrayMap2(array4, baseUnary2(iteratee2));
          }
          maxLength = nativeMin2(array4.length, maxLength);
          caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array4.length >= 120) ? new SetCache2(othIndex && array4) : undefined$1;
        }
        array4 = arrays[0];
        var index2 = -1, seen2 = caches[0];
        outer:
          while (++index2 < length2 && result2.length < maxLength) {
            var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (!(seen2 ? cacheHas2(seen2, computed) : includes2(result2, computed, comparator))) {
              othIndex = othLength;
              while (--othIndex) {
                var cache2 = caches[othIndex];
                if (!(cache2 ? cacheHas2(cache2, computed) : includes2(arrays[othIndex], computed, comparator))) {
                  continue outer;
                }
              }
              if (seen2) {
                seen2.push(computed);
              }
              result2.push(value2);
            }
          }
        return result2;
      }
      function baseInverter(object4, setter, iteratee2, accumulator) {
        baseForOwn2(object4, function(value2, key, object5) {
          setter(accumulator, iteratee2(value2), key, object5);
        });
        return accumulator;
      }
      function baseInvoke(object4, path, args) {
        path = castPath2(path, object4);
        object4 = parent(object4, path);
        var func = object4 == null ? object4 : object4[toKey2(last(path))];
        return func == null ? undefined$1 : apply2(func, object4, args);
      }
      function baseIsArguments2(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == argsTag2;
      }
      function baseIsArrayBuffer(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == arrayBufferTag2;
      }
      function baseIsDate(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == dateTag2;
      }
      function baseIsEqual2(value2, other, bitmask, customizer, stack) {
        if (value2 === other) {
          return true;
        }
        if (value2 == null || other == null || !isObjectLike2(value2) && !isObjectLike2(other)) {
          return value2 !== value2 && other !== other;
        }
        return baseIsEqualDeep2(value2, other, bitmask, customizer, baseIsEqual2, stack);
      }
      function baseIsEqualDeep2(object4, other, bitmask, customizer, equalFunc, stack) {
        var objIsArr = isArray3(object4), othIsArr = isArray3(other), objTag = objIsArr ? arrayTag2 : getTag2(object4), othTag = othIsArr ? arrayTag2 : getTag2(other);
        objTag = objTag == argsTag2 ? objectTag2 : objTag;
        othTag = othTag == argsTag2 ? objectTag2 : othTag;
        var objIsObj = objTag == objectTag2, othIsObj = othTag == objectTag2, isSameTag = objTag == othTag;
        if (isSameTag && isBuffer2(object4)) {
          if (!isBuffer2(other)) {
            return false;
          }
          objIsArr = true;
          objIsObj = false;
        }
        if (isSameTag && !objIsObj) {
          stack || (stack = new Stack2());
          return objIsArr || isTypedArray2(object4) ? equalArrays2(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object4, other, objTag, bitmask, customizer, equalFunc, stack);
        }
        if (!(bitmask & COMPARE_PARTIAL_FLAG2)) {
          var objIsWrapped = objIsObj && hasOwnProperty2.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
          if (objIsWrapped || othIsWrapped) {
            var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
            stack || (stack = new Stack2());
            return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
          }
        }
        if (!isSameTag) {
          return false;
        }
        stack || (stack = new Stack2());
        return equalObjects2(object4, other, bitmask, customizer, equalFunc, stack);
      }
      function baseIsMap2(value2) {
        return isObjectLike2(value2) && getTag2(value2) == mapTag2;
      }
      function baseIsMatch2(object4, source2, matchData, customizer) {
        var index2 = matchData.length, length2 = index2, noCustomizer = !customizer;
        if (object4 == null) {
          return !length2;
        }
        object4 = Object2(object4);
        while (index2--) {
          var data = matchData[index2];
          if (noCustomizer && data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
            return false;
          }
        }
        while (++index2 < length2) {
          data = matchData[index2];
          var key = data[0], objValue = object4[key], srcValue = data[1];
          if (noCustomizer && data[2]) {
            if (objValue === undefined$1 && !(key in object4)) {
              return false;
            }
          } else {
            var stack = new Stack2();
            if (customizer) {
              var result2 = customizer(objValue, srcValue, key, object4, source2, stack);
            }
            if (!(result2 === undefined$1 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG2 | COMPARE_UNORDERED_FLAG2, customizer, stack) : result2)) {
              return false;
            }
          }
        }
        return true;
      }
      function baseIsNative2(value2) {
        if (!isObject2(value2) || isMasked2(value2)) {
          return false;
        }
        var pattern4 = isFunction2(value2) ? reIsNative2 : reIsHostCtor2;
        return pattern4.test(toSource2(value2));
      }
      function baseIsRegExp(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == regexpTag2;
      }
      function baseIsSet2(value2) {
        return isObjectLike2(value2) && getTag2(value2) == setTag2;
      }
      function baseIsTypedArray2(value2) {
        return isObjectLike2(value2) && isLength2(value2.length) && !!typedArrayTags2[baseGetTag2(value2)];
      }
      function baseIteratee2(value2) {
        if (typeof value2 == "function") {
          return value2;
        }
        if (value2 == null) {
          return identity2;
        }
        if (typeof value2 == "object") {
          return isArray3(value2) ? baseMatchesProperty2(value2[0], value2[1]) : baseMatches2(value2);
        }
        return property2(value2);
      }
      function baseKeys2(object4) {
        if (!isPrototype2(object4)) {
          return nativeKeys2(object4);
        }
        var result2 = [];
        for (var key in Object2(object4)) {
          if (hasOwnProperty2.call(object4, key) && key != "constructor") {
            result2.push(key);
          }
        }
        return result2;
      }
      function baseKeysIn2(object4) {
        if (!isObject2(object4)) {
          return nativeKeysIn2(object4);
        }
        var isProto = isPrototype2(object4), result2 = [];
        for (var key in object4) {
          if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object4, key)))) {
            result2.push(key);
          }
        }
        return result2;
      }
      function baseLt(value2, other) {
        return value2 < other;
      }
      function baseMap2(collection, iteratee2) {
        var index2 = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
        baseEach2(collection, function(value2, key, collection2) {
          result2[++index2] = iteratee2(value2, key, collection2);
        });
        return result2;
      }
      function baseMatches2(source2) {
        var matchData = getMatchData2(source2);
        if (matchData.length == 1 && matchData[0][2]) {
          return matchesStrictComparable2(matchData[0][0], matchData[0][1]);
        }
        return function(object4) {
          return object4 === source2 || baseIsMatch2(object4, source2, matchData);
        };
      }
      function baseMatchesProperty2(path, srcValue) {
        if (isKey2(path) && isStrictComparable2(srcValue)) {
          return matchesStrictComparable2(toKey2(path), srcValue);
        }
        return function(object4) {
          var objValue = get5(object4, path);
          return objValue === undefined$1 && objValue === srcValue ? hasIn2(object4, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG2 | COMPARE_UNORDERED_FLAG2);
        };
      }
      function baseMerge2(object4, source2, srcIndex, customizer, stack) {
        if (object4 === source2) {
          return;
        }
        baseFor2(source2, function(srcValue, key) {
          stack || (stack = new Stack2());
          if (isObject2(srcValue)) {
            baseMergeDeep2(object4, source2, key, srcIndex, baseMerge2, customizer, stack);
          } else {
            var newValue = customizer ? customizer(safeGet2(object4, key), srcValue, key + "", object4, source2, stack) : undefined$1;
            if (newValue === undefined$1) {
              newValue = srcValue;
            }
            assignMergeValue2(object4, key, newValue);
          }
        }, keysIn2);
      }
      function baseMergeDeep2(object4, source2, key, srcIndex, mergeFunc, customizer, stack) {
        var objValue = safeGet2(object4, key), srcValue = safeGet2(source2, key), stacked = stack.get(srcValue);
        if (stacked) {
          assignMergeValue2(object4, key, stacked);
          return;
        }
        var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source2, stack) : undefined$1;
        var isCommon = newValue === undefined$1;
        if (isCommon) {
          var isArr = isArray3(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
          newValue = srcValue;
          if (isArr || isBuff || isTyped) {
            if (isArray3(objValue)) {
              newValue = objValue;
            } else if (isArrayLikeObject2(objValue)) {
              newValue = copyArray2(objValue);
            } else if (isBuff) {
              isCommon = false;
              newValue = cloneBuffer2(srcValue, true);
            } else if (isTyped) {
              isCommon = false;
              newValue = cloneTypedArray2(srcValue, true);
            } else {
              newValue = [];
            }
          } else if (isPlainObject3(srcValue) || isArguments2(srcValue)) {
            newValue = objValue;
            if (isArguments2(objValue)) {
              newValue = toPlainObject2(objValue);
            } else if (!isObject2(objValue) || isFunction2(objValue)) {
              newValue = initCloneObject2(srcValue);
            }
          } else {
            isCommon = false;
          }
        }
        if (isCommon) {
          stack.set(srcValue, newValue);
          mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
          stack["delete"](srcValue);
        }
        assignMergeValue2(object4, key, newValue);
      }
      function baseNth(array4, n2) {
        var length2 = array4.length;
        if (!length2) {
          return;
        }
        n2 += n2 < 0 ? length2 : 0;
        return isIndex2(n2, length2) ? array4[n2] : undefined$1;
      }
      function baseOrderBy(collection, iteratees, orders) {
        if (iteratees.length) {
          iteratees = arrayMap2(iteratees, function(iteratee2) {
            if (isArray3(iteratee2)) {
              return function(value2) {
                return baseGet2(value2, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
              };
            }
            return iteratee2;
          });
        } else {
          iteratees = [identity2];
        }
        var index2 = -1;
        iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
        var result2 = baseMap2(collection, function(value2, key, collection2) {
          var criteria = arrayMap2(iteratees, function(iteratee2) {
            return iteratee2(value2);
          });
          return { "criteria": criteria, "index": ++index2, "value": value2 };
        });
        return baseSortBy(result2, function(object4, other) {
          return compareMultiple(object4, other, orders);
        });
      }
      function basePick(object4, paths) {
        return basePickBy(object4, paths, function(value2, path) {
          return hasIn2(object4, path);
        });
      }
      function basePickBy(object4, paths, predicate) {
        var index2 = -1, length2 = paths.length, result2 = {};
        while (++index2 < length2) {
          var path = paths[index2], value2 = baseGet2(object4, path);
          if (predicate(value2, path)) {
            baseSet(result2, castPath2(path, object4), value2);
          }
        }
        return result2;
      }
      function basePropertyDeep2(path) {
        return function(object4) {
          return baseGet2(object4, path);
        };
      }
      function basePullAll(array4, values2, iteratee2, comparator) {
        var indexOf3 = comparator ? baseIndexOfWith : baseIndexOf, index2 = -1, length2 = values2.length, seen2 = array4;
        if (array4 === values2) {
          values2 = copyArray2(values2);
        }
        if (iteratee2) {
          seen2 = arrayMap2(array4, baseUnary2(iteratee2));
        }
        while (++index2 < length2) {
          var fromIndex = 0, value2 = values2[index2], computed = iteratee2 ? iteratee2(value2) : value2;
          while ((fromIndex = indexOf3(seen2, computed, fromIndex, comparator)) > -1) {
            if (seen2 !== array4) {
              splice2.call(seen2, fromIndex, 1);
            }
            splice2.call(array4, fromIndex, 1);
          }
        }
        return array4;
      }
      function basePullAt(array4, indexes) {
        var length2 = array4 ? indexes.length : 0, lastIndex = length2 - 1;
        while (length2--) {
          var index2 = indexes[length2];
          if (length2 == lastIndex || index2 !== previous2) {
            var previous2 = index2;
            if (isIndex2(index2)) {
              splice2.call(array4, index2, 1);
            } else {
              baseUnset(array4, index2);
            }
          }
        }
        return array4;
      }
      function baseRandom(lower, upper) {
        return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
      }
      function baseRange(start, end, step, fromRight) {
        var index2 = -1, length2 = nativeMax2(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length2);
        while (length2--) {
          result2[fromRight ? length2 : ++index2] = start;
          start += step;
        }
        return result2;
      }
      function baseRepeat(string3, n2) {
        var result2 = "";
        if (!string3 || n2 < 1 || n2 > MAX_SAFE_INTEGER2) {
          return result2;
        }
        do {
          if (n2 % 2) {
            result2 += string3;
          }
          n2 = nativeFloor(n2 / 2);
          if (n2) {
            string3 += string3;
          }
        } while (n2);
        return result2;
      }
      function baseRest2(func, start) {
        return setToString2(overRest2(func, start, identity2), func + "");
      }
      function baseSample(collection) {
        return arraySample(values(collection));
      }
      function baseSampleSize(collection, n2) {
        var array4 = values(collection);
        return shuffleSelf(array4, baseClamp(n2, 0, array4.length));
      }
      function baseSet(object4, path, value2, customizer) {
        if (!isObject2(object4)) {
          return object4;
        }
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length, lastIndex = length2 - 1, nested = object4;
        while (nested != null && ++index2 < length2) {
          var key = toKey2(path[index2]), newValue = value2;
          if (key === "__proto__" || key === "constructor" || key === "prototype") {
            return object4;
          }
          if (index2 != lastIndex) {
            var objValue = nested[key];
            newValue = customizer ? customizer(objValue, key, nested) : undefined$1;
            if (newValue === undefined$1) {
              newValue = isObject2(objValue) ? objValue : isIndex2(path[index2 + 1]) ? [] : {};
            }
          }
          assignValue2(nested, key, newValue);
          nested = nested[key];
        }
        return object4;
      }
      var baseSetData = !metaMap ? identity2 : function(func, data) {
        metaMap.set(func, data);
        return func;
      };
      var baseSetToString2 = !defineProperty2 ? identity2 : function(func, string3) {
        return defineProperty2(func, "toString", {
          "configurable": true,
          "enumerable": false,
          "value": constant2(string3),
          "writable": true
        });
      };
      function baseShuffle(collection) {
        return shuffleSelf(values(collection));
      }
      function baseSlice(array4, start, end) {
        var index2 = -1, length2 = array4.length;
        if (start < 0) {
          start = -start > length2 ? 0 : length2 + start;
        }
        end = end > length2 ? length2 : end;
        if (end < 0) {
          end += length2;
        }
        length2 = start > end ? 0 : end - start >>> 0;
        start >>>= 0;
        var result2 = Array2(length2);
        while (++index2 < length2) {
          result2[index2] = array4[index2 + start];
        }
        return result2;
      }
      function baseSome(collection, predicate) {
        var result2;
        baseEach2(collection, function(value2, index2, collection2) {
          result2 = predicate(value2, index2, collection2);
          return !result2;
        });
        return !!result2;
      }
      function baseSortedIndex(array4, value2, retHighest) {
        var low = 0, high = array4 == null ? low : array4.length;
        if (typeof value2 == "number" && value2 === value2 && high <= HALF_MAX_ARRAY_LENGTH) {
          while (low < high) {
            var mid = low + high >>> 1, computed = array4[mid];
            if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value2 : computed < value2)) {
              low = mid + 1;
            } else {
              high = mid;
            }
          }
          return high;
        }
        return baseSortedIndexBy(array4, value2, identity2, retHighest);
      }
      function baseSortedIndexBy(array4, value2, iteratee2, retHighest) {
        var low = 0, high = array4 == null ? 0 : array4.length;
        if (high === 0) {
          return 0;
        }
        value2 = iteratee2(value2);
        var valIsNaN = value2 !== value2, valIsNull = value2 === null, valIsSymbol = isSymbol2(value2), valIsUndefined = value2 === undefined$1;
        while (low < high) {
          var mid = nativeFloor((low + high) / 2), computed = iteratee2(array4[mid]), othIsDefined = computed !== undefined$1, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
          if (valIsNaN) {
            var setLow = retHighest || othIsReflexive;
          } else if (valIsUndefined) {
            setLow = othIsReflexive && (retHighest || othIsDefined);
          } else if (valIsNull) {
            setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
          } else if (valIsSymbol) {
            setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
          } else if (othIsNull || othIsSymbol) {
            setLow = false;
          } else {
            setLow = retHighest ? computed <= value2 : computed < value2;
          }
          if (setLow) {
            low = mid + 1;
          } else {
            high = mid;
          }
        }
        return nativeMin2(high, MAX_ARRAY_INDEX);
      }
      function baseSortedUniq(array4, iteratee2) {
        var index2 = -1, length2 = array4.length, resIndex = 0, result2 = [];
        while (++index2 < length2) {
          var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
          if (!index2 || !eq2(computed, seen2)) {
            var seen2 = computed;
            result2[resIndex++] = value2 === 0 ? 0 : value2;
          }
        }
        return result2;
      }
      function baseToNumber(value2) {
        if (typeof value2 == "number") {
          return value2;
        }
        if (isSymbol2(value2)) {
          return NAN2;
        }
        return +value2;
      }
      function baseToString2(value2) {
        if (typeof value2 == "string") {
          return value2;
        }
        if (isArray3(value2)) {
          return arrayMap2(value2, baseToString2) + "";
        }
        if (isSymbol2(value2)) {
          return symbolToString2 ? symbolToString2.call(value2) : "";
        }
        var result2 = value2 + "";
        return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
      }
      function baseUniq(array4, iteratee2, comparator) {
        var index2 = -1, includes2 = arrayIncludes, length2 = array4.length, isCommon = true, result2 = [], seen2 = result2;
        if (comparator) {
          isCommon = false;
          includes2 = arrayIncludesWith;
        } else if (length2 >= LARGE_ARRAY_SIZE2) {
          var set3 = iteratee2 ? null : createSet(array4);
          if (set3) {
            return setToArray2(set3);
          }
          isCommon = false;
          includes2 = cacheHas2;
          seen2 = new SetCache2();
        } else {
          seen2 = iteratee2 ? [] : result2;
        }
        outer:
          while (++index2 < length2) {
            var value2 = array4[index2], computed = iteratee2 ? iteratee2(value2) : value2;
            value2 = comparator || value2 !== 0 ? value2 : 0;
            if (isCommon && computed === computed) {
              var seenIndex = seen2.length;
              while (seenIndex--) {
                if (seen2[seenIndex] === computed) {
                  continue outer;
                }
              }
              if (iteratee2) {
                seen2.push(computed);
              }
              result2.push(value2);
            } else if (!includes2(seen2, computed, comparator)) {
              if (seen2 !== result2) {
                seen2.push(computed);
              }
              result2.push(value2);
            }
          }
        return result2;
      }
      function baseUnset(object4, path) {
        path = castPath2(path, object4);
        object4 = parent(object4, path);
        return object4 == null || delete object4[toKey2(last(path))];
      }
      function baseUpdate(object4, path, updater, customizer) {
        return baseSet(object4, path, updater(baseGet2(object4, path)), customizer);
      }
      function baseWhile(array4, predicate, isDrop, fromRight) {
        var length2 = array4.length, index2 = fromRight ? length2 : -1;
        while ((fromRight ? index2-- : ++index2 < length2) && predicate(array4[index2], index2, array4)) {
        }
        return isDrop ? baseSlice(array4, fromRight ? 0 : index2, fromRight ? index2 + 1 : length2) : baseSlice(array4, fromRight ? index2 + 1 : 0, fromRight ? length2 : index2);
      }
      function baseWrapperValue(value2, actions) {
        var result2 = value2;
        if (result2 instanceof LazyWrapper) {
          result2 = result2.value();
        }
        return arrayReduce(actions, function(result3, action) {
          return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
        }, result2);
      }
      function baseXor(arrays, iteratee2, comparator) {
        var length2 = arrays.length;
        if (length2 < 2) {
          return length2 ? baseUniq(arrays[0]) : [];
        }
        var index2 = -1, result2 = Array2(length2);
        while (++index2 < length2) {
          var array4 = arrays[index2], othIndex = -1;
          while (++othIndex < length2) {
            if (othIndex != index2) {
              result2[index2] = baseDifference(result2[index2] || array4, arrays[othIndex], iteratee2, comparator);
            }
          }
        }
        return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
      }
      function baseZipObject(props, values2, assignFunc) {
        var index2 = -1, length2 = props.length, valsLength = values2.length, result2 = {};
        while (++index2 < length2) {
          var value2 = index2 < valsLength ? values2[index2] : undefined$1;
          assignFunc(result2, props[index2], value2);
        }
        return result2;
      }
      function castArrayLikeObject(value2) {
        return isArrayLikeObject2(value2) ? value2 : [];
      }
      function castFunction2(value2) {
        return typeof value2 == "function" ? value2 : identity2;
      }
      function castPath2(value2, object4) {
        if (isArray3(value2)) {
          return value2;
        }
        return isKey2(value2, object4) ? [value2] : stringToPath2(toString4(value2));
      }
      var castRest = baseRest2;
      function castSlice(array4, start, end) {
        var length2 = array4.length;
        end = end === undefined$1 ? length2 : end;
        return !start && end >= length2 ? array4 : baseSlice(array4, start, end);
      }
      var clearTimeout2 = ctxClearTimeout || function(id2) {
        return root2.clearTimeout(id2);
      };
      function cloneBuffer2(buffer, isDeep) {
        if (isDeep) {
          return buffer.slice();
        }
        var length2 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
        buffer.copy(result2);
        return result2;
      }
      function cloneArrayBuffer2(arrayBuffer) {
        var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
        new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
        return result2;
      }
      function cloneDataView2(dataView, isDeep) {
        var buffer = isDeep ? cloneArrayBuffer2(dataView.buffer) : dataView.buffer;
        return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
      }
      function cloneRegExp2(regexp4) {
        var result2 = new regexp4.constructor(regexp4.source, reFlags2.exec(regexp4));
        result2.lastIndex = regexp4.lastIndex;
        return result2;
      }
      function cloneSymbol2(symbol) {
        return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
      }
      function cloneTypedArray2(typedArray, isDeep) {
        var buffer = isDeep ? cloneArrayBuffer2(typedArray.buffer) : typedArray.buffer;
        return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
      }
      function compareAscending(value2, other) {
        if (value2 !== other) {
          var valIsDefined = value2 !== undefined$1, valIsNull = value2 === null, valIsReflexive = value2 === value2, valIsSymbol = isSymbol2(value2);
          var othIsDefined = other !== undefined$1, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
          if (!othIsNull && !othIsSymbol && !valIsSymbol && value2 > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
            return 1;
          }
          if (!valIsNull && !valIsSymbol && !othIsSymbol && value2 < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
            return -1;
          }
        }
        return 0;
      }
      function compareMultiple(object4, other, orders) {
        var index2 = -1, objCriteria = object4.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length;
        while (++index2 < length2) {
          var result2 = compareAscending(objCriteria[index2], othCriteria[index2]);
          if (result2) {
            if (index2 >= ordersLength) {
              return result2;
            }
            var order2 = orders[index2];
            return result2 * (order2 == "desc" ? -1 : 1);
          }
        }
        return object4.index - other.index;
      }
      function composeArgs(args, partials, holders, isCurried) {
        var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
        while (++leftIndex < leftLength) {
          result2[leftIndex] = partials[leftIndex];
        }
        while (++argsIndex < holdersLength) {
          if (isUncurried || argsIndex < argsLength) {
            result2[holders[argsIndex]] = args[argsIndex];
          }
        }
        while (rangeLength--) {
          result2[leftIndex++] = args[argsIndex++];
        }
        return result2;
      }
      function composeArgsRight(args, partials, holders, isCurried) {
        var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
        while (++argsIndex < rangeLength) {
          result2[argsIndex] = args[argsIndex];
        }
        var offset2 = argsIndex;
        while (++rightIndex < rightLength) {
          result2[offset2 + rightIndex] = partials[rightIndex];
        }
        while (++holdersIndex < holdersLength) {
          if (isUncurried || argsIndex < argsLength) {
            result2[offset2 + holders[holdersIndex]] = args[argsIndex++];
          }
        }
        return result2;
      }
      function copyArray2(source2, array4) {
        var index2 = -1, length2 = source2.length;
        array4 || (array4 = Array2(length2));
        while (++index2 < length2) {
          array4[index2] = source2[index2];
        }
        return array4;
      }
      function copyObject2(source2, props, object4, customizer) {
        var isNew = !object4;
        object4 || (object4 = {});
        var index2 = -1, length2 = props.length;
        while (++index2 < length2) {
          var key = props[index2];
          var newValue = customizer ? customizer(object4[key], source2[key], key, object4, source2) : undefined$1;
          if (newValue === undefined$1) {
            newValue = source2[key];
          }
          if (isNew) {
            baseAssignValue2(object4, key, newValue);
          } else {
            assignValue2(object4, key, newValue);
          }
        }
        return object4;
      }
      function copySymbols2(source2, object4) {
        return copyObject2(source2, getSymbols2(source2), object4);
      }
      function copySymbolsIn2(source2, object4) {
        return copyObject2(source2, getSymbolsIn2(source2), object4);
      }
      function createAggregator(setter, initializer) {
        return function(collection, iteratee2) {
          var func = isArray3(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
          return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
        };
      }
      function createAssigner2(assigner) {
        return baseRest2(function(object4, sources) {
          var index2 = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined$1, guard = length2 > 2 ? sources[2] : undefined$1;
          customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined$1;
          if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
            customizer = length2 < 3 ? undefined$1 : customizer;
            length2 = 1;
          }
          object4 = Object2(object4);
          while (++index2 < length2) {
            var source2 = sources[index2];
            if (source2) {
              assigner(object4, source2, index2, customizer);
            }
          }
          return object4;
        });
      }
      function createBaseEach2(eachFunc, fromRight) {
        return function(collection, iteratee2) {
          if (collection == null) {
            return collection;
          }
          if (!isArrayLike2(collection)) {
            return eachFunc(collection, iteratee2);
          }
          var length2 = collection.length, index2 = fromRight ? length2 : -1, iterable = Object2(collection);
          while (fromRight ? index2-- : ++index2 < length2) {
            if (iteratee2(iterable[index2], index2, iterable) === false) {
              break;
            }
          }
          return collection;
        };
      }
      function createBaseFor2(fromRight) {
        return function(object4, iteratee2, keysFunc) {
          var index2 = -1, iterable = Object2(object4), props = keysFunc(object4), length2 = props.length;
          while (length2--) {
            var key = props[fromRight ? length2 : ++index2];
            if (iteratee2(iterable[key], key, iterable) === false) {
              break;
            }
          }
          return object4;
        };
      }
      function createBind(func, bitmask, thisArg) {
        var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
        function wrapper() {
          var fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          return fn.apply(isBind ? thisArg : this, arguments);
        }
        return wrapper;
      }
      function createCaseFirst(methodName) {
        return function(string3) {
          string3 = toString4(string3);
          var strSymbols = hasUnicode(string3) ? stringToArray3(string3) : undefined$1;
          var chr = strSymbols ? strSymbols[0] : string3.charAt(0);
          var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string3.slice(1);
          return chr[methodName]() + trailing;
        };
      }
      function createCompounder(callback2) {
        return function(string3) {
          return arrayReduce(words(deburr(string3).replace(reApos, "")), callback2, "");
        };
      }
      function createCtor(Ctor) {
        return function() {
          var args = arguments;
          switch (args.length) {
            case 0:
              return new Ctor();
            case 1:
              return new Ctor(args[0]);
            case 2:
              return new Ctor(args[0], args[1]);
            case 3:
              return new Ctor(args[0], args[1], args[2]);
            case 4:
              return new Ctor(args[0], args[1], args[2], args[3]);
            case 5:
              return new Ctor(args[0], args[1], args[2], args[3], args[4]);
            case 6:
              return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
            case 7:
              return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
          }
          var thisBinding = baseCreate2(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
          return isObject2(result2) ? result2 : thisBinding;
        };
      }
      function createCurry(func, bitmask, arity) {
        var Ctor = createCtor(func);
        function wrapper() {
          var length2 = arguments.length, args = Array2(length2), index2 = length2, placeholder = getHolder(wrapper);
          while (index2--) {
            args[index2] = arguments[index2];
          }
          var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
          length2 -= holders.length;
          if (length2 < arity) {
            return createRecurry(
              func,
              bitmask,
              createHybrid,
              wrapper.placeholder,
              undefined$1,
              args,
              holders,
              undefined$1,
              undefined$1,
              arity - length2
            );
          }
          var fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          return apply2(fn, this, args);
        }
        return wrapper;
      }
      function createFind(findIndexFunc) {
        return function(collection, predicate, fromIndex) {
          var iterable = Object2(collection);
          if (!isArrayLike2(collection)) {
            var iteratee2 = getIteratee(predicate, 3);
            collection = keys2(collection);
            predicate = function(key) {
              return iteratee2(iterable[key], key, iterable);
            };
          }
          var index2 = findIndexFunc(collection, predicate, fromIndex);
          return index2 > -1 ? iterable[iteratee2 ? collection[index2] : index2] : undefined$1;
        };
      }
      function createFlow(fromRight) {
        return flatRest(function(funcs) {
          var length2 = funcs.length, index2 = length2, prereq = LodashWrapper.prototype.thru;
          if (fromRight) {
            funcs.reverse();
          }
          while (index2--) {
            var func = funcs[index2];
            if (typeof func != "function") {
              throw new TypeError2(FUNC_ERROR_TEXT2);
            }
            if (prereq && !wrapper && getFuncName(func) == "wrapper") {
              var wrapper = new LodashWrapper([], true);
            }
          }
          index2 = wrapper ? index2 : length2;
          while (++index2 < length2) {
            func = funcs[index2];
            var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined$1;
            if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
              wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
            } else {
              wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
            }
          }
          return function() {
            var args = arguments, value2 = args[0];
            if (wrapper && args.length == 1 && isArray3(value2)) {
              return wrapper.plant(value2).value();
            }
            var index3 = 0, result2 = length2 ? funcs[index3].apply(this, args) : value2;
            while (++index3 < length2) {
              result2 = funcs[index3].call(this, result2);
            }
            return result2;
          };
        });
      }
      function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
        var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined$1 : createCtor(func);
        function wrapper() {
          var length2 = arguments.length, args = Array2(length2), index2 = length2;
          while (index2--) {
            args[index2] = arguments[index2];
          }
          if (isCurried) {
            var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
          }
          if (partials) {
            args = composeArgs(args, partials, holders, isCurried);
          }
          if (partialsRight) {
            args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
          }
          length2 -= holdersCount;
          if (isCurried && length2 < arity) {
            var newHolders = replaceHolders(args, placeholder);
            return createRecurry(
              func,
              bitmask,
              createHybrid,
              wrapper.placeholder,
              thisArg,
              args,
              newHolders,
              argPos,
              ary2,
              arity - length2
            );
          }
          var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
          length2 = args.length;
          if (argPos) {
            args = reorder(args, argPos);
          } else if (isFlip && length2 > 1) {
            args.reverse();
          }
          if (isAry && ary2 < length2) {
            args.length = ary2;
          }
          if (this && this !== root2 && this instanceof wrapper) {
            fn = Ctor || createCtor(fn);
          }
          return fn.apply(thisBinding, args);
        }
        return wrapper;
      }
      function createInverter(setter, toIteratee) {
        return function(object4, iteratee2) {
          return baseInverter(object4, setter, toIteratee(iteratee2), {});
        };
      }
      function createMathOperation(operator, defaultValue2) {
        return function(value2, other) {
          var result2;
          if (value2 === undefined$1 && other === undefined$1) {
            return defaultValue2;
          }
          if (value2 !== undefined$1) {
            result2 = value2;
          }
          if (other !== undefined$1) {
            if (result2 === undefined$1) {
              return other;
            }
            if (typeof value2 == "string" || typeof other == "string") {
              value2 = baseToString2(value2);
              other = baseToString2(other);
            } else {
              value2 = baseToNumber(value2);
              other = baseToNumber(other);
            }
            result2 = operator(value2, other);
          }
          return result2;
        };
      }
      function createOver(arrayFunc) {
        return flatRest(function(iteratees) {
          iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
          return baseRest2(function(args) {
            var thisArg = this;
            return arrayFunc(iteratees, function(iteratee2) {
              return apply2(iteratee2, thisArg, args);
            });
          });
        });
      }
      function createPadding(length2, chars2) {
        chars2 = chars2 === undefined$1 ? " " : baseToString2(chars2);
        var charsLength = chars2.length;
        if (charsLength < 2) {
          return charsLength ? baseRepeat(chars2, length2) : chars2;
        }
        var result2 = baseRepeat(chars2, nativeCeil(length2 / stringSize(chars2)));
        return hasUnicode(chars2) ? castSlice(stringToArray3(result2), 0, length2).join("") : result2.slice(0, length2);
      }
      function createPartial(func, bitmask, thisArg, partials) {
        var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
        function wrapper() {
          var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root2 && this instanceof wrapper ? Ctor : func;
          while (++leftIndex < leftLength) {
            args[leftIndex] = partials[leftIndex];
          }
          while (argsLength--) {
            args[leftIndex++] = arguments[++argsIndex];
          }
          return apply2(fn, isBind ? thisArg : this, args);
        }
        return wrapper;
      }
      function createRange(fromRight) {
        return function(start, end, step) {
          if (step && typeof step != "number" && isIterateeCall2(start, end, step)) {
            end = step = undefined$1;
          }
          start = toFinite(start);
          if (end === undefined$1) {
            end = start;
            start = 0;
          } else {
            end = toFinite(end);
          }
          step = step === undefined$1 ? start < end ? 1 : -1 : toFinite(step);
          return baseRange(start, end, step, fromRight);
        };
      }
      function createRelationalOperation(operator) {
        return function(value2, other) {
          if (!(typeof value2 == "string" && typeof other == "string")) {
            value2 = toNumber2(value2);
            other = toNumber2(other);
          }
          return operator(value2, other);
        };
      }
      function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
        var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined$1, newHoldersRight = isCurry ? undefined$1 : holders, newPartials = isCurry ? partials : undefined$1, newPartialsRight = isCurry ? undefined$1 : partials;
        bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
        bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
        if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
          bitmask &= -4;
        }
        var newData = [
          func,
          bitmask,
          thisArg,
          newPartials,
          newHolders,
          newPartialsRight,
          newHoldersRight,
          argPos,
          ary2,
          arity
        ];
        var result2 = wrapFunc.apply(undefined$1, newData);
        if (isLaziable(func)) {
          setData(result2, newData);
        }
        result2.placeholder = placeholder;
        return setWrapToString(result2, func, bitmask);
      }
      function createRound(methodName) {
        var func = Math2[methodName];
        return function(number4, precision) {
          number4 = toNumber2(number4);
          precision = precision == null ? 0 : nativeMin2(toInteger(precision), 292);
          if (precision && nativeIsFinite(number4)) {
            var pair = (toString4(number4) + "e").split("e"), value2 = func(pair[0] + "e" + (+pair[1] + precision));
            pair = (toString4(value2) + "e").split("e");
            return +(pair[0] + "e" + (+pair[1] - precision));
          }
          return func(number4);
        };
      }
      var createSet = !(Set2 && 1 / setToArray2(new Set2([, -0]))[1] == INFINITY2) ? noop4 : function(values2) {
        return new Set2(values2);
      };
      function createToPairs(keysFunc) {
        return function(object4) {
          var tag = getTag2(object4);
          if (tag == mapTag2) {
            return mapToArray2(object4);
          }
          if (tag == setTag2) {
            return setToPairs(object4);
          }
          return baseToPairs(object4, keysFunc(object4));
        };
      }
      function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
        var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
        if (!isBindKey && typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        var length2 = partials ? partials.length : 0;
        if (!length2) {
          bitmask &= -97;
          partials = holders = undefined$1;
        }
        ary2 = ary2 === undefined$1 ? ary2 : nativeMax2(toInteger(ary2), 0);
        arity = arity === undefined$1 ? arity : toInteger(arity);
        length2 -= holders ? holders.length : 0;
        if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
          var partialsRight = partials, holdersRight = holders;
          partials = holders = undefined$1;
        }
        var data = isBindKey ? undefined$1 : getData(func);
        var newData = [
          func,
          bitmask,
          thisArg,
          partials,
          holders,
          partialsRight,
          holdersRight,
          argPos,
          ary2,
          arity
        ];
        if (data) {
          mergeData(newData, data);
        }
        func = newData[0];
        bitmask = newData[1];
        thisArg = newData[2];
        partials = newData[3];
        holders = newData[4];
        arity = newData[9] = newData[9] === undefined$1 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length2, 0);
        if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
          bitmask &= -25;
        }
        if (!bitmask || bitmask == WRAP_BIND_FLAG) {
          var result2 = createBind(func, bitmask, thisArg);
        } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
          result2 = createCurry(func, bitmask, arity);
        } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
          result2 = createPartial(func, bitmask, thisArg, partials);
        } else {
          result2 = createHybrid.apply(undefined$1, newData);
        }
        var setter = data ? baseSetData : setData;
        return setWrapToString(setter(result2, newData), func, bitmask);
      }
      function customDefaultsAssignIn(objValue, srcValue, key, object4) {
        if (objValue === undefined$1 || eq2(objValue, objectProto2[key]) && !hasOwnProperty2.call(object4, key)) {
          return srcValue;
        }
        return objValue;
      }
      function customDefaultsMerge(objValue, srcValue, key, object4, source2, stack) {
        if (isObject2(objValue) && isObject2(srcValue)) {
          stack.set(srcValue, objValue);
          baseMerge2(objValue, srcValue, undefined$1, customDefaultsMerge, stack);
          stack["delete"](srcValue);
        }
        return objValue;
      }
      function customOmitClone(value2) {
        return isPlainObject3(value2) ? undefined$1 : value2;
      }
      function equalArrays2(array4, other, bitmask, customizer, equalFunc, stack) {
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, arrLength = array4.length, othLength = other.length;
        if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
          return false;
        }
        var arrStacked = stack.get(array4);
        var othStacked = stack.get(other);
        if (arrStacked && othStacked) {
          return arrStacked == other && othStacked == array4;
        }
        var index2 = -1, result2 = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG2 ? new SetCache2() : undefined$1;
        stack.set(array4, other);
        stack.set(other, array4);
        while (++index2 < arrLength) {
          var arrValue = array4[index2], othValue = other[index2];
          if (customizer) {
            var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
          }
          if (compared !== undefined$1) {
            if (compared) {
              continue;
            }
            result2 = false;
            break;
          }
          if (seen2) {
            if (!arraySome2(other, function(othValue2, othIndex) {
              if (!cacheHas2(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
                return seen2.push(othIndex);
              }
            })) {
              result2 = false;
              break;
            }
          } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
            result2 = false;
            break;
          }
        }
        stack["delete"](array4);
        stack["delete"](other);
        return result2;
      }
      function equalByTag2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
        switch (tag) {
          case dataViewTag2:
            if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
              return false;
            }
            object4 = object4.buffer;
            other = other.buffer;
          case arrayBufferTag2:
            if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object4), new Uint8Array2(other))) {
              return false;
            }
            return true;
          case boolTag2:
          case dateTag2:
          case numberTag2:
            return eq2(+object4, +other);
          case errorTag2:
            return object4.name == other.name && object4.message == other.message;
          case regexpTag2:
          case stringTag2:
            return object4 == other + "";
          case mapTag2:
            var convert2 = mapToArray2;
          case setTag2:
            var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
            convert2 || (convert2 = setToArray2);
            if (object4.size != other.size && !isPartial) {
              return false;
            }
            var stacked = stack.get(object4);
            if (stacked) {
              return stacked == other;
            }
            bitmask |= COMPARE_UNORDERED_FLAG2;
            stack.set(object4, other);
            var result2 = equalArrays2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
            stack["delete"](object4);
            return result2;
          case symbolTag2:
            if (symbolValueOf2) {
              return symbolValueOf2.call(object4) == symbolValueOf2.call(other);
            }
        }
        return false;
      }
      function equalObjects2(object4, other, bitmask, customizer, equalFunc, stack) {
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, objProps = getAllKeys2(object4), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
        if (objLength != othLength && !isPartial) {
          return false;
        }
        var index2 = objLength;
        while (index2--) {
          var key = objProps[index2];
          if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
            return false;
          }
        }
        var objStacked = stack.get(object4);
        var othStacked = stack.get(other);
        if (objStacked && othStacked) {
          return objStacked == other && othStacked == object4;
        }
        var result2 = true;
        stack.set(object4, other);
        stack.set(other, object4);
        var skipCtor = isPartial;
        while (++index2 < objLength) {
          key = objProps[index2];
          var objValue = object4[key], othValue = other[key];
          if (customizer) {
            var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
          }
          if (!(compared === undefined$1 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
            result2 = false;
            break;
          }
          skipCtor || (skipCtor = key == "constructor");
        }
        if (result2 && !skipCtor) {
          var objCtor = object4.constructor, othCtor = other.constructor;
          if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
            result2 = false;
          }
        }
        stack["delete"](object4);
        stack["delete"](other);
        return result2;
      }
      function flatRest(func) {
        return setToString2(overRest2(func, undefined$1, flatten), func + "");
      }
      function getAllKeys2(object4) {
        return baseGetAllKeys2(object4, keys2, getSymbols2);
      }
      function getAllKeysIn2(object4) {
        return baseGetAllKeys2(object4, keysIn2, getSymbolsIn2);
      }
      var getData = !metaMap ? noop4 : function(func) {
        return metaMap.get(func);
      };
      function getFuncName(func) {
        var result2 = func.name + "", array4 = realNames[result2], length2 = hasOwnProperty2.call(realNames, result2) ? array4.length : 0;
        while (length2--) {
          var data = array4[length2], otherFunc = data.func;
          if (otherFunc == null || otherFunc == func) {
            return data.name;
          }
        }
        return result2;
      }
      function getHolder(func) {
        var object4 = hasOwnProperty2.call(lodash2, "placeholder") ? lodash2 : func;
        return object4.placeholder;
      }
      function getIteratee() {
        var result2 = lodash2.iteratee || iteratee;
        result2 = result2 === iteratee ? baseIteratee2 : result2;
        return arguments.length ? result2(arguments[0], arguments[1]) : result2;
      }
      function getMapData2(map3, key) {
        var data = map3.__data__;
        return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
      }
      function getMatchData2(object4) {
        var result2 = keys2(object4), length2 = result2.length;
        while (length2--) {
          var key = result2[length2], value2 = object4[key];
          result2[length2] = [key, value2, isStrictComparable2(value2)];
        }
        return result2;
      }
      function getNative2(object4, key) {
        var value2 = getValue2(object4, key);
        return baseIsNative2(value2) ? value2 : undefined$1;
      }
      function getRawTag2(value2) {
        var isOwn = hasOwnProperty2.call(value2, symToStringTag2), tag = value2[symToStringTag2];
        try {
          value2[symToStringTag2] = undefined$1;
          var unmasked = true;
        } catch (e2) {
        }
        var result2 = nativeObjectToString2.call(value2);
        if (unmasked) {
          if (isOwn) {
            value2[symToStringTag2] = tag;
          } else {
            delete value2[symToStringTag2];
          }
        }
        return result2;
      }
      var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
        if (object4 == null) {
          return [];
        }
        object4 = Object2(object4);
        return arrayFilter2(nativeGetSymbols2(object4), function(symbol) {
          return propertyIsEnumerable2.call(object4, symbol);
        });
      };
      var getSymbolsIn2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
        var result2 = [];
        while (object4) {
          arrayPush2(result2, getSymbols2(object4));
          object4 = getPrototype2(object4);
        }
        return result2;
      };
      var getTag2 = baseGetTag2;
      if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag2 || Map2 && getTag2(new Map2()) != mapTag2 || Promise2 && getTag2(Promise2.resolve()) != promiseTag2 || Set2 && getTag2(new Set2()) != setTag2 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag2) {
        getTag2 = function(value2) {
          var result2 = baseGetTag2(value2), Ctor = result2 == objectTag2 ? value2.constructor : undefined$1, ctorString = Ctor ? toSource2(Ctor) : "";
          if (ctorString) {
            switch (ctorString) {
              case dataViewCtorString2:
                return dataViewTag2;
              case mapCtorString2:
                return mapTag2;
              case promiseCtorString2:
                return promiseTag2;
              case setCtorString2:
                return setTag2;
              case weakMapCtorString2:
                return weakMapTag2;
            }
          }
          return result2;
        };
      }
      function getView(start, end, transforms2) {
        var index2 = -1, length2 = transforms2.length;
        while (++index2 < length2) {
          var data = transforms2[index2], size3 = data.size;
          switch (data.type) {
            case "drop":
              start += size3;
              break;
            case "dropRight":
              end -= size3;
              break;
            case "take":
              end = nativeMin2(end, start + size3);
              break;
            case "takeRight":
              start = nativeMax2(start, end - size3);
              break;
          }
        }
        return { "start": start, "end": end };
      }
      function getWrapDetails(source2) {
        var match5 = source2.match(reWrapDetails);
        return match5 ? match5[1].split(reSplitDetails) : [];
      }
      function hasPath2(object4, path, hasFunc) {
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length, result2 = false;
        while (++index2 < length2) {
          var key = toKey2(path[index2]);
          if (!(result2 = object4 != null && hasFunc(object4, key))) {
            break;
          }
          object4 = object4[key];
        }
        if (result2 || ++index2 != length2) {
          return result2;
        }
        length2 = object4 == null ? 0 : object4.length;
        return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray3(object4) || isArguments2(object4));
      }
      function initCloneArray2(array4) {
        var length2 = array4.length, result2 = new array4.constructor(length2);
        if (length2 && typeof array4[0] == "string" && hasOwnProperty2.call(array4, "index")) {
          result2.index = array4.index;
          result2.input = array4.input;
        }
        return result2;
      }
      function initCloneObject2(object4) {
        return typeof object4.constructor == "function" && !isPrototype2(object4) ? baseCreate2(getPrototype2(object4)) : {};
      }
      function initCloneByTag2(object4, tag, isDeep) {
        var Ctor = object4.constructor;
        switch (tag) {
          case arrayBufferTag2:
            return cloneArrayBuffer2(object4);
          case boolTag2:
          case dateTag2:
            return new Ctor(+object4);
          case dataViewTag2:
            return cloneDataView2(object4, isDeep);
          case float32Tag2:
          case float64Tag2:
          case int8Tag2:
          case int16Tag2:
          case int32Tag2:
          case uint8Tag2:
          case uint8ClampedTag2:
          case uint16Tag2:
          case uint32Tag2:
            return cloneTypedArray2(object4, isDeep);
          case mapTag2:
            return new Ctor();
          case numberTag2:
          case stringTag2:
            return new Ctor(object4);
          case regexpTag2:
            return cloneRegExp2(object4);
          case setTag2:
            return new Ctor();
          case symbolTag2:
            return cloneSymbol2(object4);
        }
      }
      function insertWrapDetails(source2, details) {
        var length2 = details.length;
        if (!length2) {
          return source2;
        }
        var lastIndex = length2 - 1;
        details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
        details = details.join(length2 > 2 ? ", " : " ");
        return source2.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
      }
      function isFlattenable(value2) {
        return isArray3(value2) || isArguments2(value2) || !!(spreadableSymbol && value2 && value2[spreadableSymbol]);
      }
      function isIndex2(value2, length2) {
        var type4 = typeof value2;
        length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
        return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
      }
      function isIterateeCall2(value2, index2, object4) {
        if (!isObject2(object4)) {
          return false;
        }
        var type4 = typeof index2;
        if (type4 == "number" ? isArrayLike2(object4) && isIndex2(index2, object4.length) : type4 == "string" && index2 in object4) {
          return eq2(object4[index2], value2);
        }
        return false;
      }
      function isKey2(value2, object4) {
        if (isArray3(value2)) {
          return false;
        }
        var type4 = typeof value2;
        if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol2(value2)) {
          return true;
        }
        return reIsPlainProp2.test(value2) || !reIsDeepProp2.test(value2) || object4 != null && value2 in Object2(object4);
      }
      function isKeyable2(value2) {
        var type4 = typeof value2;
        return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
      }
      function isLaziable(func) {
        var funcName = getFuncName(func), other = lodash2[funcName];
        if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
          return false;
        }
        if (func === other) {
          return true;
        }
        var data = getData(other);
        return !!data && func === data[0];
      }
      function isMasked2(func) {
        return !!maskSrcKey2 && maskSrcKey2 in func;
      }
      var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
      function isPrototype2(value2) {
        var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto2;
        return value2 === proto2;
      }
      function isStrictComparable2(value2) {
        return value2 === value2 && !isObject2(value2);
      }
      function matchesStrictComparable2(key, srcValue) {
        return function(object4) {
          if (object4 == null) {
            return false;
          }
          return object4[key] === srcValue && (srcValue !== undefined$1 || key in Object2(object4));
        };
      }
      function memoizeCapped2(func) {
        var result2 = memoize2(func, function(key) {
          if (cache2.size === MAX_MEMOIZE_SIZE2) {
            cache2.clear();
          }
          return key;
        });
        var cache2 = result2.cache;
        return result2;
      }
      function mergeData(data, source2) {
        var bitmask = data[1], srcBitmask = source2[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
        var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source2[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source2[7].length <= source2[8] && bitmask == WRAP_CURRY_FLAG;
        if (!(isCommon || isCombo)) {
          return data;
        }
        if (srcBitmask & WRAP_BIND_FLAG) {
          data[2] = source2[2];
          newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
        }
        var value2 = source2[3];
        if (value2) {
          var partials = data[3];
          data[3] = partials ? composeArgs(partials, value2, source2[4]) : value2;
          data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source2[4];
        }
        value2 = source2[5];
        if (value2) {
          partials = data[5];
          data[5] = partials ? composeArgsRight(partials, value2, source2[6]) : value2;
          data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source2[6];
        }
        value2 = source2[7];
        if (value2) {
          data[7] = value2;
        }
        if (srcBitmask & WRAP_ARY_FLAG) {
          data[8] = data[8] == null ? source2[8] : nativeMin2(data[8], source2[8]);
        }
        if (data[9] == null) {
          data[9] = source2[9];
        }
        data[0] = source2[0];
        data[1] = newBitmask;
        return data;
      }
      function nativeKeysIn2(object4) {
        var result2 = [];
        if (object4 != null) {
          for (var key in Object2(object4)) {
            result2.push(key);
          }
        }
        return result2;
      }
      function objectToString2(value2) {
        return nativeObjectToString2.call(value2);
      }
      function overRest2(func, start, transform3) {
        start = nativeMax2(start === undefined$1 ? func.length - 1 : start, 0);
        return function() {
          var args = arguments, index2 = -1, length2 = nativeMax2(args.length - start, 0), array4 = Array2(length2);
          while (++index2 < length2) {
            array4[index2] = args[start + index2];
          }
          index2 = -1;
          var otherArgs = Array2(start + 1);
          while (++index2 < start) {
            otherArgs[index2] = args[index2];
          }
          otherArgs[start] = transform3(array4);
          return apply2(func, this, otherArgs);
        };
      }
      function parent(object4, path) {
        return path.length < 2 ? object4 : baseGet2(object4, baseSlice(path, 0, -1));
      }
      function reorder(array4, indexes) {
        var arrLength = array4.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray2(array4);
        while (length2--) {
          var index2 = indexes[length2];
          array4[length2] = isIndex2(index2, arrLength) ? oldArray[index2] : undefined$1;
        }
        return array4;
      }
      function safeGet2(object4, key) {
        if (key === "constructor" && typeof object4[key] === "function") {
          return;
        }
        if (key == "__proto__") {
          return;
        }
        return object4[key];
      }
      var setData = shortOut2(baseSetData);
      var setTimeout2 = ctxSetTimeout || function(func, wait) {
        return root2.setTimeout(func, wait);
      };
      var setToString2 = shortOut2(baseSetToString2);
      function setWrapToString(wrapper, reference, bitmask) {
        var source2 = reference + "";
        return setToString2(wrapper, insertWrapDetails(source2, updateWrapDetails(getWrapDetails(source2), bitmask)));
      }
      function shortOut2(func) {
        var count = 0, lastCalled = 0;
        return function() {
          var stamp = nativeNow2(), remaining = HOT_SPAN2 - (stamp - lastCalled);
          lastCalled = stamp;
          if (remaining > 0) {
            if (++count >= HOT_COUNT2) {
              return arguments[0];
            }
          } else {
            count = 0;
          }
          return func.apply(undefined$1, arguments);
        };
      }
      function shuffleSelf(array4, size3) {
        var index2 = -1, length2 = array4.length, lastIndex = length2 - 1;
        size3 = size3 === undefined$1 ? length2 : size3;
        while (++index2 < size3) {
          var rand = baseRandom(index2, lastIndex), value2 = array4[rand];
          array4[rand] = array4[index2];
          array4[index2] = value2;
        }
        array4.length = size3;
        return array4;
      }
      var stringToPath2 = memoizeCapped2(function(string3) {
        var result2 = [];
        if (string3.charCodeAt(0) === 46) {
          result2.push("");
        }
        string3.replace(rePropName2, function(match5, number4, quote, subString) {
          result2.push(quote ? subString.replace(reEscapeChar2, "$1") : number4 || match5);
        });
        return result2;
      });
      function toKey2(value2) {
        if (typeof value2 == "string" || isSymbol2(value2)) {
          return value2;
        }
        var result2 = value2 + "";
        return result2 == "0" && 1 / value2 == -INFINITY2 ? "-0" : result2;
      }
      function toSource2(func) {
        if (func != null) {
          try {
            return funcToString2.call(func);
          } catch (e2) {
          }
          try {
            return func + "";
          } catch (e2) {
          }
        }
        return "";
      }
      function updateWrapDetails(details, bitmask) {
        arrayEach2(wrapFlags, function(pair) {
          var value2 = "_." + pair[0];
          if (bitmask & pair[1] && !arrayIncludes(details, value2)) {
            details.push(value2);
          }
        });
        return details.sort();
      }
      function wrapperClone(wrapper) {
        if (wrapper instanceof LazyWrapper) {
          return wrapper.clone();
        }
        var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
        result2.__actions__ = copyArray2(wrapper.__actions__);
        result2.__index__ = wrapper.__index__;
        result2.__values__ = wrapper.__values__;
        return result2;
      }
      function chunk(array4, size3, guard) {
        if (guard ? isIterateeCall2(array4, size3, guard) : size3 === undefined$1) {
          size3 = 1;
        } else {
          size3 = nativeMax2(toInteger(size3), 0);
        }
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2 || size3 < 1) {
          return [];
        }
        var index2 = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size3));
        while (index2 < length2) {
          result2[resIndex++] = baseSlice(array4, index2, index2 += size3);
        }
        return result2;
      }
      function compact(array4) {
        var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result2 = [];
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (value2) {
            result2[resIndex++] = value2;
          }
        }
        return result2;
      }
      function concat() {
        var length2 = arguments.length;
        if (!length2) {
          return [];
        }
        var args = Array2(length2 - 1), array4 = arguments[0], index2 = length2;
        while (index2--) {
          args[index2 - 1] = arguments[index2];
        }
        return arrayPush2(isArray3(array4) ? copyArray2(array4) : [array4], baseFlatten(args, 1));
      }
      var difference = baseRest2(function(array4, values2) {
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true)) : [];
      });
      var differenceBy = baseRest2(function(array4, values2) {
        var iteratee2 = last(values2);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2)) : [];
      });
      var differenceWith = baseRest2(function(array4, values2) {
        var comparator = last(values2);
        if (isArrayLikeObject2(comparator)) {
          comparator = undefined$1;
        }
        return isArrayLikeObject2(array4) ? baseDifference(array4, baseFlatten(values2, 1, isArrayLikeObject2, true), undefined$1, comparator) : [];
      });
      function drop(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        return baseSlice(array4, n2 < 0 ? 0 : n2, length2);
      }
      function dropRight(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        n2 = length2 - n2;
        return baseSlice(array4, 0, n2 < 0 ? 0 : n2);
      }
      function dropRightWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), true, true) : [];
      }
      function dropWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), true) : [];
      }
      function fill2(array4, value2, start, end) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        if (start && typeof start != "number" && isIterateeCall2(array4, value2, start)) {
          start = 0;
          end = length2;
        }
        return baseFill(array4, value2, start, end);
      }
      function findIndex(array4, predicate, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
        if (index2 < 0) {
          index2 = nativeMax2(length2 + index2, 0);
        }
        return baseFindIndex(array4, getIteratee(predicate, 3), index2);
      }
      function findLastIndex(array4, predicate, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = length2 - 1;
        if (fromIndex !== undefined$1) {
          index2 = toInteger(fromIndex);
          index2 = fromIndex < 0 ? nativeMax2(length2 + index2, 0) : nativeMin2(index2, length2 - 1);
        }
        return baseFindIndex(array4, getIteratee(predicate, 3), index2, true);
      }
      function flatten(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseFlatten(array4, 1) : [];
      }
      function flattenDeep(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseFlatten(array4, INFINITY2) : [];
      }
      function flattenDepth(array4, depth) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        depth = depth === undefined$1 ? 1 : toInteger(depth);
        return baseFlatten(array4, depth);
      }
      function fromPairs(pairs) {
        var index2 = -1, length2 = pairs == null ? 0 : pairs.length, result2 = {};
        while (++index2 < length2) {
          var pair = pairs[index2];
          result2[pair[0]] = pair[1];
        }
        return result2;
      }
      function head(array4) {
        return array4 && array4.length ? array4[0] : undefined$1;
      }
      function indexOf2(array4, value2, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = fromIndex == null ? 0 : toInteger(fromIndex);
        if (index2 < 0) {
          index2 = nativeMax2(length2 + index2, 0);
        }
        return baseIndexOf(array4, value2, index2);
      }
      function initial(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseSlice(array4, 0, -1) : [];
      }
      var intersection = baseRest2(function(arrays) {
        var mapped = arrayMap2(arrays, castArrayLikeObject);
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
      });
      var intersectionBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
        if (iteratee2 === last(mapped)) {
          iteratee2 = undefined$1;
        } else {
          mapped.pop();
        }
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
      });
      var intersectionWith = baseRest2(function(arrays) {
        var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        if (comparator) {
          mapped.pop();
        }
        return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined$1, comparator) : [];
      });
      function join2(array4, separator) {
        return array4 == null ? "" : nativeJoin.call(array4, separator);
      }
      function last(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? array4[length2 - 1] : undefined$1;
      }
      function lastIndexOf(array4, value2, fromIndex) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return -1;
        }
        var index2 = length2;
        if (fromIndex !== undefined$1) {
          index2 = toInteger(fromIndex);
          index2 = index2 < 0 ? nativeMax2(length2 + index2, 0) : nativeMin2(index2, length2 - 1);
        }
        return value2 === value2 ? strictLastIndexOf(array4, value2, index2) : baseFindIndex(array4, baseIsNaN, index2, true);
      }
      function nth(array4, n2) {
        return array4 && array4.length ? baseNth(array4, toInteger(n2)) : undefined$1;
      }
      var pull = baseRest2(pullAll);
      function pullAll(array4, values2) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2) : array4;
      }
      function pullAllBy(array4, values2, iteratee2) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2, getIteratee(iteratee2, 2)) : array4;
      }
      function pullAllWith(array4, values2, comparator) {
        return array4 && array4.length && values2 && values2.length ? basePullAll(array4, values2, undefined$1, comparator) : array4;
      }
      var pullAt = flatRest(function(array4, indexes) {
        var length2 = array4 == null ? 0 : array4.length, result2 = baseAt(array4, indexes);
        basePullAt(array4, arrayMap2(indexes, function(index2) {
          return isIndex2(index2, length2) ? +index2 : index2;
        }).sort(compareAscending));
        return result2;
      });
      function remove(array4, predicate) {
        var result2 = [];
        if (!(array4 && array4.length)) {
          return result2;
        }
        var index2 = -1, indexes = [], length2 = array4.length;
        predicate = getIteratee(predicate, 3);
        while (++index2 < length2) {
          var value2 = array4[index2];
          if (predicate(value2, index2, array4)) {
            result2.push(value2);
            indexes.push(index2);
          }
        }
        basePullAt(array4, indexes);
        return result2;
      }
      function reverse(array4) {
        return array4 == null ? array4 : nativeReverse.call(array4);
      }
      function slice2(array4, start, end) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        if (end && typeof end != "number" && isIterateeCall2(array4, start, end)) {
          start = 0;
          end = length2;
        } else {
          start = start == null ? 0 : toInteger(start);
          end = end === undefined$1 ? length2 : toInteger(end);
        }
        return baseSlice(array4, start, end);
      }
      function sortedIndex(array4, value2) {
        return baseSortedIndex(array4, value2);
      }
      function sortedIndexBy(array4, value2, iteratee2) {
        return baseSortedIndexBy(array4, value2, getIteratee(iteratee2, 2));
      }
      function sortedIndexOf(array4, value2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (length2) {
          var index2 = baseSortedIndex(array4, value2);
          if (index2 < length2 && eq2(array4[index2], value2)) {
            return index2;
          }
        }
        return -1;
      }
      function sortedLastIndex(array4, value2) {
        return baseSortedIndex(array4, value2, true);
      }
      function sortedLastIndexBy(array4, value2, iteratee2) {
        return baseSortedIndexBy(array4, value2, getIteratee(iteratee2, 2), true);
      }
      function sortedLastIndexOf(array4, value2) {
        var length2 = array4 == null ? 0 : array4.length;
        if (length2) {
          var index2 = baseSortedIndex(array4, value2, true) - 1;
          if (eq2(array4[index2], value2)) {
            return index2;
          }
        }
        return -1;
      }
      function sortedUniq(array4) {
        return array4 && array4.length ? baseSortedUniq(array4) : [];
      }
      function sortedUniqBy(array4, iteratee2) {
        return array4 && array4.length ? baseSortedUniq(array4, getIteratee(iteratee2, 2)) : [];
      }
      function tail(array4) {
        var length2 = array4 == null ? 0 : array4.length;
        return length2 ? baseSlice(array4, 1, length2) : [];
      }
      function take(array4, n2, guard) {
        if (!(array4 && array4.length)) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        return baseSlice(array4, 0, n2 < 0 ? 0 : n2);
      }
      function takeRight(array4, n2, guard) {
        var length2 = array4 == null ? 0 : array4.length;
        if (!length2) {
          return [];
        }
        n2 = guard || n2 === undefined$1 ? 1 : toInteger(n2);
        n2 = length2 - n2;
        return baseSlice(array4, n2 < 0 ? 0 : n2, length2);
      }
      function takeRightWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3), false, true) : [];
      }
      function takeWhile(array4, predicate) {
        return array4 && array4.length ? baseWhile(array4, getIteratee(predicate, 3)) : [];
      }
      var union = baseRest2(function(arrays) {
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true));
      });
      var unionBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), getIteratee(iteratee2, 2));
      });
      var unionWith = baseRest2(function(arrays) {
        var comparator = last(arrays);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject2, true), undefined$1, comparator);
      });
      function uniq(array4) {
        return array4 && array4.length ? baseUniq(array4) : [];
      }
      function uniqBy(array4, iteratee2) {
        return array4 && array4.length ? baseUniq(array4, getIteratee(iteratee2, 2)) : [];
      }
      function uniqWith(array4, comparator) {
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return array4 && array4.length ? baseUniq(array4, undefined$1, comparator) : [];
      }
      function unzip(array4) {
        if (!(array4 && array4.length)) {
          return [];
        }
        var length2 = 0;
        array4 = arrayFilter2(array4, function(group) {
          if (isArrayLikeObject2(group)) {
            length2 = nativeMax2(group.length, length2);
            return true;
          }
        });
        return baseTimes2(length2, function(index2) {
          return arrayMap2(array4, baseProperty2(index2));
        });
      }
      function unzipWith(array4, iteratee2) {
        if (!(array4 && array4.length)) {
          return [];
        }
        var result2 = unzip(array4);
        if (iteratee2 == null) {
          return result2;
        }
        return arrayMap2(result2, function(group) {
          return apply2(iteratee2, undefined$1, group);
        });
      }
      var without = baseRest2(function(array4, values2) {
        return isArrayLikeObject2(array4) ? baseDifference(array4, values2) : [];
      });
      var xor = baseRest2(function(arrays) {
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2));
      });
      var xorBy = baseRest2(function(arrays) {
        var iteratee2 = last(arrays);
        if (isArrayLikeObject2(iteratee2)) {
          iteratee2 = undefined$1;
        }
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2), getIteratee(iteratee2, 2));
      });
      var xorWith = baseRest2(function(arrays) {
        var comparator = last(arrays);
        comparator = typeof comparator == "function" ? comparator : undefined$1;
        return baseXor(arrayFilter2(arrays, isArrayLikeObject2), undefined$1, comparator);
      });
      var zip = baseRest2(unzip);
      function zipObject(props, values2) {
        return baseZipObject(props || [], values2 || [], assignValue2);
      }
      function zipObjectDeep(props, values2) {
        return baseZipObject(props || [], values2 || [], baseSet);
      }
      var zipWith = baseRest2(function(arrays) {
        var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined$1;
        iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined$1;
        return unzipWith(arrays, iteratee2);
      });
      function chain2(value2) {
        var result2 = lodash2(value2);
        result2.__chain__ = true;
        return result2;
      }
      function tap(value2, interceptor) {
        interceptor(value2);
        return value2;
      }
      function thru(value2, interceptor) {
        return interceptor(value2);
      }
      var wrapperAt = flatRest(function(paths) {
        var length2 = paths.length, start = length2 ? paths[0] : 0, value2 = this.__wrapped__, interceptor = function(object4) {
          return baseAt(object4, paths);
        };
        if (length2 > 1 || this.__actions__.length || !(value2 instanceof LazyWrapper) || !isIndex2(start)) {
          return this.thru(interceptor);
        }
        value2 = value2.slice(start, +start + (length2 ? 1 : 0));
        value2.__actions__.push({
          "func": thru,
          "args": [interceptor],
          "thisArg": undefined$1
        });
        return new LodashWrapper(value2, this.__chain__).thru(function(array4) {
          if (length2 && !array4.length) {
            array4.push(undefined$1);
          }
          return array4;
        });
      });
      function wrapperChain() {
        return chain2(this);
      }
      function wrapperCommit() {
        return new LodashWrapper(this.value(), this.__chain__);
      }
      function wrapperNext() {
        if (this.__values__ === undefined$1) {
          this.__values__ = toArray2(this.value());
        }
        var done = this.__index__ >= this.__values__.length, value2 = done ? undefined$1 : this.__values__[this.__index__++];
        return { "done": done, "value": value2 };
      }
      function wrapperToIterator() {
        return this;
      }
      function wrapperPlant(value2) {
        var result2, parent2 = this;
        while (parent2 instanceof baseLodash) {
          var clone4 = wrapperClone(parent2);
          clone4.__index__ = 0;
          clone4.__values__ = undefined$1;
          if (result2) {
            previous2.__wrapped__ = clone4;
          } else {
            result2 = clone4;
          }
          var previous2 = clone4;
          parent2 = parent2.__wrapped__;
        }
        previous2.__wrapped__ = value2;
        return result2;
      }
      function wrapperReverse() {
        var value2 = this.__wrapped__;
        if (value2 instanceof LazyWrapper) {
          var wrapped = value2;
          if (this.__actions__.length) {
            wrapped = new LazyWrapper(this);
          }
          wrapped = wrapped.reverse();
          wrapped.__actions__.push({
            "func": thru,
            "args": [reverse],
            "thisArg": undefined$1
          });
          return new LodashWrapper(wrapped, this.__chain__);
        }
        return this.thru(reverse);
      }
      function wrapperValue() {
        return baseWrapperValue(this.__wrapped__, this.__actions__);
      }
      var countBy = createAggregator(function(result2, value2, key) {
        if (hasOwnProperty2.call(result2, key)) {
          ++result2[key];
        } else {
          baseAssignValue2(result2, key, 1);
        }
      });
      function every(collection, predicate, guard) {
        var func = isArray3(collection) ? arrayEvery : baseEvery;
        if (guard && isIterateeCall2(collection, predicate, guard)) {
          predicate = undefined$1;
        }
        return func(collection, getIteratee(predicate, 3));
      }
      function filter3(collection, predicate) {
        var func = isArray3(collection) ? arrayFilter2 : baseFilter;
        return func(collection, getIteratee(predicate, 3));
      }
      var find2 = createFind(findIndex);
      var findLast = createFind(findLastIndex);
      function flatMap(collection, iteratee2) {
        return baseFlatten(map2(collection, iteratee2), 1);
      }
      function flatMapDeep(collection, iteratee2) {
        return baseFlatten(map2(collection, iteratee2), INFINITY2);
      }
      function flatMapDepth(collection, iteratee2, depth) {
        depth = depth === undefined$1 ? 1 : toInteger(depth);
        return baseFlatten(map2(collection, iteratee2), depth);
      }
      function forEach2(collection, iteratee2) {
        var func = isArray3(collection) ? arrayEach2 : baseEach2;
        return func(collection, getIteratee(iteratee2, 3));
      }
      function forEachRight(collection, iteratee2) {
        var func = isArray3(collection) ? arrayEachRight : baseEachRight;
        return func(collection, getIteratee(iteratee2, 3));
      }
      var groupBy = createAggregator(function(result2, value2, key) {
        if (hasOwnProperty2.call(result2, key)) {
          result2[key].push(value2);
        } else {
          baseAssignValue2(result2, key, [value2]);
        }
      });
      function includes(collection, value2, fromIndex, guard) {
        collection = isArrayLike2(collection) ? collection : values(collection);
        fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
        var length2 = collection.length;
        if (fromIndex < 0) {
          fromIndex = nativeMax2(length2 + fromIndex, 0);
        }
        return isString2(collection) ? fromIndex <= length2 && collection.indexOf(value2, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value2, fromIndex) > -1;
      }
      var invokeMap = baseRest2(function(collection, path, args) {
        var index2 = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
        baseEach2(collection, function(value2) {
          result2[++index2] = isFunc ? apply2(path, value2, args) : baseInvoke(value2, path, args);
        });
        return result2;
      });
      var keyBy = createAggregator(function(result2, value2, key) {
        baseAssignValue2(result2, key, value2);
      });
      function map2(collection, iteratee2) {
        var func = isArray3(collection) ? arrayMap2 : baseMap2;
        return func(collection, getIteratee(iteratee2, 3));
      }
      function orderBy(collection, iteratees, orders, guard) {
        if (collection == null) {
          return [];
        }
        if (!isArray3(iteratees)) {
          iteratees = iteratees == null ? [] : [iteratees];
        }
        orders = guard ? undefined$1 : orders;
        if (!isArray3(orders)) {
          orders = orders == null ? [] : [orders];
        }
        return baseOrderBy(collection, iteratees, orders);
      }
      var partition = createAggregator(function(result2, value2, key) {
        result2[key ? 0 : 1].push(value2);
      }, function() {
        return [[], []];
      });
      function reduce(collection, iteratee2, accumulator) {
        var func = isArray3(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
        return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach2);
      }
      function reduceRight(collection, iteratee2, accumulator) {
        var func = isArray3(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
        return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
      }
      function reject(collection, predicate) {
        var func = isArray3(collection) ? arrayFilter2 : baseFilter;
        return func(collection, negate(getIteratee(predicate, 3)));
      }
      function sample2(collection) {
        var func = isArray3(collection) ? arraySample : baseSample;
        return func(collection);
      }
      function sampleSize(collection, n2, guard) {
        if (guard ? isIterateeCall2(collection, n2, guard) : n2 === undefined$1) {
          n2 = 1;
        } else {
          n2 = toInteger(n2);
        }
        var func = isArray3(collection) ? arraySampleSize : baseSampleSize;
        return func(collection, n2);
      }
      function shuffle(collection) {
        var func = isArray3(collection) ? arrayShuffle : baseShuffle;
        return func(collection);
      }
      function size2(collection) {
        if (collection == null) {
          return 0;
        }
        if (isArrayLike2(collection)) {
          return isString2(collection) ? stringSize(collection) : collection.length;
        }
        var tag = getTag2(collection);
        if (tag == mapTag2 || tag == setTag2) {
          return collection.size;
        }
        return baseKeys2(collection).length;
      }
      function some2(collection, predicate, guard) {
        var func = isArray3(collection) ? arraySome2 : baseSome;
        if (guard && isIterateeCall2(collection, predicate, guard)) {
          predicate = undefined$1;
        }
        return func(collection, getIteratee(predicate, 3));
      }
      var sortBy = baseRest2(function(collection, iteratees) {
        if (collection == null) {
          return [];
        }
        var length2 = iteratees.length;
        if (length2 > 1 && isIterateeCall2(collection, iteratees[0], iteratees[1])) {
          iteratees = [];
        } else if (length2 > 2 && isIterateeCall2(iteratees[0], iteratees[1], iteratees[2])) {
          iteratees = [iteratees[0]];
        }
        return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
      });
      var now2 = ctxNow || function() {
        return root2.Date.now();
      };
      function after(n2, func) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        n2 = toInteger(n2);
        return function() {
          if (--n2 < 1) {
            return func.apply(this, arguments);
          }
        };
      }
      function ary(func, n2, guard) {
        n2 = guard ? undefined$1 : n2;
        n2 = func && n2 == null ? func.length : n2;
        return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n2);
      }
      function before(n2, func) {
        var result2;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        n2 = toInteger(n2);
        return function() {
          if (--n2 > 0) {
            result2 = func.apply(this, arguments);
          }
          if (n2 <= 1) {
            func = undefined$1;
          }
          return result2;
        };
      }
      var bind2 = baseRest2(function(func, thisArg, partials) {
        var bitmask = WRAP_BIND_FLAG;
        if (partials.length) {
          var holders = replaceHolders(partials, getHolder(bind2));
          bitmask |= WRAP_PARTIAL_FLAG;
        }
        return createWrap(func, bitmask, thisArg, partials, holders);
      });
      var bindKey = baseRest2(function(object4, key, partials) {
        var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
        if (partials.length) {
          var holders = replaceHolders(partials, getHolder(bindKey));
          bitmask |= WRAP_PARTIAL_FLAG;
        }
        return createWrap(key, bitmask, object4, partials, holders);
      });
      function curry(func, arity, guard) {
        arity = guard ? undefined$1 : arity;
        var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
        result2.placeholder = curry.placeholder;
        return result2;
      }
      function curryRight(func, arity, guard) {
        arity = guard ? undefined$1 : arity;
        var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity);
        result2.placeholder = curryRight.placeholder;
        return result2;
      }
      function debounce2(func, wait, options) {
        var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        wait = toNumber2(wait) || 0;
        if (isObject2(options)) {
          leading = !!options.leading;
          maxing = "maxWait" in options;
          maxWait = maxing ? nativeMax2(toNumber2(options.maxWait) || 0, wait) : maxWait;
          trailing = "trailing" in options ? !!options.trailing : trailing;
        }
        function invokeFunc(time2) {
          var args = lastArgs, thisArg = lastThis;
          lastArgs = lastThis = undefined$1;
          lastInvokeTime = time2;
          result2 = func.apply(thisArg, args);
          return result2;
        }
        function leadingEdge(time2) {
          lastInvokeTime = time2;
          timerId = setTimeout2(timerExpired, wait);
          return leading ? invokeFunc(time2) : result2;
        }
        function remainingWait(time2) {
          var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
          return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
        }
        function shouldInvoke(time2) {
          var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
          return lastCallTime === undefined$1 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
        }
        function timerExpired() {
          var time2 = now2();
          if (shouldInvoke(time2)) {
            return trailingEdge(time2);
          }
          timerId = setTimeout2(timerExpired, remainingWait(time2));
        }
        function trailingEdge(time2) {
          timerId = undefined$1;
          if (trailing && lastArgs) {
            return invokeFunc(time2);
          }
          lastArgs = lastThis = undefined$1;
          return result2;
        }
        function cancel2() {
          if (timerId !== undefined$1) {
            clearTimeout2(timerId);
          }
          lastInvokeTime = 0;
          lastArgs = lastCallTime = lastThis = timerId = undefined$1;
        }
        function flush() {
          return timerId === undefined$1 ? result2 : trailingEdge(now2());
        }
        function debounced() {
          var time2 = now2(), isInvoking = shouldInvoke(time2);
          lastArgs = arguments;
          lastThis = this;
          lastCallTime = time2;
          if (isInvoking) {
            if (timerId === undefined$1) {
              return leadingEdge(lastCallTime);
            }
            if (maxing) {
              clearTimeout2(timerId);
              timerId = setTimeout2(timerExpired, wait);
              return invokeFunc(lastCallTime);
            }
          }
          if (timerId === undefined$1) {
            timerId = setTimeout2(timerExpired, wait);
          }
          return result2;
        }
        debounced.cancel = cancel2;
        debounced.flush = flush;
        return debounced;
      }
      var defer2 = baseRest2(function(func, args) {
        return baseDelay(func, 1, args);
      });
      var delay2 = baseRest2(function(func, wait, args) {
        return baseDelay(func, toNumber2(wait) || 0, args);
      });
      function flip2(func) {
        return createWrap(func, WRAP_FLIP_FLAG);
      }
      function memoize2(func, resolver2) {
        if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        var memoized = function() {
          var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
          if (cache2.has(key)) {
            return cache2.get(key);
          }
          var result2 = func.apply(this, args);
          memoized.cache = cache2.set(key, result2) || cache2;
          return result2;
        };
        memoized.cache = new (memoize2.Cache || MapCache2)();
        return memoized;
      }
      memoize2.Cache = MapCache2;
      function negate(predicate) {
        if (typeof predicate != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        return function() {
          var args = arguments;
          switch (args.length) {
            case 0:
              return !predicate.call(this);
            case 1:
              return !predicate.call(this, args[0]);
            case 2:
              return !predicate.call(this, args[0], args[1]);
            case 3:
              return !predicate.call(this, args[0], args[1], args[2]);
          }
          return !predicate.apply(this, args);
        };
      }
      function once(func) {
        return before(2, func);
      }
      var overArgs = castRest(function(func, transforms2) {
        transforms2 = transforms2.length == 1 && isArray3(transforms2[0]) ? arrayMap2(transforms2[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms2, 1), baseUnary2(getIteratee()));
        var funcsLength = transforms2.length;
        return baseRest2(function(args) {
          var index2 = -1, length2 = nativeMin2(args.length, funcsLength);
          while (++index2 < length2) {
            args[index2] = transforms2[index2].call(this, args[index2]);
          }
          return apply2(func, this, args);
        });
      });
      var partial = baseRest2(function(func, partials) {
        var holders = replaceHolders(partials, getHolder(partial));
        return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders);
      });
      var partialRight = baseRest2(function(func, partials) {
        var holders = replaceHolders(partials, getHolder(partialRight));
        return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders);
      });
      var rearg = flatRest(function(func, indexes) {
        return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes);
      });
      function rest(func, start) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        start = start === undefined$1 ? start : toInteger(start);
        return baseRest2(func, start);
      }
      function spread2(func, start) {
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        start = start == null ? 0 : nativeMax2(toInteger(start), 0);
        return baseRest2(function(args) {
          var array4 = args[start], otherArgs = castSlice(args, 0, start);
          if (array4) {
            arrayPush2(otherArgs, array4);
          }
          return apply2(func, this, otherArgs);
        });
      }
      function throttle2(func, wait, options) {
        var leading = true, trailing = true;
        if (typeof func != "function") {
          throw new TypeError2(FUNC_ERROR_TEXT2);
        }
        if (isObject2(options)) {
          leading = "leading" in options ? !!options.leading : leading;
          trailing = "trailing" in options ? !!options.trailing : trailing;
        }
        return debounce2(func, wait, {
          "leading": leading,
          "maxWait": wait,
          "trailing": trailing
        });
      }
      function unary(func) {
        return ary(func, 1);
      }
      function wrap2(value2, wrapper) {
        return partial(castFunction2(wrapper), value2);
      }
      function castArray() {
        if (!arguments.length) {
          return [];
        }
        var value2 = arguments[0];
        return isArray3(value2) ? value2 : [value2];
      }
      function clone3(value2) {
        return baseClone2(value2, CLONE_SYMBOLS_FLAG2);
      }
      function cloneWith(value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseClone2(value2, CLONE_SYMBOLS_FLAG2, customizer);
      }
      function cloneDeep2(value2) {
        return baseClone2(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2);
      }
      function cloneDeepWith(value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseClone2(value2, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2, customizer);
      }
      function conformsTo(object4, source2) {
        return source2 == null || baseConformsTo(object4, source2, keys2(source2));
      }
      function eq2(value2, other) {
        return value2 === other || value2 !== value2 && other !== other;
      }
      var gt = createRelationalOperation(baseGt);
      var gte = createRelationalOperation(function(value2, other) {
        return value2 >= other;
      });
      var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
        return arguments;
      }()) ? baseIsArguments2 : function(value2) {
        return isObjectLike2(value2) && hasOwnProperty2.call(value2, "callee") && !propertyIsEnumerable2.call(value2, "callee");
      };
      var isArray3 = Array2.isArray;
      var isArrayBuffer2 = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
      function isArrayLike2(value2) {
        return value2 != null && isLength2(value2.length) && !isFunction2(value2);
      }
      function isArrayLikeObject2(value2) {
        return isObjectLike2(value2) && isArrayLike2(value2);
      }
      function isBoolean2(value2) {
        return value2 === true || value2 === false || isObjectLike2(value2) && baseGetTag2(value2) == boolTag2;
      }
      var isBuffer2 = nativeIsBuffer2 || stubFalse2;
      var isDate2 = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
      function isElement(value2) {
        return isObjectLike2(value2) && value2.nodeType === 1 && !isPlainObject3(value2);
      }
      function isEmpty2(value2) {
        if (value2 == null) {
          return true;
        }
        if (isArrayLike2(value2) && (isArray3(value2) || typeof value2 == "string" || typeof value2.splice == "function" || isBuffer2(value2) || isTypedArray2(value2) || isArguments2(value2))) {
          return !value2.length;
        }
        var tag = getTag2(value2);
        if (tag == mapTag2 || tag == setTag2) {
          return !value2.size;
        }
        if (isPrototype2(value2)) {
          return !baseKeys2(value2).length;
        }
        for (var key in value2) {
          if (hasOwnProperty2.call(value2, key)) {
            return false;
          }
        }
        return true;
      }
      function isEqual2(value2, other) {
        return baseIsEqual2(value2, other);
      }
      function isEqualWith(value2, other, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        var result2 = customizer ? customizer(value2, other) : undefined$1;
        return result2 === undefined$1 ? baseIsEqual2(value2, other, undefined$1, customizer) : !!result2;
      }
      function isError(value2) {
        if (!isObjectLike2(value2)) {
          return false;
        }
        var tag = baseGetTag2(value2);
        return tag == errorTag2 || tag == domExcTag || typeof value2.message == "string" && typeof value2.name == "string" && !isPlainObject3(value2);
      }
      function isFinite2(value2) {
        return typeof value2 == "number" && nativeIsFinite(value2);
      }
      function isFunction2(value2) {
        if (!isObject2(value2)) {
          return false;
        }
        var tag = baseGetTag2(value2);
        return tag == funcTag2 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
      }
      function isInteger2(value2) {
        return typeof value2 == "number" && value2 == toInteger(value2);
      }
      function isLength2(value2) {
        return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER2;
      }
      function isObject2(value2) {
        var type4 = typeof value2;
        return value2 != null && (type4 == "object" || type4 == "function");
      }
      function isObjectLike2(value2) {
        return value2 != null && typeof value2 == "object";
      }
      var isMap2 = nodeIsMap2 ? baseUnary2(nodeIsMap2) : baseIsMap2;
      function isMatch(object4, source2) {
        return object4 === source2 || baseIsMatch2(object4, source2, getMatchData2(source2));
      }
      function isMatchWith(object4, source2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return baseIsMatch2(object4, source2, getMatchData2(source2), customizer);
      }
      function isNaN2(value2) {
        return isNumber2(value2) && value2 != +value2;
      }
      function isNative(value2) {
        if (isMaskable(value2)) {
          throw new Error2(CORE_ERROR_TEXT);
        }
        return baseIsNative2(value2);
      }
      function isNull(value2) {
        return value2 === null;
      }
      function isNil(value2) {
        return value2 == null;
      }
      function isNumber2(value2) {
        return typeof value2 == "number" || isObjectLike2(value2) && baseGetTag2(value2) == numberTag2;
      }
      function isPlainObject3(value2) {
        if (!isObjectLike2(value2) || baseGetTag2(value2) != objectTag2) {
          return false;
        }
        var proto2 = getPrototype2(value2);
        if (proto2 === null) {
          return true;
        }
        var Ctor = hasOwnProperty2.call(proto2, "constructor") && proto2.constructor;
        return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString2.call(Ctor) == objectCtorString2;
      }
      var isRegExp2 = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
      function isSafeInteger(value2) {
        return isInteger2(value2) && value2 >= -MAX_SAFE_INTEGER2 && value2 <= MAX_SAFE_INTEGER2;
      }
      var isSet2 = nodeIsSet2 ? baseUnary2(nodeIsSet2) : baseIsSet2;
      function isString2(value2) {
        return typeof value2 == "string" || !isArray3(value2) && isObjectLike2(value2) && baseGetTag2(value2) == stringTag2;
      }
      function isSymbol2(value2) {
        return typeof value2 == "symbol" || isObjectLike2(value2) && baseGetTag2(value2) == symbolTag2;
      }
      var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
      function isUndefined2(value2) {
        return value2 === undefined$1;
      }
      function isWeakMap(value2) {
        return isObjectLike2(value2) && getTag2(value2) == weakMapTag2;
      }
      function isWeakSet(value2) {
        return isObjectLike2(value2) && baseGetTag2(value2) == weakSetTag;
      }
      var lt = createRelationalOperation(baseLt);
      var lte = createRelationalOperation(function(value2, other) {
        return value2 <= other;
      });
      function toArray2(value2) {
        if (!value2) {
          return [];
        }
        if (isArrayLike2(value2)) {
          return isString2(value2) ? stringToArray3(value2) : copyArray2(value2);
        }
        if (symIterator && value2[symIterator]) {
          return iteratorToArray(value2[symIterator]());
        }
        var tag = getTag2(value2), func = tag == mapTag2 ? mapToArray2 : tag == setTag2 ? setToArray2 : values;
        return func(value2);
      }
      function toFinite(value2) {
        if (!value2) {
          return value2 === 0 ? value2 : 0;
        }
        value2 = toNumber2(value2);
        if (value2 === INFINITY2 || value2 === -INFINITY2) {
          var sign2 = value2 < 0 ? -1 : 1;
          return sign2 * MAX_INTEGER;
        }
        return value2 === value2 ? value2 : 0;
      }
      function toInteger(value2) {
        var result2 = toFinite(value2), remainder = result2 % 1;
        return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
      }
      function toLength(value2) {
        return value2 ? baseClamp(toInteger(value2), 0, MAX_ARRAY_LENGTH) : 0;
      }
      function toNumber2(value2) {
        if (typeof value2 == "number") {
          return value2;
        }
        if (isSymbol2(value2)) {
          return NAN2;
        }
        if (isObject2(value2)) {
          var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
          value2 = isObject2(other) ? other + "" : other;
        }
        if (typeof value2 != "string") {
          return value2 === 0 ? value2 : +value2;
        }
        value2 = baseTrim2(value2);
        var isBinary = reIsBinary2.test(value2);
        return isBinary || reIsOctal2.test(value2) ? freeParseInt2(value2.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value2) ? NAN2 : +value2;
      }
      function toPlainObject2(value2) {
        return copyObject2(value2, keysIn2(value2));
      }
      function toSafeInteger(value2) {
        return value2 ? baseClamp(toInteger(value2), -MAX_SAFE_INTEGER2, MAX_SAFE_INTEGER2) : value2 === 0 ? value2 : 0;
      }
      function toString4(value2) {
        return value2 == null ? "" : baseToString2(value2);
      }
      var assign = createAssigner2(function(object4, source2) {
        if (isPrototype2(source2) || isArrayLike2(source2)) {
          copyObject2(source2, keys2(source2), object4);
          return;
        }
        for (var key in source2) {
          if (hasOwnProperty2.call(source2, key)) {
            assignValue2(object4, key, source2[key]);
          }
        }
      });
      var assignIn = createAssigner2(function(object4, source2) {
        copyObject2(source2, keysIn2(source2), object4);
      });
      var assignInWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        copyObject2(source2, keysIn2(source2), object4, customizer);
      });
      var assignWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        copyObject2(source2, keys2(source2), object4, customizer);
      });
      var at = flatRest(baseAt);
      function create2(prototype2, properties2) {
        var result2 = baseCreate2(prototype2);
        return properties2 == null ? result2 : baseAssign2(result2, properties2);
      }
      var defaults2 = baseRest2(function(object4, sources) {
        object4 = Object2(object4);
        var index2 = -1;
        var length2 = sources.length;
        var guard = length2 > 2 ? sources[2] : undefined$1;
        if (guard && isIterateeCall2(sources[0], sources[1], guard)) {
          length2 = 1;
        }
        while (++index2 < length2) {
          var source2 = sources[index2];
          var props = keysIn2(source2);
          var propsIndex = -1;
          var propsLength = props.length;
          while (++propsIndex < propsLength) {
            var key = props[propsIndex];
            var value2 = object4[key];
            if (value2 === undefined$1 || eq2(value2, objectProto2[key]) && !hasOwnProperty2.call(object4, key)) {
              object4[key] = source2[key];
            }
          }
        }
        return object4;
      });
      var defaultsDeep = baseRest2(function(args) {
        args.push(undefined$1, customDefaultsMerge);
        return apply2(mergeWith, undefined$1, args);
      });
      function findKey2(object4, predicate) {
        return baseFindKey(object4, getIteratee(predicate, 3), baseForOwn2);
      }
      function findLastKey(object4, predicate) {
        return baseFindKey(object4, getIteratee(predicate, 3), baseForOwnRight);
      }
      function forIn(object4, iteratee2) {
        return object4 == null ? object4 : baseFor2(object4, getIteratee(iteratee2, 3), keysIn2);
      }
      function forInRight(object4, iteratee2) {
        return object4 == null ? object4 : baseForRight(object4, getIteratee(iteratee2, 3), keysIn2);
      }
      function forOwn2(object4, iteratee2) {
        return object4 && baseForOwn2(object4, getIteratee(iteratee2, 3));
      }
      function forOwnRight(object4, iteratee2) {
        return object4 && baseForOwnRight(object4, getIteratee(iteratee2, 3));
      }
      function functions(object4) {
        return object4 == null ? [] : baseFunctions(object4, keys2(object4));
      }
      function functionsIn(object4) {
        return object4 == null ? [] : baseFunctions(object4, keysIn2(object4));
      }
      function get5(object4, path, defaultValue2) {
        var result2 = object4 == null ? undefined$1 : baseGet2(object4, path);
        return result2 === undefined$1 ? defaultValue2 : result2;
      }
      function has(object4, path) {
        return object4 != null && hasPath2(object4, path, baseHas);
      }
      function hasIn2(object4, path) {
        return object4 != null && hasPath2(object4, path, baseHasIn2);
      }
      var invert = createInverter(function(result2, value2, key) {
        if (value2 != null && typeof value2.toString != "function") {
          value2 = nativeObjectToString2.call(value2);
        }
        result2[value2] = key;
      }, constant2(identity2));
      var invertBy = createInverter(function(result2, value2, key) {
        if (value2 != null && typeof value2.toString != "function") {
          value2 = nativeObjectToString2.call(value2);
        }
        if (hasOwnProperty2.call(result2, value2)) {
          result2[value2].push(key);
        } else {
          result2[value2] = [key];
        }
      }, getIteratee);
      var invoke = baseRest2(baseInvoke);
      function keys2(object4) {
        return isArrayLike2(object4) ? arrayLikeKeys2(object4) : baseKeys2(object4);
      }
      function keysIn2(object4) {
        return isArrayLike2(object4) ? arrayLikeKeys2(object4, true) : baseKeysIn2(object4);
      }
      function mapKeys(object4, iteratee2) {
        var result2 = {};
        iteratee2 = getIteratee(iteratee2, 3);
        baseForOwn2(object4, function(value2, key, object5) {
          baseAssignValue2(result2, iteratee2(value2, key, object5), value2);
        });
        return result2;
      }
      function mapValues(object4, iteratee2) {
        var result2 = {};
        iteratee2 = getIteratee(iteratee2, 3);
        baseForOwn2(object4, function(value2, key, object5) {
          baseAssignValue2(result2, key, iteratee2(value2, key, object5));
        });
        return result2;
      }
      var merge2 = createAssigner2(function(object4, source2, srcIndex) {
        baseMerge2(object4, source2, srcIndex);
      });
      var mergeWith = createAssigner2(function(object4, source2, srcIndex, customizer) {
        baseMerge2(object4, source2, srcIndex, customizer);
      });
      var omit2 = flatRest(function(object4, paths) {
        var result2 = {};
        if (object4 == null) {
          return result2;
        }
        var isDeep = false;
        paths = arrayMap2(paths, function(path) {
          path = castPath2(path, object4);
          isDeep || (isDeep = path.length > 1);
          return path;
        });
        copyObject2(object4, getAllKeysIn2(object4), result2);
        if (isDeep) {
          result2 = baseClone2(result2, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone);
        }
        var length2 = paths.length;
        while (length2--) {
          baseUnset(result2, paths[length2]);
        }
        return result2;
      });
      function omitBy(object4, predicate) {
        return pickBy2(object4, negate(getIteratee(predicate)));
      }
      var pick3 = flatRest(function(object4, paths) {
        return object4 == null ? {} : basePick(object4, paths);
      });
      function pickBy2(object4, predicate) {
        if (object4 == null) {
          return {};
        }
        var props = arrayMap2(getAllKeysIn2(object4), function(prop) {
          return [prop];
        });
        predicate = getIteratee(predicate);
        return basePickBy(object4, props, function(value2, path) {
          return predicate(value2, path[0]);
        });
      }
      function result(object4, path, defaultValue2) {
        path = castPath2(path, object4);
        var index2 = -1, length2 = path.length;
        if (!length2) {
          length2 = 1;
          object4 = undefined$1;
        }
        while (++index2 < length2) {
          var value2 = object4 == null ? undefined$1 : object4[toKey2(path[index2])];
          if (value2 === undefined$1) {
            index2 = length2;
            value2 = defaultValue2;
          }
          object4 = isFunction2(value2) ? value2.call(object4) : value2;
        }
        return object4;
      }
      function set2(object4, path, value2) {
        return object4 == null ? object4 : baseSet(object4, path, value2);
      }
      function setWith(object4, path, value2, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return object4 == null ? object4 : baseSet(object4, path, value2, customizer);
      }
      var toPairs = createToPairs(keys2);
      var toPairsIn = createToPairs(keysIn2);
      function transform2(object4, iteratee2, accumulator) {
        var isArr = isArray3(object4), isArrLike = isArr || isBuffer2(object4) || isTypedArray2(object4);
        iteratee2 = getIteratee(iteratee2, 4);
        if (accumulator == null) {
          var Ctor = object4 && object4.constructor;
          if (isArrLike) {
            accumulator = isArr ? new Ctor() : [];
          } else if (isObject2(object4)) {
            accumulator = isFunction2(Ctor) ? baseCreate2(getPrototype2(object4)) : {};
          } else {
            accumulator = {};
          }
        }
        (isArrLike ? arrayEach2 : baseForOwn2)(object4, function(value2, index2, object5) {
          return iteratee2(accumulator, value2, index2, object5);
        });
        return accumulator;
      }
      function unset(object4, path) {
        return object4 == null ? true : baseUnset(object4, path);
      }
      function update(object4, path, updater) {
        return object4 == null ? object4 : baseUpdate(object4, path, castFunction2(updater));
      }
      function updateWith(object4, path, updater, customizer) {
        customizer = typeof customizer == "function" ? customizer : undefined$1;
        return object4 == null ? object4 : baseUpdate(object4, path, castFunction2(updater), customizer);
      }
      function values(object4) {
        return object4 == null ? [] : baseValues(object4, keys2(object4));
      }
      function valuesIn(object4) {
        return object4 == null ? [] : baseValues(object4, keysIn2(object4));
      }
      function clamp2(number4, lower, upper) {
        if (upper === undefined$1) {
          upper = lower;
          lower = undefined$1;
        }
        if (upper !== undefined$1) {
          upper = toNumber2(upper);
          upper = upper === upper ? upper : 0;
        }
        if (lower !== undefined$1) {
          lower = toNumber2(lower);
          lower = lower === lower ? lower : 0;
        }
        return baseClamp(toNumber2(number4), lower, upper);
      }
      function inRange2(number4, start, end) {
        start = toFinite(start);
        if (end === undefined$1) {
          end = start;
          start = 0;
        } else {
          end = toFinite(end);
        }
        number4 = toNumber2(number4);
        return baseInRange(number4, start, end);
      }
      function random(lower, upper, floating) {
        if (floating && typeof floating != "boolean" && isIterateeCall2(lower, upper, floating)) {
          upper = floating = undefined$1;
        }
        if (floating === undefined$1) {
          if (typeof upper == "boolean") {
            floating = upper;
            upper = undefined$1;
          } else if (typeof lower == "boolean") {
            floating = lower;
            lower = undefined$1;
          }
        }
        if (lower === undefined$1 && upper === undefined$1) {
          lower = 0;
          upper = 1;
        } else {
          lower = toFinite(lower);
          if (upper === undefined$1) {
            upper = lower;
            lower = 0;
          } else {
            upper = toFinite(upper);
          }
        }
        if (lower > upper) {
          var temp = lower;
          lower = upper;
          upper = temp;
        }
        if (floating || lower % 1 || upper % 1) {
          var rand = nativeRandom();
          return nativeMin2(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
        }
        return baseRandom(lower, upper);
      }
      var camelCase2 = createCompounder(function(result2, word, index2) {
        word = word.toLowerCase();
        return result2 + (index2 ? capitalize2(word) : word);
      });
      function capitalize2(string3) {
        return upperFirst(toString4(string3).toLowerCase());
      }
      function deburr(string3) {
        string3 = toString4(string3);
        return string3 && string3.replace(reLatin, deburrLetter).replace(reComboMark, "");
      }
      function endsWith2(string3, target, position2) {
        string3 = toString4(string3);
        target = baseToString2(target);
        var length2 = string3.length;
        position2 = position2 === undefined$1 ? length2 : baseClamp(toInteger(position2), 0, length2);
        var end = position2;
        position2 -= target.length;
        return position2 >= 0 && string3.slice(position2, end) == target;
      }
      function escape2(string3) {
        string3 = toString4(string3);
        return string3 && reHasUnescapedHtml.test(string3) ? string3.replace(reUnescapedHtml, escapeHtmlChar) : string3;
      }
      function escapeRegExp(string3) {
        string3 = toString4(string3);
        return string3 && reHasRegExpChar.test(string3) ? string3.replace(reRegExpChar2, "\\$&") : string3;
      }
      var kebabCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? "-" : "") + word.toLowerCase();
      });
      var lowerCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + word.toLowerCase();
      });
      var lowerFirst = createCaseFirst("toLowerCase");
      function pad(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        if (!length2 || strLength >= length2) {
          return string3;
        }
        var mid = (length2 - strLength) / 2;
        return createPadding(nativeFloor(mid), chars2) + string3 + createPadding(nativeCeil(mid), chars2);
      }
      function padEnd(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        return length2 && strLength < length2 ? string3 + createPadding(length2 - strLength, chars2) : string3;
      }
      function padStart(string3, length2, chars2) {
        string3 = toString4(string3);
        length2 = toInteger(length2);
        var strLength = length2 ? stringSize(string3) : 0;
        return length2 && strLength < length2 ? createPadding(length2 - strLength, chars2) + string3 : string3;
      }
      function parseInt2(string3, radix, guard) {
        if (guard || radix == null) {
          radix = 0;
        } else if (radix) {
          radix = +radix;
        }
        return nativeParseInt(toString4(string3).replace(reTrimStart2, ""), radix || 0);
      }
      function repeat(string3, n2, guard) {
        if (guard ? isIterateeCall2(string3, n2, guard) : n2 === undefined$1) {
          n2 = 1;
        } else {
          n2 = toInteger(n2);
        }
        return baseRepeat(toString4(string3), n2);
      }
      function replace2() {
        var args = arguments, string3 = toString4(args[0]);
        return args.length < 3 ? string3 : string3.replace(args[1], args[2]);
      }
      var snakeCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? "_" : "") + word.toLowerCase();
      });
      function split2(string3, separator, limit2) {
        if (limit2 && typeof limit2 != "number" && isIterateeCall2(string3, separator, limit2)) {
          separator = limit2 = undefined$1;
        }
        limit2 = limit2 === undefined$1 ? MAX_ARRAY_LENGTH : limit2 >>> 0;
        if (!limit2) {
          return [];
        }
        string3 = toString4(string3);
        if (string3 && (typeof separator == "string" || separator != null && !isRegExp2(separator))) {
          separator = baseToString2(separator);
          if (!separator && hasUnicode(string3)) {
            return castSlice(stringToArray3(string3), 0, limit2);
          }
        }
        return string3.split(separator, limit2);
      }
      var startCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + upperFirst(word);
      });
      function startsWith(string3, target, position2) {
        string3 = toString4(string3);
        position2 = position2 == null ? 0 : baseClamp(toInteger(position2), 0, string3.length);
        target = baseToString2(target);
        return string3.slice(position2, position2 + target.length) == target;
      }
      function template2(string3, options, guard) {
        var settings = lodash2.templateSettings;
        if (guard && isIterateeCall2(string3, options, guard)) {
          options = undefined$1;
        }
        string3 = toString4(string3);
        options = assignInWith({}, options, settings, customDefaultsAssignIn);
        var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
        var isEscaping, isEvaluating, index2 = 0, interpolate2 = options.interpolate || reNoMatch, source2 = "__p += '";
        var reDelimiters = RegExp2(
          (options.escape || reNoMatch).source + "|" + interpolate2.source + "|" + (interpolate2 === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$",
          "g"
        );
        var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
        string3.replace(reDelimiters, function(match5, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) {
          interpolateValue || (interpolateValue = esTemplateValue);
          source2 += string3.slice(index2, offset2).replace(reUnescapedString, escapeStringChar);
          if (escapeValue) {
            isEscaping = true;
            source2 += "' +\n__e(" + escapeValue + ") +\n'";
          }
          if (evaluateValue) {
            isEvaluating = true;
            source2 += "';\n" + evaluateValue + ";\n__p += '";
          }
          if (interpolateValue) {
            source2 += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
          }
          index2 = offset2 + match5.length;
          return match5;
        });
        source2 += "';\n";
        var variable = hasOwnProperty2.call(options, "variable") && options.variable;
        if (!variable) {
          source2 = "with (obj) {\n" + source2 + "\n}\n";
        } else if (reForbiddenIdentifierChars.test(variable)) {
          throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
        }
        source2 = (isEvaluating ? source2.replace(reEmptyStringLeading, "") : source2).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
        source2 = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source2 + "return __p\n}";
        var result2 = attempt(function() {
          return Function2(importsKeys, sourceURL + "return " + source2).apply(undefined$1, importsValues);
        });
        result2.source = source2;
        if (isError(result2)) {
          throw result2;
        }
        return result2;
      }
      function toLower(value2) {
        return toString4(value2).toLowerCase();
      }
      function toUpper(value2) {
        return toString4(value2).toUpperCase();
      }
      function trim2(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return baseTrim2(string3);
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), chrSymbols = stringToArray3(chars2), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
        return castSlice(strSymbols, start, end).join("");
      }
      function trimEnd(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return string3.slice(0, trimmedEndIndex2(string3) + 1);
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), end = charsEndIndex(strSymbols, stringToArray3(chars2)) + 1;
        return castSlice(strSymbols, 0, end).join("");
      }
      function trimStart(string3, chars2, guard) {
        string3 = toString4(string3);
        if (string3 && (guard || chars2 === undefined$1)) {
          return string3.replace(reTrimStart2, "");
        }
        if (!string3 || !(chars2 = baseToString2(chars2))) {
          return string3;
        }
        var strSymbols = stringToArray3(string3), start = charsStartIndex(strSymbols, stringToArray3(chars2));
        return castSlice(strSymbols, start).join("");
      }
      function truncate(string3, options) {
        var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
        if (isObject2(options)) {
          var separator = "separator" in options ? options.separator : separator;
          length2 = "length" in options ? toInteger(options.length) : length2;
          omission = "omission" in options ? baseToString2(options.omission) : omission;
        }
        string3 = toString4(string3);
        var strLength = string3.length;
        if (hasUnicode(string3)) {
          var strSymbols = stringToArray3(string3);
          strLength = strSymbols.length;
        }
        if (length2 >= strLength) {
          return string3;
        }
        var end = length2 - stringSize(omission);
        if (end < 1) {
          return omission;
        }
        var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string3.slice(0, end);
        if (separator === undefined$1) {
          return result2 + omission;
        }
        if (strSymbols) {
          end += result2.length - end;
        }
        if (isRegExp2(separator)) {
          if (string3.slice(end).search(separator)) {
            var match5, substring = result2;
            if (!separator.global) {
              separator = RegExp2(separator.source, toString4(reFlags2.exec(separator)) + "g");
            }
            separator.lastIndex = 0;
            while (match5 = separator.exec(substring)) {
              var newEnd = match5.index;
            }
            result2 = result2.slice(0, newEnd === undefined$1 ? end : newEnd);
          }
        } else if (string3.indexOf(baseToString2(separator), end) != end) {
          var index2 = result2.lastIndexOf(separator);
          if (index2 > -1) {
            result2 = result2.slice(0, index2);
          }
        }
        return result2 + omission;
      }
      function unescape3(string3) {
        string3 = toString4(string3);
        return string3 && reHasEscapedHtml.test(string3) ? string3.replace(reEscapedHtml, unescapeHtmlChar) : string3;
      }
      var upperCase = createCompounder(function(result2, word, index2) {
        return result2 + (index2 ? " " : "") + word.toUpperCase();
      });
      var upperFirst = createCaseFirst("toUpperCase");
      function words(string3, pattern4, guard) {
        string3 = toString4(string3);
        pattern4 = guard ? undefined$1 : pattern4;
        if (pattern4 === undefined$1) {
          return hasUnicodeWord(string3) ? unicodeWords(string3) : asciiWords(string3);
        }
        return string3.match(pattern4) || [];
      }
      var attempt = baseRest2(function(func, args) {
        try {
          return apply2(func, undefined$1, args);
        } catch (e2) {
          return isError(e2) ? e2 : new Error2(e2);
        }
      });
      var bindAll = flatRest(function(object4, methodNames) {
        arrayEach2(methodNames, function(key) {
          key = toKey2(key);
          baseAssignValue2(object4, key, bind2(object4[key], object4));
        });
        return object4;
      });
      function cond(pairs) {
        var length2 = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
        pairs = !length2 ? [] : arrayMap2(pairs, function(pair) {
          if (typeof pair[1] != "function") {
            throw new TypeError2(FUNC_ERROR_TEXT2);
          }
          return [toIteratee(pair[0]), pair[1]];
        });
        return baseRest2(function(args) {
          var index2 = -1;
          while (++index2 < length2) {
            var pair = pairs[index2];
            if (apply2(pair[0], this, args)) {
              return apply2(pair[1], this, args);
            }
          }
        });
      }
      function conforms(source2) {
        return baseConforms(baseClone2(source2, CLONE_DEEP_FLAG2));
      }
      function constant2(value2) {
        return function() {
          return value2;
        };
      }
      function defaultTo(value2, defaultValue2) {
        return value2 == null || value2 !== value2 ? defaultValue2 : value2;
      }
      var flow2 = createFlow();
      var flowRight = createFlow(true);
      function identity2(value2) {
        return value2;
      }
      function iteratee(func) {
        return baseIteratee2(typeof func == "function" ? func : baseClone2(func, CLONE_DEEP_FLAG2));
      }
      function matches(source2) {
        return baseMatches2(baseClone2(source2, CLONE_DEEP_FLAG2));
      }
      function matchesProperty(path, srcValue) {
        return baseMatchesProperty2(path, baseClone2(srcValue, CLONE_DEEP_FLAG2));
      }
      var method4 = baseRest2(function(path, args) {
        return function(object4) {
          return baseInvoke(object4, path, args);
        };
      });
      var methodOf = baseRest2(function(object4, args) {
        return function(path) {
          return baseInvoke(object4, path, args);
        };
      });
      function mixin(object4, source2, options) {
        var props = keys2(source2), methodNames = baseFunctions(source2, props);
        if (options == null && !(isObject2(source2) && (methodNames.length || !props.length))) {
          options = source2;
          source2 = object4;
          object4 = this;
          methodNames = baseFunctions(source2, keys2(source2));
        }
        var chain3 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction2(object4);
        arrayEach2(methodNames, function(methodName) {
          var func = source2[methodName];
          object4[methodName] = func;
          if (isFunc) {
            object4.prototype[methodName] = function() {
              var chainAll = this.__chain__;
              if (chain3 || chainAll) {
                var result2 = object4(this.__wrapped__), actions = result2.__actions__ = copyArray2(this.__actions__);
                actions.push({ "func": func, "args": arguments, "thisArg": object4 });
                result2.__chain__ = chainAll;
                return result2;
              }
              return func.apply(object4, arrayPush2([this.value()], arguments));
            };
          }
        });
        return object4;
      }
      function noConflict() {
        if (root2._ === this) {
          root2._ = oldDash;
        }
        return this;
      }
      function noop4() {
      }
      function nthArg(n2) {
        n2 = toInteger(n2);
        return baseRest2(function(args) {
          return baseNth(args, n2);
        });
      }
      var over = createOver(arrayMap2);
      var overEvery = createOver(arrayEvery);
      var overSome = createOver(arraySome2);
      function property2(path) {
        return isKey2(path) ? baseProperty2(toKey2(path)) : basePropertyDeep2(path);
      }
      function propertyOf(object4) {
        return function(path) {
          return object4 == null ? undefined$1 : baseGet2(object4, path);
        };
      }
      var range3 = createRange();
      var rangeRight = createRange(true);
      function stubArray2() {
        return [];
      }
      function stubFalse2() {
        return false;
      }
      function stubObject() {
        return {};
      }
      function stubString() {
        return "";
      }
      function stubTrue() {
        return true;
      }
      function times(n2, iteratee2) {
        n2 = toInteger(n2);
        if (n2 < 1 || n2 > MAX_SAFE_INTEGER2) {
          return [];
        }
        var index2 = MAX_ARRAY_LENGTH, length2 = nativeMin2(n2, MAX_ARRAY_LENGTH);
        iteratee2 = getIteratee(iteratee2);
        n2 -= MAX_ARRAY_LENGTH;
        var result2 = baseTimes2(length2, iteratee2);
        while (++index2 < n2) {
          iteratee2(index2);
        }
        return result2;
      }
      function toPath(value2) {
        if (isArray3(value2)) {
          return arrayMap2(value2, toKey2);
        }
        return isSymbol2(value2) ? [value2] : copyArray2(stringToPath2(toString4(value2)));
      }
      function uniqueId2(prefix) {
        var id2 = ++idCounter2;
        return toString4(prefix) + id2;
      }
      var add2 = createMathOperation(function(augend, addend) {
        return augend + addend;
      }, 0);
      var ceil = createRound("ceil");
      var divide = createMathOperation(function(dividend, divisor) {
        return dividend / divisor;
      }, 1);
      var floor = createRound("floor");
      function max2(array4) {
        return array4 && array4.length ? baseExtremum(array4, identity2, baseGt) : undefined$1;
      }
      function maxBy(array4, iteratee2) {
        return array4 && array4.length ? baseExtremum(array4, getIteratee(iteratee2, 2), baseGt) : undefined$1;
      }
      function mean(array4) {
        return baseMean(array4, identity2);
      }
      function meanBy(array4, iteratee2) {
        return baseMean(array4, getIteratee(iteratee2, 2));
      }
      function min2(array4) {
        return array4 && array4.length ? baseExtremum(array4, identity2, baseLt) : undefined$1;
      }
      function minBy(array4, iteratee2) {
        return array4 && array4.length ? baseExtremum(array4, getIteratee(iteratee2, 2), baseLt) : undefined$1;
      }
      var multiply = createMathOperation(function(multiplier, multiplicand) {
        return multiplier * multiplicand;
      }, 1);
      var round2 = createRound("round");
      var subtract2 = createMathOperation(function(minuend, subtrahend) {
        return minuend - subtrahend;
      }, 0);
      function sum(array4) {
        return array4 && array4.length ? baseSum(array4, identity2) : 0;
      }
      function sumBy(array4, iteratee2) {
        return array4 && array4.length ? baseSum(array4, getIteratee(iteratee2, 2)) : 0;
      }
      lodash2.after = after;
      lodash2.ary = ary;
      lodash2.assign = assign;
      lodash2.assignIn = assignIn;
      lodash2.assignInWith = assignInWith;
      lodash2.assignWith = assignWith;
      lodash2.at = at;
      lodash2.before = before;
      lodash2.bind = bind2;
      lodash2.bindAll = bindAll;
      lodash2.bindKey = bindKey;
      lodash2.castArray = castArray;
      lodash2.chain = chain2;
      lodash2.chunk = chunk;
      lodash2.compact = compact;
      lodash2.concat = concat;
      lodash2.cond = cond;
      lodash2.conforms = conforms;
      lodash2.constant = constant2;
      lodash2.countBy = countBy;
      lodash2.create = create2;
      lodash2.curry = curry;
      lodash2.curryRight = curryRight;
      lodash2.debounce = debounce2;
      lodash2.defaults = defaults2;
      lodash2.defaultsDeep = defaultsDeep;
      lodash2.defer = defer2;
      lodash2.delay = delay2;
      lodash2.difference = difference;
      lodash2.differenceBy = differenceBy;
      lodash2.differenceWith = differenceWith;
      lodash2.drop = drop;
      lodash2.dropRight = dropRight;
      lodash2.dropRightWhile = dropRightWhile;
      lodash2.dropWhile = dropWhile;
      lodash2.fill = fill2;
      lodash2.filter = filter3;
      lodash2.flatMap = flatMap;
      lodash2.flatMapDeep = flatMapDeep;
      lodash2.flatMapDepth = flatMapDepth;
      lodash2.flatten = flatten;
      lodash2.flattenDeep = flattenDeep;
      lodash2.flattenDepth = flattenDepth;
      lodash2.flip = flip2;
      lodash2.flow = flow2;
      lodash2.flowRight = flowRight;
      lodash2.fromPairs = fromPairs;
      lodash2.functions = functions;
      lodash2.functionsIn = functionsIn;
      lodash2.groupBy = groupBy;
      lodash2.initial = initial;
      lodash2.intersection = intersection;
      lodash2.intersectionBy = intersectionBy;
      lodash2.intersectionWith = intersectionWith;
      lodash2.invert = invert;
      lodash2.invertBy = invertBy;
      lodash2.invokeMap = invokeMap;
      lodash2.iteratee = iteratee;
      lodash2.keyBy = keyBy;
      lodash2.keys = keys2;
      lodash2.keysIn = keysIn2;
      lodash2.map = map2;
      lodash2.mapKeys = mapKeys;
      lodash2.mapValues = mapValues;
      lodash2.matches = matches;
      lodash2.matchesProperty = matchesProperty;
      lodash2.memoize = memoize2;
      lodash2.merge = merge2;
      lodash2.mergeWith = mergeWith;
      lodash2.method = method4;
      lodash2.methodOf = methodOf;
      lodash2.mixin = mixin;
      lodash2.negate = negate;
      lodash2.nthArg = nthArg;
      lodash2.omit = omit2;
      lodash2.omitBy = omitBy;
      lodash2.once = once;
      lodash2.orderBy = orderBy;
      lodash2.over = over;
      lodash2.overArgs = overArgs;
      lodash2.overEvery = overEvery;
      lodash2.overSome = overSome;
      lodash2.partial = partial;
      lodash2.partialRight = partialRight;
      lodash2.partition = partition;
      lodash2.pick = pick3;
      lodash2.pickBy = pickBy2;
      lodash2.property = property2;
      lodash2.propertyOf = propertyOf;
      lodash2.pull = pull;
      lodash2.pullAll = pullAll;
      lodash2.pullAllBy = pullAllBy;
      lodash2.pullAllWith = pullAllWith;
      lodash2.pullAt = pullAt;
      lodash2.range = range3;
      lodash2.rangeRight = rangeRight;
      lodash2.rearg = rearg;
      lodash2.reject = reject;
      lodash2.remove = remove;
      lodash2.rest = rest;
      lodash2.reverse = reverse;
      lodash2.sampleSize = sampleSize;
      lodash2.set = set2;
      lodash2.setWith = setWith;
      lodash2.shuffle = shuffle;
      lodash2.slice = slice2;
      lodash2.sortBy = sortBy;
      lodash2.sortedUniq = sortedUniq;
      lodash2.sortedUniqBy = sortedUniqBy;
      lodash2.split = split2;
      lodash2.spread = spread2;
      lodash2.tail = tail;
      lodash2.take = take;
      lodash2.takeRight = takeRight;
      lodash2.takeRightWhile = takeRightWhile;
      lodash2.takeWhile = takeWhile;
      lodash2.tap = tap;
      lodash2.throttle = throttle2;
      lodash2.thru = thru;
      lodash2.toArray = toArray2;
      lodash2.toPairs = toPairs;
      lodash2.toPairsIn = toPairsIn;
      lodash2.toPath = toPath;
      lodash2.toPlainObject = toPlainObject2;
      lodash2.transform = transform2;
      lodash2.unary = unary;
      lodash2.union = union;
      lodash2.unionBy = unionBy;
      lodash2.unionWith = unionWith;
      lodash2.uniq = uniq;
      lodash2.uniqBy = uniqBy;
      lodash2.uniqWith = uniqWith;
      lodash2.unset = unset;
      lodash2.unzip = unzip;
      lodash2.unzipWith = unzipWith;
      lodash2.update = update;
      lodash2.updateWith = updateWith;
      lodash2.values = values;
      lodash2.valuesIn = valuesIn;
      lodash2.without = without;
      lodash2.words = words;
      lodash2.wrap = wrap2;
      lodash2.xor = xor;
      lodash2.xorBy = xorBy;
      lodash2.xorWith = xorWith;
      lodash2.zip = zip;
      lodash2.zipObject = zipObject;
      lodash2.zipObjectDeep = zipObjectDeep;
      lodash2.zipWith = zipWith;
      lodash2.entries = toPairs;
      lodash2.entriesIn = toPairsIn;
      lodash2.extend = assignIn;
      lodash2.extendWith = assignInWith;
      mixin(lodash2, lodash2);
      lodash2.add = add2;
      lodash2.attempt = attempt;
      lodash2.camelCase = camelCase2;
      lodash2.capitalize = capitalize2;
      lodash2.ceil = ceil;
      lodash2.clamp = clamp2;
      lodash2.clone = clone3;
      lodash2.cloneDeep = cloneDeep2;
      lodash2.cloneDeepWith = cloneDeepWith;
      lodash2.cloneWith = cloneWith;
      lodash2.conformsTo = conformsTo;
      lodash2.deburr = deburr;
      lodash2.defaultTo = defaultTo;
      lodash2.divide = divide;
      lodash2.endsWith = endsWith2;
      lodash2.eq = eq2;
      lodash2.escape = escape2;
      lodash2.escapeRegExp = escapeRegExp;
      lodash2.every = every;
      lodash2.find = find2;
      lodash2.findIndex = findIndex;
      lodash2.findKey = findKey2;
      lodash2.findLast = findLast;
      lodash2.findLastIndex = findLastIndex;
      lodash2.findLastKey = findLastKey;
      lodash2.floor = floor;
      lodash2.forEach = forEach2;
      lodash2.forEachRight = forEachRight;
      lodash2.forIn = forIn;
      lodash2.forInRight = forInRight;
      lodash2.forOwn = forOwn2;
      lodash2.forOwnRight = forOwnRight;
      lodash2.get = get5;
      lodash2.gt = gt;
      lodash2.gte = gte;
      lodash2.has = has;
      lodash2.hasIn = hasIn2;
      lodash2.head = head;
      lodash2.identity = identity2;
      lodash2.includes = includes;
      lodash2.indexOf = indexOf2;
      lodash2.inRange = inRange2;
      lodash2.invoke = invoke;
      lodash2.isArguments = isArguments2;
      lodash2.isArray = isArray3;
      lodash2.isArrayBuffer = isArrayBuffer2;
      lodash2.isArrayLike = isArrayLike2;
      lodash2.isArrayLikeObject = isArrayLikeObject2;
      lodash2.isBoolean = isBoolean2;
      lodash2.isBuffer = isBuffer2;
      lodash2.isDate = isDate2;
      lodash2.isElement = isElement;
      lodash2.isEmpty = isEmpty2;
      lodash2.isEqual = isEqual2;
      lodash2.isEqualWith = isEqualWith;
      lodash2.isError = isError;
      lodash2.isFinite = isFinite2;
      lodash2.isFunction = isFunction2;
      lodash2.isInteger = isInteger2;
      lodash2.isLength = isLength2;
      lodash2.isMap = isMap2;
      lodash2.isMatch = isMatch;
      lodash2.isMatchWith = isMatchWith;
      lodash2.isNaN = isNaN2;
      lodash2.isNative = isNative;
      lodash2.isNil = isNil;
      lodash2.isNull = isNull;
      lodash2.isNumber = isNumber2;
      lodash2.isObject = isObject2;
      lodash2.isObjectLike = isObjectLike2;
      lodash2.isPlainObject = isPlainObject3;
      lodash2.isRegExp = isRegExp2;
      lodash2.isSafeInteger = isSafeInteger;
      lodash2.isSet = isSet2;
      lodash2.isString = isString2;
      lodash2.isSymbol = isSymbol2;
      lodash2.isTypedArray = isTypedArray2;
      lodash2.isUndefined = isUndefined2;
      lodash2.isWeakMap = isWeakMap;
      lodash2.isWeakSet = isWeakSet;
      lodash2.join = join2;
      lodash2.kebabCase = kebabCase;
      lodash2.last = last;
      lodash2.lastIndexOf = lastIndexOf;
      lodash2.lowerCase = lowerCase;
      lodash2.lowerFirst = lowerFirst;
      lodash2.lt = lt;
      lodash2.lte = lte;
      lodash2.max = max2;
      lodash2.maxBy = maxBy;
      lodash2.mean = mean;
      lodash2.meanBy = meanBy;
      lodash2.min = min2;
      lodash2.minBy = minBy;
      lodash2.stubArray = stubArray2;
      lodash2.stubFalse = stubFalse2;
      lodash2.stubObject = stubObject;
      lodash2.stubString = stubString;
      lodash2.stubTrue = stubTrue;
      lodash2.multiply = multiply;
      lodash2.nth = nth;
      lodash2.noConflict = noConflict;
      lodash2.noop = noop4;
      lodash2.now = now2;
      lodash2.pad = pad;
      lodash2.padEnd = padEnd;
      lodash2.padStart = padStart;
      lodash2.parseInt = parseInt2;
      lodash2.random = random;
      lodash2.reduce = reduce;
      lodash2.reduceRight = reduceRight;
      lodash2.repeat = repeat;
      lodash2.replace = replace2;
      lodash2.result = result;
      lodash2.round = round2;
      lodash2.runInContext = runInContext2;
      lodash2.sample = sample2;
      lodash2.size = size2;
      lodash2.snakeCase = snakeCase;
      lodash2.some = some2;
      lodash2.sortedIndex = sortedIndex;
      lodash2.sortedIndexBy = sortedIndexBy;
      lodash2.sortedIndexOf = sortedIndexOf;
      lodash2.sortedLastIndex = sortedLastIndex;
      lodash2.sortedLastIndexBy = sortedLastIndexBy;
      lodash2.sortedLastIndexOf = sortedLastIndexOf;
      lodash2.startCase = startCase;
      lodash2.startsWith = startsWith;
      lodash2.subtract = subtract2;
      lodash2.sum = sum;
      lodash2.sumBy = sumBy;
      lodash2.template = template2;
      lodash2.times = times;
      lodash2.toFinite = toFinite;
      lodash2.toInteger = toInteger;
      lodash2.toLength = toLength;
      lodash2.toLower = toLower;
      lodash2.toNumber = toNumber2;
      lodash2.toSafeInteger = toSafeInteger;
      lodash2.toString = toString4;
      lodash2.toUpper = toUpper;
      lodash2.trim = trim2;
      lodash2.trimEnd = trimEnd;
      lodash2.trimStart = trimStart;
      lodash2.truncate = truncate;
      lodash2.unescape = unescape3;
      lodash2.uniqueId = uniqueId2;
      lodash2.upperCase = upperCase;
      lodash2.upperFirst = upperFirst;
      lodash2.each = forEach2;
      lodash2.eachRight = forEachRight;
      lodash2.first = head;
      mixin(lodash2, function() {
        var source2 = {};
        baseForOwn2(lodash2, function(func, methodName) {
          if (!hasOwnProperty2.call(lodash2.prototype, methodName)) {
            source2[methodName] = func;
          }
        });
        return source2;
      }(), { "chain": false });
      lodash2.VERSION = VERSION2;
      arrayEach2(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
        lodash2[methodName].placeholder = lodash2;
      });
      arrayEach2(["drop", "take"], function(methodName, index2) {
        LazyWrapper.prototype[methodName] = function(n2) {
          n2 = n2 === undefined$1 ? 1 : nativeMax2(toInteger(n2), 0);
          var result2 = this.__filtered__ && !index2 ? new LazyWrapper(this) : this.clone();
          if (result2.__filtered__) {
            result2.__takeCount__ = nativeMin2(n2, result2.__takeCount__);
          } else {
            result2.__views__.push({
              "size": nativeMin2(n2, MAX_ARRAY_LENGTH),
              "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
            });
          }
          return result2;
        };
        LazyWrapper.prototype[methodName + "Right"] = function(n2) {
          return this.reverse()[methodName](n2).reverse();
        };
      });
      arrayEach2(["filter", "map", "takeWhile"], function(methodName, index2) {
        var type4 = index2 + 1, isFilter = type4 == LAZY_FILTER_FLAG || type4 == LAZY_WHILE_FLAG;
        LazyWrapper.prototype[methodName] = function(iteratee2) {
          var result2 = this.clone();
          result2.__iteratees__.push({
            "iteratee": getIteratee(iteratee2, 3),
            "type": type4
          });
          result2.__filtered__ = result2.__filtered__ || isFilter;
          return result2;
        };
      });
      arrayEach2(["head", "last"], function(methodName, index2) {
        var takeName = "take" + (index2 ? "Right" : "");
        LazyWrapper.prototype[methodName] = function() {
          return this[takeName](1).value()[0];
        };
      });
      arrayEach2(["initial", "tail"], function(methodName, index2) {
        var dropName = "drop" + (index2 ? "" : "Right");
        LazyWrapper.prototype[methodName] = function() {
          return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
        };
      });
      LazyWrapper.prototype.compact = function() {
        return this.filter(identity2);
      };
      LazyWrapper.prototype.find = function(predicate) {
        return this.filter(predicate).head();
      };
      LazyWrapper.prototype.findLast = function(predicate) {
        return this.reverse().find(predicate);
      };
      LazyWrapper.prototype.invokeMap = baseRest2(function(path, args) {
        if (typeof path == "function") {
          return new LazyWrapper(this);
        }
        return this.map(function(value2) {
          return baseInvoke(value2, path, args);
        });
      });
      LazyWrapper.prototype.reject = function(predicate) {
        return this.filter(negate(getIteratee(predicate)));
      };
      LazyWrapper.prototype.slice = function(start, end) {
        start = toInteger(start);
        var result2 = this;
        if (result2.__filtered__ && (start > 0 || end < 0)) {
          return new LazyWrapper(result2);
        }
        if (start < 0) {
          result2 = result2.takeRight(-start);
        } else if (start) {
          result2 = result2.drop(start);
        }
        if (end !== undefined$1) {
          end = toInteger(end);
          result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start);
        }
        return result2;
      };
      LazyWrapper.prototype.takeRightWhile = function(predicate) {
        return this.reverse().takeWhile(predicate).reverse();
      };
      LazyWrapper.prototype.toArray = function() {
        return this.take(MAX_ARRAY_LENGTH);
      };
      baseForOwn2(LazyWrapper.prototype, function(func, methodName) {
        var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
        if (!lodashFunc) {
          return;
        }
        lodash2.prototype[methodName] = function() {
          var value2 = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value2 instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray3(value2);
          var interceptor = function(value3) {
            var result3 = lodashFunc.apply(lodash2, arrayPush2([value3], args));
            return isTaker && chainAll ? result3[0] : result3;
          };
          if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
            isLazy = useLazy = false;
          }
          var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
          if (!retUnwrapped && useLazy) {
            value2 = onlyLazy ? value2 : new LazyWrapper(this);
            var result2 = func.apply(value2, args);
            result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 });
            return new LodashWrapper(result2, chainAll);
          }
          if (isUnwrapped && onlyLazy) {
            return func.apply(this, args);
          }
          result2 = this.thru(interceptor);
          return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
        };
      });
      arrayEach2(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
        var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
        lodash2.prototype[methodName] = function() {
          var args = arguments;
          if (retUnwrapped && !this.__chain__) {
            var value2 = this.value();
            return func.apply(isArray3(value2) ? value2 : [], args);
          }
          return this[chainName](function(value3) {
            return func.apply(isArray3(value3) ? value3 : [], args);
          });
        };
      });
      baseForOwn2(LazyWrapper.prototype, function(func, methodName) {
        var lodashFunc = lodash2[methodName];
        if (lodashFunc) {
          var key = lodashFunc.name + "";
          if (!hasOwnProperty2.call(realNames, key)) {
            realNames[key] = [];
          }
          realNames[key].push({ "name": methodName, "func": lodashFunc });
        }
      });
      realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{
        "name": "wrapper",
        "func": undefined$1
      }];
      LazyWrapper.prototype.clone = lazyClone;
      LazyWrapper.prototype.reverse = lazyReverse;
      LazyWrapper.prototype.value = lazyValue;
      lodash2.prototype.at = wrapperAt;
      lodash2.prototype.chain = wrapperChain;
      lodash2.prototype.commit = wrapperCommit;
      lodash2.prototype.next = wrapperNext;
      lodash2.prototype.plant = wrapperPlant;
      lodash2.prototype.reverse = wrapperReverse;
      lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue;
      lodash2.prototype.first = lodash2.prototype.head;
      if (symIterator) {
        lodash2.prototype[symIterator] = wrapperToIterator;
      }
      return lodash2;
    };
    var _24 = runInContext();
    if (freeModule2) {
      (freeModule2.exports = _24)._ = _24;
      freeExports2._ = _24;
    } else {
      root2._ = _24;
    }
  }).call(commonjsGlobal);
})(lodash, lodash.exports);
var lodashExports = lodash.exports;
const _$2 = /* @__PURE__ */ getDefaultExportFromCjs(lodashExports);
const Modal = (props) => {
  const {
    title,
    children,
    defaultVisible,
    visible: visibleProp,
    footer: footer2,
    onClose: onCloseProp,
    onOk,
    size: sizeProp,
    okProps,
    className: classNameProp,
    classNames: classNamesProp,
    onDestroyed,
    ...restProps
  } = props;
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(defaultVisible ?? visibleProp);
  const [size2, setSize] = reactExports.useState();
  const [okLoading, setOkLoading] = reactExports.useState(false);
  const domRef = reactExports.useRef(null);
  const isOpen = visibleProp != void 0 ? visibleProp : visible;
  const autoFocused = reactExports.useRef(false);
  let classNameParts = [];
  switch (sizeProp) {
    case "5xl":
      classNameParts.push("max-w-5xl");
      break;
    case "6xl":
      classNameParts.push("max-w-6xl");
      break;
    case "7xl":
      classNameParts.push("max-w-7xl");
      break;
  }
  if (classNameProp) {
    classNameParts.push(classNameProp);
  }
  const className = classNameParts.join(" ");
  reactExports.useEffect(() => {
  }, []);
  reactExports.useEffect(() => {
    switch (sizeProp) {
      case "sm":
        setSize("sm");
        break;
      case "md":
        setSize("lg");
        break;
      case "lg":
        setSize("2xl");
        break;
      case "2xl":
        setSize("2xl");
        break;
      case "3xl":
        setSize("3xl");
        break;
      case "4xl":
        setSize("4xl");
        break;
      case "5xl":
      case "6xl":
      case "7xl":
        setSize("5xl");
        break;
      case "xl":
        setSize("5xl");
        break;
      case "full":
        setSize("full");
        break;
      default:
        setSize(void 0);
    }
  }, [sizeProp]);
  const onClose = () => {
    setVisible(false);
    onCloseProp == null ? void 0 : onCloseProp();
  };
  const renderFooter = () => {
    if (footer2 === false) {
      return null;
    }
    const simpleFooter = footer2 === void 0 || footer2 === true ? {
      actions: ["ok", "cancel"]
    } : (footer2 == null ? void 0 : footer2["actions"]) ? footer2 : void 0;
    if (simpleFooter == void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(modal_footer_default, { children: footer2 });
    }
    const elements = [];
    if (simpleFooter.actions.includes("cancel")) {
      const { children: children2, ref, ...otherProps } = simpleFooter.cancelProps || {};
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            ref,
            color: "danger",
            variant: "light",
            onPress: otherProps.onPress ?? onClose,
            ...otherProps,
            children: children2 ?? t2("Close")
          },
          "cancel"
        )
      );
    }
    if (simpleFooter.actions.includes("ok")) {
      const { children: children2, ref, autoFocus, ...otherProps } = {
        ...simpleFooter.okProps,
        ...okProps
      };
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            ref: (r2) => {
              if (typeof ref === "function") {
                ref(r2);
              } else {
                if (ref && typeof ref === "object" && "current" in ref) {
                  ref.current = r2;
                }
              }
              if (r2 && !autoFocused.current && autoFocus) {
                autoFocused.current = true;
                r2.focus();
              }
            },
            color: "primary",
            isLoading: okLoading,
            onPress: async (e2) => {
              var _a2;
              const r2 = (_a2 = onOk ?? otherProps.onPress) == null ? void 0 : _a2(e2);
              if (r2 instanceof Promise) {
                setOkLoading(true);
                try {
                  await r2;
                  onClose();
                } catch (e22) {
                  toast.danger(t2("An error occurred:") + (e22 == null ? void 0 : e22.message));
                  console.error(e22);
                } finally {
                  setOkLoading(false);
                }
              } else {
                onClose();
              }
            },
            ...otherProps,
            children: children2 ?? t2("Confirm")
          },
          "ok"
        )
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(modal_footer_default, { children: elements });
  };
  const classNames2 = _$2.merge({}, classNamesProp);
  if (sizeProp == "2xl") {
    const propsBaseClassName = (classNamesProp == null ? void 0 : classNamesProp["base"]) ?? "";
    classNames2["base"] = propsBaseClassName ? `max-w-[80vw] ${propsBaseClassName}` : "max-w-[80vw]";
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    modal_default,
    {
      ref: (r2) => {
        if (domRef.current && !r2 && !isOpen) {
          onDestroyed == null ? void 0 : onDestroyed();
        }
        domRef.current = r2;
      },
      ...restProps,
      className,
      classNames: classNames2,
      size: size2,
      isOpen,
      onClose,
      scrollBehavior: "inside",
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_content_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_header_default, { className: "flex flex-col gap-1", children: title }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_body_default, { children }),
        renderFooter()
      ] })
    }
  );
};
const PopoverComponent = reactExports.forwardRef(
  ({ trigger, children, visible, closeMode = ["esc", "mask"], ...otherProps }, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      popover_default,
      {
        isOpen: visible,
        shouldCloseOnBlur: closeMode == null ? void 0 : closeMode.includes("esc"),
        shouldCloseOnInteractOutside: () => (closeMode == null ? void 0 : closeMode.includes("mask")) == true,
        ...otherProps,
        ref,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(popover_trigger_default, { children: trigger }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(popover_content_default, { children })
        ]
      }
    );
  }
);
PopoverComponent.displayName = "Popover";
var lib$1 = {};
var flattenNames$1 = {};
var freeGlobal$3 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var _freeGlobal = freeGlobal$3;
var freeGlobal$2 = _freeGlobal;
var freeSelf$2 = typeof self == "object" && self && self.Object === Object && self;
var root$c = freeGlobal$2 || freeSelf$2 || Function("return this")();
var _root = root$c;
var root$b = _root;
var Symbol$8 = root$b.Symbol;
var _Symbol = Symbol$8;
var Symbol$7 = _Symbol;
var objectProto$v = Object.prototype;
var hasOwnProperty$r = objectProto$v.hasOwnProperty;
var nativeObjectToString$3 = objectProto$v.toString;
var symToStringTag$3 = Symbol$7 ? Symbol$7.toStringTag : void 0;
function getRawTag$2(value2) {
  var isOwn = hasOwnProperty$r.call(value2, symToStringTag$3), tag = value2[symToStringTag$3];
  try {
    value2[symToStringTag$3] = void 0;
    var unmasked = true;
  } catch (e2) {
  }
  var result = nativeObjectToString$3.call(value2);
  if (unmasked) {
    if (isOwn) {
      value2[symToStringTag$3] = tag;
    } else {
      delete value2[symToStringTag$3];
    }
  }
  return result;
}
var _getRawTag = getRawTag$2;
var objectProto$u = Object.prototype;
var nativeObjectToString$2 = objectProto$u.toString;
function objectToString$3(value2) {
  return nativeObjectToString$2.call(value2);
}
var _objectToString = objectToString$3;
var Symbol$6 = _Symbol, getRawTag$1 = _getRawTag, objectToString$2 = _objectToString;
var nullTag$1 = "[object Null]", undefinedTag$1 = "[object Undefined]";
var symToStringTag$2 = Symbol$6 ? Symbol$6.toStringTag : void 0;
function baseGetTag$8(value2) {
  if (value2 == null) {
    return value2 === void 0 ? undefinedTag$1 : nullTag$1;
  }
  return symToStringTag$2 && symToStringTag$2 in Object(value2) ? getRawTag$1(value2) : objectToString$2(value2);
}
var _baseGetTag = baseGetTag$8;
var isArray$i = Array.isArray;
var isArray_1 = isArray$i;
function isObjectLike$b(value2) {
  return value2 != null && typeof value2 == "object";
}
var isObjectLike_1 = isObjectLike$b;
var baseGetTag$7 = _baseGetTag, isArray$h = isArray_1, isObjectLike$a = isObjectLike_1;
var stringTag$6 = "[object String]";
function isString$3(value2) {
  return typeof value2 == "string" || !isArray$h(value2) && isObjectLike$a(value2) && baseGetTag$7(value2) == stringTag$6;
}
var isString_1 = isString$3;
function createBaseFor$2(fromRight) {
  return function(object4, iteratee, keysFunc) {
    var index2 = -1, iterable = Object(object4), props = keysFunc(object4), length2 = props.length;
    while (length2--) {
      var key = props[fromRight ? length2 : ++index2];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object4;
  };
}
var _createBaseFor = createBaseFor$2;
var createBaseFor$1 = _createBaseFor;
var baseFor$2 = createBaseFor$1();
var _baseFor = baseFor$2;
function baseTimes$2(n2, iteratee) {
  var index2 = -1, result = Array(n2);
  while (++index2 < n2) {
    result[index2] = iteratee(index2);
  }
  return result;
}
var _baseTimes = baseTimes$2;
var baseGetTag$6 = _baseGetTag, isObjectLike$9 = isObjectLike_1;
var argsTag$6 = "[object Arguments]";
function baseIsArguments$2(value2) {
  return isObjectLike$9(value2) && baseGetTag$6(value2) == argsTag$6;
}
var _baseIsArguments = baseIsArguments$2;
var baseIsArguments$1 = _baseIsArguments, isObjectLike$8 = isObjectLike_1;
var objectProto$t = Object.prototype;
var hasOwnProperty$q = objectProto$t.hasOwnProperty;
var propertyIsEnumerable$3 = objectProto$t.propertyIsEnumerable;
var isArguments$3 = baseIsArguments$1(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments$1 : function(value2) {
  return isObjectLike$8(value2) && hasOwnProperty$q.call(value2, "callee") && !propertyIsEnumerable$3.call(value2, "callee");
};
var isArguments_1 = isArguments$3;
var isBuffer$5 = { exports: {} };
function stubFalse$1() {
  return false;
}
var stubFalse_1 = stubFalse$1;
isBuffer$5.exports;
(function(module2, exports2) {
  var root2 = _root, stubFalse2 = stubFalse_1;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0;
  var nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : void 0;
  var isBuffer2 = nativeIsBuffer2 || stubFalse2;
  module2.exports = isBuffer2;
})(isBuffer$5, isBuffer$5.exports);
var isBufferExports = isBuffer$5.exports;
var MAX_SAFE_INTEGER$3 = 9007199254740991;
var reIsUint$1 = /^(?:0|[1-9]\d*)$/;
function isIndex$3(value2, length2) {
  var type4 = typeof value2;
  length2 = length2 == null ? MAX_SAFE_INTEGER$3 : length2;
  return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint$1.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
}
var _isIndex = isIndex$3;
var MAX_SAFE_INTEGER$2 = 9007199254740991;
function isLength$4(value2) {
  return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER$2;
}
var isLength_1 = isLength$4;
var baseGetTag$5 = _baseGetTag, isLength$3 = isLength_1, isObjectLike$7 = isObjectLike_1;
var argsTag$5 = "[object Arguments]", arrayTag$4 = "[object Array]", boolTag$5 = "[object Boolean]", dateTag$5 = "[object Date]", errorTag$4 = "[object Error]", funcTag$5 = "[object Function]", mapTag$8 = "[object Map]", numberTag$5 = "[object Number]", objectTag$8 = "[object Object]", regexpTag$5 = "[object RegExp]", setTag$8 = "[object Set]", stringTag$5 = "[object String]", weakMapTag$4 = "[object WeakMap]";
var arrayBufferTag$5 = "[object ArrayBuffer]", dataViewTag$7 = "[object DataView]", float32Tag$3 = "[object Float32Array]", float64Tag$3 = "[object Float64Array]", int8Tag$3 = "[object Int8Array]", int16Tag$3 = "[object Int16Array]", int32Tag$3 = "[object Int32Array]", uint8Tag$3 = "[object Uint8Array]", uint8ClampedTag$3 = "[object Uint8ClampedArray]", uint16Tag$3 = "[object Uint16Array]", uint32Tag$3 = "[object Uint32Array]";
var typedArrayTags$1 = {};
typedArrayTags$1[float32Tag$3] = typedArrayTags$1[float64Tag$3] = typedArrayTags$1[int8Tag$3] = typedArrayTags$1[int16Tag$3] = typedArrayTags$1[int32Tag$3] = typedArrayTags$1[uint8Tag$3] = typedArrayTags$1[uint8ClampedTag$3] = typedArrayTags$1[uint16Tag$3] = typedArrayTags$1[uint32Tag$3] = true;
typedArrayTags$1[argsTag$5] = typedArrayTags$1[arrayTag$4] = typedArrayTags$1[arrayBufferTag$5] = typedArrayTags$1[boolTag$5] = typedArrayTags$1[dataViewTag$7] = typedArrayTags$1[dateTag$5] = typedArrayTags$1[errorTag$4] = typedArrayTags$1[funcTag$5] = typedArrayTags$1[mapTag$8] = typedArrayTags$1[numberTag$5] = typedArrayTags$1[objectTag$8] = typedArrayTags$1[regexpTag$5] = typedArrayTags$1[setTag$8] = typedArrayTags$1[stringTag$5] = typedArrayTags$1[weakMapTag$4] = false;
function baseIsTypedArray$2(value2) {
  return isObjectLike$7(value2) && isLength$3(value2.length) && !!typedArrayTags$1[baseGetTag$5(value2)];
}
var _baseIsTypedArray = baseIsTypedArray$2;
function baseUnary$4(func) {
  return function(value2) {
    return func(value2);
  };
}
var _baseUnary = baseUnary$4;
var _nodeUtil = { exports: {} };
_nodeUtil.exports;
(function(module2, exports2) {
  var freeGlobal2 = _freeGlobal;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var freeProcess2 = moduleExports2 && freeGlobal2.process;
  var nodeUtil2 = function() {
    try {
      var types2 = freeModule2 && freeModule2.require && freeModule2.require("util").types;
      if (types2) {
        return types2;
      }
      return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
    } catch (e2) {
    }
  }();
  module2.exports = nodeUtil2;
})(_nodeUtil, _nodeUtil.exports);
var _nodeUtilExports = _nodeUtil.exports;
var baseIsTypedArray$1 = _baseIsTypedArray, baseUnary$3 = _baseUnary, nodeUtil$3 = _nodeUtilExports;
var nodeIsTypedArray$1 = nodeUtil$3 && nodeUtil$3.isTypedArray;
var isTypedArray$4 = nodeIsTypedArray$1 ? baseUnary$3(nodeIsTypedArray$1) : baseIsTypedArray$1;
var isTypedArray_1 = isTypedArray$4;
var baseTimes$1 = _baseTimes, isArguments$2 = isArguments_1, isArray$g = isArray_1, isBuffer$4 = isBufferExports, isIndex$2 = _isIndex, isTypedArray$3 = isTypedArray_1;
var objectProto$s = Object.prototype;
var hasOwnProperty$p = objectProto$s.hasOwnProperty;
function arrayLikeKeys$3(value2, inherited) {
  var isArr = isArray$g(value2), isArg = !isArr && isArguments$2(value2), isBuff = !isArr && !isArg && isBuffer$4(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$3(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes$1(value2.length, String) : [], length2 = result.length;
  for (var key in value2) {
    if ((inherited || hasOwnProperty$p.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
    (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
    isIndex$2(key, length2)))) {
      result.push(key);
    }
  }
  return result;
}
var _arrayLikeKeys = arrayLikeKeys$3;
var objectProto$r = Object.prototype;
function isPrototype$4(value2) {
  var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto$r;
  return value2 === proto2;
}
var _isPrototype = isPrototype$4;
function overArg$3(func, transform2) {
  return function(arg) {
    return func(transform2(arg));
  };
}
var _overArg = overArg$3;
var overArg$2 = _overArg;
var nativeKeys$2 = overArg$2(Object.keys, Object);
var _nativeKeys = nativeKeys$2;
var isPrototype$3 = _isPrototype, nativeKeys$1 = _nativeKeys;
var objectProto$q = Object.prototype;
var hasOwnProperty$o = objectProto$q.hasOwnProperty;
function baseKeys$2(object4) {
  if (!isPrototype$3(object4)) {
    return nativeKeys$1(object4);
  }
  var result = [];
  for (var key in Object(object4)) {
    if (hasOwnProperty$o.call(object4, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
var _baseKeys = baseKeys$2;
function isObject$b(value2) {
  var type4 = typeof value2;
  return value2 != null && (type4 == "object" || type4 == "function");
}
var isObject_1 = isObject$b;
var baseGetTag$4 = _baseGetTag, isObject$a = isObject_1;
var asyncTag$1 = "[object AsyncFunction]", funcTag$4 = "[object Function]", genTag$3 = "[object GeneratorFunction]", proxyTag$1 = "[object Proxy]";
function isFunction$8(value2) {
  if (!isObject$a(value2)) {
    return false;
  }
  var tag = baseGetTag$4(value2);
  return tag == funcTag$4 || tag == genTag$3 || tag == asyncTag$1 || tag == proxyTag$1;
}
var isFunction_1 = isFunction$8;
var isFunction$7 = isFunction_1, isLength$2 = isLength_1;
function isArrayLike$5(value2) {
  return value2 != null && isLength$2(value2.length) && !isFunction$7(value2);
}
var isArrayLike_1 = isArrayLike$5;
var arrayLikeKeys$2 = _arrayLikeKeys, baseKeys$1 = _baseKeys, isArrayLike$4 = isArrayLike_1;
function keys$8(object4) {
  return isArrayLike$4(object4) ? arrayLikeKeys$2(object4) : baseKeys$1(object4);
}
var keys_1 = keys$8;
var baseFor$1 = _baseFor, keys$7 = keys_1;
function baseForOwn$3(object4, iteratee) {
  return object4 && baseFor$1(object4, iteratee, keys$7);
}
var _baseForOwn = baseForOwn$3;
function identity$5(value2) {
  return value2;
}
var identity_1 = identity$5;
var identity$4 = identity_1;
function castFunction$2(value2) {
  return typeof value2 == "function" ? value2 : identity$4;
}
var _castFunction = castFunction$2;
var baseForOwn$2 = _baseForOwn, castFunction$1 = _castFunction;
function forOwn(object4, iteratee) {
  return object4 && baseForOwn$2(object4, castFunction$1(iteratee));
}
var forOwn_1 = forOwn;
var overArg$1 = _overArg;
var getPrototype$4 = overArg$1(Object.getPrototypeOf, Object);
var _getPrototype = getPrototype$4;
var baseGetTag$3 = _baseGetTag, getPrototype$3 = _getPrototype, isObjectLike$6 = isObjectLike_1;
var objectTag$7 = "[object Object]";
var funcProto$6 = Function.prototype, objectProto$p = Object.prototype;
var funcToString$6 = funcProto$6.toString;
var hasOwnProperty$n = objectProto$p.hasOwnProperty;
var objectCtorString$1 = funcToString$6.call(Object);
function isPlainObject$4(value2) {
  if (!isObjectLike$6(value2) || baseGetTag$3(value2) != objectTag$7) {
    return false;
  }
  var proto2 = getPrototype$3(value2);
  if (proto2 === null) {
    return true;
  }
  var Ctor = hasOwnProperty$n.call(proto2, "constructor") && proto2.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$6.call(Ctor) == objectCtorString$1;
}
var isPlainObject_1 = isPlainObject$4;
function arrayMap$3(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
  while (++index2 < length2) {
    result[index2] = iteratee(array4[index2], index2, array4);
  }
  return result;
}
var _arrayMap = arrayMap$3;
function listCacheClear$3() {
  this.__data__ = [];
  this.size = 0;
}
var _listCacheClear = listCacheClear$3;
function eq$6(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
var eq_1 = eq$6;
var eq$5 = eq_1;
function assocIndexOf$6(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq$5(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
var _assocIndexOf = assocIndexOf$6;
var assocIndexOf$5 = _assocIndexOf;
var arrayProto$2 = Array.prototype;
var splice$3 = arrayProto$2.splice;
function listCacheDelete$3(key) {
  var data = this.__data__, index2 = assocIndexOf$5(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$3.call(data, index2, 1);
  }
  --this.size;
  return true;
}
var _listCacheDelete = listCacheDelete$3;
var assocIndexOf$4 = _assocIndexOf;
function listCacheGet$3(key) {
  var data = this.__data__, index2 = assocIndexOf$4(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
var _listCacheGet = listCacheGet$3;
var assocIndexOf$3 = _assocIndexOf;
function listCacheHas$3(key) {
  return assocIndexOf$3(this.__data__, key) > -1;
}
var _listCacheHas = listCacheHas$3;
var assocIndexOf$2 = _assocIndexOf;
function listCacheSet$3(key, value2) {
  var data = this.__data__, index2 = assocIndexOf$2(data, key);
  if (index2 < 0) {
    ++this.size;
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
var _listCacheSet = listCacheSet$3;
var listCacheClear$2 = _listCacheClear, listCacheDelete$2 = _listCacheDelete, listCacheGet$2 = _listCacheGet, listCacheHas$2 = _listCacheHas, listCacheSet$2 = _listCacheSet;
function ListCache$6(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
ListCache$6.prototype.clear = listCacheClear$2;
ListCache$6.prototype["delete"] = listCacheDelete$2;
ListCache$6.prototype.get = listCacheGet$2;
ListCache$6.prototype.has = listCacheHas$2;
ListCache$6.prototype.set = listCacheSet$2;
var _ListCache = ListCache$6;
var ListCache$5 = _ListCache;
function stackClear$2() {
  this.__data__ = new ListCache$5();
  this.size = 0;
}
var _stackClear = stackClear$2;
function stackDelete$2(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
var _stackDelete = stackDelete$2;
function stackGet$2(key) {
  return this.__data__.get(key);
}
var _stackGet = stackGet$2;
function stackHas$2(key) {
  return this.__data__.has(key);
}
var _stackHas = stackHas$2;
var root$a = _root;
var coreJsData$3 = root$a["__core-js_shared__"];
var _coreJsData = coreJsData$3;
var coreJsData$2 = _coreJsData;
var maskSrcKey$2 = function() {
  var uid2 = /[^.]+$/.exec(coreJsData$2 && coreJsData$2.keys && coreJsData$2.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
function isMasked$3(func) {
  return !!maskSrcKey$2 && maskSrcKey$2 in func;
}
var _isMasked = isMasked$3;
var funcProto$5 = Function.prototype;
var funcToString$5 = funcProto$5.toString;
function toSource$4(func) {
  if (func != null) {
    try {
      return funcToString$5.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
var _toSource = toSource$4;
var isFunction$6 = isFunction_1, isMasked$2 = _isMasked, isObject$9 = isObject_1, toSource$3 = _toSource;
var reRegExpChar$2 = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor$2 = /^\[object .+?Constructor\]$/;
var funcProto$4 = Function.prototype, objectProto$o = Object.prototype;
var funcToString$4 = funcProto$4.toString;
var hasOwnProperty$m = objectProto$o.hasOwnProperty;
var reIsNative$2 = RegExp(
  "^" + funcToString$4.call(hasOwnProperty$m).replace(reRegExpChar$2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative$3(value2) {
  if (!isObject$9(value2) || isMasked$2(value2)) {
    return false;
  }
  var pattern4 = isFunction$6(value2) ? reIsNative$2 : reIsHostCtor$2;
  return pattern4.test(toSource$3(value2));
}
var _baseIsNative = baseIsNative$3;
function getValue$3(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
var _getValue = getValue$3;
var baseIsNative$2 = _baseIsNative, getValue$2 = _getValue;
function getNative$9(object4, key) {
  var value2 = getValue$2(object4, key);
  return baseIsNative$2(value2) ? value2 : void 0;
}
var _getNative = getNative$9;
var getNative$8 = _getNative, root$9 = _root;
var Map$6 = getNative$8(root$9, "Map");
var _Map = Map$6;
var getNative$7 = _getNative;
var nativeCreate$6 = getNative$7(Object, "create");
var _nativeCreate = nativeCreate$6;
var nativeCreate$5 = _nativeCreate;
function hashClear$3() {
  this.__data__ = nativeCreate$5 ? nativeCreate$5(null) : {};
  this.size = 0;
}
var _hashClear = hashClear$3;
function hashDelete$3(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
var _hashDelete = hashDelete$3;
var nativeCreate$4 = _nativeCreate;
var HASH_UNDEFINED$6 = "__lodash_hash_undefined__";
var objectProto$n = Object.prototype;
var hasOwnProperty$l = objectProto$n.hasOwnProperty;
function hashGet$3(key) {
  var data = this.__data__;
  if (nativeCreate$4) {
    var result = data[key];
    return result === HASH_UNDEFINED$6 ? void 0 : result;
  }
  return hasOwnProperty$l.call(data, key) ? data[key] : void 0;
}
var _hashGet = hashGet$3;
var nativeCreate$3 = _nativeCreate;
var objectProto$m = Object.prototype;
var hasOwnProperty$k = objectProto$m.hasOwnProperty;
function hashHas$3(key) {
  var data = this.__data__;
  return nativeCreate$3 ? data[key] !== void 0 : hasOwnProperty$k.call(data, key);
}
var _hashHas = hashHas$3;
var nativeCreate$2 = _nativeCreate;
var HASH_UNDEFINED$5 = "__lodash_hash_undefined__";
function hashSet$3(key, value2) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate$2 && value2 === void 0 ? HASH_UNDEFINED$5 : value2;
  return this;
}
var _hashSet = hashSet$3;
var hashClear$2 = _hashClear, hashDelete$2 = _hashDelete, hashGet$2 = _hashGet, hashHas$2 = _hashHas, hashSet$2 = _hashSet;
function Hash$3(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
Hash$3.prototype.clear = hashClear$2;
Hash$3.prototype["delete"] = hashDelete$2;
Hash$3.prototype.get = hashGet$2;
Hash$3.prototype.has = hashHas$2;
Hash$3.prototype.set = hashSet$2;
var _Hash = Hash$3;
var Hash$2 = _Hash, ListCache$4 = _ListCache, Map$5 = _Map;
function mapCacheClear$3() {
  this.size = 0;
  this.__data__ = {
    "hash": new Hash$2(),
    "map": new (Map$5 || ListCache$4)(),
    "string": new Hash$2()
  };
}
var _mapCacheClear = mapCacheClear$3;
function isKeyable$3(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
var _isKeyable = isKeyable$3;
var isKeyable$2 = _isKeyable;
function getMapData$6(map2, key) {
  var data = map2.__data__;
  return isKeyable$2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
var _getMapData = getMapData$6;
var getMapData$5 = _getMapData;
function mapCacheDelete$3(key) {
  var result = getMapData$5(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
var _mapCacheDelete = mapCacheDelete$3;
var getMapData$4 = _getMapData;
function mapCacheGet$3(key) {
  return getMapData$4(this, key).get(key);
}
var _mapCacheGet = mapCacheGet$3;
var getMapData$3 = _getMapData;
function mapCacheHas$3(key) {
  return getMapData$3(this, key).has(key);
}
var _mapCacheHas = mapCacheHas$3;
var getMapData$2 = _getMapData;
function mapCacheSet$3(key, value2) {
  var data = getMapData$2(this, key), size2 = data.size;
  data.set(key, value2);
  this.size += data.size == size2 ? 0 : 1;
  return this;
}
var _mapCacheSet = mapCacheSet$3;
var mapCacheClear$2 = _mapCacheClear, mapCacheDelete$2 = _mapCacheDelete, mapCacheGet$2 = _mapCacheGet, mapCacheHas$2 = _mapCacheHas, mapCacheSet$2 = _mapCacheSet;
function MapCache$5(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
MapCache$5.prototype.clear = mapCacheClear$2;
MapCache$5.prototype["delete"] = mapCacheDelete$2;
MapCache$5.prototype.get = mapCacheGet$2;
MapCache$5.prototype.has = mapCacheHas$2;
MapCache$5.prototype.set = mapCacheSet$2;
var _MapCache = MapCache$5;
var ListCache$3 = _ListCache, Map$4 = _Map, MapCache$4 = _MapCache;
var LARGE_ARRAY_SIZE$1 = 200;
function stackSet$2(key, value2) {
  var data = this.__data__;
  if (data instanceof ListCache$3) {
    var pairs = data.__data__;
    if (!Map$4 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
      pairs.push([key, value2]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache$4(pairs);
  }
  data.set(key, value2);
  this.size = data.size;
  return this;
}
var _stackSet = stackSet$2;
var ListCache$2 = _ListCache, stackClear$1 = _stackClear, stackDelete$1 = _stackDelete, stackGet$1 = _stackGet, stackHas$1 = _stackHas, stackSet$1 = _stackSet;
function Stack$4(entries) {
  var data = this.__data__ = new ListCache$2(entries);
  this.size = data.size;
}
Stack$4.prototype.clear = stackClear$1;
Stack$4.prototype["delete"] = stackDelete$1;
Stack$4.prototype.get = stackGet$1;
Stack$4.prototype.has = stackHas$1;
Stack$4.prototype.set = stackSet$1;
var _Stack = Stack$4;
var HASH_UNDEFINED$4 = "__lodash_hash_undefined__";
function setCacheAdd$2(value2) {
  this.__data__.set(value2, HASH_UNDEFINED$4);
  return this;
}
var _setCacheAdd = setCacheAdd$2;
function setCacheHas$2(value2) {
  return this.__data__.has(value2);
}
var _setCacheHas = setCacheHas$2;
var MapCache$3 = _MapCache, setCacheAdd$1 = _setCacheAdd, setCacheHas$1 = _setCacheHas;
function SetCache$2(values) {
  var index2 = -1, length2 = values == null ? 0 : values.length;
  this.__data__ = new MapCache$3();
  while (++index2 < length2) {
    this.add(values[index2]);
  }
}
SetCache$2.prototype.add = SetCache$2.prototype.push = setCacheAdd$1;
SetCache$2.prototype.has = setCacheHas$1;
var _SetCache = SetCache$2;
function arraySome$2(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (predicate(array4[index2], index2, array4)) {
      return true;
    }
  }
  return false;
}
var _arraySome = arraySome$2;
function cacheHas$2(cache2, key) {
  return cache2.has(key);
}
var _cacheHas = cacheHas$2;
var SetCache$1 = _SetCache, arraySome$1 = _arraySome, cacheHas$1 = _cacheHas;
var COMPARE_PARTIAL_FLAG$b = 1, COMPARE_UNORDERED_FLAG$7 = 2;
function equalArrays$3(array4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$b, arrLength = array4.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array4);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array4;
  }
  var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG$7 ? new SetCache$1() : void 0;
  stack.set(array4, other);
  stack.set(other, array4);
  while (++index2 < arrLength) {
    var arrValue = array4[index2], othValue = other[index2];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
    }
    if (compared !== void 0) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen2) {
      if (!arraySome$1(other, function(othValue2, othIndex) {
        if (!cacheHas$1(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen2.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array4);
  stack["delete"](other);
  return result;
}
var _equalArrays = equalArrays$3;
var root$8 = _root;
var Uint8Array$4 = root$8.Uint8Array;
var _Uint8Array = Uint8Array$4;
function mapToArray$2(map2) {
  var index2 = -1, result = Array(map2.size);
  map2.forEach(function(value2, key) {
    result[++index2] = [key, value2];
  });
  return result;
}
var _mapToArray = mapToArray$2;
function setToArray$2(set2) {
  var index2 = -1, result = Array(set2.size);
  set2.forEach(function(value2) {
    result[++index2] = value2;
  });
  return result;
}
var _setToArray = setToArray$2;
var Symbol$5 = _Symbol, Uint8Array$3 = _Uint8Array, eq$4 = eq_1, equalArrays$2 = _equalArrays, mapToArray$1 = _mapToArray, setToArray$1 = _setToArray;
var COMPARE_PARTIAL_FLAG$a = 1, COMPARE_UNORDERED_FLAG$6 = 2;
var boolTag$4 = "[object Boolean]", dateTag$4 = "[object Date]", errorTag$3 = "[object Error]", mapTag$7 = "[object Map]", numberTag$4 = "[object Number]", regexpTag$4 = "[object RegExp]", setTag$7 = "[object Set]", stringTag$4 = "[object String]", symbolTag$6 = "[object Symbol]";
var arrayBufferTag$4 = "[object ArrayBuffer]", dataViewTag$6 = "[object DataView]";
var symbolProto$5 = Symbol$5 ? Symbol$5.prototype : void 0, symbolValueOf$2 = symbolProto$5 ? symbolProto$5.valueOf : void 0;
function equalByTag$2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag$6:
      if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
        return false;
      }
      object4 = object4.buffer;
      other = other.buffer;
    case arrayBufferTag$4:
      if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$3(object4), new Uint8Array$3(other))) {
        return false;
      }
      return true;
    case boolTag$4:
    case dateTag$4:
    case numberTag$4:
      return eq$4(+object4, +other);
    case errorTag$3:
      return object4.name == other.name && object4.message == other.message;
    case regexpTag$4:
    case stringTag$4:
      return object4 == other + "";
    case mapTag$7:
      var convert2 = mapToArray$1;
    case setTag$7:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG$a;
      convert2 || (convert2 = setToArray$1);
      if (object4.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object4);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG$6;
      stack.set(object4, other);
      var result = equalArrays$2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object4);
      return result;
    case symbolTag$6:
      if (symbolValueOf$2) {
        return symbolValueOf$2.call(object4) == symbolValueOf$2.call(other);
      }
  }
  return false;
}
var _equalByTag = equalByTag$2;
function arrayPush$3(array4, values) {
  var index2 = -1, length2 = values.length, offset2 = array4.length;
  while (++index2 < length2) {
    array4[offset2 + index2] = values[index2];
  }
  return array4;
}
var _arrayPush = arrayPush$3;
var arrayPush$2 = _arrayPush, isArray$f = isArray_1;
function baseGetAllKeys$3(object4, keysFunc, symbolsFunc) {
  var result = keysFunc(object4);
  return isArray$f(object4) ? result : arrayPush$2(result, symbolsFunc(object4));
}
var _baseGetAllKeys = baseGetAllKeys$3;
function arrayFilter$2(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  while (++index2 < length2) {
    var value2 = array4[index2];
    if (predicate(value2, index2, array4)) {
      result[resIndex++] = value2;
    }
  }
  return result;
}
var _arrayFilter = arrayFilter$2;
function stubArray$3() {
  return [];
}
var stubArray_1 = stubArray$3;
var arrayFilter$1 = _arrayFilter, stubArray$2 = stubArray_1;
var objectProto$l = Object.prototype;
var propertyIsEnumerable$2 = objectProto$l.propertyIsEnumerable;
var nativeGetSymbols$2 = Object.getOwnPropertySymbols;
var getSymbols$4 = !nativeGetSymbols$2 ? stubArray$2 : function(object4) {
  if (object4 == null) {
    return [];
  }
  object4 = Object(object4);
  return arrayFilter$1(nativeGetSymbols$2(object4), function(symbol) {
    return propertyIsEnumerable$2.call(object4, symbol);
  });
};
var _getSymbols = getSymbols$4;
var baseGetAllKeys$2 = _baseGetAllKeys, getSymbols$3 = _getSymbols, keys$6 = keys_1;
function getAllKeys$3(object4) {
  return baseGetAllKeys$2(object4, keys$6, getSymbols$3);
}
var _getAllKeys = getAllKeys$3;
var getAllKeys$2 = _getAllKeys;
var COMPARE_PARTIAL_FLAG$9 = 1;
var objectProto$k = Object.prototype;
var hasOwnProperty$j = objectProto$k.hasOwnProperty;
function equalObjects$2(object4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$9, objProps = getAllKeys$2(object4), objLength = objProps.length, othProps = getAllKeys$2(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index2 = objLength;
  while (index2--) {
    var key = objProps[index2];
    if (!(isPartial ? key in other : hasOwnProperty$j.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object4);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object4;
  }
  var result = true;
  stack.set(object4, other);
  stack.set(other, object4);
  var skipCtor = isPartial;
  while (++index2 < objLength) {
    key = objProps[index2];
    var objValue = object4[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
    }
    if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object4.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object4);
  stack["delete"](other);
  return result;
}
var _equalObjects = equalObjects$2;
var getNative$6 = _getNative, root$7 = _root;
var DataView$3 = getNative$6(root$7, "DataView");
var _DataView = DataView$3;
var getNative$5 = _getNative, root$6 = _root;
var Promise$3 = getNative$5(root$6, "Promise");
var _Promise = Promise$3;
var getNative$4 = _getNative, root$5 = _root;
var Set$3 = getNative$4(root$5, "Set");
var _Set = Set$3;
var getNative$3 = _getNative, root$4 = _root;
var WeakMap$3 = getNative$3(root$4, "WeakMap");
var _WeakMap = WeakMap$3;
var DataView$2 = _DataView, Map$3 = _Map, Promise$2 = _Promise, Set$2 = _Set, WeakMap$2 = _WeakMap, baseGetTag$2 = _baseGetTag, toSource$2 = _toSource;
var mapTag$6 = "[object Map]", objectTag$6 = "[object Object]", promiseTag$1 = "[object Promise]", setTag$6 = "[object Set]", weakMapTag$3 = "[object WeakMap]";
var dataViewTag$5 = "[object DataView]";
var dataViewCtorString$1 = toSource$2(DataView$2), mapCtorString$1 = toSource$2(Map$3), promiseCtorString$1 = toSource$2(Promise$2), setCtorString$1 = toSource$2(Set$2), weakMapCtorString$1 = toSource$2(WeakMap$2);
var getTag$5 = baseGetTag$2;
if (DataView$2 && getTag$5(new DataView$2(new ArrayBuffer(1))) != dataViewTag$5 || Map$3 && getTag$5(new Map$3()) != mapTag$6 || Promise$2 && getTag$5(Promise$2.resolve()) != promiseTag$1 || Set$2 && getTag$5(new Set$2()) != setTag$6 || WeakMap$2 && getTag$5(new WeakMap$2()) != weakMapTag$3) {
  getTag$5 = function(value2) {
    var result = baseGetTag$2(value2), Ctor = result == objectTag$6 ? value2.constructor : void 0, ctorString = Ctor ? toSource$2(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString$1:
          return dataViewTag$5;
        case mapCtorString$1:
          return mapTag$6;
        case promiseCtorString$1:
          return promiseTag$1;
        case setCtorString$1:
          return setTag$6;
        case weakMapCtorString$1:
          return weakMapTag$3;
      }
    }
    return result;
  };
}
var _getTag = getTag$5;
var Stack$3 = _Stack, equalArrays$1 = _equalArrays, equalByTag$1 = _equalByTag, equalObjects$1 = _equalObjects, getTag$4 = _getTag, isArray$e = isArray_1, isBuffer$3 = isBufferExports, isTypedArray$2 = isTypedArray_1;
var COMPARE_PARTIAL_FLAG$8 = 1;
var argsTag$4 = "[object Arguments]", arrayTag$3 = "[object Array]", objectTag$5 = "[object Object]";
var objectProto$j = Object.prototype;
var hasOwnProperty$i = objectProto$j.hasOwnProperty;
function baseIsEqualDeep$2(object4, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray$e(object4), othIsArr = isArray$e(other), objTag = objIsArr ? arrayTag$3 : getTag$4(object4), othTag = othIsArr ? arrayTag$3 : getTag$4(other);
  objTag = objTag == argsTag$4 ? objectTag$5 : objTag;
  othTag = othTag == argsTag$4 ? objectTag$5 : othTag;
  var objIsObj = objTag == objectTag$5, othIsObj = othTag == objectTag$5, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer$3(object4)) {
    if (!isBuffer$3(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack$3());
    return objIsArr || isTypedArray$2(object4) ? equalArrays$1(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag$1(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG$8)) {
    var objIsWrapped = objIsObj && hasOwnProperty$i.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$i.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack$3());
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack$3());
  return equalObjects$1(object4, other, bitmask, customizer, equalFunc, stack);
}
var _baseIsEqualDeep = baseIsEqualDeep$2;
var baseIsEqualDeep$1 = _baseIsEqualDeep, isObjectLike$5 = isObjectLike_1;
function baseIsEqual$3(value2, other, bitmask, customizer, stack) {
  if (value2 === other) {
    return true;
  }
  if (value2 == null || other == null || !isObjectLike$5(value2) && !isObjectLike$5(other)) {
    return value2 !== value2 && other !== other;
  }
  return baseIsEqualDeep$1(value2, other, bitmask, customizer, baseIsEqual$3, stack);
}
var _baseIsEqual = baseIsEqual$3;
var Stack$2 = _Stack, baseIsEqual$2 = _baseIsEqual;
var COMPARE_PARTIAL_FLAG$7 = 1, COMPARE_UNORDERED_FLAG$5 = 2;
function baseIsMatch$2(object4, source2, matchData, customizer) {
  var index2 = matchData.length, length2 = index2, noCustomizer = !customizer;
  if (object4 == null) {
    return !length2;
  }
  object4 = Object(object4);
  while (index2--) {
    var data = matchData[index2];
    if (noCustomizer && data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
      return false;
    }
  }
  while (++index2 < length2) {
    data = matchData[index2];
    var key = data[0], objValue = object4[key], srcValue = data[1];
    if (noCustomizer && data[2]) {
      if (objValue === void 0 && !(key in object4)) {
        return false;
      }
    } else {
      var stack = new Stack$2();
      if (customizer) {
        var result = customizer(objValue, srcValue, key, object4, source2, stack);
      }
      if (!(result === void 0 ? baseIsEqual$2(srcValue, objValue, COMPARE_PARTIAL_FLAG$7 | COMPARE_UNORDERED_FLAG$5, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
var _baseIsMatch = baseIsMatch$2;
var isObject$8 = isObject_1;
function isStrictComparable$3(value2) {
  return value2 === value2 && !isObject$8(value2);
}
var _isStrictComparable = isStrictComparable$3;
var isStrictComparable$2 = _isStrictComparable, keys$5 = keys_1;
function getMatchData$2(object4) {
  var result = keys$5(object4), length2 = result.length;
  while (length2--) {
    var key = result[length2], value2 = object4[key];
    result[length2] = [key, value2, isStrictComparable$2(value2)];
  }
  return result;
}
var _getMatchData = getMatchData$2;
function matchesStrictComparable$3(key, srcValue) {
  return function(object4) {
    if (object4 == null) {
      return false;
    }
    return object4[key] === srcValue && (srcValue !== void 0 || key in Object(object4));
  };
}
var _matchesStrictComparable = matchesStrictComparable$3;
var baseIsMatch$1 = _baseIsMatch, getMatchData$1 = _getMatchData, matchesStrictComparable$2 = _matchesStrictComparable;
function baseMatches$2(source2) {
  var matchData = getMatchData$1(source2);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable$2(matchData[0][0], matchData[0][1]);
  }
  return function(object4) {
    return object4 === source2 || baseIsMatch$1(object4, source2, matchData);
  };
}
var _baseMatches = baseMatches$2;
var baseGetTag$1 = _baseGetTag, isObjectLike$4 = isObjectLike_1;
var symbolTag$5 = "[object Symbol]";
function isSymbol$5(value2) {
  return typeof value2 == "symbol" || isObjectLike$4(value2) && baseGetTag$1(value2) == symbolTag$5;
}
var isSymbol_1 = isSymbol$5;
var isArray$d = isArray_1, isSymbol$4 = isSymbol_1;
var reIsDeepProp$2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp$2 = /^\w*$/;
function isKey$5(value2, object4) {
  if (isArray$d(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol$4(value2)) {
    return true;
  }
  return reIsPlainProp$2.test(value2) || !reIsDeepProp$2.test(value2) || object4 != null && value2 in Object(object4);
}
var _isKey = isKey$5;
var MapCache$2 = _MapCache;
var FUNC_ERROR_TEXT$4 = "Expected a function";
function memoize$3(func, resolver2) {
  if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$4);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result) || cache2;
    return result;
  };
  memoized.cache = new (memoize$3.Cache || MapCache$2)();
  return memoized;
}
memoize$3.Cache = MapCache$2;
var memoize_1 = memoize$3;
var memoize$2 = memoize_1;
var MAX_MEMOIZE_SIZE$1 = 500;
function memoizeCapped$2(func) {
  var result = memoize$2(func, function(key) {
    if (cache2.size === MAX_MEMOIZE_SIZE$1) {
      cache2.clear();
    }
    return key;
  });
  var cache2 = result.cache;
  return result;
}
var _memoizeCapped = memoizeCapped$2;
var memoizeCapped$1 = _memoizeCapped;
var rePropName$2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar$2 = /\\(\\)?/g;
var stringToPath$3 = memoizeCapped$1(function(string3) {
  var result = [];
  if (string3.charCodeAt(0) === 46) {
    result.push("");
  }
  string3.replace(rePropName$2, function(match5, number4, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar$2, "$1") : number4 || match5);
  });
  return result;
});
var _stringToPath = stringToPath$3;
var Symbol$4 = _Symbol, arrayMap$2 = _arrayMap, isArray$c = isArray_1, isSymbol$3 = isSymbol_1;
var symbolProto$4 = Symbol$4 ? Symbol$4.prototype : void 0, symbolToString$2 = symbolProto$4 ? symbolProto$4.toString : void 0;
function baseToString$3(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isArray$c(value2)) {
    return arrayMap$2(value2, baseToString$3) + "";
  }
  if (isSymbol$3(value2)) {
    return symbolToString$2 ? symbolToString$2.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
var _baseToString = baseToString$3;
var baseToString$2 = _baseToString;
function toString$7(value2) {
  return value2 == null ? "" : baseToString$2(value2);
}
var toString_1 = toString$7;
var isArray$b = isArray_1, isKey$4 = _isKey, stringToPath$2 = _stringToPath, toString$6 = toString_1;
function castPath$4(value2, object4) {
  if (isArray$b(value2)) {
    return value2;
  }
  return isKey$4(value2, object4) ? [value2] : stringToPath$2(toString$6(value2));
}
var _castPath = castPath$4;
var isSymbol$2 = isSymbol_1;
function toKey$6(value2) {
  if (typeof value2 == "string" || isSymbol$2(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
var _toKey = toKey$6;
var castPath$3 = _castPath, toKey$5 = _toKey;
function baseGet$4(object4, path) {
  path = castPath$3(path, object4);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey$5(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
var _baseGet = baseGet$4;
var baseGet$3 = _baseGet;
function get$7(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet$3(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
var get_1 = get$7;
function baseHasIn$2(object4, key) {
  return object4 != null && key in Object(object4);
}
var _baseHasIn = baseHasIn$2;
var castPath$2 = _castPath, isArguments$1 = isArguments_1, isArray$a = isArray_1, isIndex$1 = _isIndex, isLength$1 = isLength_1, toKey$4 = _toKey;
function hasPath$2(object4, path, hasFunc) {
  path = castPath$2(path, object4);
  var index2 = -1, length2 = path.length, result = false;
  while (++index2 < length2) {
    var key = toKey$4(path[index2]);
    if (!(result = object4 != null && hasFunc(object4, key))) {
      break;
    }
    object4 = object4[key];
  }
  if (result || ++index2 != length2) {
    return result;
  }
  length2 = object4 == null ? 0 : object4.length;
  return !!length2 && isLength$1(length2) && isIndex$1(key, length2) && (isArray$a(object4) || isArguments$1(object4));
}
var _hasPath = hasPath$2;
var baseHasIn$1 = _baseHasIn, hasPath$1 = _hasPath;
function hasIn$2(object4, path) {
  return object4 != null && hasPath$1(object4, path, baseHasIn$1);
}
var hasIn_1 = hasIn$2;
var baseIsEqual$1 = _baseIsEqual, get$6 = get_1, hasIn$1 = hasIn_1, isKey$3 = _isKey, isStrictComparable$1 = _isStrictComparable, matchesStrictComparable$1 = _matchesStrictComparable, toKey$3 = _toKey;
var COMPARE_PARTIAL_FLAG$6 = 1, COMPARE_UNORDERED_FLAG$4 = 2;
function baseMatchesProperty$2(path, srcValue) {
  if (isKey$3(path) && isStrictComparable$1(srcValue)) {
    return matchesStrictComparable$1(toKey$3(path), srcValue);
  }
  return function(object4) {
    var objValue = get$6(object4, path);
    return objValue === void 0 && objValue === srcValue ? hasIn$1(object4, path) : baseIsEqual$1(srcValue, objValue, COMPARE_PARTIAL_FLAG$6 | COMPARE_UNORDERED_FLAG$4);
  };
}
var _baseMatchesProperty = baseMatchesProperty$2;
function baseProperty$2(key) {
  return function(object4) {
    return object4 == null ? void 0 : object4[key];
  };
}
var _baseProperty = baseProperty$2;
var baseGet$2 = _baseGet;
function basePropertyDeep$2(path) {
  return function(object4) {
    return baseGet$2(object4, path);
  };
}
var _basePropertyDeep = basePropertyDeep$2;
var baseProperty$1 = _baseProperty, basePropertyDeep$1 = _basePropertyDeep, isKey$2 = _isKey, toKey$2 = _toKey;
function property$3(path) {
  return isKey$2(path) ? baseProperty$1(toKey$2(path)) : basePropertyDeep$1(path);
}
var property_1 = property$3;
var baseMatches$1 = _baseMatches, baseMatchesProperty$1 = _baseMatchesProperty, identity$3 = identity_1, isArray$9 = isArray_1, property$2 = property_1;
function baseIteratee$2(value2) {
  if (typeof value2 == "function") {
    return value2;
  }
  if (value2 == null) {
    return identity$3;
  }
  if (typeof value2 == "object") {
    return isArray$9(value2) ? baseMatchesProperty$1(value2[0], value2[1]) : baseMatches$1(value2);
  }
  return property$2(value2);
}
var _baseIteratee = baseIteratee$2;
var isArrayLike$3 = isArrayLike_1;
function createBaseEach$2(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike$3(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length2 = collection.length, index2 = fromRight ? length2 : -1, iterable = Object(collection);
    while (fromRight ? index2-- : ++index2 < length2) {
      if (iteratee(iterable[index2], index2, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}
var _createBaseEach = createBaseEach$2;
var baseForOwn$1 = _baseForOwn, createBaseEach$1 = _createBaseEach;
var baseEach$2 = createBaseEach$1(baseForOwn$1);
var _baseEach = baseEach$2;
var baseEach$1 = _baseEach, isArrayLike$2 = isArrayLike_1;
function baseMap$2(collection, iteratee) {
  var index2 = -1, result = isArrayLike$2(collection) ? Array(collection.length) : [];
  baseEach$1(collection, function(value2, key, collection2) {
    result[++index2] = iteratee(value2, key, collection2);
  });
  return result;
}
var _baseMap = baseMap$2;
var arrayMap$1 = _arrayMap, baseIteratee$1 = _baseIteratee, baseMap$1 = _baseMap, isArray$8 = isArray_1;
function map$4(collection, iteratee) {
  var func = isArray$8(collection) ? arrayMap$1 : baseMap$1;
  return func(collection, baseIteratee$1(iteratee));
}
var map_1 = map$4;
Object.defineProperty(flattenNames$1, "__esModule", {
  value: true
});
flattenNames$1.flattenNames = void 0;
var _isString2 = isString_1;
var _isString3 = _interopRequireDefault$9(_isString2);
var _forOwn2$2 = forOwn_1;
var _forOwn3$2 = _interopRequireDefault$9(_forOwn2$2);
var _isPlainObject2 = isPlainObject_1;
var _isPlainObject3 = _interopRequireDefault$9(_isPlainObject2);
var _map2 = map_1;
var _map3 = _interopRequireDefault$9(_map2);
function _interopRequireDefault$9(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var flattenNames = flattenNames$1.flattenNames = function flattenNames2() {
  var things = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  var names2 = [];
  (0, _map3.default)(things, function(thing) {
    if (Array.isArray(thing)) {
      flattenNames2(thing).map(function(name2) {
        return names2.push(name2);
      });
    } else if ((0, _isPlainObject3.default)(thing)) {
      (0, _forOwn3$2.default)(thing, function(value2, key) {
        value2 === true && names2.push(key);
        names2.push(key + "-" + value2);
      });
    } else if ((0, _isString3.default)(thing)) {
      names2.push(thing);
    }
  });
  return names2;
};
flattenNames$1.default = flattenNames;
var mergeClasses$1 = {};
function arrayEach$2(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (iteratee(array4[index2], index2, array4) === false) {
      break;
    }
  }
  return array4;
}
var _arrayEach = arrayEach$2;
var getNative$2 = _getNative;
var defineProperty$4 = function() {
  try {
    var func = getNative$2(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e2) {
  }
}();
var _defineProperty$3 = defineProperty$4;
var defineProperty$3 = _defineProperty$3;
function baseAssignValue$3(object4, key, value2) {
  if (key == "__proto__" && defineProperty$3) {
    defineProperty$3(object4, key, {
      "configurable": true,
      "enumerable": true,
      "value": value2,
      "writable": true
    });
  } else {
    object4[key] = value2;
  }
}
var _baseAssignValue = baseAssignValue$3;
var baseAssignValue$2 = _baseAssignValue, eq$3 = eq_1;
var objectProto$i = Object.prototype;
var hasOwnProperty$h = objectProto$i.hasOwnProperty;
function assignValue$3(object4, key, value2) {
  var objValue = object4[key];
  if (!(hasOwnProperty$h.call(object4, key) && eq$3(objValue, value2)) || value2 === void 0 && !(key in object4)) {
    baseAssignValue$2(object4, key, value2);
  }
}
var _assignValue = assignValue$3;
var assignValue$2 = _assignValue, baseAssignValue$1 = _baseAssignValue;
function copyObject$5(source2, props, object4, customizer) {
  var isNew = !object4;
  object4 || (object4 = {});
  var index2 = -1, length2 = props.length;
  while (++index2 < length2) {
    var key = props[index2];
    var newValue = customizer ? customizer(object4[key], source2[key], key, object4, source2) : void 0;
    if (newValue === void 0) {
      newValue = source2[key];
    }
    if (isNew) {
      baseAssignValue$1(object4, key, newValue);
    } else {
      assignValue$2(object4, key, newValue);
    }
  }
  return object4;
}
var _copyObject = copyObject$5;
var copyObject$4 = _copyObject, keys$4 = keys_1;
function baseAssign$1(object4, source2) {
  return object4 && copyObject$4(source2, keys$4(source2), object4);
}
var _baseAssign = baseAssign$1;
function nativeKeysIn$2(object4) {
  var result = [];
  if (object4 != null) {
    for (var key in Object(object4)) {
      result.push(key);
    }
  }
  return result;
}
var _nativeKeysIn = nativeKeysIn$2;
var isObject$7 = isObject_1, isPrototype$2 = _isPrototype, nativeKeysIn$1 = _nativeKeysIn;
var objectProto$h = Object.prototype;
var hasOwnProperty$g = objectProto$h.hasOwnProperty;
function baseKeysIn$2(object4) {
  if (!isObject$7(object4)) {
    return nativeKeysIn$1(object4);
  }
  var isProto = isPrototype$2(object4), result = [];
  for (var key in object4) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty$g.call(object4, key)))) {
      result.push(key);
    }
  }
  return result;
}
var _baseKeysIn = baseKeysIn$2;
var arrayLikeKeys$1 = _arrayLikeKeys, baseKeysIn$1 = _baseKeysIn, isArrayLike$1 = isArrayLike_1;
function keysIn$4(object4) {
  return isArrayLike$1(object4) ? arrayLikeKeys$1(object4, true) : baseKeysIn$1(object4);
}
var keysIn_1 = keysIn$4;
var copyObject$3 = _copyObject, keysIn$3 = keysIn_1;
function baseAssignIn$1(object4, source2) {
  return object4 && copyObject$3(source2, keysIn$3(source2), object4);
}
var _baseAssignIn = baseAssignIn$1;
var _cloneBuffer = { exports: {} };
_cloneBuffer.exports;
(function(module2, exports2) {
  var root2 = _root;
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
  function cloneBuffer2(buffer, isDeep) {
    if (isDeep) {
      return buffer.slice();
    }
    var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
    buffer.copy(result);
    return result;
  }
  module2.exports = cloneBuffer2;
})(_cloneBuffer, _cloneBuffer.exports);
var _cloneBufferExports = _cloneBuffer.exports;
function copyArray$2(source2, array4) {
  var index2 = -1, length2 = source2.length;
  array4 || (array4 = Array(length2));
  while (++index2 < length2) {
    array4[index2] = source2[index2];
  }
  return array4;
}
var _copyArray = copyArray$2;
var copyObject$2 = _copyObject, getSymbols$2 = _getSymbols;
function copySymbols$1(source2, object4) {
  return copyObject$2(source2, getSymbols$2(source2), object4);
}
var _copySymbols = copySymbols$1;
var arrayPush$1 = _arrayPush, getPrototype$2 = _getPrototype, getSymbols$1 = _getSymbols, stubArray$1 = stubArray_1;
var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
var getSymbolsIn$2 = !nativeGetSymbols$1 ? stubArray$1 : function(object4) {
  var result = [];
  while (object4) {
    arrayPush$1(result, getSymbols$1(object4));
    object4 = getPrototype$2(object4);
  }
  return result;
};
var _getSymbolsIn = getSymbolsIn$2;
var copyObject$1 = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
function copySymbolsIn$1(source2, object4) {
  return copyObject$1(source2, getSymbolsIn$1(source2), object4);
}
var _copySymbolsIn = copySymbolsIn$1;
var baseGetAllKeys$1 = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$2 = keysIn_1;
function getAllKeysIn$1(object4) {
  return baseGetAllKeys$1(object4, keysIn$2, getSymbolsIn);
}
var _getAllKeysIn = getAllKeysIn$1;
var objectProto$g = Object.prototype;
var hasOwnProperty$f = objectProto$g.hasOwnProperty;
function initCloneArray$1(array4) {
  var length2 = array4.length, result = new array4.constructor(length2);
  if (length2 && typeof array4[0] == "string" && hasOwnProperty$f.call(array4, "index")) {
    result.index = array4.index;
    result.input = array4.input;
  }
  return result;
}
var _initCloneArray = initCloneArray$1;
var Uint8Array$2 = _Uint8Array;
function cloneArrayBuffer$4(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array$2(result).set(new Uint8Array$2(arrayBuffer));
  return result;
}
var _cloneArrayBuffer = cloneArrayBuffer$4;
var cloneArrayBuffer$3 = _cloneArrayBuffer;
function cloneDataView$1(dataView, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$3(dataView.buffer) : dataView.buffer;
  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
var _cloneDataView = cloneDataView$1;
var reFlags = /\w*$/;
function cloneRegExp$1(regexp4) {
  var result = new regexp4.constructor(regexp4.source, reFlags.exec(regexp4));
  result.lastIndex = regexp4.lastIndex;
  return result;
}
var _cloneRegExp = cloneRegExp$1;
var Symbol$3 = _Symbol;
var symbolProto$3 = Symbol$3 ? Symbol$3.prototype : void 0, symbolValueOf$1 = symbolProto$3 ? symbolProto$3.valueOf : void 0;
function cloneSymbol$1(symbol) {
  return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
}
var _cloneSymbol = cloneSymbol$1;
var cloneArrayBuffer$2 = _cloneArrayBuffer;
function cloneTypedArray$2(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer$2(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
var _cloneTypedArray = cloneTypedArray$2;
var cloneArrayBuffer$1 = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray$1 = _cloneTypedArray;
var boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", symbolTag$4 = "[object Symbol]";
var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
function initCloneByTag$1(object4, tag, isDeep) {
  var Ctor = object4.constructor;
  switch (tag) {
    case arrayBufferTag$3:
      return cloneArrayBuffer$1(object4);
    case boolTag$3:
    case dateTag$3:
      return new Ctor(+object4);
    case dataViewTag$4:
      return cloneDataView(object4, isDeep);
    case float32Tag$2:
    case float64Tag$2:
    case int8Tag$2:
    case int16Tag$2:
    case int32Tag$2:
    case uint8Tag$2:
    case uint8ClampedTag$2:
    case uint16Tag$2:
    case uint32Tag$2:
      return cloneTypedArray$1(object4, isDeep);
    case mapTag$5:
      return new Ctor();
    case numberTag$3:
    case stringTag$3:
      return new Ctor(object4);
    case regexpTag$3:
      return cloneRegExp(object4);
    case setTag$5:
      return new Ctor();
    case symbolTag$4:
      return cloneSymbol(object4);
  }
}
var _initCloneByTag = initCloneByTag$1;
var isObject$6 = isObject_1;
var objectCreate$1 = Object.create;
var baseCreate$2 = /* @__PURE__ */ function() {
  function object4() {
  }
  return function(proto2) {
    if (!isObject$6(proto2)) {
      return {};
    }
    if (objectCreate$1) {
      return objectCreate$1(proto2);
    }
    object4.prototype = proto2;
    var result = new object4();
    object4.prototype = void 0;
    return result;
  };
}();
var _baseCreate = baseCreate$2;
var baseCreate$1 = _baseCreate, getPrototype$1 = _getPrototype, isPrototype$1 = _isPrototype;
function initCloneObject$2(object4) {
  return typeof object4.constructor == "function" && !isPrototype$1(object4) ? baseCreate$1(getPrototype$1(object4)) : {};
}
var _initCloneObject = initCloneObject$2;
var getTag$3 = _getTag, isObjectLike$3 = isObjectLike_1;
var mapTag$4 = "[object Map]";
function baseIsMap$1(value2) {
  return isObjectLike$3(value2) && getTag$3(value2) == mapTag$4;
}
var _baseIsMap = baseIsMap$1;
var baseIsMap = _baseIsMap, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
var nodeIsMap = nodeUtil$2 && nodeUtil$2.isMap;
var isMap$1 = nodeIsMap ? baseUnary$2(nodeIsMap) : baseIsMap;
var isMap_1 = isMap$1;
var getTag$2 = _getTag, isObjectLike$2 = isObjectLike_1;
var setTag$4 = "[object Set]";
function baseIsSet$1(value2) {
  return isObjectLike$2(value2) && getTag$2(value2) == setTag$4;
}
var _baseIsSet = baseIsSet$1;
var baseIsSet = _baseIsSet, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
var nodeIsSet = nodeUtil$1 && nodeUtil$1.isSet;
var isSet$1 = nodeIsSet ? baseUnary$1(nodeIsSet) : baseIsSet;
var isSet_1 = isSet$1;
var Stack$1 = _Stack, arrayEach$1 = _arrayEach, assignValue$1 = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer$1 = _cloneBufferExports, copyArray$1 = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys$1 = _getAllKeys, getAllKeysIn = _getAllKeysIn, getTag$1 = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject$1 = _initCloneObject, isArray$7 = isArray_1, isBuffer$2 = isBufferExports, isMap = isMap_1, isObject$5 = isObject_1, isSet = isSet_1, keys$3 = keys_1, keysIn$1 = keysIn_1;
var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG$1 = 4;
var argsTag$3 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$2 = "[object Error]", funcTag$3 = "[object Function]", genTag$2 = "[object GeneratorFunction]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$3 = "[object Symbol]", weakMapTag$2 = "[object WeakMap]";
var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
var cloneableTags = {};
cloneableTags[argsTag$3] = cloneableTags[arrayTag$2] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$3] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag$1] = cloneableTags[float64Tag$1] = cloneableTags[int8Tag$1] = cloneableTags[int16Tag$1] = cloneableTags[int32Tag$1] = cloneableTags[mapTag$3] = cloneableTags[numberTag$2] = cloneableTags[objectTag$4] = cloneableTags[regexpTag$2] = cloneableTags[setTag$3] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$3] = cloneableTags[uint8Tag$1] = cloneableTags[uint8ClampedTag$1] = cloneableTags[uint16Tag$1] = cloneableTags[uint32Tag$1] = true;
cloneableTags[errorTag$2] = cloneableTags[funcTag$3] = cloneableTags[weakMapTag$2] = false;
function baseClone$1(value2, bitmask, customizer, key, object4, stack) {
  var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
  if (customizer) {
    result = object4 ? customizer(value2, key, object4, stack) : customizer(value2);
  }
  if (result !== void 0) {
    return result;
  }
  if (!isObject$5(value2)) {
    return value2;
  }
  var isArr = isArray$7(value2);
  if (isArr) {
    result = initCloneArray(value2);
    if (!isDeep) {
      return copyArray$1(value2, result);
    }
  } else {
    var tag = getTag$1(value2), isFunc = tag == funcTag$3 || tag == genTag$2;
    if (isBuffer$2(value2)) {
      return cloneBuffer$1(value2, isDeep);
    }
    if (tag == objectTag$4 || tag == argsTag$3 || isFunc && !object4) {
      result = isFlat || isFunc ? {} : initCloneObject$1(value2);
      if (!isDeep) {
        return isFlat ? copySymbolsIn(value2, baseAssignIn(result, value2)) : copySymbols(value2, baseAssign(result, value2));
      }
    } else {
      if (!cloneableTags[tag]) {
        return object4 ? value2 : {};
      }
      result = initCloneByTag(value2, tag, isDeep);
    }
  }
  stack || (stack = new Stack$1());
  var stacked = stack.get(value2);
  if (stacked) {
    return stacked;
  }
  stack.set(value2, result);
  if (isSet(value2)) {
    value2.forEach(function(subValue) {
      result.add(baseClone$1(subValue, bitmask, customizer, subValue, value2, stack));
    });
  } else if (isMap(value2)) {
    value2.forEach(function(subValue, key2) {
      result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value2, stack));
    });
  }
  var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys$1 : isFlat ? keysIn$1 : keys$3;
  var props = isArr ? void 0 : keysFunc(value2);
  arrayEach$1(props || value2, function(subValue, key2) {
    if (props) {
      key2 = subValue;
      subValue = value2[key2];
    }
    assignValue$1(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value2, stack));
  });
  return result;
}
var _baseClone = baseClone$1;
var baseClone = _baseClone;
var CLONE_DEEP_FLAG = 1, CLONE_SYMBOLS_FLAG = 4;
function cloneDeep(value2) {
  return baseClone(value2, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
}
var cloneDeep_1 = cloneDeep;
Object.defineProperty(mergeClasses$1, "__esModule", {
  value: true
});
mergeClasses$1.mergeClasses = void 0;
var _forOwn2$1 = forOwn_1;
var _forOwn3$1 = _interopRequireDefault$8(_forOwn2$1);
var _cloneDeep2 = cloneDeep_1;
var _cloneDeep3 = _interopRequireDefault$8(_cloneDeep2);
var _extends$i = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
function _interopRequireDefault$8(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var mergeClasses = mergeClasses$1.mergeClasses = function mergeClasses2(classes) {
  var activeNames = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
  var styles2 = classes.default && (0, _cloneDeep3.default)(classes.default) || {};
  activeNames.map(function(name2) {
    var toMerge = classes[name2];
    if (toMerge) {
      (0, _forOwn3$1.default)(toMerge, function(value2, key) {
        if (!styles2[key]) {
          styles2[key] = {};
        }
        styles2[key] = _extends$i({}, styles2[key], toMerge[key]);
      });
    }
    return name2;
  });
  return styles2;
};
mergeClasses$1.default = mergeClasses;
var autoprefix$1 = {};
Object.defineProperty(autoprefix$1, "__esModule", {
  value: true
});
autoprefix$1.autoprefix = void 0;
var _forOwn2 = forOwn_1;
var _forOwn3 = _interopRequireDefault$7(_forOwn2);
var _extends$h = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
function _interopRequireDefault$7(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
var transforms = {
  borderRadius: function borderRadius(value2) {
    return {
      msBorderRadius: value2,
      MozBorderRadius: value2,
      OBorderRadius: value2,
      WebkitBorderRadius: value2,
      borderRadius: value2
    };
  },
  boxShadow: function boxShadow(value2) {
    return {
      msBoxShadow: value2,
      MozBoxShadow: value2,
      OBoxShadow: value2,
      WebkitBoxShadow: value2,
      boxShadow: value2
    };
  },
  userSelect: function userSelect(value2) {
    return {
      WebkitTouchCallout: value2,
      KhtmlUserSelect: value2,
      MozUserSelect: value2,
      msUserSelect: value2,
      WebkitUserSelect: value2,
      userSelect: value2
    };
  },
  flex: function flex(value2) {
    return {
      WebkitBoxFlex: value2,
      MozBoxFlex: value2,
      WebkitFlex: value2,
      msFlex: value2,
      flex: value2
    };
  },
  flexBasis: function flexBasis(value2) {
    return {
      WebkitFlexBasis: value2,
      flexBasis: value2
    };
  },
  justifyContent: function justifyContent(value2) {
    return {
      WebkitJustifyContent: value2,
      justifyContent: value2
    };
  },
  transition: function transition2(value2) {
    return {
      msTransition: value2,
      MozTransition: value2,
      OTransition: value2,
      WebkitTransition: value2,
      transition: value2
    };
  },
  transform: function transform(value2) {
    return {
      msTransform: value2,
      MozTransform: value2,
      OTransform: value2,
      WebkitTransform: value2,
      transform: value2
    };
  },
  absolute: function absolute(value2) {
    var direction = value2 && value2.split(" ");
    return {
      position: "absolute",
      top: direction && direction[0],
      right: direction && direction[1],
      bottom: direction && direction[2],
      left: direction && direction[3]
    };
  },
  extend: function extend(name2, otherElementStyles) {
    var otherStyle = otherElementStyles[name2];
    if (otherStyle) {
      return otherStyle;
    }
    return {
      "extend": name2
    };
  }
};
var autoprefix = autoprefix$1.autoprefix = function autoprefix2(elements) {
  var prefixed = {};
  (0, _forOwn3.default)(elements, function(styles2, element2) {
    var expanded = {};
    (0, _forOwn3.default)(styles2, function(value2, key) {
      var transform2 = transforms[key];
      if (transform2) {
        expanded = _extends$h({}, expanded, transform2(value2));
      } else {
        expanded[key] = value2;
      }
    });
    prefixed[element2] = expanded;
  });
  return prefixed;
};
autoprefix$1.default = autoprefix;
var hover$1 = {};
Object.defineProperty(hover$1, "__esModule", {
  value: true
});
hover$1.hover = void 0;
var _extends$g = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$4 = reactExports;
var _react2$3 = _interopRequireDefault$6(_react$4);
function _interopRequireDefault$6(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck$9(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$9(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$9(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var hover = hover$1.hover = function hover2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$9(Hover, _React$Component);
    function Hover() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$9(this, Hover);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$9(this, (_ref = Hover.__proto__ || Object.getPrototypeOf(Hover)).call.apply(_ref, [this].concat(args))), _this), _this.state = { hover: false }, _this.handleMouseOver = function() {
        return _this.setState({ hover: true });
      }, _this.handleMouseOut = function() {
        return _this.setState({ hover: false });
      }, _this.render = function() {
        return _react2$3.default.createElement(
          Span,
          { onMouseOver: _this.handleMouseOver, onMouseOut: _this.handleMouseOut },
          _react2$3.default.createElement(Component2, _extends$g({}, _this.props, _this.state))
        );
      }, _temp), _possibleConstructorReturn$9(_this, _ret);
    }
    return Hover;
  }(_react2$3.default.Component);
};
hover$1.default = hover;
var active$1 = {};
Object.defineProperty(active$1, "__esModule", {
  value: true
});
active$1.active = void 0;
var _extends$f = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$3 = reactExports;
var _react2$2 = _interopRequireDefault$5(_react$3);
function _interopRequireDefault$5(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck$8(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$8(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$8(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var active = active$1.active = function active2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$8(Active, _React$Component);
    function Active() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$8(this, Active);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$8(this, (_ref = Active.__proto__ || Object.getPrototypeOf(Active)).call.apply(_ref, [this].concat(args))), _this), _this.state = { active: false }, _this.handleMouseDown = function() {
        return _this.setState({ active: true });
      }, _this.handleMouseUp = function() {
        return _this.setState({ active: false });
      }, _this.render = function() {
        return _react2$2.default.createElement(
          Span,
          { onMouseDown: _this.handleMouseDown, onMouseUp: _this.handleMouseUp },
          _react2$2.default.createElement(Component2, _extends$f({}, _this.props, _this.state))
        );
      }, _temp), _possibleConstructorReturn$8(_this, _ret);
    }
    return Active;
  }(_react2$2.default.Component);
};
active$1.default = active;
var loop = {};
Object.defineProperty(loop, "__esModule", {
  value: true
});
var loopable = function loopable2(i2, length2) {
  var props = {};
  var setProp = function setProp2(name2) {
    var value2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
    props[name2] = value2;
  };
  i2 === 0 && setProp("first-child");
  i2 === length2 - 1 && setProp("last-child");
  (i2 === 0 || i2 % 2 === 0) && setProp("even");
  Math.abs(i2 % 2) === 1 && setProp("odd");
  setProp("nth-child", i2);
  return props;
};
loop.default = loopable;
Object.defineProperty(lib$1, "__esModule", {
  value: true
});
lib$1.ReactCSS = lib$1.loop = lib$1.handleActive = handleHover = lib$1.handleHover = lib$1.hover = void 0;
var _flattenNames = flattenNames$1;
var _flattenNames2 = _interopRequireDefault$4(_flattenNames);
var _mergeClasses = mergeClasses$1;
var _mergeClasses2 = _interopRequireDefault$4(_mergeClasses);
var _autoprefix = autoprefix$1;
var _autoprefix2 = _interopRequireDefault$4(_autoprefix);
var _hover2 = hover$1;
var _hover3 = _interopRequireDefault$4(_hover2);
var _active = active$1;
var _active2 = _interopRequireDefault$4(_active);
var _loop2 = loop;
var _loop3 = _interopRequireDefault$4(_loop2);
function _interopRequireDefault$4(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
lib$1.hover = _hover3.default;
var handleHover = lib$1.handleHover = _hover3.default;
lib$1.handleActive = _active2.default;
lib$1.loop = _loop3.default;
var ReactCSS = lib$1.ReactCSS = function ReactCSS2(classes) {
  for (var _len = arguments.length, activations = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    activations[_key - 1] = arguments[_key];
  }
  var activeNames = (0, _flattenNames2.default)(activations);
  var merged = (0, _mergeClasses2.default)(classes, activeNames);
  return (0, _autoprefix2.default)(merged);
};
var _default$4 = lib$1.default = ReactCSS;
var calculateChange$2 = function calculateChange(e2, hsl, direction, initialA, container) {
  var containerWidth = container.clientWidth;
  var containerHeight = container.clientHeight;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (direction === "vertical") {
    var a2 = void 0;
    if (top2 < 0) {
      a2 = 0;
    } else if (top2 > containerHeight) {
      a2 = 1;
    } else {
      a2 = Math.round(top2 * 100 / containerHeight) / 100;
    }
    if (hsl.a !== a2) {
      return {
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: a2,
        source: "rgb"
      };
    }
  } else {
    var _a2 = void 0;
    if (left2 < 0) {
      _a2 = 0;
    } else if (left2 > containerWidth) {
      _a2 = 1;
    } else {
      _a2 = Math.round(left2 * 100 / containerWidth) / 100;
    }
    if (initialA !== _a2) {
      return {
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: _a2,
        source: "rgb"
      };
    }
  }
  return null;
};
var checkboardCache = {};
var render = function render2(c1, c2, size2, serverCanvas) {
  if (typeof document === "undefined" && !serverCanvas) {
    return null;
  }
  var canvas = serverCanvas ? new serverCanvas() : document.createElement("canvas");
  canvas.width = size2 * 2;
  canvas.height = size2 * 2;
  var ctx = canvas.getContext("2d");
  if (!ctx) {
    return null;
  }
  ctx.fillStyle = c1;
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  ctx.fillStyle = c2;
  ctx.fillRect(0, 0, size2, size2);
  ctx.translate(size2, size2);
  ctx.fillRect(0, 0, size2, size2);
  return canvas.toDataURL();
};
var get$5 = function get(c1, c2, size2, serverCanvas) {
  var key = c1 + "-" + c2 + "-" + size2 + (serverCanvas ? "-server" : "");
  if (checkboardCache[key]) {
    return checkboardCache[key];
  }
  var checkboard = render(c1, c2, size2, serverCanvas);
  checkboardCache[key] = checkboard;
  return checkboard;
};
var _extends$e = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var Checkboard = function Checkboard2(_ref) {
  var white = _ref.white, grey2 = _ref.grey, size2 = _ref.size, renderers = _ref.renderers, borderRadius2 = _ref.borderRadius, boxShadow2 = _ref.boxShadow, children = _ref.children;
  var styles2 = _default$4({
    "default": {
      grid: {
        borderRadius: borderRadius2,
        boxShadow: boxShadow2,
        absolute: "0px 0px 0px 0px",
        background: "url(" + get$5(white, grey2, size2, renderers.canvas) + ") center left"
      }
    }
  });
  return reactExports.isValidElement(children) ? React$6.cloneElement(children, _extends$e({}, children.props, { style: _extends$e({}, children.props.style, styles2.grid) })) : React$6.createElement("div", { style: styles2.grid });
};
Checkboard.defaultProps = {
  size: 8,
  white: "transparent",
  grey: "rgba(0,0,0,.08)",
  renderers: {}
};
var _extends$d = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$7 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$7(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$7(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$7(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Alpha = function(_ref) {
  _inherits$7(Alpha2, _ref);
  function Alpha2() {
    var _ref2;
    var _temp, _this, _ret;
    _classCallCheck$7(this, Alpha2);
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return _ret = (_temp = (_this = _possibleConstructorReturn$7(this, (_ref2 = Alpha2.__proto__ || Object.getPrototypeOf(Alpha2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e2) {
      var change = calculateChange$2(e2, _this.props.hsl, _this.props.direction, _this.props.a, _this.container);
      change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e2);
    }, _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      window.addEventListener("mousemove", _this.handleChange);
      window.addEventListener("mouseup", _this.handleMouseUp);
    }, _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    }, _this.unbindEventListeners = function() {
      window.removeEventListener("mousemove", _this.handleChange);
      window.removeEventListener("mouseup", _this.handleMouseUp);
    }, _temp), _possibleConstructorReturn$7(_this, _ret);
  }
  _createClass$7(Alpha2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var rgb = this.props.rgb;
      var styles2 = _default$4({
        "default": {
          alpha: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius
          },
          checkboard: {
            absolute: "0px 0px 0px 0px",
            overflow: "hidden",
            borderRadius: this.props.radius
          },
          gradient: {
            absolute: "0px 0px 0px 0px",
            background: "linear-gradient(to right, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n           rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)",
            boxShadow: this.props.shadow,
            borderRadius: this.props.radius
          },
          container: {
            position: "relative",
            height: "100%",
            margin: "0 3px"
          },
          pointer: {
            position: "absolute",
            left: rgb.a * 100 + "%"
          },
          slider: {
            width: "4px",
            borderRadius: "1px",
            height: "8px",
            boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
            background: "#fff",
            marginTop: "1px",
            transform: "translateX(-2px)"
          }
        },
        "vertical": {
          gradient: {
            background: "linear-gradient(to bottom, rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 0) 0%,\n           rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + ", 1) 100%)"
          },
          pointer: {
            left: 0,
            top: rgb.a * 100 + "%"
          }
        },
        "overwrite": _extends$d({}, this.props.style)
      }, {
        vertical: this.props.direction === "vertical",
        overwrite: true
      });
      return React$6.createElement(
        "div",
        { style: styles2.alpha },
        React$6.createElement(
          "div",
          { style: styles2.checkboard },
          React$6.createElement(Checkboard, { renderers: this.props.renderers })
        ),
        React$6.createElement("div", { style: styles2.gradient }),
        React$6.createElement(
          "div",
          {
            style: styles2.container,
            ref: function ref(container) {
              return _this2.container = container;
            },
            onMouseDown: this.handleMouseDown,
            onTouchMove: this.handleChange,
            onTouchStart: this.handleChange
          },
          React$6.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$6.createElement(this.props.pointer, this.props) : React$6.createElement("div", { style: styles2.slider })
          )
        )
      );
    }
  }]);
  return Alpha2;
}(reactExports.PureComponent || reactExports.Component);
var _createClass$6 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _defineProperty$2(obj, key, value2) {
  if (key in obj) {
    Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value2;
  }
  return obj;
}
function _classCallCheck$6(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$6(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$6(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var DEFAULT_ARROW_OFFSET = 1;
var UP_KEY_CODE = 38;
var DOWN_KEY_CODE = 40;
var VALID_KEY_CODES = [UP_KEY_CODE, DOWN_KEY_CODE];
var isValidKeyCode = function isValidKeyCode2(keyCode) {
  return VALID_KEY_CODES.indexOf(keyCode) > -1;
};
var getNumberValue = function getNumberValue2(value2) {
  return Number(String(value2).replace(/%/g, ""));
};
var idCounter = 1;
var EditableInput = function(_ref) {
  _inherits$6(EditableInput2, _ref);
  function EditableInput2(props) {
    _classCallCheck$6(this, EditableInput2);
    var _this = _possibleConstructorReturn$6(this, (EditableInput2.__proto__ || Object.getPrototypeOf(EditableInput2)).call(this));
    _this.handleBlur = function() {
      if (_this.state.blurValue) {
        _this.setState({ value: _this.state.blurValue, blurValue: null });
      }
    };
    _this.handleChange = function(e2) {
      _this.setUpdatedValue(e2.target.value, e2);
    };
    _this.handleKeyDown = function(e2) {
      var value2 = getNumberValue(e2.target.value);
      if (!isNaN(value2) && isValidKeyCode(e2.keyCode)) {
        var offset2 = _this.getArrowOffset();
        var updatedValue = e2.keyCode === UP_KEY_CODE ? value2 + offset2 : value2 - offset2;
        _this.setUpdatedValue(updatedValue, e2);
      }
    };
    _this.handleDrag = function(e2) {
      if (_this.props.dragLabel) {
        var newValue = Math.round(_this.props.value + e2.movementX);
        if (newValue >= 0 && newValue <= _this.props.dragMax) {
          _this.props.onChange && _this.props.onChange(_this.getValueObjectWithLabel(newValue), e2);
        }
      }
    };
    _this.handleMouseDown = function(e2) {
      if (_this.props.dragLabel) {
        e2.preventDefault();
        _this.handleDrag(e2);
        window.addEventListener("mousemove", _this.handleDrag);
        window.addEventListener("mouseup", _this.handleMouseUp);
      }
    };
    _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    };
    _this.unbindEventListeners = function() {
      window.removeEventListener("mousemove", _this.handleDrag);
      window.removeEventListener("mouseup", _this.handleMouseUp);
    };
    _this.state = {
      value: String(props.value).toUpperCase(),
      blurValue: String(props.value).toUpperCase()
    };
    _this.inputId = "rc-editable-input-" + idCounter++;
    return _this;
  }
  _createClass$6(EditableInput2, [{
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) {
        if (this.input === document.activeElement) {
          this.setState({ blurValue: String(this.props.value).toUpperCase() });
        } else {
          this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() });
        }
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "getValueObjectWithLabel",
    value: function getValueObjectWithLabel(value2) {
      return _defineProperty$2({}, this.props.label, value2);
    }
  }, {
    key: "getArrowOffset",
    value: function getArrowOffset() {
      return this.props.arrowOffset || DEFAULT_ARROW_OFFSET;
    }
  }, {
    key: "setUpdatedValue",
    value: function setUpdatedValue(value2, e2) {
      var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value2) : value2;
      this.props.onChange && this.props.onChange(onChangeValue, e2);
      this.setState({ value: value2 });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var styles2 = _default$4({
        "default": {
          wrap: {
            position: "relative"
          }
        },
        "user-override": {
          wrap: this.props.style && this.props.style.wrap ? this.props.style.wrap : {},
          input: this.props.style && this.props.style.input ? this.props.style.input : {},
          label: this.props.style && this.props.style.label ? this.props.style.label : {}
        },
        "dragLabel-true": {
          label: {
            cursor: "ew-resize"
          }
        }
      }, {
        "user-override": true
      }, this.props);
      return React$6.createElement(
        "div",
        { style: styles2.wrap },
        React$6.createElement("input", {
          id: this.inputId,
          style: styles2.input,
          ref: function ref(input2) {
            return _this2.input = input2;
          },
          value: this.state.value,
          onKeyDown: this.handleKeyDown,
          onChange: this.handleChange,
          onBlur: this.handleBlur,
          placeholder: this.props.placeholder,
          spellCheck: "false"
        }),
        this.props.label && !this.props.hideLabel ? React$6.createElement(
          "label",
          {
            htmlFor: this.inputId,
            style: styles2.label,
            onMouseDown: this.handleMouseDown
          },
          this.props.label
        ) : null
      );
    }
  }]);
  return EditableInput2;
}(reactExports.PureComponent || reactExports.Component);
var calculateChange$1 = function calculateChange2(e2, direction, hsl, container) {
  var containerWidth = container.clientWidth;
  var containerHeight = container.clientHeight;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (direction === "vertical") {
    var h3 = void 0;
    if (top2 < 0) {
      h3 = 359;
    } else if (top2 > containerHeight) {
      h3 = 0;
    } else {
      var percent2 = -(top2 * 100 / containerHeight) + 100;
      h3 = 360 * percent2 / 100;
    }
    if (hsl.h !== h3) {
      return {
        h: h3,
        s: hsl.s,
        l: hsl.l,
        a: hsl.a,
        source: "hsl"
      };
    }
  } else {
    var _h = void 0;
    if (left2 < 0) {
      _h = 0;
    } else if (left2 > containerWidth) {
      _h = 359;
    } else {
      var _percent = left2 * 100 / containerWidth;
      _h = 360 * _percent / 100;
    }
    if (hsl.h !== _h) {
      return {
        h: _h,
        s: hsl.s,
        l: hsl.l,
        a: hsl.a,
        source: "hsl"
      };
    }
  }
  return null;
};
var _createClass$5 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$5(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$5(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$5(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Hue = function(_ref) {
  _inherits$5(Hue2, _ref);
  function Hue2() {
    var _ref2;
    var _temp, _this, _ret;
    _classCallCheck$5(this, Hue2);
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return _ret = (_temp = (_this = _possibleConstructorReturn$5(this, (_ref2 = Hue2.__proto__ || Object.getPrototypeOf(Hue2)).call.apply(_ref2, [this].concat(args))), _this), _this.handleChange = function(e2) {
      var change = calculateChange$1(e2, _this.props.direction, _this.props.hsl, _this.container);
      change && typeof _this.props.onChange === "function" && _this.props.onChange(change, e2);
    }, _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      window.addEventListener("mousemove", _this.handleChange);
      window.addEventListener("mouseup", _this.handleMouseUp);
    }, _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    }, _temp), _possibleConstructorReturn$5(_this, _ret);
  }
  _createClass$5(Hue2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.unbindEventListeners();
    }
  }, {
    key: "unbindEventListeners",
    value: function unbindEventListeners() {
      window.removeEventListener("mousemove", this.handleChange);
      window.removeEventListener("mouseup", this.handleMouseUp);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _props$direction = this.props.direction, direction = _props$direction === void 0 ? "horizontal" : _props$direction;
      var styles2 = _default$4({
        "default": {
          hue: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius,
            boxShadow: this.props.shadow
          },
          container: {
            padding: "0 2px",
            position: "relative",
            height: "100%",
            borderRadius: this.props.radius
          },
          pointer: {
            position: "absolute",
            left: this.props.hsl.h * 100 / 360 + "%"
          },
          slider: {
            marginTop: "1px",
            width: "4px",
            borderRadius: "1px",
            height: "8px",
            boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
            background: "#fff",
            transform: "translateX(-2px)"
          }
        },
        "vertical": {
          pointer: {
            left: "0px",
            top: -(this.props.hsl.h * 100 / 360) + 100 + "%"
          }
        }
      }, { vertical: direction === "vertical" });
      return React$6.createElement(
        "div",
        { style: styles2.hue },
        React$6.createElement(
          "div",
          {
            className: "hue-" + direction,
            style: styles2.container,
            ref: function ref(container) {
              return _this2.container = container;
            },
            onMouseDown: this.handleMouseDown,
            onTouchMove: this.handleChange,
            onTouchStart: this.handleChange
          },
          React$6.createElement(
            "style",
            null,
            "\n            .hue-horizontal {\n              background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0\n                33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n              background: -webkit-linear-gradient(to right, #f00 0%, #ff0\n                17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n            }\n\n            .hue-vertical {\n              background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%,\n                #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n              background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%,\n                #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n            }\n          "
          ),
          React$6.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$6.createElement(this.props.pointer, this.props) : React$6.createElement("div", { style: styles2.slider })
          )
        )
      );
    }
  }]);
  return Hue2;
}(reactExports.PureComponent || reactExports.Component);
var propTypes$2 = { exports: {} };
var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
var ReactPropTypesSecret = ReactPropTypesSecret_1;
function emptyFunction() {
}
function emptyFunctionWithReset() {
}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
var factoryWithThrowingShims = function() {
  function shim2(props, propName, componentName, location2, propFullName, secret) {
    if (secret === ReactPropTypesSecret) {
      return;
    }
    var err = new Error(
      "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
    );
    err.name = "Invariant Violation";
    throw err;
  }
  shim2.isRequired = shim2;
  function getShim() {
    return shim2;
  }
  var ReactPropTypes = {
    array: shim2,
    bigint: shim2,
    bool: shim2,
    func: shim2,
    number: shim2,
    object: shim2,
    string: shim2,
    symbol: shim2,
    any: shim2,
    arrayOf: getShim,
    element: shim2,
    elementType: shim2,
    instanceOf: getShim,
    node: shim2,
    objectOf: getShim,
    oneOf: getShim,
    oneOfType: getShim,
    shape: getShim,
    exact: getShim,
    checkPropTypes: emptyFunctionWithReset,
    resetWarningCache: emptyFunction
  };
  ReactPropTypes.PropTypes = ReactPropTypes;
  return ReactPropTypes;
};
{
  propTypes$2.exports = factoryWithThrowingShims();
}
var propTypesExports = propTypes$2.exports;
const PropTypes$4 = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
function listCacheClear$1() {
  this.__data__ = [];
  this.size = 0;
}
function eq$2(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
function assocIndexOf$1(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq$2(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
var arrayProto$1 = Array.prototype;
var splice$2 = arrayProto$1.splice;
function listCacheDelete$1(key) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$2.call(data, index2, 1);
  }
  --this.size;
  return true;
}
function listCacheGet$1(key) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas$1(key) {
  return assocIndexOf$1(this.__data__, key) > -1;
}
function listCacheSet$1(key, value2) {
  var data = this.__data__, index2 = assocIndexOf$1(data, key);
  if (index2 < 0) {
    ++this.size;
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
function ListCache$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
ListCache$1.prototype.clear = listCacheClear$1;
ListCache$1.prototype["delete"] = listCacheDelete$1;
ListCache$1.prototype.get = listCacheGet$1;
ListCache$1.prototype.has = listCacheHas$1;
ListCache$1.prototype.set = listCacheSet$1;
function stackClear() {
  this.__data__ = new ListCache$1();
  this.size = 0;
}
function stackDelete(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
function stackGet(key) {
  return this.__data__.get(key);
}
function stackHas(key) {
  return this.__data__.has(key);
}
var freeGlobal$1 = typeof global == "object" && global && global.Object === Object && global;
var freeSelf$1 = typeof self == "object" && self && self.Object === Object && self;
var root$3 = freeGlobal$1 || freeSelf$1 || Function("return this")();
var Symbol$2 = root$3.Symbol;
var objectProto$f = Object.prototype;
var hasOwnProperty$e = objectProto$f.hasOwnProperty;
var nativeObjectToString$1 = objectProto$f.toString;
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
function getRawTag(value2) {
  var isOwn = hasOwnProperty$e.call(value2, symToStringTag$1), tag = value2[symToStringTag$1];
  try {
    value2[symToStringTag$1] = void 0;
    var unmasked = true;
  } catch (e2) {
  }
  var result = nativeObjectToString$1.call(value2);
  if (unmasked) {
    if (isOwn) {
      value2[symToStringTag$1] = tag;
    } else {
      delete value2[symToStringTag$1];
    }
  }
  return result;
}
var objectProto$e = Object.prototype;
var nativeObjectToString = objectProto$e.toString;
function objectToString$1(value2) {
  return nativeObjectToString.call(value2);
}
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
function baseGetTag(value2) {
  if (value2 == null) {
    return value2 === void 0 ? undefinedTag : nullTag;
  }
  return symToStringTag && symToStringTag in Object(value2) ? getRawTag(value2) : objectToString$1(value2);
}
function isObject$4(value2) {
  var type4 = typeof value2;
  return value2 != null && (type4 == "object" || type4 == "function");
}
var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
function isFunction$5(value2) {
  if (!isObject$4(value2)) {
    return false;
  }
  var tag = baseGetTag(value2);
  return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
}
var coreJsData$1 = root$3["__core-js_shared__"];
var maskSrcKey$1 = function() {
  var uid2 = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
function isMasked$1(func) {
  return !!maskSrcKey$1 && maskSrcKey$1 in func;
}
var funcProto$3 = Function.prototype;
var funcToString$3 = funcProto$3.toString;
function toSource$1(func) {
  if (func != null) {
    try {
      return funcToString$3.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor$1 = /^\[object .+?Constructor\]$/;
var funcProto$2 = Function.prototype, objectProto$d = Object.prototype;
var funcToString$2 = funcProto$2.toString;
var hasOwnProperty$d = objectProto$d.hasOwnProperty;
var reIsNative$1 = RegExp(
  "^" + funcToString$2.call(hasOwnProperty$d).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function baseIsNative$1(value2) {
  if (!isObject$4(value2) || isMasked$1(value2)) {
    return false;
  }
  var pattern4 = isFunction$5(value2) ? reIsNative$1 : reIsHostCtor$1;
  return pattern4.test(toSource$1(value2));
}
function getValue$1(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
function getNative$1(object4, key) {
  var value2 = getValue$1(object4, key);
  return baseIsNative$1(value2) ? value2 : void 0;
}
var Map$2 = getNative$1(root$3, "Map");
var nativeCreate$1 = getNative$1(Object, "create");
function hashClear$1() {
  this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  this.size = 0;
}
function hashDelete$1(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
var HASH_UNDEFINED$3 = "__lodash_hash_undefined__";
var objectProto$c = Object.prototype;
var hasOwnProperty$c = objectProto$c.hasOwnProperty;
function hashGet$1(key) {
  var data = this.__data__;
  if (nativeCreate$1) {
    var result = data[key];
    return result === HASH_UNDEFINED$3 ? void 0 : result;
  }
  return hasOwnProperty$c.call(data, key) ? data[key] : void 0;
}
var objectProto$b = Object.prototype;
var hasOwnProperty$b = objectProto$b.hasOwnProperty;
function hashHas$1(key) {
  var data = this.__data__;
  return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$b.call(data, key);
}
var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
function hashSet$1(key, value2) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate$1 && value2 === void 0 ? HASH_UNDEFINED$2 : value2;
  return this;
}
function Hash$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
Hash$1.prototype.clear = hashClear$1;
Hash$1.prototype["delete"] = hashDelete$1;
Hash$1.prototype.get = hashGet$1;
Hash$1.prototype.has = hashHas$1;
Hash$1.prototype.set = hashSet$1;
function mapCacheClear$1() {
  this.size = 0;
  this.__data__ = {
    "hash": new Hash$1(),
    "map": new (Map$2 || ListCache$1)(),
    "string": new Hash$1()
  };
}
function isKeyable$1(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function getMapData$1(map2, key) {
  var data = map2.__data__;
  return isKeyable$1(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function mapCacheDelete$1(key) {
  var result = getMapData$1(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
function mapCacheGet$1(key) {
  return getMapData$1(this, key).get(key);
}
function mapCacheHas$1(key) {
  return getMapData$1(this, key).has(key);
}
function mapCacheSet$1(key, value2) {
  var data = getMapData$1(this, key), size2 = data.size;
  data.set(key, value2);
  this.size += data.size == size2 ? 0 : 1;
  return this;
}
function MapCache$1(entries) {
  var index2 = -1, length2 = entries == null ? 0 : entries.length;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
MapCache$1.prototype.clear = mapCacheClear$1;
MapCache$1.prototype["delete"] = mapCacheDelete$1;
MapCache$1.prototype.get = mapCacheGet$1;
MapCache$1.prototype.has = mapCacheHas$1;
MapCache$1.prototype.set = mapCacheSet$1;
var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value2) {
  var data = this.__data__;
  if (data instanceof ListCache$1) {
    var pairs = data.__data__;
    if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
      pairs.push([key, value2]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache$1(pairs);
  }
  data.set(key, value2);
  this.size = data.size;
  return this;
}
function Stack(entries) {
  var data = this.__data__ = new ListCache$1(entries);
  this.size = data.size;
}
Stack.prototype.clear = stackClear;
Stack.prototype["delete"] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
var defineProperty$2 = function() {
  try {
    var func = getNative$1(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e2) {
  }
}();
function baseAssignValue(object4, key, value2) {
  if (key == "__proto__" && defineProperty$2) {
    defineProperty$2(object4, key, {
      "configurable": true,
      "enumerable": true,
      "value": value2,
      "writable": true
    });
  } else {
    object4[key] = value2;
  }
}
function assignMergeValue(object4, key, value2) {
  if (value2 !== void 0 && !eq$2(object4[key], value2) || value2 === void 0 && !(key in object4)) {
    baseAssignValue(object4, key, value2);
  }
}
function createBaseFor(fromRight) {
  return function(object4, iteratee, keysFunc) {
    var index2 = -1, iterable = Object(object4), props = keysFunc(object4), length2 = props.length;
    while (length2--) {
      var key = props[++index2];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object4;
  };
}
var baseFor = createBaseFor();
var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
var Buffer$2 = moduleExports$2 ? root$3.Buffer : void 0;
Buffer$2 ? Buffer$2.allocUnsafe : void 0;
function cloneBuffer(buffer, isDeep) {
  {
    return buffer.slice();
  }
}
var Uint8Array$1 = root$3.Uint8Array;
function cloneArrayBuffer(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  return result;
}
function cloneTypedArray(typedArray, isDeep) {
  var buffer = cloneArrayBuffer(typedArray.buffer);
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
function copyArray(source2, array4) {
  var index2 = -1, length2 = source2.length;
  array4 || (array4 = Array(length2));
  while (++index2 < length2) {
    array4[index2] = source2[index2];
  }
  return array4;
}
var objectCreate = Object.create;
var baseCreate = /* @__PURE__ */ function() {
  function object4() {
  }
  return function(proto2) {
    if (!isObject$4(proto2)) {
      return {};
    }
    if (objectCreate) {
      return objectCreate(proto2);
    }
    object4.prototype = proto2;
    var result = new object4();
    object4.prototype = void 0;
    return result;
  };
}();
function overArg(func, transform2) {
  return function(arg) {
    return func(transform2(arg));
  };
}
var getPrototype = overArg(Object.getPrototypeOf, Object);
var objectProto$a = Object.prototype;
function isPrototype(value2) {
  var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto$a;
  return value2 === proto2;
}
function initCloneObject(object4) {
  return typeof object4.constructor == "function" && !isPrototype(object4) ? baseCreate(getPrototype(object4)) : {};
}
function isObjectLike$1(value2) {
  return value2 != null && typeof value2 == "object";
}
var argsTag$2 = "[object Arguments]";
function baseIsArguments(value2) {
  return isObjectLike$1(value2) && baseGetTag(value2) == argsTag$2;
}
var objectProto$9 = Object.prototype;
var hasOwnProperty$a = objectProto$9.hasOwnProperty;
var propertyIsEnumerable$1 = objectProto$9.propertyIsEnumerable;
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments : function(value2) {
  return isObjectLike$1(value2) && hasOwnProperty$a.call(value2, "callee") && !propertyIsEnumerable$1.call(value2, "callee");
};
var isArray$6 = Array.isArray;
var MAX_SAFE_INTEGER$1 = 9007199254740991;
function isLength(value2) {
  return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER$1;
}
function isArrayLike(value2) {
  return value2 != null && isLength(value2.length) && !isFunction$5(value2);
}
function isArrayLikeObject(value2) {
  return isObjectLike$1(value2) && isArrayLike(value2);
}
function stubFalse() {
  return false;
}
var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
var Buffer$1 = moduleExports$1 ? root$3.Buffer : void 0;
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
var isBuffer$1 = nativeIsBuffer || stubFalse;
var objectTag$3 = "[object Object]";
var funcProto$1 = Function.prototype, objectProto$8 = Object.prototype;
var funcToString$1 = funcProto$1.toString;
var hasOwnProperty$9 = objectProto$8.hasOwnProperty;
var objectCtorString = funcToString$1.call(Object);
function isPlainObject$3(value2) {
  if (!isObjectLike$1(value2) || baseGetTag(value2) != objectTag$3) {
    return false;
  }
  var proto2 = getPrototype(value2);
  if (proto2 === null) {
    return true;
  }
  var Ctor = hasOwnProperty$9.call(proto2, "constructor") && proto2.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$1.call(Ctor) == objectCtorString;
}
var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
function baseIsTypedArray(value2) {
  return isObjectLike$1(value2) && isLength(value2.length) && !!typedArrayTags[baseGetTag(value2)];
}
function baseUnary(func) {
  return function(value2) {
    return func(value2);
  };
}
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
var moduleExports = freeModule && freeModule.exports === freeExports;
var freeProcess = moduleExports && freeGlobal$1.process;
var nodeUtil = function() {
  try {
    var types2 = freeModule && freeModule.require && freeModule.require("util").types;
    if (types2) {
      return types2;
    }
    return freeProcess && freeProcess.binding && freeProcess.binding("util");
  } catch (e2) {
  }
}();
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
var isTypedArray$1 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
function safeGet(object4, key) {
  if (key === "constructor" && typeof object4[key] === "function") {
    return;
  }
  if (key == "__proto__") {
    return;
  }
  return object4[key];
}
var objectProto$7 = Object.prototype;
var hasOwnProperty$8 = objectProto$7.hasOwnProperty;
function assignValue(object4, key, value2) {
  var objValue = object4[key];
  if (!(hasOwnProperty$8.call(object4, key) && eq$2(objValue, value2)) || value2 === void 0 && !(key in object4)) {
    baseAssignValue(object4, key, value2);
  }
}
function copyObject(source2, props, object4, customizer) {
  var isNew = !object4;
  object4 || (object4 = {});
  var index2 = -1, length2 = props.length;
  while (++index2 < length2) {
    var key = props[index2];
    var newValue = void 0;
    if (newValue === void 0) {
      newValue = source2[key];
    }
    if (isNew) {
      baseAssignValue(object4, key, newValue);
    } else {
      assignValue(object4, key, newValue);
    }
  }
  return object4;
}
function baseTimes(n2, iteratee) {
  var index2 = -1, result = Array(n2);
  while (++index2 < n2) {
    result[index2] = iteratee(index2);
  }
  return result;
}
var MAX_SAFE_INTEGER = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value2, length2) {
  var type4 = typeof value2;
  length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
  return !!length2 && (type4 == "number" || type4 != "symbol" && reIsUint.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
}
var objectProto$6 = Object.prototype;
var hasOwnProperty$7 = objectProto$6.hasOwnProperty;
function arrayLikeKeys(value2, inherited) {
  var isArr = isArray$6(value2), isArg = !isArr && isArguments(value2), isBuff = !isArr && !isArg && isBuffer$1(value2), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value2.length, String) : [], length2 = result.length;
  for (var key in value2) {
    if ((inherited || hasOwnProperty$7.call(value2, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
    (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
    isIndex(key, length2)))) {
      result.push(key);
    }
  }
  return result;
}
function nativeKeysIn(object4) {
  var result = [];
  if (object4 != null) {
    for (var key in Object(object4)) {
      result.push(key);
    }
  }
  return result;
}
var objectProto$5 = Object.prototype;
var hasOwnProperty$6 = objectProto$5.hasOwnProperty;
function baseKeysIn(object4) {
  if (!isObject$4(object4)) {
    return nativeKeysIn(object4);
  }
  var isProto = isPrototype(object4), result = [];
  for (var key in object4) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object4, key)))) {
      result.push(key);
    }
  }
  return result;
}
function keysIn(object4) {
  return isArrayLike(object4) ? arrayLikeKeys(object4, true) : baseKeysIn(object4);
}
function toPlainObject(value2) {
  return copyObject(value2, keysIn(value2));
}
function baseMergeDeep(object4, source2, key, srcIndex, mergeFunc, customizer, stack) {
  var objValue = safeGet(object4, key), srcValue = safeGet(source2, key), stacked = stack.get(srcValue);
  if (stacked) {
    assignMergeValue(object4, key, stacked);
    return;
  }
  var newValue = customizer ? customizer(objValue, srcValue, key + "", object4, source2, stack) : void 0;
  var isCommon = newValue === void 0;
  if (isCommon) {
    var isArr = isArray$6(srcValue), isBuff = !isArr && isBuffer$1(srcValue), isTyped = !isArr && !isBuff && isTypedArray$1(srcValue);
    newValue = srcValue;
    if (isArr || isBuff || isTyped) {
      if (isArray$6(objValue)) {
        newValue = objValue;
      } else if (isArrayLikeObject(objValue)) {
        newValue = copyArray(objValue);
      } else if (isBuff) {
        isCommon = false;
        newValue = cloneBuffer(srcValue);
      } else if (isTyped) {
        isCommon = false;
        newValue = cloneTypedArray(srcValue);
      } else {
        newValue = [];
      }
    } else if (isPlainObject$3(srcValue) || isArguments(srcValue)) {
      newValue = objValue;
      if (isArguments(objValue)) {
        newValue = toPlainObject(objValue);
      } else if (!isObject$4(objValue) || isFunction$5(objValue)) {
        newValue = initCloneObject(srcValue);
      }
    } else {
      isCommon = false;
    }
  }
  if (isCommon) {
    stack.set(srcValue, newValue);
    mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
    stack["delete"](srcValue);
  }
  assignMergeValue(object4, key, newValue);
}
function baseMerge(object4, source2, srcIndex, customizer, stack) {
  if (object4 === source2) {
    return;
  }
  baseFor(source2, function(srcValue, key) {
    stack || (stack = new Stack());
    if (isObject$4(srcValue)) {
      baseMergeDeep(object4, source2, key, srcIndex, baseMerge, customizer, stack);
    } else {
      var newValue = customizer ? customizer(safeGet(object4, key), srcValue, key + "", object4, source2, stack) : void 0;
      if (newValue === void 0) {
        newValue = srcValue;
      }
      assignMergeValue(object4, key, newValue);
    }
  }, keysIn);
}
function identity$2(value2) {
  return value2;
}
function apply(func, thisArg, args) {
  switch (args.length) {
    case 0:
      return func.call(thisArg);
    case 1:
      return func.call(thisArg, args[0]);
    case 2:
      return func.call(thisArg, args[0], args[1]);
    case 3:
      return func.call(thisArg, args[0], args[1], args[2]);
  }
  return func.apply(thisArg, args);
}
var nativeMax$1 = Math.max;
function overRest(func, start, transform2) {
  start = nativeMax$1(start === void 0 ? func.length - 1 : start, 0);
  return function() {
    var args = arguments, index2 = -1, length2 = nativeMax$1(args.length - start, 0), array4 = Array(length2);
    while (++index2 < length2) {
      array4[index2] = args[start + index2];
    }
    index2 = -1;
    var otherArgs = Array(start + 1);
    while (++index2 < start) {
      otherArgs[index2] = args[index2];
    }
    otherArgs[start] = transform2(array4);
    return apply(func, this, otherArgs);
  };
}
function constant(value2) {
  return function() {
    return value2;
  };
}
var baseSetToString = !defineProperty$2 ? identity$2 : function(func, string3) {
  return defineProperty$2(func, "toString", {
    "configurable": true,
    "enumerable": false,
    "value": constant(string3),
    "writable": true
  });
};
var HOT_COUNT = 800, HOT_SPAN = 16;
var nativeNow = Date.now;
function shortOut(func) {
  var count = 0, lastCalled = 0;
  return function() {
    var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
    lastCalled = stamp;
    if (remaining > 0) {
      if (++count >= HOT_COUNT) {
        return arguments[0];
      }
    } else {
      count = 0;
    }
    return func.apply(void 0, arguments);
  };
}
var setToString = shortOut(baseSetToString);
function baseRest(func, start) {
  return setToString(overRest(func, start, identity$2), func + "");
}
function isIterateeCall(value2, index2, object4) {
  if (!isObject$4(object4)) {
    return false;
  }
  var type4 = typeof index2;
  if (type4 == "number" ? isArrayLike(object4) && isIndex(index2, object4.length) : type4 == "string" && index2 in object4) {
    return eq$2(object4[index2], value2);
  }
  return false;
}
function createAssigner(assigner) {
  return baseRest(function(object4, sources) {
    var index2 = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
    customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
    if (guard && isIterateeCall(sources[0], sources[1], guard)) {
      customizer = length2 < 3 ? void 0 : customizer;
      length2 = 1;
    }
    object4 = Object(object4);
    while (++index2 < length2) {
      var source2 = sources[index2];
      if (source2) {
        assigner(object4, source2, index2, customizer);
      }
    }
    return object4;
  });
}
var merge$3 = createAssigner(function(object4, source2, srcIndex) {
  baseMerge(object4, source2, srcIndex);
});
var Raised = function Raised2(_ref) {
  var zDepth = _ref.zDepth, radius = _ref.radius, background = _ref.background, children = _ref.children, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles;
  var styles2 = _default$4(merge$3({
    "default": {
      wrap: {
        position: "relative",
        display: "inline-block"
      },
      content: {
        position: "relative"
      },
      bg: {
        absolute: "0px 0px 0px 0px",
        boxShadow: "0 " + zDepth + "px " + zDepth * 4 + "px rgba(0,0,0,.24)",
        borderRadius: radius,
        background
      }
    },
    "zDepth-0": {
      bg: {
        boxShadow: "none"
      }
    },
    "zDepth-1": {
      bg: {
        boxShadow: "0 2px 10px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.16)"
      }
    },
    "zDepth-2": {
      bg: {
        boxShadow: "0 6px 20px rgba(0,0,0,.19), 0 8px 17px rgba(0,0,0,.2)"
      }
    },
    "zDepth-3": {
      bg: {
        boxShadow: "0 17px 50px rgba(0,0,0,.19), 0 12px 15px rgba(0,0,0,.24)"
      }
    },
    "zDepth-4": {
      bg: {
        boxShadow: "0 25px 55px rgba(0,0,0,.21), 0 16px 28px rgba(0,0,0,.22)"
      }
    },
    "zDepth-5": {
      bg: {
        boxShadow: "0 40px 77px rgba(0,0,0,.22), 0 27px 24px rgba(0,0,0,.2)"
      }
    },
    "square": {
      bg: {
        borderRadius: "0"
      }
    },
    "circle": {
      bg: {
        borderRadius: "50%"
      }
    }
  }, passedStyles), { "zDepth-1": zDepth === 1 });
  return React$6.createElement(
    "div",
    { style: styles2.wrap },
    React$6.createElement("div", { style: styles2.bg }),
    React$6.createElement(
      "div",
      { style: styles2.content },
      children
    )
  );
};
Raised.propTypes = {
  background: PropTypes$4.string,
  zDepth: PropTypes$4.oneOf([0, 1, 2, 3, 4, 5]),
  radius: PropTypes$4.number,
  styles: PropTypes$4.object
};
Raised.defaultProps = {
  background: "#fff",
  zDepth: 1,
  radius: 2,
  styles: {}
};
var now$1 = function() {
  return root$3.Date.now();
};
var reWhitespace = /\s/;
function trimmedEndIndex(string3) {
  var index2 = string3.length;
  while (index2-- && reWhitespace.test(string3.charAt(index2))) {
  }
  return index2;
}
var reTrimStart = /^\s+/;
function baseTrim(string3) {
  return string3 ? string3.slice(0, trimmedEndIndex(string3) + 1).replace(reTrimStart, "") : string3;
}
var symbolTag$2 = "[object Symbol]";
function isSymbol$1(value2) {
  return typeof value2 == "symbol" || isObjectLike$1(value2) && baseGetTag(value2) == symbolTag$2;
}
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value2) {
  if (typeof value2 == "number") {
    return value2;
  }
  if (isSymbol$1(value2)) {
    return NAN;
  }
  if (isObject$4(value2)) {
    var other = typeof value2.valueOf == "function" ? value2.valueOf() : value2;
    value2 = isObject$4(other) ? other + "" : other;
  }
  if (typeof value2 != "string") {
    return value2 === 0 ? value2 : +value2;
  }
  value2 = baseTrim(value2);
  var isBinary = reIsBinary.test(value2);
  return isBinary || reIsOctal.test(value2) ? freeParseInt(value2.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value2) ? NAN : +value2;
}
var FUNC_ERROR_TEXT$3 = "Expected a function";
var nativeMax = Math.max, nativeMin = Math.min;
function debounce$2(func, wait, options) {
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  if (typeof func != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$3);
  }
  wait = toNumber(wait) || 0;
  if (isObject$4(options)) {
    leading = !!options.leading;
    maxing = "maxWait" in options;
    maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
    trailing = "trailing" in options ? !!options.trailing : trailing;
  }
  function invokeFunc(time2) {
    var args = lastArgs, thisArg = lastThis;
    lastArgs = lastThis = void 0;
    lastInvokeTime = time2;
    result = func.apply(thisArg, args);
    return result;
  }
  function leadingEdge(time2) {
    lastInvokeTime = time2;
    timerId = setTimeout(timerExpired, wait);
    return leading ? invokeFunc(time2) : result;
  }
  function remainingWait(time2) {
    var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
    return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  }
  function shouldInvoke(time2) {
    var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
    return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  }
  function timerExpired() {
    var time2 = now$1();
    if (shouldInvoke(time2)) {
      return trailingEdge(time2);
    }
    timerId = setTimeout(timerExpired, remainingWait(time2));
  }
  function trailingEdge(time2) {
    timerId = void 0;
    if (trailing && lastArgs) {
      return invokeFunc(time2);
    }
    lastArgs = lastThis = void 0;
    return result;
  }
  function cancel2() {
    if (timerId !== void 0) {
      clearTimeout(timerId);
    }
    lastInvokeTime = 0;
    lastArgs = lastCallTime = lastThis = timerId = void 0;
  }
  function flush() {
    return timerId === void 0 ? result : trailingEdge(now$1());
  }
  function debounced() {
    var time2 = now$1(), isInvoking = shouldInvoke(time2);
    lastArgs = arguments;
    lastThis = this;
    lastCallTime = time2;
    if (isInvoking) {
      if (timerId === void 0) {
        return leadingEdge(lastCallTime);
      }
      if (maxing) {
        clearTimeout(timerId);
        timerId = setTimeout(timerExpired, wait);
        return invokeFunc(lastCallTime);
      }
    }
    if (timerId === void 0) {
      timerId = setTimeout(timerExpired, wait);
    }
    return result;
  }
  debounced.cancel = cancel2;
  debounced.flush = flush;
  return debounced;
}
var FUNC_ERROR_TEXT$2 = "Expected a function";
function throttle$1(func, wait, options) {
  var leading = true, trailing = true;
  if (typeof func != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$2);
  }
  if (isObject$4(options)) {
    leading = "leading" in options ? !!options.leading : leading;
    trailing = "trailing" in options ? !!options.trailing : trailing;
  }
  return debounce$2(func, wait, {
    "leading": leading,
    "maxWait": wait,
    "trailing": trailing
  });
}
var calculateChange3 = function calculateChange4(e2, hsl, container) {
  var _container$getBoundin = container.getBoundingClientRect(), containerWidth = _container$getBoundin.width, containerHeight = _container$getBoundin.height;
  var x2 = typeof e2.pageX === "number" ? e2.pageX : e2.touches[0].pageX;
  var y2 = typeof e2.pageY === "number" ? e2.pageY : e2.touches[0].pageY;
  var left2 = x2 - (container.getBoundingClientRect().left + window.pageXOffset);
  var top2 = y2 - (container.getBoundingClientRect().top + window.pageYOffset);
  if (left2 < 0) {
    left2 = 0;
  } else if (left2 > containerWidth) {
    left2 = containerWidth;
  }
  if (top2 < 0) {
    top2 = 0;
  } else if (top2 > containerHeight) {
    top2 = containerHeight;
  }
  var saturation = left2 / containerWidth;
  var bright = 1 - top2 / containerHeight;
  return {
    h: hsl.h,
    s: saturation,
    v: bright,
    a: hsl.a,
    source: "hsv"
  };
};
var _createClass$4 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$4(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$4(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$4(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Saturation = function(_ref) {
  _inherits$4(Saturation2, _ref);
  function Saturation2(props) {
    _classCallCheck$4(this, Saturation2);
    var _this = _possibleConstructorReturn$4(this, (Saturation2.__proto__ || Object.getPrototypeOf(Saturation2)).call(this, props));
    _this.handleChange = function(e2) {
      typeof _this.props.onChange === "function" && _this.throttle(_this.props.onChange, calculateChange3(e2, _this.props.hsl, _this.container), e2);
    };
    _this.handleMouseDown = function(e2) {
      _this.handleChange(e2);
      var renderWindow = _this.getContainerRenderWindow();
      renderWindow.addEventListener("mousemove", _this.handleChange);
      renderWindow.addEventListener("mouseup", _this.handleMouseUp);
    };
    _this.handleMouseUp = function() {
      _this.unbindEventListeners();
    };
    _this.throttle = throttle$1(function(fn, data, e2) {
      fn(data, e2);
    }, 50);
    return _this;
  }
  _createClass$4(Saturation2, [{
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.throttle.cancel();
      this.unbindEventListeners();
    }
  }, {
    key: "getContainerRenderWindow",
    value: function getContainerRenderWindow() {
      var container = this.container;
      var renderWindow = window;
      while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
        renderWindow = renderWindow.parent;
      }
      return renderWindow;
    }
  }, {
    key: "unbindEventListeners",
    value: function unbindEventListeners() {
      var renderWindow = this.getContainerRenderWindow();
      renderWindow.removeEventListener("mousemove", this.handleChange);
      renderWindow.removeEventListener("mouseup", this.handleMouseUp);
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _ref2 = this.props.style || {}, color2 = _ref2.color, white = _ref2.white, black = _ref2.black, pointer = _ref2.pointer, circle = _ref2.circle;
      var styles2 = _default$4({
        "default": {
          color: {
            absolute: "0px 0px 0px 0px",
            background: "hsl(" + this.props.hsl.h + ",100%, 50%)",
            borderRadius: this.props.radius
          },
          white: {
            absolute: "0px 0px 0px 0px",
            borderRadius: this.props.radius
          },
          black: {
            absolute: "0px 0px 0px 0px",
            boxShadow: this.props.shadow,
            borderRadius: this.props.radius
          },
          pointer: {
            position: "absolute",
            top: -(this.props.hsv.v * 100) + 100 + "%",
            left: this.props.hsv.s * 100 + "%",
            cursor: "default"
          },
          circle: {
            width: "4px",
            height: "4px",
            boxShadow: "0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),\n            0 0 1px 2px rgba(0,0,0,.4)",
            borderRadius: "50%",
            cursor: "hand",
            transform: "translate(-2px, -2px)"
          }
        },
        "custom": {
          color: color2,
          white,
          black,
          pointer,
          circle
        }
      }, { "custom": !!this.props.style });
      return React$6.createElement(
        "div",
        {
          style: styles2.color,
          ref: function ref(container) {
            return _this2.container = container;
          },
          onMouseDown: this.handleMouseDown,
          onTouchMove: this.handleChange,
          onTouchStart: this.handleChange
        },
        React$6.createElement(
          "style",
          null,
          "\n          .saturation-white {\n            background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));\n            background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n          }\n          .saturation-black {\n            background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));\n            background: linear-gradient(to top, #000, rgba(0,0,0,0));\n          }\n        "
        ),
        React$6.createElement(
          "div",
          { style: styles2.white, className: "saturation-white" },
          React$6.createElement("div", { style: styles2.black, className: "saturation-black" }),
          React$6.createElement(
            "div",
            { style: styles2.pointer },
            this.props.pointer ? React$6.createElement(this.props.pointer, this.props) : React$6.createElement("div", { style: styles2.circle })
          )
        )
      );
    }
  }]);
  return Saturation2;
}(reactExports.PureComponent || reactExports.Component);
function arrayEach(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (iteratee(array4[index2], index2, array4) === false) {
      break;
    }
  }
  return array4;
}
var nativeKeys = overArg(Object.keys, Object);
var objectProto$4 = Object.prototype;
var hasOwnProperty$5 = objectProto$4.hasOwnProperty;
function baseKeys(object4) {
  if (!isPrototype(object4)) {
    return nativeKeys(object4);
  }
  var result = [];
  for (var key in Object(object4)) {
    if (hasOwnProperty$5.call(object4, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
function keys$2(object4) {
  return isArrayLike(object4) ? arrayLikeKeys(object4) : baseKeys(object4);
}
function baseForOwn(object4, iteratee) {
  return object4 && baseFor(object4, iteratee, keys$2);
}
function createBaseEach(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length2 = collection.length, index2 = -1, iterable = Object(collection);
    while (++index2 < length2) {
      if (iteratee(iterable[index2], index2, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}
var baseEach = createBaseEach(baseForOwn);
function castFunction(value2) {
  return typeof value2 == "function" ? value2 : identity$2;
}
function forEach$1(collection, iteratee) {
  var func = isArray$6(collection) ? arrayEach : baseEach;
  return func(collection, castFunction(iteratee));
}
function _typeof$1(obj) {
  "@babel/helpers - typeof";
  return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
    return typeof obj2;
  } : function(obj2) {
    return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
  }, _typeof$1(obj);
}
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
function tinycolor(color2, opts2) {
  color2 = color2 ? color2 : "";
  opts2 = opts2 || {};
  if (color2 instanceof tinycolor) {
    return color2;
  }
  if (!(this instanceof tinycolor)) {
    return new tinycolor(color2, opts2);
  }
  var rgb = inputToRGB(color2);
  this._originalInput = color2, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts2.format || rgb.format;
  this._gradientType = opts2.gradientType;
  if (this._r < 1)
    this._r = Math.round(this._r);
  if (this._g < 1)
    this._g = Math.round(this._g);
  if (this._b < 1)
    this._b = Math.round(this._b);
  this._ok = rgb.ok;
}
tinycolor.prototype = {
  isDark: function isDark() {
    return this.getBrightness() < 128;
  },
  isLight: function isLight() {
    return !this.isDark();
  },
  isValid: function isValid() {
    return this._ok;
  },
  getOriginalInput: function getOriginalInput() {
    return this._originalInput;
  },
  getFormat: function getFormat() {
    return this._format;
  },
  getAlpha: function getAlpha() {
    return this._a;
  },
  getBrightness: function getBrightness() {
    var rgb = this.toRgb();
    return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  },
  getLuminance: function getLuminance() {
    var rgb = this.toRgb();
    var RsRGB, GsRGB, BsRGB, R2, G2, B2;
    RsRGB = rgb.r / 255;
    GsRGB = rgb.g / 255;
    BsRGB = rgb.b / 255;
    if (RsRGB <= 0.03928)
      R2 = RsRGB / 12.92;
    else
      R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
    if (GsRGB <= 0.03928)
      G2 = GsRGB / 12.92;
    else
      G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
    if (BsRGB <= 0.03928)
      B2 = BsRGB / 12.92;
    else
      B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
    return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  },
  setAlpha: function setAlpha(value2) {
    this._a = boundAlpha(value2);
    this._roundA = Math.round(100 * this._a) / 100;
    return this;
  },
  toHsv: function toHsv() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    return {
      h: hsv.h * 360,
      s: hsv.s,
      v: hsv.v,
      a: this._a
    };
  },
  toHsvString: function toHsvString() {
    var hsv = rgbToHsv(this._r, this._g, this._b);
    var h3 = Math.round(hsv.h * 360), s2 = Math.round(hsv.s * 100), v2 = Math.round(hsv.v * 100);
    return this._a == 1 ? "hsv(" + h3 + ", " + s2 + "%, " + v2 + "%)" : "hsva(" + h3 + ", " + s2 + "%, " + v2 + "%, " + this._roundA + ")";
  },
  toHsl: function toHsl() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    return {
      h: hsl.h * 360,
      s: hsl.s,
      l: hsl.l,
      a: this._a
    };
  },
  toHslString: function toHslString() {
    var hsl = rgbToHsl(this._r, this._g, this._b);
    var h3 = Math.round(hsl.h * 360), s2 = Math.round(hsl.s * 100), l2 = Math.round(hsl.l * 100);
    return this._a == 1 ? "hsl(" + h3 + ", " + s2 + "%, " + l2 + "%)" : "hsla(" + h3 + ", " + s2 + "%, " + l2 + "%, " + this._roundA + ")";
  },
  toHex: function toHex(allow3Char) {
    return rgbToHex(this._r, this._g, this._b, allow3Char);
  },
  toHexString: function toHexString(allow3Char) {
    return "#" + this.toHex(allow3Char);
  },
  toHex8: function toHex8(allow4Char) {
    return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
  },
  toHex8String: function toHex8String(allow4Char) {
    return "#" + this.toHex8(allow4Char);
  },
  toRgb: function toRgb() {
    return {
      r: Math.round(this._r),
      g: Math.round(this._g),
      b: Math.round(this._b),
      a: this._a
    };
  },
  toRgbString: function toRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
  },
  toPercentageRgb: function toPercentageRgb() {
    return {
      r: Math.round(bound01(this._r, 255) * 100) + "%",
      g: Math.round(bound01(this._g, 255) * 100) + "%",
      b: Math.round(bound01(this._b, 255) * 100) + "%",
      a: this._a
    };
  },
  toPercentageRgbString: function toPercentageRgbString() {
    return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
  },
  toName: function toName() {
    if (this._a === 0) {
      return "transparent";
    }
    if (this._a < 1) {
      return false;
    }
    return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
  },
  toFilter: function toFilter(secondColor) {
    var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
    var secondHex8String = hex8String;
    var gradientType = this._gradientType ? "GradientType = 1, " : "";
    if (secondColor) {
      var s2 = tinycolor(secondColor);
      secondHex8String = "#" + rgbaToArgbHex(s2._r, s2._g, s2._b, s2._a);
    }
    return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
  },
  toString: function toString(format2) {
    var formatSet = !!format2;
    format2 = format2 || this._format;
    var formattedString = false;
    var hasAlpha = this._a < 1 && this._a >= 0;
    var needsAlphaFormat = !formatSet && hasAlpha && (format2 === "hex" || format2 === "hex6" || format2 === "hex3" || format2 === "hex4" || format2 === "hex8" || format2 === "name");
    if (needsAlphaFormat) {
      if (format2 === "name" && this._a === 0) {
        return this.toName();
      }
      return this.toRgbString();
    }
    if (format2 === "rgb") {
      formattedString = this.toRgbString();
    }
    if (format2 === "prgb") {
      formattedString = this.toPercentageRgbString();
    }
    if (format2 === "hex" || format2 === "hex6") {
      formattedString = this.toHexString();
    }
    if (format2 === "hex3") {
      formattedString = this.toHexString(true);
    }
    if (format2 === "hex4") {
      formattedString = this.toHex8String(true);
    }
    if (format2 === "hex8") {
      formattedString = this.toHex8String();
    }
    if (format2 === "name") {
      formattedString = this.toName();
    }
    if (format2 === "hsl") {
      formattedString = this.toHslString();
    }
    if (format2 === "hsv") {
      formattedString = this.toHsvString();
    }
    return formattedString || this.toHexString();
  },
  clone: function clone() {
    return tinycolor(this.toString());
  },
  _applyModification: function _applyModification(fn, args) {
    var color2 = fn.apply(null, [this].concat([].slice.call(args)));
    this._r = color2._r;
    this._g = color2._g;
    this._b = color2._b;
    this.setAlpha(color2._a);
    return this;
  },
  lighten: function lighten() {
    return this._applyModification(_lighten, arguments);
  },
  brighten: function brighten() {
    return this._applyModification(_brighten, arguments);
  },
  darken: function darken() {
    return this._applyModification(_darken, arguments);
  },
  desaturate: function desaturate() {
    return this._applyModification(_desaturate, arguments);
  },
  saturate: function saturate() {
    return this._applyModification(_saturate, arguments);
  },
  greyscale: function greyscale() {
    return this._applyModification(_greyscale, arguments);
  },
  spin: function spin() {
    return this._applyModification(_spin, arguments);
  },
  _applyCombination: function _applyCombination(fn, args) {
    return fn.apply(null, [this].concat([].slice.call(args)));
  },
  analogous: function analogous() {
    return this._applyCombination(_analogous, arguments);
  },
  complement: function complement() {
    return this._applyCombination(_complement, arguments);
  },
  monochromatic: function monochromatic() {
    return this._applyCombination(_monochromatic, arguments);
  },
  splitcomplement: function splitcomplement() {
    return this._applyCombination(_splitcomplement, arguments);
  },
  // Disabled until https://github.com/bgrins/TinyColor/issues/254
  // polyad: function (number) {
  //   return this._applyCombination(polyad, [number]);
  // },
  triad: function triad() {
    return this._applyCombination(polyad, [3]);
  },
  tetrad: function tetrad() {
    return this._applyCombination(polyad, [4]);
  }
};
tinycolor.fromRatio = function(color2, opts2) {
  if (_typeof$1(color2) == "object") {
    var newColor = {};
    for (var i2 in color2) {
      if (color2.hasOwnProperty(i2)) {
        if (i2 === "a") {
          newColor[i2] = color2[i2];
        } else {
          newColor[i2] = convertToPercentage(color2[i2]);
        }
      }
    }
    color2 = newColor;
  }
  return tinycolor(color2, opts2);
};
function inputToRGB(color2) {
  var rgb = {
    r: 0,
    g: 0,
    b: 0
  };
  var a2 = 1;
  var s2 = null;
  var v2 = null;
  var l2 = null;
  var ok2 = false;
  var format2 = false;
  if (typeof color2 == "string") {
    color2 = stringInputToObject(color2);
  }
  if (_typeof$1(color2) == "object") {
    if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
      rgb = rgbToRgb(color2.r, color2.g, color2.b);
      ok2 = true;
      format2 = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
    } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
      s2 = convertToPercentage(color2.s);
      v2 = convertToPercentage(color2.v);
      rgb = hsvToRgb(color2.h, s2, v2);
      ok2 = true;
      format2 = "hsv";
    } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
      s2 = convertToPercentage(color2.s);
      l2 = convertToPercentage(color2.l);
      rgb = hslToRgb(color2.h, s2, l2);
      ok2 = true;
      format2 = "hsl";
    }
    if (color2.hasOwnProperty("a")) {
      a2 = color2.a;
    }
  }
  a2 = boundAlpha(a2);
  return {
    ok: ok2,
    format: color2.format || format2,
    r: Math.min(255, Math.max(rgb.r, 0)),
    g: Math.min(255, Math.max(rgb.g, 0)),
    b: Math.min(255, Math.max(rgb.b, 0)),
    a: a2
  };
}
function rgbToRgb(r2, g2, b2) {
  return {
    r: bound01(r2, 255) * 255,
    g: bound01(g2, 255) * 255,
    b: bound01(b2, 255) * 255
  };
}
function rgbToHsl(r2, g2, b2) {
  r2 = bound01(r2, 255);
  g2 = bound01(g2, 255);
  b2 = bound01(b2, 255);
  var max2 = Math.max(r2, g2, b2), min2 = Math.min(r2, g2, b2);
  var h3, s2, l2 = (max2 + min2) / 2;
  if (max2 == min2) {
    h3 = s2 = 0;
  } else {
    var d2 = max2 - min2;
    s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
    switch (max2) {
      case r2:
        h3 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
        break;
      case g2:
        h3 = (b2 - r2) / d2 + 2;
        break;
      case b2:
        h3 = (r2 - g2) / d2 + 4;
        break;
    }
    h3 /= 6;
  }
  return {
    h: h3,
    s: s2,
    l: l2
  };
}
function hslToRgb(h3, s2, l2) {
  var r2, g2, b2;
  h3 = bound01(h3, 360);
  s2 = bound01(s2, 100);
  l2 = bound01(l2, 100);
  function hue2rgb(p3, q3, t2) {
    if (t2 < 0)
      t2 += 1;
    if (t2 > 1)
      t2 -= 1;
    if (t2 < 1 / 6)
      return p3 + (q3 - p3) * 6 * t2;
    if (t2 < 1 / 2)
      return q3;
    if (t2 < 2 / 3)
      return p3 + (q3 - p3) * (2 / 3 - t2) * 6;
    return p3;
  }
  if (s2 === 0) {
    r2 = g2 = b2 = l2;
  } else {
    var q2 = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
    var p2 = 2 * l2 - q2;
    r2 = hue2rgb(p2, q2, h3 + 1 / 3);
    g2 = hue2rgb(p2, q2, h3);
    b2 = hue2rgb(p2, q2, h3 - 1 / 3);
  }
  return {
    r: r2 * 255,
    g: g2 * 255,
    b: b2 * 255
  };
}
function rgbToHsv(r2, g2, b2) {
  r2 = bound01(r2, 255);
  g2 = bound01(g2, 255);
  b2 = bound01(b2, 255);
  var max2 = Math.max(r2, g2, b2), min2 = Math.min(r2, g2, b2);
  var h3, s2, v2 = max2;
  var d2 = max2 - min2;
  s2 = max2 === 0 ? 0 : d2 / max2;
  if (max2 == min2) {
    h3 = 0;
  } else {
    switch (max2) {
      case r2:
        h3 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
        break;
      case g2:
        h3 = (b2 - r2) / d2 + 2;
        break;
      case b2:
        h3 = (r2 - g2) / d2 + 4;
        break;
    }
    h3 /= 6;
  }
  return {
    h: h3,
    s: s2,
    v: v2
  };
}
function hsvToRgb(h3, s2, v2) {
  h3 = bound01(h3, 360) * 6;
  s2 = bound01(s2, 100);
  v2 = bound01(v2, 100);
  var i2 = Math.floor(h3), f2 = h3 - i2, p2 = v2 * (1 - s2), q2 = v2 * (1 - f2 * s2), t2 = v2 * (1 - (1 - f2) * s2), mod2 = i2 % 6, r2 = [v2, q2, p2, p2, t2, v2][mod2], g2 = [t2, v2, v2, q2, p2, p2][mod2], b2 = [p2, p2, t2, v2, v2, q2][mod2];
  return {
    r: r2 * 255,
    g: g2 * 255,
    b: b2 * 255
  };
}
function rgbToHex(r2, g2, b2, allow3Char) {
  var hex3 = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16))];
  if (allow3Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1)) {
    return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0);
  }
  return hex3.join("");
}
function rgbaToHex(r2, g2, b2, a2, allow4Char) {
  var hex3 = [pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16)), pad2(convertDecimalToHex(a2))];
  if (allow4Char && hex3[0].charAt(0) == hex3[0].charAt(1) && hex3[1].charAt(0) == hex3[1].charAt(1) && hex3[2].charAt(0) == hex3[2].charAt(1) && hex3[3].charAt(0) == hex3[3].charAt(1)) {
    return hex3[0].charAt(0) + hex3[1].charAt(0) + hex3[2].charAt(0) + hex3[3].charAt(0);
  }
  return hex3.join("");
}
function rgbaToArgbHex(r2, g2, b2, a2) {
  var hex3 = [pad2(convertDecimalToHex(a2)), pad2(Math.round(r2).toString(16)), pad2(Math.round(g2).toString(16)), pad2(Math.round(b2).toString(16))];
  return hex3.join("");
}
tinycolor.equals = function(color1, color2) {
  if (!color1 || !color2)
    return false;
  return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
};
tinycolor.random = function() {
  return tinycolor.fromRatio({
    r: Math.random(),
    g: Math.random(),
    b: Math.random()
  });
};
function _desaturate(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.s -= amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _saturate(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.s += amount / 100;
  hsl.s = clamp01(hsl.s);
  return tinycolor(hsl);
}
function _greyscale(color2) {
  return tinycolor(color2).desaturate(100);
}
function _lighten(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.l += amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}
function _brighten(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var rgb = tinycolor(color2).toRgb();
  rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  return tinycolor(rgb);
}
function _darken(color2, amount) {
  amount = amount === 0 ? 0 : amount || 10;
  var hsl = tinycolor(color2).toHsl();
  hsl.l -= amount / 100;
  hsl.l = clamp01(hsl.l);
  return tinycolor(hsl);
}
function _spin(color2, amount) {
  var hsl = tinycolor(color2).toHsl();
  var hue2 = (hsl.h + amount) % 360;
  hsl.h = hue2 < 0 ? 360 + hue2 : hue2;
  return tinycolor(hsl);
}
function _complement(color2) {
  var hsl = tinycolor(color2).toHsl();
  hsl.h = (hsl.h + 180) % 360;
  return tinycolor(hsl);
}
function polyad(color2, number4) {
  if (isNaN(number4) || number4 <= 0) {
    throw new Error("Argument to polyad must be a positive number");
  }
  var hsl = tinycolor(color2).toHsl();
  var result = [tinycolor(color2)];
  var step = 360 / number4;
  for (var i2 = 1; i2 < number4; i2++) {
    result.push(tinycolor({
      h: (hsl.h + i2 * step) % 360,
      s: hsl.s,
      l: hsl.l
    }));
  }
  return result;
}
function _splitcomplement(color2) {
  var hsl = tinycolor(color2).toHsl();
  var h3 = hsl.h;
  return [tinycolor(color2), tinycolor({
    h: (h3 + 72) % 360,
    s: hsl.s,
    l: hsl.l
  }), tinycolor({
    h: (h3 + 216) % 360,
    s: hsl.s,
    l: hsl.l
  })];
}
function _analogous(color2, results, slices) {
  results = results || 6;
  slices = slices || 30;
  var hsl = tinycolor(color2).toHsl();
  var part = 360 / slices;
  var ret = [tinycolor(color2)];
  for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
    hsl.h = (hsl.h + part) % 360;
    ret.push(tinycolor(hsl));
  }
  return ret;
}
function _monochromatic(color2, results) {
  results = results || 6;
  var hsv = tinycolor(color2).toHsv();
  var h3 = hsv.h, s2 = hsv.s, v2 = hsv.v;
  var ret = [];
  var modification = 1 / results;
  while (results--) {
    ret.push(tinycolor({
      h: h3,
      s: s2,
      v: v2
    }));
    v2 = (v2 + modification) % 1;
  }
  return ret;
}
tinycolor.mix = function(color1, color2, amount) {
  amount = amount === 0 ? 0 : amount || 50;
  var rgb1 = tinycolor(color1).toRgb();
  var rgb2 = tinycolor(color2).toRgb();
  var p2 = amount / 100;
  var rgba2 = {
    r: (rgb2.r - rgb1.r) * p2 + rgb1.r,
    g: (rgb2.g - rgb1.g) * p2 + rgb1.g,
    b: (rgb2.b - rgb1.b) * p2 + rgb1.b,
    a: (rgb2.a - rgb1.a) * p2 + rgb1.a
  };
  return tinycolor(rgba2);
};
tinycolor.readability = function(color1, color2) {
  var c1 = tinycolor(color1);
  var c2 = tinycolor(color2);
  return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
};
tinycolor.isReadable = function(color1, color2, wcag2) {
  var readability = tinycolor.readability(color1, color2);
  var wcag2Parms, out;
  out = false;
  wcag2Parms = validateWCAG2Parms(wcag2);
  switch (wcag2Parms.level + wcag2Parms.size) {
    case "AAsmall":
    case "AAAlarge":
      out = readability >= 4.5;
      break;
    case "AAlarge":
      out = readability >= 3;
      break;
    case "AAAsmall":
      out = readability >= 7;
      break;
  }
  return out;
};
tinycolor.mostReadable = function(baseColor, colorList, args) {
  var bestColor = null;
  var bestScore = 0;
  var readability;
  var includeFallbackColors, level, size2;
  args = args || {};
  includeFallbackColors = args.includeFallbackColors;
  level = args.level;
  size2 = args.size;
  for (var i2 = 0; i2 < colorList.length; i2++) {
    readability = tinycolor.readability(baseColor, colorList[i2]);
    if (readability > bestScore) {
      bestScore = readability;
      bestColor = tinycolor(colorList[i2]);
    }
  }
  if (tinycolor.isReadable(baseColor, bestColor, {
    level,
    size: size2
  }) || !includeFallbackColors) {
    return bestColor;
  } else {
    args.includeFallbackColors = false;
    return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
  }
};
var names$2 = tinycolor.names = {
  aliceblue: "f0f8ff",
  antiquewhite: "faebd7",
  aqua: "0ff",
  aquamarine: "7fffd4",
  azure: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "000",
  blanchedalmond: "ffebcd",
  blue: "00f",
  blueviolet: "8a2be2",
  brown: "a52a2a",
  burlywood: "deb887",
  burntsienna: "ea7e5d",
  cadetblue: "5f9ea0",
  chartreuse: "7fff00",
  chocolate: "d2691e",
  coral: "ff7f50",
  cornflowerblue: "6495ed",
  cornsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "0ff",
  darkblue: "00008b",
  darkcyan: "008b8b",
  darkgoldenrod: "b8860b",
  darkgray: "a9a9a9",
  darkgreen: "006400",
  darkgrey: "a9a9a9",
  darkkhaki: "bdb76b",
  darkmagenta: "8b008b",
  darkolivegreen: "556b2f",
  darkorange: "ff8c00",
  darkorchid: "9932cc",
  darkred: "8b0000",
  darksalmon: "e9967a",
  darkseagreen: "8fbc8f",
  darkslateblue: "483d8b",
  darkslategray: "2f4f4f",
  darkslategrey: "2f4f4f",
  darkturquoise: "00ced1",
  darkviolet: "9400d3",
  deeppink: "ff1493",
  deepskyblue: "00bfff",
  dimgray: "696969",
  dimgrey: "696969",
  dodgerblue: "1e90ff",
  firebrick: "b22222",
  floralwhite: "fffaf0",
  forestgreen: "228b22",
  fuchsia: "f0f",
  gainsboro: "dcdcdc",
  ghostwhite: "f8f8ff",
  gold: "ffd700",
  goldenrod: "daa520",
  gray: "808080",
  green: "008000",
  greenyellow: "adff2f",
  grey: "808080",
  honeydew: "f0fff0",
  hotpink: "ff69b4",
  indianred: "cd5c5c",
  indigo: "4b0082",
  ivory: "fffff0",
  khaki: "f0e68c",
  lavender: "e6e6fa",
  lavenderblush: "fff0f5",
  lawngreen: "7cfc00",
  lemonchiffon: "fffacd",
  lightblue: "add8e6",
  lightcoral: "f08080",
  lightcyan: "e0ffff",
  lightgoldenrodyellow: "fafad2",
  lightgray: "d3d3d3",
  lightgreen: "90ee90",
  lightgrey: "d3d3d3",
  lightpink: "ffb6c1",
  lightsalmon: "ffa07a",
  lightseagreen: "20b2aa",
  lightskyblue: "87cefa",
  lightslategray: "789",
  lightslategrey: "789",
  lightsteelblue: "b0c4de",
  lightyellow: "ffffe0",
  lime: "0f0",
  limegreen: "32cd32",
  linen: "faf0e6",
  magenta: "f0f",
  maroon: "800000",
  mediumaquamarine: "66cdaa",
  mediumblue: "0000cd",
  mediumorchid: "ba55d3",
  mediumpurple: "9370db",
  mediumseagreen: "3cb371",
  mediumslateblue: "7b68ee",
  mediumspringgreen: "00fa9a",
  mediumturquoise: "48d1cc",
  mediumvioletred: "c71585",
  midnightblue: "191970",
  mintcream: "f5fffa",
  mistyrose: "ffe4e1",
  moccasin: "ffe4b5",
  navajowhite: "ffdead",
  navy: "000080",
  oldlace: "fdf5e6",
  olive: "808000",
  olivedrab: "6b8e23",
  orange: "ffa500",
  orangered: "ff4500",
  orchid: "da70d6",
  palegoldenrod: "eee8aa",
  palegreen: "98fb98",
  paleturquoise: "afeeee",
  palevioletred: "db7093",
  papayawhip: "ffefd5",
  peachpuff: "ffdab9",
  peru: "cd853f",
  pink: "ffc0cb",
  plum: "dda0dd",
  powderblue: "b0e0e6",
  purple: "800080",
  rebeccapurple: "663399",
  red: "f00",
  rosybrown: "bc8f8f",
  royalblue: "4169e1",
  saddlebrown: "8b4513",
  salmon: "fa8072",
  sandybrown: "f4a460",
  seagreen: "2e8b57",
  seashell: "fff5ee",
  sienna: "a0522d",
  silver: "c0c0c0",
  skyblue: "87ceeb",
  slateblue: "6a5acd",
  slategray: "708090",
  slategrey: "708090",
  snow: "fffafa",
  springgreen: "00ff7f",
  steelblue: "4682b4",
  tan: "d2b48c",
  teal: "008080",
  thistle: "d8bfd8",
  tomato: "ff6347",
  turquoise: "40e0d0",
  violet: "ee82ee",
  wheat: "f5deb3",
  white: "fff",
  whitesmoke: "f5f5f5",
  yellow: "ff0",
  yellowgreen: "9acd32"
};
var hexNames = tinycolor.hexNames = flip(names$2);
function flip(o2) {
  var flipped = {};
  for (var i2 in o2) {
    if (o2.hasOwnProperty(i2)) {
      flipped[o2[i2]] = i2;
    }
  }
  return flipped;
}
function boundAlpha(a2) {
  a2 = parseFloat(a2);
  if (isNaN(a2) || a2 < 0 || a2 > 1) {
    a2 = 1;
  }
  return a2;
}
function bound01(n2, max2) {
  if (isOnePointZero(n2))
    n2 = "100%";
  var processPercent = isPercentage(n2);
  n2 = Math.min(max2, Math.max(0, parseFloat(n2)));
  if (processPercent) {
    n2 = parseInt(n2 * max2, 10) / 100;
  }
  if (Math.abs(n2 - max2) < 1e-6) {
    return 1;
  }
  return n2 % max2 / parseFloat(max2);
}
function clamp01(val) {
  return Math.min(1, Math.max(0, val));
}
function parseIntFromHex(val) {
  return parseInt(val, 16);
}
function isOnePointZero(n2) {
  return typeof n2 == "string" && n2.indexOf(".") != -1 && parseFloat(n2) === 1;
}
function isPercentage(n2) {
  return typeof n2 === "string" && n2.indexOf("%") != -1;
}
function pad2(c2) {
  return c2.length == 1 ? "0" + c2 : "" + c2;
}
function convertToPercentage(n2) {
  if (n2 <= 1) {
    n2 = n2 * 100 + "%";
  }
  return n2;
}
function convertDecimalToHex(d2) {
  return Math.round(parseFloat(d2) * 255).toString(16);
}
function convertHexToDecimal(h3) {
  return parseIntFromHex(h3) / 255;
}
var matchers = function() {
  var CSS_INTEGER = "[-\\+]?\\d+%?";
  var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
  var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
  return {
    CSS_UNIT: new RegExp(CSS_UNIT),
    rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
    rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
    hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
    hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
    hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
    hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
    hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
    hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
    hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  };
}();
function isValidCSSUnit(color2) {
  return !!matchers.CSS_UNIT.exec(color2);
}
function stringInputToObject(color2) {
  color2 = color2.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
  var named = false;
  if (names$2[color2]) {
    color2 = names$2[color2];
    named = true;
  } else if (color2 == "transparent") {
    return {
      r: 0,
      g: 0,
      b: 0,
      a: 0,
      format: "name"
    };
  }
  var match5;
  if (match5 = matchers.rgb.exec(color2)) {
    return {
      r: match5[1],
      g: match5[2],
      b: match5[3]
    };
  }
  if (match5 = matchers.rgba.exec(color2)) {
    return {
      r: match5[1],
      g: match5[2],
      b: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hsl.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      l: match5[3]
    };
  }
  if (match5 = matchers.hsla.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      l: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hsv.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      v: match5[3]
    };
  }
  if (match5 = matchers.hsva.exec(color2)) {
    return {
      h: match5[1],
      s: match5[2],
      v: match5[3],
      a: match5[4]
    };
  }
  if (match5 = matchers.hex8.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1]),
      g: parseIntFromHex(match5[2]),
      b: parseIntFromHex(match5[3]),
      a: convertHexToDecimal(match5[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match5 = matchers.hex6.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1]),
      g: parseIntFromHex(match5[2]),
      b: parseIntFromHex(match5[3]),
      format: named ? "name" : "hex"
    };
  }
  if (match5 = matchers.hex4.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1] + "" + match5[1]),
      g: parseIntFromHex(match5[2] + "" + match5[2]),
      b: parseIntFromHex(match5[3] + "" + match5[3]),
      a: convertHexToDecimal(match5[4] + "" + match5[4]),
      format: named ? "name" : "hex8"
    };
  }
  if (match5 = matchers.hex3.exec(color2)) {
    return {
      r: parseIntFromHex(match5[1] + "" + match5[1]),
      g: parseIntFromHex(match5[2] + "" + match5[2]),
      b: parseIntFromHex(match5[3] + "" + match5[3]),
      format: named ? "name" : "hex"
    };
  }
  return false;
}
function validateWCAG2Parms(parms) {
  var level, size2;
  parms = parms || {
    level: "AA",
    size: "small"
  };
  level = (parms.level || "AA").toUpperCase();
  size2 = (parms.size || "small").toLowerCase();
  if (level !== "AA" && level !== "AAA") {
    level = "AA";
  }
  if (size2 !== "small" && size2 !== "large") {
    size2 = "small";
  }
  return {
    level,
    size: size2
  };
}
var simpleCheckForValidColor = function simpleCheckForValidColor2(data) {
  var keysToCheck = ["r", "g", "b", "a", "h", "s", "l", "v"];
  var checked = 0;
  var passed = 0;
  forEach$1(keysToCheck, function(letter) {
    if (data[letter]) {
      checked += 1;
      if (!isNaN(data[letter])) {
        passed += 1;
      }
      if (letter === "s" || letter === "l") {
        var percentPatt = /^\d+%$/;
        if (percentPatt.test(data[letter])) {
          passed += 1;
        }
      }
    }
  });
  return checked === passed ? data : false;
};
var toState = function toState2(data, oldHue) {
  var color2 = data.hex ? tinycolor(data.hex) : tinycolor(data);
  var hsl = color2.toHsl();
  var hsv = color2.toHsv();
  var rgb = color2.toRgb();
  var hex3 = color2.toHex();
  if (hsl.s === 0) {
    hsl.h = oldHue || 0;
    hsv.h = oldHue || 0;
  }
  var transparent2 = hex3 === "000000" && rgb.a === 0;
  return {
    hsl,
    hex: transparent2 ? "transparent" : "#" + hex3,
    rgb,
    hsv,
    oldHue: data.h || oldHue || hsl.h,
    source: data.source
  };
};
var isValidHex = function isValidHex2(hex3) {
  if (hex3 === "transparent") {
    return true;
  }
  var lh2 = String(hex3).charAt(0) === "#" ? 1 : 0;
  return hex3.length !== 4 + lh2 && hex3.length < 7 + lh2 && tinycolor(hex3).isValid();
};
var getContrastingColor = function getContrastingColor2(data) {
  if (!data) {
    return "#fff";
  }
  var col = toState(data);
  if (col.hex === "transparent") {
    return "rgba(0,0,0,0.4)";
  }
  var yiq = (col.rgb.r * 299 + col.rgb.g * 587 + col.rgb.b * 114) / 1e3;
  return yiq >= 128 ? "#000" : "#fff";
};
var isvalidColorString = function isvalidColorString2(string3, type4) {
  var stringWithoutDegree = string3.replace("°", "");
  return tinycolor(type4 + " (" + stringWithoutDegree + ")")._ok;
};
var _extends$c = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$3 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$3(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$3(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$3(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var ColorWrap = function ColorWrap2(Picker) {
  var ColorPicker2 = function(_ref) {
    _inherits$3(ColorPicker3, _ref);
    function ColorPicker3(props) {
      _classCallCheck$3(this, ColorPicker3);
      var _this = _possibleConstructorReturn$3(this, (ColorPicker3.__proto__ || Object.getPrototypeOf(ColorPicker3)).call(this));
      _this.handleChange = function(data, event) {
        var isValidColor = simpleCheckForValidColor(data);
        if (isValidColor) {
          var colors2 = toState(data, data.h || _this.state.oldHue);
          _this.setState(colors2);
          _this.props.onChangeComplete && _this.debounce(_this.props.onChangeComplete, colors2, event);
          _this.props.onChange && _this.props.onChange(colors2, event);
        }
      };
      _this.handleSwatchHover = function(data, event) {
        var isValidColor = simpleCheckForValidColor(data);
        if (isValidColor) {
          var colors2 = toState(data, data.h || _this.state.oldHue);
          _this.props.onSwatchHover && _this.props.onSwatchHover(colors2, event);
        }
      };
      _this.state = _extends$c({}, toState(props.color, 0));
      _this.debounce = debounce$2(function(fn, data, event) {
        fn(data, event);
      }, 100);
      return _this;
    }
    _createClass$3(ColorPicker3, [{
      key: "render",
      value: function render3() {
        var optionalEvents = {};
        if (this.props.onSwatchHover) {
          optionalEvents.onSwatchHover = this.handleSwatchHover;
        }
        return React$6.createElement(Picker, _extends$c({}, this.props, this.state, {
          onChange: this.handleChange
        }, optionalEvents));
      }
    }], [{
      key: "getDerivedStateFromProps",
      value: function getDerivedStateFromProps(nextProps, state) {
        return _extends$c({}, toState(nextProps.color, state.oldHue));
      }
    }]);
    return ColorPicker3;
  }(reactExports.PureComponent || reactExports.Component);
  ColorPicker2.propTypes = _extends$c({}, Picker.propTypes);
  ColorPicker2.defaultProps = _extends$c({}, Picker.defaultProps, {
    color: {
      h: 250,
      s: 0.5,
      l: 0.2,
      a: 1
    }
  });
  return ColorPicker2;
};
var _extends$b = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _createClass$2 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$2(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$2(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$2(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var handleFocus = function handleFocus2(Component2) {
  var Span = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "span";
  return function(_React$Component) {
    _inherits$2(Focus, _React$Component);
    function Focus() {
      var _ref;
      var _temp, _this, _ret;
      _classCallCheck$2(this, Focus);
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return _ret = (_temp = (_this = _possibleConstructorReturn$2(this, (_ref = Focus.__proto__ || Object.getPrototypeOf(Focus)).call.apply(_ref, [this].concat(args))), _this), _this.state = { focus: false }, _this.handleFocus = function() {
        return _this.setState({ focus: true });
      }, _this.handleBlur = function() {
        return _this.setState({ focus: false });
      }, _temp), _possibleConstructorReturn$2(_this, _ret);
    }
    _createClass$2(Focus, [{
      key: "render",
      value: function render3() {
        return React$6.createElement(
          Span,
          { onFocus: this.handleFocus, onBlur: this.handleBlur },
          React$6.createElement(Component2, _extends$b({}, this.props, this.state))
        );
      }
    }]);
    return Focus;
  }(React$6.Component);
};
var _extends$a = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var ENTER = 13;
var Swatch = function Swatch2(_ref) {
  var color2 = _ref.color, style2 = _ref.style, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onHover = _ref.onHover, _ref$title = _ref.title, title = _ref$title === void 0 ? color2 : _ref$title, children = _ref.children, focus = _ref.focus, _ref$focusStyle = _ref.focusStyle, focusStyle = _ref$focusStyle === void 0 ? {} : _ref$focusStyle;
  var transparent2 = color2 === "transparent";
  var styles2 = _default$4({
    default: {
      swatch: _extends$a({
        background: color2,
        height: "100%",
        width: "100%",
        cursor: "pointer",
        position: "relative",
        outline: "none"
      }, style2, focus ? focusStyle : {})
    }
  });
  var handleClick = function handleClick2(e2) {
    return onClick(color2, e2);
  };
  var handleKeyDown = function handleKeyDown2(e2) {
    return e2.keyCode === ENTER && onClick(color2, e2);
  };
  var handleHover2 = function handleHover3(e2) {
    return onHover(color2, e2);
  };
  var optionalEvents = {};
  if (onHover) {
    optionalEvents.onMouseOver = handleHover2;
  }
  return React$6.createElement(
    "div",
    _extends$a({
      style: styles2.swatch,
      onClick: handleClick,
      title,
      tabIndex: 0,
      onKeyDown: handleKeyDown
    }, optionalEvents),
    children,
    transparent2 && React$6.createElement(Checkboard, {
      borderRadius: styles2.swatch.borderRadius,
      boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.1)"
    })
  );
};
const Swatch$1 = handleFocus(Swatch);
var AlphaPointer = function AlphaPointer2(_ref) {
  var direction = _ref.direction;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "18px",
        height: "18px",
        borderRadius: "50%",
        transform: "translate(-9px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    },
    "vertical": {
      picker: {
        transform: "translate(-3px, -9px)"
      }
    }
  }, { vertical: direction === "vertical" });
  return React$6.createElement("div", { style: styles2.picker });
};
var _extends$9 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var AlphaPicker = function AlphaPicker2(_ref) {
  var rgb = _ref.rgb, hsl = _ref.hsl, width = _ref.width, height = _ref.height, onChange = _ref.onChange, direction = _ref.direction, style2 = _ref.style, renderers = _ref.renderers, pointer = _ref.pointer, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4({
    "default": {
      picker: {
        position: "relative",
        width,
        height
      },
      alpha: {
        radius: "2px",
        style: style2
      }
    }
  });
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "alpha-picker " + className },
    React$6.createElement(Alpha, _extends$9({}, styles2.alpha, {
      rgb,
      hsl,
      pointer,
      renderers,
      onChange,
      direction
    }))
  );
};
AlphaPicker.defaultProps = {
  width: "316px",
  height: "16px",
  direction: "horizontal",
  pointer: AlphaPointer
};
ColorWrap(AlphaPicker);
function arrayMap(array4, iteratee) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, result = Array(length2);
  while (++index2 < length2) {
    result[index2] = iteratee(array4[index2], index2, array4);
  }
  return result;
}
var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
function setCacheAdd(value2) {
  this.__data__.set(value2, HASH_UNDEFINED$1);
  return this;
}
function setCacheHas(value2) {
  return this.__data__.has(value2);
}
function SetCache(values) {
  var index2 = -1, length2 = values == null ? 0 : values.length;
  this.__data__ = new MapCache$1();
  while (++index2 < length2) {
    this.add(values[index2]);
  }
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
function arraySome(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length;
  while (++index2 < length2) {
    if (predicate(array4[index2], index2, array4)) {
      return true;
    }
  }
  return false;
}
function cacheHas(cache2, key) {
  return cache2.has(key);
}
var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
function equalArrays(array4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array4.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array4);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array4;
  }
  var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  stack.set(array4, other);
  stack.set(other, array4);
  while (++index2 < arrLength) {
    var arrValue = array4[index2], othValue = other[index2];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
    }
    if (compared !== void 0) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen2) {
      if (!arraySome(other, function(othValue2, othIndex) {
        if (!cacheHas(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen2.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array4);
  stack["delete"](other);
  return result;
}
function mapToArray(map2) {
  var index2 = -1, result = Array(map2.size);
  map2.forEach(function(value2, key) {
    result[++index2] = [key, value2];
  });
  return result;
}
function setToArray(set2) {
  var index2 = -1, result = Array(set2.size);
  set2.forEach(function(value2) {
    result[++index2] = value2;
  });
  return result;
}
var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag$1 = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag$1 = "[object Set]", stringTag = "[object String]", symbolTag$1 = "[object Symbol]";
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]";
var symbolProto$2 = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto$2 ? symbolProto$2.valueOf : void 0;
function equalByTag(object4, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag$1:
      if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
        return false;
      }
      object4 = object4.buffer;
      other = other.buffer;
    case arrayBufferTag:
      if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object4), new Uint8Array$1(other))) {
        return false;
      }
      return true;
    case boolTag:
    case dateTag:
    case numberTag:
      return eq$2(+object4, +other);
    case errorTag:
      return object4.name == other.name && object4.message == other.message;
    case regexpTag:
    case stringTag:
      return object4 == other + "";
    case mapTag$1:
      var convert2 = mapToArray;
    case setTag$1:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
      convert2 || (convert2 = setToArray);
      if (object4.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object4);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG$2;
      stack.set(object4, other);
      var result = equalArrays(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object4);
      return result;
    case symbolTag$1:
      if (symbolValueOf) {
        return symbolValueOf.call(object4) == symbolValueOf.call(other);
      }
  }
  return false;
}
function arrayPush(array4, values) {
  var index2 = -1, length2 = values.length, offset2 = array4.length;
  while (++index2 < length2) {
    array4[offset2 + index2] = values[index2];
  }
  return array4;
}
function baseGetAllKeys(object4, keysFunc, symbolsFunc) {
  var result = keysFunc(object4);
  return isArray$6(object4) ? result : arrayPush(result, symbolsFunc(object4));
}
function arrayFilter(array4, predicate) {
  var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
  while (++index2 < length2) {
    var value2 = array4[index2];
    if (predicate(value2, index2, array4)) {
      result[resIndex++] = value2;
    }
  }
  return result;
}
function stubArray() {
  return [];
}
var objectProto$3 = Object.prototype;
var propertyIsEnumerable = objectProto$3.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray : function(object4) {
  if (object4 == null) {
    return [];
  }
  object4 = Object(object4);
  return arrayFilter(nativeGetSymbols(object4), function(symbol) {
    return propertyIsEnumerable.call(object4, symbol);
  });
};
function getAllKeys(object4) {
  return baseGetAllKeys(object4, keys$2, getSymbols);
}
var COMPARE_PARTIAL_FLAG$3 = 1;
var objectProto$2 = Object.prototype;
var hasOwnProperty$4 = objectProto$2.hasOwnProperty;
function equalObjects(object4, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object4), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index2 = objLength;
  while (index2--) {
    var key = objProps[index2];
    if (!(isPartial ? key in other : hasOwnProperty$4.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object4);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object4;
  }
  var result = true;
  stack.set(object4, other);
  stack.set(other, object4);
  var skipCtor = isPartial;
  while (++index2 < objLength) {
    key = objProps[index2];
    var objValue = object4[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
    }
    if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object4.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object4);
  stack["delete"](other);
  return result;
}
var DataView$1 = getNative$1(root$3, "DataView");
var Promise$1 = getNative$1(root$3, "Promise");
var Set$1 = getNative$1(root$3, "Set");
var WeakMap$1 = getNative$1(root$3, "WeakMap");
var mapTag = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag = "[object Set]", weakMapTag = "[object WeakMap]";
var dataViewTag = "[object DataView]";
var dataViewCtorString = toSource$1(DataView$1), mapCtorString = toSource$1(Map$2), promiseCtorString = toSource$1(Promise$1), setCtorString = toSource$1(Set$1), weakMapCtorString = toSource$1(WeakMap$1);
var getTag = baseGetTag;
if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$2 && getTag(new Map$2()) != mapTag || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
  getTag = function(value2) {
    var result = baseGetTag(value2), Ctor = result == objectTag$1 ? value2.constructor : void 0, ctorString = Ctor ? toSource$1(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString:
          return dataViewTag;
        case mapCtorString:
          return mapTag;
        case promiseCtorString:
          return promiseTag;
        case setCtorString:
          return setTag;
        case weakMapCtorString:
          return weakMapTag;
      }
    }
    return result;
  };
}
var COMPARE_PARTIAL_FLAG$2 = 1;
var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
var objectProto$1 = Object.prototype;
var hasOwnProperty$3 = objectProto$1.hasOwnProperty;
function baseIsEqualDeep(object4, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray$6(object4), othIsArr = isArray$6(other), objTag = objIsArr ? arrayTag : getTag(object4), othTag = othIsArr ? arrayTag : getTag(other);
  objTag = objTag == argsTag ? objectTag : objTag;
  othTag = othTag == argsTag ? objectTag : othTag;
  var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer$1(object4)) {
    if (!isBuffer$1(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack());
    return objIsArr || isTypedArray$1(object4) ? equalArrays(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag(object4, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
    var objIsWrapped = objIsObj && hasOwnProperty$3.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$3.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack());
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack());
  return equalObjects(object4, other, bitmask, customizer, equalFunc, stack);
}
function baseIsEqual(value2, other, bitmask, customizer, stack) {
  if (value2 === other) {
    return true;
  }
  if (value2 == null || other == null || !isObjectLike$1(value2) && !isObjectLike$1(other)) {
    return value2 !== value2 && other !== other;
  }
  return baseIsEqualDeep(value2, other, bitmask, customizer, baseIsEqual, stack);
}
var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
function baseIsMatch(object4, source2, matchData, customizer) {
  var index2 = matchData.length, length2 = index2;
  if (object4 == null) {
    return !length2;
  }
  object4 = Object(object4);
  while (index2--) {
    var data = matchData[index2];
    if (data[2] ? data[1] !== object4[data[0]] : !(data[0] in object4)) {
      return false;
    }
  }
  while (++index2 < length2) {
    data = matchData[index2];
    var key = data[0], objValue = object4[key], srcValue = data[1];
    if (data[2]) {
      if (objValue === void 0 && !(key in object4)) {
        return false;
      }
    } else {
      var stack = new Stack();
      var result;
      if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
function isStrictComparable(value2) {
  return value2 === value2 && !isObject$4(value2);
}
function getMatchData(object4) {
  var result = keys$2(object4), length2 = result.length;
  while (length2--) {
    var key = result[length2], value2 = object4[key];
    result[length2] = [key, value2, isStrictComparable(value2)];
  }
  return result;
}
function matchesStrictComparable(key, srcValue) {
  return function(object4) {
    if (object4 == null) {
      return false;
    }
    return object4[key] === srcValue && (srcValue !== void 0 || key in Object(object4));
  };
}
function baseMatches(source2) {
  var matchData = getMatchData(source2);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  }
  return function(object4) {
    return object4 === source2 || baseIsMatch(object4, source2, matchData);
  };
}
var reIsDeepProp$1 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp$1 = /^\w*$/;
function isKey$1(value2, object4) {
  if (isArray$6(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol$1(value2)) {
    return true;
  }
  return reIsPlainProp$1.test(value2) || !reIsDeepProp$1.test(value2) || object4 != null && value2 in Object(object4);
}
var FUNC_ERROR_TEXT$1 = "Expected a function";
function memoize$1(func, resolver2) {
  if (typeof func != "function" || resolver2 != null && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT$1);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result) || cache2;
    return result;
  };
  memoized.cache = new (memoize$1.Cache || MapCache$1)();
  return memoized;
}
memoize$1.Cache = MapCache$1;
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
  var result = memoize$1(func, function(key) {
    if (cache2.size === MAX_MEMOIZE_SIZE) {
      cache2.clear();
    }
    return key;
  });
  var cache2 = result.cache;
  return result;
}
var rePropName$1 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar$1 = /\\(\\)?/g;
var stringToPath$1 = memoizeCapped(function(string3) {
  var result = [];
  if (string3.charCodeAt(0) === 46) {
    result.push("");
  }
  string3.replace(rePropName$1, function(match5, number4, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar$1, "$1") : number4 || match5);
  });
  return result;
});
var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString$1 = symbolProto$1 ? symbolProto$1.toString : void 0;
function baseToString$1(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isArray$6(value2)) {
    return arrayMap(value2, baseToString$1) + "";
  }
  if (isSymbol$1(value2)) {
    return symbolToString$1 ? symbolToString$1.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function toString$5(value2) {
  return value2 == null ? "" : baseToString$1(value2);
}
function castPath$1(value2, object4) {
  if (isArray$6(value2)) {
    return value2;
  }
  return isKey$1(value2, object4) ? [value2] : stringToPath$1(toString$5(value2));
}
function toKey$1(value2) {
  if (typeof value2 == "string" || isSymbol$1(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function baseGet$1(object4, path) {
  path = castPath$1(path, object4);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey$1(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
function get$4(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet$1(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
function baseHasIn(object4, key) {
  return object4 != null && key in Object(object4);
}
function hasPath(object4, path, hasFunc) {
  path = castPath$1(path, object4);
  var index2 = -1, length2 = path.length, result = false;
  while (++index2 < length2) {
    var key = toKey$1(path[index2]);
    if (!(result = object4 != null && hasFunc(object4, key))) {
      break;
    }
    object4 = object4[key];
  }
  if (result || ++index2 != length2) {
    return result;
  }
  length2 = object4 == null ? 0 : object4.length;
  return !!length2 && isLength(length2) && isIndex(key, length2) && (isArray$6(object4) || isArguments(object4));
}
function hasIn(object4, path) {
  return object4 != null && hasPath(object4, path, baseHasIn);
}
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
function baseMatchesProperty(path, srcValue) {
  if (isKey$1(path) && isStrictComparable(srcValue)) {
    return matchesStrictComparable(toKey$1(path), srcValue);
  }
  return function(object4) {
    var objValue = get$4(object4, path);
    return objValue === void 0 && objValue === srcValue ? hasIn(object4, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  };
}
function baseProperty(key) {
  return function(object4) {
    return object4 == null ? void 0 : object4[key];
  };
}
function basePropertyDeep(path) {
  return function(object4) {
    return baseGet$1(object4, path);
  };
}
function property$1(path) {
  return isKey$1(path) ? baseProperty(toKey$1(path)) : basePropertyDeep(path);
}
function baseIteratee(value2) {
  if (typeof value2 == "function") {
    return value2;
  }
  if (value2 == null) {
    return identity$2;
  }
  if (typeof value2 == "object") {
    return isArray$6(value2) ? baseMatchesProperty(value2[0], value2[1]) : baseMatches(value2);
  }
  return property$1(value2);
}
function baseMap(collection, iteratee) {
  var index2 = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  baseEach(collection, function(value2, key, collection2) {
    result[++index2] = iteratee(value2, key, collection2);
  });
  return result;
}
function map$3(collection, iteratee) {
  var func = isArray$6(collection) ? arrayMap : baseMap;
  return func(collection, baseIteratee(iteratee));
}
var BlockSwatches = function BlockSwatches2(_ref) {
  var colors2 = _ref.colors, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover;
  var styles2 = _default$4({
    "default": {
      swatches: {
        marginRight: "-10px"
      },
      swatch: {
        width: "22px",
        height: "22px",
        float: "left",
        marginRight: "10px",
        marginBottom: "10px",
        borderRadius: "4px"
      },
      clear: {
        clear: "both"
      }
    }
  });
  return React$6.createElement(
    "div",
    { style: styles2.swatches },
    map$3(colors2, function(c2) {
      return React$6.createElement(Swatch$1, {
        key: c2,
        color: c2,
        style: styles2.swatch,
        onClick,
        onHover: onSwatchHover,
        focusStyle: {
          boxShadow: "0 0 4px " + c2
        }
      });
    }),
    React$6.createElement("div", { style: styles2.clear })
  );
};
var Block$1 = function Block(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex3 = _ref.hex, colors2 = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var transparent2 = hex3 === "transparent";
  var handleChange = function handleChange2(hexCode, e2) {
    isValidHex(hexCode) && onChange({
      hex: hexCode,
      source: "hex"
    }, e2);
  };
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        boxShadow: "0 1px rgba(0,0,0,.1)",
        borderRadius: "6px",
        position: "relative"
      },
      head: {
        height: "110px",
        background: hex3,
        borderRadius: "6px 6px 0 0",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        position: "relative"
      },
      body: {
        padding: "10px"
      },
      label: {
        fontSize: "18px",
        color: getContrastingColor(hex3),
        position: "relative"
      },
      triangle: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 10px 10px 10px",
        borderColor: "transparent transparent " + hex3 + " transparent",
        position: "absolute",
        top: "-10px",
        left: "50%",
        marginLeft: "-10px"
      },
      input: {
        width: "100%",
        fontSize: "12px",
        color: "#666",
        border: "0px",
        outline: "none",
        height: "22px",
        boxShadow: "inset 0 0 0 1px #ddd",
        borderRadius: "4px",
        padding: "0 7px",
        boxSizing: "border-box"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      }
    }
  }, passedStyles), { "hide-triangle": triangle === "hide" });
  return React$6.createElement(
    "div",
    { style: styles2.card, className: "block-picker " + className },
    React$6.createElement("div", { style: styles2.triangle }),
    React$6.createElement(
      "div",
      { style: styles2.head },
      transparent2 && React$6.createElement(Checkboard, { borderRadius: "6px 6px 0 0" }),
      React$6.createElement(
        "div",
        { style: styles2.label },
        hex3
      )
    ),
    React$6.createElement(
      "div",
      { style: styles2.body },
      React$6.createElement(BlockSwatches, { colors: colors2, onClick: handleChange, onSwatchHover }),
      React$6.createElement(EditableInput, {
        style: { input: styles2.input },
        value: hex3,
        onChange: handleChange
      })
    )
  );
};
Block$1.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  triangle: PropTypes$4.oneOf(["top", "hide"]),
  styles: PropTypes$4.object
};
Block$1.defaultProps = {
  width: 170,
  colors: ["#D9E3F0", "#F47373", "#697689", "#37D67A", "#2CCCE4", "#555555", "#dce775", "#ff8a65", "#ba68c8"],
  triangle: "top",
  styles: {}
};
ColorWrap(Block$1);
var red = { "100": "#ffcdd2", "300": "#e57373", "500": "#f44336", "700": "#d32f2f", "900": "#b71c1c" };
var pink = { "100": "#f8bbd0", "300": "#f06292", "500": "#e91e63", "700": "#c2185b", "900": "#880e4f" };
var purple = { "100": "#e1bee7", "300": "#ba68c8", "500": "#9c27b0", "700": "#7b1fa2", "900": "#4a148c" };
var deepPurple = { "100": "#d1c4e9", "300": "#9575cd", "500": "#673ab7", "700": "#512da8", "900": "#311b92" };
var indigo = { "100": "#c5cae9", "300": "#7986cb", "500": "#3f51b5", "700": "#303f9f", "900": "#1a237e" };
var blue = { "100": "#bbdefb", "300": "#64b5f6", "500": "#2196f3", "700": "#1976d2", "900": "#0d47a1" };
var lightBlue = { "100": "#b3e5fc", "300": "#4fc3f7", "500": "#03a9f4", "700": "#0288d1", "900": "#01579b" };
var cyan = { "100": "#b2ebf2", "300": "#4dd0e1", "500": "#00bcd4", "700": "#0097a7", "900": "#006064" };
var teal = { "100": "#b2dfdb", "300": "#4db6ac", "500": "#009688", "700": "#00796b", "900": "#004d40" };
var green = { "100": "#c8e6c9", "300": "#81c784", "500": "#4caf50", "700": "#388e3c" };
var lightGreen = { "100": "#dcedc8", "300": "#aed581", "500": "#8bc34a", "700": "#689f38", "900": "#33691e" };
var lime = { "100": "#f0f4c3", "300": "#dce775", "500": "#cddc39", "700": "#afb42b", "900": "#827717" };
var yellow = { "100": "#fff9c4", "300": "#fff176", "500": "#ffeb3b", "700": "#fbc02d", "900": "#f57f17" };
var amber = { "100": "#ffecb3", "300": "#ffd54f", "500": "#ffc107", "700": "#ffa000", "900": "#ff6f00" };
var orange = { "100": "#ffe0b2", "300": "#ffb74d", "500": "#ff9800", "700": "#f57c00", "900": "#e65100" };
var deepOrange = { "100": "#ffccbc", "300": "#ff8a65", "500": "#ff5722", "700": "#e64a19", "900": "#bf360c" };
var brown = { "100": "#d7ccc8", "300": "#a1887f", "500": "#795548", "700": "#5d4037", "900": "#3e2723" };
var blueGrey = { "100": "#cfd8dc", "300": "#90a4ae", "500": "#607d8b", "700": "#455a64", "900": "#263238" };
var CircleSwatch = function CircleSwatch2(_ref) {
  var color2 = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, hover3 = _ref.hover, active3 = _ref.active, circleSize = _ref.circleSize, circleSpacing = _ref.circleSpacing;
  var styles2 = _default$4({
    "default": {
      swatch: {
        width: circleSize,
        height: circleSize,
        marginRight: circleSpacing,
        marginBottom: circleSpacing,
        transform: "scale(1)",
        transition: "100ms transform ease"
      },
      Swatch: {
        borderRadius: "50%",
        background: "transparent",
        boxShadow: "inset 0 0 0 " + (circleSize / 2 + 1) + "px " + color2,
        transition: "100ms box-shadow ease"
      }
    },
    "hover": {
      swatch: {
        transform: "scale(1.2)"
      }
    },
    "active": {
      Swatch: {
        boxShadow: "inset 0 0 0 3px " + color2
      }
    }
  }, { hover: hover3, active: active3 });
  return React$6.createElement(
    "div",
    { style: styles2.swatch },
    React$6.createElement(Swatch$1, {
      style: styles2.Swatch,
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: styles2.Swatch.boxShadow + ", 0 0 5px " + color2 }
    })
  );
};
CircleSwatch.defaultProps = {
  circleSize: 28,
  circleSpacing: 14
};
const CircleSwatch$1 = handleHover(CircleSwatch);
var Circle = function Circle2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, circleSize = _ref.circleSize, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, circleSpacing = _ref.circleSpacing, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        display: "flex",
        flexWrap: "wrap",
        marginRight: -circleSpacing,
        marginBottom: -circleSpacing
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(hexCode, e2) {
    return onChange({ hex: hexCode, source: "hex" }, e2);
  };
  return React$6.createElement(
    "div",
    { style: styles2.card, className: "circle-picker " + className },
    map$3(colors2, function(c2) {
      return React$6.createElement(CircleSwatch$1, {
        key: c2,
        color: c2,
        onClick: handleChange,
        onSwatchHover,
        active: hex3 === c2.toLowerCase(),
        circleSize,
        circleSpacing
      });
    })
  );
};
Circle.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  circleSize: PropTypes$4.number,
  circleSpacing: PropTypes$4.number,
  styles: PropTypes$4.object
};
Circle.defaultProps = {
  width: 252,
  circleSize: 28,
  circleSpacing: 14,
  colors: [red["500"], pink["500"], purple["500"], deepPurple["500"], indigo["500"], blue["500"], lightBlue["500"], cyan["500"], teal["500"], green["500"], lightGreen["500"], lime["500"], yellow["500"], amber["500"], orange["500"], deepOrange["500"], brown["500"], blueGrey["500"]],
  styles: {}
};
ColorWrap(Circle);
function isUndefined$2(value2) {
  return value2 === void 0;
}
var UnfoldMoreHorizontalIcon = {};
Object.defineProperty(UnfoldMoreHorizontalIcon, "__esModule", {
  value: true
});
var _extends$8 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$2 = reactExports;
var _react2$1 = _interopRequireDefault$3(_react$2);
function _interopRequireDefault$3(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _objectWithoutProperties$2(obj, keys2) {
  var target = {};
  for (var i2 in obj) {
    if (keys2.indexOf(i2) >= 0)
      continue;
    if (!Object.prototype.hasOwnProperty.call(obj, i2))
      continue;
    target[i2] = obj[i2];
  }
  return target;
}
var DEFAULT_SIZE$2 = 24;
var _default$3 = UnfoldMoreHorizontalIcon.default = function(_ref) {
  var _ref$fill = _ref.fill, fill2 = _ref$fill === void 0 ? "currentColor" : _ref$fill, _ref$width = _ref.width, width = _ref$width === void 0 ? DEFAULT_SIZE$2 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? DEFAULT_SIZE$2 : _ref$height, _ref$style = _ref.style, style2 = _ref$style === void 0 ? {} : _ref$style, props = _objectWithoutProperties$2(_ref, ["fill", "width", "height", "style"]);
  return _react2$1.default.createElement(
    "svg",
    _extends$8({
      viewBox: "0 0 " + DEFAULT_SIZE$2 + " " + DEFAULT_SIZE$2,
      style: _extends$8({ fill: fill2, width, height }, style2)
    }, props),
    _react2$1.default.createElement("path", { d: "M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z" })
  );
};
var _createClass$1 = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck$1(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn$1(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits$1(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var ChromeFields = function(_React$Component) {
  _inherits$1(ChromeFields2, _React$Component);
  function ChromeFields2(props) {
    _classCallCheck$1(this, ChromeFields2);
    var _this = _possibleConstructorReturn$1(this, (ChromeFields2.__proto__ || Object.getPrototypeOf(ChromeFields2)).call(this));
    _this.toggleViews = function() {
      if (_this.state.view === "hex") {
        _this.setState({ view: "rgb" });
      } else if (_this.state.view === "rgb") {
        _this.setState({ view: "hsl" });
      } else if (_this.state.view === "hsl") {
        if (_this.props.hsl.a === 1) {
          _this.setState({ view: "hex" });
        } else {
          _this.setState({ view: "rgb" });
        }
      }
    };
    _this.handleChange = function(data, e2) {
      if (data.hex) {
        isValidHex(data.hex) && _this.props.onChange({
          hex: data.hex,
          source: "hex"
        }, e2);
      } else if (data.r || data.g || data.b) {
        _this.props.onChange({
          r: data.r || _this.props.rgb.r,
          g: data.g || _this.props.rgb.g,
          b: data.b || _this.props.rgb.b,
          source: "rgb"
        }, e2);
      } else if (data.a) {
        if (data.a < 0) {
          data.a = 0;
        } else if (data.a > 1) {
          data.a = 1;
        }
        _this.props.onChange({
          h: _this.props.hsl.h,
          s: _this.props.hsl.s,
          l: _this.props.hsl.l,
          a: Math.round(data.a * 100) / 100,
          source: "rgb"
        }, e2);
      } else if (data.h || data.s || data.l) {
        if (typeof data.s === "string" && data.s.includes("%")) {
          data.s = data.s.replace("%", "");
        }
        if (typeof data.l === "string" && data.l.includes("%")) {
          data.l = data.l.replace("%", "");
        }
        if (data.s == 1) {
          data.s = 0.01;
        } else if (data.l == 1) {
          data.l = 0.01;
        }
        _this.props.onChange({
          h: data.h || _this.props.hsl.h,
          s: Number(!isUndefined$2(data.s) ? data.s : _this.props.hsl.s),
          l: Number(!isUndefined$2(data.l) ? data.l : _this.props.hsl.l),
          source: "hsl"
        }, e2);
      }
    };
    _this.showHighlight = function(e2) {
      e2.currentTarget.style.background = "#eee";
    };
    _this.hideHighlight = function(e2) {
      e2.currentTarget.style.background = "transparent";
    };
    if (props.hsl.a !== 1 && props.view === "hex") {
      _this.state = {
        view: "rgb"
      };
    } else {
      _this.state = {
        view: props.view
      };
    }
    return _this;
  }
  _createClass$1(ChromeFields2, [{
    key: "render",
    value: function render3() {
      var _this2 = this;
      var styles2 = _default$4({
        "default": {
          wrap: {
            paddingTop: "16px",
            display: "flex"
          },
          fields: {
            flex: "1",
            display: "flex",
            marginLeft: "-6px"
          },
          field: {
            paddingLeft: "6px",
            width: "100%"
          },
          alpha: {
            paddingLeft: "6px",
            width: "100%"
          },
          toggle: {
            width: "32px",
            textAlign: "right",
            position: "relative"
          },
          icon: {
            marginRight: "-4px",
            marginTop: "12px",
            cursor: "pointer",
            position: "relative"
          },
          iconHighlight: {
            position: "absolute",
            width: "24px",
            height: "28px",
            background: "#eee",
            borderRadius: "4px",
            top: "10px",
            left: "12px",
            display: "none"
          },
          input: {
            fontSize: "11px",
            color: "#333",
            width: "100%",
            borderRadius: "2px",
            border: "none",
            boxShadow: "inset 0 0 0 1px #dadada",
            height: "21px",
            textAlign: "center"
          },
          label: {
            textTransform: "uppercase",
            fontSize: "11px",
            lineHeight: "11px",
            color: "#969696",
            textAlign: "center",
            display: "block",
            marginTop: "12px"
          },
          svg: {
            fill: "#333",
            width: "24px",
            height: "24px",
            border: "1px transparent solid",
            borderRadius: "5px"
          }
        },
        "disableAlpha": {
          alpha: {
            display: "none"
          }
        }
      }, this.props, this.state);
      var fields = void 0;
      if (this.state.view === "hex") {
        fields = React$6.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "hex",
              value: this.props.hex,
              onChange: this.handleChange
            })
          )
        );
      } else if (this.state.view === "rgb") {
        fields = React$6.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "r",
              value: this.props.rgb.r,
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "g",
              value: this.props.rgb.g,
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "b",
              value: this.props.rgb.b,
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.alpha },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "a",
              value: this.props.rgb.a,
              arrowOffset: 0.01,
              onChange: this.handleChange
            })
          )
        );
      } else if (this.state.view === "hsl") {
        fields = React$6.createElement(
          "div",
          { style: styles2.fields, className: "flexbox-fix" },
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "h",
              value: Math.round(this.props.hsl.h),
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "s",
              value: Math.round(this.props.hsl.s * 100) + "%",
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.field },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "l",
              value: Math.round(this.props.hsl.l * 100) + "%",
              onChange: this.handleChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.alpha },
            React$6.createElement(EditableInput, {
              style: { input: styles2.input, label: styles2.label },
              label: "a",
              value: this.props.hsl.a,
              arrowOffset: 0.01,
              onChange: this.handleChange
            })
          )
        );
      }
      return React$6.createElement(
        "div",
        { style: styles2.wrap, className: "flexbox-fix" },
        fields,
        React$6.createElement(
          "div",
          { style: styles2.toggle },
          React$6.createElement(
            "div",
            { style: styles2.icon, onClick: this.toggleViews, ref: function ref(icon) {
              return _this2.icon = icon;
            } },
            React$6.createElement(_default$3, {
              style: styles2.svg,
              onMouseOver: this.showHighlight,
              onMouseEnter: this.showHighlight,
              onMouseOut: this.hideHighlight
            })
          )
        )
      );
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, state) {
      if (nextProps.hsl.a !== 1 && state.view === "hex") {
        return { view: "rgb" };
      }
      return null;
    }
  }]);
  return ChromeFields2;
}(React$6.Component);
ChromeFields.defaultProps = {
  view: "hex"
};
var ChromePointer = function ChromePointer2() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        transform: "translate(-6px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    }
  });
  return React$6.createElement("div", { style: styles2.picker });
};
var ChromePointerCircle = function ChromePointerCircle2() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        boxShadow: "inset 0 0 0 1px #fff",
        transform: "translate(-6px, -6px)"
      }
    }
  });
  return React$6.createElement("div", { style: styles2.picker });
};
var Chrome = function Chrome2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, disableAlpha = _ref.disableAlpha, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex3 = _ref.hex, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className, defaultView = _ref.defaultView;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        background: "#fff",
        borderRadius: "2px",
        boxShadow: "0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",
        boxSizing: "initial",
        fontFamily: "Menlo"
      },
      saturation: {
        width: "100%",
        paddingBottom: "55%",
        position: "relative",
        borderRadius: "2px 2px 0 0",
        overflow: "hidden"
      },
      Saturation: {
        radius: "2px 2px 0 0"
      },
      body: {
        padding: "16px 16px 12px"
      },
      controls: {
        display: "flex"
      },
      color: {
        width: "32px"
      },
      swatch: {
        marginTop: "6px",
        width: "16px",
        height: "16px",
        borderRadius: "8px",
        position: "relative",
        overflow: "hidden"
      },
      active: {
        absolute: "0px 0px 0px 0px",
        borderRadius: "8px",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.1)",
        background: "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + rgb.a + ")",
        zIndex: "2"
      },
      toggles: {
        flex: "1"
      },
      hue: {
        height: "10px",
        position: "relative",
        marginBottom: "8px"
      },
      Hue: {
        radius: "2px"
      },
      alpha: {
        height: "10px",
        position: "relative"
      },
      Alpha: {
        radius: "2px"
      }
    },
    "disableAlpha": {
      color: {
        width: "22px"
      },
      alpha: {
        display: "none"
      },
      hue: {
        marginBottom: "0px"
      },
      swatch: {
        width: "10px",
        height: "10px",
        marginTop: "0px"
      }
    }
  }, passedStyles), { disableAlpha });
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "chrome-picker " + className },
    React$6.createElement(
      "div",
      { style: styles2.saturation },
      React$6.createElement(Saturation, {
        style: styles2.Saturation,
        hsl,
        hsv,
        pointer: ChromePointerCircle,
        onChange
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.body },
      React$6.createElement(
        "div",
        { style: styles2.controls, className: "flexbox-fix" },
        React$6.createElement(
          "div",
          { style: styles2.color },
          React$6.createElement(
            "div",
            { style: styles2.swatch },
            React$6.createElement("div", { style: styles2.active }),
            React$6.createElement(Checkboard, { renderers })
          )
        ),
        React$6.createElement(
          "div",
          { style: styles2.toggles },
          React$6.createElement(
            "div",
            { style: styles2.hue },
            React$6.createElement(Hue, {
              style: styles2.Hue,
              hsl,
              pointer: ChromePointer,
              onChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.alpha },
            React$6.createElement(Alpha, {
              style: styles2.Alpha,
              rgb,
              hsl,
              pointer: ChromePointer,
              renderers,
              onChange
            })
          )
        )
      ),
      React$6.createElement(ChromeFields, {
        rgb,
        hsl,
        hex: hex3,
        view: defaultView,
        onChange,
        disableAlpha
      })
    )
  );
};
Chrome.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  disableAlpha: PropTypes$4.bool,
  styles: PropTypes$4.object,
  defaultView: PropTypes$4.oneOf(["hex", "rgb", "hsl"])
};
Chrome.defaultProps = {
  width: 225,
  disableAlpha: false,
  styles: {}
};
ColorWrap(Chrome);
var CompactColor = function CompactColor2(_ref) {
  var color2 = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      color: {
        background: color2,
        width: "15px",
        height: "15px",
        float: "left",
        marginRight: "5px",
        marginBottom: "5px",
        position: "relative",
        cursor: "pointer"
      },
      dot: {
        absolute: "5px 5px 5px 5px",
        background: getContrastingColor(color2),
        borderRadius: "50%",
        opacity: "0"
      }
    },
    "active": {
      dot: {
        opacity: "1"
      }
    },
    "color-#FFFFFF": {
      color: {
        boxShadow: "inset 0 0 0 1px #ddd"
      },
      dot: {
        background: "#000"
      }
    },
    "transparent": {
      dot: {
        background: "#000"
      }
    }
  }, { active: active3, "color-#FFFFFF": color2 === "#FFFFFF", "transparent": color2 === "transparent" });
  return React$6.createElement(
    Swatch$1,
    {
      style: styles2.color,
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: "0 0 4px " + color2 }
    },
    React$6.createElement("div", { style: styles2.dot })
  );
};
var CompactFields = function CompactFields2(_ref) {
  var hex3 = _ref.hex, rgb = _ref.rgb, onChange = _ref.onChange;
  var styles2 = _default$4({
    "default": {
      fields: {
        display: "flex",
        paddingBottom: "6px",
        paddingRight: "5px",
        position: "relative"
      },
      active: {
        position: "absolute",
        top: "6px",
        left: "5px",
        height: "9px",
        width: "9px",
        background: hex3
      },
      HEXwrap: {
        flex: "6",
        position: "relative"
      },
      HEXinput: {
        width: "80%",
        padding: "0px",
        paddingLeft: "20%",
        border: "none",
        outline: "none",
        background: "none",
        fontSize: "12px",
        color: "#333",
        height: "16px"
      },
      HEXlabel: {
        display: "none"
      },
      RGBwrap: {
        flex: "3",
        position: "relative"
      },
      RGBinput: {
        width: "70%",
        padding: "0px",
        paddingLeft: "30%",
        border: "none",
        outline: "none",
        background: "none",
        fontSize: "12px",
        color: "#333",
        height: "16px"
      },
      RGBlabel: {
        position: "absolute",
        top: "3px",
        left: "0px",
        lineHeight: "16px",
        textTransform: "uppercase",
        fontSize: "12px",
        color: "#999"
      }
    }
  });
  var handleChange = function handleChange2(data, e2) {
    if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    } else {
      onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    }
  };
  return React$6.createElement(
    "div",
    { style: styles2.fields, className: "flexbox-fix" },
    React$6.createElement("div", { style: styles2.active }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
      label: "hex",
      value: hex3,
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "r",
      value: rgb.r,
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "g",
      value: rgb.g,
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "b",
      value: rgb.b,
      onChange: handleChange
    })
  );
};
var Compact = function Compact2(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      Compact: {
        background: "#f6f6f6",
        radius: "4px"
      },
      compact: {
        paddingTop: "5px",
        paddingLeft: "5px",
        boxSizing: "initial",
        width: "240px"
      },
      clear: {
        clear: "both"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else {
      onChange(data, e2);
    }
  };
  return React$6.createElement(
    Raised,
    { style: styles2.Compact, styles: passedStyles },
    React$6.createElement(
      "div",
      { style: styles2.compact, className: "compact-picker " + className },
      React$6.createElement(
        "div",
        null,
        map$3(colors2, function(c2) {
          return React$6.createElement(CompactColor, {
            key: c2,
            color: c2,
            active: c2.toLowerCase() === hex3,
            onClick: handleChange,
            onSwatchHover
          });
        }),
        React$6.createElement("div", { style: styles2.clear })
      ),
      React$6.createElement(CompactFields, { hex: hex3, rgb, onChange: handleChange })
    )
  );
};
Compact.propTypes = {
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  styles: PropTypes$4.object
};
Compact.defaultProps = {
  colors: ["#4D4D4D", "#999999", "#FFFFFF", "#F44E3B", "#FE9200", "#FCDC00", "#DBDF00", "#A4DD00", "#68CCCA", "#73D8FF", "#AEA1FF", "#FDA1FF", "#333333", "#808080", "#cccccc", "#D33115", "#E27300", "#FCC400", "#B0BC00", "#68BC00", "#16A5A5", "#009CE0", "#7B64FF", "#FA28FF", "#000000", "#666666", "#B3B3B3", "#9F0500", "#C45100", "#FB9E00", "#808900", "#194D33", "#0C797D", "#0062B1", "#653294", "#AB149E"],
  styles: {}
};
ColorWrap(Compact);
var GithubSwatch = function GithubSwatch2(_ref) {
  var hover3 = _ref.hover, color2 = _ref.color, onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover;
  var hoverSwatch = {
    position: "relative",
    zIndex: "2",
    outline: "2px solid #fff",
    boxShadow: "0 0 5px 2px rgba(0,0,0,0.25)"
  };
  var styles2 = _default$4({
    "default": {
      swatch: {
        width: "25px",
        height: "25px",
        fontSize: "0"
      }
    },
    "hover": {
      swatch: hoverSwatch
    }
  }, { hover: hover3 });
  return React$6.createElement(
    "div",
    { style: styles2.swatch },
    React$6.createElement(Swatch$1, {
      color: color2,
      onClick,
      onHover: onSwatchHover,
      focusStyle: hoverSwatch
    })
  );
};
const GithubSwatch$1 = handleHover(GithubSwatch);
var Github = function Github2(_ref) {
  var width = _ref.width, colors2 = _ref.colors, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        border: "1px solid rgba(0,0,0,0.2)",
        boxShadow: "0 3px 12px rgba(0,0,0,0.15)",
        borderRadius: "4px",
        position: "relative",
        padding: "5px",
        display: "flex",
        flexWrap: "wrap"
      },
      triangle: {
        position: "absolute",
        border: "7px solid transparent",
        borderBottomColor: "#fff"
      },
      triangleShadow: {
        position: "absolute",
        border: "8px solid transparent",
        borderBottomColor: "rgba(0,0,0,0.15)"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      },
      triangleShadow: {
        display: "none"
      }
    },
    "top-left-triangle": {
      triangle: {
        top: "-14px",
        left: "10px"
      },
      triangleShadow: {
        top: "-16px",
        left: "9px"
      }
    },
    "top-right-triangle": {
      triangle: {
        top: "-14px",
        right: "10px"
      },
      triangleShadow: {
        top: "-16px",
        right: "9px"
      }
    },
    "bottom-left-triangle": {
      triangle: {
        top: "35px",
        left: "10px",
        transform: "rotate(180deg)"
      },
      triangleShadow: {
        top: "37px",
        left: "9px",
        transform: "rotate(180deg)"
      }
    },
    "bottom-right-triangle": {
      triangle: {
        top: "35px",
        right: "10px",
        transform: "rotate(180deg)"
      },
      triangleShadow: {
        top: "37px",
        right: "9px",
        transform: "rotate(180deg)"
      }
    }
  }, passedStyles), {
    "hide-triangle": triangle === "hide",
    "top-left-triangle": triangle === "top-left",
    "top-right-triangle": triangle === "top-right",
    "bottom-left-triangle": triangle === "bottom-left",
    "bottom-right-triangle": triangle === "bottom-right"
  });
  var handleChange = function handleChange2(hex3, e2) {
    return onChange({ hex: hex3, source: "hex" }, e2);
  };
  return React$6.createElement(
    "div",
    { style: styles2.card, className: "github-picker " + className },
    React$6.createElement("div", { style: styles2.triangleShadow }),
    React$6.createElement("div", { style: styles2.triangle }),
    map$3(colors2, function(c2) {
      return React$6.createElement(GithubSwatch$1, {
        color: c2,
        key: c2,
        onClick: handleChange,
        onSwatchHover
      });
    })
  );
};
Github.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  triangle: PropTypes$4.oneOf(["hide", "top-left", "top-right", "bottom-left", "bottom-right"]),
  styles: PropTypes$4.object
};
Github.defaultProps = {
  width: 200,
  colors: ["#B80000", "#DB3E00", "#FCCB00", "#008B02", "#006B76", "#1273DE", "#004DCF", "#5300EB", "#EB9694", "#FAD0C3", "#FEF3BD", "#C1E1C5", "#BEDADC", "#C4DEF6", "#BED3F3", "#D4C4FB"],
  triangle: "top-left",
  styles: {}
};
ColorWrap(Github);
var SliderPointer$1 = function SliderPointer(_ref) {
  var direction = _ref.direction;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "18px",
        height: "18px",
        borderRadius: "50%",
        transform: "translate(-9px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    },
    "vertical": {
      picker: {
        transform: "translate(-3px, -9px)"
      }
    }
  }, { vertical: direction === "vertical" });
  return React$6.createElement("div", { style: styles2.picker });
};
var _extends$7 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var HuePicker = function HuePicker2(_ref) {
  var width = _ref.width, height = _ref.height, onChange = _ref.onChange, hsl = _ref.hsl, direction = _ref.direction, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        position: "relative",
        width,
        height
      },
      hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data) {
    return onChange({ a: 1, h: data.h, l: 0.5, s: 1 });
  };
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "hue-picker " + className },
    React$6.createElement(Hue, _extends$7({}, styles2.hue, {
      hsl,
      pointer,
      onChange: handleChange,
      direction
    }))
  );
};
HuePicker.propTypes = {
  styles: PropTypes$4.object
};
HuePicker.defaultProps = {
  width: "316px",
  height: "16px",
  direction: "horizontal",
  pointer: SliderPointer$1,
  styles: {}
};
ColorWrap(HuePicker);
var Material = function Material2(_ref) {
  var onChange = _ref.onChange, hex3 = _ref.hex, rgb = _ref.rgb, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      material: {
        width: "98px",
        height: "98px",
        padding: "16px",
        fontFamily: "Roboto"
      },
      HEXwrap: {
        position: "relative"
      },
      HEXinput: {
        width: "100%",
        marginTop: "12px",
        fontSize: "15px",
        color: "#333",
        padding: "0px",
        border: "0px",
        borderBottom: "2px solid " + hex3,
        outline: "none",
        height: "30px"
      },
      HEXlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        fontSize: "11px",
        color: "#999999",
        textTransform: "capitalize"
      },
      Hex: {
        style: {}
      },
      RGBwrap: {
        position: "relative"
      },
      RGBinput: {
        width: "100%",
        marginTop: "12px",
        fontSize: "15px",
        color: "#333",
        padding: "0px",
        border: "0px",
        borderBottom: "1px solid #eee",
        outline: "none",
        height: "30px"
      },
      RGBlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        fontSize: "11px",
        color: "#999999",
        textTransform: "capitalize"
      },
      split: {
        display: "flex",
        marginRight: "-10px",
        paddingTop: "11px"
      },
      third: {
        flex: "1",
        paddingRight: "10px"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    }
  };
  return React$6.createElement(
    Raised,
    { styles: passedStyles },
    React$6.createElement(
      "div",
      { style: styles2.material, className: "material-picker " + className },
      React$6.createElement(EditableInput, {
        style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
        label: "hex",
        value: hex3,
        onChange: handleChange
      }),
      React$6.createElement(
        "div",
        { style: styles2.split, className: "flexbox-fix" },
        React$6.createElement(
          "div",
          { style: styles2.third },
          React$6.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "r",
            value: rgb.r,
            onChange: handleChange
          })
        ),
        React$6.createElement(
          "div",
          { style: styles2.third },
          React$6.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "g",
            value: rgb.g,
            onChange: handleChange
          })
        ),
        React$6.createElement(
          "div",
          { style: styles2.third },
          React$6.createElement(EditableInput, {
            style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
            label: "b",
            value: rgb.b,
            onChange: handleChange
          })
        )
      )
    )
  );
};
ColorWrap(Material);
var PhotoshopPicker = function PhotoshopPicker2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsv = _ref.hsv, hex3 = _ref.hex;
  var styles2 = _default$4({
    "default": {
      fields: {
        paddingTop: "5px",
        paddingBottom: "9px",
        width: "80px",
        position: "relative"
      },
      divider: {
        height: "5px"
      },
      RGBwrap: {
        position: "relative"
      },
      RGBinput: {
        marginLeft: "40%",
        width: "40%",
        height: "18px",
        border: "1px solid #888888",
        boxShadow: "inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",
        marginBottom: "5px",
        fontSize: "13px",
        paddingLeft: "3px",
        marginRight: "10px"
      },
      RGBlabel: {
        left: "0px",
        top: "0px",
        width: "34px",
        textTransform: "uppercase",
        fontSize: "13px",
        height: "18px",
        lineHeight: "22px",
        position: "absolute"
      },
      HEXwrap: {
        position: "relative"
      },
      HEXinput: {
        marginLeft: "20%",
        width: "80%",
        height: "18px",
        border: "1px solid #888888",
        boxShadow: "inset 0 1px 1px rgba(0,0,0,.1), 0 1px 0 0 #ECECEC",
        marginBottom: "6px",
        fontSize: "13px",
        paddingLeft: "3px"
      },
      HEXlabel: {
        position: "absolute",
        top: "0px",
        left: "0px",
        width: "14px",
        textTransform: "uppercase",
        fontSize: "13px",
        height: "18px",
        lineHeight: "22px"
      },
      fieldSymbols: {
        position: "absolute",
        top: "5px",
        right: "-7px",
        fontSize: "13px"
      },
      symbol: {
        height: "20px",
        lineHeight: "22px",
        paddingBottom: "7px"
      }
    }
  });
  var handleChange = function handleChange2(data, e2) {
    if (data["#"]) {
      isValidHex(data["#"]) && onChange({
        hex: data["#"],
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        source: "rgb"
      }, e2);
    } else if (data.h || data.s || data.v) {
      onChange({
        h: data.h || hsv.h,
        s: data.s || hsv.s,
        v: data.v || hsv.v,
        source: "hsv"
      }, e2);
    }
  };
  return React$6.createElement(
    "div",
    { style: styles2.fields },
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "h",
      value: Math.round(hsv.h),
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "s",
      value: Math.round(hsv.s * 100),
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "v",
      value: Math.round(hsv.v * 100),
      onChange: handleChange
    }),
    React$6.createElement("div", { style: styles2.divider }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "r",
      value: rgb.r,
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "g",
      value: rgb.g,
      onChange: handleChange
    }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.RGBwrap, input: styles2.RGBinput, label: styles2.RGBlabel },
      label: "b",
      value: rgb.b,
      onChange: handleChange
    }),
    React$6.createElement("div", { style: styles2.divider }),
    React$6.createElement(EditableInput, {
      style: { wrap: styles2.HEXwrap, input: styles2.HEXinput, label: styles2.HEXlabel },
      label: "#",
      value: hex3.replace("#", ""),
      onChange: handleChange
    }),
    React$6.createElement(
      "div",
      { style: styles2.fieldSymbols },
      React$6.createElement(
        "div",
        { style: styles2.symbol },
        "°"
      ),
      React$6.createElement(
        "div",
        { style: styles2.symbol },
        "%"
      ),
      React$6.createElement(
        "div",
        { style: styles2.symbol },
        "%"
      )
    )
  );
};
var PhotoshopPointerCircle$1 = function PhotoshopPointerCircle(_ref) {
  var hsl = _ref.hsl;
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "12px",
        height: "12px",
        borderRadius: "6px",
        boxShadow: "inset 0 0 0 1px #fff",
        transform: "translate(-6px, -6px)"
      }
    },
    "black-outline": {
      picker: {
        boxShadow: "inset 0 0 0 1px #000"
      }
    }
  }, { "black-outline": hsl.l > 0.5 });
  return React$6.createElement("div", { style: styles2.picker });
};
var PhotoshopPointerCircle2 = function PhotoshopPointerCircle3() {
  var styles2 = _default$4({
    "default": {
      triangle: {
        width: 0,
        height: 0,
        borderStyle: "solid",
        borderWidth: "4px 0 4px 6px",
        borderColor: "transparent transparent transparent #fff",
        position: "absolute",
        top: "1px",
        left: "1px"
      },
      triangleBorder: {
        width: 0,
        height: 0,
        borderStyle: "solid",
        borderWidth: "5px 0 5px 8px",
        borderColor: "transparent transparent transparent #555"
      },
      left: {
        Extend: "triangleBorder",
        transform: "translate(-13px, -4px)"
      },
      leftInside: {
        Extend: "triangle",
        transform: "translate(-8px, -5px)"
      },
      right: {
        Extend: "triangleBorder",
        transform: "translate(20px, -14px) rotate(180deg)"
      },
      rightInside: {
        Extend: "triangle",
        transform: "translate(-8px, -5px)"
      }
    }
  });
  return React$6.createElement(
    "div",
    { style: styles2.pointer },
    React$6.createElement(
      "div",
      { style: styles2.left },
      React$6.createElement("div", { style: styles2.leftInside })
    ),
    React$6.createElement(
      "div",
      { style: styles2.right },
      React$6.createElement("div", { style: styles2.rightInside })
    )
  );
};
var PhotoshopButton = function PhotoshopButton2(_ref) {
  var onClick = _ref.onClick, label = _ref.label, children = _ref.children, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      button: {
        backgroundImage: "linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",
        border: "1px solid #878787",
        borderRadius: "2px",
        height: "20px",
        boxShadow: "0 1px 0 0 #EAEAEA",
        fontSize: "14px",
        color: "#000",
        lineHeight: "20px",
        textAlign: "center",
        marginBottom: "10px",
        cursor: "pointer"
      }
    },
    "active": {
      button: {
        boxShadow: "0 0 0 1px #878787"
      }
    }
  }, { active: active3 });
  return React$6.createElement(
    "div",
    { style: styles2.button, onClick },
    label || children
  );
};
var PhotoshopPreviews = function PhotoshopPreviews2(_ref) {
  var rgb = _ref.rgb, currentColor = _ref.currentColor;
  var styles2 = _default$4({
    "default": {
      swatches: {
        border: "1px solid #B3B3B3",
        borderBottom: "1px solid #F0F0F0",
        marginBottom: "2px",
        marginTop: "1px"
      },
      new: {
        height: "34px",
        background: "rgb(" + rgb.r + "," + rgb.g + ", " + rgb.b + ")",
        boxShadow: "inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"
      },
      current: {
        height: "34px",
        background: currentColor,
        boxShadow: "inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"
      },
      label: {
        fontSize: "14px",
        color: "#000",
        textAlign: "center"
      }
    }
  });
  return React$6.createElement(
    "div",
    null,
    React$6.createElement(
      "div",
      { style: styles2.label },
      "new"
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatches },
      React$6.createElement("div", { style: styles2.new }),
      React$6.createElement("div", { style: styles2.current })
    ),
    React$6.createElement(
      "div",
      { style: styles2.label },
      "current"
    )
  );
};
var _createClass = /* @__PURE__ */ function() {
  function defineProperties(target, props) {
    for (var i2 = 0; i2 < props.length; i2++) {
      var descriptor = props[i2];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor)
        descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps)
      defineProperties(Constructor.prototype, protoProps);
    if (staticProps)
      defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();
function _classCallCheck(instance2, Constructor) {
  if (!(instance2 instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}
function _possibleConstructorReturn(self2, call2) {
  if (!self2) {
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  }
  return call2 && (typeof call2 === "object" || typeof call2 === "function") ? call2 : self2;
}
function _inherits(subClass, superClass) {
  if (typeof superClass !== "function" && superClass !== null) {
    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  }
  subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
  if (superClass)
    Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
var Photoshop = function(_React$Component) {
  _inherits(Photoshop2, _React$Component);
  function Photoshop2(props) {
    _classCallCheck(this, Photoshop2);
    var _this = _possibleConstructorReturn(this, (Photoshop2.__proto__ || Object.getPrototypeOf(Photoshop2)).call(this));
    _this.state = {
      currentColor: props.hex
    };
    return _this;
  }
  _createClass(Photoshop2, [{
    key: "render",
    value: function render3() {
      var _props = this.props, _props$styles = _props.styles, passedStyles = _props$styles === void 0 ? {} : _props$styles, _props$className = _props.className, className = _props$className === void 0 ? "" : _props$className;
      var styles2 = _default$4(merge$3({
        "default": {
          picker: {
            background: "#DCDCDC",
            borderRadius: "4px",
            boxShadow: "0 0 0 1px rgba(0,0,0,.25), 0 8px 16px rgba(0,0,0,.15)",
            boxSizing: "initial",
            width: "513px"
          },
          head: {
            backgroundImage: "linear-gradient(-180deg, #F0F0F0 0%, #D4D4D4 100%)",
            borderBottom: "1px solid #B1B1B1",
            boxShadow: "inset 0 1px 0 0 rgba(255,255,255,.2), inset 0 -1px 0 0 rgba(0,0,0,.02)",
            height: "23px",
            lineHeight: "24px",
            borderRadius: "4px 4px 0 0",
            fontSize: "13px",
            color: "#4D4D4D",
            textAlign: "center"
          },
          body: {
            padding: "15px 15px 0",
            display: "flex"
          },
          saturation: {
            width: "256px",
            height: "256px",
            position: "relative",
            border: "2px solid #B3B3B3",
            borderBottom: "2px solid #F0F0F0",
            overflow: "hidden"
          },
          hue: {
            position: "relative",
            height: "256px",
            width: "19px",
            marginLeft: "10px",
            border: "2px solid #B3B3B3",
            borderBottom: "2px solid #F0F0F0"
          },
          controls: {
            width: "180px",
            marginLeft: "10px"
          },
          top: {
            display: "flex"
          },
          previews: {
            width: "60px"
          },
          actions: {
            flex: "1",
            marginLeft: "20px"
          }
        }
      }, passedStyles));
      return React$6.createElement(
        "div",
        { style: styles2.picker, className: "photoshop-picker " + className },
        React$6.createElement(
          "div",
          { style: styles2.head },
          this.props.header
        ),
        React$6.createElement(
          "div",
          { style: styles2.body, className: "flexbox-fix" },
          React$6.createElement(
            "div",
            { style: styles2.saturation },
            React$6.createElement(Saturation, {
              hsl: this.props.hsl,
              hsv: this.props.hsv,
              pointer: PhotoshopPointerCircle$1,
              onChange: this.props.onChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.hue },
            React$6.createElement(Hue, {
              direction: "vertical",
              hsl: this.props.hsl,
              pointer: PhotoshopPointerCircle2,
              onChange: this.props.onChange
            })
          ),
          React$6.createElement(
            "div",
            { style: styles2.controls },
            React$6.createElement(
              "div",
              { style: styles2.top, className: "flexbox-fix" },
              React$6.createElement(
                "div",
                { style: styles2.previews },
                React$6.createElement(PhotoshopPreviews, {
                  rgb: this.props.rgb,
                  currentColor: this.state.currentColor
                })
              ),
              React$6.createElement(
                "div",
                { style: styles2.actions },
                React$6.createElement(PhotoshopButton, { label: "OK", onClick: this.props.onAccept, active: true }),
                React$6.createElement(PhotoshopButton, { label: "Cancel", onClick: this.props.onCancel }),
                React$6.createElement(PhotoshopPicker, {
                  onChange: this.props.onChange,
                  rgb: this.props.rgb,
                  hsv: this.props.hsv,
                  hex: this.props.hex
                })
              )
            )
          )
        )
      );
    }
  }]);
  return Photoshop2;
}(React$6.Component);
Photoshop.propTypes = {
  header: PropTypes$4.string,
  styles: PropTypes$4.object
};
Photoshop.defaultProps = {
  header: "Color Picker",
  styles: {}
};
ColorWrap(Photoshop);
var SketchFields = function SketchFields2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex3 = _ref.hex, disableAlpha = _ref.disableAlpha;
  var styles2 = _default$4({
    "default": {
      fields: {
        display: "flex",
        paddingTop: "4px"
      },
      single: {
        flex: "1",
        paddingLeft: "6px"
      },
      alpha: {
        flex: "1",
        paddingLeft: "6px"
      },
      double: {
        flex: "2"
      },
      input: {
        width: "80%",
        padding: "4px 10% 3px",
        border: "none",
        boxShadow: "inset 0 0 0 1px #ccc",
        fontSize: "11px"
      },
      label: {
        display: "block",
        textAlign: "center",
        fontSize: "11px",
        color: "#222",
        paddingTop: "3px",
        paddingBottom: "4px",
        textTransform: "capitalize"
      }
    },
    "disableAlpha": {
      alpha: {
        display: "none"
      }
    }
  }, { disableAlpha });
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.r || data.g || data.b) {
      onChange({
        r: data.r || rgb.r,
        g: data.g || rgb.g,
        b: data.b || rgb.b,
        a: rgb.a,
        source: "rgb"
      }, e2);
    } else if (data.a) {
      if (data.a < 0) {
        data.a = 0;
      } else if (data.a > 100) {
        data.a = 100;
      }
      data.a /= 100;
      onChange({
        h: hsl.h,
        s: hsl.s,
        l: hsl.l,
        a: data.a,
        source: "rgb"
      }, e2);
    }
  };
  return React$6.createElement(
    "div",
    { style: styles2.fields, className: "flexbox-fix" },
    React$6.createElement(
      "div",
      { style: styles2.double },
      React$6.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "hex",
        value: hex3.replace("#", ""),
        onChange: handleChange
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.single },
      React$6.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "r",
        value: rgb.r,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.single },
      React$6.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "g",
        value: rgb.g,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.single },
      React$6.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "b",
        value: rgb.b,
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "255"
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.alpha },
      React$6.createElement(EditableInput, {
        style: { input: styles2.input, label: styles2.label },
        label: "a",
        value: Math.round(rgb.a * 100),
        onChange: handleChange,
        dragLabel: "true",
        dragMax: "100"
      })
    )
  );
};
var _extends$6 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var SketchPresetColors = function SketchPresetColors2(_ref) {
  var colors2 = _ref.colors, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover;
  var styles2 = _default$4({
    "default": {
      colors: {
        margin: "0 -10px",
        padding: "10px 0 0 10px",
        borderTop: "1px solid #eee",
        display: "flex",
        flexWrap: "wrap",
        position: "relative"
      },
      swatchWrap: {
        width: "16px",
        height: "16px",
        margin: "0 10px 10px 0"
      },
      swatch: {
        borderRadius: "3px",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15)"
      }
    },
    "no-presets": {
      colors: {
        display: "none"
      }
    }
  }, {
    "no-presets": !colors2 || !colors2.length
  });
  var handleClick = function handleClick2(hex3, e2) {
    onClick({
      hex: hex3,
      source: "hex"
    }, e2);
  };
  return React$6.createElement(
    "div",
    { style: styles2.colors, className: "flexbox-fix" },
    colors2.map(function(colorObjOrString) {
      var c2 = typeof colorObjOrString === "string" ? { color: colorObjOrString } : colorObjOrString;
      var key = "" + c2.color + (c2.title || "");
      return React$6.createElement(
        "div",
        { key, style: styles2.swatchWrap },
        React$6.createElement(Swatch$1, _extends$6({}, c2, {
          style: styles2.swatch,
          onClick: handleClick,
          onHover: onSwatchHover,
          focusStyle: {
            boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px " + c2.color
          }
        }))
      );
    })
  );
};
SketchPresetColors.propTypes = {
  colors: PropTypes$4.arrayOf(PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.shape({
    color: PropTypes$4.string,
    title: PropTypes$4.string
  })])).isRequired
};
var _extends$5 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var Sketch = function Sketch2(_ref) {
  var width = _ref.width, rgb = _ref.rgb, hex3 = _ref.hex, hsv = _ref.hsv, hsl = _ref.hsl, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, disableAlpha = _ref.disableAlpha, presetColors = _ref.presetColors, renderers = _ref.renderers, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": _extends$5({
      picker: {
        width,
        padding: "10px 10px 0",
        boxSizing: "initial",
        background: "#fff",
        borderRadius: "4px",
        boxShadow: "0 0 0 1px rgba(0,0,0,.15), 0 8px 16px rgba(0,0,0,.15)"
      },
      saturation: {
        width: "100%",
        paddingBottom: "75%",
        position: "relative",
        overflow: "hidden"
      },
      Saturation: {
        radius: "3px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      controls: {
        display: "flex"
      },
      sliders: {
        padding: "4px 0",
        flex: "1"
      },
      color: {
        width: "24px",
        height: "24px",
        position: "relative",
        marginTop: "4px",
        marginLeft: "4px",
        borderRadius: "3px"
      },
      activeColor: {
        absolute: "0px 0px 0px 0px",
        borderRadius: "2px",
        background: "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + rgb.a + ")",
        boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      hue: {
        position: "relative",
        height: "10px",
        overflow: "hidden"
      },
      Hue: {
        radius: "2px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      },
      alpha: {
        position: "relative",
        height: "10px",
        marginTop: "4px",
        overflow: "hidden"
      },
      Alpha: {
        radius: "2px",
        shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
      }
    }, passedStyles),
    "disableAlpha": {
      color: {
        height: "10px"
      },
      hue: {
        height: "10px"
      },
      alpha: {
        display: "none"
      }
    }
  }, passedStyles), { disableAlpha });
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "sketch-picker " + className },
    React$6.createElement(
      "div",
      { style: styles2.saturation },
      React$6.createElement(Saturation, {
        style: styles2.Saturation,
        hsl,
        hsv,
        onChange
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.controls, className: "flexbox-fix" },
      React$6.createElement(
        "div",
        { style: styles2.sliders },
        React$6.createElement(
          "div",
          { style: styles2.hue },
          React$6.createElement(Hue, {
            style: styles2.Hue,
            hsl,
            onChange
          })
        ),
        React$6.createElement(
          "div",
          { style: styles2.alpha },
          React$6.createElement(Alpha, {
            style: styles2.Alpha,
            rgb,
            hsl,
            renderers,
            onChange
          })
        )
      ),
      React$6.createElement(
        "div",
        { style: styles2.color },
        React$6.createElement(Checkboard, null),
        React$6.createElement("div", { style: styles2.activeColor })
      )
    ),
    React$6.createElement(SketchFields, {
      rgb,
      hsl,
      hex: hex3,
      onChange,
      disableAlpha
    }),
    React$6.createElement(SketchPresetColors, {
      colors: presetColors,
      onClick: onChange,
      onSwatchHover
    })
  );
};
Sketch.propTypes = {
  disableAlpha: PropTypes$4.bool,
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  styles: PropTypes$4.object
};
Sketch.defaultProps = {
  disableAlpha: false,
  width: 200,
  styles: {},
  presetColors: ["#D0021B", "#F5A623", "#F8E71C", "#8B572A", "#7ED321", "#417505", "#BD10E0", "#9013FE", "#4A90E2", "#50E3C2", "#B8E986", "#000000", "#4A4A4A", "#9B9B9B", "#FFFFFF"]
};
const SketchPicker = ColorWrap(Sketch);
var SliderSwatch = function SliderSwatch2(_ref) {
  var hsl = _ref.hsl, offset2 = _ref.offset, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, active3 = _ref.active, first = _ref.first, last = _ref.last;
  var styles2 = _default$4({
    "default": {
      swatch: {
        height: "12px",
        background: "hsl(" + hsl.h + ", 50%, " + offset2 * 100 + "%)",
        cursor: "pointer"
      }
    },
    "first": {
      swatch: {
        borderRadius: "2px 0 0 2px"
      }
    },
    "last": {
      swatch: {
        borderRadius: "0 2px 2px 0"
      }
    },
    "active": {
      swatch: {
        transform: "scaleY(1.8)",
        borderRadius: "3.6px/2px"
      }
    }
  }, { active: active3, first, last });
  var handleClick = function handleClick2(e2) {
    return onClick({
      h: hsl.h,
      s: 0.5,
      l: offset2,
      source: "hsl"
    }, e2);
  };
  return React$6.createElement("div", { style: styles2.swatch, onClick: handleClick });
};
var SliderSwatches = function SliderSwatches2(_ref) {
  var onClick = _ref.onClick, hsl = _ref.hsl;
  var styles2 = _default$4({
    "default": {
      swatches: {
        marginTop: "20px"
      },
      swatch: {
        boxSizing: "border-box",
        width: "20%",
        paddingRight: "1px",
        float: "left"
      },
      clear: {
        clear: "both"
      }
    }
  });
  var epsilon = 0.1;
  return React$6.createElement(
    "div",
    { style: styles2.swatches },
    React$6.createElement(
      "div",
      { style: styles2.swatch },
      React$6.createElement(SliderSwatch, {
        hsl,
        offset: ".80",
        active: Math.abs(hsl.l - 0.8) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick,
        first: true
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatch },
      React$6.createElement(SliderSwatch, {
        hsl,
        offset: ".65",
        active: Math.abs(hsl.l - 0.65) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatch },
      React$6.createElement(SliderSwatch, {
        hsl,
        offset: ".50",
        active: Math.abs(hsl.l - 0.5) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatch },
      React$6.createElement(SliderSwatch, {
        hsl,
        offset: ".35",
        active: Math.abs(hsl.l - 0.35) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatch },
      React$6.createElement(SliderSwatch, {
        hsl,
        offset: ".20",
        active: Math.abs(hsl.l - 0.2) < epsilon && Math.abs(hsl.s - 0.5) < epsilon,
        onClick,
        last: true
      })
    ),
    React$6.createElement("div", { style: styles2.clear })
  );
};
var SliderPointer2 = function SliderPointer3() {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "14px",
        height: "14px",
        borderRadius: "6px",
        transform: "translate(-7px, -1px)",
        backgroundColor: "rgb(248, 248, 248)",
        boxShadow: "0 1px 4px 0 rgba(0, 0, 0, 0.37)"
      }
    }
  });
  return React$6.createElement("div", { style: styles2.picker });
};
var Slider = function Slider2(_ref) {
  var hsl = _ref.hsl, onChange = _ref.onChange, pointer = _ref.pointer, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      hue: {
        height: "12px",
        position: "relative"
      },
      Hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  return React$6.createElement(
    "div",
    { style: styles2.wrap || {}, className: "slider-picker " + className },
    React$6.createElement(
      "div",
      { style: styles2.hue },
      React$6.createElement(Hue, {
        style: styles2.Hue,
        hsl,
        pointer,
        onChange
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.swatches },
      React$6.createElement(SliderSwatches, { hsl, onClick: onChange })
    )
  );
};
Slider.propTypes = {
  styles: PropTypes$4.object
};
Slider.defaultProps = {
  pointer: SliderPointer2,
  styles: {}
};
ColorWrap(Slider);
var CheckIcon = {};
Object.defineProperty(CheckIcon, "__esModule", {
  value: true
});
var _extends$4 = Object.assign || function(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2];
    for (var key in source2) {
      if (Object.prototype.hasOwnProperty.call(source2, key)) {
        target[key] = source2[key];
      }
    }
  }
  return target;
};
var _react$1 = reactExports;
var _react2 = _interopRequireDefault$2(_react$1);
function _interopRequireDefault$2(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _objectWithoutProperties$1(obj, keys2) {
  var target = {};
  for (var i2 in obj) {
    if (keys2.indexOf(i2) >= 0)
      continue;
    if (!Object.prototype.hasOwnProperty.call(obj, i2))
      continue;
    target[i2] = obj[i2];
  }
  return target;
}
var DEFAULT_SIZE$1 = 24;
var _default$2 = CheckIcon.default = function(_ref) {
  var _ref$fill = _ref.fill, fill2 = _ref$fill === void 0 ? "currentColor" : _ref$fill, _ref$width = _ref.width, width = _ref$width === void 0 ? DEFAULT_SIZE$1 : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? DEFAULT_SIZE$1 : _ref$height, _ref$style = _ref.style, style2 = _ref$style === void 0 ? {} : _ref$style, props = _objectWithoutProperties$1(_ref, ["fill", "width", "height", "style"]);
  return _react2.default.createElement(
    "svg",
    _extends$4({
      viewBox: "0 0 " + DEFAULT_SIZE$1 + " " + DEFAULT_SIZE$1,
      style: _extends$4({ fill: fill2, width, height }, style2)
    }, props),
    _react2.default.createElement("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
  );
};
var SwatchesColor = function SwatchesColor2(_ref) {
  var color2 = _ref.color, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function() {
  } : _ref$onClick, onSwatchHover = _ref.onSwatchHover, first = _ref.first, last = _ref.last, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      color: {
        width: "40px",
        height: "24px",
        cursor: "pointer",
        background: color2,
        marginBottom: "1px"
      },
      check: {
        color: getContrastingColor(color2),
        marginLeft: "8px",
        display: "none"
      }
    },
    "first": {
      color: {
        overflow: "hidden",
        borderRadius: "2px 2px 0 0"
      }
    },
    "last": {
      color: {
        overflow: "hidden",
        borderRadius: "0 0 2px 2px"
      }
    },
    "active": {
      check: {
        display: "block"
      }
    },
    "color-#FFFFFF": {
      color: {
        boxShadow: "inset 0 0 0 1px #ddd"
      },
      check: {
        color: "#333"
      }
    },
    "transparent": {
      check: {
        color: "#333"
      }
    }
  }, {
    first,
    last,
    active: active3,
    "color-#FFFFFF": color2 === "#FFFFFF",
    "transparent": color2 === "transparent"
  });
  return React$6.createElement(
    Swatch$1,
    {
      color: color2,
      style: styles2.color,
      onClick,
      onHover: onSwatchHover,
      focusStyle: { boxShadow: "0 0 4px " + color2 }
    },
    React$6.createElement(
      "div",
      { style: styles2.check },
      React$6.createElement(_default$2, null)
    )
  );
};
var SwatchesGroup = function SwatchesGroup2(_ref) {
  var onClick = _ref.onClick, onSwatchHover = _ref.onSwatchHover, group = _ref.group, active3 = _ref.active;
  var styles2 = _default$4({
    "default": {
      group: {
        paddingBottom: "10px",
        width: "40px",
        float: "left",
        marginRight: "10px"
      }
    }
  });
  return React$6.createElement(
    "div",
    { style: styles2.group },
    map$3(group, function(color2, i2) {
      return React$6.createElement(SwatchesColor, {
        key: color2,
        color: color2,
        active: color2.toLowerCase() === active3,
        first: i2 === 0,
        last: i2 === group.length - 1,
        onClick,
        onSwatchHover
      });
    })
  );
};
var Swatches = function Swatches2(_ref) {
  var width = _ref.width, height = _ref.height, onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, colors2 = _ref.colors, hex3 = _ref.hex, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        height
      },
      overflow: {
        height,
        overflowY: "scroll"
      },
      body: {
        padding: "16px 0 6px 16px"
      },
      clear: {
        clear: "both"
      }
    }
  }, passedStyles));
  var handleChange = function handleChange2(data, e2) {
    return onChange({ hex: data, source: "hex" }, e2);
  };
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "swatches-picker " + className },
    React$6.createElement(
      Raised,
      null,
      React$6.createElement(
        "div",
        { style: styles2.overflow },
        React$6.createElement(
          "div",
          { style: styles2.body },
          map$3(colors2, function(group) {
            return React$6.createElement(SwatchesGroup, {
              key: group.toString(),
              group,
              active: hex3,
              onClick: handleChange,
              onSwatchHover
            });
          }),
          React$6.createElement("div", { style: styles2.clear })
        )
      )
    )
  );
};
Swatches.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  height: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  colors: PropTypes$4.arrayOf(PropTypes$4.arrayOf(PropTypes$4.string)),
  styles: PropTypes$4.object
  /* eslint-disable max-len */
};
Swatches.defaultProps = {
  width: 320,
  height: 240,
  colors: [[red["900"], red["700"], red["500"], red["300"], red["100"]], [pink["900"], pink["700"], pink["500"], pink["300"], pink["100"]], [purple["900"], purple["700"], purple["500"], purple["300"], purple["100"]], [deepPurple["900"], deepPurple["700"], deepPurple["500"], deepPurple["300"], deepPurple["100"]], [indigo["900"], indigo["700"], indigo["500"], indigo["300"], indigo["100"]], [blue["900"], blue["700"], blue["500"], blue["300"], blue["100"]], [lightBlue["900"], lightBlue["700"], lightBlue["500"], lightBlue["300"], lightBlue["100"]], [cyan["900"], cyan["700"], cyan["500"], cyan["300"], cyan["100"]], [teal["900"], teal["700"], teal["500"], teal["300"], teal["100"]], ["#194D33", green["700"], green["500"], green["300"], green["100"]], [lightGreen["900"], lightGreen["700"], lightGreen["500"], lightGreen["300"], lightGreen["100"]], [lime["900"], lime["700"], lime["500"], lime["300"], lime["100"]], [yellow["900"], yellow["700"], yellow["500"], yellow["300"], yellow["100"]], [amber["900"], amber["700"], amber["500"], amber["300"], amber["100"]], [orange["900"], orange["700"], orange["500"], orange["300"], orange["100"]], [deepOrange["900"], deepOrange["700"], deepOrange["500"], deepOrange["300"], deepOrange["100"]], [brown["900"], brown["700"], brown["500"], brown["300"], brown["100"]], [blueGrey["900"], blueGrey["700"], blueGrey["500"], blueGrey["300"], blueGrey["100"]], ["#000000", "#525252", "#969696", "#D9D9D9", "#FFFFFF"]],
  styles: {}
};
ColorWrap(Swatches);
var Twitter = function Twitter2(_ref) {
  var onChange = _ref.onChange, onSwatchHover = _ref.onSwatchHover, hex3 = _ref.hex, colors2 = _ref.colors, width = _ref.width, triangle = _ref.triangle, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      card: {
        width,
        background: "#fff",
        border: "0 solid rgba(0,0,0,0.25)",
        boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
        borderRadius: "4px",
        position: "relative"
      },
      body: {
        padding: "15px 9px 9px 15px"
      },
      label: {
        fontSize: "18px",
        color: "#fff"
      },
      triangle: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 9px 10px 9px",
        borderColor: "transparent transparent #fff transparent",
        position: "absolute"
      },
      triangleShadow: {
        width: "0px",
        height: "0px",
        borderStyle: "solid",
        borderWidth: "0 9px 10px 9px",
        borderColor: "transparent transparent rgba(0,0,0,.1) transparent",
        position: "absolute"
      },
      hash: {
        background: "#F0F0F0",
        height: "30px",
        width: "30px",
        borderRadius: "4px 0 0 4px",
        float: "left",
        color: "#98A1A4",
        display: "flex",
        alignItems: "center",
        justifyContent: "center"
      },
      input: {
        width: "100px",
        fontSize: "14px",
        color: "#666",
        border: "0px",
        outline: "none",
        height: "28px",
        boxShadow: "inset 0 0 0 1px #F0F0F0",
        boxSizing: "content-box",
        borderRadius: "0 4px 4px 0",
        float: "left",
        paddingLeft: "8px"
      },
      swatch: {
        width: "30px",
        height: "30px",
        float: "left",
        borderRadius: "4px",
        margin: "0 6px 6px 0"
      },
      clear: {
        clear: "both"
      }
    },
    "hide-triangle": {
      triangle: {
        display: "none"
      },
      triangleShadow: {
        display: "none"
      }
    },
    "top-left-triangle": {
      triangle: {
        top: "-10px",
        left: "12px"
      },
      triangleShadow: {
        top: "-11px",
        left: "12px"
      }
    },
    "top-right-triangle": {
      triangle: {
        top: "-10px",
        right: "12px"
      },
      triangleShadow: {
        top: "-11px",
        right: "12px"
      }
    }
  }, passedStyles), {
    "hide-triangle": triangle === "hide",
    "top-left-triangle": triangle === "top-left",
    "top-right-triangle": triangle === "top-right"
  });
  var handleChange = function handleChange2(hexcode, e2) {
    isValidHex(hexcode) && onChange({
      hex: hexcode,
      source: "hex"
    }, e2);
  };
  return React$6.createElement(
    "div",
    { style: styles2.card, className: "twitter-picker " + className },
    React$6.createElement("div", { style: styles2.triangleShadow }),
    React$6.createElement("div", { style: styles2.triangle }),
    React$6.createElement(
      "div",
      { style: styles2.body },
      map$3(colors2, function(c2, i2) {
        return React$6.createElement(Swatch$1, {
          key: i2,
          color: c2,
          hex: c2,
          style: styles2.swatch,
          onClick: handleChange,
          onHover: onSwatchHover,
          focusStyle: {
            boxShadow: "0 0 4px " + c2
          }
        });
      }),
      React$6.createElement(
        "div",
        { style: styles2.hash },
        "#"
      ),
      React$6.createElement(EditableInput, {
        label: null,
        style: { input: styles2.input },
        value: hex3.replace("#", ""),
        onChange: handleChange
      }),
      React$6.createElement("div", { style: styles2.clear })
    )
  );
};
Twitter.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  triangle: PropTypes$4.oneOf(["hide", "top-left", "top-right"]),
  colors: PropTypes$4.arrayOf(PropTypes$4.string),
  styles: PropTypes$4.object
};
Twitter.defaultProps = {
  width: 276,
  colors: ["#FF6900", "#FCB900", "#7BDCB5", "#00D084", "#8ED1FC", "#0693E3", "#ABB8C3", "#EB144C", "#F78DA7", "#9900EF"],
  triangle: "top-left",
  styles: {}
};
ColorWrap(Twitter);
var GooglePointerCircle = function GooglePointerCircle2(props) {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "20px",
        height: "20px",
        borderRadius: "22px",
        border: "2px #fff solid",
        transform: "translate(-12px, -13px)",
        background: "hsl(" + Math.round(props.hsl.h) + ", " + Math.round(props.hsl.s * 100) + "%, " + Math.round(props.hsl.l * 100) + "%)"
      }
    }
  });
  return React$6.createElement("div", { style: styles2.picker });
};
GooglePointerCircle.propTypes = {
  hsl: PropTypes$4.shape({
    h: PropTypes$4.number,
    s: PropTypes$4.number,
    l: PropTypes$4.number,
    a: PropTypes$4.number
  })
};
GooglePointerCircle.defaultProps = {
  hsl: { a: 1, h: 249.94, l: 0.2, s: 0.5 }
};
var GooglePointer = function GooglePointer2(props) {
  var styles2 = _default$4({
    "default": {
      picker: {
        width: "20px",
        height: "20px",
        borderRadius: "22px",
        transform: "translate(-10px, -7px)",
        background: "hsl(" + Math.round(props.hsl.h) + ", 100%, 50%)",
        border: "2px white solid"
      }
    }
  });
  return React$6.createElement("div", { style: styles2.picker });
};
GooglePointer.propTypes = {
  hsl: PropTypes$4.shape({
    h: PropTypes$4.number,
    s: PropTypes$4.number,
    l: PropTypes$4.number,
    a: PropTypes$4.number
  })
};
GooglePointer.defaultProps = {
  hsl: { a: 1, h: 249.94, l: 0.2, s: 0.5 }
};
var GoogleFields = function GoogleFields2(_ref) {
  var onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hex3 = _ref.hex, hsv = _ref.hsv;
  var handleChange = function handleChange2(data, e2) {
    if (data.hex) {
      isValidHex(data.hex) && onChange({
        hex: data.hex,
        source: "hex"
      }, e2);
    } else if (data.rgb) {
      var values = data.rgb.split(",");
      isvalidColorString(data.rgb, "rgb") && onChange({
        r: values[0],
        g: values[1],
        b: values[2],
        a: 1,
        source: "rgb"
      }, e2);
    } else if (data.hsv) {
      var _values = data.hsv.split(",");
      if (isvalidColorString(data.hsv, "hsv")) {
        _values[2] = _values[2].replace("%", "");
        _values[1] = _values[1].replace("%", "");
        _values[0] = _values[0].replace("°", "");
        if (_values[1] == 1) {
          _values[1] = 0.01;
        } else if (_values[2] == 1) {
          _values[2] = 0.01;
        }
        onChange({
          h: Number(_values[0]),
          s: Number(_values[1]),
          v: Number(_values[2]),
          source: "hsv"
        }, e2);
      }
    } else if (data.hsl) {
      var _values2 = data.hsl.split(",");
      if (isvalidColorString(data.hsl, "hsl")) {
        _values2[2] = _values2[2].replace("%", "");
        _values2[1] = _values2[1].replace("%", "");
        _values2[0] = _values2[0].replace("°", "");
        if (hsvValue[1] == 1) {
          hsvValue[1] = 0.01;
        } else if (hsvValue[2] == 1) {
          hsvValue[2] = 0.01;
        }
        onChange({
          h: Number(_values2[0]),
          s: Number(_values2[1]),
          v: Number(_values2[2]),
          source: "hsl"
        }, e2);
      }
    }
  };
  var styles2 = _default$4({
    "default": {
      wrap: {
        display: "flex",
        height: "100px",
        marginTop: "4px"
      },
      fields: {
        width: "100%"
      },
      column: {
        paddingTop: "10px",
        display: "flex",
        justifyContent: "space-between"
      },
      double: {
        padding: "0px 4.4px",
        boxSizing: "border-box"
      },
      input: {
        width: "100%",
        height: "38px",
        boxSizing: "border-box",
        padding: "4px 10% 3px",
        textAlign: "center",
        border: "1px solid #dadce0",
        fontSize: "11px",
        textTransform: "lowercase",
        borderRadius: "5px",
        outline: "none",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      input2: {
        height: "38px",
        width: "100%",
        border: "1px solid #dadce0",
        boxSizing: "border-box",
        fontSize: "11px",
        textTransform: "lowercase",
        borderRadius: "5px",
        outline: "none",
        paddingLeft: "10px",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      label: {
        textAlign: "center",
        fontSize: "12px",
        background: "#fff",
        position: "absolute",
        textTransform: "uppercase",
        color: "#3c4043",
        width: "35px",
        top: "-6px",
        left: "0",
        right: "0",
        marginLeft: "auto",
        marginRight: "auto",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      label2: {
        left: "10px",
        textAlign: "center",
        fontSize: "12px",
        background: "#fff",
        position: "absolute",
        textTransform: "uppercase",
        color: "#3c4043",
        width: "32px",
        top: "-6px",
        fontFamily: "Roboto,Arial,sans-serif"
      },
      single: {
        flexGrow: "1",
        margin: "0px 4.4px"
      }
    }
  });
  var rgbValue = rgb.r + ", " + rgb.g + ", " + rgb.b;
  var hslValue = Math.round(hsl.h) + "°, " + Math.round(hsl.s * 100) + "%, " + Math.round(hsl.l * 100) + "%";
  var hsvValue = Math.round(hsv.h) + "°, " + Math.round(hsv.s * 100) + "%, " + Math.round(hsv.v * 100) + "%";
  return React$6.createElement(
    "div",
    { style: styles2.wrap, className: "flexbox-fix" },
    React$6.createElement(
      "div",
      { style: styles2.fields },
      React$6.createElement(
        "div",
        { style: styles2.double },
        React$6.createElement(EditableInput, {
          style: { input: styles2.input, label: styles2.label },
          label: "hex",
          value: hex3,
          onChange: handleChange
        })
      ),
      React$6.createElement(
        "div",
        { style: styles2.column },
        React$6.createElement(
          "div",
          { style: styles2.single },
          React$6.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "rgb",
            value: rgbValue,
            onChange: handleChange
          })
        ),
        React$6.createElement(
          "div",
          { style: styles2.single },
          React$6.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "hsv",
            value: hsvValue,
            onChange: handleChange
          })
        ),
        React$6.createElement(
          "div",
          { style: styles2.single },
          React$6.createElement(EditableInput, {
            style: { input: styles2.input2, label: styles2.label2 },
            label: "hsl",
            value: hslValue,
            onChange: handleChange
          })
        )
      )
    )
  );
};
var Google = function Google2(_ref) {
  var width = _ref.width, onChange = _ref.onChange, rgb = _ref.rgb, hsl = _ref.hsl, hsv = _ref.hsv, hex3 = _ref.hex, header = _ref.header, _ref$styles = _ref.styles, passedStyles = _ref$styles === void 0 ? {} : _ref$styles, _ref$className = _ref.className, className = _ref$className === void 0 ? "" : _ref$className;
  var styles2 = _default$4(merge$3({
    "default": {
      picker: {
        width,
        background: "#fff",
        border: "1px solid #dfe1e5",
        boxSizing: "initial",
        display: "flex",
        flexWrap: "wrap",
        borderRadius: "8px 8px 0px 0px"
      },
      head: {
        height: "57px",
        width: "100%",
        paddingTop: "16px",
        paddingBottom: "16px",
        paddingLeft: "16px",
        fontSize: "20px",
        boxSizing: "border-box",
        fontFamily: "Roboto-Regular,HelveticaNeue,Arial,sans-serif"
      },
      saturation: {
        width: "70%",
        padding: "0px",
        position: "relative",
        overflow: "hidden"
      },
      swatch: {
        width: "30%",
        height: "228px",
        padding: "0px",
        background: "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", 1)",
        position: "relative",
        overflow: "hidden"
      },
      body: {
        margin: "auto",
        width: "95%"
      },
      controls: {
        display: "flex",
        boxSizing: "border-box",
        height: "52px",
        paddingTop: "22px"
      },
      color: {
        width: "32px"
      },
      hue: {
        height: "8px",
        position: "relative",
        margin: "0px 16px 0px 16px",
        width: "100%"
      },
      Hue: {
        radius: "2px"
      }
    }
  }, passedStyles));
  return React$6.createElement(
    "div",
    { style: styles2.picker, className: "google-picker " + className },
    React$6.createElement(
      "div",
      { style: styles2.head },
      header
    ),
    React$6.createElement("div", { style: styles2.swatch }),
    React$6.createElement(
      "div",
      { style: styles2.saturation },
      React$6.createElement(Saturation, {
        hsl,
        hsv,
        pointer: GooglePointerCircle,
        onChange
      })
    ),
    React$6.createElement(
      "div",
      { style: styles2.body },
      React$6.createElement(
        "div",
        { style: styles2.controls, className: "flexbox-fix" },
        React$6.createElement(
          "div",
          { style: styles2.hue },
          React$6.createElement(Hue, {
            style: styles2.Hue,
            hsl,
            radius: "4px",
            pointer: GooglePointer,
            onChange
          })
        )
      ),
      React$6.createElement(GoogleFields, {
        rgb,
        hsl,
        hex: hex3,
        hsv,
        onChange
      })
    )
  );
};
Google.propTypes = {
  width: PropTypes$4.oneOfType([PropTypes$4.string, PropTypes$4.number]),
  styles: PropTypes$4.object,
  header: PropTypes$4.string
};
Google.defaultProps = {
  width: 652,
  styles: {},
  header: "Color picker"
};
ColorWrap(Google);
function buildColorValueString(color2) {
  const strColor = color2;
  if (strColor) {
    return strColor;
  }
  const rgbColor = color2;
  if (rgbColor) {
    return `rgba(${rgbColor.r},${rgbColor.g},${rgbColor.b},${rgbColor.a})`;
  }
  const hslColor = color2;
  if (hslColor) {
    return `hsla(${hslColor.h},${hslColor.s}%,${hslColor.l}%,${hslColor.a})`;
  }
  return "";
}
const ColorPicker$1 = ({ trigger, ...props }) => {
  const [panelVisible, setPanelVisible] = React$6.useState(false);
  const [color2, setColor] = reactExports.useState(props.defaultColor ?? props.color);
  reactExports.useEffect(() => {
    setColor(props.color);
  }, [props.color]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      closeMode: ["mask", "esc"],
      trigger: trigger ?? /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: "inline-block rounded cursor-pointer border border-gray-300 p-0.5 text-center",
          onClick: () => {
            setPanelVisible(true);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "p-2",
              style: {
                backgroundColor: color2 ? buildColorValueString(color2) : "var(--bakaui-color)"
              }
            }
          )
        }
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        SketchPicker,
        {
          color: color2,
          onChange: (v2) => {
            var _a2, _b2, _c2;
            if (v2.hex) {
              setColor(v2.hex);
              (_a2 = props.onChange) == null ? void 0 : _a2.call(props, v2.hex);
            } else {
              if (v2.rgb) {
                setColor(v2.rgb);
                (_b2 = props.onChange) == null ? void 0 : _b2.call(props, v2.rgb);
              } else {
                if (v2.hsl) {
                  setColor(v2.hsl);
                  (_c2 = props.onChange) == null ? void 0 : _c2.call(props, v2.hsl);
                }
              }
            }
          }
        }
      )
    }
  );
};
const Tabs = reactExports.forwardRef(
  ({ children, ...props }, ref) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(tabs_default, { ref, ...props, children });
  }
);
const Tab = tab_item_base_default;
function ownKeys$b(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$c(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$b(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$b(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var consoleLogger = {
  type: "logger",
  log: function log(args) {
    this.output("log", args);
  },
  warn: function warn(args) {
    this.output("warn", args);
  },
  error: function error(args) {
    this.output("error", args);
  },
  output: function output(type4, args) {
    if (console && console[type4])
      console[type4].apply(console, args);
  }
};
var Logger = function() {
  function Logger2(concreteLogger) {
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, Logger2);
    this.init(concreteLogger, options);
  }
  _createClass$8(Logger2, [{
    key: "init",
    value: function init2(concreteLogger) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      this.prefix = options.prefix || "i18next:";
      this.logger = concreteLogger || consoleLogger;
      this.options = options;
      this.debug = options.debug;
    }
  }, {
    key: "setDebug",
    value: function setDebug(bool) {
      this.debug = bool;
    }
  }, {
    key: "log",
    value: function log3() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return this.forward(args, "log", "", true);
    }
  }, {
    key: "warn",
    value: function warn3() {
      for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }
      return this.forward(args, "warn", "", true);
    }
  }, {
    key: "error",
    value: function error2() {
      for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        args[_key3] = arguments[_key3];
      }
      return this.forward(args, "error", "");
    }
  }, {
    key: "deprecate",
    value: function deprecate2() {
      for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
        args[_key4] = arguments[_key4];
      }
      return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
    }
  }, {
    key: "forward",
    value: function forward(args, lvl, prefix, debugOnly) {
      if (debugOnly && !this.debug)
        return null;
      if (typeof args[0] === "string")
        args[0] = "".concat(prefix).concat(this.prefix, " ").concat(args[0]);
      return this.logger[lvl](args);
    }
  }, {
    key: "create",
    value: function create2(moduleName) {
      return new Logger2(this.logger, _objectSpread$c(_objectSpread$c({}, {
        prefix: "".concat(this.prefix, ":").concat(moduleName, ":")
      }), this.options));
    }
  }, {
    key: "clone",
    value: function clone3(options) {
      options = options || this.options;
      options.prefix = options.prefix || this.prefix;
      return new Logger2(this.logger, options);
    }
  }]);
  return Logger2;
}();
var baseLogger = new Logger();
var EventEmitter = function() {
  function EventEmitter2() {
    _classCallCheck$a(this, EventEmitter2);
    this.observers = {};
  }
  _createClass$8(EventEmitter2, [{
    key: "on",
    value: function on2(events2, listener) {
      var _this = this;
      events2.split(" ").forEach(function(event) {
        _this.observers[event] = _this.observers[event] || [];
        _this.observers[event].push(listener);
      });
      return this;
    }
  }, {
    key: "off",
    value: function off(event, listener) {
      if (!this.observers[event])
        return;
      if (!listener) {
        delete this.observers[event];
        return;
      }
      this.observers[event] = this.observers[event].filter(function(l2) {
        return l2 !== listener;
      });
    }
  }, {
    key: "emit",
    value: function emit(event) {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }
      if (this.observers[event]) {
        var cloned = [].concat(this.observers[event]);
        cloned.forEach(function(observer) {
          observer.apply(void 0, args);
        });
      }
      if (this.observers["*"]) {
        var _cloned = [].concat(this.observers["*"]);
        _cloned.forEach(function(observer) {
          observer.apply(observer, [event].concat(args));
        });
      }
    }
  }]);
  return EventEmitter2;
}();
function defer() {
  var res;
  var rej;
  var promise = new Promise(function(resolve2, reject) {
    res = resolve2;
    rej = reject;
  });
  promise.resolve = res;
  promise.reject = rej;
  return promise;
}
function makeString(object4) {
  if (object4 == null)
    return "";
  return "" + object4;
}
function copy$1(a2, s2, t2) {
  a2.forEach(function(m2) {
    if (s2[m2])
      t2[m2] = s2[m2];
  });
}
function getLastOfPath(object4, path, Empty2) {
  function cleanKey(key2) {
    return key2 && key2.indexOf("###") > -1 ? key2.replace(/###/g, ".") : key2;
  }
  function canNotTraverseDeeper() {
    return !object4 || typeof object4 === "string";
  }
  var stack = typeof path !== "string" ? [].concat(path) : path.split(".");
  while (stack.length > 1) {
    if (canNotTraverseDeeper())
      return {};
    var key = cleanKey(stack.shift());
    if (!object4[key] && Empty2)
      object4[key] = new Empty2();
    if (Object.prototype.hasOwnProperty.call(object4, key)) {
      object4 = object4[key];
    } else {
      object4 = {};
    }
  }
  if (canNotTraverseDeeper())
    return {};
  return {
    obj: object4,
    k: cleanKey(stack.shift())
  };
}
function setPath(object4, path, newValue) {
  var _getLastOfPath = getLastOfPath(object4, path, Object), obj = _getLastOfPath.obj, k2 = _getLastOfPath.k;
  obj[k2] = newValue;
}
function pushPath(object4, path, newValue, concat) {
  var _getLastOfPath2 = getLastOfPath(object4, path, Object), obj = _getLastOfPath2.obj, k2 = _getLastOfPath2.k;
  obj[k2] = obj[k2] || [];
  obj[k2].push(newValue);
}
function getPath(object4, path) {
  var _getLastOfPath3 = getLastOfPath(object4, path), obj = _getLastOfPath3.obj, k2 = _getLastOfPath3.k;
  if (!obj)
    return void 0;
  return obj[k2];
}
function getPathWithDefaults(data, defaultData2, key) {
  var value2 = getPath(data, key);
  if (value2 !== void 0) {
    return value2;
  }
  return getPath(defaultData2, key);
}
function deepExtend(target, source2, overwrite) {
  for (var prop in source2) {
    if (prop !== "__proto__" && prop !== "constructor") {
      if (prop in target) {
        if (typeof target[prop] === "string" || target[prop] instanceof String || typeof source2[prop] === "string" || source2[prop] instanceof String) {
          if (overwrite)
            target[prop] = source2[prop];
        } else {
          deepExtend(target[prop], source2[prop], overwrite);
        }
      } else {
        target[prop] = source2[prop];
      }
    }
  }
  return target;
}
function regexEscape$1(str) {
  return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
var _entityMap = {
  "&": "&amp;",
  "<": "&lt;",
  ">": "&gt;",
  '"': "&quot;",
  "'": "&#39;",
  "/": "&#x2F;"
};
function escape(data) {
  if (typeof data === "string") {
    return data.replace(/[&<>"'\/]/g, function(s2) {
      return _entityMap[s2];
    });
  }
  return data;
}
var isIE10 = typeof window !== "undefined" && window.navigator && typeof window.navigator.userAgentData === "undefined" && window.navigator.userAgent && window.navigator.userAgent.indexOf("MSIE") > -1;
var chars = [" ", ",", "?", "!", ";"];
function looksLikeObjectPath(key, nsSeparator, keySeparator) {
  nsSeparator = nsSeparator || "";
  keySeparator = keySeparator || "";
  var possibleChars = chars.filter(function(c2) {
    return nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0;
  });
  if (possibleChars.length === 0)
    return true;
  var r2 = new RegExp("(".concat(possibleChars.map(function(c2) {
    return c2 === "?" ? "\\?" : c2;
  }).join("|"), ")"));
  var matched = !r2.test(key);
  if (!matched) {
    var ki2 = key.indexOf(keySeparator);
    if (ki2 > 0 && !r2.test(key.substring(0, ki2))) {
      matched = true;
    }
  }
  return matched;
}
function ownKeys$1$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$1$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$1$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$1$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$f();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$f() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function deepFind(obj, path) {
  var keySeparator = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
  if (!obj)
    return void 0;
  if (obj[path])
    return obj[path];
  var paths = path.split(keySeparator);
  var current = obj;
  for (var i2 = 0; i2 < paths.length; ++i2) {
    if (!current)
      return void 0;
    if (typeof current[paths[i2]] === "string" && i2 + 1 < paths.length) {
      return void 0;
    }
    if (current[paths[i2]] === void 0) {
      var j2 = 2;
      var p2 = paths.slice(i2, i2 + j2).join(keySeparator);
      var mix2 = current[p2];
      while (mix2 === void 0 && paths.length > i2 + j2) {
        j2++;
        p2 = paths.slice(i2, i2 + j2).join(keySeparator);
        mix2 = current[p2];
      }
      if (mix2 === void 0)
        return void 0;
      if (mix2 === null)
        return null;
      if (path.endsWith(p2)) {
        if (typeof mix2 === "string")
          return mix2;
        if (p2 && typeof mix2[p2] === "string")
          return mix2[p2];
      }
      var joinedPath = paths.slice(i2 + j2).join(keySeparator);
      if (joinedPath)
        return deepFind(mix2, joinedPath, keySeparator);
      return void 0;
    }
    current = current[paths[i2]];
  }
  return current;
}
var ResourceStore = function(_EventEmitter) {
  _inherits$a(ResourceStore2, _EventEmitter);
  var _super = _createSuper(ResourceStore2);
  function ResourceStore2(data) {
    var _this;
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
      ns: ["translation"],
      defaultNS: "translation"
    };
    _classCallCheck$a(this, ResourceStore2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.data = data || {};
    _this.options = options;
    if (_this.options.keySeparator === void 0) {
      _this.options.keySeparator = ".";
    }
    if (_this.options.ignoreJSONStructure === void 0) {
      _this.options.ignoreJSONStructure = true;
    }
    return _this;
  }
  _createClass$8(ResourceStore2, [{
    key: "addNamespaces",
    value: function addNamespaces(ns) {
      if (this.options.ns.indexOf(ns) < 0) {
        this.options.ns.push(ns);
      }
    }
  }, {
    key: "removeNamespaces",
    value: function removeNamespaces(ns) {
      var index2 = this.options.ns.indexOf(ns);
      if (index2 > -1) {
        this.options.ns.splice(index2, 1);
      }
    }
  }, {
    key: "getResource",
    value: function getResource(lng, ns, key) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
      var path = [lng, ns];
      if (key && typeof key !== "string")
        path = path.concat(key);
      if (key && typeof key === "string")
        path = path.concat(keySeparator ? key.split(keySeparator) : key);
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
      }
      var result = getPath(this.data, path);
      if (result || !ignoreJSONStructure || typeof key !== "string")
        return result;
      return deepFind(this.data && this.data[lng] && this.data[lng][ns], key, keySeparator);
    }
  }, {
    key: "addResource",
    value: function addResource(lng, ns, key, value2) {
      var options = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
        silent: false
      };
      var keySeparator = this.options.keySeparator;
      if (keySeparator === void 0)
        keySeparator = ".";
      var path = [lng, ns];
      if (key)
        path = path.concat(keySeparator ? key.split(keySeparator) : key);
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
        value2 = ns;
        ns = path[1];
      }
      this.addNamespaces(ns);
      setPath(this.data, path, value2);
      if (!options.silent)
        this.emit("added", lng, ns, key, value2);
    }
  }, {
    key: "addResources",
    value: function addResources(lng, ns, resources) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
        silent: false
      };
      for (var m2 in resources) {
        if (typeof resources[m2] === "string" || Object.prototype.toString.apply(resources[m2]) === "[object Array]")
          this.addResource(lng, ns, m2, resources[m2], {
            silent: true
          });
      }
      if (!options.silent)
        this.emit("added", lng, ns, resources);
    }
  }, {
    key: "addResourceBundle",
    value: function addResourceBundle(lng, ns, resources, deep, overwrite) {
      var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
        silent: false
      };
      var path = [lng, ns];
      if (lng.indexOf(".") > -1) {
        path = lng.split(".");
        deep = resources;
        resources = ns;
        ns = path[1];
      }
      this.addNamespaces(ns);
      var pack = getPath(this.data, path) || {};
      if (deep) {
        deepExtend(pack, resources, overwrite);
      } else {
        pack = _objectSpread$1$1(_objectSpread$1$1({}, pack), resources);
      }
      setPath(this.data, path, pack);
      if (!options.silent)
        this.emit("added", lng, ns, resources);
    }
  }, {
    key: "removeResourceBundle",
    value: function removeResourceBundle(lng, ns) {
      if (this.hasResourceBundle(lng, ns)) {
        delete this.data[lng][ns];
      }
      this.removeNamespaces(ns);
      this.emit("removed", lng, ns);
    }
  }, {
    key: "hasResourceBundle",
    value: function hasResourceBundle(lng, ns) {
      return this.getResource(lng, ns) !== void 0;
    }
  }, {
    key: "getResourceBundle",
    value: function getResourceBundle(lng, ns) {
      if (!ns)
        ns = this.options.defaultNS;
      if (this.options.compatibilityAPI === "v1")
        return _objectSpread$1$1(_objectSpread$1$1({}, {}), this.getResource(lng, ns));
      return this.getResource(lng, ns);
    }
  }, {
    key: "getDataByLanguage",
    value: function getDataByLanguage(lng) {
      return this.data[lng];
    }
  }, {
    key: "hasLanguageSomeTranslations",
    value: function hasLanguageSomeTranslations(lng) {
      var data = this.getDataByLanguage(lng);
      var n2 = data && Object.keys(data) || [];
      return !!n2.find(function(v2) {
        return data[v2] && Object.keys(data[v2]).length > 0;
      });
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      return this.data;
    }
  }]);
  return ResourceStore2;
}(EventEmitter);
var postProcessor = {
  processors: {},
  addPostProcessor: function addPostProcessor(module2) {
    this.processors[module2.name] = module2;
  },
  handle: function handle(processors, value2, key, options, translator) {
    var _this = this;
    processors.forEach(function(processor) {
      if (_this.processors[processor])
        value2 = _this.processors[processor].process(value2, key, options, translator);
    });
    return value2;
  }
};
function ownKeys$2$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$2$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$2$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$2$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$1(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$1$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$1$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
var checkedLoadedFor = {};
var Translator = function(_EventEmitter) {
  _inherits$a(Translator2, _EventEmitter);
  var _super = _createSuper$1(Translator2);
  function Translator2(services) {
    var _this;
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, Translator2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    copy$1(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, _assertThisInitialized(_this));
    _this.options = options;
    if (_this.options.keySeparator === void 0) {
      _this.options.keySeparator = ".";
    }
    _this.logger = baseLogger.create("translator");
    return _this;
  }
  _createClass$8(Translator2, [{
    key: "changeLanguage",
    value: function changeLanguage(lng) {
      if (lng)
        this.language = lng;
    }
  }, {
    key: "exists",
    value: function exists(key) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
        interpolation: {}
      };
      if (key === void 0 || key === null) {
        return false;
      }
      var resolved = this.resolve(key, options);
      return resolved && resolved.res !== void 0;
    }
  }, {
    key: "extractFromKey",
    value: function extractFromKey(key, options) {
      var nsSeparator = options.nsSeparator !== void 0 ? options.nsSeparator : this.options.nsSeparator;
      if (nsSeparator === void 0)
        nsSeparator = ":";
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var namespaces = options.ns || this.options.defaultNS || [];
      var wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
      var seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
      if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
        var m2 = key.match(this.interpolator.nestingRegexp);
        if (m2 && m2.length > 0) {
          return {
            key,
            namespaces
          };
        }
        var parts = key.split(nsSeparator);
        if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1)
          namespaces = parts.shift();
        key = parts.join(keySeparator);
      }
      if (typeof namespaces === "string")
        namespaces = [namespaces];
      return {
        key,
        namespaces
      };
    }
  }, {
    key: "translate",
    value: function translate(keys2, options, lastKey) {
      var _this2 = this;
      if (_typeof$2(options) !== "object" && this.options.overloadTranslationOptionHandler) {
        options = this.options.overloadTranslationOptionHandler(arguments);
      }
      if (!options)
        options = {};
      if (keys2 === void 0 || keys2 === null)
        return "";
      if (!Array.isArray(keys2))
        keys2 = [String(keys2)];
      var returnDetails = options.returnDetails !== void 0 ? options.returnDetails : this.options.returnDetails;
      var keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
      var _this$extractFromKey = this.extractFromKey(keys2[keys2.length - 1], options), key = _this$extractFromKey.key, namespaces = _this$extractFromKey.namespaces;
      var namespace = namespaces[namespaces.length - 1];
      var lng = options.lng || this.language;
      var appendNamespaceToCIMode = options.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
      if (lng && lng.toLowerCase() === "cimode") {
        if (appendNamespaceToCIMode) {
          var nsSeparator = options.nsSeparator || this.options.nsSeparator;
          if (returnDetails) {
            resolved.res = "".concat(namespace).concat(nsSeparator).concat(key);
            return resolved;
          }
          return "".concat(namespace).concat(nsSeparator).concat(key);
        }
        if (returnDetails) {
          resolved.res = key;
          return resolved;
        }
        return key;
      }
      var resolved = this.resolve(keys2, options);
      var res = resolved && resolved.res;
      var resUsedKey = resolved && resolved.usedKey || key;
      var resExactUsedKey = resolved && resolved.exactUsedKey || key;
      var resType = Object.prototype.toString.apply(res);
      var noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
      var joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
      var handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
      var handleAsObject = typeof res !== "string" && typeof res !== "boolean" && typeof res !== "number";
      if (handleAsObjectInI18nFormat && res && handleAsObject && noObject.indexOf(resType) < 0 && !(typeof joinArrays === "string" && resType === "[object Array]")) {
        if (!options.returnObjects && !this.options.returnObjects) {
          if (!this.options.returnedObjectHandler) {
            this.logger.warn("accessing an object - but returnObjects options is not enabled!");
          }
          var r2 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, res, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
            ns: namespaces
          })) : "key '".concat(key, " (").concat(this.language, ")' returned an object instead of string.");
          if (returnDetails) {
            resolved.res = r2;
            return resolved;
          }
          return r2;
        }
        if (keySeparator) {
          var resTypeIsArray = resType === "[object Array]";
          var copy2 = resTypeIsArray ? [] : {};
          var newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
          for (var m2 in res) {
            if (Object.prototype.hasOwnProperty.call(res, m2)) {
              var deepKey = "".concat(newKeyToUse).concat(keySeparator).concat(m2);
              copy2[m2] = this.translate(deepKey, _objectSpread$2$1(_objectSpread$2$1({}, options), {
                joinArrays: false,
                ns: namespaces
              }));
              if (copy2[m2] === deepKey)
                copy2[m2] = res[m2];
            }
          }
          res = copy2;
        }
      } else if (handleAsObjectInI18nFormat && typeof joinArrays === "string" && resType === "[object Array]") {
        res = res.join(joinArrays);
        if (res)
          res = this.extendTranslation(res, keys2, options, lastKey);
      } else {
        var usedDefault = false;
        var usedKey = false;
        var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string";
        var hasDefaultValue = Translator2.hasDefaultValue(options);
        var defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : "";
        var defaultValue2 = options["defaultValue".concat(defaultValueSuffix)] || options.defaultValue;
        if (!this.isValidLookup(res) && hasDefaultValue) {
          usedDefault = true;
          res = defaultValue2;
        }
        if (!this.isValidLookup(res)) {
          usedKey = true;
          res = key;
        }
        var missingKeyNoValueFallbackToKey = options.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
        var resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
        var updateMissing = hasDefaultValue && defaultValue2 !== res && this.options.updateMissing;
        if (usedKey || usedDefault || updateMissing) {
          this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue2 : res);
          if (keySeparator) {
            var fk2 = this.resolve(key, _objectSpread$2$1(_objectSpread$2$1({}, options), {}, {
              keySeparator: false
            }));
            if (fk2 && fk2.res)
              this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
          }
          var lngs = [];
          var fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
          if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
            for (var i2 = 0; i2 < fallbackLngs.length; i2++) {
              lngs.push(fallbackLngs[i2]);
            }
          } else if (this.options.saveMissingTo === "all") {
            lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
          } else {
            lngs.push(options.lng || this.language);
          }
          var send = function send2(l2, k2, specificDefaultValue) {
            var defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
            if (_this2.options.missingKeyHandler) {
              _this2.options.missingKeyHandler(l2, namespace, k2, defaultForMissing, updateMissing, options);
            } else if (_this2.backendConnector && _this2.backendConnector.saveMissing) {
              _this2.backendConnector.saveMissing(l2, namespace, k2, defaultForMissing, updateMissing, options);
            }
            _this2.emit("missingKey", l2, namespace, k2, res);
          };
          if (this.options.saveMissing) {
            if (this.options.saveMissingPlurals && needsPluralHandling) {
              lngs.forEach(function(language) {
                _this2.pluralResolver.getSuffixes(language, options).forEach(function(suffix) {
                  send([language], key + suffix, options["defaultValue".concat(suffix)] || defaultValue2);
                });
              });
            } else {
              send(lngs, key, defaultValue2);
            }
          }
        }
        res = this.extendTranslation(res, keys2, options, resolved, lastKey);
        if (usedKey && res === key && this.options.appendNamespaceToMissingKey)
          res = "".concat(namespace, ":").concat(key);
        if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
          if (this.options.compatibilityAPI !== "v1") {
            res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? "".concat(namespace, ":").concat(key) : key, usedDefault ? res : void 0);
          } else {
            res = this.options.parseMissingKeyHandler(res);
          }
        }
      }
      if (returnDetails) {
        resolved.res = res;
        return resolved;
      }
      return res;
    }
  }, {
    key: "extendTranslation",
    value: function extendTranslation(res, key, options, resolved, lastKey) {
      var _this3 = this;
      if (this.i18nFormat && this.i18nFormat.parse) {
        res = this.i18nFormat.parse(res, _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), options), resolved.usedLng, resolved.usedNS, resolved.usedKey, {
          resolved
        });
      } else if (!options.skipInterpolation) {
        if (options.interpolation)
          this.interpolator.init(_objectSpread$2$1(_objectSpread$2$1({}, options), {
            interpolation: _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation), options.interpolation)
          }));
        var skipOnVariables = typeof res === "string" && (options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
        var nestBef;
        if (skipOnVariables) {
          var nb2 = res.match(this.interpolator.nestingRegexp);
          nestBef = nb2 && nb2.length;
        }
        var data = options.replace && typeof options.replace !== "string" ? options.replace : options;
        if (this.options.interpolation.defaultVariables)
          data = _objectSpread$2$1(_objectSpread$2$1({}, this.options.interpolation.defaultVariables), data);
        res = this.interpolator.interpolate(res, data, options.lng || this.language, options);
        if (skipOnVariables) {
          var na2 = res.match(this.interpolator.nestingRegexp);
          var nestAft = na2 && na2.length;
          if (nestBef < nestAft)
            options.nest = false;
        }
        if (options.nest !== false)
          res = this.interpolator.nest(res, function() {
            for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
              args[_key] = arguments[_key];
            }
            if (lastKey && lastKey[0] === args[0] && !options.context) {
              _this3.logger.warn("It seems you are nesting recursively key: ".concat(args[0], " in key: ").concat(key[0]));
              return null;
            }
            return _this3.translate.apply(_this3, args.concat([key]));
          }, options);
        if (options.interpolation)
          this.interpolator.reset();
      }
      var postProcess = options.postProcess || this.options.postProcess;
      var postProcessorNames = typeof postProcess === "string" ? [postProcess] : postProcess;
      if (res !== void 0 && res !== null && postProcessorNames && postProcessorNames.length && options.applyPostProcessor !== false) {
        res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? _objectSpread$2$1({
          i18nResolved: resolved
        }, options) : options, this);
      }
      return res;
    }
  }, {
    key: "resolve",
    value: function resolve2(keys2) {
      var _this4 = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var found;
      var usedKey;
      var exactUsedKey;
      var usedLng;
      var usedNS;
      if (typeof keys2 === "string")
        keys2 = [keys2];
      keys2.forEach(function(k2) {
        if (_this4.isValidLookup(found))
          return;
        var extracted = _this4.extractFromKey(k2, options);
        var key = extracted.key;
        usedKey = key;
        var namespaces = extracted.namespaces;
        if (_this4.options.fallbackNS)
          namespaces = namespaces.concat(_this4.options.fallbackNS);
        var needsPluralHandling = options.count !== void 0 && typeof options.count !== "string";
        var needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0 && _this4.pluralResolver.shouldUseIntlApi();
        var needsContextHandling = options.context !== void 0 && (typeof options.context === "string" || typeof options.context === "number") && options.context !== "";
        var codes = options.lngs ? options.lngs : _this4.languageUtils.toResolveHierarchy(options.lng || _this4.language, options.fallbackLng);
        namespaces.forEach(function(ns) {
          if (_this4.isValidLookup(found))
            return;
          usedNS = ns;
          if (!checkedLoadedFor["".concat(codes[0], "-").concat(ns)] && _this4.utils && _this4.utils.hasLoadedNamespace && !_this4.utils.hasLoadedNamespace(usedNS)) {
            checkedLoadedFor["".concat(codes[0], "-").concat(ns)] = true;
            _this4.logger.warn('key "'.concat(usedKey, '" for languages "').concat(codes.join(", "), `" won't get resolved as namespace "`).concat(usedNS, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
          }
          codes.forEach(function(code2) {
            if (_this4.isValidLookup(found))
              return;
            usedLng = code2;
            var finalKeys = [key];
            if (_this4.i18nFormat && _this4.i18nFormat.addLookupKeys) {
              _this4.i18nFormat.addLookupKeys(finalKeys, key, code2, ns, options);
            } else {
              var pluralSuffix;
              if (needsPluralHandling)
                pluralSuffix = _this4.pluralResolver.getSuffix(code2, options.count, options);
              var zeroSuffix = "".concat(_this4.options.pluralSeparator, "zero");
              if (needsPluralHandling) {
                finalKeys.push(key + pluralSuffix);
                if (needsZeroSuffixLookup) {
                  finalKeys.push(key + zeroSuffix);
                }
              }
              if (needsContextHandling) {
                var contextKey = "".concat(key).concat(_this4.options.contextSeparator).concat(options.context);
                finalKeys.push(contextKey);
                if (needsPluralHandling) {
                  finalKeys.push(contextKey + pluralSuffix);
                  if (needsZeroSuffixLookup) {
                    finalKeys.push(contextKey + zeroSuffix);
                  }
                }
              }
            }
            var possibleKey;
            while (possibleKey = finalKeys.pop()) {
              if (!_this4.isValidLookup(found)) {
                exactUsedKey = possibleKey;
                found = _this4.getResource(code2, ns, possibleKey, options);
              }
            }
          });
        });
      });
      return {
        res: found,
        usedKey,
        exactUsedKey,
        usedLng,
        usedNS
      };
    }
  }, {
    key: "isValidLookup",
    value: function isValidLookup(res) {
      return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
    }
  }, {
    key: "getResource",
    value: function getResource(code2, ns, key) {
      var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
      if (this.i18nFormat && this.i18nFormat.getResource)
        return this.i18nFormat.getResource(code2, ns, key, options);
      return this.resourceStore.getResource(code2, ns, key, options);
    }
  }], [{
    key: "hasDefaultValue",
    value: function hasDefaultValue(options) {
      var prefix = "defaultValue";
      for (var option in options) {
        if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && void 0 !== options[option]) {
          return true;
        }
      }
      return false;
    }
  }]);
  return Translator2;
}(EventEmitter);
function capitalize$1(string3) {
  return string3.charAt(0).toUpperCase() + string3.slice(1);
}
var LanguageUtil = function() {
  function LanguageUtil2(options) {
    _classCallCheck$a(this, LanguageUtil2);
    this.options = options;
    this.supportedLngs = this.options.supportedLngs || false;
    this.logger = baseLogger.create("languageUtils");
  }
  _createClass$8(LanguageUtil2, [{
    key: "getScriptPartFromCode",
    value: function getScriptPartFromCode(code2) {
      if (!code2 || code2.indexOf("-") < 0)
        return null;
      var p2 = code2.split("-");
      if (p2.length === 2)
        return null;
      p2.pop();
      if (p2[p2.length - 1].toLowerCase() === "x")
        return null;
      return this.formatLanguageCode(p2.join("-"));
    }
  }, {
    key: "getLanguagePartFromCode",
    value: function getLanguagePartFromCode(code2) {
      if (!code2 || code2.indexOf("-") < 0)
        return code2;
      var p2 = code2.split("-");
      return this.formatLanguageCode(p2[0]);
    }
  }, {
    key: "formatLanguageCode",
    value: function formatLanguageCode(code2) {
      if (typeof code2 === "string" && code2.indexOf("-") > -1) {
        var specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
        var p2 = code2.split("-");
        if (this.options.lowerCaseLng) {
          p2 = p2.map(function(part) {
            return part.toLowerCase();
          });
        } else if (p2.length === 2) {
          p2[0] = p2[0].toLowerCase();
          p2[1] = p2[1].toUpperCase();
          if (specialCases.indexOf(p2[1].toLowerCase()) > -1)
            p2[1] = capitalize$1(p2[1].toLowerCase());
        } else if (p2.length === 3) {
          p2[0] = p2[0].toLowerCase();
          if (p2[1].length === 2)
            p2[1] = p2[1].toUpperCase();
          if (p2[0] !== "sgn" && p2[2].length === 2)
            p2[2] = p2[2].toUpperCase();
          if (specialCases.indexOf(p2[1].toLowerCase()) > -1)
            p2[1] = capitalize$1(p2[1].toLowerCase());
          if (specialCases.indexOf(p2[2].toLowerCase()) > -1)
            p2[2] = capitalize$1(p2[2].toLowerCase());
        }
        return p2.join("-");
      }
      return this.options.cleanCode || this.options.lowerCaseLng ? code2.toLowerCase() : code2;
    }
  }, {
    key: "isSupportedCode",
    value: function isSupportedCode(code2) {
      if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
        code2 = this.getLanguagePartFromCode(code2);
      }
      return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code2) > -1;
    }
  }, {
    key: "getBestMatchFromCodes",
    value: function getBestMatchFromCodes(codes) {
      var _this = this;
      if (!codes)
        return null;
      var found;
      codes.forEach(function(code2) {
        if (found)
          return;
        var cleanedLng = _this.formatLanguageCode(code2);
        if (!_this.options.supportedLngs || _this.isSupportedCode(cleanedLng))
          found = cleanedLng;
      });
      if (!found && this.options.supportedLngs) {
        codes.forEach(function(code2) {
          if (found)
            return;
          var lngOnly = _this.getLanguagePartFromCode(code2);
          if (_this.isSupportedCode(lngOnly))
            return found = lngOnly;
          found = _this.options.supportedLngs.find(function(supportedLng) {
            if (supportedLng.indexOf(lngOnly) === 0)
              return supportedLng;
          });
        });
      }
      if (!found)
        found = this.getFallbackCodes(this.options.fallbackLng)[0];
      return found;
    }
  }, {
    key: "getFallbackCodes",
    value: function getFallbackCodes(fallbacks, code2) {
      if (!fallbacks)
        return [];
      if (typeof fallbacks === "function")
        fallbacks = fallbacks(code2);
      if (typeof fallbacks === "string")
        fallbacks = [fallbacks];
      if (Object.prototype.toString.apply(fallbacks) === "[object Array]")
        return fallbacks;
      if (!code2)
        return fallbacks["default"] || [];
      var found = fallbacks[code2];
      if (!found)
        found = fallbacks[this.getScriptPartFromCode(code2)];
      if (!found)
        found = fallbacks[this.formatLanguageCode(code2)];
      if (!found)
        found = fallbacks[this.getLanguagePartFromCode(code2)];
      if (!found)
        found = fallbacks["default"];
      return found || [];
    }
  }, {
    key: "toResolveHierarchy",
    value: function toResolveHierarchy(code2, fallbackCode) {
      var _this2 = this;
      var fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code2);
      var codes = [];
      var addCode = function addCode2(c2) {
        if (!c2)
          return;
        if (_this2.isSupportedCode(c2)) {
          codes.push(c2);
        } else {
          _this2.logger.warn("rejecting language code not found in supportedLngs: ".concat(c2));
        }
      };
      if (typeof code2 === "string" && code2.indexOf("-") > -1) {
        if (this.options.load !== "languageOnly")
          addCode(this.formatLanguageCode(code2));
        if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly")
          addCode(this.getScriptPartFromCode(code2));
        if (this.options.load !== "currentOnly")
          addCode(this.getLanguagePartFromCode(code2));
      } else if (typeof code2 === "string") {
        addCode(this.formatLanguageCode(code2));
      }
      fallbackCodes.forEach(function(fc2) {
        if (codes.indexOf(fc2) < 0)
          addCode(_this2.formatLanguageCode(fc2));
      });
      return codes;
    }
  }]);
  return LanguageUtil2;
}();
var sets = [{
  lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
  nr: [1, 2],
  fc: 1
}, {
  lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
  nr: [1, 2],
  fc: 2
}, {
  lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
  nr: [1],
  fc: 3
}, {
  lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
  nr: [1, 2, 5],
  fc: 4
}, {
  lngs: ["ar"],
  nr: [0, 1, 2, 3, 11, 100],
  fc: 5
}, {
  lngs: ["cs", "sk"],
  nr: [1, 2, 5],
  fc: 6
}, {
  lngs: ["csb", "pl"],
  nr: [1, 2, 5],
  fc: 7
}, {
  lngs: ["cy"],
  nr: [1, 2, 3, 8],
  fc: 8
}, {
  lngs: ["fr"],
  nr: [1, 2],
  fc: 9
}, {
  lngs: ["ga"],
  nr: [1, 2, 3, 7, 11],
  fc: 10
}, {
  lngs: ["gd"],
  nr: [1, 2, 3, 20],
  fc: 11
}, {
  lngs: ["is"],
  nr: [1, 2],
  fc: 12
}, {
  lngs: ["jv"],
  nr: [0, 1],
  fc: 13
}, {
  lngs: ["kw"],
  nr: [1, 2, 3, 4],
  fc: 14
}, {
  lngs: ["lt"],
  nr: [1, 2, 10],
  fc: 15
}, {
  lngs: ["lv"],
  nr: [1, 2, 0],
  fc: 16
}, {
  lngs: ["mk"],
  nr: [1, 2],
  fc: 17
}, {
  lngs: ["mnk"],
  nr: [0, 1, 2],
  fc: 18
}, {
  lngs: ["mt"],
  nr: [1, 2, 11, 20],
  fc: 19
}, {
  lngs: ["or"],
  nr: [2, 1],
  fc: 2
}, {
  lngs: ["ro"],
  nr: [1, 2, 20],
  fc: 20
}, {
  lngs: ["sl"],
  nr: [5, 1, 2, 3],
  fc: 21
}, {
  lngs: ["he", "iw"],
  nr: [1, 2, 20, 21],
  fc: 22
}];
var _rulesPluralsTypes = {
  1: function _(n2) {
    return Number(n2 > 1);
  },
  2: function _2(n2) {
    return Number(n2 != 1);
  },
  3: function _3(n2) {
    return 0;
  },
  4: function _4(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  5: function _5(n2) {
    return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : n2 == 2 ? 2 : n2 % 100 >= 3 && n2 % 100 <= 10 ? 3 : n2 % 100 >= 11 ? 4 : 5);
  },
  6: function _6(n2) {
    return Number(n2 == 1 ? 0 : n2 >= 2 && n2 <= 4 ? 1 : 2);
  },
  7: function _7(n2) {
    return Number(n2 == 1 ? 0 : n2 % 10 >= 2 && n2 % 10 <= 4 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  8: function _8(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 != 8 && n2 != 11 ? 2 : 3);
  },
  9: function _9(n2) {
    return Number(n2 >= 2);
  },
  10: function _10(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 < 7 ? 2 : n2 < 11 ? 3 : 4);
  },
  11: function _11(n2) {
    return Number(n2 == 1 || n2 == 11 ? 0 : n2 == 2 || n2 == 12 ? 1 : n2 > 2 && n2 < 20 ? 2 : 3);
  },
  12: function _12(n2) {
    return Number(n2 % 10 != 1 || n2 % 100 == 11);
  },
  13: function _13(n2) {
    return Number(n2 !== 0);
  },
  14: function _14(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : n2 == 3 ? 2 : 3);
  },
  15: function _15(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 % 10 >= 2 && (n2 % 100 < 10 || n2 % 100 >= 20) ? 1 : 2);
  },
  16: function _16(n2) {
    return Number(n2 % 10 == 1 && n2 % 100 != 11 ? 0 : n2 !== 0 ? 1 : 2);
  },
  17: function _17(n2) {
    return Number(n2 == 1 || n2 % 10 == 1 && n2 % 100 != 11 ? 0 : 1);
  },
  18: function _18(n2) {
    return Number(n2 == 0 ? 0 : n2 == 1 ? 1 : 2);
  },
  19: function _19(n2) {
    return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 1 && n2 % 100 < 11 ? 1 : n2 % 100 > 10 && n2 % 100 < 20 ? 2 : 3);
  },
  20: function _20(n2) {
    return Number(n2 == 1 ? 0 : n2 == 0 || n2 % 100 > 0 && n2 % 100 < 20 ? 1 : 2);
  },
  21: function _21(n2) {
    return Number(n2 % 100 == 1 ? 1 : n2 % 100 == 2 ? 2 : n2 % 100 == 3 || n2 % 100 == 4 ? 3 : 0);
  },
  22: function _22(n2) {
    return Number(n2 == 1 ? 0 : n2 == 2 ? 1 : (n2 < 0 || n2 > 10) && n2 % 10 == 0 ? 2 : 3);
  }
};
var deprecatedJsonVersions = ["v1", "v2", "v3"];
var suffixesOrder = {
  zero: 0,
  one: 1,
  two: 2,
  few: 3,
  many: 4,
  other: 5
};
function createRules() {
  var rules2 = {};
  sets.forEach(function(set2) {
    set2.lngs.forEach(function(l2) {
      rules2[l2] = {
        numbers: set2.nr,
        plurals: _rulesPluralsTypes[set2.fc]
      };
    });
  });
  return rules2;
}
var PluralResolver = function() {
  function PluralResolver2(languageUtils) {
    var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    _classCallCheck$a(this, PluralResolver2);
    this.languageUtils = languageUtils;
    this.options = options;
    this.logger = baseLogger.create("pluralResolver");
    if ((!this.options.compatibilityJSON || this.options.compatibilityJSON === "v4") && (typeof Intl === "undefined" || !Intl.PluralRules)) {
      this.options.compatibilityJSON = "v3";
      this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.");
    }
    this.rules = createRules();
  }
  _createClass$8(PluralResolver2, [{
    key: "addRule",
    value: function addRule(lng, obj) {
      this.rules[lng] = obj;
    }
  }, {
    key: "getRule",
    value: function getRule(code2) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      if (this.shouldUseIntlApi()) {
        try {
          return new Intl.PluralRules(code2, {
            type: options.ordinal ? "ordinal" : "cardinal"
          });
        } catch (_unused) {
          return;
        }
      }
      return this.rules[code2] || this.rules[this.languageUtils.getLanguagePartFromCode(code2)];
    }
  }, {
    key: "needsPlural",
    value: function needsPlural(code2) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var rule = this.getRule(code2, options);
      if (this.shouldUseIntlApi()) {
        return rule && rule.resolvedOptions().pluralCategories.length > 1;
      }
      return rule && rule.numbers.length > 1;
    }
  }, {
    key: "getPluralFormsOfKey",
    value: function getPluralFormsOfKey(code2, key) {
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      return this.getSuffixes(code2, options).map(function(suffix) {
        return "".concat(key).concat(suffix);
      });
    }
  }, {
    key: "getSuffixes",
    value: function getSuffixes(code2) {
      var _this = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var rule = this.getRule(code2, options);
      if (!rule) {
        return [];
      }
      if (this.shouldUseIntlApi()) {
        return rule.resolvedOptions().pluralCategories.sort(function(pluralCategory1, pluralCategory2) {
          return suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2];
        }).map(function(pluralCategory) {
          return "".concat(_this.options.prepend).concat(pluralCategory);
        });
      }
      return rule.numbers.map(function(number4) {
        return _this.getSuffix(code2, number4, options);
      });
    }
  }, {
    key: "getSuffix",
    value: function getSuffix(code2, count) {
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var rule = this.getRule(code2, options);
      if (rule) {
        if (this.shouldUseIntlApi()) {
          return "".concat(this.options.prepend).concat(rule.select(count));
        }
        return this.getSuffixRetroCompatible(rule, count);
      }
      this.logger.warn("no plural rule found for: ".concat(code2));
      return "";
    }
  }, {
    key: "getSuffixRetroCompatible",
    value: function getSuffixRetroCompatible(rule, count) {
      var _this2 = this;
      var idx = rule.noAbs ? rule.plurals(count) : rule.plurals(Math.abs(count));
      var suffix = rule.numbers[idx];
      if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
        if (suffix === 2) {
          suffix = "plural";
        } else if (suffix === 1) {
          suffix = "";
        }
      }
      var returnSuffix = function returnSuffix2() {
        return _this2.options.prepend && suffix.toString() ? _this2.options.prepend + suffix.toString() : suffix.toString();
      };
      if (this.options.compatibilityJSON === "v1") {
        if (suffix === 1)
          return "";
        if (typeof suffix === "number")
          return "_plural_".concat(suffix.toString());
        return returnSuffix();
      } else if (this.options.compatibilityJSON === "v2") {
        return returnSuffix();
      } else if (this.options.simplifyPluralSuffix && rule.numbers.length === 2 && rule.numbers[0] === 1) {
        return returnSuffix();
      }
      return this.options.prepend && idx.toString() ? this.options.prepend + idx.toString() : idx.toString();
    }
  }, {
    key: "shouldUseIntlApi",
    value: function shouldUseIntlApi() {
      return !deprecatedJsonVersions.includes(this.options.compatibilityJSON);
    }
  }]);
  return PluralResolver2;
}();
function ownKeys$3$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$3$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$3$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$3$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
var Interpolator = function() {
  function Interpolator2() {
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, Interpolator2);
    this.logger = baseLogger.create("interpolator");
    this.options = options;
    this.format = options.interpolation && options.interpolation.format || function(value2) {
      return value2;
    };
    this.init(options);
  }
  _createClass$8(Interpolator2, [{
    key: "init",
    value: function init2() {
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      if (!options.interpolation)
        options.interpolation = {
          escapeValue: true
        };
      var iOpts = options.interpolation;
      this.escape = iOpts.escape !== void 0 ? iOpts.escape : escape;
      this.escapeValue = iOpts.escapeValue !== void 0 ? iOpts.escapeValue : true;
      this.useRawValueToEscape = iOpts.useRawValueToEscape !== void 0 ? iOpts.useRawValueToEscape : false;
      this.prefix = iOpts.prefix ? regexEscape$1(iOpts.prefix) : iOpts.prefixEscaped || "{{";
      this.suffix = iOpts.suffix ? regexEscape$1(iOpts.suffix) : iOpts.suffixEscaped || "}}";
      this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ",";
      this.unescapePrefix = iOpts.unescapeSuffix ? "" : iOpts.unescapePrefix || "-";
      this.unescapeSuffix = this.unescapePrefix ? "" : iOpts.unescapeSuffix || "";
      this.nestingPrefix = iOpts.nestingPrefix ? regexEscape$1(iOpts.nestingPrefix) : iOpts.nestingPrefixEscaped || regexEscape$1("$t(");
      this.nestingSuffix = iOpts.nestingSuffix ? regexEscape$1(iOpts.nestingSuffix) : iOpts.nestingSuffixEscaped || regexEscape$1(")");
      this.nestingOptionsSeparator = iOpts.nestingOptionsSeparator ? iOpts.nestingOptionsSeparator : iOpts.nestingOptionsSeparator || ",";
      this.maxReplaces = iOpts.maxReplaces ? iOpts.maxReplaces : 1e3;
      this.alwaysFormat = iOpts.alwaysFormat !== void 0 ? iOpts.alwaysFormat : false;
      this.resetRegExp();
    }
  }, {
    key: "reset",
    value: function reset() {
      if (this.options)
        this.init(this.options);
    }
  }, {
    key: "resetRegExp",
    value: function resetRegExp() {
      var regexpStr = "".concat(this.prefix, "(.+?)").concat(this.suffix);
      this.regexp = new RegExp(regexpStr, "g");
      var regexpUnescapeStr = "".concat(this.prefix).concat(this.unescapePrefix, "(.+?)").concat(this.unescapeSuffix).concat(this.suffix);
      this.regexpUnescape = new RegExp(regexpUnescapeStr, "g");
      var nestingRegexpStr = "".concat(this.nestingPrefix, "(.+?)").concat(this.nestingSuffix);
      this.nestingRegexp = new RegExp(nestingRegexpStr, "g");
    }
  }, {
    key: "interpolate",
    value: function interpolate2(str, data, lng, options) {
      var _this = this;
      var match5;
      var value2;
      var replaces;
      var defaultData2 = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
      function regexSafe(val) {
        return val.replace(/\$/g, "$$$$");
      }
      var handleFormat = function handleFormat2(key) {
        if (key.indexOf(_this.formatSeparator) < 0) {
          var path = getPathWithDefaults(data, defaultData2, key);
          return _this.alwaysFormat ? _this.format(path, void 0, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
            interpolationkey: key
          })) : path;
        }
        var p2 = key.split(_this.formatSeparator);
        var k2 = p2.shift().trim();
        var f2 = p2.join(_this.formatSeparator).trim();
        return _this.format(getPathWithDefaults(data, defaultData2, k2), f2, lng, _objectSpread$3$1(_objectSpread$3$1(_objectSpread$3$1({}, options), data), {}, {
          interpolationkey: k2
        }));
      };
      this.resetRegExp();
      var missingInterpolationHandler = options && options.missingInterpolationHandler || this.options.missingInterpolationHandler;
      var skipOnVariables = options && options.interpolation && options.interpolation.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
      var todos = [{
        regex: this.regexpUnescape,
        safeValue: function safeValue(val) {
          return regexSafe(val);
        }
      }, {
        regex: this.regexp,
        safeValue: function safeValue(val) {
          return _this.escapeValue ? regexSafe(_this.escape(val)) : regexSafe(val);
        }
      }];
      todos.forEach(function(todo) {
        replaces = 0;
        while (match5 = todo.regex.exec(str)) {
          var matchedVar = match5[1].trim();
          value2 = handleFormat(matchedVar);
          if (value2 === void 0) {
            if (typeof missingInterpolationHandler === "function") {
              var temp = missingInterpolationHandler(str, match5, options);
              value2 = typeof temp === "string" ? temp : "";
            } else if (options && options.hasOwnProperty(matchedVar)) {
              value2 = "";
            } else if (skipOnVariables) {
              value2 = match5[0];
              continue;
            } else {
              _this.logger.warn("missed to pass in variable ".concat(matchedVar, " for interpolating ").concat(str));
              value2 = "";
            }
          } else if (typeof value2 !== "string" && !_this.useRawValueToEscape) {
            value2 = makeString(value2);
          }
          var safeValue = todo.safeValue(value2);
          str = str.replace(match5[0], safeValue);
          if (skipOnVariables) {
            todo.regex.lastIndex += value2.length;
            todo.regex.lastIndex -= match5[0].length;
          } else {
            todo.regex.lastIndex = 0;
          }
          replaces++;
          if (replaces >= _this.maxReplaces) {
            break;
          }
        }
      });
      return str;
    }
  }, {
    key: "nest",
    value: function nest(str, fc2) {
      var _this2 = this;
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var match5;
      var value2;
      var clonedOptions = _objectSpread$3$1({}, options);
      clonedOptions.applyPostProcessor = false;
      delete clonedOptions.defaultValue;
      function handleHasOptions(key, inheritedOptions) {
        var sep = this.nestingOptionsSeparator;
        if (key.indexOf(sep) < 0)
          return key;
        var c2 = key.split(new RegExp("".concat(sep, "[ ]*{")));
        var optionsString = "{".concat(c2[1]);
        key = c2[0];
        optionsString = this.interpolate(optionsString, clonedOptions);
        var matchedSingleQuotes = optionsString.match(/'/g);
        var matchedDoubleQuotes = optionsString.match(/"/g);
        if (matchedSingleQuotes && matchedSingleQuotes.length % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
          optionsString = optionsString.replace(/'/g, '"');
        }
        try {
          clonedOptions = JSON.parse(optionsString);
          if (inheritedOptions)
            clonedOptions = _objectSpread$3$1(_objectSpread$3$1({}, inheritedOptions), clonedOptions);
        } catch (e2) {
          this.logger.warn("failed parsing options string in nesting for key ".concat(key), e2);
          return "".concat(key).concat(sep).concat(optionsString);
        }
        delete clonedOptions.defaultValue;
        return key;
      }
      while (match5 = this.nestingRegexp.exec(str)) {
        var formatters2 = [];
        var doReduce = false;
        if (match5[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match5[1])) {
          var r2 = match5[1].split(this.formatSeparator).map(function(elem) {
            return elem.trim();
          });
          match5[1] = r2.shift();
          formatters2 = r2;
          doReduce = true;
        }
        value2 = fc2(handleHasOptions.call(this, match5[1].trim(), clonedOptions), clonedOptions);
        if (value2 && match5[0] === str && typeof value2 !== "string")
          return value2;
        if (typeof value2 !== "string")
          value2 = makeString(value2);
        if (!value2) {
          this.logger.warn("missed to resolve ".concat(match5[1], " for nesting ").concat(str));
          value2 = "";
        }
        if (doReduce) {
          value2 = formatters2.reduce(function(v2, f2) {
            return _this2.format(v2, f2, options.lng, _objectSpread$3$1(_objectSpread$3$1({}, options), {}, {
              interpolationkey: match5[1].trim()
            }));
          }, value2.trim());
        }
        str = str.replace(match5[0], value2);
        this.regexp.lastIndex = 0;
      }
      return str;
    }
  }]);
  return Interpolator2;
}();
function ownKeys$4$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$4$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$4$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$4$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function parseFormatStr(formatStr) {
  var formatName = formatStr.toLowerCase().trim();
  var formatOptions = {};
  if (formatStr.indexOf("(") > -1) {
    var p2 = formatStr.split("(");
    formatName = p2[0].toLowerCase().trim();
    var optStr = p2[1].substring(0, p2[1].length - 1);
    if (formatName === "currency" && optStr.indexOf(":") < 0) {
      if (!formatOptions.currency)
        formatOptions.currency = optStr.trim();
    } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
      if (!formatOptions.range)
        formatOptions.range = optStr.trim();
    } else {
      var opts2 = optStr.split(";");
      opts2.forEach(function(opt) {
        if (!opt)
          return;
        var _opt$split = opt.split(":"), _opt$split2 = _toArray(_opt$split), key = _opt$split2[0], rest = _opt$split2.slice(1);
        var val = rest.join(":").trim().replace(/^'+|'+$/g, "");
        if (!formatOptions[key.trim()])
          formatOptions[key.trim()] = val;
        if (val === "false")
          formatOptions[key.trim()] = false;
        if (val === "true")
          formatOptions[key.trim()] = true;
        if (!isNaN(val))
          formatOptions[key.trim()] = parseInt(val, 10);
      });
    }
  }
  return {
    formatName,
    formatOptions
  };
}
function createCachedFormatter(fn) {
  var cache2 = {};
  return function invokeFormatter(val, lng, options) {
    var key = lng + JSON.stringify(options);
    var formatter = cache2[key];
    if (!formatter) {
      formatter = fn(lng, options);
      cache2[key] = formatter;
    }
    return formatter(val);
  };
}
var Formatter = function() {
  function Formatter2() {
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, Formatter2);
    this.logger = baseLogger.create("formatter");
    this.options = options;
    this.formats = {
      number: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.NumberFormat(lng, options2);
        return function(val) {
          return formatter.format(val);
        };
      }),
      currency: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.NumberFormat(lng, _objectSpread$4$1(_objectSpread$4$1({}, options2), {}, {
          style: "currency"
        }));
        return function(val) {
          return formatter.format(val);
        };
      }),
      datetime: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.DateTimeFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val);
        };
      }),
      relativetime: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.RelativeTimeFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val, options2.range || "day");
        };
      }),
      list: createCachedFormatter(function(lng, options2) {
        var formatter = new Intl.ListFormat(lng, _objectSpread$4$1({}, options2));
        return function(val) {
          return formatter.format(val);
        };
      })
    };
    this.init(options);
  }
  _createClass$8(Formatter2, [{
    key: "init",
    value: function init2(services) {
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
        interpolation: {}
      };
      var iOpts = options.interpolation;
      this.formatSeparator = iOpts.formatSeparator ? iOpts.formatSeparator : iOpts.formatSeparator || ",";
    }
  }, {
    key: "add",
    value: function add2(name2, fc2) {
      this.formats[name2.toLowerCase().trim()] = fc2;
    }
  }, {
    key: "addCached",
    value: function addCached(name2, fc2) {
      this.formats[name2.toLowerCase().trim()] = createCachedFormatter(fc2);
    }
  }, {
    key: "format",
    value: function format2(value2, _format, lng, options) {
      var _this = this;
      var formats = _format.split(this.formatSeparator);
      var result = formats.reduce(function(mem, f2) {
        var _parseFormatStr = parseFormatStr(f2), formatName = _parseFormatStr.formatName, formatOptions = _parseFormatStr.formatOptions;
        if (_this.formats[formatName]) {
          var formatted = mem;
          try {
            var valOptions = options && options.formatParams && options.formatParams[options.interpolationkey] || {};
            var l2 = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
            formatted = _this.formats[formatName](mem, l2, _objectSpread$4$1(_objectSpread$4$1(_objectSpread$4$1({}, formatOptions), options), valOptions));
          } catch (error2) {
            _this.logger.warn(error2);
          }
          return formatted;
        } else {
          _this.logger.warn("there was no format function for ".concat(formatName));
        }
        return mem;
      }, value2);
      return result;
    }
  }]);
  return Formatter2;
}();
function ownKeys$5$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$5$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$5$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$5$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$2(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$2$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$2$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function removePending(q2, name2) {
  if (q2.pending[name2] !== void 0) {
    delete q2.pending[name2];
    q2.pendingCount--;
  }
}
var Connector = function(_EventEmitter) {
  _inherits$a(Connector2, _EventEmitter);
  var _super = _createSuper$2(Connector2);
  function Connector2(backend, store, services) {
    var _this;
    var options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    _classCallCheck$a(this, Connector2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.backend = backend;
    _this.store = store;
    _this.services = services;
    _this.languageUtils = services.languageUtils;
    _this.options = options;
    _this.logger = baseLogger.create("backendConnector");
    _this.waitingReads = [];
    _this.maxParallelReads = options.maxParallelReads || 10;
    _this.readingCalls = 0;
    _this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
    _this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
    _this.state = {};
    _this.queue = [];
    if (_this.backend && _this.backend.init) {
      _this.backend.init(services, options.backend, options);
    }
    return _this;
  }
  _createClass$8(Connector2, [{
    key: "queueLoad",
    value: function queueLoad(languages, namespaces, options, callback2) {
      var _this2 = this;
      var toLoad = {};
      var pending = {};
      var toLoadLanguages = {};
      var toLoadNamespaces = {};
      languages.forEach(function(lng) {
        var hasAllNamespaces = true;
        namespaces.forEach(function(ns) {
          var name2 = "".concat(lng, "|").concat(ns);
          if (!options.reload && _this2.store.hasResourceBundle(lng, ns)) {
            _this2.state[name2] = 2;
          } else if (_this2.state[name2] < 0)
            ;
          else if (_this2.state[name2] === 1) {
            if (pending[name2] === void 0)
              pending[name2] = true;
          } else {
            _this2.state[name2] = 1;
            hasAllNamespaces = false;
            if (pending[name2] === void 0)
              pending[name2] = true;
            if (toLoad[name2] === void 0)
              toLoad[name2] = true;
            if (toLoadNamespaces[ns] === void 0)
              toLoadNamespaces[ns] = true;
          }
        });
        if (!hasAllNamespaces)
          toLoadLanguages[lng] = true;
      });
      if (Object.keys(toLoad).length || Object.keys(pending).length) {
        this.queue.push({
          pending,
          pendingCount: Object.keys(pending).length,
          loaded: {},
          errors: [],
          callback: callback2
        });
      }
      return {
        toLoad: Object.keys(toLoad),
        pending: Object.keys(pending),
        toLoadLanguages: Object.keys(toLoadLanguages),
        toLoadNamespaces: Object.keys(toLoadNamespaces)
      };
    }
  }, {
    key: "loaded",
    value: function loaded(name2, err, data) {
      var s2 = name2.split("|");
      var lng = s2[0];
      var ns = s2[1];
      if (err)
        this.emit("failedLoading", lng, ns, err);
      if (data) {
        this.store.addResourceBundle(lng, ns, data);
      }
      this.state[name2] = err ? -1 : 2;
      var loaded2 = {};
      this.queue.forEach(function(q2) {
        pushPath(q2.loaded, [lng], ns);
        removePending(q2, name2);
        if (err)
          q2.errors.push(err);
        if (q2.pendingCount === 0 && !q2.done) {
          Object.keys(q2.loaded).forEach(function(l2) {
            if (!loaded2[l2])
              loaded2[l2] = {};
            var loadedKeys = q2.loaded[l2];
            if (loadedKeys.length) {
              loadedKeys.forEach(function(ns2) {
                if (loaded2[l2][ns2] === void 0)
                  loaded2[l2][ns2] = true;
              });
            }
          });
          q2.done = true;
          if (q2.errors.length) {
            q2.callback(q2.errors);
          } else {
            q2.callback();
          }
        }
      });
      this.emit("loaded", loaded2);
      this.queue = this.queue.filter(function(q2) {
        return !q2.done;
      });
    }
  }, {
    key: "read",
    value: function read(lng, ns, fcName) {
      var _this3 = this;
      var tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
      var wait = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout;
      var callback2 = arguments.length > 5 ? arguments[5] : void 0;
      if (!lng.length)
        return callback2(null, {});
      if (this.readingCalls >= this.maxParallelReads) {
        this.waitingReads.push({
          lng,
          ns,
          fcName,
          tried,
          wait,
          callback: callback2
        });
        return;
      }
      this.readingCalls++;
      return this.backend[fcName](lng, ns, function(err, data) {
        _this3.readingCalls--;
        if (_this3.waitingReads.length > 0) {
          var next2 = _this3.waitingReads.shift();
          _this3.read(next2.lng, next2.ns, next2.fcName, next2.tried, next2.wait, next2.callback);
        }
        if (err && data && tried < _this3.maxRetries) {
          setTimeout(function() {
            _this3.read.call(_this3, lng, ns, fcName, tried + 1, wait * 2, callback2);
          }, wait);
          return;
        }
        callback2(err, data);
      });
    }
  }, {
    key: "prepareLoading",
    value: function prepareLoading(languages, namespaces) {
      var _this4 = this;
      var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
      var callback2 = arguments.length > 3 ? arguments[3] : void 0;
      if (!this.backend) {
        this.logger.warn("No backend was added via i18next.use. Will not load resources.");
        return callback2 && callback2();
      }
      if (typeof languages === "string")
        languages = this.languageUtils.toResolveHierarchy(languages);
      if (typeof namespaces === "string")
        namespaces = [namespaces];
      var toLoad = this.queueLoad(languages, namespaces, options, callback2);
      if (!toLoad.toLoad.length) {
        if (!toLoad.pending.length)
          callback2();
        return null;
      }
      toLoad.toLoad.forEach(function(name2) {
        _this4.loadOne(name2);
      });
    }
  }, {
    key: "load",
    value: function load(languages, namespaces, callback2) {
      this.prepareLoading(languages, namespaces, {}, callback2);
    }
  }, {
    key: "reload",
    value: function reload(languages, namespaces, callback2) {
      this.prepareLoading(languages, namespaces, {
        reload: true
      }, callback2);
    }
  }, {
    key: "loadOne",
    value: function loadOne(name2) {
      var _this5 = this;
      var prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
      var s2 = name2.split("|");
      var lng = s2[0];
      var ns = s2[1];
      this.read(lng, ns, "read", void 0, void 0, function(err, data) {
        if (err)
          _this5.logger.warn("".concat(prefix, "loading namespace ").concat(ns, " for language ").concat(lng, " failed"), err);
        if (!err && data)
          _this5.logger.log("".concat(prefix, "loaded namespace ").concat(ns, " for language ").concat(lng), data);
        _this5.loaded(name2, err, data);
      });
    }
  }, {
    key: "saveMissing",
    value: function saveMissing(languages, namespace, key, fallbackValue, isUpdate) {
      var options = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
      if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(namespace)) {
        this.logger.warn('did not save key "'.concat(key, '" as the namespace "').concat(namespace, '" was not yet loaded'), "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
        return;
      }
      if (key === void 0 || key === null || key === "")
        return;
      if (this.backend && this.backend.create) {
        this.backend.create(languages, namespace, key, fallbackValue, null, _objectSpread$5$1(_objectSpread$5$1({}, options), {}, {
          isUpdate
        }));
      }
      if (!languages || !languages[0])
        return;
      this.store.addResource(languages[0], namespace, key, fallbackValue);
    }
  }]);
  return Connector2;
}(EventEmitter);
function get$3() {
  return {
    debug: false,
    initImmediate: true,
    ns: ["translation"],
    defaultNS: ["translation"],
    fallbackLng: ["dev"],
    fallbackNS: false,
    supportedLngs: false,
    nonExplicitSupportedLngs: false,
    load: "all",
    preload: false,
    simplifyPluralSuffix: true,
    keySeparator: ".",
    nsSeparator: ":",
    pluralSeparator: "_",
    contextSeparator: "_",
    partialBundledLanguages: false,
    saveMissing: false,
    updateMissing: false,
    saveMissingTo: "fallback",
    saveMissingPlurals: true,
    missingKeyHandler: false,
    missingInterpolationHandler: false,
    postProcess: false,
    postProcessPassResolved: false,
    returnNull: true,
    returnEmptyString: true,
    returnObjects: false,
    joinArrays: false,
    returnedObjectHandler: false,
    parseMissingKeyHandler: false,
    appendNamespaceToMissingKey: false,
    appendNamespaceToCIMode: false,
    overloadTranslationOptionHandler: function handle2(args) {
      var ret = {};
      if (_typeof$2(args[1]) === "object")
        ret = args[1];
      if (typeof args[1] === "string")
        ret.defaultValue = args[1];
      if (typeof args[2] === "string")
        ret.tDescription = args[2];
      if (_typeof$2(args[2]) === "object" || _typeof$2(args[3]) === "object") {
        var options = args[3] || args[2];
        Object.keys(options).forEach(function(key) {
          ret[key] = options[key];
        });
      }
      return ret;
    },
    interpolation: {
      escapeValue: true,
      format: function format2(value2, _format, lng, options) {
        return value2;
      },
      prefix: "{{",
      suffix: "}}",
      formatSeparator: ",",
      unescapePrefix: "-",
      nestingPrefix: "$t(",
      nestingSuffix: ")",
      nestingOptionsSeparator: ",",
      maxReplaces: 1e3,
      skipOnVariables: true
    }
  };
}
function transformOptions(options) {
  if (typeof options.ns === "string")
    options.ns = [options.ns];
  if (typeof options.fallbackLng === "string")
    options.fallbackLng = [options.fallbackLng];
  if (typeof options.fallbackNS === "string")
    options.fallbackNS = [options.fallbackNS];
  if (options.supportedLngs && options.supportedLngs.indexOf("cimode") < 0) {
    options.supportedLngs = options.supportedLngs.concat(["cimode"]);
  }
  return options;
}
function ownKeys$6$1(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    if (enumerableOnly) {
      symbols = symbols.filter(function(sym) {
        return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
      });
    }
    keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$6$1(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = arguments[i2] != null ? arguments[i2] : {};
    if (i2 % 2) {
      ownKeys$6$1(Object(source2), true).forEach(function(key) {
        _defineProperty$4(target, key, source2[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2));
    } else {
      ownKeys$6$1(Object(source2)).forEach(function(key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
      });
    }
  }
  return target;
}
function _createSuper$3(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct$3$1();
  return function _createSuperInternal() {
    var Super = _getPrototypeOf(Derived), result;
    if (hasNativeReflectConstruct) {
      var NewTarget = _getPrototypeOf(this).constructor;
      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }
    return _possibleConstructorReturn$a(this, result);
  };
}
function _isNativeReflectConstruct$3$1() {
  if (typeof Reflect === "undefined" || !Reflect.construct)
    return false;
  if (Reflect.construct.sham)
    return false;
  if (typeof Proxy === "function")
    return true;
  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
    return true;
  } catch (e2) {
    return false;
  }
}
function noop$5() {
}
function bindMemberFunctions(inst) {
  var mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
  mems.forEach(function(mem) {
    if (typeof inst[mem] === "function") {
      inst[mem] = inst[mem].bind(inst);
    }
  });
}
var I18n = function(_EventEmitter) {
  _inherits$a(I18n2, _EventEmitter);
  var _super = _createSuper$3(I18n2);
  function I18n2() {
    var _this;
    var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    var callback2 = arguments.length > 1 ? arguments[1] : void 0;
    _classCallCheck$a(this, I18n2);
    _this = _super.call(this);
    if (isIE10) {
      EventEmitter.call(_assertThisInitialized(_this));
    }
    _this.options = transformOptions(options);
    _this.services = {};
    _this.logger = baseLogger;
    _this.modules = {
      external: []
    };
    bindMemberFunctions(_assertThisInitialized(_this));
    if (callback2 && !_this.isInitialized && !options.isClone) {
      if (!_this.options.initImmediate) {
        _this.init(options, callback2);
        return _possibleConstructorReturn$a(_this, _assertThisInitialized(_this));
      }
      setTimeout(function() {
        _this.init(options, callback2);
      }, 0);
    }
    return _this;
  }
  _createClass$8(I18n2, [{
    key: "init",
    value: function init2() {
      var _this2 = this;
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var callback2 = arguments.length > 1 ? arguments[1] : void 0;
      if (typeof options === "function") {
        callback2 = options;
        options = {};
      }
      if (!options.defaultNS && options.defaultNS !== false && options.ns) {
        if (typeof options.ns === "string") {
          options.defaultNS = options.ns;
        } else if (options.ns.indexOf("translation") < 0) {
          options.defaultNS = options.ns[0];
        }
      }
      var defOpts = get$3();
      this.options = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, defOpts), this.options), transformOptions(options));
      if (this.options.compatibilityAPI !== "v1") {
        this.options.interpolation = _objectSpread$6$1(_objectSpread$6$1({}, defOpts.interpolation), this.options.interpolation);
      }
      if (options.keySeparator !== void 0) {
        this.options.userDefinedKeySeparator = options.keySeparator;
      }
      if (options.nsSeparator !== void 0) {
        this.options.userDefinedNsSeparator = options.nsSeparator;
      }
      function createClassOnDemand(ClassOrObject) {
        if (!ClassOrObject)
          return null;
        if (typeof ClassOrObject === "function")
          return new ClassOrObject();
        return ClassOrObject;
      }
      if (!this.options.isClone) {
        if (this.modules.logger) {
          baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
        } else {
          baseLogger.init(null, this.options);
        }
        var formatter;
        if (this.modules.formatter) {
          formatter = this.modules.formatter;
        } else if (typeof Intl !== "undefined") {
          formatter = Formatter;
        }
        var lu = new LanguageUtil(this.options);
        this.store = new ResourceStore(this.options.resources, this.options);
        var s2 = this.services;
        s2.logger = baseLogger;
        s2.resourceStore = this.store;
        s2.languageUtils = lu;
        s2.pluralResolver = new PluralResolver(lu, {
          prepend: this.options.pluralSeparator,
          compatibilityJSON: this.options.compatibilityJSON,
          simplifyPluralSuffix: this.options.simplifyPluralSuffix
        });
        if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
          s2.formatter = createClassOnDemand(formatter);
          s2.formatter.init(s2, this.options);
          this.options.interpolation.format = s2.formatter.format.bind(s2.formatter);
        }
        s2.interpolator = new Interpolator(this.options);
        s2.utils = {
          hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
        };
        s2.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s2.resourceStore, s2, this.options);
        s2.backendConnector.on("*", function(event) {
          for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
            args[_key - 1] = arguments[_key];
          }
          _this2.emit.apply(_this2, [event].concat(args));
        });
        if (this.modules.languageDetector) {
          s2.languageDetector = createClassOnDemand(this.modules.languageDetector);
          s2.languageDetector.init(s2, this.options.detection, this.options);
        }
        if (this.modules.i18nFormat) {
          s2.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
          if (s2.i18nFormat.init)
            s2.i18nFormat.init(this);
        }
        this.translator = new Translator(this.services, this.options);
        this.translator.on("*", function(event) {
          for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
            args[_key2 - 1] = arguments[_key2];
          }
          _this2.emit.apply(_this2, [event].concat(args));
        });
        this.modules.external.forEach(function(m2) {
          if (m2.init)
            m2.init(_this2);
        });
      }
      this.format = this.options.interpolation.format;
      if (!callback2)
        callback2 = noop$5;
      if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
        var codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
        if (codes.length > 0 && codes[0] !== "dev")
          this.options.lng = codes[0];
      }
      if (!this.services.languageDetector && !this.options.lng) {
        this.logger.warn("init: no languageDetector is used and no lng is defined");
      }
      var storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
      storeApi.forEach(function(fcName) {
        _this2[fcName] = function() {
          var _this2$store;
          return (_this2$store = _this2.store)[fcName].apply(_this2$store, arguments);
        };
      });
      var storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
      storeApiChained.forEach(function(fcName) {
        _this2[fcName] = function() {
          var _this2$store2;
          (_this2$store2 = _this2.store)[fcName].apply(_this2$store2, arguments);
          return _this2;
        };
      });
      var deferred = defer();
      var load = function load2() {
        var finish = function finish2(err, t2) {
          if (_this2.isInitialized && !_this2.initializedStoreOnce)
            _this2.logger.warn("init: i18next is already initialized. You should call init just once!");
          _this2.isInitialized = true;
          if (!_this2.options.isClone)
            _this2.logger.log("initialized", _this2.options);
          _this2.emit("initialized", _this2.options);
          deferred.resolve(t2);
          callback2(err, t2);
        };
        if (_this2.languages && _this2.options.compatibilityAPI !== "v1" && !_this2.isInitialized)
          return finish(null, _this2.t.bind(_this2));
        _this2.changeLanguage(_this2.options.lng, finish);
      };
      if (this.options.resources || !this.options.initImmediate) {
        load();
      } else {
        setTimeout(load, 0);
      }
      return deferred;
    }
  }, {
    key: "loadResources",
    value: function loadResources(language) {
      var _this3 = this;
      var callback2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$5;
      var usedCallback = callback2;
      var usedLng = typeof language === "string" ? language : this.language;
      if (typeof language === "function")
        usedCallback = language;
      if (!this.options.resources || this.options.partialBundledLanguages) {
        if (usedLng && usedLng.toLowerCase() === "cimode")
          return usedCallback();
        var toLoad = [];
        var append3 = function append4(lng) {
          if (!lng)
            return;
          var lngs = _this3.services.languageUtils.toResolveHierarchy(lng);
          lngs.forEach(function(l2) {
            if (toLoad.indexOf(l2) < 0)
              toLoad.push(l2);
          });
        };
        if (!usedLng) {
          var fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
          fallbacks.forEach(function(l2) {
            return append3(l2);
          });
        } else {
          append3(usedLng);
        }
        if (this.options.preload) {
          this.options.preload.forEach(function(l2) {
            return append3(l2);
          });
        }
        this.services.backendConnector.load(toLoad, this.options.ns, function(e2) {
          if (!e2 && !_this3.resolvedLanguage && _this3.language)
            _this3.setResolvedLanguage(_this3.language);
          usedCallback(e2);
        });
      } else {
        usedCallback(null);
      }
    }
  }, {
    key: "reloadResources",
    value: function reloadResources(lngs, ns, callback2) {
      var deferred = defer();
      if (!lngs)
        lngs = this.languages;
      if (!ns)
        ns = this.options.ns;
      if (!callback2)
        callback2 = noop$5;
      this.services.backendConnector.reload(lngs, ns, function(err) {
        deferred.resolve();
        callback2(err);
      });
      return deferred;
    }
  }, {
    key: "use",
    value: function use(module2) {
      if (!module2)
        throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
      if (!module2.type)
        throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
      if (module2.type === "backend") {
        this.modules.backend = module2;
      }
      if (module2.type === "logger" || module2.log && module2.warn && module2.error) {
        this.modules.logger = module2;
      }
      if (module2.type === "languageDetector") {
        this.modules.languageDetector = module2;
      }
      if (module2.type === "i18nFormat") {
        this.modules.i18nFormat = module2;
      }
      if (module2.type === "postProcessor") {
        postProcessor.addPostProcessor(module2);
      }
      if (module2.type === "formatter") {
        this.modules.formatter = module2;
      }
      if (module2.type === "3rdParty") {
        this.modules.external.push(module2);
      }
      return this;
    }
  }, {
    key: "setResolvedLanguage",
    value: function setResolvedLanguage(l2) {
      if (!l2 || !this.languages)
        return;
      if (["cimode", "dev"].indexOf(l2) > -1)
        return;
      for (var li2 = 0; li2 < this.languages.length; li2++) {
        var lngInLngs = this.languages[li2];
        if (["cimode", "dev"].indexOf(lngInLngs) > -1)
          continue;
        if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
          this.resolvedLanguage = lngInLngs;
          break;
        }
      }
    }
  }, {
    key: "changeLanguage",
    value: function changeLanguage(lng, callback2) {
      var _this4 = this;
      this.isLanguageChangingTo = lng;
      var deferred = defer();
      this.emit("languageChanging", lng);
      var setLngProps = function setLngProps2(l2) {
        _this4.language = l2;
        _this4.languages = _this4.services.languageUtils.toResolveHierarchy(l2);
        _this4.resolvedLanguage = void 0;
        _this4.setResolvedLanguage(l2);
      };
      var done = function done2(err, l2) {
        if (l2) {
          setLngProps(l2);
          _this4.translator.changeLanguage(l2);
          _this4.isLanguageChangingTo = void 0;
          _this4.emit("languageChanged", l2);
          _this4.logger.log("languageChanged", l2);
        } else {
          _this4.isLanguageChangingTo = void 0;
        }
        deferred.resolve(function() {
          return _this4.t.apply(_this4, arguments);
        });
        if (callback2)
          callback2(err, function() {
            return _this4.t.apply(_this4, arguments);
          });
      };
      var setLng = function setLng2(lngs) {
        if (!lng && !lngs && _this4.services.languageDetector)
          lngs = [];
        var l2 = typeof lngs === "string" ? lngs : _this4.services.languageUtils.getBestMatchFromCodes(lngs);
        if (l2) {
          if (!_this4.language) {
            setLngProps(l2);
          }
          if (!_this4.translator.language)
            _this4.translator.changeLanguage(l2);
          if (_this4.services.languageDetector)
            _this4.services.languageDetector.cacheUserLanguage(l2);
        }
        _this4.loadResources(l2, function(err) {
          done(err, l2);
        });
      };
      if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
        setLng(this.services.languageDetector.detect());
      } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
        this.services.languageDetector.detect(setLng);
      } else {
        setLng(lng);
      }
      return deferred;
    }
  }, {
    key: "getFixedT",
    value: function getFixedT(lng, ns, keyPrefix) {
      var _this5 = this;
      var fixedT = function fixedT2(key, opts2) {
        var options;
        if (_typeof$2(opts2) !== "object") {
          for (var _len3 = arguments.length, rest = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
            rest[_key3 - 2] = arguments[_key3];
          }
          options = _this5.options.overloadTranslationOptionHandler([key, opts2].concat(rest));
        } else {
          options = _objectSpread$6$1({}, opts2);
        }
        options.lng = options.lng || fixedT2.lng;
        options.lngs = options.lngs || fixedT2.lngs;
        options.ns = options.ns || fixedT2.ns;
        options.keyPrefix = options.keyPrefix || keyPrefix || fixedT2.keyPrefix;
        var keySeparator = _this5.options.keySeparator || ".";
        var resultKey = options.keyPrefix ? "".concat(options.keyPrefix).concat(keySeparator).concat(key) : key;
        return _this5.t(resultKey, options);
      };
      if (typeof lng === "string") {
        fixedT.lng = lng;
      } else {
        fixedT.lngs = lng;
      }
      fixedT.ns = ns;
      fixedT.keyPrefix = keyPrefix;
      return fixedT;
    }
  }, {
    key: "t",
    value: function t2() {
      var _this$translator;
      return this.translator && (_this$translator = this.translator).translate.apply(_this$translator, arguments);
    }
  }, {
    key: "exists",
    value: function exists() {
      var _this$translator2;
      return this.translator && (_this$translator2 = this.translator).exists.apply(_this$translator2, arguments);
    }
  }, {
    key: "setDefaultNamespace",
    value: function setDefaultNamespace(ns) {
      this.options.defaultNS = ns;
    }
  }, {
    key: "hasLoadedNamespace",
    value: function hasLoadedNamespace2(ns) {
      var _this6 = this;
      var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      if (!this.isInitialized) {
        this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
        return false;
      }
      if (!this.languages || !this.languages.length) {
        this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
        return false;
      }
      var lng = this.resolvedLanguage || this.languages[0];
      var fallbackLng = this.options ? this.options.fallbackLng : false;
      var lastLng = this.languages[this.languages.length - 1];
      if (lng.toLowerCase() === "cimode")
        return true;
      var loadNotPending = function loadNotPending2(l2, n2) {
        var loadState = _this6.services.backendConnector.state["".concat(l2, "|").concat(n2)];
        return loadState === -1 || loadState === 2;
      };
      if (options.precheck) {
        var preResult = options.precheck(this, loadNotPending);
        if (preResult !== void 0)
          return preResult;
      }
      if (this.hasResourceBundle(lng, ns))
        return true;
      if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages)
        return true;
      if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
        return true;
      return false;
    }
  }, {
    key: "loadNamespaces",
    value: function loadNamespaces2(ns, callback2) {
      var _this7 = this;
      var deferred = defer();
      if (!this.options.ns) {
        callback2 && callback2();
        return Promise.resolve();
      }
      if (typeof ns === "string")
        ns = [ns];
      ns.forEach(function(n2) {
        if (_this7.options.ns.indexOf(n2) < 0)
          _this7.options.ns.push(n2);
      });
      this.loadResources(function(err) {
        deferred.resolve();
        if (callback2)
          callback2(err);
      });
      return deferred;
    }
  }, {
    key: "loadLanguages",
    value: function loadLanguages(lngs, callback2) {
      var deferred = defer();
      if (typeof lngs === "string")
        lngs = [lngs];
      var preloaded = this.options.preload || [];
      var newLngs = lngs.filter(function(lng) {
        return preloaded.indexOf(lng) < 0;
      });
      if (!newLngs.length) {
        if (callback2)
          callback2();
        return Promise.resolve();
      }
      this.options.preload = preloaded.concat(newLngs);
      this.loadResources(function(err) {
        deferred.resolve();
        if (callback2)
          callback2(err);
      });
      return deferred;
    }
  }, {
    key: "dir",
    value: function dir(lng) {
      if (!lng)
        lng = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language);
      if (!lng)
        return "rtl";
      var rtlLngs = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"];
      return rtlLngs.indexOf(this.services.languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
    }
  }, {
    key: "cloneInstance",
    value: function cloneInstance() {
      var _this8 = this;
      var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      var callback2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop$5;
      var mergedOptions = _objectSpread$6$1(_objectSpread$6$1(_objectSpread$6$1({}, this.options), options), {
        isClone: true
      });
      var clone3 = new I18n2(mergedOptions);
      if (options.debug !== void 0 || options.prefix !== void 0) {
        clone3.logger = clone3.logger.clone(options);
      }
      var membersToCopy = ["store", "services", "language"];
      membersToCopy.forEach(function(m2) {
        clone3[m2] = _this8[m2];
      });
      clone3.services = _objectSpread$6$1({}, this.services);
      clone3.services.utils = {
        hasLoadedNamespace: clone3.hasLoadedNamespace.bind(clone3)
      };
      clone3.translator = new Translator(clone3.services, clone3.options);
      clone3.translator.on("*", function(event) {
        for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
          args[_key4 - 1] = arguments[_key4];
        }
        clone3.emit.apply(clone3, [event].concat(args));
      });
      clone3.init(mergedOptions, callback2);
      clone3.translator.options = clone3.options;
      clone3.translator.backendConnector.services.utils = {
        hasLoadedNamespace: clone3.hasLoadedNamespace.bind(clone3)
      };
      return clone3;
    }
  }, {
    key: "toJSON",
    value: function toJSON3() {
      return {
        options: this.options,
        store: this.store,
        language: this.language,
        languages: this.languages,
        resolvedLanguage: this.resolvedLanguage
      };
    }
  }]);
  return I18n2;
}(EventEmitter);
_defineProperty$4(I18n, "createInstance", function() {
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
  var callback2 = arguments.length > 1 ? arguments[1] : void 0;
  return new I18n(options, callback2);
});
var instance = I18n.createInstance();
instance.createInstance = I18n.createInstance;
instance.createInstance;
instance.init;
instance.loadResources;
instance.reloadResources;
instance.use;
instance.changeLanguage;
instance.getFixedT;
instance.t;
instance.exists;
instance.setDefaultNamespace;
instance.hasLoadedNamespace;
instance.loadNamespaces;
instance.loadLanguages;
var uncPathRegex = function uncPathRegex2() {
  return /^[\\\/]{2,}[^\\\/]+[\\\/]+[^\\\/]+/;
};
var regex = uncPathRegex();
var isUncPath = function(filepath) {
  if (typeof filepath !== "string") {
    throw new TypeError("expected a string");
  }
  return regex.test(filepath);
};
const isUncPath$1 = /* @__PURE__ */ getDefaultExportFromCjs(isUncPath);
var reactIs$1 = { exports: {} };
var reactIs_production_min = {};
/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var b$1 = "function" === typeof Symbol && Symbol.for, c$3 = b$1 ? Symbol.for("react.element") : 60103, d$2 = b$1 ? Symbol.for("react.portal") : 60106, e$1 = b$1 ? Symbol.for("react.fragment") : 60107, f$3 = b$1 ? Symbol.for("react.strict_mode") : 60108, g$2 = b$1 ? Symbol.for("react.profiler") : 60114, h$2 = b$1 ? Symbol.for("react.provider") : 60109, k$3 = b$1 ? Symbol.for("react.context") : 60110, l$5 = b$1 ? Symbol.for("react.async_mode") : 60111, m$1 = b$1 ? Symbol.for("react.concurrent_mode") : 60111, n$3 = b$1 ? Symbol.for("react.forward_ref") : 60112, p$4 = b$1 ? Symbol.for("react.suspense") : 60113, q$1 = b$1 ? Symbol.for("react.suspense_list") : 60120, r$4 = b$1 ? Symbol.for("react.memo") : 60115, t$4 = b$1 ? Symbol.for("react.lazy") : 60116, v$2 = b$1 ? Symbol.for("react.block") : 60121, w$3 = b$1 ? Symbol.for("react.fundamental") : 60117, x$4 = b$1 ? Symbol.for("react.responder") : 60118, y$4 = b$1 ? Symbol.for("react.scope") : 60119;
function z$2(a2) {
  if ("object" === typeof a2 && null !== a2) {
    var u2 = a2.$$typeof;
    switch (u2) {
      case c$3:
        switch (a2 = a2.type, a2) {
          case l$5:
          case m$1:
          case e$1:
          case g$2:
          case f$3:
          case p$4:
            return a2;
          default:
            switch (a2 = a2 && a2.$$typeof, a2) {
              case k$3:
              case n$3:
              case t$4:
              case r$4:
              case h$2:
                return a2;
              default:
                return u2;
            }
        }
      case d$2:
        return u2;
    }
  }
}
function A$3(a2) {
  return z$2(a2) === m$1;
}
reactIs_production_min.AsyncMode = l$5;
reactIs_production_min.ConcurrentMode = m$1;
reactIs_production_min.ContextConsumer = k$3;
reactIs_production_min.ContextProvider = h$2;
reactIs_production_min.Element = c$3;
reactIs_production_min.ForwardRef = n$3;
reactIs_production_min.Fragment = e$1;
reactIs_production_min.Lazy = t$4;
reactIs_production_min.Memo = r$4;
reactIs_production_min.Portal = d$2;
reactIs_production_min.Profiler = g$2;
reactIs_production_min.StrictMode = f$3;
reactIs_production_min.Suspense = p$4;
reactIs_production_min.isAsyncMode = function(a2) {
  return A$3(a2) || z$2(a2) === l$5;
};
reactIs_production_min.isConcurrentMode = A$3;
reactIs_production_min.isContextConsumer = function(a2) {
  return z$2(a2) === k$3;
};
reactIs_production_min.isContextProvider = function(a2) {
  return z$2(a2) === h$2;
};
reactIs_production_min.isElement = function(a2) {
  return "object" === typeof a2 && null !== a2 && a2.$$typeof === c$3;
};
reactIs_production_min.isForwardRef = function(a2) {
  return z$2(a2) === n$3;
};
reactIs_production_min.isFragment = function(a2) {
  return z$2(a2) === e$1;
};
reactIs_production_min.isLazy = function(a2) {
  return z$2(a2) === t$4;
};
reactIs_production_min.isMemo = function(a2) {
  return z$2(a2) === r$4;
};
reactIs_production_min.isPortal = function(a2) {
  return z$2(a2) === d$2;
};
reactIs_production_min.isProfiler = function(a2) {
  return z$2(a2) === g$2;
};
reactIs_production_min.isStrictMode = function(a2) {
  return z$2(a2) === f$3;
};
reactIs_production_min.isSuspense = function(a2) {
  return z$2(a2) === p$4;
};
reactIs_production_min.isValidElementType = function(a2) {
  return "string" === typeof a2 || "function" === typeof a2 || a2 === e$1 || a2 === m$1 || a2 === g$2 || a2 === f$3 || a2 === p$4 || a2 === q$1 || "object" === typeof a2 && null !== a2 && (a2.$$typeof === t$4 || a2.$$typeof === r$4 || a2.$$typeof === h$2 || a2.$$typeof === k$3 || a2.$$typeof === n$3 || a2.$$typeof === w$3 || a2.$$typeof === x$4 || a2.$$typeof === y$4 || a2.$$typeof === v$2);
};
reactIs_production_min.typeOf = z$2;
{
  reactIs$1.exports = reactIs_production_min;
}
var reactIsExports = reactIs$1.exports;
var reactIs = reactIsExports;
var FORWARD_REF_STATICS = {
  "$$typeof": true,
  render: true,
  defaultProps: true,
  displayName: true,
  propTypes: true
};
var MEMO_STATICS = {
  "$$typeof": true,
  compare: true,
  defaultProps: true,
  displayName: true,
  propTypes: true,
  type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
var ansiStyles$1 = { exports: {} };
ansiStyles$1.exports;
(function(module2) {
  const wrapAnsi16 = (fn, offset2) => (...args) => {
    const code2 = fn(...args);
    return `\x1B[${code2 + offset2}m`;
  };
  const wrapAnsi256 = (fn, offset2) => (...args) => {
    const code2 = fn(...args);
    return `\x1B[${38 + offset2};5;${code2}m`;
  };
  const wrapAnsi16m = (fn, offset2) => (...args) => {
    const rgb = fn(...args);
    return `\x1B[${38 + offset2};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  };
  const ansi2ansi = (n2) => n2;
  const rgb2rgb = (r2, g2, b2) => [r2, g2, b2];
  const setLazyProperty = (object4, property2, get5) => {
    Object.defineProperty(object4, property2, {
      get: () => {
        const value2 = get5();
        Object.defineProperty(object4, property2, {
          value: value2,
          enumerable: true,
          configurable: true
        });
        return value2;
      },
      enumerable: true,
      configurable: true
    });
  };
  let colorConvert2;
  const makeDynamicStyles = (wrap2, targetSpace, identity2, isBackground) => {
    if (colorConvert2 === void 0) {
      colorConvert2 = requireColorConvert();
    }
    const offset2 = isBackground ? 10 : 0;
    const styles2 = {};
    for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
      const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
      if (sourceSpace === targetSpace) {
        styles2[name2] = wrap2(identity2, offset2);
      } else if (typeof suite === "object") {
        styles2[name2] = wrap2(suite[targetSpace], offset2);
      }
    }
    return styles2;
  };
  function assembleStyles() {
    const codes = /* @__PURE__ */ new Map();
    const styles2 = {
      modifier: {
        reset: [0, 0],
        // 21 isn't widely supported and 22 does the same thing
        bold: [1, 22],
        dim: [2, 22],
        italic: [3, 23],
        underline: [4, 24],
        inverse: [7, 27],
        hidden: [8, 28],
        strikethrough: [9, 29]
      },
      color: {
        black: [30, 39],
        red: [31, 39],
        green: [32, 39],
        yellow: [33, 39],
        blue: [34, 39],
        magenta: [35, 39],
        cyan: [36, 39],
        white: [37, 39],
        // Bright color
        blackBright: [90, 39],
        redBright: [91, 39],
        greenBright: [92, 39],
        yellowBright: [93, 39],
        blueBright: [94, 39],
        magentaBright: [95, 39],
        cyanBright: [96, 39],
        whiteBright: [97, 39]
      },
      bgColor: {
        bgBlack: [40, 49],
        bgRed: [41, 49],
        bgGreen: [42, 49],
        bgYellow: [43, 49],
        bgBlue: [44, 49],
        bgMagenta: [45, 49],
        bgCyan: [46, 49],
        bgWhite: [47, 49],
        // Bright color
        bgBlackBright: [100, 49],
        bgRedBright: [101, 49],
        bgGreenBright: [102, 49],
        bgYellowBright: [103, 49],
        bgBlueBright: [104, 49],
        bgMagentaBright: [105, 49],
        bgCyanBright: [106, 49],
        bgWhiteBright: [107, 49]
      }
    };
    styles2.color.gray = styles2.color.blackBright;
    styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
    styles2.color.grey = styles2.color.blackBright;
    styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
    for (const [groupName, group] of Object.entries(styles2)) {
      for (const [styleName, style2] of Object.entries(group)) {
        styles2[styleName] = {
          open: `\x1B[${style2[0]}m`,
          close: `\x1B[${style2[1]}m`
        };
        group[styleName] = styles2[styleName];
        codes.set(style2[0], style2[1]);
      }
      Object.defineProperty(styles2, groupName, {
        value: group,
        enumerable: false
      });
    }
    Object.defineProperty(styles2, "codes", {
      value: codes,
      enumerable: false
    });
    styles2.color.close = "\x1B[39m";
    styles2.bgColor.close = "\x1B[49m";
    setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
    setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
    setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
    setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
    setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
    setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
    return styles2;
  }
  Object.defineProperty(module2, "exports", {
    enumerable: true,
    get: assembleStyles
  });
})(ansiStyles$1);
var ansiStylesExports = ansiStyles$1.exports;
var browser$1 = {
  stdout: false,
  stderr: false
};
const stringReplaceAll$1 = (string3, substring, replacer) => {
  let index2 = string3.indexOf(substring);
  if (index2 === -1) {
    return string3;
  }
  const substringLength = substring.length;
  let endIndex = 0;
  let returnValue = "";
  do {
    returnValue += string3.substr(endIndex, index2 - endIndex) + substring + replacer;
    endIndex = index2 + substringLength;
    index2 = string3.indexOf(substring, endIndex);
  } while (index2 !== -1);
  returnValue += string3.substr(endIndex);
  return returnValue;
};
const stringEncaseCRLFWithFirstIndex$1 = (string3, prefix, postfix, index2) => {
  let endIndex = 0;
  let returnValue = "";
  do {
    const gotCR = string3[index2 - 1] === "\r";
    returnValue += string3.substr(endIndex, (gotCR ? index2 - 1 : index2) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
    endIndex = index2 + 1;
    index2 = string3.indexOf("\n", endIndex);
  } while (index2 !== -1);
  returnValue += string3.substr(endIndex);
  return returnValue;
};
var util$1 = {
  stringReplaceAll: stringReplaceAll$1,
  stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
};
var templates;
var hasRequiredTemplates;
function requireTemplates() {
  if (hasRequiredTemplates)
    return templates;
  hasRequiredTemplates = 1;
  const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
  const ESCAPES = /* @__PURE__ */ new Map([
    ["n", "\n"],
    ["r", "\r"],
    ["t", "	"],
    ["b", "\b"],
    ["f", "\f"],
    ["v", "\v"],
    ["0", "\0"],
    ["\\", "\\"],
    ["e", "\x1B"],
    ["a", "\x07"]
  ]);
  function unescape3(c2) {
    const u2 = c2[0] === "u";
    const bracket = c2[1] === "{";
    if (u2 && !bracket && c2.length === 5 || c2[0] === "x" && c2.length === 3) {
      return String.fromCharCode(parseInt(c2.slice(1), 16));
    }
    if (u2 && bracket) {
      return String.fromCodePoint(parseInt(c2.slice(2, -1), 16));
    }
    return ESCAPES.get(c2) || c2;
  }
  function parseArguments(name2, arguments_) {
    const results = [];
    const chunks = arguments_.trim().split(/\s*,\s*/g);
    let matches;
    for (const chunk of chunks) {
      const number4 = Number(chunk);
      if (!Number.isNaN(number4)) {
        results.push(number4);
      } else if (matches = chunk.match(STRING_REGEX)) {
        results.push(matches[2].replace(ESCAPE_REGEX, (m2, escape2, character2) => escape2 ? unescape3(escape2) : character2));
      } else {
        throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
      }
    }
    return results;
  }
  function parseStyle3(style2) {
    STYLE_REGEX.lastIndex = 0;
    const results = [];
    let matches;
    while ((matches = STYLE_REGEX.exec(style2)) !== null) {
      const name2 = matches[1];
      if (matches[2]) {
        const args = parseArguments(name2, matches[2]);
        results.push([name2].concat(args));
      } else {
        results.push([name2]);
      }
    }
    return results;
  }
  function buildStyle(chalk2, styles2) {
    const enabled = {};
    for (const layer of styles2) {
      for (const style2 of layer.styles) {
        enabled[style2[0]] = layer.inverse ? null : style2.slice(1);
      }
    }
    let current = chalk2;
    for (const [styleName, styles3] of Object.entries(enabled)) {
      if (!Array.isArray(styles3)) {
        continue;
      }
      if (!(styleName in current)) {
        throw new Error(`Unknown Chalk style: ${styleName}`);
      }
      current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
    }
    return current;
  }
  templates = (chalk2, temporary) => {
    const styles2 = [];
    const chunks = [];
    let chunk = [];
    temporary.replace(TEMPLATE_REGEX, (m2, escapeCharacter, inverse, style2, close, character2) => {
      if (escapeCharacter) {
        chunk.push(unescape3(escapeCharacter));
      } else if (style2) {
        const string3 = chunk.join("");
        chunk = [];
        chunks.push(styles2.length === 0 ? string3 : buildStyle(chalk2, styles2)(string3));
        styles2.push({ inverse, styles: parseStyle3(style2) });
      } else if (close) {
        if (styles2.length === 0) {
          throw new Error("Found extraneous } in Chalk template literal");
        }
        chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
        chunk = [];
        styles2.pop();
      } else {
        chunk.push(character2);
      }
    });
    chunks.push(chunk.join(""));
    if (styles2.length > 0) {
      const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
      throw new Error(errMessage);
    }
    return chunks.join("");
  };
  return templates;
}
const ansiStyles = ansiStylesExports;
const { stdout: stdoutColor, stderr: stderrColor } = browser$1;
const {
  stringReplaceAll,
  stringEncaseCRLFWithFirstIndex
} = util$1;
const { isArray: isArray$5 } = Array;
const levelMapping = [
  "ansi",
  "ansi",
  "ansi256",
  "ansi16m"
];
const styles$5 = /* @__PURE__ */ Object.create(null);
const applyOptions = (object4, options = {}) => {
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
    throw new Error("The `level` option should be an integer from 0 to 3");
  }
  const colorLevel = stdoutColor ? stdoutColor.level : 0;
  object4.level = options.level === void 0 ? colorLevel : options.level;
};
class ChalkClass {
  constructor(options) {
    return chalkFactory(options);
  }
}
const chalkFactory = (options) => {
  const chalk2 = {};
  applyOptions(chalk2, options);
  chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
  Object.setPrototypeOf(chalk2, Chalk.prototype);
  Object.setPrototypeOf(chalk2.template, chalk2);
  chalk2.template.constructor = () => {
    throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
  };
  chalk2.template.Instance = ChalkClass;
  return chalk2.template;
};
function Chalk(options) {
  return chalkFactory(options);
}
for (const [styleName, style2] of Object.entries(ansiStyles)) {
  styles$5[styleName] = {
    get() {
      const builder = createBuilder(this, createStyler(style2.open, style2.close, this._styler), this._isEmpty);
      Object.defineProperty(this, styleName, { value: builder });
      return builder;
    }
  };
}
styles$5.visible = {
  get() {
    const builder = createBuilder(this, this._styler, true);
    Object.defineProperty(this, "visible", { value: builder });
    return builder;
  }
};
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
for (const model of usedModels) {
  styles$5[model] = {
    get() {
      const { level } = this;
      return function(...arguments_) {
        const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
        return createBuilder(this, styler, this._isEmpty);
      };
    }
  };
}
for (const model of usedModels) {
  const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  styles$5[bgModel] = {
    get() {
      const { level } = this;
      return function(...arguments_) {
        const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
        return createBuilder(this, styler, this._isEmpty);
      };
    }
  };
}
const proto$3 = Object.defineProperties(() => {
}, {
  ...styles$5,
  level: {
    enumerable: true,
    get() {
      return this._generator.level;
    },
    set(level) {
      this._generator.level = level;
    }
  }
});
const createStyler = (open, close, parent) => {
  let openAll;
  let closeAll;
  if (parent === void 0) {
    openAll = open;
    closeAll = close;
  } else {
    openAll = parent.openAll + open;
    closeAll = close + parent.closeAll;
  }
  return {
    open,
    close,
    openAll,
    closeAll,
    parent
  };
};
const createBuilder = (self2, _styler, _isEmpty) => {
  const builder = (...arguments_) => {
    if (isArray$5(arguments_[0]) && isArray$5(arguments_[0].raw)) {
      return applyStyle(builder, chalkTag(builder, ...arguments_));
    }
    return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
  };
  Object.setPrototypeOf(builder, proto$3);
  builder._generator = self2;
  builder._styler = _styler;
  builder._isEmpty = _isEmpty;
  return builder;
};
const applyStyle = (self2, string3) => {
  if (self2.level <= 0 || !string3) {
    return self2._isEmpty ? "" : string3;
  }
  let styler = self2._styler;
  if (styler === void 0) {
    return string3;
  }
  const { openAll, closeAll } = styler;
  if (string3.indexOf("\x1B") !== -1) {
    while (styler !== void 0) {
      string3 = stringReplaceAll(string3, styler.close, styler.open);
      styler = styler.parent;
    }
  }
  const lfIndex = string3.indexOf("\n");
  if (lfIndex !== -1) {
    string3 = stringEncaseCRLFWithFirstIndex(string3, closeAll, openAll, lfIndex);
  }
  return openAll + string3 + closeAll;
};
let template;
const chalkTag = (chalk2, ...strings) => {
  const [firstString] = strings;
  if (!isArray$5(firstString) || !isArray$5(firstString.raw)) {
    return strings.join(" ");
  }
  const arguments_ = strings.slice(1);
  const parts = [firstString.raw[0]];
  for (let i2 = 1; i2 < firstString.length; i2++) {
    parts.push(
      String(arguments_[i2 - 1]).replace(/[{}\\]/g, "\\$&"),
      String(firstString.raw[i2])
    );
  }
  if (template === void 0) {
    template = requireTemplates();
  }
  return template(chalk2, parts.join(""));
};
Object.defineProperties(Chalk.prototype, styles$5);
const chalk = Chalk();
chalk.supportsColor = stdoutColor;
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
chalk.stderr.supportsColor = stderrColor;
var source = chalk;
const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
var BTaskStatus = /* @__PURE__ */ ((BTaskStatus2) => {
  BTaskStatus2[BTaskStatus2["NotStarted"] = 1] = "NotStarted";
  BTaskStatus2[BTaskStatus2["Running"] = 2] = "Running";
  BTaskStatus2[BTaskStatus2["Paused"] = 3] = "Paused";
  BTaskStatus2[BTaskStatus2["Error"] = 4] = "Error";
  BTaskStatus2[BTaskStatus2["Completed"] = 5] = "Completed";
  BTaskStatus2[BTaskStatus2["Cancelled"] = 6] = "Cancelled";
  return BTaskStatus2;
})(BTaskStatus || {});
var EnhancementRecordStatus = /* @__PURE__ */ ((EnhancementRecordStatus2) => {
  EnhancementRecordStatus2[EnhancementRecordStatus2["ContextCreated"] = 1] = "ContextCreated";
  EnhancementRecordStatus2[EnhancementRecordStatus2["ContextApplied"] = 2] = "ContextApplied";
  return EnhancementRecordStatus2;
})(EnhancementRecordStatus || {});
var FilterDisplayMode = /* @__PURE__ */ ((FilterDisplayMode2) => {
  FilterDisplayMode2[FilterDisplayMode2["Simple"] = 1] = "Simple";
  FilterDisplayMode2[FilterDisplayMode2["Advanced"] = 2] = "Advanced";
  return FilterDisplayMode2;
})(FilterDisplayMode || {});
var InitializationContentType = /* @__PURE__ */ ((InitializationContentType2) => {
  InitializationContentType2[InitializationContentType2["NotAcceptTerms"] = 1] = "NotAcceptTerms";
  InitializationContentType2[InitializationContentType2["NeedRestart"] = 2] = "NeedRestart";
  return InitializationContentType2;
})(InitializationContentType || {});
var InternalProperty = /* @__PURE__ */ ((InternalProperty2) => {
  InternalProperty2[InternalProperty2["RootPath"] = 1] = "RootPath";
  InternalProperty2[InternalProperty2["ParentResource"] = 2] = "ParentResource";
  InternalProperty2[InternalProperty2["Resource"] = 3] = "Resource";
  InternalProperty2[InternalProperty2["Filename"] = 15] = "Filename";
  InternalProperty2[InternalProperty2["DirectoryPath"] = 16] = "DirectoryPath";
  InternalProperty2[InternalProperty2["CreatedAt"] = 17] = "CreatedAt";
  InternalProperty2[InternalProperty2["FileCreatedAt"] = 18] = "FileCreatedAt";
  InternalProperty2[InternalProperty2["FileModifiedAt"] = 19] = "FileModifiedAt";
  InternalProperty2[InternalProperty2["Category"] = 20] = "Category";
  InternalProperty2[InternalProperty2["MediaLibrary"] = 21] = "MediaLibrary";
  InternalProperty2[InternalProperty2["PlayedAt"] = 23] = "PlayedAt";
  InternalProperty2[InternalProperty2["MediaLibraryV2"] = 24] = "MediaLibraryV2";
  InternalProperty2[InternalProperty2["MediaLibraryV2Multi"] = 25] = "MediaLibraryV2Multi";
  return InternalProperty2;
})(InternalProperty || {});
var MediaLibraryV2AdditionalItem = /* @__PURE__ */ ((MediaLibraryV2AdditionalItem2) => {
  MediaLibraryV2AdditionalItem2[MediaLibraryV2AdditionalItem2["None"] = 0] = "None";
  MediaLibraryV2AdditionalItem2[MediaLibraryV2AdditionalItem2["Template"] = 1] = "Template";
  return MediaLibraryV2AdditionalItem2;
})(MediaLibraryV2AdditionalItem || {});
var PathFilterFsType$1 = /* @__PURE__ */ ((PathFilterFsType2) => {
  PathFilterFsType2[PathFilterFsType2["File"] = 1] = "File";
  PathFilterFsType2[PathFilterFsType2["Directory"] = 2] = "Directory";
  return PathFilterFsType2;
})(PathFilterFsType$1 || {});
const pathFilterFsTypes = [
  {
    label: "File",
    value: 1
    /* File */
  },
  {
    label: "Directory",
    value: 2
    /* Directory */
  }
];
var PathMarkAdditionalItem = /* @__PURE__ */ ((PathMarkAdditionalItem2) => {
  PathMarkAdditionalItem2[PathMarkAdditionalItem2["None"] = 0] = "None";
  PathMarkAdditionalItem2[PathMarkAdditionalItem2["Property"] = 1] = "Property";
  PathMarkAdditionalItem2[PathMarkAdditionalItem2["MediaLibrary"] = 2] = "MediaLibrary";
  return PathMarkAdditionalItem2;
})(PathMarkAdditionalItem || {});
var PathMarkApplyScope = /* @__PURE__ */ ((PathMarkApplyScope2) => {
  PathMarkApplyScope2[PathMarkApplyScope2["MatchedOnly"] = 1] = "MatchedOnly";
  PathMarkApplyScope2[PathMarkApplyScope2["MatchedAndSubdirectories"] = 2] = "MatchedAndSubdirectories";
  return PathMarkApplyScope2;
})(PathMarkApplyScope || {});
var PathMarkSyncStatus = /* @__PURE__ */ ((PathMarkSyncStatus2) => {
  PathMarkSyncStatus2[PathMarkSyncStatus2["Pending"] = 0] = "Pending";
  PathMarkSyncStatus2[PathMarkSyncStatus2["Syncing"] = 1] = "Syncing";
  PathMarkSyncStatus2[PathMarkSyncStatus2["Synced"] = 2] = "Synced";
  PathMarkSyncStatus2[PathMarkSyncStatus2["Failed"] = 3] = "Failed";
  PathMarkSyncStatus2[PathMarkSyncStatus2["PendingDelete"] = 4] = "PendingDelete";
  return PathMarkSyncStatus2;
})(PathMarkSyncStatus || {});
var PathMarkType = /* @__PURE__ */ ((PathMarkType2) => {
  PathMarkType2[PathMarkType2["Resource"] = 1] = "Resource";
  PathMarkType2[PathMarkType2["Property"] = 2] = "Property";
  PathMarkType2[PathMarkType2["MediaLibrary"] = 3] = "MediaLibrary";
  return PathMarkType2;
})(PathMarkType || {});
var PathMatchMode = /* @__PURE__ */ ((PathMatchMode2) => {
  PathMatchMode2[PathMatchMode2["Layer"] = 1] = "Layer";
  PathMatchMode2[PathMatchMode2["Regex"] = 2] = "Regex";
  return PathMatchMode2;
})(PathMatchMode || {});
var PathPositioner = /* @__PURE__ */ ((PathPositioner2) => {
  PathPositioner2[PathPositioner2["Layer"] = 1] = "Layer";
  PathPositioner2[PathPositioner2["Regex"] = 2] = "Regex";
  return PathPositioner2;
})(PathPositioner || {});
const pathPositioners = [
  {
    label: "Layer",
    value: 1
    /* Layer */
  },
  {
    label: "Regex",
    value: 2
    /* Regex */
  }
];
var PathPropertyExtractorBasePathType = /* @__PURE__ */ ((PathPropertyExtractorBasePathType2) => {
  PathPropertyExtractorBasePathType2[PathPropertyExtractorBasePathType2["MediaLibrary"] = 1] = "MediaLibrary";
  PathPropertyExtractorBasePathType2[PathPropertyExtractorBasePathType2["Resource"] = 2] = "Resource";
  return PathPropertyExtractorBasePathType2;
})(PathPropertyExtractorBasePathType || {});
var PropertyPool = /* @__PURE__ */ ((PropertyPool2) => {
  PropertyPool2[PropertyPool2["Internal"] = 1] = "Internal";
  PropertyPool2[PropertyPool2["Reserved"] = 2] = "Reserved";
  PropertyPool2[PropertyPool2["Custom"] = 4] = "Custom";
  PropertyPool2[PropertyPool2["All"] = 7] = "All";
  return PropertyPool2;
})(PropertyPool || {});
const PropertyPoolLabel = {
  [
    1
    /* Internal */
  ]: "Internal",
  [
    2
    /* Reserved */
  ]: "Reserved",
  [
    4
    /* Custom */
  ]: "Custom",
  [
    7
    /* All */
  ]: "All"
};
var PropertyType = /* @__PURE__ */ ((PropertyType2) => {
  PropertyType2[PropertyType2["SingleLineText"] = 1] = "SingleLineText";
  PropertyType2[PropertyType2["MultilineText"] = 2] = "MultilineText";
  PropertyType2[PropertyType2["SingleChoice"] = 3] = "SingleChoice";
  PropertyType2[PropertyType2["MultipleChoice"] = 4] = "MultipleChoice";
  PropertyType2[PropertyType2["Number"] = 5] = "Number";
  PropertyType2[PropertyType2["Percentage"] = 6] = "Percentage";
  PropertyType2[PropertyType2["Rating"] = 7] = "Rating";
  PropertyType2[PropertyType2["Boolean"] = 8] = "Boolean";
  PropertyType2[PropertyType2["Link"] = 9] = "Link";
  PropertyType2[PropertyType2["Attachment"] = 10] = "Attachment";
  PropertyType2[PropertyType2["Date"] = 11] = "Date";
  PropertyType2[PropertyType2["DateTime"] = 12] = "DateTime";
  PropertyType2[PropertyType2["Time"] = 13] = "Time";
  PropertyType2[PropertyType2["Formula"] = 14] = "Formula";
  PropertyType2[PropertyType2["Multilevel"] = 15] = "Multilevel";
  PropertyType2[PropertyType2["Tags"] = 16] = "Tags";
  return PropertyType2;
})(PropertyType || {});
const propertyTypes = [
  {
    label: "SingleLineText",
    value: 1
    /* SingleLineText */
  },
  {
    label: "MultilineText",
    value: 2
    /* MultilineText */
  },
  {
    label: "SingleChoice",
    value: 3
    /* SingleChoice */
  },
  {
    label: "MultipleChoice",
    value: 4
    /* MultipleChoice */
  },
  {
    label: "Number",
    value: 5
    /* Number */
  },
  {
    label: "Percentage",
    value: 6
    /* Percentage */
  },
  {
    label: "Rating",
    value: 7
    /* Rating */
  },
  {
    label: "Boolean",
    value: 8
    /* Boolean */
  },
  {
    label: "Link",
    value: 9
    /* Link */
  },
  {
    label: "Attachment",
    value: 10
    /* Attachment */
  },
  {
    label: "Date",
    value: 11
    /* Date */
  },
  {
    label: "DateTime",
    value: 12
    /* DateTime */
  },
  {
    label: "Time",
    value: 13
    /* Time */
  },
  {
    label: "Formula",
    value: 14
    /* Formula */
  },
  {
    label: "Multilevel",
    value: 15
    /* Multilevel */
  },
  {
    label: "Tags",
    value: 16
    /* Tags */
  }
];
const PropertyTypeLabel = {
  [
    1
    /* SingleLineText */
  ]: "SingleLineText",
  [
    2
    /* MultilineText */
  ]: "MultilineText",
  [
    3
    /* SingleChoice */
  ]: "SingleChoice",
  [
    4
    /* MultipleChoice */
  ]: "MultipleChoice",
  [
    5
    /* Number */
  ]: "Number",
  [
    6
    /* Percentage */
  ]: "Percentage",
  [
    7
    /* Rating */
  ]: "Rating",
  [
    8
    /* Boolean */
  ]: "Boolean",
  [
    9
    /* Link */
  ]: "Link",
  [
    10
    /* Attachment */
  ]: "Attachment",
  [
    11
    /* Date */
  ]: "Date",
  [
    12
    /* DateTime */
  ]: "DateTime",
  [
    13
    /* Time */
  ]: "Time",
  [
    14
    /* Formula */
  ]: "Formula",
  [
    15
    /* Multilevel */
  ]: "Multilevel",
  [
    16
    /* Tags */
  ]: "Tags"
};
var PropertyValueScope = /* @__PURE__ */ ((PropertyValueScope2) => {
  PropertyValueScope2[PropertyValueScope2["Manual"] = 0] = "Manual";
  PropertyValueScope2[PropertyValueScope2["Synchronization"] = 1] = "Synchronization";
  PropertyValueScope2[PropertyValueScope2["BakabaseEnhancer"] = 1e3] = "BakabaseEnhancer";
  PropertyValueScope2[PropertyValueScope2["ExHentaiEnhancer"] = 1001] = "ExHentaiEnhancer";
  PropertyValueScope2[PropertyValueScope2["BangumiEnhancer"] = 1002] = "BangumiEnhancer";
  PropertyValueScope2[PropertyValueScope2["DLsiteEnhancer"] = 1003] = "DLsiteEnhancer";
  PropertyValueScope2[PropertyValueScope2["RegexEnhancer"] = 1004] = "RegexEnhancer";
  PropertyValueScope2[PropertyValueScope2["KodiEnhancer"] = 1005] = "KodiEnhancer";
  PropertyValueScope2[PropertyValueScope2["TmdbEnhancer"] = 1006] = "TmdbEnhancer";
  PropertyValueScope2[PropertyValueScope2["AvEnhancer"] = 1007] = "AvEnhancer";
  return PropertyValueScope2;
})(PropertyValueScope || {});
const propertyValueScopes = [
  {
    label: "Manual",
    value: 0
    /* Manual */
  },
  {
    label: "Synchronization",
    value: 1
    /* Synchronization */
  },
  {
    label: "BakabaseEnhancer",
    value: 1e3
    /* BakabaseEnhancer */
  },
  {
    label: "ExHentaiEnhancer",
    value: 1001
    /* ExHentaiEnhancer */
  },
  {
    label: "BangumiEnhancer",
    value: 1002
    /* BangumiEnhancer */
  },
  {
    label: "DLsiteEnhancer",
    value: 1003
    /* DLsiteEnhancer */
  },
  {
    label: "RegexEnhancer",
    value: 1004
    /* RegexEnhancer */
  },
  {
    label: "KodiEnhancer",
    value: 1005
    /* KodiEnhancer */
  },
  {
    label: "TmdbEnhancer",
    value: 1006
    /* TmdbEnhancer */
  },
  {
    label: "AvEnhancer",
    value: 1007
    /* AvEnhancer */
  }
];
var PropertyValueType = /* @__PURE__ */ ((PropertyValueType2) => {
  PropertyValueType2[PropertyValueType2["Fixed"] = 1] = "Fixed";
  PropertyValueType2[PropertyValueType2["Dynamic"] = 2] = "Dynamic";
  return PropertyValueType2;
})(PropertyValueType || {});
var ReservedProperty = /* @__PURE__ */ ((ReservedProperty2) => {
  ReservedProperty2[ReservedProperty2["Introduction"] = 12] = "Introduction";
  ReservedProperty2[ReservedProperty2["Rating"] = 13] = "Rating";
  ReservedProperty2[ReservedProperty2["Cover"] = 22] = "Cover";
  return ReservedProperty2;
})(ReservedProperty || {});
var ResourceCacheType = /* @__PURE__ */ ((ResourceCacheType2) => {
  ResourceCacheType2[ResourceCacheType2["Covers"] = 1] = "Covers";
  ResourceCacheType2[ResourceCacheType2["PlayableFiles"] = 2] = "PlayableFiles";
  ResourceCacheType2[ResourceCacheType2["ResourceMarkers"] = 4] = "ResourceMarkers";
  return ResourceCacheType2;
})(ResourceCacheType || {});
var ResourceTag = /* @__PURE__ */ ((ResourceTag2) => {
  ResourceTag2[ResourceTag2["IsParent"] = 1] = "IsParent";
  ResourceTag2[ResourceTag2["Pinned"] = 2] = "Pinned";
  ResourceTag2[ResourceTag2["PathDoesNotExist"] = 4] = "PathDoesNotExist";
  ResourceTag2[ResourceTag2["UnknownMediaLibrary"] = 8] = "UnknownMediaLibrary";
  return ResourceTag2;
})(ResourceTag || {});
const resourceTags = [
  {
    label: "IsParent",
    value: 1
    /* IsParent */
  },
  {
    label: "Pinned",
    value: 2
    /* Pinned */
  },
  {
    label: "PathDoesNotExist",
    value: 4
    /* PathDoesNotExist */
  },
  {
    label: "UnknownMediaLibrary",
    value: 8
    /* UnknownMediaLibrary */
  }
];
var SearchCombinator = /* @__PURE__ */ ((SearchCombinator2) => {
  SearchCombinator2[SearchCombinator2["And"] = 1] = "And";
  SearchCombinator2[SearchCombinator2["Or"] = 2] = "Or";
  return SearchCombinator2;
})(SearchCombinator || {});
var SearchOperation = /* @__PURE__ */ ((SearchOperation2) => {
  SearchOperation2[SearchOperation2["Equals"] = 1] = "Equals";
  SearchOperation2[SearchOperation2["NotEquals"] = 2] = "NotEquals";
  SearchOperation2[SearchOperation2["Contains"] = 3] = "Contains";
  SearchOperation2[SearchOperation2["NotContains"] = 4] = "NotContains";
  SearchOperation2[SearchOperation2["StartsWith"] = 5] = "StartsWith";
  SearchOperation2[SearchOperation2["NotStartsWith"] = 6] = "NotStartsWith";
  SearchOperation2[SearchOperation2["EndsWith"] = 7] = "EndsWith";
  SearchOperation2[SearchOperation2["NotEndsWith"] = 8] = "NotEndsWith";
  SearchOperation2[SearchOperation2["GreaterThan"] = 9] = "GreaterThan";
  SearchOperation2[SearchOperation2["LessThan"] = 10] = "LessThan";
  SearchOperation2[SearchOperation2["GreaterThanOrEquals"] = 11] = "GreaterThanOrEquals";
  SearchOperation2[SearchOperation2["LessThanOrEquals"] = 12] = "LessThanOrEquals";
  SearchOperation2[SearchOperation2["IsNull"] = 13] = "IsNull";
  SearchOperation2[SearchOperation2["IsNotNull"] = 14] = "IsNotNull";
  SearchOperation2[SearchOperation2["In"] = 15] = "In";
  SearchOperation2[SearchOperation2["NotIn"] = 16] = "NotIn";
  SearchOperation2[SearchOperation2["Matches"] = 17] = "Matches";
  SearchOperation2[SearchOperation2["NotMatches"] = 18] = "NotMatches";
  return SearchOperation2;
})(SearchOperation || {});
var SpecialTextType = /* @__PURE__ */ ((SpecialTextType2) => {
  SpecialTextType2[SpecialTextType2["Useless"] = 1] = "Useless";
  SpecialTextType2[SpecialTextType2["Wrapper"] = 3] = "Wrapper";
  SpecialTextType2[SpecialTextType2["Standardization"] = 4] = "Standardization";
  SpecialTextType2[SpecialTextType2["Volume"] = 6] = "Volume";
  SpecialTextType2[SpecialTextType2["Trim"] = 7] = "Trim";
  SpecialTextType2[SpecialTextType2["DateTime"] = 8] = "DateTime";
  SpecialTextType2[SpecialTextType2["Language"] = 9] = "Language";
  return SpecialTextType2;
})(SpecialTextType || {});
const specialTextTypes = [
  {
    label: "Useless",
    value: 1
    /* Useless */
  },
  {
    label: "Wrapper",
    value: 3
    /* Wrapper */
  },
  {
    label: "Standardization",
    value: 4
    /* Standardization */
  },
  {
    label: "Volume",
    value: 6
    /* Volume */
  },
  {
    label: "Trim",
    value: 7
    /* Trim */
  },
  {
    label: "DateTime",
    value: 8
    /* DateTime */
  },
  {
    label: "Language",
    value: 9
    /* Language */
  }
];
var StandardValueType = /* @__PURE__ */ ((StandardValueType2) => {
  StandardValueType2[StandardValueType2["String"] = 1] = "String";
  StandardValueType2[StandardValueType2["ListString"] = 2] = "ListString";
  StandardValueType2[StandardValueType2["Decimal"] = 3] = "Decimal";
  StandardValueType2[StandardValueType2["Link"] = 4] = "Link";
  StandardValueType2[StandardValueType2["Boolean"] = 5] = "Boolean";
  StandardValueType2[StandardValueType2["DateTime"] = 6] = "DateTime";
  StandardValueType2[StandardValueType2["Time"] = 7] = "Time";
  StandardValueType2[StandardValueType2["ListListString"] = 8] = "ListListString";
  StandardValueType2[StandardValueType2["ListTag"] = 9] = "ListTag";
  return StandardValueType2;
})(StandardValueType || {});
var TextProcessingOperation = /* @__PURE__ */ ((TextProcessingOperation2) => {
  TextProcessingOperation2[TextProcessingOperation2["Delete"] = 1] = "Delete";
  TextProcessingOperation2[TextProcessingOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  TextProcessingOperation2[TextProcessingOperation2["AddToStart"] = 3] = "AddToStart";
  TextProcessingOperation2[TextProcessingOperation2["AddToEnd"] = 4] = "AddToEnd";
  TextProcessingOperation2[TextProcessingOperation2["AddToAnyPosition"] = 5] = "AddToAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromStart"] = 6] = "RemoveFromStart";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromEnd"] = 7] = "RemoveFromEnd";
  TextProcessingOperation2[TextProcessingOperation2["RemoveFromAnyPosition"] = 8] = "RemoveFromAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromStart"] = 9] = "ReplaceFromStart";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromEnd"] = 10] = "ReplaceFromEnd";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceFromAnyPosition"] = 11] = "ReplaceFromAnyPosition";
  TextProcessingOperation2[TextProcessingOperation2["ReplaceWithRegex"] = 12] = "ReplaceWithRegex";
  return TextProcessingOperation2;
})(TextProcessingOperation || {});
var BTaskResourceType = /* @__PURE__ */ ((BTaskResourceType2) => {
  BTaskResourceType2[BTaskResourceType2["FileSystemEntry"] = 1] = "FileSystemEntry";
  BTaskResourceType2[BTaskResourceType2["Resource"] = 2] = "Resource";
  BTaskResourceType2[BTaskResourceType2["Any"] = 1e3] = "Any";
  return BTaskResourceType2;
})(BTaskResourceType || {});
var CookieValidatorTarget = /* @__PURE__ */ ((CookieValidatorTarget2) => {
  CookieValidatorTarget2[CookieValidatorTarget2["BiliBili"] = 1] = "BiliBili";
  CookieValidatorTarget2[CookieValidatorTarget2["ExHentai"] = 2] = "ExHentai";
  CookieValidatorTarget2[CookieValidatorTarget2["Pixiv"] = 3] = "Pixiv";
  return CookieValidatorTarget2;
})(CookieValidatorTarget || {});
var CoverFit = /* @__PURE__ */ ((CoverFit2) => {
  CoverFit2[CoverFit2["Contain"] = 1] = "Contain";
  CoverFit2[CoverFit2["Cover"] = 2] = "Cover";
  return CoverFit2;
})(CoverFit || {});
var CoverSelectOrder$1 = /* @__PURE__ */ ((CoverSelectOrder2) => {
  CoverSelectOrder2[CoverSelectOrder2["FilenameAscending"] = 1] = "FilenameAscending";
  CoverSelectOrder2[CoverSelectOrder2["FileModifyDtDescending"] = 2] = "FileModifyDtDescending";
  return CoverSelectOrder2;
})(CoverSelectOrder$1 || {});
var MatchResultType = /* @__PURE__ */ ((MatchResultType2) => {
  MatchResultType2[MatchResultType2["Layer"] = 1] = "Layer";
  MatchResultType2[MatchResultType2["Regex"] = 2] = "Regex";
  return MatchResultType2;
})(MatchResultType || {});
var MediaType = /* @__PURE__ */ ((MediaType2) => {
  MediaType2[MediaType2["Image"] = 1] = "Image";
  MediaType2[MediaType2["Audio"] = 2] = "Audio";
  MediaType2[MediaType2["Video"] = 3] = "Video";
  MediaType2[MediaType2["Text"] = 4] = "Text";
  MediaType2[MediaType2["Application"] = 5] = "Application";
  MediaType2[MediaType2["Unknown"] = 1e3] = "Unknown";
  return MediaType2;
})(MediaType || {});
var PlaylistItemType = /* @__PURE__ */ ((PlaylistItemType2) => {
  PlaylistItemType2[PlaylistItemType2["Resource"] = 1] = "Resource";
  PlaylistItemType2[PlaylistItemType2["Video"] = 2] = "Video";
  PlaylistItemType2[PlaylistItemType2["Image"] = 3] = "Image";
  PlaylistItemType2[PlaylistItemType2["Audio"] = 4] = "Audio";
  return PlaylistItemType2;
})(PlaylistItemType || {});
var ResourceMatcherValueType = /* @__PURE__ */ ((ResourceMatcherValueType2) => {
  ResourceMatcherValueType2[ResourceMatcherValueType2["Layer"] = 1] = "Layer";
  ResourceMatcherValueType2[ResourceMatcherValueType2["Regex"] = 2] = "Regex";
  ResourceMatcherValueType2[ResourceMatcherValueType2["FixedText"] = 3] = "FixedText";
  return ResourceMatcherValueType2;
})(ResourceMatcherValueType || {});
var ResourceProperty = /* @__PURE__ */ ((ResourceProperty2) => {
  ResourceProperty2[ResourceProperty2["RootPath"] = 1] = "RootPath";
  ResourceProperty2[ResourceProperty2["ParentResource"] = 2] = "ParentResource";
  ResourceProperty2[ResourceProperty2["Resource"] = 3] = "Resource";
  ResourceProperty2[ResourceProperty2["Introduction"] = 12] = "Introduction";
  ResourceProperty2[ResourceProperty2["Rating"] = 13] = "Rating";
  ResourceProperty2[ResourceProperty2["CustomProperty"] = 14] = "CustomProperty";
  ResourceProperty2[ResourceProperty2["Filename"] = 15] = "Filename";
  ResourceProperty2[ResourceProperty2["DirectoryPath"] = 16] = "DirectoryPath";
  ResourceProperty2[ResourceProperty2["CreatedAt"] = 17] = "CreatedAt";
  ResourceProperty2[ResourceProperty2["FileCreatedAt"] = 18] = "FileCreatedAt";
  ResourceProperty2[ResourceProperty2["FileModifiedAt"] = 19] = "FileModifiedAt";
  ResourceProperty2[ResourceProperty2["Category"] = 20] = "Category";
  ResourceProperty2[ResourceProperty2["MediaLibrary"] = 21] = "MediaLibrary";
  ResourceProperty2[ResourceProperty2["Cover"] = 22] = "Cover";
  ResourceProperty2[ResourceProperty2["PlayedAt"] = 23] = "PlayedAt";
  ResourceProperty2[ResourceProperty2["MediaLibraryV2"] = 24] = "MediaLibraryV2";
  ResourceProperty2[ResourceProperty2["MediaLibraryV2Multi"] = 25] = "MediaLibraryV2Multi";
  return ResourceProperty2;
})(ResourceProperty || {});
const startupPages = [
  {
    label: "Default",
    value: 0
    /* Default */
  },
  {
    label: "Resource",
    value: 1
    /* Resource */
  }
];
var ThirdPartyId = /* @__PURE__ */ ((ThirdPartyId2) => {
  ThirdPartyId2[ThirdPartyId2["Bilibili"] = 1] = "Bilibili";
  ThirdPartyId2[ThirdPartyId2["ExHentai"] = 2] = "ExHentai";
  ThirdPartyId2[ThirdPartyId2["Pixiv"] = 3] = "Pixiv";
  ThirdPartyId2[ThirdPartyId2["Bangumi"] = 4] = "Bangumi";
  ThirdPartyId2[ThirdPartyId2["SoulPlus"] = 5] = "SoulPlus";
  ThirdPartyId2[ThirdPartyId2["DLsite"] = 6] = "DLsite";
  ThirdPartyId2[ThirdPartyId2["Fanbox"] = 7] = "Fanbox";
  ThirdPartyId2[ThirdPartyId2["Fantia"] = 8] = "Fantia";
  ThirdPartyId2[ThirdPartyId2["Cien"] = 9] = "Cien";
  ThirdPartyId2[ThirdPartyId2["Patreon"] = 10] = "Patreon";
  ThirdPartyId2[ThirdPartyId2["Tmdb"] = 11] = "Tmdb";
  return ThirdPartyId2;
})(ThirdPartyId || {});
var PasswordSearchOrder = /* @__PURE__ */ ((PasswordSearchOrder2) => {
  PasswordSearchOrder2[PasswordSearchOrder2["Latest"] = 1] = "Latest";
  PasswordSearchOrder2[PasswordSearchOrder2["Frequency"] = 2] = "Frequency";
  return PasswordSearchOrder2;
})(PasswordSearchOrder || {});
var ResourceSearchSortableProperty = /* @__PURE__ */ ((ResourceSearchSortableProperty2) => {
  ResourceSearchSortableProperty2[ResourceSearchSortableProperty2["FileCreateDt"] = 1] = "FileCreateDt";
  ResourceSearchSortableProperty2[ResourceSearchSortableProperty2["FileModifyDt"] = 2] = "FileModifyDt";
  ResourceSearchSortableProperty2[ResourceSearchSortableProperty2["Filename"] = 3] = "Filename";
  ResourceSearchSortableProperty2[ResourceSearchSortableProperty2["AddDt"] = 6] = "AddDt";
  ResourceSearchSortableProperty2[ResourceSearchSortableProperty2["PlayedAt"] = 11] = "PlayedAt";
  return ResourceSearchSortableProperty2;
})(ResourceSearchSortableProperty || {});
const resourceSearchSortableProperties = [
  {
    label: "FileCreateDt",
    value: 1
    /* FileCreateDt */
  },
  {
    label: "FileModifyDt",
    value: 2
    /* FileModifyDt */
  },
  {
    label: "Filename",
    value: 3
    /* Filename */
  },
  {
    label: "AddDt",
    value: 6
    /* AddDt */
  },
  {
    label: "PlayedAt",
    value: 11
    /* PlayedAt */
  }
];
var AliasAdditionalItem = /* @__PURE__ */ ((AliasAdditionalItem2) => {
  AliasAdditionalItem2[AliasAdditionalItem2["Candidates"] = 1] = "Candidates";
  return AliasAdditionalItem2;
})(AliasAdditionalItem || {});
var CategoryAdditionalItem = /* @__PURE__ */ ((CategoryAdditionalItem2) => {
  CategoryAdditionalItem2[CategoryAdditionalItem2["None"] = 0] = "None";
  CategoryAdditionalItem2[CategoryAdditionalItem2["Components"] = 1] = "Components";
  CategoryAdditionalItem2[CategoryAdditionalItem2["Validation"] = 3] = "Validation";
  CategoryAdditionalItem2[CategoryAdditionalItem2["CustomProperties"] = 4] = "CustomProperties";
  CategoryAdditionalItem2[CategoryAdditionalItem2["EnhancerOptions"] = 8] = "EnhancerOptions";
  return CategoryAdditionalItem2;
})(CategoryAdditionalItem || {});
var CustomPropertyAdditionalItem = /* @__PURE__ */ ((CustomPropertyAdditionalItem2) => {
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["None"] = 0] = "None";
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["Category"] = 1] = "Category";
  CustomPropertyAdditionalItem2[CustomPropertyAdditionalItem2["ValueCount"] = 2] = "ValueCount";
  return CustomPropertyAdditionalItem2;
})(CustomPropertyAdditionalItem || {});
var ResourceAdditionalItem = /* @__PURE__ */ ((ResourceAdditionalItem2) => {
  ResourceAdditionalItem2[ResourceAdditionalItem2["None"] = 0] = "None";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Properties"] = 32] = "Properties";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Alias"] = 64] = "Alias";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Category"] = 128] = "Category";
  ResourceAdditionalItem2[ResourceAdditionalItem2["DisplayName"] = 288] = "DisplayName";
  ResourceAdditionalItem2[ResourceAdditionalItem2["HasChildren"] = 512] = "HasChildren";
  ResourceAdditionalItem2[ResourceAdditionalItem2["MediaLibraryName"] = 2048] = "MediaLibraryName";
  ResourceAdditionalItem2[ResourceAdditionalItem2["Cache"] = 4096] = "Cache";
  ResourceAdditionalItem2[ResourceAdditionalItem2["All"] = 7008] = "All";
  return ResourceAdditionalItem2;
})(ResourceAdditionalItem || {});
var ComparisonMode = /* @__PURE__ */ ((ComparisonMode2) => {
  ComparisonMode2[ComparisonMode2["StrictEqual"] = 0] = "StrictEqual";
  ComparisonMode2[ComparisonMode2["TextSimilarity"] = 2] = "TextSimilarity";
  ComparisonMode2[ComparisonMode2["RegexExtractNumber"] = 3] = "RegexExtractNumber";
  ComparisonMode2[ComparisonMode2["FixedTolerance"] = 4] = "FixedTolerance";
  ComparisonMode2[ComparisonMode2["RelativeTolerance"] = 5] = "RelativeTolerance";
  ComparisonMode2[ComparisonMode2["SetIntersection"] = 6] = "SetIntersection";
  ComparisonMode2[ComparisonMode2["Subset"] = 7] = "Subset";
  ComparisonMode2[ComparisonMode2["TimeWindow"] = 8] = "TimeWindow";
  ComparisonMode2[ComparisonMode2["SameDay"] = 9] = "SameDay";
  ComparisonMode2[ComparisonMode2["ExtensionMap"] = 10] = "ExtensionMap";
  return ComparisonMode2;
})(ComparisonMode || {});
var NullValueBehavior = /* @__PURE__ */ ((NullValueBehavior2) => {
  NullValueBehavior2[NullValueBehavior2["Skip"] = 0] = "Skip";
  NullValueBehavior2[NullValueBehavior2["Fail"] = 1] = "Fail";
  NullValueBehavior2[NullValueBehavior2["Pass"] = 2] = "Pass";
  return NullValueBehavior2;
})(NullValueBehavior || {});
var ResponseCode = /* @__PURE__ */ ((ResponseCode2) => {
  ResponseCode2[ResponseCode2["Success"] = 0] = "Success";
  ResponseCode2[ResponseCode2["NotModified"] = 304] = "NotModified";
  ResponseCode2[ResponseCode2["InvalidPayloadOrOperation"] = 400] = "InvalidPayloadOrOperation";
  ResponseCode2[ResponseCode2["Unauthenticated"] = 401] = "Unauthenticated";
  ResponseCode2[ResponseCode2["Unauthorized"] = 403] = "Unauthorized";
  ResponseCode2[ResponseCode2["NotFound"] = 404] = "NotFound";
  ResponseCode2[ResponseCode2["Conflict"] = 409] = "Conflict";
  ResponseCode2[ResponseCode2["SystemError"] = 500] = "SystemError";
  ResponseCode2[ResponseCode2["Timeout"] = 504] = "Timeout";
  ResponseCode2[ResponseCode2["InvalidCaptcha"] = 100400] = "InvalidCaptcha";
  return ResponseCode2;
})(ResponseCode || {});
var RuntimeMode = /* @__PURE__ */ ((RuntimeMode2) => {
  RuntimeMode2[RuntimeMode2["Dev"] = 0] = "Dev";
  RuntimeMode2[RuntimeMode2["WinForms"] = 1] = "WinForms";
  RuntimeMode2[RuntimeMode2["Docker"] = 2] = "Docker";
  return RuntimeMode2;
})(RuntimeMode || {});
var EnhancerId = /* @__PURE__ */ ((EnhancerId2) => {
  EnhancerId2[EnhancerId2["Bakabase"] = 1] = "Bakabase";
  EnhancerId2[EnhancerId2["ExHentai"] = 2] = "ExHentai";
  EnhancerId2[EnhancerId2["Bangumi"] = 3] = "Bangumi";
  EnhancerId2[EnhancerId2["DLsite"] = 4] = "DLsite";
  EnhancerId2[EnhancerId2["Regex"] = 5] = "Regex";
  EnhancerId2[EnhancerId2["Kodi"] = 6] = "Kodi";
  EnhancerId2[EnhancerId2["Tmdb"] = 7] = "Tmdb";
  EnhancerId2[EnhancerId2["Av"] = 8] = "Av";
  return EnhancerId2;
})(EnhancerId || {});
const enhancerIds = [
  {
    label: "Bakabase",
    value: 1
    /* Bakabase */
  },
  {
    label: "ExHentai",
    value: 2
    /* ExHentai */
  },
  {
    label: "Bangumi",
    value: 3
    /* Bangumi */
  },
  {
    label: "DLsite",
    value: 4
    /* DLsite */
  },
  {
    label: "Regex",
    value: 5
    /* Regex */
  },
  {
    label: "Kodi",
    value: 6
    /* Kodi */
  },
  {
    label: "Tmdb",
    value: 7
    /* Tmdb */
  },
  {
    label: "Av",
    value: 8
    /* Av */
  }
];
var EnhancerTag = /* @__PURE__ */ ((EnhancerTag2) => {
  EnhancerTag2[EnhancerTag2["UseRegex"] = 1] = "UseRegex";
  EnhancerTag2[EnhancerTag2["UseKeyword"] = 2] = "UseKeyword";
  return EnhancerTag2;
})(EnhancerTag || {});
var RegexEnhancerTarget = /* @__PURE__ */ ((RegexEnhancerTarget2) => {
  RegexEnhancerTarget2[RegexEnhancerTarget2["CaptureGroups"] = 0] = "CaptureGroups";
  return RegexEnhancerTarget2;
})(RegexEnhancerTarget || {});
var EnhancementAdditionalItem = /* @__PURE__ */ ((EnhancementAdditionalItem2) => {
  EnhancementAdditionalItem2[EnhancementAdditionalItem2["None"] = 0] = "None";
  EnhancementAdditionalItem2[EnhancementAdditionalItem2["GeneratedPropertyValue"] = 1] = "GeneratedPropertyValue";
  return EnhancementAdditionalItem2;
})(EnhancementAdditionalItem || {});
var EnhancerTargetOptionsItem = /* @__PURE__ */ ((EnhancerTargetOptionsItem2) => {
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["AutoBindProperty"] = 1] = "AutoBindProperty";
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["AutoMatchMultilevelString"] = 2] = "AutoMatchMultilevelString";
  EnhancerTargetOptionsItem2[EnhancerTargetOptionsItem2["CoverSelectOrder"] = 3] = "CoverSelectOrder";
  return EnhancerTargetOptionsItem2;
})(EnhancerTargetOptionsItem || {});
const builtinPropertyForDisplayNames = [
  {
    label: "Filename",
    value: 15
    /* Filename */
  }
];
var TampermonkeyScript = /* @__PURE__ */ ((TampermonkeyScript2) => {
  TampermonkeyScript2[TampermonkeyScript2["SoulPlus"] = 1] = "SoulPlus";
  TampermonkeyScript2[TampermonkeyScript2["Bakabase"] = 2] = "Bakabase";
  return TampermonkeyScript2;
})(TampermonkeyScript || {});
var PostParserSource = /* @__PURE__ */ ((PostParserSource2) => {
  PostParserSource2[PostParserSource2["SoulPlus"] = 5] = "SoulPlus";
  return PostParserSource2;
})(PostParserSource || {});
const postParserSources = [
  {
    label: "SoulPlus",
    value: 5
    /* SoulPlus */
  }
];
var FileNameModifierCaseType = /* @__PURE__ */ ((FileNameModifierCaseType2) => {
  FileNameModifierCaseType2[FileNameModifierCaseType2["TitleCase"] = 1] = "TitleCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["UpperCase"] = 2] = "UpperCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["LowerCase"] = 3] = "LowerCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["CamelCase"] = 4] = "CamelCase";
  FileNameModifierCaseType2[FileNameModifierCaseType2["PascalCase"] = 5] = "PascalCase";
  return FileNameModifierCaseType2;
})(FileNameModifierCaseType || {});
const fileNameModifierCaseTypes = [
  {
    label: "TitleCase",
    value: 1
    /* TitleCase */
  },
  {
    label: "UpperCase",
    value: 2
    /* UpperCase */
  },
  {
    label: "LowerCase",
    value: 3
    /* LowerCase */
  },
  {
    label: "CamelCase",
    value: 4
    /* CamelCase */
  },
  {
    label: "PascalCase",
    value: 5
    /* PascalCase */
  }
];
var FileNameModifierFileNameTarget = /* @__PURE__ */ ((FileNameModifierFileNameTarget2) => {
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["FileName"] = 1] = "FileName";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["FileNameWithoutExtension"] = 2] = "FileNameWithoutExtension";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["Extension"] = 3] = "Extension";
  FileNameModifierFileNameTarget2[FileNameModifierFileNameTarget2["ExtensionWithoutDot"] = 4] = "ExtensionWithoutDot";
  return FileNameModifierFileNameTarget2;
})(FileNameModifierFileNameTarget || {});
const fileNameModifierFileNameTargets = [
  {
    label: "FileName",
    value: 1
    /* FileName */
  },
  {
    label: "FileNameWithoutExtension",
    value: 2
    /* FileNameWithoutExtension */
  },
  {
    label: "Extension",
    value: 3
    /* Extension */
  },
  {
    label: "ExtensionWithoutDot",
    value: 4
    /* ExtensionWithoutDot */
  }
];
var FileNameModifierOperationType = /* @__PURE__ */ ((FileNameModifierOperationType2) => {
  FileNameModifierOperationType2[FileNameModifierOperationType2["Insert"] = 1] = "Insert";
  FileNameModifierOperationType2[FileNameModifierOperationType2["AddDateTime"] = 2] = "AddDateTime";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Delete"] = 3] = "Delete";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Replace"] = 4] = "Replace";
  FileNameModifierOperationType2[FileNameModifierOperationType2["ChangeCase"] = 5] = "ChangeCase";
  FileNameModifierOperationType2[FileNameModifierOperationType2["AddAlphabetSequence"] = 6] = "AddAlphabetSequence";
  FileNameModifierOperationType2[FileNameModifierOperationType2["Reverse"] = 7] = "Reverse";
  return FileNameModifierOperationType2;
})(FileNameModifierOperationType || {});
const fileNameModifierOperationTypes = [
  {
    label: "Insert",
    value: 1
    /* Insert */
  },
  {
    label: "AddDateTime",
    value: 2
    /* AddDateTime */
  },
  {
    label: "Delete",
    value: 3
    /* Delete */
  },
  {
    label: "Replace",
    value: 4
    /* Replace */
  },
  {
    label: "ChangeCase",
    value: 5
    /* ChangeCase */
  },
  {
    label: "AddAlphabetSequence",
    value: 6
    /* AddAlphabetSequence */
  },
  {
    label: "Reverse",
    value: 7
    /* Reverse */
  }
];
var FileNameModifierPosition = /* @__PURE__ */ ((FileNameModifierPosition2) => {
  FileNameModifierPosition2[FileNameModifierPosition2["Start"] = 1] = "Start";
  FileNameModifierPosition2[FileNameModifierPosition2["End"] = 2] = "End";
  FileNameModifierPosition2[FileNameModifierPosition2["AtPosition"] = 3] = "AtPosition";
  FileNameModifierPosition2[FileNameModifierPosition2["AfterText"] = 4] = "AfterText";
  FileNameModifierPosition2[FileNameModifierPosition2["BeforeText"] = 5] = "BeforeText";
  return FileNameModifierPosition2;
})(FileNameModifierPosition || {});
const fileNameModifierPositions = [
  {
    label: "Start",
    value: 1
    /* Start */
  },
  {
    label: "End",
    value: 2
    /* End */
  },
  {
    label: "AtPosition",
    value: 3
    /* AtPosition */
  },
  {
    label: "AfterText",
    value: 4
    /* AfterText */
  },
  {
    label: "BeforeText",
    value: 5
    /* BeforeText */
  }
];
var IwFsEntryChangeType = /* @__PURE__ */ ((IwFsEntryChangeType2) => {
  IwFsEntryChangeType2[IwFsEntryChangeType2["Created"] = 1] = "Created";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Renamed"] = 2] = "Renamed";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Changed"] = 3] = "Changed";
  IwFsEntryChangeType2[IwFsEntryChangeType2["Deleted"] = 4] = "Deleted";
  return IwFsEntryChangeType2;
})(IwFsEntryChangeType || {});
var IwFsType = /* @__PURE__ */ ((IwFsType2) => {
  IwFsType2[IwFsType2["Unknown"] = 0] = "Unknown";
  IwFsType2[IwFsType2["Directory"] = 100] = "Directory";
  IwFsType2[IwFsType2["Image"] = 200] = "Image";
  IwFsType2[IwFsType2["CompressedFileEntry"] = 300] = "CompressedFileEntry";
  IwFsType2[IwFsType2["CompressedFilePart"] = 400] = "CompressedFilePart";
  IwFsType2[IwFsType2["Symlink"] = 500] = "Symlink";
  IwFsType2[IwFsType2["Video"] = 600] = "Video";
  IwFsType2[IwFsType2["Audio"] = 700] = "Audio";
  IwFsType2[IwFsType2["Drive"] = 1e3] = "Drive";
  IwFsType2[IwFsType2["Invalid"] = 1e4] = "Invalid";
  return IwFsType2;
})(IwFsType || {});
var PixivDownloadTaskType = /* @__PURE__ */ ((PixivDownloadTaskType2) => {
  PixivDownloadTaskType2[PixivDownloadTaskType2["Search"] = 1] = "Search";
  PixivDownloadTaskType2[PixivDownloadTaskType2["Ranking"] = 2] = "Ranking";
  PixivDownloadTaskType2[PixivDownloadTaskType2["Following"] = 3] = "Following";
  return PixivDownloadTaskType2;
})(PixivDownloadTaskType || {});
var ExHentaiDownloadTaskType = /* @__PURE__ */ ((ExHentaiDownloadTaskType2) => {
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["SingleWork"] = 1] = "SingleWork";
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["Watched"] = 2] = "Watched";
  ExHentaiDownloadTaskType2[ExHentaiDownloadTaskType2["List"] = 3] = "List";
  return ExHentaiDownloadTaskType2;
})(ExHentaiDownloadTaskType || {});
var BilibiliDownloadTaskType = /* @__PURE__ */ ((BilibiliDownloadTaskType2) => {
  BilibiliDownloadTaskType2[BilibiliDownloadTaskType2["Favorites"] = 1] = "Favorites";
  return BilibiliDownloadTaskType2;
})(BilibiliDownloadTaskType || {});
var DownloadTaskAction = /* @__PURE__ */ ((DownloadTaskAction2) => {
  DownloadTaskAction2[DownloadTaskAction2["StartManually"] = 1] = "StartManually";
  DownloadTaskAction2[DownloadTaskAction2["Restart"] = 2] = "Restart";
  DownloadTaskAction2[DownloadTaskAction2["Disable"] = 3] = "Disable";
  DownloadTaskAction2[DownloadTaskAction2["StartAutomatically"] = 4] = "StartAutomatically";
  return DownloadTaskAction2;
})(DownloadTaskAction || {});
var DownloadTaskActionOnConflict = /* @__PURE__ */ ((DownloadTaskActionOnConflict2) => {
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["NotSet"] = 0] = "NotSet";
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["StopOthers"] = 1] = "StopOthers";
  DownloadTaskActionOnConflict2[DownloadTaskActionOnConflict2["Ignore"] = 2] = "Ignore";
  return DownloadTaskActionOnConflict2;
})(DownloadTaskActionOnConflict || {});
var DownloadTaskStatus = /* @__PURE__ */ ((DownloadTaskStatus2) => {
  DownloadTaskStatus2[DownloadTaskStatus2["Idle"] = 100] = "Idle";
  DownloadTaskStatus2[DownloadTaskStatus2["InQueue"] = 200] = "InQueue";
  DownloadTaskStatus2[DownloadTaskStatus2["Starting"] = 300] = "Starting";
  DownloadTaskStatus2[DownloadTaskStatus2["Downloading"] = 400] = "Downloading";
  DownloadTaskStatus2[DownloadTaskStatus2["Stopping"] = 500] = "Stopping";
  DownloadTaskStatus2[DownloadTaskStatus2["Complete"] = 600] = "Complete";
  DownloadTaskStatus2[DownloadTaskStatus2["Failed"] = 700] = "Failed";
  DownloadTaskStatus2[DownloadTaskStatus2["Disabled"] = 800] = "Disabled";
  return DownloadTaskStatus2;
})(DownloadTaskStatus || {});
const downloadTaskStatuses = [
  {
    label: "Idle",
    value: 100
    /* Idle */
  },
  {
    label: "InQueue",
    value: 200
    /* InQueue */
  },
  {
    label: "Starting",
    value: 300
    /* Starting */
  },
  {
    label: "Downloading",
    value: 400
    /* Downloading */
  },
  {
    label: "Stopping",
    value: 500
    /* Stopping */
  },
  {
    label: "Complete",
    value: 600
    /* Complete */
  },
  {
    label: "Failed",
    value: 700
    /* Failed */
  },
  {
    label: "Disabled",
    value: 800
    /* Disabled */
  }
];
var DependentComponentStatus = /* @__PURE__ */ ((DependentComponentStatus2) => {
  DependentComponentStatus2[DependentComponentStatus2["NotInstalled"] = 1] = "NotInstalled";
  DependentComponentStatus2[DependentComponentStatus2["Installed"] = 2] = "Installed";
  DependentComponentStatus2[DependentComponentStatus2["Installing"] = 3] = "Installing";
  return DependentComponentStatus2;
})(DependentComponentStatus || {});
var BulkModificationProcessorOptionsItemsFilterBy = /* @__PURE__ */ ((BulkModificationProcessorOptionsItemsFilterBy2) => {
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["All"] = 1] = "All";
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["Containing"] = 2] = "Containing";
  BulkModificationProcessorOptionsItemsFilterBy2[BulkModificationProcessorOptionsItemsFilterBy2["Matching"] = 3] = "Matching";
  return BulkModificationProcessorOptionsItemsFilterBy2;
})(BulkModificationProcessorOptionsItemsFilterBy || {});
const bulkModificationProcessorOptionsItemsFilterBies = [
  {
    label: "All",
    value: 1
    /* All */
  },
  {
    label: "Containing",
    value: 2
    /* Containing */
  },
  {
    label: "Matching",
    value: 3
    /* Matching */
  }
];
var BulkModificationTimeProcessOperation = /* @__PURE__ */ ((BulkModificationTimeProcessOperation2) => {
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["AddHours"] = 3] = "AddHours";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["SubtractHours"] = 4] = "SubtractHours";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["AddMinutes"] = 5] = "AddMinutes";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["SubtractMinutes"] = 6] = "SubtractMinutes";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["AddSeconds"] = 7] = "AddSeconds";
  BulkModificationTimeProcessOperation2[BulkModificationTimeProcessOperation2["SubtractSeconds"] = 8] = "SubtractSeconds";
  return BulkModificationTimeProcessOperation2;
})(BulkModificationTimeProcessOperation || {});
const bulkModificationTimeProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "AddHours",
    value: 3
    /* AddHours */
  },
  {
    label: "SubtractHours",
    value: 4
    /* SubtractHours */
  },
  {
    label: "AddMinutes",
    value: 5
    /* AddMinutes */
  },
  {
    label: "SubtractMinutes",
    value: 6
    /* SubtractMinutes */
  },
  {
    label: "AddSeconds",
    value: 7
    /* AddSeconds */
  },
  {
    label: "SubtractSeconds",
    value: 8
    /* SubtractSeconds */
  }
];
var BulkModificationStringProcessOperation = /* @__PURE__ */ ((BulkModificationStringProcessOperation2) => {
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToStart"] = 3] = "AddToStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToEnd"] = 4] = "AddToEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["AddToAnyPosition"] = 5] = "AddToAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromStart"] = 6] = "RemoveFromStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromEnd"] = 7] = "RemoveFromEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["RemoveFromAnyPosition"] = 8] = "RemoveFromAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromStart"] = 9] = "ReplaceFromStart";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromEnd"] = 10] = "ReplaceFromEnd";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceFromAnyPosition"] = 11] = "ReplaceFromAnyPosition";
  BulkModificationStringProcessOperation2[BulkModificationStringProcessOperation2["ReplaceWithRegex"] = 12] = "ReplaceWithRegex";
  return BulkModificationStringProcessOperation2;
})(BulkModificationStringProcessOperation || {});
const bulkModificationStringProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "AddToStart",
    value: 3
    /* AddToStart */
  },
  {
    label: "AddToEnd",
    value: 4
    /* AddToEnd */
  },
  {
    label: "AddToAnyPosition",
    value: 5
    /* AddToAnyPosition */
  },
  {
    label: "RemoveFromStart",
    value: 6
    /* RemoveFromStart */
  },
  {
    label: "RemoveFromEnd",
    value: 7
    /* RemoveFromEnd */
  },
  {
    label: "RemoveFromAnyPosition",
    value: 8
    /* RemoveFromAnyPosition */
  },
  {
    label: "ReplaceFromStart",
    value: 9
    /* ReplaceFromStart */
  },
  {
    label: "ReplaceFromEnd",
    value: 10
    /* ReplaceFromEnd */
  },
  {
    label: "ReplaceFromAnyPosition",
    value: 11
    /* ReplaceFromAnyPosition */
  },
  {
    label: "ReplaceWithRegex",
    value: 12
    /* ReplaceWithRegex */
  }
];
var BulkModificationListTagProcessOperation = /* @__PURE__ */ ((BulkModificationListTagProcessOperation2) => {
  BulkModificationListTagProcessOperation2[BulkModificationListTagProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationListTagProcessOperation2[BulkModificationListTagProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationListTagProcessOperation2[BulkModificationListTagProcessOperation2["Append"] = 3] = "Append";
  BulkModificationListTagProcessOperation2[BulkModificationListTagProcessOperation2["Prepend"] = 4] = "Prepend";
  BulkModificationListTagProcessOperation2[BulkModificationListTagProcessOperation2["Remove"] = 5] = "Remove";
  return BulkModificationListTagProcessOperation2;
})(BulkModificationListTagProcessOperation || {});
const bulkModificationListTagProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "Append",
    value: 3
    /* Append */
  },
  {
    label: "Prepend",
    value: 4
    /* Prepend */
  },
  {
    label: "Remove",
    value: 5
    /* Remove */
  }
];
var BulkModificationListStringProcessOperation = /* @__PURE__ */ ((BulkModificationListStringProcessOperation2) => {
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["SetWithFixedValue"] = 1] = "SetWithFixedValue";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Append"] = 2] = "Append";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Prepend"] = 3] = "Prepend";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Modify"] = 4] = "Modify";
  BulkModificationListStringProcessOperation2[BulkModificationListStringProcessOperation2["Delete"] = 5] = "Delete";
  return BulkModificationListStringProcessOperation2;
})(BulkModificationListStringProcessOperation || {});
const bulkModificationListStringProcessOperations = [
  {
    label: "SetWithFixedValue",
    value: 1
    /* SetWithFixedValue */
  },
  {
    label: "Append",
    value: 2
    /* Append */
  },
  {
    label: "Prepend",
    value: 3
    /* Prepend */
  },
  {
    label: "Modify",
    value: 4
    /* Modify */
  },
  {
    label: "Delete",
    value: 5
    /* Delete */
  }
];
var BulkModificationListListStringProcessOperation = /* @__PURE__ */ ((BulkModificationListListStringProcessOperation2) => {
  BulkModificationListListStringProcessOperation2[BulkModificationListListStringProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationListListStringProcessOperation2[BulkModificationListListStringProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationListListStringProcessOperation2[BulkModificationListListStringProcessOperation2["Append"] = 3] = "Append";
  BulkModificationListListStringProcessOperation2[BulkModificationListListStringProcessOperation2["Prepend"] = 4] = "Prepend";
  BulkModificationListListStringProcessOperation2[BulkModificationListListStringProcessOperation2["Remove"] = 5] = "Remove";
  return BulkModificationListListStringProcessOperation2;
})(BulkModificationListListStringProcessOperation || {});
const bulkModificationListListStringProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "Append",
    value: 3
    /* Append */
  },
  {
    label: "Prepend",
    value: 4
    /* Prepend */
  },
  {
    label: "Remove",
    value: 5
    /* Remove */
  }
];
var BulkModificationLinkProcessOperation = /* @__PURE__ */ ((BulkModificationLinkProcessOperation2) => {
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["SetText"] = 3] = "SetText";
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["SetUrl"] = 4] = "SetUrl";
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["ModifyText"] = 5] = "ModifyText";
  BulkModificationLinkProcessOperation2[BulkModificationLinkProcessOperation2["ModifyUrl"] = 6] = "ModifyUrl";
  return BulkModificationLinkProcessOperation2;
})(BulkModificationLinkProcessOperation || {});
const bulkModificationLinkProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "SetText",
    value: 3
    /* SetText */
  },
  {
    label: "SetUrl",
    value: 4
    /* SetUrl */
  },
  {
    label: "ModifyText",
    value: 5
    /* ModifyText */
  },
  {
    label: "ModifyUrl",
    value: 6
    /* ModifyUrl */
  }
];
var BulkModificationDecimalProcessOperation = /* @__PURE__ */ ((BulkModificationDecimalProcessOperation2) => {
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Add"] = 3] = "Add";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Subtract"] = 4] = "Subtract";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Multiply"] = 5] = "Multiply";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Divide"] = 6] = "Divide";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Round"] = 7] = "Round";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Ceil"] = 8] = "Ceil";
  BulkModificationDecimalProcessOperation2[BulkModificationDecimalProcessOperation2["Floor"] = 9] = "Floor";
  return BulkModificationDecimalProcessOperation2;
})(BulkModificationDecimalProcessOperation || {});
const bulkModificationDecimalProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "Add",
    value: 3
    /* Add */
  },
  {
    label: "Subtract",
    value: 4
    /* Subtract */
  },
  {
    label: "Multiply",
    value: 5
    /* Multiply */
  },
  {
    label: "Divide",
    value: 6
    /* Divide */
  },
  {
    label: "Round",
    value: 7
    /* Round */
  },
  {
    label: "Ceil",
    value: 8
    /* Ceil */
  },
  {
    label: "Floor",
    value: 9
    /* Floor */
  }
];
var BulkModificationDateTimeProcessOperation = /* @__PURE__ */ ((BulkModificationDateTimeProcessOperation2) => {
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["AddDays"] = 3] = "AddDays";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["SubtractDays"] = 4] = "SubtractDays";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["AddMonths"] = 5] = "AddMonths";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["SubtractMonths"] = 6] = "SubtractMonths";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["AddYears"] = 7] = "AddYears";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["SubtractYears"] = 8] = "SubtractYears";
  BulkModificationDateTimeProcessOperation2[BulkModificationDateTimeProcessOperation2["SetToNow"] = 9] = "SetToNow";
  return BulkModificationDateTimeProcessOperation2;
})(BulkModificationDateTimeProcessOperation || {});
const bulkModificationDateTimeProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "AddDays",
    value: 3
    /* AddDays */
  },
  {
    label: "SubtractDays",
    value: 4
    /* SubtractDays */
  },
  {
    label: "AddMonths",
    value: 5
    /* AddMonths */
  },
  {
    label: "SubtractMonths",
    value: 6
    /* SubtractMonths */
  },
  {
    label: "AddYears",
    value: 7
    /* AddYears */
  },
  {
    label: "SubtractYears",
    value: 8
    /* SubtractYears */
  },
  {
    label: "SetToNow",
    value: 9
    /* SetToNow */
  }
];
var BulkModificationBooleanProcessOperation = /* @__PURE__ */ ((BulkModificationBooleanProcessOperation2) => {
  BulkModificationBooleanProcessOperation2[BulkModificationBooleanProcessOperation2["Delete"] = 1] = "Delete";
  BulkModificationBooleanProcessOperation2[BulkModificationBooleanProcessOperation2["SetWithFixedValue"] = 2] = "SetWithFixedValue";
  BulkModificationBooleanProcessOperation2[BulkModificationBooleanProcessOperation2["Toggle"] = 3] = "Toggle";
  return BulkModificationBooleanProcessOperation2;
})(BulkModificationBooleanProcessOperation || {});
const bulkModificationBooleanProcessOperations = [
  {
    label: "Delete",
    value: 1
    /* Delete */
  },
  {
    label: "SetWithFixedValue",
    value: 2
    /* SetWithFixedValue */
  },
  {
    label: "Toggle",
    value: 3
    /* Toggle */
  }
];
var BulkModificationProcessorValueType = /* @__PURE__ */ ((BulkModificationProcessorValueType2) => {
  BulkModificationProcessorValueType2[BulkModificationProcessorValueType2["ManuallyInput"] = 1] = "ManuallyInput";
  BulkModificationProcessorValueType2[BulkModificationProcessorValueType2["Variable"] = 2] = "Variable";
  return BulkModificationProcessorValueType2;
})(BulkModificationProcessorValueType || {});
const bulkModificationProcessorValueTypes = [
  {
    label: "ManuallyInput",
    value: 1
    /* ManuallyInput */
  },
  {
    label: "Variable",
    value: 2
    /* Variable */
  }
];
var CloseBehavior = /* @__PURE__ */ ((CloseBehavior2) => {
  CloseBehavior2[CloseBehavior2["Prompt"] = 0] = "Prompt";
  CloseBehavior2[CloseBehavior2["Exit"] = 1] = "Exit";
  CloseBehavior2[CloseBehavior2["Minimize"] = 2] = "Minimize";
  CloseBehavior2[CloseBehavior2["Cancel"] = 1e3] = "Cancel";
  return CloseBehavior2;
})(CloseBehavior || {});
var IconType = /* @__PURE__ */ ((IconType2) => {
  IconType2[IconType2["UnknownFile"] = 1] = "UnknownFile";
  IconType2[IconType2["Directory"] = 2] = "Directory";
  IconType2[IconType2["Dynamic"] = 3] = "Dynamic";
  return IconType2;
})(IconType || {});
var UiTheme = /* @__PURE__ */ ((UiTheme2) => {
  UiTheme2[UiTheme2["FollowSystem"] = 0] = "FollowSystem";
  UiTheme2[UiTheme2["Light"] = 1] = "Light";
  UiTheme2[UiTheme2["Dark"] = 2] = "Dark";
  return UiTheme2;
})(UiTheme || {});
var UpdaterStatus = /* @__PURE__ */ ((UpdaterStatus2) => {
  UpdaterStatus2[UpdaterStatus2["Idle"] = 1] = "Idle";
  UpdaterStatus2[UpdaterStatus2["Running"] = 2] = "Running";
  UpdaterStatus2[UpdaterStatus2["PendingRestart"] = 3] = "PendingRestart";
  UpdaterStatus2[UpdaterStatus2["UpToDate"] = 4] = "UpToDate";
  UpdaterStatus2[UpdaterStatus2["Failed"] = 5] = "Failed";
  return UpdaterStatus2;
})(UpdaterStatus || {});
const bangumiSubjectTypes = [
  {
    label: "All",
    value: 0
    /* All */
  },
  {
    label: "Anime",
    value: 1
    /* Anime */
  },
  {
    label: "Book",
    value: 2
    /* Book */
  },
  {
    label: "Music",
    value: 3
    /* Music */
  },
  {
    label: "Game",
    value: 4
    /* Game */
  },
  {
    label: "Real",
    value: 5
    /* Real */
  }
];
var ThirdPartyRequestResultType = /* @__PURE__ */ ((ThirdPartyRequestResultType2) => {
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Succeed"] = 1] = "Succeed";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["TimedOut"] = 2] = "TimedOut";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Banned"] = 3] = "Banned";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Canceled"] = 4] = "Canceled";
  ThirdPartyRequestResultType2[ThirdPartyRequestResultType2["Failed"] = 1e3] = "Failed";
  return ThirdPartyRequestResultType2;
})(ThirdPartyRequestResultType || {});
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
  LogLevel2[LogLevel2["Trace"] = 0] = "Trace";
  LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
  LogLevel2[LogLevel2["Information"] = 2] = "Information";
  LogLevel2[LogLevel2["Warning"] = 3] = "Warning";
  LogLevel2[LogLevel2["Error"] = 4] = "Error";
  LogLevel2[LogLevel2["Critical"] = 5] = "Critical";
  LogLevel2[LogLevel2["None"] = 6] = "None";
  return LogLevel2;
})(LogLevel || {});
var DecompressionStatus = /* @__PURE__ */ ((DecompressionStatus2) => {
  DecompressionStatus2[DecompressionStatus2["Pending"] = 1] = "Pending";
  DecompressionStatus2[DecompressionStatus2["Decompressing"] = 2] = "Decompressing";
  DecompressionStatus2[DecompressionStatus2["Success"] = 3] = "Success";
  DecompressionStatus2[DecompressionStatus2["Error"] = 4] = "Error";
  return DecompressionStatus2;
})(DecompressionStatus || {});
var CompressedFileDetectionResultStatus = /* @__PURE__ */ ((CompressedFileDetectionResultStatus2) => {
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Init"] = 1] = "Init";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Inprogress"] = 2] = "Inprogress";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Complete"] = 3] = "Complete";
  CompressedFileDetectionResultStatus2[CompressedFileDetectionResultStatus2["Error"] = 4] = "Error";
  return CompressedFileDetectionResultStatus2;
})(CompressedFileDetectionResultStatus || {});
const pathSeparator = "/";
const BusinessConstants = {
  pathSeparator,
  uncPathPrefix: pathSeparator + pathSeparator,
  DefaultResourceColumnCount: 6
};
const convertDurationToTime = (duration2) => {
  return new $35ea8db9cb2ccb90$export$680ea196effce5f(
    duration2.hours(),
    duration2.minutes(),
    duration2.seconds(),
    duration2.milliseconds()
  );
};
const convertTimeToDuration = (time2) => {
  return dayjs.duration({
    hours: time2.hour,
    minutes: time2.minute,
    seconds: time2.second,
    milliseconds: time2.millisecond
  });
};
function bytesToSize(bytes) {
  const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
  if (bytes == 0)
    return "0 Byte";
  const i2 = Math.floor(Math.floor(Math.log(bytes) / Math.log(1024)));
  return `${Math.round(bytes / Math.pow(1024, i2))} ${sizes[i2]}`;
}
function useTraceUpdate(props, logPrefix) {
  const prev2 = reactExports.useRef(props);
  reactExports.useEffect(() => {
    const changedProps = Object.entries(props).reduce((ps, [k2, v2]) => {
      if (prev2.current[k2] !== v2) {
        ps[k2] = [prev2.current[k2], v2];
      }
      return ps;
    }, {});
    if (Object.keys(changedProps).length > 0) {
      console.log(`${logPrefix}Changed props:`, changedProps);
    }
    prev2.current = props;
  });
}
function humanFileSize(bytes, si2 = false, dp = 1) {
  const thresh = si2 ? 1e3 : 1024;
  if (Math.abs(bytes) < thresh) {
    return `${bytes} B`;
  }
  const units = si2 ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
  let u2 = -1;
  const r2 = 10 ** dp;
  do {
    bytes /= thresh;
    ++u2;
  } while (Math.round(Math.abs(bytes) * r2) / r2 >= thresh && u2 < units.length - 1);
  return `${bytes.toFixed(dp)} ${units[u2]}`;
}
const layerRegex = "[^\\/]+";
const pathSeparatorInRegexStr = "\\/";
function buildLayerBasedPathRegexString(layer, extensions) {
  let reg = "^";
  for (let i2 = 0; i2 < layer; i2++) {
    reg += layerRegex;
    if (i2 < layer - 1) {
      reg += pathSeparatorInRegexStr;
    } else {
      if (extensions) {
        if (extensions.length > 0) {
          reg += `\\.(?:${extensions.map((e2) => e2.replace(/^\./, "").replaceAll(".", "\\.")).join("|")})`;
          break;
        }
      }
    }
  }
  reg += "$";
  return reg;
}
function getFileNameWithoutExtension(path) {
  if (path && path.length > 0) {
    const segments = path.split(".");
    const filename = segments[Math.max(0, segments.length - 2)];
    const segments2 = filename.split("!");
    return segments2[segments2.length - 1];
  } else {
    return void 0;
  }
}
function uuidv4() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c2) => {
    let r2 = Math.random() * 16 | 0, v2 = c2 == "x" ? r2 : r2 & 3 | 8;
    return v2.toString(16);
  });
}
function findCapturingGroupsInRegex(regex2) {
  var _a2;
  return ((_a2 = regex2 == null ? void 0 : regex2.match(/\(\?<(\w+)>/g)) == null ? void 0 : _a2.map((match5) => match5.slice(3, -1))) || [];
}
function createPortalOfComponent(Component2, props) {
  const key = uuidv4();
  const node2 = document.createElement("div");
  document.body.appendChild(node2);
  const root2 = client.createRoot(node2);
  const unmount = () => {
    console.log("Unmounting", key);
    setTimeout(() => {
      root2.unmount();
      node2.remove();
    }, 1);
  };
  console.log("Mounting", key);
  root2.render(
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Component2,
      {
        ...props,
        afterClose: () => {
          if (props.afterClose) {
            props.afterClose();
          }
          unmount();
        }
      }
    )
  );
  return {
    key,
    close: unmount
  };
}
function standardizePath(path) {
  if (path == void 0) {
    return;
  }
  const np = path.replace(/\\/g, BusinessConstants.pathSeparator);
  if (isUncPath$1(path) && !np.startsWith(BusinessConstants.uncPathPrefix)) {
    return `${BusinessConstants.uncPathPrefix}${np}`;
  }
  return np;
}
function getStandardParentPath(path) {
  if (path === void 0) {
    return void 0;
  }
  if (path === "") {
    return void 0;
  }
  const stdPath = standardizePath(path);
  const segments = splitPathIntoSegments(stdPath);
  if (segments.length <= 1) {
    const match22 = stdPath.match(/^([\\/]+)(.*)/);
    const prefix2 = match22 ? match22[1] : "";
    if (prefix2 && segments.length === 1 && stdPath !== prefix2) {
      return prefix2;
    }
    return "";
  }
  const suffix = segments.slice(0, -1).join(BusinessConstants.pathSeparator);
  const match5 = stdPath.match(/^([\\/]+)(.*)/);
  const prefix = match5 ? match5[1] : "";
  return `${prefix}${suffix}`;
}
function buildLogger(key) {
  return ((...args) => {
    return Function.prototype.bind.call(
      console.log,
      console,
      chalk$1.blue(`[${key}]`)
    );
  })();
}
function createSelection(field, start, end) {
  if (field.createTextRange) {
    const selRange = field.createTextRange();
    selRange.collapse(true);
    selRange.moveStart("character", start);
    selRange.moveEnd("character", end);
    selRange.select();
    field.focus();
  } else if (field.setSelectionRange) {
    field.focus();
    field.setSelectionRange(start, end);
  } else if (typeof field.selectionStart !== "undefined") {
    field.selectionStart = start;
    field.selectionEnd = end;
    field.focus();
  }
}
function isString$2(value2) {
  return typeof value2 === "string" || value2 instanceof String;
}
function forceFocus(nodeOrQuery) {
  let dom;
  if (isString$2(nodeOrQuery)) {
    const query = nodeOrQuery;
    console.log(query);
    dom = document.querySelector(query);
  } else {
    dom = nodeOrQuery;
  }
  if (dom) {
    dom.setAttribute("tabindex", "0");
    dom.focus();
  }
}
function execAll(regex2, str, maxCount) {
  const newReg = new RegExp(regex2, "g");
  return str.matchAll(newReg);
}
function splitPathIntoSegments(path) {
  const sp = standardizePath(path);
  const segments = sp.split(BusinessConstants.pathSeparator).filter((a2) => (a2 == null ? void 0 : a2.length) > 0);
  if (sp.startsWith(BusinessConstants.uncPathPrefix)) {
    segments[0] = `${BusinessConstants.uncPathPrefix}${segments[0]}`;
  }
  return segments;
}
function splitStringWithEscapeChar(str, separator, escapeChar) {
  if (str.length === 0) {
    return null;
  }
  const result = [];
  let idx = 0;
  while (idx <= str.length) {
    let nextIdx = idx;
    while (true) {
      nextIdx = str.indexOf(separator, nextIdx);
      if (nextIdx > 0) {
        if (str[nextIdx - 1] === escapeChar) {
          nextIdx++;
          continue;
        }
      }
      break;
    }
    if (nextIdx === -1) {
      result.push(str.substring(idx));
      break;
    }
    result.push(str.substring(idx, nextIdx));
    idx = nextIdx + 1;
  }
  return result.map(
    (r2) => r2.replaceAll(`${escapeChar}${separator}`, separator)
  );
}
function joinWithEscapeChar(data, separator, escapeChar) {
  return data.map(
    (d2) => d2 == null ? void 0 : d2.replace(new RegExp(separator, "g"), `${escapeChar}${separator}`)
  ).join(separator);
}
const getUiTheme = (uiTheme) => {
  let theme2 = uiTheme ?? UiTheme.FollowSystem;
  if (theme2 == UiTheme.FollowSystem) {
    if (typeof window !== "undefined" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
      theme2 = UiTheme.Dark;
    } else {
      theme2 = UiTheme.Light;
    }
  }
  return theme2;
};
const buildUntitledLabel = (translation, existed) => {
  let i2 = 1;
  while (true) {
    const label = `${translation} ${i2}`;
    if (!existed || existed.length == 0 || !existed.includes(label)) {
      return label;
    }
    i2++;
  }
};
function adjustAlpha(color2, alphaAdjustment) {
  if (color2.startsWith("#")) {
    return hexToRGBAWithAlpha(color2, alphaAdjustment);
  } else if (color2.startsWith("rgb")) {
    return adjustRGBAWithAlpha(color2, alphaAdjustment);
  } else if (color2.startsWith("hsl")) {
    return adjustHSLAWithAlpha(color2, alphaAdjustment);
  } else {
    throw new Error("Unsupported color format");
  }
}
function hexToRGBAWithAlpha(hex3, alphaAdjustment) {
  hex3 = hex3.replace(/^#/, "");
  if (hex3.length === 3) {
    hex3 = hex3.split("").map((char2) => char2 + char2).join("");
  }
  const r2 = parseInt(hex3.substring(0, 2), 16);
  const g2 = parseInt(hex3.substring(2, 4), 16);
  const b2 = parseInt(hex3.substring(4, 6), 16);
  const adjustedAlpha = Math.min(1, Math.max(0, alphaAdjustment));
  return `rgba(${r2}, ${g2}, ${b2}, ${adjustedAlpha})`;
}
function adjustRGBAWithAlpha(rgba2, alphaAdjustment) {
  const match5 = rgba2.match(
    /rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d+\.?\d*))?\)/
  );
  if (!match5)
    throw new Error("Invalid RGB(A) format");
  const [_24, r2, g2, b2, a2 = 1] = match5.map(Number);
  const adjustedAlpha = Math.min(1, Math.max(0, a2 * alphaAdjustment));
  return `rgba(${r2}, ${g2}, ${b2}, ${adjustedAlpha})`;
}
function adjustHSLAWithAlpha(hsla2, alphaAdjustment) {
  const match5 = hsla2.match(
    /hsla?\((\d+),\s*(\d+)%,\s*(\d+)%(,\s*(\d+\.?\d*))?\)/
  );
  if (!match5)
    throw new Error("Invalid HSL(A) format");
  const [_24, h3, s2, l2, a2 = 1] = match5.map(Number);
  const adjustedAlpha = Math.min(1, Math.max(0, a2 * alphaAdjustment));
  return `hsla(${h3}, ${s2}%, ${l2}%, ${adjustedAlpha})`;
}
function autoBackgroundColor(color2) {
  return adjustAlpha(color2, 0.2);
}
function generateNextWithPrefix(prefix, currentList) {
  const regex2 = new RegExp(`^${prefix} (\\d+)$`);
  const numbers2 = currentList.map((item) => {
    const match5 = item.match(regex2);
    return match5 ? parseInt(match5[1], 10) : null;
  }).filter((num) => num !== null);
  const nextNumber = numbers2.length ? Math.max(...numbers2) + 1 : 1;
  return `${prefix} ${nextNumber}`;
}
function hasCircleReference(data, all3, getKey3, getChildKey2) {
  const visited = /* @__PURE__ */ new Set();
  let current = data;
  while (current) {
    const key = getKey3(current);
    if (visited.has(key)) {
      return true;
    }
    visited.add(key);
    const childKey = getChildKey2(current);
    if (childKey === void 0 || childKey === null) {
      return false;
    }
    current = all3.find((item) => getKey3(item) === childKey);
  }
  return false;
}
function willCauseCircleReference(parent, childKey, all3, getKey3, getChildKey2, setChildKey) {
  const prevChildKey = getChildKey2(parent);
  setChildKey(parent, childKey);
  const hasCircle = hasCircleReference(parent, all3, getKey3, getChildKey2);
  setChildKey(parent, prevChildKey);
  return hasCircle;
}
function isPromise(value2) {
  return !!value2 && typeof value2 === "object" && typeof value2.then === "function";
}
function extractErrorMessage(error2) {
  if (typeof error2 === "string") {
    return error2;
  }
  if (error2 && typeof error2 === "object") {
    if ("message" in error2 && typeof error2.message === "string") {
      return error2.message;
    }
    if (typeof error2.toString === "function") {
      return error2.toString();
    }
  }
  return "Unknown error";
}
const log$J = buildLogger("DateInput");
const convertToCalendarDateTime = (value2) => {
  if (!value2) {
    return;
  }
  const date4 = value2.toDate();
  return new $35ea8db9cb2ccb90$export$ca871e8dbb80966f(
    date4.getFullYear(),
    date4.getMonth() + 1,
    date4.getDate(),
    date4.getHours(),
    date4.getMinutes(),
    date4.getSeconds(),
    date4.getMilliseconds()
  );
};
const DateInput = ({
  value: propsValue,
  onChange,
  defaultValue: defaultValue2,
  ...props
}) => {
  const [value2, setValue] = reactExports.useState();
  log$J(propsValue);
  log$J(propsValue, propsValue == null ? void 0 : propsValue.toISOString(), value2, propsValue == null ? void 0 : propsValue.toDate());
  reactExports.useEffect(() => {
    setValue(convertToCalendarDateTime(propsValue));
  }, [propsValue]);
  const dv = convertToCalendarDateTime(defaultValue2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    date_input_default,
    {
      "aria-label": "Date Input",
      defaultValue: dv,
      hourCycle: 24,
      value: value2,
      onChange: (v2) => {
        onChange == null ? void 0 : onChange(v2 ? dayjs(v2.toString()) : void 0);
      },
      ...props
    }
  );
};
DateInput.displayName = "DateInput";
const TimeInput = ({
  value: value2,
  onChange,
  defaultValue: defaultValue2,
  ...props
}) => {
  const dv = defaultValue2 ? convertDurationToTime(defaultValue2) : void 0;
  const v2 = value2 ? convertDurationToTime(value2) : void 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    time_input_default,
    {
      defaultValue: dv,
      hourCycle: 24,
      value: v2,
      onChange: (v22) => {
        onChange == null ? void 0 : onChange(convertTimeToDuration(v22));
      },
      ...props
    }
  );
};
TimeInput.displayName = "TimeInput";
var Rate$1 = {};
var interopRequireDefault = { exports: {} };
(function(module2) {
  function _interopRequireDefault2(e2) {
    return e2 && e2.__esModule ? e2 : {
      "default": e2
    };
  }
  module2.exports = _interopRequireDefault2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
})(interopRequireDefault);
var interopRequireDefaultExports = interopRequireDefault.exports;
var _extends$3 = { exports: {} };
var hasRequired_extends;
function require_extends() {
  if (hasRequired_extends)
    return _extends$3.exports;
  hasRequired_extends = 1;
  (function(module2) {
    function _extends3() {
      return module2.exports = _extends3 = Object.assign ? Object.assign.bind() : function(n2) {
        for (var e2 = 1; e2 < arguments.length; e2++) {
          var t2 = arguments[e2];
          for (var r2 in t2)
            ({}).hasOwnProperty.call(t2, r2) && (n2[r2] = t2[r2]);
        }
        return n2;
      }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports, _extends3.apply(null, arguments);
    }
    module2.exports = _extends3, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(_extends$3);
  return _extends$3.exports;
}
const require$$2 = /* @__PURE__ */ getAugmentedNamespace(defineProperty$5);
const require$$3$1 = /* @__PURE__ */ getAugmentedNamespace(slicedToArray);
const require$$4 = /* @__PURE__ */ getAugmentedNamespace(objectWithoutProperties);
var useMergedState = {};
var useEvent$1 = {};
var interopRequireWildcard = { exports: {} };
var _typeof = { exports: {} };
var hasRequired_typeof;
function require_typeof() {
  if (hasRequired_typeof)
    return _typeof.exports;
  hasRequired_typeof = 1;
  (function(module2) {
    function _typeof2(o2) {
      "@babel/helpers - typeof";
      return module2.exports = _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o3) {
        return typeof o3;
      } : function(o3) {
        return o3 && "function" == typeof Symbol && o3.constructor === Symbol && o3 !== Symbol.prototype ? "symbol" : typeof o3;
      }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports, _typeof2(o2);
    }
    module2.exports = _typeof2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(_typeof);
  return _typeof.exports;
}
var hasRequiredInteropRequireWildcard;
function requireInteropRequireWildcard() {
  if (hasRequiredInteropRequireWildcard)
    return interopRequireWildcard.exports;
  hasRequiredInteropRequireWildcard = 1;
  (function(module2) {
    var _typeof2 = require_typeof()["default"];
    function _interopRequireWildcard2(e2, t2) {
      if ("function" == typeof WeakMap)
        var r2 = /* @__PURE__ */ new WeakMap(), n2 = /* @__PURE__ */ new WeakMap();
      return (module2.exports = _interopRequireWildcard2 = function _interopRequireWildcard3(e3, t3) {
        if (!t3 && e3 && e3.__esModule)
          return e3;
        var o2, i2, f2 = {
          __proto__: null,
          "default": e3
        };
        if (null === e3 || "object" != _typeof2(e3) && "function" != typeof e3)
          return f2;
        if (o2 = t3 ? n2 : r2) {
          if (o2.has(e3))
            return o2.get(e3);
          o2.set(e3, f2);
        }
        for (var _t in e3)
          "default" !== _t && {}.hasOwnProperty.call(e3, _t) && ((i2 = (o2 = Object.defineProperty) && Object.getOwnPropertyDescriptor(e3, _t)) && (i2.get || i2.set) ? o2(f2, _t, i2) : f2[_t] = e3[_t]);
        return f2;
      }, module2.exports.__esModule = true, module2.exports["default"] = module2.exports)(e2, t2);
    }
    module2.exports = _interopRequireWildcard2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(interopRequireWildcard);
  return interopRequireWildcard.exports;
}
var hasRequiredUseEvent;
function requireUseEvent() {
  if (hasRequiredUseEvent)
    return useEvent$1;
  hasRequiredUseEvent = 1;
  var _interopRequireWildcard2 = requireInteropRequireWildcard().default;
  Object.defineProperty(useEvent$1, "__esModule", {
    value: true
  });
  useEvent$1.default = useEvent2;
  var React2 = _interopRequireWildcard2(reactExports);
  function useEvent2(callback2) {
    var fnRef = React2.useRef();
    fnRef.current = callback2;
    var memoFn = React2.useCallback(function() {
      var _fnRef$current;
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [fnRef].concat(args));
    }, []);
    return memoFn;
  }
  return useEvent$1;
}
var useLayoutEffect = {};
var canUseDom = {};
var hasRequiredCanUseDom;
function requireCanUseDom() {
  if (hasRequiredCanUseDom)
    return canUseDom;
  hasRequiredCanUseDom = 1;
  Object.defineProperty(canUseDom, "__esModule", {
    value: true
  });
  canUseDom.default = canUseDom$12;
  function canUseDom$12() {
    return !!(typeof window !== "undefined" && window.document && window.document.createElement);
  }
  return canUseDom;
}
var hasRequiredUseLayoutEffect;
function requireUseLayoutEffect() {
  if (hasRequiredUseLayoutEffect)
    return useLayoutEffect;
  hasRequiredUseLayoutEffect = 1;
  var _interopRequireDefault2 = interopRequireDefaultExports.default;
  var _interopRequireWildcard2 = requireInteropRequireWildcard().default;
  Object.defineProperty(useLayoutEffect, "__esModule", {
    value: true
  });
  useLayoutEffect.useLayoutUpdateEffect = useLayoutEffect.default = void 0;
  var React2 = _interopRequireWildcard2(reactExports);
  var _canUseDom = _interopRequireDefault2(requireCanUseDom());
  var useInternalLayoutEffect2 = (0, _canUseDom.default)() ? React2.useLayoutEffect : React2.useEffect;
  var useLayoutEffect$12 = function useLayoutEffect22(callback2, deps) {
    var firstMountRef = React2.useRef(true);
    useInternalLayoutEffect2(function() {
      return callback2(firstMountRef.current);
    }, deps);
    useInternalLayoutEffect2(function() {
      firstMountRef.current = false;
      return function() {
        firstMountRef.current = true;
      };
    }, []);
  };
  useLayoutEffect.useLayoutUpdateEffect = function useLayoutUpdateEffect22(callback2, deps) {
    useLayoutEffect$12(function(firstMount) {
      if (!firstMount) {
        return callback2();
      }
    }, deps);
  };
  useLayoutEffect.default = useLayoutEffect$12;
  return useLayoutEffect;
}
var useState = {};
var hasRequiredUseState;
function requireUseState() {
  if (hasRequiredUseState)
    return useState;
  hasRequiredUseState = 1;
  var _interopRequireWildcard2 = requireInteropRequireWildcard().default;
  var _interopRequireDefault2 = interopRequireDefaultExports.default;
  Object.defineProperty(useState, "__esModule", {
    value: true
  });
  useState.default = useSafeState2;
  var _slicedToArray22 = _interopRequireDefault2(require$$3$1);
  var React2 = _interopRequireWildcard2(reactExports);
  function useSafeState2(defaultValue2) {
    var destroyRef = React2.useRef(false);
    var _React$useState = React2.useState(defaultValue2), _React$useState2 = (0, _slicedToArray22.default)(_React$useState, 2), value2 = _React$useState2[0], setValue = _React$useState2[1];
    React2.useEffect(function() {
      destroyRef.current = false;
      return function() {
        destroyRef.current = true;
      };
    }, []);
    function safeSetState(updater, ignoreDestroy) {
      if (ignoreDestroy && destroyRef.current) {
        return;
      }
      setValue(updater);
    }
    return [value2, safeSetState];
  }
  return useState;
}
var hasRequiredUseMergedState;
function requireUseMergedState() {
  if (hasRequiredUseMergedState)
    return useMergedState;
  hasRequiredUseMergedState = 1;
  var _interopRequireDefault2 = interopRequireDefaultExports.default;
  Object.defineProperty(useMergedState, "__esModule", {
    value: true
  });
  useMergedState.default = useMergedState$12;
  var _slicedToArray22 = _interopRequireDefault2(require$$3$1);
  var _useEvent = _interopRequireDefault2(requireUseEvent());
  var _useLayoutEffect = requireUseLayoutEffect();
  var _useState5 = _interopRequireDefault2(requireUseState());
  function hasValue2(value2) {
    return value2 !== void 0;
  }
  function useMergedState$12(defaultStateValue, option) {
    var _ref = option || {}, defaultValue2 = _ref.defaultValue, value2 = _ref.value, onChange = _ref.onChange, postState = _ref.postState;
    var _useState = (0, _useState5.default)(function() {
      if (hasValue2(value2)) {
        return value2;
      } else if (hasValue2(defaultValue2)) {
        return typeof defaultValue2 === "function" ? defaultValue2() : defaultValue2;
      } else {
        return typeof defaultStateValue === "function" ? defaultStateValue() : defaultStateValue;
      }
    }), _useState2 = (0, _slicedToArray22.default)(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1];
    var mergedValue = value2 !== void 0 ? value2 : innerValue;
    var postMergedValue = postState ? postState(mergedValue) : mergedValue;
    var onChangeFn = (0, _useEvent.default)(onChange);
    var _useState3 = (0, _useState5.default)([mergedValue]), _useState4 = (0, _slicedToArray22.default)(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1];
    (0, _useLayoutEffect.useLayoutUpdateEffect)(function() {
      var prev2 = prevValue[0];
      if (innerValue !== prev2) {
        onChangeFn(innerValue, prev2);
      }
    }, [prevValue]);
    (0, _useLayoutEffect.useLayoutUpdateEffect)(function() {
      if (!hasValue2(value2)) {
        setInnerValue(value2);
      }
    }, [value2]);
    var triggerChange = (0, _useEvent.default)(function(updater, ignoreDestroy) {
      setInnerValue(updater, ignoreDestroy);
      setPrevValue([mergedValue], ignoreDestroy);
    });
    return [postMergedValue, triggerChange];
  }
  return useMergedState;
}
var KeyCode = {};
var hasRequiredKeyCode;
function requireKeyCode() {
  if (hasRequiredKeyCode)
    return KeyCode;
  hasRequiredKeyCode = 1;
  Object.defineProperty(KeyCode, "__esModule", {
    value: true
  });
  KeyCode.default = void 0;
  var KeyCode$12 = {
    /**
     * MAC_ENTER
     */
    MAC_ENTER: 3,
    /**
     * BACKSPACE
     */
    BACKSPACE: 8,
    /**
     * TAB
     */
    TAB: 9,
    /**
     * NUMLOCK on FF/Safari Mac
     */
    NUM_CENTER: 12,
    // NUMLOCK on FF/Safari Mac
    /**
     * ENTER
     */
    ENTER: 13,
    /**
     * SHIFT
     */
    SHIFT: 16,
    /**
     * CTRL
     */
    CTRL: 17,
    /**
     * ALT
     */
    ALT: 18,
    /**
     * PAUSE
     */
    PAUSE: 19,
    /**
     * CAPS_LOCK
     */
    CAPS_LOCK: 20,
    /**
     * ESC
     */
    ESC: 27,
    /**
     * SPACE
     */
    SPACE: 32,
    /**
     * PAGE_UP
     */
    PAGE_UP: 33,
    // also NUM_NORTH_EAST
    /**
     * PAGE_DOWN
     */
    PAGE_DOWN: 34,
    // also NUM_SOUTH_EAST
    /**
     * END
     */
    END: 35,
    // also NUM_SOUTH_WEST
    /**
     * HOME
     */
    HOME: 36,
    // also NUM_NORTH_WEST
    /**
     * LEFT
     */
    LEFT: 37,
    // also NUM_WEST
    /**
     * UP
     */
    UP: 38,
    // also NUM_NORTH
    /**
     * RIGHT
     */
    RIGHT: 39,
    // also NUM_EAST
    /**
     * DOWN
     */
    DOWN: 40,
    // also NUM_SOUTH
    /**
     * PRINT_SCREEN
     */
    PRINT_SCREEN: 44,
    /**
     * INSERT
     */
    INSERT: 45,
    // also NUM_INSERT
    /**
     * DELETE
     */
    DELETE: 46,
    // also NUM_DELETE
    /**
     * ZERO
     */
    ZERO: 48,
    /**
     * ONE
     */
    ONE: 49,
    /**
     * TWO
     */
    TWO: 50,
    /**
     * THREE
     */
    THREE: 51,
    /**
     * FOUR
     */
    FOUR: 52,
    /**
     * FIVE
     */
    FIVE: 53,
    /**
     * SIX
     */
    SIX: 54,
    /**
     * SEVEN
     */
    SEVEN: 55,
    /**
     * EIGHT
     */
    EIGHT: 56,
    /**
     * NINE
     */
    NINE: 57,
    /**
     * QUESTION_MARK
     */
    QUESTION_MARK: 63,
    // needs localization
    /**
     * A
     */
    A: 65,
    /**
     * B
     */
    B: 66,
    /**
     * C
     */
    C: 67,
    /**
     * D
     */
    D: 68,
    /**
     * E
     */
    E: 69,
    /**
     * F
     */
    F: 70,
    /**
     * G
     */
    G: 71,
    /**
     * H
     */
    H: 72,
    /**
     * I
     */
    I: 73,
    /**
     * J
     */
    J: 74,
    /**
     * K
     */
    K: 75,
    /**
     * L
     */
    L: 76,
    /**
     * M
     */
    M: 77,
    /**
     * N
     */
    N: 78,
    /**
     * O
     */
    O: 79,
    /**
     * P
     */
    P: 80,
    /**
     * Q
     */
    Q: 81,
    /**
     * R
     */
    R: 82,
    /**
     * S
     */
    S: 83,
    /**
     * T
     */
    T: 84,
    /**
     * U
     */
    U: 85,
    /**
     * V
     */
    V: 86,
    /**
     * W
     */
    W: 87,
    /**
     * X
     */
    X: 88,
    /**
     * Y
     */
    Y: 89,
    /**
     * Z
     */
    Z: 90,
    /**
     * META
     */
    META: 91,
    // WIN_KEY_LEFT
    /**
     * WIN_KEY_RIGHT
     */
    WIN_KEY_RIGHT: 92,
    /**
     * CONTEXT_MENU
     */
    CONTEXT_MENU: 93,
    /**
     * NUM_ZERO
     */
    NUM_ZERO: 96,
    /**
     * NUM_ONE
     */
    NUM_ONE: 97,
    /**
     * NUM_TWO
     */
    NUM_TWO: 98,
    /**
     * NUM_THREE
     */
    NUM_THREE: 99,
    /**
     * NUM_FOUR
     */
    NUM_FOUR: 100,
    /**
     * NUM_FIVE
     */
    NUM_FIVE: 101,
    /**
     * NUM_SIX
     */
    NUM_SIX: 102,
    /**
     * NUM_SEVEN
     */
    NUM_SEVEN: 103,
    /**
     * NUM_EIGHT
     */
    NUM_EIGHT: 104,
    /**
     * NUM_NINE
     */
    NUM_NINE: 105,
    /**
     * NUM_MULTIPLY
     */
    NUM_MULTIPLY: 106,
    /**
     * NUM_PLUS
     */
    NUM_PLUS: 107,
    /**
     * NUM_MINUS
     */
    NUM_MINUS: 109,
    /**
     * NUM_PERIOD
     */
    NUM_PERIOD: 110,
    /**
     * NUM_DIVISION
     */
    NUM_DIVISION: 111,
    /**
     * F1
     */
    F1: 112,
    /**
     * F2
     */
    F2: 113,
    /**
     * F3
     */
    F3: 114,
    /**
     * F4
     */
    F4: 115,
    /**
     * F5
     */
    F5: 116,
    /**
     * F6
     */
    F6: 117,
    /**
     * F7
     */
    F7: 118,
    /**
     * F8
     */
    F8: 119,
    /**
     * F9
     */
    F9: 120,
    /**
     * F10
     */
    F10: 121,
    /**
     * F11
     */
    F11: 122,
    /**
     * F12
     */
    F12: 123,
    /**
     * NUMLOCK
     */
    NUMLOCK: 144,
    /**
     * SEMICOLON
     */
    SEMICOLON: 186,
    // needs localization
    /**
     * DASH
     */
    DASH: 189,
    // needs localization
    /**
     * EQUALS
     */
    EQUALS: 187,
    // needs localization
    /**
     * COMMA
     */
    COMMA: 188,
    // needs localization
    /**
     * PERIOD
     */
    PERIOD: 190,
    // needs localization
    /**
     * SLASH
     */
    SLASH: 191,
    // needs localization
    /**
     * APOSTROPHE
     */
    APOSTROPHE: 192,
    // needs localization
    /**
     * SINGLE_QUOTE
     */
    SINGLE_QUOTE: 222,
    // needs localization
    /**
     * OPEN_SQUARE_BRACKET
     */
    OPEN_SQUARE_BRACKET: 219,
    // needs localization
    /**
     * BACKSLASH
     */
    BACKSLASH: 220,
    // needs localization
    /**
     * CLOSE_SQUARE_BRACKET
     */
    CLOSE_SQUARE_BRACKET: 221,
    // needs localization
    /**
     * WIN_KEY
     */
    WIN_KEY: 224,
    /**
     * MAC_FF_META
     */
    MAC_FF_META: 224,
    // Firefox (Gecko) fires this for the meta key instead of 91
    /**
     * WIN_IME
     */
    WIN_IME: 229,
    // ======================== Function ========================
    /**
     * whether text and modified key is entered at the same time.
     */
    isTextModifyingKeyEvent: function isTextModifyingKeyEvent(e2) {
      var keyCode = e2.keyCode;
      if (e2.altKey && !e2.ctrlKey || e2.metaKey || // Function keys don't generate text
      keyCode >= KeyCode$12.F1 && keyCode <= KeyCode$12.F12) {
        return false;
      }
      switch (keyCode) {
        case KeyCode$12.ALT:
        case KeyCode$12.CAPS_LOCK:
        case KeyCode$12.CONTEXT_MENU:
        case KeyCode$12.CTRL:
        case KeyCode$12.DOWN:
        case KeyCode$12.END:
        case KeyCode$12.ESC:
        case KeyCode$12.HOME:
        case KeyCode$12.INSERT:
        case KeyCode$12.LEFT:
        case KeyCode$12.MAC_FF_META:
        case KeyCode$12.META:
        case KeyCode$12.NUMLOCK:
        case KeyCode$12.NUM_CENTER:
        case KeyCode$12.PAGE_DOWN:
        case KeyCode$12.PAGE_UP:
        case KeyCode$12.PAUSE:
        case KeyCode$12.PRINT_SCREEN:
        case KeyCode$12.RIGHT:
        case KeyCode$12.SHIFT:
        case KeyCode$12.UP:
        case KeyCode$12.WIN_KEY:
        case KeyCode$12.WIN_KEY_RIGHT:
          return false;
        default:
          return true;
      }
    },
    /**
     * whether character is entered.
     */
    isCharacterKey: function isCharacterKey(keyCode) {
      if (keyCode >= KeyCode$12.ZERO && keyCode <= KeyCode$12.NINE) {
        return true;
      }
      if (keyCode >= KeyCode$12.NUM_ZERO && keyCode <= KeyCode$12.NUM_MULTIPLY) {
        return true;
      }
      if (keyCode >= KeyCode$12.A && keyCode <= KeyCode$12.Z) {
        return true;
      }
      if (window.navigator.userAgent.indexOf("WebKit") !== -1 && keyCode === 0) {
        return true;
      }
      switch (keyCode) {
        case KeyCode$12.SPACE:
        case KeyCode$12.QUESTION_MARK:
        case KeyCode$12.NUM_PLUS:
        case KeyCode$12.NUM_MINUS:
        case KeyCode$12.NUM_PERIOD:
        case KeyCode$12.NUM_DIVISION:
        case KeyCode$12.SEMICOLON:
        case KeyCode$12.DASH:
        case KeyCode$12.EQUALS:
        case KeyCode$12.COMMA:
        case KeyCode$12.PERIOD:
        case KeyCode$12.SLASH:
        case KeyCode$12.APOSTROPHE:
        case KeyCode$12.SINGLE_QUOTE:
        case KeyCode$12.OPEN_SQUARE_BRACKET:
        case KeyCode$12.BACKSLASH:
        case KeyCode$12.CLOSE_SQUARE_BRACKET:
          return true;
        default:
          return false;
      }
    }
  };
  KeyCode.default = KeyCode$12;
  return KeyCode;
}
var pickAttrs = {};
var objectSpread2 = { exports: {} };
var defineProperty$1 = { exports: {} };
var toPropertyKey = { exports: {} };
var toPrimitive = { exports: {} };
var hasRequiredToPrimitive;
function requireToPrimitive() {
  if (hasRequiredToPrimitive)
    return toPrimitive.exports;
  hasRequiredToPrimitive = 1;
  (function(module2) {
    var _typeof2 = require_typeof()["default"];
    function toPrimitive2(t2, r2) {
      if ("object" != _typeof2(t2) || !t2)
        return t2;
      var e2 = t2[Symbol.toPrimitive];
      if (void 0 !== e2) {
        var i2 = e2.call(t2, r2 || "default");
        if ("object" != _typeof2(i2))
          return i2;
        throw new TypeError("@@toPrimitive must return a primitive value.");
      }
      return ("string" === r2 ? String : Number)(t2);
    }
    module2.exports = toPrimitive2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(toPrimitive);
  return toPrimitive.exports;
}
var hasRequiredToPropertyKey;
function requireToPropertyKey() {
  if (hasRequiredToPropertyKey)
    return toPropertyKey.exports;
  hasRequiredToPropertyKey = 1;
  (function(module2) {
    var _typeof2 = require_typeof()["default"];
    var toPrimitive2 = requireToPrimitive();
    function toPropertyKey2(t2) {
      var i2 = toPrimitive2(t2, "string");
      return "symbol" == _typeof2(i2) ? i2 : i2 + "";
    }
    module2.exports = toPropertyKey2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(toPropertyKey);
  return toPropertyKey.exports;
}
var hasRequiredDefineProperty;
function requireDefineProperty() {
  if (hasRequiredDefineProperty)
    return defineProperty$1.exports;
  hasRequiredDefineProperty = 1;
  (function(module2) {
    var toPropertyKey2 = requireToPropertyKey();
    function _defineProperty3(e2, r2, t2) {
      return (r2 = toPropertyKey2(r2)) in e2 ? Object.defineProperty(e2, r2, {
        value: t2,
        enumerable: true,
        configurable: true,
        writable: true
      }) : e2[r2] = t2, e2;
    }
    module2.exports = _defineProperty3, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(defineProperty$1);
  return defineProperty$1.exports;
}
var hasRequiredObjectSpread2;
function requireObjectSpread2() {
  if (hasRequiredObjectSpread2)
    return objectSpread2.exports;
  hasRequiredObjectSpread2 = 1;
  (function(module2) {
    var defineProperty2 = requireDefineProperty();
    function ownKeys2(e2, r2) {
      var t2 = Object.keys(e2);
      if (Object.getOwnPropertySymbols) {
        var o2 = Object.getOwnPropertySymbols(e2);
        r2 && (o2 = o2.filter(function(r3) {
          return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
        })), t2.push.apply(t2, o2);
      }
      return t2;
    }
    function _objectSpread22(e2) {
      for (var r2 = 1; r2 < arguments.length; r2++) {
        var t2 = null != arguments[r2] ? arguments[r2] : {};
        r2 % 2 ? ownKeys2(Object(t2), true).forEach(function(r3) {
          defineProperty2(e2, r3, t2[r3]);
        }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys2(Object(t2)).forEach(function(r3) {
          Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
        });
      }
      return e2;
    }
    module2.exports = _objectSpread22, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
  })(objectSpread2);
  return objectSpread2.exports;
}
var hasRequiredPickAttrs;
function requirePickAttrs() {
  if (hasRequiredPickAttrs)
    return pickAttrs;
  hasRequiredPickAttrs = 1;
  var _interopRequireDefault2 = interopRequireDefaultExports.default;
  Object.defineProperty(pickAttrs, "__esModule", {
    value: true
  });
  pickAttrs.default = pickAttrs$12;
  var _objectSpread22 = _interopRequireDefault2(requireObjectSpread2());
  var attributes2 = "accept acceptCharset accessKey action allowFullScreen allowTransparency\n    alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge\n    charSet checked classID className colSpan cols content contentEditable contextMenu\n    controls coords crossOrigin data dateTime default defer dir disabled download draggable\n    encType form formAction formEncType formMethod formNoValidate formTarget frameBorder\n    headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity\n    is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media\n    mediaGroup method min minLength multiple muted name noValidate nonce open\n    optimum pattern placeholder poster preload radioGroup readOnly rel required\n    reversed role rowSpan rows sandbox scope scoped scrolling seamless selected\n    shape size sizes span spellCheck src srcDoc srcLang srcSet start step style\n    summary tabIndex target title type useMap value width wmode wrap";
  var eventsName2 = "onCopy onCut onPaste onCompositionEnd onCompositionStart onCompositionUpdate onKeyDown\n    onKeyPress onKeyUp onFocus onBlur onChange onInput onSubmit onClick onContextMenu onDoubleClick\n    onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver onDragStart onDrop onMouseDown\n    onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel\n    onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough\n    onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata\n    onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError";
  var propList2 = "".concat(attributes2, " ").concat(eventsName2).split(/[\s\n]+/);
  var ariaPrefix2 = "aria-";
  var dataPrefix2 = "data-";
  function match5(key, prefix) {
    return key.indexOf(prefix) === 0;
  }
  function pickAttrs$12(props) {
    var ariaOnly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
    var mergedConfig;
    if (ariaOnly === false) {
      mergedConfig = {
        aria: true,
        data: true,
        attr: true
      };
    } else if (ariaOnly === true) {
      mergedConfig = {
        aria: true
      };
    } else {
      mergedConfig = (0, _objectSpread22.default)({}, ariaOnly);
    }
    var attrs = {};
    Object.keys(props).forEach(function(key) {
      if (
        // Aria
        mergedConfig.aria && (key === "role" || match5(key, ariaPrefix2)) || // Data
        mergedConfig.data && match5(key, dataPrefix2) || // Attr
        mergedConfig.attr && propList2.includes(key)
      ) {
        attrs[key] = props[key];
      }
    });
    return attrs;
  }
  return pickAttrs;
}
var Star = {};
var hasRequiredStar;
function requireStar() {
  if (hasRequiredStar)
    return Star;
  hasRequiredStar = 1;
  var _interopRequireDefault2 = interopRequireDefaultExports;
  Object.defineProperty(Star, "__esModule", {
    value: true
  });
  Star.default = void 0;
  var _react3 = _interopRequireDefault2(reactExports);
  var _KeyCode2 = _interopRequireDefault2(requireKeyCode());
  var _classnames2 = _interopRequireDefault2(classnamesExports);
  function Star$1(props, ref) {
    var disabled = props.disabled, prefixCls = props.prefixCls, character2 = props.character, characterRender = props.characterRender, index2 = props.index, count = props.count, value2 = props.value, allowHalf = props.allowHalf, focused = props.focused, onHover = props.onHover, onClick = props.onClick;
    var onInternalHover = function onInternalHover2(e2) {
      onHover(e2, index2);
    };
    var onInternalClick = function onInternalClick2(e2) {
      onClick(e2, index2);
    };
    var onInternalKeyDown = function onInternalKeyDown2(e2) {
      if (e2.keyCode === _KeyCode2.default.ENTER) {
        onClick(e2, index2);
      }
    };
    var starValue = index2 + 1;
    var classNameList = /* @__PURE__ */ new Set([prefixCls]);
    if (value2 === 0 && index2 === 0 && focused) {
      classNameList.add("".concat(prefixCls, "-focused"));
    } else if (allowHalf && value2 + 0.5 >= starValue && value2 < starValue) {
      classNameList.add("".concat(prefixCls, "-half"));
      classNameList.add("".concat(prefixCls, "-active"));
      if (focused) {
        classNameList.add("".concat(prefixCls, "-focused"));
      }
    } else {
      if (starValue <= value2) {
        classNameList.add("".concat(prefixCls, "-full"));
      } else {
        classNameList.add("".concat(prefixCls, "-zero"));
      }
      if (starValue === value2 && focused) {
        classNameList.add("".concat(prefixCls, "-focused"));
      }
    }
    var characterNode = typeof character2 === "function" ? character2(props) : character2;
    var start = /* @__PURE__ */ _react3.default.createElement("li", {
      className: (0, _classnames2.default)(Array.from(classNameList)),
      ref
    }, /* @__PURE__ */ _react3.default.createElement("div", {
      onClick: disabled ? null : onInternalClick,
      onKeyDown: disabled ? null : onInternalKeyDown,
      onMouseMove: disabled ? null : onInternalHover,
      role: "radio",
      "aria-checked": value2 > index2 ? "true" : "false",
      "aria-posinset": index2 + 1,
      "aria-setsize": count,
      tabIndex: disabled ? -1 : 0
    }, /* @__PURE__ */ _react3.default.createElement("div", {
      className: "".concat(prefixCls, "-first")
    }, characterNode), /* @__PURE__ */ _react3.default.createElement("div", {
      className: "".concat(prefixCls, "-second")
    }, characterNode)));
    if (characterRender) {
      start = characterRender(start, props);
    }
    return start;
  }
  Star.default = /* @__PURE__ */ _react3.default.forwardRef(Star$1);
  return Star;
}
var useRefs = {};
const require$$0 = /* @__PURE__ */ getAugmentedNamespace(_typeof$3);
var hasRequiredUseRefs;
function requireUseRefs() {
  if (hasRequiredUseRefs)
    return useRefs;
  hasRequiredUseRefs = 1;
  var _typeof2 = require$$0;
  Object.defineProperty(useRefs, "__esModule", {
    value: true
  });
  useRefs.default = useRefs$1;
  var React2 = _interopRequireWildcard2(reactExports);
  function _getRequireWildcardCache2(e2) {
    if ("function" != typeof WeakMap)
      return null;
    var r2 = /* @__PURE__ */ new WeakMap(), t2 = /* @__PURE__ */ new WeakMap();
    return (_getRequireWildcardCache2 = function _getRequireWildcardCache3(e3) {
      return e3 ? t2 : r2;
    })(e2);
  }
  function _interopRequireWildcard2(e2, r2) {
    if (e2 && e2.__esModule)
      return e2;
    if (null === e2 || "object" != _typeof2(e2) && "function" != typeof e2)
      return { default: e2 };
    var t2 = _getRequireWildcardCache2(r2);
    if (t2 && t2.has(e2))
      return t2.get(e2);
    var n2 = { __proto__: null }, a2 = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var u2 in e2)
      if ("default" !== u2 && Object.prototype.hasOwnProperty.call(e2, u2)) {
        var i2 = a2 ? Object.getOwnPropertyDescriptor(e2, u2) : null;
        i2 && (i2.get || i2.set) ? Object.defineProperty(n2, u2, i2) : n2[u2] = e2[u2];
      }
    return n2.default = e2, t2 && t2.set(e2, n2), n2;
  }
  function useRefs$1() {
    var nodeRef = React2.useRef({});
    function getRef(index2) {
      return nodeRef.current[index2];
    }
    function setRef2(index2) {
      return function(node2) {
        nodeRef.current[index2] = node2;
      };
    }
    return [getRef, setRef2];
  }
  return useRefs;
}
var util = {};
var hasRequiredUtil;
function requireUtil() {
  if (hasRequiredUtil)
    return util;
  hasRequiredUtil = 1;
  Object.defineProperty(util, "__esModule", {
    value: true
  });
  util.getOffsetLeft = getOffsetLeft;
  function getScroll(w2) {
    var ret = w2.pageXOffset;
    var method4 = "scrollLeft";
    if (typeof ret !== "number") {
      var d2 = w2.document;
      ret = d2.documentElement[method4];
      if (typeof ret !== "number") {
        ret = d2.body[method4];
      }
    }
    return ret;
  }
  function getClientPosition(elem) {
    var x2;
    var y2;
    var doc = elem.ownerDocument;
    var body = doc.body;
    var docElem = doc && doc.documentElement;
    var box = elem.getBoundingClientRect();
    x2 = box.left;
    y2 = box.top;
    x2 -= docElem.clientLeft || body.clientLeft || 0;
    y2 -= docElem.clientTop || body.clientTop || 0;
    return {
      left: x2,
      top: y2
    };
  }
  function getOffsetLeft(el2) {
    var pos = getClientPosition(el2);
    var doc = el2.ownerDocument;
    var w2 = doc.defaultView || doc.parentWindow;
    pos.left += getScroll(w2);
    return pos.left;
  }
  return util;
}
var _interopRequireDefault$1 = interopRequireDefaultExports;
Object.defineProperty(Rate$1, "__esModule", {
  value: true
});
var default_1 = Rate$1.default = void 0;
var _extends2 = _interopRequireDefault$1(require_extends());
var _defineProperty2 = _interopRequireDefault$1(require$$2);
var _slicedToArray2 = _interopRequireDefault$1(require$$3$1);
var _objectWithoutProperties2 = _interopRequireDefault$1(require$$4);
var _classnames = _interopRequireDefault$1(classnamesExports);
var _useMergedState5 = _interopRequireDefault$1(requireUseMergedState());
var _KeyCode = _interopRequireDefault$1(requireKeyCode());
var _pickAttrs = _interopRequireDefault$1(requirePickAttrs());
var _react = _interopRequireDefault$1(reactExports);
var _Star = _interopRequireDefault$1(requireStar());
var _useRefs3 = _interopRequireDefault$1(requireUseRefs());
var _util = requireUtil();
var _excluded$7 = ["prefixCls", "className", "defaultValue", "value", "count", "allowHalf", "allowClear", "keyboard", "character", "characterRender", "disabled", "direction", "tabIndex", "autoFocus", "onHoverChange", "onChange", "onFocus", "onBlur", "onKeyDown", "onMouseLeave"];
function Rate(props, ref) {
  var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? "rc-rate" : _props$prefixCls, className = props.className, defaultValue2 = props.defaultValue, propValue = props.value, _props$count = props.count, count = _props$count === void 0 ? 5 : _props$count, _props$allowHalf = props.allowHalf, allowHalf = _props$allowHalf === void 0 ? false : _props$allowHalf, _props$allowClear = props.allowClear, allowClear = _props$allowClear === void 0 ? true : _props$allowClear, _props$keyboard = props.keyboard, keyboard = _props$keyboard === void 0 ? true : _props$keyboard, _props$character = props.character, character2 = _props$character === void 0 ? "★" : _props$character, characterRender = props.characterRender, disabled = props.disabled, _props$direction = props.direction, direction = _props$direction === void 0 ? "ltr" : _props$direction, _props$tabIndex = props.tabIndex, tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex, autoFocus = props.autoFocus, onHoverChange = props.onHoverChange, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onKeyDown = props.onKeyDown, onMouseLeave = props.onMouseLeave, restProps = (0, _objectWithoutProperties2.default)(props, _excluded$7);
  var _useRefs = (0, _useRefs3.default)(), _useRefs2 = (0, _slicedToArray2.default)(_useRefs, 2), getStarRef = _useRefs2[0], setStarRef = _useRefs2[1];
  var rateRef = _react.default.useRef(null);
  var triggerFocus = function triggerFocus2() {
    if (!disabled) {
      var _rateRef$current;
      (_rateRef$current = rateRef.current) === null || _rateRef$current === void 0 || _rateRef$current.focus();
    }
  };
  _react.default.useImperativeHandle(ref, function() {
    return {
      focus: triggerFocus,
      blur: function blur() {
        if (!disabled) {
          var _rateRef$current2;
          (_rateRef$current2 = rateRef.current) === null || _rateRef$current2 === void 0 || _rateRef$current2.blur();
        }
      }
    };
  });
  var _useMergedState = (0, _useMergedState5.default)(defaultValue2 || 0, {
    value: propValue
  }), _useMergedState2 = (0, _slicedToArray2.default)(_useMergedState, 2), value2 = _useMergedState2[0], setValue = _useMergedState2[1];
  var _useMergedState3 = (0, _useMergedState5.default)(null), _useMergedState4 = (0, _slicedToArray2.default)(_useMergedState3, 2), cleanedValue = _useMergedState4[0], setCleanedValue = _useMergedState4[1];
  var getStarValue = function getStarValue2(index2, x2) {
    var reverse = direction === "rtl";
    var starValue = index2 + 1;
    if (allowHalf) {
      var starEle = getStarRef(index2);
      var leftDis = (0, _util.getOffsetLeft)(starEle);
      var width = starEle.clientWidth;
      if (reverse && x2 - leftDis > width / 2) {
        starValue -= 0.5;
      } else if (!reverse && x2 - leftDis < width / 2) {
        starValue -= 0.5;
      }
    }
    return starValue;
  };
  var changeValue = function changeValue2(nextValue) {
    setValue(nextValue);
    onChange === null || onChange === void 0 || onChange(nextValue);
  };
  var _React$useState = _react.default.useState(false), _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), focused = _React$useState2[0], setFocused = _React$useState2[1];
  var onInternalFocus = function onInternalFocus2() {
    setFocused(true);
    onFocus === null || onFocus === void 0 || onFocus();
  };
  var onInternalBlur = function onInternalBlur2() {
    setFocused(false);
    onBlur === null || onBlur === void 0 || onBlur();
  };
  var _React$useState3 = _react.default.useState(null), _React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2), hoverValue = _React$useState4[0], setHoverValue = _React$useState4[1];
  var onHover = function onHover2(event, index2) {
    var nextHoverValue = getStarValue(index2, event.pageX);
    if (nextHoverValue !== cleanedValue) {
      setHoverValue(nextHoverValue);
      setCleanedValue(null);
    }
    onHoverChange === null || onHoverChange === void 0 || onHoverChange(nextHoverValue);
  };
  var onMouseLeaveCallback = function onMouseLeaveCallback2(event) {
    if (!disabled) {
      setHoverValue(null);
      setCleanedValue(null);
      onHoverChange === null || onHoverChange === void 0 || onHoverChange(void 0);
    }
    if (event) {
      onMouseLeave === null || onMouseLeave === void 0 || onMouseLeave(event);
    }
  };
  var onClick = function onClick2(event, index2) {
    var newValue = getStarValue(index2, event.pageX);
    var isReset = false;
    if (allowClear) {
      isReset = newValue === value2;
    }
    onMouseLeaveCallback();
    changeValue(isReset ? 0 : newValue);
    setCleanedValue(isReset ? newValue : null);
  };
  var onInternalKeyDown = function onInternalKeyDown2(event) {
    var keyCode = event.keyCode;
    var reverse = direction === "rtl";
    var step = allowHalf ? 0.5 : 1;
    if (keyboard) {
      if (keyCode === _KeyCode.default.RIGHT && value2 < count && !reverse) {
        changeValue(value2 + step);
        event.preventDefault();
      } else if (keyCode === _KeyCode.default.LEFT && value2 > 0 && !reverse) {
        changeValue(value2 - step);
        event.preventDefault();
      } else if (keyCode === _KeyCode.default.RIGHT && value2 > 0 && reverse) {
        changeValue(value2 - step);
        event.preventDefault();
      } else if (keyCode === _KeyCode.default.LEFT && value2 < count && reverse) {
        changeValue(value2 + step);
        event.preventDefault();
      }
    }
    onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
  };
  _react.default.useEffect(function() {
    if (autoFocus && !disabled) {
      triggerFocus();
    }
  }, []);
  var starNodes = new Array(count).fill(0).map(function(item, index2) {
    return /* @__PURE__ */ _react.default.createElement(_Star.default, {
      ref: setStarRef(index2),
      index: index2,
      count,
      disabled,
      prefixCls: "".concat(prefixCls, "-star"),
      allowHalf,
      value: hoverValue === null ? value2 : hoverValue,
      onClick,
      onHover,
      key: item || index2,
      character: character2,
      characterRender,
      focused
    });
  });
  var classString = (0, _classnames.default)(prefixCls, className, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-disabled"), disabled), "".concat(prefixCls, "-rtl"), direction === "rtl"));
  return /* @__PURE__ */ _react.default.createElement("ul", (0, _extends2.default)({
    className: classString,
    onMouseLeave: onMouseLeaveCallback,
    tabIndex: disabled ? -1 : tabIndex,
    onFocus: disabled ? null : onInternalFocus,
    onBlur: disabled ? null : onInternalBlur,
    onKeyDown: disabled ? null : onInternalKeyDown,
    ref: rateRef
  }, (0, _pickAttrs.default)(restProps, {
    aria: true,
    data: true,
    attr: true
  })), starNodes);
}
default_1 = Rate$1.default = /* @__PURE__ */ _react.default.forwardRef(Rate);
const sizeMap = {
  sm: 16,
  md: 20,
  lg: 28
};
const Rating = reactExports.forwardRef(
  ({ size: size2 = "md", style: style2, ...props }, ref) => {
    const fontSize = sizeMap[size2];
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      default_1,
      {
        ref,
        style: {
          fontSize,
          ...style2
        },
        ...props
      }
    );
  }
);
function showToast(color2, titleOrProps) {
  if (typeof titleOrProps === "string") {
    addToast({ color: color2, title: titleOrProps });
  } else {
    addToast({ color: color2, ...titleOrProps });
  }
}
const toast = {
  default: (titleOrProps) => showToast("default", titleOrProps),
  primary: (titleOrProps) => showToast("primary", titleOrProps),
  secondary: (titleOrProps) => showToast("secondary", titleOrProps),
  success: (titleOrProps) => showToast("success", titleOrProps),
  warning: (titleOrProps) => showToast("warning", titleOrProps),
  danger: (titleOrProps) => showToast("danger", titleOrProps),
  foreground: (titleOrProps) => showToast("foreground", titleOrProps)
};
const secondsToParts = (totalSeconds) => {
  const days2 = Math.floor(totalSeconds / 86400);
  const hours2 = Math.floor(totalSeconds % 86400 / 3600);
  const minutes2 = Math.floor(totalSeconds % 3600 / 60);
  const seconds2 = totalSeconds % 60;
  return { days: days2, hours: hours2, minutes: minutes2, seconds: seconds2 };
};
const partsToSeconds = (parts) => {
  return parts.days * 86400 + parts.hours * 3600 + parts.minutes * 60 + parts.seconds;
};
const DurationInput = ({
  value: value2,
  defaultValue: defaultValue2,
  onChange,
  showDays = true,
  showHours = true,
  showMinutes = true,
  showSeconds = true,
  minValue = 0,
  size: size2 = "sm",
  isDisabled = false,
  className
}) => {
  const { t: t2 } = useTranslation();
  const currentValue = value2 ?? defaultValue2 ?? 0;
  const parts = reactExports.useMemo(() => secondsToParts(currentValue), [currentValue]);
  const handlePartChange = reactExports.useCallback(
    (part, newValue) => {
      const numValue = parseInt(newValue, 10) || 0;
      const newParts = { ...parts, [part]: Math.max(0, numValue) };
      const totalSeconds = partsToSeconds(newParts);
      onChange == null ? void 0 : onChange(Math.max(minValue, totalSeconds));
    },
    [parts, onChange, minValue]
  );
  const inputWidth = size2 === "sm" ? "w-16" : size2 === "md" ? "w-20" : "w-24";
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center gap-1 ${className || ""}`, children: [
    showDays && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          type: "number",
          size: size2,
          value: String(parts.days),
          min: 0,
          className: inputWidth,
          isDisabled,
          onChange: (e2) => handlePartChange("days", e2.target.value)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-sm", children: t2("common.unit.days") })
    ] }),
    showHours && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          type: "number",
          size: size2,
          value: String(parts.hours),
          min: 0,
          max: showDays ? 23 : void 0,
          className: inputWidth,
          isDisabled,
          onChange: (e2) => handlePartChange("hours", e2.target.value)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-sm", children: t2("common.unit.hours") })
    ] }),
    showMinutes && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          type: "number",
          size: size2,
          value: String(parts.minutes),
          min: 0,
          max: 59,
          className: inputWidth,
          isDisabled,
          onChange: (e2) => handlePartChange("minutes", e2.target.value)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-sm", children: t2("common.unit.minutes") })
    ] }),
    showSeconds && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          type: "number",
          size: size2,
          value: String(parts.seconds),
          min: 0,
          max: 59,
          className: inputWidth,
          isDisabled,
          onChange: (e2) => handlePartChange("seconds", e2.target.value)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-sm", children: t2("common.unit.seconds") })
    ] })
  ] });
};
DurationInput.displayName = "DurationInput";
const formatDuration = (seconds2, t2) => {
  if (seconds2 <= 0)
    return t2("common.state.never");
  const parts = secondsToParts(seconds2);
  const result = [];
  if (parts.days > 0) {
    result.push(`${parts.days}${t2("common.unit.days")}`);
  }
  if (parts.hours > 0) {
    result.push(`${parts.hours}${t2("common.unit.hours")}`);
  }
  if (parts.minutes > 0) {
    result.push(`${parts.minutes}${t2("common.unit.minutes")}`);
  }
  if (parts.seconds > 0 || result.length === 0) {
    result.push(`${parts.seconds}${t2("common.unit.seconds")}`);
  }
  return result.join(" ");
};
var define_import_meta_env_default$1 = {};
const envConfig = {
  apiEndpoint: define_import_meta_env_default$1.VITE_API_ENDPOINT ?? ""
};
const createStoreImpl = (createState2) => {
  let state;
  const listeners = /* @__PURE__ */ new Set();
  const setState = (partial, replace2) => {
    const nextState = typeof partial === "function" ? partial(state) : partial;
    if (!Object.is(nextState, state)) {
      const previousState = state;
      state = (replace2 != null ? replace2 : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
      listeners.forEach((listener) => listener(state, previousState));
    }
  };
  const getState = () => state;
  const getInitialState2 = () => initialState3;
  const subscribe2 = (listener) => {
    listeners.add(listener);
    return () => listeners.delete(listener);
  };
  const api = { setState, getState, getInitialState: getInitialState2, subscribe: subscribe2 };
  const initialState3 = state = createState2(setState, getState, api);
  return api;
};
const createStore = (createState2) => createState2 ? createStoreImpl(createState2) : createStoreImpl;
const identity$1 = (arg) => arg;
function useStore(api, selector = identity$1) {
  const slice2 = React$6.useSyncExternalStore(
    api.subscribe,
    () => selector(api.getState()),
    () => selector(api.getInitialState())
  );
  React$6.useDebugValue(slice2);
  return slice2;
}
const createImpl = (createState2) => {
  const api = createStore(createState2);
  const useBoundStore = (selector) => useStore(api, selector);
  Object.assign(useBoundStore, api);
  return useBoundStore;
};
const create$1 = (createState2) => createState2 ? createImpl(createState2) : createImpl;
const useDownloadTasksStore = create$1((set2, get5) => ({
  tasks: [],
  setTasks: (tasks) => set2({ tasks: tasks.slice() }),
  updateTask: (task) => set2((state) => {
    const idx = state.tasks.findIndex((t2) => t2.id == task.id);
    if (idx > -1) {
      const newTasks = state.tasks.slice();
      newTasks[idx] = task;
      return { tasks: newTasks };
    } else {
      return { tasks: [...state.tasks, task] };
    }
  })
}));
const useDependentComponentContextsStore = create$1((set2, get5) => ({
  contexts: [],
  setContexts: (contexts) => {
    console.log("dependent component context changed", contexts);
    set2({
      contexts: contexts.slice().sort((a2, b2) => a2.id.localeCompare(b2.id))
    });
  },
  updateContext: (context) => set2((state) => {
    const idx = state.contexts.findIndex((t2) => t2.id === context.id);
    let newContexts = state.contexts.slice();
    if (idx > -1) {
      newContexts[idx] = context;
    } else {
      newContexts.push(context);
    }
    return { contexts: newContexts };
  })
}));
const useFileMovingProgressesStore = create$1(
  (set2, get5) => ({
    progresses: {},
    setProgresses: (progresses) => set2({ progresses }),
    updateProgress: (progress2) => set2((state) => {
      const newProgresses = {
        ...state.progresses,
        [progress2.source]: progress2
      };
      return { progresses: newProgresses };
    })
  })
);
const log$I = buildLogger("BApi");
class HttpClient2 {
  constructor(apiConfig = {}) {
    __publicField(this, "baseUrl", "");
    __publicField(this, "securityData", null);
    __publicField(this, "securityWorker");
    __publicField(this, "abortControllers", /* @__PURE__ */ new Map());
    __publicField(this, "customFetch", (...fetchParams) => fetch(...fetchParams));
    __publicField(this, "baseApiParams", {
      credentials: "same-origin",
      headers: {},
      redirect: "follow",
      referrerPolicy: "no-referrer"
    });
    __publicField(this, "setSecurityData", (data) => {
      this.securityData = data;
    });
    __publicField(this, "contentFormatters", {
      [
        "application/json"
        /* Json */
      ]: (input2) => input2 !== null && (typeof input2 === "object" || typeof input2 === "string") ? JSON.stringify(input2) : input2,
      [
        "text/plain"
        /* Text */
      ]: (input2) => input2 !== null && typeof input2 !== "string" ? JSON.stringify(input2) : input2,
      [
        "multipart/form-data"
        /* FormData */
      ]: (input2) => Object.keys(input2 || {}).reduce((formData, key) => {
        const property2 = input2[key];
        formData.append(
          key,
          property2 instanceof Blob ? property2 : typeof property2 === "object" && property2 !== null ? JSON.stringify(property2) : `${property2}`
        );
        return formData;
      }, new FormData()),
      [
        "application/x-www-form-urlencoded"
        /* UrlEncoded */
      ]: (input2) => this.toQueryString(input2)
    });
    __publicField(this, "createAbortSignal", (cancelToken) => {
      if (this.abortControllers.has(cancelToken)) {
        const abortController2 = this.abortControllers.get(cancelToken);
        if (abortController2) {
          return abortController2.signal;
        }
        return void 0;
      }
      const abortController = new AbortController();
      this.abortControllers.set(cancelToken, abortController);
      return abortController.signal;
    });
    __publicField(this, "abortRequest", (cancelToken) => {
      const abortController = this.abortControllers.get(cancelToken);
      if (abortController) {
        abortController.abort();
        this.abortControllers.delete(cancelToken);
      }
    });
    __publicField(this, "request", async (fullRequestParams) => {
      const {
        body,
        secure,
        path,
        type: type4,
        query,
        format: format2,
        baseUrl,
        cancelToken,
        ...params
      } = fullRequestParams;
      const secureParams = (typeof secure === "boolean" ? secure : this.baseApiParams.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
      const requestParams = this.mergeRequestParams(params, secureParams);
      const queryString = query && this.toQueryString(query);
      const payloadFormatter = this.contentFormatters[
        type4 || "application/json"
        /* Json */
      ];
      const responseFormat = format2 || requestParams.format;
      return this.customFetch(
        `${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`,
        {
          ...requestParams,
          headers: {
            ...requestParams.headers || {},
            ...type4 && type4 !== "multipart/form-data" ? { "Content-Type": type4 } : {}
          },
          signal: cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal,
          body: typeof body === "undefined" || body === null ? null : payloadFormatter(body)
        }
      ).then(async (response) => {
        const r2 = response;
        r2.data = null;
        r2.error = null;
        const data = !responseFormat ? r2 : await response[responseFormat]().then((data2) => {
          if (r2.ok) {
            r2.data = data2;
          } else {
            r2.error = data2;
          }
          return r2;
        }).catch((e2) => {
          r2.error = e2;
          return r2;
        });
        if (cancelToken) {
          this.abortControllers.delete(cancelToken);
        }
        if (!response.ok) {
          this.processResponseError(data, fullRequestParams);
          throw data;
        }
        return this.processResponseData(data.data, fullRequestParams);
      }).catch((error2) => {
        this.processResponseError(error2, fullRequestParams);
        throw error2;
      });
    });
    __publicField(this, "processResponseError", (error2, params) => {
      const title = `${params.method} ${params.path} failed`;
      const description = extractErrorMessage(error2);
      toast.danger({
        title,
        description
      });
    });
    __publicField(this, "processResponseData", (response, params) => {
      if (response && typeof response === "object" && "code" in response) {
        log$I("[response]", params.path, response);
        switch (response.code) {
          case 0:
            break;
          default:
            const showErrorToast = params.showErrorToast || ((error2) => error2.code >= 400 || error2.code < 200);
            if (showErrorToast(response)) {
              const title = `[${response.code}]${params.method} ${params.path}`;
              toast.danger({
                title,
                description: response.message
              });
            }
        }
      }
      return response;
    });
    Object.assign(this, apiConfig);
  }
  encodeQueryParam(key, value2) {
    const encodedKey = encodeURIComponent(key);
    return `${encodedKey}=${encodeURIComponent(typeof value2 === "number" ? value2 : `${value2}`)}`;
  }
  addQueryParam(query, key) {
    return this.encodeQueryParam(key, query[key]);
  }
  addArrayQueryParam(query, key) {
    const value2 = query[key];
    return value2.map((v2) => this.encodeQueryParam(key, v2)).join("&");
  }
  toQueryString(rawQuery) {
    const query = rawQuery || {};
    const keys2 = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
    return keys2.map(
      (key) => Array.isArray(query[key]) ? this.addArrayQueryParam(query, key) : this.addQueryParam(query, key)
    ).join("&");
  }
  addQueryParams(rawQuery) {
    const queryString = this.toQueryString(rawQuery);
    return queryString ? `?${queryString}` : "";
  }
  mergeRequestParams(params1, params2) {
    return {
      ...this.baseApiParams,
      ...params1,
      ...params2 || {},
      headers: {
        ...this.baseApiParams.headers || {},
        ...params1.headers || {},
        ...params2 && params2.headers || {}
      }
    };
  }
}
class Api extends HttpClient2 {
  constructor() {
    super(...arguments);
    __publicField(this, "alias", {
      /**
       * No description
       *
       * @tags Alias
       * @name SearchAliasGroups
       * @request GET:/alias
       */
      searchAliasGroups: (query, params = {}) => this.request({
        path: `/alias`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchAliasGroups
       * @name searchAliasGroupsUrl
       */
      searchAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name PatchAlias
       * @request PUT:/alias
       */
      patchAlias: (data, query, params = {}) => this.request({
        path: `/alias`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAlias
       * @name patchAliasUrl
       */
      patchAliasUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name AddAlias
       * @request POST:/alias
       */
      addAlias: (data, params = {}) => this.request({
        path: `/alias`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addAlias
       * @name addAliasUrl
       */
      addAliasUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name DeleteAlias
       * @request DELETE:/alias
       */
      deleteAlias: (query, params = {}) => this.request({
        path: `/alias`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAlias
       * @name deleteAliasUrl
       */
      deleteAliasUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name DeleteAliasGroups
       * @request DELETE:/alias/groups
       */
      deleteAliasGroups: (query, params = {}) => this.request({
        path: `/alias/groups`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAliasGroups
       * @name deleteAliasGroupsUrl
       */
      deleteAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/groups`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name MergeAliasGroups
       * @request PUT:/alias/merge
       */
      mergeAliasGroups: (query, params = {}) => this.request({
        path: `/alias/merge`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for mergeAliasGroups
       * @name mergeAliasGroupsUrl
       */
      mergeAliasGroupsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/merge`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name ExportAliases
       * @request GET:/alias/xlsx
       */
      exportAliases: (params = {}) => this.request({
        path: `/alias/xlsx`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for exportAliases
       * @name exportAliasesUrl
       */
      exportAliasesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/xlsx`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Alias
       * @name ImportAliases
       * @request POST:/alias/import
       */
      importAliases: (query, params = {}) => this.request({
        path: `/alias/import`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for importAliases
       * @name importAliasesUrl
       */
      importAliasesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/alias/import`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "app", {
      /**
       * No description
       *
       * @tags App
       * @name CheckAppInitialized
       * @request GET:/app/initialized
       */
      checkAppInitialized: (params = {}) => this.request({
        path: `/app/initialized`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkAppInitialized
       * @name checkAppInitializedUrl
       */
      checkAppInitializedUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/initialized`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name GetAppInfo
       * @request GET:/app/info
       */
      getAppInfo: (params = {}) => this.request({
        path: `/app/info`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAppInfo
       * @name getAppInfoUrl
       */
      getAppInfoUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/info`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name AcceptTerms
       * @request POST:/app/terms
       */
      acceptTerms: (params = {}) => this.request({
        path: `/app/terms`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for acceptTerms
       * @name acceptTermsUrl
       */
      acceptTermsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/terms`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags App
       * @name MoveCoreData
       * @request PUT:/app/data-path
       */
      moveCoreData: (data, params = {}) => this.request({
        path: `/app/data-path`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for moveCoreData
       * @name moveCoreDataUrl
       */
      moveCoreDataUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/app/data-path`;
        return baseUrl + path;
      }
    });
    __publicField(this, "backgroundTask", {
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name StartBackgroundTask
       * @request POST:/background-task/{id}/run
       */
      startBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/run`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name StopBackgroundTask
       * @request DELETE:/background-task/{id}/run
       */
      stopBackgroundTask: (id2, query, params = {}) => this.request({
        path: `/background-task/${id2}/run`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name PauseBackgroundTask
       * @request POST:/background-task/{id}/pause
       */
      pauseBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/pause`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name ResumeBackgroundTask
       * @request DELETE:/background-task/{id}/pause
       */
      resumeBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}/pause`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name CleanInactiveBackgroundTasks
       * @request DELETE:/background-task
       */
      cleanInactiveBackgroundTasks: (params = {}) => this.request({
        path: `/background-task`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for cleanInactiveBackgroundTasks
       * @name cleanInactiveBackgroundTasksUrl
       */
      cleanInactiveBackgroundTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/background-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BackgroundTask
       * @name CleanBackgroundTask
       * @request DELETE:/background-task/{id}
       */
      cleanBackgroundTask: (id2, params = {}) => this.request({
        path: `/background-task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "bilibili", {
      /**
       * No description
       *
       * @tags BiliBili
       * @name GetBiliBiliFavorites
       * @request GET:/bilibili/favorites
       */
      getBiliBiliFavorites: (params = {}) => this.request({
        path: `/bilibili/favorites`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBiliBiliFavorites
       * @name getBiliBiliFavoritesUrl
       */
      getBiliBiliFavoritesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bilibili/favorites`;
        return baseUrl + path;
      }
    });
    __publicField(this, "bulkModification", {
      /**
       * No description
       *
       * @tags BulkModification
       * @name GetBulkModification
       * @request GET:/bulk-modification/{id}
       */
      getBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name DuplicateBulkModification
       * @request POST:/bulk-modification/{id}
       */
      duplicateBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name PatchBulkModification
       * @request PATCH:/bulk-modification/{id}
       */
      patchBulkModification: (id2, data, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name DeleteBulkModification
       * @request DELETE:/bulk-modification/{id}
       */
      deleteBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name GetAllBulkModifications
       * @request GET:/bulk-modification/all
       */
      getAllBulkModifications: (params = {}) => this.request({
        path: `/bulk-modification/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllBulkModifications
       * @name getAllBulkModificationsUrl
       */
      getAllBulkModificationsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bulk-modification/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BulkModification
       * @name AddBulkModification
       * @request POST:/bulk-modification
       */
      addBulkModification: (params = {}) => this.request({
        path: `/bulk-modification`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addBulkModification
       * @name addBulkModificationUrl
       */
      addBulkModificationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/bulk-modification`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags BulkModification
       * @name FilterResourcesInBulkModification
       * @request PUT:/bulk-modification/{id}/filtered-resources
       */
      filterResourcesInBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/filtered-resources`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name PreviewBulkModification
       * @request PUT:/bulk-modification/{id}/preview
       */
      previewBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/preview`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name SearchBulkModificationDiffs
       * @request GET:/bulk-modification/{bmId}/diffs
       */
      searchBulkModificationDiffs: (bmId, query, params = {}) => this.request({
        path: `/bulk-modification/${bmId}/diffs`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name ApplyBulkModification
       * @request POST:/bulk-modification/{id}/apply
       */
      applyBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/apply`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags BulkModification
       * @name RevertBulkModification
       * @request DELETE:/bulk-modification/{id}/apply
       */
      revertBulkModification: (id2, params = {}) => this.request({
        path: `/bulk-modification/${id2}/apply`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "cache", {
      /**
       * No description
       *
       * @tags Cache
       * @name GetCacheOverview
       * @request GET:/cache
       */
      getCacheOverview: (params = {}) => this.request({
        path: `/cache`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCacheOverview
       * @name getCacheOverviewUrl
       */
      getCacheOverviewUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/cache`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Cache
       * @name CheckResourceCacheExistence
       * @request GET:/cache/resource/{resourceId}/type/{type}/existence
       */
      checkResourceCacheExistence: (resourceId, type4, params = {}) => this.request({
        path: `/cache/resource/${resourceId}/type/${type4}/existence`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteResourceCacheByResourceIdAndCacheType
       * @request DELETE:/cache/resource/{resourceId}/type/{type}
       */
      deleteResourceCacheByResourceIdAndCacheType: (resourceId, type4, params = {}) => this.request({
        path: `/cache/resource/${resourceId}/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteResourceCacheByMediaLibraryIdAndCacheType
       * @request DELETE:/cache/media-library/{mediaLibraryId}/type/{type}
       */
      deleteResourceCacheByMediaLibraryIdAndCacheType: (mediaLibraryId, type4, params = {}) => this.request({
        path: `/cache/media-library/${mediaLibraryId}/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Cache
       * @name DeleteUnassociatedResourceCacheByCacheType
       * @request DELETE:/cache/unassociated/type/{type}
       */
      deleteUnassociatedResourceCacheByCacheType: (type4, params = {}) => this.request({
        path: `/cache/unassociated/type/${type4}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "category", {
      /**
       * No description
       *
       * @tags Category
       * @name GetCategory
       * @request GET:/category/{id}
       * @deprecated
       */
      getCategory: (id2, query, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PatchCategory
       * @request PATCH:/category/{id}
       * @deprecated
       */
      patchCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name DeleteCategory
       * @request DELETE:/category/{id}
       * @deprecated
       */
      deleteCategory: (id2, params = {}) => this.request({
        path: `/category/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name GetAllCategories
       * @request GET:/category
       * @deprecated
       */
      getAllCategories: (query, params = {}) => this.request({
        path: `/category`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllCategories
       * @name getAllCategoriesUrl
       */
      getAllCategoriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/category`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name AddCategory
       * @request POST:/category
       * @deprecated
       */
      addCategory: (data, params = {}) => this.request({
        path: `/category`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCategory
       * @name addCategoryUrl
       */
      addCategoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/category`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name DuplicateCategory
       * @request POST:/category/{id}/duplication
       * @deprecated
       */
      duplicateCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/duplication`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PutCategoryResourceDisplayNameTemplate
       * @request PUT:/category/{id}/resource-display-name-template
       * @deprecated
       */
      putCategoryResourceDisplayNameTemplate: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/resource-display-name-template`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name ConfigureCategoryComponents
       * @request PUT:/category/{id}/component
       * @deprecated
       */
      configureCategoryComponents: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/component`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name SortCategories
       * @request PUT:/category/orders
       * @deprecated
       */
      sortCategories: (data, params = {}) => this.request({
        path: `/category/orders`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortCategories
       * @name sortCategoriesUrl
       */
      sortCategoriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/category/orders`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Category
       * @name BindCustomPropertiesToCategory
       * @request PUT:/category/{id}/custom-properties
       * @deprecated
       */
      bindCustomPropertiesToCategory: (id2, data, params = {}) => this.request({
        path: `/category/${id2}/custom-properties`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name BindCustomPropertyToCategory
       * @request POST:/category/{categoryId}/custom-property/{customPropertyId}
       * @deprecated
       */
      bindCustomPropertyToCategory: (categoryId, customPropertyId, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/${customPropertyId}`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name UnlinkCustomPropertyFromCategory
       * @request DELETE:/category/{categoryId}/custom-property/{customPropertyId}
       * @deprecated
       */
      unlinkCustomPropertyFromCategory: (categoryId, customPropertyId, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/${customPropertyId}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name SortCustomPropertiesInCategory
       * @request PUT:/category/{categoryId}/custom-property/order
       * @deprecated
       */
      sortCustomPropertiesInCategory: (categoryId, data, params = {}) => this.request({
        path: `/category/${categoryId}/custom-property/order`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PreviewCategoryDisplayNameTemplate
       * @request GET:/category/{id}/resource/resource-display-name-template/preview
       * @deprecated
       */
      previewCategoryDisplayNameTemplate: (id2, query, params = {}) => this.request({
        path: `/category/${id2}/resource/resource-display-name-template/preview`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name GetCategoryEnhancerOptions
       * @request GET:/category/{id}/enhancer/{enhancerId}/options
       * @deprecated
       */
      getCategoryEnhancerOptions: (id2, enhancerId, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name PatchCategoryEnhancerOptions
       * @request PATCH:/category/{id}/enhancer/{enhancerId}/options
       * @deprecated
       */
      patchCategoryEnhancerOptions: (id2, enhancerId, data, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name DeleteCategoryEnhancerTargetOptions
       * @request DELETE:/category/{id}/enhancer/{enhancerId}/options/target
       * @deprecated
       */
      deleteCategoryEnhancerTargetOptions: (id2, enhancerId, query, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options/target`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name UnbindCategoryEnhancerTargetProperty
       * @request DELETE:/category/{id}/enhancer/{enhancerId}/options/target/property
       * @deprecated
       */
      unbindCategoryEnhancerTargetProperty: (id2, enhancerId, query, params = {}) => this.request({
        path: `/category/${id2}/enhancer/${enhancerId}/options/target/property`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Category
       * @name StartSyncingCategoryResources
       * @request PUT:/category/{id}/synchronization
       * @deprecated
       */
      startSyncingCategoryResources: (id2, params = {}) => this.request({
        path: `/category/${id2}/synchronization`,
        method: "PUT",
        format: "json",
        ...params
      })
    });
    __publicField(this, "comparison", {
      /**
       * No description
       *
       * @tags Comparison
       * @name GetAllComparisonPlans
       * @request GET:/comparison/plan
       */
      getAllComparisonPlans: (params = {}) => this.request({
        path: `/comparison/plan`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllComparisonPlans
       * @name getAllComparisonPlansUrl
       */
      getAllComparisonPlansUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/comparison/plan`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Comparison
       * @name CreateComparisonPlan
       * @request POST:/comparison/plan
       */
      createComparisonPlan: (data, params = {}) => this.request({
        path: `/comparison/plan`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for createComparisonPlan
       * @name createComparisonPlanUrl
       */
      createComparisonPlanUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/comparison/plan`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Comparison
       * @name GetComparisonPlan
       * @request GET:/comparison/plan/{id}
       */
      getComparisonPlan: (id2, params = {}) => this.request({
        path: `/comparison/plan/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name UpdateComparisonPlan
       * @request PATCH:/comparison/plan/{id}
       */
      updateComparisonPlan: (id2, data, params = {}) => this.request({
        path: `/comparison/plan/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name DeleteComparisonPlan
       * @request DELETE:/comparison/plan/{id}
       */
      deleteComparisonPlan: (id2, params = {}) => this.request({
        path: `/comparison/plan/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name DuplicateComparisonPlan
       * @request POST:/comparison/plan/{id}/duplicate
       */
      duplicateComparisonPlan: (id2, params = {}) => this.request({
        path: `/comparison/plan/${id2}/duplicate`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name ExecuteComparisonPlan
       * @request POST:/comparison/plan/{id}/execute
       */
      executeComparisonPlan: (id2, params = {}) => this.request({
        path: `/comparison/plan/${id2}/execute`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name SearchComparisonResults
       * @request GET:/comparison/plan/{planId}/results
       */
      searchComparisonResults: (planId, query, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name ClearComparisonResults
       * @request DELETE:/comparison/plan/{planId}/results
       */
      clearComparisonResults: (planId, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name GetComparisonResultGroup
       * @request GET:/comparison/plan/{planId}/results/{groupId}
       */
      getComparisonResultGroup: (planId, groupId, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results/${groupId}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name GetComparisonResultGroupResourceIds
       * @request GET:/comparison/plan/{planId}/results/{groupId}/resource-ids
       */
      getComparisonResultGroupResourceIds: (planId, groupId, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results/${groupId}/resource-ids`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name GetComparisonResultGroupPairs
       * @request GET:/comparison/plan/{planId}/results/{groupId}/pairs
       */
      getComparisonResultGroupPairs: (planId, groupId, query, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results/${groupId}/pairs`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name HideComparisonResultGroup
       * @request PUT:/comparison/plan/{planId}/results/{groupId}/hide
       */
      hideComparisonResultGroup: (planId, groupId, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results/${groupId}/hide`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Comparison
       * @name UnhideComparisonResultGroup
       * @request DELETE:/comparison/plan/{planId}/results/{groupId}/hide
       */
      unhideComparisonResultGroup: (planId, groupId, params = {}) => this.request({
        path: `/comparison/plan/${planId}/results/${groupId}/hide`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "component", {
      /**
       * No description
       *
       * @tags Component
       * @name GetComponentDescriptors
       * @request GET:/component
       */
      getComponentDescriptors: (query, params = {}) => this.request({
        path: `/component`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getComponentDescriptors
       * @name getComponentDescriptorsUrl
       */
      getComponentDescriptorsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name GetComponentDescriptorByKey
       * @request GET:/component/key
       */
      getComponentDescriptorByKey: (query, params = {}) => this.request({
        path: `/component/key`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getComponentDescriptorByKey
       * @name getComponentDescriptorByKeyUrl
       */
      getComponentDescriptorByKeyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/key`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name DiscoverDependentComponent
       * @request GET:/component/dependency/discovery
       */
      discoverDependentComponent: (query, params = {}) => this.request({
        path: `/component/dependency/discovery`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for discoverDependentComponent
       * @name discoverDependentComponentUrl
       */
      discoverDependentComponentUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency/discovery`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name GetDependentComponentLatestVersion
       * @request GET:/component/dependency/latest-version
       */
      getDependentComponentLatestVersion: (query, params = {}) => this.request({
        path: `/component/dependency/latest-version`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getDependentComponentLatestVersion
       * @name getDependentComponentLatestVersionUrl
       */
      getDependentComponentLatestVersionUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency/latest-version`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Component
       * @name InstallDependentComponent
       * @request POST:/component/dependency
       */
      installDependentComponent: (query, params = {}) => this.request({
        path: `/component/dependency`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for installDependentComponent
       * @name installDependentComponentUrl
       */
      installDependentComponentUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/component/dependency`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "componentOptions", {
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name AddComponentOptions
       * @request POST:/component-options
       * @deprecated
       */
      addComponentOptions: (data, params = {}) => this.request({
        path: `/component-options`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addComponentOptions
       * @name addComponentOptionsUrl
       */
      addComponentOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/component-options`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name PutComponentOptions
       * @request PUT:/component-options/{id}
       * @deprecated
       */
      putComponentOptions: (id2, data, params = {}) => this.request({
        path: `/component-options/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ComponentOptions
       * @name RemoveComponentOptions
       * @request DELETE:/component-options/{id}
       * @deprecated
       */
      removeComponentOptions: (id2, params = {}) => this.request({
        path: `/component-options/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "api", {
      /**
       * No description
       *
       * @tags Constant
       * @name GetAllExtensionMediaTypes
       * @request GET:/api/constant/extension-media-types
       */
      getAllExtensionMediaTypes: (params = {}) => this.request({
        path: `/api/constant/extension-media-types`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllExtensionMediaTypes
       * @name getAllExtensionMediaTypesUrl
       */
      getAllExtensionMediaTypesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/api/constant/extension-media-types`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Constant
       * @name ConstantList
       * @request GET:/api/constant
       */
      constantList: (params = {}) => this.request({
        path: `/api/constant`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for constantList
       * @name constantListUrl
       */
      constantListUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/api/constant`;
        return baseUrl + path;
      }
    });
    __publicField(this, "customProperty", {
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetAllCustomProperties
       * @request GET:/custom-property/all
       */
      getAllCustomProperties: (query, params = {}) => this.request({
        path: `/custom-property/all`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllCustomProperties
       * @name getAllCustomPropertiesUrl
       */
      getAllCustomPropertiesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/all`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyByKeys
       * @request GET:/custom-property/ids
       */
      getCustomPropertyByKeys: (query, params = {}) => this.request({
        path: `/custom-property/ids`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCustomPropertyByKeys
       * @name getCustomPropertyByKeysUrl
       */
      getCustomPropertyByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/ids`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name AddCustomProperty
       * @request POST:/custom-property
       */
      addCustomProperty: (data, params = {}) => this.request({
        path: `/custom-property`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCustomProperty
       * @name addCustomPropertyUrl
       */
      addCustomPropertyUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name AddCustomPropertyBatch
       * @request POST:/custom-property/batch
       */
      addCustomPropertyBatch: (data, params = {}) => this.request({
        path: `/custom-property/batch`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addCustomPropertyBatch
       * @name addCustomPropertyBatchUrl
       */
      addCustomPropertyBatchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/batch`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name PutCustomProperty
       * @request PUT:/custom-property/{id}
       */
      putCustomProperty: (id2, data, params = {}) => this.request({
        path: `/custom-property/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name RemoveCustomProperty
       * @request DELETE:/custom-property/{id}
       */
      removeCustomProperty: (id2, params = {}) => this.request({
        path: `/custom-property/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name SortCustomProperties
       * @request PUT:/custom-property/order
       */
      sortCustomProperties: (data, params = {}) => this.request({
        path: `/custom-property/order`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortCustomProperties
       * @name sortCustomPropertiesUrl
       */
      sortCustomPropertiesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/order`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name PreviewCustomPropertyTypeConversion
       * @request POST:/custom-property/{sourceCustomPropertyId}/{targetType}/conversion-preview
       */
      previewCustomPropertyTypeConversion: (sourceCustomPropertyId, targetType, params = {}) => this.request({
        path: `/custom-property/${sourceCustomPropertyId}/${targetType}/conversion-preview`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyConversionRules
       * @request GET:/custom-property/conversion-rule
       */
      getCustomPropertyConversionRules: (params = {}) => this.request({
        path: `/custom-property/conversion-rule`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCustomPropertyConversionRules
       * @name getCustomPropertyConversionRulesUrl
       */
      getCustomPropertyConversionRulesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/conversion-rule`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags CustomProperty
       * @name ChangeCustomPropertyType
       * @request PUT:/custom-property/{id}/{type}
       */
      changeCustomPropertyType: (id2, type4, params = {}) => this.request({
        path: `/custom-property/${id2}/${type4}`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name GetCustomPropertyValueUsage
       * @request GET:/custom-property/{id}/value-usage
       */
      getCustomPropertyValueUsage: (id2, query, params = {}) => this.request({
        path: `/custom-property/${id2}/value-usage`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags CustomProperty
       * @name TestCustomPropertyTypeConversion
       * @request GET:/custom-property/type-conversion-overview
       */
      testCustomPropertyTypeConversion: (params = {}) => this.request({
        path: `/custom-property/type-conversion-overview`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for testCustomPropertyTypeConversion
       * @name testCustomPropertyTypeConversionUrl
       */
      testCustomPropertyTypeConversionUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/custom-property/type-conversion-overview`;
        return baseUrl + path;
      }
    });
    __publicField(this, "dashboard", {
      /**
       * No description
       *
       * @tags Dashboard
       * @name GetStatistics
       * @request GET:/dashboard
       */
      getStatistics: (params = {}) => this.request({
        path: `/dashboard`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getStatistics
       * @name getStatisticsUrl
       */
      getStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/dashboard`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Dashboard
       * @name GetPropertyStatistics
       * @request GET:/dashboard/property
       */
      getPropertyStatistics: (params = {}) => this.request({
        path: `/dashboard/property`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPropertyStatistics
       * @name getPropertyStatisticsUrl
       */
      getPropertyStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/dashboard/property`;
        return baseUrl + path;
      }
    });
    __publicField(this, "downloadTask", {
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetAllDownloaderDefinitions
       * @request GET:/download-task/downloaders/definitions
       */
      getAllDownloaderDefinitions: (params = {}) => this.request({
        path: `/download-task/downloaders/definitions`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllDownloaderDefinitions
       * @name getAllDownloaderDefinitionsUrl
       */
      getAllDownloaderDefinitionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/downloaders/definitions`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetAllDownloadTasks
       * @request GET:/download-task
       */
      getAllDownloadTasks: (params = {}) => this.request({
        path: `/download-task`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllDownloadTasks
       * @name getAllDownloadTasksUrl
       */
      getAllDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name AddDownloadTask
       * @request POST:/download-task
       */
      addDownloadTask: (data, params = {}) => this.request({
        path: `/download-task`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addDownloadTask
       * @name addDownloadTaskUrl
       */
      addDownloadTaskUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name DeleteDownloadTasks
       * @request DELETE:/download-task
       */
      deleteDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteDownloadTasks
       * @name deleteDownloadTasksUrl
       */
      deleteDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetDownloadTask
       * @request GET:/download-task/{id}
       */
      getDownloadTask: (id2, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name DeleteDownloadTask
       * @request DELETE:/download-task/{id}
       */
      deleteDownloadTask: (id2, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name PutDownloadTask
       * @request PUT:/download-task/{id}
       */
      putDownloadTask: (id2, data, params = {}) => this.request({
        path: `/download-task/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name StartDownloadTasks
       * @request POST:/download-task/download
       */
      startDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task/download`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startDownloadTasks
       * @name startDownloadTasksUrl
       */
      startDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/download`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name StopDownloadTasks
       * @request DELETE:/download-task/download
       */
      stopDownloadTasks: (data, params = {}) => this.request({
        path: `/download-task/download`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopDownloadTasks
       * @name stopDownloadTasksUrl
       */
      stopDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/download`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name ClearDownloadTaskCheckpoints
       * @request DELETE:/download-task/checkpoint
       */
      clearDownloadTaskCheckpoints: (data, params = {}) => this.request({
        path: `/download-task/checkpoint`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearDownloadTaskCheckpoints
       * @name clearDownloadTaskCheckpointsUrl
       */
      clearDownloadTaskCheckpointsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/checkpoint`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name ExportAllDownloadTasks
       * @request GET:/download-task/xlsx
       */
      exportAllDownloadTasks: (params = {}) => this.request({
        path: `/download-task/xlsx`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for exportAllDownloadTasks
       * @name exportAllDownloadTasksUrl
       */
      exportAllDownloadTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/xlsx`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags DownloadTask
       * @name GetDownloaderOptions
       * @request GET:/download-task/downloader/options/{thirdPartyId}
       */
      getDownloaderOptions: (thirdPartyId, query, params = {}) => this.request({
        path: `/download-task/downloader/options/${thirdPartyId}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name PutDownloaderOptions
       * @request PUT:/download-task/downloader/options/{thirdPartyId}
       */
      putDownloaderOptions: (thirdPartyId, data, query, params = {}) => this.request({
        path: `/download-task/downloader/options/${thirdPartyId}`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags DownloadTask
       * @name AddExHentaiDownloadTask
       * @request POST:/download-task/exhentai
       */
      addExHentaiDownloadTask: (data, params = {}) => this.request({
        path: `/download-task/exhentai`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addExHentaiDownloadTask
       * @name addExHentaiDownloadTaskUrl
       */
      addExHentaiDownloadTaskUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/download-task/exhentai`;
        return baseUrl + path;
      }
    });
    __publicField(this, "resource", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name GetResourceEnhancements
       * @request GET:/resource/{resourceId}/enhancement
       */
      getResourceEnhancements: (resourceId, query, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancement`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteResourceEnhancement
       * @request DELETE:/resource/{resourceId}/enhancer/{enhancerId}/enhancement
       */
      deleteResourceEnhancement: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name EnhanceResourceByEnhancer
       * @request POST:/resource/{resourceId}/enhancer/{enhancerId}/enhancement
       */
      enhanceResourceByEnhancer: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name ApplyEnhancementContextDataForResourceByEnhancer
       * @request POST:/resource/{resourceId}/enhancer/{enhancerId}/enhancement/apply
       */
      applyEnhancementContextDataForResourceByEnhancer: (resourceId, enhancerId, params = {}) => this.request({
        path: `/resource/${resourceId}/enhancer/${enhancerId}/enhancement/apply`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetSearchOperationsForProperty
       * @request GET:/resource/search-operation
       */
      getSearchOperationsForProperty: (query, params = {}) => this.request({
        path: `/resource/search-operation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSearchOperationsForProperty
       * @name getSearchOperationsForPropertyUrl
       */
      getSearchOperationsForPropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search-operation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetSearchOperationsByPropertyType
       * @request GET:/resource/search-operation/by-type
       */
      getSearchOperationsByPropertyType: (query, params = {}) => this.request({
        path: `/resource/search-operation/by-type`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSearchOperationsByPropertyType
       * @name getSearchOperationsByPropertyTypeUrl
       */
      getSearchOperationsByPropertyTypeUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search-operation/by-type`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetFilterValueProperty
       * @request GET:/resource/filter-value-property
       */
      getFilterValueProperty: (query, params = {}) => this.request({
        path: `/resource/filter-value-property`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFilterValueProperty
       * @name getFilterValuePropertyUrl
       */
      getFilterValuePropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/filter-value-property`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetLastResourceSearch
       * @request GET:/resource/last-search
       */
      getLastResourceSearch: (params = {}) => this.request({
        path: `/resource/last-search`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getLastResourceSearch
       * @name getLastResourceSearchUrl
       */
      getLastResourceSearchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/last-search`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SaveNewResourceSearch
       * @request POST:/resource/saved-search
       */
      saveNewResourceSearch: (data, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for saveNewResourceSearch
       * @name saveNewResourceSearchUrl
       */
      saveNewResourceSearchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PutSavedSearchName
       * @request PUT:/resource/saved-search
       */
      putSavedSearchName: (data, query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putSavedSearchName
       * @name putSavedSearchNameUrl
       */
      putSavedSearchNameUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetSavedSearch
       * @request GET:/resource/saved-search
       */
      getSavedSearch: (query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSavedSearch
       * @name getSavedSearchUrl
       */
      getSavedSearchUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DeleteSavedSearch
       * @request DELETE:/resource/saved-search
       */
      deleteSavedSearch: (query, params = {}) => this.request({
        path: `/resource/saved-search`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteSavedSearch
       * @name deleteSavedSearchUrl
       */
      deleteSavedSearchUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PutSavedSearchDisplayMode
       * @request PUT:/resource/saved-search/display-mode
       */
      putSavedSearchDisplayMode: (data, query, params = {}) => this.request({
        path: `/resource/saved-search/display-mode`,
        method: "PUT",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putSavedSearchDisplayMode
       * @name putSavedSearchDisplayModeUrl
       */
      putSavedSearchDisplayModeUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/saved-search/display-mode`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchResources
       * @request POST:/resource/search
       */
      searchResources: (data, query, params = {}) => this.request({
        path: `/resource/search`,
        method: "POST",
        query,
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchResources
       * @name searchResourcesUrl
       */
      searchResourcesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchAllResourceIds
       * @request POST:/resource/search/ids
       */
      searchAllResourceIds: (data, params = {}) => this.request({
        path: `/resource/search/ids`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchAllResourceIds
       * @name searchAllResourceIdsUrl
       */
      searchAllResourceIdsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search/ids`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourcesByKeys
       * @request GET:/resource/keys
       */
      getResourcesByKeys: (query, params = {}) => this.request({
        path: `/resource/keys`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourcesByKeys
       * @name getResourcesByKeysUrl
       */
      getResourcesByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/keys`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceHierarchyContext
       * @request GET:/resource/{id}/hierarchy-context
       */
      getResourceHierarchyContext: (id2, params = {}) => this.request({
        path: `/resource/${id2}/hierarchy-context`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name OpenResourceDirectory
       * @request GET:/resource/directory
       */
      openResourceDirectory: (query, params = {}) => this.request({
        path: `/resource/directory`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openResourceDirectory
       * @name openResourceDirectoryUrl
       */
      openResourceDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DiscoverResourceCover
       * @request GET:/resource/{id}/cover
       */
      discoverResourceCover: (id2, params = {}) => this.request({
        path: `/resource/${id2}/cover`,
        method: "GET",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name SaveCover
       * @request PUT:/resource/{id}/cover
       */
      saveCover: (id2, data, params = {}) => this.request({
        path: `/resource/${id2}/cover`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourcePlayableFiles
       * @request GET:/resource/{id}/playable-files
       */
      getResourcePlayableFiles: (id2, params = {}) => this.request({
        path: `/resource/${id2}/playable-files`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name SetResourceMediaLibraries
       * @request PUT:/resource/media-libraries
       */
      setResourceMediaLibraries: (data, params = {}) => this.request({
        path: `/resource/media-libraries`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for setResourceMediaLibraries
       * @name setResourceMediaLibrariesUrl
       */
      setResourceMediaLibrariesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/media-libraries`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceMediaLibraryMappings
       * @request POST:/resource/media-library-mappings
       */
      getResourceMediaLibraryMappings: (data, params = {}) => this.request({
        path: `/resource/media-library-mappings`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourceMediaLibraryMappings
       * @name getResourceMediaLibraryMappingsUrl
       */
      getResourceMediaLibraryMappingsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/media-library-mappings`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceDataForPreviewer
       * @request GET:/resource/{id}/previewer
       */
      getResourceDataForPreviewer: (id2, params = {}) => this.request({
        path: `/resource/${id2}/previewer`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name PutResourcePropertyValue
       * @request PUT:/resource/{id}/property-value
       */
      putResourcePropertyValue: (id2, data, params = {}) => this.request({
        path: `/resource/${id2}/property-value`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name BulkPutResourcePropertyValue
       * @request PUT:/resource/bulk/property-value
       */
      bulkPutResourcePropertyValue: (data, params = {}) => this.request({
        path: `/resource/bulk/property-value`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for bulkPutResourcePropertyValue
       * @name bulkPutResourcePropertyValueUrl
       */
      bulkPutResourcePropertyValueUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/bulk/property-value`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PlayResourceFile
       * @request GET:/resource/{resourceId}/play
       */
      playResourceFile: (resourceId, query, params = {}) => this.request({
        path: `/resource/${resourceId}/play`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name PlayRandomResource
       * @request GET:/resource/play/random
       */
      playRandomResource: (params = {}) => this.request({
        path: `/resource/play/random`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for playRandomResource
       * @name playRandomResourceUrl
       */
      playRandomResourceUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/play/random`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name DeleteResourcesByKeys
       * @request DELETE:/resource/ids
       */
      deleteResourcesByKeys: (query, params = {}) => this.request({
        path: `/resource/ids`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteResourcesByKeys
       * @name deleteResourcesByKeysUrl
       */
      deleteResourcesByKeysUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/ids`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name PinResource
       * @request PUT:/resource/{id}/pin
       */
      pinResource: (id2, query, params = {}) => this.request({
        path: `/resource/${id2}/pin`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name TransferResourceData
       * @request PUT:/resource/transfer
       */
      transferResourceData: (data, params = {}) => this.request({
        path: `/resource/transfer`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for transferResourceData
       * @name transferResourceDataUrl
       */
      transferResourceDataUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/transfer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name SearchResourcePaths
       * @request GET:/resource/paths
       */
      searchResourcePaths: (query, params = {}) => this.request({
        path: `/resource/paths`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchResourcePaths
       * @name searchResourcePathsUrl
       */
      searchResourcePathsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/paths`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name MarkResourceAsNotPlayed
       * @request DELETE:/resource/{id}/played-at
       */
      markResourceAsNotPlayed: (id2, params = {}) => this.request({
        path: `/resource/${id2}/played-at`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceSearchKeywordRecommendation
       * @request GET:/resource/search/keyword-recommendation
       */
      getResourceSearchKeywordRecommendation: (query, params = {}) => this.request({
        path: `/resource/search/keyword-recommendation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourceSearchKeywordRecommendation
       * @name getResourceSearchKeywordRecommendationUrl
       */
      getResourceSearchKeywordRecommendationUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/search/keyword-recommendation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Resource
       * @name GetResourceMediaLibraries
       * @request GET:/resource/{id}/media-libraries
       */
      getResourceMediaLibraries: (id2, params = {}) => this.request({
        path: `/resource/${id2}/media-libraries`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name ReplaceResourceMediaLibraryMappings
       * @request PUT:/resource/{id}/media-libraries
       */
      replaceResourceMediaLibraryMappings: (id2, data, params = {}) => this.request({
        path: `/resource/${id2}/media-libraries`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name AddResourceMediaLibraryMapping
       * @request POST:/resource/{id}/media-libraries/{mediaLibraryId}
       */
      addResourceMediaLibraryMapping: (id2, mediaLibraryId, params = {}) => this.request({
        path: `/resource/${id2}/media-libraries/${mediaLibraryId}`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name RemoveResourceMediaLibraryMapping
       * @request DELETE:/resource/{id}/media-libraries/{mediaLibraryId}
       */
      removeResourceMediaLibraryMapping: (id2, mediaLibraryId, params = {}) => this.request({
        path: `/resource/${id2}/media-libraries/${mediaLibraryId}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Resource
       * @name BulkAddResourceMediaLibraryMappings
       * @request POST:/resource/bulk/media-libraries
       */
      bulkAddResourceMediaLibraryMappings: (data, params = {}) => this.request({
        path: `/resource/bulk/media-libraries`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for bulkAddResourceMediaLibraryMappings
       * @name bulkAddResourceMediaLibraryMappingsUrl
       */
      bulkAddResourceMediaLibraryMappingsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/bulk/media-libraries`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ResourceDiscovery
       * @name StreamResourceDiscovery
       * @request GET:/resource/discovery/stream
       */
      streamResourceDiscovery: (params = {}) => this.request({
        path: `/resource/discovery/stream`,
        method: "GET",
        ...params
      }),
      /**
       * @description Build URL for streamResourceDiscovery
       * @name streamResourceDiscoveryUrl
       */
      streamResourceDiscoveryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/discovery/stream`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ResourceDiscovery
       * @name SubscribeResourceDiscovery
       * @request POST:/resource/discovery/subscribe
       */
      subscribeResourceDiscovery: (data, params = {}) => this.request({
        path: `/resource/discovery/subscribe`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for subscribeResourceDiscovery
       * @name subscribeResourceDiscoveryUrl
       */
      subscribeResourceDiscoveryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/discovery/subscribe`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ResourceDiscovery
       * @name SubscribeResourceDiscoveryBatch
       * @request POST:/resource/discovery/subscribe/batch
       */
      subscribeResourceDiscoveryBatch: (data, params = {}) => this.request({
        path: `/resource/discovery/subscribe/batch`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for subscribeResourceDiscoveryBatch
       * @name subscribeResourceDiscoveryBatchUrl
       */
      subscribeResourceDiscoveryBatchUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource/discovery/subscribe/batch`;
        return baseUrl + path;
      }
    });
    __publicField(this, "mediaLibrary", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteByEnhancementsMediaLibrary
       * @request DELETE:/media-library/{mediaLibraryId}/enhancement
       */
      deleteByEnhancementsMediaLibrary: (mediaLibraryId, query, params = {}) => this.request({
        path: `/media-library/${mediaLibraryId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByMediaLibraryAndEnhancer
       * @request DELETE:/media-library/{mediaLibraryId}/enhancer/{enhancerId}/enhancements
       */
      deleteEnhancementsByMediaLibraryAndEnhancer: (mediaLibraryId, enhancerId, query, params = {}) => this.request({
        path: `/media-library/${mediaLibraryId}/enhancer/${enhancerId}/enhancements`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name GetAllMediaLibraries
       * @request GET:/media-library
       * @deprecated
       */
      getAllMediaLibraries: (query, params = {}) => this.request({
        path: `/media-library`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraries
       * @name getAllMediaLibrariesUrl
       */
      getAllMediaLibrariesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibrary
       * @request POST:/media-library
       * @deprecated
       */
      addMediaLibrary: (data, params = {}) => this.request({
        path: `/media-library`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibrary
       * @name addMediaLibraryUrl
       */
      addMediaLibraryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name GetMediaLibrary
       * @request GET:/media-library/{id}
       * @deprecated
       */
      getMediaLibrary: (id2, query, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name DeleteMediaLibrary
       * @request DELETE:/media-library/{id}
       * @deprecated
       */
      deleteMediaLibrary: (id2, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name PatchMediaLibrary
       * @request PUT:/media-library/{id}
       * @deprecated
       */
      patchMediaLibrary: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name StartSyncMediaLibrary
       * @request PUT:/media-library/sync
       * @deprecated
       */
      startSyncMediaLibrary: (params = {}) => this.request({
        path: `/media-library/sync`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startSyncMediaLibrary
       * @name startSyncMediaLibraryUrl
       */
      startSyncMediaLibraryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/sync`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name ValidatePathConfiguration
       * @request POST:/media-library/path-configuration-validation
       * @deprecated
       */
      validatePathConfiguration: (data, params = {}) => this.request({
        path: `/media-library/path-configuration-validation`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for validatePathConfiguration
       * @name validatePathConfigurationUrl
       */
      validatePathConfigurationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/path-configuration-validation`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name SortMediaLibrariesInCategory
       * @request PUT:/media-library/orders-in-category
       * @deprecated
       */
      sortMediaLibrariesInCategory: (data, params = {}) => this.request({
        path: `/media-library/orders-in-category`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sortMediaLibrariesInCategory
       * @name sortMediaLibrariesInCategoryUrl
       */
      sortMediaLibrariesInCategoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library/orders-in-category`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibraryPathConfiguration
       * @request POST:/media-library/{id}/path-configuration
       * @deprecated
       */
      addMediaLibraryPathConfiguration: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}/path-configuration`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name RemoveMediaLibraryPathConfiguration
       * @request DELETE:/media-library/{id}/path-configuration
       * @deprecated
       */
      removeMediaLibraryPathConfiguration: (id2, data, params = {}) => this.request({
        path: `/media-library/${id2}/path-configuration`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibrariesInBulk
       * @request POST:/media-library/bulk-add/{cId}
       * @deprecated
       */
      addMediaLibrariesInBulk: (cId, data, params = {}) => this.request({
        path: `/media-library/bulk-add/${cId}`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name AddMediaLibraryRootPathsInBulk
       * @request POST:/media-library/{mlId}/path-configuration/root-paths
       * @deprecated
       */
      addMediaLibraryRootPathsInBulk: (mlId, data, params = {}) => this.request({
        path: `/media-library/${mlId}/path-configuration/root-paths`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibrary
       * @name StartSyncingMediaLibraryResources
       * @request PUT:/media-library/{id}/synchronization
       * @deprecated
       */
      startSyncingMediaLibraryResources: (id2, params = {}) => this.request({
        path: `/media-library/${id2}/synchronization`,
        method: "PUT",
        format: "json",
        ...params
      })
    });
    __publicField(this, "enhancer", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByEnhancer
       * @request DELETE:/enhancer/{enhancerId}/enhancement
       */
      deleteEnhancementsByEnhancer: (enhancerId, query, params = {}) => this.request({
        path: `/enhancer/${enhancerId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancer
       * @name GetAllEnhancerDescriptors
       * @request GET:/enhancer/descriptor
       */
      getAllEnhancerDescriptors: (params = {}) => this.request({
        path: `/enhancer/descriptor`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllEnhancerDescriptors
       * @name getAllEnhancerDescriptorsUrl
       */
      getAllEnhancerDescriptorsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/enhancer/descriptor`;
        return baseUrl + path;
      }
    });
    __publicField(this, "resourceProfile", {
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByResourceProfile
       * @request DELETE:/resource-profile/{profileId}/enhancement
       */
      deleteEnhancementsByResourceProfile: (profileId, query, params = {}) => this.request({
        path: `/resource-profile/${profileId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Enhancement
       * @name DeleteEnhancementsByResourceProfileAndEnhancer
       * @request DELETE:/resource-profile/{profileId}/enhancer/{enhancerId}/enhancement
       */
      deleteEnhancementsByResourceProfileAndEnhancer: (profileId, enhancerId, query, params = {}) => this.request({
        path: `/resource-profile/${profileId}/enhancer/${enhancerId}/enhancement`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name GetAllResourceProfiles
       * @request GET:/resource-profile
       */
      getAllResourceProfiles: (params = {}) => this.request({
        path: `/resource-profile`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllResourceProfiles
       * @name getAllResourceProfilesUrl
       */
      getAllResourceProfilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource-profile`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name AddResourceProfile
       * @request POST:/resource-profile
       */
      addResourceProfile: (data, params = {}) => this.request({
        path: `/resource-profile`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addResourceProfile
       * @name addResourceProfileUrl
       */
      addResourceProfileUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/resource-profile`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name GetResourceProfile
       * @request GET:/resource-profile/{id}
       */
      getResourceProfile: (id2, params = {}) => this.request({
        path: `/resource-profile/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name UpdateResourceProfile
       * @request PUT:/resource-profile/{id}
       */
      updateResourceProfile: (id2, data, params = {}) => this.request({
        path: `/resource-profile/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name DeleteResourceProfile
       * @request DELETE:/resource-profile/{id}
       */
      deleteResourceProfile: (id2, params = {}) => this.request({
        path: `/resource-profile/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ResourceProfile
       * @name GetMatchingProfilesForResource
       * @request GET:/resource-profile/by-resource/{resourceId}
       */
      getMatchingProfilesForResource: (resourceId, params = {}) => this.request({
        path: `/resource-profile/by-resource/${resourceId}`,
        method: "GET",
        format: "json",
        ...params
      })
    });
    __publicField(this, "extensionGroup", {
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name GetAllExtensionGroups
       * @request GET:/extension-group
       */
      getAllExtensionGroups: (params = {}) => this.request({
        path: `/extension-group`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllExtensionGroups
       * @name getAllExtensionGroupsUrl
       */
      getAllExtensionGroupsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/extension-group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name AddExtensionGroup
       * @request POST:/extension-group
       */
      addExtensionGroup: (data, params = {}) => this.request({
        path: `/extension-group`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addExtensionGroup
       * @name addExtensionGroupUrl
       */
      addExtensionGroupUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/extension-group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name GetExtensionGroup
       * @request GET:/extension-group/{id}
       */
      getExtensionGroup: (id2, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name PutExtensionGroup
       * @request PUT:/extension-group/{id}
       */
      putExtensionGroup: (id2, data, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags ExtensionGroup
       * @name DeleteExtensionGroup
       * @request DELETE:/extension-group/{id}
       */
      deleteExtensionGroup: (id2, params = {}) => this.request({
        path: `/extension-group/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "file", {
      /**
       * No description
       *
       * @tags File
       * @name DetectCompressedFiles
       * @request POST:/file/decompression/detect
       */
      detectCompressedFiles: (data, params = {}) => this.request({
        path: `/file/decompression/detect`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      }),
      /**
       * @description Build URL for detectCompressedFiles
       * @name detectCompressedFilesUrl
       */
      detectCompressedFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression/detect`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name DecompressCompressedFiles
       * @request POST:/file/decompression/decompress
       */
      decompressCompressedFiles: (data, params = {}) => this.request({
        path: `/file/decompression/decompress`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      }),
      /**
       * @description Build URL for decompressCompressedFiles
       * @name decompressCompressedFilesUrl
       */
      decompressCompressedFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression/decompress`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetTopLevelFileSystemEntryNames
       * @request GET:/file/top-level-file-system-entries
       */
      getTopLevelFileSystemEntryNames: (query, params = {}) => this.request({
        path: `/file/top-level-file-system-entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTopLevelFileSystemEntryNames
       * @name getTopLevelFileSystemEntryNamesUrl
       */
      getTopLevelFileSystemEntryNamesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/top-level-file-system-entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name SearchFileSystemEntries
       * @request GET:/file/search-fs-entries
       */
      searchFileSystemEntries: (query, params = {}) => this.request({
        path: `/file/search-fs-entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchFileSystemEntries
       * @name searchFileSystemEntriesUrl
       */
      searchFileSystemEntriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/search-fs-entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIwFsInfo
       * @request GET:/file/iwfs-info
       */
      getIwFsInfo: (query, params = {}) => this.request({
        path: `/file/iwfs-info`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIwFsInfo
       * @name getIwFsInfoUrl
       */
      getIwFsInfoUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/iwfs-info`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIwFsEntry
       * @request GET:/file/iwfs-entry
       */
      getIwFsEntry: (query, params = {}) => this.request({
        path: `/file/iwfs-entry`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIwFsEntry
       * @name getIwFsEntryUrl
       */
      getIwFsEntryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/iwfs-entry`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CreateDirectory
       * @request POST:/file/directory
       */
      createDirectory: (query, params = {}) => this.request({
        path: `/file/directory`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for createDirectory
       * @name createDirectoryUrl
       */
      createDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetChildrenIwFsInfo
       * @request GET:/file/children/iwfs-info
       */
      getChildrenIwFsInfo: (query, params = {}) => this.request({
        path: `/file/children/iwfs-info`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getChildrenIwFsInfo
       * @name getChildrenIwFsInfoUrl
       */
      getChildrenIwFsInfoUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/children/iwfs-info`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RemoveFiles
       * @request DELETE:/file
       */
      removeFiles: (data, params = {}) => this.request({
        path: `/file`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for removeFiles
       * @name removeFilesUrl
       */
      removeFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RenameFile
       * @request PUT:/file/name
       */
      renameFile: (data, params = {}) => this.request({
        path: `/file/name`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for renameFile
       * @name renameFileUrl
       */
      renameFileUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/name`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name OpenRecycleBin
       * @request GET:/file/recycle-bin
       */
      openRecycleBin: (params = {}) => this.request({
        path: `/file/recycle-bin`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openRecycleBin
       * @name openRecycleBinUrl
       */
      openRecycleBinUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/recycle-bin`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name ExtractAndRemoveDirectory
       * @request POST:/file/extract-and-remove-directory
       */
      extractAndRemoveDirectory: (query, params = {}) => this.request({
        path: `/file/extract-and-remove-directory`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for extractAndRemoveDirectory
       * @name extractAndRemoveDirectoryUrl
       */
      extractAndRemoveDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/extract-and-remove-directory`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name MoveEntries
       * @request POST:/file/move-entries
       */
      moveEntries: (data, params = {}) => this.request({
        path: `/file/move-entries`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for moveEntries
       * @name moveEntriesUrl
       */
      moveEntriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/move-entries`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CopyEntries
       * @request POST:/file/copy-entries
       */
      copyEntries: (data, params = {}) => this.request({
        path: `/file/copy-entries`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for copyEntries
       * @name copyEntriesUrl
       */
      copyEntriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/copy-entries`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetSameNameEntriesInWorkingDirectory
       * @request POST:/file/same-name-entries-in-working-directory
       */
      getSameNameEntriesInWorkingDirectory: (data, params = {}) => this.request({
        path: `/file/same-name-entries-in-working-directory`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSameNameEntriesInWorkingDirectory
       * @name getSameNameEntriesInWorkingDirectoryUrl
       */
      getSameNameEntriesInWorkingDirectoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/same-name-entries-in-working-directory`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name RemoveSameNameEntryInWorkingDirectory
       * @request DELETE:/file/same-name-entry-in-working-directory
       */
      removeSameNameEntryInWorkingDirectory: (data, params = {}) => this.request({
        path: `/file/same-name-entry-in-working-directory`,
        method: "DELETE",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for removeSameNameEntryInWorkingDirectory
       * @name removeSameNameEntryInWorkingDirectoryUrl
       */
      removeSameNameEntryInWorkingDirectoryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/same-name-entry-in-working-directory`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StandardizeEntryName
       * @request PUT:/file/standardize
       */
      standardizeEntryName: (query, params = {}) => this.request({
        path: `/file/standardize`,
        method: "PUT",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for standardizeEntryName
       * @name standardizeEntryNameUrl
       */
      standardizeEntryNameUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/standardize`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CheckFilePlayability
       * @request GET:/file/playability
       */
      checkFilePlayability: (query, params = {}) => this.request({
        path: `/file/playability`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkFilePlayability
       * @name checkFilePlayabilityUrl
       */
      checkFilePlayabilityUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/playability`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name PlayFile
       * @request GET:/file/play
       */
      playFile: (query, params = {}) => this.request({
        path: `/file/play`,
        method: "GET",
        query,
        ...params
      }),
      /**
       * @description Build URL for playFile
       * @name playFileUrl
       */
      playFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/play`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name DecompressFiles
       * @request POST:/file/decompression
       */
      decompressFiles: (data, params = {}) => this.request({
        path: `/file/decompression`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for decompressFiles
       * @name decompressFilesUrl
       */
      decompressFilesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/decompression`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetIconData
       * @request GET:/file/icon
       */
      getIconData: (query, params = {}) => this.request({
        path: `/file/icon`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getIconData
       * @name getIconDataUrl
       */
      getIconDataUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/icon`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetAllFiles
       * @request GET:/file/all-files
       */
      getAllFiles: (query, params = {}) => this.request({
        path: `/file/all-files`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllFiles
       * @name getAllFilesUrl
       */
      getAllFilesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/all-files`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetCompressedFileEntries
       * @request GET:/file/compressed-file/entries
       */
      getCompressedFileEntries: (query, params = {}) => this.request({
        path: `/file/compressed-file/entries`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCompressedFileEntries
       * @name getCompressedFileEntriesUrl
       */
      getCompressedFileEntriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/compressed-file/entries`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetFileExtensionCounts
       * @request GET:/file/file-extension-counts
       */
      getFileExtensionCounts: (query, params = {}) => this.request({
        path: `/file/file-extension-counts`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFileExtensionCounts
       * @name getFileExtensionCountsUrl
       */
      getFileExtensionCountsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-extension-counts`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name PreviewFileSystemEntriesGroupResult
       * @request PUT:/file/group-preview
       */
      previewFileSystemEntriesGroupResult: (data, params = {}) => this.request({
        path: `/file/group-preview`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for previewFileSystemEntriesGroupResult
       * @name previewFileSystemEntriesGroupResultUrl
       */
      previewFileSystemEntriesGroupResultUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/group-preview`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GroupFileSystemEntries
       * @request PUT:/file/group
       */
      groupFileSystemEntries: (data, params = {}) => this.request({
        path: `/file/group`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for groupFileSystemEntries
       * @name groupFileSystemEntriesUrl
       */
      groupFileSystemEntriesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/group`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StartWatchingChangesInFileProcessorWorkspace
       * @request POST:/file/file-processor-watcher
       */
      startWatchingChangesInFileProcessorWorkspace: (query, params = {}) => this.request({
        path: `/file/file-processor-watcher`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startWatchingChangesInFileProcessorWorkspace
       * @name startWatchingChangesInFileProcessorWorkspaceUrl
       */
      startWatchingChangesInFileProcessorWorkspaceUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-processor-watcher`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name StopWatchingChangesInFileProcessorWorkspace
       * @request DELETE:/file/file-processor-watcher
       */
      stopWatchingChangesInFileProcessorWorkspace: (params = {}) => this.request({
        path: `/file/file-processor-watcher`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopWatchingChangesInFileProcessorWorkspace
       * @name stopWatchingChangesInFileProcessorWorkspaceUrl
       */
      stopWatchingChangesInFileProcessorWorkspaceUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-processor-watcher`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name KeepAliveFileProcessorWatcher
       * @request PUT:/file/file-processor-watcher/keep-alive
       */
      keepAliveFileProcessorWatcher: (params = {}) => this.request({
        path: `/file/file-processor-watcher/keep-alive`,
        method: "PUT",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for keepAliveFileProcessorWatcher
       * @name keepAliveFileProcessorWatcherUrl
       */
      keepAliveFileProcessorWatcherUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/file-processor-watcher/keep-alive`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name CheckPathIsFile
       * @request GET:/file/is-file
       */
      checkPathIsFile: (query, params = {}) => this.request({
        path: `/file/is-file`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkPathIsFile
       * @name checkPathIsFileUrl
       */
      checkPathIsFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/is-file`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetHardwareAccelerationInfo
       * @request GET:/file/hardware-acceleration
       */
      getHardwareAccelerationInfo: (params = {}) => this.request({
        path: `/file/hardware-acceleration`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getHardwareAccelerationInfo
       * @name getHardwareAccelerationInfoUrl
       */
      getHardwareAccelerationInfoUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/hardware-acceleration`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name ClearHardwareAccelerationCache
       * @request POST:/file/hardware-acceleration/clear-cache
       */
      clearHardwareAccelerationCache: (params = {}) => this.request({
        path: `/file/hardware-acceleration/clear-cache`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearHardwareAccelerationCache
       * @name clearHardwareAccelerationCacheUrl
       */
      clearHardwareAccelerationCacheUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/hardware-acceleration/clear-cache`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name GetFirstFileByExtension
       * @request GET:/file/first-file-by-ext
       */
      getFirstFileByExtension: (query, params = {}) => this.request({
        path: `/file/first-file-by-ext`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFirstFileByExtension
       * @name getFirstFileByExtensionUrl
       */
      getFirstFileByExtensionUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/first-file-by-ext`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags File
       * @name UploadFile
       * @request POST:/file/upload
       */
      uploadFile: (data, params = {}) => this.request({
        path: `/file/upload`,
        method: "POST",
        body: data,
        type: "multipart/form-data",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for uploadFile
       * @name uploadFileUrl
       */
      uploadFileUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file/upload`;
        return baseUrl + path;
      }
    });
    __publicField(this, "fileNameModifier", {
      /**
       * No description
       *
       * @tags FileNameModifier
       * @name PreviewFileNameModification
       * @request POST:/file-name-modifier/preview
       */
      previewFileNameModification: (data, params = {}) => this.request({
        path: `/file-name-modifier/preview`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for previewFileNameModification
       * @name previewFileNameModificationUrl
       */
      previewFileNameModificationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file-name-modifier/preview`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags FileNameModifier
       * @name ModifyFileNames
       * @request POST:/file-name-modifier/modify
       */
      modifyFileNames: (data, params = {}) => this.request({
        path: `/file-name-modifier/modify`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for modifyFileNames
       * @name modifyFileNamesUrl
       */
      modifyFileNamesUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/file-name-modifier/modify`;
        return baseUrl + path;
      }
    });
    __publicField(this, "gui", {
      /**
       * No description
       *
       * @tags Gui
       * @name OpenUrlInDefaultBrowser
       * @request GET:/gui/url
       */
      openUrlInDefaultBrowser: (query, params = {}) => this.request({
        path: `/gui/url`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openUrlInDefaultBrowser
       * @name openUrlInDefaultBrowserUrl
       */
      openUrlInDefaultBrowserUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/gui/url`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Gui
       * @name SendTestNotification
       * @request POST:/gui/test-notification
       */
      sendTestNotification: (data, params = {}) => this.request({
        path: `/gui/test-notification`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for sendTestNotification
       * @name sendTestNotificationUrl
       */
      sendTestNotificationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/gui/test-notification`;
        return baseUrl + path;
      }
    });
    __publicField(this, "log", {
      /**
       * No description
       *
       * @tags Log
       * @name GetAllLogs
       * @request GET:/log
       */
      getAllLogs: (params = {}) => this.request({
        path: `/log`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllLogs
       * @name getAllLogsUrl
       */
      getAllLogsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name ClearAllLog
       * @request DELETE:/log
       */
      clearAllLog: (params = {}) => this.request({
        path: `/log`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for clearAllLog
       * @name clearAllLogUrl
       */
      clearAllLogUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name SearchLogs
       * @request GET:/log/filtered
       */
      searchLogs: (query, params = {}) => this.request({
        path: `/log/filtered`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchLogs
       * @name searchLogsUrl
       */
      searchLogsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/filtered`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name GetUnreadLogCount
       * @request GET:/log/unread/count
       */
      getUnreadLogCount: (params = {}) => this.request({
        path: `/log/unread/count`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUnreadLogCount
       * @name getUnreadLogCountUrl
       */
      getUnreadLogCountUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/unread/count`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Log
       * @name ReadLog
       * @request PATCH:/log/{id}/read
       */
      readLog: (id2, params = {}) => this.request({
        path: `/log/${id2}/read`,
        method: "PATCH",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Log
       * @name ReadAllLog
       * @request PATCH:/log/read
       */
      readAllLog: (params = {}) => this.request({
        path: `/log/read`,
        method: "PATCH",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for readAllLog
       * @name readAllLogUrl
       */
      readAllLogUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/log/read`;
        return baseUrl + path;
      }
    });
    __publicField(this, "mediaLibraryResourceMapping", {
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name GetAllMediaLibraryResourceMappings
       * @request GET:/media-library-resource-mapping
       */
      getAllMediaLibraryResourceMappings: (params = {}) => this.request({
        path: `/media-library-resource-mapping`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraryResourceMappings
       * @name getAllMediaLibraryResourceMappingsUrl
       */
      getAllMediaLibraryResourceMappingsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-resource-mapping`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name AddMediaLibraryResourceMapping
       * @request POST:/media-library-resource-mapping
       */
      addMediaLibraryResourceMapping: (data, params = {}) => this.request({
        path: `/media-library-resource-mapping`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryResourceMapping
       * @name addMediaLibraryResourceMappingUrl
       */
      addMediaLibraryResourceMappingUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-resource-mapping`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name GetMappingsByResourceId
       * @request GET:/media-library-resource-mapping/by-resource/{resourceId}
       */
      getMappingsByResourceId: (resourceId, params = {}) => this.request({
        path: `/media-library-resource-mapping/by-resource/${resourceId}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name DeleteMappingsByResourceId
       * @request DELETE:/media-library-resource-mapping/by-resource/{resourceId}
       */
      deleteMappingsByResourceId: (resourceId, params = {}) => this.request({
        path: `/media-library-resource-mapping/by-resource/${resourceId}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name GetMappingsByMediaLibraryId
       * @request GET:/media-library-resource-mapping/by-media-library/{mediaLibraryId}
       */
      getMappingsByMediaLibraryId: (mediaLibraryId, params = {}) => this.request({
        path: `/media-library-resource-mapping/by-media-library/${mediaLibraryId}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name DeleteMediaLibraryResourceMapping
       * @request DELETE:/media-library-resource-mapping/{id}
       */
      deleteMediaLibraryResourceMapping: (id2, params = {}) => this.request({
        path: `/media-library-resource-mapping/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name EnsureMediaLibraryResourceMappings
       * @request POST:/media-library-resource-mapping/ensure
       */
      ensureMediaLibraryResourceMappings: (data, params = {}) => this.request({
        path: `/media-library-resource-mapping/ensure`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for ensureMediaLibraryResourceMappings
       * @name ensureMediaLibraryResourceMappingsUrl
       */
      ensureMediaLibraryResourceMappingsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-resource-mapping/ensure`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryResourceMapping
       * @name ReplaceMediaLibraryResourceMappings
       * @request POST:/media-library-resource-mapping/replace
       */
      replaceMediaLibraryResourceMappings: (data, params = {}) => this.request({
        path: `/media-library-resource-mapping/replace`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for replaceMediaLibraryResourceMappings
       * @name replaceMediaLibraryResourceMappingsUrl
       */
      replaceMediaLibraryResourceMappingsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-resource-mapping/replace`;
        return baseUrl + path;
      }
    });
    __publicField(this, "mediaLibraryTemplate", {
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetAllMediaLibraryTemplates
       * @request GET:/media-library-template
       * @deprecated
       */
      getAllMediaLibraryTemplates: (query, params = {}) => this.request({
        path: `/media-library-template`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraryTemplates
       * @name getAllMediaLibraryTemplatesUrl
       */
      getAllMediaLibraryTemplatesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplate
       * @request POST:/media-library-template
       * @deprecated
       */
      addMediaLibraryTemplate: (data, params = {}) => this.request({
        path: `/media-library-template`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplate
       * @name addMediaLibraryTemplateUrl
       */
      addMediaLibraryTemplateUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplate
       * @request GET:/media-library-template/{id}
       * @deprecated
       */
      getMediaLibraryTemplate: (id2, query, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name PutMediaLibraryTemplate
       * @request PUT:/media-library-template/{id}
       * @deprecated
       */
      putMediaLibraryTemplate: (id2, data, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name DeleteMediaLibraryTemplate
       * @request DELETE:/media-library-template/{id}
       * @deprecated
       */
      deleteMediaLibraryTemplate: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplateShareCode
       * @request GET:/media-library-template/{id}/share-text
       * @deprecated
       */
      getMediaLibraryTemplateShareCode: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}/share-text`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplateImportConfiguration
       * @request POST:/media-library-template/share-code/import-configuration
       * @deprecated
       */
      getMediaLibraryTemplateImportConfiguration: (data, params = {}) => this.request({
        path: `/media-library-template/share-code/import-configuration`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getMediaLibraryTemplateImportConfiguration
       * @name getMediaLibraryTemplateImportConfigurationUrl
       */
      getMediaLibraryTemplateImportConfigurationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/share-code/import-configuration`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name ImportMediaLibraryTemplate
       * @request POST:/media-library-template/share-code/import
       * @deprecated
       */
      importMediaLibraryTemplate: (data, params = {}) => this.request({
        path: `/media-library-template/share-code/import`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for importMediaLibraryTemplate
       * @name importMediaLibraryTemplateUrl
       */
      importMediaLibraryTemplateUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/share-code/import`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplateByMediaLibraryV1
       * @request POST:/media-library-template/by-media-library-v1
       * @deprecated
       */
      addMediaLibraryTemplateByMediaLibraryV1: (data, params = {}) => this.request({
        path: `/media-library-template/by-media-library-v1`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplateByMediaLibraryV1
       * @name addMediaLibraryTemplateByMediaLibraryV1Url
       */
      addMediaLibraryTemplateByMediaLibraryV1Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/by-media-library-v1`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name DuplicateMediaLibraryTemplate
       * @request POST:/media-library-template/{id}/duplicate
       * @deprecated
       */
      duplicateMediaLibraryTemplate: (id2, params = {}) => this.request({
        path: `/media-library-template/${id2}/duplicate`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name GetMediaLibraryTemplatePresetDataPool
       * @request GET:/media-library-template/preset-data-pool
       * @deprecated
       */
      getMediaLibraryTemplatePresetDataPool: (params = {}) => this.request({
        path: `/media-library-template/preset-data-pool`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getMediaLibraryTemplatePresetDataPool
       * @name getMediaLibraryTemplatePresetDataPoolUrl
       */
      getMediaLibraryTemplatePresetDataPoolUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/preset-data-pool`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name AddMediaLibraryTemplateFromPresetBuilder
       * @request POST:/media-library-template/from-preset-builder
       * @deprecated
       */
      addMediaLibraryTemplateFromPresetBuilder: (data, params = {}) => this.request({
        path: `/media-library-template/from-preset-builder`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryTemplateFromPresetBuilder
       * @name addMediaLibraryTemplateFromPresetBuilderUrl
       */
      addMediaLibraryTemplateFromPresetBuilderUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-template/from-preset-builder`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryTemplate
       * @name ValidateMediaLibraryTemplate
       * @request POST:/media-library-template/{id}/validate
       * @deprecated
       */
      validateMediaLibraryTemplate: (id2, data, params = {}) => this.request({
        path: `/media-library-template/${id2}/validate`,
        method: "POST",
        body: data,
        type: "application/json",
        ...params
      })
    });
    __publicField(this, "mediaLibraryV2", {
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetAllMediaLibraryV2
       * @request GET:/media-library-v2
       */
      getAllMediaLibraryV2: (query, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllMediaLibraryV2
       * @name getAllMediaLibraryV2Url
       */
      getAllMediaLibraryV2Url: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name AddMediaLibraryV2
       * @request POST:/media-library-v2
       */
      addMediaLibraryV2: (data, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addMediaLibraryV2
       * @name addMediaLibraryV2Url
       */
      addMediaLibraryV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SaveAllMediaLibrariesV2
       * @request PUT:/media-library-v2
       */
      saveAllMediaLibrariesV2: (data, params = {}) => this.request({
        path: `/media-library-v2`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for saveAllMediaLibrariesV2
       * @name saveAllMediaLibrariesV2Url
       */
      saveAllMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetMediaLibraryV2
       * @request GET:/media-library-v2/{id}
       */
      getMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name PutMediaLibraryV2
       * @request PUT:/media-library-v2/{id}
       */
      putMediaLibraryV2: (id2, data, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name PatchMediaLibraryV2
       * @request PATCH:/media-library-v2/{id}
       */
      patchMediaLibraryV2: (id2, data, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name DeleteMediaLibraryV2
       * @request DELETE:/media-library-v2/{id}
       */
      deleteMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name MarkMediaLibraryV2AsSynced
       * @request PATCH:/media-library-v2/mark-as-synced
       */
      markMediaLibraryV2AsSynced: (data, params = {}) => this.request({
        path: `/media-library-v2/mark-as-synced`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for markMediaLibraryV2AsSynced
       * @name markMediaLibraryV2AsSyncedUrl
       */
      markMediaLibraryV2AsSyncedUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/mark-as-synced`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SyncMediaLibraryV2
       * @request POST:/media-library-v2/{id}/sync
       */
      syncMediaLibraryV2: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/sync`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name SyncAllMediaLibrariesV2
       * @request POST:/media-library-v2/sync-all
       */
      syncAllMediaLibrariesV2: (params = {}) => this.request({
        path: `/media-library-v2/sync-all`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for syncAllMediaLibrariesV2
       * @name syncAllMediaLibrariesV2Url
       */
      syncAllMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/sync-all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetOutdatedMediaLibrariesV2
       * @request GET:/media-library-v2/outdated
       */
      getOutdatedMediaLibrariesV2: (params = {}) => this.request({
        path: `/media-library-v2/outdated`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getOutdatedMediaLibrariesV2
       * @name getOutdatedMediaLibrariesV2Url
       */
      getOutdatedMediaLibrariesV2Url: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/media-library-v2/outdated`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetMediaLibraryV2Resources
       * @request GET:/media-library-v2/{id}/resources
       */
      getMediaLibraryV2Resources: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/resources`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name RemoveAllMediaLibraryV2ResourceMappings
       * @request DELETE:/media-library-v2/{id}/resources
       */
      removeAllMediaLibraryV2ResourceMappings: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/resources`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetMediaLibraryV2ResourceCount
       * @request GET:/media-library-v2/{id}/resource-count
       */
      getMediaLibraryV2ResourceCount: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/resource-count`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags MediaLibraryV2
       * @name GetMediaLibraryV2Statistics
       * @request GET:/media-library-v2/{id}/statistics
       */
      getMediaLibraryV2Statistics: (id2, params = {}) => this.request({
        path: `/media-library-v2/${id2}/statistics`,
        method: "GET",
        format: "json",
        ...params
      })
    });
    __publicField(this, "migration", {
      /**
       * No description
       *
       * @tags Migration
       * @name MigrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary
       * @request POST:/migration/categories-media-libraries-and-resources-to-new-media-library
       */
      migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary: (params = {}) => this.request({
        path: `/migration/categories-media-libraries-and-resources-to-new-media-library`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibrary
       * @name migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibraryUrl
       */
      migrateCategoriesMediaLibrariesAndResourcesToNewMediaLibraryUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/migration/categories-media-libraries-and-resources-to-new-media-library`;
        return baseUrl + path;
      }
    });
    __publicField(this, "options", {
      /**
       * No description
       *
       * @tags Options
       * @name GetAppOptions
       * @request GET:/options/app
       */
      getAppOptions: (params = {}) => this.request({
        path: `/options/app`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAppOptions
       * @name getAppOptionsUrl
       */
      getAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchAppOptions
       * @request PATCH:/options/app
       */
      patchAppOptions: (data, params = {}) => this.request({
        path: `/options/app`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAppOptions
       * @name patchAppOptionsUrl
       */
      patchAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutAppOptions
       * @request PUT:/options/app
       */
      putAppOptions: (data, params = {}) => this.request({
        path: `/options/app`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putAppOptions
       * @name putAppOptionsUrl
       */
      putAppOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/app`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetUiOptions
       * @request GET:/options/ui
       */
      getUiOptions: (params = {}) => this.request({
        path: `/options/ui`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getUiOptions
       * @name getUiOptionsUrl
       */
      getUiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchUiOptions
       * @request PATCH:/options/ui
       */
      patchUiOptions: (data, params = {}) => this.request({
        path: `/options/ui`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchUiOptions
       * @name patchUiOptionsUrl
       */
      patchUiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddLatestUsedProperty
       * @request POST:/options/ui/latest-used-property
       */
      addLatestUsedProperty: (data, params = {}) => this.request({
        path: `/options/ui/latest-used-property`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addLatestUsedProperty
       * @name addLatestUsedPropertyUrl
       */
      addLatestUsedPropertyUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ui/latest-used-property`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetBilibiliOptions
       * @request GET:/options/bilibili
       */
      getBilibiliOptions: (params = {}) => this.request({
        path: `/options/bilibili`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBilibiliOptions
       * @name getBilibiliOptionsUrl
       */
      getBilibiliOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bilibili`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchBilibiliOptions
       * @request PATCH:/options/bilibili
       */
      patchBilibiliOptions: (data, params = {}) => this.request({
        path: `/options/bilibili`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchBilibiliOptions
       * @name patchBilibiliOptionsUrl
       */
      patchBilibiliOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bilibili`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetExHentaiOptions
       * @request GET:/options/exhentai
       */
      getExHentaiOptions: (params = {}) => this.request({
        path: `/options/exhentai`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getExHentaiOptions
       * @name getExHentaiOptionsUrl
       */
      getExHentaiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/exhentai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchExHentaiOptions
       * @request PATCH:/options/exhentai
       */
      patchExHentaiOptions: (data, params = {}) => this.request({
        path: `/options/exhentai`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchExHentaiOptions
       * @name patchExHentaiOptionsUrl
       */
      patchExHentaiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/exhentai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFileSystemOptions
       * @request GET:/options/filesystem
       */
      getFileSystemOptions: (params = {}) => this.request({
        path: `/options/filesystem`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFileSystemOptions
       * @name getFileSystemOptionsUrl
       */
      getFileSystemOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFileSystemOptions
       * @request PATCH:/options/filesystem
       */
      patchFileSystemOptions: (data, params = {}) => this.request({
        path: `/options/filesystem`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFileSystemOptions
       * @name patchFileSystemOptionsUrl
       */
      patchFileSystemOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddLatestMovingDestination
       * @request PUT:/options/filesystem/latest-moving-destination
       */
      addLatestMovingDestination: (data, params = {}) => this.request({
        path: `/options/filesystem/latest-moving-destination`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addLatestMovingDestination
       * @name addLatestMovingDestinationUrl
       */
      addLatestMovingDestinationUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/filesystem/latest-moving-destination`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetJavLibraryOptions
       * @request GET:/options/javlibrary
       */
      getJavLibraryOptions: (params = {}) => this.request({
        path: `/options/javlibrary`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getJavLibraryOptions
       * @name getJavLibraryOptionsUrl
       */
      getJavLibraryOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/javlibrary`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchJavLibraryOptions
       * @request PATCH:/options/javlibrary
       */
      patchJavLibraryOptions: (data, params = {}) => this.request({
        path: `/options/javlibrary`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchJavLibraryOptions
       * @name patchJavLibraryOptionsUrl
       */
      patchJavLibraryOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/javlibrary`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetPixivOptions
       * @request GET:/options/pixiv
       */
      getPixivOptions: (params = {}) => this.request({
        path: `/options/pixiv`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPixivOptions
       * @name getPixivOptionsUrl
       */
      getPixivOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/pixiv`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchPixivOptions
       * @request PATCH:/options/pixiv
       */
      patchPixivOptions: (data, params = {}) => this.request({
        path: `/options/pixiv`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchPixivOptions
       * @name patchPixivOptionsUrl
       */
      patchPixivOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/pixiv`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetResourceOptions
       * @request GET:/options/resource
       */
      getResourceOptions: (params = {}) => this.request({
        path: `/options/resource`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getResourceOptions
       * @name getResourceOptionsUrl
       */
      getResourceOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchResourceOptions
       * @request PATCH:/options/resource
       */
      patchResourceOptions: (data, params = {}) => this.request({
        path: `/options/resource`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchResourceOptions
       * @name patchResourceOptionsUrl
       */
      patchResourceOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name DeleteResourceMarkers
       * @request POST:/options/resource/delete-markers
       */
      deleteResourceMarkers: (params = {}) => this.request({
        path: `/options/resource/delete-markers`,
        method: "POST",
        ...params
      }),
      /**
       * @description Build URL for deleteResourceMarkers
       * @name deleteResourceMarkersUrl
       */
      deleteResourceMarkersUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource/delete-markers`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetRecentResourceFilters
       * @request GET:/options/resource/recent-filters
       */
      getRecentResourceFilters: (params = {}) => this.request({
        path: `/options/resource/recent-filters`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getRecentResourceFilters
       * @name getRecentResourceFiltersUrl
       */
      getRecentResourceFiltersUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource/recent-filters`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name AddRecentResourceFilter
       * @request POST:/options/resource/recent-filters
       */
      addRecentResourceFilter: (data, params = {}) => this.request({
        path: `/options/resource/recent-filters`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addRecentResourceFilter
       * @name addRecentResourceFilterUrl
       */
      addRecentResourceFilterUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/resource/recent-filters`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetThirdPartyOptions
       * @request GET:/options/thirdparty
       */
      getThirdPartyOptions: (params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getThirdPartyOptions
       * @name getThirdPartyOptionsUrl
       */
      getThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchThirdPartyOptions
       * @request PATCH:/options/thirdparty
       */
      patchThirdPartyOptions: (data, params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchThirdPartyOptions
       * @name patchThirdPartyOptionsUrl
       */
      patchThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutThirdPartyOptions
       * @request PUT:/options/thirdparty
       */
      putThirdPartyOptions: (data, params = {}) => this.request({
        path: `/options/thirdparty`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putThirdPartyOptions
       * @name putThirdPartyOptionsUrl
       */
      putThirdPartyOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/thirdparty`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetNetworkOptions
       * @request GET:/options/network
       */
      getNetworkOptions: (params = {}) => this.request({
        path: `/options/network`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getNetworkOptions
       * @name getNetworkOptionsUrl
       */
      getNetworkOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/network`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchNetworkOptions
       * @request PATCH:/options/network
       */
      patchNetworkOptions: (data, params = {}) => this.request({
        path: `/options/network`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchNetworkOptions
       * @name patchNetworkOptionsUrl
       */
      patchNetworkOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/network`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetEnhancerOptions
       * @request GET:/options/enhancer
       */
      getEnhancerOptions: (params = {}) => this.request({
        path: `/options/enhancer`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getEnhancerOptions
       * @name getEnhancerOptionsUrl
       */
      getEnhancerOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/enhancer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchEnhancerOptions
       * @request PATCH:/options/enhancer
       */
      patchEnhancerOptions: (data, params = {}) => this.request({
        path: `/options/enhancer`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchEnhancerOptions
       * @name patchEnhancerOptionsUrl
       */
      patchEnhancerOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/enhancer`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetTaskOptions
       * @request GET:/options/task
       */
      getTaskOptions: (params = {}) => this.request({
        path: `/options/task`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTaskOptions
       * @name getTaskOptionsUrl
       */
      getTaskOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchTaskOptions
       * @request PATCH:/options/task
       */
      patchTaskOptions: (data, params = {}) => this.request({
        path: `/options/task`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchTaskOptions
       * @name patchTaskOptionsUrl
       */
      patchTaskOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetAiOptions
       * @request GET:/options/ai
       */
      getAiOptions: (params = {}) => this.request({
        path: `/options/ai`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAiOptions
       * @name getAiOptionsUrl
       */
      getAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchAiOptions
       * @request PATCH:/options/ai
       */
      patchAiOptions: (data, params = {}) => this.request({
        path: `/options/ai`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchAiOptions
       * @name patchAiOptionsUrl
       */
      patchAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutAiOptions
       * @request PUT:/options/ai
       */
      putAiOptions: (data, params = {}) => this.request({
        path: `/options/ai`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putAiOptions
       * @name putAiOptionsUrl
       */
      putAiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/ai`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetSoulPlusOptions
       * @request GET:/options/soulplus
       */
      getSoulPlusOptions: (params = {}) => this.request({
        path: `/options/soulplus`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getSoulPlusOptions
       * @name getSoulPlusOptionsUrl
       */
      getSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchSoulPlusOptions
       * @request PATCH:/options/soulplus
       */
      patchSoulPlusOptions: (data, params = {}) => this.request({
        path: `/options/soulplus`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchSoulPlusOptions
       * @name patchSoulPlusOptionsUrl
       */
      patchSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PutSoulPlusOptions
       * @request PUT:/options/soulplus
       */
      putSoulPlusOptions: (data, params = {}) => this.request({
        path: `/options/soulplus`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for putSoulPlusOptions
       * @name putSoulPlusOptionsUrl
       */
      putSoulPlusOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/soulplus`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetBangumiOptions
       * @request GET:/options/bangumi
       */
      getBangumiOptions: (params = {}) => this.request({
        path: `/options/bangumi`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getBangumiOptions
       * @name getBangumiOptionsUrl
       */
      getBangumiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bangumi`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchBangumiOptions
       * @request PATCH:/options/bangumi
       */
      patchBangumiOptions: (data, params = {}) => this.request({
        path: `/options/bangumi`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchBangumiOptions
       * @name patchBangumiOptionsUrl
       */
      patchBangumiOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/bangumi`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetCienOptions
       * @request GET:/options/cien
       */
      getCienOptions: (params = {}) => this.request({
        path: `/options/cien`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getCienOptions
       * @name getCienOptionsUrl
       */
      getCienOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/cien`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchCienOptions
       * @request PATCH:/options/cien
       */
      patchCienOptions: (data, params = {}) => this.request({
        path: `/options/cien`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchCienOptions
       * @name patchCienOptionsUrl
       */
      patchCienOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/cien`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetDLsiteOptions
       * @request GET:/options/dlsite
       */
      getDLsiteOptions: (params = {}) => this.request({
        path: `/options/dlsite`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getDLsiteOptions
       * @name getDLsiteOptionsUrl
       */
      getDLsiteOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/dlsite`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchDLsiteOptions
       * @request PATCH:/options/dlsite
       */
      patchDLsiteOptions: (data, params = {}) => this.request({
        path: `/options/dlsite`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchDLsiteOptions
       * @name patchDLsiteOptionsUrl
       */
      patchDLsiteOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/dlsite`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFanboxOptions
       * @request GET:/options/fanbox
       */
      getFanboxOptions: (params = {}) => this.request({
        path: `/options/fanbox`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFanboxOptions
       * @name getFanboxOptionsUrl
       */
      getFanboxOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fanbox`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFanboxOptions
       * @request PATCH:/options/fanbox
       */
      patchFanboxOptions: (data, params = {}) => this.request({
        path: `/options/fanbox`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFanboxOptions
       * @name patchFanboxOptionsUrl
       */
      patchFanboxOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fanbox`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetFantiaOptions
       * @request GET:/options/fantia
       */
      getFantiaOptions: (params = {}) => this.request({
        path: `/options/fantia`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getFantiaOptions
       * @name getFantiaOptionsUrl
       */
      getFantiaOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fantia`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchFantiaOptions
       * @request PATCH:/options/fantia
       */
      patchFantiaOptions: (data, params = {}) => this.request({
        path: `/options/fantia`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchFantiaOptions
       * @name patchFantiaOptionsUrl
       */
      patchFantiaOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/fantia`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetPatreonOptions
       * @request GET:/options/patreon
       */
      getPatreonOptions: (params = {}) => this.request({
        path: `/options/patreon`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPatreonOptions
       * @name getPatreonOptionsUrl
       */
      getPatreonOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/patreon`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchPatreonOptions
       * @request PATCH:/options/patreon
       */
      patchPatreonOptions: (data, params = {}) => this.request({
        path: `/options/patreon`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchPatreonOptions
       * @name patchPatreonOptionsUrl
       */
      patchPatreonOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/patreon`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name GetTmdbOptions
       * @request GET:/options/tmdb
       */
      getTmdbOptions: (params = {}) => this.request({
        path: `/options/tmdb`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getTmdbOptions
       * @name getTmdbOptionsUrl
       */
      getTmdbOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/tmdb`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Options
       * @name PatchTmdbOptions
       * @request PATCH:/options/tmdb
       */
      patchTmdbOptions: (data, params = {}) => this.request({
        path: `/options/tmdb`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for patchTmdbOptions
       * @name patchTmdbOptionsUrl
       */
      patchTmdbOptionsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/options/tmdb`;
        return baseUrl + path;
      }
    });
    __publicField(this, "password", {
      /**
       * No description
       *
       * @tags Password
       * @name SearchPasswords
       * @request GET:/password
       */
      searchPasswords: (query, params = {}) => this.request({
        path: `/password`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchPasswords
       * @name searchPasswordsUrl
       */
      searchPasswordsUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/password`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Password
       * @name GetAllPasswords
       * @request GET:/password/all
       */
      getAllPasswords: (params = {}) => this.request({
        path: `/password/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPasswords
       * @name getAllPasswordsUrl
       */
      getAllPasswordsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/password/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Password
       * @name DeletePassword
       * @request DELETE:/password/{password}
       */
      deletePassword: (password, params = {}) => this.request({
        path: `/password/${password}`,
        method: "DELETE",
        format: "json",
        ...params
      })
    });
    __publicField(this, "pathMark", {
      /**
       * No description
       *
       * @tags PathMark
       * @name GetAllPathMarks
       * @request GET:/path-mark
       */
      getAllPathMarks: (query, params = {}) => this.request({
        path: `/path-mark`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPathMarks
       * @name getAllPathMarksUrl
       */
      getAllPathMarksUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name AddPathMark
       * @request POST:/path-mark
       */
      addPathMark: (data, params = {}) => this.request({
        path: `/path-mark`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPathMark
       * @name addPathMarkUrl
       */
      addPathMarkUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPathMark
       * @request GET:/path-mark/{id}
       */
      getPathMark: (id2, params = {}) => this.request({
        path: `/path-mark/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name UpdatePathMark
       * @request PUT:/path-mark/{id}
       */
      updatePathMark: (id2, data, params = {}) => this.request({
        path: `/path-mark/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name SoftDeletePathMark
       * @request DELETE:/path-mark/{id}
       */
      softDeletePathMark: (id2, params = {}) => this.request({
        path: `/path-mark/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPathMarksByPath
       * @request GET:/path-mark/by-path
       */
      getPathMarksByPath: (query, params = {}) => this.request({
        path: `/path-mark/by-path`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPathMarksByPath
       * @name getPathMarksByPathUrl
       */
      getPathMarksByPathUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/by-path`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name SoftDeletePathMarksByPath
       * @request DELETE:/path-mark/by-path
       */
      softDeletePathMarksByPath: (query, params = {}) => this.request({
        path: `/path-mark/by-path`,
        method: "DELETE",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for softDeletePathMarksByPath
       * @name softDeletePathMarksByPathUrl
       */
      softDeletePathMarksByPathUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/by-path`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name GetAllPathMarkPaths
       * @request GET:/path-mark/paths
       */
      getAllPathMarkPaths: (params = {}) => this.request({
        path: `/path-mark/paths`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPathMarkPaths
       * @name getAllPathMarkPathsUrl
       */
      getAllPathMarkPathsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/paths`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPendingPathMarks
       * @request GET:/path-mark/pending
       */
      getPendingPathMarks: (params = {}) => this.request({
        path: `/path-mark/pending`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPendingPathMarks
       * @name getPendingPathMarksUrl
       */
      getPendingPathMarksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/pending`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPendingPathMarksCount
       * @request GET:/path-mark/pending/count
       */
      getPendingPathMarksCount: (params = {}) => this.request({
        path: `/path-mark/pending/count`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPendingPathMarksCount
       * @name getPendingPathMarksCountUrl
       */
      getPendingPathMarksCountUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/pending/count`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPathMarksBySyncStatus
       * @request GET:/path-mark/by-status/{status}
       */
      getPathMarksBySyncStatus: (status, params = {}) => this.request({
        path: `/path-mark/by-status/${status}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name AddPathMarks
       * @request POST:/path-mark/batch
       */
      addPathMarks: (data, params = {}) => this.request({
        path: `/path-mark/batch`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPathMarks
       * @name addPathMarksUrl
       */
      addPathMarksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/batch`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name HardDeletePathMark
       * @request DELETE:/path-mark/{id}/hard
       */
      hardDeletePathMark: (id2, params = {}) => this.request({
        path: `/path-mark/${id2}/hard`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name StartSyncPathMark
       * @request POST:/path-mark/{id}/sync/start
       */
      startSyncPathMark: (id2, params = {}) => this.request({
        path: `/path-mark/${id2}/sync/start`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name CompleteSyncPathMark
       * @request POST:/path-mark/{id}/sync/complete
       */
      completeSyncPathMark: (id2, params = {}) => this.request({
        path: `/path-mark/${id2}/sync/complete`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name FailSyncPathMark
       * @request POST:/path-mark/{id}/sync/fail
       */
      failSyncPathMark: (id2, data, params = {}) => this.request({
        path: `/path-mark/${id2}/sync/fail`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PathMark
       * @name GetPathMarkSyncStatus
       * @request GET:/path-mark/sync-status
       */
      getPathMarkSyncStatus: (params = {}) => this.request({
        path: `/path-mark/sync-status`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getPathMarkSyncStatus
       * @name getPathMarkSyncStatusUrl
       */
      getPathMarkSyncStatusUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/sync-status`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name PreviewPathMarkMatchedPaths
       * @request POST:/path-mark/preview
       */
      previewPathMarkMatchedPaths: (data, params = {}) => this.request({
        path: `/path-mark/preview`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for previewPathMarkMatchedPaths
       * @name previewPathMarkMatchedPathsUrl
       */
      previewPathMarkMatchedPathsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/preview`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name CheckPathMarkPathsExist
       * @request GET:/path-mark/check-paths-exist
       */
      checkPathMarkPathsExist: (params = {}) => this.request({
        path: `/path-mark/check-paths-exist`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for checkPathMarkPathsExist
       * @name checkPathMarkPathsExistUrl
       */
      checkPathMarkPathsExistUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/check-paths-exist`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name MigratePathMarkPath
       * @request POST:/path-mark/migrate-path
       */
      migratePathMarkPath: (data, params = {}) => this.request({
        path: `/path-mark/migrate-path`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for migratePathMarkPath
       * @name migratePathMarkPathUrl
       */
      migratePathMarkPathUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/migrate-path`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name StartPathMarkSyncAll
       * @request POST:/path-mark/sync/start-all
       */
      startPathMarkSyncAll: (params = {}) => this.request({
        path: `/path-mark/sync/start-all`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startPathMarkSyncAll
       * @name startPathMarkSyncAllUrl
       */
      startPathMarkSyncAllUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/sync/start-all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name StartPathMarkSync
       * @request POST:/path-mark/sync/start
       */
      startPathMarkSync: (data, params = {}) => this.request({
        path: `/path-mark/sync/start`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startPathMarkSync
       * @name startPathMarkSyncUrl
       */
      startPathMarkSyncUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/sync/start`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PathMark
       * @name StartPathMarkSyncByPath
       * @request POST:/path-mark/sync/by-path
       */
      startPathMarkSyncByPath: (query, params = {}) => this.request({
        path: `/path-mark/sync/by-path`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startPathMarkSyncByPath
       * @name startPathMarkSyncByPathUrl
       */
      startPathMarkSyncByPathUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/path-mark/sync/by-path`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "playHistory", {
      /**
       * No description
       *
       * @tags PlayHistory
       * @name SearchPlayHistories
       * @request GET:/play-history
       */
      searchPlayHistories: (query, params = {}) => this.request({
        path: `/play-history`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for searchPlayHistories
       * @name searchPlayHistoriesUrl
       */
      searchPlayHistoriesUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/play-history`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "playlist", {
      /**
       * No description
       *
       * @tags Playlist
       * @name GetPlaylist
       * @request GET:/playlist/{id}
       */
      getPlaylist: (id2, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name PutPlaylist
       * @request PUT:/playlist/{id}
       */
      putPlaylist: (id2, data, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name DeletePlaylist
       * @request DELETE:/playlist/{id}
       */
      deletePlaylist: (id2, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name PatchPlaylist
       * @request PATCH:/playlist/{id}
       */
      patchPlaylist: (id2, data, params = {}) => this.request({
        path: `/playlist/${id2}`,
        method: "PATCH",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Playlist
       * @name GetAllPlaylists
       * @request GET:/playlist
       */
      getAllPlaylists: (params = {}) => this.request({
        path: `/playlist`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPlaylists
       * @name getAllPlaylistsUrl
       */
      getAllPlaylistsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/playlist`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Playlist
       * @name AddPlaylist
       * @request POST:/playlist
       */
      addPlaylist: (data, params = {}) => this.request({
        path: `/playlist`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPlaylist
       * @name addPlaylistUrl
       */
      addPlaylistUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/playlist`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Playlist
       * @name GetPlaylistFiles
       * @request GET:/playlist/{id}/files
       */
      getPlaylistFiles: (id2, params = {}) => this.request({
        path: `/playlist/${id2}/files`,
        method: "GET",
        format: "json",
        ...params
      })
    });
    __publicField(this, "postParser", {
      /**
       * No description
       *
       * @tags PostParser
       * @name GetAllPostParserTasks
       * @request GET:/post-parser/task/all
       */
      getAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/task/all`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllPostParserTasks
       * @name getAllPostParserTasksUrl
       */
      getAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name DeleteAllPostParserTasks
       * @request DELETE:/post-parser/task/all
       */
      deleteAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/task/all`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for deleteAllPostParserTasks
       * @name deleteAllPostParserTasksUrl
       */
      deleteAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task/all`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name AddPostParserTasks
       * @request POST:/post-parser/task
       */
      addPostParserTasks: (data, params = {}) => this.request({
        path: `/post-parser/task`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addPostParserTasks
       * @name addPostParserTasksUrl
       */
      addPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/task`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags PostParser
       * @name DeletePostParserTask
       * @request DELETE:/post-parser/task/{id}
       */
      deletePostParserTask: (id2, params = {}) => this.request({
        path: `/post-parser/task/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags PostParser
       * @name StartAllPostParserTasks
       * @request POST:/post-parser/start
       */
      startAllPostParserTasks: (params = {}) => this.request({
        path: `/post-parser/start`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startAllPostParserTasks
       * @name startAllPostParserTasksUrl
       */
      startAllPostParserTasksUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/post-parser/start`;
        return baseUrl + path;
      }
    });
    __publicField(this, "property", {
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertiesByPool
       * @request GET:/property/pool/{pool}
       */
      getPropertiesByPool: (pool, query, params = {}) => this.request({
        path: `/property/pool/${pool}`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name GetAvailablePropertyTypesForManuallySettingValue
       * @request GET:/property/property-types-for-manually-setting-value
       */
      getAvailablePropertyTypesForManuallySettingValue: (params = {}) => this.request({
        path: `/property/property-types-for-manually-setting-value`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAvailablePropertyTypesForManuallySettingValue
       * @name getAvailablePropertyTypesForManuallySettingValueUrl
       */
      getAvailablePropertyTypesForManuallySettingValueUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/property/property-types-for-manually-setting-value`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertyBizValue
       * @request GET:/property/pool/{pool}/id/{id}/biz-value
       */
      getPropertyBizValue: (pool, id2, query, params = {}) => this.request({
        path: `/property/pool/${pool}/id/${id2}/biz-value`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name GetPropertyDbValue
       * @request GET:/property/pool/{pool}/id/{id}/db-value
       */
      getPropertyDbValue: (pool, id2, query, params = {}) => this.request({
        path: `/property/pool/${pool}/id/${id2}/db-value`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags Property
       * @name FindBestMatchingProperty
       * @request GET:/property/best-matching
       */
      findBestMatchingProperty: (query, params = {}) => this.request({
        path: `/property/best-matching`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for findBestMatchingProperty
       * @name findBestMatchingPropertyUrl
       */
      findBestMatchingPropertyUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/property/best-matching`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "specialText", {
      /**
       * No description
       *
       * @tags SpecialText
       * @name GetAllSpecialTexts
       * @request GET:/special-text
       */
      getAllSpecialTexts: (params = {}) => this.request({
        path: `/special-text`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllSpecialTexts
       * @name getAllSpecialTextsUrl
       */
      getAllSpecialTextsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name AddSpecialText
       * @request POST:/special-text
       */
      addSpecialText: (data, params = {}) => this.request({
        path: `/special-text`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addSpecialText
       * @name addSpecialTextUrl
       */
      addSpecialTextUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name DeleteSpecialText
       * @request DELETE:/special-text/{id}
       */
      deleteSpecialText: (id2, params = {}) => this.request({
        path: `/special-text/${id2}`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags SpecialText
       * @name PatchSpecialText
       * @request PUT:/special-text/{id}
       */
      patchSpecialText: (id2, data, params = {}) => this.request({
        path: `/special-text/${id2}`,
        method: "PUT",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * No description
       *
       * @tags SpecialText
       * @name AddSpecialTextPrefabs
       * @request POST:/special-text/prefabs
       */
      addSpecialTextPrefabs: (params = {}) => this.request({
        path: `/special-text/prefabs`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for addSpecialTextPrefabs
       * @name addSpecialTextPrefabsUrl
       */
      addSpecialTextPrefabsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text/prefabs`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags SpecialText
       * @name PretreatText
       * @request POST:/special-text/pretreatment
       */
      pretreatText: (query, params = {}) => this.request({
        path: `/special-text/pretreatment`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for pretreatText
       * @name pretreatTextUrl
       */
      pretreatTextUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/special-text/pretreatment`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "tampermonkey", {
      /**
       * No description
       *
       * @tags Tampermonkey
       * @name InstallTampermonkeyScript
       * @request GET:/Tampermonkey/install
       */
      installTampermonkeyScript: (query, params = {}) => this.request({
        path: `/Tampermonkey/install`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for installTampermonkeyScript
       * @name installTampermonkeyScriptUrl
       */
      installTampermonkeyScriptUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/Tampermonkey/install`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tampermonkey
       * @name GetTampermonkeyScript
       * @request GET:/Tampermonkey/script/{script}.user.js
       */
      getTampermonkeyScript: (script, params = {}) => this.request({
        path: `/Tampermonkey/script/${script}.user.js`,
        method: "GET",
        ...params
      })
    });
    __publicField(this, "thirdParty", {
      /**
       * No description
       *
       * @tags ThirdParty
       * @name GetAllThirdPartyRequestStatistics
       * @request GET:/third-party/request-statistics
       */
      getAllThirdPartyRequestStatistics: (params = {}) => this.request({
        path: `/third-party/request-statistics`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getAllThirdPartyRequestStatistics
       * @name getAllThirdPartyRequestStatisticsUrl
       */
      getAllThirdPartyRequestStatisticsUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/third-party/request-statistics`;
        return baseUrl + path;
      }
    });
    __publicField(this, "thirdPartyContentTracker", {
      /**
       * No description
       *
       * @tags ThirdPartyContentTracker
       * @name QueryThirdPartyContentStatus
       * @request POST:/third-party-content-tracker/query
       */
      queryThirdPartyContentStatus: (data, params = {}) => this.request({
        path: `/third-party-content-tracker/query`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for queryThirdPartyContentStatus
       * @name queryThirdPartyContentStatusUrl
       */
      queryThirdPartyContentStatusUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/third-party-content-tracker/query`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ThirdPartyContentTracker
       * @name MarkThirdPartyContentAsViewed
       * @request POST:/third-party-content-tracker/mark-viewed
       */
      markThirdPartyContentAsViewed: (data, params = {}) => this.request({
        path: `/third-party-content-tracker/mark-viewed`,
        method: "POST",
        body: data,
        type: "application/json",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for markThirdPartyContentAsViewed
       * @name markThirdPartyContentAsViewedUrl
       */
      markThirdPartyContentAsViewedUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/third-party-content-tracker/mark-viewed`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags ThirdPartyContentTracker
       * @name FindNearestViewedContent
       * @request GET:/third-party-content-tracker/nearest-viewed
       */
      findNearestViewedContent: (query, params = {}) => this.request({
        path: `/third-party-content-tracker/nearest-viewed`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for findNearestViewedContent
       * @name findNearestViewedContentUrl
       */
      findNearestViewedContentUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/third-party-content-tracker/nearest-viewed`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "tool", {
      /**
       * No description
       *
       * @tags Tool
       * @name OpenFileOrDirectory
       * @request GET:/tool/open
       */
      openFileOrDirectory: (query, params = {}) => this.request({
        path: `/tool/open`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openFileOrDirectory
       * @name openFileOrDirectoryUrl
       */
      openFileOrDirectoryUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/open`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name ValidateCookie
       * @request GET:/tool/cookie-validation
       */
      validateCookie: (query, params = {}) => this.request({
        path: `/tool/cookie-validation`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for validateCookie
       * @name validateCookieUrl
       */
      validateCookieUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/cookie-validation`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name GetThumbnail
       * @request GET:/tool/thumbnail
       */
      getThumbnail: (query, params = {}) => this.request({
        path: `/tool/thumbnail`,
        method: "GET",
        query,
        ...params
      }),
      /**
       * @description Build URL for getThumbnail
       * @name getThumbnailUrl
       */
      getThumbnailUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/thumbnail`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name TestMatchAll
       * @request POST:/tool/match-all
       */
      testMatchAll: (query, params = {}) => this.request({
        path: `/tool/match-all`,
        method: "POST",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for testMatchAll
       * @name testMatchAllUrl
       */
      testMatchAllUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/match-all`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name OpenFile
       * @request GET:/tool/open-file
       */
      openFile: (query, params = {}) => this.request({
        path: `/tool/open-file`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for openFile
       * @name openFileUrl
       */
      openFileUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/open-file`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Tool
       * @name GenerateFilesToEmbedded
       * @request GET:/tool/generate-files-to-embedded
       */
      generateFilesToEmbedded: (query, params = {}) => this.request({
        path: `/tool/generate-files-to-embedded`,
        method: "GET",
        query,
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for generateFilesToEmbedded
       * @name generateFilesToEmbeddedUrl
       */
      generateFilesToEmbeddedUrl: (query) => {
        const baseUrl = this.baseUrl || "";
        let path = `/tool/generate-files-to-embedded`;
        if (query) {
          const queryString = Object.keys(query).filter((key) => query[key] !== void 0 && query[key] !== null).map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(String(query[key]))}`).join("&");
          return baseUrl + path + (queryString ? `?${queryString}` : "");
        }
        return baseUrl + path;
      }
    });
    __publicField(this, "updater", {
      /**
       * No description
       *
       * @tags Updater
       * @name GetNewAppVersion
       * @request GET:/updater/app/new-version
       */
      getNewAppVersion: (params = {}) => this.request({
        path: `/updater/app/new-version`,
        method: "GET",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for getNewAppVersion
       * @name getNewAppVersionUrl
       */
      getNewAppVersionUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/new-version`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name StartUpdatingApp
       * @request POST:/updater/app/update
       */
      startUpdatingApp: (params = {}) => this.request({
        path: `/updater/app/update`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for startUpdatingApp
       * @name startUpdatingAppUrl
       */
      startUpdatingAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/update`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name StopUpdatingApp
       * @request DELETE:/updater/app/update
       */
      stopUpdatingApp: (params = {}) => this.request({
        path: `/updater/app/update`,
        method: "DELETE",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for stopUpdatingApp
       * @name stopUpdatingAppUrl
       */
      stopUpdatingAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/update`;
        return baseUrl + path;
      },
      /**
       * No description
       *
       * @tags Updater
       * @name RestartAndUpdateApp
       * @request POST:/updater/app/restart
       */
      restartAndUpdateApp: (params = {}) => this.request({
        path: `/updater/app/restart`,
        method: "POST",
        format: "json",
        ...params
      }),
      /**
       * @description Build URL for restartAndUpdateApp
       * @name restartAndUpdateAppUrl
       */
      restartAndUpdateAppUrl: () => {
        const baseUrl = this.baseUrl || "";
        let path = `/updater/app/restart`;
        return baseUrl + path;
      }
    });
  }
}
const BApi$1 = new Api({ baseUrl: envConfig.apiEndpoint });
const useAppContextStore = create$1((set2, get5) => ({
  listeningAddresses: [],
  bApi2: null,
  runtimeMode: RuntimeMode.Dev,
  update: (payload) => {
    let bApi2;
    const addresses = payload.serverAddresses ?? [];
    if (addresses.length > 1) {
      bApi2 = new Api({ baseUrl: addresses[1] });
    } else {
      bApi2 = BApi$1;
    }
    set2((state) => ({
      ...state,
      ...payload,
      bApi2
    }));
  }
}));
const useBulkModificationInternalsStore = create$1((set2, get5) => ({
  disabledPropertyKeys: {},
  supportedStandardValueTypes: [],
  update: (payload) => set2((state) => ({ ...state, ...payload }))
}));
const useBTasksStore = create$1((set2) => ({
  tasks: [],
  setTasks: (tasks) => set2({ tasks: _$2.sortBy(tasks, (x2) => x2.createdAt) }),
  removeTask: (id2) => set2((state) => ({ tasks: state.tasks.filter((t2) => t2.id !== id2) })),
  updateTask: (task) => set2((state) => {
    const idx = state.tasks.findIndex((t2) => t2.id === task.id);
    const newState = state.tasks.slice();
    if (idx > -1) {
      newState[idx] = task;
    } else {
      newState.push(task);
      return { tasks: _$2.sortBy(newState, (x2) => x2.createdAt) };
    }
    return { tasks: newState };
  })
}));
const selectTasks = (state) => state.tasks;
const usePostParserTasksStore = create$1(
  (set2, get5) => ({
    tasks: [],
    setTasks: (tasks) => set2({ tasks: _$2.sortBy(tasks, (x2) => x2.createdAt) }),
    updateTask: (task) => set2((state) => {
      const idx = state.tasks.findIndex((t2) => t2.id == task.id);
      let newState = state.tasks.slice();
      if (idx > -1) {
        newState[idx] = task;
      } else {
        newState.push(task);
        newState = _$2.sortBy(newState, (x2) => x2.id);
      }
      return { tasks: newState };
    }),
    deleteTask: (taskId) => set2((state) => ({ tasks: state.tasks.filter((t2) => t2.id !== taskId) })),
    deleteAll: () => set2({ tasks: [] })
  })
);
const useIwFsEntryChangeEventsStore = create$1(
  (set2, get5) => ({
    events: [{ path: "123" }],
    addRange: (current) => set2((state) => {
      const newEvents = [...state.events, ...current];
      console.log("receiving new events", current, newEvents);
      return { events: newEvents };
    }),
    clear: () => {
      console.log("clearing events");
      set2({ events: [] });
    }
  })
);
const useAppUpdaterStateStore = create$1((set2, get5) => ({
  status: void 0,
  percentage: void 0,
  error: void 0,
  update: (payload) => set2((state) => ({ ...state, ...payload }))
}));
const useThirdPartyRequestStatisticsStore = create$1((set2) => ({
  statistics: [],
  setStatistics: (statistics) => set2({ statistics: statistics.slice() }),
  updateStatistics: (statistics) => set2({ statistics: statistics.slice() })
}));
function createOptionStore(updateApi, putApi) {
  return create$1((set2) => ({
    data: {},
    initialized: false,
    update: (payload) => set2((state) => ({
      data: { ...state.data, ...payload },
      initialized: true
    })),
    patch: async (patches) => {
      await updateApi(patches);
    },
    put: putApi ? async (data) => {
      await putApi(data);
    } : void 0
  }));
}
const useAppOptionsStore = createOptionStore(BApi$1.options.patchAppOptions, BApi$1.options.putAppOptions);
const useUiOptionsStore = createOptionStore(BApi$1.options.patchUiOptions);
const useBilibiliOptionsStore = createOptionStore(BApi$1.options.patchBilibiliOptions);
const useExHentaiOptionsStore = createOptionStore(BApi$1.options.patchExHentaiOptions);
const useFileSystemOptionsStore = createOptionStore(BApi$1.options.patchFileSystemOptions);
const useJavLibraryOptionsStore = createOptionStore(BApi$1.options.patchJavLibraryOptions);
const usePixivOptionsStore = createOptionStore(BApi$1.options.patchPixivOptions);
const useResourceOptionsStore = createOptionStore(BApi$1.options.patchResourceOptions);
const useThirdPartyOptionsStore = createOptionStore(BApi$1.options.patchThirdPartyOptions, BApi$1.options.putThirdPartyOptions);
const useNetworkOptionsStore = createOptionStore(BApi$1.options.patchNetworkOptions);
const useEnhancerOptionsStore = createOptionStore(BApi$1.options.patchEnhancerOptions);
const useTaskOptionsStore = createOptionStore(BApi$1.options.patchTaskOptions);
const useAiOptionsStore = createOptionStore(BApi$1.options.patchAiOptions, BApi$1.options.putAiOptions);
const useSoulPlusOptionsStore = createOptionStore(BApi$1.options.patchSoulPlusOptions, BApi$1.options.putSoulPlusOptions);
const useBangumiOptionsStore = createOptionStore(BApi$1.options.patchBangumiOptions);
const useCienOptionsStore = createOptionStore(BApi$1.options.patchCienOptions);
const useDLsiteOptionsStore = createOptionStore(BApi$1.options.patchDLsiteOptions);
const useFanboxOptionsStore = createOptionStore(BApi$1.options.patchFanboxOptions);
const useFantiaOptionsStore = createOptionStore(BApi$1.options.patchFantiaOptions);
const usePatreonOptionsStore = createOptionStore(BApi$1.options.patchPatreonOptions);
const useTmdbOptionsStore = createOptionStore(BApi$1.options.patchTmdbOptions);
const optionsStores = {
  appOptions: useAppOptionsStore,
  uiOptions: useUiOptionsStore,
  bilibiliOptions: useBilibiliOptionsStore,
  exHentaiOptions: useExHentaiOptionsStore,
  fileSystemOptions: useFileSystemOptionsStore,
  javLibraryOptions: useJavLibraryOptionsStore,
  pixivOptions: usePixivOptionsStore,
  resourceOptions: useResourceOptionsStore,
  thirdPartyOptions: useThirdPartyOptionsStore,
  networkOptions: useNetworkOptionsStore,
  enhancerOptions: useEnhancerOptionsStore,
  taskOptions: useTaskOptionsStore,
  aiOptions: useAiOptionsStore,
  soulPlusOptions: useSoulPlusOptionsStore,
  bangumiOptions: useBangumiOptionsStore,
  cienOptions: useCienOptionsStore,
  dlsiteOptions: useDLsiteOptionsStore,
  fanboxOptions: useFanboxOptionsStore,
  fantiaOptions: useFantiaOptionsStore,
  patreonOptions: usePatreonOptionsStore,
  tmdbOptions: useTmdbOptionsStore
};
const usePathMarksStore = create$1((set2, get5) => ({
  marks: /* @__PURE__ */ new Map(),
  updateMark: (mark2) => set2((state) => {
    if (mark2.id == null)
      return state;
    const newMarks = new Map(state.marks);
    newMarks.set(mark2.id, mark2);
    return { marks: newMarks };
  }),
  setMarks: (marks) => set2(() => {
    const newMarks = /* @__PURE__ */ new Map();
    for (const mark2 of marks) {
      if (mark2.id != null) {
        newMarks.set(mark2.id, mark2);
      }
    }
    return { marks: newMarks };
  }),
  getMark: (id2) => get5().marks.get(id2),
  removeMark: (id2) => set2((state) => {
    const newMarks = new Map(state.marks);
    newMarks.delete(id2);
    return { marks: newMarks };
  })
}));
const hubEndpoint = `${envConfig.apiEndpoint}/hub/ui`;
const UIHubConnection = () => {
  const connRef = reactExports.useRef(null);
  const logRef = reactExports.useRef(buildLogger(`UIHubConnection:${v4()}`));
  const log3 = logRef.current;
  const isRunningRef = reactExports.useRef(true);
  reactExports.useEffect(() => {
    const conn = new HubConnectionBuilder().withUrl(hubEndpoint).configureLogging(LogLevel$1.Information).build();
    conn.on("GetData", (key, data) => {
      log3("GetData", key, data);
      switch (key) {
        case "DownloadTask":
          useDownloadTasksStore.getState().setTasks(data);
          break;
        case "DependentComponentContext":
          useDependentComponentContextsStore.getState().setContexts(data);
          break;
        case "FileMovingProgress":
          useFileMovingProgressesStore.getState().setProgresses(data);
          break;
        case "AppContext":
          useAppContextStore.getState().update(data);
          break;
        case "BulkModificationInternals":
          useBulkModificationInternalsStore.getState().update(data);
          break;
        case "BTask":
          useBTasksStore.getState().setTasks(data);
          break;
        case "PostParserTask":
          usePostParserTasksStore.getState().setTasks(data);
          break;
        case "ThirdPartyRequestStatistics":
          useThirdPartyRequestStatisticsStore.getState().setStatistics(data);
          break;
      }
    });
    conn.on("GetIncrementalData", (key, data) => {
      log3("GetIncrementalData", key, data);
      switch (key) {
        case "DownloadTask":
          useDownloadTasksStore.getState().updateTask(data);
          break;
        case "DependentComponentContext":
          useDependentComponentContextsStore.getState().updateContext(data);
          break;
        case "FileMovingProgress":
          useFileMovingProgressesStore.getState().updateProgress(data);
          break;
        case "BTask":
          useBTasksStore.getState().updateTask(data);
          break;
        case "PostParserTask":
          usePostParserTasksStore.getState().updateTask(data);
          break;
        case "PathMark":
          usePathMarksStore.getState().updateMark(data);
          break;
      }
    });
    conn.on("DeleteData", (key, id2) => {
      if (key === "PostParserTask") {
        usePostParserTasksStore.getState().deleteTask(id2);
      }
    });
    conn.on("DeleteAllData", (key) => {
      if (key === "PostParserTask") {
        usePostParserTasksStore.getState().deleteAll();
      }
    });
    conn.on("GetResponse", (rsp) => {
      if (rsp.code == 0) {
        toast.success("Success");
      } else {
        toast.danger(`[${rsp.code}]${rsp.message}`);
      }
    });
    conn.on("IwFsEntriesChange", (events2) => {
      useIwFsEntryChangeEventsStore.getState().addRange(events2);
    });
    conn.on("OptionsChanged", (name2, options) => {
      if (name2.toLowerCase() === "uioptions")
        name2 = "uiOptions";
      log3("options changed", name2, options);
      const store = optionsStores[name2];
      if (store) {
        store.getState().update(options);
      }
    });
    conn.on("GetAppUpdaterState", (state) => {
      useAppUpdaterStateStore.getState().update(state);
    });
    conn.on("UpdateThirdPartyRequestStatistics", (statistics) => {
      useThirdPartyRequestStatisticsStore.getState().updateStatistics(statistics);
    });
    conn.on("OnNotification", (notification) => {
      log3("OnNotification", notification);
      const message = notification.message ? `${notification.title}
${notification.message}` : notification.title;
      const duration2 = notification.behavior === 0 ? notification.durationMs || 5e3 : 0;
      const props = { title: message, timeout: duration2, placement: "bottom-right" };
      switch (notification.severity) {
        case 0:
          toast.default(props);
          break;
        case 1:
          toast.success(props);
          break;
        case 2:
          toast.warning(props);
          break;
        case 3:
          toast.danger(props);
          break;
        default:
          toast.default(props);
      }
    });
    async function onConnected() {
      log3("connected");
      await conn.send("GetInitialData");
    }
    conn.onclose(async () => {
      log3("connection closed, attempting to reconnect...");
    });
    const guardLoop = async () => {
      while (isRunningRef.current) {
        try {
          if (conn.state === HubConnectionState.Disconnected) {
            log3("connection disconnected, attempting to connect...");
            try {
              await conn.start();
              await onConnected();
            } catch (err) {
              log3("start failed:", err);
            }
          }
        } catch (err) {
          log3("guard loop error:", err);
        } finally {
          await delay(5e3);
        }
      }
    };
    guardLoop();
    connRef.current = conn;
    return () => {
      isRunningRef.current = false;
      conn.stop();
    };
  }, []);
  return null;
};
const Close$2 = "Close";
const Confirm$1 = "Confirm";
const Beta$1 = "Beta";
const Developing$1 = "Developing";
const Deprecated$1 = "Deprecated";
const OK$1 = "OK";
const Cancel$2 = "Cancel";
const Selected$1 = "Selected";
const Filter$2 = "Filter";
const Delete$1 = "Delete";
const enCommon = {
  "common.enabled": "Enabled",
  "common.disabled": "Disabled",
  Close: Close$2,
  Confirm: Confirm$1,
  "An error occurred:": "An error occurred:",
  "common.action.save": "Save",
  "common.action.cancel": "Cancel",
  "common.action.delete": "Delete",
  "common.action.confirm": "Confirm",
  "common.action.edit": "Edit",
  "common.action.add": "Add",
  "common.action.remove": "Remove",
  "common.action.create": "Create",
  "common.action.close": "Close",
  "common.action.start": "Start",
  "common.action.stop": "Stop",
  "common.action.pause": "Pause",
  "common.action.resume": "Resume",
  "common.action.refresh": "Refresh",
  "common.action.search": "Search",
  "common.action.preview": "Preview",
  "common.action.configure": "Configure",
  "common.action.validate": "Validate",
  "common.action.back": "Back",
  "common.action.next": "Next",
  "common.action.previous": "Previous",
  "common.action.submit": "Submit",
  "common.action.reset": "Reset",
  "common.action.clear": "Clear",
  "common.action.copy": "Copy",
  "common.action.duplicate": "Duplicate",
  "common.action.enable": "Enable",
  "common.action.disable": "Disable",
  "common.action.import": "Import",
  "common.action.export": "Export",
  "common.action.download": "Download",
  "common.action.upload": "Upload",
  "common.action.play": "Play",
  "common.action.openFolder": "Open folder",
  "common.action.clearAll": "Clear all",
  "common.action.selectAll": "Select all",
  "common.action.select": "Select...",
  "common.label.selectParentResource": "Select Parent Resource",
  "common.label.selectParentResources": "Select Parent Resources",
  "common.action.change": "Change",
  "common.action.apply": "Apply",
  "common.action.retry": "Retry",
  "common.action.skip": "Skip",
  "common.action.migrate": "Migrate",
  "common.action.convert": "Convert",
  "common.action.sync": "Sync",
  "common.action.syncAll": "Sync All",
  "common.action.syncNow": "Sync Now",
  "common.action.pauseAll": "Pause all",
  "common.action.resumeAll": "Resume all",
  "common.action.moveToTop": "Move to top",
  "common.action.moveToBottom": "Move to bottom",
  "common.action.transfer": "Transfer",
  "common.action.leave": "Leave",
  "common.action.stay": "Stay",
  "common.label.yes": "Yes",
  "common.label.no": "No",
  "common.label.none": "None",
  "common.label.all": "All",
  "common.label.name": "Name",
  "common.label.path": "Path",
  "common.label.status": "Status",
  "common.label.time": "Time",
  "common.label.order": "Order",
  "common.label.priority": "Priority",
  "common.label.source": "Source",
  "common.label.message": "Message",
  "common.label.property": "Property",
  "common.label.value": "Value",
  "common.label.type": "Type",
  "common.label.pattern": "Pattern",
  "common.label.extensions": "Extensions",
  "common.placeholder.separateBySpaceOrNewline": "Separate by space or newline",
  "common.placeholder.typeHere": "Type here",
  "common.placeholder.readonly": "Readonly",
  "common.label.total": "Total",
  "common.label.count": "Count",
  "common.label.progress": "Progress",
  "common.label.remaining": "Remaining",
  "common.label.description": "Description",
  "common.label.introduction": "Introduction",
  "common.label.operations": "Operations",
  "common.label.setting": "Setting",
  "common.label.settings": "Settings",
  "common.label.configuration": "Configuration",
  "common.label.customProperties": "Custom Properties",
  "common.label.internalProperties": "Internal Properties",
  "common.label.reservedProperties": "Reserved Properties",
  "common.label.warning": "Warning",
  "common.label.error": "Error",
  "common.label.createdAt": "Created at",
  "common.label.changeLog": "Change log",
  "common.label.development": "Development",
  "common.label.log": "Log",
  "common.label.children": "Children",
  "common.label.enhancer": "Enhancer",
  "common.label.mediaLibrary": "Media Library",
  "common.label.mediaLibraries": "Media Libraries",
  "common.label.resource": "Resource",
  "common.label.resources": "Resources",
  "common.label.template": "Template",
  "common.label.regex": "Regex",
  "common.label.regexPattern": "Regex Pattern",
  "common.label.layer": "Layer",
  "common.label.checkpoint": "Checkpoint",
  "common.label.auto": "Auto",
  "common.label.manual": "Manual",
  "common.label.builtin": "Builtin",
  "common.label.dynamic": "Dynamic",
  "common.label.fixed": "Fixed",
  "common.label.notSet": "Not set",
  "common.label.clickToSet": "Click to set",
  "common.action.more": "More",
  "resourcesModal.title": "{{count}} Resources",
  "common.state.loading": "Loading...",
  "common.state.saved": "Saved",
  "common.success.saved": "Saved successfully",
  "common.state.selected": "Selected",
  "common.state.noData": "No data",
  "common.state.noResults": "No results",
  "common.state.copied": "Copied!",
  "common.state.partiallySet": "Partially set",
  "common.state.multipleValues": "Multiple values",
  "common.state.unknown": "Unknown",
  "common.state.empty": "empty",
  "common.state.noChoicesAvailable": "No choices available",
  "common.confirm.default": "Are you sure?",
  "common.confirm.short": "Sure?",
  "common.confirm.continue": "Are you sure you want to continue?",
  "common.confirm.continueAnyway": "Continue anyway",
  "common.confirm.irreversibleWarning": "Be careful, this operation can not be undone",
  "common.confirm.deleteFile": "Are you sure you want to delete this file/folder?",
  "common.confirm.deleteFileTitle": "Delete this file/folder?",
  "common.confirm.stopTask": "Are you sure to stop this task?",
  "common.message.confirmLeave": "Confirm Leave",
  "common.tip.clickToRetry": "Click here to retry",
  "common.tip.clickToCopy": "Click to copy full path",
  "common.tip.pathCopied": "Path copied to clipboard",
  "common.tip.leavePageWarning": "About to leave current page",
  "common.label.unknownProperty": "Unknown property",
  "common.unit.days": "d",
  "common.unit.hours": "h",
  "common.unit.minutes": "m",
  "common.unit.seconds": "s",
  "common.state.never": "Never",
  "common.action.viewChildren": "View Children",
  "common.action.showTimeInfo": "Show time info",
  "common.action.hideTimeInfo": "Hide time info",
  "common.state.loadingProperties": "Loading properties...",
  "common.state.filtering": "Filtering",
  "common.label.actions": "Actions",
  "common.label.to": "to",
  "common.label.andCountMore": "and {{count}} more",
  "common.label.properties": "Properties",
  "common.error.failedToLoadData": "Failed to load data",
  "common.error.failedToProcessData": "Failed to process data",
  "common.error.unknownError": "Unknown error",
  "term.mediaLibrary.description": "Associate matched resources with a media library",
  "term.mediaLibrary.usage": "Resources will be linked to the selected media library for organization",
  "term.mediaLibrary.suggestion": "Consider organizing resources into appropriate media libraries",
  "term.enhancer.description": "Enhancers are used to automatically enhance resources by extracting or adding metadata",
  "term.resource.description": "A resource represents a file or folder managed by Bakabase",
  "term.resource.usage": "Resources can have properties, be organized in media libraries, and be enhanced",
  "term.resource.tip": "Resources are the core unit of organization in Bakabase",
  "term.property.description": "Properties are metadata fields that can be attached to resources",
  "term.property.usage": "Properties help organize and search resources effectively",
  "menu.dashboard": "Dashboard",
  "menu.resource": "Resource",
  "menu.mediaLibrary": "Media library",
  "menu.mediaLibraryConfiguration": "Media library configuration",
  "menu.pathMarks": "Path marks",
  "menu.resourceProfile": "Resource Profile",
  "menu.data": "Data",
  "menu.customProperty": "Custom property",
  "menu.extensionGroup": "Extension group",
  "menu.cache": "Cache",
  "menu.alias": "Alias",
  "menu.specialText": "Special text",
  "menu.playHistory": "Play history",
  "menu.bulkModification": "Bulk modification",
  "menu.comparison": "Comparison",
  "menu.mediaLibraryTemplate": "Media library template",
  "menu.synchronizationOptions": "Synchronization options",
  "menu.tools": "Tools",
  "menu.fileProcessor": "File Processor",
  "menu.downloader": "Downloader",
  "menu.fileMover": "File Mover",
  "menu.fileNameModifier": "File name modifier",
  "menu.migration": "Migration",
  "menu.experimental": "Experimental",
  "menu.thirdPartyIntegration": "Third party integration",
  "menu.postParser": "Post parser",
  "menu.system": "System",
  "menu.configuration": "Configuration",
  "menu.thirdParty": "Third party",
  "menu.backgroundTask": "Background Task",
  "menu.performanceProfiler": "Performance Profiler",
  "menu.log": "Log",
  "menu.test": "Test",
  "typeConversion.title": "Type conversion rules",
  "typeConversion.targetType": "Target type",
  "typeConversion.rules": "Rules",
  "typeConversion.sourceType": "Source type",
  "typeConversion.checkExamples": "Check examples",
  "typeConversion.examplesTitle": "Type conversion examples",
  "typeConversion.valueToBeConverted": "Value to be converted",
  Beta: Beta$1,
  "BetaFeature.UnstableWarning": "This feature is in beta and may be unstable. Please report any issues you encounter.",
  "BetaFeature.BackupWarning": "It is strongly recommended to backup your data before use.",
  Developing: Developing$1,
  "This feature is currently in development and may not be fully functional.": "This feature is currently in development and may not be fully functional.",
  "DevelopingFeature.ExpectChanges": "Expect significant changes in future updates.",
  Deprecated: Deprecated$1,
  "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.": "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.",
  "resourceFilter.switchToAdvancedMode": "Switch to Advanced mode",
  "resourceFilter.switchToSimpleMode": "Switch to Simple mode",
  "resourceFilter.advanceFilter": "Advanced filter",
  "resourceFilter.filter": "Filter",
  "resourceFilter.filterGroup": "Filter group",
  "resourceFilter.specialFilters": "Special filters",
  "resourceFilter.recentFilters": "Recent filters",
  "Set rating": "Set rating",
  "Recycle bin": "Recycle bin",
  "New Folder": "New Folder",
  OK: OK$1,
  Cancel: Cancel$2,
  Selected: Selected$1,
  Filter: Filter$2,
  "You can type a path here": "You can type a path here",
  "Copied {{count}} items": "Copied {{count}} items",
  "Cut {{count}} items": "Cut {{count}} items",
  "Moved {{count}} items": "Moved {{count}} items",
  Delete: Delete$1,
  "Select data": "Select data",
  "extensionGroupSelect.label": "Limit file extension groups",
  "extensionGroupSelect.placeholder": "Select from extension groups",
  "common.confirm.navigateAway": "Leave current page",
  "common.confirm.navigateAwayMessage": "You are about to leave the current page. Continue?",
  "FeatureRequestTip.Developing": "The <1>{{name}}</1> feature is under development. You can urge the author or make suggestions on <3>Github</3> or <5>QQ group</5>.",
  "FeatureRequestTip.Deprecated": "The <1>{{name}}</1> feature is deprecated. You can learn more or make suggestions on <3>Github</3> or <5>QQ group</5>.",
  "FeatureRequestTip.Deprecating": "The <1>{{name}}</1> feature is being deprecated. You can learn more or make suggestions on <3>Github</3> or <5>QQ group</5>.",
  "Join QQ group": "Join QQ group",
  "For more information, you can visit:": "For more information, you can visit:",
  "Select a media library": "Select a media library",
  "Quick filter": "Quick filter",
  "Are you sure to select this media library?": "Are you sure to select this media library?",
  "Are you sure to select this path?": "Are you sure to select this path?",
  "Select a path": "Select a path"
};
const enValidation = {
  "validation.name.required": "Name is required",
  "validation.name.notEmpty": "Name cannot be empty",
  "validation.executablePath.required": "Executable path is required",
  "validation.path.required": "Path is required",
  "validation.value.required": "Value is required",
  "validation.selection.required": "Please select an option",
  "validation.file.notFolder": "Please select a file, not a folder",
  "validation.path.notExist": "{{count}} path(s) no longer exist on the file system",
  "validation.ports.tooMany": "Too many ports. Up to {{max}} ports are supported.",
  "validation.data.invalid": "Invalid Data",
  "validation.field.required": "This field is required"
};
const enErrors = {
  "error.title": "Error",
  "error.load.data": "Failed to load data",
  "error.save.mark": "Failed to save mark",
  "error.delete.mark": "Failed to delete mark",
  "error.delete.marks": "Failed to delete marks",
  "error.update.app": "Failed to update app",
  "error.add.mediaLibrary": "Failed to add media library",
  "error.remove.mediaLibrary": "Failed to remove media library",
  "error.update.property": "Failed to update property",
  "error.process.data": "Failed to process data",
  "error.get.latestVersion": "Failed to get latest version",
  "error.add.marks": "Failed to add marks",
  "error.paste.marks": "Failed to paste marks",
  "error.transfer.marks": "Failed to transfer marks",
  "error.start.sync": "Failed to start sync",
  "error.update.option": "Failed to update option",
  "error.unknown": "Unknown error"
};
const enStatus = {
  "status.completed": "Completed",
  "status.running": "Running",
  "status.paused": "Paused",
  "status.stopped": "Stopped",
  "status.pending": "Pending",
  "status.failed": "Failed",
  "status.success": "Success",
  "status.downloading": "Downloading",
  "status.syncing": "Syncing",
  "status.started": "Started",
  "status.resumed": "Resumed",
  "status.upToDate": "Up-to-date",
  "status.unknown": "Unknown",
  "status.invalid": "Invalid",
  "status.valid": "Valid",
  "status.active": "Active",
  "status.inactive": "Inactive",
  "status.enabled": "Enabled",
  "status.disabled": "Disabled"
};
const enDatetime = {
  "datetime.format.date": "YYYY-MM-DD",
  "datetime.format.dateTime": "YYYY-MM-DD HH:mm:ss",
  "datetime.format.timeShort": "HH:mm",
  "datetime.format.time": "HH:mm:ss",
  "datetime.format.timeMs": "HH:mm:ss.SSS",
  "datetime.duration.day": "d",
  "datetime.duration.hour": "h",
  "datetime.duration.minute": "m",
  "datetime.duration.second": "s",
  "datetime.label.date": "Date",
  "datetime.label.time": "Time",
  "datetime.label.nextRun": "Next run",
  "datetime.label.estimatedCompletion": "Estimated completion",
  "datetime.label.createdAt": "Created at",
  "datetime.relative.justNow": "Played just now",
  "datetime.relative.minutesAgo": "Played {{n}} minutes ago",
  "datetime.relative.hoursAgo": "Played {{n}} hours ago",
  "datetime.relative.daysAgo": "Played {{n}} days ago",
  "datetime.action.hideTimeInfo": "Hide time info",
  "datetime.action.showTimeInfo": "Show time info"
};
const enEnums = {
  "enum.propertyType.singleLineText": "Single-line text",
  "enum.propertyType.multilineText": "Multi-line text",
  "enum.propertyType.singleChoice": "Single choice",
  "enum.propertyType.multipleChoice": "Multiple choice",
  "enum.propertyType.number": "Number",
  "enum.propertyType.percentage": "Percentage",
  "enum.propertyType.rating": "Rating",
  "enum.propertyType.boolean": "True/False",
  "enum.propertyType.link": "Link",
  "enum.propertyType.attachment": "Attachment",
  "enum.propertyType.date": "Date",
  "enum.propertyType.dateTime": "DateTime",
  "enum.propertyType.time": "Time",
  "enum.propertyType.formula": "Formula",
  "enum.propertyType.multilevel": "Multi-level option",
  "enum.propertyType.tags": "Tags",
  "enum.standardValueType.string": "Text",
  "enum.standardValueType.listString": "Multiple texts",
  "enum.standardValueType.decimal": "Number",
  "enum.standardValueType.link": "Link",
  "enum.standardValueType.boolean": "Yes/No",
  "enum.standardValueType.dateTime": "Date time",
  "enum.standardValueType.time": "Time",
  "enum.standardValueType.listListString": "Multilevel texts",
  "enum.standardValueType.listTag": "Tags",
  "enum.searchOperation.equals": "Equals",
  "enum.searchOperation.notEquals": "Not equals",
  "enum.searchOperation.contains": "Contains",
  "enum.searchOperation.notContains": "Does not contain",
  "enum.searchOperation.startsWith": "Prefix equals",
  "enum.searchOperation.notStartsWith": "Prefix not equals",
  "enum.searchOperation.endsWith": "Suffix equals",
  "enum.searchOperation.notEndsWith": "Suffix not equals",
  "enum.searchOperation.greaterThan": "Greater than",
  "enum.searchOperation.lessThan": "Less than",
  "enum.searchOperation.greaterThanOrEquals": "Greater than or equals",
  "enum.searchOperation.lessThanOrEquals": "Less than or equals",
  "enum.searchOperation.isNull": "Is null",
  "enum.searchOperation.isNotNull": "Is not null",
  "enum.searchOperation.in": "In list",
  "enum.searchOperation.notIn": "Not in list",
  "enum.searchOperation.matches": "Regex matches",
  "enum.searchOperation.notMatches": "Regex does not match",
  "enum.propertyValueScope.manual": "Manual",
  "enum.propertyValueScope.synchronization": "Synchronization",
  "enum.propertyValueScope.bakabaseEnhancer": "Bakabase enhancer",
  "enum.propertyValueScope.exHentaiEnhancer": "ExHentai enhancer",
  "enum.propertyValueScope.bangumiEnhancer": "Bangumi enhancer",
  "enum.propertyValueScope.dlsiteEnhancer": "DLsite enhancer",
  "enum.propertyValueScope.regexEnhancer": "Regex enhancer",
  "enum.propertyValueScope.kodiEnhancer": "Kodi enhancer",
  "enum.propertyValueScope.tmdbEnhancer": "TMDb enhancer",
  "enum.propertyValueScope.avEnhancer": "AV enhancer",
  "PropertyValueScope.Manual": "Manual",
  "PropertyValueScope.Synchronization": "Synchronization",
  "PropertyValueScope.BakabaseEnhancer": "Bakabase enhancer",
  "PropertyValueScope.ExHentaiEnhancer": "ExHentai enhancer",
  "PropertyValueScope.BangumiEnhancer": "Bangumi enhancer",
  "PropertyValueScope.DLsiteEnhancer": "DLsite enhancer",
  "PropertyValueScope.RegexEnhancer": "Regex enhancer",
  "PropertyValueScope.KodiEnhancer": "Kodi enhancer",
  "PropertyValueScope.TmdbEnhancer": "TMDb enhancer",
  "PropertyValueScope.AvEnhancer": "AV enhancer",
  "BulkModificationProcessorValueType.ManuallyInput": "Manually input",
  "BulkModificationProcessorValueType.Variable": "Variable",
  "PropertyType.SingleLineText": "Single-line text",
  "PropertyType.MultilineText": "Multi-line text",
  "PropertyType.SingleChoice": "Single choice",
  "PropertyType.MultipleChoice": "Multiple choice",
  "PropertyType.Number": "Number",
  "PropertyType.Percentage": "Percentage",
  "PropertyType.Rating": "Rating",
  "PropertyType.Boolean": "True/False",
  "PropertyType.Link": "Link",
  "PropertyType.Attachment": "Attachment",
  "PropertyType.Date": "Date",
  "PropertyType.DateTime": "DateTime",
  "PropertyType.Time": "Time",
  "PropertyType.Formula": "Formula",
  "PropertyType.Multilevel": "Multi-level option",
  "PropertyType.Tags": "Tags",
  "PropertyPool.Internal": "Internal",
  "PropertyPool.Reserved": "Reserved",
  "PropertyPool.Custom": "Custom",
  "PropertyPool.All": "All",
  "PropertyPool.Abbreviation.Internal": "I",
  "PropertyPool.Abbreviation.Reserved": "R",
  "PropertyPool.Abbreviation.Custom": "C",
  "PropertyPool.Abbreviation.All": "A",
  "bulkModification.label.useAny": "Use {{any}}",
  "bulkModification.label.editor": "editor",
  "enum.bulkModificationFilterOperation.equals": "Equals",
  "enum.bulkModificationFilterOperation.notEquals": "Not Equals",
  "enum.bulkModificationFilterOperation.contains": "Contains",
  "enum.bulkModificationFilterOperation.notContains": "Not Contains",
  "enum.bulkModificationFilterOperation.startsWith": "Starts With",
  "enum.bulkModificationFilterOperation.notStartsWith": "Not Starts With",
  "enum.bulkModificationFilterOperation.endsWith": "Ends With",
  "enum.bulkModificationFilterOperation.notEndsWith": "Not Ends With",
  "enum.bulkModificationFilterOperation.greaterThan": "Greater Than",
  "enum.bulkModificationFilterOperation.lessThan": "Less Than",
  "enum.bulkModificationFilterOperation.greaterThanOrEquals": "Greater Than Or Equals",
  "enum.bulkModificationFilterOperation.lessThanOrEquals": "Less Than Or Equals",
  "enum.bulkModificationFilterOperation.isNull": "Is Null",
  "enum.bulkModificationFilterOperation.isNotNull": "Is Not Null",
  "enum.bulkModificationFilterOperation.in": "In",
  "enum.bulkModificationFilterOperation.notIn": "Not In",
  "enum.bulkModificationFilterOperation.matches": "Matches",
  "enum.bulkModificationFilterOperation.notMatches": "Not Matches",
  "enum.resourceTag.isParent": "Is parent",
  "enum.resourceTag.pinned": "Pinned",
  "enum.resourceTag.pathDoesNotExist": "Path does not exist",
  "enum.resourceTag.unknownMediaLibrary": "Unknown media library",
  "enum.durationUnit.day": "days",
  "enum.durationUnit.hour": "hours",
  "enum.durationUnit.minute": "minutes",
  "enum.durationUnit.second": "seconds",
  "enum.combinator.and": "And",
  "enum.combinator.or": "Or",
  "enum.builtinPropertyForDisplayName.filename": "Filename",
  "enum.bulkModificationTimeProcessOperation.delete": "Delete",
  "enum.bulkModificationTimeProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationTimeProcessOperation.addHours": "Add hours",
  "enum.bulkModificationTimeProcessOperation.subtractHours": "Subtract hours",
  "enum.bulkModificationTimeProcessOperation.addMinutes": "Add minutes",
  "enum.bulkModificationTimeProcessOperation.subtractMinutes": "Subtract minutes",
  "enum.bulkModificationTimeProcessOperation.addSeconds": "Add seconds",
  "enum.bulkModificationTimeProcessOperation.subtractSeconds": "Subtract seconds",
  "enum.bulkModificationStringProcessOperation.delete": "Delete",
  "enum.bulkModificationStringProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationStringProcessOperation.addToStart": "Add to start",
  "enum.bulkModificationStringProcessOperation.addToEnd": "Add to end",
  "enum.bulkModificationStringProcessOperation.addToAnyPosition": "Add to any position",
  "enum.bulkModificationStringProcessOperation.removeFromStart": "Remove from start",
  "enum.bulkModificationStringProcessOperation.removeFromEnd": "Remove from end",
  "enum.bulkModificationStringProcessOperation.removeFromAnyPosition": "Remove from any position",
  "enum.bulkModificationStringProcessOperation.replaceFromStart": "Replace from start",
  "enum.bulkModificationStringProcessOperation.replaceFromEnd": "Replace from end",
  "enum.bulkModificationStringProcessOperation.replaceFromAnyPosition": "Replace from any position",
  "enum.bulkModificationStringProcessOperation.replaceWithRegex": "Replace with regex",
  "enum.bulkModificationListTagProcessOperation.delete": "Delete",
  "enum.bulkModificationListTagProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationListTagProcessOperation.append": "Append",
  "enum.bulkModificationListTagProcessOperation.prepend": "Prepend",
  "enum.bulkModificationListTagProcessOperation.remove": "Remove",
  "enum.bulkModificationListStringProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationListStringProcessOperation.append": "Append",
  "enum.bulkModificationListStringProcessOperation.prepend": "Prepend",
  "enum.bulkModificationListStringProcessOperation.modify": "Modify",
  "enum.bulkModificationListStringProcessOperation.delete": "Delete",
  "enum.bulkModificationListListStringProcessOperation.delete": "Delete",
  "enum.bulkModificationListListStringProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationListListStringProcessOperation.append": "Append",
  "enum.bulkModificationListListStringProcessOperation.prepend": "Prepend",
  "enum.bulkModificationListListStringProcessOperation.remove": "Remove",
  "enum.bulkModificationLinkProcessOperation.delete": "Delete",
  "enum.bulkModificationLinkProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationLinkProcessOperation.setText": "Set text",
  "enum.bulkModificationLinkProcessOperation.setUrl": "Set URL",
  "enum.bulkModificationLinkProcessOperation.modifyText": "Modify text",
  "enum.bulkModificationLinkProcessOperation.modifyUrl": "Modify URL",
  "enum.bulkModificationDecimalProcessOperation.delete": "Delete",
  "enum.bulkModificationDecimalProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationDecimalProcessOperation.add": "Add",
  "enum.bulkModificationDecimalProcessOperation.subtract": "Subtract",
  "enum.bulkModificationDecimalProcessOperation.multiply": "Multiply",
  "enum.bulkModificationDecimalProcessOperation.divide": "Divide",
  "enum.bulkModificationDecimalProcessOperation.round": "Round",
  "enum.bulkModificationDecimalProcessOperation.ceil": "Ceil",
  "enum.bulkModificationDecimalProcessOperation.floor": "Floor",
  "enum.bulkModificationDateTimeProcessOperation.delete": "Delete",
  "enum.bulkModificationDateTimeProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationDateTimeProcessOperation.addDays": "Add days",
  "enum.bulkModificationDateTimeProcessOperation.subtractDays": "Subtract days",
  "enum.bulkModificationDateTimeProcessOperation.addMonths": "Add months",
  "enum.bulkModificationDateTimeProcessOperation.subtractMonths": "Subtract months",
  "enum.bulkModificationDateTimeProcessOperation.addYears": "Add years",
  "enum.bulkModificationDateTimeProcessOperation.subtractYears": "Subtract years",
  "enum.bulkModificationDateTimeProcessOperation.setToNow": "Set to now",
  "enum.bulkModificationBooleanProcessOperation.delete": "Delete",
  "enum.bulkModificationBooleanProcessOperation.setWithFixedValue": "Set with fixed value",
  "enum.bulkModificationBooleanProcessOperation.toggle": "Toggle",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.all": "All",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.containing": "Containing",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.matching": "Matching",
  "BangumiSubjectType.All": "All",
  "BangumiSubjectType.Anime": "Anime",
  "BangumiSubjectType.Book": "Book",
  "BangumiSubjectType.Music": "Music",
  "BangumiSubjectType.Game": "Game",
  "BangumiSubjectType.Real": "Real",
  "CoverSelectOrder.FilenameAscending": "Filename ascending",
  "CoverSelectOrder.FileModifyDtDescending": "File modify time descending",
  "enhancer.bangumi.prioritySubjectType.label": "Priority subject type",
  "enhancer.bangumi.prioritySubjectType.description": "If set, Bangumi will first search with this type. If no results found, it will fall back to searching all types.",
  "enhancer.bangumi.prioritySubjectType.hint": "Leave empty to search all types by default."
};
const enDashboard = {
  "dashboard.stat.totalResources": "Total Resources",
  "dashboard.stat.libraryCount": "{{count}} libraries",
  "dashboard.stat.thisWeek": "This Week",
  "dashboard.stat.trend": "Trend",
  "dashboard.stat.weeks": "12 weeks",
  "dashboard.stat.dataCompleteness": "Data Completeness",
  "dashboard.action.search": "Search",
  "dashboard.action.browseLibraries": "Browse Libraries",
  "dashboard.action.bulkOperations": "Bulk Operations",
  "dashboard.action.randomPick": "Random Pick",
  "dashboard.action.viewAll": "View all",
  "dashboard.action.addResources": "Add your resources",
  "dashboard.tab.recentlyAdded": "Recently Added",
  "dashboard.tab.recentlyPlayed": "Recently Played",
  "dashboard.tab.pinned": "Pinned",
  "dashboard.empty.noResources": "No resources yet",
  "dashboard.empty.noPlayHistory": "No play history",
  "dashboard.empty.noPinned": "No pinned resources",
  "dashboard.section.libraryDistribution": "Library Distribution"
};
const enResource = {
  "resource.search.placeholder": "Search everything",
  "resource.search.button": "Search",
  "resource.search.newTab": "View in new tab",
  "resource.search.searching": "Searching...",
  "resource.search.loadedInPage": "Resources loaded in current page",
  "resource.search.selectAll": "Select all",
  "resource.search.selectedCount": "{{count}} items selected",
  "resource.search.loadedResources": "Loaded resources",
  "resource.search.allFiltered": "All filtered resources",
  "resource.search.selectAllFiltered": "Select all {{count}} filtered resources (including those not currently loaded).",
  "resource.search.playlist": "Playlist",
  "resource.search.recentlyPlayed": "Recently played",
  "resource.empty.title": "No Resources Found",
  "resource.empty.checkCriteria": "Check Search Criteria",
  "resource.empty.checkCriteriaDesc": "Current filters may be too restrictive. Try resetting the search criteria to show all resources.",
  "resource.empty.resetCriteria": "Reset Search Criteria",
  "resource.empty.addToLibrary": "Add Media Library",
  "resource.empty.addToLibraryDesc": "Media libraries define which folders contain your resources. Make sure the folders containing your resources have been added to a media library.",
  "resource.empty.goToLibrary": "Go to Media Library",
  "resource.empty.configurePathMark": "Configure Path Marks",
  "resource.empty.configurePathMarkDesc": "Path marks define how to identify and parse resources. By configuring path mark rules, the system can extract resource names, tags, and other information from file paths.",
  "resource.empty.goToPathMarkConfig": "Go to Configuration",
  "resource.order.label": "Orders",
  "resource.order.placeholder": "Select orders",
  "resource.order.asc": "Asc",
  "resource.order.desc": "Desc",
  "ResourceSearchSortableProperty.FileCreateDt": "File Create Date",
  "ResourceSearchSortableProperty.FileModifyDt": "File Modify Date",
  "ResourceSearchSortableProperty.Filename": "Filename",
  "ResourceSearchSortableProperty.AddDt": "Add Date",
  "ResourceSearchSortableProperty.PlayedAt": "Last Played At",
  "resource.display.title": "Display options",
  "resource.display.columnCount": "Column count",
  "resource.display.fillCover": "Fill cover",
  "resource.display.hoverLargeCover": "Show larger cover on mouse hover",
  "resource.display.previewFiles": "Preview files of a resource on mouse hover",
  "resource.display.autoSelectFile": "Auto-select first file if multiple playable files exist",
  "resource.display.inlineNameTags": "Inline display name and tags",
  "resource.display.inlineNameTagsDesc": "To display name and tags in the same line, you need to set display properties first",
  "resource.display.useCache": "Use cache",
  "resource.display.useCacheDesc": "Use cached resources to improve loading speed. Old data may be displayed if the cache is not updated.",
  "resource.display.manageCache": "Manage cache",
  "resource.display.coverCarousel": "Cover carousel",
  "resource.display.showResourceId": "Display resource ID",
  "resource.display.hideResourceBorder": "Hide resource border",
  "resource.display.filterOptionsCollapseThreshold": "Filter options collapse threshold",
  "resource.display.filterOptionsCollapseThresholdDesc": "Selected options are always shown. At most this many options will be displayed.",
  "resource.display.reset": "Reset",
  "resource.display.operations": "Display operations",
  "resource.display.aggregateButton": "Aggregate button",
  "resource.display.pinUnpin": "Pin/Unpin",
  "resource.display.openFolder": "Open folder",
  "resource.display.enhancements": "Enhancements",
  "resource.display.preview": "Preview",
  "resource.display.addToPlaylist": "Add to playlist",
  "resource.display.properties": "Display properties",
  "resource.display.selectedProperties": "Selected",
  "resource.display.selectProperties": "Select properties",
  "resource.shortcut.title": "Shortcuts",
  "resource.recentlyPlayed.title": "Recently played",
  "resource.recentlyPlayed.count": "{{count}} resources",
  "resource.recentlyPlayed.empty": "No recently played resources"
};
const enConfiguration = {
  "configuration.dependency.title": "Dependent components",
  "configuration.dependency.defaultLocation": "Default location",
  "configuration.dependency.curlExecutable": "curl executable",
  "configuration.dependency.curlPlaceholder": "path/to/curl.exe",
  "configuration.dependency.ollamaEndpoint": "Ollama endpoint",
  "configuration.dependency.notInstalled": "Not installed",
  "configuration.dependency.checkingVersion": "Checking new version",
  "configuration.dependency.clickToUpdate": "Click to update to version",
  "configuration.dependency.updating": "Updating",
  "configuration.dependency.failedToGetVersion": "Failed to get information of new version",
  "configuration.thirdParty.title": "Third Party Configurations",
  "configuration.thirdParty.validateCookie": "Validate cookie",
  "configuration.thirdParty.cookieValid": "Cookie is good",
  "configuration.thirdParty.invalidCookie": "Invalid cookie",
  "configuration.functional.title": "Functional configurations",
  "configuration.functional.startupPage": "Startup page",
  "configuration.functional.startupPage.default": "Default",
  "configuration.functional.startupPage.resource": "Resource",
  "configuration.functional.exitBehavior": "Exit behavior",
  "configuration.functional.exitBehavior.minimize": "Minimize",
  "configuration.functional.exitBehavior.exit": "Exit",
  "configuration.functional.exitBehavior.prompt": "Prompt",
  "configuration.contact.title": "Contact us",
  "configuration.appInfo.title": "System information",
  "configuration.appInfo.appDataPath": "App Data Path",
  "configuration.appInfo.dataPath": "Data Path",
  "configuration.appInfo.tempFilesPath": "Temporary files path",
  "configuration.appInfo.logPath": "Log Path",
  "configuration.appInfo.backupPath": "Backup Path",
  "configuration.appInfo.coreVersion": "Core Version",
  "configuration.appInfo.latestVersion": "Latest version",
  "configuration.appInfo.upToDate": "Up-to-date",
  "configuration.appInfo.failedToGetLatestVersion": "Failed to get latest version",
  "configuration.appInfo.changelog": "Change log",
  "configuration.appInfo.clickToAutoUpdate": "Click to auto-update",
  "configuration.appInfo.autoUpdateFails": "Auto-Update Fails? Click to download complete installers",
  "configuration.appInfo.restartToUpdate": "Restart to update",
  "configuration.appInfo.failedToUpdateApp": "Failed to update app",
  "configuration.appInfo.clickToRetry": "Click here to retry",
  "configuration.appInfo.downloading": "Downloading",
  "configuration.appInfo.tip.appDataPath": "This is where core data files stored and DO NOT change them if not necessary. The logs in [System] - [Logs] are saved in bootstrap_log.* files, they can be safely deleted.",
  "configuration.appInfo.tip.dataPath": "This is where user files, covers, and other data are stored.",
  "configuration.appInfo.tip.tempFilesPath": "This is a directory where temporary files are stored.",
  "configuration.appInfo.tip.logPath": "Detailed information which describing the running states of app. You can send log files to developer if the app is not running normally, and you can delete them also if everything is ok.",
  "configuration.appInfo.tip.backupPath": "A data backup will be created when using the new version of app first time, you can delete them if everything is ok. You can download the corresponding version of the app and use the backup files to overwrite the App Data Path for data recovery.",
  "configuration.others.title": "Other settings",
  "configuration.others.proxy": "Proxy",
  "configuration.others.proxy.tip": "You can set a proxy for network requests, such as socks5://127.0.0.1:18888",
  "configuration.others.proxy.doNotUse": "Do not use proxy",
  "configuration.others.proxy.useSystem": "Use system proxy",
  "configuration.others.proxy.addModal.title": "Add a proxy",
  "configuration.others.enablePreRelease": "Enable pre-release channel",
  "configuration.others.enablePreRelease.tip": "Prefer pre-release version which has new features but less stability",
  "configuration.others.enableTracking": "Enable anonymous data tracking",
  "configuration.others.enableTracking.tip": "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.",
  "configuration.others.maxParallelism": "Max parallelism",
  "configuration.others.maxParallelism.tip": "Maximum degree of parallelism for CPU-intensive operations. Set to 1 to disable parallelism. Leave empty for default (half of CPU cores).",
  "configuration.development.title": "Development",
  "configuration.development.apiEndpoints": "API endpoints",
  "configuration.development.apiDocument": "API document",
  "configuration.development.listeningPortCount": "Listening port count",
  "configuration.development.listeningPorts": "Listening ports",
  "configuration.development.auto": "Auto",
  "configuration.development.count": "Count",
  "configuration.development.tip.currentListeningPortCount": "Current listening port count is {{port}}",
  "configuration.development.tip.configurablePortRange": "The configurable port range is {{min}}-{{max}}. And you can set it to 0 for auto count.",
  "configuration.development.tip.changesAfterRestart": "Changes will take effect after restarting the application",
  "configuration.development.tip.portWarning": "Please be careful when setting this value, if you set it to a value that is already in use by another application, our application will not be able to start.",
  "configuration.development.tip.portsInput": "Enter ports separated by commas, e.g. 34567, 34568",
  "configuration.development.input.portsPlaceholder": "e.g. 34567, 34568",
  "configuration.development.error.tooManyPorts": "Too many ports. Up to {{max}} ports are supported."
};
const Idle$1 = "Idle";
const InQueue$1 = "In Queue";
const Starting$1 = "Starting";
const Downloading$1 = "Downloading";
const Stopping$1 = "Stopping";
const Complete$1 = "Complete";
const Failed$1 = "Failed";
const Disabled$1 = "Disabled";
const enDownloader = {
  "downloader.confirm.conflictedTasks": "Found some conflicted tasks",
  "downloader.action.downloadSelectedFirst": "Download selected tasks firstly",
  "downloader.action.addToQueue": "Add selected tasks to the queue",
  "downloader.action.bulk": "Bulk",
  "downloader.action.start": "Start",
  "downloader.action.stop": "Stop",
  "downloader.confirm.deleteTasks": "Deleting {{count}} download tasks",
  "downloader.confirm.clearCheckpoints": "Clear checkpoints for {{count}} tasks",
  "downloader.confirm.clearCheckpoint": "Clear checkpoint",
  "downloader.action.clearCheckpoints": "Clear checkpoints",
  "downloader.filter.source": "Source",
  "downloader.filter.status": "Status",
  "downloader.filter.keyword": "Keyword",
  "downloader.action.createTask": "Create task",
  "downloader.action.startAll": "Start all",
  "downloader.action.stopAll": "Stop all",
  "downloader.action.cleanup": "Cleanup",
  "downloader.action.deleteCompleted": "Delete all completed tasks",
  "downloader.action.deleteFailed": "Delete all failed tasks",
  "downloader.action.exportAll": "Export all tasks",
  "downloader.action.configurations": "Configurations",
  "downloader.empty.noTasks": "No tasks found",
  "downloader.label.nextStartTime": "Next start time",
  "downloader.label.createdAt": "Created at",
  "downloader.confirm.deleteTask": "Are you sure to delete it?",
  "downloader.modal.configurations": "Configurations",
  "downloader.modal.creatingTask": "Creating download task",
  "downloader.modal.taskDetail": "Download task",
  "downloader.label.site": "Site",
  "downloader.label.taskType": "Task type",
  "downloader.status.notAvailable": "Not available",
  "downloader.label.allowDuplicate": "Allow duplicate submission",
  "downloader.tip.allowDuplicateDesc": "In general, it's not necessary to create identical tasks.",
  "downloader.label.autoRetry": "Auto retry",
  "downloader.tip.autoRetryDesc": "Retry automatically when the downloading task failed.",
  "downloader.tip.checkpointManual": "You can set the previous downloading checkpoint manually to make the downloader start the downloading task from it.",
  "downloader.tip.checkpointAuto": "In most cases, you should let this field set by downloader automatically.",
  "downloader.tip.checkpointFormat": "Each downloader has its own checkpoint format, and invalid checkpoint data will be ignored. You can find samples on our online document.",
  "downloader.label.requestsOverview": "Requests overview",
  "downloader.label.success": "Success",
  "downloader.label.failure": "Failure",
  "downloader.label.checkInterval": "Check interval(s)",
  "downloader.tip.checkIntervalDesc": "The interval (in seconds) after download completion or failure before restarting the task. Generally used for downloading content that updates periodically.",
  Idle: Idle$1,
  InQueue: InQueue$1,
  Starting: Starting$1,
  Downloading: Downloading$1,
  Stopping: Stopping$1,
  Complete: Complete$1,
  Failed: Failed$1,
  Disabled: Disabled$1,
  "Cookie required for authentication": "Cookie required for authentication",
  "Default download path": "Default download path",
  "Default path where downloads will be saved": "Default path where downloads will be saved",
  "Maximum concurrent download threads": "Maximum concurrent download threads",
  "Max concurrency": "Max concurrency",
  "Request interval help": "Wait time between each request to avoid too frequent requests",
  "Request interval (s)": "Request interval (s)",
  "Define how downloaded files should be named": "Define how downloaded files should be named",
  "Available fields": "Available fields",
  "Naming convention": "Naming convention",
  "Download path": "Download path",
  "Select download path": "Select download path",
  "Set a page range if you don't want to download them all.": "Set a page range if you don't want to download them all.",
  "The minimal page number is 1.": "The minimal page number is 1.",
  "Start page": "Start page",
  "End page": "End page",
  "downloader.label.preferTorrent": "Prefer torrent download",
  "downloader.tip.preferTorrentDesc": "If available, download torrent files instead of downloading images directly.",
  "downloader.tip.exHentaiUserscript": "You can use our Tampermonkey userscript to download from ExHentai with one click.",
  "downloader.tip.goToThirdPartyIntegration": "Go to Third-Party Integration"
};
const enFileProcessor = {
  "fileProcessor.action.bulkDecompression": "Bulk decompression all decompressed files in current folder",
  "fileProcessor.tip.operationsAfterPlay": "Usually this will work fine if you are categorizing files.",
  "fileProcessor.label.showOperationsAfterPlay": "Show operations after playing first file",
  "fileProcessor.modal.afterFirstPlayTitle": "We noticed that you played the first file in this path. Would you like to proceed with the following actions?",
  "fileProcessor.label.currentPath": "Current Path",
  "fileProcessor.tip.moveToAnotherPath": "You can move it to another path.",
  "fileProcessor.tip.orDeleteIt": "Or delete it?"
};
const enMediaLibrary = {
  "mediaLibrary.title": "Media Library",
  "mediaLibrary.action.add": "Add Media Library",
  "mediaLibrary.action.delete": "Delete",
  "mediaLibrary.action.cancel": "Cancel",
  "mediaLibrary.action.continue": "Continue",
  "mediaLibrary.action.createFirst": "Create your first media library",
  "mediaLibrary.action.goToPathMarkConfig": "Configure Path Marks",
  "mediaLibrary.action.searchResources": "Search resources in this media library",
  "mediaLibrary.confirm.title": "Confirm",
  "mediaLibrary.confirm.delete": "Are you sure you want to delete this media library?",
  "mediaLibrary.confirm.leavePage": "This will navigate to the resource page. Do you want to continue?",
  "mediaLibrary.error.nameEmpty": "Name cannot be empty",
  "mediaLibrary.warning.irreversible": "Be careful, this operation can not be undone",
  "mediaLibrary.tooltip.delete": "Delete this media library",
  "mediaLibrary.tooltip.resourceLoaded": "{{count}} resource(s) loaded in this media library.",
  "mediaLibrary.tooltip.noResource": "No resource loaded in this media library, you can click the synchronize button to load resources.",
  "mediaLibrary.label.resources": "resources",
  "mediaLibrary.label.listDescription": "Manage your media libraries here",
  "mediaLibrary.label.pathMarkConfigHint": "Next step: Go to Path Mark Config to select files or directories, configure resources, and link them to a media library",
  "mediaLibrary.emptyState.title": "No Media Libraries",
  "mediaLibrary.emptyState.description": "Create a media library to organize and manage your resources",
  "mediaLibrary.emptyState.feature1": "Organize resources by categories",
  "mediaLibrary.emptyState.feature2": "Apply enhancers to extract metadata",
  "mediaLibrary.emptyState.feature3": "Sync and manage multiple root paths"
};
const enPathMark = {};
const enResourceProfile = {
  "resourceProfile.confirm.delete": "Are you sure you want to delete this resource profile?",
  "resourceProfile.label.priority": "Priority",
  "resourceProfile.label.name": "Name",
  "resourceProfile.label.searchCriteria": "Search Criteria",
  "resourceProfile.label.nameTemplate": "Name Template",
  "resourceProfile.label.enhancers": "Enhancers",
  "resourceProfile.label.playableFiles": "Playable Files",
  "resourceProfile.label.players": "Players",
  "resourceProfile.label.properties": "Properties",
  "resourceProfile.label.actions": "Actions",
  "resourceProfile.label.total": "Total",
  "resourceProfile.tip.priority": "Lower numbers indicate higher priority. Higher priority profiles are matched first. When multiple profiles match a resource, the one with highest priority takes effect.",
  "resourceProfile.tip.name": "A unique name to identify this profile.",
  "resourceProfile.tip.searchCriteria": "Define which resources this profile applies to. Resources matching these criteria will use this profile's settings.",
  "resourceProfile.tip.nameTemplate": "Customize how resource names are displayed using property placeholders like {Name}. Leave empty to use the original filename.",
  "resourceProfile.tip.playableFiles": "Rules to identify which files within a resource are playable. Configure by file extension or filename pattern.",
  "resourceProfile.tip.players": "External applications to open playable files. You can assign different players for different file extensions. By default, the system's default application is used to open playable files.",
  "resourceProfile.tip.properties": "Select which properties should be displayed or editable for resources matching this profile.",
  "resourceProfile.tip.configureEnhancers": "Click to configure enhancers",
  "resourceProfile.action.testCriteria": "Test criteria",
  "resourceProfile.action.editBasicInfo": "Edit basic info",
  "resourceProfile.action.duplicate": "Duplicate",
  "resourceProfile.action.deleteEnhancements": "Delete enhancements",
  "resourceProfile.action.addProfile": "Add Resource Profile",
  "resourceProfile.action.searchByName": "Search by name",
  "resourceProfile.status.loading": "Loading...",
  "resourceProfile.empty.noProfiles": "No profiles found",
  "resourceProfileGuide.viewAgain": "View guide again",
  "resourceProfileGuide.welcome.title": "Welcome to Resource Profiles",
  "resourceProfileGuide.welcome.description": "Resource profiles help you customize how different types of resources are displayed, matched, and played. Let's get started!",
  "resourceProfileGuide.matching.title": "Search Criteria & Priority",
  "resourceProfileGuide.matching.subtitle": "Control which resources each profile applies to",
  "resourceProfileGuide.matching.point1": "Define search criteria to automatically match resources based on their properties",
  "resourceProfileGuide.matching.point2": "Set priority to determine which profile takes effect when multiple profiles match",
  "resourceProfileGuide.display.title": "Display & Enhancers",
  "resourceProfileGuide.display.subtitle": "Customize how resources are presented",
  "resourceProfileGuide.display.point1": "Create custom name templates using property placeholders",
  "resourceProfileGuide.display.point2": "Configure enhancers to automatically enrich resource metadata",
  "resourceProfileGuide.display.point3": "Select which properties to display for each profile",
  "resourceProfileGuide.playback.title": "Playback Configuration",
  "resourceProfileGuide.playback.subtitle": "Set up how files are opened and played",
  "resourceProfileGuide.playback.point1": "Define which file extensions are considered playable",
  "resourceProfileGuide.playback.point2": "Configure external players for different file types",
  "resourceProfileGuide.binding.title": "Property Binding",
  "resourceProfileGuide.binding.subtitle": "Bind different property values to different profiles",
  "resourceProfileGuide.binding.point1": "Bind specific property values to profiles for better organization",
  "resourceProfileGuide.binding.point2": "Bound properties are prioritized and displayed prominently in resource details",
  "resourceProfileGuide.skip": "Skip",
  "resourceProfileGuide.previous": "Previous",
  "resourceProfileGuide.next": "Next",
  "resourceProfileGuide.getStarted": "Get Started",
  "resourceProfile.modal.deleteEnhancementsTitle": "Delete Enhancements",
  "resourceProfile.modal.configurePlayersTitle": "Configure Players",
  "resourceProfile.modal.testSearchCriteriaTitle": "Test Search Criteria",
  "resourceProfile.label.allEnhancers": "All enhancers",
  "resourceProfile.label.selectEnhancer": "Select enhancer",
  "resourceProfile.label.deleteEmptyRecordsOnly": "Delete empty records only",
  "resourceProfile.label.newPlayer": "New Player",
  "resourceProfile.label.extensions": "extensions",
  "resourceProfile.label.invalid": "Invalid",
  "resourceProfile.label.executablePath": "Executable Path",
  "resourceProfile.label.commandTemplate": "Command Template",
  "resourceProfile.label.supportedExtensions": "Supported Extensions",
  "resourceProfile.label.commandPreviewTest": "Command Preview & Test",
  "resourceProfile.label.testFilePath": "Test File Path",
  "resourceProfile.label.generatedCommand": "Generated Command",
  "resourceProfile.label.totalMatchingResources": "Total matching resources",
  "resourceProfile.label.showLimit": "Show limit",
  "resourceProfile.label.unnamed": "Unnamed",
  "resourceProfile.tip.deleteEnhancementsForProfile": "Delete enhancements for resources matching profile",
  "resourceProfile.tip.noEnhancersConfigured": "This profile has no enhancers configured. All enhancements for matching resources will be deleted.",
  "resourceProfile.tip.deleteEmptyRecordsOnlyDescription": "Only delete enhancement records that have no actual enhancement data",
  "resourceProfile.tip.pathToPlayerExecutable": "Path to the player executable",
  "resourceProfile.tip.commandTemplatePlaceholder": "Use {0} as placeholder for the file path. Example: --fullscreen {0}",
  "resourceProfile.tip.playerExtensionUsage": "This player will be used for files with these extensions",
  "resourceProfile.tip.enterFilePathPreview": "Enter a file path to preview the command",
  "resourceProfile.tip.testPathIsFolder": "Note: The test path is a folder, not a file",
  "resourceProfile.status.testingCriteria": "Testing criteria...",
  "resourceProfile.status.playersConfigured": "{{count}} player(s) configured",
  "resourceProfile.status.noPlayersConfigured": "No players configured",
  "resourceProfile.status.showingOfTotal": "Showing {{shown}} of {{total}} matching resources",
  "resourceProfile.action.addPlayer": "Add Player",
  "resourceProfile.action.copied": "Copied!",
  "resourceProfile.action.copyToClipboard": "Copy to clipboard",
  "resourceProfile.input.filterResults": "Filter results...",
  "resourceProfile.empty.noPlayersConfiguredGetStarted": "No players configured. Click 'Add Player' to get started.",
  "resourceProfile.empty.noResourcesMatchFilter": "No resources match your filter",
  "resourceProfile.empty.noResourcesMatchedByCriteria": "No resources matched by this criteria",
  "resourceProfile.error.executablePathRequired": "Executable path is required",
  "resourceProfile.error.selectFileNotFolder": "Please select a file, not a folder",
  "resourceProfile.error.fillAllExecutablePaths": "Please fill in all executable paths before saving.",
  "resourceProfile.warning.cannotBeUndone": "Warning: This action cannot be undone.",
  "resourceProfile.modal.selectEnhancersTitle": "Select Enhancers",
  "resourceProfile.modal.playableFileOptionsTitle": "Playable File Options",
  "resourceProfile.modal.editResourceProfileTitle": "Edit Resource Profile",
  "resourceProfile.modal.addResourceProfileTitle": "Add Resource Profile",
  "resourceProfile.label.enhanceProperties": "Enhance properties",
  "resourceProfile.label.more": "more",
  "resourceProfile.label.selected": "Selected",
  "resourceProfile.label.quickAddPresets": "Quick Add Presets",
  "resourceProfile.label.video": "Video",
  "resourceProfile.label.audio": "Audio",
  "resourceProfile.label.image": "Image",
  "resourceProfile.label.document": "Document",
  "resourceProfile.label.archive": "Archive",
  "resourceProfile.label.fileExtensions": "File Extensions",
  "resourceProfile.label.fileNamePattern": "File Name Pattern",
  "resourceProfile.label.currentConfiguration": "Current Configuration",
  "resourceProfile.label.extensionsLabel": "Extensions",
  "resourceProfile.label.pattern": "Pattern",
  "resourceProfile.label.resourceProfile": "Resource Profile",
  "resourceProfile.label.profileName": "Profile name",
  "resourceProfile.action.configure": "Configure",
  "resourceProfile.action.clearAll": "Clear All",
  "resourceProfile.tip.filesWithExtensionsPlayable": "Files with these extensions will be considered playable",
  "resourceProfile.tip.regexPatternPlayable": "Regex pattern to match playable file names (optional, leave empty for extension-only matching)",
  "resourceProfile.tip.higherPriorityPrecedence": "Higher priority profiles take precedence",
  "resourceProfile.tip.otherSettingsAfterCreation": "Other settings can be configured directly in the table after creation.",
  "resourceProfile.input.fileNamePatternPlaceholder": "e.g., .*\\.(mp4|mkv|avi)$",
  "resourceProfile.error.nameRequired": "Name is required",
  "resourceProfile.modal.editDisplayNameTemplateTitle": "Edit display name template for resources",
  "resourceProfile.label.availableProperties": "Available Properties",
  "resourceProfile.empty.noPropertiesAvailable": "No properties available",
  "resourceProfile.label.wrappers": "Wrappers",
  "resourceProfile.label.template": "Template",
  "resourceProfile.label.preview": "Preview",
  "resourceProfile.tip.wrappersRemovedAutomatically": "Wrappers around empty property values will be removed automatically.",
  "resourceProfile.input.templatePlaceholder": "Enter template or click properties above to insert...",
  "resourceProfile.tip.leaveEmptyForFilename": "Leave empty to use filename as display name."
};
const enBulkModification = {
  "bulkModification.action.add": "Add a bulk modification",
  "bulkModification.action.addPreprocess": "Add a preprocess",
  "bulkModification.action.addStep": "Add a step",
  "bulkModification.action.apply": "Apply bulk modification",
  "bulkModification.action.applyChanges": "Apply changes",
  "bulkModification.action.calculate": "Calculate changes",
  "bulkModification.action.delete": "Delete bulk modification",
  "bulkModification.action.deleteProcess": "Delete current process",
  "bulkModification.action.deleteStep": "Delete a process step",
  "bulkModification.action.deleteVariable": "Delete variable",
  "bulkModification.action.duplicate": "Duplicate",
  "bulkModification.action.editName": "Edit name of bulk modification",
  "bulkModification.action.revert": "Revert bulk modification",
  "bulkModification.action.revertChanges": "Revert changes",
  "bulkModification.action.clickToDisable": "Click to disable",
  "bulkModification.action.clickToEnable": "Click to enable",
  "bulkModification.action.filter": "Filter",
  "bulkModification.action.refilter": "Re-filter",
  "bulkModification.action.checkDiffs": "Check {{count}} diffs",
  "bulkModification.action.viewFilteredResources": "View {{count}} filtered resources",
  "bulkModification.action.goToBulkModificationPage": "Go to Bulk Modification page",
  "bulkModification.message.navigateToPageConfirmation": "Are you sure you want to leave this page? Unsaved changes may be lost.",
  "bulkModification.confirm.delete": "Are you sure to delete this bulk modification?",
  "bulkModification.confirm.revert": "Are you sure to revert the bulk modification?",
  "bulkModification.confirm.deleteStep": "Are you sure you want to delete this process step?",
  "bulkModification.confirm.apply": "Please check diffs before applying, and changed value may not be reverted perfectly in some situations, are you sure to apply?",
  "bulkModification.confirm.deleteVariable": "Are you sure to delete variable {{name}}?",
  "bulkModification.confirm.deleteProcess": "Are you sure you want to delete this process and all its process steps?",
  "bulkModification.label.name": "Name",
  "bulkModification.label.count": "Count",
  "bulkModification.label.diffs": "Diffs",
  "bulkModification.label.mode": "Mode",
  "bulkModification.label.operation": "Operation",
  "bulkModification.label.property": "Property",
  "bulkModification.label.resource": "Resource",
  "bulkModification.label.steps": "Steps",
  "bulkModification.label.value": "Value",
  "bulkModification.label.resourceCount": "{{count}} resources related",
  "bulkModification.label.sequenceNumber": "Sequence number",
  "bulkModification.label.editor": "editor",
  "bulkModification.label.start": "start",
  "bulkModification.label.end": "end",
  "bulkModification.label.preprocessing": "Preprocessing",
  "bulkModification.label.settingProcess": "Setting process",
  "bulkModification.label.settingVariable": "Setting variable",
  "bulkModification.title.processForProperty": "Process flow for {{property}}",
  "bulkModification.title.preprocessForProperty": "Preprocess flow for {{property}}",
  "bulkModification.label.typeTransformation": "Type transformation",
  "bulkModification.label.startsFromZero": "Starts from 0",
  "bulkModification.filter.filterBy": "Filter by",
  "bulkModification.filter.filterBranches": "Filter branches by",
  "bulkModification.filter.forEachItem": "For each filtered item",
  "bulkModification.filter.followChanges": "Follow property changes",
  "bulkModification.filter.resourceFilteredCount": "{{count}} resources have been filtered out",
  "bulkModification.select.property": "Choose a property",
  "bulkModification.select.propertyValue": "Select a property",
  "bulkModification.select.editor": "Choose a property value editor",
  "bulkModification.select.scope": "Select a scope for property value",
  "bulkModification.select.variable": "Please select a variable",
  "bulkModification.select.resources": "Select resources to be modified.",
  "bulkModification.empty.noData": "No data",
  "bulkModification.empty.notSet": "No set",
  "bulkModification.empty.noVariables": "No variables available",
  "bulkModification.empty.notSupported": "Not supported",
  "bulkModification.error.title": "ERROR",
  "bulkModification.error.checkCriteria": "Please check the search criteria.",
  "bulkModification.error.nameEmpty": "Name cannot be empty",
  "bulkModification.error.getPropertyFailed": "Unable to get property information",
  "bulkModification.error.unsupportedValue": "Unsupported value",
  "bulkModification.input.setVariableName": "Set a name for this variable",
  "bulkModification.info.addPreprocessSteps": "You can add multiple preprocessing steps.",
  "bulkModification.info.addProcessSteps": "You can add multiple process steps.",
  "bulkModification.info.checkTypeRules": "You can check type conversion rules here",
  "bulkModification.info.typeConversion": "We will automatically convert the value from {{fromType}} to {{toType}}.",
  "bulkModification.info.underDevelopment": "Under development, currently supported data types",
  "bulkModification.info.ensureCalculation": "Please ensure that the calculation operation has been executed.",
  "bulkModification.info.noResourcesToChange": "If the calculation operation has been executed, there may be no resources that will be changed.",
  "bulkModification.info.preprocessUsage": "If a preprocessing procedure is set, the variables will be preprocessed first before being used.",
  "bulkModification.position.beginning": "beginning",
  "bulkModification.position.end": "end",
  "bulkModification.textOperation.backward": "backward",
  "bulkModification.textOperation.forward": "forward",
  "bulkModification.status.enabled": "Enabled",
  "bulkModification.status.disabled": "Disabled",
  "bulkModification.tip.forMorePowerfulModification": "For more powerful and flexible modification capabilities,",
  "bulkModification.tip.filters": "Select resources to be modified.",
  "bulkModification.tip.variables": "You can define and preprocess variables here, then use it in process steps.",
  "bulkModification.tip.processes": "You can define process steps here, and use variables in steps, to modify all filtered resources.",
  "bulkModification.tip.changes": "Before applying bulk modification, you must calculate and check the changes here.",
  "bulkModification.block.filters": "Filters",
  "bulkModification.block.variables": "Variables",
  "bulkModification.block.processes": "Processes",
  "bulkModification.block.changes": "Changes",
  "bulkModification.block.finalStep": "Final Step",
  "bulkModificationGuide.welcome.title": "Welcome to Bulk Modification",
  "bulkModificationGuide.welcome.description": "Bulk modification helps you quickly and efficiently modify properties of multiple resources. You can filter resources using any criteria and then batch update their property values.",
  "bulkModificationGuide.welcome.highlight": "All bulk modification configurations are automatically saved and can be reused anytime without reconfiguration.",
  "bulkModificationGuide.workflow.title": "Workflow",
  "bulkModificationGuide.workflow.subtitle": "Bulk modification consists of four steps, each with a clear purpose.",
  "bulkModificationGuide.workflow.step1Title": "Filter Resources",
  "bulkModificationGuide.workflow.step1Desc": "Use powerful filters to select resources to modify.",
  "bulkModificationGuide.workflow.step2Title": "Define Variables (Optional)",
  "bulkModificationGuide.workflow.step2Desc": "Predefine variables for reuse in process steps.",
  "bulkModificationGuide.workflow.step3Title": "Configure Processes",
  "bulkModificationGuide.workflow.step3Desc": "Set up operations on properties, supporting multi-step pipelines.",
  "bulkModificationGuide.workflow.step4Title": "Preview and Apply",
  "bulkModificationGuide.workflow.step4Desc": "Calculate and review all changes, then apply when ready.",
  "bulkModificationGuide.valueSources.title": "Value Sources",
  "bulkModificationGuide.valueSources.subtitle": "You can get values from multiple sources.",
  "bulkModificationGuide.valueSources.fixedValue": "Fixed Value",
  "bulkModificationGuide.valueSources.fixedValueDesc": "Directly input a fixed value to apply to all resources.",
  "bulkModificationGuide.valueSources.variable": "Variable Reference",
  "bulkModificationGuide.valueSources.variableDesc": "Reference values from other properties, including values from different scopes.",
  "bulkModificationGuide.valueSources.delete": "Delete Operation",
  "bulkModificationGuide.valueSources.deleteDesc": "Clear the property value, setting it to empty.",
  "bulkModificationGuide.pipeline.title": "Pipeline Processing",
  "bulkModificationGuide.pipeline.subtitle": "Support multi-step chain processing where each step can use the result of the previous step.",
  "bulkModificationGuide.pipeline.explanation": "Processes execute in order: Step 2 can use the new value from Step 1, Step 3 can use the result from Step 2, and so on. This makes complex bulk modifications simple.",
  "bulkModificationGuide.pipeline.example1": "Step 1: Set Property A to value X",
  "bulkModificationGuide.pipeline.example2": "Step 2: Based on Property A's new value X, set Property B to Y",
  "bulkModificationGuide.pipeline.example3": "Step 3: Continue processing based on previous results...",
  "bulkModificationGuide.saveReuse.title": "Save & Reuse",
  "bulkModificationGuide.saveReuse.subtitle": "Your bulk modification configurations are automatically saved for future reuse.",
  "bulkModificationGuide.saveReuse.point1": "Each bulk modification configuration is automatically saved to the list.",
  "bulkModificationGuide.saveReuse.point2": "You can duplicate existing configurations to quickly create similar new ones.",
  "bulkModificationGuide.saveReuse.point3": "Enable/disable status allows you to temporarily deactivate configurations.",
  "bulkModificationGuide.saveReuse.tip": "Tip: Give your bulk modification configurations meaningful names for easy lookup and reuse.",
  "bulkModificationGuide.skip": "Skip",
  "bulkModificationGuide.previous": "Previous",
  "bulkModificationGuide.next": "Next",
  "bulkModificationGuide.getStarted": "Get Started",
  "bulkModificationGuide.action.showGuide": "View Guide",
  "BulkModification.Processor.Demonstrator.Operation.SetDirectly": "<0/>with fixed value",
  "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd": "Add <1/> to <3>{{direction}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition": "Add <1/> to the <3>{{position}}</3> position from the <5>{{direction}}</5>",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd": "Remove <1>{{count}}</1> characters from <3>{{direction}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition": "Delete <1>{{count}}</1> characters <3>{{removeDirection}}</3> the <5>{{position}}</5> character from the <7>{{direction}}</7>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd": "<0>Replace</0> <1>{{find}}</1> with <3/> from <5>{{direction}}</5>",
  "BulkModification.Processor.Demonstrator.Operation.Replace": "<0>Replace</0> <1>{{find}}</1> with <3/>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex": "Use <1>regex</1> to <3>replace</3> <4>{{find}}</4> with <6/>",
  "BulkModification.Processor.Editor.Operation.AddToAnyPosition": "Add <1/> to the <3/>(th) character from <5/>",
  "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition": "Delete <1/> characters <3/> from the <5/>(th) character from <7/>",
  "BulkModification.Processor.Editor.Operation.Replace": "Replace <1/> with <3/>",
  "bulkModification.operation.link.delete": "Delete",
  "bulkModification.operation.link.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.link.setText": "Set text",
  "bulkModification.operation.link.setUrl": "Set URL",
  "bulkModification.operation.link.modifyText": "Modify text",
  "bulkModification.operation.link.modifyUrl": "Modify URL",
  "bulkModification.operation.decimal.delete": "Delete",
  "bulkModification.operation.decimal.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.decimal.round": "Round",
  "bulkModification.operation.decimal.ceil": "Ceil",
  "bulkModification.operation.decimal.floor": "Floor",
  "bulkModification.operation.time.delete": "Delete",
  "bulkModification.operation.time.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.boolean.delete": "Delete",
  "bulkModification.operation.boolean.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.boolean.toggle": "Toggle",
  "bulkModification.operation.dateTime.delete": "Delete",
  "bulkModification.operation.dateTime.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.dateTime.setToNow": "Set to now",
  "bulkModification.operation.listTag.delete": "Delete",
  "bulkModification.operation.listTag.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.listTag.append": "Append",
  "bulkModification.operation.listTag.prepend": "Prepend",
  "bulkModification.operation.listTag.remove": "Remove",
  "bulkModification.operation.listListString.delete": "Delete",
  "bulkModification.operation.listListString.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.listListString.append": "Append",
  "bulkModification.operation.listListString.prepend": "Prepend",
  "bulkModification.operation.listListString.remove": "Remove",
  "bulkModification.operation.string.delete": "Delete",
  "bulkModification.operation.string.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.string.addToStart": "Add to start",
  "bulkModification.operation.string.addToEnd": "Add to end",
  "bulkModification.operation.string.addToAnyPosition": "Add to any position",
  "bulkModification.operation.string.removeFromStart": "Remove from start",
  "bulkModification.operation.string.removeFromEnd": "Remove from end",
  "bulkModification.operation.string.removeFromAnyPosition": "Remove from any position",
  "bulkModification.operation.string.replaceFromStart": "Replace from start",
  "bulkModification.operation.string.replaceFromEnd": "Replace from end",
  "bulkModification.operation.string.replaceFromAnyPosition": "Replace from any position",
  "bulkModification.operation.string.replaceWithRegex": "Replace with regex",
  "bulkModification.operation.listString.delete": "Delete",
  "bulkModification.operation.listString.setWithFixedValue": "Set with fixed value",
  "bulkModification.operation.listString.append": "Append",
  "bulkModification.operation.listString.prepend": "Prepend",
  "bulkModification.operation.listString.modify": "Modify",
  "bulkModification.operation.decimal.add": "Add",
  "bulkModification.operation.decimal.subtract": "Subtract",
  "bulkModification.operation.decimal.multiply": "Multiply",
  "bulkModification.operation.decimal.divide": "Divide",
  "bulkModification.operation.dateTime.addDays": "Add days",
  "bulkModification.operation.dateTime.subtractDays": "Subtract days",
  "bulkModification.operation.dateTime.addMonths": "Add months",
  "bulkModification.operation.dateTime.subtractMonths": "Subtract months",
  "bulkModification.operation.dateTime.addYears": "Add years",
  "bulkModification.operation.dateTime.subtractYears": "Subtract years",
  "bulkModification.operation.time.addHours": "Add hours",
  "bulkModification.operation.time.subtractHours": "Subtract hours",
  "bulkModification.operation.time.addMinutes": "Add minutes",
  "bulkModification.operation.time.subtractMinutes": "Subtract minutes",
  "bulkModification.operation.time.addSeconds": "Add seconds",
  "bulkModification.operation.time.subtractSeconds": "Subtract seconds",
  "bulkModification.valueType.manuallyInput": "Manually input",
  "bulkModification.valueType.variable": "Variable",
  "bulkModification.valueSource.label": "Value source",
  "bulkModification.valueType.label": "Value type",
  "bulkModification.dataSource.label": "Data source",
  "bulkModification.dataSource.clickToSelect": "Click to select property",
  "bulkModification.validation.valueRequired": "Value is required",
  "bulkModification.validation.valueAndIndexRequired": "Value and index are required",
  "bulkModification.validation.countRequired": "Count is required",
  "bulkModification.validation.countAndIndexRequired": "Count and index are required",
  "bulkModification.validation.findAndReplaceRequired": "Find and replace are required",
  "bulkModification.validation.optionsRequired": "Please provide valid options",
  "bulkModification.validation.modifyOptionsRequired": "Modify options are required",
  "bulkModification.validation.filterValueRequired": "Filter value is required",
  "bulkModification.validation.operationRequired": "Operation is required",
  "bulkModification.validation.invalidValue": "Please provide a valid value",
  "bulkModification.validation.invalidValueType": "Please provide a valid value type",
  "bulkModification.validation.invalidPropertyType": "Please provide a valid property type",
  "bulkModification.validation.invalidVariable": "Please provide a valid variable",
  "bulkModification.label.scope": "Scope",
  "bulkModification.label.scopeDescription": "A property may have multiple dimensional values, and you can choose one of the dimensions as the base data.",
  "bulkModification.label.useEditor": "Use {{editor}} editor",
  "bulkModification.label.choosePropertyValueEditor": "Choose a property value editor",
  "bulkModification.label.chooseProperty": "Choose a property",
  "bulkModification.label.noVariablesAvailable": "No variables available",
  "bulkModification.label.followPropertyChanges": "Follow property changes",
  "bulkModification.label.followPropertyChangesDescription1": "By enabling this option, data will be changed according to the changes in dynamic properties (single choice, multiple choice, multilevel data, etc.).",
  "bulkModification.label.followPropertyChangesDescription2": "For example, if you use the 'actor' from the multiple-choice data as the change result, then in the future, if you modify 'actor' to 'actor1', the current data will also be changed to 'actor1' after next time processing. However, if this option is not enabled, the current data will be changed to 'actor' after next time processing.",
  "bulkModification.label.followPropertyChangesDescription3": "For properties (such as text, numbers, dates, etc.) without reference values, there is no difference between statuses of this option.",
  "bulkModification.label.clickToSet": "Click to set",
  "bulkModification.label.notSet": "Not set",
  "bulkModification.label.amount": "Amount",
  "bulkModification.label.decimalPlaces": "Decimal places",
  "bulkModification.label.text": "Text",
  "bulkModification.label.url": "URL",
  "bulkModification.label.stringOperation": "String operation",
  "bulkModification.label.setValue": "Set value",
  "bulkModification.placeholder.inputKeyword": "Please input keyword",
  "bulkModification.placeholder.inputRegex": "Please input a regular expression"
};
const enAlias = {
  "alias.info.description": "Alias is used to replace the original text of property values in UI, such as translations, etc.",
  "alias.input.searchPlaceholder": "Press enter to search",
  "alias.action.add": "Add an alias",
  "alias.action.import": "Import",
  "alias.action.export": "Export",
  "alias.action.merge": "Merge",
  "alias.action.exit": "Exit",
  "alias.action.setAsPreferred": "Set as preferred",
  "alias.label.bulkOperations": "Bulk operations",
  "alias.label.preferred": "Preferred",
  "alias.label.candidates": "Candidates",
  "alias.label.importing": "Importing, please wait...",
  "alias.confirm.mergeTitle": "Merging alias groups: {{texts}}",
  "alias.confirm.mergeDescription": "All selected alias groups will be merged into one, and the final preferred is {{preferred}}, are you sure?",
  "alias.confirm.deleteTitle": "Deleting alias groups: {{texts}}",
  "alias.confirm.deleteDescription": "All selected alias groups and its candidates will be delete and there is no way back, are you sure?",
  "alias.confirm.deleteSingle": "Deleting an alias",
  "alias.confirm.weAreDeleting": "We are deleting",
  "alias.confirm.noWayBack": "There is no way back, are you sure?",
  "alias.tip.preferredText": "{{text}} will be the preferred text in merged groups, you can change the preferred text by clicking the text."
};
const enCustomProperty = {
  "customProperty.action.checkTypeConversionRules": "Check type conversion rules",
  "customProperty.action.adjustDisplayOrders": "Adjust display orders"
};
const enBackgroundTask = {
  "backgroundTask.column.name": "Name",
  "backgroundTask.column.status": "Status",
  "backgroundTask.column.progress": "Progress",
  "backgroundTask.column.startedAt": "Started At",
  "backgroundTask.column.interval": "Interval",
  "backgroundTask.column.nextTimeStartAt": "Next time start at",
  "backgroundTask.column.elapsed": "Elapsed",
  "backgroundTask.column.enableAfter": "Enable after",
  "backgroundTask.label.notSupported": "Not supported",
  "backgroundTask.label.notSet": "Not set",
  "backgroundTask.label.willStartAt": "Will start at",
  "backgroundTask.status.notStarted": "Not Started",
  "backgroundTask.status.running": "Running",
  "backgroundTask.status.paused": "Paused",
  "backgroundTask.status.error": "Error",
  "backgroundTask.status.completed": "Completed",
  "backgroundTask.status.cancelled": "Cancelled"
};
const enCache = {
  "cache.label.resourceCount": "Resource count",
  "cache.label.cached": "Cached",
  "cache.label.unassociatedResources": "Unassociated Resources",
  "cache.resourceCacheType.covers": "Covers",
  "cache.resourceCacheType.playablefiles": "Playable Files",
  "cache.resourceCacheType.resourcemarkers": "Resource Markers"
};
const enFileNameModifier = {
  "FileNameModifier.OperationsList": "Operations List",
  "FileNameModifier.EmptyOperationsHint": "No operations yet, click the button below to add your first operation",
  "FileNameModifier.AddFirstOperation": "Add First Operation",
  "FileNameModifier.AddOperation": "Add Operation",
  "FileNameModifier.ExecuteModification": "Execute Modification",
  "FileNameModifier.RestoreOriginalPaths": "Restore Original Paths",
  "FileNameModifier.EditFileList": "Edit File List",
  "FileNameModifier.PreviewResults": "Preview Results",
  "FileNameModifier.HideFullPaths": "Hide Full Paths",
  "FileNameModifier.ShowFullPaths": "Show Full Paths",
  "FileNameModifier.FilePathsTextarea": "File Paths Input",
  "FileNameModifier.FilePathsPlaceholder": "Enter file paths, one per line",
  "FileNameModifier.ConfirmPaths": "Confirm Paths",
  "FileNameModifier.Deduplicate": "Deduplicate",
  "FileNameModifier.Cancel": "Cancel",
  "FileNameModifier.Loading": "Loading...",
  "FileNameModifier.NoPreviewResults": "No preview results",
  "FileNameModifier.PreviewFailed": "Preview failed",
  "FileNameModifier.ModificationResult": "Modification Result",
  "FileNameModifier.ModificationSuccessCount": "Success: {{count}}",
  "FileNameModifier.ModificationFailCount": "Failed: {{count}}",
  "FileNameModifier.ModificationFailList": "Failed List",
  "FileNameModifier.ModificationFailReason": "Reason",
  "FileNameModifier.ModificationFailed": "Modification failed",
  "FileNameModifier.Target.FileName": "Full File Name",
  "FileNameModifier.Target.FileNameWithoutExtension": "File Name Without Extension",
  "FileNameModifier.Target.Extension": "Extension (with dot)",
  "FileNameModifier.Target.ExtensionWithoutDot": "Extension (without dot)",
  "FileNameModifier.TargetTypePlaceholder": "Select target type",
  "FileNameModifier.OperationType.Insert": "Insert",
  "FileNameModifier.OperationType.AddDateTime": "Add Date Time",
  "FileNameModifier.OperationType.Delete": "Delete",
  "FileNameModifier.OperationType.Replace": "Replace",
  "FileNameModifier.OperationType.ChangeCase": "Change Case",
  "FileNameModifier.OperationType.AddAlphabetSequence": "Add Alphabet Sequence",
  "FileNameModifier.OperationType.Reverse": "Reverse",
  "FileNameModifier.OperationTypePlaceholder": "Select operation type",
  "FileNameModifier.PositionType.Start": "Start",
  "FileNameModifier.PositionType.End": "End",
  "FileNameModifier.PositionType.AtPosition": "At Position",
  "FileNameModifier.PositionType.AfterText": "After Text",
  "FileNameModifier.PositionType.BeforeText": "Before Text",
  "FileNameModifier.CaseType.TitleCase": "Title Case",
  "FileNameModifier.CaseType.UpperCase": "Upper Case",
  "FileNameModifier.CaseType.LowerCase": "Lower Case",
  "FileNameModifier.CaseType.CamelCase": "camelCase",
  "FileNameModifier.CaseType.PascalCase": "PascalCase",
  "FileNameModifier.Label.Text": "Text",
  "FileNameModifier.Label.TargetText": "Target Text",
  "FileNameModifier.Label.PositionType": "Position Type",
  "FileNameModifier.Label.PositionIndex": "Position Index",
  "FileNameModifier.Label.DateTimeFormat": "Date Time Format",
  "FileNameModifier.Label.DeleteCount": "Delete Count",
  "FileNameModifier.Label.DeleteStartPosition": "Delete Start Position",
  "FileNameModifier.Label.MatchText": "Match Text",
  "FileNameModifier.Label.CaseType": "Case Type",
  "FileNameModifier.Label.StartChar": "Start Char",
  "FileNameModifier.Label.Count": "Count",
  "FileNameModifier.Placeholder.Text": "Enter text to insert",
  "FileNameModifier.Placeholder.TargetText": "Enter target text",
  "FileNameModifier.Placeholder.PositionType": "Select position type",
  "FileNameModifier.Placeholder.PositionIndex": "Enter position index",
  "FileNameModifier.Placeholder.DateTimeFormat": "e.g. yyyy-MM-dd",
  "FileNameModifier.Placeholder.DeleteCount": "Enter count",
  "FileNameModifier.Placeholder.DeleteStartPosition": "Enter start position",
  "FileNameModifier.Placeholder.MatchText": "Enter match text",
  "FileNameModifier.Placeholder.CaseType": "Select case type",
  "FileNameModifier.Placeholder.StartChar": "e.g. A",
  "FileNameModifier.Placeholder.Count": "Enter count",
  "FileNameModifier.UseRegex": "Use Regex",
  "FileNameModifier.ReplaceEntire": "Replace Entire",
  "FileNameModifier.Error.NoValidOperation": "No valid operation",
  "FileNameModifier.Error.TargetRequired": "Please select target type",
  "FileNameModifier.Error.OperationTypeRequired": "Please select operation type",
  "FileNameModifier.Error.TextRequired": "Please enter text",
  "FileNameModifier.Error.TargetTextRequired": "Please enter target text",
  "FileNameModifier.Error.PositionRequired": "Please select position type",
  "FileNameModifier.Error.PositionIndexRequired": "Please enter position index",
  "FileNameModifier.Error.DateTimeFormatRequired": "Please enter date time format",
  "FileNameModifier.Error.DeleteCountRequired": "Please enter delete count",
  "FileNameModifier.Error.DeleteStartPositionRequired": "Please enter delete start position",
  "FileNameModifier.Error.CaseTypeRequired": "Please select case type",
  "FileNameModifier.Error.AlphabetStartCharRequired": "Please enter start character",
  "FileNameModifier.Error.AlphabetCountRequired": "Please enter alphabet count"
};
const enFileMover = {
  "fileMover.status.enabled": "Enabled",
  "fileMover.status.disabled": "Disabled",
  "fileMover.label.delay": "Delay",
  "fileMover.tip.delay": "Files or directories will be moved after the delayed time from the time they are created here. The delay is working for the first layer entries only.",
  "fileMover.label.sources": "Sources",
  "fileMover.action.addSource": "Add source",
  "fileMover.action.addTarget": "Add target path",
  "fileMover.empty.noSources": "No sources configured",
  "fileMover.label.overwrite": "Overwrite",
  "fileMover.tip.overwrite": "Overwrite files in target path"
};
const enLog = {
  "log.filter.time": "Time",
  "log.filter.level": "Level",
  "log.filter.all": "All",
  "log.filter.logger": "Logger",
  "log.filter.event": "Event",
  "log.filter.message": "Message",
  "log.action.clearAll": "Clear all",
  "log.label.log": "Log",
  "log.action.expand": "Expand",
  "log.label.fullMessage": "Full Message"
};
const enPlayHistory = {
  "playHistory.label.playedAt": "Played at",
  "playHistory.label.item": "Item",
  "playHistory.empty.noHistory": "No play history"
};
const enWelcome = {
  "welcome.info.termsNotice": "Please read terms and conditions carefully before you start to use this app",
  "welcome.action.clickToCheck": "Click to check",
  "welcome.info.clarityNotice": "We are using Microsoft Clarity to track anonymous data, which will help us to improve our product experience.",
  "welcome.action.acceptAndStart": "Accept and start to use"
};
const enThirdParty = {};
const enThirdPartyIntegration = {
  "thirdPartyIntegration.label.tampermonkeyScript": "Tampermonkey script",
  "thirdPartyIntegration.action.oneClickInstall": "One-click installation",
  "thirdPartyIntegration.tip.scriptModifies": "This script modifies some interactive behaviors of the target website. You can manually enable or disable the script in Tampermonkey.",
  "thirdPartyIntegration.tip.soulPlusClick": "Left-clicking on covers or post titles will trigger the creation of a post parsing task on Bakabase. You can still use the middle button to open posts.",
  "thirdPartyIntegration.tip.exHentaiClick": "Left-clicking on covers will trigger the creation of a torrent download task on Bakabase. You can still use the middle button to open posts."
};
const enThirdPartyConfiguration = {
  "thirdPartyConfig.success.saved": "Saved",
  "thirdPartyConfig.label.cookie": "Cookie",
  "thirdPartyConfig.label.maxConcurrency": "Max Concurrency",
  "thirdPartyConfig.label.requestInterval": "Request Interval (ms)",
  "thirdPartyConfig.label.defaultPath": "Default Path",
  "thirdPartyConfig.label.namingConvention": "Naming Convention",
  "thirdPartyConfig.label.maxRetries": "Max Retries",
  "thirdPartyConfig.label.requestTimeout": "Request Timeout (ms)",
  "thirdPartyConfig.label.autoBuyThreshold": "Auto Buy Threshold",
  "thirdPartyConfig.label.userAgent": "User Agent",
  "thirdPartyConfig.label.referer": "Referer",
  "thirdPartyConfig.label.apiKey": "API Key",
  "thirdPartyConfig.action.save": "Save",
  "thirdPartyConfig.action.validateCookie": "Validate cookie",
  "thirdPartyConfig.error.invalidCookie": "Invalid cookie",
  "thirdPartyConfig.success.cookieValid": "Cookie is good",
  "thirdPartyConfig.tip.bilibili": "Configure Bilibili downloader settings including cookie authentication and download parameters.",
  "thirdPartyConfig.tip.exhentai": "Configure ExHentai downloader settings. Cookie is required for authentication.",
  "thirdPartyConfig.tip.pixiv": "Configure Pixiv downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.soulplus": "Configure SoulPlus settings including cookie authentication and auto-buy threshold.",
  "thirdPartyConfig.tip.bangumi": "Configure Bangumi settings including request parameters and authentication.",
  "thirdPartyConfig.tip.cien": "Configure Cien downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.dlsite": "Configure DLsite downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.fanbox": "Configure Fanbox downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.fantia": "Configure Fantia downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.patreon": "Configure Patreon downloader settings including authentication and download parameters.",
  "thirdPartyConfig.tip.tmdb": "Configure TMDB (The Movie Database) settings including API key and request parameters."
};
const enExtensionGroup = {
  "extensionGroup.action.editGroup": "Editing extension group",
  "extensionGroup.action.addGroup": "Add a group",
  "extensionGroup.label.extensions": "Extensions",
  "extensionGroup.input.separatePlaceholder": "Separate by space or newline",
  "extensionGroup.confirm.deleteTitle": "Sure to delete?",
  "extensionGroup.select.label": "Limit file extension groups",
  "extensionGroup.select.placeholder": "Select from extension groups"
};
const enText = {
  "text.label.appliedTo": "Applied to",
  "text.label.texts": "Texts",
  "text.label.opt": "Opt",
  "text.label.original": "Original",
  "text.label.pretreated": "Pretreated",
  "text.action.addPrefabs": "Add prefabs",
  "text.label.pretreatmentTest": "Pretreatment test",
  "text.input.enterText": "Enter text",
  "text.action.runPretreatment": "Run pretreatment",
  "text.label.noChanges": "No changes",
  "text.confirm.deleteTitle": "Sure to delete?",
  "SpecialTextType.Useless": "Useless",
  "SpecialTextType.Language": "Language",
  "SpecialTextType.Wrapper": "Wrapper",
  "SpecialTextType.Standardization": "Standardization",
  "SpecialTextType.Volume": "Volume",
  "SpecialTextType.Trim": "Trim",
  "SpecialTextType.DateTime": "DateTime",
  "text.typeDescription.useless": "Ignore the part inside the wrapper that is successfully matched by the regular expression",
  "text.typeDescription.language": "Text will be parsed as [specific language] if it surrounded by [wrappers]",
  "text.typeDescription.wrapper": "Text wrapper, used to match and extract the text within the wrapper",
  "text.typeDescription.standardization": "Treat [text1] as [text2] during analyzation",
  "text.typeDescription.volume": "Extract volume information from this text group",
  "text.typeDescription.trim": "TBD, do not set it for now",
  "text.typeDescription.dateTime": "Date and time parsing template, used to extract dates and times from text",
  "text.usedIn.textPretreatment": "Text pretreatment",
  "text.usedIn.bakabaseEnhancerAnalysis": "Bakabase enhancer analysis",
  "text.usedIn.resourceDisplayNameTemplate": "Resource display name template",
  "text.usedIn.exhentaiEnhancerAnalysis": "Exhentai enhancer analysis",
  "text.usedIn.parsingOrConvertingPropertyValue": "Parsing or converting property value",
  "text.label.text": "Text",
  "text.placeholder.text": "Enter text",
  "text.label.sourceText": "Source text",
  "text.placeholder.sourceText": "Enter source text",
  "text.label.convertTo": "Convert to",
  "text.placeholder.convertTo": "Enter target text",
  "text.label.leftWrapper": "Left wrapper",
  "text.placeholder.leftWrapper": "Enter left wrapper",
  "text.label.rightWrapper": "Right wrapper",
  "text.placeholder.rightWrapper": "Enter right wrapper"
};
const enPostParser = {
  "postParser.action.addTasks": "Add tasks",
  "postParser.input.postLinks": "Post links in {{source}}",
  "postParser.tip.otherSitesSupport": "Support for other sites",
  "postParser.action.configuration": "Configuration",
  "postParser.label.automaticallyParsing": "Automatically parsing",
  "postParser.action.instructions": "Instructions for use",
  "postParser.tip.curlVersion": "This feature internally uses curl. If your system-level curl version is lower than 8.14, please configure the correct curl path in the system settings.",
  "postParser.tip.requestInterval": "The request interval configuration is temporarily unavailable. The built-in default interval is 3 seconds.",
  "postParser.label.curl": "curl",
  "postParser.tip.ollamaRequired": "This feature internally uses Ollama. You need to install and run Ollama first, and install at least one model. Then configure the Ollama API address in the system settings.",
  "postParser.tip.ollamaModel": "This feature will prioritize the largest model in the Ollama model list.",
  "postParser.tip.ollamaTested": "Currently, deepseek-r1:14b and 32b have been tested and can be used safely.",
  "postParser.label.ollama": "ollama",
  "postParser.tip.browserIntegration": 'Some sites can integrate quick actions through the browser (such as one-click task creation). You can check the "Third-Party Integrations" section.',
  "postParser.label.browserIntegrations": "browser integrations",
  "postParser.table.id": "#",
  "postParser.table.target": "Target",
  "postParser.table.items": "Items",
  "postParser.table.parsedAt": "ParsedAt",
  "postParser.label.accessCode": "Access code",
  "postParser.label.decompressionPassword": "Decompression password"
};
const enPathMarks = {
  "pathMarks.title": "Path Marks",
  "pathMarks.label.beta": "Beta",
  "pathMarks.tip.description": "View and manage all path marks across your media libraries. Click on a path to edit marks in the config page.",
  "pathMarks.warning.invalidPaths": "{{count}} path(s) no longer exist on the file system",
  "pathMarks.label.showOnlyInvalid": "Show only invalid",
  "pathMarks.success.markUpdated": "Mark updated successfully",
  "pathMarks.success.markAdded": "Mark added successfully",
  "pathMarks.error.saveMark": "Failed to save mark",
  "pathMarks.confirm.deleteTitle": "Confirm Delete Mark",
  "pathMarks.confirm.deleteQuestion": "Are you sure you want to delete this mark?",
  "pathMarks.success.markDeleted": "Mark deleted successfully",
  "pathMarks.error.deleteMark": "Failed to delete mark",
  "pathMarks.warning.noMarksToDelete": "No marks to delete",
  "pathMarks.success.deletedCount": "Deleted {{count}} mark(s) successfully",
  "pathMarks.error.deleteMarks": "Failed to delete marks",
  "pathMarks.success.pastedCount": "Pasted {{count}} marks successfully",
  "pathMarks.error.pasteMarks": "Failed to paste marks",
  "pathMarks.modal.confirmDeleteTitle": "Confirm Delete Marks",
  "pathMarks.modal.transferMarksTitle": "Transfer Marks",
  "pathMarks.modal.confirmTransferTitle": "Confirm Transfer",
  "pathMarks.modal.configurePathMarksTitle": "Configure Path Marks",
  "pathMarks.label.mainPath": "Main Path",
  "pathMarks.label.invalid": "Invalid",
  "pathMarks.label.resourceMark": "Resource Mark",
  "pathMarks.label.propertyMark": "Property Mark",
  "pathMarks.label.mediaLibraryMark": "MediaLibrary Mark",
  "pathMarks.tip.clickToCopyFullPath": "Click to copy full path",
  "pathMarks.tip.clickOnFoldersToNavigate": "Click on folders to navigate. Use the Add Mark button or right-click for mark options.",
  "pathMarks.tip.copyMarksFromThisPath": "Copy marks from this path",
  "pathMarks.tip.configureSubPathMarks": "Configure sub-path marks",
  "pathMarks.tip.syncAllMarksOnThisPath": "Sync all marks on this path",
  "pathMarks.tip.deleteAllMarksOnThisPath": "Delete all marks on this path",
  "pathMarks.tip.transferMarksToThisPath": "Transfer marks to this path",
  "pathMarks.tip.browseAndClickTransfer": 'Browse and click "Transfer here" to select destination path',
  "pathMarks.status.aboutToDeleteMarks": "You are about to delete {{count}} mark(s)",
  "pathMarks.status.aboutToTransferMarks": "You are about to transfer {{count}} mark(s)",
  "pathMarks.status.transferredSuccessfully": "Transferred {{count}} mark(s) successfully",
  "pathMarks.action.transfer": "Transfer",
  "pathMarks.action.confirmTransfer": "Confirm Transfer",
  "pathMarks.action.confirmSelection": "Confirm selection",
  "pathMarks.action.transferHere": "Transfer here",
  "pathMarks.action.pasteMarks": "Paste {{count}} marks",
  "pathMarks.action.pasteMarksWithExisting": "Paste {{count}} marks ({{existing}} already exist)",
  "pathMarks.checkbox.alsoDeleteChildMarks": "Also delete {{count}} mark(s) from {{pathCount}} child path(s)",
  "pathMarks.checkbox.includeChildPaths": "Include {{count}} child path(s) with marks",
  "pathMarks.checkbox.childPathsAvailableForTransfer": "+ {{count}} child path(s) with marks will also be available for transfer",
  "pathMarks.warning.cannotBeUndone": "This action cannot be undone.",
  "pathMarks.warning.cannotTransferToSamePath": "Cannot transfer to the same path",
  "pathMarks.error.failedToTransfer": "Failed to transfer marks",
  "pathMarks.error.failedToStartSync": "Failed to start sync",
  "pathMarks.success.pathCopied": "Path copied to clipboard",
  "pathMarks.success.syncStarted": "Sync started",
  "pathMarks.empty.noPathMarks": "No path marks found",
  "pathMarks.empty.goToConfigPage": "Go to path mark config page to add marks",
  "pathMarks.info.transferringFrom": "Transferring marks from:",
  "pathMarks.info.transferTo": "Transfer to:",
  "pathMarks.action.configureMarks": "Configure Marks",
  "pathMarks.label.resourceProfileHint": "Next step: Configure Resource Profiles to define enhancers, players, and other resource processing settings",
  "pathMarks.action.goToResourceProfile": "Configure Resource Profiles"
};
const enPathMarkConfig = {
  "pathMarkConfig.title": "Configure Your Media Library",
  "pathMarkConfig.label.beta": "Beta",
  "pathMarkConfig.tip.description": "Use this tool to configure path marks for your media library. Path marks help organize and categorize your content.",
  "pathMarkConfig.tip.pathMemory": "Edit the path in the address bar, press Enter after selecting a directory, or right-click to enter a directory - the system will remember your last location and use it as the default next time.",
  "pathMarkConfig.action.pendingSync": "Pending Sync",
  "pathMarkConfig.modal.settingsTitle": "Path Marks Settings",
  "pathMarkConfig.modal.enableSyncImmediatelyTitle": "Enable Sync Immediately",
  "pathMarkConfig.label.syncImmediately": "Sync immediately",
  "pathMarkConfig.tip.syncImmediately": "When enabled, marks will be synced immediately after being set.",
  "pathMarkConfig.warning.syncDataNote": "Note: If there is a lot of data, synchronization may take several minutes.",
  "pathMarkConfig.action.enable": "Enable",
  "pathMarkConfig.error.updateOption": "Failed to update option",
  "pathMarkConfig.status.pending": "Pending",
  "pathMarkConfig.status.syncing": "Syncing...",
  "pathMarkConfig.status.synced": "Synced",
  "pathMarkConfig.status.failed": "Failed",
  "pathMarkConfig.status.pendingDelete": "Pending Delete",
  "pathMarkConfig.status.unknown": "Unknown",
  "pathMarkConfig.status.allSynced": "All marks are synced!",
  "pathMarkConfig.modal.pendingSyncMarks": "Pending Sync Marks",
  "pathMarkConfig.action.syncAll": "Sync All",
  "pathMarkConfig.action.syncNow": "Sync Now",
  "pathMarkConfig.success.syncStarted": "Sync started",
  "pathMarkConfig.error.syncFailed": "Failed to start sync",
  "pathMarkConfig.label.enableExpiration": "Scheduled Sync",
  "pathMarkConfig.label.scheduledSync": "Scheduled Sync",
  "pathMarkConfig.tip.expirationDescription": "After sync completes, the mark will be re-synced after the specified time. If set too short, it may cause frequent re-syncing and affect performance.",
  "pathMarkConfig.label.scrollForMore": "Scroll for more",
  "pathMarkConfig.label.pathCount": "{{count}} paths",
  "Edit <type></type> Mark": "Edit <type></type> Mark",
  "Add <type></type> Mark": "Add <type></type> Mark",
  "pathMarkConfig.modal.syncProgress": "Synchronizing Marks",
  "pathMarkConfig.label.progress": "Progress",
  "pathMarkConfig.label.currentlySyncing": "Currently syncing",
  "pathMarkConfig.label.error": "Error",
  "pathMarkConfig.status.paused": "Synchronization paused",
  "pathMarkConfig.status.cancelled": "Synchronization cancelled",
  "pathMarkConfig.status.completed": "Synchronization completed!",
  "pathMarkConfig.label.resources": "Resources",
  "pathMarkConfig.label.properties": "Properties",
  "pathMarkConfig.action.pause": "Pause",
  "pathMarkConfig.action.stop": "Stop",
  "pathMarkConfig.action.resume": "Resume",
  "pathMarkConfig.success.markUpdated": "Mark updated successfully",
  "pathMarkConfig.success.markAdded": "Mark added successfully",
  "pathMarkConfig.error.saveMark": "Failed to save mark",
  "pathMarkConfig.confirm.deleteMarkTitle": "Confirm Delete Mark",
  "pathMarkConfig.confirm.deleteMarkQuestion": "Are you sure you want to delete this mark?",
  "pathMarkConfig.success.markDeleted": "Mark deleted successfully",
  "pathMarkConfig.error.deleteMark": "Failed to delete mark",
  "pathMarkConfig.success.markAddedToCount": "Mark added successfully to {{count}} paths",
  "pathMarkConfig.error.addMarks": "Failed to add marks",
  "pathMarkConfig.success.pastedCount": "Pasted {{count}} marks successfully",
  "pathMarkConfig.error.pasteMarks": "Failed to paste marks",
  "pathMarkConfig.action.addResourceMark": "Add Resource Mark ({{count}} paths)",
  "pathMarkConfig.action.addPropertyMark": "Add Property Mark ({{count}} paths)",
  "pathMarkConfig.action.addMediaLibraryMark": "Add MediaLibrary Mark ({{count}} paths)",
  "pathMarkConfig.action.copyMarks": "Copy marks from this path",
  "pathMarkConfig.action.addMark": "Add Mark",
  "pathMarkConfig.action.copy": "Copy marks",
  "pathMarkConfig.action.confirmSelection": "Confirm selection",
  "pathMarkConfig.action.pasteMarks": "Paste {{count}} marks",
  "pathMarkConfig.tip.marksAlreadyExist": "{{count}} marks already exist",
  "pathMarkConfig.label.copiedMarks": "Copied marks",
  "pathMarkConfig.empty.noCopiedMarks": "No copied marks",
  "pathMarkConfig.tip.selectMarksToCopy": "Select marks to copy from an entry",
  "pathMarkConfig.label.matchMode": "Match Mode",
  "pathMarkConfig.label.layer": "Layer",
  "pathMarkConfig.label.regex": "Regex",
  "pathMarkConfig.label.regexPattern": "Regex Pattern",
  "pathMarkConfig.label.applyScope": "Apply Scope",
  "pathMarkConfig.label.matchedOnly": "Matched Only",
  "pathMarkConfig.label.matchedAndSubdirectories": "Matched and Subdirectories",
  "pathMarkConfig.status.loadingPreview": "Loading preview...",
  "pathMarkConfig.warning.noMatches": "No matches found. Please check your configuration.",
  "pathMarkConfig.label.andAllSubdirectories": "and all subdirectories",
  "pathMarkConfig.label.propertyValue": "Property Value",
  "pathMarkConfig.label.previewMatches": "Preview matches",
  "pathMarkConfig.label.resourceFilters": "Resource Filters (Optional)",
  "pathMarkConfig.label.fileTypeFilter": "File Type Filter",
  "pathMarkConfig.label.limitExtensions": "Limit file extensions",
  "pathMarkConfig.label.propertySettings": "Property Settings",
  "pathMarkConfig.label.targetProperty": "Target Property",
  "pathMarkConfig.empty.noPropertySelected": "No property selected",
  "pathMarkConfig.action.selectProperty": "Select Property",
  "pathMarkConfig.label.valueType": "Value Type",
  "pathMarkConfig.label.fixed": "Fixed",
  "pathMarkConfig.label.dynamic": "Dynamic",
  "pathMarkConfig.label.fixedValue": "Fixed Value",
  "pathMarkConfig.label.valueExtractionMode": "Value Extraction Mode",
  "pathMarkConfig.label.valueLayer": "Value Layer",
  "pathMarkConfig.tip.zeroEqualsMatchedItem": "0 = matched item",
  "pathMarkConfig.label.valueRegex": "Value Regex",
  "pathMarkConfig.tip.regexExample": "e.g., \\\\[(.+?)\\\\]",
  "pathMarkConfig.label.mediaLibrarySettings": "Media Library Settings",
  "pathMarkConfig.label.targetMediaLibrary": "Target Media Library",
  "pathMarkConfig.empty.noMediaLibrarySelected": "No media library selected",
  "pathMarkConfig.action.selectMediaLibrary": "Select Media Library",
  "pathMarkConfig.tip.fixedMediaLibraryDescription": "Resources matched by this mark will be associated with the selected media library.",
  "pathMarkConfig.tip.dynamicMediaLibraryDescription": "Extract the media library name from the path. If the media library does not exist, it will be created automatically.",
  "pathMarkConfig.label.layerToMediaLibrary": "Layer to Media Library",
  "pathMarkConfig.tip.layerToMediaLibraryDescription": "Which layer's directory name to use as media library name. 0 = matched item, 1 = parent, etc.",
  "pathMarkConfig.label.regexToMediaLibrary": "Regex to Media Library (Optional)",
  "pathMarkConfig.tip.regexToMediaLibraryDescription": "Optional regex to extract media library name. Uses first capture group or full match.",
  "pathMark.resource.explanation": "Resource marks identify file system entries (files or directories) that should be treated as resources in your media library.",
  "pathMark.resource.isResourceBoundary": "Set as Resource Boundary",
  "pathMark.resource.isResourceBoundary.description": "When enabled, this mark defines a boundary for resource detection. Child entries won't inherit this mark's resource configuration.",
  "pathMark.layer.description": "0 = Root path, 1 = First child level, etc. The layer defines which directory depth to match.",
  "pathMark.regex.description": "Regular expression pattern to match against the relative path from root.",
  "pathMark.applyScope.matchedOnly.description": "Only apply to the exact matched path",
  "pathMark.applyScope.matchedAndSubdirectories.description": "Apply to matched path and all paths inside it",
  "pathMark.resource.matchMode.description": "You can expand from the currently selected path. If you only want to select the current path, use layer=0.",
  "pathMark.resource.applyScope.matchedOnly.description": "Only treat as a resource when the resource path exactly matches the configured pattern.",
  "pathMark.resource.applyScope.matchedAndSubdirectories.description": "Treat as a resource when the resource path exactly matches the configured pattern, or is any file or folder within the match.",
  "pathMark.property.matchMode.description": "You can expand from the currently selected path. If you only want to select the current path, use layer=0.",
  "pathMark.property.applyScope.matchedOnly.description": "Only set the configured property and value when the resource path exactly matches the configured pattern.",
  "pathMark.property.applyScope.matchedAndSubdirectories.description": "Set the configured property and value when the resource path exactly matches the configured pattern, or is a file or folder within the match.",
  "pathMark.property.configDescription": "Choose which property to bind to a matched resource, and what value to set.",
  "pathMark.mediaLibrary.matchMode.description": "You can expand from the currently selected path. If you only want to select the current path, use layer=0.",
  "pathMark.mediaLibrary.applyScope.matchedOnly.description": "Only associate the resource with the configured media library when the resource path exactly matches the configured pattern.",
  "pathMark.mediaLibrary.applyScope.matchedAndSubdirectories.description": "Associate the resource with the configured media library when the resource path exactly matches the configured pattern, or is a file or folder within the match.",
  "pathMark.mediaLibrary.configDescription": "Choose which media library to bind a matched resource to.",
  "pathMark.priority.description": "Lower values are processed first. Use to control mark application order when multiple marks match.",
  "pathMark.property.explanation": "Property Mark: Add property values (like tags, categories) to resources.",
  "pathMark.property.settingsDescription": "Select a property and set where its value comes from.",
  "pathMark.property.importantNote": "Property marks don't create resources. Only resources whose paths match a Resource Mark will receive property values.",
  "pathMark.mediaLibrary.explanation": "Media Library Mark: Categorize resources into a specific media library.",
  "pathMark.mediaLibrary.settingsDescription": "Select a target library, or extract it from the path automatically.",
  "pathMark.mediaLibrary.importantNote": "Media library marks don't create resources. Only resources whose paths match a Resource Mark will be linked to the media library.",
  "markDescription.layer.currentAndSubdirs": "This layer + subdirs",
  "markDescription.layer.current": "This layer",
  "markDescription.layer.suffix": " layer",
  "markDescription.andSubdirs": " + subdirs",
  "markDescription.regex": "Regex: {{regex}}",
  "markDescription.valueLayer.current": "=this layer",
  "markDescription.valueFrom": "=",
  "markDescription.valueRegex": "=regex({{regex}})",
  "markDescription.mediaLibraryLayer.current": "→this layer",
  "markDescription.mediaLibraryFrom": "→",
  "markDescription.mediaLibraryRegex": "→regex({{regex}})",
  "markDescription.fileOnly": "Files only",
  "markDescription.dirOnly": "Dirs only",
  "markDescription.empty": "No description",
  "markDescription.invalid": "Invalid config",
  "pathMarkConfig.tip.clickToEditRightClickDelete": "Click to edit, right-click to delete",
  "pathMarkConfig.status.syncProgress": "Syncing: {{progress}}%",
  "pathMarkConfig.tip.recheckAfter": "Re-check after",
  "pathMarkConfig.action.viewAllMarks": "View All Marks",
  "pathMarkGuide.welcome.title": "Welcome to Path Marks",
  "pathMarkGuide.welcome.description": "Path Marks help you organize your media library by defining rules on file paths. You can specify which files are resources, assign properties, and associate them with media libraries.",
  "pathMarkGuide.markTypes.title": "Three Types of Marks",
  "pathMarkGuide.markTypes.subtitle": "Each mark type serves a different purpose in organizing your content.",
  "pathMarkGuide.markTypes.resource": "Resource Mark (Core)",
  "pathMarkGuide.markTypes.resourceDesc": "Identifies files or folders as resources in your library. Use layer or regex to match paths.",
  "pathMarkGuide.markTypes.resourceImportant": "Resource Mark is the foundation - only after setting it up can you view and manage your resources on the Resource page. Without it, the system won't know which files to track.",
  "pathMarkGuide.markTypes.property": "Property Mark",
  "pathMarkGuide.markTypes.propertyDesc": "Assigns property values (like tags, categories) to matched resources automatically.",
  "pathMarkGuide.markTypes.mediaLibrary": "Media Library Mark",
  "pathMarkGuide.markTypes.mediaLibraryDesc": "Associates resources with a specific media library for better organization.",
  "pathMarkGuide.configure.title": "How to Configure",
  "pathMarkGuide.configure.subtitle": "Follow these steps to set up your path marks.",
  "pathMarkGuide.configure.step1": "Navigate to a folder in the file tree and select it.",
  "pathMarkGuide.configure.step2": "Right-click or use the Add Mark button to create marks.",
  "pathMarkGuide.configure.step3": "Configure the matching rules and preview the affected paths.",
  "pathMarkGuide.sync.title": "Sync & Management",
  "pathMarkGuide.sync.subtitle": "Marks need to be synced to generate actual data.",
  "pathMarkGuide.sync.explanation": "Creating marks alone doesn't immediately create resources. Syncing is the process that reads your marks and generates the corresponding data (resources, properties, library associations).",
  "pathMarkGuide.sync.point1": "By default, auto-sync is enabled and will run automatically after marks change. You can disable auto-sync in settings if needed.",
  "pathMarkGuide.sync.point2": 'If auto-sync is disabled, use the "Pending Sync" button to manually trigger synchronization.',
  "pathMarkGuide.skip": "Skip",
  "pathMarkGuide.previous": "Previous",
  "pathMarkGuide.next": "Next",
  "pathMarkGuide.getStarted": "Get Started",
  "pathMarkConfig.label.nextStepHint": "Next step: View all configured marks, or configure Resource Profiles to define enhancers, players, and other settings",
  "pathMarkConfig.action.goToResourceProfile": "Configure Resource Profiles",
  "pathMarkConfig.label.keepResourcesOnPathChange": "Keep resource identity on path change",
  "pathMarkConfig.tip.keepResourcesOnPathChange": "Normally, a resource record is created for each resource path. When enabled, a marker file (bakabase.json) will be generated in resource folders. During the next sync, if the resource path has changed, the system will not create a new resource record for the new path. Instead, it will use the marker file to locate the original resource record and update its path."
};
const enComparison = {
  "comparison.action.createPlan": "Create Plan",
  "comparison.action.editPlan": "Edit Plan",
  "comparison.action.delete": "Delete",
  "comparison.action.duplicate": "Duplicate",
  "comparison.action.execute": "Execute",
  "comparison.action.reExecute": "Re-execute",
  "comparison.action.viewResults": "View Results",
  "comparison.action.viewGroups": "View {{count}} groups",
  "comparison.action.clearResults": "Clear Results",
  "comparison.action.edit": "Edit",
  "comparison.action.editRules": "Configure Rules",
  "comparison.action.editFilters": "Configure Filters",
  "comparison.action.addRule": "Add Rule",
  "comparison.action.editRule": "Edit Rule",
  "comparison.action.selectProperty": "Select Property",
  "comparison.action.configureSpecialText": "Configure special text rules",
  "comparison.action.hideGroup": "Hide this group",
  "comparison.action.unhideGroup": "Unhide this group",
  "comparison.action.viewNetworkGraph": "View relationship graph",
  "comparison.confirm.navigateToSpecialText": "You are about to leave this page and navigate to the Special Text configuration page. Any unsaved changes will be lost. Do you want to continue?",
  "comparison.confirm.delete": 'Are you sure you want to delete the plan "{{name}}"?',
  "comparison.confirm.clearResults": 'Are you sure you want to clear all results for "{{name}}"?',
  "comparison.success.duplicated": "Plan duplicated successfully",
  "comparison.success.taskStarted": "Comparison task started",
  "comparison.success.resultsCleared": "Results cleared successfully",
  "comparison.error.taskFailed": "Failed to start comparison task",
  "comparison.error.nameRequired": "Name is required",
  "comparison.error.rulesRequired": "At least one rule is required",
  "comparison.error.propertyRequired": "All rules must have a property selected",
  "comparison.empty.noPlans": "No comparison plans",
  "comparison.empty.description": "Create a comparison plan to find duplicate or similar resources",
  "comparison.empty.noRules": "No rules defined. Add at least one rule.",
  "comparison.empty.noFilters": "No filters configured (will compare all resources)",
  "comparison.empty.noResults": "No comparison results found",
  "comparison.empty.noResources": "No resources in this group",
  "comparison.label.planCount": "Total plans",
  "comparison.label.ruleCount": "{{count}} rules",
  "comparison.label.resultGroups": "{{count}} groups found",
  "comparison.label.noResultsFound": "No duplicates",
  "comparison.label.threshold": "Weight Threshold",
  "comparison.label.createdAt": "Created at",
  "comparison.label.lastRun": "Last run",
  "comparison.label.rules": "Rules",
  "comparison.label.rule": "Rule",
  "comparison.label.name": "Name",
  "comparison.label.property": "Property",
  "comparison.label.propertyPool": "Property Pool",
  "comparison.label.propertyId": "Property ID",
  "comparison.label.mode": "Comparison Mode",
  "comparison.label.normalize": "Normalize Text",
  "comparison.label.weight": "Weight",
  "comparison.label.isVeto": "Is Veto Rule",
  "comparison.label.vetoThreshold": "Veto Threshold",
  "comparison.label.oneNullBehavior": "One Null Behavior",
  "comparison.label.bothNullBehavior": "Both Null Behavior",
  "comparison.label.tolerance": "Tolerance",
  "comparison.label.tolerancePercent": "Tolerance Percent",
  "comparison.label.windowHours": "Window (hours)",
  "comparison.label.regexPattern": "Regex Pattern",
  "comparison.label.minMemberCount": "Min group size",
  "comparison.label.totalGroups": "Total groups",
  "comparison.label.hiddenGroups": "Hidden",
  "comparison.label.group": "Group",
  "comparison.label.resources": "resources",
  "comparison.label.resourceIds": "Resource IDs",
  "comparison.label.filters": "Filters",
  "comparison.label.includeHidden": "Include hidden groups",
  "comparison.label.primaryResource": "Primary resource (suggested to keep)",
  "comparison.hint.viewResourcesInMainPage": "You can view these resources on the main resource page by searching with their IDs",
  "comparison.hint.rerunAfterEdit": "After editing resource information, you need to re-execute the comparison plan to generate new results",
  "comparison.hint.configureRulesAfterCreation": "You can configure rules and filters in the plan details after creation",
  "comparison.hint.filtersConfigured": "Filters configured",
  "comparison.propertyPool.internal": "Internal",
  "comparison.propertyPool.reserved": "Reserved",
  "comparison.propertyPool.custom": "Custom",
  "comparison.mode.strictEqual": "Strict Equal",
  "comparison.mode.strictEqual.description": "Binary score: 1 if exactly equal, 0 otherwise. E.g. 4 vs 4 → 1, 4 vs 5 → 0",
  "comparison.mode.normalizedText": "Normalized Text",
  "comparison.mode.normalizedText.description": "Compare after ignoring case, spaces and special characters",
  "comparison.mode.textSimilarity": "Text Similarity",
  "comparison.mode.textSimilarity.description": "Character-level Jaccard similarity (0~1). E.g. 'abc' vs 'abd' → intersection {a,b}/union {a,b,c,d} = 0.5",
  "comparison.mode.regexExtractNumber": "Regex Extract Number",
  "comparison.mode.regexExtractNumber.description": "Extract numbers using regex (e.g. 'v1', 'ep2', '第3') and compare. Binary score: 1 if equal, 0 otherwise",
  "comparison.mode.fixedTolerance": "Fixed Tolerance",
  "comparison.mode.fixedTolerance.description": "Binary score: 1 if |difference| ≤ tolerance, 0 otherwise. E.g. tolerance=1: 4 vs 5 → 1 (diff=1), 4 vs 6 → 0 (diff=2)",
  "comparison.mode.relativeTolerance": "Relative Tolerance",
  "comparison.mode.relativeTolerance.description": "Binary score: 1 if |difference|/max ≤ percent, 0 otherwise. E.g. 20%: 4 vs 5 → 1 (1/5=20%), 4 vs 6 → 0 (2/6=33%)",
  "comparison.mode.setIntersection": "Set Intersection",
  "comparison.mode.setIntersection.description": "Jaccard index (0~1): intersection/union. E.g. {A,B,C} vs {B,C,D} → {B,C}/{A,B,C,D} = 2/4 = 0.5",
  "comparison.mode.subset": "Subset",
  "comparison.mode.subset.description": "Binary score: 1 if A⊆B or B⊆A, 0 otherwise. E.g. {A,B} vs {A,B,C} → 1, {A,B} vs {B,C} → 0",
  "comparison.mode.timeWindow": "Time Window",
  "comparison.mode.timeWindow.description": "Binary score: 1 if time difference ≤ window, 0 otherwise. E.g. window=24h: 12h apart → 1, 36h apart → 0",
  "comparison.mode.sameDay": "Same Day",
  "comparison.mode.sameDay.description": "Binary score: 1 if same calendar date, 0 otherwise. E.g. 2024-01-01 10:00 vs 2024-01-01 22:00 → 1",
  "comparison.mode.extensionMap": "Extension Map",
  "comparison.mode.extensionMap.description": "Compares file extension distribution (0~1). E.g. [.jpg,.jpg,.png] vs [.jpg,.png,.png] → distribution similarity",
  "comparison.nullBehavior.skip": "Skip",
  "comparison.nullBehavior.skip.description": "Skip this rule, does not affect final score",
  "comparison.nullBehavior.fail": "Fail",
  "comparison.nullBehavior.fail.description": "Rule scores 0",
  "comparison.nullBehavior.pass": "Pass",
  "comparison.nullBehavior.pass.description": "Rule scores 1",
  "comparison.description.filters": "Optional, narrow down the resources to compare. If not set, all resources will be compared",
  "comparison.description.rules": "Required, define criteria for determining resource similarity",
  "comparison.description.execute": "Run comparison task and view results",
  "comparison.description.executeDisabledNoRules": "Please add at least one rule first",
  "comparison.description.threshold": "Resources with total score ≥ this threshold are considered similar/duplicate",
  "comparison.description.weight": "Weight coefficient of this rule in the total score",
  "comparison.description.isVeto": "If enabled and this rule scores below threshold, the overall match fails",
  "comparison.description.vetoThreshold": "Minimum score threshold to trigger veto",
  "comparison.description.normalize": "Normalize text before comparison (ignore case, spaces and special characters)",
  "comparison.description.oneNullBehavior": "How to handle when one resource has null value for this property",
  "comparison.description.bothNullBehavior": "How to handle when both resources have null values for this property",
  "comparison.description.tolerance": "Maximum allowed absolute difference. E.g. tolerance=1: values 4 and 5 match (diff=1)",
  "comparison.description.tolerancePercent": "Maximum allowed relative difference (0~1). E.g. 0.2 means 20%: values 4 and 5 match (1/5=20%)",
  "comparison.description.windowHours": "Maximum allowed time difference in hours. E.g. 24: times within 24 hours match",
  "comparison.description.regexPattern": "Custom regex pattern to extract numbers. Leave empty to use built-in patterns (e.g. v1, ep2, #3)",
  "comparison.scoring.title": "Scoring Explanation",
  "comparison.scoring.formula": "Total = Σ(Rule Score × Rule Weight) / Σ(Rule Weight) × 100%",
  "comparison.scoring.ruleScore": "Each rule calculates a score between 0~1 based on its comparison mode",
  "comparison.scoring.weightedSum": "Rule scores are multiplied by their weights, summed, then divided by total weight for weighted average",
  "comparison.scoring.threshold": "When Total Score ≥ Threshold, two resources are considered similar/duplicate",
  "comparison.scoring.example": "Example: Rule A (weight 2) scores 0.8, Rule B (weight 1) scores 0.6, Total = (0.8×2 + 0.6×1) / (2+1) × 100% = 73.3%",
  "comparison.networkGraph.title": "Resource Relationship Graph",
  "comparison.networkGraph.hint": "Only relationships with similarity above the plan threshold are shown. Hover over a connection to see detailed comparison.",
  "comparison.networkGraph.truncatedWarning": "Showing {{shown}}/{{total}} relationships (limited for performance)",
  "comparison.networkGraph.nodeCount": "{{count}} resources",
  "comparison.networkGraph.edgeCount": "{{count}} relationships",
  "comparison.networkGraph.pairScore": "Similarity: {{score}}%",
  "comparison.networkGraph.ruleDetails": "Rule Details",
  "comparison.networkGraph.skipped": "Skipped",
  "comparison.networkGraph.vetoed": "Vetoed",
  "comparison.networkGraph.noData": "No relationship data available"
};
const enFileExplorer = {
  "fileExplorer.error.noFilesUnderPath": "No files under this path",
  "fileExplorer.modal.multipleFileTypesFound": "Multiple file types are found",
  "fileExplorer.tip.pleaseSelectOneToOpen": "Please select one to open",
  "fileExplorer.success.movedItems": "Moved {{count}} items",
  "fileExplorer.error.failedToMoveItems": "Failed to move items",
  "fileExplorer.tip.quickPreviewUsingDefaultApp": "Quick preview using the default application",
  "fileExplorer.tip.openInMediaPlayer": "Open in media player",
  "fileExplorer.empty.noContent": "No content",
  "fileExplorer.contextMenu.openInFileManager": "Open in system file manager",
  "fileExplorer.contextMenu.enterDirectory": "Enter directory",
  "fileExplorer.contextMenu.createNewFolder": "Create new folder",
  "fileExplorer.contextMenu.expand": "Expand",
  "fileExplorer.contextMenu.expandSelected": "Expand selected",
  "fileExplorer.contextMenu.collapse": "Collapse",
  "fileExplorer.contextMenu.collapseSelected": "Collapse selected",
  "fileExplorer.contextMenu.decompressFiles": "Decompress {{count}} files",
  "fileExplorer.contextMenu.startDecompressing": "Start decompressing",
  "fileExplorer.contextMenu.extractDirectories": "Extract {{count}} directories",
  "fileExplorer.contextMenu.wrapItems": "Wrap {{count}} items using directory",
  "fileExplorer.contextMenu.deleteItems": "Delete {{count}} items",
  "fileExplorer.contextMenu.deleteItemsWithSameNames": "Delete items with the same names",
  "fileExplorer.contextMenu.moveItems": "Move {{count}} items",
  "fileExplorer.contextMenu.autoGroupSelectedFiles": "Auto group {{count}} selected files",
  "fileExplorer.contextMenu.autoGroupInternalItems": "Auto group internal items in {{count}} selected directories",
  "fileExplorer.contextMenu.useBulkDecompressionTool": "Use bulk decompression tool",
  "fileExplorer.contextMenu.copyNames": "Copy {{count}} names",
  "fileExplorer.contextMenu.copyPaths": "Copy {{count}} paths",
  "fileExplorer.contextMenu.copied": "Copied",
  "fileExplorer.contextMenu.failedToCopy": "Failed to copy",
  "fileExplorer.contextMenu.batchRename": "Batch rename {{count}} items",
  "fileExplorer.createDirectoryModal.title": "Create new folder",
  "fileExplorer.createDirectoryModal.okButton": "Create",
  "fileExplorer.createDirectoryModal.description": "Create a new folder in",
  "fileExplorer.deleteModal.title": "Sure to delete?",
  "fileExplorer.deleteModal.okButton": "Delete",
  "fileExplorer.deleteSameNamesModal.title": "Delete items with the same names",
  "fileExplorer.deleteSameNamesModal.okButton": "Delete",
  "fileExplorer.deleteSameNamesModal.nothingToDelete": "Nothing to delete",
  "fileExplorer.deleteSameNamesModal.description": "Removing all filesystem entries in {{workingDirectory}} that have the same names as the {{count}} selected filesystem entries",
  "fileExplorer.deleteSameNamesModal.discovering": "Discovering files with same name",
  "fileExplorer.extractModal.title": "Extract {{count}} directories",
  "fileExplorer.extractModal.okButton": "Extract",
  "fileExplorer.extractModal.otherFiles": "Other files",
  "fileExplorer.extractModal.otherFilesIn": "Other files in {{parent}}",
  "fileExplorer.groupModal.title": "Group {{count}} items",
  "fileExplorer.groupModal.titleInternal": "Group internal items",
  "fileExplorer.groupModal.okButton": "Group",
  "fileExplorer.groupModal.allItemsOneFolder": "All items will be stored in one folder",
  "fileExplorer.groupModal.exactSameNameFolder": "Items with exactly the same name (excluding file extensions) will be stored in the same folder",
  "fileExplorer.groupModal.similarityThreshold": "Similarity threshold",
  "fileExplorer.groupModal.nothingToGroup": "Nothing to group. Please check if the folder contains any files; subfolders cannot be grouped",
  "fileExplorer.groupModal.calculating": "Calculating changes...",
  "fileExplorer.wrapModal.title": "Wrapping {{count}} file entries",
  "fileExplorer.wrapModal.okButton": "Wrap",
  "fileExplorer.action.decompress": "Decompress",
  "fileExplorer.action.wrap": "Wrap",
  "fileExplorer.action.move": "Move",
  "fileExplorer.tip.extractChildrenToParent": "Extract children to parent and delete current directory",
  "fileExplorer.label.shortcuts": "Shortcuts",
  "fileExplorer.shortcut.selectPrevious": "Select previous",
  "fileExplorer.shortcut.selectNext": "Select next",
  "fileExplorer.shortcut.enterDirectory": "Enter directory",
  "fileExplorer.shortcut.selectAll": "Select all",
  "fileExplorer.shortcut.copy": "Copy",
  "fileExplorer.shortcut.cut": "Cut",
  "fileExplorer.shortcut.pasteMove": "Paste (move files)",
  "fileExplorer.capability.select": "Select",
  "fileExplorer.capability.multiSelect": "Multi-select",
  "fileExplorer.capability.rangeSelect": "Range select",
  "fileExplorer.capability.wrap": "Wrap",
  "fileExplorer.capability.extract": "Extract",
  "fileExplorer.capability.move": "Move",
  "fileExplorer.capability.delete": "Delete",
  "fileExplorer.capability.rename": "Rename",
  "fileExplorer.capability.decompress": "Decompress",
  "fileExplorer.capability.deleteAllSameName": "Delete all same name",
  "fileExplorer.capability.group": "Group",
  "fileExplorer.capability.play": "Play",
  "fileExplorer.capability.playFirstFile": "Play first file",
  "fileExplorer.capability.createDirectory": "Create directory",
  "fileExplorer.shortcutKey.leftClick": "Left Click",
  "fileExplorer.shortcutKey.ctrlClick": "Ctrl+Click",
  "fileExplorer.shortcutKey.shiftClick": "Shift+Click",
  "fileExplorer.shortcutKey.w": "W",
  "fileExplorer.shortcutKey.e": "E",
  "fileExplorer.shortcutKey.m": "M",
  "fileExplorer.shortcutKey.delete": "Delete",
  "fileExplorer.shortcutKey.f2": "F2",
  "fileExplorer.shortcutKey.d": "D",
  "fileExplorer.shortcutKey.g": "G",
  "fileExplorer.shortcutKey.space": "Space",
  "fileExplorer.shortcutKey.n": "N"
};
const enResourceFilter = {};
const enEnhancer = {
  "enhancer.selector.title": "Enhancers",
  "enhancer.selector.producesValues.label": "This enhancer can produce the following property values",
  "enhancer.selector.targetValueType.label": "The value type of this target is",
  "enhancer.selector.setup.action": "Setup",
  "enhancer.selector.deleteRecordsForCategory.confirm": "Delete all enhancement records of this enhancer for category {{categoryName}}",
  "enhancer.selector.deleteAllRecords.confirm": "Delete all enhancement records of this enhancer",
  "enhancer.selector.reapplyForCategory.confirm": "Re-apply all enhancement data of this enhancer for category {{categoryName}}",
  "enhancer.options.keywordProperty.label": "Property value used during enhancement",
  "enhancer.options.keywordProperty.description": "Generally, this enhancer will use file/folder name of resource to perform enhancement and its not necessary to change this.",
  "enhancer.options.keywordProperty.tip": "In some cases, you can change the property value used during enhancement to perform enhancement on other property values.",
  "enhancer.options.selectProperty.action": "Select property",
  "enhancer.options.propertyValueScope.label": "Property value scope",
  "enhancer.options.propertyValueScope.description": "Property value scope usually means who the property value is generated by.",
  "enhancer.options.propertyValueScope.tip": "For internal options, property value scope will be ignored.",
  "enhancer.options.manualScope.title": "Manual property value scope has been selected",
  "enhancer.options.manualScope.description": "Manual property value scope means the property values are generated by yourself, and these values are typically not yet available at the time of enhancement.",
  "enhancer.options.manualScope.confirm": "I've understood",
  "enhancer.options.pretreat.label": "Pretreat property value",
  "enhancer.options.pretreat.description": "If checked, the property value will be pretreated before enhancement.",
  "enhancer.options.pretreat.tip": "You can configure the special texts to be pretreated in special text page under data menu.",
  "enhancer.options.pretreat.action": "Click to check special texts",
  "enhancer.options.configure.title": "Configure enhancer",
  "enhancer.options.runAfter.label": "Run after enhancers",
  "enhancer.options.runAfter.description": "You can perform chained enhancement by customizing the execution order of the enhancers.",
  "enhancer.options.runAfter.tip": "Generally, you can just leave it as empty.",
  "enhancer.options.enhanceProperties.label": "Enhance properties",
  "enhancer.options.enhanceProperties.tip": "Please select at least one property to enhance.",
  "enhancer.categoryOptions.title": "Configure enhancer:{{enhancerName}} for category:{{categoryName}}",
  "enhancer.regex.captureGroups.label": "Available capture groups:",
  "enhancer.regex.captureGroups.warning": "No named capture groups were found, so the enhancement will not take effect.",
  "enhancer.regex.expressions.description": "You can set multiple regex expressions(separated by new line) to match the file or folder name of each resource.",
  "enhancer.regex.captureGroups.mergeDescription": "Text matched by multiple capture groups with the same name will be merged into a list and deduplicated.",
  "enhancer.regex.expressions.categoryTip": "After setting regex expressions, you must go to category page to configure regex enhancer for each category.",
  "enhancer.regex.expressions.namingTip": "You need to use the same name(index-based group name will be ignored) as the capture group for the dynamic enhancement target, otherwise the resource may not be enhanced.",
  "enhancer.regex.expressions.label": "Regex expressions",
  "enhancer.target.fixed.label": "Enhancement target",
  "enhancer.target.saveAsProperty.label": "Save as property",
  "enhancer.target.otherOptions.label": "Other options",
  "enhancer.target.specifyDynamic.action": "Specify dynamic target",
  "enhancer.target.default.label": "Default",
  "enhancer.target.clickToSpecify.action": "Click to specify target",
  "enhancer.target.noProperty.warning": "Target will not be applied because there is no property to store it.",
  "enhancer.target.selectProperty.action": "Select a property",
  "enhancer.target.unbind.action": "Unbind",
  "enhancer.target.label": "Target",
  "enhancer.target.duplicateDynamic.error": "Duplicate dynamic target is found",
  "enhancer.target.dynamicLabel.tip": "This is not a fixed enhancement target, which will be replaced with other content when data is collected",
  "enhancer.target.configured.label": "Configured",
  "enhancer.target.bindProperty.label": "Bind property",
  "enhancer.targetOptions.autoMatch.label": "Auto match on empty values",
  "enhancer.targetOptions.autoMatch.description": "By default, an empty layer will be created if we meet an empty value in multilevel data.",
  "enhancer.targetOptions.autoMatch.checkedBehavior": "If checked, this kind of data will be matched with the most similar multilevel value in the database.",
  "enhancer.targetOptions.autoMatch.example": "For example, assume we already have a multilevel data: a->b->c, then for the incoming data: ->->c, the values of 1st and 2nd layers of which are empty.",
  "enhancer.targetOptions.autoMatch.exampleResult": "If this option is checked, we'll save ->->c as a->b->c, otherwise the incoming value ->->c will be saved.",
  "enhancer.targetOptions.autoMatch.warning": "This option may cause unexpected behaviors, make sure you have enough confidence to merge the produced data into data in db before check it.",
  "enhancer.targetOptions.autoBind.label": "Auto bind property",
  "enhancer.targetOptions.autoBind.description": "If this option is checked, a property with the same name and type of the target will be bound automatically.",
  "enhancer.targetOptions.autoBind.createTip": "If there isn't such a property, a new property will be created and bound to this target.",
  "enhancer.targetOptions.autoBind.dynamicTip": "If this option is checked in default options of a dynamic target, all unlisted dynamic targets will be bound to properties of the same type with the same name.",
  "enhancer.targetOptions.propertyNotBound.warning": "This property is not bound to the category, its data will not be displayed.",
  "enhancer.targetOptions.bindToCategory.title": "Bind property {{propertyName}} to category {{categoryName}}",
  "enhancer.targetOptions.bindToCategory.action": "Bind now",
  "enhancer.tip.partialSetup.warning": "Some of targets are not mapped to a property, corresponding data will not be enhanced.",
  "enhancer.tip.noSetup.warning": "None of targets is mapped to a property, so no data will be enhanced.",
  "enhancer.records.title": "Enhancement records",
  "enhancer.records.noProfilesFound.warning": "No resource profiles found with this enhancer configured",
  "enhancer.records.configure.action": "Configure enhancer",
  "enhancer.records.selectProfile.label": "Select resource profile",
  "enhancer.records.noProfiles.title": "No resource profiles configured for this enhancer",
  "enhancer.records.noProfiles.description": "Please configure a resource profile with {{enhancerName}} enhancer to enable data retrieval",
  "enhancer.records.goToProfiles.action": "Go to Resource Profiles",
  "enhancer.records.noData.title": "No enhancement data available yet",
  "enhancer.records.noData.description": "Enhancement data will be generated automatically in the background, or you can click the button above to trigger it manually",
  "enhancer.records.enhanceNow.action": "Enhance now",
  "enhancer.records.resourcePath.label": "Path of resource",
  "enhancer.records.noEnhancers.title": "No enhancers configured",
  "enhancer.records.noEnhancers.description": "This resource has no enhancement records yet. Please configure enhancers in resource profiles to enable automatic data enhancement.",
  "enhancer.records.dataCreatedAt.label": "Data created at",
  "enhancer.records.dataCreatedAt.tip": "The data has been created, indicating that the enhancer has completed the data retrieval process, which is typically done by accessing third-party sites or executing specific internal logic. You can check the status of the data retrieval in the table below. Frequent repeated data retrieval attempts may result in access denial from third-party services.",
  "enhancer.records.dataAppliedAt.label": "Data applied at",
  "enhancer.records.dataAppliedAt.tip": "The application of data indicates that the retrieved data has been successfully converted into attribute values. This step is conducted entirely within the program, without involving any third-party data exchange.",
  "enhancer.records.enhanceProcess.tip": "Retrieve data then apply data. To reduce the possibility of access denial from third-party services, it is recommended to apply data only after all data has been retrieved. Configuring enhancer options in category won't affect the data retrieval process, it only affects the data applying process.",
  "enhancer.records.reEnhance.action": "Re-enhance now",
  "enhancer.records.applyData.tip": "Apply the data to property values of the resource.",
  "enhancer.records.applyData.action": "Apply data",
  "enhancer.records.notConfigured.title": "Enhancer not configured in resource profiles",
  "enhancer.records.notConfigured.description": "This enhancer is not currently configured in any resource profile. The data shown below is from previous enhancements. To enable automatic updates, please configure this enhancer in the resource profile settings.",
  "enhancer.records.error.title": "Enhancement Error",
  "enhancer.records.configUpdated.label": "Enhancer configuration updated",
  "enhancer.records.rawData.label": "Raw data",
  "enhancer.records.generatedValue.label": "Generated custom property value",
  "enhancer.records.noFixedData.warning": "No data retrieved for fixed targets, please check configuration if necessary",
  "enhancer.records.noDynamicData.warning": "No data retrieved for dynamic targets, please check configuration if necessary",
  "enhancer.records.unsupportedReservedType.error": "Unsupported reserved property type: {{type}}",
  "enhancer.records.unsupportedPropertyType.error": "Unsupported property type: {{type}}",
  "enhancer.logs.title": "Enhancement Logs",
  "enhancer.logs.timestamp.label": "Timestamp",
  "enhancer.logs.level.label": "Level",
  "enhancer.logs.event.label": "Event",
  "enhancer.logs.data.label": "Data",
  "enhancer.logs.viewData.action": "View Data",
  "enhancer.logs.copiedToClipboard.label": "Copied to clipboard",
  "propertyMatcher.autoMatch.tooltip": "Automatically match property",
  "propertyMatcher.noName.title": "No proper property name provided",
  "propertyMatcher.noName.description": "Please provide a property name",
  "propertyMatcher.noMatch.title": "No proper property found",
  "propertyMatcher.noMatch.youCan": "You can",
  "propertyMatcher.autoCreate.label": "Automatically create a new property",
  "propertyMatcher.selectManually.label": "Select manually",
  "propertyMatcher.partialMatch.title": "Some properties cannot be matched",
  "propertyMatcher.autoMatched.label": "Auto matched",
  "propertyMatcher.missing.label": "Missing",
  "propertyMatcher.recommended.label": "Recommended",
  "propertyMatcher.autoCreateMissing.label": "Automatically create missing properties",
  "propertyMatcher.keepMatched.label": "Keep matched properties, handle missing ones manually"
};
const Name$1 = "Name";
const Precision$1 = "Precision";
const Preview$2 = "Preview";
const Continue$1 = "Continue";
const Convert$1 = "Convert";
const Text$1 = "Text";
const Option$1 = "Option";
const DateTime$1 = "DateTime";
const Other$1 = "Other";
const UnderDevelopment$1 = "Under Development";
const Submit$1 = "Submit";
const Untitled$1 = "Untitled";
const enProperty = {
  "property.empty.noPropertiesAvailable": "No properties available",
  "property.empty.noPropertiesFound": "No properties found",
  "property.action.addProperty": "Add a property",
  "property.action.searchProperties": "Search properties",
  "property.modal.selectProperties": "Select properties",
  "property.modal.selectProperty": "Select a property",
  "property.modal.adjustPropertyOrderTitle": "Adjust orders of properties",
  "property.tip.clickToEditOrder": "Click to edit order",
  "property.tip.orderEditInstructions": "Click on the order number to edit directly, or use the buttons to move to top/bottom",
  "property.modal.bulkEditProperties": "Bulk edit properties",
  "property.modal.confirmPropertyChange": "Confirm property change",
  "property.success.propertyUpdatedSuccessfully": "Property updated successfully",
  "property.error.failedToUpdateProperty": "Failed to update property",
  "property.warning.willOverrideValues": "This will override different values on {{count}} resources",
  "property.attachment.selectFromFileSystem": "Select from file system",
  "property.attachment.uploadFromLocal": "Upload from local",
  "property.attachment.uploadHint": "Uploaded files will be saved in the data/attachments folder under the app data path",
  "Custom property": "Custom property",
  "Select a type": "Select a type",
  "Click to change type": "Click to change type",
  Name: Name$1,
  "Default value": "Default value",
  Precision: Precision$1,
  Preview: Preview$2,
  "Show progressbar": "Show progressbar",
  "Max value": "Max value",
  "Formula syntax": "Formula syntax",
  "You are changing property type": "You are changing property type",
  "Changing the property type may cause the loss of existing data. Click 'continue' to check.": "Changing the property type may cause the loss of existing data. Click 'continue' to check.",
  "Following rule(s) will be applied": "Following rule(s) will be applied",
  Continue: Continue$1,
  "Final check": "Final check",
  "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted": "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted",
  "Found {{count}} data, and all of them will be retained": "Found {{count}} data, and all of them will be retained",
  "Be careful, this process is irreversible": "Be careful, this process is irreversible",
  "Source value": "Source value",
  "Converted value": "Converted value",
  Convert: Convert$1,
  Text: Text$1,
  "Number": "Number",
  Option: Option$1,
  DateTime: DateTime$1,
  Other: Other$1,
  UnderDevelopment: UnderDevelopment$1,
  "Sort by alphabet": "Sort by alphabet",
  "Add a choice": "Add a choice",
  "Add or delete in bulk": "Add or delete in bulk",
  "Add or delete choices in bulk": "Add or delete choices in bulk",
  "Choices will be separated by line breaks.": "Choices will be separated by line breaks.",
  "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted.": "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted.",
  "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted.": "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted.",
  "{{count}} data will be deleted": "{{count}} data will be deleted",
  "{{count}} data will be added": "{{count}} data will be added",
  Submit: Submit$1,
  Untitled: Untitled$1,
  "Add root data": "Add root data",
  "Add or delete tags in bulk": "Add or delete tags in bulk",
  "Colon can be added between group and name, and tags will be separated by line breaks.": "Colon can be added between group and name, and tags will be separated by line breaks.",
  "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted.": "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted.",
  "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted.": "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted."
};
const enMediaPlayer = {};
const onboarding$1 = {
  skip: "Skip",
  previous: "Previous",
  next: "Next",
  start: "Get Started",
  viewAgain: "View Guide Again",
  welcome: {
    title: "Welcome to Bakabase",
    description: "Let's take a quick tour of Bakabase's core features to help you manage and browse your media resources effectively."
  },
  pathMark: {
    title: "Path Marks",
    subtitle: "Connect your media library and start managing resources",
    point1: "Add media folders as path marks",
    point2: "Set tags for different types of resources",
    point3: "Automatically scan and index your media files"
  },
  resourceProfile: {
    title: "Resource Profiles",
    subtitle: "Customize how resources are displayed and processed",
    point1: "Create profile schemes for different resource types",
    point2: "Configure metadata enhancement rules",
    point3: "Set up playback and preview options"
  },
  resourceBrowsing: {
    title: "Resource Browsing",
    subtitle: "Powerful search and filtering capabilities",
    point1: "Filter resources with multiple conditions",
    point2: "Switch between list and grid views",
    point3: "Quickly find and access your resources"
  },
  fileProcessor: {
    title: "File Processor",
    subtitle: "Automate your media file processing",
    point1: "Automatically decompress files",
    point2: "Periodically sync and update resources",
    point3: "Batch process file operations"
  },
  downloader: {
    title: "Downloader",
    subtitle: "Enhance resources with metadata and covers",
    point1: "Automatically download video previews",
    point2: "Fetch high-quality cover images",
    point3: "Sync metadata from third-party platforms"
  },
  fileMover: {
    title: "File Mover",
    subtitle: "Intelligently organize your file structure",
    point1: "Automatically move files based on rules",
    point2: "Customize file naming formats",
    point3: "Batch reorganize folder structures"
  },
  completion: {
    title: "You're All Set!",
    description: "You've learned about Bakabase's main features. Now you can start by adding your first path mark and begin managing your media resources!",
    hint: "You can view this guide again anytime in settings"
  }
};
const enOnboarding = {
  onboarding: onboarding$1
};
const Property$2 = "Property";
const enResourceComponent = {
  "resource.playControl.tooltip.cachePreparing": "Preparing cache, please wait...\nCheck progress in the background tasks button at bottom-left",
  "resource.playControl.tooltip.loading": "Loading playable files...",
  "resource.playControl.tooltip.notFound": "No playable files found",
  "resource.playControl.noPlayableFiles.title": "No Playable Files Found",
  "resource.playControl.noPlayableFiles.description": "No playable media files were found in this resource.",
  "resource.playControl.noPlayableFiles.tips.title": "Possible reasons",
  "resource.playControl.noPlayableFiles.tips.noFile": "No supported media files in the resource directory",
  "resource.playControl.noPlayableFiles.tips.extension": "File extensions are not in the playable types list",
  "resource.playControl.noPlayableFiles.action.title": "Solution",
  "resource.playControl.noPlayableFiles.action.description": "You can configure playable file types in resource profiles",
  "resource.playControl.noPlayableFiles.action.settings": "Go to Resource Profile Settings",
  "resource.playControl.noPlayableFiles.matchingProfiles": "Matching resource profiles:",
  "resource.playControl.noPlayableFiles.noMatchingProfiles": "No matching resource profiles found",
  "resource.playControl.modal.selectFileTitle": "Please select a file to play",
  "resource.playControl.modal.showAllFiles": "Show all {{count}} files",
  "resource.playControl.modal.loadAllFiles": "Load all files",
  "resource.playControl.modal.autoSelectFirstFile": "Auto-select first file if multiple playable files exist",
  "resource.playControl.toast.autoSelectEnabled": "Auto-select first playable file has been enabled. You can change this in the resource page settings.",
  "resource.cover.tooltip.cachePreparing": "Preparing cover cache...",
  "resource.cover.tooltip.loading": "Loading cover...",
  "resource.tip.isParentResource": "This is a parent resource",
  "resource.tip.fileNotExist": "File does not exist",
  "resource.tip.unknownMediaLibrary": "Unknown media library",
  "resource.tip.clickToViewEditProfile": "Click to view and edit this profile",
  "resource.tip.hierarchyDescription": "Resource relationships are determined by physical path structure.",
  "resource.tip.removeFromMediaLibrary": "Remove from this media library",
  "resource.tip.clickToViewFullIntroduction": "Click to view full introduction",
  "resource.tip.clickToAddIntroduction": "Click to add introduction",
  "resource.label.resourceId": "Resource ID",
  "resource.label.resourceProfiles": "Resource Profiles",
  "resource.label.playedJustNow": "Played just now",
  "resource.label.playedMinutesAgo": "Played {{n}} minutes ago",
  "resource.label.playedHoursAgo": "Played {{n}} hours ago",
  "resource.label.playedDaysAgo": "Played {{n}} days ago",
  "resource.label.lastPlayedAt": "Last played at",
  "resource.label.fileAddDate": "File Add Date",
  "resource.label.fileModifyDate": "File Modify Date",
  "resource.label.resourceCreateDate": "Resource Create Date",
  "resource.label.resourceUpdateDate": "Resource Update Date",
  "resource.label.columns": "Columns",
  "resource.action.markAsNotPlayed": "Mark as not played",
  "resource.action.adjustPropertyScopePriority": "Adjust the display priority of property scopes",
  "resource.action.sortPropertiesGlobally": "Adjust orders of properties globally",
  "resource.modal.selectMediaLibrary": "Select media library",
  "resource.placeholder.enterIntroduction": "Enter introduction...",
  "resource.state.noIntroductionYet": "No introduction yet",
  "resource.success.mediaLibraryAdded": "Media library added",
  "resource.success.mediaLibraryRemoved": "Media library removed",
  "resource.error.failedToAddMediaLibrary": "Failed to add media library",
  "resource.error.failedToRemoveMediaLibrary": "Failed to remove media library",
  "resource.empty.noCustomPropertyBound": "No custom property bound. You can bind them in resource profile",
  "resource.error.failedToLoadChildren": "Failed to load children",
  "resource.modal.resourceChildren": "Resource Children",
  "resource.tip.viewChildrenInNewTab": "View children in new resource tab",
  "resource.state.loadingChildren": "Loading children...",
  "resource.empty.noChildrenFound": "No children found",
  "resource.label.foundChildrenCount": "Found {{count}} children",
  "resource.label.resourcesSelected": "{{count}} resources selected",
  "resource.placeholder.searchAnyKeyword": "Search any keyword",
  "ResourceCover.CoverTips.Title": "Cover Display Issues?",
  "ResourceCover.CoverTips.Tooltip": "Why no cover?",
  "ResourceCover.CoverTips.S1.Title": "Scenario 1: Cover never appeared",
  "ResourceCover.CoverTips.S1.Happens": "Reason:",
  "ResourceCover.CoverTips.S1.When.NotImage": "The resource itself is not an image file",
  "ResourceCover.CoverTips.S1.When.NoImageInFolder": "No image files in the resource folder",
  "ResourceCover.CoverTips.S1.Todo": "Solution:",
  "ResourceCover.CoverTips.S1.Todo.ManualSet": "Set cover manually",
  "ResourceCover.CoverTips.S1.Todo.FFmpeg": "Install FFmpeg to extract covers from videos",
  "ResourceCover.CoverTips.S1.Todo.Enhancers": "Use enhancers to fetch covers automatically",
  "ResourceCover.CoverTips.S1.Todo.Cache": "Clear cover cache and rediscover",
  "ResourceCover.CoverTips.S2.Title": "Scenario 2: Cover appeared before",
  "ResourceCover.CoverTips.S2.Happens": "Reason:",
  "ResourceCover.CoverTips.S2.When.CacheDeleted": "Cover source file was deleted or moved",
  "ResourceCover.CoverTips.S2.Todo": "Solution:",
  "ResourceCover.CoverTips.S2.Todo.DisableCache": "Disable cover cache and use original files as covers",
  "Cover cache": "Cover cache",
  "Cover cache has been reset": "Cover cache has been reset",
  "Reset cover cache of current resource": "Reset cover cache of current resource",
  "resource.contextMenu.setMediaLibraries": "Set media libraries",
  "resource.contextMenu.setMediaLibrariesForCount": "Set media libraries for {{count}} resources",
  "resource.contextMenu.transferResourceData": "Transfer resource data",
  "resource.contextMenu.transferDataOfCount": "Transfer data of {{count}} resources",
  "resource.contextMenu.editProperties": "Edit properties",
  "resource.contextMenu.bulkEditProperties": "Bulk edit properties",
  "resource.contextMenu.deleteResource": "Delete resource",
  "resource.contextMenu.deleteCountResources": "Delete {{count}} resources",
  "resource.contextMenu.confirmDeleteCount": "Are you sure you want to delete {{count}} resources?",
  "resource.contextMenu.filesWillNotBeDeleted": "Files will not be deleted.",
  "The following properties are not bound to resource profiles": "The following properties are not bound to resource profiles",
  "There is no property bound yet, you can bind properties in resource profile.": "There is no property bound yet, you can bind properties in resource profile.",
  Property: Property$2,
  "Display value": "Display value",
  "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions.": "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions.",
  "indicates this scope is not enabled": "indicates this scope is not enabled",
  "Setup priority of property value scopes": "Setup priority of property value scopes",
  "Visible scopes": "Visible scopes",
  "This filter is used for quick check and does not change the priority of property value scopes.": "This filter is used for quick check and does not change the priority of property value scopes.",
  "You can click on the scope button to change the priority of the property value scopes.": "You can click on the scope button to change the priority of the property value scopes."
};
const enFloatingAssistant = {
  "floatingAssistant.status.tasksRunning": "tasks running",
  "floatingAssistant.status.someTasksFailed": "Some tasks failed",
  "floatingAssistant.tip.pauseAllRunningTasks": "Pause all running tasks",
  "floatingAssistant.tip.resumeAllPausedTasks": "Resume all paused tasks",
  "floatingAssistant.tip.clearInactiveTasks": "Remove completed, failed, and cancelled tasks from list",
  "floatingAssistant.action.clearInactiveTasks": "Clear inactive tasks",
  "floatingAssistant.label.taskList": "Task list",
  "floatingAssistant.label.nextRun": "Next run",
  "floatingAssistant.status.started": "Started",
  "floatingAssistant.status.paused": "Paused",
  "floatingAssistant.status.resumed": "Resumed",
  "floatingAssistant.status.stopped": "Stopped",
  "floatingAssistant.status.running": "Running",
  "floatingAssistant.status.pending": "Pending",
  "floatingAssistant.status.completed": "Completed",
  "floatingAssistant.status.failed": "Failed",
  "floatingAssistant.modal.stoppingTaskTitle": "Stopping task: {{taskName}}",
  "floatingAssistant.tip.removeFromList": "Remove from list",
  "floatingAssistant.tip.persistentScheduledTask": "Persistent scheduled task",
  "floatingAssistant.tip.estimatedCompletion": "Estimated completion",
  "floatingAssistant.empty.noBackgroundTask": "No background task",
  "floatingAssistant.empty.noTasksMatchFilter": "No tasks match the filter"
};
const enCookieValidator = {
  "cookieValidator.label.cookieValidator": "Cookie validator"
};
const enFileSystemSelector = {
  "fileSystemSelector.title.selectEntries": "Select file system entries",
  "fileSystemSelector.title.selectFile": "Select file",
  "fileSystemSelector.title.selectFolder": "Select folder"
};
const Close$1 = "关闭";
const Confirm = "确认";
const Beta = "测试版";
const Developing = "开发中";
const Deprecated = "已弃用";
const OK = "确定";
const Cancel$1 = "取消";
const Selected = "已选择";
const Filter$1 = "筛选";
const Delete = "删除";
const cnCommon = {
  "common.enabled": "已启用",
  "common.disabled": "已禁用",
  Close: Close$1,
  Confirm,
  "An error occurred:": "发生错误：",
  "common.action.save": "保存",
  "common.action.cancel": "取消",
  "common.action.delete": "删除",
  "common.action.confirm": "确认",
  "common.action.edit": "编辑",
  "common.action.add": "添加",
  "common.action.remove": "移除",
  "common.action.create": "创建",
  "common.action.close": "关闭",
  "common.action.start": "开始",
  "common.action.stop": "停止",
  "common.action.pause": "暂停",
  "common.action.resume": "恢复",
  "common.action.refresh": "刷新",
  "common.action.search": "搜索",
  "common.action.preview": "预览",
  "common.action.configure": "配置",
  "common.action.validate": "验证",
  "common.action.back": "返回",
  "common.action.next": "下一步",
  "common.action.previous": "上一步",
  "common.action.submit": "提交",
  "common.action.reset": "重置",
  "common.action.clear": "清除",
  "common.action.copy": "复制",
  "common.action.duplicate": "复制",
  "common.action.enable": "启用",
  "common.action.disable": "禁用",
  "common.action.import": "导入",
  "common.action.export": "导出",
  "common.action.download": "下载",
  "common.action.upload": "上传",
  "common.action.play": "播放",
  "common.action.openFolder": "打开文件夹",
  "common.action.clearAll": "清除全部",
  "common.action.selectAll": "全选",
  "common.action.select": "选择...",
  "common.label.selectParentResource": "选择父资源",
  "common.label.selectParentResources": "选择父资源",
  "common.action.change": "更改",
  "common.action.apply": "应用",
  "common.action.retry": "重试",
  "common.action.skip": "跳过",
  "common.action.migrate": "迁移",
  "common.action.convert": "转换",
  "common.action.sync": "同步",
  "common.action.syncAll": "全部同步",
  "common.action.syncNow": "立即同步",
  "common.action.pauseAll": "全部暂停",
  "common.action.resumeAll": "全部恢复",
  "common.action.moveToTop": "移动到顶部",
  "common.action.moveToBottom": "移动到底部",
  "common.action.transfer": "转移",
  "common.action.leave": "离开",
  "common.action.stay": "留下",
  "common.label.yes": "是",
  "common.label.no": "否",
  "common.label.none": "无",
  "common.label.all": "全部",
  "common.label.name": "名称",
  "common.label.path": "路径",
  "common.label.status": "状态",
  "common.label.time": "时间",
  "common.label.order": "顺序",
  "common.label.priority": "优先级",
  "common.label.source": "来源",
  "common.label.message": "消息",
  "common.label.property": "属性",
  "common.label.value": "值",
  "common.label.type": "类型",
  "common.label.pattern": "模式",
  "common.label.extensions": "扩展名",
  "common.placeholder.separateBySpaceOrNewline": "用空格或换行分隔",
  "common.placeholder.typeHere": "在这里输入",
  "common.placeholder.readonly": "只读",
  "common.label.total": "总计",
  "common.label.count": "数量",
  "common.label.progress": "进度",
  "common.label.remaining": "剩余",
  "common.label.description": "描述",
  "common.label.introduction": "简介",
  "common.label.operations": "操作",
  "common.label.setting": "设置",
  "common.label.settings": "设置",
  "common.label.configuration": "配置",
  "common.label.customProperties": "自定义属性",
  "common.label.internalProperties": "内置属性",
  "common.label.reservedProperties": "保留属性",
  "common.label.warning": "警告",
  "common.label.error": "错误",
  "common.label.createdAt": "创建于",
  "common.label.changeLog": "更新日志",
  "common.label.development": "开发",
  "common.label.log": "日志",
  "common.label.children": "子项",
  "common.label.enhancer": "增强器",
  "common.label.mediaLibrary": "媒体库",
  "common.label.mediaLibraries": "媒体库",
  "common.label.resource": "资源",
  "common.label.resources": "资源",
  "common.label.template": "模板",
  "common.label.regex": "正则表达式",
  "common.label.regexPattern": "正则表达式模式",
  "common.label.layer": "层级",
  "common.label.checkpoint": "检查点",
  "common.label.auto": "自动",
  "common.label.manual": "手动",
  "common.label.builtin": "内置",
  "common.label.dynamic": "动态",
  "common.label.fixed": "固定",
  "common.label.notSet": "未设置",
  "common.label.clickToSet": "点击设置",
  "common.action.more": "更多",
  "resourcesModal.title": "{{count}} 个资源",
  "common.state.loading": "加载中...",
  "common.state.saved": "已保存",
  "common.success.saved": "保存成功",
  "common.state.selected": "已选择",
  "common.state.noData": "无数据",
  "common.state.noResults": "无结果",
  "common.state.copied": "已复制！",
  "common.state.partiallySet": "部分设置",
  "common.state.multipleValues": "多个值",
  "common.state.unknown": "未知",
  "common.state.empty": "空",
  "common.state.noChoicesAvailable": "没有可选值",
  "common.confirm.default": "确定吗？",
  "common.confirm.short": "确定？",
  "common.confirm.continue": "确定要继续吗？",
  "common.confirm.continueAnyway": "仍然继续",
  "common.confirm.irreversibleWarning": "请注意，此操作无法撤销",
  "common.confirm.deleteFile": "确定要删除此文件/文件夹吗？",
  "common.confirm.deleteFileTitle": "删除此文件/文件夹？",
  "common.confirm.stopTask": "确定要停止此任务吗？",
  "common.message.confirmLeave": "确认离开",
  "common.tip.clickToRetry": "点击此处重试",
  "common.tip.clickToCopy": "点击复制完整路径",
  "common.tip.pathCopied": "路径已复制到剪贴板",
  "common.tip.leavePageWarning": "即将离开当前页面",
  "common.label.unknownProperty": "未知属性",
  "common.unit.days": "天",
  "common.unit.hours": "时",
  "common.unit.minutes": "分",
  "common.unit.seconds": "秒",
  "common.state.never": "从不",
  "common.action.viewChildren": "查看子项",
  "common.action.showTimeInfo": "显示时间信息",
  "common.action.hideTimeInfo": "隐藏时间信息",
  "common.state.loadingProperties": "正在加载属性...",
  "common.state.filtering": "筛选中",
  "common.label.actions": "操作",
  "common.label.to": "为",
  "common.label.andCountMore": "以及其他 {{count}} 个",
  "common.label.properties": "属性",
  "common.error.failedToLoadData": "加载数据失败",
  "common.error.failedToProcessData": "处理数据失败",
  "common.error.unknownError": "未知错误",
  "term.mediaLibrary.description": "将匹配的资源与媒体库关联",
  "term.mediaLibrary.usage": "资源将被链接到所选媒体库以进行组织",
  "term.mediaLibrary.suggestion": "考虑将资源组织到适当的媒体库中",
  "term.enhancer.description": "增强器用于通过提取或添加元数据来自动增强资源",
  "term.resource.description": "资源表示由 Bakabase 管理的文件或文件夹",
  "term.resource.usage": "资源可以拥有属性、被组织到媒体库中并被增强",
  "term.resource.tip": "资源是 Bakabase 中组织的核心单元",
  "term.property.description": "属性是可以附加到资源的元数据字段",
  "term.property.usage": "属性有助于有效地组织和搜索资源",
  "menu.dashboard": "仪表板",
  "menu.resource": "资源",
  "menu.mediaLibrary": "媒体库",
  "menu.mediaLibraryConfiguration": "媒体库配置",
  "menu.pathMarks": "已配置媒体库",
  "menu.resourceProfile": "资源扩展",
  "menu.data": "数据",
  "menu.customProperty": "自定义属性",
  "menu.extensionGroup": "扩展名分组",
  "menu.cache": "缓存",
  "menu.alias": "别名",
  "menu.specialText": "特殊文本",
  "menu.playHistory": "播放历史",
  "menu.bulkModification": "批量修改",
  "menu.comparison": "资源对比",
  "menu.mediaLibraryTemplate": "媒体库模板",
  "menu.synchronizationOptions": "同步选项",
  "menu.tools": "工具",
  "menu.fileProcessor": "文件处理器",
  "menu.downloader": "下载器",
  "menu.fileMover": "文件移动器",
  "menu.fileNameModifier": "文件名修改器",
  "menu.migration": "迁移",
  "menu.experimental": "实验性",
  "menu.thirdPartyIntegration": "第三方集成",
  "menu.postParser": "帖子解析器",
  "menu.system": "系统",
  "menu.configuration": "配置",
  "menu.thirdParty": "第三方",
  "menu.backgroundTask": "后台任务",
  "menu.performanceProfiler": "性能分析器",
  "menu.log": "日志",
  "menu.test": "测试",
  "typeConversion.title": "类型转换规则",
  "typeConversion.targetType": "目标类型",
  "typeConversion.rules": "规则",
  "typeConversion.sourceType": "源类型",
  "typeConversion.checkExamples": "查看示例",
  "typeConversion.examplesTitle": "类型转换示例",
  "typeConversion.valueToBeConverted": "待转换值",
  Beta,
  "BetaFeature.UnstableWarning": "此功能处于测试阶段，可能不稳定。如遇到问题请反馈。",
  "BetaFeature.BackupWarning": "强烈建议在使用前备份数据。",
  Developing,
  "This feature is currently in development and may not be fully functional.": "此功能正在开发中，可能尚未完全可用。",
  "DevelopingFeature.ExpectChanges": "功能可能会有较大变动，请留意后续更新。",
  Deprecated,
  "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative.": "此功能已弃用，可能会在未来版本中移除。请考虑使用推荐的替代方案。",
  "resourceFilter.switchToAdvancedMode": "切换到高级模式",
  "resourceFilter.switchToSimpleMode": "切换到简单模式",
  "resourceFilter.advanceFilter": "高级筛选",
  "resourceFilter.filter": "筛选器",
  "resourceFilter.filterGroup": "筛选器组",
  "resourceFilter.specialFilters": "特殊筛选",
  "resourceFilter.recentFilters": "最近筛选",
  "Set rating": "设置评分",
  "Recycle bin": "回收站",
  "New Folder": "新建文件夹",
  OK,
  Cancel: Cancel$1,
  Selected,
  Filter: Filter$1,
  "You can type a path here": "可以在此输入路径",
  "Copied {{count}} items": "已复制 {{count}} 个项目",
  "Cut {{count}} items": "已剪切 {{count}} 个项目",
  "Moved {{count}} items": "已移动 {{count}} 个项目",
  Delete,
  "Select data": "选择数据",
  "extensionGroupSelect.label": "限制扩展名分组",
  "extensionGroupSelect.placeholder": "从扩展名分组中选择",
  "common.confirm.navigateAway": "离开当前页面",
  "common.confirm.navigateAwayMessage": "即将离开当前页面，确定要继续吗？",
  "FeatureRequestTip.Developing": "<1>{{name}}</1> 功能正在开发中。你可以在 <3>Github</3> 或 <5>QQ群</5> 上催促作者或提出建议。",
  "FeatureRequestTip.Deprecated": "<1>{{name}}</1> 功能已弃用。你可以在 <3>Github</3> 或 <5>QQ群</5> 上了解详情或提出建议。",
  "FeatureRequestTip.Deprecating": "<1>{{name}}</1> 功能即将弃用。你可以在 <3>Github</3> 或 <5>QQ群</5> 上了解详情或提出建议。",
  "Join QQ group": "加入QQ群",
  "For more information, you can visit:": "如需了解更多信息，请访问：",
  "Select a media library": "选择媒体库",
  "Quick filter": "快速筛选",
  "Are you sure to select this media library?": "确定要选择此媒体库吗？",
  "Are you sure to select this path?": "确定要选择此路径吗？",
  "Select a path": "选择路径"
};
const cnValidation = {
  "validation.name.required": "名称为必填项",
  "validation.name.notEmpty": "名称不能为空",
  "validation.executablePath.required": "可执行文件路径为必填项",
  "validation.path.required": "路径为必填项",
  "validation.value.required": "值为必填项",
  "validation.selection.required": "请选择一个选项",
  "validation.file.notFolder": "请选择文件，而非文件夹",
  "validation.path.notExist": "{{count}} 个路径在文件系统中不存在",
  "validation.ports.tooMany": "端口数量过多，最多支持 {{max}} 个端口。",
  "validation.data.invalid": "无效数据",
  "validation.field.required": "此字段为必填项"
};
const cnErrors = {
  "error.title": "错误",
  "error.load.data": "加载数据失败",
  "error.save.mark": "保存标记失败",
  "error.delete.mark": "删除标记失败",
  "error.delete.marks": "删除标记失败",
  "error.update.app": "更新应用失败",
  "error.add.mediaLibrary": "添加媒体库失败",
  "error.remove.mediaLibrary": "移除媒体库失败",
  "error.update.property": "更新属性失败",
  "error.process.data": "处理数据失败",
  "error.get.latestVersion": "获取最新版本失败",
  "error.add.marks": "添加标记失败",
  "error.paste.marks": "粘贴标记失败",
  "error.transfer.marks": "转移标记失败",
  "error.start.sync": "启动同步失败",
  "error.update.option": "更新选项失败",
  "error.unknown": "未知错误"
};
const cnStatus = {
  "status.completed": "已完成",
  "status.running": "运行中",
  "status.paused": "已暂停",
  "status.stopped": "已停止",
  "status.pending": "待处理",
  "status.failed": "失败",
  "status.success": "成功",
  "status.downloading": "下载中",
  "status.syncing": "同步中",
  "status.started": "已启动",
  "status.resumed": "已恢复",
  "status.upToDate": "已是最新版本",
  "status.unknown": "未知",
  "status.invalid": "无效",
  "status.valid": "有效",
  "status.active": "活跃",
  "status.inactive": "非活跃",
  "status.enabled": "已启用",
  "status.disabled": "已禁用"
};
const cnDatetime = {
  "datetime.format.date": "YYYY-MM-DD",
  "datetime.format.dateTime": "YYYY-MM-DD HH:mm:ss",
  "datetime.format.timeShort": "HH:mm",
  "datetime.format.time": "HH:mm:ss",
  "datetime.format.timeMs": "HH:mm:ss.SSS",
  "datetime.duration.day": "天",
  "datetime.duration.hour": "时",
  "datetime.duration.minute": "分",
  "datetime.duration.second": "秒",
  "datetime.label.date": "日期",
  "datetime.label.time": "时间",
  "datetime.label.nextRun": "下次运行",
  "datetime.label.estimatedCompletion": "预计完成时间",
  "datetime.label.createdAt": "创建于",
  "datetime.relative.justNow": "刚刚播放",
  "datetime.relative.minutesAgo": "{{n}} 分钟前播放",
  "datetime.relative.hoursAgo": "{{n}} 小时前播放",
  "datetime.relative.daysAgo": "{{n}} 天前播放",
  "datetime.action.hideTimeInfo": "隐藏时间信息",
  "datetime.action.showTimeInfo": "显示时间信息"
};
const cnEnums = {
  "enum.propertyType.singleLineText": "单行文本",
  "enum.propertyType.multilineText": "多行文本",
  "enum.propertyType.singleChoice": "单选",
  "enum.propertyType.multipleChoice": "多选",
  "enum.propertyType.number": "数字",
  "enum.propertyType.percentage": "百分比",
  "enum.propertyType.rating": "评分",
  "enum.propertyType.boolean": "是/否",
  "enum.propertyType.link": "链接",
  "enum.propertyType.attachment": "附件",
  "enum.propertyType.date": "日期",
  "enum.propertyType.dateTime": "日期时间",
  "enum.propertyType.time": "时间",
  "enum.propertyType.formula": "公式",
  "enum.propertyType.multilevel": "多级选项",
  "enum.propertyType.tags": "标签",
  "enum.standardValueType.string": "文本",
  "enum.standardValueType.listString": "多个文本",
  "enum.standardValueType.decimal": "数字",
  "enum.standardValueType.link": "链接",
  "enum.standardValueType.boolean": "是/否",
  "enum.standardValueType.dateTime": "日期时间",
  "enum.standardValueType.time": "时间",
  "enum.standardValueType.listListString": "多级文本",
  "enum.standardValueType.listTag": "标签",
  "enum.searchOperation.equals": "等于",
  "enum.searchOperation.notEquals": "不等于",
  "enum.searchOperation.contains": "包含",
  "enum.searchOperation.notContains": "不包含",
  "enum.searchOperation.startsWith": "前缀等于",
  "enum.searchOperation.notStartsWith": "前缀不等于",
  "enum.searchOperation.endsWith": "后缀等于",
  "enum.searchOperation.notEndsWith": "后缀不等于",
  "enum.searchOperation.greaterThan": "大于",
  "enum.searchOperation.lessThan": "小于",
  "enum.searchOperation.greaterThanOrEquals": "大于等于",
  "enum.searchOperation.lessThanOrEquals": "小于等于",
  "enum.searchOperation.isNull": "为空",
  "enum.searchOperation.isNotNull": "不为空",
  "enum.searchOperation.in": "在选项中",
  "enum.searchOperation.notIn": "不在选项中",
  "enum.searchOperation.matches": "正则匹配",
  "enum.searchOperation.notMatches": "正则不匹配",
  "enum.propertyValueScope.manual": "手动",
  "enum.propertyValueScope.synchronization": "同步",
  "enum.propertyValueScope.bakabaseEnhancer": "Bakabase 增强器",
  "enum.propertyValueScope.exHentaiEnhancer": "ExHentai 增强器",
  "enum.propertyValueScope.bangumiEnhancer": "Bangumi 增强器",
  "enum.propertyValueScope.dlsiteEnhancer": "DLsite 增强器",
  "enum.propertyValueScope.regexEnhancer": "正则表达式增强器",
  "enum.propertyValueScope.kodiEnhancer": "Kodi 增强器",
  "enum.propertyValueScope.tmdbEnhancer": "TMDb 增强器",
  "enum.propertyValueScope.avEnhancer": "AV 增强器",
  "PropertyValueScope.Manual": "手动",
  "PropertyValueScope.Synchronization": "同步",
  "PropertyValueScope.BakabaseEnhancer": "Bakabase 增强器",
  "PropertyValueScope.ExHentaiEnhancer": "ExHentai 增强器",
  "PropertyValueScope.BangumiEnhancer": "Bangumi 增强器",
  "PropertyValueScope.DLsiteEnhancer": "DLsite 增强器",
  "PropertyValueScope.RegexEnhancer": "正则表达式增强器",
  "PropertyValueScope.KodiEnhancer": "Kodi 增强器",
  "PropertyValueScope.TmdbEnhancer": "TMDb 增强器",
  "PropertyValueScope.AvEnhancer": "AV 增强器",
  "BulkModificationProcessorValueType.ManuallyInput": "手动输入",
  "BulkModificationProcessorValueType.Variable": "变量",
  "PropertyType.SingleLineText": "单行文本",
  "PropertyType.MultilineText": "多行文本",
  "PropertyType.SingleChoice": "单选",
  "PropertyType.MultipleChoice": "多选",
  "PropertyType.Number": "数字",
  "PropertyType.Percentage": "百分比",
  "PropertyType.Rating": "评分",
  "PropertyType.Boolean": "是/否",
  "PropertyType.Link": "链接",
  "PropertyType.Attachment": "附件",
  "PropertyType.Date": "日期",
  "PropertyType.DateTime": "日期时间",
  "PropertyType.Time": "时间",
  "PropertyType.Formula": "公式",
  "PropertyType.Multilevel": "多级选项",
  "PropertyType.Tags": "标签",
  "PropertyPool.Internal": "内置",
  "PropertyPool.Reserved": "保留",
  "PropertyPool.Custom": "自定义",
  "PropertyPool.All": "全部",
  "PropertyPool.Abbreviation.Internal": "内",
  "PropertyPool.Abbreviation.Reserved": "保",
  "PropertyPool.Abbreviation.Custom": "自",
  "PropertyPool.Abbreviation.All": "全",
  "bulkModification.label.useAny": "使用{{any}}",
  "bulkModification.label.editor": "编辑器",
  "enum.bulkModificationFilterOperation.equals": "等于",
  "enum.bulkModificationFilterOperation.notEquals": "不等于",
  "enum.bulkModificationFilterOperation.contains": "包含",
  "enum.bulkModificationFilterOperation.notContains": "不包含",
  "enum.bulkModificationFilterOperation.startsWith": "前缀等于",
  "enum.bulkModificationFilterOperation.notStartsWith": "前缀不等于",
  "enum.bulkModificationFilterOperation.endsWith": "后缀等于",
  "enum.bulkModificationFilterOperation.notEndsWith": "后缀不等于",
  "enum.bulkModificationFilterOperation.greaterThan": "大于",
  "enum.bulkModificationFilterOperation.lessThan": "小于",
  "enum.bulkModificationFilterOperation.greaterThanOrEquals": "大于等于",
  "enum.bulkModificationFilterOperation.lessThanOrEquals": "小于等于",
  "enum.bulkModificationFilterOperation.isNull": "为空",
  "enum.bulkModificationFilterOperation.isNotNull": "不为空",
  "enum.bulkModificationFilterOperation.in": "在列表中",
  "enum.bulkModificationFilterOperation.notIn": "不在列表中",
  "enum.bulkModificationFilterOperation.matches": "正则匹配",
  "enum.bulkModificationFilterOperation.notMatches": "正则不匹配",
  "enum.resourceTag.isParent": "是父级",
  "enum.resourceTag.pinned": "已置顶",
  "enum.resourceTag.pathDoesNotExist": "路径不存在",
  "enum.resourceTag.unknownMediaLibrary": "未知媒体库",
  "enum.durationUnit.day": "天",
  "enum.durationUnit.hour": "小时",
  "enum.durationUnit.minute": "分钟",
  "enum.durationUnit.second": "秒",
  "enum.combinator.and": "且",
  "enum.combinator.or": "或",
  "enum.builtinPropertyForDisplayName.filename": "文件名",
  "enum.bulkModificationTimeProcessOperation.delete": "删除",
  "enum.bulkModificationTimeProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationTimeProcessOperation.addHours": "增加小时",
  "enum.bulkModificationTimeProcessOperation.subtractHours": "减少小时",
  "enum.bulkModificationTimeProcessOperation.addMinutes": "增加分钟",
  "enum.bulkModificationTimeProcessOperation.subtractMinutes": "减少分钟",
  "enum.bulkModificationTimeProcessOperation.addSeconds": "增加秒数",
  "enum.bulkModificationTimeProcessOperation.subtractSeconds": "减少秒数",
  "enum.bulkModificationStringProcessOperation.delete": "删除",
  "enum.bulkModificationStringProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationStringProcessOperation.addToStart": "添加到开头",
  "enum.bulkModificationStringProcessOperation.addToEnd": "添加到结尾",
  "enum.bulkModificationStringProcessOperation.addToAnyPosition": "添加到任意位置",
  "enum.bulkModificationStringProcessOperation.removeFromStart": "从开头移除",
  "enum.bulkModificationStringProcessOperation.removeFromEnd": "从结尾移除",
  "enum.bulkModificationStringProcessOperation.removeFromAnyPosition": "从任意位置移除",
  "enum.bulkModificationStringProcessOperation.replaceFromStart": "从开头替换",
  "enum.bulkModificationStringProcessOperation.replaceFromEnd": "从结尾替换",
  "enum.bulkModificationStringProcessOperation.replaceFromAnyPosition": "从任意位置替换",
  "enum.bulkModificationStringProcessOperation.replaceWithRegex": "使用正则表达式替换",
  "enum.bulkModificationListTagProcessOperation.delete": "删除",
  "enum.bulkModificationListTagProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationListTagProcessOperation.append": "追加",
  "enum.bulkModificationListTagProcessOperation.prepend": "前置",
  "enum.bulkModificationListTagProcessOperation.remove": "移除",
  "enum.bulkModificationListStringProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationListStringProcessOperation.append": "追加",
  "enum.bulkModificationListStringProcessOperation.prepend": "前置",
  "enum.bulkModificationListStringProcessOperation.modify": "修改",
  "enum.bulkModificationListStringProcessOperation.delete": "删除",
  "enum.bulkModificationListListStringProcessOperation.delete": "删除",
  "enum.bulkModificationListListStringProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationListListStringProcessOperation.append": "追加",
  "enum.bulkModificationListListStringProcessOperation.prepend": "前置",
  "enum.bulkModificationListListStringProcessOperation.remove": "移除",
  "enum.bulkModificationLinkProcessOperation.delete": "删除",
  "enum.bulkModificationLinkProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationLinkProcessOperation.setText": "设置文本",
  "enum.bulkModificationLinkProcessOperation.setUrl": "设置链接",
  "enum.bulkModificationLinkProcessOperation.modifyText": "修改文本",
  "enum.bulkModificationLinkProcessOperation.modifyUrl": "修改链接",
  "enum.bulkModificationDecimalProcessOperation.delete": "删除",
  "enum.bulkModificationDecimalProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationDecimalProcessOperation.add": "加",
  "enum.bulkModificationDecimalProcessOperation.subtract": "减",
  "enum.bulkModificationDecimalProcessOperation.multiply": "乘",
  "enum.bulkModificationDecimalProcessOperation.divide": "除",
  "enum.bulkModificationDecimalProcessOperation.round": "四舍五入",
  "enum.bulkModificationDecimalProcessOperation.ceil": "向上取整",
  "enum.bulkModificationDecimalProcessOperation.floor": "向下取整",
  "enum.bulkModificationDateTimeProcessOperation.delete": "删除",
  "enum.bulkModificationDateTimeProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationDateTimeProcessOperation.addDays": "增加天数",
  "enum.bulkModificationDateTimeProcessOperation.subtractDays": "减少天数",
  "enum.bulkModificationDateTimeProcessOperation.addMonths": "增加月数",
  "enum.bulkModificationDateTimeProcessOperation.subtractMonths": "减少月数",
  "enum.bulkModificationDateTimeProcessOperation.addYears": "增加年数",
  "enum.bulkModificationDateTimeProcessOperation.subtractYears": "减少年数",
  "enum.bulkModificationDateTimeProcessOperation.setToNow": "设置为当前时间",
  "enum.bulkModificationBooleanProcessOperation.delete": "删除",
  "enum.bulkModificationBooleanProcessOperation.setWithFixedValue": "设置为固定值",
  "enum.bulkModificationBooleanProcessOperation.toggle": "切换",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.all": "全部",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.containing": "包含",
  "enum.bulkModificationProcessorOptionsItemsFilterBy.matching": "匹配",
  "BangumiSubjectType.All": "全部",
  "BangumiSubjectType.Anime": "动画",
  "BangumiSubjectType.Book": "书籍",
  "BangumiSubjectType.Music": "音乐",
  "BangumiSubjectType.Game": "游戏",
  "BangumiSubjectType.Real": "三次元",
  "CoverSelectOrder.FilenameAscending": "文件名升序",
  "CoverSelectOrder.FileModifyDtDescending": "文件修改时间降序",
  "enhancer.bangumi.prioritySubjectType.label": "优先类别",
  "enhancer.bangumi.prioritySubjectType.description": "如果设置了此选项，Bangumi 将首先使用该类别进行搜索。如果没有找到结果，则会回退到搜索全部类别。",
  "enhancer.bangumi.prioritySubjectType.hint": "留空则默认搜索全部类别。"
};
const cnDashboard = {
  "dashboard.stat.totalResources": "资源总数",
  "dashboard.stat.libraryCount": "{{count}} 个媒体库",
  "dashboard.stat.thisWeek": "本周",
  "dashboard.stat.trend": "趋势",
  "dashboard.stat.weeks": "12 周",
  "dashboard.stat.dataCompleteness": "数据完整度",
  "dashboard.action.search": "搜索",
  "dashboard.action.browseLibraries": "浏览媒体库",
  "dashboard.action.bulkOperations": "批量操作",
  "dashboard.action.randomPick": "随机播放",
  "dashboard.action.viewAll": "查看全部",
  "dashboard.action.addResources": "添加资源",
  "dashboard.tab.recentlyAdded": "最近添加",
  "dashboard.tab.recentlyPlayed": "最近播放",
  "dashboard.tab.pinned": "已固定",
  "dashboard.empty.noResources": "暂无资源",
  "dashboard.empty.noPlayHistory": "暂无播放记录",
  "dashboard.empty.noPinned": "暂无固定资源",
  "dashboard.section.libraryDistribution": "媒体库分布"
};
const cnResource = {
  "resource.search.placeholder": "搜索全部",
  "resource.search.button": "搜索",
  "resource.search.newTab": "在新标签页中查看",
  "resource.search.searching": "搜索中...",
  "resource.search.loadedInPage": "当前页面加载的资源",
  "resource.search.selectAll": "全选",
  "resource.search.selectedCount": "已选 {{count}} 项",
  "resource.search.loadedResources": "已加载资源",
  "resource.search.allFiltered": "所有筛选结果",
  "resource.search.selectAllFiltered": "选择全部 {{count}} 个筛选结果（包括尚未加载的）。",
  "resource.search.playlist": "播放列表",
  "resource.search.recentlyPlayed": "最近播放",
  "resource.empty.title": "未找到资源",
  "resource.empty.checkCriteria": "检查搜索条件",
  "resource.empty.checkCriteriaDesc": "当前的筛选条件可能过于严格，尝试重置搜索条件以显示所有资源。",
  "resource.empty.resetCriteria": "重置搜索条件",
  "resource.empty.addToLibrary": "添加媒体库",
  "resource.empty.addToLibraryDesc": "媒体库用于定义哪些文件夹包含您的资源。请确保您的资源所在的文件夹已被添加到媒体库中。",
  "resource.empty.goToLibrary": "前往媒体库",
  "resource.empty.configurePathMark": "配置路径标记",
  "resource.empty.configurePathMarkDesc": "路径标记用于定义如何识别和解析资源。通过配置路径标记规则，系统可以从文件路径中提取资源名称、标签等信息。",
  "resource.empty.goToPathMarkConfig": "前往配置",
  "resource.order.label": "排序",
  "resource.order.placeholder": "选择排序方式",
  "resource.order.asc": "升序",
  "resource.order.desc": "降序",
  "ResourceSearchSortableProperty.FileCreateDt": "文件创建时间",
  "ResourceSearchSortableProperty.FileModifyDt": "文件修改时间",
  "ResourceSearchSortableProperty.Filename": "文件名",
  "ResourceSearchSortableProperty.AddDt": "添加时间",
  "ResourceSearchSortableProperty.PlayedAt": "上次播放时间",
  "resource.display.title": "显示选项",
  "resource.display.columnCount": "列数",
  "resource.display.fillCover": "填充封面",
  "resource.display.hoverLargeCover": "鼠标悬停时显示大封面",
  "resource.display.previewFiles": "鼠标悬停时预览资源文件",
  "resource.display.autoSelectFile": "存在多个可播放文件时自动选择第一个",
  "resource.display.inlineNameTags": "同行显示名称和标签",
  "resource.display.inlineNameTagsDesc": "要同行显示名称和标签，您需要先设置显示属性",
  "resource.display.useCache": "使用缓存",
  "resource.display.useCacheDesc": "使用缓存资源以提高加载速度。如果缓存未更新，可能会显示旧数据。",
  "resource.display.manageCache": "管理缓存",
  "resource.display.coverCarousel": "封面轮播",
  "resource.display.showResourceId": "显示资源 ID",
  "resource.display.hideResourceBorder": "隐藏资源边框",
  "resource.display.filterOptionsCollapseThreshold": "筛选选项折叠阈值",
  "resource.display.filterOptionsCollapseThresholdDesc": "已选的选项一定会全部显示，最多显示此数量的选项",
  "resource.display.reset": "重置",
  "resource.display.operations": "显示操作按钮",
  "resource.display.aggregateButton": "聚合按钮",
  "resource.display.pinUnpin": "固定/取消固定",
  "resource.display.openFolder": "打开文件夹",
  "resource.display.enhancements": "增强",
  "resource.display.preview": "预览",
  "resource.display.addToPlaylist": "添加到播放列表",
  "resource.display.properties": "显示属性",
  "resource.display.selectedProperties": "已选择",
  "resource.display.selectProperties": "选择属性",
  "resource.shortcut.title": "快捷键",
  "resource.recentlyPlayed.title": "最近播放",
  "resource.recentlyPlayed.count": "{{count}} 个资源",
  "resource.recentlyPlayed.empty": "没有最近播放的资源"
};
const cnConfiguration = {
  "configuration.dependency.title": "依赖组件",
  "configuration.dependency.defaultLocation": "默认位置",
  "configuration.dependency.curlExecutable": "curl 可执行文件",
  "configuration.dependency.curlPlaceholder": "path/to/curl.exe",
  "configuration.dependency.ollamaEndpoint": "Ollama 端点",
  "configuration.dependency.notInstalled": "未安装",
  "configuration.dependency.checkingVersion": "正在检查新版本",
  "configuration.dependency.clickToUpdate": "点击更新至版本",
  "configuration.dependency.updating": "更新中",
  "configuration.dependency.failedToGetVersion": "获取新版本信息失败",
  "configuration.thirdParty.title": "第三方配置",
  "configuration.thirdParty.validateCookie": "验证 Cookie",
  "configuration.thirdParty.cookieValid": "Cookie 有效",
  "configuration.thirdParty.invalidCookie": "无效的 Cookie",
  "configuration.functional.title": "功能配置",
  "configuration.functional.startupPage": "启动页面",
  "configuration.functional.startupPage.default": "默认",
  "configuration.functional.startupPage.resource": "资源",
  "configuration.functional.exitBehavior": "退出行为",
  "configuration.functional.exitBehavior.minimize": "最小化",
  "configuration.functional.exitBehavior.exit": "退出",
  "configuration.functional.exitBehavior.prompt": "询问",
  "configuration.contact.title": "联系我们",
  "configuration.appInfo.title": "系统信息",
  "configuration.appInfo.appDataPath": "应用数据路径",
  "configuration.appInfo.dataPath": "数据路径",
  "configuration.appInfo.tempFilesPath": "临时文件路径",
  "configuration.appInfo.logPath": "日志路径",
  "configuration.appInfo.backupPath": "备份路径",
  "configuration.appInfo.coreVersion": "核心版本",
  "configuration.appInfo.latestVersion": "最新版本",
  "configuration.appInfo.upToDate": "已是最新",
  "configuration.appInfo.failedToGetLatestVersion": "获取最新版本失败",
  "configuration.appInfo.changelog": "更新日志",
  "configuration.appInfo.clickToAutoUpdate": "点击自动更新",
  "configuration.appInfo.autoUpdateFails": "自动更新失败？点击下载完整安装包",
  "configuration.appInfo.restartToUpdate": "重启以更新",
  "configuration.appInfo.failedToUpdateApp": "更新应用失败",
  "configuration.appInfo.clickToRetry": "点击此处重试",
  "configuration.appInfo.downloading": "下载中",
  "configuration.appInfo.tip.appDataPath": "这是存储核心数据文件的位置，如非必要请勿更改。[系统] - [日志] 中的日志保存在 bootstrap_log.* 文件中，可以安全删除。",
  "configuration.appInfo.tip.dataPath": "这是存储用户文件、封面等数据的目录。",
  "configuration.appInfo.tip.tempFilesPath": "这是存储临时文件的目录。",
  "configuration.appInfo.tip.logPath": "描述应用运行状态的详细信息。如果应用运行异常，您可以将日志文件发送给开发者；如果一切正常，也可以删除它们。",
  "configuration.appInfo.tip.backupPath": "首次使用新版本应用时会创建数据备份，如果一切正常可以删除它们。您可以下载相应版本的应用，使用备份文件覆盖应用数据路径来恢复数据。",
  "configuration.others.title": "其他设置",
  "configuration.others.proxy": "代理",
  "configuration.others.proxy.tip": "您可以为网络请求设置代理，例如 socks5://127.0.0.1:18888",
  "configuration.others.proxy.doNotUse": "不使用代理",
  "configuration.others.proxy.useSystem": "使用系统代理",
  "configuration.others.proxy.addModal.title": "添加代理",
  "configuration.others.enablePreRelease": "启用预发布渠道",
  "configuration.others.enablePreRelease.tip": "优先使用具有新功能但稳定性较低的预发布版本",
  "configuration.others.enableTracking": "启用匿名数据追踪",
  "configuration.others.enableTracking.tip": "我们使用 Microsoft Clarity 追踪匿名数据，这将帮助我们改进产品体验。",
  "configuration.others.maxParallelism": "最大并行度",
  "configuration.others.maxParallelism.tip": "CPU 密集型操作的最大并行度。设为 1 禁用并行。留空使用默认值（CPU 核心数的一半）。",
  "configuration.development.title": "开发",
  "configuration.development.apiEndpoints": "API 端点",
  "configuration.development.apiDocument": "API 文档",
  "configuration.development.listeningPortCount": "监听端口数量",
  "configuration.development.listeningPorts": "监听端口",
  "configuration.development.auto": "自动",
  "configuration.development.count": "数量",
  "configuration.development.tip.currentListeningPortCount": "当前监听端口数量为 {{port}}",
  "configuration.development.tip.configurablePortRange": "可配置端口范围为 {{min}}-{{max}}。设为 0 表示自动计数。",
  "configuration.development.tip.changesAfterRestart": "更改将在重启应用后生效",
  "configuration.development.tip.portWarning": "请谨慎设置此值，如果设置的值已被其他应用占用，我们的应用将无法启动。",
  "configuration.development.tip.portsInput": "输入以逗号分隔的端口，例如 34567, 34568",
  "configuration.development.input.portsPlaceholder": "例如 34567, 34568",
  "configuration.development.error.tooManyPorts": "端口过多。最多支持 {{max}} 个端口。"
};
const Idle = "空闲";
const InQueue = "排队中";
const Starting = "启动中";
const Downloading = "下载中";
const Stopping = "停止中";
const Complete = "已完成";
const Failed = "失败";
const Disabled = "已禁用";
const cnDownloader = {
  "downloader.confirm.conflictedTasks": "发现冲突的任务",
  "downloader.action.downloadSelectedFirst": "优先下载选中的任务",
  "downloader.action.addToQueue": "将选中的任务加入队列",
  "downloader.action.bulk": "批量",
  "downloader.action.start": "开始",
  "downloader.action.stop": "停止",
  "downloader.confirm.deleteTasks": "正在删除 {{count}} 个下载任务",
  "downloader.confirm.clearCheckpoints": "清除 {{count}} 个任务的检查点",
  "downloader.confirm.clearCheckpoint": "清除检查点",
  "downloader.action.clearCheckpoints": "清除检查点",
  "downloader.filter.source": "来源",
  "downloader.filter.status": "状态",
  "downloader.filter.keyword": "关键字",
  "downloader.action.createTask": "创建任务",
  "downloader.action.startAll": "全部开始",
  "downloader.action.stopAll": "全部停止",
  "downloader.action.cleanup": "清理",
  "downloader.action.deleteCompleted": "删除所有已完成的任务",
  "downloader.action.deleteFailed": "删除所有失败的任务",
  "downloader.action.exportAll": "导出所有任务",
  "downloader.action.configurations": "配置",
  "downloader.empty.noTasks": "未找到任务",
  "downloader.label.nextStartTime": "下次开始时间",
  "downloader.label.createdAt": "创建于",
  "downloader.confirm.deleteTask": "确定要删除吗？",
  "downloader.modal.configurations": "配置",
  "downloader.modal.creatingTask": "创建下载任务",
  "downloader.modal.taskDetail": "下载任务",
  "downloader.label.site": "站点",
  "downloader.label.taskType": "任务类型",
  "downloader.status.notAvailable": "不可用",
  "downloader.label.allowDuplicate": "允许重复提交",
  "downloader.tip.allowDuplicateDesc": "通常情况下，不需要创建相同的任务。",
  "downloader.label.autoRetry": "自动重试",
  "downloader.tip.autoRetryDesc": "下载任务失败时自动重试。",
  "downloader.tip.checkpointManual": "您可以手动设置之前的下载检查点，以使下载器从该检查点开始下载任务。",
  "downloader.tip.checkpointAuto": "在大多数情况下，您应该让下载器自动设置此字段。",
  "downloader.tip.checkpointFormat": "每个下载器都有自己的检查点格式，无效的检查点数据将被忽略。您可以在我们的在线文档中找到示例。",
  "downloader.label.requestsOverview": "请求概览",
  "downloader.label.success": "成功",
  "downloader.label.failure": "失败",
  "downloader.label.checkInterval": "检查间隔（秒）",
  "downloader.tip.checkIntervalDesc": "下载完成或失败后重新启动任务的间隔（以秒为单位）。通常用于下载定期更新的内容。",
  Idle,
  InQueue,
  Starting,
  Downloading,
  Stopping,
  Complete,
  Failed,
  Disabled,
  "Cookie required for authentication": "用于身份验证的 Cookie",
  "Default download path": "默认下载路径",
  "Default path where downloads will be saved": "下载文件的默认保存路径",
  "Maximum concurrent download threads": "最大并发下载线程数",
  "Max concurrency": "最大并发数",
  "Request interval help": "每次请求之间的等待时间，用于避免请求过于频繁",
  "Request interval (s)": "请求间隔（秒）",
  "Define how downloaded files should be named": "定义下载文件的命名方式",
  "Available fields": "可用字段",
  "Naming convention": "命名规则",
  "Download path": "下载路径",
  "Select download path": "选择下载路径",
  "Set a page range if you don't want to download them all.": "如果不想全部下载，可以设置页码范围。",
  "The minimal page number is 1.": "最小页码为 1。",
  "Start page": "起始页",
  "End page": "结束页",
  "downloader.label.preferTorrent": "优先下载种子",
  "downloader.tip.preferTorrentDesc": "如果可用，优先下载种子文件而非直接下载图片。",
  "downloader.tip.exHentaiUserscript": "您可以使用我们提供的油猴脚本在 ExHentai 网站上一键下载。",
  "downloader.tip.goToThirdPartyIntegration": "前往第三方集成页面"
};
const cnFileProcessor = {
  "fileProcessor.action.bulkDecompression": "批量解压当前文件夹中的所有压缩文件",
  "fileProcessor.tip.operationsAfterPlay": "通常在分类文件时这个功能很有用。",
  "fileProcessor.label.showOperationsAfterPlay": "播放第一个文件后显示操作",
  "fileProcessor.modal.afterFirstPlayTitle": "我们注意到您播放了此路径中的第一个文件。您想要执行以下操作吗？",
  "fileProcessor.label.currentPath": "当前路径",
  "fileProcessor.tip.moveToAnotherPath": "您可以将其移动到其他路径。",
  "fileProcessor.tip.orDeleteIt": "或者删除它？"
};
const cnMediaLibrary = {
  "mediaLibrary.title": "媒体库",
  "mediaLibrary.action.add": "添加媒体库",
  "mediaLibrary.action.delete": "删除",
  "mediaLibrary.action.cancel": "取消",
  "mediaLibrary.action.continue": "继续",
  "mediaLibrary.action.createFirst": "创建你的第一个媒体库",
  "mediaLibrary.action.goToPathMarkConfig": "配置路径标记",
  "mediaLibrary.action.searchResources": "搜索此媒体库中的资源",
  "mediaLibrary.confirm.title": "确认",
  "mediaLibrary.confirm.delete": "确定要删除此媒体库吗？",
  "mediaLibrary.confirm.leavePage": "这将跳转到资源页面，是否继续？",
  "mediaLibrary.error.nameEmpty": "名称不能为空",
  "mediaLibrary.warning.irreversible": "注意，此操作不可撤销",
  "mediaLibrary.tooltip.delete": "删除此媒体库",
  "mediaLibrary.tooltip.resourceLoaded": "此媒体库中已加载 {{count}} 个资源。",
  "mediaLibrary.tooltip.noResource": "此媒体库中没有加载资源，您可以点击同步按钮来加载资源。",
  "mediaLibrary.label.resources": "个资源",
  "mediaLibrary.label.listDescription": "在此管理您的媒体库",
  "mediaLibrary.label.pathMarkConfigHint": "下一步：前往路径标记配置页面，选择文件或目录，配置资源类型并关联到媒体库",
  "mediaLibrary.emptyState.title": "暂无媒体库",
  "mediaLibrary.emptyState.description": "创建媒体库来组织和管理您的资源",
  "mediaLibrary.emptyState.feature1": "按分类组织资源",
  "mediaLibrary.emptyState.feature2": "应用增强器提取元数据",
  "mediaLibrary.emptyState.feature3": "同步和管理多个根路径"
};
const cnPathMark = {};
const cnResourceProfile = {
  "resourceProfile.confirm.delete": "确定要删除此资源扩展吗？",
  "resourceProfile.label.priority": "优先级",
  "resourceProfile.label.name": "名称",
  "resourceProfile.label.searchCriteria": "搜索条件",
  "resourceProfile.label.nameTemplate": "名称模板",
  "resourceProfile.label.enhancers": "增强器",
  "resourceProfile.label.playableFiles": "可播放文件",
  "resourceProfile.label.players": "播放器",
  "resourceProfile.label.properties": "属性",
  "resourceProfile.label.actions": "操作",
  "resourceProfile.label.total": "总计",
  "resourceProfile.tip.priority": "数字越小优先级越高。优先级越高的配置会先匹配。当多个配置匹配同一资源时，优先级最高的生效。",
  "resourceProfile.tip.name": "用于标识此配置的唯一名称。",
  "resourceProfile.tip.searchCriteria": "定义此配置适用于哪些资源。匹配这些条件的资源将使用此配置的设置。",
  "resourceProfile.tip.nameTemplate": "使用属性占位符（如 {Name}）自定义资源名称的显示方式。留空则使用原始文件名。",
  "resourceProfile.tip.playableFiles": "识别资源中哪些文件可播放的规则。可按文件扩展名或文件名模式配置。",
  "resourceProfile.tip.players": "用于打开可播放文件的外部应用程序。可为不同的文件扩展名指定不同的播放器。默认情况下我们使用系统自带的方式打开可播放文件。",
  "resourceProfile.tip.properties": "选择匹配此配置的资源应显示或可编辑哪些属性。",
  "resourceProfile.tip.configureEnhancers": "点击配置增强器",
  "resourceProfile.action.testCriteria": "测试条件",
  "resourceProfile.action.editBasicInfo": "编辑基本信息",
  "resourceProfile.action.duplicate": "复制",
  "resourceProfile.action.deleteEnhancements": "删除增强数据",
  "resourceProfile.action.addProfile": "添加资源扩展",
  "resourceProfile.action.searchByName": "按名称搜索",
  "resourceProfile.status.loading": "加载中...",
  "resourceProfile.empty.noProfiles": "未找到配置",
  "resourceProfileGuide.viewAgain": "再次查看引导",
  "resourceProfileGuide.welcome.title": "欢迎使用资源扩展",
  "resourceProfileGuide.welcome.description": "资源扩展帮助您自定义不同类型资源的显示、匹配和播放方式。让我们开始吧！",
  "resourceProfileGuide.matching.title": "搜索条件与优先级",
  "resourceProfileGuide.matching.subtitle": "控制每个配置适用于哪些资源",
  "resourceProfileGuide.matching.point1": "定义搜索条件，根据资源属性自动匹配资源",
  "resourceProfileGuide.matching.point2": "设置优先级，确定多个配置匹配时哪个生效",
  "resourceProfileGuide.display.title": "显示与增强器",
  "resourceProfileGuide.display.subtitle": "自定义资源的呈现方式",
  "resourceProfileGuide.display.point1": "使用属性占位符创建自定义名称模板",
  "resourceProfileGuide.display.point2": "配置增强器自动丰富资源元数据",
  "resourceProfileGuide.display.point3": "为每个配置选择要显示的属性",
  "resourceProfileGuide.playback.title": "播放配置",
  "resourceProfileGuide.playback.subtitle": "设置文件的打开和播放方式",
  "resourceProfileGuide.playback.point1": "定义哪些文件扩展名被视为可播放",
  "resourceProfileGuide.playback.point2": "为不同文件类型配置外部播放器",
  "resourceProfileGuide.binding.title": "属性绑定",
  "resourceProfileGuide.binding.subtitle": "为不同配置绑定不同的属性值",
  "resourceProfileGuide.binding.point1": "为配置绑定特定的属性值，便于更好地组织资源",
  "resourceProfileGuide.binding.point2": "绑定的属性会被优先展示在资源详情中",
  "resourceProfileGuide.skip": "跳过",
  "resourceProfileGuide.previous": "上一步",
  "resourceProfileGuide.next": "下一步",
  "resourceProfileGuide.getStarted": "开始使用",
  "resourceProfile.modal.deleteEnhancementsTitle": "删除增强数据",
  "resourceProfile.modal.configurePlayersTitle": "配置播放器",
  "resourceProfile.modal.testSearchCriteriaTitle": "测试搜索条件",
  "resourceProfile.label.allEnhancers": "所有增强器",
  "resourceProfile.label.selectEnhancer": "选择增强器",
  "resourceProfile.label.deleteEmptyRecordsOnly": "仅删除空记录",
  "resourceProfile.label.newPlayer": "新播放器",
  "resourceProfile.label.extensions": "扩展名",
  "resourceProfile.label.invalid": "无效",
  "resourceProfile.label.executablePath": "可执行文件路径",
  "resourceProfile.label.commandTemplate": "命令模板",
  "resourceProfile.label.supportedExtensions": "支持的扩展名",
  "resourceProfile.label.commandPreviewTest": "命令预览和测试",
  "resourceProfile.label.testFilePath": "测试文件路径",
  "resourceProfile.label.generatedCommand": "生成的命令",
  "resourceProfile.label.totalMatchingResources": "匹配的资源总数",
  "resourceProfile.label.showLimit": "显示限制",
  "resourceProfile.label.unnamed": "未命名",
  "resourceProfile.tip.deleteEnhancementsForProfile": "删除与配置匹配的资源的增强数据",
  "resourceProfile.tip.noEnhancersConfigured": "此配置未配置增强器。将删除匹配资源的所有增强数据。",
  "resourceProfile.tip.deleteEmptyRecordsOnlyDescription": "仅删除没有实际增强数据的增强记录",
  "resourceProfile.tip.pathToPlayerExecutable": "播放器可执行文件的路径",
  "resourceProfile.tip.commandTemplatePlaceholder": "使用 {0} 作为文件路径占位符。例如：--fullscreen {0}",
  "resourceProfile.tip.playerExtensionUsage": "此播放器将用于这些扩展名的文件",
  "resourceProfile.tip.enterFilePathPreview": "输入文件路径以预览命令",
  "resourceProfile.tip.testPathIsFolder": "注意：测试路径是文件夹，不是文件",
  "resourceProfile.status.testingCriteria": "正在测试条件...",
  "resourceProfile.status.playersConfigured": "已配置 {{count}} 个播放器",
  "resourceProfile.status.noPlayersConfigured": "未配置播放器",
  "resourceProfile.status.showingOfTotal": "显示 {{shown}} / {{total}} 个匹配资源",
  "resourceProfile.action.addPlayer": "添加播放器",
  "resourceProfile.action.copied": "已复制！",
  "resourceProfile.action.copyToClipboard": "复制到剪贴板",
  "resourceProfile.input.filterResults": "筛选结果...",
  "resourceProfile.empty.noPlayersConfiguredGetStarted": "未配置播放器。点击「添加播放器」开始。",
  "resourceProfile.empty.noResourcesMatchFilter": "没有资源匹配您的筛选条件",
  "resourceProfile.empty.noResourcesMatchedByCriteria": "没有资源匹配此条件",
  "resourceProfile.error.executablePathRequired": "可执行文件路径为必填项",
  "resourceProfile.error.selectFileNotFolder": "请选择文件，而不是文件夹",
  "resourceProfile.error.fillAllExecutablePaths": "请在保存前填写所有可执行文件路径。",
  "resourceProfile.warning.cannotBeUndone": "警告：此操作无法撤销。",
  "resourceProfile.modal.selectEnhancersTitle": "选择增强器",
  "resourceProfile.modal.playableFileOptionsTitle": "可播放文件选项",
  "resourceProfile.modal.editResourceProfileTitle": "编辑资源扩展",
  "resourceProfile.modal.addResourceProfileTitle": "添加资源扩展",
  "resourceProfile.label.enhanceProperties": "增强属性",
  "resourceProfile.label.more": "更多",
  "resourceProfile.label.selected": "已选择",
  "resourceProfile.label.quickAddPresets": "快速添加预设",
  "resourceProfile.label.video": "视频",
  "resourceProfile.label.audio": "音频",
  "resourceProfile.label.image": "图片",
  "resourceProfile.label.document": "文档",
  "resourceProfile.label.archive": "压缩包",
  "resourceProfile.label.fileExtensions": "文件扩展名",
  "resourceProfile.label.fileNamePattern": "文件名模式",
  "resourceProfile.label.currentConfiguration": "当前配置",
  "resourceProfile.label.extensionsLabel": "扩展名",
  "resourceProfile.label.pattern": "模式",
  "resourceProfile.label.resourceProfile": "资源扩展",
  "resourceProfile.label.profileName": "配置名称",
  "resourceProfile.action.configure": "配置",
  "resourceProfile.action.clearAll": "清除全部",
  "resourceProfile.tip.filesWithExtensionsPlayable": "具有这些扩展名的文件将被视为可播放",
  "resourceProfile.tip.regexPatternPlayable": "用于匹配可播放文件名的正则表达式（可选，留空则仅按扩展名匹配）",
  "resourceProfile.tip.higherPriorityPrecedence": "优先级较高的配置优先生效",
  "resourceProfile.tip.otherSettingsAfterCreation": "创建后可直接在表格中配置其他设置。",
  "resourceProfile.input.fileNamePatternPlaceholder": "例如：.*\\.(mp4|mkv|avi)$",
  "resourceProfile.error.nameRequired": "名称为必填项",
  "resourceProfile.modal.editDisplayNameTemplateTitle": "编辑资源显示名称模板",
  "resourceProfile.label.availableProperties": "可用属性",
  "resourceProfile.empty.noPropertiesAvailable": "没有可用属性",
  "resourceProfile.label.wrappers": "包装器",
  "resourceProfile.label.template": "模板",
  "resourceProfile.label.preview": "预览",
  "resourceProfile.tip.wrappersRemovedAutomatically": "空属性值周围的包装器将被自动移除。",
  "resourceProfile.input.templatePlaceholder": "输入模板或点击上方属性插入...",
  "resourceProfile.tip.leaveEmptyForFilename": "留空则使用文件名作为显示名称。"
};
const cnBulkModification = {
  "bulkModification.action.add": "添加批量修改",
  "bulkModification.action.addPreprocess": "添加预处理",
  "bulkModification.action.addStep": "添加处理步骤",
  "bulkModification.action.apply": "应用批量修改",
  "bulkModification.action.applyChanges": "应用更改",
  "bulkModification.action.calculate": "计算更改",
  "bulkModification.action.delete": "删除批量修改",
  "bulkModification.action.deleteProcess": "删除当前处理",
  "bulkModification.action.deleteStep": "删除处理步骤",
  "bulkModification.action.deleteVariable": "删除变量",
  "bulkModification.action.duplicate": "复制",
  "bulkModification.action.editName": "编辑批量修改名称",
  "bulkModification.action.revert": "撤销批量修改",
  "bulkModification.action.clickToDisable": "点击禁用",
  "bulkModification.action.clickToEnable": "点击启用",
  "bulkModification.action.filter": "筛选",
  "bulkModification.action.refilter": "重新筛选",
  "bulkModification.action.checkDiffs": "查看 {{count}} 个差异",
  "bulkModification.action.revertChanges": "撤销更改",
  "bulkModification.action.viewFilteredResources": "查看 {{count}} 个筛选的资源",
  "bulkModification.action.goToBulkModificationPage": "前往批量修改页面",
  "bulkModification.message.navigateToPageConfirmation": "确定要离开当前页面吗？未保存的更改可能会丢失。",
  "bulkModification.confirm.delete": "确定要删除此批量修改吗？",
  "bulkModification.confirm.revert": "确定要撤销此批量修改吗？",
  "bulkModification.confirm.deleteStep": "确定要删除此处理步骤吗？",
  "bulkModification.confirm.apply": "请在应用前检查差异，在某些情况下更改的值可能无法完美恢复，确定要应用吗？",
  "bulkModification.confirm.deleteVariable": "确定要删除变量 {{name}} 吗？",
  "bulkModification.confirm.deleteProcess": "确定要删除此处理及其所有处理步骤吗？",
  "bulkModification.label.name": "名称",
  "bulkModification.label.count": "数量",
  "bulkModification.label.diffs": "差异",
  "bulkModification.label.mode": "模式",
  "bulkModification.label.operation": "操作",
  "bulkModification.label.property": "属性",
  "bulkModification.label.resource": "资源",
  "bulkModification.label.steps": "步骤",
  "bulkModification.label.value": "值",
  "bulkModification.label.resourceCount": "{{count}} 个相关资源",
  "bulkModification.label.sequenceNumber": "序号",
  "bulkModification.label.editor": "编辑器",
  "bulkModification.label.start": "开始",
  "bulkModification.label.end": "结束",
  "bulkModification.label.preprocessing": "预处理",
  "bulkModification.label.settingProcess": "设置处理",
  "bulkModification.label.settingVariable": "设置变量",
  "bulkModification.title.processForProperty": "{{property}} 属性的处理流程",
  "bulkModification.title.preprocessForProperty": "{{property}} 属性的预处理流程",
  "bulkModification.label.typeTransformation": "类型转换",
  "bulkModification.label.startsFromZero": "从 0 开始",
  "bulkModification.filter.filterBy": "筛选条件",
  "bulkModification.filter.filterBranches": "按分支筛选",
  "bulkModification.filter.forEachItem": "对每个筛选项",
  "bulkModification.filter.followChanges": "跟随属性更改",
  "bulkModification.filter.resourceFilteredCount": "已筛选出 {{count}} 个资源",
  "bulkModification.select.property": "选择属性",
  "bulkModification.select.propertyValue": "选择属性",
  "bulkModification.select.editor": "选择属性值编辑器",
  "bulkModification.select.scope": "选择属性值范围",
  "bulkModification.select.variable": "请选择变量",
  "bulkModification.select.resources": "选择要修改的资源",
  "bulkModification.empty.noData": "暂无数据",
  "bulkModification.empty.notSet": "未设置",
  "bulkModification.empty.noVariables": "无可用变量",
  "bulkModification.empty.notSupported": "不支持",
  "bulkModification.error.title": "错误",
  "bulkModification.error.checkCriteria": "请检查搜索条件。",
  "bulkModification.error.nameEmpty": "名称不能为空",
  "bulkModification.error.getPropertyFailed": "无法获取属性信息",
  "bulkModification.error.unsupportedValue": "不支持的值",
  "bulkModification.input.setVariableName": "为此变量设置名称",
  "bulkModification.info.addPreprocessSteps": "您可以添加多个预处理步骤。",
  "bulkModification.info.addProcessSteps": "您可以添加多个处理步骤。",
  "bulkModification.info.checkTypeRules": "您可以在此查看类型转换规则",
  "bulkModification.info.typeConversion": "我们将自动把值从 {{fromType}} 转换为 {{toType}}。",
  "bulkModification.info.underDevelopment": "开发中，目前支持的数据类型",
  "bulkModification.info.ensureCalculation": "请确保已执行计算操作。",
  "bulkModification.info.noResourcesToChange": "如果已执行计算操作，可能没有需要更改的资源。",
  "bulkModification.info.preprocessUsage": "如果设置了预处理程序，变量将在使用前先进行预处理。",
  "bulkModification.position.beginning": "开头",
  "bulkModification.position.end": "结尾",
  "bulkModification.textOperation.backward": "向后",
  "bulkModification.textOperation.forward": "向前",
  "bulkModification.status.enabled": "已启用",
  "bulkModification.status.disabled": "已禁用",
  "bulkModification.tip.forMorePowerfulModification": "如果需要更强大灵活的修改能力，请",
  "bulkModification.tip.filters": "选择要修改的资源。",
  "bulkModification.tip.variables": "您可以在此定义和预处理变量，然后在处理步骤中使用。",
  "bulkModification.tip.processes": "您可以在此定义处理步骤，并在步骤中使用变量，以修改所有筛选出的资源。",
  "bulkModification.tip.changes": "在应用批量修改之前，您必须在此计算并检查更改。",
  "bulkModification.block.filters": "筛选器",
  "bulkModification.block.variables": "变量",
  "bulkModification.block.processes": "处理",
  "bulkModification.block.changes": "更改",
  "bulkModification.block.finalStep": "最后一步",
  "bulkModificationGuide.welcome.title": "欢迎使用批量修改",
  "bulkModificationGuide.welcome.description": "批量修改功能可以帮助您快速、高效地修改大量资源的属性。您可以使用任意筛选条件筛选出资源，然后批量设置这些资源的属性值。",
  "bulkModificationGuide.welcome.highlight": "所有批量修改配置都会自动保存，您可以随时重复使用，无需重新配置。",
  "bulkModificationGuide.workflow.title": "工作流程",
  "bulkModificationGuide.workflow.subtitle": "批量修改分为四个步骤，每个步骤都有明确的职责。",
  "bulkModificationGuide.workflow.step1Title": "筛选资源",
  "bulkModificationGuide.workflow.step1Desc": "使用强大的筛选器选择要修改的资源。",
  "bulkModificationGuide.workflow.step2Title": "定义变量（可选）",
  "bulkModificationGuide.workflow.step2Desc": "预定义变量以便在处理步骤中复用。",
  "bulkModificationGuide.workflow.step3Title": "配置处理流程",
  "bulkModificationGuide.workflow.step3Desc": "设置对属性的具体操作，支持多步骤流程。",
  "bulkModificationGuide.workflow.step4Title": "预览并应用",
  "bulkModificationGuide.workflow.step4Desc": "计算并查看所有更改，确认后应用。",
  "bulkModificationGuide.valueSources.title": "值来源",
  "bulkModificationGuide.valueSources.subtitle": "您可以从多种来源获取要设置的值。",
  "bulkModificationGuide.valueSources.fixedValue": "固定值",
  "bulkModificationGuide.valueSources.fixedValueDesc": "直接输入一个固定的值应用到所有资源。",
  "bulkModificationGuide.valueSources.variable": "变量引用",
  "bulkModificationGuide.valueSources.variableDesc": "引用其他属性的值，包括同属性的其他维度值。",
  "bulkModificationGuide.valueSources.delete": "删除操作",
  "bulkModificationGuide.valueSources.deleteDesc": "清空属性值，将其设为空。",
  "bulkModificationGuide.pipeline.title": "流程化处理",
  "bulkModificationGuide.pipeline.subtitle": "支持多步骤的链式处理，每一步都可以基于上一步的结果。",
  "bulkModificationGuide.pipeline.explanation": "流程按顺序执行：步骤 2 可以使用步骤 1 修改后的新值，步骤 3 可以使用步骤 2 的结果，以此类推。这使得复杂的批量修改变得简单。",
  "bulkModificationGuide.pipeline.example1": "步骤 1：将属性 A 设置为值 X",
  "bulkModificationGuide.pipeline.example2": "步骤 2：根据属性 A 的新值 X，将属性 B 设置为 Y",
  "bulkModificationGuide.pipeline.example3": "步骤 3：基于前面的结果继续处理...",
  "bulkModificationGuide.saveReuse.title": "保存与复用",
  "bulkModificationGuide.saveReuse.subtitle": "您的批量修改配置会自动保存，可以随时重复使用。",
  "bulkModificationGuide.saveReuse.point1": "每个批量修改配置都会自动保存到列表中。",
  "bulkModificationGuide.saveReuse.point2": "您可以复制现有配置，快速创建相似的新配置。",
  "bulkModificationGuide.saveReuse.point3": "启用/禁用状态让您可以临时停用某些配置。",
  "bulkModificationGuide.saveReuse.tip": "提示：给批量修改配置起一个有意义的名称，方便日后查找和使用。",
  "bulkModificationGuide.skip": "跳过",
  "bulkModificationGuide.previous": "上一步",
  "bulkModificationGuide.next": "下一步",
  "bulkModificationGuide.getStarted": "开始使用",
  "bulkModificationGuide.action.showGuide": "查看使用指南",
  "BulkModification.Processor.Demonstrator.Operation.SetDirectly": "<0/>使用固定值",
  "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd": "添加 <1/> 到 <3>{{direction}}</3>",
  "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition": "添加 <1/> 到从 <5>{{direction}}</5> 起第 <3>{{position}}</3> 个位置",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd": "从 <3>{{direction}}</3> 删除 <1>{{count}}</1> 个字符",
  "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition": "从 <7>{{direction}}</7> 起第 <5>{{position}}</5> 个字符 <3>{{removeDirection}}</3> 删除 <1>{{count}}</1> 个字符",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd": "从 <5>{{direction}}</5> <0>替换</0> <1>{{find}}</1> 为 <3/>",
  "BulkModification.Processor.Demonstrator.Operation.Replace": "<0>替换</0> <1>{{find}}</1> 为 <3/>",
  "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex": "使用 <1>正则表达式</1> <3>替换</3> <4>{{find}}</4> 为 <6/>",
  "BulkModification.Processor.Editor.Operation.AddToAnyPosition": "添加 <1/> 到从 <5/> 起第 <3/> 个字符处",
  "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition": "从 <7/> 起第 <5/> 个字符 <3/> 删除 <1/> 个字符",
  "BulkModification.Processor.Editor.Operation.Replace": "替换 <1/> 为 <3/>",
  "bulkModification.operation.link.delete": "删除",
  "bulkModification.operation.link.setWithFixedValue": "设为固定值",
  "bulkModification.operation.link.setText": "设置文本",
  "bulkModification.operation.link.setUrl": "设置 URL",
  "bulkModification.operation.link.modifyText": "修改文本",
  "bulkModification.operation.link.modifyUrl": "修改 URL",
  "bulkModification.operation.decimal.delete": "删除",
  "bulkModification.operation.decimal.setWithFixedValue": "设为固定值",
  "bulkModification.operation.decimal.round": "四舍五入",
  "bulkModification.operation.decimal.ceil": "向上取整",
  "bulkModification.operation.decimal.floor": "向下取整",
  "bulkModification.operation.time.delete": "删除",
  "bulkModification.operation.time.setWithFixedValue": "设为固定值",
  "bulkModification.operation.boolean.delete": "删除",
  "bulkModification.operation.boolean.setWithFixedValue": "设为固定值",
  "bulkModification.operation.boolean.toggle": "切换",
  "bulkModification.operation.dateTime.delete": "删除",
  "bulkModification.operation.dateTime.setWithFixedValue": "设为固定值",
  "bulkModification.operation.dateTime.setToNow": "设为当前时间",
  "bulkModification.operation.listTag.delete": "删除",
  "bulkModification.operation.listTag.setWithFixedValue": "设为固定值",
  "bulkModification.operation.listTag.append": "追加",
  "bulkModification.operation.listTag.prepend": "前置",
  "bulkModification.operation.listTag.remove": "移除",
  "bulkModification.operation.listListString.delete": "删除",
  "bulkModification.operation.listListString.setWithFixedValue": "设为固定值",
  "bulkModification.operation.listListString.append": "追加",
  "bulkModification.operation.listListString.prepend": "前置",
  "bulkModification.operation.listListString.remove": "移除",
  "bulkModification.operation.string.delete": "删除",
  "bulkModification.operation.string.setWithFixedValue": "设置固定值",
  "bulkModification.operation.string.addToStart": "添加到开头",
  "bulkModification.operation.string.addToEnd": "添加到末尾",
  "bulkModification.operation.string.addToAnyPosition": "添加到任意位置",
  "bulkModification.operation.string.removeFromStart": "从开头删除",
  "bulkModification.operation.string.removeFromEnd": "从末尾删除",
  "bulkModification.operation.string.removeFromAnyPosition": "从任意位置删除",
  "bulkModification.operation.string.replaceFromStart": "从开头替换",
  "bulkModification.operation.string.replaceFromEnd": "从末尾替换",
  "bulkModification.operation.string.replaceFromAnyPosition": "从任意位置替换",
  "bulkModification.operation.string.replaceWithRegex": "使用正则表达式替换",
  "bulkModification.operation.listString.delete": "删除",
  "bulkModification.operation.listString.setWithFixedValue": "设置固定值",
  "bulkModification.operation.listString.append": "追加",
  "bulkModification.operation.listString.prepend": "前置",
  "bulkModification.operation.listString.modify": "修改",
  "bulkModification.operation.decimal.add": "加",
  "bulkModification.operation.decimal.subtract": "减",
  "bulkModification.operation.decimal.multiply": "乘",
  "bulkModification.operation.decimal.divide": "除",
  "bulkModification.operation.dateTime.addDays": "增加天数",
  "bulkModification.operation.dateTime.subtractDays": "减少天数",
  "bulkModification.operation.dateTime.addMonths": "增加月数",
  "bulkModification.operation.dateTime.subtractMonths": "减少月数",
  "bulkModification.operation.dateTime.addYears": "增加年数",
  "bulkModification.operation.dateTime.subtractYears": "减少年数",
  "bulkModification.operation.time.addHours": "增加小时",
  "bulkModification.operation.time.subtractHours": "减少小时",
  "bulkModification.operation.time.addMinutes": "增加分钟",
  "bulkModification.operation.time.subtractMinutes": "减少分钟",
  "bulkModification.operation.time.addSeconds": "增加秒数",
  "bulkModification.operation.time.subtractSeconds": "减少秒数",
  "bulkModification.valueType.manuallyInput": "手动输入",
  "bulkModification.valueType.variable": "变量",
  "bulkModification.valueSource.label": "值来源",
  "bulkModification.valueType.label": "值类型",
  "bulkModification.dataSource.label": "数据来源",
  "bulkModification.dataSource.clickToSelect": "点击选择属性",
  "bulkModification.validation.valueRequired": "值是必填的",
  "bulkModification.validation.valueAndIndexRequired": "值和索引是必填的",
  "bulkModification.validation.countRequired": "数量是必填的",
  "bulkModification.validation.countAndIndexRequired": "数量和索引是必填的",
  "bulkModification.validation.findAndReplaceRequired": "查找和替换内容是必填的",
  "bulkModification.validation.optionsRequired": "请提供有效的选项",
  "bulkModification.validation.modifyOptionsRequired": "修改选项是必填的",
  "bulkModification.validation.filterValueRequired": "筛选值是必填的",
  "bulkModification.validation.operationRequired": "操作是必填的",
  "bulkModification.validation.invalidValue": "请提供有效的值",
  "bulkModification.validation.invalidValueType": "请提供有效的值类型",
  "bulkModification.validation.invalidPropertyType": "请提供有效的属性类型",
  "bulkModification.validation.invalidVariable": "请提供有效的变量",
  "bulkModification.label.scope": "作用域",
  "bulkModification.label.scopeDescription": "一个属性可能有多个维度的值，您可以选择其中一个维度作为基础数据。",
  "bulkModification.label.useEditor": "使用 {{editor}} 编辑器",
  "bulkModification.label.choosePropertyValueEditor": "选择属性值编辑器",
  "bulkModification.label.chooseProperty": "选择属性",
  "bulkModification.label.noVariablesAvailable": "没有可用变量",
  "bulkModification.label.followPropertyChanges": "跟随属性变更",
  "bulkModification.label.followPropertyChangesDescription1": "启用此选项后，数据将根据动态属性（单选、多选、多级数据等）的变更而变更。",
  "bulkModification.label.followPropertyChangesDescription2": '例如，如果您使用多选数据中的"演员"作为变更结果，那么将来如果您将"演员"修改为"演员1"，当前数据在下次处理后也会变为"演员1"。但是，如果未启用此选项，当前数据在下次处理后将变为"演员"。',
  "bulkModification.label.followPropertyChangesDescription3": "对于没有引用值的属性（如文本、数字、日期等），此选项的状态没有区别。",
  "bulkModification.label.clickToSet": "点击设置",
  "bulkModification.label.notSet": "未设置",
  "bulkModification.label.amount": "数量",
  "bulkModification.label.decimalPlaces": "小数位数",
  "bulkModification.label.text": "文本",
  "bulkModification.label.url": "链接",
  "bulkModification.label.stringOperation": "文本操作",
  "bulkModification.label.setValue": "设置值",
  "bulkModification.placeholder.inputKeyword": "请输入关键词",
  "bulkModification.placeholder.inputRegex": "请输入正则表达式"
};
const cnAlias = {
  "alias.info.description": "别名用于在界面中替换属性值的原始文本，例如翻译等。",
  "alias.input.searchPlaceholder": "按回车搜索",
  "alias.action.add": "添加别名",
  "alias.action.import": "导入",
  "alias.action.export": "导出",
  "alias.action.merge": "合并",
  "alias.action.exit": "退出",
  "alias.action.setAsPreferred": "设为首选",
  "alias.label.bulkOperations": "批量操作",
  "alias.label.preferred": "首选",
  "alias.label.candidates": "候选",
  "alias.label.importing": "正在导入，请稍候...",
  "alias.confirm.mergeTitle": "合并别名组: {{texts}}",
  "alias.confirm.mergeDescription": "所有选中的别名组将合并为一个，最终首选为 {{preferred}}，确定吗？",
  "alias.confirm.deleteTitle": "删除别名组: {{texts}}",
  "alias.confirm.deleteDescription": "所有选中的别名组及其候选项将被删除，此操作不可撤销，确定吗？",
  "alias.confirm.deleteSingle": "删除别名",
  "alias.confirm.weAreDeleting": "我们正在删除",
  "alias.confirm.noWayBack": "此操作不可撤销，确定吗？",
  "alias.tip.preferredText": "{{text}} 将是合并组中的首选文本，您可以通过点击文本来更改首选。"
};
const cnCustomProperty = {
  "customProperty.action.checkTypeConversionRules": "查看类型转换规则",
  "customProperty.action.adjustDisplayOrders": "调整显示顺序"
};
const cnBackgroundTask = {
  "backgroundTask.column.name": "名称",
  "backgroundTask.column.status": "状态",
  "backgroundTask.column.progress": "进度",
  "backgroundTask.column.startedAt": "开始时间",
  "backgroundTask.column.interval": "间隔",
  "backgroundTask.column.nextTimeStartAt": "下次开始时间",
  "backgroundTask.column.elapsed": "已用时间",
  "backgroundTask.column.enableAfter": "启用时间",
  "backgroundTask.label.notSupported": "不支持",
  "backgroundTask.label.notSet": "未设置",
  "backgroundTask.label.willStartAt": "将于以下时间开始",
  "backgroundTask.status.notStarted": "未开始",
  "backgroundTask.status.running": "运行中",
  "backgroundTask.status.paused": "已暂停",
  "backgroundTask.status.error": "错误",
  "backgroundTask.status.completed": "已完成",
  "backgroundTask.status.cancelled": "已取消"
};
const cnCache = {
  "cache.label.resourceCount": "资源数量",
  "cache.label.cached": "已缓存",
  "cache.label.unassociatedResources": "未关联的资源",
  "cache.resourceCacheType.covers": "封面",
  "cache.resourceCacheType.playablefiles": "可播放文件",
  "cache.resourceCacheType.resourcemarkers": "资源标记"
};
const cnFileNameModifier = {
  "FileNameModifier.OperationsList": "操作列表",
  "FileNameModifier.EmptyOperationsHint": "暂无操作，点击下方按钮添加第一个操作",
  "FileNameModifier.AddFirstOperation": "添加第一个操作",
  "FileNameModifier.AddOperation": "添加操作",
  "FileNameModifier.ExecuteModification": "执行修改",
  "FileNameModifier.RestoreOriginalPaths": "恢复原路径",
  "FileNameModifier.EditFileList": "编辑文件列表",
  "FileNameModifier.PreviewResults": "预览结果",
  "FileNameModifier.HideFullPaths": "隐藏完整路径",
  "FileNameModifier.ShowFullPaths": "显示完整路径",
  "FileNameModifier.FilePathsTextarea": "文件路径输入",
  "FileNameModifier.FilePathsPlaceholder": "请输入文件路径，每行一个",
  "FileNameModifier.ConfirmPaths": "确认路径",
  "FileNameModifier.Deduplicate": "去重",
  "FileNameModifier.Cancel": "取消",
  "FileNameModifier.Loading": "加载中...",
  "FileNameModifier.NoPreviewResults": "暂无预览结果",
  "FileNameModifier.PreviewFailed": "预览失败",
  "FileNameModifier.ModificationResult": "修改结果",
  "FileNameModifier.ModificationSuccessCount": "成功：{{count}} 个",
  "FileNameModifier.ModificationFailCount": "失败：{{count}} 个",
  "FileNameModifier.ModificationFailList": "失败列表",
  "FileNameModifier.ModificationFailReason": "失败原因",
  "FileNameModifier.ModificationFailed": "修改失败",
  "FileNameModifier.Target.FileName": "完整文件名",
  "FileNameModifier.Target.FileNameWithoutExtension": "不含扩展名的文件名",
  "FileNameModifier.Target.Extension": "扩展名（含点）",
  "FileNameModifier.Target.ExtensionWithoutDot": "扩展名（不含点）",
  "FileNameModifier.TargetTypePlaceholder": "选择目标类型",
  "FileNameModifier.OperationType.Insert": "插入",
  "FileNameModifier.OperationType.AddDateTime": "添加日期时间",
  "FileNameModifier.OperationType.Delete": "删除",
  "FileNameModifier.OperationType.Replace": "替换",
  "FileNameModifier.OperationType.ChangeCase": "更改大小写",
  "FileNameModifier.OperationType.AddAlphabetSequence": "添加字母序列",
  "FileNameModifier.OperationType.Reverse": "反转",
  "FileNameModifier.OperationTypePlaceholder": "选择操作类型",
  "FileNameModifier.PositionType.Start": "开头",
  "FileNameModifier.PositionType.End": "结尾",
  "FileNameModifier.PositionType.AtPosition": "指定位置",
  "FileNameModifier.PositionType.AfterText": "文本之后",
  "FileNameModifier.PositionType.BeforeText": "文本之前",
  "FileNameModifier.CaseType.TitleCase": "首字母大写",
  "FileNameModifier.CaseType.UpperCase": "全部大写",
  "FileNameModifier.CaseType.LowerCase": "全部小写",
  "FileNameModifier.CaseType.CamelCase": "驼峰命名",
  "FileNameModifier.CaseType.PascalCase": "帕斯卡命名",
  "FileNameModifier.Label.Text": "文本",
  "FileNameModifier.Label.TargetText": "目标文本",
  "FileNameModifier.Label.PositionType": "位置类型",
  "FileNameModifier.Label.PositionIndex": "位置索引",
  "FileNameModifier.Label.DateTimeFormat": "日期时间格式",
  "FileNameModifier.Label.DeleteCount": "删除字符数",
  "FileNameModifier.Label.DeleteStartPosition": "删除起始位置",
  "FileNameModifier.Label.MatchText": "匹配文本",
  "FileNameModifier.Label.CaseType": "大小写类型",
  "FileNameModifier.Label.StartChar": "起始字符",
  "FileNameModifier.Label.Count": "字符数量",
  "FileNameModifier.Placeholder.Text": "输入要插入的文本",
  "FileNameModifier.Placeholder.TargetText": "输入目标文本",
  "FileNameModifier.Placeholder.PositionType": "选择位置类型",
  "FileNameModifier.Placeholder.PositionIndex": "输入位置索引",
  "FileNameModifier.Placeholder.DateTimeFormat": "如 yyyy-MM-dd",
  "FileNameModifier.Placeholder.DeleteCount": "输入数量",
  "FileNameModifier.Placeholder.DeleteStartPosition": "输入起始位置",
  "FileNameModifier.Placeholder.MatchText": "输入匹配文本",
  "FileNameModifier.Placeholder.CaseType": "选择大小写类型",
  "FileNameModifier.Placeholder.StartChar": "如 A",
  "FileNameModifier.Placeholder.Count": "输入数量",
  "FileNameModifier.UseRegex": "使用正则",
  "FileNameModifier.ReplaceEntire": "替换全部",
  "FileNameModifier.Error.NoValidOperation": "没有有效的操作",
  "FileNameModifier.Error.TargetRequired": "请选择目标类型",
  "FileNameModifier.Error.OperationTypeRequired": "请选择操作类型",
  "FileNameModifier.Error.TextRequired": "请输入文本",
  "FileNameModifier.Error.TargetTextRequired": "请输入目标文本",
  "FileNameModifier.Error.PositionRequired": "请选择位置类型",
  "FileNameModifier.Error.PositionIndexRequired": "请输入位置索引",
  "FileNameModifier.Error.DateTimeFormatRequired": "请输入日期时间格式",
  "FileNameModifier.Error.DeleteCountRequired": "请输入删除字符数",
  "FileNameModifier.Error.DeleteStartPositionRequired": "请输入删除起始位置",
  "FileNameModifier.Error.CaseTypeRequired": "请选择大小写类型",
  "FileNameModifier.Error.AlphabetStartCharRequired": "请输入起始字符",
  "FileNameModifier.Error.AlphabetCountRequired": "请输入字符数量"
};
const cnFileMover = {
  "fileMover.status.enabled": "已启用",
  "fileMover.status.disabled": "已禁用",
  "fileMover.label.delay": "延迟",
  "fileMover.tip.delay": "文件或目录将在此处创建后延迟指定时间后移动。延迟仅对第一层条目生效。",
  "fileMover.label.sources": "来源",
  "fileMover.action.addSource": "添加来源",
  "fileMover.action.addTarget": "添加目标路径",
  "fileMover.empty.noSources": "未配置来源",
  "fileMover.label.overwrite": "覆盖",
  "fileMover.tip.overwrite": "覆盖目标路径中的文件"
};
const cnLog = {
  "log.filter.time": "时间",
  "log.filter.level": "级别",
  "log.filter.all": "全部",
  "log.filter.logger": "日志器",
  "log.filter.event": "事件",
  "log.filter.message": "消息",
  "log.action.clearAll": "清除全部",
  "log.label.log": "日志",
  "log.action.expand": "展开",
  "log.label.fullMessage": "完整消息"
};
const cnPlayHistory = {
  "playHistory.label.playedAt": "播放时间",
  "playHistory.label.item": "项目",
  "playHistory.empty.noHistory": "暂无播放记录"
};
const cnWelcome = {
  "welcome.info.termsNotice": "请在开始使用此应用前仔细阅读条款和条件",
  "welcome.action.clickToCheck": "点击查看",
  "welcome.info.clarityNotice": "我们使用 Microsoft Clarity 跟踪匿名数据，这将帮助我们改善产品体验。",
  "welcome.action.acceptAndStart": "接受并开始使用"
};
const cnThirdParty = {};
const cnThirdPartyIntegration = {
  "thirdPartyIntegration.label.tampermonkeyScript": "油猴脚本",
  "thirdPartyIntegration.action.oneClickInstall": "一键安装",
  "thirdPartyIntegration.tip.scriptModifies": "此脚本修改了目标网站的一些交互行为。您可以在油猴中手动启用或禁用脚本。",
  "thirdPartyIntegration.tip.soulPlusClick": "左键点击封面或帖子标题将触发在Bakabase上创建帖子解析任务。您仍然可以使用中键打开帖子。",
  "thirdPartyIntegration.tip.exHentaiClick": "左键点击封面将触发在Bakabase上创建种子下载任务。您仍然可以使用中键打开帖子。"
};
const cnThirdPartyConfiguration = {
  "thirdPartyConfig.success.saved": "已保存",
  "thirdPartyConfig.label.cookie": "Cookie",
  "thirdPartyConfig.label.maxConcurrency": "最大并发数",
  "thirdPartyConfig.label.requestInterval": "请求间隔（毫秒）",
  "thirdPartyConfig.label.defaultPath": "默认路径",
  "thirdPartyConfig.label.namingConvention": "命名规则",
  "thirdPartyConfig.label.maxRetries": "最大重试次数",
  "thirdPartyConfig.label.requestTimeout": "请求超时（毫秒）",
  "thirdPartyConfig.label.autoBuyThreshold": "自动购买阈值",
  "thirdPartyConfig.label.userAgent": "User Agent",
  "thirdPartyConfig.label.referer": "Referer",
  "thirdPartyConfig.label.apiKey": "API Key",
  "thirdPartyConfig.action.save": "保存",
  "thirdPartyConfig.action.validateCookie": "验证 Cookie",
  "thirdPartyConfig.error.invalidCookie": "无效的 Cookie",
  "thirdPartyConfig.success.cookieValid": "Cookie 有效",
  "thirdPartyConfig.tip.bilibili": "配置 Bilibili 下载器设置，包括 Cookie 认证和下载参数。",
  "thirdPartyConfig.tip.exhentai": "配置 ExHentai 下载器设置。需要 Cookie 进行认证。",
  "thirdPartyConfig.tip.pixiv": "配置 Pixiv 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.soulplus": "配置 SoulPlus 设置，包括 Cookie 认证和自动购买阈值。",
  "thirdPartyConfig.tip.bangumi": "配置 Bangumi 设置，包括请求参数和认证。",
  "thirdPartyConfig.tip.cien": "配置 Cien 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.dlsite": "配置 DLsite 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.fanbox": "配置 Fanbox 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.fantia": "配置 Fantia 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.patreon": "配置 Patreon 下载器设置，包括认证和下载参数。",
  "thirdPartyConfig.tip.tmdb": "配置 TMDB（电影数据库）设置，包括 API Key 和请求参数。"
};
const cnExtensionGroup = {
  "extensionGroup.action.editGroup": "编辑扩展组",
  "extensionGroup.action.addGroup": "添加组",
  "extensionGroup.label.extensions": "扩展名",
  "extensionGroup.input.separatePlaceholder": "用空格或换行分隔",
  "extensionGroup.confirm.deleteTitle": "确定要删除吗？",
  "extensionGroup.select.label": "限制文件扩展组",
  "extensionGroup.select.placeholder": "从扩展组选择"
};
const cnText = {
  "text.label.appliedTo": "应用于",
  "text.label.texts": "文本",
  "text.label.opt": "操作",
  "text.label.original": "原始",
  "text.label.pretreated": "处理后",
  "text.action.addPrefabs": "添加预设",
  "text.label.pretreatmentTest": "预处理测试",
  "text.input.enterText": "输入文本",
  "text.action.runPretreatment": "运行预处理",
  "text.label.noChanges": "无变化",
  "text.confirm.deleteTitle": "确定要删除吗？",
  "SpecialTextType.Useless": "无用文本",
  "SpecialTextType.Language": "语言",
  "SpecialTextType.Wrapper": "包装器",
  "SpecialTextType.Standardization": "标准化",
  "SpecialTextType.Volume": "卷",
  "SpecialTextType.Trim": "修剪",
  "SpecialTextType.DateTime": "日期时间",
  "text.typeDescription.useless": "忽略被正则表达式成功匹配的包装器内的部分",
  "text.typeDescription.language": "如果文本被[包装器]包围，将被解析为[特定语言]",
  "text.typeDescription.wrapper": "文本包装器，用于匹配和提取包装器内的文本",
  "text.typeDescription.standardization": "分析时将[文本1]视为[文本2]",
  "text.typeDescription.volume": "从此文本组中提取卷信息",
  "text.typeDescription.trim": "待定，目前不要设置",
  "text.typeDescription.dateTime": "日期时间解析模板，用于从文本中提取日期和时间",
  "text.usedIn.textPretreatment": "文本预处理",
  "text.usedIn.bakabaseEnhancerAnalysis": "Bakabase 增强器分析",
  "text.usedIn.resourceDisplayNameTemplate": "资源显示名称模板",
  "text.usedIn.exhentaiEnhancerAnalysis": "Exhentai 增强器分析",
  "text.usedIn.parsingOrConvertingPropertyValue": "解析或转换属性值",
  "text.label.text": "文本",
  "text.placeholder.text": "输入文本",
  "text.label.sourceText": "源文本",
  "text.placeholder.sourceText": "输入源文本",
  "text.label.convertTo": "转换为",
  "text.placeholder.convertTo": "输入目标文本",
  "text.label.leftWrapper": "左包装器",
  "text.placeholder.leftWrapper": "输入左包装器",
  "text.label.rightWrapper": "右包装器",
  "text.placeholder.rightWrapper": "输入右包装器"
};
const cnPostParser = {
  "postParser.action.addTasks": "添加任务",
  "postParser.input.postLinks": "{{source}} 中的帖子链接",
  "postParser.tip.otherSitesSupport": "支持其他站点",
  "postParser.action.configuration": "配置",
  "postParser.label.automaticallyParsing": "自动解析",
  "postParser.action.instructions": "使用说明",
  "postParser.tip.curlVersion": "此功能内部使用 curl。如果您的系统级 curl 版本低于 8.14，请在系统设置中配置正确的 curl 路径。",
  "postParser.tip.requestInterval": "请求间隔配置暂时不可用。内置默认间隔为 3 秒。",
  "postParser.label.curl": "curl",
  "postParser.tip.ollamaRequired": "此功能内部使用 Ollama。您需要先安装并运行 Ollama，并安装至少一个模型。然后在系统设置中配置 Ollama API 地址。",
  "postParser.tip.ollamaModel": "此功能将优先使用 Ollama 模型列表中最大的模型。",
  "postParser.tip.ollamaTested": "目前，deepseek-r1:14b 和 32b 已经过测试，可以安全使用。",
  "postParser.label.ollama": "ollama",
  "postParser.tip.browserIntegration": "某些站点可以通过浏览器集成快速操作（例如一键创建任务）。您可以查看「第三方集成」部分。",
  "postParser.label.browserIntegrations": "浏览器集成",
  "postParser.table.id": "#",
  "postParser.table.target": "目标",
  "postParser.table.items": "项目",
  "postParser.table.parsedAt": "解析时间",
  "postParser.label.accessCode": "访问码",
  "postParser.label.decompressionPassword": "解压密码"
};
const cnPathMarks = {
  "pathMarks.title": "路径标记",
  "pathMarks.label.beta": "测试版",
  "pathMarks.tip.description": "查看和管理所有媒体库中的路径标记。点击路径可在配置页面中编辑标记。",
  "pathMarks.warning.invalidPaths": "{{count}} 个路径在文件系统中不再存在",
  "pathMarks.label.showOnlyInvalid": "仅显示无效",
  "pathMarks.success.markUpdated": "标记更新成功",
  "pathMarks.success.markAdded": "标记添加成功",
  "pathMarks.error.saveMark": "保存标记失败",
  "pathMarks.confirm.deleteTitle": "确认删除标记",
  "pathMarks.confirm.deleteQuestion": "确定要删除此标记吗？",
  "pathMarks.success.markDeleted": "标记删除成功",
  "pathMarks.error.deleteMark": "删除标记失败",
  "pathMarks.warning.noMarksToDelete": "没有可删除的标记",
  "pathMarks.success.deletedCount": "成功删除 {{count}} 个标记",
  "pathMarks.error.deleteMarks": "删除标记失败",
  "pathMarks.success.pastedCount": "成功粘贴 {{count}} 个标记",
  "pathMarks.error.pasteMarks": "粘贴标记失败",
  "pathMarks.modal.confirmDeleteTitle": "确认删除标记",
  "pathMarks.modal.transferMarksTitle": "转移标记",
  "pathMarks.modal.confirmTransferTitle": "确认转移",
  "pathMarks.modal.configurePathMarksTitle": "配置路径标记",
  "pathMarks.label.mainPath": "主路径",
  "pathMarks.label.invalid": "无效",
  "pathMarks.label.resourceMark": "资源标记",
  "pathMarks.label.propertyMark": "属性标记",
  "pathMarks.label.mediaLibraryMark": "媒体库标记",
  "pathMarks.tip.clickToCopyFullPath": "点击复制完整路径",
  "pathMarks.tip.clickOnFoldersToNavigate": "点击文件夹进行导航。使用添加标记按钮或右键单击查看标记选项。",
  "pathMarks.tip.copyMarksFromThisPath": "从此路径复制标记",
  "pathMarks.tip.configureSubPathMarks": "配置子路径标记",
  "pathMarks.tip.syncAllMarksOnThisPath": "同步此路径上的所有标记",
  "pathMarks.tip.deleteAllMarksOnThisPath": "删除此路径上的所有标记",
  "pathMarks.tip.transferMarksToThisPath": "将标记转移到此路径",
  "pathMarks.tip.browseAndClickTransfer": "浏览并点击「转移到此处」选择目标路径",
  "pathMarks.status.aboutToDeleteMarks": "您即将删除 {{count}} 个标记",
  "pathMarks.status.aboutToTransferMarks": "您即将转移 {{count}} 个标记",
  "pathMarks.status.transferredSuccessfully": "成功转移 {{count}} 个标记",
  "pathMarks.action.transfer": "转移",
  "pathMarks.action.confirmTransfer": "确认转移",
  "pathMarks.action.confirmSelection": "确认选择",
  "pathMarks.action.transferHere": "转移到此处",
  "pathMarks.action.pasteMarks": "粘贴 {{count}} 个标记",
  "pathMarks.action.pasteMarksWithExisting": "粘贴 {{count}} 个标记（{{existing}} 个已存在）",
  "pathMarks.checkbox.alsoDeleteChildMarks": "同时从 {{pathCount}} 个子路径删除 {{count}} 个标记",
  "pathMarks.checkbox.includeChildPaths": "包含 {{count}} 个带有标记的子路径",
  "pathMarks.checkbox.childPathsAvailableForTransfer": "+ {{count}} 个带有标记的子路径也可转移",
  "pathMarks.warning.cannotBeUndone": "此操作无法撤销。",
  "pathMarks.warning.cannotTransferToSamePath": "无法转移到相同路径",
  "pathMarks.error.failedToTransfer": "转移标记失败",
  "pathMarks.error.failedToStartSync": "启动同步失败",
  "pathMarks.success.pathCopied": "路径已复制到剪贴板",
  "pathMarks.success.syncStarted": "同步已启动",
  "pathMarks.empty.noPathMarks": "未找到路径标记",
  "pathMarks.empty.goToConfigPage": "前往路径标记配置页添加标记",
  "pathMarks.info.transferringFrom": "正在从以下路径转移标记：",
  "pathMarks.info.transferTo": "转移到：",
  "pathMarks.action.configureMarks": "配置标记",
  "pathMarks.label.resourceProfileHint": "下一步：配置资源扩展，定义增强器、播放器等资源处理设置",
  "pathMarks.action.goToResourceProfile": "配置资源扩展"
};
const cnPathMarkConfig = {
  "pathMarkConfig.title": "配置您的媒体库",
  "pathMarkConfig.label.beta": "Beta",
  "pathMarkConfig.tip.description": "使用此工具为您的媒体库配置路径标记。路径标记有助于组织和分类您的内容。",
  "pathMarkConfig.tip.pathMemory": "修改上方路径地址、选中目录后按 Enter、或右键选择进入目录，系统都会记住您的位置，下次配置时默认使用上次的目录。",
  "pathMarkConfig.action.pendingSync": "待同步",
  "pathMarkConfig.modal.settingsTitle": "路径标记设置",
  "pathMarkConfig.modal.enableSyncImmediatelyTitle": "启用立即同步",
  "pathMarkConfig.label.syncImmediately": "立即同步",
  "pathMarkConfig.tip.syncImmediately": "启用后，标记设置后将立即同步。",
  "pathMarkConfig.warning.syncDataNote": "注意：如果数据量较大，同步可能需要几分钟。",
  "pathMarkConfig.action.enable": "启用",
  "pathMarkConfig.error.updateOption": "更新选项失败",
  "pathMarkConfig.status.pending": "待处理",
  "pathMarkConfig.status.syncing": "同步中...",
  "pathMarkConfig.status.synced": "已同步",
  "pathMarkConfig.status.failed": "失败",
  "pathMarkConfig.status.pendingDelete": "待删除",
  "pathMarkConfig.status.unknown": "未知",
  "pathMarkConfig.status.allSynced": "所有标记已同步！",
  "pathMarkConfig.modal.pendingSyncMarks": "待同步标记",
  "pathMarkConfig.action.syncAll": "全部同步",
  "pathMarkConfig.action.syncNow": "立即同步",
  "pathMarkConfig.success.syncStarted": "同步已开始",
  "pathMarkConfig.error.syncFailed": "启动同步失败",
  "pathMarkConfig.label.enableExpiration": "定时同步",
  "pathMarkConfig.label.scheduledSync": "定时同步",
  "pathMarkConfig.tip.expirationDescription": "同步完成后，标记将在指定时间后重新同步。如果设置过短，可能会导致频繁重新同步并影响性能。",
  "pathMarkConfig.label.scrollForMore": "向下滚动查看更多",
  "pathMarkConfig.label.pathCount": "{{count}} 个路径",
  "Edit <type></type> Mark": "编辑 <type></type> 标记",
  "Add <type></type> Mark": "添加 <type></type> 标记",
  "pathMarkConfig.modal.syncProgress": "同步标记中",
  "pathMarkConfig.label.progress": "进度",
  "pathMarkConfig.label.currentlySyncing": "当前同步",
  "pathMarkConfig.label.error": "错误",
  "pathMarkConfig.status.paused": "同步已暂停",
  "pathMarkConfig.status.cancelled": "同步已取消",
  "pathMarkConfig.status.completed": "同步完成！",
  "pathMarkConfig.label.resources": "资源",
  "pathMarkConfig.label.properties": "属性",
  "pathMarkConfig.action.pause": "暂停",
  "pathMarkConfig.action.stop": "停止",
  "pathMarkConfig.action.resume": "继续",
  "pathMarkConfig.success.markUpdated": "标记更新成功",
  "pathMarkConfig.success.markAdded": "标记添加成功",
  "pathMarkConfig.error.saveMark": "保存标记失败",
  "pathMarkConfig.confirm.deleteMarkTitle": "确认删除标记",
  "pathMarkConfig.confirm.deleteMarkQuestion": "确定要删除此标记吗？",
  "pathMarkConfig.success.markDeleted": "标记删除成功",
  "pathMarkConfig.error.deleteMark": "删除标记失败",
  "pathMarkConfig.success.markAddedToCount": "标记已成功添加到 {{count}} 个路径",
  "pathMarkConfig.error.addMarks": "添加标记失败",
  "pathMarkConfig.success.pastedCount": "成功粘贴 {{count}} 个标记",
  "pathMarkConfig.error.pasteMarks": "粘贴标记失败",
  "pathMarkConfig.action.addResourceMark": "添加资源标记（{{count}} 个路径）",
  "pathMarkConfig.action.addPropertyMark": "添加属性标记（{{count}} 个路径）",
  "pathMarkConfig.action.addMediaLibraryMark": "添加媒体库标记（{{count}} 个路径）",
  "pathMarkConfig.action.copyMarks": "从此路径复制标记",
  "pathMarkConfig.action.addMark": "添加标记",
  "pathMarkConfig.action.copy": "复制标记",
  "pathMarkConfig.action.confirmSelection": "确认选择",
  "pathMarkConfig.action.pasteMarks": "粘贴 {{count}} 个标记",
  "pathMarkConfig.tip.marksAlreadyExist": "{{count}} 个标记已存在",
  "pathMarkConfig.label.copiedMarks": "已复制的标记",
  "pathMarkConfig.empty.noCopiedMarks": "没有已复制的标记",
  "pathMarkConfig.tip.selectMarksToCopy": "从条目中选择标记进行复制",
  "pathMarkConfig.label.matchMode": "匹配模式",
  "pathMarkConfig.label.layer": "层级",
  "pathMarkConfig.label.regex": "正则表达式",
  "pathMarkConfig.label.regexPattern": "正则表达式",
  "pathMarkConfig.label.applyScope": "应用范围",
  "pathMarkConfig.label.matchedOnly": "仅匹配项",
  "pathMarkConfig.label.matchedAndSubdirectories": "匹配项及子目录",
  "pathMarkConfig.status.loadingPreview": "加载预览中...",
  "pathMarkConfig.warning.noMatches": "未找到匹配项。请检查您的配置。",
  "pathMarkConfig.label.andAllSubdirectories": "及所有子目录",
  "pathMarkConfig.label.propertyValue": "属性值",
  "pathMarkConfig.label.previewMatches": "预览匹配",
  "pathMarkConfig.label.resourceFilters": "资源过滤器（可选）",
  "pathMarkConfig.label.fileTypeFilter": "文件类型过滤",
  "pathMarkConfig.label.limitExtensions": "限制文件扩展名",
  "pathMarkConfig.label.propertySettings": "属性设置",
  "pathMarkConfig.label.targetProperty": "目标属性",
  "pathMarkConfig.empty.noPropertySelected": "未选择属性",
  "pathMarkConfig.action.selectProperty": "选择属性",
  "pathMarkConfig.label.valueType": "值类型",
  "pathMarkConfig.label.fixed": "固定",
  "pathMarkConfig.label.dynamic": "动态",
  "pathMarkConfig.label.fixedValue": "固定值",
  "pathMarkConfig.label.valueExtractionMode": "值提取模式",
  "pathMarkConfig.label.valueLayer": "值层级",
  "pathMarkConfig.tip.zeroEqualsMatchedItem": "0 = 匹配项",
  "pathMarkConfig.label.valueRegex": "值正则表达式",
  "pathMarkConfig.tip.regexExample": "例如：\\\\[(.+?)\\\\]",
  "pathMarkConfig.label.mediaLibrarySettings": "媒体库设置",
  "pathMarkConfig.label.targetMediaLibrary": "目标媒体库",
  "pathMarkConfig.empty.noMediaLibrarySelected": "未选择媒体库",
  "pathMarkConfig.action.selectMediaLibrary": "选择媒体库",
  "pathMarkConfig.tip.fixedMediaLibraryDescription": "与此标记匹配的资源将关联到所选媒体库。",
  "pathMarkConfig.tip.dynamicMediaLibraryDescription": "从路径中提取媒体库名称。如果媒体库不存在，将自动创建。",
  "pathMarkConfig.label.layerToMediaLibrary": "层级到媒体库",
  "pathMarkConfig.tip.layerToMediaLibraryDescription": "使用哪个层级的目录名作为媒体库名称。0 = 匹配项，1 = 父级，以此类推。",
  "pathMarkConfig.label.regexToMediaLibrary": "正则表达式到媒体库（可选）",
  "pathMarkConfig.tip.regexToMediaLibraryDescription": "可选的正则表达式用于提取媒体库名称。使用第一个捕获组或完整匹配。",
  "pathMark.resource.explanation": "资源标记用于识别应作为媒体库资源的文件系统条目（文件或目录）。",
  "pathMark.resource.isResourceBoundary": "设为资源边界",
  "pathMark.resource.isResourceBoundary.description": "启用后，此标记定义资源检测的边界。子条目将不会继承此标记的资源配置。",
  "pathMark.layer.description": "0 = 根路径，1 = 第一个子级别，以此类推。层级定义要匹配的目录深度。",
  "pathMark.regex.description": "用于匹配从根路径开始的相对路径的正则表达式。",
  "pathMark.applyScope.matchedOnly.description": "仅应用于精确匹配的路径",
  "pathMark.applyScope.matchedAndSubdirectories.description": "应用于匹配的路径及其中的所有路径",
  "pathMark.resource.matchMode.description": "可以基于您当前选择的路径进行扩展，如果您只希望选择当前路径，那么使用层级=0 即可。",
  "pathMark.resource.applyScope.matchedOnly.description": "仅当资源路径和您配置的匹配项完全重合时，才将其视为资源。",
  "pathMark.resource.applyScope.matchedAndSubdirectories.description": "当资源和您配置的匹配项完全重合，或是匹配项的任意子文件或文件夹时，才将其视作资源。",
  "pathMark.property.matchMode.description": "可以基于您当前选择的路径进行扩展，如果您只希望选择当前路径，那么使用层级=0 即可。",
  "pathMark.property.applyScope.matchedOnly.description": "仅当资源路径和您配置的匹配项完全重合时，才为资源设置您配置的属性和属性值。",
  "pathMark.property.applyScope.matchedAndSubdirectories.description": "当资源和您配置的匹配项完全重合，或是匹配项的子文件或文件夹时，才为资源设置您配置的属性和属性值。",
  "pathMark.property.configDescription": "您可以选择，当资源匹配后，应该将它与哪个属性绑定，以及属性值应该设置成什么。",
  "pathMark.mediaLibrary.matchMode.description": "可以基于您当前选择的路径进行扩展，如果您只希望选择当前路径，那么使用层级=0 即可。",
  "pathMark.mediaLibrary.applyScope.matchedOnly.description": "仅当资源路径和您配置的匹配项完全重合时，才将资源关联到您设置的媒体库。",
  "pathMark.mediaLibrary.applyScope.matchedAndSubdirectories.description": "当资源和您配置的匹配项完全重合，或是匹配项的子文件或文件夹时，才将资源关联到您设置的媒体库。",
  "pathMark.mediaLibrary.configDescription": "您可以选择，当资源匹配后，应该将它与哪个媒体库绑定。",
  "pathMark.priority.description": "值越小越先处理。用于控制多个标记匹配时的应用顺序。",
  "pathMark.property.explanation": "属性标记：为资源添加属性值（如标签、分类等）。",
  "pathMark.property.settingsDescription": "选择属性并设置其值来源。",
  "pathMark.property.importantNote": "属性标记不会创建资源，只有路径被「资源标记」匹配到的资源才会被赋予属性值。",
  "pathMark.mediaLibrary.explanation": "媒体库标记：将资源归类到指定的媒体库中。",
  "pathMark.mediaLibrary.settingsDescription": "选择目标媒体库，或从路径自动提取。",
  "pathMark.mediaLibrary.importantNote": "媒体库标记不会创建资源，只有路径被「资源标记」匹配到的资源才会被关联到媒体库。",
  "markDescription.layer.currentAndSubdirs": "当前层级 + 子目录",
  "markDescription.layer.current": "当前层级",
  "markDescription.layer.suffix": " 层",
  "markDescription.andSubdirs": " + 子目录",
  "markDescription.regex": "正则: {{regex}}",
  "markDescription.valueLayer.current": "=当前层级",
  "markDescription.valueFrom": "=",
  "markDescription.valueRegex": "=正则({{regex}})",
  "markDescription.mediaLibraryLayer.current": "→当前层级",
  "markDescription.mediaLibraryFrom": "→",
  "markDescription.mediaLibraryRegex": "→正则({{regex}})",
  "markDescription.fileOnly": "仅文件",
  "markDescription.dirOnly": "仅目录",
  "markDescription.empty": "无描述",
  "markDescription.invalid": "配置无效",
  "pathMarkConfig.tip.clickToEditRightClickDelete": "点击编辑，右键删除",
  "pathMarkConfig.status.syncProgress": "同步中: {{progress}}%",
  "pathMarkConfig.tip.recheckAfter": "重新检查于",
  "pathMarkConfig.action.viewAllMarks": "查看全部标记",
  "pathMarkGuide.welcome.title": "欢迎使用路径标记",
  "pathMarkGuide.welcome.description": "路径标记帮助您通过在文件路径上定义规则来组织媒体库。您可以指定哪些文件是资源、分配属性，并将它们与媒体库关联。",
  "pathMarkGuide.markTypes.title": "三种标记类型",
  "pathMarkGuide.markTypes.subtitle": "每种标记类型在组织内容方面都有不同的用途。",
  "pathMarkGuide.markTypes.resource": "资源标记（核心）",
  "pathMarkGuide.markTypes.resourceDesc": "将文件或文件夹标识为媒体库中的资源。使用层级或正则表达式匹配路径。",
  "pathMarkGuide.markTypes.resourceImportant": "资源标记是整个系统的基础 - 只有设置了资源标记后，您才能在资源页面中查看和管理您的资源。没有资源标记，系统将无法知道要追踪哪些文件。",
  "pathMarkGuide.markTypes.property": "属性标记",
  "pathMarkGuide.markTypes.propertyDesc": "自动为匹配的资源分配属性值（如标签、分类）。",
  "pathMarkGuide.markTypes.mediaLibrary": "媒体库标记",
  "pathMarkGuide.markTypes.mediaLibraryDesc": "将资源与特定媒体库关联，便于更好地管理。",
  "pathMarkGuide.configure.title": "如何配置",
  "pathMarkGuide.configure.subtitle": "按照以下步骤设置您的路径标记。",
  "pathMarkGuide.configure.step1": "在文件树中导航到一个文件夹并选择它。",
  "pathMarkGuide.configure.step2": "右键单击或使用「添加标记」按钮创建标记。",
  "pathMarkGuide.configure.step3": "配置匹配规则并预览受影响的路径。",
  "pathMarkGuide.sync.title": "同步与管理",
  "pathMarkGuide.sync.subtitle": "标记需要同步后才能生成实际数据。",
  "pathMarkGuide.sync.explanation": "创建标记后并不会立刻生成资源。同步是读取您设置的标记并生成相应数据（资源、属性、媒体库关联）的过程。",
  "pathMarkGuide.sync.point1": "默认情况下，自动同步已启用，会在标记变更后自动运行。您可以在设置中禁用自动同步。",
  "pathMarkGuide.sync.point2": "如果禁用了自动同步，可以使用「待同步」按钮手动触发同步。",
  "pathMarkGuide.skip": "跳过",
  "pathMarkGuide.previous": "上一步",
  "pathMarkGuide.next": "下一步",
  "pathMarkGuide.getStarted": "开始使用",
  "pathMarkConfig.label.nextStepHint": "下一步：查看所有已配置的标记，或配置资源扩展来定义增强器、播放器等设置",
  "pathMarkConfig.action.goToResourceProfile": "配置资源扩展",
  "pathMarkConfig.label.keepResourcesOnPathChange": "保持资源身份标识",
  "pathMarkConfig.tip.keepResourcesOnPathChange": "通常情况下，系统会为每个资源路径创建一条资源数据。启用此选项后，系统会在资源文件夹中生成标记文件（bakabase.json）。下次同步资源标记时，如果资源路径发生变动，系统将不会为新路径创建新的资源数据，而是通过标记文件找到原有资源数据并更新其路径。"
};
const cnComparison = {
  "comparison.action.createPlan": "创建方案",
  "comparison.action.editPlan": "编辑方案",
  "comparison.action.delete": "删除",
  "comparison.action.duplicate": "复制",
  "comparison.action.execute": "执行",
  "comparison.action.reExecute": "再次执行",
  "comparison.action.viewResults": "查看结果",
  "comparison.action.viewGroups": "查看 {{count}} 个分组",
  "comparison.action.clearResults": "清除结果",
  "comparison.action.edit": "编辑",
  "comparison.action.editRules": "配置规则",
  "comparison.action.editFilters": "配置筛选",
  "comparison.action.addRule": "添加规则",
  "comparison.action.editRule": "编辑规则",
  "comparison.action.selectProperty": "选择属性",
  "comparison.action.configureSpecialText": "配置特殊文本规则",
  "comparison.action.hideGroup": "隐藏此分组",
  "comparison.action.unhideGroup": "取消隐藏此分组",
  "comparison.action.viewNetworkGraph": "查看关系图",
  "comparison.confirm.navigateToSpecialText": "您即将离开当前页面并跳转到特殊文本配置页面。任何未保存的更改将会丢失。是否继续？",
  "comparison.confirm.delete": '确定要删除方案 "{{name}}" 吗？',
  "comparison.confirm.clearResults": '确定要清除 "{{name}}" 的所有结果吗？',
  "comparison.success.duplicated": "方案复制成功",
  "comparison.success.taskStarted": "对比任务已启动",
  "comparison.success.resultsCleared": "结果已清除",
  "comparison.error.taskFailed": "启动对比任务失败",
  "comparison.error.nameRequired": "名称不能为空",
  "comparison.error.rulesRequired": "至少需要一条规则",
  "comparison.error.propertyRequired": "所有规则必须选择属性",
  "comparison.empty.noPlans": "暂无对比方案",
  "comparison.empty.description": "创建对比方案以查找重复或相似的资源",
  "comparison.empty.noRules": "未定义规则。请至少添加一条规则。",
  "comparison.empty.noFilters": "未配置筛选条件（将对比所有资源）",
  "comparison.empty.noResults": "未找到对比结果",
  "comparison.empty.noResources": "此分组中没有资源",
  "comparison.label.planCount": "方案总数",
  "comparison.label.ruleCount": "{{count}} 条规则",
  "comparison.label.resultGroups": "找到 {{count}} 组",
  "comparison.label.noResultsFound": "无重复",
  "comparison.label.threshold": "权重阈值",
  "comparison.label.createdAt": "创建于",
  "comparison.label.lastRun": "上次运行",
  "comparison.label.rules": "规则",
  "comparison.label.rule": "规则",
  "comparison.label.name": "名称",
  "comparison.label.property": "属性",
  "comparison.label.propertyPool": "属性池",
  "comparison.label.propertyId": "属性 ID",
  "comparison.label.mode": "对比模式",
  "comparison.label.normalize": "文本标准化",
  "comparison.label.weight": "权重",
  "comparison.label.isVeto": "是否为否决规则",
  "comparison.label.vetoThreshold": "否决阈值",
  "comparison.label.oneNullBehavior": "单方空值行为",
  "comparison.label.bothNullBehavior": "双方空值行为",
  "comparison.label.tolerance": "容差值",
  "comparison.label.tolerancePercent": "容差百分比",
  "comparison.label.windowHours": "时间窗口（小时）",
  "comparison.label.regexPattern": "正则表达式",
  "comparison.label.minMemberCount": "最小组大小",
  "comparison.label.totalGroups": "总组数",
  "comparison.label.hiddenGroups": "已隐藏",
  "comparison.label.group": "分组",
  "comparison.label.resources": "个资源",
  "comparison.label.resourceIds": "资源 ID",
  "comparison.label.filters": "筛选条件",
  "comparison.label.includeHidden": "包含已隐藏的分组",
  "comparison.label.primaryResource": "主要资源（建议保留）",
  "comparison.hint.viewResourcesInMainPage": "您可以在主资源页面通过 ID 搜索来查看这些资源",
  "comparison.hint.rerunAfterEdit": "编辑资源信息后，需要返回对比方案重新执行计算才会生成新的对比结果",
  "comparison.hint.configureRulesAfterCreation": "创建后可以在方案详情中配置规则和筛选条件",
  "comparison.hint.filtersConfigured": "已配置筛选条件",
  "comparison.propertyPool.internal": "内置",
  "comparison.propertyPool.reserved": "保留",
  "comparison.propertyPool.custom": "自定义",
  "comparison.mode.strictEqual": "严格相等",
  "comparison.mode.strictEqual.description": "二元得分：相等得 1，否则得 0。例：4 vs 4 → 1，4 vs 5 → 0",
  "comparison.mode.normalizedText": "标准化文本",
  "comparison.mode.normalizedText.description": "忽略大小写、空格和特殊字符后比较",
  "comparison.mode.textSimilarity": "文本相似度",
  "comparison.mode.textSimilarity.description": "字符级 Jaccard 相似度（0~1）。例：'abc' vs 'abd' → 交集 {a,b} / 并集 {a,b,c,d} = 0.5",
  "comparison.mode.regexExtractNumber": "正则提取数字",
  "comparison.mode.regexExtractNumber.description": "使用正则提取数字（如 'v1', 'ep2', '第3'）后比较。二元得分：相等得 1，否则得 0",
  "comparison.mode.fixedTolerance": "固定容差",
  "comparison.mode.fixedTolerance.description": "二元得分：|差值| ≤ 容差得 1，否则得 0。例：容差=1 时，4 vs 5 → 1（差1），4 vs 6 → 0（差2）",
  "comparison.mode.relativeTolerance": "相对容差",
  "comparison.mode.relativeTolerance.description": "二元得分：|差值|/最大值 ≤ 百分比得 1，否则得 0。例：20% 时，4 vs 5 → 1（1/5=20%），4 vs 6 → 0（2/6=33%）",
  "comparison.mode.setIntersection": "集合交集",
  "comparison.mode.setIntersection.description": "Jaccard 指数（0~1）：交集/并集。例：{A,B,C} vs {B,C,D} → {B,C}/{A,B,C,D} = 2/4 = 0.5",
  "comparison.mode.subset": "子集",
  "comparison.mode.subset.description": "二元得分：A⊆B 或 B⊆A 得 1，否则得 0。例：{A,B} vs {A,B,C} → 1，{A,B} vs {B,C} → 0",
  "comparison.mode.timeWindow": "时间窗口",
  "comparison.mode.timeWindow.description": "二元得分：时间差 ≤ 窗口得 1，否则得 0。例：窗口=24h 时，相差 12h → 1，相差 36h → 0",
  "comparison.mode.sameDay": "同一天",
  "comparison.mode.sameDay.description": "二元得分：同一日历日期得 1，否则得 0。例：2024-01-01 10:00 vs 2024-01-01 22:00 → 1",
  "comparison.mode.extensionMap": "扩展名映射",
  "comparison.mode.extensionMap.description": "比较文件扩展名分布（0~1）。例：[.jpg,.jpg,.png] vs [.jpg,.png,.png] → 分布相似度",
  "comparison.nullBehavior.skip": "跳过",
  "comparison.nullBehavior.skip.description": "跳过此规则，不影响最终得分",
  "comparison.nullBehavior.fail": "失败",
  "comparison.nullBehavior.fail.description": "规则得分为 0",
  "comparison.nullBehavior.pass": "通过",
  "comparison.nullBehavior.pass.description": "规则得分为 1",
  "comparison.description.filters": "可选，限定参与对比的资源范围，不设置则对比所有资源",
  "comparison.description.rules": "必填，定义资源相似性的判断标准",
  "comparison.description.execute": "运行对比任务并查看结果",
  "comparison.description.executeDisabledNoRules": "请先添加至少一条规则",
  "comparison.description.threshold": "总分 ≥ 此阈值的资源将被视为相似/重复",
  "comparison.description.weight": "规则在总分中的权重系数",
  "comparison.description.isVeto": "开启后，若此规则得分低于阈值，则整体判定为不匹配",
  "comparison.description.vetoThreshold": "触发否决的最低得分阈值",
  "comparison.description.normalize": "对比前先进行文本标准化处理（忽略大小写、空格和特殊字符）",
  "comparison.description.oneNullBehavior": "当其中一个资源的属性值为空时的处理方式",
  "comparison.description.bothNullBehavior": "当两个资源的属性值都为空时的处理方式",
  "comparison.description.tolerance": "允许的最大绝对差值。例：容差=1 时，4 和 5 匹配（差值=1）",
  "comparison.description.tolerancePercent": "允许的最大相对差值（0~1）。例：0.2 表示 20%，4 和 5 匹配（1/5=20%）",
  "comparison.description.windowHours": "允许的最大时间差（小时）。例：24 表示 24 小时内的时间匹配",
  "comparison.description.regexPattern": "自定义正则表达式提取数字。留空则使用内置规则（如 v1, ep2, #3）",
  "comparison.scoring.title": "评分计算说明",
  "comparison.scoring.formula": "总分 = Σ(规则得分 × 规则权重) / Σ(规则权重) × 100%",
  "comparison.scoring.ruleScore": "每条规则根据对比模式计算出 0~1 的得分",
  "comparison.scoring.weightedSum": "各规则得分乘以其权重后求和，再除以权重总和得到加权平均分",
  "comparison.scoring.threshold": "当总分 ≥ 阈值时，判定两个资源为相似/重复",
  "comparison.scoring.example": "例：规则A(权重2)得分0.8，规则B(权重1)得分0.6，则总分 = (0.8×2 + 0.6×1) / (2+1) × 100% = 73.3%",
  "comparison.networkGraph.title": "资源关系图",
  "comparison.networkGraph.hint": "仅显示相似度超过方案阈值的关系。将鼠标悬停在连线上可查看详细对比信息。",
  "comparison.networkGraph.truncatedWarning": "显示 {{shown}}/{{total}} 条关系（出于性能考虑进行了限制）",
  "comparison.networkGraph.nodeCount": "{{count}} 个资源",
  "comparison.networkGraph.edgeCount": "{{count}} 条关系",
  "comparison.networkGraph.pairScore": "相似度：{{score}}%",
  "comparison.networkGraph.ruleDetails": "规则详情",
  "comparison.networkGraph.skipped": "已跳过",
  "comparison.networkGraph.vetoed": "已否决",
  "comparison.networkGraph.noData": "无关系数据"
};
const cnFileExplorer = {
  "fileExplorer.error.noFilesUnderPath": "此路径下没有文件",
  "fileExplorer.modal.multipleFileTypesFound": "发现多种文件类型",
  "fileExplorer.tip.pleaseSelectOneToOpen": "请选择一个打开",
  "fileExplorer.success.movedItems": "已移动 {{count}} 个项目",
  "fileExplorer.error.failedToMoveItems": "移动项目失败",
  "fileExplorer.tip.quickPreviewUsingDefaultApp": "使用默认应用快速预览",
  "fileExplorer.tip.openInMediaPlayer": "在媒体播放器中打开",
  "fileExplorer.empty.noContent": "无内容",
  "fileExplorer.contextMenu.openInFileManager": "在系统文件管理器中打开",
  "fileExplorer.contextMenu.enterDirectory": "进入目录",
  "fileExplorer.contextMenu.createNewFolder": "新建文件夹",
  "fileExplorer.contextMenu.expand": "展开",
  "fileExplorer.contextMenu.expandSelected": "展开所选",
  "fileExplorer.contextMenu.collapse": "折叠",
  "fileExplorer.contextMenu.collapseSelected": "折叠所选",
  "fileExplorer.contextMenu.decompressFiles": "解压 {{count}} 个文件",
  "fileExplorer.contextMenu.startDecompressing": "开始解压",
  "fileExplorer.contextMenu.extractDirectories": "提取 {{count}} 个目录",
  "fileExplorer.contextMenu.wrapItems": "使用目录包装 {{count}} 个项目",
  "fileExplorer.contextMenu.deleteItems": "删除 {{count}} 个项目",
  "fileExplorer.contextMenu.deleteItemsWithSameNames": "删除同名项目",
  "fileExplorer.contextMenu.moveItems": "移动 {{count}} 个项目",
  "fileExplorer.contextMenu.autoGroupSelectedFiles": "自动分组 {{count}} 个所选文件",
  "fileExplorer.contextMenu.autoGroupInternalItems": "自动分组 {{count}} 个所选目录的内部项目",
  "fileExplorer.contextMenu.useBulkDecompressionTool": "使用批量解压工具",
  "fileExplorer.contextMenu.copyNames": "复制 {{count}} 个名称",
  "fileExplorer.contextMenu.copyPaths": "复制 {{count}} 个路径",
  "fileExplorer.contextMenu.copied": "已复制",
  "fileExplorer.contextMenu.failedToCopy": "复制失败",
  "fileExplorer.contextMenu.batchRename": "批量重命名 {{count}} 个项目",
  "fileExplorer.createDirectoryModal.title": "新建文件夹",
  "fileExplorer.createDirectoryModal.okButton": "创建",
  "fileExplorer.createDirectoryModal.description": "在此路径下新建文件夹",
  "fileExplorer.deleteModal.title": "确定删除？",
  "fileExplorer.deleteModal.okButton": "删除",
  "fileExplorer.deleteSameNamesModal.title": "删除同名项目",
  "fileExplorer.deleteSameNamesModal.okButton": "删除",
  "fileExplorer.deleteSameNamesModal.nothingToDelete": "没有可删除的项目",
  "fileExplorer.deleteSameNamesModal.description": "删除 {{workingDirectory}} 中与所选 {{count}} 个文件系统条目同名的所有条目",
  "fileExplorer.deleteSameNamesModal.discovering": "正在查找同名文件",
  "fileExplorer.extractModal.title": "提取 {{count}} 个目录",
  "fileExplorer.extractModal.okButton": "提取",
  "fileExplorer.extractModal.otherFiles": "其他文件",
  "fileExplorer.extractModal.otherFilesIn": "{{parent}} 中的其他文件",
  "fileExplorer.groupModal.title": "分组 {{count}} 个项目",
  "fileExplorer.groupModal.titleInternal": "分组内部项目",
  "fileExplorer.groupModal.okButton": "分组",
  "fileExplorer.groupModal.allItemsOneFolder": "所有项目将存放在同一个文件夹中",
  "fileExplorer.groupModal.exactSameNameFolder": "名称完全相同（不含扩展名）的项目将存放在同一个文件夹中",
  "fileExplorer.groupModal.similarityThreshold": "相似度阈值",
  "fileExplorer.groupModal.nothingToGroup": "没有可分组的内容。请检查文件夹是否包含文件；子文件夹无法分组",
  "fileExplorer.groupModal.calculating": "正在计算变更...",
  "fileExplorer.wrapModal.title": "包装 {{count}} 个文件条目",
  "fileExplorer.wrapModal.okButton": "包装",
  "fileExplorer.action.decompress": "解压",
  "fileExplorer.action.wrap": "包装",
  "fileExplorer.action.move": "移动",
  "fileExplorer.tip.extractChildrenToParent": "提取子项到父目录并删除当前目录",
  "fileExplorer.label.shortcuts": "快捷键",
  "fileExplorer.shortcut.selectPrevious": "选择上一个",
  "fileExplorer.shortcut.selectNext": "选择下一个",
  "fileExplorer.shortcut.enterDirectory": "进入目录",
  "fileExplorer.shortcut.selectAll": "全选",
  "fileExplorer.shortcut.copy": "复制",
  "fileExplorer.shortcut.cut": "剪切",
  "fileExplorer.shortcut.pasteMove": "粘贴（移动文件）",
  "fileExplorer.capability.select": "选择",
  "fileExplorer.capability.multiSelect": "多选",
  "fileExplorer.capability.rangeSelect": "范围选择",
  "fileExplorer.capability.wrap": "包装",
  "fileExplorer.capability.extract": "提取",
  "fileExplorer.capability.move": "移动",
  "fileExplorer.capability.delete": "删除",
  "fileExplorer.capability.rename": "重命名",
  "fileExplorer.capability.decompress": "解压",
  "fileExplorer.capability.deleteAllSameName": "删除同名项",
  "fileExplorer.capability.group": "分组",
  "fileExplorer.capability.play": "播放",
  "fileExplorer.capability.playFirstFile": "播放第一个文件",
  "fileExplorer.capability.createDirectory": "新建文件夹",
  "fileExplorer.shortcutKey.leftClick": "左键点击",
  "fileExplorer.shortcutKey.ctrlClick": "Ctrl+点击",
  "fileExplorer.shortcutKey.shiftClick": "Shift+点击",
  "fileExplorer.shortcutKey.w": "W",
  "fileExplorer.shortcutKey.e": "E",
  "fileExplorer.shortcutKey.m": "M",
  "fileExplorer.shortcutKey.delete": "Delete",
  "fileExplorer.shortcutKey.f2": "F2",
  "fileExplorer.shortcutKey.d": "D",
  "fileExplorer.shortcutKey.g": "G",
  "fileExplorer.shortcutKey.space": "空格",
  "fileExplorer.shortcutKey.n": "N"
};
const cnResourceFilter = {};
const cnEnhancer = {
  "enhancer.selector.title": "增强器",
  "enhancer.selector.producesValues.label": "此增强器可以生成以下属性值",
  "enhancer.selector.targetValueType.label": "此目标的值类型为",
  "enhancer.selector.setup.action": "设置",
  "enhancer.selector.deleteRecordsForCategory.confirm": "删除此增强器在分类 {{categoryName}} 下的所有增强记录",
  "enhancer.selector.deleteAllRecords.confirm": "删除此增强器的所有增强记录",
  "enhancer.selector.reapplyForCategory.confirm": "重新应用此增强器在分类 {{categoryName}} 下的所有增强数据",
  "enhancer.options.keywordProperty.label": "增强时使用的属性值",
  "enhancer.options.keywordProperty.description": "通常，此增强器会使用资源的文件/文件夹名称来执行增强，无需更改此设置。",
  "enhancer.options.keywordProperty.tip": "在某些情况下，你可以更改增强时使用的属性值，以对其他属性值执行增强。",
  "enhancer.options.selectProperty.action": "选择属性",
  "enhancer.options.propertyValueScope.label": "属性值作用域",
  "enhancer.options.propertyValueScope.description": "属性值作用域通常表示属性值是由谁生成的。",
  "enhancer.options.propertyValueScope.tip": "对于内部选项，属性值作用域将被忽略。",
  "enhancer.options.manualScope.title": "已选择手动属性值作用域",
  "enhancer.options.manualScope.description": "手动属性值作用域意味着属性值由你自己生成，这些值通常在增强时尚不可用。",
  "enhancer.options.manualScope.confirm": "我已了解",
  "enhancer.options.pretreat.label": "预处理属性值",
  "enhancer.options.pretreat.description": "如果勾选，属性值将在增强前进行预处理。",
  "enhancer.options.pretreat.tip": "你可以在数据菜单下的特殊文本页面配置需要预处理的特殊文本。",
  "enhancer.options.pretreat.action": "点击查看特殊文本",
  "enhancer.options.configure.title": "配置增强器",
  "enhancer.options.runAfter.label": "在以下增强器之后运行",
  "enhancer.options.runAfter.description": "你可以通过自定义增强器的执行顺序来进行链式增强。",
  "enhancer.options.runAfter.tip": "通常，留空即可。",
  "enhancer.options.enhanceProperties.label": "增强属性",
  "enhancer.options.enhanceProperties.tip": "请至少选择一个要增强的属性。",
  "enhancer.categoryOptions.title": "为分类 {{categoryName}} 配置增强器 {{enhancerName}}",
  "enhancer.regex.captureGroups.label": "可用的捕获组：",
  "enhancer.regex.captureGroups.warning": "未找到命名捕获组，增强将不会生效。",
  "enhancer.regex.expressions.description": "你可以设置多个正则表达式（每行一个）来匹配每个资源的文件或文件夹名称。",
  "enhancer.regex.captureGroups.mergeDescription": "由多个同名捕获组匹配的文本将被合并为列表并去重。",
  "enhancer.regex.expressions.categoryTip": "设置正则表达式后，你必须去分类页面为每个分类配置正则增强器。",
  "enhancer.regex.expressions.namingTip": "你需要使用与捕获组相同的名称（基于索引的组名将被忽略）作为动态增强目标，否则资源可能不会被增强。",
  "enhancer.regex.expressions.label": "正则表达式",
  "enhancer.target.fixed.label": "增强目标",
  "enhancer.target.saveAsProperty.label": "保存为属性",
  "enhancer.target.otherOptions.label": "其他选项",
  "enhancer.target.specifyDynamic.action": "指定动态目标",
  "enhancer.target.default.label": "默认",
  "enhancer.target.clickToSpecify.action": "点击指定目标",
  "enhancer.target.noProperty.warning": "由于没有属性可以存储，此目标将不会被应用。",
  "enhancer.target.selectProperty.action": "选择属性",
  "enhancer.target.unbind.action": "取消绑定",
  "enhancer.target.label": "目标",
  "enhancer.target.duplicateDynamic.error": "发现重复的动态目标",
  "enhancer.target.dynamicLabel.tip": "这不是一个固定的增强目标，在收集数据时会被替换为其他内容",
  "enhancer.target.configured.label": "已配置",
  "enhancer.target.bindProperty.label": "绑定属性",
  "enhancer.targetOptions.autoMatch.label": "空值自动匹配",
  "enhancer.targetOptions.autoMatch.description": "默认情况下，如果多层级数据中遇到空值，将创建一个空层。",
  "enhancer.targetOptions.autoMatch.checkedBehavior": "如果勾选，这类数据将与数据库中最相似的多层级值进行匹配。",
  "enhancer.targetOptions.autoMatch.example": "例如，假设我们已有多层级数据：a->b->c，对于传入的数据：->->c，其第1层和第2层的值为空。",
  "enhancer.targetOptions.autoMatch.exampleResult": "如果勾选此选项，->->c 将被保存为 a->b->c，否则传入值 ->->c 将被直接保存。",
  "enhancer.targetOptions.autoMatch.warning": "此选项可能导致意外行为，请确保你有足够的把握将生成的数据合并到数据库中再勾选。",
  "enhancer.targetOptions.autoBind.label": "自动绑定属性",
  "enhancer.targetOptions.autoBind.description": "如果勾选此选项，将自动绑定与目标同名同类型的属性。",
  "enhancer.targetOptions.autoBind.createTip": "如果不存在这样的属性，将创建一个新属性并绑定到此目标。",
  "enhancer.targetOptions.autoBind.dynamicTip": "如果在动态目标的默认选项中勾选此选项，所有未列出的动态目标将绑定到同类型同名的属性。",
  "enhancer.targetOptions.propertyNotBound.warning": "此属性未绑定到分类，其数据将不会显示。",
  "enhancer.targetOptions.bindToCategory.title": "将属性 {{propertyName}} 绑定到分类 {{categoryName}}",
  "enhancer.targetOptions.bindToCategory.action": "立即绑定",
  "enhancer.tip.partialSetup.warning": "部分目标未映射到属性，相应的数据将不会被增强。",
  "enhancer.tip.noSetup.warning": "没有目标映射到属性，因此不会增强任何数据。",
  "enhancer.records.title": "增强记录",
  "enhancer.records.noProfilesFound.warning": "未找到配置了此增强器的资源扩展",
  "enhancer.records.configure.action": "配置增强器",
  "enhancer.records.selectProfile.label": "选择资源扩展",
  "enhancer.records.noProfiles.title": "此增强器未配置任何资源扩展",
  "enhancer.records.noProfiles.description": "请配置包含 {{enhancerName}} 增强器的资源扩展以启用数据获取",
  "enhancer.records.goToProfiles.action": "前往资源扩展",
  "enhancer.records.noData.title": "暂无增强数据",
  "enhancer.records.noData.description": "增强数据将在后台自动生成，你也可以点击上方按钮手动触发",
  "enhancer.records.enhanceNow.action": "立即增强",
  "enhancer.records.resourcePath.label": "资源路径",
  "enhancer.records.noEnhancers.title": "未配置增强器",
  "enhancer.records.noEnhancers.description": "此资源暂无增强记录。请在资源扩展中配置增强器以启用自动数据增强。",
  "enhancer.records.dataCreatedAt.label": "数据创建时间",
  "enhancer.records.dataCreatedAt.tip": "数据已创建，表明增强器已完成数据获取过程，通常是通过访问第三方网站或执行特定内部逻辑来完成的。你可以在下表中查看数据获取状态。频繁重复的数据获取尝试可能导致第三方服务拒绝访问。",
  "enhancer.records.dataAppliedAt.label": "数据应用时间",
  "enhancer.records.dataAppliedAt.tip": "数据的应用表明已获取的数据已成功转换为属性值。此步骤完全在程序内部进行，不涉及任何第三方数据交换。",
  "enhancer.records.enhanceProcess.tip": "先获取数据再应用数据。为减少第三方服务拒绝访问的可能性，建议在所有数据获取完成后再应用数据。在分类中配置增强器选项不会影响数据获取过程，只会影响数据应用过程。",
  "enhancer.records.reEnhance.action": "重新增强",
  "enhancer.records.applyData.tip": "将数据应用到资源的属性值。",
  "enhancer.records.applyData.action": "应用数据",
  "enhancer.records.notConfigured.title": "增强器未在资源扩展中配置",
  "enhancer.records.notConfigured.description": "此增强器当前未在任何资源扩展中配置。以下显示的数据来自之前的增强。要启用自动更新，请在资源扩展设置中配置此增强器。",
  "enhancer.records.error.title": "增强错误",
  "enhancer.records.configUpdated.label": "增强器配置已更新",
  "enhancer.records.rawData.label": "原始数据",
  "enhancer.records.generatedValue.label": "生成的自定义属性值",
  "enhancer.records.noFixedData.warning": "未获取到固定目标的数据，如有必要请检查配置",
  "enhancer.records.noDynamicData.warning": "未获取到动态目标的数据，如有必要请检查配置",
  "enhancer.records.unsupportedReservedType.error": "不支持的保留属性类型：{{type}}",
  "enhancer.records.unsupportedPropertyType.error": "不支持的属性类型：{{type}}",
  "enhancer.logs.title": "增强日志",
  "enhancer.logs.timestamp.label": "时间戳",
  "enhancer.logs.level.label": "级别",
  "enhancer.logs.event.label": "事件",
  "enhancer.logs.data.label": "数据",
  "enhancer.logs.viewData.action": "查看数据",
  "enhancer.logs.copiedToClipboard.label": "已复制到剪贴板",
  "propertyMatcher.autoMatch.tooltip": "自动匹配属性",
  "propertyMatcher.noName.title": "未提供有效的属性名称",
  "propertyMatcher.noName.description": "请提供属性名称",
  "propertyMatcher.noMatch.title": "未找到合适的属性",
  "propertyMatcher.noMatch.youCan": "你可以",
  "propertyMatcher.autoCreate.label": "自动创建新属性",
  "propertyMatcher.selectManually.label": "手动选择",
  "propertyMatcher.partialMatch.title": "部分属性无法匹配",
  "propertyMatcher.autoMatched.label": "已自动匹配",
  "propertyMatcher.missing.label": "缺失",
  "propertyMatcher.recommended.label": "推荐",
  "propertyMatcher.autoCreateMissing.label": "自动创建缺失的属性",
  "propertyMatcher.keepMatched.label": "保留已匹配的属性，手动处理缺失的属性"
};
const Name = "名称";
const Precision = "精度";
const Preview$1 = "预览";
const Continue = "继续";
const Convert = "转换";
const Text = "文本";
const Option = "选项";
const DateTime = "日期时间";
const Other = "其他";
const UnderDevelopment = "开发中";
const Submit = "提交";
const Untitled = "未命名";
const cnProperty = {
  "property.empty.noPropertiesAvailable": "没有可用的属性",
  "property.empty.noPropertiesFound": "未找到属性",
  "property.action.addProperty": "添加属性",
  "property.action.searchProperties": "搜索属性",
  "property.modal.selectProperties": "选择属性",
  "property.modal.selectProperty": "选择一个属性",
  "property.modal.adjustPropertyOrderTitle": "调整属性顺序",
  "property.tip.clickToEditOrder": "点击编辑顺序",
  "property.tip.orderEditInstructions": "点击顺序编号直接编辑，或使用按钮移动到顶部/底部",
  "property.modal.bulkEditProperties": "批量编辑属性",
  "property.modal.confirmPropertyChange": "确认属性更改",
  "property.success.propertyUpdatedSuccessfully": "属性更新成功",
  "property.error.failedToUpdateProperty": "更新属性失败",
  "property.warning.willOverrideValues": "这将覆盖 {{count}} 个资源上的不同值",
  "property.attachment.selectFromFileSystem": "从文件系统选择",
  "property.attachment.uploadFromLocal": "从本地上传",
  "property.attachment.uploadHint": "上传的文件将保存在应用数据路径下的 data/attachments 文件夹中",
  "Custom property": "自定义属性",
  "Select a type": "选择类型",
  "Click to change type": "点击更改类型",
  Name,
  "Default value": "默认值",
  Precision,
  Preview: Preview$1,
  "Show progressbar": "显示进度条",
  "Max value": "最大值",
  "Formula syntax": "公式语法",
  "You are changing property type": "正在更改属性类型",
  "Changing the property type may cause the loss of existing data. Click 'continue' to check.": "更改属性类型可能导致现有数据丢失。点击'继续'以检查。",
  "Following rule(s) will be applied": "将应用以下规则",
  Continue,
  "Final check": "最终确认",
  "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted": "找到 {{count}} 条数据，其中 {{changedDataCount}} 条将被修改或删除",
  "Found {{count}} data, and all of them will be retained": "找到 {{count}} 条数据，且全部将被保留",
  "Be careful, this process is irreversible": "请注意，此过程不可逆",
  "Source value": "源值",
  "Converted value": "转换后的值",
  Convert,
  Text,
  "Number": "数字",
  Option,
  DateTime,
  Other,
  UnderDevelopment,
  "Sort by alphabet": "按字母排序",
  "Add a choice": "添加选项",
  "Add or delete in bulk": "批量增删",
  "Add or delete choices in bulk": "批量增删选项",
  "Choices will be separated by line breaks.": "选项将以换行符分隔。",
  "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted.": "点击提交后，新选项将被添加到列表中，缺失的选项将被删除。",
  "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted.": "注意：一旦修改某行文本，该行将被视为新选项，原选项将被删除。",
  "{{count}} data will be deleted": "{{count}} 条数据将被删除",
  "{{count}} data will be added": "{{count}} 条数据将被添加",
  Submit,
  Untitled,
  "Add root data": "添加根数据",
  "Add or delete tags in bulk": "批量增删标签",
  "Colon can be added between group and name, and tags will be separated by line breaks.": "可在分组和名称之间添加冒号，标签将以换行符分隔。",
  "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted.": "点击提交后，新标签将被添加到列表中，缺失的标签将被删除。",
  "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted.": "注意：一旦修改某行文本，该行将被视为新标签，原标签将被删除。"
};
const cnMediaPlayer = {};
const onboarding = {
  skip: "跳过",
  previous: "上一步",
  next: "下一步",
  start: "开始使用",
  viewAgain: "再次查看引导",
  welcome: {
    title: "欢迎使用 Bakabase",
    description: "让我们快速了解一下 Bakabase 的核心功能,帮助你更好地管理和浏览你的媒体资源。"
  },
  pathMark: {
    title: "路径标记",
    subtitle: "连接你的媒体库,开始管理资源",
    point1: "添加媒体文件夹作为路径标记",
    point2: "为不同类型的资源设置标签",
    point3: "自动扫描并索引你的媒体文件"
  },
  resourceProfile: {
    title: "资源扩展",
    subtitle: "自定义资源的展示和处理方式",
    point1: "为不同类型的资源创建配置方案",
    point2: "设置资源的元数据增强规则",
    point3: "配置资源的播放和预览选项"
  },
  resourceBrowsing: {
    title: "资源浏览",
    subtitle: "强大的搜索和筛选功能",
    point1: "使用多种条件筛选资源",
    point2: "在列表视图和网格视图间切换",
    point3: "快速查找和访问你的资源"
  },
  fileProcessor: {
    title: "文件处理器",
    subtitle: "自动化处理你的媒体文件",
    point1: "自动解压缩文件",
    point2: "定期同步和更新资源",
    point3: "批量处理文件操作"
  },
  downloader: {
    title: "下载器",
    subtitle: "增强资源的元数据和封面",
    point1: "自动下载视频预览",
    point2: "获取高质量封面图片",
    point3: "同步第三方平台的元数据"
  },
  fileMover: {
    title: "文件移动器",
    subtitle: "智能整理你的文件结构",
    point1: "根据规则自动移动文件",
    point2: "自定义文件命名格式",
    point3: "批量重组文件夹结构"
  },
  completion: {
    title: "准备就绪!",
    description: "你已经了解了 Bakabase 的主要功能。现在可以开始添加你的第一个路径标记,开始管理你的媒体资源了!",
    hint: "你可以随时在设置中再次查看本指南"
  }
};
const cnOnboarding = {
  onboarding
};
const Property$1 = "属性";
const cnResourceComponent = {
  "resource.playControl.tooltip.cachePreparing": "缓存准备中，请稍候...\n可在左下角后台任务悬浮球中查看进度",
  "resource.playControl.tooltip.loading": "正在加载可播放文件...",
  "resource.playControl.tooltip.notFound": "未找到可播放文件",
  "resource.playControl.noPlayableFiles.title": "未找到可播放文件",
  "resource.playControl.noPlayableFiles.description": "当前资源中没有找到可播放的媒体文件。",
  "resource.playControl.noPlayableFiles.tips.title": "可能的原因",
  "resource.playControl.noPlayableFiles.tips.noFile": "资源目录中没有支持的媒体文件",
  "resource.playControl.noPlayableFiles.tips.extension": "文件扩展名不在可播放类型列表中",
  "resource.playControl.noPlayableFiles.action.title": "解决方案",
  "resource.playControl.noPlayableFiles.action.description": "您可以在资源扩展中配置可播放文件类型",
  "resource.playControl.noPlayableFiles.action.settings": "前往资源扩展配置",
  "resource.playControl.noPlayableFiles.matchingProfiles": "匹配的资源扩展：",
  "resource.playControl.noPlayableFiles.noMatchingProfiles": "未找到匹配的资源扩展",
  "resource.playControl.modal.selectFileTitle": "请选择要播放的文件",
  "resource.playControl.modal.showAllFiles": "显示全部 {{count}} 个文件",
  "resource.playControl.modal.loadAllFiles": "加载全部文件",
  "resource.playControl.modal.autoSelectFirstFile": "当存在多个可播放文件时自动选择第一个",
  "resource.playControl.toast.autoSelectEnabled": "已启用自动选择第一个可播放文件。您可以在资源页面设置中更改此选项。",
  "resource.cover.tooltip.cachePreparing": "封面缓存准备中...",
  "resource.cover.tooltip.loading": "正在加载封面...",
  "resource.tip.isParentResource": "这是一个父资源",
  "resource.tip.fileNotExist": "文件不存在",
  "resource.tip.unknownMediaLibrary": "未知的媒体库",
  "resource.tip.clickToViewEditProfile": "点击查看和编辑此配置",
  "resource.tip.hierarchyDescription": "资源关系由物理路径结构决定。",
  "resource.tip.removeFromMediaLibrary": "从此媒体库移除",
  "resource.tip.clickToViewFullIntroduction": "点击查看完整简介",
  "resource.tip.clickToAddIntroduction": "点击添加简介",
  "resource.label.resourceId": "资源 ID",
  "resource.label.resourceProfiles": "资源扩展",
  "resource.label.playedJustNow": "刚刚播放",
  "resource.label.playedMinutesAgo": "{{n}} 分钟前播放",
  "resource.label.playedHoursAgo": "{{n}} 小时前播放",
  "resource.label.playedDaysAgo": "{{n}} 天前播放",
  "resource.label.lastPlayedAt": "上次播放时间",
  "resource.label.fileAddDate": "文件添加时间",
  "resource.label.fileModifyDate": "文件修改时间",
  "resource.label.resourceCreateDate": "资源创建时间",
  "resource.label.resourceUpdateDate": "资源更新时间",
  "resource.label.columns": "列数",
  "resource.action.markAsNotPlayed": "标记为未播放",
  "resource.action.adjustPropertyScopePriority": "调整属性作用域的显示优先级",
  "resource.action.sortPropertiesGlobally": "全局调整属性顺序",
  "resource.modal.selectMediaLibrary": "选择媒体库",
  "resource.placeholder.enterIntroduction": "输入简介...",
  "resource.state.noIntroductionYet": "暂无简介",
  "resource.success.mediaLibraryAdded": "媒体库已添加",
  "resource.success.mediaLibraryRemoved": "媒体库已移除",
  "resource.error.failedToAddMediaLibrary": "添加媒体库失败",
  "resource.error.failedToRemoveMediaLibrary": "移除媒体库失败",
  "resource.empty.noCustomPropertyBound": "未绑定自定义属性。您可以在资源扩展中绑定它们",
  "resource.error.failedToLoadChildren": "加载子项失败",
  "resource.modal.resourceChildren": "资源子项",
  "resource.tip.viewChildrenInNewTab": "在新的资源标签中查看子项",
  "resource.state.loadingChildren": "正在加载子项...",
  "resource.empty.noChildrenFound": "未找到子项",
  "resource.label.foundChildrenCount": "找到 {{count}} 个子项",
  "resource.label.resourcesSelected": "已选择 {{count}} 个资源",
  "resource.placeholder.searchAnyKeyword": "搜索任意关键字",
  "ResourceCover.CoverTips.Title": "封面显示异常？",
  "ResourceCover.CoverTips.Tooltip": "为什么没有封面？",
  "ResourceCover.CoverTips.S1.Title": "场景1：从未出现过封面",
  "ResourceCover.CoverTips.S1.Happens": "发生原因：",
  "ResourceCover.CoverTips.S1.When.NotImage": "资源本身不是图片文件",
  "ResourceCover.CoverTips.S1.When.NoImageInFolder": "资源文件夹中没有图片文件",
  "ResourceCover.CoverTips.S1.Todo": "解决方案：",
  "ResourceCover.CoverTips.S1.Todo.ManualSet": "手动设置封面",
  "ResourceCover.CoverTips.S1.Todo.FFmpeg": "安装 FFmpeg 以支持从视频中提取封面",
  "ResourceCover.CoverTips.S1.Todo.Enhancers": "使用增强器自动获取封面",
  "ResourceCover.CoverTips.S1.Todo.Cache": "清除封面缓存后重新发现",
  "ResourceCover.CoverTips.S2.Title": "场景2：封面曾经显示过",
  "ResourceCover.CoverTips.S2.Happens": "发生原因：",
  "ResourceCover.CoverTips.S2.When.CacheDeleted": "封面源文件被删除或移动",
  "ResourceCover.CoverTips.S2.Todo": "解决方案：",
  "ResourceCover.CoverTips.S2.Todo.DisableCache": "禁用封面缓存，使用原始文件作为封面",
  "Cover cache": "封面缓存",
  "Cover cache has been reset": "封面缓存已重置",
  "Reset cover cache of current resource": "重置当前资源的封面缓存",
  "resource.contextMenu.setMediaLibraries": "设置媒体库",
  "resource.contextMenu.setMediaLibrariesForCount": "为 {{count}} 个资源设置媒体库",
  "resource.contextMenu.transferResourceData": "转移资源数据",
  "resource.contextMenu.transferDataOfCount": "转移 {{count}} 个资源的数据",
  "resource.contextMenu.editProperties": "编辑属性",
  "resource.contextMenu.bulkEditProperties": "批量编辑属性",
  "resource.contextMenu.deleteResource": "删除资源",
  "resource.contextMenu.deleteCountResources": "删除 {{count}} 个资源",
  "resource.contextMenu.confirmDeleteCount": "确定要删除 {{count}} 个资源吗？",
  "resource.contextMenu.filesWillNotBeDeleted": "文件不会被删除。",
  "The following properties are not bound to resource profiles": "以下属性未绑定到资源扩展",
  "There is no property bound yet, you can bind properties in resource profile.": "尚未绑定任何属性，您可以在资源扩展中绑定属性。",
  Property: Property$1,
  "Display value": "显示值",
  "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions.": "数字代表属性维度的优先级，属性值将按照维度的优先级顺序显示。",
  "indicates this scope is not enabled": "表示该作用域未启用",
  "Setup priority of property value scopes": "设置属性值作用域的优先级",
  "Visible scopes": "可见作用域",
  "This filter is used for quick check and does not change the priority of property value scopes.": "此筛选器仅用于快速查看，不会改变属性值作用域的优先级。",
  "You can click on the scope button to change the priority of the property value scopes.": "您可以点击作用域按钮来改变属性值作用域的优先级。"
};
const cnFloatingAssistant = {
  "floatingAssistant.status.tasksRunning": "个任务正在运行",
  "floatingAssistant.status.someTasksFailed": "部分任务失败",
  "floatingAssistant.tip.pauseAllRunningTasks": "暂停所有正在运行的任务",
  "floatingAssistant.tip.resumeAllPausedTasks": "恢复所有已暂停的任务",
  "floatingAssistant.tip.clearInactiveTasks": "从列表中移除已完成、失败和已取消的任务",
  "floatingAssistant.action.clearInactiveTasks": "清除非活动任务",
  "floatingAssistant.label.taskList": "任务列表",
  "floatingAssistant.label.nextRun": "下次运行",
  "floatingAssistant.status.started": "已开始",
  "floatingAssistant.status.paused": "已暂停",
  "floatingAssistant.status.resumed": "已恢复",
  "floatingAssistant.status.stopped": "已停止",
  "floatingAssistant.status.running": "运行中",
  "floatingAssistant.status.pending": "等待中",
  "floatingAssistant.status.completed": "已完成",
  "floatingAssistant.status.failed": "失败",
  "floatingAssistant.modal.stoppingTaskTitle": "正在停止任务：{{taskName}}",
  "floatingAssistant.tip.removeFromList": "从列表中移除",
  "floatingAssistant.tip.persistentScheduledTask": "持久化定时任务",
  "floatingAssistant.tip.estimatedCompletion": "预计完成时间",
  "floatingAssistant.empty.noBackgroundTask": "无后台任务",
  "floatingAssistant.empty.noTasksMatchFilter": "没有符合筛选条件的任务"
};
const cnCookieValidator = {
  "cookieValidator.label.cookieValidator": "Cookie 验证器"
};
const cnFileSystemSelector = {
  "fileSystemSelector.title.selectEntries": "选择文件/文件夹",
  "fileSystemSelector.title.selectFile": "选择文件",
  "fileSystemSelector.title.selectFolder": "选择文件夹"
};
const enResources = {
  ...enCommon,
  ...enValidation,
  ...enErrors,
  ...enStatus,
  ...enDatetime,
  ...enEnums,
  // Pages
  ...enDashboard,
  ...enResource,
  ...enConfiguration,
  ...enDownloader,
  ...enFileProcessor,
  ...enMediaLibrary,
  ...enPathMark,
  ...enResourceProfile,
  ...enBulkModification,
  ...enAlias,
  ...enCustomProperty,
  ...enBackgroundTask,
  ...enCache,
  ...enFileNameModifier,
  ...enFileMover,
  ...enLog,
  ...enPlayHistory,
  ...enWelcome,
  ...enThirdParty,
  ...enThirdPartyIntegration,
  ...enThirdPartyConfiguration,
  ...enExtensionGroup,
  ...enText,
  ...enPostParser,
  ...enPathMarks,
  ...enPathMarkConfig,
  ...enComparison,
  // Components
  ...enFileExplorer,
  ...enResourceFilter,
  ...enEnhancer,
  ...enProperty,
  ...enMediaPlayer,
  ...enOnboarding,
  ...enResourceComponent,
  ...enFloatingAssistant,
  ...enCookieValidator,
  ...enFileSystemSelector
};
const cnResources = {
  ...cnCommon,
  ...cnValidation,
  ...cnErrors,
  ...cnStatus,
  ...cnDatetime,
  ...cnEnums,
  // Pages
  ...cnDashboard,
  ...cnResource,
  ...cnConfiguration,
  ...cnDownloader,
  ...cnFileProcessor,
  ...cnMediaLibrary,
  ...cnPathMark,
  ...cnResourceProfile,
  ...cnBulkModification,
  ...cnAlias,
  ...cnCustomProperty,
  ...cnBackgroundTask,
  ...cnCache,
  ...cnFileNameModifier,
  ...cnFileMover,
  ...cnLog,
  ...cnPlayHistory,
  ...cnWelcome,
  ...cnThirdParty,
  ...cnThirdPartyIntegration,
  ...cnThirdPartyConfiguration,
  ...cnExtensionGroup,
  ...cnText,
  ...cnPostParser,
  ...cnPathMarks,
  ...cnPathMarkConfig,
  ...cnComparison,
  // Components
  ...cnFileExplorer,
  ...cnResourceFilter,
  ...cnEnhancer,
  ...cnProperty,
  ...cnMediaPlayer,
  ...cnOnboarding,
  ...cnResourceComponent,
  ...cnFloatingAssistant,
  ...cnCookieValidator,
  ...cnFileSystemSelector
};
if (!instance.isInitialized) {
  instance.use(initReactI18next).init({
    resources: {
      "zh-CN": { translation: cnResources },
      "en-US": { translation: enResources },
      // Legacy aliases for backward compatibility
      cn: { translation: cnResources },
      en: { translation: enResources }
    },
    lng: "en-US",
    // 默认语言
    fallbackLng: "en-US",
    returnNull: false,
    interpolation: { escapeValue: false },
    parseMissingKeyHandler: (key) => key,
    returnObjects: false
  });
  console.log("i18n initialized");
}
function pascalToCamel(str) {
  return str.charAt(0).toLowerCase() + str.slice(1);
}
function getEnumKey(enumType, label) {
  const camelEnumType = pascalToCamel(enumType);
  const camelLabel = pascalToCamel(label);
  return `enum.${camelEnumType}.${camelLabel}`;
}
var cjs$2 = { exports: {} };
var Draggable$2 = {};
function r$3(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2))
      for (t2 = 0; t2 < e2.length; t2++)
        e2[t2] && (f2 = r$3(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    else
      for (t2 in e2)
        e2[t2] && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function clsx$1() {
  for (var e2, t2, f2 = 0, n2 = ""; f2 < arguments.length; )
    (e2 = arguments[f2++]) && (t2 = r$3(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
const clsx_m = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  clsx: clsx$1,
  default: clsx$1
}, Symbol.toStringTag, { value: "Module" }));
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(clsx_m);
var domFns = {};
var shims = {};
Object.defineProperty(shims, "__esModule", {
  value: true
});
shims.dontSetMe = dontSetMe;
shims.findInArray = findInArray;
shims.int = int;
shims.isFunction = isFunction$4;
shims.isNum = isNum;
function findInArray(array4, callback2) {
  for (let i2 = 0, length2 = array4.length; i2 < length2; i2++) {
    if (callback2.apply(callback2, [array4[i2], i2, array4]))
      return array4[i2];
  }
}
function isFunction$4(func) {
  return typeof func === "function" || Object.prototype.toString.call(func) === "[object Function]";
}
function isNum(num) {
  return typeof num === "number" && !isNaN(num);
}
function int(a2) {
  return parseInt(a2, 10);
}
function dontSetMe(props, propName, componentName) {
  if (props[propName]) {
    return new Error("Invalid prop ".concat(propName, " passed to ").concat(componentName, " - do not set this, set it on the child."));
  }
}
var getPrefix$1 = {};
Object.defineProperty(getPrefix$1, "__esModule", {
  value: true
});
getPrefix$1.browserPrefixToKey = browserPrefixToKey;
getPrefix$1.browserPrefixToStyle = browserPrefixToStyle;
getPrefix$1.default = void 0;
getPrefix$1.getPrefix = getPrefix;
const prefixes = ["Moz", "Webkit", "O", "ms"];
function getPrefix() {
  var _window$document;
  let prop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
  if (typeof window === "undefined")
    return "";
  const style2 = (_window$document = window.document) === null || _window$document === void 0 || (_window$document = _window$document.documentElement) === null || _window$document === void 0 ? void 0 : _window$document.style;
  if (!style2)
    return "";
  if (prop in style2)
    return "";
  for (let i2 = 0; i2 < prefixes.length; i2++) {
    if (browserPrefixToKey(prop, prefixes[i2]) in style2)
      return prefixes[i2];
  }
  return "";
}
function browserPrefixToKey(prop, prefix) {
  return prefix ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop;
}
function browserPrefixToStyle(prop, prefix) {
  return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(prop) : prop;
}
function kebabToTitleCase(str) {
  let out = "";
  let shouldCapitalize = true;
  for (let i2 = 0; i2 < str.length; i2++) {
    if (shouldCapitalize) {
      out += str[i2].toUpperCase();
      shouldCapitalize = false;
    } else if (str[i2] === "-") {
      shouldCapitalize = true;
    } else {
      out += str[i2];
    }
  }
  return out;
}
getPrefix$1.default = getPrefix();
Object.defineProperty(domFns, "__esModule", {
  value: true
});
domFns.addClassName = addClassName;
domFns.addEvent = addEvent;
domFns.addUserSelectStyles = addUserSelectStyles;
domFns.createCSSTransform = createCSSTransform;
domFns.createSVGTransform = createSVGTransform;
domFns.getTouch = getTouch;
domFns.getTouchIdentifier = getTouchIdentifier;
domFns.getTranslation = getTranslation;
domFns.innerHeight = innerHeight$1;
domFns.innerWidth = innerWidth$1;
domFns.matchesSelector = matchesSelector;
domFns.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
domFns.offsetXYFromParent = offsetXYFromParent;
domFns.outerHeight = outerHeight;
domFns.outerWidth = outerWidth;
domFns.removeClassName = removeClassName;
domFns.removeEvent = removeEvent;
domFns.removeUserSelectStyles = removeUserSelectStyles;
var _shims$2 = shims;
var _getPrefix = _interopRequireWildcard$1(getPrefix$1);
function _getRequireWildcardCache$1(nodeInterop) {
  if (typeof WeakMap !== "function")
    return null;
  var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
  var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
  return (_getRequireWildcardCache$1 = function(nodeInterop2) {
    return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
  })(nodeInterop);
}
function _interopRequireWildcard$1(obj, nodeInterop) {
  if (obj && obj.__esModule) {
    return obj;
  }
  if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
    return { default: obj };
  }
  var cache2 = _getRequireWildcardCache$1(nodeInterop);
  if (cache2 && cache2.has(obj)) {
    return cache2.get(obj);
  }
  var newObj = {};
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var key in obj) {
    if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
      var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
      if (desc && (desc.get || desc.set)) {
        Object.defineProperty(newObj, key, desc);
      } else {
        newObj[key] = obj[key];
      }
    }
  }
  newObj.default = obj;
  if (cache2) {
    cache2.set(obj, newObj);
  }
  return newObj;
}
let matchesSelectorFunc = "";
function matchesSelector(el2, selector) {
  if (!matchesSelectorFunc) {
    matchesSelectorFunc = (0, _shims$2.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(method4) {
      return (0, _shims$2.isFunction)(el2[method4]);
    });
  }
  if (!(0, _shims$2.isFunction)(el2[matchesSelectorFunc]))
    return false;
  return el2[matchesSelectorFunc](selector);
}
function matchesSelectorAndParentsTo(el2, selector, baseNode) {
  let node2 = el2;
  do {
    if (matchesSelector(node2, selector))
      return true;
    if (node2 === baseNode)
      return false;
    node2 = node2.parentNode;
  } while (node2);
  return false;
}
function addEvent(el2, event, handler, inputOptions) {
  if (!el2)
    return;
  const options = {
    capture: true,
    ...inputOptions
  };
  if (el2.addEventListener) {
    el2.addEventListener(event, handler, options);
  } else if (el2.attachEvent) {
    el2.attachEvent("on" + event, handler);
  } else {
    el2["on" + event] = handler;
  }
}
function removeEvent(el2, event, handler, inputOptions) {
  if (!el2)
    return;
  const options = {
    capture: true,
    ...inputOptions
  };
  if (el2.removeEventListener) {
    el2.removeEventListener(event, handler, options);
  } else if (el2.detachEvent) {
    el2.detachEvent("on" + event, handler);
  } else {
    el2["on" + event] = null;
  }
}
function outerHeight(node2) {
  let height = node2.clientHeight;
  const computedStyle = node2.ownerDocument.defaultView.getComputedStyle(node2);
  height += (0, _shims$2.int)(computedStyle.borderTopWidth);
  height += (0, _shims$2.int)(computedStyle.borderBottomWidth);
  return height;
}
function outerWidth(node2) {
  let width = node2.clientWidth;
  const computedStyle = node2.ownerDocument.defaultView.getComputedStyle(node2);
  width += (0, _shims$2.int)(computedStyle.borderLeftWidth);
  width += (0, _shims$2.int)(computedStyle.borderRightWidth);
  return width;
}
function innerHeight$1(node2) {
  let height = node2.clientHeight;
  const computedStyle = node2.ownerDocument.defaultView.getComputedStyle(node2);
  height -= (0, _shims$2.int)(computedStyle.paddingTop);
  height -= (0, _shims$2.int)(computedStyle.paddingBottom);
  return height;
}
function innerWidth$1(node2) {
  let width = node2.clientWidth;
  const computedStyle = node2.ownerDocument.defaultView.getComputedStyle(node2);
  width -= (0, _shims$2.int)(computedStyle.paddingLeft);
  width -= (0, _shims$2.int)(computedStyle.paddingRight);
  return width;
}
function offsetXYFromParent(evt, offsetParent, scale2) {
  const isBody = offsetParent === offsetParent.ownerDocument.body;
  const offsetParentRect = isBody ? {
    left: 0,
    top: 0
  } : offsetParent.getBoundingClientRect();
  const x2 = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale2;
  const y2 = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale2;
  return {
    x: x2,
    y: y2
  };
}
function createCSSTransform(controlPos, positionOffset) {
  const translation = getTranslation(controlPos, positionOffset, "px");
  return {
    [(0, _getPrefix.browserPrefixToKey)("transform", _getPrefix.default)]: translation
  };
}
function createSVGTransform(controlPos, positionOffset) {
  const translation = getTranslation(controlPos, positionOffset, "");
  return translation;
}
function getTranslation(_ref, positionOffset, unitSuffix) {
  let {
    x: x2,
    y: y2
  } = _ref;
  let translation = "translate(".concat(x2).concat(unitSuffix, ",").concat(y2).concat(unitSuffix, ")");
  if (positionOffset) {
    const defaultX = "".concat(typeof positionOffset.x === "string" ? positionOffset.x : positionOffset.x + unitSuffix);
    const defaultY = "".concat(typeof positionOffset.y === "string" ? positionOffset.y : positionOffset.y + unitSuffix);
    translation = "translate(".concat(defaultX, ", ").concat(defaultY, ")") + translation;
  }
  return translation;
}
function getTouch(e2, identifier2) {
  return e2.targetTouches && (0, _shims$2.findInArray)(e2.targetTouches, (t2) => identifier2 === t2.identifier) || e2.changedTouches && (0, _shims$2.findInArray)(e2.changedTouches, (t2) => identifier2 === t2.identifier);
}
function getTouchIdentifier(e2) {
  if (e2.targetTouches && e2.targetTouches[0])
    return e2.targetTouches[0].identifier;
  if (e2.changedTouches && e2.changedTouches[0])
    return e2.changedTouches[0].identifier;
}
function addUserSelectStyles(doc) {
  if (!doc)
    return;
  let styleEl = doc.getElementById("react-draggable-style-el");
  if (!styleEl) {
    styleEl = doc.createElement("style");
    styleEl.type = "text/css";
    styleEl.id = "react-draggable-style-el";
    styleEl.innerHTML = ".react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n";
    styleEl.innerHTML += ".react-draggable-transparent-selection *::selection {all: inherit;}\n";
    doc.getElementsByTagName("head")[0].appendChild(styleEl);
  }
  if (doc.body)
    addClassName(doc.body, "react-draggable-transparent-selection");
}
function removeUserSelectStyles(doc) {
  if (!doc)
    return;
  try {
    if (doc.body)
      removeClassName(doc.body, "react-draggable-transparent-selection");
    if (doc.selection) {
      doc.selection.empty();
    } else {
      const selection = (doc.defaultView || window).getSelection();
      if (selection && selection.type !== "Caret") {
        selection.removeAllRanges();
      }
    }
  } catch (e2) {
  }
}
function addClassName(el2, className) {
  if (el2.classList) {
    el2.classList.add(className);
  } else {
    if (!el2.className.match(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)")))) {
      el2.className += " ".concat(className);
    }
  }
}
function removeClassName(el2, className) {
  if (el2.classList) {
    el2.classList.remove(className);
  } else {
    el2.className = el2.className.replace(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)"), "g"), "");
  }
}
var positionFns = {};
Object.defineProperty(positionFns, "__esModule", {
  value: true
});
positionFns.canDragX = canDragX;
positionFns.canDragY = canDragY;
positionFns.createCoreData = createCoreData;
positionFns.createDraggableData = createDraggableData;
positionFns.getBoundPosition = getBoundPosition;
positionFns.getControlPosition = getControlPosition;
positionFns.snapToGrid = snapToGrid;
var _shims$1 = shims;
var _domFns$1 = domFns;
function getBoundPosition(draggable, x2, y2) {
  if (!draggable.props.bounds)
    return [x2, y2];
  let {
    bounds: bounds2
  } = draggable.props;
  bounds2 = typeof bounds2 === "string" ? bounds2 : cloneBounds(bounds2);
  const node2 = findDOMNode(draggable);
  if (typeof bounds2 === "string") {
    const {
      ownerDocument
    } = node2;
    const ownerWindow = ownerDocument.defaultView;
    let boundNode;
    if (bounds2 === "parent") {
      boundNode = node2.parentNode;
    } else {
      boundNode = ownerDocument.querySelector(bounds2);
    }
    if (!(boundNode instanceof ownerWindow.HTMLElement)) {
      throw new Error('Bounds selector "' + bounds2 + '" could not find an element.');
    }
    const boundNodeEl = boundNode;
    const nodeStyle = ownerWindow.getComputedStyle(node2);
    const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl);
    bounds2 = {
      left: -node2.offsetLeft + (0, _shims$1.int)(boundNodeStyle.paddingLeft) + (0, _shims$1.int)(nodeStyle.marginLeft),
      top: -node2.offsetTop + (0, _shims$1.int)(boundNodeStyle.paddingTop) + (0, _shims$1.int)(nodeStyle.marginTop),
      right: (0, _domFns$1.innerWidth)(boundNodeEl) - (0, _domFns$1.outerWidth)(node2) - node2.offsetLeft + (0, _shims$1.int)(boundNodeStyle.paddingRight) - (0, _shims$1.int)(nodeStyle.marginRight),
      bottom: (0, _domFns$1.innerHeight)(boundNodeEl) - (0, _domFns$1.outerHeight)(node2) - node2.offsetTop + (0, _shims$1.int)(boundNodeStyle.paddingBottom) - (0, _shims$1.int)(nodeStyle.marginBottom)
    };
  }
  if ((0, _shims$1.isNum)(bounds2.right))
    x2 = Math.min(x2, bounds2.right);
  if ((0, _shims$1.isNum)(bounds2.bottom))
    y2 = Math.min(y2, bounds2.bottom);
  if ((0, _shims$1.isNum)(bounds2.left))
    x2 = Math.max(x2, bounds2.left);
  if ((0, _shims$1.isNum)(bounds2.top))
    y2 = Math.max(y2, bounds2.top);
  return [x2, y2];
}
function snapToGrid(grid, pendingX, pendingY) {
  const x2 = Math.round(pendingX / grid[0]) * grid[0];
  const y2 = Math.round(pendingY / grid[1]) * grid[1];
  return [x2, y2];
}
function canDragX(draggable) {
  return draggable.props.axis === "both" || draggable.props.axis === "x";
}
function canDragY(draggable) {
  return draggable.props.axis === "both" || draggable.props.axis === "y";
}
function getControlPosition(e2, touchIdentifier, draggableCore) {
  const touchObj = typeof touchIdentifier === "number" ? (0, _domFns$1.getTouch)(e2, touchIdentifier) : null;
  if (typeof touchIdentifier === "number" && !touchObj)
    return null;
  const node2 = findDOMNode(draggableCore);
  const offsetParent = draggableCore.props.offsetParent || node2.offsetParent || node2.ownerDocument.body;
  return (0, _domFns$1.offsetXYFromParent)(touchObj || e2, offsetParent, draggableCore.props.scale);
}
function createCoreData(draggable, x2, y2) {
  const isStart = !(0, _shims$1.isNum)(draggable.lastX);
  const node2 = findDOMNode(draggable);
  if (isStart) {
    return {
      node: node2,
      deltaX: 0,
      deltaY: 0,
      lastX: x2,
      lastY: y2,
      x: x2,
      y: y2
    };
  } else {
    return {
      node: node2,
      deltaX: x2 - draggable.lastX,
      deltaY: y2 - draggable.lastY,
      lastX: draggable.lastX,
      lastY: draggable.lastY,
      x: x2,
      y: y2
    };
  }
}
function createDraggableData(draggable, coreData) {
  const scale2 = draggable.props.scale;
  return {
    node: coreData.node,
    x: draggable.state.x + coreData.deltaX / scale2,
    y: draggable.state.y + coreData.deltaY / scale2,
    deltaX: coreData.deltaX / scale2,
    deltaY: coreData.deltaY / scale2,
    lastX: draggable.state.x,
    lastY: draggable.state.y
  };
}
function cloneBounds(bounds2) {
  return {
    left: bounds2.left,
    top: bounds2.top,
    right: bounds2.right,
    bottom: bounds2.bottom
  };
}
function findDOMNode(draggable) {
  const node2 = draggable.findDOMNode();
  if (!node2) {
    throw new Error("<DraggableCore>: Unmounted during event!");
  }
  return node2;
}
var DraggableCore$2 = {};
var log$H = {};
Object.defineProperty(log$H, "__esModule", {
  value: true
});
log$H.default = log$G;
function log$G() {
}
Object.defineProperty(DraggableCore$2, "__esModule", {
  value: true
});
DraggableCore$2.default = void 0;
var React$4 = _interopRequireWildcard(reactExports);
var _propTypes = _interopRequireDefault(propTypesExports);
var _reactDom = _interopRequireDefault(reactDomExports);
var _domFns = domFns;
var _positionFns = positionFns;
var _shims = shims;
var _log = _interopRequireDefault(log$H);
function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : { default: obj };
}
function _getRequireWildcardCache(nodeInterop) {
  if (typeof WeakMap !== "function")
    return null;
  var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
  var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
  return (_getRequireWildcardCache = function(nodeInterop2) {
    return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
  })(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
  if (obj && obj.__esModule) {
    return obj;
  }
  if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
    return { default: obj };
  }
  var cache2 = _getRequireWildcardCache(nodeInterop);
  if (cache2 && cache2.has(obj)) {
    return cache2.get(obj);
  }
  var newObj = {};
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (var key in obj) {
    if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
      var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
      if (desc && (desc.get || desc.set)) {
        Object.defineProperty(newObj, key, desc);
      } else {
        newObj[key] = obj[key];
      }
    }
  }
  newObj.default = obj;
  if (cache2) {
    cache2.set(obj, newObj);
  }
  return newObj;
}
function _defineProperty$1(obj, key, value2) {
  key = _toPropertyKey$1(key);
  if (key in obj) {
    Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value2;
  }
  return obj;
}
function _toPropertyKey$1(arg) {
  var key = _toPrimitive$1(arg, "string");
  return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive$1(input2, hint) {
  if (typeof input2 !== "object" || input2 === null)
    return input2;
  var prim = input2[Symbol.toPrimitive];
  if (prim !== void 0) {
    var res = prim.call(input2, hint);
    if (typeof res !== "object")
      return res;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (hint === "string" ? String : Number)(input2);
}
const eventsFor = {
  touch: {
    start: "touchstart",
    move: "touchmove",
    stop: "touchend"
  },
  mouse: {
    start: "mousedown",
    move: "mousemove",
    stop: "mouseup"
  }
};
let dragEventFor = eventsFor.mouse;
let DraggableCore$1 = class DraggableCore extends React$4.Component {
  constructor() {
    super(...arguments);
    _defineProperty$1(this, "dragging", false);
    _defineProperty$1(this, "lastX", NaN);
    _defineProperty$1(this, "lastY", NaN);
    _defineProperty$1(this, "touchIdentifier", null);
    _defineProperty$1(this, "mounted", false);
    _defineProperty$1(this, "handleDragStart", (e2) => {
      this.props.onMouseDown(e2);
      if (!this.props.allowAnyClick && typeof e2.button === "number" && e2.button !== 0)
        return false;
      const thisNode = this.findDOMNode();
      if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
        throw new Error("<DraggableCore> not mounted on DragStart!");
      }
      const {
        ownerDocument
      } = thisNode;
      if (this.props.disabled || !(e2.target instanceof ownerDocument.defaultView.Node) || this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e2.target, this.props.handle, thisNode) || this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e2.target, this.props.cancel, thisNode)) {
        return;
      }
      if (e2.type === "touchstart")
        e2.preventDefault();
      const touchIdentifier = (0, _domFns.getTouchIdentifier)(e2);
      this.touchIdentifier = touchIdentifier;
      const position2 = (0, _positionFns.getControlPosition)(e2, touchIdentifier, this);
      if (position2 == null)
        return;
      const {
        x: x2,
        y: y2
      } = position2;
      const coreEvent = (0, _positionFns.createCoreData)(this, x2, y2);
      (0, _log.default)("DraggableCore: handleDragStart: %j", coreEvent);
      (0, _log.default)("calling", this.props.onStart);
      const shouldUpdate = this.props.onStart(e2, coreEvent);
      if (shouldUpdate === false || this.mounted === false)
        return;
      if (this.props.enableUserSelectHack)
        (0, _domFns.addUserSelectStyles)(ownerDocument);
      this.dragging = true;
      this.lastX = x2;
      this.lastY = y2;
      (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, this.handleDrag);
      (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, this.handleDragStop);
    });
    _defineProperty$1(this, "handleDrag", (e2) => {
      const position2 = (0, _positionFns.getControlPosition)(e2, this.touchIdentifier, this);
      if (position2 == null)
        return;
      let {
        x: x2,
        y: y2
      } = position2;
      if (Array.isArray(this.props.grid)) {
        let deltaX = x2 - this.lastX, deltaY = y2 - this.lastY;
        [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
        if (!deltaX && !deltaY)
          return;
        x2 = this.lastX + deltaX, y2 = this.lastY + deltaY;
      }
      const coreEvent = (0, _positionFns.createCoreData)(this, x2, y2);
      (0, _log.default)("DraggableCore: handleDrag: %j", coreEvent);
      const shouldUpdate = this.props.onDrag(e2, coreEvent);
      if (shouldUpdate === false || this.mounted === false) {
        try {
          this.handleDragStop(new MouseEvent("mouseup"));
        } catch (err) {
          const event = document.createEvent("MouseEvents");
          event.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
          this.handleDragStop(event);
        }
        return;
      }
      this.lastX = x2;
      this.lastY = y2;
    });
    _defineProperty$1(this, "handleDragStop", (e2) => {
      if (!this.dragging)
        return;
      const position2 = (0, _positionFns.getControlPosition)(e2, this.touchIdentifier, this);
      if (position2 == null)
        return;
      let {
        x: x2,
        y: y2
      } = position2;
      if (Array.isArray(this.props.grid)) {
        let deltaX = x2 - this.lastX || 0;
        let deltaY = y2 - this.lastY || 0;
        [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
        x2 = this.lastX + deltaX, y2 = this.lastY + deltaY;
      }
      const coreEvent = (0, _positionFns.createCoreData)(this, x2, y2);
      const shouldContinue = this.props.onStop(e2, coreEvent);
      if (shouldContinue === false || this.mounted === false)
        return false;
      const thisNode = this.findDOMNode();
      if (thisNode) {
        if (this.props.enableUserSelectHack)
          (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
      }
      (0, _log.default)("DraggableCore: handleDragStop: %j", coreEvent);
      this.dragging = false;
      this.lastX = NaN;
      this.lastY = NaN;
      if (thisNode) {
        (0, _log.default)("DraggableCore: Removing handlers");
        (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, this.handleDrag);
        (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop);
      }
    });
    _defineProperty$1(this, "onMouseDown", (e2) => {
      dragEventFor = eventsFor.mouse;
      return this.handleDragStart(e2);
    });
    _defineProperty$1(this, "onMouseUp", (e2) => {
      dragEventFor = eventsFor.mouse;
      return this.handleDragStop(e2);
    });
    _defineProperty$1(this, "onTouchStart", (e2) => {
      dragEventFor = eventsFor.touch;
      return this.handleDragStart(e2);
    });
    _defineProperty$1(this, "onTouchEnd", (e2) => {
      dragEventFor = eventsFor.touch;
      return this.handleDragStop(e2);
    });
  }
  componentDidMount() {
    this.mounted = true;
    const thisNode = this.findDOMNode();
    if (thisNode) {
      (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
        passive: false
      });
    }
  }
  componentWillUnmount() {
    this.mounted = false;
    const thisNode = this.findDOMNode();
    if (thisNode) {
      const {
        ownerDocument
      } = thisNode;
      (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
      (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
      (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
      (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
      (0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
        passive: false
      });
      if (this.props.enableUserSelectHack)
        (0, _domFns.removeUserSelectStyles)(ownerDocument);
    }
  }
  // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
  // the underlying DOM node ourselves. See the README for more information.
  findDOMNode() {
    var _this$props, _this$props2;
    return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.nodeRef) === null || _this$props2 === void 0 ? void 0 : _this$props2.current : _reactDom.default.findDOMNode(this);
  }
  render() {
    return /* @__PURE__ */ React$4.cloneElement(React$4.Children.only(this.props.children), {
      // Note: mouseMove handler is attached to document so it will still function
      // when the user drags quickly and leaves the bounds of the element.
      onMouseDown: this.onMouseDown,
      onMouseUp: this.onMouseUp,
      // onTouchStart is added on `componentDidMount` so they can be added with
      // {passive: false}, which allows it to cancel. See
      // https://developers.google.com/web/updates/2017/01/scrolling-intervention
      onTouchEnd: this.onTouchEnd
    });
  }
};
DraggableCore$2.default = DraggableCore$1;
_defineProperty$1(DraggableCore$1, "displayName", "DraggableCore");
_defineProperty$1(DraggableCore$1, "propTypes", {
  /**
   * `allowAnyClick` allows dragging using any mouse button.
   * By default, we only accept the left button.
   *
   * Defaults to `false`.
   */
  allowAnyClick: _propTypes.default.bool,
  children: _propTypes.default.node.isRequired,
  /**
   * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
   * with the exception of `onMouseDown`, will not fire.
   */
  disabled: _propTypes.default.bool,
  /**
   * By default, we add 'user-select:none' attributes to the document body
   * to prevent ugly text selection during drag. If this is causing problems
   * for your app, set this to `false`.
   */
  enableUserSelectHack: _propTypes.default.bool,
  /**
   * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
   * instead of using the parent node.
   */
  offsetParent: function(props, propName) {
    if (props[propName] && props[propName].nodeType !== 1) {
      throw new Error("Draggable's offsetParent must be a DOM Node.");
    }
  },
  /**
   * `grid` specifies the x and y that dragging should snap to.
   */
  grid: _propTypes.default.arrayOf(_propTypes.default.number),
  /**
   * `handle` specifies a selector to be used as the handle that initiates drag.
   *
   * Example:
   *
   * ```jsx
   *   let App = React.createClass({
   *       render: function () {
   *         return (
   *            <Draggable handle=".handle">
   *              <div>
   *                  <div className="handle">Click me to drag</div>
   *                  <div>This is some other content</div>
   *              </div>
   *           </Draggable>
   *         );
   *       }
   *   });
   * ```
   */
  handle: _propTypes.default.string,
  /**
   * `cancel` specifies a selector to be used to prevent drag initialization.
   *
   * Example:
   *
   * ```jsx
   *   let App = React.createClass({
   *       render: function () {
   *           return(
   *               <Draggable cancel=".cancel">
   *                   <div>
   *                     <div className="cancel">You can't drag from here</div>
   *                     <div>Dragging here works fine</div>
   *                   </div>
   *               </Draggable>
   *           );
   *       }
   *   });
   * ```
   */
  cancel: _propTypes.default.string,
  /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
   * Unfortunately, in order for <Draggable> to work properly, we need raw access
   * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
   * as in this example:
   *
   * function MyComponent() {
   *   const nodeRef = React.useRef(null);
   *   return (
   *     <Draggable nodeRef={nodeRef}>
   *       <div ref={nodeRef}>Example Target</div>
   *     </Draggable>
   *   );
   * }
   *
   * This can be used for arbitrarily nested components, so long as the ref ends up
   * pointing to the actual child DOM node and not a custom component.
   */
  nodeRef: _propTypes.default.object,
  /**
   * Called when dragging starts.
   * If this function returns the boolean false, dragging will be canceled.
   */
  onStart: _propTypes.default.func,
  /**
   * Called while dragging.
   * If this function returns the boolean false, dragging will be canceled.
   */
  onDrag: _propTypes.default.func,
  /**
   * Called when dragging stops.
   * If this function returns the boolean false, the drag will remain active.
   */
  onStop: _propTypes.default.func,
  /**
   * A workaround option which can be passed if onMouseDown needs to be accessed,
   * since it'll always be blocked (as there is internal use of onMouseDown)
   */
  onMouseDown: _propTypes.default.func,
  /**
   * `scale`, if set, applies scaling while dragging an element
   */
  scale: _propTypes.default.number,
  /**
   * These properties should be defined on the child, not here.
   */
  className: _shims.dontSetMe,
  style: _shims.dontSetMe,
  transform: _shims.dontSetMe
});
_defineProperty$1(DraggableCore$1, "defaultProps", {
  allowAnyClick: false,
  // by default only accept left click
  disabled: false,
  enableUserSelectHack: true,
  onStart: function() {
  },
  onDrag: function() {
  },
  onStop: function() {
  },
  onMouseDown: function() {
  },
  scale: 1
});
(function(exports2) {
  Object.defineProperty(exports2, "__esModule", {
    value: true
  });
  Object.defineProperty(exports2, "DraggableCore", {
    enumerable: true,
    get: function() {
      return _DraggableCore.default;
    }
  });
  exports2.default = void 0;
  var React2 = _interopRequireWildcard2(reactExports);
  var _propTypes2 = _interopRequireDefault2(propTypesExports);
  var _reactDom2 = _interopRequireDefault2(reactDomExports);
  var _clsx = _interopRequireDefault2(require$$3);
  var _domFns2 = domFns;
  var _positionFns2 = positionFns;
  var _shims2 = shims;
  var _DraggableCore = _interopRequireDefault2(DraggableCore$2);
  var _log2 = _interopRequireDefault2(log$H);
  function _interopRequireDefault2(obj) {
    return obj && obj.__esModule ? obj : { default: obj };
  }
  function _getRequireWildcardCache2(nodeInterop) {
    if (typeof WeakMap !== "function")
      return null;
    var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
    var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
    return (_getRequireWildcardCache2 = function(nodeInterop2) {
      return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
  }
  function _interopRequireWildcard2(obj, nodeInterop) {
    if (obj && obj.__esModule) {
      return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
      return { default: obj };
    }
    var cache2 = _getRequireWildcardCache2(nodeInterop);
    if (cache2 && cache2.has(obj)) {
      return cache2.get(obj);
    }
    var newObj = {};
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for (var key in obj) {
      if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
        var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
        if (desc && (desc.get || desc.set)) {
          Object.defineProperty(newObj, key, desc);
        } else {
          newObj[key] = obj[key];
        }
      }
    }
    newObj.default = obj;
    if (cache2) {
      cache2.set(obj, newObj);
    }
    return newObj;
  }
  function _extends3() {
    _extends3 = Object.assign ? Object.assign.bind() : function(target) {
      for (var i2 = 1; i2 < arguments.length; i2++) {
        var source2 = arguments[i2];
        for (var key in source2) {
          if (Object.prototype.hasOwnProperty.call(source2, key)) {
            target[key] = source2[key];
          }
        }
      }
      return target;
    };
    return _extends3.apply(this, arguments);
  }
  function _defineProperty3(obj, key, value2) {
    key = _toPropertyKey2(key);
    if (key in obj) {
      Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
    } else {
      obj[key] = value2;
    }
    return obj;
  }
  function _toPropertyKey2(arg) {
    var key = _toPrimitive2(arg, "string");
    return typeof key === "symbol" ? key : String(key);
  }
  function _toPrimitive2(input2, hint) {
    if (typeof input2 !== "object" || input2 === null)
      return input2;
    var prim = input2[Symbol.toPrimitive];
    if (prim !== void 0) {
      var res = prim.call(input2, hint);
      if (typeof res !== "object")
        return res;
      throw new TypeError("@@toPrimitive must return a primitive value.");
    }
    return (hint === "string" ? String : Number)(input2);
  }
  class Draggable2 extends React2.Component {
    // React 16.3+
    // Arity (props, state)
    static getDerivedStateFromProps(_ref, _ref2) {
      let {
        position: position2
      } = _ref;
      let {
        prevPropsPosition
      } = _ref2;
      if (position2 && (!prevPropsPosition || position2.x !== prevPropsPosition.x || position2.y !== prevPropsPosition.y)) {
        (0, _log2.default)("Draggable: getDerivedStateFromProps %j", {
          position: position2,
          prevPropsPosition
        });
        return {
          x: position2.x,
          y: position2.y,
          prevPropsPosition: {
            ...position2
          }
        };
      }
      return null;
    }
    constructor(props) {
      super(props);
      _defineProperty3(this, "onDragStart", (e2, coreData) => {
        (0, _log2.default)("Draggable: onDragStart: %j", coreData);
        const shouldStart = this.props.onStart(e2, (0, _positionFns2.createDraggableData)(this, coreData));
        if (shouldStart === false)
          return false;
        this.setState({
          dragging: true,
          dragged: true
        });
      });
      _defineProperty3(this, "onDrag", (e2, coreData) => {
        if (!this.state.dragging)
          return false;
        (0, _log2.default)("Draggable: onDrag: %j", coreData);
        const uiData = (0, _positionFns2.createDraggableData)(this, coreData);
        const newState = {
          x: uiData.x,
          y: uiData.y,
          slackX: 0,
          slackY: 0
        };
        if (this.props.bounds) {
          const {
            x: x2,
            y: y2
          } = newState;
          newState.x += this.state.slackX;
          newState.y += this.state.slackY;
          const [newStateX, newStateY] = (0, _positionFns2.getBoundPosition)(this, newState.x, newState.y);
          newState.x = newStateX;
          newState.y = newStateY;
          newState.slackX = this.state.slackX + (x2 - newState.x);
          newState.slackY = this.state.slackY + (y2 - newState.y);
          uiData.x = newState.x;
          uiData.y = newState.y;
          uiData.deltaX = newState.x - this.state.x;
          uiData.deltaY = newState.y - this.state.y;
        }
        const shouldUpdate = this.props.onDrag(e2, uiData);
        if (shouldUpdate === false)
          return false;
        this.setState(newState);
      });
      _defineProperty3(this, "onDragStop", (e2, coreData) => {
        if (!this.state.dragging)
          return false;
        const shouldContinue = this.props.onStop(e2, (0, _positionFns2.createDraggableData)(this, coreData));
        if (shouldContinue === false)
          return false;
        (0, _log2.default)("Draggable: onDragStop: %j", coreData);
        const newState = {
          dragging: false,
          slackX: 0,
          slackY: 0
        };
        const controlled = Boolean(this.props.position);
        if (controlled) {
          const {
            x: x2,
            y: y2
          } = this.props.position;
          newState.x = x2;
          newState.y = y2;
        }
        this.setState(newState);
      });
      this.state = {
        // Whether or not we are currently dragging.
        dragging: false,
        // Whether or not we have been dragged before.
        dragged: false,
        // Current transform x and y.
        x: props.position ? props.position.x : props.defaultPosition.x,
        y: props.position ? props.position.y : props.defaultPosition.y,
        prevPropsPosition: {
          ...props.position
        },
        // Used for compensating for out-of-bounds drags
        slackX: 0,
        slackY: 0,
        // Can only determine if SVG after mounting
        isElementSVG: false
      };
      if (props.position && !(props.onDrag || props.onStop)) {
        console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
      }
    }
    componentDidMount() {
      if (typeof window.SVGElement !== "undefined" && this.findDOMNode() instanceof window.SVGElement) {
        this.setState({
          isElementSVG: true
        });
      }
    }
    componentWillUnmount() {
      this.setState({
        dragging: false
      });
    }
    // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
    // the underlying DOM node ourselves. See the README for more information.
    findDOMNode() {
      var _this$props$nodeRef$c, _this$props;
      return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.nodeRef) === null || _this$props === void 0 ? void 0 : _this$props.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom2.default.findDOMNode(this);
    }
    render() {
      const {
        axis,
        bounds: bounds2,
        children,
        defaultPosition,
        defaultClassName,
        defaultClassNameDragging,
        defaultClassNameDragged,
        position: position2,
        positionOffset,
        scale: scale2,
        ...draggableCoreProps
      } = this.props;
      let style2 = {};
      let svgTransform = null;
      const controlled = Boolean(position2);
      const draggable = !controlled || this.state.dragging;
      const validPosition = position2 || defaultPosition;
      const transformOpts = {
        // Set left if horizontal drag is enabled
        x: (0, _positionFns2.canDragX)(this) && draggable ? this.state.x : validPosition.x,
        // Set top if vertical drag is enabled
        y: (0, _positionFns2.canDragY)(this) && draggable ? this.state.y : validPosition.y
      };
      if (this.state.isElementSVG) {
        svgTransform = (0, _domFns2.createSVGTransform)(transformOpts, positionOffset);
      } else {
        style2 = (0, _domFns2.createCSSTransform)(transformOpts, positionOffset);
      }
      const className = (0, _clsx.default)(children.props.className || "", defaultClassName, {
        [defaultClassNameDragging]: this.state.dragging,
        [defaultClassNameDragged]: this.state.dragged
      });
      return /* @__PURE__ */ React2.createElement(_DraggableCore.default, _extends3({}, draggableCoreProps, {
        onStart: this.onDragStart,
        onDrag: this.onDrag,
        onStop: this.onDragStop
      }), /* @__PURE__ */ React2.cloneElement(React2.Children.only(children), {
        className,
        style: {
          ...children.props.style,
          ...style2
        },
        transform: svgTransform
      }));
    }
  }
  exports2.default = Draggable2;
  _defineProperty3(Draggable2, "displayName", "Draggable");
  _defineProperty3(Draggable2, "propTypes", {
    // Accepts all props <DraggableCore> accepts.
    ..._DraggableCore.default.propTypes,
    /**
     * `axis` determines which axis the draggable can move.
     *
     *  Note that all callbacks will still return data as normal. This only
     *  controls flushing to the DOM.
     *
     * 'both' allows movement horizontally and vertically.
     * 'x' limits movement to horizontal axis.
     * 'y' limits movement to vertical axis.
     * 'none' limits all movement.
     *
     * Defaults to 'both'.
     */
    axis: _propTypes2.default.oneOf(["both", "x", "y", "none"]),
    /**
     * `bounds` determines the range of movement available to the element.
     * Available values are:
     *
     * 'parent' restricts movement within the Draggable's parent node.
     *
     * Alternatively, pass an object with the following properties, all of which are optional:
     *
     * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
     *
     * All values are in px.
     *
     * Example:
     *
     * ```jsx
     *   let App = React.createClass({
     *       render: function () {
     *         return (
     *            <Draggable bounds={{right: 300, bottom: 300}}>
     *              <div>Content</div>
     *           </Draggable>
     *         );
     *       }
     *   });
     * ```
     */
    bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
      left: _propTypes2.default.number,
      right: _propTypes2.default.number,
      top: _propTypes2.default.number,
      bottom: _propTypes2.default.number
    }), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
    defaultClassName: _propTypes2.default.string,
    defaultClassNameDragging: _propTypes2.default.string,
    defaultClassNameDragged: _propTypes2.default.string,
    /**
     * `defaultPosition` specifies the x and y that the dragged item should start at
     *
     * Example:
     *
     * ```jsx
     *      let App = React.createClass({
     *          render: function () {
     *              return (
     *                  <Draggable defaultPosition={{x: 25, y: 25}}>
     *                      <div>I start with transformX: 25px and transformY: 25px;</div>
     *                  </Draggable>
     *              );
     *          }
     *      });
     * ```
     */
    defaultPosition: _propTypes2.default.shape({
      x: _propTypes2.default.number,
      y: _propTypes2.default.number
    }),
    positionOffset: _propTypes2.default.shape({
      x: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
      y: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
    }),
    /**
     * `position`, if present, defines the current position of the element.
     *
     *  This is similar to how form elements in React work - if no `position` is supplied, the component
     *  is uncontrolled.
     *
     * Example:
     *
     * ```jsx
     *      let App = React.createClass({
     *          render: function () {
     *              return (
     *                  <Draggable position={{x: 25, y: 25}}>
     *                      <div>I start with transformX: 25px and transformY: 25px;</div>
     *                  </Draggable>
     *              );
     *          }
     *      });
     * ```
     */
    position: _propTypes2.default.shape({
      x: _propTypes2.default.number,
      y: _propTypes2.default.number
    }),
    /**
     * These properties should be defined on the child, not here.
     */
    className: _shims2.dontSetMe,
    style: _shims2.dontSetMe,
    transform: _shims2.dontSetMe
  });
  _defineProperty3(Draggable2, "defaultProps", {
    ..._DraggableCore.default.defaultProps,
    axis: "both",
    bounds: false,
    defaultClassName: "react-draggable",
    defaultClassNameDragging: "react-draggable-dragging",
    defaultClassNameDragged: "react-draggable-dragged",
    defaultPosition: {
      x: 0,
      y: 0
    },
    scale: 1
  });
})(Draggable$2);
const {
  default: Draggable,
  DraggableCore: DraggableCore2
} = Draggable$2;
cjs$2.exports = Draggable;
cjs$2.exports.default = Draggable;
cjs$2.exports.DraggableCore = DraggableCore2;
var cjsExports = cjs$2.exports;
const Draggable$1 = /* @__PURE__ */ getDefaultExportFromCjs(cjsExports);
var __assign$5 = function() {
  __assign$5 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$5.apply(this, arguments);
};
var rowSizeBase = {
  width: "100%",
  height: "10px",
  top: "0px",
  left: "0px",
  cursor: "row-resize"
};
var colSizeBase = {
  width: "10px",
  height: "100%",
  top: "0px",
  left: "0px",
  cursor: "col-resize"
};
var edgeBase = {
  width: "20px",
  height: "20px",
  position: "absolute",
  zIndex: 1
};
var styles$4 = {
  top: __assign$5(__assign$5({}, rowSizeBase), { top: "-5px" }),
  right: __assign$5(__assign$5({}, colSizeBase), { left: void 0, right: "-5px" }),
  bottom: __assign$5(__assign$5({}, rowSizeBase), { top: void 0, bottom: "-5px" }),
  left: __assign$5(__assign$5({}, colSizeBase), { left: "-5px" }),
  topRight: __assign$5(__assign$5({}, edgeBase), { right: "-10px", top: "-10px", cursor: "ne-resize" }),
  bottomRight: __assign$5(__assign$5({}, edgeBase), { right: "-10px", bottom: "-10px", cursor: "se-resize" }),
  bottomLeft: __assign$5(__assign$5({}, edgeBase), { left: "-10px", bottom: "-10px", cursor: "sw-resize" }),
  topLeft: __assign$5(__assign$5({}, edgeBase), { left: "-10px", top: "-10px", cursor: "nw-resize" })
};
var Resizer = reactExports.memo(function(props) {
  var onResizeStart = props.onResizeStart, direction = props.direction, children = props.children, replaceStyles = props.replaceStyles, className = props.className;
  var onMouseDown = reactExports.useCallback(function(e2) {
    onResizeStart(e2, direction);
  }, [onResizeStart, direction]);
  var onTouchStart = reactExports.useCallback(function(e2) {
    onResizeStart(e2, direction);
  }, [onResizeStart, direction]);
  var style2 = reactExports.useMemo(function() {
    return __assign$5(__assign$5({ position: "absolute", userSelect: "none" }, styles$4[direction]), replaceStyles !== null && replaceStyles !== void 0 ? replaceStyles : {});
  }, [replaceStyles, direction]);
  return jsxRuntimeExports.jsx("div", { className: className || void 0, style: style2, onMouseDown, onTouchStart, children });
});
var __extends$5 = /* @__PURE__ */ function() {
  var extendStatics2 = function(d2, b2) {
    extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics2(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics2(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign$4 = function() {
  __assign$4 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$4.apply(this, arguments);
};
var DEFAULT_SIZE = {
  width: "auto",
  height: "auto"
};
var clamp = function(n2, min2, max2) {
  return Math.max(Math.min(n2, max2), min2);
};
var snap = function(n2, size2, gridGap) {
  var v2 = Math.round(n2 / size2);
  return v2 * size2 + gridGap * (v2 - 1);
};
var hasDirection = function(dir, target) {
  return new RegExp(dir, "i").test(target);
};
var isTouchEvent$2 = function(event) {
  return Boolean(event.touches && event.touches.length);
};
var isMouseEvent = function(event) {
  return Boolean((event.clientX || event.clientX === 0) && (event.clientY || event.clientY === 0));
};
var findClosestSnap = function(n2, snapArray, snapGap) {
  if (snapGap === void 0) {
    snapGap = 0;
  }
  var closestGapIndex = snapArray.reduce(function(prev2, curr, index2) {
    return Math.abs(curr - n2) < Math.abs(snapArray[prev2] - n2) ? index2 : prev2;
  }, 0);
  var gap = Math.abs(snapArray[closestGapIndex] - n2);
  return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n2;
};
var getStringSize = function(n2) {
  n2 = n2.toString();
  if (n2 === "auto") {
    return n2;
  }
  if (n2.endsWith("px")) {
    return n2;
  }
  if (n2.endsWith("%")) {
    return n2;
  }
  if (n2.endsWith("vh")) {
    return n2;
  }
  if (n2.endsWith("vw")) {
    return n2;
  }
  if (n2.endsWith("vmax")) {
    return n2;
  }
  if (n2.endsWith("vmin")) {
    return n2;
  }
  return "".concat(n2, "px");
};
var getPixelSize = function(size2, parentSize, innerWidth2, innerHeight2) {
  if (size2 && typeof size2 === "string") {
    if (size2.endsWith("px")) {
      return Number(size2.replace("px", ""));
    }
    if (size2.endsWith("%")) {
      var ratio = Number(size2.replace("%", "")) / 100;
      return parentSize * ratio;
    }
    if (size2.endsWith("vw")) {
      var ratio = Number(size2.replace("vw", "")) / 100;
      return innerWidth2 * ratio;
    }
    if (size2.endsWith("vh")) {
      var ratio = Number(size2.replace("vh", "")) / 100;
      return innerHeight2 * ratio;
    }
  }
  return size2;
};
var calculateNewMax = function(parentSize, innerWidth2, innerHeight2, maxWidth, maxHeight, minWidth, minHeight) {
  maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth2, innerHeight2);
  maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth2, innerHeight2);
  minWidth = getPixelSize(minWidth, parentSize.width, innerWidth2, innerHeight2);
  minHeight = getPixelSize(minHeight, parentSize.height, innerWidth2, innerHeight2);
  return {
    maxWidth: typeof maxWidth === "undefined" ? void 0 : Number(maxWidth),
    maxHeight: typeof maxHeight === "undefined" ? void 0 : Number(maxHeight),
    minWidth: typeof minWidth === "undefined" ? void 0 : Number(minWidth),
    minHeight: typeof minHeight === "undefined" ? void 0 : Number(minHeight)
  };
};
var normalizeToPair = function(val) {
  return Array.isArray(val) ? val : [val, val];
};
var definedProps = [
  "as",
  "ref",
  "style",
  "className",
  "grid",
  "gridGap",
  "snap",
  "bounds",
  "boundsByDirection",
  "size",
  "defaultSize",
  "minWidth",
  "minHeight",
  "maxWidth",
  "maxHeight",
  "lockAspectRatio",
  "lockAspectRatioExtraWidth",
  "lockAspectRatioExtraHeight",
  "enable",
  "handleStyles",
  "handleClasses",
  "handleWrapperStyle",
  "handleWrapperClass",
  "children",
  "onResizeStart",
  "onResize",
  "onResizeStop",
  "handleComponent",
  "scale",
  "resizeRatio",
  "snapGap"
];
var baseClassName = "__resizable_base__";
var Resizable = (
  /** @class */
  function(_super) {
    __extends$5(Resizable2, _super);
    function Resizable2(props) {
      var _a2, _b2, _c2, _d;
      var _this = _super.call(this, props) || this;
      _this.ratio = 1;
      _this.resizable = null;
      _this.parentLeft = 0;
      _this.parentTop = 0;
      _this.resizableLeft = 0;
      _this.resizableRight = 0;
      _this.resizableTop = 0;
      _this.resizableBottom = 0;
      _this.targetLeft = 0;
      _this.targetTop = 0;
      _this.delta = {
        width: 0,
        height: 0
      };
      _this.appendBase = function() {
        if (!_this.resizable || !_this.window) {
          return null;
        }
        var parent = _this.parentNode;
        if (!parent) {
          return null;
        }
        var element2 = _this.window.document.createElement("div");
        element2.style.width = "100%";
        element2.style.height = "100%";
        element2.style.position = "absolute";
        element2.style.transform = "scale(0, 0)";
        element2.style.left = "0";
        element2.style.flex = "0 0 100%";
        if (element2.classList) {
          element2.classList.add(baseClassName);
        } else {
          element2.className += baseClassName;
        }
        parent.appendChild(element2);
        return element2;
      };
      _this.removeBase = function(base) {
        var parent = _this.parentNode;
        if (!parent) {
          return;
        }
        parent.removeChild(base);
      };
      _this.state = {
        isResizing: false,
        width: (_b2 = (_a2 = _this.propsSize) === null || _a2 === void 0 ? void 0 : _a2.width) !== null && _b2 !== void 0 ? _b2 : "auto",
        height: (_d = (_c2 = _this.propsSize) === null || _c2 === void 0 ? void 0 : _c2.height) !== null && _d !== void 0 ? _d : "auto",
        direction: "right",
        original: {
          x: 0,
          y: 0,
          width: 0,
          height: 0
        },
        backgroundStyle: {
          height: "100%",
          width: "100%",
          backgroundColor: "rgba(0,0,0,0)",
          cursor: "auto",
          opacity: 0,
          position: "fixed",
          zIndex: 9999,
          top: "0",
          left: "0",
          bottom: "0",
          right: "0"
        },
        flexBasis: void 0
      };
      _this.onResizeStart = _this.onResizeStart.bind(_this);
      _this.onMouseMove = _this.onMouseMove.bind(_this);
      _this.onMouseUp = _this.onMouseUp.bind(_this);
      return _this;
    }
    Object.defineProperty(Resizable2.prototype, "parentNode", {
      get: function() {
        if (!this.resizable) {
          return null;
        }
        return this.resizable.parentNode;
      },
      enumerable: false,
      configurable: true
    });
    Object.defineProperty(Resizable2.prototype, "window", {
      get: function() {
        if (!this.resizable) {
          return null;
        }
        if (!this.resizable.ownerDocument) {
          return null;
        }
        return this.resizable.ownerDocument.defaultView;
      },
      enumerable: false,
      configurable: true
    });
    Object.defineProperty(Resizable2.prototype, "propsSize", {
      get: function() {
        return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
      },
      enumerable: false,
      configurable: true
    });
    Object.defineProperty(Resizable2.prototype, "size", {
      get: function() {
        var width = 0;
        var height = 0;
        if (this.resizable && this.window) {
          var orgWidth = this.resizable.offsetWidth;
          var orgHeight = this.resizable.offsetHeight;
          var orgPosition = this.resizable.style.position;
          if (orgPosition !== "relative") {
            this.resizable.style.position = "relative";
          }
          width = this.resizable.style.width !== "auto" ? this.resizable.offsetWidth : orgWidth;
          height = this.resizable.style.height !== "auto" ? this.resizable.offsetHeight : orgHeight;
          this.resizable.style.position = orgPosition;
        }
        return { width, height };
      },
      enumerable: false,
      configurable: true
    });
    Object.defineProperty(Resizable2.prototype, "sizeStyle", {
      get: function() {
        var _this = this;
        var size2 = this.props.size;
        var getSize = function(key) {
          var _a2;
          if (typeof _this.state[key] === "undefined" || _this.state[key] === "auto") {
            return "auto";
          }
          if (_this.propsSize && _this.propsSize[key] && ((_a2 = _this.propsSize[key]) === null || _a2 === void 0 ? void 0 : _a2.toString().endsWith("%"))) {
            if (_this.state[key].toString().endsWith("%")) {
              return _this.state[key].toString();
            }
            var parentSize = _this.getParentSize();
            var value2 = Number(_this.state[key].toString().replace("px", ""));
            var percent2 = value2 / parentSize[key] * 100;
            return "".concat(percent2, "%");
          }
          return getStringSize(_this.state[key]);
        };
        var width = size2 && typeof size2.width !== "undefined" && !this.state.isResizing ? getStringSize(size2.width) : getSize("width");
        var height = size2 && typeof size2.height !== "undefined" && !this.state.isResizing ? getStringSize(size2.height) : getSize("height");
        return { width, height };
      },
      enumerable: false,
      configurable: true
    });
    Resizable2.prototype.getParentSize = function() {
      if (!this.parentNode) {
        if (!this.window) {
          return { width: 0, height: 0 };
        }
        return { width: this.window.innerWidth, height: this.window.innerHeight };
      }
      var base = this.appendBase();
      if (!base) {
        return { width: 0, height: 0 };
      }
      var wrapChanged = false;
      var wrap2 = this.parentNode.style.flexWrap;
      if (wrap2 !== "wrap") {
        wrapChanged = true;
        this.parentNode.style.flexWrap = "wrap";
      }
      base.style.position = "relative";
      base.style.minWidth = "100%";
      base.style.minHeight = "100%";
      var size2 = {
        width: base.offsetWidth,
        height: base.offsetHeight
      };
      if (wrapChanged) {
        this.parentNode.style.flexWrap = wrap2;
      }
      this.removeBase(base);
      return size2;
    };
    Resizable2.prototype.bindEvents = function() {
      if (this.window) {
        this.window.addEventListener("mouseup", this.onMouseUp);
        this.window.addEventListener("mousemove", this.onMouseMove);
        this.window.addEventListener("mouseleave", this.onMouseUp);
        this.window.addEventListener("touchmove", this.onMouseMove, {
          capture: true,
          passive: false
        });
        this.window.addEventListener("touchend", this.onMouseUp);
      }
    };
    Resizable2.prototype.unbindEvents = function() {
      if (this.window) {
        this.window.removeEventListener("mouseup", this.onMouseUp);
        this.window.removeEventListener("mousemove", this.onMouseMove);
        this.window.removeEventListener("mouseleave", this.onMouseUp);
        this.window.removeEventListener("touchmove", this.onMouseMove, true);
        this.window.removeEventListener("touchend", this.onMouseUp);
      }
    };
    Resizable2.prototype.componentDidMount = function() {
      if (!this.resizable || !this.window) {
        return;
      }
      var computedStyle = this.window.getComputedStyle(this.resizable);
      this.setState({
        width: this.state.width || this.size.width,
        height: this.state.height || this.size.height,
        flexBasis: computedStyle.flexBasis !== "auto" ? computedStyle.flexBasis : void 0
      });
    };
    Resizable2.prototype.componentWillUnmount = function() {
      if (this.window) {
        this.unbindEvents();
      }
    };
    Resizable2.prototype.createSizeForCssProperty = function(newSize, kind) {
      var propsSize = this.propsSize && this.propsSize[kind];
      return this.state[kind] === "auto" && this.state.original[kind] === newSize && (typeof propsSize === "undefined" || propsSize === "auto") ? "auto" : newSize;
    };
    Resizable2.prototype.calculateNewMaxFromBoundary = function(maxWidth, maxHeight) {
      var boundsByDirection = this.props.boundsByDirection;
      var direction = this.state.direction;
      var widthByDirection = boundsByDirection && hasDirection("left", direction);
      var heightByDirection = boundsByDirection && hasDirection("top", direction);
      var boundWidth;
      var boundHeight;
      if (this.props.bounds === "parent") {
        var parent_1 = this.parentNode;
        if (parent_1) {
          boundWidth = widthByDirection ? this.resizableRight - this.parentLeft : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
          boundHeight = heightByDirection ? this.resizableBottom - this.parentTop : parent_1.offsetHeight + (this.parentTop - this.resizableTop);
        }
      } else if (this.props.bounds === "window") {
        if (this.window) {
          boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
          boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
        }
      } else if (this.props.bounds) {
        boundWidth = widthByDirection ? this.resizableRight - this.targetLeft : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
        boundHeight = heightByDirection ? this.resizableBottom - this.targetTop : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
      }
      if (boundWidth && Number.isFinite(boundWidth)) {
        maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
      }
      if (boundHeight && Number.isFinite(boundHeight)) {
        maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
      }
      return { maxWidth, maxHeight };
    };
    Resizable2.prototype.calculateNewSizeFromDirection = function(clientX, clientY) {
      var scale2 = this.props.scale || 1;
      var _a2 = normalizeToPair(this.props.resizeRatio || 1), resizeRatioX = _a2[0], resizeRatioY = _a2[1];
      var _b2 = this.state, direction = _b2.direction, original = _b2.original;
      var _c2 = this.props, lockAspectRatio = _c2.lockAspectRatio, lockAspectRatioExtraHeight = _c2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _c2.lockAspectRatioExtraWidth;
      var newWidth = original.width;
      var newHeight = original.height;
      var extraHeight = lockAspectRatioExtraHeight || 0;
      var extraWidth = lockAspectRatioExtraWidth || 0;
      if (hasDirection("right", direction)) {
        newWidth = original.width + (clientX - original.x) * resizeRatioX / scale2;
        if (lockAspectRatio) {
          newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
        }
      }
      if (hasDirection("left", direction)) {
        newWidth = original.width - (clientX - original.x) * resizeRatioX / scale2;
        if (lockAspectRatio) {
          newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
        }
      }
      if (hasDirection("bottom", direction)) {
        newHeight = original.height + (clientY - original.y) * resizeRatioY / scale2;
        if (lockAspectRatio) {
          newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
        }
      }
      if (hasDirection("top", direction)) {
        newHeight = original.height - (clientY - original.y) * resizeRatioY / scale2;
        if (lockAspectRatio) {
          newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
        }
      }
      return { newWidth, newHeight };
    };
    Resizable2.prototype.calculateNewSizeFromAspectRatio = function(newWidth, newHeight, max2, min2) {
      var _a2 = this.props, lockAspectRatio = _a2.lockAspectRatio, lockAspectRatioExtraHeight = _a2.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a2.lockAspectRatioExtraWidth;
      var computedMinWidth = typeof min2.width === "undefined" ? 10 : min2.width;
      var computedMaxWidth = typeof max2.width === "undefined" || max2.width < 0 ? newWidth : max2.width;
      var computedMinHeight = typeof min2.height === "undefined" ? 10 : min2.height;
      var computedMaxHeight = typeof max2.height === "undefined" || max2.height < 0 ? newHeight : max2.height;
      var extraHeight = lockAspectRatioExtraHeight || 0;
      var extraWidth = lockAspectRatioExtraWidth || 0;
      if (lockAspectRatio) {
        var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
        var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
        var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
        var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
        var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
        var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
        var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
        var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
        newWidth = clamp(newWidth, lockedMinWidth, lockedMaxWidth);
        newHeight = clamp(newHeight, lockedMinHeight, lockedMaxHeight);
      } else {
        newWidth = clamp(newWidth, computedMinWidth, computedMaxWidth);
        newHeight = clamp(newHeight, computedMinHeight, computedMaxHeight);
      }
      return { newWidth, newHeight };
    };
    Resizable2.prototype.setBoundingClientRect = function() {
      var adjustedScale = 1 / (this.props.scale || 1);
      if (this.props.bounds === "parent") {
        var parent_2 = this.parentNode;
        if (parent_2) {
          var parentRect = parent_2.getBoundingClientRect();
          this.parentLeft = parentRect.left * adjustedScale;
          this.parentTop = parentRect.top * adjustedScale;
        }
      }
      if (this.props.bounds && typeof this.props.bounds !== "string") {
        var targetRect = this.props.bounds.getBoundingClientRect();
        this.targetLeft = targetRect.left * adjustedScale;
        this.targetTop = targetRect.top * adjustedScale;
      }
      if (this.resizable) {
        var _a2 = this.resizable.getBoundingClientRect(), left2 = _a2.left, top_1 = _a2.top, right = _a2.right, bottom2 = _a2.bottom;
        this.resizableLeft = left2 * adjustedScale;
        this.resizableRight = right * adjustedScale;
        this.resizableTop = top_1 * adjustedScale;
        this.resizableBottom = bottom2 * adjustedScale;
      }
    };
    Resizable2.prototype.onResizeStart = function(event, direction) {
      if (!this.resizable || !this.window) {
        return;
      }
      var clientX = 0;
      var clientY = 0;
      if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
        clientX = event.nativeEvent.clientX;
        clientY = event.nativeEvent.clientY;
      } else if (event.nativeEvent && isTouchEvent$2(event.nativeEvent)) {
        clientX = event.nativeEvent.touches[0].clientX;
        clientY = event.nativeEvent.touches[0].clientY;
      }
      if (this.props.onResizeStart) {
        if (this.resizable) {
          var startResize = this.props.onResizeStart(event, direction, this.resizable);
          if (startResize === false) {
            return;
          }
        }
      }
      if (this.props.size) {
        if (typeof this.props.size.height !== "undefined" && this.props.size.height !== this.state.height) {
          this.setState({ height: this.props.size.height });
        }
        if (typeof this.props.size.width !== "undefined" && this.props.size.width !== this.state.width) {
          this.setState({ width: this.props.size.width });
        }
      }
      this.ratio = typeof this.props.lockAspectRatio === "number" ? this.props.lockAspectRatio : this.size.width / this.size.height;
      var flexBasis2;
      var computedStyle = this.window.getComputedStyle(this.resizable);
      if (computedStyle.flexBasis !== "auto") {
        var parent_3 = this.parentNode;
        if (parent_3) {
          var dir = this.window.getComputedStyle(parent_3).flexDirection;
          this.flexDir = dir.startsWith("row") ? "row" : "column";
          flexBasis2 = computedStyle.flexBasis;
        }
      }
      this.setBoundingClientRect();
      this.bindEvents();
      var state = {
        original: {
          x: clientX,
          y: clientY,
          width: this.size.width,
          height: this.size.height
        },
        isResizing: true,
        backgroundStyle: __assign$4(__assign$4({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || "auto" }),
        direction,
        flexBasis: flexBasis2
      };
      this.setState(state);
    };
    Resizable2.prototype.onMouseMove = function(event) {
      var _this = this;
      if (!this.state.isResizing || !this.resizable || !this.window) {
        return;
      }
      if (this.window.TouchEvent && isTouchEvent$2(event)) {
        try {
          event.preventDefault();
          event.stopPropagation();
        } catch (e2) {
        }
      }
      var _a2 = this.props, maxWidth = _a2.maxWidth, maxHeight = _a2.maxHeight, minWidth = _a2.minWidth, minHeight = _a2.minHeight;
      var clientX = isTouchEvent$2(event) ? event.touches[0].clientX : event.clientX;
      var clientY = isTouchEvent$2(event) ? event.touches[0].clientY : event.clientY;
      var _b2 = this.state, direction = _b2.direction, original = _b2.original, width = _b2.width, height = _b2.height;
      var parentSize = this.getParentSize();
      var max2 = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
      maxWidth = max2.maxWidth;
      maxHeight = max2.maxHeight;
      minWidth = max2.minWidth;
      minHeight = max2.minHeight;
      var _c2 = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c2.newHeight, newWidth = _c2.newWidth;
      var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
      if (this.props.snap && this.props.snap.x) {
        newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
      }
      if (this.props.snap && this.props.snap.y) {
        newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
      }
      var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
      newWidth = newSize.newWidth;
      newHeight = newSize.newHeight;
      if (this.props.grid) {
        var newGridWidth = snap(newWidth, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0);
        var newGridHeight = snap(newHeight, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0);
        var gap = this.props.snapGap || 0;
        var w2 = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
        var h3 = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
        newWidth = w2;
        newHeight = h3;
      }
      var delta = {
        width: newWidth - original.width,
        height: newHeight - original.height
      };
      this.delta = delta;
      if (width && typeof width === "string") {
        if (width.endsWith("%")) {
          var percent2 = newWidth / parentSize.width * 100;
          newWidth = "".concat(percent2, "%");
        } else if (width.endsWith("vw")) {
          var vw2 = newWidth / this.window.innerWidth * 100;
          newWidth = "".concat(vw2, "vw");
        } else if (width.endsWith("vh")) {
          var vh2 = newWidth / this.window.innerHeight * 100;
          newWidth = "".concat(vh2, "vh");
        }
      }
      if (height && typeof height === "string") {
        if (height.endsWith("%")) {
          var percent2 = newHeight / parentSize.height * 100;
          newHeight = "".concat(percent2, "%");
        } else if (height.endsWith("vw")) {
          var vw2 = newHeight / this.window.innerWidth * 100;
          newHeight = "".concat(vw2, "vw");
        } else if (height.endsWith("vh")) {
          var vh2 = newHeight / this.window.innerHeight * 100;
          newHeight = "".concat(vh2, "vh");
        }
      }
      var newState = {
        width: this.createSizeForCssProperty(newWidth, "width"),
        height: this.createSizeForCssProperty(newHeight, "height")
      };
      if (this.flexDir === "row") {
        newState.flexBasis = newState.width;
      } else if (this.flexDir === "column") {
        newState.flexBasis = newState.height;
      }
      var widthChanged = this.state.width !== newState.width;
      var heightChanged = this.state.height !== newState.height;
      var flexBaseChanged = this.state.flexBasis !== newState.flexBasis;
      var changed = widthChanged || heightChanged || flexBaseChanged;
      if (changed) {
        reactDomExports.flushSync(function() {
          _this.setState(newState);
        });
      }
      if (this.props.onResize) {
        if (changed) {
          this.props.onResize(event, direction, this.resizable, delta);
        }
      }
    };
    Resizable2.prototype.onMouseUp = function(event) {
      var _a2, _b2;
      var _c2 = this.state, isResizing = _c2.isResizing, direction = _c2.direction;
      _c2.original;
      if (!isResizing || !this.resizable) {
        return;
      }
      if (this.props.onResizeStop) {
        this.props.onResizeStop(event, direction, this.resizable, this.delta);
      }
      if (this.props.size) {
        this.setState({ width: (_a2 = this.props.size.width) !== null && _a2 !== void 0 ? _a2 : "auto", height: (_b2 = this.props.size.height) !== null && _b2 !== void 0 ? _b2 : "auto" });
      }
      this.unbindEvents();
      this.setState({
        isResizing: false,
        backgroundStyle: __assign$4(__assign$4({}, this.state.backgroundStyle), { cursor: "auto" })
      });
    };
    Resizable2.prototype.updateSize = function(size2) {
      var _a2, _b2;
      this.setState({ width: (_a2 = size2.width) !== null && _a2 !== void 0 ? _a2 : "auto", height: (_b2 = size2.height) !== null && _b2 !== void 0 ? _b2 : "auto" });
    };
    Resizable2.prototype.renderResizer = function() {
      var _this = this;
      var _a2 = this.props, enable = _a2.enable, handleStyles = _a2.handleStyles, handleClasses = _a2.handleClasses, handleWrapperStyle = _a2.handleWrapperStyle, handleWrapperClass = _a2.handleWrapperClass, handleComponent = _a2.handleComponent;
      if (!enable) {
        return null;
      }
      var resizers = Object.keys(enable).map(function(dir) {
        if (enable[dir] !== false) {
          return jsxRuntimeExports.jsx(Resizer, { direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir], children: handleComponent && handleComponent[dir] ? handleComponent[dir] : null }, dir);
        }
        return null;
      });
      return jsxRuntimeExports.jsx("div", { className: handleWrapperClass, style: handleWrapperStyle, children: resizers });
    };
    Resizable2.prototype.render = function() {
      var _this = this;
      var extendsProps = Object.keys(this.props).reduce(function(acc, key) {
        if (definedProps.indexOf(key) !== -1) {
          return acc;
        }
        acc[key] = _this.props[key];
        return acc;
      }, {});
      var style2 = __assign$4(__assign$4(__assign$4({ position: "relative", userSelect: this.state.isResizing ? "none" : "auto" }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: "border-box", flexShrink: 0 });
      if (this.state.flexBasis) {
        style2.flexBasis = this.state.flexBasis;
      }
      var Wrapper = this.props.as || "div";
      return jsxRuntimeExports.jsxs(Wrapper, __assign$4({ style: style2, className: this.props.className }, extendsProps, {
        // `ref` is after `extendsProps` to ensure this one wins over a version
        // passed in
        ref: function(c2) {
          if (c2) {
            _this.resizable = c2;
          }
        },
        children: [this.state.isResizing && jsxRuntimeExports.jsx("div", { style: this.state.backgroundStyle }), this.props.children, this.renderResizer()]
      }));
    };
    Resizable2.defaultProps = {
      as: "div",
      onResizeStart: function() {
      },
      onResize: function() {
      },
      onResizeStop: function() {
      },
      enable: {
        top: true,
        right: true,
        bottom: true,
        left: true,
        topRight: true,
        bottomRight: true,
        bottomLeft: true,
        topLeft: true
      },
      style: {},
      grid: [1, 1],
      gridGap: [0, 0],
      lockAspectRatio: false,
      lockAspectRatioExtraWidth: 0,
      lockAspectRatioExtraHeight: 0,
      scale: 1,
      resizeRatio: 1,
      snapGap: 0
    };
    return Resizable2;
  }(reactExports.PureComponent)
);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var extendStatics = function(d2, b2) {
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
    d3.__proto__ = b3;
  } || function(d3, b3) {
    for (var p2 in b3)
      if (b3.hasOwnProperty(p2))
        d3[p2] = b3[p2];
  };
  return extendStatics(d2, b2);
};
function __extends$4(d2, b2) {
  extendStatics(d2, b2);
  function __() {
    this.constructor = d2;
  }
  d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
}
var __assign$3 = function() {
  __assign$3 = Object.assign || function __assign2(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$3.apply(this, arguments);
};
function __rest$1(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
}
var resizableStyle = {
  width: "auto",
  height: "auto",
  display: "inline-block",
  position: "absolute",
  top: 0,
  left: 0
};
var getEnableResizingByFlag = function(flag) {
  return {
    bottom: flag,
    bottomLeft: flag,
    bottomRight: flag,
    left: flag,
    right: flag,
    top: flag,
    topLeft: flag,
    topRight: flag
  };
};
var Rnd = (
  /** @class */
  function(_super) {
    __extends$4(Rnd2, _super);
    function Rnd2(props) {
      var _this = _super.call(this, props) || this;
      _this.resizingPosition = { x: 0, y: 0 };
      _this.offsetFromParent = { left: 0, top: 0 };
      _this.resizableElement = { current: null };
      _this.originalPosition = { x: 0, y: 0 };
      _this.state = {
        resizing: false,
        bounds: {
          top: 0,
          right: 0,
          bottom: 0,
          left: 0
        },
        maxWidth: props.maxWidth,
        maxHeight: props.maxHeight
      };
      _this.onResizeStart = _this.onResizeStart.bind(_this);
      _this.onResize = _this.onResize.bind(_this);
      _this.onResizeStop = _this.onResizeStop.bind(_this);
      _this.onDragStart = _this.onDragStart.bind(_this);
      _this.onDrag = _this.onDrag.bind(_this);
      _this.onDragStop = _this.onDragStop.bind(_this);
      _this.getMaxSizesFromProps = _this.getMaxSizesFromProps.bind(_this);
      return _this;
    }
    Rnd2.prototype.componentDidMount = function() {
      this.updateOffsetFromParent();
      var _a2 = this.offsetFromParent, left2 = _a2.left, top2 = _a2.top;
      var _b2 = this.getDraggablePosition(), x2 = _b2.x, y2 = _b2.y;
      this.draggable.setState({
        x: x2 - left2,
        y: y2 - top2
      });
      this.forceUpdate();
    };
    Rnd2.prototype.getDraggablePosition = function() {
      var _a2 = this.draggable.state, x2 = _a2.x, y2 = _a2.y;
      return { x: x2, y: y2 };
    };
    Rnd2.prototype.getParent = function() {
      return this.resizable && this.resizable.parentNode;
    };
    Rnd2.prototype.getParentSize = function() {
      return this.resizable.getParentSize();
    };
    Rnd2.prototype.getMaxSizesFromProps = function() {
      var maxWidth = typeof this.props.maxWidth === "undefined" ? Number.MAX_SAFE_INTEGER : this.props.maxWidth;
      var maxHeight = typeof this.props.maxHeight === "undefined" ? Number.MAX_SAFE_INTEGER : this.props.maxHeight;
      return { maxWidth, maxHeight };
    };
    Rnd2.prototype.getSelfElement = function() {
      return this.resizable && this.resizable.resizable;
    };
    Rnd2.prototype.getOffsetHeight = function(boundary) {
      var scale2 = this.props.scale;
      switch (this.props.bounds) {
        case "window":
          return window.innerHeight / scale2;
        case "body":
          return document.body.offsetHeight / scale2;
        default:
          return boundary.offsetHeight;
      }
    };
    Rnd2.prototype.getOffsetWidth = function(boundary) {
      var scale2 = this.props.scale;
      switch (this.props.bounds) {
        case "window":
          return window.innerWidth / scale2;
        case "body":
          return document.body.offsetWidth / scale2;
        default:
          return boundary.offsetWidth;
      }
    };
    Rnd2.prototype.onDragStart = function(e2, data) {
      if (this.props.onDragStart) {
        this.props.onDragStart(e2, data);
      }
      var pos = this.getDraggablePosition();
      this.originalPosition = pos;
      if (!this.props.bounds)
        return;
      var parent = this.getParent();
      var scale2 = this.props.scale;
      var boundary;
      if (this.props.bounds === "parent") {
        boundary = parent;
      } else if (this.props.bounds === "body") {
        var parentRect_1 = parent.getBoundingClientRect();
        var parentLeft_1 = parentRect_1.left;
        var parentTop_1 = parentRect_1.top;
        var bodyRect = document.body.getBoundingClientRect();
        var left_1 = -(parentLeft_1 - parent.offsetLeft * scale2 - bodyRect.left) / scale2;
        var top_1 = -(parentTop_1 - parent.offsetTop * scale2 - bodyRect.top) / scale2;
        var right = (document.body.offsetWidth - this.resizable.size.width * scale2) / scale2 + left_1;
        var bottom2 = (document.body.offsetHeight - this.resizable.size.height * scale2) / scale2 + top_1;
        return this.setState({ bounds: { top: top_1, right, bottom: bottom2, left: left_1 } });
      } else if (this.props.bounds === "window") {
        if (!this.resizable)
          return;
        var parentRect_2 = parent.getBoundingClientRect();
        var parentLeft_2 = parentRect_2.left;
        var parentTop_2 = parentRect_2.top;
        var left_2 = -(parentLeft_2 - parent.offsetLeft * scale2) / scale2;
        var top_2 = -(parentTop_2 - parent.offsetTop * scale2) / scale2;
        var right = (window.innerWidth - this.resizable.size.width * scale2) / scale2 + left_2;
        var bottom2 = (window.innerHeight - this.resizable.size.height * scale2) / scale2 + top_2;
        return this.setState({ bounds: { top: top_2, right, bottom: bottom2, left: left_2 } });
      } else if (typeof this.props.bounds === "string") {
        boundary = document.querySelector(this.props.bounds);
      } else if (this.props.bounds instanceof HTMLElement) {
        boundary = this.props.bounds;
      }
      if (!(boundary instanceof HTMLElement) || !(parent instanceof HTMLElement)) {
        return;
      }
      var boundaryRect = boundary.getBoundingClientRect();
      var boundaryLeft = boundaryRect.left;
      var boundaryTop = boundaryRect.top;
      var parentRect = parent.getBoundingClientRect();
      var parentLeft = parentRect.left;
      var parentTop = parentRect.top;
      var left2 = (boundaryLeft - parentLeft) / scale2;
      var top2 = boundaryTop - parentTop;
      if (!this.resizable)
        return;
      this.updateOffsetFromParent();
      var offset2 = this.offsetFromParent;
      this.setState({
        bounds: {
          top: top2 - offset2.top,
          right: left2 + (boundary.offsetWidth - this.resizable.size.width) - offset2.left / scale2,
          bottom: top2 + (boundary.offsetHeight - this.resizable.size.height) - offset2.top,
          left: left2 - offset2.left / scale2
        }
      });
    };
    Rnd2.prototype.onDrag = function(e2, data) {
      if (!this.props.onDrag)
        return;
      var _a2 = this.offsetFromParent, left2 = _a2.left, top2 = _a2.top;
      if (!this.props.dragAxis || this.props.dragAxis === "both") {
        return this.props.onDrag(e2, __assign$3(__assign$3({}, data), { x: data.x + left2, y: data.y + top2 }));
      } else if (this.props.dragAxis === "x") {
        return this.props.onDrag(e2, __assign$3(__assign$3({}, data), { x: data.x + left2, y: this.originalPosition.y + top2, deltaY: 0 }));
      } else if (this.props.dragAxis === "y") {
        return this.props.onDrag(e2, __assign$3(__assign$3({}, data), { x: this.originalPosition.x + left2, y: data.y + top2, deltaX: 0 }));
      }
    };
    Rnd2.prototype.onDragStop = function(e2, data) {
      if (!this.props.onDragStop)
        return;
      var _a2 = this.offsetFromParent, left2 = _a2.left, top2 = _a2.top;
      if (!this.props.dragAxis || this.props.dragAxis === "both") {
        return this.props.onDragStop(e2, __assign$3(__assign$3({}, data), { x: data.x + left2, y: data.y + top2 }));
      } else if (this.props.dragAxis === "x") {
        return this.props.onDragStop(e2, __assign$3(__assign$3({}, data), { x: data.x + left2, y: this.originalPosition.y + top2, deltaY: 0 }));
      } else if (this.props.dragAxis === "y") {
        return this.props.onDragStop(e2, __assign$3(__assign$3({}, data), { x: this.originalPosition.x + left2, y: data.y + top2, deltaX: 0 }));
      }
    };
    Rnd2.prototype.onResizeStart = function(e2, dir, elementRef) {
      e2.stopPropagation();
      this.setState({
        resizing: true
      });
      var scale2 = this.props.scale;
      var offset2 = this.offsetFromParent;
      var pos = this.getDraggablePosition();
      this.resizingPosition = { x: pos.x + offset2.left, y: pos.y + offset2.top };
      this.originalPosition = pos;
      if (this.props.bounds) {
        var parent_1 = this.getParent();
        var boundary = void 0;
        if (this.props.bounds === "parent") {
          boundary = parent_1;
        } else if (this.props.bounds === "body") {
          boundary = document.body;
        } else if (this.props.bounds === "window") {
          boundary = window;
        } else if (typeof this.props.bounds === "string") {
          boundary = document.querySelector(this.props.bounds);
        } else if (this.props.bounds instanceof HTMLElement) {
          boundary = this.props.bounds;
        }
        var self_1 = this.getSelfElement();
        if (self_1 instanceof Element && (boundary instanceof HTMLElement || boundary === window) && parent_1 instanceof HTMLElement) {
          var _a2 = this.getMaxSizesFromProps(), maxWidth = _a2.maxWidth, maxHeight = _a2.maxHeight;
          var parentSize = this.getParentSize();
          if (maxWidth && typeof maxWidth === "string") {
            if (maxWidth.endsWith("%")) {
              var ratio = Number(maxWidth.replace("%", "")) / 100;
              maxWidth = parentSize.width * ratio;
            } else if (maxWidth.endsWith("px")) {
              maxWidth = Number(maxWidth.replace("px", ""));
            }
          }
          if (maxHeight && typeof maxHeight === "string") {
            if (maxHeight.endsWith("%")) {
              var ratio = Number(maxHeight.replace("%", "")) / 100;
              maxHeight = parentSize.height * ratio;
            } else if (maxHeight.endsWith("px")) {
              maxHeight = Number(maxHeight.replace("px", ""));
            }
          }
          var selfRect = self_1.getBoundingClientRect();
          var selfLeft = selfRect.left;
          var selfTop = selfRect.top;
          var boundaryRect = this.props.bounds === "window" ? { left: 0, top: 0 } : boundary.getBoundingClientRect();
          var boundaryLeft = boundaryRect.left;
          var boundaryTop = boundaryRect.top;
          var offsetWidth = this.getOffsetWidth(boundary);
          var offsetHeight = this.getOffsetHeight(boundary);
          var hasLeft = dir.toLowerCase().endsWith("left");
          var hasRight = dir.toLowerCase().endsWith("right");
          var hasTop = dir.startsWith("top");
          var hasBottom = dir.startsWith("bottom");
          if ((hasLeft || hasTop) && this.resizable) {
            var max2 = (selfLeft - boundaryLeft) / scale2 + this.resizable.size.width;
            this.setState({ maxWidth: max2 > Number(maxWidth) ? maxWidth : max2 });
          }
          if (hasRight || this.props.lockAspectRatio && !hasLeft && !hasTop) {
            var max2 = offsetWidth + (boundaryLeft - selfLeft) / scale2;
            this.setState({ maxWidth: max2 > Number(maxWidth) ? maxWidth : max2 });
          }
          if ((hasTop || hasLeft) && this.resizable) {
            var max2 = (selfTop - boundaryTop) / scale2 + this.resizable.size.height;
            this.setState({
              maxHeight: max2 > Number(maxHeight) ? maxHeight : max2
            });
          }
          if (hasBottom || this.props.lockAspectRatio && !hasTop && !hasLeft) {
            var max2 = offsetHeight + (boundaryTop - selfTop) / scale2;
            this.setState({
              maxHeight: max2 > Number(maxHeight) ? maxHeight : max2
            });
          }
        }
      } else {
        this.setState({
          maxWidth: this.props.maxWidth,
          maxHeight: this.props.maxHeight
        });
      }
      if (this.props.onResizeStart) {
        this.props.onResizeStart(e2, dir, elementRef);
      }
    };
    Rnd2.prototype.onResize = function(e2, direction, elementRef, delta) {
      var _this = this;
      var newPos = { x: this.originalPosition.x, y: this.originalPosition.y };
      var left2 = -delta.width;
      var top2 = -delta.height;
      var directions2 = ["top", "left", "topLeft", "bottomLeft", "topRight"];
      if (directions2.includes(direction)) {
        if (direction === "bottomLeft") {
          newPos.x += left2;
        } else if (direction === "topRight") {
          newPos.y += top2;
        } else {
          newPos.x += left2;
          newPos.y += top2;
        }
      }
      var draggableState = this.draggable.state;
      if (newPos.x !== draggableState.x || newPos.y !== draggableState.y) {
        reactDomExports.flushSync(function() {
          _this.draggable.setState(newPos);
        });
      }
      this.updateOffsetFromParent();
      var offset2 = this.offsetFromParent;
      var x2 = this.getDraggablePosition().x + offset2.left;
      var y2 = this.getDraggablePosition().y + offset2.top;
      this.resizingPosition = { x: x2, y: y2 };
      if (!this.props.onResize)
        return;
      this.props.onResize(e2, direction, elementRef, delta, {
        x: x2,
        y: y2
      });
    };
    Rnd2.prototype.onResizeStop = function(e2, direction, elementRef, delta) {
      this.setState({
        resizing: false
      });
      var _a2 = this.getMaxSizesFromProps(), maxWidth = _a2.maxWidth, maxHeight = _a2.maxHeight;
      this.setState({ maxWidth, maxHeight });
      if (this.props.onResizeStop) {
        this.props.onResizeStop(e2, direction, elementRef, delta, this.resizingPosition);
      }
    };
    Rnd2.prototype.updateSize = function(size2) {
      if (!this.resizable)
        return;
      this.resizable.updateSize({ width: size2.width, height: size2.height });
    };
    Rnd2.prototype.updatePosition = function(position2) {
      this.draggable.setState(position2);
    };
    Rnd2.prototype.updateOffsetFromParent = function() {
      var scale2 = this.props.scale;
      var parent = this.getParent();
      var self2 = this.getSelfElement();
      if (!parent || self2 === null) {
        return {
          top: 0,
          left: 0
        };
      }
      var parentRect = parent.getBoundingClientRect();
      var parentLeft = parentRect.left;
      var parentTop = parentRect.top;
      var selfRect = self2.getBoundingClientRect();
      var position2 = this.getDraggablePosition();
      var scrollLeft = parent.scrollLeft;
      var scrollTop = parent.scrollTop;
      this.offsetFromParent = {
        left: selfRect.left - parentLeft + scrollLeft - position2.x * scale2,
        top: selfRect.top - parentTop + scrollTop - position2.y * scale2
      };
    };
    Rnd2.prototype.render = function() {
      var _this = this;
      var _a2 = this.props, disableDragging = _a2.disableDragging, style2 = _a2.style, dragHandleClassName = _a2.dragHandleClassName, position2 = _a2.position, onMouseDown = _a2.onMouseDown, onMouseUp = _a2.onMouseUp, dragAxis = _a2.dragAxis, dragGrid = _a2.dragGrid, bounds2 = _a2.bounds, enableUserSelectHack = _a2.enableUserSelectHack, cancel2 = _a2.cancel, children = _a2.children;
      _a2.onResizeStart;
      _a2.onResize;
      _a2.onResizeStop;
      _a2.onDragStart;
      _a2.onDrag;
      _a2.onDragStop;
      var resizeHandleStyles = _a2.resizeHandleStyles, resizeHandleClasses = _a2.resizeHandleClasses, resizeHandleComponent = _a2.resizeHandleComponent, enableResizing = _a2.enableResizing, resizeGrid = _a2.resizeGrid, resizeHandleWrapperClass = _a2.resizeHandleWrapperClass, resizeHandleWrapperStyle = _a2.resizeHandleWrapperStyle, scale2 = _a2.scale, allowAnyClick = _a2.allowAnyClick, dragPositionOffset = _a2.dragPositionOffset, resizableProps = __rest$1(_a2, ["disableDragging", "style", "dragHandleClassName", "position", "onMouseDown", "onMouseUp", "dragAxis", "dragGrid", "bounds", "enableUserSelectHack", "cancel", "children", "onResizeStart", "onResize", "onResizeStop", "onDragStart", "onDrag", "onDragStop", "resizeHandleStyles", "resizeHandleClasses", "resizeHandleComponent", "enableResizing", "resizeGrid", "resizeHandleWrapperClass", "resizeHandleWrapperStyle", "scale", "allowAnyClick", "dragPositionOffset"]);
      var defaultValue2 = this.props.default ? __assign$3({}, this.props.default) : void 0;
      delete resizableProps.default;
      var cursorStyle = disableDragging || dragHandleClassName ? { cursor: "auto" } : { cursor: "move" };
      var innerStyle = __assign$3(__assign$3(__assign$3({}, resizableStyle), cursorStyle), style2);
      var _b2 = this.offsetFromParent, left2 = _b2.left, top2 = _b2.top;
      var draggablePosition;
      if (position2) {
        draggablePosition = {
          x: position2.x - left2,
          y: position2.y - top2
        };
      }
      var pos = this.state.resizing ? void 0 : draggablePosition;
      var dragAxisOrUndefined = this.state.resizing ? "both" : dragAxis;
      return reactExports.createElement(
        Draggable$1,
        {
          ref: function(c2) {
            if (!c2)
              return;
            _this.draggable = c2;
          },
          handle: dragHandleClassName ? ".".concat(dragHandleClassName) : void 0,
          defaultPosition: defaultValue2,
          onMouseDown,
          // @ts-expect-error
          onMouseUp,
          onStart: this.onDragStart,
          onDrag: this.onDrag,
          onStop: this.onDragStop,
          axis: dragAxisOrUndefined,
          disabled: disableDragging,
          grid: dragGrid,
          bounds: bounds2 ? this.state.bounds : void 0,
          position: pos,
          enableUserSelectHack,
          cancel: cancel2,
          scale: scale2,
          allowAnyClick,
          nodeRef: this.resizableElement,
          positionOffset: dragPositionOffset
        },
        reactExports.createElement(Resizable, __assign$3({}, resizableProps, { ref: function(c2) {
          if (!c2)
            return;
          _this.resizable = c2;
          _this.resizableElement.current = c2.resizable;
        }, defaultSize: defaultValue2, size: this.props.size, enable: typeof enableResizing === "boolean" ? getEnableResizingByFlag(enableResizing) : enableResizing, onResizeStart: this.onResizeStart, onResize: this.onResize, onResizeStop: this.onResizeStop, style: innerStyle, minWidth: this.props.minWidth, minHeight: this.props.minHeight, maxWidth: this.state.resizing ? this.state.maxWidth : this.props.maxWidth, maxHeight: this.state.resizing ? this.state.maxHeight : this.props.maxHeight, grid: resizeGrid, handleWrapperClass: resizeHandleWrapperClass, handleWrapperStyle: resizeHandleWrapperStyle, lockAspectRatio: this.props.lockAspectRatio, lockAspectRatioExtraWidth: this.props.lockAspectRatioExtraWidth, lockAspectRatioExtraHeight: this.props.lockAspectRatioExtraHeight, handleStyles: resizeHandleStyles, handleClasses: resizeHandleClasses, handleComponent: resizeHandleComponent, scale: this.props.scale }), children)
      );
    };
    Rnd2.defaultProps = {
      maxWidth: Number.MAX_SAFE_INTEGER,
      maxHeight: Number.MAX_SAFE_INTEGER,
      scale: 1,
      onResizeStart: function() {
      },
      onResize: function() {
      },
      onResizeStop: function() {
      },
      onDragStart: function() {
      },
      onDrag: function() {
      },
      onDragStop: function() {
      }
    };
    return Rnd2;
  }(reactExports.PureComponent)
);
const _WindowManager = class _WindowManager {
  constructor() {
    __publicField(this, "windows", /* @__PURE__ */ new Map());
    __publicField(this, "listeners", /* @__PURE__ */ new Set());
    __publicField(this, "snapThreshold", 20);
    // pixels
    __publicField(this, "minZIndex", 1e3);
    __publicField(this, "maxZIndex", 2e3);
    __publicField(this, "currentMaxZIndex", 1e3);
  }
  static getInstance() {
    if (!_WindowManager.instance) {
      _WindowManager.instance = new _WindowManager();
    }
    return _WindowManager.instance;
  }
  registerWindow(id2, initialState3) {
    const existingWindows = this.getAllWindows();
    const baseX = initialState3.x ?? 100;
    const baseY = initialState3.y ?? 100;
    const offsetStep = 40;
    const x2 = baseX + existingWindows.length * offsetStep;
    const y2 = baseY + existingWindows.length * offsetStep;
    const state = {
      id: id2,
      width: initialState3.width ?? 800,
      height: initialState3.height ?? 600,
      isMinimized: initialState3.isMinimized ?? false,
      isMaximized: initialState3.isMaximized ?? false,
      zIndex: this.getNextZIndex(),
      ...initialState3,
      // Override x and y with calculated offset positions to ensure they're not overwritten
      x: x2,
      y: y2
    };
    this.windows.set(id2, state);
    this.notifyListeners();
    return state;
  }
  unregisterWindow(id2) {
    this.windows.delete(id2);
    this.notifyListeners();
  }
  updateWindow(id2, updates) {
    const window2 = this.windows.get(id2);
    if (window2) {
      Object.assign(window2, updates);
      this.notifyListeners();
    }
  }
  getWindow(id2) {
    return this.windows.get(id2);
  }
  getAllWindows() {
    return Array.from(this.windows.values());
  }
  getOtherWindows(excludeId) {
    return this.getAllWindows().filter((w2) => w2.id !== excludeId);
  }
  bringToFront(id2) {
    const window2 = this.windows.get(id2);
    if (window2) {
      this.currentMaxZIndex = Math.min(this.currentMaxZIndex + 1, this.maxZIndex);
      window2.zIndex = this.currentMaxZIndex;
      this.notifyListeners();
    }
  }
  getNextZIndex() {
    this.currentMaxZIndex = Math.min(this.currentMaxZIndex + 1, this.maxZIndex);
    return this.currentMaxZIndex;
  }
  isTopmost(id2) {
    const window2 = this.windows.get(id2);
    if (!window2)
      return false;
    const allWindows = this.getAllWindows();
    const maxZIndex = Math.max(...allWindows.map((w2) => w2.zIndex));
    return window2.zIndex === maxZIndex;
  }
  subscribe(listener) {
    this.listeners.add(listener);
    return () => {
      this.listeners.delete(listener);
    };
  }
  notifyListeners() {
    this.listeners.forEach((listener) => listener(this.getAllWindows()));
  }
  // Magnetic snapping logic
  snapPosition(id2, x2, y2, width, height) {
    const window2 = this.windows.get(id2);
    if (!window2)
      return { x: x2, y: y2 };
    const otherWindows = this.getOtherWindows(id2);
    const viewportWidth = window2.innerWidth ?? document.documentElement.clientWidth;
    const viewportHeight = window2.innerHeight ?? document.documentElement.clientHeight;
    let snappedX = x2;
    let snappedY = y2;
    if (Math.abs(x2) < this.snapThreshold) {
      snappedX = 0;
    } else if (Math.abs(x2 + width - viewportWidth) < this.snapThreshold) {
      snappedX = viewportWidth - width;
    }
    if (Math.abs(y2) < this.snapThreshold) {
      snappedY = 0;
    } else if (Math.abs(y2 + height - viewportHeight) < this.snapThreshold) {
      snappedY = viewportHeight - height;
    }
    for (const otherWindow of otherWindows) {
      if (otherWindow.isMinimized)
        continue;
      const otherX = otherWindow.x;
      const otherY = otherWindow.y;
      const otherWidth = otherWindow.width;
      const otherHeight = otherWindow.height;
      if (Math.abs(x2 - (otherX + otherWidth)) < this.snapThreshold) {
        snappedX = otherX + otherWidth;
      } else if (Math.abs(x2 + width - otherX) < this.snapThreshold) {
        snappedX = otherX - width;
      } else if (Math.abs(x2 - otherX) < this.snapThreshold) {
        snappedX = otherX;
      } else if (Math.abs(x2 + width - (otherX + otherWidth)) < this.snapThreshold) {
        snappedX = otherX + otherWidth - width;
      }
      if (Math.abs(y2 - (otherY + otherHeight)) < this.snapThreshold) {
        snappedY = otherY + otherHeight;
      } else if (Math.abs(y2 + height - otherY) < this.snapThreshold) {
        snappedY = otherY - height;
      } else if (Math.abs(y2 - otherY) < this.snapThreshold) {
        snappedY = otherY;
      } else if (Math.abs(y2 + height - (otherY + otherHeight)) < this.snapThreshold) {
        snappedY = otherY + otherHeight - height;
      }
    }
    return { x: snappedX, y: snappedY };
  }
  snapSize(id2, x2, y2, width, height) {
    const window2 = this.windows.get(id2);
    if (!window2)
      return { width, height };
    const otherWindows = this.getOtherWindows(id2);
    const viewportWidth = window2.innerWidth ?? document.documentElement.clientWidth;
    const viewportHeight = window2.innerHeight ?? document.documentElement.clientHeight;
    let snappedWidth = width;
    let snappedHeight = height;
    if (Math.abs(x2 + width - viewportWidth) < this.snapThreshold) {
      snappedWidth = viewportWidth - x2;
    }
    if (Math.abs(y2 + height - viewportHeight) < this.snapThreshold) {
      snappedHeight = viewportHeight - y2;
    }
    for (const otherWindow of otherWindows) {
      if (otherWindow.isMinimized)
        continue;
      const otherX = otherWindow.x;
      const otherY = otherWindow.y;
      const otherWidth = otherWindow.width;
      const otherHeight = otherWindow.height;
      if (Math.abs(x2 + width - otherX) < this.snapThreshold) {
        snappedWidth = otherX - x2;
      } else if (Math.abs(x2 + width - (otherX + otherWidth)) < this.snapThreshold) {
        snappedWidth = otherX + otherWidth - x2;
      }
      if (Math.abs(y2 + height - otherY) < this.snapThreshold) {
        snappedHeight = otherY - y2;
      } else if (Math.abs(y2 + height - (otherY + otherHeight)) < this.snapThreshold) {
        snappedHeight = otherY + otherHeight - y2;
      }
    }
    return { width: snappedWidth, height: snappedHeight };
  }
};
__publicField(_WindowManager, "instance");
let WindowManager = _WindowManager;
var DefaultContext = {
  color: void 0,
  size: void 0,
  className: void 0,
  style: void 0,
  attr: void 0
};
var IconContext = React$6.createContext && /* @__PURE__ */ React$6.createContext(DefaultContext);
var _excluded$6 = ["attr", "size", "title"];
function _objectWithoutProperties(source2, excluded) {
  if (source2 == null)
    return {};
  var target = _objectWithoutPropertiesLoose$1(source2, excluded);
  var key, i2;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source2);
    for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
      key = sourceSymbolKeys[i2];
      if (excluded.indexOf(key) >= 0)
        continue;
      if (!Object.prototype.propertyIsEnumerable.call(source2, key))
        continue;
      target[key] = source2[key];
    }
  }
  return target;
}
function _objectWithoutPropertiesLoose$1(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  for (var key in source2) {
    if (Object.prototype.hasOwnProperty.call(source2, key)) {
      if (excluded.indexOf(key) >= 0)
        continue;
      target[key] = source2[key];
    }
  }
  return target;
}
function _extends$2() {
  _extends$2 = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$2.apply(this, arguments);
}
function ownKeys$a(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$b(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$a(Object(t2), true).forEach(function(r3) {
      _defineProperty(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$a(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _defineProperty(obj, key, value2) {
  key = _toPropertyKey(key);
  if (key in obj) {
    Object.defineProperty(obj, key, { value: value2, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value2;
  }
  return obj;
}
function _toPropertyKey(t2) {
  var i2 = _toPrimitive(t2, "string");
  return "symbol" == typeof i2 ? i2 : i2 + "";
}
function _toPrimitive(t2, r2) {
  if ("object" != typeof t2 || !t2)
    return t2;
  var e2 = t2[Symbol.toPrimitive];
  if (void 0 !== e2) {
    var i2 = e2.call(t2, r2);
    if ("object" != typeof i2)
      return i2;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r2 ? String : Number)(t2);
}
function Tree2Element(tree) {
  return tree && tree.map((node2, i2) => /* @__PURE__ */ React$6.createElement(node2.tag, _objectSpread$b({
    key: i2
  }, node2.attr), Tree2Element(node2.child)));
}
function GenIcon(data) {
  return (props) => /* @__PURE__ */ React$6.createElement(IconBase2, _extends$2({
    attr: _objectSpread$b({}, data.attr)
  }, props), Tree2Element(data.child));
}
function IconBase2(props) {
  var elem = (conf) => {
    var {
      attr,
      size: size2,
      title
    } = props, svgProps = _objectWithoutProperties(props, _excluded$6);
    var computedSize = size2 || conf.size || "1em";
    var className;
    if (conf.className)
      className = conf.className;
    if (props.className)
      className = (className ? className + " " : "") + props.className;
    return /* @__PURE__ */ React$6.createElement("svg", _extends$2({
      stroke: "currentColor",
      fill: "currentColor",
      strokeWidth: "0"
    }, conf.attr, attr, svgProps, {
      className,
      style: _objectSpread$b(_objectSpread$b({
        color: props.color || conf.color
      }, conf.style), props.style),
      height: computedSize,
      width: computedSize,
      xmlns: "http://www.w3.org/2000/svg"
    }), title && /* @__PURE__ */ React$6.createElement("title", null, title), props.children);
  };
  return IconContext !== void 0 ? /* @__PURE__ */ React$6.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
}
function IoIosSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M492 257.1c-2.6-2.6-6-4-9.6-4-3.6 0-7 1.4-9.6 4l-13 13c4.3-61.8-19.5-122.5-65.3-165C356.9 70.2 307.7 51 256.1 51c-26.7 0-52.8 5.1-77.4 15.1-25.5 10.4-48.3 25.6-67.7 45.3-13.2 13.4-24.6 28.5-33.6 44.8-1.9 3.4-2.3 7.4-1.2 11.1 1.1 3.7 3.8 6.8 7.2 8.5 2 1 4.2 1.5 6.4 1.5 5.2 0 9.9-2.8 12.4-7.3 7.9-14.3 17.8-27.5 29.4-39.1 16.8-16.8 36.3-29.8 58.1-38.7 21.1-8.6 43.4-12.9 66.2-12.9 22.9 0 45.2 4.3 66.3 12.9 21.8 8.9 41.4 21.9 58.2 38.8 20.3 20.4 35.4 45.6 43.8 73 7 22.9 9.2 47.3 6.6 71.2l-18.9-18.5c-2.5-2.4-5.8-3.8-9.3-3.8-3.5 0-6.9 1.4-9.4 3.9-5.2 5.2-5.2 13.6 0 18.8l42.8 42.9c1.9 1.9 4.4 2.9 7 2.9 2.6 0 5.1-1 7-2.9l42.1-42.2c5.2-5.3 5.2-13.9-.1-19.2zM428.6 335.9c-2-1-4.2-1.5-6.4-1.5-5.2 0-9.9 2.8-12.4 7.3-7.9 14.3-17.8 27.5-29.4 39.1-16.8 16.8-36.3 29.9-58.2 38.7-21.1 8.6-43.4 12.9-66.3 12.9s-45.2-4.3-66.2-12.9c-21.8-8.9-41.4-21.9-58.2-38.7-37.6-37.8-56-90.9-50.3-143.9l18.4 18.5c2.4 2.4 5.6 3.7 9 3.7 3.4 0 6.6-1.3 9-3.7l1.3-1.3c4.9-4.9 4.9-13 0-17.9l-42.9-43c-1.9-1.9-4.4-2.9-7-2.9-2.6 0-5.1 1-7 2.9l-42 42.3c-5.3 5.3-5.3 13.9 0 19.2 2.6 2.6 6 4 9.6 4 3.6 0 7-1.4 9.6-4l13-13.1c-1.8 25.8 1.3 52 9 76.5 9.9 31.4 26.8 59.3 50.3 82.8 19.5 19.6 42.2 34.7 67.6 45.1 24.5 10 50.4 15 76.9 15 26.5 0 52.4-5.1 76.9-15 25.4-10.3 48.1-25.5 67.6-45.1 13.5-13.5 25-28.8 34.2-45.4 1.9-3.4 2.3-7.4 1.2-11.1-1.2-3.7-3.8-6.8-7.3-8.5z" }, "child": [] }] })(props);
}
function IoMdClose(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M405 136.798L375.202 107 256 226.202 136.798 107 107 136.798 226.202 256 107 375.202 136.798 405 256 285.798 375.202 405 405 375.202 285.798 256z" }, "child": [] }] })(props);
}
function IoMdRemove(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M96 235h320v42H96z" }, "child": [] }] })(props);
}
function MdBatchPrediction(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M17 8H7c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-4 12.5h-2V19h2v1.5zm0-2.5h-2c0-1.5-2.5-3-2.5-5 0-1.93 1.57-3.5 3.5-3.5s3.5 1.57 3.5 3.5c0 2-2.5 3.5-2.5 5zm5-11.5H6C6 5.67 6.67 5 7.5 5h9c.83 0 1.5.67 1.5 1.5zm-1-3H7C7 2.67 7.67 2 8.5 2h7c.83 0 1.5.67 1.5 1.5z" }, "child": [] }] })(props);
}
function MdCalendarMonth(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V10h14v10zM9 14H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm-8 4H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2z" }, "child": [] }] })(props);
}
function MdCheckCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }, "child": [] }] })(props);
}
function MdDeleteOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9zm7.5-5-1-1h-5l-1 1H5v2h14V4z" }, "child": [] }] })(props);
}
function MdDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" }, "child": [] }] })(props);
}
function MdHelpOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z" }, "child": [] }] })(props);
}
function MdSavedSearch(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm-2.17-1.5 2.14-1.53 2.14 1.53-.83-2.46 2.15-1.5h-2.62L9.47 6l-.84 2.54H6l2.14 1.49z" }, "child": [] }] })(props);
}
function MdError(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }, "child": [] }] })(props);
}
function MdWarning(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z" }, "child": [] }] })(props);
}
function MdLibraryAdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-1 9h-4v4h-2v-4H9V9h4V5h2v4h4v2z" }, "child": [] }] })(props);
}
function MdPlayCircleOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m10 16.5 6-4.5-6-4.5v9zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" }, "child": [] }] })(props);
}
function MdPlayCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM9.5 16.5v-9l7 4.5-7 4.5z" }, "child": [] }] })(props);
}
function MdPlaylistPlay(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 10h11v2H3zM3 6h11v2H3zM3 14h7v2H3zM16 13v8l6-4z" }, "child": [] }] })(props);
}
function MdSortByAlpha(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0zm0 0h24v24H0V0zm.75.75h22.5v22.5H.75z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14.94 4.66h-4.72l2.36-2.36zm-4.69 14.71h4.66l-2.33 2.33zM6.1 6.27 1.6 17.73h1.84l.92-2.45h5.11l.92 2.45h1.84L7.74 6.27H6.1zm-1.13 7.37 1.94-5.18 1.94 5.18H4.97zm10.76 2.5h6.12v1.59h-8.53v-1.29l5.92-8.56h-5.88v-1.6h8.3v1.26l-5.93 8.6z" }, "child": [] }] })(props);
}
function MdVideoFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 2H6.01a2 2 0 0 0-2 2L4 20c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 7V3.5L18.5 9H13zm1 5 2-1.06v4.12L14 16v1c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h4c.55 0 1 .45 1 1v1z" }, "child": [] }] })(props);
}
function MdVideoLibrary(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8 12.5v-9l6 4.5-6 4.5z" }, "child": [] }] })(props);
}
function MdAddCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z" }, "child": [] }] })(props);
}
function MdSort(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z" }, "child": [] }] })(props);
}
function MdUnarchive(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m20.55 5.22-1.39-1.68A1.51 1.51 0 0 0 18 3H6c-.47 0-.88.21-1.15.55L3.46 5.22C3.17 5.57 3 6.01 3 6.5V19a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V6.5c0-.49-.17-.93-.45-1.28zM12 9.5l5.5 5.5H14v2h-4v-2H6.5L12 9.5zM5.12 5l.82-1h12l.93 1H5.12z" }, "child": [] }] })(props);
}
function MdAccessTime(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, "child": [] }] })(props);
}
function MdEditNote(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71a.996.996 0 0 1 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z" }, "child": [] }] })(props);
}
function MdInsertDriveFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z" }, "child": [] }] })(props);
}
function MdDriveFileRenameOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M18.41 5.8 17.2 4.59c-.78-.78-2.05-.78-2.83 0l-2.68 2.68L3 15.96V20h4.04l8.74-8.74 2.63-2.63c.79-.78.79-2.05 0-2.83zM6.21 18H5v-1.21l8.66-8.66 1.21 1.21L6.21 18zM11 20l4-4h6v4H11z" }, "child": [] }] })(props);
}
function MdFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z" }, "child": [] }] })(props);
}
function MdAudiotrack(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 3v9.28a4.39 4.39 0 0 0-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7z" }, "child": [] }] })(props);
}
function MdAutoFixHigh(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7.5 5.6 10 7 8.6 4.5 10 2 7.5 3.4 5 2l1.4 2.5L5 7zm12 9.8L17 14l1.4 2.5L17 19l2.5-1.4L22 19l-1.4-2.5L22 14zM22 2l-2.5 1.4L17 2l1.4 2.5L17 7l2.5-1.4L22 7l-1.4-2.5zm-7.63 5.29a.996.996 0 0 0-1.41 0L1.29 18.96a.996.996 0 0 0 0 1.41l2.34 2.34c.39.39 1.02.39 1.41 0L16.7 11.05a.996.996 0 0 0 0-1.41l-2.33-2.35zm-1.03 5.49-2.12-2.12 2.44-2.44 2.12 2.12-2.44 2.44z" }, "child": [] }] })(props);
}
function MdBrokenImage(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0zm0 0h24v24H0zm21 19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2" }, "child": [] }, { "tag": "path", "attr": { "d": "M21 5v6.59l-3-3.01-4 4.01-4-4-4 4-3-3.01V5c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2zm-3 6.42 3 3.01V19c0 1.1-.9 2-2 2H5c-1.1 0-2-.9-2-2v-6.58l3 2.99 4-4 4 4 4-3.99z" }, "child": [] }] })(props);
}
function MdEdit(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z" }, "child": [] }] })(props);
}
function MdImage(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z" }, "child": [] }] })(props);
}
function MdFullscreenExit(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z" }, "child": [] }] })(props);
}
function MdOutlineArticle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 17H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z" }, "child": [] }] })(props);
}
function MdOutlineDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z" }, "child": [] }] })(props);
}
function MdOutlineDragIndicator(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }, "child": [] }] })(props);
}
function MdOutlineFactCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "g", "attr": { "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M20 3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H4V5h16v14z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19.41 10.42 17.99 9l-3.17 3.17-1.41-1.42L12 12.16 14.82 15zM5 7h5v2H5zM5 11h5v2H5zM5 15h5v2H5z" }, "child": [] }] }] })(props);
}
function MdOutlineFilterAltOff(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "m16.95 6-3.57 4.55 1.43 1.43c1.03-1.31 4.98-6.37 4.98-6.37A.998.998 0 0 0 19 4H6.83l2 2h8.12zM2.81 2.81 1.39 4.22 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-2.17l5.78 5.78 1.41-1.41L2.81 2.81z" }, "child": [] }] })(props);
}
function MdOutlineFilterAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24m0 24H0" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 6h10l-5.01 6.3L7 6zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39A.998.998 0 0 0 18.95 4H5.04c-.83 0-1.3.95-.79 1.61z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }] })(props);
}
function MdOutlinePercent(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7.5 4C5.57 4 4 5.57 4 7.5S5.57 11 7.5 11 11 9.43 11 7.5 9.43 4 7.5 4zm0 5C6.67 9 6 8.33 6 7.5S6.67 6 7.5 6 9 6.67 9 7.5 8.33 9 7.5 9zm9 4c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5 3.5-1.57 3.5-3.5-1.57-3.5-3.5-3.5zm0 5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5.41 20 4 18.59 18.59 4 20 5.41 5.41 20z" }, "child": [] }] })(props);
}
function MdOutlineStopCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm4-4H8V8h8v8z" }, "child": [] }] })(props);
}
function MdOutlineSubtitles(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V6h16v12zM6 10h2v2H6zm0 4h8v2H6zm10 0h2v2h-2zm-6-4h8v2h-8z" }, "child": [] }] })(props);
}
function MdOutlineTextFormat(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98 13.87 11h-3.74L12 5.98z" }, "child": [] }] })(props);
}
function MdOutlineAccessTime(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" }, "child": [] }] })(props);
}
function MdOutlineCreateNewFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 6h-8l-2-2H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm0 12H4V6h5.17l2 2H20v10zm-8-4h2v2h2v-2h2v-2h-2v-2h-2v2h-2z" }, "child": [] }] })(props);
}
function MdOutlineTextSnippet(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14.17 5 19 9.83V19H5V5h9.17m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V9.83c0-.53-.21-1.04-.59-1.41l-4.83-4.83c-.37-.38-.88-.59-1.41-.59zM7 15h10v2H7v-2zm0-4h10v2H7v-2zm0-4h7v2H7V7z" }, "child": [] }] })(props);
}
function MdOutlineCleaningServices(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 11h-1V3c0-1.1-.9-2-2-2h-2c-1.1 0-2 .9-2 2v8H8c-2.76 0-5 2.24-5 5v7h18v-7c0-2.76-2.24-5-5-5zm-5-8h2v8h-2V3zm8 18h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3h-2v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H9v-3c0-.55-.45-1-1-1s-1 .45-1 1v3H5v-5c0-1.65 1.35-3 3-3h8c1.65 0 3 1.35 3 3v5z" }, "child": [] }] })(props);
}
function MdOutlineCheckBox(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zM17.99 9l-1.41-1.42-6.59 6.59-2.58-2.57-1.42 1.41 4 3.99z" }, "child": [] }] })(props);
}
function FiMaximize2(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "polyline", "attr": { "points": "15 3 21 3 21 9" }, "child": [] }, { "tag": "polyline", "attr": { "points": "9 21 3 21 3 15" }, "child": [] }, { "tag": "line", "attr": { "x1": "21", "y1": "3", "x2": "14", "y2": "10" }, "child": [] }, { "tag": "line", "attr": { "x1": "3", "y1": "21", "x2": "10", "y2": "14" }, "child": [] }] })(props);
}
function RiKeyboardLine(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M3 17H21V19H3V17ZM3 11H6V14H3V11ZM8 11H11V14H8V11ZM3 5H6V8H3V5ZM13 5H16V8H13V5ZM18 5H21V8H18V5ZM13 11H16V14H13V11ZM18 11H21V14H18V11ZM8 5H11V8H8V5Z" }, "child": [] }] })(props);
}
function RiFormula(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M10 2C7.79086 2 6 3.79086 6 6V9H3V11H6V18C6 19.1046 5.10457 20 4 20H3V22H4C6.20914 22 8 20.2091 8 18V11H11V9H8V6C8 4.89543 8.89543 4 10 4H11V2H10ZM15.2022 16.9971L11.8907 21H14.4864L16.5 18.5659L18.5137 21H21.1093L17.7979 16.9971L21.1046 13H18.5089L16.5 15.4283L14.4912 13H11.8955L15.2022 16.9971Z" }, "child": [] }] })(props);
}
const WindowHeader = ({
  windowState,
  onMinimize,
  onMaximize,
  onClose,
  isMinimized = false,
  title = "Media Player",
  renderActions
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const headerClasses = isMinimized ? "window-header flex items-center justify-between px-3 py-2 min-h-[40px] bg-[rgba(30,30,30,0.9)] border-b border-white/10 cursor-move select-none flex-shrink-0 hover:bg-[rgba(40,40,40,0.9)] transition-colors" : "window-header flex items-center justify-between px-4 py-2.5 min-h-[44px] bg-[rgba(30,30,30,0.9)] border-b border-white/10 cursor-move select-none flex-shrink-0 hover:bg-[rgba(40,40,40,0.9)] transition-colors";
  const showShortcuts = reactExports.useCallback(() => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "sm",
      title: t2("Shortcuts"),
      footer: { actions: ["cancel"] },
      classNames: {
        wrapper: "z-[9999]"
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("Previous") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { keys: ["left"] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white/50", children: t2("or scroll up") })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("Next") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { keys: ["right"] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-white/50", children: t2("or scroll down") })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("Close") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { keys: ["escape"] })
        ] })
      ] })
    });
  }, [createPortal, t2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: headerClasses, onDoubleClick: isMinimized ? onMinimize : onMaximize, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-white/90 text-sm font-medium", children: title }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 ml-3", children: [
      !isMinimized && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Shortcuts"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "text-white/70 hover:text-white/90 min-w-8 w-8 h-8",
          title: "Shortcuts",
          onMouseDown: (e2) => {
            e2.stopPropagation();
            e2.preventDefault();
          },
          onPress: () => {
            showShortcuts();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RiKeyboardLine, { size: 18 })
        }
      ) }),
      !isMinimized && renderActions && renderActions(),
      !isMinimized && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "text-white/70 hover:text-white/90 min-w-8 w-8 h-8",
          title: "Minimize",
          onMouseDown: (e2) => {
            e2.stopPropagation();
            e2.preventDefault();
          },
          onPress: (e2) => {
            onMinimize();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoMdRemove, { size: 18 })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "text-white/70 hover:text-white/90 min-w-8 w-8 h-8",
          title: windowState.isMaximized ? "Restore" : isMinimized ? "Restore" : "Maximize",
          onMouseDown: (e2) => {
            e2.stopPropagation();
            e2.preventDefault();
          },
          onPress: (e2) => {
            if (isMinimized) {
              onMinimize();
            } else {
              onMaximize();
            }
          },
          children: windowState.isMaximized ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFullscreenExit, { size: 16 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(FiMaximize2, { size: 16 })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "text-white/70 hover:text-red-500 hover:bg-red-500/20 min-w-8 w-8 h-8",
          title: "Close",
          onMouseDown: (e2) => {
            e2.stopPropagation();
            e2.preventDefault();
          },
          onPress: (e2) => {
            onClose();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoMdClose, { size: isMinimized ? 16 : 18 })
        }
      )
    ] })
  ] });
};
const Window = (props) => {
  const { title, children, onClose, afterClose, onDestroyed, windowOptions, renderHeaderActions } = props;
  const windowIdRef = reactExports.useRef(`window-${Date.now()}-${Math.random()}`);
  const windowManager = WindowManager.getInstance();
  const rndRef = reactExports.useRef(null);
  const [windowState, setWindowState] = reactExports.useState(() => {
    var _a2, _b2, _c2, _d;
    const initialState3 = windowManager.registerWindow(windowIdRef.current, {
      x: ((_a2 = windowOptions == null ? void 0 : windowOptions.initialPosition) == null ? void 0 : _a2.x) ?? 100,
      y: ((_b2 = windowOptions == null ? void 0 : windowOptions.initialPosition) == null ? void 0 : _b2.y) ?? 100,
      width: ((_c2 = windowOptions == null ? void 0 : windowOptions.initialSize) == null ? void 0 : _c2.width) ?? 1e3,
      height: ((_d = windowOptions == null ? void 0 : windowOptions.initialSize) == null ? void 0 : _d.height) ?? 700,
      isMinimized: false,
      isMaximized: false
    });
    return initialState3;
  });
  const [restoreState, setRestoreState] = reactExports.useState(null);
  const [isClosed, setIsClosed] = reactExports.useState(false);
  const isDraggingRef = reactExports.useRef(false);
  const dragPositionRef = reactExports.useRef(null);
  const isResizingRef = reactExports.useRef(false);
  const resizeStateRef = reactExports.useRef(null);
  const optimisticUpdateRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    const updateViewport = () => {
      windowManager.updateWindow(windowIdRef.current, {
        innerWidth: window.innerWidth,
        innerHeight: window.innerHeight
      });
    };
    updateViewport();
    window.addEventListener("resize", updateViewport);
    return () => {
      window.removeEventListener("resize", updateViewport);
      windowManager.unregisterWindow(windowIdRef.current);
    };
  }, []);
  reactExports.useEffect(() => {
    const unsubscribe = windowManager.subscribe((windows) => {
      const currentWindow = windows.find((w2) => w2.id === windowIdRef.current);
      if (currentWindow) {
        if (resizeStateRef.current) {
          const resizeState = resizeStateRef.current;
          resizeStateRef.current = null;
          setWindowState({
            ...currentWindow,
            x: resizeState.x,
            y: resizeState.y,
            width: resizeState.width,
            height: resizeState.height
          });
        } else if (dragPositionRef.current) {
          const dragPos = dragPositionRef.current;
          dragPositionRef.current = null;
          setWindowState({
            ...currentWindow,
            x: dragPos.x,
            y: dragPos.y
          });
        } else {
          if (optimisticUpdateRef.current) {
            const optimistic = optimisticUpdateRef.current;
            optimisticUpdateRef.current = null;
            setWindowState((prev2) => {
              const merged = {
                ...currentWindow,
                // Preserve optimistic updates for critical state fields
                ...optimistic.isMinimized !== void 0 ? { isMinimized: optimistic.isMinimized } : {},
                ...optimistic.isMaximized !== void 0 ? { isMaximized: optimistic.isMaximized } : {},
                ...optimistic.x !== void 0 ? { x: optimistic.x } : {},
                ...optimistic.y !== void 0 ? { y: optimistic.y } : {},
                ...optimistic.width !== void 0 ? { width: optimistic.width } : {},
                ...optimistic.height !== void 0 ? { height: optimistic.height } : {}
              };
              return merged;
            });
          } else {
            setWindowState(currentWindow);
          }
        }
      }
    });
    return unsubscribe;
  }, []);
  const handleDragStart = reactExports.useCallback(() => {
    isDraggingRef.current = true;
    dragPositionRef.current = null;
    windowManager.bringToFront(windowIdRef.current);
  }, []);
  const handleDrag = reactExports.useCallback(
    (_e, d2) => {
      if (windowState.isMaximized)
        return;
    },
    [windowState.isMaximized]
  );
  const handleDragStop = reactExports.useCallback(
    (_e, d2) => {
      if (windowState.isMaximized) {
        isDraggingRef.current = false;
        return;
      }
      const snapped = windowManager.snapPosition(
        windowIdRef.current,
        d2.x,
        d2.y,
        windowState.width,
        windowState.height
      );
      dragPositionRef.current = { x: snapped.x, y: snapped.y };
      windowManager.updateWindow(windowIdRef.current, {
        x: snapped.x,
        y: snapped.y
      });
      isDraggingRef.current = false;
    },
    [windowState.isMaximized, windowState.width, windowState.height]
  );
  const handleResizeStart = reactExports.useCallback(() => {
    isResizingRef.current = true;
    resizeStateRef.current = null;
    windowManager.bringToFront(windowIdRef.current);
  }, []);
  const handleResize = reactExports.useCallback(
    (_e, _direction, ref, _delta, position2) => {
      if (windowState.isMaximized)
        return;
    },
    [windowState.isMaximized]
  );
  const handleResizeStop = reactExports.useCallback(
    (_e, _direction, ref, _delta, position2) => {
      if (windowState.isMaximized) {
        isResizingRef.current = false;
        return;
      }
      const width = ref.offsetWidth;
      const height = ref.offsetHeight;
      const snappedSize = windowManager.snapSize(
        windowIdRef.current,
        position2.x,
        position2.y,
        width,
        height
      );
      const snappedPos = windowManager.snapPosition(
        windowIdRef.current,
        position2.x,
        position2.y,
        snappedSize.width,
        snappedSize.height
      );
      resizeStateRef.current = {
        x: snappedPos.x,
        y: snappedPos.y,
        width: snappedSize.width,
        height: snappedSize.height
      };
      windowManager.updateWindow(windowIdRef.current, {
        x: snappedPos.x,
        y: snappedPos.y,
        width: snappedSize.width,
        height: snappedSize.height
      });
      isResizingRef.current = false;
    },
    [windowState.isMaximized]
  );
  const handleMinimize = reactExports.useCallback(() => {
    const newIsMinimized = !windowState.isMinimized;
    optimisticUpdateRef.current = { isMinimized: newIsMinimized };
    setWindowState((prev2) => ({
      ...prev2,
      isMinimized: newIsMinimized
    }));
    windowManager.updateWindow(windowIdRef.current, {
      isMinimized: newIsMinimized
    });
  }, [windowState.isMinimized]);
  const handleMaximize = reactExports.useCallback(() => {
    if (windowState.isMaximized) {
      if (restoreState) {
        optimisticUpdateRef.current = {
          isMaximized: false,
          x: restoreState.x,
          y: restoreState.y,
          width: restoreState.width,
          height: restoreState.height
        };
        setWindowState((prev2) => ({
          ...prev2,
          isMaximized: false,
          x: restoreState.x,
          y: restoreState.y,
          width: restoreState.width,
          height: restoreState.height
        }));
        windowManager.updateWindow(windowIdRef.current, {
          isMaximized: false,
          x: restoreState.x,
          y: restoreState.y,
          width: restoreState.width,
          height: restoreState.height
        });
        setRestoreState(null);
      }
    } else {
      const newRestoreState = {
        x: windowState.x,
        y: windowState.y,
        width: windowState.width,
        height: windowState.height
      };
      setRestoreState(newRestoreState);
      optimisticUpdateRef.current = {
        isMaximized: true,
        x: 0,
        y: 0,
        width: window.innerWidth,
        height: window.innerHeight
      };
      setWindowState((prev2) => ({
        ...prev2,
        isMaximized: true,
        x: 0,
        y: 0,
        width: window.innerWidth,
        height: window.innerHeight
      }));
      windowManager.updateWindow(windowIdRef.current, {
        isMaximized: true,
        x: 0,
        y: 0,
        width: window.innerWidth,
        height: window.innerHeight
      });
    }
  }, [windowState.isMaximized, windowState, restoreState]);
  const handleClose = reactExports.useCallback(
    (e2) => {
      e2 == null ? void 0 : e2.stopPropagation();
      setIsClosed(true);
      if (rndRef.current) {
        rndRef.current = null;
      }
      windowManager.unregisterWindow(windowIdRef.current);
      if (afterClose) {
        afterClose();
      }
      if (onDestroyed) {
        onDestroyed();
      }
      if (onClose) {
        onClose();
      }
    },
    [afterClose, onDestroyed, onClose]
  );
  const handleMouseDown = reactExports.useCallback(() => {
    windowManager.bringToFront(windowIdRef.current);
  }, []);
  reactExports.useEffect(() => {
    const handleKeyDown = (e2) => {
      if (!windowManager.isTopmost(windowIdRef.current)) {
        return;
      }
      if (e2.key === "Escape") {
        handleClose();
        e2.preventDefault();
        e2.stopPropagation();
      }
    };
    document.addEventListener("keydown", handleKeyDown, true);
    return () => {
      document.removeEventListener("keydown", handleKeyDown, true);
    };
  }, [handleClose]);
  const windowClasses = "window-component rounded-lg overflow-hidden shadow-[0_10px_40px_rgba(0,0,0,0.5),0_0_0_1px_rgba(255,255,255,0.1)] bg-[rgba(20,20,20,0.95)] backdrop-blur-[10px] flex flex-col";
  if (isClosed) {
    return null;
  }
  if (windowState.isMinimized) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Rnd,
      {
        ref: rndRef,
        className: windowClasses,
        dragHandleClassName: "window-header",
        maxHeight: 40,
        maxWidth: 300,
        minHeight: 40,
        minWidth: 300,
        position: { x: windowState.x, y: windowState.y },
        size: { width: 300, height: 40 },
        style: { zIndex: windowState.zIndex },
        onDrag: handleDrag,
        onDragStart: handleDragStart,
        onDragStop: handleDragStop,
        onMouseDown: handleMouseDown,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          WindowHeader,
          {
            isMinimized: true,
            windowState,
            onClose: handleClose,
            onMaximize: handleMaximize,
            onMinimize: handleMinimize,
            title,
            renderActions: renderHeaderActions
          }
        )
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Rnd,
    {
      ref: rndRef,
      bounds: "window",
      className: windowClasses,
      disableResizing: windowState.isMaximized,
      dragHandleClassName: "window-header",
      minHeight: (windowOptions == null ? void 0 : windowOptions.minHeight) ?? 300,
      minWidth: (windowOptions == null ? void 0 : windowOptions.minWidth) ?? 400,
      position: { x: windowState.x, y: windowState.y },
      size: {
        width: windowState.width,
        height: windowState.height
      },
      style: { zIndex: windowState.zIndex },
      onDrag: handleDrag,
      onDragStart: handleDragStart,
      onDragStop: handleDragStop,
      onMouseDown: handleMouseDown,
      onResize: handleResize,
      onResizeStart: handleResizeStart,
      onResizeStop: handleResizeStop,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col w-full h-full overflow-hidden", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          WindowHeader,
          {
            windowState,
            onClose: handleClose,
            onMaximize: handleMaximize,
            onMinimize: handleMinimize,
            title,
            renderActions: renderHeaderActions
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-hidden", children })
      ] })
    }
  );
};
const github = "https://github.com/Anobaka/Bakabase";
const urls = {
  Github: github
};
const Step = ({ number: number4, title, children }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 py-1.5", children: [
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-5 h-5 rounded-full bg-primary flex items-center justify-center text-white text-xs font-bold", children: number4 }),
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-sm", children: title }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500 ml-2", children })
  ] })
] });
const ErrorModal = ({ error: error2, errorInfo }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [appInfo, setAppInfo] = reactExports.useState();
  const [showFullStack, setShowFullStack] = reactExports.useState(false);
  const [showFullComponentStack, setShowFullComponentStack] = reactExports.useState(false);
  reactExports.useEffect(() => {
    BApi$1.app.getAppInfo().then((rsp) => {
      if (!rsp.code) {
        setAppInfo({
          logPath: rsp.data.logPath
        });
      }
    });
  }, []);
  const truncateStack = (stack, maxLines = 5) => {
    const lines = stack.split("\n");
    if (lines.length <= maxLines)
      return { text: stack, truncated: false };
    return {
      text: lines.slice(0, maxLines).join("\n") + "\n...",
      truncated: true,
      totalLines: lines.length
    };
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl", children: "!" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("Something went wrong") })
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        error2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-danger-200 rounded-lg overflow-hidden", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-danger-50 px-3 py-1.5 border-b border-danger-200 flex items-center justify-between", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-danger-600 text-sm", children: error2.name || "Error" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "flat", children: t2("Error") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-3 flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-danger-600 bg-danger-50 p-2 rounded border border-danger-100", children: error2.message || t2("Unknown error") }),
            error2.stack && /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_default, { isCompact: true, selectionMode: "multiple", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: t2("Stack Trace") }),
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { hideSymbol: true, className: "w-full", radius: "sm", size: "sm", color: "default", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "pre",
                    {
                      className: "text-xs whitespace-pre-wrap break-all font-mono",
                      style: { maxHeight: showFullStack ? "none" : "6rem", overflowY: "auto" },
                      children: showFullStack ? error2.stack : truncateStack(error2.stack).text
                    }
                  ) }),
                  truncateStack(error2.stack).truncated && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", onClick: () => setShowFullStack(!showFullStack), children: showFullStack ? t2("Show less") : t2("Show all") })
                ]
              },
              "stack"
            ) }),
            (errorInfo == null ? void 0 : errorInfo.componentStack) && /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_default, { isCompact: true, selectionMode: "multiple", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              accordion_item_base_default,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: t2("Component Stack") }),
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { hideSymbol: true, className: "w-full", radius: "sm", size: "sm", color: "default", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "pre",
                    {
                      className: "text-xs whitespace-pre-wrap break-all font-mono",
                      style: { maxHeight: showFullComponentStack ? "none" : "6rem", overflowY: "auto" },
                      children: showFullComponentStack ? errorInfo.componentStack : truncateStack(errorInfo.componentStack).text
                    }
                  ) }),
                  truncateStack(errorInfo.componentStack).truncated && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", onClick: () => setShowFullComponentStack(!showFullComponentStack), children: showFullComponentStack ? t2("Show less") : t2("Show all") })
                ]
              },
              "component-stack"
            ) })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-lg overflow-hidden", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-default-100 px-3 py-1.5 border-b border-default-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-sm", children: t2("What you can try") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2 flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Step, { number: 1, title: t2("Reload the page"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("kbd", { className: "px-1 py-0.5 text-xs bg-default-200 rounded font-mono", children: "F5" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Step, { number: 2, title: t2("Restart the app"), children: t2("Shutdown and restart completely") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Step, { number: 3, title: t2("Contact support"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex gap-1.5 mt-1", children: [
              (appInfo == null ? void 0 : appInfo.logPath) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500", children: [
                t2("Log file:"),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  snippet_default,
                  {
                    hideSymbol: true,
                    className: "cursor-pointer ml-1",
                    size: "sm",
                    onClick: () => BApi$1.tool.openFileOrDirectory({ path: appInfo.logPath }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all whitespace-break-spaces text-primary", children: appInfo.logPath })
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  color: "default",
                  size: "sm",
                  onClick: () => BApi$1.gui.openUrlInDefaultBrowser({ url: urls.Github }),
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$E, {}),
                    "GitHub"
                  ]
                }
              ) })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Step, { number: 4, title: t2("Continue browsing"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(link_default, { className: "cursor-pointer", size: "sm", onClick: () => navigate("/"), children: t2("Return to homepage") }) })
          ] })
        ] })
      ] })
    }
  );
};
class ErrorBoundary extends React$6.Component {
  constructor(props) {
    super(props);
    this.state = {
      error: null,
      errorInfo: null
    };
  }
  static getDerivedStateFromError(error2) {
    return { error: error2 };
  }
  componentDidCatch(error2, errorInfo) {
    var _a2, _b2;
    console.error("Error caught by ErrorBoundary:", error2, errorInfo);
    this.setState({ errorInfo });
    (_b2 = (_a2 = this.props).onError) == null ? void 0 : _b2.call(_a2, error2, errorInfo);
  }
  render() {
    const { error: error2, errorInfo } = this.state;
    const { children, fallback: fallback2 } = this.props;
    if (error2) {
      if (fallback2) {
        return fallback2(error2, errorInfo || void 0);
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorModal, { error: error2, errorInfo: errorInfo || void 0 });
    }
    return children;
  }
}
let e = { data: "" }, t$3 = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l$4 = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a$1 = /\/\*[^]*?\*\/|  +/g, n$2 = /\n+/g, o$1 = (e2, t2) => {
  let r2 = "", l2 = "", a2 = "";
  for (let n2 in e2) {
    let c2 = e2[n2];
    "@" == n2[0] ? "i" == n2[1] ? r2 = n2 + " " + c2 + ";" : l2 += "f" == n2[1] ? o$1(c2, n2) : n2 + "{" + o$1(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? l2 += o$1(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = /^--/.test(n2) ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o$1.p ? o$1.p(n2, c2) : n2 + ":" + c2 + ";");
  }
  return r2 + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
}, c$2 = {}, s$2 = (e2) => {
  if ("object" == typeof e2) {
    let t2 = "";
    for (let r2 in e2)
      t2 += r2 + s$2(e2[r2]);
    return t2;
  }
  return e2;
}, i$1 = (e2, t2, r2, i2, p2) => {
  let u2 = s$2(e2), d2 = c$2[u2] || (c$2[u2] = ((e3) => {
    let t3 = 0, r3 = 11;
    for (; t3 < e3.length; )
      r3 = 101 * r3 + e3.charCodeAt(t3++) >>> 0;
    return "go" + r3;
  })(u2));
  if (!c$2[d2]) {
    let t3 = u2 !== e2 ? e2 : ((e3) => {
      let t4, r3, o2 = [{}];
      for (; t4 = l$4.exec(e3.replace(a$1, "")); )
        t4[4] ? o2.shift() : t4[3] ? (r3 = t4[3].replace(n$2, " ").trim(), o2.unshift(o2[0][r3] = o2[0][r3] || {})) : o2[0][t4[1]] = t4[2].replace(n$2, " ").trim();
      return o2[0];
    })(e2);
    c$2[d2] = o$1(p2 ? { ["@keyframes " + d2]: t3 } : t3, r2 ? "" : "." + d2);
  }
  let f2 = r2 && c$2.g ? c$2.g : null;
  return r2 && (c$2.g = c$2[d2]), ((e3, t3, r3, l2) => {
    l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r3 ? e3 + t3.data : t3.data + e3);
  })(c$2[d2], t2, i2, f2), d2;
}, p$3 = (e2, t2, r2) => e2.reduce((e3, l2, a2) => {
  let n2 = t2[a2];
  if (n2 && n2.call) {
    let e4 = n2(r2), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
    n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o$1(e4, "") : false === e4 ? "" : e4;
  }
  return e3 + l2 + (null == n2 ? "" : n2);
}, "");
function u$4(e2) {
  let r2 = this || {}, l2 = e2.call ? e2(r2.p) : e2;
  return i$1(l2.unshift ? l2.raw ? p$3(l2, [].slice.call(arguments, 1), r2.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r2.p) : t2), {}) : l2, t$3(r2.target), r2.g, r2.o, r2.k);
}
let d$1, f$2, g$1;
u$4.bind({ g: 1 });
let h$1 = u$4.bind({ k: 1 });
function m(e2, t2, r2, l2) {
  o$1.p = t2, d$1 = e2, f$2 = r2, g$1 = l2;
}
function j$1(e2, t2) {
  let r2 = this || {};
  return function() {
    let l2 = arguments;
    function a2(n2, o2) {
      let c2 = Object.assign({}, n2), s2 = c2.className || a2.className;
      r2.p = Object.assign({ theme: f$2 && f$2() }, c2), r2.o = / *go\d+/.test(s2), c2.className = u$4.apply(r2, l2) + (s2 ? " " + s2 : "");
      let i2 = e2;
      return e2[0] && (i2 = c2.as || e2, delete c2.as), g$1 && i2[0] && g$1(c2), d$1(i2, c2);
    }
    return a2;
  };
}
var W$3 = (e2) => typeof e2 == "function", f$1 = (e2, t2) => W$3(e2) ? e2(t2) : e2;
var F$1 = /* @__PURE__ */ (() => {
  let e2 = 0;
  return () => (++e2).toString();
})(), A$2 = /* @__PURE__ */ (() => {
  let e2;
  return () => {
    if (e2 === void 0 && typeof window < "u") {
      let t2 = matchMedia("(prefers-reduced-motion: reduce)");
      e2 = !t2 || t2.matches;
    }
    return e2;
  };
})();
var Y$2 = 20;
var U$3 = (e2, t2) => {
  switch (t2.type) {
    case 0:
      return { ...e2, toasts: [t2.toast, ...e2.toasts].slice(0, Y$2) };
    case 1:
      return { ...e2, toasts: e2.toasts.map((o2) => o2.id === t2.toast.id ? { ...o2, ...t2.toast } : o2) };
    case 2:
      let { toast: r2 } = t2;
      return U$3(e2, { type: e2.toasts.find((o2) => o2.id === r2.id) ? 1 : 0, toast: r2 });
    case 3:
      let { toastId: s2 } = t2;
      return { ...e2, toasts: e2.toasts.map((o2) => o2.id === s2 || s2 === void 0 ? { ...o2, dismissed: true, visible: false } : o2) };
    case 4:
      return t2.toastId === void 0 ? { ...e2, toasts: [] } : { ...e2, toasts: e2.toasts.filter((o2) => o2.id !== t2.toastId) };
    case 5:
      return { ...e2, pausedAt: t2.time };
    case 6:
      let a2 = t2.time - (e2.pausedAt || 0);
      return { ...e2, pausedAt: void 0, toasts: e2.toasts.map((o2) => ({ ...o2, pauseDuration: o2.pauseDuration + a2 })) };
  }
}, P$3 = [], y$3 = { toasts: [], pausedAt: void 0 }, u$3 = (e2) => {
  y$3 = U$3(y$3, e2), P$3.forEach((t2) => {
    t2(y$3);
  });
};
var J$2 = (e2, t2 = "blank", r2) => ({ createdAt: Date.now(), visible: true, dismissed: false, type: t2, ariaProps: { role: "status", "aria-live": "polite" }, message: e2, pauseDuration: 0, ...r2, id: (r2 == null ? void 0 : r2.id) || F$1() }), x$3 = (e2) => (t2, r2) => {
  let s2 = J$2(t2, e2, r2);
  return u$3({ type: 2, toast: s2 }), s2.id;
}, c$1 = (e2, t2) => x$3("blank")(e2, t2);
c$1.error = x$3("error");
c$1.success = x$3("success");
c$1.loading = x$3("loading");
c$1.custom = x$3("custom");
c$1.dismiss = (e2) => {
  u$3({ type: 3, toastId: e2 });
};
c$1.remove = (e2) => u$3({ type: 4, toastId: e2 });
c$1.promise = (e2, t2, r2) => {
  let s2 = c$1.loading(t2.loading, { ...r2, ...r2 == null ? void 0 : r2.loading });
  return typeof e2 == "function" && (e2 = e2()), e2.then((a2) => {
    let o2 = t2.success ? f$1(t2.success, a2) : void 0;
    return o2 ? c$1.success(o2, { id: s2, ...r2, ...r2 == null ? void 0 : r2.success }) : c$1.dismiss(s2), a2;
  }).catch((a2) => {
    let o2 = t2.error ? f$1(t2.error, a2) : void 0;
    o2 ? c$1.error(o2, { id: s2, ...r2, ...r2 == null ? void 0 : r2.error }) : c$1.dismiss(s2);
  }), e2;
};
var oe = h$1`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
 transform: scale(1) rotate(45deg);
  opacity: 1;
}`, re$1 = h$1`
from {
  transform: scale(0);
  opacity: 0;
}
to {
  transform: scale(1);
  opacity: 1;
}`, se = h$1`
from {
  transform: scale(0) rotate(90deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(90deg);
	opacity: 1;
}`, k$2 = j$1("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e2) => e2.primary || "#ff4b4b"};
  position: relative;
  transform: rotate(45deg);

  animation: ${oe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;

  &:after,
  &:before {
    content: '';
    animation: ${re$1} 0.15s ease-out forwards;
    animation-delay: 150ms;
    position: absolute;
    border-radius: 3px;
    opacity: 0;
    background: ${(e2) => e2.secondary || "#fff"};
    bottom: 9px;
    left: 4px;
    height: 2px;
    width: 12px;
  }

  &:before {
    animation: ${se} 0.15s ease-out forwards;
    animation-delay: 180ms;
    transform: rotate(90deg);
  }
`;
var ne = h$1`
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
`, V$2 = j$1("div")`
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 100%;
  border-color: ${(e2) => e2.secondary || "#e0e0e0"};
  border-right-color: ${(e2) => e2.primary || "#616161"};
  animation: ${ne} 1s linear infinite;
`;
var pe = h$1`
from {
  transform: scale(0) rotate(45deg);
	opacity: 0;
}
to {
  transform: scale(1) rotate(45deg);
	opacity: 1;
}`, de = h$1`
0% {
	height: 0;
	width: 0;
	opacity: 0;
}
40% {
  height: 0;
	width: 6px;
	opacity: 1;
}
100% {
  opacity: 1;
  height: 10px;
}`, _$1 = j$1("div")`
  width: 20px;
  opacity: 0;
  height: 20px;
  border-radius: 10px;
  background: ${(e2) => e2.primary || "#61d345"};
  position: relative;
  transform: rotate(45deg);

  animation: ${pe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
  animation-delay: 100ms;
  &:after {
    content: '';
    box-sizing: border-box;
    animation: ${de} 0.2s ease-out forwards;
    opacity: 0;
    animation-delay: 200ms;
    position: absolute;
    border-right: 2px solid;
    border-bottom: 2px solid;
    border-color: ${(e2) => e2.secondary || "#fff"};
    bottom: 6px;
    left: 6px;
    height: 10px;
    width: 6px;
  }
`;
var ue = j$1("div")`
  position: absolute;
`, le = j$1("div")`
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 20px;
  min-height: 20px;
`, fe = h$1`
from {
  transform: scale(0.6);
  opacity: 0.4;
}
to {
  transform: scale(1);
  opacity: 1;
}`, Te = j$1("div")`
  position: relative;
  transform: scale(0.6);
  opacity: 0.4;
  min-width: 20px;
  animation: ${fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
    forwards;
`, M$3 = ({ toast: e2 }) => {
  let { icon: t2, type: r2, iconTheme: s2 } = e2;
  return t2 !== void 0 ? typeof t2 == "string" ? reactExports.createElement(Te, null, t2) : t2 : r2 === "blank" ? null : reactExports.createElement(le, null, reactExports.createElement(V$2, { ...s2 }), r2 !== "loading" && reactExports.createElement(ue, null, r2 === "error" ? reactExports.createElement(k$2, { ...s2 }) : reactExports.createElement(_$1, { ...s2 })));
};
var ye = (e2) => `
0% {transform: translate3d(0,${e2 * -200}%,0) scale(.6); opacity:.5;}
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
`, ge = (e2) => `
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;}
`, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = j$1("div")`
  display: flex;
  align-items: center;
  background: #fff;
  color: #363636;
  line-height: 1.3;
  will-change: transform;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
  max-width: 350px;
  pointer-events: auto;
  padding: 8px 10px;
  border-radius: 8px;
`, Se = j$1("div")`
  display: flex;
  justify-content: center;
  margin: 4px 10px;
  color: inherit;
  flex: 1 1 auto;
  white-space: pre-line;
`, Ae = (e2, t2) => {
  let s2 = e2.includes("top") ? 1 : -1, [a2, o2] = A$2() ? [he, xe] : [ye(s2), ge(s2)];
  return { animation: t2 ? `${h$1(a2)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${h$1(o2)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
};
reactExports.memo(({ toast: e2, position: t2, style: r2, children: s2 }) => {
  let a2 = e2.height ? Ae(e2.position || t2 || "top-center", e2.visible) : { opacity: 0 }, o2 = reactExports.createElement(M$3, { toast: e2 }), n2 = reactExports.createElement(Se, { ...e2.ariaProps }, f$1(e2.message, e2));
  return reactExports.createElement(be, { className: e2.className, style: { ...a2, ...r2, ...e2.style } }, typeof s2 == "function" ? s2({ icon: o2, message: n2 }) : reactExports.createElement(reactExports.Fragment, null, o2, n2));
});
m(reactExports.createElement);
u$4`
  z-index: 9999;
  > * {
    pointer-events: auto;
  }
`;
var Vt = c$1;
dayjs.extend(duration);
const BakabaseContext = reactExports.createContext({
  createPortal: (C2, props) => ({ key: "", destroy: () => {
  } }),
  createWindow: (C2, props, options) => ({ key: "", destroy: () => {
  } }),
  closeAllModals: () => {
  },
  isDarkMode: false,
  isDebugging: false
});
const useBakabaseContext = () => {
  return reactExports.useContext(BakabaseContext);
};
const getStoredTheme = () => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return void 0;
  }
  try {
    const stored = localStorage.getItem("bakabase-theme");
    if (stored) {
      const themeValue = parseInt(stored);
      if (Object.values(UiTheme).includes(themeValue)) {
        return themeValue;
      }
    }
  } catch (error2) {
    console.warn("Failed to read theme from localStorage:", error2);
  }
};
const setStoredTheme = (theme2) => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return;
  }
  try {
    localStorage.setItem("bakabase-theme", theme2.toString());
  } catch (error2) {
    console.warn("Failed to save theme to localStorage:", error2);
  }
};
const changeTheme = (theme2) => {
  console.log(theme2, document);
  if (typeof document === "undefined") {
    return;
  }
  const cls = document.documentElement.classList;
  cls.remove("iw-theme-dark", "iw-theme-light", "dark", "light");
  cls.add(
    `iw-theme-${theme2 == UiTheme.Dark ? "dark" : "light"}`,
    theme2 == UiTheme.Dark ? "dark" : "light"
  );
};
const BakabaseContextProvider = ({ children }) => {
  const [appOptions, setAppOptions] = reactExports.useState();
  const currentTheme = reactExports.useRef(getUiTheme(appOptions ? appOptions.uiTheme : getStoredTheme()));
  const isDarkMode = reactExports.useMemo(() => currentTheme.current === UiTheme.Dark, [currentTheme]);
  const [portals, setPortals] = reactExports.useState([]);
  const mount = (C2, props) => {
    console.log("[createPortal] mount", C2, props);
    const key = uuidv4();
    const destroy = () => {
      console.log("[createPortal] destroy", key);
      setPortals((prev2) => prev2.filter((p2) => p2.key !== key));
    };
    const component = /* @__PURE__ */ jsxRuntimeExports.jsx(
      C2,
      {
        ...props,
        onDestroyed: () => {
          var _a2;
          (_a2 = props.onDestroyed) == null ? void 0 : _a2.call(props);
          destroy();
        }
      }
    );
    setPortals((prev2) => [...prev2, { key, component, persistent: false }]);
    return { key, destroy };
  };
  const mountWindow = (C2, props, options) => {
    console.log("[createWindow] mount", C2, props, options);
    const key = uuidv4();
    const { title, persistent, renderHeaderActions, ...windowOptions } = options || {};
    const windowComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
      Window,
      {
        title,
        windowOptions,
        renderHeaderActions,
        onDestroyed: () => {
          destroy();
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(C2, { ...props })
      }
    );
    setPortals((prev2) => [...prev2, { key, component: windowComponent, persistent }]);
    const destroy = () => {
      console.log("[createWindow] destroy", key);
      setPortals((prev2) => prev2.filter((p2) => p2.key !== key));
    };
    return { key, destroy };
  };
  const closeAllModals = () => {
    console.log("[closeAllModals] closing all non-persistent modals");
    setPortals((prev2) => prev2.filter((p2) => p2.persistent));
  };
  const appOptionsStore = useAppOptionsStore();
  const isDebugging = false;
  const firstTimeGotAppOptionsRef = reactExports.useRef(false);
  const location2 = useLocation();
  const navigate = useNavigate();
  const href = useHref;
  reactExports.useEffect(() => {
    changeTheme(currentTheme.current);
    BApi$1.options.getAppOptions().then((r2) => {
      setAppOptions(r2.data);
    });
    console.log("bakabase context provider initialized");
    Clarity.init("r5xlbsu4fl");
    return () => {
      console.log("bakabase context provider is unmounting");
    };
  }, []);
  reactExports.useEffect(() => {
    if (appOptionsStore.initialized) {
      setAppOptions(appOptionsStore.data);
    }
  }, [appOptionsStore]);
  reactExports.useEffect(() => {
    if (appOptions) {
      console.log("appOptions", appOptions, firstTimeGotAppOptionsRef.current);
      if (!firstTimeGotAppOptionsRef.current) {
        firstTimeGotAppOptionsRef.current = true;
        Clarity.setTag("appVersion", appOptions.version);
        instance.changeLanguage(appOptions.language);
      }
      const uiTheme = getUiTheme(appOptions.uiTheme);
      if (currentTheme.current != uiTheme) {
        currentTheme.current = uiTheme;
        changeTheme(uiTheme);
        setStoredTheme(uiTheme);
        console.log("theme changed to:", uiTheme);
      }
    }
  }, [appOptions]);
  reactExports.useEffect(() => {
    setPortals((prev2) => prev2.filter((p2) => p2.persistent));
  }, [location2.pathname]);
  console.log("current theme", UiTheme[currentTheme.current], "portals", portals);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(UIHubConnection, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(HeroUIProvider, { navigate, useHref: href, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      ConfigProvider,
      {
        theme: {
          algorithm: isDarkMode ? theme.darkAlgorithm : theme.defaultAlgorithm
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(ToastProvider, { placement: "top-center" }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            BakabaseContext.Provider,
            {
              value: {
                isDarkMode,
                createPortal: mount,
                createWindow: mountWindow,
                closeAllModals,
                isDebugging
              },
              children: [
                portals.map(({ key, component }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Fragment, { children: component }) }, key)),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: `${isDarkMode ? "dark" : "light"} h-[100vh] w-[100vw] text-foreground bg-background`,
                    children: appOptions ? children : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) })
                  }
                )
              ]
            }
          )
        ]
      }
    ) })
  ] });
};
function AiOutlineAim(props) {
  return GenIcon({ "attr": { "t": "1569683657482", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8C574.1 404.4 544.1 392 512 392z" }, "child": [] }] })(props);
}
function AiOutlineAppstoreAdd(props) {
  return GenIcon({ "attr": { "t": "1569683928793", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16z m-52 268H212V212h200v200zM864 144H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16z m-52 268H612V212h200v200zM864 544H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16z m-52 268H612V612h200v200zM424 712H296V584c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v128H104c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h128v128c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V776h128c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineAppstore(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M464 144H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H212V212h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V160c0-8.8-7.2-16-16-16zm-52 268H612V212h200v200zM464 544H160c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H212V612h200v200zm452-268H560c-8.8 0-16 7.2-16 16v304c0 8.8 7.2 16 16 16h304c8.8 0 16-7.2 16-16V560c0-8.8-7.2-16-16-16zm-52 268H612V612h200v200z" }, "child": [] }] })(props);
}
function AiOutlineArrowDown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M862 465.3h-81c-4.6 0-9 2-12.1 5.5L550 723.1V160c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v563.1L255.1 470.8c-3-3.5-7.4-5.5-12.1-5.5h-81c-6.8 0-10.5 8.1-6 13.2L487.9 861a31.96 31.96 0 0 0 48.3 0L868 478.5c4.5-5.2.8-13.2-6-13.2z" }, "child": [] }] })(props);
}
function AiOutlineArrowRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M869 487.8L491.2 159.9c-2.9-2.5-6.6-3.9-10.5-3.9h-88.5c-7.4 0-10.8 9.2-5.2 14l350.2 304H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h585.1L386.9 854c-5.6 4.9-2.2 14 5.2 14h91.5c1.9 0 3.8-.7 5.2-2L869 536.2a32.07 32.07 0 0 0 0-48.4z" }, "child": [] }] })(props);
}
function AiOutlineBarChart(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M888 792H200V168c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v688c0 4.4 3.6 8 8 8h752c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm-600-80h56c4.4 0 8-3.6 8-8V560c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v144c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V384c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v320c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V462c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v242c0 4.4 3.6 8 8 8zm152 0h56c4.4 0 8-3.6 8-8V304c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v400c0 4.4 3.6 8 8 8z" }, "child": [] }] })(props);
}
function AiOutlineBlock(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M856 376H648V168c0-8.8-7.2-16-16-16H168c-8.8 0-16 7.2-16 16v464c0 8.8 7.2 16 16 16h208v208c0 8.8 7.2 16 16 16h464c8.8 0 16-7.2 16-16V392c0-8.8-7.2-16-16-16zm-480 16v188H220V220h360v156H392c-8.8 0-16 7.2-16 16zm204 52v136H444V444h136zm224 360H444V648h188c8.8 0 16-7.2 16-16V444h156v360z" }, "child": [] }] })(props);
}
function AiOutlineBranches(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M740 161c-61.8 0-112 50.2-112 112 0 50.1 33.1 92.6 78.5 106.9v95.9L320 602.4V318.1c44.2-15 76-56.9 76-106.1 0-61.8-50.2-112-112-112s-112 50.2-112 112c0 49.2 31.8 91 76 106.1V706c-44.2 15-76 56.9-76 106.1 0 61.8 50.2 112 112 112s112-50.2 112-112c0-49.2-31.8-91-76-106.1v-27.8l423.5-138.7a50.52 50.52 0 0 0 34.9-48.2V378.2c42.9-15.8 73.6-57 73.6-105.2 0-61.8-50.2-112-112-112zm-504 51a48.01 48.01 0 0 1 96 0 48.01 48.01 0 0 1-96 0zm96 600a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm408-491a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, "child": [] }] })(props);
}
function AiOutlineBug(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M304 280h56c4.4 0 8-3.6 8-8 0-28.3 5.9-53.2 17.1-73.5 10.6-19.4 26-34.8 45.4-45.4C450.9 142 475.7 136 504 136h16c28.3 0 53.2 5.9 73.5 17.1 19.4 10.6 34.8 26 45.4 45.4C650 218.9 656 243.7 656 272c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-40-8.8-76.7-25.9-108.1-17.2-31.5-42.5-56.8-74-74C596.7 72.8 560 64 520 64h-16c-40 0-76.7 8.8-108.1 25.9-31.5 17.2-56.8 42.5-74 74C304.8 195.3 296 232 296 272c0 4.4 3.6 8 8 8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M940 512H792V412c76.8 0 139-62.2 139-139 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 34.8-28.2 63-63 63H232c-34.8 0-63-28.2-63-63 0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 76.8 62.2 139 139 139v100H84c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h148v96c0 6.5.2 13 .7 19.3C164.1 728.6 116 796.7 116 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-44.2 23.9-82.9 59.6-103.7 6 17.2 13.6 33.6 22.7 49 24.3 41.5 59 76.2 100.5 100.5S460.5 960 512 960s99.8-13.9 141.3-38.2c41.5-24.3 76.2-59 100.5-100.5 9.1-15.5 16.7-31.9 22.7-49C812.1 793.1 836 831.8 836 876c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8 0-79.3-48.1-147.4-116.7-176.7.4-6.4.7-12.8.7-19.3v-96h148c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM716 680c0 36.8-9.7 72-27.8 102.9-17.7 30.3-43 55.6-73.3 73.3C584 874.3 548.8 884 512 884s-72-9.7-102.9-27.8c-30.3-17.7-55.6-43-73.3-73.3C317.7 752 308 716.8 308 680V412h408v268z" }, "child": [] }] })(props);
}
function AiOutlineCheckCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0 0 51.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" }, "child": [] }] })(props);
}
function AiOutlineClockCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }, { "tag": "path", "attr": { "d": "M686.7 638.6L544.1 535.5V288c0-4.4-3.6-8-8-8H488c-4.4 0-8 3.6-8 8v275.4c0 2.6 1.2 5 3.3 6.5l165.4 120.6c3.6 2.6 8.6 1.8 11.2-1.7l28.6-39c2.6-3.7 1.8-8.7-1.8-11.2z" }, "child": [] }] })(props);
}
function AiOutlineCloseCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64Zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372Zm128.013 198.826c.023.007.042.018.083.059l45.02 45.019c.04.04.05.06.058.083a.118.118 0 0 1 0 .07c-.007.022-.018.041-.059.082L557.254 512l127.861 127.862a.268.268 0 0 1 .05.06l.009.023a.118.118 0 0 1 0 .07c-.007.022-.018.041-.059.082l-45.019 45.02c-.04.04-.06.05-.083.058a.118.118 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059L512 557.254 384.14 685.115c-.042.041-.06.052-.084.059a.118.118 0 0 1-.07 0c-.022-.007-.041-.018-.082-.059l-45.02-45.019c-.04-.04-.05-.06-.058-.083a.118.118 0 0 1 0-.07c.007-.022.018-.041.059-.082L466.745 512l-127.86-127.86a.268.268 0 0 1-.05-.061l-.009-.023a.118.118 0 0 1 0-.07c.007-.022.018-.041.059-.082l45.019-45.02c.04-.04.06-.05.083-.058a.118.118 0 0 1 .07 0c.022.007.041.018.082.059L512 466.745l127.862-127.86c.04-.041.06-.052.083-.059a.118.118 0 0 1 .07 0Z" }, "child": [] }] })(props);
}
function AiOutlineClose(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M799.855 166.312c.023.007.043.018.084.059l57.69 57.69c.041.041.052.06.059.084a.118.118 0 0 1 0 .069c-.007.023-.018.042-.059.083L569.926 512l287.703 287.703c.041.04.052.06.059.083a.118.118 0 0 1 0 .07c-.007.022-.018.042-.059.083l-57.69 57.69c-.041.041-.06.052-.084.059a.118.118 0 0 1-.069 0c-.023-.007-.042-.018-.083-.059L512 569.926 224.297 857.629c-.04.041-.06.052-.083.059a.118.118 0 0 1-.07 0c-.022-.007-.042-.018-.083-.059l-57.69-57.69c-.041-.041-.052-.06-.059-.084a.118.118 0 0 1 0-.069c.007-.023.018-.042.059-.083L454.073 512 166.371 224.297c-.041-.04-.052-.06-.059-.083a.118.118 0 0 1 0-.07c.007-.022.018-.042.059-.083l57.69-57.69c.041-.041.06-.052.084-.059a.118.118 0 0 1 .069 0c.023.007.042.018.083.059L512 454.073l287.703-287.702c.04-.041.06-.052.083-.059a.118.118 0 0 1 .07 0Z" }, "child": [] }] })(props);
}
function AiOutlineCloudDownload(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M624 706.3h-74.1V464c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v242.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.7a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9z" }, "child": [] }, { "tag": "path", "attr": { "d": "M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0 1 52.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 0 1-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z" }, "child": [] }] })(props);
}
function AiOutlineCode(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 0 0 308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 0 0-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" }, "child": [] }] })(props);
}
function AiOutlineControl(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM340 683v77c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-77c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198V264c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v221c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8s0 .1.1.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8 0 0 0 .1-.1.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7zM620 539v221c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V539c-10.1 3.3-20.8 5-32 5s-21.9-1.8-32-5zm64-198v-77c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v77c10.1-3.3 20.8-5 32-5s21.9 1.8 32 5zm-64 198c10.1 3.3 20.8 5 32 5s21.9-1.8 32-5c41.8-13.5 72-52.7 72-99s-30.2-85.5-72-99c-10.1-3.3-20.8-5-32-5s-21.9 1.8-32 5c-41.8 13.5-72 52.7-72 99s30.2 85.5 72 99zm.1-115.7c.3-.6.7-1.2 1-1.8v-.1l1.2-1.8c.1-.2.2-.3.3-.5.3-.5.7-.9 1-1.4.1-.1.2-.3.3-.4.5-.6.9-1.1 1.4-1.6l.3-.3 1.2-1.2.4-.4c.5-.5 1-.9 1.6-1.4.6-.5 1.1-.9 1.7-1.3.2-.1.3-.2.5-.3.5-.3.9-.7 1.4-1 .1-.1.3-.2.4-.3.6-.4 1.2-.7 1.9-1.1.1-.1.3-.1.4-.2.5-.3 1-.5 1.6-.8l.6-.3c.7-.3 1.3-.6 2-.8.7-.3 1.4-.5 2.1-.7.2-.1.4-.1.6-.2.6-.2 1.1-.3 1.7-.4.2 0 .3-.1.5-.1.7-.2 1.5-.3 2.2-.4.2 0 .3 0 .5-.1.6-.1 1.2-.1 1.8-.2h.6c.8 0 1.5-.1 2.3-.1s1.5 0 2.3.1h.6c.6 0 1.2.1 1.8.2.2 0 .3 0 .5.1.7.1 1.5.2 2.2.4.2 0 .3.1.5.1.6.1 1.2.3 1.7.4.2.1.4.1.6.2.7.2 1.4.4 2.1.7.7.2 1.3.5 2 .8l.6.3c.5.2 1.1.5 1.6.8.1.1.3.1.4.2.6.3 1.3.7 1.9 1.1.1.1.3.2.4.3.5.3 1 .6 1.4 1 .2.1.3.2.5.3.6.4 1.2.9 1.7 1.3s1.1.9 1.6 1.4l.4.4 1.2 1.2.3.3c.5.5 1 1.1 1.4 1.6.1.1.2.3.3.4.4.4.7.9 1 1.4.1.2.2.3.3.5l1.2 1.8v.1a36.18 36.18 0 0 1 5.1 18.5c0 6-1.5 11.7-4.1 16.7-.3.6-.7 1.2-1 1.8v.1l-1.2 1.8c-.1.2-.2.3-.3.5-.3.5-.7.9-1 1.4-.1.1-.2.3-.3.4-.5.6-.9 1.1-1.4 1.6l-.3.3-1.2 1.2-.4.4c-.5.5-1 .9-1.6 1.4-.6.5-1.1.9-1.7 1.3-.2.1-.3.2-.5.3-.5.3-.9.7-1.4 1-.1.1-.3.2-.4.3-.6.4-1.2.7-1.9 1.1-.1.1-.3.1-.4.2-.5.3-1 .5-1.6.8l-.6.3c-.7.3-1.3.6-2 .8-.7.3-1.4.5-2.1.7-.2.1-.4.1-.6.2-.6.2-1.1.3-1.7.4-.2 0-.3.1-.5.1-.7.2-1.5.3-2.2.4-.2 0-.3 0-.5.1-.6.1-1.2.1-1.8.2h-.6c-.8 0-1.5.1-2.3.1s-1.5 0-2.3-.1h-.6c-.6 0-1.2-.1-1.8-.2-.2 0-.3 0-.5-.1-.7-.1-1.5-.2-2.2-.4-.2 0-.3-.1-.5-.1-.6-.1-1.2-.3-1.7-.4-.2-.1-.4-.1-.6-.2-.7-.2-1.4-.4-2.1-.7-.7-.2-1.3-.5-2-.8l-.6-.3c-.5-.2-1.1-.5-1.6-.8-.1-.1-.3-.1-.4-.2-.6-.3-1.3-.7-1.9-1.1-.1-.1-.3-.2-.4-.3-.5-.3-1-.6-1.4-1-.2-.1-.3-.2-.5-.3-.6-.4-1.2-.9-1.7-1.3s-1.1-.9-1.6-1.4l-.4-.4-1.2-1.2-.3-.3c-.5-.5-1-1.1-1.4-1.6-.1-.1-.2-.3-.3-.4-.4-.4-.7-.9-1-1.4-.1-.2-.2-.3-.3-.5l-1.2-1.8v-.1c-.4-.6-.7-1.2-1-1.8-2.6-5-4.1-10.7-4.1-16.7s1.5-11.7 4.1-16.7z" }, "child": [] }] })(props);
}
function AiOutlineCopy(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" }, "child": [] }] })(props);
}
function AiOutlineDashboard(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M924.8 385.6a446.7 446.7 0 0 0-96-142.4 446.7 446.7 0 0 0-142.4-96C631.1 123.8 572.5 112 512 112s-119.1 11.8-174.4 35.2a446.7 446.7 0 0 0-142.4 96 446.7 446.7 0 0 0-96 142.4C75.8 440.9 64 499.5 64 560c0 132.7 58.3 257.7 159.9 343.1l1.7 1.4c5.8 4.8 13.1 7.5 20.6 7.5h531.7c7.5 0 14.8-2.7 20.6-7.5l1.7-1.4C901.7 817.7 960 692.7 960 560c0-60.5-11.9-119.1-35.2-174.4zM761.4 836H262.6A371.12 371.12 0 0 1 140 560c0-99.4 38.7-192.8 109-263 70.3-70.3 163.7-109 263-109 99.4 0 192.8 38.7 263 109 70.3 70.3 109 163.7 109 263 0 105.6-44.5 205.5-122.6 276zM623.5 421.5a8.03 8.03 0 0 0-11.3 0L527.7 506c-18.7-5-39.4-.2-54.1 14.5a55.95 55.95 0 0 0 0 79.2 55.95 55.95 0 0 0 79.2 0 55.87 55.87 0 0 0 14.5-54.1l84.5-84.5c3.1-3.1 3.1-8.2 0-11.3l-28.3-28.3zM490 320h44c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8h-44c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8zm260 218v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8zm12.7-197.2l-31.1-31.1a8.03 8.03 0 0 0-11.3 0l-56.6 56.6a8.03 8.03 0 0 0 0 11.3l31.1 31.1c3.1 3.1 8.2 3.1 11.3 0l56.6-56.6c3.1-3.1 3.1-8.2 0-11.3zm-458.6-31.1a8.03 8.03 0 0 0-11.3 0l-31.1 31.1a8.03 8.03 0 0 0 0 11.3l56.6 56.6c3.1 3.1 8.2 3.1 11.3 0l31.1-31.1c3.1-3.1 3.1-8.2 0-11.3l-56.6-56.6zM262 530h-80c-4.4 0-8 3.6-8 8v44c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8v-44c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineDatabase(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM304 240a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm0 272a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineDelete(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" }, "child": [] }] })(props);
}
function AiOutlineDiff(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M476 399.1c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1V484h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H420v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V540h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H476v-84.9zM560.5 704h-225c-4.1 0-7.5 3.2-7.5 7v42c0 3.8 3.4 7 7.5 7h225c4.1 0 7.5-3.2 7.5-7v-42c0-3.8-3.4-7-7.5-7zm-7.1-502.6c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v704c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32V397.3c0-8.5-3.4-16.6-9.4-22.6L553.4 201.4zM664 888H232V264h282.2L664 413.8V888zm190.2-581.4L611.3 72.9c-6-5.7-13.9-8.9-22.2-8.9H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h277l219 210.6V824c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V329.6c0-8.7-3.5-17-9.8-23z" }, "child": [] }] })(props);
}
function AiOutlineDisconnect(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832.6 191.4c-84.6-84.6-221.5-84.6-306 0l-96.9 96.9 51 51 96.9-96.9c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204l-96.9 96.9 51.1 51.1 96.9-96.9c84.4-84.6 84.4-221.5-.1-306.1zM446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l96.9-96.9-51.1-51.1-96.9 96.9c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l96.9-96.9-51-51-96.8 97zM260.3 209.4a8.03 8.03 0 0 0-11.3 0L209.4 249a8.03 8.03 0 0 0 0 11.3l554.4 554.4c3.1 3.1 8.2 3.1 11.3 0l39.6-39.6c3.1-3.1 3.1-8.2 0-11.3L260.3 209.4z" }, "child": [] }] })(props);
}
function AiOutlineDoubleRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 0 0 188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 0 0 492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" }, "child": [] }] })(props);
}
function AiOutlineDown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" }, "child": [] }] })(props);
}
function AiOutlineDownload(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M505.7 661a8 8 0 0 0 12.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineEdit(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 0 0 0-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 0 0 9.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" }, "child": [] }] })(props);
}
function AiOutlineEllipsis(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M176 511a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm280 0a56 56 0 1 0 112 0 56 56 0 1 0-112 0z" }, "child": [] }] })(props);
}
function AiOutlineEnter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M864 170h-60c-4.4 0-8 3.6-8 8v518H310v-73c0-6.7-7.8-10.5-13-6.3l-141.9 112a8 8 0 0 0 0 12.6l141.9 112c5.3 4.2 13 .4 13-6.3v-75h498c35.3 0 64-28.7 64-64V178c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineExperiment(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 472a40 40 0 1 0 80 0 40 40 0 1 0-80 0zm367 352.9L696.3 352V178H768v-68H256v68h71.7v174L145 824.9c-2.8 7.4-4.3 15.2-4.3 23.1 0 35.3 28.7 64 64 64h614.6c7.9 0 15.7-1.5 23.1-4.3 33-12.7 49.4-49.8 36.6-82.8zM395.7 364.7V180h232.6v184.7L719.2 600c-20.7-5.3-42.1-8-63.9-8-61.2 0-119.2 21.5-165.3 60a188.78 188.78 0 0 1-121.3 43.9c-32.7 0-64.1-8.3-91.8-23.7l118.8-307.5zM210.5 844l41.7-107.8c35.7 18.1 75.4 27.8 116.6 27.8 61.2 0 119.2-21.5 165.3-60 33.9-28.2 76.3-43.9 121.3-43.9 35 0 68.4 9.5 97.6 27.1L813.5 844h-603z" }, "child": [] }] })(props);
}
function AiOutlineExport(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32ZM770.87 824.869l-52.2 52.2c-4.7 4.7-1.9 12.8 4.7 13.6l179.4 21c5.1.6 9.5-3.7 8.9-8.9l-21-179.4c-.8-6.6-8.9-9.4-13.6-4.7l-52.4 52.4-256.2-256.2c-3.1-3.1-8.2-3.1-11.3 0l-42.4 42.4c-3.1 3.1-3.1 8.2 0 11.3l256.1 256.3Z", "transform": "matrix(1 0 0 -1 0 1024)" }, "child": [] }] })(props);
}
function AiOutlineEyeInvisible(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z" }, "child": [] }, { "tag": "path", "attr": { "d": "M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z" }, "child": [] }] })(props);
}
function AiOutlineEye(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" }, "child": [] }] })(props);
}
function AiOutlineFieldNumber(props) {
  return GenIcon({ "attr": { "t": "1569683604581", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M508 280h-63.3c-3.3 0-6 2.7-6 6v340.2H433L197.4 282.6c-1.1-1.6-3-2.6-4.9-2.6H126c-3.3 0-6 2.7-6 6v464c0 3.3 2.7 6 6 6h62.7c3.3 0 6-2.7 6-6V405.1h5.7l238.2 348.3c1.1 1.6 3 2.6 5 2.6H508c3.3 0 6-2.7 6-6V286c0-3.3-2.7-6-6-6zM886 693H582c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h304c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM733.8 630c52.9 0 95.2-17.2 126.2-51.7 29.4-32.9 44-75.8 44-128.8 0-53.1-14.6-96.5-44-129.3-30.9-34.8-73.2-52.2-126.2-52.2-53.7 0-95.9 17.5-126.3 52.8-29.2 33.1-43.4 75.9-43.4 128.7 0 52.4 14.3 95.2 43.5 128.3 30.6 34.7 73 52.2 126.2 52.2z m-71.5-263.7c16.9-20.6 40.3-30.9 71.4-30.9 31.5 0 54.8 9.6 71 29.1 16.4 20.3 24.9 48.6 24.9 84.9 0 36.3-8.4 64.1-24.8 83.9-16.5 19.4-40 29.2-71.1 29.2-31.2 0-55-10.3-71.4-30.4-16.3-20.1-24.5-47.3-24.5-82.6 0.1-35.8 8.2-63 24.5-83.2z" }, "child": [] }] })(props);
}
function AiOutlineFieldString(props) {
  return GenIcon({ "attr": { "t": "1569683607277", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M875.6 515.9c2.1 0.8 4.4-0.3 5.2-2.4 0.2-0.4 0.2-0.9 0.2-1.4v-58.3c0-1.8-1.1-3.3-2.8-3.8-6-1.8-17.2-3-27.2-3-32.9 0-61.7 16.7-73.5 41.2v-28.6c0-4.4-3.6-8-8-8H717c-4.4 0-8 3.6-8 8V729c0 4.4 3.6 8 8 8h54.8c4.4 0 8-3.6 8-8V572.7c0-36.2 26.1-60.2 65.1-60.2 10.4 0.1 26.6 1.8 30.7 3.4zM338.6 475.4l-54.7-12.6c-61.2-14.2-87.7-34.8-87.7-70.7 0-44.6 39.1-73.5 96.9-73.5 52.8 0 91.4 26.5 99.9 68.9h70C455.9 311.6 387.6 259 293.4 259c-103.3 0-171 55.5-171 139 0 68.6 38.6 109.5 122.2 128.5l61.6 14.3c63.6 14.9 91.6 37.1 91.6 75.1 0 44.1-43.5 75.2-102.5 75.2-60.6 0-104.5-27.2-112.8-70.5H111c7.2 79.9 75.6 130.4 179.1 130.4C402.3 751 471 695.2 471 605.3c0-70.2-38.6-108.5-132.4-129.9z" }, "child": [] }, { "tag": "path", "attr": { "d": "M877 729m-36 0a36 36 0 1 0 72 0 36 36 0 1 0-72 0Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M653 457.8h-51.4V396c0-4.4-3.6-8-8-8h-54.7c-4.4 0-8 3.6-8 8v61.8H495c-4.4 0-8 3.6-8 8v42.3c0 4.4 3.6 8 8 8h35.9v147.5c0 56.2 27.4 79.4 93.1 79.4 11.7 0 23.6-1.2 33.8-3.1 1.9-0.3 3.2-2 3.2-3.9v-49.3c0-2.2-1.8-4-4-4h-0.4c-4.9 0.5-6.2 0.6-8.3 0.8-4.1 0.3-7.8 0.5-12.6 0.5-24.1 0-34.1-10.3-34.1-35.6V516.1H653c4.4 0 8-3.6 8-8v-42.3c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineFieldTime(props) {
  return GenIcon({ "attr": { "t": "1569683618210", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M945 412H689c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h256c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM811 548H689c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h122c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM477.3 322.5H434c-6.2 0-11.2 5-11.2 11.2v248c0 3.6 1.7 6.9 4.6 9l148.9 108.6c5 3.6 12 2.6 15.6-2.4l25.7-35.1v-0.1c3.6-5 2.5-12-2.5-15.6l-126.7-91.6V333.7c0.1-6.2-5-11.2-11.1-11.2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M804.8 673.9H747c-5.6 0-10.9 2.9-13.9 7.7-12.7 20.1-27.5 38.7-44.5 55.7-29.3 29.3-63.4 52.3-101.3 68.3-39.3 16.6-81 25-124 25-43.1 0-84.8-8.4-124-25-37.9-16-72-39-101.3-68.3s-52.3-63.4-68.3-101.3c-16.6-39.2-25-80.9-25-124 0-43.1 8.4-84.7 25-124 16-37.9 39-72 68.3-101.3 29.3-29.3 63.4-52.3 101.3-68.3 39.2-16.6 81-25 124-25 43.1 0 84.8 8.4 124 25 37.9 16 72 39 101.3 68.3 17 17 31.8 35.6 44.5 55.7 3 4.8 8.3 7.7 13.9 7.7h57.8c6.9 0 11.3-7.2 8.2-13.3-65.2-129.7-197.4-214-345-215.7-216.1-2.7-395.6 174.2-396 390.1C71.6 727.5 246.9 903 463.2 903c149.5 0 283.9-84.6 349.8-215.8 3.1-6.1-1.4-13.3-8.2-13.3z" }, "child": [] }] })(props);
}
function AiOutlineFileAdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM544 472c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v108H372c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h108v108c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V644h108c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V472z" }, "child": [] }] })(props);
}
function AiOutlineFileSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M296 256c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm192 200v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8zm-48 396H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm104.1-115.6c1.8-34.5 16.2-66.8 40.8-91.4 26.2-26.2 62-41 99.1-41 37.4 0 72.6 14.6 99.1 41 3.2 3.2 6.3 6.6 9.2 10.1L769.2 673a8 8 0 0 0 3 14.1l93.3 22.5c5 1.2 9.8-2.6 9.9-7.7l.6-95.4a8 8 0 0 0-12.9-6.4l-20.3 15.8C805.4 569.6 748.1 540 684 540c-109.9 0-199.6 86.9-204 195.7-.2 4.5 3.5 8.3 8 8.3h48.1c4.3 0 7.8-3.3 8-7.6zM880 744h-48.1c-4.3 0-7.8 3.3-8 7.6-1.8 34.5-16.2 66.8-40.8 91.4-26.2 26.2-62 41-99.1 41-37.4 0-72.6-14.6-99.1-41-3.2-3.2-6.3-6.6-9.2-10.1l23.1-17.9a8 8 0 0 0-3-14.1l-93.3-22.5c-5-1.2-9.8 2.6-9.9 7.7l-.6 95.4a8 8 0 0 0 12.9 6.4l20.3-15.8C562.6 918.4 619.9 948 684 948c109.9 0 199.6-86.9 204-195.7.2-4.5-3.5-8.3-8-8.3z" }, "child": [] }] })(props);
}
function AiOutlineFileText(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" }, "child": [] }] })(props);
}
function AiOutlineFileZip(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M296 392h64v64h-64zm0 190v160h128V582h-64v-62h-64v62zm80 48v64h-32v-64h32zm-16-302h64v64h-64zm-64-64h64v64h-64zm64 192h64v64h-64zm0-256h64v64h-64zm494.6 88.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h64v64h64v-64h174v216a42 42 0 0 0 42 42h216v494z" }, "child": [] }] })(props);
}
function AiOutlineFile(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494z" }, "child": [] }] })(props);
}
function AiOutlineFilter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880.1 154H143.9c-24.5 0-39.8 26.7-27.5 48L349 597.4V838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V597.4L907.7 202c12.2-21.3-3.1-48-27.6-48zM603.4 798H420.6V642h182.9v156zm9.6-236.6l-9.5 16.6h-183l-9.5-16.6L212.7 226h598.6L613 561.4z" }, "child": [] }] })(props);
}
function AiOutlineFolderAdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M484 443.1V528h-84.5c-4.1 0-7.5 3.1-7.5 7v42c0 3.8 3.4 7 7.5 7H484v84.9c0 3.9 3.2 7.1 7 7.1h42c3.9 0 7-3.2 7-7.1V584h84.5c4.1 0 7.5-3.2 7.5-7v-42c0-3.9-3.4-7-7.5-7H540v-84.9c0-3.9-3.1-7.1-7-7.1h-42c-3.8 0-7 3.2-7 7.1zm396-144.7H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" }, "child": [] }] })(props);
}
function AiOutlineFolderOpen(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 0 0-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z" }, "child": [] }] })(props);
}
function AiOutlineFolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 298.4H521L403.7 186.2a8.15 8.15 0 0 0-5.5-2.2H144c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V330.4c0-17.7-14.3-32-32-32zM840 768H184V256h188.5l119.6 114.4H840V768z" }, "child": [] }] })(props);
}
function AiOutlineForm(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 0 0-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z" }, "child": [] }] })(props);
}
function AiOutlineFunction(props) {
  return GenIcon({ "attr": { "t": "1569683610100", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M841 370c3-3.3 2.7-8.3-0.6-11.3-1.5-1.3-3.4-2.1-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6c-2.9 3.4-7.9 3.8-11.3 0.9-0.9-0.8-1.6-1.7-2.1-2.8l-63.5-141.3c-1.3-2.9-4.1-4.7-7.3-4.7H380.7l0.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H284l-89 429.9c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4 0.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 0.9 0.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6c4.4 0 8-3.6 8-8 0-1.2-0.3-2.4-0.8-3.5l-95.2-198.9c-1.4-2.9-0.9-6.4 1.3-8.8L841 370z" }, "child": [] }] })(props);
}
function AiOutlineHdd(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-600 72h560v208H232V136zm560 480H232V408h560v208zm0 272H232V680h560v208zM496 208H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 544h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H312c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm328 244a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineHolder(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "path", "attr": { "d": "M300,276.497424 C317.32646,286.500861 338.67354,286.500861 356,276.497424 C373.326461,266.493987 384,248.006874 384,228 C384,207.993128 373.326461,189.506014 356,179.502578 C338.67354,169.499141 317.32646,169.499141 300,179.502578 C282.673539,189.506014 272,207.993128 272,228 C272,248.006874 282.673539,266.493987 300,276.497424 Z M300,560.497426 C317.32646,570.500863 338.67354,570.500863 356,560.497426 C373.326461,550.493989 384,532.006876 384,512.000002 C384,491.993129 373.326461,473.506016 356,463.502579 C338.67354,453.499142 317.32646,453.499142 300,463.502579 C282.673539,473.506016 272,491.993129 272,512.000002 C272,532.006876 282.673539,550.493989 300,560.497426 Z M640,228 C640,248.006874 650.673539,266.493987 668,276.497424 C685.32646,286.500861 706.67354,286.500861 724,276.497424 C741.326461,266.493987 752,248.006874 752,228 C752,207.993128 741.326461,189.506014 724,179.502578 C706.67354,169.499141 685.32646,169.499141 668,179.502578 C650.673539,189.506014 640,207.993128 640,228 L640,228 Z M640,512.000002 C640,532.006876 650.673539,550.493989 668,560.497426 C685.32646,570.500863 706.67354,570.500863 724,560.497426 C741.326461,550.493989 752,532.006876 752,512.000002 C752,491.993129 741.326461,473.506016 724,463.502579 C706.67354,453.499142 685.32646,453.499142 668,463.502579 C650.673539,473.506016 640,491.993129 640,512.000002 L640,512.000002 Z M300,844.497427 C317.32646,854.500864 338.67354,854.500864 356,844.497427 C373.326461,834.493991 384,816.006877 384,796.000003 C384,775.993131 373.326461,757.506018 356,747.502581 C338.67354,737.499144 317.32646,737.499144 300,747.502581 C282.673539,757.506018 272,775.993131 272,796.000003 C272,816.006877 282.673539,834.493991 300,844.497427 Z M640,796.000003 C640,816.006877 650.673539,834.493991 668,844.497427 C685.32646,854.500864 706.67354,854.500864 724,844.497427 C741.326461,834.493991 752,816.006877 752,796.000003 C752,775.993131 741.326461,757.506018 724,747.502581 C706.67354,737.499144 685.32646,737.499144 668,747.502581 C650.673539,757.506018 640,775.993131 640,796.000003 L640,796.000003 Z" }, "child": [] }] })(props);
}
function AiOutlineImport(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h360c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H184V184h656v320c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V144c0-17.7-14.3-32-32-32ZM653.3 599.4l52.2-52.2c4.7-4.7 1.9-12.8-4.7-13.6l-179.4-21c-5.1-.6-9.5 3.7-8.9 8.9l21 179.4c.8 6.6 8.9 9.4 13.6 4.7l52.4-52.4 256.2 256.2c3.1 3.1 8.2 3.1 11.3 0l42.4-42.4c3.1-3.1 3.1-8.2 0-11.3L653.3 599.4Z", "transform": "matrix(1 0 0 -1 0 1024)" }, "child": [] }] })(props);
}
function AiOutlineInbox(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M885.2 446.3l-.2-.8-112.2-285.1c-5-16.1-19.9-27.2-36.8-27.2H281.2c-17 0-32.1 11.3-36.9 27.6L139.4 443l-.3.7-.2.8c-1.3 4.9-1.7 9.9-1 14.8-.1 1.6-.2 3.2-.2 4.8V830a60.9 60.9 0 0 0 60.8 60.8h627.2c33.5 0 60.8-27.3 60.9-60.8V464.1c0-1.3 0-2.6-.1-3.7.4-4.9 0-9.6-1.3-14.1zm-295.8-43l-.3 15.7c-.8 44.9-31.8 75.1-77.1 75.1-22.1 0-41.1-7.1-54.8-20.6S436 441.2 435.6 419l-.3-15.7H229.5L309 210h399.2l81.7 193.3H589.4zm-375 76.8h157.3c24.3 57.1 76 90.8 140.4 90.8 33.7 0 65-9.4 90.3-27.2 22.2-15.6 39.5-37.4 50.7-63.6h156.5V814H214.4V480.1z" }, "child": [] }] })(props);
}
function AiOutlineInteraction(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656zM304.8 524h50.7c3.7 0 6.8-3 6.8-6.8v-78.9c0-19.7 15.9-35.6 35.5-35.6h205.7v53.4c0 5.7 6.5 8.8 10.9 5.3l109.1-85.7c3.5-2.7 3.5-8 0-10.7l-109.1-85.7c-4.4-3.5-10.9-.3-10.9 5.3V338H397.7c-55.1 0-99.7 44.8-99.7 100.1V517c0 4 3 7 6.8 7zm-4.2 134.9l109.1 85.7c4.4 3.5 10.9.3 10.9-5.3v-53.4h205.7c55.1 0 99.7-44.8 99.7-100.1v-78.9c0-3.7-3-6.8-6.8-6.8h-50.7c-3.7 0-6.8 3-6.8 6.8v78.9c0 19.7-15.9 35.6-35.5 35.6H420.6V568c0-5.7-6.5-8.8-10.9-5.3l-109.1 85.7c-3.5 2.5-3.5 7.8 0 10.5z" }, "child": [] }] })(props);
}
function AiOutlineLeft(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" }, "child": [] }] })(props);
}
function AiOutlineLike(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 0 0-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 0 0 471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 0 1 6.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0 1 42.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z" }, "child": [] }] })(props);
}
function AiOutlineLink(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M574 665.4a8.03 8.03 0 0 0-11.3 0L446.5 781.6c-53.8 53.8-144.6 59.5-204 0-59.5-59.5-53.8-150.2 0-204l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3l-39.8-39.8a8.03 8.03 0 0 0-11.3 0L191.4 526.5c-84.6 84.6-84.6 221.5 0 306s221.5 84.6 306 0l116.2-116.2c3.1-3.1 3.1-8.2 0-11.3L574 665.4zm258.6-474c-84.6-84.6-221.5-84.6-306 0L410.3 307.6a8.03 8.03 0 0 0 0 11.3l39.7 39.7c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c53.8-53.8 144.6-59.5 204 0 59.5 59.5 53.8 150.2 0 204L665.3 562.6a8.03 8.03 0 0 0 0 11.3l39.8 39.8c3.1 3.1 8.2 3.1 11.3 0l116.2-116.2c84.5-84.6 84.5-221.5 0-306.1zM610.1 372.3a8.03 8.03 0 0 0-11.3 0L372.3 598.7a8.03 8.03 0 0 0 0 11.3l39.6 39.6c3.1 3.1 8.2 3.1 11.3 0l226.4-226.4c3.1-3.1 3.1-8.2 0-11.3l-39.5-39.6z" }, "child": [] }] })(props);
}
function AiOutlineMinusCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M696 480H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h368c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineNodeIndex(props) {
  return GenIcon({ "attr": { "t": "1569683635191", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M843.5 737.4c-12.4-75.2-79.2-129.1-155.3-125.4S550.9 676 546 752c-153.5-4.8-208-40.7-199.1-113.7 3.3-27.3 19.8-41.9 50.1-49 18.4-4.3 38.8-4.9 57.3-3.2 1.7 0.2 3.5 0.3 5.2 0.5 11.3 2.7 22.8 5 34.3 6.8 34.1 5.6 68.8 8.4 101.8 6.6 92.8-5 156-45.9 159.2-132.7 3.1-84.1-54.7-143.7-147.9-183.6-29.9-12.8-61.6-22.7-93.3-30.2-14.3-3.4-26.3-5.7-35.2-7.2-7.9-75.9-71.5-133.8-147.8-134.4-76.3-0.6-140.9 56.1-150.1 131.9s40 146.3 114.2 163.9c74.2 17.6 149.9-23.3 175.7-95.1 9.4 1.7 18.7 3.6 28 5.8 28.2 6.6 56.4 15.4 82.4 26.6 70.7 30.2 109.3 70.1 107.5 119.9-1.6 44.6-33.6 65.2-96.2 68.6-27.5 1.5-57.6-0.9-87.3-5.8-8.3-1.4-15.9-2.8-22.6-4.3-3.9-0.8-6.6-1.5-7.8-1.8l-3.1-0.6c-2.2-0.3-5.9-0.8-10.7-1.3-25-2.3-52.1-1.5-78.5 4.6-55.2 12.9-93.9 47.2-101.1 105.8-15.7 126.2 78.6 184.7 276 188.9 29.1 70.4 106.4 107.9 179.6 87 73.3-20.9 119.3-93.4 106.9-168.6zM329.1 345.2c-46 0-83.3-37.3-83.3-83.3s37.3-83.3 83.3-83.3 83.3 37.3 83.3 83.3-37.3 83.3-83.3 83.3zM695.6 845c-46 0-83.3-37.3-83.3-83.3s37.3-83.3 83.3-83.3 83.3 37.3 83.3 83.3-37.3 83.3-83.3 83.3z" }, "child": [] }] })(props);
}
function AiOutlineNumber(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M872 394c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H400V152c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v166H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v236H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h168v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h228v166c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V706h164c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8H708V394h164zM628 630H400V394h228v236z" }, "child": [] }] })(props);
}
function AiOutlineOrderedList(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M920 760H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0-568H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H336c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM216 712H100c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h72.4v20.5h-35.7c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h35.7V838H100c-2.2 0-4 1.8-4 4v34c0 2.2 1.8 4 4 4h116c2.2 0 4-1.8 4-4V716c0-2.2-1.8-4-4-4zM100 188h38v120c0 2.2 1.8 4 4 4h40c2.2 0 4-1.8 4-4V152c0-4.4-3.6-8-8-8h-78c-2.2 0-4 1.8-4 4v36c0 2.2 1.8 4 4 4zm116 240H100c-2.2 0-4 1.8-4 4v36c0 2.2 1.8 4 4 4h68.4l-70.3 77.7a8.3 8.3 0 0 0-2.1 5.4V592c0 2.2 1.8 4 4 4h116c2.2 0 4-1.8 4-4v-36c0-2.2-1.8-4-4-4h-68.4l70.3-77.7a8.3 8.3 0 0 0 2.1-5.4V432c0-2.2-1.8-4-4-4z" }, "child": [] }] })(props);
}
function AiOutlinePause(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M304 176h80v672h-80zm408 0h-64c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlinePicture(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 1 0 0-176 88 88 0 0 0 0 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z" }, "child": [] }] })(props);
}
function AiOutlinePlayCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }, { "tag": "path", "attr": { "d": "M719.4 499.1l-296.1-215A15.9 15.9 0 0 0 398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 0 0 0-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z" }, "child": [] }] })(props);
}
function AiOutlinePlaySquare(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M442.3 677.6l199.4-156.7a11.3 11.3 0 0 0 0-17.7L442.3 346.4c-7.4-5.8-18.3-.6-18.3 8.8v313.5c0 9.4 10.9 14.7 18.3 8.9z" }, "child": [] }, { "tag": "path", "attr": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z" }, "child": [] }] })(props);
}
function AiOutlinePlusCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlinePlus(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z" }, "child": [] }] })(props);
}
function AiOutlineProduct(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024", "fill": "currentColor", "fillRule": "evenodd" }, "child": [{ "tag": "path", "attr": { "d": "M320 30.02c8.837 0 16 7.163 16 16v304c0 8.836-7.163 16-16 16H16c-8.837 0-16-7.164-16-16v-304c0-8.837 7.163-16 16-16zm-52 68H68v200h200zm493.333 87.686c6.248 6.248 6.248 16.379 0 22.627l-181.02 181.02c-6.248 6.248-16.378 6.248-22.627 0l-181.019-181.02c-6.248-6.248-6.248-16.379 0-22.627l181.02-181.02c6.248-6.248 16.378-6.248 22.627 0zm-84.853 11.313L569 89.54 461.52 197.02 569 304.5zM320 430.02c8.837 0 16 7.164 16 16v304c0 8.837-7.163 16-16 16H16c-8.837 0-16-7.163-16-16v-304c0-8.836 7.163-16 16-16zm-52 68H68v200h200zm452-68c8.837 0 16 7.164 16 16v304c0 8.837-7.163 16-16 16H416c-8.837 0-16-7.163-16-16v-304c0-8.836 7.163-16 16-16zm-52 68H468v200h200z", "transform": "translate(144 113.98)" }, "child": [] }] })(props);
}
function AiOutlinePushpin(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M878.3 392.1L631.9 145.7c-6.5-6.5-15-9.7-23.5-9.7s-17 3.2-23.5 9.7L423.8 306.9c-12.2-1.4-24.5-2-36.8-2-73.2 0-146.4 24.1-206.5 72.3a33.23 33.23 0 0 0-2.7 49.4l181.7 181.7-215.4 215.2a15.8 15.8 0 0 0-4.6 9.8l-3.4 37.2c-.9 9.4 6.6 17.4 15.9 17.4.5 0 1 0 1.5-.1l37.2-3.4c3.7-.3 7.2-2 9.8-4.6l215.4-215.4 181.7 181.7c6.5 6.5 15 9.7 23.5 9.7 9.7 0 19.3-4.2 25.9-12.4 56.3-70.3 79.7-158.3 70.2-243.4l161.1-161.1c12.9-12.8 12.9-33.8 0-46.8zM666.2 549.3l-24.5 24.5 3.8 34.4a259.92 259.92 0 0 1-30.4 153.9L262 408.8c12.9-7.1 26.3-13.1 40.3-17.9 27.2-9.4 55.7-14.1 84.7-14.1 9.6 0 19.3.5 28.9 1.6l34.4 3.8 24.5-24.5L608.5 224 800 415.5 666.2 549.3z" }, "child": [] }] })(props);
}
function AiOutlineQuestionCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }, { "tag": "path", "attr": { "d": "M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0 1 30.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1 0 80 0 40 40 0 1 0-80 0z" }, "child": [] }] })(props);
}
function AiOutlineRadarChart(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M926.8 397.1l-396-288a31.81 31.81 0 0 0-37.6 0l-396 288a31.99 31.99 0 0 0-11.6 35.8l151.3 466a32 32 0 0 0 30.4 22.1h489.5c13.9 0 26.1-8.9 30.4-22.1l151.3-466c4.2-13.2-.5-27.6-11.7-35.8zM838.6 417l-98.5 32-200-144.7V199.9L838.6 417zM466 567.2l-89.1 122.3-55.2-169.2L466 567.2zm-116.3-96.8L484 373.3v140.8l-134.3-43.7zM512 599.2l93.9 128.9H418.1L512 599.2zm28.1-225.9l134.2 97.1L540.1 514V373.3zM558 567.2l144.3-46.9-55.2 169.2L558 567.2zm-74-367.3v104.4L283.9 449l-98.5-32L484 199.9zM169.3 470.8l86.5 28.1 80.4 246.4-53.8 73.9-113.1-348.4zM327.1 853l50.3-69h269.3l50.3 69H327.1zm414.5-33.8l-53.8-73.9 80.4-246.4 86.5-28.1-113.1 348.4z" }, "child": [] }] })(props);
}
function AiOutlineRedo(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 0 0-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z" }, "child": [] }] })(props);
}
function AiOutlineRightCircle(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M666.7 505.5l-246-178A8 8 0 0 0 408 334v46.9c0 10.2 4.9 19.9 13.2 25.9L566.6 512 421.2 617.2c-8.3 6-13.2 15.6-13.2 25.9V690c0 6.5 7.4 10.3 12.7 6.5l246-178c4.4-3.2 4.4-9.8 0-13z" }, "child": [] }, { "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" }, "child": [] }] })(props);
}
function AiOutlineRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z" }, "child": [] }] })(props);
}
function AiOutlineRise(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M917 211.1l-199.2 24c-6.6.8-9.4 8.9-4.7 13.6l59.3 59.3-226 226-101.8-101.7c-6.3-6.3-16.4-6.2-22.6 0L100.3 754.1a8.03 8.03 0 0 0 0 11.3l45 45.2c3.1 3.1 8.2 3.1 11.3 0L433.3 534 535 635.7c6.3 6.2 16.4 6.2 22.6 0L829 364.5l59.3 59.3a8.01 8.01 0 0 0 13.6-4.7l24-199.2c.7-5.1-3.7-9.5-8.9-8.8z" }, "child": [] }] })(props);
}
function AiOutlineSearch(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0 0 11.6 0l43.6-43.5a8.2 8.2 0 0 0 0-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" }, "child": [] }] })(props);
}
function AiOutlineSetting(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 0 0 9.3-35.2l-.9-2.6a443.74 443.74 0 0 0-79.7-137.9l-1.8-2.1a32.12 32.12 0 0 0-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 0 0-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 0 0-25.8 25.7l-15.8 85.4a351.86 351.86 0 0 0-99 57.4l-81.9-29.1a32 32 0 0 0-35.1 9.5l-1.8 2.1a446.02 446.02 0 0 0-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 0 0-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0 0 35.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0 0 25.8 25.7l2.7.5a449.4 449.4 0 0 0 159 0l2.7-.5a32.05 32.05 0 0 0 25.8-25.7l15.7-85a350 350 0 0 0 99.7-57.6l81.3 28.9a32 32 0 0 0 35.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 0 1-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 0 1-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 0 1 512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 0 1 400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 0 1 624 502c0 29.9-11.7 58-32.8 79.2z" }, "child": [] }] })(props);
}
function AiOutlineSisternode(props) {
  return GenIcon({ "attr": { "t": "1569683586275", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M672 432c-120.3 0-219.9 88.5-237.3 204H320c-15.5 0-28-12.5-28-28V244h291c14.2 35.2 48.7 60 89 60 53 0 96-43 96-96s-43-96-96-96c-40.3 0-74.8 24.8-89 60H112v72h108v364c0 55.2 44.8 100 100 100h114.7c17.4 115.5 117 204 237.3 204 132.5 0 240-107.5 240-240S804.5 432 672 432z m128 266c0 4.4-3.6 8-8 8h-86v86c0 4.4-3.6 8-8 8h-52c-4.4 0-8-3.6-8-8v-86h-86c-4.4 0-8-3.6-8-8v-52c0-4.4 3.6-8 8-8h86v-86c0-4.4 3.6-8 8-8h52c4.4 0 8 3.6 8 8v86h86c4.4 0 8 3.6 8 8v52z" }, "child": [] }] })(props);
}
function AiOutlineSnippets(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M832 112H724V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H500V72c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v40H320c-17.7 0-32 14.3-32 32v120h-96c-17.7 0-32 14.3-32 32v632c0 17.7 14.3 32 32 32h512c17.7 0 32-14.3 32-32v-96h96c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zM664 888H232V336h218v174c0 22.1 17.9 40 40 40h174v338zm0-402H514V336h.2L664 485.8v.2zm128 274h-56V456L544 264H360v-80h68v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h152v32c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-32h68v576z" }, "child": [] }] })(props);
}
function AiOutlineStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 0 0 .6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0 0 46.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" }, "child": [] }] })(props);
}
function AiOutlineStop(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z" }, "child": [] }] })(props);
}
function AiOutlineSwap(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M847.9 592H152c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h605.2L612.9 851c-4.1 5.2-.4 13 6.3 13h72.5c4.9 0 9.5-2.2 12.6-6.1l168.8-214.1c16.5-21 1.6-51.8-25.2-51.8zM872 356H266.8l144.3-183c4.1-5.2.4-13-6.3-13h-72.5c-4.9 0-9.5 2.2-12.6 6.1L150.9 380.2c-16.5 21-1.6 51.8 25.1 51.8h696c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z" }, "child": [] }] })(props);
}
function AiOutlineSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M168 504.2c1-43.7 10-86.1 26.9-126 17.3-41 42.1-77.7 73.7-109.4S337 212.3 378 195c42.4-17.9 87.4-27 133.9-27s91.5 9.1 133.8 27A341.5 341.5 0 0 1 755 268.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 0 0 3 14.1l175.7 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c0-6.7-7.7-10.5-12.9-6.3l-56.4 44.1C765.8 155.1 646.2 92 511.8 92 282.7 92 96.3 275.6 92 503.8a8 8 0 0 0 8 8.2h60c4.4 0 7.9-3.5 8-7.8zm756 7.8h-60c-4.4 0-7.9 3.5-8 7.8-1 43.7-10 86.1-26.9 126-17.3 41-42.1 77.8-73.7 109.4A342.45 342.45 0 0 1 512.1 856a342.24 342.24 0 0 1-243.2-100.8c-9.9-9.9-19.2-20.4-27.8-31.4l60.2-47a8 8 0 0 0-3-14.1l-175.7-43c-5-1.2-9.9 2.6-9.9 7.7l-.7 181c0 6.7 7.7 10.5 12.9 6.3l56.4-44.1C258.2 868.9 377.8 932 512.2 932c229.2 0 415.5-183.7 419.8-411.8a8 8 0 0 0-8-8.2z" }, "child": [] }] })(props);
}
function AiOutlineTag(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M938 458.8l-29.6-312.6c-1.5-16.2-14.4-29-30.6-30.6L565.2 86h-.4c-3.2 0-5.7 1-7.6 2.9L88.9 557.2a9.96 9.96 0 0 0 0 14.1l363.8 363.8c1.9 1.9 4.4 2.9 7.1 2.9s5.2-1 7.1-2.9l468.3-468.3c2-2.1 3-5 2.8-8zM459.7 834.7L189.3 564.3 589 164.6 836 188l23.4 247-399.7 399.7zM680 256c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm0 120c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z" }, "child": [] }] })(props);
}
function AiOutlineTags(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 0 0 0 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1 0 67.88-67.89 48 48 0 1 0-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 0 0-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 0 0-11.3 0l-39.6 39.5a8.03 8.03 0 0 0 0 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z" }, "child": [] }] })(props);
}
function AiOutlineThunderbolt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7zM378.2 732.5l60.3-241H281.1l189.6-327.4h224.6L487 427.4h211L378.2 732.5z" }, "child": [] }] })(props);
}
function AiOutlineTool(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M876.6 239.5c-.5-.9-1.2-1.8-2-2.5-5-5-13.1-5-18.1 0L684.2 409.3l-67.9-67.9L788.7 169c.8-.8 1.4-1.6 2-2.5 3.6-6.1 1.6-13.9-4.5-17.5-98.2-58-226.8-44.7-311.3 39.7-67 67-89.2 162-66.5 247.4l-293 293c-3 3-2.8 7.9.3 11l169.7 169.7c3.1 3.1 8.1 3.3 11 .3l292.9-292.9c85.5 22.8 180.5.7 247.6-66.4 84.4-84.5 97.7-213.1 39.7-311.3zM786 499.8c-58.1 58.1-145.3 69.3-214.6 33.6l-8.8 8.8-.1-.1-274 274.1-79.2-79.2 230.1-230.1s0 .1.1.1l52.8-52.8c-35.7-69.3-24.5-156.5 33.6-214.6a184.2 184.2 0 0 1 144-53.5L537 318.9a32.05 32.05 0 0 0 0 45.3l124.5 124.5a32.05 32.05 0 0 0 45.3 0l132.8-132.8c3.7 51.8-14.4 104.8-53.6 143.9z" }, "child": [] }] })(props);
}
function AiOutlineUndo(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 0 0-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 0 1-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 0 1-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 0 0-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z" }, "child": [] }] })(props);
}
function AiOutlineUngroup(props) {
  return GenIcon({ "attr": { "t": "1569683823033", "viewBox": "0 0 1024 1024", "version": "1.1" }, "child": [{ "tag": "defs", "attr": {}, "child": [] }, { "tag": "path", "attr": { "d": "M736 550H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16h448c8.8 0 16-7.2 16-16V566c0-8.8-7.2-16-16-16z m-56 136H344v-64h336v64zM888 816c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zM736 266H288c-8.8 0-16 7.2-16 16v176c0 8.8 7.2 16 16 16h448c8.8 0 16-7.2 16-16V282c0-8.8-7.2-16-16-16z m-56 136H344v-64h336v64zM888 208c39.8 0 72-32.2 72-72s-32.2-72-72-72-72 32.2-72 72 32.2 72 72 72z m0-96c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zM136 64c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24zM136 816c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z m0 96c-13.3 0-24-10.7-24-24s10.7-24 24-24 24 10.7 24 24-10.7 24-24 24z" }, "child": [] }] })(props);
}
function AiOutlineUnorderedList(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z" }, "child": [] }] })(props);
}
function AiOutlineWarning(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 1024 1024" }, "child": [{ "tag": "path", "attr": { "d": "M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8zm475.7 440l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z" }, "child": [] }] })(props);
}
function TbChevronLeft(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M15 6l-6 6l6 6" }, "child": [] }] })(props);
}
function TbChevronRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9 6l6 6l-6 6" }, "child": [] }] })(props);
}
function TbColumns1(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M5 3m0 1a1 1 0 0 1 1 -1h12a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-12a1 1 0 0 1 -1 -1z" }, "child": [] }] })(props);
}
function TbColumns2(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm9 -1v18" }, "child": [] }] })(props);
}
function TbColumns3(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 3m0 1a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1zm6 -1v18m6 -18v18" }, "child": [] }] })(props);
}
function TbDatabase(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 6v6a8 3 0 0 0 16 0v-6" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 12v6a8 3 0 0 0 16 0v-6" }, "child": [] }] })(props);
}
function TbExternalLink(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6" }, "child": [] }, { "tag": "path", "attr": { "d": "M11 13l9 -9" }, "child": [] }, { "tag": "path", "attr": { "d": "M15 4h5v5" }, "child": [] }] })(props);
}
function TbFilterPlus(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M12 20l-3 1v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v3" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 19h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M19 16v6" }, "child": [] }] })(props);
}
function TbFilterStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M11.042 20.32l-2.042 .68v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414" }, "child": [] }, { "tag": "path", "attr": { "d": "M17.8 20.817l-2.172 1.138a.392 .392 0 0 1 -.568 -.41l.415 -2.411l-1.757 -1.707a.389 .389 0 0 1 .217 -.665l2.428 -.352l1.086 -2.193a.392 .392 0 0 1 .702 0l1.086 2.193l2.428 .352a.39 .39 0 0 1 .217 .665l-1.757 1.707l.414 2.41a.39 .39 0 0 1 -.567 .411l-2.172 -1.138z" }, "child": [] }] })(props);
}
function TbFilter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227z" }, "child": [] }] })(props);
}
function TbNumber123(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 10l2 -2v8" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 8h3a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h3" }, "child": [] }, { "tag": "path", "attr": { "d": "M17 8h2.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-1.5h1.5a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1 -1.5 1.5h-2.5" }, "child": [] }] })(props);
}
function TbSectionSign(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9.172 19a3 3 0 1 0 2.828 -4" }, "child": [] }, { "tag": "path", "attr": { "d": "M14.83 5a3 3 0 1 0 -2.83 4" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 12m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0" }, "child": [] }] })(props);
}
function TbSelect(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 3m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 11l3 3l3 -3" }, "child": [] }] })(props);
}
function TbSwitch2(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M3 17h5l1.67 -2.386m3.66 -5.227l1.67 -2.387h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M18 4l3 3l-3 3" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 7h5l7 10h6" }, "child": [] }, { "tag": "path", "attr": { "d": "M18 20l3 -3l-3 -3" }, "child": [] }] })(props);
}
function TbTemplate(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 4m0 1a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 12l6 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 16l6 0" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 20l6 0" }, "child": [] }] })(props);
}
function TbToolsKitchen(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M4 3h8l-1 9h-6z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 18h2v3h-2z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 3v12h-5c-.023 -3.681 .184 -7.406 5 -12z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20 15v6h-1v-3" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 12l0 6" }, "child": [] }] })(props);
}
/*!
 * @kurkle/color v0.3.4
 * https://github.com/kurkle/color#readme
 * (c) 2024 Jukka Kurkela
 * Released under the MIT License
 */
function round$1(v2) {
  return v2 + 0.5 | 0;
}
const lim = (v2, l2, h3) => Math.max(Math.min(v2, h3), l2);
function p2b(v2) {
  return lim(round$1(v2 * 2.55), 0, 255);
}
function n2b(v2) {
  return lim(round$1(v2 * 255), 0, 255);
}
function b2n(v2) {
  return lim(round$1(v2 / 2.55) / 100, 0, 1);
}
function n2p(v2) {
  return lim(round$1(v2 * 100), 0, 100);
}
const map$1 = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, A: 10, B: 11, C: 12, D: 13, E: 14, F: 15, a: 10, b: 11, c: 12, d: 13, e: 14, f: 15 };
const hex2 = [..."0123456789ABCDEF"];
const h1 = (b2) => hex2[b2 & 15];
const h2 = (b2) => hex2[(b2 & 240) >> 4] + hex2[b2 & 15];
const eq$1 = (b2) => (b2 & 240) >> 4 === (b2 & 15);
const isShort = (v2) => eq$1(v2.r) && eq$1(v2.g) && eq$1(v2.b) && eq$1(v2.a);
function hexParse(str) {
  var len = str.length;
  var ret;
  if (str[0] === "#") {
    if (len === 4 || len === 5) {
      ret = {
        r: 255 & map$1[str[1]] * 17,
        g: 255 & map$1[str[2]] * 17,
        b: 255 & map$1[str[3]] * 17,
        a: len === 5 ? map$1[str[4]] * 17 : 255
      };
    } else if (len === 7 || len === 9) {
      ret = {
        r: map$1[str[1]] << 4 | map$1[str[2]],
        g: map$1[str[3]] << 4 | map$1[str[4]],
        b: map$1[str[5]] << 4 | map$1[str[6]],
        a: len === 9 ? map$1[str[7]] << 4 | map$1[str[8]] : 255
      };
    }
  }
  return ret;
}
const alpha = (a2, f2) => a2 < 255 ? f2(a2) : "";
function hexString(v2) {
  var f2 = isShort(v2) ? h1 : h2;
  return v2 ? "#" + f2(v2.r) + f2(v2.g) + f2(v2.b) + alpha(v2.a, f2) : void 0;
}
const HUE_RE = /^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;
function hsl2rgbn(h3, s2, l2) {
  const a2 = s2 * Math.min(l2, 1 - l2);
  const f2 = (n2, k2 = (n2 + h3 / 30) % 12) => l2 - a2 * Math.max(Math.min(k2 - 3, 9 - k2, 1), -1);
  return [f2(0), f2(8), f2(4)];
}
function hsv2rgbn(h3, s2, v2) {
  const f2 = (n2, k2 = (n2 + h3 / 60) % 6) => v2 - v2 * s2 * Math.max(Math.min(k2, 4 - k2, 1), 0);
  return [f2(5), f2(3), f2(1)];
}
function hwb2rgbn(h3, w2, b2) {
  const rgb = hsl2rgbn(h3, 1, 0.5);
  let i2;
  if (w2 + b2 > 1) {
    i2 = 1 / (w2 + b2);
    w2 *= i2;
    b2 *= i2;
  }
  for (i2 = 0; i2 < 3; i2++) {
    rgb[i2] *= 1 - w2 - b2;
    rgb[i2] += w2;
  }
  return rgb;
}
function hueValue(r2, g2, b2, d2, max2) {
  if (r2 === max2) {
    return (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
  }
  if (g2 === max2) {
    return (b2 - r2) / d2 + 2;
  }
  return (r2 - g2) / d2 + 4;
}
function rgb2hsl(v2) {
  const range3 = 255;
  const r2 = v2.r / range3;
  const g2 = v2.g / range3;
  const b2 = v2.b / range3;
  const max2 = Math.max(r2, g2, b2);
  const min2 = Math.min(r2, g2, b2);
  const l2 = (max2 + min2) / 2;
  let h3, s2, d2;
  if (max2 !== min2) {
    d2 = max2 - min2;
    s2 = l2 > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
    h3 = hueValue(r2, g2, b2, d2, max2);
    h3 = h3 * 60 + 0.5;
  }
  return [h3 | 0, s2 || 0, l2];
}
function calln(f2, a2, b2, c2) {
  return (Array.isArray(a2) ? f2(a2[0], a2[1], a2[2]) : f2(a2, b2, c2)).map(n2b);
}
function hsl2rgb(h3, s2, l2) {
  return calln(hsl2rgbn, h3, s2, l2);
}
function hwb2rgb(h3, w2, b2) {
  return calln(hwb2rgbn, h3, w2, b2);
}
function hsv2rgb(h3, s2, v2) {
  return calln(hsv2rgbn, h3, s2, v2);
}
function hue(h3) {
  return (h3 % 360 + 360) % 360;
}
function hueParse(str) {
  const m2 = HUE_RE.exec(str);
  let a2 = 255;
  let v2;
  if (!m2) {
    return;
  }
  if (m2[5] !== v2) {
    a2 = m2[6] ? p2b(+m2[5]) : n2b(+m2[5]);
  }
  const h3 = hue(+m2[2]);
  const p1 = +m2[3] / 100;
  const p2 = +m2[4] / 100;
  if (m2[1] === "hwb") {
    v2 = hwb2rgb(h3, p1, p2);
  } else if (m2[1] === "hsv") {
    v2 = hsv2rgb(h3, p1, p2);
  } else {
    v2 = hsl2rgb(h3, p1, p2);
  }
  return {
    r: v2[0],
    g: v2[1],
    b: v2[2],
    a: a2
  };
}
function rotate(v2, deg) {
  var h3 = rgb2hsl(v2);
  h3[0] = hue(h3[0] + deg);
  h3 = hsl2rgb(h3);
  v2.r = h3[0];
  v2.g = h3[1];
  v2.b = h3[2];
}
function hslString(v2) {
  if (!v2) {
    return;
  }
  const a2 = rgb2hsl(v2);
  const h3 = a2[0];
  const s2 = n2p(a2[1]);
  const l2 = n2p(a2[2]);
  return v2.a < 255 ? `hsla(${h3}, ${s2}%, ${l2}%, ${b2n(v2.a)})` : `hsl(${h3}, ${s2}%, ${l2}%)`;
}
const map$2 = {
  x: "dark",
  Z: "light",
  Y: "re",
  X: "blu",
  W: "gr",
  V: "medium",
  U: "slate",
  A: "ee",
  T: "ol",
  S: "or",
  B: "ra",
  C: "lateg",
  D: "ights",
  R: "in",
  Q: "turquois",
  E: "hi",
  P: "ro",
  O: "al",
  N: "le",
  M: "de",
  L: "yello",
  F: "en",
  K: "ch",
  G: "arks",
  H: "ea",
  I: "ightg",
  J: "wh"
};
const names$1 = {
  OiceXe: "f0f8ff",
  antiquewEte: "faebd7",
  aqua: "ffff",
  aquamarRe: "7fffd4",
  azuY: "f0ffff",
  beige: "f5f5dc",
  bisque: "ffe4c4",
  black: "0",
  blanKedOmond: "ffebcd",
  Xe: "ff",
  XeviTet: "8a2be2",
  bPwn: "a52a2a",
  burlywood: "deb887",
  caMtXe: "5f9ea0",
  KartYuse: "7fff00",
  KocTate: "d2691e",
  cSO: "ff7f50",
  cSnflowerXe: "6495ed",
  cSnsilk: "fff8dc",
  crimson: "dc143c",
  cyan: "ffff",
  xXe: "8b",
  xcyan: "8b8b",
  xgTMnPd: "b8860b",
  xWay: "a9a9a9",
  xgYF: "6400",
  xgYy: "a9a9a9",
  xkhaki: "bdb76b",
  xmagFta: "8b008b",
  xTivegYF: "556b2f",
  xSange: "ff8c00",
  xScEd: "9932cc",
  xYd: "8b0000",
  xsOmon: "e9967a",
  xsHgYF: "8fbc8f",
  xUXe: "483d8b",
  xUWay: "2f4f4f",
  xUgYy: "2f4f4f",
  xQe: "ced1",
  xviTet: "9400d3",
  dAppRk: "ff1493",
  dApskyXe: "bfff",
  dimWay: "696969",
  dimgYy: "696969",
  dodgerXe: "1e90ff",
  fiYbrick: "b22222",
  flSOwEte: "fffaf0",
  foYstWAn: "228b22",
  fuKsia: "ff00ff",
  gaRsbSo: "dcdcdc",
  ghostwEte: "f8f8ff",
  gTd: "ffd700",
  gTMnPd: "daa520",
  Way: "808080",
  gYF: "8000",
  gYFLw: "adff2f",
  gYy: "808080",
  honeyMw: "f0fff0",
  hotpRk: "ff69b4",
  RdianYd: "cd5c5c",
  Rdigo: "4b0082",
  ivSy: "fffff0",
  khaki: "f0e68c",
  lavFMr: "e6e6fa",
  lavFMrXsh: "fff0f5",
  lawngYF: "7cfc00",
  NmoncEffon: "fffacd",
  ZXe: "add8e6",
  ZcSO: "f08080",
  Zcyan: "e0ffff",
  ZgTMnPdLw: "fafad2",
  ZWay: "d3d3d3",
  ZgYF: "90ee90",
  ZgYy: "d3d3d3",
  ZpRk: "ffb6c1",
  ZsOmon: "ffa07a",
  ZsHgYF: "20b2aa",
  ZskyXe: "87cefa",
  ZUWay: "778899",
  ZUgYy: "778899",
  ZstAlXe: "b0c4de",
  ZLw: "ffffe0",
  lime: "ff00",
  limegYF: "32cd32",
  lRF: "faf0e6",
  magFta: "ff00ff",
  maPon: "800000",
  VaquamarRe: "66cdaa",
  VXe: "cd",
  VScEd: "ba55d3",
  VpurpN: "9370db",
  VsHgYF: "3cb371",
  VUXe: "7b68ee",
  VsprRggYF: "fa9a",
  VQe: "48d1cc",
  VviTetYd: "c71585",
  midnightXe: "191970",
  mRtcYam: "f5fffa",
  mistyPse: "ffe4e1",
  moccasR: "ffe4b5",
  navajowEte: "ffdead",
  navy: "80",
  Tdlace: "fdf5e6",
  Tive: "808000",
  TivedBb: "6b8e23",
  Sange: "ffa500",
  SangeYd: "ff4500",
  ScEd: "da70d6",
  pOegTMnPd: "eee8aa",
  pOegYF: "98fb98",
  pOeQe: "afeeee",
  pOeviTetYd: "db7093",
  papayawEp: "ffefd5",
  pHKpuff: "ffdab9",
  peru: "cd853f",
  pRk: "ffc0cb",
  plum: "dda0dd",
  powMrXe: "b0e0e6",
  purpN: "800080",
  YbeccapurpN: "663399",
  Yd: "ff0000",
  Psybrown: "bc8f8f",
  PyOXe: "4169e1",
  saddNbPwn: "8b4513",
  sOmon: "fa8072",
  sandybPwn: "f4a460",
  sHgYF: "2e8b57",
  sHshell: "fff5ee",
  siFna: "a0522d",
  silver: "c0c0c0",
  skyXe: "87ceeb",
  UXe: "6a5acd",
  UWay: "708090",
  UgYy: "708090",
  snow: "fffafa",
  sprRggYF: "ff7f",
  stAlXe: "4682b4",
  tan: "d2b48c",
  teO: "8080",
  tEstN: "d8bfd8",
  tomato: "ff6347",
  Qe: "40e0d0",
  viTet: "ee82ee",
  JHt: "f5deb3",
  wEte: "ffffff",
  wEtesmoke: "f5f5f5",
  Lw: "ffff00",
  LwgYF: "9acd32"
};
function unpack() {
  const unpacked = {};
  const keys2 = Object.keys(names$1);
  const tkeys = Object.keys(map$2);
  let i2, j2, k2, ok2, nk2;
  for (i2 = 0; i2 < keys2.length; i2++) {
    ok2 = nk2 = keys2[i2];
    for (j2 = 0; j2 < tkeys.length; j2++) {
      k2 = tkeys[j2];
      nk2 = nk2.replace(k2, map$2[k2]);
    }
    k2 = parseInt(names$1[ok2], 16);
    unpacked[nk2] = [k2 >> 16 & 255, k2 >> 8 & 255, k2 & 255];
  }
  return unpacked;
}
let names;
function nameParse(str) {
  if (!names) {
    names = unpack();
    names.transparent = [0, 0, 0, 0];
  }
  const a2 = names[str.toLowerCase()];
  return a2 && {
    r: a2[0],
    g: a2[1],
    b: a2[2],
    a: a2.length === 4 ? a2[3] : 255
  };
}
const RGB_RE = /^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;
function rgbParse(str) {
  const m2 = RGB_RE.exec(str);
  let a2 = 255;
  let r2, g2, b2;
  if (!m2) {
    return;
  }
  if (m2[7] !== r2) {
    const v2 = +m2[7];
    a2 = m2[8] ? p2b(v2) : lim(v2 * 255, 0, 255);
  }
  r2 = +m2[1];
  g2 = +m2[3];
  b2 = +m2[5];
  r2 = 255 & (m2[2] ? p2b(r2) : lim(r2, 0, 255));
  g2 = 255 & (m2[4] ? p2b(g2) : lim(g2, 0, 255));
  b2 = 255 & (m2[6] ? p2b(b2) : lim(b2, 0, 255));
  return {
    r: r2,
    g: g2,
    b: b2,
    a: a2
  };
}
function rgbString(v2) {
  return v2 && (v2.a < 255 ? `rgba(${v2.r}, ${v2.g}, ${v2.b}, ${b2n(v2.a)})` : `rgb(${v2.r}, ${v2.g}, ${v2.b})`);
}
const to$1 = (v2) => v2 <= 31308e-7 ? v2 * 12.92 : Math.pow(v2, 1 / 2.4) * 1.055 - 0.055;
const from$1 = (v2) => v2 <= 0.04045 ? v2 / 12.92 : Math.pow((v2 + 0.055) / 1.055, 2.4);
function interpolate$1(rgb1, rgb2, t2) {
  const r2 = from$1(b2n(rgb1.r));
  const g2 = from$1(b2n(rgb1.g));
  const b2 = from$1(b2n(rgb1.b));
  return {
    r: n2b(to$1(r2 + t2 * (from$1(b2n(rgb2.r)) - r2))),
    g: n2b(to$1(g2 + t2 * (from$1(b2n(rgb2.g)) - g2))),
    b: n2b(to$1(b2 + t2 * (from$1(b2n(rgb2.b)) - b2))),
    a: rgb1.a + t2 * (rgb2.a - rgb1.a)
  };
}
function modHSL(v2, i2, ratio) {
  if (v2) {
    let tmp = rgb2hsl(v2);
    tmp[i2] = Math.max(0, Math.min(tmp[i2] + tmp[i2] * ratio, i2 === 0 ? 360 : 1));
    tmp = hsl2rgb(tmp);
    v2.r = tmp[0];
    v2.g = tmp[1];
    v2.b = tmp[2];
  }
}
function clone$3(v2, proto2) {
  return v2 ? Object.assign(proto2 || {}, v2) : v2;
}
function fromObject(input2) {
  var v2 = { r: 0, g: 0, b: 0, a: 255 };
  if (Array.isArray(input2)) {
    if (input2.length >= 3) {
      v2 = { r: input2[0], g: input2[1], b: input2[2], a: 255 };
      if (input2.length > 3) {
        v2.a = n2b(input2[3]);
      }
    }
  } else {
    v2 = clone$3(input2, { r: 0, g: 0, b: 0, a: 1 });
    v2.a = n2b(v2.a);
  }
  return v2;
}
function functionParse(str) {
  if (str.charAt(0) === "r") {
    return rgbParse(str);
  }
  return hueParse(str);
}
class Color {
  constructor(input2) {
    if (input2 instanceof Color) {
      return input2;
    }
    const type4 = typeof input2;
    let v2;
    if (type4 === "object") {
      v2 = fromObject(input2);
    } else if (type4 === "string") {
      v2 = hexParse(input2) || nameParse(input2) || functionParse(input2);
    }
    this._rgb = v2;
    this._valid = !!v2;
  }
  get valid() {
    return this._valid;
  }
  get rgb() {
    var v2 = clone$3(this._rgb);
    if (v2) {
      v2.a = b2n(v2.a);
    }
    return v2;
  }
  set rgb(obj) {
    this._rgb = fromObject(obj);
  }
  rgbString() {
    return this._valid ? rgbString(this._rgb) : void 0;
  }
  hexString() {
    return this._valid ? hexString(this._rgb) : void 0;
  }
  hslString() {
    return this._valid ? hslString(this._rgb) : void 0;
  }
  mix(color2, weight) {
    if (color2) {
      const c1 = this.rgb;
      const c2 = color2.rgb;
      let w2;
      const p2 = weight === w2 ? 0.5 : weight;
      const w3 = 2 * p2 - 1;
      const a2 = c1.a - c2.a;
      const w1 = ((w3 * a2 === -1 ? w3 : (w3 + a2) / (1 + w3 * a2)) + 1) / 2;
      w2 = 1 - w1;
      c1.r = 255 & w1 * c1.r + w2 * c2.r + 0.5;
      c1.g = 255 & w1 * c1.g + w2 * c2.g + 0.5;
      c1.b = 255 & w1 * c1.b + w2 * c2.b + 0.5;
      c1.a = p2 * c1.a + (1 - p2) * c2.a;
      this.rgb = c1;
    }
    return this;
  }
  interpolate(color2, t2) {
    if (color2) {
      this._rgb = interpolate$1(this._rgb, color2._rgb, t2);
    }
    return this;
  }
  clone() {
    return new Color(this.rgb);
  }
  alpha(a2) {
    this._rgb.a = n2b(a2);
    return this;
  }
  clearer(ratio) {
    const rgb = this._rgb;
    rgb.a *= 1 - ratio;
    return this;
  }
  greyscale() {
    const rgb = this._rgb;
    const val = round$1(rgb.r * 0.3 + rgb.g * 0.59 + rgb.b * 0.11);
    rgb.r = rgb.g = rgb.b = val;
    return this;
  }
  opaquer(ratio) {
    const rgb = this._rgb;
    rgb.a *= 1 + ratio;
    return this;
  }
  negate() {
    const v2 = this._rgb;
    v2.r = 255 - v2.r;
    v2.g = 255 - v2.g;
    v2.b = 255 - v2.b;
    return this;
  }
  lighten(ratio) {
    modHSL(this._rgb, 2, ratio);
    return this;
  }
  darken(ratio) {
    modHSL(this._rgb, 2, -ratio);
    return this;
  }
  saturate(ratio) {
    modHSL(this._rgb, 1, ratio);
    return this;
  }
  desaturate(ratio) {
    modHSL(this._rgb, 1, -ratio);
    return this;
  }
  rotate(deg) {
    rotate(this._rgb, deg);
    return this;
  }
}
/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */
function noop$4() {
}
const uid = /* @__PURE__ */ (() => {
  let id2 = 0;
  return () => id2++;
})();
function isNullOrUndef(value2) {
  return value2 === null || value2 === void 0;
}
function isArray$4(value2) {
  if (Array.isArray && Array.isArray(value2)) {
    return true;
  }
  const type4 = Object.prototype.toString.call(value2);
  if (type4.slice(0, 7) === "[object" && type4.slice(-6) === "Array]") {
    return true;
  }
  return false;
}
function isObject$3(value2) {
  return value2 !== null && Object.prototype.toString.call(value2) === "[object Object]";
}
function isNumberFinite(value2) {
  return (typeof value2 === "number" || value2 instanceof Number) && isFinite(+value2);
}
function finiteOrDefault(value2, defaultValue2) {
  return isNumberFinite(value2) ? value2 : defaultValue2;
}
function valueOrDefault(value2, defaultValue2) {
  return typeof value2 === "undefined" ? defaultValue2 : value2;
}
const toDimension = (value2, dimension) => typeof value2 === "string" && value2.endsWith("%") ? parseFloat(value2) / 100 * dimension : +value2;
function callback(fn, args, thisArg) {
  if (fn && typeof fn.call === "function") {
    return fn.apply(thisArg, args);
  }
}
function each(loopable3, fn, thisArg, reverse) {
  let i2, len, keys2;
  if (isArray$4(loopable3)) {
    len = loopable3.length;
    {
      for (i2 = 0; i2 < len; i2++) {
        fn.call(thisArg, loopable3[i2], i2);
      }
    }
  } else if (isObject$3(loopable3)) {
    keys2 = Object.keys(loopable3);
    len = keys2.length;
    for (i2 = 0; i2 < len; i2++) {
      fn.call(thisArg, loopable3[keys2[i2]], keys2[i2]);
    }
  }
}
function _elementsEqual(a0, a1) {
  let i2, ilen, v0, v1;
  if (!a0 || !a1 || a0.length !== a1.length) {
    return false;
  }
  for (i2 = 0, ilen = a0.length; i2 < ilen; ++i2) {
    v0 = a0[i2];
    v1 = a1[i2];
    if (v0.datasetIndex !== v1.datasetIndex || v0.index !== v1.index) {
      return false;
    }
  }
  return true;
}
function clone$2(source2) {
  if (isArray$4(source2)) {
    return source2.map(clone$2);
  }
  if (isObject$3(source2)) {
    const target = /* @__PURE__ */ Object.create(null);
    const keys2 = Object.keys(source2);
    const klen = keys2.length;
    let k2 = 0;
    for (; k2 < klen; ++k2) {
      target[keys2[k2]] = clone$2(source2[keys2[k2]]);
    }
    return target;
  }
  return source2;
}
function isValidKey(key) {
  return [
    "__proto__",
    "prototype",
    "constructor"
  ].indexOf(key) === -1;
}
function _merger(key, target, source2, options) {
  if (!isValidKey(key)) {
    return;
  }
  const tval = target[key];
  const sval = source2[key];
  if (isObject$3(tval) && isObject$3(sval)) {
    merge$2(tval, sval, options);
  } else {
    target[key] = clone$2(sval);
  }
}
function merge$2(target, source2, options) {
  const sources = isArray$4(source2) ? source2 : [
    source2
  ];
  const ilen = sources.length;
  if (!isObject$3(target)) {
    return target;
  }
  options = options || {};
  const merger = options.merger || _merger;
  let current;
  for (let i2 = 0; i2 < ilen; ++i2) {
    current = sources[i2];
    if (!isObject$3(current)) {
      continue;
    }
    const keys2 = Object.keys(current);
    for (let k2 = 0, klen = keys2.length; k2 < klen; ++k2) {
      merger(keys2[k2], target, current, options);
    }
  }
  return target;
}
function mergeIf(target, source2) {
  return merge$2(target, source2, {
    merger: _mergerIf
  });
}
function _mergerIf(key, target, source2) {
  if (!isValidKey(key)) {
    return;
  }
  const tval = target[key];
  const sval = source2[key];
  if (isObject$3(tval) && isObject$3(sval)) {
    mergeIf(tval, sval);
  } else if (!Object.prototype.hasOwnProperty.call(target, key)) {
    target[key] = clone$2(sval);
  }
}
const keyResolvers = {
  // Chart.helpers.core resolveObjectKey should resolve empty key to root object
  "": (v2) => v2,
  // default resolvers
  x: (o2) => o2.x,
  y: (o2) => o2.y
};
function _splitKey(key) {
  const parts = key.split(".");
  const keys2 = [];
  let tmp = "";
  for (const part of parts) {
    tmp += part;
    if (tmp.endsWith("\\")) {
      tmp = tmp.slice(0, -1) + ".";
    } else {
      keys2.push(tmp);
      tmp = "";
    }
  }
  return keys2;
}
function _getKeyResolver(key) {
  const keys2 = _splitKey(key);
  return (obj) => {
    for (const k2 of keys2) {
      if (k2 === "") {
        break;
      }
      obj = obj && obj[k2];
    }
    return obj;
  };
}
function resolveObjectKey(obj, key) {
  const resolver2 = keyResolvers[key] || (keyResolvers[key] = _getKeyResolver(key));
  return resolver2(obj);
}
function _capitalize(str) {
  return str.charAt(0).toUpperCase() + str.slice(1);
}
const defined = (value2) => typeof value2 !== "undefined";
const isFunction$3 = (value2) => typeof value2 === "function";
const setsEqual = (a2, b2) => {
  if (a2.size !== b2.size) {
    return false;
  }
  for (const item of a2) {
    if (!b2.has(item)) {
      return false;
    }
  }
  return true;
};
function _isClickEvent(e2) {
  return e2.type === "mouseup" || e2.type === "click" || e2.type === "contextmenu";
}
const PI = Math.PI;
const TAU = 2 * PI;
const PITAU = TAU + PI;
const INFINITY = Number.POSITIVE_INFINITY;
const RAD_PER_DEG = PI / 180;
const HALF_PI = PI / 2;
const QUARTER_PI = PI / 4;
const TWO_THIRDS_PI = PI * 2 / 3;
const log10 = Math.log10;
const sign$1 = Math.sign;
function almostEquals(x2, y2, epsilon) {
  return Math.abs(x2 - y2) < epsilon;
}
function niceNum(range3) {
  const roundedRange = Math.round(range3);
  range3 = almostEquals(range3, roundedRange, range3 / 1e3) ? roundedRange : range3;
  const niceRange = Math.pow(10, Math.floor(log10(range3)));
  const fraction = range3 / niceRange;
  const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 5 ? 5 : 10;
  return niceFraction * niceRange;
}
function _factorize(value2) {
  const result = [];
  const sqrt = Math.sqrt(value2);
  let i2;
  for (i2 = 1; i2 < sqrt; i2++) {
    if (value2 % i2 === 0) {
      result.push(i2);
      result.push(value2 / i2);
    }
  }
  if (sqrt === (sqrt | 0)) {
    result.push(sqrt);
  }
  result.sort((a2, b2) => a2 - b2).pop();
  return result;
}
function isNonPrimitive(n2) {
  return typeof n2 === "symbol" || typeof n2 === "object" && n2 !== null && !(Symbol.toPrimitive in n2 || "toString" in n2 || "valueOf" in n2);
}
function isNumber$2(n2) {
  return !isNonPrimitive(n2) && !isNaN(parseFloat(n2)) && isFinite(n2);
}
function almostWhole(x2, epsilon) {
  const rounded = Math.round(x2);
  return rounded - epsilon <= x2 && rounded + epsilon >= x2;
}
function _setMinAndMaxByKey(array4, target, property2) {
  let i2, ilen, value2;
  for (i2 = 0, ilen = array4.length; i2 < ilen; i2++) {
    value2 = array4[i2][property2];
    if (!isNaN(value2)) {
      target.min = Math.min(target.min, value2);
      target.max = Math.max(target.max, value2);
    }
  }
}
function toRadians(degrees2) {
  return degrees2 * (PI / 180);
}
function toDegrees(radians) {
  return radians * (180 / PI);
}
function _decimalPlaces(x2) {
  if (!isNumberFinite(x2)) {
    return;
  }
  let e2 = 1;
  let p2 = 0;
  while (Math.round(x2 * e2) / e2 !== x2) {
    e2 *= 10;
    p2++;
  }
  return p2;
}
function getAngleFromPoint(centrePoint, anglePoint) {
  const distanceFromXCenter = anglePoint.x - centrePoint.x;
  const distanceFromYCenter = anglePoint.y - centrePoint.y;
  const radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
  let angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
  if (angle < -0.5 * PI) {
    angle += TAU;
  }
  return {
    angle,
    distance: radialDistanceFromCenter
  };
}
function distanceBetweenPoints(pt1, pt2) {
  return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
}
function _angleDiff(a2, b2) {
  return (a2 - b2 + PITAU) % TAU - PI;
}
function _normalizeAngle(a2) {
  return (a2 % TAU + TAU) % TAU;
}
function _angleBetween(angle, start, end, sameAngleIsFullCircle) {
  const a2 = _normalizeAngle(angle);
  const s2 = _normalizeAngle(start);
  const e2 = _normalizeAngle(end);
  const angleToStart = _normalizeAngle(s2 - a2);
  const angleToEnd = _normalizeAngle(e2 - a2);
  const startToAngle = _normalizeAngle(a2 - s2);
  const endToAngle = _normalizeAngle(a2 - e2);
  return a2 === s2 || a2 === e2 || sameAngleIsFullCircle && s2 === e2 || angleToStart > angleToEnd && startToAngle < endToAngle;
}
function _limitValue(value2, min2, max2) {
  return Math.max(min2, Math.min(max2, value2));
}
function _int16Range(value2) {
  return _limitValue(value2, -32768, 32767);
}
function _isBetween(value2, start, end, epsilon = 1e-6) {
  return value2 >= Math.min(start, end) - epsilon && value2 <= Math.max(start, end) + epsilon;
}
function _lookup(table2, value2, cmp) {
  cmp = cmp || ((index2) => table2[index2] < value2);
  let hi2 = table2.length - 1;
  let lo = 0;
  let mid;
  while (hi2 - lo > 1) {
    mid = lo + hi2 >> 1;
    if (cmp(mid)) {
      lo = mid;
    } else {
      hi2 = mid;
    }
  }
  return {
    lo,
    hi: hi2
  };
}
const _lookupByKey = (table2, key, value2, last) => _lookup(table2, value2, last ? (index2) => {
  const ti2 = table2[index2][key];
  return ti2 < value2 || ti2 === value2 && table2[index2 + 1][key] === value2;
} : (index2) => table2[index2][key] < value2);
const _rlookupByKey = (table2, key, value2) => _lookup(table2, value2, (index2) => table2[index2][key] >= value2);
function _filterBetween(values, min2, max2) {
  let start = 0;
  let end = values.length;
  while (start < end && values[start] < min2) {
    start++;
  }
  while (end > start && values[end - 1] > max2) {
    end--;
  }
  return start > 0 || end < values.length ? values.slice(start, end) : values;
}
const arrayEvents = [
  "push",
  "pop",
  "shift",
  "splice",
  "unshift"
];
function listenArrayEvents(array4, listener) {
  if (array4._chartjs) {
    array4._chartjs.listeners.push(listener);
    return;
  }
  Object.defineProperty(array4, "_chartjs", {
    configurable: true,
    enumerable: false,
    value: {
      listeners: [
        listener
      ]
    }
  });
  arrayEvents.forEach((key) => {
    const method4 = "_onData" + _capitalize(key);
    const base = array4[key];
    Object.defineProperty(array4, key, {
      configurable: true,
      enumerable: false,
      value(...args) {
        const res = base.apply(this, args);
        array4._chartjs.listeners.forEach((object4) => {
          if (typeof object4[method4] === "function") {
            object4[method4](...args);
          }
        });
        return res;
      }
    });
  });
}
function unlistenArrayEvents(array4, listener) {
  const stub = array4._chartjs;
  if (!stub) {
    return;
  }
  const listeners = stub.listeners;
  const index2 = listeners.indexOf(listener);
  if (index2 !== -1) {
    listeners.splice(index2, 1);
  }
  if (listeners.length > 0) {
    return;
  }
  arrayEvents.forEach((key) => {
    delete array4[key];
  });
  delete array4._chartjs;
}
function _arrayUnique(items) {
  const set2 = new Set(items);
  if (set2.size === items.length) {
    return items;
  }
  return Array.from(set2);
}
const requestAnimFrame = function() {
  if (typeof window === "undefined") {
    return function(callback2) {
      return callback2();
    };
  }
  return window.requestAnimationFrame;
}();
function throttled(fn, thisArg) {
  let argsToUse = [];
  let ticking = false;
  return function(...args) {
    argsToUse = args;
    if (!ticking) {
      ticking = true;
      requestAnimFrame.call(window, () => {
        ticking = false;
        fn.apply(thisArg, argsToUse);
      });
    }
  };
}
function debounce$1(fn, delay2) {
  let timeout;
  return function(...args) {
    if (delay2) {
      clearTimeout(timeout);
      timeout = setTimeout(fn, delay2, args);
    } else {
      fn.apply(this, args);
    }
    return delay2;
  };
}
const _toLeftRightCenter = (align) => align === "start" ? "left" : align === "end" ? "right" : "center";
const _alignStartEnd = (align, start, end) => align === "start" ? start : align === "end" ? end : (start + end) / 2;
const _textX = (align, left2, right, rtl) => {
  const check = rtl ? "left" : "right";
  return align === check ? right : align === "center" ? (left2 + right) / 2 : left2;
};
function _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled) {
  const pointCount = points.length;
  let start = 0;
  let count = pointCount;
  if (meta._sorted) {
    const { iScale, vScale, _parsed } = meta;
    const spanGaps = meta.dataset ? meta.dataset.options ? meta.dataset.options.spanGaps : null : null;
    const axis = iScale.axis;
    const { min: min2, max: max2, minDefined, maxDefined } = iScale.getUserBounds();
    if (minDefined) {
      start = Math.min(
        // @ts-expect-error Need to type _parsed
        _lookupByKey(_parsed, axis, min2).lo,
        // @ts-expect-error Need to fix types on _lookupByKey
        animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min2)).lo
      );
      if (spanGaps) {
        const distanceToDefinedLo = _parsed.slice(0, start + 1).reverse().findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        start -= Math.max(0, distanceToDefinedLo);
      }
      start = _limitValue(start, 0, pointCount - 1);
    }
    if (maxDefined) {
      let end = Math.max(
        // @ts-expect-error Need to type _parsed
        _lookupByKey(_parsed, iScale.axis, max2, true).hi + 1,
        // @ts-expect-error Need to fix types on _lookupByKey
        animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max2), true).hi + 1
      );
      if (spanGaps) {
        const distanceToDefinedHi = _parsed.slice(end - 1).findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        end += Math.max(0, distanceToDefinedHi);
      }
      count = _limitValue(end, start, pointCount) - start;
    } else {
      count = pointCount - start;
    }
  }
  return {
    start,
    count
  };
}
function _scaleRangesChanged(meta) {
  const { xScale, yScale, _scaleRanges } = meta;
  const newRanges = {
    xmin: xScale.min,
    xmax: xScale.max,
    ymin: yScale.min,
    ymax: yScale.max
  };
  if (!_scaleRanges) {
    meta._scaleRanges = newRanges;
    return true;
  }
  const changed = _scaleRanges.xmin !== xScale.min || _scaleRanges.xmax !== xScale.max || _scaleRanges.ymin !== yScale.min || _scaleRanges.ymax !== yScale.max;
  Object.assign(_scaleRanges, newRanges);
  return changed;
}
const atEdge = (t2) => t2 === 0 || t2 === 1;
const elasticIn = (t2, s2, p2) => -(Math.pow(2, 10 * (t2 -= 1)) * Math.sin((t2 - s2) * TAU / p2));
const elasticOut = (t2, s2, p2) => Math.pow(2, -10 * t2) * Math.sin((t2 - s2) * TAU / p2) + 1;
const effects = {
  linear: (t2) => t2,
  easeInQuad: (t2) => t2 * t2,
  easeOutQuad: (t2) => -t2 * (t2 - 2),
  easeInOutQuad: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 : -0.5 * (--t2 * (t2 - 2) - 1),
  easeInCubic: (t2) => t2 * t2 * t2,
  easeOutCubic: (t2) => (t2 -= 1) * t2 * t2 + 1,
  easeInOutCubic: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 : 0.5 * ((t2 -= 2) * t2 * t2 + 2),
  easeInQuart: (t2) => t2 * t2 * t2 * t2,
  easeOutQuart: (t2) => -((t2 -= 1) * t2 * t2 * t2 - 1),
  easeInOutQuart: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 * t2 : -0.5 * ((t2 -= 2) * t2 * t2 * t2 - 2),
  easeInQuint: (t2) => t2 * t2 * t2 * t2 * t2,
  easeOutQuint: (t2) => (t2 -= 1) * t2 * t2 * t2 * t2 + 1,
  easeInOutQuint: (t2) => (t2 /= 0.5) < 1 ? 0.5 * t2 * t2 * t2 * t2 * t2 : 0.5 * ((t2 -= 2) * t2 * t2 * t2 * t2 + 2),
  easeInSine: (t2) => -Math.cos(t2 * HALF_PI) + 1,
  easeOutSine: (t2) => Math.sin(t2 * HALF_PI),
  easeInOutSine: (t2) => -0.5 * (Math.cos(PI * t2) - 1),
  easeInExpo: (t2) => t2 === 0 ? 0 : Math.pow(2, 10 * (t2 - 1)),
  easeOutExpo: (t2) => t2 === 1 ? 1 : -Math.pow(2, -10 * t2) + 1,
  easeInOutExpo: (t2) => atEdge(t2) ? t2 : t2 < 0.5 ? 0.5 * Math.pow(2, 10 * (t2 * 2 - 1)) : 0.5 * (-Math.pow(2, -10 * (t2 * 2 - 1)) + 2),
  easeInCirc: (t2) => t2 >= 1 ? t2 : -(Math.sqrt(1 - t2 * t2) - 1),
  easeOutCirc: (t2) => Math.sqrt(1 - (t2 -= 1) * t2),
  easeInOutCirc: (t2) => (t2 /= 0.5) < 1 ? -0.5 * (Math.sqrt(1 - t2 * t2) - 1) : 0.5 * (Math.sqrt(1 - (t2 -= 2) * t2) + 1),
  easeInElastic: (t2) => atEdge(t2) ? t2 : elasticIn(t2, 0.075, 0.3),
  easeOutElastic: (t2) => atEdge(t2) ? t2 : elasticOut(t2, 0.075, 0.3),
  easeInOutElastic(t2) {
    const s2 = 0.1125;
    const p2 = 0.45;
    return atEdge(t2) ? t2 : t2 < 0.5 ? 0.5 * elasticIn(t2 * 2, s2, p2) : 0.5 + 0.5 * elasticOut(t2 * 2 - 1, s2, p2);
  },
  easeInBack(t2) {
    const s2 = 1.70158;
    return t2 * t2 * ((s2 + 1) * t2 - s2);
  },
  easeOutBack(t2) {
    const s2 = 1.70158;
    return (t2 -= 1) * t2 * ((s2 + 1) * t2 + s2) + 1;
  },
  easeInOutBack(t2) {
    let s2 = 1.70158;
    if ((t2 /= 0.5) < 1) {
      return 0.5 * (t2 * t2 * (((s2 *= 1.525) + 1) * t2 - s2));
    }
    return 0.5 * ((t2 -= 2) * t2 * (((s2 *= 1.525) + 1) * t2 + s2) + 2);
  },
  easeInBounce: (t2) => 1 - effects.easeOutBounce(1 - t2),
  easeOutBounce(t2) {
    const m2 = 7.5625;
    const d2 = 2.75;
    if (t2 < 1 / d2) {
      return m2 * t2 * t2;
    }
    if (t2 < 2 / d2) {
      return m2 * (t2 -= 1.5 / d2) * t2 + 0.75;
    }
    if (t2 < 2.5 / d2) {
      return m2 * (t2 -= 2.25 / d2) * t2 + 0.9375;
    }
    return m2 * (t2 -= 2.625 / d2) * t2 + 0.984375;
  },
  easeInOutBounce: (t2) => t2 < 0.5 ? effects.easeInBounce(t2 * 2) * 0.5 : effects.easeOutBounce(t2 * 2 - 1) * 0.5 + 0.5
};
function isPatternOrGradient(value2) {
  if (value2 && typeof value2 === "object") {
    const type4 = value2.toString();
    return type4 === "[object CanvasPattern]" || type4 === "[object CanvasGradient]";
  }
  return false;
}
function color$1(value2) {
  return isPatternOrGradient(value2) ? value2 : new Color(value2);
}
function getHoverColor(value2) {
  return isPatternOrGradient(value2) ? value2 : new Color(value2).saturate(0.5).darken(0.1).hexString();
}
const numbers = [
  "x",
  "y",
  "borderWidth",
  "radius",
  "tension"
];
const colors$1 = [
  "color",
  "borderColor",
  "backgroundColor"
];
function applyAnimationsDefaults(defaults2) {
  defaults2.set("animation", {
    delay: void 0,
    duration: 1e3,
    easing: "easeOutQuart",
    fn: void 0,
    from: void 0,
    loop: void 0,
    to: void 0,
    type: void 0
  });
  defaults2.describe("animation", {
    _fallback: false,
    _indexable: false,
    _scriptable: (name2) => name2 !== "onProgress" && name2 !== "onComplete" && name2 !== "fn"
  });
  defaults2.set("animations", {
    colors: {
      type: "color",
      properties: colors$1
    },
    numbers: {
      type: "number",
      properties: numbers
    }
  });
  defaults2.describe("animations", {
    _fallback: "animation"
  });
  defaults2.set("transitions", {
    active: {
      animation: {
        duration: 400
      }
    },
    resize: {
      animation: {
        duration: 0
      }
    },
    show: {
      animations: {
        colors: {
          from: "transparent"
        },
        visible: {
          type: "boolean",
          duration: 0
        }
      }
    },
    hide: {
      animations: {
        colors: {
          to: "transparent"
        },
        visible: {
          type: "boolean",
          easing: "linear",
          fn: (v2) => v2 | 0
        }
      }
    }
  });
}
function applyLayoutsDefaults(defaults2) {
  defaults2.set("layout", {
    autoPadding: true,
    padding: {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0
    }
  });
}
const intlCache = /* @__PURE__ */ new Map();
function getNumberFormat(locale2, options) {
  options = options || {};
  const cacheKey = locale2 + JSON.stringify(options);
  let formatter = intlCache.get(cacheKey);
  if (!formatter) {
    formatter = new Intl.NumberFormat(locale2, options);
    intlCache.set(cacheKey, formatter);
  }
  return formatter;
}
function formatNumber(num, locale2, options) {
  return getNumberFormat(locale2, options).format(num);
}
const formatters = {
  values(value2) {
    return isArray$4(value2) ? value2 : "" + value2;
  },
  numeric(tickValue, index2, ticks) {
    if (tickValue === 0) {
      return "0";
    }
    const locale2 = this.chart.options.locale;
    let notation;
    let delta = tickValue;
    if (ticks.length > 1) {
      const maxTick = Math.max(Math.abs(ticks[0].value), Math.abs(ticks[ticks.length - 1].value));
      if (maxTick < 1e-4 || maxTick > 1e15) {
        notation = "scientific";
      }
      delta = calculateDelta(tickValue, ticks);
    }
    const logDelta = log10(Math.abs(delta));
    const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
    const options = {
      notation,
      minimumFractionDigits: numDecimal,
      maximumFractionDigits: numDecimal
    };
    Object.assign(options, this.options.ticks.format);
    return formatNumber(tickValue, locale2, options);
  }
};
function calculateDelta(tickValue, ticks) {
  let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
  if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
    delta = tickValue - Math.floor(tickValue);
  }
  return delta;
}
var Ticks = {
  formatters
};
function applyScaleDefaults(defaults2) {
  defaults2.set("scale", {
    display: true,
    offset: false,
    reverse: false,
    beginAtZero: false,
    bounds: "ticks",
    clip: true,
    grace: 0,
    grid: {
      display: true,
      lineWidth: 1,
      drawOnChartArea: true,
      drawTicks: true,
      tickLength: 8,
      tickWidth: (_ctx, options) => options.lineWidth,
      tickColor: (_ctx, options) => options.color,
      offset: false
    },
    border: {
      display: true,
      dash: [],
      dashOffset: 0,
      width: 1
    },
    title: {
      display: false,
      text: "",
      padding: {
        top: 4,
        bottom: 4
      }
    },
    ticks: {
      minRotation: 0,
      maxRotation: 50,
      mirror: false,
      textStrokeWidth: 0,
      textStrokeColor: "",
      padding: 3,
      display: true,
      autoSkip: true,
      autoSkipPadding: 3,
      labelOffset: 0,
      callback: Ticks.formatters.values,
      minor: {},
      major: {},
      align: "center",
      crossAlign: "near",
      showLabelBackdrop: false,
      backdropColor: "rgba(255, 255, 255, 0.75)",
      backdropPadding: 2
    }
  });
  defaults2.route("scale.ticks", "color", "", "color");
  defaults2.route("scale.grid", "color", "", "borderColor");
  defaults2.route("scale.border", "color", "", "borderColor");
  defaults2.route("scale.title", "color", "", "color");
  defaults2.describe("scale", {
    _fallback: false,
    _scriptable: (name2) => !name2.startsWith("before") && !name2.startsWith("after") && name2 !== "callback" && name2 !== "parser",
    _indexable: (name2) => name2 !== "borderDash" && name2 !== "tickBorderDash" && name2 !== "dash"
  });
  defaults2.describe("scales", {
    _fallback: "scale"
  });
  defaults2.describe("scale.ticks", {
    _scriptable: (name2) => name2 !== "backdropPadding" && name2 !== "callback",
    _indexable: (name2) => name2 !== "backdropPadding"
  });
}
const overrides = /* @__PURE__ */ Object.create(null);
const descriptors$1 = /* @__PURE__ */ Object.create(null);
function getScope$1(node2, key) {
  if (!key) {
    return node2;
  }
  const keys2 = key.split(".");
  for (let i2 = 0, n2 = keys2.length; i2 < n2; ++i2) {
    const k2 = keys2[i2];
    node2 = node2[k2] || (node2[k2] = /* @__PURE__ */ Object.create(null));
  }
  return node2;
}
function set$2(root2, scope, values) {
  if (typeof scope === "string") {
    return merge$2(getScope$1(root2, scope), values);
  }
  return merge$2(getScope$1(root2, ""), scope);
}
class Defaults {
  constructor(_descriptors2, _appliers) {
    this.animation = void 0;
    this.backgroundColor = "rgba(0,0,0,0.1)";
    this.borderColor = "rgba(0,0,0,0.1)";
    this.color = "#666";
    this.datasets = {};
    this.devicePixelRatio = (context) => context.chart.platform.getDevicePixelRatio();
    this.elements = {};
    this.events = [
      "mousemove",
      "mouseout",
      "click",
      "touchstart",
      "touchmove"
    ];
    this.font = {
      family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
      size: 12,
      style: "normal",
      lineHeight: 1.2,
      weight: null
    };
    this.hover = {};
    this.hoverBackgroundColor = (ctx, options) => getHoverColor(options.backgroundColor);
    this.hoverBorderColor = (ctx, options) => getHoverColor(options.borderColor);
    this.hoverColor = (ctx, options) => getHoverColor(options.color);
    this.indexAxis = "x";
    this.interaction = {
      mode: "nearest",
      intersect: true,
      includeInvisible: false
    };
    this.maintainAspectRatio = true;
    this.onHover = null;
    this.onClick = null;
    this.parsing = true;
    this.plugins = {};
    this.responsive = true;
    this.scale = void 0;
    this.scales = {};
    this.showLine = true;
    this.drawActiveElementsOnTop = true;
    this.describe(_descriptors2);
    this.apply(_appliers);
  }
  set(scope, values) {
    return set$2(this, scope, values);
  }
  get(scope) {
    return getScope$1(this, scope);
  }
  describe(scope, values) {
    return set$2(descriptors$1, scope, values);
  }
  override(scope, values) {
    return set$2(overrides, scope, values);
  }
  route(scope, name2, targetScope, targetName) {
    const scopeObject = getScope$1(this, scope);
    const targetScopeObject = getScope$1(this, targetScope);
    const privateName = "_" + name2;
    Object.defineProperties(scopeObject, {
      [privateName]: {
        value: scopeObject[name2],
        writable: true
      },
      [name2]: {
        enumerable: true,
        get() {
          const local = this[privateName];
          const target = targetScopeObject[targetName];
          if (isObject$3(local)) {
            return Object.assign({}, target, local);
          }
          return valueOrDefault(local, target);
        },
        set(value2) {
          this[privateName] = value2;
        }
      }
    });
  }
  apply(appliers) {
    appliers.forEach((apply2) => apply2(this));
  }
}
var defaults$2 = /* @__PURE__ */ new Defaults({
  _scriptable: (name2) => !name2.startsWith("on"),
  _indexable: (name2) => name2 !== "events",
  hover: {
    _fallback: "interaction"
  },
  interaction: {
    _scriptable: false,
    _indexable: false
  }
}, [
  applyAnimationsDefaults,
  applyLayoutsDefaults,
  applyScaleDefaults
]);
function toFontString(font) {
  if (!font || isNullOrUndef(font.size) || isNullOrUndef(font.family)) {
    return null;
  }
  return (font.style ? font.style + " " : "") + (font.weight ? font.weight + " " : "") + font.size + "px " + font.family;
}
function _measureText(ctx, data, gc2, longest, string3) {
  let textWidth = data[string3];
  if (!textWidth) {
    textWidth = data[string3] = ctx.measureText(string3).width;
    gc2.push(string3);
  }
  if (textWidth > longest) {
    longest = textWidth;
  }
  return longest;
}
function _alignPixel(chart, pixel, width) {
  const devicePixelRatio = chart.currentDevicePixelRatio;
  const halfWidth = width !== 0 ? Math.max(width / 2, 0.5) : 0;
  return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
}
function clearCanvas(canvas, ctx) {
  if (!ctx && !canvas) {
    return;
  }
  ctx = ctx || canvas.getContext("2d");
  ctx.save();
  ctx.resetTransform();
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.restore();
}
function drawPoint(ctx, options, x2, y2) {
  drawPointLegend(ctx, options, x2, y2, null);
}
function drawPointLegend(ctx, options, x2, y2, w2) {
  let type4, xOffset, yOffset, size2, cornerRadius, width, xOffsetW, yOffsetW;
  const style2 = options.pointStyle;
  const rotation = options.rotation;
  const radius = options.radius;
  let rad = (rotation || 0) * RAD_PER_DEG;
  if (style2 && typeof style2 === "object") {
    type4 = style2.toString();
    if (type4 === "[object HTMLImageElement]" || type4 === "[object HTMLCanvasElement]") {
      ctx.save();
      ctx.translate(x2, y2);
      ctx.rotate(rad);
      ctx.drawImage(style2, -style2.width / 2, -style2.height / 2, style2.width, style2.height);
      ctx.restore();
      return;
    }
  }
  if (isNaN(radius) || radius <= 0) {
    return;
  }
  ctx.beginPath();
  switch (style2) {
    default:
      if (w2) {
        ctx.ellipse(x2, y2, w2 / 2, radius, 0, 0, TAU);
      } else {
        ctx.arc(x2, y2, radius, 0, TAU);
      }
      ctx.closePath();
      break;
    case "triangle":
      width = w2 ? w2 / 2 : radius;
      ctx.moveTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      rad += TWO_THIRDS_PI;
      ctx.lineTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      rad += TWO_THIRDS_PI;
      ctx.lineTo(x2 + Math.sin(rad) * width, y2 - Math.cos(rad) * radius);
      ctx.closePath();
      break;
    case "rectRounded":
      cornerRadius = radius * 0.516;
      size2 = radius - cornerRadius;
      xOffset = Math.cos(rad + QUARTER_PI) * size2;
      xOffsetW = Math.cos(rad + QUARTER_PI) * (w2 ? w2 / 2 - cornerRadius : size2);
      yOffset = Math.sin(rad + QUARTER_PI) * size2;
      yOffsetW = Math.sin(rad + QUARTER_PI) * (w2 ? w2 / 2 - cornerRadius : size2);
      ctx.arc(x2 - xOffsetW, y2 - yOffset, cornerRadius, rad - PI, rad - HALF_PI);
      ctx.arc(x2 + yOffsetW, y2 - xOffset, cornerRadius, rad - HALF_PI, rad);
      ctx.arc(x2 + xOffsetW, y2 + yOffset, cornerRadius, rad, rad + HALF_PI);
      ctx.arc(x2 - yOffsetW, y2 + xOffset, cornerRadius, rad + HALF_PI, rad + PI);
      ctx.closePath();
      break;
    case "rect":
      if (!rotation) {
        size2 = Math.SQRT1_2 * radius;
        width = w2 ? w2 / 2 : size2;
        ctx.rect(x2 - width, y2 - size2, 2 * width, 2 * size2);
        break;
      }
      rad += QUARTER_PI;
    case "rectRot":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      ctx.closePath();
      break;
    case "crossRot":
      rad += QUARTER_PI;
    case "cross":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      break;
    case "star":
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      rad += QUARTER_PI;
      xOffsetW = Math.cos(rad) * (w2 ? w2 / 2 : radius);
      xOffset = Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      yOffsetW = Math.sin(rad) * (w2 ? w2 / 2 : radius);
      ctx.moveTo(x2 - xOffsetW, y2 - yOffset);
      ctx.lineTo(x2 + xOffsetW, y2 + yOffset);
      ctx.moveTo(x2 + yOffsetW, y2 - xOffset);
      ctx.lineTo(x2 - yOffsetW, y2 + xOffset);
      break;
    case "line":
      xOffset = w2 ? w2 / 2 : Math.cos(rad) * radius;
      yOffset = Math.sin(rad) * radius;
      ctx.moveTo(x2 - xOffset, y2 - yOffset);
      ctx.lineTo(x2 + xOffset, y2 + yOffset);
      break;
    case "dash":
      ctx.moveTo(x2, y2);
      ctx.lineTo(x2 + Math.cos(rad) * (w2 ? w2 / 2 : radius), y2 + Math.sin(rad) * radius);
      break;
    case false:
      ctx.closePath();
      break;
  }
  ctx.fill();
  if (options.borderWidth > 0) {
    ctx.stroke();
  }
}
function _isPointInArea(point2, area, margin) {
  margin = margin || 0.5;
  return !area || point2 && point2.x > area.left - margin && point2.x < area.right + margin && point2.y > area.top - margin && point2.y < area.bottom + margin;
}
function clipArea(ctx, area) {
  ctx.save();
  ctx.beginPath();
  ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
  ctx.clip();
}
function unclipArea(ctx) {
  ctx.restore();
}
function _steppedLineTo(ctx, previous2, target, flip2, mode) {
  if (!previous2) {
    return ctx.lineTo(target.x, target.y);
  }
  if (mode === "middle") {
    const midpoint = (previous2.x + target.x) / 2;
    ctx.lineTo(midpoint, previous2.y);
    ctx.lineTo(midpoint, target.y);
  } else if (mode === "after" !== !!flip2) {
    ctx.lineTo(previous2.x, target.y);
  } else {
    ctx.lineTo(target.x, previous2.y);
  }
  ctx.lineTo(target.x, target.y);
}
function _bezierCurveTo(ctx, previous2, target, flip2) {
  if (!previous2) {
    return ctx.lineTo(target.x, target.y);
  }
  ctx.bezierCurveTo(flip2 ? previous2.cp1x : previous2.cp2x, flip2 ? previous2.cp1y : previous2.cp2y, flip2 ? target.cp2x : target.cp1x, flip2 ? target.cp2y : target.cp1y, target.x, target.y);
}
function setRenderOpts(ctx, opts2) {
  if (opts2.translation) {
    ctx.translate(opts2.translation[0], opts2.translation[1]);
  }
  if (!isNullOrUndef(opts2.rotation)) {
    ctx.rotate(opts2.rotation);
  }
  if (opts2.color) {
    ctx.fillStyle = opts2.color;
  }
  if (opts2.textAlign) {
    ctx.textAlign = opts2.textAlign;
  }
  if (opts2.textBaseline) {
    ctx.textBaseline = opts2.textBaseline;
  }
}
function decorateText(ctx, x2, y2, line2, opts2) {
  if (opts2.strikethrough || opts2.underline) {
    const metrics2 = ctx.measureText(line2);
    const left2 = x2 - metrics2.actualBoundingBoxLeft;
    const right = x2 + metrics2.actualBoundingBoxRight;
    const top2 = y2 - metrics2.actualBoundingBoxAscent;
    const bottom2 = y2 + metrics2.actualBoundingBoxDescent;
    const yDecoration = opts2.strikethrough ? (top2 + bottom2) / 2 : bottom2;
    ctx.strokeStyle = ctx.fillStyle;
    ctx.beginPath();
    ctx.lineWidth = opts2.decorationWidth || 2;
    ctx.moveTo(left2, yDecoration);
    ctx.lineTo(right, yDecoration);
    ctx.stroke();
  }
}
function drawBackdrop(ctx, opts2) {
  const oldColor = ctx.fillStyle;
  ctx.fillStyle = opts2.color;
  ctx.fillRect(opts2.left, opts2.top, opts2.width, opts2.height);
  ctx.fillStyle = oldColor;
}
function renderText(ctx, text2, x2, y2, font, opts2 = {}) {
  const lines = isArray$4(text2) ? text2 : [
    text2
  ];
  const stroke = opts2.strokeWidth > 0 && opts2.strokeColor !== "";
  let i2, line2;
  ctx.save();
  ctx.font = font.string;
  setRenderOpts(ctx, opts2);
  for (i2 = 0; i2 < lines.length; ++i2) {
    line2 = lines[i2];
    if (opts2.backdrop) {
      drawBackdrop(ctx, opts2.backdrop);
    }
    if (stroke) {
      if (opts2.strokeColor) {
        ctx.strokeStyle = opts2.strokeColor;
      }
      if (!isNullOrUndef(opts2.strokeWidth)) {
        ctx.lineWidth = opts2.strokeWidth;
      }
      ctx.strokeText(line2, x2, y2, opts2.maxWidth);
    }
    ctx.fillText(line2, x2, y2, opts2.maxWidth);
    decorateText(ctx, x2, y2, line2, opts2);
    y2 += Number(font.lineHeight);
  }
  ctx.restore();
}
function addRoundedRectPath(ctx, rect) {
  const { x: x2, y: y2, w: w2, h: h3, radius } = rect;
  ctx.arc(x2 + radius.topLeft, y2 + radius.topLeft, radius.topLeft, 1.5 * PI, PI, true);
  ctx.lineTo(x2, y2 + h3 - radius.bottomLeft);
  ctx.arc(x2 + radius.bottomLeft, y2 + h3 - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
  ctx.lineTo(x2 + w2 - radius.bottomRight, y2 + h3);
  ctx.arc(x2 + w2 - radius.bottomRight, y2 + h3 - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
  ctx.lineTo(x2 + w2, y2 + radius.topRight);
  ctx.arc(x2 + w2 - radius.topRight, y2 + radius.topRight, radius.topRight, 0, -HALF_PI, true);
  ctx.lineTo(x2 + radius.topLeft, y2);
}
const LINE_HEIGHT = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/;
const FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;
function toLineHeight(value2, size2) {
  const matches = ("" + value2).match(LINE_HEIGHT);
  if (!matches || matches[1] === "normal") {
    return size2 * 1.2;
  }
  value2 = +matches[2];
  switch (matches[3]) {
    case "px":
      return value2;
    case "%":
      value2 /= 100;
      break;
  }
  return size2 * value2;
}
const numberOrZero = (v2) => +v2 || 0;
function _readValueToProps(value2, props) {
  const ret = {};
  const objProps = isObject$3(props);
  const keys2 = objProps ? Object.keys(props) : props;
  const read = isObject$3(value2) ? objProps ? (prop) => valueOrDefault(value2[prop], value2[props[prop]]) : (prop) => value2[prop] : () => value2;
  for (const prop of keys2) {
    ret[prop] = numberOrZero(read(prop));
  }
  return ret;
}
function toTRBL(value2) {
  return _readValueToProps(value2, {
    top: "y",
    right: "x",
    bottom: "y",
    left: "x"
  });
}
function toTRBLCorners(value2) {
  return _readValueToProps(value2, [
    "topLeft",
    "topRight",
    "bottomLeft",
    "bottomRight"
  ]);
}
function toPadding(value2) {
  const obj = toTRBL(value2);
  obj.width = obj.left + obj.right;
  obj.height = obj.top + obj.bottom;
  return obj;
}
function toFont(options, fallback2) {
  options = options || {};
  fallback2 = fallback2 || defaults$2.font;
  let size2 = valueOrDefault(options.size, fallback2.size);
  if (typeof size2 === "string") {
    size2 = parseInt(size2, 10);
  }
  let style2 = valueOrDefault(options.style, fallback2.style);
  if (style2 && !("" + style2).match(FONT_STYLE)) {
    console.warn('Invalid font style specified: "' + style2 + '"');
    style2 = void 0;
  }
  const font = {
    family: valueOrDefault(options.family, fallback2.family),
    lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback2.lineHeight), size2),
    size: size2,
    style: style2,
    weight: valueOrDefault(options.weight, fallback2.weight),
    string: ""
  };
  font.string = toFontString(font);
  return font;
}
function resolve(inputs, context, index2, info) {
  let i2, ilen, value2;
  for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
    value2 = inputs[i2];
    if (value2 === void 0) {
      continue;
    }
    if (value2 !== void 0) {
      return value2;
    }
  }
}
function _addGrace(minmax, grace, beginAtZero) {
  const { min: min2, max: max2 } = minmax;
  const change = toDimension(grace, (max2 - min2) / 2);
  const keepZero = (value2, add2) => beginAtZero && value2 === 0 ? 0 : value2 + add2;
  return {
    min: keepZero(min2, -Math.abs(change)),
    max: keepZero(max2, change)
  };
}
function createContext(parentContext, context) {
  return Object.assign(Object.create(parentContext), context);
}
function _createResolver(scopes, prefixes2 = [
  ""
], rootScopes, fallback2, getTarget = () => scopes[0]) {
  const finalRootScopes = rootScopes || scopes;
  if (typeof fallback2 === "undefined") {
    fallback2 = _resolve("_fallback", scopes);
  }
  const cache2 = {
    [Symbol.toStringTag]: "Object",
    _cacheable: true,
    _scopes: scopes,
    _rootScopes: finalRootScopes,
    _fallback: fallback2,
    _getTarget: getTarget,
    override: (scope) => _createResolver([
      scope,
      ...scopes
    ], prefixes2, finalRootScopes, fallback2)
  };
  return new Proxy(cache2, {
    /**
    * A trap for the delete operator.
    */
    deleteProperty(target, prop) {
      delete target[prop];
      delete target._keys;
      delete scopes[0][prop];
      return true;
    },
    /**
    * A trap for getting property values.
    */
    get(target, prop) {
      return _cached(target, prop, () => _resolveWithPrefixes(prop, prefixes2, scopes, target));
    },
    /**
    * A trap for Object.getOwnPropertyDescriptor.
    * Also used by Object.hasOwnProperty.
    */
    getOwnPropertyDescriptor(target, prop) {
      return Reflect.getOwnPropertyDescriptor(target._scopes[0], prop);
    },
    /**
    * A trap for Object.getPrototypeOf.
    */
    getPrototypeOf() {
      return Reflect.getPrototypeOf(scopes[0]);
    },
    /**
    * A trap for the in operator.
    */
    has(target, prop) {
      return getKeysFromAllScopes(target).includes(prop);
    },
    /**
    * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
    */
    ownKeys(target) {
      return getKeysFromAllScopes(target);
    },
    /**
    * A trap for setting property values.
    */
    set(target, prop, value2) {
      const storage = target._storage || (target._storage = getTarget());
      target[prop] = storage[prop] = value2;
      delete target._keys;
      return true;
    }
  });
}
function _attachContext(proxy, context, subProxy, descriptorDefaults) {
  const cache2 = {
    _cacheable: false,
    _proxy: proxy,
    _context: context,
    _subProxy: subProxy,
    _stack: /* @__PURE__ */ new Set(),
    _descriptors: _descriptors(proxy, descriptorDefaults),
    setContext: (ctx) => _attachContext(proxy, ctx, subProxy, descriptorDefaults),
    override: (scope) => _attachContext(proxy.override(scope), context, subProxy, descriptorDefaults)
  };
  return new Proxy(cache2, {
    /**
    * A trap for the delete operator.
    */
    deleteProperty(target, prop) {
      delete target[prop];
      delete proxy[prop];
      return true;
    },
    /**
    * A trap for getting property values.
    */
    get(target, prop, receiver) {
      return _cached(target, prop, () => _resolveWithContext(target, prop, receiver));
    },
    /**
    * A trap for Object.getOwnPropertyDescriptor.
    * Also used by Object.hasOwnProperty.
    */
    getOwnPropertyDescriptor(target, prop) {
      return target._descriptors.allKeys ? Reflect.has(proxy, prop) ? {
        enumerable: true,
        configurable: true
      } : void 0 : Reflect.getOwnPropertyDescriptor(proxy, prop);
    },
    /**
    * A trap for Object.getPrototypeOf.
    */
    getPrototypeOf() {
      return Reflect.getPrototypeOf(proxy);
    },
    /**
    * A trap for the in operator.
    */
    has(target, prop) {
      return Reflect.has(proxy, prop);
    },
    /**
    * A trap for Object.getOwnPropertyNames and Object.getOwnPropertySymbols.
    */
    ownKeys() {
      return Reflect.ownKeys(proxy);
    },
    /**
    * A trap for setting property values.
    */
    set(target, prop, value2) {
      proxy[prop] = value2;
      delete target[prop];
      return true;
    }
  });
}
function _descriptors(proxy, defaults2 = {
  scriptable: true,
  indexable: true
}) {
  const { _scriptable = defaults2.scriptable, _indexable = defaults2.indexable, _allKeys = defaults2.allKeys } = proxy;
  return {
    allKeys: _allKeys,
    scriptable: _scriptable,
    indexable: _indexable,
    isScriptable: isFunction$3(_scriptable) ? _scriptable : () => _scriptable,
    isIndexable: isFunction$3(_indexable) ? _indexable : () => _indexable
  };
}
const readKey = (prefix, name2) => prefix ? prefix + _capitalize(name2) : name2;
const needsSubResolver = (prop, value2) => isObject$3(value2) && prop !== "adapters" && (Object.getPrototypeOf(value2) === null || value2.constructor === Object);
function _cached(target, prop, resolve2) {
  if (Object.prototype.hasOwnProperty.call(target, prop) || prop === "constructor") {
    return target[prop];
  }
  const value2 = resolve2();
  target[prop] = value2;
  return value2;
}
function _resolveWithContext(target, prop, receiver) {
  const { _proxy, _context, _subProxy, _descriptors: descriptors2 } = target;
  let value2 = _proxy[prop];
  if (isFunction$3(value2) && descriptors2.isScriptable(prop)) {
    value2 = _resolveScriptable(prop, value2, target, receiver);
  }
  if (isArray$4(value2) && value2.length) {
    value2 = _resolveArray(prop, value2, target, descriptors2.isIndexable);
  }
  if (needsSubResolver(prop, value2)) {
    value2 = _attachContext(value2, _context, _subProxy && _subProxy[prop], descriptors2);
  }
  return value2;
}
function _resolveScriptable(prop, getValue2, target, receiver) {
  const { _proxy, _context, _subProxy, _stack } = target;
  if (_stack.has(prop)) {
    throw new Error("Recursion detected: " + Array.from(_stack).join("->") + "->" + prop);
  }
  _stack.add(prop);
  let value2 = getValue2(_context, _subProxy || receiver);
  _stack.delete(prop);
  if (needsSubResolver(prop, value2)) {
    value2 = createSubResolver(_proxy._scopes, _proxy, prop, value2);
  }
  return value2;
}
function _resolveArray(prop, value2, target, isIndexable) {
  const { _proxy, _context, _subProxy, _descriptors: descriptors2 } = target;
  if (typeof _context.index !== "undefined" && isIndexable(prop)) {
    return value2[_context.index % value2.length];
  } else if (isObject$3(value2[0])) {
    const arr = value2;
    const scopes = _proxy._scopes.filter((s2) => s2 !== arr);
    value2 = [];
    for (const item of arr) {
      const resolver2 = createSubResolver(scopes, _proxy, prop, item);
      value2.push(_attachContext(resolver2, _context, _subProxy && _subProxy[prop], descriptors2));
    }
  }
  return value2;
}
function resolveFallback(fallback2, prop, value2) {
  return isFunction$3(fallback2) ? fallback2(prop, value2) : fallback2;
}
const getScope = (key, parent) => key === true ? parent : typeof key === "string" ? resolveObjectKey(parent, key) : void 0;
function addScopes(set2, parentScopes, key, parentFallback, value2) {
  for (const parent of parentScopes) {
    const scope = getScope(key, parent);
    if (scope) {
      set2.add(scope);
      const fallback2 = resolveFallback(scope._fallback, key, value2);
      if (typeof fallback2 !== "undefined" && fallback2 !== key && fallback2 !== parentFallback) {
        return fallback2;
      }
    } else if (scope === false && typeof parentFallback !== "undefined" && key !== parentFallback) {
      return null;
    }
  }
  return false;
}
function createSubResolver(parentScopes, resolver2, prop, value2) {
  const rootScopes = resolver2._rootScopes;
  const fallback2 = resolveFallback(resolver2._fallback, prop, value2);
  const allScopes = [
    ...parentScopes,
    ...rootScopes
  ];
  const set2 = /* @__PURE__ */ new Set();
  set2.add(value2);
  let key = addScopesFromKey(set2, allScopes, prop, fallback2 || prop, value2);
  if (key === null) {
    return false;
  }
  if (typeof fallback2 !== "undefined" && fallback2 !== prop) {
    key = addScopesFromKey(set2, allScopes, fallback2, key, value2);
    if (key === null) {
      return false;
    }
  }
  return _createResolver(Array.from(set2), [
    ""
  ], rootScopes, fallback2, () => subGetTarget(resolver2, prop, value2));
}
function addScopesFromKey(set2, allScopes, key, fallback2, item) {
  while (key) {
    key = addScopes(set2, allScopes, key, fallback2, item);
  }
  return key;
}
function subGetTarget(resolver2, prop, value2) {
  const parent = resolver2._getTarget();
  if (!(prop in parent)) {
    parent[prop] = {};
  }
  const target = parent[prop];
  if (isArray$4(target) && isObject$3(value2)) {
    return value2;
  }
  return target || {};
}
function _resolveWithPrefixes(prop, prefixes2, scopes, proxy) {
  let value2;
  for (const prefix of prefixes2) {
    value2 = _resolve(readKey(prefix, prop), scopes);
    if (typeof value2 !== "undefined") {
      return needsSubResolver(prop, value2) ? createSubResolver(scopes, proxy, prop, value2) : value2;
    }
  }
}
function _resolve(key, scopes) {
  for (const scope of scopes) {
    if (!scope) {
      continue;
    }
    const value2 = scope[key];
    if (typeof value2 !== "undefined") {
      return value2;
    }
  }
}
function getKeysFromAllScopes(target) {
  let keys2 = target._keys;
  if (!keys2) {
    keys2 = target._keys = resolveKeysFromAllScopes(target._scopes);
  }
  return keys2;
}
function resolveKeysFromAllScopes(scopes) {
  const set2 = /* @__PURE__ */ new Set();
  for (const scope of scopes) {
    for (const key of Object.keys(scope).filter((k2) => !k2.startsWith("_"))) {
      set2.add(key);
    }
  }
  return Array.from(set2);
}
const EPSILON = Number.EPSILON || 1e-14;
const getPoint = (points, i2) => i2 < points.length && !points[i2].skip && points[i2];
const getValueAxis = (indexAxis) => indexAxis === "x" ? "y" : "x";
function splineCurve(firstPoint, middlePoint, afterPoint, t2) {
  const previous2 = firstPoint.skip ? middlePoint : firstPoint;
  const current = middlePoint;
  const next2 = afterPoint.skip ? middlePoint : afterPoint;
  const d01 = distanceBetweenPoints(current, previous2);
  const d12 = distanceBetweenPoints(next2, current);
  let s01 = d01 / (d01 + d12);
  let s12 = d12 / (d01 + d12);
  s01 = isNaN(s01) ? 0 : s01;
  s12 = isNaN(s12) ? 0 : s12;
  const fa2 = t2 * s01;
  const fb2 = t2 * s12;
  return {
    previous: {
      x: current.x - fa2 * (next2.x - previous2.x),
      y: current.y - fa2 * (next2.y - previous2.y)
    },
    next: {
      x: current.x + fb2 * (next2.x - previous2.x),
      y: current.y + fb2 * (next2.y - previous2.y)
    }
  };
}
function monotoneAdjust(points, deltaK, mK) {
  const pointsLen = points.length;
  let alphaK, betaK, tauK, squaredMagnitude, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (let i2 = 0; i2 < pointsLen - 1; ++i2) {
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent || !pointAfter) {
      continue;
    }
    if (almostEquals(deltaK[i2], 0, EPSILON)) {
      mK[i2] = mK[i2 + 1] = 0;
      continue;
    }
    alphaK = mK[i2] / deltaK[i2];
    betaK = mK[i2 + 1] / deltaK[i2];
    squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
    if (squaredMagnitude <= 9) {
      continue;
    }
    tauK = 3 / Math.sqrt(squaredMagnitude);
    mK[i2] = alphaK * tauK * deltaK[i2];
    mK[i2 + 1] = betaK * tauK * deltaK[i2];
  }
}
function monotoneCompute(points, mK, indexAxis = "x") {
  const valueAxis = getValueAxis(indexAxis);
  const pointsLen = points.length;
  let delta, pointBefore, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (let i2 = 0; i2 < pointsLen; ++i2) {
    pointBefore = pointCurrent;
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent) {
      continue;
    }
    const iPixel = pointCurrent[indexAxis];
    const vPixel = pointCurrent[valueAxis];
    if (pointBefore) {
      delta = (iPixel - pointBefore[indexAxis]) / 3;
      pointCurrent[`cp1${indexAxis}`] = iPixel - delta;
      pointCurrent[`cp1${valueAxis}`] = vPixel - delta * mK[i2];
    }
    if (pointAfter) {
      delta = (pointAfter[indexAxis] - iPixel) / 3;
      pointCurrent[`cp2${indexAxis}`] = iPixel + delta;
      pointCurrent[`cp2${valueAxis}`] = vPixel + delta * mK[i2];
    }
  }
}
function splineCurveMonotone(points, indexAxis = "x") {
  const valueAxis = getValueAxis(indexAxis);
  const pointsLen = points.length;
  const deltaK = Array(pointsLen).fill(0);
  const mK = Array(pointsLen);
  let i2, pointBefore, pointCurrent;
  let pointAfter = getPoint(points, 0);
  for (i2 = 0; i2 < pointsLen; ++i2) {
    pointBefore = pointCurrent;
    pointCurrent = pointAfter;
    pointAfter = getPoint(points, i2 + 1);
    if (!pointCurrent) {
      continue;
    }
    if (pointAfter) {
      const slopeDelta = pointAfter[indexAxis] - pointCurrent[indexAxis];
      deltaK[i2] = slopeDelta !== 0 ? (pointAfter[valueAxis] - pointCurrent[valueAxis]) / slopeDelta : 0;
    }
    mK[i2] = !pointBefore ? deltaK[i2] : !pointAfter ? deltaK[i2 - 1] : sign$1(deltaK[i2 - 1]) !== sign$1(deltaK[i2]) ? 0 : (deltaK[i2 - 1] + deltaK[i2]) / 2;
  }
  monotoneAdjust(points, deltaK, mK);
  monotoneCompute(points, mK, indexAxis);
}
function capControlPoint(pt, min2, max2) {
  return Math.max(Math.min(pt, max2), min2);
}
function capBezierPoints(points, area) {
  let i2, ilen, point2, inArea, inAreaPrev;
  let inAreaNext = _isPointInArea(points[0], area);
  for (i2 = 0, ilen = points.length; i2 < ilen; ++i2) {
    inAreaPrev = inArea;
    inArea = inAreaNext;
    inAreaNext = i2 < ilen - 1 && _isPointInArea(points[i2 + 1], area);
    if (!inArea) {
      continue;
    }
    point2 = points[i2];
    if (inAreaPrev) {
      point2.cp1x = capControlPoint(point2.cp1x, area.left, area.right);
      point2.cp1y = capControlPoint(point2.cp1y, area.top, area.bottom);
    }
    if (inAreaNext) {
      point2.cp2x = capControlPoint(point2.cp2x, area.left, area.right);
      point2.cp2y = capControlPoint(point2.cp2y, area.top, area.bottom);
    }
  }
}
function _updateBezierControlPoints(points, options, area, loop2, indexAxis) {
  let i2, ilen, point2, controlPoints;
  if (options.spanGaps) {
    points = points.filter((pt) => !pt.skip);
  }
  if (options.cubicInterpolationMode === "monotone") {
    splineCurveMonotone(points, indexAxis);
  } else {
    let prev2 = loop2 ? points[points.length - 1] : points[0];
    for (i2 = 0, ilen = points.length; i2 < ilen; ++i2) {
      point2 = points[i2];
      controlPoints = splineCurve(prev2, point2, points[Math.min(i2 + 1, ilen - (loop2 ? 0 : 1)) % ilen], options.tension);
      point2.cp1x = controlPoints.previous.x;
      point2.cp1y = controlPoints.previous.y;
      point2.cp2x = controlPoints.next.x;
      point2.cp2y = controlPoints.next.y;
      prev2 = point2;
    }
  }
  if (options.capBezierPoints) {
    capBezierPoints(points, area);
  }
}
function _isDomSupported() {
  return typeof window !== "undefined" && typeof document !== "undefined";
}
function _getParentNode(domNode) {
  let parent = domNode.parentNode;
  if (parent && parent.toString() === "[object ShadowRoot]") {
    parent = parent.host;
  }
  return parent;
}
function parseMaxStyle(styleValue, node2, parentProperty) {
  let valueInPixels;
  if (typeof styleValue === "string") {
    valueInPixels = parseInt(styleValue, 10);
    if (styleValue.indexOf("%") !== -1) {
      valueInPixels = valueInPixels / 100 * node2.parentNode[parentProperty];
    }
  } else {
    valueInPixels = styleValue;
  }
  return valueInPixels;
}
const getComputedStyle$1 = (element2) => element2.ownerDocument.defaultView.getComputedStyle(element2, null);
function getStyle(el2, property2) {
  return getComputedStyle$1(el2).getPropertyValue(property2);
}
const positions = [
  "top",
  "right",
  "bottom",
  "left"
];
function getPositionedStyle(styles2, style2, suffix) {
  const result = {};
  suffix = suffix ? "-" + suffix : "";
  for (let i2 = 0; i2 < 4; i2++) {
    const pos = positions[i2];
    result[pos] = parseFloat(styles2[style2 + "-" + pos + suffix]) || 0;
  }
  result.width = result.left + result.right;
  result.height = result.top + result.bottom;
  return result;
}
const useOffsetPos = (x2, y2, target) => (x2 > 0 || y2 > 0) && (!target || !target.shadowRoot);
function getCanvasPosition(e2, canvas) {
  const touches = e2.touches;
  const source2 = touches && touches.length ? touches[0] : e2;
  const { offsetX, offsetY } = source2;
  let box = false;
  let x2, y2;
  if (useOffsetPos(offsetX, offsetY, e2.target)) {
    x2 = offsetX;
    y2 = offsetY;
  } else {
    const rect = canvas.getBoundingClientRect();
    x2 = source2.clientX - rect.left;
    y2 = source2.clientY - rect.top;
    box = true;
  }
  return {
    x: x2,
    y: y2,
    box
  };
}
function getRelativePosition(event, chart) {
  if ("native" in event) {
    return event;
  }
  const { canvas, currentDevicePixelRatio } = chart;
  const style2 = getComputedStyle$1(canvas);
  const borderBox = style2.boxSizing === "border-box";
  const paddings = getPositionedStyle(style2, "padding");
  const borders2 = getPositionedStyle(style2, "border", "width");
  const { x: x2, y: y2, box } = getCanvasPosition(event, canvas);
  const xOffset = paddings.left + (box && borders2.left);
  const yOffset = paddings.top + (box && borders2.top);
  let { width, height } = chart;
  if (borderBox) {
    width -= paddings.width + borders2.width;
    height -= paddings.height + borders2.height;
  }
  return {
    x: Math.round((x2 - xOffset) / width * canvas.width / currentDevicePixelRatio),
    y: Math.round((y2 - yOffset) / height * canvas.height / currentDevicePixelRatio)
  };
}
function getContainerSize(canvas, width, height) {
  let maxWidth, maxHeight;
  if (width === void 0 || height === void 0) {
    const container = canvas && _getParentNode(canvas);
    if (!container) {
      width = canvas.clientWidth;
      height = canvas.clientHeight;
    } else {
      const rect = container.getBoundingClientRect();
      const containerStyle = getComputedStyle$1(container);
      const containerBorder = getPositionedStyle(containerStyle, "border", "width");
      const containerPadding = getPositionedStyle(containerStyle, "padding");
      width = rect.width - containerPadding.width - containerBorder.width;
      height = rect.height - containerPadding.height - containerBorder.height;
      maxWidth = parseMaxStyle(containerStyle.maxWidth, container, "clientWidth");
      maxHeight = parseMaxStyle(containerStyle.maxHeight, container, "clientHeight");
    }
  }
  return {
    width,
    height,
    maxWidth: maxWidth || INFINITY,
    maxHeight: maxHeight || INFINITY
  };
}
const round1 = (v2) => Math.round(v2 * 10) / 10;
function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio2) {
  const style2 = getComputedStyle$1(canvas);
  const margins = getPositionedStyle(style2, "margin");
  const maxWidth = parseMaxStyle(style2.maxWidth, canvas, "clientWidth") || INFINITY;
  const maxHeight = parseMaxStyle(style2.maxHeight, canvas, "clientHeight") || INFINITY;
  const containerSize = getContainerSize(canvas, bbWidth, bbHeight);
  let { width, height } = containerSize;
  if (style2.boxSizing === "content-box") {
    const borders2 = getPositionedStyle(style2, "border", "width");
    const paddings = getPositionedStyle(style2, "padding");
    width -= paddings.width + borders2.width;
    height -= paddings.height + borders2.height;
  }
  width = Math.max(0, width - margins.width);
  height = Math.max(0, aspectRatio2 ? width / aspectRatio2 : height - margins.height);
  width = round1(Math.min(width, maxWidth, containerSize.maxWidth));
  height = round1(Math.min(height, maxHeight, containerSize.maxHeight));
  if (width && !height) {
    height = round1(width / 2);
  }
  const maintainHeight = bbWidth !== void 0 || bbHeight !== void 0;
  if (maintainHeight && aspectRatio2 && containerSize.height && height > containerSize.height) {
    height = containerSize.height;
    width = round1(Math.floor(height * aspectRatio2));
  }
  return {
    width,
    height
  };
}
function retinaScale(chart, forceRatio, forceStyle) {
  const pixelRatio = forceRatio || 1;
  const deviceHeight = Math.floor(chart.height * pixelRatio);
  const deviceWidth = Math.floor(chart.width * pixelRatio);
  chart.height = Math.floor(chart.height);
  chart.width = Math.floor(chart.width);
  const canvas = chart.canvas;
  if (canvas.style && (forceStyle || !canvas.style.height && !canvas.style.width)) {
    canvas.style.height = `${chart.height}px`;
    canvas.style.width = `${chart.width}px`;
  }
  if (chart.currentDevicePixelRatio !== pixelRatio || canvas.height !== deviceHeight || canvas.width !== deviceWidth) {
    chart.currentDevicePixelRatio = pixelRatio;
    canvas.height = deviceHeight;
    canvas.width = deviceWidth;
    chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
    return true;
  }
  return false;
}
const supportsEventListenerOptions = function() {
  let passiveSupported = false;
  try {
    const options = {
      get passive() {
        passiveSupported = true;
        return false;
      }
    };
    if (_isDomSupported()) {
      window.addEventListener("test", null, options);
      window.removeEventListener("test", null, options);
    }
  } catch (e2) {
  }
  return passiveSupported;
}();
function readUsedSize(element2, property2) {
  const value2 = getStyle(element2, property2);
  const matches = value2 && value2.match(/^(\d+)(\.\d+)?px$/);
  return matches ? +matches[1] : void 0;
}
function _pointInLine(p1, p2, t2, mode) {
  return {
    x: p1.x + t2 * (p2.x - p1.x),
    y: p1.y + t2 * (p2.y - p1.y)
  };
}
function _steppedInterpolation(p1, p2, t2, mode) {
  return {
    x: p1.x + t2 * (p2.x - p1.x),
    y: mode === "middle" ? t2 < 0.5 ? p1.y : p2.y : mode === "after" ? t2 < 1 ? p1.y : p2.y : t2 > 0 ? p2.y : p1.y
  };
}
function _bezierInterpolation(p1, p2, t2, mode) {
  const cp1 = {
    x: p1.cp2x,
    y: p1.cp2y
  };
  const cp2 = {
    x: p2.cp1x,
    y: p2.cp1y
  };
  const a2 = _pointInLine(p1, cp1, t2);
  const b2 = _pointInLine(cp1, cp2, t2);
  const c2 = _pointInLine(cp2, p2, t2);
  const d2 = _pointInLine(a2, b2, t2);
  const e2 = _pointInLine(b2, c2, t2);
  return _pointInLine(d2, e2, t2);
}
const getRightToLeftAdapter = function(rectX, width) {
  return {
    x(x2) {
      return rectX + rectX + width - x2;
    },
    setWidth(w2) {
      width = w2;
    },
    textAlign(align) {
      if (align === "center") {
        return align;
      }
      return align === "right" ? "left" : "right";
    },
    xPlus(x2, value2) {
      return x2 - value2;
    },
    leftForLtr(x2, itemWidth) {
      return x2 - itemWidth;
    }
  };
};
const getLeftToRightAdapter = function() {
  return {
    x(x2) {
      return x2;
    },
    setWidth(w2) {
    },
    textAlign(align) {
      return align;
    },
    xPlus(x2, value2) {
      return x2 + value2;
    },
    leftForLtr(x2, _itemWidth) {
      return x2;
    }
  };
};
function getRtlAdapter(rtl, rectX, width) {
  return rtl ? getRightToLeftAdapter(rectX, width) : getLeftToRightAdapter();
}
function overrideTextDirection(ctx, direction) {
  let style2, original;
  if (direction === "ltr" || direction === "rtl") {
    style2 = ctx.canvas.style;
    original = [
      style2.getPropertyValue("direction"),
      style2.getPropertyPriority("direction")
    ];
    style2.setProperty("direction", direction, "important");
    ctx.prevTextDirection = original;
  }
}
function restoreTextDirection(ctx, original) {
  if (original !== void 0) {
    delete ctx.prevTextDirection;
    ctx.canvas.style.setProperty("direction", original[0], original[1]);
  }
}
function propertyFn(property2) {
  if (property2 === "angle") {
    return {
      between: _angleBetween,
      compare: _angleDiff,
      normalize: _normalizeAngle
    };
  }
  return {
    between: _isBetween,
    compare: (a2, b2) => a2 - b2,
    normalize: (x2) => x2
  };
}
function normalizeSegment({ start, end, count, loop: loop2, style: style2 }) {
  return {
    start: start % count,
    end: end % count,
    loop: loop2 && (end - start + 1) % count === 0,
    style: style2
  };
}
function getSegment(segment, points, bounds2) {
  const { property: property2, start: startBound, end: endBound } = bounds2;
  const { between, normalize: normalize2 } = propertyFn(property2);
  const count = points.length;
  let { start, end, loop: loop2 } = segment;
  let i2, ilen;
  if (loop2) {
    start += count;
    end += count;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      if (!between(normalize2(points[start % count][property2]), startBound, endBound)) {
        break;
      }
      start--;
      end--;
    }
    start %= count;
    end %= count;
  }
  if (end < start) {
    end += count;
  }
  return {
    start,
    end,
    loop: loop2,
    style: segment.style
  };
}
function _boundSegment(segment, points, bounds2) {
  if (!bounds2) {
    return [
      segment
    ];
  }
  const { property: property2, start: startBound, end: endBound } = bounds2;
  const count = points.length;
  const { compare, between, normalize: normalize2 } = propertyFn(property2);
  const { start, end, loop: loop2, style: style2 } = getSegment(segment, points, bounds2);
  const result = [];
  let inside = false;
  let subStart = null;
  let value2, point2, prevValue;
  const startIsBefore = () => between(startBound, prevValue, value2) && compare(startBound, prevValue) !== 0;
  const endIsBefore = () => compare(endBound, value2) === 0 || between(endBound, prevValue, value2);
  const shouldStart = () => inside || startIsBefore();
  const shouldStop = () => !inside || endIsBefore();
  for (let i2 = start, prev2 = start; i2 <= end; ++i2) {
    point2 = points[i2 % count];
    if (point2.skip) {
      continue;
    }
    value2 = normalize2(point2[property2]);
    if (value2 === prevValue) {
      continue;
    }
    inside = between(value2, startBound, endBound);
    if (subStart === null && shouldStart()) {
      subStart = compare(value2, startBound) === 0 ? i2 : prev2;
    }
    if (subStart !== null && shouldStop()) {
      result.push(normalizeSegment({
        start: subStart,
        end: i2,
        loop: loop2,
        count,
        style: style2
      }));
      subStart = null;
    }
    prev2 = i2;
    prevValue = value2;
  }
  if (subStart !== null) {
    result.push(normalizeSegment({
      start: subStart,
      end,
      loop: loop2,
      count,
      style: style2
    }));
  }
  return result;
}
function _boundSegments(line2, bounds2) {
  const result = [];
  const segments = line2.segments;
  for (let i2 = 0; i2 < segments.length; i2++) {
    const sub = _boundSegment(segments[i2], line2.points, bounds2);
    if (sub.length) {
      result.push(...sub);
    }
  }
  return result;
}
function findStartAndEnd(points, count, loop2, spanGaps) {
  let start = 0;
  let end = count - 1;
  if (loop2 && !spanGaps) {
    while (start < count && !points[start].skip) {
      start++;
    }
  }
  while (start < count && points[start].skip) {
    start++;
  }
  start %= count;
  if (loop2) {
    end += start;
  }
  while (end > start && points[end % count].skip) {
    end--;
  }
  end %= count;
  return {
    start,
    end
  };
}
function solidSegments(points, start, max2, loop2) {
  const count = points.length;
  const result = [];
  let last = start;
  let prev2 = points[start];
  let end;
  for (end = start + 1; end <= max2; ++end) {
    const cur = points[end % count];
    if (cur.skip || cur.stop) {
      if (!prev2.skip) {
        loop2 = false;
        result.push({
          start: start % count,
          end: (end - 1) % count,
          loop: loop2
        });
        start = last = cur.stop ? end : null;
      }
    } else {
      last = end;
      if (prev2.skip) {
        start = end;
      }
    }
    prev2 = cur;
  }
  if (last !== null) {
    result.push({
      start: start % count,
      end: last % count,
      loop: loop2
    });
  }
  return result;
}
function _computeSegments(line2, segmentOptions) {
  const points = line2.points;
  const spanGaps = line2.options.spanGaps;
  const count = points.length;
  if (!count) {
    return [];
  }
  const loop2 = !!line2._loop;
  const { start, end } = findStartAndEnd(points, count, loop2, spanGaps);
  if (spanGaps === true) {
    return splitByStyles(line2, [
      {
        start,
        end,
        loop: loop2
      }
    ], points, segmentOptions);
  }
  const max2 = end < start ? end + count : end;
  const completeLoop = !!line2._fullLoop && start === 0 && end === count - 1;
  return splitByStyles(line2, solidSegments(points, start, max2, completeLoop), points, segmentOptions);
}
function splitByStyles(line2, segments, points, segmentOptions) {
  if (!segmentOptions || !segmentOptions.setContext || !points) {
    return segments;
  }
  return doSplitByStyles(line2, segments, points, segmentOptions);
}
function doSplitByStyles(line2, segments, points, segmentOptions) {
  const chartContext = line2._chart.getContext();
  const baseStyle = readStyle(line2.options);
  const { _datasetIndex: datasetIndex, options: { spanGaps } } = line2;
  const count = points.length;
  const result = [];
  let prevStyle = baseStyle;
  let start = segments[0].start;
  let i2 = start;
  function addStyle(s2, e2, l2, st) {
    const dir = spanGaps ? -1 : 1;
    if (s2 === e2) {
      return;
    }
    s2 += count;
    while (points[s2 % count].skip) {
      s2 -= dir;
    }
    while (points[e2 % count].skip) {
      e2 += dir;
    }
    if (s2 % count !== e2 % count) {
      result.push({
        start: s2 % count,
        end: e2 % count,
        loop: l2,
        style: st
      });
      prevStyle = st;
      start = e2 % count;
    }
  }
  for (const segment of segments) {
    start = spanGaps ? start : segment.start;
    let prev2 = points[start % count];
    let style2;
    for (i2 = start + 1; i2 <= segment.end; i2++) {
      const pt = points[i2 % count];
      style2 = readStyle(segmentOptions.setContext(createContext(chartContext, {
        type: "segment",
        p0: prev2,
        p1: pt,
        p0DataIndex: (i2 - 1) % count,
        p1DataIndex: i2 % count,
        datasetIndex
      })));
      if (styleChanged(style2, prevStyle)) {
        addStyle(start, i2 - 1, segment.loop, prevStyle);
      }
      prev2 = pt;
      prevStyle = style2;
    }
    if (start < i2 - 1) {
      addStyle(start, i2 - 1, segment.loop, prevStyle);
    }
  }
  return result;
}
function readStyle(options) {
  return {
    backgroundColor: options.backgroundColor,
    borderCapStyle: options.borderCapStyle,
    borderDash: options.borderDash,
    borderDashOffset: options.borderDashOffset,
    borderJoinStyle: options.borderJoinStyle,
    borderWidth: options.borderWidth,
    borderColor: options.borderColor
  };
}
function styleChanged(style2, prevStyle) {
  if (!prevStyle) {
    return false;
  }
  const cache2 = [];
  const replacer = function(key, value2) {
    if (!isPatternOrGradient(value2)) {
      return value2;
    }
    if (!cache2.includes(value2)) {
      cache2.push(value2);
    }
    return cache2.indexOf(value2);
  };
  return JSON.stringify(style2, replacer) !== JSON.stringify(prevStyle, replacer);
}
function getSizeForArea(scale2, chartArea, field) {
  return scale2.options.clip ? scale2[field] : chartArea[field];
}
function getDatasetArea(meta, chartArea) {
  const { xScale, yScale } = meta;
  if (xScale && yScale) {
    return {
      left: getSizeForArea(xScale, chartArea, "left"),
      right: getSizeForArea(xScale, chartArea, "right"),
      top: getSizeForArea(yScale, chartArea, "top"),
      bottom: getSizeForArea(yScale, chartArea, "bottom")
    };
  }
  return chartArea;
}
function getDatasetClipArea(chart, meta) {
  const clip = meta._clip;
  if (clip.disabled) {
    return false;
  }
  const area = getDatasetArea(meta, chart.chartArea);
  return {
    left: clip.left === false ? 0 : area.left - (clip.left === true ? 0 : clip.left),
    right: clip.right === false ? chart.width : area.right + (clip.right === true ? 0 : clip.right),
    top: clip.top === false ? 0 : area.top - (clip.top === true ? 0 : clip.top),
    bottom: clip.bottom === false ? chart.height : area.bottom + (clip.bottom === true ? 0 : clip.bottom)
  };
}
/*!
 * Chart.js v4.5.0
 * https://www.chartjs.org
 * (c) 2025 Chart.js Contributors
 * Released under the MIT License
 */
class Animator {
  constructor() {
    this._request = null;
    this._charts = /* @__PURE__ */ new Map();
    this._running = false;
    this._lastDate = void 0;
  }
  _notify(chart, anims, date4, type4) {
    const callbacks = anims.listeners[type4];
    const numSteps = anims.duration;
    callbacks.forEach((fn) => fn({
      chart,
      initial: anims.initial,
      numSteps,
      currentStep: Math.min(date4 - anims.start, numSteps)
    }));
  }
  _refresh() {
    if (this._request) {
      return;
    }
    this._running = true;
    this._request = requestAnimFrame.call(window, () => {
      this._update();
      this._request = null;
      if (this._running) {
        this._refresh();
      }
    });
  }
  _update(date4 = Date.now()) {
    let remaining = 0;
    this._charts.forEach((anims, chart) => {
      if (!anims.running || !anims.items.length) {
        return;
      }
      const items = anims.items;
      let i2 = items.length - 1;
      let draw2 = false;
      let item;
      for (; i2 >= 0; --i2) {
        item = items[i2];
        if (item._active) {
          if (item._total > anims.duration) {
            anims.duration = item._total;
          }
          item.tick(date4);
          draw2 = true;
        } else {
          items[i2] = items[items.length - 1];
          items.pop();
        }
      }
      if (draw2) {
        chart.draw();
        this._notify(chart, anims, date4, "progress");
      }
      if (!items.length) {
        anims.running = false;
        this._notify(chart, anims, date4, "complete");
        anims.initial = false;
      }
      remaining += items.length;
    });
    this._lastDate = date4;
    if (remaining === 0) {
      this._running = false;
    }
  }
  _getAnims(chart) {
    const charts = this._charts;
    let anims = charts.get(chart);
    if (!anims) {
      anims = {
        running: false,
        initial: true,
        items: [],
        listeners: {
          complete: [],
          progress: []
        }
      };
      charts.set(chart, anims);
    }
    return anims;
  }
  listen(chart, event, cb2) {
    this._getAnims(chart).listeners[event].push(cb2);
  }
  add(chart, items) {
    if (!items || !items.length) {
      return;
    }
    this._getAnims(chart).items.push(...items);
  }
  has(chart) {
    return this._getAnims(chart).items.length > 0;
  }
  start(chart) {
    const anims = this._charts.get(chart);
    if (!anims) {
      return;
    }
    anims.running = true;
    anims.start = Date.now();
    anims.duration = anims.items.reduce((acc, cur) => Math.max(acc, cur._duration), 0);
    this._refresh();
  }
  running(chart) {
    if (!this._running) {
      return false;
    }
    const anims = this._charts.get(chart);
    if (!anims || !anims.running || !anims.items.length) {
      return false;
    }
    return true;
  }
  stop(chart) {
    const anims = this._charts.get(chart);
    if (!anims || !anims.items.length) {
      return;
    }
    const items = anims.items;
    let i2 = items.length - 1;
    for (; i2 >= 0; --i2) {
      items[i2].cancel();
    }
    anims.items = [];
    this._notify(chart, anims, Date.now(), "complete");
  }
  remove(chart) {
    return this._charts.delete(chart);
  }
}
var animator = /* @__PURE__ */ new Animator();
const transparent = "transparent";
const interpolators = {
  boolean(from2, to2, factor) {
    return factor > 0.5 ? to2 : from2;
  },
  color(from2, to2, factor) {
    const c0 = color$1(from2 || transparent);
    const c1 = c0.valid && color$1(to2 || transparent);
    return c1 && c1.valid ? c1.mix(c0, factor).hexString() : to2;
  },
  number(from2, to2, factor) {
    return from2 + (to2 - from2) * factor;
  }
};
class Animation {
  constructor(cfg, target, prop, to2) {
    const currentValue = target[prop];
    to2 = resolve([
      cfg.to,
      to2,
      currentValue,
      cfg.from
    ]);
    const from2 = resolve([
      cfg.from,
      currentValue,
      to2
    ]);
    this._active = true;
    this._fn = cfg.fn || interpolators[cfg.type || typeof from2];
    this._easing = effects[cfg.easing] || effects.linear;
    this._start = Math.floor(Date.now() + (cfg.delay || 0));
    this._duration = this._total = Math.floor(cfg.duration);
    this._loop = !!cfg.loop;
    this._target = target;
    this._prop = prop;
    this._from = from2;
    this._to = to2;
    this._promises = void 0;
  }
  active() {
    return this._active;
  }
  update(cfg, to2, date4) {
    if (this._active) {
      this._notify(false);
      const currentValue = this._target[this._prop];
      const elapsed = date4 - this._start;
      const remain = this._duration - elapsed;
      this._start = date4;
      this._duration = Math.floor(Math.max(remain, cfg.duration));
      this._total += elapsed;
      this._loop = !!cfg.loop;
      this._to = resolve([
        cfg.to,
        to2,
        currentValue,
        cfg.from
      ]);
      this._from = resolve([
        cfg.from,
        currentValue,
        to2
      ]);
    }
  }
  cancel() {
    if (this._active) {
      this.tick(Date.now());
      this._active = false;
      this._notify(false);
    }
  }
  tick(date4) {
    const elapsed = date4 - this._start;
    const duration2 = this._duration;
    const prop = this._prop;
    const from2 = this._from;
    const loop2 = this._loop;
    const to2 = this._to;
    let factor;
    this._active = from2 !== to2 && (loop2 || elapsed < duration2);
    if (!this._active) {
      this._target[prop] = to2;
      this._notify(true);
      return;
    }
    if (elapsed < 0) {
      this._target[prop] = from2;
      return;
    }
    factor = elapsed / duration2 % 2;
    factor = loop2 && factor > 1 ? 2 - factor : factor;
    factor = this._easing(Math.min(1, Math.max(0, factor)));
    this._target[prop] = this._fn(from2, to2, factor);
  }
  wait() {
    const promises = this._promises || (this._promises = []);
    return new Promise((res, rej) => {
      promises.push({
        res,
        rej
      });
    });
  }
  _notify(resolved) {
    const method4 = resolved ? "res" : "rej";
    const promises = this._promises || [];
    for (let i2 = 0; i2 < promises.length; i2++) {
      promises[i2][method4]();
    }
  }
}
class Animations {
  constructor(chart, config2) {
    this._chart = chart;
    this._properties = /* @__PURE__ */ new Map();
    this.configure(config2);
  }
  configure(config2) {
    if (!isObject$3(config2)) {
      return;
    }
    const animationOptions = Object.keys(defaults$2.animation);
    const animatedProps = this._properties;
    Object.getOwnPropertyNames(config2).forEach((key) => {
      const cfg = config2[key];
      if (!isObject$3(cfg)) {
        return;
      }
      const resolved = {};
      for (const option of animationOptions) {
        resolved[option] = cfg[option];
      }
      (isArray$4(cfg.properties) && cfg.properties || [
        key
      ]).forEach((prop) => {
        if (prop === key || !animatedProps.has(prop)) {
          animatedProps.set(prop, resolved);
        }
      });
    });
  }
  _animateOptions(target, values) {
    const newOptions = values.options;
    const options = resolveTargetOptions(target, newOptions);
    if (!options) {
      return [];
    }
    const animations2 = this._createAnimations(options, newOptions);
    if (newOptions.$shared) {
      awaitAll(target.options.$animations, newOptions).then(() => {
        target.options = newOptions;
      }, () => {
      });
    }
    return animations2;
  }
  _createAnimations(target, values) {
    const animatedProps = this._properties;
    const animations2 = [];
    const running = target.$animations || (target.$animations = {});
    const props = Object.keys(values);
    const date4 = Date.now();
    let i2;
    for (i2 = props.length - 1; i2 >= 0; --i2) {
      const prop = props[i2];
      if (prop.charAt(0) === "$") {
        continue;
      }
      if (prop === "options") {
        animations2.push(...this._animateOptions(target, values));
        continue;
      }
      const value2 = values[prop];
      let animation = running[prop];
      const cfg = animatedProps.get(prop);
      if (animation) {
        if (cfg && animation.active()) {
          animation.update(cfg, value2, date4);
          continue;
        } else {
          animation.cancel();
        }
      }
      if (!cfg || !cfg.duration) {
        target[prop] = value2;
        continue;
      }
      running[prop] = animation = new Animation(cfg, target, prop, value2);
      animations2.push(animation);
    }
    return animations2;
  }
  update(target, values) {
    if (this._properties.size === 0) {
      Object.assign(target, values);
      return;
    }
    const animations2 = this._createAnimations(target, values);
    if (animations2.length) {
      animator.add(this._chart, animations2);
      return true;
    }
  }
}
function awaitAll(animations2, properties2) {
  const running = [];
  const keys2 = Object.keys(properties2);
  for (let i2 = 0; i2 < keys2.length; i2++) {
    const anim = animations2[keys2[i2]];
    if (anim && anim.active()) {
      running.push(anim.wait());
    }
  }
  return Promise.all(running);
}
function resolveTargetOptions(target, newOptions) {
  if (!newOptions) {
    return;
  }
  let options = target.options;
  if (!options) {
    target.options = newOptions;
    return;
  }
  if (options.$shared) {
    target.options = options = Object.assign({}, options, {
      $shared: false,
      $animations: {}
    });
  }
  return options;
}
function scaleClip(scale2, allowedOverflow) {
  const opts2 = scale2 && scale2.options || {};
  const reverse = opts2.reverse;
  const min2 = opts2.min === void 0 ? allowedOverflow : 0;
  const max2 = opts2.max === void 0 ? allowedOverflow : 0;
  return {
    start: reverse ? max2 : min2,
    end: reverse ? min2 : max2
  };
}
function defaultClip(xScale, yScale, allowedOverflow) {
  if (allowedOverflow === false) {
    return false;
  }
  const x2 = scaleClip(xScale, allowedOverflow);
  const y2 = scaleClip(yScale, allowedOverflow);
  return {
    top: y2.end,
    right: x2.end,
    bottom: y2.start,
    left: x2.start
  };
}
function toClip(value2) {
  let t2, r2, b2, l2;
  if (isObject$3(value2)) {
    t2 = value2.top;
    r2 = value2.right;
    b2 = value2.bottom;
    l2 = value2.left;
  } else {
    t2 = r2 = b2 = l2 = value2;
  }
  return {
    top: t2,
    right: r2,
    bottom: b2,
    left: l2,
    disabled: value2 === false
  };
}
function getSortedDatasetIndices(chart, filterVisible) {
  const keys2 = [];
  const metasets = chart._getSortedDatasetMetas(filterVisible);
  let i2, ilen;
  for (i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
    keys2.push(metasets[i2].index);
  }
  return keys2;
}
function applyStack(stack, value2, dsIndex, options = {}) {
  const keys2 = stack.keys;
  const singleMode = options.mode === "single";
  let i2, ilen, datasetIndex, otherValue;
  if (value2 === null) {
    return;
  }
  let found = false;
  for (i2 = 0, ilen = keys2.length; i2 < ilen; ++i2) {
    datasetIndex = +keys2[i2];
    if (datasetIndex === dsIndex) {
      found = true;
      if (options.all) {
        continue;
      }
      break;
    }
    otherValue = stack.values[datasetIndex];
    if (isNumberFinite(otherValue) && (singleMode || value2 === 0 || sign$1(value2) === sign$1(otherValue))) {
      value2 += otherValue;
    }
  }
  if (!found && !options.all) {
    return 0;
  }
  return value2;
}
function convertObjectDataToArray(data, meta) {
  const { iScale, vScale } = meta;
  const iAxisKey = iScale.axis === "x" ? "x" : "y";
  const vAxisKey = vScale.axis === "x" ? "x" : "y";
  const keys2 = Object.keys(data);
  const adata = new Array(keys2.length);
  let i2, ilen, key;
  for (i2 = 0, ilen = keys2.length; i2 < ilen; ++i2) {
    key = keys2[i2];
    adata[i2] = {
      [iAxisKey]: key,
      [vAxisKey]: data[key]
    };
  }
  return adata;
}
function isStacked(scale2, meta) {
  const stacked = scale2 && scale2.options.stacked;
  return stacked || stacked === void 0 && meta.stack !== void 0;
}
function getStackKey(indexScale, valueScale, meta) {
  return `${indexScale.id}.${valueScale.id}.${meta.stack || meta.type}`;
}
function getUserBounds(scale2) {
  const { min: min2, max: max2, minDefined, maxDefined } = scale2.getUserBounds();
  return {
    min: minDefined ? min2 : Number.NEGATIVE_INFINITY,
    max: maxDefined ? max2 : Number.POSITIVE_INFINITY
  };
}
function getOrCreateStack(stacks, stackKey, indexValue) {
  const subStack = stacks[stackKey] || (stacks[stackKey] = {});
  return subStack[indexValue] || (subStack[indexValue] = {});
}
function getLastIndexInStack(stack, vScale, positive, type4) {
  for (const meta of vScale.getMatchingVisibleMetas(type4).reverse()) {
    const value2 = stack[meta.index];
    if (positive && value2 > 0 || !positive && value2 < 0) {
      return meta.index;
    }
  }
  return null;
}
function updateStacks(controller, parsed) {
  const { chart, _cachedMeta: meta } = controller;
  const stacks = chart._stacks || (chart._stacks = {});
  const { iScale, vScale, index: datasetIndex } = meta;
  const iAxis = iScale.axis;
  const vAxis = vScale.axis;
  const key = getStackKey(iScale, vScale, meta);
  const ilen = parsed.length;
  let stack;
  for (let i2 = 0; i2 < ilen; ++i2) {
    const item = parsed[i2];
    const { [iAxis]: index2, [vAxis]: value2 } = item;
    const itemStacks = item._stacks || (item._stacks = {});
    stack = itemStacks[vAxis] = getOrCreateStack(stacks, key, index2);
    stack[datasetIndex] = value2;
    stack._top = getLastIndexInStack(stack, vScale, true, meta.type);
    stack._bottom = getLastIndexInStack(stack, vScale, false, meta.type);
    const visualValues = stack._visualValues || (stack._visualValues = {});
    visualValues[datasetIndex] = value2;
  }
}
function getFirstScaleId(chart, axis) {
  const scales = chart.scales;
  return Object.keys(scales).filter((key) => scales[key].axis === axis).shift();
}
function createDatasetContext(parent, index2) {
  return createContext(parent, {
    active: false,
    dataset: void 0,
    datasetIndex: index2,
    index: index2,
    mode: "default",
    type: "dataset"
  });
}
function createDataContext(parent, index2, element2) {
  return createContext(parent, {
    active: false,
    dataIndex: index2,
    parsed: void 0,
    raw: void 0,
    element: element2,
    index: index2,
    mode: "default",
    type: "data"
  });
}
function clearStacks(meta, items) {
  const datasetIndex = meta.controller.index;
  const axis = meta.vScale && meta.vScale.axis;
  if (!axis) {
    return;
  }
  items = items || meta._parsed;
  for (const parsed of items) {
    const stacks = parsed._stacks;
    if (!stacks || stacks[axis] === void 0 || stacks[axis][datasetIndex] === void 0) {
      return;
    }
    delete stacks[axis][datasetIndex];
    if (stacks[axis]._visualValues !== void 0 && stacks[axis]._visualValues[datasetIndex] !== void 0) {
      delete stacks[axis]._visualValues[datasetIndex];
    }
  }
}
const isDirectUpdateMode = (mode) => mode === "reset" || mode === "none";
const cloneIfNotShared = (cached, shared) => shared ? cached : Object.assign({}, cached);
const createStack = (canStack, meta, chart) => canStack && !meta.hidden && meta._stacked && {
  keys: getSortedDatasetIndices(chart, true),
  values: null
};
class DatasetController {
  constructor(chart, datasetIndex) {
    this.chart = chart;
    this._ctx = chart.ctx;
    this.index = datasetIndex;
    this._cachedDataOpts = {};
    this._cachedMeta = this.getMeta();
    this._type = this._cachedMeta.type;
    this.options = void 0;
    this._parsing = false;
    this._data = void 0;
    this._objectData = void 0;
    this._sharedOptions = void 0;
    this._drawStart = void 0;
    this._drawCount = void 0;
    this.enableOptionSharing = false;
    this.supportsDecimation = false;
    this.$context = void 0;
    this._syncList = [];
    this.datasetElementType = new.target.datasetElementType;
    this.dataElementType = new.target.dataElementType;
    this.initialize();
  }
  initialize() {
    const meta = this._cachedMeta;
    this.configure();
    this.linkScales();
    meta._stacked = isStacked(meta.vScale, meta);
    this.addElements();
    if (this.options.fill && !this.chart.isPluginEnabled("filler")) {
      console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options");
    }
  }
  updateIndex(datasetIndex) {
    if (this.index !== datasetIndex) {
      clearStacks(this._cachedMeta);
    }
    this.index = datasetIndex;
  }
  linkScales() {
    const chart = this.chart;
    const meta = this._cachedMeta;
    const dataset = this.getDataset();
    const chooseId = (axis, x2, y2, r2) => axis === "x" ? x2 : axis === "r" ? r2 : y2;
    const xid = meta.xAxisID = valueOrDefault(dataset.xAxisID, getFirstScaleId(chart, "x"));
    const yid = meta.yAxisID = valueOrDefault(dataset.yAxisID, getFirstScaleId(chart, "y"));
    const rid = meta.rAxisID = valueOrDefault(dataset.rAxisID, getFirstScaleId(chart, "r"));
    const indexAxis = meta.indexAxis;
    const iid = meta.iAxisID = chooseId(indexAxis, xid, yid, rid);
    const vid = meta.vAxisID = chooseId(indexAxis, yid, xid, rid);
    meta.xScale = this.getScaleForId(xid);
    meta.yScale = this.getScaleForId(yid);
    meta.rScale = this.getScaleForId(rid);
    meta.iScale = this.getScaleForId(iid);
    meta.vScale = this.getScaleForId(vid);
  }
  getDataset() {
    return this.chart.data.datasets[this.index];
  }
  getMeta() {
    return this.chart.getDatasetMeta(this.index);
  }
  getScaleForId(scaleID) {
    return this.chart.scales[scaleID];
  }
  _getOtherScale(scale2) {
    const meta = this._cachedMeta;
    return scale2 === meta.iScale ? meta.vScale : meta.iScale;
  }
  reset() {
    this._update("reset");
  }
  _destroy() {
    const meta = this._cachedMeta;
    if (this._data) {
      unlistenArrayEvents(this._data, this);
    }
    if (meta._stacked) {
      clearStacks(meta);
    }
  }
  _dataCheck() {
    const dataset = this.getDataset();
    const data = dataset.data || (dataset.data = []);
    const _data = this._data;
    if (isObject$3(data)) {
      const meta = this._cachedMeta;
      this._data = convertObjectDataToArray(data, meta);
    } else if (_data !== data) {
      if (_data) {
        unlistenArrayEvents(_data, this);
        const meta = this._cachedMeta;
        clearStacks(meta);
        meta._parsed = [];
      }
      if (data && Object.isExtensible(data)) {
        listenArrayEvents(data, this);
      }
      this._syncList = [];
      this._data = data;
    }
  }
  addElements() {
    const meta = this._cachedMeta;
    this._dataCheck();
    if (this.datasetElementType) {
      meta.dataset = new this.datasetElementType();
    }
  }
  buildOrUpdateElements(resetNewElements) {
    const meta = this._cachedMeta;
    const dataset = this.getDataset();
    let stackChanged = false;
    this._dataCheck();
    const oldStacked = meta._stacked;
    meta._stacked = isStacked(meta.vScale, meta);
    if (meta.stack !== dataset.stack) {
      stackChanged = true;
      clearStacks(meta);
      meta.stack = dataset.stack;
    }
    this._resyncElements(resetNewElements);
    if (stackChanged || oldStacked !== meta._stacked) {
      updateStacks(this, meta._parsed);
      meta._stacked = isStacked(meta.vScale, meta);
    }
  }
  configure() {
    const config2 = this.chart.config;
    const scopeKeys = config2.datasetScopeKeys(this._type);
    const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys, true);
    this.options = config2.createResolver(scopes, this.getContext());
    this._parsing = this.options.parsing;
    this._cachedDataOpts = {};
  }
  parse(start, count) {
    const { _cachedMeta: meta, _data: data } = this;
    const { iScale, _stacked } = meta;
    const iAxis = iScale.axis;
    let sorted = start === 0 && count === data.length ? true : meta._sorted;
    let prev2 = start > 0 && meta._parsed[start - 1];
    let i2, cur, parsed;
    if (this._parsing === false) {
      meta._parsed = data;
      meta._sorted = true;
      parsed = data;
    } else {
      if (isArray$4(data[start])) {
        parsed = this.parseArrayData(meta, data, start, count);
      } else if (isObject$3(data[start])) {
        parsed = this.parseObjectData(meta, data, start, count);
      } else {
        parsed = this.parsePrimitiveData(meta, data, start, count);
      }
      const isNotInOrderComparedToPrev = () => cur[iAxis] === null || prev2 && cur[iAxis] < prev2[iAxis];
      for (i2 = 0; i2 < count; ++i2) {
        meta._parsed[i2 + start] = cur = parsed[i2];
        if (sorted) {
          if (isNotInOrderComparedToPrev()) {
            sorted = false;
          }
          prev2 = cur;
        }
      }
      meta._sorted = sorted;
    }
    if (_stacked) {
      updateStacks(this, parsed);
    }
  }
  parsePrimitiveData(meta, data, start, count) {
    const { iScale, vScale } = meta;
    const iAxis = iScale.axis;
    const vAxis = vScale.axis;
    const labels = iScale.getLabels();
    const singleScale = iScale === vScale;
    const parsed = new Array(count);
    let i2, ilen, index2;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start;
      parsed[i2] = {
        [iAxis]: singleScale || iScale.parse(labels[index2], index2),
        [vAxis]: vScale.parse(data[index2], index2)
      };
    }
    return parsed;
  }
  parseArrayData(meta, data, start, count) {
    const { xScale, yScale } = meta;
    const parsed = new Array(count);
    let i2, ilen, index2, item;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start;
      item = data[index2];
      parsed[i2] = {
        x: xScale.parse(item[0], index2),
        y: yScale.parse(item[1], index2)
      };
    }
    return parsed;
  }
  parseObjectData(meta, data, start, count) {
    const { xScale, yScale } = meta;
    const { xAxisKey = "x", yAxisKey = "y" } = this._parsing;
    const parsed = new Array(count);
    let i2, ilen, index2, item;
    for (i2 = 0, ilen = count; i2 < ilen; ++i2) {
      index2 = i2 + start;
      item = data[index2];
      parsed[i2] = {
        x: xScale.parse(resolveObjectKey(item, xAxisKey), index2),
        y: yScale.parse(resolveObjectKey(item, yAxisKey), index2)
      };
    }
    return parsed;
  }
  getParsed(index2) {
    return this._cachedMeta._parsed[index2];
  }
  getDataElement(index2) {
    return this._cachedMeta.data[index2];
  }
  applyStack(scale2, parsed, mode) {
    const chart = this.chart;
    const meta = this._cachedMeta;
    const value2 = parsed[scale2.axis];
    const stack = {
      keys: getSortedDatasetIndices(chart, true),
      values: parsed._stacks[scale2.axis]._visualValues
    };
    return applyStack(stack, value2, meta.index, {
      mode
    });
  }
  updateRangeFromParsed(range3, scale2, parsed, stack) {
    const parsedValue = parsed[scale2.axis];
    let value2 = parsedValue === null ? NaN : parsedValue;
    const values = stack && parsed._stacks[scale2.axis];
    if (stack && values) {
      stack.values = values;
      value2 = applyStack(stack, parsedValue, this._cachedMeta.index);
    }
    range3.min = Math.min(range3.min, value2);
    range3.max = Math.max(range3.max, value2);
  }
  getMinMax(scale2, canStack) {
    const meta = this._cachedMeta;
    const _parsed = meta._parsed;
    const sorted = meta._sorted && scale2 === meta.iScale;
    const ilen = _parsed.length;
    const otherScale = this._getOtherScale(scale2);
    const stack = createStack(canStack, meta, this.chart);
    const range3 = {
      min: Number.POSITIVE_INFINITY,
      max: Number.NEGATIVE_INFINITY
    };
    const { min: otherMin, max: otherMax } = getUserBounds(otherScale);
    let i2, parsed;
    function _skip() {
      parsed = _parsed[i2];
      const otherValue = parsed[otherScale.axis];
      return !isNumberFinite(parsed[scale2.axis]) || otherMin > otherValue || otherMax < otherValue;
    }
    for (i2 = 0; i2 < ilen; ++i2) {
      if (_skip()) {
        continue;
      }
      this.updateRangeFromParsed(range3, scale2, parsed, stack);
      if (sorted) {
        break;
      }
    }
    if (sorted) {
      for (i2 = ilen - 1; i2 >= 0; --i2) {
        if (_skip()) {
          continue;
        }
        this.updateRangeFromParsed(range3, scale2, parsed, stack);
        break;
      }
    }
    return range3;
  }
  getAllParsedValues(scale2) {
    const parsed = this._cachedMeta._parsed;
    const values = [];
    let i2, ilen, value2;
    for (i2 = 0, ilen = parsed.length; i2 < ilen; ++i2) {
      value2 = parsed[i2][scale2.axis];
      if (isNumberFinite(value2)) {
        values.push(value2);
      }
    }
    return values;
  }
  getMaxOverflow() {
    return false;
  }
  getLabelAndValue(index2) {
    const meta = this._cachedMeta;
    const iScale = meta.iScale;
    const vScale = meta.vScale;
    const parsed = this.getParsed(index2);
    return {
      label: iScale ? "" + iScale.getLabelForValue(parsed[iScale.axis]) : "",
      value: vScale ? "" + vScale.getLabelForValue(parsed[vScale.axis]) : ""
    };
  }
  _update(mode) {
    const meta = this._cachedMeta;
    this.update(mode || "default");
    meta._clip = toClip(valueOrDefault(this.options.clip, defaultClip(meta.xScale, meta.yScale, this.getMaxOverflow())));
  }
  update(mode) {
  }
  draw() {
    const ctx = this._ctx;
    const chart = this.chart;
    const meta = this._cachedMeta;
    const elements = meta.data || [];
    const area = chart.chartArea;
    const active3 = [];
    const start = this._drawStart || 0;
    const count = this._drawCount || elements.length - start;
    const drawActiveElementsOnTop = this.options.drawActiveElementsOnTop;
    let i2;
    if (meta.dataset) {
      meta.dataset.draw(ctx, area, start, count);
    }
    for (i2 = start; i2 < start + count; ++i2) {
      const element2 = elements[i2];
      if (element2.hidden) {
        continue;
      }
      if (element2.active && drawActiveElementsOnTop) {
        active3.push(element2);
      } else {
        element2.draw(ctx, area);
      }
    }
    for (i2 = 0; i2 < active3.length; ++i2) {
      active3[i2].draw(ctx, area);
    }
  }
  getStyle(index2, active3) {
    const mode = active3 ? "active" : "default";
    return index2 === void 0 && this._cachedMeta.dataset ? this.resolveDatasetElementOptions(mode) : this.resolveDataElementOptions(index2 || 0, mode);
  }
  getContext(index2, active3, mode) {
    const dataset = this.getDataset();
    let context;
    if (index2 >= 0 && index2 < this._cachedMeta.data.length) {
      const element2 = this._cachedMeta.data[index2];
      context = element2.$context || (element2.$context = createDataContext(this.getContext(), index2, element2));
      context.parsed = this.getParsed(index2);
      context.raw = dataset.data[index2];
      context.index = context.dataIndex = index2;
    } else {
      context = this.$context || (this.$context = createDatasetContext(this.chart.getContext(), this.index));
      context.dataset = dataset;
      context.index = context.datasetIndex = this.index;
    }
    context.active = !!active3;
    context.mode = mode;
    return context;
  }
  resolveDatasetElementOptions(mode) {
    return this._resolveElementOptions(this.datasetElementType.id, mode);
  }
  resolveDataElementOptions(index2, mode) {
    return this._resolveElementOptions(this.dataElementType.id, mode, index2);
  }
  _resolveElementOptions(elementType, mode = "default", index2) {
    const active3 = mode === "active";
    const cache2 = this._cachedDataOpts;
    const cacheKey = elementType + "-" + mode;
    const cached = cache2[cacheKey];
    const sharing = this.enableOptionSharing && defined(index2);
    if (cached) {
      return cloneIfNotShared(cached, sharing);
    }
    const config2 = this.chart.config;
    const scopeKeys = config2.datasetElementScopeKeys(this._type, elementType);
    const prefixes2 = active3 ? [
      `${elementType}Hover`,
      "hover",
      elementType,
      ""
    ] : [
      elementType,
      ""
    ];
    const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
    const names2 = Object.keys(defaults$2.elements[elementType]);
    const context = () => this.getContext(index2, active3, mode);
    const values = config2.resolveNamedOptions(scopes, names2, context, prefixes2);
    if (values.$shared) {
      values.$shared = sharing;
      cache2[cacheKey] = Object.freeze(cloneIfNotShared(values, sharing));
    }
    return values;
  }
  _resolveAnimations(index2, transition3, active3) {
    const chart = this.chart;
    const cache2 = this._cachedDataOpts;
    const cacheKey = `animation-${transition3}`;
    const cached = cache2[cacheKey];
    if (cached) {
      return cached;
    }
    let options;
    if (chart.options.animation !== false) {
      const config2 = this.chart.config;
      const scopeKeys = config2.datasetAnimationScopeKeys(this._type, transition3);
      const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
      options = config2.createResolver(scopes, this.getContext(index2, active3, transition3));
    }
    const animations2 = new Animations(chart, options && options.animations);
    if (options && options._cacheable) {
      cache2[cacheKey] = Object.freeze(animations2);
    }
    return animations2;
  }
  getSharedOptions(options) {
    if (!options.$shared) {
      return;
    }
    return this._sharedOptions || (this._sharedOptions = Object.assign({}, options));
  }
  includeOptions(mode, sharedOptions) {
    return !sharedOptions || isDirectUpdateMode(mode) || this.chart._animationsDisabled;
  }
  _getSharedOptions(start, mode) {
    const firstOpts = this.resolveDataElementOptions(start, mode);
    const previouslySharedOptions = this._sharedOptions;
    const sharedOptions = this.getSharedOptions(firstOpts);
    const includeOptions = this.includeOptions(mode, sharedOptions) || sharedOptions !== previouslySharedOptions;
    this.updateSharedOptions(sharedOptions, mode, firstOpts);
    return {
      sharedOptions,
      includeOptions
    };
  }
  updateElement(element2, index2, properties2, mode) {
    if (isDirectUpdateMode(mode)) {
      Object.assign(element2, properties2);
    } else {
      this._resolveAnimations(index2, mode).update(element2, properties2);
    }
  }
  updateSharedOptions(sharedOptions, mode, newOptions) {
    if (sharedOptions && !isDirectUpdateMode(mode)) {
      this._resolveAnimations(void 0, mode).update(sharedOptions, newOptions);
    }
  }
  _setStyle(element2, index2, mode, active3) {
    element2.active = active3;
    const options = this.getStyle(index2, active3);
    this._resolveAnimations(index2, mode, active3).update(element2, {
      options: !active3 && this.getSharedOptions(options) || options
    });
  }
  removeHoverStyle(element2, datasetIndex, index2) {
    this._setStyle(element2, index2, "active", false);
  }
  setHoverStyle(element2, datasetIndex, index2) {
    this._setStyle(element2, index2, "active", true);
  }
  _removeDatasetHoverStyle() {
    const element2 = this._cachedMeta.dataset;
    if (element2) {
      this._setStyle(element2, void 0, "active", false);
    }
  }
  _setDatasetHoverStyle() {
    const element2 = this._cachedMeta.dataset;
    if (element2) {
      this._setStyle(element2, void 0, "active", true);
    }
  }
  _resyncElements(resetNewElements) {
    const data = this._data;
    const elements = this._cachedMeta.data;
    for (const [method4, arg1, arg2] of this._syncList) {
      this[method4](arg1, arg2);
    }
    this._syncList = [];
    const numMeta = elements.length;
    const numData = data.length;
    const count = Math.min(numData, numMeta);
    if (count) {
      this.parse(0, count);
    }
    if (numData > numMeta) {
      this._insertElements(numMeta, numData - numMeta, resetNewElements);
    } else if (numData < numMeta) {
      this._removeElements(numData, numMeta - numData);
    }
  }
  _insertElements(start, count, resetNewElements = true) {
    const meta = this._cachedMeta;
    const data = meta.data;
    const end = start + count;
    let i2;
    const move2 = (arr) => {
      arr.length += count;
      for (i2 = arr.length - 1; i2 >= end; i2--) {
        arr[i2] = arr[i2 - count];
      }
    };
    move2(data);
    for (i2 = start; i2 < end; ++i2) {
      data[i2] = new this.dataElementType();
    }
    if (this._parsing) {
      move2(meta._parsed);
    }
    this.parse(start, count);
    if (resetNewElements) {
      this.updateElements(data, start, count, "reset");
    }
  }
  updateElements(element2, start, count, mode) {
  }
  _removeElements(start, count) {
    const meta = this._cachedMeta;
    if (this._parsing) {
      const removed = meta._parsed.splice(start, count);
      if (meta._stacked) {
        clearStacks(meta, removed);
      }
    }
    meta.data.splice(start, count);
  }
  _sync(args) {
    if (this._parsing) {
      this._syncList.push(args);
    } else {
      const [method4, arg1, arg2] = args;
      this[method4](arg1, arg2);
    }
    this.chart._dataChanges.push([
      this.index,
      ...args
    ]);
  }
  _onDataPush() {
    const count = arguments.length;
    this._sync([
      "_insertElements",
      this.getDataset().data.length - count,
      count
    ]);
  }
  _onDataPop() {
    this._sync([
      "_removeElements",
      this._cachedMeta.data.length - 1,
      1
    ]);
  }
  _onDataShift() {
    this._sync([
      "_removeElements",
      0,
      1
    ]);
  }
  _onDataSplice(start, count) {
    if (count) {
      this._sync([
        "_removeElements",
        start,
        count
      ]);
    }
    const newCount = arguments.length - 2;
    if (newCount) {
      this._sync([
        "_insertElements",
        start,
        newCount
      ]);
    }
  }
  _onDataUnshift() {
    this._sync([
      "_insertElements",
      0,
      arguments.length
    ]);
  }
}
__publicField(DatasetController, "defaults", {});
__publicField(DatasetController, "datasetElementType", null);
__publicField(DatasetController, "dataElementType", null);
function getAllScaleValues(scale2, type4) {
  if (!scale2._cache.$bar) {
    const visibleMetas = scale2.getMatchingVisibleMetas(type4);
    let values = [];
    for (let i2 = 0, ilen = visibleMetas.length; i2 < ilen; i2++) {
      values = values.concat(visibleMetas[i2].controller.getAllParsedValues(scale2));
    }
    scale2._cache.$bar = _arrayUnique(values.sort((a2, b2) => a2 - b2));
  }
  return scale2._cache.$bar;
}
function computeMinSampleSize(meta) {
  const scale2 = meta.iScale;
  const values = getAllScaleValues(scale2, meta.type);
  let min2 = scale2._length;
  let i2, ilen, curr, prev2;
  const updateMinAndPrev = () => {
    if (curr === 32767 || curr === -32768) {
      return;
    }
    if (defined(prev2)) {
      min2 = Math.min(min2, Math.abs(curr - prev2) || min2);
    }
    prev2 = curr;
  };
  for (i2 = 0, ilen = values.length; i2 < ilen; ++i2) {
    curr = scale2.getPixelForValue(values[i2]);
    updateMinAndPrev();
  }
  prev2 = void 0;
  for (i2 = 0, ilen = scale2.ticks.length; i2 < ilen; ++i2) {
    curr = scale2.getPixelForTick(i2);
    updateMinAndPrev();
  }
  return min2;
}
function computeFitCategoryTraits(index2, ruler, options, stackCount) {
  const thickness = options.barThickness;
  let size2, ratio;
  if (isNullOrUndef(thickness)) {
    size2 = ruler.min * options.categoryPercentage;
    ratio = options.barPercentage;
  } else {
    size2 = thickness * stackCount;
    ratio = 1;
  }
  return {
    chunk: size2 / stackCount,
    ratio,
    start: ruler.pixels[index2] - size2 / 2
  };
}
function computeFlexCategoryTraits(index2, ruler, options, stackCount) {
  const pixels = ruler.pixels;
  const curr = pixels[index2];
  let prev2 = index2 > 0 ? pixels[index2 - 1] : null;
  let next2 = index2 < pixels.length - 1 ? pixels[index2 + 1] : null;
  const percent2 = options.categoryPercentage;
  if (prev2 === null) {
    prev2 = curr - (next2 === null ? ruler.end - ruler.start : next2 - curr);
  }
  if (next2 === null) {
    next2 = curr + curr - prev2;
  }
  const start = curr - (curr - Math.min(prev2, next2)) / 2 * percent2;
  const size2 = Math.abs(next2 - prev2) / 2 * percent2;
  return {
    chunk: size2 / stackCount,
    ratio: options.barPercentage,
    start
  };
}
function parseFloatBar(entry, item, vScale, i2) {
  const startValue = vScale.parse(entry[0], i2);
  const endValue = vScale.parse(entry[1], i2);
  const min2 = Math.min(startValue, endValue);
  const max2 = Math.max(startValue, endValue);
  let barStart = min2;
  let barEnd = max2;
  if (Math.abs(min2) > Math.abs(max2)) {
    barStart = max2;
    barEnd = min2;
  }
  item[vScale.axis] = barEnd;
  item._custom = {
    barStart,
    barEnd,
    start: startValue,
    end: endValue,
    min: min2,
    max: max2
  };
}
function parseValue(entry, item, vScale, i2) {
  if (isArray$4(entry)) {
    parseFloatBar(entry, item, vScale, i2);
  } else {
    item[vScale.axis] = vScale.parse(entry, i2);
  }
  return item;
}
function parseArrayOrPrimitive(meta, data, start, count) {
  const iScale = meta.iScale;
  const vScale = meta.vScale;
  const labels = iScale.getLabels();
  const singleScale = iScale === vScale;
  const parsed = [];
  let i2, ilen, item, entry;
  for (i2 = start, ilen = start + count; i2 < ilen; ++i2) {
    entry = data[i2];
    item = {};
    item[iScale.axis] = singleScale || iScale.parse(labels[i2], i2);
    parsed.push(parseValue(entry, item, vScale, i2));
  }
  return parsed;
}
function isFloatBar(custom) {
  return custom && custom.barStart !== void 0 && custom.barEnd !== void 0;
}
function barSign(size2, vScale, actualBase) {
  if (size2 !== 0) {
    return sign$1(size2);
  }
  return (vScale.isHorizontal() ? 1 : -1) * (vScale.min >= actualBase ? 1 : -1);
}
function borderProps(properties2) {
  let reverse, start, end, top2, bottom2;
  if (properties2.horizontal) {
    reverse = properties2.base > properties2.x;
    start = "left";
    end = "right";
  } else {
    reverse = properties2.base < properties2.y;
    start = "bottom";
    end = "top";
  }
  if (reverse) {
    top2 = "end";
    bottom2 = "start";
  } else {
    top2 = "start";
    bottom2 = "end";
  }
  return {
    start,
    end,
    reverse,
    top: top2,
    bottom: bottom2
  };
}
function setBorderSkipped(properties2, options, stack, index2) {
  let edge = options.borderSkipped;
  const res = {};
  if (!edge) {
    properties2.borderSkipped = res;
    return;
  }
  if (edge === true) {
    properties2.borderSkipped = {
      top: true,
      right: true,
      bottom: true,
      left: true
    };
    return;
  }
  const { start, end, reverse, top: top2, bottom: bottom2 } = borderProps(properties2);
  if (edge === "middle" && stack) {
    properties2.enableBorderRadius = true;
    if ((stack._top || 0) === index2) {
      edge = top2;
    } else if ((stack._bottom || 0) === index2) {
      edge = bottom2;
    } else {
      res[parseEdge(bottom2, start, end, reverse)] = true;
      edge = top2;
    }
  }
  res[parseEdge(edge, start, end, reverse)] = true;
  properties2.borderSkipped = res;
}
function parseEdge(edge, a2, b2, reverse) {
  if (reverse) {
    edge = swap(edge, a2, b2);
    edge = startEnd(edge, b2, a2);
  } else {
    edge = startEnd(edge, a2, b2);
  }
  return edge;
}
function swap(orig, v1, v2) {
  return orig === v1 ? v2 : orig === v2 ? v1 : orig;
}
function startEnd(v2, start, end) {
  return v2 === "start" ? start : v2 === "end" ? end : v2;
}
function setInflateAmount(properties2, { inflateAmount }, ratio) {
  properties2.inflateAmount = inflateAmount === "auto" ? ratio === 1 ? 0.33 : 0 : inflateAmount;
}
class BarController extends DatasetController {
  parsePrimitiveData(meta, data, start, count) {
    return parseArrayOrPrimitive(meta, data, start, count);
  }
  parseArrayData(meta, data, start, count) {
    return parseArrayOrPrimitive(meta, data, start, count);
  }
  parseObjectData(meta, data, start, count) {
    const { iScale, vScale } = meta;
    const { xAxisKey = "x", yAxisKey = "y" } = this._parsing;
    const iAxisKey = iScale.axis === "x" ? xAxisKey : yAxisKey;
    const vAxisKey = vScale.axis === "x" ? xAxisKey : yAxisKey;
    const parsed = [];
    let i2, ilen, item, obj;
    for (i2 = start, ilen = start + count; i2 < ilen; ++i2) {
      obj = data[i2];
      item = {};
      item[iScale.axis] = iScale.parse(resolveObjectKey(obj, iAxisKey), i2);
      parsed.push(parseValue(resolveObjectKey(obj, vAxisKey), item, vScale, i2));
    }
    return parsed;
  }
  updateRangeFromParsed(range3, scale2, parsed, stack) {
    super.updateRangeFromParsed(range3, scale2, parsed, stack);
    const custom = parsed._custom;
    if (custom && scale2 === this._cachedMeta.vScale) {
      range3.min = Math.min(range3.min, custom.min);
      range3.max = Math.max(range3.max, custom.max);
    }
  }
  getMaxOverflow() {
    return 0;
  }
  getLabelAndValue(index2) {
    const meta = this._cachedMeta;
    const { iScale, vScale } = meta;
    const parsed = this.getParsed(index2);
    const custom = parsed._custom;
    const value2 = isFloatBar(custom) ? "[" + custom.start + ", " + custom.end + "]" : "" + vScale.getLabelForValue(parsed[vScale.axis]);
    return {
      label: "" + iScale.getLabelForValue(parsed[iScale.axis]),
      value: value2
    };
  }
  initialize() {
    this.enableOptionSharing = true;
    super.initialize();
    const meta = this._cachedMeta;
    meta.stack = this.getDataset().stack;
  }
  update(mode) {
    const meta = this._cachedMeta;
    this.updateElements(meta.data, 0, meta.data.length, mode);
  }
  updateElements(bars, start, count, mode) {
    const reset = mode === "reset";
    const { index: index2, _cachedMeta: { vScale } } = this;
    const base = vScale.getBasePixel();
    const horizontal = vScale.isHorizontal();
    const ruler = this._getRuler();
    const { sharedOptions, includeOptions } = this._getSharedOptions(start, mode);
    for (let i2 = start; i2 < start + count; i2++) {
      const parsed = this.getParsed(i2);
      const vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {
        base,
        head: base
      } : this._calculateBarValuePixels(i2);
      const ipixels = this._calculateBarIndexPixels(i2, ruler);
      const stack = (parsed._stacks || {})[vScale.axis];
      const properties2 = {
        horizontal,
        base: vpixels.base,
        enableBorderRadius: !stack || isFloatBar(parsed._custom) || index2 === stack._top || index2 === stack._bottom,
        x: horizontal ? vpixels.head : ipixels.center,
        y: horizontal ? ipixels.center : vpixels.head,
        height: horizontal ? ipixels.size : Math.abs(vpixels.size),
        width: horizontal ? Math.abs(vpixels.size) : ipixels.size
      };
      if (includeOptions) {
        properties2.options = sharedOptions || this.resolveDataElementOptions(i2, bars[i2].active ? "active" : mode);
      }
      const options = properties2.options || bars[i2].options;
      setBorderSkipped(properties2, options, stack, index2);
      setInflateAmount(properties2, options, ruler.ratio);
      this.updateElement(bars[i2], i2, properties2, mode);
    }
  }
  _getStacks(last, dataIndex) {
    const { iScale } = this._cachedMeta;
    const metasets = iScale.getMatchingVisibleMetas(this._type).filter((meta) => meta.controller.options.grouped);
    const stacked = iScale.options.stacked;
    const stacks = [];
    const currentParsed = this._cachedMeta.controller.getParsed(dataIndex);
    const iScaleValue = currentParsed && currentParsed[iScale.axis];
    const skipNull = (meta) => {
      const parsed = meta._parsed.find((item) => item[iScale.axis] === iScaleValue);
      const val = parsed && parsed[meta.vScale.axis];
      if (isNullOrUndef(val) || isNaN(val)) {
        return true;
      }
    };
    for (const meta of metasets) {
      if (dataIndex !== void 0 && skipNull(meta)) {
        continue;
      }
      if (stacked === false || stacks.indexOf(meta.stack) === -1 || stacked === void 0 && meta.stack === void 0) {
        stacks.push(meta.stack);
      }
      if (meta.index === last) {
        break;
      }
    }
    if (!stacks.length) {
      stacks.push(void 0);
    }
    return stacks;
  }
  _getStackCount(index2) {
    return this._getStacks(void 0, index2).length;
  }
  _getAxisCount() {
    return this._getAxis().length;
  }
  getFirstScaleIdForIndexAxis() {
    const scales = this.chart.scales;
    const indexScaleId = this.chart.options.indexAxis;
    return Object.keys(scales).filter((key) => scales[key].axis === indexScaleId).shift();
  }
  _getAxis() {
    const axis = {};
    const firstScaleAxisId = this.getFirstScaleIdForIndexAxis();
    for (const dataset of this.chart.data.datasets) {
      axis[valueOrDefault(this.chart.options.indexAxis === "x" ? dataset.xAxisID : dataset.yAxisID, firstScaleAxisId)] = true;
    }
    return Object.keys(axis);
  }
  _getStackIndex(datasetIndex, name2, dataIndex) {
    const stacks = this._getStacks(datasetIndex, dataIndex);
    const index2 = name2 !== void 0 ? stacks.indexOf(name2) : -1;
    return index2 === -1 ? stacks.length - 1 : index2;
  }
  _getRuler() {
    const opts2 = this.options;
    const meta = this._cachedMeta;
    const iScale = meta.iScale;
    const pixels = [];
    let i2, ilen;
    for (i2 = 0, ilen = meta.data.length; i2 < ilen; ++i2) {
      pixels.push(iScale.getPixelForValue(this.getParsed(i2)[iScale.axis], i2));
    }
    const barThickness = opts2.barThickness;
    const min2 = barThickness || computeMinSampleSize(meta);
    return {
      min: min2,
      pixels,
      start: iScale._startPixel,
      end: iScale._endPixel,
      stackCount: this._getStackCount(),
      scale: iScale,
      grouped: opts2.grouped,
      ratio: barThickness ? 1 : opts2.categoryPercentage * opts2.barPercentage
    };
  }
  _calculateBarValuePixels(index2) {
    const { _cachedMeta: { vScale, _stacked, index: datasetIndex }, options: { base: baseValue, minBarLength } } = this;
    const actualBase = baseValue || 0;
    const parsed = this.getParsed(index2);
    const custom = parsed._custom;
    const floating = isFloatBar(custom);
    let value2 = parsed[vScale.axis];
    let start = 0;
    let length2 = _stacked ? this.applyStack(vScale, parsed, _stacked) : value2;
    let head, size2;
    if (length2 !== value2) {
      start = length2 - value2;
      length2 = value2;
    }
    if (floating) {
      value2 = custom.barStart;
      length2 = custom.barEnd - custom.barStart;
      if (value2 !== 0 && sign$1(value2) !== sign$1(custom.barEnd)) {
        start = 0;
      }
      start += value2;
    }
    const startValue = !isNullOrUndef(baseValue) && !floating ? baseValue : start;
    let base = vScale.getPixelForValue(startValue);
    if (this.chart.getDataVisibility(index2)) {
      head = vScale.getPixelForValue(start + length2);
    } else {
      head = base;
    }
    size2 = head - base;
    if (Math.abs(size2) < minBarLength) {
      size2 = barSign(size2, vScale, actualBase) * minBarLength;
      if (value2 === actualBase) {
        base -= size2 / 2;
      }
      const startPixel = vScale.getPixelForDecimal(0);
      const endPixel = vScale.getPixelForDecimal(1);
      const min2 = Math.min(startPixel, endPixel);
      const max2 = Math.max(startPixel, endPixel);
      base = Math.max(Math.min(base, max2), min2);
      head = base + size2;
      if (_stacked && !floating) {
        parsed._stacks[vScale.axis]._visualValues[datasetIndex] = vScale.getValueForPixel(head) - vScale.getValueForPixel(base);
      }
    }
    if (base === vScale.getPixelForValue(actualBase)) {
      const halfGrid = sign$1(size2) * vScale.getLineWidthForValue(actualBase) / 2;
      base += halfGrid;
      size2 -= halfGrid;
    }
    return {
      size: size2,
      base,
      head,
      center: head + size2 / 2
    };
  }
  _calculateBarIndexPixels(index2, ruler) {
    const scale2 = ruler.scale;
    const options = this.options;
    const skipNull = options.skipNull;
    const maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
    let center, size2;
    const axisCount = this._getAxisCount();
    if (ruler.grouped) {
      const stackCount = skipNull ? this._getStackCount(index2) : ruler.stackCount;
      const range3 = options.barThickness === "flex" ? computeFlexCategoryTraits(index2, ruler, options, stackCount * axisCount) : computeFitCategoryTraits(index2, ruler, options, stackCount * axisCount);
      const axisID = this.chart.options.indexAxis === "x" ? this.getDataset().xAxisID : this.getDataset().yAxisID;
      const axisNumber = this._getAxis().indexOf(valueOrDefault(axisID, this.getFirstScaleIdForIndexAxis()));
      const stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index2 : void 0) + axisNumber;
      center = range3.start + range3.chunk * stackIndex + range3.chunk / 2;
      size2 = Math.min(maxBarThickness, range3.chunk * range3.ratio);
    } else {
      center = scale2.getPixelForValue(this.getParsed(index2)[scale2.axis], index2);
      size2 = Math.min(maxBarThickness, ruler.min * ruler.ratio);
    }
    return {
      base: center - size2 / 2,
      head: center + size2 / 2,
      center,
      size: size2
    };
  }
  draw() {
    const meta = this._cachedMeta;
    const vScale = meta.vScale;
    const rects = meta.data;
    const ilen = rects.length;
    let i2 = 0;
    for (; i2 < ilen; ++i2) {
      if (this.getParsed(i2)[vScale.axis] !== null && !rects[i2].hidden) {
        rects[i2].draw(this._ctx);
      }
    }
  }
}
__publicField(BarController, "id", "bar");
__publicField(BarController, "defaults", {
  datasetElementType: false,
  dataElementType: "bar",
  categoryPercentage: 0.8,
  barPercentage: 0.9,
  grouped: true,
  animations: {
    numbers: {
      type: "number",
      properties: [
        "x",
        "y",
        "base",
        "width",
        "height"
      ]
    }
  }
});
__publicField(BarController, "overrides", {
  scales: {
    _index_: {
      type: "category",
      offset: true,
      grid: {
        offset: true
      }
    },
    _value_: {
      type: "linear",
      beginAtZero: true
    }
  }
});
class LineController extends DatasetController {
  initialize() {
    this.enableOptionSharing = true;
    this.supportsDecimation = true;
    super.initialize();
  }
  update(mode) {
    const meta = this._cachedMeta;
    const { dataset: line2, data: points = [], _dataset } = meta;
    const animationsDisabled = this.chart._animationsDisabled;
    let { start, count } = _getStartAndCountOfVisiblePoints(meta, points, animationsDisabled);
    this._drawStart = start;
    this._drawCount = count;
    if (_scaleRangesChanged(meta)) {
      start = 0;
      count = points.length;
    }
    line2._chart = this.chart;
    line2._datasetIndex = this.index;
    line2._decimated = !!_dataset._decimated;
    line2.points = points;
    const options = this.resolveDatasetElementOptions(mode);
    if (!this.options.showLine) {
      options.borderWidth = 0;
    }
    options.segment = this.options.segment;
    this.updateElement(line2, void 0, {
      animated: !animationsDisabled,
      options
    }, mode);
    this.updateElements(points, start, count, mode);
  }
  updateElements(points, start, count, mode) {
    const reset = mode === "reset";
    const { iScale, vScale, _stacked, _dataset } = this._cachedMeta;
    const { sharedOptions, includeOptions } = this._getSharedOptions(start, mode);
    const iAxis = iScale.axis;
    const vAxis = vScale.axis;
    const { spanGaps, segment } = this.options;
    const maxGapLength = isNumber$2(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;
    const directUpdate = this.chart._animationsDisabled || reset || mode === "none";
    const end = start + count;
    const pointsCount = points.length;
    let prevParsed = start > 0 && this.getParsed(start - 1);
    for (let i2 = 0; i2 < pointsCount; ++i2) {
      const point2 = points[i2];
      const properties2 = directUpdate ? point2 : {};
      if (i2 < start || i2 >= end) {
        properties2.skip = true;
        continue;
      }
      const parsed = this.getParsed(i2);
      const nullData = isNullOrUndef(parsed[vAxis]);
      const iPixel = properties2[iAxis] = iScale.getPixelForValue(parsed[iAxis], i2);
      const vPixel = properties2[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i2);
      properties2.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;
      properties2.stop = i2 > 0 && Math.abs(parsed[iAxis] - prevParsed[iAxis]) > maxGapLength;
      if (segment) {
        properties2.parsed = parsed;
        properties2.raw = _dataset.data[i2];
      }
      if (includeOptions) {
        properties2.options = sharedOptions || this.resolveDataElementOptions(i2, point2.active ? "active" : mode);
      }
      if (!directUpdate) {
        this.updateElement(point2, i2, properties2, mode);
      }
      prevParsed = parsed;
    }
  }
  getMaxOverflow() {
    const meta = this._cachedMeta;
    const dataset = meta.dataset;
    const border = dataset.options && dataset.options.borderWidth || 0;
    const data = meta.data || [];
    if (!data.length) {
      return border;
    }
    const firstPoint = data[0].size(this.resolveDataElementOptions(0));
    const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));
    return Math.max(border, firstPoint, lastPoint) / 2;
  }
  draw() {
    const meta = this._cachedMeta;
    meta.dataset.updateControlPoints(this.chart.chartArea, meta.iScale.axis);
    super.draw();
  }
}
__publicField(LineController, "id", "line");
__publicField(LineController, "defaults", {
  datasetElementType: "line",
  dataElementType: "point",
  showLine: true,
  spanGaps: false
});
__publicField(LineController, "overrides", {
  scales: {
    _index_: {
      type: "category"
    },
    _value_: {
      type: "linear"
    }
  }
});
function abstract() {
  throw new Error("This method is not implemented: Check that a complete date adapter is provided.");
}
class DateAdapterBase {
  constructor(options) {
    __publicField(this, "options");
    this.options = options || {};
  }
  /**
  * Override default date adapter methods.
  * Accepts type parameter to define options type.
  * @example
  * Chart._adapters._date.override<{myAdapterOption: string}>({
  *   init() {
  *     console.log(this.options.myAdapterOption);
  *   }
  * })
  */
  static override(members) {
    Object.assign(DateAdapterBase.prototype, members);
  }
  // eslint-disable-next-line @typescript-eslint/no-empty-function
  init() {
  }
  formats() {
    return abstract();
  }
  parse() {
    return abstract();
  }
  format() {
    return abstract();
  }
  add() {
    return abstract();
  }
  diff() {
    return abstract();
  }
  startOf() {
    return abstract();
  }
  endOf() {
    return abstract();
  }
}
var adapters$1 = {
  _date: DateAdapterBase
};
function binarySearch(metaset, axis, value2, intersect) {
  const { controller, data, _sorted } = metaset;
  const iScale = controller._cachedMeta.iScale;
  const spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
  if (iScale && axis === iScale.axis && axis !== "r" && _sorted && data.length) {
    const lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
    if (!intersect) {
      const result = lookupMethod(data, axis, value2);
      if (spanGaps) {
        const { vScale } = controller._cachedMeta;
        const { _parsed } = metaset;
        const distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        result.lo -= Math.max(0, distanceToDefinedLo);
        const distanceToDefinedHi = _parsed.slice(result.hi).findIndex((point2) => !isNullOrUndef(point2[vScale.axis]));
        result.hi += Math.max(0, distanceToDefinedHi);
      }
      return result;
    } else if (controller._sharedOptions) {
      const el2 = data[0];
      const range3 = typeof el2.getRange === "function" && el2.getRange(axis);
      if (range3) {
        const start = lookupMethod(data, axis, value2 - range3);
        const end = lookupMethod(data, axis, value2 + range3);
        return {
          lo: start.lo,
          hi: end.hi
        };
      }
    }
  }
  return {
    lo: 0,
    hi: data.length - 1
  };
}
function evaluateInteractionItems(chart, axis, position2, handler, intersect) {
  const metasets = chart.getSortedVisibleDatasetMetas();
  const value2 = position2[axis];
  for (let i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
    const { index: index2, data } = metasets[i2];
    const { lo, hi: hi2 } = binarySearch(metasets[i2], axis, value2, intersect);
    for (let j2 = lo; j2 <= hi2; ++j2) {
      const element2 = data[j2];
      if (!element2.skip) {
        handler(element2, index2, j2);
      }
    }
  }
}
function getDistanceMetricForAxis(axis) {
  const useX = axis.indexOf("x") !== -1;
  const useY = axis.indexOf("y") !== -1;
  return function(pt1, pt2) {
    const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
    const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
    return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
  };
}
function getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) {
  const items = [];
  if (!includeInvisible && !chart.isPointInArea(position2)) {
    return items;
  }
  const evaluationFunc = function(element2, datasetIndex, index2) {
    if (!includeInvisible && !_isPointInArea(element2, chart.chartArea, 0)) {
      return;
    }
    if (element2.inRange(position2.x, position2.y, useFinalPosition)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  };
  evaluateInteractionItems(chart, axis, position2, evaluationFunc, true);
  return items;
}
function getNearestRadialItems(chart, position2, axis, useFinalPosition) {
  let items = [];
  function evaluationFunc(element2, datasetIndex, index2) {
    const { startAngle, endAngle } = element2.getProps([
      "startAngle",
      "endAngle"
    ], useFinalPosition);
    const { angle } = getAngleFromPoint(element2, {
      x: position2.x,
      y: position2.y
    });
    if (_angleBetween(angle, startAngle, endAngle)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  }
  evaluateInteractionItems(chart, axis, position2, evaluationFunc);
  return items;
}
function getNearestCartesianItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible) {
  let items = [];
  const distanceMetric = getDistanceMetricForAxis(axis);
  let minDistance = Number.POSITIVE_INFINITY;
  function evaluationFunc(element2, datasetIndex, index2) {
    const inRange2 = element2.inRange(position2.x, position2.y, useFinalPosition);
    if (intersect && !inRange2) {
      return;
    }
    const center = element2.getCenterPoint(useFinalPosition);
    const pointInArea = !!includeInvisible || chart.isPointInArea(center);
    if (!pointInArea && !inRange2) {
      return;
    }
    const distance2 = distanceMetric(position2, center);
    if (distance2 < minDistance) {
      items = [
        {
          element: element2,
          datasetIndex,
          index: index2
        }
      ];
      minDistance = distance2;
    } else if (distance2 === minDistance) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
    }
  }
  evaluateInteractionItems(chart, axis, position2, evaluationFunc);
  return items;
}
function getNearestItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible) {
  if (!includeInvisible && !chart.isPointInArea(position2)) {
    return [];
  }
  return axis === "r" && !intersect ? getNearestRadialItems(chart, position2, axis, useFinalPosition) : getNearestCartesianItems(chart, position2, axis, intersect, useFinalPosition, includeInvisible);
}
function getAxisItems(chart, position2, axis, intersect, useFinalPosition) {
  const items = [];
  const rangeMethod = axis === "x" ? "inXRange" : "inYRange";
  let intersectsItem = false;
  evaluateInteractionItems(chart, axis, position2, (element2, datasetIndex, index2) => {
    if (element2[rangeMethod] && element2[rangeMethod](position2[axis], useFinalPosition)) {
      items.push({
        element: element2,
        datasetIndex,
        index: index2
      });
      intersectsItem = intersectsItem || element2.inRange(position2.x, position2.y, useFinalPosition);
    }
  });
  if (intersect && !intersectsItem) {
    return [];
  }
  return items;
}
var Interaction = {
  modes: {
    index(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "x";
      const includeInvisible = options.includeInvisible || false;
      const items = options.intersect ? getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position2, axis, false, useFinalPosition, includeInvisible);
      const elements = [];
      if (!items.length) {
        return [];
      }
      chart.getSortedVisibleDatasetMetas().forEach((meta) => {
        const index2 = items[0].index;
        const element2 = meta.data[index2];
        if (element2 && !element2.skip) {
          elements.push({
            element: element2,
            datasetIndex: meta.index,
            index: index2
          });
        }
      });
      return elements;
    },
    dataset(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      let items = options.intersect ? getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible) : getNearestItems(chart, position2, axis, false, useFinalPosition, includeInvisible);
      if (items.length > 0) {
        const datasetIndex = items[0].datasetIndex;
        const data = chart.getDatasetMeta(datasetIndex).data;
        items = [];
        for (let i2 = 0; i2 < data.length; ++i2) {
          items.push({
            element: data[i2],
            datasetIndex,
            index: i2
          });
        }
      }
      return items;
    },
    point(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      return getIntersectItems(chart, position2, axis, useFinalPosition, includeInvisible);
    },
    nearest(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      const axis = options.axis || "xy";
      const includeInvisible = options.includeInvisible || false;
      return getNearestItems(chart, position2, axis, options.intersect, useFinalPosition, includeInvisible);
    },
    x(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      return getAxisItems(chart, position2, "x", options.intersect, useFinalPosition);
    },
    y(chart, e2, options, useFinalPosition) {
      const position2 = getRelativePosition(e2, chart);
      return getAxisItems(chart, position2, "y", options.intersect, useFinalPosition);
    }
  }
};
const STATIC_POSITIONS = [
  "left",
  "top",
  "right",
  "bottom"
];
function filterByPosition(array4, position2) {
  return array4.filter((v2) => v2.pos === position2);
}
function filterDynamicPositionByAxis(array4, axis) {
  return array4.filter((v2) => STATIC_POSITIONS.indexOf(v2.pos) === -1 && v2.box.axis === axis);
}
function sortByWeight(array4, reverse) {
  return array4.sort((a2, b2) => {
    const v0 = reverse ? b2 : a2;
    const v1 = reverse ? a2 : b2;
    return v0.weight === v1.weight ? v0.index - v1.index : v0.weight - v1.weight;
  });
}
function wrapBoxes(boxes) {
  const layoutBoxes = [];
  let i2, ilen, box, pos, stack, stackWeight;
  for (i2 = 0, ilen = (boxes || []).length; i2 < ilen; ++i2) {
    box = boxes[i2];
    ({ position: pos, options: { stack, stackWeight = 1 } } = box);
    layoutBoxes.push({
      index: i2,
      box,
      pos,
      horizontal: box.isHorizontal(),
      weight: box.weight,
      stack: stack && pos + stack,
      stackWeight
    });
  }
  return layoutBoxes;
}
function buildStacks(layouts2) {
  const stacks = {};
  for (const wrap2 of layouts2) {
    const { stack, pos, stackWeight } = wrap2;
    if (!stack || !STATIC_POSITIONS.includes(pos)) {
      continue;
    }
    const _stack = stacks[stack] || (stacks[stack] = {
      count: 0,
      placed: 0,
      weight: 0,
      size: 0
    });
    _stack.count++;
    _stack.weight += stackWeight;
  }
  return stacks;
}
function setLayoutDims(layouts2, params) {
  const stacks = buildStacks(layouts2);
  const { vBoxMaxWidth, hBoxMaxHeight } = params;
  let i2, ilen, layout2;
  for (i2 = 0, ilen = layouts2.length; i2 < ilen; ++i2) {
    layout2 = layouts2[i2];
    const { fullSize } = layout2.box;
    const stack = stacks[layout2.stack];
    const factor = stack && layout2.stackWeight / stack.weight;
    if (layout2.horizontal) {
      layout2.width = factor ? factor * vBoxMaxWidth : fullSize && params.availableWidth;
      layout2.height = hBoxMaxHeight;
    } else {
      layout2.width = vBoxMaxWidth;
      layout2.height = factor ? factor * hBoxMaxHeight : fullSize && params.availableHeight;
    }
  }
  return stacks;
}
function buildLayoutBoxes(boxes) {
  const layoutBoxes = wrapBoxes(boxes);
  const fullSize = sortByWeight(layoutBoxes.filter((wrap2) => wrap2.box.fullSize), true);
  const left2 = sortByWeight(filterByPosition(layoutBoxes, "left"), true);
  const right = sortByWeight(filterByPosition(layoutBoxes, "right"));
  const top2 = sortByWeight(filterByPosition(layoutBoxes, "top"), true);
  const bottom2 = sortByWeight(filterByPosition(layoutBoxes, "bottom"));
  const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, "x");
  const centerVertical = filterDynamicPositionByAxis(layoutBoxes, "y");
  return {
    fullSize,
    leftAndTop: left2.concat(top2),
    rightAndBottom: right.concat(centerVertical).concat(bottom2).concat(centerHorizontal),
    chartArea: filterByPosition(layoutBoxes, "chartArea"),
    vertical: left2.concat(right).concat(centerVertical),
    horizontal: top2.concat(bottom2).concat(centerHorizontal)
  };
}
function getCombinedMax(maxPadding, chartArea, a2, b2) {
  return Math.max(maxPadding[a2], chartArea[a2]) + Math.max(maxPadding[b2], chartArea[b2]);
}
function updateMaxPadding(maxPadding, boxPadding) {
  maxPadding.top = Math.max(maxPadding.top, boxPadding.top);
  maxPadding.left = Math.max(maxPadding.left, boxPadding.left);
  maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);
  maxPadding.right = Math.max(maxPadding.right, boxPadding.right);
}
function updateDims(chartArea, params, layout2, stacks) {
  const { pos, box } = layout2;
  const maxPadding = chartArea.maxPadding;
  if (!isObject$3(pos)) {
    if (layout2.size) {
      chartArea[pos] -= layout2.size;
    }
    const stack = stacks[layout2.stack] || {
      size: 0,
      count: 1
    };
    stack.size = Math.max(stack.size, layout2.horizontal ? box.height : box.width);
    layout2.size = stack.size / stack.count;
    chartArea[pos] += layout2.size;
  }
  if (box.getPadding) {
    updateMaxPadding(maxPadding, box.getPadding());
  }
  const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, "left", "right"));
  const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, "top", "bottom"));
  const widthChanged = newWidth !== chartArea.w;
  const heightChanged = newHeight !== chartArea.h;
  chartArea.w = newWidth;
  chartArea.h = newHeight;
  return layout2.horizontal ? {
    same: widthChanged,
    other: heightChanged
  } : {
    same: heightChanged,
    other: widthChanged
  };
}
function handleMaxPadding(chartArea) {
  const maxPadding = chartArea.maxPadding;
  function updatePos(pos) {
    const change = Math.max(maxPadding[pos] - chartArea[pos], 0);
    chartArea[pos] += change;
    return change;
  }
  chartArea.y += updatePos("top");
  chartArea.x += updatePos("left");
  updatePos("right");
  updatePos("bottom");
}
function getMargins(horizontal, chartArea) {
  const maxPadding = chartArea.maxPadding;
  function marginForPositions(positions2) {
    const margin = {
      left: 0,
      top: 0,
      right: 0,
      bottom: 0
    };
    positions2.forEach((pos) => {
      margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);
    });
    return margin;
  }
  return horizontal ? marginForPositions([
    "left",
    "right"
  ]) : marginForPositions([
    "top",
    "bottom"
  ]);
}
function fitBoxes(boxes, chartArea, params, stacks) {
  const refitBoxes = [];
  let i2, ilen, layout2, box, refit, changed;
  for (i2 = 0, ilen = boxes.length, refit = 0; i2 < ilen; ++i2) {
    layout2 = boxes[i2];
    box = layout2.box;
    box.update(layout2.width || chartArea.w, layout2.height || chartArea.h, getMargins(layout2.horizontal, chartArea));
    const { same, other } = updateDims(chartArea, params, layout2, stacks);
    refit |= same && refitBoxes.length;
    changed = changed || other;
    if (!box.fullSize) {
      refitBoxes.push(layout2);
    }
  }
  return refit && fitBoxes(refitBoxes, chartArea, params, stacks) || changed;
}
function setBoxDims(box, left2, top2, width, height) {
  box.top = top2;
  box.left = left2;
  box.right = left2 + width;
  box.bottom = top2 + height;
  box.width = width;
  box.height = height;
}
function placeBoxes(boxes, chartArea, params, stacks) {
  const userPadding = params.padding;
  let { x: x2, y: y2 } = chartArea;
  for (const layout2 of boxes) {
    const box = layout2.box;
    const stack = stacks[layout2.stack] || {
      placed: 0,
      weight: 1
    };
    const weight = layout2.stackWeight / stack.weight || 1;
    if (layout2.horizontal) {
      const width = chartArea.w * weight;
      const height = stack.size || box.height;
      if (defined(stack.start)) {
        y2 = stack.start;
      }
      if (box.fullSize) {
        setBoxDims(box, userPadding.left, y2, params.outerWidth - userPadding.right - userPadding.left, height);
      } else {
        setBoxDims(box, chartArea.left + stack.placed, y2, width, height);
      }
      stack.start = y2;
      stack.placed += width;
      y2 = box.bottom;
    } else {
      const height = chartArea.h * weight;
      const width = stack.size || box.width;
      if (defined(stack.start)) {
        x2 = stack.start;
      }
      if (box.fullSize) {
        setBoxDims(box, x2, userPadding.top, width, params.outerHeight - userPadding.bottom - userPadding.top);
      } else {
        setBoxDims(box, x2, chartArea.top + stack.placed, width, height);
      }
      stack.start = x2;
      stack.placed += height;
      x2 = box.right;
    }
  }
  chartArea.x = x2;
  chartArea.y = y2;
}
var layouts = {
  addBox(chart, item) {
    if (!chart.boxes) {
      chart.boxes = [];
    }
    item.fullSize = item.fullSize || false;
    item.position = item.position || "top";
    item.weight = item.weight || 0;
    item._layers = item._layers || function() {
      return [
        {
          z: 0,
          draw(chartArea) {
            item.draw(chartArea);
          }
        }
      ];
    };
    chart.boxes.push(item);
  },
  removeBox(chart, layoutItem) {
    const index2 = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
    if (index2 !== -1) {
      chart.boxes.splice(index2, 1);
    }
  },
  configure(chart, item, options) {
    item.fullSize = options.fullSize;
    item.position = options.position;
    item.weight = options.weight;
  },
  update(chart, width, height, minPadding) {
    if (!chart) {
      return;
    }
    const padding = toPadding(chart.options.layout.padding);
    const availableWidth = Math.max(width - padding.width, 0);
    const availableHeight = Math.max(height - padding.height, 0);
    const boxes = buildLayoutBoxes(chart.boxes);
    const verticalBoxes = boxes.vertical;
    const horizontalBoxes = boxes.horizontal;
    each(chart.boxes, (box) => {
      if (typeof box.beforeLayout === "function") {
        box.beforeLayout();
      }
    });
    const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap2) => wrap2.box.options && wrap2.box.options.display === false ? total : total + 1, 0) || 1;
    const params = Object.freeze({
      outerWidth: width,
      outerHeight: height,
      padding,
      availableWidth,
      availableHeight,
      vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,
      hBoxMaxHeight: availableHeight / 2
    });
    const maxPadding = Object.assign({}, padding);
    updateMaxPadding(maxPadding, toPadding(minPadding));
    const chartArea = Object.assign({
      maxPadding,
      w: availableWidth,
      h: availableHeight,
      x: padding.left,
      y: padding.top
    }, padding);
    const stacks = setLayoutDims(verticalBoxes.concat(horizontalBoxes), params);
    fitBoxes(boxes.fullSize, chartArea, params, stacks);
    fitBoxes(verticalBoxes, chartArea, params, stacks);
    if (fitBoxes(horizontalBoxes, chartArea, params, stacks)) {
      fitBoxes(verticalBoxes, chartArea, params, stacks);
    }
    handleMaxPadding(chartArea);
    placeBoxes(boxes.leftAndTop, chartArea, params, stacks);
    chartArea.x += chartArea.w;
    chartArea.y += chartArea.h;
    placeBoxes(boxes.rightAndBottom, chartArea, params, stacks);
    chart.chartArea = {
      left: chartArea.left,
      top: chartArea.top,
      right: chartArea.left + chartArea.w,
      bottom: chartArea.top + chartArea.h,
      height: chartArea.h,
      width: chartArea.w
    };
    each(boxes.chartArea, (layout2) => {
      const box = layout2.box;
      Object.assign(box, chart.chartArea);
      box.update(chartArea.w, chartArea.h, {
        left: 0,
        top: 0,
        right: 0,
        bottom: 0
      });
    });
  }
};
class BasePlatform {
  acquireContext(canvas, aspectRatio2) {
  }
  releaseContext(context) {
    return false;
  }
  addEventListener(chart, type4, listener) {
  }
  removeEventListener(chart, type4, listener) {
  }
  getDevicePixelRatio() {
    return 1;
  }
  getMaximumSize(element2, width, height, aspectRatio2) {
    width = Math.max(0, width || element2.width);
    height = height || element2.height;
    return {
      width,
      height: Math.max(0, aspectRatio2 ? Math.floor(width / aspectRatio2) : height)
    };
  }
  isAttached(canvas) {
    return true;
  }
  updateConfig(config2) {
  }
}
class BasicPlatform extends BasePlatform {
  acquireContext(item) {
    return item && item.getContext && item.getContext("2d") || null;
  }
  updateConfig(config2) {
    config2.options.animation = false;
  }
}
const EXPANDO_KEY = "$chartjs";
const EVENT_TYPES = {
  touchstart: "mousedown",
  touchmove: "mousemove",
  touchend: "mouseup",
  pointerenter: "mouseenter",
  pointerdown: "mousedown",
  pointermove: "mousemove",
  pointerup: "mouseup",
  pointerleave: "mouseout",
  pointerout: "mouseout"
};
const isNullOrEmpty = (value2) => value2 === null || value2 === "";
function initCanvas(canvas, aspectRatio2) {
  const style2 = canvas.style;
  const renderHeight = canvas.getAttribute("height");
  const renderWidth = canvas.getAttribute("width");
  canvas[EXPANDO_KEY] = {
    initial: {
      height: renderHeight,
      width: renderWidth,
      style: {
        display: style2.display,
        height: style2.height,
        width: style2.width
      }
    }
  };
  style2.display = style2.display || "block";
  style2.boxSizing = style2.boxSizing || "border-box";
  if (isNullOrEmpty(renderWidth)) {
    const displayWidth = readUsedSize(canvas, "width");
    if (displayWidth !== void 0) {
      canvas.width = displayWidth;
    }
  }
  if (isNullOrEmpty(renderHeight)) {
    if (canvas.style.height === "") {
      canvas.height = canvas.width / (aspectRatio2 || 2);
    } else {
      const displayHeight = readUsedSize(canvas, "height");
      if (displayHeight !== void 0) {
        canvas.height = displayHeight;
      }
    }
  }
  return canvas;
}
const eventListenerOptions = supportsEventListenerOptions ? {
  passive: true
} : false;
function addListener(node2, type4, listener) {
  if (node2) {
    node2.addEventListener(type4, listener, eventListenerOptions);
  }
}
function removeListener(chart, type4, listener) {
  if (chart && chart.canvas) {
    chart.canvas.removeEventListener(type4, listener, eventListenerOptions);
  }
}
function fromNativeEvent(event, chart) {
  const type4 = EVENT_TYPES[event.type] || event.type;
  const { x: x2, y: y2 } = getRelativePosition(event, chart);
  return {
    type: type4,
    chart,
    native: event,
    x: x2 !== void 0 ? x2 : null,
    y: y2 !== void 0 ? y2 : null
  };
}
function nodeListContains(nodeList, canvas) {
  for (const node2 of nodeList) {
    if (node2 === canvas || node2.contains(canvas)) {
      return true;
    }
  }
}
function createAttachObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const observer = new MutationObserver((entries) => {
    let trigger = false;
    for (const entry of entries) {
      trigger = trigger || nodeListContains(entry.addedNodes, canvas);
      trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
    }
    if (trigger) {
      listener();
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true
  });
  return observer;
}
function createDetachObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const observer = new MutationObserver((entries) => {
    let trigger = false;
    for (const entry of entries) {
      trigger = trigger || nodeListContains(entry.removedNodes, canvas);
      trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
    }
    if (trigger) {
      listener();
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true
  });
  return observer;
}
const drpListeningCharts = /* @__PURE__ */ new Map();
let oldDevicePixelRatio = 0;
function onWindowResize() {
  const dpr = window.devicePixelRatio;
  if (dpr === oldDevicePixelRatio) {
    return;
  }
  oldDevicePixelRatio = dpr;
  drpListeningCharts.forEach((resize, chart) => {
    if (chart.currentDevicePixelRatio !== dpr) {
      resize();
    }
  });
}
function listenDevicePixelRatioChanges(chart, resize) {
  if (!drpListeningCharts.size) {
    window.addEventListener("resize", onWindowResize);
  }
  drpListeningCharts.set(chart, resize);
}
function unlistenDevicePixelRatioChanges(chart) {
  drpListeningCharts.delete(chart);
  if (!drpListeningCharts.size) {
    window.removeEventListener("resize", onWindowResize);
  }
}
function createResizeObserver(chart, type4, listener) {
  const canvas = chart.canvas;
  const container = canvas && _getParentNode(canvas);
  if (!container) {
    return;
  }
  const resize = throttled((width, height) => {
    const w2 = container.clientWidth;
    listener(width, height);
    if (w2 < container.clientWidth) {
      listener();
    }
  }, window);
  const observer = new ResizeObserver((entries) => {
    const entry = entries[0];
    const width = entry.contentRect.width;
    const height = entry.contentRect.height;
    if (width === 0 && height === 0) {
      return;
    }
    resize(width, height);
  });
  observer.observe(container);
  listenDevicePixelRatioChanges(chart, resize);
  return observer;
}
function releaseObserver(chart, type4, observer) {
  if (observer) {
    observer.disconnect();
  }
  if (type4 === "resize") {
    unlistenDevicePixelRatioChanges(chart);
  }
}
function createProxyAndListen(chart, type4, listener) {
  const canvas = chart.canvas;
  const proxy = throttled((event) => {
    if (chart.ctx !== null) {
      listener(fromNativeEvent(event, chart));
    }
  }, chart);
  addListener(canvas, type4, proxy);
  return proxy;
}
class DomPlatform extends BasePlatform {
  acquireContext(canvas, aspectRatio2) {
    const context = canvas && canvas.getContext && canvas.getContext("2d");
    if (context && context.canvas === canvas) {
      initCanvas(canvas, aspectRatio2);
      return context;
    }
    return null;
  }
  releaseContext(context) {
    const canvas = context.canvas;
    if (!canvas[EXPANDO_KEY]) {
      return false;
    }
    const initial = canvas[EXPANDO_KEY].initial;
    [
      "height",
      "width"
    ].forEach((prop) => {
      const value2 = initial[prop];
      if (isNullOrUndef(value2)) {
        canvas.removeAttribute(prop);
      } else {
        canvas.setAttribute(prop, value2);
      }
    });
    const style2 = initial.style || {};
    Object.keys(style2).forEach((key) => {
      canvas.style[key] = style2[key];
    });
    canvas.width = canvas.width;
    delete canvas[EXPANDO_KEY];
    return true;
  }
  addEventListener(chart, type4, listener) {
    this.removeEventListener(chart, type4);
    const proxies = chart.$proxies || (chart.$proxies = {});
    const handlers2 = {
      attach: createAttachObserver,
      detach: createDetachObserver,
      resize: createResizeObserver
    };
    const handler = handlers2[type4] || createProxyAndListen;
    proxies[type4] = handler(chart, type4, listener);
  }
  removeEventListener(chart, type4) {
    const proxies = chart.$proxies || (chart.$proxies = {});
    const proxy = proxies[type4];
    if (!proxy) {
      return;
    }
    const handlers2 = {
      attach: releaseObserver,
      detach: releaseObserver,
      resize: releaseObserver
    };
    const handler = handlers2[type4] || removeListener;
    handler(chart, type4, proxy);
    proxies[type4] = void 0;
  }
  getDevicePixelRatio() {
    return window.devicePixelRatio;
  }
  getMaximumSize(canvas, width, height, aspectRatio2) {
    return getMaximumSize(canvas, width, height, aspectRatio2);
  }
  isAttached(canvas) {
    const container = canvas && _getParentNode(canvas);
    return !!(container && container.isConnected);
  }
}
function _detectPlatform(canvas) {
  if (!_isDomSupported() || typeof OffscreenCanvas !== "undefined" && canvas instanceof OffscreenCanvas) {
    return BasicPlatform;
  }
  return DomPlatform;
}
let Element$1 = (_a = class {
  constructor() {
    __publicField(this, "x");
    __publicField(this, "y");
    __publicField(this, "active", false);
    __publicField(this, "options");
    __publicField(this, "$animations");
  }
  tooltipPosition(useFinalPosition) {
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return {
      x: x2,
      y: y2
    };
  }
  hasValue() {
    return isNumber$2(this.x) && isNumber$2(this.y);
  }
  getProps(props, final) {
    const anims = this.$animations;
    if (!final || !anims) {
      return this;
    }
    const ret = {};
    props.forEach((prop) => {
      ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : this[prop];
    });
    return ret;
  }
}, __publicField(_a, "defaults", {}), __publicField(_a, "defaultRoutes"), _a);
function autoSkip(scale2, ticks) {
  const tickOpts = scale2.options.ticks;
  const determinedMaxTicks = determineMaxTicks(scale2);
  const ticksLimit = Math.min(tickOpts.maxTicksLimit || determinedMaxTicks, determinedMaxTicks);
  const majorIndices = tickOpts.major.enabled ? getMajorIndices(ticks) : [];
  const numMajorIndices = majorIndices.length;
  const first = majorIndices[0];
  const last = majorIndices[numMajorIndices - 1];
  const newTicks = [];
  if (numMajorIndices > ticksLimit) {
    skipMajors(ticks, newTicks, majorIndices, numMajorIndices / ticksLimit);
    return newTicks;
  }
  const spacing2 = calculateSpacing(majorIndices, ticks, ticksLimit);
  if (numMajorIndices > 0) {
    let i2, ilen;
    const avgMajorSpacing = numMajorIndices > 1 ? Math.round((last - first) / (numMajorIndices - 1)) : null;
    skip(ticks, newTicks, spacing2, isNullOrUndef(avgMajorSpacing) ? 0 : first - avgMajorSpacing, first);
    for (i2 = 0, ilen = numMajorIndices - 1; i2 < ilen; i2++) {
      skip(ticks, newTicks, spacing2, majorIndices[i2], majorIndices[i2 + 1]);
    }
    skip(ticks, newTicks, spacing2, last, isNullOrUndef(avgMajorSpacing) ? ticks.length : last + avgMajorSpacing);
    return newTicks;
  }
  skip(ticks, newTicks, spacing2);
  return newTicks;
}
function determineMaxTicks(scale2) {
  const offset2 = scale2.options.offset;
  const tickLength = scale2._tickSize();
  const maxScale = scale2._length / tickLength + (offset2 ? 0 : 1);
  const maxChart = scale2._maxLength / tickLength;
  return Math.floor(Math.min(maxScale, maxChart));
}
function calculateSpacing(majorIndices, ticks, ticksLimit) {
  const evenMajorSpacing = getEvenSpacing(majorIndices);
  const spacing2 = ticks.length / ticksLimit;
  if (!evenMajorSpacing) {
    return Math.max(spacing2, 1);
  }
  const factors = _factorize(evenMajorSpacing);
  for (let i2 = 0, ilen = factors.length - 1; i2 < ilen; i2++) {
    const factor = factors[i2];
    if (factor > spacing2) {
      return factor;
    }
  }
  return Math.max(spacing2, 1);
}
function getMajorIndices(ticks) {
  const result = [];
  let i2, ilen;
  for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
    if (ticks[i2].major) {
      result.push(i2);
    }
  }
  return result;
}
function skipMajors(ticks, newTicks, majorIndices, spacing2) {
  let count = 0;
  let next2 = majorIndices[0];
  let i2;
  spacing2 = Math.ceil(spacing2);
  for (i2 = 0; i2 < ticks.length; i2++) {
    if (i2 === next2) {
      newTicks.push(ticks[i2]);
      count++;
      next2 = majorIndices[count * spacing2];
    }
  }
}
function skip(ticks, newTicks, spacing2, majorStart, majorEnd) {
  const start = valueOrDefault(majorStart, 0);
  const end = Math.min(valueOrDefault(majorEnd, ticks.length), ticks.length);
  let count = 0;
  let length2, i2, next2;
  spacing2 = Math.ceil(spacing2);
  if (majorEnd) {
    length2 = majorEnd - majorStart;
    spacing2 = length2 / Math.floor(length2 / spacing2);
  }
  next2 = start;
  while (next2 < 0) {
    count++;
    next2 = Math.round(start + count * spacing2);
  }
  for (i2 = Math.max(start, 0); i2 < end; i2++) {
    if (i2 === next2) {
      newTicks.push(ticks[i2]);
      count++;
      next2 = Math.round(start + count * spacing2);
    }
  }
}
function getEvenSpacing(arr) {
  const len = arr.length;
  let i2, diff2;
  if (len < 2) {
    return false;
  }
  for (diff2 = arr[0], i2 = 1; i2 < len; ++i2) {
    if (arr[i2] - arr[i2 - 1] !== diff2) {
      return false;
    }
  }
  return diff2;
}
const reverseAlign = (align) => align === "left" ? "right" : align === "right" ? "left" : align;
const offsetFromEdge = (scale2, edge, offset2) => edge === "top" || edge === "left" ? scale2[edge] + offset2 : scale2[edge] - offset2;
const getTicksLimit = (ticksLength, maxTicksLimit) => Math.min(maxTicksLimit || ticksLength, ticksLength);
function sample(arr, numItems) {
  const result = [];
  const increment2 = arr.length / numItems;
  const len = arr.length;
  let i2 = 0;
  for (; i2 < len; i2 += increment2) {
    result.push(arr[Math.floor(i2)]);
  }
  return result;
}
function getPixelForGridLine(scale2, index2, offsetGridLines) {
  const length2 = scale2.ticks.length;
  const validIndex2 = Math.min(index2, length2 - 1);
  const start = scale2._startPixel;
  const end = scale2._endPixel;
  const epsilon = 1e-6;
  let lineValue = scale2.getPixelForTick(validIndex2);
  let offset2;
  if (offsetGridLines) {
    if (length2 === 1) {
      offset2 = Math.max(lineValue - start, end - lineValue);
    } else if (index2 === 0) {
      offset2 = (scale2.getPixelForTick(1) - lineValue) / 2;
    } else {
      offset2 = (lineValue - scale2.getPixelForTick(validIndex2 - 1)) / 2;
    }
    lineValue += validIndex2 < index2 ? offset2 : -offset2;
    if (lineValue < start - epsilon || lineValue > end + epsilon) {
      return;
    }
  }
  return lineValue;
}
function garbageCollect(caches, length2) {
  each(caches, (cache2) => {
    const gc2 = cache2.gc;
    const gcLen = gc2.length / 2;
    let i2;
    if (gcLen > length2) {
      for (i2 = 0; i2 < gcLen; ++i2) {
        delete cache2.data[gc2[i2]];
      }
      gc2.splice(0, gcLen);
    }
  });
}
function getTickMarkLength(options) {
  return options.drawTicks ? options.tickLength : 0;
}
function getTitleHeight(options, fallback2) {
  if (!options.display) {
    return 0;
  }
  const font = toFont(options.font, fallback2);
  const padding = toPadding(options.padding);
  const lines = isArray$4(options.text) ? options.text.length : 1;
  return lines * font.lineHeight + padding.height;
}
function createScaleContext(parent, scale2) {
  return createContext(parent, {
    scale: scale2,
    type: "scale"
  });
}
function createTickContext(parent, index2, tick) {
  return createContext(parent, {
    tick,
    index: index2,
    type: "tick"
  });
}
function titleAlign(align, position2, reverse) {
  let ret = _toLeftRightCenter(align);
  if (reverse && position2 !== "right" || !reverse && position2 === "right") {
    ret = reverseAlign(ret);
  }
  return ret;
}
function titleArgs(scale2, offset2, position2, align) {
  const { top: top2, left: left2, bottom: bottom2, right, chart } = scale2;
  const { chartArea, scales } = chart;
  let rotation = 0;
  let maxWidth, titleX, titleY;
  const height = bottom2 - top2;
  const width = right - left2;
  if (scale2.isHorizontal()) {
    titleX = _alignStartEnd(align, left2, right);
    if (isObject$3(position2)) {
      const positionAxisID = Object.keys(position2)[0];
      const value2 = position2[positionAxisID];
      titleY = scales[positionAxisID].getPixelForValue(value2) + height - offset2;
    } else if (position2 === "center") {
      titleY = (chartArea.bottom + chartArea.top) / 2 + height - offset2;
    } else {
      titleY = offsetFromEdge(scale2, position2, offset2);
    }
    maxWidth = right - left2;
  } else {
    if (isObject$3(position2)) {
      const positionAxisID = Object.keys(position2)[0];
      const value2 = position2[positionAxisID];
      titleX = scales[positionAxisID].getPixelForValue(value2) - width + offset2;
    } else if (position2 === "center") {
      titleX = (chartArea.left + chartArea.right) / 2 - width + offset2;
    } else {
      titleX = offsetFromEdge(scale2, position2, offset2);
    }
    titleY = _alignStartEnd(align, bottom2, top2);
    rotation = position2 === "left" ? -HALF_PI : HALF_PI;
  }
  return {
    titleX,
    titleY,
    maxWidth,
    rotation
  };
}
class Scale extends Element$1 {
  constructor(cfg) {
    super();
    this.id = cfg.id;
    this.type = cfg.type;
    this.options = void 0;
    this.ctx = cfg.ctx;
    this.chart = cfg.chart;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.width = void 0;
    this.height = void 0;
    this._margins = {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    };
    this.maxWidth = void 0;
    this.maxHeight = void 0;
    this.paddingTop = void 0;
    this.paddingBottom = void 0;
    this.paddingLeft = void 0;
    this.paddingRight = void 0;
    this.axis = void 0;
    this.labelRotation = void 0;
    this.min = void 0;
    this.max = void 0;
    this._range = void 0;
    this.ticks = [];
    this._gridLineItems = null;
    this._labelItems = null;
    this._labelSizes = null;
    this._length = 0;
    this._maxLength = 0;
    this._longestTextCache = {};
    this._startPixel = void 0;
    this._endPixel = void 0;
    this._reversePixels = false;
    this._userMax = void 0;
    this._userMin = void 0;
    this._suggestedMax = void 0;
    this._suggestedMin = void 0;
    this._ticksLength = 0;
    this._borderValue = 0;
    this._cache = {};
    this._dataLimitsCached = false;
    this.$context = void 0;
  }
  init(options) {
    this.options = options.setContext(this.getContext());
    this.axis = options.axis;
    this._userMin = this.parse(options.min);
    this._userMax = this.parse(options.max);
    this._suggestedMin = this.parse(options.suggestedMin);
    this._suggestedMax = this.parse(options.suggestedMax);
  }
  parse(raw, index2) {
    return raw;
  }
  getUserBounds() {
    let { _userMin, _userMax, _suggestedMin, _suggestedMax } = this;
    _userMin = finiteOrDefault(_userMin, Number.POSITIVE_INFINITY);
    _userMax = finiteOrDefault(_userMax, Number.NEGATIVE_INFINITY);
    _suggestedMin = finiteOrDefault(_suggestedMin, Number.POSITIVE_INFINITY);
    _suggestedMax = finiteOrDefault(_suggestedMax, Number.NEGATIVE_INFINITY);
    return {
      min: finiteOrDefault(_userMin, _suggestedMin),
      max: finiteOrDefault(_userMax, _suggestedMax),
      minDefined: isNumberFinite(_userMin),
      maxDefined: isNumberFinite(_userMax)
    };
  }
  getMinMax(canStack) {
    let { min: min2, max: max2, minDefined, maxDefined } = this.getUserBounds();
    let range3;
    if (minDefined && maxDefined) {
      return {
        min: min2,
        max: max2
      };
    }
    const metas = this.getMatchingVisibleMetas();
    for (let i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      range3 = metas[i2].controller.getMinMax(this, canStack);
      if (!minDefined) {
        min2 = Math.min(min2, range3.min);
      }
      if (!maxDefined) {
        max2 = Math.max(max2, range3.max);
      }
    }
    min2 = maxDefined && min2 > max2 ? max2 : min2;
    max2 = minDefined && min2 > max2 ? min2 : max2;
    return {
      min: finiteOrDefault(min2, finiteOrDefault(max2, min2)),
      max: finiteOrDefault(max2, finiteOrDefault(min2, max2))
    };
  }
  getPadding() {
    return {
      left: this.paddingLeft || 0,
      top: this.paddingTop || 0,
      right: this.paddingRight || 0,
      bottom: this.paddingBottom || 0
    };
  }
  getTicks() {
    return this.ticks;
  }
  getLabels() {
    const data = this.chart.data;
    return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];
  }
  getLabelItems(chartArea = this.chart.chartArea) {
    const items = this._labelItems || (this._labelItems = this._computeLabelItems(chartArea));
    return items;
  }
  beforeLayout() {
    this._cache = {};
    this._dataLimitsCached = false;
  }
  beforeUpdate() {
    callback(this.options.beforeUpdate, [
      this
    ]);
  }
  update(maxWidth, maxHeight, margins) {
    const { beginAtZero, grace, ticks: tickOpts } = this.options;
    const sampleSize = tickOpts.sampleSize;
    this.beforeUpdate();
    this.maxWidth = maxWidth;
    this.maxHeight = maxHeight;
    this._margins = margins = Object.assign({
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    }, margins);
    this.ticks = null;
    this._labelSizes = null;
    this._gridLineItems = null;
    this._labelItems = null;
    this.beforeSetDimensions();
    this.setDimensions();
    this.afterSetDimensions();
    this._maxLength = this.isHorizontal() ? this.width + margins.left + margins.right : this.height + margins.top + margins.bottom;
    if (!this._dataLimitsCached) {
      this.beforeDataLimits();
      this.determineDataLimits();
      this.afterDataLimits();
      this._range = _addGrace(this, grace, beginAtZero);
      this._dataLimitsCached = true;
    }
    this.beforeBuildTicks();
    this.ticks = this.buildTicks() || [];
    this.afterBuildTicks();
    const samplingEnabled = sampleSize < this.ticks.length;
    this._convertTicksToLabels(samplingEnabled ? sample(this.ticks, sampleSize) : this.ticks);
    this.configure();
    this.beforeCalculateLabelRotation();
    this.calculateLabelRotation();
    this.afterCalculateLabelRotation();
    if (tickOpts.display && (tickOpts.autoSkip || tickOpts.source === "auto")) {
      this.ticks = autoSkip(this, this.ticks);
      this._labelSizes = null;
      this.afterAutoSkip();
    }
    if (samplingEnabled) {
      this._convertTicksToLabels(this.ticks);
    }
    this.beforeFit();
    this.fit();
    this.afterFit();
    this.afterUpdate();
  }
  configure() {
    let reversePixels = this.options.reverse;
    let startPixel, endPixel;
    if (this.isHorizontal()) {
      startPixel = this.left;
      endPixel = this.right;
    } else {
      startPixel = this.top;
      endPixel = this.bottom;
      reversePixels = !reversePixels;
    }
    this._startPixel = startPixel;
    this._endPixel = endPixel;
    this._reversePixels = reversePixels;
    this._length = endPixel - startPixel;
    this._alignToPixels = this.options.alignToPixels;
  }
  afterUpdate() {
    callback(this.options.afterUpdate, [
      this
    ]);
  }
  beforeSetDimensions() {
    callback(this.options.beforeSetDimensions, [
      this
    ]);
  }
  setDimensions() {
    if (this.isHorizontal()) {
      this.width = this.maxWidth;
      this.left = 0;
      this.right = this.width;
    } else {
      this.height = this.maxHeight;
      this.top = 0;
      this.bottom = this.height;
    }
    this.paddingLeft = 0;
    this.paddingTop = 0;
    this.paddingRight = 0;
    this.paddingBottom = 0;
  }
  afterSetDimensions() {
    callback(this.options.afterSetDimensions, [
      this
    ]);
  }
  _callHooks(name2) {
    this.chart.notifyPlugins(name2, this.getContext());
    callback(this.options[name2], [
      this
    ]);
  }
  beforeDataLimits() {
    this._callHooks("beforeDataLimits");
  }
  determineDataLimits() {
  }
  afterDataLimits() {
    this._callHooks("afterDataLimits");
  }
  beforeBuildTicks() {
    this._callHooks("beforeBuildTicks");
  }
  buildTicks() {
    return [];
  }
  afterBuildTicks() {
    this._callHooks("afterBuildTicks");
  }
  beforeTickToLabelConversion() {
    callback(this.options.beforeTickToLabelConversion, [
      this
    ]);
  }
  generateTickLabels(ticks) {
    const tickOpts = this.options.ticks;
    let i2, ilen, tick;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
      tick = ticks[i2];
      tick.label = callback(tickOpts.callback, [
        tick.value,
        i2,
        ticks
      ], this);
    }
  }
  afterTickToLabelConversion() {
    callback(this.options.afterTickToLabelConversion, [
      this
    ]);
  }
  beforeCalculateLabelRotation() {
    callback(this.options.beforeCalculateLabelRotation, [
      this
    ]);
  }
  calculateLabelRotation() {
    const options = this.options;
    const tickOpts = options.ticks;
    const numTicks = getTicksLimit(this.ticks.length, options.ticks.maxTicksLimit);
    const minRotation = tickOpts.minRotation || 0;
    const maxRotation = tickOpts.maxRotation;
    let labelRotation = minRotation;
    let tickWidth, maxHeight, maxLabelDiagonal;
    if (!this._isVisible() || !tickOpts.display || minRotation >= maxRotation || numTicks <= 1 || !this.isHorizontal()) {
      this.labelRotation = minRotation;
      return;
    }
    const labelSizes = this._getLabelSizes();
    const maxLabelWidth = labelSizes.widest.width;
    const maxLabelHeight = labelSizes.highest.height;
    const maxWidth = _limitValue(this.chart.width - maxLabelWidth, 0, this.maxWidth);
    tickWidth = options.offset ? this.maxWidth / numTicks : maxWidth / (numTicks - 1);
    if (maxLabelWidth + 6 > tickWidth) {
      tickWidth = maxWidth / (numTicks - (options.offset ? 0.5 : 1));
      maxHeight = this.maxHeight - getTickMarkLength(options.grid) - tickOpts.padding - getTitleHeight(options.title, this.chart.options.font);
      maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);
      labelRotation = toDegrees(Math.min(Math.asin(_limitValue((labelSizes.highest.height + 6) / tickWidth, -1, 1)), Math.asin(_limitValue(maxHeight / maxLabelDiagonal, -1, 1)) - Math.asin(_limitValue(maxLabelHeight / maxLabelDiagonal, -1, 1))));
      labelRotation = Math.max(minRotation, Math.min(maxRotation, labelRotation));
    }
    this.labelRotation = labelRotation;
  }
  afterCalculateLabelRotation() {
    callback(this.options.afterCalculateLabelRotation, [
      this
    ]);
  }
  afterAutoSkip() {
  }
  beforeFit() {
    callback(this.options.beforeFit, [
      this
    ]);
  }
  fit() {
    const minSize = {
      width: 0,
      height: 0
    };
    const { chart, options: { ticks: tickOpts, title: titleOpts, grid: gridOpts } } = this;
    const display = this._isVisible();
    const isHorizontal = this.isHorizontal();
    if (display) {
      const titleHeight = getTitleHeight(titleOpts, chart.options.font);
      if (isHorizontal) {
        minSize.width = this.maxWidth;
        minSize.height = getTickMarkLength(gridOpts) + titleHeight;
      } else {
        minSize.height = this.maxHeight;
        minSize.width = getTickMarkLength(gridOpts) + titleHeight;
      }
      if (tickOpts.display && this.ticks.length) {
        const { first, last, widest, highest } = this._getLabelSizes();
        const tickPadding = tickOpts.padding * 2;
        const angleRadians = toRadians(this.labelRotation);
        const cos = Math.cos(angleRadians);
        const sin = Math.sin(angleRadians);
        if (isHorizontal) {
          const labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;
          minSize.height = Math.min(this.maxHeight, minSize.height + labelHeight + tickPadding);
        } else {
          const labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;
          minSize.width = Math.min(this.maxWidth, minSize.width + labelWidth + tickPadding);
        }
        this._calculatePadding(first, last, sin, cos);
      }
    }
    this._handleMargins();
    if (isHorizontal) {
      this.width = this._length = chart.width - this._margins.left - this._margins.right;
      this.height = minSize.height;
    } else {
      this.width = minSize.width;
      this.height = this._length = chart.height - this._margins.top - this._margins.bottom;
    }
  }
  _calculatePadding(first, last, sin, cos) {
    const { ticks: { align, padding }, position: position2 } = this.options;
    const isRotated = this.labelRotation !== 0;
    const labelsBelowTicks = position2 !== "top" && this.axis === "x";
    if (this.isHorizontal()) {
      const offsetLeft = this.getPixelForTick(0) - this.left;
      const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);
      let paddingLeft = 0;
      let paddingRight = 0;
      if (isRotated) {
        if (labelsBelowTicks) {
          paddingLeft = cos * first.width;
          paddingRight = sin * last.height;
        } else {
          paddingLeft = sin * first.height;
          paddingRight = cos * last.width;
        }
      } else if (align === "start") {
        paddingRight = last.width;
      } else if (align === "end") {
        paddingLeft = first.width;
      } else if (align !== "inner") {
        paddingLeft = first.width / 2;
        paddingRight = last.width / 2;
      }
      this.paddingLeft = Math.max((paddingLeft - offsetLeft + padding) * this.width / (this.width - offsetLeft), 0);
      this.paddingRight = Math.max((paddingRight - offsetRight + padding) * this.width / (this.width - offsetRight), 0);
    } else {
      let paddingTop = last.height / 2;
      let paddingBottom = first.height / 2;
      if (align === "start") {
        paddingTop = 0;
        paddingBottom = first.height;
      } else if (align === "end") {
        paddingTop = last.height;
        paddingBottom = 0;
      }
      this.paddingTop = paddingTop + padding;
      this.paddingBottom = paddingBottom + padding;
    }
  }
  _handleMargins() {
    if (this._margins) {
      this._margins.left = Math.max(this.paddingLeft, this._margins.left);
      this._margins.top = Math.max(this.paddingTop, this._margins.top);
      this._margins.right = Math.max(this.paddingRight, this._margins.right);
      this._margins.bottom = Math.max(this.paddingBottom, this._margins.bottom);
    }
  }
  afterFit() {
    callback(this.options.afterFit, [
      this
    ]);
  }
  isHorizontal() {
    const { axis, position: position2 } = this.options;
    return position2 === "top" || position2 === "bottom" || axis === "x";
  }
  isFullSize() {
    return this.options.fullSize;
  }
  _convertTicksToLabels(ticks) {
    this.beforeTickToLabelConversion();
    this.generateTickLabels(ticks);
    let i2, ilen;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; i2++) {
      if (isNullOrUndef(ticks[i2].label)) {
        ticks.splice(i2, 1);
        ilen--;
        i2--;
      }
    }
    this.afterTickToLabelConversion();
  }
  _getLabelSizes() {
    let labelSizes = this._labelSizes;
    if (!labelSizes) {
      const sampleSize = this.options.ticks.sampleSize;
      let ticks = this.ticks;
      if (sampleSize < ticks.length) {
        ticks = sample(ticks, sampleSize);
      }
      this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length, this.options.ticks.maxTicksLimit);
    }
    return labelSizes;
  }
  _computeLabelSizes(ticks, length2, maxTicksLimit) {
    const { ctx, _longestTextCache: caches } = this;
    const widths = [];
    const heights = [];
    const increment2 = Math.floor(length2 / getTicksLimit(length2, maxTicksLimit));
    let widestLabelSize = 0;
    let highestLabelSize = 0;
    let i2, j2, jlen, label, tickFont, fontString, cache2, lineHeight2, width, height, nestedLabel;
    for (i2 = 0; i2 < length2; i2 += increment2) {
      label = ticks[i2].label;
      tickFont = this._resolveTickFontOptions(i2);
      ctx.font = fontString = tickFont.string;
      cache2 = caches[fontString] = caches[fontString] || {
        data: {},
        gc: []
      };
      lineHeight2 = tickFont.lineHeight;
      width = height = 0;
      if (!isNullOrUndef(label) && !isArray$4(label)) {
        width = _measureText(ctx, cache2.data, cache2.gc, width, label);
        height = lineHeight2;
      } else if (isArray$4(label)) {
        for (j2 = 0, jlen = label.length; j2 < jlen; ++j2) {
          nestedLabel = label[j2];
          if (!isNullOrUndef(nestedLabel) && !isArray$4(nestedLabel)) {
            width = _measureText(ctx, cache2.data, cache2.gc, width, nestedLabel);
            height += lineHeight2;
          }
        }
      }
      widths.push(width);
      heights.push(height);
      widestLabelSize = Math.max(width, widestLabelSize);
      highestLabelSize = Math.max(height, highestLabelSize);
    }
    garbageCollect(caches, length2);
    const widest = widths.indexOf(widestLabelSize);
    const highest = heights.indexOf(highestLabelSize);
    const valueAt = (idx) => ({
      width: widths[idx] || 0,
      height: heights[idx] || 0
    });
    return {
      first: valueAt(0),
      last: valueAt(length2 - 1),
      widest: valueAt(widest),
      highest: valueAt(highest),
      widths,
      heights
    };
  }
  getLabelForValue(value2) {
    return value2;
  }
  getPixelForValue(value2, index2) {
    return NaN;
  }
  getValueForPixel(pixel) {
  }
  getPixelForTick(index2) {
    const ticks = this.ticks;
    if (index2 < 0 || index2 > ticks.length - 1) {
      return null;
    }
    return this.getPixelForValue(ticks[index2].value);
  }
  getPixelForDecimal(decimal) {
    if (this._reversePixels) {
      decimal = 1 - decimal;
    }
    const pixel = this._startPixel + decimal * this._length;
    return _int16Range(this._alignToPixels ? _alignPixel(this.chart, pixel, 0) : pixel);
  }
  getDecimalForPixel(pixel) {
    const decimal = (pixel - this._startPixel) / this._length;
    return this._reversePixels ? 1 - decimal : decimal;
  }
  getBasePixel() {
    return this.getPixelForValue(this.getBaseValue());
  }
  getBaseValue() {
    const { min: min2, max: max2 } = this;
    return min2 < 0 && max2 < 0 ? max2 : min2 > 0 && max2 > 0 ? min2 : 0;
  }
  getContext(index2) {
    const ticks = this.ticks || [];
    if (index2 >= 0 && index2 < ticks.length) {
      const tick = ticks[index2];
      return tick.$context || (tick.$context = createTickContext(this.getContext(), index2, tick));
    }
    return this.$context || (this.$context = createScaleContext(this.chart.getContext(), this));
  }
  _tickSize() {
    const optionTicks = this.options.ticks;
    const rot = toRadians(this.labelRotation);
    const cos = Math.abs(Math.cos(rot));
    const sin = Math.abs(Math.sin(rot));
    const labelSizes = this._getLabelSizes();
    const padding = optionTicks.autoSkipPadding || 0;
    const w2 = labelSizes ? labelSizes.widest.width + padding : 0;
    const h3 = labelSizes ? labelSizes.highest.height + padding : 0;
    return this.isHorizontal() ? h3 * cos > w2 * sin ? w2 / cos : h3 / sin : h3 * sin < w2 * cos ? h3 / cos : w2 / sin;
  }
  _isVisible() {
    const display = this.options.display;
    if (display !== "auto") {
      return !!display;
    }
    return this.getMatchingVisibleMetas().length > 0;
  }
  _computeGridLineItems(chartArea) {
    const axis = this.axis;
    const chart = this.chart;
    const options = this.options;
    const { grid, position: position2, border } = options;
    const offset2 = grid.offset;
    const isHorizontal = this.isHorizontal();
    const ticks = this.ticks;
    const ticksLength = ticks.length + (offset2 ? 1 : 0);
    const tl2 = getTickMarkLength(grid);
    const items = [];
    const borderOpts = border.setContext(this.getContext());
    const axisWidth = borderOpts.display ? borderOpts.width : 0;
    const axisHalfWidth = axisWidth / 2;
    const alignBorderValue = function(pixel) {
      return _alignPixel(chart, pixel, axisWidth);
    };
    let borderValue, i2, lineValue, alignedLineValue;
    let tx1, ty1, tx2, ty2, x1, y1, x2, y2;
    if (position2 === "top") {
      borderValue = alignBorderValue(this.bottom);
      ty1 = this.bottom - tl2;
      ty2 = borderValue - axisHalfWidth;
      y1 = alignBorderValue(chartArea.top) + axisHalfWidth;
      y2 = chartArea.bottom;
    } else if (position2 === "bottom") {
      borderValue = alignBorderValue(this.top);
      y1 = chartArea.top;
      y2 = alignBorderValue(chartArea.bottom) - axisHalfWidth;
      ty1 = borderValue + axisHalfWidth;
      ty2 = this.top + tl2;
    } else if (position2 === "left") {
      borderValue = alignBorderValue(this.right);
      tx1 = this.right - tl2;
      tx2 = borderValue - axisHalfWidth;
      x1 = alignBorderValue(chartArea.left) + axisHalfWidth;
      x2 = chartArea.right;
    } else if (position2 === "right") {
      borderValue = alignBorderValue(this.left);
      x1 = chartArea.left;
      x2 = alignBorderValue(chartArea.right) - axisHalfWidth;
      tx1 = borderValue + axisHalfWidth;
      tx2 = this.left + tl2;
    } else if (axis === "x") {
      if (position2 === "center") {
        borderValue = alignBorderValue((chartArea.top + chartArea.bottom) / 2 + 0.5);
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value2));
      }
      y1 = chartArea.top;
      y2 = chartArea.bottom;
      ty1 = borderValue + axisHalfWidth;
      ty2 = ty1 + tl2;
    } else if (axis === "y") {
      if (position2 === "center") {
        borderValue = alignBorderValue((chartArea.left + chartArea.right) / 2);
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        borderValue = alignBorderValue(this.chart.scales[positionAxisID].getPixelForValue(value2));
      }
      tx1 = borderValue - axisHalfWidth;
      tx2 = tx1 - tl2;
      x1 = chartArea.left;
      x2 = chartArea.right;
    }
    const limit2 = valueOrDefault(options.ticks.maxTicksLimit, ticksLength);
    const step = Math.max(1, Math.ceil(ticksLength / limit2));
    for (i2 = 0; i2 < ticksLength; i2 += step) {
      const context = this.getContext(i2);
      const optsAtIndex = grid.setContext(context);
      const optsAtIndexBorder = border.setContext(context);
      const lineWidth = optsAtIndex.lineWidth;
      const lineColor = optsAtIndex.color;
      const borderDash = optsAtIndexBorder.dash || [];
      const borderDashOffset = optsAtIndexBorder.dashOffset;
      const tickWidth = optsAtIndex.tickWidth;
      const tickColor = optsAtIndex.tickColor;
      const tickBorderDash = optsAtIndex.tickBorderDash || [];
      const tickBorderDashOffset = optsAtIndex.tickBorderDashOffset;
      lineValue = getPixelForGridLine(this, i2, offset2);
      if (lineValue === void 0) {
        continue;
      }
      alignedLineValue = _alignPixel(chart, lineValue, lineWidth);
      if (isHorizontal) {
        tx1 = tx2 = x1 = x2 = alignedLineValue;
      } else {
        ty1 = ty2 = y1 = y2 = alignedLineValue;
      }
      items.push({
        tx1,
        ty1,
        tx2,
        ty2,
        x1,
        y1,
        x2,
        y2,
        width: lineWidth,
        color: lineColor,
        borderDash,
        borderDashOffset,
        tickWidth,
        tickColor,
        tickBorderDash,
        tickBorderDashOffset
      });
    }
    this._ticksLength = ticksLength;
    this._borderValue = borderValue;
    return items;
  }
  _computeLabelItems(chartArea) {
    const axis = this.axis;
    const options = this.options;
    const { position: position2, ticks: optionTicks } = options;
    const isHorizontal = this.isHorizontal();
    const ticks = this.ticks;
    const { align, crossAlign, padding, mirror } = optionTicks;
    const tl2 = getTickMarkLength(options.grid);
    const tickAndPadding = tl2 + padding;
    const hTickAndPadding = mirror ? -padding : tickAndPadding;
    const rotation = -toRadians(this.labelRotation);
    const items = [];
    let i2, ilen, tick, label, x2, y2, textAlign, pixel, font, lineHeight2, lineCount, textOffset;
    let textBaseline = "middle";
    if (position2 === "top") {
      y2 = this.bottom - hTickAndPadding;
      textAlign = this._getXAxisLabelAlignment();
    } else if (position2 === "bottom") {
      y2 = this.top + hTickAndPadding;
      textAlign = this._getXAxisLabelAlignment();
    } else if (position2 === "left") {
      const ret = this._getYAxisLabelAlignment(tl2);
      textAlign = ret.textAlign;
      x2 = ret.x;
    } else if (position2 === "right") {
      const ret = this._getYAxisLabelAlignment(tl2);
      textAlign = ret.textAlign;
      x2 = ret.x;
    } else if (axis === "x") {
      if (position2 === "center") {
        y2 = (chartArea.top + chartArea.bottom) / 2 + tickAndPadding;
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        y2 = this.chart.scales[positionAxisID].getPixelForValue(value2) + tickAndPadding;
      }
      textAlign = this._getXAxisLabelAlignment();
    } else if (axis === "y") {
      if (position2 === "center") {
        x2 = (chartArea.left + chartArea.right) / 2 - tickAndPadding;
      } else if (isObject$3(position2)) {
        const positionAxisID = Object.keys(position2)[0];
        const value2 = position2[positionAxisID];
        x2 = this.chart.scales[positionAxisID].getPixelForValue(value2);
      }
      textAlign = this._getYAxisLabelAlignment(tl2).textAlign;
    }
    if (axis === "y") {
      if (align === "start") {
        textBaseline = "top";
      } else if (align === "end") {
        textBaseline = "bottom";
      }
    }
    const labelSizes = this._getLabelSizes();
    for (i2 = 0, ilen = ticks.length; i2 < ilen; ++i2) {
      tick = ticks[i2];
      label = tick.label;
      const optsAtIndex = optionTicks.setContext(this.getContext(i2));
      pixel = this.getPixelForTick(i2) + optionTicks.labelOffset;
      font = this._resolveTickFontOptions(i2);
      lineHeight2 = font.lineHeight;
      lineCount = isArray$4(label) ? label.length : 1;
      const halfCount = lineCount / 2;
      const color2 = optsAtIndex.color;
      const strokeColor = optsAtIndex.textStrokeColor;
      const strokeWidth = optsAtIndex.textStrokeWidth;
      let tickTextAlign = textAlign;
      if (isHorizontal) {
        x2 = pixel;
        if (textAlign === "inner") {
          if (i2 === ilen - 1) {
            tickTextAlign = !this.options.reverse ? "right" : "left";
          } else if (i2 === 0) {
            tickTextAlign = !this.options.reverse ? "left" : "right";
          } else {
            tickTextAlign = "center";
          }
        }
        if (position2 === "top") {
          if (crossAlign === "near" || rotation !== 0) {
            textOffset = -lineCount * lineHeight2 + lineHeight2 / 2;
          } else if (crossAlign === "center") {
            textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight2 + lineHeight2;
          } else {
            textOffset = -labelSizes.highest.height + lineHeight2 / 2;
          }
        } else {
          if (crossAlign === "near" || rotation !== 0) {
            textOffset = lineHeight2 / 2;
          } else if (crossAlign === "center") {
            textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight2;
          } else {
            textOffset = labelSizes.highest.height - lineCount * lineHeight2;
          }
        }
        if (mirror) {
          textOffset *= -1;
        }
        if (rotation !== 0 && !optsAtIndex.showLabelBackdrop) {
          x2 += lineHeight2 / 2 * Math.sin(rotation);
        }
      } else {
        y2 = pixel;
        textOffset = (1 - lineCount) * lineHeight2 / 2;
      }
      let backdrop;
      if (optsAtIndex.showLabelBackdrop) {
        const labelPadding = toPadding(optsAtIndex.backdropPadding);
        const height = labelSizes.heights[i2];
        const width = labelSizes.widths[i2];
        let top2 = textOffset - labelPadding.top;
        let left2 = 0 - labelPadding.left;
        switch (textBaseline) {
          case "middle":
            top2 -= height / 2;
            break;
          case "bottom":
            top2 -= height;
            break;
        }
        switch (textAlign) {
          case "center":
            left2 -= width / 2;
            break;
          case "right":
            left2 -= width;
            break;
          case "inner":
            if (i2 === ilen - 1) {
              left2 -= width;
            } else if (i2 > 0) {
              left2 -= width / 2;
            }
            break;
        }
        backdrop = {
          left: left2,
          top: top2,
          width: width + labelPadding.width,
          height: height + labelPadding.height,
          color: optsAtIndex.backdropColor
        };
      }
      items.push({
        label,
        font,
        textOffset,
        options: {
          rotation,
          color: color2,
          strokeColor,
          strokeWidth,
          textAlign: tickTextAlign,
          textBaseline,
          translation: [
            x2,
            y2
          ],
          backdrop
        }
      });
    }
    return items;
  }
  _getXAxisLabelAlignment() {
    const { position: position2, ticks } = this.options;
    const rotation = -toRadians(this.labelRotation);
    if (rotation) {
      return position2 === "top" ? "left" : "right";
    }
    let align = "center";
    if (ticks.align === "start") {
      align = "left";
    } else if (ticks.align === "end") {
      align = "right";
    } else if (ticks.align === "inner") {
      align = "inner";
    }
    return align;
  }
  _getYAxisLabelAlignment(tl2) {
    const { position: position2, ticks: { crossAlign, mirror, padding } } = this.options;
    const labelSizes = this._getLabelSizes();
    const tickAndPadding = tl2 + padding;
    const widest = labelSizes.widest.width;
    let textAlign;
    let x2;
    if (position2 === "left") {
      if (mirror) {
        x2 = this.right + padding;
        if (crossAlign === "near") {
          textAlign = "left";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 += widest / 2;
        } else {
          textAlign = "right";
          x2 += widest;
        }
      } else {
        x2 = this.right - tickAndPadding;
        if (crossAlign === "near") {
          textAlign = "right";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 -= widest / 2;
        } else {
          textAlign = "left";
          x2 = this.left;
        }
      }
    } else if (position2 === "right") {
      if (mirror) {
        x2 = this.left + padding;
        if (crossAlign === "near") {
          textAlign = "right";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 -= widest / 2;
        } else {
          textAlign = "left";
          x2 -= widest;
        }
      } else {
        x2 = this.left + tickAndPadding;
        if (crossAlign === "near") {
          textAlign = "left";
        } else if (crossAlign === "center") {
          textAlign = "center";
          x2 += widest / 2;
        } else {
          textAlign = "right";
          x2 = this.right;
        }
      }
    } else {
      textAlign = "right";
    }
    return {
      textAlign,
      x: x2
    };
  }
  _computeLabelArea() {
    if (this.options.ticks.mirror) {
      return;
    }
    const chart = this.chart;
    const position2 = this.options.position;
    if (position2 === "left" || position2 === "right") {
      return {
        top: 0,
        left: this.left,
        bottom: chart.height,
        right: this.right
      };
    }
    if (position2 === "top" || position2 === "bottom") {
      return {
        top: this.top,
        left: 0,
        bottom: this.bottom,
        right: chart.width
      };
    }
  }
  drawBackground() {
    const { ctx, options: { backgroundColor }, left: left2, top: top2, width, height } = this;
    if (backgroundColor) {
      ctx.save();
      ctx.fillStyle = backgroundColor;
      ctx.fillRect(left2, top2, width, height);
      ctx.restore();
    }
  }
  getLineWidthForValue(value2) {
    const grid = this.options.grid;
    if (!this._isVisible() || !grid.display) {
      return 0;
    }
    const ticks = this.ticks;
    const index2 = ticks.findIndex((t2) => t2.value === value2);
    if (index2 >= 0) {
      const opts2 = grid.setContext(this.getContext(index2));
      return opts2.lineWidth;
    }
    return 0;
  }
  drawGrid(chartArea) {
    const grid = this.options.grid;
    const ctx = this.ctx;
    const items = this._gridLineItems || (this._gridLineItems = this._computeGridLineItems(chartArea));
    let i2, ilen;
    const drawLine = (p1, p2, style2) => {
      if (!style2.width || !style2.color) {
        return;
      }
      ctx.save();
      ctx.lineWidth = style2.width;
      ctx.strokeStyle = style2.color;
      ctx.setLineDash(style2.borderDash || []);
      ctx.lineDashOffset = style2.borderDashOffset;
      ctx.beginPath();
      ctx.moveTo(p1.x, p1.y);
      ctx.lineTo(p2.x, p2.y);
      ctx.stroke();
      ctx.restore();
    };
    if (grid.display) {
      for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
        const item = items[i2];
        if (grid.drawOnChartArea) {
          drawLine({
            x: item.x1,
            y: item.y1
          }, {
            x: item.x2,
            y: item.y2
          }, item);
        }
        if (grid.drawTicks) {
          drawLine({
            x: item.tx1,
            y: item.ty1
          }, {
            x: item.tx2,
            y: item.ty2
          }, {
            color: item.tickColor,
            width: item.tickWidth,
            borderDash: item.tickBorderDash,
            borderDashOffset: item.tickBorderDashOffset
          });
        }
      }
    }
  }
  drawBorder() {
    const { chart, ctx, options: { border, grid } } = this;
    const borderOpts = border.setContext(this.getContext());
    const axisWidth = border.display ? borderOpts.width : 0;
    if (!axisWidth) {
      return;
    }
    const lastLineWidth = grid.setContext(this.getContext(0)).lineWidth;
    const borderValue = this._borderValue;
    let x1, x2, y1, y2;
    if (this.isHorizontal()) {
      x1 = _alignPixel(chart, this.left, axisWidth) - axisWidth / 2;
      x2 = _alignPixel(chart, this.right, lastLineWidth) + lastLineWidth / 2;
      y1 = y2 = borderValue;
    } else {
      y1 = _alignPixel(chart, this.top, axisWidth) - axisWidth / 2;
      y2 = _alignPixel(chart, this.bottom, lastLineWidth) + lastLineWidth / 2;
      x1 = x2 = borderValue;
    }
    ctx.save();
    ctx.lineWidth = borderOpts.width;
    ctx.strokeStyle = borderOpts.color;
    ctx.beginPath();
    ctx.moveTo(x1, y1);
    ctx.lineTo(x2, y2);
    ctx.stroke();
    ctx.restore();
  }
  drawLabels(chartArea) {
    const optionTicks = this.options.ticks;
    if (!optionTicks.display) {
      return;
    }
    const ctx = this.ctx;
    const area = this._computeLabelArea();
    if (area) {
      clipArea(ctx, area);
    }
    const items = this.getLabelItems(chartArea);
    for (const item of items) {
      const renderTextOptions = item.options;
      const tickFont = item.font;
      const label = item.label;
      const y2 = item.textOffset;
      renderText(ctx, label, 0, y2, tickFont, renderTextOptions);
    }
    if (area) {
      unclipArea(ctx);
    }
  }
  drawTitle() {
    const { ctx, options: { position: position2, title, reverse } } = this;
    if (!title.display) {
      return;
    }
    const font = toFont(title.font);
    const padding = toPadding(title.padding);
    const align = title.align;
    let offset2 = font.lineHeight / 2;
    if (position2 === "bottom" || position2 === "center" || isObject$3(position2)) {
      offset2 += padding.bottom;
      if (isArray$4(title.text)) {
        offset2 += font.lineHeight * (title.text.length - 1);
      }
    } else {
      offset2 += padding.top;
    }
    const { titleX, titleY, maxWidth, rotation } = titleArgs(this, offset2, position2, align);
    renderText(ctx, title.text, 0, 0, font, {
      color: title.color,
      maxWidth,
      rotation,
      textAlign: titleAlign(align, position2, reverse),
      textBaseline: "middle",
      translation: [
        titleX,
        titleY
      ]
    });
  }
  draw(chartArea) {
    if (!this._isVisible()) {
      return;
    }
    this.drawBackground();
    this.drawGrid(chartArea);
    this.drawBorder();
    this.drawTitle();
    this.drawLabels(chartArea);
  }
  _layers() {
    const opts2 = this.options;
    const tz = opts2.ticks && opts2.ticks.z || 0;
    const gz = valueOrDefault(opts2.grid && opts2.grid.z, -1);
    const bz = valueOrDefault(opts2.border && opts2.border.z, 0);
    if (!this._isVisible() || this.draw !== Scale.prototype.draw) {
      return [
        {
          z: tz,
          draw: (chartArea) => {
            this.draw(chartArea);
          }
        }
      ];
    }
    return [
      {
        z: gz,
        draw: (chartArea) => {
          this.drawBackground();
          this.drawGrid(chartArea);
          this.drawTitle();
        }
      },
      {
        z: bz,
        draw: () => {
          this.drawBorder();
        }
      },
      {
        z: tz,
        draw: (chartArea) => {
          this.drawLabels(chartArea);
        }
      }
    ];
  }
  getMatchingVisibleMetas(type4) {
    const metas = this.chart.getSortedVisibleDatasetMetas();
    const axisID = this.axis + "AxisID";
    const result = [];
    let i2, ilen;
    for (i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      const meta = metas[i2];
      if (meta[axisID] === this.id && (!type4 || meta.type === type4)) {
        result.push(meta);
      }
    }
    return result;
  }
  _resolveTickFontOptions(index2) {
    const opts2 = this.options.ticks.setContext(this.getContext(index2));
    return toFont(opts2.font);
  }
  _maxDigits() {
    const fontSize = this._resolveTickFontOptions(0).lineHeight;
    return (this.isHorizontal() ? this.width : this.height) / fontSize;
  }
}
class TypedRegistry {
  constructor(type4, scope, override) {
    this.type = type4;
    this.scope = scope;
    this.override = override;
    this.items = /* @__PURE__ */ Object.create(null);
  }
  isForType(type4) {
    return Object.prototype.isPrototypeOf.call(this.type.prototype, type4.prototype);
  }
  register(item) {
    const proto2 = Object.getPrototypeOf(item);
    let parentScope;
    if (isIChartComponent(proto2)) {
      parentScope = this.register(proto2);
    }
    const items = this.items;
    const id2 = item.id;
    const scope = this.scope + "." + id2;
    if (!id2) {
      throw new Error("class does not have id: " + item);
    }
    if (id2 in items) {
      return scope;
    }
    items[id2] = item;
    registerDefaults(item, scope, parentScope);
    if (this.override) {
      defaults$2.override(item.id, item.overrides);
    }
    return scope;
  }
  get(id2) {
    return this.items[id2];
  }
  unregister(item) {
    const items = this.items;
    const id2 = item.id;
    const scope = this.scope;
    if (id2 in items) {
      delete items[id2];
    }
    if (scope && id2 in defaults$2[scope]) {
      delete defaults$2[scope][id2];
      if (this.override) {
        delete overrides[id2];
      }
    }
  }
}
function registerDefaults(item, scope, parentScope) {
  const itemDefaults = merge$2(/* @__PURE__ */ Object.create(null), [
    parentScope ? defaults$2.get(parentScope) : {},
    defaults$2.get(scope),
    item.defaults
  ]);
  defaults$2.set(scope, itemDefaults);
  if (item.defaultRoutes) {
    routeDefaults(scope, item.defaultRoutes);
  }
  if (item.descriptors) {
    defaults$2.describe(scope, item.descriptors);
  }
}
function routeDefaults(scope, routes) {
  Object.keys(routes).forEach((property2) => {
    const propertyParts = property2.split(".");
    const sourceName = propertyParts.pop();
    const sourceScope = [
      scope
    ].concat(propertyParts).join(".");
    const parts = routes[property2].split(".");
    const targetName = parts.pop();
    const targetScope = parts.join(".");
    defaults$2.route(sourceScope, sourceName, targetScope, targetName);
  });
}
function isIChartComponent(proto2) {
  return "id" in proto2 && "defaults" in proto2;
}
class Registry {
  constructor() {
    this.controllers = new TypedRegistry(DatasetController, "datasets", true);
    this.elements = new TypedRegistry(Element$1, "elements");
    this.plugins = new TypedRegistry(Object, "plugins");
    this.scales = new TypedRegistry(Scale, "scales");
    this._typedRegistries = [
      this.controllers,
      this.scales,
      this.elements
    ];
  }
  add(...args) {
    this._each("register", args);
  }
  remove(...args) {
    this._each("unregister", args);
  }
  addControllers(...args) {
    this._each("register", args, this.controllers);
  }
  addElements(...args) {
    this._each("register", args, this.elements);
  }
  addPlugins(...args) {
    this._each("register", args, this.plugins);
  }
  addScales(...args) {
    this._each("register", args, this.scales);
  }
  getController(id2) {
    return this._get(id2, this.controllers, "controller");
  }
  getElement(id2) {
    return this._get(id2, this.elements, "element");
  }
  getPlugin(id2) {
    return this._get(id2, this.plugins, "plugin");
  }
  getScale(id2) {
    return this._get(id2, this.scales, "scale");
  }
  removeControllers(...args) {
    this._each("unregister", args, this.controllers);
  }
  removeElements(...args) {
    this._each("unregister", args, this.elements);
  }
  removePlugins(...args) {
    this._each("unregister", args, this.plugins);
  }
  removeScales(...args) {
    this._each("unregister", args, this.scales);
  }
  _each(method4, args, typedRegistry) {
    [
      ...args
    ].forEach((arg) => {
      const reg = typedRegistry || this._getRegistryForType(arg);
      if (typedRegistry || reg.isForType(arg) || reg === this.plugins && arg.id) {
        this._exec(method4, reg, arg);
      } else {
        each(arg, (item) => {
          const itemReg = typedRegistry || this._getRegistryForType(item);
          this._exec(method4, itemReg, item);
        });
      }
    });
  }
  _exec(method4, registry2, component) {
    const camelMethod = _capitalize(method4);
    callback(component["before" + camelMethod], [], component);
    registry2[method4](component);
    callback(component["after" + camelMethod], [], component);
  }
  _getRegistryForType(type4) {
    for (let i2 = 0; i2 < this._typedRegistries.length; i2++) {
      const reg = this._typedRegistries[i2];
      if (reg.isForType(type4)) {
        return reg;
      }
    }
    return this.plugins;
  }
  _get(id2, typedRegistry, type4) {
    const item = typedRegistry.get(id2);
    if (item === void 0) {
      throw new Error('"' + id2 + '" is not a registered ' + type4 + ".");
    }
    return item;
  }
}
var registry = /* @__PURE__ */ new Registry();
class PluginService {
  constructor() {
    this._init = [];
  }
  notify(chart, hook, args, filter3) {
    if (hook === "beforeInit") {
      this._init = this._createDescriptors(chart, true);
      this._notify(this._init, chart, "install");
    }
    const descriptors2 = filter3 ? this._descriptors(chart).filter(filter3) : this._descriptors(chart);
    const result = this._notify(descriptors2, chart, hook, args);
    if (hook === "afterDestroy") {
      this._notify(descriptors2, chart, "stop");
      this._notify(this._init, chart, "uninstall");
    }
    return result;
  }
  _notify(descriptors2, chart, hook, args) {
    args = args || {};
    for (const descriptor of descriptors2) {
      const plugin = descriptor.plugin;
      const method4 = plugin[hook];
      const params = [
        chart,
        args,
        descriptor.options
      ];
      if (callback(method4, params, plugin) === false && args.cancelable) {
        return false;
      }
    }
    return true;
  }
  invalidate() {
    if (!isNullOrUndef(this._cache)) {
      this._oldCache = this._cache;
      this._cache = void 0;
    }
  }
  _descriptors(chart) {
    if (this._cache) {
      return this._cache;
    }
    const descriptors2 = this._cache = this._createDescriptors(chart);
    this._notifyStateChanges(chart);
    return descriptors2;
  }
  _createDescriptors(chart, all3) {
    const config2 = chart && chart.config;
    const options = valueOrDefault(config2.options && config2.options.plugins, {});
    const plugins = allPlugins(config2);
    return options === false && !all3 ? [] : createDescriptors(chart, plugins, options, all3);
  }
  _notifyStateChanges(chart) {
    const previousDescriptors = this._oldCache || [];
    const descriptors2 = this._cache;
    const diff2 = (a2, b2) => a2.filter((x2) => !b2.some((y2) => x2.plugin.id === y2.plugin.id));
    this._notify(diff2(previousDescriptors, descriptors2), chart, "stop");
    this._notify(diff2(descriptors2, previousDescriptors), chart, "start");
  }
}
function allPlugins(config2) {
  const localIds = {};
  const plugins = [];
  const keys2 = Object.keys(registry.plugins.items);
  for (let i2 = 0; i2 < keys2.length; i2++) {
    plugins.push(registry.getPlugin(keys2[i2]));
  }
  const local = config2.plugins || [];
  for (let i2 = 0; i2 < local.length; i2++) {
    const plugin = local[i2];
    if (plugins.indexOf(plugin) === -1) {
      plugins.push(plugin);
      localIds[plugin.id] = true;
    }
  }
  return {
    plugins,
    localIds
  };
}
function getOpts(options, all3) {
  if (!all3 && options === false) {
    return null;
  }
  if (options === true) {
    return {};
  }
  return options;
}
function createDescriptors(chart, { plugins, localIds }, options, all3) {
  const result = [];
  const context = chart.getContext();
  for (const plugin of plugins) {
    const id2 = plugin.id;
    const opts2 = getOpts(options[id2], all3);
    if (opts2 === null) {
      continue;
    }
    result.push({
      plugin,
      options: pluginOpts(chart.config, {
        plugin,
        local: localIds[id2]
      }, opts2, context)
    });
  }
  return result;
}
function pluginOpts(config2, { plugin, local }, opts2, context) {
  const keys2 = config2.pluginScopeKeys(plugin);
  const scopes = config2.getOptionScopes(opts2, keys2);
  if (local && plugin.defaults) {
    scopes.push(plugin.defaults);
  }
  return config2.createResolver(scopes, context, [
    ""
  ], {
    scriptable: false,
    indexable: false,
    allKeys: true
  });
}
function getIndexAxis(type4, options) {
  const datasetDefaults = defaults$2.datasets[type4] || {};
  const datasetOptions = (options.datasets || {})[type4] || {};
  return datasetOptions.indexAxis || options.indexAxis || datasetDefaults.indexAxis || "x";
}
function getAxisFromDefaultScaleID(id2, indexAxis) {
  let axis = id2;
  if (id2 === "_index_") {
    axis = indexAxis;
  } else if (id2 === "_value_") {
    axis = indexAxis === "x" ? "y" : "x";
  }
  return axis;
}
function getDefaultScaleIDFromAxis(axis, indexAxis) {
  return axis === indexAxis ? "_index_" : "_value_";
}
function idMatchesAxis(id2) {
  if (id2 === "x" || id2 === "y" || id2 === "r") {
    return id2;
  }
}
function axisFromPosition(position2) {
  if (position2 === "top" || position2 === "bottom") {
    return "x";
  }
  if (position2 === "left" || position2 === "right") {
    return "y";
  }
}
function determineAxis(id2, ...scaleOptions) {
  if (idMatchesAxis(id2)) {
    return id2;
  }
  for (const opts2 of scaleOptions) {
    const axis = opts2.axis || axisFromPosition(opts2.position) || id2.length > 1 && idMatchesAxis(id2[0].toLowerCase());
    if (axis) {
      return axis;
    }
  }
  throw new Error(`Cannot determine type of '${id2}' axis. Please provide 'axis' or 'position' option.`);
}
function getAxisFromDataset(id2, axis, dataset) {
  if (dataset[axis + "AxisID"] === id2) {
    return {
      axis
    };
  }
}
function retrieveAxisFromDatasets(id2, config2) {
  if (config2.data && config2.data.datasets) {
    const boundDs = config2.data.datasets.filter((d2) => d2.xAxisID === id2 || d2.yAxisID === id2);
    if (boundDs.length) {
      return getAxisFromDataset(id2, "x", boundDs[0]) || getAxisFromDataset(id2, "y", boundDs[0]);
    }
  }
  return {};
}
function mergeScaleConfig(config2, options) {
  const chartDefaults = overrides[config2.type] || {
    scales: {}
  };
  const configScales = options.scales || {};
  const chartIndexAxis = getIndexAxis(config2.type, options);
  const scales = /* @__PURE__ */ Object.create(null);
  Object.keys(configScales).forEach((id2) => {
    const scaleConf = configScales[id2];
    if (!isObject$3(scaleConf)) {
      return console.error(`Invalid scale configuration for scale: ${id2}`);
    }
    if (scaleConf._proxy) {
      return console.warn(`Ignoring resolver passed as options for scale: ${id2}`);
    }
    const axis = determineAxis(id2, scaleConf, retrieveAxisFromDatasets(id2, config2), defaults$2.scales[scaleConf.type]);
    const defaultId = getDefaultScaleIDFromAxis(axis, chartIndexAxis);
    const defaultScaleOptions = chartDefaults.scales || {};
    scales[id2] = mergeIf(/* @__PURE__ */ Object.create(null), [
      {
        axis
      },
      scaleConf,
      defaultScaleOptions[axis],
      defaultScaleOptions[defaultId]
    ]);
  });
  config2.data.datasets.forEach((dataset) => {
    const type4 = dataset.type || config2.type;
    const indexAxis = dataset.indexAxis || getIndexAxis(type4, options);
    const datasetDefaults = overrides[type4] || {};
    const defaultScaleOptions = datasetDefaults.scales || {};
    Object.keys(defaultScaleOptions).forEach((defaultID) => {
      const axis = getAxisFromDefaultScaleID(defaultID, indexAxis);
      const id2 = dataset[axis + "AxisID"] || axis;
      scales[id2] = scales[id2] || /* @__PURE__ */ Object.create(null);
      mergeIf(scales[id2], [
        {
          axis
        },
        configScales[id2],
        defaultScaleOptions[defaultID]
      ]);
    });
  });
  Object.keys(scales).forEach((key) => {
    const scale2 = scales[key];
    mergeIf(scale2, [
      defaults$2.scales[scale2.type],
      defaults$2.scale
    ]);
  });
  return scales;
}
function initOptions(config2) {
  const options = config2.options || (config2.options = {});
  options.plugins = valueOrDefault(options.plugins, {});
  options.scales = mergeScaleConfig(config2, options);
}
function initData(data) {
  data = data || {};
  data.datasets = data.datasets || [];
  data.labels = data.labels || [];
  return data;
}
function initConfig(config2) {
  config2 = config2 || {};
  config2.data = initData(config2.data);
  initOptions(config2);
  return config2;
}
const keyCache = /* @__PURE__ */ new Map();
const keysCached = /* @__PURE__ */ new Set();
function cachedKeys(cacheKey, generate2) {
  let keys2 = keyCache.get(cacheKey);
  if (!keys2) {
    keys2 = generate2();
    keyCache.set(cacheKey, keys2);
    keysCached.add(keys2);
  }
  return keys2;
}
const addIfFound = (set2, obj, key) => {
  const opts2 = resolveObjectKey(obj, key);
  if (opts2 !== void 0) {
    set2.add(opts2);
  }
};
class Config {
  constructor(config2) {
    this._config = initConfig(config2);
    this._scopeCache = /* @__PURE__ */ new Map();
    this._resolverCache = /* @__PURE__ */ new Map();
  }
  get platform() {
    return this._config.platform;
  }
  get type() {
    return this._config.type;
  }
  set type(type4) {
    this._config.type = type4;
  }
  get data() {
    return this._config.data;
  }
  set data(data) {
    this._config.data = initData(data);
  }
  get options() {
    return this._config.options;
  }
  set options(options) {
    this._config.options = options;
  }
  get plugins() {
    return this._config.plugins;
  }
  update() {
    const config2 = this._config;
    this.clearCache();
    initOptions(config2);
  }
  clearCache() {
    this._scopeCache.clear();
    this._resolverCache.clear();
  }
  datasetScopeKeys(datasetType) {
    return cachedKeys(datasetType, () => [
      [
        `datasets.${datasetType}`,
        ""
      ]
    ]);
  }
  datasetAnimationScopeKeys(datasetType, transition3) {
    return cachedKeys(`${datasetType}.transition.${transition3}`, () => [
      [
        `datasets.${datasetType}.transitions.${transition3}`,
        `transitions.${transition3}`
      ],
      [
        `datasets.${datasetType}`,
        ""
      ]
    ]);
  }
  datasetElementScopeKeys(datasetType, elementType) {
    return cachedKeys(`${datasetType}-${elementType}`, () => [
      [
        `datasets.${datasetType}.elements.${elementType}`,
        `datasets.${datasetType}`,
        `elements.${elementType}`,
        ""
      ]
    ]);
  }
  pluginScopeKeys(plugin) {
    const id2 = plugin.id;
    const type4 = this.type;
    return cachedKeys(`${type4}-plugin-${id2}`, () => [
      [
        `plugins.${id2}`,
        ...plugin.additionalOptionScopes || []
      ]
    ]);
  }
  _cachedScopes(mainScope, resetCache) {
    const _scopeCache = this._scopeCache;
    let cache2 = _scopeCache.get(mainScope);
    if (!cache2 || resetCache) {
      cache2 = /* @__PURE__ */ new Map();
      _scopeCache.set(mainScope, cache2);
    }
    return cache2;
  }
  getOptionScopes(mainScope, keyLists, resetCache) {
    const { options, type: type4 } = this;
    const cache2 = this._cachedScopes(mainScope, resetCache);
    const cached = cache2.get(keyLists);
    if (cached) {
      return cached;
    }
    const scopes = /* @__PURE__ */ new Set();
    keyLists.forEach((keys2) => {
      if (mainScope) {
        scopes.add(mainScope);
        keys2.forEach((key) => addIfFound(scopes, mainScope, key));
      }
      keys2.forEach((key) => addIfFound(scopes, options, key));
      keys2.forEach((key) => addIfFound(scopes, overrides[type4] || {}, key));
      keys2.forEach((key) => addIfFound(scopes, defaults$2, key));
      keys2.forEach((key) => addIfFound(scopes, descriptors$1, key));
    });
    const array4 = Array.from(scopes);
    if (array4.length === 0) {
      array4.push(/* @__PURE__ */ Object.create(null));
    }
    if (keysCached.has(keyLists)) {
      cache2.set(keyLists, array4);
    }
    return array4;
  }
  chartOptionScopes() {
    const { options, type: type4 } = this;
    return [
      options,
      overrides[type4] || {},
      defaults$2.datasets[type4] || {},
      {
        type: type4
      },
      defaults$2,
      descriptors$1
    ];
  }
  resolveNamedOptions(scopes, names2, context, prefixes2 = [
    ""
  ]) {
    const result = {
      $shared: true
    };
    const { resolver: resolver2, subPrefixes } = getResolver(this._resolverCache, scopes, prefixes2);
    let options = resolver2;
    if (needContext(resolver2, names2)) {
      result.$shared = false;
      context = isFunction$3(context) ? context() : context;
      const subResolver = this.createResolver(scopes, context, subPrefixes);
      options = _attachContext(resolver2, context, subResolver);
    }
    for (const prop of names2) {
      result[prop] = options[prop];
    }
    return result;
  }
  createResolver(scopes, context, prefixes2 = [
    ""
  ], descriptorDefaults) {
    const { resolver: resolver2 } = getResolver(this._resolverCache, scopes, prefixes2);
    return isObject$3(context) ? _attachContext(resolver2, context, void 0, descriptorDefaults) : resolver2;
  }
}
function getResolver(resolverCache, scopes, prefixes2) {
  let cache2 = resolverCache.get(scopes);
  if (!cache2) {
    cache2 = /* @__PURE__ */ new Map();
    resolverCache.set(scopes, cache2);
  }
  const cacheKey = prefixes2.join();
  let cached = cache2.get(cacheKey);
  if (!cached) {
    const resolver2 = _createResolver(scopes, prefixes2);
    cached = {
      resolver: resolver2,
      subPrefixes: prefixes2.filter((p2) => !p2.toLowerCase().includes("hover"))
    };
    cache2.set(cacheKey, cached);
  }
  return cached;
}
const hasFunction = (value2) => isObject$3(value2) && Object.getOwnPropertyNames(value2).some((key) => isFunction$3(value2[key]));
function needContext(proxy, names2) {
  const { isScriptable, isIndexable } = _descriptors(proxy);
  for (const prop of names2) {
    const scriptable = isScriptable(prop);
    const indexable = isIndexable(prop);
    const value2 = (indexable || scriptable) && proxy[prop];
    if (scriptable && (isFunction$3(value2) || hasFunction(value2)) || indexable && isArray$4(value2)) {
      return true;
    }
  }
  return false;
}
var version = "4.5.0";
const KNOWN_POSITIONS = [
  "top",
  "bottom",
  "left",
  "right",
  "chartArea"
];
function positionIsHorizontal(position2, axis) {
  return position2 === "top" || position2 === "bottom" || KNOWN_POSITIONS.indexOf(position2) === -1 && axis === "x";
}
function compare2Level(l1, l2) {
  return function(a2, b2) {
    return a2[l1] === b2[l1] ? a2[l2] - b2[l2] : a2[l1] - b2[l1];
  };
}
function onAnimationsComplete(context) {
  const chart = context.chart;
  const animationOptions = chart.options.animation;
  chart.notifyPlugins("afterRender");
  callback(animationOptions && animationOptions.onComplete, [
    context
  ], chart);
}
function onAnimationProgress(context) {
  const chart = context.chart;
  const animationOptions = chart.options.animation;
  callback(animationOptions && animationOptions.onProgress, [
    context
  ], chart);
}
function getCanvas(item) {
  if (_isDomSupported() && typeof item === "string") {
    item = document.getElementById(item);
  } else if (item && item.length) {
    item = item[0];
  }
  if (item && item.canvas) {
    item = item.canvas;
  }
  return item;
}
const instances = {};
const getChart = (key) => {
  const canvas = getCanvas(key);
  return Object.values(instances).filter((c2) => c2.canvas === canvas).pop();
};
function moveNumericKeys(obj, start, move2) {
  const keys2 = Object.keys(obj);
  for (const key of keys2) {
    const intKey = +key;
    if (intKey >= start) {
      const value2 = obj[key];
      delete obj[key];
      if (move2 > 0 || intKey > start) {
        obj[intKey + move2] = value2;
      }
    }
  }
}
function determineLastEvent(e2, lastEvent, inChartArea, isClick) {
  if (!inChartArea || e2.type === "mouseout") {
    return null;
  }
  if (isClick) {
    return lastEvent;
  }
  return e2;
}
let Chart$1 = (_b = class {
  static register(...items) {
    registry.add(...items);
    invalidatePlugins();
  }
  static unregister(...items) {
    registry.remove(...items);
    invalidatePlugins();
  }
  constructor(item, userConfig) {
    const config2 = this.config = new Config(userConfig);
    const initialCanvas = getCanvas(item);
    const existingChart = getChart(initialCanvas);
    if (existingChart) {
      throw new Error("Canvas is already in use. Chart with ID '" + existingChart.id + "' must be destroyed before the canvas with ID '" + existingChart.canvas.id + "' can be reused.");
    }
    const options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
    this.platform = new (config2.platform || _detectPlatform(initialCanvas))();
    this.platform.updateConfig(config2);
    const context = this.platform.acquireContext(initialCanvas, options.aspectRatio);
    const canvas = context && context.canvas;
    const height = canvas && canvas.height;
    const width = canvas && canvas.width;
    this.id = uid();
    this.ctx = context;
    this.canvas = canvas;
    this.width = width;
    this.height = height;
    this._options = options;
    this._aspectRatio = this.aspectRatio;
    this._layers = [];
    this._metasets = [];
    this._stacks = void 0;
    this.boxes = [];
    this.currentDevicePixelRatio = void 0;
    this.chartArea = void 0;
    this._active = [];
    this._lastEvent = void 0;
    this._listeners = {};
    this._responsiveListeners = void 0;
    this._sortedMetasets = [];
    this.scales = {};
    this._plugins = new PluginService();
    this.$proxies = {};
    this._hiddenIndices = {};
    this.attached = false;
    this._animationsDisabled = void 0;
    this.$context = void 0;
    this._doResize = debounce$1((mode) => this.update(mode), options.resizeDelay || 0);
    this._dataChanges = [];
    instances[this.id] = this;
    if (!context || !canvas) {
      console.error("Failed to create chart: can't acquire context from the given item");
      return;
    }
    animator.listen(this, "complete", onAnimationsComplete);
    animator.listen(this, "progress", onAnimationProgress);
    this._initialize();
    if (this.attached) {
      this.update();
    }
  }
  get aspectRatio() {
    const { options: { aspectRatio: aspectRatio2, maintainAspectRatio }, width, height, _aspectRatio } = this;
    if (!isNullOrUndef(aspectRatio2)) {
      return aspectRatio2;
    }
    if (maintainAspectRatio && _aspectRatio) {
      return _aspectRatio;
    }
    return height ? width / height : null;
  }
  get data() {
    return this.config.data;
  }
  set data(data) {
    this.config.data = data;
  }
  get options() {
    return this._options;
  }
  set options(options) {
    this.config.options = options;
  }
  get registry() {
    return registry;
  }
  _initialize() {
    this.notifyPlugins("beforeInit");
    if (this.options.responsive) {
      this.resize();
    } else {
      retinaScale(this, this.options.devicePixelRatio);
    }
    this.bindEvents();
    this.notifyPlugins("afterInit");
    return this;
  }
  clear() {
    clearCanvas(this.canvas, this.ctx);
    return this;
  }
  stop() {
    animator.stop(this);
    return this;
  }
  resize(width, height) {
    if (!animator.running(this)) {
      this._resize(width, height);
    } else {
      this._resizeBeforeDraw = {
        width,
        height
      };
    }
  }
  _resize(width, height) {
    const options = this.options;
    const canvas = this.canvas;
    const aspectRatio2 = options.maintainAspectRatio && this.aspectRatio;
    const newSize = this.platform.getMaximumSize(canvas, width, height, aspectRatio2);
    const newRatio = options.devicePixelRatio || this.platform.getDevicePixelRatio();
    const mode = this.width ? "resize" : "attach";
    this.width = newSize.width;
    this.height = newSize.height;
    this._aspectRatio = this.aspectRatio;
    if (!retinaScale(this, newRatio, true)) {
      return;
    }
    this.notifyPlugins("resize", {
      size: newSize
    });
    callback(options.onResize, [
      this,
      newSize
    ], this);
    if (this.attached) {
      if (this._doResize(mode)) {
        this.render();
      }
    }
  }
  ensureScalesHaveIDs() {
    const options = this.options;
    const scalesOptions = options.scales || {};
    each(scalesOptions, (axisOptions, axisID) => {
      axisOptions.id = axisID;
    });
  }
  buildOrUpdateScales() {
    const options = this.options;
    const scaleOpts = options.scales;
    const scales = this.scales;
    const updated = Object.keys(scales).reduce((obj, id2) => {
      obj[id2] = false;
      return obj;
    }, {});
    let items = [];
    if (scaleOpts) {
      items = items.concat(Object.keys(scaleOpts).map((id2) => {
        const scaleOptions = scaleOpts[id2];
        const axis = determineAxis(id2, scaleOptions);
        const isRadial = axis === "r";
        const isHorizontal = axis === "x";
        return {
          options: scaleOptions,
          dposition: isRadial ? "chartArea" : isHorizontal ? "bottom" : "left",
          dtype: isRadial ? "radialLinear" : isHorizontal ? "category" : "linear"
        };
      }));
    }
    each(items, (item) => {
      const scaleOptions = item.options;
      const id2 = scaleOptions.id;
      const axis = determineAxis(id2, scaleOptions);
      const scaleType = valueOrDefault(scaleOptions.type, item.dtype);
      if (scaleOptions.position === void 0 || positionIsHorizontal(scaleOptions.position, axis) !== positionIsHorizontal(item.dposition)) {
        scaleOptions.position = item.dposition;
      }
      updated[id2] = true;
      let scale2 = null;
      if (id2 in scales && scales[id2].type === scaleType) {
        scale2 = scales[id2];
      } else {
        const scaleClass = registry.getScale(scaleType);
        scale2 = new scaleClass({
          id: id2,
          type: scaleType,
          ctx: this.ctx,
          chart: this
        });
        scales[scale2.id] = scale2;
      }
      scale2.init(scaleOptions, options);
    });
    each(updated, (hasUpdated, id2) => {
      if (!hasUpdated) {
        delete scales[id2];
      }
    });
    each(scales, (scale2) => {
      layouts.configure(this, scale2, scale2.options);
      layouts.addBox(this, scale2);
    });
  }
  _updateMetasets() {
    const metasets = this._metasets;
    const numData = this.data.datasets.length;
    const numMeta = metasets.length;
    metasets.sort((a2, b2) => a2.index - b2.index);
    if (numMeta > numData) {
      for (let i2 = numData; i2 < numMeta; ++i2) {
        this._destroyDatasetMeta(i2);
      }
      metasets.splice(numData, numMeta - numData);
    }
    this._sortedMetasets = metasets.slice(0).sort(compare2Level("order", "index"));
  }
  _removeUnreferencedMetasets() {
    const { _metasets: metasets, data: { datasets } } = this;
    if (metasets.length > datasets.length) {
      delete this._stacks;
    }
    metasets.forEach((meta, index2) => {
      if (datasets.filter((x2) => x2 === meta._dataset).length === 0) {
        this._destroyDatasetMeta(index2);
      }
    });
  }
  buildOrUpdateControllers() {
    const newControllers = [];
    const datasets = this.data.datasets;
    let i2, ilen;
    this._removeUnreferencedMetasets();
    for (i2 = 0, ilen = datasets.length; i2 < ilen; i2++) {
      const dataset = datasets[i2];
      let meta = this.getDatasetMeta(i2);
      const type4 = dataset.type || this.config.type;
      if (meta.type && meta.type !== type4) {
        this._destroyDatasetMeta(i2);
        meta = this.getDatasetMeta(i2);
      }
      meta.type = type4;
      meta.indexAxis = dataset.indexAxis || getIndexAxis(type4, this.options);
      meta.order = dataset.order || 0;
      meta.index = i2;
      meta.label = "" + dataset.label;
      meta.visible = this.isDatasetVisible(i2);
      if (meta.controller) {
        meta.controller.updateIndex(i2);
        meta.controller.linkScales();
      } else {
        const ControllerClass = registry.getController(type4);
        const { datasetElementType, dataElementType } = defaults$2.datasets[type4];
        Object.assign(ControllerClass, {
          dataElementType: registry.getElement(dataElementType),
          datasetElementType: datasetElementType && registry.getElement(datasetElementType)
        });
        meta.controller = new ControllerClass(this, i2);
        newControllers.push(meta.controller);
      }
    }
    this._updateMetasets();
    return newControllers;
  }
  _resetElements() {
    each(this.data.datasets, (dataset, datasetIndex) => {
      this.getDatasetMeta(datasetIndex).controller.reset();
    }, this);
  }
  reset() {
    this._resetElements();
    this.notifyPlugins("reset");
  }
  update(mode) {
    const config2 = this.config;
    config2.update();
    const options = this._options = config2.createResolver(config2.chartOptionScopes(), this.getContext());
    const animsDisabled = this._animationsDisabled = !options.animation;
    this._updateScales();
    this._checkEventBindings();
    this._updateHiddenIndices();
    this._plugins.invalidate();
    if (this.notifyPlugins("beforeUpdate", {
      mode,
      cancelable: true
    }) === false) {
      return;
    }
    const newControllers = this.buildOrUpdateControllers();
    this.notifyPlugins("beforeElementsUpdate");
    let minPadding = 0;
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; i2++) {
      const { controller } = this.getDatasetMeta(i2);
      const reset = !animsDisabled && newControllers.indexOf(controller) === -1;
      controller.buildOrUpdateElements(reset);
      minPadding = Math.max(+controller.getMaxOverflow(), minPadding);
    }
    minPadding = this._minPadding = options.layout.autoPadding ? minPadding : 0;
    this._updateLayout(minPadding);
    if (!animsDisabled) {
      each(newControllers, (controller) => {
        controller.reset();
      });
    }
    this._updateDatasets(mode);
    this.notifyPlugins("afterUpdate", {
      mode
    });
    this._layers.sort(compare2Level("z", "_idx"));
    const { _active: _active3, _lastEvent } = this;
    if (_lastEvent) {
      this._eventHandler(_lastEvent, true);
    } else if (_active3.length) {
      this._updateHoverStyles(_active3, _active3, true);
    }
    this.render();
  }
  _updateScales() {
    each(this.scales, (scale2) => {
      layouts.removeBox(this, scale2);
    });
    this.ensureScalesHaveIDs();
    this.buildOrUpdateScales();
  }
  _checkEventBindings() {
    const options = this.options;
    const existingEvents = new Set(Object.keys(this._listeners));
    const newEvents = new Set(options.events);
    if (!setsEqual(existingEvents, newEvents) || !!this._responsiveListeners !== options.responsive) {
      this.unbindEvents();
      this.bindEvents();
    }
  }
  _updateHiddenIndices() {
    const { _hiddenIndices } = this;
    const changes = this._getUniformDataChanges() || [];
    for (const { method: method4, start, count } of changes) {
      const move2 = method4 === "_removeElements" ? -count : count;
      moveNumericKeys(_hiddenIndices, start, move2);
    }
  }
  _getUniformDataChanges() {
    const _dataChanges = this._dataChanges;
    if (!_dataChanges || !_dataChanges.length) {
      return;
    }
    this._dataChanges = [];
    const datasetCount = this.data.datasets.length;
    const makeSet = (idx) => new Set(_dataChanges.filter((c2) => c2[0] === idx).map((c2, i2) => i2 + "," + c2.splice(1).join(",")));
    const changeSet = makeSet(0);
    for (let i2 = 1; i2 < datasetCount; i2++) {
      if (!setsEqual(changeSet, makeSet(i2))) {
        return;
      }
    }
    return Array.from(changeSet).map((c2) => c2.split(",")).map((a2) => ({
      method: a2[1],
      start: +a2[2],
      count: +a2[3]
    }));
  }
  _updateLayout(minPadding) {
    if (this.notifyPlugins("beforeLayout", {
      cancelable: true
    }) === false) {
      return;
    }
    layouts.update(this, this.width, this.height, minPadding);
    const area = this.chartArea;
    const noArea = area.width <= 0 || area.height <= 0;
    this._layers = [];
    each(this.boxes, (box) => {
      if (noArea && box.position === "chartArea") {
        return;
      }
      if (box.configure) {
        box.configure();
      }
      this._layers.push(...box._layers());
    }, this);
    this._layers.forEach((item, index2) => {
      item._idx = index2;
    });
    this.notifyPlugins("afterLayout");
  }
  _updateDatasets(mode) {
    if (this.notifyPlugins("beforeDatasetsUpdate", {
      mode,
      cancelable: true
    }) === false) {
      return;
    }
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this.getDatasetMeta(i2).controller.configure();
    }
    for (let i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this._updateDataset(i2, isFunction$3(mode) ? mode({
        datasetIndex: i2
      }) : mode);
    }
    this.notifyPlugins("afterDatasetsUpdate", {
      mode
    });
  }
  _updateDataset(index2, mode) {
    const meta = this.getDatasetMeta(index2);
    const args = {
      meta,
      index: index2,
      mode,
      cancelable: true
    };
    if (this.notifyPlugins("beforeDatasetUpdate", args) === false) {
      return;
    }
    meta.controller._update(mode);
    args.cancelable = false;
    this.notifyPlugins("afterDatasetUpdate", args);
  }
  render() {
    if (this.notifyPlugins("beforeRender", {
      cancelable: true
    }) === false) {
      return;
    }
    if (animator.has(this)) {
      if (this.attached && !animator.running(this)) {
        animator.start(this);
      }
    } else {
      this.draw();
      onAnimationsComplete({
        chart: this
      });
    }
  }
  draw() {
    let i2;
    if (this._resizeBeforeDraw) {
      const { width, height } = this._resizeBeforeDraw;
      this._resizeBeforeDraw = null;
      this._resize(width, height);
    }
    this.clear();
    if (this.width <= 0 || this.height <= 0) {
      return;
    }
    if (this.notifyPlugins("beforeDraw", {
      cancelable: true
    }) === false) {
      return;
    }
    const layers = this._layers;
    for (i2 = 0; i2 < layers.length && layers[i2].z <= 0; ++i2) {
      layers[i2].draw(this.chartArea);
    }
    this._drawDatasets();
    for (; i2 < layers.length; ++i2) {
      layers[i2].draw(this.chartArea);
    }
    this.notifyPlugins("afterDraw");
  }
  _getSortedDatasetMetas(filterVisible) {
    const metasets = this._sortedMetasets;
    const result = [];
    let i2, ilen;
    for (i2 = 0, ilen = metasets.length; i2 < ilen; ++i2) {
      const meta = metasets[i2];
      if (!filterVisible || meta.visible) {
        result.push(meta);
      }
    }
    return result;
  }
  getSortedVisibleDatasetMetas() {
    return this._getSortedDatasetMetas(true);
  }
  _drawDatasets() {
    if (this.notifyPlugins("beforeDatasetsDraw", {
      cancelable: true
    }) === false) {
      return;
    }
    const metasets = this.getSortedVisibleDatasetMetas();
    for (let i2 = metasets.length - 1; i2 >= 0; --i2) {
      this._drawDataset(metasets[i2]);
    }
    this.notifyPlugins("afterDatasetsDraw");
  }
  _drawDataset(meta) {
    const ctx = this.ctx;
    const args = {
      meta,
      index: meta.index,
      cancelable: true
    };
    const clip = getDatasetClipArea(this, meta);
    if (this.notifyPlugins("beforeDatasetDraw", args) === false) {
      return;
    }
    if (clip) {
      clipArea(ctx, clip);
    }
    meta.controller.draw();
    if (clip) {
      unclipArea(ctx);
    }
    args.cancelable = false;
    this.notifyPlugins("afterDatasetDraw", args);
  }
  isPointInArea(point2) {
    return _isPointInArea(point2, this.chartArea, this._minPadding);
  }
  getElementsAtEventForMode(e2, mode, options, useFinalPosition) {
    const method4 = Interaction.modes[mode];
    if (typeof method4 === "function") {
      return method4(this, e2, options, useFinalPosition);
    }
    return [];
  }
  getDatasetMeta(datasetIndex) {
    const dataset = this.data.datasets[datasetIndex];
    const metasets = this._metasets;
    let meta = metasets.filter((x2) => x2 && x2._dataset === dataset).pop();
    if (!meta) {
      meta = {
        type: null,
        data: [],
        dataset: null,
        controller: null,
        hidden: null,
        xAxisID: null,
        yAxisID: null,
        order: dataset && dataset.order || 0,
        index: datasetIndex,
        _dataset: dataset,
        _parsed: [],
        _sorted: false
      };
      metasets.push(meta);
    }
    return meta;
  }
  getContext() {
    return this.$context || (this.$context = createContext(null, {
      chart: this,
      type: "chart"
    }));
  }
  getVisibleDatasetCount() {
    return this.getSortedVisibleDatasetMetas().length;
  }
  isDatasetVisible(datasetIndex) {
    const dataset = this.data.datasets[datasetIndex];
    if (!dataset) {
      return false;
    }
    const meta = this.getDatasetMeta(datasetIndex);
    return typeof meta.hidden === "boolean" ? !meta.hidden : !dataset.hidden;
  }
  setDatasetVisibility(datasetIndex, visible) {
    const meta = this.getDatasetMeta(datasetIndex);
    meta.hidden = !visible;
  }
  toggleDataVisibility(index2) {
    this._hiddenIndices[index2] = !this._hiddenIndices[index2];
  }
  getDataVisibility(index2) {
    return !this._hiddenIndices[index2];
  }
  _updateVisibility(datasetIndex, dataIndex, visible) {
    const mode = visible ? "show" : "hide";
    const meta = this.getDatasetMeta(datasetIndex);
    const anims = meta.controller._resolveAnimations(void 0, mode);
    if (defined(dataIndex)) {
      meta.data[dataIndex].hidden = !visible;
      this.update();
    } else {
      this.setDatasetVisibility(datasetIndex, visible);
      anims.update(meta, {
        visible
      });
      this.update((ctx) => ctx.datasetIndex === datasetIndex ? mode : void 0);
    }
  }
  hide(datasetIndex, dataIndex) {
    this._updateVisibility(datasetIndex, dataIndex, false);
  }
  show(datasetIndex, dataIndex) {
    this._updateVisibility(datasetIndex, dataIndex, true);
  }
  _destroyDatasetMeta(datasetIndex) {
    const meta = this._metasets[datasetIndex];
    if (meta && meta.controller) {
      meta.controller._destroy();
    }
    delete this._metasets[datasetIndex];
  }
  _stop() {
    let i2, ilen;
    this.stop();
    animator.remove(this);
    for (i2 = 0, ilen = this.data.datasets.length; i2 < ilen; ++i2) {
      this._destroyDatasetMeta(i2);
    }
  }
  destroy() {
    this.notifyPlugins("beforeDestroy");
    const { canvas, ctx } = this;
    this._stop();
    this.config.clearCache();
    if (canvas) {
      this.unbindEvents();
      clearCanvas(canvas, ctx);
      this.platform.releaseContext(ctx);
      this.canvas = null;
      this.ctx = null;
    }
    delete instances[this.id];
    this.notifyPlugins("afterDestroy");
  }
  toBase64Image(...args) {
    return this.canvas.toDataURL(...args);
  }
  bindEvents() {
    this.bindUserEvents();
    if (this.options.responsive) {
      this.bindResponsiveEvents();
    } else {
      this.attached = true;
    }
  }
  bindUserEvents() {
    const listeners = this._listeners;
    const platform2 = this.platform;
    const _add = (type4, listener2) => {
      platform2.addEventListener(this, type4, listener2);
      listeners[type4] = listener2;
    };
    const listener = (e2, x2, y2) => {
      e2.offsetX = x2;
      e2.offsetY = y2;
      this._eventHandler(e2);
    };
    each(this.options.events, (type4) => _add(type4, listener));
  }
  bindResponsiveEvents() {
    if (!this._responsiveListeners) {
      this._responsiveListeners = {};
    }
    const listeners = this._responsiveListeners;
    const platform2 = this.platform;
    const _add = (type4, listener2) => {
      platform2.addEventListener(this, type4, listener2);
      listeners[type4] = listener2;
    };
    const _remove = (type4, listener2) => {
      if (listeners[type4]) {
        platform2.removeEventListener(this, type4, listener2);
        delete listeners[type4];
      }
    };
    const listener = (width, height) => {
      if (this.canvas) {
        this.resize(width, height);
      }
    };
    let detached;
    const attached = () => {
      _remove("attach", attached);
      this.attached = true;
      this.resize();
      _add("resize", listener);
      _add("detach", detached);
    };
    detached = () => {
      this.attached = false;
      _remove("resize", listener);
      this._stop();
      this._resize(0, 0);
      _add("attach", attached);
    };
    if (platform2.isAttached(this.canvas)) {
      attached();
    } else {
      detached();
    }
  }
  unbindEvents() {
    each(this._listeners, (listener, type4) => {
      this.platform.removeEventListener(this, type4, listener);
    });
    this._listeners = {};
    each(this._responsiveListeners, (listener, type4) => {
      this.platform.removeEventListener(this, type4, listener);
    });
    this._responsiveListeners = void 0;
  }
  updateHoverStyle(items, mode, enabled) {
    const prefix = enabled ? "set" : "remove";
    let meta, item, i2, ilen;
    if (mode === "dataset") {
      meta = this.getDatasetMeta(items[0].datasetIndex);
      meta.controller["_" + prefix + "DatasetHoverStyle"]();
    }
    for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
      item = items[i2];
      const controller = item && this.getDatasetMeta(item.datasetIndex).controller;
      if (controller) {
        controller[prefix + "HoverStyle"](item.element, item.datasetIndex, item.index);
      }
    }
  }
  getActiveElements() {
    return this._active || [];
  }
  setActiveElements(activeElements) {
    const lastActive = this._active || [];
    const active3 = activeElements.map(({ datasetIndex, index: index2 }) => {
      const meta = this.getDatasetMeta(datasetIndex);
      if (!meta) {
        throw new Error("No dataset found at index " + datasetIndex);
      }
      return {
        datasetIndex,
        element: meta.data[index2],
        index: index2
      };
    });
    const changed = !_elementsEqual(active3, lastActive);
    if (changed) {
      this._active = active3;
      this._lastEvent = null;
      this._updateHoverStyles(active3, lastActive);
    }
  }
  notifyPlugins(hook, args, filter3) {
    return this._plugins.notify(this, hook, args, filter3);
  }
  isPluginEnabled(pluginId) {
    return this._plugins._cache.filter((p2) => p2.plugin.id === pluginId).length === 1;
  }
  _updateHoverStyles(active3, lastActive, replay) {
    const hoverOptions = this.options.hover;
    const diff2 = (a2, b2) => a2.filter((x2) => !b2.some((y2) => x2.datasetIndex === y2.datasetIndex && x2.index === y2.index));
    const deactivated = diff2(lastActive, active3);
    const activated = replay ? active3 : diff2(active3, lastActive);
    if (deactivated.length) {
      this.updateHoverStyle(deactivated, hoverOptions.mode, false);
    }
    if (activated.length && hoverOptions.mode) {
      this.updateHoverStyle(activated, hoverOptions.mode, true);
    }
  }
  _eventHandler(e2, replay) {
    const args = {
      event: e2,
      replay,
      cancelable: true,
      inChartArea: this.isPointInArea(e2)
    };
    const eventFilter = (plugin) => (plugin.options.events || this.options.events).includes(e2.native.type);
    if (this.notifyPlugins("beforeEvent", args, eventFilter) === false) {
      return;
    }
    const changed = this._handleEvent(e2, replay, args.inChartArea);
    args.cancelable = false;
    this.notifyPlugins("afterEvent", args, eventFilter);
    if (changed || args.changed) {
      this.render();
    }
    return this;
  }
  _handleEvent(e2, replay, inChartArea) {
    const { _active: lastActive = [], options } = this;
    const useFinalPosition = replay;
    const active3 = this._getActiveElements(e2, lastActive, inChartArea, useFinalPosition);
    const isClick = _isClickEvent(e2);
    const lastEvent = determineLastEvent(e2, this._lastEvent, inChartArea, isClick);
    if (inChartArea) {
      this._lastEvent = null;
      callback(options.onHover, [
        e2,
        active3,
        this
      ], this);
      if (isClick) {
        callback(options.onClick, [
          e2,
          active3,
          this
        ], this);
      }
    }
    const changed = !_elementsEqual(active3, lastActive);
    if (changed || replay) {
      this._active = active3;
      this._updateHoverStyles(active3, lastActive, replay);
    }
    this._lastEvent = lastEvent;
    return changed;
  }
  _getActiveElements(e2, lastActive, inChartArea, useFinalPosition) {
    if (e2.type === "mouseout") {
      return [];
    }
    if (!inChartArea) {
      return lastActive;
    }
    const hoverOptions = this.options.hover;
    return this.getElementsAtEventForMode(e2, hoverOptions.mode, hoverOptions, useFinalPosition);
  }
}, __publicField(_b, "defaults", defaults$2), __publicField(_b, "instances", instances), __publicField(_b, "overrides", overrides), __publicField(_b, "registry", registry), __publicField(_b, "version", version), __publicField(_b, "getChart", getChart), _b);
function invalidatePlugins() {
  return each(Chart$1.instances, (chart) => chart._plugins.invalidate());
}
function setStyle(ctx, options, style2 = options) {
  ctx.lineCap = valueOrDefault(style2.borderCapStyle, options.borderCapStyle);
  ctx.setLineDash(valueOrDefault(style2.borderDash, options.borderDash));
  ctx.lineDashOffset = valueOrDefault(style2.borderDashOffset, options.borderDashOffset);
  ctx.lineJoin = valueOrDefault(style2.borderJoinStyle, options.borderJoinStyle);
  ctx.lineWidth = valueOrDefault(style2.borderWidth, options.borderWidth);
  ctx.strokeStyle = valueOrDefault(style2.borderColor, options.borderColor);
}
function lineTo(ctx, previous2, target) {
  ctx.lineTo(target.x, target.y);
}
function getLineMethod(options) {
  if (options.stepped) {
    return _steppedLineTo;
  }
  if (options.tension || options.cubicInterpolationMode === "monotone") {
    return _bezierCurveTo;
  }
  return lineTo;
}
function pathVars(points, segment, params = {}) {
  const count = points.length;
  const { start: paramsStart = 0, end: paramsEnd = count - 1 } = params;
  const { start: segmentStart, end: segmentEnd } = segment;
  const start = Math.max(paramsStart, segmentStart);
  const end = Math.min(paramsEnd, segmentEnd);
  const outside = paramsStart < segmentStart && paramsEnd < segmentStart || paramsStart > segmentEnd && paramsEnd > segmentEnd;
  return {
    count,
    start,
    loop: segment.loop,
    ilen: end < start && !outside ? count + end - start : end - start
  };
}
function pathSegment(ctx, line2, segment, params) {
  const { points, options } = line2;
  const { count, start, loop: loop2, ilen } = pathVars(points, segment, params);
  const lineMethod = getLineMethod(options);
  let { move: move2 = true, reverse } = params || {};
  let i2, point2, prev2;
  for (i2 = 0; i2 <= ilen; ++i2) {
    point2 = points[(start + (reverse ? ilen - i2 : i2)) % count];
    if (point2.skip) {
      continue;
    } else if (move2) {
      ctx.moveTo(point2.x, point2.y);
      move2 = false;
    } else {
      lineMethod(ctx, prev2, point2, reverse, options.stepped);
    }
    prev2 = point2;
  }
  if (loop2) {
    point2 = points[(start + (reverse ? ilen : 0)) % count];
    lineMethod(ctx, prev2, point2, reverse, options.stepped);
  }
  return !!loop2;
}
function fastPathSegment(ctx, line2, segment, params) {
  const points = line2.points;
  const { count, start, ilen } = pathVars(points, segment, params);
  const { move: move2 = true, reverse } = params || {};
  let avgX = 0;
  let countX = 0;
  let i2, point2, prevX, minY, maxY, lastY;
  const pointIndex = (index2) => (start + (reverse ? ilen - index2 : index2)) % count;
  const drawX = () => {
    if (minY !== maxY) {
      ctx.lineTo(avgX, maxY);
      ctx.lineTo(avgX, minY);
      ctx.lineTo(avgX, lastY);
    }
  };
  if (move2) {
    point2 = points[pointIndex(0)];
    ctx.moveTo(point2.x, point2.y);
  }
  for (i2 = 0; i2 <= ilen; ++i2) {
    point2 = points[pointIndex(i2)];
    if (point2.skip) {
      continue;
    }
    const x2 = point2.x;
    const y2 = point2.y;
    const truncX = x2 | 0;
    if (truncX === prevX) {
      if (y2 < minY) {
        minY = y2;
      } else if (y2 > maxY) {
        maxY = y2;
      }
      avgX = (countX * avgX + x2) / ++countX;
    } else {
      drawX();
      ctx.lineTo(x2, y2);
      prevX = truncX;
      countX = 0;
      minY = maxY = y2;
    }
    lastY = y2;
  }
  drawX();
}
function _getSegmentMethod(line2) {
  const opts2 = line2.options;
  const borderDash = opts2.borderDash && opts2.borderDash.length;
  const useFastPath = !line2._decimated && !line2._loop && !opts2.tension && opts2.cubicInterpolationMode !== "monotone" && !opts2.stepped && !borderDash;
  return useFastPath ? fastPathSegment : pathSegment;
}
function _getInterpolationMethod(options) {
  if (options.stepped) {
    return _steppedInterpolation;
  }
  if (options.tension || options.cubicInterpolationMode === "monotone") {
    return _bezierInterpolation;
  }
  return _pointInLine;
}
function strokePathWithCache(ctx, line2, start, count) {
  let path = line2._path;
  if (!path) {
    path = line2._path = new Path2D();
    if (line2.path(path, start, count)) {
      path.closePath();
    }
  }
  setStyle(ctx, line2.options);
  ctx.stroke(path);
}
function strokePathDirect(ctx, line2, start, count) {
  const { segments, options } = line2;
  const segmentMethod = _getSegmentMethod(line2);
  for (const segment of segments) {
    setStyle(ctx, options, segment.style);
    ctx.beginPath();
    if (segmentMethod(ctx, line2, segment, {
      start,
      end: start + count - 1
    })) {
      ctx.closePath();
    }
    ctx.stroke();
  }
}
const usePath2D = typeof Path2D === "function";
function draw(ctx, line2, start, count) {
  if (usePath2D && !line2.options.segment) {
    strokePathWithCache(ctx, line2, start, count);
  } else {
    strokePathDirect(ctx, line2, start, count);
  }
}
class LineElement extends Element$1 {
  constructor(cfg) {
    super();
    this.animated = true;
    this.options = void 0;
    this._chart = void 0;
    this._loop = void 0;
    this._fullLoop = void 0;
    this._path = void 0;
    this._points = void 0;
    this._segments = void 0;
    this._decimated = false;
    this._pointsUpdated = false;
    this._datasetIndex = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  updateControlPoints(chartArea, indexAxis) {
    const options = this.options;
    if ((options.tension || options.cubicInterpolationMode === "monotone") && !options.stepped && !this._pointsUpdated) {
      const loop2 = options.spanGaps ? this._loop : this._fullLoop;
      _updateBezierControlPoints(this._points, options, chartArea, loop2, indexAxis);
      this._pointsUpdated = true;
    }
  }
  set points(points) {
    this._points = points;
    delete this._segments;
    delete this._path;
    this._pointsUpdated = false;
  }
  get points() {
    return this._points;
  }
  get segments() {
    return this._segments || (this._segments = _computeSegments(this, this.options.segment));
  }
  first() {
    const segments = this.segments;
    const points = this.points;
    return segments.length && points[segments[0].start];
  }
  last() {
    const segments = this.segments;
    const points = this.points;
    const count = segments.length;
    return count && points[segments[count - 1].end];
  }
  interpolate(point2, property2) {
    const options = this.options;
    const value2 = point2[property2];
    const points = this.points;
    const segments = _boundSegments(this, {
      property: property2,
      start: value2,
      end: value2
    });
    if (!segments.length) {
      return;
    }
    const result = [];
    const _interpolate = _getInterpolationMethod(options);
    let i2, ilen;
    for (i2 = 0, ilen = segments.length; i2 < ilen; ++i2) {
      const { start, end } = segments[i2];
      const p1 = points[start];
      const p2 = points[end];
      if (p1 === p2) {
        result.push(p1);
        continue;
      }
      const t2 = Math.abs((value2 - p1[property2]) / (p2[property2] - p1[property2]));
      const interpolated = _interpolate(p1, p2, t2, options.stepped);
      interpolated[property2] = point2[property2];
      result.push(interpolated);
    }
    return result.length === 1 ? result[0] : result;
  }
  pathSegment(ctx, segment, params) {
    const segmentMethod = _getSegmentMethod(this);
    return segmentMethod(ctx, this, segment, params);
  }
  path(ctx, start, count) {
    const segments = this.segments;
    const segmentMethod = _getSegmentMethod(this);
    let loop2 = this._loop;
    start = start || 0;
    count = count || this.points.length - start;
    for (const segment of segments) {
      loop2 &= segmentMethod(ctx, this, segment, {
        start,
        end: start + count - 1
      });
    }
    return !!loop2;
  }
  draw(ctx, chartArea, start, count) {
    const options = this.options || {};
    const points = this.points || [];
    if (points.length && options.borderWidth) {
      ctx.save();
      draw(ctx, this, start, count);
      ctx.restore();
    }
    if (this.animated) {
      this._pointsUpdated = false;
      this._path = void 0;
    }
  }
}
__publicField(LineElement, "id", "line");
__publicField(LineElement, "defaults", {
  borderCapStyle: "butt",
  borderDash: [],
  borderDashOffset: 0,
  borderJoinStyle: "miter",
  borderWidth: 3,
  capBezierPoints: true,
  cubicInterpolationMode: "default",
  fill: false,
  spanGaps: false,
  stepped: false,
  tension: 0
});
__publicField(LineElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
__publicField(LineElement, "descriptors", {
  _scriptable: true,
  _indexable: (name2) => name2 !== "borderDash" && name2 !== "fill"
});
function inRange$1(el2, pos, axis, useFinalPosition) {
  const options = el2.options;
  const { [axis]: value2 } = el2.getProps([
    axis
  ], useFinalPosition);
  return Math.abs(pos - value2) < options.radius + options.hitRadius;
}
class PointElement extends Element$1 {
  constructor(cfg) {
    super();
    __publicField(this, "parsed");
    __publicField(this, "skip");
    __publicField(this, "stop");
    this.options = void 0;
    this.parsed = void 0;
    this.skip = void 0;
    this.stop = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  inRange(mouseX, mouseY, useFinalPosition) {
    const options = this.options;
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return Math.pow(mouseX - x2, 2) + Math.pow(mouseY - y2, 2) < Math.pow(options.hitRadius + options.radius, 2);
  }
  inXRange(mouseX, useFinalPosition) {
    return inRange$1(this, mouseX, "x", useFinalPosition);
  }
  inYRange(mouseY, useFinalPosition) {
    return inRange$1(this, mouseY, "y", useFinalPosition);
  }
  getCenterPoint(useFinalPosition) {
    const { x: x2, y: y2 } = this.getProps([
      "x",
      "y"
    ], useFinalPosition);
    return {
      x: x2,
      y: y2
    };
  }
  size(options) {
    options = options || this.options || {};
    let radius = options.radius || 0;
    radius = Math.max(radius, radius && options.hoverRadius || 0);
    const borderWidth = radius && options.borderWidth || 0;
    return (radius + borderWidth) * 2;
  }
  draw(ctx, area) {
    const options = this.options;
    if (this.skip || options.radius < 0.1 || !_isPointInArea(this, area, this.size(options) / 2)) {
      return;
    }
    ctx.strokeStyle = options.borderColor;
    ctx.lineWidth = options.borderWidth;
    ctx.fillStyle = options.backgroundColor;
    drawPoint(ctx, options, this.x, this.y);
  }
  getRange() {
    const options = this.options || {};
    return options.radius + options.hitRadius;
  }
}
__publicField(PointElement, "id", "point");
/**
* @type {any}
*/
__publicField(PointElement, "defaults", {
  borderWidth: 1,
  hitRadius: 1,
  hoverBorderWidth: 1,
  hoverRadius: 4,
  pointStyle: "circle",
  radius: 3,
  rotation: 0
});
/**
* @type {any}
*/
__publicField(PointElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
function getBarBounds(bar, useFinalPosition) {
  const { x: x2, y: y2, base, width, height } = bar.getProps([
    "x",
    "y",
    "base",
    "width",
    "height"
  ], useFinalPosition);
  let left2, right, top2, bottom2, half;
  if (bar.horizontal) {
    half = height / 2;
    left2 = Math.min(x2, base);
    right = Math.max(x2, base);
    top2 = y2 - half;
    bottom2 = y2 + half;
  } else {
    half = width / 2;
    left2 = x2 - half;
    right = x2 + half;
    top2 = Math.min(y2, base);
    bottom2 = Math.max(y2, base);
  }
  return {
    left: left2,
    top: top2,
    right,
    bottom: bottom2
  };
}
function skipOrLimit(skip2, value2, min2, max2) {
  return skip2 ? 0 : _limitValue(value2, min2, max2);
}
function parseBorderWidth(bar, maxW, maxH) {
  const value2 = bar.options.borderWidth;
  const skip2 = bar.borderSkipped;
  const o2 = toTRBL(value2);
  return {
    t: skipOrLimit(skip2.top, o2.top, 0, maxH),
    r: skipOrLimit(skip2.right, o2.right, 0, maxW),
    b: skipOrLimit(skip2.bottom, o2.bottom, 0, maxH),
    l: skipOrLimit(skip2.left, o2.left, 0, maxW)
  };
}
function parseBorderRadius(bar, maxW, maxH) {
  const { enableBorderRadius } = bar.getProps([
    "enableBorderRadius"
  ]);
  const value2 = bar.options.borderRadius;
  const o2 = toTRBLCorners(value2);
  const maxR = Math.min(maxW, maxH);
  const skip2 = bar.borderSkipped;
  const enableBorder = enableBorderRadius || isObject$3(value2);
  return {
    topLeft: skipOrLimit(!enableBorder || skip2.top || skip2.left, o2.topLeft, 0, maxR),
    topRight: skipOrLimit(!enableBorder || skip2.top || skip2.right, o2.topRight, 0, maxR),
    bottomLeft: skipOrLimit(!enableBorder || skip2.bottom || skip2.left, o2.bottomLeft, 0, maxR),
    bottomRight: skipOrLimit(!enableBorder || skip2.bottom || skip2.right, o2.bottomRight, 0, maxR)
  };
}
function boundingRects(bar) {
  const bounds2 = getBarBounds(bar);
  const width = bounds2.right - bounds2.left;
  const height = bounds2.bottom - bounds2.top;
  const border = parseBorderWidth(bar, width / 2, height / 2);
  const radius = parseBorderRadius(bar, width / 2, height / 2);
  return {
    outer: {
      x: bounds2.left,
      y: bounds2.top,
      w: width,
      h: height,
      radius
    },
    inner: {
      x: bounds2.left + border.l,
      y: bounds2.top + border.t,
      w: width - border.l - border.r,
      h: height - border.t - border.b,
      radius: {
        topLeft: Math.max(0, radius.topLeft - Math.max(border.t, border.l)),
        topRight: Math.max(0, radius.topRight - Math.max(border.t, border.r)),
        bottomLeft: Math.max(0, radius.bottomLeft - Math.max(border.b, border.l)),
        bottomRight: Math.max(0, radius.bottomRight - Math.max(border.b, border.r))
      }
    }
  };
}
function inRange(bar, x2, y2, useFinalPosition) {
  const skipX = x2 === null;
  const skipY = y2 === null;
  const skipBoth = skipX && skipY;
  const bounds2 = bar && !skipBoth && getBarBounds(bar, useFinalPosition);
  return bounds2 && (skipX || _isBetween(x2, bounds2.left, bounds2.right)) && (skipY || _isBetween(y2, bounds2.top, bounds2.bottom));
}
function hasRadius(radius) {
  return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;
}
function addNormalRectPath(ctx, rect) {
  ctx.rect(rect.x, rect.y, rect.w, rect.h);
}
function inflateRect(rect, amount, refRect = {}) {
  const x2 = rect.x !== refRect.x ? -amount : 0;
  const y2 = rect.y !== refRect.y ? -amount : 0;
  const w2 = (rect.x + rect.w !== refRect.x + refRect.w ? amount : 0) - x2;
  const h3 = (rect.y + rect.h !== refRect.y + refRect.h ? amount : 0) - y2;
  return {
    x: rect.x + x2,
    y: rect.y + y2,
    w: rect.w + w2,
    h: rect.h + h3,
    radius: rect.radius
  };
}
class BarElement extends Element$1 {
  constructor(cfg) {
    super();
    this.options = void 0;
    this.horizontal = void 0;
    this.base = void 0;
    this.width = void 0;
    this.height = void 0;
    this.inflateAmount = void 0;
    if (cfg) {
      Object.assign(this, cfg);
    }
  }
  draw(ctx) {
    const { inflateAmount, options: { borderColor, backgroundColor } } = this;
    const { inner, outer } = boundingRects(this);
    const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;
    ctx.save();
    if (outer.w !== inner.w || outer.h !== inner.h) {
      ctx.beginPath();
      addRectPath(ctx, inflateRect(outer, inflateAmount, inner));
      ctx.clip();
      addRectPath(ctx, inflateRect(inner, -inflateAmount, outer));
      ctx.fillStyle = borderColor;
      ctx.fill("evenodd");
    }
    ctx.beginPath();
    addRectPath(ctx, inflateRect(inner, inflateAmount));
    ctx.fillStyle = backgroundColor;
    ctx.fill();
    ctx.restore();
  }
  inRange(mouseX, mouseY, useFinalPosition) {
    return inRange(this, mouseX, mouseY, useFinalPosition);
  }
  inXRange(mouseX, useFinalPosition) {
    return inRange(this, mouseX, null, useFinalPosition);
  }
  inYRange(mouseY, useFinalPosition) {
    return inRange(this, null, mouseY, useFinalPosition);
  }
  getCenterPoint(useFinalPosition) {
    const { x: x2, y: y2, base, horizontal } = this.getProps([
      "x",
      "y",
      "base",
      "horizontal"
    ], useFinalPosition);
    return {
      x: horizontal ? (x2 + base) / 2 : x2,
      y: horizontal ? y2 : (y2 + base) / 2
    };
  }
  getRange(axis) {
    return axis === "x" ? this.width / 2 : this.height / 2;
  }
}
__publicField(BarElement, "id", "bar");
__publicField(BarElement, "defaults", {
  borderSkipped: "start",
  borderWidth: 0,
  borderRadius: 0,
  inflateAmount: "auto",
  pointStyle: void 0
});
__publicField(BarElement, "defaultRoutes", {
  backgroundColor: "backgroundColor",
  borderColor: "borderColor"
});
function _segments(line2, target, property2) {
  const segments = line2.segments;
  const points = line2.points;
  const tpoints = target.points;
  const parts = [];
  for (const segment of segments) {
    let { start, end } = segment;
    end = _findSegmentEnd(start, end, points);
    const bounds2 = _getBounds(property2, points[start], points[end], segment.loop);
    if (!target.segments) {
      parts.push({
        source: segment,
        target: bounds2,
        start: points[start],
        end: points[end]
      });
      continue;
    }
    const targetSegments = _boundSegments(target, bounds2);
    for (const tgt of targetSegments) {
      const subBounds = _getBounds(property2, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
      const fillSources = _boundSegment(segment, points, subBounds);
      for (const fillSource of fillSources) {
        parts.push({
          source: fillSource,
          target: tgt,
          start: {
            [property2]: _getEdge(bounds2, subBounds, "start", Math.max)
          },
          end: {
            [property2]: _getEdge(bounds2, subBounds, "end", Math.min)
          }
        });
      }
    }
  }
  return parts;
}
function _getBounds(property2, first, last, loop2) {
  if (loop2) {
    return;
  }
  let start = first[property2];
  let end = last[property2];
  if (property2 === "angle") {
    start = _normalizeAngle(start);
    end = _normalizeAngle(end);
  }
  return {
    property: property2,
    start,
    end
  };
}
function _pointsFromSegments(boundary, line2) {
  const { x: x2 = null, y: y2 = null } = boundary || {};
  const linePoints = line2.points;
  const points = [];
  line2.segments.forEach(({ start, end }) => {
    end = _findSegmentEnd(start, end, linePoints);
    const first = linePoints[start];
    const last = linePoints[end];
    if (y2 !== null) {
      points.push({
        x: first.x,
        y: y2
      });
      points.push({
        x: last.x,
        y: y2
      });
    } else if (x2 !== null) {
      points.push({
        x: x2,
        y: first.y
      });
      points.push({
        x: x2,
        y: last.y
      });
    }
  });
  return points;
}
function _findSegmentEnd(start, end, points) {
  for (; end > start; end--) {
    const point2 = points[end];
    if (!isNaN(point2.x) && !isNaN(point2.y)) {
      break;
    }
  }
  return end;
}
function _getEdge(a2, b2, prop, fn) {
  if (a2 && b2) {
    return fn(a2[prop], b2[prop]);
  }
  return a2 ? a2[prop] : b2 ? b2[prop] : 0;
}
function _createBoundaryLine(boundary, line2) {
  let points = [];
  let _loop = false;
  if (isArray$4(boundary)) {
    _loop = true;
    points = boundary;
  } else {
    points = _pointsFromSegments(boundary, line2);
  }
  return points.length ? new LineElement({
    points,
    options: {
      tension: 0
    },
    _loop,
    _fullLoop: _loop
  }) : null;
}
function _shouldApplyFill(source2) {
  return source2 && source2.fill !== false;
}
function _resolveTarget(sources, index2, propagate) {
  const source2 = sources[index2];
  let fill2 = source2.fill;
  const visited = [
    index2
  ];
  let target;
  if (!propagate) {
    return fill2;
  }
  while (fill2 !== false && visited.indexOf(fill2) === -1) {
    if (!isNumberFinite(fill2)) {
      return fill2;
    }
    target = sources[fill2];
    if (!target) {
      return false;
    }
    if (target.visible) {
      return fill2;
    }
    visited.push(fill2);
    fill2 = target.fill;
  }
  return false;
}
function _decodeFill(line2, index2, count) {
  const fill2 = parseFillOption(line2);
  if (isObject$3(fill2)) {
    return isNaN(fill2.value) ? false : fill2;
  }
  let target = parseFloat(fill2);
  if (isNumberFinite(target) && Math.floor(target) === target) {
    return decodeTargetIndex(fill2[0], index2, target, count);
  }
  return [
    "origin",
    "start",
    "end",
    "stack",
    "shape"
  ].indexOf(fill2) >= 0 && fill2;
}
function decodeTargetIndex(firstCh, index2, target, count) {
  if (firstCh === "-" || firstCh === "+") {
    target = index2 + target;
  }
  if (target === index2 || target < 0 || target >= count) {
    return false;
  }
  return target;
}
function _getTargetPixel(fill2, scale2) {
  let pixel = null;
  if (fill2 === "start") {
    pixel = scale2.bottom;
  } else if (fill2 === "end") {
    pixel = scale2.top;
  } else if (isObject$3(fill2)) {
    pixel = scale2.getPixelForValue(fill2.value);
  } else if (scale2.getBasePixel) {
    pixel = scale2.getBasePixel();
  }
  return pixel;
}
function _getTargetValue(fill2, scale2, startValue) {
  let value2;
  if (fill2 === "start") {
    value2 = startValue;
  } else if (fill2 === "end") {
    value2 = scale2.options.reverse ? scale2.min : scale2.max;
  } else if (isObject$3(fill2)) {
    value2 = fill2.value;
  } else {
    value2 = scale2.getBaseValue();
  }
  return value2;
}
function parseFillOption(line2) {
  const options = line2.options;
  const fillOption = options.fill;
  let fill2 = valueOrDefault(fillOption && fillOption.target, fillOption);
  if (fill2 === void 0) {
    fill2 = !!options.backgroundColor;
  }
  if (fill2 === false || fill2 === null) {
    return false;
  }
  if (fill2 === true) {
    return "origin";
  }
  return fill2;
}
function _buildStackLine(source2) {
  const { scale: scale2, index: index2, line: line2 } = source2;
  const points = [];
  const segments = line2.segments;
  const sourcePoints = line2.points;
  const linesBelow = getLinesBelow(scale2, index2);
  linesBelow.push(_createBoundaryLine({
    x: null,
    y: scale2.bottom
  }, line2));
  for (let i2 = 0; i2 < segments.length; i2++) {
    const segment = segments[i2];
    for (let j2 = segment.start; j2 <= segment.end; j2++) {
      addPointsBelow(points, sourcePoints[j2], linesBelow);
    }
  }
  return new LineElement({
    points,
    options: {}
  });
}
function getLinesBelow(scale2, index2) {
  const below = [];
  const metas = scale2.getMatchingVisibleMetas("line");
  for (let i2 = 0; i2 < metas.length; i2++) {
    const meta = metas[i2];
    if (meta.index === index2) {
      break;
    }
    if (!meta.hidden) {
      below.unshift(meta.dataset);
    }
  }
  return below;
}
function addPointsBelow(points, sourcePoint, linesBelow) {
  const postponed = [];
  for (let j2 = 0; j2 < linesBelow.length; j2++) {
    const line2 = linesBelow[j2];
    const { first, last, point: point2 } = findPoint(line2, sourcePoint, "x");
    if (!point2 || first && last) {
      continue;
    }
    if (first) {
      postponed.unshift(point2);
    } else {
      points.push(point2);
      if (!last) {
        break;
      }
    }
  }
  points.push(...postponed);
}
function findPoint(line2, sourcePoint, property2) {
  const point2 = line2.interpolate(sourcePoint, property2);
  if (!point2) {
    return {};
  }
  const pointValue = point2[property2];
  const segments = line2.segments;
  const linePoints = line2.points;
  let first = false;
  let last = false;
  for (let i2 = 0; i2 < segments.length; i2++) {
    const segment = segments[i2];
    const firstValue = linePoints[segment.start][property2];
    const lastValue = linePoints[segment.end][property2];
    if (_isBetween(pointValue, firstValue, lastValue)) {
      first = pointValue === firstValue;
      last = pointValue === lastValue;
      break;
    }
  }
  return {
    first,
    last,
    point: point2
  };
}
class simpleArc {
  constructor(opts2) {
    this.x = opts2.x;
    this.y = opts2.y;
    this.radius = opts2.radius;
  }
  pathSegment(ctx, bounds2, opts2) {
    const { x: x2, y: y2, radius } = this;
    bounds2 = bounds2 || {
      start: 0,
      end: TAU
    };
    ctx.arc(x2, y2, radius, bounds2.end, bounds2.start, true);
    return !opts2.bounds;
  }
  interpolate(point2) {
    const { x: x2, y: y2, radius } = this;
    const angle = point2.angle;
    return {
      x: x2 + Math.cos(angle) * radius,
      y: y2 + Math.sin(angle) * radius,
      angle
    };
  }
}
function _getTarget(source2) {
  const { chart, fill: fill2, line: line2 } = source2;
  if (isNumberFinite(fill2)) {
    return getLineByIndex(chart, fill2);
  }
  if (fill2 === "stack") {
    return _buildStackLine(source2);
  }
  if (fill2 === "shape") {
    return true;
  }
  const boundary = computeBoundary(source2);
  if (boundary instanceof simpleArc) {
    return boundary;
  }
  return _createBoundaryLine(boundary, line2);
}
function getLineByIndex(chart, index2) {
  const meta = chart.getDatasetMeta(index2);
  const visible = meta && chart.isDatasetVisible(index2);
  return visible ? meta.dataset : null;
}
function computeBoundary(source2) {
  const scale2 = source2.scale || {};
  if (scale2.getPointPositionForValue) {
    return computeCircularBoundary(source2);
  }
  return computeLinearBoundary(source2);
}
function computeLinearBoundary(source2) {
  const { scale: scale2 = {}, fill: fill2 } = source2;
  const pixel = _getTargetPixel(fill2, scale2);
  if (isNumberFinite(pixel)) {
    const horizontal = scale2.isHorizontal();
    return {
      x: horizontal ? pixel : null,
      y: horizontal ? null : pixel
    };
  }
  return null;
}
function computeCircularBoundary(source2) {
  const { scale: scale2, fill: fill2 } = source2;
  const options = scale2.options;
  const length2 = scale2.getLabels().length;
  const start = options.reverse ? scale2.max : scale2.min;
  const value2 = _getTargetValue(fill2, scale2, start);
  const target = [];
  if (options.grid.circular) {
    const center = scale2.getPointPositionForValue(0, start);
    return new simpleArc({
      x: center.x,
      y: center.y,
      radius: scale2.getDistanceFromCenterForValue(value2)
    });
  }
  for (let i2 = 0; i2 < length2; ++i2) {
    target.push(scale2.getPointPositionForValue(i2, value2));
  }
  return target;
}
function _drawfill(ctx, source2, area) {
  const target = _getTarget(source2);
  const { chart, index: index2, line: line2, scale: scale2, axis } = source2;
  const lineOpts = line2.options;
  const fillOption = lineOpts.fill;
  const color2 = lineOpts.backgroundColor;
  const { above = color2, below = color2 } = fillOption || {};
  const meta = chart.getDatasetMeta(index2);
  const clip = getDatasetClipArea(chart, meta);
  if (target && line2.points.length) {
    clipArea(ctx, area);
    doFill(ctx, {
      line: line2,
      target,
      above,
      below,
      area,
      scale: scale2,
      axis,
      clip
    });
    unclipArea(ctx);
  }
}
function doFill(ctx, cfg) {
  const { line: line2, target, above, below, area, scale: scale2, clip } = cfg;
  const property2 = line2._loop ? "angle" : cfg.axis;
  ctx.save();
  let fillColor = below;
  if (below !== above) {
    if (property2 === "x") {
      clipVertical(ctx, target, area.top);
      fill(ctx, {
        line: line2,
        target,
        color: above,
        scale: scale2,
        property: property2,
        clip
      });
      ctx.restore();
      ctx.save();
      clipVertical(ctx, target, area.bottom);
    } else if (property2 === "y") {
      clipHorizontal(ctx, target, area.left);
      fill(ctx, {
        line: line2,
        target,
        color: below,
        scale: scale2,
        property: property2,
        clip
      });
      ctx.restore();
      ctx.save();
      clipHorizontal(ctx, target, area.right);
      fillColor = above;
    }
  }
  fill(ctx, {
    line: line2,
    target,
    color: fillColor,
    scale: scale2,
    property: property2,
    clip
  });
  ctx.restore();
}
function clipVertical(ctx, target, clipY) {
  const { segments, points } = target;
  let first = true;
  let lineLoop = false;
  ctx.beginPath();
  for (const segment of segments) {
    const { start, end } = segment;
    const firstPoint = points[start];
    const lastPoint = points[_findSegmentEnd(start, end, points)];
    if (first) {
      ctx.moveTo(firstPoint.x, firstPoint.y);
      first = false;
    } else {
      ctx.lineTo(firstPoint.x, clipY);
      ctx.lineTo(firstPoint.x, firstPoint.y);
    }
    lineLoop = !!target.pathSegment(ctx, segment, {
      move: lineLoop
    });
    if (lineLoop) {
      ctx.closePath();
    } else {
      ctx.lineTo(lastPoint.x, clipY);
    }
  }
  ctx.lineTo(target.first().x, clipY);
  ctx.closePath();
  ctx.clip();
}
function clipHorizontal(ctx, target, clipX) {
  const { segments, points } = target;
  let first = true;
  let lineLoop = false;
  ctx.beginPath();
  for (const segment of segments) {
    const { start, end } = segment;
    const firstPoint = points[start];
    const lastPoint = points[_findSegmentEnd(start, end, points)];
    if (first) {
      ctx.moveTo(firstPoint.x, firstPoint.y);
      first = false;
    } else {
      ctx.lineTo(clipX, firstPoint.y);
      ctx.lineTo(firstPoint.x, firstPoint.y);
    }
    lineLoop = !!target.pathSegment(ctx, segment, {
      move: lineLoop
    });
    if (lineLoop) {
      ctx.closePath();
    } else {
      ctx.lineTo(clipX, lastPoint.y);
    }
  }
  ctx.lineTo(clipX, target.first().y);
  ctx.closePath();
  ctx.clip();
}
function fill(ctx, cfg) {
  const { line: line2, target, property: property2, color: color2, scale: scale2, clip } = cfg;
  const segments = _segments(line2, target, property2);
  for (const { source: src, target: tgt, start, end } of segments) {
    const { style: { backgroundColor = color2 } = {} } = src;
    const notShape = target !== true;
    ctx.save();
    ctx.fillStyle = backgroundColor;
    clipBounds(ctx, scale2, clip, notShape && _getBounds(property2, start, end));
    ctx.beginPath();
    const lineLoop = !!line2.pathSegment(ctx, src);
    let loop2;
    if (notShape) {
      if (lineLoop) {
        ctx.closePath();
      } else {
        interpolatedLineTo(ctx, target, end, property2);
      }
      const targetLoop = !!target.pathSegment(ctx, tgt, {
        move: lineLoop,
        reverse: true
      });
      loop2 = lineLoop && targetLoop;
      if (!loop2) {
        interpolatedLineTo(ctx, target, start, property2);
      }
    }
    ctx.closePath();
    ctx.fill(loop2 ? "evenodd" : "nonzero");
    ctx.restore();
  }
}
function clipBounds(ctx, scale2, clip, bounds2) {
  const chartArea = scale2.chart.chartArea;
  const { property: property2, start, end } = bounds2 || {};
  if (property2 === "x" || property2 === "y") {
    let left2, top2, right, bottom2;
    if (property2 === "x") {
      left2 = start;
      top2 = chartArea.top;
      right = end;
      bottom2 = chartArea.bottom;
    } else {
      left2 = chartArea.left;
      top2 = start;
      right = chartArea.right;
      bottom2 = end;
    }
    ctx.beginPath();
    if (clip) {
      left2 = Math.max(left2, clip.left);
      right = Math.min(right, clip.right);
      top2 = Math.max(top2, clip.top);
      bottom2 = Math.min(bottom2, clip.bottom);
    }
    ctx.rect(left2, top2, right - left2, bottom2 - top2);
    ctx.clip();
  }
}
function interpolatedLineTo(ctx, target, point2, property2) {
  const interpolatedPoint = target.interpolate(point2, property2);
  if (interpolatedPoint) {
    ctx.lineTo(interpolatedPoint.x, interpolatedPoint.y);
  }
}
var index$1 = {
  id: "filler",
  afterDatasetsUpdate(chart, _args, options) {
    const count = (chart.data.datasets || []).length;
    const sources = [];
    let meta, i2, line2, source2;
    for (i2 = 0; i2 < count; ++i2) {
      meta = chart.getDatasetMeta(i2);
      line2 = meta.dataset;
      source2 = null;
      if (line2 && line2.options && line2 instanceof LineElement) {
        source2 = {
          visible: chart.isDatasetVisible(i2),
          index: i2,
          fill: _decodeFill(line2, i2, count),
          chart,
          axis: meta.controller.options.indexAxis,
          scale: meta.vScale,
          line: line2
        };
      }
      meta.$filler = source2;
      sources.push(source2);
    }
    for (i2 = 0; i2 < count; ++i2) {
      source2 = sources[i2];
      if (!source2 || source2.fill === false) {
        continue;
      }
      source2.fill = _resolveTarget(sources, i2, options.propagate);
    }
  },
  beforeDraw(chart, _args, options) {
    const draw2 = options.drawTime === "beforeDraw";
    const metasets = chart.getSortedVisibleDatasetMetas();
    const area = chart.chartArea;
    for (let i2 = metasets.length - 1; i2 >= 0; --i2) {
      const source2 = metasets[i2].$filler;
      if (!source2) {
        continue;
      }
      source2.line.updateControlPoints(area, source2.axis);
      if (draw2 && source2.fill) {
        _drawfill(chart.ctx, source2, area);
      }
    }
  },
  beforeDatasetsDraw(chart, _args, options) {
    if (options.drawTime !== "beforeDatasetsDraw") {
      return;
    }
    const metasets = chart.getSortedVisibleDatasetMetas();
    for (let i2 = metasets.length - 1; i2 >= 0; --i2) {
      const source2 = metasets[i2].$filler;
      if (_shouldApplyFill(source2)) {
        _drawfill(chart.ctx, source2, chart.chartArea);
      }
    }
  },
  beforeDatasetDraw(chart, args, options) {
    const source2 = args.meta.$filler;
    if (!_shouldApplyFill(source2) || options.drawTime !== "beforeDatasetDraw") {
      return;
    }
    _drawfill(chart.ctx, source2, chart.chartArea);
  },
  defaults: {
    propagate: true,
    drawTime: "beforeDatasetDraw"
  }
};
const getBoxSize = (labelOpts, fontSize) => {
  let { boxHeight = fontSize, boxWidth = fontSize } = labelOpts;
  if (labelOpts.usePointStyle) {
    boxHeight = Math.min(boxHeight, fontSize);
    boxWidth = labelOpts.pointStyleWidth || Math.min(boxWidth, fontSize);
  }
  return {
    boxWidth,
    boxHeight,
    itemHeight: Math.max(fontSize, boxHeight)
  };
};
const itemsEqual$1 = (a2, b2) => a2 !== null && b2 !== null && a2.datasetIndex === b2.datasetIndex && a2.index === b2.index;
class Legend extends Element$1 {
  constructor(config2) {
    super();
    this._added = false;
    this.legendHitBoxes = [];
    this._hoveredItem = null;
    this.doughnutMode = false;
    this.chart = config2.chart;
    this.options = config2.options;
    this.ctx = config2.ctx;
    this.legendItems = void 0;
    this.columnSizes = void 0;
    this.lineWidths = void 0;
    this.maxHeight = void 0;
    this.maxWidth = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.height = void 0;
    this.width = void 0;
    this._margins = void 0;
    this.position = void 0;
    this.weight = void 0;
    this.fullSize = void 0;
  }
  update(maxWidth, maxHeight, margins) {
    this.maxWidth = maxWidth;
    this.maxHeight = maxHeight;
    this._margins = margins;
    this.setDimensions();
    this.buildLabels();
    this.fit();
  }
  setDimensions() {
    if (this.isHorizontal()) {
      this.width = this.maxWidth;
      this.left = this._margins.left;
      this.right = this.width;
    } else {
      this.height = this.maxHeight;
      this.top = this._margins.top;
      this.bottom = this.height;
    }
  }
  buildLabels() {
    const labelOpts = this.options.labels || {};
    let legendItems = callback(labelOpts.generateLabels, [
      this.chart
    ], this) || [];
    if (labelOpts.filter) {
      legendItems = legendItems.filter((item) => labelOpts.filter(item, this.chart.data));
    }
    if (labelOpts.sort) {
      legendItems = legendItems.sort((a2, b2) => labelOpts.sort(a2, b2, this.chart.data));
    }
    if (this.options.reverse) {
      legendItems.reverse();
    }
    this.legendItems = legendItems;
  }
  fit() {
    const { options, ctx } = this;
    if (!options.display) {
      this.width = this.height = 0;
      return;
    }
    const labelOpts = options.labels;
    const labelFont = toFont(labelOpts.font);
    const fontSize = labelFont.size;
    const titleHeight = this._computeTitleHeight();
    const { boxWidth, itemHeight } = getBoxSize(labelOpts, fontSize);
    let width, height;
    ctx.font = labelFont.string;
    if (this.isHorizontal()) {
      width = this.maxWidth;
      height = this._fitRows(titleHeight, fontSize, boxWidth, itemHeight) + 10;
    } else {
      height = this.maxHeight;
      width = this._fitCols(titleHeight, labelFont, boxWidth, itemHeight) + 10;
    }
    this.width = Math.min(width, options.maxWidth || this.maxWidth);
    this.height = Math.min(height, options.maxHeight || this.maxHeight);
  }
  _fitRows(titleHeight, fontSize, boxWidth, itemHeight) {
    const { ctx, maxWidth, options: { labels: { padding } } } = this;
    const hitboxes = this.legendHitBoxes = [];
    const lineWidths = this.lineWidths = [
      0
    ];
    const lineHeight2 = itemHeight + padding;
    let totalHeight = titleHeight;
    ctx.textAlign = "left";
    ctx.textBaseline = "middle";
    let row = -1;
    let top2 = -lineHeight2;
    this.legendItems.forEach((legendItem, i2) => {
      const itemWidth = boxWidth + fontSize / 2 + ctx.measureText(legendItem.text).width;
      if (i2 === 0 || lineWidths[lineWidths.length - 1] + itemWidth + 2 * padding > maxWidth) {
        totalHeight += lineHeight2;
        lineWidths[lineWidths.length - (i2 > 0 ? 0 : 1)] = 0;
        top2 += lineHeight2;
        row++;
      }
      hitboxes[i2] = {
        left: 0,
        top: top2,
        row,
        width: itemWidth,
        height: itemHeight
      };
      lineWidths[lineWidths.length - 1] += itemWidth + padding;
    });
    return totalHeight;
  }
  _fitCols(titleHeight, labelFont, boxWidth, _itemHeight) {
    const { ctx, maxHeight, options: { labels: { padding } } } = this;
    const hitboxes = this.legendHitBoxes = [];
    const columnSizes = this.columnSizes = [];
    const heightLimit = maxHeight - titleHeight;
    let totalWidth = padding;
    let currentColWidth = 0;
    let currentColHeight = 0;
    let left2 = 0;
    let col = 0;
    this.legendItems.forEach((legendItem, i2) => {
      const { itemWidth, itemHeight } = calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight);
      if (i2 > 0 && currentColHeight + itemHeight + 2 * padding > heightLimit) {
        totalWidth += currentColWidth + padding;
        columnSizes.push({
          width: currentColWidth,
          height: currentColHeight
        });
        left2 += currentColWidth + padding;
        col++;
        currentColWidth = currentColHeight = 0;
      }
      hitboxes[i2] = {
        left: left2,
        top: currentColHeight,
        col,
        width: itemWidth,
        height: itemHeight
      };
      currentColWidth = Math.max(currentColWidth, itemWidth);
      currentColHeight += itemHeight + padding;
    });
    totalWidth += currentColWidth;
    columnSizes.push({
      width: currentColWidth,
      height: currentColHeight
    });
    return totalWidth;
  }
  adjustHitBoxes() {
    if (!this.options.display) {
      return;
    }
    const titleHeight = this._computeTitleHeight();
    const { legendHitBoxes: hitboxes, options: { align, labels: { padding }, rtl } } = this;
    const rtlHelper = getRtlAdapter(rtl, this.left, this.width);
    if (this.isHorizontal()) {
      let row = 0;
      let left2 = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);
      for (const hitbox of hitboxes) {
        if (row !== hitbox.row) {
          row = hitbox.row;
          left2 = _alignStartEnd(align, this.left + padding, this.right - this.lineWidths[row]);
        }
        hitbox.top += this.top + titleHeight + padding;
        hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(left2), hitbox.width);
        left2 += hitbox.width + padding;
      }
    } else {
      let col = 0;
      let top2 = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);
      for (const hitbox of hitboxes) {
        if (hitbox.col !== col) {
          col = hitbox.col;
          top2 = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - this.columnSizes[col].height);
        }
        hitbox.top = top2;
        hitbox.left += this.left + padding;
        hitbox.left = rtlHelper.leftForLtr(rtlHelper.x(hitbox.left), hitbox.width);
        top2 += hitbox.height + padding;
      }
    }
  }
  isHorizontal() {
    return this.options.position === "top" || this.options.position === "bottom";
  }
  draw() {
    if (this.options.display) {
      const ctx = this.ctx;
      clipArea(ctx, this);
      this._draw();
      unclipArea(ctx);
    }
  }
  _draw() {
    const { options: opts2, columnSizes, lineWidths, ctx } = this;
    const { align, labels: labelOpts } = opts2;
    const defaultColor = defaults$2.color;
    const rtlHelper = getRtlAdapter(opts2.rtl, this.left, this.width);
    const labelFont = toFont(labelOpts.font);
    const { padding } = labelOpts;
    const fontSize = labelFont.size;
    const halfFontSize = fontSize / 2;
    let cursor;
    this.drawTitle();
    ctx.textAlign = rtlHelper.textAlign("left");
    ctx.textBaseline = "middle";
    ctx.lineWidth = 0.5;
    ctx.font = labelFont.string;
    const { boxWidth, boxHeight, itemHeight } = getBoxSize(labelOpts, fontSize);
    const drawLegendBox = function(x2, y2, legendItem) {
      if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {
        return;
      }
      ctx.save();
      const lineWidth = valueOrDefault(legendItem.lineWidth, 1);
      ctx.fillStyle = valueOrDefault(legendItem.fillStyle, defaultColor);
      ctx.lineCap = valueOrDefault(legendItem.lineCap, "butt");
      ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, 0);
      ctx.lineJoin = valueOrDefault(legendItem.lineJoin, "miter");
      ctx.lineWidth = lineWidth;
      ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);
      ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
      if (labelOpts.usePointStyle) {
        const drawOptions = {
          radius: boxHeight * Math.SQRT2 / 2,
          pointStyle: legendItem.pointStyle,
          rotation: legendItem.rotation,
          borderWidth: lineWidth
        };
        const centerX = rtlHelper.xPlus(x2, boxWidth / 2);
        const centerY = y2 + halfFontSize;
        drawPointLegend(ctx, drawOptions, centerX, centerY, labelOpts.pointStyleWidth && boxWidth);
      } else {
        const yBoxTop = y2 + Math.max((fontSize - boxHeight) / 2, 0);
        const xBoxLeft = rtlHelper.leftForLtr(x2, boxWidth);
        const borderRadius2 = toTRBLCorners(legendItem.borderRadius);
        ctx.beginPath();
        if (Object.values(borderRadius2).some((v2) => v2 !== 0)) {
          addRoundedRectPath(ctx, {
            x: xBoxLeft,
            y: yBoxTop,
            w: boxWidth,
            h: boxHeight,
            radius: borderRadius2
          });
        } else {
          ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);
        }
        ctx.fill();
        if (lineWidth !== 0) {
          ctx.stroke();
        }
      }
      ctx.restore();
    };
    const fillText = function(x2, y2, legendItem) {
      renderText(ctx, legendItem.text, x2, y2 + itemHeight / 2, labelFont, {
        strikethrough: legendItem.hidden,
        textAlign: rtlHelper.textAlign(legendItem.textAlign)
      });
    };
    const isHorizontal = this.isHorizontal();
    const titleHeight = this._computeTitleHeight();
    if (isHorizontal) {
      cursor = {
        x: _alignStartEnd(align, this.left + padding, this.right - lineWidths[0]),
        y: this.top + padding + titleHeight,
        line: 0
      };
    } else {
      cursor = {
        x: this.left + padding,
        y: _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[0].height),
        line: 0
      };
    }
    overrideTextDirection(this.ctx, opts2.textDirection);
    const lineHeight2 = itemHeight + padding;
    this.legendItems.forEach((legendItem, i2) => {
      ctx.strokeStyle = legendItem.fontColor;
      ctx.fillStyle = legendItem.fontColor;
      const textWidth = ctx.measureText(legendItem.text).width;
      const textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));
      const width = boxWidth + halfFontSize + textWidth;
      let x2 = cursor.x;
      let y2 = cursor.y;
      rtlHelper.setWidth(this.width);
      if (isHorizontal) {
        if (i2 > 0 && x2 + width + padding > this.right) {
          y2 = cursor.y += lineHeight2;
          cursor.line++;
          x2 = cursor.x = _alignStartEnd(align, this.left + padding, this.right - lineWidths[cursor.line]);
        }
      } else if (i2 > 0 && y2 + lineHeight2 > this.bottom) {
        x2 = cursor.x = x2 + columnSizes[cursor.line].width + padding;
        cursor.line++;
        y2 = cursor.y = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);
      }
      const realX = rtlHelper.x(x2);
      drawLegendBox(realX, y2, legendItem);
      x2 = _textX(textAlign, x2 + boxWidth + halfFontSize, isHorizontal ? x2 + width : this.right, opts2.rtl);
      fillText(rtlHelper.x(x2), y2, legendItem);
      if (isHorizontal) {
        cursor.x += width + padding;
      } else if (typeof legendItem.text !== "string") {
        const fontLineHeight = labelFont.lineHeight;
        cursor.y += calculateLegendItemHeight(legendItem, fontLineHeight) + padding;
      } else {
        cursor.y += lineHeight2;
      }
    });
    restoreTextDirection(this.ctx, opts2.textDirection);
  }
  drawTitle() {
    const opts2 = this.options;
    const titleOpts = opts2.title;
    const titleFont = toFont(titleOpts.font);
    const titlePadding = toPadding(titleOpts.padding);
    if (!titleOpts.display) {
      return;
    }
    const rtlHelper = getRtlAdapter(opts2.rtl, this.left, this.width);
    const ctx = this.ctx;
    const position2 = titleOpts.position;
    const halfFontSize = titleFont.size / 2;
    const topPaddingPlusHalfFontSize = titlePadding.top + halfFontSize;
    let y2;
    let left2 = this.left;
    let maxWidth = this.width;
    if (this.isHorizontal()) {
      maxWidth = Math.max(...this.lineWidths);
      y2 = this.top + topPaddingPlusHalfFontSize;
      left2 = _alignStartEnd(opts2.align, left2, this.right - maxWidth);
    } else {
      const maxHeight = this.columnSizes.reduce((acc, size2) => Math.max(acc, size2.height), 0);
      y2 = topPaddingPlusHalfFontSize + _alignStartEnd(opts2.align, this.top, this.bottom - maxHeight - opts2.labels.padding - this._computeTitleHeight());
    }
    const x2 = _alignStartEnd(position2, left2, left2 + maxWidth);
    ctx.textAlign = rtlHelper.textAlign(_toLeftRightCenter(position2));
    ctx.textBaseline = "middle";
    ctx.strokeStyle = titleOpts.color;
    ctx.fillStyle = titleOpts.color;
    ctx.font = titleFont.string;
    renderText(ctx, titleOpts.text, x2, y2, titleFont);
  }
  _computeTitleHeight() {
    const titleOpts = this.options.title;
    const titleFont = toFont(titleOpts.font);
    const titlePadding = toPadding(titleOpts.padding);
    return titleOpts.display ? titleFont.lineHeight + titlePadding.height : 0;
  }
  _getLegendItemAt(x2, y2) {
    let i2, hitBox, lh2;
    if (_isBetween(x2, this.left, this.right) && _isBetween(y2, this.top, this.bottom)) {
      lh2 = this.legendHitBoxes;
      for (i2 = 0; i2 < lh2.length; ++i2) {
        hitBox = lh2[i2];
        if (_isBetween(x2, hitBox.left, hitBox.left + hitBox.width) && _isBetween(y2, hitBox.top, hitBox.top + hitBox.height)) {
          return this.legendItems[i2];
        }
      }
    }
    return null;
  }
  handleEvent(e2) {
    const opts2 = this.options;
    if (!isListened(e2.type, opts2)) {
      return;
    }
    const hoveredItem = this._getLegendItemAt(e2.x, e2.y);
    if (e2.type === "mousemove" || e2.type === "mouseout") {
      const previous2 = this._hoveredItem;
      const sameItem = itemsEqual$1(previous2, hoveredItem);
      if (previous2 && !sameItem) {
        callback(opts2.onLeave, [
          e2,
          previous2,
          this
        ], this);
      }
      this._hoveredItem = hoveredItem;
      if (hoveredItem && !sameItem) {
        callback(opts2.onHover, [
          e2,
          hoveredItem,
          this
        ], this);
      }
    } else if (hoveredItem) {
      callback(opts2.onClick, [
        e2,
        hoveredItem,
        this
      ], this);
    }
  }
}
function calculateItemSize(boxWidth, labelFont, ctx, legendItem, _itemHeight) {
  const itemWidth = calculateItemWidth(legendItem, boxWidth, labelFont, ctx);
  const itemHeight = calculateItemHeight(_itemHeight, legendItem, labelFont.lineHeight);
  return {
    itemWidth,
    itemHeight
  };
}
function calculateItemWidth(legendItem, boxWidth, labelFont, ctx) {
  let legendItemText = legendItem.text;
  if (legendItemText && typeof legendItemText !== "string") {
    legendItemText = legendItemText.reduce((a2, b2) => a2.length > b2.length ? a2 : b2);
  }
  return boxWidth + labelFont.size / 2 + ctx.measureText(legendItemText).width;
}
function calculateItemHeight(_itemHeight, legendItem, fontLineHeight) {
  let itemHeight = _itemHeight;
  if (typeof legendItem.text !== "string") {
    itemHeight = calculateLegendItemHeight(legendItem, fontLineHeight);
  }
  return itemHeight;
}
function calculateLegendItemHeight(legendItem, fontLineHeight) {
  const labelHeight = legendItem.text ? legendItem.text.length : 0;
  return fontLineHeight * labelHeight;
}
function isListened(type4, opts2) {
  if ((type4 === "mousemove" || type4 === "mouseout") && (opts2.onHover || opts2.onLeave)) {
    return true;
  }
  if (opts2.onClick && (type4 === "click" || type4 === "mouseup")) {
    return true;
  }
  return false;
}
var plugin_legend = {
  id: "legend",
  _element: Legend,
  start(chart, _args, options) {
    const legend = chart.legend = new Legend({
      ctx: chart.ctx,
      options,
      chart
    });
    layouts.configure(chart, legend, options);
    layouts.addBox(chart, legend);
  },
  stop(chart) {
    layouts.removeBox(chart, chart.legend);
    delete chart.legend;
  },
  beforeUpdate(chart, _args, options) {
    const legend = chart.legend;
    layouts.configure(chart, legend, options);
    legend.options = options;
  },
  afterUpdate(chart) {
    const legend = chart.legend;
    legend.buildLabels();
    legend.adjustHitBoxes();
  },
  afterEvent(chart, args) {
    if (!args.replay) {
      chart.legend.handleEvent(args.event);
    }
  },
  defaults: {
    display: true,
    position: "top",
    align: "center",
    fullSize: true,
    reverse: false,
    weight: 1e3,
    onClick(e2, legendItem, legend) {
      const index2 = legendItem.datasetIndex;
      const ci2 = legend.chart;
      if (ci2.isDatasetVisible(index2)) {
        ci2.hide(index2);
        legendItem.hidden = true;
      } else {
        ci2.show(index2);
        legendItem.hidden = false;
      }
    },
    onHover: null,
    onLeave: null,
    labels: {
      color: (ctx) => ctx.chart.options.color,
      boxWidth: 40,
      padding: 10,
      generateLabels(chart) {
        const datasets = chart.data.datasets;
        const { labels: { usePointStyle, pointStyle, textAlign, color: color2, useBorderRadius, borderRadius: borderRadius2 } } = chart.legend.options;
        return chart._getSortedDatasetMetas().map((meta) => {
          const style2 = meta.controller.getStyle(usePointStyle ? 0 : void 0);
          const borderWidth = toPadding(style2.borderWidth);
          return {
            text: datasets[meta.index].label,
            fillStyle: style2.backgroundColor,
            fontColor: color2,
            hidden: !meta.visible,
            lineCap: style2.borderCapStyle,
            lineDash: style2.borderDash,
            lineDashOffset: style2.borderDashOffset,
            lineJoin: style2.borderJoinStyle,
            lineWidth: (borderWidth.width + borderWidth.height) / 4,
            strokeStyle: style2.borderColor,
            pointStyle: pointStyle || style2.pointStyle,
            rotation: style2.rotation,
            textAlign: textAlign || style2.textAlign,
            borderRadius: useBorderRadius && (borderRadius2 || style2.borderRadius),
            datasetIndex: meta.index
          };
        }, this);
      }
    },
    title: {
      color: (ctx) => ctx.chart.options.color,
      display: false,
      position: "center",
      text: ""
    }
  },
  descriptors: {
    _scriptable: (name2) => !name2.startsWith("on"),
    labels: {
      _scriptable: (name2) => ![
        "generateLabels",
        "filter",
        "sort"
      ].includes(name2)
    }
  }
};
class Title extends Element$1 {
  constructor(config2) {
    super();
    this.chart = config2.chart;
    this.options = config2.options;
    this.ctx = config2.ctx;
    this._padding = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.left = void 0;
    this.right = void 0;
    this.width = void 0;
    this.height = void 0;
    this.position = void 0;
    this.weight = void 0;
    this.fullSize = void 0;
  }
  update(maxWidth, maxHeight) {
    const opts2 = this.options;
    this.left = 0;
    this.top = 0;
    if (!opts2.display) {
      this.width = this.height = this.right = this.bottom = 0;
      return;
    }
    this.width = this.right = maxWidth;
    this.height = this.bottom = maxHeight;
    const lineCount = isArray$4(opts2.text) ? opts2.text.length : 1;
    this._padding = toPadding(opts2.padding);
    const textSize = lineCount * toFont(opts2.font).lineHeight + this._padding.height;
    if (this.isHorizontal()) {
      this.height = textSize;
    } else {
      this.width = textSize;
    }
  }
  isHorizontal() {
    const pos = this.options.position;
    return pos === "top" || pos === "bottom";
  }
  _drawArgs(offset2) {
    const { top: top2, left: left2, bottom: bottom2, right, options } = this;
    const align = options.align;
    let rotation = 0;
    let maxWidth, titleX, titleY;
    if (this.isHorizontal()) {
      titleX = _alignStartEnd(align, left2, right);
      titleY = top2 + offset2;
      maxWidth = right - left2;
    } else {
      if (options.position === "left") {
        titleX = left2 + offset2;
        titleY = _alignStartEnd(align, bottom2, top2);
        rotation = PI * -0.5;
      } else {
        titleX = right - offset2;
        titleY = _alignStartEnd(align, top2, bottom2);
        rotation = PI * 0.5;
      }
      maxWidth = bottom2 - top2;
    }
    return {
      titleX,
      titleY,
      maxWidth,
      rotation
    };
  }
  draw() {
    const ctx = this.ctx;
    const opts2 = this.options;
    if (!opts2.display) {
      return;
    }
    const fontOpts = toFont(opts2.font);
    const lineHeight2 = fontOpts.lineHeight;
    const offset2 = lineHeight2 / 2 + this._padding.top;
    const { titleX, titleY, maxWidth, rotation } = this._drawArgs(offset2);
    renderText(ctx, opts2.text, 0, 0, fontOpts, {
      color: opts2.color,
      maxWidth,
      rotation,
      textAlign: _toLeftRightCenter(opts2.align),
      textBaseline: "middle",
      translation: [
        titleX,
        titleY
      ]
    });
  }
}
function createTitle(chart, titleOpts) {
  const title = new Title({
    ctx: chart.ctx,
    options: titleOpts,
    chart
  });
  layouts.configure(chart, title, titleOpts);
  layouts.addBox(chart, title);
  chart.titleBlock = title;
}
var plugin_title = {
  id: "title",
  _element: Title,
  start(chart, _args, options) {
    createTitle(chart, options);
  },
  stop(chart) {
    const titleBlock = chart.titleBlock;
    layouts.removeBox(chart, titleBlock);
    delete chart.titleBlock;
  },
  beforeUpdate(chart, _args, options) {
    const title = chart.titleBlock;
    layouts.configure(chart, title, options);
    title.options = options;
  },
  defaults: {
    align: "center",
    display: false,
    font: {
      weight: "bold"
    },
    fullSize: true,
    padding: 10,
    position: "top",
    text: "",
    weight: 2e3
  },
  defaultRoutes: {
    color: "color"
  },
  descriptors: {
    _scriptable: true,
    _indexable: false
  }
};
const positioners = {
  average(items) {
    if (!items.length) {
      return false;
    }
    let i2, len;
    let xSet = /* @__PURE__ */ new Set();
    let y2 = 0;
    let count = 0;
    for (i2 = 0, len = items.length; i2 < len; ++i2) {
      const el2 = items[i2].element;
      if (el2 && el2.hasValue()) {
        const pos = el2.tooltipPosition();
        xSet.add(pos.x);
        y2 += pos.y;
        ++count;
      }
    }
    if (count === 0 || xSet.size === 0) {
      return false;
    }
    const xAverage = [
      ...xSet
    ].reduce((a2, b2) => a2 + b2) / xSet.size;
    return {
      x: xAverage,
      y: y2 / count
    };
  },
  nearest(items, eventPosition) {
    if (!items.length) {
      return false;
    }
    let x2 = eventPosition.x;
    let y2 = eventPosition.y;
    let minDistance = Number.POSITIVE_INFINITY;
    let i2, len, nearestElement;
    for (i2 = 0, len = items.length; i2 < len; ++i2) {
      const el2 = items[i2].element;
      if (el2 && el2.hasValue()) {
        const center = el2.getCenterPoint();
        const d2 = distanceBetweenPoints(eventPosition, center);
        if (d2 < minDistance) {
          minDistance = d2;
          nearestElement = el2;
        }
      }
    }
    if (nearestElement) {
      const tp = nearestElement.tooltipPosition();
      x2 = tp.x;
      y2 = tp.y;
    }
    return {
      x: x2,
      y: y2
    };
  }
};
function pushOrConcat(base, toPush) {
  if (toPush) {
    if (isArray$4(toPush)) {
      Array.prototype.push.apply(base, toPush);
    } else {
      base.push(toPush);
    }
  }
  return base;
}
function splitNewlines(str) {
  if ((typeof str === "string" || str instanceof String) && str.indexOf("\n") > -1) {
    return str.split("\n");
  }
  return str;
}
function createTooltipItem(chart, item) {
  const { element: element2, datasetIndex, index: index2 } = item;
  const controller = chart.getDatasetMeta(datasetIndex).controller;
  const { label, value: value2 } = controller.getLabelAndValue(index2);
  return {
    chart,
    label,
    parsed: controller.getParsed(index2),
    raw: chart.data.datasets[datasetIndex].data[index2],
    formattedValue: value2,
    dataset: controller.getDataset(),
    dataIndex: index2,
    datasetIndex,
    element: element2
  };
}
function getTooltipSize(tooltip, options) {
  const ctx = tooltip.chart.ctx;
  const { body, footer: footer2, title } = tooltip;
  const { boxWidth, boxHeight } = options;
  const bodyFont = toFont(options.bodyFont);
  const titleFont = toFont(options.titleFont);
  const footerFont = toFont(options.footerFont);
  const titleLineCount = title.length;
  const footerLineCount = footer2.length;
  const bodyLineItemCount = body.length;
  const padding = toPadding(options.padding);
  let height = padding.height;
  let width = 0;
  let combinedBodyLength = body.reduce((count, bodyItem) => count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length, 0);
  combinedBodyLength += tooltip.beforeBody.length + tooltip.afterBody.length;
  if (titleLineCount) {
    height += titleLineCount * titleFont.lineHeight + (titleLineCount - 1) * options.titleSpacing + options.titleMarginBottom;
  }
  if (combinedBodyLength) {
    const bodyLineHeight = options.displayColors ? Math.max(boxHeight, bodyFont.lineHeight) : bodyFont.lineHeight;
    height += bodyLineItemCount * bodyLineHeight + (combinedBodyLength - bodyLineItemCount) * bodyFont.lineHeight + (combinedBodyLength - 1) * options.bodySpacing;
  }
  if (footerLineCount) {
    height += options.footerMarginTop + footerLineCount * footerFont.lineHeight + (footerLineCount - 1) * options.footerSpacing;
  }
  let widthPadding = 0;
  const maxLineWidth = function(line2) {
    width = Math.max(width, ctx.measureText(line2).width + widthPadding);
  };
  ctx.save();
  ctx.font = titleFont.string;
  each(tooltip.title, maxLineWidth);
  ctx.font = bodyFont.string;
  each(tooltip.beforeBody.concat(tooltip.afterBody), maxLineWidth);
  widthPadding = options.displayColors ? boxWidth + 2 + options.boxPadding : 0;
  each(body, (bodyItem) => {
    each(bodyItem.before, maxLineWidth);
    each(bodyItem.lines, maxLineWidth);
    each(bodyItem.after, maxLineWidth);
  });
  widthPadding = 0;
  ctx.font = footerFont.string;
  each(tooltip.footer, maxLineWidth);
  ctx.restore();
  width += padding.width;
  return {
    width,
    height
  };
}
function determineYAlign(chart, size2) {
  const { y: y2, height } = size2;
  if (y2 < height / 2) {
    return "top";
  } else if (y2 > chart.height - height / 2) {
    return "bottom";
  }
  return "center";
}
function doesNotFitWithAlign(xAlign, chart, options, size2) {
  const { x: x2, width } = size2;
  const caret2 = options.caretSize + options.caretPadding;
  if (xAlign === "left" && x2 + width + caret2 > chart.width) {
    return true;
  }
  if (xAlign === "right" && x2 - width - caret2 < 0) {
    return true;
  }
}
function determineXAlign(chart, options, size2, yAlign) {
  const { x: x2, width } = size2;
  const { width: chartWidth, chartArea: { left: left2, right } } = chart;
  let xAlign = "center";
  if (yAlign === "center") {
    xAlign = x2 <= (left2 + right) / 2 ? "left" : "right";
  } else if (x2 <= width / 2) {
    xAlign = "left";
  } else if (x2 >= chartWidth - width / 2) {
    xAlign = "right";
  }
  if (doesNotFitWithAlign(xAlign, chart, options, size2)) {
    xAlign = "center";
  }
  return xAlign;
}
function determineAlignment(chart, options, size2) {
  const yAlign = size2.yAlign || options.yAlign || determineYAlign(chart, size2);
  return {
    xAlign: size2.xAlign || options.xAlign || determineXAlign(chart, options, size2, yAlign),
    yAlign
  };
}
function alignX(size2, xAlign) {
  let { x: x2, width } = size2;
  if (xAlign === "right") {
    x2 -= width;
  } else if (xAlign === "center") {
    x2 -= width / 2;
  }
  return x2;
}
function alignY(size2, yAlign, paddingAndSize) {
  let { y: y2, height } = size2;
  if (yAlign === "top") {
    y2 += paddingAndSize;
  } else if (yAlign === "bottom") {
    y2 -= height + paddingAndSize;
  } else {
    y2 -= height / 2;
  }
  return y2;
}
function getBackgroundPoint(options, size2, alignment, chart) {
  const { caretSize, caretPadding, cornerRadius } = options;
  const { xAlign, yAlign } = alignment;
  const paddingAndSize = caretSize + caretPadding;
  const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(cornerRadius);
  let x2 = alignX(size2, xAlign);
  const y2 = alignY(size2, yAlign, paddingAndSize);
  if (yAlign === "center") {
    if (xAlign === "left") {
      x2 += paddingAndSize;
    } else if (xAlign === "right") {
      x2 -= paddingAndSize;
    }
  } else if (xAlign === "left") {
    x2 -= Math.max(topLeft, bottomLeft) + caretSize;
  } else if (xAlign === "right") {
    x2 += Math.max(topRight, bottomRight) + caretSize;
  }
  return {
    x: _limitValue(x2, 0, chart.width - size2.width),
    y: _limitValue(y2, 0, chart.height - size2.height)
  };
}
function getAlignedX(tooltip, align, options) {
  const padding = toPadding(options.padding);
  return align === "center" ? tooltip.x + tooltip.width / 2 : align === "right" ? tooltip.x + tooltip.width - padding.right : tooltip.x + padding.left;
}
function getBeforeAfterBodyLines(callback2) {
  return pushOrConcat([], splitNewlines(callback2));
}
function createTooltipContext(parent, tooltip, tooltipItems) {
  return createContext(parent, {
    tooltip,
    tooltipItems,
    type: "tooltip"
  });
}
function overrideCallbacks(callbacks, context) {
  const override = context && context.dataset && context.dataset.tooltip && context.dataset.tooltip.callbacks;
  return override ? callbacks.override(override) : callbacks;
}
const defaultCallbacks = {
  beforeTitle: noop$4,
  title(tooltipItems) {
    if (tooltipItems.length > 0) {
      const item = tooltipItems[0];
      const labels = item.chart.data.labels;
      const labelCount = labels ? labels.length : 0;
      if (this && this.options && this.options.mode === "dataset") {
        return item.dataset.label || "";
      } else if (item.label) {
        return item.label;
      } else if (labelCount > 0 && item.dataIndex < labelCount) {
        return labels[item.dataIndex];
      }
    }
    return "";
  },
  afterTitle: noop$4,
  beforeBody: noop$4,
  beforeLabel: noop$4,
  label(tooltipItem) {
    if (this && this.options && this.options.mode === "dataset") {
      return tooltipItem.label + ": " + tooltipItem.formattedValue || tooltipItem.formattedValue;
    }
    let label = tooltipItem.dataset.label || "";
    if (label) {
      label += ": ";
    }
    const value2 = tooltipItem.formattedValue;
    if (!isNullOrUndef(value2)) {
      label += value2;
    }
    return label;
  },
  labelColor(tooltipItem) {
    const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);
    const options = meta.controller.getStyle(tooltipItem.dataIndex);
    return {
      borderColor: options.borderColor,
      backgroundColor: options.backgroundColor,
      borderWidth: options.borderWidth,
      borderDash: options.borderDash,
      borderDashOffset: options.borderDashOffset,
      borderRadius: 0
    };
  },
  labelTextColor() {
    return this.options.bodyColor;
  },
  labelPointStyle(tooltipItem) {
    const meta = tooltipItem.chart.getDatasetMeta(tooltipItem.datasetIndex);
    const options = meta.controller.getStyle(tooltipItem.dataIndex);
    return {
      pointStyle: options.pointStyle,
      rotation: options.rotation
    };
  },
  afterLabel: noop$4,
  afterBody: noop$4,
  beforeFooter: noop$4,
  footer: noop$4,
  afterFooter: noop$4
};
function invokeCallbackWithFallback(callbacks, name2, ctx, arg) {
  const result = callbacks[name2].call(ctx, arg);
  if (typeof result === "undefined") {
    return defaultCallbacks[name2].call(ctx, arg);
  }
  return result;
}
class Tooltip2 extends Element$1 {
  constructor(config2) {
    super();
    this.opacity = 0;
    this._active = [];
    this._eventPosition = void 0;
    this._size = void 0;
    this._cachedAnimations = void 0;
    this._tooltipItems = [];
    this.$animations = void 0;
    this.$context = void 0;
    this.chart = config2.chart;
    this.options = config2.options;
    this.dataPoints = void 0;
    this.title = void 0;
    this.beforeBody = void 0;
    this.body = void 0;
    this.afterBody = void 0;
    this.footer = void 0;
    this.xAlign = void 0;
    this.yAlign = void 0;
    this.x = void 0;
    this.y = void 0;
    this.height = void 0;
    this.width = void 0;
    this.caretX = void 0;
    this.caretY = void 0;
    this.labelColors = void 0;
    this.labelPointStyles = void 0;
    this.labelTextColors = void 0;
  }
  initialize(options) {
    this.options = options;
    this._cachedAnimations = void 0;
    this.$context = void 0;
  }
  _resolveAnimations() {
    const cached = this._cachedAnimations;
    if (cached) {
      return cached;
    }
    const chart = this.chart;
    const options = this.options.setContext(this.getContext());
    const opts2 = options.enabled && chart.options.animation && options.animations;
    const animations2 = new Animations(this.chart, opts2);
    if (opts2._cacheable) {
      this._cachedAnimations = Object.freeze(animations2);
    }
    return animations2;
  }
  getContext() {
    return this.$context || (this.$context = createTooltipContext(this.chart.getContext(), this, this._tooltipItems));
  }
  getTitle(context, options) {
    const { callbacks } = options;
    const beforeTitle = invokeCallbackWithFallback(callbacks, "beforeTitle", this, context);
    const title = invokeCallbackWithFallback(callbacks, "title", this, context);
    const afterTitle = invokeCallbackWithFallback(callbacks, "afterTitle", this, context);
    let lines = [];
    lines = pushOrConcat(lines, splitNewlines(beforeTitle));
    lines = pushOrConcat(lines, splitNewlines(title));
    lines = pushOrConcat(lines, splitNewlines(afterTitle));
    return lines;
  }
  getBeforeBody(tooltipItems, options) {
    return getBeforeAfterBodyLines(invokeCallbackWithFallback(options.callbacks, "beforeBody", this, tooltipItems));
  }
  getBody(tooltipItems, options) {
    const { callbacks } = options;
    const bodyItems = [];
    each(tooltipItems, (context) => {
      const bodyItem = {
        before: [],
        lines: [],
        after: []
      };
      const scoped = overrideCallbacks(callbacks, context);
      pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, "beforeLabel", this, context)));
      pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, "label", this, context));
      pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, "afterLabel", this, context)));
      bodyItems.push(bodyItem);
    });
    return bodyItems;
  }
  getAfterBody(tooltipItems, options) {
    return getBeforeAfterBodyLines(invokeCallbackWithFallback(options.callbacks, "afterBody", this, tooltipItems));
  }
  getFooter(tooltipItems, options) {
    const { callbacks } = options;
    const beforeFooter = invokeCallbackWithFallback(callbacks, "beforeFooter", this, tooltipItems);
    const footer2 = invokeCallbackWithFallback(callbacks, "footer", this, tooltipItems);
    const afterFooter = invokeCallbackWithFallback(callbacks, "afterFooter", this, tooltipItems);
    let lines = [];
    lines = pushOrConcat(lines, splitNewlines(beforeFooter));
    lines = pushOrConcat(lines, splitNewlines(footer2));
    lines = pushOrConcat(lines, splitNewlines(afterFooter));
    return lines;
  }
  _createItems(options) {
    const active3 = this._active;
    const data = this.chart.data;
    const labelColors = [];
    const labelPointStyles = [];
    const labelTextColors = [];
    let tooltipItems = [];
    let i2, len;
    for (i2 = 0, len = active3.length; i2 < len; ++i2) {
      tooltipItems.push(createTooltipItem(this.chart, active3[i2]));
    }
    if (options.filter) {
      tooltipItems = tooltipItems.filter((element2, index2, array4) => options.filter(element2, index2, array4, data));
    }
    if (options.itemSort) {
      tooltipItems = tooltipItems.sort((a2, b2) => options.itemSort(a2, b2, data));
    }
    each(tooltipItems, (context) => {
      const scoped = overrideCallbacks(options.callbacks, context);
      labelColors.push(invokeCallbackWithFallback(scoped, "labelColor", this, context));
      labelPointStyles.push(invokeCallbackWithFallback(scoped, "labelPointStyle", this, context));
      labelTextColors.push(invokeCallbackWithFallback(scoped, "labelTextColor", this, context));
    });
    this.labelColors = labelColors;
    this.labelPointStyles = labelPointStyles;
    this.labelTextColors = labelTextColors;
    this.dataPoints = tooltipItems;
    return tooltipItems;
  }
  update(changed, replay) {
    const options = this.options.setContext(this.getContext());
    const active3 = this._active;
    let properties2;
    let tooltipItems = [];
    if (!active3.length) {
      if (this.opacity !== 0) {
        properties2 = {
          opacity: 0
        };
      }
    } else {
      const position2 = positioners[options.position].call(this, active3, this._eventPosition);
      tooltipItems = this._createItems(options);
      this.title = this.getTitle(tooltipItems, options);
      this.beforeBody = this.getBeforeBody(tooltipItems, options);
      this.body = this.getBody(tooltipItems, options);
      this.afterBody = this.getAfterBody(tooltipItems, options);
      this.footer = this.getFooter(tooltipItems, options);
      const size2 = this._size = getTooltipSize(this, options);
      const positionAndSize = Object.assign({}, position2, size2);
      const alignment = determineAlignment(this.chart, options, positionAndSize);
      const backgroundPoint = getBackgroundPoint(options, positionAndSize, alignment, this.chart);
      this.xAlign = alignment.xAlign;
      this.yAlign = alignment.yAlign;
      properties2 = {
        opacity: 1,
        x: backgroundPoint.x,
        y: backgroundPoint.y,
        width: size2.width,
        height: size2.height,
        caretX: position2.x,
        caretY: position2.y
      };
    }
    this._tooltipItems = tooltipItems;
    this.$context = void 0;
    if (properties2) {
      this._resolveAnimations().update(this, properties2);
    }
    if (changed && options.external) {
      options.external.call(this, {
        chart: this.chart,
        tooltip: this,
        replay
      });
    }
  }
  drawCaret(tooltipPoint, ctx, size2, options) {
    const caretPosition = this.getCaretPosition(tooltipPoint, size2, options);
    ctx.lineTo(caretPosition.x1, caretPosition.y1);
    ctx.lineTo(caretPosition.x2, caretPosition.y2);
    ctx.lineTo(caretPosition.x3, caretPosition.y3);
  }
  getCaretPosition(tooltipPoint, size2, options) {
    const { xAlign, yAlign } = this;
    const { caretSize, cornerRadius } = options;
    const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(cornerRadius);
    const { x: ptX, y: ptY } = tooltipPoint;
    const { width, height } = size2;
    let x1, x2, x3, y1, y2, y3;
    if (yAlign === "center") {
      y2 = ptY + height / 2;
      if (xAlign === "left") {
        x1 = ptX;
        x2 = x1 - caretSize;
        y1 = y2 + caretSize;
        y3 = y2 - caretSize;
      } else {
        x1 = ptX + width;
        x2 = x1 + caretSize;
        y1 = y2 - caretSize;
        y3 = y2 + caretSize;
      }
      x3 = x1;
    } else {
      if (xAlign === "left") {
        x2 = ptX + Math.max(topLeft, bottomLeft) + caretSize;
      } else if (xAlign === "right") {
        x2 = ptX + width - Math.max(topRight, bottomRight) - caretSize;
      } else {
        x2 = this.caretX;
      }
      if (yAlign === "top") {
        y1 = ptY;
        y2 = y1 - caretSize;
        x1 = x2 - caretSize;
        x3 = x2 + caretSize;
      } else {
        y1 = ptY + height;
        y2 = y1 + caretSize;
        x1 = x2 + caretSize;
        x3 = x2 - caretSize;
      }
      y3 = y1;
    }
    return {
      x1,
      x2,
      x3,
      y1,
      y2,
      y3
    };
  }
  drawTitle(pt, ctx, options) {
    const title = this.title;
    const length2 = title.length;
    let titleFont, titleSpacing, i2;
    if (length2) {
      const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
      pt.x = getAlignedX(this, options.titleAlign, options);
      ctx.textAlign = rtlHelper.textAlign(options.titleAlign);
      ctx.textBaseline = "middle";
      titleFont = toFont(options.titleFont);
      titleSpacing = options.titleSpacing;
      ctx.fillStyle = options.titleColor;
      ctx.font = titleFont.string;
      for (i2 = 0; i2 < length2; ++i2) {
        ctx.fillText(title[i2], rtlHelper.x(pt.x), pt.y + titleFont.lineHeight / 2);
        pt.y += titleFont.lineHeight + titleSpacing;
        if (i2 + 1 === length2) {
          pt.y += options.titleMarginBottom - titleSpacing;
        }
      }
    }
  }
  _drawColorBox(ctx, pt, i2, rtlHelper, options) {
    const labelColor = this.labelColors[i2];
    const labelPointStyle = this.labelPointStyles[i2];
    const { boxHeight, boxWidth } = options;
    const bodyFont = toFont(options.bodyFont);
    const colorX = getAlignedX(this, "left", options);
    const rtlColorX = rtlHelper.x(colorX);
    const yOffSet = boxHeight < bodyFont.lineHeight ? (bodyFont.lineHeight - boxHeight) / 2 : 0;
    const colorY = pt.y + yOffSet;
    if (options.usePointStyle) {
      const drawOptions = {
        radius: Math.min(boxWidth, boxHeight) / 2,
        pointStyle: labelPointStyle.pointStyle,
        rotation: labelPointStyle.rotation,
        borderWidth: 1
      };
      const centerX = rtlHelper.leftForLtr(rtlColorX, boxWidth) + boxWidth / 2;
      const centerY = colorY + boxHeight / 2;
      ctx.strokeStyle = options.multiKeyBackground;
      ctx.fillStyle = options.multiKeyBackground;
      drawPoint(ctx, drawOptions, centerX, centerY);
      ctx.strokeStyle = labelColor.borderColor;
      ctx.fillStyle = labelColor.backgroundColor;
      drawPoint(ctx, drawOptions, centerX, centerY);
    } else {
      ctx.lineWidth = isObject$3(labelColor.borderWidth) ? Math.max(...Object.values(labelColor.borderWidth)) : labelColor.borderWidth || 1;
      ctx.strokeStyle = labelColor.borderColor;
      ctx.setLineDash(labelColor.borderDash || []);
      ctx.lineDashOffset = labelColor.borderDashOffset || 0;
      const outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);
      const innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);
      const borderRadius2 = toTRBLCorners(labelColor.borderRadius);
      if (Object.values(borderRadius2).some((v2) => v2 !== 0)) {
        ctx.beginPath();
        ctx.fillStyle = options.multiKeyBackground;
        addRoundedRectPath(ctx, {
          x: outerX,
          y: colorY,
          w: boxWidth,
          h: boxHeight,
          radius: borderRadius2
        });
        ctx.fill();
        ctx.stroke();
        ctx.fillStyle = labelColor.backgroundColor;
        ctx.beginPath();
        addRoundedRectPath(ctx, {
          x: innerX,
          y: colorY + 1,
          w: boxWidth - 2,
          h: boxHeight - 2,
          radius: borderRadius2
        });
        ctx.fill();
      } else {
        ctx.fillStyle = options.multiKeyBackground;
        ctx.fillRect(outerX, colorY, boxWidth, boxHeight);
        ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);
        ctx.fillStyle = labelColor.backgroundColor;
        ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);
      }
    }
    ctx.fillStyle = this.labelTextColors[i2];
  }
  drawBody(pt, ctx, options) {
    const { body } = this;
    const { bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth, boxPadding } = options;
    const bodyFont = toFont(options.bodyFont);
    let bodyLineHeight = bodyFont.lineHeight;
    let xLinePadding = 0;
    const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
    const fillLineOfText = function(line2) {
      ctx.fillText(line2, rtlHelper.x(pt.x + xLinePadding), pt.y + bodyLineHeight / 2);
      pt.y += bodyLineHeight + bodySpacing;
    };
    const bodyAlignForCalculation = rtlHelper.textAlign(bodyAlign);
    let bodyItem, textColor, lines, i2, j2, ilen, jlen;
    ctx.textAlign = bodyAlign;
    ctx.textBaseline = "middle";
    ctx.font = bodyFont.string;
    pt.x = getAlignedX(this, bodyAlignForCalculation, options);
    ctx.fillStyle = options.bodyColor;
    each(this.beforeBody, fillLineOfText);
    xLinePadding = displayColors && bodyAlignForCalculation !== "right" ? bodyAlign === "center" ? boxWidth / 2 + boxPadding : boxWidth + 2 + boxPadding : 0;
    for (i2 = 0, ilen = body.length; i2 < ilen; ++i2) {
      bodyItem = body[i2];
      textColor = this.labelTextColors[i2];
      ctx.fillStyle = textColor;
      each(bodyItem.before, fillLineOfText);
      lines = bodyItem.lines;
      if (displayColors && lines.length) {
        this._drawColorBox(ctx, pt, i2, rtlHelper, options);
        bodyLineHeight = Math.max(bodyFont.lineHeight, boxHeight);
      }
      for (j2 = 0, jlen = lines.length; j2 < jlen; ++j2) {
        fillLineOfText(lines[j2]);
        bodyLineHeight = bodyFont.lineHeight;
      }
      each(bodyItem.after, fillLineOfText);
    }
    xLinePadding = 0;
    bodyLineHeight = bodyFont.lineHeight;
    each(this.afterBody, fillLineOfText);
    pt.y -= bodySpacing;
  }
  drawFooter(pt, ctx, options) {
    const footer2 = this.footer;
    const length2 = footer2.length;
    let footerFont, i2;
    if (length2) {
      const rtlHelper = getRtlAdapter(options.rtl, this.x, this.width);
      pt.x = getAlignedX(this, options.footerAlign, options);
      pt.y += options.footerMarginTop;
      ctx.textAlign = rtlHelper.textAlign(options.footerAlign);
      ctx.textBaseline = "middle";
      footerFont = toFont(options.footerFont);
      ctx.fillStyle = options.footerColor;
      ctx.font = footerFont.string;
      for (i2 = 0; i2 < length2; ++i2) {
        ctx.fillText(footer2[i2], rtlHelper.x(pt.x), pt.y + footerFont.lineHeight / 2);
        pt.y += footerFont.lineHeight + options.footerSpacing;
      }
    }
  }
  drawBackground(pt, ctx, tooltipSize, options) {
    const { xAlign, yAlign } = this;
    const { x: x2, y: y2 } = pt;
    const { width, height } = tooltipSize;
    const { topLeft, topRight, bottomLeft, bottomRight } = toTRBLCorners(options.cornerRadius);
    ctx.fillStyle = options.backgroundColor;
    ctx.strokeStyle = options.borderColor;
    ctx.lineWidth = options.borderWidth;
    ctx.beginPath();
    ctx.moveTo(x2 + topLeft, y2);
    if (yAlign === "top") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + width - topRight, y2);
    ctx.quadraticCurveTo(x2 + width, y2, x2 + width, y2 + topRight);
    if (yAlign === "center" && xAlign === "right") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + width, y2 + height - bottomRight);
    ctx.quadraticCurveTo(x2 + width, y2 + height, x2 + width - bottomRight, y2 + height);
    if (yAlign === "bottom") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2 + bottomLeft, y2 + height);
    ctx.quadraticCurveTo(x2, y2 + height, x2, y2 + height - bottomLeft);
    if (yAlign === "center" && xAlign === "left") {
      this.drawCaret(pt, ctx, tooltipSize, options);
    }
    ctx.lineTo(x2, y2 + topLeft);
    ctx.quadraticCurveTo(x2, y2, x2 + topLeft, y2);
    ctx.closePath();
    ctx.fill();
    if (options.borderWidth > 0) {
      ctx.stroke();
    }
  }
  _updateAnimationTarget(options) {
    const chart = this.chart;
    const anims = this.$animations;
    const animX = anims && anims.x;
    const animY = anims && anims.y;
    if (animX || animY) {
      const position2 = positioners[options.position].call(this, this._active, this._eventPosition);
      if (!position2) {
        return;
      }
      const size2 = this._size = getTooltipSize(this, options);
      const positionAndSize = Object.assign({}, position2, this._size);
      const alignment = determineAlignment(chart, options, positionAndSize);
      const point2 = getBackgroundPoint(options, positionAndSize, alignment, chart);
      if (animX._to !== point2.x || animY._to !== point2.y) {
        this.xAlign = alignment.xAlign;
        this.yAlign = alignment.yAlign;
        this.width = size2.width;
        this.height = size2.height;
        this.caretX = position2.x;
        this.caretY = position2.y;
        this._resolveAnimations().update(this, point2);
      }
    }
  }
  _willRender() {
    return !!this.opacity;
  }
  draw(ctx) {
    const options = this.options.setContext(this.getContext());
    let opacity = this.opacity;
    if (!opacity) {
      return;
    }
    this._updateAnimationTarget(options);
    const tooltipSize = {
      width: this.width,
      height: this.height
    };
    const pt = {
      x: this.x,
      y: this.y
    };
    opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;
    const padding = toPadding(options.padding);
    const hasTooltipContent = this.title.length || this.beforeBody.length || this.body.length || this.afterBody.length || this.footer.length;
    if (options.enabled && hasTooltipContent) {
      ctx.save();
      ctx.globalAlpha = opacity;
      this.drawBackground(pt, ctx, tooltipSize, options);
      overrideTextDirection(ctx, options.textDirection);
      pt.y += padding.top;
      this.drawTitle(pt, ctx, options);
      this.drawBody(pt, ctx, options);
      this.drawFooter(pt, ctx, options);
      restoreTextDirection(ctx, options.textDirection);
      ctx.restore();
    }
  }
  getActiveElements() {
    return this._active || [];
  }
  setActiveElements(activeElements, eventPosition) {
    const lastActive = this._active;
    const active3 = activeElements.map(({ datasetIndex, index: index2 }) => {
      const meta = this.chart.getDatasetMeta(datasetIndex);
      if (!meta) {
        throw new Error("Cannot find a dataset at index " + datasetIndex);
      }
      return {
        datasetIndex,
        element: meta.data[index2],
        index: index2
      };
    });
    const changed = !_elementsEqual(lastActive, active3);
    const positionChanged = this._positionChanged(active3, eventPosition);
    if (changed || positionChanged) {
      this._active = active3;
      this._eventPosition = eventPosition;
      this._ignoreReplayEvents = true;
      this.update(true);
    }
  }
  handleEvent(e2, replay, inChartArea = true) {
    if (replay && this._ignoreReplayEvents) {
      return false;
    }
    this._ignoreReplayEvents = false;
    const options = this.options;
    const lastActive = this._active || [];
    const active3 = this._getActiveElements(e2, lastActive, replay, inChartArea);
    const positionChanged = this._positionChanged(active3, e2);
    const changed = replay || !_elementsEqual(active3, lastActive) || positionChanged;
    if (changed) {
      this._active = active3;
      if (options.enabled || options.external) {
        this._eventPosition = {
          x: e2.x,
          y: e2.y
        };
        this.update(true, replay);
      }
    }
    return changed;
  }
  _getActiveElements(e2, lastActive, replay, inChartArea) {
    const options = this.options;
    if (e2.type === "mouseout") {
      return [];
    }
    if (!inChartArea) {
      return lastActive.filter((i2) => this.chart.data.datasets[i2.datasetIndex] && this.chart.getDatasetMeta(i2.datasetIndex).controller.getParsed(i2.index) !== void 0);
    }
    const active3 = this.chart.getElementsAtEventForMode(e2, options.mode, options, replay);
    if (options.reverse) {
      active3.reverse();
    }
    return active3;
  }
  _positionChanged(active3, e2) {
    const { caretX, caretY, options } = this;
    const position2 = positioners[options.position].call(this, active3, e2);
    return position2 !== false && (caretX !== position2.x || caretY !== position2.y);
  }
}
__publicField(Tooltip2, "positioners", positioners);
var plugin_tooltip = {
  id: "tooltip",
  _element: Tooltip2,
  positioners,
  afterInit(chart, _args, options) {
    if (options) {
      chart.tooltip = new Tooltip2({
        chart,
        options
      });
    }
  },
  beforeUpdate(chart, _args, options) {
    if (chart.tooltip) {
      chart.tooltip.initialize(options);
    }
  },
  reset(chart, _args, options) {
    if (chart.tooltip) {
      chart.tooltip.initialize(options);
    }
  },
  afterDraw(chart) {
    const tooltip = chart.tooltip;
    if (tooltip && tooltip._willRender()) {
      const args = {
        tooltip
      };
      if (chart.notifyPlugins("beforeTooltipDraw", {
        ...args,
        cancelable: true
      }) === false) {
        return;
      }
      tooltip.draw(chart.ctx);
      chart.notifyPlugins("afterTooltipDraw", args);
    }
  },
  afterEvent(chart, args) {
    if (chart.tooltip) {
      const useFinalPosition = args.replay;
      if (chart.tooltip.handleEvent(args.event, useFinalPosition, args.inChartArea)) {
        args.changed = true;
      }
    }
  },
  defaults: {
    enabled: true,
    external: null,
    position: "average",
    backgroundColor: "rgba(0,0,0,0.8)",
    titleColor: "#fff",
    titleFont: {
      weight: "bold"
    },
    titleSpacing: 2,
    titleMarginBottom: 6,
    titleAlign: "left",
    bodyColor: "#fff",
    bodySpacing: 2,
    bodyFont: {},
    bodyAlign: "left",
    footerColor: "#fff",
    footerSpacing: 2,
    footerMarginTop: 6,
    footerFont: {
      weight: "bold"
    },
    footerAlign: "left",
    padding: 6,
    caretPadding: 2,
    caretSize: 5,
    cornerRadius: 6,
    boxHeight: (ctx, opts2) => opts2.bodyFont.size,
    boxWidth: (ctx, opts2) => opts2.bodyFont.size,
    multiKeyBackground: "#fff",
    displayColors: true,
    boxPadding: 0,
    borderColor: "rgba(0,0,0,0)",
    borderWidth: 0,
    animation: {
      duration: 400,
      easing: "easeOutQuart"
    },
    animations: {
      numbers: {
        type: "number",
        properties: [
          "x",
          "y",
          "width",
          "height",
          "caretX",
          "caretY"
        ]
      },
      opacity: {
        easing: "linear",
        duration: 200
      }
    },
    callbacks: defaultCallbacks
  },
  defaultRoutes: {
    bodyFont: "font",
    footerFont: "font",
    titleFont: "font"
  },
  descriptors: {
    _scriptable: (name2) => name2 !== "filter" && name2 !== "itemSort" && name2 !== "external",
    _indexable: false,
    callbacks: {
      _scriptable: false,
      _indexable: false
    },
    animation: {
      _fallback: false
    },
    animations: {
      _fallback: "animation"
    }
  },
  additionalOptionScopes: [
    "interaction"
  ]
};
const addIfString = (labels, raw, index2, addedLabels) => {
  if (typeof raw === "string") {
    index2 = labels.push(raw) - 1;
    addedLabels.unshift({
      index: index2,
      label: raw
    });
  } else if (isNaN(raw)) {
    index2 = null;
  }
  return index2;
};
function findOrAddLabel(labels, raw, index2, addedLabels) {
  const first = labels.indexOf(raw);
  if (first === -1) {
    return addIfString(labels, raw, index2, addedLabels);
  }
  const last = labels.lastIndexOf(raw);
  return first !== last ? index2 : first;
}
const validIndex = (index2, max2) => index2 === null ? null : _limitValue(Math.round(index2), 0, max2);
function _getLabelForValue(value2) {
  const labels = this.getLabels();
  if (value2 >= 0 && value2 < labels.length) {
    return labels[value2];
  }
  return value2;
}
class CategoryScale extends Scale {
  constructor(cfg) {
    super(cfg);
    this._startValue = void 0;
    this._valueRange = 0;
    this._addedLabels = [];
  }
  init(scaleOptions) {
    const added = this._addedLabels;
    if (added.length) {
      const labels = this.getLabels();
      for (const { index: index2, label } of added) {
        if (labels[index2] === label) {
          labels.splice(index2, 1);
        }
      }
      this._addedLabels = [];
    }
    super.init(scaleOptions);
  }
  parse(raw, index2) {
    if (isNullOrUndef(raw)) {
      return null;
    }
    const labels = this.getLabels();
    index2 = isFinite(index2) && labels[index2] === raw ? index2 : findOrAddLabel(labels, raw, valueOrDefault(index2, raw), this._addedLabels);
    return validIndex(index2, labels.length - 1);
  }
  determineDataLimits() {
    const { minDefined, maxDefined } = this.getUserBounds();
    let { min: min2, max: max2 } = this.getMinMax(true);
    if (this.options.bounds === "ticks") {
      if (!minDefined) {
        min2 = 0;
      }
      if (!maxDefined) {
        max2 = this.getLabels().length - 1;
      }
    }
    this.min = min2;
    this.max = max2;
  }
  buildTicks() {
    const min2 = this.min;
    const max2 = this.max;
    const offset2 = this.options.offset;
    const ticks = [];
    let labels = this.getLabels();
    labels = min2 === 0 && max2 === labels.length - 1 ? labels : labels.slice(min2, max2 + 1);
    this._valueRange = Math.max(labels.length - (offset2 ? 0 : 1), 1);
    this._startValue = this.min - (offset2 ? 0.5 : 0);
    for (let value2 = min2; value2 <= max2; value2++) {
      ticks.push({
        value: value2
      });
    }
    return ticks;
  }
  getLabelForValue(value2) {
    return _getLabelForValue.call(this, value2);
  }
  configure() {
    super.configure();
    if (!this.isHorizontal()) {
      this._reversePixels = !this._reversePixels;
    }
  }
  getPixelForValue(value2) {
    if (typeof value2 !== "number") {
      value2 = this.parse(value2);
    }
    return value2 === null ? NaN : this.getPixelForDecimal((value2 - this._startValue) / this._valueRange);
  }
  getPixelForTick(index2) {
    const ticks = this.ticks;
    if (index2 < 0 || index2 > ticks.length - 1) {
      return null;
    }
    return this.getPixelForValue(ticks[index2].value);
  }
  getValueForPixel(pixel) {
    return Math.round(this._startValue + this.getDecimalForPixel(pixel) * this._valueRange);
  }
  getBasePixel() {
    return this.bottom;
  }
}
__publicField(CategoryScale, "id", "category");
__publicField(CategoryScale, "defaults", {
  ticks: {
    callback: _getLabelForValue
  }
});
function generateTicks$1(generationOptions, dataRange) {
  const ticks = [];
  const MIN_SPACING = 1e-14;
  const { bounds: bounds2, step, min: min2, max: max2, precision, count, maxTicks, maxDigits, includeBounds } = generationOptions;
  const unit2 = step || 1;
  const maxSpaces = maxTicks - 1;
  const { min: rmin, max: rmax } = dataRange;
  const minDefined = !isNullOrUndef(min2);
  const maxDefined = !isNullOrUndef(max2);
  const countDefined = !isNullOrUndef(count);
  const minSpacing = (rmax - rmin) / (maxDigits + 1);
  let spacing2 = niceNum((rmax - rmin) / maxSpaces / unit2) * unit2;
  let factor, niceMin, niceMax, numSpaces;
  if (spacing2 < MIN_SPACING && !minDefined && !maxDefined) {
    return [
      {
        value: rmin
      },
      {
        value: rmax
      }
    ];
  }
  numSpaces = Math.ceil(rmax / spacing2) - Math.floor(rmin / spacing2);
  if (numSpaces > maxSpaces) {
    spacing2 = niceNum(numSpaces * spacing2 / maxSpaces / unit2) * unit2;
  }
  if (!isNullOrUndef(precision)) {
    factor = Math.pow(10, precision);
    spacing2 = Math.ceil(spacing2 * factor) / factor;
  }
  if (bounds2 === "ticks") {
    niceMin = Math.floor(rmin / spacing2) * spacing2;
    niceMax = Math.ceil(rmax / spacing2) * spacing2;
  } else {
    niceMin = rmin;
    niceMax = rmax;
  }
  if (minDefined && maxDefined && step && almostWhole((max2 - min2) / step, spacing2 / 1e3)) {
    numSpaces = Math.round(Math.min((max2 - min2) / spacing2, maxTicks));
    spacing2 = (max2 - min2) / numSpaces;
    niceMin = min2;
    niceMax = max2;
  } else if (countDefined) {
    niceMin = minDefined ? min2 : niceMin;
    niceMax = maxDefined ? max2 : niceMax;
    numSpaces = count - 1;
    spacing2 = (niceMax - niceMin) / numSpaces;
  } else {
    numSpaces = (niceMax - niceMin) / spacing2;
    if (almostEquals(numSpaces, Math.round(numSpaces), spacing2 / 1e3)) {
      numSpaces = Math.round(numSpaces);
    } else {
      numSpaces = Math.ceil(numSpaces);
    }
  }
  const decimalPlaces = Math.max(_decimalPlaces(spacing2), _decimalPlaces(niceMin));
  factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);
  niceMin = Math.round(niceMin * factor) / factor;
  niceMax = Math.round(niceMax * factor) / factor;
  let j2 = 0;
  if (minDefined) {
    if (includeBounds && niceMin !== min2) {
      ticks.push({
        value: min2
      });
      if (niceMin < min2) {
        j2++;
      }
      if (almostEquals(Math.round((niceMin + j2 * spacing2) * factor) / factor, min2, relativeLabelSize(min2, minSpacing, generationOptions))) {
        j2++;
      }
    } else if (niceMin < min2) {
      j2++;
    }
  }
  for (; j2 < numSpaces; ++j2) {
    const tickValue = Math.round((niceMin + j2 * spacing2) * factor) / factor;
    if (maxDefined && tickValue > max2) {
      break;
    }
    ticks.push({
      value: tickValue
    });
  }
  if (maxDefined && includeBounds && niceMax !== max2) {
    if (ticks.length && almostEquals(ticks[ticks.length - 1].value, max2, relativeLabelSize(max2, minSpacing, generationOptions))) {
      ticks[ticks.length - 1].value = max2;
    } else {
      ticks.push({
        value: max2
      });
    }
  } else if (!maxDefined || niceMax === max2) {
    ticks.push({
      value: niceMax
    });
  }
  return ticks;
}
function relativeLabelSize(value2, minSpacing, { horizontal, minRotation }) {
  const rad = toRadians(minRotation);
  const ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 1e-3;
  const length2 = 0.75 * minSpacing * ("" + value2).length;
  return Math.min(minSpacing / ratio, length2);
}
class LinearScaleBase extends Scale {
  constructor(cfg) {
    super(cfg);
    this.start = void 0;
    this.end = void 0;
    this._startValue = void 0;
    this._endValue = void 0;
    this._valueRange = 0;
  }
  parse(raw, index2) {
    if (isNullOrUndef(raw)) {
      return null;
    }
    if ((typeof raw === "number" || raw instanceof Number) && !isFinite(+raw)) {
      return null;
    }
    return +raw;
  }
  handleTickRangeOptions() {
    const { beginAtZero } = this.options;
    const { minDefined, maxDefined } = this.getUserBounds();
    let { min: min2, max: max2 } = this;
    const setMin = (v2) => min2 = minDefined ? min2 : v2;
    const setMax = (v2) => max2 = maxDefined ? max2 : v2;
    if (beginAtZero) {
      const minSign = sign$1(min2);
      const maxSign = sign$1(max2);
      if (minSign < 0 && maxSign < 0) {
        setMax(0);
      } else if (minSign > 0 && maxSign > 0) {
        setMin(0);
      }
    }
    if (min2 === max2) {
      let offset2 = max2 === 0 ? 1 : Math.abs(max2 * 0.05);
      setMax(max2 + offset2);
      if (!beginAtZero) {
        setMin(min2 - offset2);
      }
    }
    this.min = min2;
    this.max = max2;
  }
  getTickLimit() {
    const tickOpts = this.options.ticks;
    let { maxTicksLimit, stepSize } = tickOpts;
    let maxTicks;
    if (stepSize) {
      maxTicks = Math.ceil(this.max / stepSize) - Math.floor(this.min / stepSize) + 1;
      if (maxTicks > 1e3) {
        console.warn(`scales.${this.id}.ticks.stepSize: ${stepSize} would result generating up to ${maxTicks} ticks. Limiting to 1000.`);
        maxTicks = 1e3;
      }
    } else {
      maxTicks = this.computeTickLimit();
      maxTicksLimit = maxTicksLimit || 11;
    }
    if (maxTicksLimit) {
      maxTicks = Math.min(maxTicksLimit, maxTicks);
    }
    return maxTicks;
  }
  computeTickLimit() {
    return Number.POSITIVE_INFINITY;
  }
  buildTicks() {
    const opts2 = this.options;
    const tickOpts = opts2.ticks;
    let maxTicks = this.getTickLimit();
    maxTicks = Math.max(2, maxTicks);
    const numericGeneratorOptions = {
      maxTicks,
      bounds: opts2.bounds,
      min: opts2.min,
      max: opts2.max,
      precision: tickOpts.precision,
      step: tickOpts.stepSize,
      count: tickOpts.count,
      maxDigits: this._maxDigits(),
      horizontal: this.isHorizontal(),
      minRotation: tickOpts.minRotation || 0,
      includeBounds: tickOpts.includeBounds !== false
    };
    const dataRange = this._range || this;
    const ticks = generateTicks$1(numericGeneratorOptions, dataRange);
    if (opts2.bounds === "ticks") {
      _setMinAndMaxByKey(ticks, this, "value");
    }
    if (opts2.reverse) {
      ticks.reverse();
      this.start = this.max;
      this.end = this.min;
    } else {
      this.start = this.min;
      this.end = this.max;
    }
    return ticks;
  }
  configure() {
    const ticks = this.ticks;
    let start = this.min;
    let end = this.max;
    super.configure();
    if (this.options.offset && ticks.length) {
      const offset2 = (end - start) / Math.max(ticks.length - 1, 1) / 2;
      start -= offset2;
      end += offset2;
    }
    this._startValue = start;
    this._endValue = end;
    this._valueRange = end - start;
  }
  getLabelForValue(value2) {
    return formatNumber(value2, this.chart.options.locale, this.options.ticks.format);
  }
}
class LinearScale extends LinearScaleBase {
  determineDataLimits() {
    const { min: min2, max: max2 } = this.getMinMax(true);
    this.min = isNumberFinite(min2) ? min2 : 0;
    this.max = isNumberFinite(max2) ? max2 : 1;
    this.handleTickRangeOptions();
  }
  computeTickLimit() {
    const horizontal = this.isHorizontal();
    const length2 = horizontal ? this.width : this.height;
    const minRotation = toRadians(this.options.ticks.minRotation);
    const ratio = (horizontal ? Math.sin(minRotation) : Math.cos(minRotation)) || 1e-3;
    const tickFont = this._resolveTickFontOptions(0);
    return Math.ceil(length2 / Math.min(40, tickFont.lineHeight / ratio));
  }
  getPixelForValue(value2) {
    return value2 === null ? NaN : this.getPixelForDecimal((value2 - this._startValue) / this._valueRange);
  }
  getValueForPixel(pixel) {
    return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;
  }
}
__publicField(LinearScale, "id", "linear");
__publicField(LinearScale, "defaults", {
  ticks: {
    callback: Ticks.formatters.numeric
  }
});
const INTERVALS = {
  millisecond: {
    common: true,
    size: 1,
    steps: 1e3
  },
  second: {
    common: true,
    size: 1e3,
    steps: 60
  },
  minute: {
    common: true,
    size: 6e4,
    steps: 60
  },
  hour: {
    common: true,
    size: 36e5,
    steps: 24
  },
  day: {
    common: true,
    size: 864e5,
    steps: 30
  },
  week: {
    common: false,
    size: 6048e5,
    steps: 4
  },
  month: {
    common: true,
    size: 2628e6,
    steps: 12
  },
  quarter: {
    common: false,
    size: 7884e6,
    steps: 4
  },
  year: {
    common: true,
    size: 3154e7
  }
};
const UNITS = /* @__PURE__ */ Object.keys(INTERVALS);
function sorter(a2, b2) {
  return a2 - b2;
}
function parse$1(scale2, input2) {
  if (isNullOrUndef(input2)) {
    return null;
  }
  const adapter = scale2._adapter;
  const { parser, round: round2, isoWeekday } = scale2._parseOpts;
  let value2 = input2;
  if (typeof parser === "function") {
    value2 = parser(value2);
  }
  if (!isNumberFinite(value2)) {
    value2 = typeof parser === "string" ? adapter.parse(value2, parser) : adapter.parse(value2);
  }
  if (value2 === null) {
    return null;
  }
  if (round2) {
    value2 = round2 === "week" && (isNumber$2(isoWeekday) || isoWeekday === true) ? adapter.startOf(value2, "isoWeek", isoWeekday) : adapter.startOf(value2, round2);
  }
  return +value2;
}
function determineUnitForAutoTicks(minUnit, min2, max2, capacity) {
  const ilen = UNITS.length;
  for (let i2 = UNITS.indexOf(minUnit); i2 < ilen - 1; ++i2) {
    const interval = INTERVALS[UNITS[i2]];
    const factor = interval.steps ? interval.steps : Number.MAX_SAFE_INTEGER;
    if (interval.common && Math.ceil((max2 - min2) / (factor * interval.size)) <= capacity) {
      return UNITS[i2];
    }
  }
  return UNITS[ilen - 1];
}
function determineUnitForFormatting(scale2, numTicks, minUnit, min2, max2) {
  for (let i2 = UNITS.length - 1; i2 >= UNITS.indexOf(minUnit); i2--) {
    const unit2 = UNITS[i2];
    if (INTERVALS[unit2].common && scale2._adapter.diff(max2, min2, unit2) >= numTicks - 1) {
      return unit2;
    }
  }
  return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
}
function determineMajorUnit(unit2) {
  for (let i2 = UNITS.indexOf(unit2) + 1, ilen = UNITS.length; i2 < ilen; ++i2) {
    if (INTERVALS[UNITS[i2]].common) {
      return UNITS[i2];
    }
  }
}
function addTick(ticks, time2, timestamps) {
  if (!timestamps) {
    ticks[time2] = true;
  } else if (timestamps.length) {
    const { lo, hi: hi2 } = _lookup(timestamps, time2);
    const timestamp = timestamps[lo] >= time2 ? timestamps[lo] : timestamps[hi2];
    ticks[timestamp] = true;
  }
}
function setMajorTicks(scale2, ticks, map2, majorUnit) {
  const adapter = scale2._adapter;
  const first = +adapter.startOf(ticks[0].value, majorUnit);
  const last = ticks[ticks.length - 1].value;
  let major, index2;
  for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {
    index2 = map2[major];
    if (index2 >= 0) {
      ticks[index2].major = true;
    }
  }
  return ticks;
}
function ticksFromTimestamps(scale2, values, majorUnit) {
  const ticks = [];
  const map2 = {};
  const ilen = values.length;
  let i2, value2;
  for (i2 = 0; i2 < ilen; ++i2) {
    value2 = values[i2];
    map2[value2] = i2;
    ticks.push({
      value: value2,
      major: false
    });
  }
  return ilen === 0 || !majorUnit ? ticks : setMajorTicks(scale2, ticks, map2, majorUnit);
}
class TimeScale extends Scale {
  constructor(props) {
    super(props);
    this._cache = {
      data: [],
      labels: [],
      all: []
    };
    this._unit = "day";
    this._majorUnit = void 0;
    this._offsets = {};
    this._normalized = false;
    this._parseOpts = void 0;
  }
  init(scaleOpts, opts2 = {}) {
    const time2 = scaleOpts.time || (scaleOpts.time = {});
    const adapter = this._adapter = new adapters$1._date(scaleOpts.adapters.date);
    adapter.init(opts2);
    mergeIf(time2.displayFormats, adapter.formats());
    this._parseOpts = {
      parser: time2.parser,
      round: time2.round,
      isoWeekday: time2.isoWeekday
    };
    super.init(scaleOpts);
    this._normalized = opts2.normalized;
  }
  parse(raw, index2) {
    if (raw === void 0) {
      return null;
    }
    return parse$1(this, raw);
  }
  beforeLayout() {
    super.beforeLayout();
    this._cache = {
      data: [],
      labels: [],
      all: []
    };
  }
  determineDataLimits() {
    const options = this.options;
    const adapter = this._adapter;
    const unit2 = options.time.unit || "day";
    let { min: min2, max: max2, minDefined, maxDefined } = this.getUserBounds();
    function _applyBounds(bounds2) {
      if (!minDefined && !isNaN(bounds2.min)) {
        min2 = Math.min(min2, bounds2.min);
      }
      if (!maxDefined && !isNaN(bounds2.max)) {
        max2 = Math.max(max2, bounds2.max);
      }
    }
    if (!minDefined || !maxDefined) {
      _applyBounds(this._getLabelBounds());
      if (options.bounds !== "ticks" || options.ticks.source !== "labels") {
        _applyBounds(this.getMinMax(false));
      }
    }
    min2 = isNumberFinite(min2) && !isNaN(min2) ? min2 : +adapter.startOf(Date.now(), unit2);
    max2 = isNumberFinite(max2) && !isNaN(max2) ? max2 : +adapter.endOf(Date.now(), unit2) + 1;
    this.min = Math.min(min2, max2 - 1);
    this.max = Math.max(min2 + 1, max2);
  }
  _getLabelBounds() {
    const arr = this.getLabelTimestamps();
    let min2 = Number.POSITIVE_INFINITY;
    let max2 = Number.NEGATIVE_INFINITY;
    if (arr.length) {
      min2 = arr[0];
      max2 = arr[arr.length - 1];
    }
    return {
      min: min2,
      max: max2
    };
  }
  buildTicks() {
    const options = this.options;
    const timeOpts = options.time;
    const tickOpts = options.ticks;
    const timestamps = tickOpts.source === "labels" ? this.getLabelTimestamps() : this._generate();
    if (options.bounds === "ticks" && timestamps.length) {
      this.min = this._userMin || timestamps[0];
      this.max = this._userMax || timestamps[timestamps.length - 1];
    }
    const min2 = this.min;
    const max2 = this.max;
    const ticks = _filterBetween(timestamps, min2, max2);
    this._unit = timeOpts.unit || (tickOpts.autoSkip ? determineUnitForAutoTicks(timeOpts.minUnit, this.min, this.max, this._getLabelCapacity(min2)) : determineUnitForFormatting(this, ticks.length, timeOpts.minUnit, this.min, this.max));
    this._majorUnit = !tickOpts.major.enabled || this._unit === "year" ? void 0 : determineMajorUnit(this._unit);
    this.initOffsets(timestamps);
    if (options.reverse) {
      ticks.reverse();
    }
    return ticksFromTimestamps(this, ticks, this._majorUnit);
  }
  afterAutoSkip() {
    if (this.options.offsetAfterAutoskip) {
      this.initOffsets(this.ticks.map((tick) => +tick.value));
    }
  }
  initOffsets(timestamps = []) {
    let start = 0;
    let end = 0;
    let first, last;
    if (this.options.offset && timestamps.length) {
      first = this.getDecimalForValue(timestamps[0]);
      if (timestamps.length === 1) {
        start = 1 - first;
      } else {
        start = (this.getDecimalForValue(timestamps[1]) - first) / 2;
      }
      last = this.getDecimalForValue(timestamps[timestamps.length - 1]);
      if (timestamps.length === 1) {
        end = last;
      } else {
        end = (last - this.getDecimalForValue(timestamps[timestamps.length - 2])) / 2;
      }
    }
    const limit2 = timestamps.length < 3 ? 0.5 : 0.25;
    start = _limitValue(start, 0, limit2);
    end = _limitValue(end, 0, limit2);
    this._offsets = {
      start,
      end,
      factor: 1 / (start + 1 + end)
    };
  }
  _generate() {
    const adapter = this._adapter;
    const min2 = this.min;
    const max2 = this.max;
    const options = this.options;
    const timeOpts = options.time;
    const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min2, max2, this._getLabelCapacity(min2));
    const stepSize = valueOrDefault(options.ticks.stepSize, 1);
    const weekday = minor === "week" ? timeOpts.isoWeekday : false;
    const hasWeekday = isNumber$2(weekday) || weekday === true;
    const ticks = {};
    let first = min2;
    let time2, count;
    if (hasWeekday) {
      first = +adapter.startOf(first, "isoWeek", weekday);
    }
    first = +adapter.startOf(first, hasWeekday ? "day" : minor);
    if (adapter.diff(max2, min2, minor) > 1e5 * stepSize) {
      throw new Error(min2 + " and " + max2 + " are too far apart with stepSize of " + stepSize + " " + minor);
    }
    const timestamps = options.ticks.source === "data" && this.getDataTimestamps();
    for (time2 = first, count = 0; time2 < max2; time2 = +adapter.add(time2, stepSize, minor), count++) {
      addTick(ticks, time2, timestamps);
    }
    if (time2 === max2 || options.bounds === "ticks" || count === 1) {
      addTick(ticks, time2, timestamps);
    }
    return Object.keys(ticks).sort(sorter).map((x2) => +x2);
  }
  getLabelForValue(value2) {
    const adapter = this._adapter;
    const timeOpts = this.options.time;
    if (timeOpts.tooltipFormat) {
      return adapter.format(value2, timeOpts.tooltipFormat);
    }
    return adapter.format(value2, timeOpts.displayFormats.datetime);
  }
  format(value2, format2) {
    const options = this.options;
    const formats = options.time.displayFormats;
    const unit2 = this._unit;
    const fmt = format2 || formats[unit2];
    return this._adapter.format(value2, fmt);
  }
  _tickFormatFunction(time2, index2, ticks, format2) {
    const options = this.options;
    const formatter = options.ticks.callback;
    if (formatter) {
      return callback(formatter, [
        time2,
        index2,
        ticks
      ], this);
    }
    const formats = options.time.displayFormats;
    const unit2 = this._unit;
    const majorUnit = this._majorUnit;
    const minorFormat = unit2 && formats[unit2];
    const majorFormat = majorUnit && formats[majorUnit];
    const tick = ticks[index2];
    const major = majorUnit && majorFormat && tick && tick.major;
    return this._adapter.format(time2, format2 || (major ? majorFormat : minorFormat));
  }
  generateTickLabels(ticks) {
    let i2, ilen, tick;
    for (i2 = 0, ilen = ticks.length; i2 < ilen; ++i2) {
      tick = ticks[i2];
      tick.label = this._tickFormatFunction(tick.value, i2, ticks);
    }
  }
  getDecimalForValue(value2) {
    return value2 === null ? NaN : (value2 - this.min) / (this.max - this.min);
  }
  getPixelForValue(value2) {
    const offsets = this._offsets;
    const pos = this.getDecimalForValue(value2);
    return this.getPixelForDecimal((offsets.start + pos) * offsets.factor);
  }
  getValueForPixel(pixel) {
    const offsets = this._offsets;
    const pos = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
    return this.min + pos * (this.max - this.min);
  }
  _getLabelSize(label) {
    const ticksOpts = this.options.ticks;
    const tickLabelWidth = this.ctx.measureText(label).width;
    const angle = toRadians(this.isHorizontal() ? ticksOpts.maxRotation : ticksOpts.minRotation);
    const cosRotation = Math.cos(angle);
    const sinRotation = Math.sin(angle);
    const tickFontSize = this._resolveTickFontOptions(0).size;
    return {
      w: tickLabelWidth * cosRotation + tickFontSize * sinRotation,
      h: tickLabelWidth * sinRotation + tickFontSize * cosRotation
    };
  }
  _getLabelCapacity(exampleTime) {
    const timeOpts = this.options.time;
    const displayFormats = timeOpts.displayFormats;
    const format2 = displayFormats[timeOpts.unit] || displayFormats.millisecond;
    const exampleLabel = this._tickFormatFunction(exampleTime, 0, ticksFromTimestamps(this, [
      exampleTime
    ], this._majorUnit), format2);
    const size2 = this._getLabelSize(exampleLabel);
    const capacity = Math.floor(this.isHorizontal() ? this.width / size2.w : this.height / size2.h) - 1;
    return capacity > 0 ? capacity : 1;
  }
  getDataTimestamps() {
    let timestamps = this._cache.data || [];
    let i2, ilen;
    if (timestamps.length) {
      return timestamps;
    }
    const metas = this.getMatchingVisibleMetas();
    if (this._normalized && metas.length) {
      return this._cache.data = metas[0].controller.getAllParsedValues(this);
    }
    for (i2 = 0, ilen = metas.length; i2 < ilen; ++i2) {
      timestamps = timestamps.concat(metas[i2].controller.getAllParsedValues(this));
    }
    return this._cache.data = this.normalize(timestamps);
  }
  getLabelTimestamps() {
    const timestamps = this._cache.labels || [];
    let i2, ilen;
    if (timestamps.length) {
      return timestamps;
    }
    const labels = this.getLabels();
    for (i2 = 0, ilen = labels.length; i2 < ilen; ++i2) {
      timestamps.push(parse$1(this, labels[i2]));
    }
    return this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps);
  }
  normalize(values) {
    return _arrayUnique(values.sort(sorter));
  }
}
__publicField(TimeScale, "id", "time");
__publicField(TimeScale, "defaults", {
  bounds: "data",
  adapters: {},
  time: {
    parser: false,
    unit: false,
    round: false,
    isoWeekday: false,
    minUnit: "millisecond",
    displayFormats: {}
  },
  ticks: {
    source: "auto",
    callback: false,
    major: {
      enabled: false
    }
  }
});
function interpolate(table2, val, reverse) {
  let lo = 0;
  let hi2 = table2.length - 1;
  let prevSource, nextSource, prevTarget, nextTarget;
  if (reverse) {
    if (val >= table2[lo].pos && val <= table2[hi2].pos) {
      ({ lo, hi: hi2 } = _lookupByKey(table2, "pos", val));
    }
    ({ pos: prevSource, time: prevTarget } = table2[lo]);
    ({ pos: nextSource, time: nextTarget } = table2[hi2]);
  } else {
    if (val >= table2[lo].time && val <= table2[hi2].time) {
      ({ lo, hi: hi2 } = _lookupByKey(table2, "time", val));
    }
    ({ time: prevSource, pos: prevTarget } = table2[lo]);
    ({ time: nextSource, pos: nextTarget } = table2[hi2]);
  }
  const span = nextSource - prevSource;
  return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;
}
class TimeSeriesScale extends TimeScale {
  constructor(props) {
    super(props);
    this._table = [];
    this._minPos = void 0;
    this._tableRange = void 0;
  }
  initOffsets() {
    const timestamps = this._getTimestampsForTable();
    const table2 = this._table = this.buildLookupTable(timestamps);
    this._minPos = interpolate(table2, this.min);
    this._tableRange = interpolate(table2, this.max) - this._minPos;
    super.initOffsets(timestamps);
  }
  buildLookupTable(timestamps) {
    const { min: min2, max: max2 } = this;
    const items = [];
    const table2 = [];
    let i2, ilen, prev2, curr, next2;
    for (i2 = 0, ilen = timestamps.length; i2 < ilen; ++i2) {
      curr = timestamps[i2];
      if (curr >= min2 && curr <= max2) {
        items.push(curr);
      }
    }
    if (items.length < 2) {
      return [
        {
          time: min2,
          pos: 0
        },
        {
          time: max2,
          pos: 1
        }
      ];
    }
    for (i2 = 0, ilen = items.length; i2 < ilen; ++i2) {
      next2 = items[i2 + 1];
      prev2 = items[i2 - 1];
      curr = items[i2];
      if (Math.round((next2 + prev2) / 2) !== curr) {
        table2.push({
          time: curr,
          pos: i2 / (ilen - 1)
        });
      }
    }
    return table2;
  }
  _generate() {
    const min2 = this.min;
    const max2 = this.max;
    let timestamps = super.getDataTimestamps();
    if (!timestamps.includes(min2) || !timestamps.length) {
      timestamps.splice(0, 0, min2);
    }
    if (!timestamps.includes(max2) || timestamps.length === 1) {
      timestamps.push(max2);
    }
    return timestamps.sort((a2, b2) => a2 - b2);
  }
  _getTimestampsForTable() {
    let timestamps = this._cache.all || [];
    if (timestamps.length) {
      return timestamps;
    }
    const data = this.getDataTimestamps();
    const label = this.getLabelTimestamps();
    if (data.length && label.length) {
      timestamps = this.normalize(data.concat(label));
    } else {
      timestamps = data.length ? data : label;
    }
    timestamps = this._cache.all = timestamps;
    return timestamps;
  }
  getDecimalForValue(value2) {
    return (interpolate(this._table, value2) - this._minPos) / this._tableRange;
  }
  getValueForPixel(pixel) {
    const offsets = this._offsets;
    const decimal = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
    return interpolate(this._table, decimal * this._tableRange + this._minPos, true);
  }
}
__publicField(TimeSeriesScale, "id", "timeseries");
__publicField(TimeSeriesScale, "defaults", TimeScale.defaults);
const defaultDatasetIdKey = "label";
function reforwardRef(ref, value2) {
  if (typeof ref === "function") {
    ref(value2);
  } else if (ref) {
    ref.current = value2;
  }
}
function setOptions(chart, nextOptions) {
  const options = chart.options;
  if (options && nextOptions) {
    Object.assign(options, nextOptions);
  }
}
function setLabels(currentData, nextLabels) {
  currentData.labels = nextLabels;
}
function setDatasets(currentData, nextDatasets) {
  let datasetIdKey = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : defaultDatasetIdKey;
  const addedDatasets = [];
  currentData.datasets = nextDatasets.map((nextDataset) => {
    const currentDataset = currentData.datasets.find((dataset) => dataset[datasetIdKey] === nextDataset[datasetIdKey]);
    if (!currentDataset || !nextDataset.data || addedDatasets.includes(currentDataset)) {
      return {
        ...nextDataset
      };
    }
    addedDatasets.push(currentDataset);
    Object.assign(currentDataset, nextDataset);
    return currentDataset;
  });
}
function cloneData(data) {
  let datasetIdKey = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultDatasetIdKey;
  const nextData = {
    labels: [],
    datasets: []
  };
  setLabels(nextData, data.labels);
  setDatasets(nextData, data.datasets, datasetIdKey);
  return nextData;
}
function ChartComponent(props, ref) {
  const { height = 150, width = 300, redraw = false, datasetIdKey, type: type4, data, options, plugins = [], fallbackContent, updateMode, ...canvasProps } = props;
  const canvasRef = reactExports.useRef(null);
  const chartRef = reactExports.useRef(null);
  const renderChart = () => {
    if (!canvasRef.current)
      return;
    chartRef.current = new Chart$1(canvasRef.current, {
      type: type4,
      data: cloneData(data, datasetIdKey),
      options: options && {
        ...options
      },
      plugins
    });
    reforwardRef(ref, chartRef.current);
  };
  const destroyChart = () => {
    reforwardRef(ref, null);
    if (chartRef.current) {
      chartRef.current.destroy();
      chartRef.current = null;
    }
  };
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current && options) {
      setOptions(chartRef.current, options);
    }
  }, [
    redraw,
    options
  ]);
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current) {
      setLabels(chartRef.current.config.data, data.labels);
    }
  }, [
    redraw,
    data.labels
  ]);
  reactExports.useEffect(() => {
    if (!redraw && chartRef.current && data.datasets) {
      setDatasets(chartRef.current.config.data, data.datasets, datasetIdKey);
    }
  }, [
    redraw,
    data.datasets
  ]);
  reactExports.useEffect(() => {
    if (!chartRef.current)
      return;
    if (redraw) {
      destroyChart();
      setTimeout(renderChart);
    } else {
      chartRef.current.update(updateMode);
    }
  }, [
    redraw,
    options,
    data.labels,
    data.datasets,
    updateMode
  ]);
  reactExports.useEffect(() => {
    if (!chartRef.current)
      return;
    destroyChart();
    setTimeout(renderChart);
  }, [
    type4
  ]);
  reactExports.useEffect(() => {
    renderChart();
    return () => destroyChart();
  }, []);
  return /* @__PURE__ */ React$6.createElement("canvas", {
    ref: canvasRef,
    role: "img",
    height,
    width,
    ...canvasProps
  }, fallbackContent);
}
const Chart = /* @__PURE__ */ reactExports.forwardRef(ChartComponent);
function createTypedChart(type4, registerables) {
  Chart$1.register(registerables);
  return /* @__PURE__ */ reactExports.forwardRef((props, ref) => /* @__PURE__ */ React$6.createElement(Chart, {
    ...props,
    ref,
    type: type4
  }));
}
const Line = /* @__PURE__ */ createTypedChart("line", LineController);
const Bar = /* @__PURE__ */ createTypedChart("bar", BarController);
const useResourceSearch = () => {
  const [resources, setResources] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const [loadingDetails, setLoadingDetails] = reactExports.useState(false);
  const [response, setResponse] = reactExports.useState();
  const searchIdRef = reactExports.useRef(0);
  const resourcesRef = reactExports.useRef(resources);
  resourcesRef.current = resources;
  const search2 = reactExports.useCallback(
    async (form2, options) => {
      const currentSearchId = ++searchIdRef.current;
      const mode = (options == null ? void 0 : options.mode) ?? "replace";
      const filter3 = options == null ? void 0 : options.filter;
      setLoading(true);
      setLoadingDetails(false);
      if (mode === "replace") {
        setResources([]);
      }
      try {
        const rsp = await BApi$1.resource.searchResources(form2, {
          additionalItems: ResourceAdditionalItem.Cache,
          saveSearch: options == null ? void 0 : options.saveSearch,
          searchId: options == null ? void 0 : options.searchId
        });
        if (currentSearchId !== searchIdRef.current) {
          return [];
        }
        let basicResources = rsp.data || [];
        console.log("[useResourceSearch] Phase 1 (Cache) loaded", basicResources.length, "resources. Sample properties:", basicResources.slice(0, 3).map((r2) => {
          var _a2;
          return { id: r2.id, hasProperties: !!r2.properties, propertyKeys: r2.properties ? Object.keys(r2.properties) : [], mediaLibraries: r2.mediaLibraries, category: (_a2 = r2.category) == null ? void 0 : _a2.name };
        }));
        if (filter3) {
          basicResources = filter3(basicResources);
        }
        setResources((prev2) => {
          switch (mode) {
            case "append":
              return [...prev2, ...basicResources];
            case "prepend":
              return [...basicResources, ...prev2];
            default:
              return basicResources;
          }
        });
        setResponse({
          pageIndex: rsp.pageIndex,
          pageSize: rsp.pageSize,
          totalCount: rsp.totalCount
        });
        setLoading(false);
        if (basicResources.length > 0) {
          setLoadingDetails(true);
          const ids2 = basicResources.map((r2) => r2.id);
          const fullRsp = await BApi$1.resource.getResourcesByKeys({
            ids: ids2,
            additionalItems: ResourceAdditionalItem.All
          });
          if (currentSearchId !== searchIdRef.current) {
            console.log("[useResourceSearch] Phase 2 aborted: searchId mismatch", currentSearchId, "!==", searchIdRef.current);
            return [];
          }
          if (!fullRsp.code) {
            let fullResources = fullRsp.data || [];
            console.log("[useResourceSearch] Phase 2 (All) loaded", fullResources.length, "resources. Sample properties:", fullResources.slice(0, 3).map((r2) => {
              var _a2;
              return { id: r2.id, hasProperties: !!r2.properties, propertyPools: r2.properties ? Object.keys(r2.properties).map((pool) => ({ pool, propIds: Object.keys(r2.properties[pool] || {}) })) : [], mediaLibraries: r2.mediaLibraries, category: (_a2 = r2.category) == null ? void 0 : _a2.name };
            }));
            if (filter3) {
              fullResources = filter3(fullResources);
            }
            const fullResourcesMap = new Map(fullResources.map((r2) => [r2.id, r2]));
            setResources((prev2) => {
              const next2 = prev2.map((r2) => fullResourcesMap.get(r2.id) ?? r2);
              console.log("[useResourceSearch] Phase 2 setResources: prev refs === next refs?", prev2.map((r2, i2) => r2 === next2[i2]));
              return next2;
            });
            setLoadingDetails(false);
            return fullResources;
          }
          console.log("[useResourceSearch] Phase 2 API error, code:", fullRsp.code, "message:", fullRsp.message);
          setLoadingDetails(false);
        }
        return basicResources;
      } catch (error2) {
        if (currentSearchId === searchIdRef.current) {
          setLoading(false);
          setLoadingDetails(false);
        }
        throw error2;
      }
    },
    []
  );
  const reloadResources = reactExports.useCallback(async (ids2) => {
    const rsp = await BApi$1.resource.getResourcesByKeys({
      ids: ids2,
      additionalItems: ResourceAdditionalItem.All
    });
    if (!rsp.code && rsp.data) {
      const updatedResources = rsp.data;
      const updatedMap = new Map(updatedResources.map((r2) => [r2.id, r2]));
      setResources(
        (prev2) => prev2.map((r2) => updatedMap.get(r2.id) ?? r2)
      );
    }
  }, []);
  return {
    resources,
    loading,
    loadingDetails,
    response,
    search: search2,
    setResources,
    reloadResources
  };
};
const progressiveSearch = async (searchParams, setState, filter3) => {
  const quickRes = await BApi$1.resource.searchResources(searchParams, {
    additionalItems: ResourceAdditionalItem.Cache
  });
  let basicResources = quickRes.data ?? [];
  if (filter3) {
    basicResources = filter3(basicResources);
  }
  setState(basicResources);
  if (basicResources.length > 0) {
    const ids2 = basicResources.map((r2) => r2.id);
    const fullRes = await BApi$1.resource.getResourcesByKeys({
      ids: ids2,
      additionalItems: ResourceAdditionalItem.All
    });
    let fullResources = fullRes.data ?? [];
    if (filter3) {
      fullResources = filter3(fullResources);
    }
    setState(fullResources);
    return fullResources;
  }
  return basicResources;
};
function _extends$1() {
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
    for (var i2 = 1; i2 < arguments.length; i2++) {
      var source2 = arguments[i2];
      for (var key in source2) {
        if (Object.prototype.hasOwnProperty.call(source2, key)) {
          target[key] = source2[key];
        }
      }
    }
    return target;
  };
  return _extends$1.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source2, excluded) {
  if (source2 == null)
    return {};
  var target = {};
  var sourceKeys = Object.keys(source2);
  var key, i2;
  for (i2 = 0; i2 < sourceKeys.length; i2++) {
    key = sourceKeys[i2];
    if (excluded.indexOf(key) >= 0)
      continue;
    target[key] = source2[key];
  }
  return target;
}
var isMenuOpen = function isMenuOpen2(state) {
  return !!state && state[0] === "o";
};
var batchedUpdates = reactDomExports.unstable_batchedUpdates || function(callback2) {
  return callback2();
};
var floatEqual = function floatEqual2(a2, b2, diff2) {
  if (diff2 === void 0) {
    diff2 = 1e-4;
  }
  return Math.abs(a2 - b2) < diff2;
};
var getTransition = function getTransition2(transition3, name2) {
  return transition3 === true || !!(transition3 && transition3[name2]);
};
var safeCall = function safeCall2(fn, arg) {
  return typeof fn === "function" ? fn(arg) : fn;
};
var mergeProps = function mergeProps2(target, source2) {
  source2 && Object.keys(source2).forEach(function(key) {
    var targetProp = target[key];
    var sourceProp = source2[key];
    if (typeof sourceProp === "function" && targetProp) {
      target[key] = function() {
        sourceProp.apply(void 0, arguments);
        targetProp.apply(void 0, arguments);
      };
    } else {
      target[key] = sourceProp;
    }
  });
  return target;
};
var parsePadding = function parsePadding2(paddingStr) {
  if (typeof paddingStr !== "string")
    return {
      top: 0,
      right: 0,
      bottom: 0,
      left: 0
    };
  var padding = paddingStr.trim().split(/\s+/, 4).map(parseFloat);
  var top2 = !isNaN(padding[0]) ? padding[0] : 0;
  var right = !isNaN(padding[1]) ? padding[1] : top2;
  return {
    top: top2,
    right,
    bottom: !isNaN(padding[2]) ? padding[2] : top2,
    left: !isNaN(padding[3]) ? padding[3] : right
  };
};
var getScrollAncestor = function getScrollAncestor2(node2) {
  while (node2) {
    node2 = node2.parentNode;
    if (!node2 || node2 === document.body || !node2.parentNode)
      return;
    var _getComputedStyle = getComputedStyle(node2), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
    if (/auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX))
      return node2;
  }
};
function commonProps(isDisabled, isHovering) {
  return {
    "aria-disabled": isDisabled || void 0,
    tabIndex: isHovering ? 0 : -1
  };
}
function indexOfNode(nodeList, node2) {
  for (var i2 = 0; i2 < nodeList.length; i2++) {
    if (nodeList[i2] === node2)
      return i2;
  }
  return -1;
}
var useBEM = function useBEM2(_ref) {
  var block = _ref.block, element2 = _ref.element, modifiers = _ref.modifiers, className = _ref.className;
  return reactExports.useMemo(function() {
    var blockElement = element2 ? block + "__" + element2 : block;
    var classString = blockElement;
    modifiers && Object.keys(modifiers).forEach(function(name2) {
      var value2 = modifiers[name2];
      if (value2)
        classString += " " + blockElement + "--" + (value2 === true ? name2 : name2 + "-" + value2);
    });
    var expandedClassName = typeof className === "function" ? className(modifiers) : className;
    if (typeof expandedClassName === "string") {
      expandedClassName = expandedClassName.trim();
      if (expandedClassName)
        classString += " " + expandedClassName;
    }
    return classString;
  }, [block, element2, modifiers, className]);
};
var menuContainerClass = "szh-menu-container";
var menuClass = "szh-menu";
var menuArrowClass = "arrow";
var menuItemClass = "item";
var HoverItemContext = /* @__PURE__ */ reactExports.createContext();
var MenuListItemContext = /* @__PURE__ */ reactExports.createContext({});
var MenuListContext = /* @__PURE__ */ reactExports.createContext({});
var EventHandlersContext = /* @__PURE__ */ reactExports.createContext({});
var RadioGroupContext = /* @__PURE__ */ reactExports.createContext({});
var SettingsContext = /* @__PURE__ */ reactExports.createContext({});
var Keys = /* @__PURE__ */ Object.freeze({
  ENTER: "Enter",
  ESC: "Escape",
  SPACE: " ",
  HOME: "Home",
  END: "End",
  LEFT: "ArrowLeft",
  RIGHT: "ArrowRight",
  UP: "ArrowUp",
  DOWN: "ArrowDown"
});
var HoverActionTypes = /* @__PURE__ */ Object.freeze({
  RESET: 0,
  SET: 1,
  UNSET: 2,
  INCREASE: 3,
  DECREASE: 4,
  FIRST: 5,
  LAST: 6,
  SET_INDEX: 7
});
var CloseReason = /* @__PURE__ */ Object.freeze({
  CLICK: "click",
  CANCEL: "cancel",
  BLUR: "blur",
  SCROLL: "scroll"
});
var FocusPositions = /* @__PURE__ */ Object.freeze({
  FIRST: "first",
  LAST: "last"
});
var MenuStateMap = /* @__PURE__ */ Object.freeze({
  entering: "opening",
  entered: "open",
  exiting: "closing",
  exited: "closed"
});
var positionAbsolute = "absolute";
var roleNone = "presentation";
var roleMenuitem = "menuitem";
var dummyItemProps = {
  "aria-hidden": true,
  role: roleMenuitem
};
var MenuContainer = function MenuContainer2(_ref) {
  var className = _ref.className, containerRef = _ref.containerRef, containerProps = _ref.containerProps, children = _ref.children, isOpen = _ref.isOpen, skipOpen = _ref.skipOpen, theming = _ref.theming, transition3 = _ref.transition, onClose = _ref.onClose;
  var itemTransition = getTransition(transition3, "item");
  var onKeyDown = function onKeyDown2(_ref2) {
    var key = _ref2.key;
    switch (key) {
      case Keys.ESC:
        safeCall(onClose, {
          key,
          reason: CloseReason.CANCEL
        });
        break;
    }
  };
  var onBlur = function onBlur2(e2) {
    if (isOpen && !e2.currentTarget.contains(e2.relatedTarget || document.activeElement)) {
      safeCall(onClose, {
        reason: CloseReason.BLUR
      });
      if (skipOpen) {
        skipOpen.current = true;
        setTimeout(function() {
          return skipOpen.current = false;
        }, 300);
      }
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", _extends$1({}, mergeProps({
    onKeyDown,
    onBlur
  }, containerProps), {
    className: useBEM({
      block: menuContainerClass,
      modifiers: reactExports.useMemo(function() {
        return {
          theme: theming,
          itemTransition
        };
      }, [theming, itemTransition]),
      className
    }),
    style: _extends$1({
      position: "absolute"
    }, containerProps == null ? void 0 : containerProps.style),
    ref: containerRef,
    children
  }));
};
var createSubmenuCtx = function createSubmenuCtx2() {
  var timer, count = 0;
  return {
    toggle: function toggle2(isOpen) {
      isOpen ? count++ : count--;
      count = Math.max(count, 0);
    },
    on: function on2(closeDelay, pending, settled) {
      if (count) {
        if (!timer)
          timer = setTimeout(function() {
            timer = 0;
            pending();
          }, closeDelay);
      } else {
        settled == null ? void 0 : settled();
      }
    },
    off: function off() {
      if (timer) {
        clearTimeout(timer);
        timer = 0;
      }
    }
  };
};
var useItems = function useItems2(menuRef, focusRef) {
  var _useState = reactExports.useState(), hoverItem = _useState[0], setHoverItem = _useState[1];
  var stateRef = reactExports.useRef({
    items: [],
    hoverIndex: -1,
    sorted: false
  });
  var mutableState = stateRef.current;
  var updateItems = reactExports.useCallback(function(item, isMounted) {
    var items = mutableState.items;
    if (!item) {
      mutableState.items = [];
    } else if (isMounted) {
      items.push(item);
    } else {
      var index2 = items.indexOf(item);
      if (index2 > -1) {
        items.splice(index2, 1);
        if (item.contains(document.activeElement)) {
          focusRef.current.focus();
          setHoverItem();
        }
      }
    }
    mutableState.hoverIndex = -1;
    mutableState.sorted = false;
  }, [mutableState, focusRef]);
  var dispatch = reactExports.useCallback(function(actionType, item, nextIndex) {
    var items = mutableState.items, hoverIndex = mutableState.hoverIndex;
    var sortItems = function sortItems2() {
      if (mutableState.sorted)
        return;
      var orderedNodes = menuRef.current.querySelectorAll(".szh-menu__item");
      items.sort(function(a2, b2) {
        return indexOfNode(orderedNodes, a2) - indexOfNode(orderedNodes, b2);
      });
      mutableState.sorted = true;
    };
    var index2 = -1, newItem = void 0;
    switch (actionType) {
      case HoverActionTypes.RESET:
        break;
      case HoverActionTypes.SET:
        newItem = item;
        break;
      case HoverActionTypes.UNSET:
        newItem = function newItem2(prevItem) {
          return prevItem === item ? void 0 : prevItem;
        };
        break;
      case HoverActionTypes.FIRST:
        sortItems();
        index2 = 0;
        newItem = items[index2];
        break;
      case HoverActionTypes.LAST:
        sortItems();
        index2 = items.length - 1;
        newItem = items[index2];
        break;
      case HoverActionTypes.SET_INDEX:
        sortItems();
        index2 = nextIndex;
        newItem = items[index2];
        break;
      case HoverActionTypes.INCREASE:
        sortItems();
        index2 = hoverIndex;
        if (index2 < 0)
          index2 = items.indexOf(item);
        index2++;
        if (index2 >= items.length)
          index2 = 0;
        newItem = items[index2];
        break;
      case HoverActionTypes.DECREASE:
        sortItems();
        index2 = hoverIndex;
        if (index2 < 0)
          index2 = items.indexOf(item);
        index2--;
        if (index2 < 0)
          index2 = items.length - 1;
        newItem = items[index2];
        break;
    }
    if (!newItem)
      index2 = -1;
    setHoverItem(newItem);
    mutableState.hoverIndex = index2;
  }, [menuRef, mutableState]);
  return {
    hoverItem,
    dispatch,
    updateItems
  };
};
var getPositionHelpers = function getPositionHelpers2(containerRef, menuRef, menuScroll, boundingBoxPadding) {
  var menuRect = menuRef.current.getBoundingClientRect();
  var containerRect = containerRef.current.getBoundingClientRect();
  var boundingRect = menuScroll === window ? {
    left: 0,
    top: 0,
    right: document.documentElement.clientWidth,
    bottom: window.innerHeight
  } : menuScroll.getBoundingClientRect();
  var padding = parsePadding(boundingBoxPadding);
  var getLeftOverflow = function getLeftOverflow2(x2) {
    return x2 + containerRect.left - boundingRect.left - padding.left;
  };
  var getRightOverflow = function getRightOverflow2(x2) {
    return x2 + containerRect.left + menuRect.width - boundingRect.right + padding.right;
  };
  var getTopOverflow = function getTopOverflow2(y2) {
    return y2 + containerRect.top - boundingRect.top - padding.top;
  };
  var getBottomOverflow = function getBottomOverflow2(y2) {
    return y2 + containerRect.top + menuRect.height - boundingRect.bottom + padding.bottom;
  };
  var confineHorizontally = function confineHorizontally2(x2) {
    var leftOverflow = getLeftOverflow(x2);
    if (leftOverflow < 0) {
      x2 -= leftOverflow;
    } else {
      var rightOverflow = getRightOverflow(x2);
      if (rightOverflow > 0) {
        x2 -= rightOverflow;
        leftOverflow = getLeftOverflow(x2);
        if (leftOverflow < 0)
          x2 -= leftOverflow;
      }
    }
    return x2;
  };
  var confineVertically = function confineVertically2(y2) {
    var topOverflow = getTopOverflow(y2);
    if (topOverflow < 0) {
      y2 -= topOverflow;
    } else {
      var bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0) {
        y2 -= bottomOverflow;
        topOverflow = getTopOverflow(y2);
        if (topOverflow < 0)
          y2 -= topOverflow;
      }
    }
    return y2;
  };
  return {
    menuRect,
    containerRect,
    getLeftOverflow,
    getRightOverflow,
    getTopOverflow,
    getBottomOverflow,
    confineHorizontally,
    confineVertically
  };
};
var placeArrowVertical = function placeArrowVertical2(_ref) {
  var arrowRef = _ref.arrowRef, menuY = _ref.menuY, anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect;
  var y2 = anchorRect.top - containerRect.top - menuY + anchorRect.height / 2;
  var offset2 = arrowRef.current.offsetHeight * 1.25;
  y2 = Math.max(offset2, y2);
  y2 = Math.min(y2, menuRect.height - offset2);
  return y2;
};
var placeLeftorRight = function placeLeftorRight2(_ref) {
  var anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect, placeLeftorRightY = _ref.placeLeftorRightY, placeLeftX = _ref.placeLeftX, placeRightX = _ref.placeRightX, getLeftOverflow = _ref.getLeftOverflow, getRightOverflow = _ref.getRightOverflow, confineHorizontally = _ref.confineHorizontally, confineVertically = _ref.confineVertically, arrowRef = _ref.arrowRef, arrow = _ref.arrow, direction = _ref.direction, position2 = _ref.position;
  var computedDirection = direction;
  var y2 = placeLeftorRightY;
  if (position2 !== "initial") {
    y2 = confineVertically(y2);
    if (position2 === "anchor") {
      y2 = Math.min(y2, anchorRect.bottom - containerRect.top);
      y2 = Math.max(y2, anchorRect.top - containerRect.top - menuRect.height);
    }
  }
  var x2, leftOverflow, rightOverflow;
  if (computedDirection === "left") {
    x2 = placeLeftX;
    if (position2 !== "initial") {
      leftOverflow = getLeftOverflow(x2);
      if (leftOverflow < 0) {
        rightOverflow = getRightOverflow(placeRightX);
        if (rightOverflow <= 0 || -leftOverflow > rightOverflow) {
          x2 = placeRightX;
          computedDirection = "right";
        }
      }
    }
  } else {
    x2 = placeRightX;
    if (position2 !== "initial") {
      rightOverflow = getRightOverflow(x2);
      if (rightOverflow > 0) {
        leftOverflow = getLeftOverflow(placeLeftX);
        if (leftOverflow >= 0 || -leftOverflow < rightOverflow) {
          x2 = placeLeftX;
          computedDirection = "left";
        }
      }
    }
  }
  if (position2 === "auto")
    x2 = confineHorizontally(x2);
  var arrowY = arrow ? placeArrowVertical({
    menuY: y2,
    arrowRef,
    anchorRect,
    containerRect,
    menuRect
  }) : void 0;
  return {
    arrowY,
    x: x2,
    y: y2,
    computedDirection
  };
};
var placeArrowHorizontal = function placeArrowHorizontal2(_ref) {
  var arrowRef = _ref.arrowRef, menuX = _ref.menuX, anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect;
  var x2 = anchorRect.left - containerRect.left - menuX + anchorRect.width / 2;
  var offset2 = arrowRef.current.offsetWidth * 1.25;
  x2 = Math.max(offset2, x2);
  x2 = Math.min(x2, menuRect.width - offset2);
  return x2;
};
var placeToporBottom = function placeToporBottom2(_ref) {
  var anchorRect = _ref.anchorRect, containerRect = _ref.containerRect, menuRect = _ref.menuRect, placeToporBottomX = _ref.placeToporBottomX, placeTopY = _ref.placeTopY, placeBottomY = _ref.placeBottomY, getTopOverflow = _ref.getTopOverflow, getBottomOverflow = _ref.getBottomOverflow, confineHorizontally = _ref.confineHorizontally, confineVertically = _ref.confineVertically, arrowRef = _ref.arrowRef, arrow = _ref.arrow, direction = _ref.direction, position2 = _ref.position;
  var computedDirection = direction === "top" ? "top" : "bottom";
  var x2 = placeToporBottomX;
  if (position2 !== "initial") {
    x2 = confineHorizontally(x2);
    if (position2 === "anchor") {
      x2 = Math.min(x2, anchorRect.right - containerRect.left);
      x2 = Math.max(x2, anchorRect.left - containerRect.left - menuRect.width);
    }
  }
  var y2, topOverflow, bottomOverflow;
  if (computedDirection === "top") {
    y2 = placeTopY;
    if (position2 !== "initial") {
      topOverflow = getTopOverflow(y2);
      if (topOverflow < 0) {
        bottomOverflow = getBottomOverflow(placeBottomY);
        if (bottomOverflow <= 0 || -topOverflow > bottomOverflow) {
          y2 = placeBottomY;
          computedDirection = "bottom";
        }
      }
    }
  } else {
    y2 = placeBottomY;
    if (position2 !== "initial") {
      bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0) {
        topOverflow = getTopOverflow(placeTopY);
        if (topOverflow >= 0 || -topOverflow < bottomOverflow) {
          y2 = placeTopY;
          computedDirection = "top";
        }
      }
    }
  }
  if (position2 === "auto")
    y2 = confineVertically(y2);
  var arrowX = arrow ? placeArrowHorizontal({
    menuX: x2,
    arrowRef,
    anchorRect,
    containerRect,
    menuRect
  }) : void 0;
  return {
    arrowX,
    x: x2,
    y: y2,
    computedDirection
  };
};
var positionMenu = function positionMenu2(_ref) {
  var arrow = _ref.arrow, align = _ref.align, direction = _ref.direction, offsetX = _ref.offsetX, offsetY = _ref.offsetY, position2 = _ref.position, anchorRect = _ref.anchorRect, arrowRef = _ref.arrowRef, positionHelpers = _ref.positionHelpers;
  var menuRect = positionHelpers.menuRect, containerRect = positionHelpers.containerRect;
  var horizontalOffset = offsetX;
  var verticalOffset = offsetY;
  if (arrow) {
    if (direction === "left" || direction === "right") {
      horizontalOffset += arrowRef.current.offsetWidth;
    } else {
      verticalOffset += arrowRef.current.offsetHeight;
    }
  }
  var placeLeftX = anchorRect.left - containerRect.left - menuRect.width - horizontalOffset;
  var placeRightX = anchorRect.right - containerRect.left + horizontalOffset;
  var placeTopY = anchorRect.top - containerRect.top - menuRect.height - verticalOffset;
  var placeBottomY = anchorRect.bottom - containerRect.top + verticalOffset;
  var placeToporBottomX, placeLeftorRightY;
  if (align === "end") {
    placeToporBottomX = anchorRect.right - containerRect.left - menuRect.width;
    placeLeftorRightY = anchorRect.bottom - containerRect.top - menuRect.height;
  } else if (align === "center") {
    placeToporBottomX = anchorRect.left - containerRect.left - (menuRect.width - anchorRect.width) / 2;
    placeLeftorRightY = anchorRect.top - containerRect.top - (menuRect.height - anchorRect.height) / 2;
  } else {
    placeToporBottomX = anchorRect.left - containerRect.left;
    placeLeftorRightY = anchorRect.top - containerRect.top;
  }
  placeToporBottomX += horizontalOffset;
  placeLeftorRightY += verticalOffset;
  var options = _extends$1({}, positionHelpers, {
    anchorRect,
    placeLeftX,
    placeRightX,
    placeLeftorRightY,
    placeTopY,
    placeBottomY,
    placeToporBottomX,
    arrowRef,
    arrow,
    direction,
    position: position2
  });
  switch (direction) {
    case "left":
    case "right":
      return placeLeftorRight(options);
    case "top":
    case "bottom":
    default:
      return placeToporBottom(options);
  }
};
var useIsomorphicLayoutEffect$1 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined" ? reactExports.useLayoutEffect : reactExports.useEffect;
function setRef(ref, instance2) {
  typeof ref === "function" ? ref(instance2) : ref.current = instance2;
}
var useCombinedRef = function useCombinedRef2(refA, refB) {
  return reactExports.useMemo(function() {
    if (!refA)
      return refB;
    if (!refB)
      return refA;
    return function(instance2) {
      setRef(refA, instance2);
      setRef(refB, instance2);
    };
  }, [refA, refB]);
};
var _excluded$5 = ["ariaLabel", "menuClassName", "menuStyle", "arrowClassName", "arrowStyle", "anchorPoint", "anchorRef", "containerRef", "containerProps", "focusProps", "externalRef", "parentScrollingRef", "arrow", "align", "direction", "position", "overflow", "setDownOverflow", "repositionFlag", "captureFocus", "state", "endTransition", "isDisabled", "menuItemFocus", "offsetX", "offsetY", "children", "onClose"];
var MenuList = function MenuList2(_ref) {
  var ariaLabel = _ref.ariaLabel, menuClassName = _ref.menuClassName, menuStyle = _ref.menuStyle, arrowClassName = _ref.arrowClassName, arrowStyle = _ref.arrowStyle, anchorPoint = _ref.anchorPoint, anchorRef = _ref.anchorRef, containerRef = _ref.containerRef, containerProps = _ref.containerProps, focusProps = _ref.focusProps, externalRef = _ref.externalRef, parentScrollingRef = _ref.parentScrollingRef, arrow = _ref.arrow, _ref$align = _ref.align, align = _ref$align === void 0 ? "start" : _ref$align, _ref$direction = _ref.direction, direction = _ref$direction === void 0 ? "bottom" : _ref$direction, _ref$position = _ref.position, position2 = _ref$position === void 0 ? "auto" : _ref$position, _ref$overflow = _ref.overflow, overflow = _ref$overflow === void 0 ? "visible" : _ref$overflow, setDownOverflow = _ref.setDownOverflow, repositionFlag = _ref.repositionFlag, _ref$captureFocus = _ref.captureFocus, captureFocus = _ref$captureFocus === void 0 ? true : _ref$captureFocus, state = _ref.state, endTransition = _ref.endTransition, isDisabled = _ref.isDisabled, menuItemFocus = _ref.menuItemFocus, _ref$offsetX = _ref.offsetX, offsetX = _ref$offsetX === void 0 ? 0 : _ref$offsetX, _ref$offsetY = _ref.offsetY, offsetY = _ref$offsetY === void 0 ? 0 : _ref$offsetY, children = _ref.children, onClose = _ref.onClose, restProps = _objectWithoutPropertiesLoose(_ref, _excluded$5);
  var _useState = reactExports.useState({
    x: 0,
    y: 0
  }), menuPosition = _useState[0], setMenuPosition = _useState[1];
  var _useState2 = reactExports.useState({}), arrowPosition = _useState2[0], setArrowPosition = _useState2[1];
  var _useState3 = reactExports.useState(), overflowData = _useState3[0], setOverflowData = _useState3[1];
  var _useState4 = reactExports.useState(direction), expandedDirection = _useState4[0], setExpandedDirection = _useState4[1];
  var _useState5 = reactExports.useState(createSubmenuCtx), submenuCtx = _useState5[0];
  var _useReducer = reactExports.useReducer(function(c2) {
    return c2 + 1;
  }, 1), reposSubmenu = _useReducer[0], forceReposSubmenu = _useReducer[1];
  var _useContext = reactExports.useContext(SettingsContext), transition3 = _useContext.transition, boundingBoxRef = _useContext.boundingBoxRef, boundingBoxPadding = _useContext.boundingBoxPadding, rootMenuRef = _useContext.rootMenuRef, rootAnchorRef = _useContext.rootAnchorRef, scrollNodesRef = _useContext.scrollNodesRef, reposition = _useContext.reposition, viewScroll = _useContext.viewScroll, submenuCloseDelay = _useContext.submenuCloseDelay;
  var _useContext2 = reactExports.useContext(MenuListContext), parentSubmenuCtx = _useContext2.submenuCtx, _useContext2$reposSub = _useContext2.reposSubmenu, reposFlag = _useContext2$reposSub === void 0 ? repositionFlag : _useContext2$reposSub;
  var menuRef = reactExports.useRef(null);
  var focusRef = reactExports.useRef();
  var arrowRef = reactExports.useRef();
  var prevOpen = reactExports.useRef(false);
  var latestMenuSize = reactExports.useRef({
    width: 0,
    height: 0
  });
  var latestHandlePosition = reactExports.useRef(function() {
  });
  var _useItems = useItems(menuRef, focusRef), hoverItem = _useItems.hoverItem, dispatch = _useItems.dispatch, updateItems = _useItems.updateItems;
  var isOpen = isMenuOpen(state);
  var openTransition = getTransition(transition3, "open");
  var closeTransition = getTransition(transition3, "close");
  var scrollNodes = scrollNodesRef.current;
  var onKeyDown = function onKeyDown2(e2) {
    switch (e2.key) {
      case Keys.HOME:
        dispatch(HoverActionTypes.FIRST);
        break;
      case Keys.END:
        dispatch(HoverActionTypes.LAST);
        break;
      case Keys.UP:
        dispatch(HoverActionTypes.DECREASE, hoverItem);
        break;
      case Keys.DOWN:
        dispatch(HoverActionTypes.INCREASE, hoverItem);
        break;
      case Keys.SPACE:
        if (e2.target && e2.target.className.indexOf(menuClass) !== -1) {
          e2.preventDefault();
        }
        return;
      default:
        return;
    }
    e2.preventDefault();
    e2.stopPropagation();
  };
  var onAnimationEnd = function onAnimationEnd2() {
    if (state === "closing") {
      setOverflowData();
    }
    safeCall(endTransition);
  };
  var onPointerMove = function onPointerMove2(e2) {
    e2.stopPropagation();
    submenuCtx.on(submenuCloseDelay, function() {
      dispatch(HoverActionTypes.RESET);
      focusRef.current.focus();
    });
  };
  var onPointerLeave = function onPointerLeave2(e2) {
    if (e2.target === e2.currentTarget)
      submenuCtx.off();
  };
  var handlePosition = reactExports.useCallback(function(noOverflowCheck) {
    var _anchorRef$current;
    var anchorRect = anchorRef ? (_anchorRef$current = anchorRef.current) == null ? void 0 : _anchorRef$current.getBoundingClientRect() : anchorPoint ? {
      left: anchorPoint.x,
      right: anchorPoint.x,
      top: anchorPoint.y,
      bottom: anchorPoint.y,
      width: 0,
      height: 0
    } : null;
    if (!anchorRect) {
      return;
    }
    if (!scrollNodes.menu) {
      scrollNodes.menu = (boundingBoxRef ? boundingBoxRef.current : getScrollAncestor(rootMenuRef.current)) || window;
    }
    var positionHelpers = getPositionHelpers(containerRef, menuRef, scrollNodes.menu, boundingBoxPadding);
    var _positionMenu = positionMenu({
      arrow,
      align,
      direction,
      offsetX,
      offsetY,
      position: position2,
      anchorRect,
      arrowRef,
      positionHelpers
    }), arrowX = _positionMenu.arrowX, arrowY = _positionMenu.arrowY, x2 = _positionMenu.x, y2 = _positionMenu.y, computedDirection = _positionMenu.computedDirection;
    var menuRect = positionHelpers.menuRect;
    var menuHeight = menuRect.height;
    if (!noOverflowCheck && overflow !== "visible") {
      var getTopOverflow = positionHelpers.getTopOverflow, getBottomOverflow = positionHelpers.getBottomOverflow;
      var height, _overflowAmt;
      var prevHeight = latestMenuSize.current.height;
      var bottomOverflow = getBottomOverflow(y2);
      if (bottomOverflow > 0 || floatEqual(bottomOverflow, 0) && floatEqual(menuHeight, prevHeight)) {
        height = menuHeight - bottomOverflow;
        _overflowAmt = bottomOverflow;
      } else {
        var topOverflow = getTopOverflow(y2);
        if (topOverflow < 0 || floatEqual(topOverflow, 0) && floatEqual(menuHeight, prevHeight)) {
          height = menuHeight + topOverflow;
          _overflowAmt = 0 - topOverflow;
          if (height >= 0)
            y2 -= topOverflow;
        }
      }
      if (height >= 0) {
        menuHeight = height;
        setOverflowData({
          height,
          overflowAmt: _overflowAmt
        });
      } else {
        setOverflowData();
      }
    }
    if (arrow)
      setArrowPosition({
        x: arrowX,
        y: arrowY
      });
    setMenuPosition({
      x: x2,
      y: y2
    });
    setExpandedDirection(computedDirection);
    latestMenuSize.current = {
      width: menuRect.width,
      height: menuHeight
    };
  }, [arrow, align, boundingBoxPadding, direction, offsetX, offsetY, position2, overflow, anchorPoint, anchorRef, containerRef, boundingBoxRef, rootMenuRef, scrollNodes]);
  useIsomorphicLayoutEffect$1(function() {
    if (isOpen) {
      handlePosition();
      if (prevOpen.current)
        forceReposSubmenu();
    }
    prevOpen.current = isOpen;
    latestHandlePosition.current = handlePosition;
  }, [isOpen, handlePosition, reposFlag]);
  useIsomorphicLayoutEffect$1(function() {
    if (overflowData && !setDownOverflow)
      menuRef.current.scrollTop = 0;
  }, [overflowData, setDownOverflow]);
  useIsomorphicLayoutEffect$1(function() {
    return updateItems;
  }, [updateItems]);
  reactExports.useEffect(function() {
    var menuScroll = scrollNodes.menu;
    if (!isOpen || !menuScroll)
      return;
    menuScroll = menuScroll.addEventListener ? menuScroll : window;
    if (!scrollNodes.anchors) {
      scrollNodes.anchors = [];
      var anchorScroll = getScrollAncestor(rootAnchorRef && rootAnchorRef.current);
      while (anchorScroll && anchorScroll !== menuScroll) {
        scrollNodes.anchors.push(anchorScroll);
        anchorScroll = getScrollAncestor(anchorScroll);
      }
    }
    var scroll = viewScroll;
    if (scrollNodes.anchors.length && scroll === "initial")
      scroll = "auto";
    if (scroll === "initial")
      return;
    var handleScroll = function handleScroll2() {
      if (scroll === "auto") {
        batchedUpdates(function() {
          return handlePosition(true);
        });
      } else {
        safeCall(onClose, {
          reason: CloseReason.SCROLL
        });
      }
    };
    var scrollObservers = scrollNodes.anchors.concat(viewScroll !== "initial" ? menuScroll : []);
    scrollObservers.forEach(function(o2) {
      return o2.addEventListener("scroll", handleScroll);
    });
    return function() {
      return scrollObservers.forEach(function(o2) {
        return o2.removeEventListener("scroll", handleScroll);
      });
    };
  }, [rootAnchorRef, scrollNodes, isOpen, onClose, viewScroll, handlePosition]);
  var hasOverflow = !!overflowData && overflowData.overflowAmt > 0;
  reactExports.useEffect(function() {
    if (hasOverflow || !isOpen || !parentScrollingRef)
      return;
    var handleScroll = function handleScroll2() {
      return batchedUpdates(handlePosition);
    };
    var parentScroll = parentScrollingRef.current;
    parentScroll.addEventListener("scroll", handleScroll);
    return function() {
      return parentScroll.removeEventListener("scroll", handleScroll);
    };
  }, [isOpen, hasOverflow, parentScrollingRef, handlePosition]);
  reactExports.useEffect(function() {
    if (typeof ResizeObserver !== "function" || reposition === "initial")
      return;
    var resizeObserver2 = new ResizeObserver(function(_ref2) {
      var entry = _ref2[0];
      var borderBoxSize = entry.borderBoxSize, target = entry.target;
      var width, height;
      if (borderBoxSize) {
        var _ref3 = borderBoxSize[0] || borderBoxSize, inlineSize = _ref3.inlineSize, blockSize = _ref3.blockSize;
        width = inlineSize;
        height = blockSize;
      } else {
        var borderRect = target.getBoundingClientRect();
        width = borderRect.width;
        height = borderRect.height;
      }
      if (width === 0 || height === 0)
        return;
      if (floatEqual(width, latestMenuSize.current.width, 1) && floatEqual(height, latestMenuSize.current.height, 1))
        return;
      reactDomExports.flushSync(function() {
        latestHandlePosition.current();
        forceReposSubmenu();
      });
    });
    var observeTarget = menuRef.current;
    resizeObserver2.observe(observeTarget, {
      box: "border-box"
    });
    return function() {
      return resizeObserver2.unobserve(observeTarget);
    };
  }, [reposition]);
  reactExports.useEffect(function() {
    if (!isOpen) {
      dispatch(HoverActionTypes.RESET);
      if (!closeTransition)
        setOverflowData();
      return;
    }
    var _ref4 = menuItemFocus || {}, position22 = _ref4.position, alwaysUpdate = _ref4.alwaysUpdate;
    var setItemFocus = function setItemFocus2() {
      if (position22 === FocusPositions.FIRST) {
        dispatch(HoverActionTypes.FIRST);
      } else if (position22 === FocusPositions.LAST) {
        dispatch(HoverActionTypes.LAST);
      } else if (position22 >= -1) {
        dispatch(HoverActionTypes.SET_INDEX, void 0, position22);
      }
    };
    if (alwaysUpdate) {
      setItemFocus();
    } else if (captureFocus) {
      var id2 = setTimeout(function() {
        if (!menuRef.current.contains(document.activeElement)) {
          focusRef.current.focus();
          setItemFocus();
        }
      }, openTransition ? 170 : 100);
      return function() {
        return clearTimeout(id2);
      };
    }
  }, [isOpen, openTransition, closeTransition, captureFocus, menuItemFocus, dispatch]);
  var itemContext = reactExports.useMemo(function() {
    return {
      isParentOpen: isOpen,
      submenuCtx,
      dispatch,
      updateItems
    };
  }, [isOpen, submenuCtx, dispatch, updateItems]);
  var maxHeight, overflowAmt;
  if (overflowData) {
    setDownOverflow ? overflowAmt = overflowData.overflowAmt : maxHeight = overflowData.height;
  }
  var listContext = reactExports.useMemo(function() {
    return {
      reposSubmenu,
      submenuCtx,
      overflow,
      overflowAmt,
      parentMenuRef: menuRef,
      parentDir: expandedDirection
    };
  }, [reposSubmenu, submenuCtx, overflow, overflowAmt, expandedDirection]);
  var overflowStyle = maxHeight >= 0 ? {
    maxHeight,
    overflow
  } : void 0;
  var modifiers = reactExports.useMemo(function() {
    return {
      state,
      dir: expandedDirection
    };
  }, [state, expandedDirection]);
  var arrowModifiers = reactExports.useMemo(function() {
    return {
      dir: expandedDirection
    };
  }, [expandedDirection]);
  var _arrowClass = useBEM({
    block: menuClass,
    element: menuArrowClass,
    modifiers: arrowModifiers,
    className: arrowClassName
  });
  var menu2 = /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", _extends$1({
    role: "menu",
    "aria-label": ariaLabel
  }, commonProps(isDisabled), mergeProps({
    onPointerEnter: parentSubmenuCtx == null ? void 0 : parentSubmenuCtx.off,
    onPointerMove,
    onPointerLeave,
    onKeyDown,
    onAnimationEnd
  }, restProps), {
    ref: useCombinedRef(externalRef, menuRef),
    className: useBEM({
      block: menuClass,
      modifiers,
      className: menuClassName
    }),
    style: _extends$1({}, menuStyle, overflowStyle, {
      margin: 0,
      display: state === "closed" ? "none" : void 0,
      position: positionAbsolute,
      left: menuPosition.x,
      top: menuPosition.y
    }),
    children: [/* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends$1({
      tabIndex: -1,
      style: {
        position: positionAbsolute,
        left: 0,
        top: 0,
        display: "block",
        outline: "none"
      },
      ref: focusRef
    }, dummyItemProps, focusProps)), arrow && /* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends$1({
      className: _arrowClass,
      style: _extends$1({
        display: "block",
        position: positionAbsolute,
        left: arrowPosition.x,
        top: arrowPosition.y
      }, arrowStyle),
      ref: arrowRef
    }, dummyItemProps)), /* @__PURE__ */ jsxRuntimeExports.jsx(MenuListContext.Provider, {
      value: listContext,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuListItemContext.Provider, {
        value: itemContext,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(HoverItemContext.Provider, {
          value: hoverItem,
          children: safeCall(children, modifiers)
        })
      })
    })]
  }));
  return containerProps ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuContainer, _extends$1({}, containerProps, {
    isOpen,
    children: menu2
  })) : menu2;
};
var _excluded$4 = ["aria-label", "className", "containerProps", "initialMounted", "unmountOnClose", "transition", "transitionTimeout", "boundingBoxRef", "boundingBoxPadding", "reposition", "submenuOpenDelay", "submenuCloseDelay", "skipOpen", "viewScroll", "portal", "theming", "onItemClick"];
var ControlledMenu = /* @__PURE__ */ reactExports.forwardRef(function ControlledMenu2(_ref, externalRef) {
  var ariaLabel = _ref["aria-label"], className = _ref.className, containerProps = _ref.containerProps, initialMounted = _ref.initialMounted, unmountOnClose = _ref.unmountOnClose, transition3 = _ref.transition, transitionTimeout = _ref.transitionTimeout, boundingBoxRef = _ref.boundingBoxRef, boundingBoxPadding = _ref.boundingBoxPadding, _ref$reposition = _ref.reposition, reposition = _ref$reposition === void 0 ? "auto" : _ref$reposition, _ref$submenuOpenDelay = _ref.submenuOpenDelay, submenuOpenDelay = _ref$submenuOpenDelay === void 0 ? 300 : _ref$submenuOpenDelay, _ref$submenuCloseDela = _ref.submenuCloseDelay, submenuCloseDelay = _ref$submenuCloseDela === void 0 ? 150 : _ref$submenuCloseDela, skipOpen = _ref.skipOpen, _ref$viewScroll = _ref.viewScroll, viewScroll = _ref$viewScroll === void 0 ? "initial" : _ref$viewScroll, portal = _ref.portal, theming = _ref.theming, onItemClick = _ref.onItemClick, restProps = _objectWithoutPropertiesLoose(_ref, _excluded$4);
  var containerRef = reactExports.useRef(null);
  var scrollNodesRef = reactExports.useRef({});
  var anchorRef = restProps.anchorRef, state = restProps.state, onClose = restProps.onClose;
  var settings = reactExports.useMemo(function() {
    return {
      initialMounted,
      unmountOnClose,
      transition: transition3,
      transitionTimeout,
      boundingBoxRef,
      boundingBoxPadding,
      rootMenuRef: containerRef,
      rootAnchorRef: anchorRef,
      scrollNodesRef,
      reposition,
      viewScroll,
      submenuOpenDelay,
      submenuCloseDelay
    };
  }, [initialMounted, unmountOnClose, transition3, transitionTimeout, anchorRef, boundingBoxRef, boundingBoxPadding, reposition, viewScroll, submenuOpenDelay, submenuCloseDelay]);
  var eventHandlers = reactExports.useMemo(function() {
    return {
      handleClick: function handleClick(event, isCheckorRadio) {
        if (!event.stopPropagation)
          safeCall(onItemClick, event);
        var keepOpen = event.keepOpen;
        if (keepOpen === void 0) {
          keepOpen = isCheckorRadio && event.key === Keys.SPACE;
        }
        if (!keepOpen) {
          safeCall(onClose, {
            value: event.value,
            key: event.key,
            reason: CloseReason.CLICK
          });
        }
      },
      handleClose: function handleClose(key) {
        safeCall(onClose, {
          key,
          reason: CloseReason.CLICK
        });
      }
    };
  }, [onItemClick, onClose]);
  if (!state)
    return null;
  var menuList = /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsContext.Provider, {
    value: settings,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx(EventHandlersContext.Provider, {
      value: eventHandlers,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuList, _extends$1({}, restProps, {
        ariaLabel: ariaLabel || "Menu",
        externalRef,
        containerRef,
        containerProps: {
          className,
          containerRef,
          containerProps,
          skipOpen,
          theming,
          transition: transition3,
          onClose
        }
      }))
    })
  });
  if (portal === true && typeof document !== "undefined") {
    return /* @__PURE__ */ reactDomExports.createPortal(menuList, document.body);
  } else if (portal) {
    return portal.target ? /* @__PURE__ */ reactDomExports.createPortal(menuList, portal.target) : portal.stablePosition ? null : menuList;
  }
  return menuList;
});
var PRE_ENTER = 0;
var ENTERING = 1;
var ENTERED = 2;
var PRE_EXIT = 3;
var EXITING = 4;
var EXITED = 5;
var UNMOUNTED = 6;
var STATES = ["preEnter", "entering", "entered", "preExit", "exiting", "exited", "unmounted"];
var startOrEnd = function startOrEnd2(unmounted) {
  return unmounted ? UNMOUNTED : EXITED;
};
var updateState = function updateState2(state, setState, latestState, timeoutId, onChange) {
  clearTimeout(timeoutId.current);
  setState(state);
  latestState.current = state;
  onChange && onChange({
    state: STATES[state]
  });
};
var useTransition = function useTransition2(_temp) {
  var _ref = _temp === void 0 ? {} : _temp, _ref$enter = _ref.enter, enter = _ref$enter === void 0 ? true : _ref$enter, _ref$exit = _ref.exit, exit2 = _ref$exit === void 0 ? true : _ref$exit, preEnter = _ref.preEnter, preExit = _ref.preExit, timeout = _ref.timeout, initialEntered = _ref.initialEntered, mountOnEnter = _ref.mountOnEnter, unmountOnExit = _ref.unmountOnExit, onChange = _ref.onChange;
  var _useState = reactExports.useState(initialEntered ? ENTERED : startOrEnd(mountOnEnter)), state = _useState[0], setState = _useState[1];
  var latestState = reactExports.useRef(state);
  var timeoutId = reactExports.useRef();
  var enterTimeout, exitTimeout;
  if (typeof timeout === "object") {
    enterTimeout = timeout.enter;
    exitTimeout = timeout.exit;
  } else {
    enterTimeout = exitTimeout = timeout;
  }
  var endTransition = reactExports.useCallback(function() {
    var newState;
    switch (latestState.current) {
      case ENTERING:
      case PRE_ENTER:
        newState = ENTERED;
        break;
      case EXITING:
      case PRE_EXIT:
        newState = startOrEnd(unmountOnExit);
        break;
    }
    if (newState !== void 0) {
      updateState(newState, setState, latestState, timeoutId, onChange);
    }
  }, [onChange, unmountOnExit]);
  var toggle2 = reactExports.useCallback(function(toEnter) {
    var transitState = function transitState2(newState) {
      updateState(newState, setState, latestState, timeoutId, onChange);
      switch (newState) {
        case ENTERING:
          if (enterTimeout >= 0)
            timeoutId.current = setTimeout(endTransition, enterTimeout);
          break;
        case EXITING:
          if (exitTimeout >= 0)
            timeoutId.current = setTimeout(endTransition, exitTimeout);
          break;
        case PRE_ENTER:
        case PRE_EXIT:
          timeoutId.current = setTimeout(function() {
            return transitState2(newState + 1);
          }, 0);
          break;
      }
    };
    var enterStage = latestState.current <= ENTERED;
    if (typeof toEnter !== "boolean")
      toEnter = !enterStage;
    if (toEnter) {
      if (!enterStage) {
        transitState(enter ? preEnter ? PRE_ENTER : ENTERING : ENTERED);
      }
    } else {
      if (enterStage) {
        transitState(exit2 ? preExit ? PRE_EXIT : EXITING : startOrEnd(unmountOnExit));
      }
    }
  }, [endTransition, onChange, enter, exit2, preEnter, preExit, enterTimeout, exitTimeout, unmountOnExit]);
  reactExports.useEffect(function() {
    return function() {
      return clearTimeout(timeoutId.current);
    };
  }, []);
  return [STATES[state], toggle2, endTransition];
};
var useMenuState = function useMenuState2(_temp) {
  var _ref = {}, initialOpen = _ref.initialOpen, initialMounted = _ref.initialMounted, unmountOnClose = _ref.unmountOnClose, transition3 = _ref.transition, _ref$transitionTimeou = _ref.transitionTimeout, transitionTimeout = _ref$transitionTimeou === void 0 ? 500 : _ref$transitionTimeou;
  var _useTransition = useTransition({
    initialEntered: initialOpen,
    mountOnEnter: !initialMounted,
    unmountOnExit: unmountOnClose,
    timeout: transitionTimeout,
    enter: getTransition(transition3, "open"),
    exit: getTransition(transition3, "close")
  }), state = _useTransition[0], toggleMenu = _useTransition[1], endTransition = _useTransition[2];
  return [{
    state: MenuStateMap[state],
    endTransition
  }, toggleMenu];
};
var withHovering = function withHovering2(name2, WrappedComponent) {
  var Component2 = /* @__PURE__ */ reactExports.memo(WrappedComponent);
  var WithHovering = /* @__PURE__ */ reactExports.forwardRef(function(props, ref) {
    var itemRef = reactExports.useRef(null);
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Component2, _extends$1({}, props, {
      itemRef,
      externalRef: ref,
      isHovering: reactExports.useContext(HoverItemContext) === itemRef.current
    }));
  });
  WithHovering.displayName = "WithHovering(" + name2 + ")";
  return WithHovering;
};
var useItemEffect = function useItemEffect2(isDisabled, itemRef, updateItems) {
  useIsomorphicLayoutEffect$1(function() {
    if (isDisabled)
      return;
    var item = itemRef.current;
    updateItems(item, true);
    return function() {
      updateItems(item);
    };
  }, [isDisabled, itemRef, updateItems]);
};
var useItemState = function useItemState2(itemRef, focusRef, isHovering, isDisabled) {
  var _useContext = reactExports.useContext(SettingsContext), submenuCloseDelay = _useContext.submenuCloseDelay;
  var _useContext2 = reactExports.useContext(MenuListItemContext), isParentOpen = _useContext2.isParentOpen, submenuCtx = _useContext2.submenuCtx, dispatch = _useContext2.dispatch, updateItems = _useContext2.updateItems;
  var setHover = function setHover2() {
    !isHovering && !isDisabled && dispatch(HoverActionTypes.SET, itemRef.current);
  };
  var unsetHover = function unsetHover2() {
    !isDisabled && dispatch(HoverActionTypes.UNSET, itemRef.current);
  };
  var onBlur = function onBlur2(e2) {
    if (isHovering && !e2.currentTarget.contains(e2.relatedTarget))
      unsetHover();
  };
  var onPointerMove = function onPointerMove2(e2) {
    if (!isDisabled) {
      e2.stopPropagation();
      submenuCtx.on(submenuCloseDelay, setHover, setHover);
    }
  };
  var onPointerLeave = function onPointerLeave2(_24, keepHover) {
    submenuCtx.off();
    !keepHover && unsetHover();
  };
  useItemEffect(isDisabled, itemRef, updateItems);
  reactExports.useEffect(function() {
    if (isHovering && isParentOpen) {
      focusRef.current && focusRef.current.focus();
    }
  }, [focusRef, isHovering, isParentOpen]);
  return {
    setHover,
    onBlur,
    onPointerMove,
    onPointerLeave
  };
};
var _excluded$3 = ["className", "value", "href", "type", "checked", "disabled", "children", "onClick", "isHovering", "itemRef", "externalRef"], _excluded2$1 = ["setHover"];
var MenuItem = /* @__PURE__ */ withHovering("MenuItem", function MenuItem2(_ref) {
  var className = _ref.className, value2 = _ref.value, href = _ref.href, type4 = _ref.type, checked = _ref.checked, disabled = _ref.disabled, children = _ref.children, onClick = _ref.onClick, isHovering = _ref.isHovering, itemRef = _ref.itemRef, externalRef = _ref.externalRef, restProps = _objectWithoutPropertiesLoose(_ref, _excluded$3);
  var isDisabled = !!disabled;
  var _useItemState = useItemState(itemRef, itemRef, isHovering, isDisabled), setHover = _useItemState.setHover, restStateProps = _objectWithoutPropertiesLoose(_useItemState, _excluded2$1);
  var eventHandlers = reactExports.useContext(EventHandlersContext);
  var radioGroup2 = reactExports.useContext(RadioGroupContext);
  var isRadio = type4 === "radio";
  var isCheckBox = type4 === "checkbox";
  var isAnchor = !!href && !isDisabled && !isRadio && !isCheckBox;
  var isChecked = isRadio ? radioGroup2.value === value2 : isCheckBox ? !!checked : false;
  var handleClick = function handleClick2(e2) {
    if (isDisabled) {
      e2.stopPropagation();
      e2.preventDefault();
      return;
    }
    var event = {
      value: value2,
      syntheticEvent: e2
    };
    if (e2.key !== void 0)
      event.key = e2.key;
    if (isCheckBox)
      event.checked = !isChecked;
    if (isRadio)
      event.name = radioGroup2.name;
    safeCall(onClick, event);
    if (isRadio)
      safeCall(radioGroup2.onRadioChange, event);
    eventHandlers.handleClick(event, isCheckBox || isRadio);
  };
  var handleKeyDown = function handleKeyDown2(e2) {
    if (!isHovering)
      return;
    switch (e2.key) {
      case Keys.ENTER:
      case Keys.SPACE:
        isAnchor ? e2.key === Keys.SPACE && itemRef.current.click() : handleClick(e2);
    }
  };
  var modifiers = reactExports.useMemo(function() {
    return {
      type: type4,
      disabled: isDisabled,
      hover: isHovering,
      checked: isChecked,
      anchor: isAnchor
    };
  }, [type4, isDisabled, isHovering, isChecked, isAnchor]);
  var mergedProps = mergeProps(_extends$1({}, restStateProps, {
    onPointerDown: setHover,
    onKeyDown: handleKeyDown,
    onClick: handleClick
  }), restProps);
  var menuItemProps = _extends$1({
    role: isRadio ? "menuitemradio" : isCheckBox ? "menuitemcheckbox" : roleMenuitem,
    "aria-checked": isRadio || isCheckBox ? isChecked : void 0
  }, commonProps(isDisabled, isHovering), mergedProps, {
    ref: useCombinedRef(externalRef, itemRef),
    className: useBEM({
      block: menuClass,
      element: menuItemClass,
      modifiers,
      className
    }),
    children: reactExports.useMemo(function() {
      return safeCall(children, modifiers);
    }, [children, modifiers])
  });
  return isAnchor ? /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
    role: roleNone,
    children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", _extends$1({
      href
    }, menuItemProps))
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx("li", _extends$1({}, menuItemProps));
});
//! moment.js
//! version : 2.30.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
var hookCallback;
function hooks() {
  return hookCallback.apply(null, arguments);
}
function setHookCallback(callback2) {
  hookCallback = callback2;
}
function isArray$3(input2) {
  return input2 instanceof Array || Object.prototype.toString.call(input2) === "[object Array]";
}
function isObject$2(input2) {
  return input2 != null && Object.prototype.toString.call(input2) === "[object Object]";
}
function hasOwnProp(a2, b2) {
  return Object.prototype.hasOwnProperty.call(a2, b2);
}
function isObjectEmpty(obj) {
  if (Object.getOwnPropertyNames) {
    return Object.getOwnPropertyNames(obj).length === 0;
  } else {
    var k2;
    for (k2 in obj) {
      if (hasOwnProp(obj, k2)) {
        return false;
      }
    }
    return true;
  }
}
function isUndefined$1(input2) {
  return input2 === void 0;
}
function isNumber$1(input2) {
  return typeof input2 === "number" || Object.prototype.toString.call(input2) === "[object Number]";
}
function isDate$1(input2) {
  return input2 instanceof Date || Object.prototype.toString.call(input2) === "[object Date]";
}
function map(arr, fn) {
  var res = [], i2, arrLen = arr.length;
  for (i2 = 0; i2 < arrLen; ++i2) {
    res.push(fn(arr[i2], i2));
  }
  return res;
}
function extend$3(a2, b2) {
  for (var i2 in b2) {
    if (hasOwnProp(b2, i2)) {
      a2[i2] = b2[i2];
    }
  }
  if (hasOwnProp(b2, "toString")) {
    a2.toString = b2.toString;
  }
  if (hasOwnProp(b2, "valueOf")) {
    a2.valueOf = b2.valueOf;
  }
  return a2;
}
function createUTC(input2, format2, locale2, strict) {
  return createLocalOrUTC(input2, format2, locale2, strict, true).utc();
}
function defaultParsingFlags() {
  return {
    empty: false,
    unusedTokens: [],
    unusedInput: [],
    overflow: -2,
    charsLeftOver: 0,
    nullInput: false,
    invalidEra: null,
    invalidMonth: null,
    invalidFormat: false,
    userInvalidated: false,
    iso: false,
    parsedDateParts: [],
    era: null,
    meridiem: null,
    rfc2822: false,
    weekdayMismatch: false
  };
}
function getParsingFlags(m2) {
  if (m2._pf == null) {
    m2._pf = defaultParsingFlags();
  }
  return m2._pf;
}
var some;
if (Array.prototype.some) {
  some = Array.prototype.some;
} else {
  some = function(fun) {
    var t2 = Object(this), len = t2.length >>> 0, i2;
    for (i2 = 0; i2 < len; i2++) {
      if (i2 in t2 && fun.call(this, t2[i2], i2, t2)) {
        return true;
      }
    }
    return false;
  };
}
function isValid2(m2) {
  var flags = null, parsedParts = false, isNowValid = m2._d && !isNaN(m2._d.getTime());
  if (isNowValid) {
    flags = getParsingFlags(m2);
    parsedParts = some.call(flags.parsedDateParts, function(i2) {
      return i2 != null;
    });
    isNowValid = flags.overflow < 0 && !flags.empty && !flags.invalidEra && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
    if (m2._strict) {
      isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === void 0;
    }
  }
  if (Object.isFrozen == null || !Object.isFrozen(m2)) {
    m2._isValid = isNowValid;
  } else {
    return isNowValid;
  }
  return m2._isValid;
}
function createInvalid(flags) {
  var m2 = createUTC(NaN);
  if (flags != null) {
    extend$3(getParsingFlags(m2), flags);
  } else {
    getParsingFlags(m2).userInvalidated = true;
  }
  return m2;
}
var momentProperties = hooks.momentProperties = [], updateInProgress = false;
function copyConfig(to2, from2) {
  var i2, prop, val, momentPropertiesLen = momentProperties.length;
  if (!isUndefined$1(from2._isAMomentObject)) {
    to2._isAMomentObject = from2._isAMomentObject;
  }
  if (!isUndefined$1(from2._i)) {
    to2._i = from2._i;
  }
  if (!isUndefined$1(from2._f)) {
    to2._f = from2._f;
  }
  if (!isUndefined$1(from2._l)) {
    to2._l = from2._l;
  }
  if (!isUndefined$1(from2._strict)) {
    to2._strict = from2._strict;
  }
  if (!isUndefined$1(from2._tzm)) {
    to2._tzm = from2._tzm;
  }
  if (!isUndefined$1(from2._isUTC)) {
    to2._isUTC = from2._isUTC;
  }
  if (!isUndefined$1(from2._offset)) {
    to2._offset = from2._offset;
  }
  if (!isUndefined$1(from2._pf)) {
    to2._pf = getParsingFlags(from2);
  }
  if (!isUndefined$1(from2._locale)) {
    to2._locale = from2._locale;
  }
  if (momentPropertiesLen > 0) {
    for (i2 = 0; i2 < momentPropertiesLen; i2++) {
      prop = momentProperties[i2];
      val = from2[prop];
      if (!isUndefined$1(val)) {
        to2[prop] = val;
      }
    }
  }
  return to2;
}
function Moment(config2) {
  copyConfig(this, config2);
  this._d = new Date(config2._d != null ? config2._d.getTime() : NaN);
  if (!this.isValid()) {
    this._d = /* @__PURE__ */ new Date(NaN);
  }
  if (updateInProgress === false) {
    updateInProgress = true;
    hooks.updateOffset(this);
    updateInProgress = false;
  }
}
function isMoment(obj) {
  return obj instanceof Moment || obj != null && obj._isAMomentObject != null;
}
function warn2(msg) {
  if (hooks.suppressDeprecationWarnings === false && typeof console !== "undefined" && console.warn) {
    console.warn("Deprecation warning: " + msg);
  }
}
function deprecate(msg, fn) {
  var firstTime = true;
  return extend$3(function() {
    if (hooks.deprecationHandler != null) {
      hooks.deprecationHandler(null, msg);
    }
    if (firstTime) {
      var args = [], arg, i2, key, argLen = arguments.length;
      for (i2 = 0; i2 < argLen; i2++) {
        arg = "";
        if (typeof arguments[i2] === "object") {
          arg += "\n[" + i2 + "] ";
          for (key in arguments[0]) {
            if (hasOwnProp(arguments[0], key)) {
              arg += key + ": " + arguments[0][key] + ", ";
            }
          }
          arg = arg.slice(0, -2);
        } else {
          arg = arguments[i2];
        }
        args.push(arg);
      }
      warn2(
        msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack
      );
      firstTime = false;
    }
    return fn.apply(this, arguments);
  }, fn);
}
var deprecations$1 = {};
function deprecateSimple(name2, msg) {
  if (hooks.deprecationHandler != null) {
    hooks.deprecationHandler(name2, msg);
  }
  if (!deprecations$1[name2]) {
    warn2(msg);
    deprecations$1[name2] = true;
  }
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction$2(input2) {
  return typeof Function !== "undefined" && input2 instanceof Function || Object.prototype.toString.call(input2) === "[object Function]";
}
function set(config2) {
  var prop, i2;
  for (i2 in config2) {
    if (hasOwnProp(config2, i2)) {
      prop = config2[i2];
      if (isFunction$2(prop)) {
        this[i2] = prop;
      } else {
        this["_" + i2] = prop;
      }
    }
  }
  this._config = config2;
  this._dayOfMonthOrdinalParseLenient = new RegExp(
    (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source
  );
}
function mergeConfigs(parentConfig, childConfig) {
  var res = extend$3({}, parentConfig), prop;
  for (prop in childConfig) {
    if (hasOwnProp(childConfig, prop)) {
      if (isObject$2(parentConfig[prop]) && isObject$2(childConfig[prop])) {
        res[prop] = {};
        extend$3(res[prop], parentConfig[prop]);
        extend$3(res[prop], childConfig[prop]);
      } else if (childConfig[prop] != null) {
        res[prop] = childConfig[prop];
      } else {
        delete res[prop];
      }
    }
  }
  for (prop in parentConfig) {
    if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject$2(parentConfig[prop])) {
      res[prop] = extend$3({}, res[prop]);
    }
  }
  return res;
}
function Locale(config2) {
  if (config2 != null) {
    this.set(config2);
  }
}
var keys$1;
if (Object.keys) {
  keys$1 = Object.keys;
} else {
  keys$1 = function(obj) {
    var i2, res = [];
    for (i2 in obj) {
      if (hasOwnProp(obj, i2)) {
        res.push(i2);
      }
    }
    return res;
  };
}
var defaultCalendar = {
  sameDay: "[Today at] LT",
  nextDay: "[Tomorrow at] LT",
  nextWeek: "dddd [at] LT",
  lastDay: "[Yesterday at] LT",
  lastWeek: "[Last] dddd [at] LT",
  sameElse: "L"
};
function calendar(key, mom, now2) {
  var output2 = this._calendar[key] || this._calendar["sameElse"];
  return isFunction$2(output2) ? output2.call(mom, now2) : output2;
}
function zeroFill(number4, targetLength, forceSign) {
  var absNumber = "" + Math.abs(number4), zerosToFill = targetLength - absNumber.length, sign2 = number4 >= 0;
  return (sign2 ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
function addFormatToken(token2, padded, ordinal2, callback2) {
  var func = callback2;
  if (typeof callback2 === "string") {
    func = function() {
      return this[callback2]();
    };
  }
  if (token2) {
    formatTokenFunctions[token2] = func;
  }
  if (padded) {
    formatTokenFunctions[padded[0]] = function() {
      return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
    };
  }
  if (ordinal2) {
    formatTokenFunctions[ordinal2] = function() {
      return this.localeData().ordinal(
        func.apply(this, arguments),
        token2
      );
    };
  }
}
function removeFormattingTokens(input2) {
  if (input2.match(/\[[\s\S]/)) {
    return input2.replace(/^\[|\]$/g, "");
  }
  return input2.replace(/\\/g, "");
}
function makeFormatFunction(format2) {
  var array4 = format2.match(formattingTokens), i2, length2;
  for (i2 = 0, length2 = array4.length; i2 < length2; i2++) {
    if (formatTokenFunctions[array4[i2]]) {
      array4[i2] = formatTokenFunctions[array4[i2]];
    } else {
      array4[i2] = removeFormattingTokens(array4[i2]);
    }
  }
  return function(mom) {
    var output2 = "", i3;
    for (i3 = 0; i3 < length2; i3++) {
      output2 += isFunction$2(array4[i3]) ? array4[i3].call(mom, format2) : array4[i3];
    }
    return output2;
  };
}
function formatMoment(m2, format2) {
  if (!m2.isValid()) {
    return m2.localeData().invalidDate();
  }
  format2 = expandFormat(format2, m2.localeData());
  formatFunctions[format2] = formatFunctions[format2] || makeFormatFunction(format2);
  return formatFunctions[format2](m2);
}
function expandFormat(format2, locale2) {
  var i2 = 5;
  function replaceLongDateFormatTokens(input2) {
    return locale2.longDateFormat(input2) || input2;
  }
  localFormattingTokens.lastIndex = 0;
  while (i2 >= 0 && localFormattingTokens.test(format2)) {
    format2 = format2.replace(
      localFormattingTokens,
      replaceLongDateFormatTokens
    );
    localFormattingTokens.lastIndex = 0;
    i2 -= 1;
  }
  return format2;
}
var defaultLongDateFormat = {
  LTS: "h:mm:ss A",
  LT: "h:mm A",
  L: "MM/DD/YYYY",
  LL: "MMMM D, YYYY",
  LLL: "MMMM D, YYYY h:mm A",
  LLLL: "dddd, MMMM D, YYYY h:mm A"
};
function longDateFormat(key) {
  var format2 = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
  if (format2 || !formatUpper) {
    return format2;
  }
  this._longDateFormat[key] = formatUpper.match(formattingTokens).map(function(tok) {
    if (tok === "MMMM" || tok === "MM" || tok === "DD" || tok === "dddd") {
      return tok.slice(1);
    }
    return tok;
  }).join("");
  return this._longDateFormat[key];
}
var defaultInvalidDate = "Invalid date";
function invalidDate() {
  return this._invalidDate;
}
var defaultOrdinal = "%d", defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal(number4) {
  return this._ordinal.replace("%d", number4);
}
var defaultRelativeTime = {
  future: "in %s",
  past: "%s ago",
  s: "a few seconds",
  ss: "%d seconds",
  m: "a minute",
  mm: "%d minutes",
  h: "an hour",
  hh: "%d hours",
  d: "a day",
  dd: "%d days",
  w: "a week",
  ww: "%d weeks",
  M: "a month",
  MM: "%d months",
  y: "a year",
  yy: "%d years"
};
function relativeTime(number4, withoutSuffix, string3, isFuture) {
  var output2 = this._relativeTime[string3];
  return isFunction$2(output2) ? output2(number4, withoutSuffix, string3, isFuture) : output2.replace(/%d/i, number4);
}
function pastFuture(diff2, output2) {
  var format2 = this._relativeTime[diff2 > 0 ? "future" : "past"];
  return isFunction$2(format2) ? format2(output2) : format2.replace(/%s/i, output2);
}
var aliases = {
  D: "date",
  dates: "date",
  date: "date",
  d: "day",
  days: "day",
  day: "day",
  e: "weekday",
  weekdays: "weekday",
  weekday: "weekday",
  E: "isoWeekday",
  isoweekdays: "isoWeekday",
  isoweekday: "isoWeekday",
  DDD: "dayOfYear",
  dayofyears: "dayOfYear",
  dayofyear: "dayOfYear",
  h: "hour",
  hours: "hour",
  hour: "hour",
  ms: "millisecond",
  milliseconds: "millisecond",
  millisecond: "millisecond",
  m: "minute",
  minutes: "minute",
  minute: "minute",
  M: "month",
  months: "month",
  month: "month",
  Q: "quarter",
  quarters: "quarter",
  quarter: "quarter",
  s: "second",
  seconds: "second",
  second: "second",
  gg: "weekYear",
  weekyears: "weekYear",
  weekyear: "weekYear",
  GG: "isoWeekYear",
  isoweekyears: "isoWeekYear",
  isoweekyear: "isoWeekYear",
  w: "week",
  weeks: "week",
  week: "week",
  W: "isoWeek",
  isoweeks: "isoWeek",
  isoweek: "isoWeek",
  y: "year",
  years: "year",
  year: "year"
};
function normalizeUnits(units) {
  return typeof units === "string" ? aliases[units] || aliases[units.toLowerCase()] : void 0;
}
function normalizeObjectUnits(inputObject) {
  var normalizedInput = {}, normalizedProp, prop;
  for (prop in inputObject) {
    if (hasOwnProp(inputObject, prop)) {
      normalizedProp = normalizeUnits(prop);
      if (normalizedProp) {
        normalizedInput[normalizedProp] = inputObject[prop];
      }
    }
  }
  return normalizedInput;
}
var priorities = {
  date: 9,
  day: 11,
  weekday: 11,
  isoWeekday: 11,
  dayOfYear: 4,
  hour: 13,
  millisecond: 16,
  minute: 14,
  month: 8,
  quarter: 7,
  second: 15,
  weekYear: 1,
  isoWeekYear: 1,
  week: 5,
  isoWeek: 5,
  year: 1
};
function getPrioritizedUnits(unitsObj) {
  var units = [], u2;
  for (u2 in unitsObj) {
    if (hasOwnProp(unitsObj, u2)) {
      units.push({ unit: u2, priority: priorities[u2] });
    }
  }
  units.sort(function(a2, b2) {
    return a2.priority - b2.priority;
  });
  return units;
}
var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i, match1to2NoLeadingZero = /^[1-9]\d?/, match1to2HasZero = /^([1-9]\d|\d)/, regexes;
regexes = {};
function addRegexToken(token2, regex2, strictRegex) {
  regexes[token2] = isFunction$2(regex2) ? regex2 : function(isStrict, localeData2) {
    return isStrict && strictRegex ? strictRegex : regex2;
  };
}
function getParseRegexForToken(token2, config2) {
  if (!hasOwnProp(regexes, token2)) {
    return new RegExp(unescapeFormat(token2));
  }
  return regexes[token2](config2._strict, config2._locale);
}
function unescapeFormat(s2) {
  return regexEscape(
    s2.replace("\\", "").replace(
      /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
      function(matched, p1, p2, p3, p4) {
        return p1 || p2 || p3 || p4;
      }
    )
  );
}
function regexEscape(s2) {
  return s2.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
}
function absFloor(number4) {
  if (number4 < 0) {
    return Math.ceil(number4) || 0;
  } else {
    return Math.floor(number4);
  }
}
function toInt(argumentForCoercion) {
  var coercedNumber = +argumentForCoercion, value2 = 0;
  if (coercedNumber !== 0 && isFinite(coercedNumber)) {
    value2 = absFloor(coercedNumber);
  }
  return value2;
}
var tokens = {};
function addParseToken(token2, callback2) {
  var i2, func = callback2, tokenLen;
  if (typeof token2 === "string") {
    token2 = [token2];
  }
  if (isNumber$1(callback2)) {
    func = function(input2, array4) {
      array4[callback2] = toInt(input2);
    };
  }
  tokenLen = token2.length;
  for (i2 = 0; i2 < tokenLen; i2++) {
    tokens[token2[i2]] = func;
  }
}
function addWeekParseToken(token2, callback2) {
  addParseToken(token2, function(input2, array4, config2, token3) {
    config2._w = config2._w || {};
    callback2(input2, config2._w, config2, token3);
  });
}
function addTimeToArrayFromToken(token2, input2, config2) {
  if (input2 != null && hasOwnProp(tokens, token2)) {
    tokens[token2](input2, config2._a, config2, token2);
  }
}
function isLeapYear(year) {
  return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
var YEAR = 0, MONTH = 1, DATE$1 = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8;
addFormatToken("Y", 0, 0, function() {
  var y2 = this.year();
  return y2 <= 9999 ? zeroFill(y2, 4) : "+" + y2;
});
addFormatToken(0, ["YY", 2], 0, function() {
  return this.year() % 100;
});
addFormatToken(0, ["YYYY", 4], 0, "year");
addFormatToken(0, ["YYYYY", 5], 0, "year");
addFormatToken(0, ["YYYYYY", 6, true], 0, "year");
addRegexToken("Y", matchSigned);
addRegexToken("YY", match1to2, match2);
addRegexToken("YYYY", match1to4, match4);
addRegexToken("YYYYY", match1to6, match6);
addRegexToken("YYYYYY", match1to6, match6);
addParseToken(["YYYYY", "YYYYYY"], YEAR);
addParseToken("YYYY", function(input2, array4) {
  array4[YEAR] = input2.length === 2 ? hooks.parseTwoDigitYear(input2) : toInt(input2);
});
addParseToken("YY", function(input2, array4) {
  array4[YEAR] = hooks.parseTwoDigitYear(input2);
});
addParseToken("Y", function(input2, array4) {
  array4[YEAR] = parseInt(input2, 10);
});
function daysInYear(year) {
  return isLeapYear(year) ? 366 : 365;
}
hooks.parseTwoDigitYear = function(input2) {
  return toInt(input2) + (toInt(input2) > 68 ? 1900 : 2e3);
};
var getSetYear = makeGetSet("FullYear", true);
function getIsLeapYear() {
  return isLeapYear(this.year());
}
function makeGetSet(unit2, keepTime) {
  return function(value2) {
    if (value2 != null) {
      set$1(this, unit2, value2);
      hooks.updateOffset(this, keepTime);
      return this;
    } else {
      return get$2(this, unit2);
    }
  };
}
function get$2(mom, unit2) {
  if (!mom.isValid()) {
    return NaN;
  }
  var d2 = mom._d, isUTC = mom._isUTC;
  switch (unit2) {
    case "Milliseconds":
      return isUTC ? d2.getUTCMilliseconds() : d2.getMilliseconds();
    case "Seconds":
      return isUTC ? d2.getUTCSeconds() : d2.getSeconds();
    case "Minutes":
      return isUTC ? d2.getUTCMinutes() : d2.getMinutes();
    case "Hours":
      return isUTC ? d2.getUTCHours() : d2.getHours();
    case "Date":
      return isUTC ? d2.getUTCDate() : d2.getDate();
    case "Day":
      return isUTC ? d2.getUTCDay() : d2.getDay();
    case "Month":
      return isUTC ? d2.getUTCMonth() : d2.getMonth();
    case "FullYear":
      return isUTC ? d2.getUTCFullYear() : d2.getFullYear();
    default:
      return NaN;
  }
}
function set$1(mom, unit2, value2) {
  var d2, isUTC, year, month, date4;
  if (!mom.isValid() || isNaN(value2)) {
    return;
  }
  d2 = mom._d;
  isUTC = mom._isUTC;
  switch (unit2) {
    case "Milliseconds":
      return void (isUTC ? d2.setUTCMilliseconds(value2) : d2.setMilliseconds(value2));
    case "Seconds":
      return void (isUTC ? d2.setUTCSeconds(value2) : d2.setSeconds(value2));
    case "Minutes":
      return void (isUTC ? d2.setUTCMinutes(value2) : d2.setMinutes(value2));
    case "Hours":
      return void (isUTC ? d2.setUTCHours(value2) : d2.setHours(value2));
    case "Date":
      return void (isUTC ? d2.setUTCDate(value2) : d2.setDate(value2));
    case "FullYear":
      break;
    default:
      return;
  }
  year = value2;
  month = mom.month();
  date4 = mom.date();
  date4 = date4 === 29 && month === 1 && !isLeapYear(year) ? 28 : date4;
  void (isUTC ? d2.setUTCFullYear(year, month, date4) : d2.setFullYear(year, month, date4));
}
function stringGet(units) {
  units = normalizeUnits(units);
  if (isFunction$2(this[units])) {
    return this[units]();
  }
  return this;
}
function stringSet(units, value2) {
  if (typeof units === "object") {
    units = normalizeObjectUnits(units);
    var prioritized = getPrioritizedUnits(units), i2, prioritizedLen = prioritized.length;
    for (i2 = 0; i2 < prioritizedLen; i2++) {
      this[prioritized[i2].unit](units[prioritized[i2].unit]);
    }
  } else {
    units = normalizeUnits(units);
    if (isFunction$2(this[units])) {
      return this[units](value2);
    }
  }
  return this;
}
function mod(n2, x2) {
  return (n2 % x2 + x2) % x2;
}
var indexOf;
if (Array.prototype.indexOf) {
  indexOf = Array.prototype.indexOf;
} else {
  indexOf = function(o2) {
    var i2;
    for (i2 = 0; i2 < this.length; ++i2) {
      if (this[i2] === o2) {
        return i2;
      }
    }
    return -1;
  };
}
function daysInMonth(year, month) {
  if (isNaN(year) || isNaN(month)) {
    return NaN;
  }
  var modMonth = mod(month, 12);
  year += (month - modMonth) / 12;
  return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2;
}
addFormatToken("M", ["MM", 2], "Mo", function() {
  return this.month() + 1;
});
addFormatToken("MMM", 0, 0, function(format2) {
  return this.localeData().monthsShort(this, format2);
});
addFormatToken("MMMM", 0, 0, function(format2) {
  return this.localeData().months(this, format2);
});
addRegexToken("M", match1to2, match1to2NoLeadingZero);
addRegexToken("MM", match1to2, match2);
addRegexToken("MMM", function(isStrict, locale2) {
  return locale2.monthsShortRegex(isStrict);
});
addRegexToken("MMMM", function(isStrict, locale2) {
  return locale2.monthsRegex(isStrict);
});
addParseToken(["M", "MM"], function(input2, array4) {
  array4[MONTH] = toInt(input2) - 1;
});
addParseToken(["MMM", "MMMM"], function(input2, array4, config2, token2) {
  var month = config2._locale.monthsParse(input2, token2, config2._strict);
  if (month != null) {
    array4[MONTH] = month;
  } else {
    getParsingFlags(config2).invalidMonth = input2;
  }
});
var defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split(
  "_"
), defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultMonthsShortRegex = matchWord, defaultMonthsRegex = matchWord;
function localeMonths(m2, format2) {
  if (!m2) {
    return isArray$3(this._months) ? this._months : this._months["standalone"];
  }
  return isArray$3(this._months) ? this._months[m2.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format2) ? "format" : "standalone"][m2.month()];
}
function localeMonthsShort(m2, format2) {
  if (!m2) {
    return isArray$3(this._monthsShort) ? this._monthsShort : this._monthsShort["standalone"];
  }
  return isArray$3(this._monthsShort) ? this._monthsShort[m2.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format2) ? "format" : "standalone"][m2.month()];
}
function handleStrictParse(monthName, format2, strict) {
  var i2, ii2, mom, llc = monthName.toLocaleLowerCase();
  if (!this._monthsParse) {
    this._monthsParse = [];
    this._longMonthsParse = [];
    this._shortMonthsParse = [];
    for (i2 = 0; i2 < 12; ++i2) {
      mom = createUTC([2e3, i2]);
      this._shortMonthsParse[i2] = this.monthsShort(
        mom,
        ""
      ).toLocaleLowerCase();
      this._longMonthsParse[i2] = this.months(mom, "").toLocaleLowerCase();
    }
  }
  if (strict) {
    if (format2 === "MMM") {
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._longMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  } else {
    if (format2 === "MMM") {
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._longMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._longMonthsParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortMonthsParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  }
}
function localeMonthsParse(monthName, format2, strict) {
  var i2, mom, regex2;
  if (this._monthsParseExact) {
    return handleStrictParse.call(this, monthName, format2, strict);
  }
  if (!this._monthsParse) {
    this._monthsParse = [];
    this._longMonthsParse = [];
    this._shortMonthsParse = [];
  }
  for (i2 = 0; i2 < 12; i2++) {
    mom = createUTC([2e3, i2]);
    if (strict && !this._longMonthsParse[i2]) {
      this._longMonthsParse[i2] = new RegExp(
        "^" + this.months(mom, "").replace(".", "") + "$",
        "i"
      );
      this._shortMonthsParse[i2] = new RegExp(
        "^" + this.monthsShort(mom, "").replace(".", "") + "$",
        "i"
      );
    }
    if (!strict && !this._monthsParse[i2]) {
      regex2 = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, "");
      this._monthsParse[i2] = new RegExp(regex2.replace(".", ""), "i");
    }
    if (strict && format2 === "MMMM" && this._longMonthsParse[i2].test(monthName)) {
      return i2;
    } else if (strict && format2 === "MMM" && this._shortMonthsParse[i2].test(monthName)) {
      return i2;
    } else if (!strict && this._monthsParse[i2].test(monthName)) {
      return i2;
    }
  }
}
function setMonth(mom, value2) {
  if (!mom.isValid()) {
    return mom;
  }
  if (typeof value2 === "string") {
    if (/^\d+$/.test(value2)) {
      value2 = toInt(value2);
    } else {
      value2 = mom.localeData().monthsParse(value2);
      if (!isNumber$1(value2)) {
        return mom;
      }
    }
  }
  var month = value2, date4 = mom.date();
  date4 = date4 < 29 ? date4 : Math.min(date4, daysInMonth(mom.year(), month));
  void (mom._isUTC ? mom._d.setUTCMonth(month, date4) : mom._d.setMonth(month, date4));
  return mom;
}
function getSetMonth(value2) {
  if (value2 != null) {
    setMonth(this, value2);
    hooks.updateOffset(this, true);
    return this;
  } else {
    return get$2(this, "Month");
  }
}
function getDaysInMonth() {
  return daysInMonth(this.year(), this.month());
}
function monthsShortRegex(isStrict) {
  if (this._monthsParseExact) {
    if (!hasOwnProp(this, "_monthsRegex")) {
      computeMonthsParse.call(this);
    }
    if (isStrict) {
      return this._monthsShortStrictRegex;
    } else {
      return this._monthsShortRegex;
    }
  } else {
    if (!hasOwnProp(this, "_monthsShortRegex")) {
      this._monthsShortRegex = defaultMonthsShortRegex;
    }
    return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex;
  }
}
function monthsRegex(isStrict) {
  if (this._monthsParseExact) {
    if (!hasOwnProp(this, "_monthsRegex")) {
      computeMonthsParse.call(this);
    }
    if (isStrict) {
      return this._monthsStrictRegex;
    } else {
      return this._monthsRegex;
    }
  } else {
    if (!hasOwnProp(this, "_monthsRegex")) {
      this._monthsRegex = defaultMonthsRegex;
    }
    return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex;
  }
}
function computeMonthsParse() {
  function cmpLenRev(a2, b2) {
    return b2.length - a2.length;
  }
  var shortPieces = [], longPieces = [], mixedPieces = [], i2, mom, shortP, longP;
  for (i2 = 0; i2 < 12; i2++) {
    mom = createUTC([2e3, i2]);
    shortP = regexEscape(this.monthsShort(mom, ""));
    longP = regexEscape(this.months(mom, ""));
    shortPieces.push(shortP);
    longPieces.push(longP);
    mixedPieces.push(longP);
    mixedPieces.push(shortP);
  }
  shortPieces.sort(cmpLenRev);
  longPieces.sort(cmpLenRev);
  mixedPieces.sort(cmpLenRev);
  this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._monthsShortRegex = this._monthsRegex;
  this._monthsStrictRegex = new RegExp(
    "^(" + longPieces.join("|") + ")",
    "i"
  );
  this._monthsShortStrictRegex = new RegExp(
    "^(" + shortPieces.join("|") + ")",
    "i"
  );
}
function createDate(y2, m2, d2, h3, M2, s2, ms) {
  var date4;
  if (y2 < 100 && y2 >= 0) {
    date4 = new Date(y2 + 400, m2, d2, h3, M2, s2, ms);
    if (isFinite(date4.getFullYear())) {
      date4.setFullYear(y2);
    }
  } else {
    date4 = new Date(y2, m2, d2, h3, M2, s2, ms);
  }
  return date4;
}
function createUTCDate(y2) {
  var date4, args;
  if (y2 < 100 && y2 >= 0) {
    args = Array.prototype.slice.call(arguments);
    args[0] = y2 + 400;
    date4 = new Date(Date.UTC.apply(null, args));
    if (isFinite(date4.getUTCFullYear())) {
      date4.setUTCFullYear(y2);
    }
  } else {
    date4 = new Date(Date.UTC.apply(null, arguments));
  }
  return date4;
}
function firstWeekOffset(year, dow, doy) {
  var fwd = 7 + dow - doy, fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
  return -fwdlw + fwd - 1;
}
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
  var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear;
  if (dayOfYear <= 0) {
    resYear = year - 1;
    resDayOfYear = daysInYear(resYear) + dayOfYear;
  } else if (dayOfYear > daysInYear(year)) {
    resYear = year + 1;
    resDayOfYear = dayOfYear - daysInYear(year);
  } else {
    resYear = year;
    resDayOfYear = dayOfYear;
  }
  return {
    year: resYear,
    dayOfYear: resDayOfYear
  };
}
function weekOfYear(mom, dow, doy) {
  var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear;
  if (week < 1) {
    resYear = mom.year() - 1;
    resWeek = week + weeksInYear(resYear, dow, doy);
  } else if (week > weeksInYear(mom.year(), dow, doy)) {
    resWeek = week - weeksInYear(mom.year(), dow, doy);
    resYear = mom.year() + 1;
  } else {
    resYear = mom.year();
    resWeek = week;
  }
  return {
    week: resWeek,
    year: resYear
  };
}
function weeksInYear(year, dow, doy) {
  var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
  return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
addFormatToken("w", ["ww", 2], "wo", "week");
addFormatToken("W", ["WW", 2], "Wo", "isoWeek");
addRegexToken("w", match1to2, match1to2NoLeadingZero);
addRegexToken("ww", match1to2, match2);
addRegexToken("W", match1to2, match1to2NoLeadingZero);
addRegexToken("WW", match1to2, match2);
addWeekParseToken(
  ["w", "ww", "W", "WW"],
  function(input2, week, config2, token2) {
    week[token2.substr(0, 1)] = toInt(input2);
  }
);
function localeWeek(mom) {
  return weekOfYear(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
  dow: 0,
  // Sunday is the first day of the week.
  doy: 6
  // The week that contains Jan 6th is the first week of the year.
};
function localeFirstDayOfWeek() {
  return this._week.dow;
}
function localeFirstDayOfYear() {
  return this._week.doy;
}
function getSetWeek(input2) {
  var week = this.localeData().week(this);
  return input2 == null ? week : this.add((input2 - week) * 7, "d");
}
function getSetISOWeek(input2) {
  var week = weekOfYear(this, 1, 4).week;
  return input2 == null ? week : this.add((input2 - week) * 7, "d");
}
addFormatToken("d", 0, "do", "day");
addFormatToken("dd", 0, 0, function(format2) {
  return this.localeData().weekdaysMin(this, format2);
});
addFormatToken("ddd", 0, 0, function(format2) {
  return this.localeData().weekdaysShort(this, format2);
});
addFormatToken("dddd", 0, 0, function(format2) {
  return this.localeData().weekdays(this, format2);
});
addFormatToken("e", 0, 0, "weekday");
addFormatToken("E", 0, 0, "isoWeekday");
addRegexToken("d", match1to2);
addRegexToken("e", match1to2);
addRegexToken("E", match1to2);
addRegexToken("dd", function(isStrict, locale2) {
  return locale2.weekdaysMinRegex(isStrict);
});
addRegexToken("ddd", function(isStrict, locale2) {
  return locale2.weekdaysShortRegex(isStrict);
});
addRegexToken("dddd", function(isStrict, locale2) {
  return locale2.weekdaysRegex(isStrict);
});
addWeekParseToken(["dd", "ddd", "dddd"], function(input2, week, config2, token2) {
  var weekday = config2._locale.weekdaysParse(input2, token2, config2._strict);
  if (weekday != null) {
    week.d = weekday;
  } else {
    getParsingFlags(config2).invalidWeekday = input2;
  }
});
addWeekParseToken(["d", "e", "E"], function(input2, week, config2, token2) {
  week[token2] = toInt(input2);
});
function parseWeekday(input2, locale2) {
  if (typeof input2 !== "string") {
    return input2;
  }
  if (!isNaN(input2)) {
    return parseInt(input2, 10);
  }
  input2 = locale2.weekdaysParse(input2);
  if (typeof input2 === "number") {
    return input2;
  }
  return null;
}
function parseIsoWeekday(input2, locale2) {
  if (typeof input2 === "string") {
    return locale2.weekdaysParse(input2) % 7 || 7;
  }
  return isNaN(input2) ? null : input2;
}
function shiftWeekdays(ws, n2) {
  return ws.slice(n2, 7).concat(ws.slice(0, n2));
}
var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), defaultWeekdaysRegex = matchWord, defaultWeekdaysShortRegex = matchWord, defaultWeekdaysMinRegex = matchWord;
function localeWeekdays(m2, format2) {
  var weekdays = isArray$3(this._weekdays) ? this._weekdays : this._weekdays[m2 && m2 !== true && this._weekdays.isFormat.test(format2) ? "format" : "standalone"];
  return m2 === true ? shiftWeekdays(weekdays, this._week.dow) : m2 ? weekdays[m2.day()] : weekdays;
}
function localeWeekdaysShort(m2) {
  return m2 === true ? shiftWeekdays(this._weekdaysShort, this._week.dow) : m2 ? this._weekdaysShort[m2.day()] : this._weekdaysShort;
}
function localeWeekdaysMin(m2) {
  return m2 === true ? shiftWeekdays(this._weekdaysMin, this._week.dow) : m2 ? this._weekdaysMin[m2.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format2, strict) {
  var i2, ii2, mom, llc = weekdayName.toLocaleLowerCase();
  if (!this._weekdaysParse) {
    this._weekdaysParse = [];
    this._shortWeekdaysParse = [];
    this._minWeekdaysParse = [];
    for (i2 = 0; i2 < 7; ++i2) {
      mom = createUTC([2e3, 1]).day(i2);
      this._minWeekdaysParse[i2] = this.weekdaysMin(
        mom,
        ""
      ).toLocaleLowerCase();
      this._shortWeekdaysParse[i2] = this.weekdaysShort(
        mom,
        ""
      ).toLocaleLowerCase();
      this._weekdaysParse[i2] = this.weekdays(mom, "").toLocaleLowerCase();
    }
  }
  if (strict) {
    if (format2 === "dddd") {
      ii2 = indexOf.call(this._weekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else if (format2 === "ddd") {
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  } else {
    if (format2 === "dddd") {
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else if (format2 === "ddd") {
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    } else {
      ii2 = indexOf.call(this._minWeekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._weekdaysParse, llc);
      if (ii2 !== -1) {
        return ii2;
      }
      ii2 = indexOf.call(this._shortWeekdaysParse, llc);
      return ii2 !== -1 ? ii2 : null;
    }
  }
}
function localeWeekdaysParse(weekdayName, format2, strict) {
  var i2, mom, regex2;
  if (this._weekdaysParseExact) {
    return handleStrictParse$1.call(this, weekdayName, format2, strict);
  }
  if (!this._weekdaysParse) {
    this._weekdaysParse = [];
    this._minWeekdaysParse = [];
    this._shortWeekdaysParse = [];
    this._fullWeekdaysParse = [];
  }
  for (i2 = 0; i2 < 7; i2++) {
    mom = createUTC([2e3, 1]).day(i2);
    if (strict && !this._fullWeekdaysParse[i2]) {
      this._fullWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdays(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
      this._shortWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdaysShort(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
      this._minWeekdaysParse[i2] = new RegExp(
        "^" + this.weekdaysMin(mom, "").replace(".", "\\.?") + "$",
        "i"
      );
    }
    if (!this._weekdaysParse[i2]) {
      regex2 = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, "");
      this._weekdaysParse[i2] = new RegExp(regex2.replace(".", ""), "i");
    }
    if (strict && format2 === "dddd" && this._fullWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (strict && format2 === "ddd" && this._shortWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (strict && format2 === "dd" && this._minWeekdaysParse[i2].test(weekdayName)) {
      return i2;
    } else if (!strict && this._weekdaysParse[i2].test(weekdayName)) {
      return i2;
    }
  }
}
function getSetDayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  var day = get$2(this, "Day");
  if (input2 != null) {
    input2 = parseWeekday(input2, this.localeData());
    return this.add(input2 - day, "d");
  } else {
    return day;
  }
}
function getSetLocaleDayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
  return input2 == null ? weekday : this.add(input2 - weekday, "d");
}
function getSetISODayOfWeek(input2) {
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  if (input2 != null) {
    var weekday = parseIsoWeekday(input2, this.localeData());
    return this.day(this.day() % 7 ? weekday : weekday - 7);
  } else {
    return this.day() || 7;
  }
}
function weekdaysRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysStrictRegex;
    } else {
      return this._weekdaysRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      this._weekdaysRegex = defaultWeekdaysRegex;
    }
    return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex;
  }
}
function weekdaysShortRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysShortStrictRegex;
    } else {
      return this._weekdaysShortRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysShortRegex")) {
      this._weekdaysShortRegex = defaultWeekdaysShortRegex;
    }
    return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
  }
}
function weekdaysMinRegex(isStrict) {
  if (this._weekdaysParseExact) {
    if (!hasOwnProp(this, "_weekdaysRegex")) {
      computeWeekdaysParse.call(this);
    }
    if (isStrict) {
      return this._weekdaysMinStrictRegex;
    } else {
      return this._weekdaysMinRegex;
    }
  } else {
    if (!hasOwnProp(this, "_weekdaysMinRegex")) {
      this._weekdaysMinRegex = defaultWeekdaysMinRegex;
    }
    return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
  }
}
function computeWeekdaysParse() {
  function cmpLenRev(a2, b2) {
    return b2.length - a2.length;
  }
  var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i2, mom, minp, shortp, longp;
  for (i2 = 0; i2 < 7; i2++) {
    mom = createUTC([2e3, 1]).day(i2);
    minp = regexEscape(this.weekdaysMin(mom, ""));
    shortp = regexEscape(this.weekdaysShort(mom, ""));
    longp = regexEscape(this.weekdays(mom, ""));
    minPieces.push(minp);
    shortPieces.push(shortp);
    longPieces.push(longp);
    mixedPieces.push(minp);
    mixedPieces.push(shortp);
    mixedPieces.push(longp);
  }
  minPieces.sort(cmpLenRev);
  shortPieces.sort(cmpLenRev);
  longPieces.sort(cmpLenRev);
  mixedPieces.sort(cmpLenRev);
  this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._weekdaysShortRegex = this._weekdaysRegex;
  this._weekdaysMinRegex = this._weekdaysRegex;
  this._weekdaysStrictRegex = new RegExp(
    "^(" + longPieces.join("|") + ")",
    "i"
  );
  this._weekdaysShortStrictRegex = new RegExp(
    "^(" + shortPieces.join("|") + ")",
    "i"
  );
  this._weekdaysMinStrictRegex = new RegExp(
    "^(" + minPieces.join("|") + ")",
    "i"
  );
}
function hFormat() {
  return this.hours() % 12 || 12;
}
function kFormat() {
  return this.hours() || 24;
}
addFormatToken("H", ["HH", 2], 0, "hour");
addFormatToken("h", ["hh", 2], 0, hFormat);
addFormatToken("k", ["kk", 2], 0, kFormat);
addFormatToken("hmm", 0, 0, function() {
  return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken("hmmss", 0, 0, function() {
  return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
addFormatToken("Hmm", 0, 0, function() {
  return "" + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken("Hmmss", 0, 0, function() {
  return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
});
function meridiem(token2, lowercase) {
  addFormatToken(token2, 0, 0, function() {
    return this.localeData().meridiem(
      this.hours(),
      this.minutes(),
      lowercase
    );
  });
}
meridiem("a", true);
meridiem("A", false);
function matchMeridiem(isStrict, locale2) {
  return locale2._meridiemParse;
}
addRegexToken("a", matchMeridiem);
addRegexToken("A", matchMeridiem);
addRegexToken("H", match1to2, match1to2HasZero);
addRegexToken("h", match1to2, match1to2NoLeadingZero);
addRegexToken("k", match1to2, match1to2NoLeadingZero);
addRegexToken("HH", match1to2, match2);
addRegexToken("hh", match1to2, match2);
addRegexToken("kk", match1to2, match2);
addRegexToken("hmm", match3to4);
addRegexToken("hmmss", match5to6);
addRegexToken("Hmm", match3to4);
addRegexToken("Hmmss", match5to6);
addParseToken(["H", "HH"], HOUR);
addParseToken(["k", "kk"], function(input2, array4, config2) {
  var kInput = toInt(input2);
  array4[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken(["a", "A"], function(input2, array4, config2) {
  config2._isPm = config2._locale.isPM(input2);
  config2._meridiem = input2;
});
addParseToken(["h", "hh"], function(input2, array4, config2) {
  array4[HOUR] = toInt(input2);
  getParsingFlags(config2).bigHour = true;
});
addParseToken("hmm", function(input2, array4, config2) {
  var pos = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos));
  array4[MINUTE] = toInt(input2.substr(pos));
  getParsingFlags(config2).bigHour = true;
});
addParseToken("hmmss", function(input2, array4, config2) {
  var pos1 = input2.length - 4, pos2 = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos1));
  array4[MINUTE] = toInt(input2.substr(pos1, 2));
  array4[SECOND] = toInt(input2.substr(pos2));
  getParsingFlags(config2).bigHour = true;
});
addParseToken("Hmm", function(input2, array4, config2) {
  var pos = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos));
  array4[MINUTE] = toInt(input2.substr(pos));
});
addParseToken("Hmmss", function(input2, array4, config2) {
  var pos1 = input2.length - 4, pos2 = input2.length - 2;
  array4[HOUR] = toInt(input2.substr(0, pos1));
  array4[MINUTE] = toInt(input2.substr(pos1, 2));
  array4[SECOND] = toInt(input2.substr(pos2));
});
function localeIsPM(input2) {
  return (input2 + "").toLowerCase().charAt(0) === "p";
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i, getSetHour = makeGetSet("Hours", true);
function localeMeridiem(hours2, minutes2, isLower) {
  if (hours2 > 11) {
    return isLower ? "pm" : "PM";
  } else {
    return isLower ? "am" : "AM";
  }
}
var baseConfig = {
  calendar: defaultCalendar,
  longDateFormat: defaultLongDateFormat,
  invalidDate: defaultInvalidDate,
  ordinal: defaultOrdinal,
  dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
  relativeTime: defaultRelativeTime,
  months: defaultLocaleMonths,
  monthsShort: defaultLocaleMonthsShort,
  week: defaultLocaleWeek,
  weekdays: defaultLocaleWeekdays,
  weekdaysMin: defaultLocaleWeekdaysMin,
  weekdaysShort: defaultLocaleWeekdaysShort,
  meridiemParse: defaultLocaleMeridiemParse
};
var locales = {}, localeFamilies = {}, globalLocale;
function commonPrefix(arr1, arr2) {
  var i2, minl = Math.min(arr1.length, arr2.length);
  for (i2 = 0; i2 < minl; i2 += 1) {
    if (arr1[i2] !== arr2[i2]) {
      return i2;
    }
  }
  return minl;
}
function normalizeLocale(key) {
  return key ? key.toLowerCase().replace("_", "-") : key;
}
function chooseLocale(names2) {
  var i2 = 0, j2, next2, locale2, split2;
  while (i2 < names2.length) {
    split2 = normalizeLocale(names2[i2]).split("-");
    j2 = split2.length;
    next2 = normalizeLocale(names2[i2 + 1]);
    next2 = next2 ? next2.split("-") : null;
    while (j2 > 0) {
      locale2 = loadLocale(split2.slice(0, j2).join("-"));
      if (locale2) {
        return locale2;
      }
      if (next2 && next2.length >= j2 && commonPrefix(split2, next2) >= j2 - 1) {
        break;
      }
      j2--;
    }
    i2++;
  }
  return globalLocale;
}
function isLocaleNameSane(name2) {
  return !!(name2 && name2.match("^[^/\\\\]*$"));
}
function loadLocale(name2) {
  var oldLocale = null, aliasedRequire;
  if (locales[name2] === void 0 && typeof module !== "undefined" && module && module.exports && isLocaleNameSane(name2)) {
    try {
      oldLocale = globalLocale._abbr;
      aliasedRequire = require;
      aliasedRequire("./locale/" + name2);
      getSetGlobalLocale(oldLocale);
    } catch (e2) {
      locales[name2] = null;
    }
  }
  return locales[name2];
}
function getSetGlobalLocale(key, values) {
  var data;
  if (key) {
    if (isUndefined$1(values)) {
      data = getLocale(key);
    } else {
      data = defineLocale(key, values);
    }
    if (data) {
      globalLocale = data;
    } else {
      if (typeof console !== "undefined" && console.warn) {
        console.warn(
          "Locale " + key + " not found. Did you forget to load it?"
        );
      }
    }
  }
  return globalLocale._abbr;
}
function defineLocale(name2, config2) {
  if (config2 !== null) {
    var locale2, parentConfig = baseConfig;
    config2.abbr = name2;
    if (locales[name2] != null) {
      deprecateSimple(
        "defineLocaleOverride",
        "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."
      );
      parentConfig = locales[name2]._config;
    } else if (config2.parentLocale != null) {
      if (locales[config2.parentLocale] != null) {
        parentConfig = locales[config2.parentLocale]._config;
      } else {
        locale2 = loadLocale(config2.parentLocale);
        if (locale2 != null) {
          parentConfig = locale2._config;
        } else {
          if (!localeFamilies[config2.parentLocale]) {
            localeFamilies[config2.parentLocale] = [];
          }
          localeFamilies[config2.parentLocale].push({
            name: name2,
            config: config2
          });
          return null;
        }
      }
    }
    locales[name2] = new Locale(mergeConfigs(parentConfig, config2));
    if (localeFamilies[name2]) {
      localeFamilies[name2].forEach(function(x2) {
        defineLocale(x2.name, x2.config);
      });
    }
    getSetGlobalLocale(name2);
    return locales[name2];
  } else {
    delete locales[name2];
    return null;
  }
}
function updateLocale(name2, config2) {
  if (config2 != null) {
    var locale2, tmpLocale, parentConfig = baseConfig;
    if (locales[name2] != null && locales[name2].parentLocale != null) {
      locales[name2].set(mergeConfigs(locales[name2]._config, config2));
    } else {
      tmpLocale = loadLocale(name2);
      if (tmpLocale != null) {
        parentConfig = tmpLocale._config;
      }
      config2 = mergeConfigs(parentConfig, config2);
      if (tmpLocale == null) {
        config2.abbr = name2;
      }
      locale2 = new Locale(config2);
      locale2.parentLocale = locales[name2];
      locales[name2] = locale2;
    }
    getSetGlobalLocale(name2);
  } else {
    if (locales[name2] != null) {
      if (locales[name2].parentLocale != null) {
        locales[name2] = locales[name2].parentLocale;
        if (name2 === getSetGlobalLocale()) {
          getSetGlobalLocale(name2);
        }
      } else if (locales[name2] != null) {
        delete locales[name2];
      }
    }
  }
  return locales[name2];
}
function getLocale(key) {
  var locale2;
  if (key && key._locale && key._locale._abbr) {
    key = key._locale._abbr;
  }
  if (!key) {
    return globalLocale;
  }
  if (!isArray$3(key)) {
    locale2 = loadLocale(key);
    if (locale2) {
      return locale2;
    }
    key = [key];
  }
  return chooseLocale(key);
}
function listLocales() {
  return keys$1(locales);
}
function checkOverflow(m2) {
  var overflow, a2 = m2._a;
  if (a2 && getParsingFlags(m2).overflow === -2) {
    overflow = a2[MONTH] < 0 || a2[MONTH] > 11 ? MONTH : a2[DATE$1] < 1 || a2[DATE$1] > daysInMonth(a2[YEAR], a2[MONTH]) ? DATE$1 : a2[HOUR] < 0 || a2[HOUR] > 24 || a2[HOUR] === 24 && (a2[MINUTE] !== 0 || a2[SECOND] !== 0 || a2[MILLISECOND] !== 0) ? HOUR : a2[MINUTE] < 0 || a2[MINUTE] > 59 ? MINUTE : a2[SECOND] < 0 || a2[SECOND] > 59 ? SECOND : a2[MILLISECOND] < 0 || a2[MILLISECOND] > 999 ? MILLISECOND : -1;
    if (getParsingFlags(m2)._overflowDayOfYear && (overflow < YEAR || overflow > DATE$1)) {
      overflow = DATE$1;
    }
    if (getParsingFlags(m2)._overflowWeeks && overflow === -1) {
      overflow = WEEK;
    }
    if (getParsingFlags(m2)._overflowWeekday && overflow === -1) {
      overflow = WEEKDAY;
    }
    getParsingFlags(m2).overflow = overflow;
  }
  return m2;
}
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [
  ["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/],
  ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/],
  ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/],
  ["GGGG-[W]WW", /\d{4}-W\d\d/, false],
  ["YYYY-DDD", /\d{4}-\d{3}/],
  ["YYYY-MM", /\d{4}-\d\d/, false],
  ["YYYYYYMMDD", /[+-]\d{10}/],
  ["YYYYMMDD", /\d{8}/],
  ["GGGG[W]WWE", /\d{4}W\d{3}/],
  ["GGGG[W]WW", /\d{4}W\d{2}/, false],
  ["YYYYDDD", /\d{7}/],
  ["YYYYMM", /\d{6}/, false],
  ["YYYY", /\d{4}/, false]
], isoTimes = [
  ["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/],
  ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/],
  ["HH:mm:ss", /\d\d:\d\d:\d\d/],
  ["HH:mm", /\d\d:\d\d/],
  ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/],
  ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/],
  ["HHmmss", /\d\d\d\d\d\d/],
  ["HHmm", /\d\d\d\d/],
  ["HH", /\d\d/]
], aspNetJsonRegex = /^\/?Date\((-?\d+)/i, rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, obsOffsets = {
  UT: 0,
  GMT: 0,
  EDT: -4 * 60,
  EST: -5 * 60,
  CDT: -5 * 60,
  CST: -6 * 60,
  MDT: -6 * 60,
  MST: -7 * 60,
  PDT: -7 * 60,
  PST: -8 * 60
};
function configFromISO(config2) {
  var i2, l2, string3 = config2._i, match5 = extendedIsoRegex.exec(string3) || basicIsoRegex.exec(string3), allowTime, dateFormat, timeFormat, tzFormat, isoDatesLen = isoDates.length, isoTimesLen = isoTimes.length;
  if (match5) {
    getParsingFlags(config2).iso = true;
    for (i2 = 0, l2 = isoDatesLen; i2 < l2; i2++) {
      if (isoDates[i2][1].exec(match5[1])) {
        dateFormat = isoDates[i2][0];
        allowTime = isoDates[i2][2] !== false;
        break;
      }
    }
    if (dateFormat == null) {
      config2._isValid = false;
      return;
    }
    if (match5[3]) {
      for (i2 = 0, l2 = isoTimesLen; i2 < l2; i2++) {
        if (isoTimes[i2][1].exec(match5[3])) {
          timeFormat = (match5[2] || " ") + isoTimes[i2][0];
          break;
        }
      }
      if (timeFormat == null) {
        config2._isValid = false;
        return;
      }
    }
    if (!allowTime && timeFormat != null) {
      config2._isValid = false;
      return;
    }
    if (match5[4]) {
      if (tzRegex.exec(match5[4])) {
        tzFormat = "Z";
      } else {
        config2._isValid = false;
        return;
      }
    }
    config2._f = dateFormat + (timeFormat || "") + (tzFormat || "");
    configFromStringAndFormat(config2);
  } else {
    config2._isValid = false;
  }
}
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
  var result = [
    untruncateYear(yearStr),
    defaultLocaleMonthsShort.indexOf(monthStr),
    parseInt(dayStr, 10),
    parseInt(hourStr, 10),
    parseInt(minuteStr, 10)
  ];
  if (secondStr) {
    result.push(parseInt(secondStr, 10));
  }
  return result;
}
function untruncateYear(yearStr) {
  var year = parseInt(yearStr, 10);
  if (year <= 49) {
    return 2e3 + year;
  } else if (year <= 999) {
    return 1900 + year;
  }
  return year;
}
function preprocessRFC2822(s2) {
  return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "");
}
function checkWeekday(weekdayStr, parsedInput, config2) {
  if (weekdayStr) {
    var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(
      parsedInput[0],
      parsedInput[1],
      parsedInput[2]
    ).getDay();
    if (weekdayProvided !== weekdayActual) {
      getParsingFlags(config2).weekdayMismatch = true;
      config2._isValid = false;
      return false;
    }
  }
  return true;
}
function calculateOffset(obsOffset, militaryOffset, numOffset) {
  if (obsOffset) {
    return obsOffsets[obsOffset];
  } else if (militaryOffset) {
    return 0;
  } else {
    var hm = parseInt(numOffset, 10), m2 = hm % 100, h3 = (hm - m2) / 100;
    return h3 * 60 + m2;
  }
}
function configFromRFC2822(config2) {
  var match5 = rfc2822.exec(preprocessRFC2822(config2._i)), parsedArray;
  if (match5) {
    parsedArray = extractFromRFC2822Strings(
      match5[4],
      match5[3],
      match5[2],
      match5[5],
      match5[6],
      match5[7]
    );
    if (!checkWeekday(match5[1], parsedArray, config2)) {
      return;
    }
    config2._a = parsedArray;
    config2._tzm = calculateOffset(match5[8], match5[9], match5[10]);
    config2._d = createUTCDate.apply(null, config2._a);
    config2._d.setUTCMinutes(config2._d.getUTCMinutes() - config2._tzm);
    getParsingFlags(config2).rfc2822 = true;
  } else {
    config2._isValid = false;
  }
}
function configFromString(config2) {
  var matched = aspNetJsonRegex.exec(config2._i);
  if (matched !== null) {
    config2._d = /* @__PURE__ */ new Date(+matched[1]);
    return;
  }
  configFromISO(config2);
  if (config2._isValid === false) {
    delete config2._isValid;
  } else {
    return;
  }
  configFromRFC2822(config2);
  if (config2._isValid === false) {
    delete config2._isValid;
  } else {
    return;
  }
  if (config2._strict) {
    config2._isValid = false;
  } else {
    hooks.createFromInputFallback(config2);
  }
}
hooks.createFromInputFallback = deprecate(
  "value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",
  function(config2) {
    config2._d = /* @__PURE__ */ new Date(config2._i + (config2._useUTC ? " UTC" : ""));
  }
);
function defaults$1(a2, b2, c2) {
  if (a2 != null) {
    return a2;
  }
  if (b2 != null) {
    return b2;
  }
  return c2;
}
function currentDateArray(config2) {
  var nowValue = new Date(hooks.now());
  if (config2._useUTC) {
    return [
      nowValue.getUTCFullYear(),
      nowValue.getUTCMonth(),
      nowValue.getUTCDate()
    ];
  }
  return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
}
function configFromArray(config2) {
  var i2, date4, input2 = [], currentDate, expectedWeekday, yearToUse;
  if (config2._d) {
    return;
  }
  currentDate = currentDateArray(config2);
  if (config2._w && config2._a[DATE$1] == null && config2._a[MONTH] == null) {
    dayOfYearFromWeekInfo(config2);
  }
  if (config2._dayOfYear != null) {
    yearToUse = defaults$1(config2._a[YEAR], currentDate[YEAR]);
    if (config2._dayOfYear > daysInYear(yearToUse) || config2._dayOfYear === 0) {
      getParsingFlags(config2)._overflowDayOfYear = true;
    }
    date4 = createUTCDate(yearToUse, 0, config2._dayOfYear);
    config2._a[MONTH] = date4.getUTCMonth();
    config2._a[DATE$1] = date4.getUTCDate();
  }
  for (i2 = 0; i2 < 3 && config2._a[i2] == null; ++i2) {
    config2._a[i2] = input2[i2] = currentDate[i2];
  }
  for (; i2 < 7; i2++) {
    config2._a[i2] = input2[i2] = config2._a[i2] == null ? i2 === 2 ? 1 : 0 : config2._a[i2];
  }
  if (config2._a[HOUR] === 24 && config2._a[MINUTE] === 0 && config2._a[SECOND] === 0 && config2._a[MILLISECOND] === 0) {
    config2._nextDay = true;
    config2._a[HOUR] = 0;
  }
  config2._d = (config2._useUTC ? createUTCDate : createDate).apply(
    null,
    input2
  );
  expectedWeekday = config2._useUTC ? config2._d.getUTCDay() : config2._d.getDay();
  if (config2._tzm != null) {
    config2._d.setUTCMinutes(config2._d.getUTCMinutes() - config2._tzm);
  }
  if (config2._nextDay) {
    config2._a[HOUR] = 24;
  }
  if (config2._w && typeof config2._w.d !== "undefined" && config2._w.d !== expectedWeekday) {
    getParsingFlags(config2).weekdayMismatch = true;
  }
}
function dayOfYearFromWeekInfo(config2) {
  var w2, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
  w2 = config2._w;
  if (w2.GG != null || w2.W != null || w2.E != null) {
    dow = 1;
    doy = 4;
    weekYear = defaults$1(
      w2.GG,
      config2._a[YEAR],
      weekOfYear(createLocal(), 1, 4).year
    );
    week = defaults$1(w2.W, 1);
    weekday = defaults$1(w2.E, 1);
    if (weekday < 1 || weekday > 7) {
      weekdayOverflow = true;
    }
  } else {
    dow = config2._locale._week.dow;
    doy = config2._locale._week.doy;
    curWeek = weekOfYear(createLocal(), dow, doy);
    weekYear = defaults$1(w2.gg, config2._a[YEAR], curWeek.year);
    week = defaults$1(w2.w, curWeek.week);
    if (w2.d != null) {
      weekday = w2.d;
      if (weekday < 0 || weekday > 6) {
        weekdayOverflow = true;
      }
    } else if (w2.e != null) {
      weekday = w2.e + dow;
      if (w2.e < 0 || w2.e > 6) {
        weekdayOverflow = true;
      }
    } else {
      weekday = dow;
    }
  }
  if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
    getParsingFlags(config2)._overflowWeeks = true;
  } else if (weekdayOverflow != null) {
    getParsingFlags(config2)._overflowWeekday = true;
  } else {
    temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
    config2._a[YEAR] = temp.year;
    config2._dayOfYear = temp.dayOfYear;
  }
}
hooks.ISO_8601 = function() {
};
hooks.RFC_2822 = function() {
};
function configFromStringAndFormat(config2) {
  if (config2._f === hooks.ISO_8601) {
    configFromISO(config2);
    return;
  }
  if (config2._f === hooks.RFC_2822) {
    configFromRFC2822(config2);
    return;
  }
  config2._a = [];
  getParsingFlags(config2).empty = true;
  var string3 = "" + config2._i, i2, parsedInput, tokens2, token2, skipped, stringLength = string3.length, totalParsedInputLength = 0, era, tokenLen;
  tokens2 = expandFormat(config2._f, config2._locale).match(formattingTokens) || [];
  tokenLen = tokens2.length;
  for (i2 = 0; i2 < tokenLen; i2++) {
    token2 = tokens2[i2];
    parsedInput = (string3.match(getParseRegexForToken(token2, config2)) || [])[0];
    if (parsedInput) {
      skipped = string3.substr(0, string3.indexOf(parsedInput));
      if (skipped.length > 0) {
        getParsingFlags(config2).unusedInput.push(skipped);
      }
      string3 = string3.slice(
        string3.indexOf(parsedInput) + parsedInput.length
      );
      totalParsedInputLength += parsedInput.length;
    }
    if (formatTokenFunctions[token2]) {
      if (parsedInput) {
        getParsingFlags(config2).empty = false;
      } else {
        getParsingFlags(config2).unusedTokens.push(token2);
      }
      addTimeToArrayFromToken(token2, parsedInput, config2);
    } else if (config2._strict && !parsedInput) {
      getParsingFlags(config2).unusedTokens.push(token2);
    }
  }
  getParsingFlags(config2).charsLeftOver = stringLength - totalParsedInputLength;
  if (string3.length > 0) {
    getParsingFlags(config2).unusedInput.push(string3);
  }
  if (config2._a[HOUR] <= 12 && getParsingFlags(config2).bigHour === true && config2._a[HOUR] > 0) {
    getParsingFlags(config2).bigHour = void 0;
  }
  getParsingFlags(config2).parsedDateParts = config2._a.slice(0);
  getParsingFlags(config2).meridiem = config2._meridiem;
  config2._a[HOUR] = meridiemFixWrap(
    config2._locale,
    config2._a[HOUR],
    config2._meridiem
  );
  era = getParsingFlags(config2).era;
  if (era !== null) {
    config2._a[YEAR] = config2._locale.erasConvertYear(era, config2._a[YEAR]);
  }
  configFromArray(config2);
  checkOverflow(config2);
}
function meridiemFixWrap(locale2, hour, meridiem2) {
  var isPm;
  if (meridiem2 == null) {
    return hour;
  }
  if (locale2.meridiemHour != null) {
    return locale2.meridiemHour(hour, meridiem2);
  } else if (locale2.isPM != null) {
    isPm = locale2.isPM(meridiem2);
    if (isPm && hour < 12) {
      hour += 12;
    }
    if (!isPm && hour === 12) {
      hour = 0;
    }
    return hour;
  } else {
    return hour;
  }
}
function configFromStringAndArray(config2) {
  var tempConfig, bestMoment, scoreToBeat, i2, currentScore, validFormatFound, bestFormatIsValid = false, configfLen = config2._f.length;
  if (configfLen === 0) {
    getParsingFlags(config2).invalidFormat = true;
    config2._d = /* @__PURE__ */ new Date(NaN);
    return;
  }
  for (i2 = 0; i2 < configfLen; i2++) {
    currentScore = 0;
    validFormatFound = false;
    tempConfig = copyConfig({}, config2);
    if (config2._useUTC != null) {
      tempConfig._useUTC = config2._useUTC;
    }
    tempConfig._f = config2._f[i2];
    configFromStringAndFormat(tempConfig);
    if (isValid2(tempConfig)) {
      validFormatFound = true;
    }
    currentScore += getParsingFlags(tempConfig).charsLeftOver;
    currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
    getParsingFlags(tempConfig).score = currentScore;
    if (!bestFormatIsValid) {
      if (scoreToBeat == null || currentScore < scoreToBeat || validFormatFound) {
        scoreToBeat = currentScore;
        bestMoment = tempConfig;
        if (validFormatFound) {
          bestFormatIsValid = true;
        }
      }
    } else {
      if (currentScore < scoreToBeat) {
        scoreToBeat = currentScore;
        bestMoment = tempConfig;
      }
    }
  }
  extend$3(config2, bestMoment || tempConfig);
}
function configFromObject(config2) {
  if (config2._d) {
    return;
  }
  var i2 = normalizeObjectUnits(config2._i), dayOrDate = i2.day === void 0 ? i2.date : i2.day;
  config2._a = map(
    [i2.year, i2.month, dayOrDate, i2.hour, i2.minute, i2.second, i2.millisecond],
    function(obj) {
      return obj && parseInt(obj, 10);
    }
  );
  configFromArray(config2);
}
function createFromConfig(config2) {
  var res = new Moment(checkOverflow(prepareConfig(config2)));
  if (res._nextDay) {
    res.add(1, "d");
    res._nextDay = void 0;
  }
  return res;
}
function prepareConfig(config2) {
  var input2 = config2._i, format2 = config2._f;
  config2._locale = config2._locale || getLocale(config2._l);
  if (input2 === null || format2 === void 0 && input2 === "") {
    return createInvalid({ nullInput: true });
  }
  if (typeof input2 === "string") {
    config2._i = input2 = config2._locale.preparse(input2);
  }
  if (isMoment(input2)) {
    return new Moment(checkOverflow(input2));
  } else if (isDate$1(input2)) {
    config2._d = input2;
  } else if (isArray$3(format2)) {
    configFromStringAndArray(config2);
  } else if (format2) {
    configFromStringAndFormat(config2);
  } else {
    configFromInput(config2);
  }
  if (!isValid2(config2)) {
    config2._d = null;
  }
  return config2;
}
function configFromInput(config2) {
  var input2 = config2._i;
  if (isUndefined$1(input2)) {
    config2._d = new Date(hooks.now());
  } else if (isDate$1(input2)) {
    config2._d = new Date(input2.valueOf());
  } else if (typeof input2 === "string") {
    configFromString(config2);
  } else if (isArray$3(input2)) {
    config2._a = map(input2.slice(0), function(obj) {
      return parseInt(obj, 10);
    });
    configFromArray(config2);
  } else if (isObject$2(input2)) {
    configFromObject(config2);
  } else if (isNumber$1(input2)) {
    config2._d = new Date(input2);
  } else {
    hooks.createFromInputFallback(config2);
  }
}
function createLocalOrUTC(input2, format2, locale2, strict, isUTC) {
  var c2 = {};
  if (format2 === true || format2 === false) {
    strict = format2;
    format2 = void 0;
  }
  if (locale2 === true || locale2 === false) {
    strict = locale2;
    locale2 = void 0;
  }
  if (isObject$2(input2) && isObjectEmpty(input2) || isArray$3(input2) && input2.length === 0) {
    input2 = void 0;
  }
  c2._isAMomentObject = true;
  c2._useUTC = c2._isUTC = isUTC;
  c2._l = locale2;
  c2._i = input2;
  c2._f = format2;
  c2._strict = strict;
  return createFromConfig(c2);
}
function createLocal(input2, format2, locale2, strict) {
  return createLocalOrUTC(input2, format2, locale2, strict, false);
}
var prototypeMin = deprecate(
  "moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var other = createLocal.apply(null, arguments);
    if (this.isValid() && other.isValid()) {
      return other < this ? this : other;
    } else {
      return createInvalid();
    }
  }
), prototypeMax = deprecate(
  "moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",
  function() {
    var other = createLocal.apply(null, arguments);
    if (this.isValid() && other.isValid()) {
      return other > this ? this : other;
    } else {
      return createInvalid();
    }
  }
);
function pickBy(fn, moments) {
  var res, i2;
  if (moments.length === 1 && isArray$3(moments[0])) {
    moments = moments[0];
  }
  if (!moments.length) {
    return createLocal();
  }
  res = moments[0];
  for (i2 = 1; i2 < moments.length; ++i2) {
    if (!moments[i2].isValid() || moments[i2][fn](res)) {
      res = moments[i2];
    }
  }
  return res;
}
function min() {
  var args = [].slice.call(arguments, 0);
  return pickBy("isBefore", args);
}
function max() {
  var args = [].slice.call(arguments, 0);
  return pickBy("isAfter", args);
}
var now = function() {
  return Date.now ? Date.now() : +/* @__PURE__ */ new Date();
};
var ordering = [
  "year",
  "quarter",
  "month",
  "week",
  "day",
  "hour",
  "minute",
  "second",
  "millisecond"
];
function isDurationValid(m2) {
  var key, unitHasDecimal = false, i2, orderLen = ordering.length;
  for (key in m2) {
    if (hasOwnProp(m2, key) && !(indexOf.call(ordering, key) !== -1 && (m2[key] == null || !isNaN(m2[key])))) {
      return false;
    }
  }
  for (i2 = 0; i2 < orderLen; ++i2) {
    if (m2[ordering[i2]]) {
      if (unitHasDecimal) {
        return false;
      }
      if (parseFloat(m2[ordering[i2]]) !== toInt(m2[ordering[i2]])) {
        unitHasDecimal = true;
      }
    }
  }
  return true;
}
function isValid$1() {
  return this._isValid;
}
function createInvalid$1() {
  return createDuration(NaN);
}
function Duration(duration2) {
  var normalizedInput = normalizeObjectUnits(duration2), years2 = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months2 = normalizedInput.month || 0, weeks2 = normalizedInput.week || normalizedInput.isoWeek || 0, days2 = normalizedInput.day || 0, hours2 = normalizedInput.hour || 0, minutes2 = normalizedInput.minute || 0, seconds2 = normalizedInput.second || 0, milliseconds2 = normalizedInput.millisecond || 0;
  this._isValid = isDurationValid(normalizedInput);
  this._milliseconds = +milliseconds2 + seconds2 * 1e3 + // 1000
  minutes2 * 6e4 + // 1000 * 60
  hours2 * 1e3 * 60 * 60;
  this._days = +days2 + weeks2 * 7;
  this._months = +months2 + quarters * 3 + years2 * 12;
  this._data = {};
  this._locale = getLocale();
  this._bubble();
}
function isDuration(obj) {
  return obj instanceof Duration;
}
function absRound(number4) {
  if (number4 < 0) {
    return Math.round(-1 * number4) * -1;
  } else {
    return Math.round(number4);
  }
}
function compareArrays(array1, array22, dontConvert) {
  var len = Math.min(array1.length, array22.length), lengthDiff = Math.abs(array1.length - array22.length), diffs = 0, i2;
  for (i2 = 0; i2 < len; i2++) {
    if (toInt(array1[i2]) !== toInt(array22[i2])) {
      diffs++;
    }
  }
  return diffs + lengthDiff;
}
function offset(token2, separator) {
  addFormatToken(token2, 0, 0, function() {
    var offset2 = this.utcOffset(), sign2 = "+";
    if (offset2 < 0) {
      offset2 = -offset2;
      sign2 = "-";
    }
    return sign2 + zeroFill(~~(offset2 / 60), 2) + separator + zeroFill(~~offset2 % 60, 2);
  });
}
offset("Z", ":");
offset("ZZ", "");
addRegexToken("Z", matchShortOffset);
addRegexToken("ZZ", matchShortOffset);
addParseToken(["Z", "ZZ"], function(input2, array4, config2) {
  config2._useUTC = true;
  config2._tzm = offsetFromString(matchShortOffset, input2);
});
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string3) {
  var matches = (string3 || "").match(matcher), chunk, parts, minutes2;
  if (matches === null) {
    return null;
  }
  chunk = matches[matches.length - 1] || [];
  parts = (chunk + "").match(chunkOffset) || ["-", 0, 0];
  minutes2 = +(parts[1] * 60) + toInt(parts[2]);
  return minutes2 === 0 ? 0 : parts[0] === "+" ? minutes2 : -minutes2;
}
function cloneWithOffset(input2, model) {
  var res, diff2;
  if (model._isUTC) {
    res = model.clone();
    diff2 = (isMoment(input2) || isDate$1(input2) ? input2.valueOf() : createLocal(input2).valueOf()) - res.valueOf();
    res._d.setTime(res._d.valueOf() + diff2);
    hooks.updateOffset(res, false);
    return res;
  } else {
    return createLocal(input2).local();
  }
}
function getDateOffset(m2) {
  return -Math.round(m2._d.getTimezoneOffset());
}
hooks.updateOffset = function() {
};
function getSetOffset(input2, keepLocalTime, keepMinutes) {
  var offset2 = this._offset || 0, localAdjust;
  if (!this.isValid()) {
    return input2 != null ? this : NaN;
  }
  if (input2 != null) {
    if (typeof input2 === "string") {
      input2 = offsetFromString(matchShortOffset, input2);
      if (input2 === null) {
        return this;
      }
    } else if (Math.abs(input2) < 16 && !keepMinutes) {
      input2 = input2 * 60;
    }
    if (!this._isUTC && keepLocalTime) {
      localAdjust = getDateOffset(this);
    }
    this._offset = input2;
    this._isUTC = true;
    if (localAdjust != null) {
      this.add(localAdjust, "m");
    }
    if (offset2 !== input2) {
      if (!keepLocalTime || this._changeInProgress) {
        addSubtract(
          this,
          createDuration(input2 - offset2, "m"),
          1,
          false
        );
      } else if (!this._changeInProgress) {
        this._changeInProgress = true;
        hooks.updateOffset(this, true);
        this._changeInProgress = null;
      }
    }
    return this;
  } else {
    return this._isUTC ? offset2 : getDateOffset(this);
  }
}
function getSetZone(input2, keepLocalTime) {
  if (input2 != null) {
    if (typeof input2 !== "string") {
      input2 = -input2;
    }
    this.utcOffset(input2, keepLocalTime);
    return this;
  } else {
    return -this.utcOffset();
  }
}
function setOffsetToUTC(keepLocalTime) {
  return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal(keepLocalTime) {
  if (this._isUTC) {
    this.utcOffset(0, keepLocalTime);
    this._isUTC = false;
    if (keepLocalTime) {
      this.subtract(getDateOffset(this), "m");
    }
  }
  return this;
}
function setOffsetToParsedOffset() {
  if (this._tzm != null) {
    this.utcOffset(this._tzm, false, true);
  } else if (typeof this._i === "string") {
    var tZone = offsetFromString(matchOffset, this._i);
    if (tZone != null) {
      this.utcOffset(tZone);
    } else {
      this.utcOffset(0, true);
    }
  }
  return this;
}
function hasAlignedHourOffset(input2) {
  if (!this.isValid()) {
    return false;
  }
  input2 = input2 ? createLocal(input2).utcOffset() : 0;
  return (this.utcOffset() - input2) % 60 === 0;
}
function isDaylightSavingTime() {
  return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
}
function isDaylightSavingTimeShifted() {
  if (!isUndefined$1(this._isDSTShifted)) {
    return this._isDSTShifted;
  }
  var c2 = {}, other;
  copyConfig(c2, this);
  c2 = prepareConfig(c2);
  if (c2._a) {
    other = c2._isUTC ? createUTC(c2._a) : createLocal(c2._a);
    this._isDSTShifted = this.isValid() && compareArrays(c2._a, other.toArray()) > 0;
  } else {
    this._isDSTShifted = false;
  }
  return this._isDSTShifted;
}
function isLocal() {
  return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset() {
  return this.isValid() ? this._isUTC : false;
}
function isUtc() {
  return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration(input2, key) {
  var duration2 = input2, match5 = null, sign2, ret, diffRes;
  if (isDuration(input2)) {
    duration2 = {
      ms: input2._milliseconds,
      d: input2._days,
      M: input2._months
    };
  } else if (isNumber$1(input2) || !isNaN(+input2)) {
    duration2 = {};
    if (key) {
      duration2[key] = +input2;
    } else {
      duration2.milliseconds = +input2;
    }
  } else if (match5 = aspNetRegex.exec(input2)) {
    sign2 = match5[1] === "-" ? -1 : 1;
    duration2 = {
      y: 0,
      d: toInt(match5[DATE$1]) * sign2,
      h: toInt(match5[HOUR]) * sign2,
      m: toInt(match5[MINUTE]) * sign2,
      s: toInt(match5[SECOND]) * sign2,
      ms: toInt(absRound(match5[MILLISECOND] * 1e3)) * sign2
      // the millisecond decimal point is included in the match
    };
  } else if (match5 = isoRegex.exec(input2)) {
    sign2 = match5[1] === "-" ? -1 : 1;
    duration2 = {
      y: parseIso(match5[2], sign2),
      M: parseIso(match5[3], sign2),
      w: parseIso(match5[4], sign2),
      d: parseIso(match5[5], sign2),
      h: parseIso(match5[6], sign2),
      m: parseIso(match5[7], sign2),
      s: parseIso(match5[8], sign2)
    };
  } else if (duration2 == null) {
    duration2 = {};
  } else if (typeof duration2 === "object" && ("from" in duration2 || "to" in duration2)) {
    diffRes = momentsDifference(
      createLocal(duration2.from),
      createLocal(duration2.to)
    );
    duration2 = {};
    duration2.ms = diffRes.milliseconds;
    duration2.M = diffRes.months;
  }
  ret = new Duration(duration2);
  if (isDuration(input2) && hasOwnProp(input2, "_locale")) {
    ret._locale = input2._locale;
  }
  if (isDuration(input2) && hasOwnProp(input2, "_isValid")) {
    ret._isValid = input2._isValid;
  }
  return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso(inp, sign2) {
  var res = inp && parseFloat(inp.replace(",", "."));
  return (isNaN(res) ? 0 : res) * sign2;
}
function positiveMomentsDifference(base, other) {
  var res = {};
  res.months = other.month() - base.month() + (other.year() - base.year()) * 12;
  if (base.clone().add(res.months, "M").isAfter(other)) {
    --res.months;
  }
  res.milliseconds = +other - +base.clone().add(res.months, "M");
  return res;
}
function momentsDifference(base, other) {
  var res;
  if (!(base.isValid() && other.isValid())) {
    return { milliseconds: 0, months: 0 };
  }
  other = cloneWithOffset(other, base);
  if (base.isBefore(other)) {
    res = positiveMomentsDifference(base, other);
  } else {
    res = positiveMomentsDifference(other, base);
    res.milliseconds = -res.milliseconds;
    res.months = -res.months;
  }
  return res;
}
function createAdder(direction, name2) {
  return function(val, period) {
    var dur, tmp;
    if (period !== null && !isNaN(+period)) {
      deprecateSimple(
        name2,
        "moment()." + name2 + "(period, number) is deprecated. Please use moment()." + name2 + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."
      );
      tmp = val;
      val = period;
      period = tmp;
    }
    dur = createDuration(val, period);
    addSubtract(this, dur, direction);
    return this;
  };
}
function addSubtract(mom, duration2, isAdding, updateOffset) {
  var milliseconds2 = duration2._milliseconds, days2 = absRound(duration2._days), months2 = absRound(duration2._months);
  if (!mom.isValid()) {
    return;
  }
  updateOffset = updateOffset == null ? true : updateOffset;
  if (months2) {
    setMonth(mom, get$2(mom, "Month") + months2 * isAdding);
  }
  if (days2) {
    set$1(mom, "Date", get$2(mom, "Date") + days2 * isAdding);
  }
  if (milliseconds2) {
    mom._d.setTime(mom._d.valueOf() + milliseconds2 * isAdding);
  }
  if (updateOffset) {
    hooks.updateOffset(mom, days2 || months2);
  }
}
var add$1 = createAdder(1, "add"), subtract$1 = createAdder(-1, "subtract");
function isString$1(input2) {
  return typeof input2 === "string" || input2 instanceof String;
}
function isMomentInput(input2) {
  return isMoment(input2) || isDate$1(input2) || isString$1(input2) || isNumber$1(input2) || isNumberOrStringArray(input2) || isMomentInputObject(input2) || input2 === null || input2 === void 0;
}
function isMomentInputObject(input2) {
  var objectTest = isObject$2(input2) && !isObjectEmpty(input2), propertyTest = false, properties2 = [
    "years",
    "year",
    "y",
    "months",
    "month",
    "M",
    "days",
    "day",
    "d",
    "dates",
    "date",
    "D",
    "hours",
    "hour",
    "h",
    "minutes",
    "minute",
    "m",
    "seconds",
    "second",
    "s",
    "milliseconds",
    "millisecond",
    "ms"
  ], i2, property2, propertyLen = properties2.length;
  for (i2 = 0; i2 < propertyLen; i2 += 1) {
    property2 = properties2[i2];
    propertyTest = propertyTest || hasOwnProp(input2, property2);
  }
  return objectTest && propertyTest;
}
function isNumberOrStringArray(input2) {
  var arrayTest = isArray$3(input2), dataTypeTest = false;
  if (arrayTest) {
    dataTypeTest = input2.filter(function(item) {
      return !isNumber$1(item) && isString$1(input2);
    }).length === 0;
  }
  return arrayTest && dataTypeTest;
}
function isCalendarSpec(input2) {
  var objectTest = isObject$2(input2) && !isObjectEmpty(input2), propertyTest = false, properties2 = [
    "sameDay",
    "nextDay",
    "lastDay",
    "nextWeek",
    "lastWeek",
    "sameElse"
  ], i2, property2;
  for (i2 = 0; i2 < properties2.length; i2 += 1) {
    property2 = properties2[i2];
    propertyTest = propertyTest || hasOwnProp(input2, property2);
  }
  return objectTest && propertyTest;
}
function getCalendarFormat(myMoment, now2) {
  var diff2 = myMoment.diff(now2, "days", true);
  return diff2 < -6 ? "sameElse" : diff2 < -1 ? "lastWeek" : diff2 < 0 ? "lastDay" : diff2 < 1 ? "sameDay" : diff2 < 2 ? "nextDay" : diff2 < 7 ? "nextWeek" : "sameElse";
}
function calendar$1(time2, formats) {
  if (arguments.length === 1) {
    if (!arguments[0]) {
      time2 = void 0;
      formats = void 0;
    } else if (isMomentInput(arguments[0])) {
      time2 = arguments[0];
      formats = void 0;
    } else if (isCalendarSpec(arguments[0])) {
      formats = arguments[0];
      time2 = void 0;
    }
  }
  var now2 = time2 || createLocal(), sod = cloneWithOffset(now2, this).startOf("day"), format2 = hooks.calendarFormat(this, sod) || "sameElse", output2 = formats && (isFunction$2(formats[format2]) ? formats[format2].call(this, now2) : formats[format2]);
  return this.format(
    output2 || this.localeData().calendar(format2, this, createLocal(now2))
  );
}
function clone2() {
  return new Moment(this);
}
function isAfter$1(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2);
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() > localInput.valueOf();
  } else {
    return localInput.valueOf() < this.clone().startOf(units).valueOf();
  }
}
function isBefore(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2);
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() < localInput.valueOf();
  } else {
    return this.clone().endOf(units).valueOf() < localInput.valueOf();
  }
}
function isBetween(from2, to2, units, inclusivity) {
  var localFrom = isMoment(from2) ? from2 : createLocal(from2), localTo = isMoment(to2) ? to2 : createLocal(to2);
  if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
    return false;
  }
  inclusivity = inclusivity || "()";
  return (inclusivity[0] === "(" ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) && (inclusivity[1] === ")" ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
}
function isSame(input2, units) {
  var localInput = isMoment(input2) ? input2 : createLocal(input2), inputMs;
  if (!(this.isValid() && localInput.isValid())) {
    return false;
  }
  units = normalizeUnits(units) || "millisecond";
  if (units === "millisecond") {
    return this.valueOf() === localInput.valueOf();
  } else {
    inputMs = localInput.valueOf();
    return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
  }
}
function isSameOrAfter(input2, units) {
  return this.isSame(input2, units) || this.isAfter(input2, units);
}
function isSameOrBefore(input2, units) {
  return this.isSame(input2, units) || this.isBefore(input2, units);
}
function diff$2(input2, units, asFloat) {
  var that, zoneDelta, output2;
  if (!this.isValid()) {
    return NaN;
  }
  that = cloneWithOffset(input2, this);
  if (!that.isValid()) {
    return NaN;
  }
  zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
  units = normalizeUnits(units);
  switch (units) {
    case "year":
      output2 = monthDiff(this, that) / 12;
      break;
    case "month":
      output2 = monthDiff(this, that);
      break;
    case "quarter":
      output2 = monthDiff(this, that) / 3;
      break;
    case "second":
      output2 = (this - that) / 1e3;
      break;
    case "minute":
      output2 = (this - that) / 6e4;
      break;
    case "hour":
      output2 = (this - that) / 36e5;
      break;
    case "day":
      output2 = (this - that - zoneDelta) / 864e5;
      break;
    case "week":
      output2 = (this - that - zoneDelta) / 6048e5;
      break;
    default:
      output2 = this - that;
  }
  return asFloat ? output2 : absFloor(output2);
}
function monthDiff(a2, b2) {
  if (a2.date() < b2.date()) {
    return -monthDiff(b2, a2);
  }
  var wholeMonthDiff = (b2.year() - a2.year()) * 12 + (b2.month() - a2.month()), anchor = a2.clone().add(wholeMonthDiff, "months"), anchor2, adjust;
  if (b2 - anchor < 0) {
    anchor2 = a2.clone().add(wholeMonthDiff - 1, "months");
    adjust = (b2 - anchor) / (anchor - anchor2);
  } else {
    anchor2 = a2.clone().add(wholeMonthDiff + 1, "months");
    adjust = (b2 - anchor) / (anchor2 - anchor);
  }
  return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ";
hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
function toString$4() {
  return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
}
function toISOString(keepOffset) {
  if (!this.isValid()) {
    return null;
  }
  var utc = keepOffset !== true, m2 = utc ? this.clone().utc() : this;
  if (m2.year() < 0 || m2.year() > 9999) {
    return formatMoment(
      m2,
      utc ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"
    );
  }
  if (isFunction$2(Date.prototype.toISOString)) {
    if (utc) {
      return this.toDate().toISOString();
    } else {
      return new Date(this.valueOf() + this.utcOffset() * 60 * 1e3).toISOString().replace("Z", formatMoment(m2, "Z"));
    }
  }
  return formatMoment(
    m2,
    utc ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"
  );
}
function inspect() {
  if (!this.isValid()) {
    return "moment.invalid(/* " + this._i + " */)";
  }
  var func = "moment", zone = "", prefix, year, datetime, suffix;
  if (!this.isLocal()) {
    func = this.utcOffset() === 0 ? "moment.utc" : "moment.parseZone";
    zone = "Z";
  }
  prefix = "[" + func + '("]';
  year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY";
  datetime = "-MM-DD[T]HH:mm:ss.SSS";
  suffix = zone + '[")]';
  return this.format(prefix + year + datetime + suffix);
}
function format(inputString) {
  if (!inputString) {
    inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
  }
  var output2 = formatMoment(this, inputString);
  return this.localeData().postformat(output2);
}
function from(time2, withoutSuffix) {
  if (this.isValid() && (isMoment(time2) && time2.isValid() || createLocal(time2).isValid())) {
    return createDuration({ to: this, from: time2 }).locale(this.locale()).humanize(!withoutSuffix);
  } else {
    return this.localeData().invalidDate();
  }
}
function fromNow(withoutSuffix) {
  return this.from(createLocal(), withoutSuffix);
}
function to(time2, withoutSuffix) {
  if (this.isValid() && (isMoment(time2) && time2.isValid() || createLocal(time2).isValid())) {
    return createDuration({ from: this, to: time2 }).locale(this.locale()).humanize(!withoutSuffix);
  } else {
    return this.localeData().invalidDate();
  }
}
function toNow(withoutSuffix) {
  return this.to(createLocal(), withoutSuffix);
}
function locale(key) {
  var newLocaleData;
  if (key === void 0) {
    return this._locale._abbr;
  } else {
    newLocaleData = getLocale(key);
    if (newLocaleData != null) {
      this._locale = newLocaleData;
    }
    return this;
  }
}
var lang = deprecate(
  "moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",
  function(key) {
    if (key === void 0) {
      return this.localeData();
    } else {
      return this.locale(key);
    }
  }
);
function localeData() {
  return this._locale;
}
var MS_PER_SECOND = 1e3, MS_PER_MINUTE = 60 * MS_PER_SECOND, MS_PER_HOUR = 60 * MS_PER_MINUTE, MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
function mod$1(dividend, divisor) {
  return (dividend % divisor + divisor) % divisor;
}
function localStartOfDate(y2, m2, d2) {
  if (y2 < 100 && y2 >= 0) {
    return new Date(y2 + 400, m2, d2) - MS_PER_400_YEARS;
  } else {
    return new Date(y2, m2, d2).valueOf();
  }
}
function utcStartOfDate(y2, m2, d2) {
  if (y2 < 100 && y2 >= 0) {
    return Date.UTC(y2 + 400, m2, d2) - MS_PER_400_YEARS;
  } else {
    return Date.UTC(y2, m2, d2);
  }
}
function startOf(units) {
  var time2, startOfDate;
  units = normalizeUnits(units);
  if (units === void 0 || units === "millisecond" || !this.isValid()) {
    return this;
  }
  startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  switch (units) {
    case "year":
      time2 = startOfDate(this.year(), 0, 1);
      break;
    case "quarter":
      time2 = startOfDate(
        this.year(),
        this.month() - this.month() % 3,
        1
      );
      break;
    case "month":
      time2 = startOfDate(this.year(), this.month(), 1);
      break;
    case "week":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - this.weekday()
      );
      break;
    case "isoWeek":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1)
      );
      break;
    case "day":
    case "date":
      time2 = startOfDate(this.year(), this.month(), this.date());
      break;
    case "hour":
      time2 = this._d.valueOf();
      time2 -= mod$1(
        time2 + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
        MS_PER_HOUR
      );
      break;
    case "minute":
      time2 = this._d.valueOf();
      time2 -= mod$1(time2, MS_PER_MINUTE);
      break;
    case "second":
      time2 = this._d.valueOf();
      time2 -= mod$1(time2, MS_PER_SECOND);
      break;
  }
  this._d.setTime(time2);
  hooks.updateOffset(this, true);
  return this;
}
function endOf(units) {
  var time2, startOfDate;
  units = normalizeUnits(units);
  if (units === void 0 || units === "millisecond" || !this.isValid()) {
    return this;
  }
  startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
  switch (units) {
    case "year":
      time2 = startOfDate(this.year() + 1, 0, 1) - 1;
      break;
    case "quarter":
      time2 = startOfDate(
        this.year(),
        this.month() - this.month() % 3 + 3,
        1
      ) - 1;
      break;
    case "month":
      time2 = startOfDate(this.year(), this.month() + 1, 1) - 1;
      break;
    case "week":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - this.weekday() + 7
      ) - 1;
      break;
    case "isoWeek":
      time2 = startOfDate(
        this.year(),
        this.month(),
        this.date() - (this.isoWeekday() - 1) + 7
      ) - 1;
      break;
    case "day":
    case "date":
      time2 = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
      break;
    case "hour":
      time2 = this._d.valueOf();
      time2 += MS_PER_HOUR - mod$1(
        time2 + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
        MS_PER_HOUR
      ) - 1;
      break;
    case "minute":
      time2 = this._d.valueOf();
      time2 += MS_PER_MINUTE - mod$1(time2, MS_PER_MINUTE) - 1;
      break;
    case "second":
      time2 = this._d.valueOf();
      time2 += MS_PER_SECOND - mod$1(time2, MS_PER_SECOND) - 1;
      break;
  }
  this._d.setTime(time2);
  hooks.updateOffset(this, true);
  return this;
}
function valueOf() {
  return this._d.valueOf() - (this._offset || 0) * 6e4;
}
function unix() {
  return Math.floor(this.valueOf() / 1e3);
}
function toDate() {
  return new Date(this.valueOf());
}
function toArray$1() {
  var m2 = this;
  return [
    m2.year(),
    m2.month(),
    m2.date(),
    m2.hour(),
    m2.minute(),
    m2.second(),
    m2.millisecond()
  ];
}
function toObject() {
  var m2 = this;
  return {
    years: m2.year(),
    months: m2.month(),
    date: m2.date(),
    hours: m2.hours(),
    minutes: m2.minutes(),
    seconds: m2.seconds(),
    milliseconds: m2.milliseconds()
  };
}
function toJSON() {
  return this.isValid() ? this.toISOString() : null;
}
function isValid$2() {
  return isValid2(this);
}
function parsingFlags() {
  return extend$3({}, getParsingFlags(this));
}
function invalidAt() {
  return getParsingFlags(this).overflow;
}
function creationData() {
  return {
    input: this._i,
    format: this._f,
    locale: this._locale,
    isUTC: this._isUTC,
    strict: this._strict
  };
}
addFormatToken("N", 0, 0, "eraAbbr");
addFormatToken("NN", 0, 0, "eraAbbr");
addFormatToken("NNN", 0, 0, "eraAbbr");
addFormatToken("NNNN", 0, 0, "eraName");
addFormatToken("NNNNN", 0, 0, "eraNarrow");
addFormatToken("y", ["y", 1], "yo", "eraYear");
addFormatToken("y", ["yy", 2], 0, "eraYear");
addFormatToken("y", ["yyy", 3], 0, "eraYear");
addFormatToken("y", ["yyyy", 4], 0, "eraYear");
addRegexToken("N", matchEraAbbr);
addRegexToken("NN", matchEraAbbr);
addRegexToken("NNN", matchEraAbbr);
addRegexToken("NNNN", matchEraName);
addRegexToken("NNNNN", matchEraNarrow);
addParseToken(
  ["N", "NN", "NNN", "NNNN", "NNNNN"],
  function(input2, array4, config2, token2) {
    var era = config2._locale.erasParse(input2, token2, config2._strict);
    if (era) {
      getParsingFlags(config2).era = era;
    } else {
      getParsingFlags(config2).invalidEra = input2;
    }
  }
);
addRegexToken("y", matchUnsigned);
addRegexToken("yy", matchUnsigned);
addRegexToken("yyy", matchUnsigned);
addRegexToken("yyyy", matchUnsigned);
addRegexToken("yo", matchEraYearOrdinal);
addParseToken(["y", "yy", "yyy", "yyyy"], YEAR);
addParseToken(["yo"], function(input2, array4, config2, token2) {
  var match5;
  if (config2._locale._eraYearOrdinalRegex) {
    match5 = input2.match(config2._locale._eraYearOrdinalRegex);
  }
  if (config2._locale.eraYearOrdinalParse) {
    array4[YEAR] = config2._locale.eraYearOrdinalParse(input2, match5);
  } else {
    array4[YEAR] = parseInt(input2, 10);
  }
});
function localeEras(m2, format2) {
  var i2, l2, date4, eras = this._eras || getLocale("en")._eras;
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    switch (typeof eras[i2].since) {
      case "string":
        date4 = hooks(eras[i2].since).startOf("day");
        eras[i2].since = date4.valueOf();
        break;
    }
    switch (typeof eras[i2].until) {
      case "undefined":
        eras[i2].until = Infinity;
        break;
      case "string":
        date4 = hooks(eras[i2].until).startOf("day").valueOf();
        eras[i2].until = date4.valueOf();
        break;
    }
  }
  return eras;
}
function localeErasParse(eraName, format2, strict) {
  var i2, l2, eras = this.eras(), name2, abbr, narrow;
  eraName = eraName.toUpperCase();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    name2 = eras[i2].name.toUpperCase();
    abbr = eras[i2].abbr.toUpperCase();
    narrow = eras[i2].narrow.toUpperCase();
    if (strict) {
      switch (format2) {
        case "N":
        case "NN":
        case "NNN":
          if (abbr === eraName) {
            return eras[i2];
          }
          break;
        case "NNNN":
          if (name2 === eraName) {
            return eras[i2];
          }
          break;
        case "NNNNN":
          if (narrow === eraName) {
            return eras[i2];
          }
          break;
      }
    } else if ([name2, abbr, narrow].indexOf(eraName) >= 0) {
      return eras[i2];
    }
  }
}
function localeErasConvertYear(era, year) {
  var dir = era.since <= era.until ? 1 : -1;
  if (year === void 0) {
    return hooks(era.since).year();
  } else {
    return hooks(era.since).year() + (year - era.offset) * dir;
  }
}
function getEraName() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].name;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].name;
    }
  }
  return "";
}
function getEraNarrow() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].narrow;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].narrow;
    }
  }
  return "";
}
function getEraAbbr() {
  var i2, l2, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until) {
      return eras[i2].abbr;
    }
    if (eras[i2].until <= val && val <= eras[i2].since) {
      return eras[i2].abbr;
    }
  }
  return "";
}
function getEraYear() {
  var i2, l2, dir, val, eras = this.localeData().eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    dir = eras[i2].since <= eras[i2].until ? 1 : -1;
    val = this.clone().startOf("day").valueOf();
    if (eras[i2].since <= val && val <= eras[i2].until || eras[i2].until <= val && val <= eras[i2].since) {
      return (this.year() - hooks(eras[i2].since).year()) * dir + eras[i2].offset;
    }
  }
  return this.year();
}
function erasNameRegex(isStrict) {
  if (!hasOwnProp(this, "_erasNameRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasNameRegex : this._erasRegex;
}
function erasAbbrRegex(isStrict) {
  if (!hasOwnProp(this, "_erasAbbrRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasAbbrRegex : this._erasRegex;
}
function erasNarrowRegex(isStrict) {
  if (!hasOwnProp(this, "_erasNarrowRegex")) {
    computeErasParse.call(this);
  }
  return isStrict ? this._erasNarrowRegex : this._erasRegex;
}
function matchEraAbbr(isStrict, locale2) {
  return locale2.erasAbbrRegex(isStrict);
}
function matchEraName(isStrict, locale2) {
  return locale2.erasNameRegex(isStrict);
}
function matchEraNarrow(isStrict, locale2) {
  return locale2.erasNarrowRegex(isStrict);
}
function matchEraYearOrdinal(isStrict, locale2) {
  return locale2._eraYearOrdinalRegex || matchUnsigned;
}
function computeErasParse() {
  var abbrPieces = [], namePieces = [], narrowPieces = [], mixedPieces = [], i2, l2, erasName, erasAbbr, erasNarrow, eras = this.eras();
  for (i2 = 0, l2 = eras.length; i2 < l2; ++i2) {
    erasName = regexEscape(eras[i2].name);
    erasAbbr = regexEscape(eras[i2].abbr);
    erasNarrow = regexEscape(eras[i2].narrow);
    namePieces.push(erasName);
    abbrPieces.push(erasAbbr);
    narrowPieces.push(erasNarrow);
    mixedPieces.push(erasName);
    mixedPieces.push(erasAbbr);
    mixedPieces.push(erasNarrow);
  }
  this._erasRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i");
  this._erasNameRegex = new RegExp("^(" + namePieces.join("|") + ")", "i");
  this._erasAbbrRegex = new RegExp("^(" + abbrPieces.join("|") + ")", "i");
  this._erasNarrowRegex = new RegExp(
    "^(" + narrowPieces.join("|") + ")",
    "i"
  );
}
addFormatToken(0, ["gg", 2], 0, function() {
  return this.weekYear() % 100;
});
addFormatToken(0, ["GG", 2], 0, function() {
  return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken(token2, getter) {
  addFormatToken(0, [token2, token2.length], 0, getter);
}
addWeekYearFormatToken("gggg", "weekYear");
addWeekYearFormatToken("ggggg", "weekYear");
addWeekYearFormatToken("GGGG", "isoWeekYear");
addWeekYearFormatToken("GGGGG", "isoWeekYear");
addRegexToken("G", matchSigned);
addRegexToken("g", matchSigned);
addRegexToken("GG", match1to2, match2);
addRegexToken("gg", match1to2, match2);
addRegexToken("GGGG", match1to4, match4);
addRegexToken("gggg", match1to4, match4);
addRegexToken("GGGGG", match1to6, match6);
addRegexToken("ggggg", match1to6, match6);
addWeekParseToken(
  ["gggg", "ggggg", "GGGG", "GGGGG"],
  function(input2, week, config2, token2) {
    week[token2.substr(0, 2)] = toInt(input2);
  }
);
addWeekParseToken(["gg", "GG"], function(input2, week, config2, token2) {
  week[token2] = hooks.parseTwoDigitYear(input2);
});
function getSetWeekYear(input2) {
  return getSetWeekYearHelper.call(
    this,
    input2,
    this.week(),
    this.weekday() + this.localeData()._week.dow,
    this.localeData()._week.dow,
    this.localeData()._week.doy
  );
}
function getSetISOWeekYear(input2) {
  return getSetWeekYearHelper.call(
    this,
    input2,
    this.isoWeek(),
    this.isoWeekday(),
    1,
    4
  );
}
function getISOWeeksInYear() {
  return weeksInYear(this.year(), 1, 4);
}
function getISOWeeksInISOWeekYear() {
  return weeksInYear(this.isoWeekYear(), 1, 4);
}
function getWeeksInYear() {
  var weekInfo = this.localeData()._week;
  return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getWeeksInWeekYear() {
  var weekInfo = this.localeData()._week;
  return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input2, week, weekday, dow, doy) {
  var weeksTarget;
  if (input2 == null) {
    return weekOfYear(this, dow, doy).year;
  } else {
    weeksTarget = weeksInYear(input2, dow, doy);
    if (week > weeksTarget) {
      week = weeksTarget;
    }
    return setWeekAll.call(this, input2, week, weekday, dow, doy);
  }
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
  var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date4 = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
  this.year(date4.getUTCFullYear());
  this.month(date4.getUTCMonth());
  this.date(date4.getUTCDate());
  return this;
}
addFormatToken("Q", 0, "Qo", "quarter");
addRegexToken("Q", match1);
addParseToken("Q", function(input2, array4) {
  array4[MONTH] = (toInt(input2) - 1) * 3;
});
function getSetQuarter(input2) {
  return input2 == null ? Math.ceil((this.month() + 1) / 3) : this.month((input2 - 1) * 3 + this.month() % 3);
}
addFormatToken("D", ["DD", 2], "Do", "date");
addRegexToken("D", match1to2, match1to2NoLeadingZero);
addRegexToken("DD", match1to2, match2);
addRegexToken("Do", function(isStrict, locale2) {
  return isStrict ? locale2._dayOfMonthOrdinalParse || locale2._ordinalParse : locale2._dayOfMonthOrdinalParseLenient;
});
addParseToken(["D", "DD"], DATE$1);
addParseToken("Do", function(input2, array4) {
  array4[DATE$1] = toInt(input2.match(match1to2)[0]);
});
var getSetDayOfMonth = makeGetSet("Date", true);
addFormatToken("DDD", ["DDDD", 3], "DDDo", "dayOfYear");
addRegexToken("DDD", match1to3);
addRegexToken("DDDD", match3);
addParseToken(["DDD", "DDDD"], function(input2, array4, config2) {
  config2._dayOfYear = toInt(input2);
});
function getSetDayOfYear(input2) {
  var dayOfYear = Math.round(
    (this.clone().startOf("day") - this.clone().startOf("year")) / 864e5
  ) + 1;
  return input2 == null ? dayOfYear : this.add(input2 - dayOfYear, "d");
}
addFormatToken("m", ["mm", 2], 0, "minute");
addRegexToken("m", match1to2, match1to2HasZero);
addRegexToken("mm", match1to2, match2);
addParseToken(["m", "mm"], MINUTE);
var getSetMinute = makeGetSet("Minutes", false);
addFormatToken("s", ["ss", 2], 0, "second");
addRegexToken("s", match1to2, match1to2HasZero);
addRegexToken("ss", match1to2, match2);
addParseToken(["s", "ss"], SECOND);
var getSetSecond = makeGetSet("Seconds", false);
addFormatToken("S", 0, 0, function() {
  return ~~(this.millisecond() / 100);
});
addFormatToken(0, ["SS", 2], 0, function() {
  return ~~(this.millisecond() / 10);
});
addFormatToken(0, ["SSS", 3], 0, "millisecond");
addFormatToken(0, ["SSSS", 4], 0, function() {
  return this.millisecond() * 10;
});
addFormatToken(0, ["SSSSS", 5], 0, function() {
  return this.millisecond() * 100;
});
addFormatToken(0, ["SSSSSS", 6], 0, function() {
  return this.millisecond() * 1e3;
});
addFormatToken(0, ["SSSSSSS", 7], 0, function() {
  return this.millisecond() * 1e4;
});
addFormatToken(0, ["SSSSSSSS", 8], 0, function() {
  return this.millisecond() * 1e5;
});
addFormatToken(0, ["SSSSSSSSS", 9], 0, function() {
  return this.millisecond() * 1e6;
});
addRegexToken("S", match1to3, match1);
addRegexToken("SS", match1to3, match2);
addRegexToken("SSS", match1to3, match3);
var token, getSetMillisecond;
for (token = "SSSS"; token.length <= 9; token += "S") {
  addRegexToken(token, matchUnsigned);
}
function parseMs(input2, array4) {
  array4[MILLISECOND] = toInt(("0." + input2) * 1e3);
}
for (token = "S"; token.length <= 9; token += "S") {
  addParseToken(token, parseMs);
}
getSetMillisecond = makeGetSet("Milliseconds", false);
addFormatToken("z", 0, 0, "zoneAbbr");
addFormatToken("zz", 0, 0, "zoneName");
function getZoneAbbr() {
  return this._isUTC ? "UTC" : "";
}
function getZoneName() {
  return this._isUTC ? "Coordinated Universal Time" : "";
}
var proto$1 = Moment.prototype;
proto$1.add = add$1;
proto$1.calendar = calendar$1;
proto$1.clone = clone2;
proto$1.diff = diff$2;
proto$1.endOf = endOf;
proto$1.format = format;
proto$1.from = from;
proto$1.fromNow = fromNow;
proto$1.to = to;
proto$1.toNow = toNow;
proto$1.get = stringGet;
proto$1.invalidAt = invalidAt;
proto$1.isAfter = isAfter$1;
proto$1.isBefore = isBefore;
proto$1.isBetween = isBetween;
proto$1.isSame = isSame;
proto$1.isSameOrAfter = isSameOrAfter;
proto$1.isSameOrBefore = isSameOrBefore;
proto$1.isValid = isValid$2;
proto$1.lang = lang;
proto$1.locale = locale;
proto$1.localeData = localeData;
proto$1.max = prototypeMax;
proto$1.min = prototypeMin;
proto$1.parsingFlags = parsingFlags;
proto$1.set = stringSet;
proto$1.startOf = startOf;
proto$1.subtract = subtract$1;
proto$1.toArray = toArray$1;
proto$1.toObject = toObject;
proto$1.toDate = toDate;
proto$1.toISOString = toISOString;
proto$1.inspect = inspect;
if (typeof Symbol !== "undefined" && Symbol.for != null) {
  proto$1[Symbol.for("nodejs.util.inspect.custom")] = function() {
    return "Moment<" + this.format() + ">";
  };
}
proto$1.toJSON = toJSON;
proto$1.toString = toString$4;
proto$1.unix = unix;
proto$1.valueOf = valueOf;
proto$1.creationData = creationData;
proto$1.eraName = getEraName;
proto$1.eraNarrow = getEraNarrow;
proto$1.eraAbbr = getEraAbbr;
proto$1.eraYear = getEraYear;
proto$1.year = getSetYear;
proto$1.isLeapYear = getIsLeapYear;
proto$1.weekYear = getSetWeekYear;
proto$1.isoWeekYear = getSetISOWeekYear;
proto$1.quarter = proto$1.quarters = getSetQuarter;
proto$1.month = getSetMonth;
proto$1.daysInMonth = getDaysInMonth;
proto$1.week = proto$1.weeks = getSetWeek;
proto$1.isoWeek = proto$1.isoWeeks = getSetISOWeek;
proto$1.weeksInYear = getWeeksInYear;
proto$1.weeksInWeekYear = getWeeksInWeekYear;
proto$1.isoWeeksInYear = getISOWeeksInYear;
proto$1.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
proto$1.date = getSetDayOfMonth;
proto$1.day = proto$1.days = getSetDayOfWeek;
proto$1.weekday = getSetLocaleDayOfWeek;
proto$1.isoWeekday = getSetISODayOfWeek;
proto$1.dayOfYear = getSetDayOfYear;
proto$1.hour = proto$1.hours = getSetHour;
proto$1.minute = proto$1.minutes = getSetMinute;
proto$1.second = proto$1.seconds = getSetSecond;
proto$1.millisecond = proto$1.milliseconds = getSetMillisecond;
proto$1.utcOffset = getSetOffset;
proto$1.utc = setOffsetToUTC;
proto$1.local = setOffsetToLocal;
proto$1.parseZone = setOffsetToParsedOffset;
proto$1.hasAlignedHourOffset = hasAlignedHourOffset;
proto$1.isDST = isDaylightSavingTime;
proto$1.isLocal = isLocal;
proto$1.isUtcOffset = isUtcOffset;
proto$1.isUtc = isUtc;
proto$1.isUTC = isUtc;
proto$1.zoneAbbr = getZoneAbbr;
proto$1.zoneName = getZoneName;
proto$1.dates = deprecate(
  "dates accessor is deprecated. Use date instead.",
  getSetDayOfMonth
);
proto$1.months = deprecate(
  "months accessor is deprecated. Use month instead",
  getSetMonth
);
proto$1.years = deprecate(
  "years accessor is deprecated. Use year instead",
  getSetYear
);
proto$1.zone = deprecate(
  "moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",
  getSetZone
);
proto$1.isDSTShifted = deprecate(
  "isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",
  isDaylightSavingTimeShifted
);
function createUnix(input2) {
  return createLocal(input2 * 1e3);
}
function createInZone() {
  return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat(string3) {
  return string3;
}
var proto$1$1 = Locale.prototype;
proto$1$1.calendar = calendar;
proto$1$1.longDateFormat = longDateFormat;
proto$1$1.invalidDate = invalidDate;
proto$1$1.ordinal = ordinal;
proto$1$1.preparse = preParsePostFormat;
proto$1$1.postformat = preParsePostFormat;
proto$1$1.relativeTime = relativeTime;
proto$1$1.pastFuture = pastFuture;
proto$1$1.set = set;
proto$1$1.eras = localeEras;
proto$1$1.erasParse = localeErasParse;
proto$1$1.erasConvertYear = localeErasConvertYear;
proto$1$1.erasAbbrRegex = erasAbbrRegex;
proto$1$1.erasNameRegex = erasNameRegex;
proto$1$1.erasNarrowRegex = erasNarrowRegex;
proto$1$1.months = localeMonths;
proto$1$1.monthsShort = localeMonthsShort;
proto$1$1.monthsParse = localeMonthsParse;
proto$1$1.monthsRegex = monthsRegex;
proto$1$1.monthsShortRegex = monthsShortRegex;
proto$1$1.week = localeWeek;
proto$1$1.firstDayOfYear = localeFirstDayOfYear;
proto$1$1.firstDayOfWeek = localeFirstDayOfWeek;
proto$1$1.weekdays = localeWeekdays;
proto$1$1.weekdaysMin = localeWeekdaysMin;
proto$1$1.weekdaysShort = localeWeekdaysShort;
proto$1$1.weekdaysParse = localeWeekdaysParse;
proto$1$1.weekdaysRegex = weekdaysRegex;
proto$1$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1$1.weekdaysMinRegex = weekdaysMinRegex;
proto$1$1.isPM = localeIsPM;
proto$1$1.meridiem = localeMeridiem;
function get$1$1(format2, index2, field, setter) {
  var locale2 = getLocale(), utc = createUTC().set(setter, index2);
  return locale2[field](utc, format2);
}
function listMonthsImpl(format2, index2, field) {
  if (isNumber$1(format2)) {
    index2 = format2;
    format2 = void 0;
  }
  format2 = format2 || "";
  if (index2 != null) {
    return get$1$1(format2, index2, field, "month");
  }
  var i2, out = [];
  for (i2 = 0; i2 < 12; i2++) {
    out[i2] = get$1$1(format2, i2, field, "month");
  }
  return out;
}
function listWeekdaysImpl(localeSorted, format2, index2, field) {
  if (typeof localeSorted === "boolean") {
    if (isNumber$1(format2)) {
      index2 = format2;
      format2 = void 0;
    }
    format2 = format2 || "";
  } else {
    format2 = localeSorted;
    index2 = format2;
    localeSorted = false;
    if (isNumber$1(format2)) {
      index2 = format2;
      format2 = void 0;
    }
    format2 = format2 || "";
  }
  var locale2 = getLocale(), shift = localeSorted ? locale2._week.dow : 0, i2, out = [];
  if (index2 != null) {
    return get$1$1(format2, (index2 + shift) % 7, field, "day");
  }
  for (i2 = 0; i2 < 7; i2++) {
    out[i2] = get$1$1(format2, (i2 + shift) % 7, field, "day");
  }
  return out;
}
function listMonths(format2, index2) {
  return listMonthsImpl(format2, index2, "months");
}
function listMonthsShort(format2, index2) {
  return listMonthsImpl(format2, index2, "monthsShort");
}
function listWeekdays(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdays");
}
function listWeekdaysShort(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdaysShort");
}
function listWeekdaysMin(localeSorted, format2, index2) {
  return listWeekdaysImpl(localeSorted, format2, index2, "weekdaysMin");
}
getSetGlobalLocale("en", {
  eras: [
    {
      since: "0001-01-01",
      until: Infinity,
      offset: 1,
      name: "Anno Domini",
      narrow: "AD",
      abbr: "AD"
    },
    {
      since: "0000-12-31",
      until: -Infinity,
      offset: 1,
      name: "Before Christ",
      narrow: "BC",
      abbr: "BC"
    }
  ],
  dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
  ordinal: function(number4) {
    var b2 = number4 % 10, output2 = toInt(number4 % 100 / 10) === 1 ? "th" : b2 === 1 ? "st" : b2 === 2 ? "nd" : b2 === 3 ? "rd" : "th";
    return number4 + output2;
  }
});
hooks.lang = deprecate(
  "moment.lang is deprecated. Use moment.locale instead.",
  getSetGlobalLocale
);
hooks.langData = deprecate(
  "moment.langData is deprecated. Use moment.localeData instead.",
  getLocale
);
var mathAbs = Math.abs;
function abs() {
  var data = this._data;
  this._milliseconds = mathAbs(this._milliseconds);
  this._days = mathAbs(this._days);
  this._months = mathAbs(this._months);
  data.milliseconds = mathAbs(data.milliseconds);
  data.seconds = mathAbs(data.seconds);
  data.minutes = mathAbs(data.minutes);
  data.hours = mathAbs(data.hours);
  data.months = mathAbs(data.months);
  data.years = mathAbs(data.years);
  return this;
}
function addSubtract$1(duration2, input2, value2, direction) {
  var other = createDuration(input2, value2);
  duration2._milliseconds += direction * other._milliseconds;
  duration2._days += direction * other._days;
  duration2._months += direction * other._months;
  return duration2._bubble();
}
function add$1$1(input2, value2) {
  return addSubtract$1(this, input2, value2, 1);
}
function subtract$1$1(input2, value2) {
  return addSubtract$1(this, input2, value2, -1);
}
function absCeil(number4) {
  if (number4 < 0) {
    return Math.floor(number4);
  } else {
    return Math.ceil(number4);
  }
}
function bubble() {
  var milliseconds2 = this._milliseconds, days2 = this._days, months2 = this._months, data = this._data, seconds2, minutes2, hours2, years2, monthsFromDays;
  if (!(milliseconds2 >= 0 && days2 >= 0 && months2 >= 0 || milliseconds2 <= 0 && days2 <= 0 && months2 <= 0)) {
    milliseconds2 += absCeil(monthsToDays(months2) + days2) * 864e5;
    days2 = 0;
    months2 = 0;
  }
  data.milliseconds = milliseconds2 % 1e3;
  seconds2 = absFloor(milliseconds2 / 1e3);
  data.seconds = seconds2 % 60;
  minutes2 = absFloor(seconds2 / 60);
  data.minutes = minutes2 % 60;
  hours2 = absFloor(minutes2 / 60);
  data.hours = hours2 % 24;
  days2 += absFloor(hours2 / 24);
  monthsFromDays = absFloor(daysToMonths(days2));
  months2 += monthsFromDays;
  days2 -= absCeil(monthsToDays(monthsFromDays));
  years2 = absFloor(months2 / 12);
  months2 %= 12;
  data.days = days2;
  data.months = months2;
  data.years = years2;
  return this;
}
function daysToMonths(days2) {
  return days2 * 4800 / 146097;
}
function monthsToDays(months2) {
  return months2 * 146097 / 4800;
}
function as(units) {
  if (!this.isValid()) {
    return NaN;
  }
  var days2, months2, milliseconds2 = this._milliseconds;
  units = normalizeUnits(units);
  if (units === "month" || units === "quarter" || units === "year") {
    days2 = this._days + milliseconds2 / 864e5;
    months2 = this._months + daysToMonths(days2);
    switch (units) {
      case "month":
        return months2;
      case "quarter":
        return months2 / 3;
      case "year":
        return months2 / 12;
    }
  } else {
    days2 = this._days + Math.round(monthsToDays(this._months));
    switch (units) {
      case "week":
        return days2 / 7 + milliseconds2 / 6048e5;
      case "day":
        return days2 + milliseconds2 / 864e5;
      case "hour":
        return days2 * 24 + milliseconds2 / 36e5;
      case "minute":
        return days2 * 1440 + milliseconds2 / 6e4;
      case "second":
        return days2 * 86400 + milliseconds2 / 1e3;
      case "millisecond":
        return Math.floor(days2 * 864e5) + milliseconds2;
      default:
        throw new Error("Unknown unit " + units);
    }
  }
}
function makeAs(alias) {
  return function() {
    return this.as(alias);
  };
}
var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asQuarters = makeAs("Q"), asYears = makeAs("y"), valueOf$1 = asMilliseconds;
function clone$1() {
  return createDuration(this);
}
function get$2$1(units) {
  units = normalizeUnits(units);
  return this.isValid() ? this[units + "s"]() : NaN;
}
function makeGetter(name2) {
  return function() {
    return this.isValid() ? this._data[name2] : NaN;
  };
}
var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
function weeks() {
  return absFloor(this.days() / 7);
}
var round = Math.round, thresholds = {
  ss: 44,
  // a few seconds to seconds
  s: 45,
  // seconds to minute
  m: 45,
  // minutes to hour
  h: 22,
  // hours to day
  d: 26,
  // days to month/week
  w: null,
  // weeks to month
  M: 11
  // months to year
};
function substituteTimeAgo(string3, number4, withoutSuffix, isFuture, locale2) {
  return locale2.relativeTime(number4 || 1, !!withoutSuffix, string3, isFuture);
}
function relativeTime$1(posNegDuration, withoutSuffix, thresholds2, locale2) {
  var duration2 = createDuration(posNegDuration).abs(), seconds2 = round(duration2.as("s")), minutes2 = round(duration2.as("m")), hours2 = round(duration2.as("h")), days2 = round(duration2.as("d")), months2 = round(duration2.as("M")), weeks2 = round(duration2.as("w")), years2 = round(duration2.as("y")), a2 = seconds2 <= thresholds2.ss && ["s", seconds2] || seconds2 < thresholds2.s && ["ss", seconds2] || minutes2 <= 1 && ["m"] || minutes2 < thresholds2.m && ["mm", minutes2] || hours2 <= 1 && ["h"] || hours2 < thresholds2.h && ["hh", hours2] || days2 <= 1 && ["d"] || days2 < thresholds2.d && ["dd", days2];
  if (thresholds2.w != null) {
    a2 = a2 || weeks2 <= 1 && ["w"] || weeks2 < thresholds2.w && ["ww", weeks2];
  }
  a2 = a2 || months2 <= 1 && ["M"] || months2 < thresholds2.M && ["MM", months2] || years2 <= 1 && ["y"] || ["yy", years2];
  a2[2] = withoutSuffix;
  a2[3] = +posNegDuration > 0;
  a2[4] = locale2;
  return substituteTimeAgo.apply(null, a2);
}
function getSetRelativeTimeRounding(roundingFunction) {
  if (roundingFunction === void 0) {
    return round;
  }
  if (typeof roundingFunction === "function") {
    round = roundingFunction;
    return true;
  }
  return false;
}
function getSetRelativeTimeThreshold(threshold, limit2) {
  if (thresholds[threshold] === void 0) {
    return false;
  }
  if (limit2 === void 0) {
    return thresholds[threshold];
  }
  thresholds[threshold] = limit2;
  if (threshold === "s") {
    thresholds.ss = limit2 - 1;
  }
  return true;
}
function humanize(argWithSuffix, argThresholds) {
  if (!this.isValid()) {
    return this.localeData().invalidDate();
  }
  var withSuffix = false, th2 = thresholds, locale2, output2;
  if (typeof argWithSuffix === "object") {
    argThresholds = argWithSuffix;
    argWithSuffix = false;
  }
  if (typeof argWithSuffix === "boolean") {
    withSuffix = argWithSuffix;
  }
  if (typeof argThresholds === "object") {
    th2 = Object.assign({}, thresholds, argThresholds);
    if (argThresholds.s != null && argThresholds.ss == null) {
      th2.ss = argThresholds.s - 1;
    }
  }
  locale2 = this.localeData();
  output2 = relativeTime$1(this, !withSuffix, th2, locale2);
  if (withSuffix) {
    output2 = locale2.pastFuture(+this, output2);
  }
  return locale2.postformat(output2);
}
var abs$1 = Math.abs;
function sign(x2) {
  return (x2 > 0) - (x2 < 0) || +x2;
}
function toISOString$1() {
  if (!this.isValid()) {
    return this.localeData().invalidDate();
  }
  var seconds2 = abs$1(this._milliseconds) / 1e3, days2 = abs$1(this._days), months2 = abs$1(this._months), minutes2, hours2, years2, s2, total = this.asSeconds(), totalSign, ymSign, daysSign, hmsSign;
  if (!total) {
    return "P0D";
  }
  minutes2 = absFloor(seconds2 / 60);
  hours2 = absFloor(minutes2 / 60);
  seconds2 %= 60;
  minutes2 %= 60;
  years2 = absFloor(months2 / 12);
  months2 %= 12;
  s2 = seconds2 ? seconds2.toFixed(3).replace(/\.?0+$/, "") : "";
  totalSign = total < 0 ? "-" : "";
  ymSign = sign(this._months) !== sign(total) ? "-" : "";
  daysSign = sign(this._days) !== sign(total) ? "-" : "";
  hmsSign = sign(this._milliseconds) !== sign(total) ? "-" : "";
  return totalSign + "P" + (years2 ? ymSign + years2 + "Y" : "") + (months2 ? ymSign + months2 + "M" : "") + (days2 ? daysSign + days2 + "D" : "") + (hours2 || minutes2 || seconds2 ? "T" : "") + (hours2 ? hmsSign + hours2 + "H" : "") + (minutes2 ? hmsSign + minutes2 + "M" : "") + (seconds2 ? hmsSign + s2 + "S" : "");
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1$1;
proto$2.subtract = subtract$1$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asQuarters = asQuarters;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.clone = clone$1;
proto$2.get = get$2$1;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
proto$2.toIsoString = deprecate(
  "toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",
  toISOString$1
);
proto$2.lang = lang;
addFormatToken("X", 0, 0, "unix");
addFormatToken("x", 0, 0, "valueOf");
addRegexToken("x", matchSigned);
addRegexToken("X", matchTimestamp);
addParseToken("X", function(input2, array4, config2) {
  config2._d = new Date(parseFloat(input2) * 1e3);
});
addParseToken("x", function(input2, array4, config2) {
  config2._d = new Date(toInt(input2));
});
//! moment.js
hooks.version = "2.30.1";
setHookCallback(createLocal);
hooks.fn = proto$1;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate$1;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto$1;
hooks.HTML5_FMT = {
  DATETIME_LOCAL: "YYYY-MM-DDTHH:mm",
  // <input type="datetime-local" />
  DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss",
  // <input type="datetime-local" step="1" />
  DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS",
  // <input type="datetime-local" step="0.001" />
  DATE: "YYYY-MM-DD",
  // <input type="date" />
  TIME: "HH:mm",
  // <input type="time" />
  TIME_SECONDS: "HH:mm:ss",
  // <input type="time" step="1" />
  TIME_MS: "HH:mm:ss.SSS",
  // <input type="time" step="0.001" />
  WEEK: "GGGG-[W]WW",
  // <input type="week" />
  MONTH: "YYYY-MM"
  // <input type="month" />
};
const sizeTextClassMap = {
  sm: "text-small",
  md: "text-medium",
  lg: "text-large"
};
const LightText = (props) => {
  const { children, onClick, size: size2, faded: faded2, color: color2 } = props;
  const textClass = size2 ? sizeTextClassMap[size2] : sizeTextClassMap.md;
  const className = [
    textClass,
    faded2 ? "opacity-40" : "",
    onClick ? "cursor-pointer" : ""
  ].filter(Boolean).join(" ");
  const style2 = color2 ? { color: color2 } : void 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, style: style2, onClick, children });
};
LightText.displayName = "LightText";
const NotSet = (props) => {
  const { t: t2 } = useTranslation();
  const { onClick, size: size2 } = props;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { faded: true, onClick, size: size2, children: onClick ? t2("common.label.clickToSet") : t2("common.label.notSet") });
};
NotSet.displayName = "NotSet";
function useFirstMountState() {
  var isFirst = reactExports.useRef(true);
  if (isFirst.current) {
    isFirst.current = false;
    return true;
  }
  return isFirst.current;
}
var useUpdateEffect = function(effect, deps) {
  var isFirstMount = useFirstMountState();
  reactExports.useEffect(function() {
    if (!isFirstMount) {
      return effect();
    }
  }, deps);
};
var noop$3 = function() {
};
var isBrowser$1 = typeof window !== "undefined";
var updateReducer = function(num) {
  return (num + 1) % 1e6;
};
function useUpdate() {
  var _a2 = reactExports.useReducer(updateReducer, 0), update = _a2[1];
  return update;
}
function useTimeoutFn(fn, ms) {
  if (ms === void 0) {
    ms = 0;
  }
  var ready = reactExports.useRef(false);
  var timeout = reactExports.useRef();
  var callback2 = reactExports.useRef(fn);
  var isReady = reactExports.useCallback(function() {
    return ready.current;
  }, []);
  var set2 = reactExports.useCallback(function() {
    ready.current = false;
    timeout.current && clearTimeout(timeout.current);
    timeout.current = setTimeout(function() {
      ready.current = true;
      callback2.current();
    }, ms);
  }, [ms]);
  var clear = reactExports.useCallback(function() {
    ready.current = null;
    timeout.current && clearTimeout(timeout.current);
  }, []);
  reactExports.useEffect(function() {
    callback2.current = fn;
  }, [fn]);
  reactExports.useEffect(function() {
    set2();
    return clear;
  }, [ms]);
  return [isReady, clear, set2];
}
function useDebounce(fn, ms, deps) {
  if (ms === void 0) {
    ms = 0;
  }
  if (deps === void 0) {
    deps = [];
  }
  var _a2 = useTimeoutFn(fn, ms), isReady = _a2[0], cancel2 = _a2[1], reset = _a2[2];
  reactExports.useEffect(reset, deps);
  return [isReady, cancel2];
}
var useLocalStorage = function(key, initialValue, options) {
  if (!isBrowser$1) {
    return [initialValue, noop$3, noop$3];
  }
  if (!key) {
    throw new Error("useLocalStorage key may not be falsy");
  }
  var deserializer2 = JSON.parse;
  var initializer = reactExports.useRef(function(key2) {
    try {
      var serializer2 = options ? options.raw ? String : options.serializer : JSON.stringify;
      var localStorageValue = localStorage.getItem(key2);
      if (localStorageValue !== null) {
        return deserializer2(localStorageValue);
      } else {
        initialValue && localStorage.setItem(key2, serializer2(initialValue));
        return initialValue;
      }
    } catch (_a3) {
      return initialValue;
    }
  });
  var _a2 = reactExports.useState(function() {
    return initializer.current(key);
  }), state = _a2[0], setState = _a2[1];
  reactExports.useLayoutEffect(function() {
    return setState(initializer.current(key));
  }, [key]);
  var set2 = reactExports.useCallback(function(valOrFunc) {
    try {
      var newState = typeof valOrFunc === "function" ? valOrFunc(state) : valOrFunc;
      if (typeof newState === "undefined")
        return;
      var value2 = void 0;
      if (options)
        ;
      else
        value2 = JSON.stringify(newState);
      localStorage.setItem(key, value2);
      setState(deserializer2(value2));
    } catch (_a3) {
    }
  }, [key, setState]);
  var remove = reactExports.useCallback(function() {
    try {
      localStorage.removeItem(key);
      setState(void 0);
    } catch (_a3) {
    }
  }, [key, setState]);
  return [state, set2, remove];
};
function usePrevious$1(state) {
  var ref = reactExports.useRef();
  reactExports.useEffect(function() {
    ref.current = state;
  });
  return ref.current;
}
const log$F = buildLogger("useStringValueState");
function useStringValueState(props) {
  const {
    value: propsValue,
    variant,
    editor,
    size: size2,
    isReadonly: propsIsReadonly,
    defaultEditing,
    isEditing
  } = props;
  const [editing, setEditing] = reactExports.useState(defaultEditing && !propsIsReadonly && !!editor);
  const [value2, setValue] = reactExports.useState(propsValue);
  const isReadonly = propsIsReadonly ?? false;
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = !isReadonly && editor && isEditing !== false ? () => {
    log$F("Start editing");
    setEditing(true);
  } : void 0;
  const completeEditing = () => {
    var _a2;
    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, value2, value2);
    setEditing(false);
  };
  return {
    value: value2,
    setValue,
    editing,
    setEditing,
    isReadonly,
    variant,
    editor,
    size: size2,
    isEditing,
    startEditing,
    completeEditing,
    log: log$F
  };
}
const SingleLineTextRenderer = (props) => {
  const { t: t2 } = useTranslation();
  const {
    value: value2,
    setValue,
    editing,
    isReadonly,
    variant,
    editor,
    size: size2,
    isEditing,
    startEditing,
    completeEditing
  } = useStringValueState(props);
  if (isEditing && !isReadonly && editor) {
    const handleChange = (newValue) => {
      var _a2;
      setValue(newValue);
      (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, newValue, newValue);
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { size: size2, value: value2 ?? "", placeholder: t2("common.placeholder.typeHere"), onValueChange: handleChange });
  }
  if (variant == "light" && !editing) {
    if (value2 == null || value2 === "") {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: startEditing, size: size2, children: value2 });
  }
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { size: size2, autoFocus: true, value: value2, placeholder: t2("common.placeholder.typeHere"), onBlur: completeEditing, onValueChange: setValue });
  }
  if (value2 == null || value2 === "") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: startEditing, size: size2, children: value2 });
};
SingleLineTextRenderer.displayName = "SingleLineTextRenderer";
const MultilineTextRenderer = (props) => {
  const { t: t2 } = useTranslation();
  const {
    value: value2,
    setValue,
    editing,
    isReadonly,
    variant,
    editor,
    size: size2,
    isEditing,
    startEditing,
    completeEditing
  } = useStringValueState(props);
  if (isEditing && !isReadonly && editor) {
    const handleChange = (newValue) => {
      var _a2;
      setValue(newValue);
      (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, newValue, newValue);
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(textarea_default, { size: size2, value: value2 ?? "", minRows: 2, placeholder: t2("common.placeholder.typeHere"), onValueChange: handleChange });
  }
  if (variant == "light" && !editing) {
    if (value2 == null || value2 === "") {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: startEditing, size: size2, children: value2 });
  }
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(textarea_default, { size: size2, minRows: 2, autoFocus: true, value: value2, placeholder: t2("common.placeholder.typeHere"), onBlur: completeEditing, onValueChange: setValue });
  }
  if (value2 == null || value2 === "") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: startEditing, size: size2, children: value2 });
};
MultilineTextRenderer.displayName = "MultilineTextRenderer";
const StringValueRenderer = (props) => {
  const { multiline, ...baseProps } = props;
  if (multiline) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(MultilineTextRenderer, { ...baseProps });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SingleLineTextRenderer, { ...baseProps });
};
StringValueRenderer.displayName = "StringValueRenderer";
const log$E = buildLogger("NumberValueRenderer");
const NumberValueRenderer = (props) => {
  const {
    value: propsValue,
    precision,
    editor,
    variant,
    suffix,
    as: as2,
    size: size2,
    isReadonly: propsIsReadonly,
    isEditing,
    defaultEditing
  } = props;
  const { t: t2 } = useTranslation();
  log$E(props);
  const isReadonly = propsIsReadonly ?? false;
  const [editing, setEditing] = reactExports.useState(defaultEditing && !isReadonly && !!editor);
  const [value2, setValue] = reactExports.useState(propsValue);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = !isReadonly && editor && isEditing !== false ? () => setEditing(true) : void 0;
  const completeEditing = () => {
    var _a2;
    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, value2, value2);
    setEditing(false);
  };
  if (isEditing && !isReadonly && editor) {
    const handleChange = (newValue) => {
      var _a2;
      const v2 = Number.isNaN(newValue) ? void 0 : newValue;
      setValue(v2);
      (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, v2, v2);
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        hideStepper: true,
        className: "w-[120px]",
        classNames: { input: "text-left" },
        endContent: as2 === "progress" ? "%" : void 0,
        placeholder: t2("common.placeholder.typeHere"),
        size: size2,
        value: value2,
        onValueChange: handleChange
      }
    );
  }
  if (variant == "light" && !editing) {
    if (value2 == null) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: startEditing });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(LightText, { size: size2, onClick: startEditing, children: [
      value2,
      suffix
    ] });
  }
  if (as2 == "progress" && !editing) {
    if (value2 == null) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: startEditing });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      progress_default,
      {
        showValueLabel: true,
        className: `w-[120px] ${startEditing ? "cursor-pointer" : ""}`,
        classNames: {
          base: "relative",
          labelWrapper: "absolute inset-0 flex items-center justify-center z-10",
          value: "text-foreground text-xs"
        },
        size: size2,
        value: value2,
        onClick: startEditing
      }
    );
  }
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        hideStepper: true,
        className: "w-[120px]",
        classNames: { input: "text-left" },
        endContent: as2 === "progress" ? "%" : void 0,
        placeholder: t2("common.placeholder.typeHere"),
        size: size2,
        value: value2,
        onBlur: completeEditing,
        onKeyDown: (e2) => {
          if (e2.key === "Enter") {
            completeEditing();
          }
        },
        onValueChange: (v2) => setValue(Number.isNaN(v2) ? void 0 : v2)
      }
    );
  }
  if (value2 == null) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: startEditing });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(LightText, { size: size2, onClick: startEditing, children: [
    value2,
    suffix
  ] });
};
NumberValueRenderer.displayName = "NumberValueRenderer";
const SelectableChip = ({
  itemKey: itemKey2,
  label,
  isSelected,
  color: color2,
  size: size2,
  onClick
}) => {
  const textClass = size2 ? sizeTextClassMap[size2] : sizeTextClassMap.md;
  const style2 = {};
  const classNames2 = [
    "inline-flex items-center rounded-md px-1",
    textClass
  ];
  if (onClick) {
    classNames2.push("cursor-pointer");
  }
  if (isSelected) {
    if (color2) {
      style2.color = color2;
      style2.backgroundColor = autoBackgroundColor(color2);
    } else {
      classNames2.push("bg-primary text-primary-foreground");
    }
  } else {
    if (color2) {
      style2.color = color2;
      classNames2.push("opacity-50");
    } else {
      classNames2.push("opacity-50");
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "span",
    {
      className: classNames2.join(" "),
      style: Object.keys(style2).length > 0 ? style2 : void 0,
      onClick,
      children: label
    },
    itemKey2
  );
};
SelectableChip.displayName = "SelectableChip";
const BooleanValueRenderer = ({
  value: value2,
  variant,
  editor,
  size: size2,
  isReadonly: propsIsReadonly,
  isEditing,
  defaultEditing = false
}) => {
  const { t: t2 } = useTranslation();
  const isReadonly = propsIsReadonly ?? false;
  const v2 = variant ?? "default";
  const canEdit = !isReadonly && editor;
  const [internalEditing, setInternalEditing] = reactExports.useState(
    defaultEditing && !isReadonly && !!editor && (v2 === "light" || v2 === "default")
  );
  const startEditing = canEdit && isEditing !== false ? () => setInternalEditing(true) : void 0;
  const handleChipClick = (clickedValue) => {
    var _a2;
    const newValue = value2 === clickedValue ? void 0 : clickedValue;
    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, newValue, newValue);
    if (!isEditing) {
      setInternalEditing(false);
    }
  };
  if ((isEditing || internalEditing) && canEdit && v2 !== "switch") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex gap-1 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: "__yes__",
          label: t2("common.label.yes"),
          isSelected: value2 === true,
          size: size2,
          onClick: () => handleChipClick(true)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: "__no__",
          label: t2("common.label.no"),
          isSelected: value2 === false,
          size: size2,
          onClick: () => handleChipClick(false)
        }
      )
    ] });
  }
  if (v2 === "light") {
    if (value2 === true) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { size: size2, onClick: startEditing, children: t2("common.label.yes") });
    } else if (value2 === false) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { size: size2, onClick: startEditing, children: t2("common.label.no") });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: startEditing });
    }
  }
  if (v2 === "switch") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      switch_default,
      {
        isSelected: value2,
        size: size2,
        isDisabled: !canEdit,
        onValueChange: canEdit ? (v22) => {
          var _a2;
          return (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, v22, v22);
        } : void 0
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { onClick: startEditing, className: startEditing ? "cursor-pointer" : void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { isSelected: value2, size: size2, isReadOnly: true, className: "pointer-events-none" }) });
};
BooleanValueRenderer.displayName = "BooleanValueRenderer";
const ExternalLink = ({ href, children, size: size2, ...otherProps }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Button,
    {
      color: "primary",
      href,
      variant: "light",
      size: size2,
      ...otherProps,
      onPress: (e2) => {
        BApi$1.gui.openUrlInDefaultBrowser({ url: href });
      },
      children: [
        children,
        /* @__PURE__ */ jsxRuntimeExports.jsx(TbExternalLink, { className: "text-lg" })
      ]
    }
  );
};
ExternalLink.displayName = "ExternalLink";
const LinkValueRenderer = ({
  value: value2,
  editor,
  variant,
  size: size2,
  isReadonly: propsIsReadonly,
  isEditing,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [editingValue, setEditingValue] = reactExports.useState();
  const isReadonly = propsIsReadonly ?? false;
  const canEdit = !isReadonly && editor && isEditing !== false;
  const renderInner = () => {
    if (value2 == null ? void 0 : value2.url) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "px-3", size: size2, href: value2.url, children: value2.text ?? value2.url });
    } else {
      if ((value2 == null ? void 0 : value2.text) != void 0 && value2.text.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: value2.text });
      }
    }
    return null;
  };
  const inner = renderInner();
  if (!inner && !canEdit) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2 });
  }
  if (canEdit) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
      inner,
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          isOpen: !!editingValue,
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" }) }),
          onOpenChange: (isOpen) => {
            if (isOpen) {
              setEditingValue({ ...value2 });
            } else {
              setEditingValue(void 0);
            }
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 min-w-[320px] p-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                placeholder: t2("Text"),
                size: size2,
                variant: "bordered",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1c, { className: "text-default-400" }),
                value: editingValue == null ? void 0 : editingValue.text,
                onValueChange: (text2) => {
                  setEditingValue({
                    ...editingValue,
                    text: text2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                placeholder: t2("Link"),
                size: size2,
                variant: "bordered",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$x, { className: "text-default-400" }),
                value: editingValue == null ? void 0 : editingValue.url,
                onValueChange: (url2) => {
                  setEditingValue({
                    ...editingValue,
                    url: url2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-end", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: size2,
                  variant: "light",
                  onClick: () => {
                    setEditingValue(void 0);
                  },
                  children: t2("Cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: size2,
                  onClick: () => {
                    var _a2;
                    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, editingValue, editingValue);
                    setEditingValue(void 0);
                  },
                  children: t2("Submit")
                }
              )
            ] })
          ] })
        }
      )
    ] });
  } else {
    return inner;
  }
};
LinkValueRenderer.displayName = "LinkValueRenderer";
const log$D = buildLogger("DateTimeValueRenderer");
const DateTimeValueRenderer = (props) => {
  const { value: propsValue, format: format2, as: as2, variant, editor, size: size2, isEditing, isReadonly: propsIsReadonly } = props;
  log$D(props);
  const [editing, setEditing] = reactExports.useState(false);
  const [value2, setValue] = reactExports.useState(propsValue);
  const isReadonly = propsIsReadonly ?? false;
  reactExports.useEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const startEditing = !isReadonly && editor && isEditing !== false ? () => {
    setEditing(true);
  } : void 0;
  const f2 = format2 == void 0 ? as2 == "datetime" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD" : format2;
  if (isEditing && !isReadonly && editor) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      DateInput,
      {
        granularity: as2 == "datetime" ? "second" : "day",
        isReadOnly: false,
        value: value2,
        size: size2,
        onChange: (d2) => {
          var _a2;
          log$D("OnChange", d2);
          setValue(d2);
          (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, d2, d2);
        }
      }
    );
  }
  if (!editing) {
    if (value2 == void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, className: startEditing ? "cursor-pointer" : void 0, children: value2 == null ? void 0 : value2.format(f2) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    DateInput,
    {
      granularity: as2 == "datetime" ? "second" : "day",
      isReadOnly: !editor,
      value: value2,
      size: size2,
      onBlur: () => {
        var _a2;
        log$D("onBlur", value2);
        (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, value2);
        setEditing(false);
      },
      onChange: (d2) => {
        log$D("OnChange", d2);
        setValue(d2);
      },
      onKeyDown: (e2) => {
        var _a2;
        if (e2.key == "Enter") {
          log$D("onEnter", value2);
          (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, value2, value2);
          setEditing(false);
        }
      }
    }
  );
};
DateTimeValueRenderer.displayName = "DateTimeValueRenderer";
function LuCalendarClock(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 2v4" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 2v4" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 10h5" }, "child": [] }, { "tag": "path", "attr": { "d": "M17.5 17.5 16 16.25V14" }, "child": [] }, { "tag": "path", "attr": { "d": "M22 16a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, "child": [] }] })(props);
}
function LuCalendarDays(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "rect", "attr": { "width": "18", "height": "18", "x": "3", "y": "4", "rx": "2", "ry": "2" }, "child": [] }, { "tag": "line", "attr": { "x1": "16", "x2": "16", "y1": "2", "y2": "6" }, "child": [] }, { "tag": "line", "attr": { "x1": "8", "x2": "8", "y1": "2", "y2": "6" }, "child": [] }, { "tag": "line", "attr": { "x1": "3", "x2": "21", "y1": "10", "y2": "10" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 14h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M8 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M12 18h.01" }, "child": [] }, { "tag": "path", "attr": { "d": "M16 18h.01" }, "child": [] }] })(props);
}
function LuLink(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, "child": [] }, { "tag": "path", "attr": { "d": "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }, "child": [] }] })(props);
}
function LuRegex(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M17 3v10" }, "child": [] }, { "tag": "path", "attr": { "d": "m12.67 5.5 8.66 5" }, "child": [] }, { "tag": "path", "attr": { "d": "m12.67 10.5 8.66-5" }, "child": [] }, { "tag": "path", "attr": { "d": "M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z" }, "child": [] }] })(props);
}
function LuRuler(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z" }, "child": [] }, { "tag": "path", "attr": { "d": "m14.5 12.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m11.5 9.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m8.5 6.5 2-2" }, "child": [] }, { "tag": "path", "attr": { "d": "m17.5 15.5 2-2" }, "child": [] }] })(props);
}
function LuTags(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none", "stroke": "currentColor", "strokeWidth": "2", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "d": "M9 5H2v7l6.29 6.29c.94.94 2.48.94 3.42 0l3.58-3.58c.94-.94.94-2.48 0-3.42L9 5Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 9.01V9" }, "child": [] }, { "tag": "path", "attr": { "d": "m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19" }, "child": [] }] })(props);
}
function PiEmpty(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M198.24,62.63l15.68-17.25a8,8,0,0,0-11.84-10.76L186.4,51.86A95.95,95.95,0,0,0,57.76,193.37L42.08,210.62a8,8,0,1,0,11.84,10.76L69.6,204.14A95.95,95.95,0,0,0,198.24,62.63ZM48,128A80,80,0,0,1,175.6,63.75l-107,117.73A79.63,79.63,0,0,1,48,128Zm80,80a79.55,79.55,0,0,1-47.6-15.75l107-117.73A79.95,79.95,0,0,1,128,208Z" }, "child": [] }] })(props);
}
function PiImages(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M216,40H72A16,16,0,0,0,56,56V72H40A16,16,0,0,0,24,88V200a16,16,0,0,0,16,16H184a16,16,0,0,0,16-16V184h16a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM72,56H216v62.75l-10.07-10.06a16,16,0,0,0-22.63,0l-20,20-44-44a16,16,0,0,0-22.62,0L72,109.37ZM184,200H40V88H56v80a16,16,0,0,0,16,16H184Zm32-32H72V132l36-36,49.66,49.66a8,8,0,0,0,11.31,0L194.63,120,216,141.38V168ZM160,84a12,12,0,1,1,12,12A12,12,0,0,1,160,84Z" }, "child": [] }] })(props);
}
function PiTreeView(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 256 256", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M176,152h32a16,16,0,0,0,16-16V104a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H88V80h8a16,16,0,0,0,16-16V32A16,16,0,0,0,96,16H64A16,16,0,0,0,48,32V64A16,16,0,0,0,64,80h8V192a24,24,0,0,0,24,24h64v8a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16V192a16,16,0,0,0-16-16H176a16,16,0,0,0-16,16v8H96a8,8,0,0,1-8-8V128h72v8A16,16,0,0,0,176,152ZM64,32H96V64H64ZM176,192h32v32H176Zm0-88h32v32H176Z" }, "child": [] }] })(props);
}
({
  [StandardValueType.String]: MdOutlineTextFormat,
  [StandardValueType.ListString]: MdOutlineTextSnippet,
  [StandardValueType.Decimal]: TbNumber123,
  [StandardValueType.Link]: LuLink,
  [StandardValueType.Boolean]: MdOutlineCheckBox,
  [StandardValueType.DateTime]: LuCalendarDays,
  [StandardValueType.Time]: MdOutlineAccessTime,
  [StandardValueType.ListListString]: PiTreeView,
  [StandardValueType.ListTag]: LuTags
});
const log$C = buildLogger("ChoiceValueEditor");
const ChoiceValueEditor = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { multiple, getDataSource, value: propsValue, onValueChange } = props;
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  log$C(props);
  reactExports.useEffect(() => {
    loadData();
  }, []);
  const loadData = async () => {
    const data = await getDataSource() ?? [];
    if (data.length > 0) {
      setDataSource(data);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: dataSource.length > 10 ? "xl" : "lg",
      title: t2("Select data"),
      onOk: async () => {
        const validValues = value2.filter(
          (v2) => dataSource.some((d2) => d2.value == v2)
        );
        onValueChange == null ? void 0 : onValueChange(
          validValues,
          validValues.map((v2) => {
            var _a2;
            return (_a2 = dataSource.find((x2) => x2.value == v2)) == null ? void 0 : _a2.label;
          }).filter((x2) => x2)
        );
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            placeholder: t2("common.placeholder.search"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => {
              setKeyword(v2);
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: dataSource.length == 0 ? t2("No choices available, please check your configurations") : dataSource.filter(
          (d2) => keyword.length == 0 || d2.label.toLowerCase().includes(keyword.toLowerCase())
        ).map((d2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: value2.includes(d2.value) ? "primary" : "default",
              size: "sm",
              onClick: () => {
                if (multiple) {
                  log$C(
                    "value",
                    value2,
                    "select",
                    d2.value,
                    "includes",
                    value2.includes(d2.value)
                  );
                  if (value2.includes(d2.value)) {
                    setValue(value2.filter((v2) => v2 !== d2.value));
                  } else {
                    setValue([...value2 || [], d2.value]);
                  }
                } else {
                  setValue([d2.value]);
                }
              },
              children: d2.label
            }
          );
        }) })
      ]
    }
  );
};
ChoiceValueEditor.displayName = "ChoiceValueEditor";
const NumberValueEditor = ({
  value: value2,
  onValueChange,
  label,
  placeholder,
  size: size2,
  ...props
}) => {
  const valueRef = reactExports.useRef(value2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    number_input_default,
    {
      fullWidth: false,
      size: size2,
      hideStepper: true,
      labelPlacement: "outside",
      classNames: {
        input: "text-left"
      },
      className: "w-[120px]",
      defaultValue: valueRef.current,
      label,
      placeholder,
      onBlur: () => {
        onValueChange == null ? void 0 : onValueChange(valueRef.current, valueRef.current);
      },
      onKeyDown: (e2) => {
        if (e2.key === "Enter") {
          onValueChange == null ? void 0 : onValueChange(valueRef.current, valueRef.current);
        }
      },
      onValueChange: (v2) => {
        valueRef.current = Number.isNaN(v2) ? void 0 : v2;
      }
    }
  );
};
NumberValueEditor.displayName = "NumberValueEditor";
const filterMultilevelData = (data, keyword) => {
  var _a2;
  if (!keyword) {
    return data;
  }
  const result = [];
  for (const d2 of data) {
    if ((_a2 = d2.label) == null ? void 0 : _a2.toLowerCase().includes(keyword)) {
      result.push(d2);
    } else {
      if (d2.children && d2.children.length > 0) {
        const children = filterMultilevelData(d2.children, keyword);
        if (children.length > 0) {
          result.push({
            ...d2,
            children
          });
        }
      }
    }
  }
  return result;
};
const findNodeChainInMultilevelData = (data, value2) => {
  for (const d2 of data) {
    if (d2.value === value2) {
      return [d2];
    } else {
      if (d2.children && d2.children.length > 0) {
        const children = findNodeChainInMultilevelData(d2.children, value2);
        if (children !== void 0) {
          if ((children == null ? void 0 : children.length) > 0) {
            return [d2, ...children];
          }
        }
      }
    }
  }
  return;
};
const convertFromApiValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
    case StandardValueType.ListString:
    case StandardValueType.Decimal:
    case StandardValueType.Link:
    case StandardValueType.Boolean:
    case StandardValueType.ListListString:
    case StandardValueType.ListTag:
      return value2;
    case StandardValueType.DateTime:
      return dayjs(value2);
    case StandardValueType.Time:
      return dayjs.duration(value2);
  }
};
const Serialization = {
  LowLevelSeparator: ",",
  HighLevelSeparator: ";",
  EscapeChar: "\\"
};
const deserializeStandardValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
      return value2;
    case StandardValueType.ListString:
      return splitStringWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    case StandardValueType.Decimal: {
      const d2 = parseFloat(value2);
      if (Number.isNaN(d2)) {
        return void 0;
      }
      return d2;
    }
    case StandardValueType.Link: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return {
          text: parts[0],
          url: parts[1]
        };
      }
      return void 0;
    }
    case StandardValueType.Boolean: {
      if (value2 === "True") {
        return true;
      } else if (value2 === "False") {
        return false;
      }
      return void 0;
    }
    case StandardValueType.ListListString: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return parts.map(
          (p2) => splitStringWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        );
      }
      return void 0;
    }
    case StandardValueType.ListTag: {
      const parts = splitStringWithEscapeChar(
        value2,
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
      if (parts) {
        return parts.map((p2) => {
          const tagSegments = splitStringWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          );
          if (tagSegments) {
            return {
              group: tagSegments[0],
              name: tagSegments[1]
            };
          }
          return null;
        }).filter((p2) => p2 != null);
      }
      return void 0;
    }
    case StandardValueType.DateTime: {
      return dayjs(parseInt(value2, 10));
    }
    case StandardValueType.Time:
      return dayjs.duration(parseInt(value2, 10));
  }
};
const serializeStandardValue = (value2, type4) => {
  if (value2 == void 0) {
    return void 0;
  }
  switch (type4) {
    case StandardValueType.String:
      return value2;
    case StandardValueType.ListString:
      return joinWithEscapeChar(
        value2,
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    case StandardValueType.Decimal:
      return value2.toString();
    case StandardValueType.Link: {
      const lv = value2;
      if (!lv) {
        return void 0;
      }
      return joinWithEscapeChar(
        [lv.text, lv.url],
        Serialization.LowLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.Boolean: {
      return value2 ? "True" : "False";
    }
    case StandardValueType.ListListString: {
      return joinWithEscapeChar(
        value2.map(
          (p2) => joinWithEscapeChar(
            p2,
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        ),
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.ListTag: {
      const tvs = value2;
      if (!tvs) {
        return void 0;
      }
      return joinWithEscapeChar(
        tvs.map(
          (tv2) => joinWithEscapeChar(
            [tv2.group, tv2.name],
            Serialization.LowLevelSeparator,
            Serialization.EscapeChar
          )
        ),
        Serialization.HighLevelSeparator,
        Serialization.EscapeChar
      );
    }
    case StandardValueType.DateTime: {
      const dt = value2;
      return dt.valueOf().toString();
    }
    case StandardValueType.Time: {
      const dur = value2;
      return dur.asMilliseconds().toString();
    }
  }
};
const buildDefaultSelectable = () => {
  return (data, depth, index2) => data.children == void 0 || data.children.length == 0;
};
const log$B = buildLogger("MultilevelValueEditor");
const MultilevelValueEditor = (props) => {
  const { t: t2 } = useTranslation();
  const {
    getDataSource,
    selectable = buildDefaultSelectable(),
    value: propsValue,
    onValueChange,
    onCancel,
    multiple
  } = props;
  log$B(props);
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  const [expandedPath, setExpandedPath] = reactExports.useState([]);
  reactExports.useEffect(() => {
    loadData();
  }, []);
  useUpdateEffect(() => {
    loadData();
  }, [getDataSource]);
  reactExports.useEffect(() => {
    setValue(propsValue ?? []);
  }, [propsValue]);
  const loadData = async () => {
    const data = await (getDataSource == null ? void 0 : getDataSource()) ?? [];
    if (data.length > 0) {
      setDataSource(data);
    }
  };
  const getColumnsData = reactExports.useCallback(() => {
    const columns2 = [];
    let currentItems = filterMultilevelData(dataSource, keyword);
    columns2.push({ items: currentItems, depth: 0 });
    for (let i2 = 0; i2 < expandedPath.length; i2++) {
      const expandedValue = expandedPath[i2];
      const expandedItem = currentItems.find((item) => item.value === expandedValue);
      if ((expandedItem == null ? void 0 : expandedItem.children) && expandedItem.children.length > 0) {
        currentItems = filterMultilevelData(expandedItem.children, keyword);
        columns2.push({ items: currentItems, depth: i2 + 1 });
      } else {
        break;
      }
    }
    return columns2;
  }, [dataSource, expandedPath, keyword]);
  const columns = getColumnsData();
  const handleItemClick = (item, depth) => {
    const hasChildren2 = item.children && item.children.length > 0;
    if (hasChildren2) {
      setExpandedPath([...expandedPath.slice(0, depth), item.value]);
    } else {
      if (multiple) {
        if (value2.includes(item.value)) {
          setValue(value2.filter((v2) => v2 !== item.value));
        } else {
          setValue([...value2, item.value]);
        }
      } else {
        setValue([item.value]);
      }
    }
  };
  const renderColumn = (items, depth) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "flex flex-col gap-1 min-w-[150px] max-w-[200px] p-2 rounded overflow-y-auto",
        style: { background: "var(--bakaui-overlap-background)" },
        children: items.map((item, idx) => {
          const hasChildren2 = item.children && item.children.length > 0;
          const isSelected = value2.includes(item.value);
          const isExpanded = expandedPath[depth] === item.value;
          const style2 = {};
          if (item.color) {
            style2.color = item.color;
            if (!isSelected && !isExpanded) {
              style2.backgroundColor = autoBackgroundColor(item.color);
            }
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: isSelected ? "primary" : isExpanded ? "secondary" : "default",
              size: "sm",
              variant: isExpanded && !isSelected ? "flat" : "solid",
              style: style2,
              className: "justify-between",
              onPress: () => handleItemClick(item, depth),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: item.label }),
                hasChildren2 && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1m, { className: "text-xs flex-shrink-0" })
              ]
            },
            idx
          );
        })
      }
    );
  };
  const selectedLabels = reactExports.useMemo(() => {
    return value2.map((v2) => {
      const chain2 = findNodeChainInMultilevelData(dataSource, v2);
      return chain2 == null ? void 0 : chain2.map((x2) => x2.label).join(" / ");
    }).filter((x2) => x2);
  }, [value2, dataSource]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: dataSource.length > 10 ? "xl" : "lg",
      title: t2("Select data"),
      onClose: onCancel,
      onOk: async () => {
        const bv = value2.map(
          (v2) => {
            var _a2;
            return (_a2 = findNodeChainInMultilevelData(dataSource, v2)) == null ? void 0 : _a2.map((x2) => x2.label);
          }
        ).filter((x2) => x2);
        onValueChange == null ? void 0 : onValueChange(value2, bv);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 max-h-full min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            placeholder: t2("common.placeholder.search"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        selectedLabels.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 p-2 rounded bg-default-100", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500 mr-1", children: [
            t2("Selected"),
            ":"
          ] }),
          selectedLabels.map((label, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm bg-primary-100 text-primary-700 px-2 py-0.5 rounded", children: label }, i2))
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-2 min-h-0 overflow-x-auto overflow-y-hidden", children: columns.length > 0 && columns[0].items.length > 0 ? columns.map((column2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(React$6.Fragment, { children: renderColumn(column2.items, column2.depth) }, i2)) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "m-2 flex items-center justify-center text-default-400", children: t2("common.state.noData") }) })
      ] })
    }
  );
};
MultilevelValueEditor.displayName = "MultilevelValueEditor";
const NoChoicesAvailable = ({ size: size2 }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400 text-sm", children: t2("common.state.noChoicesAvailable") });
};
NoChoicesAvailable.displayName = "NoChoicesAvailable";
const STORAGE_KEY = "bakabase-filter-options-threshold";
const DEFAULT_FILTER_OPTIONS_THRESHOLD = 30;
const getFilterOptionsThreshold = () => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return DEFAULT_FILTER_OPTIONS_THRESHOLD;
  }
  try {
    const stored = localStorage.getItem(STORAGE_KEY);
    if (stored) {
      const value2 = parseInt(stored, 10);
      if (!isNaN(value2) && value2 > 0) {
        return value2;
      }
    }
  } catch (error2) {
    console.warn("Failed to read filter options threshold from localStorage:", error2);
  }
  return DEFAULT_FILTER_OPTIONS_THRESHOLD;
};
const setFilterOptionsThreshold = (value2) => {
  if (typeof window === "undefined" || typeof localStorage === "undefined") {
    return;
  }
  try {
    localStorage.setItem(STORAGE_KEY, value2.toString());
    window.dispatchEvent(new CustomEvent("filter-options-threshold-change", { detail: value2 }));
  } catch (error2) {
    console.warn("Failed to save filter options threshold to localStorage:", error2);
  }
};
const useFilterOptionsThreshold = () => {
  const [threshold, setThresholdState] = reactExports.useState(getFilterOptionsThreshold);
  reactExports.useEffect(() => {
    const handleChange = (event) => {
      setThresholdState(event.detail);
    };
    window.addEventListener("filter-options-threshold-change", handleChange);
    return () => {
      window.removeEventListener("filter-options-threshold-change", handleChange);
    };
  }, []);
  const setThreshold = reactExports.useCallback((value2) => {
    if (value2 > 0) {
      setThresholdState(value2);
      setFilterOptionsThreshold(value2);
    }
  }, []);
  return [threshold, setThreshold];
};
function getInlineOptionsLimit() {
  return getFilterOptionsThreshold();
}
function buildVisibleOptions(options, isSelected, limit2) {
  if (options.length === 0)
    return [];
  const inlineLimit = limit2 ?? getInlineOptionsLimit();
  const selectedCount = options.filter(isSelected).length;
  const maxCount = Math.max(inlineLimit, selectedCount);
  const firstN = options.slice(0, inlineLimit);
  const selectedInFirstN = firstN.filter(isSelected);
  const unselectedInFirstN = firstN.filter((item) => !isSelected(item));
  const selectedBeyondN = options.slice(inlineLimit).filter(isSelected);
  const totalSelected = selectedInFirstN.length + selectedBeyondN.length;
  const unselectedSlots = Math.max(0, maxCount - totalSelected);
  const unselectedToShow = unselectedInFirstN.slice(0, unselectedSlots);
  const includedItems = /* @__PURE__ */ new Set([...selectedInFirstN, ...unselectedToShow]);
  const firstPortion = firstN.filter((item) => includedItems.has(item));
  return [...firstPortion, ...selectedBeyondN];
}
function hasMoreOptions(totalCount, limit2) {
  const inlineLimit = limit2 ?? getInlineOptionsLimit();
  return totalCount > inlineLimit;
}
function getRemainingCount(totalCount, visibleCount) {
  return totalCount - visibleCount;
}
const log$A = buildLogger("ChoiceValueRenderer");
const ChoiceValueRenderer = (props) => {
  const { value: value2, editor, variant, getDataSource, multiple, valueAttributes, size: size2, isReadonly: propsIsReadonly, isEditing: controlledIsEditing, defaultEditing = false } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [optionsThreshold] = useFilterOptionsThreshold();
  const [internalIsEditing, setInternalIsEditing] = reactExports.useState(defaultEditing);
  const containerRef = reactExports.useRef(null);
  const isEditing = controlledIsEditing ?? internalIsEditing;
  const isReadonly = propsIsReadonly ?? false;
  log$A(props);
  reactExports.useEffect(() => {
    if (controlledIsEditing !== void 0 || !isEditing)
      return;
    const handleClickOutside = (event) => {
      if (containerRef.current && !containerRef.current.contains(event.target)) {
        setInternalIsEditing(false);
      }
    };
    document.addEventListener("mousedown", handleClickOutside);
    return () => document.removeEventListener("mousedown", handleClickOutside);
  }, [controlledIsEditing, isEditing]);
  reactExports.useEffect(() => {
    if (isEditing && getDataSource && dataSource.length === 0) {
      setIsLoading(true);
      getDataSource().then((data) => {
        setDataSource(data);
        setIsLoading(false);
      });
    }
  }, [isEditing, getDataSource]);
  const handleClick = () => {
    if (controlledIsEditing === void 0 && !isEditing && !isReadonly && editor) {
      setInternalIsEditing(true);
    }
  };
  const openFullEditor = editor ? () => {
    createPortal(ChoiceValueEditor, {
      value: editor == null ? void 0 : editor.value,
      getDataSource: getDataSource ?? (async () => []),
      onValueChange: editor == null ? void 0 : editor.onValueChange,
      multiple: multiple ?? false
    });
  } : void 0;
  const selectedValues = (editor == null ? void 0 : editor.value) || value2 || [];
  const toggleValue = (itemValue) => {
    if (isReadonly || !(editor == null ? void 0 : editor.onValueChange))
      return;
    if (multiple) {
      const newDbValues = selectedValues.includes(itemValue) ? selectedValues.filter((v2) => v2 !== itemValue) : [...selectedValues, itemValue];
      const newBizValues = newDbValues.map((v2) => {
        var _a2;
        return (_a2 = dataSource.find((d2) => d2.value === v2)) == null ? void 0 : _a2.label;
      }).filter((l2) => l2 !== void 0);
      editor.onValueChange(newDbValues, newBizValues);
    } else {
      const newDbValues = selectedValues.includes(itemValue) ? [] : [itemValue];
      const newBizValues = newDbValues.map((v2) => {
        var _a2;
        return (_a2 = dataSource.find((d2) => d2.value === v2)) == null ? void 0 : _a2.label;
      }).filter((l2) => l2 !== void 0);
      editor.onValueChange(newDbValues, newBizValues);
    }
  };
  const visibleOptions = reactExports.useMemo(
    () => buildVisibleOptions(dataSource, (item) => selectedValues.includes(item.value), optionsThreshold),
    [dataSource, selectedValues, optionsThreshold]
  );
  const hasMore = hasMoreOptions(dataSource.length, optionsThreshold);
  const remainingCount = getRemainingCount(dataSource.length, visibleOptions.length);
  if (isEditing === true && dataSource.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "flex flex-wrap gap-1 items-center", children: [
      visibleOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: item.value,
          label: item.label,
          isSelected: selectedValues.includes(item.value),
          color: item.color,
          size: size2,
          onClick: () => toggleValue(item.value)
        },
        item.value
      )),
      hasMore && /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          color: "primary",
          onClick: openFullEditor,
          children: [
            t2("common.action.more"),
            " (+",
            remainingCount,
            ")"
          ]
        }
      )
    ] });
  }
  if (isEditing === true && isLoading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("common.state.loading") });
  }
  if (isEditing === true && dataSource.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NoChoicesAvailable, {});
  }
  const validValues = (value2 == null ? void 0 : value2.filter((v2) => v2 != void 0)) || [];
  const canEdit = !isReadonly && !!editor;
  if (validValues.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: canEdit ? "cursor-pointer" : void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: canEdit ? handleClick : void 0 }) });
  }
  if (variant == "light") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: handleClick, size: size2, children: value2 == null ? void 0 : value2.map((v2, i2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        i2 != 0 && ", ",
        /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { color: (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color, size: size2, children: v2 })
      ] }, i2);
    }) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: "flex flex-wrap gap-1 cursor-pointer", children: value2 == null ? void 0 : value2.map((v2, i2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: `display-${i2}`,
          label: v2,
          isSelected: true,
          color: (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color,
          size: size2
        },
        i2
      );
    }) });
  }
};
ChoiceValueRenderer.displayName = "ChoiceValueRenderer";
const FormulaValueRenderer = ({
  value: value2,
  variant,
  editor,
  size: size2,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("Not supported") });
};
FormulaValueRenderer.displayName = "FormulaValueRenderer";
var imagePromiseFactory = function(_ref) {
  var _ref$decode = _ref.decode, decode2 = _ref$decode === void 0 ? true : _ref$decode, _ref$crossOrigin = _ref.crossOrigin, crossOrigin = _ref$crossOrigin === void 0 ? "" : _ref$crossOrigin;
  return function(src) {
    return new Promise(function(resolve2, reject) {
      var i2 = new Image();
      if (crossOrigin)
        i2.crossOrigin = crossOrigin;
      i2.onload = function() {
        decode2 && i2.decode ? i2.decode().then(resolve2)["catch"](reject) : resolve2();
      };
      i2.onerror = reject;
      i2.src = src;
    });
  };
};
function ownKeys$9(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    enumerableOnly && (symbols = symbols.filter(function(sym) {
      return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
    })), keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$a(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = null != arguments[i2] ? arguments[i2] : {};
    i2 % 2 ? ownKeys$9(Object(source2), true).forEach(function(key) {
      _defineProperty$4(target, key, source2[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)) : ownKeys$9(Object(source2)).forEach(function(key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
    });
  }
  return target;
}
var removeBlankArrayElements = function removeBlankArrayElements2(a2) {
  return a2.filter(function(x2) {
    return x2;
  });
};
var stringToArray = function stringToArray2(x2) {
  return Array.isArray(x2) ? x2 : [x2];
};
var cache = {};
var promiseFind = function promiseFind2(arr, promiseFactory) {
  var done = false;
  return new Promise(function(resolve2, reject) {
    var queueNext = function queueNext2(src) {
      return promiseFactory(src).then(function() {
        done = true;
        resolve2(src);
      });
    };
    arr.reduce(function(p2, src) {
      return p2["catch"](function() {
        if (!done)
          return queueNext(src);
      });
    }, queueNext(arr.shift()))["catch"](reject);
  });
};
function useImage(_ref) {
  var srcList = _ref.srcList, _ref$imgPromise = _ref.imgPromise, imgPromise = _ref$imgPromise === void 0 ? imagePromiseFactory({
    decode: true
  }) : _ref$imgPromise, _ref$useSuspense = _ref.useSuspense, useSuspense = _ref$useSuspense === void 0 ? true : _ref$useSuspense;
  var _useState = reactExports.useState(false), setIsSettled = _useState[1];
  var sourceList = removeBlankArrayElements(stringToArray(srcList));
  var sourceKey = sourceList.join("");
  if (!cache[sourceKey]) {
    cache[sourceKey] = {
      promise: promiseFind(sourceList, imgPromise),
      cache: "pending",
      error: null
    };
  }
  if (cache[sourceKey].cache === "resolved") {
    return {
      src: cache[sourceKey].src,
      isLoading: false,
      error: null
    };
  }
  if (cache[sourceKey].cache === "rejected") {
    if (useSuspense)
      throw cache[sourceKey].error;
    return {
      isLoading: false,
      error: cache[sourceKey].error,
      src: void 0
    };
  }
  cache[sourceKey].promise.then(function(src) {
    cache[sourceKey] = _objectSpread$a(_objectSpread$a({}, cache[sourceKey]), {}, {
      cache: "resolved",
      src
    });
    if (!useSuspense)
      setIsSettled(sourceKey);
  })["catch"](function(error2) {
    cache[sourceKey] = _objectSpread$a(_objectSpread$a({}, cache[sourceKey]), {}, {
      cache: "rejected",
      error: error2
    });
    if (!useSuspense)
      setIsSettled(sourceKey);
  });
  if (useSuspense)
    throw cache[sourceKey].promise;
  return {
    isLoading: true,
    src: void 0,
    error: null
  };
}
var _excluded$2 = ["decode", "src", "loader", "unloader", "container", "loaderContainer", "unloaderContainer", "imgPromise", "crossorigin", "useSuspense"];
function ownKeys$8(object4, enumerableOnly) {
  var keys2 = Object.keys(object4);
  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object4);
    enumerableOnly && (symbols = symbols.filter(function(sym) {
      return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
    })), keys2.push.apply(keys2, symbols);
  }
  return keys2;
}
function _objectSpread$9(target) {
  for (var i2 = 1; i2 < arguments.length; i2++) {
    var source2 = null != arguments[i2] ? arguments[i2] : {};
    i2 % 2 ? ownKeys$8(Object(source2), true).forEach(function(key) {
      _defineProperty$4(target, key, source2[key]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source2)) : ownKeys$8(Object(source2)).forEach(function(key) {
      Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source2, key));
    });
  }
  return target;
}
var passthroughContainer = function passthroughContainer2(x2) {
  return x2;
};
function Img(_ref) {
  var _ref$decode = _ref.decode, decode2 = _ref$decode === void 0 ? true : _ref$decode, _ref$src = _ref.src, srcList = _ref$src === void 0 ? [] : _ref$src, _ref$loader = _ref.loader, loader = _ref$loader === void 0 ? null : _ref$loader, _ref$unloader = _ref.unloader, unloader = _ref$unloader === void 0 ? null : _ref$unloader, _ref$container = _ref.container, container = _ref$container === void 0 ? passthroughContainer : _ref$container, _ref$loaderContainer = _ref.loaderContainer, loaderContainer = _ref$loaderContainer === void 0 ? passthroughContainer : _ref$loaderContainer, _ref$unloaderContaine = _ref.unloaderContainer, unloaderContainer = _ref$unloaderContaine === void 0 ? passthroughContainer : _ref$unloaderContaine, imgPromise = _ref.imgPromise, crossorigin = _ref.crossorigin, _ref$useSuspense = _ref.useSuspense, useSuspense = _ref$useSuspense === void 0 ? false : _ref$useSuspense, imgProps = _objectWithoutPropertiesLoose$2(_ref, _excluded$2);
  imgPromise = imgPromise || imagePromiseFactory({
    decode: decode2,
    crossOrigin: crossorigin
  });
  var _useImage = useImage({
    srcList,
    imgPromise,
    useSuspense
  }), src = _useImage.src, isLoading = _useImage.isLoading;
  if (src)
    return container(/* @__PURE__ */ React$6.createElement("img", _objectSpread$9({
      src
    }, imgProps)));
  if (!useSuspense && isLoading)
    return loaderContainer(loader);
  if (!useSuspense && unloader)
    return unloaderContainer(unloader);
  return null;
}
const FileSystemSelectorButton = ({
  fileSystemSelectorProps,
  children,
  ...buttonProps
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [path, setPath2] = reactExports.useState(
    fileSystemSelectorProps.defaultSelectedPath
  );
  let label = path;
  if (!path) {
    if (!children) {
      if (fileSystemSelectorProps.targetType === "folder") {
        label = t2("Select folder");
      } else if (fileSystemSelectorProps.targetType === "file") {
        label = t2("Select file");
      } else {
        label = t2("Select file system entries");
      }
    } else {
      label = children;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "primary",
      size: "sm",
      variant: "light",
      ...buttonProps,
      onPress: () => {
        createPortal(FileSystemSelectorModal, {
          ...fileSystemSelectorProps,
          onSelected: (entry) => {
            setPath2(entry.path);
            if (fileSystemSelectorProps.onSelected) {
              fileSystemSelectorProps.onSelected(entry);
            }
          }
        });
      },
      children: label
    }
  );
};
FileSystemSelectorButton.displayName = "FileSystemSelectorButton";
var SelectionMode$1 = /* @__PURE__ */ ((SelectionMode2) => {
  SelectionMode2[SelectionMode2["Normal"] = 1] = "Normal";
  SelectionMode2[SelectionMode2["Ctrl"] = 2] = "Ctrl";
  SelectionMode2[SelectionMode2["Shift"] = 3] = "Shift";
  return SelectionMode2;
})(SelectionMode$1 || {});
const EventListener = (props) => {
  const { t: t2 } = useTranslation();
  const propsRef = reactExports.useRef(props);
  const selectionModeRef = reactExports.useRef(
    1
    /* Normal */
  );
  const shiftHoldingRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    propsRef.current = props;
  });
  reactExports.useEffect(() => {
    if (typeof window === "undefined") {
      return;
    }
    window.addEventListener("keydown", onKeyDown);
    window.addEventListener("keyup", onKeyUp);
    window.addEventListener("click", onClick);
    return () => {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick);
    };
  }, []);
  const changeSelectionMode = (mode) => {
    if (selectionModeRef.current != mode) {
      selectionModeRef.current = mode;
      propsRef.current.onSelectionModeChange(mode);
    }
  };
  const onClick = reactExports.useCallback((evt) => {
    var _a2, _b2;
    (_b2 = (_a2 = propsRef.current).onClick) == null ? void 0 : _b2.call(_a2, evt);
  }, []);
  const onKeyDown = reactExports.useCallback((e2) => {
    var _a2, _b2, _c2, _d;
    switch (e2.key) {
      case "Control":
      case "Meta":
        changeSelectionMode(
          2
          /* Ctrl */
        );
        break;
      case "Shift":
        changeSelectionMode(
          3
          /* Shift */
        );
        shiftHoldingRef.current = true;
        break;
      case "Delete":
        (_b2 = (_a2 = propsRef.current).onDelete) == null ? void 0 : _b2.call(_a2);
        break;
      default:
        (_d = (_c2 = propsRef.current).onKeyDown) == null ? void 0 : _d.call(_c2, e2.key, e2);
        break;
    }
  }, []);
  const onKeyUp = reactExports.useCallback((e2) => {
    switch (e2.key) {
      case "Control":
      case "Meta":
        changeSelectionMode(
          1
          /* Normal */
        );
        break;
      case "Shift":
        changeSelectionMode(
          1
          /* Normal */
        );
        shiftHoldingRef.current = false;
        break;
    }
  }, []);
  return null;
};
EventListener.displayName = "EventListener";
function n$1(n2) {
  for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e2 = 1; e2 < r2; e2++)
    t2[e2 - 1] = arguments[e2];
  throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
    return "'" + n3 + "'";
  }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function r$2(n2) {
  return !!n2 && !!n2[Q$2];
}
function t$2(n2) {
  var r2;
  return !!n2 && (function(n3) {
    if (!n3 || "object" != typeof n3)
      return false;
    var r3 = Object.getPrototypeOf(n3);
    if (null === r3)
      return true;
    var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
    return t2 === Object || "function" == typeof t2 && Function.toString.call(t2) === Z$2;
  }(n2) || Array.isArray(n2) || !!n2[L$2] || !!(null === (r2 = n2.constructor) || void 0 === r2 ? void 0 : r2[L$2]) || s$1(n2) || v$1(n2));
}
function i(n2, r2, t2) {
  void 0 === t2 && (t2 = false), 0 === o(n2) ? (t2 ? Object.keys : nn)(n2).forEach(function(e2) {
    t2 && "symbol" == typeof e2 || r2(e2, n2[e2], n2);
  }) : n2.forEach(function(t3, e2) {
    return r2(e2, t3, n2);
  });
}
function o(n2) {
  var r2 = n2[Q$2];
  return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s$1(n2) ? 2 : v$1(n2) ? 3 : 0;
}
function u$2(n2, r2) {
  return 2 === o(n2) ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
}
function a(n2, r2) {
  return 2 === o(n2) ? n2.get(r2) : n2[r2];
}
function f(n2, r2, t2) {
  var e2 = o(n2);
  2 === e2 ? n2.set(r2, t2) : 3 === e2 ? n2.add(t2) : n2[r2] = t2;
}
function c(n2, r2) {
  return n2 === r2 ? 0 !== n2 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
}
function s$1(n2) {
  return X$2 && n2 instanceof Map;
}
function v$1(n2) {
  return q && n2 instanceof Set;
}
function p$2(n2) {
  return n2.o || n2.t;
}
function l$3(n2) {
  if (Array.isArray(n2))
    return Array.prototype.slice.call(n2);
  var r2 = rn(n2);
  delete r2[Q$2];
  for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
    var i2 = t2[e2], o2 = r2[i2];
    false === o2.writable && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
  }
  return Object.create(Object.getPrototypeOf(n2), r2);
}
function d(n2, e2) {
  return void 0 === e2 && (e2 = false), y$2(n2) || r$2(n2) || !t$2(n2) || (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e2 && i(n2, function(n3, r2) {
    return d(r2, true);
  }, true)), n2;
}
function h() {
  n$1(2);
}
function y$2(n2) {
  return null == n2 || "object" != typeof n2 || Object.isFrozen(n2);
}
function b(r2) {
  var t2 = tn[r2];
  return t2 || n$1(18, r2), t2;
}
function _23() {
  return U$2;
}
function j(n2, r2) {
  r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
}
function g(n2) {
  O$2(n2), n2.p.forEach(S$2), n2.p = null;
}
function O$2(n2) {
  n2 === U$2 && (U$2 = n2.l);
}
function w$2(n2) {
  return U$2 = { p: [], l: U$2, h: n2, m: true, _: 0 };
}
function S$2(n2) {
  var r2 = n2[Q$2];
  0 === r2.i || 1 === r2.i ? r2.j() : r2.g = true;
}
function P$2(r2, e2) {
  e2._ = e2.p.length;
  var i2 = e2.p[0], o2 = void 0 !== r2 && r2 !== i2;
  return e2.h.O || b("ES5").S(e2, r2, o2), o2 ? (i2[Q$2].P && (g(e2), n$1(4)), t$2(r2) && (r2 = M$2(e2, r2), e2.l || x$2(e2, r2)), e2.u && b("Patches").M(i2[Q$2].t, r2, e2.u, e2.s)) : r2 = M$2(e2, i2, []), g(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H$2 ? r2 : void 0;
}
function M$2(n2, r2, t2) {
  if (y$2(r2))
    return r2;
  var e2 = r2[Q$2];
  if (!e2)
    return i(r2, function(i2, o3) {
      return A$1(n2, e2, r2, i2, o3, t2);
    }, true), r2;
  if (e2.A !== n2)
    return r2;
  if (!e2.P)
    return x$2(n2, e2.t, true), e2.t;
  if (!e2.I) {
    e2.I = true, e2.A._--;
    var o2 = 4 === e2.i || 5 === e2.i ? e2.o = l$3(e2.k) : e2.o, u2 = o2, a2 = false;
    3 === e2.i && (u2 = new Set(o2), o2.clear(), a2 = true), i(u2, function(r3, i2) {
      return A$1(n2, e2, o2, r3, i2, t2, a2);
    }), x$2(n2, o2, false), t2 && n2.u && b("Patches").N(e2, t2, n2.u, n2.s);
  }
  return e2.o;
}
function A$1(e2, i2, o2, a2, c2, s2, v2) {
  if (r$2(c2)) {
    var p2 = M$2(e2, c2, s2 && i2 && 3 !== i2.i && !u$2(i2.R, a2) ? s2.concat(a2) : void 0);
    if (f(o2, a2, p2), !r$2(p2))
      return;
    e2.m = false;
  } else
    v2 && o2.add(c2);
  if (t$2(c2) && !y$2(c2)) {
    if (!e2.h.D && e2._ < 1)
      return;
    M$2(e2, c2), i2 && i2.A.l || x$2(e2, c2);
  }
}
function x$2(n2, r2, t2) {
  void 0 === t2 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
}
function z$1(n2, r2) {
  var t2 = n2[Q$2];
  return (t2 ? p$2(t2) : n2)[r2];
}
function I$2(n2, r2) {
  if (r2 in n2)
    for (var t2 = Object.getPrototypeOf(n2); t2; ) {
      var e2 = Object.getOwnPropertyDescriptor(t2, r2);
      if (e2)
        return e2;
      t2 = Object.getPrototypeOf(t2);
    }
}
function k$1(n2) {
  n2.P || (n2.P = true, n2.l && k$1(n2.l));
}
function E$2(n2) {
  n2.o || (n2.o = l$3(n2.t));
}
function N$2(n2, r2, t2) {
  var e2 = s$1(r2) ? b("MapSet").F(r2, t2) : v$1(r2) ? b("MapSet").T(r2, t2) : n2.O ? function(n3, r3) {
    var t3 = Array.isArray(n3), e3 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _23(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e3, o2 = en;
    t3 && (i2 = [e3], o2 = on);
    var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
    return e3.k = f2, e3.j = a2, f2;
  }(r2, t2) : b("ES5").J(r2, t2);
  return (t2 ? t2.A : _23()).p.push(e2), e2;
}
function R$2(e2) {
  return r$2(e2) || n$1(22, e2), function n2(r2) {
    if (!t$2(r2))
      return r2;
    var e3, u2 = r2[Q$2], c2 = o(r2);
    if (u2) {
      if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
        return u2.t;
      u2.I = true, e3 = D$1(r2, c2), u2.I = false;
    } else
      e3 = D$1(r2, c2);
    return i(e3, function(r3, t2) {
      u2 && a(u2.t, r3) === t2 || f(e3, r3, n2(t2));
    }), 3 === c2 ? new Set(e3) : e3;
  }(e2);
}
function D$1(n2, r2) {
  switch (r2) {
    case 2:
      return new Map(n2);
    case 3:
      return Array.from(n2);
  }
  return l$3(n2);
}
var G$1, U$2, W$2 = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"), X$2 = "undefined" != typeof Map, q = "undefined" != typeof Set, B$2 = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect, H$2 = W$2 ? Symbol.for("immer-nothing") : ((G$1 = {})["immer-nothing"] = true, G$1), L$2 = W$2 ? Symbol.for("immer-draftable") : "__$immer_draftable", Q$2 = W$2 ? Symbol.for("immer-state") : "__$immer_state", Z$2 = "" + Object.prototype.constructor, nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n2) {
  return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
} : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n2) {
  var r2 = {};
  return nn(n2).forEach(function(t2) {
    r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
  }), r2;
}, tn = {}, en = { get: function(n2, r2) {
  if (r2 === Q$2)
    return n2;
  var e2 = p$2(n2);
  if (!u$2(e2, r2))
    return function(n3, r3, t2) {
      var e3, i3 = I$2(r3, t2);
      return i3 ? "value" in i3 ? i3.value : null === (e3 = i3.get) || void 0 === e3 ? void 0 : e3.call(n3.k) : void 0;
    }(n2, e2, r2);
  var i2 = e2[r2];
  return n2.I || !t$2(i2) ? i2 : i2 === z$1(n2.t, r2) ? (E$2(n2), n2.o[r2] = N$2(n2.A.h, i2, n2)) : i2;
}, has: function(n2, r2) {
  return r2 in p$2(n2);
}, ownKeys: function(n2) {
  return Reflect.ownKeys(p$2(n2));
}, set: function(n2, r2, t2) {
  var e2 = I$2(p$2(n2), r2);
  if (null == e2 ? void 0 : e2.set)
    return e2.set.call(n2.k, t2), true;
  if (!n2.P) {
    var i2 = z$1(p$2(n2), r2), o2 = null == i2 ? void 0 : i2[Q$2];
    if (o2 && o2.t === t2)
      return n2.o[r2] = t2, n2.R[r2] = false, true;
    if (c(t2, i2) && (void 0 !== t2 || u$2(n2.t, r2)))
      return true;
    E$2(n2), k$1(n2);
  }
  return n2.o[r2] === t2 && (void 0 !== t2 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
}, deleteProperty: function(n2, r2) {
  return void 0 !== z$1(n2.t, r2) || r2 in n2.t ? (n2.R[r2] = false, E$2(n2), k$1(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
}, getOwnPropertyDescriptor: function(n2, r2) {
  var t2 = p$2(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
  return e2 ? { writable: true, configurable: 1 !== n2.i || "length" !== r2, enumerable: e2.enumerable, value: t2[r2] } : e2;
}, defineProperty: function() {
  n$1(11);
}, getPrototypeOf: function(n2) {
  return Object.getPrototypeOf(n2.t);
}, setPrototypeOf: function() {
  n$1(12);
} }, on = {};
i(en, function(n2, r2) {
  on[n2] = function() {
    return arguments[0] = arguments[0][0], r2.apply(this, arguments);
  };
}), on.deleteProperty = function(r2, t2) {
  return on.set.call(this, r2, t2, void 0);
}, on.set = function(r2, t2, e2) {
  return en.set.call(this, r2[0], t2, e2, r2[0]);
};
var un = function() {
  function e2(r2) {
    var e3 = this;
    this.O = B$2, this.D = true, this.produce = function(r3, i3, o2) {
      if ("function" == typeof r3 && "function" != typeof i3) {
        var u2 = i3;
        i3 = r3;
        var a2 = e3;
        return function(n2) {
          var r4 = this;
          void 0 === n2 && (n2 = u2);
          for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
            e4[o3 - 1] = arguments[o3];
          return a2.produce(n2, function(n3) {
            var t3;
            return (t3 = i3).call.apply(t3, [r4, n3].concat(e4));
          });
        };
      }
      var f2;
      if ("function" != typeof i3 && n$1(6), void 0 !== o2 && "function" != typeof o2 && n$1(7), t$2(r3)) {
        var c2 = w$2(e3), s2 = N$2(e3, r3, void 0), v2 = true;
        try {
          f2 = i3(s2), v2 = false;
        } finally {
          v2 ? g(c2) : O$2(c2);
        }
        return "undefined" != typeof Promise && f2 instanceof Promise ? f2.then(function(n2) {
          return j(c2, o2), P$2(n2, c2);
        }, function(n2) {
          throw g(c2), n2;
        }) : (j(c2, o2), P$2(f2, c2));
      }
      if (!r3 || "object" != typeof r3) {
        if (void 0 === (f2 = i3(r3)) && (f2 = r3), f2 === H$2 && (f2 = void 0), e3.D && d(f2, true), o2) {
          var p2 = [], l2 = [];
          b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
        }
        return f2;
      }
      n$1(21, r3);
    }, this.produceWithPatches = function(n2, r3) {
      if ("function" == typeof n2)
        return function(r4) {
          for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
            i4[o3 - 1] = arguments[o3];
          return e3.produceWithPatches(r4, function(r5) {
            return n2.apply(void 0, [r5].concat(i4));
          });
        };
      var t2, i3, o2 = e3.produce(n2, r3, function(n3, r4) {
        t2 = n3, i3 = r4;
      });
      return "undefined" != typeof Promise && o2 instanceof Promise ? o2.then(function(n3) {
        return [n3, t2, i3];
      }) : [o2, t2, i3];
    }, "boolean" == typeof (null == r2 ? void 0 : r2.useProxies) && this.setUseProxies(r2.useProxies), "boolean" == typeof (null == r2 ? void 0 : r2.autoFreeze) && this.setAutoFreeze(r2.autoFreeze);
  }
  var i2 = e2.prototype;
  return i2.createDraft = function(e3) {
    t$2(e3) || n$1(8), r$2(e3) && (e3 = R$2(e3));
    var i3 = w$2(this), o2 = N$2(this, e3, void 0);
    return o2[Q$2].C = true, O$2(i3), o2;
  }, i2.finishDraft = function(r2, t2) {
    var e3 = r2 && r2[Q$2];
    var i3 = e3.A;
    return j(i3, t2), P$2(void 0, i3);
  }, i2.setAutoFreeze = function(n2) {
    this.D = n2;
  }, i2.setUseProxies = function(r2) {
    r2 && !B$2 && n$1(20), this.O = r2;
  }, i2.applyPatches = function(n2, t2) {
    var e3;
    for (e3 = t2.length - 1; e3 >= 0; e3--) {
      var i3 = t2[e3];
      if (0 === i3.path.length && "replace" === i3.op) {
        n2 = i3.value;
        break;
      }
    }
    e3 > -1 && (t2 = t2.slice(e3 + 1));
    var o2 = b("Patches").$;
    return r$2(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
      return o2(n3, t2);
    });
  }, e2;
}(), an = new un();
an.produce;
an.produceWithPatches.bind(an);
an.setAutoFreeze.bind(an);
an.setUseProxies.bind(an);
an.applyPatches.bind(an);
an.createDraft.bind(an);
an.finishDraft.bind(an);
const DefaultMaxChildrenHeight = 600;
const MainLineHeight = 35;
const ChildrenIndent = 26;
var EntryProperty = /* @__PURE__ */ ((EntryProperty2) => {
  EntryProperty2[EntryProperty2["ChildrenCount"] = 1] = "ChildrenCount";
  EntryProperty2[EntryProperty2["Size"] = 3] = "Size";
  return EntryProperty2;
})(EntryProperty || {});
var EntryStatus = /* @__PURE__ */ ((EntryStatus2) => {
  EntryStatus2[EntryStatus2["Default"] = 0] = "Default";
  EntryStatus2[EntryStatus2["Loading"] = 1] = "Loading";
  EntryStatus2[EntryStatus2["Error"] = 2] = "Error";
  return EntryStatus2;
})(EntryStatus || {});
var IwFsEntryAction = /* @__PURE__ */ ((IwFsEntryAction2) => {
  IwFsEntryAction2[IwFsEntryAction2["Decompress"] = 1] = "Decompress";
  IwFsEntryAction2[IwFsEntryAction2["Play"] = 2] = "Play";
  return IwFsEntryAction2;
})(IwFsEntryAction || {});
const _Entry = class _Entry {
  constructor(init2) {
    __publicField(this, "id");
    __publicField(this, _c, true);
    __publicField(this, "root");
    __publicField(this, "properties");
    __publicField(this, "children");
    __publicField(this, "parent");
    __publicField(this, "_tmpFilter", {});
    __publicField(this, "_filteredChildren", []);
    __publicField(this, "_childrenCount");
    __publicField(this, "initializationStatus", 0);
    __publicField(this, "expanded", false);
    __publicField(this, "selected", false);
    __publicField(this, "passwordsForDecompressing", []);
    __publicField(this, "renaming", false);
    __publicField(this, "newName");
    __publicField(this, "type", IwFsType.Unknown);
    __publicField(this, "path");
    __publicField(this, "name");
    __publicField(this, "meaningfulName");
    __publicField(this, "size");
    __publicField(this, "ext");
    __publicField(this, "creationTime");
    __publicField(this, "lastWriteTime");
    __publicField(this, "treeCache", {});
    // directoryCount?: number = undefined;
    // fileCount?: number = undefined;
    // duration?: number = undefined;
    __publicField(this, "task");
    __publicField(this, "_ref");
    __publicField(this, "errors", {});
    __publicField(this, "childrenWidth");
    Object.assign(this, init2);
    this.id = uuidv4();
    if (this.parent) {
      this.root = this.parent.root;
      this.childrenWidth = this.parent.childrenWidth - ChildrenIndent;
      this.root.nodeMap[this.path] = this;
    }
    if (!this.properties) {
      this.properties = Object.keys(EntryProperty).filter((item) => !isNaN(Number(item))).map((n2) => parseInt(n2, 10));
    }
  }
  get isRoot() {
    return !this.parent;
  }
  expireFilteredChildren() {
    var _a2;
    this._tmpFilter = {};
    this._filteredChildren = ((_a2 = this.children) == null ? void 0 : _a2.slice()) || [];
  }
  /**
   * Performance optimization
   */
  get filteredChildren() {
    if (this._tmpFilter != this.root.filter) {
      this._tmpFilter = this.root.filter;
      this.refreshFilteredChildren();
    }
    return this._filteredChildren;
  }
  async dispose() {
  }
  refreshFilteredChildren() {
    const { keyword, types: types2, custom } = this._tmpFilter;
    const lowerCasedKeyword = keyword == null ? void 0 : keyword.toLowerCase();
    this._filteredChildren = (this.children ?? []).filter((c2) => {
      if (!(lowerCasedKeyword == void 0 || c2.name.toLowerCase().includes(lowerCasedKeyword))) {
        return false;
      }
      if (types2 && !types2.includes(c2.type) && c2.type != IwFsType.Directory) {
        return false;
      }
      if (custom != void 0) {
        const r2 = custom(c2);
        if (!r2) {
          return false;
        }
      }
      return true;
    });
  }
  get childrenCount() {
    var _a2;
    return ((_a2 = this.children) == null ? void 0 : _a2.length) ?? this._childrenCount;
  }
  set childrenCount(value2) {
    if (this.children) {
      return;
    }
    this._childrenCount = value2;
  }
  async addChildByPath(path, render3) {
    if (this.children) {
      const childData = (await BApi$1.file.getIwFsEntry({ path })).data;
      const child = new _Entry({
        ...childData,
        parent: this
      });
      this.children ?? (this.children = []);
      this.children.push(child);
      this.children = this.children.slice().sort((a2, b2) => a2.name.localeCompare(b2.name));
      this.refreshFilteredChildren();
    } else {
      if (this.childrenCount != void 0) {
        this.childrenCount += 1;
      }
    }
    if (render3) {
      this.renderChildren();
    }
  }
  clearChildren() {
    if (this.children) {
      for (const c2 of this.children) {
        delete this.root.nodeMap[c2.path];
      }
      this.children = void 0;
      this._filteredChildren = [];
      this.renderChildren();
    }
  }
  async replaceChildByPath(prevPath, newPath, render3) {
    var _a2;
    (_a2 = this.root.nodeMap[prevPath]) == null ? void 0 : _a2.delete(false);
    await this.addChildByPath(newPath, render3);
  }
  get status() {
    if (this.initializationStatus == 1) {
      return 1;
    }
    const eKeys = Object.keys(this.errors);
    if (eKeys.length > 0) {
      return 2;
    }
    return 0;
  }
  get actions() {
    const actions = [];
    if (!this.isDirectoryOrDrive && this.type != IwFsType.CompressedFilePart) {
      actions.push(
        1
        /* Decompress */
      );
    }
    if (this.childrenCount != void 0 && this.childrenCount > 0) {
      actions.push(
        2
        /* Play */
      );
    }
    return actions;
  }
  get visible() {
    return this._ref != void 0;
  }
  async initialize() {
    var _a2, _b2;
    if (this.initializationStatus != 0) {
      return;
    }
    if (this.type == IwFsType.Drive) {
      this.initializationStatus = 2;
      return;
    }
    (_a2 = this.ref) == null ? void 0 : _a2.setLoading(true);
    this.initializationStatus = 1;
    try {
      for (const property2 of this.properties) {
        switch (property2) {
          case 1: {
            {
              const info = await BApi$1.file.getIwFsInfo(
                { path: this.path, type: this.type },
                { showErrorToast: () => false }
              );
              if (info.code) {
                this.errors[
                  1
                  /* InitializationFailed */
                ] = info.message;
              } else {
                Object.assign(this, info.data);
              }
            }
            break;
          }
        }
      }
    } catch (e2) {
      this.errors[
        1
        /* InitializationFailed */
      ] = e2.message;
    } finally {
      this.initializationStatus = 2;
      (_b2 = this.ref) == null ? void 0 : _b2.setLoading(false);
    }
  }
  delete(render3) {
    const { parent, root: root2 } = this;
    delete root2.nodeMap[this.path];
    if (parent) {
      if (parent.children) {
        parent.children = parent.children.filter((c2) => c2 != this);
        parent.refreshFilteredChildren();
      } else {
        if (parent.childrenCount != void 0) {
          parent.childrenCount -= 1;
        }
      }
      if (render3) {
        parent.renderChildren();
      }
    }
  }
  get pathSegments() {
    return this.path.split(BusinessConstants.pathSeparator);
  }
  /**
   * @deprecated The method should not be used
   */
  get isDecompressionCandidateInMultiSelection() {
    return !this.isDirectoryOrDrive;
  }
  get expandable() {
    return this.type == IwFsType.Drive || this.type == IwFsType.Directory && (this.childrenCount == void 0 || this.childrenCount > 0);
  }
  get isMedia() {
    return this.type == IwFsType.Audio || this.type == IwFsType.Video;
  }
  get isDirectory() {
    return this.type == IwFsType.Directory;
  }
  get isDirectoryOrDrive() {
    return this.type == IwFsType.Directory || this.type == IwFsType.Drive;
  }
  get isDrive() {
    return this.type == IwFsType.Drive;
  }
  /**
   * @deprecated The method should not be used
   */
  get fileSystemInfoIsLoaded() {
    return this.childrenCount != void 0;
  }
  get ref() {
    return this._ref;
  }
  set ref(ref) {
    this._ref = ref;
  }
  renderChildren() {
    var _a2, _b2;
    (_a2 = this._ref) == null ? void 0 : _a2.renderChildren();
    (_b2 = this.parent) == null ? void 0 : _b2.renderChildren();
  }
  /**
   * @return rendered
   */
  recalculateChildrenWidth() {
    var _a2;
    const dom = (_a2 = this.ref) == null ? void 0 : _a2.dom;
    if (dom) {
      const childrenWidth = dom.parentElement.clientWidth - (this.isRoot ? 0 : ChildrenIndent);
      if (childrenWidth != this.childrenWidth) {
        this.childrenWidth = childrenWidth;
        this.forceUpdate();
        if (this.children) {
          for (const c2 of this.children) {
            c2.recalculateChildrenWidth();
          }
        }
        return true;
      }
    }
    return false;
  }
  select(select2) {
    this.simpleRefCall("select", "selected", select2);
  }
  highlight(highlight) {
    this.simpleRefCall("highlight", "highlighted", highlight);
  }
  expand(refresh) {
    if (this._ref) {
      this._ref.expand(refresh);
    }
  }
  collapse() {
    if (this._ref) {
      this._ref.collapse();
    }
  }
  get dom() {
    var _a2;
    return (_a2 = this._ref) == null ? void 0 : _a2.dom;
  }
  get childrenHeight() {
    var _a2, _b2, _c2, _d, _e;
    const { ref } = this;
    if (!ref) {
      return 0;
    }
    if (this.isRoot) {
      const parentHeight = ((_b2 = (_a2 = ref.dom) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.clientHeight) ?? 0;
      return parentHeight;
    }
    let height = 0;
    if (((_c2 = this.filteredChildren) == null ? void 0 : _c2.length) > 0 && this.expanded) {
      for (const te2 of this.filteredChildren) {
        height += te2.totalHeight;
      }
    }
    const maxChildrenHeight = this.isRoot ? ((_e = (_d = ref.dom) == null ? void 0 : _d.parentElement) == null ? void 0 : _e.clientHeight) ?? 0 : DefaultMaxChildrenHeight;
    return Math.min(maxChildrenHeight, height);
  }
  get totalHeight() {
    return MainLineHeight + this.childrenHeight;
  }
  forceUpdate() {
    var _a2;
    (_a2 = this._ref) == null ? void 0 : _a2.forceUpdate();
  }
  simpleRefCall(method4, fallbackProperty, value2) {
    if (this._ref) {
      this._ref[method4](value2);
    } else {
      this[fallbackProperty] = value2;
    }
  }
};
_c = L$2;
let Entry = _Entry;
const useIconsStore = create$1((set2, get5) => ({
  icons: {},
  add: (icons) => set2((state) => {
    const newIcons = { ...state.icons };
    Object.keys(icons).forEach((e2) => {
      newIcons[e2] = icons[e2];
    });
    return { icons: newIcons };
  })
}));
const buildCacheKey = (type4, path) => {
  let suffix = "";
  switch (type4) {
    case IconType.UnknownFile:
    case IconType.Directory:
      break;
    case IconType.Dynamic: {
      if (!path) {
        return void 0;
      }
      if (path.endsWith(".exe") || path.endsWith(".app")) {
        suffix = path;
        break;
      }
      const filename = _$2.last(splitPathIntoSegments(path));
      const filenameSegments = filename.split(".");
      const ext = filenameSegments[filenameSegments.length - 1];
      if (ext == void 0) {
        type4 = IconType.UnknownFile;
      } else {
        suffix = `.${ext}`;
      }
      break;
    }
  }
  return `${type4}-${suffix}`;
};
const FileSystemEntryIcon = ({
  path,
  type: type4,
  size: size2 = 14,
  disableCache
}) => {
  const cacheKey = buildCacheKey(type4, path);
  const { icons, add: add2 } = useIconsStore();
  const iconCache = cacheKey == void 0 ? void 0 : icons[cacheKey];
  const iconImgDataRef = reactExports.useRef(disableCache ? void 0 : iconCache === void 0 ? void 0 : iconCache);
  const forceUpdate = useUpdate();
  reactExports.useEffect(() => {
    if (iconImgDataRef.current === void 0 && cacheKey != void 0) {
      BApi$1.file.getIconData({
        type: type4,
        path
      }).then((r2) => {
        add2({ [cacheKey]: r2.data });
        iconImgDataRef.current = r2.data;
        forceUpdate();
      });
    }
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "file-system-entry-icon",
      style: {
        width: size2,
        height: size2,
        minWidth: size2,
        minHeight: size2
      },
      children: iconImgDataRef.current ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", src: iconImgDataRef.current }) : type4 == IconType.Directory ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdFolder, { style: {
        color: "#ccc",
        fontSize: size2
      } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        MdInsertDriveFile,
        {
          style: {
            color: "#ccc",
            fontSize: size2
          },
          title: instance.t("Unknown file type")
        }
      )
    }
  );
};
FileSystemEntryIcon.displayName = "FileSystemEntryIcon";
const FileSystemEntryChangeExampleItem = (props) => {
  const {
    type: type4,
    editable = false,
    layer = 0,
    text: text2 = "",
    path,
    onChange,
    isDirectory = false,
    hideIcon,
    className
  } = props;
  const style2 = {
    paddingLeft: `${layer * 24}px`
  };
  const renderInner = () => {
    switch (type4) {
      case "error":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "px-0 whitespace-normal h-auto",
            classNames: { content: "px-0" },
            color: "danger",
            size: "sm",
            variant: "light",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { style: { fontSize: "18px" } }),
              text2
            ] })
          }
        ) });
      case "others":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.UnknownFile }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              className: "px-0 whitespace-break-spaces",
              classNames: { content: "px-0" },
              size: "sm",
              variant: "light",
              children: text2
            }
          )
        ] });
      case "added": {
        if (editable) {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "px-0",
                classNames: { content: "px-0" },
                color: "success",
                size: "sm",
                variant: "light",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.Directory })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                radius: "none",
                defaultValue: text2,
                size: "sm",
                onValueChange: (v2) => {
                  onChange == null ? void 0 : onChange(v2);
                }
              }
            )
          ] });
        } else {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              className: "px-0",
              classNames: { content: "px-0" },
              color: "success",
              size: "sm",
              variant: "light",
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryIcon,
                  {
                    path,
                    size: 20,
                    type: isDirectory ? IconType.Directory : path ? IconType.Dynamic : IconType.UnknownFile
                  }
                ),
                text2
              ] })
            }
          ) });
        }
      }
      case "deleted":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "line-through px-0 whitespace-normal h-auto",
            classNames: { content: "px-0" },
            color: "danger",
            size: "sm",
            variant: "light",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              !hideIcon && /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemEntryIcon,
                {
                  path,
                  size: 20,
                  type: isDirectory ? IconType.Directory : path ? IconType.Dynamic : IconType.UnknownFile
                }
              ),
              text2
            ] })
          }
        ) });
      case "default":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { size: 20, type: IconType.Directory }),
          text2
        ] });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${className} flex items-center gap-2`, style: style2, children: renderInner() });
};
FileSystemEntryChangeExampleItem.displayName = "FileSystemEntryChangeExampleItem";
const FileSystemEntryChangeExampleMiscellaneousItem = ({
  indent,
  parent
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    FileSystemEntryChangeExampleItem,
    {
      className: "opacity-60",
      layer: indent,
      text: parent ? `${t2("Other files in {{parent}}", { parent })}...` : `${t2("Other files")}...`,
      type: "others"
    }
  );
};
FileSystemEntryChangeExampleMiscellaneousItem.displayName = "FileSystemEntryChangeExampleMiscellaneousItem";
const ExtractModal = ({ entries = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [targetEntries, setTargetEntries] = reactExports.useState([]);
  reactExports.useEffect(() => {
    const directoryEntries = _$2.sortBy(
      _$2.sortBy(
        entries.filter((entry) => entry.isDirectory),
        (e2) => e2.path
      ),
      (x2) => x2.path.length
    );
    const outerDirectoryEntries = [];
    const outerDirectoryPaths = /* @__PURE__ */ new Set();
    for (const de2 of directoryEntries) {
      let skip2 = false;
      for (const odp of outerDirectoryPaths) {
        if (de2.path.startsWith(odp)) {
          skip2 = true;
        }
      }
      if (!skip2) {
        outerDirectoryPaths.add(`${de2.path}/`);
        outerDirectoryEntries.push(de2);
      }
    }
    setTargetEntries(outerDirectoryEntries);
  }, [entries]);
  const groups = _$2.groupBy(targetEntries, (e2) => {
    var _a2;
    return (_a2 = e2.parent) == null ? void 0 : _a2.path;
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.extractModal.okButton")}(Enter)`,
          autoFocus: true
        }
      },
      size: "xl",
      title: t2("fileExplorer.extractModal.title", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        for (const e2 of targetEntries) {
          await BApi$1.file.extractAndRemoveDirectory({ directory: e2.path });
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: Object.keys(groups).map((parent) => {
        const innerEntries = groups[parent] ?? [];
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              isDirectory: true,
              text: parent ?? ".",
              type: "default"
            }
          ),
          innerEntries.map((e2) => {
            if (e2.isDirectoryOrDrive) {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: e2.isDirectory,
                    layer: 1,
                    path: e2.path,
                    text: e2.name,
                    type: "deleted"
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: false,
                    layer: 2,
                    text: `${t2("fileExplorer.extractModal.otherFiles")}...`,
                    type: "deleted"
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: false,
                    layer: 1,
                    text: `${t2("fileExplorer.extractModal.otherFilesIn", { parent: e2.name })}...`,
                    type: "added"
                  }
                )
              ] }, e2.path);
            } else {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                FileSystemEntryChangeExampleItem,
                {
                  isDirectory: e2.isDirectory,
                  layer: 1,
                  path: e2.path,
                  text: e2.name,
                  type: "default"
                },
                e2.path
              );
            }
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleMiscellaneousItem,
            {
              indent: 1,
              parent
            }
          )
        ] }, parent);
      }) })
    }
  );
};
ExtractModal.displayName = "ExtractModal";
const WrapModal = ({ entries = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const groupsRef = reactExports.useRef(_$2.groupBy(entries, (e2) => {
    var _a2;
    return (_a2 = e2.parent) == null ? void 0 : _a2.path;
  }));
  const [newParentNames, setNewParentNames] = reactExports.useState(
    _$2.mapValues(groupsRef.current, (g2) => g2[0].meaningfulName)
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.wrapModal.okButton")}(Enter)`,
          autoFocus: true,
          disabled: _$2.values(newParentNames).some((x2) => !x2 || x2.length == 0)
        }
      },
      size: "xl",
      title: t2("fileExplorer.wrapModal.title", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        await Promise.all(
          _$2.keys(groupsRef.current).map(async (p2) => {
            const innerEntries = groupsRef.current[p2];
            const parentEntry = innerEntries[0].parent;
            const d2 = [parentEntry.path, newParentNames[p2]].join(
              BusinessConstants.pathSeparator
            );
            await BApi$1.file.moveEntries({
              destDir: d2,
              entryPaths: innerEntries.map((e2) => e2.path)
            });
          })
        );
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: Object.keys(groupsRef.current).map((parent) => {
        const innerEntries = groupsRef.current[parent] ?? [];
        const newParentName = newParentNames[parent] ?? "";
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              isDirectory: true,
              text: parent ?? ".",
              type: "default"
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              editable: true,
              isDirectory: true,
              layer: 1,
              text: newParentName,
              type: "added",
              onChange: (v2) => {
                setNewParentNames((old) => ({ ...old, [parent]: v2 }));
              }
            }
          ),
          innerEntries.map((e2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: e2.isDirectory,
                layer: 2,
                path: e2.path,
                text: e2.name,
                type: "added"
              },
              `${e2.path}-added`
            );
          }),
          innerEntries.map((e2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: e2.isDirectory,
                layer: 1,
                path: e2.path,
                text: e2.name,
                type: "deleted"
              },
              `${e2.path}-deleted`
            );
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleMiscellaneousItem,
            {
              indent: 1,
              parent
            }
          )
        ] }, parent);
      }) })
    }
  );
};
WrapModal.displayName = "WrapModal";
const log$z = buildLogger("DeleteConfirmationModal");
const _mergeItems = (entries, entryRestSegmentsMap, path) => {
  const prefixes2 = [];
  const ret = [];
  const groups = _$2.groupBy(
    entries,
    (e2) => entryRestSegmentsMap.get(e2.path).shift()
  );
  const keys2 = _$2.sortBy(_$2.keys(groups), (x2) => x2);
  for (const key of keys2) {
    const childrenEntries = groups[key].filter(
      (x2) => entryRestSegmentsMap.get(x2.path).length > 0
    );
    const pathSegment2 = [...prefixes2, key].join("/");
    const newPath = [path, pathSegment2].filter((x2) => x2 != void 0).join("/");
    if (childrenEntries.length == 1) {
      ret.push({
        pathSegment: pathSegment2,
        isDirectory: childrenEntries[0].isDirectory,
        path: newPath,
        willBeDeleted: entryRestSegmentsMap.has(newPath)
      });
    } else {
      ret.push({
        pathSegment: pathSegment2,
        children: _mergeItems(childrenEntries, entryRestSegmentsMap, newPath),
        isDirectory: true,
        path: newPath,
        willBeDeleted: entryRestSegmentsMap.has(newPath)
      });
    }
  }
  return ret;
};
const mergeItems = (entries, rootPath) => {
  const entryRestSegmentsMap = entries.reduce((s2, t2) => {
    s2.set(
      t2.path,
      splitPathIntoSegments(
        rootPath == void 0 ? t2.path : t2.path.replace(rootPath, "")
      )
    );
    return s2;
  }, /* @__PURE__ */ new Map());
  const list2 = _mergeItems(entries, entryRestSegmentsMap, rootPath);
  if (rootPath == void 0) {
    return list2;
  } else {
    return [
      {
        pathSegment: rootPath,
        children: list2,
        isDirectory: true,
        path: rootPath,
        willBeDeleted: false
      }
    ];
  }
};
const renderItem = (item, layer) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      FileSystemEntryChangeExampleItem,
      {
        isDirectory: item.isDirectory,
        layer,
        text: item.pathSegment,
        type: item.willBeDeleted ? "deleted" : "default"
      }
    ),
    item.children && item.children.map((x2) => renderItem(x2, layer + 1))
  ] }, item.path);
};
const DeleteConfirmationModal = ({
  entries = [],
  onDestroyed,
  rootPath
}) => {
  const { t: t2 } = useTranslation();
  const items = mergeItems(entries, rootPath);
  log$z(rootPath, entries, items);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.deleteModal.okButton")}(Enter)`,
          color: "danger",
          autoFocus: true
        }
      },
      size: "xl",
      title: t2("fileExplorer.deleteModal.title"),
      onDestroyed,
      onOk: async () => await BApi$1.file.removeFiles({ paths: entries.map((p2) => p2.path) }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        items.map((item) => renderItem(item, 0)),
        rootPath && /* @__PURE__ */ jsxRuntimeExports.jsx(
          FileSystemEntryChangeExampleMiscellaneousItem,
          {
            indent: 1,
            parent: rootPath
          }
        )
      ] })
    }
  );
};
DeleteConfirmationModal.displayName = "DeleteConfirmationModal";
const DeleteItemsWithSameNamesModal = ({
  entries,
  workingDirectory,
  onDestroyed,
  ...dialogProps
}) => {
  const [deletingAllPaths, setDeletingAllPaths] = reactExports.useState();
  const { t: t2 } = useTranslation();
  reactExports.useEffect(() => {
    BApi$1.file.getSameNameEntriesInWorkingDirectory({
      workingDir: workingDirectory,
      entryPaths: entries.map((e2) => e2.path)
    }).then((t22) => {
      setDeletingAllPaths(t22.data || []);
    });
    return () => {
    };
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.deleteSameNamesModal.okButton")}(Enter)`,
          color: "danger",
          autoFocus: true,
          disabled: !deletingAllPaths || deletingAllPaths.length == 0
        }
      },
      size: "xl",
      title: t2("fileExplorer.deleteSameNamesModal.title"),
      onDestroyed,
      onOk: async () => {
        if (!deletingAllPaths || deletingAllPaths.length == 0) {
          toast.danger(t2("fileExplorer.deleteSameNamesModal.nothingToDelete"));
          return false;
        } else {
          const rsp = await BApi$1.file.removeSameNameEntryInWorkingDirectory({
            workingDir: workingDirectory,
            entryPaths: entries.map((e2) => e2.path)
          });
          return rsp;
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2", children: t2("fileExplorer.deleteSameNamesModal.description", {
          count: entries.length,
          workingDirectory
        }) }),
        deletingAllPaths ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryChangeExampleItem,
            {
              text: workingDirectory,
              type: "default"
            }
          ),
          deletingAllPaths.map((d2, i2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                isDirectory: d2.isDirectory,
                layer: 1,
                path: d2.path,
                text: d2.name,
                type: "deleted"
              }
            );
          })
        ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}),
          t2("fileExplorer.deleteSameNamesModal.discovering")
        ] })
      ]
    }
  );
};
DeleteItemsWithSameNamesModal.displayName = "DeleteItemsWithSameNamesModal";
const GroupModal = ({ entries = [], groupInternal, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [preview, setPreview] = reactExports.useState();
  const forceUpdate = useUpdate();
  const similarityThresholdRef = reactExports.useRef(1);
  const [caculating, setCaculating] = reactExports.useState(true);
  const caculate = () => {
    setCaculating(true);
    BApi$1.file.previewFileSystemEntriesGroupResult({
      paths: entries.map((e2) => e2.path),
      groupInternal,
      similarityThreshold: similarityThresholdRef.current
    }).then((x2) => {
      setPreview(x2.data);
    }).finally(() => {
      setCaculating(false);
    });
  };
  reactExports.useEffect(() => {
    caculate();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.groupModal.okButton")}(Enter)`,
          autoFocus: true,
          disabled: !preview || preview.length == 0
        }
      },
      size: "xl",
      title: t2(groupInternal ? "fileExplorer.groupModal.titleInternal" : "fileExplorer.groupModal.title", {
        count: entries.length
      }),
      onDestroyed,
      onOk: async () => {
        await BApi$1.file.groupFileSystemEntries({
          paths: entries.map((e2) => e2.path),
          groupInternal,
          similarityThreshold: similarityThresholdRef.current
        });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          slider_default,
          {
            defaultValue: similarityThresholdRef.current,
            isDisabled: caculating,
            maxValue: 1,
            minValue: 0,
            size: "sm",
            step: 0.01,
            onChange: (v2) => {
              similarityThresholdRef.current = v2;
              forceUpdate();
            },
            onChangeEnd: (v2) => {
              caculate();
            },
            renderValue: (v2) => {
              const p2 = Math.round(similarityThresholdRef.current * 100);
              if (p2 == 0) {
                return `${t2("fileExplorer.groupModal.allItemsOneFolder")}`;
              }
              if (p2 == 100) {
                return `${t2("fileExplorer.groupModal.exactSameNameFolder")}`;
              }
              return `${p2}%`;
            },
            label: t2("fileExplorer.groupModal.similarityThreshold")
          }
        ),
        preview ? preview.map((p2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { isDirectory: true, text: p2.rootPath, type: "default" }),
            p2.groups && p2.groups.length > 0 ? p2.groups.map((g2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  FileSystemEntryChangeExampleItem,
                  {
                    isDirectory: true,
                    layer: 1,
                    text: g2.directoryName,
                    type: "added"
                  }
                ),
                g2.filenames.map((f2) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { layer: 2, text: f2, type: "added" });
                }),
                g2.filenames.map((f2) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleItem, { layer: 1, text: f2, type: "deleted" });
                })
              ] });
            }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              FileSystemEntryChangeExampleItem,
              {
                layer: 1,
                text: t2("fileExplorer.groupModal.nothingToGroup"),
                type: "error"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryChangeExampleMiscellaneousItem, { indent: 1, parent: p2.rootPath })
          ] });
        }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}),
          t2("fileExplorer.groupModal.calculating")
        ] })
      ] })
    }
  );
};
GroupModal.displayName = "GroupModal";
function useCombinedRefs() {
  for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
    refs[_key] = arguments[_key];
  }
  return reactExports.useMemo(
    () => (node2) => {
      refs.forEach((ref) => ref(node2));
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    refs
  );
}
const canUseDOM$1 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
function isWindow$1(element2) {
  const elementString = Object.prototype.toString.call(element2);
  return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global]
  elementString === "[object global]";
}
function isNode(node2) {
  return "nodeType" in node2;
}
function getWindow$2(target) {
  var _target$ownerDocument, _target$ownerDocument2;
  if (!target) {
    return window;
  }
  if (isWindow$1(target)) {
    return target;
  }
  if (!isNode(target)) {
    return window;
  }
  return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window;
}
function isDocument(node2) {
  const {
    Document
  } = getWindow$2(node2);
  return node2 instanceof Document;
}
function isHTMLElement(node2) {
  if (isWindow$1(node2)) {
    return false;
  }
  return node2 instanceof getWindow$2(node2).HTMLElement;
}
function isSVGElement(node2) {
  return node2 instanceof getWindow$2(node2).SVGElement;
}
function getOwnerDocument(target) {
  if (!target) {
    return document;
  }
  if (isWindow$1(target)) {
    return target.document;
  }
  if (!isNode(target)) {
    return document;
  }
  if (isDocument(target)) {
    return target;
  }
  if (isHTMLElement(target) || isSVGElement(target)) {
    return target.ownerDocument;
  }
  return document;
}
const useIsomorphicLayoutEffect = canUseDOM$1 ? reactExports.useLayoutEffect : reactExports.useEffect;
function useEvent(handler) {
  const handlerRef = reactExports.useRef(handler);
  useIsomorphicLayoutEffect(() => {
    handlerRef.current = handler;
  });
  return reactExports.useCallback(function() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return handlerRef.current == null ? void 0 : handlerRef.current(...args);
  }, []);
}
function useInterval() {
  const intervalRef = reactExports.useRef(null);
  const set2 = reactExports.useCallback((listener, duration2) => {
    intervalRef.current = setInterval(listener, duration2);
  }, []);
  const clear = reactExports.useCallback(() => {
    if (intervalRef.current !== null) {
      clearInterval(intervalRef.current);
      intervalRef.current = null;
    }
  }, []);
  return [set2, clear];
}
function useLatestValue(value2, dependencies) {
  if (dependencies === void 0) {
    dependencies = [value2];
  }
  const valueRef = reactExports.useRef(value2);
  useIsomorphicLayoutEffect(() => {
    if (valueRef.current !== value2) {
      valueRef.current = value2;
    }
  }, dependencies);
  return valueRef;
}
function useLazyMemo(callback2, dependencies) {
  const valueRef = reactExports.useRef();
  return reactExports.useMemo(
    () => {
      const newValue = callback2(valueRef.current);
      valueRef.current = newValue;
      return newValue;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [...dependencies]
  );
}
function useNodeRef(onChange) {
  const onChangeHandler = useEvent(onChange);
  const node2 = reactExports.useRef(null);
  const setNodeRef = reactExports.useCallback(
    (element2) => {
      if (element2 !== node2.current) {
        onChangeHandler == null ? void 0 : onChangeHandler(element2, node2.current);
      }
      node2.current = element2;
    },
    //eslint-disable-next-line
    []
  );
  return [node2, setNodeRef];
}
function usePrevious2(value2) {
  const ref = reactExports.useRef();
  reactExports.useEffect(() => {
    ref.current = value2;
  }, [value2]);
  return ref.current;
}
let ids = {};
function useUniqueId(prefix, value2) {
  return reactExports.useMemo(() => {
    if (value2) {
      return value2;
    }
    const id2 = ids[prefix] == null ? 0 : ids[prefix] + 1;
    ids[prefix] = id2;
    return prefix + "-" + id2;
  }, [prefix, value2]);
}
function createAdjustmentFn(modifier) {
  return function(object4) {
    for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      adjustments[_key - 1] = arguments[_key];
    }
    return adjustments.reduce((accumulator, adjustment) => {
      const entries = Object.entries(adjustment);
      for (const [key, valueAdjustment] of entries) {
        const value2 = accumulator[key];
        if (value2 != null) {
          accumulator[key] = value2 + modifier * valueAdjustment;
        }
      }
      return accumulator;
    }, {
      ...object4
    });
  };
}
const add = /* @__PURE__ */ createAdjustmentFn(1);
const subtract = /* @__PURE__ */ createAdjustmentFn(-1);
function hasViewportRelativeCoordinates(event) {
  return "clientX" in event && "clientY" in event;
}
function isKeyboardEvent(event) {
  if (!event) {
    return false;
  }
  const {
    KeyboardEvent: KeyboardEvent2
  } = getWindow$2(event.target);
  return KeyboardEvent2 && event instanceof KeyboardEvent2;
}
function isTouchEvent$1(event) {
  if (!event) {
    return false;
  }
  const {
    TouchEvent
  } = getWindow$2(event.target);
  return TouchEvent && event instanceof TouchEvent;
}
function getEventCoordinates(event) {
  if (isTouchEvent$1(event)) {
    if (event.touches && event.touches.length) {
      const {
        clientX: x2,
        clientY: y2
      } = event.touches[0];
      return {
        x: x2,
        y: y2
      };
    } else if (event.changedTouches && event.changedTouches.length) {
      const {
        clientX: x2,
        clientY: y2
      } = event.changedTouches[0];
      return {
        x: x2,
        y: y2
      };
    }
  }
  if (hasViewportRelativeCoordinates(event)) {
    return {
      x: event.clientX,
      y: event.clientY
    };
  }
  return null;
}
const CSS$1 = /* @__PURE__ */ Object.freeze({
  Translate: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      const {
        x: x2,
        y: y2
      } = transform2;
      return "translate3d(" + (x2 ? Math.round(x2) : 0) + "px, " + (y2 ? Math.round(y2) : 0) + "px, 0)";
    }
  },
  Scale: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      const {
        scaleX,
        scaleY
      } = transform2;
      return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")";
    }
  },
  Transform: {
    toString(transform2) {
      if (!transform2) {
        return;
      }
      return [CSS$1.Translate.toString(transform2), CSS$1.Scale.toString(transform2)].join(" ");
    }
  },
  Transition: {
    toString(_ref) {
      let {
        property: property2,
        duration: duration2,
        easing
      } = _ref;
      return property2 + " " + duration2 + "ms " + easing;
    }
  }
});
const SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
function findFirstFocusableNode(element2) {
  if (element2.matches(SELECTOR)) {
    return element2;
  }
  return element2.querySelector(SELECTOR);
}
const hiddenStyles = {
  display: "none"
};
function HiddenText(_ref) {
  let {
    id: id2,
    value: value2
  } = _ref;
  return React$6.createElement("div", {
    id: id2,
    style: hiddenStyles
  }, value2);
}
function LiveRegion(_ref) {
  let {
    id: id2,
    announcement,
    ariaLiveType = "assertive"
  } = _ref;
  const visuallyHidden = {
    position: "fixed",
    top: 0,
    left: 0,
    width: 1,
    height: 1,
    margin: -1,
    border: 0,
    padding: 0,
    overflow: "hidden",
    clip: "rect(0 0 0 0)",
    clipPath: "inset(100%)",
    whiteSpace: "nowrap"
  };
  return React$6.createElement("div", {
    id: id2,
    style: visuallyHidden,
    role: "status",
    "aria-live": ariaLiveType,
    "aria-atomic": true
  }, announcement);
}
function useAnnouncement() {
  const [announcement, setAnnouncement] = reactExports.useState("");
  const announce = reactExports.useCallback((value2) => {
    if (value2 != null) {
      setAnnouncement(value2);
    }
  }, []);
  return {
    announce,
    announcement
  };
}
const DndMonitorContext = /* @__PURE__ */ reactExports.createContext(null);
function useDndMonitor(listener) {
  const registerListener = reactExports.useContext(DndMonitorContext);
  reactExports.useEffect(() => {
    if (!registerListener) {
      throw new Error("useDndMonitor must be used within a children of <DndContext>");
    }
    const unsubscribe = registerListener(listener);
    return unsubscribe;
  }, [listener, registerListener]);
}
function useDndMonitorProvider() {
  const [listeners] = reactExports.useState(() => /* @__PURE__ */ new Set());
  const registerListener = reactExports.useCallback((listener) => {
    listeners.add(listener);
    return () => listeners.delete(listener);
  }, [listeners]);
  const dispatch = reactExports.useCallback((_ref) => {
    let {
      type: type4,
      event
    } = _ref;
    listeners.forEach((listener) => {
      var _listener$type;
      return (_listener$type = listener[type4]) == null ? void 0 : _listener$type.call(listener, event);
    });
  }, [listeners]);
  return [dispatch, registerListener];
}
const defaultScreenReaderInstructions = {
  draggable: "\n    To pick up a draggable item, press the space bar.\n    While dragging, use the arrow keys to move the item.\n    Press space again to drop the item in its new position, or press escape to cancel.\n  "
};
const defaultAnnouncements = {
  onDragStart(_ref) {
    let {
      active: active3
    } = _ref;
    return "Picked up draggable item " + active3.id + ".";
  },
  onDragOver(_ref2) {
    let {
      active: active3,
      over
    } = _ref2;
    if (over) {
      return "Draggable item " + active3.id + " was moved over droppable area " + over.id + ".";
    }
    return "Draggable item " + active3.id + " is no longer over a droppable area.";
  },
  onDragEnd(_ref3) {
    let {
      active: active3,
      over
    } = _ref3;
    if (over) {
      return "Draggable item " + active3.id + " was dropped over droppable area " + over.id;
    }
    return "Draggable item " + active3.id + " was dropped.";
  },
  onDragCancel(_ref4) {
    let {
      active: active3
    } = _ref4;
    return "Dragging was cancelled. Draggable item " + active3.id + " was dropped.";
  }
};
function Accessibility(_ref) {
  let {
    announcements = defaultAnnouncements,
    container,
    hiddenTextDescribedById,
    screenReaderInstructions = defaultScreenReaderInstructions
  } = _ref;
  const {
    announce,
    announcement
  } = useAnnouncement();
  const liveRegionId = useUniqueId("DndLiveRegion");
  const [mounted, setMounted] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setMounted(true);
  }, []);
  useDndMonitor(reactExports.useMemo(() => ({
    onDragStart(_ref2) {
      let {
        active: active3
      } = _ref2;
      announce(announcements.onDragStart({
        active: active3
      }));
    },
    onDragMove(_ref3) {
      let {
        active: active3,
        over
      } = _ref3;
      if (announcements.onDragMove) {
        announce(announcements.onDragMove({
          active: active3,
          over
        }));
      }
    },
    onDragOver(_ref4) {
      let {
        active: active3,
        over
      } = _ref4;
      announce(announcements.onDragOver({
        active: active3,
        over
      }));
    },
    onDragEnd(_ref5) {
      let {
        active: active3,
        over
      } = _ref5;
      announce(announcements.onDragEnd({
        active: active3,
        over
      }));
    },
    onDragCancel(_ref6) {
      let {
        active: active3,
        over
      } = _ref6;
      announce(announcements.onDragCancel({
        active: active3,
        over
      }));
    }
  }), [announce, announcements]));
  if (!mounted) {
    return null;
  }
  const markup = React$6.createElement(React$6.Fragment, null, React$6.createElement(HiddenText, {
    id: hiddenTextDescribedById,
    value: screenReaderInstructions.draggable
  }), React$6.createElement(LiveRegion, {
    id: liveRegionId,
    announcement
  }));
  return container ? reactDomExports.createPortal(markup, container) : markup;
}
var Action;
(function(Action2) {
  Action2["DragStart"] = "dragStart";
  Action2["DragMove"] = "dragMove";
  Action2["DragEnd"] = "dragEnd";
  Action2["DragCancel"] = "dragCancel";
  Action2["DragOver"] = "dragOver";
  Action2["RegisterDroppable"] = "registerDroppable";
  Action2["SetDroppableDisabled"] = "setDroppableDisabled";
  Action2["UnregisterDroppable"] = "unregisterDroppable";
})(Action || (Action = {}));
function noop$2() {
}
function useSensor(sensor, options) {
  return reactExports.useMemo(
    () => ({
      sensor,
      options: options != null ? options : {}
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [sensor, options]
  );
}
function useSensors() {
  for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) {
    sensors[_key] = arguments[_key];
  }
  return reactExports.useMemo(
    () => [...sensors].filter((sensor) => sensor != null),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [...sensors]
  );
}
const defaultCoordinates = /* @__PURE__ */ Object.freeze({
  x: 0,
  y: 0
});
function distanceBetween(p1, p2) {
  return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
}
function sortCollisionsAsc(_ref, _ref2) {
  let {
    data: {
      value: a2
    }
  } = _ref;
  let {
    data: {
      value: b2
    }
  } = _ref2;
  return a2 - b2;
}
function sortCollisionsDesc(_ref3, _ref4) {
  let {
    data: {
      value: a2
    }
  } = _ref3;
  let {
    data: {
      value: b2
    }
  } = _ref4;
  return b2 - a2;
}
function cornersOfRectangle(_ref5) {
  let {
    left: left2,
    top: top2,
    height,
    width
  } = _ref5;
  return [{
    x: left2,
    y: top2
  }, {
    x: left2 + width,
    y: top2
  }, {
    x: left2,
    y: top2 + height
  }, {
    x: left2 + width,
    y: top2 + height
  }];
}
function getFirstCollision(collisions, property2) {
  if (!collisions || collisions.length === 0) {
    return null;
  }
  const [firstCollision] = collisions;
  return firstCollision[property2];
}
function centerOfRectangle(rect, left2, top2) {
  if (left2 === void 0) {
    left2 = rect.left;
  }
  if (top2 === void 0) {
    top2 = rect.top;
  }
  return {
    x: left2 + rect.width * 0.5,
    y: top2 + rect.height * 0.5
  };
}
const closestCenter = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const centerRect = centerOfRectangle(collisionRect, collisionRect.left, collisionRect.top);
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const distBetween = distanceBetween(centerOfRectangle(rect), centerRect);
      collisions.push({
        id: id2,
        data: {
          droppableContainer,
          value: distBetween
        }
      });
    }
  }
  return collisions.sort(sortCollisionsAsc);
};
const closestCorners = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const corners = cornersOfRectangle(collisionRect);
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const rectCorners = cornersOfRectangle(rect);
      const distances = corners.reduce((accumulator, corner, index2) => {
        return accumulator + distanceBetween(rectCorners[index2], corner);
      }, 0);
      const effectiveDistance = Number((distances / 4).toFixed(4));
      collisions.push({
        id: id2,
        data: {
          droppableContainer,
          value: effectiveDistance
        }
      });
    }
  }
  return collisions.sort(sortCollisionsAsc);
};
function getIntersectionRatio(entry, target) {
  const top2 = Math.max(target.top, entry.top);
  const left2 = Math.max(target.left, entry.left);
  const right = Math.min(target.left + target.width, entry.left + entry.width);
  const bottom2 = Math.min(target.top + target.height, entry.top + entry.height);
  const width = right - left2;
  const height = bottom2 - top2;
  if (left2 < right && top2 < bottom2) {
    const targetArea = target.width * target.height;
    const entryArea = entry.width * entry.height;
    const intersectionArea = width * height;
    const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea);
    return Number(intersectionRatio.toFixed(4));
  }
  return 0;
}
const rectIntersection = (_ref) => {
  let {
    collisionRect,
    droppableRects,
    droppableContainers
  } = _ref;
  const collisions = [];
  for (const droppableContainer of droppableContainers) {
    const {
      id: id2
    } = droppableContainer;
    const rect = droppableRects.get(id2);
    if (rect) {
      const intersectionRatio = getIntersectionRatio(rect, collisionRect);
      if (intersectionRatio > 0) {
        collisions.push({
          id: id2,
          data: {
            droppableContainer,
            value: intersectionRatio
          }
        });
      }
    }
  }
  return collisions.sort(sortCollisionsDesc);
};
function adjustScale(transform2, rect1, rect2) {
  return {
    ...transform2,
    scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1,
    scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1
  };
}
function getRectDelta(rect1, rect2) {
  return rect1 && rect2 ? {
    x: rect1.left - rect2.left,
    y: rect1.top - rect2.top
  } : defaultCoordinates;
}
function createRectAdjustmentFn(modifier) {
  return function adjustClientRect(rect) {
    for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      adjustments[_key - 1] = arguments[_key];
    }
    return adjustments.reduce((acc, adjustment) => ({
      ...acc,
      top: acc.top + modifier * adjustment.y,
      bottom: acc.bottom + modifier * adjustment.y,
      left: acc.left + modifier * adjustment.x,
      right: acc.right + modifier * adjustment.x
    }), {
      ...rect
    });
  };
}
const getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1);
function parseTransform(transform2) {
  if (transform2.startsWith("matrix3d(")) {
    const transformArray = transform2.slice(9, -1).split(/, /);
    return {
      x: +transformArray[12],
      y: +transformArray[13],
      scaleX: +transformArray[0],
      scaleY: +transformArray[5]
    };
  } else if (transform2.startsWith("matrix(")) {
    const transformArray = transform2.slice(7, -1).split(/, /);
    return {
      x: +transformArray[4],
      y: +transformArray[5],
      scaleX: +transformArray[0],
      scaleY: +transformArray[3]
    };
  }
  return null;
}
function inverseTransform(rect, transform2, transformOrigin) {
  const parsedTransform = parseTransform(transform2);
  if (!parsedTransform) {
    return rect;
  }
  const {
    scaleX,
    scaleY,
    x: translateX,
    y: translateY
  } = parsedTransform;
  const x2 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin);
  const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1));
  const w2 = scaleX ? rect.width / scaleX : rect.width;
  const h3 = scaleY ? rect.height / scaleY : rect.height;
  return {
    width: w2,
    height: h3,
    top: y2,
    right: x2 + w2,
    bottom: y2 + h3,
    left: x2
  };
}
const defaultOptions = {
  ignoreTransform: false
};
function getClientRect(element2, options) {
  if (options === void 0) {
    options = defaultOptions;
  }
  let rect = element2.getBoundingClientRect();
  if (options.ignoreTransform) {
    const {
      transform: transform2,
      transformOrigin
    } = getWindow$2(element2).getComputedStyle(element2);
    if (transform2) {
      rect = inverseTransform(rect, transform2, transformOrigin);
    }
  }
  const {
    top: top2,
    left: left2,
    width,
    height,
    bottom: bottom2,
    right
  } = rect;
  return {
    top: top2,
    left: left2,
    width,
    height,
    bottom: bottom2,
    right
  };
}
function getTransformAgnosticClientRect(element2) {
  return getClientRect(element2, {
    ignoreTransform: true
  });
}
function getWindowClientRect(element2) {
  const width = element2.innerWidth;
  const height = element2.innerHeight;
  return {
    top: 0,
    left: 0,
    right: width,
    bottom: height,
    width,
    height
  };
}
function isFixed(node2, computedStyle) {
  if (computedStyle === void 0) {
    computedStyle = getWindow$2(node2).getComputedStyle(node2);
  }
  return computedStyle.position === "fixed";
}
function isScrollable$1(element2, computedStyle) {
  if (computedStyle === void 0) {
    computedStyle = getWindow$2(element2).getComputedStyle(element2);
  }
  const overflowRegex = /(auto|scroll|overlay)/;
  const properties2 = ["overflow", "overflowX", "overflowY"];
  return properties2.some((property2) => {
    const value2 = computedStyle[property2];
    return typeof value2 === "string" ? overflowRegex.test(value2) : false;
  });
}
function getScrollableAncestors(element2, limit2) {
  const scrollParents = [];
  function findScrollableAncestors(node2) {
    if (limit2 != null && scrollParents.length >= limit2) {
      return scrollParents;
    }
    if (!node2) {
      return scrollParents;
    }
    if (isDocument(node2) && node2.scrollingElement != null && !scrollParents.includes(node2.scrollingElement)) {
      scrollParents.push(node2.scrollingElement);
      return scrollParents;
    }
    if (!isHTMLElement(node2) || isSVGElement(node2)) {
      return scrollParents;
    }
    if (scrollParents.includes(node2)) {
      return scrollParents;
    }
    const computedStyle = getWindow$2(element2).getComputedStyle(node2);
    if (node2 !== element2) {
      if (isScrollable$1(node2, computedStyle)) {
        scrollParents.push(node2);
      }
    }
    if (isFixed(node2, computedStyle)) {
      return scrollParents;
    }
    return findScrollableAncestors(node2.parentNode);
  }
  if (!element2) {
    return scrollParents;
  }
  return findScrollableAncestors(element2);
}
function getFirstScrollableAncestor(node2) {
  const [firstScrollableAncestor] = getScrollableAncestors(node2, 1);
  return firstScrollableAncestor != null ? firstScrollableAncestor : null;
}
function getScrollableElement(element2) {
  if (!canUseDOM$1 || !element2) {
    return null;
  }
  if (isWindow$1(element2)) {
    return element2;
  }
  if (!isNode(element2)) {
    return null;
  }
  if (isDocument(element2) || element2 === getOwnerDocument(element2).scrollingElement) {
    return window;
  }
  if (isHTMLElement(element2)) {
    return element2;
  }
  return null;
}
function getScrollXCoordinate(element2) {
  if (isWindow$1(element2)) {
    return element2.scrollX;
  }
  return element2.scrollLeft;
}
function getScrollYCoordinate(element2) {
  if (isWindow$1(element2)) {
    return element2.scrollY;
  }
  return element2.scrollTop;
}
function getScrollCoordinates(element2) {
  return {
    x: getScrollXCoordinate(element2),
    y: getScrollYCoordinate(element2)
  };
}
var Direction;
(function(Direction2) {
  Direction2[Direction2["Forward"] = 1] = "Forward";
  Direction2[Direction2["Backward"] = -1] = "Backward";
})(Direction || (Direction = {}));
function isDocumentScrollingElement(element2) {
  if (!canUseDOM$1 || !element2) {
    return false;
  }
  return element2 === document.scrollingElement;
}
function getScrollPosition(scrollingContainer) {
  const minScroll = {
    x: 0,
    y: 0
  };
  const dimensions = isDocumentScrollingElement(scrollingContainer) ? {
    height: window.innerHeight,
    width: window.innerWidth
  } : {
    height: scrollingContainer.clientHeight,
    width: scrollingContainer.clientWidth
  };
  const maxScroll = {
    x: scrollingContainer.scrollWidth - dimensions.width,
    y: scrollingContainer.scrollHeight - dimensions.height
  };
  const isTop = scrollingContainer.scrollTop <= minScroll.y;
  const isLeft = scrollingContainer.scrollLeft <= minScroll.x;
  const isBottom = scrollingContainer.scrollTop >= maxScroll.y;
  const isRight = scrollingContainer.scrollLeft >= maxScroll.x;
  return {
    isTop,
    isLeft,
    isBottom,
    isRight,
    maxScroll,
    minScroll
  };
}
const defaultThreshold = {
  x: 0.2,
  y: 0.2
};
function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) {
  let {
    top: top2,
    left: left2,
    right,
    bottom: bottom2
  } = _ref;
  if (acceleration === void 0) {
    acceleration = 10;
  }
  if (thresholdPercentage === void 0) {
    thresholdPercentage = defaultThreshold;
  }
  const {
    isTop,
    isBottom,
    isLeft,
    isRight
  } = getScrollPosition(scrollContainer);
  const direction = {
    x: 0,
    y: 0
  };
  const speed = {
    x: 0,
    y: 0
  };
  const threshold = {
    height: scrollContainerRect.height * thresholdPercentage.y,
    width: scrollContainerRect.width * thresholdPercentage.x
  };
  if (!isTop && top2 <= scrollContainerRect.top + threshold.height) {
    direction.y = Direction.Backward;
    speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top2) / threshold.height);
  } else if (!isBottom && bottom2 >= scrollContainerRect.bottom - threshold.height) {
    direction.y = Direction.Forward;
    speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom2) / threshold.height);
  }
  if (!isRight && right >= scrollContainerRect.right - threshold.width) {
    direction.x = Direction.Forward;
    speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width);
  } else if (!isLeft && left2 <= scrollContainerRect.left + threshold.width) {
    direction.x = Direction.Backward;
    speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left2) / threshold.width);
  }
  return {
    direction,
    speed
  };
}
function getScrollElementRect(element2) {
  if (element2 === document.scrollingElement) {
    const {
      innerWidth: innerWidth2,
      innerHeight: innerHeight2
    } = window;
    return {
      top: 0,
      left: 0,
      right: innerWidth2,
      bottom: innerHeight2,
      width: innerWidth2,
      height: innerHeight2
    };
  }
  const {
    top: top2,
    left: left2,
    right,
    bottom: bottom2
  } = element2.getBoundingClientRect();
  return {
    top: top2,
    left: left2,
    right,
    bottom: bottom2,
    width: element2.clientWidth,
    height: element2.clientHeight
  };
}
function getScrollOffsets(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return add(acc, getScrollCoordinates(node2));
  }, defaultCoordinates);
}
function getScrollXOffset(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return acc + getScrollXCoordinate(node2);
  }, 0);
}
function getScrollYOffset(scrollableAncestors) {
  return scrollableAncestors.reduce((acc, node2) => {
    return acc + getScrollYCoordinate(node2);
  }, 0);
}
function scrollIntoViewIfNeeded(element2, measure) {
  if (measure === void 0) {
    measure = getClientRect;
  }
  if (!element2) {
    return;
  }
  const {
    top: top2,
    left: left2,
    bottom: bottom2,
    right
  } = measure(element2);
  const firstScrollableAncestor = getFirstScrollableAncestor(element2);
  if (!firstScrollableAncestor) {
    return;
  }
  if (bottom2 <= 0 || right <= 0 || top2 >= window.innerHeight || left2 >= window.innerWidth) {
    element2.scrollIntoView({
      block: "center",
      inline: "center"
    });
  }
}
const properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]];
class Rect {
  constructor(rect, element2) {
    this.rect = void 0;
    this.width = void 0;
    this.height = void 0;
    this.top = void 0;
    this.bottom = void 0;
    this.right = void 0;
    this.left = void 0;
    const scrollableAncestors = getScrollableAncestors(element2);
    const scrollOffsets = getScrollOffsets(scrollableAncestors);
    this.rect = {
      ...rect
    };
    this.width = rect.width;
    this.height = rect.height;
    for (const [axis, keys2, getScrollOffset2] of properties) {
      for (const key of keys2) {
        Object.defineProperty(this, key, {
          get: () => {
            const currentOffsets = getScrollOffset2(scrollableAncestors);
            const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets;
            return this.rect[key] + scrollOffsetsDeltla;
          },
          enumerable: true
        });
      }
    }
    Object.defineProperty(this, "rect", {
      enumerable: false
    });
  }
}
class Listeners {
  constructor(target) {
    this.target = void 0;
    this.listeners = [];
    this.removeAll = () => {
      this.listeners.forEach((listener) => {
        var _this$target;
        return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener);
      });
    };
    this.target = target;
  }
  add(eventName, handler, options) {
    var _this$target2;
    (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options);
    this.listeners.push([eventName, handler, options]);
  }
}
function getEventListenerTarget(target) {
  const {
    EventTarget
  } = getWindow$2(target);
  return target instanceof EventTarget ? target : getOwnerDocument(target);
}
function hasExceededDistance(delta, measurement) {
  const dx = Math.abs(delta.x);
  const dy = Math.abs(delta.y);
  if (typeof measurement === "number") {
    return Math.sqrt(dx ** 2 + dy ** 2) > measurement;
  }
  if ("x" in measurement && "y" in measurement) {
    return dx > measurement.x && dy > measurement.y;
  }
  if ("x" in measurement) {
    return dx > measurement.x;
  }
  if ("y" in measurement) {
    return dy > measurement.y;
  }
  return false;
}
var EventName;
(function(EventName2) {
  EventName2["Click"] = "click";
  EventName2["DragStart"] = "dragstart";
  EventName2["Keydown"] = "keydown";
  EventName2["ContextMenu"] = "contextmenu";
  EventName2["Resize"] = "resize";
  EventName2["SelectionChange"] = "selectionchange";
  EventName2["VisibilityChange"] = "visibilitychange";
})(EventName || (EventName = {}));
function preventDefault(event) {
  event.preventDefault();
}
function stopPropagation(event) {
  event.stopPropagation();
}
var KeyboardCode;
(function(KeyboardCode2) {
  KeyboardCode2["Space"] = "Space";
  KeyboardCode2["Down"] = "ArrowDown";
  KeyboardCode2["Right"] = "ArrowRight";
  KeyboardCode2["Left"] = "ArrowLeft";
  KeyboardCode2["Up"] = "ArrowUp";
  KeyboardCode2["Esc"] = "Escape";
  KeyboardCode2["Enter"] = "Enter";
  KeyboardCode2["Tab"] = "Tab";
})(KeyboardCode || (KeyboardCode = {}));
const defaultKeyboardCodes = {
  start: [KeyboardCode.Space, KeyboardCode.Enter],
  cancel: [KeyboardCode.Esc],
  end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab]
};
const defaultKeyboardCoordinateGetter = (event, _ref) => {
  let {
    currentCoordinates
  } = _ref;
  switch (event.code) {
    case KeyboardCode.Right:
      return {
        ...currentCoordinates,
        x: currentCoordinates.x + 25
      };
    case KeyboardCode.Left:
      return {
        ...currentCoordinates,
        x: currentCoordinates.x - 25
      };
    case KeyboardCode.Down:
      return {
        ...currentCoordinates,
        y: currentCoordinates.y + 25
      };
    case KeyboardCode.Up:
      return {
        ...currentCoordinates,
        y: currentCoordinates.y - 25
      };
  }
  return void 0;
};
class KeyboardSensor {
  constructor(props) {
    this.props = void 0;
    this.autoScrollEnabled = false;
    this.referenceCoordinates = void 0;
    this.listeners = void 0;
    this.windowListeners = void 0;
    this.props = props;
    const {
      event: {
        target
      }
    } = props;
    this.props = props;
    this.listeners = new Listeners(getOwnerDocument(target));
    this.windowListeners = new Listeners(getWindow$2(target));
    this.handleKeyDown = this.handleKeyDown.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
    this.attach();
  }
  attach() {
    this.handleStart();
    this.windowListeners.add(EventName.Resize, this.handleCancel);
    this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
    setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown));
  }
  handleStart() {
    const {
      activeNode,
      onStart
    } = this.props;
    const node2 = activeNode.node.current;
    if (node2) {
      scrollIntoViewIfNeeded(node2);
    }
    onStart(defaultCoordinates);
  }
  handleKeyDown(event) {
    if (isKeyboardEvent(event)) {
      const {
        active: active3,
        context,
        options
      } = this.props;
      const {
        keyboardCodes = defaultKeyboardCodes,
        coordinateGetter = defaultKeyboardCoordinateGetter,
        scrollBehavior = "smooth"
      } = options;
      const {
        code: code2
      } = event;
      if (keyboardCodes.end.includes(code2)) {
        this.handleEnd(event);
        return;
      }
      if (keyboardCodes.cancel.includes(code2)) {
        this.handleCancel(event);
        return;
      }
      const {
        collisionRect
      } = context.current;
      const currentCoordinates = collisionRect ? {
        x: collisionRect.left,
        y: collisionRect.top
      } : defaultCoordinates;
      if (!this.referenceCoordinates) {
        this.referenceCoordinates = currentCoordinates;
      }
      const newCoordinates = coordinateGetter(event, {
        active: active3,
        context: context.current,
        currentCoordinates
      });
      if (newCoordinates) {
        const coordinatesDelta = subtract(newCoordinates, currentCoordinates);
        const scrollDelta = {
          x: 0,
          y: 0
        };
        const {
          scrollableAncestors
        } = context.current;
        for (const scrollContainer of scrollableAncestors) {
          const direction = event.code;
          const {
            isTop,
            isRight,
            isLeft,
            isBottom,
            maxScroll,
            minScroll
          } = getScrollPosition(scrollContainer);
          const scrollElementRect = getScrollElementRect(scrollContainer);
          const clampedCoordinates = {
            x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)),
            y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y))
          };
          const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft;
          const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop;
          if (canScrollX && clampedCoordinates.x !== newCoordinates.x) {
            const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x;
            const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x;
            if (canScrollToNewCoordinates && !coordinatesDelta.y) {
              scrollContainer.scrollTo({
                left: newScrollCoordinates,
                behavior: scrollBehavior
              });
              return;
            }
            if (canScrollToNewCoordinates) {
              scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates;
            } else {
              scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x;
            }
            if (scrollDelta.x) {
              scrollContainer.scrollBy({
                left: -scrollDelta.x,
                behavior: scrollBehavior
              });
            }
            break;
          } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) {
            const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y;
            const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y;
            if (canScrollToNewCoordinates && !coordinatesDelta.x) {
              scrollContainer.scrollTo({
                top: newScrollCoordinates,
                behavior: scrollBehavior
              });
              return;
            }
            if (canScrollToNewCoordinates) {
              scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates;
            } else {
              scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y;
            }
            if (scrollDelta.y) {
              scrollContainer.scrollBy({
                top: -scrollDelta.y,
                behavior: scrollBehavior
              });
            }
            break;
          }
        }
        this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta));
      }
    }
  }
  handleMove(event, coordinates) {
    const {
      onMove
    } = this.props;
    event.preventDefault();
    onMove(coordinates);
  }
  handleEnd(event) {
    const {
      onEnd
    } = this.props;
    event.preventDefault();
    this.detach();
    onEnd();
  }
  handleCancel(event) {
    const {
      onCancel
    } = this.props;
    event.preventDefault();
    this.detach();
    onCancel();
  }
  detach() {
    this.listeners.removeAll();
    this.windowListeners.removeAll();
  }
}
KeyboardSensor.activators = [{
  eventName: "onKeyDown",
  handler: (event, _ref, _ref2) => {
    let {
      keyboardCodes = defaultKeyboardCodes,
      onActivation
    } = _ref;
    let {
      active: active3
    } = _ref2;
    const {
      code: code2
    } = event.nativeEvent;
    if (keyboardCodes.start.includes(code2)) {
      const activator = active3.activatorNode.current;
      if (activator && event.target !== activator) {
        return false;
      }
      event.preventDefault();
      onActivation == null ? void 0 : onActivation({
        event: event.nativeEvent
      });
      return true;
    }
    return false;
  }
}];
function isDistanceConstraint(constraint) {
  return Boolean(constraint && "distance" in constraint);
}
function isDelayConstraint(constraint) {
  return Boolean(constraint && "delay" in constraint);
}
class AbstractPointerSensor {
  constructor(props, events2, listenerTarget) {
    var _getEventCoordinates;
    if (listenerTarget === void 0) {
      listenerTarget = getEventListenerTarget(props.event.target);
    }
    this.props = void 0;
    this.events = void 0;
    this.autoScrollEnabled = true;
    this.document = void 0;
    this.activated = false;
    this.initialCoordinates = void 0;
    this.timeoutId = null;
    this.listeners = void 0;
    this.documentListeners = void 0;
    this.windowListeners = void 0;
    this.props = props;
    this.events = events2;
    const {
      event
    } = props;
    const {
      target
    } = event;
    this.props = props;
    this.events = events2;
    this.document = getOwnerDocument(target);
    this.documentListeners = new Listeners(this.document);
    this.listeners = new Listeners(listenerTarget);
    this.windowListeners = new Listeners(getWindow$2(target));
    this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates;
    this.handleStart = this.handleStart.bind(this);
    this.handleMove = this.handleMove.bind(this);
    this.handleEnd = this.handleEnd.bind(this);
    this.handleCancel = this.handleCancel.bind(this);
    this.handleKeydown = this.handleKeydown.bind(this);
    this.removeTextSelection = this.removeTextSelection.bind(this);
    this.attach();
  }
  attach() {
    const {
      events: events2,
      props: {
        options: {
          activationConstraint,
          bypassActivationConstraint
        }
      }
    } = this;
    this.listeners.add(events2.move.name, this.handleMove, {
      passive: false
    });
    this.listeners.add(events2.end.name, this.handleEnd);
    if (events2.cancel) {
      this.listeners.add(events2.cancel.name, this.handleCancel);
    }
    this.windowListeners.add(EventName.Resize, this.handleCancel);
    this.windowListeners.add(EventName.DragStart, preventDefault);
    this.windowListeners.add(EventName.VisibilityChange, this.handleCancel);
    this.windowListeners.add(EventName.ContextMenu, preventDefault);
    this.documentListeners.add(EventName.Keydown, this.handleKeydown);
    if (activationConstraint) {
      if (bypassActivationConstraint != null && bypassActivationConstraint({
        event: this.props.event,
        activeNode: this.props.activeNode,
        options: this.props.options
      })) {
        return this.handleStart();
      }
      if (isDelayConstraint(activationConstraint)) {
        this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay);
        this.handlePending(activationConstraint);
        return;
      }
      if (isDistanceConstraint(activationConstraint)) {
        this.handlePending(activationConstraint);
        return;
      }
    }
    this.handleStart();
  }
  detach() {
    this.listeners.removeAll();
    this.windowListeners.removeAll();
    setTimeout(this.documentListeners.removeAll, 50);
    if (this.timeoutId !== null) {
      clearTimeout(this.timeoutId);
      this.timeoutId = null;
    }
  }
  handlePending(constraint, offset2) {
    const {
      active: active3,
      onPending
    } = this.props;
    onPending(active3, constraint, this.initialCoordinates, offset2);
  }
  handleStart() {
    const {
      initialCoordinates
    } = this;
    const {
      onStart
    } = this.props;
    if (initialCoordinates) {
      this.activated = true;
      this.documentListeners.add(EventName.Click, stopPropagation, {
        capture: true
      });
      this.removeTextSelection();
      this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection);
      onStart(initialCoordinates);
    }
  }
  handleMove(event) {
    var _getEventCoordinates2;
    const {
      activated,
      initialCoordinates,
      props
    } = this;
    const {
      onMove,
      options: {
        activationConstraint
      }
    } = props;
    if (!initialCoordinates) {
      return;
    }
    const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates;
    const delta = subtract(initialCoordinates, coordinates);
    if (!activated && activationConstraint) {
      if (isDistanceConstraint(activationConstraint)) {
        if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) {
          return this.handleCancel();
        }
        if (hasExceededDistance(delta, activationConstraint.distance)) {
          return this.handleStart();
        }
      }
      if (isDelayConstraint(activationConstraint)) {
        if (hasExceededDistance(delta, activationConstraint.tolerance)) {
          return this.handleCancel();
        }
      }
      this.handlePending(activationConstraint, delta);
      return;
    }
    if (event.cancelable) {
      event.preventDefault();
    }
    onMove(coordinates);
  }
  handleEnd() {
    const {
      onAbort,
      onEnd
    } = this.props;
    this.detach();
    if (!this.activated) {
      onAbort(this.props.active);
    }
    onEnd();
  }
  handleCancel() {
    const {
      onAbort,
      onCancel
    } = this.props;
    this.detach();
    if (!this.activated) {
      onAbort(this.props.active);
    }
    onCancel();
  }
  handleKeydown(event) {
    if (event.code === KeyboardCode.Esc) {
      this.handleCancel();
    }
  }
  removeTextSelection() {
    var _this$document$getSel;
    (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges();
  }
}
const events$1 = {
  cancel: {
    name: "pointercancel"
  },
  move: {
    name: "pointermove"
  },
  end: {
    name: "pointerup"
  }
};
class PointerSensor extends AbstractPointerSensor {
  constructor(props) {
    const {
      event
    } = props;
    const listenerTarget = getOwnerDocument(event.target);
    super(props, events$1, listenerTarget);
  }
}
PointerSensor.activators = [{
  eventName: "onPointerDown",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    if (!event.isPrimary || event.button !== 0) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
const events$1$1 = {
  move: {
    name: "mousemove"
  },
  end: {
    name: "mouseup"
  }
};
var MouseButton;
(function(MouseButton2) {
  MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick";
})(MouseButton || (MouseButton = {}));
class MouseSensor extends AbstractPointerSensor {
  constructor(props) {
    super(props, events$1$1, getOwnerDocument(props.event.target));
  }
}
MouseSensor.activators = [{
  eventName: "onMouseDown",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    if (event.button === MouseButton.RightClick) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
const events$2 = {
  cancel: {
    name: "touchcancel"
  },
  move: {
    name: "touchmove"
  },
  end: {
    name: "touchend"
  }
};
class TouchSensor extends AbstractPointerSensor {
  constructor(props) {
    super(props, events$2);
  }
  static setup() {
    window.addEventListener(events$2.move.name, noop4, {
      capture: false,
      passive: false
    });
    return function teardown() {
      window.removeEventListener(events$2.move.name, noop4);
    };
    function noop4() {
    }
  }
}
TouchSensor.activators = [{
  eventName: "onTouchStart",
  handler: (_ref, _ref2) => {
    let {
      nativeEvent: event
    } = _ref;
    let {
      onActivation
    } = _ref2;
    const {
      touches
    } = event;
    if (touches.length > 1) {
      return false;
    }
    onActivation == null ? void 0 : onActivation({
      event
    });
    return true;
  }
}];
var AutoScrollActivator;
(function(AutoScrollActivator2) {
  AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer";
  AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect";
})(AutoScrollActivator || (AutoScrollActivator = {}));
var TraversalOrder;
(function(TraversalOrder2) {
  TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder";
  TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder";
})(TraversalOrder || (TraversalOrder = {}));
function useAutoScroller(_ref) {
  let {
    acceleration,
    activator = AutoScrollActivator.Pointer,
    canScroll,
    draggingRect,
    enabled,
    interval = 5,
    order: order2 = TraversalOrder.TreeOrder,
    pointerCoordinates,
    scrollableAncestors,
    scrollableAncestorRects,
    delta,
    threshold
  } = _ref;
  const scrollIntent = useScrollIntent({
    delta,
    disabled: !enabled
  });
  const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval();
  const scrollSpeed = reactExports.useRef({
    x: 0,
    y: 0
  });
  const scrollDirection = reactExports.useRef({
    x: 0,
    y: 0
  });
  const rect = reactExports.useMemo(() => {
    switch (activator) {
      case AutoScrollActivator.Pointer:
        return pointerCoordinates ? {
          top: pointerCoordinates.y,
          bottom: pointerCoordinates.y,
          left: pointerCoordinates.x,
          right: pointerCoordinates.x
        } : null;
      case AutoScrollActivator.DraggableRect:
        return draggingRect;
    }
  }, [activator, draggingRect, pointerCoordinates]);
  const scrollContainerRef = reactExports.useRef(null);
  const autoScroll = reactExports.useCallback(() => {
    const scrollContainer = scrollContainerRef.current;
    if (!scrollContainer) {
      return;
    }
    const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x;
    const scrollTop = scrollSpeed.current.y * scrollDirection.current.y;
    scrollContainer.scrollBy(scrollLeft, scrollTop);
  }, []);
  const sortedScrollableAncestors = reactExports.useMemo(() => order2 === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order2, scrollableAncestors]);
  reactExports.useEffect(
    () => {
      if (!enabled || !scrollableAncestors.length || !rect) {
        clearAutoScrollInterval();
        return;
      }
      for (const scrollContainer of sortedScrollableAncestors) {
        if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) {
          continue;
        }
        const index2 = scrollableAncestors.indexOf(scrollContainer);
        const scrollContainerRect = scrollableAncestorRects[index2];
        if (!scrollContainerRect) {
          continue;
        }
        const {
          direction,
          speed
        } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold);
        for (const axis of ["x", "y"]) {
          if (!scrollIntent[axis][direction[axis]]) {
            speed[axis] = 0;
            direction[axis] = 0;
          }
        }
        if (speed.x > 0 || speed.y > 0) {
          clearAutoScrollInterval();
          scrollContainerRef.current = scrollContainer;
          setAutoScrollInterval(autoScroll, interval);
          scrollSpeed.current = speed;
          scrollDirection.current = direction;
          return;
        }
      }
      scrollSpeed.current = {
        x: 0,
        y: 0
      };
      scrollDirection.current = {
        x: 0,
        y: 0
      };
      clearAutoScrollInterval();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [
      acceleration,
      autoScroll,
      canScroll,
      clearAutoScrollInterval,
      enabled,
      interval,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(rect),
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(scrollIntent),
      setAutoScrollInterval,
      scrollableAncestors,
      sortedScrollableAncestors,
      scrollableAncestorRects,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(threshold)
    ]
  );
}
const defaultScrollIntent = {
  x: {
    [Direction.Backward]: false,
    [Direction.Forward]: false
  },
  y: {
    [Direction.Backward]: false,
    [Direction.Forward]: false
  }
};
function useScrollIntent(_ref2) {
  let {
    delta,
    disabled
  } = _ref2;
  const previousDelta = usePrevious2(delta);
  return useLazyMemo((previousIntent) => {
    if (disabled || !previousDelta || !previousIntent) {
      return defaultScrollIntent;
    }
    const direction = {
      x: Math.sign(delta.x - previousDelta.x),
      y: Math.sign(delta.y - previousDelta.y)
    };
    return {
      x: {
        [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1,
        [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1
      },
      y: {
        [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1,
        [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1
      }
    };
  }, [disabled, delta, previousDelta]);
}
function useCachedNode(draggableNodes, id2) {
  const draggableNode = id2 != null ? draggableNodes.get(id2) : void 0;
  const node2 = draggableNode ? draggableNode.node.current : null;
  return useLazyMemo((cachedNode) => {
    var _ref;
    if (id2 == null) {
      return null;
    }
    return (_ref = node2 != null ? node2 : cachedNode) != null ? _ref : null;
  }, [node2, id2]);
}
function useCombineActivators(sensors, getSyntheticHandler) {
  return reactExports.useMemo(() => sensors.reduce((accumulator, sensor) => {
    const {
      sensor: Sensor
    } = sensor;
    const sensorActivators = Sensor.activators.map((activator) => ({
      eventName: activator.eventName,
      handler: getSyntheticHandler(activator.handler, sensor)
    }));
    return [...accumulator, ...sensorActivators];
  }, []), [sensors, getSyntheticHandler]);
}
var MeasuringStrategy;
(function(MeasuringStrategy2) {
  MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always";
  MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging";
  MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging";
})(MeasuringStrategy || (MeasuringStrategy = {}));
var MeasuringFrequency;
(function(MeasuringFrequency2) {
  MeasuringFrequency2["Optimized"] = "optimized";
})(MeasuringFrequency || (MeasuringFrequency = {}));
const defaultValue = /* @__PURE__ */ new Map();
function useDroppableMeasuring(containers, _ref) {
  let {
    dragging,
    dependencies,
    config: config2
  } = _ref;
  const [queue, setQueue] = reactExports.useState(null);
  const {
    frequency,
    measure,
    strategy
  } = config2;
  const containersRef = reactExports.useRef(containers);
  const disabled = isDisabled();
  const disabledRef = useLatestValue(disabled);
  const measureDroppableContainers = reactExports.useCallback(function(ids2) {
    if (ids2 === void 0) {
      ids2 = [];
    }
    if (disabledRef.current) {
      return;
    }
    setQueue((value2) => {
      if (value2 === null) {
        return ids2;
      }
      return value2.concat(ids2.filter((id2) => !value2.includes(id2)));
    });
  }, [disabledRef]);
  const timeoutId = reactExports.useRef(null);
  const droppableRects = useLazyMemo((previousValue) => {
    if (disabled && !dragging) {
      return defaultValue;
    }
    if (!previousValue || previousValue === defaultValue || containersRef.current !== containers || queue != null) {
      const map2 = /* @__PURE__ */ new Map();
      for (let container of containers) {
        if (!container) {
          continue;
        }
        if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) {
          map2.set(container.id, container.rect.current);
          continue;
        }
        const node2 = container.node.current;
        const rect = node2 ? new Rect(measure(node2), node2) : null;
        container.rect.current = rect;
        if (rect) {
          map2.set(container.id, rect);
        }
      }
      return map2;
    }
    return previousValue;
  }, [containers, queue, dragging, disabled, measure]);
  reactExports.useEffect(() => {
    containersRef.current = containers;
  }, [containers]);
  reactExports.useEffect(
    () => {
      if (disabled) {
        return;
      }
      measureDroppableContainers();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [dragging, disabled]
  );
  reactExports.useEffect(
    () => {
      if (queue && queue.length > 0) {
        setQueue(null);
      }
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [JSON.stringify(queue)]
  );
  reactExports.useEffect(
    () => {
      if (disabled || typeof frequency !== "number" || timeoutId.current !== null) {
        return;
      }
      timeoutId.current = setTimeout(() => {
        measureDroppableContainers();
        timeoutId.current = null;
      }, frequency);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [frequency, disabled, measureDroppableContainers, ...dependencies]
  );
  return {
    droppableRects,
    measureDroppableContainers,
    measuringScheduled: queue != null
  };
  function isDisabled() {
    switch (strategy) {
      case MeasuringStrategy.Always:
        return false;
      case MeasuringStrategy.BeforeDragging:
        return dragging;
      default:
        return !dragging;
    }
  }
}
function useInitialValue(value2, computeFn) {
  return useLazyMemo((previousValue) => {
    if (!value2) {
      return null;
    }
    if (previousValue) {
      return previousValue;
    }
    return typeof computeFn === "function" ? computeFn(value2) : value2;
  }, [computeFn, value2]);
}
function useInitialRect(node2, measure) {
  return useInitialValue(node2, measure);
}
function useMutationObserver$1(_ref) {
  let {
    callback: callback2,
    disabled
  } = _ref;
  const handleMutations = useEvent(callback2);
  const mutationObserver = reactExports.useMemo(() => {
    if (disabled || typeof window === "undefined" || typeof window.MutationObserver === "undefined") {
      return void 0;
    }
    const {
      MutationObserver: MutationObserver2
    } = window;
    return new MutationObserver2(handleMutations);
  }, [handleMutations, disabled]);
  reactExports.useEffect(() => {
    return () => mutationObserver == null ? void 0 : mutationObserver.disconnect();
  }, [mutationObserver]);
  return mutationObserver;
}
function useResizeObserver(_ref) {
  let {
    callback: callback2,
    disabled
  } = _ref;
  const handleResize = useEvent(callback2);
  const resizeObserver2 = reactExports.useMemo(
    () => {
      if (disabled || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") {
        return void 0;
      }
      const {
        ResizeObserver: ResizeObserver2
      } = window;
      return new ResizeObserver2(handleResize);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [disabled]
  );
  reactExports.useEffect(() => {
    return () => resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
  }, [resizeObserver2]);
  return resizeObserver2;
}
function defaultMeasure(element2) {
  return new Rect(getClientRect(element2), element2);
}
function useRect$1(element2, measure, fallbackRect) {
  if (measure === void 0) {
    measure = defaultMeasure;
  }
  const [rect, setRect] = reactExports.useState(null);
  function measureRect() {
    setRect((currentRect) => {
      if (!element2) {
        return null;
      }
      if (element2.isConnected === false) {
        var _ref;
        return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null;
      }
      const newRect = measure(element2);
      if (JSON.stringify(currentRect) === JSON.stringify(newRect)) {
        return currentRect;
      }
      return newRect;
    });
  }
  const mutationObserver = useMutationObserver$1({
    callback(records) {
      if (!element2) {
        return;
      }
      for (const record of records) {
        const {
          type: type4,
          target
        } = record;
        if (type4 === "childList" && target instanceof HTMLElement && target.contains(element2)) {
          measureRect();
          break;
        }
      }
    }
  });
  const resizeObserver2 = useResizeObserver({
    callback: measureRect
  });
  useIsomorphicLayoutEffect(() => {
    measureRect();
    if (element2) {
      resizeObserver2 == null ? void 0 : resizeObserver2.observe(element2);
      mutationObserver == null ? void 0 : mutationObserver.observe(document.body, {
        childList: true,
        subtree: true
      });
    } else {
      resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
      mutationObserver == null ? void 0 : mutationObserver.disconnect();
    }
  }, [element2]);
  return rect;
}
function useRectDelta(rect) {
  const initialRect = useInitialValue(rect);
  return getRectDelta(rect, initialRect);
}
const defaultValue$1 = [];
function useScrollableAncestors(node2) {
  const previousNode = reactExports.useRef(node2);
  const ancestors = useLazyMemo((previousValue) => {
    if (!node2) {
      return defaultValue$1;
    }
    if (previousValue && previousValue !== defaultValue$1 && node2 && previousNode.current && node2.parentNode === previousNode.current.parentNode) {
      return previousValue;
    }
    return getScrollableAncestors(node2);
  }, [node2]);
  reactExports.useEffect(() => {
    previousNode.current = node2;
  }, [node2]);
  return ancestors;
}
function useScrollOffsets(elements) {
  const [scrollCoordinates, setScrollCoordinates] = reactExports.useState(null);
  const prevElements = reactExports.useRef(elements);
  const handleScroll = reactExports.useCallback((event) => {
    const scrollingElement = getScrollableElement(event.target);
    if (!scrollingElement) {
      return;
    }
    setScrollCoordinates((scrollCoordinates2) => {
      if (!scrollCoordinates2) {
        return null;
      }
      scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement));
      return new Map(scrollCoordinates2);
    });
  }, []);
  reactExports.useEffect(() => {
    const previousElements = prevElements.current;
    if (elements !== previousElements) {
      cleanup2(previousElements);
      const entries = elements.map((element2) => {
        const scrollableElement = getScrollableElement(element2);
        if (scrollableElement) {
          scrollableElement.addEventListener("scroll", handleScroll, {
            passive: true
          });
          return [scrollableElement, getScrollCoordinates(scrollableElement)];
        }
        return null;
      }).filter((entry) => entry != null);
      setScrollCoordinates(entries.length ? new Map(entries) : null);
      prevElements.current = elements;
    }
    return () => {
      cleanup2(elements);
      cleanup2(previousElements);
    };
    function cleanup2(elements2) {
      elements2.forEach((element2) => {
        const scrollableElement = getScrollableElement(element2);
        scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll);
      });
    }
  }, [handleScroll, elements]);
  return reactExports.useMemo(() => {
    if (elements.length) {
      return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements);
    }
    return defaultCoordinates;
  }, [elements, scrollCoordinates]);
}
function useScrollOffsetsDelta(scrollOffsets, dependencies) {
  if (dependencies === void 0) {
    dependencies = [];
  }
  const initialScrollOffsets = reactExports.useRef(null);
  reactExports.useEffect(
    () => {
      initialScrollOffsets.current = null;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    dependencies
  );
  reactExports.useEffect(() => {
    const hasScrollOffsets = scrollOffsets !== defaultCoordinates;
    if (hasScrollOffsets && !initialScrollOffsets.current) {
      initialScrollOffsets.current = scrollOffsets;
    }
    if (!hasScrollOffsets && initialScrollOffsets.current) {
      initialScrollOffsets.current = null;
    }
  }, [scrollOffsets]);
  return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates;
}
function useSensorSetup(sensors) {
  reactExports.useEffect(
    () => {
      if (!canUseDOM$1) {
        return;
      }
      const teardownFns = sensors.map((_ref) => {
        let {
          sensor
        } = _ref;
        return sensor.setup == null ? void 0 : sensor.setup();
      });
      return () => {
        for (const teardown of teardownFns) {
          teardown == null ? void 0 : teardown();
        }
      };
    },
    // TO-DO: Sensors length could theoretically change which would not be a valid dependency
    // eslint-disable-next-line react-hooks/exhaustive-deps
    sensors.map((_ref2) => {
      let {
        sensor
      } = _ref2;
      return sensor;
    })
  );
}
function useSyntheticListeners(listeners, id2) {
  return reactExports.useMemo(() => {
    return listeners.reduce((acc, _ref) => {
      let {
        eventName,
        handler
      } = _ref;
      acc[eventName] = (event) => {
        handler(event, id2);
      };
      return acc;
    }, {});
  }, [listeners, id2]);
}
function useWindowRect(element2) {
  return reactExports.useMemo(() => element2 ? getWindowClientRect(element2) : null, [element2]);
}
const defaultValue$2 = [];
function useRects(elements, measure) {
  if (measure === void 0) {
    measure = getClientRect;
  }
  const [firstElement] = elements;
  const windowRect = useWindowRect(firstElement ? getWindow$2(firstElement) : null);
  const [rects, setRects] = reactExports.useState(defaultValue$2);
  function measureRects() {
    setRects(() => {
      if (!elements.length) {
        return defaultValue$2;
      }
      return elements.map((element2) => isDocumentScrollingElement(element2) ? windowRect : new Rect(measure(element2), element2));
    });
  }
  const resizeObserver2 = useResizeObserver({
    callback: measureRects
  });
  useIsomorphicLayoutEffect(() => {
    resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
    measureRects();
    elements.forEach((element2) => resizeObserver2 == null ? void 0 : resizeObserver2.observe(element2));
  }, [elements]);
  return rects;
}
function getMeasurableNode(node2) {
  if (!node2) {
    return null;
  }
  if (node2.children.length > 1) {
    return node2;
  }
  const firstChild = node2.children[0];
  return isHTMLElement(firstChild) ? firstChild : node2;
}
function useDragOverlayMeasuring(_ref) {
  let {
    measure
  } = _ref;
  const [rect, setRect] = reactExports.useState(null);
  const handleResize = reactExports.useCallback((entries) => {
    for (const {
      target
    } of entries) {
      if (isHTMLElement(target)) {
        setRect((rect2) => {
          const newRect = measure(target);
          return rect2 ? {
            ...rect2,
            width: newRect.width,
            height: newRect.height
          } : newRect;
        });
        break;
      }
    }
  }, [measure]);
  const resizeObserver2 = useResizeObserver({
    callback: handleResize
  });
  const handleNodeChange = reactExports.useCallback((element2) => {
    const node2 = getMeasurableNode(element2);
    resizeObserver2 == null ? void 0 : resizeObserver2.disconnect();
    if (node2) {
      resizeObserver2 == null ? void 0 : resizeObserver2.observe(node2);
    }
    setRect(node2 ? measure(node2) : null);
  }, [measure, resizeObserver2]);
  const [nodeRef, setRef2] = useNodeRef(handleNodeChange);
  return reactExports.useMemo(() => ({
    nodeRef,
    rect,
    setRef: setRef2
  }), [rect, nodeRef, setRef2]);
}
const defaultSensors = [{
  sensor: PointerSensor,
  options: {}
}, {
  sensor: KeyboardSensor,
  options: {}
}];
const defaultData = {
  current: {}
};
const defaultMeasuringConfiguration = {
  draggable: {
    measure: getTransformAgnosticClientRect
  },
  droppable: {
    measure: getTransformAgnosticClientRect,
    strategy: MeasuringStrategy.WhileDragging,
    frequency: MeasuringFrequency.Optimized
  },
  dragOverlay: {
    measure: getClientRect
  }
};
class DroppableContainersMap extends Map {
  get(id2) {
    var _super$get;
    return id2 != null ? (_super$get = super.get(id2)) != null ? _super$get : void 0 : void 0;
  }
  toArray() {
    return Array.from(this.values());
  }
  getEnabled() {
    return this.toArray().filter((_ref) => {
      let {
        disabled
      } = _ref;
      return !disabled;
    });
  }
  getNodeFor(id2) {
    var _this$get$node$curren, _this$get;
    return (_this$get$node$curren = (_this$get = this.get(id2)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0;
  }
}
const defaultPublicContext = {
  activatorEvent: null,
  active: null,
  activeNode: null,
  activeNodeRect: null,
  collisions: null,
  containerNodeRect: null,
  draggableNodes: /* @__PURE__ */ new Map(),
  droppableRects: /* @__PURE__ */ new Map(),
  droppableContainers: /* @__PURE__ */ new DroppableContainersMap(),
  over: null,
  dragOverlay: {
    nodeRef: {
      current: null
    },
    rect: null,
    setRef: noop$2
  },
  scrollableAncestors: [],
  scrollableAncestorRects: [],
  measuringConfiguration: defaultMeasuringConfiguration,
  measureDroppableContainers: noop$2,
  windowRect: null,
  measuringScheduled: false
};
const defaultInternalContext = {
  activatorEvent: null,
  activators: [],
  active: null,
  activeNodeRect: null,
  ariaDescribedById: {
    draggable: ""
  },
  dispatch: noop$2,
  draggableNodes: /* @__PURE__ */ new Map(),
  over: null,
  measureDroppableContainers: noop$2
};
const InternalContext = /* @__PURE__ */ reactExports.createContext(defaultInternalContext);
const PublicContext = /* @__PURE__ */ reactExports.createContext(defaultPublicContext);
function getInitialState() {
  return {
    draggable: {
      active: null,
      initialCoordinates: {
        x: 0,
        y: 0
      },
      nodes: /* @__PURE__ */ new Map(),
      translate: {
        x: 0,
        y: 0
      }
    },
    droppable: {
      containers: new DroppableContainersMap()
    }
  };
}
function reducer(state, action) {
  switch (action.type) {
    case Action.DragStart:
      return {
        ...state,
        draggable: {
          ...state.draggable,
          initialCoordinates: action.initialCoordinates,
          active: action.active
        }
      };
    case Action.DragMove:
      if (state.draggable.active == null) {
        return state;
      }
      return {
        ...state,
        draggable: {
          ...state.draggable,
          translate: {
            x: action.coordinates.x - state.draggable.initialCoordinates.x,
            y: action.coordinates.y - state.draggable.initialCoordinates.y
          }
        }
      };
    case Action.DragEnd:
    case Action.DragCancel:
      return {
        ...state,
        draggable: {
          ...state.draggable,
          active: null,
          initialCoordinates: {
            x: 0,
            y: 0
          },
          translate: {
            x: 0,
            y: 0
          }
        }
      };
    case Action.RegisterDroppable: {
      const {
        element: element2
      } = action;
      const {
        id: id2
      } = element2;
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.set(id2, element2);
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    case Action.SetDroppableDisabled: {
      const {
        id: id2,
        key,
        disabled
      } = action;
      const element2 = state.droppable.containers.get(id2);
      if (!element2 || key !== element2.key) {
        return state;
      }
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.set(id2, {
        ...element2,
        disabled
      });
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    case Action.UnregisterDroppable: {
      const {
        id: id2,
        key
      } = action;
      const element2 = state.droppable.containers.get(id2);
      if (!element2 || key !== element2.key) {
        return state;
      }
      const containers = new DroppableContainersMap(state.droppable.containers);
      containers.delete(id2);
      return {
        ...state,
        droppable: {
          ...state.droppable,
          containers
        }
      };
    }
    default: {
      return state;
    }
  }
}
function RestoreFocus(_ref) {
  let {
    disabled
  } = _ref;
  const {
    active: active3,
    activatorEvent,
    draggableNodes
  } = reactExports.useContext(InternalContext);
  const previousActivatorEvent = usePrevious2(activatorEvent);
  const previousActiveId = usePrevious2(active3 == null ? void 0 : active3.id);
  reactExports.useEffect(() => {
    if (disabled) {
      return;
    }
    if (!activatorEvent && previousActivatorEvent && previousActiveId != null) {
      if (!isKeyboardEvent(previousActivatorEvent)) {
        return;
      }
      if (document.activeElement === previousActivatorEvent.target) {
        return;
      }
      const draggableNode = draggableNodes.get(previousActiveId);
      if (!draggableNode) {
        return;
      }
      const {
        activatorNode,
        node: node2
      } = draggableNode;
      if (!activatorNode.current && !node2.current) {
        return;
      }
      requestAnimationFrame(() => {
        for (const element2 of [activatorNode.current, node2.current]) {
          if (!element2) {
            continue;
          }
          const focusableNode = findFirstFocusableNode(element2);
          if (focusableNode) {
            focusableNode.focus();
            break;
          }
        }
      });
    }
  }, [activatorEvent, disabled, draggableNodes, previousActiveId, previousActivatorEvent]);
  return null;
}
function applyModifiers(modifiers, _ref) {
  let {
    transform: transform2,
    ...args
  } = _ref;
  return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => {
    return modifier({
      transform: accumulator,
      ...args
    });
  }, transform2) : transform2;
}
function useMeasuringConfiguration(config2) {
  return reactExports.useMemo(
    () => ({
      draggable: {
        ...defaultMeasuringConfiguration.draggable,
        ...config2 == null ? void 0 : config2.draggable
      },
      droppable: {
        ...defaultMeasuringConfiguration.droppable,
        ...config2 == null ? void 0 : config2.droppable
      },
      dragOverlay: {
        ...defaultMeasuringConfiguration.dragOverlay,
        ...config2 == null ? void 0 : config2.dragOverlay
      }
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [config2 == null ? void 0 : config2.draggable, config2 == null ? void 0 : config2.droppable, config2 == null ? void 0 : config2.dragOverlay]
  );
}
function useLayoutShiftScrollCompensation(_ref) {
  let {
    activeNode,
    measure,
    initialRect,
    config: config2 = true
  } = _ref;
  const initialized = reactExports.useRef(false);
  const {
    x: x2,
    y: y2
  } = typeof config2 === "boolean" ? {
    x: config2,
    y: config2
  } : config2;
  useIsomorphicLayoutEffect(() => {
    const disabled = !x2 && !y2;
    if (disabled || !activeNode) {
      initialized.current = false;
      return;
    }
    if (initialized.current || !initialRect) {
      return;
    }
    const node2 = activeNode == null ? void 0 : activeNode.node.current;
    if (!node2 || node2.isConnected === false) {
      return;
    }
    const rect = measure(node2);
    const rectDelta = getRectDelta(rect, initialRect);
    if (!x2) {
      rectDelta.x = 0;
    }
    if (!y2) {
      rectDelta.y = 0;
    }
    initialized.current = true;
    if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) {
      const firstScrollableAncestor = getFirstScrollableAncestor(node2);
      if (firstScrollableAncestor) {
        firstScrollableAncestor.scrollBy({
          top: rectDelta.y,
          left: rectDelta.x
        });
      }
    }
  }, [activeNode, x2, y2, initialRect, measure]);
}
const ActiveDraggableContext = /* @__PURE__ */ reactExports.createContext({
  ...defaultCoordinates,
  scaleX: 1,
  scaleY: 1
});
var Status;
(function(Status2) {
  Status2[Status2["Uninitialized"] = 0] = "Uninitialized";
  Status2[Status2["Initializing"] = 1] = "Initializing";
  Status2[Status2["Initialized"] = 2] = "Initialized";
})(Status || (Status = {}));
const DndContext = /* @__PURE__ */ reactExports.memo(function DndContext2(_ref) {
  var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect;
  let {
    id: id2,
    accessibility,
    autoScroll = true,
    children,
    sensors = defaultSensors,
    collisionDetection = rectIntersection,
    measuring,
    modifiers,
    ...props
  } = _ref;
  const store = reactExports.useReducer(reducer, void 0, getInitialState);
  const [state, dispatch] = store;
  const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider();
  const [status, setStatus] = reactExports.useState(Status.Uninitialized);
  const isInitialized = status === Status.Initialized;
  const {
    draggable: {
      active: activeId,
      nodes: draggableNodes,
      translate
    },
    droppable: {
      containers: droppableContainers
    }
  } = state;
  const node2 = activeId != null ? draggableNodes.get(activeId) : null;
  const activeRects = reactExports.useRef({
    initial: null,
    translated: null
  });
  const active3 = reactExports.useMemo(() => {
    var _node$data;
    return activeId != null ? {
      id: activeId,
      // It's possible for the active node to unmount while dragging
      data: (_node$data = node2 == null ? void 0 : node2.data) != null ? _node$data : defaultData,
      rect: activeRects
    } : null;
  }, [activeId, node2]);
  const activeRef = reactExports.useRef(null);
  const [activeSensor, setActiveSensor] = reactExports.useState(null);
  const [activatorEvent, setActivatorEvent] = reactExports.useState(null);
  const latestProps = useLatestValue(props, Object.values(props));
  const draggableDescribedById = useUniqueId("DndDescribedBy", id2);
  const enabledDroppableContainers = reactExports.useMemo(() => droppableContainers.getEnabled(), [droppableContainers]);
  const measuringConfiguration = useMeasuringConfiguration(measuring);
  const {
    droppableRects,
    measureDroppableContainers,
    measuringScheduled
  } = useDroppableMeasuring(enabledDroppableContainers, {
    dragging: isInitialized,
    dependencies: [translate.x, translate.y],
    config: measuringConfiguration.droppable
  });
  const activeNode = useCachedNode(draggableNodes, activeId);
  const activationCoordinates = reactExports.useMemo(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]);
  const autoScrollOptions = getAutoScrollerOptions();
  const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure);
  useLayoutShiftScrollCompensation({
    activeNode: activeId != null ? draggableNodes.get(activeId) : null,
    config: autoScrollOptions.layoutShiftCompensation,
    initialRect: initialActiveNodeRect,
    measure: measuringConfiguration.draggable.measure
  });
  const activeNodeRect = useRect$1(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect);
  const containerNodeRect = useRect$1(activeNode ? activeNode.parentElement : null);
  const sensorContext = reactExports.useRef({
    activatorEvent: null,
    active: null,
    activeNode,
    collisionRect: null,
    collisions: null,
    droppableRects,
    draggableNodes,
    draggingNode: null,
    draggingNodeRect: null,
    droppableContainers,
    over: null,
    scrollableAncestors: [],
    scrollAdjustedTranslate: null
  });
  const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id);
  const dragOverlay = useDragOverlayMeasuring({
    measure: measuringConfiguration.dragOverlay.measure
  });
  const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode;
  const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null;
  const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect);
  const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect);
  const windowRect = useWindowRect(draggingNode ? getWindow$2(draggingNode) : null);
  const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null);
  const scrollableAncestorRects = useRects(scrollableAncestors);
  const modifiedTranslate = applyModifiers(modifiers, {
    transform: {
      x: translate.x - nodeRectDelta.x,
      y: translate.y - nodeRectDelta.y,
      scaleX: 1,
      scaleY: 1
    },
    activatorEvent,
    active: active3,
    activeNodeRect,
    containerNodeRect,
    draggingNodeRect,
    over: sensorContext.current.over,
    overlayNodeRect: dragOverlay.rect,
    scrollableAncestors,
    scrollableAncestorRects,
    windowRect
  });
  const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null;
  const scrollOffsets = useScrollOffsets(scrollableAncestors);
  const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets);
  const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]);
  const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment);
  const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null;
  const collisions = active3 && collisionRect ? collisionDetection({
    active: active3,
    collisionRect,
    droppableRects,
    droppableContainers: enabledDroppableContainers,
    pointerCoordinates
  }) : null;
  const overId = getFirstCollision(collisions, "id");
  const [over, setOver] = reactExports.useState(null);
  const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta);
  const transform2 = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect);
  const activeSensorRef = reactExports.useRef(null);
  const instantiateSensor = reactExports.useCallback(
    (event, _ref2) => {
      let {
        sensor: Sensor,
        options
      } = _ref2;
      if (activeRef.current == null) {
        return;
      }
      const activeNode2 = draggableNodes.get(activeRef.current);
      if (!activeNode2) {
        return;
      }
      const activatorEvent2 = event.nativeEvent;
      const sensorInstance = new Sensor({
        active: activeRef.current,
        activeNode: activeNode2,
        event: activatorEvent2,
        options,
        // Sensors need to be instantiated with refs for arguments that change over time
        // otherwise they are frozen in time with the stale arguments
        context: sensorContext,
        onAbort(id3) {
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragAbort
          } = latestProps.current;
          const event2 = {
            id: id3
          };
          onDragAbort == null ? void 0 : onDragAbort(event2);
          dispatchMonitorEvent({
            type: "onDragAbort",
            event: event2
          });
        },
        onPending(id3, constraint, initialCoordinates, offset2) {
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragPending
          } = latestProps.current;
          const event2 = {
            id: id3,
            constraint,
            initialCoordinates,
            offset: offset2
          };
          onDragPending == null ? void 0 : onDragPending(event2);
          dispatchMonitorEvent({
            type: "onDragPending",
            event: event2
          });
        },
        onStart(initialCoordinates) {
          const id3 = activeRef.current;
          if (id3 == null) {
            return;
          }
          const draggableNode = draggableNodes.get(id3);
          if (!draggableNode) {
            return;
          }
          const {
            onDragStart
          } = latestProps.current;
          const event2 = {
            activatorEvent: activatorEvent2,
            active: {
              id: id3,
              data: draggableNode.data,
              rect: activeRects
            }
          };
          reactDomExports.unstable_batchedUpdates(() => {
            onDragStart == null ? void 0 : onDragStart(event2);
            setStatus(Status.Initializing);
            dispatch({
              type: Action.DragStart,
              initialCoordinates,
              active: id3
            });
            dispatchMonitorEvent({
              type: "onDragStart",
              event: event2
            });
            setActiveSensor(activeSensorRef.current);
            setActivatorEvent(activatorEvent2);
          });
        },
        onMove(coordinates) {
          dispatch({
            type: Action.DragMove,
            coordinates
          });
        },
        onEnd: createHandler(Action.DragEnd),
        onCancel: createHandler(Action.DragCancel)
      });
      activeSensorRef.current = sensorInstance;
      function createHandler(type4) {
        return async function handler() {
          const {
            active: active4,
            collisions: collisions2,
            over: over2,
            scrollAdjustedTranslate: scrollAdjustedTranslate2
          } = sensorContext.current;
          let event2 = null;
          if (active4 && scrollAdjustedTranslate2) {
            const {
              cancelDrop
            } = latestProps.current;
            event2 = {
              activatorEvent: activatorEvent2,
              active: active4,
              collisions: collisions2,
              delta: scrollAdjustedTranslate2,
              over: over2
            };
            if (type4 === Action.DragEnd && typeof cancelDrop === "function") {
              const shouldCancel = await Promise.resolve(cancelDrop(event2));
              if (shouldCancel) {
                type4 = Action.DragCancel;
              }
            }
          }
          activeRef.current = null;
          reactDomExports.unstable_batchedUpdates(() => {
            dispatch({
              type: type4
            });
            setStatus(Status.Uninitialized);
            setOver(null);
            setActiveSensor(null);
            setActivatorEvent(null);
            activeSensorRef.current = null;
            const eventName = type4 === Action.DragEnd ? "onDragEnd" : "onDragCancel";
            if (event2) {
              const handler2 = latestProps.current[eventName];
              handler2 == null ? void 0 : handler2(event2);
              dispatchMonitorEvent({
                type: eventName,
                event: event2
              });
            }
          });
        };
      }
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [draggableNodes]
  );
  const bindActivatorToSensorInstantiator = reactExports.useCallback((handler, sensor) => {
    return (event, active4) => {
      const nativeEvent = event.nativeEvent;
      const activeDraggableNode = draggableNodes.get(active4);
      if (
        // Another sensor is already instantiating
        activeRef.current !== null || // No active draggable
        !activeDraggableNode || // Event has already been captured
        nativeEvent.dndKit || nativeEvent.defaultPrevented
      ) {
        return;
      }
      const activationContext = {
        active: activeDraggableNode
      };
      const shouldActivate = handler(event, sensor.options, activationContext);
      if (shouldActivate === true) {
        nativeEvent.dndKit = {
          capturedBy: sensor.sensor
        };
        activeRef.current = active4;
        instantiateSensor(event, sensor);
      }
    };
  }, [draggableNodes, instantiateSensor]);
  const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator);
  useSensorSetup(sensors);
  useIsomorphicLayoutEffect(() => {
    if (activeNodeRect && status === Status.Initializing) {
      setStatus(Status.Initialized);
    }
  }, [activeNodeRect, status]);
  reactExports.useEffect(
    () => {
      const {
        onDragMove
      } = latestProps.current;
      const {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        over: over2
      } = sensorContext.current;
      if (!active4 || !activatorEvent2) {
        return;
      }
      const event = {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        delta: {
          x: scrollAdjustedTranslate.x,
          y: scrollAdjustedTranslate.y
        },
        over: over2
      };
      reactDomExports.unstable_batchedUpdates(() => {
        onDragMove == null ? void 0 : onDragMove(event);
        dispatchMonitorEvent({
          type: "onDragMove",
          event
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y]
  );
  reactExports.useEffect(
    () => {
      const {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        droppableContainers: droppableContainers2,
        scrollAdjustedTranslate: scrollAdjustedTranslate2
      } = sensorContext.current;
      if (!active4 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) {
        return;
      }
      const {
        onDragOver
      } = latestProps.current;
      const overContainer = droppableContainers2.get(overId);
      const over2 = overContainer && overContainer.rect.current ? {
        id: overContainer.id,
        rect: overContainer.rect.current,
        data: overContainer.data,
        disabled: overContainer.disabled
      } : null;
      const event = {
        active: active4,
        activatorEvent: activatorEvent2,
        collisions: collisions2,
        delta: {
          x: scrollAdjustedTranslate2.x,
          y: scrollAdjustedTranslate2.y
        },
        over: over2
      };
      reactDomExports.unstable_batchedUpdates(() => {
        setOver(over2);
        onDragOver == null ? void 0 : onDragOver(event);
        dispatchMonitorEvent({
          type: "onDragOver",
          event
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [overId]
  );
  useIsomorphicLayoutEffect(() => {
    sensorContext.current = {
      activatorEvent,
      active: active3,
      activeNode,
      collisionRect,
      collisions,
      droppableRects,
      draggableNodes,
      draggingNode,
      draggingNodeRect,
      droppableContainers,
      over,
      scrollableAncestors,
      scrollAdjustedTranslate
    };
    activeRects.current = {
      initial: draggingNodeRect,
      translated: collisionRect
    };
  }, [active3, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]);
  useAutoScroller({
    ...autoScrollOptions,
    delta: translate,
    draggingRect: collisionRect,
    pointerCoordinates,
    scrollableAncestors,
    scrollableAncestorRects
  });
  const publicContext = reactExports.useMemo(() => {
    const context = {
      active: active3,
      activeNode,
      activeNodeRect,
      activatorEvent,
      collisions,
      containerNodeRect,
      dragOverlay,
      draggableNodes,
      droppableContainers,
      droppableRects,
      over,
      measureDroppableContainers,
      scrollableAncestors,
      scrollableAncestorRects,
      measuringConfiguration,
      measuringScheduled,
      windowRect
    };
    return context;
  }, [active3, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]);
  const internalContext = reactExports.useMemo(() => {
    const context = {
      activatorEvent,
      activators,
      active: active3,
      activeNodeRect,
      ariaDescribedById: {
        draggable: draggableDescribedById
      },
      dispatch,
      draggableNodes,
      over,
      measureDroppableContainers
    };
    return context;
  }, [activatorEvent, activators, active3, activeNodeRect, dispatch, draggableDescribedById, draggableNodes, over, measureDroppableContainers]);
  return React$6.createElement(DndMonitorContext.Provider, {
    value: registerMonitorListener
  }, React$6.createElement(InternalContext.Provider, {
    value: internalContext
  }, React$6.createElement(PublicContext.Provider, {
    value: publicContext
  }, React$6.createElement(ActiveDraggableContext.Provider, {
    value: transform2
  }, children)), React$6.createElement(RestoreFocus, {
    disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false
  })), React$6.createElement(Accessibility, {
    ...accessibility,
    hiddenTextDescribedById: draggableDescribedById
  }));
  function getAutoScrollerOptions() {
    const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false;
    const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false;
    const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled;
    if (typeof autoScroll === "object") {
      return {
        ...autoScroll,
        enabled
      };
    }
    return {
      enabled
    };
  }
});
const NullContext = /* @__PURE__ */ reactExports.createContext(null);
const defaultRole = "button";
const ID_PREFIX$1 = "Draggable";
function useDraggable$1(_ref) {
  let {
    id: id2,
    data,
    disabled = false,
    attributes: attributes2
  } = _ref;
  const key = useUniqueId(ID_PREFIX$1);
  const {
    activators,
    activatorEvent,
    active: active3,
    activeNodeRect,
    ariaDescribedById,
    draggableNodes,
    over
  } = reactExports.useContext(InternalContext);
  const {
    role = defaultRole,
    roleDescription = "draggable",
    tabIndex = 0
  } = attributes2 != null ? attributes2 : {};
  const isDragging2 = (active3 == null ? void 0 : active3.id) === id2;
  const transform2 = reactExports.useContext(isDragging2 ? ActiveDraggableContext : NullContext);
  const [node2, setNodeRef] = useNodeRef();
  const [activatorNode, setActivatorNodeRef] = useNodeRef();
  const listeners = useSyntheticListeners(activators, id2);
  const dataRef = useLatestValue(data);
  useIsomorphicLayoutEffect(
    () => {
      draggableNodes.set(id2, {
        id: id2,
        key,
        node: node2,
        activatorNode,
        data: dataRef
      });
      return () => {
        const node3 = draggableNodes.get(id2);
        if (node3 && node3.key === key) {
          draggableNodes.delete(id2);
        }
      };
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [draggableNodes, id2]
  );
  const memoizedAttributes = reactExports.useMemo(() => ({
    role,
    tabIndex,
    "aria-disabled": disabled,
    "aria-pressed": isDragging2 && role === defaultRole ? true : void 0,
    "aria-roledescription": roleDescription,
    "aria-describedby": ariaDescribedById.draggable
  }), [disabled, role, tabIndex, isDragging2, roleDescription, ariaDescribedById.draggable]);
  return {
    active: active3,
    activatorEvent,
    activeNodeRect,
    attributes: memoizedAttributes,
    isDragging: isDragging2,
    listeners: disabled ? void 0 : listeners,
    node: node2,
    over,
    setNodeRef,
    setActivatorNodeRef,
    transform: transform2
  };
}
function useDndContext() {
  return reactExports.useContext(PublicContext);
}
const ID_PREFIX$1$1 = "Droppable";
const defaultResizeObserverConfig = {
  timeout: 25
};
function useDroppable(_ref) {
  let {
    data,
    disabled = false,
    id: id2,
    resizeObserverConfig
  } = _ref;
  const key = useUniqueId(ID_PREFIX$1$1);
  const {
    active: active3,
    dispatch,
    over,
    measureDroppableContainers
  } = reactExports.useContext(InternalContext);
  const previous2 = reactExports.useRef({
    disabled
  });
  const resizeObserverConnected = reactExports.useRef(false);
  const rect = reactExports.useRef(null);
  const callbackId = reactExports.useRef(null);
  const {
    disabled: resizeObserverDisabled,
    updateMeasurementsFor,
    timeout: resizeObserverTimeout
  } = {
    ...defaultResizeObserverConfig,
    ...resizeObserverConfig
  };
  const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id2);
  const handleResize = reactExports.useCallback(
    () => {
      if (!resizeObserverConnected.current) {
        resizeObserverConnected.current = true;
        return;
      }
      if (callbackId.current != null) {
        clearTimeout(callbackId.current);
      }
      callbackId.current = setTimeout(() => {
        measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]);
        callbackId.current = null;
      }, resizeObserverTimeout);
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [resizeObserverTimeout]
  );
  const resizeObserver2 = useResizeObserver({
    callback: handleResize,
    disabled: resizeObserverDisabled || !active3
  });
  const handleNodeChange = reactExports.useCallback((newElement, previousElement) => {
    if (!resizeObserver2) {
      return;
    }
    if (previousElement) {
      resizeObserver2.unobserve(previousElement);
      resizeObserverConnected.current = false;
    }
    if (newElement) {
      resizeObserver2.observe(newElement);
    }
  }, [resizeObserver2]);
  const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange);
  const dataRef = useLatestValue(data);
  reactExports.useEffect(() => {
    if (!resizeObserver2 || !nodeRef.current) {
      return;
    }
    resizeObserver2.disconnect();
    resizeObserverConnected.current = false;
    resizeObserver2.observe(nodeRef.current);
  }, [nodeRef, resizeObserver2]);
  reactExports.useEffect(
    () => {
      dispatch({
        type: Action.RegisterDroppable,
        element: {
          id: id2,
          key,
          disabled,
          node: nodeRef,
          rect,
          data: dataRef
        }
      });
      return () => dispatch({
        type: Action.UnregisterDroppable,
        key,
        id: id2
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [id2]
  );
  reactExports.useEffect(() => {
    if (disabled !== previous2.current.disabled) {
      dispatch({
        type: Action.SetDroppableDisabled,
        id: id2,
        key,
        disabled
      });
      previous2.current.disabled = disabled;
    }
  }, [id2, key, disabled, dispatch]);
  return {
    active: active3,
    rect,
    isOver: (over == null ? void 0 : over.id) === id2,
    node: nodeRef,
    over,
    setNodeRef
  };
}
function arrayMove(array4, from2, to2) {
  const newArray = array4.slice();
  newArray.splice(to2 < 0 ? newArray.length + to2 : to2, 0, newArray.splice(from2, 1)[0]);
  return newArray;
}
function getSortedRects(items, rects) {
  return items.reduce((accumulator, id2, index2) => {
    const rect = rects.get(id2);
    if (rect) {
      accumulator[index2] = rect;
    }
    return accumulator;
  }, Array(items.length));
}
function isValidIndex(index2) {
  return index2 !== null && index2 >= 0;
}
function itemsEqual(a2, b2) {
  if (a2 === b2) {
    return true;
  }
  if (a2.length !== b2.length) {
    return false;
  }
  for (let i2 = 0; i2 < a2.length; i2++) {
    if (a2[i2] !== b2[i2]) {
      return false;
    }
  }
  return true;
}
function normalizeDisabled(disabled) {
  if (typeof disabled === "boolean") {
    return {
      draggable: disabled,
      droppable: disabled
    };
  }
  return disabled;
}
const rectSortingStrategy = (_ref) => {
  let {
    rects,
    activeIndex,
    overIndex,
    index: index2
  } = _ref;
  const newRects = arrayMove(rects, overIndex, activeIndex);
  const oldRect = rects[index2];
  const newRect = newRects[index2];
  if (!newRect || !oldRect) {
    return null;
  }
  return {
    x: newRect.left - oldRect.left,
    y: newRect.top - oldRect.top,
    scaleX: newRect.width / oldRect.width,
    scaleY: newRect.height / oldRect.height
  };
};
const defaultScale$1 = {
  scaleX: 1,
  scaleY: 1
};
const verticalListSortingStrategy = (_ref) => {
  var _rects$activeIndex;
  let {
    activeIndex,
    activeNodeRect: fallbackActiveRect,
    index: index2,
    rects,
    overIndex
  } = _ref;
  const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
  if (!activeNodeRect) {
    return null;
  }
  if (index2 === activeIndex) {
    const overIndexRect = rects[overIndex];
    if (!overIndexRect) {
      return null;
    }
    return {
      x: 0,
      y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,
      ...defaultScale$1
    };
  }
  const itemGap = getItemGap$1(rects, index2, activeIndex);
  if (index2 > activeIndex && index2 <= overIndex) {
    return {
      x: 0,
      y: -activeNodeRect.height - itemGap,
      ...defaultScale$1
    };
  }
  if (index2 < activeIndex && index2 >= overIndex) {
    return {
      x: 0,
      y: activeNodeRect.height + itemGap,
      ...defaultScale$1
    };
  }
  return {
    x: 0,
    y: 0,
    ...defaultScale$1
  };
};
function getItemGap$1(clientRects, index2, activeIndex) {
  const currentRect = clientRects[index2];
  const previousRect = clientRects[index2 - 1];
  const nextRect = clientRects[index2 + 1];
  if (!currentRect) {
    return 0;
  }
  if (activeIndex < index2) {
    return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
  }
  return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
}
const ID_PREFIX = "Sortable";
const Context = /* @__PURE__ */ React$6.createContext({
  activeIndex: -1,
  containerId: ID_PREFIX,
  disableTransforms: false,
  items: [],
  overIndex: -1,
  useDragOverlay: false,
  sortedRects: [],
  strategy: rectSortingStrategy,
  disabled: {
    draggable: false,
    droppable: false
  }
});
function SortableContext$1(_ref) {
  let {
    children,
    id: id2,
    items: userDefinedItems,
    strategy = rectSortingStrategy,
    disabled: disabledProp = false
  } = _ref;
  const {
    active: active3,
    dragOverlay,
    droppableRects,
    over,
    measureDroppableContainers
  } = useDndContext();
  const containerId = useUniqueId(ID_PREFIX, id2);
  const useDragOverlay = Boolean(dragOverlay.rect !== null);
  const items = reactExports.useMemo(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]);
  const isDragging2 = active3 != null;
  const activeIndex = active3 ? items.indexOf(active3.id) : -1;
  const overIndex = over ? items.indexOf(over.id) : -1;
  const previousItemsRef = reactExports.useRef(items);
  const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
  const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
  const disabled = normalizeDisabled(disabledProp);
  useIsomorphicLayoutEffect(() => {
    if (itemsHaveChanged && isDragging2) {
      measureDroppableContainers(items);
    }
  }, [itemsHaveChanged, items, isDragging2, measureDroppableContainers]);
  reactExports.useEffect(() => {
    previousItemsRef.current = items;
  }, [items]);
  const contextValue = reactExports.useMemo(
    () => ({
      activeIndex,
      containerId,
      disabled,
      disableTransforms,
      items,
      overIndex,
      useDragOverlay,
      sortedRects: getSortedRects(items, droppableRects),
      strategy
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]
  );
  return React$6.createElement(Context.Provider, {
    value: contextValue
  }, children);
}
const defaultNewIndexGetter = (_ref) => {
  let {
    id: id2,
    items,
    activeIndex,
    overIndex
  } = _ref;
  return arrayMove(items, activeIndex, overIndex).indexOf(id2);
};
const defaultAnimateLayoutChanges = (_ref2) => {
  let {
    containerId,
    isSorting,
    wasDragging,
    index: index2,
    items,
    newIndex,
    previousItems,
    previousContainerId,
    transition: transition3
  } = _ref2;
  if (!transition3 || !wasDragging) {
    return false;
  }
  if (previousItems !== items && index2 === newIndex) {
    return false;
  }
  if (isSorting) {
    return true;
  }
  return newIndex !== index2 && containerId === previousContainerId;
};
const defaultTransition = {
  duration: 200,
  easing: "ease"
};
const transitionProperty = "transform";
const disabledTransition = /* @__PURE__ */ CSS$1.Transition.toString({
  property: transitionProperty,
  duration: 0,
  easing: "linear"
});
const defaultAttributes = {
  roleDescription: "sortable"
};
function useDerivedTransform(_ref) {
  let {
    disabled,
    index: index2,
    node: node2,
    rect
  } = _ref;
  const [derivedTransform, setDerivedtransform] = reactExports.useState(null);
  const previousIndex = reactExports.useRef(index2);
  useIsomorphicLayoutEffect(() => {
    if (!disabled && index2 !== previousIndex.current && node2.current) {
      const initial = rect.current;
      if (initial) {
        const current = getClientRect(node2.current, {
          ignoreTransform: true
        });
        const delta = {
          x: initial.left - current.left,
          y: initial.top - current.top,
          scaleX: initial.width / current.width,
          scaleY: initial.height / current.height
        };
        if (delta.x || delta.y) {
          setDerivedtransform(delta);
        }
      }
    }
    if (index2 !== previousIndex.current) {
      previousIndex.current = index2;
    }
  }, [disabled, index2, node2, rect]);
  reactExports.useEffect(() => {
    if (derivedTransform) {
      setDerivedtransform(null);
    }
  }, [derivedTransform]);
  return derivedTransform;
}
function useSortable(_ref) {
  let {
    animateLayoutChanges = defaultAnimateLayoutChanges,
    attributes: userDefinedAttributes,
    disabled: localDisabled,
    data: customData,
    getNewIndex = defaultNewIndexGetter,
    id: id2,
    strategy: localStrategy,
    resizeObserverConfig,
    transition: transition3 = defaultTransition
  } = _ref;
  const {
    items,
    containerId,
    activeIndex,
    disabled: globalDisabled,
    disableTransforms,
    sortedRects,
    overIndex,
    useDragOverlay,
    strategy: globalStrategy
  } = reactExports.useContext(Context);
  const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
  const index2 = items.indexOf(id2);
  const data = reactExports.useMemo(() => ({
    sortable: {
      containerId,
      index: index2,
      items
    },
    ...customData
  }), [containerId, customData, index2, items]);
  const itemsAfterCurrentSortable = reactExports.useMemo(() => items.slice(items.indexOf(id2)), [items, id2]);
  const {
    rect,
    node: node2,
    isOver,
    setNodeRef: setDroppableNodeRef
  } = useDroppable({
    id: id2,
    data,
    disabled: disabled.droppable,
    resizeObserverConfig: {
      updateMeasurementsFor: itemsAfterCurrentSortable,
      ...resizeObserverConfig
    }
  });
  const {
    active: active3,
    activatorEvent,
    activeNodeRect,
    attributes: attributes2,
    setNodeRef: setDraggableNodeRef,
    listeners,
    isDragging: isDragging2,
    over,
    setActivatorNodeRef,
    transform: transform2
  } = useDraggable$1({
    id: id2,
    data,
    attributes: {
      ...defaultAttributes,
      ...userDefinedAttributes
    },
    disabled: disabled.draggable
  });
  const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
  const isSorting = Boolean(active3);
  const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);
  const shouldDisplaceDragSource = !useDragOverlay && isDragging2;
  const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform2 : null;
  const strategy = localStrategy != null ? localStrategy : globalStrategy;
  const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({
    rects: sortedRects,
    activeNodeRect,
    activeIndex,
    overIndex,
    index: index2
  }) : null;
  const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
    id: id2,
    items,
    activeIndex,
    overIndex
  }) : index2;
  const activeId = active3 == null ? void 0 : active3.id;
  const previous2 = reactExports.useRef({
    activeId,
    items,
    newIndex,
    containerId
  });
  const itemsHaveChanged = items !== previous2.current.items;
  const shouldAnimateLayoutChanges = animateLayoutChanges({
    active: active3,
    containerId,
    isDragging: isDragging2,
    isSorting,
    id: id2,
    index: index2,
    items,
    newIndex: previous2.current.newIndex,
    previousItems: previous2.current.items,
    previousContainerId: previous2.current.containerId,
    transition: transition3,
    wasDragging: previous2.current.activeId != null
  });
  const derivedTransform = useDerivedTransform({
    disabled: !shouldAnimateLayoutChanges,
    index: index2,
    node: node2,
    rect
  });
  reactExports.useEffect(() => {
    if (isSorting && previous2.current.newIndex !== newIndex) {
      previous2.current.newIndex = newIndex;
    }
    if (containerId !== previous2.current.containerId) {
      previous2.current.containerId = containerId;
    }
    if (items !== previous2.current.items) {
      previous2.current.items = items;
    }
  }, [isSorting, newIndex, containerId, items]);
  reactExports.useEffect(() => {
    if (activeId === previous2.current.activeId) {
      return;
    }
    if (activeId && !previous2.current.activeId) {
      previous2.current.activeId = activeId;
      return;
    }
    const timeoutId = setTimeout(() => {
      previous2.current.activeId = activeId;
    }, 50);
    return () => clearTimeout(timeoutId);
  }, [activeId]);
  return {
    active: active3,
    activeIndex,
    attributes: attributes2,
    data,
    rect,
    index: index2,
    newIndex,
    items,
    isOver,
    isSorting,
    isDragging: isDragging2,
    listeners,
    node: node2,
    overIndex,
    over,
    setNodeRef,
    setActivatorNodeRef,
    setDroppableNodeRef,
    setDraggableNodeRef,
    transform: derivedTransform != null ? derivedTransform : finalTransform,
    transition: getTransition3()
  };
  function getTransition3() {
    if (
      // Temporarily disable transitions for a single frame to set up derived transforms
      derivedTransform || // Or to prevent items jumping to back to their "new" position when items change
      itemsHaveChanged && previous2.current.newIndex === index2
    ) {
      return disabledTransition;
    }
    if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition3) {
      return void 0;
    }
    if (isSorting || shouldAnimateLayoutChanges) {
      return CSS$1.Transition.toString({
        ...transition3,
        property: transitionProperty
      });
    }
    return void 0;
  }
}
function normalizeLocalDisabled(localDisabled, globalDisabled) {
  var _localDisabled$dragga, _localDisabled$droppa;
  if (typeof localDisabled === "boolean") {
    return {
      draggable: localDisabled,
      // Backwards compatibility
      droppable: false
    };
  }
  return {
    draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
    droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
  };
}
function hasSortableData(entry) {
  if (!entry) {
    return false;
  }
  const data = entry.data.current;
  if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) {
    return true;
  }
  return false;
}
const directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
const sortableKeyboardCoordinates = (event, _ref) => {
  let {
    context: {
      active: active3,
      collisionRect,
      droppableRects,
      droppableContainers,
      over,
      scrollableAncestors
    }
  } = _ref;
  if (directions.includes(event.code)) {
    event.preventDefault();
    if (!active3 || !collisionRect) {
      return;
    }
    const filteredContainers = [];
    droppableContainers.getEnabled().forEach((entry) => {
      if (!entry || entry != null && entry.disabled) {
        return;
      }
      const rect = droppableRects.get(entry.id);
      if (!rect) {
        return;
      }
      switch (event.code) {
        case KeyboardCode.Down:
          if (collisionRect.top < rect.top) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Up:
          if (collisionRect.top > rect.top) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Left:
          if (collisionRect.left > rect.left) {
            filteredContainers.push(entry);
          }
          break;
        case KeyboardCode.Right:
          if (collisionRect.left < rect.left) {
            filteredContainers.push(entry);
          }
          break;
      }
    });
    const collisions = closestCorners({
      collisionRect,
      droppableRects,
      droppableContainers: filteredContainers
    });
    let closestId = getFirstCollision(collisions, "id");
    if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) {
      closestId = collisions[1].id;
    }
    if (closestId != null) {
      const activeDroppable = droppableContainers.get(active3.id);
      const newDroppable = droppableContainers.get(closestId);
      const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;
      const newNode = newDroppable == null ? void 0 : newDroppable.node.current;
      if (newNode && newRect && activeDroppable && newDroppable) {
        const newScrollAncestors = getScrollableAncestors(newNode);
        const hasDifferentScrollAncestors = newScrollAncestors.some((element2, index2) => scrollableAncestors[index2] !== element2);
        const hasSameContainer = isSameContainer(activeDroppable, newDroppable);
        const isAfterActive = isAfter(activeDroppable, newDroppable);
        const offset2 = hasDifferentScrollAncestors || !hasSameContainer ? {
          x: 0,
          y: 0
        } : {
          x: isAfterActive ? collisionRect.width - newRect.width : 0,
          y: isAfterActive ? collisionRect.height - newRect.height : 0
        };
        const rectCoordinates = {
          x: newRect.left,
          y: newRect.top
        };
        const newCoordinates = offset2.x && offset2.y ? rectCoordinates : subtract(rectCoordinates, offset2);
        return newCoordinates;
      }
    }
  }
  return void 0;
};
function isSameContainer(a2, b2) {
  if (!hasSortableData(a2) || !hasSortableData(b2)) {
    return false;
  }
  return a2.data.current.sortable.containerId === b2.data.current.sortable.containerId;
}
function isAfter(a2, b2) {
  if (!hasSortableData(a2) || !hasSortableData(b2)) {
    return false;
  }
  if (!isSameContainer(a2, b2)) {
    return false;
  }
  return a2.data.current.sortable.index < b2.data.current.sortable.index;
}
const OperationType$1 = FileNameModifierOperationType;
const PositionType$4 = FileNameModifierPosition;
function getFieldRequirements(op) {
  const requirements = {};
  switch (op.operation) {
    case OperationType$1.Insert:
      requirements.text = true;
      requirements.position = true;
      if (op.position === PositionType$4.BeforeText || op.position === PositionType$4.AfterText) {
        requirements.targetText = true;
      }
      if (op.position === PositionType$4.AtPosition) {
        requirements.positionIndex = true;
      }
      break;
    case OperationType$1.Replace:
      if (!op.replaceEntire) {
        requirements.targetText = true;
      }
      requirements.text = false;
      break;
    case OperationType$1.AddDateTime:
      requirements.dateTimeFormat = true;
      requirements.position = true;
      if (op.position === PositionType$4.AtPosition) {
        requirements.positionIndex = true;
      }
      if (op.position === PositionType$4.BeforeText || op.position === PositionType$4.AfterText) {
        requirements.targetText = true;
      }
      break;
    case OperationType$1.Delete:
      requirements.deleteCount = true;
      requirements.deleteStartPosition = true;
      requirements.position = true;
      requirements.targetText = false;
      if (op.position === PositionType$4.AtPosition) {
        requirements.positionIndex = true;
      }
      break;
    case OperationType$1.ChangeCase:
      requirements.caseType = true;
      break;
    case OperationType$1.AddAlphabetSequence:
      requirements.alphabetStartChar = true;
      requirements.alphabetCount = true;
      if (op.position === PositionType$4.AtPosition) {
        requirements.positionIndex = true;
      }
      break;
    case OperationType$1.Reverse:
      break;
  }
  return requirements;
}
function validateOperation(op) {
  if (!op.target)
    return "FileNameModifier.Error.TargetRequired";
  if (!op.operation)
    return "FileNameModifier.Error.OperationTypeRequired";
  const requirements = getFieldRequirements(op);
  if (requirements.text && !op.text) {
    return "FileNameModifier.Error.TextRequired";
  }
  if (requirements.targetText && !op.targetText) {
    return "FileNameModifier.Error.TargetTextRequired";
  }
  if (requirements.position && !op.position) {
    return "FileNameModifier.Error.PositionRequired";
  }
  if (requirements.positionIndex && op.positionIndex == null) {
    return "FileNameModifier.Error.PositionIndexRequired";
  }
  if (requirements.dateTimeFormat && !op.dateTimeFormat) {
    return "FileNameModifier.Error.DateTimeFormatRequired";
  }
  if (requirements.deleteCount && op.deleteCount == null) {
    return "FileNameModifier.Error.DeleteCountRequired";
  }
  if (requirements.deleteStartPosition && op.deleteStartPosition == null) {
    return "FileNameModifier.Error.DeleteStartPositionRequired";
  }
  if (requirements.caseType && !op.caseType) {
    return "FileNameModifier.Error.CaseTypeRequired";
  }
  if (requirements.alphabetStartChar && !op.alphabetStartChar) {
    return "FileNameModifier.Error.AlphabetStartCharRequired";
  }
  if (requirements.alphabetCount && op.alphabetCount == null) {
    return "FileNameModifier.Error.AlphabetCountRequired";
  }
  return "";
}
const PositionType$3 = FileNameModifierPosition;
const PositionTypeOptions$2 = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const InsertOperationFields = ({ operation, t: t2, onChange }) => {
  var _a2;
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  const requirements = getFieldRequirements(operation);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: requirements.text,
        label: t2("FileNameModifier.Label.Text"),
        placeholder: t2("FileNameModifier.Placeholder.Text"),
        size: "sm",
        value: operation.text || "",
        onValueChange: (e2) => handleChangeField("text", e2)
      }
    ),
    (operation.position === PositionType$3.BeforeText || operation.position === PositionType$3.AfterText) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: requirements.targetText,
        label: t2("FileNameModifier.Label.TargetText"),
        placeholder: t2("FileNameModifier.Placeholder.TargetText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => handleChangeField("targetText", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[160px]",
        dataSource: PositionTypeOptions$2.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        disallowEmptySelection: true,
        isRequired: requirements.position,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            handleChangeField("position", key);
          }
        }
      }
    ),
    operation.position === PositionType$3.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.positionIndex,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => handleChangeField("positionIndex", e2)
      }
    )
  ] });
};
const ReplaceOperationFields = ({ operation, t: t2, onChange }) => {
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  const requirements = getFieldRequirements(operation);
  const isReplaceEntire = operation.replaceEntire || false;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isDisabled: isReplaceEntire,
        isRequired: !isReplaceEntire && requirements.targetText,
        label: t2("FileNameModifier.Label.TargetText"),
        placeholder: t2("FileNameModifier.Placeholder.TargetText"),
        size: "sm",
        value: isReplaceEntire ? "" : operation.targetText || "",
        onValueChange: (e2) => handleChangeField("targetText", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: requirements.text,
        label: t2("FileNameModifier.Label.Text"),
        placeholder: t2("FileNameModifier.Placeholder.Text"),
        size: "sm",
        value: operation.text || "",
        onValueChange: (e2) => handleChangeField("text", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          checkbox_default,
          {
            isDisabled: isReplaceEntire,
            checked: isReplaceEntire ? false : operation.regex || false,
            onChange: (e2) => handleChangeField("regex", e2.target.checked)
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-xs ${isReplaceEntire ? "text-gray-300" : "text-gray-500"}`, children: t2("FileNameModifier.UseRegex") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          checkbox_default,
          {
            checked: isReplaceEntire,
            onChange: (e2) => handleChangeField("replaceEntire", e2.target.checked)
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-500", children: t2("FileNameModifier.ReplaceEntire") })
      ] })
    ] })
  ] });
};
const PositionType$2 = FileNameModifierPosition;
const PositionTypeOptions$1 = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const AddDateTimeOperationFields = ({
  operation,
  t: t2,
  onChange
}) => {
  var _a2;
  const requirements = getFieldRequirements(operation);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: requirements.dateTimeFormat,
        label: t2("FileNameModifier.Label.DateTimeFormat"),
        placeholder: t2("FileNameModifier.Placeholder.DateTimeFormat"),
        size: "sm",
        value: operation.dateTimeFormat || "",
        onValueChange: (e2) => onChange({ ...operation, dateTimeFormat: e2 })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[160px]",
        dataSource: PositionTypeOptions$1.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        disallowEmptySelection: true,
        isRequired: requirements.position,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            onChange({ ...operation, position: key });
          }
        }
      }
    ),
    operation.position === PositionType$2.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.positionIndex,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => onChange({ ...operation, positionIndex: e2 })
      }
    ),
    (operation.position === PositionType$2.BeforeText || operation.position === PositionType$2.AfterText) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[240px]",
        isRequired: requirements.targetText,
        label: t2("FileNameModifier.Label.TargetText"),
        placeholder: t2("FileNameModifier.Placeholder.TargetText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => onChange({ ...operation, targetText: e2 })
      }
    )
  ] });
};
const PositionType$1 = FileNameModifierPosition;
const PositionTypeOptions = fileNameModifierPositions.map((opt) => ({
  label: "FileNameModifier.PositionType." + FileNameModifierPosition[opt.value],
  value: opt.value
}));
const DeleteOperationFields = ({ operation, t: t2, onChange }) => {
  var _a2;
  const handleChangeField = (key, value2) => onChange({ ...operation, [key]: value2 });
  const requirements = getFieldRequirements(operation);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.deleteCount,
        label: t2("FileNameModifier.Label.DeleteCount"),
        placeholder: t2("FileNameModifier.Placeholder.DeleteCount"),
        size: "sm",
        value: operation.deleteCount,
        onValueChange: (e2) => handleChangeField("deleteCount", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.deleteStartPosition,
        label: t2("FileNameModifier.Label.DeleteStartPosition"),
        placeholder: t2("FileNameModifier.Placeholder.DeleteStartPosition"),
        size: "sm",
        value: operation.deleteStartPosition,
        onValueChange: (e2) => handleChangeField("deleteStartPosition", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[180px]",
        isRequired: requirements.targetText,
        label: t2("FileNameModifier.Label.MatchText"),
        placeholder: t2("FileNameModifier.Placeholder.MatchText"),
        size: "sm",
        value: operation.targetText || "",
        onValueChange: (e2) => handleChangeField("targetText", e2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        className: "w-[140px]",
        dataSource: PositionTypeOptions.map((opt) => ({
          label: t2(opt.label),
          value: opt.value
        })),
        disallowEmptySelection: true,
        isRequired: requirements.position,
        label: t2("FileNameModifier.Label.PositionType"),
        placeholder: t2("FileNameModifier.Placeholder.PositionType"),
        selectedKeys: [((_a2 = operation.position) == null ? void 0 : _a2.toString()) || ""],
        size: "sm",
        onSelectionChange: (keys2) => {
          const key = parseInt(Array.from(keys2)[0]);
          if (key !== operation.position) {
            handleChangeField("position", key);
          }
        }
      }
    ),
    operation.position === PositionType$1.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.positionIndex,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => handleChangeField("positionIndex", e2)
      }
    )
  ] });
};
const CaseTypeOptions = fileNameModifierCaseTypes.map((opt) => ({
  label: "FileNameModifier.CaseType." + FileNameModifierCaseType[opt.value],
  value: opt.value
}));
const ChangeCaseOperationFields = ({
  operation,
  t: t2,
  onChange
}) => {
  var _a2;
  const requirements = getFieldRequirements(operation);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Select,
    {
      className: "w-[180px]",
      dataSource: CaseTypeOptions.map((opt) => ({
        label: t2(opt.label),
        value: opt.value
      })),
      disallowEmptySelection: true,
      isRequired: requirements.caseType,
      label: t2("FileNameModifier.Label.CaseType"),
      placeholder: t2("FileNameModifier.Placeholder.CaseType"),
      selectedKeys: [((_a2 = operation.caseType) == null ? void 0 : _a2.toString()) || ""],
      size: "sm",
      onSelectionChange: (keys2) => {
        const key = parseInt(Array.from(keys2)[0]);
        if (key !== operation.caseType) {
          onChange({ ...operation, caseType: key });
        }
      }
    }
  );
};
const PositionType = FileNameModifierPosition;
const AddAlphabetSequenceOperationFields = ({
  operation,
  t: t2,
  onChange
}) => {
  const requirements = getFieldRequirements(operation);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-[100px]",
        isRequired: requirements.alphabetStartChar,
        label: t2("FileNameModifier.Label.StartChar"),
        maxLength: 1,
        placeholder: t2("FileNameModifier.Placeholder.StartChar"),
        size: "sm",
        value: operation.alphabetStartChar,
        onValueChange: (e2) => onChange({ ...operation, alphabetStartChar: e2 })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[100px]",
        isRequired: requirements.alphabetCount,
        label: t2("FileNameModifier.Label.Count"),
        placeholder: t2("FileNameModifier.Placeholder.Count"),
        size: "sm",
        value: operation.alphabetCount,
        onValueChange: (e2) => onChange({ ...operation, alphabetCount: e2 })
      }
    ),
    operation.position === PositionType.AtPosition && /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        className: "w-[120px]",
        isRequired: requirements.positionIndex,
        label: t2("FileNameModifier.Label.PositionIndex"),
        placeholder: t2("FileNameModifier.Placeholder.PositionIndex"),
        size: "sm",
        value: operation.positionIndex,
        onValueChange: (e2) => onChange({ ...operation, positionIndex: e2 })
      }
    )
  ] });
};
const OperationType = FileNameModifierOperationType;
const TargetTypeOptions = fileNameModifierFileNameTargets.map((opt) => ({
  label: "FileNameModifier.Target." + FileNameModifierFileNameTarget[opt.value],
  value: opt.value
}));
const OperationCard = reactExports.forwardRef(
  ({
    operation,
    index: index2,
    onChange,
    onDelete,
    onCopy,
    errors,
    style: style2,
    dragHandleProps
  }, ref) => {
    var _a2, _b2;
    const { t: t2 } = useTranslation();
    const handleChange = (key, value2) => {
      onChange({ ...operation, [key]: value2 });
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { ref, className: "mb-2 p-3 operation-card", style: style2, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          dragHandleProps && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              ...dragHandleProps,
              className: "cursor-grab active:cursor-grabbing text-gray-400 hover:text-gray-600",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineHolder, { className: "text-lg" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", radius: "md", size: "sm", variant: "flat", children: index2 + 1 }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              className: "w-[200px]",
              dataSource: TargetTypeOptions.map((opt) => ({
                label: t2(opt.label),
                value: opt.value
              })),
              disallowEmptySelection: true,
              isRequired: true,
              placeholder: t2("FileNameModifier.TargetTypePlaceholder"),
              selectedKeys: [((_a2 = operation.target) == null ? void 0 : _a2.toString()) || ""],
              size: "sm",
              onSelectionChange: (keys2) => {
                const key = parseInt(Array.from(keys2)[0]);
                if (key !== operation.target) {
                  handleChange("target", key);
                }
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              className: "w-[160px]",
              dataSource: fileNameModifierOperationTypes.map((opt) => ({
                label: t2(`FileNameModifier.OperationType.${opt.label}`),
                value: opt.value
              })),
              disallowEmptySelection: true,
              isRequired: true,
              placeholder: t2("FileNameModifier.OperationTypePlaceholder"),
              selectedKeys: [((_b2 = operation.operation) == null ? void 0 : _b2.toString()) || ""],
              size: "sm",
              onSelectionChange: (keys2) => {
                const key = Array.from(keys2)[0];
                const keyInt = parseInt(key);
                if (keyInt && keyInt !== operation.operation) {
                  handleChange("operation", keyInt);
                }
              }
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          onCopy && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", onClick: onCopy, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onClick: onDelete,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
            }
          )
        ] })
      ] }),
      errors && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-xs mb-1", children: errors }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2 items-center", children: [
        operation.operation === OperationType.Insert && /* @__PURE__ */ jsxRuntimeExports.jsx(
          InsertOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        ),
        operation.operation === OperationType.Replace && /* @__PURE__ */ jsxRuntimeExports.jsx(
          ReplaceOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        ),
        operation.operation === OperationType.AddDateTime && /* @__PURE__ */ jsxRuntimeExports.jsx(
          AddDateTimeOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        ),
        operation.operation === OperationType.Delete && /* @__PURE__ */ jsxRuntimeExports.jsx(
          DeleteOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        ),
        operation.operation === OperationType.ChangeCase && /* @__PURE__ */ jsxRuntimeExports.jsx(
          ChangeCaseOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        ),
        operation.operation === OperationType.AddAlphabetSequence && /* @__PURE__ */ jsxRuntimeExports.jsx(
          AddAlphabetSequenceOperationFields,
          {
            operation,
            t: t2,
            onChange
          }
        )
      ] })
    ] });
  }
);
OperationCard.displayName = "OperationCard";
const SortableOperationCard = ({
  id: id2,
  operation,
  index: index2,
  errors,
  onChange,
  onDelete,
  onCopy
}) => {
  const {
    attributes: attributes2,
    listeners,
    setNodeRef,
    transform: transform2,
    transition: transition3,
    isDragging: isDragging2
  } = useSortable({ id: id2 });
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    opacity: isDragging2 ? 0.5 : 1,
    zIndex: isDragging2 ? 1e3 : void 0
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    OperationCard,
    {
      ref: setNodeRef,
      dragHandleProps: { ...listeners, ...attributes2 },
      errors,
      index: index2,
      operation,
      style: style2,
      onChange,
      onCopy,
      onDelete
    }
  );
};
function componentWillMount() {
  var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
  if (state !== null && state !== void 0) {
    this.setState(state);
  }
}
function componentWillReceiveProps(nextProps) {
  function updater(prevState) {
    var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
    return state !== null && state !== void 0 ? state : null;
  }
  this.setState(updater.bind(this));
}
function componentWillUpdate(nextProps, nextState) {
  try {
    var prevProps = this.props;
    var prevState = this.state;
    this.props = nextProps;
    this.state = nextState;
    this.__reactInternalSnapshotFlag = true;
    this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
      prevProps,
      prevState
    );
  } finally {
    this.props = prevProps;
    this.state = prevState;
  }
}
componentWillMount.__suppressDeprecationWarning = true;
componentWillReceiveProps.__suppressDeprecationWarning = true;
componentWillUpdate.__suppressDeprecationWarning = true;
function polyfill2(Component2) {
  var prototype2 = Component2.prototype;
  if (!prototype2 || !prototype2.isReactComponent) {
    throw new Error("Can only polyfill class components");
  }
  if (typeof Component2.getDerivedStateFromProps !== "function" && typeof prototype2.getSnapshotBeforeUpdate !== "function") {
    return Component2;
  }
  var foundWillMountName = null;
  var foundWillReceivePropsName = null;
  var foundWillUpdateName = null;
  if (typeof prototype2.componentWillMount === "function") {
    foundWillMountName = "componentWillMount";
  } else if (typeof prototype2.UNSAFE_componentWillMount === "function") {
    foundWillMountName = "UNSAFE_componentWillMount";
  }
  if (typeof prototype2.componentWillReceiveProps === "function") {
    foundWillReceivePropsName = "componentWillReceiveProps";
  } else if (typeof prototype2.UNSAFE_componentWillReceiveProps === "function") {
    foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps";
  }
  if (typeof prototype2.componentWillUpdate === "function") {
    foundWillUpdateName = "componentWillUpdate";
  } else if (typeof prototype2.UNSAFE_componentWillUpdate === "function") {
    foundWillUpdateName = "UNSAFE_componentWillUpdate";
  }
  if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
    var componentName = Component2.displayName || Component2.name;
    var newApiName = typeof Component2.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
    throw Error(
      "Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n" + componentName + " uses " + newApiName + " but also contains the following legacy lifecycles:" + (foundWillMountName !== null ? "\n  " + foundWillMountName : "") + (foundWillReceivePropsName !== null ? "\n  " + foundWillReceivePropsName : "") + (foundWillUpdateName !== null ? "\n  " + foundWillUpdateName : "") + "\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks"
    );
  }
  if (typeof Component2.getDerivedStateFromProps === "function") {
    prototype2.componentWillMount = componentWillMount;
    prototype2.componentWillReceiveProps = componentWillReceiveProps;
  }
  if (typeof prototype2.getSnapshotBeforeUpdate === "function") {
    if (typeof prototype2.componentDidUpdate !== "function") {
      throw new Error(
        "Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype"
      );
    }
    prototype2.componentWillUpdate = componentWillUpdate;
    var componentDidUpdate = prototype2.componentDidUpdate;
    prototype2.componentDidUpdate = function componentDidUpdatePolyfill(prevProps, prevState, maybeSnapshot) {
      var snapshot = this.__reactInternalSnapshotFlag ? this.__reactInternalSnapshot : maybeSnapshot;
      componentDidUpdate.call(this, prevProps, prevState, snapshot);
    };
  }
  return Component2;
}
function ownKeys$7(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$8(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$7(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$7(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$e(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$e() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$e() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$e = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ArrowKeyStepper = /* @__PURE__ */ function(_React$PureComponent) {
  function ArrowKeyStepper2() {
    var _this;
    _classCallCheck$a(this, ArrowKeyStepper2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$e(this, ArrowKeyStepper2, [].concat(args));
    _defineProperty$4(_this, "state", {
      scrollToColumn: 0,
      scrollToRow: 0,
      instanceProps: {
        prevScrollToColumn: 0,
        prevScrollToRow: 0
      }
    });
    _defineProperty$4(_this, "_columnStartIndex", 0);
    _defineProperty$4(_this, "_columnStopIndex", 0);
    _defineProperty$4(_this, "_rowStartIndex", 0);
    _defineProperty$4(_this, "_rowStopIndex", 0);
    _defineProperty$4(_this, "_onKeyDown", function(event) {
      var _this$props = _this.props, columnCount = _this$props.columnCount, disabled = _this$props.disabled, mode = _this$props.mode, rowCount = _this$props.rowCount;
      if (disabled) {
        return;
      }
      var _this$_getScrollState = _this._getScrollState(), scrollToColumnPrevious = _this$_getScrollState.scrollToColumn, scrollToRowPrevious = _this$_getScrollState.scrollToRow;
      var _this$_getScrollState2 = _this._getScrollState(), scrollToColumn = _this$_getScrollState2.scrollToColumn, scrollToRow = _this$_getScrollState2.scrollToRow;
      switch (event.key) {
        case "ArrowDown":
          scrollToRow = mode === "cells" ? Math.min(scrollToRow + 1, rowCount - 1) : Math.min(_this._rowStopIndex + 1, rowCount - 1);
          break;
        case "ArrowLeft":
          scrollToColumn = mode === "cells" ? Math.max(scrollToColumn - 1, 0) : Math.max(_this._columnStartIndex - 1, 0);
          break;
        case "ArrowRight":
          scrollToColumn = mode === "cells" ? Math.min(scrollToColumn + 1, columnCount - 1) : Math.min(_this._columnStopIndex + 1, columnCount - 1);
          break;
        case "ArrowUp":
          scrollToRow = mode === "cells" ? Math.max(scrollToRow - 1, 0) : Math.max(_this._rowStartIndex - 1, 0);
          break;
      }
      if (scrollToColumn !== scrollToColumnPrevious || scrollToRow !== scrollToRowPrevious) {
        event.preventDefault();
        _this._updateScrollState({
          scrollToColumn,
          scrollToRow
        });
      }
    });
    _defineProperty$4(_this, "_onSectionRendered", function(_ref) {
      var columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex;
      _this._columnStartIndex = columnStartIndex;
      _this._columnStopIndex = columnStopIndex;
      _this._rowStartIndex = rowStartIndex;
      _this._rowStopIndex = rowStopIndex;
    });
    return _this;
  }
  _inherits$a(ArrowKeyStepper2, _React$PureComponent);
  return _createClass$8(ArrowKeyStepper2, [{
    key: "setScrollIndexes",
    value: function setScrollIndexes(_ref2) {
      var scrollToColumn = _ref2.scrollToColumn, scrollToRow = _ref2.scrollToRow;
      this.setState({
        scrollToRow,
        scrollToColumn
      });
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, className = _this$props2.className, children = _this$props2.children;
      var _this$_getScrollState3 = this._getScrollState(), scrollToColumn = _this$_getScrollState3.scrollToColumn, scrollToRow = _this$_getScrollState3.scrollToRow;
      return /* @__PURE__ */ reactExports.createElement("div", {
        className,
        onKeyDown: this._onKeyDown
      }, children({
        onSectionRendered: this._onSectionRendered,
        scrollToColumn,
        scrollToRow
      }));
    }
  }, {
    key: "_getScrollState",
    value: function _getScrollState() {
      return this.props.isControlled ? this.props : this.state;
    }
  }, {
    key: "_updateScrollState",
    value: function _updateScrollState(_ref3) {
      var scrollToColumn = _ref3.scrollToColumn, scrollToRow = _ref3.scrollToRow;
      var _this$props3 = this.props, isControlled = _this$props3.isControlled, onScrollToChange = _this$props3.onScrollToChange;
      if (typeof onScrollToChange === "function") {
        onScrollToChange({
          scrollToColumn,
          scrollToRow
        });
      }
      if (!isControlled) {
        this.setState({
          scrollToColumn,
          scrollToRow
        });
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.isControlled) {
        return {};
      }
      if (nextProps.scrollToColumn !== prevState.instanceProps.prevScrollToColumn || nextProps.scrollToRow !== prevState.instanceProps.prevScrollToRow) {
        return _objectSpread$8(_objectSpread$8({}, prevState), {}, {
          scrollToColumn: nextProps.scrollToColumn,
          scrollToRow: nextProps.scrollToRow,
          instanceProps: {
            prevScrollToColumn: nextProps.scrollToColumn,
            prevScrollToRow: nextProps.scrollToRow
          }
        });
      }
      return {};
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(ArrowKeyStepper, "defaultProps", {
  disabled: false,
  isControlled: false,
  mode: "edges",
  scrollToColumn: 0,
  scrollToRow: 0
});
polyfill2(ArrowKeyStepper);
function createDetectElementResize(nonce, hostWindow) {
  var _window;
  if (typeof hostWindow !== "undefined") {
    _window = hostWindow;
  } else if (typeof window !== "undefined") {
    _window = window;
  } else if (typeof self !== "undefined") {
    _window = self;
  } else {
    _window = global;
  }
  var attachEvent = typeof _window.document !== "undefined" && _window.document.attachEvent;
  if (!attachEvent) {
    var requestFrame = function() {
      var raf3 = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || function(fn) {
        return _window.setTimeout(fn, 20);
      };
      return function(fn) {
        return raf3(fn);
      };
    }();
    var cancelFrame2 = function() {
      var cancel2 = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || _window.clearTimeout;
      return function(id2) {
        return cancel2(id2);
      };
    }();
    var resetTriggers = function resetTriggers2(element2) {
      var triggers = element2.__resizeTriggers__, expand = triggers.firstElementChild, contract = triggers.lastElementChild, expandChild = expand.firstElementChild;
      contract.scrollLeft = contract.scrollWidth;
      contract.scrollTop = contract.scrollHeight;
      expandChild.style.width = expand.offsetWidth + 1 + "px";
      expandChild.style.height = expand.offsetHeight + 1 + "px";
      expand.scrollLeft = expand.scrollWidth;
      expand.scrollTop = expand.scrollHeight;
    };
    var checkTriggers = function checkTriggers2(element2) {
      return element2.offsetWidth != element2.__resizeLast__.width || element2.offsetHeight != element2.__resizeLast__.height;
    };
    var scrollListener = function scrollListener2(e2) {
      if (e2.target.className && typeof e2.target.className.indexOf === "function" && e2.target.className.indexOf("contract-trigger") < 0 && e2.target.className.indexOf("expand-trigger") < 0) {
        return;
      }
      var element2 = this;
      resetTriggers(this);
      if (this.__resizeRAF__) {
        cancelFrame2(this.__resizeRAF__);
      }
      this.__resizeRAF__ = requestFrame(function() {
        if (checkTriggers(element2)) {
          element2.__resizeLast__.width = element2.offsetWidth;
          element2.__resizeLast__.height = element2.offsetHeight;
          element2.__resizeListeners__.forEach(function(fn) {
            fn.call(element2, e2);
          });
        }
      });
    };
    var animation = false, keyframeprefix = "", animationstartevent = "animationstart", domPrefixes = "Webkit Moz O ms".split(" "), startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), pfx = "";
    {
      var elm = _window.document.createElement("fakeelement");
      if (elm.style.animationName !== void 0) {
        animation = true;
      }
      if (animation === false) {
        for (var i2 = 0; i2 < domPrefixes.length; i2++) {
          if (elm.style[domPrefixes[i2] + "AnimationName"] !== void 0) {
            pfx = domPrefixes[i2];
            keyframeprefix = "-" + pfx.toLowerCase() + "-";
            animationstartevent = startEvents[i2];
            animation = true;
            break;
          }
        }
      }
    }
    var animationName = "resizeanim";
    var animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
    var animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
  }
  var createStyles = function createStyles2(doc) {
    if (!doc.getElementById("detectElementResize")) {
      var css = (animationKeyframes ? animationKeyframes : "") + ".resize-triggers { " + (animationStyle ? animationStyle : "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', head = doc.head || doc.getElementsByTagName("head")[0], style2 = doc.createElement("style");
      style2.id = "detectElementResize";
      style2.type = "text/css";
      if (nonce != null) {
        style2.setAttribute("nonce", nonce);
      }
      if (style2.styleSheet) {
        style2.styleSheet.cssText = css;
      } else {
        style2.appendChild(doc.createTextNode(css));
      }
      head.appendChild(style2);
    }
  };
  var addResizeListener = function addResizeListener2(element2, fn) {
    if (attachEvent) {
      element2.attachEvent("onresize", fn);
    } else {
      if (!element2.__resizeTriggers__) {
        var doc = element2.ownerDocument;
        var elementStyle = _window.getComputedStyle(element2);
        if (elementStyle && elementStyle.position == "static") {
          element2.style.position = "relative";
        }
        createStyles(doc);
        element2.__resizeLast__ = {};
        element2.__resizeListeners__ = [];
        (element2.__resizeTriggers__ = doc.createElement("div")).className = "resize-triggers";
        var expandTrigger = doc.createElement("div");
        expandTrigger.className = "expand-trigger";
        expandTrigger.appendChild(doc.createElement("div"));
        var contractTrigger = doc.createElement("div");
        contractTrigger.className = "contract-trigger";
        element2.__resizeTriggers__.appendChild(expandTrigger);
        element2.__resizeTriggers__.appendChild(contractTrigger);
        element2.appendChild(element2.__resizeTriggers__);
        resetTriggers(element2);
        element2.addEventListener("scroll", scrollListener, true);
        if (animationstartevent) {
          element2.__resizeTriggers__.__animationListener__ = function animationListener(e2) {
            if (e2.animationName == animationName) {
              resetTriggers(element2);
            }
          };
          element2.__resizeTriggers__.addEventListener(animationstartevent, element2.__resizeTriggers__.__animationListener__);
        }
      }
      element2.__resizeListeners__.push(fn);
    }
  };
  var removeResizeListener = function removeResizeListener2(element2, fn) {
    if (attachEvent) {
      element2.detachEvent("onresize", fn);
    } else {
      element2.__resizeListeners__.splice(element2.__resizeListeners__.indexOf(fn), 1);
      if (!element2.__resizeListeners__.length) {
        element2.removeEventListener("scroll", scrollListener, true);
        if (element2.__resizeTriggers__.__animationListener__) {
          element2.__resizeTriggers__.removeEventListener(animationstartevent, element2.__resizeTriggers__.__animationListener__);
          element2.__resizeTriggers__.__animationListener__ = null;
        }
        try {
          element2.__resizeTriggers__ = !element2.removeChild(element2.__resizeTriggers__);
        } catch (e2) {
        }
      }
    }
  };
  return {
    addResizeListener,
    removeResizeListener
  };
}
function ownKeys$6(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$7(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$6(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$6(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$d(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$d() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$d() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$d = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var AutoSizer = /* @__PURE__ */ function(_React$Component) {
  function AutoSizer2() {
    var _this;
    _classCallCheck$a(this, AutoSizer2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$d(this, AutoSizer2, [].concat(args));
    _defineProperty$4(_this, "state", {
      height: _this.props.defaultHeight || 0,
      width: _this.props.defaultWidth || 0
    });
    _defineProperty$4(_this, "_parentNode", void 0);
    _defineProperty$4(_this, "_autoSizer", void 0);
    _defineProperty$4(_this, "_window", void 0);
    _defineProperty$4(_this, "_detectElementResize", void 0);
    _defineProperty$4(_this, "_onResize", function() {
      var _this$props = _this.props, disableHeight = _this$props.disableHeight, disableWidth = _this$props.disableWidth, onResize4 = _this$props.onResize;
      if (_this._parentNode) {
        var height = _this._parentNode.offsetHeight || 0;
        var width = _this._parentNode.offsetWidth || 0;
        var win2 = _this._window || window;
        var style2 = win2.getComputedStyle(_this._parentNode) || {};
        var paddingLeft = parseInt(style2.paddingLeft, 10) || 0;
        var paddingRight = parseInt(style2.paddingRight, 10) || 0;
        var paddingTop = parseInt(style2.paddingTop, 10) || 0;
        var paddingBottom = parseInt(style2.paddingBottom, 10) || 0;
        var newHeight = height - paddingTop - paddingBottom;
        var newWidth = width - paddingLeft - paddingRight;
        if (!disableHeight && _this.state.height !== newHeight || !disableWidth && _this.state.width !== newWidth) {
          _this.setState({
            height: height - paddingTop - paddingBottom,
            width: width - paddingLeft - paddingRight
          });
          onResize4({
            height,
            width
          });
        }
      }
    });
    _defineProperty$4(_this, "_setRef", function(autoSizer) {
      _this._autoSizer = autoSizer;
    });
    return _this;
  }
  _inherits$a(AutoSizer2, _React$Component);
  return _createClass$8(AutoSizer2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var nonce = this.props.nonce;
      if (this._autoSizer && this._autoSizer.parentNode && this._autoSizer.parentNode.ownerDocument && this._autoSizer.parentNode.ownerDocument.defaultView && this._autoSizer.parentNode instanceof this._autoSizer.parentNode.ownerDocument.defaultView.HTMLElement) {
        this._parentNode = this._autoSizer.parentNode;
        this._window = this._autoSizer.parentNode.ownerDocument.defaultView;
        this._detectElementResize = createDetectElementResize(nonce, this._window);
        this._detectElementResize.addResizeListener(this._parentNode, this._onResize);
        this._onResize();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._detectElementResize && this._parentNode) {
        this._detectElementResize.removeResizeListener(this._parentNode, this._onResize);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, children = _this$props2.children, className = _this$props2.className, disableHeight = _this$props2.disableHeight, disableWidth = _this$props2.disableWidth, style2 = _this$props2.style;
      var _this$state = this.state, height = _this$state.height, width = _this$state.width;
      var outerStyle = {
        overflow: "visible"
      };
      var childParams = {};
      if (!disableHeight) {
        outerStyle.height = 0;
        childParams.height = height;
      }
      if (!disableWidth) {
        outerStyle.width = 0;
        childParams.width = width;
      }
      return /* @__PURE__ */ reactExports.createElement("div", {
        className,
        ref: this._setRef,
        style: _objectSpread$7(_objectSpread$7({}, outerStyle), style2)
      }, children(childParams));
    }
  }]);
}(reactExports.Component);
_defineProperty$4(AutoSizer, "defaultProps", {
  onResize: function onResize2() {
  },
  disableHeight: false,
  disableWidth: false,
  style: {}
});
function _callSuper$c(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$c() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$c() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$c = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var CellMeasurer = /* @__PURE__ */ function(_React$PureComponent) {
  function CellMeasurer2() {
    var _this;
    _classCallCheck$a(this, CellMeasurer2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$c(this, CellMeasurer2, [].concat(args));
    _defineProperty$4(_this, "_child", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$4(_this, "_measure", function() {
      var _this$props = _this.props, cache2 = _this$props.cache, _this$props$columnInd = _this$props.columnIndex, columnIndex = _this$props$columnInd === void 0 ? 0 : _this$props$columnInd, parent = _this$props.parent, _this$props$rowIndex = _this$props.rowIndex, rowIndex = _this$props$rowIndex === void 0 ? _this.props.index || 0 : _this$props$rowIndex;
      var _this$_getCellMeasure = _this._getCellMeasurements(), height = _this$_getCellMeasure.height, width = _this$_getCellMeasure.width;
      if (height !== cache2.getHeight(rowIndex, columnIndex) || width !== cache2.getWidth(rowIndex, columnIndex)) {
        cache2.set(rowIndex, columnIndex, width, height);
        if (parent && typeof parent.recomputeGridSize === "function") {
          parent.recomputeGridSize({
            columnIndex,
            rowIndex
          });
        }
      }
    });
    _defineProperty$4(_this, "_registerChild", function(element2) {
      if (element2 && !(element2 instanceof Element)) {
        console.warn("CellMeasurer registerChild expects to be passed Element or null");
      }
      _this._child.current = element2;
      if (element2) {
        _this._maybeMeasureCell();
      }
    });
    return _this;
  }
  _inherits$a(CellMeasurer2, _React$PureComponent);
  return _createClass$8(CellMeasurer2, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this._maybeMeasureCell();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._maybeMeasureCell();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var children = this.props.children;
      var resolvedChildren = typeof children === "function" ? children({
        measure: this._measure,
        registerChild: this._registerChild
      }) : children;
      if (resolvedChildren === null) {
        return resolvedChildren;
      }
      return /* @__PURE__ */ reactExports.cloneElement(resolvedChildren, {
        ref: function ref(node2) {
          if (typeof resolvedChildren.ref === "function") {
            resolvedChildren.ref(node2);
          } else if (resolvedChildren.ref) {
            resolvedChildren.ref.current = node2;
          }
          _this2._child.current = node2;
        }
      });
    }
  }, {
    key: "_getCellMeasurements",
    value: function _getCellMeasurements() {
      var cache2 = this.props.cache;
      var node2 = this._child.current;
      if (node2 && node2.ownerDocument && node2.ownerDocument.defaultView && node2 instanceof node2.ownerDocument.defaultView.HTMLElement) {
        var styleWidth = node2.style.width;
        var styleHeight = node2.style.height;
        if (!cache2.hasFixedWidth()) {
          node2.style.width = "auto";
        }
        if (!cache2.hasFixedHeight()) {
          node2.style.height = "auto";
        }
        var height = Math.ceil(node2.offsetHeight);
        var width = Math.ceil(node2.offsetWidth);
        if (styleWidth) {
          node2.style.width = styleWidth;
        }
        if (styleHeight) {
          node2.style.height = styleHeight;
        }
        return {
          height,
          width
        };
      } else {
        return {
          height: 0,
          width: 0
        };
      }
    }
  }, {
    key: "_maybeMeasureCell",
    value: function _maybeMeasureCell() {
      var _this$props2 = this.props, cache2 = _this$props2.cache, _this$props2$columnIn = _this$props2.columnIndex, columnIndex = _this$props2$columnIn === void 0 ? 0 : _this$props2$columnIn, parent = _this$props2.parent, _this$props2$rowIndex = _this$props2.rowIndex, rowIndex = _this$props2$rowIndex === void 0 ? this.props.index || 0 : _this$props2$rowIndex;
      if (!cache2.has(rowIndex, columnIndex)) {
        var _this$_getCellMeasure2 = this._getCellMeasurements(), height = _this$_getCellMeasure2.height, width = _this$_getCellMeasure2.width;
        cache2.set(rowIndex, columnIndex, width, height);
        if (parent && typeof parent.invalidateCellSizeAfterRender === "function") {
          parent.invalidateCellSizeAfterRender({
            columnIndex,
            rowIndex
          });
        }
      }
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(CellMeasurer, "__internalCellMeasurerFlag", false);
var DEFAULT_HEIGHT = 30;
var DEFAULT_WIDTH = 100;
var CellMeasurerCache = /* @__PURE__ */ function() {
  function CellMeasurerCache2() {
    var _this = this;
    var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, CellMeasurerCache2);
    _defineProperty$4(this, "_cellHeightCache", {});
    _defineProperty$4(this, "_cellWidthCache", {});
    _defineProperty$4(this, "_columnWidthCache", {});
    _defineProperty$4(this, "_rowHeightCache", {});
    _defineProperty$4(this, "_defaultHeight", void 0);
    _defineProperty$4(this, "_defaultWidth", void 0);
    _defineProperty$4(this, "_minHeight", void 0);
    _defineProperty$4(this, "_minWidth", void 0);
    _defineProperty$4(this, "_keyMapper", void 0);
    _defineProperty$4(this, "_hasFixedHeight", void 0);
    _defineProperty$4(this, "_hasFixedWidth", void 0);
    _defineProperty$4(this, "_columnCount", 0);
    _defineProperty$4(this, "_rowCount", 0);
    _defineProperty$4(this, "columnWidth", function(_ref) {
      var index2 = _ref.index;
      var key = _this._keyMapper(0, index2);
      return _this._columnWidthCache[key] !== void 0 ? _this._columnWidthCache[key] : _this._defaultWidth;
    });
    _defineProperty$4(this, "rowHeight", function(_ref2) {
      var index2 = _ref2.index;
      var key = _this._keyMapper(index2, 0);
      return _this._rowHeightCache[key] !== void 0 ? _this._rowHeightCache[key] : _this._defaultHeight;
    });
    var defaultHeight = params.defaultHeight, defaultWidth = params.defaultWidth, fixedHeight = params.fixedHeight, fixedWidth = params.fixedWidth, keyMapper = params.keyMapper, minHeight = params.minHeight, minWidth = params.minWidth;
    this._hasFixedHeight = fixedHeight === true;
    this._hasFixedWidth = fixedWidth === true;
    this._minHeight = minHeight || 0;
    this._minWidth = minWidth || 0;
    this._keyMapper = keyMapper || defaultKeyMapper;
    this._defaultHeight = Math.max(this._minHeight, typeof defaultHeight === "number" ? defaultHeight : DEFAULT_HEIGHT);
    this._defaultWidth = Math.max(this._minWidth, typeof defaultWidth === "number" ? defaultWidth : DEFAULT_WIDTH);
  }
  return _createClass$8(CellMeasurerCache2, [{
    key: "clear",
    value: function clear(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      var key = this._keyMapper(rowIndex, columnIndex);
      delete this._cellHeightCache[key];
      delete this._cellWidthCache[key];
      this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
    }
  }, {
    key: "clearAll",
    value: function clearAll() {
      this._cellHeightCache = {};
      this._cellWidthCache = {};
      this._columnWidthCache = {};
      this._rowHeightCache = {};
      this._rowCount = 0;
      this._columnCount = 0;
    }
  }, {
    key: "defaultHeight",
    get: function get5() {
      return this._defaultHeight;
    }
  }, {
    key: "defaultWidth",
    get: function get5() {
      return this._defaultWidth;
    }
  }, {
    key: "hasFixedHeight",
    value: function hasFixedHeight() {
      return this._hasFixedHeight;
    }
  }, {
    key: "hasFixedWidth",
    value: function hasFixedWidth() {
      return this._hasFixedWidth;
    }
  }, {
    key: "getHeight",
    value: function getHeight4(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (this._hasFixedHeight) {
        return this._defaultHeight;
      } else {
        var _key = this._keyMapper(rowIndex, columnIndex);
        return this._cellHeightCache[_key] !== void 0 ? Math.max(this._minHeight, this._cellHeightCache[_key]) : this._defaultHeight;
      }
    }
  }, {
    key: "getWidth",
    value: function getWidth3(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (this._hasFixedWidth) {
        return this._defaultWidth;
      } else {
        var _key2 = this._keyMapper(rowIndex, columnIndex);
        return this._cellWidthCache[_key2] !== void 0 ? Math.max(this._minWidth, this._cellWidthCache[_key2]) : this._defaultWidth;
      }
    }
  }, {
    key: "has",
    value: function has(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      var key = this._keyMapper(rowIndex, columnIndex);
      return this._cellHeightCache[key] !== void 0;
    }
  }, {
    key: "set",
    value: function set2(rowIndex, columnIndex, width, height) {
      var key = this._keyMapper(rowIndex, columnIndex);
      if (columnIndex >= this._columnCount) {
        this._columnCount = columnIndex + 1;
      }
      if (rowIndex >= this._rowCount) {
        this._rowCount = rowIndex + 1;
      }
      this._cellHeightCache[key] = height;
      this._cellWidthCache[key] = width;
      this._updateCachedColumnAndRowSizes(rowIndex, columnIndex);
    }
  }, {
    key: "_updateCachedColumnAndRowSizes",
    value: function _updateCachedColumnAndRowSizes(rowIndex, columnIndex) {
      if (!this._hasFixedWidth) {
        var columnWidth = 0;
        for (var i2 = 0; i2 < this._rowCount; i2++) {
          columnWidth = Math.max(columnWidth, this.getWidth(i2, columnIndex));
        }
        var columnKey = this._keyMapper(0, columnIndex);
        this._columnWidthCache[columnKey] = columnWidth;
      }
      if (!this._hasFixedHeight) {
        var rowHeight = 0;
        for (var _i = 0; _i < this._columnCount; _i++) {
          rowHeight = Math.max(rowHeight, this.getHeight(rowIndex, _i));
        }
        var rowKey = this._keyMapper(rowIndex, 0);
        this._rowHeightCache[rowKey] = rowHeight;
      }
    }
  }]);
}();
function defaultKeyMapper(rowIndex, columnIndex) {
  return "".concat(rowIndex, "-").concat(columnIndex);
}
var _extendsExports = require_extends();
const _extends = /* @__PURE__ */ getDefaultExportFromCjs(_extendsExports);
function r$1(e2) {
  var t2, f2, n2 = "";
  if ("string" == typeof e2 || "number" == typeof e2)
    n2 += e2;
  else if ("object" == typeof e2)
    if (Array.isArray(e2))
      for (t2 = 0; t2 < e2.length; t2++)
        e2[t2] && (f2 = r$1(e2[t2])) && (n2 && (n2 += " "), n2 += f2);
    else
      for (t2 in e2)
        e2[t2] && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function clsx() {
  for (var e2, t2, f2 = 0, n2 = ""; f2 < arguments.length; )
    (e2 = arguments[f2++]) && (t2 = r$1(e2)) && (n2 && (n2 += " "), n2 += t2);
  return n2;
}
function createCallbackMemoizer() {
  var requireAllKeys = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
  var cachedIndices = {};
  return function(_ref) {
    var callback2 = _ref.callback, indices = _ref.indices;
    var keys2 = Object.keys(indices);
    var allInitialized = !requireAllKeys || keys2.every(function(key) {
      var value2 = indices[key];
      return Array.isArray(value2) ? value2.length > 0 : value2 >= 0;
    });
    var indexChanged = keys2.length !== Object.keys(cachedIndices).length || keys2.some(function(key) {
      var cachedValue = cachedIndices[key];
      var value2 = indices[key];
      return Array.isArray(value2) ? cachedValue.join(",") !== value2.join(",") : cachedValue !== value2;
    });
    cachedIndices = indices;
    if (allInitialized && indexChanged) {
      callback2(indices);
    }
  };
}
const canUseDOM2 = !!(typeof window !== "undefined" && window.document && window.document.createElement);
var size;
function scrollbarSize(recalc) {
  if (!size && size !== 0 || recalc) {
    if (canUseDOM2) {
      var scrollDiv = document.createElement("div");
      scrollDiv.style.position = "absolute";
      scrollDiv.style.top = "-9999px";
      scrollDiv.style.width = "50px";
      scrollDiv.style.height = "50px";
      scrollDiv.style.overflow = "scroll";
      document.body.appendChild(scrollDiv);
      size = scrollDiv.offsetWidth - scrollDiv.clientWidth;
      document.body.removeChild(scrollDiv);
    }
  }
  return size;
}
function ownKeys$5(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$6(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$5(Object(t2), true).forEach(function(r22) {
      _defineProperty$4(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$5(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$b(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$b() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$b() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$b = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var IS_SCROLLING_TIMEOUT$1 = 150;
var SCROLL_POSITION_CHANGE_REASONS$1 = {
  OBSERVED: "observed",
  REQUESTED: "requested"
};
var CollectionView = /* @__PURE__ */ function(_React$PureComponent) {
  function CollectionView2() {
    var _this;
    _classCallCheck$a(this, CollectionView2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$b(this, CollectionView2, [].concat(args));
    _defineProperty$4(_this, "state", {
      isScrolling: false,
      scrollLeft: 0,
      scrollTop: 0
    });
    _defineProperty$4(_this, "_calculateSizeAndPositionDataOnNextUpdate", false);
    _defineProperty$4(_this, "_onSectionRenderedMemoizer", createCallbackMemoizer());
    _defineProperty$4(_this, "_onScrollMemoizer", createCallbackMemoizer(false));
    _defineProperty$4(_this, "_invokeOnSectionRenderedHelper", function() {
      var _this$props = _this.props, cellLayoutManager = _this$props.cellLayoutManager, onSectionRendered22 = _this$props.onSectionRendered;
      _this._onSectionRenderedMemoizer({
        callback: onSectionRendered22,
        indices: {
          indices: cellLayoutManager.getLastRenderedIndices()
        }
      });
    });
    _defineProperty$4(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
    });
    _defineProperty$4(_this, "_updateScrollPositionForScrollToCell", function() {
      var _this$props2 = _this.props, cellLayoutManager = _this$props2.cellLayoutManager, height = _this$props2.height, scrollToAlignment = _this$props2.scrollToAlignment, scrollToCell = _this$props2.scrollToCell, width = _this$props2.width;
      var _this$state = _this.state, scrollLeft = _this$state.scrollLeft, scrollTop = _this$state.scrollTop;
      if (scrollToCell >= 0) {
        var scrollPosition = cellLayoutManager.getScrollPositionForCell({
          align: scrollToAlignment,
          cellIndex: scrollToCell,
          height,
          scrollLeft,
          scrollTop,
          width
        });
        if (scrollPosition.scrollLeft !== scrollLeft || scrollPosition.scrollTop !== scrollTop) {
          _this._setScrollPosition(scrollPosition);
        }
      }
    });
    _defineProperty$4(_this, "_onScroll", function(event) {
      if (event.target !== _this._scrollingContainer) {
        return;
      }
      _this._enablePointerEventsAfterDelay();
      var _this$props3 = _this.props, cellLayoutManager = _this$props3.cellLayoutManager, height = _this$props3.height, isScrollingChange = _this$props3.isScrollingChange, width = _this$props3.width;
      var scrollbarSize2 = _this._scrollbarSize;
      var _cellLayoutManager$ge = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge.height, totalWidth = _cellLayoutManager$ge.width;
      var scrollLeft = Math.max(0, Math.min(totalWidth - width + scrollbarSize2, event.target.scrollLeft));
      var scrollTop = Math.max(0, Math.min(totalHeight - height + scrollbarSize2, event.target.scrollTop));
      if (_this.state.scrollLeft !== scrollLeft || _this.state.scrollTop !== scrollTop) {
        var scrollPositionChangeReason = event.cancelable ? SCROLL_POSITION_CHANGE_REASONS$1.OBSERVED : SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED;
        if (!_this.state.isScrolling) {
          isScrollingChange(true);
        }
        _this.setState({
          isScrolling: true,
          scrollLeft,
          scrollPositionChangeReason,
          scrollTop
        });
      }
      _this._invokeOnScrollMemoizer({
        scrollLeft,
        scrollTop,
        totalWidth,
        totalHeight
      });
    });
    _this._scrollbarSize = scrollbarSize();
    if (_this._scrollbarSize === void 0) {
      _this._scrollbarSizeMeasured = false;
      _this._scrollbarSize = 0;
    } else {
      _this._scrollbarSizeMeasured = true;
    }
    return _this;
  }
  _inherits$a(CollectionView2, _React$PureComponent);
  return _createClass$8(CollectionView2, [{
    key: "recomputeCellSizesAndPositions",
    value: function recomputeCellSizesAndPositions() {
      this._calculateSizeAndPositionDataOnNextUpdate = true;
      this.forceUpdate();
    }
    /* ---------------------------- Component lifecycle methods ---------------------------- */
    /**
     * @private
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) Empty content (0 rows or columns)
     * 2) New scroll props overriding the current state
     * 3) Cells-count or cells-size has changed, making previous scroll offsets invalid
     */
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props4 = this.props, cellLayoutManager = _this$props4.cellLayoutManager, scrollLeft = _this$props4.scrollLeft, scrollToCell = _this$props4.scrollToCell, scrollTop = _this$props4.scrollTop;
      if (!this._scrollbarSizeMeasured) {
        this._scrollbarSize = scrollbarSize();
        this._scrollbarSizeMeasured = true;
        this.setState({});
      }
      if (scrollToCell >= 0) {
        this._updateScrollPositionForScrollToCell();
      } else if (scrollLeft >= 0 || scrollTop >= 0) {
        this._setScrollPosition({
          scrollLeft,
          scrollTop
        });
      }
      this._invokeOnSectionRenderedHelper();
      var _cellLayoutManager$ge2 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge2.height, totalWidth = _cellLayoutManager$ge2.width;
      this._invokeOnScrollMemoizer({
        scrollLeft: scrollLeft || 0,
        scrollTop: scrollTop || 0,
        totalHeight,
        totalWidth
      });
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this$props5 = this.props, height = _this$props5.height, scrollToAlignment = _this$props5.scrollToAlignment, scrollToCell = _this$props5.scrollToCell, width = _this$props5.width;
      var _this$state2 = this.state, scrollLeft = _this$state2.scrollLeft, scrollPositionChangeReason = _this$state2.scrollPositionChangeReason, scrollTop = _this$state2.scrollTop;
      if (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED) {
        if (scrollLeft >= 0 && scrollLeft !== prevState.scrollLeft && scrollLeft !== this._scrollingContainer.scrollLeft) {
          this._scrollingContainer.scrollLeft = scrollLeft;
        }
        if (scrollTop >= 0 && scrollTop !== prevState.scrollTop && scrollTop !== this._scrollingContainer.scrollTop) {
          this._scrollingContainer.scrollTop = scrollTop;
        }
      }
      if (height !== prevProps.height || scrollToAlignment !== prevProps.scrollToAlignment || scrollToCell !== prevProps.scrollToCell || width !== prevProps.width) {
        this._updateScrollPositionForScrollToCell();
      }
      this._invokeOnSectionRenderedHelper();
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._disablePointerEventsTimeoutId) {
        clearTimeout(this._disablePointerEventsTimeoutId);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props6 = this.props, autoHeight = _this$props6.autoHeight, cellCount = _this$props6.cellCount, cellLayoutManager = _this$props6.cellLayoutManager, className = _this$props6.className, height = _this$props6.height, horizontalOverscanSize = _this$props6.horizontalOverscanSize, id2 = _this$props6.id, noContentRenderer2 = _this$props6.noContentRenderer, style2 = _this$props6.style, verticalOverscanSize = _this$props6.verticalOverscanSize, width = _this$props6.width;
      var _this$state3 = this.state, isScrolling = _this$state3.isScrolling, scrollLeft = _this$state3.scrollLeft, scrollTop = _this$state3.scrollTop;
      if (this._lastRenderedCellCount !== cellCount || this._lastRenderedCellLayoutManager !== cellLayoutManager || this._calculateSizeAndPositionDataOnNextUpdate) {
        this._lastRenderedCellCount = cellCount;
        this._lastRenderedCellLayoutManager = cellLayoutManager;
        this._calculateSizeAndPositionDataOnNextUpdate = false;
        cellLayoutManager.calculateSizeAndPositionData();
      }
      var _cellLayoutManager$ge3 = cellLayoutManager.getTotalSize(), totalHeight = _cellLayoutManager$ge3.height, totalWidth = _cellLayoutManager$ge3.width;
      var left2 = Math.max(0, scrollLeft - horizontalOverscanSize);
      var top2 = Math.max(0, scrollTop - verticalOverscanSize);
      var right = Math.min(totalWidth, scrollLeft + width + horizontalOverscanSize);
      var bottom2 = Math.min(totalHeight, scrollTop + height + verticalOverscanSize);
      var childrenToDisplay = height > 0 && width > 0 ? cellLayoutManager.cellRenderers({
        height: bottom2 - top2,
        isScrolling,
        width: right - left2,
        x: left2,
        y: top2
      }) : [];
      var collectionStyle = {
        boxSizing: "border-box",
        direction: "ltr",
        height: autoHeight ? "auto" : height,
        position: "relative",
        WebkitOverflowScrolling: "touch",
        width,
        willChange: "transform"
      };
      var verticalScrollBarSize = totalHeight > height ? this._scrollbarSize : 0;
      var horizontalScrollBarSize = totalWidth > width ? this._scrollbarSize : 0;
      collectionStyle.overflowX = totalWidth + verticalScrollBarSize <= width ? "hidden" : "auto";
      collectionStyle.overflowY = totalHeight + horizontalScrollBarSize <= height ? "hidden" : "auto";
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._setScrollingContainerRef,
        "aria-label": this.props["aria-label"],
        className: clsx("ReactVirtualized__Collection", className),
        id: id2,
        onScroll: this._onScroll,
        role: "grid",
        style: _objectSpread$6(_objectSpread$6({}, collectionStyle), style2),
        tabIndex: 0
      }, cellCount > 0 && /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Collection__innerScrollContainer",
        style: {
          height: totalHeight,
          maxHeight: totalHeight,
          maxWidth: totalWidth,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          width: totalWidth
        }
      }, childrenToDisplay), cellCount === 0 && noContentRenderer2());
    }
    /* ---------------------------- Helper methods ---------------------------- */
    /**
     * Sets an :isScrolling flag for a small window of time.
     * This flag is used to disable pointer events on the scrollable portion of the Collection.
     * This prevents jerky/stuttery mouse-wheel scrolling.
     */
  }, {
    key: "_enablePointerEventsAfterDelay",
    value: function _enablePointerEventsAfterDelay() {
      var _this2 = this;
      if (this._disablePointerEventsTimeoutId) {
        clearTimeout(this._disablePointerEventsTimeoutId);
      }
      this._disablePointerEventsTimeoutId = setTimeout(function() {
        var isScrollingChange = _this2.props.isScrollingChange;
        isScrollingChange(false);
        _this2._disablePointerEventsTimeoutId = null;
        _this2.setState({
          isScrolling: false
        });
      }, IS_SCROLLING_TIMEOUT$1);
    }
  }, {
    key: "_invokeOnScrollMemoizer",
    value: function _invokeOnScrollMemoizer(_ref) {
      var _this3 = this;
      var scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, totalHeight = _ref.totalHeight, totalWidth = _ref.totalWidth;
      this._onScrollMemoizer({
        callback: function callback2(_ref2) {
          var scrollLeft2 = _ref2.scrollLeft, scrollTop2 = _ref2.scrollTop;
          var _this3$props = _this3.props, height = _this3$props.height, onScroll22 = _this3$props.onScroll, width = _this3$props.width;
          onScroll22({
            clientHeight: height,
            clientWidth: width,
            scrollHeight: totalHeight,
            scrollLeft: scrollLeft2,
            scrollTop: scrollTop2,
            scrollWidth: totalWidth
          });
        },
        indices: {
          scrollLeft,
          scrollTop
        }
      });
    }
  }, {
    key: "_setScrollPosition",
    value: function _setScrollPosition(_ref3) {
      var scrollLeft = _ref3.scrollLeft, scrollTop = _ref3.scrollTop;
      var newState = {
        scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
      };
      if (scrollLeft >= 0) {
        newState.scrollLeft = scrollLeft;
      }
      if (scrollTop >= 0) {
        newState.scrollTop = scrollTop;
      }
      if (scrollLeft >= 0 && scrollLeft !== this.state.scrollLeft || scrollTop >= 0 && scrollTop !== this.state.scrollTop) {
        this.setState(newState);
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.cellCount === 0 && (prevState.scrollLeft !== 0 || prevState.scrollTop !== 0)) {
        return {
          scrollLeft: 0,
          scrollTop: 0,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
        };
      } else if (nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop) {
        return {
          scrollLeft: nextProps.scrollLeft != null ? nextProps.scrollLeft : prevState.scrollLeft,
          scrollTop: nextProps.scrollTop != null ? nextProps.scrollTop : prevState.scrollTop,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS$1.REQUESTED
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(CollectionView, "defaultProps", {
  "aria-label": "grid",
  horizontalOverscanSize: 0,
  noContentRenderer: function noContentRenderer() {
    return null;
  },
  onScroll: function onScroll() {
    return null;
  },
  onSectionRendered: function onSectionRendered() {
    return null;
  },
  scrollToAlignment: "auto",
  scrollToCell: -1,
  style: {},
  verticalOverscanSize: 0
});
CollectionView.propTypes = {};
polyfill2(CollectionView);
var Section = /* @__PURE__ */ function() {
  function Section2(_ref) {
    var height = _ref.height, width = _ref.width, x2 = _ref.x, y2 = _ref.y;
    _classCallCheck$a(this, Section2);
    this.height = height;
    this.width = width;
    this.x = x2;
    this.y = y2;
    this._indexMap = {};
    this._indices = [];
  }
  return _createClass$8(Section2, [{
    key: "addCellIndex",
    value: function addCellIndex(_ref2) {
      var index2 = _ref2.index;
      if (!this._indexMap[index2]) {
        this._indexMap[index2] = true;
        this._indices.push(index2);
      }
    }
    /** Get all cell indices that have been added to this section. */
  }, {
    key: "getCellIndices",
    value: function getCellIndices() {
      return this._indices;
    }
    /** Intended for debugger/test purposes only */
  }, {
    key: "toString",
    value: function toString4() {
      return "".concat(this.x, ",").concat(this.y, " ").concat(this.width, "x").concat(this.height);
    }
  }]);
}();
var SECTION_SIZE = 100;
var SectionManager = /* @__PURE__ */ function() {
  function SectionManager2() {
    var sectionSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : SECTION_SIZE;
    _classCallCheck$a(this, SectionManager2);
    this._sectionSize = sectionSize;
    this._cellMetadata = [];
    this._sections = {};
  }
  return _createClass$8(SectionManager2, [{
    key: "getCellIndices",
    value: function getCellIndices(_ref) {
      var height = _ref.height, width = _ref.width, x2 = _ref.x, y2 = _ref.y;
      var indices = {};
      this.getSections({
        height,
        width,
        x: x2,
        y: y2
      }).forEach(function(section) {
        return section.getCellIndices().forEach(function(index2) {
          indices[index2] = index2;
        });
      });
      return Object.keys(indices).map(function(index2) {
        return indices[index2];
      });
    }
    /** Get size and position information for the cell specified. */
  }, {
    key: "getCellMetadata",
    value: function getCellMetadata(_ref2) {
      var index2 = _ref2.index;
      return this._cellMetadata[index2];
    }
    /** Get all Sections overlapping the specified region. */
  }, {
    key: "getSections",
    value: function getSections(_ref3) {
      var height = _ref3.height, width = _ref3.width, x2 = _ref3.x, y2 = _ref3.y;
      var sectionXStart = Math.floor(x2 / this._sectionSize);
      var sectionXStop = Math.floor((x2 + width - 1) / this._sectionSize);
      var sectionYStart = Math.floor(y2 / this._sectionSize);
      var sectionYStop = Math.floor((y2 + height - 1) / this._sectionSize);
      var sections = [];
      for (var sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) {
        for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) {
          var key = "".concat(sectionX, ".").concat(sectionY);
          if (!this._sections[key]) {
            this._sections[key] = new Section({
              height: this._sectionSize,
              width: this._sectionSize,
              x: sectionX * this._sectionSize,
              y: sectionY * this._sectionSize
            });
          }
          sections.push(this._sections[key]);
        }
      }
      return sections;
    }
    /** Total number of Sections based on the currently registered cells. */
  }, {
    key: "getTotalSectionCount",
    value: function getTotalSectionCount() {
      return Object.keys(this._sections).length;
    }
    /** Intended for debugger/test purposes only */
  }, {
    key: "toString",
    value: function toString4() {
      var _this = this;
      return Object.keys(this._sections).map(function(index2) {
        return _this._sections[index2].toString();
      });
    }
    /** Adds a cell to the appropriate Sections and registers it metadata for later retrievable. */
  }, {
    key: "registerCell",
    value: function registerCell(_ref4) {
      var cellMetadatum = _ref4.cellMetadatum, index2 = _ref4.index;
      this._cellMetadata[index2] = cellMetadatum;
      this.getSections(cellMetadatum).forEach(function(section) {
        return section.addCellIndex({
          index: index2
        });
      });
    }
  }]);
}();
function calculateSizeAndPositionData(_ref) {
  var cellCount = _ref.cellCount, cellSizeAndPositionGetter = _ref.cellSizeAndPositionGetter, sectionSize = _ref.sectionSize;
  var cellMetadata = [];
  var sectionManager = new SectionManager(sectionSize);
  var height = 0;
  var width = 0;
  for (var index2 = 0; index2 < cellCount; index2++) {
    var cellMetadatum = cellSizeAndPositionGetter({
      index: index2
    });
    if (cellMetadatum.height == null || isNaN(cellMetadatum.height) || cellMetadatum.width == null || isNaN(cellMetadatum.width) || cellMetadatum.x == null || isNaN(cellMetadatum.x) || cellMetadatum.y == null || isNaN(cellMetadatum.y)) {
      throw Error("Invalid metadata returned for cell ".concat(index2, ":\n        x:").concat(cellMetadatum.x, ", y:").concat(cellMetadatum.y, ", width:").concat(cellMetadatum.width, ", height:").concat(cellMetadatum.height));
    }
    height = Math.max(height, cellMetadatum.y + cellMetadatum.height);
    width = Math.max(width, cellMetadatum.x + cellMetadatum.width);
    cellMetadata[index2] = cellMetadatum;
    sectionManager.registerCell({
      cellMetadatum,
      index: index2
    });
  }
  return {
    cellMetadata,
    height,
    sectionManager,
    width
  };
}
function getUpdatedOffsetForIndex(_ref) {
  var _ref$align = _ref.align, align = _ref$align === void 0 ? "auto" : _ref$align, cellOffset = _ref.cellOffset, cellSize = _ref.cellSize, containerSize = _ref.containerSize, currentOffset = _ref.currentOffset;
  var maxOffset = cellOffset;
  var minOffset = maxOffset - containerSize + cellSize;
  switch (align) {
    case "start":
      return maxOffset;
    case "end":
      return minOffset;
    case "center":
      return maxOffset - (containerSize - cellSize) / 2;
    default:
      return Math.max(minOffset, Math.min(maxOffset, currentOffset));
  }
}
function _callSuper$a(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$a() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$a() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$a = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Collection$1 = /* @__PURE__ */ function(_React$PureComponent) {
  function Collection2(props, context) {
    var _this;
    _classCallCheck$a(this, Collection2);
    _this = _callSuper$a(this, Collection2, [props, context]);
    _this._cellMetadata = [];
    _this._lastRenderedCellIndices = [];
    _this._cellCache = [];
    _this._isScrollingChange = _this._isScrollingChange.bind(_this);
    _this._setCollectionViewRef = _this._setCollectionViewRef.bind(_this);
    return _this;
  }
  _inherits$a(Collection2, _React$PureComponent);
  return _createClass$8(Collection2, [{
    key: "forceUpdate",
    value: function forceUpdate() {
      if (this._collectionView !== void 0) {
        this._collectionView.forceUpdate();
      }
    }
    /** See Collection#recomputeCellSizesAndPositions */
  }, {
    key: "recomputeCellSizesAndPositions",
    value: function recomputeCellSizesAndPositions() {
      this._cellCache = [];
      this._collectionView.recomputeCellSizesAndPositions();
    }
    /** React lifecycle methods */
  }, {
    key: "render",
    value: function render3() {
      var props = _extends({}, (_objectDestructuringEmpty(this.props), this.props));
      return /* @__PURE__ */ reactExports.createElement(CollectionView, _extends({
        cellLayoutManager: this,
        isScrollingChange: this._isScrollingChange,
        ref: this._setCollectionViewRef
      }, props));
    }
    /** CellLayoutManager interface */
  }, {
    key: "calculateSizeAndPositionData",
    value: function calculateSizeAndPositionData$1() {
      var _this$props = this.props, cellCount = _this$props.cellCount, cellSizeAndPositionGetter = _this$props.cellSizeAndPositionGetter, sectionSize = _this$props.sectionSize;
      var data = calculateSizeAndPositionData({
        cellCount,
        cellSizeAndPositionGetter,
        sectionSize
      });
      this._cellMetadata = data.cellMetadata;
      this._sectionManager = data.sectionManager;
      this._height = data.height;
      this._width = data.width;
    }
    /**
     * Returns the most recently rendered set of cell indices.
     */
  }, {
    key: "getLastRenderedIndices",
    value: function getLastRenderedIndices() {
      return this._lastRenderedCellIndices;
    }
    /**
     * Calculates the minimum amount of change from the current scroll position to ensure the specified cell is (fully) visible.
     */
  }, {
    key: "getScrollPositionForCell",
    value: function getScrollPositionForCell(_ref) {
      var align = _ref.align, cellIndex = _ref.cellIndex, height = _ref.height, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, width = _ref.width;
      var cellCount = this.props.cellCount;
      if (cellIndex >= 0 && cellIndex < cellCount) {
        var cellMetadata = this._cellMetadata[cellIndex];
        scrollLeft = getUpdatedOffsetForIndex({
          align,
          cellOffset: cellMetadata.x,
          cellSize: cellMetadata.width,
          containerSize: width,
          currentOffset: scrollLeft
        });
        scrollTop = getUpdatedOffsetForIndex({
          align,
          cellOffset: cellMetadata.y,
          cellSize: cellMetadata.height,
          containerSize: height,
          currentOffset: scrollTop
        });
      }
      return {
        scrollLeft,
        scrollTop
      };
    }
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      return {
        height: this._height,
        width: this._width
      };
    }
  }, {
    key: "cellRenderers",
    value: function cellRenderers(_ref2) {
      var _this2 = this;
      var height = _ref2.height, isScrolling = _ref2.isScrolling, width = _ref2.width, x2 = _ref2.x, y2 = _ref2.y;
      var _this$props2 = this.props, cellGroupRenderer = _this$props2.cellGroupRenderer, cellRenderer = _this$props2.cellRenderer;
      this._lastRenderedCellIndices = this._sectionManager.getCellIndices({
        height,
        width,
        x: x2,
        y: y2
      });
      return cellGroupRenderer({
        cellCache: this._cellCache,
        cellRenderer,
        cellSizeAndPositionGetter: function cellSizeAndPositionGetter(_ref3) {
          var index2 = _ref3.index;
          return _this2._sectionManager.getCellMetadata({
            index: index2
          });
        },
        indices: this._lastRenderedCellIndices,
        isScrolling
      });
    }
  }, {
    key: "_isScrollingChange",
    value: function _isScrollingChange(isScrolling) {
      if (!isScrolling) {
        this._cellCache = [];
      }
    }
  }, {
    key: "_setCollectionViewRef",
    value: function _setCollectionViewRef(ref) {
      this._collectionView = ref;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(Collection$1, "defaultProps", {
  "aria-label": "grid",
  cellGroupRenderer: defaultCellGroupRenderer
});
Collection$1.propTypes = {};
function defaultCellGroupRenderer(_ref4) {
  var cellCache = _ref4.cellCache, cellRenderer = _ref4.cellRenderer, cellSizeAndPositionGetter = _ref4.cellSizeAndPositionGetter, indices = _ref4.indices, isScrolling = _ref4.isScrolling;
  return indices.map(function(index2) {
    var cellMetadata = cellSizeAndPositionGetter({
      index: index2
    });
    var cellRendererProps = {
      index: index2,
      isScrolling,
      key: index2,
      style: {
        height: cellMetadata.height,
        left: cellMetadata.x,
        position: "absolute",
        top: cellMetadata.y,
        width: cellMetadata.width
      }
    };
    if (isScrolling) {
      if (!(index2 in cellCache)) {
        cellCache[index2] = cellRenderer(cellRendererProps);
      }
      return cellCache[index2];
    } else {
      return cellRenderer(cellRendererProps);
    }
  }).filter(function(renderedCell) {
    return !!renderedCell;
  });
}
function _callSuper$9(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$9() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$9() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$9 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ColumnSizer = /* @__PURE__ */ function(_React$PureComponent) {
  function ColumnSizer2(props, context) {
    var _this;
    _classCallCheck$a(this, ColumnSizer2);
    _this = _callSuper$9(this, ColumnSizer2, [props, context]);
    _this._registerChild = _this._registerChild.bind(_this);
    return _this;
  }
  _inherits$a(ColumnSizer2, _React$PureComponent);
  return _createClass$8(ColumnSizer2, [{
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps) {
      var _this$props = this.props, columnMaxWidth = _this$props.columnMaxWidth, columnMinWidth = _this$props.columnMinWidth, columnCount = _this$props.columnCount, width = _this$props.width;
      if (columnMaxWidth !== prevProps.columnMaxWidth || columnMinWidth !== prevProps.columnMinWidth || columnCount !== prevProps.columnCount || width !== prevProps.width) {
        if (this._registeredChild) {
          this._registeredChild.recomputeGridSize();
        }
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props2 = this.props, children = _this$props2.children, columnMaxWidth = _this$props2.columnMaxWidth, columnMinWidth = _this$props2.columnMinWidth, columnCount = _this$props2.columnCount, width = _this$props2.width;
      var safeColumnMinWidth = columnMinWidth || 1;
      var safeColumnMaxWidth = columnMaxWidth ? Math.min(columnMaxWidth, width) : width;
      var columnWidth = width / columnCount;
      columnWidth = Math.max(safeColumnMinWidth, columnWidth);
      columnWidth = Math.min(safeColumnMaxWidth, columnWidth);
      columnWidth = Math.floor(columnWidth);
      var adjustedWidth = Math.min(width, columnWidth * columnCount);
      return children({
        adjustedWidth,
        columnWidth,
        getColumnWidth: function getColumnWidth() {
          return columnWidth;
        },
        registerChild: this._registerChild
      });
    }
  }, {
    key: "_registerChild",
    value: function _registerChild(child) {
      if (child && typeof child.recomputeGridSize !== "function") {
        throw Error("Unexpected child type registered; only Grid/MultiGrid children are supported.");
      }
      this._registeredChild = child;
      if (this._registeredChild) {
        this._registeredChild.recomputeGridSize();
      }
    }
  }]);
}(reactExports.PureComponent);
ColumnSizer.propTypes = {};
function calculateSizeAndPositionDataAndUpdateScrollOffset(_ref) {
  var cellCount = _ref.cellCount, cellSize = _ref.cellSize, computeMetadataCallback = _ref.computeMetadataCallback, computeMetadataCallbackProps = _ref.computeMetadataCallbackProps, nextCellsCount = _ref.nextCellsCount, nextCellSize = _ref.nextCellSize, nextScrollToIndex = _ref.nextScrollToIndex, scrollToIndex = _ref.scrollToIndex, updateScrollOffsetForScrollToIndex = _ref.updateScrollOffsetForScrollToIndex;
  if (cellCount !== nextCellsCount || (typeof cellSize === "number" || typeof nextCellSize === "number") && cellSize !== nextCellSize) {
    computeMetadataCallback(computeMetadataCallbackProps);
    if (scrollToIndex >= 0 && scrollToIndex === nextScrollToIndex) {
      updateScrollOffsetForScrollToIndex();
    }
  }
}
var CellSizeAndPositionManager = /* @__PURE__ */ function() {
  function CellSizeAndPositionManager2(_ref) {
    var cellCount = _ref.cellCount, cellSizeGetter = _ref.cellSizeGetter, estimatedCellSize = _ref.estimatedCellSize;
    _classCallCheck$a(this, CellSizeAndPositionManager2);
    _defineProperty$4(this, "_cellSizeAndPositionData", {});
    _defineProperty$4(this, "_lastMeasuredIndex", -1);
    _defineProperty$4(this, "_lastBatchedIndex", -1);
    _defineProperty$4(this, "_cellCount", void 0);
    _defineProperty$4(this, "_cellSizeGetter", void 0);
    _defineProperty$4(this, "_estimatedCellSize", void 0);
    this._cellSizeGetter = cellSizeGetter;
    this._cellCount = cellCount;
    this._estimatedCellSize = estimatedCellSize;
  }
  return _createClass$8(CellSizeAndPositionManager2, [{
    key: "areOffsetsAdjusted",
    value: function areOffsetsAdjusted() {
      return false;
    }
  }, {
    key: "configure",
    value: function configure2(_ref2) {
      var cellCount = _ref2.cellCount, estimatedCellSize = _ref2.estimatedCellSize, cellSizeGetter = _ref2.cellSizeGetter;
      this._cellCount = cellCount;
      this._estimatedCellSize = estimatedCellSize;
      this._cellSizeGetter = cellSizeGetter;
    }
  }, {
    key: "getCellCount",
    value: function getCellCount() {
      return this._cellCount;
    }
  }, {
    key: "getEstimatedCellSize",
    value: function getEstimatedCellSize() {
      return this._estimatedCellSize;
    }
  }, {
    key: "getLastMeasuredIndex",
    value: function getLastMeasuredIndex() {
      return this._lastMeasuredIndex;
    }
  }, {
    key: "getOffsetAdjustment",
    value: function getOffsetAdjustment() {
      return 0;
    }
    /**
     * This method returns the size and position for the cell at the specified index.
     * It just-in-time calculates (or used cached values) for cells leading up to the index.
     */
  }, {
    key: "getSizeAndPositionOfCell",
    value: function getSizeAndPositionOfCell(index2) {
      if (index2 < 0 || index2 >= this._cellCount) {
        throw Error("Requested index ".concat(index2, " is outside of range 0..").concat(this._cellCount));
      }
      if (index2 > this._lastMeasuredIndex) {
        var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
        var offset2 = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size;
        for (var i2 = this._lastMeasuredIndex + 1; i2 <= index2; i2++) {
          var size2 = this._cellSizeGetter({
            index: i2
          });
          if (size2 === void 0 || isNaN(size2)) {
            throw Error("Invalid size returned for cell ".concat(i2, " of value ").concat(size2));
          } else if (size2 === null) {
            this._cellSizeAndPositionData[i2] = {
              offset: offset2,
              size: 0
            };
            this._lastBatchedIndex = index2;
          } else {
            this._cellSizeAndPositionData[i2] = {
              offset: offset2,
              size: size2
            };
            offset2 += size2;
            this._lastMeasuredIndex = index2;
          }
        }
      }
      return this._cellSizeAndPositionData[index2];
    }
  }, {
    key: "getSizeAndPositionOfLastMeasuredCell",
    value: function getSizeAndPositionOfLastMeasuredCell() {
      return this._lastMeasuredIndex >= 0 ? this._cellSizeAndPositionData[this._lastMeasuredIndex] : {
        offset: 0,
        size: 0
      };
    }
    /**
     * Total size of all cells being measured.
     * This value will be completely estimated initially.
     * As cells are measured, the estimate will be updated.
     */
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
      var totalSizeOfMeasuredCells = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size;
      var numUnmeasuredCells = this._cellCount - this._lastMeasuredIndex - 1;
      var totalSizeOfUnmeasuredCells = numUnmeasuredCells * this._estimatedCellSize;
      return totalSizeOfMeasuredCells + totalSizeOfUnmeasuredCells;
    }
    /**
     * Determines a new offset that ensures a certain cell is visible, given the current offset.
     * If the cell is already visible then the current offset will be returned.
     * If the current offset is too great or small, it will be adjusted just enough to ensure the specified index is visible.
     *
     * @param align Desired alignment within container; one of "auto" (default), "start", or "end"
     * @param containerSize Size (width or height) of the container viewport
     * @param currentOffset Container's current (x or y) offset
     * @param totalSize Total size (width or height) of all cells
     * @return Offset to use to ensure the specified cell is visible
     */
  }, {
    key: "getUpdatedOffsetForIndex",
    value: function getUpdatedOffsetForIndex2(_ref3) {
      var _ref3$align = _ref3.align, align = _ref3$align === void 0 ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset, targetIndex = _ref3.targetIndex;
      if (containerSize <= 0) {
        return 0;
      }
      var datum = this.getSizeAndPositionOfCell(targetIndex);
      var maxOffset = datum.offset;
      var minOffset = maxOffset - containerSize + datum.size;
      var idealOffset;
      switch (align) {
        case "start":
          idealOffset = maxOffset;
          break;
        case "end":
          idealOffset = minOffset;
          break;
        case "center":
          idealOffset = maxOffset - (containerSize - datum.size) / 2;
          break;
        default:
          idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset));
          break;
      }
      var totalSize = this.getTotalSize();
      return Math.max(0, Math.min(totalSize - containerSize, idealOffset));
    }
  }, {
    key: "getVisibleCellRange",
    value: function getVisibleCellRange(params) {
      var containerSize = params.containerSize, offset2 = params.offset;
      var totalSize = this.getTotalSize();
      if (totalSize === 0) {
        return {};
      }
      var maxOffset = offset2 + containerSize;
      var start = this._findNearestCell(offset2);
      var datum = this.getSizeAndPositionOfCell(start);
      offset2 = datum.offset + datum.size;
      var stop = start;
      while (offset2 < maxOffset && stop < this._cellCount - 1) {
        stop++;
        offset2 += this.getSizeAndPositionOfCell(stop).size;
      }
      return {
        start,
        stop
      };
    }
    /**
     * Clear all cached values for cells after the specified index.
     * This method should be called for any cell that has changed its size.
     * It will not immediately perform any calculations; they'll be performed the next time getSizeAndPositionOfCell() is called.
     */
  }, {
    key: "resetCell",
    value: function resetCell(index2) {
      this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index2 - 1);
    }
  }, {
    key: "_binarySearch",
    value: function _binarySearch(high, low, offset2) {
      while (low <= high) {
        var middle = low + Math.floor((high - low) / 2);
        var currentOffset = this.getSizeAndPositionOfCell(middle).offset;
        if (currentOffset === offset2) {
          return middle;
        } else if (currentOffset < offset2) {
          low = middle + 1;
        } else if (currentOffset > offset2) {
          high = middle - 1;
        }
      }
      if (low > 0) {
        return low - 1;
      } else {
        return 0;
      }
    }
  }, {
    key: "_exponentialSearch",
    value: function _exponentialSearch(index2, offset2) {
      var interval = 1;
      while (index2 < this._cellCount && this.getSizeAndPositionOfCell(index2).offset < offset2) {
        index2 += interval;
        interval *= 2;
      }
      return this._binarySearch(Math.min(index2, this._cellCount - 1), Math.floor(index2 / 2), offset2);
    }
    /**
     * Searches for the cell (index) nearest the specified offset.
     *
     * If no exact match is found the next lowest cell index will be returned.
     * This allows partially visible cells (with offsets just before/above the fold) to be visible.
     */
  }, {
    key: "_findNearestCell",
    value: function _findNearestCell(offset2) {
      if (isNaN(offset2)) {
        throw Error("Invalid offset ".concat(offset2, " specified"));
      }
      offset2 = Math.max(0, offset2);
      var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell();
      var lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex);
      if (lastMeasuredCellSizeAndPosition.offset >= offset2) {
        return this._binarySearch(lastMeasuredIndex, 0, offset2);
      } else {
        return this._exponentialSearch(lastMeasuredIndex, offset2);
      }
    }
  }]);
}();
var DEFAULT_MAX_ELEMENT_SIZE = 15e5;
var CHROME_MAX_ELEMENT_SIZE = 16777100;
var isBrowser = function isBrowser2() {
  return typeof window !== "undefined";
};
var isChrome = function isChrome2() {
  return !!window.chrome;
};
var getMaxElementSize = function getMaxElementSize2() {
  if (isBrowser()) {
    if (isChrome()) {
      return CHROME_MAX_ELEMENT_SIZE;
    }
  }
  return DEFAULT_MAX_ELEMENT_SIZE;
};
var _excluded$1 = ["maxScrollSize"];
var ScalingCellSizeAndPositionManager = /* @__PURE__ */ function() {
  function ScalingCellSizeAndPositionManager2(_ref) {
    var _ref$maxScrollSize = _ref.maxScrollSize, maxScrollSize = _ref$maxScrollSize === void 0 ? getMaxElementSize() : _ref$maxScrollSize, params = _objectWithoutProperties$3(_ref, _excluded$1);
    _classCallCheck$a(this, ScalingCellSizeAndPositionManager2);
    _defineProperty$4(this, "_cellSizeAndPositionManager", void 0);
    _defineProperty$4(this, "_maxScrollSize", void 0);
    this._cellSizeAndPositionManager = new CellSizeAndPositionManager(params);
    this._maxScrollSize = maxScrollSize;
  }
  return _createClass$8(ScalingCellSizeAndPositionManager2, [{
    key: "areOffsetsAdjusted",
    value: function areOffsetsAdjusted() {
      return this._cellSizeAndPositionManager.getTotalSize() > this._maxScrollSize;
    }
  }, {
    key: "configure",
    value: function configure2(params) {
      this._cellSizeAndPositionManager.configure(params);
    }
  }, {
    key: "getCellCount",
    value: function getCellCount() {
      return this._cellSizeAndPositionManager.getCellCount();
    }
  }, {
    key: "getEstimatedCellSize",
    value: function getEstimatedCellSize() {
      return this._cellSizeAndPositionManager.getEstimatedCellSize();
    }
  }, {
    key: "getLastMeasuredIndex",
    value: function getLastMeasuredIndex() {
      return this._cellSizeAndPositionManager.getLastMeasuredIndex();
    }
    /**
     * Number of pixels a cell at the given position (offset) should be shifted in order to fit within the scaled container.
     * The offset passed to this function is scaled (safe) as well.
     */
  }, {
    key: "getOffsetAdjustment",
    value: function getOffsetAdjustment(_ref2) {
      var containerSize = _ref2.containerSize, offset2 = _ref2.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      var offsetPercentage = this._getOffsetPercentage({
        containerSize,
        offset: offset2,
        totalSize: safeTotalSize
      });
      return Math.round(offsetPercentage * (safeTotalSize - totalSize));
    }
  }, {
    key: "getSizeAndPositionOfCell",
    value: function getSizeAndPositionOfCell(index2) {
      return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index2);
    }
  }, {
    key: "getSizeAndPositionOfLastMeasuredCell",
    value: function getSizeAndPositionOfLastMeasuredCell() {
      return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell();
    }
    /** See CellSizeAndPositionManager#getTotalSize */
  }, {
    key: "getTotalSize",
    value: function getTotalSize() {
      return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize());
    }
    /** See CellSizeAndPositionManager#getUpdatedOffsetForIndex */
  }, {
    key: "getUpdatedOffsetForIndex",
    value: function getUpdatedOffsetForIndex2(_ref3) {
      var _ref3$align = _ref3.align, align = _ref3$align === void 0 ? "auto" : _ref3$align, containerSize = _ref3.containerSize, currentOffset = _ref3.currentOffset, targetIndex = _ref3.targetIndex;
      currentOffset = this._safeOffsetToOffset({
        containerSize,
        offset: currentOffset
      });
      var offset2 = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex({
        align,
        containerSize,
        currentOffset,
        targetIndex
      });
      return this._offsetToSafeOffset({
        containerSize,
        offset: offset2
      });
    }
    /** See CellSizeAndPositionManager#getVisibleCellRange */
  }, {
    key: "getVisibleCellRange",
    value: function getVisibleCellRange(_ref4) {
      var containerSize = _ref4.containerSize, offset2 = _ref4.offset;
      offset2 = this._safeOffsetToOffset({
        containerSize,
        offset: offset2
      });
      return this._cellSizeAndPositionManager.getVisibleCellRange({
        containerSize,
        offset: offset2
      });
    }
  }, {
    key: "resetCell",
    value: function resetCell(index2) {
      this._cellSizeAndPositionManager.resetCell(index2);
    }
  }, {
    key: "_getOffsetPercentage",
    value: function _getOffsetPercentage(_ref5) {
      var containerSize = _ref5.containerSize, offset2 = _ref5.offset, totalSize = _ref5.totalSize;
      return totalSize <= containerSize ? 0 : offset2 / (totalSize - containerSize);
    }
  }, {
    key: "_offsetToSafeOffset",
    value: function _offsetToSafeOffset(_ref6) {
      var containerSize = _ref6.containerSize, offset2 = _ref6.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      if (totalSize === safeTotalSize) {
        return offset2;
      } else {
        var offsetPercentage = this._getOffsetPercentage({
          containerSize,
          offset: offset2,
          totalSize
        });
        return Math.round(offsetPercentage * (safeTotalSize - containerSize));
      }
    }
  }, {
    key: "_safeOffsetToOffset",
    value: function _safeOffsetToOffset(_ref7) {
      var containerSize = _ref7.containerSize, offset2 = _ref7.offset;
      var totalSize = this._cellSizeAndPositionManager.getTotalSize();
      var safeTotalSize = this.getTotalSize();
      if (totalSize === safeTotalSize) {
        return offset2;
      } else {
        var offsetPercentage = this._getOffsetPercentage({
          containerSize,
          offset: offset2,
          totalSize: safeTotalSize
        });
        return Math.round(offsetPercentage * (totalSize - containerSize));
      }
    }
  }]);
}();
var SCROLL_DIRECTION_BACKWARD = -1;
var SCROLL_DIRECTION_FORWARD$1 = 1;
function defaultOverscanIndicesGetter$1(_ref) {
  var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
  if (scrollDirection === SCROLL_DIRECTION_FORWARD$1) {
    return {
      overscanStartIndex: Math.max(0, startIndex),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
    };
  } else {
    return {
      overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex)
    };
  }
}
function updateScrollIndexHelper(_ref) {
  var cellSize = _ref.cellSize, cellSizeAndPositionManager = _ref.cellSizeAndPositionManager, previousCellsCount = _ref.previousCellsCount, previousCellSize = _ref.previousCellSize, previousScrollToAlignment = _ref.previousScrollToAlignment, previousScrollToIndex = _ref.previousScrollToIndex, previousSize = _ref.previousSize, scrollOffset = _ref.scrollOffset, scrollToAlignment = _ref.scrollToAlignment, scrollToIndex = _ref.scrollToIndex, size2 = _ref.size, sizeJustIncreasedFromZero = _ref.sizeJustIncreasedFromZero, updateScrollIndexCallback = _ref.updateScrollIndexCallback;
  var cellCount = cellSizeAndPositionManager.getCellCount();
  var hasScrollToIndex = scrollToIndex >= 0 && scrollToIndex < cellCount;
  var sizeHasChanged = size2 !== previousSize || sizeJustIncreasedFromZero || !previousCellSize || typeof cellSize === "number" && cellSize !== previousCellSize;
  if (hasScrollToIndex && (sizeHasChanged || scrollToAlignment !== previousScrollToAlignment || scrollToIndex !== previousScrollToIndex)) {
    updateScrollIndexCallback(scrollToIndex);
  } else if (!hasScrollToIndex && cellCount > 0 && (size2 < previousSize || cellCount < previousCellsCount)) {
    if (scrollOffset > cellSizeAndPositionManager.getTotalSize() - size2) {
      updateScrollIndexCallback(cellCount - 1);
    }
  }
}
function defaultCellRangeRenderer(_ref) {
  var cellCache = _ref.cellCache, cellRenderer = _ref.cellRenderer, columnSizeAndPositionManager = _ref.columnSizeAndPositionManager, columnStartIndex = _ref.columnStartIndex, columnStopIndex = _ref.columnStopIndex, deferredMeasurementCache = _ref.deferredMeasurementCache, horizontalOffsetAdjustment = _ref.horizontalOffsetAdjustment, isScrolling = _ref.isScrolling, isScrollingOptOut = _ref.isScrollingOptOut, parent = _ref.parent, rowSizeAndPositionManager = _ref.rowSizeAndPositionManager, rowStartIndex = _ref.rowStartIndex, rowStopIndex = _ref.rowStopIndex, styleCache = _ref.styleCache, verticalOffsetAdjustment = _ref.verticalOffsetAdjustment, visibleColumnIndices = _ref.visibleColumnIndices, visibleRowIndices = _ref.visibleRowIndices;
  var renderedCells = [];
  var areOffsetsAdjusted = columnSizeAndPositionManager.areOffsetsAdjusted() || rowSizeAndPositionManager.areOffsetsAdjusted();
  var canCacheStyle = !isScrolling && !areOffsetsAdjusted;
  for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
    var rowDatum = rowSizeAndPositionManager.getSizeAndPositionOfCell(rowIndex);
    for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
      var columnDatum = columnSizeAndPositionManager.getSizeAndPositionOfCell(columnIndex);
      var isVisible2 = columnIndex >= visibleColumnIndices.start && columnIndex <= visibleColumnIndices.stop && rowIndex >= visibleRowIndices.start && rowIndex <= visibleRowIndices.stop;
      var key = "".concat(rowIndex, "-").concat(columnIndex);
      var style2 = void 0;
      if (canCacheStyle && styleCache[key]) {
        style2 = styleCache[key];
      } else {
        if (deferredMeasurementCache && !deferredMeasurementCache.has(rowIndex, columnIndex)) {
          style2 = {
            height: "auto",
            left: 0,
            position: "absolute",
            top: 0,
            width: "auto"
          };
        } else {
          style2 = {
            height: rowDatum.size,
            left: columnDatum.offset + horizontalOffsetAdjustment,
            position: "absolute",
            top: rowDatum.offset + verticalOffsetAdjustment,
            width: columnDatum.size
          };
          styleCache[key] = style2;
        }
      }
      var cellRendererParams = {
        columnIndex,
        isScrolling,
        isVisible: isVisible2,
        key,
        parent,
        rowIndex,
        style: style2
      };
      var renderedCell = void 0;
      if ((isScrollingOptOut || isScrolling) && !horizontalOffsetAdjustment && !verticalOffsetAdjustment) {
        if (!cellCache[key]) {
          cellCache[key] = cellRenderer(cellRendererParams);
        }
        renderedCell = cellCache[key];
      } else {
        renderedCell = cellRenderer(cellRendererParams);
      }
      if (renderedCell == null || renderedCell === false) {
        continue;
      }
      if (!renderedCell.props.role) {
        renderedCell = /* @__PURE__ */ React$6.cloneElement(renderedCell, {
          role: "gridcell"
        });
      }
      renderedCells.push(renderedCell);
    }
  }
  return renderedCells;
}
var win;
if (typeof window !== "undefined") {
  win = window;
} else if (typeof self !== "undefined") {
  win = self;
} else {
  win = {};
}
var request = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.oRequestAnimationFrame || win.msRequestAnimationFrame || function(callback2) {
  return win.setTimeout(callback2, 1e3 / 60);
};
var cancel = win.cancelAnimationFrame || win.webkitCancelAnimationFrame || win.mozCancelAnimationFrame || win.oCancelAnimationFrame || win.msCancelAnimationFrame || function(id2) {
  win.clearTimeout(id2);
};
var raf = request;
var caf = cancel;
var cancelAnimationTimeout = function cancelAnimationTimeout2(frame2) {
  return caf(frame2.id);
};
var requestAnimationTimeout = function requestAnimationTimeout2(callback2, delay2) {
  var start;
  Promise.resolve().then(function() {
    start = Date.now();
  });
  var _timeout = function timeout() {
    if (Date.now() - start >= delay2) {
      callback2.call();
    } else {
      frame2.id = raf(_timeout);
    }
  };
  var frame2 = {
    id: raf(_timeout)
  };
  return frame2;
};
function ownKeys$4(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$5(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$4(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$4(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$8(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$8() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$8() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$8 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var DEFAULT_SCROLLING_RESET_TIME_INTERVAL$1 = 150;
var SCROLL_POSITION_CHANGE_REASONS = {
  OBSERVED: "observed",
  REQUESTED: "requested"
};
var renderNull = function renderNull2() {
  return null;
};
var Grid = /* @__PURE__ */ function(_React$PureComponent) {
  function Grid2(props) {
    var _this;
    _classCallCheck$a(this, Grid2);
    _this = _callSuper$8(this, Grid2, [props]);
    _defineProperty$4(_this, "_onGridRenderedMemoizer", createCallbackMemoizer());
    _defineProperty$4(_this, "_onScrollMemoizer", createCallbackMemoizer(false));
    _defineProperty$4(_this, "_deferredInvalidateColumnIndex", null);
    _defineProperty$4(_this, "_deferredInvalidateRowIndex", null);
    _defineProperty$4(_this, "_recomputeScrollLeftFlag", false);
    _defineProperty$4(_this, "_recomputeScrollTopFlag", false);
    _defineProperty$4(_this, "_horizontalScrollBarSize", 0);
    _defineProperty$4(_this, "_verticalScrollBarSize", 0);
    _defineProperty$4(_this, "_scrollbarPresenceChanged", false);
    _defineProperty$4(_this, "_scrollingContainer", void 0);
    _defineProperty$4(_this, "_childrenToDisplay", void 0);
    _defineProperty$4(_this, "_columnStartIndex", void 0);
    _defineProperty$4(_this, "_columnStopIndex", void 0);
    _defineProperty$4(_this, "_rowStartIndex", void 0);
    _defineProperty$4(_this, "_rowStopIndex", void 0);
    _defineProperty$4(_this, "_renderedColumnStartIndex", 0);
    _defineProperty$4(_this, "_renderedColumnStopIndex", 0);
    _defineProperty$4(_this, "_renderedRowStartIndex", 0);
    _defineProperty$4(_this, "_renderedRowStopIndex", 0);
    _defineProperty$4(_this, "_initialScrollTop", void 0);
    _defineProperty$4(_this, "_initialScrollLeft", void 0);
    _defineProperty$4(_this, "_disablePointerEventsTimeoutId", void 0);
    _defineProperty$4(_this, "_styleCache", {});
    _defineProperty$4(_this, "_cellCache", {});
    _defineProperty$4(_this, "_debounceScrollEndedCallback", function() {
      _this._disablePointerEventsTimeoutId = null;
      _this.setState({
        isScrolling: false,
        needToResetStyleCache: false
      });
    });
    _defineProperty$4(_this, "_invokeOnGridRenderedHelper", function() {
      var onSectionRendered3 = _this.props.onSectionRendered;
      _this._onGridRenderedMemoizer({
        callback: onSectionRendered3,
        indices: {
          columnOverscanStartIndex: _this._columnStartIndex,
          columnOverscanStopIndex: _this._columnStopIndex,
          columnStartIndex: _this._renderedColumnStartIndex,
          columnStopIndex: _this._renderedColumnStopIndex,
          rowOverscanStartIndex: _this._rowStartIndex,
          rowOverscanStopIndex: _this._rowStopIndex,
          rowStartIndex: _this._renderedRowStartIndex,
          rowStopIndex: _this._renderedRowStopIndex
        }
      });
    });
    _defineProperty$4(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
      if (typeof _this.props.elementRef === "function") {
        _this.props.elementRef(ref);
      } else if (_typeof$2(_this.props.elementRef) === "object") {
        _this.props.elementRef.current = ref;
      }
    });
    _defineProperty$4(_this, "_onScroll", function(event) {
      if (event.target === _this._scrollingContainer) {
        _this.handleScrollEvent(event.target);
      }
    });
    var columnSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
      cellCount: props.columnCount,
      cellSizeGetter: function cellSizeGetter(params) {
        return Grid2._wrapSizeGetter(props.columnWidth)(params);
      },
      estimatedCellSize: Grid2._getEstimatedColumnSize(props)
    });
    var rowSizeAndPositionManager = new ScalingCellSizeAndPositionManager({
      cellCount: props.rowCount,
      cellSizeGetter: function cellSizeGetter(params) {
        return Grid2._wrapSizeGetter(props.rowHeight)(params);
      },
      estimatedCellSize: Grid2._getEstimatedRowSize(props)
    });
    _this.state = {
      instanceProps: {
        columnSizeAndPositionManager,
        rowSizeAndPositionManager,
        prevColumnWidth: props.columnWidth,
        prevRowHeight: props.rowHeight,
        prevColumnCount: props.columnCount,
        prevRowCount: props.rowCount,
        prevIsScrolling: props.isScrolling === true,
        prevScrollToColumn: props.scrollToColumn,
        prevScrollToRow: props.scrollToRow,
        scrollbarSize: 0,
        scrollbarSizeMeasured: false
      },
      isScrolling: false,
      scrollDirectionHorizontal: SCROLL_DIRECTION_FORWARD$1,
      scrollDirectionVertical: SCROLL_DIRECTION_FORWARD$1,
      scrollLeft: 0,
      scrollTop: 0,
      scrollPositionChangeReason: null,
      needToResetStyleCache: false
    };
    if (props.scrollToRow > 0) {
      _this._initialScrollTop = _this._getCalculatedScrollTop(props, _this.state);
    }
    if (props.scrollToColumn > 0) {
      _this._initialScrollLeft = _this._getCalculatedScrollLeft(props, _this.state);
    }
    return _this;
  }
  _inherits$a(Grid2, _React$PureComponent);
  return _createClass$8(Grid2, [{
    key: "getOffsetForCell",
    value: function getOffsetForCell() {
      var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$alignment = _ref.alignment, alignment = _ref$alignment === void 0 ? this.props.scrollToAlignment : _ref$alignment, _ref$columnIndex = _ref.columnIndex, columnIndex = _ref$columnIndex === void 0 ? this.props.scrollToColumn : _ref$columnIndex, _ref$rowIndex = _ref.rowIndex, rowIndex = _ref$rowIndex === void 0 ? this.props.scrollToRow : _ref$rowIndex;
      var offsetProps = _objectSpread$5(_objectSpread$5({}, this.props), {}, {
        scrollToAlignment: alignment,
        scrollToColumn: columnIndex,
        scrollToRow: rowIndex
      });
      return {
        scrollLeft: this._getCalculatedScrollLeft(offsetProps),
        scrollTop: this._getCalculatedScrollTop(offsetProps)
      };
    }
    /**
     * Gets estimated total rows' height.
     */
  }, {
    key: "getTotalRowsHeight",
    value: function getTotalRowsHeight() {
      return this.state.instanceProps.rowSizeAndPositionManager.getTotalSize();
    }
    /**
     * Gets estimated total columns' width.
     */
  }, {
    key: "getTotalColumnsWidth",
    value: function getTotalColumnsWidth() {
      return this.state.instanceProps.columnSizeAndPositionManager.getTotalSize();
    }
    /**
     * This method handles a scroll event originating from an external scroll control.
     * It's an advanced method and should probably not be used unless you're implementing a custom scroll-bar solution.
     */
  }, {
    key: "handleScrollEvent",
    value: function handleScrollEvent(_ref2) {
      var _ref2$scrollLeft = _ref2.scrollLeft, scrollLeftParam = _ref2$scrollLeft === void 0 ? 0 : _ref2$scrollLeft, _ref2$scrollTop = _ref2.scrollTop, scrollTopParam = _ref2$scrollTop === void 0 ? 0 : _ref2$scrollTop;
      if (scrollTopParam < 0) {
        return;
      }
      this._debounceScrollEnded();
      var _this$props = this.props, autoHeight = _this$props.autoHeight, autoWidth = _this$props.autoWidth, height = _this$props.height, width = _this$props.width;
      var instanceProps = this.state.instanceProps;
      var scrollbarSize2 = instanceProps.scrollbarSize;
      var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
      var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
      var scrollLeft = Math.min(Math.max(0, totalColumnsWidth - width + scrollbarSize2), scrollLeftParam);
      var scrollTop = Math.min(Math.max(0, totalRowsHeight - height + scrollbarSize2), scrollTopParam);
      if (this.state.scrollLeft !== scrollLeft || this.state.scrollTop !== scrollTop) {
        var scrollDirectionHorizontal = scrollLeft !== this.state.scrollLeft ? scrollLeft > this.state.scrollLeft ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD : this.state.scrollDirectionHorizontal;
        var scrollDirectionVertical = scrollTop !== this.state.scrollTop ? scrollTop > this.state.scrollTop ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD : this.state.scrollDirectionVertical;
        var newState = {
          isScrolling: true,
          scrollDirectionHorizontal,
          scrollDirectionVertical,
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.OBSERVED
        };
        if (!autoHeight) {
          newState.scrollTop = scrollTop;
        }
        if (!autoWidth) {
          newState.scrollLeft = scrollLeft;
        }
        newState.needToResetStyleCache = false;
        this.setState(newState);
      }
      this._invokeOnScrollMemoizer({
        scrollLeft,
        scrollTop,
        totalColumnsWidth,
        totalRowsHeight
      });
    }
    /**
     * Invalidate Grid size and recompute visible cells.
     * This is a deferred wrapper for recomputeGridSize().
     * It sets a flag to be evaluated on cDM/cDU to avoid unnecessary renders.
     * This method is intended for advanced use-cases like CellMeasurer.
     */
    // @TODO (bvaughn) Add automated test coverage for this.
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref3) {
      var columnIndex = _ref3.columnIndex, rowIndex = _ref3.rowIndex;
      this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === "number" ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;
      this._deferredInvalidateRowIndex = typeof this._deferredInvalidateRowIndex === "number" ? Math.min(this._deferredInvalidateRowIndex, rowIndex) : rowIndex;
    }
    /**
     * Pre-measure all columns and rows in a Grid.
     * Typically cells are only measured as needed and estimated sizes are used for cells that have not yet been measured.
     * This method ensures that the next call to getTotalSize() returns an exact size (as opposed to just an estimated one).
     */
  }, {
    key: "measureAllCells",
    value: function measureAllCells() {
      var _this$props2 = this.props, columnCount = _this$props2.columnCount, rowCount = _this$props2.rowCount;
      var instanceProps = this.state.instanceProps;
      instanceProps.columnSizeAndPositionManager.getSizeAndPositionOfCell(columnCount - 1);
      instanceProps.rowSizeAndPositionManager.getSizeAndPositionOfCell(rowCount - 1);
    }
    /**
     * Forced recompute of row heights and column widths.
     * This function should be called if dynamic column or row sizes have changed but nothing else has.
     * Since Grid only receives :columnCount and :rowCount it has no way of detecting when the underlying data changes.
     */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref4 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref4$columnIndex = _ref4.columnIndex, columnIndex = _ref4$columnIndex === void 0 ? 0 : _ref4$columnIndex, _ref4$rowIndex = _ref4.rowIndex, rowIndex = _ref4$rowIndex === void 0 ? 0 : _ref4$rowIndex;
      var _this$props3 = this.props, scrollToColumn = _this$props3.scrollToColumn, scrollToRow = _this$props3.scrollToRow;
      var instanceProps = this.state.instanceProps;
      instanceProps.columnSizeAndPositionManager.resetCell(columnIndex);
      instanceProps.rowSizeAndPositionManager.resetCell(rowIndex);
      this._recomputeScrollLeftFlag = scrollToColumn >= 0 && (this.state.scrollDirectionHorizontal === SCROLL_DIRECTION_FORWARD$1 ? columnIndex <= scrollToColumn : columnIndex >= scrollToColumn);
      this._recomputeScrollTopFlag = scrollToRow >= 0 && (this.state.scrollDirectionVertical === SCROLL_DIRECTION_FORWARD$1 ? rowIndex <= scrollToRow : rowIndex >= scrollToRow);
      this._styleCache = {};
      this._cellCache = {};
      this.forceUpdate();
    }
    /**
     * Ensure column and row are visible.
     */
  }, {
    key: "scrollToCell",
    value: function scrollToCell(_ref5) {
      var columnIndex = _ref5.columnIndex, rowIndex = _ref5.rowIndex;
      var columnCount = this.props.columnCount;
      var props = this.props;
      if (columnCount > 1 && columnIndex !== void 0) {
        this._updateScrollLeftForScrollToColumn(_objectSpread$5(_objectSpread$5({}, props), {}, {
          scrollToColumn: columnIndex
        }));
      }
      if (rowIndex !== void 0) {
        this._updateScrollTopForScrollToRow(_objectSpread$5(_objectSpread$5({}, props), {}, {
          scrollToRow: rowIndex
        }));
      }
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props4 = this.props, getScrollbarSize = _this$props4.getScrollbarSize, height = _this$props4.height, scrollLeft = _this$props4.scrollLeft, scrollToColumn = _this$props4.scrollToColumn, scrollTop = _this$props4.scrollTop, scrollToRow = _this$props4.scrollToRow, width = _this$props4.width;
      var instanceProps = this.state.instanceProps;
      this._initialScrollTop = 0;
      this._initialScrollLeft = 0;
      this._handleInvalidatedGridSize();
      if (!instanceProps.scrollbarSizeMeasured) {
        this.setState(function(prevState) {
          var stateUpdate2 = _objectSpread$5(_objectSpread$5({}, prevState), {}, {
            needToResetStyleCache: false
          });
          stateUpdate2.instanceProps.scrollbarSize = getScrollbarSize();
          stateUpdate2.instanceProps.scrollbarSizeMeasured = true;
          return stateUpdate2;
        });
      }
      if (typeof scrollLeft === "number" && scrollLeft >= 0 || typeof scrollTop === "number" && scrollTop >= 0) {
        var stateUpdate = Grid2._getScrollToPositionStateUpdate({
          prevState: this.state,
          scrollLeft,
          scrollTop
        });
        if (stateUpdate) {
          stateUpdate.needToResetStyleCache = false;
          this.setState(stateUpdate);
        }
      }
      if (this._scrollingContainer) {
        if (this._scrollingContainer.scrollLeft !== this.state.scrollLeft) {
          this._scrollingContainer.scrollLeft = this.state.scrollLeft;
        }
        if (this._scrollingContainer.scrollTop !== this.state.scrollTop) {
          this._scrollingContainer.scrollTop = this.state.scrollTop;
        }
      }
      var sizeIsBiggerThanZero = height > 0 && width > 0;
      if (scrollToColumn >= 0 && sizeIsBiggerThanZero) {
        this._updateScrollLeftForScrollToColumn();
      }
      if (scrollToRow >= 0 && sizeIsBiggerThanZero) {
        this._updateScrollTopForScrollToRow();
      }
      this._invokeOnGridRenderedHelper();
      this._invokeOnScrollMemoizer({
        scrollLeft: scrollLeft || 0,
        scrollTop: scrollTop || 0,
        totalColumnsWidth: instanceProps.columnSizeAndPositionManager.getTotalSize(),
        totalRowsHeight: instanceProps.rowSizeAndPositionManager.getTotalSize()
      });
      this._maybeCallOnScrollbarPresenceChange();
    }
    /**
     * @private
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) New scroll-to-cell props have been set
     */
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var _this2 = this;
      var _this$props5 = this.props, autoHeight = _this$props5.autoHeight, autoWidth = _this$props5.autoWidth, columnCount = _this$props5.columnCount, height = _this$props5.height, rowCount = _this$props5.rowCount, scrollToAlignment = _this$props5.scrollToAlignment, scrollToColumn = _this$props5.scrollToColumn, scrollToRow = _this$props5.scrollToRow, width = _this$props5.width;
      var _this$state = this.state, scrollLeft = _this$state.scrollLeft, scrollPositionChangeReason = _this$state.scrollPositionChangeReason, scrollTop = _this$state.scrollTop, instanceProps = _this$state.instanceProps;
      this._handleInvalidatedGridSize();
      var columnOrRowCountJustIncreasedFromZero = columnCount > 0 && prevProps.columnCount === 0 || rowCount > 0 && prevProps.rowCount === 0;
      if (scrollPositionChangeReason === SCROLL_POSITION_CHANGE_REASONS.REQUESTED) {
        if (!autoWidth && scrollLeft >= 0 && (scrollLeft !== this._scrollingContainer.scrollLeft || columnOrRowCountJustIncreasedFromZero)) {
          this._scrollingContainer.scrollLeft = scrollLeft;
        }
        if (!autoHeight && scrollTop >= 0 && (scrollTop !== this._scrollingContainer.scrollTop || columnOrRowCountJustIncreasedFromZero)) {
          this._scrollingContainer.scrollTop = scrollTop;
        }
      }
      var sizeJustIncreasedFromZero = (prevProps.width === 0 || prevProps.height === 0) && height > 0 && width > 0;
      if (this._recomputeScrollLeftFlag) {
        this._recomputeScrollLeftFlag = false;
        this._updateScrollLeftForScrollToColumn(this.props);
      } else {
        updateScrollIndexHelper({
          cellSizeAndPositionManager: instanceProps.columnSizeAndPositionManager,
          previousCellsCount: prevProps.columnCount,
          previousCellSize: prevProps.columnWidth,
          previousScrollToAlignment: prevProps.scrollToAlignment,
          previousScrollToIndex: prevProps.scrollToColumn,
          previousSize: prevProps.width,
          scrollOffset: scrollLeft,
          scrollToAlignment,
          scrollToIndex: scrollToColumn,
          size: width,
          sizeJustIncreasedFromZero,
          updateScrollIndexCallback: function updateScrollIndexCallback() {
            return _this2._updateScrollLeftForScrollToColumn(_this2.props);
          }
        });
      }
      if (this._recomputeScrollTopFlag) {
        this._recomputeScrollTopFlag = false;
        this._updateScrollTopForScrollToRow(this.props);
      } else {
        updateScrollIndexHelper({
          cellSizeAndPositionManager: instanceProps.rowSizeAndPositionManager,
          previousCellsCount: prevProps.rowCount,
          previousCellSize: prevProps.rowHeight,
          previousScrollToAlignment: prevProps.scrollToAlignment,
          previousScrollToIndex: prevProps.scrollToRow,
          previousSize: prevProps.height,
          scrollOffset: scrollTop,
          scrollToAlignment,
          scrollToIndex: scrollToRow,
          size: height,
          sizeJustIncreasedFromZero,
          updateScrollIndexCallback: function updateScrollIndexCallback() {
            return _this2._updateScrollTopForScrollToRow(_this2.props);
          }
        });
      }
      this._invokeOnGridRenderedHelper();
      if (scrollLeft !== prevState.scrollLeft || scrollTop !== prevState.scrollTop) {
        var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
        var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
        this._invokeOnScrollMemoizer({
          scrollLeft,
          scrollTop,
          totalColumnsWidth,
          totalRowsHeight
        });
      }
      this._maybeCallOnScrollbarPresenceChange();
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._disablePointerEventsTimeoutId) {
        cancelAnimationTimeout(this._disablePointerEventsTimeoutId);
      }
    }
    /**
     * This method updates scrollLeft/scrollTop in state for the following conditions:
     * 1) Empty content (0 rows or columns)
     * 2) New scroll props overriding the current state
     * 3) Cells-count or cells-size has changed, making previous scroll offsets invalid
     */
  }, {
    key: "render",
    value: function render3() {
      var _this$props6 = this.props, autoContainerWidth = _this$props6.autoContainerWidth, autoHeight = _this$props6.autoHeight, autoWidth = _this$props6.autoWidth, className = _this$props6.className, containerProps = _this$props6.containerProps, containerRole = _this$props6.containerRole, containerStyle = _this$props6.containerStyle, height = _this$props6.height, id2 = _this$props6.id, noContentRenderer2 = _this$props6.noContentRenderer, role = _this$props6.role, style2 = _this$props6.style, tabIndex = _this$props6.tabIndex, width = _this$props6.width;
      var _this$state2 = this.state, instanceProps = _this$state2.instanceProps, needToResetStyleCache = _this$state2.needToResetStyleCache;
      var isScrolling = this._isScrolling();
      var gridStyle = {
        boxSizing: "border-box",
        direction: "ltr",
        height: autoHeight ? "auto" : height,
        position: "relative",
        width: autoWidth ? "auto" : width,
        WebkitOverflowScrolling: "touch",
        willChange: "transform"
      };
      if (needToResetStyleCache) {
        this._styleCache = {};
      }
      if (!this.state.isScrolling) {
        this._resetStyleCache();
      }
      this._calculateChildrenToRender(this.props, this.state);
      var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
      var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
      var verticalScrollBarSize = totalRowsHeight > height ? instanceProps.scrollbarSize : 0;
      var horizontalScrollBarSize = totalColumnsWidth > width ? instanceProps.scrollbarSize : 0;
      if (horizontalScrollBarSize !== this._horizontalScrollBarSize || verticalScrollBarSize !== this._verticalScrollBarSize) {
        this._horizontalScrollBarSize = horizontalScrollBarSize;
        this._verticalScrollBarSize = verticalScrollBarSize;
        this._scrollbarPresenceChanged = true;
      }
      gridStyle.overflowX = totalColumnsWidth + verticalScrollBarSize <= width ? "hidden" : "auto";
      gridStyle.overflowY = totalRowsHeight + horizontalScrollBarSize <= height ? "hidden" : "auto";
      var childrenToDisplay = this._childrenToDisplay;
      var showNoContentRenderer = childrenToDisplay.length === 0 && height > 0 && width > 0;
      return /* @__PURE__ */ reactExports.createElement("div", _extends({
        ref: this._setScrollingContainerRef
      }, containerProps, {
        "aria-label": this.props["aria-label"],
        "aria-readonly": this.props["aria-readonly"],
        className: clsx("ReactVirtualized__Grid", className),
        id: id2,
        onScroll: this._onScroll,
        role,
        style: _objectSpread$5(_objectSpread$5({}, gridStyle), style2),
        tabIndex
      }), childrenToDisplay.length > 0 && /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Grid__innerScrollContainer",
        role: containerRole,
        style: _objectSpread$5({
          width: autoContainerWidth ? "auto" : totalColumnsWidth,
          height: totalRowsHeight,
          maxWidth: totalColumnsWidth,
          maxHeight: totalRowsHeight,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          position: "relative"
        }, containerStyle)
      }, childrenToDisplay), showNoContentRenderer && noContentRenderer2());
    }
    /* ---------------------------- Helper methods ---------------------------- */
  }, {
    key: "_calculateChildrenToRender",
    value: function _calculateChildrenToRender() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var cellRenderer = props.cellRenderer, cellRangeRenderer = props.cellRangeRenderer, columnCount = props.columnCount, deferredMeasurementCache = props.deferredMeasurementCache, height = props.height, overscanColumnCount = props.overscanColumnCount, overscanIndicesGetter = props.overscanIndicesGetter, overscanRowCount = props.overscanRowCount, rowCount = props.rowCount, width = props.width, isScrollingOptOut = props.isScrollingOptOut;
      var scrollDirectionHorizontal = state.scrollDirectionHorizontal, scrollDirectionVertical = state.scrollDirectionVertical, instanceProps = state.instanceProps;
      var scrollTop = this._initialScrollTop > 0 ? this._initialScrollTop : state.scrollTop;
      var scrollLeft = this._initialScrollLeft > 0 ? this._initialScrollLeft : state.scrollLeft;
      var isScrolling = this._isScrolling(props, state);
      this._childrenToDisplay = [];
      if (height > 0 && width > 0) {
        var visibleColumnIndices = instanceProps.columnSizeAndPositionManager.getVisibleCellRange({
          containerSize: width,
          offset: scrollLeft
        });
        var visibleRowIndices = instanceProps.rowSizeAndPositionManager.getVisibleCellRange({
          containerSize: height,
          offset: scrollTop
        });
        var horizontalOffsetAdjustment = instanceProps.columnSizeAndPositionManager.getOffsetAdjustment({
          containerSize: width,
          offset: scrollLeft
        });
        var verticalOffsetAdjustment = instanceProps.rowSizeAndPositionManager.getOffsetAdjustment({
          containerSize: height,
          offset: scrollTop
        });
        this._renderedColumnStartIndex = visibleColumnIndices.start;
        this._renderedColumnStopIndex = visibleColumnIndices.stop;
        this._renderedRowStartIndex = visibleRowIndices.start;
        this._renderedRowStopIndex = visibleRowIndices.stop;
        var overscanColumnIndices = overscanIndicesGetter({
          direction: "horizontal",
          cellCount: columnCount,
          overscanCellsCount: overscanColumnCount,
          scrollDirection: scrollDirectionHorizontal,
          startIndex: typeof visibleColumnIndices.start === "number" ? visibleColumnIndices.start : 0,
          stopIndex: typeof visibleColumnIndices.stop === "number" ? visibleColumnIndices.stop : -1
        });
        var overscanRowIndices = overscanIndicesGetter({
          direction: "vertical",
          cellCount: rowCount,
          overscanCellsCount: overscanRowCount,
          scrollDirection: scrollDirectionVertical,
          startIndex: typeof visibleRowIndices.start === "number" ? visibleRowIndices.start : 0,
          stopIndex: typeof visibleRowIndices.stop === "number" ? visibleRowIndices.stop : -1
        });
        var columnStartIndex = overscanColumnIndices.overscanStartIndex;
        var columnStopIndex = overscanColumnIndices.overscanStopIndex;
        var rowStartIndex = overscanRowIndices.overscanStartIndex;
        var rowStopIndex = overscanRowIndices.overscanStopIndex;
        if (deferredMeasurementCache) {
          if (!deferredMeasurementCache.hasFixedHeight()) {
            for (var rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
              if (!deferredMeasurementCache.has(rowIndex, 0)) {
                columnStartIndex = 0;
                columnStopIndex = columnCount - 1;
                break;
              }
            }
          }
          if (!deferredMeasurementCache.hasFixedWidth()) {
            for (var columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
              if (!deferredMeasurementCache.has(0, columnIndex)) {
                rowStartIndex = 0;
                rowStopIndex = rowCount - 1;
                break;
              }
            }
          }
        }
        this._childrenToDisplay = cellRangeRenderer({
          cellCache: this._cellCache,
          cellRenderer,
          columnSizeAndPositionManager: instanceProps.columnSizeAndPositionManager,
          columnStartIndex,
          columnStopIndex,
          deferredMeasurementCache,
          horizontalOffsetAdjustment,
          isScrolling,
          isScrollingOptOut,
          parent: this,
          rowSizeAndPositionManager: instanceProps.rowSizeAndPositionManager,
          rowStartIndex,
          rowStopIndex,
          scrollLeft,
          scrollTop,
          styleCache: this._styleCache,
          verticalOffsetAdjustment,
          visibleColumnIndices,
          visibleRowIndices
        });
        this._columnStartIndex = columnStartIndex;
        this._columnStopIndex = columnStopIndex;
        this._rowStartIndex = rowStartIndex;
        this._rowStopIndex = rowStopIndex;
      }
    }
    /**
     * Sets an :isScrolling flag for a small window of time.
     * This flag is used to disable pointer events on the scrollable portion of the Grid.
     * This prevents jerky/stuttery mouse-wheel scrolling.
     */
  }, {
    key: "_debounceScrollEnded",
    value: function _debounceScrollEnded() {
      var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
      if (this._disablePointerEventsTimeoutId) {
        cancelAnimationTimeout(this._disablePointerEventsTimeoutId);
      }
      this._disablePointerEventsTimeoutId = requestAnimationTimeout(this._debounceScrollEndedCallback, scrollingResetTimeInterval);
    }
  }, {
    key: "_handleInvalidatedGridSize",
    value: (
      /**
       * Check for batched CellMeasurer size invalidations.
       * This will occur the first time one or more previously unmeasured cells are rendered.
       */
      function _handleInvalidatedGridSize() {
        if (typeof this._deferredInvalidateColumnIndex === "number" && typeof this._deferredInvalidateRowIndex === "number") {
          var columnIndex = this._deferredInvalidateColumnIndex;
          var rowIndex = this._deferredInvalidateRowIndex;
          this._deferredInvalidateColumnIndex = null;
          this._deferredInvalidateRowIndex = null;
          this.recomputeGridSize({
            columnIndex,
            rowIndex
          });
        }
      }
    )
  }, {
    key: "_invokeOnScrollMemoizer",
    value: function _invokeOnScrollMemoizer(_ref6) {
      var _this3 = this;
      var scrollLeft = _ref6.scrollLeft, scrollTop = _ref6.scrollTop, totalColumnsWidth = _ref6.totalColumnsWidth, totalRowsHeight = _ref6.totalRowsHeight;
      this._onScrollMemoizer({
        callback: function callback2(_ref7) {
          var scrollLeft2 = _ref7.scrollLeft, scrollTop2 = _ref7.scrollTop;
          var _this3$props = _this3.props, height = _this3$props.height, onScroll6 = _this3$props.onScroll, width = _this3$props.width;
          onScroll6({
            clientHeight: height,
            clientWidth: width,
            scrollHeight: totalRowsHeight,
            scrollLeft: scrollLeft2,
            scrollTop: scrollTop2,
            scrollWidth: totalColumnsWidth
          });
        },
        indices: {
          scrollLeft,
          scrollTop
        }
      });
    }
  }, {
    key: "_isScrolling",
    value: function _isScrolling() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Object.hasOwnProperty.call(props, "isScrolling") ? Boolean(props.isScrolling) : Boolean(state.isScrolling);
    }
  }, {
    key: "_maybeCallOnScrollbarPresenceChange",
    value: function _maybeCallOnScrollbarPresenceChange() {
      if (this._scrollbarPresenceChanged) {
        var onScrollbarPresenceChange2 = this.props.onScrollbarPresenceChange;
        this._scrollbarPresenceChanged = false;
        onScrollbarPresenceChange2({
          horizontal: this._horizontalScrollBarSize > 0,
          size: this.state.instanceProps.scrollbarSize,
          vertical: this._verticalScrollBarSize > 0
        });
      }
    }
  }, {
    key: "scrollToPosition",
    value: (
      /**
       * Scroll to the specified offset(s).
       * Useful for animating position changes.
       */
      function scrollToPosition(_ref8) {
        var scrollLeft = _ref8.scrollLeft, scrollTop = _ref8.scrollTop;
        var stateUpdate = Grid2._getScrollToPositionStateUpdate({
          prevState: this.state,
          scrollLeft,
          scrollTop
        });
        if (stateUpdate) {
          stateUpdate.needToResetStyleCache = false;
          this.setState(stateUpdate);
        }
      }
    )
  }, {
    key: "_getCalculatedScrollLeft",
    value: function _getCalculatedScrollLeft() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Grid2._getCalculatedScrollLeft(props, state);
    }
  }, {
    key: "_updateScrollLeftForScrollToColumn",
    value: function _updateScrollLeftForScrollToColumn() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var stateUpdate = Grid2._getScrollLeftForScrollToColumnStateUpdate(props, state);
      if (stateUpdate) {
        stateUpdate.needToResetStyleCache = false;
        this.setState(stateUpdate);
      }
    }
  }, {
    key: "_getCalculatedScrollTop",
    value: function _getCalculatedScrollTop() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      return Grid2._getCalculatedScrollTop(props, state);
    }
  }, {
    key: "_resetStyleCache",
    value: function _resetStyleCache() {
      var styleCache = this._styleCache;
      var cellCache = this._cellCache;
      var isScrollingOptOut = this.props.isScrollingOptOut;
      this._cellCache = {};
      this._styleCache = {};
      for (var rowIndex = this._rowStartIndex; rowIndex <= this._rowStopIndex; rowIndex++) {
        for (var columnIndex = this._columnStartIndex; columnIndex <= this._columnStopIndex; columnIndex++) {
          var key = "".concat(rowIndex, "-").concat(columnIndex);
          this._styleCache[key] = styleCache[key];
          if (isScrollingOptOut) {
            this._cellCache[key] = cellCache[key];
          }
        }
      }
    }
  }, {
    key: "_updateScrollTopForScrollToRow",
    value: function _updateScrollTopForScrollToRow() {
      var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
      var state = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.state;
      var stateUpdate = Grid2._getScrollTopForScrollToRowStateUpdate(props, state);
      if (stateUpdate) {
        stateUpdate.needToResetStyleCache = false;
        this.setState(stateUpdate);
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      var newState = {};
      if (nextProps.columnCount === 0 && prevState.scrollLeft !== 0 || nextProps.rowCount === 0 && prevState.scrollTop !== 0) {
        newState.scrollLeft = 0;
        newState.scrollTop = 0;
      } else if (nextProps.scrollLeft !== prevState.scrollLeft && nextProps.scrollToColumn < 0 || nextProps.scrollTop !== prevState.scrollTop && nextProps.scrollToRow < 0) {
        Object.assign(newState, Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: nextProps.scrollLeft,
          scrollTop: nextProps.scrollTop
        }));
      }
      var instanceProps = prevState.instanceProps;
      newState.needToResetStyleCache = false;
      if (nextProps.columnWidth !== instanceProps.prevColumnWidth || nextProps.rowHeight !== instanceProps.prevRowHeight) {
        newState.needToResetStyleCache = true;
      }
      instanceProps.columnSizeAndPositionManager.configure({
        cellCount: nextProps.columnCount,
        estimatedCellSize: Grid2._getEstimatedColumnSize(nextProps),
        cellSizeGetter: Grid2._wrapSizeGetter(nextProps.columnWidth)
      });
      instanceProps.rowSizeAndPositionManager.configure({
        cellCount: nextProps.rowCount,
        estimatedCellSize: Grid2._getEstimatedRowSize(nextProps),
        cellSizeGetter: Grid2._wrapSizeGetter(nextProps.rowHeight)
      });
      if (instanceProps.prevColumnCount === 0 || instanceProps.prevRowCount === 0) {
        instanceProps.prevColumnCount = 0;
        instanceProps.prevRowCount = 0;
      }
      if (nextProps.autoHeight && nextProps.isScrolling === false && instanceProps.prevIsScrolling === true) {
        Object.assign(newState, {
          isScrolling: false
        });
      }
      var maybeStateA;
      var maybeStateB;
      calculateSizeAndPositionDataAndUpdateScrollOffset({
        cellCount: instanceProps.prevColumnCount,
        cellSize: typeof instanceProps.prevColumnWidth === "number" ? instanceProps.prevColumnWidth : null,
        computeMetadataCallback: function computeMetadataCallback() {
          return instanceProps.columnSizeAndPositionManager.resetCell(0);
        },
        computeMetadataCallbackProps: nextProps,
        nextCellsCount: nextProps.columnCount,
        nextCellSize: typeof nextProps.columnWidth === "number" ? nextProps.columnWidth : null,
        nextScrollToIndex: nextProps.scrollToColumn,
        scrollToIndex: instanceProps.prevScrollToColumn,
        updateScrollOffsetForScrollToIndex: function updateScrollOffsetForScrollToIndex() {
          maybeStateA = Grid2._getScrollLeftForScrollToColumnStateUpdate(nextProps, prevState);
        }
      });
      calculateSizeAndPositionDataAndUpdateScrollOffset({
        cellCount: instanceProps.prevRowCount,
        cellSize: typeof instanceProps.prevRowHeight === "number" ? instanceProps.prevRowHeight : null,
        computeMetadataCallback: function computeMetadataCallback() {
          return instanceProps.rowSizeAndPositionManager.resetCell(0);
        },
        computeMetadataCallbackProps: nextProps,
        nextCellsCount: nextProps.rowCount,
        nextCellSize: typeof nextProps.rowHeight === "number" ? nextProps.rowHeight : null,
        nextScrollToIndex: nextProps.scrollToRow,
        scrollToIndex: instanceProps.prevScrollToRow,
        updateScrollOffsetForScrollToIndex: function updateScrollOffsetForScrollToIndex() {
          maybeStateB = Grid2._getScrollTopForScrollToRowStateUpdate(nextProps, prevState);
        }
      });
      instanceProps.prevColumnCount = nextProps.columnCount;
      instanceProps.prevColumnWidth = nextProps.columnWidth;
      instanceProps.prevIsScrolling = nextProps.isScrolling === true;
      instanceProps.prevRowCount = nextProps.rowCount;
      instanceProps.prevRowHeight = nextProps.rowHeight;
      instanceProps.prevScrollToColumn = nextProps.scrollToColumn;
      instanceProps.prevScrollToRow = nextProps.scrollToRow;
      instanceProps.scrollbarSize = nextProps.getScrollbarSize();
      if (instanceProps.scrollbarSize === void 0) {
        instanceProps.scrollbarSizeMeasured = false;
        instanceProps.scrollbarSize = 0;
      } else {
        instanceProps.scrollbarSizeMeasured = true;
      }
      newState.instanceProps = instanceProps;
      return _objectSpread$5(_objectSpread$5(_objectSpread$5({}, newState), maybeStateA), maybeStateB);
    }
  }, {
    key: "_getEstimatedColumnSize",
    value: function _getEstimatedColumnSize(props) {
      return typeof props.columnWidth === "number" ? props.columnWidth : props.estimatedColumnSize;
    }
  }, {
    key: "_getEstimatedRowSize",
    value: function _getEstimatedRowSize(props) {
      return typeof props.rowHeight === "number" ? props.rowHeight : props.estimatedRowSize;
    }
  }, {
    key: "_getScrollToPositionStateUpdate",
    value: (
      /**
       * Get the updated state after scrolling to
       * scrollLeft and scrollTop
       */
      function _getScrollToPositionStateUpdate(_ref9) {
        var prevState = _ref9.prevState, scrollLeft = _ref9.scrollLeft, scrollTop = _ref9.scrollTop;
        var newState = {
          scrollPositionChangeReason: SCROLL_POSITION_CHANGE_REASONS.REQUESTED
        };
        if (typeof scrollLeft === "number" && scrollLeft >= 0) {
          newState.scrollDirectionHorizontal = scrollLeft > prevState.scrollLeft ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD;
          newState.scrollLeft = scrollLeft;
        }
        if (typeof scrollTop === "number" && scrollTop >= 0) {
          newState.scrollDirectionVertical = scrollTop > prevState.scrollTop ? SCROLL_DIRECTION_FORWARD$1 : SCROLL_DIRECTION_BACKWARD;
          newState.scrollTop = scrollTop;
        }
        if (typeof scrollLeft === "number" && scrollLeft >= 0 && scrollLeft !== prevState.scrollLeft || typeof scrollTop === "number" && scrollTop >= 0 && scrollTop !== prevState.scrollTop) {
          return newState;
        }
        return {};
      }
    )
  }, {
    key: "_wrapSizeGetter",
    value: function _wrapSizeGetter(value2) {
      return typeof value2 === "function" ? value2 : function() {
        return value2;
      };
    }
  }, {
    key: "_getCalculatedScrollLeft",
    value: function _getCalculatedScrollLeft(nextProps, prevState) {
      var columnCount = nextProps.columnCount, height = nextProps.height, scrollToAlignment = nextProps.scrollToAlignment, scrollToColumn = nextProps.scrollToColumn, width = nextProps.width;
      var scrollLeft = prevState.scrollLeft, instanceProps = prevState.instanceProps;
      if (columnCount > 0) {
        var finalColumn = columnCount - 1;
        var targetIndex = scrollToColumn < 0 ? finalColumn : Math.min(finalColumn, scrollToColumn);
        var totalRowsHeight = instanceProps.rowSizeAndPositionManager.getTotalSize();
        var scrollBarSize = instanceProps.scrollbarSizeMeasured && totalRowsHeight > height ? instanceProps.scrollbarSize : 0;
        return instanceProps.columnSizeAndPositionManager.getUpdatedOffsetForIndex({
          align: scrollToAlignment,
          containerSize: width - scrollBarSize,
          currentOffset: scrollLeft,
          targetIndex
        });
      }
      return 0;
    }
  }, {
    key: "_getScrollLeftForScrollToColumnStateUpdate",
    value: function _getScrollLeftForScrollToColumnStateUpdate(nextProps, prevState) {
      var scrollLeft = prevState.scrollLeft;
      var calculatedScrollLeft = Grid2._getCalculatedScrollLeft(nextProps, prevState);
      if (typeof calculatedScrollLeft === "number" && calculatedScrollLeft >= 0 && scrollLeft !== calculatedScrollLeft) {
        return Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: calculatedScrollLeft,
          scrollTop: -1
        });
      }
      return {};
    }
  }, {
    key: "_getCalculatedScrollTop",
    value: function _getCalculatedScrollTop(nextProps, prevState) {
      var height = nextProps.height, rowCount = nextProps.rowCount, scrollToAlignment = nextProps.scrollToAlignment, scrollToRow = nextProps.scrollToRow, width = nextProps.width;
      var scrollTop = prevState.scrollTop, instanceProps = prevState.instanceProps;
      if (rowCount > 0) {
        var finalRow = rowCount - 1;
        var targetIndex = scrollToRow < 0 ? finalRow : Math.min(finalRow, scrollToRow);
        var totalColumnsWidth = instanceProps.columnSizeAndPositionManager.getTotalSize();
        var scrollBarSize = instanceProps.scrollbarSizeMeasured && totalColumnsWidth > width ? instanceProps.scrollbarSize : 0;
        return instanceProps.rowSizeAndPositionManager.getUpdatedOffsetForIndex({
          align: scrollToAlignment,
          containerSize: height - scrollBarSize,
          currentOffset: scrollTop,
          targetIndex
        });
      }
      return 0;
    }
  }, {
    key: "_getScrollTopForScrollToRowStateUpdate",
    value: function _getScrollTopForScrollToRowStateUpdate(nextProps, prevState) {
      var scrollTop = prevState.scrollTop;
      var calculatedScrollTop = Grid2._getCalculatedScrollTop(nextProps, prevState);
      if (typeof calculatedScrollTop === "number" && calculatedScrollTop >= 0 && scrollTop !== calculatedScrollTop) {
        return Grid2._getScrollToPositionStateUpdate({
          prevState,
          scrollLeft: -1,
          scrollTop: calculatedScrollTop
        });
      }
      return {};
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(Grid, "defaultProps", {
  "aria-label": "grid",
  "aria-readonly": true,
  autoContainerWidth: false,
  autoHeight: false,
  autoWidth: false,
  cellRangeRenderer: defaultCellRangeRenderer,
  containerRole: "row",
  containerStyle: {},
  estimatedColumnSize: 100,
  estimatedRowSize: 30,
  getScrollbarSize: scrollbarSize,
  noContentRenderer: renderNull,
  onScroll: function onScroll2() {
  },
  onScrollbarPresenceChange: function onScrollbarPresenceChange() {
  },
  onSectionRendered: function onSectionRendered2() {
  },
  overscanColumnCount: 0,
  overscanIndicesGetter: defaultOverscanIndicesGetter$1,
  overscanRowCount: 10,
  role: "grid",
  scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL$1,
  scrollToAlignment: "auto",
  scrollToColumn: -1,
  scrollToRow: -1,
  style: {},
  tabIndex: 0,
  isScrollingOptOut: false
});
polyfill2(Grid);
var SCROLL_DIRECTION_FORWARD = 1;
function defaultOverscanIndicesGetter(_ref) {
  var cellCount = _ref.cellCount, overscanCellsCount = _ref.overscanCellsCount, scrollDirection = _ref.scrollDirection, startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
  overscanCellsCount = Math.max(1, overscanCellsCount);
  if (scrollDirection === SCROLL_DIRECTION_FORWARD) {
    return {
      overscanStartIndex: Math.max(0, startIndex - 1),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + overscanCellsCount)
    };
  } else {
    return {
      overscanStartIndex: Math.max(0, startIndex - overscanCellsCount),
      overscanStopIndex: Math.min(cellCount - 1, stopIndex + 1)
    };
  }
}
function _callSuper$7(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$7() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$7() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$7 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var InfiniteLoader = /* @__PURE__ */ function(_React$PureComponent) {
  function InfiniteLoader2(props, context) {
    var _this;
    _classCallCheck$a(this, InfiniteLoader2);
    _this = _callSuper$7(this, InfiniteLoader2, [props, context]);
    _this._loadMoreRowsMemoizer = createCallbackMemoizer();
    _this._onRowsRendered = _this._onRowsRendered.bind(_this);
    _this._registerChild = _this._registerChild.bind(_this);
    return _this;
  }
  _inherits$a(InfiniteLoader2, _React$PureComponent);
  return _createClass$8(InfiniteLoader2, [{
    key: "resetLoadMoreRowsCache",
    value: function resetLoadMoreRowsCache(autoReload) {
      this._loadMoreRowsMemoizer = createCallbackMemoizer();
      if (autoReload) {
        this._doStuff(this._lastRenderedStartIndex, this._lastRenderedStopIndex);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var children = this.props.children;
      return children({
        onRowsRendered: this._onRowsRendered,
        registerChild: this._registerChild
      });
    }
  }, {
    key: "_loadUnloadedRanges",
    value: function _loadUnloadedRanges(unloadedRanges) {
      var _this2 = this;
      var loadMoreRows = this.props.loadMoreRows;
      unloadedRanges.forEach(function(unloadedRange) {
        var promise = loadMoreRows(unloadedRange);
        if (promise) {
          promise.then(function() {
            if (isRangeVisible({
              lastRenderedStartIndex: _this2._lastRenderedStartIndex,
              lastRenderedStopIndex: _this2._lastRenderedStopIndex,
              startIndex: unloadedRange.startIndex,
              stopIndex: unloadedRange.stopIndex
            })) {
              if (_this2._registeredChild) {
                forceUpdateReactVirtualizedComponent(_this2._registeredChild, _this2._lastRenderedStartIndex);
              }
            }
          });
        }
      });
    }
  }, {
    key: "_onRowsRendered",
    value: function _onRowsRendered(_ref) {
      var startIndex = _ref.startIndex, stopIndex = _ref.stopIndex;
      this._lastRenderedStartIndex = startIndex;
      this._lastRenderedStopIndex = stopIndex;
      this._doStuff(startIndex, stopIndex);
    }
  }, {
    key: "_doStuff",
    value: function _doStuff(startIndex, stopIndex) {
      var _ref2, _this3 = this;
      var _this$props = this.props, isRowLoaded = _this$props.isRowLoaded, minimumBatchSize = _this$props.minimumBatchSize, rowCount = _this$props.rowCount, threshold = _this$props.threshold;
      var unloadedRanges = scanForUnloadedRanges({
        isRowLoaded,
        minimumBatchSize,
        rowCount,
        startIndex: Math.max(0, startIndex - threshold),
        stopIndex: Math.min(rowCount - 1, stopIndex + threshold)
      });
      var squashedUnloadedRanges = (_ref2 = []).concat.apply(_ref2, _toConsumableArray(unloadedRanges.map(function(_ref3) {
        var startIndex2 = _ref3.startIndex, stopIndex2 = _ref3.stopIndex;
        return [startIndex2, stopIndex2];
      })));
      this._loadMoreRowsMemoizer({
        callback: function callback2() {
          _this3._loadUnloadedRanges(unloadedRanges);
        },
        indices: {
          squashedUnloadedRanges
        }
      });
    }
  }, {
    key: "_registerChild",
    value: function _registerChild(registeredChild) {
      this._registeredChild = registeredChild;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(InfiniteLoader, "defaultProps", {
  minimumBatchSize: 10,
  rowCount: 0,
  threshold: 15
});
InfiniteLoader.propTypes = {};
function isRangeVisible(_ref4) {
  var lastRenderedStartIndex = _ref4.lastRenderedStartIndex, lastRenderedStopIndex = _ref4.lastRenderedStopIndex, startIndex = _ref4.startIndex, stopIndex = _ref4.stopIndex;
  return !(startIndex > lastRenderedStopIndex || stopIndex < lastRenderedStartIndex);
}
function scanForUnloadedRanges(_ref5) {
  var isRowLoaded = _ref5.isRowLoaded, minimumBatchSize = _ref5.minimumBatchSize, rowCount = _ref5.rowCount, startIndex = _ref5.startIndex, stopIndex = _ref5.stopIndex;
  var unloadedRanges = [];
  var rangeStartIndex = null;
  var rangeStopIndex = null;
  for (var index2 = startIndex; index2 <= stopIndex; index2++) {
    var loaded = isRowLoaded({
      index: index2
    });
    if (!loaded) {
      rangeStopIndex = index2;
      if (rangeStartIndex === null) {
        rangeStartIndex = index2;
      }
    } else if (rangeStopIndex !== null) {
      unloadedRanges.push({
        startIndex: rangeStartIndex,
        stopIndex: rangeStopIndex
      });
      rangeStartIndex = rangeStopIndex = null;
    }
  }
  if (rangeStopIndex !== null) {
    var potentialStopIndex = Math.min(Math.max(rangeStopIndex, rangeStartIndex + minimumBatchSize - 1), rowCount - 1);
    for (var _index = rangeStopIndex + 1; _index <= potentialStopIndex; _index++) {
      if (!isRowLoaded({
        index: _index
      })) {
        rangeStopIndex = _index;
      } else {
        break;
      }
    }
    unloadedRanges.push({
      startIndex: rangeStartIndex,
      stopIndex: rangeStopIndex
    });
  }
  if (unloadedRanges.length) {
    var firstUnloadedRange = unloadedRanges[0];
    while (firstUnloadedRange.stopIndex - firstUnloadedRange.startIndex + 1 < minimumBatchSize && firstUnloadedRange.startIndex > 0) {
      var _index2 = firstUnloadedRange.startIndex - 1;
      if (!isRowLoaded({
        index: _index2
      })) {
        firstUnloadedRange.startIndex = _index2;
      } else {
        break;
      }
    }
  }
  return unloadedRanges;
}
function forceUpdateReactVirtualizedComponent(component) {
  var currentIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
  var recomputeSize = typeof component.recomputeGridSize === "function" ? component.recomputeGridSize : component.recomputeRowHeights;
  if (recomputeSize) {
    recomputeSize.call(component, currentIndex);
  } else {
    component.forceUpdate();
  }
}
function _callSuper$6(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$6() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$6() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$6 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var List = /* @__PURE__ */ function(_React$PureComponent) {
  function List2() {
    var _this;
    _classCallCheck$a(this, List2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$6(this, List2, [].concat(args));
    _defineProperty$4(_this, "Grid", void 0);
    _defineProperty$4(_this, "_cellRenderer", function(_ref) {
      var parent = _ref.parent, rowIndex = _ref.rowIndex, style2 = _ref.style, isScrolling = _ref.isScrolling, isVisible2 = _ref.isVisible, key = _ref.key;
      var rowRenderer = _this.props.rowRenderer;
      var widthDescriptor = Object.getOwnPropertyDescriptor(style2, "width");
      if (widthDescriptor && widthDescriptor.writable) {
        style2.width = "100%";
      }
      return rowRenderer({
        index: rowIndex,
        style: style2,
        isScrolling,
        isVisible: isVisible2,
        key,
        parent
      });
    });
    _defineProperty$4(_this, "_setRef", function(ref) {
      _this.Grid = ref;
    });
    _defineProperty$4(_this, "_onScroll", function(_ref2) {
      var clientHeight = _ref2.clientHeight, scrollHeight = _ref2.scrollHeight, scrollTop = _ref2.scrollTop;
      var onScroll6 = _this.props.onScroll;
      onScroll6({
        clientHeight,
        scrollHeight,
        scrollTop
      });
    });
    _defineProperty$4(_this, "_onSectionRendered", function(_ref3) {
      var rowOverscanStartIndex = _ref3.rowOverscanStartIndex, rowOverscanStopIndex = _ref3.rowOverscanStopIndex, rowStartIndex = _ref3.rowStartIndex, rowStopIndex = _ref3.rowStopIndex;
      var onRowsRendered3 = _this.props.onRowsRendered;
      onRowsRendered3({
        overscanStartIndex: rowOverscanStartIndex,
        overscanStopIndex: rowOverscanStopIndex,
        startIndex: rowStartIndex,
        stopIndex: rowStopIndex
      });
    });
    return _this;
  }
  _inherits$a(List2, _React$PureComponent);
  return _createClass$8(List2, [{
    key: "forceUpdateGrid",
    value: function forceUpdateGrid() {
      if (this.Grid) {
        this.Grid.forceUpdate();
      }
    }
    /** See Grid#getOffsetForCell */
  }, {
    key: "getOffsetForRow",
    value: function getOffsetForRow(_ref4) {
      var alignment = _ref4.alignment, index2 = _ref4.index;
      if (this.Grid) {
        var _this$Grid$getOffsetF = this.Grid.getOffsetForCell({
          alignment,
          rowIndex: index2,
          columnIndex: 0
        }), scrollTop = _this$Grid$getOffsetF.scrollTop;
        return scrollTop;
      }
      return 0;
    }
    /** CellMeasurer compatibility */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref5) {
      var columnIndex = _ref5.columnIndex, rowIndex = _ref5.rowIndex;
      if (this.Grid) {
        this.Grid.invalidateCellSizeAfterRender({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllRows",
    value: function measureAllRows() {
      if (this.Grid) {
        this.Grid.measureAllCells();
      }
    }
    /** CellMeasurer compatibility */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref6 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref6$columnIndex = _ref6.columnIndex, columnIndex = _ref6$columnIndex === void 0 ? 0 : _ref6$columnIndex, _ref6$rowIndex = _ref6.rowIndex, rowIndex = _ref6$rowIndex === void 0 ? 0 : _ref6$rowIndex;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeRowHeights",
    value: function recomputeRowHeights() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex: index2,
          columnIndex: 0
        });
      }
    }
    /** See Grid#scrollToPosition */
  }, {
    key: "scrollToPosition",
    value: function scrollToPosition() {
      var scrollTop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToPosition({
          scrollTop
        });
      }
    }
    /** See Grid#scrollToCell */
  }, {
    key: "scrollToRow",
    value: function scrollToRow() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToCell({
          columnIndex: 0,
          rowIndex: index2
        });
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props = this.props, className = _this$props.className, noRowsRenderer3 = _this$props.noRowsRenderer, scrollToIndex = _this$props.scrollToIndex, width = _this$props.width;
      var classNames2 = clsx("ReactVirtualized__List", className);
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, this.props, {
        autoContainerWidth: true,
        cellRenderer: this._cellRenderer,
        className: classNames2,
        columnWidth: width,
        columnCount: 1,
        noContentRenderer: noRowsRenderer3,
        onScroll: this._onScroll,
        onSectionRendered: this._onSectionRendered,
        ref: this._setRef,
        scrollToRow: scrollToIndex
      }));
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(List, "defaultProps", {
  autoHeight: false,
  estimatedRowSize: 30,
  onScroll: function onScroll3() {
  },
  noRowsRenderer: function noRowsRenderer() {
    return null;
  },
  onRowsRendered: function onRowsRendered() {
  },
  overscanIndicesGetter: defaultOverscanIndicesGetter,
  overscanRowCount: 10,
  scrollToAlignment: "auto",
  scrollToIndex: -1,
  style: {}
});
function _GEA(a2, l2, h3, y2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 >= y2) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function _GEP(a2, l2, h3, y2, c2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) >= 0) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function dispatchBsearchGE(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _GEP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _GEA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _GTA(a2, l2, h3, y2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 > y2) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function _GTP(a2, l2, h3, y2, c2) {
  var i2 = h3 + 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) > 0) {
      i2 = m2;
      h3 = m2 - 1;
    } else {
      l2 = m2 + 1;
    }
  }
  return i2;
}
function dispatchBsearchGT(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _GTP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _GTA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _LTA(a2, l2, h3, y2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 < y2) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function _LTP(a2, l2, h3, y2, c2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) < 0) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function dispatchBsearchLT(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _LTP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _LTA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _LEA(a2, l2, h3, y2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 <= y2) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function _LEP(a2, l2, h3, y2, c2) {
  var i2 = l2 - 1;
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (c2(x2, y2) <= 0) {
      i2 = m2;
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return i2;
}
function dispatchBsearchLE(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _LEP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _LEA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
function _EQA(a2, l2, h3, y2) {
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    if (x2 === y2) {
      return m2;
    } else if (x2 <= y2) {
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return -1;
}
function _EQP(a2, l2, h3, y2, c2) {
  while (l2 <= h3) {
    var m2 = l2 + h3 >>> 1, x2 = a2[m2];
    var p2 = c2(x2, y2);
    if (p2 === 0) {
      return m2;
    } else if (p2 <= 0) {
      l2 = m2 + 1;
    } else {
      h3 = m2 - 1;
    }
  }
  return -1;
}
function dispatchBsearchEQ(a2, y2, c2, l2, h3) {
  if (typeof c2 === "function") {
    return _EQP(a2, l2 === void 0 ? 0 : l2 | 0, h3 === void 0 ? a2.length - 1 : h3 | 0, y2, c2);
  } else {
    return _EQA(a2, c2 === void 0 ? 0 : c2 | 0, l2 === void 0 ? a2.length - 1 : l2 | 0, y2);
  }
}
const bounds = {
  ge: dispatchBsearchGE,
  gt: dispatchBsearchGT,
  lt: dispatchBsearchLT,
  le: dispatchBsearchLE,
  eq: dispatchBsearchEQ
};
var NOT_FOUND = 0;
var SUCCESS = 1;
var EMPTY$1 = 2;
function IntervalTreeNode(mid, left2, right, leftPoints, rightPoints) {
  this.mid = mid;
  this.left = left2;
  this.right = right;
  this.leftPoints = leftPoints;
  this.rightPoints = rightPoints;
  this.count = (left2 ? left2.count : 0) + (right ? right.count : 0) + leftPoints.length;
}
var proto = IntervalTreeNode.prototype;
function copy(a2, b2) {
  a2.mid = b2.mid;
  a2.left = b2.left;
  a2.right = b2.right;
  a2.leftPoints = b2.leftPoints;
  a2.rightPoints = b2.rightPoints;
  a2.count = b2.count;
}
function rebuild(node2, intervals) {
  var ntree = createIntervalTree(intervals);
  node2.mid = ntree.mid;
  node2.left = ntree.left;
  node2.right = ntree.right;
  node2.leftPoints = ntree.leftPoints;
  node2.rightPoints = ntree.rightPoints;
  node2.count = ntree.count;
}
function rebuildWithInterval(node2, interval) {
  var intervals = node2.intervals([]);
  intervals.push(interval);
  rebuild(node2, intervals);
}
function rebuildWithoutInterval(node2, interval) {
  var intervals = node2.intervals([]);
  var idx = intervals.indexOf(interval);
  if (idx < 0) {
    return NOT_FOUND;
  }
  intervals.splice(idx, 1);
  rebuild(node2, intervals);
  return SUCCESS;
}
proto.intervals = function(result) {
  result.push.apply(result, this.leftPoints);
  if (this.left) {
    this.left.intervals(result);
  }
  if (this.right) {
    this.right.intervals(result);
  }
  return result;
};
proto.insert = function(interval) {
  var weight = this.count - this.leftPoints.length;
  this.count += 1;
  if (interval[1] < this.mid) {
    if (this.left) {
      if (4 * (this.left.count + 1) > 3 * (weight + 1)) {
        rebuildWithInterval(this, interval);
      } else {
        this.left.insert(interval);
      }
    } else {
      this.left = createIntervalTree([interval]);
    }
  } else if (interval[0] > this.mid) {
    if (this.right) {
      if (4 * (this.right.count + 1) > 3 * (weight + 1)) {
        rebuildWithInterval(this, interval);
      } else {
        this.right.insert(interval);
      }
    } else {
      this.right = createIntervalTree([interval]);
    }
  } else {
    var l2 = bounds.ge(this.leftPoints, interval, compareBegin);
    var r2 = bounds.ge(this.rightPoints, interval, compareEnd);
    this.leftPoints.splice(l2, 0, interval);
    this.rightPoints.splice(r2, 0, interval);
  }
};
proto.remove = function(interval) {
  var weight = this.count - this.leftPoints;
  if (interval[1] < this.mid) {
    if (!this.left) {
      return NOT_FOUND;
    }
    var rw = this.right ? this.right.count : 0;
    if (4 * rw > 3 * (weight - 1)) {
      return rebuildWithoutInterval(this, interval);
    }
    var r2 = this.left.remove(interval);
    if (r2 === EMPTY$1) {
      this.left = null;
      this.count -= 1;
      return SUCCESS;
    } else if (r2 === SUCCESS) {
      this.count -= 1;
    }
    return r2;
  } else if (interval[0] > this.mid) {
    if (!this.right) {
      return NOT_FOUND;
    }
    var lw = this.left ? this.left.count : 0;
    if (4 * lw > 3 * (weight - 1)) {
      return rebuildWithoutInterval(this, interval);
    }
    var r2 = this.right.remove(interval);
    if (r2 === EMPTY$1) {
      this.right = null;
      this.count -= 1;
      return SUCCESS;
    } else if (r2 === SUCCESS) {
      this.count -= 1;
    }
    return r2;
  } else {
    if (this.count === 1) {
      if (this.leftPoints[0] === interval) {
        return EMPTY$1;
      } else {
        return NOT_FOUND;
      }
    }
    if (this.leftPoints.length === 1 && this.leftPoints[0] === interval) {
      if (this.left && this.right) {
        var p2 = this;
        var n2 = this.left;
        while (n2.right) {
          p2 = n2;
          n2 = n2.right;
        }
        if (p2 === this) {
          n2.right = this.right;
        } else {
          var l2 = this.left;
          var r2 = this.right;
          p2.count -= n2.count;
          p2.right = n2.left;
          n2.left = l2;
          n2.right = r2;
        }
        copy(this, n2);
        this.count = (this.left ? this.left.count : 0) + (this.right ? this.right.count : 0) + this.leftPoints.length;
      } else if (this.left) {
        copy(this, this.left);
      } else {
        copy(this, this.right);
      }
      return SUCCESS;
    }
    for (var l2 = bounds.ge(this.leftPoints, interval, compareBegin); l2 < this.leftPoints.length; ++l2) {
      if (this.leftPoints[l2][0] !== interval[0]) {
        break;
      }
      if (this.leftPoints[l2] === interval) {
        this.count -= 1;
        this.leftPoints.splice(l2, 1);
        for (var r2 = bounds.ge(this.rightPoints, interval, compareEnd); r2 < this.rightPoints.length; ++r2) {
          if (this.rightPoints[r2][1] !== interval[1]) {
            break;
          } else if (this.rightPoints[r2] === interval) {
            this.rightPoints.splice(r2, 1);
            return SUCCESS;
          }
        }
      }
    }
    return NOT_FOUND;
  }
};
function reportLeftRange(arr, hi2, cb2) {
  for (var i2 = 0; i2 < arr.length && arr[i2][0] <= hi2; ++i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
function reportRightRange(arr, lo, cb2) {
  for (var i2 = arr.length - 1; i2 >= 0 && arr[i2][1] >= lo; --i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
function reportRange(arr, cb2) {
  for (var i2 = 0; i2 < arr.length; ++i2) {
    var r2 = cb2(arr[i2]);
    if (r2) {
      return r2;
    }
  }
}
proto.queryPoint = function(x2, cb2) {
  if (x2 < this.mid) {
    if (this.left) {
      var r2 = this.left.queryPoint(x2, cb2);
      if (r2) {
        return r2;
      }
    }
    return reportLeftRange(this.leftPoints, x2, cb2);
  } else if (x2 > this.mid) {
    if (this.right) {
      var r2 = this.right.queryPoint(x2, cb2);
      if (r2) {
        return r2;
      }
    }
    return reportRightRange(this.rightPoints, x2, cb2);
  } else {
    return reportRange(this.leftPoints, cb2);
  }
};
proto.queryInterval = function(lo, hi2, cb2) {
  if (lo < this.mid && this.left) {
    var r2 = this.left.queryInterval(lo, hi2, cb2);
    if (r2) {
      return r2;
    }
  }
  if (hi2 > this.mid && this.right) {
    var r2 = this.right.queryInterval(lo, hi2, cb2);
    if (r2) {
      return r2;
    }
  }
  if (hi2 < this.mid) {
    return reportLeftRange(this.leftPoints, hi2, cb2);
  } else if (lo > this.mid) {
    return reportRightRange(this.rightPoints, lo, cb2);
  } else {
    return reportRange(this.leftPoints, cb2);
  }
};
function compareNumbers(a2, b2) {
  return a2 - b2;
}
function compareBegin(a2, b2) {
  var d2 = a2[0] - b2[0];
  if (d2) {
    return d2;
  }
  return a2[1] - b2[1];
}
function compareEnd(a2, b2) {
  var d2 = a2[1] - b2[1];
  if (d2) {
    return d2;
  }
  return a2[0] - b2[0];
}
function createIntervalTree(intervals) {
  if (intervals.length === 0) {
    return null;
  }
  var pts = [];
  for (var i2 = 0; i2 < intervals.length; ++i2) {
    pts.push(intervals[i2][0], intervals[i2][1]);
  }
  pts.sort(compareNumbers);
  var mid = pts[pts.length >> 1];
  var leftIntervals = [];
  var rightIntervals = [];
  var centerIntervals = [];
  for (var i2 = 0; i2 < intervals.length; ++i2) {
    var s2 = intervals[i2];
    if (s2[1] < mid) {
      leftIntervals.push(s2);
    } else if (mid < s2[0]) {
      rightIntervals.push(s2);
    } else {
      centerIntervals.push(s2);
    }
  }
  var leftPoints = centerIntervals;
  var rightPoints = centerIntervals.slice();
  leftPoints.sort(compareBegin);
  rightPoints.sort(compareEnd);
  return new IntervalTreeNode(mid, createIntervalTree(leftIntervals), createIntervalTree(rightIntervals), leftPoints, rightPoints);
}
function IntervalTree(root2) {
  this.root = root2;
}
var tproto = IntervalTree.prototype;
tproto.insert = function(interval) {
  if (this.root) {
    this.root.insert(interval);
  } else {
    this.root = new IntervalTreeNode(interval[0], null, null, [interval], [interval]);
  }
};
tproto.remove = function(interval) {
  if (this.root) {
    var r2 = this.root.remove(interval);
    if (r2 === EMPTY$1) {
      this.root = null;
    }
    return r2 !== NOT_FOUND;
  }
  return false;
};
tproto.queryPoint = function(p2, cb2) {
  if (this.root) {
    return this.root.queryPoint(p2, cb2);
  }
};
tproto.queryInterval = function(lo, hi2, cb2) {
  if (lo <= hi2 && this.root) {
    return this.root.queryInterval(lo, hi2, cb2);
  }
};
Object.defineProperty(tproto, "count", {
  get: function get2() {
    if (this.root) {
      return this.root.count;
    }
    return 0;
  }
});
Object.defineProperty(tproto, "intervals", {
  get: function get3() {
    if (this.root) {
      return this.root.intervals([]);
    }
    return [];
  }
});
function createWrapper(intervals) {
  {
    return new IntervalTree(null);
  }
}
var PositionCache = /* @__PURE__ */ function() {
  function PositionCache2() {
    _classCallCheck$a(this, PositionCache2);
    _defineProperty$4(this, "_columnSizeMap", {});
    _defineProperty$4(this, "_intervalTree", createWrapper());
    _defineProperty$4(this, "_leftMap", {});
  }
  return _createClass$8(PositionCache2, [{
    key: "estimateTotalHeight",
    value: function estimateTotalHeight(cellCount, columnCount, defaultCellHeight) {
      var unmeasuredCellCount = cellCount - this.count;
      return this.tallestColumnSize + Math.ceil(unmeasuredCellCount / columnCount) * defaultCellHeight;
    }
    // Render all cells visible within the viewport range defined.
  }, {
    key: "range",
    value: function range3(scrollTop, clientHeight, renderCallback) {
      var _this = this;
      this._intervalTree.queryInterval(scrollTop, scrollTop + clientHeight, function(_ref) {
        var _ref2 = _slicedToArray(_ref, 3), top2 = _ref2[0];
        _ref2[1];
        var index2 = _ref2[2];
        return renderCallback(index2, _this._leftMap[index2], top2);
      });
    }
  }, {
    key: "setPosition",
    value: function setPosition(index2, left2, top2, height) {
      this._intervalTree.insert([top2, top2 + height, index2]);
      this._leftMap[index2] = left2;
      var columnSizeMap = this._columnSizeMap;
      var columnHeight = columnSizeMap[left2];
      if (columnHeight === void 0) {
        columnSizeMap[left2] = top2 + height;
      } else {
        columnSizeMap[left2] = Math.max(columnHeight, top2 + height);
      }
    }
  }, {
    key: "count",
    get: function get5() {
      return this._intervalTree.count;
    }
  }, {
    key: "shortestColumnSize",
    get: function get5() {
      var columnSizeMap = this._columnSizeMap;
      var size2 = 0;
      for (var i2 in columnSizeMap) {
        var height = columnSizeMap[i2];
        size2 = size2 === 0 ? height : Math.min(size2, height);
      }
      return size2;
    }
  }, {
    key: "tallestColumnSize",
    get: function get5() {
      var columnSizeMap = this._columnSizeMap;
      var size2 = 0;
      for (var i2 in columnSizeMap) {
        var height = columnSizeMap[i2];
        size2 = Math.max(size2, height);
      }
      return size2;
    }
  }]);
}();
function ownKeys$3(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$4(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$3(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$3(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper$5(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$5() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$5() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct$5 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var emptyObject = {};
var DEFAULT_SCROLLING_RESET_TIME_INTERVAL = 150;
var Masonry = /* @__PURE__ */ function(_React$PureComponent) {
  function Masonry2() {
    var _this;
    _classCallCheck$a(this, Masonry2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper$5(this, Masonry2, [].concat(args));
    _defineProperty$4(_this, "state", {
      isScrolling: false,
      scrollTop: 0
    });
    _defineProperty$4(_this, "_debounceResetIsScrollingId", void 0);
    _defineProperty$4(_this, "_invalidateOnUpdateStartIndex", null);
    _defineProperty$4(_this, "_invalidateOnUpdateStopIndex", null);
    _defineProperty$4(_this, "_positionCache", new PositionCache());
    _defineProperty$4(_this, "_startIndex", null);
    _defineProperty$4(_this, "_startIndexMemoized", null);
    _defineProperty$4(_this, "_stopIndex", null);
    _defineProperty$4(_this, "_stopIndexMemoized", null);
    _defineProperty$4(_this, "_debounceResetIsScrollingCallback", function() {
      _this.setState({
        isScrolling: false
      });
    });
    _defineProperty$4(_this, "_setScrollingContainerRef", function(ref) {
      _this._scrollingContainer = ref;
    });
    _defineProperty$4(_this, "_onScroll", function(event) {
      var height = _this.props.height;
      var eventScrollTop = event.currentTarget.scrollTop;
      var scrollTop = Math.min(Math.max(0, _this._getEstimatedTotalHeight() - height), eventScrollTop);
      if (eventScrollTop !== scrollTop) {
        return;
      }
      _this._debounceResetIsScrolling();
      if (_this.state.scrollTop !== scrollTop) {
        _this.setState({
          isScrolling: true,
          scrollTop
        });
      }
    });
    return _this;
  }
  _inherits$a(Masonry2, _React$PureComponent);
  return _createClass$8(Masonry2, [{
    key: "clearCellPositions",
    value: function clearCellPositions() {
      this._positionCache = new PositionCache();
      this.forceUpdate();
    }
    // HACK This method signature was intended for Grid
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref) {
      var index2 = _ref.rowIndex;
      if (this._invalidateOnUpdateStartIndex === null) {
        this._invalidateOnUpdateStartIndex = index2;
        this._invalidateOnUpdateStopIndex = index2;
      } else {
        this._invalidateOnUpdateStartIndex = Math.min(this._invalidateOnUpdateStartIndex, index2);
        this._invalidateOnUpdateStopIndex = Math.max(this._invalidateOnUpdateStopIndex, index2);
      }
    }
  }, {
    key: "recomputeCellPositions",
    value: function recomputeCellPositions() {
      var stopIndex = this._positionCache.count - 1;
      this._positionCache = new PositionCache();
      this._populatePositionCache(0, stopIndex);
      this.forceUpdate();
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this._checkInvalidateOnUpdate();
      this._invokeOnScrollCallback();
      this._invokeOnCellsRenderedCallback();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      this._checkInvalidateOnUpdate();
      this._invokeOnScrollCallback();
      this._invokeOnCellsRenderedCallback();
      if (this.props.scrollTop !== prevProps.scrollTop) {
        this._debounceResetIsScrolling();
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      if (this._debounceResetIsScrollingId) {
        cancelAnimationTimeout(this._debounceResetIsScrollingId);
      }
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _this$props = this.props, autoHeight = _this$props.autoHeight, cellCount = _this$props.cellCount, cellMeasurerCache = _this$props.cellMeasurerCache, cellRenderer = _this$props.cellRenderer, className = _this$props.className, height = _this$props.height, id2 = _this$props.id, keyMapper = _this$props.keyMapper, overscanByPixels = _this$props.overscanByPixels, role = _this$props.role, style2 = _this$props.style, tabIndex = _this$props.tabIndex, width = _this$props.width, rowDirection = _this$props.rowDirection;
      var _this$state = this.state, isScrolling = _this$state.isScrolling, scrollTop = _this$state.scrollTop;
      var children = [];
      var estimateTotalHeight = this._getEstimatedTotalHeight();
      var shortestColumnSize = this._positionCache.shortestColumnSize;
      var measuredCellCount = this._positionCache.count;
      var startIndex = 0;
      var stopIndex;
      this._positionCache.range(Math.max(0, scrollTop - overscanByPixels), height + overscanByPixels * 2, function(index2, left2, top2) {
        if (typeof stopIndex === "undefined") {
          startIndex = index2;
          stopIndex = index2;
        } else {
          startIndex = Math.min(startIndex, index2);
          stopIndex = Math.max(stopIndex, index2);
        }
        children.push(cellRenderer({
          index: index2,
          isScrolling,
          key: keyMapper(index2),
          parent: _this2,
          style: _defineProperty$4(_defineProperty$4(_defineProperty$4(_defineProperty$4({
            height: cellMeasurerCache.getHeight(index2)
          }, rowDirection === "ltr" ? "left" : "right", left2), "position", "absolute"), "top", top2), "width", cellMeasurerCache.getWidth(index2))
        }));
      });
      if (shortestColumnSize < scrollTop + height + overscanByPixels && measuredCellCount < cellCount) {
        var batchSize = Math.min(cellCount - measuredCellCount, Math.ceil((scrollTop + height + overscanByPixels - shortestColumnSize) / cellMeasurerCache.defaultHeight * width / cellMeasurerCache.defaultWidth));
        for (var _index = measuredCellCount; _index < measuredCellCount + batchSize; _index++) {
          stopIndex = _index;
          children.push(cellRenderer({
            index: _index,
            isScrolling,
            key: keyMapper(_index),
            parent: this,
            style: {
              width: cellMeasurerCache.getWidth(_index)
            }
          }));
        }
      }
      this._startIndex = startIndex;
      this._stopIndex = stopIndex;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._setScrollingContainerRef,
        "aria-label": this.props["aria-label"],
        className: clsx("ReactVirtualized__Masonry", className),
        id: id2,
        onScroll: this._onScroll,
        role,
        style: _objectSpread$4({
          boxSizing: "border-box",
          direction: "ltr",
          height: autoHeight ? "auto" : height,
          overflowX: "hidden",
          overflowY: estimateTotalHeight < height ? "hidden" : "auto",
          position: "relative",
          width,
          WebkitOverflowScrolling: "touch",
          willChange: "transform"
        }, style2),
        tabIndex
      }, /* @__PURE__ */ reactExports.createElement("div", {
        className: "ReactVirtualized__Masonry__innerScrollContainer",
        style: {
          width: "100%",
          height: estimateTotalHeight,
          maxWidth: "100%",
          maxHeight: estimateTotalHeight,
          overflow: "hidden",
          pointerEvents: isScrolling ? "none" : "",
          position: "relative"
        }
      }, children));
    }
  }, {
    key: "_checkInvalidateOnUpdate",
    value: function _checkInvalidateOnUpdate() {
      if (typeof this._invalidateOnUpdateStartIndex === "number") {
        var startIndex = this._invalidateOnUpdateStartIndex;
        var stopIndex = this._invalidateOnUpdateStopIndex;
        this._invalidateOnUpdateStartIndex = null;
        this._invalidateOnUpdateStopIndex = null;
        this._populatePositionCache(startIndex, stopIndex);
        this.forceUpdate();
      }
    }
  }, {
    key: "_debounceResetIsScrolling",
    value: function _debounceResetIsScrolling() {
      var scrollingResetTimeInterval = this.props.scrollingResetTimeInterval;
      if (this._debounceResetIsScrollingId) {
        cancelAnimationTimeout(this._debounceResetIsScrollingId);
      }
      this._debounceResetIsScrollingId = requestAnimationTimeout(this._debounceResetIsScrollingCallback, scrollingResetTimeInterval);
    }
  }, {
    key: "_getEstimatedTotalHeight",
    value: function _getEstimatedTotalHeight() {
      var _this$props2 = this.props, cellCount = _this$props2.cellCount, cellMeasurerCache = _this$props2.cellMeasurerCache, width = _this$props2.width;
      var estimatedColumnCount = Math.max(1, Math.floor(width / cellMeasurerCache.defaultWidth));
      return this._positionCache.estimateTotalHeight(cellCount, estimatedColumnCount, cellMeasurerCache.defaultHeight);
    }
  }, {
    key: "_invokeOnScrollCallback",
    value: function _invokeOnScrollCallback() {
      var _this$props3 = this.props, height = _this$props3.height, onScroll6 = _this$props3.onScroll;
      var scrollTop = this.state.scrollTop;
      if (this._onScrollMemoized !== scrollTop) {
        onScroll6({
          clientHeight: height,
          scrollHeight: this._getEstimatedTotalHeight(),
          scrollTop
        });
        this._onScrollMemoized = scrollTop;
      }
    }
  }, {
    key: "_invokeOnCellsRenderedCallback",
    value: function _invokeOnCellsRenderedCallback() {
      if (this._startIndexMemoized !== this._startIndex || this._stopIndexMemoized !== this._stopIndex) {
        var onCellsRendered = this.props.onCellsRendered;
        onCellsRendered({
          startIndex: this._startIndex,
          stopIndex: this._stopIndex
        });
        this._startIndexMemoized = this._startIndex;
        this._stopIndexMemoized = this._stopIndex;
      }
    }
  }, {
    key: "_populatePositionCache",
    value: function _populatePositionCache(startIndex, stopIndex) {
      var _this$props4 = this.props, cellMeasurerCache = _this$props4.cellMeasurerCache, cellPositioner = _this$props4.cellPositioner;
      for (var _index2 = startIndex; _index2 <= stopIndex; _index2++) {
        var _cellPositioner = cellPositioner(_index2), left2 = _cellPositioner.left, top2 = _cellPositioner.top;
        this._positionCache.setPosition(_index2, left2, top2, cellMeasurerCache.getHeight(_index2));
      }
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.scrollTop !== void 0 && prevState.scrollTop !== nextProps.scrollTop) {
        return {
          isScrolling: true,
          scrollTop: nextProps.scrollTop
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(Masonry, "defaultProps", {
  autoHeight: false,
  keyMapper: identity,
  onCellsRendered: noop$1,
  onScroll: noop$1,
  overscanByPixels: 20,
  role: "grid",
  scrollingResetTimeInterval: DEFAULT_SCROLLING_RESET_TIME_INTERVAL,
  style: emptyObject,
  tabIndex: 0,
  rowDirection: "ltr"
});
function identity(value2) {
  return value2;
}
function noop$1() {
}
polyfill2(Masonry);
var CellMeasurerCacheDecorator = /* @__PURE__ */ function() {
  function CellMeasurerCacheDecorator2() {
    var _this = this;
    var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    _classCallCheck$a(this, CellMeasurerCacheDecorator2);
    _defineProperty$4(this, "_cellMeasurerCache", void 0);
    _defineProperty$4(this, "_columnIndexOffset", void 0);
    _defineProperty$4(this, "_rowIndexOffset", void 0);
    _defineProperty$4(this, "columnWidth", function(_ref) {
      var index2 = _ref.index;
      _this._cellMeasurerCache.columnWidth({
        index: index2 + _this._columnIndexOffset
      });
    });
    _defineProperty$4(this, "rowHeight", function(_ref2) {
      var index2 = _ref2.index;
      _this._cellMeasurerCache.rowHeight({
        index: index2 + _this._rowIndexOffset
      });
    });
    var cellMeasurerCache = params.cellMeasurerCache, _params$columnIndexOf = params.columnIndexOffset, columnIndexOffset = _params$columnIndexOf === void 0 ? 0 : _params$columnIndexOf, _params$rowIndexOffse = params.rowIndexOffset, rowIndexOffset = _params$rowIndexOffse === void 0 ? 0 : _params$rowIndexOffse;
    this._cellMeasurerCache = cellMeasurerCache;
    this._columnIndexOffset = columnIndexOffset;
    this._rowIndexOffset = rowIndexOffset;
  }
  return _createClass$8(CellMeasurerCacheDecorator2, [{
    key: "clear",
    value: function clear(rowIndex, columnIndex) {
      this._cellMeasurerCache.clear(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "clearAll",
    value: function clearAll() {
      this._cellMeasurerCache.clearAll();
    }
  }, {
    key: "defaultHeight",
    get: function get5() {
      return this._cellMeasurerCache.defaultHeight;
    }
  }, {
    key: "defaultWidth",
    get: function get5() {
      return this._cellMeasurerCache.defaultWidth;
    }
  }, {
    key: "hasFixedHeight",
    value: function hasFixedHeight() {
      return this._cellMeasurerCache.hasFixedHeight();
    }
  }, {
    key: "hasFixedWidth",
    value: function hasFixedWidth() {
      return this._cellMeasurerCache.hasFixedWidth();
    }
  }, {
    key: "getHeight",
    value: function getHeight4(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.getHeight(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "getWidth",
    value: function getWidth3(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.getWidth(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "has",
    value: function has(rowIndex) {
      var columnIndex = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return this._cellMeasurerCache.has(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset);
    }
  }, {
    key: "set",
    value: function set2(rowIndex, columnIndex, width, height) {
      this._cellMeasurerCache.set(rowIndex + this._rowIndexOffset, columnIndex + this._columnIndexOffset, width, height);
    }
  }]);
}();
var _excluded = ["rowIndex"], _excluded2 = ["columnIndex", "rowIndex"], _excluded3 = ["columnIndex"], _excluded4 = ["onScroll", "onSectionRendered", "onScrollbarPresenceChange", "scrollLeft", "scrollToColumn", "scrollTop", "scrollToRow"];
function ownKeys$2(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$3(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$2(Object(t2), true).forEach(function(r22) {
      _defineProperty$4(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$2(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$4(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$4() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$4() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$4 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var SCROLLBAR_SIZE_BUFFER = 20;
var MultiGrid = /* @__PURE__ */ function(_React$PureComponent) {
  function MultiGrid2(props, context) {
    var _this;
    _classCallCheck$a(this, MultiGrid2);
    _this = _callSuper$4(this, MultiGrid2, [props, context]);
    _defineProperty$4(_this, "state", {
      scrollLeft: 0,
      scrollTop: 0,
      scrollbarSize: 0,
      showHorizontalScrollbar: false,
      showVerticalScrollbar: false
    });
    _defineProperty$4(_this, "_deferredInvalidateColumnIndex", null);
    _defineProperty$4(_this, "_deferredInvalidateRowIndex", null);
    _defineProperty$4(_this, "_bottomLeftGridRef", function(ref) {
      _this._bottomLeftGrid = ref;
    });
    _defineProperty$4(_this, "_bottomRightGridRef", function(ref) {
      _this._bottomRightGrid = ref;
    });
    _defineProperty$4(_this, "_cellRendererBottomLeftGrid", function(_ref) {
      var rowIndex = _ref.rowIndex, rest = _objectWithoutProperties$3(_ref, _excluded);
      var _this$props = _this.props, cellRenderer = _this$props.cellRenderer, fixedRowCount = _this$props.fixedRowCount, rowCount = _this$props.rowCount;
      if (rowIndex === rowCount - fixedRowCount) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          key: rest.key,
          style: _objectSpread$3(_objectSpread$3({}, rest.style), {}, {
            height: SCROLLBAR_SIZE_BUFFER
          })
        });
      } else {
        return cellRenderer(_objectSpread$3(_objectSpread$3({}, rest), {}, {
          parent: _this,
          rowIndex: rowIndex + fixedRowCount
        }));
      }
    });
    _defineProperty$4(_this, "_cellRendererBottomRightGrid", function(_ref2) {
      var columnIndex = _ref2.columnIndex, rowIndex = _ref2.rowIndex, rest = _objectWithoutProperties$3(_ref2, _excluded2);
      var _this$props2 = _this.props, cellRenderer = _this$props2.cellRenderer, fixedColumnCount = _this$props2.fixedColumnCount, fixedRowCount = _this$props2.fixedRowCount;
      return cellRenderer(_objectSpread$3(_objectSpread$3({}, rest), {}, {
        columnIndex: columnIndex + fixedColumnCount,
        parent: _this,
        rowIndex: rowIndex + fixedRowCount
      }));
    });
    _defineProperty$4(_this, "_cellRendererTopRightGrid", function(_ref3) {
      var columnIndex = _ref3.columnIndex, rest = _objectWithoutProperties$3(_ref3, _excluded3);
      var _this$props3 = _this.props, cellRenderer = _this$props3.cellRenderer, columnCount = _this$props3.columnCount, fixedColumnCount = _this$props3.fixedColumnCount;
      if (columnIndex === columnCount - fixedColumnCount) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          key: rest.key,
          style: _objectSpread$3(_objectSpread$3({}, rest.style), {}, {
            width: SCROLLBAR_SIZE_BUFFER
          })
        });
      } else {
        return cellRenderer(_objectSpread$3(_objectSpread$3({}, rest), {}, {
          columnIndex: columnIndex + fixedColumnCount,
          parent: _this
        }));
      }
    });
    _defineProperty$4(_this, "_columnWidthRightGrid", function(_ref4) {
      var index2 = _ref4.index;
      var _this$props4 = _this.props, columnCount = _this$props4.columnCount, fixedColumnCount = _this$props4.fixedColumnCount, columnWidth = _this$props4.columnWidth;
      var _this$state = _this.state, scrollbarSize2 = _this$state.scrollbarSize, showHorizontalScrollbar = _this$state.showHorizontalScrollbar;
      if (showHorizontalScrollbar && index2 === columnCount - fixedColumnCount) {
        return scrollbarSize2;
      }
      return typeof columnWidth === "function" ? columnWidth({
        index: index2 + fixedColumnCount
      }) : columnWidth;
    });
    _defineProperty$4(_this, "_onScroll", function(scrollInfo) {
      var scrollLeft = scrollInfo.scrollLeft, scrollTop = scrollInfo.scrollTop;
      _this.setState({
        scrollLeft,
        scrollTop
      });
      var onScroll6 = _this.props.onScroll;
      if (onScroll6) {
        onScroll6(scrollInfo);
      }
    });
    _defineProperty$4(_this, "_onScrollbarPresenceChange", function(_ref5) {
      var horizontal = _ref5.horizontal, size2 = _ref5.size, vertical = _ref5.vertical;
      var _this$state2 = _this.state, showHorizontalScrollbar = _this$state2.showHorizontalScrollbar, showVerticalScrollbar = _this$state2.showVerticalScrollbar;
      if (horizontal !== showHorizontalScrollbar || vertical !== showVerticalScrollbar) {
        _this.setState({
          scrollbarSize: size2,
          showHorizontalScrollbar: horizontal,
          showVerticalScrollbar: vertical
        });
        var onScrollbarPresenceChange2 = _this.props.onScrollbarPresenceChange;
        if (typeof onScrollbarPresenceChange2 === "function") {
          onScrollbarPresenceChange2({
            horizontal,
            size: size2,
            vertical
          });
        }
      }
    });
    _defineProperty$4(_this, "_onScrollLeft", function(scrollInfo) {
      var scrollLeft = scrollInfo.scrollLeft;
      _this._onScroll({
        scrollLeft,
        scrollTop: _this.state.scrollTop
      });
    });
    _defineProperty$4(_this, "_onScrollTop", function(scrollInfo) {
      var scrollTop = scrollInfo.scrollTop;
      _this._onScroll({
        scrollTop,
        scrollLeft: _this.state.scrollLeft
      });
    });
    _defineProperty$4(_this, "_rowHeightBottomGrid", function(_ref6) {
      var index2 = _ref6.index;
      var _this$props5 = _this.props, fixedRowCount = _this$props5.fixedRowCount, rowCount = _this$props5.rowCount, rowHeight = _this$props5.rowHeight;
      var _this$state3 = _this.state, scrollbarSize2 = _this$state3.scrollbarSize, showVerticalScrollbar = _this$state3.showVerticalScrollbar;
      if (showVerticalScrollbar && index2 === rowCount - fixedRowCount) {
        return scrollbarSize2;
      }
      return typeof rowHeight === "function" ? rowHeight({
        index: index2 + fixedRowCount
      }) : rowHeight;
    });
    _defineProperty$4(_this, "_topLeftGridRef", function(ref) {
      _this._topLeftGrid = ref;
    });
    _defineProperty$4(_this, "_topRightGridRef", function(ref) {
      _this._topRightGrid = ref;
    });
    var deferredMeasurementCache = props.deferredMeasurementCache, _fixedColumnCount = props.fixedColumnCount, _fixedRowCount = props.fixedRowCount;
    _this._maybeCalculateCachedStyles(true);
    if (deferredMeasurementCache) {
      _this._deferredMeasurementCacheBottomLeftGrid = _fixedRowCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: 0,
        rowIndexOffset: _fixedRowCount
      }) : deferredMeasurementCache;
      _this._deferredMeasurementCacheBottomRightGrid = _fixedColumnCount > 0 || _fixedRowCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: _fixedColumnCount,
        rowIndexOffset: _fixedRowCount
      }) : deferredMeasurementCache;
      _this._deferredMeasurementCacheTopRightGrid = _fixedColumnCount > 0 ? new CellMeasurerCacheDecorator({
        cellMeasurerCache: deferredMeasurementCache,
        columnIndexOffset: _fixedColumnCount,
        rowIndexOffset: 0
      }) : deferredMeasurementCache;
    }
    return _this;
  }
  _inherits$a(MultiGrid2, _React$PureComponent);
  return _createClass$8(MultiGrid2, [{
    key: "forceUpdateGrids",
    value: function forceUpdateGrids() {
      this._bottomLeftGrid && this._bottomLeftGrid.forceUpdate();
      this._bottomRightGrid && this._bottomRightGrid.forceUpdate();
      this._topLeftGrid && this._topLeftGrid.forceUpdate();
      this._topRightGrid && this._topRightGrid.forceUpdate();
    }
    /** See Grid#invalidateCellSizeAfterRender */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender() {
      var _ref7 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref7$columnIndex = _ref7.columnIndex, columnIndex = _ref7$columnIndex === void 0 ? 0 : _ref7$columnIndex, _ref7$rowIndex = _ref7.rowIndex, rowIndex = _ref7$rowIndex === void 0 ? 0 : _ref7$rowIndex;
      this._deferredInvalidateColumnIndex = typeof this._deferredInvalidateColumnIndex === "number" ? Math.min(this._deferredInvalidateColumnIndex, columnIndex) : columnIndex;
      this._deferredInvalidateRowIndex = typeof this._deferredInvalidateRowIndex === "number" ? Math.min(this._deferredInvalidateRowIndex, rowIndex) : rowIndex;
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllCells",
    value: function measureAllCells() {
      this._bottomLeftGrid && this._bottomLeftGrid.measureAllCells();
      this._bottomRightGrid && this._bottomRightGrid.measureAllCells();
      this._topLeftGrid && this._topLeftGrid.measureAllCells();
      this._topRightGrid && this._topRightGrid.measureAllCells();
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref8 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref8$columnIndex = _ref8.columnIndex, columnIndex = _ref8$columnIndex === void 0 ? 0 : _ref8$columnIndex, _ref8$rowIndex = _ref8.rowIndex, rowIndex = _ref8$rowIndex === void 0 ? 0 : _ref8$rowIndex;
      var _this$props6 = this.props, fixedColumnCount = _this$props6.fixedColumnCount, fixedRowCount = _this$props6.fixedRowCount;
      var adjustedColumnIndex = Math.max(0, columnIndex - fixedColumnCount);
      var adjustedRowIndex = Math.max(0, rowIndex - fixedRowCount);
      this._bottomLeftGrid && this._bottomLeftGrid.recomputeGridSize({
        columnIndex,
        rowIndex: adjustedRowIndex
      });
      this._bottomRightGrid && this._bottomRightGrid.recomputeGridSize({
        columnIndex: adjustedColumnIndex,
        rowIndex: adjustedRowIndex
      });
      this._topLeftGrid && this._topLeftGrid.recomputeGridSize({
        columnIndex,
        rowIndex
      });
      this._topRightGrid && this._topRightGrid.recomputeGridSize({
        columnIndex: adjustedColumnIndex,
        rowIndex
      });
      this._leftGridWidth = null;
      this._topGridHeight = null;
      this._maybeCalculateCachedStyles(true);
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var _this$props7 = this.props, scrollLeft = _this$props7.scrollLeft, scrollTop = _this$props7.scrollTop;
      if (scrollLeft > 0 || scrollTop > 0) {
        var newState = {};
        if (scrollLeft > 0) {
          newState.scrollLeft = scrollLeft;
        }
        if (scrollTop > 0) {
          newState.scrollTop = scrollTop;
        }
        this.setState(newState);
      }
      this._handleInvalidatedGridSize();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._handleInvalidatedGridSize();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this$props8 = this.props, onScroll6 = _this$props8.onScroll, onSectionRendered3 = _this$props8.onSectionRendered;
      _this$props8.onScrollbarPresenceChange;
      _this$props8.scrollLeft;
      var scrollToColumn = _this$props8.scrollToColumn;
      _this$props8.scrollTop;
      var scrollToRow = _this$props8.scrollToRow, rest = _objectWithoutProperties$3(_this$props8, _excluded4);
      this._prepareForRender();
      if (this.props.width === 0 || this.props.height === 0) {
        return null;
      }
      var _this$state4 = this.state, scrollLeft = _this$state4.scrollLeft, scrollTop = _this$state4.scrollTop;
      return /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerOuterStyle
      }, /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerTopStyle
      }, this._renderTopLeftGrid(rest), this._renderTopRightGrid(_objectSpread$3(_objectSpread$3({}, rest), {}, {
        onScroll: onScroll6,
        scrollLeft
      }))), /* @__PURE__ */ reactExports.createElement("div", {
        style: this._containerBottomStyle
      }, this._renderBottomLeftGrid(_objectSpread$3(_objectSpread$3({}, rest), {}, {
        onScroll: onScroll6,
        scrollTop
      })), this._renderBottomRightGrid(_objectSpread$3(_objectSpread$3({}, rest), {}, {
        onScroll: onScroll6,
        onSectionRendered: onSectionRendered3,
        scrollLeft,
        scrollToColumn,
        scrollToRow,
        scrollTop
      }))));
    }
  }, {
    key: "_getBottomGridHeight",
    value: function _getBottomGridHeight(props) {
      var height = props.height;
      var topGridHeight = this._getTopGridHeight(props);
      return height - topGridHeight;
    }
  }, {
    key: "_getLeftGridWidth",
    value: function _getLeftGridWidth(props) {
      var fixedColumnCount = props.fixedColumnCount, columnWidth = props.columnWidth;
      if (this._leftGridWidth == null) {
        if (typeof columnWidth === "function") {
          var leftGridWidth = 0;
          for (var index2 = 0; index2 < fixedColumnCount; index2++) {
            leftGridWidth += columnWidth({
              index: index2
            });
          }
          this._leftGridWidth = leftGridWidth;
        } else {
          this._leftGridWidth = columnWidth * fixedColumnCount;
        }
      }
      return this._leftGridWidth;
    }
  }, {
    key: "_getRightGridWidth",
    value: function _getRightGridWidth(props) {
      var width = props.width;
      var leftGridWidth = this._getLeftGridWidth(props);
      return width - leftGridWidth;
    }
  }, {
    key: "_getTopGridHeight",
    value: function _getTopGridHeight(props) {
      var fixedRowCount = props.fixedRowCount, rowHeight = props.rowHeight;
      if (this._topGridHeight == null) {
        if (typeof rowHeight === "function") {
          var topGridHeight = 0;
          for (var index2 = 0; index2 < fixedRowCount; index2++) {
            topGridHeight += rowHeight({
              index: index2
            });
          }
          this._topGridHeight = topGridHeight;
        } else {
          this._topGridHeight = rowHeight * fixedRowCount;
        }
      }
      return this._topGridHeight;
    }
  }, {
    key: "_handleInvalidatedGridSize",
    value: function _handleInvalidatedGridSize() {
      if (typeof this._deferredInvalidateColumnIndex === "number") {
        var columnIndex = this._deferredInvalidateColumnIndex;
        var rowIndex = this._deferredInvalidateRowIndex;
        this._deferredInvalidateColumnIndex = null;
        this._deferredInvalidateRowIndex = null;
        this.recomputeGridSize({
          columnIndex,
          rowIndex
        });
        this.forceUpdate();
      }
    }
    /**
     * Avoid recreating inline styles each render; this bypasses Grid's shallowCompare.
     * This method recalculates styles only when specific props change.
     */
  }, {
    key: "_maybeCalculateCachedStyles",
    value: function _maybeCalculateCachedStyles(resetAll) {
      var _this$props9 = this.props, columnWidth = _this$props9.columnWidth, enableFixedColumnScroll = _this$props9.enableFixedColumnScroll, enableFixedRowScroll = _this$props9.enableFixedRowScroll, height = _this$props9.height, fixedColumnCount = _this$props9.fixedColumnCount, fixedRowCount = _this$props9.fixedRowCount, rowHeight = _this$props9.rowHeight, style2 = _this$props9.style, styleBottomLeftGrid = _this$props9.styleBottomLeftGrid, styleBottomRightGrid = _this$props9.styleBottomRightGrid, styleTopLeftGrid = _this$props9.styleTopLeftGrid, styleTopRightGrid = _this$props9.styleTopRightGrid, width = _this$props9.width;
      var sizeChange = resetAll || height !== this._lastRenderedHeight || width !== this._lastRenderedWidth;
      var leftSizeChange = resetAll || columnWidth !== this._lastRenderedColumnWidth || fixedColumnCount !== this._lastRenderedFixedColumnCount;
      var topSizeChange = resetAll || fixedRowCount !== this._lastRenderedFixedRowCount || rowHeight !== this._lastRenderedRowHeight;
      if (resetAll || sizeChange || style2 !== this._lastRenderedStyle) {
        this._containerOuterStyle = _objectSpread$3({
          height,
          overflow: "visible",
          // Let :focus outline show through
          width
        }, style2);
      }
      if (resetAll || sizeChange || topSizeChange) {
        this._containerTopStyle = {
          height: this._getTopGridHeight(this.props),
          position: "relative",
          width
        };
        this._containerBottomStyle = {
          height: height - this._getTopGridHeight(this.props),
          overflow: "visible",
          // Let :focus outline show through
          position: "relative",
          width
        };
      }
      if (resetAll || styleBottomLeftGrid !== this._lastRenderedStyleBottomLeftGrid) {
        this._bottomLeftGridStyle = _objectSpread$3({
          left: 0,
          overflowX: "hidden",
          overflowY: enableFixedColumnScroll ? "auto" : "hidden",
          position: "absolute"
        }, styleBottomLeftGrid);
      }
      if (resetAll || leftSizeChange || styleBottomRightGrid !== this._lastRenderedStyleBottomRightGrid) {
        this._bottomRightGridStyle = _objectSpread$3({
          left: this._getLeftGridWidth(this.props),
          position: "absolute"
        }, styleBottomRightGrid);
      }
      if (resetAll || styleTopLeftGrid !== this._lastRenderedStyleTopLeftGrid) {
        this._topLeftGridStyle = _objectSpread$3({
          left: 0,
          overflowX: "hidden",
          overflowY: "hidden",
          position: "absolute",
          top: 0
        }, styleTopLeftGrid);
      }
      if (resetAll || leftSizeChange || styleTopRightGrid !== this._lastRenderedStyleTopRightGrid) {
        this._topRightGridStyle = _objectSpread$3({
          left: this._getLeftGridWidth(this.props),
          overflowX: enableFixedRowScroll ? "auto" : "hidden",
          overflowY: "hidden",
          position: "absolute",
          top: 0
        }, styleTopRightGrid);
      }
      this._lastRenderedColumnWidth = columnWidth;
      this._lastRenderedFixedColumnCount = fixedColumnCount;
      this._lastRenderedFixedRowCount = fixedRowCount;
      this._lastRenderedHeight = height;
      this._lastRenderedRowHeight = rowHeight;
      this._lastRenderedStyle = style2;
      this._lastRenderedStyleBottomLeftGrid = styleBottomLeftGrid;
      this._lastRenderedStyleBottomRightGrid = styleBottomRightGrid;
      this._lastRenderedStyleTopLeftGrid = styleTopLeftGrid;
      this._lastRenderedStyleTopRightGrid = styleTopRightGrid;
      this._lastRenderedWidth = width;
    }
  }, {
    key: "_prepareForRender",
    value: function _prepareForRender() {
      if (this._lastRenderedColumnWidth !== this.props.columnWidth || this._lastRenderedFixedColumnCount !== this.props.fixedColumnCount) {
        this._leftGridWidth = null;
      }
      if (this._lastRenderedFixedRowCount !== this.props.fixedRowCount || this._lastRenderedRowHeight !== this.props.rowHeight) {
        this._topGridHeight = null;
      }
      this._maybeCalculateCachedStyles();
      this._lastRenderedColumnWidth = this.props.columnWidth;
      this._lastRenderedFixedColumnCount = this.props.fixedColumnCount;
      this._lastRenderedFixedRowCount = this.props.fixedRowCount;
      this._lastRenderedRowHeight = this.props.rowHeight;
    }
  }, {
    key: "_renderBottomLeftGrid",
    value: function _renderBottomLeftGrid(props) {
      var enableFixedColumnScroll = props.enableFixedColumnScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, hideBottomLeftGridScrollbar = props.hideBottomLeftGridScrollbar;
      var showVerticalScrollbar = this.state.showVerticalScrollbar;
      if (!fixedColumnCount) {
        return null;
      }
      var additionalRowCount = showVerticalScrollbar ? 1 : 0, height = this._getBottomGridHeight(props), width = this._getLeftGridWidth(props), scrollbarSize2 = this.state.showVerticalScrollbar ? this.state.scrollbarSize : 0, gridWidth = hideBottomLeftGridScrollbar ? width + scrollbarSize2 : width;
      var bottomLeftGrid = /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, props, {
        cellRenderer: this._cellRendererBottomLeftGrid,
        className: this.props.classNameBottomLeftGrid,
        columnCount: fixedColumnCount,
        deferredMeasurementCache: this._deferredMeasurementCacheBottomLeftGrid,
        height,
        onScroll: enableFixedColumnScroll ? this._onScrollTop : void 0,
        ref: this._bottomLeftGridRef,
        rowCount: Math.max(0, rowCount - fixedRowCount) + additionalRowCount,
        rowHeight: this._rowHeightBottomGrid,
        style: this._bottomLeftGridStyle,
        tabIndex: null,
        width: gridWidth
      }));
      if (hideBottomLeftGridScrollbar) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: "BottomLeftGrid_ScrollWrapper",
          style: _objectSpread$3(_objectSpread$3({}, this._bottomLeftGridStyle), {}, {
            height,
            width,
            overflowY: "hidden"
          })
        }, bottomLeftGrid);
      }
      return bottomLeftGrid;
    }
  }, {
    key: "_renderBottomRightGrid",
    value: function _renderBottomRightGrid(props) {
      var columnCount = props.columnCount, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, rowCount = props.rowCount, scrollToColumn = props.scrollToColumn, scrollToRow = props.scrollToRow;
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, props, {
        cellRenderer: this._cellRendererBottomRightGrid,
        className: this.props.classNameBottomRightGrid,
        columnCount: Math.max(0, columnCount - fixedColumnCount),
        columnWidth: this._columnWidthRightGrid,
        deferredMeasurementCache: this._deferredMeasurementCacheBottomRightGrid,
        height: this._getBottomGridHeight(props),
        onScroll: this._onScroll,
        onScrollbarPresenceChange: this._onScrollbarPresenceChange,
        ref: this._bottomRightGridRef,
        rowCount: Math.max(0, rowCount - fixedRowCount),
        rowHeight: this._rowHeightBottomGrid,
        scrollToColumn: scrollToColumn - fixedColumnCount,
        scrollToRow: scrollToRow - fixedRowCount,
        style: this._bottomRightGridStyle,
        width: this._getRightGridWidth(props)
      }));
    }
  }, {
    key: "_renderTopLeftGrid",
    value: function _renderTopLeftGrid(props) {
      var fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount;
      if (!fixedColumnCount || !fixedRowCount) {
        return null;
      }
      return /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, props, {
        className: this.props.classNameTopLeftGrid,
        columnCount: fixedColumnCount,
        height: this._getTopGridHeight(props),
        ref: this._topLeftGridRef,
        rowCount: fixedRowCount,
        style: this._topLeftGridStyle,
        tabIndex: null,
        width: this._getLeftGridWidth(props)
      }));
    }
  }, {
    key: "_renderTopRightGrid",
    value: function _renderTopRightGrid(props) {
      var columnCount = props.columnCount, enableFixedRowScroll = props.enableFixedRowScroll, fixedColumnCount = props.fixedColumnCount, fixedRowCount = props.fixedRowCount, scrollLeft = props.scrollLeft, hideTopRightGridScrollbar = props.hideTopRightGridScrollbar;
      var _this$state5 = this.state, showHorizontalScrollbar = _this$state5.showHorizontalScrollbar, scrollbarSize2 = _this$state5.scrollbarSize;
      if (!fixedRowCount) {
        return null;
      }
      var additionalColumnCount = showHorizontalScrollbar ? 1 : 0, height = this._getTopGridHeight(props), width = this._getRightGridWidth(props), additionalHeight = showHorizontalScrollbar ? scrollbarSize2 : 0;
      var gridHeight = height, style2 = this._topRightGridStyle;
      if (hideTopRightGridScrollbar) {
        gridHeight = height + additionalHeight;
        style2 = _objectSpread$3(_objectSpread$3({}, this._topRightGridStyle), {}, {
          left: 0
        });
      }
      var topRightGrid = /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, props, {
        cellRenderer: this._cellRendererTopRightGrid,
        className: this.props.classNameTopRightGrid,
        columnCount: Math.max(0, columnCount - fixedColumnCount) + additionalColumnCount,
        columnWidth: this._columnWidthRightGrid,
        deferredMeasurementCache: this._deferredMeasurementCacheTopRightGrid,
        height: gridHeight,
        onScroll: enableFixedRowScroll ? this._onScrollLeft : void 0,
        ref: this._topRightGridRef,
        rowCount: fixedRowCount,
        scrollLeft,
        style: style2,
        tabIndex: null,
        width
      }));
      if (hideTopRightGridScrollbar) {
        return /* @__PURE__ */ reactExports.createElement("div", {
          className: "TopRightGrid_ScrollWrapper",
          style: _objectSpread$3(_objectSpread$3({}, this._topRightGridStyle), {}, {
            height,
            width,
            overflowX: "hidden"
          })
        }, topRightGrid);
      }
      return topRightGrid;
    }
  }], [{
    key: "getDerivedStateFromProps",
    value: function getDerivedStateFromProps(nextProps, prevState) {
      if (nextProps.scrollLeft !== prevState.scrollLeft || nextProps.scrollTop !== prevState.scrollTop) {
        return {
          scrollLeft: nextProps.scrollLeft != null && nextProps.scrollLeft >= 0 ? nextProps.scrollLeft : prevState.scrollLeft,
          scrollTop: nextProps.scrollTop != null && nextProps.scrollTop >= 0 ? nextProps.scrollTop : prevState.scrollTop
        };
      }
      return null;
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(MultiGrid, "defaultProps", {
  classNameBottomLeftGrid: "",
  classNameBottomRightGrid: "",
  classNameTopLeftGrid: "",
  classNameTopRightGrid: "",
  enableFixedColumnScroll: false,
  enableFixedRowScroll: false,
  fixedColumnCount: 0,
  fixedRowCount: 0,
  scrollToColumn: -1,
  scrollToRow: -1,
  style: {},
  styleBottomLeftGrid: {},
  styleBottomRightGrid: {},
  styleTopLeftGrid: {},
  styleTopRightGrid: {},
  hideTopRightGridScrollbar: false,
  hideBottomLeftGridScrollbar: false
});
MultiGrid.propTypes = {};
polyfill2(MultiGrid);
function _callSuper$3(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$3() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$3() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var ScrollSync = /* @__PURE__ */ function(_React$PureComponent) {
  function ScrollSync2(props, context) {
    var _this;
    _classCallCheck$a(this, ScrollSync2);
    _this = _callSuper$3(this, ScrollSync2, [props, context]);
    _this.state = {
      clientHeight: 0,
      clientWidth: 0,
      scrollHeight: 0,
      scrollLeft: 0,
      scrollTop: 0,
      scrollWidth: 0
    };
    _this._onScroll = _this._onScroll.bind(_this);
    return _this;
  }
  _inherits$a(ScrollSync2, _React$PureComponent);
  return _createClass$8(ScrollSync2, [{
    key: "render",
    value: function render3() {
      var children = this.props.children;
      var _this$state = this.state, clientHeight = _this$state.clientHeight, clientWidth = _this$state.clientWidth, scrollHeight = _this$state.scrollHeight, scrollLeft = _this$state.scrollLeft, scrollTop = _this$state.scrollTop, scrollWidth = _this$state.scrollWidth;
      return children({
        clientHeight,
        clientWidth,
        onScroll: this._onScroll,
        scrollHeight,
        scrollLeft,
        scrollTop,
        scrollWidth
      });
    }
  }, {
    key: "_onScroll",
    value: function _onScroll(_ref) {
      var clientHeight = _ref.clientHeight, clientWidth = _ref.clientWidth, scrollHeight = _ref.scrollHeight, scrollLeft = _ref.scrollLeft, scrollTop = _ref.scrollTop, scrollWidth = _ref.scrollWidth;
      this.setState({
        clientHeight,
        clientWidth,
        scrollHeight,
        scrollLeft,
        scrollTop,
        scrollWidth
      });
    }
  }]);
}(reactExports.PureComponent);
ScrollSync.propTypes = {};
function defaultCellDataGetter(_ref) {
  var dataKey = _ref.dataKey, rowData = _ref.rowData;
  if (typeof rowData.get === "function") {
    return rowData.get(dataKey);
  } else {
    return rowData[dataKey];
  }
}
function defaultCellRenderer(_ref) {
  var cellData = _ref.cellData;
  if (cellData == null) {
    return "";
  } else {
    return String(cellData);
  }
}
function defaultHeaderRowRenderer(_ref) {
  var className = _ref.className, columns = _ref.columns, style2 = _ref.style;
  return /* @__PURE__ */ reactExports.createElement("div", {
    className,
    role: "row",
    style: style2
  }, columns);
}
var SortDirection = {
  /**
   * Sort items in ascending order.
   * This means arranging from the lowest value to the highest (e.g. a-z, 0-9).
   */
  ASC: "ASC",
  /**
   * Sort items in descending order.
   * This means arranging from the highest value to the lowest (e.g. z-a, 9-0).
   */
  DESC: "DESC"
};
function SortIndicator(_ref) {
  var sortDirection = _ref.sortDirection;
  var classNames2 = clsx("ReactVirtualized__Table__sortableHeaderIcon", {
    "ReactVirtualized__Table__sortableHeaderIcon--ASC": sortDirection === SortDirection.ASC,
    "ReactVirtualized__Table__sortableHeaderIcon--DESC": sortDirection === SortDirection.DESC
  });
  return /* @__PURE__ */ reactExports.createElement("svg", {
    className: classNames2,
    width: 18,
    height: 18,
    viewBox: "0 0 24 24"
  }, sortDirection === SortDirection.ASC ? /* @__PURE__ */ reactExports.createElement("path", {
    d: "M7 14l5-5 5 5z"
  }) : /* @__PURE__ */ reactExports.createElement("path", {
    d: "M7 10l5 5 5-5z"
  }), /* @__PURE__ */ reactExports.createElement("path", {
    d: "M0 0h24v24H0z",
    fill: "none"
  }));
}
SortIndicator.propTypes = {};
function defaultHeaderRenderer(_ref) {
  var dataKey = _ref.dataKey, label = _ref.label, sortBy = _ref.sortBy, sortDirection = _ref.sortDirection;
  var showSortIndicator = sortBy === dataKey;
  var children = [/* @__PURE__ */ reactExports.createElement("span", {
    className: "ReactVirtualized__Table__headerTruncatedText",
    key: "label",
    title: typeof label === "string" ? label : null
  }, label)];
  if (showSortIndicator) {
    children.push(/* @__PURE__ */ reactExports.createElement(SortIndicator, {
      key: "SortIndicator",
      sortDirection
    }));
  }
  return children;
}
function defaultRowRenderer(_ref) {
  var className = _ref.className, columns = _ref.columns, index2 = _ref.index, key = _ref.key, onRowClick = _ref.onRowClick, onRowDoubleClick = _ref.onRowDoubleClick, onRowMouseOut = _ref.onRowMouseOut, onRowMouseOver = _ref.onRowMouseOver, onRowRightClick = _ref.onRowRightClick, rowData = _ref.rowData, style2 = _ref.style;
  var a11yProps = {
    "aria-rowindex": index2 + 1
  };
  if (onRowClick || onRowDoubleClick || onRowMouseOut || onRowMouseOver || onRowRightClick) {
    a11yProps["aria-label"] = "row";
    a11yProps.tabIndex = 0;
    if (onRowClick) {
      a11yProps.onClick = function(event) {
        return onRowClick({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowDoubleClick) {
      a11yProps.onDoubleClick = function(event) {
        return onRowDoubleClick({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowMouseOut) {
      a11yProps.onMouseOut = function(event) {
        return onRowMouseOut({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowMouseOver) {
      a11yProps.onMouseOver = function(event) {
        return onRowMouseOver({
          event,
          index: index2,
          rowData
        });
      };
    }
    if (onRowRightClick) {
      a11yProps.onContextMenu = function(event) {
        return onRowRightClick({
          event,
          index: index2,
          rowData
        });
      };
    }
  }
  return /* @__PURE__ */ reactExports.createElement("div", _extends({}, a11yProps, {
    className,
    key,
    role: "row",
    style: style2
  }), columns);
}
function _callSuper$2(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$2() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$2() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$2 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Column = /* @__PURE__ */ function(_React$Component) {
  function Column2() {
    _classCallCheck$a(this, Column2);
    return _callSuper$2(this, Column2, arguments);
  }
  _inherits$a(Column2, _React$Component);
  return _createClass$8(Column2);
}(reactExports.Component);
_defineProperty$4(Column, "defaultProps", {
  cellDataGetter: defaultCellDataGetter,
  cellRenderer: defaultCellRenderer,
  defaultSortDirection: SortDirection.ASC,
  flexGrow: 0,
  flexShrink: 1,
  headerRenderer: defaultHeaderRenderer,
  style: {}
});
Column.propTypes = {};
function ownKeys$1(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r22) {
      return Object.getOwnPropertyDescriptor(e2, r22).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$2(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys$1(Object(t2), true).forEach(function(r22) {
      _defineProperty$4(e2, r22, t2[r22]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys$1(Object(t2)).forEach(function(r22) {
      Object.defineProperty(e2, r22, Object.getOwnPropertyDescriptor(t2, r22));
    });
  }
  return e2;
}
function _callSuper$1(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct$1() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct$1() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t22) {
  }
  return (_isNativeReflectConstruct$1 = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var Table = /* @__PURE__ */ function(_React$PureComponent) {
  function Table2(props) {
    var _this;
    _classCallCheck$a(this, Table2);
    _this = _callSuper$1(this, Table2, [props]);
    _this.state = {
      scrollbarWidth: 0
    };
    _this._createColumn = _this._createColumn.bind(_this);
    _this._createRow = _this._createRow.bind(_this);
    _this._onScroll = _this._onScroll.bind(_this);
    _this._onSectionRendered = _this._onSectionRendered.bind(_this);
    _this._setRef = _this._setRef.bind(_this);
    _this._setGridElementRef = _this._setGridElementRef.bind(_this);
    return _this;
  }
  _inherits$a(Table2, _React$PureComponent);
  return _createClass$8(Table2, [{
    key: "forceUpdateGrid",
    value: function forceUpdateGrid() {
      if (this.Grid) {
        this.Grid.forceUpdate();
      }
    }
    /** See Grid#getOffsetForCell */
  }, {
    key: "getOffsetForRow",
    value: function getOffsetForRow(_ref) {
      var alignment = _ref.alignment, index2 = _ref.index;
      if (this.Grid) {
        var _this$Grid$getOffsetF = this.Grid.getOffsetForCell({
          alignment,
          rowIndex: index2
        }), scrollTop = _this$Grid$getOffsetF.scrollTop;
        return scrollTop;
      }
      return 0;
    }
    /** CellMeasurer compatibility */
  }, {
    key: "invalidateCellSizeAfterRender",
    value: function invalidateCellSizeAfterRender(_ref2) {
      var columnIndex = _ref2.columnIndex, rowIndex = _ref2.rowIndex;
      if (this.Grid) {
        this.Grid.invalidateCellSizeAfterRender({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#measureAllCells */
  }, {
    key: "measureAllRows",
    value: function measureAllRows() {
      if (this.Grid) {
        this.Grid.measureAllCells();
      }
    }
    /** CellMeasurer compatibility */
  }, {
    key: "recomputeGridSize",
    value: function recomputeGridSize() {
      var _ref3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref3$columnIndex = _ref3.columnIndex, columnIndex = _ref3$columnIndex === void 0 ? 0 : _ref3$columnIndex, _ref3$rowIndex = _ref3.rowIndex, rowIndex = _ref3$rowIndex === void 0 ? 0 : _ref3$rowIndex;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex,
          columnIndex
        });
      }
    }
    /** See Grid#recomputeGridSize */
  }, {
    key: "recomputeRowHeights",
    value: function recomputeRowHeights() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.recomputeGridSize({
          rowIndex: index2
        });
      }
    }
    /** See Grid#scrollToPosition */
  }, {
    key: "scrollToPosition",
    value: function scrollToPosition() {
      var scrollTop = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToPosition({
          scrollTop
        });
      }
    }
    /** See Grid#scrollToCell */
  }, {
    key: "scrollToRow",
    value: function scrollToRow() {
      var index2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      if (this.Grid) {
        this.Grid.scrollToCell({
          columnIndex: 0,
          rowIndex: index2
        });
      }
    }
  }, {
    key: "getScrollbarWidth",
    value: function getScrollbarWidth() {
      if (this.GridElement) {
        var _Grid = this.GridElement;
        var clientWidth = _Grid.clientWidth || 0;
        var offsetWidth = _Grid.offsetWidth || 0;
        return offsetWidth - clientWidth;
      }
      return 0;
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      this._setScrollbarWidth();
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this._setScrollbarWidth();
    }
  }, {
    key: "render",
    value: function render3() {
      var _this2 = this;
      var _this$props = this.props, children2 = _this$props.children, className = _this$props.className, disableHeader = _this$props.disableHeader, gridClassName = _this$props.gridClassName, gridStyle = _this$props.gridStyle, headerHeight = _this$props.headerHeight, headerRowRenderer = _this$props.headerRowRenderer, height = _this$props.height, id2 = _this$props.id, noRowsRenderer22 = _this$props.noRowsRenderer, rowClassName = _this$props.rowClassName, rowStyle = _this$props.rowStyle, scrollToIndex = _this$props.scrollToIndex, style2 = _this$props.style, width = _this$props.width;
      var scrollbarWidth = this.state.scrollbarWidth;
      var availableRowsHeight = disableHeader ? height : height - headerHeight;
      var rowClass = typeof rowClassName === "function" ? rowClassName({
        index: -1
      }) : rowClassName;
      var rowStyleObject = typeof rowStyle === "function" ? rowStyle({
        index: -1
      }) : rowStyle;
      this._cachedColumnStyles = [];
      reactExports.Children.toArray(children2).forEach(function(column2, index2) {
        var flexStyles = _this2._getFlexStyleForColumn(column2, column2.props.style || Column.defaultProps.style);
        _this2._cachedColumnStyles[index2] = _objectSpread$2({
          overflow: "hidden"
        }, flexStyles);
      });
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-label": this.props["aria-label"],
        "aria-labelledby": this.props["aria-labelledby"],
        "aria-colcount": reactExports.Children.toArray(children2).length,
        "aria-rowcount": this.props.rowCount,
        className: clsx("ReactVirtualized__Table", className),
        id: id2,
        role: "grid",
        style: style2
      }, !disableHeader && headerRowRenderer({
        className: clsx("ReactVirtualized__Table__headerRow", rowClass),
        columns: this._getHeaderColumns(),
        style: _objectSpread$2({
          height: headerHeight,
          overflow: "hidden",
          paddingRight: scrollbarWidth,
          width
        }, rowStyleObject)
      }), /* @__PURE__ */ reactExports.createElement(Grid, _extends({}, this.props, {
        elementRef: this._setGridElementRef,
        "aria-readonly": null,
        autoContainerWidth: true,
        className: clsx("ReactVirtualized__Table__Grid", gridClassName),
        cellRenderer: this._createRow,
        columnWidth: width,
        columnCount: 1,
        height: availableRowsHeight,
        id: void 0,
        noContentRenderer: noRowsRenderer22,
        onScroll: this._onScroll,
        onSectionRendered: this._onSectionRendered,
        ref: this._setRef,
        role: "rowgroup",
        scrollbarWidth,
        scrollToRow: scrollToIndex,
        style: _objectSpread$2(_objectSpread$2({}, gridStyle), {}, {
          overflowX: "hidden"
        })
      })));
    }
  }, {
    key: "_createColumn",
    value: function _createColumn(_ref4) {
      var column2 = _ref4.column, columnIndex = _ref4.columnIndex, isScrolling = _ref4.isScrolling, parent = _ref4.parent, rowData = _ref4.rowData, rowIndex = _ref4.rowIndex;
      var onColumnClick = this.props.onColumnClick;
      var _column$props = column2.props, cellDataGetter = _column$props.cellDataGetter, cellRenderer = _column$props.cellRenderer, className = _column$props.className, columnData = _column$props.columnData, dataKey = _column$props.dataKey, id2 = _column$props.id;
      var cellData = cellDataGetter({
        columnData,
        dataKey,
        rowData
      });
      var renderedCell = cellRenderer({
        cellData,
        columnData,
        columnIndex,
        dataKey,
        isScrolling,
        parent,
        rowData,
        rowIndex
      });
      var onClick = function onClick2(event) {
        onColumnClick && onColumnClick({
          columnData,
          dataKey,
          event
        });
      };
      var style2 = this._cachedColumnStyles[columnIndex];
      var title = typeof renderedCell === "string" ? renderedCell : null;
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-colindex": columnIndex + 1,
        "aria-describedby": id2,
        className: clsx("ReactVirtualized__Table__rowColumn", className),
        key: "Row" + rowIndex + "-Col" + columnIndex,
        onClick,
        role: "gridcell",
        style: style2,
        title
      }, renderedCell);
    }
  }, {
    key: "_createHeader",
    value: function _createHeader(_ref5) {
      var column2 = _ref5.column, index2 = _ref5.index;
      var _this$props2 = this.props, headerClassName = _this$props2.headerClassName, headerStyle = _this$props2.headerStyle, onHeaderClick = _this$props2.onHeaderClick, sort = _this$props2.sort, sortBy = _this$props2.sortBy, sortDirection = _this$props2.sortDirection;
      var _column$props2 = column2.props, columnData = _column$props2.columnData, dataKey = _column$props2.dataKey, defaultSortDirection = _column$props2.defaultSortDirection, disableSort = _column$props2.disableSort, headerRenderer = _column$props2.headerRenderer, id2 = _column$props2.id, label = _column$props2.label;
      var sortEnabled = !disableSort && sort;
      var classNames2 = clsx("ReactVirtualized__Table__headerColumn", headerClassName, column2.props.headerClassName, {
        ReactVirtualized__Table__sortableHeaderColumn: sortEnabled
      });
      var style2 = this._getFlexStyleForColumn(column2, _objectSpread$2(_objectSpread$2({}, headerStyle), column2.props.headerStyle));
      var renderedHeader = headerRenderer({
        columnData,
        dataKey,
        disableSort,
        label,
        sortBy,
        sortDirection
      });
      var headerOnClick, headerOnKeyDown, headerTabIndex, headerAriaSort, headerAriaLabel;
      if (sortEnabled || onHeaderClick) {
        var isFirstTimeSort = sortBy !== dataKey;
        var newSortDirection = isFirstTimeSort ? defaultSortDirection : sortDirection === SortDirection.DESC ? SortDirection.ASC : SortDirection.DESC;
        var onClick = function onClick2(event) {
          sortEnabled && sort({
            defaultSortDirection,
            event,
            sortBy: dataKey,
            sortDirection: newSortDirection
          });
          onHeaderClick && onHeaderClick({
            columnData,
            dataKey,
            event
          });
        };
        var onKeyDown = function onKeyDown2(event) {
          if (event.key === "Enter" || event.key === " ") {
            onClick(event);
          }
        };
        headerAriaLabel = column2.props["aria-label"] || label || dataKey;
        headerAriaSort = "none";
        headerTabIndex = 0;
        headerOnClick = onClick;
        headerOnKeyDown = onKeyDown;
      }
      if (sortBy === dataKey) {
        headerAriaSort = sortDirection === SortDirection.ASC ? "ascending" : "descending";
      }
      return /* @__PURE__ */ reactExports.createElement("div", {
        "aria-label": headerAriaLabel,
        "aria-sort": headerAriaSort,
        className: classNames2,
        id: id2,
        key: "Header-Col" + index2,
        onClick: headerOnClick,
        onKeyDown: headerOnKeyDown,
        role: "columnheader",
        style: style2,
        tabIndex: headerTabIndex
      }, renderedHeader);
    }
  }, {
    key: "_createRow",
    value: function _createRow(_ref6) {
      var _this3 = this;
      var index2 = _ref6.rowIndex, isScrolling = _ref6.isScrolling, key = _ref6.key, parent = _ref6.parent, style2 = _ref6.style;
      var _this$props3 = this.props, children2 = _this$props3.children, onRowClick = _this$props3.onRowClick, onRowDoubleClick = _this$props3.onRowDoubleClick, onRowRightClick = _this$props3.onRowRightClick, onRowMouseOver = _this$props3.onRowMouseOver, onRowMouseOut = _this$props3.onRowMouseOut, rowClassName = _this$props3.rowClassName, rowGetter = _this$props3.rowGetter, rowRenderer = _this$props3.rowRenderer, rowStyle = _this$props3.rowStyle;
      var scrollbarWidth = this.state.scrollbarWidth;
      var rowClass = typeof rowClassName === "function" ? rowClassName({
        index: index2
      }) : rowClassName;
      var rowStyleObject = typeof rowStyle === "function" ? rowStyle({
        index: index2
      }) : rowStyle;
      var rowData = rowGetter({
        index: index2
      });
      var columns = reactExports.Children.toArray(children2).map(function(column2, columnIndex) {
        return _this3._createColumn({
          column: column2,
          columnIndex,
          isScrolling,
          parent,
          rowData,
          rowIndex: index2,
          scrollbarWidth
        });
      });
      var className = clsx("ReactVirtualized__Table__row", rowClass);
      var flattenedStyle = _objectSpread$2(_objectSpread$2({}, style2), {}, {
        height: this._getRowHeight(index2),
        overflow: "hidden",
        paddingRight: scrollbarWidth
      }, rowStyleObject);
      return rowRenderer({
        className,
        columns,
        index: index2,
        isScrolling,
        key,
        onRowClick,
        onRowDoubleClick,
        onRowRightClick,
        onRowMouseOver,
        onRowMouseOut,
        rowData,
        style: flattenedStyle
      });
    }
    /**
     * Determines the flex-shrink, flex-grow, and width values for a cell (header or column).
     */
  }, {
    key: "_getFlexStyleForColumn",
    value: function _getFlexStyleForColumn(column2) {
      var customStyle = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
      var flexValue = "".concat(column2.props.flexGrow, " ").concat(column2.props.flexShrink, " ").concat(column2.props.width, "px");
      var style2 = _objectSpread$2(_objectSpread$2({}, customStyle), {}, {
        flex: flexValue,
        msFlex: flexValue,
        WebkitFlex: flexValue
      });
      if (column2.props.maxWidth) {
        style2.maxWidth = column2.props.maxWidth;
      }
      if (column2.props.minWidth) {
        style2.minWidth = column2.props.minWidth;
      }
      return style2;
    }
  }, {
    key: "_getHeaderColumns",
    value: function _getHeaderColumns() {
      var _this4 = this;
      var _this$props4 = this.props, children2 = _this$props4.children, disableHeader = _this$props4.disableHeader;
      var items = disableHeader ? [] : reactExports.Children.toArray(children2);
      return items.map(function(column2, index2) {
        return _this4._createHeader({
          column: column2,
          index: index2
        });
      });
    }
  }, {
    key: "_getRowHeight",
    value: function _getRowHeight(rowIndex) {
      var rowHeight = this.props.rowHeight;
      return typeof rowHeight === "function" ? rowHeight({
        index: rowIndex
      }) : rowHeight;
    }
  }, {
    key: "_onScroll",
    value: function _onScroll(_ref7) {
      var clientHeight = _ref7.clientHeight, scrollHeight = _ref7.scrollHeight, scrollTop = _ref7.scrollTop;
      var onScroll22 = this.props.onScroll;
      onScroll22({
        clientHeight,
        scrollHeight,
        scrollTop
      });
    }
  }, {
    key: "_onSectionRendered",
    value: function _onSectionRendered(_ref8) {
      var rowOverscanStartIndex = _ref8.rowOverscanStartIndex, rowOverscanStopIndex = _ref8.rowOverscanStopIndex, rowStartIndex = _ref8.rowStartIndex, rowStopIndex = _ref8.rowStopIndex;
      var onRowsRendered22 = this.props.onRowsRendered;
      onRowsRendered22({
        overscanStartIndex: rowOverscanStartIndex,
        overscanStopIndex: rowOverscanStopIndex,
        startIndex: rowStartIndex,
        stopIndex: rowStopIndex
      });
    }
  }, {
    key: "_setRef",
    value: function _setRef(ref) {
      this.Grid = ref;
    }
  }, {
    key: "_setGridElementRef",
    value: function _setGridElementRef(ref) {
      this.GridElement = ref;
    }
  }, {
    key: "_setScrollbarWidth",
    value: function _setScrollbarWidth() {
      var scrollbarWidth = this.getScrollbarWidth();
      this.setState({
        scrollbarWidth
      });
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(Table, "defaultProps", {
  disableHeader: false,
  estimatedRowSize: 30,
  headerHeight: 0,
  headerStyle: {},
  noRowsRenderer: function noRowsRenderer2() {
    return null;
  },
  onRowsRendered: function onRowsRendered2() {
    return null;
  },
  onScroll: function onScroll4() {
    return null;
  },
  overscanIndicesGetter: defaultOverscanIndicesGetter,
  overscanRowCount: 10,
  rowRenderer: defaultRowRenderer,
  headerRowRenderer: defaultHeaderRowRenderer,
  rowStyle: {},
  scrollToAlignment: "auto",
  scrollToIndex: -1,
  style: {}
});
Table.propTypes = {};
var mountedInstances = [];
var originalBodyPointerEvents = null;
var disablePointerEventsTimeoutId = null;
function enablePointerEventsIfDisabled() {
  if (disablePointerEventsTimeoutId) {
    disablePointerEventsTimeoutId = null;
    if (document.body && originalBodyPointerEvents != null) {
      document.body.style.pointerEvents = originalBodyPointerEvents;
    }
    originalBodyPointerEvents = null;
  }
}
function enablePointerEventsAfterDelayCallback() {
  enablePointerEventsIfDisabled();
  mountedInstances.forEach(function(instance2) {
    return instance2.__resetIsScrolling();
  });
}
function enablePointerEventsAfterDelay() {
  if (disablePointerEventsTimeoutId) {
    cancelAnimationTimeout(disablePointerEventsTimeoutId);
  }
  var maximumTimeout = 0;
  mountedInstances.forEach(function(instance2) {
    maximumTimeout = Math.max(maximumTimeout, instance2.props.scrollingResetTimeInterval);
  });
  disablePointerEventsTimeoutId = requestAnimationTimeout(enablePointerEventsAfterDelayCallback, maximumTimeout);
}
function onScrollWindow(event) {
  if (event.currentTarget === window && originalBodyPointerEvents == null && document.body) {
    originalBodyPointerEvents = document.body.style.pointerEvents;
    document.body.style.pointerEvents = "none";
  }
  enablePointerEventsAfterDelay();
  mountedInstances.forEach(function(instance2) {
    if (instance2.props.scrollElement === event.currentTarget) {
      instance2.__handleWindowScrollEvent();
    }
  });
}
function registerScrollListener(component, element2) {
  if (!mountedInstances.some(function(instance2) {
    return instance2.props.scrollElement === element2;
  })) {
    element2.addEventListener("scroll", onScrollWindow);
  }
  mountedInstances.push(component);
}
function unregisterScrollListener(component, element2) {
  mountedInstances = mountedInstances.filter(function(instance2) {
    return instance2 !== component;
  });
  if (!mountedInstances.length) {
    element2.removeEventListener("scroll", onScrollWindow);
    if (disablePointerEventsTimeoutId) {
      cancelAnimationTimeout(disablePointerEventsTimeoutId);
      enablePointerEventsIfDisabled();
    }
  }
}
var isWindow = function isWindow2(element2) {
  return element2 === window;
};
var getBoundingBox = function getBoundingBox2(element2) {
  return element2.getBoundingClientRect();
};
function getDimensions(scrollElement, props) {
  if (!scrollElement) {
    return {
      height: props.serverHeight,
      width: props.serverWidth
    };
  } else if (isWindow(scrollElement)) {
    var _window = window, innerHeight2 = _window.innerHeight, innerWidth2 = _window.innerWidth;
    return {
      height: typeof innerHeight2 === "number" ? innerHeight2 : 0,
      width: typeof innerWidth2 === "number" ? innerWidth2 : 0
    };
  } else {
    return getBoundingBox(scrollElement);
  }
}
function getPositionOffset(element2, container) {
  if (isWindow(container) && document.documentElement) {
    var containerElement = document.documentElement;
    var elementRect = getBoundingBox(element2);
    var containerRect = getBoundingBox(containerElement);
    return {
      top: elementRect.top - containerRect.top,
      left: elementRect.left - containerRect.left
    };
  } else {
    var scrollOffset = getScrollOffset(container);
    var _elementRect = getBoundingBox(element2);
    var _containerRect = getBoundingBox(container);
    return {
      top: _elementRect.top + scrollOffset.top - _containerRect.top,
      left: _elementRect.left + scrollOffset.left - _containerRect.left
    };
  }
}
function getScrollOffset(element2) {
  if (isWindow(element2) && document.documentElement) {
    return {
      top: "scrollY" in window ? window.scrollY : document.documentElement.scrollTop,
      left: "scrollX" in window ? window.scrollX : document.documentElement.scrollLeft
    };
  } else {
    return {
      top: element2.scrollTop,
      left: element2.scrollLeft
    };
  }
}
function ownKeys(e2, r2) {
  var t2 = Object.keys(e2);
  if (Object.getOwnPropertySymbols) {
    var o2 = Object.getOwnPropertySymbols(e2);
    r2 && (o2 = o2.filter(function(r3) {
      return Object.getOwnPropertyDescriptor(e2, r3).enumerable;
    })), t2.push.apply(t2, o2);
  }
  return t2;
}
function _objectSpread$1(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? arguments[r2] : {};
    r2 % 2 ? ownKeys(Object(t2), true).forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e2, Object.getOwnPropertyDescriptors(t2)) : ownKeys(Object(t2)).forEach(function(r3) {
      Object.defineProperty(e2, r3, Object.getOwnPropertyDescriptor(t2, r3));
    });
  }
  return e2;
}
function _callSuper(t2, o2, e2) {
  return o2 = _getPrototypeOf(o2), _possibleConstructorReturn$a(t2, _isNativeReflectConstruct() ? Reflect.construct(o2, e2 || [], _getPrototypeOf(t2).constructor) : o2.apply(t2, e2));
}
function _isNativeReflectConstruct() {
  try {
    var t2 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
    }));
  } catch (t3) {
  }
  return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
    return !!t2;
  })();
}
var IS_SCROLLING_TIMEOUT = 150;
var getWindow$1 = function getWindow() {
  return typeof window !== "undefined" ? window : void 0;
};
var WindowScroller = /* @__PURE__ */ function(_React$PureComponent) {
  function WindowScroller2() {
    var _this;
    _classCallCheck$a(this, WindowScroller2);
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _callSuper(this, WindowScroller2, [].concat(args));
    _defineProperty$4(_this, "_window", getWindow$1());
    _defineProperty$4(_this, "_isMounted", false);
    _defineProperty$4(_this, "_positionFromTop", 0);
    _defineProperty$4(_this, "_positionFromLeft", 0);
    _defineProperty$4(_this, "_detectElementResize", void 0);
    _defineProperty$4(_this, "_child", void 0);
    _defineProperty$4(_this, "_windowScrollerRef", /* @__PURE__ */ reactExports.createRef());
    _defineProperty$4(_this, "state", _objectSpread$1(_objectSpread$1({}, getDimensions(_this.props.scrollElement, _this.props)), {}, {
      isScrolling: false,
      scrollLeft: 0,
      scrollTop: 0
    }));
    _defineProperty$4(_this, "_registerChild", function(element2) {
      if (element2 && !(element2 instanceof Element)) {
        console.warn("WindowScroller registerChild expects to be passed Element or null");
      }
      _this._child = element2;
      _this.updatePosition();
    });
    _defineProperty$4(_this, "_onChildScroll", function(_ref) {
      var scrollTop = _ref.scrollTop;
      if (_this.state.scrollTop === scrollTop) {
        return;
      }
      var scrollElement = _this.props.scrollElement;
      if (scrollElement) {
        if (typeof scrollElement.scrollTo === "function") {
          scrollElement.scrollTo(0, scrollTop + _this._positionFromTop);
        } else {
          scrollElement.scrollTop = scrollTop + _this._positionFromTop;
        }
      }
    });
    _defineProperty$4(_this, "_registerResizeListener", function(element2) {
      if (element2 === window) {
        window.addEventListener("resize", _this._onResize, false);
      } else {
        _this._detectElementResize.addResizeListener(element2, _this._onResize);
      }
    });
    _defineProperty$4(_this, "_unregisterResizeListener", function(element2) {
      if (element2 === window) {
        window.removeEventListener("resize", _this._onResize, false);
      } else if (element2) {
        _this._detectElementResize.removeResizeListener(element2, _this._onResize);
      }
    });
    _defineProperty$4(_this, "_onResize", function() {
      _this.updatePosition();
    });
    _defineProperty$4(_this, "__handleWindowScrollEvent", function() {
      if (!_this._isMounted) {
        return;
      }
      var onScroll6 = _this.props.onScroll;
      var scrollElement = _this.props.scrollElement;
      if (scrollElement) {
        var scrollOffset = getScrollOffset(scrollElement);
        var scrollLeft = Math.max(0, scrollOffset.left - _this._positionFromLeft);
        var scrollTop = Math.max(0, scrollOffset.top - _this._positionFromTop);
        _this.setState({
          isScrolling: true,
          scrollLeft,
          scrollTop
        });
        onScroll6({
          scrollLeft,
          scrollTop
        });
      }
    });
    _defineProperty$4(_this, "__resetIsScrolling", function() {
      _this.setState({
        isScrolling: false
      });
    });
    return _this;
  }
  _inherits$a(WindowScroller2, _React$PureComponent);
  return _createClass$8(WindowScroller2, [{
    key: "updatePosition",
    value: function updatePosition() {
      var scrollElement = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.scrollElement;
      var onResize4 = this.props.onResize;
      var _this$state = this.state, height = _this$state.height, width = _this$state.width;
      var thisNode = this._child || this._windowScrollerRef.current;
      if (thisNode instanceof Element && scrollElement) {
        var offset2 = getPositionOffset(thisNode, scrollElement);
        this._positionFromTop = offset2.top;
        this._positionFromLeft = offset2.left;
      }
      var dimensions = getDimensions(scrollElement, this.props);
      if (height !== dimensions.height || width !== dimensions.width) {
        this.setState({
          height: dimensions.height,
          width: dimensions.width
        });
        onResize4({
          height: dimensions.height,
          width: dimensions.width
        });
      }
      if (this.props.updateScrollTopOnUpdatePosition === true) {
        this.__handleWindowScrollEvent();
        this.__resetIsScrolling();
      }
    }
  }, {
    key: "componentDidMount",
    value: function componentDidMount() {
      var scrollElement = this.props.scrollElement;
      this._detectElementResize = createDetectElementResize();
      this.updatePosition(scrollElement);
      if (scrollElement) {
        registerScrollListener(this, scrollElement);
        this._registerResizeListener(scrollElement);
      }
      this._isMounted = true;
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate(prevProps, prevState) {
      var scrollElement = this.props.scrollElement;
      var prevScrollElement = prevProps.scrollElement;
      if (prevScrollElement !== scrollElement && prevScrollElement != null && scrollElement != null) {
        this.updatePosition(scrollElement);
        unregisterScrollListener(this, prevScrollElement);
        registerScrollListener(this, scrollElement);
        this._unregisterResizeListener(prevScrollElement);
        this._registerResizeListener(scrollElement);
      }
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      var scrollElement = this.props.scrollElement;
      if (scrollElement) {
        unregisterScrollListener(this, scrollElement);
        this._unregisterResizeListener(scrollElement);
      }
      this._isMounted = false;
    }
  }, {
    key: "render",
    value: function render3() {
      var children = this.props.children;
      var _this$state2 = this.state, isScrolling = _this$state2.isScrolling, scrollTop = _this$state2.scrollTop, scrollLeft = _this$state2.scrollLeft, height = _this$state2.height, width = _this$state2.width;
      return /* @__PURE__ */ reactExports.createElement("div", {
        ref: this._windowScrollerRef
      }, children({
        onChildScroll: this._onChildScroll,
        registerChild: this._registerChild,
        height,
        isScrolling,
        scrollLeft,
        scrollTop,
        width
      }));
    }
  }]);
}(reactExports.PureComponent);
_defineProperty$4(WindowScroller, "defaultProps", {
  onResize: function onResize3() {
  },
  onScroll: function onScroll5() {
  },
  scrollingResetTimeInterval: IS_SCROLLING_TIMEOUT,
  scrollElement: getWindow$1(),
  serverHeight: 0,
  serverWidth: 0
});
function detectCommonPrefix(paths) {
  if (paths.length === 0)
    return "";
  if (paths.length === 1) {
    const lastSep = Math.max(paths[0].lastIndexOf("/"), paths[0].lastIndexOf("\\"));
    return lastSep >= 0 ? paths[0].substring(0, lastSep + 1) : "";
  }
  const dirs = paths.map((p2) => {
    const lastSep = Math.max(p2.lastIndexOf("/"), p2.lastIndexOf("\\"));
    return lastSep >= 0 ? p2.substring(0, lastSep + 1) : "";
  });
  let prefix = dirs[0];
  for (let i2 = 1; i2 < dirs.length; i2++) {
    while (!dirs[i2].startsWith(prefix) && prefix.length > 0) {
      const lastSep = Math.max(
        prefix.lastIndexOf("/", prefix.length - 2),
        prefix.lastIndexOf("\\", prefix.length - 2)
      );
      prefix = lastSep >= 0 ? prefix.substring(0, lastSep + 1) : "";
    }
    if (prefix.length === 0)
      break;
  }
  return prefix;
}
function computeDiff(original, modified) {
  if (original === modified) {
    return {
      commonPrefix: original,
      commonSuffix: "",
      removedPart: "",
      addedPart: ""
    };
  }
  let prefixLen = 0;
  const minLen = Math.min(original.length, modified.length);
  while (prefixLen < minLen && original[prefixLen] === modified[prefixLen]) {
    prefixLen++;
  }
  let suffixLen = 0;
  while (suffixLen < original.length - prefixLen && suffixLen < modified.length - prefixLen && original[original.length - 1 - suffixLen] === modified[modified.length - 1 - suffixLen]) {
    suffixLen++;
  }
  return {
    commonPrefix: original.substring(0, prefixLen),
    commonSuffix: original.substring(original.length - suffixLen),
    removedPart: original.substring(prefixLen, original.length - suffixLen),
    addedPart: modified.substring(prefixLen, modified.length - suffixLen)
  };
}
const DiffHighlight = ({
  original,
  modified,
  className = ""
}) => {
  const diff2 = computeDiff(original, modified);
  if (original === modified) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, children: original });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: diff2.commonPrefix }),
    diff2.removedPart && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-red-200 text-red-800 line-through dark:bg-red-900 dark:text-red-200", children: diff2.removedPart }),
    diff2.addedPart && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-green-200 text-green-800 dark:bg-green-900 dark:text-green-200", children: diff2.addedPart }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: diff2.commonSuffix })
  ] });
};
const PreviewItem = ({
  result,
  showFullPaths,
  commonPrefix: commonPrefix2,
  style: style2
}) => {
  const originalDisplay = showFullPaths ? result.originalPath : result.originalFileName;
  const modifiedDisplay = showFullPaths ? result.modifiedPath : result.modifiedFileName;
  const hasChanged = originalDisplay !== modifiedDisplay;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "flex items-center gap-2 py-1 px-2 hover:bg-default-100 rounded",
      style: { fontSize: "12px", ...style2 },
      title: hasChanged ? `${originalDisplay} → ${modifiedDisplay}` : originalDisplay,
      children: hasChanged ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        DiffHighlight,
        {
          className: "flex-1 min-w-0 truncate",
          modified: modifiedDisplay,
          original: originalDisplay
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60 flex-1 min-w-0 truncate", children: originalDisplay })
    }
  );
};
const ROW_HEIGHT$1 = 32;
const PreviewList = ({
  results,
  showFullPaths,
  commonPrefix: commonPrefix2,
  isLoading
}) => {
  const { t: t2 } = useTranslation();
  if (isLoading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 text-center py-5", children: t2("FileNameModifier.Loading") });
  }
  if (!results.length) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-gray-400 text-center py-5", children: t2("FileNameModifier.NoPreviewResults") });
  }
  const rowRenderer = ({ index: index2, key, style: style2 }) => {
    const result = results[index2];
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PreviewItem,
      {
        commonPrefix: commonPrefix2,
        result,
        showFullPaths,
        style: style2
      },
      result.originalPath
    );
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "preview-list min-h-0 h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    List,
    {
      height: height || 300,
      overscanRowCount: 5,
      rowCount: results.length,
      rowHeight: ROW_HEIGHT$1,
      rowRenderer,
      width: width || 400
    }
  ) }) });
};
function useFileNameModifier(initialFilePaths = []) {
  const [operations, setOperations] = reactExports.useState([]);
  const [filePaths, setFilePaths] = reactExports.useState(initialFilePaths);
  const [previewResults, setPreviewResults] = reactExports.useState([]);
  const [error2, setError] = reactExports.useState("");
  const [isPreviewLoading, setIsPreviewLoading] = reactExports.useState(false);
  const [lastFilePaths, setLastFilePaths] = reactExports.useState(null);
  const initializedRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (!initializedRef.current && initialFilePaths.length > 0) {
      setFilePaths(initialFilePaths);
      initializedRef.current = true;
    }
  }, [initialFilePaths]);
  return {
    operations,
    setOperations,
    filePaths,
    setFilePaths,
    previewResults,
    setPreviewResults,
    error: error2,
    setError,
    isPreviewLoading,
    setIsPreviewLoading,
    lastFilePaths,
    setLastFilePaths
  };
}
let operationIdCounter = 0;
const generateOperationId = () => `op-${Date.now()}-${operationIdCounter++}`;
const createDefaultOperation = () => ({
  id: generateOperationId(),
  target: 2,
  // FileNameWithoutExtension
  operation: 1,
  position: 1,
  positionIndex: 0,
  targetText: "",
  text: "",
  deleteCount: 0,
  deleteStartPosition: 0,
  caseType: 1,
  dateTimeFormat: "",
  alphabetStartChar: "A",
  alphabetCount: 0,
  replaceEntire: false
});
const FileNameModifier = ({
  initialFilePaths = [],
  onClose
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    operations,
    setOperations,
    filePaths,
    setFilePaths,
    previewResults,
    setPreviewResults,
    error: error2,
    setError,
    isPreviewLoading,
    setIsPreviewLoading,
    lastFilePaths,
    setLastFilePaths
  } = useFileNameModifier(initialFilePaths);
  const [showTextarea, setShowTextarea] = reactExports.useState(false);
  const [showFullPaths, setShowFullPaths] = reactExports.useState(false);
  const [modifying, setModifying] = reactExports.useState(false);
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const handleDragEnd = reactExports.useCallback(
    (event) => {
      const { active: active3, over } = event;
      if (over && active3.id !== over.id) {
        setOperations((ops) => {
          const oldIndex = ops.findIndex((op) => op.id === active3.id);
          const newIndex = ops.findIndex((op) => op.id === over.id);
          return arrayMove(ops, oldIndex, newIndex);
        });
      }
    },
    [setOperations]
  );
  const handleOperationChange = reactExports.useCallback(
    (id2, op) => {
      setOperations((ops) => ops.map((item) => item.id === id2 ? op : item));
    },
    [setOperations]
  );
  const handleOperationDelete = reactExports.useCallback(
    (id2) => {
      setOperations((ops) => ops.filter((op) => op.id !== id2));
    },
    [setOperations]
  );
  const handleOperationCopy = reactExports.useCallback(
    (id2) => {
      setOperations((ops) => {
        const idx = ops.findIndex((op) => op.id === id2);
        if (idx === -1)
          return ops;
        const next2 = [...ops];
        const copy2 = {
          ...ops[idx],
          id: generateOperationId()
        };
        next2.splice(idx + 1, 0, copy2);
        return next2;
      });
    },
    [setOperations]
  );
  const handleAddOperation = reactExports.useCallback(() => {
    setOperations((ops) => [...ops, createDefaultOperation()]);
  }, [setOperations]);
  const handleRestoreFilePaths = reactExports.useCallback(() => {
    if (lastFilePaths) {
      setFilePaths(lastFilePaths);
      setLastFilePaths(null);
    }
  }, [lastFilePaths, setFilePaths, setLastFilePaths]);
  const handleConfirmPaths = () => {
    const paths = filePaths.join("\n").split("\n").map((f2) => f2.trim()).filter(Boolean);
    setFilePaths(paths);
    setShowTextarea(false);
  };
  const handleShowFileListEdit = () => {
    setShowTextarea(true);
  };
  const handleDeduplicatePaths = () => {
    setFilePaths(
      (paths) => Array.from(new Set(paths.map((f2) => f2.trim()).filter(Boolean)))
    );
  };
  const commonPrefix2 = reactExports.useMemo(
    () => detectCommonPrefix(previewResults.map((r2) => r2.originalPath)),
    [previewResults]
  );
  const hasAnyChanges = reactExports.useMemo(
    () => previewResults.some((r2) => r2.originalPath !== r2.modifiedPath),
    [previewResults]
  );
  const debounceTimer = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (debounceTimer.current)
      clearTimeout(debounceTimer.current);
    if (filePaths.length === 0) {
      setPreviewResults([]);
      return;
    }
    const validOperations = operations.filter((op) => !validateOperation(op));
    debounceTimer.current = setTimeout(() => {
      (async () => {
        try {
          setError("");
          setIsPreviewLoading(true);
          const rsp = await BApi$1.fileNameModifier.previewFileNameModification({
            filePaths,
            operations: validOperations
          });
          let modifiedPaths = rsp.data ?? [];
          const results = filePaths.map((originalPath, i2) => {
            const modifiedPath = modifiedPaths[i2] || originalPath;
            const getFileName = (p2) => p2.split(/[\\/]/).pop() || "";
            return {
              originalPath,
              modifiedPath,
              originalFileName: getFileName(originalPath),
              modifiedFileName: getFileName(modifiedPath),
              commonPrefix: "",
              originalRelative: "",
              modifiedRelative: ""
            };
          });
          setPreviewResults(results);
        } catch (e2) {
          setError((e2 == null ? void 0 : e2.message) || t2("FileNameModifier.PreviewFailed"));
        } finally {
          setIsPreviewLoading(false);
        }
      })();
    }, 300);
    return () => {
      if (debounceTimer.current)
        clearTimeout(debounceTimer.current);
    };
  }, [filePaths, operations]);
  const handleExecuteModification = async () => {
    const validOperations = operations.filter((op) => !validateOperation(op));
    if (validOperations.length === 0) {
      setError(t2("FileNameModifier.Error.NoValidOperation"));
      return;
    }
    try {
      setModifying(true);
      setError("");
      setLastFilePaths([...filePaths]);
      const rsp = await BApi$1.fileNameModifier.modifyFileNames({
        filePaths,
        operations: validOperations
      });
      const result = rsp.data ?? [];
      const newFilePaths = filePaths.map((oldPath) => {
        const resultItem = result.find((r2) => r2.oldPath === oldPath);
        return (resultItem == null ? void 0 : resultItem.success) && resultItem.newPath ? resultItem.newPath : oldPath;
      });
      setFilePaths(newFilePaths);
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("FileNameModifier.ModificationResult"),
        size: "xl",
        footer: {
          actions: ["cancel"]
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-green-600 font-semibold mr-4", children: t2("FileNameModifier.ModificationSuccessCount", {
              count: result.filter((r2) => r2.success).length
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-red-600 font-semibold", children: t2("FileNameModifier.ModificationFailCount", {
              count: result.filter((r2) => !r2.success).length
            }) })
          ] }),
          result.filter((r2) => !r2.success).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-h-48 overflow-y-auto border rounded p-2 bg-background border border-default", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold mb-1", children: t2("FileNameModifier.ModificationFailList") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "text-xs", children: result.filter((r2) => !r2.success).map((item) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "mb-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-foreground", children: item.oldPath }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-red-500 ml-2", children: [
                t2("FileNameModifier.ModificationFailReason"),
                ": ",
                item.error
              ] })
            ] }, item.oldPath)) })
          ] })
        ] })
      });
      setModifying(false);
    } catch (e2) {
      setModifying(false);
      setLastFilePaths(null);
      setError((e2 == null ? void 0 : e2.message) || t2("FileNameModifier.ModificationFailed"));
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col min-h-0 grow md:flex-row gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "flex-1 flex flex-col min-w-0 p-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h5", { className: "font-semibold mb-2", children: t2("FileNameModifier.OperationsList") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto rounded p-2", children: [
        operations.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-gray-400", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-4xl mb-2" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm mb-3", children: t2("FileNameModifier.EmptyOperationsHint") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", variant: "flat", onClick: handleAddOperation, children: t2("FileNameModifier.AddFirstOperation") })
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          DndContext,
          {
            collisionDetection: closestCenter,
            sensors,
            onDragEnd: handleDragEnd,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              SortableContext$1,
              {
                items: operations.map((op) => op.id),
                strategy: verticalListSortingStrategy,
                children: operations.map((op, idx) => {
                  const validationError = validateOperation(op);
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    SortableOperationCard,
                    {
                      errors: validationError ? t2(validationError) : "",
                      id: op.id,
                      index: idx,
                      operation: op,
                      onChange: (op2) => handleOperationChange(op.id, { ...op2, id: op.id }),
                      onCopy: () => handleOperationCopy(op.id),
                      onDelete: () => handleOperationDelete(op.id)
                    },
                    op.id
                  );
                })
              }
            )
          }
        ),
        operations.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            "aria-label": t2("FileNameModifier.AddOperation"),
            className: "w-full mt-2",
            variant: "light",
            onClick: handleAddOperation,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
              t2("FileNameModifier.AddOperation")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.ExecuteModification"),
              color: "primary",
              isDisabled: !hasAnyChanges || isPreviewLoading,
              isLoading: modifying,
              variant: "solid",
              onClick: handleExecuteModification,
              children: t2("FileNameModifier.ExecuteModification")
            }
          ),
          lastFilePaths && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              "aria-label": t2("FileNameModifier.RestoreOriginalPaths"),
              color: "warning",
              variant: "flat",
              onClick: handleRestoreFilePaths,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineUndo, { className: "text-lg" }),
                t2("FileNameModifier.RestoreOriginalPaths")
              ]
            }
          )
        ] }),
        error2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-xs mt-2", children: error2 })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "flex-1 flex flex-col min-w-0 p-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex justify-between items-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("h5", { className: "font-semibold mb-0 flex items-center gap-1", children: [
          showTextarea ? t2("FileNameModifier.EditFileList") : t2("FileNameModifier.PreviewResults"),
          !showTextarea && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              "aria-label": showFullPaths ? t2("FileNameModifier.HideFullPaths") : t2("FileNameModifier.ShowFullPaths"),
              className: "text-xs",
              size: "sm",
              variant: "light",
              onClick: () => setShowFullPaths(!showFullPaths),
              children: [
                showFullPaths ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEyeInvisible, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEye, { className: "text-base" }),
                showFullPaths ? t2("FileNameModifier.HideFullPaths") : t2("FileNameModifier.ShowFullPaths")
              ]
            }
          )
        ] }),
        !showTextarea && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            "aria-label": t2("FileNameModifier.EditFileList"),
            size: "sm",
            variant: "light",
            onClick: handleShowFileListEdit,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" }),
              t2("FileNameModifier.EditFileList")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 rounded min-h-0", children: showTextarea ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          textarea_default,
          {
            "aria-label": t2("FileNameModifier.FilePathsTextarea"),
            maxRows: 15,
            minRows: 10,
            placeholder: t2("FileNameModifier.FilePathsPlaceholder"),
            value: filePaths.join("\n"),
            onValueChange: (e2) => setFilePaths(e2.split("\n"))
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-wrap gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.ConfirmPaths"),
              color: "primary",
              size: "sm",
              variant: "solid",
              onClick: handleConfirmPaths,
              children: t2("FileNameModifier.ConfirmPaths")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.Deduplicate"),
              color: "secondary",
              size: "sm",
              variant: "light",
              onClick: handleDeduplicatePaths,
              children: t2("FileNameModifier.Deduplicate")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              "aria-label": t2("FileNameModifier.Cancel"),
              size: "sm",
              variant: "flat",
              onClick: () => setShowTextarea(false),
              children: t2("FileNameModifier.Cancel")
            }
          )
        ] })
      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        PreviewList,
        {
          commonPrefix: commonPrefix2,
          isLoading: isPreviewLoading,
          results: previewResults,
          showFullPaths
        }
      ) })
    ] })
  ] });
};
const BetaChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "warning",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2("BetaFeature.UnstableWarning"),
    /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
    t2("BetaFeature.BackupWarning")
  ] });
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Beta") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      delay: 2e3,
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
BetaChip.displayName = "BetaChip";
const FileNameModifierModal = ({
  onClose,
  initialFilePaths = []
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: null,
      size: "7xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        t2("FileNameModifier.Title"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
      ] }),
      onClose,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileNameModifier, { initialFilePaths, onClose })
    }
  );
};
const getFileIcon = (item) => {
  if (item.isDirectory) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-lg" });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$N, { className: "text-lg" });
  }
};
function PathAutocomplete({
  value: propsValue,
  defaultValue: defaultValue2,
  onChange,
  onSelectionChange,
  pathType = "folder",
  maxResults = 10,
  debounceDelay = 300,
  ...autocompleteProps
}) {
  const [autocompleteItems, setAutocompleteItems] = reactExports.useState([]);
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [value2, setValue] = reactExports.useState(propsValue ?? defaultValue2);
  const valueRef = reactExports.useRef(value2);
  const isFirstRender = reactExports.useRef(true);
  const searchPaths = reactExports.useCallback(
    (prefix) => {
      setIsLoading(true);
      const reqPrefix = prefix && prefix.length >= 1 ? prefix : void 0;
      BApi$1.file.searchFileSystemEntries({
        prefix: reqPrefix,
        maxResults
      }).then((response) => {
        if (response.data) {
          let filteredItems = response.data;
          if (pathType === "folder") {
            filteredItems = response.data.filter(
              (item) => item.isDirectory
            );
          }
          setAutocompleteItems(filteredItems);
        }
      }).finally(() => {
        setIsLoading(false);
      });
    },
    [pathType, maxResults]
  );
  useDebounce(
    () => {
      if (isFirstRender.current) {
        isFirstRender.current = false;
        return;
      }
      searchPaths(value2);
    },
    debounceDelay,
    [value2]
  );
  useUpdateEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  useUpdateEffect(() => {
    searchPaths(valueRef.current);
  }, [pathType, maxResults]);
  const handleInputChange = (inputValue) => {
    const item = autocompleteItems.find((it) => it.path === inputValue);
    setValue(inputValue);
    onChange == null ? void 0 : onChange(
      inputValue,
      item ? item.isDirectory ? "folder" : "file" : void 0
    );
  };
  const handleSelectionChange = (key) => {
    if (key) {
      const selectedPath = key;
      const item = autocompleteItems.find((it) => it.path === selectedPath);
      const type4 = item.isDirectory ? "folder" : "file";
      setValue(selectedPath);
      onChange == null ? void 0 : onChange(selectedPath, type4);
      onSelectionChange == null ? void 0 : onSelectionChange(selectedPath, type4);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    autocomplete_default,
    {
      ...autocompleteProps,
      allowsCustomValue: true,
      inputValue: value2,
      isLoading,
      items: autocompleteItems,
      onInputChange: handleInputChange,
      onOpenChange: (isOpen) => {
        if (isOpen && autocompleteItems.length == 0) {
          searchPaths(value2);
        }
      },
      onSelectionChange: handleSelectionChange,
      children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        listbox_item_base_default,
        {
          startContent: getFileIcon(item),
          title: item.path
        },
        item.path
      )
    }
  );
}
const CustomPathSelectorInner = (props) => {
  var _a2;
  const { onSelect, mlPaths } = props;
  const { t: t2 } = useTranslation();
  const fsOptions = useFileSystemOptionsStore((state) => state);
  const paths = ((_a2 = fsOptions.data) == null ? void 0 : _a2.recentMovingDestinations) ?? [];
  const [manualPath, setManualPath] = reactExports.useState("");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: paths.map((p2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "default",
            size: "sm",
            variant: "light",
            onPress: () => {
              navigator.clipboard.writeText(p2);
              toast.success(t2("common.tip.pathCopied"));
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await fsOptions.patch({
                recentMovingDestinations: paths.filter((p22) => p22 !== p22)
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
          }
        )
      ] }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: mlPaths.has(p2) ? "success" : "primary",
          size: "sm",
          variant: "light",
          onClick: () => onSelect(p2),
          children: p2
        },
        p2
      ) }) }, p2);
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PathAutocomplete,
        {
          pathType: "folder",
          placeholder: t2("folderSelector.placeholder.manuallyEnterPath"),
          size: "sm",
          value: manualPath,
          onChange: setManualPath
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "success",
          size: "sm",
          variant: "flat",
          onPress: () => onSelect(manualPath),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-lg" })
        }
      )
    ] })
  ] });
};
const MediaLibraryPathSelectorInner = (props) => {
  const { t: t2 } = useTranslation();
  const { onSelect } = props;
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryV2.getAllMediaLibraryV2().then((r2) => {
      var _a2;
      setMediaLibraries(r2.data ?? []);
      props.onPathsLoaded(new Set(((_a2 = r2.data) == null ? void 0 : _a2.flatMap((ml2) => ml2.paths ?? [])) ?? []));
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-x-2 items-center", style: { gridTemplateColumns: "auto 1fr" }, children: mediaLibraries.map((ml2) => {
    var _a2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: ml2.name }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: (_a2 = ml2.paths) == null ? void 0 : _a2.map((p2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "default",
            size: "sm",
            variant: "light",
            onPress: () => {
              navigator.clipboard.writeText(p2);
              toast.success(t2("Path copied to clipboard"));
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" })
          }
        ) }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "success",
            size: "sm",
            variant: "light",
            onPress: () => onSelect(p2, ml2.id),
            children: p2
          },
          p2
        ) });
      }) })
    ] });
  }) });
};
const FolderSelectorInner = ({ sources, onSelect: propsOnSelect }) => {
  const { t: t2 } = useTranslation();
  const [mlPaths, setMlPaths] = reactExports.useState(/* @__PURE__ */ new Set());
  const onSelect = async (path) => {
    await BApi$1.options.addLatestMovingDestination(path);
    propsOnSelect(path);
  };
  const onPathsLoaded = (paths) => {
    setMlPaths(paths);
  };
  const renderSourceInner = (source2) => {
    switch (source2) {
      case "media library":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          MediaLibraryPathSelectorInner,
          {
            onSelect,
            onPathsLoaded
          }
        );
      case "custom":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(CustomPathSelectorInner, { onSelect, mlPaths });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_default, { hideIndicator: true, selectedKeys: sources.map((s2) => s2), variant: "splitted", children: sources.map((s2) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { "aria-label": t2(s2), title: t2(s2), children: renderSourceInner(s2) }, s2);
  }) });
};
const FolderSelector = (props) => {
  const { t: t2 } = useTranslation();
  const { sources, onSelect: propsOnSelect, onDestroyed } = props;
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      visible,
      onClose: () => setVisible(false),
      title: t2("Select Path"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        FolderSelectorInner,
        {
          sources,
          onSelect: async (path) => {
            propsOnSelect(path);
            setVisible(false);
          }
        }
      )
    }
  );
};
function CgNotes(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24", "fill": "none" }, "child": [{ "tag": "path", "attr": { "d": "M6 6C6 5.44772 6.44772 5 7 5H17C17.5523 5 18 5.44772 18 6C18 6.55228 17.5523 7 17 7H7C6.44771 7 6 6.55228 6 6Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 10C6 9.44771 6.44772 9 7 9H17C17.5523 9 18 9.44771 18 10C18 10.5523 17.5523 11 17 11H7C6.44771 11 6 10.5523 6 10Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 13C6.44772 13 6 13.4477 6 14C6 14.5523 6.44771 15 7 15H17C17.5523 15 18 14.5523 18 14C18 13.4477 17.5523 13 17 13H7Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "d": "M6 18C6 17.4477 6.44772 17 7 17H11C11.5523 17 12 17.4477 12 18C12 18.5523 11.5523 19 11 19H7C6.44772 19 6 18.5523 6 18Z", "fill": "currentColor" }, "child": [] }, { "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M2 4C2 2.34315 3.34315 1 5 1H19C20.6569 1 22 2.34315 22 4V20C22 21.6569 20.6569 23 19 23H5C3.34315 23 2 21.6569 2 20V4ZM5 3H19C19.5523 3 20 3.44771 20 4V20C20 20.5523 19.5523 21 19 21H5C4.44772 21 4 20.5523 4 20V4C4 3.44772 4.44771 3 5 3Z", "fill": "currentColor" }, "child": [] }] })(props);
}
function ImMoveUp(props) {
  return GenIcon({ "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11 8v6h1v-6h2.5l-3-3-3 3z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 3h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3 3h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 3h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 6.5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M2.5 7h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4.5 7h1.5v1h-1.5v-1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M1 4.5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 5h1v1.5h-1v-1.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 11v3h-3v-3h3zM6 10h-5v5h5v-5z" }, "child": [] }] })(props);
}
function ImEmbed(props) {
  return GenIcon({ "attr": { "version": "1.1", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M9 11.5l1.5 1.5 5-5-5-5-1.5 1.5 3.5 3.5z" }, "child": [] }, { "tag": "path", "attr": { "d": "M7 4.5l-1.5-1.5-5 5 5 5 1.5-1.5-3.5-3.5z" }, "child": [] }] })(props);
}
const DetectCompressedFilesModal = ({ paths = [], onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(true);
  const [detecting, setDetecting] = reactExports.useState(false);
  const includeUnknownFilesRef = reactExports.useRef(false);
  const unknownFilesMinMbRef = reactExports.useRef(0);
  const [includeUnknownFiles, setIncludeUnknownFiles] = reactExports.useState(
    includeUnknownFilesRef.current
  );
  const [unknownFilesMinMb, setUnknownFilesMinMb] = reactExports.useState(
    unknownFilesMinMbRef.current
  );
  const [onFailureContinue, setOnFailureContinue] = reactExports.useState(true);
  const abortDetectingRef = reactExports.useRef(null);
  const abortDecompressingRef = reactExports.useRef(null);
  const [globalOperation, setGlobalOperation] = reactExports.useState({
    decompressToNewFolder: true,
    deleteAfterDecompression: false,
    moveToParent: false,
    overwriteExistFiles: false
  });
  const [operationMap, setOperationMap] = reactExports.useState({});
  const { createPortal } = useBakabaseContext();
  const [results, setResults] = reactExports.useState([]);
  const tableRef = reactExports.useRef(null);
  const cache2 = reactExports.useMemo(
    () => new CellMeasurerCache({
      fixedWidth: true,
      defaultHeight: 150,
      minHeight: 50
    }),
    []
  );
  reactExports.useEffect(() => {
    if (results.length > 0) {
      cache2.clearAll();
      if (tableRef.current) {
        tableRef.current.recomputeRowHeights();
        tableRef.current.forceUpdateGrid();
      }
    }
  }, [results, cache2]);
  const startDetecting = reactExports.useCallback(async () => {
    if (!paths || paths.length === 0)
      return;
    setDetecting(true);
    setResults([]);
    const controller = new AbortController();
    abortDetectingRef.current = controller;
    try {
      const url2 = BApi$1.file.detectCompressedFilesUrl();
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          paths,
          includeUnknownFiles: includeUnknownFilesRef.current,
          unknownFilesMinMb: includeUnknownFilesRef.current ? unknownFilesMinMbRef.current : void 0
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          const result = JSON.parse(line2);
          setResults((prev2) => {
            const idx2 = prev2.findIndex((r2) => r2.key === result.key);
            const next2 = [...prev2];
            if (idx2 >= 0) {
              const existed = next2[idx2] || {};
              const mapped = {
                ...Object.fromEntries(
                  Object.entries(result).filter(
                    ([k2, v2]) => k2 !== "status" && k2 !== "message" && v2 !== null && v2 !== void 0 && v2 !== ""
                  )
                )
              };
              if (result.status !== void 0) {
                mapped.detectionStatus = result.status;
              }
              if (result.message !== void 0 && result.message !== "") {
                mapped.detectionMessage = result.message;
              }
              next2[idx2] = {
                ...existed,
                ...mapped
              };
              cache2.clear(idx2, 0);
            } else {
              const mapped = {
                ...result,
                detectionMessage: result.message,
                detectionStatus: result.status,
                index: next2.length
              };
              next2.push(mapped);
            }
            return next2;
          });
          setTimeout(() => {
            if (tableRef.current) {
              tableRef.current.recomputeRowHeights();
              tableRef.current.forceUpdate();
            }
          }, 0);
        }
      }
    } catch (e2) {
      toast.danger(e2 instanceof Error ? e2.message : "Unknown error");
    } finally {
      setDetecting(false);
      abortDetectingRef.current = null;
    }
  }, [paths, cache2]);
  const stopDetecting = reactExports.useCallback(() => {
    var _a2;
    (_a2 = abortDetectingRef.current) == null ? void 0 : _a2.abort();
    abortDetectingRef.current = null;
    setDetecting(false);
  }, []);
  const close = reactExports.useCallback(() => {
    stopDetecting();
    setVisible(false);
  }, [stopDetecting]);
  const startDecompressing = reactExports.useCallback(async () => {
    const detectedItems2 = results.filter(
      (r2) => r2.detectionStatus === CompressedFileDetectionResultStatus.Complete
    );
    if (detectedItems2.length === 0)
      return;
    const dangerousItems = detectedItems2.filter((item) => {
      const op = operationMap[item.key] ?? globalOperation;
      return op.moveToParent && !op.decompressToNewFolder;
    });
    if (dangerousItems.length > 0) {
      const confirmed = await new Promise((resolve2) => {
        createPortal(Modal, {
          defaultVisible: true,
          size: "lg",
          title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-warning", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-2xl" }),
            t2("common.label.warning")
          ] }),
          footer: {
            actions: ["ok", "cancel"],
            okProps: {
              children: t2("common.confirm.continueAnyway"),
              color: "danger"
            },
            cancelProps: {
              children: t2("common.action.cancel"),
              color: "default",
              variant: "light"
            }
          },
          onOk: () => {
            resolve2(true);
          },
          onClose: () => {
            resolve2(false);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base", children: t2(
              "bulkDecompression.warning.dangerousOperation",
              { count: dangerousItems.length }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc list-inside space-y-1 text-sm text-danger", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("bulkDecompression.warning.allEntriesWillBeMoved") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("bulkDecompression.warning.pendingFilesMayBeMoved") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("bulkDecompression.warning.fileStructureMayBeMessed") })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-primary-50 dark:bg-primary-900/20 border-l-4 border-primary p-3 rounded", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-foreground-600", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-semibold", children: [
                t2("common.label.tip"),
                ":"
              ] }),
              " ",
              t2("bulkDecompression.tip.recommendation")
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-base font-semibold", children: t2("common.confirm.continue") })
          ] })
        });
      });
      if (!confirmed) {
        return;
      }
    }
    const controller = new AbortController();
    abortDecompressingRef.current = controller;
    try {
      const url2 = BApi$1.file.decompressCompressedFilesUrl();
      const items = detectedItems2.map((item) => {
        const op = operationMap[item.key] ?? globalOperation;
        return {
          key: item.key,
          directory: item.directory,
          files: item.files,
          password: item.password,
          decompressToNewFolder: op.decompressToNewFolder,
          deleteAfterDecompression: op.deleteAfterDecompression,
          moveToParent: op.moveToParent,
          overwriteExistFiles: op.overwriteExistFiles
        };
      });
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          items,
          onFailureContinue
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          const update = JSON.parse(line2);
          setResults((prev2) => {
            const idx2 = prev2.findIndex((r2) => r2.key === update.key);
            if (idx2 >= 0) {
              const next2 = [...prev2];
              const mapped = {
                ...Object.fromEntries(
                  Object.entries(update).filter(
                    ([k2, v2]) => k2 !== "status" && k2 !== "percentage" && k2 !== "message" && v2 !== null && v2 !== void 0 && v2 !== ""
                  )
                )
              };
              if (update.status !== void 0) {
                mapped.decompressionStatus = update.status;
              }
              if (update.percentage !== void 0) {
                mapped.decompressionPercentage = update.percentage;
              }
              if (update.message !== void 0 && update.message !== "") {
                mapped.decompressionMessage = update.message;
              }
              next2[idx2] = {
                ...next2[idx2],
                ...mapped
              };
              cache2.clear(idx2, 0);
              return next2;
            }
            return prev2;
          });
          setTimeout(() => {
            if (tableRef.current) {
              tableRef.current.recomputeRowHeights();
              tableRef.current.forceUpdate();
            }
          }, 0);
        }
      }
      toast.success(t2("bulkDecompression.success.decompressionCompleted"));
    } catch (e2) {
      if (e2 instanceof Error && e2.name !== "AbortError") {
        toast.danger(e2.message);
      }
    } finally {
      abortDecompressingRef.current = null;
    }
  }, [results, operationMap, globalOperation, onFailureContinue, t2, cache2]);
  reactExports.useEffect(() => {
    return () => stopDetecting();
  }, []);
  const renderDetectionStatus = reactExports.useCallback((result) => {
    switch (result.detectionStatus) {
      case CompressedFileDetectionResultStatus.Init:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-lg" }) });
      case CompressedFileDetectionResultStatus.Inprogress:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "primary", labelColor: "foreground", size: "sm" }),
          result.decompressionPercentage !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
            result.decompressionPercentage,
            "%"
          ] })
        ] }) });
      case CompressedFileDetectionResultStatus.Complete:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) });
      case CompressedFileDetectionResultStatus.Error:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" }) });
    }
  }, []);
  const renderDecompressionStatus = reactExports.useCallback((result) => {
    switch (result.decompressionStatus) {
      case DecompressionStatus.Pending:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-lg" }) });
      case DecompressionStatus.Decompressing:
        return (
          // <Chip color="default" variant="light">
          //   <Spinner color="default" labelColor="foreground" size="sm" />
          // </Chip>
          /* @__PURE__ */ jsxRuntimeExports.jsx(circular_progress_default, { size: "sm", showValueLabel: true, value: result.decompressionPercentage })
        );
      case DecompressionStatus.Success:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) });
      case DecompressionStatus.Error:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" }) });
    }
  }, []);
  const renderOperations = reactExports.useCallback(
    (decompressToNewFolder, setDecompressToNewFolder, deleteAfterDecompression, setDeleteAfterDecompression, moveToParent, setMoveToParent, overwriteExistFiles, setOverwriteExistFiles, showTooltip) => {
      const decompressToNewFolderBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: decompressToNewFolder ? "" : "opacity-30",
          color: decompressToNewFolder ? "primary" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setDecompressToNewFolder(!decompressToNewFolder),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderAdd, { className: "text-xl" })
        }
      );
      const deleteAfterDecompressionBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: deleteAfterDecompression ? "" : "opacity-30",
          color: deleteAfterDecompression ? "danger" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setDeleteAfterDecompression(!deleteAfterDecompression),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-xl" })
        }
      );
      const moveToParentBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: moveToParent ? "" : "opacity-30",
          color: moveToParent ? "success" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setMoveToParent(!moveToParent),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImMoveUp, { className: "text-xl" })
        }
      );
      const overwriteExistFilesBtn = /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: overwriteExistFiles ? "" : "opacity-30",
          color: overwriteExistFiles ? "warning" : "default",
          size: "sm",
          variant: "light",
          onPress: () => setOverwriteExistFiles(!overwriteExistFiles),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileSync, { className: "text-xl" })
        }
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-0", children: showTooltip ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "primary", content: t2("bulkDecompression.tip.extractToNewDirectory"), children: decompressToNewFolderBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "danger", content: t2("bulkDecompression.tip.deleteSourceAfterDecompression"), children: deleteAfterDecompressionBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "success", content: t2("bulkDecompression.tip.moveToParentDirectory"), children: moveToParentBtn }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[320px]", color: "warning", content: t2("bulkDecompression.tip.overwriteExistingFiles"), children: overwriteExistFilesBtn })
      ] }) : [decompressToNewFolderBtn, deleteAfterDecompressionBtn, moveToParentBtn, overwriteExistFilesBtn] });
    },
    []
  );
  console.log(results);
  const detectedItems = results.filter(
    (r2) => r2.detectionStatus == CompressedFileDetectionResultStatus.Complete
  );
  const someNotDecompressToNewFolder = _$2.values(operationMap).some((a2) => !a2.decompressToNewFolder);
  const someNotDeleteAfterDecompression = _$2.values(operationMap).some((a2) => !a2.deleteAfterDecompression);
  const someNotMoveToParent = _$2.values(operationMap).some((a2) => !a2.moveToParent);
  const someNotOverwriteExistFiles = _$2.values(operationMap).some((a2) => !a2.overwriteExistFiles);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      className: "max-w-[95vw] max-h-[90vh]",
      footer: false,
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        t2("bulkDecompression.modal.title"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
      ] }),
      visible,
      onClose: () => {
        var _a2;
        if (detecting || abortDecompressingRef.current) {
          if (!confirm(t2("bulkDecompression.confirm.closeWhileRunning")))
            return;
          stopDetecting();
          (_a2 = abortDecompressingRef.current) == null ? void 0 : _a2.abort();
          abortDecompressingRef.current = null;
        }
        close();
      },
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: includeUnknownFiles,
                size: "sm",
                onValueChange: (selected) => {
                  includeUnknownFilesRef.current = selected;
                  setIncludeUnknownFiles(selected);
                  if (!selected) {
                    unknownFilesMinMbRef.current = void 0;
                    setUnknownFilesMinMb(void 0);
                  } else if (unknownFilesMinMbRef.current === void 0) {
                    const defaultValue2 = 10;
                    unknownFilesMinMbRef.current = defaultValue2;
                    setUnknownFilesMinMb(defaultValue2);
                  }
                },
                children: t2("bulkDecompression.label.includeUnknownExtensions")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              number_input_default,
              {
                isClearable: true,
                className: "w-[400px]",
                isDisabled: !includeUnknownFiles,
                label: t2("bulkDecompression.label.unknownExtensionsMinSize"),
                placeholder: t2("bulkDecompression.placeholder.optional"),
                size: "sm",
                value: unknownFilesMinMb,
                onValueChange: (v2) => {
                  unknownFilesMinMbRef.current = v2;
                  setUnknownFilesMinMb(v2);
                  if (v2 === void 0) {
                    includeUnknownFilesRef.current = false;
                    setIncludeUnknownFiles(false);
                  } else if (!includeUnknownFilesRef.current) {
                    includeUnknownFilesRef.current = true;
                    setIncludeUnknownFiles(true);
                  }
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: !detecting ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              onPress: () => {
                startDetecting();
              },
              children: t2("bulkDecompression.action.detectCompressedFiles")
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { color: "danger", variant: "light", onPress: stopDetecting, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-lg" }),
            t2("common.action.stop")
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow h-[65vh] max-h-[65vh] border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Table,
          {
            ref: tableRef,
            deferredMeasurementCache: cache2,
            headerClassName: "bg-default-100 dark:bg-default-50/10 font-medium border-b border-divider text-sm",
            headerHeight: 40,
            height,
            noRowsRenderer: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full text-gray-500", children: t2("bulkDecompression.empty.noCompressedFilesDetected") }),
            rowClassName: ({ index: index2 }) => index2 >= 0 ? "transition-colors hover:bg-primary-50/30 dark:hover:bg-primary-900/20 border-b border-divider/50" : "",
            rowCount: results.length,
            rowGetter: ({ index: index2 }) => results[index2],
            rowHeight: cache2.rowHeight,
            width,
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center px-2 py-2", children: rowData.index + 1 }),
                  dataKey: "index",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("bulkDecompression.label.index") }),
                  width: 60
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result, parent, rowIndex }) => {
                    var _a2, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      CellMeasurer,
                      {
                        cache: cache2,
                        columnIndex: 0,
                        parent,
                        rowIndex,
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          "div",
                          {
                            className: "flex flex-col gap-0.5 py-2 px-2 overflow-hidden",
                            style: { width: "100%" },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-lg" }),
                                result.directory
                              ] }) }),
                              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start", children: [
                                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEnter, { className: "text-lg scale-x-[-1]" }) }) }),
                                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 max-h-[100px] overflow-y-auto", children: (_a2 = result.files) == null ? void 0 : _a2.map((f2, fileIdx) => {
                                    var _a3;
                                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      Chip,
                                      {
                                        color: result.status === CompressedFileDetectionResultStatus.Error ? "danger" : "default",
                                        size: "sm",
                                        variant: "light",
                                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            FileSystemEntryIcon,
                                            {
                                              path: `${result.directory}/${f2}`,
                                              size: 18,
                                              type: IconType.Dynamic
                                            }
                                          ),
                                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: f2 }),
                                          typeof ((_a3 = result.fileSizes) == null ? void 0 : _a3[fileIdx]) === "number" && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: humanFileSize(result.fileSizes[fileIdx] ?? 0, false, 2) })
                                        ] })
                                      },
                                      f2
                                    );
                                  }) }),
                                  result.status === CompressedFileDetectionResultStatus.Complete && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRightCircle, { className: "text-lg" }) }),
                                    ((_b2 = operationMap[result.key] ?? globalOperation) == null ? void 0 : _b2.decompressToNewFolder) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineCreateNewFolder, { className: "text-lg" }),
                                      result.decompressToDirName
                                    ] }) }) }),
                                    result.contentSampleGroups && result.contentSampleGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
                                      "/",
                                      result.contentSampleGroups.map(
                                        (g2, gi2) => {
                                          var _a3, _b3, _c2;
                                          const restFileCount = g2.count - (((_a3 = g2.samples) == null ? void 0 : _a3.length) ?? 0);
                                          const sampleFilesText = (_b3 = g2.samples) == null ? void 0 : _b3.join(", ");
                                          return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            Chip,
                                            {
                                              size: "sm",
                                              variant: "flat",
                                              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                                                /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                  FileSystemEntryIcon,
                                                  {
                                                    size: 18,
                                                    type: g2.isFile ? IconType.Dynamic : IconType.Directory
                                                  }
                                                ),
                                                restFileCount > 0 ? t2(
                                                  "bulkDecompression.label.sampleFilesAndMore",
                                                  { sampleFilesText, restFileCount }
                                                ) : sampleFilesText
                                              ] })
                                            },
                                            ((_c2 = g2.samples) == null ? void 0 : _c2[0]) ?? gi2
                                          );
                                        }
                                      )
                                    ] })
                                  ] })
                                ] })
                              ] })
                            ]
                          }
                        )
                      },
                      result.key
                    );
                  },
                  dataKey: "files",
                  flexGrow: 1,
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center", children: t2("bulkDecompression.label.files") }),
                  width: width * 0.4
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => {
                    var _a2, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center px-2 py-2", children: [
                      result.password && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }), children: result.password }),
                      (_a2 = result.candidatePasswords) == null ? void 0 : _a2.map((cp) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: cp }, cp)),
                      (_b2 = result.wrongPasswords) == null ? void 0 : _b2.map((wp) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "line-through", size: "sm", variant: "light", children: wp }, wp))
                    ] });
                  },
                  dataKey: "password",
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center", children: t2("bulkDecompression.label.password") }),
                  width: 150
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 py-2", children: [
                    renderDetectionStatus(result),
                    result.detectionMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            size: "xl",
                            title: t2("common.label.message"),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap", children: result.detectionMessage })
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CgNotes, { className: "text-lg" })
                      }
                    )
                  ] }),
                  dataKey: "detectionStatus",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("bulkDecompression.label.detection") }),
                  width: 120
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center px-2 py-2", children: [
                    renderDecompressionStatus(result),
                    result.decompressionMessage && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            size: "xl",
                            title: t2("common.label.message"),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap", children: result.decompressionMessage })
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(CgNotes, { className: "text-lg" })
                      }
                    )
                  ] }),
                  dataKey: "decompressionStatus",
                  headerClassName: "flex items-center justify-center",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center justify-center", children: t2("bulkDecompression.label.decompression") }),
                  width: 120
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Column,
                {
                  cellRenderer: ({ rowData: result }) => {
                    var _a2, _b2, _c2, _d;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-2 py-2", children: [
                      result.detectionStatus === CompressedFileDetectionResultStatus.Complete && renderOperations(
                        ((_a2 = operationMap[result.key]) == null ? void 0 : _a2.decompressToNewFolder) ?? globalOperation.decompressToNewFolder,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], decompressToNewFolder: v2 }
                          }));
                        },
                        ((_b2 = operationMap[result.key]) == null ? void 0 : _b2.deleteAfterDecompression) ?? globalOperation.deleteAfterDecompression,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], deleteAfterDecompression: v2 }
                          }));
                        },
                        ((_c2 = operationMap[result.key]) == null ? void 0 : _c2.moveToParent) ?? globalOperation.moveToParent,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], moveToParent: v2 }
                          }));
                        },
                        ((_d = operationMap[result.key]) == null ? void 0 : _d.overwriteExistFiles) ?? globalOperation.overwriteExistFiles,
                        (v2) => {
                          setOperationMap((prev2) => ({
                            ...prev2,
                            [result.key]: { ...prev2[result.key], overwriteExistFiles: v2 }
                          }));
                        },
                        false
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          isIconOnly: true,
                          size: "sm",
                          variant: "light",
                          onPress: () => {
                            BApi$1.tool.openFileOrDirectory({
                              path: result.directory
                            });
                          },
                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" })
                        }
                      )
                    ] });
                  },
                  dataKey: "operations",
                  headerClassName: "flex items-center justify-start",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-8 flex items-center gap-2 px-2", children: renderOperations(
                    someNotDecompressToNewFolder ? false : globalOperation.decompressToNewFolder,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, decompressToNewFolder: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], decompressToNewFolder: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotDeleteAfterDecompression ? false : globalOperation.deleteAfterDecompression,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, deleteAfterDecompression: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], deleteAfterDecompression: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotMoveToParent ? false : globalOperation.moveToParent,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, moveToParent: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], moveToParent: v2 };
                        }
                        return prev2;
                      });
                    },
                    someNotOverwriteExistFiles ? false : globalOperation.overwriteExistFiles,
                    (v2) => {
                      setGlobalOperation((prev2) => ({ ...prev2, overwriteExistFiles: v2 }));
                      setOperationMap((prev2) => {
                        for (const key in prev2) {
                          prev2[key] = { ...prev2[key], overwriteExistFiles: v2 };
                        }
                        return prev2;
                      });
                    },
                    true
                  ) }),
                  width: 260
                }
              )
            ]
          }
        ) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 ", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              checked: onFailureContinue,
              size: "sm",
              type: "checkbox",
              onChange: (e2) => setOnFailureContinue(e2.currentTarget.checked),
              children: t2("bulkDecompression.label.continueOnFailure")
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              className: detecting || detectedItems.length == 0 ? "cursor-not-allowed" : "",
              color: "primary",
              isDisabled: detecting || detectedItems.length == 0,
              onPress: () => {
                startDecompressing();
              },
              children: detecting ? t2("bulkDecompression.status.waitingForDetection") : detectedItems.length == 0 ? t2("bulkDecompression.empty.noCompressedFilesDetected") : t2("bulkDecompression.action.decompressAllDetected")
            }
          ) })
        ] })
      ] })
    }
  );
};
DetectCompressedFilesModal.displayName = "DetectCompressedFilesModal";
const CreateDirectoryModal = ({ parentPath, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: `${t2("fileExplorer.createDirectoryModal.okButton")}(Enter)`,
          autoFocus: true
        }
      },
      size: "sm",
      title: t2("fileExplorer.createDirectoryModal.title"),
      onDestroyed,
      onOk: async () => {
        await BApi$1.file.createDirectory({ parent: parentPath });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm", children: [
        t2("fileExplorer.createDirectoryModal.description"),
        ": ",
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: parentPath })
      ] })
    }
  );
};
CreateDirectoryModal.displayName = "CreateDirectoryModal";
const ContextMenu = ({ selectedEntries, capabilities, root: root2, renderExtraContextMenuItems, onChangeWorkingDirectory }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const items = [];
  if (selectedEntries.length > 0) {
    const decompressableEntries = selectedEntries.filter(
      (x2) => x2.actions.includes(IwFsEntryAction.Decompress)
    );
    const expandableEntries = selectedEntries.filter((x2) => x2.expandable && !x2.expanded);
    const collapsableEntries = selectedEntries.filter((x2) => x2.expandable && x2.expanded);
    const directoryEntries = selectedEntries.filter((e2) => e2.type == IwFsType.Directory);
    if (selectedEntries.length === 1) {
      const entry = selectedEntries[0];
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.openInFileManager"),
        onClick: () => {
          BApi$1.tool.openFileOrDirectory({
            path: entry.path,
            openInDirectory: entry.type != IwFsType.Directory
          });
        }
      });
    }
    if (selectedEntries.length === 1 && selectedEntries[0].isDirectoryOrDrive && onChangeWorkingDirectory) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$w, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.enterDirectory"),
        onClick: () => {
          onChangeWorkingDirectory(selectedEntries[0].path);
        }
      });
    }
    if ((capabilities == null ? void 0 : capabilities.includes("create-directory")) && selectedEntries.length === 1 && selectedEntries[0].isDirectoryOrDrive) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.createNewFolder"),
        onClick: () => {
          createPortal(CreateDirectoryModal, {
            parentPath: selectedEntries[0].path
          });
        }
      });
    }
    if (expandableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1k, { className: "text-base" }),
        label: t2(selectedEntries.length == 1 ? "fileExplorer.contextMenu.expand" : "fileExplorer.contextMenu.expandSelected"),
        onClick: () => {
          for (const entry of expandableEntries) {
            entry.expand(false);
          }
        }
      });
    }
    if (collapsableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1e, { className: "text-base" }),
        label: t2(selectedEntries.length == 1 ? "fileExplorer.contextMenu.collapse" : "fileExplorer.contextMenu.collapseSelected"),
        onClick: () => {
          for (const entry of collapsableEntries) {
            entry.collapse();
          }
        }
      });
    }
    if ((capabilities == null ? void 0 : capabilities.includes("decompress")) && decompressableEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.decompressFiles", {
          count: decompressableEntries.length
        }),
        onClick: () => {
          toast.default(t2("fileExplorer.contextMenu.startDecompressing"));
          BApi$1.file.decompressFiles({
            paths: decompressableEntries.map((e2) => e2.path)
          });
        }
      });
    }
    if ((capabilities == null ? void 0 : capabilities.includes("extract")) && directoryEntries.length > 0) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.extractDirectories", {
          count: directoryEntries.length
        }),
        onClick: () => {
          createPortal(ExtractModal, { entries: selectedEntries });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("wrap")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$t, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.wrapItems", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(WrapModal, { entries: selectedEntries });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("delete")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.deleteItems", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(DeleteConfirmationModal, {
            entries: selectedEntries,
            rootPath: root2 == null ? void 0 : root2.path
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("delete-all-same-name")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$V, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.deleteItemsWithSameNames"),
        onClick: () => {
          var _a2;
          createPortal(DeleteItemsWithSameNamesModal, {
            entries: selectedEntries,
            workingDirectory: ((_a2 = selectedEntries[0]) == null ? void 0 : _a2.root.path) ?? ""
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("move")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$d, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.moveItems", {
          count: selectedEntries.length
        }),
        onClick: () => {
          createPortal(FolderSelector, {
            onSelect: (path) => {
              return BApi$1.file.moveEntries({
                destDir: path,
                entryPaths: selectedEntries.map((e2) => e2.path)
              });
            },
            sources: ["media library", "custom"]
          });
        }
      });
    }
    if (capabilities == null ? void 0 : capabilities.includes("group")) {
      const fileEntries = selectedEntries.filter((x2) => !x2.isDirectoryOrDrive);
      if (fileEntries.length > 1) {
        items.push({
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$C, { className: "text-base" }),
          label: t2("fileExplorer.contextMenu.autoGroupSelectedFiles", {
            count: fileEntries.length
          }),
          onClick: () => {
            createPortal(GroupModal, {
              entries: fileEntries,
              groupInternal: false
            });
          }
        });
      }
      const directoryEntries2 = selectedEntries.filter((e2) => e2.isDirectory);
      if (directoryEntries2.length > 0) {
        items.push({
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$C, { className: "text-base" }),
          label: t2("fileExplorer.contextMenu.autoGroupInternalItems", {
            count: directoryEntries2.length
          }),
          onClick: () => {
            createPortal(GroupModal, {
              entries: selectedEntries,
              groupInternal: true
            });
          }
        });
      }
    }
    if (capabilities == null ? void 0 : capabilities.includes("decompress")) {
      items.push({
        icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileZip, { className: "text-base" }),
        label: t2("fileExplorer.contextMenu.useBulkDecompressionTool"),
        onClick: () => {
          createPortal(DetectCompressedFilesModal, { paths: selectedEntries.map((e2) => e2.path) });
        }
      });
    }
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-base" }),
      label: t2("fileExplorer.contextMenu.copyNames", {
        count: selectedEntries.length
      }),
      onClick: () => {
        navigator.clipboard.writeText(selectedEntries.map((e2) => e2.name).join("\n")).then(() => {
          toast.success(t2("fileExplorer.contextMenu.copied"));
        }).catch((e2) => {
          toast.danger(`${t2("fileExplorer.contextMenu.failedToCopy")}. ${e2}`);
        });
      }
    });
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-base" }),
      label: t2("fileExplorer.contextMenu.copyPaths", {
        count: selectedEntries.length
      }),
      onClick: () => {
        navigator.clipboard.writeText(selectedEntries.map((e2) => e2.path).join("\n")).then(() => {
          toast.success(t2("fileExplorer.contextMenu.copied"));
        }).catch((e2) => {
          toast.danger(`${t2("fileExplorer.contextMenu.failedToCopy")}. ${e2}`);
        });
      }
    });
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDriveFileRenameOutline, { className: "text-base" }),
      // 可换为更合适的icon
      label: t2("fileExplorer.contextMenu.batchRename", {
        count: selectedEntries.length
      }),
      onClick: () => {
        createPortal(FileNameModifierModal, {
          initialFilePaths: selectedEntries.map((e2) => e2.path)
        });
      }
    });
  }
  if (selectedEntries.length === 0 && (capabilities == null ? void 0 : capabilities.includes("create-directory")) && (root2 == null ? void 0 : root2.path)) {
    items.push({
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-base" }),
      label: t2("fileExplorer.contextMenu.createNewFolder"),
      onClick: () => {
        createPortal(CreateDirectoryModal, {
          parentPath: root2.path
        });
      }
    });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    items.map((i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuItem, { onClick: i2.onClick, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        i2.icon,
        i2.label
      ] }) }, i2.label);
    }),
    renderExtraContextMenuItems == null ? void 0 : renderExtraContextMenuItems(selectedEntries)
  ] });
};
ContextMenu.displayName = "ContextMenu";
const FileSystemTreeEntryCapabilityMap = {
  select: {
    shortcut: { nameI18nKey: "fileExplorer.shortcutKey.leftClick", mouseButton: 0 },
    nameI18NKey: "fileExplorer.capability.select"
  },
  "multi-select": {
    shortcut: { nameI18nKey: "fileExplorer.shortcutKey.ctrlClick", mouseButton: 0, modifiers: ["Control"] },
    nameI18NKey: "fileExplorer.capability.multiSelect"
  },
  "range-select": {
    shortcut: { nameI18nKey: "fileExplorer.shortcutKey.shiftClick", mouseButton: 0, modifiers: ["Shift"] },
    nameI18NKey: "fileExplorer.capability.rangeSelect"
  },
  wrap: {
    shortcut: { key: "w", nameI18nKey: "fileExplorer.shortcutKey.w" },
    nameI18NKey: "fileExplorer.capability.wrap"
  },
  extract: {
    shortcut: { key: "e", nameI18nKey: "fileExplorer.shortcutKey.e" },
    nameI18NKey: "fileExplorer.capability.extract"
  },
  move: {
    shortcut: { key: "m", nameI18nKey: "fileExplorer.shortcutKey.m" },
    nameI18NKey: "fileExplorer.capability.move"
  },
  delete: {
    shortcut: { key: "Delete", nameI18nKey: "fileExplorer.shortcutKey.delete" },
    nameI18NKey: "fileExplorer.capability.delete"
  },
  rename: {
    shortcut: { key: "F2", nameI18nKey: "fileExplorer.shortcutKey.f2" },
    nameI18NKey: "fileExplorer.capability.rename"
  },
  decompress: {
    shortcut: { key: "d", nameI18nKey: "fileExplorer.shortcutKey.d" },
    nameI18NKey: "fileExplorer.capability.decompress"
  },
  "delete-all-same-name": {
    nameI18NKey: "fileExplorer.capability.deleteAllSameName"
  },
  group: {
    shortcut: { key: "g", nameI18nKey: "fileExplorer.shortcutKey.g" },
    nameI18NKey: "fileExplorer.capability.group"
  },
  play: {
    nameI18NKey: "fileExplorer.capability.play"
  },
  "play-first-file": {
    shortcut: { key: " ", nameI18nKey: "fileExplorer.shortcutKey.space" },
    nameI18NKey: "fileExplorer.capability.playFirstFile"
  },
  "create-directory": {
    shortcut: { key: "n", nameI18nKey: "fileExplorer.shortcutKey.n" },
    nameI18NKey: "fileExplorer.capability.createDirectory"
  }
};
const log$y = buildLogger("Shortcuts");
const Shortcuts = ({ capabilities, className }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  log$y("shortcuts for capabilities", capabilities);
  const shortcuts2 = reactExports.useMemo(() => {
    const result = [];
    if (capabilities && capabilities.length > 0) {
      capabilities.forEach((c2) => {
        const def = FileSystemTreeEntryCapabilityMap[c2];
        const shortcut = def == null ? void 0 : def.shortcut;
        if (shortcut) {
          result.push({
            label: t2(def.nameI18NKey),
            shortcut: t2(def.shortcut.nameI18nKey)
          });
        }
      });
    }
    result.push(
      { label: t2("fileExplorer.shortcut.selectPrevious"), shortcut: "↑" },
      { label: t2("fileExplorer.shortcut.selectNext"), shortcut: "↓" },
      { label: t2("fileExplorer.shortcut.enterDirectory"), shortcut: "Enter" },
      { label: t2("fileExplorer.shortcut.selectAll"), shortcut: "Ctrl+A" },
      { label: t2("fileExplorer.shortcut.copy"), shortcut: "Ctrl+C" },
      { label: t2("fileExplorer.shortcut.cut"), shortcut: "Ctrl+X" },
      { label: t2("fileExplorer.shortcut.pasteMove"), shortcut: "Ctrl+V" }
    );
    return result;
  }, [capabilities, t2]);
  const openModal = () => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "lg",
      title: t2("fileExplorer.label.shortcuts"),
      footer: { actions: ["cancel"] },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-x-8 gap-y-2", children: shortcuts2.map((s2, idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: s2.label }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { children: s2.shortcut })
      ] }, idx)) })
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("fileExplorer.label.shortcuts"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, className, variant: "light", onPress: openModal, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RiKeyboardLine, { className: "text-lg" }) }) });
};
Shortcuts.displayName = "Shortcuts";
function BsCollectionPlayFill(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M2.5 3.5a.5.5 0 0 1 0-1h11a.5.5 0 0 1 0 1zm2-2a.5.5 0 0 1 0-1h7a.5.5 0 0 1 0 1zM0 13a1.5 1.5 0 0 0 1.5 1.5h13A1.5 1.5 0 0 0 16 13V6a1.5 1.5 0 0 0-1.5-1.5h-13A1.5 1.5 0 0 0 0 6zm6.258-6.437a.5.5 0 0 1 .507.013l4 2.5a.5.5 0 0 1 0 .848l-4 2.5A.5.5 0 0 1 6 12V7a.5.5 0 0 1 .258-.437" }, "child": [] }] })(props);
}
function BsController(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M11.5 6.027a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m2.5-.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0m-1.5 1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1m-6.5-3h1v1h1v1h-1v1h-1v-1h-1v-1h1z" }, "child": [] }, { "tag": "path", "attr": { "d": "M3.051 3.26a.5.5 0 0 1 .354-.613l1.932-.518a.5.5 0 0 1 .62.39c.655-.079 1.35-.117 2.043-.117.72 0 1.443.041 2.12.126a.5.5 0 0 1 .622-.399l1.932.518a.5.5 0 0 1 .306.729q.211.136.373.297c.408.408.78 1.05 1.095 1.772.32.733.599 1.591.805 2.466s.34 1.78.364 2.606c.024.816-.059 1.602-.328 2.21a1.42 1.42 0 0 1-1.445.83c-.636-.067-1.115-.394-1.513-.773-.245-.232-.496-.526-.739-.808-.126-.148-.25-.292-.368-.423-.728-.804-1.597-1.527-3.224-1.527s-2.496.723-3.224 1.527c-.119.131-.242.275-.368.423-.243.282-.494.575-.739.808-.398.38-.877.706-1.513.773a1.42 1.42 0 0 1-1.445-.83c-.27-.608-.352-1.395-.329-2.21.024-.826.16-1.73.365-2.606.206-.875.486-1.733.805-2.466.315-.722.687-1.364 1.094-1.772a2.3 2.3 0 0 1 .433-.335l-.028-.079zm2.036.412c-.877.185-1.469.443-1.733.708-.276.276-.587.783-.885 1.465a14 14 0 0 0-.748 2.295 12.4 12.4 0 0 0-.339 2.406c-.022.755.062 1.368.243 1.776a.42.42 0 0 0 .426.24c.327-.034.61-.199.929-.502.212-.202.4-.423.615-.674.133-.156.276-.323.44-.504C4.861 9.969 5.978 9.027 8 9.027s3.139.942 3.965 1.855c.164.181.307.348.44.504.214.251.403.472.615.674.318.303.601.468.929.503a.42.42 0 0 0 .426-.241c.18-.408.265-1.02.243-1.776a12.4 12.4 0 0 0-.339-2.406 14 14 0 0 0-.748-2.295c-.298-.682-.61-1.19-.885-1.465-.264-.265-.856-.523-1.733-.708-.85-.179-1.877-.27-2.913-.27s-2.063.091-2.913.27" }, "child": [] }] })(props);
}
function BsFileEarmark(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" }, "child": [] }] })(props);
}
function BsFolder(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z" }, "child": [] }] })(props);
}
function BsRegex(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 1 1 .707.707m9.9-.707a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.314.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707M6 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0m5-6.5a.5.5 0 0 0-1 0v2.117L8.257 5.57a.5.5 0 0 0-.514.858L9.528 7.5 7.743 8.571a.5.5 0 1 0 .514.858L10 8.383V10.5a.5.5 0 1 0 1 0V8.383l1.743 1.046a.5.5 0 0 0 .514-.858L11.472 7.5l1.785-1.071a.5.5 0 1 0-.514-.858L11 6.617z" }, "child": [] }] })(props);
}
function BsTerminal(props) {
  return GenIcon({ "attr": { "fill": "currentColor", "viewBox": "0 0 16 16" }, "child": [{ "tag": "path", "attr": { "d": "M6 9a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3A.5.5 0 0 1 6 9M3.854 4.146a.5.5 0 1 0-.708.708L4.793 6.5 3.146 8.146a.5.5 0 1 0 .708.708l2-2a.5.5 0 0 0 0-.708z" }, "child": [] }, { "tag": "path", "attr": { "d": "M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2zm12 1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z" }, "child": [] }] })(props);
}
const OperationButton = reactExports.forwardRef(({
  onClick,
  children,
  size: size2 = "sm",
  variant = "light",
  className,
  ...props
}, ref) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      ref,
      className: `w-auto h-auto p-1 min-w-fit opacity-70 hover:opacity-100 ${className ?? ""}`,
      size: size2,
      variant,
      onClick: (e2) => {
        e2.stopPropagation();
        onClick == null ? void 0 : onClick(e2);
      },
      ...props,
      children
    }
  );
});
OperationButton.displayName = "OperationButton";
var __defProp$2 = Object.defineProperty;
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$2 = (obj, key, value2) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues$2 = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp$2.call(b2, prop))
      __defNormalProp$2(a2, prop, b2[prop]);
  if (__getOwnPropSymbols$2)
    for (var prop of __getOwnPropSymbols$2(b2)) {
      if (__propIsEnum$2.call(b2, prop))
        __defNormalProp$2(a2, prop, b2[prop]);
    }
  return a2;
};
var __objRest$2 = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp$2.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols$2)
    for (var prop of __getOwnPropSymbols$2(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
function throttleAnimationFrame(func) {
  let wait = false;
  return () => {
    if (!wait) {
      wait = true;
      requestAnimationFrame(() => {
        func();
        wait = false;
      });
    }
  };
}
var antiOverflowAlgo = ({
  fontSizePx,
  minFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx,
  breakPredicate: breakPred
}) => {
  const maxIterCount = Math.ceil(1 / fontSizePrecisionPx);
  let iterCount = 0;
  while (fontSizePx > minFontSizePx && iterCount < maxIterCount) {
    if (breakPred())
      break;
    fontSizePx = updateFontSizePx(fontSizePx - fontSizePrecisionPx);
    iterCount++;
  }
};
var getContentWidth = (element2) => {
  const computedStyle = getComputedStyle(element2);
  return element2.clientWidth - parseFloat(computedStyle.paddingLeft) - parseFloat(computedStyle.paddingRight);
};
var getContentHeight = (element2) => {
  const computedStyle = getComputedStyle(element2);
  return element2.clientHeight - parseFloat(computedStyle.paddingTop) - parseFloat(computedStyle.paddingBottom);
};
var multilineAlgo = (opts2) => {
  opts2.innerEl.style.whiteSpace = "nowrap";
  onelineAlgo(opts2);
  if (opts2.innerEl.scrollWidth > getContentWidth(opts2.containerEl)) {
    opts2.innerEl.style.whiteSpace = "normal";
  }
};
var onelineAlgo = ({
  innerEl,
  containerEl,
  fontSizePx,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx
}) => {
  const maxIterCount = 10;
  let iterCount = 0;
  let prevOverflowFactor = 1;
  while (iterCount < maxIterCount) {
    const w0 = innerEl.scrollWidth;
    const w1 = getContentWidth(containerEl);
    const canGrow = fontSizePx < maxFontSizePx && w0 < w1;
    const canShrink = fontSizePx > minFontSizePx && w0 > w1;
    const overflowFactor = w0 / w1;
    if (prevOverflowFactor === overflowFactor) {
      break;
    }
    if (!(canGrow || canShrink)) {
      break;
    }
    const updatePx = fontSizePx / overflowFactor - fontSizePx;
    const prevFontSizePx = fontSizePx;
    fontSizePx = updateFontSizePx(fontSizePx + updatePx);
    if (Math.abs(fontSizePx - prevFontSizePx) <= fontSizePrecisionPx) {
      break;
    }
    prevOverflowFactor = overflowFactor;
    iterCount++;
  }
  antiOverflowAlgo({
    fontSizePx,
    minFontSizePx,
    updateFontSizePx,
    fontSizePrecisionPx,
    breakPredicate: () => innerEl.scrollWidth <= getContentWidth(containerEl)
  });
};
var boxAlgo = ({
  innerEl,
  containerEl,
  fontSizePx,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx,
  updateFontSizePx
}) => {
  const maxIterCount = 100;
  fontSizePx = updateFontSizePx((maxFontSizePx - minFontSizePx) * 0.5);
  let updatePx = (maxFontSizePx - minFontSizePx) * 0.25;
  let iterCount = 0;
  while (updatePx > fontSizePrecisionPx && iterCount < maxIterCount) {
    const w0 = innerEl.scrollWidth;
    const w1 = getContentWidth(containerEl);
    const h0 = innerEl.scrollHeight;
    const h12 = getContentHeight(containerEl);
    if (w0 === w1 && h0 === h12)
      break;
    if (fontSizePx < maxFontSizePx && w0 <= w1 && h0 <= h12) {
      fontSizePx = updateFontSizePx(fontSizePx + updatePx);
    } else if (fontSizePx > minFontSizePx && (w0 > w1 || h0 > h12)) {
      fontSizePx = updateFontSizePx(fontSizePx - updatePx);
    }
    updatePx *= 0.5;
    iterCount++;
  }
  antiOverflowAlgo({
    fontSizePx,
    minFontSizePx,
    updateFontSizePx,
    fontSizePrecisionPx,
    breakPredicate: () => innerEl.scrollWidth <= getContentWidth(containerEl) && innerEl.scrollHeight <= getContentHeight(containerEl)
  });
};
function updateTextSize({
  innerEl,
  containerEl,
  mode = "multiline",
  minFontSizePx = 8,
  maxFontSizePx = 160,
  fontSizePrecisionPx = 0.1
}) {
  performance.now();
  if (!isFinite(minFontSizePx)) {
    throw new Error(`Invalid minFontSizePx (${minFontSizePx})`);
  }
  if (!isFinite(minFontSizePx)) {
    throw new Error(`Invalid maxFontSizePx (${maxFontSizePx})`);
  }
  if (!isFinite(fontSizePrecisionPx) || fontSizePrecisionPx === 0) {
    throw new Error(`Invalid fontSizePrecisionPx (${fontSizePrecisionPx})`);
  }
  if (containerEl.children.length > 1) {
    console.warn(
      `AutoTextSize has ${containerEl.children.length - 1} siblings. This may interfere with the algorithm.`
    );
  }
  const containerStyles = {
    // Necessary to correctly compute the dimensions `innerEl`.
    display: "flex",
    alignItems: "start"
  };
  const innerStyles = {
    display: "block"
    // Necessary to compute dimensions.
  };
  if (mode === "oneline") {
    innerStyles.whiteSpace = "nowrap";
  } else if (mode === "multiline") {
    innerStyles.wordBreak = "break-word";
  } else if (mode === "box") {
    innerStyles.whiteSpace = "pre-wrap";
    innerStyles.wordBreak = "break-word";
  } else if (mode === "boxoneline") {
    innerStyles.whiteSpace = "nowrap";
  }
  Object.assign(containerEl.style, containerStyles);
  Object.assign(innerEl.style, innerStyles);
  const fontSizeStr = window.getComputedStyle(innerEl, null).getPropertyValue("font-size");
  let fontSizePx = parseFloat(fontSizeStr);
  const updateFontSizePx = (px2) => {
    px2 = Math.min(Math.max(px2, minFontSizePx), maxFontSizePx);
    fontSizePx = px2;
    innerEl.style.fontSize = `${fontSizePx}px`;
    return fontSizePx;
  };
  if (fontSizePx > maxFontSizePx || fontSizePx < minFontSizePx) {
    updateFontSizePx(fontSizePx);
  }
  const algoOpts = {
    innerEl,
    containerEl,
    fontSizePx,
    minFontSizePx,
    maxFontSizePx,
    fontSizePrecisionPx,
    updateFontSizePx
  };
  if (mode === "oneline") {
    onelineAlgo(algoOpts);
  } else if (mode === "multiline") {
    multilineAlgo(algoOpts);
  } else if (mode === "box") {
    boxAlgo(algoOpts);
  } else if (mode === "boxoneline") {
    boxAlgo(algoOpts);
  }
}
function autoTextSize({
  innerEl,
  containerEl,
  mode,
  minFontSizePx,
  maxFontSizePx,
  fontSizePrecisionPx
}) {
  let containerDimensions = void 0;
  const throttledUpdateTextSize = throttleAnimationFrame(() => {
    updateTextSize({
      innerEl,
      containerEl,
      mode,
      maxFontSizePx,
      minFontSizePx,
      fontSizePrecisionPx
    });
    containerDimensions = [
      getContentWidth(containerEl),
      getContentHeight(containerEl)
    ];
  });
  const resizeObserver2 = new ResizeObserver(() => {
    const prevContainerDimensions = containerDimensions;
    containerDimensions = [
      getContentWidth(containerEl),
      getContentHeight(containerEl)
    ];
    if ((prevContainerDimensions == null ? void 0 : prevContainerDimensions[0]) !== containerDimensions[0] || (prevContainerDimensions == null ? void 0 : prevContainerDimensions[1]) !== containerDimensions[1]) {
      throttledUpdateTextSize();
    }
  });
  resizeObserver2.observe(containerEl);
  throttledUpdateTextSize.disconnect = () => resizeObserver2.disconnect();
  return throttledUpdateTextSize;
}
function AutoTextSize(_a2) {
  var _b2 = _a2, {
    mode,
    minFontSizePx,
    maxFontSizePx,
    fontSizePrecisionPx,
    as: Comp = "div",
    children
  } = _b2, rest = __objRest$2(_b2, [
    "mode",
    "minFontSizePx",
    "maxFontSizePx",
    "fontSizePrecisionPx",
    "as",
    // TODO: The `...rest` props are not typed to reflect another `as`.
    "children"
  ]);
  const updateTextSizeRef = reactExports.useRef();
  reactExports.useEffect(() => {
    var _a22;
    return (_a22 = updateTextSizeRef.current) == null ? void 0 : _a22.call(updateTextSizeRef);
  }, [children]);
  const refCallback = reactExports.useCallback(
    (innerEl) => {
      var _a22;
      (_a22 = updateTextSizeRef.current) == null ? void 0 : _a22.disconnect();
      const containerEl = innerEl == null ? void 0 : innerEl.parentElement;
      if (!innerEl || !containerEl)
        return;
      updateTextSizeRef.current = autoTextSize({
        innerEl,
        containerEl,
        mode,
        minFontSizePx,
        maxFontSizePx,
        fontSizePrecisionPx
      });
    },
    [mode, minFontSizePx, maxFontSizePx, fontSizePrecisionPx]
  );
  return /* @__PURE__ */ React$6.createElement(Comp, __spreadValues$2({ ref: refCallback }, rest), children);
}
const log$x = buildLogger("EditableText");
const EditableText = reactExports.memo((props) => {
  const { path, name: name2, isDirectory, disabled = false } = props;
  const propsRef = reactExports.useRef(props);
  const [editing, setEditing] = reactExports.useState(false);
  const editingRef = reactExports.useRef(editing);
  const nodeRef = reactExports.useRef(null);
  const inputRef = reactExports.useRef(null);
  const [value2, setValue] = reactExports.useState(name2);
  const valueRef = reactExports.useRef(value2);
  useTraceUpdate(props, "EditableText");
  log$x("Rendering", props);
  useUpdateEffect(() => {
    editingRef.current = editing;
    if (editing) {
      const selection = isDirectory ? valueRef.current : getFileNameWithoutExtension(valueRef.current);
      createSelection(inputRef.current, 0, selection.length);
    }
  }, [editing]);
  useUpdateEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  useUpdateEffect(() => {
    if (!editingRef.current) {
      setValue(name2);
    }
  }, [name2]);
  const cancel2 = reactExports.useCallback(() => {
    if (editingRef.current) {
      setEditing(false);
      forceFocus(nodeRef.current);
      setValue(propsRef.current.name);
    }
  }, []);
  const submit = reactExports.useCallback(async () => {
    if (valueRef.current && valueRef.current != propsRef.current.name) {
      const rsp = await BApi$1.file.renameFile({
        fullname: path,
        newName: valueRef.current
      });
      if (!rsp.code) {
        setValue(valueRef.current);
      }
      setEditing(false);
    } else {
      cancel2();
    }
  }, [path, cancel2]);
  const enterEditingModeKeyDownHandler = reactExports.useCallback((e2) => {
    if (disabled || editingRef.current) {
      return;
    }
    if (e2.key == "F2") {
      setEditing(true);
      e2.stopPropagation();
    }
  }, [disabled]);
  const inputKeyDownHandler = reactExports.useCallback((e2) => {
    log$x("Key down", e2.key, e2.ctrlKey, e2.shiftKey, e2.altKey, e2.metaKey, e2);
    switch (e2.key) {
      case "Enter":
        submit();
        break;
      case "Escape":
        cancel2();
        break;
      case "Delete":
        break;
      default:
        return;
    }
  }, [submit, cancel2]);
  const parentListenerRef = reactExports.useRef(null);
  const handlerRef = reactExports.useRef(enterEditingModeKeyDownHandler);
  reactExports.useEffect(() => {
    const oldHandler = handlerRef.current;
    handlerRef.current = enterEditingModeKeyDownHandler;
    if (parentListenerRef.current && oldHandler !== enterEditingModeKeyDownHandler) {
      parentListenerRef.current.removeEventListener("keydown", oldHandler);
      parentListenerRef.current.addEventListener("keydown", enterEditingModeKeyDownHandler);
    }
    return () => {
      if (parentListenerRef.current) {
        parentListenerRef.current.removeEventListener("keydown", enterEditingModeKeyDownHandler);
      }
    };
  }, [enterEditingModeKeyDownHandler]);
  log$x(props, valueRef.current, editingRef.current);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ref: (r2) => {
        if (r2) {
          nodeRef.current = r2;
          let e2 = r2.parentElement;
          while (e2) {
            if (e2.className.includes("entry-keydown-listener")) {
              if (parentListenerRef.current && parentListenerRef.current !== e2) {
                parentListenerRef.current.removeEventListener("keydown", enterEditingModeKeyDownHandler);
              }
              if (parentListenerRef.current !== e2) {
                e2.addEventListener("keydown", enterEditingModeKeyDownHandler);
                parentListenerRef.current = e2;
              }
              break;
            } else {
              e2 = e2.parentElement;
            }
          }
        }
      },
      className: `min-w-0 ${editing ? "flex-1" : ""}`,
      onKeyDown: (e2) => enterEditingModeKeyDownHandler(e2.nativeEvent),
      children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          ref: inputRef,
          className: "w-full",
          "data-focus": false,
          radius: "none",
          onDoubleClick: (e2) => {
            log$x("onDoubleClick", e2);
            e2.stopPropagation();
            e2.preventDefault();
          },
          size: "sm",
          value: value2,
          onBlur: submit,
          onClick: (e2) => {
            log$x("onClick", e2);
            e2.stopPropagation();
            e2.preventDefault();
          },
          onKeyDown: inputKeyDownHandler,
          onValueChange: (v2) => {
            setValue(v2);
          }
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(AutoTextSize, { maxFontSizePx: 14, children: value2 })
    }
  );
});
function PasswordSelector(props) {
  const { onSelect, afterClose } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [passwords, setPasswords] = reactExports.useState([]);
  const [visible, setVisible] = reactExports.useState(true);
  const [order2, setOrder] = reactExports.useState(PasswordSearchOrder.Latest);
  const initialize = reactExports.useCallback(async () => {
    const rsp = await BApi$1.password.getAllPasswords();
    setPasswords(rsp.data || []);
  }, []);
  reactExports.useEffect(() => {
    initialize();
  }, []);
  const close = reactExports.useCallback(() => {
    setVisible(false);
  }, []);
  const renderPasswords = reactExports.useCallback(() => {
    const filtered = passwords.sort(
      (a2, b2) => order2 === PasswordSearchOrder.Latest ? b2.lastUsedAt.localeCompare(a2.lastUsedAt) : b2.usedTimes - a2.usedTimes
    );
    return filtered.map((p2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "password",
          onClick: () => {
            onSelect(p2.text);
            close();
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "top", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text", children: p2.text }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("Delete password from history?"),
                      children: t2(
                        "Are you sure you want to delete this password from history?"
                      ),
                      onOk: () => BApi$1.password.deletePassword(p2.text)
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "info", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "last-used-at", children: p2.lastUsedAt }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(badge_default, { count: p2.usedTimes })
            ] })
          ]
        }
      );
    });
  }, [passwords, order2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      v2: true,
      afterClose,
      className: "password-selector-dialog",
      closeMode: ["close", "mask", "esc"],
      footerActions: ["cancel"],
      title: t2("Passwords"),
      visible,
      width: "auto",
      onCancel: close,
      onClose: close,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "orders", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Order") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            radio_default.Group,
            {
              dataSource: [
                {
                  label: t2("Used recently"),
                  value: PasswordSearchOrder.Latest
                },
                {
                  label: t2("Used frequently"),
                  value: PasswordSearchOrder.Frequency
                }
              ],
              value: order2,
              onChange: (v2) => {
                setOrder(v2);
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "passwords", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "title", children: t2("Passwords") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "content", children: renderPasswords() })
        ] })
      ]
    }
  );
}
PasswordSelector.show = (props) => createPortalOfComponent(PasswordSelector, props);
const QuickPasswordCount = 5;
const loadTopNPasswords = async (type4) => {
  const rsp = await BApi$1.password.searchPasswords({
    order: type4,
    pageSize: QuickPasswordCount
  });
  return rsp.data || [];
};
const DecompressBalloon = (props) => {
  const { trigger, entry, passwords = [] } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const customPasswordRef = reactExports.useRef();
  const [recentPasswords, setRecentPasswords] = reactExports.useState([]);
  const [frequentlyUsedPasswords, setFrequentlyUsedPasswords] = reactExports.useState([]);
  const decompress = reactExports.useCallback((path, password) => {
    toast.default(t2("Start decompressing"));
    return BApi$1.file.decompressFiles({
      paths: [path],
      password
    });
  }, []);
  const onBalloonVisible = reactExports.useCallback(async () => {
    setRecentPasswords(await loadTopNPasswords(PasswordSearchOrder.Latest));
    setFrequentlyUsedPasswords(await loadTopNPasswords(PasswordSearchOrder.Frequency));
  }, []);
  const openPasswordSelector = reactExports.useCallback(() => {
    PasswordSelector.show({
      onSelect: (password) => {
        decompress(entry.path, password);
      }
    });
  }, []);
  const renderTopNPasswords = reactExports.useCallback(
    (type4) => {
      let label;
      let passwords2;
      switch (type4) {
        case PasswordSearchOrder.Latest:
          label = "recently used";
          passwords2 = recentPasswords;
          break;
        case PasswordSearchOrder.Frequency:
          label = "frequently used";
          passwords2 = frequentlyUsedPasswords;
          break;
      }
      if (passwords2.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded p-2.5 shadow-[rgba(0,0,0,0.05)_0px_0px_0px_1px,rgb(209,213,219)_0px_0px_0px_1px_inset]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1.5", children: [
            t2(`Alternatively, you can choose a password from ${label} passwords:`),
            passwords2.length === 5 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onClick: openPasswordSelector,
                children: t2("Show more")
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: passwords2.map((p2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "cursor-pointer",
                size: "sm",
                onClick: () => {
                  decompress(entry.path, p2.text);
                },
                onClose: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Delete password from history?"),
                    children: t2(
                      "Are you sure you want to delete this password from history?"
                    ),
                    onOk: () => BApi$1.password.deletePassword(p2.text)
                  });
                },
                children: p2.text
              },
              p2.text
            );
          }) })
        ] });
      }
      return;
    },
    [recentPasswords, frequentlyUsedPasswords]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "my-1.5", children: t2(
          "Contents will be decompressed to the same directory as the compressed file."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2.5", children: [
          passwords.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "fp.te.db.defaultPassword",
              values: {
                password: passwords[0]
              },
              children: [
                "By default, we will use ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", variant: "light", children: "password" }),
                "  as password."
              ]
            }
          ) }),
          passwords.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded p-2.5 shadow-[rgba(0,0,0,0.05)_0px_0px_0px_1px,rgb(209,213,219)_0px_0px_0px_1px_inset]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-1.5", children: t2(
              "Alternatively, you can choose a password from the following candidates:"
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: passwords.slice(1).map((password) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: "flat",
                onClick: () => {
                  decompress(entry.path, password);
                },
                children: password
              },
              password
            )) })
          ] }),
          renderTopNPasswords(PasswordSearchOrder.Latest),
          renderTopNPasswords(PasswordSearchOrder.Frequency),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded p-2.5 shadow-[rgba(0,0,0,0.05)_0px_0px_0px_1px,rgb(209,213,219)_0px_0px_0px_1px_inset]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-1.5", children: t2("Or you can use a custom password:") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                isClearable: true,
                endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    size: "sm",
                    variant: "flat",
                    onClick: () => {
                      if (customPasswordRef.current) {
                        decompress(entry.path, customPasswordRef.current);
                      } else {
                        toast.danger(instance.t("Password can not be empty"));
                      }
                    },
                    children: t2("Use custom password to decompress")
                  }
                ),
                placeholder: instance.t("Password"),
                size: "sm",
                style: { width: "100%" },
                onKeyDown: (e2) => {
                  e2.cancelable = true;
                },
                onMouseDown: (e2) => {
                  e2.stopPropagation();
                },
                onClick: (e2) => {
                  e2.stopPropagation();
                },
                onDoubleClick: (e2) => {
                  e2.stopPropagation();
                },
                onValueChange: (v2) => {
                  customPasswordRef.current = v2;
                }
              }
            )
          ] })
        ] })
      ] }),
      delay: 500,
      placement: "left",
      onClick: () => {
      },
      onOpenChange: (v2) => {
        if (v2) {
          onBalloonVisible();
        }
      },
      children: React$6.cloneElement(trigger, {
        onContextMenu: () => {
        },
        onClick: () => {
          if (trigger.props.onClick) {
            trigger.props.onClick();
          }
          decompress(entry.path);
        }
      })
    }
  );
};
DecompressBalloon.displayName = "DecompressBalloon";
const RightOperations = ({ entry, capabilities }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { actions } = entry;
  const isDecompressible = (capabilities == null ? void 0 : capabilities.includes("decompress")) && actions.includes(IwFsEntryAction.Decompress);
  const isWrappable = (capabilities == null ? void 0 : capabilities.includes("wrap")) && entry.isDirectory;
  const isMovable = capabilities == null ? void 0 : capabilities.includes("move");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    isDecompressible && /* @__PURE__ */ jsxRuntimeExports.jsx(
      DecompressBalloon,
      {
        entry,
        passwords: entry.passwordsForDecompressing,
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "ghost", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$L, { className: "text-sm" }),
          t2("fileExplorer.action.decompress")
        ] })
      },
      "decompress"
    ),
    isWrappable && /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "ghost",
        onClick: () => {
          createPortal(WrapModal, {
            entries: [entry]
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$17, { className: "text-sm" }),
          t2("fileExplorer.action.wrap")
        ]
      },
      "wrap"
    ),
    isMovable && /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "ghost",
        onClick: (e2) => {
          createPortal(FolderSelector, {
            sources: ["media library", "custom"],
            onSelect: (path) => {
              return BApi$1.file.moveEntries({
                destDir: path,
                entryPaths: [entry.path]
              });
            }
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$d, { className: "text-sm" }),
          t2("fileExplorer.action.move")
        ]
      },
      "move"
    )
  ] });
};
RightOperations.displayName = "RightOperations";
const ThumbnailPanelItem = ({
  entry,
  index: index2,
  activeIndex,
  isActive: isActive2,
  getThumbnailUrl,
  getMediaType,
  onEntryClick,
  activeThumbnailRef
}) => {
  const [imageLoading, setImageLoading] = reactExports.useState(true);
  const [imageError, setImageError] = reactExports.useState(false);
  const thumbnailUrl = getThumbnailUrl(entry);
  const mediaType = getMediaType(entry);
  const isDirectory = entry.type === IwFsType.Directory;
  const isCompressedFile = entry.type === IwFsType.CompressedFileEntry;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ref: isActive2 ? activeThumbnailRef : null,
      className: `group cursor-pointer transition-all duration-200 border-transparent relative ${isActive2 ? "bg-blue-500/20 border-l-blue-500/80" : "hover:bg-white/5"}`,
      title: entry.name,
      onClick: () => onEntryClick(entry),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center gap-1.5 relative w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-[120px] h-[120px] flex items-center justify-center bg-black/30 rounded overflow-hidden thumbnail-image-container", children: [
        thumbnailUrl ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          imageLoading && !imageError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center z-[2] bg-black/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "img",
            {
              alt: entry.name,
              className: "w-full h-full object-contain thumbnail-image",
              src: thumbnailUrl,
              onLoad: () => setImageLoading(false),
              onError: (e2) => {
                setImageLoading(false);
                setImageError(true);
                const target = e2.target;
                target.style.display = "none";
                if (target.parentElement) {
                  target.parentElement.classList.add("icon-fallback");
                }
              }
            }
          ),
          imageError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-full h-full text-white/70 thumbnail-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            FileSystemEntryIcon,
            {
              path: entry.path,
              size: 40,
              type: isDirectory ? IconType.Directory : IconType.Dynamic
            }
          ) })
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-full h-full text-white/70 thumbnail-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          FileSystemEntryIcon,
          {
            path: entry.path,
            size: 40,
            type: isDirectory ? IconType.Directory : IconType.Dynamic
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-0 left-0 right-0 px-2 py-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-white/90 text-xs text-center break-words line-clamp-6", title: entry.name, children: entry.name }) }),
        mediaType === MediaType.Video && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-1 right-1 px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase bg-red-500/80 text-white/90", children: "VIDEO" }),
        mediaType === MediaType.Audio && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-1 right-1 px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase bg-green-500/80 text-white/90", children: "AUDIO" }),
        mediaType === MediaType.Text && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-1 right-1 px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase bg-purple-500/80 text-white/90", children: "TEXT" }),
        (isDirectory || isCompressedFile) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-1 left-1 px-1.5 py-0.5 rounded text-[10px] font-semibold uppercase bg-blue-500/80 text-white/90", children: isDirectory ? "DIR" : "ZIP" })
      ] }) })
    }
  );
};
const ROW_HEIGHT = 126;
const ThumbnailPanel = ({
  entries,
  playableEntries,
  activeIndex,
  collapsed: collapsed2,
  onToggleCollapse,
  onEntryClick,
  getMediaType
}) => {
  const thumbnailPanelRef = reactExports.useRef(null);
  const activeThumbnailRef = reactExports.useRef(null);
  const virtualListRef = reactExports.useRef(null);
  const isInitialMount = reactExports.useRef(true);
  const getThumbnailUrl = reactExports.useCallback(
    (entry) => {
      const mediaType = getMediaType(entry);
      if (mediaType === MediaType.Image) {
        const pathToUse = entry.playPath || entry.path;
        return `${envConfig.apiEndpoint}/tool/thumbnail?path=${encodeURIComponent(pathToUse)}&w=150&h=150`;
      }
      return null;
    },
    [getMediaType]
  );
  const prevEntriesLengthRef = reactExports.useRef(entries.length);
  reactExports.useEffect(() => {
    if (isInitialMount.current) {
      isInitialMount.current = false;
      prevEntriesLengthRef.current = entries.length;
      return;
    }
    if (entries.length !== prevEntriesLengthRef.current) {
      prevEntriesLengthRef.current = entries.length;
      return;
    }
    if (!collapsed2 && virtualListRef.current && entries.length > 0) {
      const activeEntry = playableEntries[activeIndex];
      if (activeEntry) {
        const entryIndex = entries.findIndex((e2) => e2.path === activeEntry.path);
        if (entryIndex >= 0) {
          virtualListRef.current.scrollToRow(entryIndex);
        }
      }
    }
  }, [activeIndex, collapsed2, entries, playableEntries]);
  const rowRenderer = reactExports.useCallback(
    ({ index: index2, key, style: style2 }) => {
      const entry = entries[index2];
      if (!entry)
        return null;
      const playableIndex = playableEntries.findIndex((e2) => e2.path === entry.path);
      const isActive2 = playableIndex === activeIndex && playableIndex >= 0;
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { ...style2, padding: 0 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        ThumbnailPanelItem,
        {
          activeIndex,
          activeThumbnailRef: isActive2 ? activeThumbnailRef : null,
          entry,
          getMediaType,
          getThumbnailUrl,
          index: playableIndex,
          isActive: isActive2,
          onEntryClick
        }
      ) }, key);
    },
    [
      entries,
      playableEntries,
      activeIndex,
      getMediaType,
      getThumbnailUrl,
      onEntryClick
    ]
  );
  if (collapsed2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      TbChevronRight,
      {
        className: "absolute left-1 top-1/2 -translate-y-1/2 text-white/70 hover:text-white text-xl cursor-pointer hover:scale-110 transition-all duration-200 z-10",
        onClick: onToggleCollapse,
        title: "Expand thumbnail panel"
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative bg-[rgba(30,30,30,0.95)] border-r border-white/10 flex flex-col transition-all duration-300 ease-in-out w-[120px] min-w-[120px] max-w-[120px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      TbChevronLeft,
      {
        className: "absolute right-1 top-1/2 -translate-y-1/2 text-white/70 hover:text-white text-xl cursor-pointer hover:scale-110 transition-all duration-200 z-10",
        onClick: onToggleCollapse,
        title: "Collapse thumbnail panel"
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: thumbnailPanelRef,
        className: "flex-1 overflow-hidden thumbnail-list",
        onMouseDown: (e2) => {
          if (e2.button === 0) {
            e2.preventDefault();
          }
        },
        style: { userSelect: "none" },
        children: entries.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          List,
          {
            ref: virtualListRef,
            className: "thumbnail-list-virtualized",
            height,
            width,
            rowCount: entries.length,
            rowHeight: ROW_HEIGHT,
            rowRenderer,
            overscanRowCount: 15
          }
        ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full text-white/50 text-sm", children: "No entries" })
      }
    )
  ] });
};
const AUDIO_EXTENSIONS = /\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx)($|\?)/i;
const VIDEO_EXTENSIONS = /\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i;
const HLS_EXTENSIONS = /\.(m3u8)($|\?)/i;
const DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
const MATCH_URL_MUX = /stream\.mux\.com\/(?!\w+\.m3u8)(\w+)/;
const MATCH_URL_YOUTUBE = /(?:youtu\.be\/|youtube(?:-nocookie|education)?\.com\/(?:embed\/|v\/|watch\/|watch\?v=|watch\?.+&v=|shorts\/|live\/))((\w|-){11})|youtube\.com\/playlist\?list=|youtube\.com\/user\//;
const MATCH_URL_VIMEO = /vimeo\.com\/(?!progressive_redirect).+/;
const MATCH_URL_WISTIA = /(?:wistia\.(?:com|net)|wi\.st)\/(?:medias|embed)\/(?:iframe\/)?([^?]+)/;
const MATCH_URL_SPOTIFY = /open\.spotify\.com\/(\w+)\/(\w+)/i;
const MATCH_URL_TWITCH = /(?:www\.|go\.)?twitch\.tv\/([a-zA-Z0-9_]+|(videos?\/|\?video=)\d+)($|\?)/;
const MATCH_URL_TIKTOK = /tiktok\.com\/(?:@[^/]+\/video\/)?(\d+)(?:\/([\w-]+))?/;
const canPlayFile = (url2, test2) => {
  if (Array.isArray(url2)) {
    for (const item of url2) {
      if (typeof item === "string" && canPlayFile(item, test2)) {
        return true;
      }
      if (canPlayFile(item.src, test2)) {
        return true;
      }
    }
    return false;
  }
  return test2(url2);
};
const canPlay = {
  html: (url2) => canPlayFile(url2, (u2) => AUDIO_EXTENSIONS.test(u2) || VIDEO_EXTENSIONS.test(u2)),
  hls: (url2) => canPlayFile(url2, (u2) => HLS_EXTENSIONS.test(u2)),
  dash: (url2) => canPlayFile(url2, (u2) => DASH_EXTENSIONS.test(u2)),
  mux: (url2) => MATCH_URL_MUX.test(url2),
  youtube: (url2) => MATCH_URL_YOUTUBE.test(url2),
  vimeo: (url2) => MATCH_URL_VIMEO.test(url2) && !VIDEO_EXTENSIONS.test(url2) && !HLS_EXTENSIONS.test(url2),
  wistia: (url2) => MATCH_URL_WISTIA.test(url2),
  spotify: (url2) => MATCH_URL_SPOTIFY.test(url2),
  twitch: (url2) => MATCH_URL_TWITCH.test(url2),
  tiktok: (url2) => MATCH_URL_TIKTOK.test(url2)
};
const HtmlPlayer = React$6.forwardRef((props, ref) => {
  const Media = AUDIO_EXTENSIONS.test(`${props.src}`) ? "audio" : "video";
  return /* @__PURE__ */ React$6.createElement(Media, { ...props, ref }, props.children);
});
var HtmlPlayer_default = HtmlPlayer;
const Players = [
  {
    key: "hls",
    name: "hls.js",
    canPlay: canPlay.hls,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerHls' */
        "./react-B_E9Zu0Z.js"
      ), true ? __vite__mapDeps([0,1,2,3]) : void 0)
    )
  },
  {
    key: "dash",
    name: "dash.js",
    canPlay: canPlay.dash,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerDash' */
        "./react-BO-1k3Fo.js"
      ), true ? __vite__mapDeps([4,1]) : void 0)
    )
  },
  {
    key: "mux",
    name: "Mux",
    canPlay: canPlay.mux,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerMux' */
        "./index-BnaQdAqy.js"
      ), true ? __vite__mapDeps([5,3,1,2]) : void 0)
    )
  },
  {
    key: "youtube",
    name: "YouTube",
    canPlay: canPlay.youtube,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerYouTube' */
        "./react-C5wmGGPn.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "vimeo",
    name: "Vimeo",
    canPlay: canPlay.vimeo,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerVimeo' */
        "./react-B5s7q-EW.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "wistia",
    name: "Wistia",
    canPlay: canPlay.wistia,
    canEnablePIP: () => true,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerWistia' */
        "./react-DI8jbxCw.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "spotify",
    name: "Spotify",
    canPlay: canPlay.spotify,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerSpotify' */
        "./react-JZ_ql4rK.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "twitch",
    name: "Twitch",
    canPlay: canPlay.twitch,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerTwitch' */
        "./react-DOPfPtrE.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "tiktok",
    name: "TikTok",
    canPlay: canPlay.tiktok,
    canEnablePIP: () => false,
    player: reactExports.lazy(
      () => __vitePreload(() => import(
        /* webpackChunkName: 'reactPlayerTiktok' */
        "./react-Colr83kK.js"
      ), true ? __vite__mapDeps([]) : void 0)
    )
  },
  {
    key: "html",
    name: "html",
    canPlay: canPlay.html,
    canEnablePIP: () => true,
    player: HtmlPlayer_default
  }
];
var players_default = Players;
const defaultProps$1 = {
  // Falsy values don't need to be defined
  //
  // native video attrs
  // src: undefined,
  // preload: undefined,
  // crossOrigin: undefined,
  // autoPlay: false,
  // muted: false,
  // loop: false,
  // controls: false,
  // playsInline: false,
  width: "320px",
  height: "180px",
  // native video props
  volume: 1,
  playbackRate: 1,
  // custom props
  // playing: undefined,
  // pip: false,
  // light: false,
  // fallback: null,
  previewTabIndex: 0,
  previewAriaLabel: "",
  oEmbedUrl: "https://noembed.com/embed?url={url}"
};
const Player = React$6.forwardRef((props, ref) => {
  const { playing, pip } = props;
  const Player2 = props.activePlayer;
  const playerRef = reactExports.useRef(null);
  const startOnPlayRef = reactExports.useRef(true);
  reactExports.useEffect(() => {
    var _a2, _b2;
    if (!playerRef.current)
      return;
    if (playerRef.current.paused && playing === true) {
      playerRef.current.play();
    }
    if (!playerRef.current.paused && playing === false) {
      playerRef.current.pause();
    }
    playerRef.current.playbackRate = (_a2 = props.playbackRate) != null ? _a2 : 1;
    playerRef.current.volume = (_b2 = props.volume) != null ? _b2 : 1;
  });
  reactExports.useEffect(() => {
    var _a2, _b2, _c2, _d, _e;
    if (!playerRef.current || !globalThis.document)
      return;
    if (pip && !document.pictureInPictureElement) {
      try {
        (_b2 = (_a2 = playerRef.current).requestPictureInPicture) == null ? void 0 : _b2.call(_a2);
      } catch (err) {
      }
    }
    if (!pip && document.pictureInPictureElement) {
      try {
        (_d = (_c2 = playerRef.current).exitPictureInPicture) == null ? void 0 : _d.call(_c2);
        (_e = document.exitPictureInPicture) == null ? void 0 : _e.call(document);
      } catch (err) {
      }
    }
  }, [pip]);
  const handleLoadStart = (event) => {
    var _a2, _b2;
    startOnPlayRef.current = true;
    (_a2 = props.onReady) == null ? void 0 : _a2.call(props);
    (_b2 = props.onLoadStart) == null ? void 0 : _b2.call(props, event);
  };
  const handlePlay = (event) => {
    var _a2, _b2;
    if (startOnPlayRef.current) {
      startOnPlayRef.current = false;
      (_a2 = props.onStart) == null ? void 0 : _a2.call(props, event);
    }
    (_b2 = props.onPlay) == null ? void 0 : _b2.call(props, event);
  };
  if (!Player2) {
    return null;
  }
  const eventProps = {};
  for (const key in props) {
    if (key.startsWith("on")) {
      eventProps[key] = props[key];
    }
  }
  return /* @__PURE__ */ React$6.createElement(
    Player2,
    {
      ...eventProps,
      style: props.style,
      className: props.className,
      slot: props.slot,
      ref: reactExports.useCallback(
        (node2) => {
          playerRef.current = node2;
          if (typeof ref === "function") {
            ref(node2);
          } else if (ref !== null) {
            ref.current = node2;
          }
        },
        [ref]
      ),
      src: props.src,
      crossOrigin: props.crossOrigin,
      preload: props.preload,
      controls: props.controls,
      muted: props.muted,
      autoPlay: props.autoPlay,
      loop: props.loop,
      playsInline: props.playsInline,
      config: props.config,
      onLoadStart: handleLoadStart,
      onPlay: handlePlay
    },
    props.children
  );
});
Player.displayName = "Player";
var Player_default = Player;
const Preview = reactExports.lazy(() => __vitePreload(() => import(
  /* webpackChunkName: 'reactPlayerPreview' */
  "./Preview-CBmjhvMA.js"
), true ? __vite__mapDeps([]) : void 0));
const customPlayers = [];
const createReactPlayer = (players, playerFallback) => {
  const getActivePlayer = (src) => {
    for (const player of [...customPlayers, ...players]) {
      if (src && player.canPlay(src)) {
        return player;
      }
    }
    if (playerFallback) {
      return playerFallback;
    }
    return null;
  };
  const ReactPlayer = React$6.forwardRef((_props, ref) => {
    const props = { ...defaultProps$1, ..._props };
    const { src, slot, className, style: style2, width, height, fallback: fallback2, wrapper } = props;
    const [showPreview, setShowPreview] = reactExports.useState(!!props.light);
    reactExports.useEffect(() => {
      if (props.light) {
        setShowPreview(true);
      } else {
        setShowPreview(false);
      }
    }, [props.light]);
    const handleClickPreview = (e2) => {
      var _a2;
      setShowPreview(false);
      (_a2 = props.onClickPreview) == null ? void 0 : _a2.call(props, e2);
    };
    const renderPreview = (src2) => {
      if (!src2)
        return null;
      const { light: light2, playIcon, previewTabIndex, oEmbedUrl, previewAriaLabel } = props;
      return /* @__PURE__ */ React$6.createElement(
        Preview,
        {
          src: src2,
          light: light2,
          playIcon,
          previewTabIndex,
          previewAriaLabel,
          oEmbedUrl,
          onClickPreview: handleClickPreview
        }
      );
    };
    const renderActivePlayer = (src2) => {
      var _a2, _b2;
      const player = getActivePlayer(src2);
      if (!player)
        return null;
      const { style: style22, width: width2, height: height2, wrapper: wrapper2 } = props;
      const config2 = (_a2 = props.config) == null ? void 0 : _a2[player.key];
      return /* @__PURE__ */ React$6.createElement(
        Player_default,
        {
          ...props,
          ref,
          activePlayer: (_b2 = player.player) != null ? _b2 : player,
          slot: wrapper2 ? void 0 : slot,
          className: wrapper2 ? void 0 : className,
          style: wrapper2 ? { display: "block", width: "100%", height: "100%" } : { display: "block", width: width2, height: height2, ...style22 },
          config: config2
        }
      );
    };
    const Wrapper = wrapper == null ? ForwardChildren : wrapper;
    const UniversalSuspense = fallback2 === false ? ForwardChildren : reactExports.Suspense;
    return /* @__PURE__ */ React$6.createElement(Wrapper, { slot, className, style: { width, height, ...style2 } }, /* @__PURE__ */ React$6.createElement(UniversalSuspense, { fallback: fallback2 }, showPreview ? renderPreview(src) : renderActivePlayer(src)));
  });
  ReactPlayer.displayName = "ReactPlayer";
  ReactPlayer.addCustomPlayer = (player) => {
    customPlayers.push(player);
  };
  ReactPlayer.removeCustomPlayers = () => {
    customPlayers.length = 0;
  };
  ReactPlayer.canPlay = (src) => {
    if (src) {
      for (const Player2 of [...customPlayers, ...players]) {
        if (Player2.canPlay(src)) {
          return true;
        }
      }
    }
    return false;
  };
  ReactPlayer.canEnablePIP = (src) => {
    var _a2;
    if (src) {
      for (const Player2 of [...customPlayers, ...players]) {
        if (Player2.canPlay(src) && ((_a2 = Player2.canEnablePIP) == null ? void 0 : _a2.call(Player2))) {
          return true;
        }
      }
    }
    return false;
  };
  return ReactPlayer;
};
const ForwardChildren = ({ children }) => children;
const fallback = players_default[players_default.length - 1];
var src_default = createReactPlayer(players_default, fallback);
function bind(fn, thisArg) {
  return function wrap2() {
    return fn.apply(thisArg, arguments);
  };
}
const { toString: toString$3 } = Object.prototype;
const { getPrototypeOf } = Object;
const { iterator, toStringTag } = Symbol;
const kindOf = /* @__PURE__ */ ((cache2) => (thing) => {
  const str = toString$3.call(thing);
  return cache2[str] || (cache2[str] = str.slice(8, -1).toLowerCase());
})(/* @__PURE__ */ Object.create(null));
const kindOfTest = (type4) => {
  type4 = type4.toLowerCase();
  return (thing) => kindOf(thing) === type4;
};
const typeOfTest = (type4) => (thing) => typeof thing === type4;
const { isArray: isArray$2 } = Array;
const isUndefined = typeOfTest("undefined");
function isBuffer(val) {
  return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
}
const isArrayBuffer = kindOfTest("ArrayBuffer");
function isArrayBufferView(val) {
  let result;
  if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
    result = ArrayBuffer.isView(val);
  } else {
    result = val && val.buffer && isArrayBuffer(val.buffer);
  }
  return result;
}
const isString = typeOfTest("string");
const isFunction$1 = typeOfTest("function");
const isNumber = typeOfTest("number");
const isObject$1 = (thing) => thing !== null && typeof thing === "object";
const isBoolean = (thing) => thing === true || thing === false;
const isPlainObject$2 = (val) => {
  if (kindOf(val) !== "object") {
    return false;
  }
  const prototype2 = getPrototypeOf(val);
  return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
};
const isEmptyObject = (val) => {
  if (!isObject$1(val) || isBuffer(val)) {
    return false;
  }
  try {
    return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
  } catch (e2) {
    return false;
  }
};
const isDate = kindOfTest("Date");
const isFile = kindOfTest("File");
const isBlob = kindOfTest("Blob");
const isFileList = kindOfTest("FileList");
const isStream = (val) => isObject$1(val) && isFunction$1(val.pipe);
const isFormData = (thing) => {
  let kind;
  return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
  kind === "object" && isFunction$1(thing.toString) && thing.toString() === "[object FormData]"));
};
const isURLSearchParams = kindOfTest("URLSearchParams");
const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
const trim$1 = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
function forEach(obj, fn, { allOwnKeys = false } = {}) {
  if (obj === null || typeof obj === "undefined") {
    return;
  }
  let i2;
  let l2;
  if (typeof obj !== "object") {
    obj = [obj];
  }
  if (isArray$2(obj)) {
    for (i2 = 0, l2 = obj.length; i2 < l2; i2++) {
      fn.call(null, obj[i2], i2, obj);
    }
  } else {
    if (isBuffer(obj)) {
      return;
    }
    const keys2 = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
    const len = keys2.length;
    let key;
    for (i2 = 0; i2 < len; i2++) {
      key = keys2[i2];
      fn.call(null, obj[key], key, obj);
    }
  }
}
function findKey(obj, key) {
  if (isBuffer(obj)) {
    return null;
  }
  key = key.toLowerCase();
  const keys2 = Object.keys(obj);
  let i2 = keys2.length;
  let _key;
  while (i2-- > 0) {
    _key = keys2[i2];
    if (key === _key.toLowerCase()) {
      return _key;
    }
  }
  return null;
}
const _global = (() => {
  if (typeof globalThis !== "undefined")
    return globalThis;
  return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
})();
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
function merge$1() {
  const { caseless } = isContextDefined(this) && this || {};
  const result = {};
  const assignValue2 = (val, key) => {
    const targetKey = caseless && findKey(result, key) || key;
    if (isPlainObject$2(result[targetKey]) && isPlainObject$2(val)) {
      result[targetKey] = merge$1(result[targetKey], val);
    } else if (isPlainObject$2(val)) {
      result[targetKey] = merge$1({}, val);
    } else if (isArray$2(val)) {
      result[targetKey] = val.slice();
    } else {
      result[targetKey] = val;
    }
  };
  for (let i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
    arguments[i2] && forEach(arguments[i2], assignValue2);
  }
  return result;
}
const extend$2 = (a2, b2, thisArg, { allOwnKeys } = {}) => {
  forEach(b2, (val, key) => {
    if (thisArg && isFunction$1(val)) {
      a2[key] = bind(val, thisArg);
    } else {
      a2[key] = val;
    }
  }, { allOwnKeys });
  return a2;
};
const stripBOM = (content2) => {
  if (content2.charCodeAt(0) === 65279) {
    content2 = content2.slice(1);
  }
  return content2;
};
const inherits = (constructor, superConstructor, props, descriptors2) => {
  constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
  constructor.prototype.constructor = constructor;
  Object.defineProperty(constructor, "super", {
    value: superConstructor.prototype
  });
  props && Object.assign(constructor.prototype, props);
};
const toFlatObject = (sourceObj, destObj, filter3, propFilter) => {
  let props;
  let i2;
  let prop;
  const merged = {};
  destObj = destObj || {};
  if (sourceObj == null)
    return destObj;
  do {
    props = Object.getOwnPropertyNames(sourceObj);
    i2 = props.length;
    while (i2-- > 0) {
      prop = props[i2];
      if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
        destObj[prop] = sourceObj[prop];
        merged[prop] = true;
      }
    }
    sourceObj = filter3 !== false && getPrototypeOf(sourceObj);
  } while (sourceObj && (!filter3 || filter3(sourceObj, destObj)) && sourceObj !== Object.prototype);
  return destObj;
};
const endsWith = (str, searchString, position2) => {
  str = String(str);
  if (position2 === void 0 || position2 > str.length) {
    position2 = str.length;
  }
  position2 -= searchString.length;
  const lastIndex = str.indexOf(searchString, position2);
  return lastIndex !== -1 && lastIndex === position2;
};
const toArray = (thing) => {
  if (!thing)
    return null;
  if (isArray$2(thing))
    return thing;
  let i2 = thing.length;
  if (!isNumber(i2))
    return null;
  const arr = new Array(i2);
  while (i2-- > 0) {
    arr[i2] = thing[i2];
  }
  return arr;
};
const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
  return (thing) => {
    return TypedArray && thing instanceof TypedArray;
  };
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
const forEachEntry = (obj, fn) => {
  const generator = obj && obj[iterator];
  const _iterator = generator.call(obj);
  let result;
  while ((result = _iterator.next()) && !result.done) {
    const pair = result.value;
    fn.call(obj, pair[0], pair[1]);
  }
};
const matchAll = (regExp, str) => {
  let matches;
  const arr = [];
  while ((matches = regExp.exec(str)) !== null) {
    arr.push(matches);
  }
  return arr;
};
const isHTMLForm = kindOfTest("HTMLFormElement");
const toCamelCase = (str) => {
  return str.toLowerCase().replace(
    /[-_\s]([a-z\d])(\w*)/g,
    function replacer(m2, p1, p2) {
      return p1.toUpperCase() + p2;
    }
  );
};
const hasOwnProperty$2 = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
const isRegExp = kindOfTest("RegExp");
const reduceDescriptors = (obj, reducer2) => {
  const descriptors2 = Object.getOwnPropertyDescriptors(obj);
  const reducedDescriptors = {};
  forEach(descriptors2, (descriptor, name2) => {
    let ret;
    if ((ret = reducer2(descriptor, name2, obj)) !== false) {
      reducedDescriptors[name2] = ret || descriptor;
    }
  });
  Object.defineProperties(obj, reducedDescriptors);
};
const freezeMethods = (obj) => {
  reduceDescriptors(obj, (descriptor, name2) => {
    if (isFunction$1(obj) && ["arguments", "caller", "callee"].indexOf(name2) !== -1) {
      return false;
    }
    const value2 = obj[name2];
    if (!isFunction$1(value2))
      return;
    descriptor.enumerable = false;
    if ("writable" in descriptor) {
      descriptor.writable = false;
      return;
    }
    if (!descriptor.set) {
      descriptor.set = () => {
        throw Error("Can not rewrite read-only method '" + name2 + "'");
      };
    }
  });
};
const toObjectSet = (arrayOrString, delimiter2) => {
  const obj = {};
  const define = (arr) => {
    arr.forEach((value2) => {
      obj[value2] = true;
    });
  };
  isArray$2(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter2));
  return obj;
};
const noop3 = () => {
};
const toFiniteNumber = (value2, defaultValue2) => {
  return value2 != null && Number.isFinite(value2 = +value2) ? value2 : defaultValue2;
};
function isSpecCompliantForm(thing) {
  return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
}
const toJSONObject = (obj) => {
  const stack = new Array(10);
  const visit2 = (source2, i2) => {
    if (isObject$1(source2)) {
      if (stack.indexOf(source2) >= 0) {
        return;
      }
      if (isBuffer(source2)) {
        return source2;
      }
      if (!("toJSON" in source2)) {
        stack[i2] = source2;
        const target = isArray$2(source2) ? [] : {};
        forEach(source2, (value2, key) => {
          const reducedValue = visit2(value2, i2 + 1);
          !isUndefined(reducedValue) && (target[key] = reducedValue);
        });
        stack[i2] = void 0;
        return target;
      }
    }
    return source2;
  };
  return visit2(obj, 0);
};
const isAsyncFn = kindOfTest("AsyncFunction");
const isThenable = (thing) => thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
  if (setImmediateSupported) {
    return setImmediate;
  }
  return postMessageSupported ? ((token2, callbacks) => {
    _global.addEventListener("message", ({ source: source2, data }) => {
      if (source2 === _global && data === token2) {
        callbacks.length && callbacks.shift()();
      }
    }, false);
    return (cb2) => {
      callbacks.push(cb2);
      _global.postMessage(token2, "*");
    };
  })(`axios@${Math.random()}`, []) : (cb2) => setTimeout(cb2);
})(
  typeof setImmediate === "function",
  isFunction$1(_global.postMessage)
);
const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
const utils$1 = {
  isArray: isArray$2,
  isArrayBuffer,
  isBuffer,
  isFormData,
  isArrayBufferView,
  isString,
  isNumber,
  isBoolean,
  isObject: isObject$1,
  isPlainObject: isPlainObject$2,
  isEmptyObject,
  isReadableStream,
  isRequest,
  isResponse,
  isHeaders,
  isUndefined,
  isDate,
  isFile,
  isBlob,
  isRegExp,
  isFunction: isFunction$1,
  isStream,
  isURLSearchParams,
  isTypedArray,
  isFileList,
  forEach,
  merge: merge$1,
  extend: extend$2,
  trim: trim$1,
  stripBOM,
  inherits,
  toFlatObject,
  kindOf,
  kindOfTest,
  endsWith,
  toArray,
  forEachEntry,
  matchAll,
  isHTMLForm,
  hasOwnProperty: hasOwnProperty$2,
  hasOwnProp: hasOwnProperty$2,
  // an alias to avoid ESLint no-prototype-builtins detection
  reduceDescriptors,
  freezeMethods,
  toObjectSet,
  toCamelCase,
  noop: noop3,
  toFiniteNumber,
  findKey,
  global: _global,
  isContextDefined,
  isSpecCompliantForm,
  toJSONObject,
  isAsyncFn,
  isThenable,
  setImmediate: _setImmediate,
  asap,
  isIterable
};
function AxiosError$1(message, code2, config2, request2, response) {
  Error.call(this);
  if (Error.captureStackTrace) {
    Error.captureStackTrace(this, this.constructor);
  } else {
    this.stack = new Error().stack;
  }
  this.message = message;
  this.name = "AxiosError";
  code2 && (this.code = code2);
  config2 && (this.config = config2);
  request2 && (this.request = request2);
  if (response) {
    this.response = response;
    this.status = response.status ? response.status : null;
  }
}
utils$1.inherits(AxiosError$1, Error, {
  toJSON: function toJSON2() {
    return {
      // Standard
      message: this.message,
      name: this.name,
      // Microsoft
      description: this.description,
      number: this.number,
      // Mozilla
      fileName: this.fileName,
      lineNumber: this.lineNumber,
      columnNumber: this.columnNumber,
      stack: this.stack,
      // Axios
      config: utils$1.toJSONObject(this.config),
      code: this.code,
      status: this.status
    };
  }
});
const prototype$1 = AxiosError$1.prototype;
const descriptors = {};
[
  "ERR_BAD_OPTION_VALUE",
  "ERR_BAD_OPTION",
  "ECONNABORTED",
  "ETIMEDOUT",
  "ERR_NETWORK",
  "ERR_FR_TOO_MANY_REDIRECTS",
  "ERR_DEPRECATED",
  "ERR_BAD_RESPONSE",
  "ERR_BAD_REQUEST",
  "ERR_CANCELED",
  "ERR_NOT_SUPPORT",
  "ERR_INVALID_URL"
  // eslint-disable-next-line func-names
].forEach((code2) => {
  descriptors[code2] = { value: code2 };
});
Object.defineProperties(AxiosError$1, descriptors);
Object.defineProperty(prototype$1, "isAxiosError", { value: true });
AxiosError$1.from = (error2, code2, config2, request2, response, customProps) => {
  const axiosError = Object.create(prototype$1);
  utils$1.toFlatObject(error2, axiosError, function filter3(obj) {
    return obj !== Error.prototype;
  }, (prop) => {
    return prop !== "isAxiosError";
  });
  AxiosError$1.call(axiosError, error2.message, code2, config2, request2, response);
  axiosError.cause = error2;
  axiosError.name = error2.name;
  customProps && Object.assign(axiosError, customProps);
  return axiosError;
};
const httpAdapter = null;
function isVisitable(thing) {
  return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
}
function removeBrackets(key) {
  return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
}
function renderKey(path, key, dots) {
  if (!path)
    return key;
  return path.concat(key).map(function each2(token2, i2) {
    token2 = removeBrackets(token2);
    return !dots && i2 ? "[" + token2 + "]" : token2;
  }).join(dots ? "." : "");
}
function isFlatArray(arr) {
  return utils$1.isArray(arr) && !arr.some(isVisitable);
}
const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter2(prop) {
  return /^is[A-Z]/.test(prop);
});
function toFormData$1(obj, formData, options) {
  if (!utils$1.isObject(obj)) {
    throw new TypeError("target must be an object");
  }
  formData = formData || new FormData();
  options = utils$1.toFlatObject(options, {
    metaTokens: true,
    dots: false,
    indexes: false
  }, false, function defined2(option, source2) {
    return !utils$1.isUndefined(source2[option]);
  });
  const metaTokens = options.metaTokens;
  const visitor = options.visitor || defaultVisitor;
  const dots = options.dots;
  const indexes = options.indexes;
  const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
  if (!utils$1.isFunction(visitor)) {
    throw new TypeError("visitor must be a function");
  }
  function convertValue(value2) {
    if (value2 === null)
      return "";
    if (utils$1.isDate(value2)) {
      return value2.toISOString();
    }
    if (utils$1.isBoolean(value2)) {
      return value2.toString();
    }
    if (!useBlob && utils$1.isBlob(value2)) {
      throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
    }
    if (utils$1.isArrayBuffer(value2) || utils$1.isTypedArray(value2)) {
      return useBlob && typeof Blob === "function" ? new Blob([value2]) : Buffer.from(value2);
    }
    return value2;
  }
  function defaultVisitor(value2, key, path) {
    let arr = value2;
    if (value2 && !path && typeof value2 === "object") {
      if (utils$1.endsWith(key, "{}")) {
        key = metaTokens ? key : key.slice(0, -2);
        value2 = JSON.stringify(value2);
      } else if (utils$1.isArray(value2) && isFlatArray(value2) || (utils$1.isFileList(value2) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value2))) {
        key = removeBrackets(key);
        arr.forEach(function each2(el2, index2) {
          !(utils$1.isUndefined(el2) || el2 === null) && formData.append(
            // eslint-disable-next-line no-nested-ternary
            indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
            convertValue(el2)
          );
        });
        return false;
      }
    }
    if (isVisitable(value2)) {
      return true;
    }
    formData.append(renderKey(path, key, dots), convertValue(value2));
    return false;
  }
  const stack = [];
  const exposedHelpers = Object.assign(predicates, {
    defaultVisitor,
    convertValue,
    isVisitable
  });
  function build(value2, path) {
    if (utils$1.isUndefined(value2))
      return;
    if (stack.indexOf(value2) !== -1) {
      throw Error("Circular reference detected in " + path.join("."));
    }
    stack.push(value2);
    utils$1.forEach(value2, function each2(el2, key) {
      const result = !(utils$1.isUndefined(el2) || el2 === null) && visitor.call(
        formData,
        el2,
        utils$1.isString(key) ? key.trim() : key,
        path,
        exposedHelpers
      );
      if (result === true) {
        build(el2, path ? path.concat(key) : [key]);
      }
    });
    stack.pop();
  }
  if (!utils$1.isObject(obj)) {
    throw new TypeError("data must be an object");
  }
  build(obj);
  return formData;
}
function encode$1(str) {
  const charMap = {
    "!": "%21",
    "'": "%27",
    "(": "%28",
    ")": "%29",
    "~": "%7E",
    "%20": "+",
    "%00": "\0"
  };
  return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match5) {
    return charMap[match5];
  });
}
function AxiosURLSearchParams(params, options) {
  this._pairs = [];
  params && toFormData$1(params, this, options);
}
const prototype = AxiosURLSearchParams.prototype;
prototype.append = function append2(name2, value2) {
  this._pairs.push([name2, value2]);
};
prototype.toString = function toString2(encoder) {
  const _encode = encoder ? function(value2) {
    return encoder.call(this, value2, encode$1);
  } : encode$1;
  return this._pairs.map(function each2(pair) {
    return _encode(pair[0]) + "=" + _encode(pair[1]);
  }, "").join("&");
};
function encode(val) {
  return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
}
function buildURL(url2, params, options) {
  if (!params) {
    return url2;
  }
  const _encode = options && options.encode || encode;
  if (utils$1.isFunction(options)) {
    options = {
      serialize: options
    };
  }
  const serializeFn = options && options.serialize;
  let serializedParams;
  if (serializeFn) {
    serializedParams = serializeFn(params, options);
  } else {
    serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
  }
  if (serializedParams) {
    const hashmarkIndex = url2.indexOf("#");
    if (hashmarkIndex !== -1) {
      url2 = url2.slice(0, hashmarkIndex);
    }
    url2 += (url2.indexOf("?") === -1 ? "?" : "&") + serializedParams;
  }
  return url2;
}
class InterceptorManager {
  constructor() {
    this.handlers = [];
  }
  /**
   * Add a new interceptor to the stack
   *
   * @param {Function} fulfilled The function to handle `then` for a `Promise`
   * @param {Function} rejected The function to handle `reject` for a `Promise`
   *
   * @return {Number} An ID used to remove interceptor later
   */
  use(fulfilled, rejected, options) {
    this.handlers.push({
      fulfilled,
      rejected,
      synchronous: options ? options.synchronous : false,
      runWhen: options ? options.runWhen : null
    });
    return this.handlers.length - 1;
  }
  /**
   * Remove an interceptor from the stack
   *
   * @param {Number} id The ID that was returned by `use`
   *
   * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
   */
  eject(id2) {
    if (this.handlers[id2]) {
      this.handlers[id2] = null;
    }
  }
  /**
   * Clear all interceptors from the stack
   *
   * @returns {void}
   */
  clear() {
    if (this.handlers) {
      this.handlers = [];
    }
  }
  /**
   * Iterate over all the registered interceptors
   *
   * This method is particularly useful for skipping over any
   * interceptors that may have become `null` calling `eject`.
   *
   * @param {Function} fn The function to call for each interceptor
   *
   * @returns {void}
   */
  forEach(fn) {
    utils$1.forEach(this.handlers, function forEachHandler(h3) {
      if (h3 !== null) {
        fn(h3);
      }
    });
  }
}
const transitionalDefaults = {
  silentJSONParsing: true,
  forcedJSONParsing: true,
  clarifyTimeoutError: false
};
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
const platform$1 = {
  isBrowser: true,
  classes: {
    URLSearchParams: URLSearchParams$1,
    FormData: FormData$1,
    Blob: Blob$1
  },
  protocols: ["http", "https", "file", "blob", "url", "data"]
};
const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
const _navigator = typeof navigator === "object" && navigator || void 0;
const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
const hasStandardBrowserWebWorkerEnv = (() => {
  return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
  self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
})();
const origin = hasBrowserEnv && window.location.href || "http://localhost";
const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  hasBrowserEnv,
  hasStandardBrowserEnv,
  hasStandardBrowserWebWorkerEnv,
  navigator: _navigator,
  origin
}, Symbol.toStringTag, { value: "Module" }));
const platform = {
  ...utils,
  ...platform$1
};
function toURLEncodedForm(data, options) {
  return toFormData$1(data, new platform.classes.URLSearchParams(), {
    visitor: function(value2, key, path, helpers) {
      if (platform.isNode && utils$1.isBuffer(value2)) {
        this.append(key, value2.toString("base64"));
        return false;
      }
      return helpers.defaultVisitor.apply(this, arguments);
    },
    ...options
  });
}
function parsePropPath(name2) {
  return utils$1.matchAll(/\w+|\[(\w*)]/g, name2).map((match5) => {
    return match5[0] === "[]" ? "" : match5[1] || match5[0];
  });
}
function arrayToObject(arr) {
  const obj = {};
  const keys2 = Object.keys(arr);
  let i2;
  const len = keys2.length;
  let key;
  for (i2 = 0; i2 < len; i2++) {
    key = keys2[i2];
    obj[key] = arr[key];
  }
  return obj;
}
function formDataToJSON(formData) {
  function buildPath(path, value2, target, index2) {
    let name2 = path[index2++];
    if (name2 === "__proto__")
      return true;
    const isNumericKey = Number.isFinite(+name2);
    const isLast = index2 >= path.length;
    name2 = !name2 && utils$1.isArray(target) ? target.length : name2;
    if (isLast) {
      if (utils$1.hasOwnProp(target, name2)) {
        target[name2] = [target[name2], value2];
      } else {
        target[name2] = value2;
      }
      return !isNumericKey;
    }
    if (!target[name2] || !utils$1.isObject(target[name2])) {
      target[name2] = [];
    }
    const result = buildPath(path, value2, target[name2], index2);
    if (result && utils$1.isArray(target[name2])) {
      target[name2] = arrayToObject(target[name2]);
    }
    return !isNumericKey;
  }
  if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
    const obj = {};
    utils$1.forEachEntry(formData, (name2, value2) => {
      buildPath(parsePropPath(name2), value2, obj, 0);
    });
    return obj;
  }
  return null;
}
function stringifySafely(rawValue, parser, encoder) {
  if (utils$1.isString(rawValue)) {
    try {
      (parser || JSON.parse)(rawValue);
      return utils$1.trim(rawValue);
    } catch (e2) {
      if (e2.name !== "SyntaxError") {
        throw e2;
      }
    }
  }
  return (encoder || JSON.stringify)(rawValue);
}
const defaults = {
  transitional: transitionalDefaults,
  adapter: ["xhr", "http", "fetch"],
  transformRequest: [function transformRequest(data, headers) {
    const contentType = headers.getContentType() || "";
    const hasJSONContentType = contentType.indexOf("application/json") > -1;
    const isObjectPayload = utils$1.isObject(data);
    if (isObjectPayload && utils$1.isHTMLForm(data)) {
      data = new FormData(data);
    }
    const isFormData2 = utils$1.isFormData(data);
    if (isFormData2) {
      return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
    }
    if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
      return data;
    }
    if (utils$1.isArrayBufferView(data)) {
      return data.buffer;
    }
    if (utils$1.isURLSearchParams(data)) {
      headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
      return data.toString();
    }
    let isFileList2;
    if (isObjectPayload) {
      if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
        return toURLEncodedForm(data, this.formSerializer).toString();
      }
      if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
        const _FormData = this.env && this.env.FormData;
        return toFormData$1(
          isFileList2 ? { "files[]": data } : data,
          _FormData && new _FormData(),
          this.formSerializer
        );
      }
    }
    if (isObjectPayload || hasJSONContentType) {
      headers.setContentType("application/json", false);
      return stringifySafely(data);
    }
    return data;
  }],
  transformResponse: [function transformResponse(data) {
    const transitional2 = this.transitional || defaults.transitional;
    const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
    const JSONRequested = this.responseType === "json";
    if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
      return data;
    }
    if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
      const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
      const strictJSONParsing = !silentJSONParsing && JSONRequested;
      try {
        return JSON.parse(data);
      } catch (e2) {
        if (strictJSONParsing) {
          if (e2.name === "SyntaxError") {
            throw AxiosError$1.from(e2, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
          }
          throw e2;
        }
      }
    }
    return data;
  }],
  /**
   * A timeout in milliseconds to abort a request. If set to 0 (default) a
   * timeout is not created.
   */
  timeout: 0,
  xsrfCookieName: "XSRF-TOKEN",
  xsrfHeaderName: "X-XSRF-TOKEN",
  maxContentLength: -1,
  maxBodyLength: -1,
  env: {
    FormData: platform.classes.FormData,
    Blob: platform.classes.Blob
  },
  validateStatus: function validateStatus(status) {
    return status >= 200 && status < 300;
  },
  headers: {
    common: {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": void 0
    }
  }
};
utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method4) => {
  defaults.headers[method4] = {};
});
const ignoreDuplicateOf = utils$1.toObjectSet([
  "age",
  "authorization",
  "content-length",
  "content-type",
  "etag",
  "expires",
  "from",
  "host",
  "if-modified-since",
  "if-unmodified-since",
  "last-modified",
  "location",
  "max-forwards",
  "proxy-authorization",
  "referer",
  "retry-after",
  "user-agent"
]);
const parseHeaders = (rawHeaders) => {
  const parsed = {};
  let key;
  let val;
  let i2;
  rawHeaders && rawHeaders.split("\n").forEach(function parser(line2) {
    i2 = line2.indexOf(":");
    key = line2.substring(0, i2).trim().toLowerCase();
    val = line2.substring(i2 + 1).trim();
    if (!key || parsed[key] && ignoreDuplicateOf[key]) {
      return;
    }
    if (key === "set-cookie") {
      if (parsed[key]) {
        parsed[key].push(val);
      } else {
        parsed[key] = [val];
      }
    } else {
      parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
    }
  });
  return parsed;
};
const $internals = Symbol("internals");
function normalizeHeader(header) {
  return header && String(header).trim().toLowerCase();
}
function normalizeValue(value2) {
  if (value2 === false || value2 == null) {
    return value2;
  }
  return utils$1.isArray(value2) ? value2.map(normalizeValue) : String(value2);
}
function parseTokens(str) {
  const tokens2 = /* @__PURE__ */ Object.create(null);
  const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
  let match5;
  while (match5 = tokensRE.exec(str)) {
    tokens2[match5[1]] = match5[2];
  }
  return tokens2;
}
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
function matchHeaderValue(context, value2, header, filter3, isHeaderNameFilter) {
  if (utils$1.isFunction(filter3)) {
    return filter3.call(this, value2, header);
  }
  if (isHeaderNameFilter) {
    value2 = header;
  }
  if (!utils$1.isString(value2))
    return;
  if (utils$1.isString(filter3)) {
    return value2.indexOf(filter3) !== -1;
  }
  if (utils$1.isRegExp(filter3)) {
    return filter3.test(value2);
  }
}
function formatHeader(header) {
  return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char2, str) => {
    return char2.toUpperCase() + str;
  });
}
function buildAccessors(obj, header) {
  const accessorName = utils$1.toCamelCase(" " + header);
  ["get", "set", "has"].forEach((methodName) => {
    Object.defineProperty(obj, methodName + accessorName, {
      value: function(arg1, arg2, arg3) {
        return this[methodName].call(this, header, arg1, arg2, arg3);
      },
      configurable: true
    });
  });
}
let AxiosHeaders$1 = class AxiosHeaders {
  constructor(headers) {
    headers && this.set(headers);
  }
  set(header, valueOrRewrite, rewrite) {
    const self2 = this;
    function setHeader(_value, _header, _rewrite) {
      const lHeader = normalizeHeader(_header);
      if (!lHeader) {
        throw new Error("header name must be a non-empty string");
      }
      const key = utils$1.findKey(self2, lHeader);
      if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
        self2[key || _header] = normalizeValue(_value);
      }
    }
    const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
    if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
      setHeaders(header, valueOrRewrite);
    } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
      setHeaders(parseHeaders(header), valueOrRewrite);
    } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
      let obj = {}, dest, key;
      for (const entry of header) {
        if (!utils$1.isArray(entry)) {
          throw TypeError("Object iterator must return a key-value pair");
        }
        obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
      }
      setHeaders(obj, valueOrRewrite);
    } else {
      header != null && setHeader(valueOrRewrite, header, rewrite);
    }
    return this;
  }
  get(header, parser) {
    header = normalizeHeader(header);
    if (header) {
      const key = utils$1.findKey(this, header);
      if (key) {
        const value2 = this[key];
        if (!parser) {
          return value2;
        }
        if (parser === true) {
          return parseTokens(value2);
        }
        if (utils$1.isFunction(parser)) {
          return parser.call(this, value2, key);
        }
        if (utils$1.isRegExp(parser)) {
          return parser.exec(value2);
        }
        throw new TypeError("parser must be boolean|regexp|function");
      }
    }
  }
  has(header, matcher) {
    header = normalizeHeader(header);
    if (header) {
      const key = utils$1.findKey(this, header);
      return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
    }
    return false;
  }
  delete(header, matcher) {
    const self2 = this;
    let deleted = false;
    function deleteHeader(_header) {
      _header = normalizeHeader(_header);
      if (_header) {
        const key = utils$1.findKey(self2, _header);
        if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
          delete self2[key];
          deleted = true;
        }
      }
    }
    if (utils$1.isArray(header)) {
      header.forEach(deleteHeader);
    } else {
      deleteHeader(header);
    }
    return deleted;
  }
  clear(matcher) {
    const keys2 = Object.keys(this);
    let i2 = keys2.length;
    let deleted = false;
    while (i2--) {
      const key = keys2[i2];
      if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
        delete this[key];
        deleted = true;
      }
    }
    return deleted;
  }
  normalize(format2) {
    const self2 = this;
    const headers = {};
    utils$1.forEach(this, (value2, header) => {
      const key = utils$1.findKey(headers, header);
      if (key) {
        self2[key] = normalizeValue(value2);
        delete self2[header];
        return;
      }
      const normalized = format2 ? formatHeader(header) : String(header).trim();
      if (normalized !== header) {
        delete self2[header];
      }
      self2[normalized] = normalizeValue(value2);
      headers[normalized] = true;
    });
    return this;
  }
  concat(...targets) {
    return this.constructor.concat(this, ...targets);
  }
  toJSON(asStrings) {
    const obj = /* @__PURE__ */ Object.create(null);
    utils$1.forEach(this, (value2, header) => {
      value2 != null && value2 !== false && (obj[header] = asStrings && utils$1.isArray(value2) ? value2.join(", ") : value2);
    });
    return obj;
  }
  [Symbol.iterator]() {
    return Object.entries(this.toJSON())[Symbol.iterator]();
  }
  toString() {
    return Object.entries(this.toJSON()).map(([header, value2]) => header + ": " + value2).join("\n");
  }
  getSetCookie() {
    return this.get("set-cookie") || [];
  }
  get [Symbol.toStringTag]() {
    return "AxiosHeaders";
  }
  static from(thing) {
    return thing instanceof this ? thing : new this(thing);
  }
  static concat(first, ...targets) {
    const computed = new this(first);
    targets.forEach((target) => computed.set(target));
    return computed;
  }
  static accessor(header) {
    const internals = this[$internals] = this[$internals] = {
      accessors: {}
    };
    const accessors = internals.accessors;
    const prototype2 = this.prototype;
    function defineAccessor(_header) {
      const lHeader = normalizeHeader(_header);
      if (!accessors[lHeader]) {
        buildAccessors(prototype2, _header);
        accessors[lHeader] = true;
      }
    }
    utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
    return this;
  }
};
AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value: value2 }, key) => {
  let mapped = key[0].toUpperCase() + key.slice(1);
  return {
    get: () => value2,
    set(headerValue) {
      this[mapped] = headerValue;
    }
  };
});
utils$1.freezeMethods(AxiosHeaders$1);
function transformData(fns, response) {
  const config2 = this || defaults;
  const context = response || config2;
  const headers = AxiosHeaders$1.from(context.headers);
  let data = context.data;
  utils$1.forEach(fns, function transform2(fn) {
    data = fn.call(config2, data, headers.normalize(), response ? response.status : void 0);
  });
  headers.normalize();
  return data;
}
function isCancel$1(value2) {
  return !!(value2 && value2.__CANCEL__);
}
function CanceledError$1(message, config2, request2) {
  AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config2, request2);
  this.name = "CanceledError";
}
utils$1.inherits(CanceledError$1, AxiosError$1, {
  __CANCEL__: true
});
function settle(resolve2, reject, response) {
  const validateStatus2 = response.config.validateStatus;
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
    resolve2(response);
  } else {
    reject(new AxiosError$1(
      "Request failed with status code " + response.status,
      [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
      response.config,
      response.request,
      response
    ));
  }
}
function parseProtocol(url2) {
  const match5 = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url2);
  return match5 && match5[1] || "";
}
function speedometer(samplesCount, min2) {
  samplesCount = samplesCount || 10;
  const bytes = new Array(samplesCount);
  const timestamps = new Array(samplesCount);
  let head = 0;
  let tail = 0;
  let firstSampleTS;
  min2 = min2 !== void 0 ? min2 : 1e3;
  return function push2(chunkLength) {
    const now2 = Date.now();
    const startedAt = timestamps[tail];
    if (!firstSampleTS) {
      firstSampleTS = now2;
    }
    bytes[head] = chunkLength;
    timestamps[head] = now2;
    let i2 = tail;
    let bytesCount = 0;
    while (i2 !== head) {
      bytesCount += bytes[i2++];
      i2 = i2 % samplesCount;
    }
    head = (head + 1) % samplesCount;
    if (head === tail) {
      tail = (tail + 1) % samplesCount;
    }
    if (now2 - firstSampleTS < min2) {
      return;
    }
    const passed = startedAt && now2 - startedAt;
    return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
  };
}
function throttle(fn, freq) {
  let timestamp = 0;
  let threshold = 1e3 / freq;
  let lastArgs;
  let timer;
  const invoke = (args, now2 = Date.now()) => {
    timestamp = now2;
    lastArgs = null;
    if (timer) {
      clearTimeout(timer);
      timer = null;
    }
    fn(...args);
  };
  const throttled2 = (...args) => {
    const now2 = Date.now();
    const passed = now2 - timestamp;
    if (passed >= threshold) {
      invoke(args, now2);
    } else {
      lastArgs = args;
      if (!timer) {
        timer = setTimeout(() => {
          timer = null;
          invoke(lastArgs);
        }, threshold - passed);
      }
    }
  };
  const flush = () => lastArgs && invoke(lastArgs);
  return [throttled2, flush];
}
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
  let bytesNotified = 0;
  const _speedometer = speedometer(50, 250);
  return throttle((e2) => {
    const loaded = e2.loaded;
    const total = e2.lengthComputable ? e2.total : void 0;
    const progressBytes = loaded - bytesNotified;
    const rate = _speedometer(progressBytes);
    const inRange2 = loaded <= total;
    bytesNotified = loaded;
    const data = {
      loaded,
      total,
      progress: total ? loaded / total : void 0,
      bytes: progressBytes,
      rate: rate ? rate : void 0,
      estimated: rate && total && inRange2 ? (total - loaded) / rate : void 0,
      event: e2,
      lengthComputable: total != null,
      [isDownloadStream ? "download" : "upload"]: true
    };
    listener(data);
  }, freq);
};
const progressEventDecorator = (total, throttled2) => {
  const lengthComputable = total != null;
  return [(loaded) => throttled2[0]({
    lengthComputable,
    total,
    loaded
  }), throttled2[1]];
};
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url2) => {
  url2 = new URL(url2, platform.origin);
  return origin2.protocol === url2.protocol && origin2.host === url2.host && (isMSIE || origin2.port === url2.port);
})(
  new URL(platform.origin),
  platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
) : () => true;
const cookies = platform.hasStandardBrowserEnv ? (
  // Standard browser envs support document.cookie
  {
    write(name2, value2, expires, path, domain, secure) {
      const cookie = [name2 + "=" + encodeURIComponent(value2)];
      utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
      utils$1.isString(path) && cookie.push("path=" + path);
      utils$1.isString(domain) && cookie.push("domain=" + domain);
      secure === true && cookie.push("secure");
      document.cookie = cookie.join("; ");
    },
    read(name2) {
      const match5 = document.cookie.match(new RegExp("(^|;\\s*)(" + name2 + ")=([^;]*)"));
      return match5 ? decodeURIComponent(match5[3]) : null;
    },
    remove(name2) {
      this.write(name2, "", Date.now() - 864e5);
    }
  }
) : (
  // Non-standard browser env (web workers, react-native) lack needed support.
  {
    write() {
    },
    read() {
      return null;
    },
    remove() {
    }
  }
);
function isAbsoluteURL(url2) {
  return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url2);
}
function combineURLs(baseURL, relativeURL) {
  return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
}
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
    return combineURLs(baseURL, requestedURL);
  }
  return requestedURL;
}
const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
function mergeConfig$1(config1, config2) {
  config2 = config2 || {};
  const config3 = {};
  function getMergedValue(target, source2, prop, caseless) {
    if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source2)) {
      return utils$1.merge.call({ caseless }, target, source2);
    } else if (utils$1.isPlainObject(source2)) {
      return utils$1.merge({}, source2);
    } else if (utils$1.isArray(source2)) {
      return source2.slice();
    }
    return source2;
  }
  function mergeDeepProperties(a2, b2, prop, caseless) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(a2, b2, prop, caseless);
    } else if (!utils$1.isUndefined(a2)) {
      return getMergedValue(void 0, a2, prop, caseless);
    }
  }
  function valueFromConfig2(a2, b2) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(void 0, b2);
    }
  }
  function defaultToConfig2(a2, b2) {
    if (!utils$1.isUndefined(b2)) {
      return getMergedValue(void 0, b2);
    } else if (!utils$1.isUndefined(a2)) {
      return getMergedValue(void 0, a2);
    }
  }
  function mergeDirectKeys(a2, b2, prop) {
    if (prop in config2) {
      return getMergedValue(a2, b2);
    } else if (prop in config1) {
      return getMergedValue(void 0, a2);
    }
  }
  const mergeMap = {
    url: valueFromConfig2,
    method: valueFromConfig2,
    data: valueFromConfig2,
    baseURL: defaultToConfig2,
    transformRequest: defaultToConfig2,
    transformResponse: defaultToConfig2,
    paramsSerializer: defaultToConfig2,
    timeout: defaultToConfig2,
    timeoutMessage: defaultToConfig2,
    withCredentials: defaultToConfig2,
    withXSRFToken: defaultToConfig2,
    adapter: defaultToConfig2,
    responseType: defaultToConfig2,
    xsrfCookieName: defaultToConfig2,
    xsrfHeaderName: defaultToConfig2,
    onUploadProgress: defaultToConfig2,
    onDownloadProgress: defaultToConfig2,
    decompress: defaultToConfig2,
    maxContentLength: defaultToConfig2,
    maxBodyLength: defaultToConfig2,
    beforeRedirect: defaultToConfig2,
    transport: defaultToConfig2,
    httpAgent: defaultToConfig2,
    httpsAgent: defaultToConfig2,
    cancelToken: defaultToConfig2,
    socketPath: defaultToConfig2,
    responseEncoding: defaultToConfig2,
    validateStatus: mergeDirectKeys,
    headers: (a2, b2, prop) => mergeDeepProperties(headersToObject(a2), headersToObject(b2), prop, true)
  };
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
    const merge2 = mergeMap[prop] || mergeDeepProperties;
    const configValue = merge2(config1[prop], config2[prop], prop);
    utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
  });
  return config3;
}
const resolveConfig = (config2) => {
  const newConfig = mergeConfig$1({}, config2);
  let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
  newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config2.params, config2.paramsSerializer);
  if (auth) {
    headers.set(
      "Authorization",
      "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
    );
  }
  let contentType;
  if (utils$1.isFormData(data)) {
    if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
      headers.setContentType(void 0);
    } else if ((contentType = headers.getContentType()) !== false) {
      const [type4, ...tokens2] = contentType ? contentType.split(";").map((token2) => token2.trim()).filter(Boolean) : [];
      headers.setContentType([type4 || "multipart/form-data", ...tokens2].join("; "));
    }
  }
  if (platform.hasStandardBrowserEnv) {
    withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
    if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
      const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
      if (xsrfValue) {
        headers.set(xsrfHeaderName, xsrfValue);
      }
    }
  }
  return newConfig;
};
const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
const xhrAdapter = isXHRAdapterSupported && function(config2) {
  return new Promise(function dispatchXhrRequest(resolve2, reject) {
    const _config = resolveConfig(config2);
    let requestData = _config.data;
    const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
    let { responseType, onUploadProgress, onDownloadProgress } = _config;
    let onCanceled;
    let uploadThrottled, downloadThrottled;
    let flushUpload, flushDownload;
    function done() {
      flushUpload && flushUpload();
      flushDownload && flushDownload();
      _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
      _config.signal && _config.signal.removeEventListener("abort", onCanceled);
    }
    let request2 = new XMLHttpRequest();
    request2.open(_config.method.toUpperCase(), _config.url, true);
    request2.timeout = _config.timeout;
    function onloadend() {
      if (!request2) {
        return;
      }
      const responseHeaders = AxiosHeaders$1.from(
        "getAllResponseHeaders" in request2 && request2.getAllResponseHeaders()
      );
      const responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
      const response = {
        data: responseData,
        status: request2.status,
        statusText: request2.statusText,
        headers: responseHeaders,
        config: config2,
        request: request2
      };
      settle(function _resolve2(value2) {
        resolve2(value2);
        done();
      }, function _reject(err) {
        reject(err);
        done();
      }, response);
      request2 = null;
    }
    if ("onloadend" in request2) {
      request2.onloadend = onloadend;
    } else {
      request2.onreadystatechange = function handleLoad() {
        if (!request2 || request2.readyState !== 4) {
          return;
        }
        if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
          return;
        }
        setTimeout(onloadend);
      };
    }
    request2.onabort = function handleAbort() {
      if (!request2) {
        return;
      }
      reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config2, request2));
      request2 = null;
    };
    request2.onerror = function handleError() {
      reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config2, request2));
      request2 = null;
    };
    request2.ontimeout = function handleTimeout() {
      let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
      const transitional2 = _config.transitional || transitionalDefaults;
      if (_config.timeoutErrorMessage) {
        timeoutErrorMessage = _config.timeoutErrorMessage;
      }
      reject(new AxiosError$1(
        timeoutErrorMessage,
        transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
        config2,
        request2
      ));
      request2 = null;
    };
    requestData === void 0 && requestHeaders.setContentType(null);
    if ("setRequestHeader" in request2) {
      utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
        request2.setRequestHeader(key, val);
      });
    }
    if (!utils$1.isUndefined(_config.withCredentials)) {
      request2.withCredentials = !!_config.withCredentials;
    }
    if (responseType && responseType !== "json") {
      request2.responseType = _config.responseType;
    }
    if (onDownloadProgress) {
      [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
      request2.addEventListener("progress", downloadThrottled);
    }
    if (onUploadProgress && request2.upload) {
      [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
      request2.upload.addEventListener("progress", uploadThrottled);
      request2.upload.addEventListener("loadend", flushUpload);
    }
    if (_config.cancelToken || _config.signal) {
      onCanceled = (cancel2) => {
        if (!request2) {
          return;
        }
        reject(!cancel2 || cancel2.type ? new CanceledError$1(null, config2, request2) : cancel2);
        request2.abort();
        request2 = null;
      };
      _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
      if (_config.signal) {
        _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
      }
    }
    const protocol = parseProtocol(_config.url);
    if (protocol && platform.protocols.indexOf(protocol) === -1) {
      reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config2));
      return;
    }
    request2.send(requestData || null);
  });
};
const composeSignals = (signals, timeout) => {
  const { length: length2 } = signals = signals ? signals.filter(Boolean) : [];
  if (timeout || length2) {
    let controller = new AbortController();
    let aborted;
    const onabort = function(reason) {
      if (!aborted) {
        aborted = true;
        unsubscribe();
        const err = reason instanceof Error ? reason : this.reason;
        controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
      }
    };
    let timer = timeout && setTimeout(() => {
      timer = null;
      onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
    }, timeout);
    const unsubscribe = () => {
      if (signals) {
        timer && clearTimeout(timer);
        timer = null;
        signals.forEach((signal2) => {
          signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
        });
        signals = null;
      }
    };
    signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
    const { signal } = controller;
    signal.unsubscribe = () => utils$1.asap(unsubscribe);
    return signal;
  }
};
const streamChunk = function* (chunk, chunkSize) {
  let len = chunk.byteLength;
  if (len < chunkSize) {
    yield chunk;
    return;
  }
  let pos = 0;
  let end;
  while (pos < len) {
    end = pos + chunkSize;
    yield chunk.slice(pos, end);
    pos = end;
  }
};
const readBytes = async function* (iterable, chunkSize) {
  for await (const chunk of readStream(iterable)) {
    yield* streamChunk(chunk, chunkSize);
  }
};
const readStream = async function* (stream) {
  if (stream[Symbol.asyncIterator]) {
    yield* stream;
    return;
  }
  const reader = stream.getReader();
  try {
    for (; ; ) {
      const { done, value: value2 } = await reader.read();
      if (done) {
        break;
      }
      yield value2;
    }
  } finally {
    await reader.cancel();
  }
};
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
  const iterator2 = readBytes(stream, chunkSize);
  let bytes = 0;
  let done;
  let _onFinish = (e2) => {
    if (!done) {
      done = true;
      onFinish && onFinish(e2);
    }
  };
  return new ReadableStream({
    async pull(controller) {
      try {
        const { done: done2, value: value2 } = await iterator2.next();
        if (done2) {
          _onFinish();
          controller.close();
          return;
        }
        let len = value2.byteLength;
        if (onProgress) {
          let loadedBytes = bytes += len;
          onProgress(loadedBytes);
        }
        controller.enqueue(new Uint8Array(value2));
      } catch (err) {
        _onFinish(err);
        throw err;
      }
    },
    cancel(reason) {
      _onFinish(reason);
      return iterator2.return();
    }
  }, {
    highWaterMark: 2
  });
};
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
const test = (fn, ...args) => {
  try {
    return !!fn(...args);
  } catch (e2) {
    return false;
  }
};
const supportsRequestStream = isReadableStreamSupported && test(() => {
  let duplexAccessed = false;
  const hasContentType = new Request(platform.origin, {
    body: new ReadableStream(),
    method: "POST",
    get duplex() {
      duplexAccessed = true;
      return "half";
    }
  }).headers.has("Content-Type");
  return duplexAccessed && !hasContentType;
});
const DEFAULT_CHUNK_SIZE = 64 * 1024;
const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
const resolvers = {
  stream: supportsResponseStream && ((res) => res.body)
};
isFetchSupported && ((res) => {
  ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type4) => {
    !resolvers[type4] && (resolvers[type4] = utils$1.isFunction(res[type4]) ? (res2) => res2[type4]() : (_24, config2) => {
      throw new AxiosError$1(`Response type '${type4}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config2);
    });
  });
})(new Response());
const getBodyLength = async (body) => {
  if (body == null) {
    return 0;
  }
  if (utils$1.isBlob(body)) {
    return body.size;
  }
  if (utils$1.isSpecCompliantForm(body)) {
    const _request = new Request(platform.origin, {
      method: "POST",
      body
    });
    return (await _request.arrayBuffer()).byteLength;
  }
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
    return body.byteLength;
  }
  if (utils$1.isURLSearchParams(body)) {
    body = body + "";
  }
  if (utils$1.isString(body)) {
    return (await encodeText(body)).byteLength;
  }
};
const resolveBodyLength = async (headers, body) => {
  const length2 = utils$1.toFiniteNumber(headers.getContentLength());
  return length2 == null ? getBodyLength(body) : length2;
};
const fetchAdapter = isFetchSupported && (async (config2) => {
  let {
    url: url2,
    method: method4,
    data,
    signal,
    cancelToken,
    timeout,
    onDownloadProgress,
    onUploadProgress,
    responseType,
    headers,
    withCredentials = "same-origin",
    fetchOptions
  } = resolveConfig(config2);
  responseType = responseType ? (responseType + "").toLowerCase() : "text";
  let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
  let request2;
  const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
    composedSignal.unsubscribe();
  });
  let requestContentLength;
  try {
    if (onUploadProgress && supportsRequestStream && method4 !== "get" && method4 !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
      let _request = new Request(url2, {
        method: "POST",
        body: data,
        duplex: "half"
      });
      let contentTypeHeader;
      if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
        headers.setContentType(contentTypeHeader);
      }
      if (_request.body) {
        const [onProgress, flush] = progressEventDecorator(
          requestContentLength,
          progressEventReducer(asyncDecorator(onUploadProgress))
        );
        data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
      }
    }
    if (!utils$1.isString(withCredentials)) {
      withCredentials = withCredentials ? "include" : "omit";
    }
    const isCredentialsSupported = "credentials" in Request.prototype;
    request2 = new Request(url2, {
      ...fetchOptions,
      signal: composedSignal,
      method: method4.toUpperCase(),
      headers: headers.normalize().toJSON(),
      body: data,
      duplex: "half",
      credentials: isCredentialsSupported ? withCredentials : void 0
    });
    let response = await fetch(request2, fetchOptions);
    const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
    if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
      const options = {};
      ["status", "statusText", "headers"].forEach((prop) => {
        options[prop] = response[prop];
      });
      const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
      const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
        responseContentLength,
        progressEventReducer(asyncDecorator(onDownloadProgress), true)
      ) || [];
      response = new Response(
        trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
          flush && flush();
          unsubscribe && unsubscribe();
        }),
        options
      );
    }
    responseType = responseType || "text";
    let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config2);
    !isStreamResponse && unsubscribe && unsubscribe();
    return await new Promise((resolve2, reject) => {
      settle(resolve2, reject, {
        data: responseData,
        headers: AxiosHeaders$1.from(response.headers),
        status: response.status,
        statusText: response.statusText,
        config: config2,
        request: request2
      });
    });
  } catch (err) {
    unsubscribe && unsubscribe();
    if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
      throw Object.assign(
        new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config2, request2),
        {
          cause: err.cause || err
        }
      );
    }
    throw AxiosError$1.from(err, err && err.code, config2, request2);
  }
});
const knownAdapters = {
  http: httpAdapter,
  xhr: xhrAdapter,
  fetch: fetchAdapter
};
utils$1.forEach(knownAdapters, (fn, value2) => {
  if (fn) {
    try {
      Object.defineProperty(fn, "name", { value: value2 });
    } catch (e2) {
    }
    Object.defineProperty(fn, "adapterName", { value: value2 });
  }
});
const renderReason = (reason) => `- ${reason}`;
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
const adapters = {
  getAdapter: (adapters2) => {
    adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
    const { length: length2 } = adapters2;
    let nameOrAdapter;
    let adapter;
    const rejectedReasons = {};
    for (let i2 = 0; i2 < length2; i2++) {
      nameOrAdapter = adapters2[i2];
      let id2;
      adapter = nameOrAdapter;
      if (!isResolvedHandle(nameOrAdapter)) {
        adapter = knownAdapters[(id2 = String(nameOrAdapter)).toLowerCase()];
        if (adapter === void 0) {
          throw new AxiosError$1(`Unknown adapter '${id2}'`);
        }
      }
      if (adapter) {
        break;
      }
      rejectedReasons[id2 || "#" + i2] = adapter;
    }
    if (!adapter) {
      const reasons = Object.entries(rejectedReasons).map(
        ([id2, state]) => `adapter ${id2} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
      );
      let s2 = length2 ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
      throw new AxiosError$1(
        `There is no suitable adapter to dispatch the request ` + s2,
        "ERR_NOT_SUPPORT"
      );
    }
    return adapter;
  },
  adapters: knownAdapters
};
function throwIfCancellationRequested(config2) {
  if (config2.cancelToken) {
    config2.cancelToken.throwIfRequested();
  }
  if (config2.signal && config2.signal.aborted) {
    throw new CanceledError$1(null, config2);
  }
}
function dispatchRequest(config2) {
  throwIfCancellationRequested(config2);
  config2.headers = AxiosHeaders$1.from(config2.headers);
  config2.data = transformData.call(
    config2,
    config2.transformRequest
  );
  if (["post", "put", "patch"].indexOf(config2.method) !== -1) {
    config2.headers.setContentType("application/x-www-form-urlencoded", false);
  }
  const adapter = adapters.getAdapter(config2.adapter || defaults.adapter);
  return adapter(config2).then(function onAdapterResolution(response) {
    throwIfCancellationRequested(config2);
    response.data = transformData.call(
      config2,
      config2.transformResponse,
      response
    );
    response.headers = AxiosHeaders$1.from(response.headers);
    return response;
  }, function onAdapterRejection(reason) {
    if (!isCancel$1(reason)) {
      throwIfCancellationRequested(config2);
      if (reason && reason.response) {
        reason.response.data = transformData.call(
          config2,
          config2.transformResponse,
          reason.response
        );
        reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
      }
    }
    return Promise.reject(reason);
  });
}
const VERSION$1 = "1.11.0";
const validators$1 = {};
["object", "boolean", "number", "function", "string", "symbol"].forEach((type4, i2) => {
  validators$1[type4] = function validator2(thing) {
    return typeof thing === type4 || "a" + (i2 < 1 ? "n " : " ") + type4;
  };
});
const deprecatedWarnings = {};
validators$1.transitional = function transitional(validator2, version2, message) {
  function formatMessage(opt, desc) {
    return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
  }
  return (value2, opt, opts2) => {
    if (validator2 === false) {
      throw new AxiosError$1(
        formatMessage(opt, " has been removed" + (version2 ? " in " + version2 : "")),
        AxiosError$1.ERR_DEPRECATED
      );
    }
    if (version2 && !deprecatedWarnings[opt]) {
      deprecatedWarnings[opt] = true;
      console.warn(
        formatMessage(
          opt,
          " has been deprecated since v" + version2 + " and will be removed in the near future"
        )
      );
    }
    return validator2 ? validator2(value2, opt, opts2) : true;
  };
};
validators$1.spelling = function spelling(correctSpelling) {
  return (value2, opt) => {
    console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
    return true;
  };
};
function assertOptions(options, schema, allowUnknown) {
  if (typeof options !== "object") {
    throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
  }
  const keys2 = Object.keys(options);
  let i2 = keys2.length;
  while (i2-- > 0) {
    const opt = keys2[i2];
    const validator2 = schema[opt];
    if (validator2) {
      const value2 = options[opt];
      const result = value2 === void 0 || validator2(value2, opt, options);
      if (result !== true) {
        throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
      }
      continue;
    }
    if (allowUnknown !== true) {
      throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
    }
  }
}
const validator = {
  assertOptions,
  validators: validators$1
};
const validators = validator.validators;
let Axios$1 = class Axios {
  constructor(instanceConfig) {
    this.defaults = instanceConfig || {};
    this.interceptors = {
      request: new InterceptorManager(),
      response: new InterceptorManager()
    };
  }
  /**
   * Dispatch a request
   *
   * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
   * @param {?Object} config
   *
   * @returns {Promise} The Promise to be fulfilled
   */
  async request(configOrUrl, config2) {
    try {
      return await this._request(configOrUrl, config2);
    } catch (err) {
      if (err instanceof Error) {
        let dummy = {};
        Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
        const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
        try {
          if (!err.stack) {
            err.stack = stack;
          } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
            err.stack += "\n" + stack;
          }
        } catch (e2) {
        }
      }
      throw err;
    }
  }
  _request(configOrUrl, config2) {
    if (typeof configOrUrl === "string") {
      config2 = config2 || {};
      config2.url = configOrUrl;
    } else {
      config2 = configOrUrl || {};
    }
    config2 = mergeConfig$1(this.defaults, config2);
    const { transitional: transitional2, paramsSerializer, headers } = config2;
    if (transitional2 !== void 0) {
      validator.assertOptions(transitional2, {
        silentJSONParsing: validators.transitional(validators.boolean),
        forcedJSONParsing: validators.transitional(validators.boolean),
        clarifyTimeoutError: validators.transitional(validators.boolean)
      }, false);
    }
    if (paramsSerializer != null) {
      if (utils$1.isFunction(paramsSerializer)) {
        config2.paramsSerializer = {
          serialize: paramsSerializer
        };
      } else {
        validator.assertOptions(paramsSerializer, {
          encode: validators.function,
          serialize: validators.function
        }, true);
      }
    }
    if (config2.allowAbsoluteUrls !== void 0)
      ;
    else if (this.defaults.allowAbsoluteUrls !== void 0) {
      config2.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
    } else {
      config2.allowAbsoluteUrls = true;
    }
    validator.assertOptions(config2, {
      baseUrl: validators.spelling("baseURL"),
      withXsrfToken: validators.spelling("withXSRFToken")
    }, true);
    config2.method = (config2.method || this.defaults.method || "get").toLowerCase();
    let contextHeaders = headers && utils$1.merge(
      headers.common,
      headers[config2.method]
    );
    headers && utils$1.forEach(
      ["delete", "get", "head", "post", "put", "patch", "common"],
      (method4) => {
        delete headers[method4];
      }
    );
    config2.headers = AxiosHeaders$1.concat(contextHeaders, headers);
    const requestInterceptorChain = [];
    let synchronousRequestInterceptors = true;
    this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
      if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config2) === false) {
        return;
      }
      synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
      requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
    });
    const responseInterceptorChain = [];
    this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
      responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
    });
    let promise;
    let i2 = 0;
    let len;
    if (!synchronousRequestInterceptors) {
      const chain2 = [dispatchRequest.bind(this), void 0];
      chain2.unshift(...requestInterceptorChain);
      chain2.push(...responseInterceptorChain);
      len = chain2.length;
      promise = Promise.resolve(config2);
      while (i2 < len) {
        promise = promise.then(chain2[i2++], chain2[i2++]);
      }
      return promise;
    }
    len = requestInterceptorChain.length;
    let newConfig = config2;
    i2 = 0;
    while (i2 < len) {
      const onFulfilled = requestInterceptorChain[i2++];
      const onRejected = requestInterceptorChain[i2++];
      try {
        newConfig = onFulfilled(newConfig);
      } catch (error2) {
        onRejected.call(this, error2);
        break;
      }
    }
    try {
      promise = dispatchRequest.call(this, newConfig);
    } catch (error2) {
      return Promise.reject(error2);
    }
    i2 = 0;
    len = responseInterceptorChain.length;
    while (i2 < len) {
      promise = promise.then(responseInterceptorChain[i2++], responseInterceptorChain[i2++]);
    }
    return promise;
  }
  getUri(config2) {
    config2 = mergeConfig$1(this.defaults, config2);
    const fullPath = buildFullPath(config2.baseURL, config2.url, config2.allowAbsoluteUrls);
    return buildURL(fullPath, config2.params, config2.paramsSerializer);
  }
};
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method4) {
  Axios$1.prototype[method4] = function(url2, config2) {
    return this.request(mergeConfig$1(config2 || {}, {
      method: method4,
      url: url2,
      data: (config2 || {}).data
    }));
  };
});
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method4) {
  function generateHTTPMethod(isForm) {
    return function httpMethod(url2, data, config2) {
      return this.request(mergeConfig$1(config2 || {}, {
        method: method4,
        headers: isForm ? {
          "Content-Type": "multipart/form-data"
        } : {},
        url: url2,
        data
      }));
    };
  }
  Axios$1.prototype[method4] = generateHTTPMethod();
  Axios$1.prototype[method4 + "Form"] = generateHTTPMethod(true);
});
let CancelToken$1 = class CancelToken {
  constructor(executor) {
    if (typeof executor !== "function") {
      throw new TypeError("executor must be a function.");
    }
    let resolvePromise;
    this.promise = new Promise(function promiseExecutor(resolve2) {
      resolvePromise = resolve2;
    });
    const token2 = this;
    this.promise.then((cancel2) => {
      if (!token2._listeners)
        return;
      let i2 = token2._listeners.length;
      while (i2-- > 0) {
        token2._listeners[i2](cancel2);
      }
      token2._listeners = null;
    });
    this.promise.then = (onfulfilled) => {
      let _resolve2;
      const promise = new Promise((resolve2) => {
        token2.subscribe(resolve2);
        _resolve2 = resolve2;
      }).then(onfulfilled);
      promise.cancel = function reject() {
        token2.unsubscribe(_resolve2);
      };
      return promise;
    };
    executor(function cancel2(message, config2, request2) {
      if (token2.reason) {
        return;
      }
      token2.reason = new CanceledError$1(message, config2, request2);
      resolvePromise(token2.reason);
    });
  }
  /**
   * Throws a `CanceledError` if cancellation has been requested.
   */
  throwIfRequested() {
    if (this.reason) {
      throw this.reason;
    }
  }
  /**
   * Subscribe to the cancel signal
   */
  subscribe(listener) {
    if (this.reason) {
      listener(this.reason);
      return;
    }
    if (this._listeners) {
      this._listeners.push(listener);
    } else {
      this._listeners = [listener];
    }
  }
  /**
   * Unsubscribe from the cancel signal
   */
  unsubscribe(listener) {
    if (!this._listeners) {
      return;
    }
    const index2 = this._listeners.indexOf(listener);
    if (index2 !== -1) {
      this._listeners.splice(index2, 1);
    }
  }
  toAbortSignal() {
    const controller = new AbortController();
    const abort = (err) => {
      controller.abort(err);
    };
    this.subscribe(abort);
    controller.signal.unsubscribe = () => this.unsubscribe(abort);
    return controller.signal;
  }
  /**
   * Returns an object that contains a new `CancelToken` and a function that, when called,
   * cancels the `CancelToken`.
   */
  static source() {
    let cancel2;
    const token2 = new CancelToken(function executor(c2) {
      cancel2 = c2;
    });
    return {
      token: token2,
      cancel: cancel2
    };
  }
};
function spread$1(callback2) {
  return function wrap2(arr) {
    return callback2.apply(null, arr);
  };
}
function isAxiosError$1(payload) {
  return utils$1.isObject(payload) && payload.isAxiosError === true;
}
const HttpStatusCode$1 = {
  Continue: 100,
  SwitchingProtocols: 101,
  Processing: 102,
  EarlyHints: 103,
  Ok: 200,
  Created: 201,
  Accepted: 202,
  NonAuthoritativeInformation: 203,
  NoContent: 204,
  ResetContent: 205,
  PartialContent: 206,
  MultiStatus: 207,
  AlreadyReported: 208,
  ImUsed: 226,
  MultipleChoices: 300,
  MovedPermanently: 301,
  Found: 302,
  SeeOther: 303,
  NotModified: 304,
  UseProxy: 305,
  Unused: 306,
  TemporaryRedirect: 307,
  PermanentRedirect: 308,
  BadRequest: 400,
  Unauthorized: 401,
  PaymentRequired: 402,
  Forbidden: 403,
  NotFound: 404,
  MethodNotAllowed: 405,
  NotAcceptable: 406,
  ProxyAuthenticationRequired: 407,
  RequestTimeout: 408,
  Conflict: 409,
  Gone: 410,
  LengthRequired: 411,
  PreconditionFailed: 412,
  PayloadTooLarge: 413,
  UriTooLong: 414,
  UnsupportedMediaType: 415,
  RangeNotSatisfiable: 416,
  ExpectationFailed: 417,
  ImATeapot: 418,
  MisdirectedRequest: 421,
  UnprocessableEntity: 422,
  Locked: 423,
  FailedDependency: 424,
  TooEarly: 425,
  UpgradeRequired: 426,
  PreconditionRequired: 428,
  TooManyRequests: 429,
  RequestHeaderFieldsTooLarge: 431,
  UnavailableForLegalReasons: 451,
  InternalServerError: 500,
  NotImplemented: 501,
  BadGateway: 502,
  ServiceUnavailable: 503,
  GatewayTimeout: 504,
  HttpVersionNotSupported: 505,
  VariantAlsoNegotiates: 506,
  InsufficientStorage: 507,
  LoopDetected: 508,
  NotExtended: 510,
  NetworkAuthenticationRequired: 511
};
Object.entries(HttpStatusCode$1).forEach(([key, value2]) => {
  HttpStatusCode$1[value2] = key;
});
function createInstance(defaultConfig2) {
  const context = new Axios$1(defaultConfig2);
  const instance2 = bind(Axios$1.prototype.request, context);
  utils$1.extend(instance2, Axios$1.prototype, context, { allOwnKeys: true });
  utils$1.extend(instance2, context, null, { allOwnKeys: true });
  instance2.create = function create2(instanceConfig) {
    return createInstance(mergeConfig$1(defaultConfig2, instanceConfig));
  };
  return instance2;
}
const axios = createInstance(defaults);
axios.Axios = Axios$1;
axios.CanceledError = CanceledError$1;
axios.CancelToken = CancelToken$1;
axios.isCancel = isCancel$1;
axios.VERSION = VERSION$1;
axios.toFormData = toFormData$1;
axios.AxiosError = AxiosError$1;
axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
  return Promise.all(promises);
};
axios.spread = spread$1;
axios.isAxiosError = isAxiosError$1;
axios.mergeConfig = mergeConfig$1;
axios.AxiosHeaders = AxiosHeaders$1;
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
axios.getAdapter = adapters.getAdapter;
axios.HttpStatusCode = HttpStatusCode$1;
axios.default = axios;
const {
  Axios: Axios2,
  AxiosError,
  CanceledError,
  isCancel,
  CancelToken: CancelToken2,
  VERSION,
  all: all$1,
  Cancel,
  isAxiosError,
  spread,
  toFormData,
  AxiosHeaders: AxiosHeaders2,
  HttpStatusCode,
  formToJSON,
  getAdapter,
  mergeConfig
} = axios;
const ColorPicker = ({
  color: propColor,
  onChange = (hex3) => {
  },
  panelOffset = { top: 0, left: "60px" }
}) => {
  const [color2, setColor] = reactExports.useState(propColor);
  const [colorPickerVisible, setColorPickerVisible] = reactExports.useState(false);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "relative", width: 26, height: 26 }, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        style: {
          padding: "5px",
          background: "#fff",
          borderRadius: "1px",
          boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
          display: "inline-block",
          cursor: "pointer"
        },
        onClick: () => setColorPickerVisible(true),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            style: {
              width: "16px",
              height: "16px",
              borderRadius: "2px",
              background: color2
            }
          }
        )
      }
    ),
    colorPickerVisible ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { position: "absolute", ...panelOffset, zIndex: "20" }, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          style: {
            position: "fixed",
            top: "0px",
            right: "0px",
            bottom: "0px",
            left: "0px"
          },
          onClick: () => setColorPickerVisible(false)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        SketchPicker,
        {
          color: { hex: color2 },
          onChange: (v2) => {
            setColor(v2.hex);
            onChange(v2.hex);
          }
        }
      )
    ] }) : null
  ] });
};
ColorPicker.displayName = "ColorPicker";
const TextReader = (props) => {
  var _a2;
  const { file, style: style2 = {}, onLoad, className } = props;
  const [previewData, setPreviewData] = reactExports.useState();
  const [fontSize, setFontSize] = reactExports.useState(14);
  const [background, setBackground] = reactExports.useState("white");
  const [color2, setColor] = reactExports.useState("black");
  const [colorPickerVisible, setColorPickerVisible] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (file) {
      axios.request({
        url: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(file)}`
      }).then((a2) => {
        if (a2.status == 200) {
          const text2 = a2.data;
          const pd2 = {
            title: getFileNameWithoutExtension(file),
            paragraphs: void 0
          };
          const paragraphs = text2 == null ? void 0 : text2.split("\n").map((x2) => x2.trim()).filter((b2) => (b2 == null ? void 0 : b2.length) > 0);
          if ((paragraphs == null ? void 0 : paragraphs.length) > 0) {
            pd2.paragraphs = paragraphs;
          }
          setPreviewData(pd2);
        }
      });
    } else {
      onLoad();
    }
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `text-reader ${className || ""}`,
      style: { ...style2, background, color: color2 },
      onLoad,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "configurations", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Font size") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(number_input_default, { value: fontSize, onChange: (v2) => setFontSize(v2) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Font color") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: color2, onChange: (v2) => setColor(v2) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: instance.t("Background color") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "value", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ColorPicker, { color: background, onChange: (v2) => setBackground(v2) }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "content", children: [
          (previewData == null ? void 0 : previewData.title) && /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { children: previewData.title }),
          ((_a2 = previewData == null ? void 0 : previewData.sections) == null ? void 0 : _a2.map((s2, i2) => {
            var _a3;
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: `s-${i2}`, children: [
              s2.title && /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { children: s2.title }),
              (_a3 = s2.paragraphs) == null ? void 0 : _a3.map((p2, j2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: `p-${j2}`, style: { fontSize }, children: p2 });
              })
            ] });
          })) || /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-content", children: instance.t("No content") })
        ] })
      ]
    }
  );
};
TextReader.displayName = "TextReader";
const MediaRenderer = reactExports.forwardRef((props, ref) => {
  const {
    entry,
    mediaType,
    playing,
    currentInitialized,
    onLoad,
    onVideoReady,
    onVideoPlay,
    onVideoPause,
    onVideoEnded,
    onVideoSeek,
    onVideoStart,
    onVideoProgress,
    onPlayabilityError
  } = props;
  const { t: t2 } = useTranslation();
  const log3 = buildLogger("MediaRenderer");
  const imageRef = reactExports.useRef(null);
  const playerRef = reactExports.useRef(null);
  const videoSizeRef = reactExports.useRef();
  const mediaContainerRef = reactExports.useRef(null);
  const [playabilityInfo, setPlayabilityInfo] = reactExports.useState(null);
  const [isCheckingPlayability, setIsCheckingPlayability] = reactExports.useState(false);
  const [playabilityChecked, setPlayabilityChecked] = reactExports.useState(false);
  reactExports.useImperativeHandle(ref, () => ({
    getImageRef: () => imageRef.current,
    getPlayerRef: () => playerRef.current
  }));
  const playPath = entry.playPath || entry.path;
  reactExports.useEffect(() => {
    const checkPlayability = async () => {
      if (mediaType !== MediaType.Video && mediaType !== MediaType.Audio) {
        setPlayabilityChecked(true);
        setPlayabilityInfo({ playable: true, mediaType });
        return;
      }
      setIsCheckingPlayability(true);
      setPlayabilityChecked(false);
      setPlayabilityInfo(null);
      try {
        const response = await BApi$1.file.checkFilePlayability({ fullname: playPath });
        if (response.data) {
          setPlayabilityInfo(response.data);
          if (!response.data.playable && response.data.error) {
            log3("File not playable:", response.data.error);
            onPlayabilityError == null ? void 0 : onPlayabilityError(response.data.error);
          }
        }
      } catch (err) {
        log3("Playability check failed:", err);
        setPlayabilityInfo({ playable: true, mediaType });
      } finally {
        setIsCheckingPlayability(false);
        setPlayabilityChecked(true);
      }
    };
    checkPlayability();
  }, [playPath, mediaType]);
  const renderMediaContent = () => {
    var _a2, _b2;
    if ((mediaType === MediaType.Video || mediaType === MediaType.Audio) && isCheckingPlayability) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center text-white/70", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: t2("Checking playability...") })
      ] });
    }
    if (playabilityChecked && playabilityInfo && !playabilityInfo.playable) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center text-white/70 text-center p-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-red-400 text-xl mb-2", children: [
          "⚠️ ",
          t2("Cannot play this file")
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm opacity-80", children: playabilityInfo.error || t2("Unknown error") })
      ] });
    }
    switch (mediaType) {
      case MediaType.Audio:
      case MediaType.Video:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          src_default,
          {
            ...{
              ref: (player) => {
                playerRef.current = player;
              },
              controls: true,
              className: "max-w-full max-h-full object-contain",
              config: {
                file: {
                  attributes: {
                    crossOrigin: "anonymous"
                  }
                }
              },
              height: (_a2 = videoSizeRef.current) == null ? void 0 : _a2.height,
              playing,
              url: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(playPath)}`,
              width: (_b2 = videoSizeRef.current) == null ? void 0 : _b2.width
            },
            ...{
              onDuration: (d2) => {
              },
              onEnded: () => {
                onVideoEnded == null ? void 0 : onVideoEnded();
              },
              onPause: () => {
                log3("Video pause");
                onVideoPause == null ? void 0 : onVideoPause();
              },
              onPlay: () => {
                log3("Video play");
                onVideoPlay == null ? void 0 : onVideoPlay();
              },
              onProgress: (state) => {
                onVideoProgress == null ? void 0 : onVideoProgress(state);
              },
              onReady: () => {
                if (playerRef.current) {
                  const internalPlayer = playerRef.current.getInternalPlayer();
                  const width = internalPlayer.videoWidth;
                  const height = internalPlayer.videoHeight;
                  if (width > 0 && height > 0) {
                    videoSizeRef.current = {
                      width: Math.min(width, mediaContainerRef.current.clientWidth),
                      height: Math.min(height, mediaContainerRef.current.clientHeight)
                    };
                  }
                  log3("Video ready", `${width}x${height}`);
                  onVideoReady == null ? void 0 : onVideoReady(width, height);
                  onLoad();
                }
              },
              onSeek: () => {
                log3("Video seek");
                onVideoSeek == null ? void 0 : onVideoSeek();
              },
              onStart: () => {
                log3("Video start");
                onVideoStart == null ? void 0 : onVideoStart();
              }
            }
          }
        );
      case MediaType.Image:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          "img",
          {
            ref: imageRef,
            className: "max-w-full max-h-full object-contain",
            crossOrigin: "anonymous",
            src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(playPath)}`,
            onLoad: () => {
              onLoad();
            }
          }
        );
      case MediaType.Text:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          TextReader,
          {
            className: "max-w-full max-h-full object-contain",
            file: playPath,
            style: { padding: "20px" },
            onLoad: () => {
              onLoad();
            }
          }
        );
      default:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "max-w-full max-h-full object-contain text-white text-2xl",
            onLoad: () => {
              onLoad();
            },
            children: t2("Unsupported")
          }
        );
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: mediaContainerRef,
      className: "relative w-full h-full flex flex-col items-center justify-center p-5 z-[1]",
      children: [
        !currentInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center z-[2] bg-black/30", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }),
        renderMediaContent()
      ]
    }
  );
});
MediaRenderer.displayName = "MediaRenderer";
const MediaFooter = ({
  entry,
  activeIndex,
  totalEntries,
  currentInitialized,
  autoPlay,
  progress: progress2,
  mediaType,
  playing,
  renderOperations,
  reactPlayer,
  image: image2
}) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-[40px] min-h-[40px] text-center flex gap-2.5 items-center justify-center text-white/90 bg-black/50 border-t border-white/10 px-5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-4 max-h-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileSystemEntryIcon, { path: entry.path, size: 16, type: IconType.Dynamic }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center flex-wrap gap-0.5", children: entry.name })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "(",
        activeIndex + 1,
        " / ",
        totalEntries,
        ")"
      ] }),
      renderOperations && currentInitialized && renderOperations(
        entry.playPath || entry.path,
        mediaType,
        playing,
        reactPlayer,
        image2
      )
    ] }),
    autoPlay && progress2 && /* @__PURE__ */ jsxRuntimeExports.jsx(progress_default, { ...{ percent: progress2, size: "sm", textRender: () => "" } })
  ] });
};
const MediaContent = ({
  activeEntry,
  activeIndex,
  playableEntries,
  mediaType,
  playing,
  currentInitialized,
  autoPlay,
  progress: progress2,
  renderOperations,
  onLoad,
  onVideoReady,
  onVideoPlay,
  onVideoPause,
  onVideoEnded,
  onVideoSeek,
  onVideoStart,
  onVideoProgress,
  onPrevEntry,
  onNextEntry
}) => {
  var _a2, _b2;
  const mediaRendererRef = reactExports.useRef(null);
  const mediaContainerRef = reactExports.useRef(null);
  const handlePrevClick = (e2) => {
    e2.stopPropagation();
    let prevIndex = activeIndex - 1;
    while (prevIndex >= 0) {
      const entry = playableEntries[prevIndex];
      if (entry && entry.type !== IwFsType.Directory && entry.type !== IwFsType.CompressedFileEntry) {
        onPrevEntry();
        break;
      }
      prevIndex--;
    }
  };
  const handleNextClick = (e2) => {
    e2.stopPropagation();
    let nextIndex = activeIndex + 1;
    while (nextIndex < playableEntries.length) {
      const entry = playableEntries[nextIndex];
      if (entry && entry.type !== IwFsType.Directory && entry.type !== IwFsType.CompressedFileEntry) {
        onNextEntry();
        break;
      }
      nextIndex++;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex flex-col min-w-0 relative", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        ref: mediaContainerRef,
        className: "flex-1 flex items-center justify-center relative min-h-0 overflow-y-auto overflow-x-hidden media-container",
        tabIndex: 0,
        children: [
          activeIndex > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "absolute left-0 top-0 bottom-0 w-1/3 z-[1] cursor-pointer",
              onClick: handlePrevClick
            }
          ),
          activeIndex < playableEntries.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "absolute right-0 top-0 bottom-0 w-1/3 z-[1] cursor-pointer",
              onClick: handleNextClick
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            MediaRenderer,
            {
              ref: mediaRendererRef,
              currentInitialized,
              entry: activeEntry,
              mediaType,
              playing,
              onLoad,
              onVideoEnded,
              onVideoPause,
              onVideoPlay,
              onVideoProgress,
              onVideoReady,
              onVideoSeek,
              onVideoStart
            }
          )
        ]
      }
    ),
    activeEntry && /* @__PURE__ */ jsxRuntimeExports.jsx(
      MediaFooter,
      {
        activeIndex,
        autoPlay,
        currentInitialized,
        entry: activeEntry,
        image: ((_a2 = mediaRendererRef.current) == null ? void 0 : _a2.getImageRef()) || null,
        mediaType,
        playing,
        progress: progress2,
        reactPlayer: (_b2 = mediaRendererRef.current) == null ? void 0 : _b2.getPlayerRef(),
        renderOperations,
        totalEntries: playableEntries.length
      }
    )
  ] });
};
const MediaPlayerLayout = ({
  entries,
  playableEntries,
  activeIndex,
  activeEntry,
  leftPanelCollapsed,
  playing,
  currentInitialized,
  autoPlay,
  progress: progress2,
  getMediaType,
  renderOperations,
  onEntryClick,
  onToggleCollapse,
  onPrevEntry,
  onNextEntry,
  onLoad,
  onVideoReady,
  onVideoPlay,
  onVideoPause,
  onVideoEnded,
  onVideoSeek,
  onVideoStart,
  onVideoProgress,
  onWheel
}) => {
  const mediaType = getMediaType(activeEntry);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "w-full h-full bg-black/90 flex flex-row",
      tabIndex: -1,
      onWheel,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          ThumbnailPanel,
          {
            activeIndex,
            collapsed: leftPanelCollapsed,
            entries,
            getMediaType,
            playableEntries,
            onEntryClick,
            onToggleCollapse
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          MediaContent,
          {
            activeEntry,
            activeIndex,
            autoPlay,
            currentInitialized,
            mediaType,
            playableEntries,
            playing,
            progress: progress2,
            renderOperations,
            onLoad,
            onNextEntry,
            onPrevEntry,
            onVideoEnded,
            onVideoPause,
            onVideoPlay,
            onVideoProgress,
            onVideoReady,
            onVideoSeek,
            onVideoStart
          }
        )
      ]
    }
  );
};
const COMPRESSED_FILE_ROOT_SEPARATOR = "!";
var define_import_meta_env_default = {};
const buildPlayPath = (entry, compressedFilePath) => {
  return entry.path;
};
const convertToMediaPlayerEntries = (entries, compressedFilePath) => {
  return entries.map((entry) => ({
    ...entry,
    playPath: buildPlayPath(entry)
  }));
};
const MediaPlayer = reactExports.forwardRef((props, ref) => {
  const {
    defaultActiveIndex = 0,
    entries: propEntries = [],
    interval = 1e3,
    renderOperations = () => {
    },
    autoPlay = false,
    ...otherProps
  } = props;
  useTraceUpdate(props, "[MediaPlayer]");
  const log3 = buildLogger("MediaPlayer");
  log3(props);
  const [extensionsMediaTypes, setExtensionsMediaTypes] = reactExports.useState(
    /* @__PURE__ */ new Map()
  );
  const [playing, setPlaying] = reactExports.useState(autoPlay);
  const [progress2, setProgress] = reactExports.useState(0);
  const progressRef = reactExports.useRef(0);
  const progressIntervalRef = reactExports.useRef();
  const activeDtRef = reactExports.useRef();
  const autoGoToNextHandleRef = reactExports.useRef();
  const [leftPanelCollapsed, setLeftPanelCollapsed] = reactExports.useState(false);
  const [currentEntries, setCurrentEntries] = reactExports.useState(
    () => convertToMediaPlayerEntries(propEntries)
  );
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const playableEntries = currentEntries.filter(
    (entry) => entry.type !== IwFsType.Directory && entry.type !== IwFsType.CompressedFileEntry && entry.type !== IwFsType.Drive
  );
  const [activeIndex, setActiveIndex] = reactExports.useState(
    Math.min(defaultActiveIndex, Math.max(0, playableEntries.length - 1))
  );
  const activeEntry = playableEntries[activeIndex];
  const preloadRefs = reactExports.useRef(/* @__PURE__ */ new Map());
  const [currentInitialized, setCurrentInitialized] = reactExports.useState(false);
  const checkAndAutoExpand = reactExports.useCallback(async (entries) => {
    if (entries.length !== 1) {
      return { shouldExpand: false, entries };
    }
    const singleEntry = entries[0];
    if (singleEntry.type === IwFsType.Directory) {
      setIsLoading(true);
      try {
        const rsp = await BApi$1.file.getAllFiles({ path: singleEntry.path });
        if (!rsp.code && rsp.data && rsp.data.length > 0) {
          const expandedEntries = rsp.data.map((filePath) => {
            const name2 = filePath.split(/[/\\]/).pop() || filePath;
            const ext = name2.includes(".") ? name2.split(".").pop() : void 0;
            return {
              path: filePath,
              name: name2,
              meaningfulName: name2,
              ext,
              type: IwFsType.Unknown,
              passwordsForDecompressing: [],
              playPath: filePath
            };
          });
          return { shouldExpand: true, entries: expandedEntries };
        }
      } finally {
        setIsLoading(false);
      }
    } else if (singleEntry.type === IwFsType.CompressedFileEntry) {
      setIsLoading(true);
      try {
        const rsp = await BApi$1.file.getCompressedFileEntries({
          compressedFilePath: singleEntry.path
        });
        if (!rsp.code && rsp.data && rsp.data.length > 0) {
          const expandedEntries = rsp.data.map((ce2) => {
            const path = ce2.path || "";
            const name2 = path.split(/[/\\]/).pop() || path;
            const ext = name2.includes(".") ? name2.split(".").pop() : void 0;
            return {
              path,
              name: name2,
              meaningfulName: name2,
              ext,
              type: IwFsType.Unknown,
              passwordsForDecompressing: [],
              playPath: `${singleEntry.path}${COMPRESSED_FILE_ROOT_SEPARATOR}${path}`
            };
          });
          return { shouldExpand: true, entries: expandedEntries };
        }
      } finally {
        setIsLoading(false);
      }
    }
    return { shouldExpand: false, entries };
  }, []);
  reactExports.useEffect(() => {
    const initEntries = async () => {
      const initialEntries = convertToMediaPlayerEntries(propEntries);
      const result = await checkAndAutoExpand(initialEntries);
      if (result.shouldExpand) {
        setCurrentEntries(result.entries);
      } else {
        setCurrentEntries(initialEntries);
      }
      setActiveIndex(0);
    };
    initEntries();
  }, [propEntries, checkAndAutoExpand]);
  useUpdateEffect(() => {
    progressRef.current = progress2;
  }, [progress2]);
  reactExports.useEffect(() => {
    BApi$1.api.getAllExtensionMediaTypes().then((t2) => {
      if (t2.data) {
        const map2 = /* @__PURE__ */ new Map();
        Object.keys(t2.data).forEach((ext) => {
          map2.set(ext, t2.data[ext]);
        });
        setExtensionsMediaTypes(map2);
        console.log("[MediaPlayer]Extension-Media-Type initialized", map2);
      }
    });
    return () => {
      console.log("unmounting");
      clearProgressHandler();
    };
  }, []);
  const getMediaType = reactExports.useCallback(
    (entry) => {
      if (entry.type === IwFsType.Image)
        return MediaType.Image;
      if (entry.type === IwFsType.Video)
        return MediaType.Video;
      if (entry.type === IwFsType.Audio)
        return MediaType.Audio;
      const ext = entry.ext || entry.path.split(".").pop();
      if (!ext)
        return MediaType.Unknown;
      return extensionsMediaTypes.get(`.${ext}`) ?? MediaType.Unknown;
    },
    [extensionsMediaTypes]
  );
  const gotoPrevEntry = reactExports.useCallback(() => {
    if (activeIndex > 0) {
      setActiveIndex(activeIndex - 1);
    }
  }, [activeIndex]);
  const gotoNextEntry = reactExports.useCallback(() => {
    if (activeIndex < playableEntries.length - 1) {
      setActiveIndex(activeIndex + 1);
    }
  }, [activeIndex, playableEntries.length]);
  const handleEntryClick = reactExports.useCallback(
    (entry) => {
      if (entry.type === IwFsType.Directory || entry.type === IwFsType.CompressedFileEntry) {
        return;
      }
      const index2 = playableEntries.findIndex((e2) => e2.path === entry.path);
      if (index2 >= 0) {
        setActiveIndex(index2);
      }
    },
    [playableEntries]
  );
  reactExports.useEffect(() => {
    if (!activeEntry)
      return;
    const preloadCount = 3;
    for (let i2 = activeIndex + 1; i2 < playableEntries.length && i2 < activeIndex + 1 + preloadCount; i2++) {
      const entry = playableEntries[i2];
      if (entry && getMediaType(entry) === MediaType.Image) {
        const img = new Image();
        const playPath = entry.playPath || entry.path;
        img.src = `${define_import_meta_env_default.VITE_API_ENDPOINT || ""}/file/play?fullname=${encodeURIComponent(playPath)}`;
        preloadRefs.current.set(entry.path, img);
      }
    }
    return () => {
      preloadRefs.current.forEach((_24, key) => {
        if (key !== activeEntry.path) {
          const isInPreloadRange = playableEntries.slice(activeIndex + 1, activeIndex + 1 + preloadCount).some((e2) => e2.path === key);
          if (!isInPreloadRange) {
            preloadRefs.current.delete(key);
          }
        }
      });
    };
  }, [activeIndex, activeEntry, playableEntries, getMediaType]);
  const clearProgressHandler = () => {
    clearInterval(progressIntervalRef.current);
    clearTimeout(autoGoToNextHandleRef.current);
  };
  useUpdateEffect(() => {
    console.log("current initialized", currentInitialized);
  }, [currentInitialized]);
  reactExports.useEffect(() => {
    setPlaying(autoPlay);
    setProgress(0);
    setCurrentInitialized(false);
    clearProgressHandler();
  }, [activeEntry]);
  reactExports.useImperativeHandle(
    ref,
    () => ({
      gotoPrevEntry,
      gotoNextEntry
    }),
    [gotoPrevEntry, gotoNextEntry]
  );
  const tryAutoGotoNextEntry = () => {
    if (autoPlay) {
      clearProgressHandler();
      activeDtRef.current = /* @__PURE__ */ new Date();
      progressIntervalRef.current = setInterval(() => {
        const raw = ((/* @__PURE__ */ new Date()).getTime() - activeDtRef.current.getTime()) / interval * 100;
        const percentage = Math.floor(raw);
        if (percentage != progressRef.current) {
          setProgress(percentage);
        }
      }, 100);
      autoGoToNextHandleRef.current = setTimeout(
        () => {
          gotoNextEntry();
        },
        Math.max(interval, 1e3)
      );
    }
  };
  const handleLoad = () => {
    setCurrentInitialized(true);
    tryAutoGotoNextEntry();
  };
  const handleVideoPlay = () => {
    log3("Video play");
    setPlaying(true);
  };
  const handleVideoPause = () => {
    log3("Video pause");
    setPlaying(false);
  };
  const handleVideoEnded = () => {
    tryAutoGotoNextEntry();
  };
  const handleWheel = (e2) => {
    e2.preventDefault();
    e2.stopPropagation();
    if (e2.deltaY < 0) {
      gotoPrevEntry();
    } else if (e2.deltaY > 0) {
      gotoNextEntry();
    }
  };
  const handleKeyDown = (e2) => {
    switch (e2.key) {
      case "ArrowLeft":
        e2.preventDefault();
        gotoPrevEntry();
        break;
      case "ArrowRight":
        e2.preventDefault();
        gotoNextEntry();
        break;
    }
  };
  log3("Rendering", playableEntries, activeIndex, activeEntry);
  if (isLoading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center bg-black/90", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-white", children: "Loading..." }) });
  }
  if (!activeEntry) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center bg-black/90", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-white/70 text-lg", children: "No playable files" }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ref: (r2) => {
        if (r2) {
          forceFocus(r2);
          r2.focus();
        }
      },
      className: "w-full h-full",
      tabIndex: 0,
      onKeyDown: handleKeyDown,
      ...otherProps,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        MediaPlayerLayout,
        {
          activeEntry,
          activeIndex,
          autoPlay,
          currentInitialized,
          entries: currentEntries,
          getMediaType,
          leftPanelCollapsed,
          playableEntries,
          playing,
          progress: progress2,
          renderOperations,
          onEntryClick: handleEntryClick,
          onLoad: handleLoad,
          onNextEntry: gotoNextEntry,
          onPrevEntry: gotoPrevEntry,
          onToggleCollapse: () => setLeftPanelCollapsed(!leftPanelCollapsed),
          onVideoEnded: handleVideoEnded,
          onVideoPause: handleVideoPause,
          onVideoPlay: handleVideoPlay,
          onWheel: handleWheel
        }
      )
    }
  );
});
MediaPlayer.displayName = "MediaPlayer";
const TailingOperations = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { entry, capabilities } = props;
  const isExtractable = (capabilities == null ? void 0 : capabilities.includes("extract")) && entry.isDirectory && entry.childrenCount && entry.childrenCount > 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      OperationButton,
      {
        isIconOnly: true,
        onClick: (e2) => {
          e2.stopPropagation();
          BApi$1.tool.openFileOrDirectory({
            path: entry.path,
            openInDirectory: entry.type != IwFsType.Directory
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" })
      }
    ),
    isExtractable && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: `(E)${t2("fileExplorer.tip.extractChildrenToParent")}`,
        placement: "top",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            className: "w-auto h-auto p-1 min-w-fit opacity-60 hover:opacity-100",
            variant: "light",
            onClick: (e2) => {
              e2.stopPropagation();
              createPortal(ExtractModal, {
                entries: [entry]
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" })
          }
        )
      }
    ),
    entry.isDirectoryOrDrive && (capabilities == null ? void 0 : capabilities.includes("create-directory")) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: `(N)${t2("fileExplorer.contextMenu.createNewFolder")}`, placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        className: "w-auto h-auto p-1 min-w-fit opacity-60 hover:opacity-100",
        variant: "light",
        onClick: (e2) => {
          e2.stopPropagation();
          createPortal(CreateDirectoryModal, {
            parentPath: entry.path
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-base" })
      }
    ) }),
    entry.isDirectoryOrDrive && /* @__PURE__ */ jsxRuntimeExports.jsx(
      OperationButton,
      {
        isIconOnly: true,
        onClick: (e2) => {
          var _a2;
          (_a2 = entry.ref) == null ? void 0 : _a2.expand(true);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" })
      }
    )
  ] });
};
TailingOperations.displayName = "TailingOperations";
const LeftIcon = ({ loading, entry, expandable }) => {
  const renderInner = reactExports.useCallback(() => {
    if (loading) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-base animate-spin" });
    } else {
      switch (entry.status) {
        case EntryStatus.Default:
          if (expandable && entry.expandable) {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              OperationButton,
              {
                isIconOnly: true,
                onClick: () => {
                  var _a2, _b2;
                  if (entry.expanded) {
                    (_a2 = entry.ref) == null ? void 0 : _a2.collapse();
                  } else {
                    (_b2 = entry.ref) == null ? void 0 : _b2.expand();
                  }
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  RefIcon$1m,
                  {
                    className: `text-xs transition-transform duration-200 ease-out ${entry.expanded ? "rotate-90" : "rotate-0"}`
                  }
                )
              }
            );
          }
          break;
        case EntryStatus.Loading:
          break;
        case EntryStatus.Error:
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              content: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "text-danger", children: Object.keys(entry.errors).map((e2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: entry.errors[e2] }, e2);
              }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-base" }) })
            }
          );
      }
    }
    return null;
  }, [entry, loading, expandable]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-5 h-5 min-w-5 max-w-5 min-h-5 max-h-5 flex items-center justify-center mr-1.5", children: renderInner() });
};
LeftIcon.displayName = "LeftIcon";
const BTaskStopButton = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const stop = async () => {
    const rsp = await BApi$1.backgroundTask.stopBackgroundTask(props.id, {
      confirm: false
    });
    if (rsp.code == 202) {
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("Stop Task"),
        children: rsp.message ?? t2("Sure to stop the task?"),
        onOk: async () => await BApi$1.backgroundTask.stopBackgroundTask(props.id, {
          confirm: true
        })
      });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { ...props, onPress: props.onPress ?? stop, children: props.children ?? t2("Stop") });
};
BTaskStopButton.displayName = "BTaskStopButton";
const TaskOverlay = ({ task }) => {
  const { t: t2 } = useTranslation();
  if (task.error) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "running-task-cover absolute inset-0 z-[1] bg-white/30 backdrop-blur-[2px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute inset-0 flex items-center justify-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: "absolute left-0 top-0 h-full transition-[width] duration-300 ease-out",
          style: {
            width: `${task.percentage}%`,
            background: "linear-gradient(90deg, rgba(105, 226, 248, 0.15), rgba(105, 226, 248, 0.3))"
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-[var(--theme-body-background)] px-6 py-1 rounded-md text-xs font-medium shadow-md", children: [
        task.name,
        " ",
        task.status == BTaskStatus.NotStarted ? t2("Waiting") : `${task.percentage}%`
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "stop absolute inset-0 hidden items-center justify-center hover:flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BTaskStopButton, { color: "warning", id: task.id, size: "small" }) })
  ] });
};
TaskOverlay.displayName = "TaskOverlay";
const useFileExplorerClipboardStore = create$1((set2, get5) => ({
  paths: [],
  mode: "copy",
  copy: (paths) => set2({
    paths,
    mode: "copy"
  }),
  cut: (paths) => set2({
    paths,
    mode: "cut"
  }),
  clear: () => set2({
    paths: []
  }),
  hasPaths: () => get5().paths.length > 0,
  isInClipboard: (path) => get5().paths.includes(path)
}));
const VIRTUAL_LIST_OVERSCAN_ROW_COUNT = 5;
const RESIZE_DEBOUNCE_MS = 100;
const FileExplorerEntry = (props) => {
  var _a2, _b2;
  const {
    style: propsStyle,
    entry: propsEntry,
    filter: filter3,
    switchSelective,
    onDoubleClick,
    capabilities,
    onChildrenLoaded,
    onContextMenu = (e2, entry2) => {
    },
    onLoadFail = (rsp, entry2) => {
    },
    expandable = true,
    afterPlayedFirstFile,
    renderAfterName,
    renderBeforeRightOperations
  } = props;
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const clipboardStore = useFileExplorerClipboardStore();
  const { createPortal, createWindow } = useBakabaseContext();
  const [entry, setEntry] = reactExports.useState(propsEntry);
  const entryRef = reactExports.useRef(entry);
  const log3 = reactExports.useMemo(() => buildLogger(entryRef.current.path), [entry.path]);
  const [childrenVersion, setChildrenVersion] = reactExports.useState(0);
  const loadingChildrenRef = reactExports.useRef(false);
  const childrenStylesRef = reactExports.useRef({});
  const domRef = reactExports.useRef(null);
  const hashRef = reactExports.useRef(uuidv4());
  const [loading, setLoading] = reactExports.useState(false);
  const pendingRenderingRef = reactExports.useRef(false);
  const resizeDebounceRef = reactExports.useRef();
  const [isDragOver, setIsDragOver] = reactExports.useState(false);
  useUpdateEffect(() => {
    setEntry(propsEntry);
  }, [propsEntry]);
  reactExports.useEffect(() => {
    loadingChildrenRef.current = loading;
  }, [loading]);
  const currentEntryDomRef = reactExports.useRef();
  const initialize = reactExports.useCallback(async (e2) => {
    e2.path = standardizePath(e2.path);
    log3("Initializing", e2);
    if (entryRef.current) {
      log3("Disposing previous entry", entryRef.current);
      await entryRef.current.dispose();
    }
    entryRef.current = e2;
    entryRef.current.ref = {
      select: (selected) => {
        var _a3, _b3;
        if (((_a3 = entryRef.current) == null ? void 0 : _a3.selected) != selected) {
          entryRef.current.selected = selected;
          if (selected) {
            log3("Focus");
            (_b3 = currentEntryDomRef.current) == null ? void 0 : _b3.focus();
          }
          forceUpdate();
        }
      },
      get dom() {
        return domRef.current;
      },
      forceUpdate,
      renderChildren,
      get filteredChildren() {
        return entryRef.current.filteredChildren;
      },
      expand,
      collapse,
      scrollTo: (path) => {
        var _a3;
        const row = entryRef.current.filteredChildren.findIndex((e22) => e22.path == path);
        log3("scrolling to", path, row, virtualListRef.current);
        (_a3 = virtualListRef.current) == null ? void 0 : _a3.scrollToRow(row);
      },
      setLoading,
      playFirstFile
    };
    log3(
      "initializing, status: ",
      EntryStatus[entryRef.current.status],
      "expanded:",
      entryRef.current.expanded,
      `children size:${entryRef.current.childrenWidth}x${entryRef.current.childrenHeight}`,
      "filtered children",
      entryRef.current.filteredChildren
    );
    await entryRef.current.initialize();
    if (entryRef.current.expanded) {
      log3("Expanding");
      const rendered = await expand();
      if (!rendered) {
        entryRef.current.renderChildren();
      }
    }
    if (!entryRef.current.recalculateChildrenWidth()) {
      forceUpdate();
    }
    log3("Initialized");
  }, []);
  reactExports.useEffect(() => {
    initialize(entry);
    const resizeObserver2 = new ResizeObserver(() => {
      clearTimeout(resizeDebounceRef.current);
      resizeDebounceRef.current = setTimeout(() => {
        var _a3;
        if (domRef.current) {
          log3("Size changed", domRef.current, (_a3 = domRef.current) == null ? void 0 : _a3.clientWidth);
          entryRef.current.childrenWidth = domRef.current.clientWidth - (entryRef.current.isRoot ? 0 : ChildrenIndent);
          forceUpdate();
        }
      }, RESIZE_DEBOUNCE_MS);
    });
    resizeObserver2.observe(domRef.current);
    return () => {
      clearTimeout(resizeDebounceRef.current);
      resizeObserver2.disconnect();
    };
  }, []);
  useUpdateEffect(() => {
    initialize(entry);
  }, [entry]);
  const renderFileSystemInfo = reactExports.useCallback(() => {
    const en2 = entryRef.current;
    if (en2.type != IwFsType.Invalid) {
      const elements = [];
      if (en2.childrenCount != void 0 && en2.isDirectoryOrDrive && en2.properties.includes(EntryProperty.ChildrenCount)) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "secondary", size: "sm", variant: "light", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$N, { className: "text-sm" }),
            en2.childrenCount
          ] }, "children-count")
        );
      }
      if (en2.size != void 0 && en2.size > 0 && en2.properties.includes(EntryProperty.Size)) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: humanFileSize(en2.size, false) }, "size")
        );
      }
      if (elements.length > 0) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: elements });
      }
    }
    return;
  }, []);
  const shallowStyleEqual = reactExports.useCallback((a2, b2) => {
    if (a2 === b2)
      return true;
    if (!a2 || !b2)
      return false;
    const keysA = Object.keys(a2).filter((k2) => k2 !== "id");
    const keysB = Object.keys(b2).filter((k2) => k2 !== "id");
    if (keysA.length !== keysB.length)
      return false;
    return keysA.every((key) => a2[key] === b2[key]);
  }, []);
  const virtualListRowHeightCallback = reactExports.useCallback(
    ({ index: index2 }) => {
      const child = entryRef.current.filteredChildren[index2];
      if (child) {
        const h3 = child.totalHeight;
        log3(
          `[VirtualListRowHeight] Getting row height of [${child == null ? void 0 : child.name}]:${h3}, with children height:[${child.childrenHeight}]`
        );
        return h3;
      } else {
        log3(`[VirtualListRowHeight] Getting row height of [${index2}]:Unknown`);
        return 0;
      }
    },
    [childrenVersion, log3]
  );
  const virtualListRowRendererCallback = reactExports.useCallback(
    ({ index: index2, style: style2 }) => {
      if (entryRef.current.filteredChildren.length <= index2) {
        log3(
          `[VirtualListRowRenderer] Rendering a child with overflow index: ${index2} >= count of children: ${entryRef.current.filteredChildren.length}, ignoring`
        );
        return;
      }
      const e2 = entryRef.current.filteredChildren[index2];
      log3(
        `[VirtualListRowRenderer]Rendering children row:[${e2.name}]`,
        `height:[${style2.height}]`,
        `children height:[${e2.childrenHeight}]`,
        "status:",
        EntryStatus[e2.status]
      );
      const prevStyle = childrenStylesRef.current[e2.path];
      if (!shallowStyleEqual(prevStyle, style2)) {
        childrenStylesRef.current[e2.path] = { ...style2, id: uuidv4() };
      }
      const s2 = childrenStylesRef.current[e2.path];
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MemoFileExplorerEntry,
        {
          afterPlayedFirstFile,
          capabilities,
          entry: e2,
          expandable: e2.expandable,
          filter: filter3,
          style: s2,
          switchSelective,
          onContextMenu,
          onDoubleClick,
          onLoadFail,
          renderAfterName,
          renderBeforeRightOperations
        },
        e2.id
      );
    },
    [childrenVersion, onDoubleClick, renderAfterName, renderBeforeRightOperations, shallowStyleEqual, log3, afterPlayedFirstFile, capabilities, filter3, switchSelective, onContextMenu, onLoadFail]
  );
  const domCallback = reactExports.useCallback((node2) => {
    domRef.current = node2;
  }, []);
  const virtualListRef = reactExports.useRef(null);
  const renderChildren = reactExports.useCallback(() => {
    var _a3, _b3;
    log3("Rendering children", entryRef.current, entryRef.current.filteredChildren);
    pendingRenderingRef.current = true;
    setChildrenVersion((v2) => v2 + 1);
    const currentPaths = new Set(entryRef.current.filteredChildren.map((c2) => c2.path));
    for (const path of Object.keys(childrenStylesRef.current)) {
      if (!currentPaths.has(path)) {
        delete childrenStylesRef.current[path];
      }
    }
    if ((_a3 = domRef.current) == null ? void 0 : _a3.parentElement) {
      const newWidth = domRef.current.parentElement.clientWidth - (entryRef.current.isRoot ? 0 : ChildrenIndent);
      const newHeight = entryRef.current.childrenHeight;
      log3(`Recalculated children size: ${newWidth}x${newHeight}`);
      for (let i2 = 0; i2 < entryRef.current.filteredChildren.length; i2++) {
        (_b3 = virtualListRef.current) == null ? void 0 : _b3.recomputeRowHeights(i2);
      }
      forceUpdate();
    }
    if (entryRef.current.filteredChildren.length == 0) {
      triggerChildrenLoaded();
    }
  }, [log3]);
  const collapse = reactExports.useCallback(() => {
    if (entryRef.current.expanded) {
      entryRef.current.expanded = false;
      entryRef.current.renderChildren();
    }
  }, []);
  const expand = reactExports.useCallback(async (refresh = false) => {
    var _a3, _b3;
    if (!entryRef.current.expandable) {
      return false;
    }
    if (refresh) {
      entryRef.current.clearChildren();
      log3("Clear children");
    }
    if (!entryRef.current.expanded || !entryRef.current.children) {
      if (!entryRef.current.children) {
        if (loadingChildrenRef.current) {
          return false;
        }
        loadingChildrenRef.current = true;
        setLoading(true);
        const rsp = await BApi$1.file.getChildrenIwFsInfo(
          { root: entryRef.current.path },
          { showErrorToast: () => false }
        );
        log3(`Loaded ${(_b3 = (_a3 = rsp.data) == null ? void 0 : _a3.entries) == null ? void 0 : _b3.length} children`);
        setLoading(false);
        if (rsp.code) {
          onLoadFail(rsp, entryRef.current);
          return false;
        }
        if (rsp.data) {
          const { entries = [] } = rsp.data || {};
          entryRef.current.children = entries.map(
            (e2) => new Entry({
              ...e2,
              parent: entryRef.current,
              properties: entryRef.current.properties
            })
          );
        }
      }
      entryRef.current.expanded = true;
      entryRef.current.expireFilteredChildren();
      entryRef.current.renderChildren();
      return true;
    }
    return false;
  }, [log3, onLoadFail]);
  const triggerChildrenLoaded = reactExports.useCallback(() => {
    log3("Trigger onChildrenLoaded", entryRef.current);
    onChildrenLoaded == null ? void 0 : onChildrenLoaded(entryRef.current);
  }, []);
  useUpdateEffect(() => {
    entryRef.current.root.patchFilter(filter3);
    forceUpdate();
  }, [filter3]);
  const { actions } = entryRef.current;
  const renderTaskError = reactExports.useCallback(() => {
    if (entryRef.current.task && entryRef.current.task.error) {
      const text2 = `${entryRef.current.task.name}:${entryRef.current.task.error}`;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "danger",
          isIconOnly: !entryRef.current.task.briefError,
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(Modal, {
              defaultVisible: true,
              size: "xl",
              title: t2("common.label.error"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: text2 })
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base" }),
            entryRef.current.task.briefError
          ]
        }
      );
    }
    return;
  }, [createPortal, t2]);
  const play = reactExports.useCallback((entry2) => {
    const mediaEntry = {
      path: entry2.path,
      name: entry2.name,
      meaningfulName: entry2.meaningfulName || entry2.name,
      ext: entry2.ext,
      type: entry2.type,
      passwordsForDecompressing: entry2.passwordsForDecompressing || []
    };
    log3("Play", mediaEntry);
    createWindow(
      MediaPlayer,
      {
        entries: [mediaEntry],
        defaultActiveIndex: 0
      },
      {
        title: entry2.meaningfulName || entry2.name,
        persistent: true
      }
    );
  }, []);
  const playFirstFile = reactExports.useCallback(async () => {
    if (!((entryRef.current.childrenCount && entryRef.current.childrenCount > 0 || !entryRef.current.isDirectoryOrDrive) && (capabilities == null ? void 0 : capabilities.includes("play-first-file")))) {
      return;
    }
    const rsp = await BApi$1.file.getFirstFileByExtension({
      path: entryRef.current.path
    });
    const files = rsp.data ?? [];
    if (files.length == 0) {
      toast.danger(t2("fileExplorer.error.noFilesUnderPath"));
    } else {
      if (files.length == 1) {
        await BApi$1.tool.openFile({ path: files[0] });
        afterPlayedFirstFile == null ? void 0 : afterPlayedFirstFile(entryRef.current);
      } else {
        const modal2 = createPortal(Modal, {
          size: "lg",
          defaultVisible: true,
          title: t2("fileExplorer.modal.multipleFileTypesFound"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("fileExplorer.tip.pleaseSelectOneToOpen") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: files.map((x2) => {
              const segments = x2.split(".");
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { className: "max-w-[600px]", content: x2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  onPress: async () => {
                    await BApi$1.tool.openFile({ path: x2 });
                    afterPlayedFirstFile == null ? void 0 : afterPlayedFirstFile(entryRef.current);
                    modal2.destroy();
                  },
                  children: segments[segments.length - 1]
                }
              ) });
            }) })
          ] }),
          footer: {
            actions: ["cancel"]
          }
        });
      }
    }
  }, [capabilities, t2, createPortal, afterPlayedFirstFile]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: domCallback,
      className: `tree-entry flex flex-col select-none outline-none ${entryRef.current.isRoot ? "h-full" : ""}`,
      style: propsStyle,
      tabIndex: 0,
      onDoubleClick: (e2) => {
        e2.stopPropagation();
        log3("Double clicked", entryRef.current);
        onDoubleClick == null ? void 0 : onDoubleClick(e2, entryRef.current);
      },
      children: [
        !entryRef.current.isRoot && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "entry-main-container relative w-full h-9 min-h-9 max-h-9 border-b border-[var(--theme-file-processor-entry-divider)]",
            onClick: (e2) => {
              e2.stopPropagation();
            },
            children: [
              entryRef.current.type == IwFsType.Invalid && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 z-[2] cursor-not-allowed bg-red-700/10 backdrop-blur-[1px]" }),
              entryRef.current.task && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskOverlay, { task: entryRef.current.task }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  ref: (r2) => {
                    currentEntryDomRef.current = r2;
                  },
                  className: `entry-main box-content flex items-center justify-between h-6 py-[5px] pl-1 pr-2 relative rounded-md mx-1 border-l-[3px] border-l-transparent transition-all duration-150 ${((_a2 = entryRef.current) == null ? void 0 : _a2.selected) ? "selected" : ""} ${entryRef.current.expanded ? "border-b-[var(--theme-border-color)]" : ""} ${isDragOver ? "bg-primary/20 border-l-primary" : ""} ${clipboardStore.paths.includes(entryRef.current.path) ? clipboardStore.mode === "cut" ? "opacity-50 border-l-warning" : "border-l-success" : ""}`,
                  tabIndex: 0,
                  draggable: !entryRef.current.isDrive,
                  onDragStart: (e2) => {
                    e2.dataTransfer.setData("text/plain", JSON.stringify([entryRef.current.path]));
                    e2.dataTransfer.effectAllowed = "move";
                  },
                  onDragOver: (e2) => {
                    if (entryRef.current.isDirectoryOrDrive) {
                      e2.preventDefault();
                      e2.dataTransfer.dropEffect = "move";
                      setIsDragOver(true);
                    }
                  },
                  onDragLeave: () => {
                    setIsDragOver(false);
                  },
                  onDrop: (e2) => {
                    e2.preventDefault();
                    setIsDragOver(false);
                    try {
                      const paths = JSON.parse(e2.dataTransfer.getData("text/plain"));
                      if (paths.length > 0 && entryRef.current.isDirectoryOrDrive) {
                        BApi$1.file.moveEntries({
                          destDir: entryRef.current.path,
                          entryPaths: paths
                        }).then(() => {
                          toast.success(t2("fileExplorer.success.movedItems", { count: paths.length }));
                        }).catch((err) => {
                          toast.danger(t2("fileExplorer.error.failedToMoveItems"));
                          log3("Move entries failed", err);
                        });
                      }
                    } catch (err) {
                      log3("Invalid drag data", err);
                    }
                  },
                  onClick: () => {
                    var _a3, _b3, _c2;
                    const r2 = !switchSelective || switchSelective(entryRef.current);
                    log3(
                      `Trying ${((_a3 = entryRef.current) == null ? void 0 : _a3.selected) ? "unselect" : "select"} ${(_b3 = entryRef.current) == null ? void 0 : _b3.name}, and get blocked: ${!r2}`
                    );
                    if (r2) {
                      entryRef.current.selected = !((_c2 = entryRef.current) == null ? void 0 : _c2.selected);
                      forceUpdate();
                    }
                  },
                  onContextMenu: (e2) => {
                    if (!entryRef.current.selected) {
                      if (!switchSelective || switchSelective(entryRef.current)) {
                        entryRef.current.selected = true;
                        forceUpdate();
                      }
                    }
                    onContextMenu(e2, entryRef.current);
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center flex-1 overflow-hidden text-sm gap-0.5 ${entry.isDirectoryOrDrive ? "font-medium" : "font-normal opacity-90"}`, children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "things-before-name flex items-center", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(LeftIcon, { entry: entryRef.current, expandable, loading }),
                        entryRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center justify-center mr-1.5 ${entry.isDirectoryOrDrive ? "w-5 h-5 min-w-5 max-w-5 min-h-5 max-h-5" : "w-4 h-4 min-w-4 max-w-4 min-h-4 max-h-4"}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          FileSystemEntryIcon,
                          {
                            path: entryRef.current.path,
                            size: entry.isDirectoryOrDrive ? 18 : 16,
                            type: entry.isDirectoryOrDrive ? IconType.Directory : IconType.Dynamic
                          }
                        ) })
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        EditableText,
                        {
                          disabled: entry.isDrive || !(capabilities == null ? void 0 : capabilities.includes("rename")) || entry.status == EntryStatus.Error,
                          isDirectory: entry.isDirectoryOrDrive,
                          name: entry.name,
                          path: entry.path
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center [&>*]:whitespace-nowrap [&>*]:flex [&>*]:items-center [&>*]:ml-1.5", children: [
                        actions.includes(IwFsEntryAction.Play) && (capabilities == null ? void 0 : capabilities.includes("play")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
                          OperationButton,
                          {
                            isIconOnly: true,
                            color: "primary",
                            onClick: (e2) => {
                              play(entryRef.current);
                            },
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1a, { className: "text-base" })
                          }
                        ),
                        " ",
                        (entry.childrenCount && entry.childrenCount > 0 || !entry.isDirectoryOrDrive) && (capabilities == null ? void 0 : capabilities.includes("play-first-file")) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("fileExplorer.tip.quickPreviewUsingDefaultApp"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          OperationButton,
                          {
                            isIconOnly: true,
                            onClick: async (e2) => {
                              e2.stopPropagation();
                              playFirstFile();
                            },
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-base" })
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("fileExplorer.tip.openInMediaPlayer"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          OperationButton,
                          {
                            isIconOnly: true,
                            color: "success",
                            onPress: (e2) => {
                              play(entryRef.current);
                            },
                            children: /* @__PURE__ */ jsxRuntimeExports.jsx(BsCollectionPlayFill, { className: "text-base" })
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(TailingOperations, { capabilities, entry }),
                        renderFileSystemInfo(),
                        renderTaskError(),
                        renderAfterName && /* @__PURE__ */ jsxRuntimeExports.jsx(
                          "div",
                          {
                            className: "ml-1.5",
                            onClick: (e2) => e2.stopPropagation(),
                            onDoubleClick: (e2) => e2.stopPropagation(),
                            onMouseDown: (e2) => e2.stopPropagation(),
                            onKeyDown: (e2) => e2.stopPropagation(),
                            onContextMenu: (e2) => e2.stopPropagation(),
                            children: renderAfterName(entry)
                          }
                        )
                      ] })
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end ml-3 gap-1", children: [
                      renderBeforeRightOperations && /* @__PURE__ */ jsxRuntimeExports.jsx(
                        "div",
                        {
                          onClick: (e2) => e2.stopPropagation(),
                          onDoubleClick: (e2) => e2.stopPropagation(),
                          onMouseDown: (e2) => e2.stopPropagation(),
                          onKeyDown: (e2) => e2.stopPropagation(),
                          children: renderBeforeRightOperations(entry)
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RightOperations, { capabilities, entry: entryRef.current })
                    ] })
                  ]
                }
              )
            ]
          }
        ),
        entryRef.current.expanded && (((_b2 = entryRef.current.filteredChildren) == null ? void 0 : _b2.length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `children-container flex-1 overflow-hidden ${entryRef.current.isRoot ? "" : "pl-[8px] ml-[18px] border-l border-[var(--theme-file-processor-entry-divider)] hover:border-l-primary/50 transition-colors"}`,
            children: entryRef.current.childrenHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              List,
              {
                ref: (r2) => {
                  log3("VirtualList ref", r2);
                  virtualListRef.current = r2;
                  if (r2) {
                    if (pendingRenderingRef.current) {
                      pendingRenderingRef.current = false;
                      triggerChildrenLoaded();
                    }
                  }
                },
                height: entryRef.current.childrenHeight,
                overscanRowCount: VIRTUAL_LIST_OVERSCAN_ROW_COUNT,
                renderHash: hashRef.current,
                rowCount: entryRef.current.filteredChildren.length,
                rowHeight: virtualListRowHeightCallback,
                rowRenderer: virtualListRowRendererCallback,
                width: entryRef.current.childrenWidth
              }
            )
          }
        ) : loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center gap-2 opacity-70 py-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("fileExplorer.empty.noContent") })
        ] }))
      ]
    }
  );
};
const MemoFileExplorerEntry = React$6.memo(FileExplorerEntry);
var deepDiff = { exports: {} };
(function(module2, exports2) {
  (function(root2, factory) {
    var deepDiff2 = factory(root2);
    {
      module2.exports = deepDiff2;
    }
  })(commonjsGlobal, function(root2) {
    var validKinds = ["N", "E", "A", "D"];
    function inherits2(ctor, superCtor) {
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    }
    function Diff(kind, path) {
      Object.defineProperty(this, "kind", {
        value: kind,
        enumerable: true
      });
      if (path && path.length) {
        Object.defineProperty(this, "path", {
          value: path,
          enumerable: true
        });
      }
    }
    function DiffEdit(path, origin2, value2) {
      DiffEdit.super_.call(this, "E", path);
      Object.defineProperty(this, "lhs", {
        value: origin2,
        enumerable: true
      });
      Object.defineProperty(this, "rhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffEdit, Diff);
    function DiffNew(path, value2) {
      DiffNew.super_.call(this, "N", path);
      Object.defineProperty(this, "rhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffNew, Diff);
    function DiffDeleted(path, value2) {
      DiffDeleted.super_.call(this, "D", path);
      Object.defineProperty(this, "lhs", {
        value: value2,
        enumerable: true
      });
    }
    inherits2(DiffDeleted, Diff);
    function DiffArray(path, index2, item) {
      DiffArray.super_.call(this, "A", path);
      Object.defineProperty(this, "index", {
        value: index2,
        enumerable: true
      });
      Object.defineProperty(this, "item", {
        value: item,
        enumerable: true
      });
    }
    inherits2(DiffArray, Diff);
    function arrayRemove(arr, from2, to2) {
      var rest = arr.slice(from2 + 1 || arr.length);
      arr.length = from2 < 0 ? arr.length + from2 : from2;
      arr.push.apply(arr, rest);
      return arr;
    }
    function realTypeOf(subject) {
      var type4 = typeof subject;
      if (type4 !== "object") {
        return type4;
      }
      if (subject === Math) {
        return "math";
      } else if (subject === null) {
        return "null";
      } else if (Array.isArray(subject)) {
        return "array";
      } else if (Object.prototype.toString.call(subject) === "[object Date]") {
        return "date";
      } else if (typeof subject.toString === "function" && /^\/.*\//.test(subject.toString())) {
        return "regexp";
      }
      return "object";
    }
    function hashThisString(string3) {
      var hash = 0;
      if (string3.length === 0) {
        return hash;
      }
      for (var i2 = 0; i2 < string3.length; i2++) {
        var char2 = string3.charCodeAt(i2);
        hash = (hash << 5) - hash + char2;
        hash = hash & hash;
      }
      return hash;
    }
    function getOrderIndependentHash(object4) {
      var accum = 0;
      var type4 = realTypeOf(object4);
      if (type4 === "array") {
        object4.forEach(function(item) {
          accum += getOrderIndependentHash(item);
        });
        var arrayString = "[type: array, hash: " + accum + "]";
        return accum + hashThisString(arrayString);
      }
      if (type4 === "object") {
        for (var key in object4) {
          if (object4.hasOwnProperty(key)) {
            var keyValueString = "[ type: object, key: " + key + ", value hash: " + getOrderIndependentHash(object4[key]) + "]";
            accum += hashThisString(keyValueString);
          }
        }
        return accum;
      }
      var stringToHash = "[ type: " + type4 + " ; value: " + object4 + "]";
      return accum + hashThisString(stringToHash);
    }
    function deepDiff2(lhs, rhs, changes, prefilter, path, key, stack, orderIndependent) {
      changes = changes || [];
      path = path || [];
      stack = stack || [];
      var currentPath = path.slice(0);
      if (typeof key !== "undefined" && key !== null) {
        if (prefilter) {
          if (typeof prefilter === "function" && prefilter(currentPath, key)) {
            return;
          } else if (typeof prefilter === "object") {
            if (prefilter.prefilter && prefilter.prefilter(currentPath, key)) {
              return;
            }
            if (prefilter.normalize) {
              var alt = prefilter.normalize(currentPath, key, lhs, rhs);
              if (alt) {
                lhs = alt[0];
                rhs = alt[1];
              }
            }
          }
        }
        currentPath.push(key);
      }
      if (realTypeOf(lhs) === "regexp" && realTypeOf(rhs) === "regexp") {
        lhs = lhs.toString();
        rhs = rhs.toString();
      }
      var ltype = typeof lhs;
      var rtype = typeof rhs;
      var i2, j2, k2, other;
      var ldefined = ltype !== "undefined" || stack && stack.length > 0 && stack[stack.length - 1].lhs && Object.getOwnPropertyDescriptor(stack[stack.length - 1].lhs, key);
      var rdefined = rtype !== "undefined" || stack && stack.length > 0 && stack[stack.length - 1].rhs && Object.getOwnPropertyDescriptor(stack[stack.length - 1].rhs, key);
      if (!ldefined && rdefined) {
        changes.push(new DiffNew(currentPath, rhs));
      } else if (!rdefined && ldefined) {
        changes.push(new DiffDeleted(currentPath, lhs));
      } else if (realTypeOf(lhs) !== realTypeOf(rhs)) {
        changes.push(new DiffEdit(currentPath, lhs, rhs));
      } else if (realTypeOf(lhs) === "date" && lhs - rhs !== 0) {
        changes.push(new DiffEdit(currentPath, lhs, rhs));
      } else if (ltype === "object" && lhs !== null && rhs !== null) {
        for (i2 = stack.length - 1; i2 > -1; --i2) {
          if (stack[i2].lhs === lhs) {
            other = true;
            break;
          }
        }
        if (!other) {
          stack.push({ lhs, rhs });
          if (Array.isArray(lhs)) {
            if (orderIndependent) {
              lhs.sort(function(a2, b2) {
                return getOrderIndependentHash(a2) - getOrderIndependentHash(b2);
              });
              rhs.sort(function(a2, b2) {
                return getOrderIndependentHash(a2) - getOrderIndependentHash(b2);
              });
            }
            i2 = rhs.length - 1;
            j2 = lhs.length - 1;
            while (i2 > j2) {
              changes.push(new DiffArray(currentPath, i2, new DiffNew(void 0, rhs[i2--])));
            }
            while (j2 > i2) {
              changes.push(new DiffArray(currentPath, j2, new DiffDeleted(void 0, lhs[j2--])));
            }
            for (; i2 >= 0; --i2) {
              deepDiff2(lhs[i2], rhs[i2], changes, prefilter, currentPath, i2, stack, orderIndependent);
            }
          } else {
            var akeys = Object.keys(lhs);
            var pkeys = Object.keys(rhs);
            for (i2 = 0; i2 < akeys.length; ++i2) {
              k2 = akeys[i2];
              other = pkeys.indexOf(k2);
              if (other >= 0) {
                deepDiff2(lhs[k2], rhs[k2], changes, prefilter, currentPath, k2, stack, orderIndependent);
                pkeys[other] = null;
              } else {
                deepDiff2(lhs[k2], void 0, changes, prefilter, currentPath, k2, stack, orderIndependent);
              }
            }
            for (i2 = 0; i2 < pkeys.length; ++i2) {
              k2 = pkeys[i2];
              if (k2) {
                deepDiff2(void 0, rhs[k2], changes, prefilter, currentPath, k2, stack, orderIndependent);
              }
            }
          }
          stack.length = stack.length - 1;
        } else if (lhs !== rhs) {
          changes.push(new DiffEdit(currentPath, lhs, rhs));
        }
      } else if (lhs !== rhs) {
        if (!(ltype === "number" && isNaN(lhs) && isNaN(rhs))) {
          changes.push(new DiffEdit(currentPath, lhs, rhs));
        }
      }
    }
    function observableDiff(lhs, rhs, observer, prefilter, orderIndependent) {
      var changes = [];
      deepDiff2(lhs, rhs, changes, prefilter, null, null, null, orderIndependent);
      if (observer) {
        for (var i2 = 0; i2 < changes.length; ++i2) {
          observer(changes[i2]);
        }
      }
      return changes;
    }
    function orderIndependentDeepDiff(lhs, rhs, changes, prefilter, path, key, stack) {
      return deepDiff2(lhs, rhs, changes, prefilter, path, key, stack, true);
    }
    function accumulateDiff(lhs, rhs, prefilter, accum) {
      var observer = accum ? function(difference) {
        if (difference) {
          accum.push(difference);
        }
      } : void 0;
      var changes = observableDiff(lhs, rhs, observer, prefilter);
      return accum ? accum : changes.length ? changes : void 0;
    }
    function accumulateOrderIndependentDiff(lhs, rhs, prefilter, accum) {
      var observer = accum ? function(difference) {
        if (difference) {
          accum.push(difference);
        }
      } : void 0;
      var changes = observableDiff(lhs, rhs, observer, prefilter, true);
      return accum ? accum : changes.length ? changes : void 0;
    }
    function applyArrayChange(arr, index2, change) {
      if (change.path && change.path.length) {
        var it = arr[index2], i2, u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            applyArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            delete it[change.path[i2]];
            break;
          case "E":
          case "N":
            it[change.path[i2]] = change.rhs;
            break;
        }
      } else {
        switch (change.kind) {
          case "A":
            applyArrayChange(arr[index2], change.index, change.item);
            break;
          case "D":
            arr = arrayRemove(arr, index2);
            break;
          case "E":
          case "N":
            arr[index2] = change.rhs;
            break;
        }
      }
      return arr;
    }
    function applyChange(target, source2, change) {
      if (typeof change === "undefined" && source2 && ~validKinds.indexOf(source2.kind)) {
        change = source2;
      }
      if (target && change && change.kind) {
        var it = target, i2 = -1, last = change.path ? change.path.length - 1 : 0;
        while (++i2 < last) {
          if (typeof it[change.path[i2]] === "undefined") {
            it[change.path[i2]] = typeof change.path[i2 + 1] !== "undefined" && typeof change.path[i2 + 1] === "number" ? [] : {};
          }
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            if (change.path && typeof it[change.path[i2]] === "undefined") {
              it[change.path[i2]] = [];
            }
            applyArrayChange(change.path ? it[change.path[i2]] : it, change.index, change.item);
            break;
          case "D":
            delete it[change.path[i2]];
            break;
          case "E":
          case "N":
            it[change.path[i2]] = change.rhs;
            break;
        }
      }
    }
    function revertArrayChange(arr, index2, change) {
      if (change.path && change.path.length) {
        var it = arr[index2], i2, u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            revertArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            it[change.path[i2]] = change.lhs;
            break;
          case "E":
            it[change.path[i2]] = change.lhs;
            break;
          case "N":
            delete it[change.path[i2]];
            break;
        }
      } else {
        switch (change.kind) {
          case "A":
            revertArrayChange(arr[index2], change.index, change.item);
            break;
          case "D":
            arr[index2] = change.lhs;
            break;
          case "E":
            arr[index2] = change.lhs;
            break;
          case "N":
            arr = arrayRemove(arr, index2);
            break;
        }
      }
      return arr;
    }
    function revertChange(target, source2, change) {
      if (target && source2 && change && change.kind) {
        var it = target, i2, u2;
        u2 = change.path.length - 1;
        for (i2 = 0; i2 < u2; i2++) {
          if (typeof it[change.path[i2]] === "undefined") {
            it[change.path[i2]] = {};
          }
          it = it[change.path[i2]];
        }
        switch (change.kind) {
          case "A":
            revertArrayChange(it[change.path[i2]], change.index, change.item);
            break;
          case "D":
            it[change.path[i2]] = change.lhs;
            break;
          case "E":
            it[change.path[i2]] = change.lhs;
            break;
          case "N":
            delete it[change.path[i2]];
            break;
        }
      }
    }
    function applyDiff(target, source2, filter3) {
      if (target && source2) {
        var onChange = function(change) {
          if (!filter3 || filter3(target, source2, change)) {
            applyChange(target, source2, change);
          }
        };
        observableDiff(target, source2, onChange);
      }
    }
    Object.defineProperties(accumulateDiff, {
      diff: {
        value: accumulateDiff,
        enumerable: true
      },
      orderIndependentDiff: {
        value: accumulateOrderIndependentDiff,
        enumerable: true
      },
      observableDiff: {
        value: observableDiff,
        enumerable: true
      },
      orderIndependentObservableDiff: {
        value: orderIndependentDeepDiff,
        enumerable: true
      },
      orderIndepHash: {
        value: getOrderIndependentHash,
        enumerable: true
      },
      applyDiff: {
        value: applyDiff,
        enumerable: true
      },
      applyChange: {
        value: applyChange,
        enumerable: true
      },
      revertChange: {
        value: revertChange,
        enumerable: true
      },
      isConflict: {
        value: function() {
          return typeof $conflict !== "undefined";
        },
        enumerable: true
      }
    });
    accumulateDiff.DeepDiff = accumulateDiff;
    if (root2) {
      root2.DeepDiff = accumulateDiff;
    }
    return accumulateDiff;
  });
})(deepDiff);
var deepDiffExports = deepDiff.exports;
const diff$1 = /* @__PURE__ */ getDefaultExportFromCjs(deepDiffExports);
const log$w = buildLogger("RootEntry");
class RenderingQueue {
  constructor() {
    __publicField(this, "_queue", []);
  }
  push(path, type4) {
    this._queue.push({
      path,
      type: type4
    });
  }
  deQueueAll() {
    const q2 = this._queue;
    this._queue = [];
    return q2;
  }
  shrink() {
    const map2 = {};
    for (const i2 in this._queue) {
      const item = this._queue[i2];
      if (item.path in map2) {
        map2[item.path] |= item.type;
      } else {
        map2[item.path] = item.type;
      }
    }
    this._queue = Object.keys(map2).map((x2) => ({
      path: x2,
      type: map2[x2]
    }));
  }
  get length() {
    return this._queue.length;
  }
}
const _RootEntry = class _RootEntry extends Entry {
  constructor(path) {
    super({ path });
    __publicField(this, "nodeMap", {});
    __publicField(this, "filter", {});
    __publicField(this, "_fsWatcher");
    __publicField(this, "_keepAliveInterval");
    __publicField(this, "_processingFsEvents", false);
    __publicField(this, "_resizeObserver");
    __publicField(this, "_initialized", false);
    this.root = this;
    this.expanded = true;
    this.type = IwFsType.Directory;
    this.nodeMap[this.path] = this;
  }
  // Send keep-alive every 30 seconds
  patchFilter(filter3) {
    this.filter = {
      ...this.filter || {},
      ...filter3 || {}
    };
  }
  async _compareBTasks(renderingQueue) {
    const self2 = this;
    const bTasks = useBTasksStore.getState().tasks;
    const targetTasks = bTasks.filter(
      (x2) => x2.resourceType == BTaskResourceType.FileSystemEntry && (x2.status == BTaskStatus.Running || x2.status == BTaskStatus.Paused || x2.status == BTaskStatus.Error || x2.status == BTaskStatus.NotStarted || x2.status == BTaskStatus.Completed || x2.status == BTaskStatus.Cancelled)
    );
    const targetTasksMap = _$2.flatMap(
      targetTasks,
      (t2) => (t2.resourceKeys ?? []).map((k2) => ({
        path: k2,
        task: t2
      }))
    ).reduce((s2, t2) => {
      if (t2.path in s2) {
        s2[t2.path].push(t2.task);
      } else {
        s2[t2.path] = [t2.task];
      }
      return s2;
    }, {});
    for (const path of Object.keys(self2.nodeMap)) {
      const node2 = self2.nodeMap[path];
      const prevTask = node2.task;
      const incomingTasks = (targetTasksMap[path] ?? []).sort(
        (a2, b2) => {
          var _a2;
          return -((_a2 = a2.createdAt) == null ? void 0 : _a2.localeCompare(b2.createdAt));
        }
      );
      let task = incomingTasks[0];
      if (task) {
        if (task.status == BTaskStatus.Completed || task.status == BTaskStatus.Cancelled) {
          task = void 0;
        }
      }
      const differences = diff$1(prevTask, task);
      if (differences) {
        log$w("TaskChanged", differences, "current: ", task, "previous: ", prevTask);
        renderingQueue.push(
          path,
          1
          /* ForceUpdate */
        );
        node2.task = task;
      }
    }
  }
  async _consumeFsEvents(renderingQueue) {
    const self2 = this;
    const data = useIwFsEntryChangeEventsStore.getState();
    const dispatchers = {
      addRange: useIwFsEntryChangeEventsStore.getState().addRange,
      clear: useIwFsEntryChangeEventsStore.getState().clear
      // ... 其它 action如有
    };
    const { events: events2 } = data;
    if (events2.length > 0) {
      log$w("handling events", events2, self2);
      dispatchers.clear();
      for (let i2 = 0; i2 < events2.length; i2++) {
        const evt = events2[i2];
        const changedEntryPath = evt.type == IwFsEntryChangeType.Renamed ? evt.prevPath : evt.path;
        const changedEntry = self2.nodeMap[changedEntryPath];
        const parentPath = getStandardParentPath(evt.path);
        const parent = parentPath ? self2.nodeMap[parentPath] : void 0;
        log$w(
          "Try to locate parent",
          "path:",
          parentPath,
          "parent:",
          parent,
          "nodeMap:",
          self2.nodeMap
        );
        log$w(
          `File system entry changed: [${IwFsEntryChangeType[evt.type]}]${evt.path}`,
          "Event: ",
          evt,
          "Entry: ",
          changedEntry
        );
        if (!changedEntry) {
          if (parent) {
            switch (evt.type) {
              case IwFsEntryChangeType.Created:
                await parent.addChildByPath(evt.path, false);
                log$w("Add to children", evt.path, parent.children);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
                break;
              case IwFsEntryChangeType.Renamed:
                break;
              case IwFsEntryChangeType.Changed:
                break;
              case IwFsEntryChangeType.Deleted:
                if (parent.childrenCount != void 0) {
                  parent.childrenCount -= 1;
                }
                renderingQueue.push(
                  parent.path,
                  1
                  /* ForceUpdate */
                );
                break;
            }
          }
        } else {
          switch (evt.type) {
            case IwFsEntryChangeType.Created:
              break;
            case IwFsEntryChangeType.Renamed:
              if (parent) {
                await parent.replaceChildByPath(evt.prevPath, evt.path, false);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
              }
              break;
            case IwFsEntryChangeType.Changed:
              break;
            case IwFsEntryChangeType.Deleted:
              if (parent) {
                changedEntry.delete(false);
                renderingQueue.push(
                  parent.path,
                  2
                  /* Children */
                );
              }
              break;
          }
        }
      }
    }
  }
  async initialize() {
    var _a2, _b2;
    if (!this._initialized) {
      this._initialized = true;
      log$w("Initializing...", this);
      await this._stop();
      if (this.path) {
        log$w("Start watching", this.path, this);
        await BApi$1.file.startWatchingChangesInFileProcessorWorkspace(
          { path: this.path },
          { showErrorToast: () => false }
        );
        this._keepAliveInterval = setInterval(() => {
          BApi$1.file.keepAliveFileProcessorWatcher({ showErrorToast: () => false });
        }, _RootEntry.KEEP_ALIVE_INTERVAL_MS);
        const renderingQueue = new RenderingQueue();
        const self2 = this;
        this._fsWatcher = setInterval(async () => {
          if (self2._processingFsEvents) {
            return;
          }
          self2._processingFsEvents = true;
          await self2._consumeFsEvents(renderingQueue);
          await self2._compareBTasks(renderingQueue);
          const originalRenderingTimes = renderingQueue.length;
          renderingQueue.shrink();
          let actualRenderingTimes = 0;
          const rq = renderingQueue.deQueueAll();
          for (let i2 = 0; i2 < rq.length; i2++) {
            const { path, type: type4 } = rq[i2];
            const entry = self2.nodeMap[path];
            if (entry) {
              if (type4 & 2) {
                entry.renderChildren();
                actualRenderingTimes++;
              }
              if (type4 & 1) {
                entry.forceUpdate();
                actualRenderingTimes++;
              }
            }
          }
          if (actualRenderingTimes != originalRenderingTimes) {
            log$w(
              `Reduced ${originalRenderingTimes - actualRenderingTimes} rendering times totally`,
              rq
            );
          }
          self2._processingFsEvents = false;
        }, 500);
      }
      this.childrenWidth = ((_b2 = (_a2 = this._ref) == null ? void 0 : _a2.dom.parentElement) == null ? void 0 : _b2.clientWidth) ?? 0;
      this._resizeObserver = new ResizeObserver((c2) => {
        const parent = c2[0];
        log$w("Size of parent changed", parent);
        this.recalculateChildrenWidth();
      });
      this._resizeObserver.observe(this._ref.dom);
    }
  }
  async _stop() {
    log$w("Stopping watcher", this, this.path, this._fsWatcher);
    clearInterval(this._fsWatcher);
    clearInterval(this._keepAliveInterval);
    await BApi$1.file.stopWatchingChangesInFileProcessorWorkspace();
    useIwFsEntryChangeEventsStore.getState().clear();
  }
  async dispose() {
    await this._stop();
  }
};
__publicField(_RootEntry, "KEEP_ALIVE_INTERVAL_MS", 3e4);
let RootEntry = _RootEntry;
const log$v = buildLogger("FileExplorer");
const FileExplorer = reactExports.forwardRef(
  ({
    rootPath,
    onDoubleClick,
    filter: filter3,
    onSelected,
    selectable,
    onInitialized,
    defaultSelectedPath,
    expandable = false,
    capabilities,
    afterPlayedFirstFile,
    renderAfterName,
    renderBeforeRightOperations,
    renderExtraContextMenuItems
  }, ref) => {
    const { t: t2 } = useTranslation();
    const forceUpdate = useUpdate();
    const { createPortal } = useBakabaseContext();
    const initializedRootPathRef = reactExports.useRef();
    const inputBlurHandlerRef = reactExports.useRef();
    const [root2, setRoot] = reactExports.useState();
    const rootRef = reactExports.useRef(root2);
    const [inputValue, setInputValue] = reactExports.useState(rootPath);
    const [selectedEntries, setSelectedEntries] = reactExports.useState([]);
    const selectedEntriesRef = reactExports.useRef(selectedEntries);
    const selectionModeRef = reactExports.useRef(SelectionMode$1.Normal);
    const shiftSelectionStartRef = reactExports.useRef();
    const clipboardStore = useFileExplorerClipboardStore();
    const defaultSelectedPathInitializedRef = reactExports.useRef(false);
    const [historyRootPaths, setHistoryRootPaths] = reactExports.useState([]);
    const historyRootPathsRef = reactExports.useRef(historyRootPaths);
    const [filterInputValue, setFilterInputValue] = reactExports.useState();
    const [debouncedFilterValue, setDebouncedFilterValue] = reactExports.useState();
    useDebounce(
      () => {
        setDebouncedFilterValue(filterInputValue);
      },
      300,
      [filterInputValue]
    );
    const [menuProps, toggleMenu] = useMenuState();
    const [anchorPoint, setAnchorPoint] = reactExports.useState({
      x: 0,
      y: 0
    });
    const contextMenuEntryRef = reactExports.useRef();
    const onSelectedRef = reactExports.useRef(onSelected);
    useUpdateEffect(() => {
      onSelectedRef.current = onSelected;
    }, [onSelected]);
    useUpdateEffect(() => {
      var _a2;
      selectedEntriesRef.current = selectedEntries;
      log$v("Trigger onSelected", selectedEntriesRef.current);
      (_a2 = onSelectedRef.current) == null ? void 0 : _a2.call(onSelectedRef, selectedEntriesRef.current);
    }, [selectedEntries]);
    const initialize = reactExports.useCallback(async (path, addToHistory = true) => {
      let finalPath = standardizePath(path);
      if (finalPath != void 0 && finalPath.length > 0) {
        const isFile2 = (await BApi$1.file.checkPathIsFile({ path: finalPath })).data;
        if (isFile2) {
          finalPath = getStandardParentPath(finalPath);
        }
      }
      shiftSelectionStartRef.current = void 0;
      if (addToHistory && rootRef.current) {
        const history = historyRootPathsRef.current;
        if (history.length == 0 || history[history.length - 1] != rootRef.current.path) {
          setHistoryRootPaths([...history, rootRef.current.path]);
        }
      }
      log$v("initialize", finalPath, historyRootPathsRef.current);
      setRoot(new RootEntry(finalPath));
    }, []);
    reactExports.useEffect(() => {
      initialize(rootPath);
      return () => {
        var _a2;
        log$v("Disposing", rootRef);
        (_a2 = rootRef == null ? void 0 : rootRef.current) == null ? void 0 : _a2.dispose();
        clearTimeout(inputBlurHandlerRef.current);
      };
    }, []);
    useUpdateEffect(() => {
      initialize(rootPath);
    }, [rootPath]);
    useUpdateEffect(() => {
      var _a2;
      (_a2 = rootRef.current) == null ? void 0 : _a2.patchFilter(filter3);
    }, [filter3]);
    useUpdateEffect(() => {
      var _a2;
      setInputValue(root2 == null ? void 0 : root2.path);
      rootRef.current = root2;
      (_a2 = rootRef.current) == null ? void 0 : _a2.patchFilter(filter3);
      log$v("root changed", root2);
    }, [root2]);
    useUpdateEffect(() => {
      historyRootPathsRef.current = historyRootPaths;
    }, [historyRootPaths]);
    reactExports.useImperativeHandle(ref, () => {
      return {
        root: root2
      };
    }, [root2]);
    const ignoreClickEvent = reactExports.useCallback((target) => {
      let e2 = target;
      while (e2) {
        if (e2.role == "dialog" || e2.role == "menuitem") {
          return true;
        }
        e2 = e2.parentElement;
      }
      return false;
    }, []);
    const filterObj = reactExports.useMemo(() => ({ keyword: debouncedFilterValue }), [debouncedFilterValue]);
    const switchSelective = reactExports.useCallback((e2) => {
      if (selectable == "disabled") {
        return false;
      }
      if (selectable == "single" || selectionModeRef.current == SelectionMode$1.Normal) {
        shiftSelectionStartRef.current = e2;
        if (selectedEntriesRef.current.includes(e2)) {
          if (selectedEntriesRef.current.length > 1) {
            for (const se2 of selectedEntriesRef.current.filter((x2) => x2 != e2)) {
              se2.select(false);
            }
            setSelectedEntries([e2]);
            return false;
          } else {
            setSelectedEntries([]);
            return true;
          }
        } else {
          for (const se2 of selectedEntriesRef.current) {
            se2.select(false);
          }
          setSelectedEntries([e2]);
          return true;
        }
      }
      switch (selectionModeRef.current) {
        case SelectionMode$1.Ctrl: {
          shiftSelectionStartRef.current = e2;
          const newSelectedEntries = selectedEntriesRef.current.includes(e2) ? selectedEntriesRef.current.filter((x2) => x2 != e2) : [...selectedEntriesRef.current, e2];
          setSelectedEntries(newSelectedEntries);
          return true;
        }
        case SelectionMode$1.Shift: {
          shiftSelectionStartRef.current ?? (shiftSelectionStartRef.current = e2.parent.filteredChildren[0]);
          let startParent = shiftSelectionStartRef.current.parent;
          const startParentSet = /* @__PURE__ */ new Set();
          while (startParent) {
            startParentSet.add(startParent);
            startParent = startParent.parent;
          }
          let endParent = e2.parent;
          while (endParent) {
            if (startParentSet.has(endParent)) {
              break;
            }
            endParent = endParent.parent;
          }
          const buildPreorderTraversal = (entry, result) => {
            result.push(entry);
            if (entry.expanded && entry.filteredChildren) {
              for (const child of entry.filteredChildren) {
                buildPreorderTraversal(child, result);
              }
            }
          };
          const preorderTraversal = [];
          buildPreorderTraversal(endParent, preorderTraversal);
          const startIdx = preorderTraversal.indexOf(shiftSelectionStartRef.current);
          const endIdx = preorderTraversal.indexOf(e2);
          const minIdx = Math.min(startIdx, endIdx);
          const maxIdx = Math.max(startIdx, endIdx);
          const newSelectedEntries = preorderTraversal.slice(minIdx, maxIdx + 1);
          for (let i2 = minIdx; i2 <= maxIdx; i2++) {
            const en2 = preorderTraversal[i2];
            en2.select(true);
          }
          for (const se2 of selectedEntriesRef.current) {
            if (!newSelectedEntries.includes(se2)) {
              se2.select(false);
            }
          }
          setSelectedEntries(newSelectedEntries);
          return false;
        }
      }
      return true;
    }, [selectable]);
    if (!root2) {
      return null;
    }
    const filteredChildrenCount = root2.filteredChildren.length ?? 0;
    const childrenCount = root2.childrenCount ?? 0;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 max-h-full min-h-0 grow", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        ControlledMenu,
        {
          ...menuProps,
          anchorPoint,
          className: "file-explorer-context-menu",
          onClose: () => {
            contextMenuEntryRef.current = void 0;
            toggleMenu(false);
          },
          onContextMenu: (e2) => {
            e2.preventDefault();
            e2.stopPropagation();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            ContextMenu,
            {
              capabilities,
              root: root2,
              selectedEntries,
              renderExtraContextMenuItems,
              onChangeWorkingDirectory: initialize
            }
          )
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        EventListener,
        {
          onClick: (evt) => {
            if (ignoreClickEvent(evt.target)) {
              return;
            }
            for (const se2 of selectedEntriesRef.current) {
              se2.select(false);
            }
            setSelectedEntries([]);
          },
          onDelete: () => {
            var _a2;
            if (selectedEntriesRef.current.length > 0 && (capabilities == null ? void 0 : capabilities.includes("delete"))) {
              createPortal(DeleteConfirmationModal, {
                entries: selectedEntriesRef.current,
                rootPath: (_a2 = rootRef.current) == null ? void 0 : _a2.path
              });
            }
          },
          onKeyDown: (key, evt) => {
            var _a2, _b2, _c2;
            log$v("event listener", "key down", key, evt);
            const c2 = _$2.keys(FileSystemTreeEntryCapabilityMap).find(
              (k2) => {
                var _a3;
                return ((_a3 = FileSystemTreeEntryCapabilityMap[k2].shortcut) == null ? void 0 : _a3.key) == key;
              }
            );
            if (c2) {
              evt.stopPropagation();
              evt.preventDefault();
              if (capabilities == null ? void 0 : capabilities.includes(c2)) {
                switch (c2) {
                  case "wrap":
                    if (selectedEntriesRef.current.length > 0) {
                      createPortal(WrapModal, {
                        entries: selectedEntriesRef.current
                      });
                    }
                    break;
                  case "extract":
                    if (selectedEntriesRef.current.length > 0) {
                      createPortal(ExtractModal, {
                        entries: selectedEntriesRef.current
                      });
                    }
                    break;
                  case "move":
                    if (selectedEntriesRef.current.length > 0) {
                      createPortal(FolderSelector, {
                        onSelect: (path) => {
                          return BApi$1.file.moveEntries({
                            destDir: path,
                            entryPaths: selectedEntriesRef.current.map((e2) => e2.path)
                          });
                        },
                        sources: ["media library", "custom"]
                      });
                    }
                    break;
                  case "delete":
                    break;
                  case "rename":
                    break;
                  case "decompress":
                    if (selectedEntriesRef.current.length > 0) {
                      BApi$1.file.decompressFiles({
                        paths: selectedEntriesRef.current.map((e2) => e2.path)
                      });
                    }
                    break;
                  case "delete-all-same-name":
                    break;
                  case "group":
                    break;
                  case "play":
                    break;
                  case "play-first-file":
                    if (selectedEntriesRef.current.length == 1) {
                      (_a2 = selectedEntriesRef.current[0].ref) == null ? void 0 : _a2.playFirstFile();
                    }
                    break;
                }
              }
            } else {
              switch (key) {
                case "a": {
                  if (evt.ctrlKey) {
                    let parent;
                    for (const se2 of selectedEntriesRef.current) {
                      if (se2.parent) {
                        if (!parent || parent.path.startsWith(se2.parent.path)) {
                          parent = se2.parent;
                        }
                      }
                    }
                    parent ?? (parent = rootRef.current);
                    log$v("Select all filtered children of entry", parent);
                    if (parent) {
                      const newSelectedEntries = [];
                      for (const c22 of parent.filteredChildren) {
                        newSelectedEntries.push(c22);
                        c22.select(true);
                      }
                      const others = selectedEntriesRef.current.filter(
                        (s2) => !newSelectedEntries.includes(s2)
                      );
                      for (const o2 of others) {
                        o2.select(false);
                      }
                      setSelectedEntries(newSelectedEntries);
                    }
                  }
                  break;
                }
                case "ArrowUp":
                case "ArrowDown": {
                  evt.preventDefault();
                  const lastSelected = selectedEntriesRef.current[selectedEntriesRef.current.length - 1];
                  const parent = (lastSelected == null ? void 0 : lastSelected.parent) ?? rootRef.current;
                  if (parent && parent.filteredChildren.length > 0) {
                    let currentIndex = lastSelected ? parent.filteredChildren.indexOf(lastSelected) : -1;
                    let newIndex;
                    if (key === "ArrowUp") {
                      newIndex = currentIndex <= 0 ? parent.filteredChildren.length - 1 : currentIndex - 1;
                    } else {
                      newIndex = currentIndex >= parent.filteredChildren.length - 1 ? 0 : currentIndex + 1;
                    }
                    const newEntry = parent.filteredChildren[newIndex];
                    if (newEntry) {
                      for (const se2 of selectedEntriesRef.current) {
                        se2.select(false);
                      }
                      newEntry.select(true);
                      setSelectedEntries([newEntry]);
                      (_b2 = parent.ref) == null ? void 0 : _b2.scrollTo(newEntry.path);
                    }
                  }
                  break;
                }
                case "Enter": {
                  if (selectedEntriesRef.current.length === 1) {
                    const entry = selectedEntriesRef.current[0];
                    if (entry.isDirectoryOrDrive) {
                      initialize(entry.path);
                    }
                  }
                  break;
                }
                case "c": {
                  if ((evt.ctrlKey || evt.metaKey) && selectedEntriesRef.current.length > 0) {
                    evt.preventDefault();
                    const paths = selectedEntriesRef.current.map((e2) => e2.path);
                    clipboardStore.copy(paths);
                    toast.success(t2("Copied {{count}} items", { count: paths.length }));
                  }
                  break;
                }
                case "x": {
                  if ((evt.ctrlKey || evt.metaKey) && selectedEntriesRef.current.length > 0) {
                    evt.preventDefault();
                    const paths = selectedEntriesRef.current.map((e2) => e2.path);
                    clipboardStore.cut(paths);
                    toast.success(t2("Cut {{count}} items", { count: paths.length }));
                  }
                  break;
                }
                case "v": {
                  if ((evt.ctrlKey || evt.metaKey) && clipboardStore.paths.length > 0) {
                    evt.preventDefault();
                    const { paths, mode } = clipboardStore;
                    let destDir;
                    if (selectedEntriesRef.current.length === 0) {
                      destDir = (_c2 = rootRef.current) == null ? void 0 : _c2.path;
                    } else if (selectedEntriesRef.current.length === 1 && selectedEntriesRef.current[0].isDirectoryOrDrive) {
                      destDir = selectedEntriesRef.current[0].path;
                    }
                    if (destDir) {
                      if (mode === "cut") {
                        const allItemsAlreadyInDest = paths.every(
                          (p2) => getStandardParentPath(p2) === destDir
                        );
                        if (allItemsAlreadyInDest) {
                          break;
                        }
                      }
                      const apiCall = mode === "copy" ? BApi$1.file.copyEntries({ destDir, entryPaths: paths }) : BApi$1.file.moveEntries({ destDir, entryPaths: paths });
                      apiCall.then(() => {
                        const message = mode === "copy" ? t2("Copied {{count}} items", { count: paths.length }) : t2("Moved {{count}} items", { count: paths.length });
                        toast.success(message);
                        if (mode === "cut") {
                          clipboardStore.clear();
                        }
                      });
                    }
                  }
                  break;
                }
              }
            }
          },
          onSelectionModeChange: (m2) => {
            selectionModeRef.current = m2;
            forceUpdate();
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            isDisabled: historyRootPaths.length == 0,
            radius: "none",
            size: "sm",
            variant: "light",
            onClick: () => {
              const newRoot = historyRootPathsRef.current.pop();
              setHistoryRootPaths([...historyRootPathsRef.current]);
              initialize(newRoot, false);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$13, { className: "text-base" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            isDisabled: getStandardParentPath(root2 == null ? void 0 : root2.path) === void 0,
            radius: "none",
            size: "sm",
            variant: "light",
            onPress: () => {
              if (root2) {
                const newRootPath = getStandardParentPath(root2.path);
                if (newRootPath !== void 0) {
                  initialize(newRootPath);
                }
              }
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$11, { className: "text-base" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "grow",
            classNames: {
              inputWrapper: "pl-0"
            },
            endContent: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "light", children: [
              selectedEntries.length,
              " /",
              " ",
              filteredChildrenCount == childrenCount ? childrenCount : `${filteredChildrenCount} / ${childrenCount}`
            ] }),
            placeholder: t2("You can type a path here"),
            radius: "none",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                isDisabled: !(root2 == null ? void 0 : root2.path),
                radius: "none",
                size: "sm",
                onPress: () => {
                  BApi$1.tool.openFileOrDirectory({ path: root2 == null ? void 0 : root2.path });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-base" })
              }
            ),
            value: inputValue,
            onKeyDown: (evt) => {
              evt.stopPropagation();
            },
            onValueChange: (v2) => {
              const path = standardizePath(v2);
              setInputValue(path);
              clearTimeout(inputBlurHandlerRef.current);
              inputBlurHandlerRef.current = setTimeout(() => {
                initialize(path);
              }, 1e3);
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "w-1/4",
            placeholder: t2("Filter"),
            radius: "none",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-base" }),
            value: filterInputValue,
            onValueChange: (v2) => setFilterInputValue(v2)
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            className: "px-6",
            radius: "none",
            size: "sm",
            onClick: () => {
              BApi$1.file.openRecycleBin();
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" }),
              t2("Recycle bin")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Shortcuts, { capabilities })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        MemoFileExplorerEntry,
        {
          afterPlayedFirstFile,
          capabilities,
          entry: root2,
          expandable,
          filter: filterObj,
          renderAfterName,
          renderBeforeRightOperations,
          switchSelective,
          onChildrenLoaded: (e2) => {
            var _a2, _b2;
            if (!defaultSelectedPathInitializedRef.current) {
              defaultSelectedPathInitializedRef.current = true;
              const standardDefaultSelectedPath = standardizePath(defaultSelectedPath);
              if (standardDefaultSelectedPath != void 0 && standardDefaultSelectedPath.length > 0) {
                const selectedRow = (_a2 = e2.filteredChildren) == null ? void 0 : _a2.findIndex(
                  (c2) => c2.path == standardDefaultSelectedPath
                );
                if (selectedRow > -1) {
                  const selected = e2.filteredChildren[selectedRow];
                  selected.select(true);
                  const scrollToRow = Math.min(e2.filteredChildren.length - 1, selectedRow + 2);
                  (_b2 = e2.ref) == null ? void 0 : _b2.scrollTo(e2.filteredChildren[scrollToRow].path);
                  setSelectedEntries([selected]);
                }
              }
            }
            if (initializedRootPathRef.current != e2.path) {
              initializedRootPathRef.current = e2.path;
              onInitialized == null ? void 0 : onInitialized(e2 == null ? void 0 : e2.path);
            }
            forceUpdate();
          },
          onContextMenu: (evt, entry) => {
            evt.preventDefault();
            setAnchorPoint({
              x: evt.clientX,
              y: evt.clientY
            });
            contextMenuEntryRef.current = entry;
            toggleMenu(true);
          },
          onDoubleClick: (evt, en2) => {
            if (!onDoubleClick || onDoubleClick(evt, en2)) {
              if (en2.expandable) {
                if (en2.expanded) {
                  en2.collapse();
                } else {
                  en2.expand();
                }
              }
            }
          }
        }
      ) })
    ] });
  }
);
FileExplorer.displayName = "FileExplorer";
const log$u = buildLogger("FileSystemSelector");
const Panel = (props) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const {
    startPath,
    targetType,
    onSelected,
    onCancel,
    filter: propsFilter = (e2) => true,
    defaultSelectedPath
  } = props;
  const [selected, setSelected] = reactExports.useState();
  const [currentDirPath, setCurrentDirPath] = reactExports.useState();
  const rootRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
  }, []);
  const filter3 = (e2, mode) => {
    log$u("filter", e2, mode, targetType);
    if (!e2.path) {
      return false;
    }
    if (targetType) {
      switch (targetType) {
        case "file":
          if (![
            IwFsType.Audio,
            IwFsType.CompressedFilePart,
            IwFsType.CompressedFileEntry,
            IwFsType.Image,
            IwFsType.Unknown,
            IwFsType.Video
          ].includes(e2.type)) {
            if (mode == "select") {
              return false;
            } else {
              if (e2.type != IwFsType.Directory && e2.type != IwFsType.Drive) {
                return false;
              }
            }
          }
          break;
        case "folder":
          if (e2.type != IwFsType.Directory && e2.type != IwFsType.Drive) {
            return false;
          }
          break;
      }
    }
    if (propsFilter && !propsFilter(e2)) {
      return false;
    }
    return true;
  };
  log$u("selected", selected);
  const trySelectRootOrClearSelection = () => {
    var _a2;
    if (((_a2 = rootRef.current) == null ? void 0 : _a2.root) && filter3(rootRef.current.root, "select")) {
      setSelected(rootRef.current.root);
    } else {
      setSelected(void 0);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 grow max-h-full", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      FileExplorer,
      {
        ref: (r2) => {
          rootRef.current = r2;
          log$u("ref", r2);
        },
        capabilities: ["rename", "select"],
        defaultSelectedPath,
        filter: {
          custom: (e2) => filter3(e2, "visible")
        },
        rootPath: startPath,
        selectable: "single",
        onInitialized: () => {
          var _a2, _b2;
          log$u("onInitialized", (_a2 = rootRef.current) == null ? void 0 : _a2.root);
          if ((_b2 = rootRef.current) == null ? void 0 : _b2.root) {
            trySelectRootOrClearSelection();
            if (rootRef.current.root.isDirectory) {
              setCurrentDirPath(rootRef.current.root.path);
            }
          }
        },
        onSelected: (es) => {
          const e2 = es[0];
          log$u(rootRef.current);
          if (e2) {
            if (filter3(e2, "select")) {
              setSelected(e2);
            } else {
              setSelected(void 0);
            }
          } else {
            trySelectRootOrClearSelection();
          }
        }
      }
    ),
    selected && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "light", children: t2("Selected") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "whitespace-break-spaces h-auto",
          color: "success",
          radius: "sm",
          size: "sm",
          variant: "light",
          children: selected.path
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          isDisabled: !currentDirPath,
          onClick: () => {
            BApi$1.file.createDirectory({ parent: currentDirPath });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$I, { className: "text-base" }),
            t2("New Folder")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            disabled: !selected,
            onClick: () => {
              onSelected == null ? void 0 : onSelected(selected);
            },
            children: t2("OK")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            onClick: () => {
              onCancel == null ? void 0 : onCancel();
            },
            children: t2("Cancel")
          }
        )
      ] })
    ] })
  ] });
};
Panel.displayName = "Panel";
const FileSystemSelectorModal = (props) => {
  const { t: t2 } = useTranslation();
  const { ...fsProps } = props;
  const [visible, setVisible] = reactExports.useState(true);
  const close = () => {
    setVisible(false);
  };
  let titleKey = "fileSystemSelector.title.selectEntries";
  if (props.targetType != void 0) {
    switch (props.targetType) {
      case "file":
        titleKey = "fileSystemSelector.title.selectFile";
        break;
      case "folder":
        titleKey = "fileSystemSelector.title.selectFolder";
        break;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      className: "h-full",
      footer: false,
      size: "xl",
      title: t2(titleKey),
      visible,
      onClose: close,
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Panel,
        {
          ...fsProps,
          onCancel: () => {
            close();
            if (fsProps.onCancel) {
              fsProps.onCancel();
            }
          },
          onSelected: (e2) => {
            close();
            if (fsProps.onSelected) {
              fsProps.onSelected(e2);
            }
          }
        }
      )
    }
  );
};
FileSystemSelectorModal.displayName = "FileSystemSelectorModal";
const AttachmentValueRenderer = ({
  value: value2,
  variant,
  editor,
  size: size2,
  isReadonly: propsIsReadonly,
  isEditing: controlledIsEditing,
  defaultEditing = false,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const fileInputRef = reactExports.useRef(null);
  const [isUploading, setIsUploading] = reactExports.useState(false);
  const [addPopoverOpen, setAddPopoverOpen] = reactExports.useState(false);
  const [internalIsEditing, setInternalIsEditing] = reactExports.useState(defaultEditing);
  const isEditing = controlledIsEditing ?? internalIsEditing;
  const isReadonly = propsIsReadonly ?? false;
  const v2 = variant ?? "default";
  const canEdit = !isReadonly && editor;
  const handleClick = () => {
    if (controlledIsEditing === void 0 && !isEditing && canEdit) {
      setInternalIsEditing(true);
    }
  };
  const openFile = (path) => {
    BApi$1.tool.openFileOrDirectory({ path });
  };
  const handleFileUpload = async (event) => {
    var _a2, _b2;
    const file = (_a2 = event.target.files) == null ? void 0 : _a2[0];
    if (!file)
      return;
    setIsUploading(true);
    try {
      const formData = new FormData();
      formData.append("file", file);
      const response = await fetch(`${envConfig.apiEndpoint}/file/upload`, {
        method: "POST",
        body: formData
      });
      if (response.ok) {
        const result = await response.json();
        if (result.data) {
          const newValue = (value2 ?? []).concat([result.data]);
          (_b2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _b2.call(editor, newValue, newValue);
        }
      }
    } finally {
      setIsUploading(false);
      setAddPopoverOpen(false);
      if (fileInputRef.current) {
        fileInputRef.current.value = "";
      }
    }
  };
  const openFileSystemSelector = () => {
    setAddPopoverOpen(false);
    createPortal(FileSystemSelectorModal, {
      targetType: "file",
      onSelected: (entry) => {
        var _a2;
        const newValue = (value2 ?? []).concat([entry.path]);
        (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, newValue, newValue);
      }
    });
  };
  const triggerFileUpload = () => {
    var _a2;
    (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
  };
  const removeFile = (path) => {
    var _a2;
    const newValue = (value2 ?? []).filter((v22) => v22 !== path);
    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, newValue, newValue);
  };
  const getFileName = (path) => {
    const segments = splitPathIntoSegments(path);
    return segments[segments.length - 1] || path;
  };
  const sizeConfig = {
    sm: { thumbnail: 60, iconSize: "text-2xl", gap: 1 },
    md: { thumbnail: 80, iconSize: "text-3xl", gap: 2 },
    lg: { thumbnail: 100, iconSize: "text-4xl", gap: 2 }
  };
  const config2 = sizeConfig[size2 ?? "md"];
  const renderAddPopoverContent = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 p-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        size: "sm",
        variant: "light",
        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, {}),
        className: "justify-start",
        onClick: openFileSystemSelector,
        children: t2("property.attachment.selectFromFileSystem")
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        size: "sm",
        variant: "light",
        startContent: isUploading ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, {}),
        className: "justify-start",
        onClick: triggerFileUpload,
        isDisabled: isUploading,
        children: t2("property.attachment.uploadFromLocal")
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 px-2", children: t2("property.attachment.uploadHint") })
  ] });
  const renderAddButton = (lightVariant = false) => {
    if (!canEdit)
      return null;
    const trigger = lightVariant ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "primary",
        size: "sm",
        variant: "light",
        className: "min-w-0 w-5 h-5",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, { className: "text-xs" })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "primary",
        size: size2,
        variant: "flat",
        className: "min-w-0",
        style: {
          width: config2.thumbnail,
          height: config2.thumbnail
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, { className: config2.iconSize })
      }
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "input",
        {
          ref: fileInputRef,
          type: "file",
          className: "hidden",
          onChange: handleFileUpload
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          isOpen: addPopoverOpen,
          onOpenChange: setAddPopoverOpen,
          trigger,
          children: renderAddPopoverContent()
        }
      )
    ] });
  };
  const renderAttachment = (path, showDelete) => {
    const fileName = getFileName(path);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "flex flex-col items-center gap-1 relative group",
        style: { maxWidth: config2.thumbnail },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "cursor-pointer relative",
              onClick: () => openFile(path),
              title: path,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Img,
                {
                  alt: fileName,
                  loader: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: config2.iconSize }),
                  src: [
                    `${envConfig.apiEndpoint}/tool/thumbnail?path=${encodeURIComponent(path)}`
                  ],
                  style: {
                    maxWidth: config2.thumbnail,
                    maxHeight: config2.thumbnail,
                    objectFit: "cover"
                  },
                  unloader: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "div",
                    {
                      className: "flex items-center justify-center bg-default-100 rounded",
                      style: {
                        width: config2.thumbnail,
                        height: config2.thumbnail
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFile, { className: config2.iconSize })
                    }
                  )
                }
              )
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              className: "text-xs text-default-500 truncate w-full text-center",
              title: fileName,
              children: fileName
            }
          ),
          showDelete && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "flat",
              className: "absolute -top-1 -right-1 min-w-0 w-5 h-5 opacity-0 group-hover:opacity-100 transition-opacity",
              onClick: (e2) => {
                e2.stopPropagation();
                removeFile(path);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-xs" })
            }
          )
        ]
      },
      path
    );
  };
  if (v2 === "default") {
    const showEditControls = isEditing === true || controlledIsEditing === void 0 && !!canEdit;
    if (!value2 || value2.length === 0) {
      if (isReadonly) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2 });
      }
      if (showEditControls) {
        return renderAddButton();
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: canEdit ? handleClick : void 0 });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-start gap-${config2.gap} flex-wrap`, children: [
      value2.map((path) => renderAttachment(path, showEditControls)),
      showEditControls && renderAddButton()
    ] });
  }
  if (v2 === "light") {
    const showEditControls = isEditing === true || controlledIsEditing === void 0 && !!canEdit;
    if (!value2 || value2.length === 0) {
      if (isReadonly) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2 });
      }
      if (showEditControls) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "input",
            {
              ref: fileInputRef,
              type: "file",
              className: "hidden",
              onChange: handleFileUpload
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            PopoverComponent,
            {
              isOpen: addPopoverOpen,
              onOpenChange: setAddPopoverOpen,
              trigger: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: () => {
              } }) }),
              children: renderAddPopoverContent()
            }
          )
        ] });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: canEdit ? handleClick : void 0 });
    }
    const renderLightFilename = (path) => {
      const fileName = getFileName(path);
      const filenameSpan = /* @__PURE__ */ jsxRuntimeExports.jsx(
        "span",
        {
          className: `cursor-pointer hover:underline ${showEditControls ? "text-primary" : ""}`,
          onClick: () => openFile(path),
          children: fileName
        }
      );
      if (showEditControls) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PopoverComponent,
          {
            trigger: filenameSpan,
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 p-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  color: "danger",
                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, {}),
                  className: "justify-start",
                  onClick: () => removeFile(path),
                  children: t2("Delete")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 my-1" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, {}),
                  className: "justify-start",
                  onClick: openFileSystemSelector,
                  children: t2("property.attachment.selectFromFileSystem")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  startContent: isUploading ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, {}),
                  className: "justify-start",
                  onClick: triggerFileUpload,
                  isDisabled: isUploading,
                  children: t2("property.attachment.uploadFromLocal")
                }
              )
            ] })
          },
          path
        );
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: filenameSpan }, path);
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { size: size2, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "input",
        {
          ref: fileInputRef,
          type: "file",
          className: "hidden",
          onChange: handleFileUpload
        }
      ),
      value2.map((path, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        i2 !== 0 && ", ",
        renderLightFilename(path)
      ] }, path))
    ] }) });
  }
  return null;
};
AttachmentValueRenderer.displayName = "AttachmentValueRenderer";
buildLogger("RatingValueRenderer");
const RatingValueRenderer = (props) => {
  const { value: propsValue, editor, variant, allowHalf = true, size: size2, isEditing, isReadonly: propsIsReadonly, defaultEditing } = props;
  const [value2, setValue] = reactExports.useState(propsValue);
  const { t: t2 } = useTranslation();
  const isReadonly = propsIsReadonly ?? false;
  const [lightEditing, setLightEditing] = reactExports.useState(defaultEditing && !isReadonly && !!editor && variant === "light");
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const handleRatingChange = (r2) => {
    var _a2;
    if (isReadonly || !editor)
      return;
    setValue(r2);
    (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, r2, r2);
  };
  const startLightEditing = !isReadonly && editor && isEditing !== false && variant === "light" ? () => setLightEditing(true) : void 0;
  const completeLightEditing = (v2) => {
    var _a2;
    setValue(v2);
    setLightEditing(false);
    (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, v2, v2);
  };
  if (variant === "light") {
    if (isEditing && !isReadonly && editor) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueEditor,
        {
          placeholder: t2("Set rating"),
          value: value2,
          size: size2,
          onValueChange: (dv) => {
            var _a2;
            setValue(dv);
            (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, dv, dv);
          }
        }
      );
    }
    if (lightEditing) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueEditor,
        {
          placeholder: t2("Set rating"),
          value: value2,
          size: size2,
          onValueChange: (dv) => completeLightEditing(dv)
        }
      );
    }
    if (value2 != void 0 && value2 > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { size: size2, onClick: startLightEditing, children: value2 });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: startLightEditing });
    }
  }
  const canEdit = !isReadonly && editor;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Rating,
    {
      allowHalf,
      value: value2,
      size: size2,
      disabled: !canEdit,
      onChange: canEdit ? handleRatingChange : void 0
    }
  );
};
RatingValueRenderer.displayName = "RatingValueRenderer";
buildLogger("MultilevelValueRenderer");
const MultilevelValueRenderer = ({
  value: value2,
  editor,
  variant,
  getDataSource,
  multiple,
  defaultEditing = false,
  valueAttributes,
  size: size2,
  isReadonly: propsIsReadonly,
  isEditing: controlledIsEditing
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [optionsThreshold] = useFilterOptionsThreshold();
  const [internalIsEditing, setInternalIsEditing] = reactExports.useState(defaultEditing);
  const containerRef = reactExports.useRef(null);
  const isEditing = controlledIsEditing ?? internalIsEditing;
  const isReadonly = propsIsReadonly ?? false;
  reactExports.useEffect(() => {
    if (controlledIsEditing !== void 0 || !isEditing)
      return;
    const handleClickOutside = (event) => {
      if (containerRef.current && !containerRef.current.contains(event.target)) {
        setInternalIsEditing(false);
      }
    };
    document.addEventListener("mousedown", handleClickOutside);
    return () => document.removeEventListener("mousedown", handleClickOutside);
  }, [controlledIsEditing, isEditing]);
  reactExports.useEffect(() => {
    if (isEditing && getDataSource && dataSource.length === 0) {
      setIsLoading(true);
      getDataSource().then((data) => {
        setDataSource(data);
        setIsLoading(false);
      });
    }
  }, [isEditing, getDataSource]);
  const handleClick = () => {
    if (controlledIsEditing === void 0 && !isEditing && !isReadonly && editor) {
      setInternalIsEditing(true);
    }
  };
  const openFullEditor = editor ? () => {
    createPortal(MultilevelValueEditor, {
      getDataSource,
      onValueChange: editor == null ? void 0 : editor.onValueChange,
      multiple,
      value: editor == null ? void 0 : editor.value
    });
  } : void 0;
  const flattenedOptions = reactExports.useMemo(() => {
    const result = [];
    const traverse = (nodes, currentPath, currentLabels) => {
      for (const node2 of nodes) {
        const newPath = [...currentPath, node2.value];
        const newLabels = [...currentLabels, node2.label || node2.value];
        if (node2.children && node2.children.length > 0) {
          traverse(node2.children, newPath, newLabels);
        } else {
          result.push({
            path: newPath,
            label: newLabels.join("/"),
            color: node2.color
          });
        }
      }
    };
    traverse(dataSource, [], []);
    return result;
  }, [dataSource]);
  const selectedValues = (editor == null ? void 0 : editor.value) || [];
  const isPathSelected = (path) => {
    const leafValue = path[path.length - 1];
    return selectedValues.includes(leafValue);
  };
  const togglePath = (path) => {
    if (isReadonly || !(editor == null ? void 0 : editor.onValueChange))
      return;
    const leafValue = path[path.length - 1];
    const isSelected = selectedValues.includes(leafValue);
    let newDbValues;
    let newBizValues;
    if (isSelected) {
      newDbValues = selectedValues.filter((v2) => v2 !== leafValue);
      newBizValues = flattenedOptions.filter((opt) => newDbValues.includes(opt.path[opt.path.length - 1])).map((opt) => opt.path);
    } else {
      if (multiple) {
        newDbValues = [...selectedValues, leafValue];
        newBizValues = flattenedOptions.filter((opt) => newDbValues.includes(opt.path[opt.path.length - 1])).map((opt) => opt.path);
      } else {
        newDbValues = [leafValue];
        newBizValues = [path];
      }
    }
    editor.onValueChange(newDbValues, newBizValues);
  };
  const visibleOptions = reactExports.useMemo(
    () => buildVisibleOptions(flattenedOptions, (opt) => isPathSelected(opt.path), optionsThreshold),
    [flattenedOptions, selectedValues, optionsThreshold]
  );
  const hasMore = hasMoreOptions(flattenedOptions.length, optionsThreshold);
  const remainingCount = getRemainingCount(flattenedOptions.length, visibleOptions.length);
  if (isEditing === true && dataSource.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "flex flex-wrap gap-1 items-center", children: [
      visibleOptions.map((opt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: opt.path.join("/"),
          label: opt.label,
          isSelected: isPathSelected(opt.path),
          color: opt.color,
          size: size2,
          onClick: () => togglePath(opt.path)
        },
        opt.path.join("/")
      )),
      hasMore && /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          color: "primary",
          onClick: openFullEditor,
          children: [
            t2("common.action.more"),
            " (+",
            remainingCount,
            ")"
          ]
        }
      )
    ] });
  }
  if (isEditing === true && isLoading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("common.state.loading") });
  }
  if (isEditing === true && dataSource.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NoChoicesAvailable, {});
  }
  const canEdit = !isReadonly && !!editor;
  if (value2 == void 0 || value2.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: canEdit ? "cursor-pointer" : void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: canEdit ? handleClick : void 0 }) });
  }
  const getFirstColor = (index2) => {
    const attrs = valueAttributes == null ? void 0 : valueAttributes[index2];
    if (attrs) {
      for (const attr of attrs) {
        if (attr == null ? void 0 : attr.color)
          return attr.color;
      }
    }
    return void 0;
  };
  if (variant == "light") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: handleClick, size: size2, children: value2 == null ? void 0 : value2.map((v2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
      i2 != 0 && ", ",
      /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { color: getFirstColor(i2), size: size2, children: v2.join("/") })
    ] }, i2)) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: "flex flex-wrap gap-1 cursor-pointer", children: value2 == null ? void 0 : value2.map((v2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      SelectableChip,
      {
        itemKey: `display-${i2}`,
        label: v2.join("/"),
        isSelected: true,
        color: getFirstColor(i2),
        size: size2
      },
      i2
    )) });
  }
};
MultilevelValueRenderer.displayName = "MultilevelValueRenderer";
const log$t = buildLogger("TagsValueEditor");
const TagsValueEditor = (props) => {
  const { t: t2 } = useTranslation();
  const { getDataSource, value: propsValue, onValueChange, onCancel } = props;
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [value2, setValue] = reactExports.useState(propsValue ?? []);
  log$t(props);
  reactExports.useEffect(() => {
    loadData();
  }, []);
  const loadData = async () => {
    const data = await getDataSource() ?? [];
    if (data.length > 0) {
      setDataSource(data);
    }
  };
  const groupedTags = reactExports.useMemo(() => {
    const groups = {};
    const ungrouped = [];
    const filteredData = keyword.length === 0 ? dataSource : dataSource.filter((d2) => {
      const searchText = d2.group ? `${d2.group}:${d2.name}` : d2.name;
      return searchText.toLowerCase().includes(keyword.toLowerCase());
    });
    for (const tag of filteredData) {
      if (tag.group && tag.group.length > 0) {
        if (!groups[tag.group]) {
          groups[tag.group] = [];
        }
        groups[tag.group].push(tag);
      } else {
        ungrouped.push(tag);
      }
    }
    return { groups, ungrouped };
  }, [dataSource, keyword]);
  const toggleTag = (tagValue) => {
    if (value2.includes(tagValue)) {
      setValue(value2.filter((v2) => v2 !== tagValue));
    } else {
      setValue([...value2, tagValue]);
    }
  };
  const renderTagButton = (tag) => {
    const isSelected = value2.includes(tag.value);
    const style2 = {};
    if (tag.color) {
      style2.color = tag.color;
      if (!isSelected) {
        style2.backgroundColor = autoBackgroundColor(tag.color);
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: isSelected ? "primary" : "default",
        size: "sm",
        style: style2,
        onPress: () => toggleTag(tag.value),
        children: tag.name
      },
      tag.value
    );
  };
  const groupNames = Object.keys(groupedTags.groups).sort();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: dataSource.length > 20 ? "xl" : "lg",
      title: t2("Select data"),
      onClose: onCancel,
      onOk: async () => {
        const bizValue = value2.map((v2) => {
          const tag = dataSource.find((d2) => d2.value === v2);
          if (tag) {
            return { name: tag.name, group: tag.group };
          }
          return null;
        }).filter((x2) => x2);
        onValueChange == null ? void 0 : onValueChange(value2, bizValue);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 max-h-full min-h-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            placeholder: t2("common.placeholder.search"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3 min-h-0 overflow-y-auto", children: dataSource.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-400 text-center py-4", children: t2("No choices available, please check your configurations") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          groupedTags.ungrouped.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: groupedTags.ungrouped.map(renderTagButton) }),
          groupNames.map((groupName) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium text-default-500", children: groupName }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 pl-2", children: groupedTags.groups[groupName].map(renderTagButton) })
          ] }, groupName)),
          groupedTags.ungrouped.length === 0 && groupNames.length === 0 && keyword.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-400 text-center py-4", children: t2("common.state.noData") })
        ] }) })
      ] })
    }
  );
};
TagsValueEditor.displayName = "TagsValueEditor";
buildLogger("TagsValueRenderer");
const TagsValueRenderer = (props) => {
  const { createPortal } = useBakabaseContext();
  const { t: t2 } = useTranslation();
  const { value: value2, editor, variant, getDataSource, valueAttributes, size: size2, isReadonly: propsIsReadonly, isEditing: controlledIsEditing, defaultEditing = false } = props;
  const [dataSource, setDataSource] = reactExports.useState([]);
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [optionsThreshold] = useFilterOptionsThreshold();
  const [internalIsEditing, setInternalIsEditing] = reactExports.useState(defaultEditing);
  const containerRef = reactExports.useRef(null);
  const isEditing = controlledIsEditing ?? internalIsEditing;
  const isReadonly = propsIsReadonly ?? false;
  reactExports.useEffect(() => {
    if (controlledIsEditing !== void 0 || !isEditing)
      return;
    const handleClickOutside = (event) => {
      if (containerRef.current && !containerRef.current.contains(event.target)) {
        setInternalIsEditing(false);
      }
    };
    document.addEventListener("mousedown", handleClickOutside);
    return () => document.removeEventListener("mousedown", handleClickOutside);
  }, [controlledIsEditing, isEditing]);
  reactExports.useEffect(() => {
    if (isEditing && getDataSource && dataSource.length === 0) {
      setIsLoading(true);
      getDataSource().then((data) => {
        setDataSource(data);
        setIsLoading(false);
      });
    }
  }, [isEditing, getDataSource]);
  const handleClick = () => {
    if (controlledIsEditing === void 0 && !isEditing && !isReadonly && editor) {
      setInternalIsEditing(true);
    }
  };
  const getTagLabel = (tag) => {
    if (tag.group != void 0 && tag.group.length > 0) {
      return `${tag.group}:${tag.name}`;
    }
    return tag.name;
  };
  const simpleLabels = value2 == null ? void 0 : value2.map(getTagLabel);
  const openFullEditor = editor ? () => {
    createPortal(TagsValueEditor, {
      value: editor == null ? void 0 : editor.value,
      getDataSource: async () => {
        return await (getDataSource == null ? void 0 : getDataSource()) || [];
      },
      onValueChange: (dbValue, bizValue) => {
        var _a2;
        (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(editor, dbValue, bizValue);
      }
    });
  } : void 0;
  const selectedValues = (editor == null ? void 0 : editor.value) || [];
  const toggleValue = (tagValue) => {
    if (isReadonly || !(editor == null ? void 0 : editor.onValueChange))
      return;
    const tag = dataSource.find((t22) => t22.value === tagValue);
    if (!tag)
      return;
    const newDbValues = selectedValues.includes(tagValue) ? selectedValues.filter((v2) => v2 !== tagValue) : [...selectedValues, tagValue];
    const newBizValues = newDbValues.map((v2) => {
      const t22 = dataSource.find((d2) => d2.value === v2);
      return t22 ? { name: t22.name, group: t22.group } : { name: v2 };
    });
    editor.onValueChange(newDbValues, newBizValues);
  };
  const visibleOptions = reactExports.useMemo(
    () => buildVisibleOptions(dataSource, (item) => selectedValues.includes(item.value), optionsThreshold),
    [dataSource, selectedValues, optionsThreshold]
  );
  const hasMore = hasMoreOptions(dataSource.length, optionsThreshold);
  const remainingCount = getRemainingCount(dataSource.length, visibleOptions.length);
  if (isEditing === true && dataSource.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "flex flex-wrap gap-1 items-center", children: [
      visibleOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: item.value,
          label: getTagLabel(item),
          isSelected: selectedValues.includes(item.value),
          color: item.color,
          size: size2,
          onClick: () => toggleValue(item.value)
        },
        item.value
      )),
      hasMore && /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          color: "primary",
          onClick: openFullEditor,
          children: [
            t2("common.action.more"),
            " (+",
            remainingCount,
            ")"
          ]
        }
      )
    ] });
  }
  if (isEditing === true && isLoading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("common.state.loading") });
  }
  if (isEditing === true && dataSource.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NoChoicesAvailable, {});
  }
  const canEdit = !isReadonly && !!editor;
  if (!value2 || value2.length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: canEdit ? "cursor-pointer" : void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { size: size2, onClick: canEdit ? handleClick : void 0 }) });
  }
  if (variant == "light") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { onClick: handleClick, size: size2, children: simpleLabels == null ? void 0 : simpleLabels.map((l2, i2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        i2 != 0 && ", ",
        /* @__PURE__ */ jsxRuntimeExports.jsx(LightText, { color: (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color, size: size2, children: l2 })
      ] }, i2);
    }) });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: containerRef, onClick: handleClick, className: "flex flex-wrap gap-1 cursor-pointer", children: simpleLabels == null ? void 0 : simpleLabels.map((l2, i2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        SelectableChip,
        {
          itemKey: `display-${i2}`,
          label: l2,
          isSelected: true,
          color: (_a2 = valueAttributes == null ? void 0 : valueAttributes[i2]) == null ? void 0 : _a2.color,
          size: size2
        },
        i2
      );
    }) });
  }
};
TagsValueRenderer.displayName = "TagsValueRenderer";
const TimeValueRenderer = ({
  value: value2,
  format: format2,
  variant,
  editor,
  size: size2,
  isEditing,
  isReadonly: propsIsReadonly,
  ...props
}) => {
  const [editing, setEditing] = reactExports.useState(false);
  const editingValueRef = reactExports.useRef();
  const isReadonly = propsIsReadonly ?? false;
  const f2 = format2 == void 0 ? "HH:mm:ss" : format2;
  const startEditing = !isReadonly && editor && isEditing !== false ? () => {
    editingValueRef.current = value2;
    setEditing(true);
  } : void 0;
  if (isEditing && !isReadonly && editor) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      TimeInput,
      {
        isReadOnly: false,
        value: value2,
        size: size2,
        onChange: (x2) => {
          var _a2;
          editingValueRef.current = x2;
          (_a2 = editor.onValueChange) == null ? void 0 : _a2.call(editor, x2, x2);
        }
      }
    );
  }
  if (editing) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      TimeInput,
      {
        isReadOnly: !editor,
        value: value2,
        size: size2,
        onBlur: (x2) => {
          var _a2;
          (_a2 = editor == null ? void 0 : editor.onValueChange) == null ? void 0 : _a2.call(
            editor,
            editingValueRef.current,
            editingValueRef.current
          );
          setEditing(false);
        },
        onChange: (x2) => editingValueRef.current = x2
      }
    );
  }
  if (value2 == void 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(NotSet, { onClick: startEditing, size: size2 });
  } else {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: startEditing, className: startEditing ? "cursor-pointer" : void 0, children: value2 == null ? void 0 : value2.format(f2) });
  }
};
TimeValueRenderer.displayName = "TimeValueRenderer";
dayjs.extend(duration);
buildLogger("StandardValueRenderer");
const StandardValueRenderer = (props) => {
  const { value: value2, type: type4, variant = "default", propertyType } = props;
  switch (type4) {
    case StandardValueType.String:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          multiline: propertyType == PropertyType.MultilineText,
          value: value2,
          variant
        }
      );
    case StandardValueType.ListString: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TagsValueRenderer,
        {
          value: value2 == null ? void 0 : value2.map((v2) => ({ name: v2 })),
          variant
        }
      );
    }
    case StandardValueType.Decimal:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: propertyType == void 0 || propertyType == PropertyType.Rating || propertyType == PropertyType.Number ? "number" : "progress",
          value: value2,
          variant
        }
      );
    case StandardValueType.Link:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(LinkValueRenderer, { value: value2, variant });
    case StandardValueType.Boolean:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BooleanValueRenderer, { value: value2, variant });
    case StandardValueType.DateTime: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateTimeValueRenderer,
        {
          as: propertyType == void 0 || propertyType == PropertyType.DateTime ? "datetime" : "date",
          format: propertyType == void 0 || propertyType == PropertyType.DateTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD",
          value: value2,
          variant
        }
      );
    }
    case StandardValueType.Time: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(TimeValueRenderer, { format: "HH:mm:ss", value: value2, variant });
    }
    case StandardValueType.ListListString: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(MultilevelValueRenderer, { value: value2, variant });
    }
    case StandardValueType.ListTag:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(TagsValueRenderer, { value: value2, variant });
  }
};
function TiChevronRightOutline(props) {
  return GenIcon({ "attr": { "version": "1.2", "baseProfile": "tiny", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 20c-.802 0-1.555-.312-2.122-.879-.566-.566-.878-1.32-.878-2.121s.312-1.555.879-2.122l2.878-2.878-2.878-2.879c-.567-.566-.879-1.32-.879-2.121s.312-1.555.879-2.122c1.133-1.132 3.109-1.133 4.243.001l7.121 7.121-7.122 7.121c-.566.567-1.319.879-2.121.879zm0-14c-.268 0-.518.104-.707.292-.189.19-.293.441-.293.708s.104.518.293.707l4.292 4.293-4.292 4.293c-.189.189-.293.439-.293.707s.104.518.293.707c.378.379 1.037.378 1.414.001l5.708-5.708-5.708-5.707c-.189-.189-.439-.293-.707-.293z" }, "child": [] }] })(props);
}
function TiFlowChildren(props) {
  return GenIcon({ "attr": { "version": "1.2", "baseProfile": "tiny", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M17 16c-1.305 0-2.403.837-2.816 2h-3.184c-1.654 0-3-1.346-3-3v-3.025c.838.634 1.87 1.025 3 1.025h3.184c.413 1.163 1.512 2 2.816 2 1.657 0 3-1.343 3-3s-1.343-3-3-3c-1.305 0-2.403.837-2.816 2h-3.184c-1.654 0-3-1.346-3-3v-.184c1.163-.413 2-1.512 2-2.816 0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.304.837 2.403 2 2.816v7.184c0 2.757 2.243 5 5 5h3.184c.413 1.163 1.512 2 2.816 2 1.657 0 3-1.343 3-3s-1.343-3-3-3zm0-5c.552 0 1 .449 1 1s-.448 1-1 1-1-.449-1-1 .448-1 1-1zm-10-7c.552 0 1 .449 1 1s-.448 1-1 1-1-.449-1-1 .448-1 1-1zm10 16c-.552 0-1-.449-1-1s.448-1 1-1 1 .449 1 1-.448 1-1 1z" }, "child": [] }] })(props);
}
const usePendingSearchStore = create$1((set2, get5) => ({
  pendingSearch: void 0,
  setPendingSearch: (search2) => {
    set2({ pendingSearch: search2 });
  },
  consumePendingSearch: () => {
    const current = get5().pendingSearch;
    if (current) {
      set2({ pendingSearch: void 0 });
    }
    return current;
  }
}));
const log$s = buildLogger("ChildrenModal");
const PAGE_SIZE$3 = 50;
const ChildrenModal = ({
  resourceId,
  resourceDisplayName,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const location2 = useLocation();
  const { closeAllModals } = useBakabaseContext();
  const setPendingSearch = usePendingSearchStore((s2) => s2.setPendingSearch);
  const { resources: children, loading, response, search: search2 } = useResourceSearch();
  const [error2, setError] = reactExports.useState(null);
  const [page, setPage] = reactExports.useState(1);
  const handleShowInNewTab = () => {
    const searchModel = {
      group: {
        combinator: SearchCombinator.And,
        disabled: false,
        filters: [
          {
            propertyPool: PropertyPool.Internal,
            propertyId: InternalProperty.ParentResource,
            operation: SearchOperation.Equals,
            dbValue: resourceId.toString(),
            bizValue: resourceDisplayName,
            disabled: false
          }
        ]
      },
      page: 1,
      pageSize: 50
    };
    setPendingSearch(searchModel);
    closeAllModals();
    if (location2.pathname !== "/resource") {
      navigate("/resource");
    }
  };
  const doSearch = (pageNumber) => {
    setError(null);
    search2(
      {
        group: {
          combinator: SearchCombinator.And,
          disabled: false,
          filters: [
            {
              propertyPool: PropertyPool.Internal,
              propertyId: InternalProperty.ParentResource,
              operation: SearchOperation.Equals,
              dbValue: resourceId.toString(),
              disabled: false
            }
          ]
        },
        page: pageNumber,
        pageSize: PAGE_SIZE$3
      },
      { saveSearch: false }
    ).then((result) => {
      log$s("Found children:", result.length);
    }).catch((err) => {
      console.error("Failed to search children:", err);
      setError(t2("resource.error.failedToLoadChildren"));
    });
  };
  reactExports.useEffect(() => {
    if (resourceId) {
      setPage(1);
      doSearch(1);
    }
  }, [resourceId]);
  const handlePageChange = (newPage) => {
    setPage(newPage);
    doSearch(newPage);
  };
  const totalPages = response ? Math.ceil(response.totalCount / PAGE_SIZE$3) : 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "7xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("resource.modal.resourceChildren") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.tip.viewChildrenInNewTab"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: handleShowInNewTab,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" })
          }
        ) })
      ] }),
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center h-32", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: t2("resource.state.loadingChildren") })
      ] }) : error2 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-red-500 p-4", children: error2 }) : children.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 p-4", children: t2("resource.empty.noChildrenFound") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("resource.label.foundChildrenCount", {
          count: (response == null ? void 0 : response.totalCount) ?? children.length
        }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-8 gap-1", children: children.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          ResourceMemo,
          {
            resource: child,
            selected: false,
            selectedResourceIds: [],
            onSelected: () => {
            },
            onSelectedResourcesChanged: () => {
            }
          },
          child.id
        )) }),
        totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          pagination_default,
          {
            showControls: true,
            page,
            total: totalPages,
            onChange: handlePageChange
          }
        ) })
      ] }) })
    }
  );
};
const dateTimes = [
  {
    key: "fileCreateDt",
    label: "resource.label.fileAddDate"
  },
  {
    key: "fileModifyDt",
    label: "resource.label.fileModifyDate"
  },
  {
    key: "createDt",
    label: "resource.label.resourceCreateDate"
  },
  {
    key: "updateDt",
    label: "resource.label.resourceUpdateDate"
  }
];
const BasicInfo = ({ resource }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "grid justify-evenly gap-y-1",
      style: { gridTemplateColumns: "repeat(2, auto)" },
      children: dateTimes.map((dateTime, i2) => {
        const label = t2(dateTime.label);
        const value2 = dayjs(resource[dateTime.key]).format(
          "YYYY-MM-DD HH:mm:ss"
        );
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-60", children: label }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: value2 })
        ] }, i2);
      })
    }
  );
};
BasicInfo.displayName = "BasicInfo";
const PropertyAttributeMap = {
  [PropertyType.SingleLineText]: {
    dbValueType: StandardValueType.String,
    bizValueType: StandardValueType.String,
    isReferenceValueType: false
  },
  [PropertyType.MultilineText]: {
    dbValueType: StandardValueType.String,
    bizValueType: StandardValueType.String,
    isReferenceValueType: false
  },
  [PropertyType.SingleChoice]: {
    dbValueType: StandardValueType.String,
    bizValueType: StandardValueType.String,
    isReferenceValueType: true
  },
  [PropertyType.MultipleChoice]: {
    dbValueType: StandardValueType.ListString,
    bizValueType: StandardValueType.ListString,
    isReferenceValueType: true
  },
  [PropertyType.Number]: {
    dbValueType: StandardValueType.Decimal,
    bizValueType: StandardValueType.Decimal,
    isReferenceValueType: false
  },
  [PropertyType.Percentage]: {
    dbValueType: StandardValueType.Decimal,
    bizValueType: StandardValueType.Decimal,
    isReferenceValueType: false
  },
  [PropertyType.Rating]: {
    dbValueType: StandardValueType.Decimal,
    bizValueType: StandardValueType.Decimal,
    isReferenceValueType: false
  },
  [PropertyType.Boolean]: {
    dbValueType: StandardValueType.Boolean,
    bizValueType: StandardValueType.Boolean,
    isReferenceValueType: false
  },
  [PropertyType.Link]: {
    dbValueType: StandardValueType.Link,
    bizValueType: StandardValueType.Link,
    isReferenceValueType: false
  },
  [PropertyType.Attachment]: {
    dbValueType: StandardValueType.ListString,
    bizValueType: StandardValueType.ListString,
    isReferenceValueType: false
  },
  [PropertyType.Date]: {
    dbValueType: StandardValueType.DateTime,
    bizValueType: StandardValueType.DateTime,
    isReferenceValueType: false
  },
  [PropertyType.DateTime]: {
    dbValueType: StandardValueType.DateTime,
    bizValueType: StandardValueType.DateTime,
    isReferenceValueType: false
  },
  [PropertyType.Time]: {
    dbValueType: StandardValueType.Time,
    bizValueType: StandardValueType.Time,
    isReferenceValueType: false
  },
  [PropertyType.Formula]: {
    dbValueType: StandardValueType.String,
    bizValueType: StandardValueType.String,
    isReferenceValueType: false
  },
  [PropertyType.Multilevel]: {
    dbValueType: StandardValueType.ListString,
    bizValueType: StandardValueType.ListListString,
    isReferenceValueType: true
  },
  [PropertyType.Tags]: {
    dbValueType: StandardValueType.ListString,
    bizValueType: StandardValueType.ListTag,
    isReferenceValueType: true
  }
};
function getDbValueType(propertyType) {
  return PropertyAttributeMap[propertyType].dbValueType;
}
function getBizValueType(propertyType) {
  return PropertyAttributeMap[propertyType].bizValueType;
}
({
  text: [PropertyType.SingleLineText, PropertyType.MultilineText, PropertyType.Link],
  number: [PropertyType.Number, PropertyType.Percentage, PropertyType.Rating],
  choice: [PropertyType.SingleChoice, PropertyType.MultipleChoice, PropertyType.Multilevel],
  dateTime: [PropertyType.DateTime, PropertyType.Date, PropertyType.Time],
  other: [PropertyType.Attachment, PropertyType.Boolean, PropertyType.Tags],
  underDevelopment: [PropertyType.Formula]
});
var GroupCombinator = /* @__PURE__ */ ((GroupCombinator2) => {
  GroupCombinator2[GroupCombinator2["And"] = 1] = "And";
  GroupCombinator2[GroupCombinator2["Or"] = 2] = "Or";
  return GroupCombinator2;
})(GroupCombinator || {});
const FilterContext = reactExports.createContext(null);
function FilterProvider({ config: config2, children }) {
  const value2 = reactExports.useMemo(() => ({ config: config2 }), [config2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FilterContext.Provider, { value: value2, children });
}
function useFilterConfig() {
  const context = reactExports.useContext(FilterContext);
  if (!context) {
    throw new Error("useFilterConfig must be used within a FilterProvider");
  }
  return context.config;
}
function useHasFilterContext() {
  const context = reactExports.useContext(FilterContext);
  return context !== null;
}
const SimpleFilterOperationMap = {
  [PropertyType.SingleLineText]: SearchOperation.Contains,
  [PropertyType.MultilineText]: SearchOperation.Contains,
  [PropertyType.SingleChoice]: SearchOperation.In,
  [PropertyType.MultipleChoice]: SearchOperation.Contains,
  [PropertyType.Number]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.Percentage]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.Rating]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.Boolean]: SearchOperation.Equals,
  [PropertyType.Link]: SearchOperation.Contains,
  [PropertyType.Attachment]: SearchOperation.Contains,
  [PropertyType.Date]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.DateTime]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.Time]: [SearchOperation.GreaterThanOrEquals, SearchOperation.LessThanOrEquals],
  [PropertyType.Formula]: SearchOperation.Contains,
  [PropertyType.Multilevel]: SearchOperation.Contains,
  [PropertyType.Tags]: SearchOperation.Contains
};
const getSimpleFilterOperation = (type4) => {
  const operation = SimpleFilterOperationMap[type4];
  return Array.isArray(operation) ? operation[0] : operation;
};
const getRangeFilterOperations = (type4) => {
  const operation = SimpleFilterOperationMap[type4];
  return Array.isArray(operation) ? operation : void 0;
};
const PropertyField = ({
  property: property2,
  isReadonly,
  onSelect,
  onCancel
}) => {
  const { t: t2 } = useTranslation();
  const config2 = useFilterConfig();
  const displayText = property2 ? property2.name ?? t2("Unknown property") : t2("Property");
  const handlePress = () => {
    config2.renderers.openPropertySelector(
      property2 ? { id: property2.id, pool: property2.pool } : void 0,
      (selectedProperty, availableOperations) => {
        onSelect == null ? void 0 : onSelect(selectedProperty, availableOperations);
      },
      onCancel
    );
  };
  if (isReadonly) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-foreground", children: displayText });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "button",
    {
      type: "button",
      className: "text-sm font-medium text-foreground hover:text-primary hover:underline cursor-pointer bg-transparent border-none p-0",
      onClick: handlePress,
      children: displayText
    }
  );
};
PropertyField.displayName = "PropertyField";
const numericPropertyTypes = [
  PropertyType.Number,
  PropertyType.Percentage,
  PropertyType.Rating,
  PropertyType.Date,
  PropertyType.DateTime,
  PropertyType.Time
];
const compactValuePropertyTypes = [
  PropertyType.Number,
  PropertyType.Percentage,
  PropertyType.Rating,
  PropertyType.Boolean,
  PropertyType.Date,
  PropertyType.DateTime,
  PropertyType.Time
];
const inlineValuePropertyTypes = [
  PropertyType.SingleChoice,
  PropertyType.MultipleChoice,
  PropertyType.Tags,
  PropertyType.Multilevel
];
const isCompactValueType = (propertyType) => {
  return propertyType !== void 0 && compactValuePropertyTypes.includes(propertyType);
};
const isInlineValueType = (propertyType) => {
  return propertyType !== void 0 && inlineValuePropertyTypes.includes(propertyType);
};
const shouldUseSymbol = (propertyType) => {
  return propertyType !== void 0 && numericPropertyTypes.includes(propertyType);
};
const getOperationDisplay = (operation, propertyType, t2) => {
  const baseKey = getEnumKey("SearchOperation", SearchOperation[operation]);
  if (shouldUseSymbol(propertyType)) {
    const symbolKey = `${baseKey}.symbol`;
    const symbol = t2(symbolKey);
    if (symbol !== symbolKey) {
      return symbol;
    }
  }
  return t2(baseKey);
};
const getOperationDropdownDisplay = (operation, propertyType, t2) => {
  const baseKey = getEnumKey("SearchOperation", SearchOperation[operation]);
  const descriptionKey = `${baseKey}.description`;
  const description = t2(descriptionKey);
  const label = t2(baseKey);
  let displayText = label;
  if (shouldUseSymbol(propertyType)) {
    const symbolKey = `${baseKey}.symbol`;
    const symbol = t2(symbolKey);
    if (symbol !== symbolKey) {
      displayText = `${symbol} ${label}`;
    }
  }
  return {
    displayText,
    description: description === descriptionKey ? void 0 : description
  };
};
const OperationSelector = ({
  operation,
  propertyType,
  availableOperations = [],
  hasProperty,
  isReadonly,
  onSelect
}) => {
  const { t: t2 } = useTranslation();
  const displayText = operation === void 0 ? t2("Condition") : getOperationDisplay(operation, propertyType, t2);
  if (isReadonly) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-secondary", children: displayText });
  }
  if (!hasProperty) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Please select a property first"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400 cursor-not-allowed", children: displayText }) });
  }
  if (!availableOperations || availableOperations.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Can not operate on this property"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400 cursor-not-allowed", children: displayText }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { placement: "bottom-start", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        type: "button",
        className: "text-sm text-secondary hover:text-secondary-600 hover:underline cursor-pointer bg-transparent border-none p-0",
        children: displayText
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_menu_default, { children: availableOperations.map((op) => {
      const { displayText: itemText, description } = getOperationDropdownDisplay(
        op,
        propertyType,
        t2
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        menu_item_base_default,
        {
          description,
          onClick: () => onSelect == null ? void 0 : onSelect(op),
          children: itemText
        },
        op
      );
    }) })
  ] });
};
OperationSelector.displayName = "OperationSelector";
const DeleteButton = ({ onDelete }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      size: "sm",
      variant: "light",
      color: "danger",
      className: "min-w-6 w-6 h-6",
      onPress: onDelete,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-sm" })
    }
  );
};
DeleteButton.displayName = "DeleteButton";
const DisableButton = ({ disabled, onToggle }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      size: "sm",
      variant: "light",
      color: disabled ? "success" : "warning",
      className: "min-w-6 w-6 h-6",
      onPress: onToggle,
      children: disabled ? /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAlt, { className: "text-sm" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-sm" })
    }
  );
};
DisableButton.displayName = "DisableButton";
const log$r = buildLogger("Filter");
const Filter = ({
  filter: propsFilter,
  onRemove,
  onChange,
  isReadonly,
  isNew,
  removeBackground,
  autoTriggerPropertySelector,
  onCancelNewFilter,
  filterDisplayMode,
  layout: layout2 = "horizontal"
}) => {
  var _a2, _b2, _c2;
  const config2 = useFilterConfig();
  const [filter3, setFilter] = reactExports.useState(propsFilter);
  const isSimpleMode = filterDisplayMode === FilterDisplayMode.Simple;
  const isVertical = layout2 === "vertical";
  reactExports.useEffect(() => {
    var _a3, _b3;
    if ((isNew || autoTriggerPropertySelector) && !filter3.propertyId) {
      openPropertySelector();
    } else if (filter3.propertyPool && filter3.propertyId && filter3.operation) {
      if (!filter3.property) {
        config2.api.getValueProperty(filter3).then((p2) => {
          if (p2) {
            setFilter((prev2) => ({
              ...prev2,
              property: p2,
              valueProperty: p2
            }));
          }
        });
      } else if (!filter3.valueProperty) {
        config2.api.getValueProperty(filter3).then((p2) => {
          if (p2) {
            setFilter((prev2) => ({
              ...prev2,
              valueProperty: p2
            }));
          }
        });
      }
    }
    if (((_a3 = filter3.property) == null ? void 0 : _a3.type) && !((_b3 = filter3.availableOperations) == null ? void 0 : _b3.length)) {
      config2.api.getAvailableOperationsByPropertyType(filter3.property.type).then((ops) => {
        if (ops == null ? void 0 : ops.length) {
          setFilter((prev2) => ({
            ...prev2,
            availableOperations: ops
          }));
        }
      });
    }
  }, []);
  useUpdateEffect(() => {
    setFilter(propsFilter);
  }, [propsFilter]);
  const changeFilter = (newFilter) => {
    setFilter(newFilter);
    onChange == null ? void 0 : onChange(newFilter);
    if (newFilter.propertyPool && newFilter.propertyId && newFilter.operation) {
      config2.api.saveRecentFilter(newFilter);
    }
  };
  log$r(propsFilter, filter3);
  const openPropertySelector = () => {
    config2.renderers.openPropertySelector(
      filter3.propertyId == void 0 ? void 0 : {
        id: filter3.propertyId,
        pool: filter3.propertyPool
      },
      (property2, availableOperations) => {
        handlePropertySelect(property2, availableOperations);
      },
      onCancelNewFilter
    );
  };
  const handlePropertySelect = (property2, availableOperations) => {
    const operation = isSimpleMode && property2.type ? getSimpleFilterOperation(property2.type) : availableOperations[0];
    const nf2 = {
      ...filter3,
      propertyId: property2.id,
      propertyPool: property2.pool,
      dbValue: void 0,
      bizValue: void 0,
      property: property2,
      availableOperations,
      operation
    };
    refreshValue(nf2);
  };
  const refreshValue = (filter22) => {
    if (!filter22.propertyPool || !filter22.propertyId || !filter22.operation) {
      filter22.valueProperty = void 0;
      filter22.dbValue = void 0;
      filter22.bizValue = void 0;
      changeFilter({
        ...filter22
      });
    } else {
      if (filter22.operation === SearchOperation.IsNull || filter22.operation === SearchOperation.IsNotNull) {
        filter22.dbValue = void 0;
        filter22.bizValue = void 0;
      }
      config2.api.getValueProperty(filter22).then((p2) => {
        filter22.valueProperty = p2;
        changeFilter({
          ...filter22
        });
      });
    }
  };
  const renderValue = () => {
    var _a3, _b3;
    if (!filter3.valueProperty) {
      return null;
    }
    if (filter3.operation == SearchOperation.IsNull || filter3.operation == SearchOperation.IsNotNull) {
      return null;
    }
    const valueElement = config2.renderers.renderValueInput(
      filter3.valueProperty,
      filter3.dbValue,
      filter3.bizValue,
      (dbValue, bizValue) => {
        changeFilter({
          ...filter3,
          dbValue,
          bizValue
        });
      },
      {
        size: "sm",
        variant: "light",
        isReadonly,
        operation: filter3.operation,
        // In Simple mode, always show editing UI (isEditing: true)
        // In Advanced mode, don't pass isEditing (keep undefined) to allow click-to-edit
        isEditing: isSimpleMode && !isReadonly ? true : void 0
      }
    );
    if (isSimpleMode && isCompactValueType((_a3 = filter3.property) == null ? void 0 : _a3.type)) {
      const propertyType = (_b3 = filter3.property) == null ? void 0 : _b3.type;
      const isDateTimeType = propertyType === PropertyType.Date || propertyType === PropertyType.DateTime || propertyType === PropertyType.Time;
      const widthClass = isDateTimeType ? "w-auto" : "w-16";
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: widthClass, children: valueElement });
    }
    return valueElement;
  };
  log$r("rendering filter", filter3);
  const toggleDisabled = () => {
    changeFilter({
      ...filter3,
      disabled: !filter3.disabled
    });
  };
  const isCompact = isSimpleMode && isCompactValueType((_a2 = filter3.property) == null ? void 0 : _a2.type);
  const useVerticalLayout = isVertical && !isCompact;
  const useFullWidth = useVerticalLayout && !isInlineValueType((_b2 = filter3.property) == null ? void 0 : _b2.type);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex ${useVerticalLayout ? "flex-col" : ""} ${useFullWidth ? "w-full" : ""} rounded p-1 ${useVerticalLayout ? "gap-1" : "items-center"} relative`,
      style: removeBackground ? void 0 : { backgroundColor: "var(--bakaui-overlap-background)" },
      children: [
        filter3.disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "absolute top-0 left-0 w-full h-full flex items-center justify-center z-10 rounded pointer-events-none",
            style: { backgroundColor: "var(--bakaui-overlap-background)" },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg text-warning" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center gap-1 ${useFullWidth ? "w-full" : ""} ${filter3.disabled ? "opacity-40" : ""}`, children: [
          !isReadonly && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteButton, { onDelete: onRemove }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(DisableButton, { disabled: filter3.disabled, onToggle: toggleDisabled })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertyField,
            {
              property: filter3.property,
              isReadonly: isReadonly || isSimpleMode,
              onSelect: handlePropertySelect,
              onCancel: onCancelNewFilter
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            OperationSelector,
            {
              operation: filter3.operation,
              propertyType: (_c2 = filter3.property) == null ? void 0 : _c2.type,
              availableOperations: filter3.availableOperations,
              hasProperty: filter3.propertyId !== void 0,
              isReadonly,
              onSelect: (op) => refreshValue({ ...filter3, operation: op })
            }
          ),
          !useVerticalLayout && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pr-2", children: renderValue() })
        ] }),
        useVerticalLayout && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${useFullWidth ? "w-full" : ""} ${filter3.disabled ? "opacity-40" : ""}`, children: renderValue() })
      ]
    }
  );
};
Filter.displayName = "Filter";
function BiAddToQueue(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H8c-1.103 0-2 .897-2 2v12c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM8 16V4h12l.002 12H8z" }, "child": [] }, { "tag": "path", "attr": { "d": "M4 8H2v12c0 1.103.897 2 2 2h12v-2H4V8zm11-2h-2v3h-3v2h3v3h2v-3h3V9h-3z" }, "child": [] }] })(props);
}
function BiCarousel(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 19h2c0 1.103.897 2 2 2h8c1.103 0 2-.897 2-2h2c1.103 0 2-.897 2-2V7c0-1.103-.897-2-2-2h-2c0-1.103-.897-2-2-2H8c-1.103 0-2 .897-2 2H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2zM20 7v10h-2V7h2zM8 5h8l.001 14H8V5zM4 7h2v10H4V7z" }, "child": [] }] })(props);
}
function BiCollapseVertical(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 7.59 7.05 2.64 5.64 4.05 12 10.41l6.36-6.36-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95 1.41-1.41L12 13.59l-6.36 6.36z" }, "child": [] }] })(props);
}
function BiExpandVertical(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, "child": [] }] })(props);
}
buildLogger("RecentFilters");
const RecentFilters = ({ onSelectFilter }) => {
  const { t: t2 } = useTranslation();
  const config2 = useFilterConfig();
  const [recentFilters, setRecentFilters] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const loadRecentFilters = async () => {
    setLoading(true);
    try {
      const filters = await config2.api.getRecentFilters();
      setRecentFilters(filters || []);
    } catch (error2) {
      console.error("Failed to load recent filters:", error2);
    } finally {
      setLoading(false);
    }
  };
  reactExports.useEffect(() => {
    loadRecentFilters();
  }, []);
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" });
  }
  if (recentFilters.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid-cols-2 gap-1 max-h-[400px] overflow-y-auto", children: recentFilters.map((filter3, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      button_default$1,
      {
        variant: "light",
        size: "sm",
        color: "primary",
        onPress: () => onSelectFilter == null ? void 0 : onSelectFilter(filter3),
        isIconOnly: true,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiAddToQueue, { className: "text-lg" })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Filter, { isReadonly: true, filter: filter3, removeBackground: true })
  ] })) });
};
RecentFilters.displayName = "RecentFilters";
const FilterAddPopoverContent = ({
  onAddFilter,
  onAddFilterGroup,
  onSelectFilters,
  showTags = false,
  selectedTags,
  onTagsChange,
  showRecentFilters = true,
  onClose,
  onSwitchToSimpleMode
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "grid items-center gap-2 my-3 mx-1 max-w-[480px]",
      style: { gridTemplateColumns: "auto auto" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("resourceFilter.advanceFilter") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              onPress: () => {
                onClose == null ? void 0 : onClose();
                onAddFilter(true);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$K, { className: "text-base" }),
                t2("resourceFilter.filter")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              onPress: () => {
                onClose == null ? void 0 : onClose();
                onAddFilterGroup();
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$14, { className: "text-base" }),
                t2("resourceFilter.filterGroup")
              ]
            }
          )
        ] }),
        showTags && onTagsChange && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("resourceFilter.specialFilters") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_group_default,
            {
              size: "sm",
              value: selectedTags == null ? void 0 : selectedTags.map((tag) => tag.toString()),
              onChange: (ts) => {
                const newTags = ts.map((tag) => parseInt(tag, 10));
                onTagsChange(newTags);
              },
              children: resourceTags.filter(
                (rt) => rt.value != ResourceTag.PathDoesNotExist && rt.value != ResourceTag.UnknownMediaLibrary
              ).map((rt) => /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { value: rt.value.toString(), children: t2(getEnumKey("ResourceTag", rt.label)) }, rt.value))
            }
          ) })
        ] }),
        showRecentFilters && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("resourceFilter.recentFilters") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            RecentFilters,
            {
              onSelectFilter: (filter3) => {
                onClose == null ? void 0 : onClose();
                onSelectFilters([filter3]);
              }
            }
          ) })
        ] }),
        onSwitchToSimpleMode && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "light",
              color: "primary",
              onPress: () => {
                onClose == null ? void 0 : onClose();
                onSwitchToSimpleMode();
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(TbSwitch2, { className: "text-lg" }),
                t2("resourceFilter.switchToSimpleMode")
              ]
            }
          ) })
        ] })
      ]
    }
  );
};
FilterAddPopoverContent.displayName = "FilterAddPopoverContent";
const log$q = buildLogger("FilterGroup");
const FilterGroup = ({
  group: propsGroup,
  onRemove,
  onChange,
  isRoot = false,
  externalNewFilterIndex,
  onExternalNewFilterConsumed,
  filterDisplayMode,
  filterLayout,
  isReadonly = false
}) => {
  const { t: t2 } = useTranslation();
  const [group, setGroup] = React$6.useState(propsGroup);
  const groupRef = reactExports.useRef(group);
  const [popoverOpen, setPopoverOpen] = reactExports.useState(false);
  const [actionsPopoverOpen, setActionsPopoverOpen] = reactExports.useState(false);
  const [internalNewFilterIndex, setInternalNewFilterIndex] = reactExports.useState(null);
  const newFilterIndex = internalNewFilterIndex ?? externalNewFilterIndex ?? null;
  const changeGroup = reactExports.useCallback(
    (newGroup) => {
      setGroup(newGroup);
      onChange == null ? void 0 : onChange(newGroup);
    },
    [onChange]
  );
  useUpdateEffect(() => {
    groupRef.current = group;
  }, [group]);
  useUpdateEffect(() => {
    setGroup(propsGroup);
  }, [propsGroup]);
  const { filters, groups, combinator } = group;
  const isSimpleMode = filterDisplayMode === FilterDisplayMode.Simple;
  const isVerticalLayout = filterLayout === "vertical";
  log$q("FilterGroup render", { isRoot, filtersCount: filters == null ? void 0 : filters.length, groupsCount: groups == null ? void 0 : groups.length, combinator });
  const renderCombinator = (index2) => {
    if (isSimpleMode)
      return null;
    const combinatorText = t2(getEnumKey("Combinator", GroupCombinator[combinator]));
    const isAnd = combinator === GroupCombinator.And;
    const handleClick = () => {
      if (isReadonly)
        return;
      changeGroup({
        ...group,
        combinator: isAnd ? GroupCombinator.Or : GroupCombinator.And
      });
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      "span",
      {
        className: `text-xs font-medium px-1.5 py-0.5 rounded select-none ${isReadonly ? "" : "cursor-pointer transition-opacity hover:opacity-80"}`,
        style: {
          backgroundColor: isAnd ? "hsl(var(--heroui-primary) / 0.2)" : "hsl(var(--heroui-warning) / 0.2)",
          color: isAnd ? "hsl(var(--heroui-primary))" : "hsl(var(--heroui-warning))"
        },
        onClick: handleClick,
        children: combinatorText
      },
      `c-${index2}`
    );
  };
  const conditionElements = (filters || []).map((f2, i2) => {
    const isNewFilter = newFilterIndex === i2;
    const filterElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
      Filter,
      {
        filter: f2,
        filterDisplayMode,
        layout: filterLayout,
        isReadonly,
        autoTriggerPropertySelector: isNewFilter,
        onChange: (tf2) => {
          if (isNewFilter) {
            setInternalNewFilterIndex(null);
            onExternalNewFilterConsumed == null ? void 0 : onExternalNewFilterConsumed();
          }
          changeGroup({
            ...group,
            filters: (group.filters || []).map((fil) => fil === f2 ? tf2 : fil)
          });
        },
        onRemove: () => {
          if (isNewFilter) {
            setInternalNewFilterIndex(null);
            onExternalNewFilterConsumed == null ? void 0 : onExternalNewFilterConsumed();
          }
          changeGroup({
            ...group,
            filters: (group.filters || []).filter((fil) => fil !== f2)
          });
        },
        onCancelNewFilter: isNewFilter ? () => {
          setInternalNewFilterIndex(null);
          onExternalNewFilterConsumed == null ? void 0 : onExternalNewFilterConsumed();
          changeGroup({
            ...groupRef.current,
            filters: (groupRef.current.filters || []).filter((_24, idx) => idx !== i2)
          });
        } : void 0
      },
      `f-${i2}`
    );
    return { element: filterElement, index: i2 };
  }).concat(
    (groups || []).map((g2, i2) => {
      const groupElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
        FilterGroup,
        {
          group: g2,
          filterDisplayMode,
          filterLayout,
          isReadonly,
          onChange: (tg2) => {
            changeGroup({
              ...group,
              groups: (group.groups || []).map((gr) => gr === g2 ? tg2 : gr)
            });
          },
          onRemove: () => {
            changeGroup({
              ...group,
              groups: (group.groups || []).filter((gr) => gr !== g2)
            });
          }
        },
        `g-${i2}`
      );
      return { element: groupElement, index: ((filters == null ? void 0 : filters.length) || 0) + i2 };
    })
  );
  const renderedElements = (() => {
    if (isVerticalLayout) {
      if (isSimpleMode) {
        return conditionElements.map((item) => item.element);
      }
      return conditionElements.map((item, i2) => {
        const isNotFirst = i2 > 0;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 w-full", children: [
          isNotFirst && renderCombinator(item.index),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: item.element })
        ] }, `row-${item.index}`);
      });
    }
    return conditionElements.reduce((acc, item, i2) => {
      acc.push(item.element);
      if (i2 < conditionElements.length - 1 && !isSimpleMode) {
        acc.push(renderCombinator(item.index));
      }
      return acc;
    }, []);
  })();
  const renderGroupActionsMenu = () => {
    if (isRoot || isReadonly)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PopoverComponent,
      {
        placement: "bottom-start",
        isOpen: actionsPopoverOpen,
        onOpenChange: setActionsPopoverOpen,
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            className: "min-w-6 w-6 h-6",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$p, { className: "text-base" })
          }
        ),
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 p-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "warning",
              size: "sm",
              variant: "light",
              className: "justify-start",
              onPress: () => {
                changeGroup({
                  ...group,
                  disabled: !group.disabled
                });
                setActionsPopoverOpen(false);
              },
              children: group.disabled ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAlt, { className: "text-lg" }),
                t2("Enable group")
              ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg" }),
                t2("Disable group")
              ] })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "danger",
              size: "sm",
              variant: "light",
              className: "justify-start",
              onPress: () => {
                setActionsPopoverOpen(false);
                onRemove == null ? void 0 : onRemove();
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" }),
                t2("Delete group")
              ]
            }
          )
        ] })
      }
    );
  };
  const renderGroup = () => {
    log$q("render group");
    const renderElementsWithActionsMenu = () => {
      const actionsMenu = renderGroupActionsMenu();
      if (!actionsMenu || !isVerticalLayout) {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          actionsMenu,
          renderedElements
        ] });
      }
      if (renderedElements.length === 0) {
        return actionsMenu;
      }
      const [firstElement, ...restElements] = renderedElements;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 w-full", children: [
          actionsMenu,
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: firstElement })
        ] }),
        restElements
      ] });
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `flex ${isVerticalLayout ? "flex-col" : "items-center flex-wrap"} gap-[5px] rounded text-sm relative ${isRoot ? "" : "border border-default-200 bg-[var(--bakaui-overlap-background)] px-1 py-1"}`,
        children: [
          group.disabled && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "absolute top-0 left-0 w-full h-full flex items-center justify-center z-20 group/group-disable-cover rounded cursor-not-allowed",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFilterAltOff, { className: "text-lg text-warning" })
            }
          ),
          renderElementsWithActionsMenu(),
          !isSimpleMode && !isReadonly && !(isRoot && !group && (!filters || filters.length == 0)) && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PopoverComponent,
            {
              showArrow: true,
              placement: "bottom",
              isOpen: popoverOpen,
              onOpenChange: setPopoverOpen,
              trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilterPlus, { className: "text-lg" }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                FilterAddPopoverContent,
                {
                  showTags: false,
                  showRecentFilters: true,
                  onAddFilter: (autoTrigger) => {
                    const currentFilters = groupRef.current.filters || [];
                    if (autoTrigger) {
                      setInternalNewFilterIndex(currentFilters.length);
                    }
                    changeGroup({
                      ...groupRef.current,
                      filters: [...currentFilters, { disabled: false }]
                    });
                  },
                  onAddFilterGroup: () => {
                    changeGroup({
                      ...groupRef.current,
                      groups: [
                        ...groupRef.current.groups || [],
                        {
                          combinator: GroupCombinator.And,
                          disabled: false
                        }
                      ]
                    });
                  },
                  onSelectFilters: (filters2) => {
                    changeGroup({
                      ...groupRef.current,
                      filters: [...groupRef.current.filters || [], ...filters2]
                    });
                  },
                  onClose: () => setPopoverOpen(false)
                }
              )
            }
          )
        ]
      }
    );
  };
  return renderGroup();
};
var lib = {};
var ace$4 = {};
var ace$3 = { exports: {} };
(function(module2, exports2) {
  (function() {
    var ACE_NAMESPACE = "ace";
    var global2 = /* @__PURE__ */ function() {
      return this;
    }();
    if (!global2 && typeof window != "undefined")
      global2 = window;
    var define = function(module3, deps, payload) {
      if (typeof module3 !== "string") {
        if (define.original)
          define.original.apply(this, arguments);
        else {
          console.error("dropping module because define wasn't a string.");
          console.trace();
        }
        return;
      }
      if (arguments.length == 2)
        payload = deps;
      if (!define.modules[module3]) {
        define.payloads[module3] = payload;
        define.modules[module3] = null;
      }
    };
    define.modules = {};
    define.payloads = {};
    var _require = function(parentId, module3, callback2) {
      if (typeof module3 === "string") {
        var payload = lookup(parentId, module3);
        if (payload != void 0) {
          callback2 && callback2();
          return payload;
        }
      } else if (Object.prototype.toString.call(module3) === "[object Array]") {
        var params = [];
        for (var i2 = 0, l2 = module3.length; i2 < l2; ++i2) {
          var dep = lookup(parentId, module3[i2]);
          if (dep == void 0 && require2.original)
            return;
          params.push(dep);
        }
        return callback2 && callback2.apply(null, params) || true;
      }
    };
    var require2 = function(module3, callback2) {
      var packagedModule = _require("", module3, callback2);
      if (packagedModule == void 0 && require2.original)
        return require2.original.apply(this, arguments);
      return packagedModule;
    };
    var normalizeModule = function(parentId, moduleName) {
      if (moduleName.indexOf("!") !== -1) {
        var chunks = moduleName.split("!");
        return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
      }
      if (moduleName.charAt(0) == ".") {
        var base = parentId.split("/").slice(0, -1).join("/");
        moduleName = base + "/" + moduleName;
        while (moduleName.indexOf(".") !== -1 && previous2 != moduleName) {
          var previous2 = moduleName;
          moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
        }
      }
      return moduleName;
    };
    var lookup = function(parentId, moduleName) {
      moduleName = normalizeModule(parentId, moduleName);
      var module3 = define.modules[moduleName];
      if (!module3) {
        module3 = define.payloads[moduleName];
        if (typeof module3 === "function") {
          var exports3 = {};
          var mod2 = {
            id: moduleName,
            uri: "",
            exports: exports3,
            packaged: true
          };
          var req = function(module4, callback2) {
            return _require(moduleName, module4, callback2);
          };
          var returnValue = module3(req, exports3, mod2);
          exports3 = returnValue || mod2.exports;
          define.modules[moduleName] = exports3;
          delete define.payloads[moduleName];
        }
        module3 = define.modules[moduleName] = exports3 || module3;
      }
      return module3;
    };
    function exportAce(ns) {
      var root2 = global2;
      {
        if (!global2[ns])
          global2[ns] = {};
        root2 = global2[ns];
      }
      if (!root2.define || !root2.define.packaged) {
        define.original = root2.define;
        root2.define = define;
        root2.define.packaged = true;
      }
      if (!root2.require || !root2.require.packaged) {
        require2.original = root2.require;
        root2.require = require2;
        root2.require.packaged = true;
      }
    }
    exportAce(ACE_NAMESPACE);
  })();
  ace.define("ace/lib/es6-shim", ["require", "exports", "module"], function(require2, exports3, module3) {
    function defineProp(obj, name2, val) {
      Object.defineProperty(obj, name2, {
        value: val,
        enumerable: false,
        writable: true,
        configurable: true
      });
    }
    if (!String.prototype.startsWith) {
      defineProp(String.prototype, "startsWith", function(searchString, position2) {
        position2 = position2 || 0;
        return this.lastIndexOf(searchString, position2) === position2;
      });
    }
    if (!String.prototype.endsWith) {
      defineProp(String.prototype, "endsWith", function(searchString, position2) {
        var subjectString = this;
        if (position2 === void 0 || position2 > subjectString.length) {
          position2 = subjectString.length;
        }
        position2 -= searchString.length;
        var lastIndex = subjectString.indexOf(searchString, position2);
        return lastIndex !== -1 && lastIndex === position2;
      });
    }
    if (!String.prototype.repeat) {
      defineProp(String.prototype, "repeat", function(count) {
        var result = "";
        var string3 = this;
        while (count > 0) {
          if (count & 1)
            result += string3;
          if (count >>= 1)
            string3 += string3;
        }
        return result;
      });
    }
    if (!String.prototype.includes) {
      defineProp(String.prototype, "includes", function(str, position2) {
        return this.indexOf(str, position2) != -1;
      });
    }
    if (!Object.assign) {
      Object.assign = function(target) {
        if (target === void 0 || target === null) {
          throw new TypeError("Cannot convert undefined or null to object");
        }
        var output2 = Object(target);
        for (var index2 = 1; index2 < arguments.length; index2++) {
          var source2 = arguments[index2];
          if (source2 !== void 0 && source2 !== null) {
            Object.keys(source2).forEach(function(key) {
              output2[key] = source2[key];
            });
          }
        }
        return output2;
      };
    }
    if (!Object.values) {
      Object.values = function(o2) {
        return Object.keys(o2).map(function(k2) {
          return o2[k2];
        });
      };
    }
    if (!Array.prototype.find) {
      defineProp(Array.prototype, "find", function(predicate) {
        var len = this.length;
        var thisArg = arguments[1];
        for (var k2 = 0; k2 < len; k2++) {
          var kValue = this[k2];
          if (predicate.call(thisArg, kValue, k2, this)) {
            return kValue;
          }
        }
      });
    }
    if (!Array.prototype.findIndex) {
      defineProp(Array.prototype, "findIndex", function(predicate) {
        var len = this.length;
        var thisArg = arguments[1];
        for (var k2 = 0; k2 < len; k2++) {
          var kValue = this[k2];
          if (predicate.call(thisArg, kValue, k2, this)) {
            return k2;
          }
        }
      });
    }
    if (!Array.prototype.includes) {
      defineProp(Array.prototype, "includes", function(item, position2) {
        return this.indexOf(item, position2) != -1;
      });
    }
    if (!Array.prototype.fill) {
      defineProp(Array.prototype, "fill", function(value2) {
        var O2 = this;
        var len = O2.length >>> 0;
        var start = arguments[1];
        var relativeStart = start >> 0;
        var k2 = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len);
        var end = arguments[2];
        var relativeEnd = end === void 0 ? len : end >> 0;
        var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len);
        while (k2 < final) {
          O2[k2] = value2;
          k2++;
        }
        return O2;
      });
    }
    if (!Array.of) {
      defineProp(Array, "of", function() {
        return Array.prototype.slice.call(arguments);
      });
    }
  });
  ace.define("ace/lib/fixoldbrowsers", ["require", "exports", "module", "ace/lib/es6-shim"], function(require2, exports3, module3) {
    require2("./es6-shim");
  });
  ace.define("ace/lib/deep_copy", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.deepCopy = function deepCopy(obj) {
      if (typeof obj !== "object" || !obj)
        return obj;
      var copy2;
      if (Array.isArray(obj)) {
        copy2 = [];
        for (var key = 0; key < obj.length; key++) {
          copy2[key] = deepCopy(obj[key]);
        }
        return copy2;
      }
      if (Object.prototype.toString.call(obj) !== "[object Object]")
        return obj;
      copy2 = {};
      for (var key in obj)
        copy2[key] = deepCopy(obj[key]);
      return copy2;
    };
  });
  ace.define("ace/lib/lang", ["require", "exports", "module", "ace/lib/deep_copy"], function(require2, exports3, module3) {
    exports3.last = function(a2) {
      return a2[a2.length - 1];
    };
    exports3.stringReverse = function(string3) {
      return string3.split("").reverse().join("");
    };
    exports3.stringRepeat = function(string3, count) {
      var result = "";
      while (count > 0) {
        if (count & 1)
          result += string3;
        if (count >>= 1)
          string3 += string3;
      }
      return result;
    };
    var trimBeginRegexp = /^\s\s*/;
    var trimEndRegexp = /\s\s*$/;
    exports3.stringTrimLeft = function(string3) {
      return string3.replace(trimBeginRegexp, "");
    };
    exports3.stringTrimRight = function(string3) {
      return string3.replace(trimEndRegexp, "");
    };
    exports3.copyObject = function(obj) {
      var copy2 = {};
      for (var key in obj) {
        copy2[key] = obj[key];
      }
      return copy2;
    };
    exports3.copyArray = function(array4) {
      var copy2 = [];
      for (var i2 = 0, l2 = array4.length; i2 < l2; i2++) {
        if (array4[i2] && typeof array4[i2] == "object")
          copy2[i2] = this.copyObject(array4[i2]);
        else
          copy2[i2] = array4[i2];
      }
      return copy2;
    };
    exports3.deepCopy = require2("./deep_copy").deepCopy;
    exports3.arrayToMap = function(arr) {
      var map2 = {};
      for (var i2 = 0; i2 < arr.length; i2++) {
        map2[arr[i2]] = 1;
      }
      return map2;
    };
    exports3.createMap = function(props) {
      var map2 = /* @__PURE__ */ Object.create(null);
      for (var i2 in props) {
        map2[i2] = props[i2];
      }
      return map2;
    };
    exports3.arrayRemove = function(array4, value2) {
      for (var i2 = 0; i2 <= array4.length; i2++) {
        if (value2 === array4[i2]) {
          array4.splice(i2, 1);
        }
      }
    };
    exports3.escapeRegExp = function(str) {
      return str.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1");
    };
    exports3.escapeHTML = function(str) {
      return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
    };
    exports3.getMatchOffsets = function(string3, regExp) {
      var matches = [];
      string3.replace(regExp, function(str) {
        matches.push({
          offset: arguments[arguments.length - 2],
          length: str.length
        });
      });
      return matches;
    };
    exports3.deferredCall = function(fcn) {
      var timer = null;
      var callback2 = function() {
        timer = null;
        fcn();
      };
      var deferred = function(timeout) {
        deferred.cancel();
        timer = setTimeout(callback2, timeout || 0);
        return deferred;
      };
      deferred.schedule = deferred;
      deferred.call = function() {
        this.cancel();
        fcn();
        return deferred;
      };
      deferred.cancel = function() {
        clearTimeout(timer);
        timer = null;
        return deferred;
      };
      deferred.isPending = function() {
        return timer;
      };
      return deferred;
    };
    exports3.delayedCall = function(fcn, defaultTimeout) {
      var timer = null;
      var callback2 = function() {
        timer = null;
        fcn();
      };
      var _self = function(timeout) {
        if (timer == null)
          timer = setTimeout(callback2, timeout || defaultTimeout);
      };
      _self.delay = function(timeout) {
        timer && clearTimeout(timer);
        timer = setTimeout(callback2, timeout || defaultTimeout);
      };
      _self.schedule = _self;
      _self.call = function() {
        this.cancel();
        fcn();
      };
      _self.cancel = function() {
        timer && clearTimeout(timer);
        timer = null;
      };
      _self.isPending = function() {
        return timer;
      };
      return _self;
    };
    exports3.supportsLookbehind = function() {
      try {
        new RegExp("(?<=.)");
      } catch (e2) {
        return false;
      }
      return true;
    };
    exports3.skipEmptyMatch = function(line2, last, supportsUnicodeFlag) {
      return supportsUnicodeFlag && line2.codePointAt(last) > 65535 ? 2 : 1;
    };
  });
  ace.define("ace/lib/useragent", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.OS = {
      LINUX: "LINUX",
      MAC: "MAC",
      WINDOWS: "WINDOWS"
    };
    exports3.getOS = function() {
      if (exports3.isMac) {
        return exports3.OS.MAC;
      } else if (exports3.isLinux) {
        return exports3.OS.LINUX;
      } else {
        return exports3.OS.WINDOWS;
      }
    };
    var _navigator2 = typeof navigator == "object" ? navigator : {};
    var os = (/mac|win|linux/i.exec(_navigator2.platform) || ["other"])[0].toLowerCase();
    var ua2 = _navigator2.userAgent || "";
    var appName = _navigator2.appName || "";
    exports3.isWin = os == "win";
    exports3.isMac = os == "mac";
    exports3.isLinux = os == "linux";
    exports3.isIE = appName == "Microsoft Internet Explorer" || appName.indexOf("MSAppHost") >= 0 ? parseFloat((ua2.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]) : parseFloat((ua2.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]);
    exports3.isOldIE = exports3.isIE && exports3.isIE < 9;
    exports3.isGecko = exports3.isMozilla = ua2.match(/ Gecko\/\d+/);
    exports3.isOpera = typeof opera == "object" && Object.prototype.toString.call(window["opera"]) == "[object Opera]";
    exports3.isWebKit = parseFloat(ua2.split("WebKit/")[1]) || void 0;
    exports3.isChrome = parseFloat(ua2.split(" Chrome/")[1]) || void 0;
    exports3.isSafari = parseFloat(ua2.split(" Safari/")[1]) && !exports3.isChrome || void 0;
    exports3.isEdge = parseFloat(ua2.split(" Edge/")[1]) || void 0;
    exports3.isAIR = ua2.indexOf("AdobeAIR") >= 0;
    exports3.isAndroid = ua2.indexOf("Android") >= 0;
    exports3.isChromeOS = ua2.indexOf(" CrOS ") >= 0;
    exports3.isIOS = /iPad|iPhone|iPod/.test(ua2) && !window["MSStream"];
    if (exports3.isIOS)
      exports3.isMac = true;
    exports3.isMobile = exports3.isIOS || exports3.isAndroid;
  });
  ace.define("ace/lib/dom", ["require", "exports", "module", "ace/lib/useragent"], function(require2, exports3, module3) {
    var useragent = require2("./useragent");
    var XHTML_NS = "http://www.w3.org/1999/xhtml";
    exports3.buildDom = function buildDom(arr, parent, refs) {
      if (typeof arr == "string" && arr) {
        var txt = document.createTextNode(arr);
        if (parent)
          parent.appendChild(txt);
        return txt;
      }
      if (!Array.isArray(arr)) {
        if (arr && arr.appendChild && parent)
          parent.appendChild(arr);
        return arr;
      }
      if (typeof arr[0] != "string" || !arr[0]) {
        var els = [];
        for (var i2 = 0; i2 < arr.length; i2++) {
          var ch2 = buildDom(arr[i2], parent, refs);
          ch2 && els.push(ch2);
        }
        return els;
      }
      var el2 = document.createElement(arr[0]);
      var options = arr[1];
      var childIndex = 1;
      if (options && typeof options == "object" && !Array.isArray(options))
        childIndex = 2;
      for (var i2 = childIndex; i2 < arr.length; i2++)
        buildDom(arr[i2], el2, refs);
      if (childIndex == 2) {
        Object.keys(options).forEach(function(n2) {
          var val = options[n2];
          if (n2 === "class") {
            el2.className = Array.isArray(val) ? val.join(" ") : val;
          } else if (typeof val == "function" || n2 == "value" || n2[0] == "$") {
            el2[n2] = val;
          } else if (n2 === "ref") {
            if (refs)
              refs[val] = el2;
          } else if (n2 === "style") {
            if (typeof val == "string")
              el2.style.cssText = val;
          } else if (val != null) {
            el2.setAttribute(n2, val);
          }
        });
      }
      if (parent)
        parent.appendChild(el2);
      return el2;
    };
    exports3.getDocumentHead = function(doc) {
      if (!doc)
        doc = document;
      return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
    };
    exports3.createElement = function(tag, ns) {
      return document.createElementNS ? document.createElementNS(ns || XHTML_NS, tag) : document.createElement(tag);
    };
    exports3.removeChildren = function(element2) {
      element2.innerHTML = "";
    };
    exports3.createTextNode = function(textContent, element2) {
      var doc = element2 ? element2.ownerDocument : document;
      return doc.createTextNode(textContent);
    };
    exports3.createFragment = function(element2) {
      var doc = element2 ? element2.ownerDocument : document;
      return doc.createDocumentFragment();
    };
    exports3.hasCssClass = function(el2, name2) {
      var classes = (el2.className + "").split(/\s+/g);
      return classes.indexOf(name2) !== -1;
    };
    exports3.addCssClass = function(el2, name2) {
      if (!exports3.hasCssClass(el2, name2)) {
        el2.className += " " + name2;
      }
    };
    exports3.removeCssClass = function(el2, name2) {
      var classes = el2.className.split(/\s+/g);
      while (true) {
        var index2 = classes.indexOf(name2);
        if (index2 == -1) {
          break;
        }
        classes.splice(index2, 1);
      }
      el2.className = classes.join(" ");
    };
    exports3.toggleCssClass = function(el2, name2) {
      var classes = el2.className.split(/\s+/g), add2 = true;
      while (true) {
        var index2 = classes.indexOf(name2);
        if (index2 == -1) {
          break;
        }
        add2 = false;
        classes.splice(index2, 1);
      }
      if (add2)
        classes.push(name2);
      el2.className = classes.join(" ");
      return add2;
    };
    exports3.setCssClass = function(node2, className, include) {
      if (include) {
        exports3.addCssClass(node2, className);
      } else {
        exports3.removeCssClass(node2, className);
      }
    };
    exports3.hasCssString = function(id2, doc) {
      var index2 = 0, sheets;
      doc = doc || document;
      if (sheets = doc.querySelectorAll("style")) {
        while (index2 < sheets.length) {
          if (sheets[index2++].id === id2) {
            return true;
          }
        }
      }
    };
    exports3.removeElementById = function(id2, doc) {
      doc = doc || document;
      if (doc.getElementById(id2)) {
        doc.getElementById(id2).remove();
      }
    };
    var strictCSP;
    var cssCache = [];
    exports3.useStrictCSP = function(value2) {
      strictCSP = value2;
      if (value2 == false)
        insertPendingStyles();
      else if (!cssCache)
        cssCache = [];
    };
    function insertPendingStyles() {
      var cache2 = cssCache;
      cssCache = null;
      cache2 && cache2.forEach(function(item) {
        importCssString(item[0], item[1]);
      });
    }
    function importCssString(cssText, id2, target) {
      if (typeof document == "undefined")
        return;
      if (cssCache) {
        if (target) {
          insertPendingStyles();
        } else if (target === false) {
          return cssCache.push([cssText, id2]);
        }
      }
      if (strictCSP)
        return;
      var container = target;
      if (!target || !target.getRootNode) {
        container = document;
      } else {
        container = target.getRootNode();
        if (!container || container == target)
          container = document;
      }
      var doc = container.ownerDocument || container;
      if (id2 && exports3.hasCssString(id2, container))
        return null;
      if (id2)
        cssText += "\n/*# sourceURL=ace/css/" + id2 + " */";
      var style2 = exports3.createElement("style");
      style2.appendChild(doc.createTextNode(cssText));
      if (id2)
        style2.id = id2;
      if (container == doc)
        container = exports3.getDocumentHead(doc);
      container.insertBefore(style2, container.firstChild);
    }
    exports3.importCssString = importCssString;
    exports3.importCssStylsheet = function(uri, doc) {
      exports3.buildDom(["link", { rel: "stylesheet", href: uri }], exports3.getDocumentHead(doc));
    };
    exports3.scrollbarWidth = function(doc) {
      var inner = exports3.createElement("ace_inner");
      inner.style.width = "100%";
      inner.style.minWidth = "0px";
      inner.style.height = "200px";
      inner.style.display = "block";
      var outer = exports3.createElement("ace_outer");
      var style2 = outer.style;
      style2.position = "absolute";
      style2.left = "-10000px";
      style2.overflow = "hidden";
      style2.width = "200px";
      style2.minWidth = "0px";
      style2.height = "150px";
      style2.display = "block";
      outer.appendChild(inner);
      var body = doc && doc.documentElement || document && document.documentElement;
      if (!body)
        return 0;
      body.appendChild(outer);
      var noScrollbar = inner.offsetWidth;
      style2.overflow = "scroll";
      var withScrollbar = inner.offsetWidth;
      if (noScrollbar === withScrollbar) {
        withScrollbar = outer.clientWidth;
      }
      body.removeChild(outer);
      return noScrollbar - withScrollbar;
    };
    exports3.computedStyle = function(element2, style2) {
      return window.getComputedStyle(element2, "") || {};
    };
    exports3.setStyle = function(styles2, property2, value2) {
      if (styles2[property2] !== value2) {
        styles2[property2] = value2;
      }
    };
    exports3.HAS_CSS_ANIMATION = false;
    exports3.HAS_CSS_TRANSFORMS = false;
    exports3.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true;
    if (useragent.isChromeOS)
      exports3.HI_DPI = false;
    if (typeof document !== "undefined") {
      var div = document.createElement("div");
      if (exports3.HI_DPI && div.style.transform !== void 0)
        exports3.HAS_CSS_TRANSFORMS = true;
      if (!useragent.isEdge && typeof div.style.animationName !== "undefined")
        exports3.HAS_CSS_ANIMATION = true;
      div = null;
    }
    if (exports3.HAS_CSS_TRANSFORMS) {
      exports3.translate = function(element2, tx, ty) {
        element2.style.transform = "translate(" + Math.round(tx) + "px, " + Math.round(ty) + "px)";
      };
    } else {
      exports3.translate = function(element2, tx, ty) {
        element2.style.top = Math.round(ty) + "px";
        element2.style.left = Math.round(tx) + "px";
      };
    }
  });
  ace.define("ace/lib/net", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    /*
    * based on code from:
    *
    * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
    * Available via the MIT or new BSD license.
    * see: http://github.com/jrburke/requirejs for details
    */
    var dom = require2("./dom");
    exports3.get = function(url2, callback2) {
      var xhr = new XMLHttpRequest();
      xhr.open("GET", url2, true);
      xhr.onreadystatechange = function() {
        if (xhr.readyState === 4) {
          callback2(xhr.responseText);
        }
      };
      xhr.send(null);
    };
    exports3.loadScript = function(path, callback2) {
      var head = dom.getDocumentHead();
      var s2 = document.createElement("script");
      s2.src = path;
      head.appendChild(s2);
      s2.onload = s2.onreadystatechange = function(_24, isAbort) {
        if (isAbort || !s2.readyState || s2.readyState == "loaded" || s2.readyState == "complete") {
          s2 = s2.onload = s2.onreadystatechange = null;
          if (!isAbort)
            callback2();
        }
      };
    };
    exports3.qualifyURL = function(url2) {
      var a2 = document.createElement("a");
      a2.href = url2;
      return a2.href;
    };
  });
  ace.define("ace/lib/oop", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.inherits = function(ctor, superCtor) {
      ctor.super_ = superCtor;
      ctor.prototype = Object.create(superCtor.prototype, {
        constructor: {
          value: ctor,
          enumerable: false,
          writable: true,
          configurable: true
        }
      });
    };
    exports3.mixin = function(obj, mixin) {
      for (var key in mixin) {
        obj[key] = mixin[key];
      }
      return obj;
    };
    exports3.implement = function(proto2, mixin) {
      exports3.mixin(proto2, mixin);
    };
  });
  ace.define("ace/lib/event_emitter", ["require", "exports", "module"], function(require2, exports3, module3) {
    var EventEmitter2 = {};
    var stopPropagation2 = function() {
      this.propagationStopped = true;
    };
    var preventDefault2 = function() {
      this.defaultPrevented = true;
    };
    EventEmitter2._emit = EventEmitter2._dispatchEvent = function(eventName, e2) {
      this._eventRegistry || (this._eventRegistry = {});
      this._defaultHandlers || (this._defaultHandlers = {});
      var listeners = this._eventRegistry[eventName] || [];
      var defaultHandler = this._defaultHandlers[eventName];
      if (!listeners.length && !defaultHandler)
        return;
      if (typeof e2 != "object" || !e2)
        e2 = {};
      if (!e2.type)
        e2.type = eventName;
      if (!e2.stopPropagation)
        e2.stopPropagation = stopPropagation2;
      if (!e2.preventDefault)
        e2.preventDefault = preventDefault2;
      listeners = listeners.slice();
      for (var i2 = 0; i2 < listeners.length; i2++) {
        listeners[i2](e2, this);
        if (e2.propagationStopped)
          break;
      }
      if (defaultHandler && !e2.defaultPrevented)
        return defaultHandler(e2, this);
    };
    EventEmitter2._signal = function(eventName, e2) {
      var listeners = (this._eventRegistry || {})[eventName];
      if (!listeners)
        return;
      listeners = listeners.slice();
      for (var i2 = 0; i2 < listeners.length; i2++)
        listeners[i2](e2, this);
    };
    EventEmitter2.once = function(eventName, callback2) {
      var _self = this;
      this.on(eventName, function newCallback() {
        _self.off(eventName, newCallback);
        callback2.apply(null, arguments);
      });
      if (!callback2) {
        return new Promise(function(resolve2) {
          callback2 = resolve2;
        });
      }
    };
    EventEmitter2.setDefaultHandler = function(eventName, callback2) {
      var handlers2 = this._defaultHandlers;
      if (!handlers2)
        handlers2 = this._defaultHandlers = { _disabled_: {} };
      if (handlers2[eventName]) {
        var old = handlers2[eventName];
        var disabled = handlers2._disabled_[eventName];
        if (!disabled)
          handlers2._disabled_[eventName] = disabled = [];
        disabled.push(old);
        var i2 = disabled.indexOf(callback2);
        if (i2 != -1)
          disabled.splice(i2, 1);
      }
      handlers2[eventName] = callback2;
    };
    EventEmitter2.removeDefaultHandler = function(eventName, callback2) {
      var handlers2 = this._defaultHandlers;
      if (!handlers2)
        return;
      var disabled = handlers2._disabled_[eventName];
      if (handlers2[eventName] == callback2) {
        if (disabled)
          this.setDefaultHandler(eventName, disabled.pop());
      } else if (disabled) {
        var i2 = disabled.indexOf(callback2);
        if (i2 != -1)
          disabled.splice(i2, 1);
      }
    };
    EventEmitter2.on = EventEmitter2.addEventListener = function(eventName, callback2, capturing) {
      this._eventRegistry = this._eventRegistry || {};
      var listeners = this._eventRegistry[eventName];
      if (!listeners)
        listeners = this._eventRegistry[eventName] = [];
      if (listeners.indexOf(callback2) == -1)
        listeners[capturing ? "unshift" : "push"](callback2);
      return callback2;
    };
    EventEmitter2.off = EventEmitter2.removeListener = EventEmitter2.removeEventListener = function(eventName, callback2) {
      this._eventRegistry = this._eventRegistry || {};
      var listeners = this._eventRegistry[eventName];
      if (!listeners)
        return;
      var index2 = listeners.indexOf(callback2);
      if (index2 !== -1)
        listeners.splice(index2, 1);
    };
    EventEmitter2.removeAllListeners = function(eventName) {
      if (!eventName)
        this._eventRegistry = this._defaultHandlers = void 0;
      if (this._eventRegistry)
        this._eventRegistry[eventName] = void 0;
      if (this._defaultHandlers)
        this._defaultHandlers[eventName] = void 0;
    };
    exports3.EventEmitter = EventEmitter2;
  });
  ace.define("ace/lib/report_error", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.reportError = function reportError2(msg, data) {
      var e2 = new Error(msg);
      e2["data"] = data;
      if (typeof console == "object" && console.error)
        console.error(e2);
      setTimeout(function() {
        throw e2;
      });
    };
  });
  ace.define("ace/lib/default_english_messages", ["require", "exports", "module"], function(require2, exports3, module3) {
    var defaultEnglishMessages = {
      "autocomplete.popup.aria-roledescription": "Autocomplete suggestions",
      "autocomplete.popup.aria-label": "Autocomplete suggestions",
      "autocomplete.popup.item.aria-roledescription": "item",
      "autocomplete.loading": "Loading...",
      "editor.scroller.aria-roledescription": "editor",
      "editor.scroller.aria-label": "Editor content, press Enter to start editing, press Escape to exit",
      "editor.gutter.aria-roledescription": "editor gutter",
      "editor.gutter.aria-label": "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit",
      "error-marker.good-state": "Looks good!",
      "prompt.recently-used": "Recently used",
      "prompt.other-commands": "Other commands",
      "prompt.no-matching-commands": "No matching commands",
      "search-box.find.placeholder": "Search for",
      "search-box.find-all.text": "All",
      "search-box.replace.placeholder": "Replace with",
      "search-box.replace-next.text": "Replace",
      "search-box.replace-all.text": "All",
      "search-box.toggle-replace.title": "Toggle Replace mode",
      "search-box.toggle-regexp.title": "RegExp Search",
      "search-box.toggle-case.title": "CaseSensitive Search",
      "search-box.toggle-whole-word.title": "Whole Word Search",
      "search-box.toggle-in-selection.title": "Search In Selection",
      "search-box.search-counter": "$0 of $1",
      "text-input.aria-roledescription": "editor",
      "text-input.aria-label": "Cursor at row $0",
      "gutter.code-folding.range.aria-label": "Toggle code folding, rows $0 through $1",
      "gutter.code-folding.closed.aria-label": "Toggle code folding, rows $0 through $1",
      "gutter.code-folding.open.aria-label": "Toggle code folding, row $0",
      "gutter.code-folding.closed.title": "Unfold code",
      "gutter.code-folding.open.title": "Fold code",
      "gutter.annotation.aria-label.error": "Error, read annotations row $0",
      "gutter.annotation.aria-label.warning": "Warning, read annotations row $0",
      "gutter.annotation.aria-label.info": "Info, read annotations row $0",
      "inline-fold.closed.title": "Unfold code",
      "gutter-tooltip.aria-label.error.singular": "error",
      "gutter-tooltip.aria-label.error.plural": "errors",
      "gutter-tooltip.aria-label.warning.singular": "warning",
      "gutter-tooltip.aria-label.warning.plural": "warnings",
      "gutter-tooltip.aria-label.info.singular": "information message",
      "gutter-tooltip.aria-label.info.plural": "information messages",
      "gutter.annotation.aria-label.security": "Security finding, read annotations row $0",
      "gutter.annotation.aria-label.hint": "Suggestion, read annotations row $0",
      "gutter-tooltip.aria-label.security.singular": "security finding",
      "gutter-tooltip.aria-label.security.plural": "security findings",
      "gutter-tooltip.aria-label.hint.singular": "suggestion",
      "gutter-tooltip.aria-label.hint.plural": "suggestions",
      "editor.tooltip.disable-editing": "Editing is disabled"
    };
    exports3.defaultEnglishMessages = defaultEnglishMessages;
  });
  ace.define("ace/lib/app_config", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter", "ace/lib/report_error", "ace/lib/default_english_messages"], function(require2, exports3, module3) {
    "no use strict";
    var oop = require2("./oop");
    var EventEmitter2 = require2("./event_emitter").EventEmitter;
    var reportError2 = require2("./report_error").reportError;
    var defaultEnglishMessages = require2("./default_english_messages").defaultEnglishMessages;
    var optionsProvider = {
      setOptions: function(optList) {
        Object.keys(optList).forEach(function(key) {
          this.setOption(key, optList[key]);
        }, this);
      },
      getOptions: function(optionNames) {
        var result = {};
        if (!optionNames) {
          var options = this.$options;
          optionNames = Object.keys(options).filter(function(key) {
            return !options[key].hidden;
          });
        } else if (!Array.isArray(optionNames)) {
          optionNames = Object.keys(optionNames);
        }
        optionNames.forEach(function(key) {
          result[key] = this.getOption(key);
        }, this);
        return result;
      },
      setOption: function(name2, value2) {
        if (this["$" + name2] === value2)
          return;
        var opt = this.$options[name2];
        if (!opt) {
          return warn3('misspelled option "' + name2 + '"');
        }
        if (opt.forwardTo)
          return this[opt.forwardTo] && this[opt.forwardTo].setOption(name2, value2);
        if (!opt.handlesSet)
          this["$" + name2] = value2;
        if (opt && opt.set)
          opt.set.call(this, value2);
      },
      getOption: function(name2) {
        var opt = this.$options[name2];
        if (!opt) {
          return warn3('misspelled option "' + name2 + '"');
        }
        if (opt.forwardTo)
          return this[opt.forwardTo] && this[opt.forwardTo].getOption(name2);
        return opt && opt.get ? opt.get.call(this) : this["$" + name2];
      }
    };
    function warn3(message) {
      if (typeof console != "undefined" && console.warn)
        console.warn.apply(console, arguments);
    }
    var messages2;
    var nlsPlaceholders;
    var AppConfig = (
      /** @class */
      function() {
        function AppConfig2() {
          this.$defaultOptions = {};
          messages2 = defaultEnglishMessages;
          nlsPlaceholders = "dollarSigns";
        }
        AppConfig2.prototype.defineOptions = function(obj, path, options) {
          if (!obj.$options)
            this.$defaultOptions[path] = obj.$options = {};
          Object.keys(options).forEach(function(key) {
            var opt = options[key];
            if (typeof opt == "string")
              opt = { forwardTo: opt };
            opt.name || (opt.name = key);
            obj.$options[opt.name] = opt;
            if ("initialValue" in opt)
              obj["$" + opt.name] = opt.initialValue;
          });
          oop.implement(obj, optionsProvider);
          return this;
        };
        AppConfig2.prototype.resetOptions = function(obj) {
          Object.keys(obj.$options).forEach(function(key) {
            var opt = obj.$options[key];
            if ("value" in opt)
              obj.setOption(key, opt.value);
          });
        };
        AppConfig2.prototype.setDefaultValue = function(path, name2, value2) {
          if (!path) {
            for (path in this.$defaultOptions)
              if (this.$defaultOptions[path][name2])
                break;
            if (!this.$defaultOptions[path][name2])
              return false;
          }
          var opts2 = this.$defaultOptions[path] || (this.$defaultOptions[path] = {});
          if (opts2[name2]) {
            if (opts2.forwardTo)
              this.setDefaultValue(opts2.forwardTo, name2, value2);
            else
              opts2[name2].value = value2;
          }
        };
        AppConfig2.prototype.setDefaultValues = function(path, optionHash) {
          Object.keys(optionHash).forEach(function(key) {
            this.setDefaultValue(path, key, optionHash[key]);
          }, this);
        };
        AppConfig2.prototype.setMessages = function(value2, options) {
          messages2 = value2;
          if (options && options.placeholders) {
            nlsPlaceholders = options.placeholders;
          }
        };
        AppConfig2.prototype.nls = function(key, defaultString, params) {
          if (!messages2[key]) {
            warn3("No message found for the key '" + key + "' in messages with id " + messages2.$id + ", trying to find a translation for the default string '" + defaultString + "'.");
            if (!messages2[defaultString]) {
              warn3("No message found for the default string '" + defaultString + "' in the provided messages. Falling back to the default English message.");
            }
          }
          var translated = messages2[key] || messages2[defaultString] || defaultString;
          if (params) {
            if (nlsPlaceholders === "dollarSigns") {
              translated = translated.replace(/\$(\$|[\d]+)/g, function(_24, dollarMatch) {
                if (dollarMatch == "$")
                  return "$";
                return params[dollarMatch];
              });
            }
            if (nlsPlaceholders === "curlyBrackets") {
              translated = translated.replace(/\{([^\}]+)\}/g, function(_24, curlyBracketMatch) {
                return params[curlyBracketMatch];
              });
            }
          }
          return translated;
        };
        return AppConfig2;
      }()
    );
    AppConfig.prototype.warn = warn3;
    AppConfig.prototype.reportError = reportError2;
    oop.implement(AppConfig.prototype, EventEmitter2);
    exports3.AppConfig = AppConfig;
  });
  ace.define("ace/theme/textmate-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = '.ace-tm .ace_gutter {\n  background: #f0f0f0;\n  color: #333;\n}\n\n.ace-tm .ace_print-margin {\n  width: 1px;\n  background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n    background-color: #6B72E6;\n}\n\n.ace-tm {\n  background-color: #FFFFFF;\n  color: black;\n}\n\n.ace-tm .ace_cursor {\n  color: black;\n}\n        \n.ace-tm .ace_invisible {\n  color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n  color: blue;\n}\n\n.ace-tm .ace_constant {\n  color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n  color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n  color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n  color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n  background-color: rgba(255, 0, 0, 0.1);\n  color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n  color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n  color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n  color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n  color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n  color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n  color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n  color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n  color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n  color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n  color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n  color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n  color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n  color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n  color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n  color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n  color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n  background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n  box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n  background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n  background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n  margin: -1px 0 0 -1px;\n  border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n  background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n    background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n  background: rgb(250, 250, 255);\n  border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n  background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n';
  });
  ace.define("ace/theme/textmate", ["require", "exports", "module", "ace/theme/textmate-css", "ace/lib/dom"], function(require2, exports3, module3) {
    exports3.isDark = false;
    exports3.cssClass = "ace-tm";
    exports3.cssText = require2("./textmate-css");
    exports3.$id = "ace/theme/textmate";
    var dom = require2("../lib/dom");
    dom.importCssString(exports3.cssText, exports3.cssClass, false);
  });
  ace.define("ace/config", ["require", "exports", "module", "ace/lib/lang", "ace/lib/net", "ace/lib/dom", "ace/lib/app_config", "ace/theme/textmate"], function(require2, exports3, module3) {
    "no use strict";
    var lang2 = require2("./lib/lang");
    var net = require2("./lib/net");
    var dom = require2("./lib/dom");
    var AppConfig = require2("./lib/app_config").AppConfig;
    module3.exports = exports3 = new AppConfig();
    var options = {
      packaged: false,
      workerPath: null,
      modePath: null,
      themePath: null,
      basePath: "",
      suffix: ".js",
      $moduleUrls: {},
      loadWorkerFromBlob: true,
      sharedPopups: false,
      useStrictCSP: null
    };
    exports3.get = function(key) {
      if (!options.hasOwnProperty(key))
        throw new Error("Unknown config key: " + key);
      return options[key];
    };
    exports3.set = function(key, value2) {
      if (options.hasOwnProperty(key))
        options[key] = value2;
      else if (this.setDefaultValue("", key, value2) == false)
        throw new Error("Unknown config key: " + key);
      if (key == "useStrictCSP")
        dom.useStrictCSP(value2);
    };
    exports3.all = function() {
      return lang2.copyObject(options);
    };
    exports3.$modes = {};
    exports3.moduleUrl = function(name2, component) {
      if (options.$moduleUrls[name2])
        return options.$moduleUrls[name2];
      var parts = name2.split("/");
      component = component || parts[parts.length - 2] || "";
      var sep = component == "snippets" ? "/" : "-";
      var base = parts[parts.length - 1];
      if (component == "worker" && sep == "-") {
        var re2 = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
        base = base.replace(re2, "");
      }
      if ((!base || base == component) && parts.length > 1)
        base = parts[parts.length - 2];
      var path = options[component + "Path"];
      if (path == null) {
        path = options.basePath;
      } else if (sep == "/") {
        component = sep = "";
      }
      if (path && path.slice(-1) != "/")
        path += "/";
      return path + component + sep + base + this.get("suffix");
    };
    exports3.setModuleUrl = function(name2, subst) {
      return options.$moduleUrls[name2] = subst;
    };
    var loader = function(moduleName, cb2) {
      if (moduleName === "ace/theme/textmate" || moduleName === "./theme/textmate")
        return cb2(null, require2("./theme/textmate"));
      if (customLoader)
        return customLoader(moduleName, cb2);
      console.error("loader is not configured");
    };
    var customLoader;
    exports3.setLoader = function(cb2) {
      customLoader = cb2;
    };
    exports3.dynamicModules = /* @__PURE__ */ Object.create(null);
    exports3.$loading = {};
    exports3.$loaded = {};
    exports3.loadModule = function(moduleId, onLoad) {
      var loadedModule;
      if (Array.isArray(moduleId)) {
        var moduleType = moduleId[0];
        var moduleName = moduleId[1];
      } else if (typeof moduleId == "string") {
        var moduleName = moduleId;
      }
      var load = function(module4) {
        if (module4 && !exports3.$loading[moduleName])
          return onLoad && onLoad(module4);
        if (!exports3.$loading[moduleName])
          exports3.$loading[moduleName] = [];
        exports3.$loading[moduleName].push(onLoad);
        if (exports3.$loading[moduleName].length > 1)
          return;
        var afterLoad = function() {
          loader(moduleName, function(err, module5) {
            if (module5)
              exports3.$loaded[moduleName] = module5;
            exports3._emit("load.module", { name: moduleName, module: module5 });
            var listeners = exports3.$loading[moduleName];
            exports3.$loading[moduleName] = null;
            listeners.forEach(function(onLoad2) {
              onLoad2 && onLoad2(module5);
            });
          });
        };
        if (!exports3.get("packaged"))
          return afterLoad();
        net.loadScript(exports3.moduleUrl(moduleName, moduleType), afterLoad);
        reportErrorIfPathIsNotConfigured();
      };
      if (exports3.dynamicModules[moduleName]) {
        exports3.dynamicModules[moduleName]().then(function(module4) {
          if (module4.default) {
            load(module4.default);
          } else {
            load(module4);
          }
        });
      } else {
        try {
          loadedModule = this.$require(moduleName);
        } catch (e2) {
        }
        load(loadedModule || exports3.$loaded[moduleName]);
      }
    };
    exports3.$require = function(moduleName) {
      if (typeof module3["require"] == "function") {
        var req = "require";
        return module3[req](moduleName);
      }
    };
    exports3.setModuleLoader = function(moduleName, onLoad) {
      exports3.dynamicModules[moduleName] = onLoad;
    };
    var reportErrorIfPathIsNotConfigured = function() {
      if (!options.basePath && !options.workerPath && !options.modePath && !options.themePath && !Object.keys(options.$moduleUrls).length) {
        console.error("Unable to infer path to ace from script src,", "use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes", "or with webpack use ace/webpack-resolver");
        reportErrorIfPathIsNotConfigured = function() {
        };
      }
    };
    exports3.version = "1.43.2";
  });
  ace.define("ace/loader_build", ["require", "exports", "module", "ace/lib/fixoldbrowsers", "ace/config"], function(require2, exports3, module3) {
    require2("./lib/fixoldbrowsers");
    var config2 = require2("./config");
    config2.setLoader(function(moduleName, cb2) {
      require2([moduleName], function(module4) {
        cb2(null, module4);
      });
    });
    var global2 = /* @__PURE__ */ function() {
      return this || typeof window != "undefined" && window;
    }();
    module3.exports = function(ace2) {
      config2.init = init2;
      config2.$require = require2;
      ace2.require = require2;
    };
    init2(true);
    function init2(packaged) {
      if (!global2 || !global2.document)
        return;
      config2.set("packaged", packaged || require2.packaged || module3.packaged || global2.define && (void 0).packaged);
      var scriptOptions = {};
      var scriptUrl = "";
      var currentScript = document.currentScript || document._currentScript;
      var currentDocument = currentScript && currentScript.ownerDocument || document;
      if (currentScript && currentScript.src) {
        scriptUrl = currentScript.src.split(/[?#]/)[0].split("/").slice(0, -1).join("/") || "";
      }
      var scripts = currentDocument.getElementsByTagName("script");
      for (var i2 = 0; i2 < scripts.length; i2++) {
        var script = scripts[i2];
        var src = script.src || script.getAttribute("src");
        if (!src)
          continue;
        var attributes2 = script.attributes;
        for (var j2 = 0, l2 = attributes2.length; j2 < l2; j2++) {
          var attr = attributes2[j2];
          if (attr.name.indexOf("data-ace-") === 0) {
            scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
          }
        }
        var m2 = src.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);
        if (m2)
          scriptUrl = m2[1];
      }
      if (scriptUrl) {
        scriptOptions.base = scriptOptions.base || scriptUrl;
        scriptOptions.packaged = true;
      }
      scriptOptions.basePath = scriptOptions.base;
      scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
      scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
      scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
      delete scriptOptions.base;
      for (var key in scriptOptions)
        if (typeof scriptOptions[key] !== "undefined")
          config2.set(key, scriptOptions[key]);
    }
    function deHyphenate(str) {
      return str.replace(/-(.)/g, function(m2, m1) {
        return m1.toUpperCase();
      });
    }
  });
  ace.define("ace/range", ["require", "exports", "module"], function(require2, exports3, module3) {
    var Range = (
      /** @class */
      function() {
        function Range2(startRow, startColumn, endRow, endColumn) {
          this.start = {
            row: startRow,
            column: startColumn
          };
          this.end = {
            row: endRow,
            column: endColumn
          };
        }
        Range2.prototype.isEqual = function(range3) {
          return this.start.row === range3.start.row && this.end.row === range3.end.row && this.start.column === range3.start.column && this.end.column === range3.end.column;
        };
        Range2.prototype.toString = function() {
          return "Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]";
        };
        Range2.prototype.contains = function(row, column2) {
          return this.compare(row, column2) == 0;
        };
        Range2.prototype.compareRange = function(range3) {
          var cmp, end = range3.end, start = range3.start;
          cmp = this.compare(end.row, end.column);
          if (cmp == 1) {
            cmp = this.compare(start.row, start.column);
            if (cmp == 1) {
              return 2;
            } else if (cmp == 0) {
              return 1;
            } else {
              return 0;
            }
          } else if (cmp == -1) {
            return -2;
          } else {
            cmp = this.compare(start.row, start.column);
            if (cmp == -1) {
              return -1;
            } else if (cmp == 1) {
              return 42;
            } else {
              return 0;
            }
          }
        };
        Range2.prototype.comparePoint = function(p2) {
          return this.compare(p2.row, p2.column);
        };
        Range2.prototype.containsRange = function(range3) {
          return this.comparePoint(range3.start) == 0 && this.comparePoint(range3.end) == 0;
        };
        Range2.prototype.intersects = function(range3) {
          var cmp = this.compareRange(range3);
          return cmp == -1 || cmp == 0 || cmp == 1;
        };
        Range2.prototype.isEnd = function(row, column2) {
          return this.end.row == row && this.end.column == column2;
        };
        Range2.prototype.isStart = function(row, column2) {
          return this.start.row == row && this.start.column == column2;
        };
        Range2.prototype.setStart = function(row, column2) {
          if (typeof row == "object") {
            this.start.column = row.column;
            this.start.row = row.row;
          } else {
            this.start.row = row;
            this.start.column = column2;
          }
        };
        Range2.prototype.setEnd = function(row, column2) {
          if (typeof row == "object") {
            this.end.column = row.column;
            this.end.row = row.row;
          } else {
            this.end.row = row;
            this.end.column = column2;
          }
        };
        Range2.prototype.inside = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isEnd(row, column2) || this.isStart(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range2.prototype.insideStart = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isEnd(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range2.prototype.insideEnd = function(row, column2) {
          if (this.compare(row, column2) == 0) {
            if (this.isStart(row, column2)) {
              return false;
            } else {
              return true;
            }
          }
          return false;
        };
        Range2.prototype.compare = function(row, column2) {
          if (!this.isMultiLine()) {
            if (row === this.start.row) {
              return column2 < this.start.column ? -1 : column2 > this.end.column ? 1 : 0;
            }
          }
          if (row < this.start.row)
            return -1;
          if (row > this.end.row)
            return 1;
          if (this.start.row === row)
            return column2 >= this.start.column ? 0 : -1;
          if (this.end.row === row)
            return column2 <= this.end.column ? 0 : 1;
          return 0;
        };
        Range2.prototype.compareStart = function(row, column2) {
          if (this.start.row == row && this.start.column == column2) {
            return -1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range2.prototype.compareEnd = function(row, column2) {
          if (this.end.row == row && this.end.column == column2) {
            return 1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range2.prototype.compareInside = function(row, column2) {
          if (this.end.row == row && this.end.column == column2) {
            return 1;
          } else if (this.start.row == row && this.start.column == column2) {
            return -1;
          } else {
            return this.compare(row, column2);
          }
        };
        Range2.prototype.clipRows = function(firstRow, lastRow) {
          if (this.end.row > lastRow)
            var end = { row: lastRow + 1, column: 0 };
          else if (this.end.row < firstRow)
            var end = { row: firstRow, column: 0 };
          if (this.start.row > lastRow)
            var start = { row: lastRow + 1, column: 0 };
          else if (this.start.row < firstRow)
            var start = { row: firstRow, column: 0 };
          return Range2.fromPoints(start || this.start, end || this.end);
        };
        Range2.prototype.extend = function(row, column2) {
          var cmp = this.compare(row, column2);
          if (cmp == 0)
            return this;
          else if (cmp == -1)
            var start = { row, column: column2 };
          else
            var end = { row, column: column2 };
          return Range2.fromPoints(start || this.start, end || this.end);
        };
        Range2.prototype.isEmpty = function() {
          return this.start.row === this.end.row && this.start.column === this.end.column;
        };
        Range2.prototype.isMultiLine = function() {
          return this.start.row !== this.end.row;
        };
        Range2.prototype.clone = function() {
          return Range2.fromPoints(this.start, this.end);
        };
        Range2.prototype.collapseRows = function() {
          if (this.end.column == 0)
            return new Range2(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0);
          else
            return new Range2(this.start.row, 0, this.end.row, 0);
        };
        Range2.prototype.toScreenRange = function(session) {
          var screenPosStart = session.documentToScreenPosition(this.start);
          var screenPosEnd = session.documentToScreenPosition(this.end);
          return new Range2(screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column);
        };
        Range2.prototype.moveBy = function(row, column2) {
          this.start.row += row;
          this.start.column += column2;
          this.end.row += row;
          this.end.column += column2;
        };
        return Range2;
      }()
    );
    Range.fromPoints = function(start, end) {
      return new Range(start.row, start.column, end.row, end.column);
    };
    Range.comparePoints = function(p1, p2) {
      return p1.row - p2.row || p1.column - p2.column;
    };
    exports3.Range = Range;
  });
  ace.define("ace/lib/keys", ["require", "exports", "module", "ace/lib/oop"], function(require2, exports3, module3) {
    var oop = require2("./oop");
    var Keys2 = {
      MODIFIER_KEYS: {
        16: "Shift",
        17: "Ctrl",
        18: "Alt",
        224: "Meta",
        91: "MetaLeft",
        92: "MetaRight",
        93: "ContextMenu"
      },
      KEY_MODS: {
        "ctrl": 1,
        "alt": 2,
        "option": 2,
        "shift": 4,
        "super": 8,
        "meta": 8,
        "command": 8,
        "cmd": 8,
        "control": 1
      },
      FUNCTION_KEYS: {
        8: "Backspace",
        9: "Tab",
        13: "Return",
        19: "Pause",
        27: "Esc",
        32: "Space",
        33: "PageUp",
        34: "PageDown",
        35: "End",
        36: "Home",
        37: "Left",
        38: "Up",
        39: "Right",
        40: "Down",
        44: "Print",
        45: "Insert",
        46: "Delete",
        "-13": "NumpadEnter",
        144: "Numlock",
        145: "Scrolllock"
      },
      PRINTABLE_KEYS: {
        32: " ",
        59: ";",
        61: "=",
        107: "+",
        109: "-",
        110: ".",
        186: ";",
        187: "=",
        188: ",",
        189: "-",
        190: ".",
        191: "/",
        192: "`",
        219: "[",
        220: "\\",
        221: "]",
        222: "'",
        111: "/",
        106: "*"
      }
    };
    var codeToKeyCode = {
      Command: 224,
      Backspace: 8,
      Tab: 9,
      Return: 13,
      Enter: 13,
      Pause: 19,
      Escape: 27,
      PageUp: 33,
      PageDown: 34,
      End: 35,
      Home: 36,
      Insert: 45,
      Delete: 46,
      ArrowLeft: 37,
      ArrowUp: 38,
      ArrowRight: 39,
      ArrowDown: 40,
      Backquote: 192,
      Minus: 189,
      Equal: 187,
      BracketLeft: 219,
      Backslash: 220,
      BracketRight: 221,
      Semicolon: 186,
      Quote: 222,
      Comma: 188,
      Period: 190,
      Slash: 191,
      Space: 32,
      NumpadAdd: 107,
      NumpadDecimal: 110,
      NumpadSubtract: 109,
      NumpadDivide: 111,
      NumpadMultiply: 106
    };
    for (var i2 = 0; i2 < 10; i2++) {
      codeToKeyCode["Digit" + i2] = 48 + i2;
      codeToKeyCode["Numpad" + i2] = 96 + i2;
      Keys2.PRINTABLE_KEYS[48 + i2] = "" + i2;
      Keys2.FUNCTION_KEYS[96 + i2] = "Numpad" + i2;
    }
    for (var i2 = 65; i2 < 91; i2++) {
      var chr = String.fromCharCode(i2 + 32);
      codeToKeyCode["Key" + chr.toUpperCase()] = i2;
      Keys2.PRINTABLE_KEYS[i2] = chr;
    }
    for (var i2 = 1; i2 < 13; i2++) {
      codeToKeyCode["F" + i2] = 111 + i2;
      Keys2.FUNCTION_KEYS[111 + i2] = "F" + i2;
    }
    var modifiers = {
      Shift: 16,
      Control: 17,
      Alt: 18,
      Meta: 224
    };
    for (var mod2 in modifiers) {
      codeToKeyCode[mod2] = codeToKeyCode[mod2 + "Left"] = codeToKeyCode[mod2 + "Right"] = modifiers[mod2];
    }
    exports3.$codeToKeyCode = codeToKeyCode;
    Keys2.PRINTABLE_KEYS[173] = "-";
    for (var j2 in Keys2.FUNCTION_KEYS) {
      var name2 = Keys2.FUNCTION_KEYS[j2].toLowerCase();
      Keys2[name2] = parseInt(j2, 10);
    }
    for (var j2 in Keys2.PRINTABLE_KEYS) {
      var name2 = Keys2.PRINTABLE_KEYS[j2].toLowerCase();
      Keys2[name2] = parseInt(j2, 10);
    }
    oop.mixin(Keys2, Keys2.MODIFIER_KEYS);
    oop.mixin(Keys2, Keys2.PRINTABLE_KEYS);
    oop.mixin(Keys2, Keys2.FUNCTION_KEYS);
    Keys2.enter = Keys2["return"];
    Keys2.escape = Keys2.esc;
    Keys2.del = Keys2["delete"];
    (function() {
      var mods = ["cmd", "ctrl", "alt", "shift"];
      for (var i3 = Math.pow(2, mods.length); i3--; ) {
        Keys2.KEY_MODS[i3] = mods.filter(function(x2) {
          return i3 & Keys2.KEY_MODS[x2];
        }).join("-") + "-";
      }
    })();
    Keys2.KEY_MODS[0] = "";
    Keys2.KEY_MODS[-1] = "input-";
    oop.mixin(exports3, Keys2);
    exports3.default = exports3;
    exports3.keyCodeToString = function(keyCode) {
      var keyString = Keys2[keyCode];
      if (typeof keyString != "string")
        keyString = String.fromCharCode(keyCode);
      return keyString.toLowerCase();
    };
  });
  ace.define("ace/lib/event", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require2, exports3, module3) {
    var keys2 = require2("./keys");
    var useragent = require2("./useragent");
    var pressedKeys = null;
    var ts = 0;
    var activeListenerOptions;
    function detectListenerOptionsSupport() {
      activeListenerOptions = false;
      try {
        document.createComment("").addEventListener("test", function() {
        }, {
          get passive() {
            activeListenerOptions = { passive: false };
            return true;
          }
        });
      } catch (e2) {
      }
    }
    function getListenerOptions() {
      if (activeListenerOptions == void 0)
        detectListenerOptionsSupport();
      return activeListenerOptions;
    }
    function EventListener2(elem, type4, callback2) {
      this.elem = elem;
      this.type = type4;
      this.callback = callback2;
    }
    EventListener2.prototype.destroy = function() {
      removeListener2(this.elem, this.type, this.callback);
      this.elem = this.type = this.callback = void 0;
    };
    var addListener2 = exports3.addListener = function(elem, type4, callback2, destroyer) {
      elem.addEventListener(type4, callback2, getListenerOptions());
      if (destroyer)
        destroyer.$toDestroy.push(new EventListener2(elem, type4, callback2));
    };
    var removeListener2 = exports3.removeListener = function(elem, type4, callback2) {
      elem.removeEventListener(type4, callback2, getListenerOptions());
    };
    exports3.stopEvent = function(e2) {
      exports3.stopPropagation(e2);
      exports3.preventDefault(e2);
      return false;
    };
    exports3.stopPropagation = function(e2) {
      if (e2.stopPropagation)
        e2.stopPropagation();
    };
    exports3.preventDefault = function(e2) {
      if (e2.preventDefault)
        e2.preventDefault();
    };
    exports3.getButton = function(e2) {
      if (e2.type == "dblclick")
        return 0;
      if (e2.type == "contextmenu" || useragent.isMac && (e2.ctrlKey && !e2.altKey && !e2.shiftKey))
        return 2;
      return e2.button;
    };
    exports3.capture = function(el2, eventHandler, releaseCaptureHandler) {
      var ownerDocument = el2 && el2.ownerDocument || document;
      function onMouseUp(e2) {
        eventHandler && eventHandler(e2);
        releaseCaptureHandler && releaseCaptureHandler(e2);
        removeListener2(ownerDocument, "mousemove", eventHandler);
        removeListener2(ownerDocument, "mouseup", onMouseUp);
        removeListener2(ownerDocument, "dragstart", onMouseUp);
      }
      addListener2(ownerDocument, "mousemove", eventHandler);
      addListener2(ownerDocument, "mouseup", onMouseUp);
      addListener2(ownerDocument, "dragstart", onMouseUp);
      return onMouseUp;
    };
    exports3.addMouseWheelListener = function(el2, callback2, destroyer) {
      addListener2(el2, "wheel", function(e2) {
        var factor = 0.15;
        var deltaX = e2.deltaX || 0;
        var deltaY = e2.deltaY || 0;
        switch (e2.deltaMode) {
          case e2.DOM_DELTA_PIXEL:
            e2.wheelX = deltaX * factor;
            e2.wheelY = deltaY * factor;
            break;
          case e2.DOM_DELTA_LINE:
            var linePixels = 15;
            e2.wheelX = deltaX * linePixels;
            e2.wheelY = deltaY * linePixels;
            break;
          case e2.DOM_DELTA_PAGE:
            var pagePixels = 150;
            e2.wheelX = deltaX * pagePixels;
            e2.wheelY = deltaY * pagePixels;
            break;
        }
        callback2(e2);
      }, destroyer);
    };
    exports3.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) {
      var clicks = 0;
      var startX, startY, timer;
      var eventNames = {
        2: "dblclick",
        3: "tripleclick",
        4: "quadclick"
      };
      function onMousedown(e2) {
        if (exports3.getButton(e2) !== 0) {
          clicks = 0;
        } else if (e2.detail > 1) {
          clicks++;
          if (clicks > 4)
            clicks = 1;
        } else {
          clicks = 1;
        }
        if (useragent.isIE) {
          var isNewClick = Math.abs(e2.clientX - startX) > 5 || Math.abs(e2.clientY - startY) > 5;
          if (!timer || isNewClick)
            clicks = 1;
          if (timer)
            clearTimeout(timer);
          timer = setTimeout(function() {
            timer = null;
          }, timeouts[clicks - 1] || 600);
          if (clicks == 1) {
            startX = e2.clientX;
            startY = e2.clientY;
          }
        }
        e2._clicks = clicks;
        eventHandler[callbackName]("mousedown", e2);
        if (clicks > 4)
          clicks = 0;
        else if (clicks > 1)
          return eventHandler[callbackName](eventNames[clicks], e2);
      }
      if (!Array.isArray(elements))
        elements = [elements];
      elements.forEach(function(el2) {
        addListener2(el2, "mousedown", onMousedown, destroyer);
      });
    };
    function getModifierHash(e2) {
      return 0 | (e2.ctrlKey ? 1 : 0) | (e2.altKey ? 2 : 0) | (e2.shiftKey ? 4 : 0) | (e2.metaKey ? 8 : 0);
    }
    exports3.getModifierString = function(e2) {
      return keys2.KEY_MODS[getModifierHash(e2)];
    };
    function normalizeCommandKeys(callback2, e2, keyCode) {
      var hashId = getModifierHash(e2);
      if (!keyCode && e2.code) {
        keyCode = keys2.$codeToKeyCode[e2.code] || keyCode;
      }
      if (!useragent.isMac && pressedKeys) {
        if (e2.getModifierState && (e2.getModifierState("OS") || e2.getModifierState("Win")))
          hashId |= 8;
        if (pressedKeys.altGr) {
          if ((3 & hashId) != 3)
            pressedKeys.altGr = 0;
          else
            return;
        }
        if (keyCode === 18 || keyCode === 17) {
          var location2 = e2.location;
          if (keyCode === 17 && location2 === 1) {
            if (pressedKeys[keyCode] == 1)
              ts = e2.timeStamp;
          } else if (keyCode === 18 && hashId === 3 && location2 === 2) {
            var dt = e2.timeStamp - ts;
            if (dt < 50)
              pressedKeys.altGr = true;
          }
        }
      }
      if (keyCode in keys2.MODIFIER_KEYS) {
        keyCode = -1;
      }
      if (!hashId && keyCode === 13) {
        if (e2.location === 3) {
          callback2(e2, hashId, -keyCode);
          if (e2.defaultPrevented)
            return;
        }
      }
      if (useragent.isChromeOS && hashId & 8) {
        callback2(e2, hashId, keyCode);
        if (e2.defaultPrevented)
          return;
        else
          hashId &= -9;
      }
      if (!hashId && !(keyCode in keys2.FUNCTION_KEYS) && !(keyCode in keys2.PRINTABLE_KEYS)) {
        return false;
      }
      return callback2(e2, hashId, keyCode);
    }
    exports3.addCommandKeyListener = function(el2, callback2, destroyer) {
      var lastDefaultPrevented = null;
      addListener2(el2, "keydown", function(e2) {
        pressedKeys[e2.keyCode] = (pressedKeys[e2.keyCode] || 0) + 1;
        var result = normalizeCommandKeys(callback2, e2, e2.keyCode);
        lastDefaultPrevented = e2.defaultPrevented;
        return result;
      }, destroyer);
      addListener2(el2, "keypress", function(e2) {
        if (lastDefaultPrevented && (e2.ctrlKey || e2.altKey || e2.shiftKey || e2.metaKey)) {
          exports3.stopEvent(e2);
          lastDefaultPrevented = null;
        }
      }, destroyer);
      addListener2(el2, "keyup", function(e2) {
        pressedKeys[e2.keyCode] = null;
      }, destroyer);
      if (!pressedKeys) {
        resetPressedKeys();
        addListener2(window, "focus", resetPressedKeys);
      }
    };
    function resetPressedKeys() {
      pressedKeys = /* @__PURE__ */ Object.create(null);
    }
    if (typeof window == "object" && window.postMessage && !useragent.isOldIE) {
      var postMessageId = 1;
      exports3.nextTick = function(callback2, win2) {
        win2 = win2 || window;
        var messageName = "zero-timeout-message-" + postMessageId++;
        var listener = function(e2) {
          if (e2.data == messageName) {
            exports3.stopPropagation(e2);
            removeListener2(win2, "message", listener);
            callback2();
          }
        };
        addListener2(win2, "message", listener);
        win2.postMessage(messageName, "*");
      };
    }
    exports3.$idleBlocked = false;
    exports3.onIdle = function(cb2, timeout) {
      return setTimeout(function handler() {
        if (!exports3.$idleBlocked) {
          cb2();
        } else {
          setTimeout(handler, 100);
        }
      }, timeout);
    };
    exports3.$idleBlockId = null;
    exports3.blockIdle = function(delay2) {
      if (exports3.$idleBlockId)
        clearTimeout(exports3.$idleBlockId);
      exports3.$idleBlocked = true;
      exports3.$idleBlockId = setTimeout(function() {
        exports3.$idleBlocked = false;
      }, delay2 || 100);
    };
    exports3.nextFrame = typeof window == "object" && (window.requestAnimationFrame || window["mozRequestAnimationFrame"] || window["webkitRequestAnimationFrame"] || window["msRequestAnimationFrame"] || window["oRequestAnimationFrame"]);
    if (exports3.nextFrame)
      exports3.nextFrame = exports3.nextFrame.bind(window);
    else
      exports3.nextFrame = function(callback2) {
        setTimeout(callback2, 17);
      };
  });
  ace.define("ace/clipboard", ["require", "exports", "module"], function(require2, exports3, module3) {
    var $cancelT;
    module3.exports = {
      lineMode: false,
      pasteCancelled: function() {
        if ($cancelT && $cancelT > Date.now() - 50)
          return true;
        return $cancelT = false;
      },
      cancel: function() {
        $cancelT = Date.now();
      }
    };
  });
  ace.define("ace/keyboard/textinput", ["require", "exports", "module", "ace/lib/event", "ace/config", "ace/lib/useragent", "ace/lib/dom", "ace/lib/lang", "ace/clipboard", "ace/lib/keys"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var nls = require2("../config").nls;
    var useragent = require2("../lib/useragent");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var clipboard = require2("../clipboard");
    var BROKEN_SETDATA = useragent.isChrome < 18;
    var USE_IE_MIME_TYPE = useragent.isIE;
    var HAS_FOCUS_ARGS = useragent.isChrome > 63;
    var MAX_LINE_LENGTH = 400;
    var KEYS = require2("../lib/keys");
    var MODS = KEYS.KEY_MODS;
    var isIOS = useragent.isIOS;
    var valueResetRegex = isIOS ? /\s/ : /\n/;
    var isMobile2 = useragent.isMobile;
    var TextInput = (
      /** @class */
      function() {
        function TextInput2(parentNode, host) {
          var _this = this;
          this.host = host;
          this.text = dom.createElement("textarea");
          this.text.className = "ace_text-input";
          this.text.setAttribute("wrap", "off");
          this.text.setAttribute("autocorrect", "off");
          this.text.setAttribute("autocapitalize", "off");
          this.text.setAttribute("spellcheck", "false");
          this.text.style.opacity = "0";
          parentNode.insertBefore(this.text, parentNode.firstChild);
          this.copied = false;
          this.pasted = false;
          this.inComposition = false;
          this.sendingText = false;
          this.tempStyle = "";
          if (!isMobile2)
            this.text.style.fontSize = "1px";
          this.commandMode = false;
          this.ignoreFocusEvents = false;
          this.lastValue = "";
          this.lastSelectionStart = 0;
          this.lastSelectionEnd = 0;
          this.lastRestoreEnd = 0;
          this.rowStart = Number.MAX_SAFE_INTEGER;
          this.rowEnd = Number.MIN_SAFE_INTEGER;
          this.numberOfExtraLines = 0;
          try {
            this.$isFocused = document.activeElement === this.text;
          } catch (e2) {
          }
          this.cancelComposition = this.cancelComposition.bind(this);
          this.setAriaOptions({ role: "textbox" });
          event.addListener(this.text, "blur", function(e2) {
            if (_this.ignoreFocusEvents)
              return;
            host.onBlur(e2);
            _this.$isFocused = false;
          }, host);
          event.addListener(this.text, "focus", function(e2) {
            if (_this.ignoreFocusEvents)
              return;
            _this.$isFocused = true;
            if (useragent.isEdge) {
              try {
                if (!document.hasFocus())
                  return;
              } catch (e3) {
              }
            }
            host.onFocus(e2);
            if (useragent.isEdge)
              setTimeout(_this.resetSelection.bind(_this));
            else
              _this.resetSelection();
          }, host);
          this.$focusScroll = false;
          host.on("beforeEndOperation", function() {
            var curOp = host.curOp;
            var commandName = curOp && curOp.command && curOp.command.name;
            if (commandName == "insertstring")
              return;
            var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged);
            if (_this.inComposition && isUserAction) {
              _this.lastValue = _this.text.value = "";
              _this.onCompositionEnd();
            }
            _this.resetSelection();
          });
          host.on("changeSelection", this.setAriaLabel.bind(this));
          this.resetSelection = isIOS ? this.$resetSelectionIOS : this.$resetSelection;
          if (this.$isFocused)
            host.onFocus();
          this.inputHandler = null;
          this.afterContextMenu = false;
          event.addCommandKeyListener(this.text, function(e2, hashId, keyCode) {
            if (_this.inComposition)
              return;
            return host.onCommandKey(e2, hashId, keyCode);
          }, host);
          event.addListener(this.text, "select", this.onSelect.bind(this), host);
          event.addListener(this.text, "input", this.onInput.bind(this), host);
          event.addListener(this.text, "cut", this.onCut.bind(this), host);
          event.addListener(this.text, "copy", this.onCopy.bind(this), host);
          event.addListener(this.text, "paste", this.onPaste.bind(this), host);
          if (!("oncut" in this.text) || !("oncopy" in this.text) || !("onpaste" in this.text)) {
            event.addListener(parentNode, "keydown", function(e2) {
              if (useragent.isMac && !e2.metaKey || !e2.ctrlKey)
                return;
              switch (e2.keyCode) {
                case 67:
                  _this.onCopy(e2);
                  break;
                case 86:
                  _this.onPaste(e2);
                  break;
                case 88:
                  _this.onCut(e2);
                  break;
              }
            }, host);
          }
          this.syncComposition = lang2.delayedCall(this.onCompositionUpdate.bind(this), 50).schedule.bind(null, null);
          event.addListener(this.text, "compositionstart", this.onCompositionStart.bind(this), host);
          event.addListener(this.text, "compositionupdate", this.onCompositionUpdate.bind(this), host);
          event.addListener(this.text, "keyup", this.onKeyup.bind(this), host);
          event.addListener(this.text, "keydown", this.syncComposition.bind(this), host);
          event.addListener(this.text, "compositionend", this.onCompositionEnd.bind(this), host);
          this.closeTimeout;
          event.addListener(this.text, "mouseup", this.$onContextMenu.bind(this), host);
          event.addListener(this.text, "mousedown", function(e2) {
            e2.preventDefault();
            _this.onContextMenuClose();
          }, host);
          event.addListener(host.renderer.scroller, "contextmenu", this.$onContextMenu.bind(this), host);
          event.addListener(this.text, "contextmenu", this.$onContextMenu.bind(this), host);
          if (isIOS)
            this.addIosSelectionHandler(parentNode, host, this.text);
        }
        TextInput2.prototype.addIosSelectionHandler = function(parentNode, host, text2) {
          var _this = this;
          var typingResetTimeout = null;
          var typing = false;
          text2.addEventListener("keydown", function(e2) {
            if (typingResetTimeout)
              clearTimeout(typingResetTimeout);
            typing = true;
          }, true);
          text2.addEventListener("keyup", function(e2) {
            typingResetTimeout = setTimeout(function() {
              typing = false;
            }, 100);
          }, true);
          var detectArrowKeys = function(e2) {
            if (document.activeElement !== text2)
              return;
            if (typing || _this.inComposition || host.$mouseHandler.isMousePressed)
              return;
            if (_this.copied) {
              return;
            }
            var selectionStart = text2.selectionStart;
            var selectionEnd = text2.selectionEnd;
            var key = null;
            var modifier = 0;
            if (selectionStart == 0) {
              key = KEYS.up;
            } else if (selectionStart == 1) {
              key = KEYS.home;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue[selectionEnd] == "\n") {
              key = KEYS.end;
            } else if (selectionStart < _this.lastSelectionStart && _this.lastValue[selectionStart - 1] == " ") {
              key = KEYS.left;
              modifier = MODS.option;
            } else if (selectionStart < _this.lastSelectionStart || selectionStart == _this.lastSelectionStart && _this.lastSelectionEnd != _this.lastSelectionStart && selectionStart == selectionEnd) {
              key = KEYS.left;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue.slice(0, selectionEnd).split("\n").length > 2) {
              key = KEYS.down;
            } else if (selectionEnd > _this.lastSelectionEnd && _this.lastValue[selectionEnd - 1] == " ") {
              key = KEYS.right;
              modifier = MODS.option;
            } else if (selectionEnd > _this.lastSelectionEnd || selectionEnd == _this.lastSelectionEnd && _this.lastSelectionEnd != _this.lastSelectionStart && selectionStart == selectionEnd) {
              key = KEYS.right;
            }
            if (selectionStart !== selectionEnd)
              modifier |= MODS.shift;
            if (key) {
              var result = host.onCommandKey({}, modifier, key);
              if (!result && host.commands) {
                key = KEYS.keyCodeToString(key);
                var command = host.commands.findKeyCommand(modifier, key);
                if (command)
                  host.execCommand(command);
              }
              _this.lastSelectionStart = selectionStart;
              _this.lastSelectionEnd = selectionEnd;
              _this.resetSelection("");
            }
          };
          document.addEventListener("selectionchange", detectArrowKeys);
          host.on("destroy", function() {
            document.removeEventListener("selectionchange", detectArrowKeys);
          });
        };
        TextInput2.prototype.onContextMenuClose = function() {
          var _this = this;
          clearTimeout(this.closeTimeout);
          this.closeTimeout = setTimeout(function() {
            if (_this.tempStyle) {
              _this.text.style.cssText = _this.tempStyle;
              _this.tempStyle = "";
            }
            _this.host.renderer.$isMousePressed = false;
            if (_this.host.renderer.$keepTextAreaAtCursor)
              _this.host.renderer.$moveTextAreaToCursor();
          }, 0);
        };
        TextInput2.prototype.$onContextMenu = function(e2) {
          this.host.textInput.onContextMenu(e2);
          this.onContextMenuClose();
        };
        TextInput2.prototype.onKeyup = function(e2) {
          if (e2.keyCode == 27 && this.text.value.length < this.text.selectionStart) {
            if (!this.inComposition)
              this.lastValue = this.text.value;
            this.lastSelectionStart = this.lastSelectionEnd = -1;
            this.resetSelection();
          }
          this.syncComposition();
        };
        TextInput2.prototype.cancelComposition = function() {
          this.ignoreFocusEvents = true;
          this.text.blur();
          this.text.focus();
          this.ignoreFocusEvents = false;
        };
        TextInput2.prototype.onCompositionStart = function(e2) {
          if (this.inComposition || !this.host.onCompositionStart || this.host.$readOnly)
            return;
          this.inComposition = {};
          if (this.commandMode)
            return;
          if (e2.data)
            this.inComposition.useTextareaForIME = false;
          setTimeout(this.onCompositionUpdate.bind(this), 0);
          this.host._signal("compositionStart");
          this.host.on("mousedown", this.cancelComposition);
          var range3 = this.host.getSelectionRange();
          range3.end.row = range3.start.row;
          range3.end.column = range3.start.column;
          this.inComposition.markerRange = range3;
          this.inComposition.selectionStart = this.lastSelectionStart;
          this.host.onCompositionStart(this.inComposition);
          if (this.inComposition.useTextareaForIME) {
            this.lastValue = this.text.value = "";
            this.lastSelectionStart = 0;
            this.lastSelectionEnd = 0;
          } else {
            if (this.text.msGetInputContext)
              this.inComposition.context = this.text.msGetInputContext();
            if (this.text.getInputContext)
              this.inComposition.context = this.text.getInputContext();
          }
        };
        TextInput2.prototype.onCompositionUpdate = function() {
          if (!this.inComposition || !this.host.onCompositionUpdate || this.host.$readOnly)
            return;
          if (this.commandMode)
            return this.cancelComposition();
          if (this.inComposition.useTextareaForIME) {
            this.host.onCompositionUpdate(this.text.value);
          } else {
            var data = this.text.value;
            this.sendText(data);
            if (this.inComposition.markerRange) {
              if (this.inComposition.context) {
                this.inComposition.markerRange.start.column = this.inComposition.selectionStart = this.inComposition.context.compositionStartOffset;
              }
              this.inComposition.markerRange.end.column = this.inComposition.markerRange.start.column + this.lastSelectionEnd - this.inComposition.selectionStart + this.lastRestoreEnd;
            }
          }
        };
        TextInput2.prototype.onCompositionEnd = function(e2) {
          if (!this.host.onCompositionEnd || this.host.$readOnly)
            return;
          this.inComposition = false;
          this.host.onCompositionEnd();
          this.host.off("mousedown", this.cancelComposition);
          if (e2)
            this.onInput();
        };
        TextInput2.prototype.onCut = function(e2) {
          this.doCopy(e2, true);
        };
        TextInput2.prototype.onCopy = function(e2) {
          this.doCopy(e2, false);
        };
        TextInput2.prototype.onPaste = function(e2) {
          var data = this.handleClipboardData(e2);
          if (clipboard.pasteCancelled())
            return;
          if (typeof data == "string") {
            if (data)
              this.host.onPaste(data, e2);
            if (useragent.isIE)
              setTimeout(this.resetSelection);
            event.preventDefault(e2);
          } else {
            this.text.value = "";
            this.pasted = true;
          }
        };
        TextInput2.prototype.doCopy = function(e2, isCut) {
          var _this = this;
          var data = this.host.getCopyText();
          if (!data)
            return event.preventDefault(e2);
          if (this.handleClipboardData(e2, data)) {
            if (isIOS) {
              this.resetSelection(data);
              this.copied = data;
              setTimeout(function() {
                _this.copied = false;
              }, 10);
            }
            isCut ? this.host.onCut() : this.host.onCopy();
            event.preventDefault(e2);
          } else {
            this.copied = true;
            this.text.value = data;
            this.text.select();
            setTimeout(function() {
              _this.copied = false;
              _this.resetSelection();
              isCut ? _this.host.onCut() : _this.host.onCopy();
            });
          }
        };
        TextInput2.prototype.handleClipboardData = function(e2, data, forceIEMime) {
          var clipboardData = e2.clipboardData || window["clipboardData"];
          if (!clipboardData || BROKEN_SETDATA)
            return;
          var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain";
          try {
            if (data) {
              return clipboardData.setData(mime, data) !== false;
            } else {
              return clipboardData.getData(mime);
            }
          } catch (e3) {
            if (!forceIEMime)
              return this.handleClipboardData(e3, data, true);
          }
        };
        TextInput2.prototype.onInput = function(e2) {
          if (this.inComposition)
            return this.onCompositionUpdate();
          if (e2 && e2.inputType) {
            if (e2.inputType == "historyUndo")
              return this.host.execCommand("undo");
            if (e2.inputType == "historyRedo")
              return this.host.execCommand("redo");
          }
          var data = this.text.value;
          var inserted = this.sendText(data, true);
          if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted) || isMobile2 && this.lastSelectionStart < 1 && this.lastSelectionStart == this.lastSelectionEnd) {
            this.resetSelection();
          }
        };
        TextInput2.prototype.sendText = function(value2, fromInput) {
          if (this.afterContextMenu)
            this.afterContextMenu = false;
          if (this.pasted) {
            this.resetSelection();
            if (value2)
              this.host.onPaste(value2);
            this.pasted = false;
            return "";
          } else {
            var selectionStart = this.text.selectionStart;
            var selectionEnd = this.text.selectionEnd;
            var extendLeft = this.lastSelectionStart;
            var extendRight = this.lastValue.length - this.lastSelectionEnd;
            var inserted = value2;
            var restoreStart = value2.length - selectionStart;
            var restoreEnd = value2.length - selectionEnd;
            var i2 = 0;
            while (extendLeft > 0 && this.lastValue[i2] == value2[i2]) {
              i2++;
              extendLeft--;
            }
            inserted = inserted.slice(i2);
            i2 = 1;
            while (extendRight > 0 && this.lastValue.length - i2 > this.lastSelectionStart - 1 && this.lastValue[this.lastValue.length - i2] == value2[value2.length - i2]) {
              i2++;
              extendRight--;
            }
            restoreStart -= i2 - 1;
            restoreEnd -= i2 - 1;
            var endIndex = inserted.length - i2 + 1;
            if (endIndex < 0) {
              extendLeft = -endIndex;
              endIndex = 0;
            }
            inserted = inserted.slice(0, endIndex);
            if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd)
              return "";
            this.sendingText = true;
            var shouldReset = false;
            if (useragent.isAndroid && inserted == ". ") {
              inserted = "  ";
              shouldReset = true;
            }
            if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || this.commandMode) {
              this.host.onTextInput(inserted);
            } else {
              this.host.onTextInput(inserted, {
                extendLeft,
                extendRight,
                restoreStart,
                restoreEnd
              });
            }
            this.sendingText = false;
            this.lastValue = value2;
            this.lastSelectionStart = selectionStart;
            this.lastSelectionEnd = selectionEnd;
            this.lastRestoreEnd = restoreEnd;
            return shouldReset ? "\n" : inserted;
          }
        };
        TextInput2.prototype.onSelect = function(e2) {
          var _this = this;
          if (this.inComposition)
            return;
          var isAllSelected = function(text2) {
            return text2.selectionStart === 0 && text2.selectionEnd >= _this.lastValue.length && text2.value === _this.lastValue && _this.lastValue && text2.selectionEnd !== _this.lastSelectionEnd;
          };
          if (this.copied) {
            this.copied = false;
          } else if (isAllSelected(this.text)) {
            this.host.selectAll();
            this.resetSelection();
          } else if (isMobile2 && this.text.selectionStart != this.lastSelectionStart) {
            this.resetSelection();
          }
        };
        TextInput2.prototype.$resetSelectionIOS = function(value2) {
          if (!this.$isFocused || this.copied && !value2 || this.sendingText)
            return;
          if (!value2)
            value2 = "";
          var newValue = "\n ab" + value2 + "cde fg\n";
          if (newValue != this.text.value)
            this.text.value = this.lastValue = newValue;
          var selectionStart = 4;
          var selectionEnd = 4 + (value2.length || (this.host.selection.isEmpty() ? 0 : 1));
          if (this.lastSelectionStart != selectionStart || this.lastSelectionEnd != selectionEnd) {
            this.text.setSelectionRange(selectionStart, selectionEnd);
          }
          this.lastSelectionStart = selectionStart;
          this.lastSelectionEnd = selectionEnd;
        };
        TextInput2.prototype.$resetSelection = function() {
          var _this = this;
          if (this.inComposition || this.sendingText)
            return;
          if (!this.$isFocused && !this.afterContextMenu)
            return;
          this.inComposition = true;
          var selectionStart = 0;
          var selectionEnd = 0;
          var line2 = "";
          var positionToSelection = function(row2, column2) {
            var selection2 = column2;
            for (var i3 = 1; i3 <= row2 - _this.rowStart && i3 < 2 * _this.numberOfExtraLines + 1; i3++) {
              selection2 += _this.host.session.getLine(row2 - i3).length + 1;
            }
            return selection2;
          };
          if (this.host.session) {
            var selection = this.host.selection;
            var range3 = selection.getRange();
            var row = selection.cursor.row;
            if (row === this.rowEnd + 1) {
              this.rowStart = this.rowEnd + 1;
              this.rowEnd = this.rowStart + 2 * this.numberOfExtraLines;
            } else if (row === this.rowStart - 1) {
              this.rowEnd = this.rowStart - 1;
              this.rowStart = this.rowEnd - 2 * this.numberOfExtraLines;
            } else if (row < this.rowStart - 1 || row > this.rowEnd + 1) {
              this.rowStart = row > this.numberOfExtraLines ? row - this.numberOfExtraLines : 0;
              this.rowEnd = row > this.numberOfExtraLines ? row + this.numberOfExtraLines : 2 * this.numberOfExtraLines;
            }
            var lines = [];
            for (var i2 = this.rowStart; i2 <= this.rowEnd; i2++) {
              lines.push(this.host.session.getLine(i2));
            }
            line2 = lines.join("\n");
            selectionStart = positionToSelection(range3.start.row, range3.start.column);
            selectionEnd = positionToSelection(range3.end.row, range3.end.column);
            if (range3.start.row < this.rowStart) {
              var prevLine = this.host.session.getLine(this.rowStart - 1);
              selectionStart = range3.start.row < this.rowStart - 1 ? 0 : selectionStart;
              selectionEnd += prevLine.length + 1;
              line2 = prevLine + "\n" + line2;
            } else if (range3.end.row > this.rowEnd) {
              var nextLine = this.host.session.getLine(this.rowEnd + 1);
              selectionEnd = range3.end.row > this.rowEnd + 1 ? nextLine.length : range3.end.column;
              selectionEnd += line2.length + 1;
              line2 = line2 + "\n" + nextLine;
            } else if (isMobile2 && row > 0) {
              line2 = "\n" + line2;
              selectionEnd += 1;
              selectionStart += 1;
            }
            if (line2.length > MAX_LINE_LENGTH) {
              if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) {
                line2 = line2.slice(0, MAX_LINE_LENGTH);
              } else {
                line2 = "\n";
                if (selectionStart == selectionEnd) {
                  selectionStart = selectionEnd = 0;
                } else {
                  selectionStart = 0;
                  selectionEnd = 1;
                }
              }
            }
            var newValue = line2 + "\n\n";
            if (newValue != this.lastValue) {
              this.text.value = this.lastValue = newValue;
              this.lastSelectionStart = this.lastSelectionEnd = newValue.length;
            }
          }
          if (this.afterContextMenu) {
            this.lastSelectionStart = this.text.selectionStart;
            this.lastSelectionEnd = this.text.selectionEnd;
          }
          if (this.lastSelectionEnd != selectionEnd || this.lastSelectionStart != selectionStart || this.text.selectionEnd != this.lastSelectionEnd) {
            try {
              this.text.setSelectionRange(selectionStart, selectionEnd);
              this.lastSelectionStart = selectionStart;
              this.lastSelectionEnd = selectionEnd;
            } catch (e2) {
            }
          }
          this.inComposition = false;
        };
        TextInput2.prototype.setHost = function(newHost) {
          this.host = newHost;
        };
        TextInput2.prototype.setNumberOfExtraLines = function(number4) {
          this.rowStart = Number.MAX_SAFE_INTEGER;
          this.rowEnd = Number.MIN_SAFE_INTEGER;
          if (number4 < 0) {
            this.numberOfExtraLines = 0;
            return;
          }
          this.numberOfExtraLines = number4;
        };
        TextInput2.prototype.setAriaLabel = function() {
          var ariaLabel = "";
          if (this.host.$textInputAriaLabel) {
            ariaLabel += "".concat(this.host.$textInputAriaLabel, ", ");
          }
          if (this.host.session) {
            var row = this.host.session.selection.cursor.row;
            ariaLabel += nls("text-input.aria-label", "Cursor at row $0", [row + 1]);
          }
          this.text.setAttribute("aria-label", ariaLabel);
        };
        TextInput2.prototype.setAriaOptions = function(options) {
          if (options.activeDescendant) {
            this.text.setAttribute("aria-haspopup", "true");
            this.text.setAttribute("aria-autocomplete", options.inline ? "both" : "list");
            this.text.setAttribute("aria-activedescendant", options.activeDescendant);
          } else {
            this.text.setAttribute("aria-haspopup", "false");
            this.text.setAttribute("aria-autocomplete", "both");
            this.text.removeAttribute("aria-activedescendant");
          }
          if (options.role) {
            this.text.setAttribute("role", options.role);
          }
          if (options.setLabel) {
            this.text.setAttribute("aria-roledescription", nls("text-input.aria-roledescription", "editor"));
            this.setAriaLabel();
          }
        };
        TextInput2.prototype.focus = function() {
          var _this = this;
          this.setAriaOptions({
            setLabel: this.host.renderer.enableKeyboardAccessibility
          });
          if (this.tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser")
            return this.text.focus({ preventScroll: true });
          var top2 = this.text.style.top;
          this.text.style.position = "fixed";
          this.text.style.top = "0px";
          try {
            var isTransformed = this.text.getBoundingClientRect().top != 0;
          } catch (e2) {
            return;
          }
          var ancestors = [];
          if (isTransformed) {
            var t2 = this.text.parentElement;
            while (t2 && t2.nodeType == 1) {
              ancestors.push(t2);
              t2.setAttribute("ace_nocontext", "true");
              if (!t2.parentElement && t2.getRootNode)
                t2 = t2.getRootNode()["host"];
              else
                t2 = t2.parentElement;
            }
          }
          this.text.focus({ preventScroll: true });
          if (isTransformed) {
            ancestors.forEach(function(p2) {
              p2.removeAttribute("ace_nocontext");
            });
          }
          setTimeout(function() {
            _this.text.style.position = "";
            if (_this.text.style.top == "0px")
              _this.text.style.top = top2;
          }, 0);
        };
        TextInput2.prototype.blur = function() {
          this.text.blur();
        };
        TextInput2.prototype.isFocused = function() {
          return this.$isFocused;
        };
        TextInput2.prototype.setInputHandler = function(cb2) {
          this.inputHandler = cb2;
        };
        TextInput2.prototype.getInputHandler = function() {
          return this.inputHandler;
        };
        TextInput2.prototype.getElement = function() {
          return this.text;
        };
        TextInput2.prototype.setCommandMode = function(value2) {
          this.commandMode = value2;
          this.text.readOnly = false;
        };
        TextInput2.prototype.setReadOnly = function(readOnly) {
          if (!this.commandMode)
            this.text.readOnly = readOnly;
        };
        TextInput2.prototype.setCopyWithEmptySelection = function(value2) {
        };
        TextInput2.prototype.onContextMenu = function(e2) {
          this.afterContextMenu = true;
          this.resetSelection();
          this.host._emit("nativecontextmenu", {
            target: this.host,
            domEvent: e2
          });
          this.moveToMouse(e2, true);
        };
        TextInput2.prototype.moveToMouse = function(e2, bringToFront) {
          var _this = this;
          if (!this.tempStyle)
            this.tempStyle = this.text.style.cssText;
          this.text.style.cssText = (bringToFront ? "z-index:100000;" : "") + (useragent.isIE ? "opacity:0.1;" : "") + "text-indent: -" + (this.lastSelectionStart + this.lastSelectionEnd) * this.host.renderer.characterWidth * 0.5 + "px;";
          var rect = this.host.container.getBoundingClientRect();
          var style2 = dom.computedStyle(this.host.container);
          var top2 = rect.top + (parseInt(style2.borderTopWidth) || 0);
          var left2 = rect.left + (parseInt(style2.borderLeftWidth) || 0);
          var maxTop = rect.bottom - top2 - this.text.clientHeight - 2;
          var move2 = function(e3) {
            dom.translate(_this.text, e3.clientX - left2 - 2, Math.min(e3.clientY - top2 - 2, maxTop));
          };
          move2(e2);
          if (e2.type != "mousedown")
            return;
          this.host.renderer.$isMousePressed = true;
          clearTimeout(this.closeTimeout);
          if (useragent.isWin)
            event.capture(this.host.container, move2, this.onContextMenuClose.bind(this));
        };
        TextInput2.prototype.destroy = function() {
          if (this.text.parentElement)
            this.text.parentElement.removeChild(this.text);
        };
        return TextInput2;
      }()
    );
    exports3.TextInput = TextInput;
    exports3.$setUserAgentForTests = function(_isMobile, _isIOS) {
      isMobile2 = _isMobile;
      isIOS = _isIOS;
    };
  });
  ace.define("ace/mouse/default_handlers", ["require", "exports", "module", "ace/lib/useragent"], function(require2, exports3, module3) {
    var useragent = require2("../lib/useragent");
    var DRAG_OFFSET = 0;
    var SCROLL_COOLDOWN_T = 550;
    var DefaultHandlers = (
      /** @class */
      function() {
        function DefaultHandlers2(mouseHandler) {
          mouseHandler.$clickSelection = null;
          var editor = mouseHandler.editor;
          editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
          editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
          editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
          editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
          editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler));
          var exports4 = [
            "select",
            "startSelect",
            "selectEnd",
            "selectAllEnd",
            "selectByWordsEnd",
            "selectByLinesEnd",
            "dragWait",
            "dragWaitEnd",
            "focusWait"
          ];
          exports4.forEach(function(x2) {
            mouseHandler[x2] = this[x2];
          }, this);
          mouseHandler["selectByLines"] = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
          mouseHandler["selectByWords"] = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
        }
        DefaultHandlers2.prototype.onMouseDown = function(ev) {
          var inSelection = ev.inSelection();
          var pos = ev.getDocumentPosition();
          this.mousedownEvent = ev;
          var editor = this.editor;
          var button2 = ev.getButton();
          if (button2 !== 0) {
            var selectionRange = editor.getSelectionRange();
            var selectionEmpty = selectionRange.isEmpty();
            if (selectionEmpty || button2 == 1)
              editor.selection.moveToPosition(pos);
            if (button2 == 2) {
              editor.textInput.onContextMenu(ev.domEvent);
              if (!useragent.isMozilla)
                ev.preventDefault();
            }
            return;
          }
          this.mousedownEvent.time = Date.now();
          if (inSelection && !editor.isFocused()) {
            editor.focus();
            if (this.$focusTimeout && !this.$clickSelection && !editor.inMultiSelectMode) {
              this.setState("focusWait");
              this.captureMouse(ev);
              return;
            }
          }
          this.captureMouse(ev);
          this.startSelect(pos, ev.domEvent._clicks > 1);
          return ev.preventDefault();
        };
        DefaultHandlers2.prototype.startSelect = function(pos, waitForClickSelection) {
          pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
          var editor = this.editor;
          if (!this.mousedownEvent)
            return;
          if (this.mousedownEvent.getShiftKey())
            editor.selection.selectToPosition(pos);
          else if (!waitForClickSelection)
            editor.selection.moveToPosition(pos);
          if (!waitForClickSelection)
            this.select();
          editor.setStyle("ace_selecting");
          this.setState("select");
        };
        DefaultHandlers2.prototype.select = function() {
          var anchor, editor = this.editor;
          var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
          if (this.$clickSelection) {
            var cmp = this.$clickSelection.comparePoint(cursor);
            if (cmp == -1) {
              anchor = this.$clickSelection.end;
            } else if (cmp == 1) {
              anchor = this.$clickSelection.start;
            } else {
              var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
              cursor = orientedRange.cursor;
              anchor = orientedRange.anchor;
            }
            editor.selection.setSelectionAnchor(anchor.row, anchor.column);
          }
          editor.selection.selectToPosition(cursor);
          editor.renderer.scrollCursorIntoView();
        };
        DefaultHandlers2.prototype.extendSelectionBy = function(unitName) {
          var anchor, editor = this.editor;
          var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
          var range3 = editor.selection[unitName](cursor.row, cursor.column);
          if (this.$clickSelection) {
            var cmpStart = this.$clickSelection.comparePoint(range3.start);
            var cmpEnd = this.$clickSelection.comparePoint(range3.end);
            if (cmpStart == -1 && cmpEnd <= 0) {
              anchor = this.$clickSelection.end;
              if (range3.end.row != cursor.row || range3.end.column != cursor.column)
                cursor = range3.start;
            } else if (cmpEnd == 1 && cmpStart >= 0) {
              anchor = this.$clickSelection.start;
              if (range3.start.row != cursor.row || range3.start.column != cursor.column)
                cursor = range3.end;
            } else if (cmpStart == -1 && cmpEnd == 1) {
              cursor = range3.end;
              anchor = range3.start;
            } else {
              var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
              cursor = orientedRange.cursor;
              anchor = orientedRange.anchor;
            }
            editor.selection.setSelectionAnchor(anchor.row, anchor.column);
          }
          editor.selection.selectToPosition(cursor);
          editor.renderer.scrollCursorIntoView();
        };
        DefaultHandlers2.prototype.selectByLinesEnd = function() {
          this.$clickSelection = null;
          this.editor.unsetStyle("ace_selecting");
        };
        DefaultHandlers2.prototype.focusWait = function() {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          var time2 = Date.now();
          if (distance2 > DRAG_OFFSET || time2 - this.mousedownEvent.time > this.$focusTimeout)
            this.startSelect(this.mousedownEvent.getDocumentPosition());
        };
        DefaultHandlers2.prototype.onDoubleClick = function(ev) {
          var pos = ev.getDocumentPosition();
          var editor = this.editor;
          var session = editor.session;
          var range3 = session.getBracketRange(pos);
          if (range3) {
            if (range3.isEmpty()) {
              range3.start.column--;
              range3.end.column++;
            }
            this.setState("select");
          } else {
            range3 = editor.selection.getWordRange(pos.row, pos.column);
            this.setState("selectByWords");
          }
          this.$clickSelection = range3;
          this.select();
        };
        DefaultHandlers2.prototype.onTripleClick = function(ev) {
          var pos = ev.getDocumentPosition();
          var editor = this.editor;
          this.setState("selectByLines");
          var range3 = editor.getSelectionRange();
          if (range3.isMultiLine() && range3.contains(pos.row, pos.column)) {
            this.$clickSelection = editor.selection.getLineRange(range3.start.row);
            this.$clickSelection.end = editor.selection.getLineRange(range3.end.row).end;
          } else {
            this.$clickSelection = editor.selection.getLineRange(pos.row);
          }
          this.select();
        };
        DefaultHandlers2.prototype.onQuadClick = function(ev) {
          var editor = this.editor;
          editor.selectAll();
          this.$clickSelection = editor.getSelectionRange();
          this.setState("selectAll");
        };
        DefaultHandlers2.prototype.onMouseWheel = function(ev) {
          if (ev.getAccelKey())
            return;
          if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) {
            ev.wheelX = ev.wheelY;
            ev.wheelY = 0;
          }
          var editor = this.editor;
          if (!this.$lastScroll)
            this.$lastScroll = { t: 0, vx: 0, vy: 0, allowed: 0 };
          var prevScroll = this.$lastScroll;
          var t2 = ev.domEvent.timeStamp;
          var dt = t2 - prevScroll.t;
          var vx = dt ? ev.wheelX / dt : prevScroll.vx;
          var vy = dt ? ev.wheelY / dt : prevScroll.vy;
          if (dt < SCROLL_COOLDOWN_T) {
            vx = (vx + prevScroll.vx) / 2;
            vy = (vy + prevScroll.vy) / 2;
          }
          var direction = Math.abs(vx / vy);
          var canScroll = false;
          if (direction >= 1 && editor.renderer.isScrollableBy(ev.wheelX * ev.speed, 0))
            canScroll = true;
          if (direction <= 1 && editor.renderer.isScrollableBy(0, ev.wheelY * ev.speed))
            canScroll = true;
          if (canScroll) {
            prevScroll.allowed = t2;
          } else if (t2 - prevScroll.allowed < SCROLL_COOLDOWN_T) {
            var isSlower = Math.abs(vx) <= 1.5 * Math.abs(prevScroll.vx) && Math.abs(vy) <= 1.5 * Math.abs(prevScroll.vy);
            if (isSlower) {
              canScroll = true;
              prevScroll.allowed = t2;
            } else {
              prevScroll.allowed = 0;
            }
          }
          prevScroll.t = t2;
          prevScroll.vx = vx;
          prevScroll.vy = vy;
          if (canScroll) {
            editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
            return ev.stop();
          }
        };
        return DefaultHandlers2;
      }()
    );
    DefaultHandlers.prototype.selectEnd = DefaultHandlers.prototype.selectByLinesEnd;
    DefaultHandlers.prototype.selectAllEnd = DefaultHandlers.prototype.selectByLinesEnd;
    DefaultHandlers.prototype.selectByWordsEnd = DefaultHandlers.prototype.selectByLinesEnd;
    exports3.DefaultHandlers = DefaultHandlers;
    function calcDistance(ax, ay, bx, by) {
      return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
    }
    function calcRangeOrientation(range3, cursor) {
      if (range3.start.row == range3.end.row)
        var cmp = 2 * cursor.column - range3.start.column - range3.end.column;
      else if (range3.start.row == range3.end.row - 1 && !range3.start.column && !range3.end.column)
        var cmp = cursor.column - 4;
      else
        var cmp = 2 * cursor.row - range3.start.row - range3.end.row;
      if (cmp < 0)
        return { cursor: range3.start, anchor: range3.end };
      else
        return { cursor: range3.end, anchor: range3.start };
    }
  });
  ace.define("ace/lib/scroll", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.preventParentScroll = function preventParentScroll(event) {
      event.stopPropagation();
      var target = event.currentTarget;
      var contentOverflows = target.scrollHeight > target.clientHeight;
      if (!contentOverflows) {
        event.preventDefault();
      }
    };
  });
  ace.define("ace/tooltip", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/range", "ace/lib/scroll"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var dom = require2("./lib/dom");
    require2("./lib/event");
    var Range = require2("./range").Range;
    var preventParentScroll = require2("./lib/scroll").preventParentScroll;
    var CLASSNAME = "ace_tooltip";
    var Tooltip3 = (
      /** @class */
      function() {
        function Tooltip4(parentNode) {
          this.isOpen = false;
          this.$element = null;
          this.$parentNode = parentNode;
        }
        Tooltip4.prototype.$init = function() {
          this.$element = dom.createElement("div");
          this.$element.className = CLASSNAME;
          this.$element.style.display = "none";
          this.$parentNode.appendChild(this.$element);
          return this.$element;
        };
        Tooltip4.prototype.getElement = function() {
          return this.$element || this.$init();
        };
        Tooltip4.prototype.setText = function(text2) {
          this.getElement().textContent = text2;
        };
        Tooltip4.prototype.setHtml = function(html2) {
          this.getElement().innerHTML = html2;
        };
        Tooltip4.prototype.setPosition = function(x2, y2) {
          this.getElement().style.left = x2 + "px";
          this.getElement().style.top = y2 + "px";
        };
        Tooltip4.prototype.setClassName = function(className) {
          dom.addCssClass(this.getElement(), className);
        };
        Tooltip4.prototype.setTheme = function(theme2) {
          this.$element.className = CLASSNAME + " " + (theme2.isDark ? "ace_dark " : "") + (theme2.cssClass || "");
        };
        Tooltip4.prototype.show = function(text2, x2, y2) {
          if (text2 != null)
            this.setText(text2);
          if (x2 != null && y2 != null)
            this.setPosition(x2, y2);
          if (!this.isOpen) {
            this.getElement().style.display = "block";
            this.isOpen = true;
          }
        };
        Tooltip4.prototype.hide = function(e2) {
          if (this.isOpen) {
            this.getElement().style.display = "none";
            this.getElement().className = CLASSNAME;
            this.isOpen = false;
          }
        };
        Tooltip4.prototype.getHeight = function() {
          return this.getElement().offsetHeight;
        };
        Tooltip4.prototype.getWidth = function() {
          return this.getElement().offsetWidth;
        };
        Tooltip4.prototype.destroy = function() {
          this.isOpen = false;
          if (this.$element && this.$element.parentNode) {
            this.$element.parentNode.removeChild(this.$element);
          }
        };
        return Tooltip4;
      }()
    );
    var PopupManager = (
      /** @class */
      function() {
        function PopupManager2() {
          this.popups = [];
        }
        PopupManager2.prototype.addPopup = function(popup) {
          this.popups.push(popup);
          this.updatePopups();
        };
        PopupManager2.prototype.removePopup = function(popup) {
          var index2 = this.popups.indexOf(popup);
          if (index2 !== -1) {
            this.popups.splice(index2, 1);
            this.updatePopups();
          }
        };
        PopupManager2.prototype.updatePopups = function() {
          var e_1, _a2, e_2, _b2;
          this.popups.sort(function(a2, b2) {
            return b2.priority - a2.priority;
          });
          var visiblepopups = [];
          try {
            for (var _c2 = __values(this.popups), _d = _c2.next(); !_d.done; _d = _c2.next()) {
              var popup = _d.value;
              var shouldDisplay = true;
              try {
                for (var visiblepopups_1 = (e_2 = void 0, __values(visiblepopups)), visiblepopups_1_1 = visiblepopups_1.next(); !visiblepopups_1_1.done; visiblepopups_1_1 = visiblepopups_1.next()) {
                  var visiblePopup = visiblepopups_1_1.value;
                  if (this.doPopupsOverlap(visiblePopup, popup)) {
                    shouldDisplay = false;
                    break;
                  }
                }
              } catch (e_2_1) {
                e_2 = { error: e_2_1 };
              } finally {
                try {
                  if (visiblepopups_1_1 && !visiblepopups_1_1.done && (_b2 = visiblepopups_1.return))
                    _b2.call(visiblepopups_1);
                } finally {
                  if (e_2)
                    throw e_2.error;
                }
              }
              if (shouldDisplay) {
                visiblepopups.push(popup);
              } else {
                popup.hide();
              }
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (_d && !_d.done && (_a2 = _c2.return))
                _a2.call(_c2);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
        };
        PopupManager2.prototype.doPopupsOverlap = function(popupA, popupB) {
          var rectA = popupA.getElement().getBoundingClientRect();
          var rectB = popupB.getElement().getBoundingClientRect();
          return rectA.left < rectB.right && rectA.right > rectB.left && rectA.top < rectB.bottom && rectA.bottom > rectB.top;
        };
        return PopupManager2;
      }()
    );
    var popupManager = new PopupManager();
    exports3.popupManager = popupManager;
    exports3.Tooltip = Tooltip3;
    var HoverTooltip = (
      /** @class */
      function(_super) {
        __extends2(HoverTooltip2, _super);
        function HoverTooltip2(parentNode) {
          if (parentNode === void 0) {
            parentNode = document.body;
          }
          var _this = _super.call(this, parentNode) || this;
          _this.timeout = void 0;
          _this.lastT = 0;
          _this.idleTime = 350;
          _this.lastEvent = void 0;
          _this.onMouseOut = _this.onMouseOut.bind(_this);
          _this.onMouseMove = _this.onMouseMove.bind(_this);
          _this.waitForHover = _this.waitForHover.bind(_this);
          _this.hide = _this.hide.bind(_this);
          var el2 = _this.getElement();
          el2.style.whiteSpace = "pre-wrap";
          el2.style.pointerEvents = "auto";
          el2.addEventListener("mouseout", _this.onMouseOut);
          el2.tabIndex = -1;
          el2.addEventListener("blur", (function() {
            if (!el2.contains(document.activeElement))
              this.hide();
          }).bind(_this));
          el2.addEventListener("wheel", preventParentScroll);
          return _this;
        }
        HoverTooltip2.prototype.addToEditor = function(editor) {
          editor.on("mousemove", this.onMouseMove);
          editor.on("mousedown", this.hide);
          editor.renderer.getMouseEventTarget().addEventListener("mouseout", this.onMouseOut, true);
        };
        HoverTooltip2.prototype.removeFromEditor = function(editor) {
          editor.off("mousemove", this.onMouseMove);
          editor.off("mousedown", this.hide);
          editor.renderer.getMouseEventTarget().removeEventListener("mouseout", this.onMouseOut, true);
          if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
          }
        };
        HoverTooltip2.prototype.onMouseMove = function(e2, editor) {
          this.lastEvent = e2;
          this.lastT = Date.now();
          var isMousePressed = editor.$mouseHandler.isMousePressed;
          if (this.isOpen) {
            var pos = this.lastEvent && this.lastEvent.getDocumentPosition();
            if (!this.range || !this.range.contains(pos.row, pos.column) || isMousePressed || this.isOutsideOfText(this.lastEvent)) {
              this.hide();
            }
          }
          if (this.timeout || isMousePressed)
            return;
          this.lastEvent = e2;
          this.timeout = setTimeout(this.waitForHover, this.idleTime);
        };
        HoverTooltip2.prototype.waitForHover = function() {
          if (this.timeout)
            clearTimeout(this.timeout);
          var dt = Date.now() - this.lastT;
          if (this.idleTime - dt > 10) {
            this.timeout = setTimeout(this.waitForHover, this.idleTime - dt);
            return;
          }
          this.timeout = null;
          if (this.lastEvent && !this.isOutsideOfText(this.lastEvent)) {
            this.$gatherData(this.lastEvent, this.lastEvent.editor);
          }
        };
        HoverTooltip2.prototype.isOutsideOfText = function(e2) {
          var editor = e2.editor;
          var docPos = e2.getDocumentPosition();
          var line2 = editor.session.getLine(docPos.row);
          if (docPos.column == line2.length) {
            var screenPos = editor.renderer.pixelToScreenCoordinates(e2.clientX, e2.clientY);
            var clippedPos = editor.session.documentToScreenPosition(docPos.row, docPos.column);
            if (clippedPos.column != screenPos.column || clippedPos.row != screenPos.row) {
              return true;
            }
          }
          return false;
        };
        HoverTooltip2.prototype.setDataProvider = function(value2) {
          this.$gatherData = value2;
        };
        HoverTooltip2.prototype.showForRange = function(editor, range3, domNode, startingEvent) {
          var MARGIN = 10;
          if (startingEvent && startingEvent != this.lastEvent)
            return;
          if (this.isOpen && document.activeElement == this.getElement())
            return;
          var renderer = editor.renderer;
          if (!this.isOpen) {
            popupManager.addPopup(this);
            this.$registerCloseEvents();
            this.setTheme(renderer.theme);
          }
          this.isOpen = true;
          this.addMarker(range3, editor.session);
          this.range = Range.fromPoints(range3.start, range3.end);
          var position2 = renderer.textToScreenCoordinates(range3.start.row, range3.start.column);
          var rect = renderer.scroller.getBoundingClientRect();
          if (position2.pageX < rect.left)
            position2.pageX = rect.left;
          var element2 = this.getElement();
          element2.innerHTML = "";
          element2.appendChild(domNode);
          element2.style.maxHeight = "";
          element2.style.display = "block";
          var labelHeight = element2.clientHeight;
          var labelWidth = element2.clientWidth;
          var spaceBelow = window.innerHeight - position2.pageY - renderer.lineHeight;
          var isAbove = true;
          if (position2.pageY - labelHeight < 0 && position2.pageY < spaceBelow) {
            isAbove = false;
          }
          element2.style.maxHeight = (isAbove ? position2.pageY : spaceBelow) - MARGIN + "px";
          element2.style.top = isAbove ? "" : position2.pageY + renderer.lineHeight + "px";
          element2.style.bottom = isAbove ? window.innerHeight - position2.pageY + "px" : "";
          element2.style.left = Math.min(position2.pageX, window.innerWidth - labelWidth - MARGIN) + "px";
        };
        HoverTooltip2.prototype.addMarker = function(range3, session) {
          if (this.marker) {
            this.$markerSession.removeMarker(this.marker);
          }
          this.$markerSession = session;
          this.marker = session && session.addMarker(range3, "ace_highlight-marker", "text");
        };
        HoverTooltip2.prototype.hide = function(e2) {
          if (!e2 && document.activeElement == this.getElement())
            return;
          if (e2 && e2.target && (e2.type != "keydown" || e2.ctrlKey || e2.metaKey) && this.$element.contains(e2.target))
            return;
          this.lastEvent = null;
          if (this.timeout)
            clearTimeout(this.timeout);
          this.timeout = null;
          this.addMarker(null);
          if (this.isOpen) {
            this.$removeCloseEvents();
            this.getElement().style.display = "none";
            this.isOpen = false;
            popupManager.removePopup(this);
          }
        };
        HoverTooltip2.prototype.$registerCloseEvents = function() {
          window.addEventListener("keydown", this.hide, true);
          window.addEventListener("wheel", this.hide, true);
          window.addEventListener("mousedown", this.hide, true);
        };
        HoverTooltip2.prototype.$removeCloseEvents = function() {
          window.removeEventListener("keydown", this.hide, true);
          window.removeEventListener("wheel", this.hide, true);
          window.removeEventListener("mousedown", this.hide, true);
        };
        HoverTooltip2.prototype.onMouseOut = function(e2) {
          if (this.timeout) {
            clearTimeout(this.timeout);
            this.timeout = null;
          }
          this.lastEvent = null;
          if (!this.isOpen)
            return;
          if (!e2.relatedTarget || this.getElement().contains(e2.relatedTarget))
            return;
          if (e2 && e2.currentTarget.contains(e2.relatedTarget))
            return;
          if (!e2.relatedTarget.classList.contains("ace_content"))
            this.hide();
        };
        return HoverTooltip2;
      }(Tooltip3)
    );
    exports3.HoverTooltip = HoverTooltip;
  });
  ace.define("ace/mouse/default_gutter_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/tooltip", "ace/config"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var dom = require2("../lib/dom");
    var event = require2("../lib/event");
    var Tooltip3 = require2("../tooltip").Tooltip;
    var nls = require2("../config").nls;
    var GUTTER_TOOLTIP_LEFT_OFFSET = 5;
    var GUTTER_TOOLTIP_TOP_OFFSET = 3;
    exports3.GUTTER_TOOLTIP_LEFT_OFFSET = GUTTER_TOOLTIP_LEFT_OFFSET;
    exports3.GUTTER_TOOLTIP_TOP_OFFSET = GUTTER_TOOLTIP_TOP_OFFSET;
    function GutterHandler(mouseHandler) {
      var editor = mouseHandler.editor;
      var gutter = editor.renderer.$gutterLayer;
      var tooltip = new GutterTooltip(editor, true);
      mouseHandler.editor.setDefaultHandler("guttermousedown", function(e2) {
        if (!editor.isFocused() || e2.getButton() != 0)
          return;
        var gutterRegion = gutter.getRegion(e2);
        if (gutterRegion == "foldWidgets")
          return;
        var row = e2.getDocumentPosition().row;
        var selection = editor.session.selection;
        if (e2.getShiftKey())
          selection.selectTo(row, 0);
        else {
          if (e2.domEvent.detail == 2) {
            editor.selectAll();
            return e2.preventDefault();
          }
          mouseHandler.$clickSelection = editor.selection.getLineRange(row);
        }
        mouseHandler.setState("selectByLines");
        mouseHandler.captureMouse(e2);
        return e2.preventDefault();
      });
      var tooltipTimeout, mouseEvent;
      function showTooltip() {
        var row = mouseEvent.getDocumentPosition().row;
        var maxRow = editor.session.getLength();
        if (row == maxRow) {
          var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row;
          var pos = mouseEvent.$pos;
          if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column))
            return hideTooltip();
        }
        tooltip.showTooltip(row);
        if (!tooltip.isOpen)
          return;
        editor.on("mousewheel", hideTooltip);
        editor.on("changeSession", hideTooltip);
        window.addEventListener("keydown", hideTooltip, true);
        if (mouseHandler.$tooltipFollowsMouse) {
          moveTooltip(mouseEvent);
        } else {
          var gutterRow = mouseEvent.getGutterRow();
          var gutterCell = gutter.$lines.get(gutterRow);
          if (gutterCell) {
            var gutterElement = gutterCell.element.querySelector(".ace_gutter_annotation");
            var rect = gutterElement.getBoundingClientRect();
            var style2 = tooltip.getElement().style;
            style2.left = rect.right - GUTTER_TOOLTIP_LEFT_OFFSET + "px";
            style2.top = rect.bottom - GUTTER_TOOLTIP_TOP_OFFSET + "px";
          } else {
            moveTooltip(mouseEvent);
          }
        }
      }
      function hideTooltip(e2) {
        if (e2 && e2.type === "keydown" && (e2.ctrlKey || e2.metaKey))
          return;
        if (e2 && e2.type === "mouseout" && (!e2.relatedTarget || tooltip.getElement().contains(e2.relatedTarget)))
          return;
        if (tooltipTimeout)
          tooltipTimeout = clearTimeout(tooltipTimeout);
        if (tooltip.isOpen) {
          tooltip.hideTooltip();
          editor.off("mousewheel", hideTooltip);
          editor.off("changeSession", hideTooltip);
          window.removeEventListener("keydown", hideTooltip, true);
        }
      }
      function moveTooltip(e2) {
        tooltip.setPosition(e2.x, e2.y);
      }
      mouseHandler.editor.setDefaultHandler("guttermousemove", function(e2) {
        var target = e2.domEvent.target || e2.domEvent.srcElement;
        if (dom.hasCssClass(target, "ace_fold-widget") || dom.hasCssClass(target, "ace_custom-widget"))
          return hideTooltip();
        if (tooltip.isOpen && mouseHandler.$tooltipFollowsMouse)
          moveTooltip(e2);
        mouseEvent = e2;
        if (tooltipTimeout)
          return;
        tooltipTimeout = setTimeout(function() {
          tooltipTimeout = null;
          if (mouseEvent && !mouseHandler.isMousePressed)
            showTooltip();
        }, 50);
      });
      event.addListener(editor.renderer.$gutter, "mouseout", function(e2) {
        mouseEvent = null;
        if (!tooltip.isOpen)
          return;
        tooltipTimeout = setTimeout(function() {
          tooltipTimeout = null;
          hideTooltip(e2);
        }, 50);
      }, editor);
    }
    exports3.GutterHandler = GutterHandler;
    var GutterTooltip = (
      /** @class */
      function(_super) {
        __extends2(GutterTooltip2, _super);
        function GutterTooltip2(editor, isHover) {
          if (isHover === void 0) {
            isHover = false;
          }
          var _this = _super.call(this, editor.container) || this;
          _this.id = "gt" + ++GutterTooltip2.$uid;
          _this.editor = editor;
          _this.visibleTooltipRow;
          var el2 = _this.getElement();
          el2.setAttribute("role", "tooltip");
          el2.setAttribute("id", _this.id);
          el2.style.pointerEvents = "auto";
          if (isHover) {
            _this.onMouseOut = _this.onMouseOut.bind(_this);
            el2.addEventListener("mouseout", _this.onMouseOut);
          }
          return _this;
        }
        GutterTooltip2.prototype.onMouseOut = function(e2) {
          if (!this.isOpen)
            return;
          if (!e2.relatedTarget || this.getElement().contains(e2.relatedTarget))
            return;
          if (e2 && e2.currentTarget.contains(e2.relatedTarget))
            return;
          this.hideTooltip();
        };
        GutterTooltip2.prototype.setPosition = function(x2, y2) {
          var windowWidth = window.innerWidth || document.documentElement.clientWidth;
          var windowHeight = window.innerHeight || document.documentElement.clientHeight;
          var width = this.getWidth();
          var height = this.getHeight();
          x2 += 15;
          y2 += 15;
          if (x2 + width > windowWidth) {
            x2 -= x2 + width - windowWidth;
          }
          if (y2 + height > windowHeight) {
            y2 -= 20 + height;
          }
          Tooltip3.prototype.setPosition.call(this, x2, y2);
        };
        Object.defineProperty(GutterTooltip2, "annotationLabels", {
          get: function() {
            return {
              error: {
                singular: nls("gutter-tooltip.aria-label.error.singular", "error"),
                plural: nls("gutter-tooltip.aria-label.error.plural", "errors")
              },
              security: {
                singular: nls("gutter-tooltip.aria-label.security.singular", "security finding"),
                plural: nls("gutter-tooltip.aria-label.security.plural", "security findings")
              },
              warning: {
                singular: nls("gutter-tooltip.aria-label.warning.singular", "warning"),
                plural: nls("gutter-tooltip.aria-label.warning.plural", "warnings")
              },
              info: {
                singular: nls("gutter-tooltip.aria-label.info.singular", "information message"),
                plural: nls("gutter-tooltip.aria-label.info.plural", "information messages")
              },
              hint: {
                singular: nls("gutter-tooltip.aria-label.hint.singular", "suggestion"),
                plural: nls("gutter-tooltip.aria-label.hint.plural", "suggestions")
              }
            };
          },
          enumerable: false,
          configurable: true
        });
        GutterTooltip2.prototype.showTooltip = function(row) {
          var _a2;
          var gutter = this.editor.renderer.$gutterLayer;
          var annotationsInRow = gutter.$annotations[row];
          var annotation;
          if (annotationsInRow)
            annotation = {
              displayText: Array.from(annotationsInRow.displayText),
              type: Array.from(annotationsInRow.type)
            };
          else
            annotation = { displayText: [], type: [] };
          var fold = gutter.session.getFoldLine(row);
          if (fold && gutter.$showFoldedAnnotations) {
            var annotationsInFold = { error: [], security: [], warning: [], info: [], hint: [] };
            var severityRank = { error: 1, security: 2, warning: 3, info: 4, hint: 5 };
            var mostSevereAnnotationTypeInFold;
            for (var i2 = row + 1; i2 <= fold.end.row; i2++) {
              if (!gutter.$annotations[i2])
                continue;
              for (var j2 = 0; j2 < gutter.$annotations[i2].text.length; j2++) {
                var annotationType = gutter.$annotations[i2].type[j2];
                annotationsInFold[annotationType].push(gutter.$annotations[i2].text[j2]);
                if (!mostSevereAnnotationTypeInFold || severityRank[annotationType] < severityRank[mostSevereAnnotationTypeInFold]) {
                  mostSevereAnnotationTypeInFold = annotationType;
                }
              }
            }
            if (["error", "security", "warning"].includes(mostSevereAnnotationTypeInFold)) {
              var summaryFoldedAnnotations = "".concat(GutterTooltip2.annotationsToSummaryString(annotationsInFold), " in folded code.");
              annotation.displayText.push(summaryFoldedAnnotations);
              annotation.type.push(mostSevereAnnotationTypeInFold + "_fold");
            }
          }
          if (annotation.displayText.length === 0)
            return this.hideTooltip();
          var annotationMessages = { error: [], security: [], warning: [], info: [], hint: [] };
          var iconClassName = gutter.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon";
          for (var i2 = 0; i2 < annotation.displayText.length; i2++) {
            var lineElement = dom.createElement("span");
            var iconElement = dom.createElement("span");
            (_a2 = iconElement.classList).add.apply(_a2, ["ace_".concat(annotation.type[i2]), iconClassName]);
            iconElement.setAttribute("aria-label", "".concat(GutterTooltip2.annotationLabels[annotation.type[i2].replace("_fold", "")].singular));
            iconElement.setAttribute("role", "img");
            iconElement.appendChild(dom.createTextNode(" "));
            lineElement.appendChild(iconElement);
            lineElement.appendChild(dom.createTextNode(annotation.displayText[i2]));
            lineElement.appendChild(dom.createElement("br"));
            annotationMessages[annotation.type[i2].replace("_fold", "")].push(lineElement);
          }
          var tooltipElement = this.getElement();
          dom.removeChildren(tooltipElement);
          annotationMessages.error.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.security.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.warning.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.info.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          annotationMessages.hint.forEach(function(el2) {
            return tooltipElement.appendChild(el2);
          });
          tooltipElement.setAttribute("aria-live", "polite");
          if (!this.isOpen) {
            this.setTheme(this.editor.renderer.theme);
            this.setClassName("ace_gutter-tooltip");
          }
          var annotationNode = this.$findLinkedAnnotationNode(row);
          if (annotationNode) {
            annotationNode.setAttribute("aria-describedby", this.id);
          }
          this.show();
          this.visibleTooltipRow = row;
          this.editor._signal("showGutterTooltip", this);
        };
        GutterTooltip2.prototype.$findLinkedAnnotationNode = function(row) {
          var cell = this.$findCellByRow(row);
          if (cell) {
            var element2 = cell.element;
            if (element2.childNodes.length > 2) {
              return element2.childNodes[2];
            }
          }
        };
        GutterTooltip2.prototype.$findCellByRow = function(row) {
          return this.editor.renderer.$gutterLayer.$lines.cells.find(function(el2) {
            return el2.row === row;
          });
        };
        GutterTooltip2.prototype.hideTooltip = function() {
          if (!this.isOpen) {
            return;
          }
          this.$element.removeAttribute("aria-live");
          this.hide();
          if (this.visibleTooltipRow != void 0) {
            var annotationNode = this.$findLinkedAnnotationNode(this.visibleTooltipRow);
            if (annotationNode) {
              annotationNode.removeAttribute("aria-describedby");
            }
          }
          this.visibleTooltipRow = void 0;
          this.editor._signal("hideGutterTooltip", this);
        };
        GutterTooltip2.annotationsToSummaryString = function(annotations) {
          var e_1, _a2;
          var summary = [];
          var annotationTypes = ["error", "security", "warning", "info", "hint"];
          try {
            for (var annotationTypes_1 = __values(annotationTypes), annotationTypes_1_1 = annotationTypes_1.next(); !annotationTypes_1_1.done; annotationTypes_1_1 = annotationTypes_1.next()) {
              var annotationType = annotationTypes_1_1.value;
              if (!annotations[annotationType].length)
                continue;
              var label = annotations[annotationType].length === 1 ? GutterTooltip2.annotationLabels[annotationType].singular : GutterTooltip2.annotationLabels[annotationType].plural;
              summary.push("".concat(annotations[annotationType].length, " ").concat(label));
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (annotationTypes_1_1 && !annotationTypes_1_1.done && (_a2 = annotationTypes_1.return))
                _a2.call(annotationTypes_1);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
          return summary.join(", ");
        };
        return GutterTooltip2;
      }(Tooltip3)
    );
    GutterTooltip.$uid = 0;
    exports3.GutterTooltip = GutterTooltip;
  });
  ace.define("ace/mouse/mouse_event", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var MouseEvent2 = (
      /** @class */
      function() {
        function MouseEvent3(domEvent, editor) {
          this.speed;
          this.wheelX;
          this.wheelY;
          this.domEvent = domEvent;
          this.editor = editor;
          this.x = this.clientX = domEvent.clientX;
          this.y = this.clientY = domEvent.clientY;
          this.$pos = null;
          this.$inSelection = null;
          this.propagationStopped = false;
          this.defaultPrevented = false;
        }
        MouseEvent3.prototype.stopPropagation = function() {
          event.stopPropagation(this.domEvent);
          this.propagationStopped = true;
        };
        MouseEvent3.prototype.preventDefault = function() {
          event.preventDefault(this.domEvent);
          this.defaultPrevented = true;
        };
        MouseEvent3.prototype.stop = function() {
          this.stopPropagation();
          this.preventDefault();
        };
        MouseEvent3.prototype.getDocumentPosition = function() {
          if (this.$pos)
            return this.$pos;
          this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
          return this.$pos;
        };
        MouseEvent3.prototype.getGutterRow = function() {
          var documentRow = this.getDocumentPosition().row;
          var screenRow = this.editor.session.documentToScreenRow(documentRow, 0);
          var screenTopRow = this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row, 0);
          return screenRow - screenTopRow;
        };
        MouseEvent3.prototype.inSelection = function() {
          if (this.$inSelection !== null)
            return this.$inSelection;
          var editor = this.editor;
          var selectionRange = editor.getSelectionRange();
          if (selectionRange.isEmpty())
            this.$inSelection = false;
          else {
            var pos = this.getDocumentPosition();
            this.$inSelection = selectionRange.contains(pos.row, pos.column);
          }
          return this.$inSelection;
        };
        MouseEvent3.prototype.getButton = function() {
          return event.getButton(this.domEvent);
        };
        MouseEvent3.prototype.getShiftKey = function() {
          return this.domEvent.shiftKey;
        };
        MouseEvent3.prototype.getAccelKey = function() {
          return useragent.isMac ? this.domEvent.metaKey : this.domEvent.ctrlKey;
        };
        return MouseEvent3;
      }()
    );
    exports3.MouseEvent = MouseEvent2;
  });
  ace.define("ace/mouse/dragdrop_handler", ["require", "exports", "module", "ace/lib/dom", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var AUTOSCROLL_DELAY = 200;
    var SCROLL_CURSOR_DELAY = 200;
    var SCROLL_CURSOR_HYSTERESIS = 5;
    function DragdropHandler(mouseHandler) {
      var editor = mouseHandler.editor;
      var dragImage = dom.createElement("div");
      dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5";
      dragImage.textContent = " ";
      var exports4 = ["dragWait", "dragWaitEnd", "startDrag", "dragReadyEnd", "onMouseDrag"];
      exports4.forEach(function(x3) {
        mouseHandler[x3] = this[x3];
      }, this);
      editor.on("mousedown", this.onMouseDown.bind(mouseHandler));
      var mouseTarget = editor.container;
      var dragSelectionMarker, x2, y2;
      var timerId, range3;
      var dragCursor, counter = 0;
      var dragOperation;
      var isInternal;
      var autoScrollStartTime;
      var cursorMovedTime;
      var cursorPointOnCaretMoved;
      this.onDragStart = function(e2) {
        if (this.cancelDrag || !mouseTarget.draggable) {
          var self2 = this;
          setTimeout(function() {
            self2.startSelect();
            self2.captureMouse(e2);
          }, 0);
          return e2.preventDefault();
        }
        range3 = editor.getSelectionRange();
        var dataTransfer = e2.dataTransfer;
        dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove";
        editor.container.appendChild(dragImage);
        dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0);
        setTimeout(function() {
          editor.container.removeChild(dragImage);
        });
        dataTransfer.clearData();
        dataTransfer.setData("Text", editor.session.getTextRange());
        isInternal = true;
        this.setState("drag");
      };
      this.onDragEnd = function(e2) {
        mouseTarget.draggable = false;
        isInternal = false;
        this.setState(null);
        if (!editor.getReadOnly()) {
          var dropEffect = e2.dataTransfer.dropEffect;
          if (!dragOperation && dropEffect == "move")
            editor.session.remove(editor.getSelectionRange());
          editor.$resetCursorStyle();
        }
        this.editor.unsetStyle("ace_dragging");
        this.editor.renderer.setCursorStyle("");
      };
      this.onDragEnter = function(e2) {
        if (editor.getReadOnly() || !canAccept(e2.dataTransfer))
          return;
        x2 = e2.clientX;
        y2 = e2.clientY;
        if (!dragSelectionMarker)
          addDragMarker();
        counter++;
        e2.dataTransfer.dropEffect = dragOperation = getDropEffect(e2);
        return event.preventDefault(e2);
      };
      this.onDragOver = function(e2) {
        if (editor.getReadOnly() || !canAccept(e2.dataTransfer))
          return;
        x2 = e2.clientX;
        y2 = e2.clientY;
        if (!dragSelectionMarker) {
          addDragMarker();
          counter++;
        }
        if (onMouseMoveTimer !== null)
          onMouseMoveTimer = null;
        e2.dataTransfer.dropEffect = dragOperation = getDropEffect(e2);
        return event.preventDefault(e2);
      };
      this.onDragLeave = function(e2) {
        counter--;
        if (counter <= 0 && dragSelectionMarker) {
          clearDragMarker();
          dragOperation = null;
          return event.preventDefault(e2);
        }
      };
      this.onDrop = function(e2) {
        if (!dragCursor)
          return;
        var dataTransfer = e2.dataTransfer;
        if (isInternal) {
          switch (dragOperation) {
            case "move":
              if (range3.contains(dragCursor.row, dragCursor.column)) {
                range3 = {
                  start: dragCursor,
                  end: dragCursor
                };
              } else {
                range3 = editor.moveText(range3, dragCursor);
              }
              break;
            case "copy":
              range3 = editor.moveText(range3, dragCursor, true);
              break;
          }
        } else {
          var dropData = dataTransfer.getData("Text");
          range3 = {
            start: dragCursor,
            end: editor.session.insert(dragCursor, dropData)
          };
          editor.focus();
          dragOperation = null;
        }
        clearDragMarker();
        return event.preventDefault(e2);
      };
      event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor);
      event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor);
      event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor);
      event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor);
      event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor);
      event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor);
      function scrollCursorIntoView(cursor, prevCursor) {
        var now2 = Date.now();
        var vMovement = !prevCursor || cursor.row != prevCursor.row;
        var hMovement = !prevCursor || cursor.column != prevCursor.column;
        if (!cursorMovedTime || vMovement || hMovement) {
          editor.moveCursorToPosition(cursor);
          cursorMovedTime = now2;
          cursorPointOnCaretMoved = { x: x2, y: y2 };
        } else {
          var distance2 = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x2, y2);
          if (distance2 > SCROLL_CURSOR_HYSTERESIS) {
            cursorMovedTime = null;
          } else if (now2 - cursorMovedTime >= SCROLL_CURSOR_DELAY) {
            editor.renderer.scrollCursorIntoView();
            cursorMovedTime = null;
          }
        }
      }
      function autoScroll(cursor, prevCursor) {
        var now2 = Date.now();
        var lineHeight2 = editor.renderer.layerConfig.lineHeight;
        var characterWidth = editor.renderer.layerConfig.characterWidth;
        var editorRect = editor.renderer.scroller.getBoundingClientRect();
        var offsets = {
          x: {
            left: x2 - editorRect.left,
            right: editorRect.right - x2
          },
          y: {
            top: y2 - editorRect.top,
            bottom: editorRect.bottom - y2
          }
        };
        var nearestXOffset = Math.min(offsets.x.left, offsets.x.right);
        var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom);
        var scrollCursor = { row: cursor.row, column: cursor.column };
        if (nearestXOffset / characterWidth <= 2) {
          scrollCursor.column += offsets.x.left < offsets.x.right ? -3 : 2;
        }
        if (nearestYOffset / lineHeight2 <= 1) {
          scrollCursor.row += offsets.y.top < offsets.y.bottom ? -1 : 1;
        }
        var vScroll = cursor.row != scrollCursor.row;
        var hScroll = cursor.column != scrollCursor.column;
        var vMovement = !prevCursor || cursor.row != prevCursor.row;
        if (vScroll || hScroll && !vMovement) {
          if (!autoScrollStartTime)
            autoScrollStartTime = now2;
          else if (now2 - autoScrollStartTime >= AUTOSCROLL_DELAY)
            editor.renderer.scrollCursorIntoView(scrollCursor);
        } else {
          autoScrollStartTime = null;
        }
      }
      function onDragInterval() {
        var prevCursor = dragCursor;
        dragCursor = editor.renderer.screenToTextCoordinates(x2, y2);
        scrollCursorIntoView(dragCursor, prevCursor);
        autoScroll(dragCursor, prevCursor);
      }
      function addDragMarker() {
        range3 = editor.selection.toOrientedRange();
        dragSelectionMarker = editor.session.addMarker(range3, "ace_selection", editor.getSelectionStyle());
        editor.clearSelection();
        if (editor.isFocused())
          editor.renderer.$cursorLayer.setBlinking(false);
        clearInterval(timerId);
        onDragInterval();
        timerId = setInterval(onDragInterval, 20);
        counter = 0;
        event.addListener(document, "mousemove", onMouseMove);
      }
      function clearDragMarker() {
        clearInterval(timerId);
        editor.session.removeMarker(dragSelectionMarker);
        dragSelectionMarker = null;
        editor.selection.fromOrientedRange(range3);
        if (editor.isFocused() && !isInternal)
          editor.$resetCursorStyle();
        range3 = null;
        dragCursor = null;
        counter = 0;
        autoScrollStartTime = null;
        cursorMovedTime = null;
        event.removeListener(document, "mousemove", onMouseMove);
      }
      var onMouseMoveTimer = null;
      function onMouseMove() {
        if (onMouseMoveTimer == null) {
          onMouseMoveTimer = setTimeout(function() {
            if (onMouseMoveTimer != null && dragSelectionMarker)
              clearDragMarker();
          }, 20);
        }
      }
      function canAccept(dataTransfer) {
        var types2 = dataTransfer.types;
        return !types2 || Array.prototype.some.call(types2, function(type4) {
          return type4 == "text/plain" || type4 == "Text";
        });
      }
      function getDropEffect(e2) {
        var copyAllowed = ["copy", "copymove", "all", "uninitialized"];
        var moveAllowed = ["move", "copymove", "linkmove", "all", "uninitialized"];
        var copyModifierState = useragent.isMac ? e2.altKey : e2.ctrlKey;
        var effectAllowed = "uninitialized";
        try {
          effectAllowed = e2.dataTransfer.effectAllowed.toLowerCase();
        } catch (e3) {
        }
        var dropEffect = "none";
        if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "copy";
        else if (moveAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "move";
        else if (copyAllowed.indexOf(effectAllowed) >= 0)
          dropEffect = "copy";
        return dropEffect;
      }
    }
    (function() {
      this.dragWait = function() {
        var interval = Date.now() - this.mousedownEvent.time;
        if (interval > this.editor.getDragDelay())
          this.startDrag();
      };
      this.dragWaitEnd = function() {
        var target = this.editor.container;
        target.draggable = false;
        this.startSelect(this.mousedownEvent.getDocumentPosition());
        this.selectEnd();
      };
      this.dragReadyEnd = function(e2) {
        this.editor.$resetCursorStyle();
        this.editor.unsetStyle("ace_dragging");
        this.editor.renderer.setCursorStyle("");
        this.dragWaitEnd();
      };
      this.startDrag = function() {
        this.cancelDrag = false;
        var editor = this.editor;
        var target = editor.container;
        target.draggable = true;
        editor.renderer.$cursorLayer.setBlinking(false);
        editor.setStyle("ace_dragging");
        var cursorStyle = useragent.isWin ? "default" : "move";
        editor.renderer.setCursorStyle(cursorStyle);
        this.setState("dragReady");
      };
      this.onMouseDrag = function(e2) {
        var target = this.editor.container;
        if (useragent.isIE && this.state == "dragReady") {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          if (distance2 > 3)
            target.dragDrop();
        }
        if (this.state === "dragWait") {
          var distance2 = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
          if (distance2 > 0) {
            target.draggable = false;
            this.startSelect(this.mousedownEvent.getDocumentPosition());
          }
        }
      };
      this.onMouseDown = function(e2) {
        if (!this.$dragEnabled)
          return;
        this.mousedownEvent = e2;
        var editor = this.editor;
        var inSelection = e2.inSelection();
        var button2 = e2.getButton();
        var clickCount = e2.domEvent.detail || 1;
        if (clickCount === 1 && button2 === 0 && inSelection) {
          if (e2.editor.inMultiSelectMode && (e2.getAccelKey() || e2.getShiftKey()))
            return;
          this.mousedownEvent.time = Date.now();
          var eventTarget = e2.domEvent.target || e2.domEvent.srcElement;
          if ("unselectable" in eventTarget)
            eventTarget.unselectable = "on";
          if (editor.getDragDelay()) {
            if (useragent.isWebKit) {
              this.cancelDrag = true;
              var mouseTarget = editor.container;
              mouseTarget.draggable = true;
            }
            this.setState("dragWait");
          } else {
            this.startDrag();
          }
          this.captureMouse(e2, this.onMouseDrag.bind(this));
          e2.defaultPrevented = true;
        }
      };
    }).call(DragdropHandler.prototype);
    function calcDistance(ax, ay, bx, by) {
      return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
    }
    exports3.DragdropHandler = DragdropHandler;
  });
  ace.define("ace/mouse/touch_handler", ["require", "exports", "module", "ace/mouse/mouse_event", "ace/lib/event", "ace/lib/dom"], function(require2, exports3, module3) {
    var MouseEvent2 = require2("./mouse_event").MouseEvent;
    var event = require2("../lib/event");
    var dom = require2("../lib/dom");
    exports3.addTouchListeners = function(el2, editor) {
      var mode = "scroll";
      var startX;
      var startY;
      var touchStartT;
      var lastT;
      var longTouchTimer;
      var animationTimer;
      var animationSteps = 0;
      var pos;
      var clickCount = 0;
      var vX = 0;
      var vY = 0;
      var pressed;
      var contextMenu;
      function createContextMenu() {
        var clipboard = window.navigator && window.navigator.clipboard;
        var isOpen = false;
        var updateMenu = function() {
          var selected = editor.getCopyText();
          var hasUndo = editor.session.getUndoManager().hasUndo();
          contextMenu.replaceChild(dom.buildDom(isOpen ? [
            "span",
            !selected && canExecuteCommand("selectall") && ["span", { class: "ace_mobile-button", action: "selectall" }, "Select All"],
            selected && canExecuteCommand("copy") && ["span", { class: "ace_mobile-button", action: "copy" }, "Copy"],
            selected && canExecuteCommand("cut") && ["span", { class: "ace_mobile-button", action: "cut" }, "Cut"],
            clipboard && canExecuteCommand("paste") && ["span", { class: "ace_mobile-button", action: "paste" }, "Paste"],
            hasUndo && canExecuteCommand("undo") && ["span", { class: "ace_mobile-button", action: "undo" }, "Undo"],
            canExecuteCommand("find") && ["span", { class: "ace_mobile-button", action: "find" }, "Find"],
            canExecuteCommand("openCommandPalette") && ["span", { class: "ace_mobile-button", action: "openCommandPalette" }, "Palette"]
          ] : ["span"]), contextMenu.firstChild);
        };
        var canExecuteCommand = function(cmd) {
          return editor.commands.canExecute(cmd, editor);
        };
        var handleClick = function(e2) {
          var action = e2.target.getAttribute("action");
          if (action == "more" || !isOpen) {
            isOpen = !isOpen;
            return updateMenu();
          }
          if (action == "paste") {
            clipboard.readText().then(function(text2) {
              editor.execCommand(action, text2);
            });
          } else if (action) {
            if (action == "cut" || action == "copy") {
              if (clipboard)
                clipboard.writeText(editor.getCopyText());
              else
                document.execCommand("copy");
            }
            editor.execCommand(action);
          }
          contextMenu.firstChild.style.display = "none";
          isOpen = false;
          if (action != "openCommandPalette")
            editor.focus();
        };
        contextMenu = dom.buildDom([
          "div",
          {
            class: "ace_mobile-menu",
            ontouchstart: function(e2) {
              mode = "menu";
              e2.stopPropagation();
              e2.preventDefault();
              editor.textInput.focus();
            },
            ontouchend: function(e2) {
              e2.stopPropagation();
              e2.preventDefault();
              handleClick(e2);
            },
            onclick: handleClick
          },
          ["span"],
          ["span", { class: "ace_mobile-button", action: "more" }, "..."]
        ], editor.container);
      }
      function showContextMenu() {
        if (!editor.getOption("enableMobileMenu")) {
          if (contextMenu) {
            hideContextMenu();
          }
          return;
        }
        if (!contextMenu)
          createContextMenu();
        var cursor = editor.selection.cursor;
        var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);
        var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX;
        var scrollLeft = editor.renderer.scrollLeft;
        var rect = editor.container.getBoundingClientRect();
        contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px";
        if (pagePos.pageX - rect.left < rect.width - 70) {
          contextMenu.style.left = "";
          contextMenu.style.right = "10px";
        } else {
          contextMenu.style.right = "";
          contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px";
        }
        contextMenu.style.display = "";
        contextMenu.firstChild.style.display = "none";
        editor.on("input", hideContextMenu);
      }
      function hideContextMenu(e2) {
        if (contextMenu)
          contextMenu.style.display = "none";
        editor.off("input", hideContextMenu);
      }
      function handleLongTap() {
        longTouchTimer = null;
        clearTimeout(longTouchTimer);
        var range3 = editor.selection.getRange();
        var inSelection = range3.contains(pos.row, pos.column);
        if (range3.isEmpty() || !inSelection) {
          editor.selection.moveToPosition(pos);
          editor.selection.selectWord();
        }
        mode = "wait";
        showContextMenu();
      }
      function switchToSelectionMode() {
        longTouchTimer = null;
        clearTimeout(longTouchTimer);
        editor.selection.moveToPosition(pos);
        var range3 = clickCount >= 2 ? editor.selection.getLineRange(pos.row) : editor.session.getBracketRange(pos);
        if (range3 && !range3.isEmpty()) {
          editor.selection.setRange(range3);
        } else {
          editor.selection.selectWord();
        }
        mode = "wait";
      }
      event.addListener(el2, "contextmenu", function(e2) {
        if (!pressed)
          return;
        var textarea = editor.textInput.getElement();
        textarea.focus();
      }, editor);
      event.addListener(el2, "touchstart", function(e2) {
        var touches = e2.touches;
        if (longTouchTimer || touches.length > 1) {
          clearTimeout(longTouchTimer);
          longTouchTimer = null;
          touchStartT = -1;
          mode = "zoom";
          return;
        }
        pressed = editor.$mouseHandler.isMousePressed = true;
        var h3 = editor.renderer.layerConfig.lineHeight;
        var w2 = editor.renderer.layerConfig.lineHeight;
        var t2 = e2.timeStamp;
        lastT = t2;
        var touchObj = touches[0];
        var x2 = touchObj.clientX;
        var y2 = touchObj.clientY;
        if (Math.abs(startX - x2) + Math.abs(startY - y2) > h3)
          touchStartT = -1;
        startX = e2.clientX = x2;
        startY = e2.clientY = y2;
        vX = vY = 0;
        var ev = new MouseEvent2(e2, editor);
        pos = ev.getDocumentPosition();
        if (t2 - touchStartT < 500 && touches.length == 1 && !animationSteps) {
          clickCount++;
          e2.preventDefault();
          e2.button = 0;
          switchToSelectionMode();
        } else {
          clickCount = 0;
          var cursor = editor.selection.cursor;
          var anchor = editor.selection.isEmpty() ? cursor : editor.selection.anchor;
          var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true);
          var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true);
          var rect = editor.renderer.scroller.getBoundingClientRect();
          var offsetTop = editor.renderer.layerConfig.offset;
          var offsetLeft = editor.renderer.scrollLeft;
          var weightedDistance = function(x3, y3) {
            x3 = x3 / w2;
            y3 = y3 / h3 - 0.75;
            return x3 * x3 + y3 * y3;
          };
          if (e2.clientX < rect.left) {
            mode = "zoom";
            return;
          }
          var diff1 = weightedDistance(e2.clientX - rect.left - cursorPos.left + offsetLeft, e2.clientY - rect.top - cursorPos.top + offsetTop);
          var diff2 = weightedDistance(e2.clientX - rect.left - anchorPos.left + offsetLeft, e2.clientY - rect.top - anchorPos.top + offsetTop);
          if (diff1 < 3.5 && diff2 < 3.5)
            mode = diff1 > diff2 ? "cursor" : "anchor";
          if (diff2 < 3.5)
            mode = "anchor";
          else if (diff1 < 3.5)
            mode = "cursor";
          else
            mode = "scroll";
          longTouchTimer = setTimeout(handleLongTap, 450);
        }
        touchStartT = t2;
      }, editor);
      event.addListener(el2, "touchend", function(e2) {
        pressed = editor.$mouseHandler.isMousePressed = false;
        if (animationTimer)
          clearInterval(animationTimer);
        if (mode == "zoom") {
          mode = "";
          animationSteps = 0;
        } else if (longTouchTimer) {
          editor.selection.moveToPosition(pos);
          animationSteps = 0;
          showContextMenu();
        } else if (mode == "scroll") {
          animate();
          hideContextMenu();
        } else {
          showContextMenu();
        }
        clearTimeout(longTouchTimer);
        longTouchTimer = null;
      }, editor);
      event.addListener(el2, "touchmove", function(e2) {
        if (longTouchTimer) {
          clearTimeout(longTouchTimer);
          longTouchTimer = null;
        }
        var touches = e2.touches;
        if (touches.length > 1 || mode == "zoom")
          return;
        var touchObj = touches[0];
        var wheelX = startX - touchObj.clientX;
        var wheelY = startY - touchObj.clientY;
        if (mode == "wait") {
          if (wheelX * wheelX + wheelY * wheelY > 4)
            mode = "cursor";
          else
            return e2.preventDefault();
        }
        startX = touchObj.clientX;
        startY = touchObj.clientY;
        e2.clientX = touchObj.clientX;
        e2.clientY = touchObj.clientY;
        var t2 = e2.timeStamp;
        var dt = t2 - lastT;
        lastT = t2;
        if (mode == "scroll") {
          var mouseEvent = new MouseEvent2(e2, editor);
          mouseEvent.speed = 1;
          mouseEvent.wheelX = wheelX;
          mouseEvent.wheelY = wheelY;
          if (10 * Math.abs(wheelX) < Math.abs(wheelY))
            wheelX = 0;
          if (10 * Math.abs(wheelY) < Math.abs(wheelX))
            wheelY = 0;
          if (dt != 0) {
            vX = wheelX / dt;
            vY = wheelY / dt;
          }
          editor._emit("mousewheel", mouseEvent);
          if (!mouseEvent.propagationStopped) {
            vX = vY = 0;
          }
        } else {
          var ev = new MouseEvent2(e2, editor);
          var pos2 = ev.getDocumentPosition();
          if (mode == "cursor")
            editor.selection.moveCursorToPosition(pos2);
          else if (mode == "anchor")
            editor.selection.setSelectionAnchor(pos2.row, pos2.column);
          editor.renderer.scrollCursorIntoView(pos2);
          e2.preventDefault();
        }
      }, editor);
      function animate() {
        animationSteps += 60;
        animationTimer = setInterval(function() {
          if (animationSteps-- <= 0) {
            clearInterval(animationTimer);
            animationTimer = null;
          }
          if (Math.abs(vX) < 0.01)
            vX = 0;
          if (Math.abs(vY) < 0.01)
            vY = 0;
          if (animationSteps < 20)
            vX = 0.9 * vX;
          if (animationSteps < 20)
            vY = 0.9 * vY;
          var oldScrollTop = editor.session.getScrollTop();
          editor.renderer.scrollBy(10 * vX, 10 * vY);
          if (oldScrollTop == editor.session.getScrollTop())
            animationSteps = 0;
        }, 10);
      }
    };
  });
  ace.define("ace/mouse/mouse_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent", "ace/mouse/default_handlers", "ace/mouse/default_gutter_handler", "ace/mouse/mouse_event", "ace/mouse/dragdrop_handler", "ace/mouse/touch_handler", "ace/config"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var DefaultHandlers = require2("./default_handlers").DefaultHandlers;
    var DefaultGutterHandler = require2("./default_gutter_handler").GutterHandler;
    var MouseEvent2 = require2("./mouse_event").MouseEvent;
    var DragdropHandler = require2("./dragdrop_handler").DragdropHandler;
    var addTouchListeners = require2("./touch_handler").addTouchListeners;
    var config2 = require2("../config");
    var MouseHandler = (
      /** @class */
      function() {
        function MouseHandler2(editor) {
          this.$dragDelay;
          this.$dragEnabled;
          this.$mouseMoved;
          this.mouseEvent;
          this.$focusTimeout;
          var _self = this;
          this.editor = editor;
          new DefaultHandlers(this);
          new DefaultGutterHandler(this);
          new DragdropHandler(this);
          var focusEditor = function(e2) {
            var windowBlurred = !document.hasFocus || !document.hasFocus() || !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement());
            if (windowBlurred)
              window.focus();
            editor.focus();
            setTimeout(function() {
              if (!editor.isFocused())
                editor.focus();
            });
          };
          var mouseTarget = editor.renderer.getMouseEventTarget();
          event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor);
          event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor);
          event.addMultiMouseDownListener([
            mouseTarget,
            editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner,
            editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner,
            editor.textInput && editor.textInput.getElement()
          ].filter(Boolean), [400, 300, 250], this, "onMouseEvent", editor);
          event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor);
          addTouchListeners(editor.container, editor);
          var gutterEl = editor.renderer.$gutter;
          event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor);
          event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor);
          event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor);
          event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor);
          event.addListener(mouseTarget, "mousedown", focusEditor, editor);
          event.addListener(gutterEl, "mousedown", focusEditor, editor);
          if (useragent.isIE && editor.renderer.scrollBarV) {
            event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor);
            event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor);
          }
          editor.on(
            "mousemove",
            function(e2) {
              if (_self.state || _self.$dragDelay || !_self.$dragEnabled)
                return;
              var character2 = editor.renderer.screenToTextCoordinates(e2.x, e2.y);
              var range3 = editor.session.selection.getRange();
              var renderer = editor.renderer;
              if (!range3.isEmpty() && range3.insideStart(character2.row, character2.column)) {
                renderer.setCursorStyle("default");
              } else {
                renderer.setCursorStyle("");
              }
            },
            //@ts-expect-error TODO: seems mistyping - should be boolean
            editor
          );
        }
        MouseHandler2.prototype.onMouseEvent = function(name2, e2) {
          if (!this.editor.session)
            return;
          this.editor._emit(name2, new MouseEvent2(e2, this.editor));
        };
        MouseHandler2.prototype.onMouseMove = function(name2, e2) {
          var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
          if (!listeners || !listeners.length)
            return;
          this.editor._emit(name2, new MouseEvent2(e2, this.editor));
        };
        MouseHandler2.prototype.onMouseWheel = function(name2, e2) {
          var mouseEvent = new MouseEvent2(e2, this.editor);
          mouseEvent.speed = this.$scrollSpeed * 2;
          mouseEvent.wheelX = e2.wheelX;
          mouseEvent.wheelY = e2.wheelY;
          this.editor._emit(name2, mouseEvent);
        };
        MouseHandler2.prototype.setState = function(state) {
          this.state = state;
        };
        MouseHandler2.prototype.captureMouse = function(ev, mouseMoveHandler) {
          this.x = ev.x;
          this.y = ev.y;
          this.isMousePressed = true;
          var editor = this.editor;
          var renderer = this.editor.renderer;
          renderer.$isMousePressed = true;
          var self2 = this;
          var continueCapture = true;
          var onMouseMove = function(e2) {
            if (!e2)
              return;
            if (useragent.isWebKit && !e2.which && self2.releaseMouse)
              return self2.releaseMouse();
            self2.x = e2.clientX;
            self2.y = e2.clientY;
            mouseMoveHandler && mouseMoveHandler(e2);
            self2.mouseEvent = new MouseEvent2(e2, self2.editor);
            self2.$mouseMoved = true;
          };
          var onCaptureEnd = function(e2) {
            editor.off("beforeEndOperation", onOperationEnd);
            continueCapture = false;
            if (editor.session)
              onCaptureUpdate();
            self2[self2.state + "End"] && self2[self2.state + "End"](e2);
            self2.state = "";
            self2.isMousePressed = renderer.$isMousePressed = false;
            if (renderer.$keepTextAreaAtCursor)
              renderer.$moveTextAreaToCursor();
            self2.$onCaptureMouseMove = self2.releaseMouse = null;
            e2 && self2.onMouseEvent("mouseup", e2);
            editor.endOperation();
          };
          var onCaptureUpdate = function() {
            self2[self2.state] && self2[self2.state]();
            self2.$mouseMoved = false;
          };
          var onCaptureInterval = function() {
            if (continueCapture) {
              onCaptureUpdate();
              event.nextFrame(onCaptureInterval);
            }
          };
          if (useragent.isOldIE && ev.domEvent.type == "dblclick") {
            return setTimeout(function() {
              onCaptureEnd(ev);
            });
          }
          var onOperationEnd = function(e2) {
            if (!self2.releaseMouse)
              return;
            if (editor.curOp.command.name && editor.curOp.selectionChanged) {
              self2[self2.state + "End"] && self2[self2.state + "End"]();
              self2.state = "";
              self2.releaseMouse();
            }
          };
          editor.on("beforeEndOperation", onOperationEnd);
          editor.startOperation({ command: { name: "mouse" } });
          self2.$onCaptureMouseMove = onMouseMove;
          self2.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd);
          onCaptureInterval();
        };
        MouseHandler2.prototype.cancelContextMenu = function() {
          var stop = (function(e2) {
            if (e2 && e2.domEvent && e2.domEvent.type != "contextmenu")
              return;
            this.editor.off("nativecontextmenu", stop);
            if (e2 && e2.domEvent)
              event.stopEvent(e2.domEvent);
          }).bind(this);
          setTimeout(stop, 10);
          this.editor.on("nativecontextmenu", stop);
        };
        MouseHandler2.prototype.destroy = function() {
          if (this.releaseMouse)
            this.releaseMouse();
        };
        return MouseHandler2;
      }()
    );
    MouseHandler.prototype.releaseMouse = null;
    config2.defineOptions(MouseHandler.prototype, "mouseHandler", {
      scrollSpeed: { initialValue: 2 },
      dragDelay: { initialValue: useragent.isMac ? 150 : 0 },
      dragEnabled: { initialValue: true },
      focusTimeout: { initialValue: 0 },
      tooltipFollowsMouse: { initialValue: true }
    });
    exports3.MouseHandler = MouseHandler;
  });
  ace.define("ace/mouse/fold_handler", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var FoldHandler = (
      /** @class */
      /* @__PURE__ */ function() {
        function FoldHandler2(editor) {
          editor.on("click", function(e2) {
            var position2 = e2.getDocumentPosition();
            var session = editor.session;
            var fold = session.getFoldAt(position2.row, position2.column, 1);
            if (fold) {
              if (e2.getAccelKey())
                session.removeFold(fold);
              else
                session.expandFold(fold);
              e2.stop();
            }
            var target = e2.domEvent && e2.domEvent.target;
            if (target && dom.hasCssClass(target, "ace_inline_button")) {
              if (dom.hasCssClass(target, "ace_toggle_wrap")) {
                session.setOption("wrap", !session.getUseWrapMode());
                editor.renderer.scrollCursorIntoView();
              }
            }
          });
          editor.on("gutterclick", function(e2) {
            var gutterRegion = editor.renderer.$gutterLayer.getRegion(e2);
            if (gutterRegion == "foldWidgets") {
              var row = e2.getDocumentPosition().row;
              var session = editor.session;
              if (session.foldWidgets && session.foldWidgets[row])
                editor.session.onFoldWidgetClick(row, e2);
              if (!editor.isFocused())
                editor.focus();
              e2.stop();
            }
          });
          editor.on("gutterdblclick", function(e2) {
            var gutterRegion = editor.renderer.$gutterLayer.getRegion(e2);
            if (gutterRegion == "foldWidgets") {
              var row = e2.getDocumentPosition().row;
              var session = editor.session;
              var data = session.getParentFoldRangeData(row, true);
              var range3 = data.range || data.firstRange;
              if (range3) {
                row = range3.start.row;
                var fold = session.getFoldAt(row, session.getLine(row).length, 1);
                if (fold) {
                  session.removeFold(fold);
                } else {
                  session.addFold("...", range3);
                  editor.renderer.scrollCursorIntoView({ row: range3.start.row, column: 0 });
                }
              }
              e2.stop();
            }
          });
        }
        return FoldHandler2;
      }()
    );
    exports3.FoldHandler = FoldHandler;
  });
  ace.define("ace/keyboard/keybinding", ["require", "exports", "module", "ace/lib/keys", "ace/lib/event"], function(require2, exports3, module3) {
    var keyUtil = require2("../lib/keys");
    var event = require2("../lib/event");
    var KeyBinding = (
      /** @class */
      function() {
        function KeyBinding2(editor) {
          this.$editor = editor;
          this.$data = { editor };
          this.$handlers = [];
          this.setDefaultHandler(editor.commands);
        }
        KeyBinding2.prototype.setDefaultHandler = function(kb2) {
          this.removeKeyboardHandler(this.$defaultHandler);
          this.$defaultHandler = kb2;
          this.addKeyboardHandler(kb2, 0);
        };
        KeyBinding2.prototype.setKeyboardHandler = function(kb2) {
          var h3 = this.$handlers;
          if (h3[h3.length - 1] == kb2)
            return;
          while (h3[h3.length - 1] && h3[h3.length - 1] != this.$defaultHandler)
            this.removeKeyboardHandler(h3[h3.length - 1]);
          this.addKeyboardHandler(kb2, 1);
        };
        KeyBinding2.prototype.addKeyboardHandler = function(kb2, pos) {
          if (!kb2)
            return;
          if (typeof kb2 == "function" && !kb2.handleKeyboard)
            kb2.handleKeyboard = kb2;
          var i2 = this.$handlers.indexOf(kb2);
          if (i2 != -1)
            this.$handlers.splice(i2, 1);
          if (pos == void 0)
            this.$handlers.push(kb2);
          else
            this.$handlers.splice(pos, 0, kb2);
          if (i2 == -1 && kb2.attach)
            kb2.attach(this.$editor);
        };
        KeyBinding2.prototype.removeKeyboardHandler = function(kb2) {
          var i2 = this.$handlers.indexOf(kb2);
          if (i2 == -1)
            return false;
          this.$handlers.splice(i2, 1);
          kb2.detach && kb2.detach(this.$editor);
          return true;
        };
        KeyBinding2.prototype.getKeyboardHandler = function() {
          return this.$handlers[this.$handlers.length - 1];
        };
        KeyBinding2.prototype.getStatusText = function() {
          var data = this.$data;
          var editor = data.editor;
          return this.$handlers.map(function(h3) {
            return h3.getStatusText && h3.getStatusText(editor, data) || "";
          }).filter(Boolean).join(" ");
        };
        KeyBinding2.prototype.$callKeyboardHandlers = function(hashId, keyString, keyCode, e2) {
          var toExecute;
          var success = false;
          var commands = this.$editor.commands;
          for (var i2 = this.$handlers.length; i2--; ) {
            toExecute = this.$handlers[i2].handleKeyboard(
              this.$data,
              hashId,
              keyString,
              keyCode,
              e2
            );
            if (!toExecute || !toExecute.command)
              continue;
            if (toExecute.command == "null") {
              success = true;
            } else {
              success = commands.exec(toExecute.command, this.$editor, toExecute.args, e2);
            }
            if (success && e2 && hashId != -1 && toExecute["passEvent"] != true && toExecute.command["passEvent"] != true) {
              event.stopEvent(e2);
            }
            if (success)
              break;
          }
          if (!success && hashId == -1) {
            toExecute = { command: "insertstring" };
            success = commands.exec("insertstring", this.$editor, keyString);
          }
          if (success && this.$editor._signal)
            this.$editor._signal("keyboardActivity", toExecute);
          return success;
        };
        KeyBinding2.prototype.onCommandKey = function(e2, hashId, keyCode) {
          var keyString = keyUtil.keyCodeToString(keyCode);
          return this.$callKeyboardHandlers(hashId, keyString, keyCode, e2);
        };
        KeyBinding2.prototype.onTextInput = function(text2) {
          return this.$callKeyboardHandlers(-1, text2);
        };
        return KeyBinding2;
      }()
    );
    exports3.KeyBinding = KeyBinding;
  });
  ace.define("ace/lib/bidiutil", ["require", "exports", "module"], function(require2, exports3, module3) {
    var dir = 0, hiLevel = 0;
    var lastArabic = false, hasUBAT_B = false, hasUBAT_S = false;
    var impTab_LTR = [
      [0, 3, 0, 1, 0, 0, 0],
      [0, 3, 0, 1, 2, 2, 0],
      [0, 3, 0, 17, 2, 0, 1],
      [0, 3, 5, 5, 4, 1, 0],
      [0, 3, 21, 21, 4, 0, 1],
      [0, 3, 5, 5, 4, 2, 0]
    ];
    var impTab_RTL = [
      [2, 0, 1, 1, 0, 1, 0],
      [2, 0, 1, 1, 0, 2, 0],
      [2, 0, 2, 1, 3, 2, 0],
      [2, 0, 2, 33, 3, 1, 1]
    ];
    var LTR = 0, RTL = 1;
    var L2 = 0;
    var R2 = 1;
    var EN = 2;
    var AN = 3;
    var ON = 4;
    var B2 = 5;
    var S2 = 6;
    var AL = 7;
    var WS = 8;
    var CS = 9;
    var ES = 10;
    var ET = 11;
    var NSM = 12;
    var LRE = 13;
    var RLE = 14;
    var PDF = 15;
    var LRO = 16;
    var RLO = 17;
    var BN = 18;
    var UnicodeTBL00 = [
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      S2,
      B2,
      S2,
      WS,
      B2,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      B2,
      B2,
      B2,
      S2,
      WS,
      ON,
      ON,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      ON,
      ES,
      CS,
      ES,
      CS,
      CS,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      EN,
      CS,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      L2,
      ON,
      ON,
      ON,
      ON,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      B2,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      BN,
      CS,
      ON,
      ET,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      L2,
      ON,
      ON,
      BN,
      ON,
      ON,
      ET,
      ET,
      EN,
      EN,
      ON,
      L2,
      ON,
      ON,
      ON,
      EN,
      L2,
      ON,
      ON,
      ON,
      ON,
      ON
    ];
    var UnicodeTBL20 = [
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      WS,
      BN,
      BN,
      BN,
      L2,
      R2,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      WS,
      B2,
      LRE,
      RLE,
      PDF,
      LRO,
      RLO,
      CS,
      ET,
      ET,
      ET,
      ET,
      ET,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      CS,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      ON,
      WS
    ];
    function _computeLevels(chars2, levels, len, charTypes) {
      var impTab = dir ? impTab_RTL : impTab_LTR, prevState = null, newClass = null, newLevel = null, newState = 0, action = null, cond = null, condPos = -1, i2 = null, ix = null, classes = [];
      if (!charTypes) {
        for (i2 = 0, charTypes = []; i2 < len; i2++) {
          charTypes[i2] = _getCharacterType(chars2[i2]);
        }
      }
      hiLevel = dir;
      lastArabic = false;
      hasUBAT_B = false;
      hasUBAT_S = false;
      for (ix = 0; ix < len; ix++) {
        prevState = newState;
        classes[ix] = newClass = _getCharClass(chars2, charTypes, classes, ix);
        newState = impTab[prevState][newClass];
        action = newState & 240;
        newState &= 15;
        levels[ix] = newLevel = impTab[newState][5];
        if (action > 0) {
          if (action == 16) {
            for (i2 = condPos; i2 < ix; i2++) {
              levels[i2] = 1;
            }
            condPos = -1;
          } else {
            condPos = -1;
          }
        }
        cond = impTab[newState][6];
        if (cond) {
          if (condPos == -1) {
            condPos = ix;
          }
        } else {
          if (condPos > -1) {
            for (i2 = condPos; i2 < ix; i2++) {
              levels[i2] = newLevel;
            }
            condPos = -1;
          }
        }
        if (charTypes[ix] == B2) {
          levels[ix] = 0;
        }
        hiLevel |= newLevel;
      }
      if (hasUBAT_S) {
        for (i2 = 0; i2 < len; i2++) {
          if (charTypes[i2] == S2) {
            levels[i2] = dir;
            for (var j2 = i2 - 1; j2 >= 0; j2--) {
              if (charTypes[j2] == WS) {
                levels[j2] = dir;
              } else {
                break;
              }
            }
          }
        }
      }
    }
    function _invertLevel(lev, levels, _array) {
      if (hiLevel < lev) {
        return;
      }
      if (lev == 1 && dir == RTL && !hasUBAT_B) {
        _array.reverse();
        return;
      }
      var len = _array.length, start = 0, end, lo, hi2, tmp;
      while (start < len) {
        if (levels[start] >= lev) {
          end = start + 1;
          while (end < len && levels[end] >= lev) {
            end++;
          }
          for (lo = start, hi2 = end - 1; lo < hi2; lo++, hi2--) {
            tmp = _array[lo];
            _array[lo] = _array[hi2];
            _array[hi2] = tmp;
          }
          start = end;
        }
        start++;
      }
    }
    function _getCharClass(chars2, types2, classes, ix) {
      var cType = types2[ix], wType, nType, len, i2;
      switch (cType) {
        case L2:
        case R2:
          lastArabic = false;
        case ON:
        case AN:
          return cType;
        case EN:
          return lastArabic ? AN : EN;
        case AL:
          lastArabic = true;
          return R2;
        case WS:
          return ON;
        case CS:
          if (ix < 1 || ix + 1 >= types2.length || (wType = classes[ix - 1]) != EN && wType != AN || (nType = types2[ix + 1]) != EN && nType != AN) {
            return ON;
          }
          if (lastArabic) {
            nType = AN;
          }
          return nType == wType ? nType : ON;
        case ES:
          wType = ix > 0 ? classes[ix - 1] : B2;
          if (wType == EN && ix + 1 < types2.length && types2[ix + 1] == EN) {
            return EN;
          }
          return ON;
        case ET:
          if (ix > 0 && classes[ix - 1] == EN) {
            return EN;
          }
          if (lastArabic) {
            return ON;
          }
          i2 = ix + 1;
          len = types2.length;
          while (i2 < len && types2[i2] == ET) {
            i2++;
          }
          if (i2 < len && types2[i2] == EN) {
            return EN;
          }
          return ON;
        case NSM:
          len = types2.length;
          i2 = ix + 1;
          while (i2 < len && types2[i2] == NSM) {
            i2++;
          }
          if (i2 < len) {
            var c2 = chars2[ix], rtlCandidate = c2 >= 1425 && c2 <= 2303 || c2 == 64286;
            wType = types2[i2];
            if (rtlCandidate && (wType == R2 || wType == AL)) {
              return R2;
            }
          }
          if (ix < 1 || (wType = types2[ix - 1]) == B2) {
            return ON;
          }
          return classes[ix - 1];
        case B2:
          lastArabic = false;
          hasUBAT_B = true;
          return dir;
        case S2:
          hasUBAT_S = true;
          return ON;
        case LRE:
        case RLE:
        case LRO:
        case RLO:
        case PDF:
          lastArabic = false;
        case BN:
          return ON;
      }
    }
    function _getCharacterType(ch2) {
      var uc2 = ch2.charCodeAt(0), hi2 = uc2 >> 8;
      if (hi2 == 0) {
        return uc2 > 191 ? L2 : UnicodeTBL00[uc2];
      } else if (hi2 == 5) {
        return /[\u0591-\u05f4]/.test(ch2) ? R2 : L2;
      } else if (hi2 == 6) {
        if (/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(ch2))
          return NSM;
        else if (/[\u0660-\u0669\u066b-\u066c]/.test(ch2))
          return AN;
        else if (uc2 == 1642)
          return ET;
        else if (/[\u06f0-\u06f9]/.test(ch2))
          return EN;
        else
          return AL;
      } else if (hi2 == 32 && uc2 <= 8287) {
        return UnicodeTBL20[uc2 & 255];
      } else if (hi2 == 254) {
        return uc2 >= 65136 ? AL : ON;
      }
      return ON;
    }
    exports3.L = L2;
    exports3.R = R2;
    exports3.EN = EN;
    exports3.ON_R = 3;
    exports3.AN = 4;
    exports3.R_H = 5;
    exports3.B = 6;
    exports3.RLE = 7;
    exports3.DOT = "·";
    exports3.doBidiReorder = function(text2, textCharTypes, isRtl) {
      if (text2.length < 2)
        return {};
      var chars2 = text2.split(""), logicalFromVisual = new Array(chars2.length), bidiLevels = new Array(chars2.length), levels = [];
      dir = isRtl ? RTL : LTR;
      _computeLevels(chars2, levels, chars2.length, textCharTypes);
      for (var i2 = 0; i2 < logicalFromVisual.length; logicalFromVisual[i2] = i2, i2++)
        ;
      _invertLevel(2, levels, logicalFromVisual);
      _invertLevel(1, levels, logicalFromVisual);
      for (var i2 = 0; i2 < logicalFromVisual.length - 1; i2++) {
        if (textCharTypes[i2] === AN) {
          levels[i2] = exports3.AN;
        } else if (levels[i2] === R2 && (textCharTypes[i2] > AL && textCharTypes[i2] < LRE || textCharTypes[i2] === ON || textCharTypes[i2] === BN)) {
          levels[i2] = exports3.ON_R;
        } else if (i2 > 0 && chars2[i2 - 1] === "ل" && /\u0622|\u0623|\u0625|\u0627/.test(chars2[i2])) {
          levels[i2 - 1] = levels[i2] = exports3.R_H;
          i2++;
        }
      }
      if (chars2[chars2.length - 1] === exports3.DOT)
        levels[chars2.length - 1] = exports3.B;
      if (chars2[0] === "‫")
        levels[0] = exports3.RLE;
      for (var i2 = 0; i2 < logicalFromVisual.length; i2++) {
        bidiLevels[i2] = levels[logicalFromVisual[i2]];
      }
      return { "logicalFromVisual": logicalFromVisual, "bidiLevels": bidiLevels };
    };
    exports3.hasBidiCharacters = function(text2, textCharTypes) {
      var ret = false;
      for (var i2 = 0; i2 < text2.length; i2++) {
        textCharTypes[i2] = _getCharacterType(text2.charAt(i2));
        if (!ret && (textCharTypes[i2] == R2 || textCharTypes[i2] == AL || textCharTypes[i2] == AN))
          ret = true;
      }
      return ret;
    };
    exports3.getVisualFromLogicalIdx = function(logIdx, rowMap) {
      for (var i2 = 0; i2 < rowMap.logicalFromVisual.length; i2++) {
        if (rowMap.logicalFromVisual[i2] == logIdx)
          return i2;
      }
      return 0;
    };
  });
  ace.define("ace/bidihandler", ["require", "exports", "module", "ace/lib/bidiutil", "ace/lib/lang"], function(require2, exports3, module3) {
    var bidiUtil = require2("./lib/bidiutil");
    var lang2 = require2("./lib/lang");
    var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/;
    var BidiHandler = (
      /** @class */
      function() {
        function BidiHandler2(session) {
          this.session = session;
          this.bidiMap = {};
          this.currentRow = null;
          this.bidiUtil = bidiUtil;
          this.charWidths = [];
          this.EOL = "¬";
          this.showInvisibles = true;
          this.isRtlDir = false;
          this.$isRtl = false;
          this.line = "";
          this.wrapIndent = 0;
          this.EOF = "¶";
          this.RLE = "‫";
          this.contentWidth = 0;
          this.fontMetrics = null;
          this.rtlLineOffset = 0;
          this.wrapOffset = 0;
          this.isMoveLeftOperation = false;
          this.seenBidi = bidiRE.test(session.getValue());
        }
        BidiHandler2.prototype.isBidiRow = function(screenRow, docRow, splitIndex) {
          if (!this.seenBidi)
            return false;
          if (screenRow !== this.currentRow) {
            this.currentRow = screenRow;
            this.updateRowLine(docRow, splitIndex);
            this.updateBidiMap();
          }
          return this.bidiMap.bidiLevels;
        };
        BidiHandler2.prototype.onChange = function(delta) {
          if (!this.seenBidi) {
            if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) {
              this.seenBidi = true;
              this.currentRow = null;
            }
          } else {
            this.currentRow = null;
          }
        };
        BidiHandler2.prototype.getDocumentRow = function() {
          var docRow = 0;
          var rowCache = this.session.$screenRowCache;
          if (rowCache.length) {
            var index2 = this.session.$getRowCacheIndex(rowCache, this.currentRow);
            if (index2 >= 0)
              docRow = this.session.$docRowCache[index2];
          }
          return docRow;
        };
        BidiHandler2.prototype.getSplitIndex = function() {
          var splitIndex = 0;
          var rowCache = this.session.$screenRowCache;
          if (rowCache.length) {
            var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow);
            while (this.currentRow - splitIndex > 0) {
              currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1);
              if (currentIndex !== prevIndex)
                break;
              prevIndex = currentIndex;
              splitIndex++;
            }
          } else {
            splitIndex = this.currentRow;
          }
          return splitIndex;
        };
        BidiHandler2.prototype.updateRowLine = function(docRow, splitIndex) {
          if (docRow === void 0)
            docRow = this.getDocumentRow();
          var isLastRow = docRow === this.session.getLength() - 1, endOfLine = isLastRow ? this.EOF : this.EOL;
          this.wrapIndent = 0;
          this.line = this.session.getLine(docRow);
          this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE;
          if (this.session.$useWrapMode) {
            var splits = this.session.$wrapData[docRow];
            if (splits) {
              if (splitIndex === void 0)
                splitIndex = this.getSplitIndex();
              if (splitIndex > 0 && splits.length) {
                this.wrapIndent = splits.indent;
                this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L];
                this.line = splitIndex < splits.length ? this.line.substring(splits[splitIndex - 1], splits[splitIndex]) : this.line.substring(splits[splits.length - 1]);
              } else {
                this.line = this.line.substring(0, splits[splitIndex]);
              }
              if (splitIndex == splits.length) {
                this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
              }
            }
          } else {
            this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT;
          }
          var session = this.session, shift = 0, size2;
          this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function(ch2, i2) {
            if (ch2 === "	" || session.isFullWidth(ch2.charCodeAt(0))) {
              size2 = ch2 === "	" ? session.getScreenTabSize(i2 + shift) : 2;
              shift += size2 - 1;
              return lang2.stringRepeat(bidiUtil.DOT, size2);
            }
            return ch2;
          });
          if (this.isRtlDir) {
            this.fontMetrics.$main.textContent = this.line.charAt(this.line.length - 1) == bidiUtil.DOT ? this.line.substr(0, this.line.length - 1) : this.line;
            this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width;
          }
        };
        BidiHandler2.prototype.updateBidiMap = function() {
          var textCharTypes = [];
          if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) {
            this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir);
          } else {
            this.bidiMap = {};
          }
        };
        BidiHandler2.prototype.markAsDirty = function() {
          this.currentRow = null;
        };
        BidiHandler2.prototype.updateCharacterWidths = function(fontMetrics) {
          if (this.characterWidth === fontMetrics.$characterSize.width)
            return;
          this.fontMetrics = fontMetrics;
          var characterWidth = this.characterWidth = fontMetrics.$characterSize.width;
          var bidiCharWidth = fontMetrics.$measureCharWidth("ה");
          this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth;
          this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth;
          this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45;
          this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0;
          this.currentRow = null;
        };
        BidiHandler2.prototype.setShowInvisibles = function(showInvisibles) {
          this.showInvisibles = showInvisibles;
          this.currentRow = null;
        };
        BidiHandler2.prototype.setEolChar = function(eolChar) {
          this.EOL = eolChar;
        };
        BidiHandler2.prototype.setContentWidth = function(width) {
          this.contentWidth = width;
        };
        BidiHandler2.prototype.isRtlLine = function(row) {
          if (this.$isRtl)
            return true;
          if (row != void 0)
            return this.session.getLine(row).charAt(0) == this.RLE;
          else
            return this.isRtlDir;
        };
        BidiHandler2.prototype.setRtlDirection = function(editor, isRtlDir) {
          var cursor = editor.getCursorPosition();
          for (var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++) {
            if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE)
              editor.session.doc.removeInLine(row, 0, 1);
            else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE)
              editor.session.doc.insert({ column: 0, row }, editor.session.$bidiHandler.RLE);
          }
        };
        BidiHandler2.prototype.getPosLeft = function(col) {
          col -= this.wrapIndent;
          var leftBoundary = this.line.charAt(0) === this.RLE ? 1 : 0;
          var logicalIdx = col > leftBoundary ? this.session.getOverwrite() ? col : col - 1 : leftBoundary;
          var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap), levels = this.bidiMap.bidiLevels, left2 = 0;
          if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0)
            visualIdx++;
          for (var i2 = 0; i2 < visualIdx; i2++) {
            left2 += this.charWidths[levels[i2]];
          }
          if (!this.session.getOverwrite() && col > leftBoundary && levels[visualIdx] % 2 === 0)
            left2 += this.charWidths[levels[visualIdx]];
          if (this.wrapIndent)
            left2 += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          if (this.isRtlDir)
            left2 += this.rtlLineOffset;
          return left2;
        };
        BidiHandler2.prototype.getSelections = function(startCol, endCol) {
          var map2 = this.bidiMap, levels = map2.bidiLevels, level, selections = [], offset2 = 0, selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent, isSelected = false, isSelectedPrev = false, selectionStart = 0;
          if (this.wrapIndent)
            offset2 += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) {
            logIdx = map2.logicalFromVisual[visIdx];
            level = levels[visIdx];
            isSelected = logIdx >= selColMin && logIdx < selColMax;
            if (isSelected && !isSelectedPrev) {
              selectionStart = offset2;
            } else if (!isSelected && isSelectedPrev) {
              selections.push({ left: selectionStart, width: offset2 - selectionStart });
            }
            offset2 += this.charWidths[level];
            isSelectedPrev = isSelected;
          }
          if (isSelected && visIdx === levels.length) {
            selections.push({ left: selectionStart, width: offset2 - selectionStart });
          }
          if (this.isRtlDir) {
            for (var i2 = 0; i2 < selections.length; i2++) {
              selections[i2].left += this.rtlLineOffset;
            }
          }
          return selections;
        };
        BidiHandler2.prototype.offsetToCol = function(posX) {
          if (this.isRtlDir)
            posX -= this.rtlLineOffset;
          var logicalIdx = 0, posX = Math.max(posX, 0), offset2 = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels, charWidth = this.charWidths[levels[visualIdx]];
          if (this.wrapIndent)
            posX -= this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset;
          while (posX > offset2 + charWidth / 2) {
            offset2 += charWidth;
            if (visualIdx === levels.length - 1) {
              charWidth = 0;
              break;
            }
            charWidth = this.charWidths[levels[++visualIdx]];
          }
          if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && levels[visualIdx] % 2 === 0) {
            if (posX < offset2)
              visualIdx--;
            logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];
          } else if (visualIdx > 0 && levels[visualIdx - 1] % 2 === 0 && levels[visualIdx] % 2 !== 0) {
            logicalIdx = 1 + (posX > offset2 ? this.bidiMap.logicalFromVisual[visualIdx] : this.bidiMap.logicalFromVisual[visualIdx - 1]);
          } else if (this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && levels[visualIdx - 1] % 2 === 0 || !this.isRtlDir && visualIdx === 0 && levels[visualIdx] % 2 !== 0) {
            logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx];
          } else {
            if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && charWidth !== 0)
              visualIdx--;
            logicalIdx = this.bidiMap.logicalFromVisual[visualIdx];
          }
          if (logicalIdx === 0 && this.isRtlDir)
            logicalIdx++;
          return logicalIdx + this.wrapIndent;
        };
        return BidiHandler2;
      }()
    );
    exports3.BidiHandler = BidiHandler;
  });
  ace.define("ace/selection", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/range"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var lang2 = require2("./lib/lang");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Range = require2("./range").Range;
    var Selection = (
      /** @class */
      function() {
        function Selection2(session) {
          this.session = session;
          this.doc = session.getDocument();
          this.clearSelection();
          this.cursor = this.lead = this.doc.createAnchor(0, 0);
          this.anchor = this.doc.createAnchor(0, 0);
          this.$silent = false;
          var self2 = this;
          this.cursor.on("change", function(e2) {
            self2.$cursorChanged = true;
            if (!self2.$silent)
              self2._emit("changeCursor");
            if (!self2.$isEmpty && !self2.$silent)
              self2._emit("changeSelection");
            if (!self2.$keepDesiredColumnOnChange && e2.old.column != e2.value.column)
              self2.$desiredColumn = null;
          });
          this.anchor.on("change", function() {
            self2.$anchorChanged = true;
            if (!self2.$isEmpty && !self2.$silent)
              self2._emit("changeSelection");
          });
        }
        Selection2.prototype.isEmpty = function() {
          return this.$isEmpty || this.anchor.row == this.lead.row && this.anchor.column == this.lead.column;
        };
        Selection2.prototype.isMultiLine = function() {
          return !this.$isEmpty && this.anchor.row != this.cursor.row;
        };
        Selection2.prototype.getCursor = function() {
          return this.lead.getPosition();
        };
        Selection2.prototype.setAnchor = function(row, column2) {
          this.$isEmpty = false;
          this.anchor.setPosition(row, column2);
        };
        Selection2.prototype.getAnchor = function() {
          if (this.$isEmpty)
            return this.getSelectionLead();
          return this.anchor.getPosition();
        };
        Selection2.prototype.getSelectionLead = function() {
          return this.lead.getPosition();
        };
        Selection2.prototype.isBackwards = function() {
          var anchor = this.anchor;
          var lead = this.lead;
          return anchor.row > lead.row || anchor.row == lead.row && anchor.column > lead.column;
        };
        Selection2.prototype.getRange = function() {
          var anchor = this.anchor;
          var lead = this.lead;
          if (this.$isEmpty)
            return Range.fromPoints(lead, lead);
          return this.isBackwards() ? Range.fromPoints(lead, anchor) : Range.fromPoints(anchor, lead);
        };
        Selection2.prototype.clearSelection = function() {
          if (!this.$isEmpty) {
            this.$isEmpty = true;
            this._emit("changeSelection");
          }
        };
        Selection2.prototype.selectAll = function() {
          this.$setSelection(0, 0, Number.MAX_VALUE, Number.MAX_VALUE);
        };
        Selection2.prototype.setRange = function(range3, reverse) {
          var start = reverse ? range3.end : range3.start;
          var end = reverse ? range3.start : range3.end;
          this.$setSelection(start.row, start.column, end.row, end.column);
        };
        Selection2.prototype.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) {
          if (this.$silent)
            return;
          var wasEmpty = this.$isEmpty;
          var wasMultiselect = this.inMultiSelectMode;
          this.$silent = true;
          this.$cursorChanged = this.$anchorChanged = false;
          this.anchor.setPosition(anchorRow, anchorColumn);
          this.cursor.setPosition(cursorRow, cursorColumn);
          this.$isEmpty = !Range.comparePoints(this.anchor, this.cursor);
          this.$silent = false;
          if (this.$cursorChanged)
            this._emit("changeCursor");
          if (this.$cursorChanged || this.$anchorChanged || wasEmpty != this.$isEmpty || wasMultiselect)
            this._emit("changeSelection");
        };
        Selection2.prototype.$moveSelection = function(mover) {
          var lead = this.lead;
          if (this.$isEmpty)
            this.setSelectionAnchor(lead.row, lead.column);
          mover.call(this);
        };
        Selection2.prototype.selectTo = function(row, column2) {
          this.$moveSelection(function() {
            this.moveCursorTo(row, column2);
          });
        };
        Selection2.prototype.selectToPosition = function(pos) {
          this.$moveSelection(function() {
            this.moveCursorToPosition(pos);
          });
        };
        Selection2.prototype.moveTo = function(row, column2) {
          this.clearSelection();
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveToPosition = function(pos) {
          this.clearSelection();
          this.moveCursorToPosition(pos);
        };
        Selection2.prototype.selectUp = function() {
          this.$moveSelection(this.moveCursorUp);
        };
        Selection2.prototype.selectDown = function() {
          this.$moveSelection(this.moveCursorDown);
        };
        Selection2.prototype.selectRight = function() {
          this.$moveSelection(this.moveCursorRight);
        };
        Selection2.prototype.selectLeft = function() {
          this.$moveSelection(this.moveCursorLeft);
        };
        Selection2.prototype.selectLineStart = function() {
          this.$moveSelection(this.moveCursorLineStart);
        };
        Selection2.prototype.selectLineEnd = function() {
          this.$moveSelection(this.moveCursorLineEnd);
        };
        Selection2.prototype.selectFileEnd = function() {
          this.$moveSelection(this.moveCursorFileEnd);
        };
        Selection2.prototype.selectFileStart = function() {
          this.$moveSelection(this.moveCursorFileStart);
        };
        Selection2.prototype.selectWordRight = function() {
          this.$moveSelection(this.moveCursorWordRight);
        };
        Selection2.prototype.selectWordLeft = function() {
          this.$moveSelection(this.moveCursorWordLeft);
        };
        Selection2.prototype.getWordRange = function(row, column2) {
          if (typeof column2 == "undefined") {
            var cursor = row || this.lead;
            row = cursor.row;
            column2 = cursor.column;
          }
          return this.session.getWordRange(row, column2);
        };
        Selection2.prototype.selectWord = function() {
          this.setSelectionRange(this.getWordRange());
        };
        Selection2.prototype.selectAWord = function() {
          var cursor = this.getCursor();
          var range3 = this.session.getAWordRange(cursor.row, cursor.column);
          this.setSelectionRange(range3);
        };
        Selection2.prototype.getLineRange = function(row, excludeLastChar) {
          var rowStart = typeof row == "number" ? row : this.lead.row;
          var rowEnd;
          var foldLine = this.session.getFoldLine(rowStart);
          if (foldLine) {
            rowStart = foldLine.start.row;
            rowEnd = foldLine.end.row;
          } else {
            rowEnd = rowStart;
          }
          if (excludeLastChar === true)
            return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
          else
            return new Range(rowStart, 0, rowEnd + 1, 0);
        };
        Selection2.prototype.selectLine = function() {
          this.setSelectionRange(this.getLineRange());
        };
        Selection2.prototype.moveCursorUp = function() {
          this.moveCursorBy(-1, 0);
        };
        Selection2.prototype.moveCursorDown = function() {
          this.moveCursorBy(1, 0);
        };
        Selection2.prototype.wouldMoveIntoSoftTab = function(cursor, tabSize, direction) {
          var start = cursor.column;
          var end = cursor.column + tabSize;
          if (direction < 0) {
            start = cursor.column - tabSize;
            end = cursor.column;
          }
          return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start, end).split(" ").length - 1 == tabSize;
        };
        Selection2.prototype.moveCursorLeft = function() {
          var cursor = this.lead.getPosition(), fold;
          if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
            this.moveCursorTo(fold.start.row, fold.start.column);
          } else if (cursor.column === 0) {
            if (cursor.row > 0) {
              this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
            }
          } else {
            var tabSize = this.session.getTabSize();
            if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) {
              this.moveCursorBy(0, -tabSize);
            } else {
              this.moveCursorBy(0, -1);
            }
          }
        };
        Selection2.prototype.moveCursorRight = function() {
          var cursor = this.lead.getPosition(), fold;
          if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
            this.moveCursorTo(fold.end.row, fold.end.column);
          } else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
            if (this.lead.row < this.doc.getLength() - 1) {
              this.moveCursorTo(this.lead.row + 1, 0);
            }
          } else {
            var tabSize = this.session.getTabSize();
            var cursor = this.lead;
            if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) {
              this.moveCursorBy(0, tabSize);
            } else {
              this.moveCursorBy(0, 1);
            }
          }
        };
        Selection2.prototype.moveCursorLineStart = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var screenRow = this.session.documentToScreenRow(row, column2);
          var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
          var beforeCursor = this.session.getDisplayLine(row, null, firstColumnPosition.row, firstColumnPosition.column);
          var leadingSpace = beforeCursor.match(/^\s*/);
          if (leadingSpace[0].length != column2 && !this.session.$useEmacsStyleLineStart)
            firstColumnPosition.column += leadingSpace[0].length;
          this.moveCursorToPosition(firstColumnPosition);
        };
        Selection2.prototype.moveCursorLineEnd = function() {
          var lead = this.lead;
          var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
          if (this.lead.column == lineEnd.column) {
            var line2 = this.session.getLine(lineEnd.row);
            if (lineEnd.column == line2.length) {
              var textEnd = line2.search(/\s+$/);
              if (textEnd > 0)
                lineEnd.column = textEnd;
            }
          }
          this.moveCursorTo(lineEnd.row, lineEnd.column);
        };
        Selection2.prototype.moveCursorFileEnd = function() {
          var row = this.doc.getLength() - 1;
          var column2 = this.doc.getLine(row).length;
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveCursorFileStart = function() {
          this.moveCursorTo(0, 0);
        };
        Selection2.prototype.moveCursorLongWordRight = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var line2 = this.doc.getLine(row);
          var rightOfCursor = line2.substring(column2);
          this.session.nonTokenRe.lastIndex = 0;
          this.session.tokenRe.lastIndex = 0;
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold) {
            this.moveCursorTo(fold.end.row, fold.end.column);
            return;
          }
          if (this.session.nonTokenRe.exec(rightOfCursor)) {
            column2 += this.session.nonTokenRe.lastIndex;
            this.session.nonTokenRe.lastIndex = 0;
            rightOfCursor = line2.substring(column2);
          }
          if (column2 >= line2.length) {
            this.moveCursorTo(row, line2.length);
            this.moveCursorRight();
            if (row < this.doc.getLength() - 1)
              this.moveCursorWordRight();
            return;
          }
          if (this.session.tokenRe.exec(rightOfCursor)) {
            column2 += this.session.tokenRe.lastIndex;
            this.session.tokenRe.lastIndex = 0;
          }
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.moveCursorLongWordLeft = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var fold;
          if (fold = this.session.getFoldAt(row, column2, -1)) {
            this.moveCursorTo(fold.start.row, fold.start.column);
            return;
          }
          var str = this.session.getFoldStringAt(row, column2, -1);
          if (str == null) {
            str = this.doc.getLine(row).substring(0, column2);
          }
          var leftOfCursor = lang2.stringReverse(str);
          this.session.nonTokenRe.lastIndex = 0;
          this.session.tokenRe.lastIndex = 0;
          if (this.session.nonTokenRe.exec(leftOfCursor)) {
            column2 -= this.session.nonTokenRe.lastIndex;
            leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
            this.session.nonTokenRe.lastIndex = 0;
          }
          if (column2 <= 0) {
            this.moveCursorTo(row, 0);
            this.moveCursorLeft();
            if (row > 0)
              this.moveCursorWordLeft();
            return;
          }
          if (this.session.tokenRe.exec(leftOfCursor)) {
            column2 -= this.session.tokenRe.lastIndex;
            this.session.tokenRe.lastIndex = 0;
          }
          this.moveCursorTo(row, column2);
        };
        Selection2.prototype.$shortWordEndIndex = function(rightOfCursor) {
          var index2 = 0, ch2;
          var whitespaceRe = /\s/;
          var tokenRe = this.session.tokenRe;
          tokenRe.lastIndex = 0;
          if (this.session.tokenRe.exec(rightOfCursor)) {
            index2 = this.session.tokenRe.lastIndex;
          } else {
            while ((ch2 = rightOfCursor[index2]) && whitespaceRe.test(ch2))
              index2++;
            if (index2 < 1) {
              tokenRe.lastIndex = 0;
              while ((ch2 = rightOfCursor[index2]) && !tokenRe.test(ch2)) {
                tokenRe.lastIndex = 0;
                index2++;
                if (whitespaceRe.test(ch2)) {
                  if (index2 > 2) {
                    index2--;
                    break;
                  } else {
                    while ((ch2 = rightOfCursor[index2]) && whitespaceRe.test(ch2))
                      index2++;
                    if (index2 > 2)
                      break;
                  }
                }
              }
            }
          }
          tokenRe.lastIndex = 0;
          return index2;
        };
        Selection2.prototype.moveCursorShortWordRight = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var line2 = this.doc.getLine(row);
          var rightOfCursor = line2.substring(column2);
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold)
            return this.moveCursorTo(fold.end.row, fold.end.column);
          if (column2 == line2.length) {
            var l2 = this.doc.getLength();
            do {
              row++;
              rightOfCursor = this.doc.getLine(row);
            } while (row < l2 && /^\s*$/.test(rightOfCursor));
            if (!/^\s+/.test(rightOfCursor))
              rightOfCursor = "";
            column2 = 0;
          }
          var index2 = this.$shortWordEndIndex(rightOfCursor);
          this.moveCursorTo(row, column2 + index2);
        };
        Selection2.prototype.moveCursorShortWordLeft = function() {
          var row = this.lead.row;
          var column2 = this.lead.column;
          var fold;
          if (fold = this.session.getFoldAt(row, column2, -1))
            return this.moveCursorTo(fold.start.row, fold.start.column);
          var line2 = this.session.getLine(row).substring(0, column2);
          if (column2 === 0) {
            do {
              row--;
              line2 = this.doc.getLine(row);
            } while (row > 0 && /^\s*$/.test(line2));
            column2 = line2.length;
            if (!/\s+$/.test(line2))
              line2 = "";
          }
          var leftOfCursor = lang2.stringReverse(line2);
          var index2 = this.$shortWordEndIndex(leftOfCursor);
          return this.moveCursorTo(row, column2 - index2);
        };
        Selection2.prototype.moveCursorWordRight = function() {
          if (this.session.$selectLongWords)
            this.moveCursorLongWordRight();
          else
            this.moveCursorShortWordRight();
        };
        Selection2.prototype.moveCursorWordLeft = function() {
          if (this.session.$selectLongWords)
            this.moveCursorLongWordLeft();
          else
            this.moveCursorShortWordLeft();
        };
        Selection2.prototype.moveCursorBy = function(rows, chars2) {
          var screenPos = this.session.documentToScreenPosition(this.lead.row, this.lead.column);
          var offsetX;
          if (chars2 === 0) {
            if (rows !== 0) {
              if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) {
                offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column);
                screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]);
              } else {
                offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0];
              }
            }
            if (this.$desiredColumn)
              screenPos.column = this.$desiredColumn;
            else
              this.$desiredColumn = screenPos.column;
          }
          if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) {
            var widget = this.session.lineWidgets[this.lead.row];
            if (rows < 0)
              rows -= widget.rowsAbove || 0;
            else if (rows > 0)
              rows += widget.rowCount - (widget.rowsAbove || 0);
          }
          var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX);
          if (rows !== 0 && chars2 === 0 && docPos.row === this.lead.row && docPos.column === this.lead.column)
            ;
          this.moveCursorTo(docPos.row, docPos.column + chars2, chars2 === 0);
        };
        Selection2.prototype.moveCursorToPosition = function(position2) {
          this.moveCursorTo(position2.row, position2.column);
        };
        Selection2.prototype.moveCursorTo = function(row, column2, keepDesiredColumn) {
          var fold = this.session.getFoldAt(row, column2, 1);
          if (fold) {
            row = fold.start.row;
            column2 = fold.start.column;
          }
          this.$keepDesiredColumnOnChange = true;
          var line2 = this.session.getLine(row);
          if (/[\uDC00-\uDFFF]/.test(line2.charAt(column2)) && line2.charAt(column2 - 1)) {
            if (this.lead.row == row && this.lead.column == column2 + 1)
              column2 = column2 - 1;
            else
              column2 = column2 + 1;
          }
          this.lead.setPosition(row, column2);
          this.$keepDesiredColumnOnChange = false;
          if (!keepDesiredColumn)
            this.$desiredColumn = null;
        };
        Selection2.prototype.moveCursorToScreen = function(row, column2, keepDesiredColumn) {
          var pos = this.session.screenToDocumentPosition(row, column2);
          this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
        };
        Selection2.prototype.detach = function() {
          this.lead.detach();
          this.anchor.detach();
        };
        Selection2.prototype.fromOrientedRange = function(range3) {
          this.setSelectionRange(range3, range3.cursor == range3.start);
          this.$desiredColumn = range3.desiredColumn || this.$desiredColumn;
        };
        Selection2.prototype.toOrientedRange = function(range3) {
          var r2 = this.getRange();
          if (range3) {
            range3.start.column = r2.start.column;
            range3.start.row = r2.start.row;
            range3.end.column = r2.end.column;
            range3.end.row = r2.end.row;
          } else {
            range3 = r2;
          }
          range3.cursor = this.isBackwards() ? range3.start : range3.end;
          range3.desiredColumn = this.$desiredColumn;
          return range3;
        };
        Selection2.prototype.getRangeOfMovements = function(func) {
          var start = this.getCursor();
          try {
            func(this);
            var end = this.getCursor();
            return Range.fromPoints(start, end);
          } catch (e2) {
            return Range.fromPoints(start, start);
          } finally {
            this.moveCursorToPosition(start);
          }
        };
        Selection2.prototype.toJSON = function() {
          if (this.rangeCount) {
            var data = this.ranges.map(function(r2) {
              var r1 = r2.clone();
              r1.isBackwards = r2.cursor == r2.start;
              return r1;
            });
          } else {
            var data = this.getRange();
            data.isBackwards = this.isBackwards();
          }
          return data;
        };
        Selection2.prototype.fromJSON = function(data) {
          if (data.start == void 0) {
            if (this.rangeList && data.length > 1) {
              this.toSingleRange(data[0]);
              for (var i2 = data.length; i2--; ) {
                var r2 = Range.fromPoints(data[i2].start, data[i2].end);
                if (data[i2].isBackwards)
                  r2.cursor = r2.start;
                this.addRange(r2, true);
              }
              return;
            } else {
              data = data[0];
            }
          }
          if (this.rangeList)
            this.toSingleRange(data);
          this.setSelectionRange(data, data.isBackwards);
        };
        Selection2.prototype.isEqual = function(data) {
          if ((data.length || this.rangeCount) && data.length != this.rangeCount)
            return false;
          if (!data.length || !this.ranges)
            return this.getRange().isEqual(data);
          for (var i2 = this.ranges.length; i2--; ) {
            if (!this.ranges[i2].isEqual(data[i2]))
              return false;
          }
          return true;
        };
        return Selection2;
      }()
    );
    Selection.prototype.setSelectionAnchor = Selection.prototype.setAnchor;
    Selection.prototype.getSelectionAnchor = Selection.prototype.getAnchor;
    Selection.prototype.setSelectionRange = Selection.prototype.setRange;
    oop.implement(Selection.prototype, EventEmitter2);
    exports3.Selection = Selection;
  });
  ace.define("ace/tokenizer", ["require", "exports", "module", "ace/lib/report_error"], function(require2, exports3, module3) {
    var reportError2 = require2("./lib/report_error").reportError;
    var MAX_TOKEN_COUNT = 2e3;
    var Tokenizer = (
      /** @class */
      function() {
        function Tokenizer2(rules2) {
          this.splitRegex;
          this.states = rules2;
          this.regExps = {};
          this.matchMappings = {};
          for (var key in this.states) {
            var state = this.states[key];
            var ruleRegExps = [];
            var matchTotal = 0;
            var mapping = this.matchMappings[key] = { defaultToken: "text" };
            var flag = "g";
            var splitterRurles = [];
            for (var i2 = 0; i2 < state.length; i2++) {
              var rule = state[i2];
              if (rule.defaultToken)
                mapping.defaultToken = rule.defaultToken;
              if (rule.caseInsensitive && flag.indexOf("i") === -1)
                flag += "i";
              if (rule.unicode && flag.indexOf("u") === -1)
                flag += "u";
              if (rule.regex == null)
                continue;
              if (rule.regex instanceof RegExp)
                rule.regex = rule.regex.toString().slice(1, -1);
              var adjustedregex = rule.regex;
              var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2;
              if (Array.isArray(rule.token)) {
                if (rule.token.length == 1 || matchcount == 1) {
                  rule.token = rule.token[0];
                } else if (matchcount - 1 != rule.token.length) {
                  this.reportError("number of classes and regexp groups doesn't match", {
                    rule,
                    groupCount: matchcount - 1
                  });
                  rule.token = rule.token[0];
                } else {
                  rule.tokenArray = rule.token;
                  rule.token = null;
                  rule.onMatch = this.$arrayTokens;
                }
              } else if (typeof rule.token == "function" && !rule.onMatch) {
                if (matchcount > 1)
                  rule.onMatch = this.$applyToken;
                else
                  rule.onMatch = rule.token;
              }
              if (matchcount > 1) {
                if (/\\\d/.test(rule.regex)) {
                  adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match5, digit) {
                    return "\\" + (parseInt(digit, 10) + matchTotal + 1);
                  });
                } else {
                  matchcount = 1;
                  adjustedregex = this.removeCapturingGroups(rule.regex);
                }
                if (!rule.splitRegex && typeof rule.token != "string")
                  splitterRurles.push(rule);
              }
              mapping[matchTotal] = i2;
              matchTotal += matchcount;
              ruleRegExps.push(adjustedregex);
              if (!rule.onMatch)
                rule.onMatch = null;
            }
            if (!ruleRegExps.length) {
              mapping[0] = 0;
              ruleRegExps.push("$");
            }
            splitterRurles.forEach(function(rule2) {
              rule2.splitRegex = this.createSplitterRegexp(rule2.regex, flag);
            }, this);
            this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag);
          }
        }
        Tokenizer2.prototype.$setMaxTokenCount = function(m2) {
          MAX_TOKEN_COUNT = m2 | 0;
        };
        Tokenizer2.prototype.$applyToken = function(str) {
          var values = this.splitRegex.exec(str).slice(1);
          var types2 = this.token.apply(this, values);
          if (typeof types2 === "string")
            return [{ type: types2, value: str }];
          var tokens2 = [];
          for (var i2 = 0, l2 = types2.length; i2 < l2; i2++) {
            if (values[i2])
              tokens2[tokens2.length] = {
                type: types2[i2],
                value: values[i2]
              };
          }
          return tokens2;
        };
        Tokenizer2.prototype.$arrayTokens = function(str) {
          if (!str)
            return [];
          var values = this.splitRegex.exec(str);
          if (!values)
            return "text";
          var tokens2 = [];
          var types2 = this.tokenArray;
          for (var i2 = 0, l2 = types2.length; i2 < l2; i2++) {
            if (values[i2 + 1])
              tokens2[tokens2.length] = {
                type: types2[i2],
                value: values[i2 + 1]
              };
          }
          return tokens2;
        };
        Tokenizer2.prototype.removeCapturingGroups = function(src) {
          var r2 = src.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g, function(x2, y2) {
            return y2 ? "(?:" : x2;
          });
          return r2;
        };
        Tokenizer2.prototype.createSplitterRegexp = function(src, flag) {
          if (src.indexOf("(?=") != -1) {
            var stack = 0;
            var inChClass = false;
            var lastCapture = {};
            src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(m2, esc, parenOpen, parenClose, square, index2) {
              if (inChClass) {
                inChClass = square != "]";
              } else if (square) {
                inChClass = true;
              } else if (parenClose) {
                if (stack == lastCapture.stack) {
                  lastCapture.end = index2 + 1;
                  lastCapture.stack = -1;
                }
                stack--;
              } else if (parenOpen) {
                stack++;
                if (parenOpen.length != 1) {
                  lastCapture.stack = stack;
                  lastCapture.start = index2;
                }
              }
              return m2;
            });
            if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end)))
              src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end);
          }
          if (src.charAt(0) != "^")
            src = "^" + src;
          if (src.charAt(src.length - 1) != "$")
            src += "$";
          return new RegExp(src, (flag || "").replace("g", ""));
        };
        Tokenizer2.prototype.getLineTokens = function(line2, startState) {
          if (startState && typeof startState != "string") {
            var stack = startState.slice(0);
            startState = stack[0];
            if (startState === "#tmp") {
              stack.shift();
              startState = stack.shift();
            }
          } else
            var stack = [];
          var currentState = (
            /**@type{string}*/
            startState || "start"
          );
          var state = this.states[currentState];
          if (!state) {
            currentState = "start";
            state = this.states[currentState];
          }
          var mapping = this.matchMappings[currentState];
          var re2 = this.regExps[currentState];
          re2.lastIndex = 0;
          var match5, tokens2 = [];
          var lastIndex = 0;
          var matchAttempts = 0;
          var token2 = { type: null, value: "" };
          while (match5 = re2.exec(line2)) {
            var type4 = mapping.defaultToken;
            var rule = null;
            var value2 = match5[0];
            var index2 = re2.lastIndex;
            if (index2 - value2.length > lastIndex) {
              var skipped = line2.substring(lastIndex, index2 - value2.length);
              if (token2.type == type4) {
                token2.value += skipped;
              } else {
                if (token2.type)
                  tokens2.push(token2);
                token2 = { type: type4, value: skipped };
              }
            }
            for (var i2 = 0; i2 < match5.length - 2; i2++) {
              if (match5[i2 + 1] === void 0)
                continue;
              rule = state[mapping[i2]];
              if (rule.onMatch)
                type4 = rule.onMatch(value2, currentState, stack, line2);
              else
                type4 = rule.token;
              if (rule.next) {
                if (typeof rule.next == "string") {
                  currentState = rule.next;
                } else {
                  currentState = rule.next(currentState, stack);
                }
                state = this.states[currentState];
                if (!state) {
                  this.reportError("state doesn't exist", currentState);
                  currentState = "start";
                  state = this.states[currentState];
                }
                mapping = this.matchMappings[currentState];
                lastIndex = index2;
                re2 = this.regExps[currentState];
                re2.lastIndex = index2;
              }
              if (rule.consumeLineEnd)
                lastIndex = index2;
              break;
            }
            if (value2) {
              if (typeof type4 === "string") {
                if ((!rule || rule.merge !== false) && token2.type === type4) {
                  token2.value += value2;
                } else {
                  if (token2.type)
                    tokens2.push(token2);
                  token2 = { type: type4, value: value2 };
                }
              } else if (type4) {
                if (token2.type)
                  tokens2.push(token2);
                token2 = { type: null, value: "" };
                for (var i2 = 0; i2 < type4.length; i2++)
                  tokens2.push(type4[i2]);
              }
            }
            if (lastIndex == line2.length)
              break;
            lastIndex = index2;
            if (matchAttempts++ > MAX_TOKEN_COUNT) {
              if (matchAttempts > 2 * line2.length) {
                this.reportError("infinite loop with in ace tokenizer", {
                  startState,
                  line: line2
                });
              }
              while (lastIndex < line2.length) {
                if (token2.type)
                  tokens2.push(token2);
                token2 = {
                  value: line2.substring(lastIndex, lastIndex += 500),
                  type: "overflow"
                };
              }
              currentState = "start";
              stack = [];
              break;
            }
          }
          if (token2.type)
            tokens2.push(token2);
          if (stack.length > 1) {
            if (stack[0] !== currentState)
              stack.unshift("#tmp", currentState);
          }
          return {
            tokens: tokens2,
            state: stack.length ? stack : currentState
          };
        };
        return Tokenizer2;
      }()
    );
    Tokenizer.prototype.reportError = reportError2;
    exports3.Tokenizer = Tokenizer;
  });
  ace.define("ace/mode/text_highlight_rules", ["require", "exports", "module", "ace/lib/deep_copy"], function(require2, exports3, module3) {
    var deepCopy = require2("../lib/deep_copy").deepCopy;
    var TextHighlightRules;
    TextHighlightRules = function() {
      this.$rules = {
        "start": [{
          token: "empty_line",
          regex: "^$"
        }, {
          defaultToken: "text"
        }]
      };
    };
    (function() {
      this.addRules = function(rules2, prefix) {
        if (!prefix) {
          for (var key in rules2)
            this.$rules[key] = rules2[key];
          return;
        }
        for (var key in rules2) {
          var state = rules2[key];
          for (var i2 = 0; i2 < state.length; i2++) {
            var rule = state[i2];
            if (rule.next || rule.onMatch) {
              if (typeof rule.next == "string") {
                if (rule.next.indexOf(prefix) !== 0)
                  rule.next = prefix + rule.next;
              }
              if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
                rule.nextState = prefix + rule.nextState;
            }
          }
          this.$rules[prefix + key] = state;
        }
      };
      this.getRules = function() {
        return this.$rules;
      };
      this.embedRules = function(HighlightRules, prefix, escapeRules, states, append3) {
        var embedRules = typeof HighlightRules == "function" ? new HighlightRules().getRules() : HighlightRules;
        if (states) {
          for (var i2 = 0; i2 < states.length; i2++)
            states[i2] = prefix + states[i2];
        } else {
          states = [];
          for (var key in embedRules)
            states.push(prefix + key);
        }
        this.addRules(embedRules, prefix);
        if (escapeRules) {
          var addRules = Array.prototype[append3 ? "push" : "unshift"];
          for (var i2 = 0; i2 < states.length; i2++)
            addRules.apply(this.$rules[states[i2]], deepCopy(escapeRules));
        }
        if (!this.$embeds)
          this.$embeds = [];
        this.$embeds.push(prefix);
      };
      this.getEmbeds = function() {
        return this.$embeds;
      };
      var pushState = function(currentState, stack) {
        if (currentState != "start" || stack.length)
          stack.unshift(this.nextState, currentState);
        return this.nextState;
      };
      var popState = function(currentState, stack) {
        stack.shift();
        return stack.shift() || "start";
      };
      this.normalizeRules = function() {
        var id2 = 0;
        var rules2 = this.$rules;
        function processState(key) {
          var state = rules2[key];
          state["processed"] = true;
          for (var i2 = 0; i2 < state.length; i2++) {
            var rule = state[i2];
            var toInsert = null;
            if (Array.isArray(rule)) {
              toInsert = rule;
              rule = {};
            }
            if (!rule.regex && rule.start) {
              rule.regex = rule.start;
              if (!rule.next)
                rule.next = [];
              rule.next.push({
                defaultToken: rule.token
              }, {
                token: rule.token + ".end",
                regex: rule.end || rule.start,
                next: "pop"
              });
              rule.token = rule.token + ".start";
              rule.push = true;
            }
            var next2 = rule.next || rule.push;
            if (next2 && Array.isArray(next2)) {
              var stateName = rule.stateName;
              if (!stateName) {
                stateName = rule.token;
                if (typeof stateName != "string")
                  stateName = stateName[0] || "";
                if (rules2[stateName])
                  stateName += id2++;
              }
              rules2[stateName] = next2;
              rule.next = stateName;
              processState(stateName);
            } else if (next2 == "pop") {
              rule.next = popState;
            }
            if (rule.push) {
              rule.nextState = rule.next || rule.push;
              rule.next = pushState;
              delete rule.push;
            }
            if (rule.rules) {
              for (var r2 in rule.rules) {
                if (rules2[r2]) {
                  if (rules2[r2].push)
                    rules2[r2].push.apply(rules2[r2], rule.rules[r2]);
                } else {
                  rules2[r2] = rule.rules[r2];
                }
              }
            }
            var includeName = typeof rule == "string" ? rule : rule.include;
            if (includeName) {
              if (includeName === "$self")
                includeName = "start";
              if (Array.isArray(includeName))
                toInsert = includeName.map(function(x2) {
                  return rules2[x2];
                });
              else
                toInsert = rules2[includeName];
            }
            if (toInsert) {
              var args = [i2, 1].concat(toInsert);
              if (rule.noEscape)
                args = args.filter(function(x2) {
                  return !x2.next;
                });
              state.splice.apply(state, args);
              i2--;
            }
            if (rule.keywordMap) {
              rule.token = this.createKeywordMapper(rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive);
              delete rule.defaultToken;
            }
          }
        }
        Object.keys(rules2).forEach(processState, this);
      };
      this.createKeywordMapper = function(map2, defaultToken, ignoreCase, splitChar) {
        var keywords = /* @__PURE__ */ Object.create(null);
        this.$keywordList = [];
        Object.keys(map2).forEach(function(className) {
          var a2 = map2[className];
          var list2 = a2.split(splitChar || "|");
          for (var i2 = list2.length; i2--; ) {
            var word = list2[i2];
            this.$keywordList.push(word);
            if (ignoreCase)
              word = word.toLowerCase();
            keywords[word] = className;
          }
        }, this);
        map2 = null;
        return ignoreCase ? function(value2) {
          return keywords[value2.toLowerCase()] || defaultToken;
        } : function(value2) {
          return keywords[value2] || defaultToken;
        };
      };
      this.getKeywords = function() {
        return this.$keywords;
      };
    }).call(TextHighlightRules.prototype);
    exports3.TextHighlightRules = TextHighlightRules;
  });
  ace.define("ace/mode/behaviour", ["require", "exports", "module"], function(require2, exports3, module3) {
    var Behaviour;
    Behaviour = function() {
      this.$behaviours = {};
    };
    (function() {
      this.add = function(name2, action, callback2) {
        switch (void 0) {
          case this.$behaviours:
            this.$behaviours = {};
          case this.$behaviours[name2]:
            this.$behaviours[name2] = {};
        }
        this.$behaviours[name2][action] = callback2;
      };
      this.addBehaviours = function(behaviours) {
        for (var key in behaviours) {
          for (var action in behaviours[key]) {
            this.add(key, action, behaviours[key][action]);
          }
        }
      };
      this.remove = function(name2) {
        if (this.$behaviours && this.$behaviours[name2]) {
          delete this.$behaviours[name2];
        }
      };
      this.inherit = function(mode, filter3) {
        if (typeof mode === "function") {
          var behaviours = new mode().getBehaviours(filter3);
        } else {
          var behaviours = mode.getBehaviours(filter3);
        }
        this.addBehaviours(behaviours);
      };
      this.getBehaviours = function(filter3) {
        if (!filter3) {
          return this.$behaviours;
        } else {
          var ret = {};
          for (var i2 = 0; i2 < filter3.length; i2++) {
            if (this.$behaviours[filter3[i2]]) {
              ret[filter3[i2]] = this.$behaviours[filter3[i2]];
            }
          }
          return ret;
        }
      };
    }).call(Behaviour.prototype);
    exports3.Behaviour = Behaviour;
  });
  ace.define("ace/token_iterator", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("./range").Range;
    var TokenIterator = (
      /** @class */
      function() {
        function TokenIterator2(session, initialRow, initialColumn) {
          this.$session = session;
          this.$row = initialRow;
          this.$rowTokens = session.getTokens(initialRow);
          var token2 = session.getTokenAt(initialRow, initialColumn);
          this.$tokenIndex = token2 ? token2.index : -1;
        }
        TokenIterator2.prototype.stepBackward = function() {
          this.$tokenIndex -= 1;
          while (this.$tokenIndex < 0) {
            this.$row -= 1;
            if (this.$row < 0) {
              this.$row = 0;
              return null;
            }
            this.$rowTokens = this.$session.getTokens(this.$row);
            this.$tokenIndex = this.$rowTokens.length - 1;
          }
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.stepForward = function() {
          this.$tokenIndex += 1;
          var rowCount;
          while (this.$tokenIndex >= this.$rowTokens.length) {
            this.$row += 1;
            if (!rowCount)
              rowCount = this.$session.getLength();
            if (this.$row >= rowCount) {
              this.$row = rowCount - 1;
              return null;
            }
            this.$rowTokens = this.$session.getTokens(this.$row);
            this.$tokenIndex = 0;
          }
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.getCurrentToken = function() {
          return this.$rowTokens[this.$tokenIndex];
        };
        TokenIterator2.prototype.getCurrentTokenRow = function() {
          return this.$row;
        };
        TokenIterator2.prototype.getCurrentTokenColumn = function() {
          var rowTokens = this.$rowTokens;
          var tokenIndex = this.$tokenIndex;
          var column2 = rowTokens[tokenIndex].start;
          if (column2 !== void 0)
            return column2;
          column2 = 0;
          while (tokenIndex > 0) {
            tokenIndex -= 1;
            column2 += rowTokens[tokenIndex].value.length;
          }
          return column2;
        };
        TokenIterator2.prototype.getCurrentTokenPosition = function() {
          return { row: this.$row, column: this.getCurrentTokenColumn() };
        };
        TokenIterator2.prototype.getCurrentTokenRange = function() {
          var token2 = this.$rowTokens[this.$tokenIndex];
          var column2 = this.getCurrentTokenColumn();
          return new Range(this.$row, column2, this.$row, column2 + token2.value.length);
        };
        return TokenIterator2;
      }()
    );
    exports3.TokenIterator = TokenIterator;
  });
  ace.define("ace/mode/behaviour/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator", "ace/lib/lang"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Behaviour = require2("../behaviour").Behaviour;
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    var lang2 = require2("../../lib/lang");
    var SAFE_INSERT_IN_TOKENS = ["text", "paren.rparen", "rparen", "paren", "punctuation.operator"];
    var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "rparen", "paren", "punctuation.operator", "comment"];
    var context;
    var contextCache = {};
    var defaultQuotes = { '"': '"', "'": "'" };
    var initContext = function(editor) {
      var id2 = -1;
      if (editor.multiSelect) {
        id2 = editor.selection.index;
        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
          contextCache = { rangeCount: editor.multiSelect.rangeCount };
      }
      if (contextCache[id2])
        return context = contextCache[id2];
      context = contextCache[id2] = {
        autoInsertedBrackets: 0,
        autoInsertedRow: -1,
        autoInsertedLineEnd: "",
        maybeInsertedBrackets: 0,
        maybeInsertedRow: -1,
        maybeInsertedLineStart: "",
        maybeInsertedLineEnd: ""
      };
    };
    var getWrapped = function(selection, selected, opening, closing) {
      var rowDiff = selection.end.row - selection.start.row;
      return {
        text: opening + selected + closing,
        selection: [
          0,
          selection.start.column + 1,
          rowDiff,
          selection.end.column + (rowDiff ? 0 : 1)
        ]
      };
    };
    var CstyleBehaviour;
    CstyleBehaviour = function(options) {
      options = options || {};
      this.add("braces", "insertion", function(state, action, editor, session, text2) {
        var cursor = editor.getCursorPosition();
        var line2 = session.doc.getLine(cursor.row);
        if (text2 == "{") {
          initContext(editor);
          var selection = editor.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          var token2 = session.getTokenAt(cursor.row, cursor.column);
          if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "{", "}");
          } else if (token2 && /(?:string)\.quasi|\.xml/.test(token2.type)) {
            var excludeTokens = [
              /tag\-(?:open|name)/,
              /attribute\-name/
            ];
            if (excludeTokens.some(function(el2) {
              return el2.test(token2.type);
            }) || /(string)\.quasi/.test(token2.type) && token2.value[cursor.column - token2.start - 1] !== "$")
              return;
            CstyleBehaviour.recordAutoInsert(editor, session, "}");
            return {
              text: "{}",
              selection: [1, 1]
            };
          } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
            if (/[\]\}\)]/.test(line2[cursor.column]) || editor.inMultiSelectMode || options.braces) {
              CstyleBehaviour.recordAutoInsert(editor, session, "}");
              return {
                text: "{}",
                selection: [1, 1]
              };
            } else {
              CstyleBehaviour.recordMaybeInsert(editor, session, "{");
              return {
                text: "{",
                selection: [1, 1]
              };
            }
          }
        } else if (text2 == "}") {
          initContext(editor);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == "}") {
            var matching = session.$findOpeningBracket("}", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        } else if (text2 == "\n" || text2 == "\r\n") {
          initContext(editor);
          var closing = "";
          if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line2)) {
            closing = lang2.stringRepeat("}", context.maybeInsertedBrackets);
            CstyleBehaviour.clearMaybeInsertedClosing();
          }
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar === "}") {
            var openBracePos = session.findMatchingBracket({ row: cursor.row, column: cursor.column + 1 }, "}");
            if (!openBracePos)
              return null;
            var next_indent = this.$getIndent(session.getLine(openBracePos.row));
          } else if (closing) {
            var next_indent = this.$getIndent(line2);
          } else {
            CstyleBehaviour.clearMaybeInsertedClosing();
            return;
          }
          var indent = next_indent + session.getTabString();
          return {
            text: "\n" + indent + "\n" + next_indent + closing,
            selection: [1, indent.length, 1, indent.length]
          };
        } else {
          CstyleBehaviour.clearMaybeInsertedClosing();
        }
      });
      this.add("braces", "deletion", function(state, action, editor, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "{") {
          initContext(editor);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.end.column, range3.end.column + 1);
          if (rightChar == "}") {
            range3.end.column++;
            return range3;
          } else {
            context.maybeInsertedBrackets--;
          }
        }
      });
      this.add("parens", "insertion", function(state, action, editor, session, text2) {
        if (text2 == "(") {
          initContext(editor);
          var selection = editor.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && editor.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "(", ")");
          } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
            CstyleBehaviour.recordAutoInsert(editor, session, ")");
            return {
              text: "()",
              selection: [1, 1]
            };
          }
        } else if (text2 == ")") {
          initContext(editor);
          var cursor = editor.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == ")") {
            var matching = session.$findOpeningBracket(")", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        }
      });
      this.add("parens", "deletion", function(state, action, editor, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "(") {
          initContext(editor);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == ")") {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("brackets", "insertion", function(state, action, editor, session, text2) {
        if (text2 == "[") {
          initContext(editor);
          var selection = editor.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && editor.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, "[", "]");
          } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
            CstyleBehaviour.recordAutoInsert(editor, session, "]");
            return {
              text: "[]",
              selection: [1, 1]
            };
          }
        } else if (text2 == "]") {
          initContext(editor);
          var cursor = editor.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          if (rightChar == "]") {
            var matching = session.$findOpeningBracket("]", { column: cursor.column + 1, row: cursor.row });
            if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line2, text2)) {
              CstyleBehaviour.popAutoInsertedClosing();
              return {
                text: "",
                selection: [1, 1]
              };
            }
          }
        }
      });
      this.add("brackets", "deletion", function(state, action, editor, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && selected == "[") {
          initContext(editor);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == "]") {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("string_dquotes", "insertion", function(state, action, editor, session, text2) {
        var quotes = session.$mode.$quotes || defaultQuotes;
        if (text2.length == 1 && quotes[text2]) {
          if (this.lineCommentStart && this.lineCommentStart.indexOf(text2) != -1)
            return;
          initContext(editor);
          var quote = text2;
          var selection = editor.getSelectionRange();
          var selected = session.doc.getTextRange(selection);
          if (selected !== "" && (selected.length != 1 || !quotes[selected]) && editor.getWrapBehavioursEnabled()) {
            return getWrapped(selection, selected, quote, quote);
          } else if (!selected) {
            var cursor = editor.getCursorPosition();
            var line2 = session.doc.getLine(cursor.row);
            var leftChar = line2.substring(cursor.column - 1, cursor.column);
            var rightChar = line2.substring(cursor.column, cursor.column + 1);
            var token2 = session.getTokenAt(cursor.row, cursor.column);
            var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
            if (leftChar == "\\" && token2 && /escape/.test(token2.type))
              return null;
            var stringBefore = token2 && /string|escape/.test(token2.type);
            var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
            var pair;
            if (rightChar == quote) {
              pair = stringBefore !== stringAfter;
              if (pair && /string\.end/.test(rightToken.type))
                pair = false;
            } else {
              if (stringBefore && !stringAfter)
                return null;
              if (stringBefore && stringAfter)
                return null;
              var wordRe = session.$mode.tokenRe;
              wordRe.lastIndex = 0;
              var isWordBefore = wordRe.test(leftChar);
              wordRe.lastIndex = 0;
              var isWordAfter = wordRe.test(rightChar);
              var pairQuotesAfter = session.$mode.$pairQuotesAfter;
              var shouldPairQuotes = pairQuotesAfter && pairQuotesAfter[quote] && pairQuotesAfter[quote].test(leftChar);
              if (!shouldPairQuotes && isWordBefore || isWordAfter)
                return null;
              if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
                return null;
              var charBefore = line2[cursor.column - 2];
              if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore)))
                return null;
              pair = true;
            }
            return {
              text: pair ? quote + quote : "",
              selection: [1, 1]
            };
          }
        }
      });
      this.add("string_dquotes", "deletion", function(state, action, editor, session, range3) {
        var quotes = session.$mode.$quotes || defaultQuotes;
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && quotes.hasOwnProperty(selected)) {
          initContext(editor);
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == selected) {
            range3.end.column++;
            return range3;
          }
        }
      });
      if (options.closeDocComment !== false) {
        this.add("doc comment end", "insertion", function(state, action, editor, session, text2) {
          if (state === "doc-start" && (text2 === "\n" || text2 === "\r\n") && editor.selection.isEmpty()) {
            var cursor = editor.getCursorPosition();
            if (cursor.column === 0) {
              return;
            }
            var line2 = session.doc.getLine(cursor.row);
            var nextLine = session.doc.getLine(cursor.row + 1);
            var tokens2 = session.getTokens(cursor.row);
            var index2 = 0;
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              index2 += tokens2[i2].value.length;
              var currentToken = tokens2[i2];
              if (index2 >= cursor.column) {
                if (index2 === cursor.column) {
                  if (!/\.doc/.test(currentToken.type)) {
                    return;
                  }
                  if (/\*\//.test(currentToken.value)) {
                    var nextToken = tokens2[i2 + 1];
                    if (!nextToken || !/\.doc/.test(nextToken.type)) {
                      return;
                    }
                  }
                }
                var cursorPosInToken = cursor.column - (index2 - currentToken.value.length);
                var closeDocPos = currentToken.value.indexOf("*/");
                var openDocPos = currentToken.value.indexOf("/**", closeDocPos > -1 ? closeDocPos + 2 : 0);
                if (openDocPos !== -1 && cursorPosInToken > openDocPos && cursorPosInToken < openDocPos + 3) {
                  return;
                }
                if (closeDocPos !== -1 && openDocPos !== -1 && cursorPosInToken >= closeDocPos && cursorPosInToken <= openDocPos || !/\.doc/.test(currentToken.type)) {
                  return;
                }
                break;
              }
            }
            var indent = this.$getIndent(line2);
            if (/\s*\*/.test(nextLine)) {
              if (/^\s*\*/.test(line2)) {
                return {
                  text: text2 + indent + "* ",
                  selection: [1, 2 + indent.length, 1, 2 + indent.length]
                };
              } else {
                return {
                  text: text2 + indent + " * ",
                  selection: [1, 3 + indent.length, 1, 3 + indent.length]
                };
              }
            }
            if (/\/\*\*/.test(line2.substring(0, cursor.column))) {
              return {
                text: text2 + indent + " * " + text2 + " " + indent + "*/",
                selection: [1, 4 + indent.length, 1, 4 + indent.length]
              };
            }
          }
        });
      }
    };
    CstyleBehaviour.isSaneInsertion = function(editor, session) {
      var cursor = editor.getCursorPosition();
      var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
      if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
        if (/[)}\]]/.test(editor.session.getLine(cursor.row)[cursor.column]))
          return true;
        var iterator22 = new TokenIterator(session, cursor.row, cursor.column + 1);
        if (!this.$matchTokenType(iterator22.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
          return false;
      }
      iterator2.stepForward();
      return iterator2.getCurrentTokenRow() !== cursor.row || this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
    };
    CstyleBehaviour["$matchTokenType"] = function(token2, types2) {
      return types2.indexOf(token2.type || token2) > -1;
    };
    CstyleBehaviour["recordAutoInsert"] = function(editor, session, bracket) {
      var cursor = editor.getCursorPosition();
      var line2 = session.doc.getLine(cursor.row);
      if (!this["isAutoInsertedClosing"](cursor, line2, context.autoInsertedLineEnd[0]))
        context.autoInsertedBrackets = 0;
      context.autoInsertedRow = cursor.row;
      context.autoInsertedLineEnd = bracket + line2.substr(cursor.column);
      context.autoInsertedBrackets++;
    };
    CstyleBehaviour["recordMaybeInsert"] = function(editor, session, bracket) {
      var cursor = editor.getCursorPosition();
      var line2 = session.doc.getLine(cursor.row);
      if (!this["isMaybeInsertedClosing"](cursor, line2))
        context.maybeInsertedBrackets = 0;
      context.maybeInsertedRow = cursor.row;
      context.maybeInsertedLineStart = line2.substr(0, cursor.column) + bracket;
      context.maybeInsertedLineEnd = line2.substr(cursor.column);
      context.maybeInsertedBrackets++;
    };
    CstyleBehaviour["isAutoInsertedClosing"] = function(cursor, line2, bracket) {
      return context.autoInsertedBrackets > 0 && cursor.row === context.autoInsertedRow && bracket === context.autoInsertedLineEnd[0] && line2.substr(cursor.column) === context.autoInsertedLineEnd;
    };
    CstyleBehaviour["isMaybeInsertedClosing"] = function(cursor, line2) {
      return context.maybeInsertedBrackets > 0 && cursor.row === context.maybeInsertedRow && line2.substr(cursor.column) === context.maybeInsertedLineEnd && line2.substr(0, cursor.column) == context.maybeInsertedLineStart;
    };
    CstyleBehaviour["popAutoInsertedClosing"] = function() {
      context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
      context.autoInsertedBrackets--;
    };
    CstyleBehaviour["clearMaybeInsertedClosing"] = function() {
      if (context) {
        context.maybeInsertedBrackets = 0;
        context.maybeInsertedRow = -1;
      }
    };
    oop.inherits(CstyleBehaviour, Behaviour);
    exports3.CstyleBehaviour = CstyleBehaviour;
  });
  ace.define("ace/unicode", ["require", "exports", "module"], function(require2, exports3, module3) {
    var wordChars = [48, 9, 8, 25, 5, 0, 2, 25, 48, 0, 11, 0, 5, 0, 6, 22, 2, 30, 2, 457, 5, 11, 15, 4, 8, 0, 2, 0, 18, 116, 2, 1, 3, 3, 9, 0, 2, 2, 2, 0, 2, 19, 2, 82, 2, 138, 2, 4, 3, 155, 12, 37, 3, 0, 8, 38, 10, 44, 2, 0, 2, 1, 2, 1, 2, 0, 9, 26, 6, 2, 30, 10, 7, 61, 2, 9, 5, 101, 2, 7, 3, 9, 2, 18, 3, 0, 17, 58, 3, 100, 15, 53, 5, 0, 6, 45, 211, 57, 3, 18, 2, 5, 3, 11, 3, 9, 2, 1, 7, 6, 2, 2, 2, 7, 3, 1, 3, 21, 2, 6, 2, 0, 4, 3, 3, 8, 3, 1, 3, 3, 9, 0, 5, 1, 2, 4, 3, 11, 16, 2, 2, 5, 5, 1, 3, 21, 2, 6, 2, 1, 2, 1, 2, 1, 3, 0, 2, 4, 5, 1, 3, 2, 4, 0, 8, 3, 2, 0, 8, 15, 12, 2, 2, 8, 2, 2, 2, 21, 2, 6, 2, 1, 2, 4, 3, 9, 2, 2, 2, 2, 3, 0, 16, 3, 3, 9, 18, 2, 2, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 3, 8, 3, 1, 3, 2, 9, 1, 5, 1, 2, 4, 3, 9, 2, 0, 17, 1, 2, 5, 4, 2, 2, 3, 4, 1, 2, 0, 2, 1, 4, 1, 4, 2, 4, 11, 5, 4, 4, 2, 2, 3, 3, 0, 7, 0, 15, 9, 18, 2, 2, 7, 2, 2, 2, 22, 2, 9, 2, 4, 4, 7, 2, 2, 2, 3, 8, 1, 2, 1, 7, 3, 3, 9, 19, 1, 2, 7, 2, 2, 2, 22, 2, 9, 2, 4, 3, 8, 2, 2, 2, 3, 8, 1, 8, 0, 2, 3, 3, 9, 19, 1, 2, 7, 2, 2, 2, 22, 2, 15, 4, 7, 2, 2, 2, 3, 10, 0, 9, 3, 3, 9, 11, 5, 3, 1, 2, 17, 4, 23, 2, 8, 2, 0, 3, 6, 4, 0, 5, 5, 2, 0, 2, 7, 19, 1, 14, 57, 6, 14, 2, 9, 40, 1, 2, 0, 3, 1, 2, 0, 3, 0, 7, 3, 2, 6, 2, 2, 2, 0, 2, 0, 3, 1, 2, 12, 2, 2, 3, 4, 2, 0, 2, 5, 3, 9, 3, 1, 35, 0, 24, 1, 7, 9, 12, 0, 2, 0, 2, 0, 5, 9, 2, 35, 5, 19, 2, 5, 5, 7, 2, 35, 10, 0, 58, 73, 7, 77, 3, 37, 11, 42, 2, 0, 4, 328, 2, 3, 3, 6, 2, 0, 2, 3, 3, 40, 2, 3, 3, 32, 2, 3, 3, 6, 2, 0, 2, 3, 3, 14, 2, 56, 2, 3, 3, 66, 5, 0, 33, 15, 17, 84, 13, 619, 3, 16, 2, 25, 6, 74, 22, 12, 2, 6, 12, 20, 12, 19, 13, 12, 2, 2, 2, 1, 13, 51, 3, 29, 4, 0, 5, 1, 3, 9, 34, 2, 3, 9, 7, 87, 9, 42, 6, 69, 11, 28, 4, 11, 5, 11, 11, 39, 3, 4, 12, 43, 5, 25, 7, 10, 38, 27, 5, 62, 2, 28, 3, 10, 7, 9, 14, 0, 89, 75, 5, 9, 18, 8, 13, 42, 4, 11, 71, 55, 9, 9, 4, 48, 83, 2, 2, 30, 14, 230, 23, 280, 3, 5, 3, 37, 3, 5, 3, 7, 2, 0, 2, 0, 2, 0, 2, 30, 3, 52, 2, 6, 2, 0, 4, 2, 2, 6, 4, 3, 3, 5, 5, 12, 6, 2, 2, 6, 67, 1, 20, 0, 29, 0, 14, 0, 17, 4, 60, 12, 5, 0, 4, 11, 18, 0, 5, 0, 3, 9, 2, 0, 4, 4, 7, 0, 2, 0, 2, 0, 2, 3, 2, 10, 3, 3, 6, 4, 5, 0, 53, 1, 2684, 46, 2, 46, 2, 132, 7, 6, 15, 37, 11, 53, 10, 0, 17, 22, 10, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 31, 48, 0, 470, 1, 36, 5, 2, 4, 6, 1, 5, 85, 3, 1, 3, 2, 2, 89, 2, 3, 6, 40, 4, 93, 18, 23, 57, 15, 513, 6581, 75, 20939, 53, 1164, 68, 45, 3, 268, 4, 27, 21, 31, 3, 13, 13, 1, 2, 24, 9, 69, 11, 1, 38, 8, 3, 102, 3, 1, 111, 44, 25, 51, 13, 68, 12, 9, 7, 23, 4, 0, 5, 45, 3, 35, 13, 28, 4, 64, 15, 10, 39, 54, 10, 13, 3, 9, 7, 22, 4, 1, 5, 66, 25, 2, 227, 42, 2, 1, 3, 9, 7, 11171, 13, 22, 5, 48, 8453, 301, 3, 61, 3, 105, 39, 6, 13, 4, 6, 11, 2, 12, 2, 4, 2, 0, 2, 1, 2, 1, 2, 107, 34, 362, 19, 63, 3, 53, 41, 11, 5, 15, 17, 6, 13, 1, 25, 2, 33, 4, 2, 134, 20, 9, 8, 25, 5, 0, 2, 25, 12, 88, 4, 5, 3, 5, 3, 5, 3, 2];
    var code2 = 0;
    var str = [];
    for (var i2 = 0; i2 < wordChars.length; i2 += 2) {
      str.push(code2 += wordChars[i2]);
      if (wordChars[i2 + 1])
        str.push(45, code2 += wordChars[i2 + 1]);
    }
    exports3.wordChars = String.fromCharCode.apply(null, str);
  });
  ace.define("ace/mode/text", ["require", "exports", "module", "ace/config", "ace/tokenizer", "ace/mode/text_highlight_rules", "ace/mode/behaviour/cstyle", "ace/unicode", "ace/lib/lang", "ace/token_iterator", "ace/range"], function(require2, exports3, module3) {
    var config2 = require2("../config");
    var Tokenizer = require2("../tokenizer").Tokenizer;
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var CstyleBehaviour = require2("./behaviour/cstyle").CstyleBehaviour;
    var unicode = require2("../unicode");
    var lang2 = require2("../lib/lang");
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var Range = require2("../range").Range;
    var Mode;
    Mode = function() {
      this.HighlightRules = TextHighlightRules;
    };
    (function() {
      this.$defaultBehaviour = new CstyleBehaviour();
      this.tokenRe = new RegExp("^[" + unicode.wordChars + "\\$_]+", "g");
      this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g");
      this.getTokenizer = function() {
        if (!this.$tokenizer) {
          this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig);
          this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
        }
        return this.$tokenizer;
      };
      this.lineCommentStart = "";
      this.blockComment = "";
      this.toggleCommentLines = function(state, session, startRow, endRow) {
        var doc = session.doc;
        var ignoreBlankLines = true;
        var shouldRemove = true;
        var minIndent = Infinity;
        var tabSize = session.getTabSize();
        var insertAtTabStop = false;
        if (!this.lineCommentStart) {
          if (!this.blockComment)
            return false;
          var lineCommentStart = this.blockComment.start;
          var lineCommentEnd = this.blockComment.end;
          var regexpStart = new RegExp("^(\\s*)(?:" + lang2.escapeRegExp(lineCommentStart) + ")");
          var regexpEnd = new RegExp("(?:" + lang2.escapeRegExp(lineCommentEnd) + ")\\s*$");
          var comment2 = function(line2, i2) {
            if (testRemove(line2, i2))
              return;
            if (!ignoreBlankLines || /\S/.test(line2)) {
              doc.insertInLine({ row: i2, column: line2.length }, lineCommentEnd);
              doc.insertInLine({ row: i2, column: minIndent }, lineCommentStart);
            }
          };
          var uncomment = function(line2, i2) {
            var m2;
            if (m2 = line2.match(regexpEnd))
              doc.removeInLine(i2, line2.length - m2[0].length, line2.length);
            if (m2 = line2.match(regexpStart))
              doc.removeInLine(i2, m2[1].length, m2[0].length);
          };
          var testRemove = function(line2, row) {
            if (regexpStart.test(line2))
              return true;
            var tokens2 = session.getTokens(row);
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              if (tokens2[i2].type === "comment")
                return true;
            }
          };
        } else {
          if (Array.isArray(this.lineCommentStart)) {
            var regexpStart = this.lineCommentStart.map(lang2.escapeRegExp).join("|");
            var lineCommentStart = this.lineCommentStart[0];
          } else {
            var regexpStart = lang2.escapeRegExp(this.lineCommentStart);
            var lineCommentStart = this.lineCommentStart;
          }
          regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
          insertAtTabStop = session.getUseSoftTabs();
          var uncomment = function(line2, i2) {
            var m2 = line2.match(regexpStart);
            if (!m2)
              return;
            var start = m2[1].length, end = m2[0].length;
            if (!shouldInsertSpace(line2, start, end) && m2[0][end - 1] == " ")
              end--;
            doc.removeInLine(i2, start, end);
          };
          var commentWithSpace = lineCommentStart + " ";
          var comment2 = function(line2, i2) {
            if (!ignoreBlankLines || /\S/.test(line2)) {
              if (shouldInsertSpace(line2, minIndent, minIndent))
                doc.insertInLine({ row: i2, column: minIndent }, commentWithSpace);
              else
                doc.insertInLine({ row: i2, column: minIndent }, lineCommentStart);
            }
          };
          var testRemove = function(line2, i2) {
            return regexpStart.test(line2);
          };
          var shouldInsertSpace = function(line2, before, after) {
            var spaces = 0;
            while (before-- && line2.charAt(before) == " ")
              spaces++;
            if (spaces % tabSize != 0)
              return false;
            var spaces = 0;
            while (line2.charAt(after++) == " ")
              spaces++;
            if (tabSize > 2)
              return spaces % tabSize != tabSize - 1;
            else
              return spaces % tabSize == 0;
          };
        }
        function iter(fun) {
          for (var i2 = startRow; i2 <= endRow; i2++)
            fun(doc.getLine(i2), i2);
        }
        var minEmptyLength = Infinity;
        iter(function(line2, i2) {
          var indent = line2.search(/\S/);
          if (indent !== -1) {
            if (indent < minIndent)
              minIndent = indent;
            if (shouldRemove && !testRemove(line2, i2))
              shouldRemove = false;
          } else if (minEmptyLength > line2.length) {
            minEmptyLength = line2.length;
          }
        });
        if (minIndent == Infinity) {
          minIndent = minEmptyLength;
          ignoreBlankLines = false;
          shouldRemove = false;
        }
        if (insertAtTabStop && minIndent % tabSize != 0)
          minIndent = Math.floor(minIndent / tabSize) * tabSize;
        iter(shouldRemove ? uncomment : comment2);
      };
      this.toggleBlockComment = function(state, session, range3, cursor) {
        var comment2 = this.blockComment;
        if (!comment2)
          return;
        if (!comment2.start && comment2[0])
          comment2 = comment2[0];
        var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
        var token2 = iterator2.getCurrentToken();
        session.selection;
        var initialRange = session.selection.toOrientedRange();
        var startRow, colDiff;
        if (token2 && /comment/.test(token2.type)) {
          var startRange, endRange;
          while (token2 && /comment/.test(token2.type)) {
            var i2 = token2.value.indexOf(comment2.start);
            if (i2 != -1) {
              var row = iterator2.getCurrentTokenRow();
              var column2 = iterator2.getCurrentTokenColumn() + i2;
              startRange = new Range(row, column2, row, column2 + comment2.start.length);
              break;
            }
            token2 = iterator2.stepBackward();
          }
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          while (token2 && /comment/.test(token2.type)) {
            var i2 = token2.value.indexOf(comment2.end);
            if (i2 != -1) {
              var row = iterator2.getCurrentTokenRow();
              var column2 = iterator2.getCurrentTokenColumn() + i2;
              endRange = new Range(row, column2, row, column2 + comment2.end.length);
              break;
            }
            token2 = iterator2.stepForward();
          }
          if (endRange)
            session.remove(endRange);
          if (startRange) {
            session.remove(startRange);
            startRow = startRange.start.row;
            colDiff = -comment2.start.length;
          }
        } else {
          colDiff = comment2.start.length;
          startRow = range3.start.row;
          session.insert(range3.end, comment2.end);
          session.insert(range3.start, comment2.start);
        }
        if (initialRange.start.row == startRow)
          initialRange.start.column += colDiff;
        if (initialRange.end.row == startRow)
          initialRange.end.column += colDiff;
        session.selection.fromOrientedRange(initialRange);
      };
      this.getNextLineIndent = function(state, line2, tab2) {
        return this.$getIndent(line2);
      };
      this.checkOutdent = function(state, line2, input2) {
        return false;
      };
      this.autoOutdent = function(state, doc, row) {
      };
      this.$getIndent = function(line2) {
        return line2.match(/^\s*/)[0];
      };
      this.createWorker = function(session) {
        return null;
      };
      this.createModeDelegates = function(mapping) {
        this.$embeds = [];
        this.$modes = {};
        for (var i2 in mapping) {
          if (mapping[i2]) {
            var Mode2 = mapping[i2];
            var id2 = Mode2.prototype.$id;
            var mode = config2.$modes[id2];
            if (!mode)
              config2.$modes[id2] = mode = new Mode2();
            if (!config2.$modes[i2])
              config2.$modes[i2] = mode;
            this.$embeds.push(i2);
            this.$modes[i2] = mode;
          }
        }
        var delegations = [
          "toggleBlockComment",
          "toggleCommentLines",
          "getNextLineIndent",
          "checkOutdent",
          "autoOutdent",
          "transformAction",
          "getCompletions"
        ];
        var _loop_1 = function(i3) {
          (function(scope) {
            var functionName = delegations[i3];
            var defaultHandler = scope[functionName];
            scope[delegations[i3]] = function() {
              return this.$delegator(functionName, arguments, defaultHandler);
            };
          })(this_1);
        };
        var this_1 = this;
        for (var i2 = 0; i2 < delegations.length; i2++) {
          _loop_1(i2);
        }
      };
      this.$delegator = function(method4, args, defaultHandler) {
        var state = args[0] || "start";
        if (typeof state != "string") {
          if (Array.isArray(state[2])) {
            var language = state[2][state[2].length - 1];
            var mode = this.$modes[language];
            if (mode)
              return mode[method4].apply(mode, [state[1]].concat([].slice.call(args, 1)));
          }
          state = state[0] || "start";
        }
        for (var i2 = 0; i2 < this.$embeds.length; i2++) {
          if (!this.$modes[this.$embeds[i2]])
            continue;
          var split2 = state.split(this.$embeds[i2]);
          if (!split2[0] && split2[1]) {
            args[0] = split2[1];
            var mode = this.$modes[this.$embeds[i2]];
            return mode[method4].apply(mode, args);
          }
        }
        var ret = defaultHandler.apply(this, args);
        return defaultHandler ? ret : void 0;
      };
      this.transformAction = function(state, action, editor, session, param) {
        if (this.$behaviour) {
          var behaviours = this.$behaviour.getBehaviours();
          for (var key in behaviours) {
            if (behaviours[key][action]) {
              var ret = behaviours[key][action].apply(this, arguments);
              if (ret) {
                return ret;
              }
            }
          }
        }
      };
      this.getKeywords = function(append3) {
        if (!this.completionKeywords) {
          var rules2 = this.$tokenizer["rules"];
          var completionKeywords = [];
          for (var rule in rules2) {
            var ruleItr = rules2[rule];
            for (var r2 = 0, l2 = ruleItr.length; r2 < l2; r2++) {
              if (typeof ruleItr[r2].token === "string") {
                if (/keyword|support|storage/.test(ruleItr[r2].token))
                  completionKeywords.push(ruleItr[r2].regex);
              } else if (typeof ruleItr[r2].token === "object") {
                for (var a2 = 0, aLength = ruleItr[r2].token.length; a2 < aLength; a2++) {
                  if (/keyword|support|storage/.test(ruleItr[r2].token[a2])) {
                    var rule = ruleItr[r2].regex.match(/\(.+?\)/g)[a2];
                    completionKeywords.push(rule.substr(1, rule.length - 2));
                  }
                }
              }
            }
          }
          this.completionKeywords = completionKeywords;
        }
        if (!append3)
          return this.$keywordList;
        return completionKeywords.concat(this.$keywordList || []);
      };
      this.$createKeywordList = function() {
        if (!this.$highlightRules)
          this.getTokenizer();
        return this.$keywordList = this.$highlightRules.$keywordList || [];
      };
      this.getCompletions = function(state, session, pos, prefix) {
        var keywords = this.$keywordList || this.$createKeywordList();
        return keywords.map(function(word) {
          return {
            name: word,
            value: word,
            score: 0,
            meta: "keyword"
          };
        });
      };
      this.$id = "ace/mode/text";
    }).call(Mode.prototype);
    exports3.Mode = Mode;
  });
  ace.define("ace/line_widgets", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("./lib/dom");
    var LineWidgets = (
      /** @class */
      function() {
        function LineWidgets2(session) {
          this.session = session;
          this.session.widgetManager = this;
          this.session.getRowLength = this.getRowLength;
          this.session.$getWidgetScreenLength = this.$getWidgetScreenLength;
          this.updateOnChange = this.updateOnChange.bind(this);
          this.renderWidgets = this.renderWidgets.bind(this);
          this.measureWidgets = this.measureWidgets.bind(this);
          this.session._changedWidgets = [];
          this.$onChangeEditor = this.$onChangeEditor.bind(this);
          this.session.on("change", this.updateOnChange);
          this.session.on("changeFold", this.updateOnFold);
          this.session.on("changeEditor", this.$onChangeEditor);
        }
        LineWidgets2.prototype.getRowLength = function(row) {
          var h3;
          if (this.lineWidgets)
            h3 = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
          else
            h3 = 0;
          if (!this["$useWrapMode"] || !this["$wrapData"][row]) {
            return 1 + h3;
          } else {
            return this["$wrapData"][row].length + 1 + h3;
          }
        };
        LineWidgets2.prototype.$getWidgetScreenLength = function() {
          var screenRows = 0;
          this.lineWidgets.forEach(function(w2) {
            if (w2 && w2.rowCount && !w2.hidden)
              screenRows += w2.rowCount;
          });
          return screenRows;
        };
        LineWidgets2.prototype.$onChangeEditor = function(e2) {
          this.attach(e2.editor);
        };
        LineWidgets2.prototype.attach = function(editor) {
          if (editor && editor.widgetManager && editor.widgetManager != this)
            editor.widgetManager.detach();
          if (this.editor == editor)
            return;
          this.detach();
          this.editor = editor;
          if (editor) {
            editor.widgetManager = this;
            editor.renderer.on("beforeRender", this.measureWidgets);
            editor.renderer.on("afterRender", this.renderWidgets);
          }
        };
        LineWidgets2.prototype.detach = function(e2) {
          var editor = this.editor;
          if (!editor)
            return;
          this.editor = null;
          editor.widgetManager = null;
          editor.renderer.off("beforeRender", this.measureWidgets);
          editor.renderer.off("afterRender", this.renderWidgets);
          var lineWidgets = this.session.lineWidgets;
          lineWidgets && lineWidgets.forEach(function(w2) {
            if (w2 && w2.el && w2.el.parentNode) {
              w2._inDocument = false;
              w2.el.parentNode.removeChild(w2.el);
            }
          });
        };
        LineWidgets2.prototype.updateOnFold = function(e2, session) {
          var lineWidgets = session.lineWidgets;
          if (!lineWidgets || !e2.action)
            return;
          var fold = e2.data;
          var start = fold.start.row;
          var end = fold.end.row;
          var hide = e2.action == "add";
          for (var i2 = start + 1; i2 < end; i2++) {
            if (lineWidgets[i2])
              lineWidgets[i2].hidden = hide;
          }
          if (lineWidgets[end]) {
            if (hide) {
              if (!lineWidgets[start])
                lineWidgets[start] = lineWidgets[end];
              else
                lineWidgets[end].hidden = hide;
            } else {
              if (lineWidgets[start] == lineWidgets[end])
                lineWidgets[start] = void 0;
              lineWidgets[end].hidden = hide;
            }
          }
        };
        LineWidgets2.prototype.updateOnChange = function(delta) {
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var startRow = delta.start.row;
          var len = delta.end.row - startRow;
          if (len === 0)
            ;
          else if (delta.action == "remove") {
            var removed = lineWidgets.splice(startRow + 1, len);
            if (!lineWidgets[startRow] && removed[removed.length - 1]) {
              lineWidgets[startRow] = removed.pop();
            }
            removed.forEach(function(w2) {
              w2 && this.removeLineWidget(w2);
            }, this);
            this.$updateRows();
          } else {
            var args = new Array(len);
            if (lineWidgets[startRow] && lineWidgets[startRow].column != null) {
              if (delta.start.column > lineWidgets[startRow].column)
                startRow++;
            }
            args.unshift(startRow, 0);
            lineWidgets.splice.apply(lineWidgets, args);
            this.$updateRows();
          }
        };
        LineWidgets2.prototype.$updateRows = function() {
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var noWidgets = true;
          lineWidgets.forEach(function(w2, i2) {
            if (w2) {
              noWidgets = false;
              w2.row = i2;
              while (w2.$oldWidget) {
                w2.$oldWidget.row = i2;
                w2 = w2.$oldWidget;
              }
            }
          });
          if (noWidgets)
            this.session.lineWidgets = null;
        };
        LineWidgets2.prototype.$registerLineWidget = function(w2) {
          if (!this.session.lineWidgets)
            this.session.lineWidgets = new Array(this.session.getLength());
          var old = this.session.lineWidgets[w2.row];
          if (old) {
            w2.$oldWidget = old;
            if (old.el && old.el.parentNode) {
              old.el.parentNode.removeChild(old.el);
              old._inDocument = false;
            }
          }
          this.session.lineWidgets[w2.row] = w2;
          return w2;
        };
        LineWidgets2.prototype.addLineWidget = function(w2) {
          this.$registerLineWidget(w2);
          w2.session = this.session;
          if (!this.editor)
            return w2;
          var renderer = this.editor.renderer;
          if (w2.html && !w2.el) {
            w2.el = dom.createElement("div");
            w2.el.innerHTML = w2.html;
          }
          if (w2.text && !w2.el) {
            w2.el = dom.createElement("div");
            w2.el.textContent = w2.text;
          }
          if (w2.el) {
            dom.addCssClass(w2.el, "ace_lineWidgetContainer");
            if (w2.className) {
              dom.addCssClass(w2.el, w2.className);
            }
            w2.el.style.position = "absolute";
            w2.el.style.zIndex = "5";
            renderer.container.appendChild(w2.el);
            w2._inDocument = true;
            if (!w2.coverGutter) {
              w2.el.style.zIndex = "3";
            }
            if (w2.pixelHeight == null) {
              w2.pixelHeight = w2.el.offsetHeight;
            }
          }
          if (w2.rowCount == null) {
            w2.rowCount = w2.pixelHeight / renderer.layerConfig.lineHeight;
          }
          var fold = this.session.getFoldAt(w2.row, 0);
          w2.$fold = fold;
          if (fold) {
            var lineWidgets = this.session.lineWidgets;
            if (w2.row == fold.end.row && !lineWidgets[fold.start.row])
              lineWidgets[fold.start.row] = w2;
            else
              w2.hidden = true;
          }
          this.session._emit("changeFold", { data: { start: { row: w2.row } } });
          this.$updateRows();
          this.renderWidgets(null, renderer);
          this.onWidgetChanged(w2);
          return w2;
        };
        LineWidgets2.prototype.removeLineWidget = function(w2) {
          w2._inDocument = false;
          w2.session = null;
          if (w2.el && w2.el.parentNode)
            w2.el.parentNode.removeChild(w2.el);
          if (w2.editor && w2.editor.destroy)
            try {
              w2.editor.destroy();
            } catch (e2) {
            }
          if (this.session.lineWidgets) {
            var w1 = this.session.lineWidgets[w2.row];
            if (w1 == w2) {
              this.session.lineWidgets[w2.row] = w2.$oldWidget;
              if (w2.$oldWidget)
                this.onWidgetChanged(w2.$oldWidget);
            } else {
              while (w1) {
                if (w1.$oldWidget == w2) {
                  w1.$oldWidget = w2.$oldWidget;
                  break;
                }
                w1 = w1.$oldWidget;
              }
            }
          }
          this.session._emit("changeFold", { data: { start: { row: w2.row } } });
          this.$updateRows();
        };
        LineWidgets2.prototype.getWidgetsAtRow = function(row) {
          var lineWidgets = this.session.lineWidgets;
          var w2 = lineWidgets && lineWidgets[row];
          var list2 = [];
          while (w2) {
            list2.push(w2);
            w2 = w2.$oldWidget;
          }
          return list2;
        };
        LineWidgets2.prototype.onWidgetChanged = function(w2) {
          this.session._changedWidgets.push(w2);
          this.editor && this.editor.renderer.updateFull();
        };
        LineWidgets2.prototype.measureWidgets = function(e2, renderer) {
          var changedWidgets = this.session._changedWidgets;
          var config2 = renderer.layerConfig;
          if (!changedWidgets || !changedWidgets.length)
            return;
          var min2 = Infinity;
          for (var i2 = 0; i2 < changedWidgets.length; i2++) {
            var w2 = changedWidgets[i2];
            if (!w2 || !w2.el)
              continue;
            if (w2.session != this.session)
              continue;
            if (!w2._inDocument) {
              if (this.session.lineWidgets[w2.row] != w2)
                continue;
              w2._inDocument = true;
              renderer.container.appendChild(w2.el);
            }
            w2.h = w2.el.offsetHeight;
            if (!w2.fixedWidth) {
              w2.w = w2.el.offsetWidth;
              w2.screenWidth = Math.ceil(w2.w / config2.characterWidth);
            }
            var rowCount = w2.h / config2.lineHeight;
            if (w2.coverLine) {
              rowCount -= this.session.getRowLineCount(w2.row);
              if (rowCount < 0)
                rowCount = 0;
            }
            if (w2.rowCount != rowCount) {
              w2.rowCount = rowCount;
              if (w2.row < min2)
                min2 = w2.row;
            }
          }
          if (min2 != Infinity) {
            this.session._emit("changeFold", { data: { start: { row: min2 } } });
            this.session.lineWidgetWidth = null;
          }
          this.session._changedWidgets = [];
        };
        LineWidgets2.prototype.renderWidgets = function(e2, renderer) {
          var config2 = renderer.layerConfig;
          var lineWidgets = this.session.lineWidgets;
          if (!lineWidgets)
            return;
          var first = Math.min(this.firstRow, config2.firstRow);
          var last = Math.max(this.lastRow, config2.lastRow, lineWidgets.length);
          while (first > 0 && !lineWidgets[first])
            first--;
          this.firstRow = config2.firstRow;
          this.lastRow = config2.lastRow;
          renderer.$cursorLayer.config = config2;
          for (var i2 = first; i2 <= last; i2++) {
            var w2 = lineWidgets[i2];
            if (!w2 || !w2.el)
              continue;
            if (w2.hidden) {
              w2.el.style.top = -100 - (w2.pixelHeight || 0) + "px";
              continue;
            }
            if (!w2._inDocument) {
              w2._inDocument = true;
              renderer.container.appendChild(w2.el);
            }
            var top2 = renderer.$cursorLayer.getPixelPosition({ row: i2, column: 0 }, true).top;
            if (!w2.coverLine)
              top2 += config2.lineHeight * this.session.getRowLineCount(w2.row);
            w2.el.style.top = top2 - config2.offset + "px";
            var left2 = w2.coverGutter ? 0 : renderer.gutterWidth;
            if (!w2.fixedWidth)
              left2 -= renderer.scrollLeft;
            w2.el.style.left = left2 + "px";
            if (w2.fullWidth && w2.screenWidth) {
              w2.el.style.minWidth = config2.width + 2 * config2.padding + "px";
            }
            if (w2.fixedWidth) {
              w2.el.style.right = renderer.scrollBar.getWidth() + "px";
            } else {
              w2.el.style.right = "";
            }
          }
        };
        return LineWidgets2;
      }()
    );
    exports3.LineWidgets = LineWidgets;
  });
  ace.define("ace/apply_delta", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.applyDelta = function(docLines, delta, doNotValidate) {
      var row = delta.start.row;
      var startColumn = delta.start.column;
      var line2 = docLines[row] || "";
      switch (delta.action) {
        case "insert":
          var lines = delta.lines;
          if (lines.length === 1) {
            docLines[row] = line2.substring(0, startColumn) + delta.lines[0] + line2.substring(startColumn);
          } else {
            var args = [row, 1].concat(delta.lines);
            docLines.splice.apply(docLines, args);
            docLines[row] = line2.substring(0, startColumn) + docLines[row];
            docLines[row + delta.lines.length - 1] += line2.substring(startColumn);
          }
          break;
        case "remove":
          var endColumn = delta.end.column;
          var endRow = delta.end.row;
          if (row === endRow) {
            docLines[row] = line2.substring(0, startColumn) + line2.substring(endColumn);
          } else {
            docLines.splice(row, endRow - row + 1, line2.substring(0, startColumn) + docLines[endRow].substring(endColumn));
          }
          break;
      }
    };
  });
  ace.define("ace/anchor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Anchor = (
      /** @class */
      function() {
        function Anchor2(doc, row, column2) {
          this.$onChange = this.onChange.bind(this);
          this.attach(doc);
          if (typeof row != "number")
            this.setPosition(row.row, row.column);
          else
            this.setPosition(row, column2);
        }
        Anchor2.prototype.getPosition = function() {
          return this.$clipPositionToDocument(this.row, this.column);
        };
        Anchor2.prototype.getDocument = function() {
          return this.document;
        };
        Anchor2.prototype.onChange = function(delta) {
          if (delta.start.row == delta.end.row && delta.start.row != this.row)
            return;
          if (delta.start.row > this.row)
            return;
          var point2 = $getTransformedPoint(delta, { row: this.row, column: this.column }, this.$insertRight);
          this.setPosition(point2.row, point2.column, true);
        };
        Anchor2.prototype.setPosition = function(row, column2, noClip) {
          var pos;
          if (noClip) {
            pos = {
              row,
              column: column2
            };
          } else {
            pos = this.$clipPositionToDocument(row, column2);
          }
          if (this.row == pos.row && this.column == pos.column)
            return;
          var old = {
            row: this.row,
            column: this.column
          };
          this.row = pos.row;
          this.column = pos.column;
          this._signal("change", {
            old,
            value: pos
          });
        };
        Anchor2.prototype.detach = function() {
          this.document.off("change", this.$onChange);
        };
        Anchor2.prototype.attach = function(doc) {
          this.document = doc || this.document;
          this.document.on("change", this.$onChange);
        };
        Anchor2.prototype.$clipPositionToDocument = function(row, column2) {
          var pos = {};
          if (row >= this.document.getLength()) {
            pos.row = Math.max(0, this.document.getLength() - 1);
            pos.column = this.document.getLine(pos.row).length;
          } else if (row < 0) {
            pos.row = 0;
            pos.column = 0;
          } else {
            pos.row = row;
            pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column2));
          }
          if (column2 < 0)
            pos.column = 0;
          return pos;
        };
        return Anchor2;
      }()
    );
    Anchor.prototype.$insertRight = false;
    oop.implement(Anchor.prototype, EventEmitter2);
    function $pointsInOrder(point1, point2, equalPointsInOrder) {
      var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
      return point1.row < point2.row || point1.row == point2.row && bColIsAfter;
    }
    function $getTransformedPoint(delta, point2, moveIfEqual) {
      var deltaIsInsert = delta.action == "insert";
      var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
      var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
      var deltaStart = delta.start;
      var deltaEnd = deltaIsInsert ? deltaStart : delta.end;
      if ($pointsInOrder(point2, deltaStart, moveIfEqual)) {
        return {
          row: point2.row,
          column: point2.column
        };
      }
      if ($pointsInOrder(deltaEnd, point2, !moveIfEqual)) {
        return {
          row: point2.row + deltaRowShift,
          column: point2.column + (point2.row == deltaEnd.row ? deltaColShift : 0)
        };
      }
      return {
        row: deltaStart.row,
        column: deltaStart.column
      };
    }
    exports3.Anchor = Anchor;
  });
  ace.define("ace/document", ["require", "exports", "module", "ace/lib/oop", "ace/apply_delta", "ace/lib/event_emitter", "ace/range", "ace/anchor"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var applyDelta = require2("./apply_delta").applyDelta;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Range = require2("./range").Range;
    var Anchor = require2("./anchor").Anchor;
    var Document = (
      /** @class */
      function() {
        function Document2(textOrLines) {
          this.$lines = [""];
          if (textOrLines.length === 0) {
            this.$lines = [""];
          } else if (Array.isArray(textOrLines)) {
            this.insertMergedLines({ row: 0, column: 0 }, textOrLines);
          } else {
            this.insert({ row: 0, column: 0 }, textOrLines);
          }
        }
        Document2.prototype.setValue = function(text2) {
          var len = this.getLength() - 1;
          this.remove(new Range(0, 0, len, this.getLine(len).length));
          this.insert({ row: 0, column: 0 }, text2 || "");
        };
        Document2.prototype.getValue = function() {
          return this.getAllLines().join(this.getNewLineCharacter());
        };
        Document2.prototype.createAnchor = function(row, column2) {
          return new Anchor(this, row, column2);
        };
        Document2.prototype.$detectNewLine = function(text2) {
          var match5 = text2.match(/^.*?(\r\n|\r|\n)/m);
          this.$autoNewLine = match5 ? match5[1] : "\n";
          this._signal("changeNewLineMode");
        };
        Document2.prototype.getNewLineCharacter = function() {
          switch (this.$newLineMode) {
            case "windows":
              return "\r\n";
            case "unix":
              return "\n";
            default:
              return this.$autoNewLine || "\n";
          }
        };
        Document2.prototype.setNewLineMode = function(newLineMode) {
          if (this.$newLineMode === newLineMode)
            return;
          this.$newLineMode = newLineMode;
          this._signal("changeNewLineMode");
        };
        Document2.prototype.getNewLineMode = function() {
          return this.$newLineMode;
        };
        Document2.prototype.isNewLine = function(text2) {
          return text2 == "\r\n" || text2 == "\r" || text2 == "\n";
        };
        Document2.prototype.getLine = function(row) {
          return this.$lines[row] || "";
        };
        Document2.prototype.getLines = function(firstRow, lastRow) {
          return this.$lines.slice(firstRow, lastRow + 1);
        };
        Document2.prototype.getAllLines = function() {
          return this.getLines(0, this.getLength());
        };
        Document2.prototype.getLength = function() {
          return this.$lines.length;
        };
        Document2.prototype.getTextRange = function(range3) {
          return this.getLinesForRange(range3).join(this.getNewLineCharacter());
        };
        Document2.prototype.getLinesForRange = function(range3) {
          var lines;
          if (range3.start.row === range3.end.row) {
            lines = [this.getLine(range3.start.row).substring(range3.start.column, range3.end.column)];
          } else {
            lines = this.getLines(range3.start.row, range3.end.row);
            lines[0] = (lines[0] || "").substring(range3.start.column);
            var l2 = lines.length - 1;
            if (range3.end.row - range3.start.row == l2)
              lines[l2] = lines[l2].substring(0, range3.end.column);
          }
          return lines;
        };
        Document2.prototype.insertLines = function(row, lines) {
          console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
          return this.insertFullLines(row, lines);
        };
        Document2.prototype.removeLines = function(firstRow, lastRow) {
          console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
          return this.removeFullLines(firstRow, lastRow);
        };
        Document2.prototype.insertNewLine = function(position2) {
          console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
          return this.insertMergedLines(position2, ["", ""]);
        };
        Document2.prototype.insert = function(position2, text2) {
          if (this.getLength() <= 1)
            this.$detectNewLine(text2);
          return this.insertMergedLines(position2, this.$split(text2));
        };
        Document2.prototype.insertInLine = function(position2, text2) {
          var start = this.clippedPos(position2.row, position2.column);
          var end = this.pos(position2.row, position2.column + text2.length);
          this.applyDelta({
            start,
            end,
            action: "insert",
            lines: [text2]
          }, true);
          return this.clonePos(end);
        };
        Document2.prototype.clippedPos = function(row, column2) {
          var length2 = this.getLength();
          if (row === void 0) {
            row = length2;
          } else if (row < 0) {
            row = 0;
          } else if (row >= length2) {
            row = length2 - 1;
            column2 = void 0;
          }
          var line2 = this.getLine(row);
          if (column2 == void 0)
            column2 = line2.length;
          column2 = Math.min(Math.max(column2, 0), line2.length);
          return { row, column: column2 };
        };
        Document2.prototype.clonePos = function(pos) {
          return { row: pos.row, column: pos.column };
        };
        Document2.prototype.pos = function(row, column2) {
          return { row, column: column2 };
        };
        Document2.prototype.$clipPosition = function(position2) {
          var length2 = this.getLength();
          if (position2.row >= length2) {
            position2.row = Math.max(0, length2 - 1);
            position2.column = this.getLine(length2 - 1).length;
          } else {
            position2.row = Math.max(0, position2.row);
            position2.column = Math.min(Math.max(position2.column, 0), this.getLine(position2.row).length);
          }
          return position2;
        };
        Document2.prototype.insertFullLines = function(row, lines) {
          row = Math.min(Math.max(row, 0), this.getLength());
          var column2 = 0;
          if (row < this.getLength()) {
            lines = lines.concat([""]);
            column2 = 0;
          } else {
            lines = [""].concat(lines);
            row--;
            column2 = this.$lines[row].length;
          }
          this.insertMergedLines({ row, column: column2 }, lines);
        };
        Document2.prototype.insertMergedLines = function(position2, lines) {
          var start = this.clippedPos(position2.row, position2.column);
          var end = {
            row: start.row + lines.length - 1,
            column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
          };
          this.applyDelta({
            start,
            end,
            action: "insert",
            lines
          });
          return this.clonePos(end);
        };
        Document2.prototype.remove = function(range3) {
          var start = this.clippedPos(range3.start.row, range3.start.column);
          var end = this.clippedPos(range3.end.row, range3.end.column);
          this.applyDelta({
            start,
            end,
            action: "remove",
            lines: this.getLinesForRange({ start, end })
          });
          return this.clonePos(start);
        };
        Document2.prototype.removeInLine = function(row, startColumn, endColumn) {
          var start = this.clippedPos(row, startColumn);
          var end = this.clippedPos(row, endColumn);
          this.applyDelta({
            start,
            end,
            action: "remove",
            lines: this.getLinesForRange({ start, end })
          }, true);
          return this.clonePos(start);
        };
        Document2.prototype.removeFullLines = function(firstRow, lastRow) {
          firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
          lastRow = Math.min(Math.max(0, lastRow), this.getLength() - 1);
          var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
          var deleteLastNewLine = lastRow < this.getLength() - 1;
          var startRow = deleteFirstNewLine ? firstRow - 1 : firstRow;
          var startCol = deleteFirstNewLine ? this.getLine(startRow).length : 0;
          var endRow = deleteLastNewLine ? lastRow + 1 : lastRow;
          var endCol = deleteLastNewLine ? 0 : this.getLine(endRow).length;
          var range3 = new Range(startRow, startCol, endRow, endCol);
          var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
          this.applyDelta({
            start: range3.start,
            end: range3.end,
            action: "remove",
            lines: this.getLinesForRange(range3)
          });
          return deletedLines;
        };
        Document2.prototype.removeNewLine = function(row) {
          if (row < this.getLength() - 1 && row >= 0) {
            this.applyDelta({
              start: this.pos(row, this.getLine(row).length),
              end: this.pos(row + 1, 0),
              action: "remove",
              lines: ["", ""]
            });
          }
        };
        Document2.prototype.replace = function(range3, text2) {
          if (!(range3 instanceof Range))
            range3 = Range.fromPoints(range3.start, range3.end);
          if (text2.length === 0 && range3.isEmpty())
            return range3.start;
          if (text2 == this.getTextRange(range3))
            return range3.end;
          this.remove(range3);
          var end;
          if (text2) {
            end = this.insert(range3.start, text2);
          } else {
            end = range3.start;
          }
          return end;
        };
        Document2.prototype.applyDeltas = function(deltas) {
          for (var i2 = 0; i2 < deltas.length; i2++) {
            this.applyDelta(deltas[i2]);
          }
        };
        Document2.prototype.revertDeltas = function(deltas) {
          for (var i2 = deltas.length - 1; i2 >= 0; i2--) {
            this.revertDelta(deltas[i2]);
          }
        };
        Document2.prototype.applyDelta = function(delta, doNotValidate) {
          var isInsert = delta.action == "insert";
          if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] : !Range.comparePoints(delta.start, delta.end)) {
            return;
          }
          if (isInsert && delta.lines.length > 2e4) {
            this.$splitAndapplyLargeDelta(delta, 2e4);
          } else {
            applyDelta(this.$lines, delta, doNotValidate);
            this._signal("change", delta);
          }
        };
        Document2.prototype.$safeApplyDelta = function(delta) {
          var docLength = this.$lines.length;
          if (delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength || delta.action == "insert" && delta.start.row <= docLength) {
            this.applyDelta(delta);
          }
        };
        Document2.prototype.$splitAndapplyLargeDelta = function(delta, MAX) {
          var lines = delta.lines;
          var l2 = lines.length - MAX + 1;
          var row = delta.start.row;
          var column2 = delta.start.column;
          for (var from2 = 0, to2 = 0; from2 < l2; from2 = to2) {
            to2 += MAX - 1;
            var chunk = lines.slice(from2, to2);
            chunk.push("");
            this.applyDelta({
              start: this.pos(row + from2, column2),
              end: this.pos(row + to2, column2 = 0),
              action: delta.action,
              lines: chunk
            }, true);
          }
          delta.lines = lines.slice(from2);
          delta.start.row = row + from2;
          delta.start.column = column2;
          this.applyDelta(delta, true);
        };
        Document2.prototype.revertDelta = function(delta) {
          this.$safeApplyDelta({
            start: this.clonePos(delta.start),
            end: this.clonePos(delta.end),
            action: delta.action == "insert" ? "remove" : "insert",
            lines: delta.lines.slice()
          });
        };
        Document2.prototype.indexToPosition = function(index2, startRow) {
          var lines = this.$lines || this.getAllLines();
          var newlineLength = this.getNewLineCharacter().length;
          for (var i2 = startRow || 0, l2 = lines.length; i2 < l2; i2++) {
            index2 -= lines[i2].length + newlineLength;
            if (index2 < 0)
              return { row: i2, column: index2 + lines[i2].length + newlineLength };
          }
          return { row: l2 - 1, column: index2 + lines[l2 - 1].length + newlineLength };
        };
        Document2.prototype.positionToIndex = function(pos, startRow) {
          var lines = this.$lines || this.getAllLines();
          var newlineLength = this.getNewLineCharacter().length;
          var index2 = 0;
          var row = Math.min(pos.row, lines.length);
          for (var i2 = startRow || 0; i2 < row; ++i2)
            index2 += lines[i2].length + newlineLength;
          return index2 + pos.column;
        };
        Document2.prototype.$split = function(text2) {
          return text2.split(/\r\n|\r|\n/);
        };
        return Document2;
      }()
    );
    Document.prototype.$autoNewLine = "";
    Document.prototype.$newLineMode = "auto";
    oop.implement(Document.prototype, EventEmitter2);
    exports3.Document = Document;
  });
  ace.define("ace/background_tokenizer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var BackgroundTokenizer = (
      /** @class */
      function() {
        function BackgroundTokenizer2(tokenizer, session) {
          this.running = false;
          this.lines = [];
          this.states = [];
          this.currentLine = 0;
          this.tokenizer = tokenizer;
          var self2 = this;
          this.$worker = function() {
            if (!self2.running) {
              return;
            }
            var workerStart = /* @__PURE__ */ new Date();
            var currentLine = self2.currentLine;
            var endLine = -1;
            var doc = self2.doc;
            var startLine = currentLine;
            while (self2.lines[currentLine])
              currentLine++;
            var len = doc.getLength();
            var processedLines = 0;
            self2.running = false;
            while (currentLine < len) {
              self2.$tokenizeRow(currentLine);
              endLine = currentLine;
              do {
                currentLine++;
              } while (self2.lines[currentLine]);
              processedLines++;
              if (processedLines % 5 === 0 && /* @__PURE__ */ new Date() - workerStart > 20) {
                self2.running = setTimeout(self2.$worker, 20);
                break;
              }
            }
            self2.currentLine = currentLine;
            if (endLine == -1)
              endLine = currentLine;
            if (startLine <= endLine)
              self2.fireUpdateEvent(startLine, endLine);
          };
        }
        BackgroundTokenizer2.prototype.setTokenizer = function(tokenizer) {
          this.tokenizer = tokenizer;
          this.lines = [];
          this.states = [];
          this.start(0);
        };
        BackgroundTokenizer2.prototype.setDocument = function(doc) {
          this.doc = doc;
          this.lines = [];
          this.states = [];
          this.stop();
        };
        BackgroundTokenizer2.prototype.fireUpdateEvent = function(firstRow, lastRow) {
          var data = {
            first: firstRow,
            last: lastRow
          };
          this._signal("update", { data });
        };
        BackgroundTokenizer2.prototype.start = function(startRow) {
          this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
          this.lines.splice(this.currentLine, this.lines.length);
          this.states.splice(this.currentLine, this.states.length);
          this.stop();
          this.running = setTimeout(this.$worker, 700);
        };
        BackgroundTokenizer2.prototype.scheduleStart = function() {
          if (!this.running)
            this.running = setTimeout(this.$worker, 700);
        };
        BackgroundTokenizer2.prototype.$updateOnChange = function(delta) {
          var startRow = delta.start.row;
          var len = delta.end.row - startRow;
          if (len === 0) {
            this.lines[startRow] = null;
          } else if (delta.action == "remove") {
            this.lines.splice(startRow, len + 1, null);
            this.states.splice(startRow, len + 1, null);
          } else {
            var args = Array(len + 1);
            args.unshift(startRow, 1);
            this.lines.splice.apply(this.lines, args);
            this.states.splice.apply(this.states, args);
          }
          this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
          this.stop();
        };
        BackgroundTokenizer2.prototype.stop = function() {
          if (this.running)
            clearTimeout(this.running);
          this.running = false;
        };
        BackgroundTokenizer2.prototype.getTokens = function(row) {
          return this.lines[row] || this.$tokenizeRow(row);
        };
        BackgroundTokenizer2.prototype.getState = function(row) {
          if (this.currentLine == row)
            this.$tokenizeRow(row);
          return this.states[row] || "start";
        };
        BackgroundTokenizer2.prototype.$tokenizeRow = function(row) {
          var line2 = this.doc.getLine(row);
          var state = this.states[row - 1];
          var data = this.tokenizer.getLineTokens(line2, state, row);
          if (this.states[row] + "" !== data.state + "") {
            this.states[row] = data.state;
            this.lines[row + 1] = null;
            if (this.currentLine > row + 1)
              this.currentLine = row + 1;
          } else if (this.currentLine == row) {
            this.currentLine = row + 1;
          }
          return this.lines[row] = data.tokens;
        };
        BackgroundTokenizer2.prototype.cleanup = function() {
          this.running = false;
          this.lines = [];
          this.states = [];
          this.currentLine = 0;
          this.removeAllListeners();
        };
        return BackgroundTokenizer2;
      }()
    );
    oop.implement(BackgroundTokenizer.prototype, EventEmitter2);
    exports3.BackgroundTokenizer = BackgroundTokenizer;
  });
  ace.define("ace/search_highlight", ["require", "exports", "module", "ace/lib/lang", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("./lib/lang");
    var Range = require2("./range").Range;
    var SearchHighlight = (
      /** @class */
      function() {
        function SearchHighlight2(regExp, clazz, type4) {
          if (type4 === void 0) {
            type4 = "text";
          }
          this.setRegexp(regExp);
          this.clazz = clazz;
          this.type = type4;
          this.docLen = 0;
        }
        SearchHighlight2.prototype.setRegexp = function(regExp) {
          if (this.regExp + "" == regExp + "")
            return;
          this.regExp = regExp;
          this.cache = [];
        };
        SearchHighlight2.prototype.update = function(html2, markerLayer, session, config2) {
          if (!this.regExp)
            return;
          var start = config2.firstRow;
          var end = config2.lastRow;
          var renderedMarkerRanges = {};
          var _search = session.$editor && session.$editor.$search;
          var mtSearch = _search && _search.$isMultilineSearch(session.$editor.getLastSearchOptions());
          for (var i2 = start; i2 <= end; i2++) {
            var ranges = this.cache[i2];
            if (ranges == null || session.getValue().length != this.docLen) {
              if (mtSearch) {
                ranges = [];
                var match5 = _search.$multiLineForward(session, this.regExp, i2, end);
                if (match5) {
                  var end_row = match5.endRow <= end ? match5.endRow - 1 : end;
                  if (end_row > i2)
                    i2 = end_row;
                  ranges.push(new Range(match5.startRow, match5.startCol, match5.endRow, match5.endCol));
                }
                if (ranges.length > this.MAX_RANGES)
                  ranges = ranges.slice(0, this.MAX_RANGES);
              } else {
                ranges = lang2.getMatchOffsets(session.getLine(i2), this.regExp);
                if (ranges.length > this.MAX_RANGES)
                  ranges = ranges.slice(0, this.MAX_RANGES);
                ranges = ranges.map(function(match7) {
                  return new Range(i2, match7.offset, i2, match7.offset + match7.length);
                });
              }
              this.cache[i2] = ranges.length ? ranges : "";
            }
            if (ranges.length === 0)
              continue;
            for (var j2 = ranges.length; j2--; ) {
              var rangeToAddMarkerTo = ranges[j2].toScreenRange(session);
              var rangeAsString = rangeToAddMarkerTo.toString();
              if (renderedMarkerRanges[rangeAsString])
                continue;
              renderedMarkerRanges[rangeAsString] = true;
              markerLayer.drawSingleLineMarker(html2, rangeToAddMarkerTo, this.clazz, config2);
            }
          }
          this.docLen = session.getValue().length;
        };
        return SearchHighlight2;
      }()
    );
    SearchHighlight.prototype.MAX_RANGES = 500;
    exports3.SearchHighlight = SearchHighlight;
  });
  ace.define("ace/undomanager", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var UndoManager = (
      /** @class */
      function() {
        function UndoManager2() {
          this.$keepRedoStack;
          this.$maxRev = 0;
          this.$fromUndo = false;
          this.$undoDepth = Infinity;
          this.reset();
        }
        UndoManager2.prototype.addSession = function(session) {
          this.$session = session;
        };
        UndoManager2.prototype.add = function(delta, allowMerge, session) {
          if (this.$fromUndo)
            return;
          if (delta == this.$lastDelta)
            return;
          if (!this.$keepRedoStack)
            this.$redoStack.length = 0;
          if (allowMerge === false || !this.lastDeltas) {
            this.lastDeltas = [];
            var undoStackLength = this.$undoStack.length;
            if (undoStackLength > this.$undoDepth - 1) {
              this.$undoStack.splice(0, undoStackLength - this.$undoDepth + 1);
            }
            this.$undoStack.push(this.lastDeltas);
            delta.id = this.$rev = ++this.$maxRev;
          }
          if (delta.action == "remove" || delta.action == "insert")
            this.$lastDelta = delta;
          this.lastDeltas.push(delta);
        };
        UndoManager2.prototype.addSelection = function(selection, rev) {
          this.selections.push({
            value: selection,
            rev: rev || this.$rev
          });
        };
        UndoManager2.prototype.startNewGroup = function() {
          this.lastDeltas = null;
          return this.$rev;
        };
        UndoManager2.prototype.markIgnored = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
          var stack = this.$undoStack;
          for (var i2 = stack.length; i2--; ) {
            var delta = stack[i2][0];
            if (delta.id <= from2)
              break;
            if (delta.id < to2)
              delta.ignore = true;
          }
          this.lastDeltas = null;
        };
        UndoManager2.prototype.getSelection = function(rev, after) {
          var stack = this.selections;
          for (var i2 = stack.length; i2--; ) {
            var selection = stack[i2];
            if (selection.rev < rev) {
              if (after)
                selection = stack[i2 + 1];
              return selection;
            }
          }
        };
        UndoManager2.prototype.getRevision = function() {
          return this.$rev;
        };
        UndoManager2.prototype.getDeltas = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
          var stack = this.$undoStack;
          var end = null, start = 0;
          for (var i2 = stack.length; i2--; ) {
            var delta = stack[i2][0];
            if (delta.id < to2 && !end)
              end = i2 + 1;
            if (delta.id <= from2) {
              start = i2 + 1;
              break;
            }
          }
          return stack.slice(start, end);
        };
        UndoManager2.prototype.getChangedRanges = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
        };
        UndoManager2.prototype.getChangedLines = function(from2, to2) {
          if (to2 == null)
            to2 = this.$rev + 1;
        };
        UndoManager2.prototype.undo = function(session, dontSelect) {
          this.lastDeltas = null;
          var stack = this.$undoStack;
          if (!rearrangeUndoStack(stack, stack.length))
            return;
          if (!session)
            session = this.$session;
          if (this.$redoStackBaseRev !== this.$rev && this.$redoStack.length)
            this.$redoStack = [];
          this.$fromUndo = true;
          var deltaSet = stack.pop();
          var undoSelectionRange = null;
          if (deltaSet) {
            undoSelectionRange = session.undoChanges(deltaSet, dontSelect);
            this.$redoStack.push(deltaSet);
            this.$syncRev();
          }
          this.$fromUndo = false;
          return undoSelectionRange;
        };
        UndoManager2.prototype.redo = function(session, dontSelect) {
          this.lastDeltas = null;
          if (!session)
            session = this.$session;
          this.$fromUndo = true;
          if (this.$redoStackBaseRev != this.$rev) {
            var diff2 = this.getDeltas(this.$redoStackBaseRev, this.$rev + 1);
            rebaseRedoStack(this.$redoStack, diff2);
            this.$redoStackBaseRev = this.$rev;
            this.$redoStack.forEach(function(x2) {
              x2[0].id = ++this.$maxRev;
            }, this);
          }
          var deltaSet = this.$redoStack.pop();
          var redoSelectionRange = null;
          if (deltaSet) {
            redoSelectionRange = session.redoChanges(deltaSet, dontSelect);
            this.$undoStack.push(deltaSet);
            this.$syncRev();
          }
          this.$fromUndo = false;
          return redoSelectionRange;
        };
        UndoManager2.prototype.$syncRev = function() {
          var stack = this.$undoStack;
          var nextDelta = stack[stack.length - 1];
          var id2 = nextDelta && nextDelta[0].id || 0;
          this.$redoStackBaseRev = id2;
          this.$rev = id2;
        };
        UndoManager2.prototype.reset = function() {
          this.lastDeltas = null;
          this.$lastDelta = null;
          this.$undoStack = [];
          this.$redoStack = [];
          this.$rev = 0;
          this.mark = 0;
          this.$redoStackBaseRev = this.$rev;
          this.selections = [];
        };
        UndoManager2.prototype.canUndo = function() {
          return this.$undoStack.length > 0;
        };
        UndoManager2.prototype.canRedo = function() {
          return this.$redoStack.length > 0;
        };
        UndoManager2.prototype.bookmark = function(rev) {
          if (rev == void 0)
            rev = this.$rev;
          this.mark = rev;
        };
        UndoManager2.prototype.isAtBookmark = function() {
          return this.$rev === this.mark;
        };
        UndoManager2.prototype.toJSON = function() {
          return {
            $redoStack: this.$redoStack,
            $undoStack: this.$undoStack
          };
        };
        UndoManager2.prototype.fromJSON = function(json) {
          this.reset();
          this.$undoStack = json.$undoStack;
          this.$redoStack = json.$redoStack;
        };
        UndoManager2.prototype.$prettyPrint = function(delta) {
          if (delta)
            return stringifyDelta(delta);
          return stringifyDelta(this.$undoStack) + "\n---\n" + stringifyDelta(this.$redoStack);
        };
        return UndoManager2;
      }()
    );
    UndoManager.prototype.hasUndo = UndoManager.prototype.canUndo;
    UndoManager.prototype.hasRedo = UndoManager.prototype.canRedo;
    UndoManager.prototype.isClean = UndoManager.prototype.isAtBookmark;
    UndoManager.prototype.markClean = UndoManager.prototype.bookmark;
    function rearrangeUndoStack(stack, pos) {
      for (var i2 = pos; i2--; ) {
        var deltaSet = stack[i2];
        if (deltaSet && !deltaSet[0].ignore) {
          while (i2 < pos - 1) {
            var swapped = swapGroups(stack[i2], stack[i2 + 1]);
            stack[i2] = swapped[0];
            stack[i2 + 1] = swapped[1];
            i2++;
          }
          return true;
        }
      }
    }
    var Range = require2("./range").Range;
    var cmp = Range.comparePoints;
    Range.comparePoints;
    function clonePos(pos) {
      return { row: pos.row, column: pos.column };
    }
    function cloneDelta(d2) {
      return {
        start: clonePos(d2.start),
        end: clonePos(d2.end),
        action: d2.action,
        lines: d2.lines.slice()
      };
    }
    function stringifyDelta(d2) {
      d2 = d2 || this;
      if (Array.isArray(d2)) {
        return d2.map(stringifyDelta).join("\n");
      }
      var type4 = "";
      if (d2.action) {
        type4 = d2.action == "insert" ? "+" : "-";
        type4 += "[" + d2.lines + "]";
      } else if (d2.value) {
        if (Array.isArray(d2.value)) {
          type4 = d2.value.map(stringifyRange).join("\n");
        } else {
          type4 = stringifyRange(d2.value);
        }
      }
      if (d2.start) {
        type4 += stringifyRange(d2);
      }
      if (d2.id || d2.rev) {
        type4 += "	(" + (d2.id || d2.rev) + ")";
      }
      return type4;
    }
    function stringifyRange(r2) {
      return r2.start.row + ":" + r2.start.column + "=>" + r2.end.row + ":" + r2.end.column;
    }
    function swap2(d1, d2) {
      var i1 = d1.action == "insert";
      var i2 = d2.action == "insert";
      if (i1 && i2) {
        if (cmp(d2.start, d1.end) >= 0) {
          shift(d2, d1, -1);
        } else if (cmp(d2.start, d1.start) <= 0) {
          shift(d1, d2, 1);
        } else {
          return null;
        }
      } else if (i1 && !i2) {
        if (cmp(d2.start, d1.end) >= 0) {
          shift(d2, d1, -1);
        } else if (cmp(d2.end, d1.start) <= 0) {
          shift(d1, d2, -1);
        } else {
          return null;
        }
      } else if (!i1 && i2) {
        if (cmp(d2.start, d1.start) >= 0) {
          shift(d2, d1, 1);
        } else if (cmp(d2.start, d1.start) <= 0) {
          shift(d1, d2, 1);
        } else {
          return null;
        }
      } else if (!i1 && !i2) {
        if (cmp(d2.start, d1.start) >= 0) {
          shift(d2, d1, 1);
        } else if (cmp(d2.end, d1.start) <= 0) {
          shift(d1, d2, -1);
        } else {
          return null;
        }
      }
      return [d2, d1];
    }
    function swapGroups(ds1, ds2) {
      for (var i2 = ds1.length; i2--; ) {
        for (var j2 = 0; j2 < ds2.length; j2++) {
          if (!swap2(ds1[i2], ds2[j2])) {
            while (i2 < ds1.length) {
              while (j2--) {
                swap2(ds2[j2], ds1[i2]);
              }
              j2 = ds2.length;
              i2++;
            }
            return [ds1, ds2];
          }
        }
      }
      ds1.selectionBefore = ds2.selectionBefore = ds1.selectionAfter = ds2.selectionAfter = null;
      return [ds2, ds1];
    }
    function xform(d1, c1) {
      var i1 = d1.action == "insert";
      var i2 = c1.action == "insert";
      if (i1 && i2) {
        if (cmp(d1.start, c1.start) < 0) {
          shift(c1, d1, 1);
        } else {
          shift(d1, c1, 1);
        }
      } else if (i1 && !i2) {
        if (cmp(d1.start, c1.end) >= 0) {
          shift(d1, c1, -1);
        } else if (cmp(d1.start, c1.start) <= 0) {
          shift(c1, d1, 1);
        } else {
          shift(d1, Range.fromPoints(c1.start, d1.start), -1);
          shift(c1, d1, 1);
        }
      } else if (!i1 && i2) {
        if (cmp(c1.start, d1.end) >= 0) {
          shift(c1, d1, -1);
        } else if (cmp(c1.start, d1.start) <= 0) {
          shift(d1, c1, 1);
        } else {
          shift(c1, Range.fromPoints(d1.start, c1.start), -1);
          shift(d1, c1, 1);
        }
      } else if (!i1 && !i2) {
        if (cmp(c1.start, d1.end) >= 0) {
          shift(c1, d1, -1);
        } else if (cmp(c1.end, d1.start) <= 0) {
          shift(d1, c1, -1);
        } else {
          var before, after;
          if (cmp(d1.start, c1.start) < 0) {
            before = d1;
            d1 = splitDelta(d1, c1.start);
          }
          if (cmp(d1.end, c1.end) > 0) {
            after = splitDelta(d1, c1.end);
          }
          shiftPos(c1.end, d1.start, d1.end, -1);
          if (after && !before) {
            d1.lines = after.lines;
            d1.start = after.start;
            d1.end = after.end;
            after = d1;
          }
          return [c1, before, after].filter(Boolean);
        }
      }
      return [c1, d1];
    }
    function shift(d1, d2, dir) {
      shiftPos(d1.start, d2.start, d2.end, dir);
      shiftPos(d1.end, d2.start, d2.end, dir);
    }
    function shiftPos(pos, start, end, dir) {
      if (pos.row == (dir == 1 ? start : end).row) {
        pos.column += dir * (end.column - start.column);
      }
      pos.row += dir * (end.row - start.row);
    }
    function splitDelta(c2, pos) {
      var lines = c2.lines;
      var end = c2.end;
      c2.end = clonePos(pos);
      var rowsBefore = c2.end.row - c2.start.row;
      var otherLines = lines.splice(rowsBefore, lines.length);
      var col = rowsBefore ? pos.column : pos.column - c2.start.column;
      lines.push(otherLines[0].substring(0, col));
      otherLines[0] = otherLines[0].substr(col);
      var rest = {
        start: clonePos(pos),
        end,
        lines: otherLines,
        action: c2.action
      };
      return rest;
    }
    function moveDeltasByOne(redoStack, d2) {
      d2 = cloneDelta(d2);
      for (var j2 = redoStack.length; j2--; ) {
        var deltaSet = redoStack[j2];
        for (var i2 = 0; i2 < deltaSet.length; i2++) {
          var x2 = deltaSet[i2];
          var xformed = xform(x2, d2);
          d2 = xformed[0];
          if (xformed.length != 2) {
            if (xformed[2]) {
              deltaSet.splice(i2 + 1, 1, xformed[1], xformed[2]);
              i2++;
            } else if (!xformed[1]) {
              deltaSet.splice(i2, 1);
              i2--;
            }
          }
        }
        if (!deltaSet.length) {
          redoStack.splice(j2, 1);
        }
      }
      return redoStack;
    }
    function rebaseRedoStack(redoStack, deltaSets) {
      for (var i2 = 0; i2 < deltaSets.length; i2++) {
        var deltas = deltaSets[i2];
        for (var j2 = 0; j2 < deltas.length; j2++) {
          moveDeltasByOne(redoStack, deltas[j2]);
        }
      }
    }
    exports3.UndoManager = UndoManager;
  });
  ace.define("ace/edit_session/fold_line", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("../range").Range;
    var FoldLine = (
      /** @class */
      function() {
        function FoldLine2(foldData, folds) {
          this.foldData = foldData;
          if (Array.isArray(folds)) {
            this.folds = folds;
          } else {
            folds = this.folds = [folds];
          }
          var last = folds[folds.length - 1];
          this.range = new Range(folds[0].start.row, folds[0].start.column, last.end.row, last.end.column);
          this.start = this.range.start;
          this.end = this.range.end;
          this.folds.forEach(function(fold) {
            fold.setFoldLine(this);
          }, this);
        }
        FoldLine2.prototype.shiftRow = function(shift) {
          this.start.row += shift;
          this.end.row += shift;
          this.folds.forEach(function(fold) {
            fold.start.row += shift;
            fold.end.row += shift;
          });
        };
        FoldLine2.prototype.addFold = function(fold) {
          if (fold.sameRow) {
            if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
              throw new Error("Can't add a fold to this FoldLine as it has no connection");
            }
            this.folds.push(fold);
            this.folds.sort(function(a2, b2) {
              return -a2.range.compareEnd(b2.start.row, b2.start.column);
            });
            if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
              this.end.row = fold.end.row;
              this.end.column = fold.end.column;
            } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
              this.start.row = fold.start.row;
              this.start.column = fold.start.column;
            }
          } else if (fold.start.row == this.end.row) {
            this.folds.push(fold);
            this.end.row = fold.end.row;
            this.end.column = fold.end.column;
          } else if (fold.end.row == this.start.row) {
            this.folds.unshift(fold);
            this.start.row = fold.start.row;
            this.start.column = fold.start.column;
          } else {
            throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
          }
          fold.foldLine = this;
        };
        FoldLine2.prototype.containsRow = function(row) {
          return row >= this.start.row && row <= this.end.row;
        };
        FoldLine2.prototype.walk = function(callback2, endRow, endColumn) {
          var lastEnd = 0, folds = this.folds, fold, cmp, stop, isNewRow = true;
          if (endRow == null) {
            endRow = this.end.row;
            endColumn = this.end.column;
          }
          for (var i2 = 0; i2 < folds.length; i2++) {
            fold = folds[i2];
            cmp = fold.range.compareStart(endRow, endColumn);
            if (cmp == -1) {
              callback2(null, endRow, endColumn, lastEnd, isNewRow);
              return;
            }
            stop = callback2(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
            stop = !stop && callback2(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
            if (stop || cmp === 0) {
              return;
            }
            isNewRow = !fold.sameRow;
            lastEnd = fold.end.column;
          }
          callback2(null, endRow, endColumn, lastEnd, isNewRow);
        };
        FoldLine2.prototype.getNextFoldTo = function(row, column2) {
          var fold, cmp;
          for (var i2 = 0; i2 < this.folds.length; i2++) {
            fold = this.folds[i2];
            cmp = fold.range.compareEnd(row, column2);
            if (cmp == -1) {
              return {
                fold,
                kind: "after"
              };
            } else if (cmp === 0) {
              return {
                fold,
                kind: "inside"
              };
            }
          }
          return null;
        };
        FoldLine2.prototype.addRemoveChars = function(row, column2, len) {
          var ret = this.getNextFoldTo(row, column2), fold, folds;
          if (ret) {
            fold = ret.fold;
            if (ret.kind == "inside" && fold.start.column != column2 && fold.start.row != row) {
              window.console && window.console.log(row, column2, fold);
            } else if (fold.start.row == row) {
              folds = this.folds;
              var i2 = folds.indexOf(fold);
              if (i2 === 0) {
                this.start.column += len;
              }
              for (i2; i2 < folds.length; i2++) {
                fold = folds[i2];
                fold.start.column += len;
                if (!fold.sameRow) {
                  return;
                }
                fold.end.column += len;
              }
              this.end.column += len;
            }
          }
        };
        FoldLine2.prototype.split = function(row, column2) {
          var pos = this.getNextFoldTo(row, column2);
          if (!pos || pos.kind == "inside")
            return null;
          var fold = pos.fold;
          var folds = this.folds;
          var foldData = this.foldData;
          var i2 = folds.indexOf(fold);
          var foldBefore = folds[i2 - 1];
          this.end.row = foldBefore.end.row;
          this.end.column = foldBefore.end.column;
          folds = folds.splice(i2, folds.length - i2);
          var newFoldLine = new FoldLine2(foldData, folds);
          foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
          return newFoldLine;
        };
        FoldLine2.prototype.merge = function(foldLineNext) {
          var folds = foldLineNext.folds;
          for (var i2 = 0; i2 < folds.length; i2++) {
            this.addFold(folds[i2]);
          }
          var foldData = this.foldData;
          foldData.splice(foldData.indexOf(foldLineNext), 1);
        };
        FoldLine2.prototype.toString = function() {
          var ret = [this.range.toString() + ": ["];
          this.folds.forEach(function(fold) {
            ret.push("  " + fold.toString());
          });
          ret.push("]");
          return ret.join("\n");
        };
        FoldLine2.prototype.idxToPosition = function(idx) {
          var lastFoldEndColumn = 0;
          for (var i2 = 0; i2 < this.folds.length; i2++) {
            var fold = this.folds[i2];
            idx -= fold.start.column - lastFoldEndColumn;
            if (idx < 0) {
              return {
                row: fold.start.row,
                column: fold.start.column + idx
              };
            }
            idx -= fold.placeholder.length;
            if (idx < 0) {
              return fold.start;
            }
            lastFoldEndColumn = fold.end.column;
          }
          return {
            row: this.end.row,
            column: this.end.column + idx
          };
        };
        return FoldLine2;
      }()
    );
    exports3.FoldLine = FoldLine;
  });
  ace.define("ace/range_list", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("./range").Range;
    var comparePoints = Range.comparePoints;
    var RangeList = (
      /** @class */
      function() {
        function RangeList2() {
          this.ranges = [];
          this.$bias = 1;
        }
        RangeList2.prototype.pointIndex = function(pos, excludeEdges, startIndex) {
          var list2 = this.ranges;
          for (var i2 = startIndex || 0; i2 < list2.length; i2++) {
            var range3 = list2[i2];
            var cmpEnd = comparePoints(pos, range3.end);
            if (cmpEnd > 0)
              continue;
            var cmpStart = comparePoints(pos, range3.start);
            if (cmpEnd === 0)
              return excludeEdges && cmpStart !== 0 ? -i2 - 2 : i2;
            if (cmpStart > 0 || cmpStart === 0 && !excludeEdges)
              return i2;
            return -i2 - 1;
          }
          return -i2 - 1;
        };
        RangeList2.prototype.add = function(range3) {
          var excludeEdges = !range3.isEmpty();
          var startIndex = this.pointIndex(range3.start, excludeEdges);
          if (startIndex < 0)
            startIndex = -startIndex - 1;
          var endIndex = this.pointIndex(range3.end, excludeEdges, startIndex);
          if (endIndex < 0)
            endIndex = -endIndex - 1;
          else
            endIndex++;
          return this.ranges.splice(startIndex, endIndex - startIndex, range3);
        };
        RangeList2.prototype.addList = function(list2) {
          var removed = [];
          for (var i2 = list2.length; i2--; ) {
            removed.push.apply(removed, this.add(list2[i2]));
          }
          return removed;
        };
        RangeList2.prototype.substractPoint = function(pos) {
          var i2 = this.pointIndex(pos);
          if (i2 >= 0)
            return this.ranges.splice(i2, 1);
        };
        RangeList2.prototype.merge = function() {
          var removed = [];
          var list2 = this.ranges;
          list2 = list2.sort(function(a2, b2) {
            return comparePoints(a2.start, b2.start);
          });
          var next2 = list2[0], range3;
          for (var i2 = 1; i2 < list2.length; i2++) {
            range3 = next2;
            next2 = list2[i2];
            var cmp = comparePoints(range3.end, next2.start);
            if (cmp < 0)
              continue;
            if (cmp == 0 && !range3.isEmpty() && !next2.isEmpty())
              continue;
            if (comparePoints(range3.end, next2.end) < 0) {
              range3.end.row = next2.end.row;
              range3.end.column = next2.end.column;
            }
            list2.splice(i2, 1);
            removed.push(next2);
            next2 = range3;
            i2--;
          }
          this.ranges = list2;
          return removed;
        };
        RangeList2.prototype.contains = function(row, column2) {
          return this.pointIndex({ row, column: column2 }) >= 0;
        };
        RangeList2.prototype.containsPoint = function(pos) {
          return this.pointIndex(pos) >= 0;
        };
        RangeList2.prototype.rangeAtPoint = function(pos) {
          var i2 = this.pointIndex(pos);
          if (i2 >= 0)
            return this.ranges[i2];
        };
        RangeList2.prototype.clipRows = function(startRow, endRow) {
          var list2 = this.ranges;
          if (list2[0].start.row > endRow || list2[list2.length - 1].start.row < startRow)
            return [];
          var startIndex = this.pointIndex({ row: startRow, column: 0 });
          if (startIndex < 0)
            startIndex = -startIndex - 1;
          var endIndex = this.pointIndex({ row: endRow, column: 0 }, startIndex);
          if (endIndex < 0)
            endIndex = -endIndex - 1;
          var clipped = [];
          for (var i2 = startIndex; i2 < endIndex; i2++) {
            clipped.push(list2[i2]);
          }
          return clipped;
        };
        RangeList2.prototype.removeAll = function() {
          return this.ranges.splice(0, this.ranges.length);
        };
        RangeList2.prototype.attach = function(session) {
          if (this.session)
            this.detach();
          this.session = session;
          this.onChange = this.$onChange.bind(this);
          this.session.on("change", this.onChange);
        };
        RangeList2.prototype.detach = function() {
          if (!this.session)
            return;
          this.session.removeListener("change", this.onChange);
          this.session = null;
        };
        RangeList2.prototype.$onChange = function(delta) {
          var start = delta.start;
          var end = delta.end;
          var startRow = start.row;
          var endRow = end.row;
          var ranges = this.ranges;
          for (var i2 = 0, n2 = ranges.length; i2 < n2; i2++) {
            var r2 = ranges[i2];
            if (r2.end.row >= startRow)
              break;
          }
          if (delta.action == "insert") {
            var lineDif = endRow - startRow;
            var colDiff = -start.column + end.column;
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              if (r2.start.row > startRow)
                break;
              if (r2.start.row == startRow && r2.start.column >= start.column) {
                if (r2.start.column == start.column && this.$bias <= 0)
                  ;
                else {
                  r2.start.column += colDiff;
                  r2.start.row += lineDif;
                }
              }
              if (r2.end.row == startRow && r2.end.column >= start.column) {
                if (r2.end.column == start.column && this.$bias < 0) {
                  continue;
                }
                if (r2.end.column == start.column && colDiff > 0 && i2 < n2 - 1) {
                  if (r2.end.column > r2.start.column && r2.end.column == ranges[i2 + 1].start.column)
                    r2.end.column -= colDiff;
                }
                r2.end.column += colDiff;
                r2.end.row += lineDif;
              }
            }
          } else {
            var lineDif = startRow - endRow;
            var colDiff = start.column - end.column;
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              if (r2.start.row > endRow)
                break;
              if (r2.end.row < endRow && (startRow < r2.end.row || startRow == r2.end.row && start.column < r2.end.column)) {
                r2.end.row = startRow;
                r2.end.column = start.column;
              } else if (r2.end.row == endRow) {
                if (r2.end.column <= end.column) {
                  if (lineDif || r2.end.column > start.column) {
                    r2.end.column = start.column;
                    r2.end.row = start.row;
                  }
                } else {
                  r2.end.column += colDiff;
                  r2.end.row += lineDif;
                }
              } else if (r2.end.row > endRow) {
                r2.end.row += lineDif;
              }
              if (r2.start.row < endRow && (startRow < r2.start.row || startRow == r2.start.row && start.column < r2.start.column)) {
                r2.start.row = startRow;
                r2.start.column = start.column;
              } else if (r2.start.row == endRow) {
                if (r2.start.column <= end.column) {
                  if (lineDif || r2.start.column > start.column) {
                    r2.start.column = start.column;
                    r2.start.row = start.row;
                  }
                } else {
                  r2.start.column += colDiff;
                  r2.start.row += lineDif;
                }
              } else if (r2.start.row > endRow) {
                r2.start.row += lineDif;
              }
            }
          }
          if (lineDif != 0 && i2 < n2) {
            for (; i2 < n2; i2++) {
              var r2 = ranges[i2];
              r2.start.row += lineDif;
              r2.end.row += lineDif;
            }
          }
        };
        return RangeList2;
      }()
    );
    RangeList.prototype.comparePoints = comparePoints;
    exports3.RangeList = RangeList;
  });
  ace.define("ace/edit_session/fold", ["require", "exports", "module", "ace/range_list"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var RangeList = require2("../range_list").RangeList;
    var Fold = (
      /** @class */
      function(_super) {
        __extends2(Fold2, _super);
        function Fold2(range3, placeholder) {
          var _this = _super.call(this) || this;
          _this.foldLine = null;
          _this.placeholder = placeholder;
          _this.range = range3;
          _this.start = range3.start;
          _this.end = range3.end;
          _this.sameRow = range3.start.row == range3.end.row;
          _this.subFolds = _this.ranges = [];
          return _this;
        }
        Fold2.prototype.toString = function() {
          return '"' + this.placeholder + '" ' + this.range.toString();
        };
        Fold2.prototype.setFoldLine = function(foldLine) {
          this.foldLine = foldLine;
          this.subFolds.forEach(function(fold) {
            fold.setFoldLine(foldLine);
          });
        };
        Fold2.prototype.clone = function() {
          var range3 = this.range.clone();
          var fold = new Fold2(range3, this.placeholder);
          this.subFolds.forEach(function(subFold) {
            fold.subFolds.push(subFold.clone());
          });
          fold.collapseChildren = this.collapseChildren;
          return fold;
        };
        Fold2.prototype.addSubFold = function(fold) {
          if (this.range.isEqual(fold))
            return;
          consumeRange(fold, this.start);
          var row = fold.start.row, column2 = fold.start.column;
          for (var i2 = 0, cmp = -1; i2 < this.subFolds.length; i2++) {
            cmp = this.subFolds[i2].range.compare(row, column2);
            if (cmp != 1)
              break;
          }
          var afterStart = this.subFolds[i2];
          var firstConsumed = 0;
          if (cmp == 0) {
            if (afterStart.range.containsRange(fold))
              return afterStart.addSubFold(fold);
            else
              firstConsumed = 1;
          }
          var row = fold.range.end.row, column2 = fold.range.end.column;
          for (var j2 = i2, cmp = -1; j2 < this.subFolds.length; j2++) {
            cmp = this.subFolds[j2].range.compare(row, column2);
            if (cmp != 1)
              break;
          }
          if (cmp == 0)
            j2++;
          var consumedFolds = this.subFolds.splice(i2, j2 - i2, fold);
          var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length;
          for (var k2 = firstConsumed; k2 < last; k2++) {
            fold.addSubFold(consumedFolds[k2]);
          }
          fold.setFoldLine(this.foldLine);
          return fold;
        };
        Fold2.prototype.restoreRange = function(range3) {
          return restoreRange(range3, this.start);
        };
        return Fold2;
      }(RangeList)
    );
    function consumePoint(point2, anchor) {
      point2.row -= anchor.row;
      if (point2.row == 0)
        point2.column -= anchor.column;
    }
    function consumeRange(range3, anchor) {
      consumePoint(range3.start, anchor);
      consumePoint(range3.end, anchor);
    }
    function restorePoint(point2, anchor) {
      if (point2.row == 0)
        point2.column += anchor.column;
      point2.row += anchor.row;
    }
    function restoreRange(range3, anchor) {
      restorePoint(range3.start, anchor);
      restorePoint(range3.end, anchor);
    }
    exports3.Fold = Fold;
  });
  ace.define("ace/edit_session/folding", ["require", "exports", "module", "ace/range", "ace/edit_session/fold_line", "ace/edit_session/fold", "ace/token_iterator", "ace/mouse/mouse_event"], function(require2, exports3, module3) {
    var Range = require2("../range").Range;
    var FoldLine = require2("./fold_line").FoldLine;
    var Fold = require2("./fold").Fold;
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var MouseEvent2 = require2("../mouse/mouse_event").MouseEvent;
    function Folding() {
      this.getFoldAt = function(row, column2, side) {
        var foldLine = this.getFoldLine(row);
        if (!foldLine)
          return null;
        var folds = foldLine.folds;
        for (var i2 = 0; i2 < folds.length; i2++) {
          var range3 = folds[i2].range;
          if (range3.contains(row, column2)) {
            if (side == 1 && range3.isEnd(row, column2) && !range3.isEmpty()) {
              continue;
            } else if (side == -1 && range3.isStart(row, column2) && !range3.isEmpty()) {
              continue;
            }
            return folds[i2];
          }
        }
      };
      this.getFoldsInRange = function(range3) {
        var start = range3.start;
        var end = range3.end;
        var foldLines = this.$foldData;
        var foundFolds = [];
        start.column += 1;
        end.column -= 1;
        for (var i2 = 0; i2 < foldLines.length; i2++) {
          var cmp = foldLines[i2].range.compareRange(range3);
          if (cmp == 2) {
            continue;
          } else if (cmp == -2) {
            break;
          }
          var folds = foldLines[i2].folds;
          for (var j2 = 0; j2 < folds.length; j2++) {
            var fold = folds[j2];
            cmp = fold.range.compareRange(range3);
            if (cmp == -2) {
              break;
            } else if (cmp == 2) {
              continue;
            } else if (cmp == 42) {
              break;
            }
            foundFolds.push(fold);
          }
        }
        start.column -= 1;
        end.column += 1;
        return foundFolds;
      };
      this.getFoldsInRangeList = function(ranges) {
        if (Array.isArray(ranges)) {
          var folds = [];
          ranges.forEach(function(range3) {
            folds = folds.concat(this.getFoldsInRange(range3));
          }, this);
        } else {
          var folds = this.getFoldsInRange(ranges);
        }
        return folds;
      };
      this.getAllFolds = function() {
        var folds = [];
        var foldLines = this.$foldData;
        for (var i2 = 0; i2 < foldLines.length; i2++)
          for (var j2 = 0; j2 < foldLines[i2].folds.length; j2++)
            folds.push(foldLines[i2].folds[j2]);
        return folds;
      };
      this.getFoldStringAt = function(row, column2, trim2, foldLine) {
        foldLine = foldLine || this.getFoldLine(row);
        if (!foldLine)
          return null;
        var lastFold = {
          end: { column: 0 }
        };
        var str, fold;
        for (var i2 = 0; i2 < foldLine.folds.length; i2++) {
          fold = foldLine.folds[i2];
          var cmp = fold.range.compareEnd(row, column2);
          if (cmp == -1) {
            str = this.getLine(fold.start.row).substring(lastFold.end.column, fold.start.column);
            break;
          } else if (cmp === 0) {
            return null;
          }
          lastFold = fold;
        }
        if (!str)
          str = this.getLine(fold.start.row).substring(lastFold.end.column);
        if (trim2 == -1)
          return str.substring(0, column2 - lastFold.end.column);
        else if (trim2 == 1)
          return str.substring(column2 - lastFold.end.column);
        else
          return str;
      };
      this.getFoldLine = function(docRow, startFoldLine) {
        var foldData = this.$foldData;
        var i2 = 0;
        if (startFoldLine)
          i2 = foldData.indexOf(startFoldLine);
        if (i2 == -1)
          i2 = 0;
        for (i2; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
            return foldLine;
          } else if (foldLine.end.row > docRow) {
            return null;
          }
        }
        return null;
      };
      this.getNextFoldLine = function(docRow, startFoldLine) {
        var foldData = this.$foldData;
        var i2 = 0;
        if (startFoldLine)
          i2 = foldData.indexOf(startFoldLine);
        if (i2 == -1)
          i2 = 0;
        for (i2; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (foldLine.end.row >= docRow) {
            return foldLine;
          }
        }
        return null;
      };
      this.getFoldedRowCount = function(first, last) {
        var foldData = this.$foldData, rowCount = last - first + 1;
        for (var i2 = 0; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2], end = foldLine.end.row, start = foldLine.start.row;
          if (end >= last) {
            if (start < last) {
              if (start >= first)
                rowCount -= last - start;
              else
                rowCount = 0;
            }
            break;
          } else if (end >= first) {
            if (start >= first)
              rowCount -= end - start;
            else
              rowCount -= end - first + 1;
          }
        }
        return rowCount;
      };
      this.$addFoldLine = function(foldLine) {
        this.$foldData.push(foldLine);
        this.$foldData.sort(function(a2, b2) {
          return a2.start.row - b2.start.row;
        });
        return foldLine;
      };
      this.addFold = function(placeholder, range3) {
        var foldData = this.$foldData;
        var added = false;
        var fold;
        if (placeholder instanceof Fold)
          fold = placeholder;
        else {
          fold = new Fold(range3, placeholder);
          fold.collapseChildren = range3.collapseChildren;
        }
        this.$clipRangeToDocument(fold.range);
        var startRow = fold.start.row;
        var startColumn = fold.start.column;
        var endRow = fold.end.row;
        var endColumn = fold.end.column;
        var startFold = this.getFoldAt(startRow, startColumn, 1);
        var endFold = this.getFoldAt(endRow, endColumn, -1);
        if (startFold && endFold == startFold)
          return startFold.addSubFold(fold);
        if (startFold && !startFold.range.isStart(startRow, startColumn))
          this.removeFold(startFold);
        if (endFold && !endFold.range.isEnd(endRow, endColumn))
          this.removeFold(endFold);
        var folds = this.getFoldsInRange(fold.range);
        if (folds.length > 0) {
          this.removeFolds(folds);
          if (!fold.collapseChildren) {
            folds.forEach(function(subFold) {
              fold.addSubFold(subFold);
            });
          }
        }
        for (var i2 = 0; i2 < foldData.length; i2++) {
          var foldLine = foldData[i2];
          if (endRow == foldLine.start.row) {
            foldLine.addFold(fold);
            added = true;
            break;
          } else if (startRow == foldLine.end.row) {
            foldLine.addFold(fold);
            added = true;
            if (!fold.sameRow) {
              var foldLineNext = foldData[i2 + 1];
              if (foldLineNext && foldLineNext.start.row == endRow) {
                foldLine.merge(foldLineNext);
                break;
              }
            }
            break;
          } else if (endRow <= foldLine.start.row) {
            break;
          }
        }
        if (!added)
          foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
        if (this.$useWrapMode)
          this.$updateWrapData(foldLine.start.row, foldLine.start.row);
        else
          this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
        this.$modified = true;
        this._signal("changeFold", { data: fold, action: "add" });
        return fold;
      };
      this.addFolds = function(folds) {
        folds.forEach(function(fold) {
          this.addFold(fold);
        }, this);
      };
      this.removeFold = function(fold) {
        var foldLine = fold.foldLine;
        var startRow = foldLine.start.row;
        var endRow = foldLine.end.row;
        var foldLines = this.$foldData;
        var folds = foldLine.folds;
        if (folds.length == 1) {
          foldLines.splice(foldLines.indexOf(foldLine), 1);
        } else if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
          folds.pop();
          foldLine.end.row = folds[folds.length - 1].end.row;
          foldLine.end.column = folds[folds.length - 1].end.column;
        } else if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
          folds.shift();
          foldLine.start.row = folds[0].start.row;
          foldLine.start.column = folds[0].start.column;
        } else if (fold.sameRow) {
          folds.splice(folds.indexOf(fold), 1);
        } else {
          var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
          folds = newFoldLine.folds;
          folds.shift();
          newFoldLine.start.row = folds[0].start.row;
          newFoldLine.start.column = folds[0].start.column;
        }
        if (!this.$updating) {
          if (this.$useWrapMode)
            this.$updateWrapData(startRow, endRow);
          else
            this.$updateRowLengthCache(startRow, endRow);
        }
        this.$modified = true;
        this._signal("changeFold", { data: fold, action: "remove" });
      };
      this.removeFolds = function(folds) {
        var cloneFolds = [];
        for (var i2 = 0; i2 < folds.length; i2++) {
          cloneFolds.push(folds[i2]);
        }
        cloneFolds.forEach(function(fold) {
          this.removeFold(fold);
        }, this);
        this.$modified = true;
      };
      this.expandFold = function(fold) {
        this.removeFold(fold);
        fold.subFolds.forEach(function(subFold) {
          fold.restoreRange(subFold);
          this.addFold(subFold);
        }, this);
        if (fold.collapseChildren > 0) {
          this.foldAll(fold.start.row + 1, fold.end.row, fold.collapseChildren - 1);
        }
        fold.subFolds = [];
      };
      this.expandFolds = function(folds) {
        folds.forEach(function(fold) {
          this.expandFold(fold);
        }, this);
      };
      this.unfold = function(location2, expandInner) {
        var range3, folds;
        if (location2 == null) {
          range3 = new Range(0, 0, this.getLength(), 0);
          if (expandInner == null)
            expandInner = true;
        } else if (typeof location2 == "number") {
          range3 = new Range(location2, 0, location2, this.getLine(location2).length);
        } else if ("row" in location2) {
          range3 = Range.fromPoints(location2, location2);
        } else if (Array.isArray(location2)) {
          folds = [];
          location2.forEach(function(range4) {
            folds = folds.concat(this.unfold(range4));
          }, this);
          return folds;
        } else {
          range3 = location2;
        }
        folds = this.getFoldsInRangeList(range3);
        var outermostFolds = folds;
        while (folds.length == 1 && Range.comparePoints(folds[0].start, range3.start) < 0 && Range.comparePoints(folds[0].end, range3.end) > 0) {
          this.expandFolds(folds);
          folds = this.getFoldsInRangeList(range3);
        }
        if (expandInner != false) {
          this.removeFolds(folds);
        } else {
          this.expandFolds(folds);
        }
        if (outermostFolds.length)
          return outermostFolds;
      };
      this.isRowFolded = function(docRow, startFoldRow) {
        return !!this.getFoldLine(docRow, startFoldRow);
      };
      this.getRowFoldEnd = function(docRow, startFoldRow) {
        var foldLine = this.getFoldLine(docRow, startFoldRow);
        return foldLine ? foldLine.end.row : docRow;
      };
      this.getRowFoldStart = function(docRow, startFoldRow) {
        var foldLine = this.getFoldLine(docRow, startFoldRow);
        return foldLine ? foldLine.start.row : docRow;
      };
      this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
        if (startRow == null)
          startRow = foldLine.start.row;
        if (startColumn == null)
          startColumn = 0;
        if (endRow == null)
          endRow = foldLine.end.row;
        if (endColumn == null)
          endColumn = this.getLine(endRow).length;
        var doc = this.doc;
        var textLine = "";
        foldLine.walk(function(placeholder, row, column2, lastColumn) {
          if (row < startRow)
            return;
          if (row == startRow) {
            if (column2 < startColumn)
              return;
            lastColumn = Math.max(startColumn, lastColumn);
          }
          if (placeholder != null) {
            textLine += placeholder;
          } else {
            textLine += doc.getLine(row).substring(lastColumn, column2);
          }
        }, endRow, endColumn);
        return textLine;
      };
      this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
        var foldLine = this.getFoldLine(row);
        if (!foldLine) {
          var line2;
          line2 = this.doc.getLine(row);
          return line2.substring(startColumn || 0, endColumn || line2.length);
        } else {
          return this.getFoldDisplayLine(foldLine, row, endColumn, startRow, startColumn);
        }
      };
      this.$cloneFoldData = function() {
        var fd2 = [];
        fd2 = this.$foldData.map(function(foldLine) {
          var folds = foldLine.folds.map(function(fold) {
            return fold.clone();
          });
          return new FoldLine(fd2, folds);
        });
        return fd2;
      };
      this.toggleFold = function(tryToUnfold) {
        var selection = this.selection;
        var range3 = selection.getRange();
        var fold;
        var bracketPos;
        if (range3.isEmpty()) {
          var cursor = range3.start;
          fold = this.getFoldAt(cursor.row, cursor.column);
          if (fold) {
            this.expandFold(fold);
            return;
          } else if (tryToUnfold) {
            var foldLine = this.getFoldLine(cursor.row);
            if (foldLine)
              this.expandFolds(foldLine.folds);
            return;
          } else if (bracketPos = this.findMatchingBracket(cursor)) {
            if (range3.comparePoint(bracketPos) == 1) {
              range3.end = bracketPos;
            } else {
              range3.start = bracketPos;
              range3.start.column++;
              range3.end.column--;
            }
          } else if (bracketPos = this.findMatchingBracket({ row: cursor.row, column: cursor.column + 1 })) {
            if (range3.comparePoint(bracketPos) == 1)
              range3.end = bracketPos;
            else
              range3.start = bracketPos;
            range3.start.column++;
          } else {
            range3 = this.getCommentFoldRange(cursor.row, cursor.column) || range3;
          }
        } else {
          var folds = this.getFoldsInRange(range3);
          if (tryToUnfold && folds.length) {
            this.expandFolds(folds);
            return;
          } else if (folds.length == 1) {
            fold = folds[0];
          }
        }
        if (!fold)
          fold = this.getFoldAt(range3.start.row, range3.start.column);
        if (fold && fold.range.toString() == range3.toString()) {
          this.expandFold(fold);
          return;
        }
        var placeholder = "...";
        if (!range3.isMultiLine()) {
          placeholder = this.getTextRange(range3);
          if (placeholder.length < 4)
            return;
          placeholder = placeholder.trim().substring(0, 2) + "..";
        }
        this.addFold(placeholder, range3);
      };
      this.getCommentFoldRange = function(row, column2, dir) {
        var iterator2 = new TokenIterator(this, row, column2);
        var token2 = iterator2.getCurrentToken();
        var type4 = token2 && token2.type;
        if (token2 && /^comment|string/.test(type4)) {
          type4 = type4.match(/comment|string/)[0];
          if (type4 == "comment")
            type4 += "|doc-start|\\.doc";
          var re2 = new RegExp(type4);
          var range3 = new Range();
          if (dir != 1) {
            do {
              token2 = iterator2.stepBackward();
            } while (token2 && re2.test(token2.type));
            token2 = iterator2.stepForward();
          }
          range3.start.row = iterator2.getCurrentTokenRow();
          range3.start.column = iterator2.getCurrentTokenColumn() + token2.value.length;
          iterator2 = new TokenIterator(this, row, column2);
          var initState = this.getState(iterator2.$row);
          if (dir != -1) {
            var lastRow = -1;
            do {
              token2 = iterator2.stepForward();
              if (lastRow == -1) {
                var state = this.getState(iterator2.$row);
                if (initState.toString() !== state.toString())
                  lastRow = iterator2.$row;
              } else if (iterator2.$row > lastRow) {
                break;
              }
            } while (token2 && re2.test(token2.type));
            token2 = iterator2.stepBackward();
          } else
            token2 = iterator2.getCurrentToken();
          range3.end.row = iterator2.getCurrentTokenRow();
          range3.end.column = iterator2.getCurrentTokenColumn();
          if (range3.start.row == range3.end.row && range3.start.column > range3.end.column)
            return;
          return range3;
        }
      };
      this.foldAll = function(startRow, endRow, depth, test2) {
        if (depth == void 0)
          depth = 1e5;
        var foldWidgets = this.foldWidgets;
        if (!foldWidgets)
          return;
        endRow = endRow || this.getLength();
        startRow = startRow || 0;
        for (var row = startRow; row < endRow; row++) {
          if (foldWidgets[row] == null)
            foldWidgets[row] = this.getFoldWidget(row);
          if (foldWidgets[row] != "start")
            continue;
          if (test2 && !test2(row))
            continue;
          var range3 = this.getFoldWidgetRange(row);
          if (range3 && range3.isMultiLine() && range3.end.row <= endRow && range3.start.row >= startRow) {
            row = range3.end.row;
            range3.collapseChildren = depth;
            this.addFold("...", range3);
          }
        }
      };
      this.foldToLevel = function(level) {
        this.foldAll();
        while (level-- > 0)
          this.unfold(null, false);
      };
      this.foldAllComments = function() {
        var session = this;
        this.foldAll(null, null, null, function(row) {
          var tokens2 = session.getTokens(row);
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            if (token2.type == "text" && /^\s+$/.test(token2.value))
              continue;
            if (/comment/.test(token2.type))
              return true;
            return false;
          }
        });
      };
      this.$foldStyles = {
        "manual": 1,
        "markbegin": 1,
        "markbeginend": 1
      };
      this.$foldStyle = "markbegin";
      this.setFoldStyle = function(style2) {
        if (!this.$foldStyles[style2])
          throw new Error("invalid fold style: " + style2 + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
        if (this.$foldStyle == style2)
          return;
        this.$foldStyle = style2;
        if (style2 == "manual")
          this.unfold();
        var mode = this.$foldMode;
        this.$setFolding(null);
        this.$setFolding(mode);
      };
      this.$setFolding = function(foldMode) {
        if (this.$foldMode == foldMode)
          return;
        this.$foldMode = foldMode;
        this.off("change", this.$updateFoldWidgets);
        this.off("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets);
        this._signal("changeAnnotation");
        if (!foldMode || this.$foldStyle == "manual") {
          this.foldWidgets = null;
          return;
        }
        this.foldWidgets = [];
        this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
        this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
        this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
        this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this);
        this.on("change", this.$updateFoldWidgets);
        this.on("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets);
      };
      this.getParentFoldRangeData = function(row, ignoreCurrent) {
        var fw = this.foldWidgets;
        if (!fw || ignoreCurrent && fw[row])
          return {};
        var i2 = row - 1, firstRange;
        while (i2 >= 0) {
          var c2 = fw[i2];
          if (c2 == null)
            c2 = fw[i2] = this.getFoldWidget(i2);
          if (c2 == "start") {
            var range3 = this.getFoldWidgetRange(i2);
            if (!firstRange)
              firstRange = range3;
            if (range3 && range3.end.row >= row)
              break;
          }
          i2--;
        }
        return {
          range: i2 !== -1 && range3,
          firstRange
        };
      };
      this.onFoldWidgetClick = function(row, e2) {
        if (e2 instanceof MouseEvent2)
          e2 = e2.domEvent;
        var options = {
          children: e2.shiftKey,
          all: e2.ctrlKey || e2.metaKey,
          siblings: e2.altKey
        };
        var range3 = this.$toggleFoldWidget(row, options);
        if (!range3) {
          var el2 = e2.target || e2.srcElement;
          if (el2 && /ace_fold-widget/.test(el2.className))
            el2.className += " ace_invalid";
        }
      };
      this.$toggleFoldWidget = function(row, options) {
        if (!this.getFoldWidget)
          return;
        var type4 = this.getFoldWidget(row);
        var line2 = this.getLine(row);
        var dir = type4 === "end" ? -1 : 1;
        var fold = this.getFoldAt(row, dir === -1 ? 0 : line2.length, dir);
        if (fold) {
          if (options.children || options.all)
            this.removeFold(fold);
          else
            this.expandFold(fold);
          return fold;
        }
        var range3 = this.getFoldWidgetRange(row, true);
        if (range3 && !range3.isMultiLine()) {
          fold = this.getFoldAt(range3.start.row, range3.start.column, 1);
          if (fold && range3.isEqual(fold.range)) {
            this.removeFold(fold);
            return fold;
          }
        }
        if (options.siblings) {
          var data = this.getParentFoldRangeData(row);
          if (data.range) {
            var startRow = data.range.start.row + 1;
            var endRow = data.range.end.row;
          }
          this.foldAll(startRow, endRow, options.all ? 1e4 : 0);
        } else if (options.children) {
          endRow = range3 ? range3.end.row : this.getLength();
          this.foldAll(row + 1, endRow, options.all ? 1e4 : 0);
        } else if (range3) {
          if (options.all)
            range3.collapseChildren = 1e4;
          this.addFold("...", range3);
        }
        return range3;
      };
      this.toggleFoldWidget = function(toggleParent) {
        var row = this.selection.getCursor().row;
        row = this.getRowFoldStart(row);
        var range3 = this.$toggleFoldWidget(row, {});
        if (range3)
          return;
        var data = this.getParentFoldRangeData(row, true);
        range3 = data.range || data.firstRange;
        if (range3) {
          row = range3.start.row;
          var fold = this.getFoldAt(row, this.getLine(row).length, 1);
          if (fold) {
            this.removeFold(fold);
          } else {
            this.addFold("...", range3);
          }
        }
      };
      this.updateFoldWidgets = function(delta) {
        var firstRow = delta.start.row;
        var len = delta.end.row - firstRow;
        if (len === 0) {
          this.foldWidgets[firstRow] = null;
        } else if (delta.action == "remove") {
          this.foldWidgets.splice(firstRow, len + 1, null);
        } else {
          var args = Array(len + 1);
          args.unshift(firstRow, 1);
          this.foldWidgets.splice.apply(this.foldWidgets, args);
        }
      };
      this.tokenizerUpdateFoldWidgets = function(e2) {
        var rows = e2.data;
        if (rows.first != rows.last) {
          if (this.foldWidgets.length > rows.first)
            this.foldWidgets.splice(rows.first, this.foldWidgets.length);
        }
      };
    }
    exports3.Folding = Folding;
  });
  ace.define("ace/edit_session/bracket_match", ["require", "exports", "module", "ace/token_iterator", "ace/range"], function(require2, exports3, module3) {
    var TokenIterator = require2("../token_iterator").TokenIterator;
    var Range = require2("../range").Range;
    function BracketMatch() {
      this.findMatchingBracket = function(position2, chr) {
        if (position2.column == 0)
          return null;
        var charBeforeCursor = chr || this.getLine(position2.row).charAt(position2.column - 1);
        if (charBeforeCursor == "")
          return null;
        var match5 = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
        if (!match5)
          return null;
        if (match5[1])
          return this.$findClosingBracket(match5[1], position2);
        else
          return this.$findOpeningBracket(match5[2], position2);
      };
      this.getBracketRange = function(pos) {
        var line2 = this.getLine(pos.row);
        var before = true, range3;
        var chr = line2.charAt(pos.column - 1);
        var match5 = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
        if (!match5) {
          chr = line2.charAt(pos.column);
          pos = { row: pos.row, column: pos.column + 1 };
          match5 = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
          before = false;
        }
        if (!match5)
          return null;
        if (match5[1]) {
          var bracketPos = this.$findClosingBracket(match5[1], pos);
          if (!bracketPos)
            return null;
          range3 = Range.fromPoints(pos, bracketPos);
          if (!before) {
            range3.end.column++;
            range3.start.column--;
          }
          range3.cursor = range3.end;
        } else {
          var bracketPos = this.$findOpeningBracket(match5[2], pos);
          if (!bracketPos)
            return null;
          range3 = Range.fromPoints(bracketPos, pos);
          if (!before) {
            range3.start.column++;
            range3.end.column--;
          }
          range3.cursor = range3.start;
        }
        return range3;
      };
      this.getMatchingBracketRanges = function(pos, isBackwards) {
        var line2 = this.getLine(pos.row);
        var bracketsRegExp = /([\(\[\{])|([\)\]\}])/;
        var chr = !isBackwards && line2.charAt(pos.column - 1);
        var match5 = chr && chr.match(bracketsRegExp);
        if (!match5) {
          chr = (isBackwards === void 0 || isBackwards) && line2.charAt(pos.column);
          pos = {
            row: pos.row,
            column: pos.column + 1
          };
          match5 = chr && chr.match(bracketsRegExp);
        }
        if (!match5)
          return null;
        var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column);
        var bracketPos = match5[1] ? this.$findClosingBracket(match5[1], pos) : this.$findOpeningBracket(match5[2], pos);
        if (!bracketPos)
          return [startRange];
        var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1);
        return [startRange, endRange];
      };
      this.$brackets = {
        ")": "(",
        "(": ")",
        "]": "[",
        "[": "]",
        "{": "}",
        "}": "{",
        "<": ">",
        ">": "<"
      };
      this.$findOpeningBracket = function(bracket, position2, typeRe) {
        var openBracket = this.$brackets[bracket];
        var depth = 1;
        var iterator2 = new TokenIterator(this, position2.row, position2.column);
        var token2 = iterator2.getCurrentToken();
        if (!token2)
          token2 = iterator2.stepForward();
        if (!token2)
          return;
        if (!typeRe) {
          typeRe = new RegExp("(\\.?" + token2.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)").replace(/-close\b/, "-(close|open)") + ")+");
        }
        var valueIndex = position2.column - iterator2.getCurrentTokenColumn() - 2;
        var value2 = token2.value;
        while (true) {
          while (valueIndex >= 0) {
            var chr = value2.charAt(valueIndex);
            if (chr == openBracket) {
              depth -= 1;
              if (depth == 0) {
                return {
                  row: iterator2.getCurrentTokenRow(),
                  column: valueIndex + iterator2.getCurrentTokenColumn()
                };
              }
            } else if (chr == bracket) {
              depth += 1;
            }
            valueIndex -= 1;
          }
          do {
            token2 = iterator2.stepBackward();
          } while (token2 && !typeRe.test(token2.type));
          if (token2 == null)
            break;
          value2 = token2.value;
          valueIndex = value2.length - 1;
        }
        return null;
      };
      this.$findClosingBracket = function(bracket, position2, typeRe) {
        var closingBracket = this.$brackets[bracket];
        var depth = 1;
        var iterator2 = new TokenIterator(this, position2.row, position2.column);
        var token2 = iterator2.getCurrentToken();
        if (!token2)
          token2 = iterator2.stepForward();
        if (!token2)
          return;
        if (!typeRe) {
          typeRe = new RegExp("(\\.?" + token2.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)").replace(/-open\b/, "-(close|open)") + ")+");
        }
        var valueIndex = position2.column - iterator2.getCurrentTokenColumn();
        while (true) {
          var value2 = token2.value;
          var valueLength = value2.length;
          while (valueIndex < valueLength) {
            var chr = value2.charAt(valueIndex);
            if (chr == closingBracket) {
              depth -= 1;
              if (depth == 0) {
                return {
                  row: iterator2.getCurrentTokenRow(),
                  column: valueIndex + iterator2.getCurrentTokenColumn()
                };
              }
            } else if (chr == bracket) {
              depth += 1;
            }
            valueIndex += 1;
          }
          do {
            token2 = iterator2.stepForward();
          } while (token2 && !typeRe.test(token2.type));
          if (token2 == null)
            break;
          valueIndex = 0;
        }
        return null;
      };
      this.getMatchingTags = function(pos) {
        var iterator2 = new TokenIterator(this, pos.row, pos.column);
        var token2 = this.$findTagName(iterator2);
        if (!token2)
          return;
        var prevToken = iterator2.stepBackward();
        if (prevToken.value === "<") {
          return this.$findClosingTag(iterator2, token2);
        } else {
          return this.$findOpeningTag(iterator2, token2);
        }
      };
      this.$findTagName = function(iterator2) {
        var token2 = iterator2.getCurrentToken();
        var found = false;
        var backward = false;
        if (token2 && token2.type.indexOf("tag-name") === -1) {
          do {
            if (backward)
              token2 = iterator2.stepBackward();
            else
              token2 = iterator2.stepForward();
            if (token2) {
              if (token2.value === "/>") {
                backward = true;
              } else if (token2.type.indexOf("tag-name") !== -1) {
                found = true;
              }
            }
          } while (token2 && !found);
        }
        return token2;
      };
      this.$findClosingTag = function(iterator2, token2) {
        var prevToken;
        var currentTag = token2.value;
        var tag = token2.value;
        var depth = 0;
        var openTagStart = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
        token2 = iterator2.stepForward();
        var openTagName = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
        var foundOpenTagEnd = false;
        do {
          prevToken = token2;
          if (prevToken.type.indexOf("tag-close") !== -1 && !foundOpenTagEnd) {
            var openTagEnd = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
            foundOpenTagEnd = true;
          }
          token2 = iterator2.stepForward();
          if (token2) {
            if (token2.value === ">" && !foundOpenTagEnd) {
              var openTagEnd = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
              foundOpenTagEnd = true;
            }
            if (token2.type.indexOf("tag-name") !== -1) {
              currentTag = token2.value;
              if (tag === currentTag) {
                if (prevToken.value === "<") {
                  depth++;
                } else if (prevToken.value === "</") {
                  depth--;
                  if (depth < 0) {
                    iterator2.stepBackward();
                    var closeTagStart = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 2);
                    token2 = iterator2.stepForward();
                    var closeTagName = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
                    if (token2.type.indexOf("tag-close") === -1) {
                      token2 = iterator2.stepForward();
                    }
                    if (token2 && token2.value === ">") {
                      var closeTagEnd = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                    } else {
                      return;
                    }
                  }
                }
              }
            } else if (tag === currentTag && token2.value === "/>") {
              depth--;
              if (depth < 0) {
                var closeTagStart = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 2);
                var closeTagName = closeTagStart;
                var closeTagEnd = closeTagName;
                var openTagEnd = new Range(openTagName.end.row, openTagName.end.column, openTagName.end.row, openTagName.end.column + 1);
              }
            }
          }
        } while (token2 && depth >= 0);
        if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) {
          return {
            openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column),
            closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column),
            openTagName,
            closeTagName
          };
        }
      };
      this.$findOpeningTag = function(iterator2, token2) {
        var prevToken = iterator2.getCurrentToken();
        var tag = token2.value;
        var depth = 0;
        var startRow = iterator2.getCurrentTokenRow();
        var startColumn = iterator2.getCurrentTokenColumn();
        var endColumn = startColumn + 2;
        var closeTagStart = new Range(startRow, startColumn, startRow, endColumn);
        iterator2.stepForward();
        var closeTagName = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + token2.value.length);
        if (token2.type.indexOf("tag-close") === -1) {
          token2 = iterator2.stepForward();
        }
        if (!token2 || token2.value !== ">")
          return;
        var closeTagEnd = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
        iterator2.stepBackward();
        iterator2.stepBackward();
        do {
          token2 = prevToken;
          startRow = iterator2.getCurrentTokenRow();
          startColumn = iterator2.getCurrentTokenColumn();
          endColumn = startColumn + token2.value.length;
          prevToken = iterator2.stepBackward();
          if (token2) {
            if (token2.type.indexOf("tag-name") !== -1) {
              if (tag === token2.value) {
                if (prevToken.value === "<") {
                  depth++;
                  if (depth > 0) {
                    var openTagName = new Range(startRow, startColumn, startRow, endColumn);
                    var openTagStart = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                    do {
                      token2 = iterator2.stepForward();
                    } while (token2 && token2.value !== ">");
                    var openTagEnd = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn(), iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + 1);
                  }
                } else if (prevToken.value === "</") {
                  depth--;
                }
              }
            } else if (token2.value === "/>") {
              var stepCount = 0;
              var tmpToken = prevToken;
              while (tmpToken) {
                if (tmpToken.type.indexOf("tag-name") !== -1 && tmpToken.value === tag) {
                  depth--;
                  break;
                } else if (tmpToken.value === "<") {
                  break;
                }
                tmpToken = iterator2.stepBackward();
                stepCount++;
              }
              for (var i2 = 0; i2 < stepCount; i2++) {
                iterator2.stepForward();
              }
            }
          }
        } while (prevToken && depth <= 0);
        if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) {
          return {
            openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column),
            closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column),
            openTagName,
            closeTagName
          };
        }
      };
    }
    exports3.BracketMatch = BracketMatch;
  });
  ace.define("ace/edit_session", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/bidihandler", "ace/config", "ace/lib/event_emitter", "ace/selection", "ace/mode/text", "ace/range", "ace/line_widgets", "ace/document", "ace/background_tokenizer", "ace/search_highlight", "ace/undomanager", "ace/edit_session/folding", "ace/edit_session/bracket_match"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var lang2 = require2("./lib/lang");
    var BidiHandler = require2("./bidihandler").BidiHandler;
    var config2 = require2("./config");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Selection = require2("./selection").Selection;
    var TextMode = require2("./mode/text").Mode;
    var Range = require2("./range").Range;
    var LineWidgets = require2("./line_widgets").LineWidgets;
    var Document = require2("./document").Document;
    var BackgroundTokenizer = require2("./background_tokenizer").BackgroundTokenizer;
    var SearchHighlight = require2("./search_highlight").SearchHighlight;
    var UndoManager = require2("./undomanager").UndoManager;
    var EditSession = (
      /** @class */
      function() {
        function EditSession2(text2, mode) {
          this.doc;
          this.$breakpoints = [];
          this.$decorations = [];
          this.$frontMarkers = {};
          this.$backMarkers = {};
          this.$markerId = 1;
          this.$undoSelect = true;
          this.$editor = null;
          this.prevOp = {};
          this.$foldData = [];
          this.id = "session" + ++EditSession2.$uid;
          this.$foldData.toString = function() {
            return this.join("\n");
          };
          this.$gutterCustomWidgets = {};
          this.bgTokenizer = new BackgroundTokenizer(new TextMode().getTokenizer(), this);
          var _self = this;
          this.bgTokenizer.on("update", function(e2) {
            _self._signal("tokenizerUpdate", e2);
          });
          this.on("changeFold", this.onChangeFold.bind(this));
          this.$onChange = this.onChange.bind(this);
          if (typeof text2 != "object" || !text2.getLine)
            text2 = new Document(
              /**@type{string}*/
              text2
            );
          this.setDocument(text2);
          this.selection = new Selection(this);
          this.$onSelectionChange = this.onSelectionChange.bind(this);
          this.selection.on("changeSelection", this.$onSelectionChange);
          this.selection.on("changeCursor", this.$onSelectionChange);
          this.$bidiHandler = new BidiHandler(this);
          config2.resetOptions(this);
          this.setMode(mode);
          config2._signal("session", this);
          this.destroyed = false;
          this.$initOperationListeners();
        }
        EditSession2.prototype.$initOperationListeners = function() {
          var _this = this;
          this.curOp = null;
          this.on("change", function() {
            if (!_this.curOp) {
              _this.startOperation();
              _this.curOp.selectionBefore = _this.$lastSel;
            }
            _this.curOp.docChanged = true;
          }, true);
          this.on("changeSelection", function() {
            if (!_this.curOp) {
              _this.startOperation();
              _this.curOp.selectionBefore = _this.$lastSel;
            }
            _this.curOp.selectionChanged = true;
          }, true);
          this.$operationResetTimer = lang2.delayedCall(this.endOperation.bind(this, true));
        };
        EditSession2.prototype.startOperation = function(commandEvent) {
          if (this.curOp) {
            if (!commandEvent || this.curOp.command) {
              return;
            }
            this.prevOp = this.curOp;
          }
          if (!commandEvent) {
            commandEvent = {};
          }
          this.$operationResetTimer.schedule();
          this.curOp = {
            command: commandEvent.command || {},
            args: commandEvent.args
          };
          this.curOp.selectionBefore = this.selection.toJSON();
          this._signal("startOperation", commandEvent);
        };
        EditSession2.prototype.endOperation = function(e2) {
          if (this.curOp) {
            if (e2 && e2.returnValue === false) {
              this.curOp = null;
              this._signal("endOperation", e2);
              return;
            }
            if (e2 == true && this.curOp.command && this.curOp.command.name == "mouse") {
              return;
            }
            var currentSelection = this.selection.toJSON();
            this.curOp.selectionAfter = currentSelection;
            this.$lastSel = this.selection.toJSON();
            this.getUndoManager().addSelection(currentSelection);
            this._signal("beforeEndOperation");
            this.prevOp = this.curOp;
            this.curOp = null;
            this._signal("endOperation", e2);
          }
        };
        EditSession2.prototype.setDocument = function(doc) {
          if (this.doc)
            this.doc.off("change", this.$onChange);
          this.doc = doc;
          doc.on("change", this.$onChange, true);
          this.bgTokenizer.setDocument(this.getDocument());
          this.resetCaches();
        };
        EditSession2.prototype.getDocument = function() {
          return this.doc;
        };
        Object.defineProperty(EditSession2.prototype, "widgetManager", {
          get: function() {
            var widgetManager = new LineWidgets(this);
            this.widgetManager = widgetManager;
            if (this.$editor)
              widgetManager.attach(this.$editor);
            return widgetManager;
          },
          set: function(value2) {
            Object.defineProperty(this, "widgetManager", {
              writable: true,
              enumerable: true,
              configurable: true,
              value: value2
            });
          },
          enumerable: false,
          configurable: true
        });
        EditSession2.prototype.$resetRowCache = function(docRow) {
          if (!docRow) {
            this.$docRowCache = [];
            this.$screenRowCache = [];
            return;
          }
          var l2 = this.$docRowCache.length;
          var i2 = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
          if (l2 > i2) {
            this.$docRowCache.splice(i2, l2);
            this.$screenRowCache.splice(i2, l2);
          }
        };
        EditSession2.prototype.$getRowCacheIndex = function(cacheArray, val) {
          var low = 0;
          var hi2 = cacheArray.length - 1;
          while (low <= hi2) {
            var mid = low + hi2 >> 1;
            var c2 = cacheArray[mid];
            if (val > c2)
              low = mid + 1;
            else if (val < c2)
              hi2 = mid - 1;
            else
              return mid;
          }
          return low - 1;
        };
        EditSession2.prototype.resetCaches = function() {
          this.$modified = true;
          this.$wrapData = [];
          this.$rowLengthCache = [];
          this.$resetRowCache(0);
          if (!this.destroyed)
            this.bgTokenizer.start(0);
        };
        EditSession2.prototype.onChangeFold = function(e2) {
          var fold = e2.data;
          this.$resetRowCache(fold.start.row);
        };
        EditSession2.prototype.onChange = function(delta) {
          this.$modified = true;
          this.$bidiHandler.onChange(delta);
          this.$resetRowCache(delta.start.row);
          var removedFolds = this.$updateInternalDataOnChange(delta);
          if (!this.$fromUndo && this.$undoManager) {
            if (removedFolds && removedFolds.length) {
              this.$undoManager.add({
                action: "removeFolds",
                folds: removedFolds
              }, this.mergeUndoDeltas);
              this.mergeUndoDeltas = true;
            }
            this.$undoManager.add(delta, this.mergeUndoDeltas);
            this.mergeUndoDeltas = true;
            this.$informUndoManager.schedule();
          }
          this.bgTokenizer.$updateOnChange(delta);
          this._signal("change", delta);
        };
        EditSession2.prototype.onSelectionChange = function() {
          this._signal("changeSelection");
        };
        EditSession2.prototype.setValue = function(text2) {
          this.doc.setValue(text2);
          this.selection.moveTo(0, 0);
          this.$resetRowCache(0);
          this.setUndoManager(this.$undoManager);
          this.getUndoManager().reset();
        };
        EditSession2.fromJSON = function(session) {
          if (typeof session == "string")
            session = JSON.parse(session);
          var undoManager = new UndoManager();
          undoManager.$undoStack = session.history.undo;
          undoManager.$redoStack = session.history.redo;
          undoManager.mark = session.history.mark;
          undoManager.$rev = session.history.rev;
          var editSession = new EditSession2(session.value);
          session.folds.forEach(function(fold) {
            editSession.addFold("...", Range.fromPoints(fold.start, fold.end));
          });
          editSession.setAnnotations(session.annotations);
          editSession.setBreakpoints(session.breakpoints);
          editSession.setMode(session.mode);
          editSession.setScrollLeft(session.scrollLeft);
          editSession.setScrollTop(session.scrollTop);
          editSession.setUndoManager(undoManager);
          editSession.selection.fromJSON(session.selection);
          return editSession;
        };
        EditSession2.prototype.toJSON = function() {
          return {
            annotations: this.$annotations,
            breakpoints: this.$breakpoints,
            folds: this.getAllFolds().map(function(fold) {
              return fold.range;
            }),
            history: this.getUndoManager(),
            mode: this.$mode.$id,
            scrollLeft: this.$scrollLeft,
            scrollTop: this.$scrollTop,
            selection: this.selection.toJSON(),
            value: this.doc.getValue()
          };
        };
        EditSession2.prototype.toString = function() {
          return this.doc.getValue();
        };
        EditSession2.prototype.getSelection = function() {
          return this.selection;
        };
        EditSession2.prototype.getState = function(row) {
          return this.bgTokenizer.getState(row);
        };
        EditSession2.prototype.getTokens = function(row) {
          return this.bgTokenizer.getTokens(row);
        };
        EditSession2.prototype.getTokenAt = function(row, column2) {
          var tokens2 = this.bgTokenizer.getTokens(row);
          var token2, c2 = 0;
          if (column2 == null) {
            var i2 = tokens2.length - 1;
            c2 = this.getLine(row).length;
          } else {
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              c2 += tokens2[i2].value.length;
              if (c2 >= column2)
                break;
            }
          }
          token2 = tokens2[i2];
          if (!token2)
            return null;
          token2.index = i2;
          token2.start = c2 - token2.value.length;
          return token2;
        };
        EditSession2.prototype.setUndoManager = function(undoManager) {
          this.$undoManager = undoManager;
          if (this.$informUndoManager)
            this.$informUndoManager.cancel();
          if (undoManager) {
            var self2 = this;
            undoManager.addSession(this);
            this.$syncInformUndoManager = function() {
              self2.$informUndoManager.cancel();
              self2.mergeUndoDeltas = false;
            };
            this.$informUndoManager = lang2.delayedCall(this.$syncInformUndoManager);
          } else {
            this.$syncInformUndoManager = function() {
            };
          }
        };
        EditSession2.prototype.markUndoGroup = function() {
          if (this.$syncInformUndoManager)
            this.$syncInformUndoManager();
        };
        EditSession2.prototype.getUndoManager = function() {
          return this.$undoManager || this.$defaultUndoManager;
        };
        EditSession2.prototype.getTabString = function() {
          if (this.getUseSoftTabs()) {
            return lang2.stringRepeat(" ", this.getTabSize());
          } else {
            return "	";
          }
        };
        EditSession2.prototype.setUseSoftTabs = function(val) {
          this.setOption("useSoftTabs", val);
        };
        EditSession2.prototype.getUseSoftTabs = function() {
          return this.$useSoftTabs && !this.$mode.$indentWithTabs;
        };
        EditSession2.prototype.setTabSize = function(tabSize) {
          this.setOption("tabSize", tabSize);
        };
        EditSession2.prototype.getTabSize = function() {
          return this.$tabSize;
        };
        EditSession2.prototype.isTabStop = function(position2) {
          return this.$useSoftTabs && position2.column % this.$tabSize === 0;
        };
        EditSession2.prototype.setNavigateWithinSoftTabs = function(navigateWithinSoftTabs) {
          this.setOption("navigateWithinSoftTabs", navigateWithinSoftTabs);
        };
        EditSession2.prototype.getNavigateWithinSoftTabs = function() {
          return this.$navigateWithinSoftTabs;
        };
        EditSession2.prototype.setOverwrite = function(overwrite) {
          this.setOption("overwrite", overwrite);
        };
        EditSession2.prototype.getOverwrite = function() {
          return this.$overwrite;
        };
        EditSession2.prototype.toggleOverwrite = function() {
          this.setOverwrite(!this.$overwrite);
        };
        EditSession2.prototype.addGutterDecoration = function(row, className) {
          if (!this.$decorations[row])
            this.$decorations[row] = "";
          this.$decorations[row] += " " + className;
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.removeGutterCustomWidget = function(row) {
          if (this.$editor) {
            this.$editor.renderer.$gutterLayer.$removeCustomWidget(row);
          }
        };
        EditSession2.prototype.addGutterCustomWidget = function(row, attributes2) {
          if (this.$editor) {
            this.$editor.renderer.$gutterLayer.$addCustomWidget(row, attributes2);
          }
        };
        EditSession2.prototype.removeGutterDecoration = function(row, className) {
          this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.getBreakpoints = function() {
          return this.$breakpoints;
        };
        EditSession2.prototype.setBreakpoints = function(rows) {
          this.$breakpoints = [];
          for (var i2 = 0; i2 < rows.length; i2++) {
            this.$breakpoints[rows[i2]] = "ace_breakpoint";
          }
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.clearBreakpoints = function() {
          this.$breakpoints = [];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.setBreakpoint = function(row, className) {
          if (className === void 0)
            className = "ace_breakpoint";
          if (className)
            this.$breakpoints[row] = className;
          else
            delete this.$breakpoints[row];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.clearBreakpoint = function(row) {
          delete this.$breakpoints[row];
          this._signal("changeBreakpoint", {});
        };
        EditSession2.prototype.addMarker = function(range3, clazz, type4, inFront) {
          var id2 = this.$markerId++;
          var marker = {
            range: range3,
            type: type4 || "line",
            renderer: typeof type4 == "function" ? type4 : null,
            clazz,
            inFront: !!inFront,
            id: id2
          };
          if (inFront) {
            this.$frontMarkers[id2] = marker;
            this._signal("changeFrontMarker");
          } else {
            this.$backMarkers[id2] = marker;
            this._signal("changeBackMarker");
          }
          return id2;
        };
        EditSession2.prototype.addDynamicMarker = function(marker, inFront) {
          if (!marker.update)
            return;
          var id2 = this.$markerId++;
          marker.id = id2;
          marker.inFront = !!inFront;
          if (inFront) {
            this.$frontMarkers[id2] = marker;
            this._signal("changeFrontMarker");
          } else {
            this.$backMarkers[id2] = marker;
            this._signal("changeBackMarker");
          }
          return marker;
        };
        EditSession2.prototype.removeMarker = function(markerId) {
          var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
          if (!marker)
            return;
          var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
          delete markers[markerId];
          this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
        };
        EditSession2.prototype.getMarkers = function(inFront) {
          return inFront ? this.$frontMarkers : this.$backMarkers;
        };
        EditSession2.prototype.highlight = function(re2) {
          if (!this.$searchHighlight) {
            var highlight = new SearchHighlight(null, "ace_selected-word", "text");
            this.$searchHighlight = this.addDynamicMarker(highlight);
          }
          this.$searchHighlight.setRegexp(re2);
        };
        EditSession2.prototype.highlightLines = function(startRow, endRow, clazz, inFront) {
          if (typeof endRow != "number") {
            clazz = endRow;
            endRow = startRow;
          }
          if (!clazz)
            clazz = "ace_step";
          var range3 = new Range(startRow, 0, endRow, Infinity);
          range3.id = this.addMarker(range3, clazz, "fullLine", inFront);
          return range3;
        };
        EditSession2.prototype.setAnnotations = function(annotations) {
          this.$annotations = annotations;
          this._signal("changeAnnotation", {});
        };
        EditSession2.prototype.getAnnotations = function() {
          return this.$annotations || [];
        };
        EditSession2.prototype.clearAnnotations = function() {
          this.setAnnotations([]);
        };
        EditSession2.prototype.$detectNewLine = function(text2) {
          var match5 = text2.match(/^.*?(\r?\n)/m);
          if (match5) {
            this.$autoNewLine = match5[1];
          } else {
            this.$autoNewLine = "\n";
          }
        };
        EditSession2.prototype.getWordRange = function(row, column2) {
          var line2 = this.getLine(row);
          var inToken = false;
          if (column2 > 0)
            inToken = !!line2.charAt(column2 - 1).match(this.tokenRe);
          if (!inToken)
            inToken = !!line2.charAt(column2).match(this.tokenRe);
          if (inToken)
            var re2 = this.tokenRe;
          else if (/^\s+$/.test(line2.slice(column2 - 1, column2 + 1)))
            var re2 = /\s/;
          else
            var re2 = this.nonTokenRe;
          var start = column2;
          if (start > 0) {
            do {
              start--;
            } while (start >= 0 && line2.charAt(start).match(re2));
            start++;
          }
          var end = column2;
          while (end < line2.length && line2.charAt(end).match(re2)) {
            end++;
          }
          return new Range(row, start, row, end);
        };
        EditSession2.prototype.getAWordRange = function(row, column2) {
          var wordRange = this.getWordRange(row, column2);
          var line2 = this.getLine(wordRange.end.row);
          while (line2.charAt(wordRange.end.column).match(/[ \t]/)) {
            wordRange.end.column += 1;
          }
          return wordRange;
        };
        EditSession2.prototype.setNewLineMode = function(newLineMode) {
          this.doc.setNewLineMode(newLineMode);
        };
        EditSession2.prototype.getNewLineMode = function() {
          return this.doc.getNewLineMode();
        };
        EditSession2.prototype.setUseWorker = function(useWorker) {
          this.setOption("useWorker", useWorker);
        };
        EditSession2.prototype.getUseWorker = function() {
          return this.$useWorker;
        };
        EditSession2.prototype.onReloadTokenizer = function(e2) {
          var rows = e2.data;
          this.bgTokenizer.start(rows.first);
          this._signal("tokenizerUpdate", e2);
        };
        EditSession2.prototype.setMode = function(mode, cb2) {
          if (mode && typeof mode === "object") {
            if (mode.getTokenizer)
              return this.$onChangeMode(mode);
            var options = mode;
            var path = options.path;
          } else {
            path = /**@type{string}*/
            mode || "ace/mode/text";
          }
          if (!this.$modes["ace/mode/text"])
            this.$modes["ace/mode/text"] = new TextMode();
          if (this.$modes[path] && !options) {
            this.$onChangeMode(this.$modes[path]);
            cb2 && cb2();
            return;
          }
          this.$modeId = path;
          config2.loadModule(["mode", path], (function(m2) {
            if (this.destroyed) {
              return;
            }
            if (this.$modeId !== path)
              return cb2 && cb2();
            if (this.$modes[path] && !options) {
              this.$onChangeMode(this.$modes[path]);
            } else if (m2 && m2.Mode) {
              m2 = new m2.Mode(options);
              if (!options) {
                this.$modes[path] = m2;
                m2.$id = path;
              }
              this.$onChangeMode(m2);
            }
            cb2 && cb2();
          }).bind(this));
          if (!this.$mode)
            this.$onChangeMode(this.$modes["ace/mode/text"], true);
        };
        EditSession2.prototype.$onChangeMode = function(mode, $isPlaceholder) {
          if (!$isPlaceholder)
            this.$modeId = mode.$id;
          if (this.$mode === mode)
            return;
          var oldMode = this.$mode;
          this.$mode = mode;
          this.$stopWorker();
          if (this.$useWorker)
            this.$startWorker();
          var tokenizer = mode.getTokenizer();
          if (tokenizer.on !== void 0) {
            var onReloadTokenizer = this.onReloadTokenizer.bind(this);
            tokenizer.on("update", onReloadTokenizer);
          }
          this.bgTokenizer.setTokenizer(tokenizer);
          this.bgTokenizer.setDocument(this.getDocument());
          this.tokenRe = mode.tokenRe;
          this.nonTokenRe = mode.nonTokenRe;
          if (!$isPlaceholder) {
            if (mode.attachToSession)
              mode.attachToSession(this);
            this.$options.wrapMethod.set.call(this, this.$wrapMethod);
            this.$setFolding(mode.foldingRules);
            this.bgTokenizer.start(0);
            this._emit("changeMode", { oldMode, mode });
          }
        };
        EditSession2.prototype.$stopWorker = function() {
          if (this.$worker) {
            this.$worker.terminate();
            this.$worker = null;
          }
        };
        EditSession2.prototype.$startWorker = function() {
          try {
            this.$worker = this.$mode.createWorker(this);
          } catch (e2) {
            config2.warn("Could not load worker", e2);
            this.$worker = null;
          }
        };
        EditSession2.prototype.getMode = function() {
          return this.$mode;
        };
        EditSession2.prototype.setScrollTop = function(scrollTop) {
          if (this.$scrollTop === scrollTop || isNaN(scrollTop))
            return;
          this.$scrollTop = scrollTop;
          this._signal("changeScrollTop", scrollTop);
        };
        EditSession2.prototype.getScrollTop = function() {
          return this.$scrollTop;
        };
        EditSession2.prototype.setScrollLeft = function(scrollLeft) {
          if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
            return;
          this.$scrollLeft = scrollLeft;
          this._signal("changeScrollLeft", scrollLeft);
        };
        EditSession2.prototype.getScrollLeft = function() {
          return this.$scrollLeft;
        };
        EditSession2.prototype.getScreenWidth = function() {
          this.$computeWidth();
          if (this.lineWidgets)
            return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
          return this.screenWidth;
        };
        EditSession2.prototype.getLineWidgetMaxWidth = function() {
          if (this.lineWidgetsWidth != null)
            return this.lineWidgetsWidth;
          var width = 0;
          this.lineWidgets.forEach(function(w2) {
            if (w2 && w2.screenWidth > width)
              width = w2.screenWidth;
          });
          return this.lineWidgetWidth = width;
        };
        EditSession2.prototype.$computeWidth = function(force) {
          if (this.$modified || force) {
            this.$modified = false;
            if (this.$useWrapMode)
              return this.screenWidth = this.$wrapLimit;
            var lines = this.doc.getAllLines();
            var cache2 = this.$rowLengthCache;
            var longestScreenLine = 0;
            var foldIndex = 0;
            var foldLine = this.$foldData[foldIndex];
            var foldStart = foldLine ? foldLine.start.row : Infinity;
            var len = lines.length;
            for (var i2 = 0; i2 < len; i2++) {
              if (i2 > foldStart) {
                i2 = foldLine.end.row + 1;
                if (i2 >= len)
                  break;
                foldLine = this.$foldData[foldIndex++];
                foldStart = foldLine ? foldLine.start.row : Infinity;
              }
              if (cache2[i2] == null)
                cache2[i2] = this.$getStringScreenWidth(lines[i2])[0];
              if (cache2[i2] > longestScreenLine)
                longestScreenLine = cache2[i2];
            }
            this.screenWidth = longestScreenLine;
          }
        };
        EditSession2.prototype.getLine = function(row) {
          return this.doc.getLine(row);
        };
        EditSession2.prototype.getLines = function(firstRow, lastRow) {
          return this.doc.getLines(firstRow, lastRow);
        };
        EditSession2.prototype.getLength = function() {
          return this.doc.getLength();
        };
        EditSession2.prototype.getTextRange = function(range3) {
          return this.doc.getTextRange(range3 || this.selection.getRange());
        };
        EditSession2.prototype.insert = function(position2, text2) {
          return this.doc.insert(position2, text2);
        };
        EditSession2.prototype.remove = function(range3) {
          return this.doc.remove(range3);
        };
        EditSession2.prototype.removeFullLines = function(firstRow, lastRow) {
          return this.doc.removeFullLines(firstRow, lastRow);
        };
        EditSession2.prototype.undoChanges = function(deltas, dontSelect) {
          if (!deltas.length)
            return;
          this.$fromUndo = true;
          for (var i2 = deltas.length - 1; i2 != -1; i2--) {
            var delta = deltas[i2];
            if (delta.action == "insert" || delta.action == "remove") {
              this.doc.revertDelta(delta);
            } else if (delta.folds) {
              this.addFolds(delta.folds);
            }
          }
          if (!dontSelect && this.$undoSelect) {
            if (deltas.selectionBefore)
              this.selection.fromJSON(deltas.selectionBefore);
            else
              this.selection.setRange(this.$getUndoSelection(deltas, true));
          }
          this.$fromUndo = false;
        };
        EditSession2.prototype.redoChanges = function(deltas, dontSelect) {
          if (!deltas.length)
            return;
          this.$fromUndo = true;
          for (var i2 = 0; i2 < deltas.length; i2++) {
            var delta = deltas[i2];
            if (delta.action == "insert" || delta.action == "remove") {
              this.doc.$safeApplyDelta(delta);
            }
          }
          if (!dontSelect && this.$undoSelect) {
            if (deltas.selectionAfter)
              this.selection.fromJSON(deltas.selectionAfter);
            else
              this.selection.setRange(this.$getUndoSelection(deltas, false));
          }
          this.$fromUndo = false;
        };
        EditSession2.prototype.setUndoSelect = function(enable) {
          this.$undoSelect = enable;
        };
        EditSession2.prototype.$getUndoSelection = function(deltas, isUndo) {
          function isInsert(delta2) {
            return isUndo ? delta2.action !== "insert" : delta2.action === "insert";
          }
          var range3, point2;
          for (var i2 = 0; i2 < deltas.length; i2++) {
            var delta = deltas[i2];
            if (!delta.start)
              continue;
            if (!range3) {
              if (isInsert(delta)) {
                range3 = Range.fromPoints(delta.start, delta.end);
              } else {
                range3 = Range.fromPoints(delta.start, delta.start);
              }
              continue;
            }
            if (isInsert(delta)) {
              point2 = delta.start;
              if (range3.compare(point2.row, point2.column) == -1) {
                range3.setStart(point2);
              }
              point2 = delta.end;
              if (range3.compare(point2.row, point2.column) == 1) {
                range3.setEnd(point2);
              }
            } else {
              point2 = delta.start;
              if (range3.compare(point2.row, point2.column) == -1) {
                range3 = Range.fromPoints(delta.start, delta.start);
              }
            }
          }
          return range3;
        };
        EditSession2.prototype.replace = function(range3, text2) {
          return this.doc.replace(range3, text2);
        };
        EditSession2.prototype.moveText = function(fromRange, toPosition, copy2) {
          var text2 = this.getTextRange(fromRange);
          var folds = this.getFoldsInRange(fromRange);
          var toRange = Range.fromPoints(toPosition, toPosition);
          if (!copy2) {
            this.remove(fromRange);
            var rowDiff = fromRange.start.row - fromRange.end.row;
            var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
            if (collDiff) {
              if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
                toRange.start.column += collDiff;
              if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
                toRange.end.column += collDiff;
            }
            if (rowDiff && toRange.start.row >= fromRange.end.row) {
              toRange.start.row += rowDiff;
              toRange.end.row += rowDiff;
            }
          }
          toRange.end = this.insert(toRange.start, text2);
          if (folds.length) {
            var oldStart = fromRange.start;
            var newStart = toRange.start;
            var rowDiff = newStart.row - oldStart.row;
            var collDiff = newStart.column - oldStart.column;
            this.addFolds(folds.map(function(x2) {
              x2 = x2.clone();
              if (x2.start.row == oldStart.row)
                x2.start.column += collDiff;
              if (x2.end.row == oldStart.row)
                x2.end.column += collDiff;
              x2.start.row += rowDiff;
              x2.end.row += rowDiff;
              return x2;
            }));
          }
          return toRange;
        };
        EditSession2.prototype.indentRows = function(startRow, endRow, indentString) {
          indentString = indentString.replace(/\t/g, this.getTabString());
          for (var row = startRow; row <= endRow; row++)
            this.doc.insertInLine({ row, column: 0 }, indentString);
        };
        EditSession2.prototype.outdentRows = function(range3) {
          var rowRange = range3.collapseRows();
          var deleteRange = new Range(0, 0, 0, 0);
          var size2 = this.getTabSize();
          for (var i2 = rowRange.start.row; i2 <= rowRange.end.row; ++i2) {
            var line2 = this.getLine(i2);
            deleteRange.start.row = i2;
            deleteRange.end.row = i2;
            for (var j2 = 0; j2 < size2; ++j2)
              if (line2.charAt(j2) != " ")
                break;
            if (j2 < size2 && line2.charAt(j2) == "	") {
              deleteRange.start.column = j2;
              deleteRange.end.column = j2 + 1;
            } else {
              deleteRange.start.column = 0;
              deleteRange.end.column = j2;
            }
            this.remove(deleteRange);
          }
        };
        EditSession2.prototype.$moveLines = function(firstRow, lastRow, dir) {
          firstRow = this.getRowFoldStart(firstRow);
          lastRow = this.getRowFoldEnd(lastRow);
          if (dir < 0) {
            var row = this.getRowFoldStart(firstRow + dir);
            if (row < 0)
              return 0;
            var diff2 = row - firstRow;
          } else if (dir > 0) {
            var row = this.getRowFoldEnd(lastRow + dir);
            if (row > this.doc.getLength() - 1)
              return 0;
            var diff2 = row - lastRow;
          } else {
            firstRow = this.$clipRowToDocument(firstRow);
            lastRow = this.$clipRowToDocument(lastRow);
            var diff2 = lastRow - firstRow + 1;
          }
          var range3 = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
          var folds = this.getFoldsInRange(range3).map(function(x2) {
            x2 = x2.clone();
            x2.start.row += diff2;
            x2.end.row += diff2;
            return x2;
          });
          var lines = dir == 0 ? this.doc.getLines(firstRow, lastRow) : this.doc.removeFullLines(firstRow, lastRow);
          this.doc.insertFullLines(firstRow + diff2, lines);
          folds.length && this.addFolds(folds);
          return diff2;
        };
        EditSession2.prototype.moveLinesUp = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, -1);
        };
        EditSession2.prototype.moveLinesDown = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, 1);
        };
        EditSession2.prototype.duplicateLines = function(firstRow, lastRow) {
          return this.$moveLines(firstRow, lastRow, 0);
        };
        EditSession2.prototype.$clipRowToDocument = function(row) {
          return Math.max(0, Math.min(row, this.doc.getLength() - 1));
        };
        EditSession2.prototype.$clipColumnToRow = function(row, column2) {
          if (column2 < 0)
            return 0;
          return Math.min(this.doc.getLine(row).length, column2);
        };
        EditSession2.prototype.$clipPositionToDocument = function(row, column2) {
          column2 = Math.max(0, column2);
          if (row < 0) {
            row = 0;
            column2 = 0;
          } else {
            var len = this.doc.getLength();
            if (row >= len) {
              row = len - 1;
              column2 = this.doc.getLine(len - 1).length;
            } else {
              column2 = Math.min(this.doc.getLine(row).length, column2);
            }
          }
          return {
            row,
            column: column2
          };
        };
        EditSession2.prototype.$clipRangeToDocument = function(range3) {
          if (range3.start.row < 0) {
            range3.start.row = 0;
            range3.start.column = 0;
          } else {
            range3.start.column = this.$clipColumnToRow(range3.start.row, range3.start.column);
          }
          var len = this.doc.getLength() - 1;
          if (range3.end.row > len) {
            range3.end.row = len;
            range3.end.column = this.doc.getLine(len).length;
          } else {
            range3.end.column = this.$clipColumnToRow(range3.end.row, range3.end.column);
          }
          return range3;
        };
        EditSession2.prototype.setUseWrapMode = function(useWrapMode) {
          if (useWrapMode != this.$useWrapMode) {
            this.$useWrapMode = useWrapMode;
            this.$modified = true;
            this.$resetRowCache(0);
            if (useWrapMode) {
              var len = this.getLength();
              this.$wrapData = Array(len);
              this.$updateWrapData(0, len - 1);
            }
            this._signal("changeWrapMode");
          }
        };
        EditSession2.prototype.getUseWrapMode = function() {
          return this.$useWrapMode;
        };
        EditSession2.prototype.setWrapLimitRange = function(min2, max2) {
          if (this.$wrapLimitRange.min !== min2 || this.$wrapLimitRange.max !== max2) {
            this.$wrapLimitRange = { min: min2, max: max2 };
            this.$modified = true;
            this.$bidiHandler.markAsDirty();
            if (this.$useWrapMode)
              this._signal("changeWrapMode");
          }
        };
        EditSession2.prototype.adjustWrapLimit = function(desiredLimit, $printMargin) {
          var limits = this.$wrapLimitRange;
          if (limits.max < 0)
            limits = { min: $printMargin, max: $printMargin };
          var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
          if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
            this.$wrapLimit = wrapLimit;
            this.$modified = true;
            if (this.$useWrapMode) {
              this.$updateWrapData(0, this.getLength() - 1);
              this.$resetRowCache(0);
              this._signal("changeWrapLimit");
            }
            return true;
          }
          return false;
        };
        EditSession2.prototype.$constrainWrapLimit = function(wrapLimit, min2, max2) {
          if (min2)
            wrapLimit = Math.max(min2, wrapLimit);
          if (max2)
            wrapLimit = Math.min(max2, wrapLimit);
          return wrapLimit;
        };
        EditSession2.prototype.getWrapLimit = function() {
          return this.$wrapLimit;
        };
        EditSession2.prototype.setWrapLimit = function(limit2) {
          this.setWrapLimitRange(limit2, limit2);
        };
        EditSession2.prototype.getWrapLimitRange = function() {
          return {
            min: this.$wrapLimitRange.min,
            max: this.$wrapLimitRange.max
          };
        };
        EditSession2.prototype.$updateInternalDataOnChange = function(delta) {
          var useWrapMode = this.$useWrapMode;
          var action = delta.action;
          var start = delta.start;
          var end = delta.end;
          var firstRow = start.row;
          var lastRow = end.row;
          var len = lastRow - firstRow;
          var removedFolds = null;
          this.$updating = true;
          if (len != 0) {
            if (action === "remove") {
              this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
              var foldLines = this.$foldData;
              removedFolds = this.getFoldsInRange(delta);
              this.removeFolds(removedFolds);
              var foldLine = this.getFoldLine(end.row);
              var idx = 0;
              if (foldLine) {
                foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
                foldLine.shiftRow(-len);
                var foldLineBefore = this.getFoldLine(firstRow);
                if (foldLineBefore && foldLineBefore !== foldLine) {
                  foldLineBefore.merge(foldLine);
                  foldLine = foldLineBefore;
                }
                idx = foldLines.indexOf(foldLine) + 1;
              }
              for (idx; idx < foldLines.length; idx++) {
                var foldLine = foldLines[idx];
                if (foldLine.start.row >= end.row) {
                  foldLine.shiftRow(-len);
                }
              }
              lastRow = firstRow;
            } else {
              var args = Array(len);
              args.unshift(firstRow, 0);
              var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache;
              arr.splice.apply(arr, args);
              var foldLines = this.$foldData;
              var foldLine = this.getFoldLine(firstRow);
              var idx = 0;
              if (foldLine) {
                var cmp = foldLine.range.compareInside(start.row, start.column);
                if (cmp == 0) {
                  foldLine = foldLine.split(start.row, start.column);
                  if (foldLine) {
                    foldLine.shiftRow(len);
                    foldLine.addRemoveChars(lastRow, 0, end.column - start.column);
                  }
                } else if (cmp == -1) {
                  foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
                  foldLine.shiftRow(len);
                }
                idx = foldLines.indexOf(foldLine) + 1;
              }
              for (idx; idx < foldLines.length; idx++) {
                var foldLine = foldLines[idx];
                if (foldLine.start.row >= firstRow) {
                  foldLine.shiftRow(len);
                }
              }
            }
          } else {
            len = Math.abs(delta.start.column - delta.end.column);
            if (action === "remove") {
              removedFolds = this.getFoldsInRange(delta);
              this.removeFolds(removedFolds);
              len = -len;
            }
            var foldLine = this.getFoldLine(firstRow);
            if (foldLine) {
              foldLine.addRemoveChars(firstRow, start.column, len);
            }
          }
          if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
            console.error("doc.getLength() and $wrapData.length have to be the same!");
          }
          this.$updating = false;
          if (useWrapMode)
            this.$updateWrapData(firstRow, lastRow);
          else
            this.$updateRowLengthCache(firstRow, lastRow);
          return removedFolds;
        };
        EditSession2.prototype.$updateRowLengthCache = function(firstRow, lastRow) {
          this.$rowLengthCache[firstRow] = null;
          this.$rowLengthCache[lastRow] = null;
        };
        EditSession2.prototype.$updateWrapData = function(firstRow, lastRow) {
          var lines = this.doc.getAllLines();
          var tabSize = this.getTabSize();
          var wrapData = this.$wrapData;
          var wrapLimit = this.$wrapLimit;
          var tokens2;
          var foldLine;
          var row = firstRow;
          lastRow = Math.min(lastRow, lines.length - 1);
          while (row <= lastRow) {
            foldLine = this.getFoldLine(row, foldLine);
            if (!foldLine) {
              tokens2 = this.$getDisplayTokens(lines[row]);
              wrapData[row] = this.$computeWrapSplits(tokens2, wrapLimit, tabSize);
              row++;
            } else {
              tokens2 = [];
              foldLine.walk((function(placeholder, row2, column2, lastColumn) {
                var walkTokens;
                if (placeholder != null) {
                  walkTokens = this.$getDisplayTokens(placeholder, tokens2.length);
                  walkTokens[0] = PLACEHOLDER_START;
                  for (var i2 = 1; i2 < walkTokens.length; i2++) {
                    walkTokens[i2] = PLACEHOLDER_BODY;
                  }
                } else {
                  walkTokens = this.$getDisplayTokens(lines[row2].substring(lastColumn, column2), tokens2.length);
                }
                tokens2 = tokens2.concat(walkTokens);
              }).bind(this), foldLine.end.row, lines[foldLine.end.row].length + 1);
              wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens2, wrapLimit, tabSize);
              row = foldLine.end.row + 1;
            }
          }
        };
        EditSession2.prototype.$computeWrapSplits = function(tokens2, wrapLimit, tabSize) {
          if (tokens2.length == 0) {
            return [];
          }
          var splits = [];
          var displayLength = tokens2.length;
          var lastSplit = 0, lastDocSplit = 0;
          var isCode = this.$wrapAsCode;
          var indentedSoftWrap = this.$indentedSoftWrap;
          var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8) || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2);
          function getWrapIndent() {
            var indentation = 0;
            if (maxIndent === 0)
              return indentation;
            if (indentedSoftWrap) {
              for (var i2 = 0; i2 < tokens2.length; i2++) {
                var token2 = tokens2[i2];
                if (token2 == SPACE)
                  indentation += 1;
                else if (token2 == TAB)
                  indentation += tabSize;
                else if (token2 == TAB_SPACE)
                  continue;
                else
                  break;
              }
            }
            if (isCode && indentedSoftWrap !== false)
              indentation += tabSize;
            return Math.min(indentation, maxIndent);
          }
          function addSplit(screenPos) {
            var len = screenPos - lastSplit;
            for (var i2 = lastSplit; i2 < screenPos; i2++) {
              var ch2 = tokens2[i2];
              if (ch2 === 12 || ch2 === 2)
                len -= 1;
            }
            if (!splits.length) {
              indent = getWrapIndent();
              splits.indent = indent;
            }
            lastDocSplit += len;
            splits.push(lastDocSplit);
            lastSplit = screenPos;
          }
          var indent = 0;
          while (displayLength - lastSplit > wrapLimit - indent) {
            var split2 = lastSplit + wrapLimit - indent;
            if (tokens2[split2 - 1] >= SPACE && tokens2[split2] >= SPACE) {
              addSplit(split2);
              continue;
            }
            if (tokens2[split2] == PLACEHOLDER_START || tokens2[split2] == PLACEHOLDER_BODY) {
              for (split2; split2 != lastSplit - 1; split2--) {
                if (tokens2[split2] == PLACEHOLDER_START) {
                  break;
                }
              }
              if (split2 > lastSplit) {
                addSplit(split2);
                continue;
              }
              split2 = lastSplit + wrapLimit;
              for (split2; split2 < tokens2.length; split2++) {
                if (tokens2[split2] != PLACEHOLDER_BODY) {
                  break;
                }
              }
              if (split2 == tokens2.length) {
                break;
              }
              addSplit(split2);
              continue;
            }
            var minSplit = Math.max(split2 - (wrapLimit - (wrapLimit >> 2)), lastSplit - 1);
            while (split2 > minSplit && tokens2[split2] < PLACEHOLDER_START) {
              split2--;
            }
            if (isCode) {
              while (split2 > minSplit && tokens2[split2] < PLACEHOLDER_START) {
                split2--;
              }
              while (split2 > minSplit && tokens2[split2] == PUNCTUATION) {
                split2--;
              }
            } else {
              while (split2 > minSplit && tokens2[split2] < SPACE) {
                split2--;
              }
            }
            if (split2 > minSplit) {
              addSplit(++split2);
              continue;
            }
            split2 = lastSplit + wrapLimit;
            if (tokens2[split2] == CHAR_EXT)
              split2--;
            addSplit(split2 - indent);
          }
          return splits;
        };
        EditSession2.prototype.$getDisplayTokens = function(str, offset2) {
          var arr = [];
          var tabSize;
          offset2 = offset2 || 0;
          for (var i2 = 0; i2 < str.length; i2++) {
            var c2 = str.charCodeAt(i2);
            if (c2 == 9) {
              tabSize = this.getScreenTabSize(arr.length + offset2);
              arr.push(TAB);
              for (var n2 = 1; n2 < tabSize; n2++) {
                arr.push(TAB_SPACE);
              }
            } else if (c2 == 32) {
              arr.push(SPACE);
            } else if (c2 > 39 && c2 < 48 || c2 > 57 && c2 < 64) {
              arr.push(PUNCTUATION);
            } else if (c2 >= 4352 && isFullWidth(c2)) {
              arr.push(CHAR, CHAR_EXT);
            } else {
              arr.push(CHAR);
            }
          }
          return arr;
        };
        EditSession2.prototype.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
          if (maxScreenColumn == 0)
            return [0, 0];
          if (maxScreenColumn == null)
            maxScreenColumn = Infinity;
          screenColumn = screenColumn || 0;
          var c2, column2;
          for (column2 = 0; column2 < str.length; column2++) {
            c2 = str.charCodeAt(column2);
            if (c2 == 9) {
              screenColumn += this.getScreenTabSize(screenColumn);
            } else if (c2 >= 4352 && isFullWidth(c2)) {
              screenColumn += 2;
            } else {
              screenColumn += 1;
            }
            if (screenColumn > maxScreenColumn) {
              break;
            }
          }
          return [screenColumn, column2];
        };
        EditSession2.prototype.getRowLength = function(row) {
          var h3 = 1;
          if (this.lineWidgets)
            h3 += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
          if (!this.$useWrapMode || !this.$wrapData[row])
            return h3;
          else
            return this.$wrapData[row].length + h3;
        };
        EditSession2.prototype.getRowLineCount = function(row) {
          if (!this.$useWrapMode || !this.$wrapData[row]) {
            return 1;
          } else {
            return this.$wrapData[row].length + 1;
          }
        };
        EditSession2.prototype.getRowWrapIndent = function(screenRow) {
          if (this.$useWrapMode) {
            var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
            var splits = this.$wrapData[pos.row];
            return splits.length && splits[0] < pos.column ? splits.indent : 0;
          } else {
            return 0;
          }
        };
        EditSession2.prototype.getScreenLastRowColumn = function(screenRow) {
          var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
          return this.documentToScreenColumn(pos.row, pos.column);
        };
        EditSession2.prototype.getDocumentLastRowColumn = function(docRow, docColumn) {
          var screenRow = this.documentToScreenRow(docRow, docColumn);
          return this.getScreenLastRowColumn(screenRow);
        };
        EditSession2.prototype.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
          var screenRow = this.documentToScreenRow(docRow, docColumn);
          return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
        };
        EditSession2.prototype.getRowSplitData = function(row) {
          if (!this.$useWrapMode) {
            return void 0;
          } else {
            return this.$wrapData[row];
          }
        };
        EditSession2.prototype.getScreenTabSize = function(screenColumn) {
          return this.$tabSize - (screenColumn % this.$tabSize | 0);
        };
        EditSession2.prototype.screenToDocumentRow = function(screenRow, screenColumn) {
          return this.screenToDocumentPosition(screenRow, screenColumn).row;
        };
        EditSession2.prototype.screenToDocumentColumn = function(screenRow, screenColumn) {
          return this.screenToDocumentPosition(screenRow, screenColumn).column;
        };
        EditSession2.prototype.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) {
          if (screenRow < 0)
            return { row: 0, column: 0 };
          var line2;
          var docRow = 0;
          var docColumn = 0;
          var column2;
          var row = 0;
          var rowLength = 0;
          var rowCache = this.$screenRowCache;
          var i2 = this.$getRowCacheIndex(rowCache, screenRow);
          var l2 = rowCache.length;
          if (l2 && i2 >= 0) {
            var row = rowCache[i2];
            var docRow = this.$docRowCache[i2];
            var doCache = screenRow > rowCache[l2 - 1];
          } else {
            var doCache = !l2;
          }
          var maxRow = this.getLength() - 1;
          var foldLine = this.getNextFoldLine(docRow);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (row <= screenRow) {
            rowLength = this.getRowLength(docRow);
            if (row + rowLength > screenRow || docRow >= maxRow) {
              break;
            } else {
              row += rowLength;
              docRow++;
              if (docRow > foldStart) {
                docRow = foldLine.end.row + 1;
                foldLine = this.getNextFoldLine(docRow, foldLine);
                foldStart = foldLine ? foldLine.start.row : Infinity;
              }
            }
            if (doCache) {
              this.$docRowCache.push(docRow);
              this.$screenRowCache.push(row);
            }
          }
          if (foldLine && foldLine.start.row <= docRow) {
            line2 = this.getFoldDisplayLine(foldLine);
            docRow = foldLine.start.row;
          } else if (row + rowLength <= screenRow || docRow > maxRow) {
            return {
              row: maxRow,
              column: this.getLine(maxRow).length
            };
          } else {
            line2 = this.getLine(docRow);
            foldLine = null;
          }
          var wrapIndent = 0, splitIndex = Math.floor(screenRow - row);
          if (this.$useWrapMode) {
            var splits = this.$wrapData[docRow];
            if (splits) {
              column2 = splits[splitIndex];
              if (splitIndex > 0 && splits.length) {
                wrapIndent = splits.indent;
                docColumn = splits[splitIndex - 1] || splits[splits.length - 1];
                line2 = line2.substring(docColumn);
              }
            }
          }
          if (offsetX !== void 0 && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex))
            screenColumn = this.$bidiHandler.offsetToCol(offsetX);
          docColumn += this.$getStringScreenWidth(line2, screenColumn - wrapIndent)[1];
          if (this.$useWrapMode && docColumn >= column2)
            docColumn = column2 - 1;
          if (foldLine)
            return foldLine.idxToPosition(docColumn);
          return { row: docRow, column: docColumn };
        };
        EditSession2.prototype.documentToScreenPosition = function(docRow, docColumn) {
          if (typeof docColumn === "undefined")
            var pos = this.$clipPositionToDocument(
              /**@type{Point}*/
              docRow.row,
              /**@type{Point}*/
              docRow.column
            );
          else
            pos = this.$clipPositionToDocument(
              /**@type{number}*/
              docRow,
              docColumn
            );
          docRow = pos.row;
          docColumn = pos.column;
          var screenRow = 0;
          var foldStartRow = null;
          var fold = null;
          fold = this.getFoldAt(docRow, docColumn, 1);
          if (fold) {
            docRow = fold.start.row;
            docColumn = fold.start.column;
          }
          var rowEnd, row = 0;
          var rowCache = this.$docRowCache;
          var i2 = this.$getRowCacheIndex(rowCache, docRow);
          var l2 = rowCache.length;
          if (l2 && i2 >= 0) {
            var row = rowCache[i2];
            var screenRow = this.$screenRowCache[i2];
            var doCache = docRow > rowCache[l2 - 1];
          } else {
            var doCache = !l2;
          }
          var foldLine = this.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (row < docRow) {
            if (row >= foldStart) {
              rowEnd = foldLine.end.row + 1;
              if (rowEnd > docRow)
                break;
              foldLine = this.getNextFoldLine(rowEnd, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            } else {
              rowEnd = row + 1;
            }
            screenRow += this.getRowLength(row);
            row = rowEnd;
            if (doCache) {
              this.$docRowCache.push(row);
              this.$screenRowCache.push(screenRow);
            }
          }
          var textLine = "";
          if (foldLine && row >= foldStart) {
            textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
            foldStartRow = foldLine.start.row;
          } else {
            textLine = this.getLine(docRow).substring(0, docColumn);
            foldStartRow = docRow;
          }
          var wrapIndent = 0;
          if (this.$useWrapMode) {
            var wrapRow = this.$wrapData[foldStartRow];
            if (wrapRow) {
              var screenRowOffset = 0;
              while (textLine.length >= wrapRow[screenRowOffset]) {
                screenRow++;
                screenRowOffset++;
              }
              textLine = textLine.substring(wrapRow[screenRowOffset - 1] || 0, textLine.length);
              wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0;
            }
          }
          if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove)
            screenRow += this.lineWidgets[row].rowsAbove;
          return {
            row: screenRow,
            column: wrapIndent + this.$getStringScreenWidth(textLine)[0]
          };
        };
        EditSession2.prototype.documentToScreenColumn = function(row, docColumn) {
          return this.documentToScreenPosition(row, docColumn).column;
        };
        EditSession2.prototype.documentToScreenRow = function(docRow, docColumn) {
          return this.documentToScreenPosition(docRow, docColumn).row;
        };
        EditSession2.prototype.getScreenLength = function() {
          var screenRows = 0;
          var fold = null;
          if (!this.$useWrapMode) {
            screenRows = this.getLength();
            var foldData = this.$foldData;
            for (var i2 = 0; i2 < foldData.length; i2++) {
              fold = foldData[i2];
              screenRows -= fold.end.row - fold.start.row;
            }
          } else {
            var lastRow = this.$wrapData.length;
            var row = 0, i2 = 0;
            var fold = this.$foldData[i2++];
            var foldStart = fold ? fold.start.row : Infinity;
            while (row < lastRow) {
              var splits = this.$wrapData[row];
              screenRows += splits ? splits.length + 1 : 1;
              row++;
              if (row > foldStart) {
                row = fold.end.row + 1;
                fold = this.$foldData[i2++];
                foldStart = fold ? fold.start.row : Infinity;
              }
            }
          }
          if (this.lineWidgets)
            screenRows += this.$getWidgetScreenLength();
          return screenRows;
        };
        EditSession2.prototype.$setFontMetrics = function(fm) {
          if (!this.$enableVarChar)
            return;
          this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
            if (maxScreenColumn === 0)
              return [0, 0];
            if (!maxScreenColumn)
              maxScreenColumn = Infinity;
            screenColumn = screenColumn || 0;
            var c2, column2;
            for (column2 = 0; column2 < str.length; column2++) {
              c2 = str.charAt(column2);
              if (c2 === "	") {
                screenColumn += this.getScreenTabSize(screenColumn);
              } else {
                screenColumn += fm.getCharacterWidth(c2);
              }
              if (screenColumn > maxScreenColumn) {
                break;
              }
            }
            return [screenColumn, column2];
          };
        };
        EditSession2.prototype.getPrecedingCharacter = function() {
          var pos = this.selection.getCursor();
          if (pos.column === 0) {
            return pos.row === 0 ? "" : this.doc.getNewLineCharacter();
          }
          var currentLine = this.getLine(pos.row);
          return currentLine[pos.column - 1];
        };
        EditSession2.prototype.destroy = function() {
          if (!this.destroyed) {
            this.bgTokenizer.setDocument(null);
            this.bgTokenizer.cleanup();
            this.destroyed = true;
          }
          this.endOperation();
          this.$stopWorker();
          this.removeAllListeners();
          if (this.doc) {
            this.doc.off("change", this.$onChange);
          }
          if (this.selection) {
            this.selection.off("changeCursor", this.$onSelectionChange);
            this.selection.off("changeSelection", this.$onSelectionChange);
          }
          this.selection.detach();
        };
        return EditSession2;
      }()
    );
    EditSession.$uid = 0;
    EditSession.prototype.$modes = config2.$modes;
    EditSession.prototype.getValue = EditSession.prototype.toString;
    EditSession.prototype.$defaultUndoManager = {
      undo: function() {
      },
      redo: function() {
      },
      hasUndo: function() {
      },
      hasRedo: function() {
      },
      reset: function() {
      },
      add: function() {
      },
      addSelection: function() {
      },
      startNewGroup: function() {
      },
      addSession: function() {
      }
    };
    EditSession.prototype.$overwrite = false;
    EditSession.prototype.$mode = null;
    EditSession.prototype.$modeId = null;
    EditSession.prototype.$scrollTop = 0;
    EditSession.prototype.$scrollLeft = 0;
    EditSession.prototype.$wrapLimit = 80;
    EditSession.prototype.$useWrapMode = false;
    EditSession.prototype.$wrapLimitRange = {
      min: null,
      max: null
    };
    EditSession.prototype.lineWidgets = null;
    EditSession.prototype.isFullWidth = isFullWidth;
    oop.implement(EditSession.prototype, EventEmitter2);
    var CHAR = 1, CHAR_EXT = 2, PLACEHOLDER_START = 3, PLACEHOLDER_BODY = 4, PUNCTUATION = 9, SPACE = 10, TAB = 11, TAB_SPACE = 12;
    function isFullWidth(c2) {
      if (c2 < 4352)
        return false;
      return c2 >= 4352 && c2 <= 4447 || c2 >= 4515 && c2 <= 4519 || c2 >= 4602 && c2 <= 4607 || c2 >= 9001 && c2 <= 9002 || c2 >= 11904 && c2 <= 11929 || c2 >= 11931 && c2 <= 12019 || c2 >= 12032 && c2 <= 12245 || c2 >= 12272 && c2 <= 12283 || c2 >= 12288 && c2 <= 12350 || c2 >= 12353 && c2 <= 12438 || c2 >= 12441 && c2 <= 12543 || c2 >= 12549 && c2 <= 12589 || c2 >= 12593 && c2 <= 12686 || c2 >= 12688 && c2 <= 12730 || c2 >= 12736 && c2 <= 12771 || c2 >= 12784 && c2 <= 12830 || c2 >= 12832 && c2 <= 12871 || c2 >= 12880 && c2 <= 13054 || c2 >= 13056 && c2 <= 19903 || c2 >= 19968 && c2 <= 42124 || c2 >= 42128 && c2 <= 42182 || c2 >= 43360 && c2 <= 43388 || c2 >= 44032 && c2 <= 55203 || c2 >= 55216 && c2 <= 55238 || c2 >= 55243 && c2 <= 55291 || c2 >= 63744 && c2 <= 64255 || c2 >= 65040 && c2 <= 65049 || c2 >= 65072 && c2 <= 65106 || c2 >= 65108 && c2 <= 65126 || c2 >= 65128 && c2 <= 65131 || c2 >= 65281 && c2 <= 65376 || c2 >= 65504 && c2 <= 65510;
    }
    require2("./edit_session/folding").Folding.call(EditSession.prototype);
    require2("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
    config2.defineOptions(EditSession.prototype, "session", {
      wrap: {
        set: function(value2) {
          if (!value2 || value2 == "off")
            value2 = false;
          else if (value2 == "free")
            value2 = true;
          else if (value2 == "printMargin")
            value2 = -1;
          else if (typeof value2 == "string")
            value2 = parseInt(value2, 10) || false;
          if (this.$wrap == value2)
            return;
          this.$wrap = value2;
          if (!value2) {
            this.setUseWrapMode(false);
          } else {
            var col = typeof value2 == "number" ? value2 : null;
            this.setWrapLimitRange(col, col);
            this.setUseWrapMode(true);
          }
        },
        get: function() {
          if (this.getUseWrapMode()) {
            if (this.$wrap == -1)
              return "printMargin";
            if (!this.getWrapLimitRange().min)
              return "free";
            return this.$wrap;
          }
          return "off";
        },
        handlesSet: true
      },
      wrapMethod: {
        set: function(val) {
          val = val == "auto" ? this.$mode.type != "text" : val != "text";
          if (val != this.$wrapAsCode) {
            this.$wrapAsCode = val;
            if (this.$useWrapMode) {
              this.$useWrapMode = false;
              this.setUseWrapMode(true);
            }
          }
        },
        initialValue: "auto"
      },
      indentedSoftWrap: {
        set: function() {
          if (this.$useWrapMode) {
            this.$useWrapMode = false;
            this.setUseWrapMode(true);
          }
        },
        initialValue: true
      },
      firstLineNumber: {
        set: function() {
          this._signal("changeBreakpoint");
        },
        initialValue: 1
      },
      useWorker: {
        set: function(useWorker) {
          this.$useWorker = useWorker;
          this.$stopWorker();
          if (useWorker)
            this.$startWorker();
        },
        initialValue: true
      },
      useSoftTabs: { initialValue: true },
      tabSize: {
        set: function(tabSize) {
          tabSize = parseInt(tabSize);
          if (tabSize > 0 && this.$tabSize !== tabSize) {
            this.$modified = true;
            this.$rowLengthCache = [];
            this.$tabSize = tabSize;
            this._signal("changeTabSize");
          }
        },
        initialValue: 4,
        handlesSet: true
      },
      navigateWithinSoftTabs: { initialValue: false },
      foldStyle: {
        set: function(val) {
          this.setFoldStyle(val);
        },
        handlesSet: true
      },
      overwrite: {
        set: function(val) {
          this._signal("changeOverwrite");
        },
        initialValue: false
      },
      newLineMode: {
        set: function(val) {
          this.doc.setNewLineMode(val);
        },
        get: function() {
          return this.doc.getNewLineMode();
        },
        handlesSet: true
      },
      mode: {
        set: function(val) {
          this.setMode(val);
        },
        get: function() {
          return this.$modeId;
        },
        handlesSet: true
      }
    });
    exports3.EditSession = EditSession;
  });
  ace.define("ace/search", ["require", "exports", "module", "ace/lib/lang", "ace/lib/oop", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("./lib/lang");
    var oop = require2("./lib/oop");
    var Range = require2("./range").Range;
    var Search = (
      /** @class */
      function() {
        function Search2() {
          this.$options = {};
        }
        Search2.prototype.set = function(options) {
          oop.mixin(this.$options, options);
          return this;
        };
        Search2.prototype.getOptions = function() {
          return lang2.copyObject(this.$options);
        };
        Search2.prototype.setOptions = function(options) {
          this.$options = options;
        };
        Search2.prototype.find = function(session) {
          var options = this.$options;
          var iterator2 = this.$matchIterator(session, options);
          if (!iterator2)
            return false;
          var firstRange = null;
          iterator2.forEach(function(sr, sc2, er, ec2) {
            firstRange = new Range(sr, sc2, er, ec2);
            if (sc2 == ec2 && options.start && /**@type{Range}*/
            options.start.start && options.skipCurrent != false && firstRange.isEqual(
              /**@type{Range}*/
              options.start
            )) {
              firstRange = null;
              return false;
            }
            return true;
          });
          return firstRange;
        };
        Search2.prototype.findAll = function(session) {
          var options = this.$options;
          if (!options.needle)
            return [];
          this.$assembleRegExp(options);
          var range3 = options.range;
          var lines = range3 ? session.getLines(range3.start.row, range3.end.row) : session.doc.getAllLines();
          var ranges = [];
          var re2 = options.re;
          if (options.$isMultiLine) {
            var len = re2.length;
            var maxRow = lines.length - len;
            var prevRange;
            outer:
              for (var row = re2.offset || 0; row <= maxRow; row++) {
                for (var j2 = 0; j2 < len; j2++)
                  if (lines[row + j2].search(re2[j2]) == -1)
                    continue outer;
                var startLine = lines[row];
                var line2 = lines[row + len - 1];
                var startIndex = startLine.length - startLine.match(re2[0])[0].length;
                var endIndex = line2.match(re2[len - 1])[0].length;
                if (prevRange && prevRange.end.row === row && prevRange.end.column > startIndex) {
                  continue;
                }
                ranges.push(prevRange = new Range(row, startIndex, row + len - 1, endIndex));
                if (len > 2)
                  row = row + len - 2;
              }
          } else {
            for (var matches, i2 = 0; i2 < lines.length; i2++) {
              if (this.$isMultilineSearch(options)) {
                var lng = lines.length - 1;
                matches = this.$multiLineForward(session, re2, i2, lng);
                if (matches) {
                  var end_row = matches.endRow <= lng ? matches.endRow - 1 : lng;
                  if (end_row > i2)
                    i2 = end_row;
                  ranges.push(new Range(matches.startRow, matches.startCol, matches.endRow, matches.endCol));
                }
              } else {
                matches = lang2.getMatchOffsets(lines[i2], re2);
                for (var j2 = 0; j2 < matches.length; j2++) {
                  var match5 = matches[j2];
                  ranges.push(new Range(i2, match5.offset, i2, match5.offset + match5.length));
                }
              }
            }
          }
          if (range3) {
            var startColumn = range3.start.column;
            var endColumn = range3.end.column;
            var i2 = 0, j2 = ranges.length - 1;
            while (i2 < j2 && ranges[i2].start.column < startColumn && ranges[i2].start.row == 0)
              i2++;
            var endRow = range3.end.row - range3.start.row;
            while (i2 < j2 && ranges[j2].end.column > endColumn && ranges[j2].end.row == endRow)
              j2--;
            ranges = ranges.slice(i2, j2 + 1);
            for (i2 = 0, j2 = ranges.length; i2 < j2; i2++) {
              ranges[i2].start.row += range3.start.row;
              ranges[i2].end.row += range3.start.row;
            }
          }
          return ranges;
        };
        Search2.prototype.parseReplaceString = function(replaceString) {
          var CharCode = {
            DollarSign: 36,
            Ampersand: 38,
            Digit0: 48,
            Digit1: 49,
            Digit9: 57,
            Backslash: 92,
            n: 110,
            t: 116
          };
          var replacement = "";
          for (var i2 = 0, len = replaceString.length; i2 < len; i2++) {
            var chCode = replaceString.charCodeAt(i2);
            if (chCode === CharCode.Backslash) {
              i2++;
              if (i2 >= len) {
                replacement += "\\";
                break;
              }
              var nextChCode = replaceString.charCodeAt(i2);
              switch (nextChCode) {
                case CharCode.Backslash:
                  replacement += "\\";
                  break;
                case CharCode.n:
                  replacement += "\n";
                  break;
                case CharCode.t:
                  replacement += "	";
                  break;
              }
              continue;
            }
            if (chCode === CharCode.DollarSign) {
              i2++;
              if (i2 >= len) {
                replacement += "$";
                break;
              }
              var nextChCode_1 = replaceString.charCodeAt(i2);
              if (nextChCode_1 === CharCode.DollarSign) {
                replacement += "$$";
                continue;
              }
              if (nextChCode_1 === CharCode.Digit0 || nextChCode_1 === CharCode.Ampersand) {
                replacement += "$&";
                continue;
              }
              if (CharCode.Digit1 <= nextChCode_1 && nextChCode_1 <= CharCode.Digit9) {
                replacement += "$" + replaceString[i2];
                continue;
              }
            }
            replacement += replaceString[i2];
          }
          return replacement || replaceString;
        };
        Search2.prototype.replace = function(input2, replacement) {
          var options = this.$options;
          var re2 = this.$assembleRegExp(options);
          if (options.$isMultiLine)
            return replacement;
          if (!re2)
            return;
          var mtSearch = this.$isMultilineSearch(options);
          if (mtSearch)
            input2 = input2.replace(/\r\n|\r|\n/g, "\n");
          var match5 = re2.exec(input2);
          if (!match5 || !mtSearch && match5[0].length != input2.length)
            return null;
          replacement = options.regExp ? this.parseReplaceString(replacement) : replacement.replace(/\$/g, "$$$$");
          replacement = input2.replace(re2, replacement);
          if (options.preserveCase) {
            replacement = replacement.split("");
            for (var i2 = Math.min(input2.length, input2.length); i2--; ) {
              var ch2 = input2[i2];
              if (ch2 && ch2.toLowerCase() != ch2)
                replacement[i2] = replacement[i2].toUpperCase();
              else
                replacement[i2] = replacement[i2].toLowerCase();
            }
            replacement = replacement.join("");
          }
          return replacement;
        };
        Search2.prototype.$assembleRegExp = function(options, $disableFakeMultiline) {
          if (options.needle instanceof RegExp)
            return options.re = options.needle;
          var needle = options.needle;
          if (!options.needle)
            return options.re = false;
          if (!options.regExp)
            needle = lang2.escapeRegExp(needle);
          var modifier = options.caseSensitive ? "gm" : "gmi";
          try {
            new RegExp(needle, "u");
            options.$supportsUnicodeFlag = true;
            modifier += "u";
          } catch (e2) {
            options.$supportsUnicodeFlag = false;
          }
          if (options.wholeWord)
            needle = addWordBoundary(needle, options);
          options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle);
          if (options.$isMultiLine)
            return options.re = this.$assembleMultilineRegExp(needle, modifier);
          try {
            var re2 = new RegExp(needle, modifier);
          } catch (e2) {
            re2 = false;
          }
          return options.re = re2;
        };
        Search2.prototype.$assembleMultilineRegExp = function(needle, modifier) {
          var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
          var re2 = [];
          for (var i2 = 0; i2 < parts.length; i2++)
            try {
              re2.push(new RegExp(parts[i2], modifier));
            } catch (e2) {
              return false;
            }
          return re2;
        };
        Search2.prototype.$isMultilineSearch = function(options) {
          return options.re && /\\r\\n|\\r|\\n/.test(options.re.source) && options.regExp && !options.$isMultiLine;
        };
        Search2.prototype.$multiLineForward = function(session, re2, start, last) {
          var line2, chunk = chunkEnd(session, start);
          for (var row = start; row <= last; ) {
            for (var i2 = 0; i2 < chunk; i2++) {
              if (row > last)
                break;
              var next2 = session.getLine(row++);
              line2 = line2 == null ? next2 : line2 + "\n" + next2;
            }
            var match5 = re2.exec(line2);
            re2.lastIndex = 0;
            if (match5) {
              var beforeMatch = line2.slice(0, match5.index).split("\n");
              var matchedText = match5[0].split("\n");
              var startRow = start + beforeMatch.length - 1;
              var startCol = beforeMatch[beforeMatch.length - 1].length;
              var endRow = startRow + matchedText.length - 1;
              var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length;
              return {
                startRow,
                startCol,
                endRow,
                endCol
              };
            }
          }
          return null;
        };
        Search2.prototype.$multiLineBackward = function(session, re2, endIndex, start, first) {
          var line2, chunk = chunkEnd(session, start), endMargin = session.getLine(start).length - endIndex;
          for (var row = start; row >= first; ) {
            for (var i2 = 0; i2 < chunk && row >= first; i2++) {
              var next2 = session.getLine(row--);
              line2 = line2 == null ? next2 : next2 + "\n" + line2;
            }
            var match5 = multiLineBackwardMatch(line2, re2, endMargin);
            if (match5) {
              var beforeMatch = line2.slice(0, match5.index).split("\n");
              var matchedText = match5[0].split("\n");
              var startRow = row + beforeMatch.length;
              var startCol = beforeMatch[beforeMatch.length - 1].length;
              var endRow = startRow + matchedText.length - 1;
              var endCol = matchedText.length == 1 ? startCol + matchedText[0].length : matchedText[matchedText.length - 1].length;
              return {
                startRow,
                startCol,
                endRow,
                endCol
              };
            }
          }
          return null;
        };
        Search2.prototype.$matchIterator = function(session, options) {
          var re2 = this.$assembleRegExp(options);
          if (!re2)
            return false;
          var mtSearch = this.$isMultilineSearch(options);
          var mtForward = this.$multiLineForward;
          var mtBackward = this.$multiLineBackward;
          var backwards = options.backwards == true;
          var skipCurrent = options.skipCurrent != false;
          var supportsUnicodeFlag = re2.unicode;
          var range3 = options.range;
          var start = options.start;
          if (!start)
            start = range3 ? range3[backwards ? "end" : "start"] : session.selection.getRange();
          if (start.start)
            start = start[skipCurrent != backwards ? "end" : "start"];
          var firstRow = range3 ? range3.start.row : 0;
          var lastRow = range3 ? range3.end.row : session.getLength() - 1;
          if (backwards) {
            var forEach2 = function(callback2) {
              var row = start.row;
              if (forEachInLine(row, start.column, callback2))
                return;
              for (row--; row >= firstRow; row--)
                if (forEachInLine(row, Number.MAX_VALUE, callback2))
                  return;
              if (options.wrap == false)
                return;
              for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
                if (forEachInLine(row, Number.MAX_VALUE, callback2))
                  return;
            };
          } else {
            var forEach2 = function(callback2) {
              var row = start.row;
              if (forEachInLine(row, start.column, callback2))
                return;
              for (row = row + 1; row <= lastRow; row++)
                if (forEachInLine(row, 0, callback2))
                  return;
              if (options.wrap == false)
                return;
              for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
                if (forEachInLine(row, 0, callback2))
                  return;
            };
          }
          if (options.$isMultiLine) {
            var len = re2.length;
            var forEachInLine = function(row, offset2, callback2) {
              var startRow = backwards ? row - len + 1 : row;
              if (startRow < 0 || startRow + len > session.getLength())
                return;
              var line2 = session.getLine(startRow);
              var startIndex = line2.search(re2[0]);
              if (!backwards && startIndex < offset2 || startIndex === -1)
                return;
              for (var i2 = 1; i2 < len; i2++) {
                line2 = session.getLine(startRow + i2);
                if (line2.search(re2[i2]) == -1)
                  return;
              }
              var endIndex = line2.match(re2[len - 1])[0].length;
              if (backwards && endIndex > offset2)
                return;
              if (callback2(startRow, startIndex, startRow + len - 1, endIndex))
                return true;
            };
          } else if (backwards) {
            var forEachInLine = function(row, endIndex, callback2) {
              if (mtSearch) {
                var pos = mtBackward(session, re2, endIndex, row, firstRow);
                if (!pos)
                  return false;
                if (callback2(pos.startRow, pos.startCol, pos.endRow, pos.endCol))
                  return true;
              } else {
                var line2 = session.getLine(row);
                var matches = [];
                var m2, last = 0;
                re2.lastIndex = 0;
                while (m2 = re2.exec(line2)) {
                  var length2 = m2[0].length;
                  last = m2.index;
                  if (!length2) {
                    if (last >= line2.length)
                      break;
                    re2.lastIndex = last += lang2.skipEmptyMatch(line2, last, supportsUnicodeFlag);
                  }
                  if (m2.index + length2 > endIndex)
                    break;
                  matches.push(m2.index, length2);
                }
                for (var i2 = matches.length - 1; i2 >= 0; i2 -= 2) {
                  var column2 = matches[i2 - 1];
                  var length2 = matches[i2];
                  if (callback2(row, column2, row, column2 + length2))
                    return true;
                }
              }
            };
          } else {
            var forEachInLine = function(row, startIndex, callback2) {
              re2.lastIndex = startIndex;
              if (mtSearch) {
                var pos = mtForward(session, re2, row, lastRow);
                if (pos) {
                  var end_row = pos.endRow <= lastRow ? pos.endRow - 1 : lastRow;
                  if (end_row > row)
                    row = end_row;
                }
                if (!pos)
                  return false;
                if (callback2(pos.startRow, pos.startCol, pos.endRow, pos.endCol))
                  return true;
              } else {
                var line2 = session.getLine(row);
                var last;
                var m2;
                while (m2 = re2.exec(line2)) {
                  var length2 = m2[0].length;
                  last = m2.index;
                  if (callback2(row, last, row, last + length2))
                    return true;
                  if (!length2) {
                    re2.lastIndex = last += lang2.skipEmptyMatch(line2, last, supportsUnicodeFlag);
                    if (last >= line2.length)
                      return false;
                  }
                }
              }
            };
          }
          return { forEach: forEach2 };
        };
        return Search2;
      }()
    );
    function addWordBoundary(needle, options) {
      var supportsLookbehind = lang2.supportsLookbehind();
      function wordBoundary(c2, firstChar2) {
        if (firstChar2 === void 0) {
          firstChar2 = true;
        }
        var wordRegExp = supportsLookbehind && options.$supportsUnicodeFlag ? new RegExp("[\\p{L}\\p{N}_]", "u") : new RegExp("\\w");
        if (wordRegExp.test(c2) || options.regExp) {
          if (supportsLookbehind && options.$supportsUnicodeFlag) {
            if (firstChar2)
              return "(?<=^|[^\\p{L}\\p{N}_])";
            return "(?=[^\\p{L}\\p{N}_]|$)";
          }
          return "\\b";
        }
        return "";
      }
      var needleArray = Array.from(needle);
      var firstChar = needleArray[0];
      var lastChar = needleArray[needleArray.length - 1];
      return wordBoundary(firstChar) + needle + wordBoundary(lastChar, false);
    }
    function multiLineBackwardMatch(line2, re2, endMargin) {
      var match5 = null;
      var from2 = 0;
      while (from2 <= line2.length) {
        re2.lastIndex = from2;
        var newMatch = re2.exec(line2);
        if (!newMatch)
          break;
        var end = newMatch.index + newMatch[0].length;
        if (end > line2.length - endMargin)
          break;
        if (!match5 || end > match5.index + match5[0].length)
          match5 = newMatch;
        from2 = newMatch.index + 1;
      }
      return match5;
    }
    function chunkEnd(session, start) {
      var base = 5e3, startPosition = { row: start, column: 0 }, startIndex = session.doc.positionToIndex(startPosition), targetIndex = startIndex + base, targetPosition = session.doc.indexToPosition(targetIndex), targetLine = targetPosition.row;
      return targetLine + 1;
    }
    exports3.Search = Search;
  });
  ace.define("ace/keyboard/hash_handler", ["require", "exports", "module", "ace/lib/keys", "ace/lib/useragent"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var keyUtil = require2("../lib/keys");
    var useragent = require2("../lib/useragent");
    var KEY_MODS = keyUtil.KEY_MODS;
    var MultiHashHandler = (
      /** @class */
      function() {
        function MultiHashHandler2(config2, platform2) {
          this.$init(config2, platform2, false);
        }
        MultiHashHandler2.prototype.$init = function(config2, platform2, $singleCommand) {
          this.platform = platform2 || (useragent.isMac ? "mac" : "win");
          this.commands = {};
          this.commandKeyBinding = {};
          this.addCommands(config2);
          this.$singleCommand = $singleCommand;
        };
        MultiHashHandler2.prototype.addCommand = function(command) {
          if (this.commands[command.name])
            this.removeCommand(command);
          this.commands[command.name] = command;
          if (command.bindKey)
            this._buildKeyHash(command);
        };
        MultiHashHandler2.prototype.removeCommand = function(command, keepCommand) {
          var name2 = command && (typeof command === "string" ? command : command.name);
          command = this.commands[name2];
          if (!keepCommand)
            delete this.commands[name2];
          var ckb = this.commandKeyBinding;
          for (var keyId in ckb) {
            var cmdGroup = ckb[keyId];
            if (cmdGroup == command) {
              delete ckb[keyId];
            } else if (Array.isArray(cmdGroup)) {
              var i2 = cmdGroup.indexOf(command);
              if (i2 != -1) {
                cmdGroup.splice(i2, 1);
                if (cmdGroup.length == 1)
                  ckb[keyId] = cmdGroup[0];
              }
            }
          }
        };
        MultiHashHandler2.prototype.bindKey = function(key, command, position2) {
          if (typeof key == "object" && key) {
            if (position2 == void 0)
              position2 = key.position;
            key = key[this.platform];
          }
          if (!key)
            return;
          if (typeof command == "function")
            return this.addCommand({ exec: command, bindKey: key, name: command.name || /**@type{string}*/
            key });
          key.split("|").forEach(function(keyPart) {
            var chain2 = "";
            if (keyPart.indexOf(" ") != -1) {
              var parts = keyPart.split(/\s+/);
              keyPart = parts.pop();
              parts.forEach(function(keyPart2) {
                var binding2 = this.parseKeys(keyPart2);
                var id3 = KEY_MODS[binding2.hashId] + binding2.key;
                chain2 += (chain2 ? " " : "") + id3;
                this._addCommandToBinding(chain2, "chainKeys");
              }, this);
              chain2 += " ";
            }
            var binding = this.parseKeys(keyPart);
            var id2 = KEY_MODS[binding.hashId] + binding.key;
            this._addCommandToBinding(chain2 + id2, command, position2);
          }, this);
        };
        MultiHashHandler2.prototype._addCommandToBinding = function(keyId, command, position2) {
          var ckb = this.commandKeyBinding, i2;
          if (!command) {
            delete ckb[keyId];
          } else if (!ckb[keyId] || this.$singleCommand) {
            ckb[keyId] = command;
          } else {
            if (!Array.isArray(ckb[keyId])) {
              ckb[keyId] = [ckb[keyId]];
            } else if ((i2 = ckb[keyId].indexOf(command)) != -1) {
              ckb[keyId].splice(i2, 1);
            }
            if (typeof position2 != "number") {
              position2 = getPosition2(command);
            }
            var commands = ckb[keyId];
            for (i2 = 0; i2 < commands.length; i2++) {
              var other = commands[i2];
              var otherPos = getPosition2(other);
              if (otherPos > position2)
                break;
            }
            commands.splice(i2, 0, command);
          }
        };
        MultiHashHandler2.prototype.addCommands = function(commands) {
          commands && Object.keys(commands).forEach(function(name2) {
            var command = commands[name2];
            if (!command)
              return;
            if (typeof command === "string")
              return this.bindKey(command, name2);
            if (typeof command === "function")
              command = { exec: command };
            if (typeof command !== "object")
              return;
            if (!command.name)
              command.name = name2;
            this.addCommand(command);
          }, this);
        };
        MultiHashHandler2.prototype.removeCommands = function(commands) {
          Object.keys(commands).forEach(function(name2) {
            this.removeCommand(commands[name2]);
          }, this);
        };
        MultiHashHandler2.prototype.bindKeys = function(keyList) {
          Object.keys(keyList).forEach(function(key) {
            this.bindKey(key, keyList[key]);
          }, this);
        };
        MultiHashHandler2.prototype._buildKeyHash = function(command) {
          this.bindKey(command.bindKey, command);
        };
        MultiHashHandler2.prototype.parseKeys = function(keys2) {
          var parts = keys2.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x2) {
            return x2;
          });
          var key = parts.pop();
          var keyCode = keyUtil[key];
          if (keyUtil.FUNCTION_KEYS[keyCode])
            key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
          else if (!parts.length)
            return { key, hashId: -1 };
          else if (parts.length == 1 && parts[0] == "shift")
            return { key: key.toUpperCase(), hashId: -1 };
          var hashId = 0;
          for (var i2 = parts.length; i2--; ) {
            var modifier = keyUtil.KEY_MODS[parts[i2]];
            if (modifier == null) {
              if (typeof console != "undefined")
                console.error("invalid modifier " + parts[i2] + " in " + keys2);
              return false;
            }
            hashId |= modifier;
          }
          return { key, hashId };
        };
        MultiHashHandler2.prototype.findKeyCommand = function(hashId, keyString) {
          var key = KEY_MODS[hashId] + keyString;
          return this.commandKeyBinding[key];
        };
        MultiHashHandler2.prototype.handleKeyboard = function(data, hashId, keyString, keyCode) {
          if (keyCode < 0)
            return;
          var key = KEY_MODS[hashId] + keyString;
          var command = this.commandKeyBinding[key];
          if (data.$keyChain) {
            data.$keyChain += " " + key;
            command = this.commandKeyBinding[data.$keyChain] || command;
          }
          if (command) {
            if (command == "chainKeys" || command[command.length - 1] == "chainKeys") {
              data.$keyChain = data.$keyChain || key;
              return { command: "null" };
            }
          }
          if (data.$keyChain) {
            if ((!hashId || hashId == 4) && keyString.length == 1)
              data.$keyChain = data.$keyChain.slice(0, -key.length - 1);
            else if (hashId == -1 || keyCode > 0)
              data.$keyChain = "";
          }
          return { command };
        };
        MultiHashHandler2.prototype.getStatusText = function(editor, data) {
          return data.$keyChain || "";
        };
        return MultiHashHandler2;
      }()
    );
    function getPosition2(command) {
      return typeof command == "object" && command.bindKey && command.bindKey.position || (command.isDefault ? -100 : 0);
    }
    var HashHandler = (
      /** @class */
      function(_super) {
        __extends2(HashHandler2, _super);
        function HashHandler2(config2, platform2) {
          var _this = _super.call(this, config2, platform2) || this;
          _this.$singleCommand = true;
          return _this;
        }
        return HashHandler2;
      }(MultiHashHandler)
    );
    HashHandler.call = function(thisArg, config2, platform2) {
      MultiHashHandler.prototype.$init.call(thisArg, config2, platform2, true);
    };
    MultiHashHandler.call = function(thisArg, config2, platform2) {
      MultiHashHandler.prototype.$init.call(thisArg, config2, platform2, false);
    };
    exports3.HashHandler = HashHandler;
    exports3.MultiHashHandler = MultiHashHandler;
  });
  ace.define("ace/commands/command_manager", ["require", "exports", "module", "ace/lib/oop", "ace/keyboard/hash_handler", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("../lib/oop");
    var MultiHashHandler = require2("../keyboard/hash_handler").MultiHashHandler;
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var CommandManager = (
      /** @class */
      function(_super) {
        __extends2(CommandManager2, _super);
        function CommandManager2(platform2, commands) {
          var _this = _super.call(this, commands, platform2) || this;
          _this.byName = _this.commands;
          _this.setDefaultHandler("exec", function(e2) {
            if (!e2.args) {
              return e2.command.exec(e2.editor, {}, e2.event, true);
            }
            return e2.command.exec(e2.editor, e2.args, e2.event, false);
          });
          return _this;
        }
        CommandManager2.prototype.exec = function(command, editor, args) {
          if (Array.isArray(command)) {
            for (var i2 = command.length; i2--; ) {
              if (this.exec(command[i2], editor, args))
                return true;
            }
            return false;
          }
          if (typeof command === "string")
            command = this.commands[command];
          var e2 = { editor, command, args };
          if (!this.canExecute(command, editor)) {
            this._signal("commandUnavailable", e2);
            return false;
          }
          e2.returnValue = this._emit("exec", e2);
          this._signal("afterExec", e2);
          return e2.returnValue === false ? false : true;
        };
        CommandManager2.prototype.canExecute = function(command, editor) {
          if (typeof command === "string")
            command = this.commands[command];
          if (!command)
            return false;
          if (editor && editor.$readOnly && !command.readOnly)
            return false;
          if (this.$checkCommandState != false && command.isAvailable && !command.isAvailable(editor))
            return false;
          return true;
        };
        CommandManager2.prototype.toggleRecording = function(editor) {
          if (this.$inReplay)
            return;
          editor && editor._emit("changeStatus");
          if (this.recording) {
            this.macro.pop();
            this.off("exec", this.$addCommandToMacro);
            if (!this.macro.length)
              this.macro = this.oldMacro;
            return this.recording = false;
          }
          if (!this.$addCommandToMacro) {
            this.$addCommandToMacro = (function(e2) {
              this.macro.push([e2.command, e2.args]);
            }).bind(this);
          }
          this.oldMacro = this.macro;
          this.macro = [];
          this.on("exec", this.$addCommandToMacro);
          return this.recording = true;
        };
        CommandManager2.prototype.replay = function(editor) {
          if (this.$inReplay || !this.macro)
            return;
          if (this.recording)
            return this.toggleRecording(editor);
          try {
            this.$inReplay = true;
            this.macro.forEach(function(x2) {
              if (typeof x2 == "string")
                this.exec(x2, editor);
              else
                this.exec(x2[0], editor, x2[1]);
            }, this);
          } finally {
            this.$inReplay = false;
          }
        };
        CommandManager2.prototype.trimMacro = function(m2) {
          return m2.map(function(x2) {
            if (typeof x2[0] != "string")
              x2[0] = x2[0].name;
            if (!x2[1])
              x2 = x2[0];
            return x2;
          });
        };
        return CommandManager2;
      }(MultiHashHandler)
    );
    oop.implement(CommandManager.prototype, EventEmitter2);
    exports3.CommandManager = CommandManager;
  });
  ace.define("ace/commands/default_commands", ["require", "exports", "module", "ace/lib/lang", "ace/config", "ace/range"], function(require2, exports3, module3) {
    var lang2 = require2("../lib/lang");
    var config2 = require2("../config");
    var Range = require2("../range").Range;
    function bindKey(win2, mac) {
      return { win: win2, mac };
    }
    exports3.commands = [
      {
        name: "showSettingsMenu",
        description: "Show settings menu",
        bindKey: bindKey("Ctrl-,", "Command-,"),
        exec: function(editor) {
          config2.loadModule("ace/ext/settings_menu", function(module4) {
            module4.init(editor);
            editor.showSettingsMenu();
          });
        },
        readOnly: true
      },
      {
        name: "goToNextError",
        description: "Go to next error",
        bindKey: bindKey("Alt-E", "F4"),
        exec: function(editor) {
          config2.loadModule("ace/ext/error_marker", function(module4) {
            module4.showErrorMarker(editor, 1);
          });
        },
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "goToPreviousError",
        description: "Go to previous error",
        bindKey: bindKey("Alt-Shift-E", "Shift-F4"),
        exec: function(editor) {
          config2.loadModule("ace/ext/error_marker", function(module4) {
            module4.showErrorMarker(editor, -1);
          });
        },
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "selectall",
        description: "Select all",
        bindKey: bindKey("Ctrl-A", "Command-A"),
        exec: function(editor) {
          editor.selectAll();
        },
        readOnly: true
      },
      {
        name: "centerselection",
        description: "Center selection",
        bindKey: bindKey(null, "Ctrl-L"),
        exec: function(editor) {
          editor.centerSelection();
        },
        readOnly: true
      },
      {
        name: "gotoline",
        description: "Go to line...",
        bindKey: bindKey("Ctrl-L", "Command-L"),
        exec: function(editor, line2) {
          if (typeof line2 === "number" && !isNaN(line2))
            editor.gotoLine(line2);
          editor.prompt({ $type: "gotoLine" });
        },
        readOnly: true
      },
      {
        name: "fold",
        bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
        exec: function(editor) {
          editor.session.toggleFold(false);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "unfold",
        bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
        exec: function(editor) {
          editor.session.toggleFold(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "toggleFoldWidget",
        description: "Toggle fold widget",
        bindKey: bindKey("F2", "F2"),
        exec: function(editor) {
          editor.session.toggleFoldWidget();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "toggleParentFoldWidget",
        description: "Toggle parent fold widget",
        bindKey: bindKey("Alt-F2", "Alt-F2"),
        exec: function(editor) {
          editor.session.toggleFoldWidget(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldall",
        description: "Fold all",
        bindKey: bindKey(null, "Ctrl-Command-Option-0"),
        exec: function(editor) {
          editor.session.foldAll();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldAllComments",
        description: "Fold all comments",
        bindKey: bindKey(null, "Ctrl-Command-Option-0"),
        exec: function(editor) {
          editor.session.foldAllComments();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "foldOther",
        description: "Fold other",
        bindKey: bindKey("Alt-0", "Command-Option-0"),
        exec: function(editor) {
          editor.session.foldAll();
          editor.session.unfold(editor.selection.getAllRanges());
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "unfoldall",
        description: "Unfold all",
        bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
        exec: function(editor) {
          editor.session.unfold();
        },
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "findnext",
        description: "Find next",
        bindKey: bindKey("Ctrl-K", "Command-G"),
        exec: function(editor) {
          editor.findNext();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "findprevious",
        description: "Find previous",
        bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
        exec: function(editor) {
          editor.findPrevious();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "center",
        readOnly: true
      },
      {
        name: "selectOrFindNext",
        description: "Select or find next",
        bindKey: bindKey("Alt-K", "Ctrl-G"),
        exec: function(editor) {
          if (editor.selection.isEmpty())
            editor.selection.selectWord();
          else
            editor.findNext();
        },
        readOnly: true
      },
      {
        name: "selectOrFindPrevious",
        description: "Select or find previous",
        bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"),
        exec: function(editor) {
          if (editor.selection.isEmpty())
            editor.selection.selectWord();
          else
            editor.findPrevious();
        },
        readOnly: true
      },
      {
        name: "find",
        description: "Find",
        bindKey: bindKey("Ctrl-F", "Command-F"),
        exec: function(editor) {
          config2.loadModule("ace/ext/searchbox", function(e2) {
            e2.Search(editor);
          });
        },
        readOnly: true
      },
      {
        name: "overwrite",
        description: "Overwrite",
        bindKey: "Insert",
        exec: function(editor) {
          editor.toggleOverwrite();
        },
        readOnly: true
      },
      {
        name: "selecttostart",
        description: "Select to start",
        bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"),
        exec: function(editor) {
          editor.getSelection().selectFileStart();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "gotostart",
        description: "Go to start",
        bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
        exec: function(editor) {
          editor.navigateFileStart();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "selectup",
        description: "Select up",
        bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"),
        exec: function(editor) {
          editor.getSelection().selectUp();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "golineup",
        description: "Go line up",
        bindKey: bindKey("Up", "Up|Ctrl-P"),
        exec: function(editor, args) {
          editor.navigateUp(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttoend",
        description: "Select to end",
        bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"),
        exec: function(editor) {
          editor.getSelection().selectFileEnd();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "gotoend",
        description: "Go to end",
        bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
        exec: function(editor) {
          editor.navigateFileEnd();
        },
        multiSelectAction: "forEach",
        readOnly: true,
        scrollIntoView: "animate",
        aceCommandGroup: "fileJump"
      },
      {
        name: "selectdown",
        description: "Select down",
        bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"),
        exec: function(editor) {
          editor.getSelection().selectDown();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "golinedown",
        description: "Go line down",
        bindKey: bindKey("Down", "Down|Ctrl-N"),
        exec: function(editor, args) {
          editor.navigateDown(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectwordleft",
        description: "Select word left",
        bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
        exec: function(editor) {
          editor.getSelection().selectWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotowordleft",
        description: "Go to word left",
        bindKey: bindKey("Ctrl-Left", "Option-Left"),
        exec: function(editor) {
          editor.navigateWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttolinestart",
        description: "Select to line start",
        bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"),
        exec: function(editor) {
          editor.getSelection().selectLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotolinestart",
        description: "Go to line start",
        bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
        exec: function(editor) {
          editor.navigateLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectleft",
        description: "Select left",
        bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"),
        exec: function(editor) {
          editor.getSelection().selectLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotoleft",
        description: "Go to left",
        bindKey: bindKey("Left", "Left|Ctrl-B"),
        exec: function(editor, args) {
          editor.navigateLeft(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectwordright",
        description: "Select word right",
        bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
        exec: function(editor) {
          editor.getSelection().selectWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotowordright",
        description: "Go to word right",
        bindKey: bindKey("Ctrl-Right", "Option-Right"),
        exec: function(editor) {
          editor.navigateWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selecttolineend",
        description: "Select to line end",
        bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"),
        exec: function(editor) {
          editor.getSelection().selectLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotolineend",
        description: "Go to line end",
        bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
        exec: function(editor) {
          editor.navigateLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectright",
        description: "Select right",
        bindKey: bindKey("Shift-Right", "Shift-Right"),
        exec: function(editor) {
          editor.getSelection().selectRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "gotoright",
        description: "Go to right",
        bindKey: bindKey("Right", "Right|Ctrl-F"),
        exec: function(editor, args) {
          editor.navigateRight(args.times);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectpagedown",
        description: "Select page down",
        bindKey: "Shift-PageDown",
        exec: function(editor) {
          editor.selectPageDown();
        },
        readOnly: true
      },
      {
        name: "pagedown",
        description: "Page down",
        bindKey: bindKey(null, "Option-PageDown"),
        exec: function(editor) {
          editor.scrollPageDown();
        },
        readOnly: true
      },
      {
        name: "gotopagedown",
        description: "Go to page down",
        bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
        exec: function(editor) {
          editor.gotoPageDown();
        },
        readOnly: true
      },
      {
        name: "selectpageup",
        description: "Select page up",
        bindKey: "Shift-PageUp",
        exec: function(editor) {
          editor.selectPageUp();
        },
        readOnly: true
      },
      {
        name: "pageup",
        description: "Page up",
        bindKey: bindKey(null, "Option-PageUp"),
        exec: function(editor) {
          editor.scrollPageUp();
        },
        readOnly: true
      },
      {
        name: "gotopageup",
        description: "Go to page up",
        bindKey: "PageUp",
        exec: function(editor) {
          editor.gotoPageUp();
        },
        readOnly: true
      },
      {
        name: "scrollup",
        description: "Scroll up",
        bindKey: bindKey("Ctrl-Up", null),
        exec: function(e2) {
          e2.renderer.scrollBy(0, -2 * e2.renderer.layerConfig.lineHeight);
        },
        readOnly: true
      },
      {
        name: "scrolldown",
        description: "Scroll down",
        bindKey: bindKey("Ctrl-Down", null),
        exec: function(e2) {
          e2.renderer.scrollBy(0, 2 * e2.renderer.layerConfig.lineHeight);
        },
        readOnly: true
      },
      {
        name: "selectlinestart",
        description: "Select line start",
        bindKey: "Shift-Home",
        exec: function(editor) {
          editor.getSelection().selectLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "selectlineend",
        description: "Select line end",
        bindKey: "Shift-End",
        exec: function(editor) {
          editor.getSelection().selectLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "togglerecording",
        description: "Toggle recording",
        bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
        exec: function(editor) {
          editor.commands.toggleRecording(editor);
        },
        readOnly: true
      },
      {
        name: "replaymacro",
        description: "Replay macro",
        bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
        exec: function(editor) {
          editor.commands.replay(editor);
        },
        readOnly: true
      },
      {
        name: "jumptomatching",
        description: "Jump to matching",
        bindKey: bindKey("Ctrl-\\|Ctrl-P", "Command-\\"),
        exec: function(editor) {
          editor.jumpToMatching();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "selecttomatching",
        description: "Select to matching",
        bindKey: bindKey("Ctrl-Shift-\\|Ctrl-Shift-P", "Command-Shift-\\"),
        exec: function(editor) {
          editor.jumpToMatching(true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "expandToMatching",
        description: "Expand to matching",
        bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"),
        exec: function(editor) {
          editor.jumpToMatching(true, true);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "animate",
        readOnly: true
      },
      {
        name: "passKeysToBrowser",
        description: "Pass keys to browser",
        bindKey: bindKey(null, null),
        exec: function() {
        },
        passEvent: true,
        readOnly: true
      },
      {
        name: "copy",
        description: "Copy",
        exec: function(editor) {
        },
        readOnly: true
      },
      {
        name: "cut",
        description: "Cut",
        exec: function(editor) {
          var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty();
          var range3 = cutLine ? editor.selection.getLineRange() : editor.selection.getRange();
          editor._emit("cut", range3);
          if (!range3.isEmpty())
            editor.session.remove(range3);
          editor.clearSelection();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "paste",
        description: "Paste",
        exec: function(editor, args) {
          editor.$handlePaste(args);
        },
        scrollIntoView: "cursor"
      },
      {
        name: "removeline",
        description: "Remove line",
        bindKey: bindKey("Ctrl-D", "Command-D"),
        exec: function(editor) {
          editor.removeLines();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEachLine"
      },
      {
        name: "duplicateSelection",
        description: "Duplicate selection",
        bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
        exec: function(editor) {
          editor.duplicateSelection();
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "sortlines",
        description: "Sort lines",
        bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
        exec: function(editor) {
          editor.sortLines();
        },
        scrollIntoView: "selection",
        multiSelectAction: "forEachLine"
      },
      {
        name: "togglecomment",
        description: "Toggle comment",
        bindKey: bindKey("Ctrl-/", "Command-/"),
        exec: function(editor) {
          editor.toggleCommentLines();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "toggleBlockComment",
        description: "Toggle block comment",
        bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
        exec: function(editor) {
          editor.toggleBlockComment();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "modifyNumberUp",
        description: "Modify number up",
        bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
        exec: function(editor) {
          editor.modifyNumber(1);
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "modifyNumberDown",
        description: "Modify number down",
        bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
        exec: function(editor) {
          editor.modifyNumber(-1);
        },
        scrollIntoView: "cursor",
        multiSelectAction: "forEach"
      },
      {
        name: "replace",
        description: "Replace",
        bindKey: bindKey("Ctrl-H", "Command-Option-F"),
        exec: function(editor) {
          config2.loadModule("ace/ext/searchbox", function(e2) {
            e2.Search(editor, true);
          });
        }
      },
      {
        name: "undo",
        description: "Undo",
        bindKey: bindKey("Ctrl-Z", "Command-Z"),
        exec: function(editor) {
          editor.undo();
        }
      },
      {
        name: "redo",
        description: "Redo",
        bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
        exec: function(editor) {
          editor.redo();
        }
      },
      {
        name: "copylinesup",
        description: "Copy lines up",
        bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
        exec: function(editor) {
          editor.copyLinesUp();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "movelinesup",
        description: "Move lines up",
        bindKey: bindKey("Alt-Up", "Option-Up"),
        exec: function(editor) {
          editor.moveLinesUp();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "copylinesdown",
        description: "Copy lines down",
        bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
        exec: function(editor) {
          editor.copyLinesDown();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "movelinesdown",
        description: "Move lines down",
        bindKey: bindKey("Alt-Down", "Option-Down"),
        exec: function(editor) {
          editor.moveLinesDown();
        },
        scrollIntoView: "cursor"
      },
      {
        name: "del",
        description: "Delete",
        bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
        exec: function(editor) {
          editor.remove("right");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "backspace",
        description: "Backspace",
        bindKey: bindKey("Shift-Backspace|Backspace", "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),
        exec: function(editor) {
          editor.remove("left");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "cut_or_delete",
        description: "Cut or delete",
        bindKey: bindKey("Shift-Delete", null),
        exec: function(editor) {
          if (editor.selection.isEmpty()) {
            editor.remove("left");
          } else {
            return false;
          }
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolinestart",
        description: "Remove to line start",
        bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
        exec: function(editor) {
          editor.removeToLineStart();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolineend",
        description: "Remove to line end",
        bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"),
        exec: function(editor) {
          editor.removeToLineEnd();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolinestarthard",
        description: "Remove to line start hard",
        bindKey: bindKey("Ctrl-Shift-Backspace", null),
        exec: function(editor) {
          var range3 = editor.selection.getRange();
          range3.start.column = 0;
          editor.session.remove(range3);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removetolineendhard",
        description: "Remove to line end hard",
        bindKey: bindKey("Ctrl-Shift-Delete", null),
        exec: function(editor) {
          var range3 = editor.selection.getRange();
          range3.end.column = Number.MAX_VALUE;
          editor.session.remove(range3);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removewordleft",
        description: "Remove word left",
        bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
        exec: function(editor) {
          editor.removeWordLeft();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "removewordright",
        description: "Remove word right",
        bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
        exec: function(editor) {
          editor.removeWordRight();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "outdent",
        description: "Outdent",
        bindKey: bindKey("Shift-Tab", "Shift-Tab"),
        exec: function(editor) {
          editor.blockOutdent();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "indent",
        description: "Indent",
        bindKey: bindKey("Tab", "Tab"),
        exec: function(editor) {
          editor.indent();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "selectionPart"
      },
      {
        name: "blockoutdent",
        description: "Block outdent",
        bindKey: bindKey("Ctrl-[", "Ctrl-["),
        exec: function(editor) {
          editor.blockOutdent();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "blockindent",
        description: "Block indent",
        bindKey: bindKey("Ctrl-]", "Ctrl-]"),
        exec: function(editor) {
          editor.blockIndent();
        },
        multiSelectAction: "forEachLine",
        scrollIntoView: "selectionPart"
      },
      {
        name: "insertstring",
        description: "Insert string",
        exec: function(editor, str) {
          editor.insert(str);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "inserttext",
        description: "Insert text",
        exec: function(editor, args) {
          editor.insert(lang2.stringRepeat(args.text || "", args.times || 1));
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "splitline",
        description: "Split line",
        bindKey: bindKey(null, "Ctrl-O"),
        exec: function(editor) {
          editor.splitLine();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "transposeletters",
        description: "Transpose letters",
        bindKey: bindKey("Alt-Shift-X", "Ctrl-T"),
        exec: function(editor) {
          editor.transposeLetters();
        },
        multiSelectAction: function(editor) {
          editor.transposeSelections(1);
        },
        scrollIntoView: "cursor"
      },
      {
        name: "touppercase",
        description: "To uppercase",
        bindKey: bindKey("Ctrl-U", "Ctrl-U"),
        exec: function(editor) {
          editor.toUpperCase();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "tolowercase",
        description: "To lowercase",
        bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
        exec: function(editor) {
          editor.toLowerCase();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "autoindent",
        description: "Auto Indent",
        bindKey: bindKey(null, null),
        exec: function(editor) {
          editor.autoIndent();
        },
        scrollIntoView: "animate"
      },
      {
        name: "expandtoline",
        description: "Expand to line",
        bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
        exec: function(editor) {
          var range3 = editor.selection.getRange();
          range3.start.column = range3.end.column = 0;
          range3.end.row++;
          editor.selection.setRange(range3, false);
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor",
        readOnly: true
      },
      {
        name: "openlink",
        bindKey: bindKey("Ctrl+F3", "F3"),
        exec: function(editor) {
          editor.openLink();
        }
      },
      {
        name: "joinlines",
        description: "Join lines",
        bindKey: bindKey(null, null),
        exec: function(editor) {
          var isBackwards = editor.selection.isBackwards();
          var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
          var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
          var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length;
          var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
          var selectedCount = selectedText.replace(/\n\s*/, " ").length;
          var insertLine = editor.session.doc.getLine(selectionStart.row);
          for (var i3 = selectionStart.row + 1; i3 <= selectionEnd.row + 1; i3++) {
            var curLine = lang2.stringTrimLeft(lang2.stringTrimRight(editor.session.doc.getLine(i3)));
            if (curLine.length !== 0) {
              curLine = " " + curLine;
            }
            insertLine += curLine;
          }
          if (selectionEnd.row + 1 < editor.session.doc.getLength() - 1) {
            insertLine += editor.session.doc.getNewLineCharacter();
          }
          editor.clearSelection();
          editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
          if (selectedCount > 0) {
            editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
            editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
          } else {
            firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? firstLineEndCol + 1 : firstLineEndCol;
            editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
          }
        },
        multiSelectAction: "forEach",
        readOnly: true
      },
      {
        name: "invertSelection",
        description: "Invert selection",
        bindKey: bindKey(null, null),
        exec: function(editor) {
          var endRow = editor.session.doc.getLength() - 1;
          var endCol = editor.session.doc.getLine(endRow).length;
          var ranges = editor.selection.rangeList.ranges;
          var newRanges = [];
          if (ranges.length < 1) {
            ranges = [editor.selection.getRange()];
          }
          for (var i3 = 0; i3 < ranges.length; i3++) {
            if (i3 == ranges.length - 1) {
              if (!(ranges[i3].end.row === endRow && ranges[i3].end.column === endCol)) {
                newRanges.push(new Range(ranges[i3].end.row, ranges[i3].end.column, endRow, endCol));
              }
            }
            if (i3 === 0) {
              if (!(ranges[i3].start.row === 0 && ranges[i3].start.column === 0)) {
                newRanges.push(new Range(0, 0, ranges[i3].start.row, ranges[i3].start.column));
              }
            } else {
              newRanges.push(new Range(ranges[i3 - 1].end.row, ranges[i3 - 1].end.column, ranges[i3].start.row, ranges[i3].start.column));
            }
          }
          editor.exitMultiSelectMode();
          editor.clearSelection();
          for (var i3 = 0; i3 < newRanges.length; i3++) {
            editor.selection.addRange(newRanges[i3], false);
          }
        },
        readOnly: true,
        scrollIntoView: "none"
      },
      {
        name: "addLineAfter",
        description: "Add new line after the current line",
        exec: function(editor) {
          editor.selection.clearSelection();
          editor.navigateLineEnd();
          editor.insert("\n");
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "addLineBefore",
        description: "Add new line before the current line",
        exec: function(editor) {
          editor.selection.clearSelection();
          var cursor = editor.getCursorPosition();
          editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE);
          editor.insert("\n");
          if (cursor.row === 0)
            editor.navigateUp();
        },
        multiSelectAction: "forEach",
        scrollIntoView: "cursor"
      },
      {
        name: "openCommandPallete",
        exec: function(editor) {
          console.warn("This is an obsolete command. Please use `openCommandPalette` instead.");
          editor.prompt({ $type: "commands" });
        },
        readOnly: true
      },
      {
        name: "openCommandPalette",
        description: "Open command palette",
        bindKey: bindKey("F1", "F1"),
        exec: function(editor) {
          editor.prompt({ $type: "commands" });
        },
        readOnly: true
      },
      {
        name: "modeSelect",
        description: "Change language mode...",
        bindKey: bindKey(null, null),
        exec: function(editor) {
          editor.prompt({ $type: "modes" });
        },
        readOnly: true
      }
    ];
    for (var i2 = 1; i2 < 9; i2++) {
      exports3.commands.push({
        name: "foldToLevel" + i2,
        description: "Fold To Level " + i2,
        level: i2,
        exec: function(editor) {
          editor.session.foldToLevel(this.level);
        },
        scrollIntoView: "center",
        readOnly: true
      });
    }
  });
  ace.define("ace/keyboard/gutter_handler", ["require", "exports", "module", "ace/lib/keys", "ace/mouse/default_gutter_handler"], function(require2, exports3, module3) {
    var keys2 = require2("../lib/keys");
    var GutterTooltip = require2("../mouse/default_gutter_handler").GutterTooltip;
    var GutterKeyboardHandler = (
      /** @class */
      function() {
        function GutterKeyboardHandler2(editor) {
          this.editor = editor;
          this.gutterLayer = editor.renderer.$gutterLayer;
          this.element = editor.renderer.$gutter;
          this.lines = editor.renderer.$gutterLayer.$lines;
          this.activeRowIndex = null;
          this.activeLane = null;
          this.annotationTooltip = new GutterTooltip(this.editor);
        }
        GutterKeyboardHandler2.prototype.addListener = function() {
          this.element.addEventListener("keydown", this.$onGutterKeyDown.bind(this));
          this.element.addEventListener("focusout", this.$blurGutter.bind(this));
          this.editor.on("mousewheel", this.$blurGutter.bind(this));
        };
        GutterKeyboardHandler2.prototype.removeListener = function() {
          this.element.removeEventListener("keydown", this.$onGutterKeyDown.bind(this));
          this.element.removeEventListener("focusout", this.$blurGutter.bind(this));
          this.editor.off("mousewheel", this.$blurGutter.bind(this));
        };
        GutterKeyboardHandler2.prototype.$onGutterKeyDown = function(e2) {
          if (this.annotationTooltip.isOpen) {
            e2.preventDefault();
            if (e2.keyCode === keys2["escape"])
              this.annotationTooltip.hideTooltip();
            return;
          }
          if (e2.target === this.element) {
            if (e2.keyCode != keys2["enter"]) {
              return;
            }
            e2.preventDefault();
            var row = this.editor.getCursorPosition().row;
            if (!this.editor.isRowVisible(row))
              this.editor.scrollToLine(row, true, true);
            setTimeout(
              (function() {
                var index2 = this.$rowToRowIndex(this.gutterLayer.$cursorCell.row);
                var nearestFoldLaneWidgetIndex = this.$findNearestFoldLaneWidget(index2);
                var nearestAnnotationIndex = this.$findNearestAnnotation(index2);
                if (nearestFoldLaneWidgetIndex === null && nearestAnnotationIndex === null)
                  return;
                var futureActiveRowIndex = this.$findClosestNumber(nearestFoldLaneWidgetIndex, nearestAnnotationIndex, index2);
                if (futureActiveRowIndex === nearestFoldLaneWidgetIndex) {
                  this.activeLane = "fold";
                  this.activeRowIndex = nearestFoldLaneWidgetIndex;
                  if (this.$isCustomWidgetVisible(nearestFoldLaneWidgetIndex)) {
                    this.$focusCustomWidget(this.activeRowIndex);
                    return;
                  } else {
                    this.$focusFoldWidget(this.activeRowIndex);
                    return;
                  }
                } else {
                  this.activeRowIndex = nearestAnnotationIndex;
                  this.activeLane = "annotation";
                  this.$focusAnnotation(this.activeRowIndex);
                  return;
                }
              }).bind(this),
              10
            );
            return;
          }
          this.$handleGutterKeyboardInteraction(e2);
          setTimeout((function() {
            this.editor._signal("gutterkeydown", new GutterKeyboardEvent(e2, this));
          }).bind(this), 10);
        };
        GutterKeyboardHandler2.prototype.$handleGutterKeyboardInteraction = function(e2) {
          if (e2.keyCode === keys2["tab"]) {
            e2.preventDefault();
            return;
          }
          if (e2.keyCode === keys2["escape"]) {
            e2.preventDefault();
            this.$blurGutter();
            this.element.focus();
            this.lane = null;
            return;
          }
          if (e2.keyCode === keys2["up"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                this.$moveFoldWidgetUp();
                break;
              case "annotation":
                this.$moveAnnotationUp();
                break;
            }
            return;
          }
          if (e2.keyCode === keys2["down"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                this.$moveFoldWidgetDown();
                break;
              case "annotation":
                this.$moveAnnotationDown();
                break;
            }
            return;
          }
          if (e2.keyCode === keys2["left"]) {
            e2.preventDefault();
            this.$switchLane("annotation");
            return;
          }
          if (e2.keyCode === keys2["right"]) {
            e2.preventDefault();
            this.$switchLane("fold");
            return;
          }
          if (e2.keyCode === keys2["enter"] || e2.keyCode === keys2["space"]) {
            e2.preventDefault();
            switch (this.activeLane) {
              case "fold":
                var row = this.$rowIndexToRow(this.activeRowIndex);
                var customWidget = this.editor.session.$gutterCustomWidgets[row];
                if (customWidget) {
                  if (customWidget.callbacks && customWidget.callbacks.onClick) {
                    customWidget.callbacks.onClick(e2, row);
                  }
                } else if (this.gutterLayer.session.foldWidgets[row] === "start") {
                  this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex), e2);
                  setTimeout(
                    (function() {
                      if (this.$rowIndexToRow(this.activeRowIndex) !== row) {
                        this.$blurFoldWidget(this.activeRowIndex);
                        this.activeRowIndex = this.$rowToRowIndex(row);
                        this.$focusFoldWidget(this.activeRowIndex);
                      }
                    }).bind(this),
                    10
                  );
                  break;
                } else if (this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)] === "end") {
                  break;
                }
                return;
              case "annotation":
                var gutterElement = this.lines.cells[this.activeRowIndex].element.childNodes[2];
                var rect = gutterElement.getBoundingClientRect();
                var style2 = this.annotationTooltip.getElement().style;
                style2.left = rect.right + "px";
                style2.top = rect.bottom + "px";
                this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex));
                break;
            }
            return;
          }
        };
        GutterKeyboardHandler2.prototype.$blurGutter = function() {
          if (this.activeRowIndex !== null) {
            switch (this.activeLane) {
              case "fold":
                this.$blurFoldWidget(this.activeRowIndex);
                this.$blurCustomWidget(this.activeRowIndex);
                break;
              case "annotation":
                this.$blurAnnotation(this.activeRowIndex);
                break;
            }
          }
          if (this.annotationTooltip.isOpen)
            this.annotationTooltip.hideTooltip();
          return;
        };
        GutterKeyboardHandler2.prototype.$isFoldWidgetVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = this.$getFoldWidget(index2).style.display !== "none";
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$isCustomWidgetVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = !!this.$getCustomWidget(index2);
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$isAnnotationVisible = function(index2) {
          var isRowFullyVisible = this.editor.isRowFullyVisible(this.$rowIndexToRow(index2));
          var isIconVisible = this.$getAnnotation(index2).style.display !== "none";
          return isRowFullyVisible && isIconVisible;
        };
        GutterKeyboardHandler2.prototype.$getFoldWidget = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[1];
        };
        GutterKeyboardHandler2.prototype.$getCustomWidget = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[3];
        };
        GutterKeyboardHandler2.prototype.$getAnnotation = function(index2) {
          var cell = this.lines.get(index2);
          var element2 = cell.element;
          return element2.childNodes[2];
        };
        GutterKeyboardHandler2.prototype.$findNearestFoldLaneWidget = function(index2) {
          if (this.$isCustomWidgetVisible(index2))
            return index2;
          if (this.$isFoldWidgetVisible(index2))
            return index2;
          var i2 = 0;
          while (index2 - i2 > 0 || index2 + i2 < this.lines.getLength() - 1) {
            i2++;
            if (index2 - i2 >= 0 && this.$isCustomWidgetVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isCustomWidgetVisible(index2 + i2))
              return index2 + i2;
            if (index2 - i2 >= 0 && this.$isFoldWidgetVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isFoldWidgetVisible(index2 + i2))
              return index2 + i2;
          }
          return null;
        };
        GutterKeyboardHandler2.prototype.$findNearestAnnotation = function(index2) {
          if (this.$isAnnotationVisible(index2))
            return index2;
          var i2 = 0;
          while (index2 - i2 > 0 || index2 + i2 < this.lines.getLength() - 1) {
            i2++;
            if (index2 - i2 >= 0 && this.$isAnnotationVisible(index2 - i2))
              return index2 - i2;
            if (index2 + i2 <= this.lines.getLength() - 1 && this.$isAnnotationVisible(index2 + i2))
              return index2 + i2;
          }
          return null;
        };
        GutterKeyboardHandler2.prototype.$focusFoldWidget = function(index2) {
          if (index2 == null)
            return;
          var foldWidget = this.$getFoldWidget(index2);
          foldWidget.classList.add(this.editor.renderer.keyboardFocusClassName);
          foldWidget.focus();
        };
        GutterKeyboardHandler2.prototype.$focusCustomWidget = function(index2) {
          if (index2 == null)
            return;
          var customWidget = this.$getCustomWidget(index2);
          if (customWidget) {
            customWidget.classList.add(this.editor.renderer.keyboardFocusClassName);
            customWidget.focus();
          }
        };
        GutterKeyboardHandler2.prototype.$focusAnnotation = function(index2) {
          if (index2 == null)
            return;
          var annotation = this.$getAnnotation(index2);
          annotation.classList.add(this.editor.renderer.keyboardFocusClassName);
          annotation.focus();
        };
        GutterKeyboardHandler2.prototype.$blurFoldWidget = function(index2) {
          var foldWidget = this.$getFoldWidget(index2);
          foldWidget.classList.remove(this.editor.renderer.keyboardFocusClassName);
          foldWidget.blur();
        };
        GutterKeyboardHandler2.prototype.$blurCustomWidget = function(index2) {
          var customWidget = this.$getCustomWidget(index2);
          if (customWidget) {
            customWidget.classList.remove(this.editor.renderer.keyboardFocusClassName);
            customWidget.blur();
          }
        };
        GutterKeyboardHandler2.prototype.$blurAnnotation = function(index2) {
          var annotation = this.$getAnnotation(index2);
          annotation.classList.remove(this.editor.renderer.keyboardFocusClassName);
          annotation.blur();
        };
        GutterKeyboardHandler2.prototype.$moveFoldWidgetUp = function() {
          var index2 = this.activeRowIndex;
          while (index2 > 0) {
            index2--;
            if (this.$isFoldWidgetVisible(index2) || this.$isCustomWidgetVisible(index2)) {
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = index2;
              if (this.$isFoldWidgetVisible(index2)) {
                this.$focusFoldWidget(this.activeRowIndex);
              } else {
                this.$focusCustomWidget(this.activeRowIndex);
              }
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveFoldWidgetDown = function() {
          var index2 = this.activeRowIndex;
          while (index2 < this.lines.getLength() - 1) {
            index2++;
            if (this.$isFoldWidgetVisible(index2) || this.$isCustomWidgetVisible(index2)) {
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = index2;
              if (this.$isFoldWidgetVisible(index2)) {
                this.$focusFoldWidget(this.activeRowIndex);
              } else {
                this.$focusCustomWidget(this.activeRowIndex);
              }
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveAnnotationUp = function() {
          var index2 = this.activeRowIndex;
          while (index2 > 0) {
            index2--;
            if (this.$isAnnotationVisible(index2)) {
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = index2;
              this.$focusAnnotation(this.activeRowIndex);
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$moveAnnotationDown = function() {
          var index2 = this.activeRowIndex;
          while (index2 < this.lines.getLength() - 1) {
            index2++;
            if (this.$isAnnotationVisible(index2)) {
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = index2;
              this.$focusAnnotation(this.activeRowIndex);
              return;
            }
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$findClosestNumber = function(num1, num2, target) {
          if (num1 === null)
            return num2;
          if (num2 === null)
            return num1;
          return Math.abs(target - num1) <= Math.abs(target - num2) ? num1 : num2;
        };
        GutterKeyboardHandler2.prototype.$switchLane = function(desinationLane) {
          switch (desinationLane) {
            case "annotation":
              if (this.activeLane === "annotation") {
                break;
              }
              var annotationIndex = this.$findNearestAnnotation(this.activeRowIndex);
              if (annotationIndex == null) {
                break;
              }
              this.activeLane = "annotation";
              this.$blurFoldWidget(this.activeRowIndex);
              this.$blurCustomWidget(this.activeRowIndex);
              this.activeRowIndex = annotationIndex;
              this.$focusAnnotation(this.activeRowIndex);
              break;
            case "fold":
              if (this.activeLane === "fold") {
                break;
              }
              var foldLaneWidgetIndex = this.$findNearestFoldLaneWidget(this.activeRowIndex);
              if (foldLaneWidgetIndex === null) {
                break;
              }
              this.activeLane = "fold";
              this.$blurAnnotation(this.activeRowIndex);
              this.activeRowIndex = foldLaneWidgetIndex;
              if (this.$isCustomWidgetVisible(foldLaneWidgetIndex)) {
                this.$focusCustomWidget(this.activeRowIndex);
              } else {
                this.$focusFoldWidget(this.activeRowIndex);
              }
              break;
          }
          return;
        };
        GutterKeyboardHandler2.prototype.$rowIndexToRow = function(index2) {
          var cell = this.lines.get(index2);
          if (cell)
            return cell.row;
          return null;
        };
        GutterKeyboardHandler2.prototype.$rowToRowIndex = function(row) {
          for (var i2 = 0; i2 < this.lines.getLength(); i2++) {
            var cell = this.lines.get(i2);
            if (cell.row == row)
              return i2;
          }
          return null;
        };
        return GutterKeyboardHandler2;
      }()
    );
    exports3.GutterKeyboardHandler = GutterKeyboardHandler;
    var GutterKeyboardEvent = (
      /** @class */
      function() {
        function GutterKeyboardEvent2(domEvent, gutterKeyboardHandler) {
          this.gutterKeyboardHandler = gutterKeyboardHandler;
          this.domEvent = domEvent;
        }
        GutterKeyboardEvent2.prototype.getKey = function() {
          return keys2.keyCodeToString(this.domEvent.keyCode);
        };
        GutterKeyboardEvent2.prototype.getRow = function() {
          return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex);
        };
        GutterKeyboardEvent2.prototype.isInAnnotationLane = function() {
          return this.gutterKeyboardHandler.activeLane === "annotation";
        };
        GutterKeyboardEvent2.prototype.isInFoldLane = function() {
          return this.gutterKeyboardHandler.activeLane === "fold";
        };
        return GutterKeyboardEvent2;
      }()
    );
    exports3.GutterKeyboardEvent = GutterKeyboardEvent;
  });
  ace.define("ace/editor", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/useragent", "ace/keyboard/textinput", "ace/mouse/mouse_handler", "ace/mouse/fold_handler", "ace/keyboard/keybinding", "ace/edit_session", "ace/search", "ace/range", "ace/lib/event_emitter", "ace/commands/command_manager", "ace/commands/default_commands", "ace/config", "ace/token_iterator", "ace/keyboard/gutter_handler", "ace/config", "ace/clipboard", "ace/lib/keys", "ace/lib/event", "ace/tooltip"], function(require2, exports3, module3) {
    var __values = this && this.__values || function(o2) {
      var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0;
      if (m2)
        return m2.call(o2);
      if (o2 && typeof o2.length === "number")
        return {
          next: function() {
            if (o2 && i2 >= o2.length)
              o2 = void 0;
            return { value: o2 && o2[i2++], done: !o2 };
          }
        };
      throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
    };
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var lang2 = require2("./lib/lang");
    var useragent = require2("./lib/useragent");
    var TextInput = require2("./keyboard/textinput").TextInput;
    var MouseHandler = require2("./mouse/mouse_handler").MouseHandler;
    var FoldHandler = require2("./mouse/fold_handler").FoldHandler;
    var KeyBinding = require2("./keyboard/keybinding").KeyBinding;
    var EditSession = require2("./edit_session").EditSession;
    var Search = require2("./search").Search;
    var Range = require2("./range").Range;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var CommandManager = require2("./commands/command_manager").CommandManager;
    var defaultCommands = require2("./commands/default_commands").commands;
    var config2 = require2("./config");
    var TokenIterator = require2("./token_iterator").TokenIterator;
    var GutterKeyboardHandler = require2("./keyboard/gutter_handler").GutterKeyboardHandler;
    var nls = require2("./config").nls;
    var clipboard = require2("./clipboard");
    var keys2 = require2("./lib/keys");
    var event = require2("./lib/event");
    var HoverTooltip = require2("./tooltip").HoverTooltip;
    var Editor2 = (
      /** @class */
      function() {
        function Editor3(renderer, session, options) {
          this.id = "editor" + ++Editor3.$uid;
          this.session;
          this.$toDestroy = [];
          var container = renderer.getContainerElement();
          this.container = container;
          this.renderer = renderer;
          this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
          if (typeof document == "object") {
            this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
            this.renderer.textarea = this.textInput.getElement();
            this.$mouseHandler = new MouseHandler(this);
            new FoldHandler(this);
          }
          this.keyBinding = new KeyBinding(this);
          this.$search = new Search().set({
            wrap: true
          });
          this.$historyTracker = this.$historyTracker.bind(this);
          this.commands.on("exec", this.$historyTracker);
          this.$initOperationListeners();
          this._$emitInputEvent = lang2.delayedCall((function() {
            this._signal("input", {});
            if (this.session && !this.session.destroyed)
              this.session.bgTokenizer.scheduleStart();
          }).bind(this));
          this.on("change", function(_24, _self) {
            _self._$emitInputEvent.schedule(31);
          });
          this.setSession(session || options && options.session || new EditSession(""));
          config2.resetOptions(this);
          if (options)
            this.setOptions(options);
          config2._signal("editor", this);
        }
        Editor3.prototype.$initOperationListeners = function() {
          this.commands.on("exec", this.startOperation.bind(this), true);
          this.commands.on("afterExec", this.endOperation.bind(this), true);
        };
        Editor3.prototype.startOperation = function(commandEvent) {
          this.session.startOperation(commandEvent);
        };
        Editor3.prototype.endOperation = function(e2) {
          this.session.endOperation(e2);
        };
        Editor3.prototype.onStartOperation = function(commandEvent) {
          this.curOp = this.session.curOp;
          this.curOp.scrollTop = this.renderer.scrollTop;
          this.prevOp = this.session.prevOp;
          if (!commandEvent) {
            this.previousCommand = null;
          }
        };
        Editor3.prototype.onEndOperation = function(e2) {
          if (this.curOp && this.session) {
            if (e2 && e2.returnValue === false) {
              this.curOp = null;
              return;
            }
            this._signal("beforeEndOperation");
            if (!this.curOp)
              return;
            var command = this.curOp.command;
            var scrollIntoView = command && command.scrollIntoView;
            if (scrollIntoView) {
              switch (scrollIntoView) {
                case "center-animate":
                  scrollIntoView = "animate";
                case "center":
                  this.renderer.scrollCursorIntoView(null, 0.5);
                  break;
                case "animate":
                case "cursor":
                  this.renderer.scrollCursorIntoView();
                  break;
                case "selectionPart":
                  var range3 = this.selection.getRange();
                  var config3 = this.renderer.layerConfig;
                  if (range3.start.row >= config3.lastRow || range3.end.row <= config3.firstRow) {
                    this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead);
                  }
                  break;
              }
              if (scrollIntoView == "animate")
                this.renderer.animateScrolling(this.curOp.scrollTop);
            }
            this.$lastSel = this.session.selection.toJSON();
            this.prevOp = this.curOp;
            this.curOp = null;
          }
        };
        Editor3.prototype.$historyTracker = function(e2) {
          if (!this.$mergeUndoDeltas)
            return;
          var prev2 = this.prevOp;
          var mergeableCommands = this.$mergeableCommands;
          var shouldMerge = prev2.command && e2.command.name == prev2.command.name;
          if (e2.command.name == "insertstring") {
            var text2 = e2.args;
            if (this.mergeNextCommand === void 0)
              this.mergeNextCommand = true;
            shouldMerge = shouldMerge && this.mergeNextCommand && (!/\s/.test(text2) || /\s/.test(prev2.args));
            this.mergeNextCommand = true;
          } else {
            shouldMerge = shouldMerge && mergeableCommands.indexOf(e2.command.name) !== -1;
          }
          if (this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2e3) {
            shouldMerge = false;
          }
          if (shouldMerge)
            this.session.mergeUndoDeltas = true;
          else if (mergeableCommands.indexOf(e2.command.name) !== -1)
            this.sequenceStartTime = Date.now();
        };
        Editor3.prototype.setKeyboardHandler = function(keyboardHandler, cb2) {
          if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") {
            this.$keybindingId = keyboardHandler;
            var _self = this;
            config2.loadModule(["keybinding", keyboardHandler], function(module4) {
              if (_self.$keybindingId == keyboardHandler)
                _self.keyBinding.setKeyboardHandler(module4 && module4.handler);
              cb2 && cb2();
            });
          } else {
            this.$keybindingId = null;
            this.keyBinding.setKeyboardHandler(keyboardHandler);
            cb2 && cb2();
          }
        };
        Editor3.prototype.getKeyboardHandler = function() {
          return this.keyBinding.getKeyboardHandler();
        };
        Editor3.prototype.setSession = function(session) {
          if (this.session == session)
            return;
          if (this.curOp)
            this.endOperation();
          this.curOp = {};
          var oldSession = this.session;
          if (oldSession) {
            this.session.off("change", this.$onDocumentChange);
            this.session.off("changeMode", this.$onChangeMode);
            this.session.off("tokenizerUpdate", this.$onTokenizerUpdate);
            this.session.off("changeTabSize", this.$onChangeTabSize);
            this.session.off("changeWrapLimit", this.$onChangeWrapLimit);
            this.session.off("changeWrapMode", this.$onChangeWrapMode);
            this.session.off("changeFold", this.$onChangeFold);
            this.session.off("changeFrontMarker", this.$onChangeFrontMarker);
            this.session.off("changeBackMarker", this.$onChangeBackMarker);
            this.session.off("changeBreakpoint", this.$onChangeBreakpoint);
            this.session.off("changeAnnotation", this.$onChangeAnnotation);
            this.session.off("changeOverwrite", this.$onCursorChange);
            this.session.off("changeScrollTop", this.$onScrollTopChange);
            this.session.off("changeScrollLeft", this.$onScrollLeftChange);
            this.session.off("startOperation", this.$onStartOperation);
            this.session.off("endOperation", this.$onEndOperation);
            var selection = this.session.getSelection();
            selection.off("changeCursor", this.$onCursorChange);
            selection.off("changeSelection", this.$onSelectionChange);
          }
          this.session = session;
          if (session) {
            this.$onDocumentChange = this.onDocumentChange.bind(this);
            session.on("change", this.$onDocumentChange);
            this.renderer.setSession(session);
            this.$onChangeMode = this.onChangeMode.bind(this);
            session.on("changeMode", this.$onChangeMode);
            this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
            session.on("tokenizerUpdate", this.$onTokenizerUpdate);
            this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
            session.on("changeTabSize", this.$onChangeTabSize);
            this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
            session.on("changeWrapLimit", this.$onChangeWrapLimit);
            this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
            session.on("changeWrapMode", this.$onChangeWrapMode);
            this.$onChangeFold = this.onChangeFold.bind(this);
            session.on("changeFold", this.$onChangeFold);
            this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
            this.session.on("changeFrontMarker", this.$onChangeFrontMarker);
            this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
            this.session.on("changeBackMarker", this.$onChangeBackMarker);
            this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
            this.session.on("changeBreakpoint", this.$onChangeBreakpoint);
            this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
            this.session.on("changeAnnotation", this.$onChangeAnnotation);
            this.$onCursorChange = this.onCursorChange.bind(this);
            this.session.on("changeOverwrite", this.$onCursorChange);
            this.$onScrollTopChange = this.onScrollTopChange.bind(this);
            this.session.on("changeScrollTop", this.$onScrollTopChange);
            this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
            this.session.on("changeScrollLeft", this.$onScrollLeftChange);
            this.selection = session.getSelection();
            this.selection.on("changeCursor", this.$onCursorChange);
            this.$onSelectionChange = this.onSelectionChange.bind(this);
            this.selection.on("changeSelection", this.$onSelectionChange);
            this.$onStartOperation = this.onStartOperation.bind(this);
            this.session.on("startOperation", this.$onStartOperation);
            this.$onEndOperation = this.onEndOperation.bind(this);
            this.session.on("endOperation", this.$onEndOperation);
            this.onChangeMode();
            this.onCursorChange();
            this.onScrollTopChange();
            this.onScrollLeftChange();
            this.onSelectionChange();
            this.onChangeFrontMarker();
            this.onChangeBackMarker();
            this.onChangeBreakpoint();
            this.onChangeAnnotation();
            this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
            this.renderer.updateFull();
          } else {
            this.selection = null;
            this.renderer.setSession(session);
          }
          this._signal("changeSession", {
            session,
            oldSession
          });
          this.curOp = null;
          oldSession && oldSession._signal("changeEditor", { oldEditor: this });
          if (oldSession)
            oldSession.$editor = null;
          session && session._signal("changeEditor", { editor: this });
          if (session)
            session.$editor = this;
          if (session && !session.destroyed)
            session.bgTokenizer.scheduleStart();
        };
        Editor3.prototype.getSession = function() {
          return this.session;
        };
        Editor3.prototype.setValue = function(val, cursorPos) {
          this.session.doc.setValue(val);
          if (!cursorPos)
            this.selectAll();
          else if (cursorPos == 1)
            this.navigateFileEnd();
          else if (cursorPos == -1)
            this.navigateFileStart();
          return val;
        };
        Editor3.prototype.getValue = function() {
          return this.session.getValue();
        };
        Editor3.prototype.getSelection = function() {
          return this.selection;
        };
        Editor3.prototype.resize = function(force) {
          this.renderer.onResize(force);
        };
        Editor3.prototype.setTheme = function(theme2, cb2) {
          this.renderer.setTheme(theme2, cb2);
        };
        Editor3.prototype.getTheme = function() {
          return this.renderer.getTheme();
        };
        Editor3.prototype.setStyle = function(style2, incluude) {
          this.renderer.setStyle(style2, incluude);
        };
        Editor3.prototype.unsetStyle = function(style2) {
          this.renderer.unsetStyle(style2);
        };
        Editor3.prototype.getFontSize = function() {
          return this.getOption("fontSize") || dom.computedStyle(this.container).fontSize;
        };
        Editor3.prototype.setFontSize = function(size2) {
          this.setOption("fontSize", size2);
        };
        Editor3.prototype.$highlightBrackets = function() {
          if (this.$highlightPending) {
            return;
          }
          var self2 = this;
          this.$highlightPending = true;
          setTimeout(function() {
            self2.$highlightPending = false;
            var session = self2.session;
            if (!session || session.destroyed)
              return;
            if (session.$bracketHighlight) {
              session.$bracketHighlight.markerIds.forEach(function(id2) {
                session.removeMarker(id2);
              });
              session.$bracketHighlight = null;
            }
            var pos = self2.getCursorPosition();
            var handler = self2.getKeyboardHandler();
            var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self2);
            var ranges = session.getMatchingBracketRanges(pos, isBackwards);
            if (!ranges) {
              var iterator2 = new TokenIterator(session, pos.row, pos.column);
              var token2 = iterator2.getCurrentToken();
              if (token2 && /\b(?:tag-open|tag-name)/.test(token2.type)) {
                var tagNamesRanges = session.getMatchingTags(pos);
                if (tagNamesRanges) {
                  ranges = [
                    tagNamesRanges.openTagName.isEmpty() ? tagNamesRanges.openTag : tagNamesRanges.openTagName,
                    tagNamesRanges.closeTagName.isEmpty() ? tagNamesRanges.closeTag : tagNamesRanges.closeTagName
                  ];
                }
              }
            }
            if (!ranges && session.$mode.getMatching)
              ranges = session.$mode.getMatching(self2.session);
            if (!ranges) {
              if (self2.getHighlightIndentGuides())
                self2.renderer.$textLayer.$highlightIndentGuide();
              return;
            }
            var markerType = "ace_bracket";
            if (!Array.isArray(ranges)) {
              ranges = [ranges];
            } else if (ranges.length == 1) {
              markerType = "ace_error_bracket";
            }
            if (ranges.length == 2) {
              if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0)
                ranges = [Range.fromPoints(ranges[0].start, ranges[1].end)];
              else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0)
                ranges = [Range.fromPoints(ranges[1].start, ranges[0].end)];
            }
            session.$bracketHighlight = {
              ranges,
              markerIds: ranges.map(function(range3) {
                return session.addMarker(range3, markerType, "text");
              })
            };
            if (self2.getHighlightIndentGuides())
              self2.renderer.$textLayer.$highlightIndentGuide();
          }, 50);
        };
        Editor3.prototype.focus = function() {
          this.textInput.focus();
        };
        Editor3.prototype.isFocused = function() {
          return this.textInput.isFocused();
        };
        Editor3.prototype.blur = function() {
          this.textInput.blur();
        };
        Editor3.prototype.onFocus = function(e2) {
          if (this.$isFocused)
            return;
          this.$isFocused = true;
          this.renderer.showCursor();
          this.renderer.visualizeFocus();
          this._emit("focus", e2);
        };
        Editor3.prototype.onBlur = function(e2) {
          if (!this.$isFocused)
            return;
          this.$isFocused = false;
          this.renderer.hideCursor();
          this.renderer.visualizeBlur();
          this._emit("blur", e2);
        };
        Editor3.prototype.$cursorChange = function() {
          this.renderer.updateCursor();
          this.$highlightBrackets();
          this.$updateHighlightActiveLine();
        };
        Editor3.prototype.onDocumentChange = function(delta) {
          var wrap2 = this.session.$useWrapMode;
          var lastRow = delta.start.row == delta.end.row ? delta.end.row : Infinity;
          this.renderer.updateLines(delta.start.row, lastRow, wrap2);
          this._signal("change", delta);
          this.$cursorChange();
        };
        Editor3.prototype.onTokenizerUpdate = function(e2) {
          var rows = e2.data;
          this.renderer.updateLines(rows.first, rows.last);
        };
        Editor3.prototype.onScrollTopChange = function() {
          this.renderer.scrollToY(this.session.getScrollTop());
        };
        Editor3.prototype.onScrollLeftChange = function() {
          this.renderer.scrollToX(this.session.getScrollLeft());
        };
        Editor3.prototype.onCursorChange = function() {
          this.$cursorChange();
          this._signal("changeSelection");
        };
        Editor3.prototype.$updateHighlightActiveLine = function() {
          var session = this.getSession();
          var highlight;
          if (this.$highlightActiveLine) {
            if (this.$selectionStyle != "line" || !this.selection.isMultiLine())
              highlight = this.getCursorPosition();
            if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty())
              highlight = false;
            if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1))
              highlight = false;
          }
          if (session.$highlightLineMarker && !highlight) {
            session.removeMarker(session.$highlightLineMarker.id);
            session.$highlightLineMarker = null;
          } else if (!session.$highlightLineMarker && highlight) {
            var range3 = new Range(highlight.row, highlight.column, highlight.row, Infinity);
            range3.id = session.addMarker(range3, "ace_active-line", "screenLine");
            session.$highlightLineMarker = range3;
          } else if (highlight) {
            session.$highlightLineMarker.start.row = highlight.row;
            session.$highlightLineMarker.end.row = highlight.row;
            session.$highlightLineMarker.start.column = highlight.column;
            session._signal("changeBackMarker");
          }
        };
        Editor3.prototype.onSelectionChange = function(e2) {
          var session = this.session;
          if (session.$selectionMarker) {
            session.removeMarker(session.$selectionMarker);
          }
          session.$selectionMarker = null;
          if (!this.selection.isEmpty()) {
            var range3 = this.selection.getRange();
            var style2 = this.getSelectionStyle();
            session.$selectionMarker = session.addMarker(range3, "ace_selection", style2);
          } else {
            this.$updateHighlightActiveLine();
          }
          var re2 = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp();
          this.session.highlight(re2);
          this._signal("changeSelection");
        };
        Editor3.prototype.$getSelectionHighLightRegexp = function() {
          var session = this.session;
          var selection = this.getSelectionRange();
          if (selection.isEmpty() || selection.isMultiLine())
            return;
          var startColumn = selection.start.column;
          var endColumn = selection.end.column;
          var line2 = session.getLine(selection.start.row);
          var needle = line2.substring(startColumn, endColumn);
          if (needle.length > 5e3 || !/[\w\d]/.test(needle))
            return;
          var re2 = this.$search.$assembleRegExp({
            wholeWord: true,
            caseSensitive: true,
            needle
          });
          var wordWithBoundary = line2.substring(startColumn - 1, endColumn + 1);
          if (!re2.test(wordWithBoundary))
            return;
          return re2;
        };
        Editor3.prototype.onChangeFrontMarker = function() {
          this.renderer.updateFrontMarkers();
        };
        Editor3.prototype.onChangeBackMarker = function() {
          this.renderer.updateBackMarkers();
        };
        Editor3.prototype.onChangeBreakpoint = function() {
          this.renderer.updateBreakpoints();
        };
        Editor3.prototype.onChangeAnnotation = function() {
          this.renderer.setAnnotations(this.session.getAnnotations());
        };
        Editor3.prototype.onChangeMode = function(e2) {
          this.renderer.updateText();
          this._emit("changeMode", e2);
        };
        Editor3.prototype.onChangeWrapLimit = function() {
          this.renderer.updateFull();
        };
        Editor3.prototype.onChangeWrapMode = function() {
          this.renderer.onResize(true);
        };
        Editor3.prototype.onChangeFold = function() {
          this.$updateHighlightActiveLine();
          this.renderer.updateFull();
        };
        Editor3.prototype.getSelectedText = function() {
          return this.session.getTextRange(this.getSelectionRange());
        };
        Editor3.prototype.getCopyText = function() {
          var text2 = this.getSelectedText();
          var nl2 = this.session.doc.getNewLineCharacter();
          var copyLine = false;
          if (!text2 && this.$copyWithEmptySelection) {
            copyLine = true;
            var ranges = this.selection.getAllRanges();
            for (var i2 = 0; i2 < ranges.length; i2++) {
              var range3 = ranges[i2];
              if (i2 && ranges[i2 - 1].start.row == range3.start.row)
                continue;
              text2 += this.session.getLine(range3.start.row) + nl2;
            }
          }
          var e2 = { text: text2 };
          this._signal("copy", e2);
          clipboard.lineMode = copyLine ? e2.text : false;
          return e2.text;
        };
        Editor3.prototype.onCopy = function() {
          this.commands.exec("copy", this);
        };
        Editor3.prototype.onCut = function() {
          this.commands.exec("cut", this);
        };
        Editor3.prototype.onPaste = function(text2, event2) {
          var e2 = { text: text2, event: event2 };
          this.commands.exec("paste", this, e2);
        };
        Editor3.prototype.$handlePaste = function(e2) {
          if (typeof e2 == "string")
            e2 = { text: e2 };
          this._signal("paste", e2);
          var text2 = e2.text;
          var lineMode = text2 === clipboard.lineMode;
          var session = this.session;
          if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
            if (lineMode)
              session.insert({ row: this.selection.lead.row, column: 0 }, text2);
            else
              this.insert(text2);
          } else if (lineMode) {
            this.selection.rangeList.ranges.forEach(function(range4) {
              session.insert({ row: range4.start.row, column: 0 }, text2);
            });
          } else {
            var lines = text2.split(/\r\n|\r|\n/);
            var ranges = this.selection.rangeList.ranges;
            var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]);
            if (lines.length != ranges.length || isFullLine)
              return this.commands.exec("insertstring", this, text2);
            for (var i2 = ranges.length; i2--; ) {
              var range3 = ranges[i2];
              if (!range3.isEmpty())
                session.remove(range3);
              session.insert(range3.start, lines[i2]);
            }
          }
        };
        Editor3.prototype.execCommand = function(command, args) {
          return this.commands.exec(command, this, args);
        };
        Editor3.prototype.insert = function(text2, pasted) {
          var session = this.session;
          var mode = session.getMode();
          var cursor = this.getCursorPosition();
          if (this.getBehavioursEnabled() && !pasted) {
            var transform2 = mode.transformAction(session.getState(cursor.row), "insertion", this, session, text2);
            if (transform2) {
              if (text2 !== transform2.text) {
                if (!this.inVirtualSelectionMode) {
                  this.session.mergeUndoDeltas = false;
                  this.mergeNextCommand = false;
                }
              }
              text2 = transform2.text;
            }
          }
          if (text2 == "	")
            text2 = this.session.getTabString();
          if (!this.selection.isEmpty()) {
            var range3 = this.getSelectionRange();
            cursor = this.session.remove(range3);
            this.clearSelection();
          } else if (this.session.getOverwrite() && text2.indexOf("\n") == -1) {
            var range3 = Range.fromPoints(cursor, cursor);
            range3.end.column += text2.length;
            this.session.remove(range3);
          }
          if (text2 == "\n" || text2 == "\r\n") {
            var line2 = session.getLine(cursor.row);
            if (cursor.column > line2.search(/\S|$/)) {
              var d2 = line2.substr(cursor.column).search(/\S|$/);
              session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d2);
            }
          }
          this.clearSelection();
          var start = cursor.column;
          var lineState = session.getState(cursor.row);
          var line2 = session.getLine(cursor.row);
          var shouldOutdent = mode.checkOutdent(lineState, line2, text2);
          session.insert(cursor, text2);
          if (transform2 && transform2.selection) {
            if (transform2.selection.length == 2) {
              this.selection.setSelectionRange(new Range(cursor.row, start + transform2.selection[0], cursor.row, start + transform2.selection[1]));
            } else {
              this.selection.setSelectionRange(new Range(cursor.row + transform2.selection[0], transform2.selection[1], cursor.row + transform2.selection[2], transform2.selection[3]));
            }
          }
          if (this.$enableAutoIndent) {
            if (session.getDocument().isNewLine(text2)) {
              var lineIndent = mode.getNextLineIndent(lineState, line2.slice(0, cursor.column), session.getTabString());
              session.insert({ row: cursor.row + 1, column: 0 }, lineIndent);
            }
            if (shouldOutdent)
              mode.autoOutdent(lineState, session, cursor.row);
          }
        };
        Editor3.prototype.autoIndent = function() {
          var session = this.session;
          var mode = session.getMode();
          var ranges = this.selection.isEmpty() ? [new Range(0, 0, session.doc.getLength() - 1, 0)] : this.selection.getAllRanges();
          var prevLineState = "";
          var prevLine = "";
          var lineIndent = "";
          var tab2 = session.getTabString();
          for (var i2 = 0; i2 < ranges.length; i2++) {
            var startRow = ranges[i2].start.row;
            var endRow = ranges[i2].end.row;
            for (var row = startRow; row <= endRow; row++) {
              if (row > 0) {
                prevLineState = session.getState(row - 1);
                prevLine = session.getLine(row - 1);
                lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab2);
              }
              var line2 = session.getLine(row);
              var currIndent = mode.$getIndent(line2);
              if (lineIndent !== currIndent) {
                if (currIndent.length > 0) {
                  var range3 = new Range(row, 0, row, currIndent.length);
                  session.remove(range3);
                }
                if (lineIndent.length > 0) {
                  session.insert({ row, column: 0 }, lineIndent);
                }
              }
              mode.autoOutdent(prevLineState, session, row);
            }
          }
        };
        Editor3.prototype.onTextInput = function(text2, composition) {
          if (!composition)
            return this.keyBinding.onTextInput(text2);
          this.startOperation({ command: { name: "insertstring" } });
          var applyComposition = this.applyComposition.bind(this, text2, composition);
          if (this.selection.rangeCount)
            this.forEachSelection(applyComposition);
          else
            applyComposition();
          this.endOperation();
        };
        Editor3.prototype.applyComposition = function(text2, composition) {
          if (composition.extendLeft || composition.extendRight) {
            var r2 = this.selection.getRange();
            r2.start.column -= composition.extendLeft;
            r2.end.column += composition.extendRight;
            if (r2.start.column < 0) {
              r2.start.row--;
              r2.start.column += this.session.getLine(r2.start.row).length + 1;
            }
            this.selection.setRange(r2);
            if (!text2 && !r2.isEmpty())
              this.remove();
          }
          if (text2 || !this.selection.isEmpty())
            this.insert(text2, true);
          if (composition.restoreStart || composition.restoreEnd) {
            var r2 = this.selection.getRange();
            r2.start.column -= composition.restoreStart;
            r2.end.column -= composition.restoreEnd;
            this.selection.setRange(r2);
          }
        };
        Editor3.prototype.onCommandKey = function(e2, hashId, keyCode) {
          return this.keyBinding.onCommandKey(e2, hashId, keyCode);
        };
        Editor3.prototype.setOverwrite = function(overwrite) {
          this.session.setOverwrite(overwrite);
        };
        Editor3.prototype.getOverwrite = function() {
          return this.session.getOverwrite();
        };
        Editor3.prototype.toggleOverwrite = function() {
          this.session.toggleOverwrite();
        };
        Editor3.prototype.setScrollSpeed = function(speed) {
          this.setOption("scrollSpeed", speed);
        };
        Editor3.prototype.getScrollSpeed = function() {
          return this.getOption("scrollSpeed");
        };
        Editor3.prototype.setDragDelay = function(dragDelay) {
          this.setOption("dragDelay", dragDelay);
        };
        Editor3.prototype.getDragDelay = function() {
          return this.getOption("dragDelay");
        };
        Editor3.prototype.setSelectionStyle = function(val) {
          this.setOption("selectionStyle", val);
        };
        Editor3.prototype.getSelectionStyle = function() {
          return this.getOption("selectionStyle");
        };
        Editor3.prototype.setHighlightActiveLine = function(shouldHighlight) {
          this.setOption("highlightActiveLine", shouldHighlight);
        };
        Editor3.prototype.getHighlightActiveLine = function() {
          return this.getOption("highlightActiveLine");
        };
        Editor3.prototype.setHighlightGutterLine = function(shouldHighlight) {
          this.setOption("highlightGutterLine", shouldHighlight);
        };
        Editor3.prototype.getHighlightGutterLine = function() {
          return this.getOption("highlightGutterLine");
        };
        Editor3.prototype.setHighlightSelectedWord = function(shouldHighlight) {
          this.setOption("highlightSelectedWord", shouldHighlight);
        };
        Editor3.prototype.getHighlightSelectedWord = function() {
          return this.$highlightSelectedWord;
        };
        Editor3.prototype.setAnimatedScroll = function(shouldAnimate) {
          this.renderer.setAnimatedScroll(shouldAnimate);
        };
        Editor3.prototype.getAnimatedScroll = function() {
          return this.renderer.getAnimatedScroll();
        };
        Editor3.prototype.setShowInvisibles = function(showInvisibles) {
          this.renderer.setShowInvisibles(showInvisibles);
        };
        Editor3.prototype.getShowInvisibles = function() {
          return this.renderer.getShowInvisibles();
        };
        Editor3.prototype.setDisplayIndentGuides = function(display) {
          this.renderer.setDisplayIndentGuides(display);
        };
        Editor3.prototype.getDisplayIndentGuides = function() {
          return this.renderer.getDisplayIndentGuides();
        };
        Editor3.prototype.setHighlightIndentGuides = function(highlight) {
          this.renderer.setHighlightIndentGuides(highlight);
        };
        Editor3.prototype.getHighlightIndentGuides = function() {
          return this.renderer.getHighlightIndentGuides();
        };
        Editor3.prototype.setShowPrintMargin = function(showPrintMargin) {
          this.renderer.setShowPrintMargin(showPrintMargin);
        };
        Editor3.prototype.getShowPrintMargin = function() {
          return this.renderer.getShowPrintMargin();
        };
        Editor3.prototype.setPrintMarginColumn = function(showPrintMargin) {
          this.renderer.setPrintMarginColumn(showPrintMargin);
        };
        Editor3.prototype.getPrintMarginColumn = function() {
          return this.renderer.getPrintMarginColumn();
        };
        Editor3.prototype.setReadOnly = function(readOnly) {
          this.setOption("readOnly", readOnly);
        };
        Editor3.prototype.getReadOnly = function() {
          return this.getOption("readOnly");
        };
        Editor3.prototype.setBehavioursEnabled = function(enabled) {
          this.setOption("behavioursEnabled", enabled);
        };
        Editor3.prototype.getBehavioursEnabled = function() {
          return this.getOption("behavioursEnabled");
        };
        Editor3.prototype.setWrapBehavioursEnabled = function(enabled) {
          this.setOption("wrapBehavioursEnabled", enabled);
        };
        Editor3.prototype.getWrapBehavioursEnabled = function() {
          return this.getOption("wrapBehavioursEnabled");
        };
        Editor3.prototype.setShowFoldWidgets = function(show) {
          this.setOption("showFoldWidgets", show);
        };
        Editor3.prototype.getShowFoldWidgets = function() {
          return this.getOption("showFoldWidgets");
        };
        Editor3.prototype.setFadeFoldWidgets = function(fade) {
          this.setOption("fadeFoldWidgets", fade);
        };
        Editor3.prototype.getFadeFoldWidgets = function() {
          return this.getOption("fadeFoldWidgets");
        };
        Editor3.prototype.remove = function(dir) {
          if (this.selection.isEmpty()) {
            if (dir == "left")
              this.selection.selectLeft();
            else
              this.selection.selectRight();
          }
          var range3 = this.getSelectionRange();
          if (this.getBehavioursEnabled()) {
            var session = this.session;
            var state = session.getState(range3.start.row);
            var new_range = session.getMode().transformAction(state, "deletion", this, session, range3);
            if (range3.end.column === 0) {
              var text2 = session.getTextRange(range3);
              if (text2[text2.length - 1] == "\n") {
                var line2 = session.getLine(range3.end.row);
                if (/^\s+$/.test(line2)) {
                  range3.end.column = line2.length;
                }
              }
            }
            if (new_range)
              range3 = new_range;
          }
          this.session.remove(range3);
          this.clearSelection();
        };
        Editor3.prototype.removeWordRight = function() {
          if (this.selection.isEmpty())
            this.selection.selectWordRight();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeWordLeft = function() {
          if (this.selection.isEmpty())
            this.selection.selectWordLeft();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeToLineStart = function() {
          if (this.selection.isEmpty())
            this.selection.selectLineStart();
          if (this.selection.isEmpty())
            this.selection.selectLeft();
          this.session.remove(this.getSelectionRange());
          this.clearSelection();
        };
        Editor3.prototype.removeToLineEnd = function() {
          if (this.selection.isEmpty())
            this.selection.selectLineEnd();
          var range3 = this.getSelectionRange();
          if (range3.start.column == range3.end.column && range3.start.row == range3.end.row) {
            range3.end.column = 0;
            range3.end.row++;
          }
          this.session.remove(range3);
          this.clearSelection();
        };
        Editor3.prototype.splitLine = function() {
          if (!this.selection.isEmpty()) {
            this.session.remove(this.getSelectionRange());
            this.clearSelection();
          }
          var cursor = this.getCursorPosition();
          this.insert("\n");
          this.moveCursorToPosition(cursor);
        };
        Editor3.prototype.setGhostText = function(text2, position2) {
          this.renderer.setGhostText(text2, position2);
        };
        Editor3.prototype.removeGhostText = function() {
          this.renderer.removeGhostText();
        };
        Editor3.prototype.transposeLetters = function() {
          if (!this.selection.isEmpty()) {
            return;
          }
          var cursor = this.getCursorPosition();
          var column2 = cursor.column;
          if (column2 === 0)
            return;
          var line2 = this.session.getLine(cursor.row);
          var swap2, range3;
          if (column2 < line2.length) {
            swap2 = line2.charAt(column2) + line2.charAt(column2 - 1);
            range3 = new Range(cursor.row, column2 - 1, cursor.row, column2 + 1);
          } else {
            swap2 = line2.charAt(column2 - 1) + line2.charAt(column2 - 2);
            range3 = new Range(cursor.row, column2 - 2, cursor.row, column2);
          }
          this.session.replace(range3, swap2);
          this.session.selection.moveToPosition(range3.end);
        };
        Editor3.prototype.toLowerCase = function() {
          var originalRange = this.getSelectionRange();
          if (this.selection.isEmpty()) {
            this.selection.selectWord();
          }
          var range3 = this.getSelectionRange();
          var text2 = this.session.getTextRange(range3);
          this.session.replace(range3, text2.toLowerCase());
          this.selection.setSelectionRange(originalRange);
        };
        Editor3.prototype.toUpperCase = function() {
          var originalRange = this.getSelectionRange();
          if (this.selection.isEmpty()) {
            this.selection.selectWord();
          }
          var range3 = this.getSelectionRange();
          var text2 = this.session.getTextRange(range3);
          this.session.replace(range3, text2.toUpperCase());
          this.selection.setSelectionRange(originalRange);
        };
        Editor3.prototype.indent = function() {
          var session = this.session;
          var range3 = this.getSelectionRange();
          if (range3.start.row < range3.end.row) {
            var rows = this.$getSelectedRows();
            session.indentRows(rows.first, rows.last, "	");
            return;
          } else if (range3.start.column < range3.end.column) {
            var text2 = session.getTextRange(range3);
            if (!/^\s+$/.test(text2)) {
              var rows = this.$getSelectedRows();
              session.indentRows(rows.first, rows.last, "	");
              return;
            }
          }
          var line2 = session.getLine(range3.start.row);
          var position2 = range3.start;
          var size2 = session.getTabSize();
          var column2 = session.documentToScreenColumn(position2.row, position2.column);
          if (this.session.getUseSoftTabs()) {
            var count = size2 - column2 % size2;
            var indentString = lang2.stringRepeat(" ", count);
          } else {
            var count = column2 % size2;
            while (line2[range3.start.column - 1] == " " && count) {
              range3.start.column--;
              count--;
            }
            this.selection.setSelectionRange(range3);
            indentString = "	";
          }
          return this.insert(indentString);
        };
        Editor3.prototype.blockIndent = function() {
          var rows = this.$getSelectedRows();
          this.session.indentRows(rows.first, rows.last, "	");
        };
        Editor3.prototype.blockOutdent = function() {
          var selection = this.session.getSelection();
          this.session.outdentRows(selection.getRange());
        };
        Editor3.prototype.sortLines = function() {
          var rows = this.$getSelectedRows();
          var session = this.session;
          var lines = [];
          for (var i2 = rows.first; i2 <= rows.last; i2++)
            lines.push(session.getLine(i2));
          lines.sort(function(a2, b2) {
            if (a2.toLowerCase() < b2.toLowerCase())
              return -1;
            if (a2.toLowerCase() > b2.toLowerCase())
              return 1;
            return 0;
          });
          var deleteRange = new Range(0, 0, 0, 0);
          for (var i2 = rows.first; i2 <= rows.last; i2++) {
            var line2 = session.getLine(i2);
            deleteRange.start.row = i2;
            deleteRange.end.row = i2;
            deleteRange.end.column = line2.length;
            session.replace(deleteRange, lines[i2 - rows.first]);
          }
        };
        Editor3.prototype.toggleCommentLines = function() {
          var state = this.session.getState(this.getCursorPosition().row);
          var rows = this.$getSelectedRows();
          this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
        };
        Editor3.prototype.toggleBlockComment = function() {
          var cursor = this.getCursorPosition();
          var state = this.session.getState(cursor.row);
          var range3 = this.getSelectionRange();
          this.session.getMode().toggleBlockComment(state, this.session, range3, cursor);
        };
        Editor3.prototype.getNumberAt = function(row, column2) {
          var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g;
          _numberRx.lastIndex = 0;
          var s2 = this.session.getLine(row);
          while (_numberRx.lastIndex < column2) {
            var m2 = _numberRx.exec(s2);
            if (m2.index <= column2 && m2.index + m2[0].length >= column2) {
              var number4 = {
                value: m2[0],
                start: m2.index,
                end: m2.index + m2[0].length
              };
              return number4;
            }
          }
          return null;
        };
        Editor3.prototype.modifyNumber = function(amount) {
          var row = this.selection.getCursor().row;
          var column2 = this.selection.getCursor().column;
          var charRange = new Range(row, column2 - 1, row, column2);
          var c2 = this.session.getTextRange(charRange);
          if (!isNaN(parseFloat(c2)) && isFinite(c2)) {
            var nr = this.getNumberAt(row, column2);
            if (nr) {
              var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
              var decimals = nr.start + nr.value.length - fp;
              var t2 = parseFloat(nr.value);
              t2 *= Math.pow(10, decimals);
              if (fp !== nr.end && column2 < fp) {
                amount *= Math.pow(10, nr.end - column2 - 1);
              } else {
                amount *= Math.pow(10, nr.end - column2);
              }
              t2 += amount;
              t2 /= Math.pow(10, decimals);
              var nnr = t2.toFixed(decimals);
              var replaceRange = new Range(row, nr.start, row, nr.end);
              this.session.replace(replaceRange, nnr);
              this.moveCursorTo(row, Math.max(nr.start + 1, column2 + nnr.length - nr.value.length));
            }
          } else {
            this.toggleWord();
          }
        };
        Editor3.prototype.toggleWord = function() {
          var row = this.selection.getCursor().row;
          var column2 = this.selection.getCursor().column;
          this.selection.selectWord();
          var currentState = this.getSelectedText();
          var currWordStart = this.selection.getWordRange().start.column;
          var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, "$1 ").split(/\s/);
          var delta = column2 - currWordStart - 1;
          if (delta < 0)
            delta = 0;
          var curLength = 0, itLength = 0;
          var that = this;
          if (currentState.match(/[A-Za-z0-9_]+/)) {
            wordParts.forEach(function(item2, i3) {
              itLength = curLength + item2.length;
              if (delta >= curLength && delta <= itLength) {
                currentState = item2;
                that.selection.clearSelection();
                that.moveCursorTo(row, curLength + currWordStart);
                that.selection.selectTo(row, itLength + currWordStart);
              }
              curLength = itLength;
            });
          }
          var wordPairs = this.$toggleWordPairs;
          var reg;
          for (var i2 = 0; i2 < wordPairs.length; i2++) {
            var item = wordPairs[i2];
            for (var j2 = 0; j2 <= 1; j2++) {
              var negate = +!j2;
              var firstCondition = currentState.match(new RegExp("^\\s?_?(" + lang2.escapeRegExp(item[j2]) + ")\\s?$", "i"));
              if (firstCondition) {
                var secondCondition = currentState.match(new RegExp("([_]|^|\\s)(" + lang2.escapeRegExp(firstCondition[1]) + ")($|\\s)", "g"));
                if (secondCondition) {
                  reg = currentState.replace(new RegExp(lang2.escapeRegExp(item[j2]), "i"), function(result) {
                    var res = item[negate];
                    if (result.toUpperCase() == result) {
                      res = res.toUpperCase();
                    } else if (result.charAt(0).toUpperCase() == result.charAt(0)) {
                      res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1);
                    }
                    return res;
                  });
                  this.insert(reg);
                  reg = "";
                }
              }
            }
          }
        };
        Editor3.prototype.findLinkAt = function(row, column2) {
          var e_1, _a2;
          var line2 = this.session.getLine(row);
          var wordParts = line2.split(/((?:https?|ftp):\/\/[\S]+)/);
          var columnPosition = column2;
          if (columnPosition < 0)
            columnPosition = 0;
          var previousPosition = 0, currentPosition = 0, match5;
          try {
            for (var wordParts_1 = __values(wordParts), wordParts_1_1 = wordParts_1.next(); !wordParts_1_1.done; wordParts_1_1 = wordParts_1.next()) {
              var item = wordParts_1_1.value;
              currentPosition = previousPosition + item.length;
              if (columnPosition >= previousPosition && columnPosition <= currentPosition) {
                if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) {
                  match5 = item.replace(/[\s:.,'";}\]]+$/, "");
                  break;
                }
              }
              previousPosition = currentPosition;
            }
          } catch (e_1_1) {
            e_1 = { error: e_1_1 };
          } finally {
            try {
              if (wordParts_1_1 && !wordParts_1_1.done && (_a2 = wordParts_1.return))
                _a2.call(wordParts_1);
            } finally {
              if (e_1)
                throw e_1.error;
            }
          }
          return match5;
        };
        Editor3.prototype.openLink = function() {
          var cursor = this.selection.getCursor();
          var url2 = this.findLinkAt(cursor.row, cursor.column);
          if (url2)
            window.open(url2, "_blank");
          return url2 != null;
        };
        Editor3.prototype.removeLines = function() {
          var rows = this.$getSelectedRows();
          this.session.removeFullLines(rows.first, rows.last);
          this.clearSelection();
        };
        Editor3.prototype.duplicateSelection = function() {
          var sel = this.selection;
          var doc = this.session;
          var range3 = sel.getRange();
          var reverse = sel.isBackwards();
          if (range3.isEmpty()) {
            var row = range3.start.row;
            doc.duplicateLines(row, row);
          } else {
            var point2 = reverse ? range3.start : range3.end;
            var endPoint = doc.insert(point2, doc.getTextRange(range3));
            range3.start = point2;
            range3.end = endPoint;
            sel.setSelectionRange(range3, reverse);
          }
        };
        Editor3.prototype.moveLinesDown = function() {
          this.$moveLines(1, false);
        };
        Editor3.prototype.moveLinesUp = function() {
          this.$moveLines(-1, false);
        };
        Editor3.prototype.moveText = function(range3, toPosition, copy2) {
          return this.session.moveText(range3, toPosition, copy2);
        };
        Editor3.prototype.copyLinesUp = function() {
          this.$moveLines(-1, true);
        };
        Editor3.prototype.copyLinesDown = function() {
          this.$moveLines(1, true);
        };
        Editor3.prototype.$moveLines = function(dir, copy2) {
          var rows, moved;
          var selection = this.selection;
          if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
            var range3 = selection.toOrientedRange();
            rows = this.$getSelectedRows(range3);
            moved = this.session.$moveLines(rows.first, rows.last, copy2 ? 0 : dir);
            if (copy2 && dir == -1)
              moved = 0;
            range3.moveBy(moved, 0);
            selection.fromOrientedRange(range3);
          } else {
            var ranges = selection.rangeList.ranges;
            selection.rangeList.detach(this.session);
            this.inVirtualSelectionMode = true;
            var diff2 = 0;
            var totalDiff = 0;
            var l2 = ranges.length;
            for (var i2 = 0; i2 < l2; i2++) {
              var rangeIndex = i2;
              ranges[i2].moveBy(diff2, 0);
              rows = this.$getSelectedRows(ranges[i2]);
              var first = rows.first;
              var last = rows.last;
              while (++i2 < l2) {
                if (totalDiff)
                  ranges[i2].moveBy(totalDiff, 0);
                var subRows = this.$getSelectedRows(ranges[i2]);
                if (copy2 && subRows.first != last)
                  break;
                else if (!copy2 && subRows.first > last + 1)
                  break;
                last = subRows.last;
              }
              i2--;
              diff2 = this.session.$moveLines(first, last, copy2 ? 0 : dir);
              if (copy2 && dir == -1)
                rangeIndex = i2 + 1;
              while (rangeIndex <= i2) {
                ranges[rangeIndex].moveBy(diff2, 0);
                rangeIndex++;
              }
              if (!copy2)
                diff2 = 0;
              totalDiff += diff2;
            }
            selection.fromOrientedRange(selection.ranges[0]);
            selection.rangeList.attach(this.session);
            this.inVirtualSelectionMode = false;
          }
        };
        Editor3.prototype.$getSelectedRows = function(range3) {
          range3 = (range3 || this.getSelectionRange()).collapseRows();
          return {
            first: this.session.getRowFoldStart(range3.start.row),
            last: this.session.getRowFoldEnd(range3.end.row)
          };
        };
        Editor3.prototype.onCompositionStart = function(compositionState) {
          this.renderer.showComposition(compositionState);
        };
        Editor3.prototype.onCompositionUpdate = function(text2) {
          this.renderer.setCompositionText(text2);
        };
        Editor3.prototype.onCompositionEnd = function() {
          this.renderer.hideComposition();
        };
        Editor3.prototype.getFirstVisibleRow = function() {
          return this.renderer.getFirstVisibleRow();
        };
        Editor3.prototype.getLastVisibleRow = function() {
          return this.renderer.getLastVisibleRow();
        };
        Editor3.prototype.isRowVisible = function(row) {
          return row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow();
        };
        Editor3.prototype.isRowFullyVisible = function(row) {
          return row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow();
        };
        Editor3.prototype.$getVisibleRowCount = function() {
          return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
        };
        Editor3.prototype.$moveByPage = function(dir, select2) {
          var renderer = this.renderer;
          var config3 = this.renderer.layerConfig;
          var rows = dir * Math.floor(config3.height / config3.lineHeight);
          if (select2 === true) {
            this.selection.$moveSelection(function() {
              this.moveCursorBy(rows, 0);
            });
          } else if (select2 === false) {
            this.selection.moveCursorBy(rows, 0);
            this.selection.clearSelection();
          }
          var scrollTop = renderer.scrollTop;
          renderer.scrollBy(0, rows * config3.lineHeight);
          if (select2 != null)
            renderer.scrollCursorIntoView(null, 0.5);
          renderer.animateScrolling(scrollTop);
        };
        Editor3.prototype.selectPageDown = function() {
          this.$moveByPage(1, true);
        };
        Editor3.prototype.selectPageUp = function() {
          this.$moveByPage(-1, true);
        };
        Editor3.prototype.gotoPageDown = function() {
          this.$moveByPage(1, false);
        };
        Editor3.prototype.gotoPageUp = function() {
          this.$moveByPage(-1, false);
        };
        Editor3.prototype.scrollPageDown = function() {
          this.$moveByPage(1);
        };
        Editor3.prototype.scrollPageUp = function() {
          this.$moveByPage(-1);
        };
        Editor3.prototype.scrollToRow = function(row) {
          this.renderer.scrollToRow(row);
        };
        Editor3.prototype.scrollToLine = function(line2, center, animate, callback2) {
          this.renderer.scrollToLine(line2, center, animate, callback2);
        };
        Editor3.prototype.centerSelection = function() {
          var range3 = this.getSelectionRange();
          var pos = {
            row: Math.floor(range3.start.row + (range3.end.row - range3.start.row) / 2),
            column: Math.floor(range3.start.column + (range3.end.column - range3.start.column) / 2)
          };
          this.renderer.alignCursor(pos, 0.5);
        };
        Editor3.prototype.getCursorPosition = function() {
          return this.selection.getCursor();
        };
        Editor3.prototype.getCursorPositionScreen = function() {
          return this.session.documentToScreenPosition(this.getCursorPosition());
        };
        Editor3.prototype.getSelectionRange = function() {
          return this.selection.getRange();
        };
        Editor3.prototype.selectAll = function() {
          this.selection.selectAll();
        };
        Editor3.prototype.clearSelection = function() {
          this.selection.clearSelection();
        };
        Editor3.prototype.moveCursorTo = function(row, column2) {
          this.selection.moveCursorTo(row, column2);
        };
        Editor3.prototype.moveCursorToPosition = function(pos) {
          this.selection.moveCursorToPosition(pos);
        };
        Editor3.prototype.jumpToMatching = function(select2, expand) {
          var cursor = this.getCursorPosition();
          var iterator2 = new TokenIterator(this.session, cursor.row, cursor.column);
          var prevToken = iterator2.getCurrentToken();
          var tokenCount = 0;
          if (prevToken && prevToken.type.indexOf("tag-name") !== -1) {
            prevToken = iterator2.stepBackward();
          }
          var token2 = prevToken || iterator2.stepForward();
          if (!token2)
            return;
          var matchType;
          var found = false;
          var depth = {};
          var i2 = cursor.column - token2.start;
          var bracketType;
          var brackets = {
            ")": "(",
            "(": "(",
            "]": "[",
            "[": "[",
            "{": "{",
            "}": "{"
          };
          do {
            if (token2.value.match(/[{}()\[\]]/g)) {
              for (; i2 < token2.value.length && !found; i2++) {
                if (!brackets[token2.value[i2]]) {
                  continue;
                }
                bracketType = brackets[token2.value[i2]] + "." + token2.type.replace("rparen", "lparen");
                if (isNaN(depth[bracketType])) {
                  depth[bracketType] = 0;
                }
                switch (token2.value[i2]) {
                  case "(":
                  case "[":
                  case "{":
                    depth[bracketType]++;
                    break;
                  case ")":
                  case "]":
                  case "}":
                    depth[bracketType]--;
                    if (depth[bracketType] === -1) {
                      matchType = "bracket";
                      found = true;
                    }
                    break;
                }
              }
            } else if (token2.type.indexOf("tag-name") !== -1) {
              if (isNaN(depth[token2.value])) {
                depth[token2.value] = 0;
              }
              if (prevToken.value === "<" && tokenCount > 1) {
                depth[token2.value]++;
              } else if (prevToken.value === "</") {
                depth[token2.value]--;
              }
              if (depth[token2.value] === -1) {
                matchType = "tag";
                found = true;
              }
            }
            if (!found) {
              prevToken = token2;
              tokenCount++;
              token2 = iterator2.stepForward();
              i2 = 0;
            }
          } while (token2 && !found);
          if (!matchType)
            return;
          var range3, pos;
          if (matchType === "bracket") {
            range3 = this.session.getBracketRange(cursor);
            if (!range3) {
              range3 = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + i2 - 1, iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() + i2 - 1);
              pos = range3.start;
              if (expand || pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
                range3 = this.session.getBracketRange(pos);
            }
          } else if (matchType === "tag") {
            if (!token2 || token2.type.indexOf("tag-name") === -1)
              return;
            range3 = new Range(iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() - 2, iterator2.getCurrentTokenRow(), iterator2.getCurrentTokenColumn() - 2);
            if (range3.compare(cursor.row, cursor.column) === 0) {
              var tagsRanges = this.session.getMatchingTags(cursor);
              if (tagsRanges) {
                if (tagsRanges.openTag.contains(cursor.row, cursor.column)) {
                  range3 = tagsRanges.closeTag;
                  pos = range3.start;
                } else {
                  range3 = tagsRanges.openTag;
                  if (tagsRanges.closeTag.start.row === cursor.row && tagsRanges.closeTag.start.column === cursor.column)
                    pos = range3.end;
                  else
                    pos = range3.start;
                }
              }
            }
            pos = pos || range3.start;
          }
          pos = range3 && range3.cursor || pos;
          if (pos) {
            if (select2) {
              if (range3 && expand) {
                this.selection.setRange(range3);
              } else if (range3 && range3.isEqual(this.getSelectionRange())) {
                this.clearSelection();
              } else {
                this.selection.selectTo(pos.row, pos.column);
              }
            } else {
              this.selection.moveTo(pos.row, pos.column);
            }
          }
        };
        Editor3.prototype.gotoLine = function(lineNumber, column2, animate) {
          this.selection.clearSelection();
          this.session.unfold({ row: lineNumber - 1, column: column2 || 0 });
          this.exitMultiSelectMode && this.exitMultiSelectMode();
          this.moveCursorTo(lineNumber - 1, column2 || 0);
          if (!this.isRowFullyVisible(lineNumber - 1))
            this.scrollToLine(lineNumber - 1, true, animate);
        };
        Editor3.prototype.navigateTo = function(row, column2) {
          this.selection.moveTo(row, column2);
        };
        Editor3.prototype.navigateUp = function(times) {
          if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
            var selectionStart = this.selection.anchor.getPosition();
            return this.moveCursorToPosition(selectionStart);
          }
          this.selection.clearSelection();
          this.selection.moveCursorBy(-times || -1, 0);
        };
        Editor3.prototype.navigateDown = function(times) {
          if (this.selection.isMultiLine() && this.selection.isBackwards()) {
            var selectionEnd = this.selection.anchor.getPosition();
            return this.moveCursorToPosition(selectionEnd);
          }
          this.selection.clearSelection();
          this.selection.moveCursorBy(times || 1, 0);
        };
        Editor3.prototype.navigateLeft = function(times) {
          if (!this.selection.isEmpty()) {
            var selectionStart = this.getSelectionRange().start;
            this.moveCursorToPosition(selectionStart);
          } else {
            times = times || 1;
            while (times--) {
              this.selection.moveCursorLeft();
            }
          }
          this.clearSelection();
        };
        Editor3.prototype.navigateRight = function(times) {
          if (!this.selection.isEmpty()) {
            var selectionEnd = this.getSelectionRange().end;
            this.moveCursorToPosition(selectionEnd);
          } else {
            times = times || 1;
            while (times--) {
              this.selection.moveCursorRight();
            }
          }
          this.clearSelection();
        };
        Editor3.prototype.navigateLineStart = function() {
          this.selection.moveCursorLineStart();
          this.clearSelection();
        };
        Editor3.prototype.navigateLineEnd = function() {
          this.selection.moveCursorLineEnd();
          this.clearSelection();
        };
        Editor3.prototype.navigateFileEnd = function() {
          this.selection.moveCursorFileEnd();
          this.clearSelection();
        };
        Editor3.prototype.navigateFileStart = function() {
          this.selection.moveCursorFileStart();
          this.clearSelection();
        };
        Editor3.prototype.navigateWordRight = function() {
          this.selection.moveCursorWordRight();
          this.clearSelection();
        };
        Editor3.prototype.navigateWordLeft = function() {
          this.selection.moveCursorWordLeft();
          this.clearSelection();
        };
        Editor3.prototype.replace = function(replacement, options) {
          if (options)
            this.$search.set(options);
          var range3 = this.$search.find(this.session);
          var replaced = 0;
          if (!range3)
            return replaced;
          if (this.$tryReplace(range3, replacement)) {
            replaced = 1;
          }
          this.selection.setSelectionRange(range3);
          this.renderer.scrollSelectionIntoView(range3.start, range3.end);
          return replaced;
        };
        Editor3.prototype.replaceAll = function(replacement, options) {
          if (options) {
            this.$search.set(options);
          }
          var ranges = this.$search.findAll(this.session);
          var replaced = 0;
          if (!ranges.length)
            return replaced;
          var selection = this.getSelectionRange();
          this.selection.moveTo(0, 0);
          for (var i2 = ranges.length - 1; i2 >= 0; --i2) {
            if (this.$tryReplace(ranges[i2], replacement)) {
              replaced++;
            }
          }
          this.selection.setSelectionRange(selection);
          return replaced;
        };
        Editor3.prototype.$tryReplace = function(range3, replacement) {
          var input2 = this.session.getTextRange(range3);
          replacement = this.$search.replace(input2, replacement);
          if (replacement !== null) {
            range3.end = this.session.replace(range3, replacement);
            return range3;
          } else {
            return null;
          }
        };
        Editor3.prototype.getLastSearchOptions = function() {
          return this.$search.getOptions();
        };
        Editor3.prototype.find = function(needle, options, animate) {
          if (!options)
            options = {};
          if (typeof needle == "string" || needle instanceof RegExp)
            options.needle = needle;
          else if (typeof needle == "object")
            oop.mixin(options, needle);
          var range3 = this.selection.getRange();
          if (options.needle == null) {
            needle = this.session.getTextRange(range3) || this.$search.$options.needle;
            if (!needle) {
              range3 = this.session.getWordRange(range3.start.row, range3.start.column);
              needle = this.session.getTextRange(range3);
            }
            this.$search.set({ needle });
          }
          this.$search.set(options);
          if (!options.start)
            this.$search.set({ start: range3 });
          var newRange = this.$search.find(this.session);
          if (options.preventScroll)
            return newRange;
          if (newRange) {
            this.revealRange(newRange, animate);
            return newRange;
          }
          if (options.backwards)
            range3.start = range3.end;
          else
            range3.end = range3.start;
          this.selection.setRange(range3);
        };
        Editor3.prototype.findNext = function(options, animate) {
          this.find({ skipCurrent: true, backwards: false }, options, animate);
        };
        Editor3.prototype.findPrevious = function(options, animate) {
          this.find(options, { skipCurrent: true, backwards: true }, animate);
        };
        Editor3.prototype.revealRange = function(range3, animate) {
          this.session.unfold(range3);
          this.selection.setSelectionRange(range3);
          var scrollTop = this.renderer.scrollTop;
          this.renderer.scrollSelectionIntoView(range3.start, range3.end, 0.5);
          if (animate !== false)
            this.renderer.animateScrolling(scrollTop);
        };
        Editor3.prototype.undo = function() {
          this.session.getUndoManager().undo(this.session);
          this.renderer.scrollCursorIntoView(null, 0.5);
        };
        Editor3.prototype.redo = function() {
          this.session.getUndoManager().redo(this.session);
          this.renderer.scrollCursorIntoView(null, 0.5);
        };
        Editor3.prototype.destroy = function() {
          this.destroyed = true;
          if (this.$toDestroy) {
            this.$toDestroy.forEach(function(el2) {
              el2.destroy();
            });
            this.$toDestroy = [];
          }
          if (this.$mouseHandler)
            this.$mouseHandler.destroy();
          this.renderer.destroy();
          this._signal("destroy", this);
          if (this.session)
            this.session.destroy();
          if (this._$emitInputEvent)
            this._$emitInputEvent.cancel();
          this.removeAllListeners();
        };
        Editor3.prototype.setAutoScrollEditorIntoView = function(enable) {
          if (!enable)
            return;
          var rect;
          var self2 = this;
          var shouldScroll = false;
          if (!this.$scrollAnchor)
            this.$scrollAnchor = document.createElement("div");
          var scrollAnchor = this.$scrollAnchor;
          scrollAnchor.style.cssText = "position:absolute";
          this.container.insertBefore(scrollAnchor, this.container.firstChild);
          var onChangeSelection = this.on("changeSelection", function() {
            shouldScroll = true;
          });
          var onBeforeRender = this.renderer.on("beforeRender", function() {
            if (shouldScroll)
              rect = self2.renderer.container.getBoundingClientRect();
          });
          var onAfterRender = this.renderer.on("afterRender", function() {
            if (shouldScroll && rect && (self2.isFocused() || self2.searchBox && self2.searchBox.isFocused())) {
              var renderer = self2.renderer;
              var pos = renderer.$cursorLayer.$pixelPos;
              var config3 = renderer.layerConfig;
              var top2 = pos.top - config3.offset;
              if (pos.top >= 0 && top2 + rect.top < 0) {
                shouldScroll = true;
              } else if (pos.top < config3.height && pos.top + rect.top + config3.lineHeight > window.innerHeight) {
                shouldScroll = false;
              } else {
                shouldScroll = null;
              }
              if (shouldScroll != null) {
                scrollAnchor.style.top = top2 + "px";
                scrollAnchor.style.left = pos.left + "px";
                scrollAnchor.style.height = config3.lineHeight + "px";
                scrollAnchor.scrollIntoView(shouldScroll);
              }
              shouldScroll = rect = null;
            }
          });
          this.setAutoScrollEditorIntoView = function(enable2) {
            if (enable2)
              return;
            delete this.setAutoScrollEditorIntoView;
            this.off("changeSelection", onChangeSelection);
            this.renderer.off("afterRender", onAfterRender);
            this.renderer.off("beforeRender", onBeforeRender);
          };
        };
        Editor3.prototype.$resetCursorStyle = function() {
          var style2 = this.$cursorStyle || "ace";
          var cursorLayer = this.renderer.$cursorLayer;
          if (!cursorLayer)
            return;
          cursorLayer.setSmoothBlinking(/smooth/.test(style2));
          cursorLayer.isBlinking = !this.$readOnly && style2 != "wide";
          dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style2));
        };
        Editor3.prototype.prompt = function(message, options, callback2) {
          var editor = this;
          config2.loadModule("ace/ext/prompt", function(module4) {
            module4.prompt(editor, message, options, callback2);
          });
        };
        return Editor3;
      }()
    );
    Editor2.$uid = 0;
    Editor2.prototype.curOp = null;
    Editor2.prototype.prevOp = {};
    Editor2.prototype.$mergeableCommands = ["backspace", "del", "insertstring"];
    Editor2.prototype.$toggleWordPairs = [
      ["first", "last"],
      ["true", "false"],
      ["yes", "no"],
      ["width", "height"],
      ["top", "bottom"],
      ["right", "left"],
      ["on", "off"],
      ["x", "y"],
      ["get", "set"],
      ["max", "min"],
      ["horizontal", "vertical"],
      ["show", "hide"],
      ["add", "remove"],
      ["up", "down"],
      ["before", "after"],
      ["even", "odd"],
      ["in", "out"],
      ["inside", "outside"],
      ["next", "previous"],
      ["increase", "decrease"],
      ["attach", "detach"],
      ["&&", "||"],
      ["==", "!="]
    ];
    oop.implement(Editor2.prototype, EventEmitter2);
    config2.defineOptions(Editor2.prototype, "editor", {
      selectionStyle: {
        set: function(style2) {
          this.onSelectionChange();
          this._signal("changeSelectionStyle", { data: style2 });
        },
        initialValue: "line"
      },
      highlightActiveLine: {
        set: function() {
          this.$updateHighlightActiveLine();
        },
        initialValue: true
      },
      highlightSelectedWord: {
        set: function(shouldHighlight) {
          this.$onSelectionChange();
        },
        initialValue: true
      },
      readOnly: {
        set: function(readOnly) {
          var _this = this;
          this.textInput.setReadOnly(readOnly);
          if (this.destroyed)
            return;
          this.$resetCursorStyle();
          if (!this.$readOnlyCallback) {
            this.$readOnlyCallback = function(e2) {
              var shouldShow = false;
              if (e2 && e2.type == "keydown") {
                if (e2 && e2.key && !e2.ctrlKey && !e2.metaKey) {
                  if (e2.key == " ")
                    e2.preventDefault();
                  shouldShow = e2.key.length == 1;
                }
                if (!shouldShow)
                  return;
              } else if (e2 && e2.type !== "exec") {
                shouldShow = true;
              }
              if (shouldShow) {
                if (!_this.hoverTooltip) {
                  _this.hoverTooltip = new HoverTooltip();
                }
                var domNode = dom.createElement("div");
                domNode.textContent = nls("editor.tooltip.disable-editing", "Editing is disabled");
                if (!_this.hoverTooltip.isOpen) {
                  _this.hoverTooltip.showForRange(_this, _this.getSelectionRange(), domNode);
                }
              } else if (_this.hoverTooltip && _this.hoverTooltip.isOpen) {
                _this.hoverTooltip.hide();
              }
            };
          }
          var textArea = this.textInput.getElement();
          if (readOnly) {
            event.addListener(textArea, "keydown", this.$readOnlyCallback, this);
            this.commands.on("exec", this.$readOnlyCallback);
            this.commands.on("commandUnavailable", this.$readOnlyCallback);
          } else {
            event.removeListener(textArea, "keydown", this.$readOnlyCallback);
            this.commands.off("exec", this.$readOnlyCallback);
            this.commands.off("commandUnavailable", this.$readOnlyCallback);
            if (this.hoverTooltip) {
              this.hoverTooltip.destroy();
              this.hoverTooltip = null;
            }
          }
        },
        initialValue: false
      },
      copyWithEmptySelection: {
        set: function(value2) {
          this.textInput.setCopyWithEmptySelection(value2);
        },
        initialValue: false
      },
      cursorStyle: {
        set: function(val) {
          this.$resetCursorStyle();
        },
        values: ["ace", "slim", "smooth", "wide"],
        initialValue: "ace"
      },
      mergeUndoDeltas: {
        values: [false, true, "always"],
        initialValue: true
      },
      behavioursEnabled: { initialValue: true },
      wrapBehavioursEnabled: { initialValue: true },
      enableAutoIndent: { initialValue: true },
      autoScrollEditorIntoView: {
        set: function(val) {
          this.setAutoScrollEditorIntoView(val);
        }
      },
      keyboardHandler: {
        set: function(val) {
          this.setKeyboardHandler(val);
        },
        get: function() {
          return this.$keybindingId;
        },
        handlesSet: true
      },
      value: {
        set: function(val) {
          this.session.setValue(val);
        },
        get: function() {
          return this.getValue();
        },
        handlesSet: true,
        hidden: true
      },
      session: {
        set: function(val) {
          this.setSession(val);
        },
        get: function() {
          return this.session;
        },
        handlesSet: true,
        hidden: true
      },
      showLineNumbers: {
        set: function(show) {
          this.renderer.$gutterLayer.setShowLineNumbers(show);
          this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER);
          if (show && this.$relativeLineNumbers)
            relativeNumberRenderer.attach(this);
          else
            relativeNumberRenderer.detach(this);
        },
        initialValue: true
      },
      relativeLineNumbers: {
        set: function(value2) {
          if (this.$showLineNumbers && value2)
            relativeNumberRenderer.attach(this);
          else
            relativeNumberRenderer.detach(this);
        }
      },
      placeholder: {
        set: function(message) {
          if (!this.$updatePlaceholder) {
            this.$updatePlaceholder = (function() {
              var hasValue2 = this.session && (this.renderer.$composition || this.session.getLength() > 1 || this.session.getLine(0).length > 0);
              if (hasValue2 && this.renderer.placeholderNode) {
                this.renderer.off("afterRender", this.$updatePlaceholder);
                dom.removeCssClass(this.container, "ace_hasPlaceholder");
                this.renderer.placeholderNode.remove();
                this.renderer.placeholderNode = null;
              } else if (!hasValue2 && !this.renderer.placeholderNode) {
                this.renderer.on("afterRender", this.$updatePlaceholder);
                dom.addCssClass(this.container, "ace_hasPlaceholder");
                var el2 = dom.createElement("div");
                el2.className = "ace_placeholder";
                el2.textContent = this.$placeholder || "";
                this.renderer.placeholderNode = el2;
                this.renderer.content.appendChild(this.renderer.placeholderNode);
              } else if (!hasValue2 && this.renderer.placeholderNode) {
                this.renderer.placeholderNode.textContent = this.$placeholder || "";
              }
            }).bind(this);
            this.on("input", this.$updatePlaceholder);
          }
          this.$updatePlaceholder();
        }
      },
      enableKeyboardAccessibility: {
        set: function(value2) {
          var blurCommand = {
            name: "blurTextInput",
            description: "Set focus to the editor content div to allow tabbing through the page",
            bindKey: "Esc",
            exec: function(editor) {
              editor.blur();
              editor.renderer.scroller.focus();
            },
            readOnly: true
          };
          var focusOnEnterKeyup = function(e2) {
            if (e2.target == this.renderer.scroller && e2.keyCode === keys2["enter"]) {
              e2.preventDefault();
              var row = this.getCursorPosition().row;
              if (!this.isRowVisible(row))
                this.scrollToLine(row, true, true);
              this.focus();
            }
          };
          var gutterKeyboardHandler;
          if (value2) {
            this.renderer.enableKeyboardAccessibility = true;
            this.renderer.keyboardFocusClassName = "ace_keyboard-focus";
            this.textInput.getElement().setAttribute("tabindex", -1);
            this.textInput.setNumberOfExtraLines(useragent.isWin ? 3 : 0);
            this.renderer.scroller.setAttribute("tabindex", 0);
            this.renderer.scroller.setAttribute("role", "group");
            this.renderer.scroller.setAttribute("aria-roledescription", nls("editor.scroller.aria-roledescription", "editor"));
            this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName);
            this.renderer.scroller.setAttribute("aria-label", nls("editor.scroller.aria-label", "Editor content, press Enter to start editing, press Escape to exit"));
            this.renderer.scroller.addEventListener("keyup", focusOnEnterKeyup.bind(this));
            this.commands.addCommand(blurCommand);
            this.renderer.$gutter.setAttribute("tabindex", 0);
            this.renderer.$gutter.setAttribute("aria-hidden", false);
            this.renderer.$gutter.setAttribute("role", "group");
            this.renderer.$gutter.setAttribute("aria-roledescription", nls("editor.gutter.aria-roledescription", "editor gutter"));
            this.renderer.$gutter.setAttribute("aria-label", nls("editor.gutter.aria-label", "Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit"));
            this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName);
            this.renderer.content.setAttribute("aria-hidden", true);
            if (!gutterKeyboardHandler)
              gutterKeyboardHandler = new GutterKeyboardHandler(this);
            gutterKeyboardHandler.addListener();
            this.textInput.setAriaOptions({
              setLabel: true
            });
          } else {
            this.renderer.enableKeyboardAccessibility = false;
            this.textInput.getElement().setAttribute("tabindex", 0);
            this.textInput.setNumberOfExtraLines(0);
            this.renderer.scroller.setAttribute("tabindex", -1);
            this.renderer.scroller.removeAttribute("role");
            this.renderer.scroller.removeAttribute("aria-roledescription");
            this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName);
            this.renderer.scroller.removeAttribute("aria-label");
            this.renderer.scroller.removeEventListener("keyup", focusOnEnterKeyup.bind(this));
            this.commands.removeCommand(blurCommand);
            this.renderer.content.removeAttribute("aria-hidden");
            this.renderer.$gutter.setAttribute("tabindex", -1);
            this.renderer.$gutter.setAttribute("aria-hidden", true);
            this.renderer.$gutter.removeAttribute("role");
            this.renderer.$gutter.removeAttribute("aria-roledescription");
            this.renderer.$gutter.removeAttribute("aria-label");
            this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName);
            if (gutterKeyboardHandler)
              gutterKeyboardHandler.removeListener();
          }
        },
        initialValue: false
      },
      textInputAriaLabel: {
        set: function(val) {
          this.$textInputAriaLabel = val;
        },
        initialValue: ""
      },
      enableMobileMenu: {
        set: function(val) {
          this.$enableMobileMenu = val;
        },
        initialValue: true
      },
      customScrollbar: "renderer",
      hScrollBarAlwaysVisible: "renderer",
      vScrollBarAlwaysVisible: "renderer",
      highlightGutterLine: "renderer",
      animatedScroll: "renderer",
      showInvisibles: "renderer",
      showPrintMargin: "renderer",
      printMarginColumn: "renderer",
      printMargin: "renderer",
      fadeFoldWidgets: "renderer",
      showFoldWidgets: "renderer",
      displayIndentGuides: "renderer",
      highlightIndentGuides: "renderer",
      showGutter: "renderer",
      fontSize: "renderer",
      fontFamily: "renderer",
      maxLines: "renderer",
      minLines: "renderer",
      scrollPastEnd: "renderer",
      fixedWidthGutter: "renderer",
      theme: "renderer",
      hasCssTransforms: "renderer",
      maxPixelHeight: "renderer",
      useTextareaForIME: "renderer",
      useResizeObserver: "renderer",
      useSvgGutterIcons: "renderer",
      showFoldedAnnotations: "renderer",
      scrollSpeed: "$mouseHandler",
      dragDelay: "$mouseHandler",
      dragEnabled: "$mouseHandler",
      focusTimeout: "$mouseHandler",
      tooltipFollowsMouse: "$mouseHandler",
      firstLineNumber: "session",
      overwrite: "session",
      newLineMode: "session",
      useWorker: "session",
      useSoftTabs: "session",
      navigateWithinSoftTabs: "session",
      tabSize: "session",
      wrap: "session",
      indentedSoftWrap: "session",
      foldStyle: "session",
      mode: "session"
    });
    var relativeNumberRenderer = {
      getText: function(session, row) {
        return (Math.abs(session.selection.lead.row - row) || row + 1 + (row < 9 ? "·" : "")) + "";
      },
      getWidth: function(session, lastLineNumber, config3) {
        return Math.max(lastLineNumber.toString().length, (config3.lastRow + 1).toString().length, 2) * config3.characterWidth;
      },
      update: function(e2, editor) {
        editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER);
      },
      attach: function(editor) {
        editor.renderer.$gutterLayer.$renderer = this;
        editor.on("changeSelection", this.update);
        this.update(null, editor);
      },
      detach: function(editor) {
        if (editor.renderer.$gutterLayer.$renderer == this)
          editor.renderer.$gutterLayer.$renderer = null;
        editor.off("changeSelection", this.update);
        this.update(null, editor);
      }
    };
    exports3.Editor = Editor2;
  });
  ace.define("ace/layer/lines", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Lines = (
      /** @class */
      function() {
        function Lines2(element2, canvasHeight) {
          this.element = element2;
          this.canvasHeight = canvasHeight || 5e5;
          this.element.style.height = this.canvasHeight * 2 + "px";
          this.cells = [];
          this.cellCache = [];
          this.$offsetCoefficient = 0;
        }
        Lines2.prototype.moveContainer = function(config2) {
          dom.translate(this.element, 0, -(config2.firstRowScreen * config2.lineHeight % this.canvasHeight) - config2.offset * this.$offsetCoefficient);
        };
        Lines2.prototype.pageChanged = function(oldConfig, newConfig) {
          return Math.floor(oldConfig.firstRowScreen * oldConfig.lineHeight / this.canvasHeight) !== Math.floor(newConfig.firstRowScreen * newConfig.lineHeight / this.canvasHeight);
        };
        Lines2.prototype.computeLineTop = function(row, config2, session) {
          var screenTop = config2.firstRowScreen * config2.lineHeight;
          var screenPage = Math.floor(screenTop / this.canvasHeight);
          var lineTop = session.documentToScreenRow(row, 0) * config2.lineHeight;
          return lineTop - screenPage * this.canvasHeight;
        };
        Lines2.prototype.computeLineHeight = function(row, config2, session) {
          return config2.lineHeight * session.getRowLineCount(row);
        };
        Lines2.prototype.getLength = function() {
          return this.cells.length;
        };
        Lines2.prototype.get = function(index2) {
          return this.cells[index2];
        };
        Lines2.prototype.shift = function() {
          this.$cacheCell(this.cells.shift());
        };
        Lines2.prototype.pop = function() {
          this.$cacheCell(this.cells.pop());
        };
        Lines2.prototype.push = function(cell) {
          if (Array.isArray(cell)) {
            this.cells.push.apply(this.cells, cell);
            var fragment = dom.createFragment(this.element);
            for (var i2 = 0; i2 < cell.length; i2++) {
              fragment.appendChild(cell[i2].element);
            }
            this.element.appendChild(fragment);
          } else {
            this.cells.push(cell);
            this.element.appendChild(cell.element);
          }
        };
        Lines2.prototype.unshift = function(cell) {
          if (Array.isArray(cell)) {
            this.cells.unshift.apply(this.cells, cell);
            var fragment = dom.createFragment(this.element);
            for (var i2 = 0; i2 < cell.length; i2++) {
              fragment.appendChild(cell[i2].element);
            }
            if (this.element.firstChild)
              this.element.insertBefore(fragment, this.element.firstChild);
            else
              this.element.appendChild(fragment);
          } else {
            this.cells.unshift(cell);
            this.element.insertAdjacentElement("afterbegin", cell.element);
          }
        };
        Lines2.prototype.last = function() {
          if (this.cells.length)
            return this.cells[this.cells.length - 1];
          else
            return null;
        };
        Lines2.prototype.$cacheCell = function(cell) {
          if (!cell)
            return;
          cell.element.remove();
          this.cellCache.push(cell);
        };
        Lines2.prototype.createCell = function(row, config2, session, initElement) {
          var cell = this.cellCache.pop();
          if (!cell) {
            var element2 = dom.createElement("div");
            if (initElement)
              initElement(element2);
            this.element.appendChild(element2);
            cell = {
              element: element2,
              text: "",
              row
            };
          }
          cell.row = row;
          return cell;
        };
        return Lines2;
      }()
    );
    exports3.Lines = Lines;
  });
  ace.define("ace/layer/gutter", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/layer/lines", "ace/config"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var oop = require2("../lib/oop");
    var lang2 = require2("../lib/lang");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var Lines = require2("./lines").Lines;
    var nls = require2("../config").nls;
    var Gutter = (
      /** @class */
      function() {
        function Gutter2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_gutter-layer";
          parentEl.appendChild(this.element);
          this.setShowFoldWidgets(this.$showFoldWidgets);
          this.gutterWidth = 0;
          this.$annotations = [];
          this.$updateAnnotations = this.$updateAnnotations.bind(this);
          this.$lines = new Lines(this.element);
          this.$lines.$offsetCoefficient = 1;
        }
        Gutter2.prototype.setSession = function(session) {
          if (this.session)
            this.session.off("change", this.$updateAnnotations);
          this.session = session;
          if (session)
            session.on("change", this.$updateAnnotations);
        };
        Gutter2.prototype.addGutterDecoration = function(row, className) {
          if (window.console)
            console.warn && console.warn("deprecated use session.addGutterDecoration");
          this.session.addGutterDecoration(row, className);
        };
        Gutter2.prototype.removeGutterDecoration = function(row, className) {
          if (window.console)
            console.warn && console.warn("deprecated use session.removeGutterDecoration");
          this.session.removeGutterDecoration(row, className);
        };
        Gutter2.prototype.setAnnotations = function(annotations) {
          this.$annotations = [];
          for (var i2 = 0; i2 < annotations.length; i2++) {
            var annotation = annotations[i2];
            var row = annotation.row;
            var rowInfo = this.$annotations[row];
            if (!rowInfo)
              rowInfo = this.$annotations[row] = { text: [], type: [], displayText: [] };
            var annoText = annotation.text;
            var displayAnnoText = annotation.text;
            var annoType = annotation.type;
            annoText = annoText ? lang2.escapeHTML(annoText) : annotation.html || "";
            displayAnnoText = displayAnnoText ? displayAnnoText : annotation.html || "";
            if (rowInfo.text.indexOf(annoText) === -1) {
              rowInfo.text.push(annoText);
              rowInfo.type.push(annoType);
              rowInfo.displayText.push(displayAnnoText);
            }
            var className = annotation.className;
            if (className) {
              rowInfo.className = className;
            } else if (annoType === "error") {
              rowInfo.className = " ace_error";
            } else if (annoType === "security" && !/\bace_error\b/.test(rowInfo.className)) {
              rowInfo.className = " ace_security";
            } else if (annoType === "warning" && !/\bace_(error|security)\b/.test(rowInfo.className)) {
              rowInfo.className = " ace_warning";
            } else if (annoType === "info" && !rowInfo.className) {
              rowInfo.className = " ace_info";
            } else if (annoType === "hint" && !rowInfo.className) {
              rowInfo.className = " ace_hint";
            }
          }
        };
        Gutter2.prototype.$updateAnnotations = function(delta) {
          if (!this.$annotations.length)
            return;
          var firstRow = delta.start.row;
          var len = delta.end.row - firstRow;
          if (len === 0)
            ;
          else if (delta.action == "remove") {
            this.$annotations.splice(firstRow, len + 1, null);
          } else {
            var args = new Array(len + 1);
            args.unshift(firstRow, 1);
            this.$annotations.splice.apply(this.$annotations, args);
          }
        };
        Gutter2.prototype.update = function(config2) {
          this.config = config2;
          var session = this.session;
          var firstRow = config2.firstRow;
          var lastRow = Math.min(
            config2.lastRow + config2.gutterOffset,
            // needed to compensate for hor scollbar
            session.getLength() - 1
          );
          this.oldLastRow = lastRow;
          this.config = config2;
          this.$lines.moveContainer(config2);
          this.$updateCursorRow();
          var fold = session.getNextFoldLine(firstRow);
          var foldStart = fold ? fold.start.row : Infinity;
          var cell = null;
          var index2 = -1;
          var row = firstRow;
          while (true) {
            if (row > foldStart) {
              row = fold.end.row + 1;
              fold = session.getNextFoldLine(row, fold);
              foldStart = fold ? fold.start.row : Infinity;
            }
            if (row > lastRow) {
              while (this.$lines.getLength() > index2 + 1)
                this.$lines.pop();
              break;
            }
            cell = this.$lines.get(++index2);
            if (cell) {
              cell.row = row;
            } else {
              cell = this.$lines.createCell(row, config2, this.session, onCreateCell);
              this.$lines.push(cell);
            }
            this.$renderCell(cell, config2, fold, row);
            row++;
          }
          this._signal("afterRender");
          this.$updateGutterWidth(config2);
        };
        Gutter2.prototype.$updateGutterWidth = function(config2) {
          var session = this.session;
          var gutterRenderer = session.gutterRenderer || this.$renderer;
          var firstLineNumber = session.$firstLineNumber;
          var lastLineText = this.$lines.last() ? this.$lines.last().text : "";
          if (this.$fixedWidth || session.$useWrapMode)
            lastLineText = session.getLength() + firstLineNumber - 1;
          var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineText, config2) : lastLineText.toString().length * config2.characterWidth;
          var padding = this.$padding || this.$computePadding();
          gutterWidth += padding.left + padding.right;
          if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
            this.gutterWidth = gutterWidth;
            this.element.parentNode.style.width = this.element.style.width = Math.ceil(this.gutterWidth) + "px";
            this._signal("changeGutterWidth", gutterWidth);
          }
        };
        Gutter2.prototype.$updateCursorRow = function() {
          if (!this.$highlightGutterLine)
            return;
          var position2 = this.session.selection.getCursor();
          if (this.$cursorRow === position2.row)
            return;
          this.$cursorRow = position2.row;
        };
        Gutter2.prototype.updateLineHighlight = function() {
          if (!this.$highlightGutterLine)
            return;
          var row = this.session.selection.cursor.row;
          this.$cursorRow = row;
          if (this.$cursorCell && this.$cursorCell.row == row)
            return;
          if (this.$cursorCell)
            this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", "");
          var cells = this.$lines.cells;
          this.$cursorCell = null;
          for (var i2 = 0; i2 < cells.length; i2++) {
            var cell = cells[i2];
            if (cell.row >= this.$cursorRow) {
              if (cell.row > this.$cursorRow) {
                var fold = this.session.getFoldLine(this.$cursorRow);
                if (i2 > 0 && fold && fold.start.row == cells[i2 - 1].row)
                  cell = cells[i2 - 1];
                else
                  break;
              }
              cell.element.className = "ace_gutter-active-line " + cell.element.className;
              this.$cursorCell = cell;
              break;
            }
          }
        };
        Gutter2.prototype.scrollLines = function(config2) {
          var oldConfig = this.config;
          this.config = config2;
          this.$updateCursorRow();
          if (this.$lines.pageChanged(oldConfig, config2))
            return this.update(config2);
          this.$lines.moveContainer(config2);
          var lastRow = Math.min(
            config2.lastRow + config2.gutterOffset,
            // needed to compensate for hor scollbar
            this.session.getLength() - 1
          );
          var oldLastRow = this.oldLastRow;
          this.oldLastRow = lastRow;
          if (!oldConfig || oldLastRow < config2.firstRow)
            return this.update(config2);
          if (lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (oldConfig.firstRow < config2.firstRow)
            for (var row = this.session.getFoldedRowCount(oldConfig.firstRow, config2.firstRow - 1); row > 0; row--)
              this.$lines.shift();
          if (oldLastRow > lastRow)
            for (var row = this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row > 0; row--)
              this.$lines.pop();
          if (config2.firstRow < oldConfig.firstRow) {
            this.$lines.unshift(this.$renderLines(config2, config2.firstRow, oldConfig.firstRow - 1));
          }
          if (lastRow > oldLastRow) {
            this.$lines.push(this.$renderLines(config2, oldLastRow + 1, lastRow));
          }
          this.updateLineHighlight();
          this._signal("afterRender");
          this.$updateGutterWidth(config2);
        };
        Gutter2.prototype.$renderLines = function(config2, firstRow, lastRow) {
          var fragment = [];
          var row = firstRow;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > lastRow)
              break;
            var cell = this.$lines.createCell(row, config2, this.session, onCreateCell);
            this.$renderCell(cell, config2, foldLine, row);
            fragment.push(cell);
            row++;
          }
          return fragment;
        };
        Gutter2.prototype.$renderCell = function(cell, config2, fold, row) {
          var element2 = cell.element;
          var session = this.session;
          var textNode = element2.childNodes[0];
          var foldWidget = element2.childNodes[1];
          var annotationNode = element2.childNodes[2];
          var customWidget = element2.childNodes[3];
          var annotationIconNode = annotationNode.firstChild;
          var firstLineNumber = session.$firstLineNumber;
          var breakpoints = session.$breakpoints;
          var decorations = session.$decorations;
          var gutterRenderer = session.gutterRenderer || this.$renderer;
          var foldWidgets = this.$showFoldWidgets && session.foldWidgets;
          var foldStart = fold ? fold.start.row : Number.MAX_VALUE;
          var lineHeight2 = config2.lineHeight + "px";
          var className = this.$useSvgGutterIcons ? "ace_gutter-cell_svg-icons " : "ace_gutter-cell ";
          var iconClassName = this.$useSvgGutterIcons ? "ace_icon_svg" : "ace_icon";
          var rowText = (gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber).toString();
          if (this.$highlightGutterLine) {
            if (row == this.$cursorRow || fold && row < this.$cursorRow && row >= foldStart && this.$cursorRow <= fold.end.row) {
              className += "ace_gutter-active-line ";
              if (this.$cursorCell != cell) {
                if (this.$cursorCell)
                  this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", "");
                this.$cursorCell = cell;
              }
            }
          }
          if (breakpoints[row])
            className += breakpoints[row];
          if (decorations[row])
            className += decorations[row];
          if (this.$annotations[row] && row !== foldStart)
            className += this.$annotations[row].className;
          if (foldWidgets) {
            var c2 = foldWidgets[row];
            if (c2 == null)
              c2 = foldWidgets[row] = session.getFoldWidget(row);
          }
          if (c2) {
            var foldClass = "ace_fold-widget ace_" + c2;
            var isClosedFold = c2 == "start" && row == foldStart && row < fold.end.row;
            if (isClosedFold) {
              foldClass += " ace_closed";
              var foldAnnotationClass = "";
              var annotationInFold = false;
              for (var i2 = row + 1; i2 <= fold.end.row; i2++) {
                if (!this.$annotations[i2])
                  continue;
                if (this.$annotations[i2].className === " ace_error") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_error_fold";
                  break;
                }
                if (this.$annotations[i2].className === " ace_security") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_security_fold";
                } else if (this.$annotations[i2].className === " ace_warning" && foldAnnotationClass !== " ace_security_fold") {
                  annotationInFold = true;
                  foldAnnotationClass = " ace_warning_fold";
                }
              }
              className += foldAnnotationClass;
            } else
              foldClass += " ace_open";
            if (foldWidget.className != foldClass)
              foldWidget.className = foldClass;
            dom.setStyle(foldWidget.style, "height", lineHeight2);
            dom.setStyle(foldWidget.style, "display", "inline-block");
            foldWidget.setAttribute("role", "button");
            foldWidget.setAttribute("tabindex", "-1");
            var foldRange = session.getFoldWidgetRange(row);
            if (foldRange)
              foldWidget.setAttribute("aria-label", nls("gutter.code-folding.range.aria-label", "Toggle code folding, rows $0 through $1", [
                foldRange.start.row + 1,
                foldRange.end.row + 1
              ]));
            else {
              if (fold)
                foldWidget.setAttribute("aria-label", nls("gutter.code-folding.closed.aria-label", "Toggle code folding, rows $0 through $1", [
                  fold.start.row + 1,
                  fold.end.row + 1
                ]));
              else
                foldWidget.setAttribute("aria-label", nls("gutter.code-folding.open.aria-label", "Toggle code folding, row $0", [row + 1]));
            }
            if (isClosedFold) {
              foldWidget.setAttribute("aria-expanded", "false");
              foldWidget.setAttribute("title", nls("gutter.code-folding.closed.title", "Unfold code"));
            } else {
              foldWidget.setAttribute("aria-expanded", "true");
              foldWidget.setAttribute("title", nls("gutter.code-folding.open.title", "Fold code"));
            }
          } else {
            if (foldWidget) {
              dom.setStyle(foldWidget.style, "display", "none");
              foldWidget.setAttribute("tabindex", "0");
              foldWidget.removeAttribute("role");
              foldWidget.removeAttribute("aria-label");
            }
          }
          var customWidgetAttributes = this.session.$gutterCustomWidgets[row];
          if (customWidgetAttributes) {
            this.$addCustomWidget(row, customWidgetAttributes, cell);
          } else if (customWidget) {
            this.$removeCustomWidget(row, cell);
          }
          if (annotationInFold && this.$showFoldedAnnotations) {
            annotationNode.className = "ace_gutter_annotation";
            annotationIconNode.className = iconClassName;
            annotationIconNode.className += foldAnnotationClass;
            dom.setStyle(annotationIconNode.style, "height", lineHeight2);
            dom.setStyle(annotationNode.style, "display", "block");
            dom.setStyle(annotationNode.style, "height", lineHeight2);
            var ariaLabel;
            switch (foldAnnotationClass) {
              case " ace_error_fold":
                ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]);
                break;
              case " ace_security_fold":
                ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]);
                break;
              case " ace_warning_fold":
                ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]);
                break;
            }
            annotationNode.setAttribute("aria-label", ariaLabel);
            annotationNode.setAttribute("tabindex", "-1");
            annotationNode.setAttribute("role", "button");
          } else if (this.$annotations[row]) {
            annotationNode.className = "ace_gutter_annotation";
            annotationIconNode.className = iconClassName;
            if (this.$useSvgGutterIcons)
              annotationIconNode.className += this.$annotations[row].className;
            else
              element2.classList.add(this.$annotations[row].className.replace(" ", ""));
            dom.setStyle(annotationIconNode.style, "height", lineHeight2);
            dom.setStyle(annotationNode.style, "display", "block");
            dom.setStyle(annotationNode.style, "height", lineHeight2);
            var ariaLabel;
            switch (this.$annotations[row].className) {
              case " ace_error":
                ariaLabel = nls("gutter.annotation.aria-label.error", "Error, read annotations row $0", [rowText]);
                break;
              case " ace_security":
                ariaLabel = nls("gutter.annotation.aria-label.security", "Security finding, read annotations row $0", [rowText]);
                break;
              case " ace_warning":
                ariaLabel = nls("gutter.annotation.aria-label.warning", "Warning, read annotations row $0", [rowText]);
                break;
              case " ace_info":
                ariaLabel = nls("gutter.annotation.aria-label.info", "Info, read annotations row $0", [rowText]);
                break;
              case " ace_hint":
                ariaLabel = nls("gutter.annotation.aria-label.hint", "Suggestion, read annotations row $0", [rowText]);
                break;
            }
            annotationNode.setAttribute("aria-label", ariaLabel);
            annotationNode.setAttribute("tabindex", "-1");
            annotationNode.setAttribute("role", "button");
          } else {
            dom.setStyle(annotationNode.style, "display", "none");
            annotationNode.removeAttribute("aria-label");
            annotationNode.removeAttribute("role");
            annotationNode.setAttribute("tabindex", "0");
          }
          if (rowText !== textNode.data) {
            textNode.data = rowText;
          }
          if (element2.className != className)
            element2.className = className;
          dom.setStyle(cell.element.style, "height", this.$lines.computeLineHeight(row, config2, session) + "px");
          dom.setStyle(cell.element.style, "top", this.$lines.computeLineTop(row, config2, session) + "px");
          cell.text = rowText;
          if (annotationNode.style.display === "none" && foldWidget.style.display === "none" && !customWidgetAttributes)
            cell.element.setAttribute("aria-hidden", true);
          else
            cell.element.setAttribute("aria-hidden", false);
          return cell;
        };
        Gutter2.prototype.setHighlightGutterLine = function(highlightGutterLine) {
          this.$highlightGutterLine = highlightGutterLine;
        };
        Gutter2.prototype.setShowLineNumbers = function(show) {
          this.$renderer = !show && {
            getWidth: function() {
              return 0;
            },
            getText: function() {
              return "";
            }
          };
        };
        Gutter2.prototype.getShowLineNumbers = function() {
          return this.$showLineNumbers;
        };
        Gutter2.prototype.setShowFoldWidgets = function(show) {
          if (show)
            dom.addCssClass(this.element, "ace_folding-enabled");
          else
            dom.removeCssClass(this.element, "ace_folding-enabled");
          this.$showFoldWidgets = show;
          this.$padding = null;
        };
        Gutter2.prototype.getShowFoldWidgets = function() {
          return this.$showFoldWidgets;
        };
        Gutter2.prototype.$hideFoldWidget = function(row, cell) {
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var foldWidget = rowCell.element.childNodes[1];
            if (foldWidget) {
              dom.setStyle(foldWidget.style, "display", "none");
            }
          }
        };
        Gutter2.prototype.$showFoldWidget = function(row, cell) {
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var foldWidget = rowCell.element.childNodes[1];
            if (foldWidget && this.session.foldWidgets && this.session.foldWidgets[rowCell.row]) {
              dom.setStyle(foldWidget.style, "display", "inline-block");
            }
          }
        };
        Gutter2.prototype.$getGutterCell = function(row) {
          var cells = this.$lines.cells;
          var visibileRow = this.session.documentToScreenRow(row, 0);
          return cells[row - this.config.firstRowScreen - (row - visibileRow)];
        };
        Gutter2.prototype.$addCustomWidget = function(row, _a2, cell) {
          var className = _a2.className, label = _a2.label, title = _a2.title, callbacks = _a2.callbacks;
          this.session.$gutterCustomWidgets[row] = { className, label, title, callbacks };
          this.$hideFoldWidget(row, cell);
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var customWidget = rowCell.element.querySelector(".ace_custom-widget");
            if (customWidget) {
              customWidget.remove();
            }
            customWidget = dom.createElement("span");
            customWidget.className = "ace_custom-widget ".concat(className);
            customWidget.setAttribute("tabindex", "-1");
            customWidget.setAttribute("role", "button");
            customWidget.setAttribute("aria-label", label);
            customWidget.setAttribute("title", title);
            dom.setStyle(customWidget.style, "display", "inline-block");
            dom.setStyle(customWidget.style, "height", "inherit");
            if (callbacks && callbacks.onClick) {
              customWidget.addEventListener("click", function(e2) {
                callbacks.onClick(e2, row);
                e2.stopPropagation();
              });
            }
            rowCell.element.appendChild(customWidget);
          }
        };
        Gutter2.prototype.$removeCustomWidget = function(row, cell) {
          delete this.session.$gutterCustomWidgets[row];
          this.$showFoldWidget(row, cell);
          var rowCell = cell || this.$getGutterCell(row);
          if (rowCell && rowCell.element) {
            var customWidget = rowCell.element.querySelector(".ace_custom-widget");
            if (customWidget) {
              rowCell.element.removeChild(customWidget);
            }
          }
        };
        Gutter2.prototype.$computePadding = function() {
          if (!this.element.firstChild)
            return { left: 0, right: 0 };
          var style2 = dom.computedStyle(
            /**@type{Element}*/
            this.element.firstChild
          );
          this.$padding = {};
          this.$padding.left = (parseInt(style2.borderLeftWidth) || 0) + (parseInt(style2.paddingLeft) || 0) + 1;
          this.$padding.right = (parseInt(style2.borderRightWidth) || 0) + (parseInt(style2.paddingRight) || 0);
          return this.$padding;
        };
        Gutter2.prototype.getRegion = function(point2) {
          var padding = this.$padding || this.$computePadding();
          var rect = this.element.getBoundingClientRect();
          if (point2.x < padding.left + rect.left)
            return "markers";
          if (this.$showFoldWidgets && point2.x > rect.right - padding.right)
            return "foldWidgets";
        };
        return Gutter2;
      }()
    );
    Gutter.prototype.$fixedWidth = false;
    Gutter.prototype.$highlightGutterLine = true;
    Gutter.prototype.$renderer = "";
    Gutter.prototype.$showLineNumbers = true;
    Gutter.prototype.$showFoldWidgets = true;
    oop.implement(Gutter.prototype, EventEmitter2);
    function onCreateCell(element2) {
      var textNode = document.createTextNode("");
      element2.appendChild(textNode);
      var foldWidget = dom.createElement("span");
      element2.appendChild(foldWidget);
      var annotationNode = dom.createElement("span");
      element2.appendChild(annotationNode);
      var annotationIconNode = dom.createElement("span");
      annotationNode.appendChild(annotationIconNode);
      return element2;
    }
    exports3.Gutter = Gutter;
  });
  ace.define("ace/layer/marker", ["require", "exports", "module", "ace/range", "ace/lib/dom"], function(require2, exports3, module3) {
    var Range = require2("../range").Range;
    var dom = require2("../lib/dom");
    var Marker = (
      /** @class */
      function() {
        function Marker2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_marker-layer";
          parentEl.appendChild(this.element);
        }
        Marker2.prototype.setPadding = function(padding) {
          this.$padding = padding;
        };
        Marker2.prototype.setSession = function(session) {
          this.session = session;
        };
        Marker2.prototype.setMarkers = function(markers) {
          this.markers = markers;
        };
        Marker2.prototype.elt = function(className, css) {
          var x2 = this.i != -1 && this.element.childNodes[this.i];
          if (!x2) {
            x2 = document.createElement("div");
            this.element.appendChild(x2);
            this.i = -1;
          } else {
            this.i++;
          }
          x2.style.cssText = css;
          x2.className = className;
        };
        Marker2.prototype.update = function(config2) {
          if (!config2)
            return;
          this.config = config2;
          this.i = 0;
          var html2;
          for (var key in this.markers) {
            var marker = this.markers[key];
            if (!marker.range) {
              marker.update(html2, this, this.session, config2);
              continue;
            }
            var range3 = marker.range.clipRows(config2.firstRow, config2.lastRow);
            if (range3.isEmpty())
              continue;
            range3 = range3.toScreenRange(this.session);
            if (marker.renderer) {
              var top2 = this.$getTop(range3.start.row, config2);
              var left2 = this.$padding + range3.start.column * config2.characterWidth;
              marker.renderer(html2, range3, left2, top2, config2);
            } else if (marker.type == "fullLine") {
              this.drawFullLineMarker(html2, range3, marker.clazz, config2);
            } else if (marker.type == "screenLine") {
              this.drawScreenLineMarker(html2, range3, marker.clazz, config2);
            } else if (range3.isMultiLine()) {
              if (marker.type == "text")
                this.drawTextMarker(html2, range3, marker.clazz, config2);
              else
                this.drawMultiLineMarker(html2, range3, marker.clazz, config2);
            } else {
              this.drawSingleLineMarker(html2, range3, marker.clazz + " ace_start ace_br15", config2);
            }
          }
          if (this.i != -1) {
            while (this.i < this.element.childElementCount)
              this.element.removeChild(this.element.lastChild);
          }
        };
        Marker2.prototype.$getTop = function(row, layerConfig) {
          return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
        };
        Marker2.prototype.drawTextMarker = function(stringBuilder, range3, clazz, layerConfig, extraStyle) {
          var session = this.session;
          var start = range3.start.row;
          var end = range3.end.row;
          var row = start;
          var prev2 = 0;
          var curr = 0;
          var next2 = session.getScreenLastRowColumn(row);
          var lineRange = new Range(row, range3.start.column, row, curr);
          for (; row <= end; row++) {
            lineRange.start.row = lineRange.end.row = row;
            lineRange.start.column = row == start ? range3.start.column : session.getRowWrapIndent(row);
            lineRange.end.column = next2;
            prev2 = curr;
            curr = next2;
            next2 = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range3.end.column;
            this.drawSingleLineMarker(stringBuilder, lineRange, clazz + (row == start ? " ace_start" : "") + " ace_br" + getBorderClass(row == start || row == start + 1 && range3.start.column, prev2 < curr, curr > next2, row == end), layerConfig, row == end ? 0 : 1, extraStyle);
          }
        };
        Marker2.prototype.drawMultiLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var padding = this.$padding;
          var height = config2.lineHeight;
          var top2 = this.$getTop(range3.start.row, config2);
          var left2 = padding + range3.start.column * config2.characterWidth;
          extraStyle = extraStyle || "";
          if (this.session.$bidiHandler.isBidiRow(range3.start.row)) {
            var range1 = range3.clone();
            range1.end.row = range1.start.row;
            range1.end.column = this.session.getLine(range1.start.row).length;
            this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br1 ace_start", config2, null, extraStyle);
          } else {
            this.elt(clazz + " ace_br1 ace_start", "height:" + height + "px;right:" + padding + "px;top:" + top2 + "px;left:" + left2 + "px;" + (extraStyle || ""));
          }
          if (this.session.$bidiHandler.isBidiRow(range3.end.row)) {
            var range1 = range3.clone();
            range1.start.row = range1.end.row;
            range1.start.column = 0;
            this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br12", config2, null, extraStyle);
          } else {
            top2 = this.$getTop(range3.end.row, config2);
            var width = range3.end.column * config2.characterWidth;
            this.elt(clazz + " ace_br12", "height:" + height + "px;width:" + width + "px;top:" + top2 + "px;left:" + padding + "px;" + (extraStyle || ""));
          }
          height = (range3.end.row - range3.start.row - 1) * config2.lineHeight;
          if (height <= 0)
            return;
          top2 = this.$getTop(range3.start.row + 1, config2);
          var radiusClass = (range3.start.column ? 1 : 0) | (range3.end.column ? 0 : 8);
          this.elt(clazz + (radiusClass ? " ace_br" + radiusClass : ""), "height:" + height + "px;right:" + padding + "px;top:" + top2 + "px;left:" + padding + "px;" + (extraStyle || ""));
        };
        Marker2.prototype.drawSingleLineMarker = function(stringBuilder, range3, clazz, config2, extraLength, extraStyle) {
          if (this.session.$bidiHandler.isBidiRow(range3.start.row))
            return this.drawBidiSingleLineMarker(stringBuilder, range3, clazz, config2, extraLength, extraStyle);
          var height = config2.lineHeight;
          var width = (range3.end.column + (extraLength || 0) - range3.start.column) * config2.characterWidth;
          var top2 = this.$getTop(range3.start.row, config2);
          var left2 = this.$padding + range3.start.column * config2.characterWidth;
          this.elt(clazz, "height:" + height + "px;width:" + width + "px;top:" + top2 + "px;left:" + left2 + "px;" + (extraStyle || ""));
        };
        Marker2.prototype.drawBidiSingleLineMarker = function(stringBuilder, range3, clazz, config2, extraLength, extraStyle) {
          var height = config2.lineHeight, top2 = this.$getTop(range3.start.row, config2), padding = this.$padding;
          var selections = this.session.$bidiHandler.getSelections(range3.start.column, range3.end.column);
          selections.forEach(function(selection) {
            this.elt(clazz, "height:" + height + "px;width:" + (selection.width + (extraLength || 0)) + "px;top:" + top2 + "px;left:" + (padding + selection.left) + "px;" + (extraStyle || ""));
          }, this);
        };
        Marker2.prototype.drawFullLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var top2 = this.$getTop(range3.start.row, config2);
          var height = config2.lineHeight;
          if (range3.start.row != range3.end.row)
            height += this.$getTop(range3.end.row, config2) - top2;
          this.elt(clazz, "height:" + height + "px;top:" + top2 + "px;left:0;right:0;" + (extraStyle || ""));
        };
        Marker2.prototype.drawScreenLineMarker = function(stringBuilder, range3, clazz, config2, extraStyle) {
          var top2 = this.$getTop(range3.start.row, config2);
          var height = config2.lineHeight;
          this.elt(clazz, "height:" + height + "px;top:" + top2 + "px;left:0;right:0;" + (extraStyle || ""));
        };
        return Marker2;
      }()
    );
    Marker.prototype.$padding = 0;
    function getBorderClass(tl2, tr, br, bl2) {
      return (tl2 ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl2 ? 8 : 0);
    }
    exports3.Marker = Marker;
  });
  ace.define("ace/layer/text_util", ["require", "exports", "module"], function(require2, exports3, module3) {
    var textTokens = /* @__PURE__ */ new Set(["text", "rparen", "lparen"]);
    exports3.isTextToken = function(tokenType) {
      return textTokens.has(tokenType);
    };
  });
  ace.define("ace/layer/text", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/layer/lines", "ace/lib/event_emitter", "ace/config", "ace/layer/text_util"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var Lines = require2("./lines").Lines;
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var nls = require2("../config").nls;
    var isTextToken = require2("./text_util").isTextToken;
    var Text2 = (
      /** @class */
      function() {
        function Text3(parentEl) {
          this.dom = dom;
          this.element = this.dom.createElement("div");
          this.element.className = "ace_layer ace_text-layer";
          parentEl.appendChild(this.element);
          this.$updateEolChar = this.$updateEolChar.bind(this);
          this.$lines = new Lines(this.element);
        }
        Text3.prototype.$updateEolChar = function() {
          var doc = this.session.doc;
          var unixMode = doc.getNewLineCharacter() == "\n" && doc.getNewLineMode() != "windows";
          var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF;
          if (this.EOL_CHAR != EOL_CHAR) {
            this.EOL_CHAR = EOL_CHAR;
            return true;
          }
        };
        Text3.prototype.setPadding = function(padding) {
          this.$padding = padding;
          this.element.style.margin = "0 " + padding + "px";
        };
        Text3.prototype.getLineHeight = function() {
          return this.$fontMetrics.$characterSize.height || 0;
        };
        Text3.prototype.getCharacterWidth = function() {
          return this.$fontMetrics.$characterSize.width || 0;
        };
        Text3.prototype.$setFontMetrics = function(measure) {
          this.$fontMetrics = measure;
          this.$fontMetrics.on(
            "changeCharacterSize",
            (function(e2) {
              this._signal("changeCharacterSize", e2);
            }).bind(this)
          );
          this.$pollSizeChanges();
        };
        Text3.prototype.checkForSizeChanges = function() {
          this.$fontMetrics.checkForSizeChanges();
        };
        Text3.prototype.$pollSizeChanges = function() {
          return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges();
        };
        Text3.prototype.setSession = function(session) {
          this.session = session;
          if (session)
            this.$computeTabString();
        };
        Text3.prototype.setShowInvisibles = function(showInvisibles) {
          if (this.showInvisibles == showInvisibles)
            return false;
          this.showInvisibles = showInvisibles;
          if (typeof showInvisibles == "string") {
            this.showSpaces = /tab/i.test(showInvisibles);
            this.showTabs = /space/i.test(showInvisibles);
            this.showEOL = /eol/i.test(showInvisibles);
          } else {
            this.showSpaces = this.showTabs = this.showEOL = showInvisibles;
          }
          this.$computeTabString();
          return true;
        };
        Text3.prototype.setDisplayIndentGuides = function(display) {
          if (this.displayIndentGuides == display)
            return false;
          this.displayIndentGuides = display;
          this.$computeTabString();
          return true;
        };
        Text3.prototype.setHighlightIndentGuides = function(highlight) {
          if (this.$highlightIndentGuides === highlight)
            return false;
          this.$highlightIndentGuides = highlight;
          return highlight;
        };
        Text3.prototype.$computeTabString = function() {
          var tabSize = this.session.getTabSize();
          this.tabSize = tabSize;
          var tabStr = this.$tabStrings = [0];
          for (var i2 = 1; i2 < tabSize + 1; i2++) {
            if (this.showTabs) {
              var span = this.dom.createElement("span");
              span.className = "ace_invisible ace_invisible_tab";
              span.textContent = lang2.stringRepeat(this.TAB_CHAR, i2);
              tabStr.push(span);
            } else {
              tabStr.push(this.dom.createTextNode(lang2.stringRepeat(" ", i2), this.element));
            }
          }
          if (this.displayIndentGuides) {
            this.$indentGuideRe = /\s\S| \t|\t |\s$/;
            var className = "ace_indent-guide";
            var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : "";
            var spaceContent = this.showSpaces ? lang2.stringRepeat(this.SPACE_CHAR, this.tabSize) : lang2.stringRepeat(" ", this.tabSize);
            var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : "";
            var tabContent = this.showTabs ? lang2.stringRepeat(this.TAB_CHAR, this.tabSize) : spaceContent;
            var span = this.dom.createElement("span");
            span.className = className + spaceClass;
            span.textContent = spaceContent;
            this.$tabStrings[" "] = span;
            var span = this.dom.createElement("span");
            span.className = className + tabClass;
            span.textContent = tabContent;
            this.$tabStrings["	"] = span;
          }
        };
        Text3.prototype.updateLines = function(config2, firstRow, lastRow) {
          if (this.config.lastRow != config2.lastRow || this.config.firstRow != config2.firstRow) {
            return this.update(config2);
          }
          this.config = config2;
          var first = Math.max(firstRow, config2.firstRow);
          var last = Math.min(lastRow, config2.lastRow);
          var lineElements = this.element.childNodes;
          var lineElementsIdx = 0;
          for (var row = config2.firstRow; row < first; row++) {
            var foldLine = this.session.getFoldLine(row);
            if (foldLine) {
              if (foldLine.containsRow(first)) {
                first = foldLine.start.row;
                break;
              } else {
                row = foldLine.end.row;
              }
            }
            lineElementsIdx++;
          }
          var heightChanged = false;
          var row = first;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > last)
              break;
            var lineElement = lineElements[lineElementsIdx++];
            if (lineElement) {
              this.dom.removeChildren(lineElement);
              this.$renderLine(lineElement, row, row == foldStart ? foldLine : false);
              if (heightChanged)
                lineElement.style.top = this.$lines.computeLineTop(row, config2, this.session) + "px";
              var height = config2.lineHeight * this.session.getRowLength(row) + "px";
              if (lineElement.style.height != height) {
                heightChanged = true;
                lineElement.style.height = height;
              }
            }
            row++;
          }
          if (heightChanged) {
            while (lineElementsIdx < this.$lines.cells.length) {
              var cell = this.$lines.cells[lineElementsIdx++];
              cell.element.style.top = this.$lines.computeLineTop(cell.row, config2, this.session) + "px";
            }
          }
        };
        Text3.prototype.scrollLines = function(config2) {
          var oldConfig = this.config;
          this.config = config2;
          if (this.$lines.pageChanged(oldConfig, config2))
            return this.update(config2);
          this.$lines.moveContainer(config2);
          var lastRow = config2.lastRow;
          var oldLastRow = oldConfig ? oldConfig.lastRow : -1;
          if (!oldConfig || oldLastRow < config2.firstRow)
            return this.update(config2);
          if (lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (!oldConfig || oldConfig.lastRow < config2.firstRow)
            return this.update(config2);
          if (config2.lastRow < oldConfig.firstRow)
            return this.update(config2);
          if (oldConfig.firstRow < config2.firstRow)
            for (var row = this.session.getFoldedRowCount(oldConfig.firstRow, config2.firstRow - 1); row > 0; row--)
              this.$lines.shift();
          if (oldConfig.lastRow > config2.lastRow)
            for (var row = this.session.getFoldedRowCount(config2.lastRow + 1, oldConfig.lastRow); row > 0; row--)
              this.$lines.pop();
          if (config2.firstRow < oldConfig.firstRow) {
            this.$lines.unshift(this.$renderLinesFragment(config2, config2.firstRow, oldConfig.firstRow - 1));
          }
          if (config2.lastRow > oldConfig.lastRow) {
            this.$lines.push(this.$renderLinesFragment(config2, oldConfig.lastRow + 1, config2.lastRow));
          }
          this.$highlightIndentGuide();
        };
        Text3.prototype.$renderLinesFragment = function(config2, firstRow, lastRow) {
          var fragment = [];
          var row = firstRow;
          var foldLine = this.session.getNextFoldLine(row);
          var foldStart = foldLine ? foldLine.start.row : Infinity;
          while (true) {
            if (row > foldStart) {
              row = foldLine.end.row + 1;
              foldLine = this.session.getNextFoldLine(row, foldLine);
              foldStart = foldLine ? foldLine.start.row : Infinity;
            }
            if (row > lastRow)
              break;
            var line2 = this.$lines.createCell(row, config2, this.session);
            var lineEl = line2.element;
            this.dom.removeChildren(lineEl);
            dom.setStyle(lineEl.style, "height", this.$lines.computeLineHeight(row, config2, this.session) + "px");
            dom.setStyle(lineEl.style, "top", this.$lines.computeLineTop(row, config2, this.session) + "px");
            this.$renderLine(lineEl, row, row == foldStart ? foldLine : false);
            if (this.$useLineGroups()) {
              lineEl.className = "ace_line_group";
            } else {
              lineEl.className = "ace_line";
            }
            fragment.push(line2);
            row++;
          }
          return fragment;
        };
        Text3.prototype.update = function(config2) {
          this.$lines.moveContainer(config2);
          this.config = config2;
          var firstRow = config2.firstRow;
          var lastRow = config2.lastRow;
          var lines = this.$lines;
          while (lines.getLength())
            lines.pop();
          lines.push(this.$renderLinesFragment(config2, firstRow, lastRow));
        };
        Text3.prototype.$renderToken = function(parent, screenColumn, token2, value2) {
          var self2 = this;
          var re2 = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g;
          var valueFragment = this.dom.createFragment(this.element);
          var m2;
          var i2 = 0;
          while (m2 = re2.exec(value2)) {
            var tab2 = m2[1];
            var simpleSpace = m2[2];
            var controlCharacter = m2[3];
            var cjkSpace = m2[4];
            var cjk = m2[5];
            if (!self2.showSpaces && simpleSpace)
              continue;
            var before = i2 != m2.index ? value2.slice(i2, m2.index) : "";
            i2 = m2.index + m2[0].length;
            if (before) {
              valueFragment.appendChild(this.dom.createTextNode(before, this.element));
            }
            if (tab2) {
              var tabSize = self2.session.getScreenTabSize(screenColumn + m2.index);
              var text2 = self2.$tabStrings[tabSize].cloneNode(true);
              text2["charCount"] = 1;
              valueFragment.appendChild(text2);
              screenColumn += tabSize - 1;
            } else if (simpleSpace) {
              if (self2.showSpaces) {
                var span = this.dom.createElement("span");
                span.className = "ace_invisible ace_invisible_space";
                span.textContent = lang2.stringRepeat(self2.SPACE_CHAR, simpleSpace.length);
                valueFragment.appendChild(span);
              } else {
                valueFragment.appendChild(this.dom.createTextNode(simpleSpace, this.element));
              }
            } else if (controlCharacter) {
              var span = this.dom.createElement("span");
              span.className = "ace_invisible ace_invisible_space ace_invalid";
              span.textContent = lang2.stringRepeat(self2.SPACE_CHAR, controlCharacter.length);
              valueFragment.appendChild(span);
            } else if (cjkSpace) {
              screenColumn += 1;
              var span = this.dom.createElement("span");
              span.style.width = self2.config.characterWidth * 2 + "px";
              span.className = self2.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk";
              span.textContent = self2.showSpaces ? self2.SPACE_CHAR : cjkSpace;
              valueFragment.appendChild(span);
            } else if (cjk) {
              screenColumn += 1;
              var span = this.dom.createElement("span");
              span.style.width = self2.config.characterWidth * 2 + "px";
              span.className = "ace_cjk";
              span.textContent = cjk;
              valueFragment.appendChild(span);
            }
          }
          valueFragment.appendChild(this.dom.createTextNode(i2 ? value2.slice(i2) : value2, this.element));
          if (!isTextToken(token2.type)) {
            var classes = "ace_" + token2.type.replace(/\./g, " ace_");
            var span = this.dom.createElement("span");
            if (token2.type == "fold") {
              span.style.width = token2.value.length * this.config.characterWidth + "px";
              span.setAttribute("title", nls("inline-fold.closed.title", "Unfold code"));
            }
            span.className = classes;
            span.appendChild(valueFragment);
            parent.appendChild(span);
          } else {
            parent.appendChild(valueFragment);
          }
          return screenColumn + value2.length;
        };
        Text3.prototype.renderIndentGuide = function(parent, value2, max2) {
          var cols = value2.search(this.$indentGuideRe);
          if (cols <= 0 || cols >= max2)
            return value2;
          if (value2[0] == " ") {
            cols -= cols % this.tabSize;
            var count = cols / this.tabSize;
            for (var i2 = 0; i2 < count; i2++) {
              parent.appendChild(this.$tabStrings[" "].cloneNode(true));
            }
            this.$highlightIndentGuide();
            return value2.substr(cols);
          } else if (value2[0] == "	") {
            for (var i2 = 0; i2 < cols; i2++) {
              parent.appendChild(this.$tabStrings["	"].cloneNode(true));
            }
            this.$highlightIndentGuide();
            return value2.substr(cols);
          }
          this.$highlightIndentGuide();
          return value2;
        };
        Text3.prototype.$highlightIndentGuide = function() {
          if (!this.$highlightIndentGuides || !this.displayIndentGuides)
            return;
          this.$highlightIndentGuideMarker = {
            indentLevel: void 0,
            start: void 0,
            end: void 0,
            dir: void 0
          };
          var lines = this.session.doc.$lines;
          if (!lines)
            return;
          var cursor = this.session.selection.getCursor();
          var initialIndent = /^\s*/.exec(this.session.doc.getLine(cursor.row))[0].length;
          var elementIndentLevel = Math.floor(initialIndent / this.tabSize);
          this.$highlightIndentGuideMarker = {
            indentLevel: elementIndentLevel,
            start: cursor.row
          };
          var bracketHighlight = this.session.$bracketHighlight;
          if (bracketHighlight) {
            var ranges = this.session.$bracketHighlight.ranges;
            for (var i2 = 0; i2 < ranges.length; i2++) {
              if (cursor.row !== ranges[i2].start.row) {
                this.$highlightIndentGuideMarker.end = ranges[i2].start.row + 1;
                if (cursor.row > ranges[i2].start.row) {
                  this.$highlightIndentGuideMarker.dir = -1;
                } else {
                  this.$highlightIndentGuideMarker.dir = 1;
                }
                break;
              }
            }
          }
          if (!this.$highlightIndentGuideMarker.end) {
            if (lines[cursor.row] !== "" && cursor.column === lines[cursor.row].length) {
              this.$highlightIndentGuideMarker.dir = 1;
              for (var i2 = cursor.row + 1; i2 < lines.length; i2++) {
                var line2 = lines[i2];
                var currentIndent = /^\s*/.exec(line2)[0].length;
                if (line2 !== "") {
                  this.$highlightIndentGuideMarker.end = i2;
                  if (currentIndent <= initialIndent)
                    break;
                }
              }
            }
          }
          this.$renderHighlightIndentGuide();
        };
        Text3.prototype.$clearActiveIndentGuide = function() {
          var activeIndentGuides = this.element.querySelectorAll(".ace_indent-guide-active");
          for (var i2 = 0; i2 < activeIndentGuides.length; i2++) {
            activeIndentGuides[i2].classList.remove("ace_indent-guide-active");
          }
        };
        Text3.prototype.$setIndentGuideActive = function(cell, indentLevel) {
          var line2 = this.session.doc.getLine(cell.row);
          if (line2 !== "") {
            var element2 = cell.element;
            if (cell.element.classList && cell.element.classList.contains("ace_line_group")) {
              if (cell.element.childNodes.length > 0) {
                element2 = cell.element.childNodes[0];
              } else {
                return;
              }
            }
            var childNodes = element2.childNodes;
            if (childNodes) {
              var node2 = childNodes[indentLevel - 1];
              if (node2 && node2.classList && node2.classList.contains("ace_indent-guide"))
                node2.classList.add("ace_indent-guide-active");
            }
          }
        };
        Text3.prototype.$renderHighlightIndentGuide = function() {
          if (!this.$lines)
            return;
          var cells = this.$lines.cells;
          this.$clearActiveIndentGuide();
          var indentLevel = this.$highlightIndentGuideMarker.indentLevel;
          if (indentLevel !== 0) {
            if (this.$highlightIndentGuideMarker.dir === 1) {
              for (var i2 = 0; i2 < cells.length; i2++) {
                var cell = cells[i2];
                if (this.$highlightIndentGuideMarker.end && cell.row >= this.$highlightIndentGuideMarker.start + 1) {
                  if (cell.row >= this.$highlightIndentGuideMarker.end)
                    break;
                  this.$setIndentGuideActive(cell, indentLevel);
                }
              }
            } else {
              for (var i2 = cells.length - 1; i2 >= 0; i2--) {
                var cell = cells[i2];
                if (this.$highlightIndentGuideMarker.end && cell.row < this.$highlightIndentGuideMarker.start) {
                  if (cell.row < this.$highlightIndentGuideMarker.end)
                    break;
                  this.$setIndentGuideActive(cell, indentLevel);
                }
              }
            }
          }
        };
        Text3.prototype.$createLineElement = function(parent) {
          var lineEl = this.dom.createElement("div");
          lineEl.className = "ace_line";
          lineEl.style.height = this.config.lineHeight + "px";
          return lineEl;
        };
        Text3.prototype.$renderWrappedLine = function(parent, tokens2, splits) {
          var chars2 = 0;
          var split2 = 0;
          var splitChars = splits[0];
          var screenColumn = 0;
          var lineEl = this.$createLineElement();
          parent.appendChild(lineEl);
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            var value2 = token2.value;
            if (i2 == 0 && this.displayIndentGuides) {
              chars2 = value2.length;
              value2 = this.renderIndentGuide(lineEl, value2, splitChars);
              if (!value2)
                continue;
              chars2 -= value2.length;
            }
            if (chars2 + value2.length < splitChars) {
              screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2);
              chars2 += value2.length;
            } else {
              while (chars2 + value2.length >= splitChars) {
                screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2.substring(0, splitChars - chars2));
                value2 = value2.substring(splitChars - chars2);
                chars2 = splitChars;
                lineEl = this.$createLineElement();
                parent.appendChild(lineEl);
                var text2 = this.dom.createTextNode(lang2.stringRepeat(" ", splits.indent), this.element);
                text2["charCount"] = 0;
                lineEl.appendChild(text2);
                split2++;
                screenColumn = 0;
                splitChars = splits[split2] || Number.MAX_VALUE;
              }
              if (value2.length != 0) {
                chars2 += value2.length;
                screenColumn = this.$renderToken(lineEl, screenColumn, token2, value2);
              }
            }
          }
          if (splits[splits.length - 1] > this.MAX_LINE_LENGTH)
            this.$renderOverflowMessage(lineEl, screenColumn, null, "", true);
        };
        Text3.prototype.$renderSimpleLine = function(parent, tokens2) {
          var screenColumn = 0;
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            var value2 = token2.value;
            if (i2 == 0 && this.displayIndentGuides) {
              value2 = this.renderIndentGuide(parent, value2);
              if (!value2)
                continue;
            }
            if (screenColumn + value2.length > this.MAX_LINE_LENGTH)
              return this.$renderOverflowMessage(parent, screenColumn, token2, value2);
            screenColumn = this.$renderToken(parent, screenColumn, token2, value2);
          }
        };
        Text3.prototype.$renderOverflowMessage = function(parent, screenColumn, token2, value2, hide) {
          token2 && this.$renderToken(parent, screenColumn, token2, value2.slice(0, this.MAX_LINE_LENGTH - screenColumn));
          var overflowEl = this.dom.createElement("span");
          overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap";
          overflowEl.textContent = hide ? "<hide>" : "<click to see more...>";
          parent.appendChild(overflowEl);
        };
        Text3.prototype.$renderLine = function(parent, row, foldLine) {
          if (!foldLine && foldLine != false)
            foldLine = this.session.getFoldLine(row);
          if (foldLine)
            var tokens2 = this.$getFoldLineTokens(row, foldLine);
          else
            var tokens2 = this.session.getTokens(row);
          var lastLineEl = parent;
          if (tokens2.length) {
            var splits = this.session.getRowSplitData(row);
            if (splits && splits.length) {
              this.$renderWrappedLine(parent, tokens2, splits);
              var lastLineEl = parent.lastChild;
            } else {
              var lastLineEl = parent;
              if (this.$useLineGroups()) {
                lastLineEl = this.$createLineElement();
                parent.appendChild(lastLineEl);
              }
              this.$renderSimpleLine(lastLineEl, tokens2);
            }
          } else if (this.$useLineGroups()) {
            lastLineEl = this.$createLineElement();
            parent.appendChild(lastLineEl);
          }
          if (this.showEOL && lastLineEl) {
            if (foldLine)
              row = foldLine.end.row;
            var invisibleEl = this.dom.createElement("span");
            invisibleEl.className = "ace_invisible ace_invisible_eol";
            invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR;
            lastLineEl.appendChild(invisibleEl);
          }
        };
        Text3.prototype.$getFoldLineTokens = function(row, foldLine) {
          var session = this.session;
          var renderTokens = [];
          function addTokens(tokens3, from2, to2) {
            var idx = 0, col = 0;
            while (col + tokens3[idx].value.length < from2) {
              col += tokens3[idx].value.length;
              idx++;
              if (idx == tokens3.length)
                return;
            }
            if (col != from2) {
              var value2 = tokens3[idx].value.substring(from2 - col);
              if (value2.length > to2 - from2)
                value2 = value2.substring(0, to2 - from2);
              renderTokens.push({
                type: tokens3[idx].type,
                value: value2
              });
              col = from2 + value2.length;
              idx += 1;
            }
            while (col < to2 && idx < tokens3.length) {
              var value2 = tokens3[idx].value;
              if (value2.length + col > to2) {
                renderTokens.push({
                  type: tokens3[idx].type,
                  value: value2.substring(0, to2 - col)
                });
              } else
                renderTokens.push(tokens3[idx]);
              col += value2.length;
              idx += 1;
            }
          }
          var tokens2 = session.getTokens(row);
          foldLine.walk(function(placeholder, row2, column2, lastColumn, isNewRow) {
            if (placeholder != null) {
              renderTokens.push({
                type: "fold",
                value: placeholder
              });
            } else {
              if (isNewRow)
                tokens2 = session.getTokens(row2);
              if (tokens2.length)
                addTokens(tokens2, lastColumn, column2);
            }
          }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
          return renderTokens;
        };
        Text3.prototype.$useLineGroups = function() {
          return this.session.getUseWrapMode();
        };
        return Text3;
      }()
    );
    Text2.prototype.EOF_CHAR = "¶";
    Text2.prototype.EOL_CHAR_LF = "¬";
    Text2.prototype.EOL_CHAR_CRLF = "¤";
    Text2.prototype.EOL_CHAR = Text2.prototype.EOL_CHAR_LF;
    Text2.prototype.TAB_CHAR = "—";
    Text2.prototype.SPACE_CHAR = "·";
    Text2.prototype.$padding = 0;
    Text2.prototype.MAX_LINE_LENGTH = 1e4;
    Text2.prototype.showInvisibles = false;
    Text2.prototype.showSpaces = false;
    Text2.prototype.showTabs = false;
    Text2.prototype.showEOL = false;
    Text2.prototype.displayIndentGuides = true;
    Text2.prototype.$highlightIndentGuides = true;
    Text2.prototype.$tabStrings = [];
    Text2.prototype.destroy = {};
    Text2.prototype.onChangeTabSize = Text2.prototype.$computeTabString;
    oop.implement(Text2.prototype, EventEmitter2);
    exports3.Text = Text2;
  });
  ace.define("ace/layer/cursor", ["require", "exports", "module", "ace/lib/dom"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Cursor = (
      /** @class */
      function() {
        function Cursor2(parentEl) {
          this.element = dom.createElement("div");
          this.element.className = "ace_layer ace_cursor-layer";
          parentEl.appendChild(this.element);
          this.isVisible = false;
          this.isBlinking = true;
          this.blinkInterval = 1e3;
          this.smoothBlinking = false;
          this.cursors = [];
          this.cursor = this.addCursor();
          dom.addCssClass(this.element, "ace_hidden-cursors");
          this.$updateCursors = this.$updateOpacity.bind(this);
        }
        Cursor2.prototype.$updateOpacity = function(val) {
          var cursors = this.cursors;
          for (var i2 = cursors.length; i2--; )
            dom.setStyle(cursors[i2].style, "opacity", val ? "" : "0");
        };
        Cursor2.prototype.$startCssAnimation = function() {
          var cursors = this.cursors;
          for (var i2 = cursors.length; i2--; )
            cursors[i2].style.animationDuration = this.blinkInterval + "ms";
          this.$isAnimating = true;
          setTimeout((function() {
            if (this.$isAnimating) {
              dom.addCssClass(this.element, "ace_animate-blinking");
            }
          }).bind(this));
        };
        Cursor2.prototype.$stopCssAnimation = function() {
          this.$isAnimating = false;
          dom.removeCssClass(this.element, "ace_animate-blinking");
        };
        Cursor2.prototype.setPadding = function(padding) {
          this.$padding = padding;
        };
        Cursor2.prototype.setSession = function(session) {
          this.session = session;
        };
        Cursor2.prototype.setBlinking = function(blinking) {
          if (blinking != this.isBlinking) {
            this.isBlinking = blinking;
            this.restartTimer();
          }
        };
        Cursor2.prototype.setBlinkInterval = function(blinkInterval) {
          if (blinkInterval != this.blinkInterval) {
            this.blinkInterval = blinkInterval;
            this.restartTimer();
          }
        };
        Cursor2.prototype.setSmoothBlinking = function(smoothBlinking) {
          if (smoothBlinking != this.smoothBlinking) {
            this.smoothBlinking = smoothBlinking;
            dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking);
            this.$updateCursors(true);
            this.restartTimer();
          }
        };
        Cursor2.prototype.addCursor = function() {
          var el2 = dom.createElement("div");
          el2.className = "ace_cursor";
          this.element.appendChild(el2);
          this.cursors.push(el2);
          return el2;
        };
        Cursor2.prototype.removeCursor = function() {
          if (this.cursors.length > 1) {
            var el2 = this.cursors.pop();
            el2.parentNode.removeChild(el2);
            return el2;
          }
        };
        Cursor2.prototype.hideCursor = function() {
          this.isVisible = false;
          dom.addCssClass(this.element, "ace_hidden-cursors");
          this.restartTimer();
        };
        Cursor2.prototype.showCursor = function() {
          this.isVisible = true;
          dom.removeCssClass(this.element, "ace_hidden-cursors");
          this.restartTimer();
        };
        Cursor2.prototype.restartTimer = function() {
          var update = this.$updateCursors;
          clearInterval(this.intervalId);
          clearTimeout(this.timeoutId);
          this.$stopCssAnimation();
          if (this.smoothBlinking) {
            this.$isSmoothBlinking = false;
            dom.removeCssClass(this.element, "ace_smooth-blinking");
          }
          update(true);
          if (!this.isBlinking || !this.blinkInterval || !this.isVisible) {
            this.$stopCssAnimation();
            return;
          }
          if (this.smoothBlinking) {
            this.$isSmoothBlinking = true;
            setTimeout((function() {
              if (this.$isSmoothBlinking) {
                dom.addCssClass(this.element, "ace_smooth-blinking");
              }
            }).bind(this));
          }
          if (dom.HAS_CSS_ANIMATION) {
            this.$startCssAnimation();
          } else {
            var blink = (
              /**@this{Cursor}*/
              (function() {
                this.timeoutId = setTimeout(function() {
                  update(false);
                }, 0.6 * this.blinkInterval);
              }).bind(this)
            );
            this.intervalId = setInterval(function() {
              update(true);
              blink();
            }, this.blinkInterval);
            blink();
          }
        };
        Cursor2.prototype.getPixelPosition = function(position2, onScreen) {
          if (!this.config || !this.session)
            return { left: 0, top: 0 };
          if (!position2)
            position2 = this.session.selection.getCursor();
          var pos = this.session.documentToScreenPosition(position2);
          var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position2.row) ? this.session.$bidiHandler.getPosLeft(pos.column) : pos.column * this.config.characterWidth);
          var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * this.config.lineHeight;
          return { left: cursorLeft, top: cursorTop };
        };
        Cursor2.prototype.isCursorInView = function(pixelPos, config2) {
          return pixelPos.top >= 0 && pixelPos.top < config2.maxHeight;
        };
        Cursor2.prototype.update = function(config2) {
          this.config = config2;
          var selections = this.session.$selectionMarkers;
          var i2 = 0, cursorIndex = 0;
          if (selections === void 0 || selections.length === 0) {
            selections = [{ cursor: null }];
          }
          for (var i2 = 0, n2 = selections.length; i2 < n2; i2++) {
            var pixelPos = this.getPixelPosition(selections[i2].cursor, true);
            if ((pixelPos.top > config2.height + config2.offset || pixelPos.top < 0) && i2 > 1) {
              continue;
            }
            var element2 = this.cursors[cursorIndex++] || this.addCursor();
            var style2 = element2.style;
            if (!this.drawCursor) {
              if (!this.isCursorInView(pixelPos, config2)) {
                dom.setStyle(style2, "display", "none");
              } else {
                dom.setStyle(style2, "display", "block");
                dom.translate(element2, pixelPos.left, pixelPos.top);
                dom.setStyle(style2, "width", Math.round(config2.characterWidth) + "px");
                dom.setStyle(style2, "height", config2.lineHeight + "px");
              }
            } else {
              this.drawCursor(element2, pixelPos, config2, selections[i2], this.session);
            }
          }
          while (this.cursors.length > cursorIndex)
            this.removeCursor();
          var overwrite = this.session.getOverwrite();
          this.$setOverwrite(overwrite);
          this.$pixelPos = pixelPos;
          this.restartTimer();
        };
        Cursor2.prototype.$setOverwrite = function(overwrite) {
          if (overwrite != this.overwrite) {
            this.overwrite = overwrite;
            if (overwrite)
              dom.addCssClass(this.element, "ace_overwrite-cursors");
            else
              dom.removeCssClass(this.element, "ace_overwrite-cursors");
          }
        };
        Cursor2.prototype.destroy = function() {
          clearInterval(this.intervalId);
          clearTimeout(this.timeoutId);
        };
        return Cursor2;
      }()
    );
    Cursor.prototype.$padding = 0;
    Cursor.prototype.drawCursor = null;
    exports3.Cursor = Cursor;
  });
  ace.define("ace/scrollbar", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var event = require2("./lib/event");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var MAX_SCROLL_H = 32768;
    var Scrollbar = (
      /** @class */
      function() {
        function Scrollbar2(parent, classSuffix) {
          this.element = dom.createElement("div");
          this.element.className = "ace_scrollbar ace_scrollbar" + classSuffix;
          this.inner = dom.createElement("div");
          this.inner.className = "ace_scrollbar-inner";
          this.inner.textContent = " ";
          this.element.appendChild(this.inner);
          parent.appendChild(this.element);
          this.setVisible(false);
          this.skipEvent = false;
          event.addListener(this.element, "scroll", this.onScroll.bind(this));
          event.addListener(this.element, "mousedown", event.preventDefault);
        }
        Scrollbar2.prototype.setVisible = function(isVisible2) {
          this.element.style.display = isVisible2 ? "" : "none";
          this.isVisible = isVisible2;
          this.coeff = 1;
        };
        return Scrollbar2;
      }()
    );
    oop.implement(Scrollbar.prototype, EventEmitter2);
    var VScrollBar = (
      /** @class */
      function(_super) {
        __extends2(VScrollBar2, _super);
        function VScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-v") || this;
          _this.scrollTop = 0;
          _this.scrollHeight = 0;
          renderer.$scrollbarWidth = _this.width = dom.scrollbarWidth(parent.ownerDocument);
          _this.inner.style.width = _this.element.style.width = (_this.width || 15) + 5 + "px";
          _this.$minWidth = 0;
          return _this;
        }
        VScrollBar2.prototype.onScroll = function() {
          if (!this.skipEvent) {
            this.scrollTop = this.element.scrollTop;
            if (this.coeff != 1) {
              var h3 = this.element.clientHeight / this.scrollHeight;
              this.scrollTop = this.scrollTop * (1 - h3) / (this.coeff - h3);
            }
            this._emit("scroll", { data: this.scrollTop });
          }
          this.skipEvent = false;
        };
        VScrollBar2.prototype.getWidth = function() {
          return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
        };
        VScrollBar2.prototype.setHeight = function(height) {
          this.element.style.height = height + "px";
        };
        VScrollBar2.prototype.setScrollHeight = function(height) {
          this.scrollHeight = height;
          if (height > MAX_SCROLL_H) {
            this.coeff = MAX_SCROLL_H / height;
            height = MAX_SCROLL_H;
          } else if (this.coeff != 1) {
            this.coeff = 1;
          }
          this.inner.style.height = height + "px";
        };
        VScrollBar2.prototype.setScrollTop = function(scrollTop) {
          if (this.scrollTop != scrollTop) {
            this.skipEvent = true;
            this.scrollTop = scrollTop;
            this.element.scrollTop = scrollTop * this.coeff;
          }
        };
        return VScrollBar2;
      }(Scrollbar)
    );
    VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight;
    var HScrollBar = (
      /** @class */
      function(_super) {
        __extends2(HScrollBar2, _super);
        function HScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-h") || this;
          _this.scrollLeft = 0;
          _this.height = renderer.$scrollbarWidth;
          _this.inner.style.height = _this.element.style.height = (_this.height || 15) + 5 + "px";
          return _this;
        }
        HScrollBar2.prototype.onScroll = function() {
          if (!this.skipEvent) {
            this.scrollLeft = this.element.scrollLeft;
            this._emit("scroll", { data: this.scrollLeft });
          }
          this.skipEvent = false;
        };
        HScrollBar2.prototype.getHeight = function() {
          return this.isVisible ? this.height : 0;
        };
        HScrollBar2.prototype.setWidth = function(width) {
          this.element.style.width = width + "px";
        };
        HScrollBar2.prototype.setInnerWidth = function(width) {
          this.inner.style.width = width + "px";
        };
        HScrollBar2.prototype.setScrollWidth = function(width) {
          this.inner.style.width = width + "px";
        };
        HScrollBar2.prototype.setScrollLeft = function(scrollLeft) {
          if (this.scrollLeft != scrollLeft) {
            this.skipEvent = true;
            this.scrollLeft = this.element.scrollLeft = scrollLeft;
          }
        };
        return HScrollBar2;
      }(Scrollbar)
    );
    exports3.ScrollBar = VScrollBar;
    exports3.ScrollBarV = VScrollBar;
    exports3.ScrollBarH = HScrollBar;
    exports3.VScrollBar = VScrollBar;
    exports3.HScrollBar = HScrollBar;
  });
  ace.define("ace/scrollbar_custom", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/event", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var __extends2 = this && this.__extends || /* @__PURE__ */ function() {
      var extendStatics2 = function(d2, b2) {
        extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
          d3.__proto__ = b3;
        } || function(d3, b3) {
          for (var p2 in b3)
            if (Object.prototype.hasOwnProperty.call(b3, p2))
              d3[p2] = b3[p2];
        };
        return extendStatics2(d2, b2);
      };
      return function(d2, b2) {
        if (typeof b2 !== "function" && b2 !== null)
          throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
        extendStatics2(d2, b2);
        function __() {
          this.constructor = d2;
        }
        d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
      };
    }();
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var event = require2("./lib/event");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    dom.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n  position: absolute;\n  background: rgba(128, 128, 128, 0.6);\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n  border: 1px solid #bbb;\n  border-radius: 2px;\n  z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n  position: absolute;\n  z-index: 6;\n  background: none;\n  overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n  z-index: 6;\n  right: 0;\n  top: 0;\n  width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n  z-index: 8;\n  right: 0;\n  width: 100%;\n}\n.ace_editor>.ace_sb-h {\n  bottom: 0;\n  left: 0;\n  height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n  bottom: 0;\n  height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n  z-index: 8;\n  background: #000;\n}", "ace_scrollbar.css", false);
    var ScrollBar2 = (
      /** @class */
      function() {
        function ScrollBar3(parent, classSuffix) {
          this.element = dom.createElement("div");
          this.element.className = "ace_sb" + classSuffix;
          this.inner = dom.createElement("div");
          this.inner.className = "";
          this.element.appendChild(this.inner);
          this.VScrollWidth = 12;
          this.HScrollHeight = 12;
          parent.appendChild(this.element);
          this.setVisible(false);
          this.skipEvent = false;
          event.addMultiMouseDownListener(this.element, [500, 300, 300], this, "onMouseDown");
        }
        ScrollBar3.prototype.setVisible = function(isVisible2) {
          this.element.style.display = isVisible2 ? "" : "none";
          this.isVisible = isVisible2;
          this.coeff = 1;
        };
        return ScrollBar3;
      }()
    );
    oop.implement(ScrollBar2.prototype, EventEmitter2);
    var VScrollBar = (
      /** @class */
      function(_super) {
        __extends2(VScrollBar2, _super);
        function VScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-v") || this;
          _this.scrollTop = 0;
          _this.scrollHeight = 0;
          _this.parent = parent;
          _this.width = _this.VScrollWidth;
          _this.renderer = renderer;
          _this.inner.style.width = _this.element.style.width = (_this.width || 15) + "px";
          _this.$minWidth = 0;
          return _this;
        }
        VScrollBar2.prototype.onMouseDown = function(eType, e2) {
          if (eType !== "mousedown")
            return;
          if (event.getButton(e2) !== 0 || e2.detail === 2) {
            return;
          }
          if (e2.target === this.inner) {
            var self2 = this;
            var mousePageY = e2.clientY;
            var onMouseMove = function(e3) {
              mousePageY = e3.clientY;
            };
            var onMouseUp = function() {
              clearInterval(timerId);
            };
            var startY = e2.clientY;
            var startTop = this.thumbTop;
            var onScrollInterval = function() {
              if (mousePageY === void 0)
                return;
              var scrollTop = self2.scrollTopFromThumbTop(startTop + mousePageY - startY);
              if (scrollTop === self2.scrollTop)
                return;
              self2._emit("scroll", { data: scrollTop });
            };
            event.capture(this.inner, onMouseMove, onMouseUp);
            var timerId = setInterval(onScrollInterval, 20);
            return event.preventDefault(e2);
          }
          var top2 = e2.clientY - this.element.getBoundingClientRect().top - this.thumbHeight / 2;
          this._emit("scroll", { data: this.scrollTopFromThumbTop(top2) });
          return event.preventDefault(e2);
        };
        VScrollBar2.prototype.getHeight = function() {
          return this.height;
        };
        VScrollBar2.prototype.scrollTopFromThumbTop = function(thumbTop) {
          var scrollTop = thumbTop * (this.pageHeight - this.viewHeight) / (this.slideHeight - this.thumbHeight);
          scrollTop = scrollTop >> 0;
          if (scrollTop < 0) {
            scrollTop = 0;
          } else if (scrollTop > this.pageHeight - this.viewHeight) {
            scrollTop = this.pageHeight - this.viewHeight;
          }
          return scrollTop;
        };
        VScrollBar2.prototype.getWidth = function() {
          return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0);
        };
        VScrollBar2.prototype.setHeight = function(height) {
          this.height = Math.max(0, height);
          this.slideHeight = this.height;
          this.viewHeight = this.height;
          this.setScrollHeight(this.pageHeight, true);
        };
        VScrollBar2.prototype.setScrollHeight = function(height, force) {
          if (this.pageHeight === height && !force)
            return;
          this.pageHeight = height;
          this.thumbHeight = this.slideHeight * this.viewHeight / this.pageHeight;
          if (this.thumbHeight > this.slideHeight)
            this.thumbHeight = this.slideHeight;
          if (this.thumbHeight < 15)
            this.thumbHeight = 15;
          this.inner.style.height = this.thumbHeight + "px";
          if (this.scrollTop > this.pageHeight - this.viewHeight) {
            this.scrollTop = this.pageHeight - this.viewHeight;
            if (this.scrollTop < 0)
              this.scrollTop = 0;
            this._emit("scroll", { data: this.scrollTop });
          }
        };
        VScrollBar2.prototype.setScrollTop = function(scrollTop) {
          this.scrollTop = scrollTop;
          if (scrollTop < 0)
            scrollTop = 0;
          this.thumbTop = scrollTop * (this.slideHeight - this.thumbHeight) / (this.pageHeight - this.viewHeight);
          this.inner.style.top = this.thumbTop + "px";
        };
        return VScrollBar2;
      }(ScrollBar2)
    );
    VScrollBar.prototype.setInnerHeight = VScrollBar.prototype.setScrollHeight;
    var HScrollBar = (
      /** @class */
      function(_super) {
        __extends2(HScrollBar2, _super);
        function HScrollBar2(parent, renderer) {
          var _this = _super.call(this, parent, "-h") || this;
          _this.scrollLeft = 0;
          _this.scrollWidth = 0;
          _this.height = _this.HScrollHeight;
          _this.inner.style.height = _this.element.style.height = (_this.height || 12) + "px";
          _this.renderer = renderer;
          return _this;
        }
        HScrollBar2.prototype.onMouseDown = function(eType, e2) {
          if (eType !== "mousedown")
            return;
          if (event.getButton(e2) !== 0 || e2.detail === 2) {
            return;
          }
          if (e2.target === this.inner) {
            var self2 = this;
            var mousePageX = e2.clientX;
            var onMouseMove = function(e3) {
              mousePageX = e3.clientX;
            };
            var onMouseUp = function() {
              clearInterval(timerId);
            };
            var startX = e2.clientX;
            var startLeft = this.thumbLeft;
            var onScrollInterval = function() {
              if (mousePageX === void 0)
                return;
              var scrollLeft = self2.scrollLeftFromThumbLeft(startLeft + mousePageX - startX);
              if (scrollLeft === self2.scrollLeft)
                return;
              self2._emit("scroll", { data: scrollLeft });
            };
            event.capture(this.inner, onMouseMove, onMouseUp);
            var timerId = setInterval(onScrollInterval, 20);
            return event.preventDefault(e2);
          }
          var left2 = e2.clientX - this.element.getBoundingClientRect().left - this.thumbWidth / 2;
          this._emit("scroll", { data: this.scrollLeftFromThumbLeft(left2) });
          return event.preventDefault(e2);
        };
        HScrollBar2.prototype.getHeight = function() {
          return this.isVisible ? this.height : 0;
        };
        HScrollBar2.prototype.scrollLeftFromThumbLeft = function(thumbLeft) {
          var scrollLeft = thumbLeft * (this.pageWidth - this.viewWidth) / (this.slideWidth - this.thumbWidth);
          scrollLeft = scrollLeft >> 0;
          if (scrollLeft < 0) {
            scrollLeft = 0;
          } else if (scrollLeft > this.pageWidth - this.viewWidth) {
            scrollLeft = this.pageWidth - this.viewWidth;
          }
          return scrollLeft;
        };
        HScrollBar2.prototype.setWidth = function(width) {
          this.width = Math.max(0, width);
          this.element.style.width = this.width + "px";
          this.slideWidth = this.width;
          this.viewWidth = this.width;
          this.setScrollWidth(this.pageWidth, true);
        };
        HScrollBar2.prototype.setScrollWidth = function(width, force) {
          if (this.pageWidth === width && !force)
            return;
          this.pageWidth = width;
          this.thumbWidth = this.slideWidth * this.viewWidth / this.pageWidth;
          if (this.thumbWidth > this.slideWidth)
            this.thumbWidth = this.slideWidth;
          if (this.thumbWidth < 15)
            this.thumbWidth = 15;
          this.inner.style.width = this.thumbWidth + "px";
          if (this.scrollLeft > this.pageWidth - this.viewWidth) {
            this.scrollLeft = this.pageWidth - this.viewWidth;
            if (this.scrollLeft < 0)
              this.scrollLeft = 0;
            this._emit("scroll", { data: this.scrollLeft });
          }
        };
        HScrollBar2.prototype.setScrollLeft = function(scrollLeft) {
          this.scrollLeft = scrollLeft;
          if (scrollLeft < 0)
            scrollLeft = 0;
          this.thumbLeft = scrollLeft * (this.slideWidth - this.thumbWidth) / (this.pageWidth - this.viewWidth);
          this.inner.style.left = this.thumbLeft + "px";
        };
        return HScrollBar2;
      }(ScrollBar2)
    );
    HScrollBar.prototype.setInnerWidth = HScrollBar.prototype.setScrollWidth;
    exports3.ScrollBar = VScrollBar;
    exports3.ScrollBarV = VScrollBar;
    exports3.ScrollBarH = HScrollBar;
    exports3.VScrollBar = VScrollBar;
    exports3.HScrollBar = HScrollBar;
  });
  ace.define("ace/renderloop", ["require", "exports", "module", "ace/lib/event"], function(require2, exports3, module3) {
    var event = require2("./lib/event");
    var RenderLoop = (
      /** @class */
      function() {
        function RenderLoop2(onRender, win2) {
          this.onRender = onRender;
          this.pending = false;
          this.changes = 0;
          this.$recursionLimit = 2;
          this.window = win2 || window;
          var _self = this;
          this._flush = function(ts) {
            _self.pending = false;
            var changes = _self.changes;
            if (changes) {
              event.blockIdle(100);
              _self.changes = 0;
              _self.onRender(changes);
            }
            if (_self.changes) {
              if (_self.$recursionLimit-- < 0)
                return;
              _self.schedule();
            } else {
              _self.$recursionLimit = 2;
            }
          };
        }
        RenderLoop2.prototype.schedule = function(change) {
          this.changes = this.changes | change;
          if (this.changes && !this.pending) {
            event.nextFrame(this._flush);
            this.pending = true;
          }
        };
        RenderLoop2.prototype.clear = function(change) {
          var changes = this.changes;
          this.changes = 0;
          return changes;
        };
        return RenderLoop2;
      }()
    );
    exports3.RenderLoop = RenderLoop;
  });
  ace.define("ace/layer/font_metrics", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/lib/event", "ace/lib/useragent", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var dom = require2("../lib/dom");
    var lang2 = require2("../lib/lang");
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var CHAR_COUNT = 512;
    var USE_OBSERVER = typeof ResizeObserver == "function";
    var L2 = 200;
    var FontMetrics = (
      /** @class */
      function() {
        function FontMetrics2(parentEl) {
          this.el = dom.createElement("div");
          this.$setMeasureNodeStyles(this.el.style, true);
          this.$main = dom.createElement("div");
          this.$setMeasureNodeStyles(this.$main.style);
          this.$measureNode = dom.createElement("div");
          this.$setMeasureNodeStyles(this.$measureNode.style);
          this.el.appendChild(this.$main);
          this.el.appendChild(this.$measureNode);
          parentEl.appendChild(this.el);
          this.$measureNode.textContent = lang2.stringRepeat("X", CHAR_COUNT);
          this.$characterSize = { width: 0, height: 0 };
          if (USE_OBSERVER)
            this.$addObserver();
          else
            this.checkForSizeChanges();
        }
        FontMetrics2.prototype.$setMeasureNodeStyles = function(style2, isRoot) {
          style2.width = style2.height = "auto";
          style2.left = style2.top = "0px";
          style2.visibility = "hidden";
          style2.position = "absolute";
          style2.whiteSpace = "pre";
          if (useragent.isIE < 8) {
            style2["font-family"] = "inherit";
          } else {
            style2.font = "inherit";
          }
          style2.overflow = isRoot ? "hidden" : "visible";
        };
        FontMetrics2.prototype.checkForSizeChanges = function(size2) {
          if (size2 === void 0)
            size2 = this.$measureSizes();
          if (size2 && (this.$characterSize.width !== size2.width || this.$characterSize.height !== size2.height)) {
            this.$measureNode.style.fontWeight = "bold";
            var boldSize = this.$measureSizes();
            this.$measureNode.style.fontWeight = "";
            this.$characterSize = size2;
            this.charSizes = /* @__PURE__ */ Object.create(null);
            this.allowBoldFonts = boldSize && boldSize.width === size2.width && boldSize.height === size2.height;
            this._emit("changeCharacterSize", { data: size2 });
          }
        };
        FontMetrics2.prototype.$addObserver = function() {
          var self2 = this;
          this.$observer = new window.ResizeObserver(function(e2) {
            self2.checkForSizeChanges();
          });
          this.$observer.observe(this.$measureNode);
        };
        FontMetrics2.prototype.$pollSizeChanges = function() {
          if (this.$pollSizeChangesTimer || this.$observer)
            return this.$pollSizeChangesTimer;
          var self2 = this;
          return this.$pollSizeChangesTimer = event.onIdle(function cb2() {
            self2.checkForSizeChanges();
            event.onIdle(cb2, 500);
          }, 500);
        };
        FontMetrics2.prototype.setPolling = function(val) {
          if (val) {
            this.$pollSizeChanges();
          } else if (this.$pollSizeChangesTimer) {
            clearInterval(this.$pollSizeChangesTimer);
            this.$pollSizeChangesTimer = 0;
          }
        };
        FontMetrics2.prototype.$measureSizes = function(node2) {
          var size2 = {
            height: (node2 || this.$measureNode).clientHeight,
            width: (node2 || this.$measureNode).clientWidth / CHAR_COUNT
          };
          if (size2.width === 0 || size2.height === 0)
            return null;
          return size2;
        };
        FontMetrics2.prototype.$measureCharWidth = function(ch2) {
          this.$main.textContent = lang2.stringRepeat(ch2, CHAR_COUNT);
          var rect = this.$main.getBoundingClientRect();
          return rect.width / CHAR_COUNT;
        };
        FontMetrics2.prototype.getCharacterWidth = function(ch2) {
          var w2 = this.charSizes[ch2];
          if (w2 === void 0) {
            w2 = this.charSizes[ch2] = this.$measureCharWidth(ch2) / this.$characterSize.width;
          }
          return w2;
        };
        FontMetrics2.prototype.destroy = function() {
          clearInterval(this.$pollSizeChangesTimer);
          if (this.$observer)
            this.$observer.disconnect();
          if (this.el && this.el.parentNode)
            this.el.parentNode.removeChild(this.el);
        };
        FontMetrics2.prototype.$getZoom = function(element2) {
          if (!element2 || !element2.parentElement)
            return 1;
          return (Number(window.getComputedStyle(element2)["zoom"]) || 1) * this.$getZoom(element2.parentElement);
        };
        FontMetrics2.prototype.$initTransformMeasureNodes = function() {
          var t2 = function(t3, l2) {
            return ["div", {
              style: "position: absolute;top:" + t3 + "px;left:" + l2 + "px;"
            }];
          };
          this.els = dom.buildDom([t2(0, 0), t2(L2, 0), t2(0, L2), t2(L2, L2)], this.el);
        };
        FontMetrics2.prototype.transformCoordinates = function(clientPos, elPos) {
          if (clientPos) {
            var zoom = this.$getZoom(this.el);
            clientPos = mul(1 / zoom, clientPos);
          }
          function solve(l1, l2, r2) {
            var det = l1[1] * l2[0] - l1[0] * l2[1];
            return [
              (-l2[1] * r2[0] + l2[0] * r2[1]) / det,
              (+l1[1] * r2[0] - l1[0] * r2[1]) / det
            ];
          }
          function sub(a3, b3) {
            return [a3[0] - b3[0], a3[1] - b3[1]];
          }
          function add2(a3, b3) {
            return [a3[0] + b3[0], a3[1] + b3[1]];
          }
          function mul(a3, b3) {
            return [a3 * b3[0], a3 * b3[1]];
          }
          if (!this.els)
            this.$initTransformMeasureNodes();
          function p2(el2) {
            var r2 = el2.getBoundingClientRect();
            return [r2.left, r2.top];
          }
          var a2 = p2(this.els[0]);
          var b2 = p2(this.els[1]);
          var c2 = p2(this.els[2]);
          var d2 = p2(this.els[3]);
          var h3 = solve(sub(d2, b2), sub(d2, c2), sub(add2(b2, c2), add2(d2, a2)));
          var m1 = mul(1 + h3[0], sub(b2, a2));
          var m2 = mul(1 + h3[1], sub(c2, a2));
          if (elPos) {
            var x2 = elPos;
            var k2 = h3[0] * x2[0] / L2 + h3[1] * x2[1] / L2 + 1;
            var ut = add2(mul(x2[0], m1), mul(x2[1], m2));
            return add2(mul(1 / k2 / L2, ut), a2);
          }
          var u2 = sub(clientPos, a2);
          var f2 = solve(sub(m1, mul(h3[0], u2)), sub(m2, mul(h3[1], u2)), u2);
          return mul(L2, f2);
        };
        return FontMetrics2;
      }()
    );
    FontMetrics.prototype.$characterSize = { width: 0, height: 0 };
    oop.implement(FontMetrics.prototype, EventEmitter2);
    exports3.FontMetrics = FontMetrics;
  });
  ace.define("ace/css/editor-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = `
.ace_br1 {border-top-left-radius    : 3px;}
.ace_br2 {border-top-right-radius   : 3px;}
.ace_br3 {border-top-left-radius    : 3px; border-top-right-radius:    3px;}
.ace_br4 {border-bottom-right-radius: 3px;}
.ace_br5 {border-top-left-radius    : 3px; border-bottom-right-radius: 3px;}
.ace_br6 {border-top-right-radius   : 3px; border-bottom-right-radius: 3px;}
.ace_br7 {border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px;}
.ace_br8 {border-bottom-left-radius : 3px;}
.ace_br9 {border-top-left-radius    : 3px; border-bottom-left-radius:  3px;}
.ace_br10{border-top-right-radius   : 3px; border-bottom-left-radius:  3px;}
.ace_br11{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-left-radius:  3px;}
.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br13{border-top-left-radius    : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br14{border-top-right-radius   : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius:  3px;}
.ace_br15{border-top-left-radius    : 3px; border-top-right-radius:    3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}


.ace_editor {
    position: relative;
    overflow: hidden;
    padding: 0;
    font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', monospace;
    direction: ltr;
    text-align: left;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    forced-color-adjust: none;
}

.ace_scroller {
    position: absolute;
    overflow: hidden;
    top: 0;
    bottom: 0;
    background-color: inherit;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: text;
}

.ace_content {
    position: absolute;
    box-sizing: border-box;
    min-width: 100%;
    contain: style size layout;
    font-variant-ligatures: no-common-ligatures;
}
.ace_invisible {
    font-variant-ligatures: none;
}

.ace_keyboard-focus:focus {
    box-shadow: inset 0 0 0 2px #5E9ED6;
    outline: none;
}

.ace_dragging .ace_scroller:before{
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    content: '';
    background: rgba(250, 250, 250, 0.01);
    z-index: 1000;
}
.ace_dragging.ace_dark .ace_scroller:before{
    background: rgba(0, 0, 0, 0.01);
}

.ace_gutter {
    position: absolute;
    overflow : hidden;
    width: auto;
    top: 0;
    bottom: 0;
    left: 0;
    cursor: default;
    z-index: 4;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    contain: style size layout;
}

.ace_gutter-active-line {
    position: absolute;
    left: 0;
    right: 0;
}

.ace_scroller.ace_scroll-left:after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
    pointer-events: none;
}

.ace_gutter-cell, .ace_gutter-cell_svg-icons {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding-left: 19px;
    padding-right: 6px;
    background-repeat: no-repeat;
}

.ace_gutter-cell_svg-icons .ace_gutter_annotation {
    margin-left: -14px;
    float: left;
}

.ace_gutter-cell .ace_gutter_annotation {
    margin-left: -19px;
    float: left;
}

.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");
}

.ace_icon_svg.ace_error {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");
    background-color: crimson;
}
.ace_icon_svg.ace_security {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");
    background-color: crimson;
}
.ace_icon_svg.ace_warning {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");
    background-color: darkorange;
}
.ace_icon_svg.ace_info {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");
    background-color: royalblue;
}
.ace_icon_svg.ace_hint {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");
    background-color: silver;
}

.ace_icon_svg.ace_error_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
    background-color: crimson;
}
.ace_icon_svg.ace_security_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
    background-color: crimson;
}
.ace_icon_svg.ace_warning_fold {
    -webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");
    background-color: darkorange;
}

.ace_scrollbar {
    contain: strict;
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 6;
}

.ace_scrollbar-inner {
    position: absolute;
    cursor: text;
    left: 0;
    top: 0;
}

.ace_scrollbar-v{
    overflow-x: hidden;
    overflow-y: scroll;
    top: 0;
}

.ace_scrollbar-h {
    overflow-x: scroll;
    overflow-y: hidden;
    left: 0;
}

.ace_print-margin {
    position: absolute;
    height: 100%;
}

.ace_text-input {
    position: absolute;
    z-index: 0;
    width: 0.5em;
    height: 1em;
    opacity: 0;
    background: transparent;
    -moz-appearance: none;
    appearance: none;
    border: none;
    resize: none;
    outline: none;
    overflow: hidden;
    font: inherit;
    padding: 0 1px;
    margin: 0 -1px;
    contain: strict;
    -ms-user-select: text;
    -moz-user-select: text;
    -webkit-user-select: text;
    user-select: text;
    /*with \`pre-line\` chrome inserts &nbsp; instead of space*/
    white-space: pre!important;
}
.ace_text-input.ace_composition {
    background: transparent;
    color: inherit;
    z-index: 1000;
    opacity: 1;
}
.ace_composition_placeholder { color: transparent }
.ace_composition_marker { 
    border-bottom: 1px solid;
    position: absolute;
    border-radius: 0;
    margin-top: 1px;
}

[ace_nocontext=true] {
    transform: none!important;
    filter: none!important;
    clip-path: none!important;
    mask : none!important;
    contain: none!important;
    perspective: none!important;
    mix-blend-mode: initial!important;
    z-index: auto;
}

.ace_layer {
    z-index: 1;
    position: absolute;
    overflow: hidden;
    /* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/
    word-wrap: normal;
    white-space: pre;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
    /* setting pointer-events: auto; on node under the mouse, which changes
        during scroll, will break mouse wheel scrolling in Safari */
    pointer-events: none;
}

.ace_gutter-layer {
    position: relative;
    width: auto;
    text-align: right;
    pointer-events: auto;
    height: 1000000px;
    contain: style size layout;
}

.ace_text-layer {
    font: inherit !important;
    position: absolute;
    height: 1000000px;
    width: 1000000px;
    contain: style size layout;
}

.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {
    contain: style size layout;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.ace_hidpi .ace_text-layer,
.ace_hidpi .ace_gutter-layer,
.ace_hidpi .ace_content,
.ace_hidpi .ace_gutter {
    contain: strict;
}
.ace_hidpi .ace_text-layer > .ace_line, 
.ace_hidpi .ace_text-layer > .ace_line_group {
    contain: strict;
}

.ace_cjk {
    display: inline-block;
    text-align: center;
}

.ace_cursor-layer {
    z-index: 4;
}

.ace_cursor {
    z-index: 4;
    position: absolute;
    box-sizing: border-box;
    border-left: 2px solid;
    /* workaround for smooth cursor repaintng whole screen in chrome */
    transform: translatez(0);
}

.ace_multiselect .ace_cursor {
    border-left-width: 1px;
}

.ace_slim-cursors .ace_cursor {
    border-left-width: 1px;
}

.ace_overwrite-cursors .ace_cursor {
    border-left-width: 0;
    border-bottom: 1px solid;
}

.ace_hidden-cursors .ace_cursor {
    opacity: 0.2;
}

.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {
    opacity: 0;
}

.ace_smooth-blinking .ace_cursor {
    transition: opacity 0.18s;
}

.ace_animate-blinking .ace_cursor {
    animation-duration: 1000ms;
    animation-timing-function: step-end;
    animation-name: blink-ace-animate;
    animation-iteration-count: infinite;
}

.ace_animate-blinking.ace_smooth-blinking .ace_cursor {
    animation-duration: 1000ms;
    animation-timing-function: ease-in-out;
    animation-name: blink-ace-animate-smooth;
}
    
@keyframes blink-ace-animate {
    from, to { opacity: 1; }
    60% { opacity: 0; }
}

@keyframes blink-ace-animate-smooth {
    from, to { opacity: 1; }
    45% { opacity: 1; }
    60% { opacity: 0; }
    85% { opacity: 0; }
}

.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
    position: absolute;
    z-index: 3;
}

.ace_marker-layer .ace_selection {
    position: absolute;
    z-index: 5;
}

.ace_marker-layer .ace_bracket {
    position: absolute;
    z-index: 6;
}

.ace_marker-layer .ace_error_bracket {
    position: absolute;
    border-bottom: 1px solid #DE5555;
    border-radius: 0;
}

.ace_marker-layer .ace_active-line {
    position: absolute;
    z-index: 2;
}

.ace_marker-layer .ace_selected-word {
    position: absolute;
    z-index: 4;
    box-sizing: border-box;
}

.ace_line .ace_fold {
    box-sizing: border-box;

    display: inline-block;
    height: 11px;
    margin-top: -2px;
    vertical-align: middle;

    background-image:
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");
    background-repeat: no-repeat, repeat-x;
    background-position: center center, top left;
    color: transparent;

    border: 1px solid black;
    border-radius: 2px;

    cursor: pointer;
    pointer-events: auto;
}

.ace_dark .ace_fold {
}

.ace_fold:hover{
    background-image:
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
        url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");
}

.ace_tooltip {
    background-color: #f5f5f5;
    border: 1px solid gray;
    border-radius: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: black;
    padding: 3px 4px;
    position: fixed;
    z-index: 999999;
    box-sizing: border-box;
    cursor: default;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: normal;
    font-style: normal;
    font-weight: normal;
    letter-spacing: normal;
    pointer-events: none;
    overflow: auto;
    max-width: min(33em, 66vw);
    overscroll-behavior: contain;
}
.ace_tooltip pre {
    white-space: pre-wrap;
}

.ace_tooltip.ace_dark {
    background-color: #636363;
    color: #fff;
}

.ace_tooltip:focus {
    outline: 1px solid #5E9ED6;
}

.ace_icon {
    display: inline-block;
    width: 18px;
    vertical-align: top;
}

.ace_icon_svg {
    display: inline-block;
    width: 12px;
    vertical-align: top;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 12px;
    -webkit-mask-position: center;
}

.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {
    padding-right: 13px;
}

.ace_fold-widget, .ace_custom-widget {
    box-sizing: border-box;

    margin: 0 -12px 0 1px;
    display: none;
    width: 11px;
    vertical-align: top;

    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");
    background-repeat: no-repeat;
    background-position: center;

    border-radius: 3px;
    
    border: 1px solid transparent;
    cursor: pointer;
    pointer-events: auto;
}

.ace_custom-widget {
    background: none;
}

.ace_folding-enabled .ace_fold-widget {
    display: inline-block;   
}

.ace_fold-widget.ace_end {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");
}

.ace_fold-widget.ace_closed {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");
}

.ace_fold-widget:hover {
    border: 1px solid rgba(0, 0, 0, 0.3);
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}

.ace_fold-widget:active {
    border: 1px solid rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
/**
 * Dark version for fold widgets
 */
.ace_dark .ace_fold-widget {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.ace_end {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.ace_closed {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.1);
}
.ace_dark .ace_fold-widget:active {
    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}

.ace_inline_button {
    border: 1px solid lightgray;
    display: inline-block;
    margin: -1px 8px;
    padding: 0 5px;
    pointer-events: auto;
    cursor: pointer;
}
.ace_inline_button:hover {
    border-color: gray;
    background: rgba(200,200,200,0.2);
    display: inline-block;
    pointer-events: auto;
}

.ace_fold-widget.ace_invalid {
    background-color: #FFB4B4;
    border-color: #DE5555;
}

.ace_fade-fold-widgets .ace_fold-widget {
    transition: opacity 0.4s ease 0.05s;
    opacity: 0;
}

.ace_fade-fold-widgets:hover .ace_fold-widget {
    transition: opacity 0.05s ease 0.05s;
    opacity:1;
}

.ace_underline {
    text-decoration: underline;
}

.ace_bold {
    font-weight: bold;
}

.ace_nobold .ace_bold {
    font-weight: normal;
}

.ace_italic {
    font-style: italic;
}


.ace_error-marker {
    background-color: rgba(255, 0, 0,0.2);
    position: absolute;
    z-index: 9;
}

.ace_highlight-marker {
    background-color: rgba(255, 255, 0,0.2);
    position: absolute;
    z-index: 8;
}

.ace_mobile-menu {
    position: absolute;
    line-height: 1.5;
    border-radius: 4px;
    -ms-user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    background: white;
    box-shadow: 1px 3px 2px grey;
    border: 1px solid #dcdcdc;
    color: black;
}
.ace_dark > .ace_mobile-menu {
    background: #333;
    color: #ccc;
    box-shadow: 1px 3px 2px grey;
    border: 1px solid #444;

}
.ace_mobile-button {
    padding: 2px;
    cursor: pointer;
    overflow: hidden;
}
.ace_mobile-button:hover {
    background-color: #eee;
    opacity:1;
}
.ace_mobile-button:active {
    background-color: #ddd;
}

.ace_placeholder {
    position: relative;
    font-family: arial;
    transform: scale(0.9);
    transform-origin: left;
    white-space: pre;
    opacity: 0.7;
    margin: 0 10px;
    z-index: 1;
}

.ace_ghost_text {
    opacity: 0.5;
    font-style: italic;
}

.ace_ghost_text_container > div {
    white-space: pre;
}

.ghost_text_line_wrapped::after {
    content: "↩";
    position: absolute;
}

.ace_lineWidgetContainer.ace_ghost_text {
    margin: 0px 4px
}

.ace_screenreader-only {
    position:absolute;
    left:-10000px;
    top:auto;
    width:1px;
    height:1px;
    overflow:hidden;
}

.ace_hidden_token {
    display: none;
}`;
  });
  ace.define("ace/layer/decorators", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event_emitter"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var oop = require2("../lib/oop");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var Decorator = (
      /** @class */
      function() {
        function Decorator2(scrollbarV, renderer) {
          this.renderer = renderer;
          this.pixelRatio = 1;
          this.maxHeight = renderer.layerConfig.maxHeight;
          this.lineHeight = renderer.layerConfig.lineHeight;
          this.minDecorationHeight = 2 * this.pixelRatio | 0;
          this.halfMinDecorationHeight = this.minDecorationHeight / 2 | 0;
          this.colors = {};
          this.colors.dark = {
            "error": "rgba(255, 18, 18, 1)",
            "warning": "rgba(18, 136, 18, 1)",
            "info": "rgba(18, 18, 136, 1)"
          };
          this.colors.light = {
            "error": "rgb(255,51,51)",
            "warning": "rgb(32,133,72)",
            "info": "rgb(35,68,138)"
          };
          this.setScrollBarV(scrollbarV);
        }
        Decorator2.prototype.$createCanvas = function() {
          this.canvas = dom.createElement("canvas");
          this.canvas.style.top = "0px";
          this.canvas.style.right = "0px";
          this.canvas.style.zIndex = "7";
          this.canvas.style.position = "absolute";
        };
        Decorator2.prototype.setScrollBarV = function(scrollbarV) {
          this.$createCanvas();
          this.scrollbarV = scrollbarV;
          scrollbarV.element.appendChild(this.canvas);
          this.setDimensions();
        };
        Decorator2.prototype.$updateDecorators = function(config2) {
          if (typeof this.canvas.getContext !== "function") {
            return;
          }
          var colors2 = this.renderer.theme.isDark === true ? this.colors.dark : this.colors.light;
          this.setDimensions(config2);
          var ctx = this.canvas.getContext("2d");
          function compare(a2, b2) {
            if (a2.priority < b2.priority)
              return -1;
            if (a2.priority > b2.priority)
              return 1;
            return 0;
          }
          var annotations = this.renderer.session.$annotations;
          ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
          if (annotations) {
            var priorities2 = {
              "info": 1,
              "warning": 2,
              "error": 3
            };
            annotations.forEach(function(item) {
              item["priority"] = priorities2[item.type] || null;
            });
            annotations = annotations.sort(compare);
            for (var i2 = 0; i2 < annotations.length; i2++) {
              var row = annotations[i2].row;
              var offset1 = this.getVerticalOffsetForRow(row);
              var offset2 = offset1 + this.lineHeight;
              var y1 = Math.round(this.heightRatio * offset1);
              var y2 = Math.round(this.heightRatio * offset2);
              var ycenter = Math.round((y1 + y2) / 2);
              var halfHeight = y2 - ycenter;
              if (halfHeight < this.halfMinDecorationHeight) {
                halfHeight = this.halfMinDecorationHeight;
              }
              if (ycenter - halfHeight < 0) {
                ycenter = halfHeight;
              }
              if (ycenter + halfHeight > this.canvasHeight) {
                ycenter = this.canvasHeight - halfHeight;
              }
              var from2 = ycenter - halfHeight;
              var to2 = ycenter + halfHeight;
              var zoneHeight = to2 - from2;
              ctx.fillStyle = colors2[annotations[i2].type] || null;
              ctx.fillRect(0, from2, Math.round(this.oneZoneWidth - 1), zoneHeight);
            }
          }
          var cursor = this.renderer.session.selection.getCursor();
          if (cursor) {
            var currentY = Math.round(this.getVerticalOffsetForRow(cursor.row) * this.heightRatio);
            ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
            ctx.fillRect(0, currentY, this.canvasWidth, 2);
          }
        };
        Decorator2.prototype.getVerticalOffsetForRow = function(row) {
          row = row | 0;
          var offset2 = this.renderer.session.documentToScreenRow(row, 0) * this.lineHeight;
          return offset2;
        };
        Decorator2.prototype.setDimensions = function(config2) {
          config2 = config2 || this.renderer.layerConfig;
          this.maxHeight = config2.maxHeight;
          this.lineHeight = config2.lineHeight;
          this.canvasHeight = config2.height;
          this.canvasWidth = this.scrollbarV.width || this.canvasWidth;
          this.setZoneWidth();
          this.canvas.width = this.canvasWidth;
          this.canvas.height = this.canvasHeight;
          if (this.maxHeight < this.canvasHeight) {
            this.heightRatio = 1;
          } else {
            this.heightRatio = this.canvasHeight / this.maxHeight;
          }
        };
        Decorator2.prototype.setZoneWidth = function() {
          this.oneZoneWidth = this.canvasWidth;
        };
        Decorator2.prototype.destroy = function() {
          this.canvas.parentNode.removeChild(this.canvas);
        };
        return Decorator2;
      }()
    );
    oop.implement(Decorator.prototype, EventEmitter2);
    exports3.Decorator = Decorator;
  });
  ace.define("ace/virtual_renderer", ["require", "exports", "module", "ace/lib/oop", "ace/lib/dom", "ace/lib/lang", "ace/config", "ace/layer/gutter", "ace/layer/marker", "ace/layer/text", "ace/layer/cursor", "ace/scrollbar", "ace/scrollbar", "ace/scrollbar_custom", "ace/scrollbar_custom", "ace/renderloop", "ace/layer/font_metrics", "ace/lib/event_emitter", "ace/css/editor-css", "ace/layer/decorators", "ace/lib/useragent", "ace/layer/text_util"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    var dom = require2("./lib/dom");
    var lang2 = require2("./lib/lang");
    var config2 = require2("./config");
    var GutterLayer = require2("./layer/gutter").Gutter;
    var MarkerLayer = require2("./layer/marker").Marker;
    var TextLayer = require2("./layer/text").Text;
    var CursorLayer = require2("./layer/cursor").Cursor;
    var HScrollBar = require2("./scrollbar").HScrollBar;
    var VScrollBar = require2("./scrollbar").VScrollBar;
    var HScrollBarCustom = require2("./scrollbar_custom").HScrollBar;
    var VScrollBarCustom = require2("./scrollbar_custom").VScrollBar;
    var RenderLoop = require2("./renderloop").RenderLoop;
    var FontMetrics = require2("./layer/font_metrics").FontMetrics;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var editorCss = require2("./css/editor-css");
    var Decorator = require2("./layer/decorators").Decorator;
    var useragent = require2("./lib/useragent");
    var isTextToken = require2("./layer/text_util").isTextToken;
    dom.importCssString(editorCss, "ace_editor.css", false);
    var VirtualRenderer = (
      /** @class */
      function() {
        function VirtualRenderer2(container, theme2) {
          var _self = this;
          this.container = container || dom.createElement("div");
          dom.addCssClass(this.container, "ace_editor");
          if (dom.HI_DPI)
            dom.addCssClass(this.container, "ace_hidpi");
          this.setTheme(theme2);
          if (config2.get("useStrictCSP") == null)
            config2.set("useStrictCSP", false);
          this.$gutter = dom.createElement("div");
          this.$gutter.className = "ace_gutter";
          this.container.appendChild(this.$gutter);
          this.$gutter.setAttribute("aria-hidden", "true");
          this.scroller = dom.createElement("div");
          this.scroller.className = "ace_scroller";
          this.container.appendChild(this.scroller);
          this.content = dom.createElement("div");
          this.content.className = "ace_content";
          this.scroller.appendChild(this.content);
          this.$gutterLayer = new GutterLayer(this.$gutter);
          this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this));
          this.$markerBack = new MarkerLayer(this.content);
          var textLayer = this.$textLayer = new TextLayer(this.content);
          this.canvas = textLayer.element;
          this.$markerFront = new MarkerLayer(this.content);
          this.$cursorLayer = new CursorLayer(this.content);
          this.$horizScroll = false;
          this.$vScroll = false;
          this.scrollBar = this.scrollBarV = new VScrollBar(this.container, this);
          this.scrollBarH = new HScrollBar(this.container, this);
          this.scrollBarV.on("scroll", function(e2) {
            if (!_self.$scrollAnimation)
              _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
          });
          this.scrollBarH.on("scroll", function(e2) {
            if (!_self.$scrollAnimation)
              _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
          });
          this.scrollTop = 0;
          this.scrollLeft = 0;
          this.cursorPos = {
            row: 0,
            column: 0
          };
          this.$fontMetrics = new FontMetrics(this.container);
          this.$textLayer.$setFontMetrics(this.$fontMetrics);
          this.$textLayer.on("changeCharacterSize", function(e2) {
            _self.updateCharacterSize();
            _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height);
            _self._signal("changeCharacterSize", e2);
          });
          this.$size = {
            width: 0,
            height: 0,
            scrollerHeight: 0,
            scrollerWidth: 0,
            $dirty: true
          };
          this.layerConfig = {
            width: 1,
            padding: 0,
            firstRow: 0,
            firstRowScreen: 0,
            lastRow: 0,
            lineHeight: 0,
            characterWidth: 0,
            minHeight: 1,
            maxHeight: 1,
            offset: 0,
            height: 1,
            gutterOffset: 1
          };
          this.scrollMargin = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0,
            v: 0,
            h: 0
          };
          this.margin = {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0,
            v: 0,
            h: 0
          };
          this.$keepTextAreaAtCursor = !useragent.isIOS;
          this.$loop = new RenderLoop(this.$renderChanges.bind(this), this.container.ownerDocument.defaultView);
          this.$loop.schedule(this.CHANGE_FULL);
          this.updateCharacterSize();
          this.setPadding(4);
          this.$addResizeObserver();
          config2.resetOptions(this);
          config2._signal("renderer", this);
        }
        VirtualRenderer2.prototype.updateCharacterSize = function() {
          if (this.$textLayer.allowBoldFonts != this.$allowBoldFonts) {
            this.$allowBoldFonts = this.$textLayer.allowBoldFonts;
            this.setStyle("ace_nobold", !this.$allowBoldFonts);
          }
          this.layerConfig.characterWidth = this.characterWidth = this.$textLayer.getCharacterWidth();
          this.layerConfig.lineHeight = this.lineHeight = this.$textLayer.getLineHeight();
          this.$updatePrintMargin();
          dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px");
        };
        VirtualRenderer2.prototype.setSession = function(session) {
          if (this.session)
            this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode);
          this.session = session;
          if (session && this.scrollMargin.top && session.getScrollTop() <= 0)
            session.setScrollTop(-this.scrollMargin.top);
          this.$cursorLayer.setSession(session);
          this.$markerBack.setSession(session);
          this.$markerFront.setSession(session);
          this.$gutterLayer.setSession(session);
          this.$textLayer.setSession(session);
          if (!session)
            return;
          this.$loop.schedule(this.CHANGE_FULL);
          this.session.$setFontMetrics(this.$fontMetrics);
          this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
          this.onChangeNewLineMode = this.onChangeNewLineMode.bind(this);
          this.onChangeNewLineMode();
          this.session.doc.on("changeNewLineMode", this.onChangeNewLineMode);
        };
        VirtualRenderer2.prototype.updateLines = function(firstRow, lastRow, force) {
          if (lastRow === void 0)
            lastRow = Infinity;
          if (!this.$changedLines) {
            this.$changedLines = {
              firstRow,
              lastRow
            };
          } else {
            if (this.$changedLines.firstRow > firstRow)
              this.$changedLines.firstRow = firstRow;
            if (this.$changedLines.lastRow < lastRow)
              this.$changedLines.lastRow = lastRow;
          }
          if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
            if (force)
              this.$changedLines.lastRow = this.layerConfig.lastRow;
            else
              return;
          }
          if (this.$changedLines.firstRow > this.layerConfig.lastRow)
            return;
          this.$loop.schedule(this.CHANGE_LINES);
        };
        VirtualRenderer2.prototype.onChangeNewLineMode = function() {
          this.$loop.schedule(this.CHANGE_TEXT);
          this.$textLayer.$updateEolChar();
          this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR);
        };
        VirtualRenderer2.prototype.onChangeTabSize = function() {
          this.$loop.schedule(this.CHANGE_TEXT | this.CHANGE_MARKER);
          this.$textLayer.onChangeTabSize();
        };
        VirtualRenderer2.prototype.updateText = function() {
          this.$loop.schedule(this.CHANGE_TEXT);
        };
        VirtualRenderer2.prototype.updateFull = function(force) {
          if (force)
            this.$renderChanges(this.CHANGE_FULL, true);
          else
            this.$loop.schedule(this.CHANGE_FULL);
        };
        VirtualRenderer2.prototype.updateFontSize = function() {
          this.$textLayer.checkForSizeChanges();
        };
        VirtualRenderer2.prototype.$updateSizeAsync = function() {
          if (this.$loop.pending)
            this.$size.$dirty = true;
          else
            this.onResize();
        };
        VirtualRenderer2.prototype.onResize = function(force, gutterWidth, width, height) {
          if (this.resizing > 2)
            return;
          else if (this.resizing > 0)
            this.resizing++;
          else
            this.resizing = force ? 1 : 0;
          var el2 = this.container;
          if (!height)
            height = el2.clientHeight || el2.scrollHeight;
          if (!height && this.$maxLines && this.lineHeight > 1) {
            if (!el2.style.height || el2.style.height == "0px") {
              el2.style.height = "1px";
              height = el2.clientHeight || el2.scrollHeight;
            }
          }
          if (!width)
            width = el2.clientWidth || el2.scrollWidth;
          var changes = this.$updateCachedSize(force, gutterWidth, width, height);
          if (this.$resizeTimer)
            this.$resizeTimer.cancel();
          if (!this.$size.scrollerHeight || !width && !height)
            return this.resizing = 0;
          if (force)
            this.$gutterLayer.$padding = null;
          if (force)
            this.$renderChanges(changes | this.$changes, true);
          else
            this.$loop.schedule(changes | this.$changes);
          if (this.resizing)
            this.resizing = 0;
          this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null;
          if (this.$customScrollbar) {
            this.$updateCustomScrollbar(true);
          }
        };
        VirtualRenderer2.prototype.$updateCachedSize = function(force, gutterWidth, width, height) {
          height -= this.$extraHeight || 0;
          var changes = 0;
          var size2 = this.$size;
          var oldSize = {
            width: size2.width,
            height: size2.height,
            scrollerHeight: size2.scrollerHeight,
            scrollerWidth: size2.scrollerWidth
          };
          if (height && (force || size2.height != height)) {
            size2.height = height;
            changes |= this.CHANGE_SIZE;
            size2.scrollerHeight = size2.height;
            if (this.$horizScroll)
              size2.scrollerHeight -= this.scrollBarH.getHeight();
            this.scrollBarV.setHeight(size2.scrollerHeight);
            this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px";
            changes = changes | this.CHANGE_SCROLL;
          }
          if (width && (force || size2.width != width)) {
            changes |= this.CHANGE_SIZE;
            size2.width = width;
            if (gutterWidth == null)
              gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0;
            this.gutterWidth = gutterWidth;
            dom.setStyle(this.scrollBarH.element.style, "left", gutterWidth + "px");
            dom.setStyle(this.scroller.style, "left", gutterWidth + this.margin.left + "px");
            size2.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h);
            dom.setStyle(this.$gutter.style, "left", this.margin.left + "px");
            var right = this.scrollBarV.getWidth() + "px";
            dom.setStyle(this.scrollBarH.element.style, "right", right);
            dom.setStyle(this.scroller.style, "right", right);
            dom.setStyle(this.scroller.style, "bottom", this.scrollBarH.getHeight());
            this.scrollBarH.setWidth(size2.scrollerWidth);
            if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) {
              changes |= this.CHANGE_FULL;
            }
          }
          size2.$dirty = !width || !height;
          if (changes)
            this._signal("resize", oldSize);
          return changes;
        };
        VirtualRenderer2.prototype.onGutterResize = function(width) {
          var gutterWidth = this.$showGutter ? width : 0;
          if (gutterWidth != this.gutterWidth)
            this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height);
          if (this.session.getUseWrapMode() && this.adjustWrapLimit()) {
            this.$loop.schedule(this.CHANGE_FULL);
          } else if (this.$size.$dirty) {
            this.$loop.schedule(this.CHANGE_FULL);
          } else {
            this.$computeLayerConfig();
          }
        };
        VirtualRenderer2.prototype.adjustWrapLimit = function() {
          var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
          var limit2 = Math.floor(availableWidth / this.characterWidth);
          return this.session.adjustWrapLimit(limit2, this.$showPrintMargin && this.$printMarginColumn);
        };
        VirtualRenderer2.prototype.setAnimatedScroll = function(shouldAnimate) {
          this.setOption("animatedScroll", shouldAnimate);
        };
        VirtualRenderer2.prototype.getAnimatedScroll = function() {
          return this.$animatedScroll;
        };
        VirtualRenderer2.prototype.setShowInvisibles = function(showInvisibles) {
          this.setOption("showInvisibles", showInvisibles);
          this.session.$bidiHandler.setShowInvisibles(showInvisibles);
        };
        VirtualRenderer2.prototype.getShowInvisibles = function() {
          return this.getOption("showInvisibles");
        };
        VirtualRenderer2.prototype.getDisplayIndentGuides = function() {
          return this.getOption("displayIndentGuides");
        };
        VirtualRenderer2.prototype.setDisplayIndentGuides = function(display) {
          this.setOption("displayIndentGuides", display);
        };
        VirtualRenderer2.prototype.getHighlightIndentGuides = function() {
          return this.getOption("highlightIndentGuides");
        };
        VirtualRenderer2.prototype.setHighlightIndentGuides = function(highlight) {
          this.setOption("highlightIndentGuides", highlight);
        };
        VirtualRenderer2.prototype.setShowPrintMargin = function(showPrintMargin) {
          this.setOption("showPrintMargin", showPrintMargin);
        };
        VirtualRenderer2.prototype.getShowPrintMargin = function() {
          return this.getOption("showPrintMargin");
        };
        VirtualRenderer2.prototype.setPrintMarginColumn = function(printMarginColumn) {
          this.setOption("printMarginColumn", printMarginColumn);
        };
        VirtualRenderer2.prototype.getPrintMarginColumn = function() {
          return this.getOption("printMarginColumn");
        };
        VirtualRenderer2.prototype.getShowGutter = function() {
          return this.getOption("showGutter");
        };
        VirtualRenderer2.prototype.setShowGutter = function(show) {
          return this.setOption("showGutter", show);
        };
        VirtualRenderer2.prototype.getFadeFoldWidgets = function() {
          return this.getOption("fadeFoldWidgets");
        };
        VirtualRenderer2.prototype.setFadeFoldWidgets = function(show) {
          this.setOption("fadeFoldWidgets", show);
        };
        VirtualRenderer2.prototype.setHighlightGutterLine = function(shouldHighlight) {
          this.setOption("highlightGutterLine", shouldHighlight);
        };
        VirtualRenderer2.prototype.getHighlightGutterLine = function() {
          return this.getOption("highlightGutterLine");
        };
        VirtualRenderer2.prototype.$updatePrintMargin = function() {
          if (!this.$showPrintMargin && !this.$printMarginEl)
            return;
          if (!this.$printMarginEl) {
            var containerEl = dom.createElement("div");
            containerEl.className = "ace_layer ace_print-margin-layer";
            this.$printMarginEl = dom.createElement("div");
            this.$printMarginEl.className = "ace_print-margin";
            containerEl.appendChild(this.$printMarginEl);
            this.content.insertBefore(containerEl, this.content.firstChild);
          }
          var style2 = this.$printMarginEl.style;
          style2.left = Math.round(this.characterWidth * this.$printMarginColumn + this.$padding) + "px";
          style2.visibility = this.$showPrintMargin ? "visible" : "hidden";
          if (this.session && this.session.$wrap == -1)
            this.adjustWrapLimit();
        };
        VirtualRenderer2.prototype.getContainerElement = function() {
          return this.container;
        };
        VirtualRenderer2.prototype.getMouseEventTarget = function() {
          return this.scroller;
        };
        VirtualRenderer2.prototype.getTextAreaContainer = function() {
          return this.container;
        };
        VirtualRenderer2.prototype.$moveTextAreaToCursor = function() {
          if (this.$isMousePressed)
            return;
          var style2 = this.textarea.style;
          var composition = this.$composition;
          if (!this.$keepTextAreaAtCursor && !composition) {
            dom.translate(this.textarea, -100, 0);
            return;
          }
          var pixelPos = this.$cursorLayer.$pixelPos;
          if (!pixelPos)
            return;
          if (composition && composition.markerRange)
            pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true);
          var config3 = this.layerConfig;
          var posTop = pixelPos.top;
          var posLeft = pixelPos.left;
          posTop -= config3.offset;
          var h3 = composition && composition.useTextareaForIME || useragent.isMobile ? this.lineHeight : 1;
          if (posTop < 0 || posTop > config3.height - h3) {
            dom.translate(this.textarea, 0, 0);
            return;
          }
          var w2 = 1;
          var maxTop = this.$size.height - h3;
          if (!composition) {
            posTop += this.lineHeight;
          } else {
            if (composition.useTextareaForIME) {
              var val = this.textarea.value;
              w2 = this.characterWidth * this.session.$getStringScreenWidth(val)[0];
            } else {
              posTop += this.lineHeight + 2;
            }
          }
          posLeft -= this.scrollLeft;
          if (posLeft > this.$size.scrollerWidth - w2)
            posLeft = this.$size.scrollerWidth - w2;
          posLeft += this.gutterWidth + this.margin.left;
          dom.setStyle(style2, "height", h3 + "px");
          dom.setStyle(style2, "width", w2 + "px");
          dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w2), Math.min(posTop, maxTop));
        };
        VirtualRenderer2.prototype.getFirstVisibleRow = function() {
          return this.layerConfig.firstRow;
        };
        VirtualRenderer2.prototype.getFirstFullyVisibleRow = function() {
          return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
        };
        VirtualRenderer2.prototype.getLastFullyVisibleRow = function() {
          var config3 = this.layerConfig;
          var lastRow = config3.lastRow;
          var top2 = this.session.documentToScreenRow(lastRow, 0) * config3.lineHeight;
          if (top2 - this.session.getScrollTop() > config3.height - config3.lineHeight)
            return lastRow - 1;
          return lastRow;
        };
        VirtualRenderer2.prototype.getLastVisibleRow = function() {
          return this.layerConfig.lastRow;
        };
        VirtualRenderer2.prototype.setPadding = function(padding) {
          this.$padding = padding;
          this.$textLayer.setPadding(padding);
          this.$cursorLayer.setPadding(padding);
          this.$markerFront.setPadding(padding);
          this.$markerBack.setPadding(padding);
          this.$loop.schedule(this.CHANGE_FULL);
          this.$updatePrintMargin();
        };
        VirtualRenderer2.prototype.setScrollMargin = function(top2, bottom2, left2, right) {
          var sm = this.scrollMargin;
          sm.top = top2 | 0;
          sm.bottom = bottom2 | 0;
          sm.right = right | 0;
          sm.left = left2 | 0;
          sm.v = sm.top + sm.bottom;
          sm.h = sm.left + sm.right;
          if (sm.top && this.scrollTop <= 0 && this.session)
            this.session.setScrollTop(-sm.top);
          this.updateFull();
        };
        VirtualRenderer2.prototype.setMargin = function(top2, bottom2, left2, right) {
          var sm = this.margin;
          sm.top = top2 | 0;
          sm.bottom = bottom2 | 0;
          sm.right = right | 0;
          sm.left = left2 | 0;
          sm.v = sm.top + sm.bottom;
          sm.h = sm.left + sm.right;
          this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height);
          this.updateFull();
        };
        VirtualRenderer2.prototype.getHScrollBarAlwaysVisible = function() {
          return this.$hScrollBarAlwaysVisible;
        };
        VirtualRenderer2.prototype.setHScrollBarAlwaysVisible = function(alwaysVisible) {
          this.setOption("hScrollBarAlwaysVisible", alwaysVisible);
        };
        VirtualRenderer2.prototype.getVScrollBarAlwaysVisible = function() {
          return this.$vScrollBarAlwaysVisible;
        };
        VirtualRenderer2.prototype.setVScrollBarAlwaysVisible = function(alwaysVisible) {
          this.setOption("vScrollBarAlwaysVisible", alwaysVisible);
        };
        VirtualRenderer2.prototype.$updateScrollBarV = function() {
          var scrollHeight = this.layerConfig.maxHeight;
          var scrollerHeight = this.$size.scrollerHeight;
          if (!this.$maxLines && this.$scrollPastEnd) {
            scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
            if (this.scrollTop > scrollHeight - scrollerHeight) {
              scrollHeight = this.scrollTop + scrollerHeight;
              this.scrollBarV.scrollTop = null;
            }
          }
          this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
          this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
        };
        VirtualRenderer2.prototype.$updateScrollBarH = function() {
          this.scrollBarH.setScrollWidth(this.layerConfig.width + 2 * this.$padding + this.scrollMargin.h);
          this.scrollBarH.setScrollLeft(this.scrollLeft + this.scrollMargin.left);
        };
        VirtualRenderer2.prototype.freeze = function() {
          this.$frozen = true;
        };
        VirtualRenderer2.prototype.unfreeze = function() {
          this.$frozen = false;
        };
        VirtualRenderer2.prototype.$renderChanges = function(changes, force) {
          if (this.$changes) {
            changes |= this.$changes;
            this.$changes = 0;
          }
          if (!this.session || !this.container.offsetWidth || this.$frozen || !changes && !force) {
            this.$changes |= changes;
            return;
          }
          if (this.$size.$dirty) {
            this.$changes |= changes;
            return this.onResize(true);
          }
          if (!this.lineHeight) {
            this.$textLayer.checkForSizeChanges();
          }
          this._signal("beforeRender", changes);
          if (this.session && this.session.$bidiHandler)
            this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);
          var config3 = this.layerConfig;
          if (changes & this.CHANGE_FULL || changes & this.CHANGE_SIZE || changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES || changes & this.CHANGE_SCROLL || changes & this.CHANGE_H_SCROLL) {
            changes |= this.$computeLayerConfig() | this.$loop.clear();
            if (config3.firstRow != this.layerConfig.firstRow && config3.firstRowScreen == this.layerConfig.firstRowScreen) {
              var st = this.scrollTop + (config3.firstRow - Math.max(this.layerConfig.firstRow, 0)) * this.lineHeight;
              if (st > 0) {
                this.scrollTop = st;
                changes = changes | this.CHANGE_SCROLL;
                changes |= this.$computeLayerConfig() | this.$loop.clear();
              }
            }
            config3 = this.layerConfig;
            this.$updateScrollBarV();
            if (changes & this.CHANGE_H_SCROLL)
              this.$updateScrollBarH();
            dom.translate(this.content, -this.scrollLeft, -config3.offset);
            var width = config3.width + 2 * this.$padding + "px";
            var height = config3.minHeight + "px";
            dom.setStyle(this.content.style, "width", width);
            dom.setStyle(this.content.style, "height", height);
          }
          if (changes & this.CHANGE_H_SCROLL) {
            dom.translate(this.content, -this.scrollLeft, -config3.offset);
            this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller " : "ace_scroller ace_scroll-left ";
            if (this.enableKeyboardAccessibility)
              this.scroller.className += this.keyboardFocusClassName;
          }
          if (changes & this.CHANGE_FULL) {
            this.$changedLines = null;
            this.$textLayer.update(config3);
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
            this.$markerBack.update(config3);
            this.$markerFront.update(config3);
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
            this._signal("afterRender", changes);
            return;
          }
          if (changes & this.CHANGE_SCROLL) {
            this.$changedLines = null;
            if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
              this.$textLayer.update(config3);
            else
              this.$textLayer.scrollLines(config3);
            if (this.$showGutter) {
              if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES)
                this.$gutterLayer.update(config3);
              else
                this.$gutterLayer.scrollLines(config3);
            }
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
            this.$markerBack.update(config3);
            this.$markerFront.update(config3);
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
            this._signal("afterRender", changes);
            return;
          }
          if (changes & this.CHANGE_TEXT) {
            this.$changedLines = null;
            this.$textLayer.update(config3);
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_LINES) {
            if (this.$updateLines() || changes & this.CHANGE_GUTTER && this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) {
            if (this.$showGutter)
              this.$gutterLayer.update(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          } else if (changes & this.CHANGE_CURSOR) {
            if (this.$highlightGutterLine)
              this.$gutterLayer.updateLineHighlight(config3);
            if (this.$customScrollbar) {
              this.$scrollDecorator.$updateDecorators(config3);
            }
          }
          if (changes & this.CHANGE_CURSOR) {
            this.$cursorLayer.update(config3);
            this.$moveTextAreaToCursor();
          }
          if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
            this.$markerFront.update(config3);
          }
          if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
            this.$markerBack.update(config3);
          }
          this._signal("afterRender", changes);
        };
        VirtualRenderer2.prototype.$autosize = function() {
          var height = this.session.getScreenLength() * this.lineHeight;
          var maxHeight = this.$maxLines * this.lineHeight;
          var desiredHeight = Math.min(maxHeight, Math.max((this.$minLines || 1) * this.lineHeight, height)) + this.scrollMargin.v + (this.$extraHeight || 0);
          if (this.$horizScroll)
            desiredHeight += this.scrollBarH.getHeight();
          if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight)
            desiredHeight = this.$maxPixelHeight;
          var hideScrollbars = desiredHeight <= 2 * this.lineHeight;
          var vScroll = !hideScrollbars && height > maxHeight;
          if (desiredHeight != this.desiredHeight || this.$size.height != this.desiredHeight || vScroll != this.$vScroll) {
            if (vScroll != this.$vScroll) {
              this.$vScroll = vScroll;
              this.scrollBarV.setVisible(vScroll);
            }
            var w2 = this.container.clientWidth;
            this.container.style.height = desiredHeight + "px";
            this.$updateCachedSize(true, this.$gutterWidth, w2, desiredHeight);
            this.desiredHeight = desiredHeight;
            this._signal("autosize");
          }
        };
        VirtualRenderer2.prototype.$computeLayerConfig = function() {
          var session = this.session;
          var size2 = this.$size;
          var hideScrollbars = size2.height <= 2 * this.lineHeight;
          var screenLines = this.session.getScreenLength();
          var maxHeight = screenLines * this.lineHeight;
          var longestLine = this.$getLongestLine();
          var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible || size2.scrollerWidth - longestLine - 2 * this.$padding < 0);
          var hScrollChanged = this.$horizScroll !== horizScroll;
          if (hScrollChanged) {
            this.$horizScroll = horizScroll;
            this.scrollBarH.setVisible(horizScroll);
          }
          var vScrollBefore = this.$vScroll;
          if (this.$maxLines && this.lineHeight > 1) {
            this.$autosize();
            hideScrollbars = size2.height <= 2 * this.lineHeight;
          }
          var minHeight = size2.scrollerHeight + this.lineHeight;
          var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd ? (size2.scrollerHeight - this.lineHeight) * this.$scrollPastEnd : 0;
          maxHeight += scrollPastEnd;
          var sm = this.scrollMargin;
          this.session.setScrollTop(Math.max(-sm.top, Math.min(this.scrollTop, maxHeight - size2.scrollerHeight + sm.bottom)));
          this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft, longestLine + 2 * this.$padding - size2.scrollerWidth + sm.right)));
          var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible || size2.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
          var vScrollChanged = vScrollBefore !== vScroll;
          if (vScrollChanged) {
            this.$vScroll = vScroll;
            this.scrollBarV.setVisible(vScroll);
          }
          var offset2 = this.scrollTop % this.lineHeight;
          var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
          var firstRow = Math.max(0, Math.round((this.scrollTop - offset2) / this.lineHeight));
          var lastRow = firstRow + lineCount;
          var firstRowScreen, firstRowHeight;
          var lineHeight2 = this.lineHeight;
          firstRow = session.screenToDocumentRow(firstRow, 0);
          var foldLine = session.getFoldLine(firstRow);
          if (foldLine) {
            firstRow = foldLine.start.row;
          }
          firstRowScreen = session.documentToScreenRow(firstRow, 0);
          firstRowHeight = session.getRowLength(firstRow) * lineHeight2;
          lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
          minHeight = size2.scrollerHeight + session.getRowLength(lastRow) * lineHeight2 + firstRowHeight;
          offset2 = this.scrollTop - firstRowScreen * lineHeight2;
          if (offset2 < 0 && firstRowScreen > 0) {
            firstRowScreen = Math.max(0, firstRowScreen + Math.floor(offset2 / lineHeight2));
            offset2 = this.scrollTop - firstRowScreen * lineHeight2;
          }
          var changes = 0;
          if (this.layerConfig.width != longestLine || hScrollChanged)
            changes = this.CHANGE_H_SCROLL;
          if (hScrollChanged || vScrollChanged) {
            changes |= this.$updateCachedSize(true, this.gutterWidth, size2.width, size2.height);
            this._signal("scrollbarVisibilityChanged");
            if (vScrollChanged)
              longestLine = this.$getLongestLine();
          }
          this.layerConfig = {
            width: longestLine,
            padding: this.$padding,
            firstRow,
            firstRowScreen,
            lastRow,
            lineHeight: lineHeight2,
            characterWidth: this.characterWidth,
            minHeight,
            maxHeight,
            offset: offset2,
            gutterOffset: lineHeight2 ? Math.max(0, Math.ceil((offset2 + size2.height - size2.scrollerHeight) / lineHeight2)) : 0,
            height: this.$size.scrollerHeight
          };
          if (this.session.$bidiHandler)
            this.session.$bidiHandler.setContentWidth(longestLine - this.$padding);
          return changes;
        };
        VirtualRenderer2.prototype.$updateLines = function() {
          if (!this.$changedLines)
            return;
          var firstRow = this.$changedLines.firstRow;
          var lastRow = this.$changedLines.lastRow;
          this.$changedLines = null;
          var layerConfig = this.layerConfig;
          if (firstRow > layerConfig.lastRow + 1) {
            return;
          }
          if (lastRow < layerConfig.firstRow) {
            return;
          }
          if (lastRow === Infinity) {
            if (this.$showGutter)
              this.$gutterLayer.update(layerConfig);
            this.$textLayer.update(layerConfig);
            return;
          }
          this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
          return true;
        };
        VirtualRenderer2.prototype.$getLongestLine = function() {
          var charCount = this.session.getScreenWidth();
          if (this.showInvisibles && !this.session.$useWrapMode)
            charCount += 1;
          if (this.$textLayer && charCount > this.$textLayer.MAX_LINE_LENGTH)
            charCount = this.$textLayer.MAX_LINE_LENGTH + 30;
          return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
        };
        VirtualRenderer2.prototype.updateFrontMarkers = function() {
          this.$markerFront.setMarkers(this.session.getMarkers(true));
          this.$loop.schedule(this.CHANGE_MARKER_FRONT);
        };
        VirtualRenderer2.prototype.updateBackMarkers = function() {
          this.$markerBack.setMarkers(this.session.getMarkers());
          this.$loop.schedule(this.CHANGE_MARKER_BACK);
        };
        VirtualRenderer2.prototype.addGutterDecoration = function(row, className) {
          this.$gutterLayer.addGutterDecoration(row, className);
        };
        VirtualRenderer2.prototype.removeGutterDecoration = function(row, className) {
          this.$gutterLayer.removeGutterDecoration(row, className);
        };
        VirtualRenderer2.prototype.updateBreakpoints = function(rows) {
          this._rows = rows;
          this.$loop.schedule(this.CHANGE_GUTTER);
        };
        VirtualRenderer2.prototype.setAnnotations = function(annotations) {
          this.$gutterLayer.setAnnotations(annotations);
          this.$loop.schedule(this.CHANGE_GUTTER);
        };
        VirtualRenderer2.prototype.updateCursor = function() {
          this.$loop.schedule(this.CHANGE_CURSOR);
        };
        VirtualRenderer2.prototype.hideCursor = function() {
          this.$cursorLayer.hideCursor();
        };
        VirtualRenderer2.prototype.showCursor = function() {
          this.$cursorLayer.showCursor();
        };
        VirtualRenderer2.prototype.scrollSelectionIntoView = function(anchor, lead, offset2) {
          this.scrollCursorIntoView(anchor, offset2);
          this.scrollCursorIntoView(lead, offset2);
        };
        VirtualRenderer2.prototype.scrollCursorIntoView = function(cursor, offset2, $viewMargin) {
          if (this.$size.scrollerHeight === 0)
            return;
          var pos = this.$cursorLayer.getPixelPosition(cursor);
          var newLeft = pos.left;
          var newTop = pos.top;
          var topMargin = $viewMargin && $viewMargin.top || 0;
          var bottomMargin = $viewMargin && $viewMargin.bottom || 0;
          if (this.$scrollAnimation) {
            this.$stopAnimation = true;
          }
          var currentTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop;
          if (currentTop + topMargin > newTop) {
            if (offset2 && currentTop + topMargin > newTop + this.lineHeight)
              newTop -= offset2 * this.$size.scrollerHeight;
            if (newTop === 0)
              newTop = -this.scrollMargin.top;
            this.session.setScrollTop(newTop);
          } else if (currentTop + this.$size.scrollerHeight - bottomMargin < newTop + this.lineHeight) {
            if (offset2 && currentTop + this.$size.scrollerHeight - bottomMargin < newTop - this.lineHeight)
              newTop += offset2 * this.$size.scrollerHeight;
            this.session.setScrollTop(newTop + this.lineHeight + bottomMargin - this.$size.scrollerHeight);
          }
          var currentLeft = this.scrollLeft;
          var twoCharsWidth = 2 * this.layerConfig.characterWidth;
          if (newLeft - twoCharsWidth < currentLeft) {
            newLeft -= twoCharsWidth;
            if (newLeft < this.$padding + twoCharsWidth) {
              newLeft = -this.scrollMargin.left;
            }
            this.session.setScrollLeft(newLeft);
          } else {
            newLeft += twoCharsWidth;
            if (currentLeft + this.$size.scrollerWidth < newLeft + this.characterWidth) {
              this.session.setScrollLeft(Math.round(newLeft + this.characterWidth - this.$size.scrollerWidth));
            } else if (currentLeft <= this.$padding && newLeft - currentLeft < this.characterWidth) {
              this.session.setScrollLeft(0);
            }
          }
        };
        VirtualRenderer2.prototype.getScrollTop = function() {
          return this.session.getScrollTop();
        };
        VirtualRenderer2.prototype.getScrollLeft = function() {
          return this.session.getScrollLeft();
        };
        VirtualRenderer2.prototype.getScrollTopRow = function() {
          return this.scrollTop / this.lineHeight;
        };
        VirtualRenderer2.prototype.getScrollBottomRow = function() {
          return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
        };
        VirtualRenderer2.prototype.scrollToRow = function(row) {
          this.session.setScrollTop(row * this.lineHeight);
        };
        VirtualRenderer2.prototype.alignCursor = function(cursor, alignment) {
          if (typeof cursor == "number")
            cursor = { row: cursor, column: 0 };
          var pos = this.$cursorLayer.getPixelPosition(cursor);
          var h3 = this.$size.scrollerHeight - this.lineHeight;
          var offset2 = pos.top - h3 * (alignment || 0);
          this.session.setScrollTop(offset2);
          return offset2;
        };
        VirtualRenderer2.prototype.$calcSteps = function(fromValue, toValue2) {
          var i2 = 0;
          var l2 = this.STEPS;
          var steps = [];
          var func = function(t2, x_min, dx) {
            return dx * (Math.pow(t2 - 1, 3) + 1) + x_min;
          };
          for (i2 = 0; i2 < l2; ++i2)
            steps.push(func(i2 / this.STEPS, fromValue, toValue2 - fromValue));
          return steps;
        };
        VirtualRenderer2.prototype.scrollToLine = function(line2, center, animate, callback2) {
          var pos = this.$cursorLayer.getPixelPosition({ row: line2, column: 0 });
          var offset2 = pos.top;
          if (center)
            offset2 -= this.$size.scrollerHeight / 2;
          var initialScroll = this.scrollTop;
          this.session.setScrollTop(offset2);
          if (animate !== false)
            this.animateScrolling(initialScroll, callback2);
        };
        VirtualRenderer2.prototype.animateScrolling = function(fromValue, callback2) {
          var toValue2 = this.scrollTop;
          if (!this.$animatedScroll)
            return;
          var _self = this;
          if (fromValue == toValue2)
            return;
          if (this.$scrollAnimation) {
            var oldSteps = this.$scrollAnimation.steps;
            if (oldSteps.length) {
              fromValue = oldSteps[0];
              if (fromValue == toValue2)
                return;
            }
          }
          var steps = _self.$calcSteps(fromValue, toValue2);
          this.$scrollAnimation = { from: fromValue, to: toValue2, steps };
          clearInterval(this.$timer);
          _self.session.setScrollTop(steps.shift());
          _self.session.$scrollTop = toValue2;
          function endAnimation() {
            _self.$timer = clearInterval(_self.$timer);
            _self.$scrollAnimation = null;
            _self.$stopAnimation = false;
            callback2 && callback2();
          }
          this.$timer = setInterval(function() {
            if (_self.$stopAnimation) {
              endAnimation();
              return;
            }
            if (!_self.session)
              return clearInterval(_self.$timer);
            if (steps.length) {
              _self.session.setScrollTop(steps.shift());
              _self.session.$scrollTop = toValue2;
            } else if (toValue2 != null) {
              _self.session.$scrollTop = -1;
              _self.session.setScrollTop(toValue2);
              toValue2 = null;
            } else {
              endAnimation();
            }
          }, 10);
        };
        VirtualRenderer2.prototype.scrollToY = function(scrollTop) {
          if (this.scrollTop !== scrollTop) {
            this.$loop.schedule(this.CHANGE_SCROLL);
            this.scrollTop = scrollTop;
          }
        };
        VirtualRenderer2.prototype.scrollToX = function(scrollLeft) {
          if (this.scrollLeft !== scrollLeft)
            this.scrollLeft = scrollLeft;
          this.$loop.schedule(this.CHANGE_H_SCROLL);
        };
        VirtualRenderer2.prototype.scrollTo = function(x2, y2) {
          this.session.setScrollTop(y2);
          this.session.setScrollLeft(x2);
        };
        VirtualRenderer2.prototype.scrollBy = function(deltaX, deltaY) {
          deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
          deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
        };
        VirtualRenderer2.prototype.isScrollableBy = function(deltaX, deltaY) {
          if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
            return true;
          if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
            return true;
          if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
            return true;
          if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right)
            return true;
        };
        VirtualRenderer2.prototype.pixelToScreenCoordinates = function(x2, y2) {
          var canvasPos;
          if (this.$hasCssTransforms) {
            canvasPos = { top: 0, left: 0 };
            var p2 = this.$fontMetrics.transformCoordinates([x2, y2]);
            x2 = p2[1] - this.gutterWidth - this.margin.left;
            y2 = p2[0];
          } else {
            canvasPos = this.scroller.getBoundingClientRect();
          }
          var offsetX = x2 + this.scrollLeft - canvasPos.left - this.$padding;
          var offset2 = offsetX / this.characterWidth;
          var row = Math.floor((y2 + this.scrollTop - canvasPos.top) / this.lineHeight);
          var col = this.$blockCursor ? Math.floor(offset2) : Math.round(offset2);
          return { row, column: col, side: offset2 - col > 0 ? 1 : -1, offsetX };
        };
        VirtualRenderer2.prototype.screenToTextCoordinates = function(x2, y2) {
          var canvasPos;
          if (this.$hasCssTransforms) {
            canvasPos = { top: 0, left: 0 };
            var p2 = this.$fontMetrics.transformCoordinates([x2, y2]);
            x2 = p2[1] - this.gutterWidth - this.margin.left;
            y2 = p2[0];
          } else {
            canvasPos = this.scroller.getBoundingClientRect();
          }
          var offsetX = x2 + this.scrollLeft - canvasPos.left - this.$padding;
          var offset2 = offsetX / this.characterWidth;
          var col = this.$blockCursor ? Math.floor(offset2) : Math.round(offset2);
          var row = Math.floor((y2 + this.scrollTop - canvasPos.top) / this.lineHeight);
          return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX);
        };
        VirtualRenderer2.prototype.textToScreenCoordinates = function(row, column2) {
          var canvasPos = this.scroller.getBoundingClientRect();
          var pos = this.session.documentToScreenPosition(row, column2);
          var x2 = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row) ? this.session.$bidiHandler.getPosLeft(pos.column) : Math.round(pos.column * this.characterWidth));
          var y2 = pos.row * this.lineHeight;
          return {
            pageX: canvasPos.left + x2 - this.scrollLeft,
            pageY: canvasPos.top + y2 - this.scrollTop
          };
        };
        VirtualRenderer2.prototype.visualizeFocus = function() {
          dom.addCssClass(this.container, "ace_focus");
        };
        VirtualRenderer2.prototype.visualizeBlur = function() {
          dom.removeCssClass(this.container, "ace_focus");
        };
        VirtualRenderer2.prototype.showComposition = function(composition) {
          this.$composition = composition;
          if (!composition.cssText) {
            composition.cssText = this.textarea.style.cssText;
          }
          if (composition.useTextareaForIME == void 0)
            composition.useTextareaForIME = this.$useTextareaForIME;
          if (this.$useTextareaForIME) {
            dom.addCssClass(this.textarea, "ace_composition");
            this.textarea.style.cssText = "";
            this.$moveTextAreaToCursor();
            this.$cursorLayer.element.style.display = "none";
          } else {
            composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text");
          }
        };
        VirtualRenderer2.prototype.setCompositionText = function(text2) {
          var cursor = this.session.selection.cursor;
          this.addToken(text2, "composition_placeholder", cursor.row, cursor.column);
          this.$moveTextAreaToCursor();
        };
        VirtualRenderer2.prototype.hideComposition = function() {
          if (!this.$composition)
            return;
          if (this.$composition.markerId)
            this.session.removeMarker(this.$composition.markerId);
          dom.removeCssClass(this.textarea, "ace_composition");
          this.textarea.style.cssText = this.$composition.cssText;
          var cursor = this.session.selection.cursor;
          this.removeExtraToken(cursor.row, cursor.column);
          this.$composition = null;
          this.$cursorLayer.element.style.display = "";
        };
        VirtualRenderer2.prototype.setGhostText = function(text2, position2) {
          var cursor = this.session.selection.cursor;
          var insertPosition = position2 || { row: cursor.row, column: cursor.column };
          this.removeGhostText();
          var textChunks = this.$calculateWrappedTextChunks(text2, insertPosition);
          this.addToken(textChunks[0].text, "ghost_text", insertPosition.row, insertPosition.column);
          this.$ghostText = {
            text: text2,
            position: {
              row: insertPosition.row,
              column: insertPosition.column
            }
          };
          var widgetDiv = dom.createElement("div");
          if (textChunks.length > 1) {
            var hiddenTokens = this.hideTokensAfterPosition(insertPosition.row, insertPosition.column);
            var lastLineDiv;
            textChunks.slice(1).forEach(function(el3) {
              var chunkDiv = dom.createElement("div");
              var chunkSpan = dom.createElement("span");
              chunkSpan.className = "ace_ghost_text";
              if (el3.wrapped)
                chunkDiv.className = "ghost_text_line_wrapped";
              if (el3.text.length === 0)
                el3.text = " ";
              chunkSpan.appendChild(dom.createTextNode(el3.text));
              chunkDiv.appendChild(chunkSpan);
              widgetDiv.appendChild(chunkDiv);
              lastLineDiv = chunkDiv;
            });
            hiddenTokens.forEach(function(token2) {
              var element2 = dom.createElement("span");
              if (!isTextToken(token2.type))
                element2.className = "ace_" + token2.type.replace(/\./g, " ace_");
              element2.appendChild(dom.createTextNode(token2.value));
              lastLineDiv.appendChild(element2);
            });
            this.$ghostTextWidget = {
              el: widgetDiv,
              row: insertPosition.row,
              column: insertPosition.column,
              className: "ace_ghost_text_container"
            };
            this.session.widgetManager.addLineWidget(this.$ghostTextWidget);
            var pixelPosition = this.$cursorLayer.getPixelPosition(insertPosition, true);
            var el2 = this.container;
            var height = el2.getBoundingClientRect().height;
            var ghostTextHeight = textChunks.length * this.lineHeight;
            var fitsY = ghostTextHeight < height - pixelPosition.top;
            if (fitsY)
              return;
            if (ghostTextHeight < height) {
              this.scrollBy(0, (textChunks.length - 1) * this.lineHeight);
            } else {
              this.scrollToRow(insertPosition.row);
            }
          }
        };
        VirtualRenderer2.prototype.$calculateWrappedTextChunks = function(text2, position2) {
          var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
          var limit2 = Math.floor(availableWidth / this.characterWidth) - 2;
          limit2 = limit2 <= 0 ? 60 : limit2;
          var textLines = text2.split(/\r?\n/);
          var textChunks = [];
          for (var i2 = 0; i2 < textLines.length; i2++) {
            var displayTokens = this.session.$getDisplayTokens(textLines[i2], position2.column);
            var wrapSplits = this.session.$computeWrapSplits(displayTokens, limit2, this.session.$tabSize);
            if (wrapSplits.length > 0) {
              var start = 0;
              wrapSplits.push(textLines[i2].length);
              for (var j2 = 0; j2 < wrapSplits.length; j2++) {
                var textSlice = textLines[i2].slice(start, wrapSplits[j2]);
                textChunks.push({ text: textSlice, wrapped: true });
                start = wrapSplits[j2];
              }
            } else {
              textChunks.push({ text: textLines[i2], wrapped: false });
            }
          }
          return textChunks;
        };
        VirtualRenderer2.prototype.removeGhostText = function() {
          if (!this.$ghostText)
            return;
          var position2 = this.$ghostText.position;
          this.removeExtraToken(position2.row, position2.column);
          if (this.$ghostTextWidget) {
            this.session.widgetManager.removeLineWidget(this.$ghostTextWidget);
            this.$ghostTextWidget = null;
          }
          this.$ghostText = null;
        };
        VirtualRenderer2.prototype.addToken = function(text2, type4, row, column2) {
          var session = this.session;
          session.bgTokenizer.lines[row] = null;
          var newToken = { type: type4, value: text2 };
          var tokens2 = session.getTokens(row);
          if (column2 == null || !tokens2.length) {
            tokens2.push(newToken);
          } else {
            var l2 = 0;
            for (var i2 = 0; i2 < tokens2.length; i2++) {
              var token2 = tokens2[i2];
              l2 += token2.value.length;
              if (column2 <= l2) {
                var diff2 = token2.value.length - (l2 - column2);
                var before = token2.value.slice(0, diff2);
                var after = token2.value.slice(diff2);
                tokens2.splice(i2, 1, { type: token2.type, value: before }, newToken, { type: token2.type, value: after });
                break;
              }
            }
          }
          this.updateLines(row, row);
        };
        VirtualRenderer2.prototype.hideTokensAfterPosition = function(row, column2) {
          var tokens2 = this.session.getTokens(row);
          var l2 = 0;
          var hasPassedCursor = false;
          var hiddenTokens = [];
          for (var i2 = 0; i2 < tokens2.length; i2++) {
            var token2 = tokens2[i2];
            l2 += token2.value.length;
            if (token2.type === "ghost_text")
              continue;
            if (hasPassedCursor) {
              hiddenTokens.push({ type: token2.type, value: token2.value });
              token2.type = "hidden_token";
              continue;
            }
            if (l2 === column2) {
              hasPassedCursor = true;
            }
          }
          this.updateLines(row, row);
          return hiddenTokens;
        };
        VirtualRenderer2.prototype.removeExtraToken = function(row, column2) {
          this.session.bgTokenizer.lines[row] = null;
          this.updateLines(row, row);
        };
        VirtualRenderer2.prototype.setTheme = function(theme2, cb2) {
          var _self = this;
          this.$themeId = theme2;
          _self._dispatchEvent("themeChange", { theme: theme2 });
          if (!theme2 || typeof theme2 == "string") {
            var moduleName = theme2 || this.$options.theme.initialValue;
            config2.loadModule(["theme", moduleName], afterLoad);
          } else {
            afterLoad(theme2);
          }
          function afterLoad(module4) {
            if (_self.$themeId != theme2)
              return cb2 && cb2();
            if (!module4 || !module4.cssClass)
              throw new Error("couldn't load module " + theme2 + " or it didn't call define");
            if (module4.$id)
              _self.$themeId = module4.$id;
            dom.importCssString(module4.cssText, module4.cssClass, _self.container);
            if (_self.theme)
              dom.removeCssClass(_self.container, _self.theme.cssClass);
            var padding = "padding" in module4 ? module4.padding : "padding" in (_self.theme || {}) ? 4 : _self.$padding;
            if (_self.$padding && padding != _self.$padding)
              _self.setPadding(padding);
            _self.$theme = module4.cssClass;
            _self.theme = module4;
            dom.addCssClass(_self.container, module4.cssClass);
            dom.setCssClass(_self.container, "ace_dark", module4.isDark);
            if (_self.$size) {
              _self.$size.width = 0;
              _self.$updateSizeAsync();
            }
            _self._dispatchEvent("themeLoaded", { theme: module4 });
            cb2 && cb2();
            if (useragent.isSafari && _self.scroller) {
              _self.scroller.style.background = "red";
              _self.scroller.style.background = "";
            }
          }
        };
        VirtualRenderer2.prototype.getTheme = function() {
          return this.$themeId;
        };
        VirtualRenderer2.prototype.setStyle = function(style2, include) {
          dom.setCssClass(this.container, style2, include !== false);
        };
        VirtualRenderer2.prototype.unsetStyle = function(style2) {
          dom.removeCssClass(this.container, style2);
        };
        VirtualRenderer2.prototype.setCursorStyle = function(style2) {
          dom.setStyle(this.scroller.style, "cursor", style2);
        };
        VirtualRenderer2.prototype.setMouseCursor = function(cursorStyle) {
          dom.setStyle(this.scroller.style, "cursor", cursorStyle);
        };
        VirtualRenderer2.prototype.attachToShadowRoot = function() {
          dom.importCssString(editorCss, "ace_editor.css", this.container);
        };
        VirtualRenderer2.prototype.destroy = function() {
          this.freeze();
          this.$fontMetrics.destroy();
          this.$cursorLayer.destroy();
          this.removeAllListeners();
          this.container.textContent = "";
          this.setOption("useResizeObserver", false);
        };
        VirtualRenderer2.prototype.$updateCustomScrollbar = function(val) {
          var _self = this;
          this.$horizScroll = this.$vScroll = null;
          this.scrollBarV.element.remove();
          this.scrollBarH.element.remove();
          if (val === true) {
            this.scrollBarV = new VScrollBarCustom(this.container, this);
            this.scrollBarH = new HScrollBarCustom(this.container, this);
            this.scrollBarV.setHeight(this.$size.scrollerHeight);
            this.scrollBarH.setWidth(this.$size.scrollerWidth);
            this.scrollBarV.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
            });
            this.scrollBarH.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
            });
            if (!this.$scrollDecorator) {
              this.$scrollDecorator = new Decorator(this.scrollBarV, this);
              this.$scrollDecorator.$updateDecorators();
            } else {
              this.$scrollDecorator.setScrollBarV(this.scrollBarV);
              this.$scrollDecorator.$updateDecorators();
            }
          } else {
            this.scrollBarV = new VScrollBar(this.container, this);
            this.scrollBarH = new HScrollBar(this.container, this);
            this.scrollBarV.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollTop(e2.data - _self.scrollMargin.top);
            });
            this.scrollBarH.addEventListener("scroll", function(e2) {
              if (!_self.$scrollAnimation)
                _self.session.setScrollLeft(e2.data - _self.scrollMargin.left);
            });
          }
        };
        VirtualRenderer2.prototype.$addResizeObserver = function() {
          if (!window.ResizeObserver || this.$resizeObserver)
            return;
          var self2 = this;
          this.$resizeTimer = lang2.delayedCall(function() {
            if (!self2.destroyed)
              self2.onResize();
          }, 50);
          this.$resizeObserver = new window.ResizeObserver(function(e2) {
            var w2 = e2[0].contentRect.width;
            var h3 = e2[0].contentRect.height;
            if (Math.abs(self2.$size.width - w2) > 1 || Math.abs(self2.$size.height - h3) > 1) {
              self2.$resizeTimer.delay();
            } else {
              self2.$resizeTimer.cancel();
            }
          });
          this.$resizeObserver.observe(this.container);
        };
        return VirtualRenderer2;
      }()
    );
    VirtualRenderer.prototype.CHANGE_CURSOR = 1;
    VirtualRenderer.prototype.CHANGE_MARKER = 2;
    VirtualRenderer.prototype.CHANGE_GUTTER = 4;
    VirtualRenderer.prototype.CHANGE_SCROLL = 8;
    VirtualRenderer.prototype.CHANGE_LINES = 16;
    VirtualRenderer.prototype.CHANGE_TEXT = 32;
    VirtualRenderer.prototype.CHANGE_SIZE = 64;
    VirtualRenderer.prototype.CHANGE_MARKER_BACK = 128;
    VirtualRenderer.prototype.CHANGE_MARKER_FRONT = 256;
    VirtualRenderer.prototype.CHANGE_FULL = 512;
    VirtualRenderer.prototype.CHANGE_H_SCROLL = 1024;
    VirtualRenderer.prototype.$changes = 0;
    VirtualRenderer.prototype.$padding = null;
    VirtualRenderer.prototype.$frozen = false;
    VirtualRenderer.prototype.STEPS = 8;
    oop.implement(VirtualRenderer.prototype, EventEmitter2);
    config2.defineOptions(VirtualRenderer.prototype, "renderer", {
      useResizeObserver: {
        set: function(value2) {
          if (!value2 && this.$resizeObserver) {
            this.$resizeObserver.disconnect();
            this.$resizeTimer.cancel();
            this.$resizeTimer = this.$resizeObserver = null;
          } else if (value2 && !this.$resizeObserver) {
            this.$addResizeObserver();
          }
        }
      },
      animatedScroll: { initialValue: false },
      showInvisibles: {
        set: function(value2) {
          if (this.$textLayer.setShowInvisibles(value2))
            this.$loop.schedule(this.CHANGE_TEXT);
        },
        initialValue: false
      },
      showPrintMargin: {
        set: function() {
          this.$updatePrintMargin();
        },
        initialValue: true
      },
      printMarginColumn: {
        set: function() {
          this.$updatePrintMargin();
        },
        initialValue: 80
      },
      printMargin: {
        set: function(val) {
          if (typeof val == "number")
            this.$printMarginColumn = val;
          this.$showPrintMargin = !!val;
          this.$updatePrintMargin();
        },
        get: function() {
          return this.$showPrintMargin && this.$printMarginColumn;
        }
      },
      showGutter: {
        set: function(show) {
          this.$gutter.style.display = show ? "block" : "none";
          this.$loop.schedule(this.CHANGE_FULL);
          this.onGutterResize();
        },
        initialValue: true
      },
      useSvgGutterIcons: {
        set: function(value2) {
          this.$gutterLayer.$useSvgGutterIcons = value2;
        },
        initialValue: false
      },
      showFoldedAnnotations: {
        set: function(value2) {
          this.$gutterLayer.$showFoldedAnnotations = value2;
        },
        initialValue: false
      },
      fadeFoldWidgets: {
        set: function(show) {
          dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show);
        },
        initialValue: false
      },
      showFoldWidgets: {
        set: function(show) {
          this.$gutterLayer.setShowFoldWidgets(show);
          this.$loop.schedule(this.CHANGE_GUTTER);
        },
        initialValue: true
      },
      displayIndentGuides: {
        set: function(show) {
          if (this.$textLayer.setDisplayIndentGuides(show))
            this.$loop.schedule(this.CHANGE_TEXT);
        },
        initialValue: true
      },
      highlightIndentGuides: {
        set: function(show) {
          if (this.$textLayer.setHighlightIndentGuides(show) == true) {
            this.$textLayer.$highlightIndentGuide();
          } else {
            this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells);
          }
        },
        initialValue: true
      },
      highlightGutterLine: {
        set: function(shouldHighlight) {
          this.$gutterLayer.setHighlightGutterLine(shouldHighlight);
          this.$loop.schedule(this.CHANGE_GUTTER);
        },
        initialValue: true
      },
      hScrollBarAlwaysVisible: {
        set: function(val) {
          if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll)
            this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: false
      },
      vScrollBarAlwaysVisible: {
        set: function(val) {
          if (!this.$vScrollBarAlwaysVisible || !this.$vScroll)
            this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: false
      },
      fontSize: {
        set: function(size2) {
          if (typeof size2 == "number")
            size2 = size2 + "px";
          this.container.style.fontSize = size2;
          this.updateFontSize();
        },
        initialValue: 12
      },
      fontFamily: {
        set: function(name2) {
          this.container.style.fontFamily = name2;
          this.updateFontSize();
        }
      },
      maxLines: {
        set: function(val) {
          this.updateFull();
        }
      },
      minLines: {
        set: function(val) {
          if (!(this.$minLines < 562949953421311))
            this.$minLines = 0;
          this.updateFull();
        }
      },
      maxPixelHeight: {
        set: function(val) {
          this.updateFull();
        },
        initialValue: 0
      },
      scrollPastEnd: {
        set: function(val) {
          val = +val || 0;
          if (this.$scrollPastEnd == val)
            return;
          this.$scrollPastEnd = val;
          this.$loop.schedule(this.CHANGE_SCROLL);
        },
        initialValue: 0,
        handlesSet: true
      },
      fixedWidthGutter: {
        set: function(val) {
          this.$gutterLayer.$fixedWidth = !!val;
          this.$loop.schedule(this.CHANGE_GUTTER);
        }
      },
      customScrollbar: {
        set: function(val) {
          this.$updateCustomScrollbar(val);
        },
        initialValue: false
      },
      theme: {
        set: function(val) {
          this.setTheme(val);
        },
        get: function() {
          return this.$themeId || this.theme;
        },
        initialValue: "./theme/textmate",
        handlesSet: true
      },
      hasCssTransforms: {},
      useTextareaForIME: {
        initialValue: !useragent.isMobile && !useragent.isIE
      }
    });
    exports3.VirtualRenderer = VirtualRenderer;
  });
  ace.define("ace/worker/worker_client", ["require", "exports", "module", "ace/lib/oop", "ace/lib/net", "ace/lib/event_emitter", "ace/config"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var net = require2("../lib/net");
    var EventEmitter2 = require2("../lib/event_emitter").EventEmitter;
    var config2 = require2("../config");
    function $workerBlob(workerUrl) {
      var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
      try {
        return new Blob([script], { "type": "application/javascript" });
      } catch (e2) {
        var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
        var blobBuilder = new BlobBuilder();
        blobBuilder.append(script);
        return blobBuilder.getBlob("application/javascript");
      }
    }
    function createWorker(workerUrl) {
      if (typeof Worker == "undefined")
        return { postMessage: function() {
        }, terminate: function() {
        } };
      if (config2.get("loadWorkerFromBlob")) {
        var blob = $workerBlob(workerUrl);
        var URL2 = window.URL || window.webkitURL;
        var blobURL = URL2.createObjectURL(blob);
        return new Worker(blobURL);
      }
      return new Worker(workerUrl);
    }
    var WorkerClient = function(worker) {
      if (!worker.postMessage)
        worker = this.$createWorkerFromOldConfig.apply(this, arguments);
      this.$worker = worker;
      this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this);
      this.changeListener = this.changeListener.bind(this);
      this.onMessage = this.onMessage.bind(this);
      this.callbackId = 1;
      this.callbacks = {};
      this.$worker.onmessage = this.onMessage;
    };
    (function() {
      oop.implement(this, EventEmitter2);
      this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod2, classname, workerUrl, importScripts) {
        if (require2.nameToUrl && !require2.toUrl)
          require2.toUrl = require2.nameToUrl;
        if (config2.get("packaged") || !require2.toUrl) {
          workerUrl = workerUrl || config2.moduleUrl(mod2, "worker");
        } else {
          var normalizePath = this.$normalizePath;
          workerUrl = workerUrl || normalizePath(require2.toUrl("ace/worker/worker.js", null, "_"));
          var tlns = {};
          topLevelNamespaces.forEach(function(ns) {
            tlns[ns] = normalizePath(require2.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, ""));
          });
        }
        this.$worker = createWorker(workerUrl);
        if (importScripts) {
          this.send("importScripts", importScripts);
        }
        this.$worker.postMessage({
          init: true,
          tlns,
          module: mod2,
          classname
        });
        return this.$worker;
      };
      this.onMessage = function(e2) {
        var msg = e2.data;
        switch (msg.type) {
          case "event":
            this._signal(msg.name, { data: msg.data });
            break;
          case "call":
            var callback2 = this.callbacks[msg.id];
            if (callback2) {
              callback2(msg.data);
              delete this.callbacks[msg.id];
            }
            break;
          case "error":
            this.reportError(msg.data);
            break;
          case "log":
            window.console && console.log && console.log.apply(console, msg.data);
            break;
        }
      };
      this.reportError = function(err) {
        window.console && console.error && console.error(err);
      };
      this.$normalizePath = function(path) {
        return net.qualifyURL(path);
      };
      this.terminate = function() {
        this._signal("terminate", {});
        this.deltaQueue = null;
        this.$worker.terminate();
        this.$worker.onerror = function(e2) {
          e2.preventDefault();
        };
        this.$worker = null;
        if (this.$doc)
          this.$doc.off("change", this.changeListener);
        this.$doc = null;
      };
      this.send = function(cmd, args) {
        this.$worker.postMessage({ command: cmd, args });
      };
      this.call = function(cmd, args, callback2) {
        if (callback2) {
          var id2 = this.callbackId++;
          this.callbacks[id2] = callback2;
          args.push(id2);
        }
        this.send(cmd, args);
      };
      this.emit = function(event, data) {
        try {
          if (data.data && data.data.err)
            data.data.err = { message: data.data.err.message, stack: data.data.err.stack, code: data.data.err.code };
          this.$worker && this.$worker.postMessage({ event, data: { data: data.data } });
        } catch (ex) {
          console.error(ex.stack);
        }
      };
      this.attachToDocument = function(doc) {
        if (this.$doc)
          this.terminate();
        this.$doc = doc;
        this.call("setValue", [doc.getValue()]);
        doc.on("change", this.changeListener, true);
      };
      this.changeListener = function(delta) {
        if (!this.deltaQueue) {
          this.deltaQueue = [];
          setTimeout(this.$sendDeltaQueue, 0);
        }
        if (delta.action == "insert")
          this.deltaQueue.push(delta.start, delta.lines);
        else
          this.deltaQueue.push(delta.start, delta.end);
      };
      this.$sendDeltaQueue = function() {
        var q2 = this.deltaQueue;
        if (!q2)
          return;
        this.deltaQueue = null;
        if (q2.length > 50 && q2.length > this.$doc.getLength() >> 1) {
          this.call("setValue", [this.$doc.getValue()]);
        } else
          this.emit("change", { data: q2 });
      };
    }).call(WorkerClient.prototype);
    var UIWorkerClient = function(topLevelNamespaces, mod2, classname) {
      var main2 = null;
      var emitSync = false;
      var sender = Object.create(EventEmitter2);
      var messageBuffer = [];
      var workerClient = new WorkerClient({
        messageBuffer,
        terminate: function() {
        },
        postMessage: function(e2) {
          messageBuffer.push(e2);
          if (!main2)
            return;
          if (emitSync)
            setTimeout(processNext);
          else
            processNext();
        }
      });
      workerClient.setEmitSync = function(val) {
        emitSync = val;
      };
      var processNext = function() {
        var msg = messageBuffer.shift();
        if (msg.command)
          main2[msg.command].apply(main2, msg.args);
        else if (msg.event)
          sender._signal(msg.event, msg.data);
      };
      sender.postMessage = function(msg) {
        workerClient.onMessage({ data: msg });
      };
      sender.callback = function(data, callbackId) {
        this.postMessage({ type: "call", id: callbackId, data });
      };
      sender.emit = function(name2, data) {
        this.postMessage({ type: "event", name: name2, data });
      };
      config2.loadModule(["worker", mod2], function(Main) {
        main2 = new Main[classname](sender);
        while (messageBuffer.length)
          processNext();
      });
      return workerClient;
    };
    exports3.UIWorkerClient = UIWorkerClient;
    exports3.WorkerClient = WorkerClient;
    exports3.createWorker = createWorker;
  });
  ace.define("ace/placeholder", ["require", "exports", "module", "ace/range", "ace/lib/event_emitter", "ace/lib/oop"], function(require2, exports3, module3) {
    var Range = require2("./range").Range;
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var oop = require2("./lib/oop");
    var PlaceHolder = (
      /** @class */
      function() {
        function PlaceHolder2(session, length2, pos, others, mainClass, othersClass) {
          var _self = this;
          this.length = length2;
          this.session = session;
          this.doc = session.getDocument();
          this.mainClass = mainClass;
          this.othersClass = othersClass;
          this.$onUpdate = this.onUpdate.bind(this);
          this.doc.on("change", this.$onUpdate, true);
          this.$others = others;
          this.$onCursorChange = function() {
            setTimeout(function() {
              _self.onCursorChange();
            });
          };
          this.$pos = pos;
          var undoStack = session.getUndoManager().$undoStack || session.getUndoManager()["$undostack"] || { length: -1 };
          this.$undoStackDepth = undoStack.length;
          this.setup();
          session.selection.on("changeCursor", this.$onCursorChange);
        }
        PlaceHolder2.prototype.setup = function() {
          var _self = this;
          var doc = this.doc;
          var session = this.session;
          this.selectionBefore = session.selection.toJSON();
          if (session.selection.inMultiSelectMode)
            session.selection.toSingleRange();
          this.pos = doc.createAnchor(this.$pos.row, this.$pos.column);
          var pos = this.pos;
          pos.$insertRight = true;
          pos.detach();
          pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
          this.others = [];
          this.$others.forEach(function(other) {
            var anchor = doc.createAnchor(other.row, other.column);
            anchor.$insertRight = true;
            anchor.detach();
            _self.others.push(anchor);
          });
          session.setUndoSelect(false);
        };
        PlaceHolder2.prototype.showOtherMarkers = function() {
          if (this.othersActive)
            return;
          var session = this.session;
          var _self = this;
          this.othersActive = true;
          this.others.forEach(function(anchor) {
            anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column + _self.length), _self.othersClass, null, false);
          });
        };
        PlaceHolder2.prototype.hideOtherMarkers = function() {
          if (!this.othersActive)
            return;
          this.othersActive = false;
          for (var i2 = 0; i2 < this.others.length; i2++) {
            this.session.removeMarker(this.others[i2].markerId);
          }
        };
        PlaceHolder2.prototype.onUpdate = function(delta) {
          if (this.$updating)
            return this.updateAnchors(delta);
          var range3 = delta;
          if (range3.start.row !== range3.end.row)
            return;
          if (range3.start.row !== this.pos.row)
            return;
          this.$updating = true;
          var lengthDiff = delta.action === "insert" ? range3.end.column - range3.start.column : range3.start.column - range3.end.column;
          var inMainRange = range3.start.column >= this.pos.column && range3.start.column <= this.pos.column + this.length + 1;
          var distanceFromStart = range3.start.column - this.pos.column;
          this.updateAnchors(delta);
          if (inMainRange)
            this.length += lengthDiff;
          if (inMainRange && !this.session.$fromUndo) {
            if (delta.action === "insert") {
              for (var i2 = this.others.length - 1; i2 >= 0; i2--) {
                var otherPos = this.others[i2];
                var newPos = { row: otherPos.row, column: otherPos.column + distanceFromStart };
                this.doc.insertMergedLines(newPos, delta.lines);
              }
            } else if (delta.action === "remove") {
              for (var i2 = this.others.length - 1; i2 >= 0; i2--) {
                var otherPos = this.others[i2];
                var newPos = { row: otherPos.row, column: otherPos.column + distanceFromStart };
                this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
              }
            }
          }
          this.$updating = false;
          this.updateMarkers();
        };
        PlaceHolder2.prototype.updateAnchors = function(delta) {
          this.pos.onChange(delta);
          for (var i2 = this.others.length; i2--; )
            this.others[i2].onChange(delta);
          this.updateMarkers();
        };
        PlaceHolder2.prototype.updateMarkers = function() {
          if (this.$updating)
            return;
          var _self = this;
          var session = this.session;
          var updateMarker = function(pos, className) {
            session.removeMarker(pos.markerId);
            pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + _self.length), className, null, false);
          };
          updateMarker(this.pos, this.mainClass);
          for (var i2 = this.others.length; i2--; )
            updateMarker(this.others[i2], this.othersClass);
        };
        PlaceHolder2.prototype.onCursorChange = function(event) {
          if (this.$updating || !this.session)
            return;
          var pos = this.session.selection.getCursor();
          if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
            this.showOtherMarkers();
            this._emit("cursorEnter", event);
          } else {
            this.hideOtherMarkers();
            this._emit("cursorLeave", event);
          }
        };
        PlaceHolder2.prototype.detach = function() {
          this.session.removeMarker(this.pos && this.pos.markerId);
          this.hideOtherMarkers();
          this.doc.off("change", this.$onUpdate);
          this.session.selection.off("changeCursor", this.$onCursorChange);
          this.session.setUndoSelect(true);
          this.session = null;
        };
        PlaceHolder2.prototype.cancel = function() {
          if (this.$undoStackDepth === -1)
            return;
          var undoManager = this.session.getUndoManager();
          var undosRequired = (undoManager.$undoStack || undoManager["$undostack"]).length - this.$undoStackDepth;
          for (var i2 = 0; i2 < undosRequired; i2++) {
            undoManager.undo(this.session, true);
          }
          if (this.selectionBefore)
            this.session.selection.fromJSON(this.selectionBefore);
        };
        return PlaceHolder2;
      }()
    );
    oop.implement(PlaceHolder.prototype, EventEmitter2);
    exports3.PlaceHolder = PlaceHolder;
  });
  ace.define("ace/mouse/multi_select_handler", ["require", "exports", "module", "ace/lib/event", "ace/lib/useragent"], function(require2, exports3, module3) {
    var event = require2("../lib/event");
    var useragent = require2("../lib/useragent");
    function isSamePoint(p1, p2) {
      return p1.row == p2.row && p1.column == p2.column;
    }
    function onMouseDown(e2) {
      var ev = e2.domEvent;
      var alt = ev.altKey;
      var shift = ev.shiftKey;
      var ctrl = ev.ctrlKey;
      var accel = e2.getAccelKey();
      var button2 = e2.getButton();
      if (ctrl && useragent.isMac)
        button2 = ev.button;
      if (e2.editor.inMultiSelectMode && button2 == 2) {
        e2.editor.textInput.onContextMenu(e2.domEvent);
        return;
      }
      if (!ctrl && !alt && !accel) {
        if (button2 === 0 && e2.editor.inMultiSelectMode)
          e2.editor.exitMultiSelectMode();
        return;
      }
      if (button2 !== 0)
        return;
      var editor = e2.editor;
      var selection = editor.selection;
      var isMultiSelect = editor.inMultiSelectMode;
      var pos = e2.getDocumentPosition();
      var cursor = selection.getCursor();
      var inSelection = e2.inSelection() || selection.isEmpty() && isSamePoint(pos, cursor);
      var mouseX = e2.x, mouseY = e2.y;
      var onMouseSelection = function(e3) {
        mouseX = e3.clientX;
        mouseY = e3.clientY;
      };
      var session = editor.session;
      var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
      var screenCursor = screenAnchor;
      var selectionMode;
      if (editor.$mouseHandler.$enableJumpToDef) {
        if (ctrl && alt || accel && alt)
          selectionMode = shift ? "block" : "add";
        else if (alt && editor.$blockSelectEnabled)
          selectionMode = "block";
      } else {
        if (accel && !alt) {
          selectionMode = "add";
          if (!isMultiSelect && shift)
            return;
        } else if (alt && editor.$blockSelectEnabled) {
          selectionMode = "block";
        }
      }
      if (selectionMode && useragent.isMac && ev.ctrlKey) {
        editor.$mouseHandler.cancelContextMenu();
      }
      if (selectionMode == "add") {
        if (!isMultiSelect && inSelection)
          return;
        if (!isMultiSelect) {
          var range3 = selection.toOrientedRange();
          editor.addSelectionMarker(range3);
        }
        var oldRange = selection.rangeList.rangeAtPoint(pos);
        editor.inVirtualSelectionMode = true;
        if (shift) {
          oldRange = null;
          range3 = selection.ranges[0] || range3;
          editor.removeSelectionMarker(range3);
        }
        editor.once("mouseup", function() {
          var tmpSel = selection.toOrientedRange();
          if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
            selection.substractPoint(tmpSel.cursor);
          else {
            if (shift) {
              selection.substractPoint(range3.cursor);
            } else if (range3) {
              editor.removeSelectionMarker(range3);
              selection.addRange(range3);
            }
            selection.addRange(tmpSel);
          }
          editor.inVirtualSelectionMode = false;
        });
      } else if (selectionMode == "block") {
        e2.stop();
        editor.inVirtualSelectionMode = true;
        var initialRange;
        var rectSel = [];
        var blockSelect = function() {
          var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
          var cursor2 = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX);
          if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor2, selection.lead))
            return;
          screenCursor = newCursor;
          editor.selection.moveToPosition(cursor2);
          editor.renderer.scrollCursorIntoView();
          editor.removeSelectionMarkers(rectSel);
          rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
          if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty())
            rectSel[0] = editor.$mouseHandler.$clickSelection.clone();
          rectSel.forEach(editor.addSelectionMarker, editor);
          editor.updateSelectionMarkers();
        };
        if (isMultiSelect && !accel) {
          selection.toSingleRange();
        } else if (!isMultiSelect && accel) {
          initialRange = selection.toOrientedRange();
          editor.addSelectionMarker(initialRange);
        }
        if (shift)
          screenAnchor = session.documentToScreenPosition(selection.lead);
        else
          selection.moveToPosition(pos);
        screenCursor = { row: -1, column: -1 };
        var onMouseSelectionEnd = function(e3) {
          blockSelect();
          clearInterval(timerId);
          editor.removeSelectionMarkers(rectSel);
          if (!rectSel.length)
            rectSel = [selection.toOrientedRange()];
          if (initialRange) {
            editor.removeSelectionMarker(initialRange);
            selection.toSingleRange(initialRange);
          }
          for (var i2 = 0; i2 < rectSel.length; i2++)
            selection.addRange(rectSel[i2]);
          editor.inVirtualSelectionMode = false;
          editor.$mouseHandler.$clickSelection = null;
        };
        var onSelectionInterval = blockSelect;
        event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
        var timerId = setInterval(function() {
          onSelectionInterval();
        }, 20);
        return e2.preventDefault();
      }
    }
    exports3.onMouseDown = onMouseDown;
  });
  ace.define("ace/commands/multi_select_commands", ["require", "exports", "module", "ace/keyboard/hash_handler"], function(require2, exports3, module3) {
    exports3.defaultCommands = [{
      name: "addCursorAbove",
      description: "Add cursor above",
      exec: function(editor) {
        editor.selectMoreLines(-1);
      },
      bindKey: { win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorBelow",
      description: "Add cursor below",
      exec: function(editor) {
        editor.selectMoreLines(1);
      },
      bindKey: { win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorAboveSkipCurrent",
      description: "Add cursor above (skip current)",
      exec: function(editor) {
        editor.selectMoreLines(-1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "addCursorBelowSkipCurrent",
      description: "Add cursor below (skip current)",
      exec: function(editor) {
        editor.selectMoreLines(1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectMoreBefore",
      description: "Select more before",
      exec: function(editor) {
        editor.selectMore(-1);
      },
      bindKey: { win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectMoreAfter",
      description: "Select more after",
      exec: function(editor) {
        editor.selectMore(1);
      },
      bindKey: { win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectNextBefore",
      description: "Select next before",
      exec: function(editor) {
        editor.selectMore(-1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "selectNextAfter",
      description: "Select next after",
      exec: function(editor) {
        editor.selectMore(1, true);
      },
      bindKey: { win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right" },
      scrollIntoView: "cursor",
      readOnly: true
    }, {
      name: "toggleSplitSelectionIntoLines",
      description: "Split selection into lines",
      exec: function(editor) {
        if (editor.multiSelect.rangeCount > 1)
          editor.multiSelect.joinSelections();
        else
          editor.multiSelect.splitIntoLines();
      },
      bindKey: { win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L" },
      readOnly: true
    }, {
      name: "splitSelectionIntoLines",
      description: "Split into lines",
      exec: function(editor) {
        editor.multiSelect.splitIntoLines();
      },
      readOnly: true
    }, {
      name: "alignCursors",
      description: "Align cursors",
      exec: function(editor) {
        editor.alignCursors();
      },
      bindKey: { win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A" },
      scrollIntoView: "cursor"
    }, {
      name: "findAll",
      description: "Find all",
      exec: function(editor) {
        editor.findAll();
      },
      bindKey: { win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G" },
      scrollIntoView: "cursor",
      readOnly: true
    }];
    exports3.multiSelectCommands = [{
      name: "singleSelection",
      description: "Single selection",
      bindKey: "esc",
      exec: function(editor) {
        editor.exitMultiSelectMode();
      },
      scrollIntoView: "cursor",
      readOnly: true,
      isAvailable: function(editor) {
        return editor && editor.inMultiSelectMode;
      }
    }];
    var HashHandler = require2("../keyboard/hash_handler").HashHandler;
    exports3.keyboardHandler = new HashHandler(exports3.multiSelectCommands);
  });
  ace.define("ace/multi_select", ["require", "exports", "module", "ace/range_list", "ace/range", "ace/selection", "ace/mouse/multi_select_handler", "ace/lib/event", "ace/lib/lang", "ace/commands/multi_select_commands", "ace/search", "ace/edit_session", "ace/editor", "ace/config"], function(require2, exports3, module3) {
    var RangeList = require2("./range_list").RangeList;
    var Range = require2("./range").Range;
    var Selection = require2("./selection").Selection;
    var onMouseDown = require2("./mouse/multi_select_handler").onMouseDown;
    var event = require2("./lib/event");
    var lang2 = require2("./lib/lang");
    var commands = require2("./commands/multi_select_commands");
    exports3.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
    var Search = require2("./search").Search;
    var search2 = new Search();
    function find2(session, needle, dir) {
      search2.$options.wrap = true;
      search2.$options.needle = needle;
      search2.$options.backwards = dir == -1;
      return search2.find(session);
    }
    var EditSession = require2("./edit_session").EditSession;
    (function() {
      this.getSelectionMarkers = function() {
        return this.$selectionMarkers;
      };
    }).call(EditSession.prototype);
    (function() {
      this.ranges = null;
      this.rangeList = null;
      this.addRange = function(range3, $blockChangeEvents) {
        if (!range3)
          return;
        if (!this.inMultiSelectMode && this.rangeCount === 0) {
          var oldRange = this.toOrientedRange();
          this.rangeList.add(oldRange);
          this.rangeList.add(range3);
          if (this.rangeList.ranges.length != 2) {
            this.rangeList.removeAll();
            return $blockChangeEvents || this.fromOrientedRange(range3);
          }
          this.rangeList.removeAll();
          this.rangeList.add(oldRange);
          this.$onAddRange(oldRange);
        }
        if (!range3.cursor)
          range3.cursor = range3.end;
        var removed = this.rangeList.add(range3);
        this.$onAddRange(range3);
        if (removed.length)
          this.$onRemoveRange(removed);
        if (this.rangeCount > 1 && !this.inMultiSelectMode) {
          this._signal("multiSelect");
          this.inMultiSelectMode = true;
          this.session.$undoSelect = false;
          this.rangeList.attach(this.session);
        }
        return $blockChangeEvents || this.fromOrientedRange(range3);
      };
      this.toSingleRange = function(range3) {
        range3 = range3 || this.ranges[0];
        var removed = this.rangeList.removeAll();
        if (removed.length)
          this.$onRemoveRange(removed);
        range3 && this.fromOrientedRange(range3);
      };
      this.substractPoint = function(pos) {
        var removed = this.rangeList.substractPoint(pos);
        if (removed) {
          this.$onRemoveRange(removed);
          return removed[0];
        }
      };
      this.mergeOverlappingRanges = function() {
        var removed = this.rangeList.merge();
        if (removed.length)
          this.$onRemoveRange(removed);
      };
      this.$onAddRange = function(range3) {
        this.rangeCount = this.rangeList.ranges.length;
        this.ranges.unshift(range3);
        this._signal("addRange", { range: range3 });
      };
      this.$onRemoveRange = function(removed) {
        this.rangeCount = this.rangeList.ranges.length;
        if (this.rangeCount == 1 && this.inMultiSelectMode) {
          var lastRange = this.rangeList.ranges.pop();
          removed.push(lastRange);
          this.rangeCount = 0;
        }
        for (var i2 = removed.length; i2--; ) {
          var index2 = this.ranges.indexOf(removed[i2]);
          this.ranges.splice(index2, 1);
        }
        this._signal("removeRange", { ranges: removed });
        if (this.rangeCount === 0 && this.inMultiSelectMode) {
          this.inMultiSelectMode = false;
          this._signal("singleSelect");
          this.session.$undoSelect = true;
          this.rangeList.detach(this.session);
        }
        lastRange = lastRange || this.ranges[0];
        if (lastRange && !lastRange.isEqual(this.getRange()))
          this.fromOrientedRange(lastRange);
      };
      this.$initRangeList = function() {
        if (this.rangeList)
          return;
        this.rangeList = new RangeList();
        this.ranges = [];
        this.rangeCount = 0;
      };
      this.getAllRanges = function() {
        return this.rangeCount ? this.rangeList.ranges.concat() : [this.getRange()];
      };
      this.splitIntoLines = function() {
        var ranges = this.ranges.length ? this.ranges : [this.getRange()];
        var newRanges = [];
        for (var i2 = 0; i2 < ranges.length; i2++) {
          var range3 = ranges[i2];
          var row = range3.start.row;
          var endRow = range3.end.row;
          if (row === endRow) {
            newRanges.push(range3.clone());
          } else {
            newRanges.push(new Range(row, range3.start.column, row, this.session.getLine(row).length));
            while (++row < endRow)
              newRanges.push(this.getLineRange(row, true));
            newRanges.push(new Range(endRow, 0, endRow, range3.end.column));
          }
          if (i2 == 0 && !this.isBackwards())
            newRanges = newRanges.reverse();
        }
        this.toSingleRange();
        for (var i2 = newRanges.length; i2--; )
          this.addRange(newRanges[i2]);
      };
      this.joinSelections = function() {
        var ranges = this.rangeList.ranges;
        var lastRange = ranges[ranges.length - 1];
        var range3 = Range.fromPoints(ranges[0].start, lastRange.end);
        this.toSingleRange();
        this.setSelectionRange(range3, lastRange.cursor == lastRange.start);
      };
      this.toggleBlockSelection = function() {
        if (this.rangeCount > 1) {
          var ranges = this.rangeList.ranges;
          var lastRange = ranges[ranges.length - 1];
          var range3 = Range.fromPoints(ranges[0].start, lastRange.end);
          this.toSingleRange();
          this.setSelectionRange(range3, lastRange.cursor == lastRange.start);
        } else {
          var cursor = this.session.documentToScreenPosition(this.cursor);
          var anchor = this.session.documentToScreenPosition(this.anchor);
          var rectSel = this.rectangularRangeBlock(cursor, anchor);
          rectSel.forEach(this.addRange, this);
        }
      };
      this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
        var rectSel = [];
        var xBackwards = screenCursor.column < screenAnchor.column;
        if (xBackwards) {
          var startColumn = screenCursor.column;
          var endColumn = screenAnchor.column;
          var startOffsetX = screenCursor.offsetX;
          var endOffsetX = screenAnchor.offsetX;
        } else {
          var startColumn = screenAnchor.column;
          var endColumn = screenCursor.column;
          var startOffsetX = screenAnchor.offsetX;
          var endOffsetX = screenCursor.offsetX;
        }
        var yBackwards = screenCursor.row < screenAnchor.row;
        if (yBackwards) {
          var startRow = screenCursor.row;
          var endRow = screenAnchor.row;
        } else {
          var startRow = screenAnchor.row;
          var endRow = screenCursor.row;
        }
        if (startColumn < 0)
          startColumn = 0;
        if (startRow < 0)
          startRow = 0;
        if (startRow == endRow)
          includeEmptyLines = true;
        var docEnd;
        for (var row = startRow; row <= endRow; row++) {
          var range3 = Range.fromPoints(this.session.screenToDocumentPosition(row, startColumn, startOffsetX), this.session.screenToDocumentPosition(row, endColumn, endOffsetX));
          if (range3.isEmpty()) {
            if (docEnd && isSamePoint(range3.end, docEnd))
              break;
            docEnd = range3.end;
          }
          range3.cursor = xBackwards ? range3.start : range3.end;
          rectSel.push(range3);
        }
        if (yBackwards)
          rectSel.reverse();
        if (!includeEmptyLines) {
          var end = rectSel.length - 1;
          while (rectSel[end].isEmpty() && end > 0)
            end--;
          if (end > 0) {
            var start = 0;
            while (rectSel[start].isEmpty())
              start++;
          }
          for (var i2 = end; i2 >= start; i2--) {
            if (rectSel[i2].isEmpty())
              rectSel.splice(i2, 1);
          }
        }
        return rectSel;
      };
    }).call(Selection.prototype);
    var Editor2 = require2("./editor").Editor;
    (function() {
      this.updateSelectionMarkers = function() {
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.addSelectionMarker = function(orientedRange) {
        if (!orientedRange.cursor)
          orientedRange.cursor = orientedRange.end;
        var style2 = this.getSelectionStyle();
        orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style2);
        this.session.$selectionMarkers.push(orientedRange);
        this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
        return orientedRange;
      };
      this.removeSelectionMarker = function(range3) {
        if (!range3.marker)
          return;
        this.session.removeMarker(range3.marker);
        var index2 = this.session.$selectionMarkers.indexOf(range3);
        if (index2 != -1)
          this.session.$selectionMarkers.splice(index2, 1);
        this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
      };
      this.removeSelectionMarkers = function(ranges) {
        var markerList = this.session.$selectionMarkers;
        for (var i2 = ranges.length; i2--; ) {
          var range3 = ranges[i2];
          if (!range3.marker)
            continue;
          this.session.removeMarker(range3.marker);
          var index2 = markerList.indexOf(range3);
          if (index2 != -1)
            markerList.splice(index2, 1);
        }
        this.session.selectionMarkerCount = markerList.length;
      };
      this.$onAddRange = function(e2) {
        this.addSelectionMarker(e2.range);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onRemoveRange = function(e2) {
        this.removeSelectionMarkers(e2.ranges);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onMultiSelect = function(e2) {
        if (this.inMultiSelectMode)
          return;
        this.inMultiSelectMode = true;
        this.setStyle("ace_multiselect");
        this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
        this.commands.setDefaultHandler("exec", this.$onMultiSelectExec);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
      };
      this.$onSingleSelect = function(e2) {
        if (this.session.multiSelect.inVirtualMode)
          return;
        this.inMultiSelectMode = false;
        this.unsetStyle("ace_multiselect");
        this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
        this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec);
        this.renderer.updateCursor();
        this.renderer.updateBackMarkers();
        this._emit("changeSelection");
      };
      this.$onMultiSelectExec = function(e2) {
        var command = e2.command;
        var editor = e2.editor;
        if (!editor.multiSelect)
          return;
        if (!command.multiSelectAction) {
          var result = command.exec(editor, e2.args || {});
          editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
          editor.multiSelect.mergeOverlappingRanges();
        } else if (command.multiSelectAction == "forEach") {
          result = editor.forEachSelection(command, e2.args);
        } else if (command.multiSelectAction == "forEachLine") {
          result = editor.forEachSelection(command, e2.args, true);
        } else if (command.multiSelectAction == "single") {
          editor.exitMultiSelectMode();
          result = command.exec(editor, e2.args || {});
        } else {
          result = command.multiSelectAction(editor, e2.args || {});
        }
        return result;
      };
      this.forEachSelection = function(cmd, args, options) {
        if (this.inVirtualSelectionMode)
          return;
        var keepOrder = options && options.keepOrder;
        var $byLines = options == true || options && options.$byLines;
        var session = this.session;
        var selection = this.selection;
        var rangeList = selection.rangeList;
        var ranges = (keepOrder ? selection : rangeList).ranges;
        var result;
        if (!ranges.length)
          return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
        var reg = selection._eventRegistry;
        selection._eventRegistry = {};
        var tmpSel = new Selection(session);
        this.inVirtualSelectionMode = true;
        for (var i2 = ranges.length; i2--; ) {
          if ($byLines) {
            while (i2 > 0 && ranges[i2].start.row == ranges[i2 - 1].end.row)
              i2--;
          }
          tmpSel.fromOrientedRange(ranges[i2]);
          tmpSel.index = i2;
          this.selection = session.selection = tmpSel;
          var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
          if (!result && cmdResult !== void 0)
            result = cmdResult;
          tmpSel.toOrientedRange(ranges[i2]);
        }
        tmpSel.detach();
        this.selection = session.selection = selection;
        this.inVirtualSelectionMode = false;
        selection._eventRegistry = reg;
        selection.mergeOverlappingRanges();
        if (selection.ranges[0])
          selection.fromOrientedRange(selection.ranges[0]);
        var anim = this.renderer.$scrollAnimation;
        this.onCursorChange();
        this.onSelectionChange();
        if (anim && anim.from == anim.to)
          this.renderer.animateScrolling(anim.from);
        return result;
      };
      this.exitMultiSelectMode = function() {
        if (!this.inMultiSelectMode || this.inVirtualSelectionMode)
          return;
        this.multiSelect.toSingleRange();
      };
      this.getSelectedText = function() {
        var text2 = "";
        if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
          var ranges = this.multiSelect.rangeList.ranges;
          var buf = [];
          for (var i2 = 0; i2 < ranges.length; i2++) {
            buf.push(this.session.getTextRange(ranges[i2]));
          }
          var nl2 = this.session.getDocument().getNewLineCharacter();
          text2 = buf.join(nl2);
          if (text2.length == (buf.length - 1) * nl2.length)
            text2 = "";
        } else if (!this.selection.isEmpty()) {
          text2 = this.session.getTextRange(this.getSelectionRange());
        }
        return text2;
      };
      this.$checkMultiselectChange = function(e2, anchor) {
        if (this.inMultiSelectMode && !this.inVirtualSelectionMode) {
          var range3 = this.multiSelect.ranges[0];
          if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor)
            return;
          var pos = anchor == this.multiSelect.anchor ? range3.cursor == range3.start ? range3.end : range3.start : range3.cursor;
          if (pos.row != anchor.row || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column)
            this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange());
          else
            this.multiSelect.mergeOverlappingRanges();
        }
      };
      this.findAll = function(needle, options, additive) {
        options = options || {};
        options.needle = needle || options.needle;
        if (options.needle == void 0) {
          var range3 = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange();
          options.needle = this.session.getTextRange(range3);
        }
        this.$search.set(options);
        var ranges = this.$search.findAll(this.session);
        if (!ranges.length)
          return 0;
        var selection = this.multiSelect;
        if (!additive)
          selection.toSingleRange(ranges[0]);
        for (var i2 = ranges.length; i2--; )
          selection.addRange(ranges[i2], true);
        if (range3 && selection.rangeList.rangeAtPoint(range3.start))
          selection.addRange(range3, true);
        return ranges.length;
      };
      this.selectMoreLines = function(dir, skip2) {
        var range3 = this.selection.toOrientedRange();
        var isBackwards = range3.cursor == range3.end;
        var screenLead = this.session.documentToScreenPosition(range3.cursor);
        if (this.selection.$desiredColumn)
          screenLead.column = this.selection.$desiredColumn;
        var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
        if (!range3.isEmpty()) {
          var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range3.end : range3.start);
          var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
        } else {
          var anchor = lead;
        }
        if (isBackwards) {
          var newRange = Range.fromPoints(lead, anchor);
          newRange.cursor = newRange.start;
        } else {
          var newRange = Range.fromPoints(anchor, lead);
          newRange.cursor = newRange.end;
        }
        newRange.desiredColumn = screenLead.column;
        if (!this.selection.inMultiSelectMode) {
          this.selection.addRange(range3);
        } else {
          if (skip2)
            var toRemove = range3.cursor;
        }
        this.selection.addRange(newRange);
        if (toRemove)
          this.selection.substractPoint(toRemove);
      };
      this.transposeSelections = function(dir) {
        var session = this.session;
        var sel = session.multiSelect;
        var all3 = sel.ranges;
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          if (range3.isEmpty()) {
            var tmp_1 = session.getWordRange(range3.start.row, range3.start.column);
            range3.start.row = tmp_1.start.row;
            range3.start.column = tmp_1.start.column;
            range3.end.row = tmp_1.end.row;
            range3.end.column = tmp_1.end.column;
          }
        }
        sel.mergeOverlappingRanges();
        var words = [];
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          words.unshift(session.getTextRange(range3));
        }
        if (dir < 0)
          words.unshift(words.pop());
        else
          words.push(words.shift());
        for (var i2 = all3.length; i2--; ) {
          var range3 = all3[i2];
          var tmp = range3.clone();
          session.replace(range3, words[i2]);
          range3.start.row = tmp.start.row;
          range3.start.column = tmp.start.column;
        }
        sel.fromOrientedRange(sel.ranges[0]);
      };
      this.selectMore = function(dir, skip2, stopAtFirst) {
        var session = this.session;
        var sel = session.multiSelect;
        var range3 = sel.toOrientedRange();
        if (range3.isEmpty()) {
          range3 = session.getWordRange(range3.start.row, range3.start.column);
          range3.cursor = dir == -1 ? range3.start : range3.end;
          this.multiSelect.addRange(range3);
          if (stopAtFirst)
            return;
        }
        var needle = session.getTextRange(range3);
        var newRange = find2(session, needle, dir);
        if (newRange) {
          newRange.cursor = dir == -1 ? newRange.start : newRange.end;
          this.session.unfold(newRange);
          this.multiSelect.addRange(newRange);
          this.renderer.scrollCursorIntoView(null, 0.5);
        }
        if (skip2)
          this.multiSelect.substractPoint(range3.cursor);
      };
      this.alignCursors = function() {
        var session = this.session;
        var sel = session.multiSelect;
        var ranges = sel.ranges;
        var row = -1;
        var sameRowRanges = ranges.filter(function(r2) {
          if (r2.cursor.row == row)
            return true;
          row = r2.cursor.row;
        });
        if (!ranges.length || sameRowRanges.length == ranges.length - 1) {
          var range3 = this.selection.getRange();
          var fr = range3.start.row, lr = range3.end.row;
          var guessRange = fr == lr;
          if (guessRange) {
            var max2 = this.session.getLength();
            var line2;
            do {
              line2 = this.session.getLine(lr);
            } while (/[=:]/.test(line2) && ++lr < max2);
            do {
              line2 = this.session.getLine(fr);
            } while (/[=:]/.test(line2) && --fr > 0);
            if (fr < 0)
              fr = 0;
            if (lr >= max2)
              lr = max2 - 1;
          }
          var lines = this.session.removeFullLines(fr, lr);
          lines = this.$reAlignText(lines, guessRange);
          this.session.insert({ row: fr, column: 0 }, lines.join("\n") + "\n");
          if (!guessRange) {
            range3.start.column = 0;
            range3.end.column = lines[lines.length - 1].length;
          }
          this.selection.setRange(range3);
        } else {
          sameRowRanges.forEach(function(r2) {
            sel.substractPoint(r2.cursor);
          });
          var maxCol = 0;
          var minSpace = Infinity;
          var spaceOffsets = ranges.map(function(r2) {
            var p2 = r2.cursor;
            var line3 = session.getLine(p2.row);
            var spaceOffset = line3.substr(p2.column).search(/\S/g);
            if (spaceOffset == -1)
              spaceOffset = 0;
            if (p2.column > maxCol)
              maxCol = p2.column;
            if (spaceOffset < minSpace)
              minSpace = spaceOffset;
            return spaceOffset;
          });
          ranges.forEach(function(r2, i2) {
            var p2 = r2.cursor;
            var l2 = maxCol - p2.column;
            var d2 = spaceOffsets[i2] - minSpace;
            if (l2 > d2)
              session.insert(p2, lang2.stringRepeat(" ", l2 - d2));
            else
              session.remove(new Range(p2.row, p2.column, p2.row, p2.column - l2 + d2));
            r2.start.column = r2.end.column = maxCol;
            r2.start.row = r2.end.row = p2.row;
            r2.cursor = r2.end;
          });
          sel.fromOrientedRange(ranges[0]);
          this.renderer.updateCursor();
          this.renderer.updateBackMarkers();
        }
      };
      this.$reAlignText = function(lines, forceLeft) {
        var isLeftAligned = true, isRightAligned = true;
        var startW, textW, endW;
        return lines.map(function(line2) {
          var m2 = line2.match(/(\s*)(.*?)(\s*)([=:].*)/);
          if (!m2)
            return [line2];
          if (startW == null) {
            startW = m2[1].length;
            textW = m2[2].length;
            endW = m2[3].length;
            return m2;
          }
          if (startW + textW + endW != m2[1].length + m2[2].length + m2[3].length)
            isRightAligned = false;
          if (startW != m2[1].length)
            isLeftAligned = false;
          if (startW > m2[1].length)
            startW = m2[1].length;
          if (textW < m2[2].length)
            textW = m2[2].length;
          if (endW > m2[3].length)
            endW = m2[3].length;
          return m2;
        }).map(forceLeft ? alignLeft : isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign);
        function spaces(n2) {
          return lang2.stringRepeat(" ", n2);
        }
        function alignLeft(m2) {
          return !m2[2] ? m2[0] : spaces(startW) + m2[2] + spaces(textW - m2[2].length + endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
        function alignRight(m2) {
          return !m2[2] ? m2[0] : spaces(startW + textW - m2[2].length) + m2[2] + spaces(endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
        function unAlign(m2) {
          return !m2[2] ? m2[0] : spaces(startW) + m2[2] + spaces(endW) + m2[4].replace(/^([=:])\s+/, "$1 ");
        }
      };
    }).call(Editor2.prototype);
    function isSamePoint(p1, p2) {
      return p1.row == p2.row && p1.column == p2.column;
    }
    exports3.onSessionChange = function(e2) {
      var session = e2.session;
      if (session && !session.multiSelect) {
        session.$selectionMarkers = [];
        session.selection.$initRangeList();
        session.multiSelect = session.selection;
      }
      this.multiSelect = session && session.multiSelect;
      var oldSession = e2.oldSession;
      if (oldSession) {
        oldSession.multiSelect.off("addRange", this.$onAddRange);
        oldSession.multiSelect.off("removeRange", this.$onRemoveRange);
        oldSession.multiSelect.off("multiSelect", this.$onMultiSelect);
        oldSession.multiSelect.off("singleSelect", this.$onSingleSelect);
        oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange);
        oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange);
      }
      if (session) {
        session.multiSelect.on("addRange", this.$onAddRange);
        session.multiSelect.on("removeRange", this.$onRemoveRange);
        session.multiSelect.on("multiSelect", this.$onMultiSelect);
        session.multiSelect.on("singleSelect", this.$onSingleSelect);
        session.multiSelect.lead.on("change", this.$checkMultiselectChange);
        session.multiSelect.anchor.on("change", this.$checkMultiselectChange);
      }
      if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) {
        if (session.selection.inMultiSelectMode)
          this.$onMultiSelect();
        else
          this.$onSingleSelect();
      }
    };
    function MultiSelect(editor) {
      if (editor.$multiselectOnSessionChange)
        return;
      editor.$onAddRange = editor.$onAddRange.bind(editor);
      editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
      editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
      editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
      editor.$multiselectOnSessionChange = exports3.onSessionChange.bind(editor);
      editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor);
      editor.$multiselectOnSessionChange(editor);
      editor.on("changeSession", editor.$multiselectOnSessionChange);
      editor.on("mousedown", onMouseDown);
      editor.commands.addCommands(commands.defaultCommands);
      addAltCursorListeners(editor);
    }
    function addAltCursorListeners(editor) {
      if (!editor.textInput)
        return;
      var el2 = editor.textInput.getElement();
      var altCursor = false;
      event.addListener(el2, "keydown", function(e2) {
        var altDown = e2.keyCode == 18 && !(e2.ctrlKey || e2.shiftKey || e2.metaKey);
        if (editor.$blockSelectEnabled && altDown) {
          if (!altCursor) {
            editor.renderer.setMouseCursor("crosshair");
            altCursor = true;
          }
        } else if (altCursor) {
          reset();
        }
      }, editor);
      event.addListener(el2, "keyup", reset, editor);
      event.addListener(el2, "blur", reset, editor);
      function reset(e2) {
        if (altCursor) {
          editor.renderer.setMouseCursor("");
          altCursor = false;
        }
      }
    }
    exports3.MultiSelect = MultiSelect;
    require2("./config").defineOptions(Editor2.prototype, "editor", {
      enableMultiselect: {
        set: function(val) {
          MultiSelect(this);
          if (val) {
            this.on("mousedown", onMouseDown);
          } else {
            this.off("mousedown", onMouseDown);
          }
        },
        value: true
      },
      enableBlockSelect: {
        set: function(val) {
          this.$blockSelectEnabled = val;
        },
        value: true
      }
    });
  });
  ace.define("ace/mode/folding/fold_mode", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("../../range").Range;
    var FoldMode = exports3.FoldMode = function() {
    };
    (function() {
      this.foldingStartMarker = null;
      this.foldingStopMarker = null;
      this.getFoldWidget = function(session, foldStyle, row) {
        var line2 = session.getLine(row);
        if (this.foldingStartMarker.test(line2))
          return "start";
        if (foldStyle == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(line2))
          return "end";
        return "";
      };
      this.getFoldWidgetRange = function(session, foldStyle, row) {
        return null;
      };
      this.indentationBlock = function(session, row, column2) {
        var re2 = /\S/;
        var line2 = session.getLine(row);
        var startLevel = line2.search(re2);
        if (startLevel == -1)
          return;
        var startColumn = column2 || line2.length;
        var maxRow = session.getLength();
        var startRow = row;
        var endRow = row;
        while (++row < maxRow) {
          var level = session.getLine(row).search(re2);
          if (level == -1)
            continue;
          if (level <= startLevel) {
            var token2 = session.getTokenAt(row, 0);
            if (!token2 || token2.type !== "string")
              break;
          }
          endRow = row;
        }
        if (endRow > startRow) {
          var endColumn = session.getLine(endRow).length;
          return new Range(startRow, startColumn, endRow, endColumn);
        }
      };
      this.openingBracketBlock = function(session, bracket, row, column2, typeRe) {
        var start = { row, column: column2 + 1 };
        var end = session.$findClosingBracket(bracket, start, typeRe);
        if (!end)
          return;
        var fw = session.foldWidgets[end.row];
        if (fw == null)
          fw = session.getFoldWidget(end.row);
        if (fw == "start" && end.row > start.row) {
          end.row--;
          end.column = session.getLine(end.row).length;
        }
        return Range.fromPoints(start, end);
      };
      this.closingBracketBlock = function(session, bracket, row, column2, typeRe) {
        var end = { row, column: column2 };
        var start = session.$findOpeningBracket(bracket, end);
        if (!start)
          return;
        start.column++;
        end.column--;
        return Range.fromPoints(start, end);
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/ext/error_marker", ["require", "exports", "module", "ace/lib/dom", "ace/range", "ace/config"], function(require2, exports3, module3) {
    var dom = require2("../lib/dom");
    var Range = require2("../range").Range;
    var nls = require2("../config").nls;
    function binarySearch2(array4, needle, comparator) {
      var first = 0;
      var last = array4.length - 1;
      while (first <= last) {
        var mid = first + last >> 1;
        var c2 = comparator(needle, array4[mid]);
        if (c2 > 0)
          first = mid + 1;
        else if (c2 < 0)
          last = mid - 1;
        else
          return mid;
      }
      return -(first + 1);
    }
    function findAnnotations(session, row, dir) {
      var annotations = session.getAnnotations().sort(Range.comparePoints);
      if (!annotations.length)
        return;
      var i2 = binarySearch2(annotations, { row, column: -1 }, Range.comparePoints);
      if (i2 < 0)
        i2 = -i2 - 1;
      if (i2 >= annotations.length)
        i2 = dir > 0 ? 0 : annotations.length - 1;
      else if (i2 === 0 && dir < 0)
        i2 = annotations.length - 1;
      var annotation = annotations[i2];
      if (!annotation || !dir)
        return;
      if (annotation.row === row) {
        do {
          annotation = annotations[i2 += dir];
        } while (annotation && annotation.row === row);
        if (!annotation)
          return annotations.slice();
      }
      var matched = [];
      row = annotation.row;
      do {
        matched[dir < 0 ? "unshift" : "push"](annotation);
        annotation = annotations[i2 += dir];
      } while (annotation && annotation.row == row);
      return matched.length && matched;
    }
    exports3.showErrorMarker = function(editor, dir) {
      var session = editor.session;
      var pos = editor.getCursorPosition();
      var row = pos.row;
      var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w3) {
        return w3.type == "errorMarker";
      })[0];
      if (oldWidget) {
        oldWidget.destroy();
      } else {
        row -= dir;
      }
      var annotations = findAnnotations(session, row, dir);
      var gutterAnno;
      if (annotations) {
        var annotation = annotations[0];
        pos.column = (annotation.pos && typeof annotation.column != "number" ? annotation.pos.sc : annotation.column) || 0;
        pos.row = annotation.row;
        gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row];
      } else if (oldWidget) {
        return;
      } else {
        gutterAnno = {
          displayText: [nls("error-marker.good-state", "Looks good!")],
          className: "ace_ok"
        };
      }
      editor.session.unfold(pos.row);
      editor.selection.moveToPosition(pos);
      var w2 = {
        row: pos.row,
        fixedWidth: true,
        coverGutter: true,
        el: dom.createElement("div"),
        type: "errorMarker"
      };
      var el2 = w2.el.appendChild(dom.createElement("div"));
      var arrow = w2.el.appendChild(dom.createElement("div"));
      arrow.className = "error_widget_arrow " + gutterAnno.className;
      var left2 = editor.renderer.$cursorLayer.getPixelPosition(pos).left;
      arrow.style.left = left2 + editor.renderer.gutterWidth - 5 + "px";
      w2.el.className = "error_widget_wrapper";
      el2.className = "error_widget " + gutterAnno.className;
      gutterAnno.displayText.forEach(function(annoTextLine, i2) {
        el2.appendChild(dom.createTextNode(annoTextLine));
        if (i2 < gutterAnno.displayText.length - 1) {
          el2.appendChild(dom.createElement("br"));
        }
      });
      el2.appendChild(dom.createElement("div"));
      var kb2 = function(_24, hashId, keyString) {
        if (hashId === 0 && (keyString === "esc" || keyString === "return")) {
          w2.destroy();
          return { command: "null" };
        }
      };
      w2.destroy = function() {
        if (editor.$mouseHandler.isMousePressed)
          return;
        editor.keyBinding.removeKeyboardHandler(kb2);
        session.widgetManager.removeLineWidget(w2);
        editor.off("changeSelection", w2.destroy);
        editor.off("changeSession", w2.destroy);
        editor.off("mouseup", w2.destroy);
        editor.off("change", w2.destroy);
      };
      editor.keyBinding.addKeyboardHandler(kb2);
      editor.on("changeSelection", w2.destroy);
      editor.on("changeSession", w2.destroy);
      editor.on("mouseup", w2.destroy);
      editor.on("change", w2.destroy);
      editor.session.widgetManager.addLineWidget(w2);
      w2.el.onmousedown = editor.focus.bind(editor);
      editor.renderer.scrollCursorIntoView(null, 0.5, { bottom: w2.el.offsetHeight });
    };
    dom.importCssString("\n    .error_widget_wrapper {\n        background: inherit;\n        color: inherit;\n        border:none\n    }\n    .error_widget {\n        border-top: solid 2px;\n        border-bottom: solid 2px;\n        margin: 5px 0;\n        padding: 10px 40px;\n        white-space: pre-wrap;\n    }\n    .error_widget.ace_error, .error_widget_arrow.ace_error{\n        border-color: #ff5a5a\n    }\n    .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n        border-color: #F1D817\n    }\n    .error_widget.ace_info, .error_widget_arrow.ace_info{\n        border-color: #5a5a5a\n    }\n    .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n        border-color: #5aaa5a\n    }\n    .error_widget_arrow {\n        position: absolute;\n        border: solid 5px;\n        border-top-color: transparent!important;\n        border-right-color: transparent!important;\n        border-left-color: transparent!important;\n        top: -5px;\n    }\n", "error_marker.css", false);
  });
  ace.define("ace/ace", ["require", "exports", "module", "ace/lib/dom", "ace/range", "ace/editor", "ace/edit_session", "ace/undomanager", "ace/virtual_renderer", "ace/worker/worker_client", "ace/keyboard/hash_handler", "ace/placeholder", "ace/multi_select", "ace/mode/folding/fold_mode", "ace/theme/textmate", "ace/ext/error_marker", "ace/config", "ace/loader_build"], function(require2, exports3, module3) {
    require2("./loader_build")(exports3);
    var dom = require2("./lib/dom");
    var Range = require2("./range").Range;
    var Editor2 = require2("./editor").Editor;
    var EditSession = require2("./edit_session").EditSession;
    var UndoManager = require2("./undomanager").UndoManager;
    var Renderer = require2("./virtual_renderer").VirtualRenderer;
    require2("./worker/worker_client");
    require2("./keyboard/hash_handler");
    require2("./placeholder");
    require2("./multi_select");
    require2("./mode/folding/fold_mode");
    require2("./theme/textmate");
    require2("./ext/error_marker");
    exports3.config = require2("./config");
    exports3.edit = function(el2, options) {
      if (typeof el2 == "string") {
        var _id = el2;
        el2 = document.getElementById(_id);
        if (!el2)
          throw new Error("ace.edit can't find div #" + _id);
      }
      if (el2 && el2.env && el2.env.editor instanceof Editor2)
        return el2.env.editor;
      var value2 = "";
      if (el2 && /input|textarea/i.test(el2.tagName)) {
        var oldNode = el2;
        value2 = oldNode.value;
        el2 = dom.createElement("pre");
        oldNode.parentNode.replaceChild(el2, oldNode);
      } else if (el2) {
        value2 = el2.textContent;
        el2.innerHTML = "";
      }
      var doc = exports3.createEditSession(value2);
      var editor = new Editor2(new Renderer(el2), doc, options);
      var env2 = {
        document: doc,
        editor,
        onResize: editor.resize.bind(editor, null)
      };
      if (oldNode)
        env2.textarea = oldNode;
      editor.on("destroy", function() {
        env2.editor.container.env = null;
      });
      editor.container.env = editor.env = env2;
      return editor;
    };
    exports3.createEditSession = function(text2, mode) {
      var doc = new EditSession(text2, mode);
      doc.setUndoManager(new UndoManager());
      return doc;
    };
    exports3.Range = Range;
    exports3.Editor = Editor2;
    exports3.EditSession = EditSession;
    exports3.UndoManager = UndoManager;
    exports3.VirtualRenderer = Renderer;
    var version2 = exports3.config.version;
    exports3.version = version2;
  });
  (function() {
    ace.require(["ace/ace"], function(a2) {
      if (a2) {
        a2.config.init(true);
        a2.define = ace.define;
      }
      var global2 = /* @__PURE__ */ function() {
        return this;
      }();
      if (!global2 && typeof window != "undefined")
        global2 = window;
      if (!global2 && typeof self != "undefined")
        global2 = self;
      if (!global2.ace)
        global2.ace = a2;
      for (var key in a2)
        if (a2.hasOwnProperty(key))
          global2.ace[key] = a2[key];
      global2.ace["default"] = global2.ace;
      if (module2) {
        module2.exports = global2.ace;
      }
    });
  })();
})(ace$3);
var aceExports = ace$3.exports;
var lodash_isequal = { exports: {} };
lodash_isequal.exports;
(function(module2, exports2) {
  var LARGE_ARRAY_SIZE2 = 200;
  var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
  var COMPARE_PARTIAL_FLAG2 = 1, COMPARE_UNORDERED_FLAG2 = 2;
  var MAX_SAFE_INTEGER2 = 9007199254740991;
  var argsTag2 = "[object Arguments]", arrayTag2 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag2 = "[object Boolean]", dateTag2 = "[object Date]", errorTag2 = "[object Error]", funcTag2 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag2 = "[object Map]", numberTag2 = "[object Number]", nullTag2 = "[object Null]", objectTag2 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag2 = "[object RegExp]", setTag2 = "[object Set]", stringTag2 = "[object String]", symbolTag2 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag2 = "[object WeakMap]";
  var arrayBufferTag2 = "[object ArrayBuffer]", dataViewTag2 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
  var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g;
  var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
  var reIsUint2 = /^(?:0|[1-9]\d*)$/;
  var typedArrayTags2 = {};
  typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
  typedArrayTags2[argsTag2] = typedArrayTags2[arrayTag2] = typedArrayTags2[arrayBufferTag2] = typedArrayTags2[boolTag2] = typedArrayTags2[dataViewTag2] = typedArrayTags2[dateTag2] = typedArrayTags2[errorTag2] = typedArrayTags2[funcTag2] = typedArrayTags2[mapTag2] = typedArrayTags2[numberTag2] = typedArrayTags2[objectTag2] = typedArrayTags2[regexpTag2] = typedArrayTags2[setTag2] = typedArrayTags2[stringTag2] = typedArrayTags2[weakMapTag2] = false;
  var freeGlobal2 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
  var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
  var root2 = freeGlobal2 || freeSelf2 || Function("return this")();
  var freeExports2 = exports2 && !exports2.nodeType && exports2;
  var freeModule2 = freeExports2 && true && module2 && !module2.nodeType && module2;
  var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
  var freeProcess2 = moduleExports2 && freeGlobal2.process;
  var nodeUtil2 = function() {
    try {
      return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
    } catch (e2) {
    }
  }();
  var nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
  function arrayFilter2(array4, predicate) {
    var index2 = -1, length2 = array4 == null ? 0 : array4.length, resIndex = 0, result = [];
    while (++index2 < length2) {
      var value2 = array4[index2];
      if (predicate(value2, index2, array4)) {
        result[resIndex++] = value2;
      }
    }
    return result;
  }
  function arrayPush2(array4, values) {
    var index2 = -1, length2 = values.length, offset2 = array4.length;
    while (++index2 < length2) {
      array4[offset2 + index2] = values[index2];
    }
    return array4;
  }
  function arraySome2(array4, predicate) {
    var index2 = -1, length2 = array4 == null ? 0 : array4.length;
    while (++index2 < length2) {
      if (predicate(array4[index2], index2, array4)) {
        return true;
      }
    }
    return false;
  }
  function baseTimes2(n2, iteratee) {
    var index2 = -1, result = Array(n2);
    while (++index2 < n2) {
      result[index2] = iteratee(index2);
    }
    return result;
  }
  function baseUnary2(func) {
    return function(value2) {
      return func(value2);
    };
  }
  function cacheHas2(cache2, key) {
    return cache2.has(key);
  }
  function getValue2(object4, key) {
    return object4 == null ? void 0 : object4[key];
  }
  function mapToArray2(map2) {
    var index2 = -1, result = Array(map2.size);
    map2.forEach(function(value2, key) {
      result[++index2] = [key, value2];
    });
    return result;
  }
  function overArg2(func, transform2) {
    return function(arg) {
      return func(transform2(arg));
    };
  }
  function setToArray2(set2) {
    var index2 = -1, result = Array(set2.size);
    set2.forEach(function(value2) {
      result[++index2] = value2;
    });
    return result;
  }
  var arrayProto2 = Array.prototype, funcProto2 = Function.prototype, objectProto2 = Object.prototype;
  var coreJsData2 = root2["__core-js_shared__"];
  var funcToString2 = funcProto2.toString;
  var hasOwnProperty2 = objectProto2.hasOwnProperty;
  var maskSrcKey2 = function() {
    var uid2 = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
    return uid2 ? "Symbol(src)_1." + uid2 : "";
  }();
  var nativeObjectToString2 = objectProto2.toString;
  var reIsNative2 = RegExp(
    "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  );
  var Buffer2 = moduleExports2 ? root2.Buffer : void 0, Symbol2 = root2.Symbol, Uint8Array2 = root2.Uint8Array, propertyIsEnumerable2 = objectProto2.propertyIsEnumerable, splice2 = arrayProto2.splice, symToStringTag2 = Symbol2 ? Symbol2.toStringTag : void 0;
  var nativeGetSymbols2 = Object.getOwnPropertySymbols, nativeIsBuffer2 = Buffer2 ? Buffer2.isBuffer : void 0, nativeKeys2 = overArg2(Object.keys, Object);
  var DataView2 = getNative2(root2, "DataView"), Map2 = getNative2(root2, "Map"), Promise2 = getNative2(root2, "Promise"), Set2 = getNative2(root2, "Set"), WeakMap2 = getNative2(root2, "WeakMap"), nativeCreate2 = getNative2(Object, "create");
  var dataViewCtorString2 = toSource2(DataView2), mapCtorString2 = toSource2(Map2), promiseCtorString2 = toSource2(Promise2), setCtorString2 = toSource2(Set2), weakMapCtorString2 = toSource2(WeakMap2);
  var symbolProto2 = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : void 0;
  function Hash2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function hashClear2() {
    this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
    this.size = 0;
  }
  function hashDelete2(key) {
    var result = this.has(key) && delete this.__data__[key];
    this.size -= result ? 1 : 0;
    return result;
  }
  function hashGet2(key) {
    var data = this.__data__;
    if (nativeCreate2) {
      var result = data[key];
      return result === HASH_UNDEFINED2 ? void 0 : result;
    }
    return hasOwnProperty2.call(data, key) ? data[key] : void 0;
  }
  function hashHas2(key) {
    var data = this.__data__;
    return nativeCreate2 ? data[key] !== void 0 : hasOwnProperty2.call(data, key);
  }
  function hashSet2(key, value2) {
    var data = this.__data__;
    this.size += this.has(key) ? 0 : 1;
    data[key] = nativeCreate2 && value2 === void 0 ? HASH_UNDEFINED2 : value2;
    return this;
  }
  Hash2.prototype.clear = hashClear2;
  Hash2.prototype["delete"] = hashDelete2;
  Hash2.prototype.get = hashGet2;
  Hash2.prototype.has = hashHas2;
  Hash2.prototype.set = hashSet2;
  function ListCache2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function listCacheClear2() {
    this.__data__ = [];
    this.size = 0;
  }
  function listCacheDelete2(key) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    if (index2 < 0) {
      return false;
    }
    var lastIndex = data.length - 1;
    if (index2 == lastIndex) {
      data.pop();
    } else {
      splice2.call(data, index2, 1);
    }
    --this.size;
    return true;
  }
  function listCacheGet2(key) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    return index2 < 0 ? void 0 : data[index2][1];
  }
  function listCacheHas2(key) {
    return assocIndexOf2(this.__data__, key) > -1;
  }
  function listCacheSet2(key, value2) {
    var data = this.__data__, index2 = assocIndexOf2(data, key);
    if (index2 < 0) {
      ++this.size;
      data.push([key, value2]);
    } else {
      data[index2][1] = value2;
    }
    return this;
  }
  ListCache2.prototype.clear = listCacheClear2;
  ListCache2.prototype["delete"] = listCacheDelete2;
  ListCache2.prototype.get = listCacheGet2;
  ListCache2.prototype.has = listCacheHas2;
  ListCache2.prototype.set = listCacheSet2;
  function MapCache2(entries) {
    var index2 = -1, length2 = entries == null ? 0 : entries.length;
    this.clear();
    while (++index2 < length2) {
      var entry = entries[index2];
      this.set(entry[0], entry[1]);
    }
  }
  function mapCacheClear2() {
    this.size = 0;
    this.__data__ = {
      "hash": new Hash2(),
      "map": new (Map2 || ListCache2)(),
      "string": new Hash2()
    };
  }
  function mapCacheDelete2(key) {
    var result = getMapData2(this, key)["delete"](key);
    this.size -= result ? 1 : 0;
    return result;
  }
  function mapCacheGet2(key) {
    return getMapData2(this, key).get(key);
  }
  function mapCacheHas2(key) {
    return getMapData2(this, key).has(key);
  }
  function mapCacheSet2(key, value2) {
    var data = getMapData2(this, key), size2 = data.size;
    data.set(key, value2);
    this.size += data.size == size2 ? 0 : 1;
    return this;
  }
  MapCache2.prototype.clear = mapCacheClear2;
  MapCache2.prototype["delete"] = mapCacheDelete2;
  MapCache2.prototype.get = mapCacheGet2;
  MapCache2.prototype.has = mapCacheHas2;
  MapCache2.prototype.set = mapCacheSet2;
  function SetCache2(values) {
    var index2 = -1, length2 = values == null ? 0 : values.length;
    this.__data__ = new MapCache2();
    while (++index2 < length2) {
      this.add(values[index2]);
    }
  }
  function setCacheAdd2(value2) {
    this.__data__.set(value2, HASH_UNDEFINED2);
    return this;
  }
  function setCacheHas2(value2) {
    return this.__data__.has(value2);
  }
  SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
  SetCache2.prototype.has = setCacheHas2;
  function Stack2(entries) {
    var data = this.__data__ = new ListCache2(entries);
    this.size = data.size;
  }
  function stackClear2() {
    this.__data__ = new ListCache2();
    this.size = 0;
  }
  function stackDelete2(key) {
    var data = this.__data__, result = data["delete"](key);
    this.size = data.size;
    return result;
  }
  function stackGet2(key) {
    return this.__data__.get(key);
  }
  function stackHas2(key) {
    return this.__data__.has(key);
  }
  function stackSet2(key, value2) {
    var data = this.__data__;
    if (data instanceof ListCache2) {
      var pairs = data.__data__;
      if (!Map2 || pairs.length < LARGE_ARRAY_SIZE2 - 1) {
        pairs.push([key, value2]);
        this.size = ++data.size;
        return this;
      }
      data = this.__data__ = new MapCache2(pairs);
    }
    data.set(key, value2);
    this.size = data.size;
    return this;
  }
  Stack2.prototype.clear = stackClear2;
  Stack2.prototype["delete"] = stackDelete2;
  Stack2.prototype.get = stackGet2;
  Stack2.prototype.has = stackHas2;
  Stack2.prototype.set = stackSet2;
  function arrayLikeKeys2(value2, inherited) {
    var isArr = isArray3(value2), isArg = !isArr && isArguments2(value2), isBuff = !isArr && !isArg && isBuffer2(value2), isType = !isArr && !isArg && !isBuff && isTypedArray2(value2), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes2(value2.length, String) : [], length2 = result.length;
    for (var key in value2) {
      if (hasOwnProperty2.call(value2, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
      (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
      isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
      isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
      isIndex2(key, length2)))) {
        result.push(key);
      }
    }
    return result;
  }
  function assocIndexOf2(array4, key) {
    var length2 = array4.length;
    while (length2--) {
      if (eq2(array4[length2][0], key)) {
        return length2;
      }
    }
    return -1;
  }
  function baseGetAllKeys2(object4, keysFunc, symbolsFunc) {
    var result = keysFunc(object4);
    return isArray3(object4) ? result : arrayPush2(result, symbolsFunc(object4));
  }
  function baseGetTag2(value2) {
    if (value2 == null) {
      return value2 === void 0 ? undefinedTag2 : nullTag2;
    }
    return symToStringTag2 && symToStringTag2 in Object(value2) ? getRawTag2(value2) : objectToString2(value2);
  }
  function baseIsArguments2(value2) {
    return isObjectLike2(value2) && baseGetTag2(value2) == argsTag2;
  }
  function baseIsEqual2(value2, other, bitmask, customizer, stack) {
    if (value2 === other) {
      return true;
    }
    if (value2 == null || other == null || !isObjectLike2(value2) && !isObjectLike2(other)) {
      return value2 !== value2 && other !== other;
    }
    return baseIsEqualDeep2(value2, other, bitmask, customizer, baseIsEqual2, stack);
  }
  function baseIsEqualDeep2(object4, other, bitmask, customizer, equalFunc, stack) {
    var objIsArr = isArray3(object4), othIsArr = isArray3(other), objTag = objIsArr ? arrayTag2 : getTag2(object4), othTag = othIsArr ? arrayTag2 : getTag2(other);
    objTag = objTag == argsTag2 ? objectTag2 : objTag;
    othTag = othTag == argsTag2 ? objectTag2 : othTag;
    var objIsObj = objTag == objectTag2, othIsObj = othTag == objectTag2, isSameTag = objTag == othTag;
    if (isSameTag && isBuffer2(object4)) {
      if (!isBuffer2(other)) {
        return false;
      }
      objIsArr = true;
      objIsObj = false;
    }
    if (isSameTag && !objIsObj) {
      stack || (stack = new Stack2());
      return objIsArr || isTypedArray2(object4) ? equalArrays2(object4, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object4, other, objTag, bitmask, customizer, equalFunc, stack);
    }
    if (!(bitmask & COMPARE_PARTIAL_FLAG2)) {
      var objIsWrapped = objIsObj && hasOwnProperty2.call(object4, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__");
      if (objIsWrapped || othIsWrapped) {
        var objUnwrapped = objIsWrapped ? object4.value() : object4, othUnwrapped = othIsWrapped ? other.value() : other;
        stack || (stack = new Stack2());
        return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
      }
    }
    if (!isSameTag) {
      return false;
    }
    stack || (stack = new Stack2());
    return equalObjects2(object4, other, bitmask, customizer, equalFunc, stack);
  }
  function baseIsNative2(value2) {
    if (!isObject2(value2) || isMasked2(value2)) {
      return false;
    }
    var pattern4 = isFunction2(value2) ? reIsNative2 : reIsHostCtor2;
    return pattern4.test(toSource2(value2));
  }
  function baseIsTypedArray2(value2) {
    return isObjectLike2(value2) && isLength2(value2.length) && !!typedArrayTags2[baseGetTag2(value2)];
  }
  function baseKeys2(object4) {
    if (!isPrototype2(object4)) {
      return nativeKeys2(object4);
    }
    var result = [];
    for (var key in Object(object4)) {
      if (hasOwnProperty2.call(object4, key) && key != "constructor") {
        result.push(key);
      }
    }
    return result;
  }
  function equalArrays2(array4, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, arrLength = array4.length, othLength = other.length;
    if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
      return false;
    }
    var stacked = stack.get(array4);
    if (stacked && stack.get(other)) {
      return stacked == other;
    }
    var index2 = -1, result = true, seen2 = bitmask & COMPARE_UNORDERED_FLAG2 ? new SetCache2() : void 0;
    stack.set(array4, other);
    stack.set(other, array4);
    while (++index2 < arrLength) {
      var arrValue = array4[index2], othValue = other[index2];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, arrValue, index2, other, array4, stack) : customizer(arrValue, othValue, index2, array4, other, stack);
      }
      if (compared !== void 0) {
        if (compared) {
          continue;
        }
        result = false;
        break;
      }
      if (seen2) {
        if (!arraySome2(other, function(othValue2, othIndex) {
          if (!cacheHas2(seen2, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
            return seen2.push(othIndex);
          }
        })) {
          result = false;
          break;
        }
      } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
        result = false;
        break;
      }
    }
    stack["delete"](array4);
    stack["delete"](other);
    return result;
  }
  function equalByTag2(object4, other, tag, bitmask, customizer, equalFunc, stack) {
    switch (tag) {
      case dataViewTag2:
        if (object4.byteLength != other.byteLength || object4.byteOffset != other.byteOffset) {
          return false;
        }
        object4 = object4.buffer;
        other = other.buffer;
      case arrayBufferTag2:
        if (object4.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object4), new Uint8Array2(other))) {
          return false;
        }
        return true;
      case boolTag2:
      case dateTag2:
      case numberTag2:
        return eq2(+object4, +other);
      case errorTag2:
        return object4.name == other.name && object4.message == other.message;
      case regexpTag2:
      case stringTag2:
        return object4 == other + "";
      case mapTag2:
        var convert2 = mapToArray2;
      case setTag2:
        var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
        convert2 || (convert2 = setToArray2);
        if (object4.size != other.size && !isPartial) {
          return false;
        }
        var stacked = stack.get(object4);
        if (stacked) {
          return stacked == other;
        }
        bitmask |= COMPARE_UNORDERED_FLAG2;
        stack.set(object4, other);
        var result = equalArrays2(convert2(object4), convert2(other), bitmask, customizer, equalFunc, stack);
        stack["delete"](object4);
        return result;
      case symbolTag2:
        if (symbolValueOf2) {
          return symbolValueOf2.call(object4) == symbolValueOf2.call(other);
        }
    }
    return false;
  }
  function equalObjects2(object4, other, bitmask, customizer, equalFunc, stack) {
    var isPartial = bitmask & COMPARE_PARTIAL_FLAG2, objProps = getAllKeys2(object4), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
    if (objLength != othLength && !isPartial) {
      return false;
    }
    var index2 = objLength;
    while (index2--) {
      var key = objProps[index2];
      if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) {
        return false;
      }
    }
    var stacked = stack.get(object4);
    if (stacked && stack.get(other)) {
      return stacked == other;
    }
    var result = true;
    stack.set(object4, other);
    stack.set(other, object4);
    var skipCtor = isPartial;
    while (++index2 < objLength) {
      key = objProps[index2];
      var objValue = object4[key], othValue = other[key];
      if (customizer) {
        var compared = isPartial ? customizer(othValue, objValue, key, other, object4, stack) : customizer(objValue, othValue, key, object4, other, stack);
      }
      if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
        result = false;
        break;
      }
      skipCtor || (skipCtor = key == "constructor");
    }
    if (result && !skipCtor) {
      var objCtor = object4.constructor, othCtor = other.constructor;
      if (objCtor != othCtor && ("constructor" in object4 && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
        result = false;
      }
    }
    stack["delete"](object4);
    stack["delete"](other);
    return result;
  }
  function getAllKeys2(object4) {
    return baseGetAllKeys2(object4, keys2, getSymbols2);
  }
  function getMapData2(map2, key) {
    var data = map2.__data__;
    return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  }
  function getNative2(object4, key) {
    var value2 = getValue2(object4, key);
    return baseIsNative2(value2) ? value2 : void 0;
  }
  function getRawTag2(value2) {
    var isOwn = hasOwnProperty2.call(value2, symToStringTag2), tag = value2[symToStringTag2];
    try {
      value2[symToStringTag2] = void 0;
      var unmasked = true;
    } catch (e2) {
    }
    var result = nativeObjectToString2.call(value2);
    if (unmasked) {
      if (isOwn) {
        value2[symToStringTag2] = tag;
      } else {
        delete value2[symToStringTag2];
      }
    }
    return result;
  }
  var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object4) {
    if (object4 == null) {
      return [];
    }
    object4 = Object(object4);
    return arrayFilter2(nativeGetSymbols2(object4), function(symbol) {
      return propertyIsEnumerable2.call(object4, symbol);
    });
  };
  var getTag2 = baseGetTag2;
  if (DataView2 && getTag2(new DataView2(new ArrayBuffer(1))) != dataViewTag2 || Map2 && getTag2(new Map2()) != mapTag2 || Promise2 && getTag2(Promise2.resolve()) != promiseTag2 || Set2 && getTag2(new Set2()) != setTag2 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag2) {
    getTag2 = function(value2) {
      var result = baseGetTag2(value2), Ctor = result == objectTag2 ? value2.constructor : void 0, ctorString = Ctor ? toSource2(Ctor) : "";
      if (ctorString) {
        switch (ctorString) {
          case dataViewCtorString2:
            return dataViewTag2;
          case mapCtorString2:
            return mapTag2;
          case promiseCtorString2:
            return promiseTag2;
          case setCtorString2:
            return setTag2;
          case weakMapCtorString2:
            return weakMapTag2;
        }
      }
      return result;
    };
  }
  function isIndex2(value2, length2) {
    length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
    return !!length2 && (typeof value2 == "number" || reIsUint2.test(value2)) && (value2 > -1 && value2 % 1 == 0 && value2 < length2);
  }
  function isKeyable2(value2) {
    var type4 = typeof value2;
    return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
  }
  function isMasked2(func) {
    return !!maskSrcKey2 && maskSrcKey2 in func;
  }
  function isPrototype2(value2) {
    var Ctor = value2 && value2.constructor, proto2 = typeof Ctor == "function" && Ctor.prototype || objectProto2;
    return value2 === proto2;
  }
  function objectToString2(value2) {
    return nativeObjectToString2.call(value2);
  }
  function toSource2(func) {
    if (func != null) {
      try {
        return funcToString2.call(func);
      } catch (e2) {
      }
      try {
        return func + "";
      } catch (e2) {
      }
    }
    return "";
  }
  function eq2(value2, other) {
    return value2 === other || value2 !== value2 && other !== other;
  }
  var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
    return arguments;
  }()) ? baseIsArguments2 : function(value2) {
    return isObjectLike2(value2) && hasOwnProperty2.call(value2, "callee") && !propertyIsEnumerable2.call(value2, "callee");
  };
  var isArray3 = Array.isArray;
  function isArrayLike2(value2) {
    return value2 != null && isLength2(value2.length) && !isFunction2(value2);
  }
  var isBuffer2 = nativeIsBuffer2 || stubFalse2;
  function isEqual2(value2, other) {
    return baseIsEqual2(value2, other);
  }
  function isFunction2(value2) {
    if (!isObject2(value2)) {
      return false;
    }
    var tag = baseGetTag2(value2);
    return tag == funcTag2 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
  }
  function isLength2(value2) {
    return typeof value2 == "number" && value2 > -1 && value2 % 1 == 0 && value2 <= MAX_SAFE_INTEGER2;
  }
  function isObject2(value2) {
    var type4 = typeof value2;
    return value2 != null && (type4 == "object" || type4 == "function");
  }
  function isObjectLike2(value2) {
    return value2 != null && typeof value2 == "object";
  }
  var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
  function keys2(object4) {
    return isArrayLike2(object4) ? arrayLikeKeys2(object4) : baseKeys2(object4);
  }
  function stubArray2() {
    return [];
  }
  function stubFalse2() {
    return false;
  }
  module2.exports = isEqual2;
})(lodash_isequal, lodash_isequal.exports);
var lodash_isequalExports = lodash_isequal.exports;
var editorOptions$1 = {};
Object.defineProperty(editorOptions$1, "__esModule", { value: true });
editorOptions$1.getAceInstance = editorOptions$1.debounce = editorOptions$1.editorEvents = editorOptions$1.editorOptions = void 0;
var editorOptions = [
  "minLines",
  "maxLines",
  "readOnly",
  "highlightActiveLine",
  "tabSize",
  "enableBasicAutocompletion",
  "enableLiveAutocompletion",
  "enableSnippets"
];
editorOptions$1.editorOptions = editorOptions;
var editorEvents = [
  "onChange",
  "onFocus",
  "onInput",
  "onBlur",
  "onCopy",
  "onPaste",
  "onSelectionChange",
  "onCursorChange",
  "onScroll",
  "handleOptions",
  "updateRef"
];
editorOptions$1.editorEvents = editorEvents;
var getAceInstance = function() {
  var ace2;
  if (typeof window === "undefined") {
    commonjsGlobal.window = {};
    ace2 = aceExports;
    delete commonjsGlobal.window;
  } else if (window.ace) {
    ace2 = window.ace;
    ace2.acequire = window.ace.require || window.ace.acequire;
  } else {
    ace2 = aceExports;
  }
  return ace2;
};
editorOptions$1.getAceInstance = getAceInstance;
var debounce = function(fn, delay2) {
  var timer = null;
  return function() {
    var context = this;
    var args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function() {
      fn.apply(context, args);
    }, delay2);
  };
};
editorOptions$1.debounce = debounce;
var __extends$3 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics2 = function(d2, b2) {
    extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics2(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics2(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign$2 = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign$2 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$2.apply(this, arguments);
};
Object.defineProperty(ace$4, "__esModule", { value: true });
var ace_builds_1$1 = aceExports;
var PropTypes$3 = propTypesExports;
var React$3 = reactExports;
var isEqual$1 = lodash_isequalExports;
var editorOptions_1$1 = editorOptions$1;
var ace$2 = (0, editorOptions_1$1.getAceInstance)();
var ReactAce = (
  /** @class */
  function(_super) {
    __extends$3(ReactAce2, _super);
    function ReactAce2(props) {
      var _this = _super.call(this, props) || this;
      editorOptions_1$1.editorEvents.forEach(function(method4) {
        _this[method4] = _this[method4].bind(_this);
      });
      _this.debounce = editorOptions_1$1.debounce;
      return _this;
    }
    ReactAce2.prototype.isInShadow = function(node2) {
      var parent = node2 && node2.parentNode;
      while (parent) {
        if (parent.toString() === "[object ShadowRoot]") {
          return true;
        }
        parent = parent.parentNode;
      }
      return false;
    };
    ReactAce2.prototype.componentDidMount = function() {
      var _this = this;
      var _a2 = this.props, className = _a2.className, onBeforeLoad = _a2.onBeforeLoad, onValidate = _a2.onValidate, mode = _a2.mode, focus = _a2.focus, theme2 = _a2.theme, fontSize = _a2.fontSize, lineHeight2 = _a2.lineHeight, value2 = _a2.value, defaultValue2 = _a2.defaultValue, showGutter = _a2.showGutter, wrapEnabled = _a2.wrapEnabled, showPrintMargin = _a2.showPrintMargin, _b2 = _a2.scrollMargin, scrollMargin = _b2 === void 0 ? [0, 0, 0, 0] : _b2, keyboardHandler = _a2.keyboardHandler, onLoad = _a2.onLoad, commands = _a2.commands, annotations = _a2.annotations, markers = _a2.markers, placeholder = _a2.placeholder;
      this.editor = ace$2.edit(this.refEditor);
      if (onBeforeLoad) {
        onBeforeLoad(ace$2);
      }
      var editorProps = Object.keys(this.props.editorProps);
      for (var i2 = 0; i2 < editorProps.length; i2++) {
        this.editor[editorProps[i2]] = this.props.editorProps[editorProps[i2]];
      }
      if (this.props.debounceChangePeriod) {
        this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
      }
      this.editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
      if (this.isInShadow(this.refEditor)) {
        this.editor.renderer.attachToShadowRoot();
      }
      this.editor.getSession().setMode(typeof mode === "string" ? "ace/mode/".concat(mode) : mode);
      if (theme2 && theme2 !== "")
        this.editor.setTheme("ace/theme/".concat(theme2));
      this.editor.setFontSize(typeof fontSize === "number" ? "".concat(fontSize, "px") : fontSize);
      if (lineHeight2) {
        this.editor.container.style.lineHeight = typeof lineHeight2 === "number" ? "".concat(lineHeight2, "px") : "".concat(lineHeight2);
        this.editor.renderer.updateFontSize();
      }
      this.editor.getSession().setValue(!defaultValue2 ? value2 || "" : defaultValue2);
      if (this.props.navigateToFileEnd) {
        this.editor.navigateFileEnd();
      }
      this.editor.renderer.setShowGutter(showGutter);
      this.editor.getSession().setUseWrapMode(wrapEnabled);
      this.editor.setShowPrintMargin(showPrintMargin);
      this.editor.on("focus", this.onFocus);
      this.editor.on("blur", this.onBlur);
      this.editor.on("copy", this.onCopy);
      this.editor.on("paste", this.onPaste);
      this.editor.on("change", this.onChange);
      this.editor.on("input", this.onInput);
      if (placeholder) {
        this.updatePlaceholder();
      }
      this.editor.getSession().selection.on("changeSelection", this.onSelectionChange);
      this.editor.getSession().selection.on("changeCursor", this.onCursorChange);
      if (onValidate) {
        this.editor.getSession().on("changeAnnotation", function() {
          var annotations2 = _this.editor.getSession().getAnnotations();
          _this.props.onValidate(annotations2);
        });
      }
      this.editor.session.on("changeScrollTop", this.onScroll);
      this.editor.getSession().setAnnotations(annotations || []);
      if (markers && markers.length > 0) {
        this.handleMarkers(markers);
      }
      var availableOptions = this.editor.$options;
      editorOptions_1$1.editorOptions.forEach(function(option) {
        if (availableOptions.hasOwnProperty(option)) {
          _this.editor.setOption(option, _this.props[option]);
        } else if (_this.props[option]) {
          console.warn("ReactAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
        }
      });
      this.handleOptions(this.props);
      if (Array.isArray(commands)) {
        commands.forEach(function(command) {
          if (typeof command.exec === "string") {
            _this.editor.commands.bindKey(command.bindKey, command.exec);
          } else {
            _this.editor.commands.addCommand(command);
          }
        });
      }
      if (keyboardHandler) {
        this.editor.setKeyboardHandler("ace/keyboard/" + keyboardHandler);
      }
      if (className) {
        this.refEditor.className += " " + className;
      }
      if (onLoad) {
        onLoad(this.editor);
      }
      this.editor.resize();
      if (focus) {
        this.editor.focus();
      }
    };
    ReactAce2.prototype.componentDidUpdate = function(prevProps) {
      var oldProps = prevProps;
      var nextProps = this.props;
      for (var i2 = 0; i2 < editorOptions_1$1.editorOptions.length; i2++) {
        var option = editorOptions_1$1.editorOptions[i2];
        if (nextProps[option] !== oldProps[option]) {
          this.editor.setOption(option, nextProps[option]);
        }
      }
      if (nextProps.className !== oldProps.className) {
        var appliedClasses = this.refEditor.className;
        var appliedClassesArray_1 = appliedClasses.trim().split(" ");
        var oldClassesArray = oldProps.className.trim().split(" ");
        oldClassesArray.forEach(function(oldClass) {
          var index2 = appliedClassesArray_1.indexOf(oldClass);
          appliedClassesArray_1.splice(index2, 1);
        });
        this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" ");
      }
      var valueChanged = this.editor && nextProps.value != null && this.editor.getValue() !== nextProps.value;
      if (valueChanged) {
        this.silent = true;
        var pos = this.editor.session.selection.toJSON();
        this.editor.setValue(nextProps.value, nextProps.cursorStart);
        this.editor.session.selection.fromJSON(pos);
        this.silent = false;
      }
      if (nextProps.placeholder !== oldProps.placeholder) {
        this.updatePlaceholder();
      }
      if (nextProps.mode !== oldProps.mode) {
        this.editor.getSession().setMode(typeof nextProps.mode === "string" ? "ace/mode/".concat(nextProps.mode) : nextProps.mode);
      }
      if (nextProps.theme !== oldProps.theme) {
        this.editor.setTheme("ace/theme/" + nextProps.theme);
      }
      if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
        if (nextProps.keyboardHandler) {
          this.editor.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler);
        } else {
          this.editor.setKeyboardHandler(null);
        }
      }
      if (nextProps.fontSize !== oldProps.fontSize) {
        this.editor.setFontSize(typeof nextProps.fontSize === "number" ? "".concat(nextProps.fontSize, "px") : nextProps.fontSize);
      }
      if (nextProps.lineHeight !== oldProps.lineHeight) {
        this.editor.container.style.lineHeight = typeof nextProps.lineHeight === "number" ? "".concat(nextProps.lineHeight, "px") : nextProps.lineHeight;
        this.editor.renderer.updateFontSize();
      }
      if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
        this.editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
      }
      if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
        this.editor.setShowPrintMargin(nextProps.showPrintMargin);
      }
      if (nextProps.showGutter !== oldProps.showGutter) {
        this.editor.renderer.setShowGutter(nextProps.showGutter);
      }
      if (!isEqual$1(nextProps.setOptions, oldProps.setOptions)) {
        this.handleOptions(nextProps);
      }
      if (valueChanged || !isEqual$1(nextProps.annotations, oldProps.annotations)) {
        this.editor.getSession().setAnnotations(nextProps.annotations || []);
      }
      if (!isEqual$1(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) {
        this.handleMarkers(nextProps.markers);
      }
      if (!isEqual$1(nextProps.scrollMargin, oldProps.scrollMargin)) {
        this.handleScrollMargins(nextProps.scrollMargin);
      }
      if (prevProps.height !== this.props.height || prevProps.width !== this.props.width) {
        this.editor.resize();
      }
      if (this.props.focus && !prevProps.focus) {
        this.editor.focus();
      }
    };
    ReactAce2.prototype.handleScrollMargins = function(margins) {
      if (margins === void 0) {
        margins = [0, 0, 0, 0];
      }
      this.editor.renderer.setScrollMargin(margins[0], margins[1], margins[2], margins[3]);
    };
    ReactAce2.prototype.componentWillUnmount = function() {
      if (this.editor) {
        this.editor.destroy();
        this.editor = null;
      }
    };
    ReactAce2.prototype.onChange = function(event) {
      if (this.props.onChange && !this.silent) {
        var value2 = this.editor.getValue();
        this.props.onChange(value2, event);
      }
    };
    ReactAce2.prototype.onSelectionChange = function(event) {
      if (this.props.onSelectionChange) {
        var value2 = this.editor.getSelection();
        this.props.onSelectionChange(value2, event);
      }
    };
    ReactAce2.prototype.onCursorChange = function(event) {
      if (this.props.onCursorChange) {
        var value2 = this.editor.getSelection();
        this.props.onCursorChange(value2, event);
      }
    };
    ReactAce2.prototype.onInput = function(event) {
      if (this.props.onInput) {
        this.props.onInput(event);
      }
      if (this.props.placeholder) {
        this.updatePlaceholder();
      }
    };
    ReactAce2.prototype.onFocus = function(event) {
      if (this.props.onFocus) {
        this.props.onFocus(event, this.editor);
      }
    };
    ReactAce2.prototype.onBlur = function(event) {
      if (this.props.onBlur) {
        this.props.onBlur(event, this.editor);
      }
    };
    ReactAce2.prototype.onCopy = function(_a2) {
      var text2 = _a2.text;
      if (this.props.onCopy) {
        this.props.onCopy(text2);
      }
    };
    ReactAce2.prototype.onPaste = function(_a2) {
      var text2 = _a2.text;
      if (this.props.onPaste) {
        this.props.onPaste(text2);
      }
    };
    ReactAce2.prototype.onScroll = function() {
      if (this.props.onScroll) {
        this.props.onScroll(this.editor);
      }
    };
    ReactAce2.prototype.handleOptions = function(props) {
      var setOptions2 = Object.keys(props.setOptions);
      for (var y2 = 0; y2 < setOptions2.length; y2++) {
        this.editor.setOption(setOptions2[y2], props.setOptions[setOptions2[y2]]);
      }
    };
    ReactAce2.prototype.handleMarkers = function(markers) {
      var _this = this;
      var currentMarkers = this.editor.getSession().getMarkers(true);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          this.editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      currentMarkers = this.editor.getSession().getMarkers(false);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2) && currentMarkers[i2].clazz !== "ace_active-line" && currentMarkers[i2].clazz !== "ace_selected-word") {
          this.editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      markers.forEach(function(_a2) {
        var startRow = _a2.startRow, startCol = _a2.startCol, endRow = _a2.endRow, endCol = _a2.endCol, className = _a2.className, type4 = _a2.type, _b2 = _a2.inFront, inFront = _b2 === void 0 ? false : _b2;
        var range3 = new ace_builds_1$1.Range(startRow, startCol, endRow, endCol);
        _this.editor.getSession().addMarker(range3, className, type4, inFront);
      });
    };
    ReactAce2.prototype.updatePlaceholder = function() {
      var editor = this.editor;
      var placeholder = this.props.placeholder;
      var showPlaceholder = !editor.session.getValue().length;
      var node2 = editor.renderer.placeholderNode;
      if (!showPlaceholder && node2) {
        editor.renderer.scroller.removeChild(editor.renderer.placeholderNode);
        editor.renderer.placeholderNode = null;
      } else if (showPlaceholder && !node2) {
        node2 = editor.renderer.placeholderNode = document.createElement("div");
        node2.textContent = placeholder || "";
        node2.className = "ace_comment ace_placeholder";
        node2.style.padding = "0 9px";
        node2.style.position = "absolute";
        node2.style.zIndex = "3";
        editor.renderer.scroller.appendChild(node2);
      } else if (showPlaceholder && node2) {
        node2.textContent = placeholder;
      }
    };
    ReactAce2.prototype.updateRef = function(item) {
      this.refEditor = item;
    };
    ReactAce2.prototype.render = function() {
      var _a2 = this.props, name2 = _a2.name, width = _a2.width, height = _a2.height, style2 = _a2.style;
      var divStyle = __assign$2({ width, height }, style2);
      return React$3.createElement("div", { ref: this.updateRef, id: name2, style: divStyle });
    };
    ReactAce2.propTypes = {
      mode: PropTypes$3.oneOfType([PropTypes$3.string, PropTypes$3.object]),
      focus: PropTypes$3.bool,
      theme: PropTypes$3.string,
      name: PropTypes$3.string,
      className: PropTypes$3.string,
      height: PropTypes$3.string,
      width: PropTypes$3.string,
      fontSize: PropTypes$3.oneOfType([PropTypes$3.number, PropTypes$3.string]),
      lineHeight: PropTypes$3.oneOfType([PropTypes$3.number, PropTypes$3.string]),
      showGutter: PropTypes$3.bool,
      onChange: PropTypes$3.func,
      onCopy: PropTypes$3.func,
      onPaste: PropTypes$3.func,
      onFocus: PropTypes$3.func,
      onInput: PropTypes$3.func,
      onBlur: PropTypes$3.func,
      onScroll: PropTypes$3.func,
      value: PropTypes$3.string,
      defaultValue: PropTypes$3.string,
      onLoad: PropTypes$3.func,
      onSelectionChange: PropTypes$3.func,
      onCursorChange: PropTypes$3.func,
      onBeforeLoad: PropTypes$3.func,
      onValidate: PropTypes$3.func,
      minLines: PropTypes$3.number,
      maxLines: PropTypes$3.number,
      readOnly: PropTypes$3.bool,
      highlightActiveLine: PropTypes$3.bool,
      tabSize: PropTypes$3.number,
      showPrintMargin: PropTypes$3.bool,
      cursorStart: PropTypes$3.number,
      debounceChangePeriod: PropTypes$3.number,
      editorProps: PropTypes$3.object,
      setOptions: PropTypes$3.object,
      style: PropTypes$3.object,
      scrollMargin: PropTypes$3.array,
      annotations: PropTypes$3.array,
      markers: PropTypes$3.array,
      keyboardHandler: PropTypes$3.string,
      wrapEnabled: PropTypes$3.bool,
      enableSnippets: PropTypes$3.bool,
      enableBasicAutocompletion: PropTypes$3.oneOfType([
        PropTypes$3.bool,
        PropTypes$3.array
      ]),
      enableLiveAutocompletion: PropTypes$3.oneOfType([
        PropTypes$3.bool,
        PropTypes$3.array
      ]),
      navigateToFileEnd: PropTypes$3.bool,
      commands: PropTypes$3.array,
      placeholder: PropTypes$3.string
    };
    ReactAce2.defaultProps = {
      name: "ace-editor",
      focus: false,
      mode: "",
      theme: "",
      height: "500px",
      width: "500px",
      fontSize: 12,
      enableSnippets: false,
      showGutter: true,
      onChange: null,
      onPaste: null,
      onLoad: null,
      onScroll: null,
      minLines: null,
      maxLines: null,
      readOnly: false,
      highlightActiveLine: true,
      showPrintMargin: true,
      tabSize: 4,
      cursorStart: 1,
      editorProps: {},
      style: {},
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      wrapEnabled: false,
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false,
      placeholder: null,
      navigateToFileEnd: true
    };
    return ReactAce2;
  }(React$3.Component)
);
ace$4.default = ReactAce;
var diff = {};
var split = {};
var extSplit = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/split", ["require", "exports", "module", "ace/lib/oop", "ace/lib/lang", "ace/lib/event_emitter", "ace/editor", "ace/virtual_renderer", "ace/edit_session"], function(require2, exports3, module3) {
    var oop = require2("./lib/oop");
    require2("./lib/lang");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var Editor2 = require2("./editor").Editor;
    var Renderer = require2("./virtual_renderer").VirtualRenderer;
    var EditSession = require2("./edit_session").EditSession;
    var Split;
    Split = function(container, theme2, splits) {
      this.BELOW = 1;
      this.BESIDE = 0;
      this.$container = container;
      this.$theme = theme2;
      this.$splits = 0;
      this.$editorCSS = "";
      this.$editors = [];
      this.$orientation = this.BESIDE;
      this.setSplits(splits || 1);
      this.$cEditor = this.$editors[0];
      this.on("focus", (function(editor) {
        this.$cEditor = editor;
      }).bind(this));
    };
    (function() {
      oop.implement(this, EventEmitter2);
      this.$createEditor = function() {
        var el2 = document.createElement("div");
        el2.className = this.$editorCSS;
        el2.style.cssText = "position: absolute; top:0px; bottom:0px";
        this.$container.appendChild(el2);
        var editor = new Editor2(new Renderer(el2, this.$theme));
        editor.on("focus", (function() {
          this._emit("focus", editor);
        }).bind(this));
        this.$editors.push(editor);
        editor.setFontSize(this.$fontSize);
        return editor;
      };
      this.setSplits = function(splits) {
        var editor;
        if (splits < 1) {
          throw "The number of splits have to be > 0!";
        }
        if (splits == this.$splits) {
          return;
        } else if (splits > this.$splits) {
          while (this.$splits < this.$editors.length && this.$splits < splits) {
            editor = this.$editors[this.$splits];
            this.$container.appendChild(editor.container);
            editor.setFontSize(this.$fontSize);
            this.$splits++;
          }
          while (this.$splits < splits) {
            this.$createEditor();
            this.$splits++;
          }
        } else {
          while (this.$splits > splits) {
            editor = this.$editors[this.$splits - 1];
            this.$container.removeChild(editor.container);
            this.$splits--;
          }
        }
        this.resize();
      };
      this.getSplits = function() {
        return this.$splits;
      };
      this.getEditor = function(idx) {
        return this.$editors[idx];
      };
      this.getCurrentEditor = function() {
        return this.$cEditor;
      };
      this.focus = function() {
        this.$cEditor.focus();
      };
      this.blur = function() {
        this.$cEditor.blur();
      };
      this.setTheme = function(theme2) {
        this.$editors.forEach(function(editor) {
          editor.setTheme(theme2);
        });
      };
      this.setKeyboardHandler = function(keybinding) {
        this.$editors.forEach(function(editor) {
          editor.setKeyboardHandler(keybinding);
        });
      };
      this.forEach = function(callback2, scope) {
        this.$editors.forEach(callback2, scope);
      };
      this.$fontSize = "";
      this.setFontSize = function(size2) {
        this.$fontSize = size2;
        this.forEach(function(editor) {
          editor.setFontSize(size2);
        });
      };
      this.$cloneSession = function(session) {
        var s2 = new EditSession(session.getDocument(), session.getMode());
        var undoManager = session.getUndoManager();
        s2.setUndoManager(undoManager);
        s2.setTabSize(session.getTabSize());
        s2.setUseSoftTabs(session.getUseSoftTabs());
        s2.setOverwrite(session.getOverwrite());
        s2.setBreakpoints(session.getBreakpoints());
        s2.setUseWrapMode(session.getUseWrapMode());
        s2.setUseWorker(session.getUseWorker());
        s2.setWrapLimitRange(session.$wrapLimitRange.min, session.$wrapLimitRange.max);
        s2.$foldData = session.$cloneFoldData();
        return s2;
      };
      this.setSession = function(session, idx) {
        var editor;
        if (idx == null) {
          editor = this.$cEditor;
        } else {
          editor = this.$editors[idx];
        }
        var isUsed = this.$editors.some(function(editor2) {
          return editor2.session === session;
        });
        if (isUsed) {
          session = this.$cloneSession(session);
        }
        editor.setSession(session);
        return session;
      };
      this.getOrientation = function() {
        return this.$orientation;
      };
      this.setOrientation = function(orientation) {
        if (this.$orientation == orientation) {
          return;
        }
        this.$orientation = orientation;
        this.resize();
      };
      this.resize = function() {
        var width = this.$container.clientWidth;
        var height = this.$container.clientHeight;
        var editor;
        if (this.$orientation == this.BESIDE) {
          var editorWidth = width / this.$splits;
          for (var i2 = 0; i2 < this.$splits; i2++) {
            editor = this.$editors[i2];
            editor.container.style.width = editorWidth + "px";
            editor.container.style.top = "0px";
            editor.container.style.left = i2 * editorWidth + "px";
            editor.container.style.height = height + "px";
            editor.resize();
          }
        } else {
          var editorHeight = height / this.$splits;
          for (var i2 = 0; i2 < this.$splits; i2++) {
            editor = this.$editors[i2];
            editor.container.style.width = width + "px";
            editor.container.style.top = i2 * editorHeight + "px";
            editor.container.style.left = "0px";
            editor.container.style.height = editorHeight + "px";
            editor.resize();
          }
        }
      };
    }).call(Split.prototype);
    exports3.Split = Split;
  });
  ace.define("ace/ext/split", ["require", "exports", "module", "ace/ext/split", "ace/split"], function(require2, exports3, module3) {
    module3.exports = require2("../split");
  });
  (function() {
    ace.require(["ace/ext/split"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(extSplit);
var extSplitExports = extSplit.exports;
var FUNC_ERROR_TEXT = "Expected a function";
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var funcTag = "[object Function]", genTag = "[object GeneratorFunction]", symbolTag = "[object Symbol]";
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reEscapeChar = /\\(\\)?/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root$2 = freeGlobal || freeSelf || Function("return this")();
function getValue(object4, key) {
  return object4 == null ? void 0 : object4[key];
}
function isHostObject(value2) {
  var result = false;
  if (value2 != null && typeof value2.toString != "function") {
    try {
      result = !!(value2 + "");
    } catch (e2) {
    }
  }
  return result;
}
var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
var coreJsData = root$2["__core-js_shared__"];
var maskSrcKey = function() {
  var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  return uid2 ? "Symbol(src)_1." + uid2 : "";
}();
var funcToString = funcProto.toString;
var hasOwnProperty$1 = objectProto.hasOwnProperty;
var objectToString = objectProto.toString;
var reIsNative = RegExp(
  "^" + funcToString.call(hasOwnProperty$1).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
var Symbol$1 = root$2.Symbol, splice$1 = arrayProto.splice;
var Map$1 = getNative(root$2, "Map"), nativeCreate = getNative(Object, "create");
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
function Hash(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function hashClear() {
  this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
function hashDelete(key) {
  return this.has(key) && delete this.__data__[key];
}
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate) {
    var result = data[key];
    return result === HASH_UNDEFINED ? void 0 : result;
  }
  return hasOwnProperty$1.call(data, key) ? data[key] : void 0;
}
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate ? data[key] !== void 0 : hasOwnProperty$1.call(data, key);
}
function hashSet(key, value2) {
  var data = this.__data__;
  data[key] = nativeCreate && value2 === void 0 ? HASH_UNDEFINED : value2;
  return this;
}
Hash.prototype.clear = hashClear;
Hash.prototype["delete"] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
function ListCache(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function listCacheClear() {
  this.__data__ = [];
}
function listCacheDelete(key) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  if (index2 < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index2 == lastIndex) {
    data.pop();
  } else {
    splice$1.call(data, index2, 1);
  }
  return true;
}
function listCacheGet(key) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  return index2 < 0 ? void 0 : data[index2][1];
}
function listCacheHas(key) {
  return assocIndexOf(this.__data__, key) > -1;
}
function listCacheSet(key, value2) {
  var data = this.__data__, index2 = assocIndexOf(data, key);
  if (index2 < 0) {
    data.push([key, value2]);
  } else {
    data[index2][1] = value2;
  }
  return this;
}
ListCache.prototype.clear = listCacheClear;
ListCache.prototype["delete"] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
function MapCache(entries) {
  var index2 = -1, length2 = entries ? entries.length : 0;
  this.clear();
  while (++index2 < length2) {
    var entry = entries[index2];
    this.set(entry[0], entry[1]);
  }
}
function mapCacheClear() {
  this.__data__ = {
    "hash": new Hash(),
    "map": new (Map$1 || ListCache)(),
    "string": new Hash()
  };
}
function mapCacheDelete(key) {
  return getMapData(this, key)["delete"](key);
}
function mapCacheGet(key) {
  return getMapData(this, key).get(key);
}
function mapCacheHas(key) {
  return getMapData(this, key).has(key);
}
function mapCacheSet(key, value2) {
  getMapData(this, key).set(key, value2);
  return this;
}
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype["delete"] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
function assocIndexOf(array4, key) {
  var length2 = array4.length;
  while (length2--) {
    if (eq(array4[length2][0], key)) {
      return length2;
    }
  }
  return -1;
}
function baseGet(object4, path) {
  path = isKey(path, object4) ? [path] : castPath(path);
  var index2 = 0, length2 = path.length;
  while (object4 != null && index2 < length2) {
    object4 = object4[toKey(path[index2++])];
  }
  return index2 && index2 == length2 ? object4 : void 0;
}
function baseIsNative(value2) {
  if (!isObject(value2) || isMasked(value2)) {
    return false;
  }
  var pattern4 = isFunction(value2) || isHostObject(value2) ? reIsNative : reIsHostCtor;
  return pattern4.test(toSource(value2));
}
function baseToString(value2) {
  if (typeof value2 == "string") {
    return value2;
  }
  if (isSymbol(value2)) {
    return symbolToString ? symbolToString.call(value2) : "";
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function castPath(value2) {
  return isArray$1(value2) ? value2 : stringToPath(value2);
}
function getMapData(map2, key) {
  var data = map2.__data__;
  return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
function getNative(object4, key) {
  var value2 = getValue(object4, key);
  return baseIsNative(value2) ? value2 : void 0;
}
function isKey(value2, object4) {
  if (isArray$1(value2)) {
    return false;
  }
  var type4 = typeof value2;
  if (type4 == "number" || type4 == "symbol" || type4 == "boolean" || value2 == null || isSymbol(value2)) {
    return true;
  }
  return reIsPlainProp.test(value2) || !reIsDeepProp.test(value2) || object4 != null && value2 in Object(object4);
}
function isKeyable(value2) {
  var type4 = typeof value2;
  return type4 == "string" || type4 == "number" || type4 == "symbol" || type4 == "boolean" ? value2 !== "__proto__" : value2 === null;
}
function isMasked(func) {
  return !!maskSrcKey && maskSrcKey in func;
}
var stringToPath = memoize(function(string3) {
  string3 = toString$2(string3);
  var result = [];
  if (reLeadingDot.test(string3)) {
    result.push("");
  }
  string3.replace(rePropName, function(match5, number4, quote, string4) {
    result.push(quote ? string4.replace(reEscapeChar, "$1") : number4 || match5);
  });
  return result;
});
function toKey(value2) {
  if (typeof value2 == "string" || isSymbol(value2)) {
    return value2;
  }
  var result = value2 + "";
  return result == "0" && 1 / value2 == -Infinity ? "-0" : result;
}
function toSource(func) {
  if (func != null) {
    try {
      return funcToString.call(func);
    } catch (e2) {
    }
    try {
      return func + "";
    } catch (e2) {
    }
  }
  return "";
}
function memoize(func, resolver2) {
  if (typeof func != "function" || resolver2 && typeof resolver2 != "function") {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  var memoized = function() {
    var args = arguments, key = resolver2 ? resolver2.apply(this, args) : args[0], cache2 = memoized.cache;
    if (cache2.has(key)) {
      return cache2.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache2.set(key, result);
    return result;
  };
  memoized.cache = new (memoize.Cache || MapCache)();
  return memoized;
}
memoize.Cache = MapCache;
function eq(value2, other) {
  return value2 === other || value2 !== value2 && other !== other;
}
var isArray$1 = Array.isArray;
function isFunction(value2) {
  var tag = isObject(value2) ? objectToString.call(value2) : "";
  return tag == funcTag || tag == genTag;
}
function isObject(value2) {
  var type4 = typeof value2;
  return !!value2 && (type4 == "object" || type4 == "function");
}
function isObjectLike(value2) {
  return !!value2 && typeof value2 == "object";
}
function isSymbol(value2) {
  return typeof value2 == "symbol" || isObjectLike(value2) && objectToString.call(value2) == symbolTag;
}
function toString$2(value2) {
  return value2 == null ? "" : baseToString(value2);
}
function get$1(object4, path, defaultValue2) {
  var result = object4 == null ? void 0 : baseGet(object4, path);
  return result === void 0 ? defaultValue2 : result;
}
var lodash_get = get$1;
var __extends$2 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics2 = function(d2, b2) {
    extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics2(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics2(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign$1 = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign$1 = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign$1.apply(this, arguments);
};
Object.defineProperty(split, "__esModule", { value: true });
var editorOptions_1 = editorOptions$1;
var ace$1 = (0, editorOptions_1.getAceInstance)();
var ace_builds_1 = aceExports;
var ext_split_1 = extSplitExports;
var PropTypes$2 = propTypesExports;
var React$2 = reactExports;
var isEqual = lodash_isequalExports;
var get4 = lodash_get;
var SplitComponent = (
  /** @class */
  function(_super) {
    __extends$2(SplitComponent2, _super);
    function SplitComponent2(props) {
      var _this = _super.call(this, props) || this;
      editorOptions_1.editorEvents.forEach(function(method4) {
        _this[method4] = _this[method4].bind(_this);
      });
      _this.debounce = editorOptions_1.debounce;
      return _this;
    }
    SplitComponent2.prototype.isInShadow = function(node2) {
      var parent = node2 && node2.parentNode;
      while (parent) {
        if (parent.toString() === "[object ShadowRoot]") {
          return true;
        }
        parent = parent.parentNode;
      }
      return false;
    };
    SplitComponent2.prototype.componentDidMount = function() {
      var _this = this;
      var _a2 = this.props, className = _a2.className, onBeforeLoad = _a2.onBeforeLoad, mode = _a2.mode, focus = _a2.focus, theme2 = _a2.theme, fontSize = _a2.fontSize, value2 = _a2.value, defaultValue2 = _a2.defaultValue, cursorStart = _a2.cursorStart, showGutter = _a2.showGutter, wrapEnabled = _a2.wrapEnabled, showPrintMargin = _a2.showPrintMargin, _b2 = _a2.scrollMargin, scrollMargin = _b2 === void 0 ? [0, 0, 0, 0] : _b2, keyboardHandler = _a2.keyboardHandler, onLoad = _a2.onLoad, commands = _a2.commands, annotations = _a2.annotations, markers = _a2.markers, splits = _a2.splits;
      this.editor = ace$1.edit(this.refEditor);
      if (this.isInShadow(this.refEditor)) {
        this.editor.renderer.attachToShadowRoot();
      }
      this.editor.setTheme("ace/theme/".concat(theme2));
      if (onBeforeLoad) {
        onBeforeLoad(ace$1);
      }
      var editorProps = Object.keys(this.props.editorProps);
      var split2 = new ext_split_1.Split(this.editor.container, "ace/theme/".concat(theme2), splits);
      this.editor.env.split = split2;
      this.splitEditor = split2.getEditor(0);
      this.split = split2;
      this.editor.setShowPrintMargin(false);
      this.editor.renderer.setShowGutter(false);
      var availableOptions = this.splitEditor.$options;
      if (this.props.debounceChangePeriod) {
        this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod);
      }
      split2.forEach(function(editor, index2) {
        for (var i2 = 0; i2 < editorProps.length; i2++) {
          editor[editorProps[i2]] = _this.props.editorProps[editorProps[i2]];
        }
        var defaultValueForEditor = get4(defaultValue2, index2);
        var valueForEditor = get4(value2, index2, "");
        editor.session.setUndoManager(new ace$1.UndoManager());
        editor.setTheme("ace/theme/".concat(theme2));
        editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]);
        editor.getSession().setMode("ace/mode/".concat(mode));
        editor.setFontSize(fontSize);
        editor.renderer.setShowGutter(showGutter);
        editor.getSession().setUseWrapMode(wrapEnabled);
        editor.setShowPrintMargin(showPrintMargin);
        editor.on("focus", _this.onFocus);
        editor.on("blur", _this.onBlur);
        editor.on("input", _this.onInput);
        editor.on("copy", _this.onCopy);
        editor.on("paste", _this.onPaste);
        editor.on("change", _this.onChange);
        editor.getSession().selection.on("changeSelection", _this.onSelectionChange);
        editor.getSession().selection.on("changeCursor", _this.onCursorChange);
        editor.session.on("changeScrollTop", _this.onScroll);
        editor.setValue(defaultValueForEditor === void 0 ? valueForEditor : defaultValueForEditor, cursorStart);
        var newAnnotations = get4(annotations, index2, []);
        var newMarkers = get4(markers, index2, []);
        editor.getSession().setAnnotations(newAnnotations);
        if (newMarkers && newMarkers.length > 0) {
          _this.handleMarkers(newMarkers, editor);
        }
        for (var i2 = 0; i2 < editorOptions_1.editorOptions.length; i2++) {
          var option = editorOptions_1.editorOptions[i2];
          if (availableOptions.hasOwnProperty(option)) {
            editor.setOption(option, _this.props[option]);
          } else if (_this.props[option]) {
            console.warn("ReaceAce: editor option ".concat(option, " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"));
          }
        }
        _this.handleOptions(_this.props, editor);
        if (Array.isArray(commands)) {
          commands.forEach(function(command) {
            if (typeof command.exec === "string") {
              editor.commands.bindKey(command.bindKey, command.exec);
            } else {
              editor.commands.addCommand(command);
            }
          });
        }
        if (keyboardHandler) {
          editor.setKeyboardHandler("ace/keyboard/" + keyboardHandler);
        }
      });
      if (className) {
        this.refEditor.className += " " + className;
      }
      if (focus) {
        this.splitEditor.focus();
      }
      var sp = this.editor.env.split;
      sp.setOrientation(this.props.orientation === "below" ? sp.BELOW : sp.BESIDE);
      sp.resize(true);
      if (onLoad) {
        onLoad(sp);
      }
    };
    SplitComponent2.prototype.componentDidUpdate = function(prevProps) {
      var _this = this;
      var oldProps = prevProps;
      var nextProps = this.props;
      var split2 = this.editor.env.split;
      if (nextProps.splits !== oldProps.splits) {
        split2.setSplits(nextProps.splits);
      }
      if (nextProps.orientation !== oldProps.orientation) {
        split2.setOrientation(nextProps.orientation === "below" ? split2.BELOW : split2.BESIDE);
      }
      split2.forEach(function(editor, index2) {
        if (nextProps.mode !== oldProps.mode) {
          editor.getSession().setMode("ace/mode/" + nextProps.mode);
        }
        if (nextProps.keyboardHandler !== oldProps.keyboardHandler) {
          if (nextProps.keyboardHandler) {
            editor.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler);
          } else {
            editor.setKeyboardHandler(null);
          }
        }
        if (nextProps.fontSize !== oldProps.fontSize) {
          editor.setFontSize(nextProps.fontSize);
        }
        if (nextProps.wrapEnabled !== oldProps.wrapEnabled) {
          editor.getSession().setUseWrapMode(nextProps.wrapEnabled);
        }
        if (nextProps.showPrintMargin !== oldProps.showPrintMargin) {
          editor.setShowPrintMargin(nextProps.showPrintMargin);
        }
        if (nextProps.showGutter !== oldProps.showGutter) {
          editor.renderer.setShowGutter(nextProps.showGutter);
        }
        for (var i2 = 0; i2 < editorOptions_1.editorOptions.length; i2++) {
          var option = editorOptions_1.editorOptions[i2];
          if (nextProps[option] !== oldProps[option]) {
            editor.setOption(option, nextProps[option]);
          }
        }
        if (!isEqual(nextProps.setOptions, oldProps.setOptions)) {
          _this.handleOptions(nextProps, editor);
        }
        var nextValue = get4(nextProps.value, index2, "");
        if (editor.getValue() !== nextValue) {
          _this.silent = true;
          var pos = editor.session.selection.toJSON();
          editor.setValue(nextValue, nextProps.cursorStart);
          editor.session.selection.fromJSON(pos);
          _this.silent = false;
        }
        var newAnnotations = get4(nextProps.annotations, index2, []);
        var oldAnnotations = get4(oldProps.annotations, index2, []);
        if (!isEqual(newAnnotations, oldAnnotations)) {
          editor.getSession().setAnnotations(newAnnotations);
        }
        var newMarkers = get4(nextProps.markers, index2, []);
        var oldMarkers = get4(oldProps.markers, index2, []);
        if (!isEqual(newMarkers, oldMarkers) && Array.isArray(newMarkers)) {
          _this.handleMarkers(newMarkers, editor);
        }
      });
      if (nextProps.className !== oldProps.className) {
        var appliedClasses = this.refEditor.className;
        var appliedClassesArray_1 = appliedClasses.trim().split(" ");
        var oldClassesArray = oldProps.className.trim().split(" ");
        oldClassesArray.forEach(function(oldClass) {
          var index2 = appliedClassesArray_1.indexOf(oldClass);
          appliedClassesArray_1.splice(index2, 1);
        });
        this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" ");
      }
      if (nextProps.theme !== oldProps.theme) {
        split2.setTheme("ace/theme/" + nextProps.theme);
      }
      if (nextProps.focus && !oldProps.focus) {
        this.splitEditor.focus();
      }
      if (nextProps.height !== this.props.height || nextProps.width !== this.props.width) {
        this.editor.resize();
      }
    };
    SplitComponent2.prototype.componentWillUnmount = function() {
      this.editor.destroy();
      this.editor = null;
    };
    SplitComponent2.prototype.onChange = function(event) {
      if (this.props.onChange && !this.silent) {
        var value_1 = [];
        this.editor.env.split.forEach(function(editor) {
          value_1.push(editor.getValue());
        });
        this.props.onChange(value_1, event);
      }
    };
    SplitComponent2.prototype.onSelectionChange = function(event) {
      if (this.props.onSelectionChange) {
        var value_2 = [];
        this.editor.env.split.forEach(function(editor) {
          value_2.push(editor.getSelection());
        });
        this.props.onSelectionChange(value_2, event);
      }
    };
    SplitComponent2.prototype.onCursorChange = function(event) {
      if (this.props.onCursorChange) {
        var value_3 = [];
        this.editor.env.split.forEach(function(editor) {
          value_3.push(editor.getSelection());
        });
        this.props.onCursorChange(value_3, event);
      }
    };
    SplitComponent2.prototype.onFocus = function(event) {
      if (this.props.onFocus) {
        this.props.onFocus(event);
      }
    };
    SplitComponent2.prototype.onInput = function(event) {
      if (this.props.onInput) {
        this.props.onInput(event);
      }
    };
    SplitComponent2.prototype.onBlur = function(event) {
      if (this.props.onBlur) {
        this.props.onBlur(event);
      }
    };
    SplitComponent2.prototype.onCopy = function(text2) {
      if (this.props.onCopy) {
        this.props.onCopy(text2);
      }
    };
    SplitComponent2.prototype.onPaste = function(text2) {
      if (this.props.onPaste) {
        this.props.onPaste(text2);
      }
    };
    SplitComponent2.prototype.onScroll = function() {
      if (this.props.onScroll) {
        this.props.onScroll(this.editor);
      }
    };
    SplitComponent2.prototype.handleOptions = function(props, editor) {
      var setOptions2 = Object.keys(props.setOptions);
      for (var y2 = 0; y2 < setOptions2.length; y2++) {
        editor.setOption(setOptions2[y2], props.setOptions[setOptions2[y2]]);
      }
    };
    SplitComponent2.prototype.handleMarkers = function(markers, editor) {
      var currentMarkers = editor.getSession().getMarkers(true);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      currentMarkers = editor.getSession().getMarkers(false);
      for (var i2 in currentMarkers) {
        if (currentMarkers.hasOwnProperty(i2)) {
          editor.getSession().removeMarker(currentMarkers[i2].id);
        }
      }
      markers.forEach(function(_a2) {
        var startRow = _a2.startRow, startCol = _a2.startCol, endRow = _a2.endRow, endCol = _a2.endCol, className = _a2.className, type4 = _a2.type, _b2 = _a2.inFront, inFront = _b2 === void 0 ? false : _b2;
        var range3 = new ace_builds_1.Range(startRow, startCol, endRow, endCol);
        editor.getSession().addMarker(range3, className, type4, inFront);
      });
    };
    SplitComponent2.prototype.updateRef = function(item) {
      this.refEditor = item;
    };
    SplitComponent2.prototype.render = function() {
      var _a2 = this.props, name2 = _a2.name, width = _a2.width, height = _a2.height, style2 = _a2.style;
      var divStyle = __assign$1({ width, height }, style2);
      return React$2.createElement("div", { ref: this.updateRef, id: name2, style: divStyle });
    };
    SplitComponent2.propTypes = {
      className: PropTypes$2.string,
      debounceChangePeriod: PropTypes$2.number,
      defaultValue: PropTypes$2.arrayOf(PropTypes$2.string),
      focus: PropTypes$2.bool,
      fontSize: PropTypes$2.oneOfType([PropTypes$2.number, PropTypes$2.string]),
      height: PropTypes$2.string,
      mode: PropTypes$2.string,
      name: PropTypes$2.string,
      onBlur: PropTypes$2.func,
      onChange: PropTypes$2.func,
      onCopy: PropTypes$2.func,
      onFocus: PropTypes$2.func,
      onInput: PropTypes$2.func,
      onLoad: PropTypes$2.func,
      onPaste: PropTypes$2.func,
      onScroll: PropTypes$2.func,
      orientation: PropTypes$2.string,
      showGutter: PropTypes$2.bool,
      splits: PropTypes$2.number,
      theme: PropTypes$2.string,
      value: PropTypes$2.arrayOf(PropTypes$2.string),
      width: PropTypes$2.string,
      onSelectionChange: PropTypes$2.func,
      onCursorChange: PropTypes$2.func,
      onBeforeLoad: PropTypes$2.func,
      minLines: PropTypes$2.number,
      maxLines: PropTypes$2.number,
      readOnly: PropTypes$2.bool,
      highlightActiveLine: PropTypes$2.bool,
      tabSize: PropTypes$2.number,
      showPrintMargin: PropTypes$2.bool,
      cursorStart: PropTypes$2.number,
      editorProps: PropTypes$2.object,
      setOptions: PropTypes$2.object,
      style: PropTypes$2.object,
      scrollMargin: PropTypes$2.array,
      annotations: PropTypes$2.array,
      markers: PropTypes$2.array,
      keyboardHandler: PropTypes$2.string,
      wrapEnabled: PropTypes$2.bool,
      enableBasicAutocompletion: PropTypes$2.oneOfType([
        PropTypes$2.bool,
        PropTypes$2.array
      ]),
      enableLiveAutocompletion: PropTypes$2.oneOfType([
        PropTypes$2.bool,
        PropTypes$2.array
      ]),
      commands: PropTypes$2.array
    };
    SplitComponent2.defaultProps = {
      name: "ace-editor",
      focus: false,
      orientation: "beside",
      splits: 2,
      mode: "",
      theme: "",
      height: "500px",
      width: "500px",
      value: [],
      fontSize: 12,
      showGutter: true,
      onChange: null,
      onPaste: null,
      onLoad: null,
      onScroll: null,
      minLines: null,
      maxLines: null,
      readOnly: false,
      highlightActiveLine: true,
      showPrintMargin: true,
      tabSize: 4,
      cursorStart: 1,
      editorProps: {},
      style: {},
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      wrapEnabled: false,
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false
    };
    return SplitComponent2;
  }(React$2.Component)
);
split.default = SplitComponent;
var diffMatchPatch = { exports: {} };
(function(module2) {
  var diff_match_patch = function() {
    this.Diff_Timeout = 1;
    this.Diff_EditCost = 4;
    this.Match_Threshold = 0.5;
    this.Match_Distance = 1e3;
    this.Patch_DeleteThreshold = 0.5;
    this.Patch_Margin = 4;
    this.Match_MaxBits = 32;
  };
  var DIFF_DELETE = -1;
  var DIFF_INSERT = 1;
  var DIFF_EQUAL = 0;
  diff_match_patch.Diff = function(op, text2) {
    return [op, text2];
  };
  diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
    if (typeof opt_deadline == "undefined") {
      if (this.Diff_Timeout <= 0) {
        opt_deadline = Number.MAX_VALUE;
      } else {
        opt_deadline = (/* @__PURE__ */ new Date()).getTime() + this.Diff_Timeout * 1e3;
      }
    }
    var deadline = opt_deadline;
    if (text1 == null || text2 == null) {
      throw new Error("Null input. (diff_main)");
    }
    if (text1 == text2) {
      if (text1) {
        return [new diff_match_patch.Diff(DIFF_EQUAL, text1)];
      }
      return [];
    }
    if (typeof opt_checklines == "undefined") {
      opt_checklines = true;
    }
    var checklines = opt_checklines;
    var commonlength = this.diff_commonPrefix(text1, text2);
    var commonprefix = text1.substring(0, commonlength);
    text1 = text1.substring(commonlength);
    text2 = text2.substring(commonlength);
    commonlength = this.diff_commonSuffix(text1, text2);
    var commonsuffix = text1.substring(text1.length - commonlength);
    text1 = text1.substring(0, text1.length - commonlength);
    text2 = text2.substring(0, text2.length - commonlength);
    var diffs = this.diff_compute_(text1, text2, checklines, deadline);
    if (commonprefix) {
      diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, commonprefix));
    }
    if (commonsuffix) {
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, commonsuffix));
    }
    this.diff_cleanupMerge(diffs);
    return diffs;
  };
  diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines, deadline) {
    var diffs;
    if (!text1) {
      return [new diff_match_patch.Diff(DIFF_INSERT, text2)];
    }
    if (!text2) {
      return [new diff_match_patch.Diff(DIFF_DELETE, text1)];
    }
    var longtext = text1.length > text2.length ? text1 : text2;
    var shorttext = text1.length > text2.length ? text2 : text1;
    var i2 = longtext.indexOf(shorttext);
    if (i2 != -1) {
      diffs = [
        new diff_match_patch.Diff(DIFF_INSERT, longtext.substring(0, i2)),
        new diff_match_patch.Diff(DIFF_EQUAL, shorttext),
        new diff_match_patch.Diff(
          DIFF_INSERT,
          longtext.substring(i2 + shorttext.length)
        )
      ];
      if (text1.length > text2.length) {
        diffs[0][0] = diffs[2][0] = DIFF_DELETE;
      }
      return diffs;
    }
    if (shorttext.length == 1) {
      return [
        new diff_match_patch.Diff(DIFF_DELETE, text1),
        new diff_match_patch.Diff(DIFF_INSERT, text2)
      ];
    }
    var hm = this.diff_halfMatch_(text1, text2);
    if (hm) {
      var text1_a = hm[0];
      var text1_b = hm[1];
      var text2_a = hm[2];
      var text2_b = hm[3];
      var mid_common = hm[4];
      var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
      var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
      return diffs_a.concat(
        [new diff_match_patch.Diff(DIFF_EQUAL, mid_common)],
        diffs_b
      );
    }
    if (checklines && text1.length > 100 && text2.length > 100) {
      return this.diff_lineMode_(text1, text2, deadline);
    }
    return this.diff_bisect_(text1, text2, deadline);
  };
  diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
    var a2 = this.diff_linesToChars_(text1, text2);
    text1 = a2.chars1;
    text2 = a2.chars2;
    var linearray = a2.lineArray;
    var diffs = this.diff_main(text1, text2, false, deadline);
    this.diff_charsToLines_(diffs, linearray);
    this.diff_cleanupSemantic(diffs);
    diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ""));
    var pointer = 0;
    var count_delete = 0;
    var count_insert = 0;
    var text_delete = "";
    var text_insert = "";
    while (pointer < diffs.length) {
      switch (diffs[pointer][0]) {
        case DIFF_INSERT:
          count_insert++;
          text_insert += diffs[pointer][1];
          break;
        case DIFF_DELETE:
          count_delete++;
          text_delete += diffs[pointer][1];
          break;
        case DIFF_EQUAL:
          if (count_delete >= 1 && count_insert >= 1) {
            diffs.splice(
              pointer - count_delete - count_insert,
              count_delete + count_insert
            );
            pointer = pointer - count_delete - count_insert;
            var subDiff = this.diff_main(text_delete, text_insert, false, deadline);
            for (var j2 = subDiff.length - 1; j2 >= 0; j2--) {
              diffs.splice(pointer, 0, subDiff[j2]);
            }
            pointer = pointer + subDiff.length;
          }
          count_insert = 0;
          count_delete = 0;
          text_delete = "";
          text_insert = "";
          break;
      }
      pointer++;
    }
    diffs.pop();
    return diffs;
  };
  diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
    var text1_length = text1.length;
    var text2_length = text2.length;
    var max_d = Math.ceil((text1_length + text2_length) / 2);
    var v_offset = max_d;
    var v_length = 2 * max_d;
    var v1 = new Array(v_length);
    var v2 = new Array(v_length);
    for (var x2 = 0; x2 < v_length; x2++) {
      v1[x2] = -1;
      v2[x2] = -1;
    }
    v1[v_offset + 1] = 0;
    v2[v_offset + 1] = 0;
    var delta = text1_length - text2_length;
    var front = delta % 2 != 0;
    var k1start = 0;
    var k1end = 0;
    var k2start = 0;
    var k2end = 0;
    for (var d2 = 0; d2 < max_d; d2++) {
      if ((/* @__PURE__ */ new Date()).getTime() > deadline) {
        break;
      }
      for (var k1 = -d2 + k1start; k1 <= d2 - k1end; k1 += 2) {
        var k1_offset = v_offset + k1;
        var x1;
        if (k1 == -d2 || k1 != d2 && v1[k1_offset - 1] < v1[k1_offset + 1]) {
          x1 = v1[k1_offset + 1];
        } else {
          x1 = v1[k1_offset - 1] + 1;
        }
        var y1 = x1 - k1;
        while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text2.charAt(y1)) {
          x1++;
          y1++;
        }
        v1[k1_offset] = x1;
        if (x1 > text1_length) {
          k1end += 2;
        } else if (y1 > text2_length) {
          k1start += 2;
        } else if (front) {
          var k2_offset = v_offset + delta - k1;
          if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
            var x22 = text1_length - v2[k2_offset];
            if (x1 >= x22) {
              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
            }
          }
        }
      }
      for (var k2 = -d2 + k2start; k2 <= d2 - k2end; k2 += 2) {
        var k2_offset = v_offset + k2;
        var x22;
        if (k2 == -d2 || k2 != d2 && v2[k2_offset - 1] < v2[k2_offset + 1]) {
          x22 = v2[k2_offset + 1];
        } else {
          x22 = v2[k2_offset - 1] + 1;
        }
        var y2 = x22 - k2;
        while (x22 < text1_length && y2 < text2_length && text1.charAt(text1_length - x22 - 1) == text2.charAt(text2_length - y2 - 1)) {
          x22++;
          y2++;
        }
        v2[k2_offset] = x22;
        if (x22 > text1_length) {
          k2end += 2;
        } else if (y2 > text2_length) {
          k2start += 2;
        } else if (!front) {
          var k1_offset = v_offset + delta - k2;
          if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
            var x1 = v1[k1_offset];
            var y1 = v_offset + x1 - k1_offset;
            x22 = text1_length - x22;
            if (x1 >= x22) {
              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
            }
          }
        }
      }
    }
    return [
      new diff_match_patch.Diff(DIFF_DELETE, text1),
      new diff_match_patch.Diff(DIFF_INSERT, text2)
    ];
  };
  diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x2, y2, deadline) {
    var text1a = text1.substring(0, x2);
    var text2a = text2.substring(0, y2);
    var text1b = text1.substring(x2);
    var text2b = text2.substring(y2);
    var diffs = this.diff_main(text1a, text2a, false, deadline);
    var diffsb = this.diff_main(text1b, text2b, false, deadline);
    return diffs.concat(diffsb);
  };
  diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
    var lineArray = [];
    var lineHash = {};
    lineArray[0] = "";
    function diff_linesToCharsMunge_(text3) {
      var chars3 = "";
      var lineStart = 0;
      var lineEnd = -1;
      var lineArrayLength = lineArray.length;
      while (lineEnd < text3.length - 1) {
        lineEnd = text3.indexOf("\n", lineStart);
        if (lineEnd == -1) {
          lineEnd = text3.length - 1;
        }
        var line2 = text3.substring(lineStart, lineEnd + 1);
        if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line2) : lineHash[line2] !== void 0) {
          chars3 += String.fromCharCode(lineHash[line2]);
        } else {
          if (lineArrayLength == maxLines) {
            line2 = text3.substring(lineStart);
            lineEnd = text3.length;
          }
          chars3 += String.fromCharCode(lineArrayLength);
          lineHash[line2] = lineArrayLength;
          lineArray[lineArrayLength++] = line2;
        }
        lineStart = lineEnd + 1;
      }
      return chars3;
    }
    var maxLines = 4e4;
    var chars1 = diff_linesToCharsMunge_(text1);
    maxLines = 65535;
    var chars2 = diff_linesToCharsMunge_(text2);
    return { chars1, chars2, lineArray };
  };
  diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
    for (var i2 = 0; i2 < diffs.length; i2++) {
      var chars2 = diffs[i2][1];
      var text2 = [];
      for (var j2 = 0; j2 < chars2.length; j2++) {
        text2[j2] = lineArray[chars2.charCodeAt(j2)];
      }
      diffs[i2][1] = text2.join("");
    }
  };
  diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
    if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
      return 0;
    }
    var pointermin = 0;
    var pointermax = Math.min(text1.length, text2.length);
    var pointermid = pointermax;
    var pointerstart = 0;
    while (pointermin < pointermid) {
      if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
        pointermin = pointermid;
        pointerstart = pointermin;
      } else {
        pointermax = pointermid;
      }
      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
    }
    return pointermid;
  };
  diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
    if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
      return 0;
    }
    var pointermin = 0;
    var pointermax = Math.min(text1.length, text2.length);
    var pointermid = pointermax;
    var pointerend = 0;
    while (pointermin < pointermid) {
      if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
        pointermin = pointermid;
        pointerend = pointermin;
      } else {
        pointermax = pointermid;
      }
      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
    }
    return pointermid;
  };
  diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
    var text1_length = text1.length;
    var text2_length = text2.length;
    if (text1_length == 0 || text2_length == 0) {
      return 0;
    }
    if (text1_length > text2_length) {
      text1 = text1.substring(text1_length - text2_length);
    } else if (text1_length < text2_length) {
      text2 = text2.substring(0, text1_length);
    }
    var text_length = Math.min(text1_length, text2_length);
    if (text1 == text2) {
      return text_length;
    }
    var best = 0;
    var length2 = 1;
    while (true) {
      var pattern4 = text1.substring(text_length - length2);
      var found = text2.indexOf(pattern4);
      if (found == -1) {
        return best;
      }
      length2 += found;
      if (found == 0 || text1.substring(text_length - length2) == text2.substring(0, length2)) {
        best = length2;
        length2++;
      }
    }
  };
  diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
    if (this.Diff_Timeout <= 0) {
      return null;
    }
    var longtext = text1.length > text2.length ? text1 : text2;
    var shorttext = text1.length > text2.length ? text2 : text1;
    if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
      return null;
    }
    var dmp = this;
    function diff_halfMatchI_(longtext2, shorttext2, i2) {
      var seed = longtext2.substring(i2, i2 + Math.floor(longtext2.length / 4));
      var j2 = -1;
      var best_common = "";
      var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
      while ((j2 = shorttext2.indexOf(seed, j2 + 1)) != -1) {
        var prefixLength = dmp.diff_commonPrefix(
          longtext2.substring(i2),
          shorttext2.substring(j2)
        );
        var suffixLength = dmp.diff_commonSuffix(
          longtext2.substring(0, i2),
          shorttext2.substring(0, j2)
        );
        if (best_common.length < suffixLength + prefixLength) {
          best_common = shorttext2.substring(j2 - suffixLength, j2) + shorttext2.substring(j2, j2 + prefixLength);
          best_longtext_a = longtext2.substring(0, i2 - suffixLength);
          best_longtext_b = longtext2.substring(i2 + prefixLength);
          best_shorttext_a = shorttext2.substring(0, j2 - suffixLength);
          best_shorttext_b = shorttext2.substring(j2 + prefixLength);
        }
      }
      if (best_common.length * 2 >= longtext2.length) {
        return [
          best_longtext_a,
          best_longtext_b,
          best_shorttext_a,
          best_shorttext_b,
          best_common
        ];
      } else {
        return null;
      }
    }
    var hm1 = diff_halfMatchI_(
      longtext,
      shorttext,
      Math.ceil(longtext.length / 4)
    );
    var hm2 = diff_halfMatchI_(
      longtext,
      shorttext,
      Math.ceil(longtext.length / 2)
    );
    var hm;
    if (!hm1 && !hm2) {
      return null;
    } else if (!hm2) {
      hm = hm1;
    } else if (!hm1) {
      hm = hm2;
    } else {
      hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
    }
    var text1_a, text1_b, text2_a, text2_b;
    if (text1.length > text2.length) {
      text1_a = hm[0];
      text1_b = hm[1];
      text2_a = hm[2];
      text2_b = hm[3];
    } else {
      text2_a = hm[0];
      text2_b = hm[1];
      text1_a = hm[2];
      text1_b = hm[3];
    }
    var mid_common = hm[4];
    return [text1_a, text1_b, text2_a, text2_b, mid_common];
  };
  diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
    var changes = false;
    var equalities = [];
    var equalitiesLength = 0;
    var lastEquality = null;
    var pointer = 0;
    var length_insertions1 = 0;
    var length_deletions1 = 0;
    var length_insertions2 = 0;
    var length_deletions2 = 0;
    while (pointer < diffs.length) {
      if (diffs[pointer][0] == DIFF_EQUAL) {
        equalities[equalitiesLength++] = pointer;
        length_insertions1 = length_insertions2;
        length_deletions1 = length_deletions2;
        length_insertions2 = 0;
        length_deletions2 = 0;
        lastEquality = diffs[pointer][1];
      } else {
        if (diffs[pointer][0] == DIFF_INSERT) {
          length_insertions2 += diffs[pointer][1].length;
        } else {
          length_deletions2 += diffs[pointer][1].length;
        }
        if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(
          length_insertions2,
          length_deletions2
        )) {
          diffs.splice(
            equalities[equalitiesLength - 1],
            0,
            new diff_match_patch.Diff(DIFF_DELETE, lastEquality)
          );
          diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
          equalitiesLength--;
          equalitiesLength--;
          pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
          length_insertions1 = 0;
          length_deletions1 = 0;
          length_insertions2 = 0;
          length_deletions2 = 0;
          lastEquality = null;
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
    this.diff_cleanupSemanticLossless(diffs);
    pointer = 1;
    while (pointer < diffs.length) {
      if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
        var deletion = diffs[pointer - 1][1];
        var insertion = diffs[pointer][1];
        var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
        var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
        if (overlap_length1 >= overlap_length2) {
          if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
            diffs.splice(pointer, 0, new diff_match_patch.Diff(
              DIFF_EQUAL,
              insertion.substring(0, overlap_length1)
            ));
            diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
            diffs[pointer + 1][1] = insertion.substring(overlap_length1);
            pointer++;
          }
        } else {
          if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
            diffs.splice(pointer, 0, new diff_match_patch.Diff(
              DIFF_EQUAL,
              deletion.substring(0, overlap_length2)
            ));
            diffs[pointer - 1][0] = DIFF_INSERT;
            diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
            diffs[pointer + 1][0] = DIFF_DELETE;
            diffs[pointer + 1][1] = deletion.substring(overlap_length2);
            pointer++;
          }
        }
        pointer++;
      }
      pointer++;
    }
  };
  diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
    function diff_cleanupSemanticScore_(one2, two) {
      if (!one2 || !two) {
        return 6;
      }
      var char1 = one2.charAt(one2.length - 1);
      var char2 = two.charAt(0);
      var nonAlphaNumeric1 = char1.match(diff_match_patch.nonAlphaNumericRegex_);
      var nonAlphaNumeric2 = char2.match(diff_match_patch.nonAlphaNumericRegex_);
      var whitespace1 = nonAlphaNumeric1 && char1.match(diff_match_patch.whitespaceRegex_);
      var whitespace22 = nonAlphaNumeric2 && char2.match(diff_match_patch.whitespaceRegex_);
      var lineBreak1 = whitespace1 && char1.match(diff_match_patch.linebreakRegex_);
      var lineBreak2 = whitespace22 && char2.match(diff_match_patch.linebreakRegex_);
      var blankLine1 = lineBreak1 && one2.match(diff_match_patch.blanklineEndRegex_);
      var blankLine2 = lineBreak2 && two.match(diff_match_patch.blanklineStartRegex_);
      if (blankLine1 || blankLine2) {
        return 5;
      } else if (lineBreak1 || lineBreak2) {
        return 4;
      } else if (nonAlphaNumeric1 && !whitespace1 && whitespace22) {
        return 3;
      } else if (whitespace1 || whitespace22) {
        return 2;
      } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
        return 1;
      }
      return 0;
    }
    var pointer = 1;
    while (pointer < diffs.length - 1) {
      if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
        var equality1 = diffs[pointer - 1][1];
        var edit = diffs[pointer][1];
        var equality2 = diffs[pointer + 1][1];
        var commonOffset = this.diff_commonSuffix(equality1, edit);
        if (commonOffset) {
          var commonString = edit.substring(edit.length - commonOffset);
          equality1 = equality1.substring(0, equality1.length - commonOffset);
          edit = commonString + edit.substring(0, edit.length - commonOffset);
          equality2 = commonString + equality2;
        }
        var bestEquality1 = equality1;
        var bestEdit = edit;
        var bestEquality2 = equality2;
        var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
        while (edit.charAt(0) === equality2.charAt(0)) {
          equality1 += edit.charAt(0);
          edit = edit.substring(1) + equality2.charAt(0);
          equality2 = equality2.substring(1);
          var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
          if (score >= bestScore) {
            bestScore = score;
            bestEquality1 = equality1;
            bestEdit = edit;
            bestEquality2 = equality2;
          }
        }
        if (diffs[pointer - 1][1] != bestEquality1) {
          if (bestEquality1) {
            diffs[pointer - 1][1] = bestEquality1;
          } else {
            diffs.splice(pointer - 1, 1);
            pointer--;
          }
          diffs[pointer][1] = bestEdit;
          if (bestEquality2) {
            diffs[pointer + 1][1] = bestEquality2;
          } else {
            diffs.splice(pointer + 1, 1);
            pointer--;
          }
        }
      }
      pointer++;
    }
  };
  diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
  diff_match_patch.whitespaceRegex_ = /\s/;
  diff_match_patch.linebreakRegex_ = /[\r\n]/;
  diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/;
  diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/;
  diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
    var changes = false;
    var equalities = [];
    var equalitiesLength = 0;
    var lastEquality = null;
    var pointer = 0;
    var pre_ins = false;
    var pre_del = false;
    var post_ins = false;
    var post_del = false;
    while (pointer < diffs.length) {
      if (diffs[pointer][0] == DIFF_EQUAL) {
        if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) {
          equalities[equalitiesLength++] = pointer;
          pre_ins = post_ins;
          pre_del = post_del;
          lastEquality = diffs[pointer][1];
        } else {
          equalitiesLength = 0;
          lastEquality = null;
        }
        post_ins = post_del = false;
      } else {
        if (diffs[pointer][0] == DIFF_DELETE) {
          post_del = true;
        } else {
          post_ins = true;
        }
        if (lastEquality && (pre_ins && pre_del && post_ins && post_del || lastEquality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) {
          diffs.splice(
            equalities[equalitiesLength - 1],
            0,
            new diff_match_patch.Diff(DIFF_DELETE, lastEquality)
          );
          diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
          equalitiesLength--;
          lastEquality = null;
          if (pre_ins && pre_del) {
            post_ins = post_del = true;
            equalitiesLength = 0;
          } else {
            equalitiesLength--;
            pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
            post_ins = post_del = false;
          }
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
  };
  diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
    diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ""));
    var pointer = 0;
    var count_delete = 0;
    var count_insert = 0;
    var text_delete = "";
    var text_insert = "";
    var commonlength;
    while (pointer < diffs.length) {
      switch (diffs[pointer][0]) {
        case DIFF_INSERT:
          count_insert++;
          text_insert += diffs[pointer][1];
          pointer++;
          break;
        case DIFF_DELETE:
          count_delete++;
          text_delete += diffs[pointer][1];
          pointer++;
          break;
        case DIFF_EQUAL:
          if (count_delete + count_insert > 1) {
            if (count_delete !== 0 && count_insert !== 0) {
              commonlength = this.diff_commonPrefix(text_insert, text_delete);
              if (commonlength !== 0) {
                if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) {
                  diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
                } else {
                  diffs.splice(0, 0, new diff_match_patch.Diff(
                    DIFF_EQUAL,
                    text_insert.substring(0, commonlength)
                  ));
                  pointer++;
                }
                text_insert = text_insert.substring(commonlength);
                text_delete = text_delete.substring(commonlength);
              }
              commonlength = this.diff_commonSuffix(text_insert, text_delete);
              if (commonlength !== 0) {
                diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
                text_insert = text_insert.substring(0, text_insert.length - commonlength);
                text_delete = text_delete.substring(0, text_delete.length - commonlength);
              }
            }
            pointer -= count_delete + count_insert;
            diffs.splice(pointer, count_delete + count_insert);
            if (text_delete.length) {
              diffs.splice(
                pointer,
                0,
                new diff_match_patch.Diff(DIFF_DELETE, text_delete)
              );
              pointer++;
            }
            if (text_insert.length) {
              diffs.splice(
                pointer,
                0,
                new diff_match_patch.Diff(DIFF_INSERT, text_insert)
              );
              pointer++;
            }
            pointer++;
          } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
            diffs[pointer - 1][1] += diffs[pointer][1];
            diffs.splice(pointer, 1);
          } else {
            pointer++;
          }
          count_insert = 0;
          count_delete = 0;
          text_delete = "";
          text_insert = "";
          break;
      }
    }
    if (diffs[diffs.length - 1][1] === "") {
      diffs.pop();
    }
    var changes = false;
    pointer = 1;
    while (pointer < diffs.length - 1) {
      if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
        if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
          diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
          diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
          diffs.splice(pointer - 1, 1);
          changes = true;
        } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
          diffs[pointer - 1][1] += diffs[pointer + 1][1];
          diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
          diffs.splice(pointer + 1, 1);
          changes = true;
        }
      }
      pointer++;
    }
    if (changes) {
      this.diff_cleanupMerge(diffs);
    }
  };
  diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
    var chars1 = 0;
    var chars2 = 0;
    var last_chars1 = 0;
    var last_chars2 = 0;
    var x2;
    for (x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_INSERT) {
        chars1 += diffs[x2][1].length;
      }
      if (diffs[x2][0] !== DIFF_DELETE) {
        chars2 += diffs[x2][1].length;
      }
      if (chars1 > loc) {
        break;
      }
      last_chars1 = chars1;
      last_chars2 = chars2;
    }
    if (diffs.length != x2 && diffs[x2][0] === DIFF_DELETE) {
      return last_chars2;
    }
    return last_chars2 + (loc - last_chars1);
  };
  diff_match_patch.prototype.diff_prettyHtml = function(diffs) {
    var html2 = [];
    var pattern_amp = /&/g;
    var pattern_lt = /</g;
    var pattern_gt = />/g;
    var pattern_para = /\n/g;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var op = diffs[x2][0];
      var data = diffs[x2][1];
      var text2 = data.replace(pattern_amp, "&amp;").replace(pattern_lt, "&lt;").replace(pattern_gt, "&gt;").replace(pattern_para, "&para;<br>");
      switch (op) {
        case DIFF_INSERT:
          html2[x2] = '<ins style="background:#e6ffe6;">' + text2 + "</ins>";
          break;
        case DIFF_DELETE:
          html2[x2] = '<del style="background:#ffe6e6;">' + text2 + "</del>";
          break;
        case DIFF_EQUAL:
          html2[x2] = "<span>" + text2 + "</span>";
          break;
      }
    }
    return html2.join("");
  };
  diff_match_patch.prototype.diff_text1 = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_INSERT) {
        text2[x2] = diffs[x2][1];
      }
    }
    return text2.join("");
  };
  diff_match_patch.prototype.diff_text2 = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      if (diffs[x2][0] !== DIFF_DELETE) {
        text2[x2] = diffs[x2][1];
      }
    }
    return text2.join("");
  };
  diff_match_patch.prototype.diff_levenshtein = function(diffs) {
    var levenshtein = 0;
    var insertions = 0;
    var deletions = 0;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var op = diffs[x2][0];
      var data = diffs[x2][1];
      switch (op) {
        case DIFF_INSERT:
          insertions += data.length;
          break;
        case DIFF_DELETE:
          deletions += data.length;
          break;
        case DIFF_EQUAL:
          levenshtein += Math.max(insertions, deletions);
          insertions = 0;
          deletions = 0;
          break;
      }
    }
    levenshtein += Math.max(insertions, deletions);
    return levenshtein;
  };
  diff_match_patch.prototype.diff_toDelta = function(diffs) {
    var text2 = [];
    for (var x2 = 0; x2 < diffs.length; x2++) {
      switch (diffs[x2][0]) {
        case DIFF_INSERT:
          text2[x2] = "+" + encodeURI(diffs[x2][1]);
          break;
        case DIFF_DELETE:
          text2[x2] = "-" + diffs[x2][1].length;
          break;
        case DIFF_EQUAL:
          text2[x2] = "=" + diffs[x2][1].length;
          break;
      }
    }
    return text2.join("	").replace(/%20/g, " ");
  };
  diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
    var diffs = [];
    var diffsLength = 0;
    var pointer = 0;
    var tokens2 = delta.split(/\t/g);
    for (var x2 = 0; x2 < tokens2.length; x2++) {
      var param = tokens2[x2].substring(1);
      switch (tokens2[x2].charAt(0)) {
        case "+":
          try {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_INSERT, decodeURI(param));
          } catch (ex) {
            throw new Error("Illegal escape in diff_fromDelta: " + param);
          }
          break;
        case "-":
        case "=":
          var n2 = parseInt(param, 10);
          if (isNaN(n2) || n2 < 0) {
            throw new Error("Invalid number in diff_fromDelta: " + param);
          }
          var text2 = text1.substring(pointer, pointer += n2);
          if (tokens2[x2].charAt(0) == "=") {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text2);
          } else {
            diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text2);
          }
          break;
        default:
          if (tokens2[x2]) {
            throw new Error("Invalid diff operation in diff_fromDelta: " + tokens2[x2]);
          }
      }
    }
    if (pointer != text1.length) {
      throw new Error("Delta length (" + pointer + ") does not equal source text length (" + text1.length + ").");
    }
    return diffs;
  };
  diff_match_patch.prototype.match_main = function(text2, pattern4, loc) {
    if (text2 == null || pattern4 == null || loc == null) {
      throw new Error("Null input. (match_main)");
    }
    loc = Math.max(0, Math.min(loc, text2.length));
    if (text2 == pattern4) {
      return 0;
    } else if (!text2.length) {
      return -1;
    } else if (text2.substring(loc, loc + pattern4.length) == pattern4) {
      return loc;
    } else {
      return this.match_bitap_(text2, pattern4, loc);
    }
  };
  diff_match_patch.prototype.match_bitap_ = function(text2, pattern4, loc) {
    if (pattern4.length > this.Match_MaxBits) {
      throw new Error("Pattern too long for this browser.");
    }
    var s2 = this.match_alphabet_(pattern4);
    var dmp = this;
    function match_bitapScore_(e2, x2) {
      var accuracy = e2 / pattern4.length;
      var proximity = Math.abs(loc - x2);
      if (!dmp.Match_Distance) {
        return proximity ? 1 : accuracy;
      }
      return accuracy + proximity / dmp.Match_Distance;
    }
    var score_threshold = this.Match_Threshold;
    var best_loc = text2.indexOf(pattern4, loc);
    if (best_loc != -1) {
      score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
      best_loc = text2.lastIndexOf(pattern4, loc + pattern4.length);
      if (best_loc != -1) {
        score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
      }
    }
    var matchmask = 1 << pattern4.length - 1;
    best_loc = -1;
    var bin_min, bin_mid;
    var bin_max = pattern4.length + text2.length;
    var last_rd;
    for (var d2 = 0; d2 < pattern4.length; d2++) {
      bin_min = 0;
      bin_mid = bin_max;
      while (bin_min < bin_mid) {
        if (match_bitapScore_(d2, loc + bin_mid) <= score_threshold) {
          bin_min = bin_mid;
        } else {
          bin_max = bin_mid;
        }
        bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
      }
      bin_max = bin_mid;
      var start = Math.max(1, loc - bin_mid + 1);
      var finish = Math.min(loc + bin_mid, text2.length) + pattern4.length;
      var rd2 = Array(finish + 2);
      rd2[finish + 1] = (1 << d2) - 1;
      for (var j2 = finish; j2 >= start; j2--) {
        var charMatch = s2[text2.charAt(j2 - 1)];
        if (d2 === 0) {
          rd2[j2] = (rd2[j2 + 1] << 1 | 1) & charMatch;
        } else {
          rd2[j2] = (rd2[j2 + 1] << 1 | 1) & charMatch | ((last_rd[j2 + 1] | last_rd[j2]) << 1 | 1) | last_rd[j2 + 1];
        }
        if (rd2[j2] & matchmask) {
          var score = match_bitapScore_(d2, j2 - 1);
          if (score <= score_threshold) {
            score_threshold = score;
            best_loc = j2 - 1;
            if (best_loc > loc) {
              start = Math.max(1, 2 * loc - best_loc);
            } else {
              break;
            }
          }
        }
      }
      if (match_bitapScore_(d2 + 1, loc) > score_threshold) {
        break;
      }
      last_rd = rd2;
    }
    return best_loc;
  };
  diff_match_patch.prototype.match_alphabet_ = function(pattern4) {
    var s2 = {};
    for (var i2 = 0; i2 < pattern4.length; i2++) {
      s2[pattern4.charAt(i2)] = 0;
    }
    for (var i2 = 0; i2 < pattern4.length; i2++) {
      s2[pattern4.charAt(i2)] |= 1 << pattern4.length - i2 - 1;
    }
    return s2;
  };
  diff_match_patch.prototype.patch_addContext_ = function(patch2, text2) {
    if (text2.length == 0) {
      return;
    }
    if (patch2.start2 === null) {
      throw Error("patch not initialized");
    }
    var pattern4 = text2.substring(patch2.start2, patch2.start2 + patch2.length1);
    var padding = 0;
    while (text2.indexOf(pattern4) != text2.lastIndexOf(pattern4) && pattern4.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
      padding += this.Patch_Margin;
      pattern4 = text2.substring(
        patch2.start2 - padding,
        patch2.start2 + patch2.length1 + padding
      );
    }
    padding += this.Patch_Margin;
    var prefix = text2.substring(patch2.start2 - padding, patch2.start2);
    if (prefix) {
      patch2.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
    }
    var suffix = text2.substring(
      patch2.start2 + patch2.length1,
      patch2.start2 + patch2.length1 + padding
    );
    if (suffix) {
      patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, suffix));
    }
    patch2.start1 -= prefix.length;
    patch2.start2 -= prefix.length;
    patch2.length1 += prefix.length + suffix.length;
    patch2.length2 += prefix.length + suffix.length;
  };
  diff_match_patch.prototype.patch_make = function(a2, opt_b, opt_c) {
    var text1, diffs;
    if (typeof a2 == "string" && typeof opt_b == "string" && typeof opt_c == "undefined") {
      text1 = /** @type {string} */
      a2;
      diffs = this.diff_main(
        text1,
        /** @type {string} */
        opt_b,
        true
      );
      if (diffs.length > 2) {
        this.diff_cleanupSemantic(diffs);
        this.diff_cleanupEfficiency(diffs);
      }
    } else if (a2 && typeof a2 == "object" && typeof opt_b == "undefined" && typeof opt_c == "undefined") {
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      a2;
      text1 = this.diff_text1(diffs);
    } else if (typeof a2 == "string" && opt_b && typeof opt_b == "object" && typeof opt_c == "undefined") {
      text1 = /** @type {string} */
      a2;
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      opt_b;
    } else if (typeof a2 == "string" && typeof opt_b == "string" && opt_c && typeof opt_c == "object") {
      text1 = /** @type {string} */
      a2;
      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */
      opt_c;
    } else {
      throw new Error("Unknown call format to patch_make.");
    }
    if (diffs.length === 0) {
      return [];
    }
    var patches = [];
    var patch2 = new diff_match_patch.patch_obj();
    var patchDiffLength = 0;
    var char_count1 = 0;
    var char_count2 = 0;
    var prepatch_text = text1;
    var postpatch_text = text1;
    for (var x2 = 0; x2 < diffs.length; x2++) {
      var diff_type = diffs[x2][0];
      var diff_text = diffs[x2][1];
      if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
        patch2.start1 = char_count1;
        patch2.start2 = char_count2;
      }
      switch (diff_type) {
        case DIFF_INSERT:
          patch2.diffs[patchDiffLength++] = diffs[x2];
          patch2.length2 += diff_text.length;
          postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2);
          break;
        case DIFF_DELETE:
          patch2.length1 += diff_text.length;
          patch2.diffs[patchDiffLength++] = diffs[x2];
          postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length);
          break;
        case DIFF_EQUAL:
          if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x2 + 1) {
            patch2.diffs[patchDiffLength++] = diffs[x2];
            patch2.length1 += diff_text.length;
            patch2.length2 += diff_text.length;
          } else if (diff_text.length >= 2 * this.Patch_Margin) {
            if (patchDiffLength) {
              this.patch_addContext_(patch2, prepatch_text);
              patches.push(patch2);
              patch2 = new diff_match_patch.patch_obj();
              patchDiffLength = 0;
              prepatch_text = postpatch_text;
              char_count1 = char_count2;
            }
          }
          break;
      }
      if (diff_type !== DIFF_INSERT) {
        char_count1 += diff_text.length;
      }
      if (diff_type !== DIFF_DELETE) {
        char_count2 += diff_text.length;
      }
    }
    if (patchDiffLength) {
      this.patch_addContext_(patch2, prepatch_text);
      patches.push(patch2);
    }
    return patches;
  };
  diff_match_patch.prototype.patch_deepCopy = function(patches) {
    var patchesCopy = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      var patch2 = patches[x2];
      var patchCopy = new diff_match_patch.patch_obj();
      patchCopy.diffs = [];
      for (var y2 = 0; y2 < patch2.diffs.length; y2++) {
        patchCopy.diffs[y2] = new diff_match_patch.Diff(patch2.diffs[y2][0], patch2.diffs[y2][1]);
      }
      patchCopy.start1 = patch2.start1;
      patchCopy.start2 = patch2.start2;
      patchCopy.length1 = patch2.length1;
      patchCopy.length2 = patch2.length2;
      patchesCopy[x2] = patchCopy;
    }
    return patchesCopy;
  };
  diff_match_patch.prototype.patch_apply = function(patches, text2) {
    if (patches.length == 0) {
      return [text2, []];
    }
    patches = this.patch_deepCopy(patches);
    var nullPadding = this.patch_addPadding(patches);
    text2 = nullPadding + text2 + nullPadding;
    this.patch_splitMax(patches);
    var delta = 0;
    var results = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      var expected_loc = patches[x2].start2 + delta;
      var text1 = this.diff_text1(patches[x2].diffs);
      var start_loc;
      var end_loc = -1;
      if (text1.length > this.Match_MaxBits) {
        start_loc = this.match_main(
          text2,
          text1.substring(0, this.Match_MaxBits),
          expected_loc
        );
        if (start_loc != -1) {
          end_loc = this.match_main(
            text2,
            text1.substring(text1.length - this.Match_MaxBits),
            expected_loc + text1.length - this.Match_MaxBits
          );
          if (end_loc == -1 || start_loc >= end_loc) {
            start_loc = -1;
          }
        }
      } else {
        start_loc = this.match_main(text2, text1, expected_loc);
      }
      if (start_loc == -1) {
        results[x2] = false;
        delta -= patches[x2].length2 - patches[x2].length1;
      } else {
        results[x2] = true;
        delta = start_loc - expected_loc;
        var text22;
        if (end_loc == -1) {
          text22 = text2.substring(start_loc, start_loc + text1.length);
        } else {
          text22 = text2.substring(start_loc, end_loc + this.Match_MaxBits);
        }
        if (text1 == text22) {
          text2 = text2.substring(0, start_loc) + this.diff_text2(patches[x2].diffs) + text2.substring(start_loc + text1.length);
        } else {
          var diffs = this.diff_main(text1, text22, false);
          if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
            results[x2] = false;
          } else {
            this.diff_cleanupSemanticLossless(diffs);
            var index1 = 0;
            var index2;
            for (var y2 = 0; y2 < patches[x2].diffs.length; y2++) {
              var mod2 = patches[x2].diffs[y2];
              if (mod2[0] !== DIFF_EQUAL) {
                index2 = this.diff_xIndex(diffs, index1);
              }
              if (mod2[0] === DIFF_INSERT) {
                text2 = text2.substring(0, start_loc + index2) + mod2[1] + text2.substring(start_loc + index2);
              } else if (mod2[0] === DIFF_DELETE) {
                text2 = text2.substring(0, start_loc + index2) + text2.substring(start_loc + this.diff_xIndex(
                  diffs,
                  index1 + mod2[1].length
                ));
              }
              if (mod2[0] !== DIFF_DELETE) {
                index1 += mod2[1].length;
              }
            }
          }
        }
      }
    }
    text2 = text2.substring(nullPadding.length, text2.length - nullPadding.length);
    return [text2, results];
  };
  diff_match_patch.prototype.patch_addPadding = function(patches) {
    var paddingLength = this.Patch_Margin;
    var nullPadding = "";
    for (var x2 = 1; x2 <= paddingLength; x2++) {
      nullPadding += String.fromCharCode(x2);
    }
    for (var x2 = 0; x2 < patches.length; x2++) {
      patches[x2].start1 += paddingLength;
      patches[x2].start2 += paddingLength;
    }
    var patch2 = patches[0];
    var diffs = patch2.diffs;
    if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
      diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
      patch2.start1 -= paddingLength;
      patch2.start2 -= paddingLength;
      patch2.length1 += paddingLength;
      patch2.length2 += paddingLength;
    } else if (paddingLength > diffs[0][1].length) {
      var extraLength = paddingLength - diffs[0][1].length;
      diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
      patch2.start1 -= extraLength;
      patch2.start2 -= extraLength;
      patch2.length1 += extraLength;
      patch2.length2 += extraLength;
    }
    patch2 = patches[patches.length - 1];
    diffs = patch2.diffs;
    if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
      diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding));
      patch2.length1 += paddingLength;
      patch2.length2 += paddingLength;
    } else if (paddingLength > diffs[diffs.length - 1][1].length) {
      var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
      diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
      patch2.length1 += extraLength;
      patch2.length2 += extraLength;
    }
    return nullPadding;
  };
  diff_match_patch.prototype.patch_splitMax = function(patches) {
    var patch_size = this.Match_MaxBits;
    for (var x2 = 0; x2 < patches.length; x2++) {
      if (patches[x2].length1 <= patch_size) {
        continue;
      }
      var bigpatch = patches[x2];
      patches.splice(x2--, 1);
      var start1 = bigpatch.start1;
      var start2 = bigpatch.start2;
      var precontext = "";
      while (bigpatch.diffs.length !== 0) {
        var patch2 = new diff_match_patch.patch_obj();
        var empty2 = true;
        patch2.start1 = start1 - precontext.length;
        patch2.start2 = start2 - precontext.length;
        if (precontext !== "") {
          patch2.length1 = patch2.length2 = precontext.length;
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, precontext));
        }
        while (bigpatch.diffs.length !== 0 && patch2.length1 < patch_size - this.Patch_Margin) {
          var diff_type = bigpatch.diffs[0][0];
          var diff_text = bigpatch.diffs[0][1];
          if (diff_type === DIFF_INSERT) {
            patch2.length2 += diff_text.length;
            start2 += diff_text.length;
            patch2.diffs.push(bigpatch.diffs.shift());
            empty2 = false;
          } else if (diff_type === DIFF_DELETE && patch2.diffs.length == 1 && patch2.diffs[0][0] == DIFF_EQUAL && diff_text.length > 2 * patch_size) {
            patch2.length1 += diff_text.length;
            start1 += diff_text.length;
            empty2 = false;
            patch2.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
            bigpatch.diffs.shift();
          } else {
            diff_text = diff_text.substring(
              0,
              patch_size - patch2.length1 - this.Patch_Margin
            );
            patch2.length1 += diff_text.length;
            start1 += diff_text.length;
            if (diff_type === DIFF_EQUAL) {
              patch2.length2 += diff_text.length;
              start2 += diff_text.length;
            } else {
              empty2 = false;
            }
            patch2.diffs.push(new diff_match_patch.Diff(diff_type, diff_text));
            if (diff_text == bigpatch.diffs[0][1]) {
              bigpatch.diffs.shift();
            } else {
              bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length);
            }
          }
        }
        precontext = this.diff_text2(patch2.diffs);
        precontext = precontext.substring(precontext.length - this.Patch_Margin);
        var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin);
        if (postcontext !== "") {
          patch2.length1 += postcontext.length;
          patch2.length2 += postcontext.length;
          if (patch2.diffs.length !== 0 && patch2.diffs[patch2.diffs.length - 1][0] === DIFF_EQUAL) {
            patch2.diffs[patch2.diffs.length - 1][1] += postcontext;
          } else {
            patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, postcontext));
          }
        }
        if (!empty2) {
          patches.splice(++x2, 0, patch2);
        }
      }
    }
  };
  diff_match_patch.prototype.patch_toText = function(patches) {
    var text2 = [];
    for (var x2 = 0; x2 < patches.length; x2++) {
      text2[x2] = patches[x2];
    }
    return text2.join("");
  };
  diff_match_patch.prototype.patch_fromText = function(textline) {
    var patches = [];
    if (!textline) {
      return patches;
    }
    var text2 = textline.split("\n");
    var textPointer = 0;
    var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
    while (textPointer < text2.length) {
      var m2 = text2[textPointer].match(patchHeader);
      if (!m2) {
        throw new Error("Invalid patch string: " + text2[textPointer]);
      }
      var patch2 = new diff_match_patch.patch_obj();
      patches.push(patch2);
      patch2.start1 = parseInt(m2[1], 10);
      if (m2[2] === "") {
        patch2.start1--;
        patch2.length1 = 1;
      } else if (m2[2] == "0") {
        patch2.length1 = 0;
      } else {
        patch2.start1--;
        patch2.length1 = parseInt(m2[2], 10);
      }
      patch2.start2 = parseInt(m2[3], 10);
      if (m2[4] === "") {
        patch2.start2--;
        patch2.length2 = 1;
      } else if (m2[4] == "0") {
        patch2.length2 = 0;
      } else {
        patch2.start2--;
        patch2.length2 = parseInt(m2[4], 10);
      }
      textPointer++;
      while (textPointer < text2.length) {
        var sign2 = text2[textPointer].charAt(0);
        try {
          var line2 = decodeURI(text2[textPointer].substring(1));
        } catch (ex) {
          throw new Error("Illegal escape in patch_fromText: " + line2);
        }
        if (sign2 == "-") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_DELETE, line2));
        } else if (sign2 == "+") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_INSERT, line2));
        } else if (sign2 == " ") {
          patch2.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, line2));
        } else if (sign2 == "@") {
          break;
        } else if (sign2 === "")
          ;
        else {
          throw new Error('Invalid patch mode "' + sign2 + '" in: ' + line2);
        }
        textPointer++;
      }
    }
    return patches;
  };
  diff_match_patch.patch_obj = function() {
    this.diffs = [];
    this.start1 = null;
    this.start2 = null;
    this.length1 = 0;
    this.length2 = 0;
  };
  diff_match_patch.patch_obj.prototype.toString = function() {
    var coords1, coords2;
    if (this.length1 === 0) {
      coords1 = this.start1 + ",0";
    } else if (this.length1 == 1) {
      coords1 = this.start1 + 1;
    } else {
      coords1 = this.start1 + 1 + "," + this.length1;
    }
    if (this.length2 === 0) {
      coords2 = this.start2 + ",0";
    } else if (this.length2 == 1) {
      coords2 = this.start2 + 1;
    } else {
      coords2 = this.start2 + 1 + "," + this.length2;
    }
    var text2 = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
    var op;
    for (var x2 = 0; x2 < this.diffs.length; x2++) {
      switch (this.diffs[x2][0]) {
        case DIFF_INSERT:
          op = "+";
          break;
        case DIFF_DELETE:
          op = "-";
          break;
        case DIFF_EQUAL:
          op = " ";
          break;
      }
      text2[x2 + 1] = op + encodeURI(this.diffs[x2][1]) + "\n";
    }
    return text2.join("").replace(/%20/g, " ");
  };
  module2.exports = diff_match_patch;
  module2.exports["diff_match_patch"] = diff_match_patch;
  module2.exports["DIFF_DELETE"] = DIFF_DELETE;
  module2.exports["DIFF_INSERT"] = DIFF_INSERT;
  module2.exports["DIFF_EQUAL"] = DIFF_EQUAL;
})(diffMatchPatch);
var diffMatchPatchExports = diffMatchPatch.exports;
const DiffMatchPatch$1 = /* @__PURE__ */ getDefaultExportFromCjs(diffMatchPatchExports);
var __extends$1 = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics2 = function(d2, b2) {
    extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics2(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics2(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
Object.defineProperty(diff, "__esModule", { value: true });
var PropTypes$1 = propTypesExports;
var React$1 = reactExports;
var split_1$1 = split;
var DiffMatchPatch = diffMatchPatchExports;
var DiffComponent = (
  /** @class */
  function(_super) {
    __extends$1(DiffComponent2, _super);
    function DiffComponent2(props) {
      var _this = _super.call(this, props) || this;
      _this.state = {
        value: _this.props.value
      };
      _this.onChange = _this.onChange.bind(_this);
      _this.diff = _this.diff.bind(_this);
      return _this;
    }
    DiffComponent2.prototype.componentDidUpdate = function() {
      var value2 = this.props.value;
      if (value2 !== this.state.value) {
        this.setState({ value: value2 });
      }
    };
    DiffComponent2.prototype.onChange = function(value2) {
      this.setState({
        value: value2
      });
      if (this.props.onChange) {
        this.props.onChange(value2);
      }
    };
    DiffComponent2.prototype.diff = function() {
      var dmp = new DiffMatchPatch();
      var lhString = this.state.value[0];
      var rhString = this.state.value[1];
      if (lhString.length === 0 && rhString.length === 0) {
        return [];
      }
      var diff2 = dmp.diff_main(lhString, rhString);
      dmp.diff_cleanupSemantic(diff2);
      var diffedLines = this.generateDiffedLines(diff2);
      var codeEditorSettings = this.setCodeMarkers(diffedLines);
      return codeEditorSettings;
    };
    DiffComponent2.prototype.generateDiffedLines = function(diff2) {
      var C2 = {
        DIFF_EQUAL: 0,
        DIFF_DELETE: -1,
        DIFF_INSERT: 1
      };
      var diffedLines = {
        left: [],
        right: []
      };
      var cursor = {
        left: 1,
        right: 1
      };
      diff2.forEach(function(chunk) {
        var chunkType = chunk[0];
        var text2 = chunk[1];
        var lines = text2.split("\n").length - 1;
        if (text2.length === 0) {
          return;
        }
        var firstChar = text2[0];
        var lastChar = text2[text2.length - 1];
        var linesToHighlight = 0;
        switch (chunkType) {
          case C2.DIFF_EQUAL:
            cursor.left += lines;
            cursor.right += lines;
            break;
          case C2.DIFF_DELETE:
            if (firstChar === "\n") {
              cursor.left++;
              lines--;
            }
            linesToHighlight = lines;
            if (linesToHighlight === 0) {
              diffedLines.right.push({
                startLine: cursor.right,
                endLine: cursor.right
              });
            }
            if (lastChar === "\n") {
              linesToHighlight -= 1;
            }
            diffedLines.left.push({
              startLine: cursor.left,
              endLine: cursor.left + linesToHighlight
            });
            cursor.left += lines;
            break;
          case C2.DIFF_INSERT:
            if (firstChar === "\n") {
              cursor.right++;
              lines--;
            }
            linesToHighlight = lines;
            if (linesToHighlight === 0) {
              diffedLines.left.push({
                startLine: cursor.left,
                endLine: cursor.left
              });
            }
            if (lastChar === "\n") {
              linesToHighlight -= 1;
            }
            diffedLines.right.push({
              startLine: cursor.right,
              endLine: cursor.right + linesToHighlight
            });
            cursor.right += lines;
            break;
          default:
            throw new Error("Diff type was not defined.");
        }
      });
      return diffedLines;
    };
    DiffComponent2.prototype.setCodeMarkers = function(diffedLines) {
      if (diffedLines === void 0) {
        diffedLines = { left: [], right: [] };
      }
      var codeEditorSettings = [];
      var newMarkerSet = {
        left: [],
        right: []
      };
      for (var i2 = 0; i2 < diffedLines.left.length; i2++) {
        var markerObj = {
          startRow: diffedLines.left[i2].startLine - 1,
          endRow: diffedLines.left[i2].endLine,
          type: "text",
          className: "codeMarker"
        };
        newMarkerSet.left.push(markerObj);
      }
      for (var i2 = 0; i2 < diffedLines.right.length; i2++) {
        var markerObj = {
          startRow: diffedLines.right[i2].startLine - 1,
          endRow: diffedLines.right[i2].endLine,
          type: "text",
          className: "codeMarker"
        };
        newMarkerSet.right.push(markerObj);
      }
      codeEditorSettings[0] = newMarkerSet.left;
      codeEditorSettings[1] = newMarkerSet.right;
      return codeEditorSettings;
    };
    DiffComponent2.prototype.render = function() {
      var markers = this.diff();
      return React$1.createElement(split_1$1.default, { name: this.props.name, className: this.props.className, focus: this.props.focus, orientation: this.props.orientation, splits: this.props.splits, mode: this.props.mode, theme: this.props.theme, height: this.props.height, width: this.props.width, fontSize: this.props.fontSize, showGutter: this.props.showGutter, onChange: this.onChange, onPaste: this.props.onPaste, onLoad: this.props.onLoad, onScroll: this.props.onScroll, minLines: this.props.minLines, maxLines: this.props.maxLines, readOnly: this.props.readOnly, highlightActiveLine: this.props.highlightActiveLine, showPrintMargin: this.props.showPrintMargin, tabSize: this.props.tabSize, cursorStart: this.props.cursorStart, editorProps: this.props.editorProps, style: this.props.style, scrollMargin: this.props.scrollMargin, setOptions: this.props.setOptions, wrapEnabled: this.props.wrapEnabled, enableBasicAutocompletion: this.props.enableBasicAutocompletion, enableLiveAutocompletion: this.props.enableLiveAutocompletion, value: this.state.value, markers });
    };
    DiffComponent2.propTypes = {
      cursorStart: PropTypes$1.number,
      editorProps: PropTypes$1.object,
      enableBasicAutocompletion: PropTypes$1.bool,
      enableLiveAutocompletion: PropTypes$1.bool,
      focus: PropTypes$1.bool,
      fontSize: PropTypes$1.number,
      height: PropTypes$1.string,
      highlightActiveLine: PropTypes$1.bool,
      maxLines: PropTypes$1.number,
      minLines: PropTypes$1.number,
      mode: PropTypes$1.string,
      name: PropTypes$1.string,
      className: PropTypes$1.string,
      onLoad: PropTypes$1.func,
      onPaste: PropTypes$1.func,
      onScroll: PropTypes$1.func,
      onChange: PropTypes$1.func,
      orientation: PropTypes$1.string,
      readOnly: PropTypes$1.bool,
      scrollMargin: PropTypes$1.array,
      setOptions: PropTypes$1.object,
      showGutter: PropTypes$1.bool,
      showPrintMargin: PropTypes$1.bool,
      splits: PropTypes$1.number,
      style: PropTypes$1.object,
      tabSize: PropTypes$1.number,
      theme: PropTypes$1.string,
      value: PropTypes$1.array,
      width: PropTypes$1.string,
      wrapEnabled: PropTypes$1.bool
    };
    DiffComponent2.defaultProps = {
      cursorStart: 1,
      editorProps: {},
      enableBasicAutocompletion: false,
      enableLiveAutocompletion: false,
      focus: false,
      fontSize: 12,
      height: "500px",
      highlightActiveLine: true,
      maxLines: null,
      minLines: null,
      mode: "",
      name: "ace-editor",
      onLoad: null,
      onScroll: null,
      onPaste: null,
      onChange: null,
      orientation: "beside",
      readOnly: false,
      scrollMargin: [0, 0, 0, 0],
      setOptions: {},
      showGutter: true,
      showPrintMargin: true,
      splits: 2,
      style: {},
      tabSize: 4,
      theme: "github",
      value: ["", ""],
      width: "500px",
      wrapEnabled: true
    };
    return DiffComponent2;
  }(React$1.Component)
);
diff.default = DiffComponent;
Object.defineProperty(lib, "__esModule", { value: true });
lib.diff = lib.split = void 0;
var ace_1 = ace$4;
var diff_1 = diff;
lib.diff = diff_1.default;
var split_1 = split;
lib.split = split_1.default;
var _default$1 = lib.default = ace_1.default;
var modeJavascript = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/mode/jsdoc_comment_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text_highlight_rules"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var JsDocCommentHighlightRules = function() {
      this.$rules = {
        "start": [
          {
            token: ["comment.doc.tag", "comment.doc.text", "lparen.doc"],
            regex: "(@(?:param|member|typedef|property|namespace|var|const|callback))(\\s*)({)",
            push: [
              {
                token: "lparen.doc",
                regex: "{",
                push: [
                  {
                    include: "doc-syntax"
                  },
                  {
                    token: "rparen.doc",
                    regex: "}|(?=$)",
                    next: "pop"
                  }
                ]
              },
              {
                token: ["rparen.doc", "text.doc", "variable.parameter.doc", "lparen.doc", "variable.parameter.doc", "rparen.doc"],
                regex: /(})(\s*)(?:([\w=:\/\.]+)|(?:(\[)([\w=:\/\.\-\'\" ]+)(\])))/,
                next: "pop"
              },
              {
                token: "rparen.doc",
                regex: "}|(?=$)",
                next: "pop"
              },
              {
                include: "doc-syntax"
              },
              {
                defaultToken: "text.doc"
              }
            ]
          },
          {
            token: ["comment.doc.tag", "text.doc", "lparen.doc"],
            regex: "(@(?:returns?|yields|type|this|suppress|public|protected|private|package|modifies|implements|external|exception|throws|enum|define|extends))(\\s*)({)",
            push: [
              {
                token: "lparen.doc",
                regex: "{",
                push: [
                  {
                    include: "doc-syntax"
                  },
                  {
                    token: "rparen.doc",
                    regex: "}|(?=$)",
                    next: "pop"
                  }
                ]
              },
              {
                token: "rparen.doc",
                regex: "}|(?=$)",
                next: "pop"
              },
              {
                include: "doc-syntax"
              },
              {
                defaultToken: "text.doc"
              }
            ]
          },
          {
            token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
            regex: '(@(?:alias|memberof|instance|module|name|lends|namespace|external|this|template|requires|param|implements|function|extends|typedef|mixes|constructor|var|memberof\\!|event|listens|exports|class|constructs|interface|emits|fires|throws|const|callback|borrows|augments))(\\s+)(\\w[\\w#.:/~"\\-]*)?'
          },
          {
            token: ["comment.doc.tag", "text.doc", "variable.parameter.doc"],
            regex: "(@method)(\\s+)(\\w[\\w.\\(\\)]*)"
          },
          {
            token: "comment.doc.tag",
            regex: "@access\\s+(?:private|public|protected)"
          },
          {
            token: "comment.doc.tag",
            regex: "@kind\\s+(?:class|constant|event|external|file|function|member|mixin|module|namespace|typedef)"
          },
          {
            token: "comment.doc.tag",
            regex: "@\\w+(?=\\s|$)"
          },
          JsDocCommentHighlightRules.getTagRule(),
          {
            defaultToken: "comment.doc.body",
            caseInsensitive: true
          }
        ],
        "doc-syntax": [{
          token: "operator.doc",
          regex: /[|:]/
        }, {
          token: "paren.doc",
          regex: /[\[\]]/
        }]
      };
      this.normalizeRules();
    };
    oop.inherits(JsDocCommentHighlightRules, TextHighlightRules);
    JsDocCommentHighlightRules.getTagRule = function(start) {
      return {
        token: "comment.doc.tag.storage.type",
        regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b"
      };
    };
    JsDocCommentHighlightRules.getStartRule = function(start) {
      return {
        token: "comment.doc",
        // doc comment
        regex: /\/\*\*(?!\/)/,
        next: start
      };
    };
    JsDocCommentHighlightRules.getEndRule = function(start) {
      return {
        token: "comment.doc",
        // closing comment
        regex: "\\*\\/",
        next: start
      };
    };
    exports3.JsDocCommentHighlightRules = JsDocCommentHighlightRules;
  });
  ace.define("ace/mode/javascript_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/jsdoc_comment_highlight_rules", "ace/mode/text_highlight_rules"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var DocCommentHighlightRules = require2("./jsdoc_comment_highlight_rules").JsDocCommentHighlightRules;
    var TextHighlightRules = require2("./text_highlight_rules").TextHighlightRules;
    var identifierRe = "[a-zA-Z\\$_¡-][a-zA-Z\\d\\$_¡-]*";
    var JavaScriptHighlightRules = function(options) {
      var keywords = {
        "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",
        // Pseudo
        "keyword": "const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor",
        "storage.type": "const|let|var|function",
        "constant.language": "null|Infinity|NaN|undefined",
        "support.function": "alert",
        "constant.language.boolean": "true|false"
      };
      var keywordMapper = this.createKeywordMapper(keywords, "identifier");
      var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
      var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";
      var anonymousFunctionRe = "(function)(\\s*)(\\*?)";
      var functionCallStartRule = {
        token: ["identifier", "text", "paren.lparen"],
        regex: "(\\b(?!" + Object.values(keywords).join("|") + "\\b)" + identifierRe + ")(\\s*)(\\()"
      };
      this.$rules = {
        "no_regex": [
          DocCommentHighlightRules.getStartRule("doc-start"),
          comments("no_regex"),
          functionCallStartRule,
          {
            token: "string",
            regex: "'(?=.)",
            next: "qstring"
          },
          {
            token: "string",
            regex: '"(?=.)',
            next: "qqstring"
          },
          {
            token: "constant.numeric",
            // hexadecimal, octal and binary
            regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
          },
          {
            token: "constant.numeric",
            // decimal integers and floats
            regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
          },
          {
            token: [
              "entity.name.function",
              "text",
              "keyword.operator",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "text",
              "entity.name.function",
              "text",
              "paren.lparen"
            ],
            regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(" + identifierRe + ")(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "entity.name.function",
              "text",
              "punctuation.operator",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "text",
              "text",
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: "(:)(\\s*)" + anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: "keyword",
            regex: `from(?=\\s*('|"))`
          },
          {
            token: "keyword",
            regex: "(?:" + kwBeforeRe + ")\\b",
            next: "start"
          },
          {
            token: "support.constant",
            regex: /that\b/
          },
          {
            token: ["storage.type", "punctuation.operator", "support.function.firebug"],
            regex: /(console)(\.)(warn|info|log|error|debug|time|trace|timeEnd|assert)\b/
          },
          {
            token: keywordMapper,
            regex: identifierRe
          },
          {
            token: "punctuation.operator",
            regex: /[.](?![.])/,
            next: "property"
          },
          {
            token: "storage.type",
            regex: /=>/,
            next: "start"
          },
          {
            token: "keyword.operator",
            regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
            next: "start"
          },
          {
            token: "punctuation.operator",
            regex: /[?:,;.]/,
            next: "start"
          },
          {
            token: "paren.lparen",
            regex: /[\[({]/,
            next: "start"
          },
          {
            token: "paren.rparen",
            regex: /[\])}]/
          },
          {
            token: "comment",
            regex: /^#!.*$/
          }
        ],
        property: [
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "keyword.operator",
            regex: /=/
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "paren.lparen"
            ],
            regex: anonymousFunctionRe + "(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: [
              "storage.type",
              "text",
              "storage.type",
              "text",
              "text",
              "entity.name.function",
              "text",
              "paren.lparen"
            ],
            regex: "(function)(?:(?:(\\s*)(\\*)(\\s*))|(\\s+))(\\w+)(\\s*)(\\()",
            next: "function_arguments"
          },
          {
            token: "punctuation.operator",
            regex: /[.](?![.])/
          },
          {
            token: "support.function",
            regex: "prototype"
          },
          {
            token: "support.function",
            regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
          },
          {
            token: "support.function.dom",
            regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
          },
          {
            token: "support.constant",
            regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
          },
          {
            token: "identifier",
            regex: identifierRe
          },
          {
            regex: "",
            token: "empty",
            next: "no_regex"
          }
        ],
        "start": [
          DocCommentHighlightRules.getStartRule("doc-start"),
          comments("start"),
          {
            token: "string.regexp",
            regex: "\\/",
            next: "regex"
          },
          {
            token: "text",
            regex: "\\s+|^$",
            next: "start"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "regex": [
          {
            token: "regexp.keyword.operator",
            regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
          },
          {
            token: "string.regexp",
            regex: "/[sxngimy]*",
            next: "no_regex"
          },
          {
            token: "invalid",
            regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
          },
          {
            token: "constant.language.escape",
            regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
          },
          {
            token: "constant.language.delimiter",
            regex: /\|/
          },
          {
            token: "constant.language.escape",
            regex: /\[\^?/,
            next: "regex_character_class"
          },
          {
            token: "empty",
            regex: "$",
            next: "no_regex"
          },
          {
            defaultToken: "string.regexp"
          }
        ],
        "regex_character_class": [
          {
            token: "regexp.charclass.keyword.operator",
            regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
          },
          {
            token: "constant.language.escape",
            regex: "]",
            next: "regex"
          },
          {
            token: "constant.language.escape",
            regex: "-"
          },
          {
            token: "empty",
            regex: "$",
            next: "no_regex"
          },
          {
            defaultToken: "string.regexp.charachterclass"
          }
        ],
        "default_parameter": [
          {
            token: "string",
            regex: "'(?=.)",
            push: [
              {
                token: "string",
                regex: "'|$",
                next: "pop"
              },
              {
                include: "qstring"
              }
            ]
          },
          {
            token: "string",
            regex: '"(?=.)',
            push: [
              {
                token: "string",
                regex: '"|$',
                next: "pop"
              },
              {
                include: "qqstring"
              }
            ]
          },
          {
            token: "constant.language",
            regex: "null|Infinity|NaN|undefined"
          },
          {
            token: "constant.numeric",
            // hexadecimal, octal and binary
            regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
          },
          {
            token: "constant.numeric",
            // decimal integers and floats
            regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
          },
          {
            token: "punctuation.operator",
            regex: ",",
            next: "function_arguments"
          },
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "punctuation.operator",
            regex: "$"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "function_arguments": [
          comments("function_arguments"),
          {
            token: "variable.parameter",
            regex: identifierRe
          },
          {
            token: "punctuation.operator",
            regex: ","
          },
          {
            token: "text",
            regex: "\\s+"
          },
          {
            token: "punctuation.operator",
            regex: "$"
          },
          {
            token: "empty",
            regex: "",
            next: "no_regex"
          }
        ],
        "qqstring": [
          {
            token: "constant.language.escape",
            regex: escapedRe
          },
          {
            token: "string",
            regex: "\\\\$",
            consumeLineEnd: true
          },
          {
            token: "string",
            regex: '"|$',
            next: "no_regex"
          },
          {
            defaultToken: "string"
          }
        ],
        "qstring": [
          {
            token: "constant.language.escape",
            regex: escapedRe
          },
          {
            token: "string",
            regex: "\\\\$",
            consumeLineEnd: true
          },
          {
            token: "string",
            regex: "'|$",
            next: "no_regex"
          },
          {
            defaultToken: "string"
          }
        ]
      };
      if (!options || !options.noES6) {
        this.$rules.no_regex.unshift({
          regex: "[{}]",
          onMatch: function(val, state, stack) {
            this.next = val == "{" ? this.nextState : "";
            if (val == "{" && stack.length) {
              stack.unshift("start", state);
            } else if (val == "}" && stack.length) {
              stack.shift();
              this.next = stack.shift();
              if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
                return "paren.quasi.end";
            }
            return val == "{" ? "paren.lparen" : "paren.rparen";
          },
          nextState: "start"
        }, {
          token: "string.quasi.start",
          regex: /`/,
          push: [{
            token: "constant.language.escape",
            regex: escapedRe
          }, {
            token: "paren.quasi.start",
            regex: /\${/,
            push: "start"
          }, {
            token: "string.quasi.end",
            regex: /`/,
            next: "pop"
          }, {
            defaultToken: "string.quasi"
          }]
        }, {
          token: ["variable.parameter", "text"],
          regex: "(" + identifierRe + ")(\\s*)(?=\\=>)"
        }, {
          token: "paren.lparen",
          regex: "(\\()(?=[^\\(]+\\s*=>)",
          next: "function_arguments"
        }, {
          token: "variable.language",
          regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b"
        });
        this.$rules["function_arguments"].unshift({
          token: "keyword.operator",
          regex: "=",
          next: "default_parameter"
        }, {
          token: "keyword.operator",
          regex: "\\.{3}"
        });
        this.$rules["property"].unshift({
          token: "support.function",
          regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()"
        }, {
          token: "constant.language",
          regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b"
        });
        if (!options || options.jsx != false)
          JSX.call(this);
      }
      this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("no_regex")]);
      this.normalizeRules();
    };
    oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
    function JSX() {
      var tagRegex = identifierRe.replace("\\d", "\\d\\-");
      var jsxTag = {
        onMatch: function(val, state, stack) {
          var offset2 = val.charAt(1) == "/" ? 2 : 1;
          if (offset2 == 1) {
            if (state != this.nextState)
              stack.unshift(this.next, this.nextState, 0);
            else
              stack.unshift(this.next);
            stack[2]++;
          } else if (offset2 == 2) {
            if (state == this.nextState) {
              stack[1]--;
              if (!stack[1] || stack[1] < 0) {
                stack.shift();
                stack.shift();
              }
            }
          }
          return [{
            type: "meta.tag.punctuation." + (offset2 == 1 ? "" : "end-") + "tag-open.xml",
            value: val.slice(0, offset2)
          }, {
            type: "meta.tag.tag-name.xml",
            value: val.substr(offset2)
          }];
        },
        regex: "</?(?:" + tagRegex + "|(?=>))",
        next: "jsxAttributes",
        nextState: "jsx"
      };
      this.$rules.start.unshift(jsxTag);
      var jsxJsRule = {
        regex: "{",
        token: "paren.quasi.start",
        push: "start"
      };
      this.$rules.jsx = [
        jsxJsRule,
        jsxTag,
        { include: "reference" },
        { defaultToken: "string.xml" }
      ];
      this.$rules.jsxAttributes = [
        {
          token: "meta.tag.punctuation.tag-close.xml",
          regex: "/?>",
          onMatch: function(value2, currentState, stack) {
            if (currentState == stack[0])
              stack.shift();
            if (value2.length == 2) {
              if (stack[0] == this.nextState)
                stack[1]--;
              if (!stack[1] || stack[1] < 0) {
                stack.splice(0, 2);
              }
            }
            this.next = stack[0] || "start";
            return [{ type: this.token, value: value2 }];
          },
          nextState: "jsx"
        },
        jsxJsRule,
        comments("jsxAttributes"),
        {
          token: "entity.other.attribute-name.xml",
          regex: tagRegex
        },
        {
          token: "keyword.operator.attribute-equals.xml",
          regex: "="
        },
        {
          token: "text.tag-whitespace.xml",
          regex: "\\s+"
        },
        {
          token: "string.attribute-value.xml",
          regex: "'",
          stateName: "jsx_attr_q",
          push: [
            { token: "string.attribute-value.xml", regex: "'", next: "pop" },
            { include: "reference" },
            { defaultToken: "string.attribute-value.xml" }
          ]
        },
        {
          token: "string.attribute-value.xml",
          regex: '"',
          stateName: "jsx_attr_qq",
          push: [
            { token: "string.attribute-value.xml", regex: '"', next: "pop" },
            { include: "reference" },
            { defaultToken: "string.attribute-value.xml" }
          ]
        },
        jsxTag
      ];
      this.$rules.reference = [{
        token: "constant.language.escape.reference.xml",
        regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
      }];
    }
    function comments(next2) {
      return [
        {
          token: "comment",
          // multi line comment
          regex: /\/\*/,
          next: [
            DocCommentHighlightRules.getTagRule(),
            { token: "comment", regex: "\\*\\/", next: next2 || "pop" },
            { defaultToken: "comment", caseInsensitive: true }
          ]
        },
        {
          token: "comment",
          regex: "\\/\\/",
          next: [
            DocCommentHighlightRules.getTagRule(),
            { token: "comment", regex: "$|^", next: next2 || "pop" },
            { defaultToken: "comment", caseInsensitive: true }
          ]
        }
      ];
    }
    exports3.JavaScriptHighlightRules = JavaScriptHighlightRules;
  });
  ace.define("ace/mode/matching_brace_outdent", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("../range").Range;
    var MatchingBraceOutdent = function() {
    };
    (function() {
      this.checkOutdent = function(line2, input2) {
        if (!/^\s+$/.test(line2))
          return false;
        return /^\s*\}/.test(input2);
      };
      this.autoOutdent = function(doc, row) {
        var line2 = doc.getLine(row);
        var match5 = line2.match(/^(\s*\})/);
        if (!match5)
          return 0;
        var column2 = match5[1].length;
        var openBracePos = doc.findMatchingBracket({ row, column: column2 });
        if (!openBracePos || openBracePos.row == row)
          return 0;
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
        doc.replace(new Range(row, 0, row, column2 - 1), indent);
      };
      this.$getIndent = function(line2) {
        return line2.match(/^\s*/)[0];
      };
    }).call(MatchingBraceOutdent.prototype);
    exports3.MatchingBraceOutdent = MatchingBraceOutdent;
  });
  ace.define("ace/mode/behaviour/xml", ["require", "exports", "module", "ace/lib/oop", "ace/mode/behaviour", "ace/token_iterator"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Behaviour = require2("../behaviour").Behaviour;
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    function is2(token2, type4) {
      return token2 && token2.type.lastIndexOf(type4 + ".xml") > -1;
    }
    var XmlBehaviour = function() {
      this.add("string_dquotes", "insertion", function(state, action, editor, session, text2) {
        if (text2 == '"' || text2 == "'") {
          var quote = text2;
          var selected = session.doc.getTextRange(editor.getSelectionRange());
          if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
            return {
              text: quote + selected + quote,
              selection: false
            };
          }
          var cursor = editor.getCursorPosition();
          var line2 = session.doc.getLine(cursor.row);
          var rightChar = line2.substring(cursor.column, cursor.column + 1);
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          if (rightChar == quote && (is2(token2, "attribute-value") || is2(token2, "string"))) {
            return {
              text: "",
              selection: [1, 1]
            };
          }
          if (!token2)
            token2 = iterator2.stepBackward();
          if (!token2)
            return;
          while (is2(token2, "tag-whitespace") || is2(token2, "whitespace")) {
            token2 = iterator2.stepBackward();
          }
          var rightSpace = !rightChar || rightChar.match(/\s/);
          if (is2(token2, "attribute-equals") && (rightSpace || rightChar == ">") || is2(token2, "decl-attribute-equals") && (rightSpace || rightChar == "?")) {
            return {
              text: quote + quote,
              selection: [1, 1]
            };
          }
        }
      });
      this.add("string_dquotes", "deletion", function(state, action, editor, session, range3) {
        var selected = session.doc.getTextRange(range3);
        if (!range3.isMultiLine() && (selected == '"' || selected == "'")) {
          var line2 = session.doc.getLine(range3.start.row);
          var rightChar = line2.substring(range3.start.column + 1, range3.start.column + 2);
          if (rightChar == selected) {
            range3.end.column++;
            return range3;
          }
        }
      });
      this.add("autoclosing", "insertion", function(state, action, editor, session, text2) {
        if (text2 == ">") {
          var position2 = editor.getSelectionRange().start;
          var iterator2 = new TokenIterator(session, position2.row, position2.column);
          var token2 = iterator2.getCurrentToken() || iterator2.stepBackward();
          if (!token2 || !(is2(token2, "tag-name") || is2(token2, "tag-whitespace") || is2(token2, "attribute-name") || is2(token2, "attribute-equals") || is2(token2, "attribute-value")))
            return;
          if (is2(token2, "reference.attribute-value"))
            return;
          if (is2(token2, "attribute-value")) {
            var tokenEndColumn = iterator2.getCurrentTokenColumn() + token2.value.length;
            if (position2.column < tokenEndColumn)
              return;
            if (position2.column == tokenEndColumn) {
              var nextToken = iterator2.stepForward();
              if (nextToken && is2(nextToken, "attribute-value"))
                return;
              iterator2.stepBackward();
            }
          }
          if (/^\s*>/.test(session.getLine(position2.row).slice(position2.column)))
            return;
          while (!is2(token2, "tag-name")) {
            token2 = iterator2.stepBackward();
            if (token2.value == "<") {
              token2 = iterator2.stepForward();
              break;
            }
          }
          var tokenRow = iterator2.getCurrentTokenRow();
          var tokenColumn = iterator2.getCurrentTokenColumn();
          if (is2(iterator2.stepBackward(), "end-tag-open"))
            return;
          var element2 = token2.value;
          if (tokenRow == position2.row)
            element2 = element2.substring(0, position2.column - tokenColumn);
          if (this.voidElements && this.voidElements.hasOwnProperty(element2.toLowerCase()))
            return;
          return {
            text: "></" + element2 + ">",
            selection: [1, 1]
          };
        }
      });
      this.add("autoindent", "insertion", function(state, action, editor, session, text2) {
        if (text2 == "\n") {
          var cursor = editor.getCursorPosition();
          var line2 = session.getLine(cursor.row);
          var iterator2 = new TokenIterator(session, cursor.row, cursor.column);
          var token2 = iterator2.getCurrentToken();
          if (is2(token2, "") && token2.type.indexOf("tag-close") !== -1) {
            if (token2.value == "/>")
              return;
            while (token2 && token2.type.indexOf("tag-name") === -1) {
              token2 = iterator2.stepBackward();
            }
            if (!token2) {
              return;
            }
            var tag = token2.value;
            var row = iterator2.getCurrentTokenRow();
            token2 = iterator2.stepBackward();
            if (!token2 || token2.type.indexOf("end-tag") !== -1) {
              return;
            }
            if (this.voidElements && !this.voidElements[tag] || !this.voidElements) {
              var nextToken = session.getTokenAt(cursor.row, cursor.column + 1);
              var line2 = session.getLine(row);
              var nextIndent = this.$getIndent(line2);
              var indent = nextIndent + session.getTabString();
              if (nextToken && nextToken.value === "</") {
                return {
                  text: "\n" + indent + "\n" + nextIndent,
                  selection: [1, indent.length, 1, indent.length]
                };
              } else {
                return {
                  text: "\n" + indent
                };
              }
            }
          }
        }
      });
    };
    oop.inherits(XmlBehaviour, Behaviour);
    exports3.XmlBehaviour = XmlBehaviour;
  });
  ace.define("ace/mode/behaviour/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/token_iterator", "ace/mode/behaviour/cstyle", "ace/mode/behaviour/xml"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var TokenIterator = require2("../../token_iterator").TokenIterator;
    var CstyleBehaviour = require2("../behaviour/cstyle").CstyleBehaviour;
    var XmlBehaviour = require2("../behaviour/xml").XmlBehaviour;
    var JavaScriptBehaviour = function() {
      var xmlBehaviours = new XmlBehaviour({ closeCurlyBraces: true }).getBehaviours();
      this.addBehaviours(xmlBehaviours);
      this.inherit(CstyleBehaviour);
      this.add("autoclosing-fragment", "insertion", function(state, action, editor, session, text2) {
        if (text2 == ">") {
          var position2 = editor.getSelectionRange().start;
          var iterator2 = new TokenIterator(session, position2.row, position2.column);
          var token2 = iterator2.getCurrentToken() || iterator2.stepBackward();
          if (!token2)
            return;
          if (token2.value == "<") {
            return {
              text: "></>",
              selection: [1, 1]
            };
          }
        }
      });
    };
    oop.inherits(JavaScriptBehaviour, CstyleBehaviour);
    exports3.JavaScriptBehaviour = JavaScriptBehaviour;
  });
  ace.define("ace/mode/folding/xml", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Range = require2("../../range").Range;
    var BaseFoldMode = require2("./fold_mode").FoldMode;
    var FoldMode = exports3.FoldMode = function(voidElements2, optionalEndTags) {
      BaseFoldMode.call(this);
      this.voidElements = voidElements2 || {};
      this.optionalEndTags = oop.mixin({}, this.voidElements);
      if (optionalEndTags)
        oop.mixin(this.optionalEndTags, optionalEndTags);
    };
    oop.inherits(FoldMode, BaseFoldMode);
    var Tag = function() {
      this.tagName = "";
      this.closing = false;
      this.selfClosing = false;
      this.start = { row: 0, column: 0 };
      this.end = { row: 0, column: 0 };
    };
    function is2(token2, type4) {
      return token2 && token2.type && token2.type.lastIndexOf(type4 + ".xml") > -1;
    }
    (function() {
      this.getFoldWidget = function(session, foldStyle, row) {
        var tag = this._getFirstTagInLine(session, row);
        if (!tag)
          return this.getCommentFoldWidget(session, row);
        if (tag.closing || !tag.tagName && tag.selfClosing)
          return foldStyle === "markbeginend" ? "end" : "";
        if (!tag.tagName || tag.selfClosing || this.voidElements.hasOwnProperty(tag.tagName.toLowerCase()))
          return "";
        if (this._findEndTagInLine(session, row, tag.tagName, tag.end.column))
          return "";
        return "start";
      };
      this.getCommentFoldWidget = function(session, row) {
        if (/comment/.test(session.getState(row)) && /<!-/.test(session.getLine(row)))
          return "start";
        return "";
      };
      this._getFirstTagInLine = function(session, row) {
        var tokens2 = session.getTokens(row);
        var tag = new Tag();
        for (var i2 = 0; i2 < tokens2.length; i2++) {
          var token2 = tokens2[i2];
          if (is2(token2, "tag-open")) {
            tag.end.column = tag.start.column + token2.value.length;
            tag.closing = is2(token2, "end-tag-open");
            token2 = tokens2[++i2];
            if (!token2)
              return null;
            tag.tagName = token2.value;
            if (token2.value === "") {
              token2 = tokens2[++i2];
              if (!token2)
                return null;
              tag.tagName = token2.value;
            }
            tag.end.column += token2.value.length;
            for (i2++; i2 < tokens2.length; i2++) {
              token2 = tokens2[i2];
              tag.end.column += token2.value.length;
              if (is2(token2, "tag-close")) {
                tag.selfClosing = token2.value == "/>";
                break;
              }
            }
            return tag;
          } else if (is2(token2, "tag-close")) {
            tag.selfClosing = token2.value == "/>";
            return tag;
          }
          tag.start.column += token2.value.length;
        }
        return null;
      };
      this._findEndTagInLine = function(session, row, tagName, startColumn) {
        var tokens2 = session.getTokens(row);
        var column2 = 0;
        for (var i2 = 0; i2 < tokens2.length; i2++) {
          var token2 = tokens2[i2];
          column2 += token2.value.length;
          if (column2 < startColumn - 1)
            continue;
          if (is2(token2, "end-tag-open")) {
            token2 = tokens2[i2 + 1];
            if (is2(token2, "tag-name") && token2.value === "") {
              token2 = tokens2[i2 + 2];
            }
            if (token2 && token2.value == tagName)
              return true;
          }
        }
        return false;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row) {
        var firstTag = this._getFirstTagInLine(session, row);
        if (!firstTag) {
          return this.getCommentFoldWidget(session, row) && session.getCommentFoldRange(row, session.getLine(row).length);
        }
        var tags = session.getMatchingTags({ row, column: 0 });
        if (tags) {
          return new Range(tags.openTag.end.row, tags.openTag.end.column, tags.closeTag.start.row, tags.closeTag.start.column);
        }
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/folding/cstyle", ["require", "exports", "module", "ace/lib/oop", "ace/range", "ace/mode/folding/fold_mode"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var Range = require2("../../range").Range;
    var BaseFoldMode = require2("./fold_mode").FoldMode;
    var FoldMode = exports3.FoldMode = function(commentRegex) {
      if (commentRegex) {
        this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
        this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
      }
    };
    oop.inherits(FoldMode, BaseFoldMode);
    (function() {
      this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
      this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
      this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/;
      this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
      this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
      this._getFoldWidgetBase = this.getFoldWidget;
      this.getFoldWidget = function(session, foldStyle, row) {
        var line2 = session.getLine(row);
        if (this.singleLineBlockCommentRe.test(line2)) {
          if (!this.startRegionRe.test(line2) && !this.tripleStarBlockCommentRe.test(line2))
            return "";
        }
        var fw = this._getFoldWidgetBase(session, foldStyle, row);
        if (!fw && this.startRegionRe.test(line2))
          return "start";
        return fw;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
        var line2 = session.getLine(row);
        if (this.startRegionRe.test(line2))
          return this.getCommentRegionBlock(session, line2, row);
        var match5 = line2.match(this.foldingStartMarker);
        if (match5) {
          var i2 = match5.index;
          if (match5[1])
            return this.openingBracketBlock(session, match5[1], row, i2);
          var range3 = session.getCommentFoldRange(row, i2 + match5[0].length, 1);
          if (range3 && !range3.isMultiLine()) {
            if (forceMultiline) {
              range3 = this.getSectionRange(session, row);
            } else if (foldStyle != "all")
              range3 = null;
          }
          return range3;
        }
        if (foldStyle === "markbegin")
          return;
        var match5 = line2.match(this.foldingStopMarker);
        if (match5) {
          var i2 = match5.index + match5[0].length;
          if (match5[1])
            return this.closingBracketBlock(session, match5[1], row, i2);
          return session.getCommentFoldRange(row, i2, -1);
        }
      };
      this.getSectionRange = function(session, row) {
        var line2 = session.getLine(row);
        var startIndent = line2.search(/\S/);
        var startRow = row;
        var startColumn = line2.length;
        row = row + 1;
        var endRow = row;
        var maxRow = session.getLength();
        while (++row < maxRow) {
          line2 = session.getLine(row);
          var indent = line2.search(/\S/);
          if (indent === -1)
            continue;
          if (startIndent > indent)
            break;
          var subRange = this.getFoldWidgetRange(session, "all", row);
          if (subRange) {
            if (subRange.start.row <= startRow) {
              break;
            } else if (subRange.isMultiLine()) {
              row = subRange.end.row;
            } else if (startIndent == indent) {
              break;
            }
          }
          endRow = row;
        }
        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
      };
      this.getCommentRegionBlock = function(session, line2, row) {
        var startColumn = line2.search(/\s*$/);
        var maxRow = session.getLength();
        var startRow = row;
        var re2 = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
        var depth = 1;
        while (++row < maxRow) {
          line2 = session.getLine(row);
          var m2 = re2.exec(line2);
          if (!m2)
            continue;
          if (m2[1])
            depth--;
          else
            depth++;
          if (!depth)
            break;
        }
        var endRow = row;
        if (endRow > startRow) {
          return new Range(startRow, startColumn, endRow, line2.length);
        }
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/folding/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/mode/folding/xml", "ace/mode/folding/cstyle"], function(require2, exports3, module3) {
    var oop = require2("../../lib/oop");
    var XmlFoldMode = require2("./xml").FoldMode;
    var CFoldMode = require2("./cstyle").FoldMode;
    var FoldMode = exports3.FoldMode = function(commentRegex) {
      if (commentRegex) {
        this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start));
        this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end));
      }
      this.xmlFoldMode = new XmlFoldMode();
    };
    oop.inherits(FoldMode, CFoldMode);
    (function() {
      this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
      this.getFoldWidgetBase = this.getFoldWidget;
      this.getFoldWidget = function(session, foldStyle, row) {
        var fw = this.getFoldWidgetBase(session, foldStyle, row);
        if (!fw) {
          return this.xmlFoldMode.getFoldWidget(session, foldStyle, row);
        }
        return fw;
      };
      this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
        var range3 = this.getFoldWidgetRangeBase(session, foldStyle, row, forceMultiline);
        if (range3)
          return range3;
        return this.xmlFoldMode.getFoldWidgetRange(session, foldStyle, row);
      };
    }).call(FoldMode.prototype);
  });
  ace.define("ace/mode/javascript", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/javascript_highlight_rules", "ace/mode/matching_brace_outdent", "ace/worker/worker_client", "ace/mode/behaviour/javascript", "ace/mode/folding/javascript"], function(require2, exports3, module3) {
    var oop = require2("../lib/oop");
    var TextMode = require2("./text").Mode;
    var JavaScriptHighlightRules = require2("./javascript_highlight_rules").JavaScriptHighlightRules;
    var MatchingBraceOutdent = require2("./matching_brace_outdent").MatchingBraceOutdent;
    var WorkerClient = require2("../worker/worker_client").WorkerClient;
    var JavaScriptBehaviour = require2("./behaviour/javascript").JavaScriptBehaviour;
    var JavaScriptFoldMode = require2("./folding/javascript").FoldMode;
    var Mode = function() {
      this.HighlightRules = JavaScriptHighlightRules;
      this.$outdent = new MatchingBraceOutdent();
      this.$behaviour = new JavaScriptBehaviour();
      this.foldingRules = new JavaScriptFoldMode();
    };
    oop.inherits(Mode, TextMode);
    (function() {
      this.lineCommentStart = "//";
      this.blockComment = { start: "/*", end: "*/" };
      this.$quotes = { '"': '"', "'": "'", "`": "`" };
      this.$pairQuotesAfter = {
        "`": /\w/
      };
      this.getNextLineIndent = function(state, line2, tab2) {
        var indent = this.$getIndent(line2);
        var tokenizedLine = this.getTokenizer().getLineTokens(line2, state);
        var tokens2 = tokenizedLine.tokens;
        var endState = tokenizedLine.state;
        if (tokens2.length && tokens2[tokens2.length - 1].type == "comment") {
          return indent;
        }
        if (state == "start" || state == "no_regex") {
          var match5 = line2.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
          if (match5) {
            indent += tab2;
          }
        } else if (state == "doc-start") {
          if (endState == "start" || endState == "no_regex") {
            return "";
          }
        }
        return indent;
      };
      this.checkOutdent = function(state, line2, input2) {
        return this.$outdent.checkOutdent(line2, input2);
      };
      this.autoOutdent = function(state, doc, row) {
        this.$outdent.autoOutdent(doc, row);
      };
      this.createWorker = function(session) {
        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
        worker.attachToDocument(session.getDocument());
        worker.on("annotate", function(results) {
          session.setAnnotations(results.data);
        });
        worker.on("terminate", function() {
          session.clearAnnotations();
        });
        return worker;
      };
      this.$id = "ace/mode/javascript";
      this.snippetFileId = "ace/snippets/javascript";
    }).call(Mode.prototype);
    exports3.Mode = Mode;
  });
  (function() {
    ace.require(["ace/mode/javascript"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(modeJavascript);
var themeMonokai = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/theme/monokai-css", ["require", "exports", "module"], function(require2, exports3, module3) {
    module3.exports = ".ace-monokai .ace_gutter {\n  background: #2F3129;\n  color: #8F908A\n}\n\n.ace-monokai .ace_print-margin {\n  width: 1px;\n  background: #555651\n}\n\n.ace-monokai {\n  background-color: #272822;\n  color: #F8F8F2\n}\n\n.ace-monokai .ace_cursor {\n  color: #F8F8F0\n}\n\n.ace-monokai .ace_marker-layer .ace_selection {\n  background: #49483E\n}\n\n.ace-monokai.ace_multiselect .ace_selection.ace_start {\n  box-shadow: 0 0 3px 0px #272822;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n  background: rgb(102, 82, 0)\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n  margin: -1px 0 0 -1px;\n  border: 1px solid #49483E\n}\n\n.ace-monokai .ace_marker-layer .ace_active-line {\n  background: #202020\n}\n\n.ace-monokai .ace_gutter-active-line {\n  background-color: #272727\n}\n\n.ace-monokai .ace_marker-layer .ace_selected-word {\n  border: 1px solid #49483E\n}\n\n.ace-monokai .ace_invisible {\n  color: #52524d\n}\n\n.ace-monokai .ace_entity.ace_name.ace_tag,\n.ace-monokai .ace_keyword,\n.ace-monokai .ace_meta.ace_tag,\n.ace-monokai .ace_storage {\n  color: #F92672\n}\n\n.ace-monokai .ace_punctuation,\n.ace-monokai .ace_punctuation.ace_tag {\n  color: #fff\n}\n\n.ace-monokai .ace_constant.ace_character,\n.ace-monokai .ace_constant.ace_language,\n.ace-monokai .ace_constant.ace_numeric,\n.ace-monokai .ace_constant.ace_other {\n  color: #AE81FF\n}\n\n.ace-monokai .ace_invalid {\n  color: #F8F8F0;\n  background-color: #F92672\n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n  color: #F8F8F0;\n  background-color: #AE81FF\n}\n\n.ace-monokai .ace_support.ace_constant,\n.ace-monokai .ace_support.ace_function {\n  color: #66D9EF\n}\n\n.ace-monokai .ace_fold {\n  background-color: #A6E22E;\n  border-color: #F8F8F2\n}\n\n.ace-monokai .ace_storage.ace_type,\n.ace-monokai .ace_support.ace_class,\n.ace-monokai .ace_support.ace_type {\n  font-style: italic;\n  color: #66D9EF\n}\n\n.ace-monokai .ace_entity.ace_name.ace_function,\n.ace-monokai .ace_entity.ace_other,\n.ace-monokai .ace_entity.ace_other.ace_attribute-name,\n.ace-monokai .ace_variable {\n  color: #A6E22E\n}\n\n.ace-monokai .ace_variable.ace_parameter {\n  font-style: italic;\n  color: #FD971F\n}\n\n.ace-monokai .ace_string {\n  color: #E6DB74\n}\n\n.ace-monokai .ace_comment {\n  color: #75715E\n}\n\n.ace-monokai .ace_indent-guide {\n  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\n}\n\n.ace-monokai .ace_indent-guide-active {\n  background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;\n}\n";
  });
  ace.define("ace/theme/monokai", ["require", "exports", "module", "ace/theme/monokai-css", "ace/lib/dom"], function(require2, exports3, module3) {
    exports3.isDark = true;
    exports3.cssClass = "ace-monokai";
    exports3.cssText = require2("./monokai-css");
    var dom = require2("../lib/dom");
    dom.importCssString(exports3.cssText, exports3.cssClass, false);
  });
  (function() {
    ace.require(["ace/theme/monokai"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(themeMonokai);
var extLanguage_tools = { exports: {} };
(function(module2, exports2) {
  ace.define("ace/snippets", ["require", "exports", "module", "ace/lib/dom", "ace/lib/oop", "ace/lib/event_emitter", "ace/lib/lang", "ace/range", "ace/range_list", "ace/keyboard/hash_handler", "ace/tokenizer", "ace/clipboard", "ace/editor"], function(require2, exports3, module3) {
    var dom = require2("./lib/dom");
    var oop = require2("./lib/oop");
    var EventEmitter2 = require2("./lib/event_emitter").EventEmitter;
    var lang2 = require2("./lib/lang");
    var Range = require2("./range").Range;
    var RangeList = require2("./range_list").RangeList;
    var HashHandler = require2("./keyboard/hash_handler").HashHandler;
    var Tokenizer = require2("./tokenizer").Tokenizer;
    var clipboard = require2("./clipboard");
    var VARIABLES = {
      CURRENT_WORD: function(editor) {
        return editor.session.getTextRange(editor.session.getWordRange());
      },
      SELECTION: function(editor, name2, indentation) {
        var text2 = editor.session.getTextRange();
        if (indentation)
          return text2.replace(/\n\r?([ \t]*\S)/g, "\n" + indentation + "$1");
        return text2;
      },
      CURRENT_LINE: function(editor) {
        return editor.session.getLine(editor.getCursorPosition().row);
      },
      PREV_LINE: function(editor) {
        return editor.session.getLine(editor.getCursorPosition().row - 1);
      },
      LINE_INDEX: function(editor) {
        return editor.getCursorPosition().row;
      },
      LINE_NUMBER: function(editor) {
        return editor.getCursorPosition().row + 1;
      },
      SOFT_TABS: function(editor) {
        return editor.session.getUseSoftTabs() ? "YES" : "NO";
      },
      TAB_SIZE: function(editor) {
        return editor.session.getTabSize();
      },
      CLIPBOARD: function(editor) {
        return clipboard.getText && clipboard.getText();
      },
      FILENAME: function(editor) {
        return /[^/\\]*$/.exec(this.FILEPATH(editor))[0];
      },
      FILENAME_BASE: function(editor) {
        return /[^/\\]*$/.exec(this.FILEPATH(editor))[0].replace(/\.[^.]*$/, "");
      },
      DIRECTORY: function(editor) {
        return this.FILEPATH(editor).replace(/[^/\\]*$/, "");
      },
      FILEPATH: function(editor) {
        return "/not implemented.txt";
      },
      WORKSPACE_NAME: function() {
        return "Unknown";
      },
      FULLNAME: function() {
        return "Unknown";
      },
      BLOCK_COMMENT_START: function(editor) {
        var mode = editor.session.$mode || {};
        return mode.blockComment && mode.blockComment.start || "";
      },
      BLOCK_COMMENT_END: function(editor) {
        var mode = editor.session.$mode || {};
        return mode.blockComment && mode.blockComment.end || "";
      },
      LINE_COMMENT: function(editor) {
        var mode = editor.session.$mode || {};
        return mode.lineCommentStart || "";
      },
      CURRENT_YEAR: date4.bind(null, { year: "numeric" }),
      CURRENT_YEAR_SHORT: date4.bind(null, { year: "2-digit" }),
      CURRENT_MONTH: date4.bind(null, { month: "numeric" }),
      CURRENT_MONTH_NAME: date4.bind(null, { month: "long" }),
      CURRENT_MONTH_NAME_SHORT: date4.bind(null, { month: "short" }),
      CURRENT_DATE: date4.bind(null, { day: "2-digit" }),
      CURRENT_DAY_NAME: date4.bind(null, { weekday: "long" }),
      CURRENT_DAY_NAME_SHORT: date4.bind(null, { weekday: "short" }),
      CURRENT_HOUR: date4.bind(null, { hour: "2-digit", hour12: false }),
      CURRENT_MINUTE: date4.bind(null, { minute: "2-digit" }),
      CURRENT_SECOND: date4.bind(null, { second: "2-digit" })
    };
    VARIABLES.SELECTED_TEXT = VARIABLES.SELECTION;
    function date4(dateFormat) {
      var str = (/* @__PURE__ */ new Date()).toLocaleString("en-us", dateFormat);
      return str.length == 1 ? "0" + str : str;
    }
    var SnippetManager = (
      /** @class */
      function() {
        function SnippetManager2() {
          this.snippetMap = {};
          this.snippetNameMap = {};
          this.variables = VARIABLES;
        }
        SnippetManager2.prototype.getTokenizer = function() {
          return SnippetManager2["$tokenizer"] || this.createTokenizer();
        };
        SnippetManager2.prototype.createTokenizer = function() {
          function TabstopToken(str) {
            str = str.substr(1);
            if (/^\d+$/.test(str))
              return [{ tabstopId: parseInt(str, 10) }];
            return [{ text: str }];
          }
          function escape2(ch2) {
            return "(?:[^\\\\" + ch2 + "]|\\\\.)";
          }
          var formatMatcher = {
            regex: "/(" + escape2("/") + "+)/",
            onMatch: function(val, state, stack) {
              var ts = stack[0];
              ts.fmtString = true;
              ts.guard = val.slice(1, -1);
              ts.flag = "";
              return "";
            },
            next: "formatString"
          };
          SnippetManager2["$tokenizer"] = new Tokenizer({
            start: [
              { regex: /\\./, onMatch: function(val, state, stack) {
                var ch2 = val[1];
                if (ch2 == "}" && stack.length) {
                  val = ch2;
                } else if ("`$\\".indexOf(ch2) != -1) {
                  val = ch2;
                }
                return [val];
              } },
              { regex: /}/, onMatch: function(val, state, stack) {
                return [stack.length ? stack.shift() : val];
              } },
              { regex: /\$(?:\d+|\w+)/, onMatch: TabstopToken },
              { regex: /\$\{[\dA-Z_a-z]+/, onMatch: function(str, state, stack) {
                var t2 = TabstopToken(str.substr(1));
                stack.unshift(t2[0]);
                return t2;
              }, next: "snippetVar" },
              { regex: /\n/, token: "newline", merge: false }
            ],
            snippetVar: [
              { regex: "\\|" + escape2("\\|") + "*\\|", onMatch: function(val, state, stack) {
                var choices = val.slice(1, -1).replace(/\\[,|\\]|,/g, function(operator) {
                  return operator.length == 2 ? operator[1] : "\0";
                }).split("\0").map(function(value2) {
                  return { value: value2 };
                });
                stack[0].choices = choices;
                return [choices[0]];
              }, next: "start" },
              formatMatcher,
              { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "start" }
            ],
            formatString: [
              { regex: /:/, onMatch: function(val, state, stack) {
                if (stack.length && stack[0].expectElse) {
                  stack[0].expectElse = false;
                  stack[0].ifEnd = { elseEnd: stack[0] };
                  return [stack[0].ifEnd];
                }
                return ":";
              } },
              { regex: /\\./, onMatch: function(val, state, stack) {
                var ch2 = val[1];
                if (ch2 == "}" && stack.length)
                  val = ch2;
                else if ("`$\\".indexOf(ch2) != -1)
                  val = ch2;
                else if (ch2 == "n")
                  val = "\n";
                else if (ch2 == "t")
                  val = "	";
                else if ("ulULE".indexOf(ch2) != -1)
                  val = { changeCase: ch2, local: ch2 > "a" };
                return [val];
              } },
              { regex: "/\\w*}", onMatch: function(val, state, stack) {
                var next2 = stack.shift();
                if (next2)
                  next2.flag = val.slice(1, -1);
                this.next = next2 && next2.tabstopId ? "start" : "";
                return [next2 || val];
              }, next: "start" },
              { regex: /\$(?:\d+|\w+)/, onMatch: function(val, state, stack) {
                return [{ text: val.slice(1) }];
              } },
              { regex: /\${\w+/, onMatch: function(val, state, stack) {
                var token2 = { text: val.slice(2) };
                stack.unshift(token2);
                return [token2];
              }, next: "formatStringVar" },
              { regex: /\n/, token: "newline", merge: false },
              { regex: /}/, onMatch: function(val, state, stack) {
                var next2 = stack.shift();
                this.next = next2 && next2.tabstopId ? "start" : "";
                return [next2 || val];
              }, next: "start" }
            ],
            formatStringVar: [
              { regex: /:\/\w+}/, onMatch: function(val, state, stack) {
                var ts = stack[0];
                ts.formatFunction = val.slice(2, -1);
                return [stack.shift()];
              }, next: "formatString" },
              formatMatcher,
              { regex: /:[\?\-+]?/, onMatch: function(val, state, stack) {
                if (val[1] == "+")
                  stack[0].ifEnd = stack[0];
                if (val[1] == "?")
                  stack[0].expectElse = true;
              }, next: "formatString" },
              { regex: "([^:}\\\\]|\\\\.)*:?", token: "", next: "formatString" }
            ]
          });
          return SnippetManager2["$tokenizer"];
        };
        SnippetManager2.prototype.tokenizeTmSnippet = function(str, startState) {
          return this.getTokenizer().getLineTokens(str, startState).tokens.map(function(x2) {
            return x2.value || x2;
          });
        };
        SnippetManager2.prototype.getVariableValue = function(editor, name2, indentation) {
          if (/^\d+$/.test(name2))
            return (this.variables.__ || {})[name2] || "";
          if (/^[A-Z]\d+$/.test(name2))
            return (this.variables[name2[0] + "__"] || {})[name2.substr(1)] || "";
          name2 = name2.replace(/^TM_/, "");
          if (!this.variables.hasOwnProperty(name2))
            return "";
          var value2 = this.variables[name2];
          if (typeof value2 == "function")
            value2 = this.variables[name2](editor, name2, indentation);
          return value2 == null ? "" : value2;
        };
        SnippetManager2.prototype.tmStrFormat = function(str, ch2, editor) {
          if (!ch2.fmt)
            return str;
          var flag = ch2.flag || "";
          var re2 = ch2.guard;
          re2 = new RegExp(re2, flag.replace(/[^gim]/g, ""));
          var fmtTokens = typeof ch2.fmt == "string" ? this.tokenizeTmSnippet(ch2.fmt, "formatString") : ch2.fmt;
          var _self = this;
          var formatted = str.replace(re2, function() {
            var oldArgs = _self.variables.__;
            _self.variables.__ = [].slice.call(arguments);
            var fmtParts = _self.resolveVariables(fmtTokens, editor);
            var gChangeCase = "E";
            for (var i2 = 0; i2 < fmtParts.length; i2++) {
              var ch3 = fmtParts[i2];
              if (typeof ch3 == "object") {
                fmtParts[i2] = "";
                if (ch3.changeCase && ch3.local) {
                  var next2 = fmtParts[i2 + 1];
                  if (next2 && typeof next2 == "string") {
                    if (ch3.changeCase == "u")
                      fmtParts[i2] = next2[0].toUpperCase();
                    else
                      fmtParts[i2] = next2[0].toLowerCase();
                    fmtParts[i2 + 1] = next2.substr(1);
                  }
                } else if (ch3.changeCase) {
                  gChangeCase = ch3.changeCase;
                }
              } else if (gChangeCase == "U") {
                fmtParts[i2] = ch3.toUpperCase();
              } else if (gChangeCase == "L") {
                fmtParts[i2] = ch3.toLowerCase();
              }
            }
            _self.variables.__ = oldArgs;
            return fmtParts.join("");
          });
          return formatted;
        };
        SnippetManager2.prototype.tmFormatFunction = function(str, ch2, editor) {
          if (ch2.formatFunction == "upcase")
            return str.toUpperCase();
          if (ch2.formatFunction == "downcase")
            return str.toLowerCase();
          return str;
        };
        SnippetManager2.prototype.resolveVariables = function(snippet2, editor) {
          var result = [];
          var indentation = "";
          var afterNewLine = true;
          for (var i2 = 0; i2 < snippet2.length; i2++) {
            var ch2 = snippet2[i2];
            if (typeof ch2 == "string") {
              result.push(ch2);
              if (ch2 == "\n") {
                afterNewLine = true;
                indentation = "";
              } else if (afterNewLine) {
                indentation = /^\t*/.exec(ch2)[0];
                afterNewLine = /\S/.test(ch2);
              }
              continue;
            }
            if (!ch2)
              continue;
            afterNewLine = false;
            if (ch2.fmtString) {
              var j2 = snippet2.indexOf(ch2, i2 + 1);
              if (j2 == -1)
                j2 = snippet2.length;
              ch2.fmt = snippet2.slice(i2 + 1, j2);
              i2 = j2;
            }
            if (ch2.text) {
              var value2 = this.getVariableValue(editor, ch2.text, indentation) + "";
              if (ch2.fmtString)
                value2 = this.tmStrFormat(value2, ch2, editor);
              if (ch2.formatFunction)
                value2 = this.tmFormatFunction(value2, ch2, editor);
              if (value2 && !ch2.ifEnd) {
                result.push(value2);
                gotoNext(ch2);
              } else if (!value2 && ch2.ifEnd) {
                gotoNext(ch2.ifEnd);
              }
            } else if (ch2.elseEnd) {
              gotoNext(ch2.elseEnd);
            } else if (ch2.tabstopId != null) {
              result.push(ch2);
            } else if (ch2.changeCase != null) {
              result.push(ch2);
            }
          }
          function gotoNext(ch3) {
            var i1 = snippet2.indexOf(ch3, i2 + 1);
            if (i1 != -1)
              i2 = i1;
          }
          return result;
        };
        SnippetManager2.prototype.getDisplayTextForSnippet = function(editor, snippetText) {
          var processedSnippet = processSnippetText.call(this, editor, snippetText);
          return processedSnippet.text;
        };
        SnippetManager2.prototype.insertSnippetForSelection = function(editor, snippetText, options) {
          if (options === void 0) {
            options = {};
          }
          var processedSnippet = processSnippetText.call(this, editor, snippetText, options);
          var range3 = editor.getSelectionRange();
          var end = editor.session.replace(range3, processedSnippet.text);
          var tabstopManager = new TabstopManager(editor);
          var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
          tabstopManager.addTabstops(processedSnippet.tabstops, range3.start, end, selectionId);
        };
        SnippetManager2.prototype.insertSnippet = function(editor, snippetText, options) {
          if (options === void 0) {
            options = {};
          }
          var self2 = this;
          if (editor.inVirtualSelectionMode)
            return self2.insertSnippetForSelection(editor, snippetText, options);
          editor.forEachSelection(function() {
            self2.insertSnippetForSelection(editor, snippetText, options);
          }, null, { keepOrder: true });
          if (editor.tabstopManager)
            editor.tabstopManager.tabNext();
        };
        SnippetManager2.prototype.$getScope = function(editor) {
          var scope = editor.session.$mode.$id || "";
          scope = scope.split("/").pop();
          if (scope === "html" || scope === "php") {
            if (scope === "php" && !editor.session.$mode.inlinePhp)
              scope = "html";
            var c2 = editor.getCursorPosition();
            var state = editor.session.getState(c2.row);
            if (typeof state === "object") {
              state = state[0];
            }
            if (state.substring) {
              if (state.substring(0, 3) == "js-")
                scope = "javascript";
              else if (state.substring(0, 4) == "css-")
                scope = "css";
              else if (state.substring(0, 4) == "php-")
                scope = "php";
            }
          }
          return scope;
        };
        SnippetManager2.prototype.getActiveScopes = function(editor) {
          var scope = this.$getScope(editor);
          var scopes = [scope];
          var snippetMap = this.snippetMap;
          if (snippetMap[scope] && snippetMap[scope].includeScopes) {
            scopes.push.apply(scopes, snippetMap[scope].includeScopes);
          }
          scopes.push("_");
          return scopes;
        };
        SnippetManager2.prototype.expandWithTab = function(editor, options) {
          var self2 = this;
          var result = editor.forEachSelection(function() {
            return self2.expandSnippetForSelection(editor, options);
          }, null, { keepOrder: true });
          if (result && editor.tabstopManager)
            editor.tabstopManager.tabNext();
          return result;
        };
        SnippetManager2.prototype.expandSnippetForSelection = function(editor, options) {
          var cursor = editor.getCursorPosition();
          var line2 = editor.session.getLine(cursor.row);
          var before = line2.substring(0, cursor.column);
          var after = line2.substr(cursor.column);
          var snippetMap = this.snippetMap;
          var snippet2;
          this.getActiveScopes(editor).some(function(scope) {
            var snippets = snippetMap[scope];
            if (snippets)
              snippet2 = this.findMatchingSnippet(snippets, before, after);
            return !!snippet2;
          }, this);
          if (!snippet2)
            return false;
          if (options && options.dryRun)
            return true;
          editor.session.doc.removeInLine(cursor.row, cursor.column - snippet2.replaceBefore.length, cursor.column + snippet2.replaceAfter.length);
          this.variables.M__ = snippet2.matchBefore;
          this.variables.T__ = snippet2.matchAfter;
          this.insertSnippetForSelection(editor, snippet2.content);
          this.variables.M__ = this.variables.T__ = null;
          return true;
        };
        SnippetManager2.prototype.findMatchingSnippet = function(snippetList, before, after) {
          for (var i2 = snippetList.length; i2--; ) {
            var s2 = snippetList[i2];
            if (s2.startRe && !s2.startRe.test(before))
              continue;
            if (s2.endRe && !s2.endRe.test(after))
              continue;
            if (!s2.startRe && !s2.endRe)
              continue;
            s2.matchBefore = s2.startRe ? s2.startRe.exec(before) : [""];
            s2.matchAfter = s2.endRe ? s2.endRe.exec(after) : [""];
            s2.replaceBefore = s2.triggerRe ? s2.triggerRe.exec(before)[0] : "";
            s2.replaceAfter = s2.endTriggerRe ? s2.endTriggerRe.exec(after)[0] : "";
            return s2;
          }
        };
        SnippetManager2.prototype.register = function(snippets, scope) {
          var snippetMap = this.snippetMap;
          var snippetNameMap = this.snippetNameMap;
          var self2 = this;
          if (!snippets)
            snippets = [];
          function wrapRegexp(src) {
            if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
              src = "(?:" + src + ")";
            return src || "";
          }
          function guardedRegexp(re2, guard, opening) {
            re2 = wrapRegexp(re2);
            guard = wrapRegexp(guard);
            {
              re2 = guard + re2;
              if (re2 && re2[re2.length - 1] != "$")
                re2 = re2 + "$";
            }
            return new RegExp(re2);
          }
          function addSnippet(s2) {
            if (!s2.scope)
              s2.scope = scope || "_";
            scope = s2.scope;
            if (!snippetMap[scope]) {
              snippetMap[scope] = [];
              snippetNameMap[scope] = {};
            }
            var map2 = snippetNameMap[scope];
            if (s2.name) {
              var old = map2[s2.name];
              if (old)
                self2.unregister(old);
              map2[s2.name] = s2;
            }
            snippetMap[scope].push(s2);
            if (s2.prefix)
              s2.tabTrigger = s2.prefix;
            if (!s2.content && s2.body)
              s2.content = Array.isArray(s2.body) ? s2.body.join("\n") : s2.body;
            if (s2.tabTrigger && !s2.trigger) {
              if (!s2.guard && /^\w/.test(s2.tabTrigger))
                s2.guard = "\\b";
              s2.trigger = lang2.escapeRegExp(s2.tabTrigger);
            }
            if (!s2.trigger && !s2.guard && !s2.endTrigger && !s2.endGuard)
              return;
            s2.startRe = guardedRegexp(s2.trigger, s2.guard);
            s2.triggerRe = new RegExp(s2.trigger);
            s2.endRe = guardedRegexp(s2.endTrigger, s2.endGuard);
            s2.endTriggerRe = new RegExp(s2.endTrigger);
          }
          if (Array.isArray(snippets)) {
            snippets.forEach(addSnippet);
          } else {
            Object.keys(snippets).forEach(function(key) {
              addSnippet(snippets[key]);
            });
          }
          this._signal("registerSnippets", { scope });
        };
        SnippetManager2.prototype.unregister = function(snippets, scope) {
          var snippetMap = this.snippetMap;
          var snippetNameMap = this.snippetNameMap;
          function removeSnippet(s2) {
            var nameMap = snippetNameMap[s2.scope || scope];
            if (nameMap && nameMap[s2.name]) {
              delete nameMap[s2.name];
              var map2 = snippetMap[s2.scope || scope];
              var i2 = map2 && map2.indexOf(s2);
              if (i2 >= 0)
                map2.splice(i2, 1);
            }
          }
          if (snippets.content)
            removeSnippet(snippets);
          else if (Array.isArray(snippets))
            snippets.forEach(removeSnippet);
        };
        SnippetManager2.prototype.parseSnippetFile = function(str) {
          str = str.replace(/\r/g, "");
          var list2 = [], snippet2 = {};
          var re2 = /^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm;
          var m2;
          while (m2 = re2.exec(str)) {
            if (m2[1]) {
              try {
                snippet2 = JSON.parse(m2[1]);
                list2.push(snippet2);
              } catch (e2) {
              }
            }
            if (m2[4]) {
              snippet2.content = m2[4].replace(/^\t/gm, "");
              list2.push(snippet2);
              snippet2 = {};
            } else {
              var key = m2[2], val = m2[3];
              if (key == "regex") {
                var guardRe = /\/((?:[^\/\\]|\\.)*)|$/g;
                snippet2.guard = guardRe.exec(val)[1];
                snippet2.trigger = guardRe.exec(val)[1];
                snippet2.endTrigger = guardRe.exec(val)[1];
                snippet2.endGuard = guardRe.exec(val)[1];
              } else if (key == "snippet") {
                snippet2.tabTrigger = val.match(/^\S*/)[0];
                if (!snippet2.name)
                  snippet2.name = val;
              } else if (key) {
                snippet2[key] = val;
              }
            }
          }
          return list2;
        };
        SnippetManager2.prototype.getSnippetByName = function(name2, editor) {
          var snippetMap = this.snippetNameMap;
          var snippet2;
          this.getActiveScopes(editor).some(function(scope) {
            var snippets = snippetMap[scope];
            if (snippets)
              snippet2 = snippets[name2];
            return !!snippet2;
          }, this);
          return snippet2;
        };
        return SnippetManager2;
      }()
    );
    oop.implement(SnippetManager.prototype, EventEmitter2);
    var processSnippetText = function(editor, snippetText, options) {
      if (options === void 0) {
        options = {};
      }
      var cursor = editor.getCursorPosition();
      var line2 = editor.session.getLine(cursor.row);
      var tabString = editor.session.getTabString();
      var indentString = line2.match(/^\s*/)[0];
      if (cursor.column < indentString.length)
        indentString = indentString.slice(0, cursor.column);
      snippetText = snippetText.replace(/\r/g, "");
      var tokens2 = this.tokenizeTmSnippet(snippetText);
      tokens2 = this.resolveVariables(tokens2, editor);
      tokens2 = tokens2.map(function(x2) {
        if (x2 == "\n" && !options.excludeExtraIndent)
          return x2 + indentString;
        if (typeof x2 == "string")
          return x2.replace(/\t/g, tabString);
        return x2;
      });
      var tabstops = [];
      tokens2.forEach(function(p3, i3) {
        if (typeof p3 != "object")
          return;
        var id3 = p3.tabstopId;
        var ts2 = tabstops[id3];
        if (!ts2) {
          ts2 = tabstops[id3] = [];
          ts2.index = id3;
          ts2.value = "";
          ts2.parents = {};
        }
        if (ts2.indexOf(p3) !== -1)
          return;
        if (p3.choices && !ts2.choices)
          ts2.choices = p3.choices;
        ts2.push(p3);
        var i12 = tokens2.indexOf(p3, i3 + 1);
        if (i12 === -1)
          return;
        var value3 = tokens2.slice(i3 + 1, i12);
        var isNested = value3.some(function(t2) {
          return typeof t2 === "object";
        });
        if (isNested && !ts2.value) {
          ts2.value = value3;
        } else if (value3.length && (!ts2.value || typeof ts2.value !== "string")) {
          ts2.value = value3.join("");
        }
      });
      tabstops.forEach(function(ts2) {
        ts2.length = 0;
      });
      var expanding = {};
      function copyValue(val) {
        var copy2 = [];
        for (var i3 = 0; i3 < val.length; i3++) {
          var p3 = val[i3];
          if (typeof p3 == "object") {
            if (expanding[p3.tabstopId])
              continue;
            var j2 = val.lastIndexOf(p3, i3 - 1);
            p3 = copy2[j2] || { tabstopId: p3.tabstopId };
          }
          copy2[i3] = p3;
        }
        return copy2;
      }
      for (var i2 = 0; i2 < tokens2.length; i2++) {
        var p2 = tokens2[i2];
        if (typeof p2 != "object")
          continue;
        var id2 = p2.tabstopId;
        var ts = tabstops[id2];
        var i1 = tokens2.indexOf(p2, i2 + 1);
        if (expanding[id2]) {
          if (expanding[id2] === p2) {
            delete expanding[id2];
            Object.keys(expanding).forEach(function(parentId) {
              ts.parents[parentId] = true;
            });
          }
          continue;
        }
        expanding[id2] = p2;
        var value2 = ts.value;
        if (typeof value2 !== "string")
          value2 = copyValue(value2);
        else if (p2.fmt)
          value2 = this.tmStrFormat(value2, p2, editor);
        tokens2.splice.apply(tokens2, [i2 + 1, Math.max(0, i1 - i2)].concat(value2, p2));
        if (ts.indexOf(p2) === -1)
          ts.push(p2);
      }
      var row = 0, column2 = 0;
      var text2 = "";
      tokens2.forEach(function(t2) {
        if (typeof t2 === "string") {
          var lines = t2.split("\n");
          if (lines.length > 1) {
            column2 = lines[lines.length - 1].length;
            row += lines.length - 1;
          } else
            column2 += t2.length;
          text2 += t2;
        } else if (t2) {
          if (!t2.start)
            t2.start = { row, column: column2 };
          else
            t2.end = { row, column: column2 };
        }
      });
      return {
        text: text2,
        tabstops,
        tokens: tokens2
      };
    };
    var TabstopManager = (
      /** @class */
      function() {
        function TabstopManager2(editor) {
          this.index = 0;
          this.ranges = [];
          this.tabstops = [];
          if (editor.tabstopManager)
            return editor.tabstopManager;
          editor.tabstopManager = this;
          this.$onChange = this.onChange.bind(this);
          this.$onChangeSelection = lang2.delayedCall(this.onChangeSelection.bind(this)).schedule;
          this.$onChangeSession = this.onChangeSession.bind(this);
          this.$onAfterExec = this.onAfterExec.bind(this);
          this.attach(editor);
        }
        TabstopManager2.prototype.attach = function(editor) {
          this.$openTabstops = null;
          this.selectedTabstop = null;
          this.editor = editor;
          this.session = editor.session;
          this.editor.on("change", this.$onChange);
          this.editor.on("changeSelection", this.$onChangeSelection);
          this.editor.on("changeSession", this.$onChangeSession);
          this.editor.commands.on("afterExec", this.$onAfterExec);
          this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
        };
        TabstopManager2.prototype.detach = function() {
          this.tabstops.forEach(this.removeTabstopMarkers, this);
          this.ranges.length = 0;
          this.tabstops.length = 0;
          this.selectedTabstop = null;
          this.editor.off("change", this.$onChange);
          this.editor.off("changeSelection", this.$onChangeSelection);
          this.editor.off("changeSession", this.$onChangeSession);
          this.editor.commands.off("afterExec", this.$onAfterExec);
          this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
          this.editor.tabstopManager = null;
          this.session = null;
          this.editor = null;
        };
        TabstopManager2.prototype.onChange = function(delta) {
          var isRemove = delta.action[0] == "r";
          var selectedTabstop = this.selectedTabstop || {};
          var parents = selectedTabstop.parents || {};
          var tabstops = this.tabstops.slice();
          for (var i2 = 0; i2 < tabstops.length; i2++) {
            var ts = tabstops[i2];
            var active3 = ts == selectedTabstop || parents[ts.index];
            ts.rangeList.$bias = active3 ? 0 : 1;
            if (delta.action == "remove" && ts !== selectedTabstop) {
              var parentActive = ts.parents && ts.parents[selectedTabstop.index];
              var startIndex = ts.rangeList.pointIndex(delta.start, parentActive);
              startIndex = startIndex < 0 ? -startIndex - 1 : startIndex + 1;
              var endIndex = ts.rangeList.pointIndex(delta.end, parentActive);
              endIndex = endIndex < 0 ? -endIndex - 1 : endIndex - 1;
              var toRemove = ts.rangeList.ranges.slice(startIndex, endIndex);
              for (var j2 = 0; j2 < toRemove.length; j2++)
                this.removeRange(toRemove[j2]);
            }
            ts.rangeList.$onChange(delta);
          }
          var session = this.session;
          if (!this.$inChange && isRemove && session.getLength() == 1 && !session.getValue())
            this.detach();
        };
        TabstopManager2.prototype.updateLinkedFields = function() {
          var ts = this.selectedTabstop;
          if (!ts || !ts.hasLinkedRanges || !ts.firstNonLinked)
            return;
          this.$inChange = true;
          var session = this.session;
          var text2 = session.getTextRange(ts.firstNonLinked);
          for (var i2 = 0; i2 < ts.length; i2++) {
            var range3 = ts[i2];
            if (!range3.linked)
              continue;
            var original = range3.original;
            var fmt = exports3.snippetManager.tmStrFormat(text2, original, this.editor);
            session.replace(range3, fmt);
          }
          this.$inChange = false;
        };
        TabstopManager2.prototype.onAfterExec = function(e2) {
          if (e2.command && !e2.command.readOnly)
            this.updateLinkedFields();
        };
        TabstopManager2.prototype.onChangeSelection = function() {
          if (!this.editor)
            return;
          var lead = this.editor.selection.lead;
          var anchor = this.editor.selection.anchor;
          var isEmpty2 = this.editor.selection.isEmpty();
          for (var i2 = 0; i2 < this.ranges.length; i2++) {
            if (this.ranges[i2].linked)
              continue;
            var containsLead = this.ranges[i2].contains(lead.row, lead.column);
            var containsAnchor = isEmpty2 || this.ranges[i2].contains(anchor.row, anchor.column);
            if (containsLead && containsAnchor)
              return;
          }
          this.detach();
        };
        TabstopManager2.prototype.onChangeSession = function() {
          this.detach();
        };
        TabstopManager2.prototype.tabNext = function(dir) {
          var max2 = this.tabstops.length;
          var index2 = this.index + (dir || 1);
          index2 = Math.min(Math.max(index2, 1), max2);
          if (index2 == max2)
            index2 = 0;
          this.selectTabstop(index2);
          this.updateTabstopMarkers();
          if (index2 === 0) {
            this.detach();
          }
        };
        TabstopManager2.prototype.selectTabstop = function(index2) {
          this.$openTabstops = null;
          var ts = this.tabstops[this.index];
          if (ts)
            this.addTabstopMarkers(ts);
          this.index = index2;
          ts = this.tabstops[this.index];
          if (!ts || !ts.length)
            return;
          this.selectedTabstop = ts;
          var range3 = ts.firstNonLinked || ts;
          if (ts.choices)
            range3.cursor = range3.start;
          if (!this.editor.inVirtualSelectionMode) {
            var sel = this.editor.multiSelect;
            sel.toSingleRange(range3);
            for (var i2 = 0; i2 < ts.length; i2++) {
              if (ts.hasLinkedRanges && ts[i2].linked)
                continue;
              sel.addRange(ts[i2].clone(), true);
            }
          } else {
            this.editor.selection.fromOrientedRange(range3);
          }
          this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
          if (this.selectedTabstop && this.selectedTabstop.choices)
            this.editor.execCommand("startAutocomplete", { matches: this.selectedTabstop.choices });
        };
        TabstopManager2.prototype.addTabstops = function(tabstops, start, end) {
          var useLink2 = this.useLink || !this.editor.getOption("enableMultiselect");
          if (!this.$openTabstops)
            this.$openTabstops = [];
          if (!tabstops[0]) {
            var p2 = Range.fromPoints(end, end);
            moveRelative(p2.start, start);
            moveRelative(p2.end, start);
            tabstops[0] = [p2];
            tabstops[0].index = 0;
          }
          var i2 = this.index;
          var arg = [i2 + 1, 0];
          var ranges = this.ranges;
          var snippetId = this.snippetId = (this.snippetId || 0) + 1;
          tabstops.forEach(function(ts, index2) {
            var dest = this.$openTabstops[index2] || ts;
            dest.snippetId = snippetId;
            for (var i3 = 0; i3 < ts.length; i3++) {
              var p3 = ts[i3];
              var range3 = Range.fromPoints(p3.start, p3.end || p3.start);
              movePoint2(range3.start, start);
              movePoint2(range3.end, start);
              range3.original = p3;
              range3.tabstop = dest;
              ranges.push(range3);
              if (dest != ts)
                dest.unshift(range3);
              else
                dest[i3] = range3;
              if (p3.fmtString || dest.firstNonLinked && useLink2) {
                range3.linked = true;
                dest.hasLinkedRanges = true;
              } else if (!dest.firstNonLinked)
                dest.firstNonLinked = range3;
            }
            if (!dest.firstNonLinked)
              dest.hasLinkedRanges = false;
            if (dest === ts) {
              arg.push(dest);
              this.$openTabstops[index2] = dest;
            }
            this.addTabstopMarkers(dest);
            dest.rangeList = dest.rangeList || new RangeList();
            dest.rangeList.$bias = 0;
            dest.rangeList.addList(dest);
          }, this);
          if (arg.length > 2) {
            if (this.tabstops.length)
              arg.push(arg.splice(2, 1)[0]);
            this.tabstops.splice.apply(this.tabstops, arg);
          }
        };
        TabstopManager2.prototype.addTabstopMarkers = function(ts) {
          var session = this.session;
          ts.forEach(function(range3) {
            if (!range3.markerId)
              range3.markerId = session.addMarker(range3, "ace_snippet-marker", "text");
          });
        };
        TabstopManager2.prototype.removeTabstopMarkers = function(ts) {
          var session = this.session;
          ts.forEach(function(range3) {
            session.removeMarker(range3.markerId);
            range3.markerId = null;
          });
        };
        TabstopManager2.prototype.updateTabstopMarkers = function() {
          if (!this.selectedTabstop)
            return;
          var currentSnippetId = this.selectedTabstop.snippetId;
          if (this.selectedTabstop.index === 0) {
            currentSnippetId--;
          }
          this.tabstops.forEach(function(ts) {
            if (ts.snippetId === currentSnippetId)
              this.addTabstopMarkers(ts);
            else
              this.removeTabstopMarkers(ts);
          }, this);
        };
        TabstopManager2.prototype.removeRange = function(range3) {
          var i2 = range3.tabstop.indexOf(range3);
          if (i2 != -1)
            range3.tabstop.splice(i2, 1);
          i2 = this.ranges.indexOf(range3);
          if (i2 != -1)
            this.ranges.splice(i2, 1);
          i2 = range3.tabstop.rangeList.ranges.indexOf(range3);
          if (i2 != -1)
            range3.tabstop.splice(i2, 1);
          this.session.removeMarker(range3.markerId);
          if (!range3.tabstop.length) {
            i2 = this.tabstops.indexOf(range3.tabstop);
            if (i2 != -1)
              this.tabstops.splice(i2, 1);
            if (!this.tabstops.length)
              this.detach();
          }
        };
        return TabstopManager2;
      }()
    );
    TabstopManager.prototype.keyboardHandler = new HashHandler();
    TabstopManager.prototype.keyboardHandler.bindKeys({
      "Tab": function(editor) {
        if (exports3.snippetManager && exports3.snippetManager.expandWithTab(editor))
          return;
        editor.tabstopManager.tabNext(1);
        editor.renderer.scrollCursorIntoView();
      },
      "Shift-Tab": function(editor) {
        editor.tabstopManager.tabNext(-1);
        editor.renderer.scrollCursorIntoView();
      },
      "Esc": function(editor) {
        editor.tabstopManager.detach();
      }
    });
    var movePoint2 = function(point2, diff2) {
      if (point2.row == 0)
        point2.column += diff2.column;
      point2.row += diff2.row;
    };
    var moveRelative = function(point2, start) {
      if (point2.row == start.row)
        point2.column -= start.column;
      point2.row -= start.row;
    };
    dom.importCssString("\n.ace_snippet-marker {\n    -moz-box-sizing: border-box;\n    box-sizing: border-box;\n    background: rgba(194, 193, 208, 0.09);\n    border: 1px dotted rgba(211, 208, 235, 0.62);\n    position: absolute;\n}", "snippets.css", false);
    exports3.snippetManager = new SnippetManager();
    var Editor2 = require2("./editor").Editor;
    (function() {
      this.insertSnippet = function(content2, options) {
        return exports3.snippetManager.insertSnippet(this, content2, options);
      };
      this.expandSnippet = function(options) {
        return exports3.snippetManager.expandWithTab(this, options);
      };
    }).call(Editor2.prototype);
  });
  ace.define("ace/autocomplete/popup", ["require", "exports", "module", "ace/virtual_renderer", "ace/editor", "ace/range", "ace/lib/event", "ace/lib/lang", "ace/lib/dom", "ace/config", "ace/lib/useragent"], function(require2, exports3, module3) {
    var Renderer = require2("../virtual_renderer").VirtualRenderer;
    var Editor2 = require2("../editor").Editor;
    var Range = require2("../range").Range;
    var event = require2("../lib/event");
    var lang2 = require2("../lib/lang");
    var dom = require2("../lib/dom");
    var nls = require2("../config").nls;
    var userAgent = require2("./../lib/useragent");
    var getAriaId = function(index2) {
      return "suggest-aria-id:".concat(index2);
    };
    var popupAriaRole = userAgent.isSafari ? "menu" : "listbox";
    var optionAriaRole = userAgent.isSafari ? "menuitem" : "option";
    var ariaActiveState = userAgent.isSafari ? "aria-current" : "aria-selected";
    var $singleLineEditor = function(el2) {
      var renderer = new Renderer(el2);
      renderer.$maxLines = 4;
      var editor = new Editor2(renderer);
      editor.setHighlightActiveLine(false);
      editor.setShowPrintMargin(false);
      editor.renderer.setShowGutter(false);
      editor.renderer.setHighlightGutterLine(false);
      editor.$mouseHandler.$focusTimeout = 0;
      editor.$highlightTagPending = true;
      return editor;
    };
    var AcePopup = (
      /** @class */
      /* @__PURE__ */ function() {
        function AcePopup2(parentNode) {
          var el2 = dom.createElement("div");
          var popup = $singleLineEditor(el2);
          if (parentNode) {
            parentNode.appendChild(el2);
          }
          el2.style.display = "none";
          popup.renderer.content.style.cursor = "default";
          popup.renderer.setStyle("ace_autocomplete");
          popup.renderer.$textLayer.element.setAttribute("role", popupAriaRole);
          popup.renderer.$textLayer.element.setAttribute("aria-roledescription", nls("autocomplete.popup.aria-roledescription", "Autocomplete suggestions"));
          popup.renderer.$textLayer.element.setAttribute("aria-label", nls("autocomplete.popup.aria-label", "Autocomplete suggestions"));
          popup.renderer.textarea.setAttribute("aria-hidden", "true");
          popup.setOption("displayIndentGuides", false);
          popup.setOption("dragDelay", 150);
          var noop4 = function() {
          };
          popup.focus = noop4;
          popup.$isFocused = true;
          popup.renderer.$cursorLayer.restartTimer = noop4;
          popup.renderer.$cursorLayer.element.style.opacity = "0";
          popup.renderer.$maxLines = 8;
          popup.renderer.$keepTextAreaAtCursor = false;
          popup.setHighlightActiveLine(false);
          popup.session.highlight("");
          popup.session.$searchHighlight.clazz = "ace_highlight-marker";
          popup.on("mousedown", function(e2) {
            var pos = e2.getDocumentPosition();
            popup.selection.moveToPosition(pos);
            selectionMarker.start.row = selectionMarker.end.row = pos.row;
            e2.stop();
          });
          var lastMouseEvent;
          var hoverMarker = new Range(-1, 0, -1, Infinity);
          var selectionMarker = new Range(-1, 0, -1, Infinity);
          selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
          popup.setSelectOnHover = function(val) {
            if (!val) {
              hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
            } else if (hoverMarker.id) {
              popup.session.removeMarker(hoverMarker.id);
              hoverMarker.id = null;
            }
          };
          popup.setSelectOnHover(false);
          popup.on("mousemove", function(e2) {
            if (!lastMouseEvent) {
              lastMouseEvent = e2;
              return;
            }
            if (lastMouseEvent.x == e2.x && lastMouseEvent.y == e2.y) {
              return;
            }
            lastMouseEvent = e2;
            lastMouseEvent.scrollTop = popup.renderer.scrollTop;
            popup.isMouseOver = true;
            var row = lastMouseEvent.getDocumentPosition().row;
            if (hoverMarker.start.row != row) {
              if (!hoverMarker.id)
                popup.setRow(row);
              setHoverMarker(row);
            }
          });
          popup.renderer.on("beforeRender", function() {
            if (lastMouseEvent && hoverMarker.start.row != -1) {
              lastMouseEvent.$pos = null;
              var row = lastMouseEvent.getDocumentPosition().row;
              if (!hoverMarker.id)
                popup.setRow(row);
              setHoverMarker(row, true);
            }
          });
          popup.renderer.on("afterRender", function() {
            var t2 = popup.renderer.$textLayer;
            for (var row = t2.config.firstRow, l2 = t2.config.lastRow; row <= l2; row++) {
              var popupRowElement = (
                /** @type {HTMLElement|null} */
                t2.element.childNodes[row - t2.config.firstRow]
              );
              popupRowElement.setAttribute("role", optionAriaRole);
              popupRowElement.setAttribute("aria-roledescription", nls("autocomplete.popup.item.aria-roledescription", "item"));
              popupRowElement.setAttribute("aria-setsize", popup.data.length);
              popupRowElement.setAttribute("aria-describedby", "doc-tooltip");
              popupRowElement.setAttribute("aria-posinset", row + 1);
              var rowData = popup.getData(row);
              if (rowData) {
                var ariaLabel = "".concat(rowData.caption || rowData.value).concat(rowData.meta ? ", ".concat(rowData.meta) : "");
                popupRowElement.setAttribute("aria-label", ariaLabel);
              }
              var highlightedSpans = popupRowElement.querySelectorAll(".ace_completion-highlight");
              highlightedSpans.forEach(function(span) {
                span.setAttribute("role", "mark");
              });
            }
          });
          popup.renderer.on("afterRender", function() {
            var row = popup.getRow();
            var t2 = popup.renderer.$textLayer;
            var selected = (
              /** @type {HTMLElement|null} */
              t2.element.childNodes[row - t2.config.firstRow]
            );
            var el3 = document.activeElement;
            if (selected !== popup.selectedNode && popup.selectedNode) {
              dom.removeCssClass(popup.selectedNode, "ace_selected");
              popup.selectedNode.removeAttribute(ariaActiveState);
              popup.selectedNode.removeAttribute("id");
            }
            el3.removeAttribute("aria-activedescendant");
            popup.selectedNode = selected;
            if (selected) {
              var ariaId = getAriaId(row);
              dom.addCssClass(selected, "ace_selected");
              selected.id = ariaId;
              t2.element.setAttribute("aria-activedescendant", ariaId);
              el3.setAttribute("aria-activedescendant", ariaId);
              selected.setAttribute(ariaActiveState, "true");
            }
          });
          var hideHoverMarker = function() {
            setHoverMarker(-1);
          };
          var setHoverMarker = function(row, suppressRedraw) {
            if (row !== hoverMarker.start.row) {
              hoverMarker.start.row = hoverMarker.end.row = row;
              if (!suppressRedraw)
                popup.session._emit("changeBackMarker");
              popup._emit("changeHoverMarker");
            }
          };
          popup.getHoveredRow = function() {
            return hoverMarker.start.row;
          };
          event.addListener(popup.container, "mouseout", function() {
            popup.isMouseOver = false;
            hideHoverMarker();
          });
          popup.on("hide", hideHoverMarker);
          popup.on("changeSelection", hideHoverMarker);
          popup.session.doc.getLength = function() {
            return popup.data.length;
          };
          popup.session.doc.getLine = function(i2) {
            var data = popup.data[i2];
            if (typeof data == "string")
              return data;
            return data && data.value || "";
          };
          var bgTokenizer = popup.session.bgTokenizer;
          bgTokenizer.$tokenizeRow = function(row) {
            var data = popup.data[row];
            var tokens2 = [];
            if (!data)
              return tokens2;
            if (typeof data == "string")
              data = { value: data };
            var caption = data.caption || data.value || data.name;
            function addToken(value2, className) {
              value2 && tokens2.push({
                type: (data.className || "") + (className || ""),
                value: value2
              });
            }
            var lower = caption.toLowerCase();
            var filterText = (popup.filterText || "").toLowerCase();
            var lastIndex = 0;
            var lastI = 0;
            for (var i2 = 0; i2 <= filterText.length; i2++) {
              if (i2 != lastI && (data.matchMask & 1 << i2 || i2 == filterText.length)) {
                var sub = filterText.slice(lastI, i2);
                lastI = i2;
                var index2 = lower.indexOf(sub, lastIndex);
                if (index2 == -1)
                  continue;
                addToken(caption.slice(lastIndex, index2), "");
                lastIndex = index2 + sub.length;
                addToken(caption.slice(index2, lastIndex), "completion-highlight");
              }
            }
            addToken(caption.slice(lastIndex, caption.length), "");
            tokens2.push({ type: "completion-spacer", value: " " });
            if (data.meta)
              tokens2.push({ type: "completion-meta", value: data.meta });
            if (data.message)
              tokens2.push({ type: "completion-message", value: data.message });
            return tokens2;
          };
          bgTokenizer.$updateOnChange = noop4;
          bgTokenizer.start = noop4;
          popup.session.$computeWidth = function() {
            return this.screenWidth = 0;
          };
          popup.isOpen = false;
          popup.isTopdown = false;
          popup.autoSelect = true;
          popup.filterText = "";
          popup.isMouseOver = false;
          popup.data = [];
          popup.setData = function(list2, filterText) {
            popup.filterText = filterText || "";
            popup.setValue(lang2.stringRepeat("\n", list2.length), -1);
            popup.data = list2 || [];
            popup.setRow(0);
          };
          popup.getData = function(row) {
            return popup.data[row];
          };
          popup.getRow = function() {
            return selectionMarker.start.row;
          };
          popup.setRow = function(line2) {
            line2 = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length - 1, line2));
            if (selectionMarker.start.row != line2) {
              popup.selection.clearSelection();
              selectionMarker.start.row = selectionMarker.end.row = line2 || 0;
              popup.session._emit("changeBackMarker");
              popup.moveCursorTo(line2 || 0, 0);
              if (popup.isOpen)
                popup._signal("select");
            }
          };
          popup.on("changeSelection", function() {
            if (popup.isOpen)
              popup.setRow(popup.selection.lead.row);
            popup.renderer.scrollCursorIntoView();
          });
          popup.hide = function() {
            this.container.style.display = "none";
            popup.anchorPos = null;
            popup.anchor = null;
            if (popup.isOpen) {
              popup.isOpen = false;
              this._signal("hide");
            }
          };
          popup.tryShow = function(pos, lineHeight2, anchor, forceShow) {
            if (!forceShow && popup.isOpen && popup.anchorPos && popup.anchor && popup.anchorPos.top === pos.top && popup.anchorPos.left === pos.left && popup.anchor === anchor) {
              return true;
            }
            var el3 = this.container;
            var scrollBarSize = this.renderer.scrollBar.width || 10;
            var screenHeight = window.innerHeight - scrollBarSize;
            var screenWidth = window.innerWidth - scrollBarSize;
            var renderer = this.renderer;
            var maxH = renderer.$maxLines * lineHeight2 * 1.4;
            var dims = { top: 0, bottom: 0 };
            var spaceBelow = screenHeight - pos.top - 3 * this.$borderSize - lineHeight2;
            var spaceAbove = pos.top - 3 * this.$borderSize;
            if (!anchor) {
              if (spaceAbove <= spaceBelow || spaceBelow >= maxH) {
                anchor = "bottom";
              } else {
                anchor = "top";
              }
            }
            if (anchor === "top") {
              dims.bottom = pos.top - this.$borderSize;
              dims.top = dims.bottom - maxH;
            } else if (anchor === "bottom") {
              dims.top = pos.top + lineHeight2 + this.$borderSize;
              dims.bottom = dims.top + maxH;
            }
            var fitsX = dims.top >= 0 && dims.bottom <= screenHeight;
            if (!forceShow && !fitsX) {
              return false;
            }
            if (!fitsX) {
              if (anchor === "top") {
                renderer.$maxPixelHeight = spaceAbove;
              } else {
                renderer.$maxPixelHeight = spaceBelow;
              }
            } else {
              renderer.$maxPixelHeight = null;
            }
            if (anchor === "top") {
              el3.style.top = "";
              el3.style.bottom = screenHeight + scrollBarSize - dims.bottom + "px";
              popup.isTopdown = false;
            } else {
              el3.style.top = dims.top + "px";
              el3.style.bottom = "";
              popup.isTopdown = true;
            }
            el3.style.display = "";
            var left2 = pos.left;
            if (left2 + el3.offsetWidth > screenWidth)
              left2 = screenWidth - el3.offsetWidth;
            el3.style.left = left2 + "px";
            el3.style.right = "";
            if (!popup.isOpen) {
              popup.isOpen = true;
              this._signal("show");
              lastMouseEvent = null;
            }
            popup.anchorPos = pos;
            popup.anchor = anchor;
            return true;
          };
          popup.show = function(pos, lineHeight2, topdownOnly) {
            this.tryShow(pos, lineHeight2, topdownOnly ? "bottom" : void 0, true);
          };
          popup.goTo = function(where) {
            var row = this.getRow();
            var max2 = this.session.getLength() - 1;
            switch (where) {
              case "up":
                row = row <= 0 ? max2 : row - 1;
                break;
              case "down":
                row = row >= max2 ? -1 : row + 1;
                break;
              case "start":
                row = 0;
                break;
              case "end":
                row = max2;
                break;
            }
            this.setRow(row);
          };
          popup.getTextLeftOffset = function() {
            return this.$borderSize + this.renderer.$padding + this.$imageSize;
          };
          popup.$imageSize = 0;
          popup.$borderSize = 1;
          return popup;
        }
        return AcePopup2;
      }()
    );
    dom.importCssString('\n.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n    background-color: #CAD6FA;\n    z-index: 1;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\n    background-color: #3a674e;\n}\n.ace_editor.ace_autocomplete .ace_line-hover {\n    border: 1px solid #abbffe;\n    margin-top: -1px;\n    background: rgba(233,233,253,0.4);\n    position: absolute;\n    z-index: 2;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {\n    border: 1px solid rgba(109, 150, 13, 0.8);\n    background: rgba(58, 103, 78, 0.62);\n}\n.ace_completion-meta {\n    opacity: 0.5;\n    margin-left: 0.9em;\n}\n.ace_completion-message {\n    margin-left: 0.9em;\n    color: blue;\n}\n.ace_editor.ace_autocomplete .ace_completion-highlight{\n    color: #2d69c7;\n}\n.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{\n    color: #93ca12;\n}\n.ace_editor.ace_autocomplete {\n    width: 300px;\n    z-index: 200000;\n    border: 1px lightgray solid;\n    position: fixed;\n    box-shadow: 2px 3px 5px rgba(0,0,0,.2);\n    line-height: 1.4;\n    background: #fefefe;\n    color: #111;\n}\n.ace_dark.ace_editor.ace_autocomplete {\n    border: 1px #484747 solid;\n    box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);\n    line-height: 1.4;\n    background: #25282c;\n    color: #c1c1c1;\n}\n.ace_autocomplete .ace_text-layer  {\n    width: calc(100% - 8px);\n}\n.ace_autocomplete .ace_line {\n    display: flex;\n    align-items: center;\n}\n.ace_autocomplete .ace_line > * {\n    min-width: 0;\n    flex: 0 0 auto;\n}\n.ace_autocomplete .ace_line .ace_ {\n    flex: 0 1 auto;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n.ace_autocomplete .ace_completion-spacer {\n    flex: 1;\n}\n.ace_autocomplete.ace_loading:after  {\n    content: "";\n    position: absolute;\n    top: 0px;\n    height: 2px;\n    width: 8%;\n    background: blue;\n    z-index: 100;\n    animation: ace_progress 3s infinite linear;\n    animation-delay: 300ms;\n    transform: translateX(-100%) scaleX(1);\n}\n@keyframes ace_progress {\n    0% { transform: translateX(-100%) scaleX(1) }\n    50% { transform: translateX(625%) scaleX(2) } \n    100% { transform: translateX(1500%) scaleX(3) } \n}\n@media (prefers-reduced-motion) {\n    .ace_autocomplete.ace_loading:after {\n        transform: translateX(625%) scaleX(2);\n        animation: none;\n     }\n}\n', "autocompletion.css", false);
    exports3.AcePopup = AcePopup;
    exports3.$singleLineEditor = $singleLineEditor;
    exports3.getAriaId = getAriaId;
  });
  ace.define("ace/autocomplete/inline_screenreader", ["require", "exports", "module"], function(require2, exports3, module3) {
    var AceInlineScreenReader = (
      /** @class */
      function() {
        function AceInlineScreenReader2(editor) {
          this.editor = editor;
          this.screenReaderDiv = document.createElement("div");
          this.screenReaderDiv.classList.add("ace_screenreader-only");
          this.editor.container.appendChild(this.screenReaderDiv);
        }
        AceInlineScreenReader2.prototype.setScreenReaderContent = function(content2) {
          if (!this.popup && this.editor.completer && /**@type{import("../autocomplete").Autocomplete}*/
          this.editor.completer.popup) {
            this.popup = /**@type{import("../autocomplete").Autocomplete}*/
            this.editor.completer.popup;
            this.popup.renderer.on("afterRender", (function() {
              var row = this.popup.getRow();
              var t2 = this.popup.renderer.$textLayer;
              var selected = t2.element.childNodes[row - t2.config.firstRow];
              if (selected) {
                var idString = "doc-tooltip ";
                for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
                  idString += "ace-inline-screenreader-line-".concat(lineIndex, " ");
                }
                selected.setAttribute("aria-describedby", idString);
              }
            }).bind(this));
          }
          while (this.screenReaderDiv.firstChild) {
            this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);
          }
          this._lines = content2.split(/\r\n|\r|\n/);
          var codeElement = this.createCodeBlock();
          this.screenReaderDiv.appendChild(codeElement);
        };
        AceInlineScreenReader2.prototype.destroy = function() {
          this.screenReaderDiv.remove();
        };
        AceInlineScreenReader2.prototype.createCodeBlock = function() {
          var container = document.createElement("pre");
          container.setAttribute("id", "ace-inline-screenreader");
          for (var lineIndex = 0; lineIndex < this._lines.length; lineIndex++) {
            var codeElement = document.createElement("code");
            codeElement.setAttribute("id", "ace-inline-screenreader-line-".concat(lineIndex));
            var line2 = document.createTextNode(this._lines[lineIndex]);
            codeElement.appendChild(line2);
            container.appendChild(codeElement);
          }
          return container;
        };
        return AceInlineScreenReader2;
      }()
    );
    exports3.AceInlineScreenReader = AceInlineScreenReader;
  });
  ace.define("ace/autocomplete/inline", ["require", "exports", "module", "ace/snippets", "ace/autocomplete/inline_screenreader"], function(require2, exports3, module3) {
    var snippetManager = require2("../snippets").snippetManager;
    var AceInlineScreenReader = require2("./inline_screenreader").AceInlineScreenReader;
    var AceInline = (
      /** @class */
      function() {
        function AceInline2() {
          this.editor = null;
        }
        AceInline2.prototype.show = function(editor, completion, prefix) {
          prefix = prefix || "";
          if (editor && this.editor && this.editor !== editor) {
            this.hide();
            this.editor = null;
            this.inlineScreenReader = null;
          }
          if (!editor || !completion) {
            return false;
          }
          if (!this.inlineScreenReader) {
            this.inlineScreenReader = new AceInlineScreenReader(editor);
          }
          var displayText = completion.snippet ? snippetManager.getDisplayTextForSnippet(editor, completion.snippet) : completion.value;
          if (completion.hideInlinePreview || !displayText || !displayText.startsWith(prefix)) {
            return false;
          }
          this.editor = editor;
          this.inlineScreenReader.setScreenReaderContent(displayText);
          displayText = displayText.slice(prefix.length);
          if (displayText === "") {
            editor.removeGhostText();
          } else {
            editor.setGhostText(displayText);
          }
          return true;
        };
        AceInline2.prototype.isOpen = function() {
          if (!this.editor) {
            return false;
          }
          return !!this.editor.renderer.$ghostText;
        };
        AceInline2.prototype.hide = function() {
          if (!this.editor) {
            return false;
          }
          this.editor.removeGhostText();
          return true;
        };
        AceInline2.prototype.destroy = function() {
          this.hide();
          this.editor = null;
          if (this.inlineScreenReader) {
            this.inlineScreenReader.destroy();
            this.inlineScreenReader = null;
          }
        };
        return AceInline2;
      }()
    );
    exports3.AceInline = AceInline;
  });
  ace.define("ace/autocomplete/util", ["require", "exports", "module"], function(require2, exports3, module3) {
    exports3.parForEach = function(array4, fn, callback2) {
      var completed = 0;
      var arLength = array4.length;
      if (arLength === 0)
        callback2();
      for (var i2 = 0; i2 < arLength; i2++) {
        fn(array4[i2], function(result, err) {
          completed++;
          if (completed === arLength)
            callback2(result, err);
        });
      }
    };
    var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;
    exports3.retrievePrecedingIdentifier = function(text2, pos, regex2) {
      regex2 = regex2 || ID_REGEX;
      var buf = [];
      for (var i2 = pos - 1; i2 >= 0; i2--) {
        if (regex2.test(text2[i2]))
          buf.push(text2[i2]);
        else
          break;
      }
      return buf.reverse().join("");
    };
    exports3.retrieveFollowingIdentifier = function(text2, pos, regex2) {
      regex2 = regex2 || ID_REGEX;
      var buf = [];
      for (var i2 = pos; i2 < text2.length; i2++) {
        if (regex2.test(text2[i2]))
          buf.push(text2[i2]);
        else
          break;
      }
      return buf;
    };
    exports3.getCompletionPrefix = function(editor) {
      var pos = editor.getCursorPosition();
      var line2 = editor.session.getLine(pos.row);
      var prefix;
      editor.completers.forEach((function(completer) {
        if (completer.identifierRegexps) {
          completer.identifierRegexps.forEach((function(identifierRegex) {
            if (!prefix && identifierRegex)
              prefix = this.retrievePrecedingIdentifier(line2, pos.column, identifierRegex);
          }).bind(this));
        }
      }).bind(this));
      return prefix || this.retrievePrecedingIdentifier(line2, pos.column);
    };
    exports3.triggerAutocomplete = function(editor, previousChar) {
      var previousChar = previousChar == null ? editor.session.getPrecedingCharacter() : previousChar;
      return editor.completers.some(function(completer) {
        if (completer.triggerCharacters && Array.isArray(completer.triggerCharacters)) {
          return completer.triggerCharacters.includes(previousChar);
        }
      });
    };
  });
  ace.define("ace/autocomplete", ["require", "exports", "module", "ace/keyboard/hash_handler", "ace/autocomplete/popup", "ace/autocomplete/inline", "ace/autocomplete/popup", "ace/autocomplete/util", "ace/lib/lang", "ace/lib/dom", "ace/snippets", "ace/config", "ace/lib/event", "ace/lib/scroll"], function(require2, exports3, module3) {
    var HashHandler = require2("./keyboard/hash_handler").HashHandler;
    var AcePopup = require2("./autocomplete/popup").AcePopup;
    var AceInline = require2("./autocomplete/inline").AceInline;
    var getAriaId = require2("./autocomplete/popup").getAriaId;
    var util2 = require2("./autocomplete/util");
    var lang2 = require2("./lib/lang");
    var dom = require2("./lib/dom");
    var snippetManager = require2("./snippets").snippetManager;
    var config2 = require2("./config");
    var event = require2("./lib/event");
    var preventParentScroll = require2("./lib/scroll").preventParentScroll;
    var destroyCompleter = function(e2, editor) {
      editor.completer && editor.completer.destroy();
    };
    var Autocomplete3 = (
      /** @class */
      function() {
        function Autocomplete4() {
          this.autoInsert = false;
          this.autoSelect = true;
          this.autoShown = false;
          this.exactMatch = false;
          this.inlineEnabled = false;
          this.keyboardHandler = new HashHandler();
          this.keyboardHandler.bindKeys(this.commands);
          this.parentNode = null;
          this.setSelectOnHover = false;
          this.hasSeen = /* @__PURE__ */ new Set();
          this.showLoadingState = false;
          this.stickySelectionDelay = 500;
          this.blurListener = this.blurListener.bind(this);
          this.changeListener = this.changeListener.bind(this);
          this.mousedownListener = this.mousedownListener.bind(this);
          this.mousewheelListener = this.mousewheelListener.bind(this);
          this.onLayoutChange = this.onLayoutChange.bind(this);
          this.changeTimer = lang2.delayedCall((function() {
            this.updateCompletions(true);
          }).bind(this));
          this.tooltipTimer = lang2.delayedCall(this.updateDocTooltip.bind(this), 50);
          this.popupTimer = lang2.delayedCall(this.$updatePopupPosition.bind(this), 50);
          this.stickySelectionTimer = lang2.delayedCall((function() {
            this.stickySelection = true;
          }).bind(this), this.stickySelectionDelay);
          this.$firstOpenTimer = lang2.delayedCall(
            /**@this{Autocomplete}*/
            (function() {
              var initialPosition = this.completionProvider && this.completionProvider.initialPosition;
              if (this.autoShown || this.popup && this.popup.isOpen || !initialPosition || this.editor.completers.length === 0)
                return;
              this.completions = new FilteredList(Autocomplete4.completionsForLoading);
              this.openPopup(this.editor, initialPosition.prefix, false);
              this.popup.renderer.setStyle("ace_loading", true);
            }).bind(this),
            this.stickySelectionDelay
          );
        }
        Object.defineProperty(Autocomplete4, "completionsForLoading", {
          get: function() {
            return [{
              caption: config2.nls("autocomplete.loading", "Loading..."),
              value: ""
            }];
          },
          enumerable: false,
          configurable: true
        });
        Autocomplete4.prototype.$init = function() {
          this.popup = new AcePopup(this.parentNode || document.body || document.documentElement);
          this.popup.on("click", (function(e2) {
            this.insertMatch();
            e2.stop();
          }).bind(this));
          this.popup.focus = this.editor.focus.bind(this.editor);
          this.popup.on("show", this.$onPopupShow.bind(this));
          this.popup.on("hide", this.$onHidePopup.bind(this));
          this.popup.on("select", this.$onPopupChange.bind(this));
          event.addListener(this.popup.container, "mouseout", this.mouseOutListener.bind(this));
          this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null));
          this.popup.renderer.on("afterRender", this.$onPopupRender.bind(this));
          return this.popup;
        };
        Autocomplete4.prototype.$initInline = function() {
          if (!this.inlineEnabled || this.inlineRenderer)
            return;
          this.inlineRenderer = new AceInline();
          return this.inlineRenderer;
        };
        Autocomplete4.prototype.getPopup = function() {
          return this.popup || this.$init();
        };
        Autocomplete4.prototype.$onHidePopup = function() {
          if (this.inlineRenderer) {
            this.inlineRenderer.hide();
          }
          this.hideDocTooltip();
          this.stickySelectionTimer.cancel();
          this.popupTimer.cancel();
          this.stickySelection = false;
        };
        Autocomplete4.prototype.$seen = function(completion) {
          if (!this.hasSeen.has(completion) && completion && completion.completer && completion.completer.onSeen && typeof completion.completer.onSeen === "function") {
            completion.completer.onSeen(this.editor, completion);
            this.hasSeen.add(completion);
          }
        };
        Autocomplete4.prototype.$onPopupChange = function(hide) {
          if (this.inlineRenderer && this.inlineEnabled) {
            var completion = hide ? null : this.popup.getData(this.popup.getRow());
            this.$updateGhostText(completion);
            if (this.popup.isMouseOver && this.setSelectOnHover) {
              this.tooltipTimer.call(null, null);
              return;
            }
            this.popupTimer.schedule();
            this.tooltipTimer.schedule();
          } else {
            this.popupTimer.call(null, null);
            this.tooltipTimer.call(null, null);
          }
        };
        Autocomplete4.prototype.$updateGhostText = function(completion) {
          var row = this.base.row;
          var column2 = this.base.column;
          var cursorColumn = this.editor.getCursorPosition().column;
          var prefix = this.editor.session.getLine(row).slice(column2, cursorColumn);
          if (!this.inlineRenderer.show(this.editor, completion, prefix)) {
            this.inlineRenderer.hide();
          } else {
            this.$seen(completion);
          }
        };
        Autocomplete4.prototype.$onPopupRender = function() {
          var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
          if (this.completions && this.completions.filtered && this.completions.filtered.length > 0) {
            for (var i2 = this.popup.getFirstVisibleRow(); i2 <= this.popup.getLastVisibleRow(); i2++) {
              var completion = this.popup.getData(i2);
              if (completion && (!inlineEnabled || completion.hideInlinePreview)) {
                this.$seen(completion);
              }
            }
          }
        };
        Autocomplete4.prototype.$onPopupShow = function(hide) {
          this.$onPopupChange(hide);
          this.stickySelection = false;
          if (this.stickySelectionDelay >= 0)
            this.stickySelectionTimer.schedule(this.stickySelectionDelay);
        };
        Autocomplete4.prototype.observeLayoutChanges = function() {
          if (this.$elements || !this.editor)
            return;
          window.addEventListener("resize", this.onLayoutChange, { passive: true });
          window.addEventListener("wheel", this.mousewheelListener);
          var el2 = this.editor.container.parentNode;
          var elements = [];
          while (el2) {
            elements.push(el2);
            el2.addEventListener("scroll", this.onLayoutChange, { passive: true });
            el2 = el2.parentNode;
          }
          this.$elements = elements;
        };
        Autocomplete4.prototype.unObserveLayoutChanges = function() {
          var _this = this;
          window.removeEventListener("resize", this.onLayoutChange, { passive: true });
          window.removeEventListener("wheel", this.mousewheelListener);
          this.$elements && this.$elements.forEach(function(el2) {
            el2.removeEventListener("scroll", _this.onLayoutChange, { passive: true });
          });
          this.$elements = null;
        };
        Autocomplete4.prototype.onLayoutChange = function() {
          if (!this.popup.isOpen)
            return this.unObserveLayoutChanges();
          this.$updatePopupPosition();
          this.updateDocTooltip();
        };
        Autocomplete4.prototype.$updatePopupPosition = function() {
          var editor = this.editor;
          var renderer = editor.renderer;
          var lineHeight2 = renderer.layerConfig.lineHeight;
          var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);
          pos.left -= this.popup.getTextLeftOffset();
          var rect = editor.container.getBoundingClientRect();
          pos.top += rect.top - renderer.layerConfig.offset;
          pos.left += rect.left - editor.renderer.scrollLeft;
          pos.left += renderer.gutterWidth;
          var posGhostText = {
            top: pos.top,
            left: pos.left
          };
          if (renderer.$ghostText && renderer.$ghostTextWidget) {
            if (this.base.row === renderer.$ghostText.position.row) {
              posGhostText.top += renderer.$ghostTextWidget.el.offsetHeight;
            }
          }
          var editorContainerBottom = editor.container.getBoundingClientRect().bottom - lineHeight2;
          var lowestPosition = editorContainerBottom < posGhostText.top ? { top: editorContainerBottom, left: posGhostText.left } : posGhostText;
          if (this.popup.tryShow(lowestPosition, lineHeight2, "bottom")) {
            return;
          }
          if (this.popup.tryShow(pos, lineHeight2, "top")) {
            return;
          }
          this.popup.show(pos, lineHeight2);
        };
        Autocomplete4.prototype.openPopup = function(editor, prefix, keepPopupPosition) {
          this.$firstOpenTimer.cancel();
          if (!this.popup)
            this.$init();
          if (this.inlineEnabled && !this.inlineRenderer)
            this.$initInline();
          this.popup.autoSelect = this.autoSelect;
          this.popup.setSelectOnHover(this.setSelectOnHover);
          var oldRow = this.popup.getRow();
          var previousSelectedItem = this.popup.data[oldRow];
          this.popup.setData(this.completions.filtered, this.completions.filterText);
          if (this.editor.textInput.setAriaOptions) {
            this.editor.textInput.setAriaOptions({
              activeDescendant: getAriaId(this.popup.getRow()),
              inline: this.inlineEnabled
            });
          }
          editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
          var newRow;
          if (this.stickySelection)
            newRow = this.popup.data.indexOf(previousSelectedItem);
          if (!newRow || newRow === -1)
            newRow = 0;
          this.popup.setRow(this.autoSelect ? newRow : -1);
          if (newRow === oldRow && previousSelectedItem !== this.completions.filtered[newRow])
            this.$onPopupChange();
          var inlineEnabled = this.inlineRenderer && this.inlineEnabled;
          if (newRow === oldRow && inlineEnabled) {
            var completion = this.popup.getData(this.popup.getRow());
            this.$updateGhostText(completion);
          }
          if (!keepPopupPosition) {
            this.popup.setTheme(editor.getTheme());
            this.popup.setFontSize(editor.getFontSize());
            this.$updatePopupPosition();
            if (this.tooltipNode) {
              this.updateDocTooltip();
            }
          }
          this.changeTimer.cancel();
          this.observeLayoutChanges();
        };
        Autocomplete4.prototype.detach = function() {
          if (this.editor) {
            this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
            this.editor.off("changeSelection", this.changeListener);
            this.editor.off("blur", this.blurListener);
            this.editor.off("mousedown", this.mousedownListener);
            this.editor.off("mousewheel", this.mousewheelListener);
          }
          this.$firstOpenTimer.cancel();
          this.changeTimer.cancel();
          this.hideDocTooltip();
          if (this.completionProvider) {
            this.completionProvider.detach();
          }
          if (this.popup && this.popup.isOpen)
            this.popup.hide();
          if (this.popup && this.popup.renderer) {
            this.popup.renderer.off("afterRender", this.$onPopupRender);
          }
          if (this.base)
            this.base.detach();
          this.activated = false;
          this.completionProvider = this.completions = this.base = null;
          this.unObserveLayoutChanges();
        };
        Autocomplete4.prototype.changeListener = function(e2) {
          var cursor = this.editor.selection.lead;
          if (cursor.row != this.base.row || cursor.column < this.base.column) {
            this.detach();
          }
          if (this.activated)
            this.changeTimer.schedule();
          else
            this.detach();
        };
        Autocomplete4.prototype.blurListener = function(e2) {
          var el2 = document.activeElement;
          var text2 = this.editor.textInput.getElement();
          var fromTooltip = e2.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e2.relatedTarget);
          var container = this.popup && this.popup.container;
          if (el2 != text2 && el2.parentNode != container && !fromTooltip && el2 != this.tooltipNode && e2.relatedTarget != text2) {
            this.detach();
          }
        };
        Autocomplete4.prototype.mousedownListener = function(e2) {
          this.detach();
        };
        Autocomplete4.prototype.mousewheelListener = function(e2) {
          if (this.popup && !this.popup.isMouseOver)
            this.detach();
        };
        Autocomplete4.prototype.mouseOutListener = function(e2) {
          if (this.popup.isOpen)
            this.$updatePopupPosition();
        };
        Autocomplete4.prototype.goTo = function(where) {
          this.popup.goTo(where);
        };
        Autocomplete4.prototype.insertMatch = function(data, options) {
          if (!data)
            data = this.popup.getData(this.popup.getRow());
          if (!data)
            return false;
          if (data.value === "")
            return this.detach();
          var completions = this.completions;
          var result = this.getCompletionProvider().insertMatch(this.editor, data, completions.filterText, options);
          if (this.completions == completions)
            this.detach();
          return result;
        };
        Autocomplete4.prototype.showPopup = function(editor, options) {
          if (this.editor)
            this.detach();
          this.activated = true;
          this.editor = editor;
          if (editor.completer != this) {
            if (editor.completer)
              editor.completer.detach();
            editor.completer = this;
          }
          editor.on("changeSelection", this.changeListener);
          editor.on("blur", this.blurListener);
          editor.on("mousedown", this.mousedownListener);
          editor.on("mousewheel", this.mousewheelListener);
          this.updateCompletions(false, options);
        };
        Autocomplete4.prototype.getCompletionProvider = function(initialPosition) {
          if (!this.completionProvider)
            this.completionProvider = new CompletionProvider(initialPosition);
          return this.completionProvider;
        };
        Autocomplete4.prototype.gatherCompletions = function(editor, callback2) {
          return this.getCompletionProvider().gatherCompletions(editor, callback2);
        };
        Autocomplete4.prototype.updateCompletions = function(keepPopupPosition, options) {
          if (keepPopupPosition && this.base && this.completions) {
            var pos = this.editor.getCursorPosition();
            var prefix = this.editor.session.getTextRange({ start: this.base, end: pos });
            if (prefix == this.completions.filterText)
              return;
            this.completions.setFilter(prefix);
            if (!this.completions.filtered.length)
              return this.detach();
            if (this.completions.filtered.length == 1 && this.completions.filtered[0].value == prefix && !this.completions.filtered[0].snippet)
              return this.detach();
            this.openPopup(this.editor, prefix, keepPopupPosition);
            return;
          }
          if (options && options.matches) {
            var pos = this.editor.getSelectionRange().start;
            this.base = this.editor.session.doc.createAnchor(pos.row, pos.column);
            this.base.$insertRight = true;
            this.completions = new FilteredList(options.matches);
            this.getCompletionProvider().completions = this.completions;
            return this.openPopup(this.editor, "", keepPopupPosition);
          }
          var session = this.editor.getSession();
          var pos = this.editor.getCursorPosition();
          var prefix = util2.getCompletionPrefix(this.editor);
          this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length);
          this.base.$insertRight = true;
          var completionOptions = {
            exactMatch: this.exactMatch,
            ignoreCaption: this.ignoreCaption
          };
          this.getCompletionProvider({
            prefix,
            pos
          }).provideCompletions(
            this.editor,
            completionOptions,
            (function(err, completions, finished) {
              var filtered = completions.filtered;
              var prefix2 = util2.getCompletionPrefix(this.editor);
              this.$firstOpenTimer.cancel();
              if (finished) {
                if (!filtered.length) {
                  var emptyMessage = !this.autoShown && this.emptyMessage;
                  if (typeof emptyMessage == "function")
                    emptyMessage = this.emptyMessage(prefix2);
                  if (emptyMessage) {
                    var completionsForEmpty = [
                      {
                        caption: emptyMessage,
                        value: ""
                      }
                    ];
                    this.completions = new FilteredList(completionsForEmpty);
                    this.openPopup(this.editor, prefix2, keepPopupPosition);
                    this.popup.renderer.setStyle("ace_loading", false);
                    this.popup.renderer.setStyle("ace_empty-message", true);
                    return;
                  }
                  return this.detach();
                }
                if (filtered.length == 1 && filtered[0].value == prefix2 && !filtered[0].snippet)
                  return this.detach();
                if (this.autoInsert && !this.autoShown && filtered.length == 1)
                  return this.insertMatch(filtered[0]);
              }
              this.completions = !finished && this.showLoadingState ? new FilteredList(Autocomplete4.completionsForLoading.concat(filtered), completions.filterText) : completions;
              this.openPopup(this.editor, prefix2, keepPopupPosition);
              this.popup.renderer.setStyle("ace_empty-message", false);
              this.popup.renderer.setStyle("ace_loading", !finished);
            }).bind(this)
          );
          if (this.showLoadingState && !this.autoShown && !(this.popup && this.popup.isOpen)) {
            this.$firstOpenTimer.delay(this.stickySelectionDelay / 2);
          }
        };
        Autocomplete4.prototype.cancelContextMenu = function() {
          this.editor.$mouseHandler.cancelContextMenu();
        };
        Autocomplete4.prototype.updateDocTooltip = function() {
          var popup = this.popup;
          var all3 = this.completions && this.completions.filtered;
          var selected = all3 && (all3[popup.getHoveredRow()] || all3[popup.getRow()]);
          var doc = null;
          if (!selected || !this.editor || !this.popup.isOpen)
            return this.hideDocTooltip();
          var completersLength = this.editor.completers.length;
          for (var i2 = 0; i2 < completersLength; i2++) {
            var completer = this.editor.completers[i2];
            if (completer.getDocTooltip && selected.completerId === completer.id) {
              doc = completer.getDocTooltip(selected);
              break;
            }
          }
          if (!doc && typeof selected != "string")
            doc = selected;
          if (typeof doc == "string")
            doc = { docText: doc };
          if (!doc || !(doc.docHTML || doc.docText))
            return this.hideDocTooltip();
          this.showDocTooltip(doc);
        };
        Autocomplete4.prototype.showDocTooltip = function(item) {
          if (!this.tooltipNode) {
            this.tooltipNode = dom.createElement("div");
            this.tooltipNode.style.margin = "0";
            this.tooltipNode.style.pointerEvents = "auto";
            this.tooltipNode.style.overscrollBehavior = "contain";
            this.tooltipNode.tabIndex = -1;
            this.tooltipNode.onblur = this.blurListener.bind(this);
            this.tooltipNode.onclick = this.onTooltipClick.bind(this);
            this.tooltipNode.id = "doc-tooltip";
            this.tooltipNode.setAttribute("role", "tooltip");
            this.tooltipNode.addEventListener("wheel", preventParentScroll);
          }
          var theme2 = this.editor.renderer.theme;
          this.tooltipNode.className = "ace_tooltip ace_doc-tooltip " + (theme2.isDark ? "ace_dark " : "") + (theme2.cssClass || "");
          var tooltipNode = this.tooltipNode;
          if (item.docHTML) {
            tooltipNode.innerHTML = item.docHTML;
          } else if (item.docText) {
            tooltipNode.textContent = item.docText;
          }
          if (!tooltipNode.parentNode)
            this.popup.container.appendChild(this.tooltipNode);
          var popup = this.popup;
          var rect = popup.container.getBoundingClientRect();
          var targetWidth = 400;
          var targetHeight = 300;
          var scrollBarSize = popup.renderer.scrollBar.width || 10;
          var leftSize = rect.left;
          var rightSize = window.innerWidth - rect.right - scrollBarSize;
          var topSize = popup.isTopdown ? rect.top : window.innerHeight - scrollBarSize - rect.bottom;
          var scores = [
            Math.min(rightSize / targetWidth, 1),
            Math.min(leftSize / targetWidth, 1),
            Math.min(topSize / targetHeight * 0.9)
          ];
          var max2 = Math.max.apply(Math, scores);
          var tooltipStyle = tooltipNode.style;
          tooltipStyle.display = "block";
          if (max2 == scores[0]) {
            tooltipStyle.left = rect.right + 1 + "px";
            tooltipStyle.right = "";
            tooltipStyle.maxWidth = targetWidth * max2 + "px";
            tooltipStyle.top = rect.top + "px";
            tooltipStyle.bottom = "";
            tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
          } else if (max2 == scores[1]) {
            tooltipStyle.right = window.innerWidth - rect.left + "px";
            tooltipStyle.left = "";
            tooltipStyle.maxWidth = targetWidth * max2 + "px";
            tooltipStyle.top = rect.top + "px";
            tooltipStyle.bottom = "";
            tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.top, targetHeight) + "px";
          } else if (max2 == scores[2]) {
            tooltipStyle.left = window.innerWidth - rect.left + "px";
            tooltipStyle.maxWidth = Math.min(targetWidth, window.innerWidth) + "px";
            if (popup.isTopdown) {
              tooltipStyle.top = rect.bottom + "px";
              tooltipStyle.left = rect.left + "px";
              tooltipStyle.right = "";
              tooltipStyle.bottom = "";
              tooltipStyle.maxHeight = Math.min(window.innerHeight - scrollBarSize - rect.bottom, targetHeight) + "px";
            } else {
              tooltipStyle.top = popup.container.offsetTop - tooltipNode.offsetHeight + "px";
              tooltipStyle.left = rect.left + "px";
              tooltipStyle.right = "";
              tooltipStyle.bottom = "";
              tooltipStyle.maxHeight = Math.min(popup.container.offsetTop, targetHeight) + "px";
            }
          }
        };
        Autocomplete4.prototype.hideDocTooltip = function() {
          this.tooltipTimer.cancel();
          if (!this.tooltipNode)
            return;
          var el2 = this.tooltipNode;
          if (!this.editor.isFocused() && document.activeElement == el2)
            this.editor.focus();
          this.tooltipNode = null;
          if (el2.parentNode)
            el2.parentNode.removeChild(el2);
        };
        Autocomplete4.prototype.onTooltipClick = function(e2) {
          var a2 = e2.target;
          while (a2 && a2 != this.tooltipNode) {
            if (a2.nodeName == "A" && a2.href) {
              a2.rel = "noreferrer";
              a2.target = "_blank";
              break;
            }
            a2 = a2.parentNode;
          }
        };
        Autocomplete4.prototype.destroy = function() {
          this.detach();
          if (this.popup) {
            this.popup.destroy();
            var el2 = this.popup.container;
            if (el2 && el2.parentNode)
              el2.parentNode.removeChild(el2);
          }
          if (this.editor && this.editor.completer == this) {
            this.editor.off("destroy", destroyCompleter);
            this.editor.completer = null;
          }
          this.inlineRenderer = this.popup = this.editor = null;
        };
        Autocomplete4.for = function(editor) {
          if (editor.completer instanceof Autocomplete4) {
            return editor.completer;
          }
          if (editor.completer) {
            editor.completer.destroy();
            editor.completer = null;
          }
          if (config2.get("sharedPopups")) {
            if (!Autocomplete4["$sharedInstance"])
              Autocomplete4["$sharedInstance"] = new Autocomplete4();
            editor.completer = Autocomplete4["$sharedInstance"];
          } else {
            editor.completer = new Autocomplete4();
            editor.once("destroy", destroyCompleter);
          }
          return editor.completer;
        };
        return Autocomplete4;
      }()
    );
    Autocomplete3.prototype.commands = {
      "Up": function(editor) {
        editor.completer.goTo("up");
      },
      "Down": function(editor) {
        editor.completer.goTo("down");
      },
      "Ctrl-Up|Ctrl-Home": function(editor) {
        editor.completer.goTo("start");
      },
      "Ctrl-Down|Ctrl-End": function(editor) {
        editor.completer.goTo("end");
      },
      "Esc": function(editor) {
        editor.completer.detach();
      },
      "Return": function(editor) {
        return editor.completer.insertMatch();
      },
      "Shift-Return": function(editor) {
        editor.completer.insertMatch(null, { deleteSuffix: true });
      },
      "Tab": function(editor) {
        var result = editor.completer.insertMatch();
        if (!result && !editor.tabstopManager)
          editor.completer.goTo("down");
        else
          return result;
      },
      "Backspace": function(editor) {
        editor.execCommand("backspace");
        var prefix = util2.getCompletionPrefix(editor);
        if (!prefix && editor.completer)
          editor.completer.detach();
      },
      "PageUp": function(editor) {
        editor.completer.popup.gotoPageUp();
      },
      "PageDown": function(editor) {
        editor.completer.popup.gotoPageDown();
      }
    };
    Autocomplete3.startCommand = {
      name: "startAutocomplete",
      exec: function(editor, options) {
        var completer = Autocomplete3.for(editor);
        completer.autoInsert = false;
        completer.autoSelect = true;
        completer.autoShown = false;
        completer.showPopup(editor, options);
        completer.cancelContextMenu();
      },
      bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
    };
    var CompletionProvider = (
      /** @class */
      function() {
        function CompletionProvider2(initialPosition) {
          this.initialPosition = initialPosition;
          this.active = true;
        }
        CompletionProvider2.prototype.insertByIndex = function(editor, index2, options) {
          if (!this.completions || !this.completions.filtered) {
            return false;
          }
          return this.insertMatch(editor, this.completions.filtered[index2], options);
        };
        CompletionProvider2.prototype.insertMatch = function(editor, data, options) {
          if (!data)
            return false;
          editor.startOperation({ command: { name: "insertMatch" } });
          if (data.completer && data.completer.insertMatch) {
            data.completer.insertMatch(editor, data);
          } else {
            if (!this.completions)
              return false;
            var replaceBefore = this.completions.filterText.length;
            var replaceAfter = 0;
            if (data.range && data.range.start.row === data.range.end.row) {
              replaceBefore -= this.initialPosition.prefix.length;
              replaceBefore += this.initialPosition.pos.column - data.range.start.column;
              replaceAfter += data.range.end.column - this.initialPosition.pos.column;
            }
            if (replaceBefore || replaceAfter) {
              var ranges;
              if (editor.selection.getAllRanges) {
                ranges = editor.selection.getAllRanges();
              } else {
                ranges = [editor.getSelectionRange()];
              }
              for (var i2 = 0, range3; range3 = ranges[i2]; i2++) {
                range3.start.column -= replaceBefore;
                range3.end.column += replaceAfter;
                editor.session.remove(range3);
              }
            }
            if (data.snippet) {
              snippetManager.insertSnippet(editor, data.snippet);
            } else {
              this.$insertString(editor, data);
            }
            if (data.completer && data.completer.onInsert && typeof data.completer.onInsert == "function") {
              data.completer.onInsert(editor, data);
            }
            if (data.command && data.command === "startAutocomplete") {
              editor.execCommand(data.command);
            }
          }
          editor.endOperation();
          return true;
        };
        CompletionProvider2.prototype.$insertString = function(editor, data) {
          var text2 = data.value || data;
          editor.execCommand("insertstring", text2);
        };
        CompletionProvider2.prototype.gatherCompletions = function(editor, callback2) {
          var session = editor.getSession();
          var pos = editor.getCursorPosition();
          var prefix = util2.getCompletionPrefix(editor);
          var matches = [];
          this.completers = editor.completers;
          var total = editor.completers.length;
          editor.completers.forEach(function(completer, i2) {
            completer.getCompletions(editor, session, pos, prefix, function(err, results) {
              if (completer.hideInlinePreview)
                results = results.map(function(result) {
                  return Object.assign(result, { hideInlinePreview: completer.hideInlinePreview });
                });
              if (!err && results)
                matches = matches.concat(results);
              callback2(null, {
                prefix: util2.getCompletionPrefix(editor),
                matches,
                finished: --total === 0
              });
            });
          });
          return true;
        };
        CompletionProvider2.prototype.provideCompletions = function(editor, options, callback2) {
          var processResults = (function(results2) {
            var prefix = results2.prefix;
            var matches = results2.matches;
            this.completions = new FilteredList(matches);
            if (options.exactMatch)
              this.completions.exactMatch = true;
            if (options.ignoreCaption)
              this.completions.ignoreCaption = true;
            this.completions.setFilter(prefix);
            if (results2.finished || this.completions.filtered.length)
              callback2(null, this.completions, results2.finished);
          }).bind(this);
          var isImmediate = true;
          var immediateResults = null;
          this.gatherCompletions(editor, (function(err, results2) {
            if (!this.active) {
              return;
            }
            if (err) {
              callback2(err, [], true);
              this.detach();
            }
            var prefix = results2.prefix;
            if (prefix.indexOf(results2.prefix) !== 0)
              return;
            if (isImmediate) {
              immediateResults = results2;
              return;
            }
            processResults(results2);
          }).bind(this));
          isImmediate = false;
          if (immediateResults) {
            var results = immediateResults;
            immediateResults = null;
            processResults(results);
          }
        };
        CompletionProvider2.prototype.detach = function() {
          this.active = false;
          this.completers && this.completers.forEach(function(completer) {
            if (typeof completer.cancel === "function") {
              completer.cancel();
            }
          });
        };
        return CompletionProvider2;
      }()
    );
    var FilteredList = (
      /** @class */
      function() {
        function FilteredList2(array4, filterText) {
          this.all = array4;
          this.filtered = array4;
          this.filterText = filterText || "";
          this.exactMatch = false;
          this.ignoreCaption = false;
        }
        FilteredList2.prototype.setFilter = function(str) {
          if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
            var matches = this.filtered;
          else
            var matches = this.all;
          this.filterText = str;
          matches = this.filterCompletions(matches, this.filterText);
          matches = matches.sort(function(a2, b2) {
            return b2.exactMatch - a2.exactMatch || b2.$score - a2.$score || (a2.caption || a2.value).localeCompare(b2.caption || b2.value);
          });
          var prev2 = null;
          matches = matches.filter(function(item) {
            var caption = item.snippet || item.caption || item.value;
            if (caption === prev2)
              return false;
            prev2 = caption;
            return true;
          });
          this.filtered = matches;
        };
        FilteredList2.prototype.filterCompletions = function(items, needle) {
          var results = [];
          var upper = needle.toUpperCase();
          var lower = needle.toLowerCase();
          loop:
            for (var i2 = 0, item; item = items[i2]; i2++) {
              if (item.skipFilter) {
                item.$score = item.score;
                results.push(item);
                continue;
              }
              var caption = !this.ignoreCaption && item.caption || item.value || item.snippet;
              if (!caption)
                continue;
              var lastIndex = -1;
              var matchMask = 0;
              var penalty = 0;
              var index2, distance2;
              if (this.exactMatch) {
                if (needle !== caption.substr(0, needle.length))
                  continue loop;
              } else {
                var fullMatchIndex = caption.toLowerCase().indexOf(lower);
                if (fullMatchIndex > -1) {
                  penalty = fullMatchIndex;
                } else {
                  for (var j2 = 0; j2 < needle.length; j2++) {
                    var i1 = caption.indexOf(lower[j2], lastIndex + 1);
                    var i22 = caption.indexOf(upper[j2], lastIndex + 1);
                    index2 = i1 >= 0 ? i22 < 0 || i1 < i22 ? i1 : i22 : i22;
                    if (index2 < 0)
                      continue loop;
                    distance2 = index2 - lastIndex - 1;
                    if (distance2 > 0) {
                      if (lastIndex === -1)
                        penalty += 10;
                      penalty += distance2;
                      matchMask = matchMask | 1 << j2;
                    }
                    lastIndex = index2;
                  }
                }
              }
              item.matchMask = matchMask;
              item.exactMatch = penalty ? 0 : 1;
              item.$score = (item.score || 0) - penalty;
              results.push(item);
            }
          return results;
        };
        return FilteredList2;
      }()
    );
    exports3.Autocomplete = Autocomplete3;
    exports3.CompletionProvider = CompletionProvider;
    exports3.FilteredList = FilteredList;
  });
  ace.define("ace/marker_group", ["require", "exports", "module"], function(require2, exports3, module3) {
    var MarkerGroup = (
      /** @class */
      function() {
        function MarkerGroup2(session, options) {
          if (options)
            this.markerType = options.markerType;
          this.markers = [];
          this.session = session;
          session.addDynamicMarker(this);
        }
        MarkerGroup2.prototype.getMarkerAtPosition = function(pos) {
          return this.markers.find(function(marker) {
            return marker.range.contains(pos.row, pos.column);
          });
        };
        MarkerGroup2.prototype.markersComparator = function(a2, b2) {
          return a2.range.start.row - b2.range.start.row;
        };
        MarkerGroup2.prototype.setMarkers = function(markers) {
          this.markers = markers.sort(this.markersComparator).slice(0, this.MAX_MARKERS);
          this.session._signal("changeBackMarker");
        };
        MarkerGroup2.prototype.update = function(html2, markerLayer, session, config2) {
          if (!this.markers || !this.markers.length)
            return;
          var visibleRangeStartRow = config2.firstRow, visibleRangeEndRow = config2.lastRow;
          var foldLine;
          var markersOnOneLine = 0;
          var lastRow = 0;
          for (var i2 = 0; i2 < this.markers.length; i2++) {
            var marker = this.markers[i2];
            if (marker.range.end.row < visibleRangeStartRow)
              continue;
            if (marker.range.start.row > visibleRangeEndRow)
              continue;
            if (marker.range.start.row === lastRow) {
              markersOnOneLine++;
            } else {
              lastRow = marker.range.start.row;
              markersOnOneLine = 0;
            }
            if (markersOnOneLine > 200) {
              continue;
            }
            var markerVisibleRange = marker.range.clipRows(visibleRangeStartRow, visibleRangeEndRow);
            if (markerVisibleRange.start.row === markerVisibleRange.end.row && markerVisibleRange.start.column === markerVisibleRange.end.column) {
              continue;
            }
            var screenRange = markerVisibleRange.toScreenRange(session);
            if (screenRange.isEmpty()) {
              foldLine = session.getNextFoldLine(markerVisibleRange.end.row, foldLine);
              if (foldLine && foldLine.end.row > markerVisibleRange.end.row) {
                visibleRangeStartRow = foldLine.end.row;
              }
              continue;
            }
            if (this.markerType === "fullLine") {
              markerLayer.drawFullLineMarker(html2, screenRange, marker.className, config2);
            } else if (screenRange.isMultiLine()) {
              if (this.markerType === "line")
                markerLayer.drawMultiLineMarker(html2, screenRange, marker.className, config2);
              else
                markerLayer.drawTextMarker(html2, screenRange, marker.className, config2);
            } else {
              markerLayer.drawSingleLineMarker(html2, screenRange, marker.className + " ace_br15", config2);
            }
          }
        };
        return MarkerGroup2;
      }()
    );
    MarkerGroup.prototype.MAX_MARKERS = 1e4;
    exports3.MarkerGroup = MarkerGroup;
  });
  ace.define("ace/autocomplete/text_completer", ["require", "exports", "module", "ace/range"], function(require2, exports3, module3) {
    var Range = require2("../range").Range;
    var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
    function getWordIndex(doc, pos) {
      var textBefore = doc.getTextRange(Range.fromPoints({
        row: 0,
        column: 0
      }, pos));
      return textBefore.split(splitRegex).length - 1;
    }
    function wordDistance(doc, pos) {
      var prefixPos = getWordIndex(doc, pos);
      var words = doc.getValue().split(splitRegex);
      var wordScores = /* @__PURE__ */ Object.create(null);
      var currentWord = words[prefixPos];
      words.forEach(function(word, idx) {
        if (!word || word === currentWord)
          return;
        var distance2 = Math.abs(prefixPos - idx);
        var score = words.length - distance2;
        if (wordScores[word]) {
          wordScores[word] = Math.max(score, wordScores[word]);
        } else {
          wordScores[word] = score;
        }
      });
      return wordScores;
    }
    exports3.getCompletions = function(editor, session, pos, prefix, callback2) {
      var wordScore = wordDistance(session, pos);
      var wordList = Object.keys(wordScore);
      callback2(null, wordList.map(function(word) {
        return {
          caption: word,
          value: word,
          score: wordScore[word],
          meta: "local"
        };
      }));
    };
  });
  ace.define("ace/ext/language_tools", ["require", "exports", "module", "ace/snippets", "ace/autocomplete", "ace/config", "ace/lib/lang", "ace/autocomplete/util", "ace/marker_group", "ace/autocomplete/text_completer", "ace/editor", "ace/config"], function(require2, exports3, module3) {
    var snippetManager = require2("../snippets").snippetManager;
    var Autocomplete3 = require2("../autocomplete").Autocomplete;
    var config2 = require2("../config");
    var lang2 = require2("../lib/lang");
    var util2 = require2("../autocomplete/util");
    var MarkerGroup = require2("../marker_group").MarkerGroup;
    var textCompleter = require2("../autocomplete/text_completer");
    var keyWordCompleter = {
      getCompletions: function(editor, session, pos, prefix, callback2) {
        if (session.$mode.completer) {
          return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback2);
        }
        var state = editor.session.getState(pos.row);
        var completions = session.$mode.getCompletions(state, session, pos, prefix);
        completions = completions.map(function(el2) {
          el2.completerId = keyWordCompleter.id;
          return el2;
        });
        callback2(null, completions);
      },
      id: "keywordCompleter"
    };
    var transformSnippetTooltip = function(str) {
      var record = {};
      return str.replace(/\${(\d+)(:(.*?))?}/g, function(_24, p1, p2, p3) {
        return record[p1] = p3 || "";
      }).replace(/\$(\d+?)/g, function(_24, p1) {
        return record[p1];
      });
    };
    var snippetCompleter = {
      getCompletions: function(editor, session, pos, prefix, callback2) {
        var scopes = [];
        var token2 = session.getTokenAt(pos.row, pos.column);
        if (token2 && token2.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/))
          scopes.push("html-tag");
        else
          scopes = snippetManager.getActiveScopes(editor);
        var snippetMap = snippetManager.snippetMap;
        var completions = [];
        scopes.forEach(function(scope) {
          var snippets = snippetMap[scope] || [];
          for (var i2 = snippets.length; i2--; ) {
            var s2 = snippets[i2];
            var caption = s2.name || s2.tabTrigger;
            if (!caption)
              continue;
            completions.push({
              caption,
              snippet: s2.content,
              meta: s2.tabTrigger && !s2.name ? s2.tabTrigger + "⇥ " : "snippet",
              completerId: snippetCompleter.id
            });
          }
        }, this);
        callback2(null, completions);
      },
      getDocTooltip: function(item) {
        if (item.snippet && !item.docHTML) {
          item.docHTML = [
            "<b>",
            lang2.escapeHTML(item.caption),
            "</b>",
            "<hr></hr>",
            lang2.escapeHTML(transformSnippetTooltip(item.snippet))
          ].join("");
        }
      },
      id: "snippetCompleter"
    };
    var completers = [snippetCompleter, textCompleter, keyWordCompleter];
    exports3.setCompleters = function(val) {
      completers.length = 0;
      if (val)
        completers.push.apply(completers, val);
    };
    exports3.addCompleter = function(completer) {
      completers.push(completer);
    };
    exports3.textCompleter = textCompleter;
    exports3.keyWordCompleter = keyWordCompleter;
    exports3.snippetCompleter = snippetCompleter;
    var expandSnippet = {
      name: "expandSnippet",
      exec: function(editor) {
        return snippetManager.expandWithTab(editor);
      },
      bindKey: "Tab"
    };
    var onChangeMode = function(e2, editor) {
      loadSnippetsForMode(editor.session.$mode);
    };
    var loadSnippetsForMode = function(mode) {
      if (typeof mode == "string")
        mode = config2.$modes[mode];
      if (!mode)
        return;
      if (!snippetManager.files)
        snippetManager.files = {};
      loadSnippetFile(mode.$id, mode.snippetFileId);
      if (mode.modes)
        mode.modes.forEach(loadSnippetsForMode);
    };
    var loadSnippetFile = function(id2, snippetFilePath) {
      if (!snippetFilePath || !id2 || snippetManager.files[id2])
        return;
      snippetManager.files[id2] = {};
      config2.loadModule(snippetFilePath, function(m2) {
        if (!m2)
          return;
        snippetManager.files[id2] = m2;
        if (!m2.snippets && m2.snippetText)
          m2.snippets = snippetManager.parseSnippetFile(m2.snippetText);
        snippetManager.register(m2.snippets || [], m2.scope);
        if (m2.includeScopes) {
          snippetManager.snippetMap[m2.scope].includeScopes = m2.includeScopes;
          m2.includeScopes.forEach(function(x2) {
            loadSnippetsForMode("ace/mode/" + x2);
          });
        }
      });
    };
    var doLiveAutocomplete = function(e2) {
      var editor = e2.editor;
      var hasCompleter = editor.completer && editor.completer.activated;
      if (e2.command.name === "backspace") {
        if (hasCompleter && !util2.getCompletionPrefix(editor))
          editor.completer.detach();
      } else if (e2.command.name === "insertstring" && !hasCompleter) {
        lastExecEvent = e2;
        var delay2 = e2.editor.$liveAutocompletionDelay;
        if (delay2) {
          liveAutocompleteTimer.delay(delay2);
        } else {
          showLiveAutocomplete(e2);
        }
      }
    };
    var lastExecEvent;
    var liveAutocompleteTimer = lang2.delayedCall(function() {
      showLiveAutocomplete(lastExecEvent);
    }, 0);
    var showLiveAutocomplete = function(e2) {
      var editor = e2.editor;
      var prefix = util2.getCompletionPrefix(editor);
      var previousChar = e2.args;
      var triggerAutocomplete = util2.triggerAutocomplete(editor, previousChar);
      if (prefix && prefix.length >= editor.$liveAutocompletionThreshold || triggerAutocomplete) {
        var completer = Autocomplete3.for(editor);
        completer.autoShown = true;
        completer.showPopup(editor);
      }
    };
    var Editor2 = require2("../editor").Editor;
    require2("../config").defineOptions(Editor2.prototype, "editor", {
      enableBasicAutocompletion: {
        set: function(val) {
          if (val) {
            Autocomplete3.for(this);
            if (!this.completers)
              this.completers = Array.isArray(val) ? val : completers;
            this.commands.addCommand(Autocomplete3.startCommand);
          } else {
            this.commands.removeCommand(Autocomplete3.startCommand);
          }
        },
        value: false
      },
      enableLiveAutocompletion: {
        set: function(val) {
          if (val) {
            if (!this.completers)
              this.completers = Array.isArray(val) ? val : completers;
            this.commands.on("afterExec", doLiveAutocomplete);
          } else {
            this.commands.off("afterExec", doLiveAutocomplete);
          }
        },
        value: false
      },
      liveAutocompletionDelay: {
        initialValue: 0
      },
      liveAutocompletionThreshold: {
        initialValue: 0
      },
      enableSnippets: {
        set: function(val) {
          if (val) {
            this.commands.addCommand(expandSnippet);
            this.on("changeMode", onChangeMode);
            onChangeMode(null, this);
          } else {
            this.commands.removeCommand(expandSnippet);
            this.off("changeMode", onChangeMode);
          }
        },
        value: false
      }
    });
    exports3.MarkerGroup = MarkerGroup;
  });
  (function() {
    ace.require(["ace/ext/language_tools"], function(m2) {
      if (module2) {
        module2.exports = m2;
      }
    });
  })();
})(extLanguage_tools);
const colors = {
  color: getComputedStyle(document.body).getPropertyValue("color")
};
const MultilevelData = ({ options: propOptions, onChange }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propOptions ?? {});
  const [editingKey, setEditingKey] = reactExports.useState();
  const [expandKeys, setExpandKeys] = reactExports.useState(
    (_a2 = options.data) == null ? void 0 : _a2.map((d2) => d2.value)
  );
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
    onChange == null ? void 0 : onChange(newOptions);
  };
  const buildTreeDataSource = (data2) => {
    const ret = [];
    for (const md2 of data2) {
      const td2 = {
        selectable: false,
        checkable: false,
        disableCheckbox: true,
        title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            ColorPicker$1,
            {
              color: md2.color ?? colors.color,
              onChange: (c2) => {
                md2.color = buildColorValueString(c2);
                patchOptions({ ...options });
              }
            }
          ),
          editingKey == md2.value ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              size: "sm",
              value: md2.label,
              variant: "flat",
              onBlur: () => {
                setEditingKey(void 0);
              },
              onValueChange: (v2) => {
                md2.label = v2;
                patchOptions({ ...options });
              }
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                setEditingKey(md2.value);
              },
              children: md2.label
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                md2.children ?? (md2.children = []);
                md2.children.push({
                  value: uuidv4(),
                  label: buildUntitledLabel(
                    t2("Untitled"),
                    md2.children.map((c2) => c2.label)
                  )
                });
                patchOptions({ ...options });
                const newExpandedKeys = expandKeys ?? [];
                if (!newExpandedKeys.includes(md2.value)) {
                  newExpandedKeys.push(md2.value);
                }
                setExpandKeys([...newExpandedKeys]);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-small" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                data2.splice(data2.indexOf(md2), 1);
                patchOptions({ ...options });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-small" })
            }
          )
        ] }),
        key: md2.value,
        children: md2.children ? buildTreeDataSource(md2.children) : void 0
      };
      ret.push(td2);
    }
    return ret;
  };
  const data = options.data ? buildTreeDataSource(options.data) : [];
  console.log(options);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onPress: () => {
          options.data ?? (options.data = []);
          patchOptions({
            data: options.data.concat([
              {
                value: uuidv4(),
                label: buildUntitledLabel(
                  t2("Untitled"),
                  options.data.map((c2) => c2.label)
                )
              }
            ])
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-small" }),
          t2("Add root data")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tree,
      {
        showLine: true,
        checkable: false,
        expandedKeys: expandKeys,
        selectable: false,
        treeData: data,
        onExpand: (keys2, { expanded }) => {
          setExpandKeys(
            expanded ? _$2.union(expandKeys, keys2) : _$2.intersection(expandKeys, keys2)
          );
        }
      }
    )
  ] });
};
MultilevelData.displayName = "MultilevelData";
const qqGroupImg = "/assets/qq-group-D_wH-SpU.png";
const FeatureStatusTip = ({ name: name2, status, className, url: url2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  console.log(name2);
  const renderText2 = reactExports.useCallback(() => {
    let i18nKey;
    switch (status) {
      case "developing":
        i18nKey = "FeatureRequestTip.Developing";
        break;
      case "deprecated":
        i18nKey = "FeatureRequestTip.Deprecated";
        break;
      case "deprecating":
        i18nKey = "FeatureRequestTip.Deprecating";
        break;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey, values: { name: name2 }, children: [
      "The",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold px-1", children: "name" }),
      "feature is under development. You can urge the author or make suggestions on",
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        ExternalLink,
        {
          className: "px-1",
          href: "https://github.com/anobaka/InsideWorld",
          children: "Github"
        }
      ),
      "or",
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          className: "cursor-pointer",
          classNames: { content: "px-0" },
          color: "primary",
          variant: "light",
          onClick: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Join QQ group"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "Qrcode for qq group", src: qqGroupImg }),
              footer: {
                actions: ["ok"]
              }
            });
          },
          children: "QQ group"
        }
      ),
      "."
    ] });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `italic opacity-80 whitespace-break-spaces ${className}`, children: [
    renderText2(),
    url2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      t2("For more information, you can visit:"),
      /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "px-1", href: url2, children: url2 })
    ] })
  ] });
};
FeatureStatusTip.displayName = "FeatureStatusTip";
const DragHandle = (props) => {
  const { style: style2 = {}, className, ...otherProps } = props || {};
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    chip_default,
    {
      className: `drag-handle ${className || ""} cursor-pointer opacity-80 hover:opacity-100`,
      size: "sm",
      style: { cursor: "all-scroll", ...style2 },
      title: t2("Drag to sort"),
      variant: "light",
      ...otherProps || {},
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDragIndicator, { className: "text-lg" })
    }
  );
};
DragHandle.displayName = "DragHandle";
function SortableChoice({
  id: id2,
  choice: propsChoice,
  onRemove,
  onChange,
  style: propsStyle,
  checkUsage,
  onEnterKeyDown
}) {
  const { t: t2 } = useTranslation();
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: id2 });
  const { createPortal } = useBakabaseContext();
  const [choice, setChoice] = reactExports.useState(propsChoice);
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    onChange == null ? void 0 : onChange(choice);
  }, [choice]);
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    ...propsStyle
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: setNodeRef, className: "flex gap-1 items-center", style: style2, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ColorPicker$1,
      {
        color: choice.color ?? colors.color,
        onChange: (color2) => {
          setChoice({
            ...choice,
            color: buildColorValueString(color2)
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        autoFocus: !choice.label,
        size: "sm",
        value: choice == null ? void 0 : choice.label,
        onKeyDown: (e2) => {
          if (e2.key === "Enter") {
            onEnterKeyDown == null ? void 0 : onEnterKeyDown();
          }
        },
        onValueChange: (label) => {
          setChoice({
            ...choice,
            label
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          radius: "sm",
          size: "sm",
          title: t2("Hide in view"),
          variant: "light",
          onClick: () => {
            setChoice({
              ...choice,
              hide: !choice.hide
            });
          },
          children: choice.hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1a, { className: "text-base" })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          radius: "sm",
          size: "sm",
          variant: "light",
          onClick: async () => {
            if (checkUsage) {
              const count = await checkUsage(choice.value);
              if (count > 0) {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "sm",
                  title: t2(
                    "Value is being referenced in {{count}} places",
                    { count }
                  ),
                  children: t2("Sure to delete?"),
                  onOk: async () => {
                    onRemove == null ? void 0 : onRemove(choice);
                  }
                });
                return;
              }
            }
            onRemove == null ? void 0 : onRemove(choice);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
        }
      )
    ] })
  ] });
}
const lineHeight = 35;
function ChoiceList({
  choices: propsChoices,
  onChange,
  className,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const [choices, setChoices] = reactExports.useState(propsChoices || []);
  const [editInBulkPopupVisible, setEditInBulkPopupVisible] = reactExports.useState(false);
  const [editInBulkText, setEditInBulkText] = reactExports.useState("");
  const [bulkEditSummaries, setBulkEditSummaries] = reactExports.useState([]);
  const calculateBulkEditSummaryTimeoutRef = reactExports.useRef();
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const virtualListRef = reactExports.useRef();
  reactExports.useEffect(() => {
    onChange == null ? void 0 : onChange(choices);
  }, [choices]);
  const buildChoicesFromBulkText = (text2) => {
    return text2.split("\n").map((c2) => {
      const str = c2.trim();
      if (str.length == 0) {
        return null;
      }
      const t22 = choices.find((x2) => x2.label == str);
      if (t22) {
        return t22;
      }
      return {
        label: str,
        value: uuidv4()
      };
    }).filter((x2) => x2 != null);
  };
  const calculateBulkEditSummary = (text2) => {
    const ctxChoices = buildChoicesFromBulkText(text2);
    const addedChoicesCount = ctxChoices.filter(
      (x2) => !choices.includes(x2)
    ).length;
    const sameChoicesCount = ctxChoices.filter(
      (x2) => choices.includes(x2)
    ).length;
    const deletedChoicesCount = choices.length - sameChoicesCount;
    if (deletedChoicesCount > 0 || addedChoicesCount > 0) {
      const tips = [
        deletedChoicesCount > 0 ? t2("{{count}} data will be deleted", {
          count: deletedChoicesCount
        }) : "",
        addedChoicesCount > 0 ? t2("{{count}} data will be added", {
          count: addedChoicesCount
        }) : ""
      ];
      setBulkEditSummaries(tips.filter((t22) => t22));
    } else {
      setBulkEditSummaries([]);
    }
  };
  const addChoice = () => {
    const newChoices = [...choices, { label: "", value: uuidv4() }];
    setChoices(newChoices);
    setTimeout(() => {
      var _a2;
      (_a2 = virtualListRef.current) == null ? void 0 : _a2.scrollToRow(newChoices.length - 1);
    }, 100);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onClick: () => {
          choices.sort(
            (a2, b2) => (a2.label || "").localeCompare(b2.label || "")
          );
          setChoices([...choices]);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSort, { className: "text-base" }),
          t2("Sort by alphabet")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 mb-2 flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      DndContext,
      {
        collisionDetection: closestCenter,
        sensors,
        onDragEnd: handleDragEnd,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          SortableContext$1,
          {
            items: choices == null ? void 0 : choices.map((c2) => ({ ...c2, id: c2.value })),
            strategy: verticalListSortingStrategy,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: Math.min(choices.length, 6) * lineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              List,
              {
                ref: virtualListRef,
                height,
                rowCount: choices.length,
                rowHeight: lineHeight,
                rowRenderer: (ctx) => {
                  const { key, index: index2, style: style2 } = ctx;
                  const sc2 = choices[index2];
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    SortableChoice,
                    {
                      choice: sc2,
                      style: style2,
                      onChange: (t22) => {
                        choices[index2] = t22;
                        setChoices([...choices]);
                      },
                      onEnterKeyDown: () => {
                        addChoice();
                      },
                      onRemove: (t22) => {
                        choices.splice(index2, 1);
                        setChoices([...choices]);
                      },
                      checkUsage,
                      id: sc2.value
                    },
                    sc2.value
                  );
                },
                width
              }
            ) }) })
          }
        )
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          onClick: () => {
            addChoice();
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(MdAddCircle, { className: "text-base" }),
            t2("Add a choice")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          placement: "right",
          size: "lg",
          style: { zIndex: 100 },
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", children: t2("Add or delete in bulk") }),
          visible: editInBulkPopupVisible,
          onVisibleChange: (v2) => {
            if (v2) {
              const text2 = choices.map((t22) => t22.label).join("\n");
              setEditInBulkText(text2);
            }
            setEditInBulkPopupVisible(v2);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 m-2 ", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: t2("Add or delete choices in bulk") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm opacity-70", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Choices will be separated by line breaks.") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Once you click the submit button, new choices will be added to the list, and missing choices will be deleted."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Be cautions: once you modify the text in one line, it will be treated as a new choice, and the original choice will be deleted."
              ) })
            ] }),
            bulkEditSummaries.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 text-sm", children: bulkEditSummaries.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: s2 })) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                onValueChange: (v2) => {
                  setEditInBulkText(v2);
                  calculateBulkEditSummaryTimeoutRef.current && clearTimeout(calculateBulkEditSummaryTimeoutRef.current);
                  calculateBulkEditSummaryTimeoutRef.current = setTimeout(() => {
                    calculateBulkEditSummary(v2);
                    calculateBulkEditSummaryTimeoutRef.current = void 0;
                  }, 1e3);
                },
                value: editInBulkText,
                maxRows: 16
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  isLoading: !!calculateBulkEditSummaryTimeoutRef.current,
                  size: "sm",
                  onClick: () => {
                    setChoices(buildChoicesFromBulkText(editInBulkText));
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Submit")
                }
              )
            ] })
          ] })
        }
      )
    ] })
  ] });
  function handleDragEnd(event) {
    const { active: active3, over } = event;
    if (active3.value !== over.value) {
      setChoices((items) => {
        const oldIndex = items.indexOf(active3.value);
        const newIndex = items.indexOf(over.value);
        return arrayMove(items, oldIndex, newIndex);
      });
    }
  }
}
function SortableTag({
  id: id2,
  tag: propsTag,
  onRemove,
  onChange,
  style: propsStyle,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const { attributes: attributes2, listeners, setNodeRef, transform: transform2, transition: transition3 } = useSortable({ id: id2 });
  const { createPortal } = useBakabaseContext();
  const [tag, setTag2] = reactExports.useState(propsTag);
  reactExports.useEffect(() => {
  }, []);
  useUpdateEffect(() => {
    onChange == null ? void 0 : onChange(tag);
  }, [tag]);
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    ...propsStyle
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: setNodeRef, className: "flex gap-1 items-center", style: style2, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ColorPicker$1,
      {
        color: tag.color ?? colors.color,
        onChange: (color2) => {
          setTag2({
            ...tag,
            color: buildColorValueString(color2)
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        placeholder: t2("Group of tag, optional"),
        size: "sm",
        value: tag == null ? void 0 : tag.group,
        onValueChange: (group) => {
          setTag2({
            ...tag,
            group
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        placeholder: t2("Name of tag, required"),
        size: "sm",
        value: tag == null ? void 0 : tag.name,
        onValueChange: (name2) => {
          setTag2({
            ...tag,
            name: name2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          radius: "sm",
          size: "sm",
          title: t2("Hide in view"),
          variant: "light",
          onClick: () => {
            setTag2({
              ...tag,
              hide: !tag.hide
            });
          },
          children: tag.hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1a, { className: "text-base" })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          radius: "sm",
          size: "sm",
          variant: "light",
          onClick: async () => {
            if (checkUsage) {
              const count = await checkUsage(tag.value);
              if (count > 0) {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "sm",
                  title: t2(
                    "Value is being referenced in {{count}} places",
                    { count }
                  ),
                  children: t2("Sure to delete?"),
                  onOk: async () => {
                    onRemove == null ? void 0 : onRemove(tag);
                  }
                });
                return;
              }
            }
            onRemove == null ? void 0 : onRemove(tag);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
        }
      )
    ] })
  ] });
}
const LineHeight = 35;
const GroupAndNameSeparator = ":";
function TagList({
  tags: propsTags,
  onChange,
  className,
  checkUsage
}) {
  const { t: t2 } = useTranslation();
  const [tags, setTags] = reactExports.useState(propsTags || []);
  const [editInBulkPopupVisible, setEditInBulkPopupVisible] = reactExports.useState(false);
  const [editInBulkText, setEditInBulkText] = reactExports.useState("");
  const [bulkEditSummaries, setBulkEditSummaries] = reactExports.useState([]);
  const calculateBulkEditSummaryTimeoutRef = reactExports.useRef();
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const virtualListRef = reactExports.useRef();
  reactExports.useEffect(() => {
    onChange == null ? void 0 : onChange(tags);
  }, [tags]);
  const buildTagsFromBulkText = (text2) => {
    return text2.split("\n").map((c2) => {
      const str = c2.trim();
      if (str.length == 0) {
        return null;
      }
      const segments = str.split(GroupAndNameSeparator);
      let name2 = "";
      let group;
      if (segments.length == 1) {
        name2 = segments[0];
      } else {
        group = segments[0];
        name2 = segments[1];
      }
      const t22 = tags.find((x2) => x2.name == name2 && x2.group == group);
      if (t22) {
        return t22;
      }
      return {
        group,
        name: name2,
        value: uuidv4()
      };
    }).filter((x2) => x2 != null);
  };
  const calculateBulkEditSummary = (text2) => {
    const ctxTags = buildTagsFromBulkText(text2);
    const addedTagsCount = ctxTags.filter((x2) => !tags.includes(x2)).length;
    const sameTagsCount = ctxTags.filter((x2) => tags.includes(x2)).length;
    const deletedTagsCount = tags.length - sameTagsCount;
    if (deletedTagsCount > 0 || addedTagsCount > 0) {
      const tips = [
        deletedTagsCount > 0 ? t2("{{count}} data will be deleted", {
          count: deletedTagsCount
        }) : "",
        addedTagsCount > 0 ? t2("{{count}} data will be added", { count: addedTagsCount }) : ""
      ];
      setBulkEditSummaries(tips.filter((t22) => t22));
    } else {
      setBulkEditSummaries([]);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onPress: () => {
          tags.sort((a2, b2) => {
            const sa2 = a2.group ? `${a2.group}:${b2.name}` : b2.name;
            const sb2 = b2.group ? `${b2.group}:${b2.name}` : b2.name;
            return (sa2 ?? "").localeCompare(sb2 ?? "");
          });
          setTags([...tags]);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdSort, { className: "text-base" }),
          t2("Sort by alphabet")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 mb-2 flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      DndContext,
      {
        collisionDetection: closestCenter,
        sensors,
        onDragEnd: handleDragEnd,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          SortableContext$1,
          {
            items: tags == null ? void 0 : tags.map((c2) => ({
              ...c2,
              id: c2.value
            })),
            strategy: verticalListSortingStrategy,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: Math.min(tags.length, 6) * LineHeight }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              List,
              {
                ref: virtualListRef,
                height,
                rowCount: tags.length,
                rowHeight: LineHeight,
                rowRenderer: (ctx) => {
                  const { key, index: index2, style: style2 } = ctx;
                  const sc2 = tags[index2];
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    SortableTag,
                    {
                      checkUsage,
                      id: sc2.value,
                      style: style2,
                      tag: sc2,
                      onChange: (t22) => {
                        tags[index2] = t22;
                        setTags([...tags]);
                      },
                      onRemove: (t22) => {
                        tags.splice(index2, 1);
                        setTags([...tags]);
                      }
                    },
                    sc2.value
                  );
                },
                width
              }
            ) }) })
          }
        )
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          onClick: () => {
            const newTags = [...tags, { value: uuidv4() }];
            setTags(newTags);
            setTimeout(() => {
              var _a2;
              (_a2 = virtualListRef.current) == null ? void 0 : _a2.scrollToRow(newTags.length - 1);
            }, 100);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(MdAddCircle, { className: "text-base" }),
            t2("Add a choice")
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          placement: "right",
          size: "lg",
          style: { zIndex: 100 },
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "light", children: t2("Add or delete in bulk") }),
          visible: editInBulkPopupVisible,
          onVisibleChange: (v2) => {
            if (v2) {
              const text2 = tags.map((t22) => {
                let s2 = "";
                if (t22.group != void 0 && t22.group.length > 0) {
                  s2 += t22.group + GroupAndNameSeparator;
                }
                s2 += t22.name;
                return s2;
              }).join("\n");
              setEditInBulkText(text2);
            }
            setEditInBulkPopupVisible(v2);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 m-2 ", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: t2("Add or delete tags in bulk") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm opacity-70", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Colon can be added between group and name, and tags will be separated by line breaks."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Once you click the submit button, new tags will be added to the list, and missing tags will be deleted."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Be cautions: once you modify the text in one line, it will be treated as a new tag, and the original tag will be deleted."
              ) })
            ] }),
            bulkEditSummaries.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 text-sm", children: bulkEditSummaries.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: s2 })) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                onValueChange: (v2) => {
                  setEditInBulkText(v2);
                  calculateBulkEditSummaryTimeoutRef.current && clearTimeout(calculateBulkEditSummaryTimeoutRef.current);
                  calculateBulkEditSummaryTimeoutRef.current = setTimeout(() => {
                    calculateBulkEditSummary(v2);
                    calculateBulkEditSummaryTimeoutRef.current = void 0;
                  }, 1e3);
                },
                value: editInBulkText,
                maxRows: 16
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  isLoading: !!calculateBulkEditSummaryTimeoutRef.current,
                  size: "sm",
                  onClick: () => {
                    setTags(buildTagsFromBulkText(editInBulkText));
                    setEditInBulkPopupVisible(false);
                  },
                  children: t2("Submit")
                }
              )
            ] })
          ] })
        }
      )
    ] })
  ] });
  function handleDragEnd(event) {
    const { active: active3, over } = event;
    if (active3.value !== over.value) {
      setTags((items) => {
        const oldIndex = items.indexOf(active3.value);
        const newIndex = items.indexOf(over.value);
        return arrayMove(items, oldIndex, newIndex);
      });
    }
  }
}
const optimizeOptions = (options) => {
  if (!options) {
    return {};
  }
  if (options.choices) {
    options.choices = options.choices.map((c2) => {
      var _a2;
      return {
        ...c2,
        label: (_a2 = c2.label) == null ? void 0 : _a2.trim()
      };
    });
  }
  if (options.tags) {
    options.tags = options.tags.map((t2) => {
      var _a2, _b2;
      return {
        ...t2,
        name: (_a2 = t2.name) == null ? void 0 : _a2.trim(),
        group: (_b2 = t2.group) == null ? void 0 : _b2.trim()
      };
    });
  }
  return {
    ...options,
    choices: options.choices || [],
    tags: options.tags || []
  };
};
function GrInstallOption(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,18 L12,8 L12,18 Z M12,23 C18.0751322,23 23,18.0751322 23,12 C23,5.92486775 18.0751322,1 12,1 C5.92486775,1 1,5.92486775 1,12 C1,18.0751322 5.92486775,23 12,23 Z M17,12 L12,7 L7,12", "transform": "matrix(1 0 0 -1 0 24)" }, "child": [] }] })(props);
}
function GrResources(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M12,3 L21,7.5 L12,12 L3,7.5 L12,3 Z M16.5,10.25 L21,12.5 L12,17 L3,12.5 L7.5,10.25 L7.5,10.25 M16.5,15.25 L21,17.5 L12,22 L3,17.5 L7.5,15.25 L7.5,15.25" }, "child": [] }] })(props);
}
function GrResume(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M1,20 L6,20 L6,4 L1,4 L1,20 Z M11,19.0000002 L22,12 L11,5 L11,19.0000002 Z" }, "child": [] }] })(props);
}
function GrTextWrap(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeWidth": "2", "d": "M17,10 L24,10 L17,10 L17,10 Z M1,14 L14,14 L14,2 L1,2 L1,14 Z M6,6 C6,6.5525 5.5525,7 5,7 C4.4475,7 4,6.5525 4,6 C4,5.4475 4.4475,5 5,5 C5.5525,5 6,5.4475 6,6 M17,6 L24,6 L17,6 L17,6 Z M17,2 L24,2 L17,2 L17,2 Z M17,14 L24,14 L17,14 L17,14 Z M0,18 L24,18 L0,18 L0,18 Z M0,22 L24,22 L0,22 L0,22 Z M14,14 L14,13 L10,8 L7,11 L6,10 L2,14 L14,14 Z" }, "child": [] }] })(props);
}
function FaImages(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M160 32c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H160zM396 138.7l96 144c4.9 7.4 5.4 16.8 1.2 24.6S480.9 320 472 320H328 280 200c-9.2 0-17.6-5.3-21.6-13.6s-2.9-18.2 2.9-25.4l64-80c4.6-5.7 11.4-9 18.7-9s14.2 3.3 18.7 9l17.3 21.6 56-84C360.5 132 368 128 376 128s15.5 4 20 10.7zM192 128a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zM48 120c0-13.3-10.7-24-24-24S0 106.7 0 120V344c0 75.1 60.9 136 136 136H456c13.3 0 24-10.7 24-24s-10.7-24-24-24H136c-48.6 0-88-39.4-88-88V120z" }, "child": [] }] })(props);
}
function FaRankingStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 640 512" }, "child": [{ "tag": "path", "attr": { "d": "M353.8 54.1L330.2 6.3c-3.9-8.3-16.1-8.6-20.4 0L286.2 54.1l-52.3 7.5c-9.3 1.4-13.3 12.9-6.4 19.8l38 37-9 52.1c-1.4 9.3 8.2 16.5 16.8 12.2l46.9-24.8 46.6 24.4c8.6 4.3 18.3-2.9 16.8-12.2l-9-52.1 38-36.6c6.8-6.8 2.9-18.3-6.4-19.8l-52.3-7.5zM256 256c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V288c0-17.7-14.3-32-32-32H256zM32 320c-17.7 0-32 14.3-32 32V480c0 17.7 14.3 32 32 32H160c17.7 0 32-14.3 32-32V352c0-17.7-14.3-32-32-32H32zm416 96v64c0 17.7 14.3 32 32 32H608c17.7 0 32-14.3 32-32V416c0-17.7-14.3-32-32-32H480c-17.7 0-32 14.3-32 32z" }, "child": [] }] })(props);
}
function FaRegCircleCheck(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z" }, "child": [] }] })(props);
}
function FaRegCirclePause(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm224-72V328c0 13.3-10.7 24-24 24s-24-10.7-24-24V184c0-13.3 10.7-24 24-24s24 10.7 24 24zm112 0V328c0 13.3-10.7 24-24 24s-24-10.7-24-24V184c0-13.3 10.7-24 24-24s24 10.7 24 24z" }, "child": [] }] })(props);
}
function FaRegStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M287.9 0c9.2 0 17.6 5.2 21.6 13.5l68.6 141.3 153.2 22.6c9 1.3 16.5 7.6 19.3 16.3s.5 18.1-5.9 24.5L433.6 328.4l26.2 155.6c1.5 9-2.2 18.1-9.7 23.5s-17.3 6-25.3 1.7l-137-73.2L151 509.1c-8.1 4.3-17.9 3.7-25.3-1.7s-11.2-14.5-9.7-23.5l26.2-155.6L31.1 218.2c-6.5-6.4-8.7-15.9-5.9-24.5s10.3-14.9 19.3-16.3l153.2-22.6L266.3 13.5C270.4 5.2 278.7 0 287.9 0zm0 79L235.4 187.2c-3.5 7.1-10.2 12.1-18.1 13.3L99 217.9 184.9 303c5.5 5.5 8.1 13.3 6.8 21L171.4 443.7l105.2-56.2c7.1-3.8 15.6-3.8 22.6 0l105.2 56.2L384.2 324.1c-1.3-7.7 1.2-15.5 6.8-21l85.9-85.1L358.6 200.5c-7.8-1.2-14.6-6.1-18.1-13.3L287.9 79z" }, "child": [] }] })(props);
}
function CiCircleList(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Circle_List" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "path", "attr": { "d": "M20.438,6.062h-9a.5.5,0,0,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20.438,12.5h-9a.5.5,0,0,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M20.438,18.935h-9a.5.5,0,1,1,0-1h9a.5.5,0,0,1,0,1Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,8.062a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,8.062Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,4.062Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,14.5a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,14.5Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,10.5Z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5.562,20.938a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,5.562,20.938Zm0-4a1.5,1.5,0,1,0,1.5,1.5A1.5,1.5,0,0,0,5.562,16.938Z" }, "child": [] }] }] }] })(props);
}
function CiCircleMore(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Circle_More" }, "child": [{ "tag": "g", "attr": {}, "child": [{ "tag": "circle", "attr": { "cx": "12.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "16.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "circle", "attr": { "cx": "8.001", "cy": "12", "r": "1" }, "child": [] }, { "tag": "path", "attr": { "d": "M12,21.932A9.934,9.934,0,1,1,21.934,12,9.944,9.944,0,0,1,12,21.932ZM12,3.065A8.934,8.934,0,1,0,20.934,12,8.944,8.944,0,0,0,12,3.065Z" }, "child": [] }] }] }] })(props);
}
function CiFilter(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "g", "attr": { "id": "Filter" }, "child": [{ "tag": "path", "attr": { "d": "M14.037,20.937a1.015,1.015,0,0,1-.518-.145l-3.334-2a2.551,2.551,0,0,1-1.233-2.176V12.091a1.526,1.526,0,0,0-.284-.891L4.013,4.658a1.01,1.01,0,0,1,.822-1.6h14.33a1.009,1.009,0,0,1,.822,1.6h0L15.332,11.2a1.527,1.527,0,0,0-.285.891v7.834a1.013,1.013,0,0,1-1.01,1.012ZM4.835,4.063,9.482,10.62a2.515,2.515,0,0,1,.47,1.471v4.524a1.543,1.543,0,0,0,.747,1.318l3.334,2,.014-7.843a2.516,2.516,0,0,1,.471-1.471l4.654-6.542,0,0Z" }, "child": [] }] }] })(props);
}
const PropertyTypeIconMap = {
  [PropertyType.SingleLineText]: MdOutlineTextFormat,
  [PropertyType.MultilineText]: GrTextWrap,
  [PropertyType.SingleChoice]: TbSelect,
  [PropertyType.MultipleChoice]: CiCircleList,
  [PropertyType.Multilevel]: PiTreeView,
  [PropertyType.Number]: TbNumber123,
  [PropertyType.Percentage]: MdOutlinePercent,
  [PropertyType.Rating]: FaRegStar,
  [PropertyType.Boolean]: MdOutlineCheckBox,
  [PropertyType.Link]: LuLink,
  [PropertyType.Attachment]: PiImages,
  [PropertyType.Formula]: RiFormula,
  [PropertyType.Time]: MdOutlineAccessTime,
  [PropertyType.Date]: LuCalendarDays,
  [PropertyType.DateTime]: LuCalendarClock,
  [PropertyType.Tags]: LuTags
};
const PropertyTypeIcon = ({
  type: type4,
  textVariant = "default",
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const Icon2 = type4 ? PropertyTypeIconMap[type4] : AiOutlineQuestionCircle;
  const typeName = type4 ? t2(getEnumKey("PropertyType", PropertyType[type4])) : t2("common.state.unknown");
  switch (textVariant) {
    case "none":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props });
    case "default":
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs", children: typeName })
      ] });
    case "tooltip":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "foreground", content: typeName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base", ...props }) });
  }
};
PropertyTypeIcon.displayName = "PropertyTypeIcon";
const UnderDevelopmentGroupKey = "UnderDevelopment";
const PropertyTypeGroup = {
  Text: [
    PropertyType.SingleLineText,
    PropertyType.MultilineText,
    PropertyType.Link
  ],
  Number: [PropertyType.Number, PropertyType.Percentage, PropertyType.Rating],
  Option: [
    PropertyType.SingleChoice,
    PropertyType.MultipleChoice,
    PropertyType.Multilevel
  ],
  DateTime: [PropertyType.DateTime, PropertyType.Date, PropertyType.Time],
  Other: [PropertyType.Attachment, PropertyType.Boolean, PropertyType.Tags],
  [UnderDevelopmentGroupKey]: [PropertyType.Formula]
};
const NumberPrecisions = [0, 1, 2, 3, 4].map((x2) => ({
  value: x2,
  label: Number(1).toFixed(x2)
}));
const RatingMaxValueDataSource = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((x2) => ({
  value: x2,
  label: x2
}));
buildLogger("ModalContent");
const ModalContent = ({ validValueTypes, value: value2, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const [typeGroupsVisible, settypeGroupsVisible] = reactExports.useState(false);
  const typePopoverDomRef = reactExports.useRef(null);
  const [property2, setProperty3] = reactExports.useState(
    JSON.parse(
      JSON.stringify({
        ...value2 || {},
        options: optimizeOptions(value2 == null ? void 0 : value2.options)
      })
    )
  );
  const checkValueUsage = property2.id ? async (value22) => {
    const rsp = await BApi$1.customProperty.getCustomPropertyValueUsage(
      property2.id,
      { value: value22 }
    );
    return rsp.data;
  } : void 0;
  const renderOptions = () => {
    if (property2.type != void 0) {
      switch (property2.type) {
        case PropertyType.SingleLineText:
        case PropertyType.MultilineText:
          break;
        case PropertyType.SingleChoice:
        case PropertyType.MultipleChoice: {
          const options = property2.options;
          const multiple = property2.type === PropertyType.MultipleChoice;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ChoiceList,
              {
                checkUsage: checkValueUsage,
                choices: options == null ? void 0 : options.choices,
                className: "mt-4",
                onChange: (choices) => {
                  patchProperty({
                    options: {
                      ...options,
                      choices
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                className: "mt-2",
                dataSource: options == null ? void 0 : options.choices,
                label: t2("Default value"),
                selectedKeys: (options == null ? void 0 : options.defaultValue) ? multiple ? options.defaultValue : [options.defaultValue] : void 0,
                selectionMode: multiple ? "multiple" : "single",
                size: "sm",
                onSelectionChange: (c2) => {
                  const array4 = Array.from(c2.values());
                  patchProperty({
                    options: {
                      ...options,
                      defaultValue: multiple ? array4 : array4[0]
                    }
                  });
                }
              }
            )
          ] });
        }
        case PropertyType.Number: {
          const options = property2.options ?? {};
          const previewValue = 80;
          const previewValueStr = Number(previewValue).toFixed(
            (options == null ? void 0 : options.precision) || 0
          );
          options.precision ?? (options.precision = 0);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: NumberPrecisions,
                label: t2("Precision"),
                selectedKeys: [options.precision.toString()],
                onSelectionChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      precision: Number(c2.values().next().value)
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                disabled: true,
                label: t2("Preview"),
                value: previewValueStr
              }
            )
          ] });
        }
        case PropertyType.Percentage: {
          const options = property2.options ?? {};
          const previewValue = 80;
          const previewValueStr = `${Number(previewValue).toFixed((options == null ? void 0 : options.precision) || 0)}%`;
          options.precision ?? (options.precision = 0);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: NumberPrecisions,
                label: t2("Precision"),
                selectedKeys: [options.precision.toString()],
                onSelectionChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      precision: Number(c2.values().next().value)
                    }
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              switch_default,
              {
                isSelected: options == null ? void 0 : options.showProgressbar,
                size: "sm",
                onValueChange: (c2) => {
                  patchProperty({
                    options: {
                      ...options,
                      showProgressbar: c2
                    }
                  });
                },
                children: t2("Show progressbar")
              }
            ),
            (options == null ? void 0 : options.showProgressbar) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Preview") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                progress_default,
                {
                  className: "max-w-[70%]",
                  label: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[color:var(--bakaui-color)]", children: previewValueStr }),
                  value: previewValue
                }
              )
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                disabled: true,
                label: t2("Preview"),
                value: previewValueStr
              }
            )
          ] });
        }
        case PropertyType.Rating: {
          const options = property2.options ?? {};
          options.maxValue ?? (options.maxValue = 5);
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: RatingMaxValueDataSource,
              label: t2("Max value"),
              selectedKeys: [options.maxValue.toString()],
              onSelectionChange: (c2) => {
                patchProperty({
                  options: {
                    ...options,
                    maxValue: Number(c2.values().next().value)
                  }
                });
              }
            }
          ) });
        }
        case PropertyType.Boolean: {
          break;
        }
        case PropertyType.Link:
        case PropertyType.Attachment:
          break;
        case PropertyType.Date:
          break;
        case PropertyType.DateTime:
          break;
        case PropertyType.Time:
          break;
        case PropertyType.Formula: {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              radio_group_default,
              {
                label: t2("Formula syntax"),
                orientation: "horizontal",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: "buenos-aires", children: "Javascript" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              _default$1,
              {
                wrapEnabled: true,
                editorProps: { $blockScrolling: true },
                mode: "javascript",
                name: "UNIQUE_ID_OF_DIV",
                theme: "monokai",
                onChange: (v2) => {
                  console.log(v2);
                }
              }
            )
          ] });
        }
        case PropertyType.Multilevel: {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            MultilevelData,
            {
              options: property2.options,
              onChange: (options) => {
                patchProperty({
                  options
                });
              }
            }
          );
        }
        case PropertyType.Tags: {
          const options = property2.options;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            TagList,
            {
              checkUsage: checkValueUsage,
              className: "mt-4",
              tags: options == null ? void 0 : options.tags,
              onChange: (tags) => {
                patchProperty({
                  options: {
                    ...options,
                    tags
                  }
                });
              }
            }
          ) });
        }
      }
    }
    return;
  };
  const renderPropertyTypeButton = () => {
    const btn = /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "default",
        size: "lg",
        onClick: () => {
          settypeGroupsVisible(true);
        },
        children: property2.type == void 0 ? t2("Select a type") : /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "default", type: property2.type })
      }
    );
    if (property2 && property2.id != void 0 && property2.id > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Click to change type"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: btn }) }) });
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: btn });
    }
  };
  const patchProperty = (patches) => {
    const newProperties = {
      ...property2,
      ...patches
    };
    setProperty3(newProperties);
    if (newProperties.name == void 0 || newProperties.name.length == 0 || newProperties.type == void 0 || !(newProperties.type > 0)) {
      onChange == null ? void 0 : onChange(void 0);
    } else {
      onChange == null ? void 0 : onChange(newProperties);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          isDismissable: true,
          showArrow: true,
          closeMode: ["mask", "esc"],
          placement: "right",
          trigger: renderPropertyTypeButton(),
          visible: typeGroupsVisible,
          onOpenChange: (isOpen) => {
            settypeGroupsVisible(isOpen);
          },
          onVisibleChange: (visible) => {
            settypeGroupsVisible(visible);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: typePopoverDomRef, className: "p-2 flex flex-col gap-2", children: Object.keys(PropertyTypeGroup).map((group) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "pb-2 mb-2 border-b-1 last:mb-0 last:border-b-0 last:pb-0",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-bold", children: t2(group) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-x-2 text-sm leading-5", children: PropertyTypeGroup[group].map((type4) => {
                    if (group == UnderDevelopmentGroupKey) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Tooltip$1,
                        {
                          content: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            FeatureStatusTip,
                            {
                              name: t2(PropertyType[type4]),
                              status: "developing"
                            }
                          ),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              className: "justify-start",
                              disabled: (validValueTypes == null ? void 0 : validValueTypes.includes(type4)) === false,
                              variant: "light",
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                PropertyTypeIcon,
                                {
                                  textVariant: "default",
                                  type: type4
                                }
                              )
                            }
                          )
                        }
                      );
                    }
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        className: "justify-start",
                        disabled: (validValueTypes == null ? void 0 : validValueTypes.includes(type4)) === false,
                        variant: "light",
                        onClick: () => {
                          if (property2.id != void 0 && property2.id > 0) {
                            BApi$1.customProperty.getCustomPropertyConversionRules().then((r2) => {
                              var _a2, _b2;
                              const rules2 = ((_b2 = (_a2 = r2.data) == null ? void 0 : _a2[property2.type]) == null ? void 0 : _b2[type4]) ?? [];
                              createPortal(Modal, {
                                defaultVisible: true,
                                title: t2(
                                  "You are changing property type"
                                ),
                                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                    "Changing the property type may cause the loss of existing data. Click 'continue' to check."
                                  ) }),
                                  rules2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2(
                                      "Following rule(s) will be applied"
                                    ) }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      "div",
                                      {
                                        className: "flex flex-wrap gap-2 items-center mt-1",
                                        children: rules2.map((r22) => {
                                          if (r22.description == null) {
                                            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r22.name });
                                          }
                                          return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                            Tooltip$1,
                                            {
                                              content: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: r22.description }),
                                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r22.name })
                                            }
                                          );
                                        })
                                      }
                                    )
                                  ] })
                                ] }),
                                footer: {
                                  actions: ["ok", "cancel"],
                                  okProps: {
                                    children: t2("Continue")
                                  }
                                },
                                onOk: async () => {
                                  var _a3;
                                  const rsp = await BApi$1.customProperty.previewCustomPropertyTypeConversion(
                                    property2.id,
                                    type4
                                  );
                                  if (rsp.data) {
                                    const changes = ((_a3 = rsp.data) == null ? void 0 : _a3.changes) || [];
                                    const { dataCount, toType, fromType } = rsp.data;
                                    createPortal(Modal, {
                                      defaultVisible: true,
                                      title: t2("Final check"),
                                      size: changes.length > 0 ? "lg" : void 0,
                                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: changes.length > 0 ? t2(
                                          "Found {{count}} data, and {{changedDataCount}} data will be modified or deleted",
                                          {
                                            count: dataCount,
                                            changedDataCount: changes.length
                                          }
                                        ) : t2(
                                          "Found {{count}} data, and all of them will be retained",
                                          { count: dataCount }
                                        ) }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2(
                                          "Be careful, this process is irreversible"
                                        ) }),
                                        changes.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { children: [
                                          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(
                                              "Source value"
                                            ) }),
                                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(
                                              "Converted value"
                                            ) })
                                          ] }),
                                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: changes.map((c2) => {
                                            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                StandardValueRenderer,
                                                {
                                                  type: fromType,
                                                  value: deserializeStandardValue(
                                                    c2.serializedFromValue ?? null,
                                                    fromType
                                                  ),
                                                  variant: "light"
                                                }
                                              ) }),
                                              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                                StandardValueRenderer,
                                                {
                                                  type: toType,
                                                  value: deserializeStandardValue(
                                                    c2.serializedToValue ?? null,
                                                    toType
                                                  ),
                                                  variant: "light"
                                                }
                                              ) })
                                            ] });
                                          }) })
                                        ] })
                                      ] }),
                                      onOk: async () => {
                                        await BApi$1.customProperty.changeCustomPropertyType(
                                          property2.id,
                                          type4
                                        );
                                        await BApi$1.customProperty.getCustomPropertyByKeys({
                                          ids: [property2.id]
                                        }).then((r22) => {
                                          patchProperty(r22.data[0]);
                                        });
                                      },
                                      footer: {
                                        actions: ["ok", "cancel"],
                                        okProps: {
                                          children: t2("Convert")
                                        }
                                      }
                                    });
                                  }
                                }
                              });
                            });
                          } else {
                            patchProperty({
                              ...property2,
                              type: type4
                            });
                          }
                          settypeGroupsVisible(false);
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          PropertyTypeIcon,
                          {
                            textVariant: "default",
                            type: type4
                          }
                        )
                      }
                    );
                  }) })
                ]
              }
            );
          }) })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          className: "flex-1",
          label: t2("Name"),
          size: "sm",
          value: property2.name,
          onValueChange: (name2) => patchProperty({
            ...property2,
            name: name2
          })
        }
      )
    ] }),
    renderOptions()
  ] });
};
ModalContent.displayName = "ModalContent";
const log$p = buildLogger("PropertyModal");
const PropertyModal = ({
  value: value2,
  onSaved,
  validValueTypes,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(true);
  const [property2, setProperty3] = reactExports.useState();
  const close = () => {
    setVisible(false);
  };
  log$p(property2);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !property2
        }
      },
      size: "lg",
      title: t2("Custom property"),
      visible,
      onClose: close,
      onOk: async () => {
        if (!property2) {
          throw new Error("Property is required");
        }
        const model = {
          ...property2,
          // todo: this serialization is a hardcode
          options: JSON.stringify(property2.options)
        };
        const isUpdate = property2.id != void 0 && property2.id > 0;
        const rsp = isUpdate ? await BApi$1.customProperty.putCustomProperty(property2.id, model) : await BApi$1.customProperty.addCustomProperty(model);
        if (!rsp.code) {
          onSaved == null ? void 0 : onSaved(rsp.data);
          close();
        }
      },
      ...props,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        ModalContent,
        {
          validValueTypes,
          value: value2,
          onChange: (v2) => setProperty3(v2)
        }
      )
    }
  );
};
PropertyModal.displayName = "PropertyModal";
const property = "_property_j4j5r_1";
const line1 = "_line1_j4j5r_4";
const left = "_left_j4j5r_7";
const type3 = "_type_j4j5r_12";
const bottom = "_bottom_j4j5r_19";
const styles$3 = {
  property,
  line1,
  left,
  type: type3,
  bottom
};
const Label = ({ property: property2, showPool }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center", children: [
    showPool && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2(`PropertyPool.${PropertyPool[property2.pool]}`) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "none", type: property2.type }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: property2.name })
  ] });
};
Label.displayName = "Label";
const Property = ({
  property: property2,
  onClick,
  editablePortal = "edit-icon",
  onSaved,
  onRemoved,
  onDialogDestroyed,
  disabled,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const [removeConfirmingDialogVisible, setRemoveConfirmingDialogVisible] = reactExports.useState(false);
  const { createPortal } = useBakabaseContext();
  const editable = property2.pool == PropertyPool.Custom && props.editable;
  const removable = property2.pool == PropertyPool.Custom && props.removable;
  const renderBottom = () => {
    if (property2.pool != PropertyPool.Custom) {
      return null;
    }
    const categories = property2.categories || [];
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.bottom} mt-1 pt-1 flex flex-wrap gap-2`, children: [
      categories.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 max-w-[600px]", children: categories.map((c2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: c2.name }, c2.id);
          }) }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$x, { className: "text-sm" }),
            categories.length
          ] })
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("No category bound") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("You can bind properties in category page") })
          ] }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-sm" })
        }
      ),
      property2.valueCount != void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2("{{count}} values", {
            count: property2.valueCount
          }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-sm" }),
            property2.valueCount
          ] })
        }
      )
    ] });
  };
  const showDetail = () => {
    createPortal(PropertyModal, {
      value: {
        ...property2,
        type: property2.type
      },
      onSaved: (p2) => onSaved == null ? void 0 : onSaved({
        ...p2
      }),
      onDestroyed: onDialogDestroyed
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `${styles$3.property} group px-2 py-1 rounded ${disabled ? "cursor-not-allowed opacity-60" : "cursor-pointer hover:bg-[var(--bakaui-overlap-background)]"}`,
      onClick: () => {
        if (disabled) {
          return;
        }
        if (editable && editablePortal == "click") {
          showDetail();
        }
        onClick == null ? void 0 : onClick();
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Modal,
          {
            title: t2("Delete a property"),
            visible: removeConfirmingDialogVisible,
            onClose: () => setRemoveConfirmingDialogVisible(false),
            onOk: async () => {
              await BApi$1.customProperty.removeCustomProperty(property2.id);
              onRemoved == null ? void 0 : onRemoved();
            },
            children: t2("This operation can not be undone, are you sure?")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.line1} flex item-center justify-between gap-1`, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$3.left}`, children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(`${PropertyPool[property2.pool]}`) }),
              property2.name
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "foreground",
                content: t2(PropertyType[property2.type]),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles$3.type, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "none", type: property2.type }) })
              }
            )
          ] }),
          property2.pool == PropertyPool.Custom && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "ml-1 flex gap-0.5 items-center invisible group-hover:visible",
              children: [
                editable && editablePortal == "edit-icon" && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "text-base",
                    color: "default",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      showDetail();
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdEdit, { className: "text-base" })
                  }
                ),
                removable && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "text-base",
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: async () => {
                      setRemoveConfirmingDialogVisible(true);
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, { className: "text-base" })
                  }
                )
              ]
            }
          )
        ] }),
        renderBottom()
      ]
    },
    property2.id
  );
};
Property.displayName = "Property";
const getPropertyPoolColor = (pool) => {
  switch (pool) {
    case PropertyPool.Internal:
      return "default";
    case PropertyPool.Reserved:
      return "secondary";
    case PropertyPool.Custom:
      return "primary";
    default:
      return "warning";
  }
};
const PropertyPoolIcon = ({ pool }) => {
  const { t: t2 } = useTranslation();
  const color2 = getPropertyPoolColor(pool);
  const poolName = pool ? t2(`PropertyPool.${PropertyPool[pool]}`) : t2("Unknown");
  const poolAbbreviation = pool ? t2(`PropertyPool.Abbreviation.${PropertyPool[pool]}`) : "?";
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "foreground", content: poolName, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: color2, size: "sm", variant: "flat", children: poolAbbreviation }) });
};
PropertyPoolIcon.displayName = "PropertyPoolIcon";
const PropertyExtra = ({ property: property2 }) => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const components2 = [];
  switch (property2.type) {
    case PropertyType.SingleLineText:
      break;
    case PropertyType.MultilineText:
      break;
    case PropertyType.SingleChoice:
    case PropertyType.MultipleChoice: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_a2 = options.choices) == null ? void 0 : _a2.length) ?? 0
          ] }, "choices-count")
        );
      }
      break;
    }
    case PropertyType.Number:
    case PropertyType.Percentage: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(LuRuler, { className: "text-base" }),
            options.precision ?? 0
          ] }, "number-count")
        );
      }
      break;
    }
    case PropertyType.Rating: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStar, { className: "text-base" }),
            options.maxValue ?? 5
          ] }, "rating-count")
        );
      }
      break;
    }
    case PropertyType.Boolean:
      break;
    case PropertyType.Link:
      break;
    case PropertyType.Attachment:
      break;
    case PropertyType.Date:
      break;
    case PropertyType.DateTime:
      break;
    case PropertyType.Time:
      break;
    case PropertyType.Formula:
      break;
    case PropertyType.Multilevel: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_b2 = options.data) == null ? void 0 : _b2.length) ?? 0
          ] }, "multilevel-count")
        );
      }
      break;
    }
    case PropertyType.Tags: {
      const options = property2.options;
      if (options) {
        components2.push(
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(TbSelect, { className: "text-base" }),
            ((_c2 = options.tags) == null ? void 0 : _c2.length) ?? 0
          ] }, "tags-count")
        );
      }
      break;
    }
  }
  if (property2.pool == PropertyPool.Custom && property2.valueCount && property2.valueCount > 0) {
    components2.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2("{{count}} resource(s) have set this property value.", {
            count: property2.valueCount
          }),
          placement: "bottom",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
            property2.valueCount
          ] })
        },
        "value-count"
      )
    );
  }
  if (components2.length == 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: components2 });
};
const V2 = ({
  property: property2,
  hidePool,
  hideType,
  onClick,
  onSaved,
  onRemoved,
  onDialogDestroyed,
  isSelected,
  disabled,
  ...props
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const editable = property2.pool == PropertyPool.Custom && props.editable;
  const removable = property2.pool == PropertyPool.Custom && props.removable;
  const selected = isSelected === true;
  const showDetail = () => {
    createPortal(PropertyModal, {
      value: {
        ...property2,
        type: property2.type
      },
      onSaved: (p2) => onSaved == null ? void 0 : onSaved({
        ...p2
      }),
      onDestroyed: onDialogDestroyed
    });
  };
  const actions = [];
  if (editable) {
    actions.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          onPress: () => {
            showDetail();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
        }
      )
    );
  }
  if (removable) {
    actions.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Delete a property"),
              children: t2(
                "This operation can not be undone, are you sure?"
              ),
              onOk: async () => {
                await BApi$1.customProperty.removeCustomProperty(property2.id);
                onRemoved == null ? void 0 : onRemoved();
              }
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
        }
      )
    );
  }
  const card2 = /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { isPressable: !disabled, onPress: onClick, className: disabled ? "cursor-not-allowed opacity-60" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "flex flex-col gap-1", children: [
    (!hidePool || !hideType) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      !hideType && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { type: property2.type }),
      !hidePool && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyPoolIcon, { pool: property2.pool })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base text-left", children: property2.name }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyExtra, { property: property2 })
    ] })
  ] }) });
  const cardWithSelection = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `relative ${selected ? "ring-2 ring-green-500 rounded-lg" : ""}`, "aria-selected": selected, children: [
    selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pointer-events-none absolute -top-1.5 -right-1.5 bg-green-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs shadow z-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, {}) }),
    card2
  ] });
  if (actions.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: actions }),
        children: cardWithSelection
      }
    );
  }
  return cardWithSelection;
};
V2.displayName = "V2";
const log$o = buildLogger("PropertySelector");
const deprecatedInternalPropertyIds = [
  ResourceProperty.Category,
  ResourceProperty.MediaLibrary,
  ResourceProperty.MediaLibraryV2
];
const PropertySelector = (props) => {
  log$o("props", props);
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    selection: propsSelection,
    onSubmit: propsOnSubmit,
    onCancel,
    multiple = true,
    pool,
    types: types2,
    valueTypes: valueTypes2,
    addable,
    editable,
    removable,
    title,
    onDestroyed,
    isDisabled,
    v2
  } = props;
  const [properties2, setProperties] = reactExports.useState([]);
  const [selection, setSelection] = reactExports.useState(propsSelection || []);
  const [visible, setVisible] = reactExports.useState(true);
  const [keyword, setKeyword] = reactExports.useState("");
  const hasSubmittedRef = reactExports.useRef(false);
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(pool)).data || [];
    setProperties(psr);
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const isSelected = (property2) => {
    return selection.some((s2) => s2.id === property2.id && s2.pool === property2.pool);
  };
  const toggleProperty = async (property2) => {
    const isDeprecatedInternal = property2.pool === PropertyPool.Internal && deprecatedInternalPropertyIds.includes(property2.id);
    if (isDeprecatedInternal || (isDisabled == null ? void 0 : isDisabled(property2))) {
      return;
    }
    const selected = isSelected(property2);
    if (multiple) {
      if (selected) {
        setSelection(selection.filter((s2) => !(s2.id === property2.id && s2.pool === property2.pool)));
      } else {
        setSelection([...selection, { id: property2.id, pool: property2.pool }]);
      }
    } else {
      if (selected) {
        setSelection([]);
      } else {
        const ns = [{ id: property2.id, pool: property2.pool }];
        setSelection(ns);
        await onSubmit(ns);
      }
    }
  };
  const onSubmit = async (sel) => {
    if (sel.length > 0) {
      await BApi$1.options.addLatestUsedProperty(sel);
    }
    if (propsOnSubmit) {
      await propsOnSubmit(
        sel.map((s2) => properties2.find((p2) => p2.id === s2.id && p2.pool === s2.pool)).filter((x2) => x2 != void 0)
      );
    }
    hasSubmittedRef.current = true;
    setVisible(false);
  };
  const filteredProperties = properties2.filter((p2) => {
    if (keyword && !p2.name.toLowerCase().includes(keyword.toLowerCase())) {
      return false;
    }
    if (valueTypes2 && !valueTypes2.includes(p2.dbValueType)) {
      return false;
    }
    if (types2 && !types2.includes(p2.type)) {
      return false;
    }
    return true;
  });
  const reservedProperties = filteredProperties.filter((p2) => p2.pool === PropertyPool.Reserved);
  const customProperties = filteredProperties.filter((p2) => p2.pool === PropertyPool.Custom);
  const internalProperties = filteredProperties.filter((p2) => p2.pool === PropertyPool.Internal);
  const groupedCustomProperties = customProperties.reduce(
    (s2, t22) => {
      var _a2;
      (s2[_a2 = t22.type] ?? (s2[_a2] = [])).push(t22);
      return s2;
    },
    {}
  );
  const renderFilter = () => {
    const filters = [];
    if (pool !== PropertyPool.All) {
      Object.keys(PropertyPool).forEach((k2) => {
        const v3 = parseInt(k2, 10);
        if (Number.isNaN(v3)) {
          return;
        }
        if (pool & v3) {
          switch (v3) {
            case PropertyPool.Internal:
            case PropertyPool.Reserved:
            case PropertyPool.Custom:
              filters.push(
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(PropertyPool[v3]) }, `pool-${v3}`)
              );
              break;
          }
        }
      });
    }
    if (valueTypes2) {
      filters.push(
        ...valueTypes2.map((vt) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(StandardValueType[vt]) }, `vt-${vt}`))
      );
    }
    if (types2) {
      filters.push(
        ...types2.map((pt) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: t2(PropertyType[pt]) }, `pt-${pt}`))
      );
    }
    if (filters.length > 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 items-center flex-wrap", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-sm", children: t2("common.state.filtering") }),
        filters
      ] });
    }
    return null;
  };
  const renderPropertyItem = (property2, showTypeIcon) => {
    const selected = isSelected(property2);
    const isDeprecatedInternal = property2.pool === PropertyPool.Internal && deprecatedInternalPropertyIds.includes(property2.id);
    const disabled = isDeprecatedInternal || (isDisabled == null ? void 0 : isDisabled(property2));
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `relative cursor-pointer rounded-md transition-all ${selected ? "ring-2 ring-success ring-offset-1" : ""} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
        children: [
          v2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            V2,
            {
              disabled,
              editable,
              hidePool: true,
              hideType: showTypeIcon,
              property: property2,
              removable,
              onSaved: loadProperties,
              onClick: () => toggleProperty(property2)
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
            Property,
            {
              disabled,
              editable,
              property: property2,
              removable,
              onSaved: loadProperties,
              onClick: () => toggleProperty(property2)
            }
          ),
          selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute -top-1 -right-1 bg-success rounded-full p-0.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-white text-xs" }) })
        ]
      },
      `${property2.pool}-${property2.id}`
    );
  };
  const renderPropertyGroup = (groupTitle, props2, showTypeIcon) => {
    if (props2.length === 0)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-lg border border-default-200 bg-content1 overflow-hidden", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-4 py-3 bg-default-100 border-b border-default-200", children: [
        showTypeIcon && props2[0] && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "default", type: props2[0].type }),
        !showTypeIcon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: groupTitle }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-500 text-sm", children: [
          "(",
          props2.length,
          ")"
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: props2.map((p2) => renderPropertyItem(p2, showTypeIcon)) }) })
    ] });
  };
  const renderProperties = () => {
    const totalCount = filteredProperties.length;
    if (totalCount === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center gap-2 py-8", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("property.empty.noPropertiesAvailable") }),
        addable && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              createPortal(PropertyModal, {
                onSaved: loadProperties,
                validValueTypes: valueTypes2 == null ? void 0 : valueTypes2.map((v3) => v3)
              });
            },
            children: t2("property.action.addProperty")
          }
        )
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-4 grid-cols-1 lg:grid-cols-2", children: [
      (pool & PropertyPool.Internal) !== 0 && internalProperties.length > 0 && renderPropertyGroup(t2("common.label.internalProperties"), internalProperties, false),
      (pool & PropertyPool.Reserved) !== 0 && reservedProperties.length > 0 && renderPropertyGroup(t2("common.label.reservedProperties"), reservedProperties, false),
      (pool & PropertyPool.Custom) !== 0 && Object.keys(groupedCustomProperties).map((k2) => {
        const ps = groupedCustomProperties[k2];
        return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: renderPropertyGroup("", ps, true) }, k2);
      })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      classNames: { base: "max-w-[70vw]" },
      footer: multiple && filteredProperties.length > 0 ? true : /* @__PURE__ */ jsxRuntimeExports.jsx(spacer_default, {}),
      size: "3xl",
      title: title ?? t2(multiple ? "property.modal.selectProperties" : "property.modal.selectProperty"),
      visible,
      onClose: () => {
        setVisible(false);
      },
      onDestroyed: () => {
        if (!hasSubmittedRef.current) {
          onCancel == null ? void 0 : onCancel();
        }
        onDestroyed == null ? void 0 : onDestroyed();
      },
      onOk: async () => {
        await onSubmit(selection);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        (() => {
          const filter3 = renderFilter();
          return filter3 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            filter3,
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {})
          ] });
        })(),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              size: "sm",
              placeholder: t2("property.action.searchProperties"),
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
              value: keyword,
              onValueChange: setKeyword,
              className: "w-64"
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-500", children: [
              t2("common.state.selected"),
              ": ",
              selection.length
            ] }),
            addable && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                onPress: () => {
                  createPortal(PropertyModal, {
                    onSaved: loadProperties,
                    validValueTypes: valueTypes2 == null ? void 0 : valueTypes2.map((v3) => v3)
                  });
                },
                children: t2("property.action.addProperty")
              }
            )
          ] })
        ] }),
        renderProperties()
      ] })
    }
  );
};
function createDefaultFilterConfig(createPortal) {
  return {
    api: {
      getAvailableOperations: async (propertyPool, propertyId) => {
        const response = await BApi$1.resource.getSearchOperationsForProperty({
          propertyPool,
          propertyId
        });
        return response.data || [];
      },
      getAvailableOperationsByPropertyType: async (propertyType) => {
        const response = await BApi$1.resource.getSearchOperationsByPropertyType({
          propertyType
        });
        return response.data || [];
      },
      getValueProperty: async (filter3) => {
        if (!filter3.propertyPool || !filter3.propertyId || !filter3.operation) {
          return void 0;
        }
        const response = await BApi$1.resource.getFilterValueProperty(filter3);
        return response.data;
      },
      saveRecentFilter: async (filter3) => {
        if (filter3.propertyPool && filter3.propertyId && filter3.operation) {
          await BApi$1.options.addRecentResourceFilter({
            propertyPool: filter3.propertyPool,
            propertyId: filter3.propertyId,
            operation: filter3.operation,
            dbValue: filter3.dbValue
          });
        }
      },
      getRecentFilters: async () => {
        const response = await BApi$1.options.getRecentResourceFilters();
        return response.data || [];
      }
    },
    renderers: {
      openPropertySelector: (currentSelection, onSelect, onCancel, disabledProperties) => {
        createPortal(PropertySelector, {
          v2: true,
          selection: currentSelection ? [{ id: currentSelection.id, pool: currentSelection.pool }] : void 0,
          onSubmit: async (selectedProperties) => {
            const property2 = selectedProperties[0];
            if (property2) {
              const response = await BApi$1.resource.getSearchOperationsForProperty({
                propertyPool: property2.pool,
                propertyId: property2.id
              });
              const availableOperations = response.data || [];
              onSelect(property2, availableOperations);
            }
          },
          onCancel,
          multiple: false,
          pool: PropertyPool.All,
          addable: false,
          editable: false,
          isDisabled: (disabledProperties == null ? void 0 : disabledProperties.length) ? (p2) => disabledProperties.some((dp) => dp.id === p2.id && dp.pool === p2.pool) : void 0
        });
      },
      renderValueInput: (property2, dbValue, bizValue, onValueChange, options) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue,
            dbValue,
            defaultEditing: options == null ? void 0 : options.defaultEditing,
            property: property2,
            size: (options == null ? void 0 : options.size) ?? "sm",
            variant: (options == null ? void 0 : options.variant) ?? "light",
            onValueChange,
            isReadonly: options == null ? void 0 : options.isReadonly,
            isEditing: options == null ? void 0 : options.isEditing
          }
        );
      }
    }
  };
}
const isGroupEmpty = (group) => {
  if (!group)
    return true;
  const hasFilters = group.filters && group.filters.length > 0;
  const hasGroups = group.groups && group.groups.length > 0;
  return !hasFilters && !hasGroups;
};
const createMediaLibraryFilter = async () => {
  try {
    const propertyId = ResourceProperty.MediaLibraryV2Multi;
    const pool = PropertyPool.Internal;
    const operation = SearchOperation.In;
    const propertyResponse = await BApi$1.property.getPropertiesByPool(pool);
    const property2 = (propertyResponse.data || []).find((p2) => p2.id === propertyId);
    if (!property2)
      return null;
    const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
      propertyPool: pool,
      propertyId,
      operation
    });
    const valueProperty = valuePropertyResponse.data;
    const operationsResponse = await BApi$1.resource.getSearchOperationsForProperty({
      propertyPool: pool,
      propertyId
    });
    const availableOperations = operationsResponse.data ?? [];
    return {
      propertyId,
      operation,
      propertyPool: pool,
      property: property2,
      valueProperty,
      availableOperations,
      disabled: false
    };
  } catch {
    return null;
  }
};
const FilterGroupWithContextContent = ({
  group,
  onChange,
  filterDisplayMode,
  filterLayout,
  externalNewFilterIndex,
  onExternalNewFilterConsumed,
  className = "",
  autoCreateMediaLibraryFilter = false,
  isReadonly = false
}) => {
  const autoCreateTriggeredRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (!autoCreateMediaLibraryFilter)
      return;
    if (autoCreateTriggeredRef.current)
      return;
    if (!isGroupEmpty(group))
      return;
    autoCreateTriggeredRef.current = true;
    createMediaLibraryFilter().then((filter3) => {
      if (filter3) {
        const newGroup = {
          combinator: GroupCombinator.And,
          disabled: false,
          filters: [filter3],
          groups: []
        };
        onChange(newGroup);
      }
    });
  }, [autoCreateMediaLibraryFilter, group, onChange]);
  const hasFilters = group && (group.filters && group.filters.length > 0 || group.groups && group.groups.length > 0);
  if (!hasFilters || !group) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: className || void 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    FilterGroup,
    {
      isRoot: true,
      group,
      filterDisplayMode,
      filterLayout,
      isReadonly,
      externalNewFilterIndex,
      onExternalNewFilterConsumed,
      onChange
    }
  ) });
};
const FilterGroupWithContext = ({
  config: config2,
  ...props
}) => {
  const hasContext = useHasFilterContext();
  const { createPortal } = useBakabaseContext();
  const defaultConfig2 = reactExports.useMemo(() => createDefaultFilterConfig(createPortal), [createPortal]);
  if (hasContext) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(FilterGroupWithContextContent, { ...props });
  }
  const effectiveConfig = config2 ?? defaultConfig2;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FilterProvider, { config: effectiveConfig, children: /* @__PURE__ */ jsxRuntimeExports.jsx(FilterGroupWithContextContent, { ...props }) });
};
FilterGroupWithContext.displayName = "FilterGroupWithContext";
const ResourceSearchPanelInner = ({
  criteria,
  onChange,
  showKeyword = false,
  showTags = true,
  showRecentFilters = true,
  showFilterGroupPreview = true,
  compact = false,
  filterDisplayMode,
  filterLayout,
  externalNewFilterIndex,
  onExternalNewFilterConsumed
}) => {
  const { t: t2 } = useTranslation();
  const [popoverOpen, setPopoverOpen] = reactExports.useState(false);
  const [internalNewFilterIndex, setInternalNewFilterIndex] = reactExports.useState(null);
  const newFilterIndex = internalNewFilterIndex ?? externalNewFilterIndex ?? null;
  const addFilter = (filter3, autoTriggerPropertySelector = false) => {
    const newGroup = criteria.group ?? {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    if (!newGroup.filters) {
      newGroup.filters = [];
    }
    if (autoTriggerPropertySelector) {
      setInternalNewFilterIndex(newGroup.filters.length);
    }
    newGroup.filters.push(filter3);
    onChange({ ...criteria, group: newGroup });
  };
  const addFilterGroup = () => {
    const newSubGroup = {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    const newGroup = criteria.group ?? {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    if (!newGroup.groups) {
      newGroup.groups = [];
    }
    newGroup.groups.push(newSubGroup);
    onChange({ ...criteria, group: newGroup });
  };
  const hasFilters = criteria.group && (criteria.group.filters && criteria.group.filters.length > 0 || criteria.group.groups && criteria.group.groups.length > 0);
  const showAddFilterButton = showRecentFilters || showTags;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-3 flex-wrap", children: [
    showKeyword && /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        isClearable: true,
        className: "grow",
        placeholder: t2("Search everything"),
        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-lg" }),
        value: criteria.keyword || "",
        onValueChange: (v2) => {
          onChange({ ...criteria, keyword: v2 || void 0 });
        }
      }
    ),
    showAddFilterButton && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      PopoverComponent,
      {
        showArrow: true,
        placement: "bottom",
        isOpen: popoverOpen,
        onOpenChange: setPopoverOpen,
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: compact ? "md" : "md", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilterPlus, { className: "text-lg" }) }),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          FilterAddPopoverContent,
          {
            showTags,
            selectedTags: criteria.tags,
            onTagsChange: (tags) => {
              onChange({
                ...criteria,
                tags: tags.length > 0 ? tags : void 0
              });
            },
            showRecentFilters,
            onAddFilter: (autoTrigger) => addFilter({ disabled: false }, autoTrigger),
            onAddFilterGroup: addFilterGroup,
            onSelectFilters: (filters) => {
              filters.forEach((filter3) => addFilter(filter3));
            },
            onClose: () => setPopoverOpen(false)
          }
        )
      }
    ) }),
    showFilterGroupPreview && hasFilters && criteria.group && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${filterDisplayMode === FilterDisplayMode.Simple ? "" : "border border-default-200 rounded"} w-full`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      FilterGroup,
      {
        isRoot: true,
        group: criteria.group,
        filterDisplayMode,
        filterLayout,
        externalNewFilterIndex: newFilterIndex,
        onExternalNewFilterConsumed: () => {
          setInternalNewFilterIndex(null);
          onExternalNewFilterConsumed == null ? void 0 : onExternalNewFilterConsumed();
        },
        onChange: (group) => {
          onChange({ ...criteria, group });
        }
      }
    ) }),
    criteria.tags && criteria.tags.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: criteria.tags.map((tag) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "span",
        {
          className: "px-2 py-1 text-xs bg-default-100 rounded cursor-pointer hover:bg-default-200",
          onClick: () => {
            var _a3;
            onChange({
              ...criteria,
              tags: (_a3 = criteria.tags) == null ? void 0 : _a3.filter((t22) => t22 !== tag)
            });
          },
          children: [
            t2(getEnumKey("ResourceTag", (_a2 = resourceTags.find((rt) => rt.value === tag)) == null ? void 0 : _a2.label)),
            " ×"
          ]
        },
        tag
      );
    }) })
  ] });
};
const ResourceSearchPanel = (props) => {
  const { createPortal } = useBakabaseContext();
  const filterConfig = reactExports.useMemo(() => createDefaultFilterConfig(createPortal), [createPortal]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FilterProvider, { config: filterConfig, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceSearchPanelInner, { ...props }) });
};
ResourceSearchPanel.displayName = "ResourceSearchPanel";
const FilterPortal = ({
  mode,
  onModeChange,
  onAddFilter,
  onAddFilterGroup,
  onSelectFilters,
  showTags = true,
  selectedTags,
  onTagsChange,
  showRecentFilters = true,
  currentFilters = []
}) => {
  const { t: t2 } = useTranslation();
  const [popoverOpen, setPopoverOpen] = reactExports.useState(false);
  const config2 = useFilterConfig();
  const handleSimpleModeAddFilter = () => {
    config2.renderers.openPropertySelector(
      void 0,
      async (property2, availableOperations) => {
        const rangeOperations = property2.type ? getRangeFilterOperations(property2.type) : void 0;
        if (rangeOperations) {
          const [minOp, maxOp] = rangeOperations;
          const baseFilter = {
            propertyId: property2.id,
            propertyPool: property2.pool,
            property: property2,
            availableOperations,
            disabled: false
          };
          const minFilter = { ...baseFilter, operation: minOp };
          const maxFilter = { ...baseFilter, operation: maxOp };
          const [minValueProperty, maxValueProperty] = await Promise.all([
            config2.api.getValueProperty(minFilter),
            config2.api.getValueProperty(maxFilter)
          ]);
          onSelectFilters([
            { ...minFilter, valueProperty: minValueProperty },
            { ...maxFilter, valueProperty: maxValueProperty }
          ]);
        } else {
          const operation = property2.type ? getSimpleFilterOperation(property2.type) : availableOperations[0];
          const newFilter = {
            propertyId: property2.id,
            propertyPool: property2.pool,
            property: property2,
            availableOperations,
            operation,
            disabled: false
          };
          const valueProperty = await config2.api.getValueProperty(newFilter);
          onSelectFilters([{ ...newFilter, valueProperty }]);
        }
      }
    );
  };
  if (mode === FilterDisplayMode.Simple) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        placement: "right",
        delay: 1e3,
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            variant: "light",
            color: "primary",
            onPress: () => onModeChange(FilterDisplayMode.Advanced),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbSwitch2, { className: "text-lg" }),
              t2("resourceFilter.switchToAdvancedMode")
            ]
          }
        ),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "md",
            onPress: handleSimpleModeAddFilter,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilter, { className: "text-lg" })
          }
        )
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      showArrow: true,
      placement: "bottom",
      isOpen: popoverOpen,
      onOpenChange: setPopoverOpen,
      trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "md", color: "primary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TbFilterStar, { className: "text-lg" }) }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        FilterAddPopoverContent,
        {
          showTags,
          selectedTags,
          onTagsChange,
          showRecentFilters,
          onAddFilter: (autoTrigger) => {
            setPopoverOpen(false);
            onAddFilter(autoTrigger);
          },
          onAddFilterGroup: () => {
            setPopoverOpen(false);
            onAddFilterGroup();
          },
          onSelectFilters: (filters) => {
            setPopoverOpen(false);
            onSelectFilters(filters);
          },
          onClose: () => setPopoverOpen(false),
          onSwitchToSimpleMode: () => {
            setPopoverOpen(false);
            onModeChange(FilterDisplayMode.Simple);
          }
        }
      )
    }
  );
};
FilterPortal.displayName = "FilterPortal";
function ResourceKeywordAutocomplete({
  value: value2,
  onValueChange,
  onSelectionChange,
  maxResults = 10,
  debounceDelay = 300,
  placeholder,
  ...autocompleteProps
}) {
  const { t: t2 } = useTranslation();
  const [isLoading, setIsLoading] = reactExports.useState(false);
  const [candidates, setCandidates] = reactExports.useState([]);
  const lastSearchedRef = reactExports.useRef(void 0);
  const searchKeywords = reactExports.useCallback(
    (prefix) => {
      setIsLoading(true);
      if (prefix && prefix.length > 0) {
        BApi$1.resource.getResourceSearchKeywordRecommendation({
          keyword: prefix,
          maxCount: maxResults
        }).then((ret) => {
          setCandidates(ret.data ?? []);
        }).finally(() => setIsLoading(false));
      } else {
        setCandidates([]);
        setIsLoading(false);
      }
    },
    [maxResults]
  );
  useDebounce(
    () => {
      if (lastSearchedRef.current !== value2) {
        lastSearchedRef.current = value2;
        searchKeywords(value2 ?? "");
      }
    },
    debounceDelay,
    [value2]
  );
  const handleSelectionChange = (key) => {
    if (key) {
      const selected = key;
      onValueChange == null ? void 0 : onValueChange(selected);
      onSelectionChange == null ? void 0 : onSelectionChange(selected);
    }
  };
  console.log(autocompleteProps);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    autocomplete_default,
    {
      "aria-label": "Resource Keyword",
      placeholder: placeholder ?? t2("resource.placeholder.searchAnyKeyword"),
      ...autocompleteProps,
      allowsCustomValue: true,
      inputValue: value2 ?? "",
      isLoading,
      items: candidates.map((k2) => ({ label: k2, value: k2 })),
      onInputChange: (inputValue) => {
        onValueChange == null ? void 0 : onValueChange(inputValue);
      },
      onOpenChange: (isOpen) => {
        if (isOpen && candidates.length === 0) {
          searchKeywords(value2 ?? "");
        }
      },
      onSelectionChange: handleSelectionChange,
      children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { title: item.label, children: item.label }, item.value)
    }
  );
}
const ResourceFilterControllerInner = ({
  keyword: externalKeyword,
  onKeywordChange: externalOnKeywordChange,
  onSearch,
  group,
  onGroupChange,
  tags,
  onTagsChange,
  filterDisplayMode: externalFilterDisplayMode,
  defaultFilterDisplayMode = FilterDisplayMode.Simple,
  onFilterDisplayModeChange,
  filterLayout = "vertical",
  externalNewFilterIndex,
  onExternalNewFilterConsumed,
  showRecentFilters = true,
  showTags = true,
  keywordContainer,
  filterPortalContainer,
  filterGroupsContainer,
  keywordClassName = "",
  filterGroupsClassName = "",
  keywordPlaceholder,
  autoCreateMediaLibraryFilter = false,
  isReadonly = false
}) => {
  const [internalNewFilterIndex, setInternalNewFilterIndex] = reactExports.useState(null);
  const [internalKeyword, setInternalKeyword] = reactExports.useState(void 0);
  const keyword = externalKeyword !== void 0 ? externalKeyword : internalKeyword;
  const onKeywordChange = externalOnKeywordChange ?? setInternalKeyword;
  const [internalFilterDisplayMode, setInternalFilterDisplayMode] = reactExports.useState(defaultFilterDisplayMode);
  const filterDisplayMode = externalFilterDisplayMode ?? internalFilterDisplayMode;
  const newFilterIndex = internalNewFilterIndex ?? externalNewFilterIndex ?? null;
  const addFilter = reactExports.useCallback((filter3, autoTriggerPropertySelector = false) => {
    const newGroup = group ?? {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    if (!newGroup.filters) {
      newGroup.filters = [];
    }
    if (autoTriggerPropertySelector) {
      setInternalNewFilterIndex(newGroup.filters.length);
    }
    newGroup.filters.push(filter3);
    onGroupChange({ ...newGroup });
  }, [group, onGroupChange]);
  const addFilters = reactExports.useCallback((filters) => {
    const newGroup = group ?? {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    if (!newGroup.filters) {
      newGroup.filters = [];
    }
    newGroup.filters.push(...filters);
    onGroupChange({ ...newGroup });
  }, [group, onGroupChange]);
  const addFilterGroup = reactExports.useCallback(() => {
    const newSubGroup = {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    const newGroup = group ?? {
      combinator: GroupCombinator.And,
      disabled: false,
      filters: [],
      groups: []
    };
    if (!newGroup.groups) {
      newGroup.groups = [];
    }
    newGroup.groups.push(newSubGroup);
    onGroupChange({ ...newGroup });
  }, [group, onGroupChange]);
  const handleModeChange = reactExports.useCallback((mode) => {
    if (mode === FilterDisplayMode.Simple && filterDisplayMode === FilterDisplayMode.Advanced) {
      const currentGroup = group;
      if (currentGroup) {
        const cleanedFilters = (currentGroup.filters || []).filter((f2) => !f2.disabled).map((f2) => ({ ...f2, disabled: false }));
        onGroupChange({
          ...currentGroup,
          filters: cleanedFilters,
          groups: [],
          // Remove all sub-groups in Simple mode
          combinator: GroupCombinator.And,
          disabled: false
        });
      }
    }
    setInternalFilterDisplayMode(mode);
    onFilterDisplayModeChange == null ? void 0 : onFilterDisplayModeChange(mode);
  }, [onFilterDisplayModeChange, filterDisplayMode, group, onGroupChange]);
  const keywordElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
    ResourceKeywordAutocomplete,
    {
      isClearable: true,
      value: keyword,
      onValueChange: onKeywordChange,
      onKeyDown: (e2) => {
        if (e2.key === "Enter") {
          onSearch == null ? void 0 : onSearch();
        }
      },
      placeholder: keywordPlaceholder,
      className: `${keywordClassName} ${!keywordContainer && !filterPortalContainer ? "flex-1 min-w-0" : ""}`
    }
  );
  const filterPortalElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
    FilterPortal,
    {
      mode: filterDisplayMode,
      onModeChange: handleModeChange,
      onAddFilter: (autoTrigger) => addFilter({ disabled: false }, autoTrigger),
      onAddFilterGroup: addFilterGroup,
      onSelectFilters: addFilters,
      showRecentFilters,
      showTags,
      selectedTags: tags,
      onTagsChange,
      currentFilters: group == null ? void 0 : group.filters
    }
  );
  const filterGroupsElement = /* @__PURE__ */ jsxRuntimeExports.jsx(
    FilterGroupWithContext,
    {
      group,
      onChange: onGroupChange,
      filterDisplayMode,
      filterLayout,
      isReadonly,
      externalNewFilterIndex: newFilterIndex,
      onExternalNewFilterConsumed: () => {
        setInternalNewFilterIndex(null);
        onExternalNewFilterConsumed == null ? void 0 : onExternalNewFilterConsumed();
      },
      className: filterGroupsClassName,
      autoCreateMediaLibraryFilter
    }
  );
  const renderToContainer = (element2, container) => {
    if (container) {
      return reactDomExports.createPortal(element2, container);
    }
    return element2;
  };
  const shouldRenderKeywordAndFilterPortalTogether = !keywordContainer && !filterPortalContainer;
  const hasFilterGroupContent = group && (group.filters && group.filters.length > 0 || group.groups && group.groups.length > 0);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    !isReadonly && (shouldRenderKeywordAndFilterPortalTogether ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `flex items-center gap-2 ${hasFilterGroupContent && !filterGroupsContainer ? "mb-2" : ""}`, children: [
      keywordElement,
      filterPortalElement
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      renderToContainer(keywordElement, keywordContainer),
      renderToContainer(filterPortalElement, filterPortalContainer)
    ] })),
    renderToContainer(filterGroupsElement, filterGroupsContainer)
  ] });
};
const ResourceFilterController = (props) => {
  const { createPortal: createPortal2 } = useBakabaseContext();
  const filterConfig = reactExports.useMemo(() => createDefaultFilterConfig(createPortal2), [createPortal2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(FilterProvider, { config: filterConfig, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceFilterControllerInner, { ...props }) });
};
ResourceFilterController.displayName = "ResourceFilterController";
const toFilterInputModel = (filter3) => {
  return {
    propertyPool: filter3.propertyPool,
    propertyId: filter3.propertyId,
    operation: filter3.operation,
    dbValue: filter3.dbValue,
    disabled: filter3.disabled ?? false
  };
};
const toFilterGroupInputModel = (group) => {
  var _a2, _b2;
  return {
    combinator: group.combinator ?? 1,
    groups: (_a2 = group.groups) == null ? void 0 : _a2.map(toFilterGroupInputModel),
    filters: (_b2 = group.filters) == null ? void 0 : _b2.map(toFilterInputModel),
    disabled: group.disabled ?? false
  };
};
const toSearchInputModel = (search2) => {
  return {
    group: search2.group ? toFilterGroupInputModel(search2.group) : void 0,
    orders: search2.orders,
    keyword: search2.keyword,
    pageSize: search2.pageSize ?? 100,
    page: search2.page ?? search2.pageIndex ?? 1,
    tags: search2.tags
  };
};
const log$n = buildLogger("ResourceSelectorModal");
const PAGE_SIZE$2 = 50;
const ResourceSelectorModal = ({
  multiple = false,
  defaultSelectedIds = [],
  defaultCriteria,
  onConfirm,
  onCancel,
  onDestroyed,
  title
}) => {
  const { t: t2 } = useTranslation();
  const { resources, loading, response, search: search2 } = useResourceSearch();
  const [error2, setError] = reactExports.useState(null);
  const [page, setPage] = reactExports.useState(1);
  const [selectedIds, setSelectedIds] = reactExports.useState(defaultSelectedIds);
  const [criteria, setCriteria] = reactExports.useState(
    defaultCriteria ?? {}
  );
  const doSearch = reactExports.useCallback((pageNumber, searchCriteria) => {
    setError(null);
    const inputModel = toSearchInputModel({
      ...searchCriteria,
      page: pageNumber,
      pageSize: PAGE_SIZE$2
    });
    search2(inputModel, { saveSearch: false }).then((result) => {
      log$n("Found resources:", result.length);
    }).catch((err) => {
      console.error("Failed to search resources:", err);
      setError(t2("Failed to load resources"));
    });
  }, [search2, t2]);
  reactExports.useEffect(() => {
    doSearch(1, criteria);
  }, []);
  const handlePageChange = (newPage) => {
    setPage(newPage);
    doSearch(newPage, criteria);
  };
  const handleCriteriaChange = (newCriteria) => {
    setCriteria(newCriteria);
    setPage(1);
    doSearch(1, newCriteria);
  };
  const handleResourceClick = (resource) => {
    if (multiple) {
      setSelectedIds((prev2) => {
        if (prev2.includes(resource.id)) {
          return prev2.filter((id2) => id2 !== resource.id);
        }
        return [...prev2, resource.id];
      });
    } else {
      setSelectedIds([resource.id]);
    }
  };
  const handleConfirm = () => {
    const selectedResources = selectedIds.map((id2) => {
      const resource = resources.find((r2) => r2.id === id2);
      if (resource) {
        return {
          id: resource.id,
          displayName: resource.displayName || resource.fileName || `Resource ${resource.id}`
        };
      }
      return {
        id: id2,
        displayName: `Resource ${id2}`
      };
    });
    onConfirm == null ? void 0 : onConfirm(selectedResources);
    onDestroyed == null ? void 0 : onDestroyed();
  };
  const handleCancel = () => {
    onCancel == null ? void 0 : onCancel();
    onDestroyed == null ? void 0 : onDestroyed();
  };
  const totalPages = response ? Math.ceil(response.totalCount / PAGE_SIZE$2) : 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "7xl",
      title: title || t2(multiple ? "Select Resources" : "Select Resource"),
      onDestroyed,
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center w-full", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: selectedIds.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", children: t2("{{count}} selected", { count: selectedIds.length }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "default",
              variant: "light",
              onPress: handleCancel,
              children: t2("Cancel")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              isDisabled: selectedIds.length === 0,
              onPress: handleConfirm,
              children: t2("Confirm")
            }
          )
        ] })
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 min-h-[400px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-b pb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          ResourceSearchPanel,
          {
            compact: true,
            criteria,
            showKeyword: false,
            showRecentFilters: false,
            showTags: true,
            onChange: handleCriteriaChange
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center h-32", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-2", children: t2("Loading resources...") })
        ] }) : error2 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-red-500 p-4", children: error2 }) : resources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 p-4", children: t2("No resources found") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: t2("Found {{count}} resources", {
            count: (response == null ? void 0 : response.totalCount) ?? resources.length
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-8 gap-1", children: resources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: `cursor-pointer transition-all rounded-lg ${selectedIds.includes(resource.id) ? "ring-2 ring-primary ring-offset-2" : "hover:ring-2 hover:ring-gray-300 hover:ring-offset-2"}`,
              onClick: () => handleResourceClick(resource),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                ResourceMemo,
                {
                  disableCoverClick: true,
                  resource,
                  selected: selectedIds.includes(resource.id),
                  selectedResourceIds: selectedIds,
                  onSelected: () => handleResourceClick(resource),
                  onSelectedResourcesChanged: () => {
                  }
                }
              )
            },
            resource.id
          )) })
        ] }) }),
        totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center pt-4 border-t", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          pagination_default,
          {
            showControls: true,
            page,
            total: totalPages,
            onChange: handlePageChange
          }
        ) })
      ] })
    }
  );
};
const ParentResourceValueRenderer = ({
  property: property2,
  dbValue,
  bizValue,
  onValueChange,
  defaultEditing,
  size: size2 = "sm",
  variant = "light",
  isReadonly: isReadonlyProp
}) => {
  const { t: t2 } = useTranslation();
  const isReadonly = isReadonlyProp ?? !onValueChange;
  const { createPortal } = useBakabaseContext();
  const [isModalOpen, setIsModalOpen] = reactExports.useState(defaultEditing && !dbValue);
  const dbValueType = getDbValueType(property2.type);
  const bizValueType = getBizValueType(property2.type);
  const isMultiple = dbValueType === StandardValueType.ListString;
  const parseValues = () => {
    if (!dbValue)
      return [];
    try {
      const deserializedDbValue = deserializeStandardValue(dbValue, dbValueType);
      const deserializedBizValue = deserializeStandardValue(bizValue ?? "", bizValueType);
      if (isMultiple) {
        const ids2 = (deserializedDbValue ?? []).map((id2) => parseInt(id2, 10));
        const names2 = deserializedBizValue ?? [];
        return ids2.map((id2, index2) => ({
          id: id2,
          displayName: names2[index2] ?? `Resource ${id2}`
        }));
      } else {
        const id2 = parseInt(deserializedDbValue ?? "", 10);
        const name2 = deserializedBizValue;
        return isNaN(id2) ? [] : [{
          id: id2,
          displayName: name2 ?? `Resource ${id2}`
        }];
      }
    } catch {
      return [];
    }
  };
  const currentValues = parseValues();
  const handleOpenModal = () => {
    if (isReadonly)
      return;
    const portal = createPortal(ResourceSelectorModal, {
      multiple: isMultiple,
      defaultSelectedIds: currentValues.map((v2) => v2.id),
      defaultCriteria: { tags: [ResourceTag.IsParent] },
      title: t2(isMultiple ? "common.label.selectParentResources" : "common.label.selectParentResource"),
      onConfirm: (selectedResources) => {
        if (selectedResources.length === 0) {
          onValueChange == null ? void 0 : onValueChange(void 0, void 0);
        } else if (isMultiple) {
          const dbIds = selectedResources.map((r2) => r2.id.toString());
          const bizNames = selectedResources.map((r2) => r2.displayName);
          const serializedDbValue = serializeStandardValue(dbIds, dbValueType);
          const serializedBizValue = serializeStandardValue(bizNames, bizValueType);
          onValueChange == null ? void 0 : onValueChange(serializedDbValue, serializedBizValue);
        } else {
          const resource = selectedResources[0];
          const serializedDbValue = serializeStandardValue(resource.id.toString(), dbValueType);
          const serializedBizValue = serializeStandardValue(resource.displayName, bizValueType);
          onValueChange == null ? void 0 : onValueChange(serializedDbValue, serializedBizValue);
        }
        portal.destroy();
      },
      onCancel: () => {
        portal.destroy();
      }
    });
  };
  const handleRemoveValue = (valueToRemove) => {
    const newValues = currentValues.filter((v2) => v2.id !== valueToRemove.id);
    if (newValues.length === 0) {
      onValueChange == null ? void 0 : onValueChange(void 0, void 0);
    } else {
      const dbIds = newValues.map((v2) => v2.id.toString());
      const bizNames = newValues.map((v2) => v2.displayName);
      const serializedDbValue = serializeStandardValue(dbIds, dbValueType);
      const serializedBizValue = serializeStandardValue(bizNames, bizValueType);
      onValueChange == null ? void 0 : onValueChange(serializedDbValue, serializedBizValue);
    }
  };
  const renderValue = () => {
    if (currentValues.length === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          className: "min-w-fit",
          color: "default",
          size: size2,
          variant,
          onPress: handleOpenModal,
          isDisabled: isReadonly,
          children: t2("common.action.select")
        }
      );
    }
    if (isMultiple) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
        currentValues.map((value22) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            size: "sm",
            variant: "flat",
            onClose: isReadonly ? void 0 : () => handleRemoveValue(value22),
            children: value22.displayName
          },
          value22.id
        )),
        !isReadonly && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: handleOpenModal,
            children: "+"
          }
        )
      ] });
    }
    const value2 = currentValues[0];
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        className: "min-w-fit",
        color: "default",
        size: size2,
        variant,
        onPress: handleOpenModal,
        isDisabled: isReadonly,
        children: value2.displayName
      }
    );
  };
  return renderValue();
};
const log$m = buildLogger("PropertyValueRenderer");
const PropertyValueRenderer = (props) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const {
    property: property2,
    variant = "default",
    onValueChange,
    dbValue,
    bizValue,
    defaultEditing,
    size: size2 = "md",
    isReadonly: isReadonlyProp,
    isEditing
  } = props;
  const { t: t2 } = useTranslation();
  const isReadonly = isReadonlyProp ?? false;
  const dbValueType = getDbValueType(property2.type);
  const bizValueType = getBizValueType(property2.type);
  let bv = deserializeStandardValue(bizValue ?? null, bizValueType);
  const dv = deserializeStandardValue(dbValue ?? null, dbValueType);
  log$m(props, bv, dv);
  const simpleOnValueChange = !isReadonly && onValueChange ? (dv2, bv2) => {
    const sdv = serializeStandardValue(dv2 ?? null, dbValueType);
    const sbv = serializeStandardValue(bv2 ?? null, bizValueType);
    log$m("OnValueChange:Serialization:dv", dv2, sdv);
    log$m("OnValueChange:Serialization:bv", bv2, sbv);
    return onValueChange(sdv, sbv);
  } : void 0;
  const simpleEditor = simpleOnValueChange ? {
    value: dv,
    onValueChange: simpleOnValueChange
  } : void 0;
  if (property2.pool === PropertyPool.Internal && property2.id === InternalProperty.ParentResource) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      ParentResourceValueRenderer,
      {
        bizValue,
        dbValue,
        defaultEditing,
        isReadonly,
        property: property2,
        size: size2,
        variant,
        onValueChange
      }
    );
  }
  switch (property2.type) {
    case PropertyType.SingleLineText: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.MultilineText: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      bv ?? (bv = dv);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        StringValueRenderer,
        {
          multiline: true,
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.SingleChoice: {
      const typedDv = dv;
      const oc2 = onValueChange == void 0 ? void 0 : (dbValue2, bizValue2) => {
        onValueChange(
          dbValue2 && dbValue2.length > 0 ? serializeStandardValue(dbValue2[0], StandardValueType.String) : void 0,
          bizValue2 && bizValue2.length > 0 ? serializeStandardValue(bizValue2[0], StandardValueType.String) : void 0
        );
      };
      const editor = oc2 ? {
        value: typedDv == void 0 ? void 0 : [typedDv],
        onValueChange: oc2
      } : void 0;
      const typedBv = bv ?? ((_b2 = (((_a2 = property2.options) == null ? void 0 : _a2.choices) ?? []).find((x2) => x2.value == typedDv)) == null ? void 0 : _b2.label);
      const vas = _$2.sortBy(
        ((_d = (_c2 = property2.options) == null ? void 0 : _c2.choices) == null ? void 0 : _d.filter((o2) => dv == null ? void 0 : dv.includes(o2.value))) ?? [],
        (x2) => x2.value == typedDv
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChoiceValueRenderer,
        {
          defaultEditing,
          editor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2.options) == null ? void 0 : _a3.choices) ?? [];
          },
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv == void 0 ? void 0 : [typedBv],
          valueAttributes: vas,
          variant
        }
      );
    }
    case PropertyType.MultipleChoice: {
      const typedDv = dv;
      const typedBv = bv ?? (((_e = property2.options) == null ? void 0 : _e.choices) ?? []).filter((x2) => typedDv == null ? void 0 : typedDv.includes(x2.value)).map((x2) => x2.label);
      const vas = _$2.sortBy(
        ((_g = (_f = property2.options) == null ? void 0 : _f.choices) == null ? void 0 : _g.filter((o2) => dv == null ? void 0 : dv.includes(o2.value))) ?? [],
        (x2) => typedDv == null ? void 0 : typedDv.findIndex((d2) => d2 == x2.value)
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        ChoiceValueRenderer,
        {
          multiple: true,
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2.options) == null ? void 0 : _a3.choices) ?? [];
          },
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          valueAttributes: vas,
          variant
        }
      );
    }
    case PropertyType.Number: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: "number",
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Percentage: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        NumberValueRenderer,
        {
          as: "progress",
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          suffix: "%",
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Rating: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        RatingValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Boolean: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        BooleanValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Link: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        LinkValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Attachment: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        AttachmentValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Date:
    case PropertyType.DateTime: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateTimeValueRenderer,
        {
          as: property2.type == PropertyType.DateTime ? "datetime" : "date",
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Time: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TimeValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Formula: {
      const typedDv = dv;
      const typedBv = bv ?? typedDv;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        FormulaValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          variant
        }
      );
    }
    case PropertyType.Multilevel: {
      const typedDv = dv;
      const tbv = typedDv == null ? void 0 : typedDv.map((v2) => {
        var _a3;
        return findNodeChainInMultilevelData(((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.data) || [], v2);
      }).filter((x2) => x2 != void 0);
      const typedBv = bv ?? (tbv == null ? void 0 : tbv.map((x2) => x2.map((y2) => y2.label)));
      const vas = tbv == null ? void 0 : tbv.map((v2) => v2.map((x2) => ({ color: x2.color })));
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MultilevelValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.data) || [];
          },
          isEditing,
          isReadonly,
          multiple: ((_h = property2 == null ? void 0 : property2.options) == null ? void 0 : _h.valueIsSingleton) ?? true,
          size: size2,
          value: typedBv,
          valueAttributes: vas,
          variant
        }
      );
    }
    case PropertyType.Tags: {
      const typedDv = dv;
      const tags = ((_i = property2.options) == null ? void 0 : _i.tags) || [];
      const typedBv = bv ?? tags.filter((x2) => dv == null ? void 0 : dv.includes(x2.value)).map((x2) => ({
        group: x2.group,
        name: x2.name
      }));
      const vas = _$2.sortBy(
        tags.filter((o2) => typedDv == null ? void 0 : typedDv.includes(o2.value)),
        (x2) => typedDv == null ? void 0 : typedDv.findIndex((d2) => d2 == x2.value)
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TagsValueRenderer,
        {
          defaultEditing,
          editor: simpleEditor,
          getDataSource: async () => {
            var _a3;
            return ((_a3 = property2 == null ? void 0 : property2.options) == null ? void 0 : _a3.tags) || [];
          },
          isEditing,
          isReadonly,
          size: size2,
          value: typedBv,
          valueAttributes: vas,
          variant
        }
      );
    }
  }
};
PropertyValueRenderer.displayName = "PropertyValueRenderer";
const BriefProperty = ({ property: property2, fields, showPoolChip = true, chipProps }) => {
  const { t: t2 } = useTranslation();
  fields ?? (fields = ["pool", "type", "name"]);
  const nameColor = showPoolChip ? "default" : getPropertyPoolColor(property2 == null ? void 0 : property2.pool);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: property2 ? fields.map((f2) => {
    switch (f2) {
      case "pool":
        return showPoolChip ? /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyPoolIcon, { pool: property2.pool }, f2) : null;
      case "type":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { type: property2.type }, f2);
      case "name":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: nameColor, radius: "sm", size: "sm", variant: "flat", ...chipProps, children: property2.name }, f2);
    }
  }) : t2("Unknown property") });
};
BriefProperty.displayName = "BriefProperty";
const log$l = buildLogger("PropertyContainer");
const PropertyContainer = (props) => {
  useUpdate();
  log$l(props);
  const {
    valueScopePriority,
    onValueScopePriorityChange,
    values,
    property: property2,
    onValueChange,
    hidePropertyName = false,
    classNames: classNames2,
    isLinked: propsIsLinked,
    categoryId,
    layout: layout2 = "horizontal"
  } = props;
  const { t: t2 } = useTranslation();
  const [isLinked, setIsLinked] = React$6.useState(propsIsLinked);
  propertyValueScopes.map((s2) => {
    return {
      key: s2.value,
      scope: s2.value,
      value: values == null ? void 0 : values.find((x2) => x2.scope == s2.value)
    };
  });
  let bizValue;
  let dbValue;
  let scope;
  for (const s2 of valueScopePriority) {
    const value2 = values == null ? void 0 : values.find((v2) => v2.scope == s2);
    if (value2) {
      const dv = value2.aliasAppliedBizValue ?? value2.bizValue;
      if (dv) {
        bizValue = dv;
        dbValue = value2.value;
        scope = s2;
        break;
      }
    }
  }
  scope ?? (scope = valueScopePriority[0]);
  if (layout2 === "vertical") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-0.5", children: [
      !hidePropertyName && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames2 == null ? void 0 : classNames2.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        BriefProperty,
        {
          chipProps: { variant: "light", className: "px-0 leading-none", classNames: { content: "px-0", base: "h-auto" } },
          fields: ["pool", "name"],
          property: property2,
          showPoolChip: false
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center gap-2 break-all ${classNames2 == null ? void 0 : classNames2.value}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        PropertyValueRenderer,
        {
          bizValue: serializeStandardValue(bizValue, property2.bizValueType),
          dbValue: serializeStandardValue(dbValue, property2.dbValueType),
          property: property2,
          variant: "default",
          onValueChange
        }
      ) })
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-0.5", children: [
    !hidePropertyName && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classNames2 == null ? void 0 : classNames2.name, children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["pool", "name"], property: property2, showPoolChip: false }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center gap-2 break-all ${classNames2 == null ? void 0 : classNames2.value}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyValueRenderer,
      {
        bizValue: serializeStandardValue(bizValue, property2.bizValueType),
        dbValue: serializeStandardValue(dbValue, property2.dbValueType),
        property: property2,
        variant: "default",
        onValueChange
      }
    ) })
  ] });
};
PropertyContainer.displayName = "PropertyContainer";
const log$k = buildLogger("Properties");
const Properties = (props) => {
  const {
    resource,
    className,
    reload,
    restrictedPropertyPool,
    restrictedPropertyIds,
    propertyInnerDirection = "hoz",
    hidePropertyName = false,
    propertyClassNames,
    noPropertyContent,
    sortable = false,
    columns = 2
  } = props;
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const cps = resource.properties;
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const [valueScopePriority, setValueScopePriority] = reactExports.useState([]);
  const [builtinPropertyMap, setBuiltinPropertyMap] = reactExports.useState({});
  const [customPropertyMap, setCustomPropertyMap] = reactExports.useState({});
  reactExports.useEffect(() => {
    const c2 = resourceOptions.propertyValueScopePriority;
    const vsp = c2 && c2.length > 0 ? c2.slice() : propertyValueScopes.map((s2) => s2.value);
    for (const scope of propertyValueScopes) {
      if (!vsp.includes(scope.value)) {
        if (scope.value == PropertyValueScope.Manual) {
          vsp.splice(0, 0, scope.value);
        } else {
          vsp.push(scope.value);
        }
      }
    }
    setValueScopePriority(vsp);
  }, [resourceOptions.propertyValueScopePriority]);
  reactExports.useEffect(() => {
    var _a2;
    BApi$1.property.getPropertiesByPool(PropertyPool.Reserved | PropertyPool.Internal).then((r2) => {
      const ps = r2.data || [];
      setBuiltinPropertyMap(
        ps.reduce((s2, t22) => {
          s2[t22.id] = t22;
          return s2;
        }, {})
      );
    });
    if (restrictedPropertyPool == void 0 || restrictedPropertyPool == PropertyPool.Custom) {
      const customPropertyMap2 = ((_a2 = resource.properties) == null ? void 0 : _a2[PropertyPool.Custom]) || {};
      const customPropertyIds = Object.keys(customPropertyMap2).map((x2) => parseInt(x2, 10));
      if (customPropertyIds.length > 0) {
        BApi$1.customProperty.getCustomPropertyByKeys({ ids: customPropertyIds }).then((r2) => {
          const ps = r2.data || [];
          setCustomPropertyMap(
            ps.reduce((s2, t22) => {
              s2[t22.id] = t22;
              return s2;
            }, {})
          );
        });
      }
    }
  }, []);
  if (!cps || Object.keys(cps).length == 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: t2("There is no property bound yet, you can bind properties in resource profile.") });
  }
  const onValueChange = async (propertyId, isCustomProperty, value2) => {
    await BApi$1.resource.putResourcePropertyValue(resource.id, {
      value: value2,
      isCustomProperty,
      propertyId
    });
    reload();
  };
  log$k(props, "reserved property map", builtinPropertyMap);
  const buildRenderContext = () => {
    const renderContext2 = [];
    Object.keys(resource.properties ?? {}).forEach((propertyPoolStr) => {
      var _a2;
      const pp = parseInt(propertyPoolStr, 10);
      if (restrictedPropertyPool != void 0 && restrictedPropertyPool != pp) {
        return;
      }
      const propertyMap = ((_a2 = resource.properties) == null ? void 0 : _a2[pp]) ?? {};
      Object.keys(propertyMap).forEach((idStr) => {
        const pId = parseInt(idStr, 10);
        if (restrictedPropertyIds != void 0 && !restrictedPropertyIds.includes(pId)) {
          return;
        }
        const sp = propertyMap[pId];
        let property2;
        switch (pp) {
          case PropertyPool.Internal:
            break;
          case PropertyPool.Reserved:
            property2 = builtinPropertyMap[pId];
            break;
          case PropertyPool.Custom: {
            const p2 = customPropertyMap == null ? void 0 : customPropertyMap[pId];
            property2 = p2;
            break;
          }
        }
        if (property2) {
          renderContext2.push({
            property: property2,
            propertyPool: pp,
            propertyValues: sp,
            visible: sp.visible ?? false,
            order: sp.order
          });
        }
      });
    });
    return renderContext2.sort((a2, b2) => a2.order - b2.order);
  };
  const renderProperty = (pCtx) => {
    const { property: property2, propertyValues, propertyPool } = pCtx;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyContainer,
      {
        categoryId: resource.categoryId,
        classNames: propertyClassNames,
        hidePropertyName,
        isLinked: pCtx.visible,
        layout: "vertical",
        property: property2,
        valueScopePriority,
        values: propertyValues.values,
        onValueChange: (sdv, sbv) => {
          var _a2;
          const dv = deserializeStandardValue(sdv ?? null, property2.dbValueType);
          const bv = deserializeStandardValue(sbv ?? null, property2.bizValueType);
          log$k("OnValueChange", "dv", dv, "bv", bv, "sdv", sdv, "sbv", sbv, property2);
          let manualValue = (_a2 = propertyValues.values) == null ? void 0 : _a2.find(
            (v2) => v2.scope == PropertyValueScope.Manual
          );
          if (!manualValue) {
            manualValue = {
              scope: PropertyValueScope.Manual
            };
            (propertyValues.values ?? (propertyValues.values = [])).push(manualValue);
          }
          manualValue.bizValue = bv;
          manualValue.aliasAppliedBizValue = bv;
          manualValue.value = dv;
          forceUpdate();
          onValueChange(property2.id, property2.pool == PropertyPool.Custom, sdv);
        },
        onValueScopePriorityChange: reload
      },
      `${propertyPool}-${property2.id}`
    );
  };
  const renderContext = buildRenderContext();
  const visibleProperties = renderContext.filter((x2) => x2.visible);
  const invisibleProperties = renderContext.filter((x2) => !x2.visible);
  const masonryStyle = {
    columnCount: columns,
    columnGap: "1rem"
  };
  const masonryItemStyle = {
    breakInside: "avoid",
    marginBottom: "0.5rem"
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    propertyInnerDirection == "hoz" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: `${className} overflow-visible`,
          style: masonryStyle,
          children: visibleProperties.map((pCtx) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: masonryItemStyle, children: renderProperty(pCtx) }, `${pCtx.propertyPool}-${pCtx.property.id}`))
        }
      ),
      invisibleProperties.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 my-3 opacity-50", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "flex-1" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400 whitespace-nowrap", children: t2("The following properties are not bound to resource profiles") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "flex-1" })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `${className} overflow-visible`,
            style: masonryStyle,
            children: invisibleProperties.map((pCtx) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: masonryItemStyle, children: renderProperty(pCtx) }, `${pCtx.propertyPool}-${pCtx.property.id}`))
          }
        )
      ] })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
      visibleProperties.map((pCtx) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: renderProperty(pCtx) }, `${pCtx.propertyPool}-${pCtx.property.id}`)),
      invisibleProperties.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 my-1 opacity-50", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "flex-1" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400 whitespace-nowrap", children: t2("The following properties are not bound to resource profiles") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "flex-1" })
        ] }),
        invisibleProperties.map((pCtx) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: renderProperty(pCtx) }, `${pCtx.propertyPool}-${pCtx.property.id}`))
      ] })
    ] }),
    renderContext.length == 0 ? noPropertyContent : null
  ] });
};
Properties.displayName = "Properties";
const MediaLibraryMappings = ({ resourceId, onMappingsChange, compact = false }) => {
  const { t: t2 } = useTranslation();
  const [loading, setLoading] = reactExports.useState(true);
  const [mappings, setMappings] = reactExports.useState([]);
  const [allLibraries, setAllLibraries] = reactExports.useState([]);
  const [addPopoverOpen, setAddPopoverOpen] = reactExports.useState(false);
  const loadData = reactExports.useCallback(async () => {
    setLoading(true);
    try {
      const [mappingsRsp, librariesRsp] = await Promise.all([
        BApi$1.mediaLibraryResourceMapping.getMappingsByResourceId(resourceId),
        BApi$1.mediaLibraryV2.getAllMediaLibraryV2()
      ]);
      const libs = librariesRsp.data || [];
      setAllLibraries(libs);
      const mappingsData = mappingsRsp.data || [];
      const mappingsWithLib = mappingsData.map((m2) => ({
        ...m2,
        mediaLibrary: libs.find((lib2) => lib2.id === m2.mediaLibraryId)
      }));
      setMappings(mappingsWithLib);
    } catch (error2) {
      console.error("Failed to load mappings:", error2);
    } finally {
      setLoading(false);
    }
  }, [resourceId]);
  reactExports.useEffect(() => {
    loadData();
  }, [loadData]);
  const handleAddMapping = reactExports.useCallback(
    async (mediaLibraryId) => {
      try {
        await BApi$1.mediaLibraryResourceMapping.addMediaLibraryResourceMapping({
          id: 0,
          mediaLibraryId,
          resourceId,
          createDt: (/* @__PURE__ */ new Date()).toISOString()
        });
        toast.success(t2("resource.success.mediaLibraryAdded"));
        await loadData();
        onMappingsChange == null ? void 0 : onMappingsChange();
        setAddPopoverOpen(false);
      } catch (error2) {
        console.error("Failed to add mapping:", error2);
        toast.danger(t2("resource.error.failedToAddMediaLibrary"));
      }
    },
    [resourceId, t2, loadData, onMappingsChange]
  );
  const handleRemoveMapping = reactExports.useCallback(
    async (mappingId) => {
      try {
        await BApi$1.mediaLibraryResourceMapping.deleteMediaLibraryResourceMapping(
          mappingId
        );
        toast.success(t2("resource.success.mediaLibraryRemoved"));
        await loadData();
        onMappingsChange == null ? void 0 : onMappingsChange();
      } catch (error2) {
        console.error("Failed to remove mapping:", error2);
        toast.danger(t2("resource.error.failedToRemoveMediaLibrary"));
      }
    },
    [t2, loadData, onMappingsChange]
  );
  const availableLibraries = allLibraries.filter(
    (lib2) => !mappings.some((m2) => m2.mediaLibraryId === lib2.id)
  );
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      !compact && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-sm text-default-500 shrink-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$x, { className: "text-base" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("common.label.mediaLibraries") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" })
    ] });
  }
  if (compact && mappings.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
    !compact && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-sm text-default-500 shrink-0 pt-0.5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$x, { className: "text-base" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("common.label.mediaLibraries") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-1 flex-1", children: [
      mappings.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400", children: t2("common.label.none") }) : mappings.map((mapping) => {
        var _a2, _b2, _c2;
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            size: "sm",
            variant: "flat",
            style: {
              backgroundColor: ((_a2 = mapping.mediaLibrary) == null ? void 0 : _a2.color) ? `${mapping.mediaLibrary.color}20` : void 0,
              color: (_b2 = mapping.mediaLibrary) == null ? void 0 : _b2.color
            },
            endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.tip.removeFromMediaLibrary"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                className: "",
                isIconOnly: true,
                size: "sm",
                variant: "light",
                color: "danger",
                onPress: (e2) => {
                  handleRemoveMapping(mapping.id);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
              }
            ) }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: ((_c2 = mapping.mediaLibrary) == null ? void 0 : _c2.name) || t2("common.state.unknown") })
          },
          mapping.id
        );
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PopoverComponent,
        {
          placement: "bottom-end",
          trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              isDisabled: availableLibraries.length === 0,
              size: "sm",
              variant: "light",
              color: "primary",
              className: "min-w-6 w-6 h-6",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, { className: "text-base" })
            }
          ),
          visible: addPopoverOpen,
          onOpenChange: setAddPopoverOpen,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-60 overflow-y-auto min-w-[200px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            listbox_default,
            {
              "aria-label": t2("resource.modal.selectMediaLibrary"),
              onAction: (key) => {
                const id2 = parseInt(key, 10);
                handleAddMapping(id2);
              },
              children: availableLibraries.map((lib2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { textValue: lib2.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "span",
                  {
                    className: "w-2 h-2 rounded-full",
                    style: { backgroundColor: lib2.color || "#888" }
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: lib2.name })
              ] }) }, lib2.id))
            }
          ) })
        }
      )
    ] })
  ] });
};
MediaLibraryMappings.displayName = "MediaLibraryMappings";
const MAX_SUMMARY_LENGTH = 100;
const IntroductionSummary = ({ resource, onReload }) => {
  const { t: t2 } = useTranslation();
  const [isDrawerOpen, setIsDrawerOpen] = reactExports.useState(false);
  const [isEditing, setIsEditing] = reactExports.useState(false);
  const [editValue, setEditValue] = reactExports.useState("");
  const [isSaving, setIsSaving] = reactExports.useState(false);
  const introduction = reactExports.useMemo(() => {
    var _a2, _b2;
    const reservedProps = (_a2 = resource.properties) == null ? void 0 : _a2[PropertyPool.Reserved];
    if (!reservedProps)
      return null;
    const introProperty = reservedProps[ReservedProperty.Introduction];
    if (!((_b2 = introProperty == null ? void 0 : introProperty.values) == null ? void 0 : _b2.length))
      return null;
    const value2 = introProperty.values[0];
    return value2 == null ? void 0 : value2.bizValue;
  }, [resource]);
  const handleOpenDrawer = () => {
    setEditValue(introduction || "");
    setIsDrawerOpen(true);
  };
  const handleSave = async () => {
    setIsSaving(true);
    try {
      const serializedValue = editValue.trim() ? serializeStandardValue(editValue, StandardValueType.String) : void 0;
      await BApi$1.resource.putResourcePropertyValue(resource.id, {
        value: serializedValue,
        isCustomProperty: false,
        propertyId: ReservedProperty.Introduction
      });
      setIsEditing(false);
      onReload == null ? void 0 : onReload();
    } finally {
      setIsSaving(false);
    }
  };
  const hasIntroduction = !!introduction;
  const plainTextIntroduction = (introduction == null ? void 0 : introduction.replace(/<[^>]*>/g, "")) ?? null;
  const isTruncated = !!plainTextIntroduction && plainTextIntroduction.length > MAX_SUMMARY_LENGTH;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      card_default,
      {
        isPressable: true,
        className: "w-full cursor-pointer hover:bg-default-100 transition-colors",
        onPress: handleOpenDrawer,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "py-2 px-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: hasIntroduction ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "text-sm text-default-600 line-clamp-2",
              dangerouslySetInnerHTML: { __html: introduction }
            }
          ),
          isTruncated && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-primary mt-1", children: t2("resource.tip.clickToViewFullIntroduction") })
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-400 italic", children: t2("resource.tip.clickToAddIntroduction") }) }) }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      drawer_default,
      {
        isOpen: isDrawerOpen,
        placement: "right",
        size: "lg",
        onClose: () => {
          setIsDrawerOpen(false);
          setIsEditing(false);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_content_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(modal_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1c, {}),
            t2("common.label.introduction")
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(modal_body_default, { children: isEditing ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 h-full", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                className: "flex-1",
                minRows: 10,
                placeholder: t2("resource.placeholder.enterIntroduction"),
                value: editValue,
                onValueChange: setEditValue
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 justify-end", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  variant: "light",
                  onPress: () => {
                    setIsEditing(false);
                    setEditValue(introduction || "");
                  },
                  children: t2("common.action.cancel")
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  isLoading: isSaving,
                  onPress: handleSave,
                  children: t2("common.action.save")
                }
              )
            ] })
          ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "flex-1 text-default-700",
                dangerouslySetInnerHTML: { __html: introduction ?? "" }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, {}),
                variant: "flat",
                onPress: () => {
                  setEditValue(introduction || "");
                  setIsEditing(true);
                },
                children: t2("common.action.edit")
              }
            ) })
          ] }) })
        ] })
      }
    )
  ] });
};
IntroductionSummary.displayName = "IntroductionSummary";
const ResourceProfiles = ({ resourceId, onClose, compact = false }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [profiles, setProfiles] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  reactExports.useEffect(() => {
    const loadProfiles = async () => {
      setLoading(true);
      try {
        const response = await BApi$1.resourceProfile.getMatchingProfilesForResource(resourceId);
        setProfiles(response.data || []);
      } catch (error2) {
        console.error("Failed to load matching profiles:", error2);
        setProfiles([]);
      } finally {
        setLoading(false);
      }
    };
    loadProfiles();
  }, [resourceId]);
  const handleNavigateToProfile = (profileId) => {
    onClose == null ? void 0 : onClose();
    navigate(`/resource-profile?highlight=${profileId}`);
  };
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
      !compact && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-sm text-default-500 shrink-0", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$h, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("resource.label.resourceProfiles") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" })
    ] });
  }
  if (compact && profiles.length === 0) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
    !compact && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-sm text-default-500 shrink-0 pt-0.5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$h, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("resource.label.resourceProfiles") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 flex-1", children: profiles.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400", children: t2("common.label.none") }) : profiles.map((profile) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: t2("resource.tip.clickToViewEditProfile"),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            className: "cursor-pointer",
            color: "primary",
            endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1m, { className: "text-xs" }),
            size: "sm",
            variant: "flat",
            onClick: () => handleNavigateToProfile(profile.id),
            children: profile.name
          }
        )
      },
      profile.id
    )) })
  ] });
};
ResourceProfiles.displayName = "ResourceProfiles";
const ResourceHierarchy = ({ resource, onReload }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [ancestors, setAncestors] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const [childrenCount, setChildrenCount] = reactExports.useState(void 0);
  const loadHierarchyContext = reactExports.useCallback(async () => {
    var _a2, _b2;
    if (!resource.parentId && !resource.hasChildren) {
      setAncestors([]);
      setChildrenCount(void 0);
      return;
    }
    setLoading(true);
    try {
      const res = await BApi$1.resource.getResourceHierarchyContext(resource.id);
      setAncestors(((_a2 = res.data) == null ? void 0 : _a2.ancestors) ?? []);
      setChildrenCount(((_b2 = res.data) == null ? void 0 : _b2.childrenCount) ?? void 0);
    } catch (error2) {
      console.error("Failed to load hierarchy context:", error2);
    } finally {
      setLoading(false);
    }
  }, [resource.id, resource.parentId, resource.hasChildren]);
  reactExports.useEffect(() => {
    loadHierarchyContext();
  }, [loadHierarchyContext]);
  if (!resource.parentId && !resource.hasChildren) {
    return null;
  }
  const handleAncestorClick = (ancestorId) => {
    createPortal(DetailModal, {
      id: ancestorId,
      onDestroyed: onReload
    });
  };
  const handleChildrenClick = () => {
    createPortal(ChildrenModal, {
      resourceId: resource.id,
      resourceDisplayName: resource.displayName
    });
  };
  const displayAncestors = ancestors.length > 3 ? [ancestors[0], null, ...ancestors.slice(-2)] : ancestors;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
      breadcrumbs_default,
      {
        size: "sm",
        variant: "light",
        classNames: {
          list: "flex-wrap"
        },
        children: [
          displayAncestors.map((ancestor, index2) => {
            if (ancestor === null) {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(breadcrumb_item_default, { isDisabled: true, children: "..." }, "ellipsis");
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(breadcrumb_item_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "span",
              {
                className: "cursor-pointer hover:underline text-primary",
                onClick: () => handleAncestorClick(ancestor.id),
                children: ancestor.displayName
              }
            ) }, ancestor.id);
          }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            breadcrumb_item_default,
            {
              isCurrent: true,
              classNames: {
                item: "font-semibold"
              },
              children: resource.displayName
            },
            resource.id
          ),
          resource.hasChildren && /* @__PURE__ */ jsxRuntimeExports.jsx(breadcrumb_item_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "span",
            {
              className: "flex items-center gap-1 cursor-pointer hover:underline text-primary",
              onClick: handleChildrenClick,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(TiFlowChildren, { className: "text-sm" }),
                t2("common.label.children"),
                childrenCount !== void 0 && ` (${childrenCount})`
              ]
            }
          ) }, "children")
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500", children: t2("resource.tip.hierarchyDescription") })
  ] });
};
const MediaPreviewer = (props) => {
  const { t: t2 } = useTranslation();
  const { resourceId } = props;
  const [items, setItems] = reactExports.useState([]);
  const itemsRef = reactExports.useRef(items);
  const [status, setStatus] = reactExports.useState(
    0
    /* Initializing */
  );
  const statusRef = reactExports.useRef(status);
  const [mouseOffsetX, setMouseOffsetX] = reactExports.useState();
  const mouseOffsetXRef = reactExports.useRef(mouseOffsetX);
  const [currentFrame, setCurrentFrame] = reactExports.useState(-1);
  const currentFrameRef = reactExports.useRef(currentFrame);
  const [currentItem, setCurrentItem] = reactExports.useState();
  const currentItemRef = reactExports.useRef(currentItem);
  const autoPlayTimeoutRef = reactExports.useRef();
  const mediaRef = reactExports.useRef(null);
  const reactPlayerRef = reactExports.useRef(null);
  const videoInitializedRef = reactExports.useRef(false);
  const [playabilityError, setPlayabilityError] = reactExports.useState(null);
  const [isCheckingPlayability, setIsCheckingPlayability] = reactExports.useState(false);
  const playabilityCheckedPathsRef = reactExports.useRef(/* @__PURE__ */ new Map());
  const isControlled = reactExports.useCallback(
    () => mouseOffsetXRef.current != void 0,
    []
  );
  const setPlayerRef = reactExports.useCallback((player) => {
    if (!player)
      return;
    reactPlayerRef.current = player;
    console.log(player);
  }, []);
  useUpdateEffect(() => {
    statusRef.current = status;
    switch (status) {
      case 0:
        break;
      case 1:
        break;
      case 2:
        resume();
        break;
      case 3:
        pauseAutomatically();
        break;
    }
  }, [status]);
  useUpdateEffect(() => {
    var _a2;
    mouseOffsetXRef.current = mouseOffsetX;
    if (mouseOffsetX != void 0) {
      const percent2 = ((_a2 = progressBarRef.current) == null ? void 0 : _a2.clientWidth) ? mouseOffsetX * 100 / progressBarRef.current.clientWidth : 0;
      const totalFrameCount2 = items.reduce(
        (prev2, curr) => prev2 + curr.duration,
        0
      );
      const cf2 = Math.ceil(totalFrameCount2 * percent2 / 100);
      if (cf2 != currentFrameRef.current) {
        setCurrentFrame(cf2);
      }
    }
  }, [mouseOffsetX]);
  reactExports.useEffect(() => {
    BApi$1.resource.getResourceDataForPreviewer(resourceId, {
      showErrorToast: (r2) => (r2.code >= 404 || r2.code < 200) && r2.code != 404
    }).then((rsp) => {
      var _a2;
      if (rsp.data && ((_a2 = rsp.data) == null ? void 0 : _a2.length) > 0) {
        const newItems = [];
        let prevFrame = 0;
        for (const d2 of rsp.data) {
          const item = {
            duration: d2.duration,
            filePath: d2.filePath,
            type: d2.type,
            startFrame: prevFrame,
            endFrame: prevFrame + d2.duration - 1
          };
          newItems.push(item);
          prevFrame = item.endFrame + 1;
        }
        setItems(newItems);
        setStatus(
          2
          /* Playing */
        );
        setCurrentFrame(0);
      } else {
        setStatus(
          4
          /* NothingToPreview */
        );
      }
    });
  }, []);
  reactExports.useEffect(() => {
    itemsRef.current = items;
  }, [items]);
  reactExports.useEffect(() => {
    currentFrameRef.current = currentFrame;
    const item = itemsRef.current.find(
      (item2) => item2.startFrame <= currentFrame && item2.endFrame >= currentFrame
    );
    if (item) {
      if (mouseOffsetXRef.current != void 0) {
        if (item == currentItemRef.current) {
          if (reactPlayerRef.current) {
            console.log("seeking video", reactPlayerRef.current);
            reactPlayerRef.current.currentTime = currentFrame - item.startFrame;
          }
        } else {
          setCurrentItem(item);
        }
      } else {
        if (item.startFrame == currentFrame) {
          setStatus(
            2
            /* Playing */
          );
          setCurrentItem(item);
        }
      }
    }
  }, [currentFrame]);
  useUpdateEffect(() => {
    videoInitializedRef.current = false;
    currentItemRef.current = currentItem;
  }, [currentItem]);
  reactExports.useEffect(() => {
    if (!currentItem || currentItem.type !== MediaType.Video) {
      setPlayabilityError(null);
      return;
    }
    const filePath = currentItem.filePath;
    const cached = playabilityCheckedPathsRef.current.get(filePath);
    if (cached) {
      if (!cached.playable) {
        setPlayabilityError(cached.error || t2("Cannot play this file"));
        setStatus(
          5
          /* NotPlayable */
        );
      } else {
        setPlayabilityError(null);
      }
      return;
    }
    const checkPlayability = async () => {
      setIsCheckingPlayability(true);
      try {
        const response = await BApi$1.file.checkFilePlayability({ fullname: filePath });
        if (response.data) {
          playabilityCheckedPathsRef.current.set(filePath, response.data);
          if (!response.data.playable) {
            setPlayabilityError(response.data.error || t2("Cannot play this file"));
            setStatus(
              5
              /* NotPlayable */
            );
          } else {
            setPlayabilityError(null);
          }
        }
      } catch (err) {
        setPlayabilityError(null);
      } finally {
        setIsCheckingPlayability(false);
      }
    };
    checkPlayability();
  }, [currentItem]);
  const progressBarRef = reactExports.useRef(null);
  const totalFrameCount = items.reduce((prev2, curr) => prev2 + curr.duration, 0);
  let percentProgress = mouseOffsetX != void 0 ? progressBarRef.current ? mouseOffsetX * 100 / progressBarRef.current.clientWidth : 0 : totalFrameCount == 0 ? 0 : (currentFrame + 1) * 100 / totalFrameCount;
  const renderMedia = () => {
    var _a2, _b2;
    if (currentItem) {
      switch (currentItem.type) {
        case MediaType.Image:
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            "img",
            {
              src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(currentItem.filePath)}`,
              onLoad: () => {
                clearTimeout(autoPlayTimeoutRef.current);
                if (currentFrame < totalFrameCount && statusRef.current == 2) {
                  autoPlayTimeoutRef.current = setTimeout(() => {
                    setCurrentFrame(currentFrame + 1);
                  }, 1e3);
                }
              }
            }
          );
        case MediaType.Video: {
          const playing = status == 2 && !isControlled();
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            src_default,
            {
              ref: setPlayerRef,
              muted: true,
              controls: false,
              height: (_a2 = mediaRef.current) == null ? void 0 : _a2.clientHeight,
              playing,
              src: `${envConfig.apiEndpoint}/file/play?fullname=${encodeURIComponent(currentItem.filePath)}`,
              width: (_b2 = mediaRef.current) == null ? void 0 : _b2.clientWidth,
              onCanPlay: () => {
                if (!videoInitializedRef.current && reactPlayerRef.current) {
                  if (isControlled()) {
                    const seekTo = currentFrame - currentItem.startFrame;
                    if (seekTo > 0) {
                      reactPlayerRef.current.currentTime = seekTo;
                    }
                  }
                  videoInitializedRef.current = true;
                }
              },
              onEnded: () => {
                if (!isControlled()) {
                  const nextItem = items.find(
                    (item) => item.startFrame > currentItem.startFrame
                  );
                  if (nextItem) {
                    setCurrentFrame(nextItem.startFrame);
                  } else {
                    setCurrentFrame(currentItem.endFrame);
                  }
                }
              },
              onLoadedMetadata: () => {
              },
              onTimeUpdate: () => {
                if (!isControlled() && reactPlayerRef.current) {
                  const frame2 = Math.ceil(reactPlayerRef.current.currentTime);
                  const nextFrame = frame2 + currentItem.startFrame - 1;
                  if (nextFrame != currentFrame) {
                    setCurrentFrame(nextFrame);
                  }
                }
              }
            }
          );
        }
        case MediaType.Audio:
        case MediaType.Text:
        case MediaType.Unknown:
        default:
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Unsupported") });
      }
    }
    return;
  };
  const pauseAutomatically = reactExports.useCallback(() => {
    clearTimeout(autoPlayTimeoutRef.current);
    autoPlayTimeoutRef.current = void 0;
  }, []);
  const resume = reactExports.useCallback(() => {
    var _a2;
    if (!autoPlayTimeoutRef.current) {
      if (((_a2 = currentItemRef.current) == null ? void 0 : _a2.type) == MediaType.Image) {
        autoPlayTimeoutRef.current = setTimeout(() => {
          const totalFrameCount2 = itemsRef.current.reduce(
            (prev2, curr) => prev2 + curr.duration,
            0
          );
          if (currentFrameRef.current < totalFrameCount2) {
            setCurrentFrame(currentFrameRef.current + 1);
          }
        }, 1e3);
      }
    }
  }, []);
  const renderCore = () => {
    switch (status) {
      case 4:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "nothing-to-preview", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mask" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-2xl" }) })
        ] });
      case 0:
      case 1:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "loading", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mask" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "label", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-2xl" }) })
        ] });
      case 5:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "not-playable", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mask" }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "label flex flex-col items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-2xl text-yellow-500" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs mt-1 text-center max-w-full px-2 truncate", children: playabilityError || t2("Cannot play") })
          ] })
        ] });
      case 2:
      case 3:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "playing", children: [
          status == 3 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "paused-cover",
              onClick: () => {
                setStatus(
                  2
                  /* Playing */
                );
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdAccessTime, { className: "text-3xl" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              ref: mediaRef,
              className: "media",
              onClick: () => {
                setStatus(
                  3
                  /* Paused */
                );
              },
              children: renderMedia()
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              ref: progressBarRef,
              className: "progress-bar",
              onMouseLeave: () => {
                if (mouseOffsetXRef.current != void 0) {
                  mouseOffsetXRef.current = void 0;
                  setMouseOffsetX(void 0);
                }
                resume();
              },
              onMouseMove: (e2) => {
                if (!progressBarRef.current) {
                  return;
                }
                const { left: left2 } = progressBarRef.current.getBoundingClientRect();
                const offsetX = Math.ceil(e2.clientX - left2);
                if (offsetX != mouseOffsetX) {
                  setMouseOffsetX(offsetX);
                }
                pauseAutomatically();
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bar", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "progress",
                  style: { width: `${percentProgress}%` }
                }
              ) })
            }
          )
        ] });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "media-previewer", children: renderCore() });
};
const FallbackCover = ({ id: id2, afterClearingCache }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const showModal = async () => {
    const cacheExists = (await BApi$1.cache.checkResourceCacheExistence(id2, ResourceCacheType.Covers)).data ?? false;
    createPortal(Modal, {
      defaultVisible: true,
      size: "lg",
      title: t2("ResourceCover.CoverTips.Title"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("ResourceCover.CoverTips.S1.Title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mb-1", children: t2("ResourceCover.CoverTips.S1.Happens") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-5 text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.When.NotImage") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.When.NoImageInFolder") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mt-1", children: t2("ResourceCover.CoverTips.S1.Todo") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("ol", { className: "list-decimal pl-5 text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.ManualSet") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.FFmpeg") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.Enhancers") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S1.Todo.Cache") })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("ResourceCover.CoverTips.S2.Title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mb-1", children: t2("ResourceCover.CoverTips.S2.Happens") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "list-disc pl-5 text-sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S2.When.CacheDeleted") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mt-1", children: t2("ResourceCover.CoverTips.S2.Todo") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("ol", { className: "list-decimal pl-5 text-sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("ResourceCover.CoverTips.S2.Todo.DisableCache") }) })
        ] }),
        cacheExists && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("Cover cache") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "secondary",
              size: "sm",
              variant: "flat",
              onPress: async () => {
                try {
                  await BApi$1.cache.deleteResourceCacheByResourceIdAndCacheType(
                    id2,
                    ResourceCacheType.Covers
                  );
                  await BApi$1.resource.discoverResourceCover(id2);
                  afterClearingCache == null ? void 0 : afterClearingCache();
                  toast.success(t2("Cover cache has been reset"));
                } catch (err) {
                  toast.danger("Failed");
                }
              },
              children: t2("Reset cover cache of current resource")
            }
          )
        ] })
      ] }),
      footer: { actions: ["ok"] }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          onPress: showModal,
          size: "sm",
          variant: "flat",
          color: "primary",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdHelpOutline, { className: "text-lg" }),
          children: t2("ResourceCover.CoverTips.Tooltip")
        }
      ),
      delay: 2e3,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "inline-flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdBrokenImage, { className: "text-2xl opacity-50" }) })
    }
  );
};
class ResourceDiscoveryChannel {
  constructor() {
    __publicField(this, "eventSource", null);
    __publicField(this, "subscribers", /* @__PURE__ */ new Map());
    __publicField(this, "pendingRequests", /* @__PURE__ */ new Set());
    // resourceId-types (already sent)
    __publicField(this, "pendingSubscriptions", /* @__PURE__ */ new Map());
    // to be sent in batch
    __publicField(this, "connectionPromise", null);
    __publicField(this, "reconnectTimeout", null);
    __publicField(this, "batchTimeout", null);
    __publicField(this, "isConnecting", false);
    // Batch delay in ms - requests within this window will be merged
    __publicField(this, "batchDelay", 50);
  }
  getApiEndpoint() {
    return envConfig.apiEndpoint || "";
  }
  ensureConnected() {
    var _a2;
    if (((_a2 = this.eventSource) == null ? void 0 : _a2.readyState) === EventSource.OPEN) {
      return Promise.resolve();
    }
    if (this.connectionPromise) {
      return this.connectionPromise;
    }
    this.isConnecting = true;
    this.connectionPromise = new Promise((resolve2, reject) => {
      const endpoint = this.getApiEndpoint();
      const url2 = `${endpoint}/resource/discovery/stream`;
      console.log("[ResourceDiscoveryChannel] Connecting to SSE:", url2);
      this.eventSource = new EventSource(url2);
      this.eventSource.onopen = () => {
        console.log("[ResourceDiscoveryChannel] SSE connection established");
        this.isConnecting = false;
        this.connectionPromise = null;
        resolve2();
      };
      this.eventSource.onerror = (event) => {
        var _a3;
        console.error("[ResourceDiscoveryChannel] SSE connection error:", event);
        this.isConnecting = false;
        this.connectionPromise = null;
        if (((_a3 = this.eventSource) == null ? void 0 : _a3.readyState) === EventSource.CONNECTING) {
          return;
        }
        this.scheduleReconnect();
      };
      this.eventSource.addEventListener("result", (event) => {
        try {
          const result = JSON.parse(event.data);
          this.notifySubscribers(result);
        } catch (e2) {
          console.error("[ResourceDiscoveryChannel] Failed to parse result:", e2);
        }
      });
      this.eventSource.addEventListener("error", (event) => {
        if (event instanceof MessageEvent) {
          try {
            const result = JSON.parse(event.data);
            this.notifySubscribers(result);
          } catch (e2) {
            console.error("[ResourceDiscoveryChannel] Failed to parse error:", e2);
          }
        }
      });
    });
    return this.connectionPromise;
  }
  scheduleReconnect() {
    if (this.reconnectTimeout) {
      return;
    }
    console.log("[ResourceDiscoveryChannel] Scheduling reconnect in 3 seconds");
    this.reconnectTimeout = setTimeout(() => {
      this.reconnectTimeout = null;
      if (this.subscribers.size > 0) {
        console.log("[ResourceDiscoveryChannel] Reconnecting...");
        this.ensureConnected();
      }
    }, 3e3);
  }
  notifySubscribers(result) {
    const subscribers = this.subscribers.get(result.resourceId);
    if (!subscribers || subscribers.size === 0) {
      return;
    }
    console.log(
      "[ResourceDiscoveryChannel] Notifying",
      subscribers.size,
      "subscribers for resource",
      result.resourceId
    );
    if (result.success) {
      const data = {
        coverPaths: result.coverPaths,
        playableFilePaths: result.playableFilePaths,
        hasMorePlayableFiles: result.hasMorePlayableFiles
      };
      subscribers.forEach((cb2) => cb2(data));
    } else {
      subscribers.forEach((cb2) => cb2(null, result.error));
    }
  }
  scheduleBatchSend() {
    if (this.batchTimeout) {
      return;
    }
    this.batchTimeout = setTimeout(() => {
      this.batchTimeout = null;
      this.sendBatch();
    }, this.batchDelay);
  }
  async sendBatch() {
    if (this.pendingSubscriptions.size === 0) {
      return;
    }
    const requests = Array.from(this.pendingSubscriptions.values());
    const requestKeys = Array.from(this.pendingSubscriptions.keys());
    this.pendingSubscriptions.clear();
    requestKeys.forEach((key) => this.pendingRequests.add(key));
    console.log("[ResourceDiscoveryChannel] Sending batch of", requests.length, "subscriptions");
    const endpoint = this.getApiEndpoint();
    try {
      await fetch(`${endpoint}/resource/discovery/subscribe/batch`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(requests)
      });
    } catch (e2) {
      console.error("[ResourceDiscoveryChannel] Failed to send batch:", e2);
      requestKeys.forEach((key) => this.pendingRequests.delete(key));
      requests.forEach((req) => {
        const subs = this.subscribers.get(req.resourceId);
        if (subs) {
          subs.forEach((cb2) => cb2(null, "Failed to subscribe"));
        }
      });
    }
  }
  async subscribe(resourceId, types2, callback2) {
    if (!this.subscribers.has(resourceId)) {
      this.subscribers.set(resourceId, /* @__PURE__ */ new Set());
    }
    this.subscribers.get(resourceId).add(callback2);
    await this.ensureConnected();
    const typesFlag = types2.reduce((acc, t2) => acc | t2, 0);
    const requestKey = `${resourceId}-${typesFlag}`;
    if (!this.pendingRequests.has(requestKey) && !this.pendingSubscriptions.has(requestKey)) {
      this.pendingSubscriptions.set(requestKey, { resourceId, types: typesFlag });
      this.scheduleBatchSend();
    }
    return () => {
      const subs = this.subscribers.get(resourceId);
      if (subs) {
        subs.delete(callback2);
        if (subs.size === 0) {
          this.subscribers.delete(resourceId);
        }
      }
      this.pendingRequests.delete(requestKey);
      this.pendingSubscriptions.delete(requestKey);
      if (this.subscribers.size === 0) {
        this.disconnect();
      }
    };
  }
  disconnect() {
    console.log("[ResourceDiscoveryChannel] Disconnecting");
    if (this.reconnectTimeout) {
      clearTimeout(this.reconnectTimeout);
      this.reconnectTimeout = null;
    }
    if (this.batchTimeout) {
      clearTimeout(this.batchTimeout);
      this.batchTimeout = null;
    }
    if (this.eventSource) {
      this.eventSource.close();
      this.eventSource = null;
    }
    this.connectionPromise = null;
    this.isConnecting = false;
    this.pendingRequests.clear();
    this.pendingSubscriptions.clear();
  }
  // Get connection status for debugging
  get isConnected() {
    var _a2;
    return ((_a2 = this.eventSource) == null ? void 0 : _a2.readyState) === EventSource.OPEN;
  }
  get subscriberCount() {
    return this.subscribers.size;
  }
}
const resourceDiscoveryChannel = new ResourceDiscoveryChannel();
function useResourceDiscovery(resource, types2, cacheEnabled = true) {
  var _a2, _b2, _c2, _d, _e, _f, _g;
  const typesKey = reactExports.useMemo(() => types2.sort().join(","), [types2]);
  const cachedTypesKey = ((_b2 = (_a2 = resource.cache) == null ? void 0 : _a2.cachedTypes) == null ? void 0 : _b2.sort().join(",")) ?? "";
  const coverPathsKey = ((_d = (_c2 = resource.cache) == null ? void 0 : _c2.coverPaths) == null ? void 0 : _d.join(",")) ?? "";
  const playableFilePathsKey = ((_f = (_e = resource.cache) == null ? void 0 : _e.playableFilePaths) == null ? void 0 : _f.join(",")) ?? "";
  const hasMorePlayableFiles = (_g = resource.cache) == null ? void 0 : _g.hasMorePlayableFiles;
  const initialState3 = reactExports.useMemo(() => {
    var _a3, _b3, _c3, _d2;
    const cachedTypes = ((_a3 = resource.cache) == null ? void 0 : _a3.cachedTypes) ?? [];
    const hasAllRequiredTypes = types2.every((t2) => cachedTypes.includes(t2));
    if (cacheEnabled && hasAllRequiredTypes) {
      return {
        status: "ready",
        source: "cache",
        cacheEnabled,
        coverPaths: (_b3 = resource.cache) == null ? void 0 : _b3.coverPaths,
        playableFilePaths: (_c3 = resource.cache) == null ? void 0 : _c3.playableFilePaths,
        hasMorePlayableFiles: (_d2 = resource.cache) == null ? void 0 : _d2.hasMorePlayableFiles
      };
    }
    return {
      status: "loading",
      source: "realtime",
      // Always realtime when loading via SSE
      cacheEnabled
    };
  }, [resource.id, cachedTypesKey, coverPathsKey, playableFilePathsKey, hasMorePlayableFiles, typesKey, cacheEnabled]);
  const [state, setState] = reactExports.useState(initialState3);
  const mountedRef = reactExports.useRef(true);
  const subscribedRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    var _a3, _b3, _c3, _d2;
    const cachedTypes = ((_a3 = resource.cache) == null ? void 0 : _a3.cachedTypes) ?? [];
    const hasAllRequiredTypes = types2.every((t2) => cachedTypes.includes(t2));
    if (cacheEnabled && hasAllRequiredTypes) {
      setState({
        status: "ready",
        source: "cache",
        cacheEnabled,
        coverPaths: (_b3 = resource.cache) == null ? void 0 : _b3.coverPaths,
        playableFilePaths: (_c3 = resource.cache) == null ? void 0 : _c3.playableFilePaths,
        hasMorePlayableFiles: (_d2 = resource.cache) == null ? void 0 : _d2.hasMorePlayableFiles
      });
      subscribedRef.current = false;
    } else {
      setState({
        status: "loading",
        source: "realtime",
        cacheEnabled
      });
      subscribedRef.current = false;
    }
  }, [resource.id, cachedTypesKey, coverPathsKey, playableFilePathsKey, hasMorePlayableFiles, typesKey, cacheEnabled]);
  reactExports.useEffect(() => {
    mountedRef.current = true;
    if (state.status === "ready") {
      return;
    }
    if (subscribedRef.current) {
      return;
    }
    subscribedRef.current = true;
    let unsubscribe = null;
    resourceDiscoveryChannel.subscribe(resource.id, types2, (data, error2) => {
      if (!mountedRef.current)
        return;
      if (error2) {
        setState({
          status: "error",
          source: "realtime",
          // Data was loaded via realtime discovery
          cacheEnabled,
          error: error2
        });
      } else if (data) {
        setState({
          status: "ready",
          source: "realtime",
          // Data was loaded via realtime discovery
          cacheEnabled,
          coverPaths: data.coverPaths,
          playableFilePaths: data.playableFilePaths,
          hasMorePlayableFiles: data.hasMorePlayableFiles
        });
      }
    }).then((unsub) => {
      if (mountedRef.current) {
        unsubscribe = unsub;
      } else {
        unsub();
      }
    }).catch((err) => {
      if (mountedRef.current) {
        setState({
          status: "error",
          source: "realtime",
          // Data was loaded via realtime discovery
          cacheEnabled,
          error: String(err)
        });
      }
    });
    return () => {
      mountedRef.current = false;
      subscribedRef.current = false;
      unsubscribe == null ? void 0 : unsubscribe();
    };
  }, [resource.id, typesKey, state.status]);
  return state;
}
function useCoverDiscovery(resource, cacheEnabled = true) {
  return useResourceDiscovery(resource, [ResourceCacheType.Covers], cacheEnabled);
}
function usePlayableFilesDiscovery(resource, cacheEnabled = true) {
  return useResourceDiscovery(resource, [ResourceCacheType.PlayableFiles], cacheEnabled);
}
const ResourceCover = React$6.forwardRef((props, ref) => {
  var _a2, _b2, _c2, _d, _e;
  const {
    resource,
    onClick: propsOnClick,
    showBiggerOnHover = true,
    disableMediaPreviewer = false,
    biggerCoverPlacement,
    coverFit = CoverFit.Contain,
    disableCarousel = false
  } = props;
  const { t: t2 } = useTranslation();
  const log3 = buildLogger(`ResourceCover:${resource.id}|${resource.path}`);
  const forceUpdate = useUpdate();
  const resourceUiOptions = useUiOptionsStore((state) => {
    var _a3;
    return (_a3 = state.data) == null ? void 0 : _a3.resource;
  });
  const cacheEnabled = !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCache);
  const discoveryState = useCoverDiscovery(resource, cacheEnabled);
  const [previewerVisible, setPreviewerVisible] = reactExports.useState(false);
  const previewerHoverTimerRef = reactExports.useRef();
  const appContext = useAppContextStore((state) => state);
  const containerRef = reactExports.useRef(null);
  const maxCoverRawSizeRef = reactExports.useRef({
    w: 0,
    h: 0
  });
  const [failureUrls, setFailureUrls] = reactExports.useState(/* @__PURE__ */ new Set());
  const [reloadKey, setReloadKey] = reactExports.useState(0);
  const stableDiscoveryCoverPaths = reactExports.useMemo(
    () => discoveryState.coverPaths,
    [(_a2 = discoveryState.coverPaths) == null ? void 0 : _a2.join(",")]
  );
  const stableResourceCoverPaths = reactExports.useMemo(
    () => resource.coverPaths,
    [(_b2 = resource.coverPaths) == null ? void 0 : _b2.join(",")]
  );
  const stableApiEndpoints = reactExports.useMemo(
    () => appContext.apiEndpoints,
    [(_c2 = appContext.apiEndpoints) == null ? void 0 : _c2.join(",")]
  );
  const urls2 = reactExports.useMemo(() => {
    if (discoveryState.status !== "ready") {
      return null;
    }
    const serverAddresses = stableApiEndpoints ?? [envConfig.apiEndpoint];
    const resourceServerAddresses = serverAddresses.length === 1 ? serverAddresses : serverAddresses.slice(1);
    const serverAddress = resourceServerAddresses[Math.floor(Math.random() * resourceServerAddresses.length)];
    const coverPaths = (stableResourceCoverPaths == null ? void 0 : stableResourceCoverPaths.length) ? stableResourceCoverPaths : (stableDiscoveryCoverPaths == null ? void 0 : stableDiscoveryCoverPaths.length) ? stableDiscoveryCoverPaths : [resource.path];
    return coverPaths.map(
      (coverPath) => `${serverAddress}/tool/thumbnail?path=${encodeURIComponent(coverPath)}`
    );
  }, [discoveryState.status, stableDiscoveryCoverPaths, stableApiEndpoints, stableResourceCoverPaths, resource.path, reloadKey]);
  useUpdateEffect(() => {
    forceUpdate();
  }, [coverFit]);
  useUpdateEffect(() => {
    setFailureUrls(/* @__PURE__ */ new Set());
  }, [urls2]);
  useUpdateEffect(() => {
    setFailureUrls(/* @__PURE__ */ new Set());
    maxCoverRawSizeRef.current = { w: 0, h: 0 };
  }, [resource.id]);
  reactExports.useEffect(() => {
    if (!containerRef.current)
      return;
    const resizeObserver2 = new ResizeObserver(() => {
      forceUpdate();
    });
    resizeObserver2.observe(containerRef.current);
    return () => resizeObserver2.disconnect();
  }, []);
  const reload = reactExports.useCallback(() => {
    setReloadKey((k2) => k2 + 1);
  }, []);
  reactExports.useImperativeHandle(ref, () => {
    return { reload };
  }, [reload]);
  const onClick = reactExports.useCallback(() => {
    if (propsOnClick) {
      propsOnClick();
    }
  }, [propsOnClick]);
  const loadingTooltipContent = reactExports.useMemo(() => {
    if (discoveryState.status === "loading") {
      if (discoveryState.cacheEnabled) {
        return t2("resource.cover.tooltip.cachePreparing");
      }
      return t2("resource.cover.tooltip.loading");
    }
    return void 0;
  }, [discoveryState.status, discoveryState.cacheEnabled, t2]);
  const handleImageLoad = reactExports.useCallback((e2) => {
    var _a3, _b3;
    const img = e2.target;
    if (img) {
      const prevW = ((_a3 = maxCoverRawSizeRef.current) == null ? void 0 : _a3.w) ?? 0;
      const prevH = ((_b3 = maxCoverRawSizeRef.current) == null ? void 0 : _b3.h) ?? 0;
      if (!maxCoverRawSizeRef.current) {
        maxCoverRawSizeRef.current = {
          w: img.naturalWidth,
          h: img.naturalHeight
        };
      } else {
        maxCoverRawSizeRef.current.w = Math.max(
          maxCoverRawSizeRef.current.w,
          img.naturalWidth
        );
        maxCoverRawSizeRef.current.h = Math.max(
          maxCoverRawSizeRef.current.h,
          img.naturalHeight
        );
      }
      if (maxCoverRawSizeRef.current.w !== prevW || maxCoverRawSizeRef.current.h !== prevH) {
        forceUpdate();
      }
    }
  }, [forceUpdate]);
  const handleImageError = reactExports.useCallback((url2) => {
    setFailureUrls((prev2) => new Set(prev2).add(url2));
    log3("failed to load url", url2);
  }, []);
  const renderCover = reactExports.useCallback(() => {
    if (discoveryState.status === "loading" || !urls2) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: loadingTooltipContent, isDisabled: !loadingTooltipContent, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center bg-default-100", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) }) });
    }
    if (discoveryState.status === "error") {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackCover, { afterClearingCache: reload, id: resource.id });
    }
    let dynamicClassNames = [
      coverFit === CoverFit.Cover ? "object-cover" : "object-contain"
    ];
    if (containerRef.current && maxCoverRawSizeRef.current) {
      if (maxCoverRawSizeRef.current.w > containerRef.current.clientWidth) {
        dynamicClassNames.push("w-full");
      }
      if (maxCoverRawSizeRef.current.h > containerRef.current.clientHeight) {
        dynamicClassNames.push("h-full");
      }
    }
    const dynamicClassName = dynamicClassNames.join(" ");
    const renderingUrls = disableCarousel ? urls2.slice(0, 1) : urls2;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Carousel,
      {
        autoplay: renderingUrls && renderingUrls.length > 1,
        dots: urls2 && urls2.length > 1,
        children: renderingUrls == null ? void 0 : renderingUrls.map((url2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "flex items-center justify-center",
              style: {
                width: (_a3 = containerRef.current) == null ? void 0 : _a3.clientWidth,
                height: (_b3 = containerRef.current) == null ? void 0 : _b3.clientHeight
              },
              children: failureUrls.has(url2) ? /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackCover, { afterClearingCache: reload, id: resource.id }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                image_default,
                {
                  removeWrapper: true,
                  className: `${dynamicClassName} max-w-full max-h-full`,
                  loading: "eager",
                  fetchPriority: "low",
                  src: url2,
                  onLoad: handleImageLoad,
                  onError: () => handleImageError(url2)
                },
                url2
              )
            }
          ) }, url2);
        })
      },
      renderingUrls.join(",")
    );
  }, [urls2, coverFit, disableCarousel, failureUrls, discoveryState.status, loadingTooltipContent, handleImageLoad, handleImageError]);
  const renderContainer = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        ref: containerRef,
        className: "resource-cover-container relative overflow-hidden",
        onClick,
        onMouseLeave: () => {
          if (!disableMediaPreviewer) {
            clearTimeout(previewerHoverTimerRef.current);
            previewerHoverTimerRef.current = void 0;
            if (previewerVisible) {
              setPreviewerVisible(false);
            }
          }
        },
        onMouseOver: () => {
          if (!disableMediaPreviewer) {
            if (!previewerHoverTimerRef.current) {
              previewerHoverTimerRef.current = setTimeout(() => {
                setPreviewerVisible(true);
              }, 1e3);
            }
          }
        },
        children: [
          previewerVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(MediaPreviewer, { resourceId: resource.id }),
          renderCover()
        ]
      }
    );
  };
  let tooltipWidth;
  let tooltipHeight;
  if (showBiggerOnHover && typeof window !== "undefined") {
    const containerWidth = ((_d = containerRef.current) == null ? void 0 : _d.clientWidth) ?? 100;
    const containerHeight = ((_e = containerRef.current) == null ? void 0 : _e.clientHeight) ?? 100;
    if (maxCoverRawSizeRef.current.w > containerWidth && maxCoverRawSizeRef.current.h > containerHeight) {
      const tooltipScale = Math.min(
        window.innerWidth * 0.6 / maxCoverRawSizeRef.current.w,
        window.innerHeight * 0.6 / maxCoverRawSizeRef.current.h
      );
      tooltipWidth = maxCoverRawSizeRef.current.w * tooltipScale;
      tooltipHeight = maxCoverRawSizeRef.current.h * tooltipScale;
    }
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          style: {
            width: tooltipWidth,
            height: tooltipHeight
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Carousel,
            {
              adaptiveHeight: true,
              autoplay: !!(urls2 && urls2.length > 1),
              dots: !!(urls2 && urls2.length > 1),
              children: urls2 == null ? void 0 : urls2.map((url2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "div",
                  {
                    className: "flex items-center justify-center",
                    style: {
                      maxWidth: tooltipWidth,
                      maxHeight: tooltipHeight
                    },
                    children: failureUrls.has(url2) ? /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackCover, { afterClearingCache: reload, id: resource.id }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
                      image_default,
                      {
                        removeWrapper: true,
                        alt: "",
                        loading: "eager",
                        src: url2,
                        style: {
                          maxWidth: tooltipWidth,
                          maxHeight: tooltipHeight
                        }
                      },
                      url2
                    )
                  }
                ) }, url2);
              })
            }
          )
        }
      ),
      isDisabled: tooltipWidth === void 0,
      placement: biggerCoverPlacement,
      children: renderContainer()
    }
  );
});
const ResourceCoverMemo = React$6.memo(ResourceCover);
ResourceCoverMemo.displayName = "ResourceCover";
buildLogger("PropertyValueScopePicker");
const PropertyValueScopePicker = (props) => {
  const { t: t2 } = useTranslation();
  const { resource } = props;
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [visibleScopes, setVisibleScopes] = reactExports.useState(
    propertyValueScopes.map((s2) => s2.value)
  );
  const init2 = reactExports.useCallback(async () => {
    const properties2 = (await BApi$1.property.getPropertiesByPool(
      PropertyPool.Custom | PropertyPool.Reserved
    )).data ?? [];
    const propertyMap2 = {};
    properties2.forEach((p2) => {
      if (!propertyMap2[p2.pool]) {
        propertyMap2[p2.pool] = {};
      }
      propertyMap2[p2.pool][p2.id] = p2;
    });
    setPropertyMap(propertyMap2);
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  const renderHeader = () => {
    const columns = [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Property") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Display value") }),
      ...visibleScopes.map((scope) => {
        const priority = resourceOptions.propertyValueScopePriority ?? [];
        const index2 = priority.findIndex((p2) => p2 == scope);
        return /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onClick: () => {
              const arr = index2 > -1 ? priority.filter((p2) => p2 != scope) : [...priority, scope];
              BApi$1.options.patchResourceOptions({
                propertyValueScopePriority: arr
              });
            },
            children: [
              t2(`PropertyValueScope.${PropertyValueScope[scope]}`),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                      "The numbers represent the priority of property dimensions, and the property values will be displayed according to the priority of the dimensions."
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base" }),
                      t2("indicates this scope is not enabled")
                    ] })
                  ] }),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: index2 == -1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base" }) : index2 + 1 })
                }
              )
            ]
          }
        ) }, scope);
      })
    ];
    return columns;
  };
  const renderRows = () => {
    const ps = resource.properties ?? {};
    const rows = [];
    const priority = resourceOptions.propertyValueScopePriority ?? [];
    Object.keys(ps).forEach((pool) => {
      const propertyValueMap = ps[pool];
      Object.keys(propertyValueMap).forEach((id2) => {
        var _a2;
        const propertyValues = propertyValueMap[id2];
        const row = [];
        row.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: propertyValues.name }) }) }, "Property")
        );
        let finalValue;
        let finalScope;
        if (propertyValues.values) {
          for (const scope of priority) {
            const t22 = propertyValues.values.find((v2) => v2.scope == scope);
            if (t22 == null ? void 0 : t22.value) {
              finalValue = t22.aliasAppliedBizValue;
              finalScope = scope;
              break;
            }
          }
        }
        const property2 = (_a2 = propertyMap[pool]) == null ? void 0 : _a2[id2];
        row.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: property2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertyValueRenderer,
            {
              bizValue: serializeStandardValue(
                finalValue,
                propertyValues.bizValueType
              ),
              property: property2,
              variant: "light"
            }
          ) }, "Display value")
        );
        visibleScopes.forEach((scope) => {
          var _a3, _b2;
          const value2 = (_b2 = (_a3 = propertyValues.values) == null ? void 0 : _a3.find(
            (v2) => v2.scope == scope
          )) == null ? void 0 : _b2.aliasAppliedBizValue;
          const isHidden = priority.findIndex((p2) => p2 == scope) == -1;
          let className = "";
          const style2 = {};
          row.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              table_cell_default,
              {
                className,
                style: style2,
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `relative ${isHidden ? "opacity-60" : ""}`, children: [
                  scope == finalScope && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    RefIcon$_,
                    {
                      className: "absolute top-0 right-0 text-[var(--bakaui-success)]"
                    }
                  ),
                  property2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    PropertyValueRenderer,
                    {
                      bizValue: serializeStandardValue(
                        value2,
                        propertyValues.bizValueType
                      ),
                      property: property2,
                      variant: "light"
                    }
                  )
                ] })
              },
              `scope-${scope}`
            )
          );
        });
        rows.push(/* @__PURE__ */ jsxRuntimeExports.jsx(table_row_default, { children: row }, id2));
      });
    });
    return rows;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "full",
      title: t2("Setup priority of property value scopes"),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("Visible scopes"),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: t2(
                  "This filter is used for quick check and does not change the priority of property value scopes."
                ),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: propertyValueScopes.map((s2) => {
            const isVisible2 = visibleScopes.includes(s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "cursor-pointer",
                color: isVisible2 ? "primary" : "default",
                radius: "sm",
                size: "sm",
                onClick: () => {
                  if (isVisible2) {
                    setVisibleScopes(visibleScopes.filter((v2) => v2 != s2.value));
                  } else {
                    setVisibleScopes([...visibleScopes, s2.value]);
                  }
                },
                children: t2(`PropertyValueScope.${PropertyValueScope[s2.value]}`)
              }
            );
          }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "You can click on the scope button to change the priority of the property value scopes."
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: renderHeader() }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: renderRows() })
        ] })
      ]
    }
  );
};
PropertyValueScopePicker.displayName = "PropertyValueScopePicker";
const NoPlayableFilesModal = ({ resourceId, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [profiles, setProfiles] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  reactExports.useEffect(() => {
    const loadProfiles = async () => {
      setLoading(true);
      try {
        const response = await BApi$1.resourceProfile.getMatchingProfilesForResource(resourceId);
        setProfiles(response.data || []);
      } catch (error2) {
        console.error("Failed to load matching profiles:", error2);
        setProfiles([]);
      } finally {
        setLoading(false);
      }
    };
    loadProfiles();
  }, [resourceId]);
  const handleNavigateToProfile = (profileId) => {
    onDestroyed == null ? void 0 : onDestroyed();
    if (profileId) {
      navigate(`/resource-profile?highlight=${profileId}`);
    } else {
      navigate("/resource-profile");
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "lg",
      title: t2("resource.playControl.noPlayableFiles.title"),
      onDestroyed,
      footer: { actions: ["ok"] },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-6", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm mb-2", children: t2("resource.playControl.noPlayableFiles.description") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("resource.playControl.noPlayableFiles.tips.title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc pl-5 text-sm space-y-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("resource.playControl.noPlayableFiles.tips.noFile") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("resource.playControl.noPlayableFiles.tips.extension") })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("resource.playControl.noPlayableFiles.action.title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm mb-3", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
            t2("resource.playControl.noPlayableFiles.action.description")
          ] }),
          loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("common.state.loading") })
          ] }) : profiles.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 mb-1", children: t2("resource.playControl.noPlayableFiles.matchingProfiles") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: profiles.map((profile) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "cursor-pointer",
                color: "primary",
                endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1m, { className: "text-xs" }),
                size: "sm",
                variant: "flat",
                onClick: () => handleNavigateToProfile(profile.id),
                children: profile.name
              },
              profile.id
            )) })
          ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500", children: t2("resource.playControl.noPlayableFiles.noMatchingProfiles") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$c, {}),
              onPress: () => handleNavigateToProfile(),
              children: t2("resource.playControl.noPlayableFiles.action.settings")
            }
          ) })
        ] })
      ] })
    }
  );
};
NoPlayableFilesModal.displayName = "NoPlayableFilesModal";
const splitIntoDirs = (paths, prefix) => {
  const groups = [];
  const stdPrefix = standardizePath(prefix);
  for (const path of paths) {
    const stdPath = standardizePath(path);
    const relativePath = stdPath.replace(stdPrefix, "");
    const segments = splitPathIntoSegments(relativePath);
    const relativeDir = segments.slice(0, segments.length - 1).join(BusinessConstants.pathSeparator);
    let dir = groups.find((g2) => g2.relativePath == relativeDir);
    if (!dir) {
      dir = {
        relativePath: relativeDir,
        groups: []
      };
      groups.push(dir);
    }
    const extension2 = segments[segments.length - 1].split(".").pop();
    let group = dir.groups.find((g2) => g2.extension == extension2);
    if (!group) {
      group = {
        extension: extension2,
        files: []
      };
      dir.groups.push(group);
    }
    group.files.push({
      name: segments[segments.length - 1],
      path
    });
  }
  return groups;
};
const DefaultVisibleFileCount = 5;
const PlayControl = reactExports.forwardRef(function PlayControl2({ resource, PortalComponent, afterPlaying }, ref) {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const uiOptionsStore = useUiOptionsStore();
  const resourceUiOptions = (_a2 = uiOptionsStore.data) == null ? void 0 : _a2.resource;
  const cacheEnabled = !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCache);
  const discoveryState = usePlayableFilesDiscovery(resource, cacheEnabled);
  const [dirs, setDirs] = reactExports.useState();
  const [modalVisible, setModalVisible] = reactExports.useState(false);
  const [loadingAllFiles, setLoadingAllFiles] = reactExports.useState(false);
  const [allFilesLoaded, setAllFilesLoaded] = reactExports.useState(false);
  const portalCtx = discoveryState.status === "ready" ? {
    files: discoveryState.playableFilePaths ?? [],
    hasMore: discoveryState.hasMorePlayableFiles ?? false
  } : null;
  const computeStatus = () => {
    if (discoveryState.status === "loading") {
      return "loading";
    }
    if (discoveryState.status === "error") {
      return "not-found";
    }
    if ((portalCtx == null ? void 0 : portalCtx.files) && portalCtx.files.length > 0) {
      return "ready";
    }
    return "not-found";
  };
  const computeTooltipContent = () => {
    if (discoveryState.status === "loading") {
      if (discoveryState.cacheEnabled) {
        return t2("resource.playControl.tooltip.cachePreparing");
      }
      return t2("resource.playControl.tooltip.loading");
    }
    if (computeStatus() === "not-found") {
      return t2("resource.playControl.tooltip.notFound");
    }
    return void 0;
  };
  const status = computeStatus();
  const tooltipContent = computeTooltipContent();
  reactExports.useEffect(() => {
    var _a3;
    if (discoveryState.status === "ready" && ((_a3 = discoveryState.playableFilePaths) == null ? void 0 : _a3.length) && !resource.isFile) {
      setDirs(splitIntoDirs(discoveryState.playableFilePaths, resource.path));
    }
  }, [discoveryState.status, discoveryState.playableFilePaths, resource.isFile, resource.path]);
  reactExports.useEffect(() => {
    setDirs(void 0);
    setAllFilesLoaded(false);
  }, [resource.id]);
  reactExports.useImperativeHandle(ref, () => ({}), []);
  const play = (file) => BApi$1.resource.playResourceFile(resource.id, {
    file
  }).then((a2) => {
    if (!a2.code) {
      Vt.success(t2("Opened"));
      afterPlaying == null ? void 0 : afterPlaying();
    }
  });
  const handleClick = reactExports.useCallback(() => {
    if (status === "not-found") {
      createPortal(NoPlayableFilesModal, {
        resourceId: resource.id
      });
      return;
    }
    if (status === "loading") {
      return;
    }
    if ((portalCtx == null ? void 0 : portalCtx.files) && portalCtx.files.length > 0) {
      if (portalCtx.files.length === 1 && !portalCtx.hasMore) {
        play(portalCtx.files[0]);
      } else if ((resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile) && portalCtx.files.length > 0) {
        play(portalCtx.files[0]);
      } else {
        if (!resource.isFile && portalCtx.files.length > 0) {
          const computedDirs = splitIntoDirs(portalCtx.files, resource.path);
          setDirs(computedDirs);
        }
        setModalVisible(true);
      }
    }
  }, [status, portalCtx, resource.isFile, resource.path, resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      PortalComponent,
      {
        status,
        source: discoveryState.source,
        cacheEnabled: discoveryState.cacheEnabled,
        onClick: handleClick,
        tooltipContent
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Modal,
      {
        footer: false,
        size: "lg",
        title: t2("resource.playControl.modal.selectFileTitle"),
        visible: modalVisible,
        onClose: () => {
          setModalVisible(false);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 pb-2", children: dirs == null ? void 0 : dirs.map((d2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              dirs.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$G, { className: "text-base" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "light", children: d2.relativePath })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1 flex-col", children: d2.groups.map((g2) => {
                const showCount = g2.showAll ? g2.files.length : Math.min(DefaultVisibleFileCount, g2.files.length);
                return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [
                  d2.groups.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: g2.extension }),
                  g2.files.slice(0, showCount).map((file) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        className: "whitespace-break-spaces py-2 h-auto text-left",
                        radius: "sm",
                        size: "sm",
                        onPress: () => {
                          play(file.path);
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: "text-base" }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all overflow-hidden text-ellipsis", children: file.name })
                        ]
                      },
                      file.path
                    );
                  }),
                  g2.files.length > DefaultVisibleFileCount && !g2.showAll && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      color: "primary",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        g2.showAll = true;
                        setDirs([...dirs]);
                      },
                      children: t2("resource.playControl.modal.showAllFiles", {
                        count: g2.files.length
                      })
                    }
                  )
                ] }, g2.extension);
              }) })
            ] }, d2.relativePath);
          }) }),
          (portalCtx == null ? void 0 : portalCtx.hasMore) && !allFilesLoaded && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              isLoading: loadingAllFiles,
              onPress: async () => {
                setLoadingAllFiles(true);
                try {
                  const rsp = await BApi$1.resource.getResourcePlayableFiles(resource.id);
                  const allFiles = rsp.data ?? [];
                  if (allFiles.length > 0 && !resource.isFile) {
                    setDirs(splitIntoDirs(allFiles, resource.path));
                  }
                  setAllFilesLoaded(true);
                } finally {
                  setLoadingAllFiles(false);
                }
              },
              children: t2("resource.playControl.modal.loadAllFiles")
            }
          ) }),
          !(resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile) && portalCtx && portalCtx.files.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-3 border-t mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "flat",
              onPress: async () => {
                await uiOptionsStore.patch({
                  resource: {
                    ...resourceUiOptions,
                    autoSelectFirstPlayableFile: true
                  }
                });
                setModalVisible(false);
                Vt.success(
                  t2("resource.playControl.toast.autoSelectEnabled")
                );
              },
              children: t2("resource.playControl.modal.autoSelectFirstFile")
            }
          ) })
        ]
      }
    )
  ] });
});
PlayControl.displayName = "PlayControl";
const SortableRow = ({
  item,
  globalIndex,
  totalCount,
  isEditing,
  editingValue,
  onEditStart,
  onEditEnd,
  onEditingValueChange,
  onOrderInputKeyDown,
  onOrderInputBlur,
  onMoveToTop,
  onMoveToBottom,
  t: t2
}) => {
  const {
    attributes: attributes2,
    listeners,
    setNodeRef,
    transform: transform2,
    transition: transition3,
    isDragging: isDragging2
  } = useSortable({ id: item.id });
  const style2 = {
    transform: CSS$1.Transform.toString(transform2),
    transition: transition3,
    opacity: isDragging2 ? 0.5 : 1
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      ref: setNodeRef,
      className: "flex items-center gap-2 py-2 px-2 border-b border-default-200 hover:bg-default-100",
      style: style2,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, { ...listeners, ...attributes2 }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-16", children: isEditing ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            autoFocus: true,
            className: "w-16",
            size: "sm",
            type: "number",
            value: editingValue,
            onBlur: () => onOrderInputBlur(item.id),
            onKeyDown: (e2) => onOrderInputKeyDown(e2, item.id),
            onValueChange: onEditingValueChange
          }
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("property.tip.clickToEditOrder"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "cursor-pointer px-2 py-1 rounded hover:bg-default-200 inline-block min-w-[40px] text-center",
            onClick: () => {
              onEditStart(item.id, String(globalIndex));
            },
            children: globalIndex
          }
        ) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Label,
          {
            property: {
              name: item.name,
              type: item.type,
              pool: PropertyPool.Custom
            }
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.moveToTop"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isDisabled: globalIndex === 1,
              isIconOnly: true,
              size: "sm",
              variant: "light",
              onPress: () => onMoveToTop(item.id),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1i, { className: "text-base" })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.moveToBottom"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isDisabled: globalIndex === totalCount,
              isIconOnly: true,
              size: "sm",
              variant: "light",
              onPress: () => onMoveToBottom(item.id),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$2, { className: "text-base" })
            }
          ) })
        ] })
      ]
    }
  );
};
const CustomPropertySortModal = ({ properties: properties2, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [items, setItems] = reactExports.useState(properties2);
  const [searchText, setSearchText] = reactExports.useState("");
  const [editingId, setEditingId] = reactExports.useState(null);
  const [editingValue, setEditingValue] = reactExports.useState("");
  const sensors = useSensors(
    useSensor(PointerSensor),
    useSensor(KeyboardSensor, {
      coordinateGetter: sortableKeyboardCoordinates
    })
  );
  const filteredItems = reactExports.useMemo(() => {
    if (!searchText.trim())
      return items;
    const lowerSearch = searchText.toLowerCase();
    return items.filter(
      (item) => item.name.toLowerCase().includes(lowerSearch)
    );
  }, [items, searchText]);
  const saveOrder = reactExports.useCallback(
    async (newItems) => {
      const ids2 = newItems.map((item) => item.id);
      await BApi$1.customProperty.sortCustomProperties({ ids: ids2 });
      Vt.success(t2("common.state.saved"));
    },
    [t2]
  );
  const handleOrderChange = reactExports.useCallback(
    async (itemId, newOrder) => {
      const currentIndex = items.findIndex((item) => item.id === itemId);
      if (currentIndex === -1)
        return;
      const targetIndex = Math.max(0, Math.min(items.length - 1, newOrder - 1));
      if (currentIndex === targetIndex)
        return;
      const newItems = [...items];
      const [removed] = newItems.splice(currentIndex, 1);
      newItems.splice(targetIndex, 0, removed);
      setItems(newItems);
      await saveOrder(newItems);
    },
    [items, saveOrder]
  );
  const handleMoveToTop = reactExports.useCallback(
    async (itemId) => {
      const currentIndex = items.findIndex((item) => item.id === itemId);
      if (currentIndex <= 0)
        return;
      const newItems = [...items];
      const [removed] = newItems.splice(currentIndex, 1);
      newItems.unshift(removed);
      setItems(newItems);
      await saveOrder(newItems);
    },
    [items, saveOrder]
  );
  const handleMoveToBottom = reactExports.useCallback(
    async (itemId) => {
      const currentIndex = items.findIndex((item) => item.id === itemId);
      if (currentIndex === -1 || currentIndex === items.length - 1)
        return;
      const newItems = [...items];
      const [removed] = newItems.splice(currentIndex, 1);
      newItems.push(removed);
      setItems(newItems);
      await saveOrder(newItems);
    },
    [items, saveOrder]
  );
  const handleOrderInputKeyDown = (e2, itemId) => {
    if (e2.key === "Enter") {
      const newOrder = parseInt(editingValue, 10);
      if (!isNaN(newOrder) && newOrder >= 1 && newOrder <= items.length) {
        handleOrderChange(itemId, newOrder);
      }
      setEditingId(null);
    } else if (e2.key === "Escape") {
      setEditingId(null);
    }
  };
  const handleOrderInputBlur = (itemId) => {
    const newOrder = parseInt(editingValue, 10);
    if (!isNaN(newOrder) && newOrder >= 1 && newOrder <= items.length) {
      handleOrderChange(itemId, newOrder);
    }
    setEditingId(null);
  };
  const handleDragEnd = reactExports.useCallback(
    async (event) => {
      const { active: active3, over } = event;
      if (active3.id !== (over == null ? void 0 : over.id)) {
        const oldIndex = items.findIndex((item) => item.id === active3.id);
        const newIndex = items.findIndex((item) => item.id === (over == null ? void 0 : over.id));
        if (oldIndex !== -1 && newIndex !== -1) {
          const newItems = arrayMove(items, oldIndex, newIndex);
          setItems(newItems);
          await saveOrder(newItems);
        }
      }
    },
    [items, saveOrder]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          text: t2("common.action.close")
        }
      },
      size: "3xl",
      title: t2("property.modal.adjustPropertyOrderTitle"),
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500", children: t2("property.tip.orderEditInstructions") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              className: "w-64",
              placeholder: t2("property.action.searchProperties"),
              size: "sm",
              value: searchText,
              onValueChange: setSearchText
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          DndContext,
          {
            collisionDetection: closestCenter,
            sensors,
            onDragEnd: handleDragEnd,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              SortableContext$1,
              {
                items: filteredItems.map((item) => item.id),
                strategy: verticalListSortingStrategy,
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-lg", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 py-2 px-2 bg-default-100 font-medium border-b border-default-200", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-8" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-16", children: t2("common.label.order") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: t2("common.label.property") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-24", children: t2("common.label.actions") })
                  ] }),
                  filteredItems.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-8 text-center text-default-500", children: t2("property.empty.noPropertiesFound") }) : filteredItems.map((item, index2) => {
                    const globalIndex = index2 + 1;
                    const isEditing = editingId === item.id;
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      SortableRow,
                      {
                        editingValue,
                        globalIndex,
                        isEditing,
                        item,
                        t: t2,
                        totalCount: items.length,
                        onEditEnd: () => setEditingId(null),
                        onEditStart: (id2, value2) => {
                          setEditingId(id2);
                          setEditingValue(value2);
                        },
                        onEditingValueChange: setEditingValue,
                        onMoveToBottom: handleMoveToBottom,
                        onMoveToTop: handleMoveToTop,
                        onOrderInputBlur: handleOrderInputBlur,
                        onOrderInputKeyDown: handleOrderInputKeyDown
                      },
                      item.id
                    );
                  })
                ] })
              }
            )
          }
        )
      ] })
    }
  );
};
CustomPropertySortModal.displayName = "CustomPropertySortModal";
const PROPERTIES_COLUMNS_KEY = "bakabase:properties:columns";
const DetailModal = ({ id: id2, initialResource, onRemoved, ...props }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [resource, setResource] = reactExports.useState(initialResource);
  const [loading, setLoading] = reactExports.useState(!initialResource);
  const uiOptions = useUiOptionsStore((state) => state.data);
  const [columns, setColumns] = useLocalStorage(PROPERTIES_COLUMNS_KEY, 2);
  const loadResource = async () => {
    var _a3;
    const r2 = await BApi$1.resource.getResourcesByKeys({
      ids: [id2],
      additionalItems: ResourceAdditionalItem.All
    });
    const d2 = ((_a3 = r2.data || []) == null ? void 0 : _a3[0]) ?? {};
    if (d2.properties) {
      Object.values(d2.properties).forEach((a2) => {
        Object.values(a2).forEach((b2) => {
          if (b2.values) {
            for (const v2 of b2.values) {
              v2.bizValue = convertFromApiValue(v2.bizValue, b2.bizValueType);
              v2.aliasAppliedBizValue = convertFromApiValue(v2.aliasAppliedBizValue, b2.bizValueType);
              v2.value = convertFromApiValue(v2.value, b2.dbValueType);
            }
          }
        });
      });
    }
    setResource(d2);
    setLoading(false);
  };
  reactExports.useEffect(() => {
    loadResource();
  }, []);
  console.log(resource);
  const hideTimeInfo = !!((_a2 = uiOptions.resource) == null ? void 0 : _a2.hideResourceTimeInfo);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "7xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-4 flex-wrap", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink min-w-0 break-words", children: resource == null ? void 0 : resource.displayName }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 flex-shrink-0", children: [
          resource && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              MediaLibraryMappings,
              {
                compact: true,
                resourceId: resource.id,
                onMappingsChange: loadResource
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceProfiles, { compact: true, resourceId: resource.id })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            PopoverComponent,
            {
              shouldCloseOnBlur: true,
              placement: "left-start",
              trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  variant: "light",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$c, { className: "text-base" })
                }
              ),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("resource.label.columns") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: [
                    { col: 1, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbColumns1, {}) },
                    { col: 2, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbColumns2, {}) },
                    { col: 3, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbColumns3, {}) }
                  ].map(({ col, icon }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: columns === col ? "primary" : "default",
                      variant: columns === col ? "solid" : "flat",
                      onPress: () => setColumns(col),
                      children: icon
                    },
                    col
                  )) })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  listbox_default,
                  {
                    "aria-label": "Actions",
                    onAction: (key) => {
                      switch (key) {
                        case "AdjustPropertyScopePriority": {
                          if (resource) {
                            createPortal(PropertyValueScopePicker, {
                              resource
                            });
                          }
                          break;
                        }
                        case "SortPropertiesGlobally": {
                          BApi$1.customProperty.getAllCustomProperties().then((r2) => {
                            const properties2 = (r2.data || []).sort((a2, b2) => a2.order - b2.order);
                            createPortal(CustomPropertySortModal, {
                              properties: properties2,
                              onDestroyed: loadResource
                            });
                          });
                        }
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        listbox_item_base_default,
                        {
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$14, { className: "text-small" }),
                          children: t2("resource.action.adjustPropertyScopePriority")
                        },
                        "AdjustPropertyScopePriority"
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        listbox_item_base_default,
                        {
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$h, { className: "text-small" }),
                          children: t2("resource.action.sortPropertiesGlobally")
                        },
                        "SortPropertiesGlobally"
                      )
                    ]
                  }
                )
              ] })
            }
          )
        ] })
      ] }),
      onDestroyed: props.onDestroyed,
      children: resource && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 pb-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-[400px] w-[400px] max-w-[400px] flex flex-col gap-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "h-[400px] max-h-[400px] overflow-hidden rounded flex items-center justify-center border-1",
              style: { borderColor: "var(--bakaui-overlap-background)" },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceCoverMemo, { resource, showBiggerOnHover: false })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Properties,
              {
                hidePropertyName: true,
                propertyInnerDirection: "ver",
                reload: loadResource,
                resource,
                restrictedPropertyIds: [ReservedProperty.Rating],
                restrictedPropertyPool: PropertyPool.Reserved
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(button_group_default, { size: "sm", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                PlayControl,
                {
                  PortalComponent: ({ status, onClick, tooltipContent }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tooltipContent ?? t2("common.action.play"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "primary",
                      onPress: onClick,
                      isDisabled: status === "loading",
                      children: status === "loading" ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-lg", spin: true }) : status === "not-found" ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-lg text-warning" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: "text-lg" })
                    }
                  ) }),
                  resource
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.openFolder"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "default",
                  variant: "light",
                  onPress: () => {
                    BApi$1.resource.openResourceDirectory({
                      id: resource.id
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-lg" })
                }
              ) }),
              resource.hasChildren && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.viewChildren"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "default",
                  onPress: () => {
                    createPortal(ChildrenModal, {
                      resourceId: resource.id,
                      resourceDisplayName: resource.displayName
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(TiFlowChildren, { className: "text-lg" })
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: hideTimeInfo ? t2("common.action.showTimeInfo") : t2("common.action.hideTimeInfo"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  className: hideTimeInfo ? "opacity-40" : void 0,
                  color: "default",
                  variant: "light",
                  onPress: () => {
                    BApi$1.options.patchUiOptions({
                      ...uiOptions,
                      resource: {
                        ...uiOptions.resource,
                        hideResourceTimeInfo: !hideTimeInfo
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdCalendarMonth, { className: "text-lg" })
                }
              ) })
            ] }) })
          ] }),
          !hideTimeInfo && /* @__PURE__ */ jsxRuntimeExports.jsx(BasicInfo, { resource })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-auto relative grow", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full min-h-[200px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { label: t2("common.state.loadingProperties") }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceHierarchy, { resource, onReload: loadResource }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(IntroductionSummary, { resource, onReload: loadResource }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Properties,
              {
                columns: 1,
                reload: loadResource,
                resource,
                restrictedPropertyIds: [ReservedProperty.Cover],
                restrictedPropertyPool: PropertyPool.Reserved
              }
            ),
            resource.playedAt && /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-x-4 gap-y-1 undefined items-center overflow-visible",
                style: {
                  gridTemplateColumns: "calc(120px) minmax(0, 1fr)"
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Chip,
                    {
                      className: "text-right justify-self-end",
                      color: "default",
                      radius: "sm",
                      size: "sm",
                      children: t2("resource.label.lastPlayedAt")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    resource.playedAt,
                    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.action.markAsNotPlayed"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        size: "sm",
                        variant: "light",
                        onPress: () => {
                          BApi$1.resource.markResourceAsNotPlayed(resource.id).then((r2) => {
                            if (!r2.code) {
                              loadResource();
                            }
                          });
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base opacity-60" })
                      }
                    ) })
                  ] })
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Properties,
            {
              columns,
              noPropertyContent: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center gap-2 justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-4/5", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-base mr-1" }),
                t2("resource.empty.noCustomPropertyBound")
              ] }) }),
              reload: loadResource,
              resource,
              restrictedPropertyPool: PropertyPool.Custom
            }
          )
        ] }) })
      ] }) })
    }
  );
};
DetailModal.displayName = "DetailModal";
function createEnhancerTargetOptions(descriptor) {
  const eto = {
    target: descriptor.id
  };
  if (descriptor.optionsItems != void 0)
    ;
  return eto;
}
const CoverSelectOrder = ({
  coverSelectOrder,
  onChange,
  isDisabled
}) => {
  const { t: t2 } = useTranslation();
  console.log(coverSelectOrder);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    radio_group_default,
    {
      isDisabled,
      orientation: "horizontal",
      size: "sm",
      value: coverSelectOrder == null ? void 0 : coverSelectOrder.toString(),
      onValueChange: (c2) => {
        onChange == null ? void 0 : onChange(parseInt(c2, 10));
      },
      children: Object.keys(CoverSelectOrder$1).filter((x2) => !Number.isNaN(parseInt(x2, 10))).map((x2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: x2, children: t2(`CoverSelectOrder.${CoverSelectOrder$1[parseInt(x2, 10)]}`) });
      })
    }
  );
};
CoverSelectOrder.displayName = "CoverSelectOrder";
const TargetOptions = ({
  options: propsOptions,
  optionsItems,
  onChange,
  isDisabled
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  reactExports.useEffect(() => {
    setOptions2(propsOptions ?? {});
  }, [propsOptions]);
  const patchOptions = (patches, triggerChange = true) => {
    const no = {
      ...options,
      ...patches
    };
    setOptions2(no);
    if (triggerChange) {
      onChange == null ? void 0 : onChange(no);
    }
  };
  const finalOptions = propsOptions ?? options;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: optionsItems == null ? void 0 : optionsItems.map((item, index2) => {
    switch (item) {
      case EnhancerTargetOptionsItem.CoverSelectOrder:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          CoverSelectOrder,
          {
            coverSelectOrder: finalOptions.coverSelectOrder,
            isDisabled,
            onChange: (o2) => patchOptions({ coverSelectOrder: o2 })
          },
          item
        );
      default:
        return null;
    }
  }) });
};
TargetOptions.displayName = "TargetOptions";
const IntegrateWithSpecialTextLabel = ({ type: type4 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  let tooltipContent = "";
  switch (type4) {
    case SpecialTextType.DateTime:
      tooltipContent = t2(
        "Data will be attempted to be converted into date&time data according to relevant conversions."
      );
      break;
    case SpecialTextType.Useless:
    case SpecialTextType.Language:
    case SpecialTextType.Wrapper:
    case SpecialTextType.Standardization:
    case SpecialTextType.Volume:
    case SpecialTextType.Trim:
      tooltipContent = t2("Data will be processed with special texts.");
      break;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        tooltipContent,
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          link_default,
          {
            className: "active:no-underline cursor-pointer",
            size: "sm",
            onClick: (e2) => {
              e2.preventDefault();
              e2.stopPropagation();
              createPortal(Modal, {
                title: t2("We are leaving current page"),
                children: t2("Are you sure?"),
                defaultVisible: true,
                onOk: () => {
                  window.location.href = "/text";
                }
              });
            },
            children: t2("Click to check special texts")
          }
        )
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2("Integrate with special text") })
    }
  );
};
IntegrateWithSpecialTextLabel.displayName = "IntegrateWithSpecialTextLabel";
function IoDuplicateOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "rect", "attr": { "width": "336", "height": "336", "x": "128", "y": "128", "fill": "none", "strokeLinejoin": "round", "strokeWidth": "32", "rx": "57", "ry": "57" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m383.5 128 .5-24a56.16 56.16 0 0 0-56-56H112a64.19 64.19 0 0 0-64 64v216a56.16 56.16 0 0 0 56 56h24m168-168v160m80-80H216" }, "child": [] }] })(props);
}
function IoGitBranchOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "circle", "attr": { "cx": "160", "cy": "96", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "circle", "attr": { "cx": "160", "cy": "416", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M160 368V144" }, "child": [] }, { "tag": "circle", "attr": { "cx": "352", "cy": "160", "r": "48", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M352 208c0 128-192 48-192 160" }, "child": [] }] })(props);
}
function IoLayersOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m434.8 137.65-149.36-68.1c-16.19-7.4-42.69-7.4-58.88 0L77.3 137.65c-17.6 8-17.6 21.09 0 29.09l148 67.5c16.89 7.7 44.69 7.7 61.58 0l148-67.5c17.52-8 17.52-21.1-.08-29.09zM160 308.52l-82.7 37.11c-17.6 8-17.6 21.1 0 29.1l148 67.5c16.89 7.69 44.69 7.69 61.58 0l148-67.5c17.6-8 17.6-21.1 0-29.1l-79.94-38.47" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m160 204.48-82.8 37.16c-17.6 8-17.6 21.1 0 29.1l148 67.49c16.89 7.7 44.69 7.7 61.58 0l148-67.49c17.7-8 17.7-21.1.1-29.1L352 204.48" }, "child": [] }] })(props);
}
function IoLocate(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "48", "d": "M256 96V56m0 400v-40m0-304a144 144 0 1 0 144 144 144 144 0 0 0-144-144zm160 144h40m-400 0h40" }, "child": [] }] })(props);
}
function IoPlayCircleOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeMiterlimit": "10", "strokeWidth": "32", "d": "M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192 192-86 192-192z" }, "child": [] }, { "tag": "path", "attr": { "d": "m216.32 334.44 114.45-69.14a10.89 10.89 0 0 0 0-18.6l-114.45-69.14a10.78 10.78 0 0 0-16.32 9.31v138.26a10.78 10.78 0 0 0 16.32 9.31z" }, "child": [] }] })(props);
}
function IoRocketOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M461.81 53.81a4.4 4.4 0 0 0-3.3-3.39c-54.38-13.3-180 34.09-248.13 102.17a294.9 294.9 0 0 0-33.09 39.08c-21-1.9-42-.3-59.88 7.5-50.49 22.2-65.18 80.18-69.28 105.07a9 9 0 0 0 9.8 10.4l81.07-8.9a180.29 180.29 0 0 0 1.1 18.3 18.15 18.15 0 0 0 5.3 11.09l31.39 31.39a18.15 18.15 0 0 0 11.1 5.3 179.91 179.91 0 0 0 18.19 1.1l-8.89 81a9 9 0 0 0 10.39 9.79c24.9-4 83-18.69 105.07-69.17 7.8-17.9 9.4-38.79 7.6-59.69a293.91 293.91 0 0 0 39.19-33.09c68.38-68 115.47-190.86 102.37-247.95zM298.66 213.67a42.7 42.7 0 1 1 60.38 0 42.65 42.65 0 0 1-60.38 0z" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M109.64 352a45.06 45.06 0 0 0-26.35 12.84C65.67 382.52 64 448 64 448s65.52-1.67 83.15-19.31A44.73 44.73 0 0 0 160 402.32" }, "child": [] }] })(props);
}
function IoSettingsOutline(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z" }, "child": [] }] })(props);
}
function IoSync(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "M434.67 285.59v-29.8c0-98.73-80.24-178.79-179.2-178.79a179 179 0 0 0-140.14 67.36m-38.53 82v29.8C76.8 355 157 435 256 435a180.45 180.45 0 0 0 140-66.92" }, "child": [] }, { "tag": "path", "attr": { "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round", "strokeWidth": "32", "d": "m32 256 44-44 46 44m358 0-44 44-46-44" }, "child": [] }] })(props);
}
const PropertyMatcher = ({
  matchedProperty,
  type: type4,
  name: name2,
  options,
  isClearable,
  onValueChanged: propsOnValueChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [property2, setProperty3] = reactExports.useState();
  const [isFindingBestMatch, setIsFindingBestMatch] = reactExports.useState(false);
  reactExports.useEffect(() => {
    setProperty3(matchedProperty);
  }, [matchedProperty]);
  const onValueChange = reactExports.useCallback(
    (property22) => {
      setProperty3(property22);
      console.log(property22);
      propsOnValueChanged == null ? void 0 : propsOnValueChanged(property22);
    },
    [propsOnValueChanged]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
    property2 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          size: "sm",
          variant: "light",
          onPress: () => {
            createPortal(PropertySelector, {
              v2: true,
              pool: PropertyPool.Custom | PropertyPool.Reserved,
              multiple: false,
              onSubmit: async (selection) => {
                onValueChange(selection[0]);
              }
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 })
        }
      ),
      isClearable && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "warning",
          size: "sm",
          variant: "light",
          onPress: () => {
            onValueChange();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDisconnect, { className: "text-base" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("propertyMatcher.autoMatch.tooltip"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "primary",
        isLoading: isFindingBestMatch,
        size: "sm",
        variant: "light",
        onPress: async () => {
          if (name2 == void 0 || name2.length == 0) {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("propertyMatcher.noName.title"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: t2("propertyMatcher.noName.description") }),
              footer: {
                actions: ["cancel"]
              }
            });
            return;
          }
          setIsFindingBestMatch(true);
          try {
            const candidate = await BApi$1.property.findBestMatchingProperty({
              type: type4,
              name: name2
            });
            if (candidate.data) {
              onValueChange(candidate.data);
            } else {
              const modal2 = createPortal(Modal, {
                defaultVisible: true,
                title: t2("propertyMatcher.noMatch.title"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                  t2("propertyMatcher.noMatch.youCan"),
                  ":",
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      card_default,
                      {
                        isPressable: true,
                        className: "flex flex-col items-center gap-2 justify-center py-2",
                        onPress: async () => {
                          const r2 = await BApi$1.customProperty.addCustomProperty({
                            name: name2,
                            type: type4,
                            options: options ? JSON.stringify(options) : void 0
                          });
                          if (r2.code) {
                            throw new Error(r2.message);
                          }
                          const np = r2.data;
                          onValueChange(np);
                          modal2.destroy();
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-2xl" }),
                          t2("propertyMatcher.autoCreate.label")
                        ]
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      card_default,
                      {
                        isPressable: true,
                        className: "flex flex-col items-center gap-2 justify-center py-2",
                        onPress: () => {
                          modal2.destroy();
                          createPortal(PropertySelector, {
                            v2: true,
                            pool: PropertyPool.Custom | PropertyPool.Reserved,
                            multiple: false,
                            onSubmit: async (selection) => {
                              onValueChange(selection[0]);
                            }
                          });
                        },
                        children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-2xl" }),
                          t2("propertyMatcher.selectManually.label")
                        ]
                      }
                    )
                  ] })
                ] }),
                footer: false
              });
            }
          } finally {
            setIsFindingBestMatch(false);
          }
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-base" })
      }
    ) })
  ] });
};
PropertyMatcher.displayName = "PropertyMatcher";
const StdValueSpecialTextIntegrationMap = {
  [StandardValueType.DateTime]: SpecialTextType.DateTime
};
const log$j = buildLogger("TargetRow");
const TargetRow = (props) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const {
    dynamicTarget,
    options: propsOptions,
    onDeleted,
    otherDynamicTargetsInGroup,
    propertyMap,
    descriptor,
    onPropertyChanged,
    onChange,
    dynamicTargetCandidates
  } = props;
  const [options, setOptions2] = reactExports.useState(
    propsOptions ?? createEnhancerTargetOptions(descriptor)
  );
  const [dynamicTargetError, setDynamicTargetError] = reactExports.useState();
  const dynamicTargetInputValueRef = reactExports.useRef();
  const [editingDynamicTarget, setEditingDynamicTarget] = reactExports.useState(false);
  const validateDynamicTarget = (newTarget) => {
    let error2;
    if (otherDynamicTargetsInGroup == null ? void 0 : otherDynamicTargetsInGroup.includes(newTarget)) {
      error2 = t2("enhancer.target.duplicateDynamic.error");
    }
    if (newTarget.length == 0) {
      error2 = t2("validation.field.required");
    }
    if (dynamicTargetError != error2) {
      setDynamicTargetError(error2);
    }
    return error2 == void 0;
  };
  useUpdateEffect(() => {
    setOptions2(propsOptions ?? createEnhancerTargetOptions(descriptor));
  }, [propsOptions]);
  const patchTargetOptions = async (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
    log$j("Patch target options", newOptions);
    if (!newOptions.autoBindProperty && (newOptions.propertyPool == void 0 || newOptions.propertyId == void 0)) {
      return;
    }
    onChange == null ? void 0 : onChange(newOptions);
  };
  const dt = options.dynamicTarget ?? dynamicTarget;
  const targetLabel = descriptor.isDynamic ? dt ?? t2("enhancer.target.default.label") : descriptor.name;
  const isDefaultTargetOfDynamic = descriptor.isDynamic && dt == void 0;
  const integratedSpecialTextType = StdValueSpecialTextIntegrationMap[descriptor.valueType];
  let property2;
  if (options.propertyPool != void 0 && options.propertyId != void 0) {
    property2 = (_a2 = propertyMap == null ? void 0 : propertyMap[options.propertyPool]) == null ? void 0 : _a2[options.propertyId];
  }
  const noPropertyBound = !options.autoBindProperty && (!options.propertyId || !options.propertyPool);
  log$j(props, options, propsOptions, property2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[80px] flex justify-center", children: isDefaultTargetOfDynamic ? "-" : noPropertyBound ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-lg text-warning" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-4/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: descriptor.isDynamic && !isDefaultTargetOfDynamic ? editingDynamicTarget ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      autocomplete_default,
      {
        allowsCustomValue: true,
        isRequired: true,
        defaultInputValue: dynamicTargetInputValueRef.current,
        errorMessage: dynamicTargetError,
        isInvalid: dynamicTargetError != void 0,
        items: (dynamicTargetCandidates == null ? void 0 : dynamicTargetCandidates.map((k2) => ({ label: k2, value: k2 }))) ?? [],
        size: "sm",
        onBlur: () => {
          if (dynamicTargetInputValueRef.current != void 0 && dynamicTargetInputValueRef.current.length > 0) {
            patchTargetOptions({
              dynamicTarget: dynamicTargetInputValueRef.current
            });
          }
          dynamicTargetInputValueRef.current = void 0;
          setEditingDynamicTarget(false);
        },
        onInputChange: (v2) => {
          if (validateDynamicTarget(v2)) {
            dynamicTargetInputValueRef.current = v2;
          }
        },
        children: (c2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: c2.label }, c2.value)
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        variant: "light",
        onClick: () => {
          dynamicTargetInputValueRef.current = dt;
          setEditingDynamicTarget(true);
        },
        children: [
          targetLabel ?? t2("enhancer.target.clickToSpecify.action"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" })
        ]
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        BriefProperty,
        {
          fields: ["name", "type"],
          property: {
            type: descriptor.propertyType,
            name: descriptor.name
          }
        }
      ),
      integratedSpecialTextType && /* @__PURE__ */ jsxRuntimeExports.jsx(IntegrateWithSpecialTextLabel, { type: integratedSpecialTextType }),
      descriptor.description && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          className: "max-w-[400px]",
          color: "secondary",
          content: descriptor.description,
          placement: "right",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
        }
      )
    ] }) }) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: isDefaultTargetOfDynamic ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "light", children: "/" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      PropertyMatcher,
      {
        isClearable: true,
        matchedProperty: property2,
        name: descriptor.isDynamic ? options.dynamicTarget : descriptor.name,
        type: descriptor.propertyType,
        onValueChanged: (property22) => {
          if (!property22) {
            onDeleted == null ? void 0 : onDeleted();
            return;
          }
          patchTargetOptions({
            propertyId: property22.id,
            propertyPool: property22.pool
          });
          onPropertyChanged == null ? void 0 : onPropertyChanged();
        }
      }
    ) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      TargetOptions,
      {
        isDisabled: !options.autoBindProperty && (!options.propertyId || !options.propertyPool),
        options,
        optionsItems: descriptor.optionsItems,
        onChange: patchTargetOptions
      }
    ) }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-1/12", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: descriptor.isDynamic && !isDefaultTargetOfDynamic && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "danger",
        size: "sm",
        variant: "light",
        onPress: () => {
          onDeleted == null ? void 0 : onDeleted();
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
      }
    ) }) })
  ] });
};
TargetRow.displayName = "TargetRow";
const OtherOptionsTip = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-base", children: t2("enhancer.targetOptions.autoBind.label") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoBind.description"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoBind.createTip"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoBind.dynamicTip"
        ) })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-base", children: t2("enhancer.targetOptions.autoMatch.label") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoMatch.description"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoMatch.checkedBehavior"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoMatch.example"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoMatch.exampleResult"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "enhancer.targetOptions.autoMatch.warning"
        ) })
      ] })
    ] })
  ] }) });
};
OtherOptionsTip.displayName = "OtherOptionsTip";
const PropertiesMatcher = ({
  properties: properties2,
  onValueChanged: propsOnValueChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [isFindingBestMatch, setIsFindingBestMatch] = reactExports.useState(false);
  const onValueChange = reactExports.useCallback(
    (properties22) => {
      console.log(properties22);
      propsOnValueChanged == null ? void 0 : propsOnValueChanged(properties22);
    },
    [propsOnValueChanged]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("propertyMatcher.autoMatch.tooltip"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      color: "primary",
      size: "sm",
      variant: "light",
      isLoading: isFindingBestMatch,
      onPress: async () => {
        setIsFindingBestMatch(true);
        try {
          const results = await Promise.all(
            properties2.map(
              (property2) => BApi$1.property.findBestMatchingProperty({
                type: property2.type,
                name: property2.name
              })
            )
          );
          const ret = results.map(
            (r2) => r2.data
          );
          const missingIndexes = ret.map((p2, idx) => p2 ? -1 : idx).filter((idx) => idx !== -1);
          if (missingIndexes.length === 0) {
            onValueChange(ret);
            return;
          }
          const modal2 = createPortal(Modal, {
            defaultVisible: true,
            title: t2("propertyMatcher.partialMatch.title"),
            size: "lg",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: t2("propertyMatcher.autoMatched.label") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 text-sm", children: ret.map((p2, idx) => p2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: p2 }, `matched-${idx}`) : null) })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: t2("propertyMatcher.missing.label") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 text-sm text-warning-500", children: missingIndexes.map((idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: properties2[idx] }, `missing-${idx}`)) })
              ] }),
              t2("propertyMatcher.noMatch.youCan"),
              ":",
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  card_default,
                  {
                    isPressable: true,
                    className: "relative flex flex-col items-center gap-2 justify-center py-3 border-2 border-primary-500 bg-primary-50 hover:bg-primary-100 shadow-sm",
                    onPress: async () => {
                      const models = missingIndexes.map((idx) => {
                        const p2 = properties2[idx];
                        return {
                          name: p2.name,
                          type: p2.type,
                          options: p2.options ? JSON.stringify(p2.options) : void 0
                        };
                      });
                      const r2 = await BApi$1.customProperty.addCustomPropertyBatch(models);
                      if (r2.code) {
                        throw new Error(r2.message);
                      }
                      const created = r2.data || [];
                      created.forEach((cp, i2) => {
                        const idx = missingIndexes[i2];
                        ret[idx] = cp;
                      });
                      onValueChange(ret);
                      modal2.destroy();
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "absolute top-1 right-1 rounded-full bg-primary-500 text-white text-[10px] px-2 py-0.5", children: t2("propertyMatcher.recommended.label") }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-2xl text-primary-600" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium text-primary-700 text-center px-2", children: t2("propertyMatcher.autoCreateMissing.label") })
                    ]
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  card_default,
                  {
                    isPressable: missingIndexes.length > 0,
                    className: `relative flex flex-col items-center gap-2 justify-center py-2 border border-default-200 bg-content1 text-default-600 hover:bg-content2 ${missingIndexes.length === 0 ? "opacity-50 pointer-events-none" : ""}`,
                    onPress: () => {
                      onValueChange(ret);
                      modal2.destroy();
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-2xl text-default-500" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-700 text-center px-2", children: t2("propertyMatcher.keepMatched.label") })
                    ]
                  }
                )
              ] })
            ] }),
            footer: {
              actions: ["cancel"]
            }
          });
        } finally {
          setIsFindingBestMatch(false);
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-base" })
    }
  ) });
};
PropertiesMatcher.displayName = "PropertiesMatcher";
const log$i = buildLogger("DynamicTargets");
const buildGroups = (descriptors2, optionsList, candidateTargetsMap) => {
  return descriptors2.map((descriptor) => {
    const subOptions = (optionsList == null ? void 0 : optionsList.filter((x2) => x2.target == descriptor.id)) || [];
    let defaultOptions2 = subOptions.find((x2) => x2.dynamicTarget == void 0);
    if (defaultOptions2 == void 0) {
      defaultOptions2 = createEnhancerTargetOptions(descriptor);
    } else {
      const defaultIdx = subOptions.findIndex((x2) => x2 == defaultOptions2);
      subOptions.splice(defaultIdx, 1);
    }
    subOptions.splice(0, 0, defaultOptions2);
    return {
      descriptor,
      subOptions,
      candidateTargets: candidateTargetsMap == null ? void 0 : candidateTargetsMap[descriptor.id]
    };
  });
};
const DynamicTargets = (props) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { propertyMap, optionsList, enhancer, onPropertyChanged, onChange, candidateTargetsMap } = props;
  const dynamicTargetDescriptors = enhancer.targets.filter((x2) => x2.isDynamic);
  const [groups, setGroups] = reactExports.useState([]);
  reactExports.useEffect(() => {
    setGroups(buildGroups(dynamicTargetDescriptors, optionsList, candidateTargetsMap));
  }, [candidateTargetsMap]);
  const updateGroups = (groups2) => {
    setGroups([...groups2]);
    const ol2 = _$2.flatMap(groups2, (g2) => g2.subOptions);
    onChange == null ? void 0 : onChange(ol2);
  };
  log$i("rendering", optionsList, groups);
  return groups.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: groups.map((g2) => {
    const { descriptor, subOptions, candidateTargets } = g2;
    const notEmptyTargets = subOptions.filter((x2) => x2.dynamicTarget != void 0);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Dynamic target", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 80, children: t2("enhancer.target.configured.label") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_column_default, { width: "33.3333%", children: [
            descriptor.name,
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverComponent, { trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$17, { className: "text-base" }), children: t2(
              "enhancer.target.dynamicLabel.tip"
            ) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("enhancer.target.bindProperty.label"),
            notEmptyTargets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              PropertiesMatcher,
              {
                properties: notEmptyTargets.map((td2) => ({
                  type: descriptor.propertyType,
                  name: td2.dynamicTarget
                })),
                onValueChanged: (ps) => {
                  var _a2;
                  for (let i2 = 0; i2 < ps.length; i2++) {
                    const p2 = ps[i2];
                    if (p2) {
                      subOptions[i2] = {
                        ...subOptions[i2],
                        propertyId: p2.id,
                        propertyPool: p2.pool,
                        target: descriptor.id
                      };
                      if (propertyMap) {
                        const pMap = propertyMap[_a2 = p2.pool] ?? (propertyMap[_a2] = {});
                        if (!(p2.id in pMap)) {
                          pMap[p2.id] = p2;
                        }
                      }
                    }
                  }
                  updateGroups(groups);
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2("enhancer.target.otherOptions.label"),
            /* @__PURE__ */ jsxRuntimeExports.jsx(OtherOptionsTip, {})
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.operations") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: subOptions.map((data, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TargetRow,
            {
              descriptor,
              dynamicTarget: data.dynamicTarget,
              dynamicTargetCandidates: candidateTargets,
              options: data,
              propertyMap,
              onChange: (newOptions) => {
                subOptions[i2] = newOptions;
                updateGroups(groups);
              },
              onDeleted: () => {
                subOptions == null ? void 0 : subOptions.splice(i2, 1);
                updateGroups(groups);
              },
              onPropertyChanged
            },
            i2
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
        ] });
      }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "success",
          size: "sm",
          variant: "light",
          onPress: () => {
            const currentTargets = subOptions.filter((x2) => x2.dynamicTarget != void 0).map((x2) => x2.dynamicTarget);
            const nextTarget = generateNextWithPrefix(t2("enhancer.target.label"), currentTargets);
            const newOptions = createEnhancerTargetOptions(descriptor);
            newOptions.dynamicTarget = nextTarget;
            subOptions.push(newOptions);
            setGroups([...groups]);
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-sm" }),
            t2("enhancer.target.specifyDynamic.action")
          ]
        }
      )
    ] });
  }) }) : null;
};
DynamicTargets.displayName = "DynamicTargets";
const FixedTargets = (props) => {
  const { t: t2 } = useTranslation();
  const {
    optionsList: propsOptionsList,
    propertyMap,
    enhancer,
    onPropertyChanged,
    onChange
  } = props;
  const [optionsList, setOptionsList] = reactExports.useState(
    propsOptionsList || []
  );
  const fixedTargets = enhancer.targets.filter((t22) => !t22.isDynamic);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, "aria-label": "Fixed targets", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { align: "center", width: 80, children: t2("enhancer.target.configured.label") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "33.3333%", children: t2("enhancer.target.fixed.label") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          t2("enhancer.target.bindProperty.label"),
          enhancer.targets && enhancer.targets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertiesMatcher,
            {
              properties: enhancer.targets.map((td2) => ({
                type: td2.propertyType,
                name: td2.name
              })),
              onValueChanged: (ps) => {
                var _a2;
                for (let i2 = 0; i2 < ps.length; i2++) {
                  const p2 = ps[i2];
                  if (p2) {
                    const td2 = enhancer.targets[i2];
                    let to2 = optionsList.find((x2) => x2.target == td2.id);
                    if (!to2) {
                      to2 = { target: enhancer.targets[i2].id };
                      optionsList.push(to2);
                    }
                    to2.propertyId = p2.id;
                    to2.propertyPool = p2.pool;
                    if (propertyMap) {
                      const pMap = propertyMap[_a2 = p2.pool] ?? (propertyMap[_a2] = {});
                      if (!(p2.id in pMap)) {
                        pMap[p2.id] = p2;
                      }
                    }
                  }
                }
                setOptionsList(optionsList);
                onChange == null ? void 0 : onChange(optionsList);
              }
            }
          )
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "25%", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          t2("enhancer.target.otherOptions.label"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(OtherOptionsTip, {})
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, {})
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-y-2", children: fixedTargets.map((target, i2) => {
      const toIdx = optionsList.findIndex((x2) => x2.target == target.id);
      const to2 = optionsList[toIdx];
      const targetDescriptor = enhancer.targets.find(
        (x2) => x2.id == target.id
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          TargetRow,
          {
            descriptor: targetDescriptor,
            options: to2,
            propertyMap,
            onChange: (o2) => {
              const newOptionsList = [...optionsList];
              if (toIdx == -1) {
                newOptionsList.push(o2);
              } else {
                newOptionsList[toIdx] = o2;
              }
              setOptionsList(newOptionsList);
              onChange == null ? void 0 : onChange(newOptionsList);
            },
            onDeleted: () => {
              const newOptionsList = [...optionsList];
              if (toIdx != -1) {
                newOptionsList.splice(toIdx, 1);
              }
              setOptionsList(newOptionsList);
              onChange == null ? void 0 : onChange(newOptionsList);
            },
            onPropertyChanged
          },
          `${target.id}-${to2 == null ? void 0 : to2.dynamicTarget}`
        ),
        fixedTargets.length - 1 !== i2 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
      ] });
    }) })
  ] });
};
FixedTargets.displayName = "FixedTargets";
function SiKodi(props) {
  return GenIcon({ "attr": { "role": "img", "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12.03.047c-.226 0-.452.107-.669.324-.922.922-1.842 1.845-2.763 2.768-.233.233-.455.48-.703.695-.31.267-.405.583-.399.988.02 1.399.008 2.799.008 4.198 0 1.453-.002 2.907 0 4.36 0 .11.002.223.03.327.087.337.303.393.546.15 1.31-1.31 2.618-2.622 3.928-3.933l4.449-4.453c.43-.431.43-.905 0-1.336L12.697.37c-.216-.217-.442-.324-.668-.324zm7.224 7.23c-.223 0-.445.104-.65.309L14.82 11.37c-.428.429-.427.895 0 1.322l3.76 3.766c.44.44.908.44 1.346.002 1.215-1.216 2.427-2.433 3.644-3.647.182-.18.353-.364.43-.615v-.33c-.077-.251-.246-.436-.428-.617-1.224-1.22-2.443-2.445-3.666-3.668-.205-.205-.429-.307-.652-.307zM4.18 7.611c-.086.014-.145.094-.207.157L.209 11.572c-.28.284-.278.677.004.96l2.043 2.046c.59.59 1.177 1.182 1.767 1.772.169.168.33.139.416-.084.044-.114.062-.242.063-.364.004-1.283.004-2.567.004-3.851h-.002V8.184c0-.085-.01-.169-.022-.252-.019-.135-.072-.258-.207-.309a.186.186 0 0 0-.095-.012zm7.908 6.838c-.224 0-.447.106-.656.315L7.66 18.537c-.433.434-.433.899.002 1.334 1.215 1.216 2.43 2.43 3.643 3.649.18.18.361.354.611.433h.33c.244-.069.423-.226.598-.402 1.222-1.23 2.45-2.453 3.676-3.68.43-.43.427-.905-.004-1.338l-3.772-3.773c-.208-.208-.432-.311-.656-.31z" }, "child": [] }] })(props);
}
const DLsite = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAAAZCAMAAABtjXLxAAAAt1BMVEUAAAAFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoP8yAAFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoMFKoP8yAD8yAAFKoMFKoMFKoP8yAAFKoP8yAD8yAD8yAD8yAAFKoP8yAAFKoP8yAAFKoP8yABxWlg8AAAAO3RSTlMAMPBgoNGQ4AjmD8XAtSUC8xr9+bCYPSrqpoNQTDXYu/6ynIltWEUgzK17eGTn2mRPSTPQxpqJfX0WCvdznL4AAAIjSURBVEjHldRpg5owEAbgMcISbhAVRcBrPVb37t30//+ukpFggoHa9wtxkIcEMgDDzLwsBZEBlqAzH+v1Mz9ahBALOsOaeNP75I8/VThNGGOkXxaZ0HvkNZe//p/MXOde+cvdsqDpv+VnLn+v5ehwiPvkbGOLB9InTycuP//z5eXbb5QxHlxCd8bRevVPgSwPINxZDDPtlGOvqo4r36iya8vhm5jcah7LMoDj43DZJR9sdpGH/PjQkumYXUP2igz0iONAL1OT9ch0yeQke0WGKY4f9fKZ6WVC/Gq4FeSonvVBkaHk47lWDme8NtoUbRnPpghGWQBhYTAeX5Wx6GrlAt/NAkArb/ALwRVxnn0q8gMfm1p5eFnOjRzhgvAeOdTZ4B9u5+xp5R+89HYrE3wYOKO9WcfCn4qMr9/QyrichSrbQt5jjy3U7SHLwap7bxjX9Q5Fr1pCznllq8pMlp969vMS+/MqG7L8iS2mytFVDjMcuqCTnYiX0ls5wi5K+I4sBnLSRg58hnnXyeEcdzNV5bK527j+BGPygfRFOp+91QX2QcjDOgDF1hTLUWS8nRk33VvmIcCvbDQLhCzFjlGWg/sCs2vJ71iN3Ll4RYyYryOuBC0Z26hb9qElh0eGsQCcUp2g05LLFLpl02nLEMyEDLHJpJxAkaOMQrfsI6zKEI+FDHSbNDNegCRb/iNeqpftpxygLWOKiZVYgIlPLmGJvayhv5Y94zAKuFkxAAAAAElFTkSuQmCC";
const Bangumi = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIcAAAAjCAYAAAC+ahnyAAAKRElEQVR42uzXSWhTURTGcYcuGumiC0VQ1IXSlWMRFHFZcKcuRVfqQg3oWkRcxaJSCBa1aG0QSRWr1lonHKJGFIeNglarUuhI0zkd6Ljpv+VbHB4paUpCSrkXfrzkcd65J/ccAm+RW265tYBW/PL1nSjvDZYtTuGZQlxAbrqLycEqrJy+wrUoq8NRhLc4MMv4LajEYyxPdzFn8Qd1qMdF16KsD8g5RLEtSdxeRFCDTekuYi2a0IkOxLDRtSfrw5GHatQif4YYP6KowOpMFBFEj1HqWjNvBmQrPqPEc38ZivERAfgysXkBYuhHXJ8LXFvm1YCcwFcc1PcVCOEL/JncuBxDMohi147U19RbBWe3NMWzX5JC7DV8wz5U4ROK5tjz3NkEbcYARmRYBUQQxXt5p3svcR8B7E6Q7zw+4DXe6Or1Sl6gFhU4hXXeH4Bbeua58cx4Kk9Qjbu4hP3ISVDfHgRxT/E18sjjgXLdwGlsT5DrpOqvUnwZfEnO+4hi72h/v+77cFV1hVEpYQnhIX7gu0RQihBuogTHsN6zZz6u4DZCcjjpcKiYCRk3xoxRGTGG5YzJtcv+AxkD0m/EjT75jx0m31H0oNvoQqfR4RFDu4SRZ/IF0Ga0osVoNpqk0Thucm3APzQYh5Kc9Ro19y/qpdAMzW+jzvglP+OT7Zt5bFXVFsYT2oKCDNqGBxqkPJTHYC19UAcKz0IfahlsH2J9oGKROhYH0DgrFQecLVVTsCClBcGCKCJDYlAUBxIHBhMFqVAQi2AqdQCMUOr3x+8mKytXzmmKidF7kl8ud6+z993Dt9da+5wyfeamyKdho2ED4SfLJayfwiesefsgYZwnGsQRw+co+lW3o6pQ6n4rIBahvenEcjzLYgtlVfCyqBQfI5qfjHhKTZa+0Ylnlahg1803VCKELVZAkEV7mRHxGAG9hdeaI+ZCuShj7DucgNaL42ivxAno5RAbcaqoNhRTfqJ4H7FtgfniWULJU3jsz2GTmEkfnmF+P4sICF40uclaJ6ChgV6DsNFoqBJtAup8LBoMpU14gufbSsfLHID9ZjEnW+/D7x4X9EwAEX0P60QHcoE3nPeZLloG5A/vi91QKx7kd/qIHcb71Ih+AX07TWzm3u2IIwXbJOeBlop4U7elWGXEU+La7kgq8IURUB62250HWihaBC3McCsMFqBLCE/zi6mzX5zWjES41IWvlSZG7nDh6/KAto4XH7nwdQW2nCjhq0NAe4NY/L1QLTpjm+U80IwQYy1xIayM8iR2c43hQp/bGOFUi/7OPg7RbEVAK0WcOJlQstmQSbXAXdFoeCrEANfaOiYEJKDQCjH3KJTDbJK9Q3ifwzCE9qbY/IddER/Qt4nG+/xMbG0l4sUHLv+5NcRYl+F96mAK5Wlir/FAX4t/Bb3v4L5a2CX6YrvX5T+v2rqEhY0mfM31ySYecpsR0GhsDyOmrTAvzI4d6RZ5n+jcxDoHI5NCbGxsJu+Z+LuH/KcBRod4ivilS6ALsOU5D1QTlIyRWP9g2Gm8RoXYZygOMd8LXAI9j/JTWLzdhsGu7t0R8cBAvylcAv22eUf2hdgO20RGUEfjiN+NhqKAOglivatTZo7CvzrbLgZU6zGxutGRbZI2W/6hiAvo32TjgQ7hYo9nkj51p69JIRZzUcQDwSOU9yc8/Qi1IjlEKK5zpGN7THwHe8USV7ez2GLC1+IoXmO9O32Nw/aoO4FVhPEao+zkM8CkgDrjbB0m7nRsC52tgt2fiEv0tBJlrs67Jv7WOdsFAX07UexydQqxjXfJc3WIhDuN8f0Ce8Qp2Ja45HlaiPle4Y7vr5lj7Tcugc5wdR9wp69Mvync8X0dyWs3PGQt7BT9w3iN99xEFgQ9SUO9ts4L2M4Rh0x5nUgM8Vr5Z9fehWYn2fLlYd5aujrV9Lmt+MrZ8kKFADwQPET5EJc8V4tWAW3lMVbLAGzPueR5nqvbFdHvg2i5yJf2BGYS8Blij2FG2Mfkh92ElYscGCVyRba4gDxjhb2fielBUrvM2erFzWKE+B/tXUR7/xX5Yrurs4a+ncwkNEKDGBAwnn+Ib117E7FNsuVQyjhz6V8OfRsmhoprGV+jOMLEdhQtxGrRAIdZuKs59eVaaK9Q7HYPD5fQt56i3nigOpHiTzfu+Y/3GkUu9/mIzd+bOalDNN+InoHiYGCNzeRGc3Tc1cy2doo+tDfb2RaFGM8Trk6NaINtDmXN4S7aasdEe/sRQ4PFeh/YKrrTXpXzQi+4cfVCFAfgDWfvgvDs0+crsb0k6g1Ph3/1S9xs4iR9z9l5mGvvYrHZhZYgfhXb2MVdaSfL3kP/UkK8E/Je8CZj70nmfrAJ/fLCbW/aG8tYDzdxrNWEkC60k+2O7/X2KIyXWuTE473GTHHAsIHk+3z3+uJr5rjJr+gzcPVZfAqgjDjbT5x6lLbasFDnUedo/EekMOm+P0NFBu2khvzjpPOpM5C23RNPRCJ7tLGZuqliuTjiwlO0I3NqyLEOEmeIdr4/5rczxZnOHk/7gyA9Sj/OxRaZr26U9xaDjb1X7F15My8mtd4IY7toHZuZv95Ct2eHt7VYsLcRiYTGHS4cXB+byb+eMO5goasD4B1E1Idx60SCbbfh/mkdRJJIhqHiFjHG3ZfHZ2uRJs4W3Y39LJElBoo4kSCuEidgP11cJ/LFlWKkuEzkw6WmrUzo6/qQTHkH03e+/73/znJ/M04mB8UropNvm8WcLSaKhSzo/aI39pPEBDFZ/FsUilJxs5gvuop46k0S14sTREsxR5xEO/8UBeISMVq8glhGiStErunTBha9WORTli+KKC9HGOV8f+1vKxCeOawWS5vIMlFp3vp6YXQXw8Q8FqiCxVvKQvYQqWKVuJMdf5PIRhBTRS8WfgJ1C0QfvMezZpcniU5iOOJ7UzyIQNqJNNOvNfbfvsxfEdHE4ssxvBDHaJGDINaJ1eL/LHQK9w1HQOfgHVaKaeIdcSr3XIotV4wRlWKTWCCuERniNhbyIvGkGIJAcsScKILINd6i6HfHgeeIreixFUdHcS27eLy4AVEsY/F6EOfnw0xEcgb17xSpxu1PxnN0ou6LeJEkcS7eZQphbK2YLmZFQojpVw0ho5zv0cXB78bE8ceII108zMKPEStEAWWVYgQJ6FjxhBjMTn9dPCLeFl1pa6S4XYzlewvE1JbvA0QhISWF9rrhTUY4caxxn8kIJeqFh7kltqLHXiC9xQLCwnKRz8KNx362eF7cSNi4TwwjT3iIhDQBMY3Es6QgjjKRZBLfcWIUAntG3MPJKE1M9+IgpOSa0JFsPEnfSJ5BG/mx1TzGF4tfRUK6BNdfLAqxX0youUv0IzeZSq6ymFNKHKKYQFkfxDFLJNJOX9q/msW8AbEVIJQS06di4zGKzLG1GCQYxAOxlfwDLtz9cySbZ4qzyB0KzT3tRBELPAIuEdnUby2eFkMIE10QTIlINCJ8XKSTf2RQNx1vFfsvqrErdsWuP8n1GzoJaRomxDB7AAAAAElFTkSuQmCC";
const ExHentai = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAACXBIWXMAAAsTAAALEwEAmpwYAAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuYjBmOGJlOSwgMjAyMS8xMi8wOC0xOToxMToyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpwaG90b3Nob3A9Imh0dHA6Ly9ucy5hZG9iZS5jb20vcGhvdG9zaG9wLzEuMC8iIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIzLjIgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjItMTEtMTdUMTc6MDM6MDUrMDg6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmYxYmIyYjJhLWMzMDUtNGQ0Yi05ZjE2LWI4NTI4ZGVjNjhiYyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpmMWJiMmIyYS1jMzA1LTRkNGItOWYxNi1iODUyOGRlYzY4YmMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpmMWJiMmIyYS1jMzA1LTRkNGItOWYxNi1iODUyOGRlYzY4YmMiIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmYxYmIyYjJhLWMzMDUtNGQ0Yi05ZjE2LWI4NTI4ZGVjNjhiYyIgc3RFdnQ6d2hlbj0iMjAyMi0xMS0xN1QxNzowMzowNSswODowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDIzLjIgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ps76qPkAAAToSURBVFiF7VhbbxtFFD5zW6/vdmJbtuNUBKESmYSoIgghISJagRCCX8Qv4P/0ARXlBSEhpEqobfAD4qFJnDgkTh3Hji+7M7M8TDyeXW9sp01KH3Ke7N0z3/n2zLnNIM/z4F0S/H8TCModoVlyR2iWUP3rxw8fAECv3VZ/PSmlEOB5gTSMpdOrD7c2fvhu9asvY5m0+ap31v7719+ePf659mTbGQwAwLLt6jePNr7/9qOvH7GoDQBuf/DXL9sBHQD46WVNgbzDHnq1XwcAKcT0BU6v/2q/3m+fexOanpTDi173pHnWOFJPegDdk+bwoielVE9kmE44oZlU5hLPC+CofZ+uE07IikUBwOn19RNMKWEUIWQuiKXTC8uVaDqFCAlgIYQwpcy2MSHKJCaE2TamY5BQnXBChDEAAOgrpXSpmK2UU4UCtZi5wIrHK+vVTKk40vdzwpgwSiOW+jAasQijCOPpOuGETDdiSrOV8sqnm5X1qhWP+xZYLFUoZCtlwijcgoxBvVHcAQDCKFUoVNar97e+iKV9uQ0IEcYIo6EeuklCpmCMI/FYIp9bvLcccPhti+GhQC4ghAl5y2zALIwIIV9CeZ7kXHJ+XcTAh+kQVn9Dw9yUqR6iFNPrRC5CquRoKDPJ1ZPJQhCwSw00X71R5cuT8k13bVapDNgNd4Au8Kd7+yrLEMYquVRBEy7njnOJixC1LMKoYo8wxqNvMBuFaqLOYBBoJgExPGR4wpPe+fFx/UUNAFQdYnYkUy5ll8qRRGLY7bYODlv1A+64AEAtlq0sZZfKgBCmhDCmN1rjYEppJAIAfDisv6idHx970pu06yNklnDJeat+CPD0dHdPVepoJr2y+QlhLIXQ+fFJ/dnOP7//4VxcKMYffP4ZYSy+kKWWRSOWJqRxWvW6wpdCnDWOWvVDnS5Xtg6TqRSi3TjqnDQRvky9VKFg2dHF95btZKLbbB7s1GpPttXwFEuno8mkeoUpJYyRkQ2NU3++Y4BLybkOrCs9FAguKYQZjM2Xu2eNxqDTFY476HTPGg09Pzi9vnolhcCEEEJ9zvbjTErA7js8oAXqASYEU2puWaZUspMJYjE7mciUSplSUW+ZenWZgIL7+jQhmFJMzHjwbdmVdchsrpPjRzSTXlqrJnI5KxZL5HJLa9V+p6ODWr0ijEnOheuKkTGNkykVA0HdbhwpTp4//+cdP1Tapwr5SDyeKuQrG2vxxayZ9qlCHhDijsOHzjiDRjj3Hnys037vz+cATzsnTWUxEGHzjh9mYaQWs5PJ/PsrgcI46HQlF8J1NSGNs/pwSxdGyfnp7h7CaNIuvN74QTAmjKmR1xSEsSelJ6WuwhonUyqqJzGARD4XicfwFR3p9scPhAKlDxMCRqoHk8lY+Mbjh+cpS2Ynl5y7g4EOFCmEOxhIzs2JwLRr9K/AIfU1xo+RAR9JKYXL+dBRf/nQES73ruisMMNDQkxZeUsy7/gxFmPID45QN0to+vgxXjA6BiULeWr5jlQ3TGj6+KFFHRQBNmPZ7O0SEq47JiREq37QPvo39CgtOc9WKsXV+5Nw84TwpE44IfNUf0krLO2n3X7MkeShOibIOG4wIXji/uDaMqsMhuqYMvbQwnIF5rtBu/L2w2gU+nYs0ChwmI7vA+b57Lcp6O4mf4bcEZold4RmyX/ZNBBgOWF93AAAAABJRU5ErkJggg==";
const Bakabase = "/assets/bakabase-WV9_LjRj.png";
const EnhancerIcon = ({ id: id2 }) => {
  switch (id2) {
    case EnhancerId.Bakabase:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: Bakabase });
    case EnhancerId.ExHentai:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: ExHentai });
    case EnhancerId.Bangumi:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: Bangumi });
    case EnhancerId.DLsite:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("img", { alt: "", className: "max-h-[16px]", height: 16, src: DLsite });
    case EnhancerId.Regex:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" });
    case EnhancerId.Kodi:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(SiKodi, { className: "text-base" });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$6, { className: "text-base" });
};
EnhancerIcon.displayName = "EnhancerIcon";
buildLogger("TargetNotSetupTip");
const BriefEnhancer = ({ enhancer }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: enhancer.id }),
    enhancer.name,
    enhancer.id == EnhancerId.Kodi && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
    enhancer.id == EnhancerId.Tmdb && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
    enhancer.id == EnhancerId.Av && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
  ] });
};
BriefEnhancer.displayName = "BriefEnhancer";
const extractCaptureGroups = (expressions) => expressions.reduce((s2, t2) => {
  s2.push(...findCapturingGroupsInRegex(t2));
  return s2;
}, []);
function EnhancerOptionsModal({
  enhancer,
  options: propsOptions,
  onSubmit,
  onDestroyed
}) {
  var _a2, _b2, _c2, _d;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const navigate = useNavigate();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [allEnhancers, setAllEnhancers] = reactExports.useState([]);
  const init2 = async () => {
    await Promise.all([loadAllProperties(), loadEnhancers()]);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const loadAllProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const loadEnhancers = async () => {
    const r2 = await BApi$1.enhancer.getAllEnhancerDescriptors();
    setAllEnhancers(r2.data || []);
  };
  const renderKeywordProperty = () => {
    var _a3, _b3;
    if (!enhancer.tags.includes(EnhancerTag.UseKeyword)) {
      return null;
    }
    if (!options.keywordProperty) {
      options.keywordProperty = {
        pool: PropertyPool.Internal,
        id: InternalProperty.Filename,
        scope: PropertyValueScope.Synchronization
      };
    }
    const currentProperty = (_a3 = propertyMap == null ? void 0 : propertyMap[options.keywordProperty.pool]) == null ? void 0 : _a3[options.keywordProperty.id];
    const keywordPropertyScope = (_b3 = options.keywordProperty) == null ? void 0 : _b3.scope;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: " w-[300px]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-small", children: t2("enhancer.options.keywordProperty.label") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
              "enhancer.options.keywordProperty.description"
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
              "enhancer.options.keywordProperty.tip"
            ) })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(PropertySelector, {
                v2: true,
                pool: PropertyPool.All,
                multiple: false,
                isDisabled: (p2) => p2.pool == PropertyPool.Internal && p2.id != InternalProperty.Filename,
                onSubmit: async (selection) => {
                  const p2 = selection[0];
                  if (p2) {
                    setOptions2({
                      ...options,
                      keywordProperty: { pool: p2.pool, id: p2.id, scope: PropertyValueScope.Manual }
                    });
                  }
                  return Promise.resolve();
                }
              });
            },
            children: currentProperty ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: currentProperty }) : t2("enhancer.options.selectProperty.action")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            className: "w-auto",
            dataSource: propertyValueScopes.map((e2) => ({
              label: `${t2(`PropertyValueScope.${e2.label}`)}`,
              value: e2.value.toString()
            })),
            description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "enhancer.options.propertyValueScope.description"
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.options.propertyValueScope.tip") })
            ] }),
            label: t2("enhancer.options.propertyValueScope.label"),
            selectedKeys: keywordPropertyScope == void 0 ? [] : [keywordPropertyScope.toString()],
            size: "sm",
            onSelectionChange: (keys2) => {
              const arr = Array.from(keys2);
              const vals = arr.map((o2) => parseInt(o2, 10));
              const selected = vals[0];
              if (selected === PropertyValueScope.Manual) {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("enhancer.options.manualScope.title"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "enhancer.options.manualScope.description"
                  ) }),
                  footer: {
                    actions: ["cancel"],
                    cancelProps: {
                      children: t2("enhancer.options.manualScope.confirm")
                    }
                  }
                });
              }
              setOptions2({
                ...options,
                keywordProperty: { ...options.keywordProperty, scope: vals[0] }
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: " w-[300px]", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-small", children: t2("enhancer.options.pretreat.label") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.options.pretreat.description") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              t2(
                "enhancer.options.pretreat.tip"
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("common.tip.leavePageWarning"),
                      children: t2("common.confirm.short"),
                      onOk: async () => {
                        navigate("/text");
                      }
                    });
                  },
                  children: t2("enhancer.options.pretreat.action")
                }
              )
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: options.pretreatKeyword ?? false,
            size: "sm",
            onValueChange: (v2) => {
              setOptions2({ ...options, pretreatKeyword: v2 });
            }
          }
        )
      ] })
    ] });
  };
  const renderBangumiPrioritySubjectType = () => {
    if (enhancer.id !== EnhancerId.Bangumi) {
      return null;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        isClearable: true,
        dataSource: bangumiSubjectTypes.map((e2) => ({
          label: t2(`BangumiSubjectType.${e2.label}`),
          value: e2.value.toString()
        })),
        description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.bangumi.prioritySubjectType.description") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.bangumi.prioritySubjectType.hint") })
        ] }),
        label: t2("enhancer.bangumi.prioritySubjectType.label"),
        selectedKeys: options.bangumiPrioritySubjectType != null ? [options.bangumiPrioritySubjectType.toString()] : [],
        size: "sm",
        onSelectionChange: (keys2) => {
          const arr = Array.from(keys2);
          if (arr.length === 0) {
            setOptions2({ ...options, bangumiPrioritySubjectType: void 0 });
          } else {
            const val = parseInt(arr[0], 10);
            setOptions2({ ...options, bangumiPrioritySubjectType: val });
          }
        }
      }
    );
  };
  const expressions = (options == null ? void 0 : options.expressions) || [];
  const captureGroups = extractCaptureGroups(expressions);
  const prerequisiteEnhancers = (_a2 = options.requirements) == null ? void 0 : _a2.map((r2) => r2.toString());
  let candidateTargetsMap = {};
  if (enhancer.id == EnhancerId.Regex) {
    candidateTargetsMap[RegexEnhancerTarget.CaptureGroups] = captureGroups;
  }
  const hasDynamicTargets = (_b2 = enhancer.targets) == null ? void 0 : _b2.some((t22) => t22.isDynamic);
  const hasFixedTargets = (_c2 = enhancer.targets) == null ? void 0 : _c2.some((t22) => !t22.isDynamic);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"]
      },
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
        t2("enhancer.options.configure.title"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer })
      ] }),
      onDestroyed,
      onOk: async () => {
        await (onSubmit == null ? void 0 : onSubmit(options));
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              isClearable: true,
              dataSource: allEnhancers.map((e2) => ({ label: e2.name, value: e2.id.toString() })),
              description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.options.runAfter.description"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.options.runAfter.tip") })
              ] }),
              label: t2("enhancer.options.runAfter.label"),
              selectedKeys: prerequisiteEnhancers && prerequisiteEnhancers.length > 0 ? prerequisiteEnhancers : void 0,
              selectionMode: "multiple",
              size: "sm",
              onSelectionChange: (keys2) => {
                const arr = Array.from(keys2);
                const vals = arr.map((o2) => parseInt(o2, 10));
                setOptions2({ ...options, requirements: vals });
              }
            }
          ),
          renderKeywordProperty(),
          renderBangumiPrioritySubjectType(),
          enhancer.tags.includes(EnhancerTag.UseRegex) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                captureGroups.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  t2("enhancer.regex.captureGroups.label"),
                  captureGroups.map((g2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: g2 }, g2);
                  })
                ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.regex.captureGroups.warning"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.regex.expressions.description"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.regex.captureGroups.mergeDescription"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.regex.expressions.categoryTip"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "enhancer.regex.expressions.namingTip"
                ) })
              ] }),
              label: t2("enhancer.regex.expressions.label"),
              maxRows: 10,
              minRows: 3,
              value: (_d = options == null ? void 0 : options.expressions) == null ? void 0 : _d.join("\n"),
              onValueChange: (v2) => {
                setOptions2({ ...options, expressions: v2.split("\n") });
              }
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base", children: [
            t2("enhancer.options.enhanceProperties.label"),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.options.enhanceProperties.tip") }) })
          ] }),
          options && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-4", children: [
            hasFixedTargets && /* @__PURE__ */ jsxRuntimeExports.jsx(
              FixedTargets,
              {
                enhancer,
                optionsList: options.targetOptions,
                propertyMap,
                onChange: (list2) => {
                  setOptions2({
                    ...options,
                    targetOptions: list2
                  });
                },
                onPropertyChanged: loadAllProperties
              }
            ),
            hasDynamicTargets && /* @__PURE__ */ jsxRuntimeExports.jsx(
              DynamicTargets,
              {
                candidateTargetsMap,
                enhancer,
                optionsList: options.targetOptions,
                propertyMap,
                onChange: (list2) => {
                  setOptions2({
                    ...options,
                    targetOptions: list2
                  });
                },
                onPropertyChanged: loadAllProperties
              }
            )
          ] })
        ] })
      ]
    }
  );
}
const TermChip = ({
  className,
  size: size2 = "sm",
  variant = "light",
  color: color2 = "success",
  label,
  description
}) => {
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
    Chip,
    {
      className: "cursor-pointer !px-0 !py-0 !h-auto !min-h-0",
      color: color2,
      size: size2,
      variant,
      classNames: {
        content: "!px-0"
      },
      children: label
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      placement: "bottom",
      trigger: chip2,
      classNames: {
        trigger: `inline-flex items-center ${className || ""}`
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 max-w-xs", children: description })
    }
  );
};
TermChip.displayName = "TermChip";
const ResourceDescription = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.resource.description") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.resource.usage") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-small text-warning-500", children: t2("term.resource.tip") })
  ] });
};
ResourceDescription.displayName = "ResourceDescription";
const ResourceTerm = ({
  className,
  size: size2 = "sm",
  variant = "light",
  color: color2 = "success"
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    TermChip,
    {
      className,
      color: color2,
      description: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceDescription, {}),
      label: t2("common.label.resource"),
      size: size2,
      variant
    }
  );
};
ResourceTerm.displayName = "ResourceTerm";
const PropertyDescription = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.property.description") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.property.usage") })
  ] });
};
PropertyDescription.displayName = "PropertyDescription";
const PropertyTerm = ({
  className,
  size: size2 = "sm",
  variant = "light",
  color: color2 = "primary"
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    TermChip,
    {
      className,
      color: color2,
      description: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyDescription, {}),
      label: t2("common.label.property"),
      size: size2,
      variant
    }
  );
};
PropertyTerm.displayName = "PropertyTerm";
const MediaLibraryDescription = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.mediaLibrary.description") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.mediaLibrary.usage") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-secondary text-xs pt-1 border-t border-default-200", children: t2("term.mediaLibrary.suggestion") })
  ] });
};
MediaLibraryDescription.displayName = "MediaLibraryDescription";
const MediaLibraryTerm = ({
  className,
  size: size2 = "sm",
  variant = "light",
  color: color2 = "secondary"
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    TermChip,
    {
      className,
      color: color2,
      description: /* @__PURE__ */ jsxRuntimeExports.jsx(MediaLibraryDescription, {}),
      label: t2("common.label.mediaLibrary"),
      size: size2,
      variant
    }
  );
};
MediaLibraryTerm.displayName = "MediaLibraryTerm";
const EnhancerDescription = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("term.enhancer.description") }) });
};
EnhancerDescription.displayName = "EnhancerDescription";
const ConfigureEnhancerButton = ({
  enhancer,
  onConfigure,
  getProfiles
}) => {
  const { t: t2 } = useTranslation();
  const [profiles, setProfiles] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const [isOpen, setIsOpen] = reactExports.useState(false);
  const handleClick = async () => {
    setLoading(true);
    try {
      const profilesWithEnhancer = await getProfiles(enhancer);
      if (profilesWithEnhancer.length === 0) {
        toast.default(t2("enhancer.records.noProfilesFound.warning"));
        return;
      }
      if (profilesWithEnhancer.length === 1) {
        onConfigure(profilesWithEnhancer[0], enhancer);
        return;
      }
      setProfiles(profilesWithEnhancer);
      setIsOpen(true);
    } finally {
      setLoading(false);
    }
  };
  if (profiles.length > 1 && isOpen) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PopoverComponent,
      {
        isOpen,
        onOpenChange: setIsOpen,
        placement: "bottom",
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            isLoading: loading,
            onClick: handleClick,
            children: t2("enhancer.records.configure.action")
          }
        ),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          listbox_default,
          {
            "aria-label": t2("enhancer.records.selectProfile.label"),
            onAction: (key) => {
              const profile = profiles.find((p2) => p2.id === Number(key));
              if (profile) {
                onConfigure(profile, enhancer);
                setIsOpen(false);
              }
            },
            children: profiles.map((profile) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: profile.name }, profile.id))
          }
        )
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "primary",
      size: "sm",
      variant: "light",
      isLoading: loading,
      onClick: handleClick,
      children: t2("enhancer.records.configure.action")
    }
  );
};
const EmptyState = ({ type: type4, enhancerName, onConfigureClick, onNavigateToProfiles }) => {
  const { t: t2 } = useTranslation();
  if (type4 === "no-profile") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-12 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-default-500", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg font-semibold mb-2", children: t2("enhancer.records.noProfiles.title") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2(
          "enhancer.records.noProfiles.description",
          { enhancerName }
        ) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "flat",
          onClick: onNavigateToProfiles,
          children: t2("enhancer.records.goToProfiles.action")
        }
      )
    ] });
  }
  if (type4 === "no-enhancements") {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-12 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-default-500", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg font-semibold mb-2", children: t2("enhancer.records.noData.title") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2(
          "enhancer.records.noData.description"
        ) })
      ] }),
      onConfigureClick && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "flat",
          onClick: onConfigureClick,
          children: t2("enhancer.records.enhanceNow.action")
        }
      )
    ] });
  }
  return null;
};
function ResourceEnhancementsModal({ resourceId, ...props }) {
  const [enhancerTabs, setEnhancerTabs] = reactExports.useState([]);
  const [resource, setResource] = reactExports.useState({
    path: "",
    categoryId: 0
  });
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { createPortal } = useBakabaseContext();
  const [enhancing, setEnhancing] = reactExports.useState(false);
  const [applyingContext, setApplyingContext] = reactExports.useState(false);
  reactExports.useEffect(() => {
    loadEnhancements();
    BApi$1.resource.getResourcesByKeys({ ids: [resourceId] }).then((r2) => {
      var _a2, _b2;
      const data = r2.data || [];
      setResource({
        path: ((_a2 = data[0]) == null ? void 0 : _a2.path) || "",
        categoryId: ((_b2 = data[0]) == null ? void 0 : _b2.categoryId) ?? 0
      });
    });
  }, []);
  const loadEnhancements = reactExports.useCallback(async () => {
    var _a2, _b2;
    const enhancementsResponse = await BApi$1.resource.getResourceEnhancements(resourceId, {
      additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
    });
    const enhancementsData = enhancementsResponse.data || [];
    const enhancerMap = /* @__PURE__ */ new Map();
    for (const d2 of enhancementsData) {
      (_a2 = d2.dynamicTargets) == null ? void 0 : _a2.forEach((dt) => {
        var _a3;
        (_a3 = dt.enhancements) == null ? void 0 : _a3.forEach((e2) => {
          e2.value = convertFromApiValue(e2.value, e2.valueType);
          const v2 = e2.customPropertyValue;
          const p2 = e2.property;
          if (p2 && v2) {
            v2.value = convertFromApiValue(v2.value, p2.dbValueType);
            v2.bizValue = convertFromApiValue(v2.bizValue, p2.bizValueType);
          }
        });
      });
      enhancerMap.set(d2.enhancer.id, d2.enhancer);
    }
    const profilesResponse = await BApi$1.resourceProfile.getMatchingProfilesForResource(resourceId);
    const allProfiles = profilesResponse.data || [];
    const profilesByEnhancerId = /* @__PURE__ */ new Map();
    for (const profile of allProfiles) {
      const enhancers = ((_b2 = profile.enhancerOptions) == null ? void 0 : _b2.enhancers) || [];
      for (const enhancerOption of enhancers) {
        const enhancerId = enhancerOption.enhancerId;
        if (!enhancerId)
          continue;
        if (!profilesByEnhancerId.has(enhancerId)) {
          profilesByEnhancerId.set(enhancerId, []);
        }
        profilesByEnhancerId.get(enhancerId).push(profile);
      }
    }
    const tabsData = Array.from(enhancerMap.values()).map((enhancer) => ({
      enhancer,
      profiles: profilesByEnhancerId.get(enhancer.id) || [],
      // @ts-ignore - API type is compatible but TS doesn't recognize it
      enhancement: enhancementsData.find((e2) => e2.enhancer.id === enhancer.id)
    }));
    setEnhancerTabs(tabsData);
  }, []);
  const openEnhancerOptionsForProfile = (profile, enhancer) => {
    var _a2, _b2;
    const enhancerOption = (_b2 = (_a2 = profile.enhancerOptions) == null ? void 0 : _a2.enhancers) == null ? void 0 : _b2.find(
      (opt) => opt.enhancerId === enhancer.id
    );
    createPortal(EnhancerOptionsModal, {
      enhancer,
      options: enhancerOption ? {
        targetOptions: enhancerOption.targetOptions,
        expressions: enhancerOption.expressions ?? void 0,
        requirements: enhancerOption.requirements ?? void 0,
        keywordProperty: enhancerOption.keywordProperty,
        pretreatKeyword: enhancerOption.pretreatKeyword ?? void 0
      } : void 0,
      onSubmit: async (options) => {
        var _a3;
        const updatedEnhancers = (((_a3 = profile.enhancerOptions) == null ? void 0 : _a3.enhancers) || []).map(
          (opt) => opt.enhancerId === enhancer.id ? {
            enhancerId: enhancer.id,
            targetOptions: options.targetOptions,
            expressions: options.expressions,
            requirements: options.requirements,
            keywordProperty: options.keywordProperty,
            pretreatKeyword: options.pretreatKeyword
          } : opt
        );
        const updatedProfile = {
          ...profile,
          enhancerOptions: { enhancers: updatedEnhancers }
        };
        const inputModel = {
          name: updatedProfile.name ?? "",
          search: updatedProfile.search,
          nameTemplate: updatedProfile.nameTemplate,
          enhancerOptions: updatedProfile.enhancerOptions,
          playableFileOptions: updatedProfile.playableFileOptions,
          playerOptions: updatedProfile.playerOptions,
          propertyOptions: updatedProfile.propertyOptions,
          priority: updatedProfile.priority ?? 0
        };
        await BApi$1.resourceProfile.updateResourceProfile(profile.id, inputModel);
        toast.success(t2("enhancer.records.configUpdated.label"));
        loadEnhancements();
      }
    });
  };
  const getProfilesForEnhancer = async (enhancer) => {
    const profilesResponse = await BApi$1.resourceProfile.getMatchingProfilesForResource(resourceId);
    const profiles = profilesResponse.data || [];
    const profilesWithEnhancer = profiles.filter(
      (profile) => {
        var _a2, _b2;
        return (_b2 = (_a2 = profile.enhancerOptions) == null ? void 0 : _a2.enhancers) == null ? void 0 : _b2.some((opt) => opt.enhancerId === enhancer.id);
      }
    );
    return profilesWithEnhancer;
  };
  console.log(enhancerTabs);
  const renderConvertedValue = (e2) => {
    if (!e2 || e2.propertyPool == void 0 || e2.propertyId == void 0 || e2.property == void 0) {
      return;
    }
    const { property: property2 } = e2;
    switch (e2.propertyPool) {
      case PropertyPool.Reserved: {
        const rv = e2.reservedPropertyValue;
        if (!rv) {
          return;
        }
        let bizRv;
        let dbRv;
        switch (e2.propertyId) {
          case ResourceProperty.Introduction:
            bizRv = rv.introduction;
            dbRv = rv.introduction;
            break;
          case ResourceProperty.Rating:
            bizRv = rv.rating;
            dbRv = rv.rating;
            break;
          case ResourceProperty.Cover:
            bizRv = rv.coverPaths;
            dbRv = rv.coverPaths;
            break;
          case ResourceProperty.PlayedAt:
            bizRv = new dayjs_minExports.Dayjs(rv.playedAt);
            dbRv = new dayjs_minExports.Dayjs(rv.playedAt);
            break;
          default:
            return t2("enhancer.records.unsupportedReservedType.error", {
              type: e2.propertyId
            });
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue: serializeStandardValue(bizRv, property2.bizValueType),
            dbValue: serializeStandardValue(dbRv, property2.dbValueType),
            property: property2,
            variant: "light"
          }
        );
      }
      case PropertyPool.Custom: {
        const pv = e2.customPropertyValue;
        if (!pv) {
          return;
        }
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          PropertyValueRenderer,
          {
            bizValue: serializeStandardValue(pv.bizValue, property2.bizValueType),
            dbValue: serializeStandardValue(pv.value, property2.dbValueType),
            property: property2,
            variant: "light"
          }
        );
      }
      case PropertyPool.Internal:
      case PropertyPool.All:
        return t2("enhancer.records.unsupportedPropertyType.error", {
          type: e2.propertyPool
        });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          children: t2("common.action.close")
        }
      },
      size: "7xl",
      title: t2("enhancer.records.title"),
      onDestroyed: props.onDestroyed,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("enhancer.records.resourcePath.label") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { size: "sm", symbol: "", children: resource.path })
        ] }),
        enhancerTabs.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-16 gap-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-default-100 dark:bg-default-50 p-4 rounded-lg max-w-2xl", children: /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerDescription, {}) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-default-500", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg font-semibold mb-2", children: t2("enhancer.records.noEnhancers.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2(
              "enhancer.records.noEnhancers.description"
            ) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              variant: "flat",
              onClick: () => navigate("/resource-profile"),
              children: t2("enhancer.records.goToProfiles.action")
            }
          )
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tabs,
          {
            isVertical: true,
            "aria-label": "Enhancers",
            classNames: {
              panel: "grow min-w-0"
            },
            variant: "bordered",
            children: enhancerTabs.map((tabData) => {
              var _a2;
              const { enhancer, profiles, enhancement } = tabData;
              const hasProfiles = profiles.length > 0;
              const targets = (enhancement == null ? void 0 : enhancement.targets) || [];
              const hasEnhancementData = (enhancement == null ? void 0 : enhancement.contextCreatedAt) || targets.some((x2) => x2.enhancement) || (enhancement == null ? void 0 : enhancement.dynamicTargets) && enhancement.dynamicTargets.some((dt) => dt.enhancements && dt.enhancements.length > 0);
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: enhancer.name, children: !hasEnhancementData ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                EmptyState,
                {
                  type: "no-enhancements",
                  enhancerName: enhancer.name,
                  onConfigureClick: () => {
                    setEnhancing(true);
                    BApi$1.resource.enhanceResourceByEnhancer(resourceId, enhancer.id).then(() => {
                      loadEnhancements();
                      setEnhancing(false);
                    });
                  },
                  onNavigateToProfiles: () => navigate("/resource-profiles")
                }
              ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                !hasProfiles && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4 p-4 bg-warning-50 dark:bg-warning-900/20 rounded-lg border border-warning-200 dark:border-warning-800", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-warning-600 dark:text-warning-400 text-lg mt-0.5" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning-800 dark:text-warning-300 font-semibold mb-1", children: t2("enhancer.records.notConfigured.title") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning-700 dark:text-warning-400 text-sm", children: t2(
                      "enhancer.records.notConfigured.description"
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        className: "mt-2",
                        color: "warning",
                        size: "sm",
                        variant: "flat",
                        onClick: () => navigate("/resource-profiles"),
                        children: t2("enhancer.records.goToProfiles.action")
                      }
                    )
                  ] })
                ] }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "secondary",
                          radius: "sm",
                          variant: "light",
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            t2("enhancer.records.dataCreatedAt.label"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              Tooltip$1,
                              {
                                className: "max-w-[500px]",
                                color: "secondary",
                                content: t2(
                                  "enhancer.records.dataCreatedAt.tip"
                                ),
                                placement: "top",
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
                              }
                            )
                          ] })
                        }
                      ),
                      (enhancement == null ? void 0 : enhancement.contextCreatedAt) ?? t2("common.label.none")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "secondary",
                          radius: "sm",
                          variant: "light",
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            t2("enhancer.records.dataAppliedAt.label"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              Tooltip$1,
                              {
                                className: "max-w-[500px]",
                                color: "secondary",
                                content: t2(
                                  "enhancer.records.dataAppliedAt.tip"
                                ),
                                placement: "top",
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
                              }
                            )
                          ] })
                        }
                      ),
                      (enhancement == null ? void 0 : enhancement.contextAppliedAt) ?? t2("common.label.none")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        className: "max-w-[500px]",
                        color: "secondary",
                        content: t2(
                          "enhancer.records.enhanceProcess.tip"
                        ),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          Button,
                          {
                            color: (enhancement == null ? void 0 : enhancement.status) == EnhancementRecordStatus.ContextApplied || (enhancement == null ? void 0 : enhancement.status) == EnhancementRecordStatus.ContextCreated ? "warning" : "primary",
                            isLoading: enhancing,
                            size: "sm",
                            variant: "light",
                            onClick: () => {
                              setEnhancing(true);
                              BApi$1.resource.enhanceResourceByEnhancer(resourceId, enhancer.id).then(() => {
                                loadEnhancements();
                                setEnhancing(false);
                              });
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, { className: "text-base" }),
                              t2(
                                (enhancement == null ? void 0 : enhancement.status) == EnhancementRecordStatus.ContextApplied ? "enhancer.records.reEnhance.action" : "enhancer.records.enhanceNow.action"
                              )
                            ]
                          }
                        )
                      }
                    ),
                    ((enhancement == null ? void 0 : enhancement.status) == EnhancementRecordStatus.ContextApplied || (enhancement == null ? void 0 : enhancement.status) == EnhancementRecordStatus.ContextCreated) && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2("enhancer.records.applyData.tip"),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                          Button,
                          {
                            color: "primary",
                            isLoading: applyingContext,
                            size: "sm",
                            variant: "light",
                            onClick: () => {
                              setApplyingContext(true);
                              BApi$1.resource.applyEnhancementContextDataForResourceByEnhancer(
                                resourceId,
                                enhancer.id
                              ).then(() => {
                                loadEnhancements();
                                setApplyingContext(false);
                              });
                            },
                            children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$16, { className: "text-base" }),
                              t2("enhancer.records.applyData.action")
                            ]
                          }
                        )
                      }
                    )
                  ] }),
                  hasProfiles && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    ConfigureEnhancerButton,
                    {
                      enhancer,
                      onConfigure: openEnhancerOptionsForProfile,
                      getProfiles: getProfilesForEnhancer
                    }
                  ) })
                ] }),
                (enhancement == null ? void 0 : enhancement.errorMessage) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4 p-4 bg-danger-50 dark:bg-danger-900/20 rounded-lg border border-danger-200 dark:border-danger-800", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-danger-600 dark:text-danger-400 text-lg mt-0.5" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-danger-800 dark:text-danger-300 font-semibold mb-1", children: t2("enhancer.records.error.title") }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-danger-700 dark:text-danger-400 text-sm whitespace-pre-wrap", children: enhancement.errorMessage })
                  ] })
                ] }) }),
                (enhancement == null ? void 0 : enhancement.logs) && enhancement.logs.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_default, { className: "mb-4", variant: "bordered", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  accordion_item_base_default,
                  {
                    "aria-label": t2("enhancer.logs.title"),
                    title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("enhancer.logs.title") }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: enhancement.logs.length })
                    ] }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[400px] overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, "aria-label": t2("enhancer.logs.title"), children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 160, children: t2("enhancer.logs.timestamp.label") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 80, children: t2("enhancer.logs.level.label") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 120, children: t2("enhancer.logs.event.label") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.message") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("enhancer.logs.data.label") })
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: enhancement.logs.map((log3, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: new Date(log3.timestamp).toLocaleString() }) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Chip,
                          {
                            size: "sm",
                            color: log3.level === "Error" ? "danger" : log3.level === "Warning" ? "warning" : "primary",
                            variant: "flat",
                            children: log3.level
                          }
                        ) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: log3.event }) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: log3.message }) }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: log3.data && /* @__PURE__ */ jsxRuntimeExports.jsx(
                          PopoverComponent,
                          {
                            placement: "left",
                            trigger: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-primary cursor-pointer underline", children: t2("enhancer.logs.viewData.action") }),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2", children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                Button,
                                {
                                  size: "sm",
                                  variant: "light",
                                  onClick: () => {
                                    navigator.clipboard.writeText(JSON.stringify(log3.data, null, 2));
                                    toast.success(t2("enhancer.logs.copiedToClipboard.label"));
                                  },
                                  children: t2("common.action.copy")
                                }
                              ) }),
                              /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-xs max-w-[400px] max-h-[300px] overflow-auto whitespace-pre-wrap bg-default-100 p-2 rounded", children: JSON.stringify(log3.data, null, 2) })
                            ] })
                          }
                        ) })
                      ] }, index2)) })
                    ] }) })
                  },
                  "logs"
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-2 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                    targets.every((x2) => !x2.enhancement) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "opacity-60", radius: "sm", size: "sm", variant: "light", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-sm mr-1" }),
                      t2(
                        "enhancer.records.noFixedData.warning"
                      )
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, className: "break-all", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("enhancer.target.label") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("enhancer.records.rawData.label") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("enhancer.records.generatedValue.label") })
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: targets.map((e2) => {
                        var _a3;
                        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: e2.targetName }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: JSON.stringify((_a3 = e2.enhancement) == null ? void 0 : _a3.value) }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderConvertedValue(e2.enhancement) })
                        ] });
                      }) })
                    ] })
                  ] }),
                  (_a2 = enhancement == null ? void 0 : enhancement.dynamicTargets) == null ? void 0 : _a2.map((dt) => {
                    var _a3, _b2;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                      (!dt.enhancements || dt.enhancements.length == 0) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "opacity-60", radius: "sm", size: "sm", variant: "light", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-sm mr-1" }),
                        t2(
                          "enhancer.records.noDynamicData.warning"
                        )
                      ] }),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, className: "break-all", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_column_default, { children: [
                            dt.targetName,
                            "(",
                            ((_a3 = dt.enhancements) == null ? void 0 : _a3.length) ?? 0,
                            ")"
                          ] }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("enhancer.records.rawData.label") }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("enhancer.records.generatedValue.label") })
                        ] }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: (_b2 = dt.enhancements) == null ? void 0 : _b2.map((e2) => {
                          return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: e2.dynamicTarget }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: JSON.stringify(e2.value) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderConvertedValue(e2) })
                          ] });
                        }) })
                      ] })
                    ] });
                  })
                ] })
              ] }) }, enhancer.id);
            })
          }
        )
      ]
    }
  );
}
function _objectSpread(e2) {
  for (var r2 = 1; r2 < arguments.length; r2++) {
    var t2 = null != arguments[r2] ? Object(arguments[r2]) : {}, o2 = Object.keys(t2);
    "function" == typeof Object.getOwnPropertySymbols && o2.push.apply(o2, Object.getOwnPropertySymbols(t2).filter(function(e3) {
      return Object.getOwnPropertyDescriptor(t2, e3).enumerable;
    })), o2.forEach(function(r3) {
      _defineProperty$4(e2, r3, t2[r3]);
    });
  }
  return e2;
}
var invariant = function(condition, format2, a2, b2, c2, d2, e2, f2) {
  if (!condition) {
    var error2;
    if (format2 === void 0) {
      error2 = new Error(
        "Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings."
      );
    } else {
      var args = [a2, b2, c2, d2, e2, f2];
      var argIndex = 0;
      error2 = new Error(
        format2.replace(/%s/g, function() {
          return args[argIndex++];
        })
      );
      error2.name = "Invariant Violation";
    }
    error2.framesToPop = 1;
    throw error2;
  }
};
var browser = invariant;
const invariant$1 = /* @__PURE__ */ getDefaultExportFromCjs(browser);
var Manager = function() {
  function Manager2() {
    _classCallCheck$a(this, Manager2);
    _defineProperty$4(this, "refs", {});
  }
  _createClass$8(Manager2, [{
    key: "add",
    value: function add2(collection, ref) {
      if (!this.refs[collection]) {
        this.refs[collection] = [];
      }
      this.refs[collection].push(ref);
    }
  }, {
    key: "remove",
    value: function remove(collection, ref) {
      var index2 = this.getIndex(collection, ref);
      if (index2 !== -1) {
        this.refs[collection].splice(index2, 1);
      }
    }
  }, {
    key: "isActive",
    value: function isActive2() {
      return this.active;
    }
  }, {
    key: "getActive",
    value: function getActive() {
      var _this = this;
      return this.refs[this.active.collection].find(function(_ref) {
        var node2 = _ref.node;
        return node2.sortableInfo.index == _this.active.index;
      });
    }
  }, {
    key: "getIndex",
    value: function getIndex(collection, ref) {
      return this.refs[collection].indexOf(ref);
    }
  }, {
    key: "getOrderedRefs",
    value: function getOrderedRefs() {
      var collection = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.active.collection;
      return this.refs[collection].sort(sortByIndex);
    }
  }]);
  return Manager2;
}();
function sortByIndex(_ref2, _ref3) {
  var index1 = _ref2.node.sortableInfo.index;
  var index2 = _ref3.node.sortableInfo.index;
  return index1 - index2;
}
function omit(obj, keysToOmit) {
  return Object.keys(obj).reduce(function(acc, key) {
    if (keysToOmit.indexOf(key) === -1) {
      acc[key] = obj[key];
    }
    return acc;
  }, {});
}
var events = {
  end: ["touchend", "touchcancel", "mouseup"],
  move: ["touchmove", "mousemove"],
  start: ["touchstart", "mousedown"]
};
var vendorPrefix = function() {
  if (typeof window === "undefined" || typeof document === "undefined") {
    return "";
  }
  var styles2 = window.getComputedStyle(document.documentElement, "") || ["-moz-hidden-iframe"];
  var pre = (Array.prototype.slice.call(styles2).join("").match(/-(moz|webkit|ms)-/) || styles2.OLink === "" && ["", "o"])[1];
  switch (pre) {
    case "ms":
      return "ms";
    default:
      return pre && pre.length ? pre[0].toUpperCase() + pre.substr(1) : "";
  }
}();
function setInlineStyles(node2, styles2) {
  Object.keys(styles2).forEach(function(key) {
    node2.style[key] = styles2[key];
  });
}
function setTranslate3d(node2, translate) {
  node2.style["".concat(vendorPrefix, "Transform")] = translate == null ? "" : "translate3d(".concat(translate.x, "px,").concat(translate.y, "px,0)");
}
function setTransitionDuration(node2, duration2) {
  node2.style["".concat(vendorPrefix, "TransitionDuration")] = duration2 == null ? "" : "".concat(duration2, "ms");
}
function closest(el2, fn) {
  while (el2) {
    if (fn(el2)) {
      return el2;
    }
    el2 = el2.parentNode;
  }
  return null;
}
function limit(min2, max2, value2) {
  return Math.max(min2, Math.min(value2, max2));
}
function getPixelValue(stringValue) {
  if (stringValue.substr(-2) === "px") {
    return parseFloat(stringValue);
  }
  return 0;
}
function getElementMargin(element2) {
  var style2 = window.getComputedStyle(element2);
  return {
    bottom: getPixelValue(style2.marginBottom),
    left: getPixelValue(style2.marginLeft),
    right: getPixelValue(style2.marginRight),
    top: getPixelValue(style2.marginTop)
  };
}
function provideDisplayName(prefix, Component$$1) {
  var componentName = Component$$1.displayName || Component$$1.name;
  return componentName ? "".concat(prefix, "(").concat(componentName, ")") : prefix;
}
function getScrollAdjustedBoundingClientRect(node2, scrollDelta) {
  var boundingClientRect = node2.getBoundingClientRect();
  return {
    top: boundingClientRect.top + scrollDelta.top,
    left: boundingClientRect.left + scrollDelta.left
  };
}
function getPosition(event) {
  if (event.touches && event.touches.length) {
    return {
      x: event.touches[0].pageX,
      y: event.touches[0].pageY
    };
  } else if (event.changedTouches && event.changedTouches.length) {
    return {
      x: event.changedTouches[0].pageX,
      y: event.changedTouches[0].pageY
    };
  } else {
    return {
      x: event.pageX,
      y: event.pageY
    };
  }
}
function isTouchEvent(event) {
  return event.touches && event.touches.length || event.changedTouches && event.changedTouches.length;
}
function getEdgeOffset(node2, parent) {
  var offset2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
    left: 0,
    top: 0
  };
  if (!node2) {
    return void 0;
  }
  var nodeOffset = {
    left: offset2.left + node2.offsetLeft,
    top: offset2.top + node2.offsetTop
  };
  if (node2.parentNode === parent) {
    return nodeOffset;
  }
  return getEdgeOffset(node2.parentNode, parent, nodeOffset);
}
function getTargetIndex(newIndex, prevIndex, oldIndex) {
  if (newIndex < oldIndex && newIndex > prevIndex) {
    return newIndex - 1;
  } else if (newIndex > oldIndex && newIndex < prevIndex) {
    return newIndex + 1;
  } else {
    return newIndex;
  }
}
function getLockPixelOffset(_ref) {
  var lockOffset = _ref.lockOffset, width = _ref.width, height = _ref.height;
  var offsetX = lockOffset;
  var offsetY = lockOffset;
  var unit2 = "px";
  if (typeof lockOffset === "string") {
    var match5 = /^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(lockOffset);
    invariant$1(match5 !== null, 'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s', lockOffset);
    offsetX = parseFloat(lockOffset);
    offsetY = parseFloat(lockOffset);
    unit2 = match5[1];
  }
  invariant$1(isFinite(offsetX) && isFinite(offsetY), "lockOffset value should be a finite. Given %s", lockOffset);
  if (unit2 === "%") {
    offsetX = offsetX * width / 100;
    offsetY = offsetY * height / 100;
  }
  return {
    x: offsetX,
    y: offsetY
  };
}
function getLockPixelOffsets(_ref2) {
  var height = _ref2.height, width = _ref2.width, lockOffset = _ref2.lockOffset;
  var offsets = Array.isArray(lockOffset) ? lockOffset : [lockOffset, lockOffset];
  invariant$1(offsets.length === 2, "lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s", lockOffset);
  var _offsets = _slicedToArray(offsets, 2), minLockOffset = _offsets[0], maxLockOffset = _offsets[1];
  return [getLockPixelOffset({
    height,
    lockOffset: minLockOffset,
    width
  }), getLockPixelOffset({
    height,
    lockOffset: maxLockOffset,
    width
  })];
}
function isScrollable(el2) {
  var computedStyle = window.getComputedStyle(el2);
  var overflowRegex = /(auto|scroll)/;
  var properties2 = ["overflow", "overflowX", "overflowY"];
  return properties2.find(function(property2) {
    return overflowRegex.test(computedStyle[property2]);
  });
}
function getScrollingParent(el2) {
  if (!(el2 instanceof HTMLElement)) {
    return null;
  } else if (isScrollable(el2)) {
    return el2;
  } else {
    return getScrollingParent(el2.parentNode);
  }
}
function getContainerGridGap(element2) {
  var style2 = window.getComputedStyle(element2);
  if (style2.display === "grid") {
    return {
      x: getPixelValue(style2.gridColumnGap),
      y: getPixelValue(style2.gridRowGap)
    };
  }
  return {
    x: 0,
    y: 0
  };
}
var KEYCODE = {
  ESC: 27,
  SPACE: 32,
  LEFT: 37,
  UP: 38,
  RIGHT: 39,
  DOWN: 40
};
var NodeType = {
  Anchor: "A",
  Button: "BUTTON",
  Canvas: "CANVAS",
  Input: "INPUT",
  Option: "OPTION",
  Textarea: "TEXTAREA",
  Select: "SELECT"
};
function cloneNode(node2) {
  var selector = "input, textarea, select, canvas, [contenteditable]";
  var fields = node2.querySelectorAll(selector);
  var clonedNode = node2.cloneNode(true);
  var clonedFields = _toConsumableArray(clonedNode.querySelectorAll(selector));
  clonedFields.forEach(function(field, i2) {
    if (field.type !== "file") {
      field.value = fields[i2].value;
    }
    if (field.type === "radio" && field.name) {
      field.name = "__sortableClone__".concat(field.name);
    }
    if (field.tagName === NodeType.Canvas && fields[i2].width > 0 && fields[i2].height > 0) {
      var destCtx = field.getContext("2d");
      destCtx.drawImage(fields[i2], 0, 0);
    }
  });
  return clonedNode;
}
function sortableHandle(WrappedComponent) {
  var _class, _temp;
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    withRef: false
  };
  return _temp = _class = function(_React$Component) {
    _inherits$a(WithSortableHandle, _React$Component);
    function WithSortableHandle() {
      var _getPrototypeOf2;
      var _this;
      _classCallCheck$a(this, WithSortableHandle);
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      _this = _possibleConstructorReturn$a(this, (_getPrototypeOf2 = _getPrototypeOf(WithSortableHandle)).call.apply(_getPrototypeOf2, [this].concat(args)));
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "wrappedInstance", reactExports.createRef());
      return _this;
    }
    _createClass$8(WithSortableHandle, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        var node2 = reactDomExports.findDOMNode(this);
        node2.sortableHandle = true;
      }
    }, {
      key: "getWrappedInstance",
      value: function getWrappedInstance() {
        invariant$1(config2.withRef, "To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call");
        return this.wrappedInstance.current;
      }
    }, {
      key: "render",
      value: function render3() {
        var ref = config2.withRef ? this.wrappedInstance : null;
        return reactExports.createElement(WrappedComponent, _extends$j({
          ref
        }, this.props));
      }
    }]);
    return WithSortableHandle;
  }(reactExports.Component), _defineProperty$4(_class, "displayName", provideDisplayName("sortableHandle", WrappedComponent)), _temp;
}
function isSortableHandle(node2) {
  return node2.sortableHandle != null;
}
var AutoScroller = function() {
  function AutoScroller2(container, onScrollCallback) {
    _classCallCheck$a(this, AutoScroller2);
    this.container = container;
    this.onScrollCallback = onScrollCallback;
  }
  _createClass$8(AutoScroller2, [{
    key: "clear",
    value: function clear() {
      if (this.interval == null) {
        return;
      }
      clearInterval(this.interval);
      this.interval = null;
    }
  }, {
    key: "update",
    value: function update(_ref) {
      var _this = this;
      var translate = _ref.translate, minTranslate = _ref.minTranslate, maxTranslate = _ref.maxTranslate, width = _ref.width, height = _ref.height;
      var direction = {
        x: 0,
        y: 0
      };
      var speed = {
        x: 1,
        y: 1
      };
      var acceleration = {
        x: 10,
        y: 10
      };
      var _this$container = this.container, scrollTop = _this$container.scrollTop, scrollLeft = _this$container.scrollLeft, scrollHeight = _this$container.scrollHeight, scrollWidth = _this$container.scrollWidth, clientHeight = _this$container.clientHeight, clientWidth = _this$container.clientWidth;
      var isTop = scrollTop === 0;
      var isBottom = scrollHeight - scrollTop - clientHeight === 0;
      var isLeft = scrollLeft === 0;
      var isRight = scrollWidth - scrollLeft - clientWidth === 0;
      if (translate.y >= maxTranslate.y - height / 2 && !isBottom) {
        direction.y = 1;
        speed.y = acceleration.y * Math.abs((maxTranslate.y - height / 2 - translate.y) / height);
      } else if (translate.x >= maxTranslate.x - width / 2 && !isRight) {
        direction.x = 1;
        speed.x = acceleration.x * Math.abs((maxTranslate.x - width / 2 - translate.x) / width);
      } else if (translate.y <= minTranslate.y + height / 2 && !isTop) {
        direction.y = -1;
        speed.y = acceleration.y * Math.abs((translate.y - height / 2 - minTranslate.y) / height);
      } else if (translate.x <= minTranslate.x + width / 2 && !isLeft) {
        direction.x = -1;
        speed.x = acceleration.x * Math.abs((translate.x - width / 2 - minTranslate.x) / width);
      }
      if (this.interval) {
        this.clear();
        this.isAutoScrolling = false;
      }
      if (direction.x !== 0 || direction.y !== 0) {
        this.interval = setInterval(function() {
          _this.isAutoScrolling = true;
          var offset2 = {
            left: speed.x * direction.x,
            top: speed.y * direction.y
          };
          _this.container.scrollTop += offset2.top;
          _this.container.scrollLeft += offset2.left;
          _this.onScrollCallback(offset2);
        }, 5);
      }
    }
  }]);
  return AutoScroller2;
}();
function defaultGetHelperDimensions(_ref) {
  var node2 = _ref.node;
  return {
    height: node2.offsetHeight,
    width: node2.offsetWidth
  };
}
function defaultShouldCancelStart(event) {
  var interactiveElements = [NodeType.Input, NodeType.Textarea, NodeType.Select, NodeType.Option, NodeType.Button];
  if (interactiveElements.indexOf(event.target.tagName) !== -1) {
    return true;
  }
  if (closest(event.target, function(el2) {
    return el2.contentEditable === "true";
  })) {
    return true;
  }
  return false;
}
var propTypes = {
  axis: PropTypes$4.oneOf(["x", "y", "xy"]),
  contentWindow: PropTypes$4.any,
  disableAutoscroll: PropTypes$4.bool,
  distance: PropTypes$4.number,
  getContainer: PropTypes$4.func,
  getHelperDimensions: PropTypes$4.func,
  helperClass: PropTypes$4.string,
  helperContainer: PropTypes$4.oneOfType([PropTypes$4.func, typeof HTMLElement === "undefined" ? PropTypes$4.any : PropTypes$4.instanceOf(HTMLElement)]),
  hideSortableGhost: PropTypes$4.bool,
  keyboardSortingTransitionDuration: PropTypes$4.number,
  lockAxis: PropTypes$4.string,
  lockOffset: PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string, PropTypes$4.arrayOf(PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string]))]),
  lockToContainerEdges: PropTypes$4.bool,
  onSortEnd: PropTypes$4.func,
  onSortMove: PropTypes$4.func,
  onSortOver: PropTypes$4.func,
  onSortStart: PropTypes$4.func,
  pressDelay: PropTypes$4.number,
  pressThreshold: PropTypes$4.number,
  keyCodes: PropTypes$4.shape({
    lift: PropTypes$4.arrayOf(PropTypes$4.number),
    drop: PropTypes$4.arrayOf(PropTypes$4.number),
    cancel: PropTypes$4.arrayOf(PropTypes$4.number),
    up: PropTypes$4.arrayOf(PropTypes$4.number),
    down: PropTypes$4.arrayOf(PropTypes$4.number)
  }),
  shouldCancelStart: PropTypes$4.func,
  transitionDuration: PropTypes$4.number,
  updateBeforeSortStart: PropTypes$4.func,
  useDragHandle: PropTypes$4.bool,
  useWindowAsScrollContainer: PropTypes$4.bool
};
var defaultKeyCodes = {
  lift: [KEYCODE.SPACE],
  drop: [KEYCODE.SPACE],
  cancel: [KEYCODE.ESC],
  up: [KEYCODE.UP, KEYCODE.LEFT],
  down: [KEYCODE.DOWN, KEYCODE.RIGHT]
};
var defaultProps = {
  axis: "y",
  disableAutoscroll: false,
  distance: 0,
  getHelperDimensions: defaultGetHelperDimensions,
  hideSortableGhost: true,
  lockOffset: "50%",
  lockToContainerEdges: false,
  pressDelay: 0,
  pressThreshold: 5,
  keyCodes: defaultKeyCodes,
  shouldCancelStart: defaultShouldCancelStart,
  transitionDuration: 300,
  useWindowAsScrollContainer: false
};
var omittedProps = Object.keys(propTypes);
function validateProps(props) {
  invariant$1(!(props.distance && props.pressDelay), "Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.");
}
function _finallyRethrows(body, finalizer) {
  try {
    var result = body();
  } catch (e2) {
    return finalizer(true, e2);
  }
  if (result && result.then) {
    return result.then(finalizer.bind(null, false), finalizer.bind(null, true));
  }
  return finalizer(false, value);
}
var SortableContext = reactExports.createContext({
  manager: {}
});
function sortableContainer(WrappedComponent) {
  var _class, _temp;
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    withRef: false
  };
  return _temp = _class = function(_React$Component) {
    _inherits$a(WithSortableContainer, _React$Component);
    function WithSortableContainer(props) {
      var _this;
      _classCallCheck$a(this, WithSortableContainer);
      _this = _possibleConstructorReturn$a(this, _getPrototypeOf(WithSortableContainer).call(this, props));
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "state", {});
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleStart", function(event) {
        var _this$props = _this.props, distance2 = _this$props.distance, shouldCancelStart = _this$props.shouldCancelStart;
        if (event.button === 2 || shouldCancelStart(event)) {
          return;
        }
        _this.touched = true;
        _this.position = getPosition(event);
        var node2 = closest(event.target, function(el2) {
          return el2.sortableInfo != null;
        });
        if (node2 && node2.sortableInfo && _this.nodeIsChild(node2) && !_this.state.sorting) {
          var useDragHandle = _this.props.useDragHandle;
          var _node$sortableInfo = node2.sortableInfo, index2 = _node$sortableInfo.index, collection = _node$sortableInfo.collection, disabled = _node$sortableInfo.disabled;
          if (disabled) {
            return;
          }
          if (useDragHandle && !closest(event.target, isSortableHandle)) {
            return;
          }
          _this.manager.active = {
            collection,
            index: index2
          };
          if (!isTouchEvent(event) && event.target.tagName === NodeType.Anchor) {
            event.preventDefault();
          }
          if (!distance2) {
            if (_this.props.pressDelay === 0) {
              _this.handlePress(event);
            } else {
              _this.pressTimer = setTimeout(function() {
                return _this.handlePress(event);
              }, _this.props.pressDelay);
            }
          }
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "nodeIsChild", function(node2) {
        return node2.sortableInfo.manager === _this.manager;
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleMove", function(event) {
        var _this$props2 = _this.props, distance2 = _this$props2.distance, pressThreshold = _this$props2.pressThreshold;
        if (!_this.state.sorting && _this.touched && !_this._awaitingUpdateBeforeSortStart) {
          var position2 = getPosition(event);
          var delta = {
            x: _this.position.x - position2.x,
            y: _this.position.y - position2.y
          };
          var combinedDelta = Math.abs(delta.x) + Math.abs(delta.y);
          _this.delta = delta;
          if (!distance2 && (!pressThreshold || combinedDelta >= pressThreshold)) {
            clearTimeout(_this.cancelTimer);
            _this.cancelTimer = setTimeout(_this.cancel, 0);
          } else if (distance2 && combinedDelta >= distance2 && _this.manager.isActive()) {
            _this.handlePress(event);
          }
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleEnd", function() {
        _this.touched = false;
        _this.cancel();
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "cancel", function() {
        var distance2 = _this.props.distance;
        var sorting = _this.state.sorting;
        if (!sorting) {
          if (!distance2) {
            clearTimeout(_this.pressTimer);
          }
          _this.manager.active = null;
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handlePress", function(event) {
        try {
          var active3 = _this.manager.getActive();
          var _temp6 = function() {
            if (active3) {
              var _temp7 = function _temp72() {
                var index2 = _node.sortableInfo.index;
                var margin = getElementMargin(_node);
                var gridGap = getContainerGridGap(_this.container);
                var containerBoundingRect = _this.scrollContainer.getBoundingClientRect();
                var dimensions = _getHelperDimensions({
                  index: index2,
                  node: _node,
                  collection: _collection
                });
                _this.node = _node;
                _this.margin = margin;
                _this.gridGap = gridGap;
                _this.width = dimensions.width;
                _this.height = dimensions.height;
                _this.marginOffset = {
                  x: _this.margin.left + _this.margin.right + _this.gridGap.x,
                  y: Math.max(_this.margin.top, _this.margin.bottom, _this.gridGap.y)
                };
                _this.boundingClientRect = _node.getBoundingClientRect();
                _this.containerBoundingRect = containerBoundingRect;
                _this.index = index2;
                _this.newIndex = index2;
                _this.axis = {
                  x: _axis.indexOf("x") >= 0,
                  y: _axis.indexOf("y") >= 0
                };
                _this.offsetEdge = getEdgeOffset(_node, _this.container);
                if (_isKeySorting) {
                  _this.initialOffset = getPosition(_objectSpread({}, event, {
                    pageX: _this.boundingClientRect.left,
                    pageY: _this.boundingClientRect.top
                  }));
                } else {
                  _this.initialOffset = getPosition(event);
                }
                _this.initialScroll = {
                  left: _this.scrollContainer.scrollLeft,
                  top: _this.scrollContainer.scrollTop
                };
                _this.initialWindowScroll = {
                  left: window.pageXOffset,
                  top: window.pageYOffset
                };
                _this.helper = _this.helperContainer.appendChild(cloneNode(_node));
                setInlineStyles(_this.helper, {
                  boxSizing: "border-box",
                  height: "".concat(_this.height, "px"),
                  left: "".concat(_this.boundingClientRect.left - margin.left, "px"),
                  pointerEvents: "none",
                  position: "fixed",
                  top: "".concat(_this.boundingClientRect.top - margin.top, "px"),
                  width: "".concat(_this.width, "px")
                });
                if (_isKeySorting) {
                  _this.helper.focus();
                }
                if (_hideSortableGhost) {
                  _this.sortableGhost = _node;
                  setInlineStyles(_node, {
                    opacity: 0,
                    visibility: "hidden"
                  });
                }
                _this.minTranslate = {};
                _this.maxTranslate = {};
                if (_isKeySorting) {
                  var _ref = _useWindowAsScrollContainer ? {
                    top: 0,
                    left: 0,
                    width: _this.contentWindow.innerWidth,
                    height: _this.contentWindow.innerHeight
                  } : _this.containerBoundingRect, containerTop = _ref.top, containerLeft = _ref.left, containerWidth = _ref.width, containerHeight = _ref.height;
                  var containerBottom = containerTop + containerHeight;
                  var containerRight = containerLeft + containerWidth;
                  if (_this.axis.x) {
                    _this.minTranslate.x = containerLeft - _this.boundingClientRect.left;
                    _this.maxTranslate.x = containerRight - (_this.boundingClientRect.left + _this.width);
                  }
                  if (_this.axis.y) {
                    _this.minTranslate.y = containerTop - _this.boundingClientRect.top;
                    _this.maxTranslate.y = containerBottom - (_this.boundingClientRect.top + _this.height);
                  }
                } else {
                  if (_this.axis.x) {
                    _this.minTranslate.x = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.left) - _this.boundingClientRect.left - _this.width / 2;
                    _this.maxTranslate.x = (_useWindowAsScrollContainer ? _this.contentWindow.innerWidth : containerBoundingRect.left + containerBoundingRect.width) - _this.boundingClientRect.left - _this.width / 2;
                  }
                  if (_this.axis.y) {
                    _this.minTranslate.y = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.top) - _this.boundingClientRect.top - _this.height / 2;
                    _this.maxTranslate.y = (_useWindowAsScrollContainer ? _this.contentWindow.innerHeight : containerBoundingRect.top + containerBoundingRect.height) - _this.boundingClientRect.top - _this.height / 2;
                  }
                }
                if (_helperClass) {
                  _helperClass.split(" ").forEach(function(className) {
                    return _this.helper.classList.add(className);
                  });
                }
                _this.listenerNode = event.touches ? event.target : _this.contentWindow;
                if (_isKeySorting) {
                  _this.listenerNode.addEventListener("wheel", _this.handleKeyEnd, true);
                  _this.listenerNode.addEventListener("mousedown", _this.handleKeyEnd, true);
                  _this.listenerNode.addEventListener("keydown", _this.handleKeyDown);
                } else {
                  events.move.forEach(function(eventName) {
                    return _this.listenerNode.addEventListener(eventName, _this.handleSortMove, false);
                  });
                  events.end.forEach(function(eventName) {
                    return _this.listenerNode.addEventListener(eventName, _this.handleSortEnd, false);
                  });
                }
                _this.setState({
                  sorting: true,
                  sortingIndex: index2
                });
                if (_onSortStart) {
                  _onSortStart({
                    node: _node,
                    index: index2,
                    collection: _collection,
                    isKeySorting: _isKeySorting,
                    nodes: _this.manager.getOrderedRefs(),
                    helper: _this.helper
                  }, event);
                }
                if (_isKeySorting) {
                  _this.keyMove(0);
                }
              };
              var _this$props3 = _this.props, _axis = _this$props3.axis, _getHelperDimensions = _this$props3.getHelperDimensions, _helperClass = _this$props3.helperClass, _hideSortableGhost = _this$props3.hideSortableGhost, updateBeforeSortStart = _this$props3.updateBeforeSortStart, _onSortStart = _this$props3.onSortStart, _useWindowAsScrollContainer = _this$props3.useWindowAsScrollContainer;
              var _node = active3.node, _collection = active3.collection;
              var _isKeySorting = _this.manager.isKeySorting;
              var _temp8 = function() {
                if (typeof updateBeforeSortStart === "function") {
                  _this._awaitingUpdateBeforeSortStart = true;
                  var _temp9 = _finallyRethrows(function() {
                    var index2 = _node.sortableInfo.index;
                    return Promise.resolve(updateBeforeSortStart({
                      collection: _collection,
                      index: index2,
                      node: _node,
                      isKeySorting: _isKeySorting
                    }, event)).then(function() {
                    });
                  }, function(_wasThrown, _result) {
                    _this._awaitingUpdateBeforeSortStart = false;
                    if (_wasThrown)
                      throw _result;
                    return _result;
                  });
                  if (_temp9 && _temp9.then)
                    return _temp9.then(function() {
                    });
                }
              }();
              return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8);
            }
          }();
          return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function() {
          }) : void 0);
        } catch (e2) {
          return Promise.reject(e2);
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortMove", function(event) {
        var onSortMove = _this.props.onSortMove;
        if (typeof event.preventDefault === "function" && event.cancelable) {
          event.preventDefault();
        }
        _this.updateHelperPosition(event);
        _this.animateNodes();
        _this.autoscroll();
        if (onSortMove) {
          onSortMove(event);
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleSortEnd", function(event) {
        var _this$props4 = _this.props, hideSortableGhost = _this$props4.hideSortableGhost, onSortEnd = _this$props4.onSortEnd;
        var _this$manager = _this.manager, collection = _this$manager.active.collection, isKeySorting = _this$manager.isKeySorting;
        var nodes = _this.manager.getOrderedRefs();
        if (_this.listenerNode) {
          if (isKeySorting) {
            _this.listenerNode.removeEventListener("wheel", _this.handleKeyEnd, true);
            _this.listenerNode.removeEventListener("mousedown", _this.handleKeyEnd, true);
            _this.listenerNode.removeEventListener("keydown", _this.handleKeyDown);
          } else {
            events.move.forEach(function(eventName) {
              return _this.listenerNode.removeEventListener(eventName, _this.handleSortMove);
            });
            events.end.forEach(function(eventName) {
              return _this.listenerNode.removeEventListener(eventName, _this.handleSortEnd);
            });
          }
        }
        _this.helper.parentNode.removeChild(_this.helper);
        if (hideSortableGhost && _this.sortableGhost) {
          setInlineStyles(_this.sortableGhost, {
            opacity: "",
            visibility: ""
          });
        }
        for (var i2 = 0, len = nodes.length; i2 < len; i2++) {
          var _node2 = nodes[i2];
          var el2 = _node2.node;
          _node2.edgeOffset = null;
          _node2.boundingClientRect = null;
          setTranslate3d(el2, null);
          setTransitionDuration(el2, null);
          _node2.translate = null;
        }
        _this.autoScroller.clear();
        _this.manager.active = null;
        _this.manager.isKeySorting = false;
        _this.setState({
          sorting: false,
          sortingIndex: null
        });
        if (typeof onSortEnd === "function") {
          onSortEnd({
            collection,
            newIndex: _this.newIndex,
            oldIndex: _this.index,
            isKeySorting,
            nodes
          }, event);
        }
        _this.touched = false;
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "autoscroll", function() {
        var disableAutoscroll = _this.props.disableAutoscroll;
        var isKeySorting = _this.manager.isKeySorting;
        if (disableAutoscroll) {
          _this.autoScroller.clear();
          return;
        }
        if (isKeySorting) {
          var translate = _objectSpread({}, _this.translate);
          var scrollX = 0;
          var scrollY = 0;
          if (_this.axis.x) {
            translate.x = Math.min(_this.maxTranslate.x, Math.max(_this.minTranslate.x, _this.translate.x));
            scrollX = _this.translate.x - translate.x;
          }
          if (_this.axis.y) {
            translate.y = Math.min(_this.maxTranslate.y, Math.max(_this.minTranslate.y, _this.translate.y));
            scrollY = _this.translate.y - translate.y;
          }
          _this.translate = translate;
          setTranslate3d(_this.helper, _this.translate);
          _this.scrollContainer.scrollLeft += scrollX;
          _this.scrollContainer.scrollTop += scrollY;
          return;
        }
        _this.autoScroller.update({
          height: _this.height,
          maxTranslate: _this.maxTranslate,
          minTranslate: _this.minTranslate,
          translate: _this.translate,
          width: _this.width
        });
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "onAutoScroll", function(offset2) {
        _this.translate.x += offset2.left;
        _this.translate.y += offset2.top;
        _this.animateNodes();
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyDown", function(event) {
        var keyCode = event.keyCode;
        var _this$props5 = _this.props, shouldCancelStart = _this$props5.shouldCancelStart, _this$props5$keyCodes = _this$props5.keyCodes, customKeyCodes = _this$props5$keyCodes === void 0 ? {} : _this$props5$keyCodes;
        var keyCodes = _objectSpread({}, defaultKeyCodes, customKeyCodes);
        if (_this.manager.active && !_this.manager.isKeySorting || !_this.manager.active && (!keyCodes.lift.includes(keyCode) || shouldCancelStart(event) || !_this.isValidSortingTarget(event))) {
          return;
        }
        event.stopPropagation();
        event.preventDefault();
        if (keyCodes.lift.includes(keyCode) && !_this.manager.active) {
          _this.keyLift(event);
        } else if (keyCodes.drop.includes(keyCode) && _this.manager.active) {
          _this.keyDrop(event);
        } else if (keyCodes.cancel.includes(keyCode)) {
          _this.newIndex = _this.manager.active.index;
          _this.keyDrop(event);
        } else if (keyCodes.up.includes(keyCode)) {
          _this.keyMove(-1);
        } else if (keyCodes.down.includes(keyCode)) {
          _this.keyMove(1);
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "keyLift", function(event) {
        var target = event.target;
        var node2 = closest(target, function(el2) {
          return el2.sortableInfo != null;
        });
        var _node$sortableInfo2 = node2.sortableInfo, index2 = _node$sortableInfo2.index, collection = _node$sortableInfo2.collection;
        _this.initialFocusedNode = target;
        _this.manager.isKeySorting = true;
        _this.manager.active = {
          index: index2,
          collection
        };
        _this.handlePress(event);
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "keyMove", function(shift) {
        var nodes = _this.manager.getOrderedRefs();
        var lastIndex = nodes[nodes.length - 1].node.sortableInfo.index;
        var newIndex = _this.newIndex + shift;
        var prevIndex = _this.newIndex;
        if (newIndex < 0 || newIndex > lastIndex) {
          return;
        }
        _this.prevIndex = prevIndex;
        _this.newIndex = newIndex;
        var targetIndex = getTargetIndex(_this.newIndex, _this.prevIndex, _this.index);
        var target = nodes.find(function(_ref2) {
          var node2 = _ref2.node;
          return node2.sortableInfo.index === targetIndex;
        });
        var targetNode = target.node;
        var scrollDelta = _this.containerScrollDelta;
        var targetBoundingClientRect = target.boundingClientRect || getScrollAdjustedBoundingClientRect(targetNode, scrollDelta);
        var targetTranslate = target.translate || {
          x: 0,
          y: 0
        };
        var targetPosition = {
          top: targetBoundingClientRect.top + targetTranslate.y - scrollDelta.top,
          left: targetBoundingClientRect.left + targetTranslate.x - scrollDelta.left
        };
        var shouldAdjustForSize = prevIndex < newIndex;
        var sizeAdjustment = {
          x: shouldAdjustForSize && _this.axis.x ? targetNode.offsetWidth - _this.width : 0,
          y: shouldAdjustForSize && _this.axis.y ? targetNode.offsetHeight - _this.height : 0
        };
        _this.handleSortMove({
          pageX: targetPosition.left + sizeAdjustment.x,
          pageY: targetPosition.top + sizeAdjustment.y,
          ignoreTransition: shift === 0
        });
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "keyDrop", function(event) {
        _this.handleSortEnd(event);
        if (_this.initialFocusedNode) {
          _this.initialFocusedNode.focus();
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "handleKeyEnd", function(event) {
        if (_this.manager.active) {
          _this.keyDrop(event);
        }
      });
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "isValidSortingTarget", function(event) {
        var useDragHandle = _this.props.useDragHandle;
        var target = event.target;
        var node2 = closest(target, function(el2) {
          return el2.sortableInfo != null;
        });
        return node2 && node2.sortableInfo && !node2.sortableInfo.disabled && (useDragHandle ? isSortableHandle(target) : target.sortableInfo);
      });
      var manager = new Manager();
      validateProps(props);
      _this.manager = manager;
      _this.wrappedInstance = reactExports.createRef();
      _this.sortableContextValue = {
        manager
      };
      _this.events = {
        end: _this.handleEnd,
        move: _this.handleMove,
        start: _this.handleStart
      };
      return _this;
    }
    _createClass$8(WithSortableContainer, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        var _this2 = this;
        var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
        var container = this.getContainer();
        Promise.resolve(container).then(function(containerNode) {
          _this2.container = containerNode;
          _this2.document = _this2.container.ownerDocument || document;
          var contentWindow = _this2.props.contentWindow || _this2.document.defaultView || window;
          _this2.contentWindow = typeof contentWindow === "function" ? contentWindow() : contentWindow;
          _this2.scrollContainer = useWindowAsScrollContainer ? _this2.document.scrollingElement || _this2.document.documentElement : getScrollingParent(_this2.container) || _this2.container;
          _this2.autoScroller = new AutoScroller(_this2.scrollContainer, _this2.onAutoScroll);
          Object.keys(_this2.events).forEach(function(key) {
            return events[key].forEach(function(eventName) {
              return _this2.container.addEventListener(eventName, _this2.events[key], false);
            });
          });
          _this2.container.addEventListener("keydown", _this2.handleKeyDown);
        });
      }
    }, {
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        var _this3 = this;
        if (this.helper && this.helper.parentNode) {
          this.helper.parentNode.removeChild(this.helper);
        }
        if (!this.container) {
          return;
        }
        Object.keys(this.events).forEach(function(key) {
          return events[key].forEach(function(eventName) {
            return _this3.container.removeEventListener(eventName, _this3.events[key]);
          });
        });
        this.container.removeEventListener("keydown", this.handleKeyDown);
      }
    }, {
      key: "updateHelperPosition",
      value: function updateHelperPosition(event) {
        var _this$props6 = this.props, lockAxis = _this$props6.lockAxis, lockOffset = _this$props6.lockOffset, lockToContainerEdges = _this$props6.lockToContainerEdges, transitionDuration = _this$props6.transitionDuration, _this$props6$keyboard = _this$props6.keyboardSortingTransitionDuration, keyboardSortingTransitionDuration = _this$props6$keyboard === void 0 ? transitionDuration : _this$props6$keyboard;
        var isKeySorting = this.manager.isKeySorting;
        var ignoreTransition = event.ignoreTransition;
        var offset2 = getPosition(event);
        var translate = {
          x: offset2.x - this.initialOffset.x,
          y: offset2.y - this.initialOffset.y
        };
        translate.y -= window.pageYOffset - this.initialWindowScroll.top;
        translate.x -= window.pageXOffset - this.initialWindowScroll.left;
        this.translate = translate;
        if (lockToContainerEdges) {
          var _getLockPixelOffsets = getLockPixelOffsets({
            height: this.height,
            lockOffset,
            width: this.width
          }), _getLockPixelOffsets2 = _slicedToArray(_getLockPixelOffsets, 2), minLockOffset = _getLockPixelOffsets2[0], maxLockOffset = _getLockPixelOffsets2[1];
          var minOffset = {
            x: this.width / 2 - minLockOffset.x,
            y: this.height / 2 - minLockOffset.y
          };
          var maxOffset = {
            x: this.width / 2 - maxLockOffset.x,
            y: this.height / 2 - maxLockOffset.y
          };
          translate.x = limit(this.minTranslate.x + minOffset.x, this.maxTranslate.x - maxOffset.x, translate.x);
          translate.y = limit(this.minTranslate.y + minOffset.y, this.maxTranslate.y - maxOffset.y, translate.y);
        }
        if (lockAxis === "x") {
          translate.y = 0;
        } else if (lockAxis === "y") {
          translate.x = 0;
        }
        if (isKeySorting && keyboardSortingTransitionDuration && !ignoreTransition) {
          setTransitionDuration(this.helper, keyboardSortingTransitionDuration);
        }
        setTranslate3d(this.helper, translate);
      }
    }, {
      key: "animateNodes",
      value: function animateNodes() {
        var _this$props7 = this.props, transitionDuration = _this$props7.transitionDuration, hideSortableGhost = _this$props7.hideSortableGhost, onSortOver = _this$props7.onSortOver;
        var containerScrollDelta = this.containerScrollDelta, windowScrollDelta = this.windowScrollDelta;
        var nodes = this.manager.getOrderedRefs();
        var sortingOffset = {
          left: this.offsetEdge.left + this.translate.x + containerScrollDelta.left,
          top: this.offsetEdge.top + this.translate.y + containerScrollDelta.top
        };
        var isKeySorting = this.manager.isKeySorting;
        var prevIndex = this.newIndex;
        this.newIndex = null;
        for (var i2 = 0, len = nodes.length; i2 < len; i2++) {
          var _node3 = nodes[i2].node;
          var index2 = _node3.sortableInfo.index;
          var width = _node3.offsetWidth;
          var height = _node3.offsetHeight;
          var offset2 = {
            height: this.height > height ? height / 2 : this.height / 2,
            width: this.width > width ? width / 2 : this.width / 2
          };
          var mustShiftBackward = isKeySorting && index2 > this.index && index2 <= prevIndex;
          var mustShiftForward = isKeySorting && index2 < this.index && index2 >= prevIndex;
          var translate = {
            x: 0,
            y: 0
          };
          var edgeOffset = nodes[i2].edgeOffset;
          if (!edgeOffset) {
            edgeOffset = getEdgeOffset(_node3, this.container);
            nodes[i2].edgeOffset = edgeOffset;
            if (isKeySorting) {
              nodes[i2].boundingClientRect = getScrollAdjustedBoundingClientRect(_node3, containerScrollDelta);
            }
          }
          var nextNode = i2 < nodes.length - 1 && nodes[i2 + 1];
          var prevNode = i2 > 0 && nodes[i2 - 1];
          if (nextNode && !nextNode.edgeOffset) {
            nextNode.edgeOffset = getEdgeOffset(nextNode.node, this.container);
            if (isKeySorting) {
              nextNode.boundingClientRect = getScrollAdjustedBoundingClientRect(nextNode.node, containerScrollDelta);
            }
          }
          if (index2 === this.index) {
            if (hideSortableGhost) {
              this.sortableGhost = _node3;
              setInlineStyles(_node3, {
                opacity: 0,
                visibility: "hidden"
              });
            }
            continue;
          }
          if (transitionDuration) {
            setTransitionDuration(_node3, transitionDuration);
          }
          if (this.axis.x) {
            if (this.axis.y) {
              if (mustShiftForward || index2 < this.index && (sortingOffset.left + windowScrollDelta.left - offset2.width <= edgeOffset.left && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset2.height || sortingOffset.top + windowScrollDelta.top + offset2.height <= edgeOffset.top)) {
                translate.x = this.width + this.marginOffset.x;
                if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset2.width) {
                  if (nextNode) {
                    translate.x = nextNode.edgeOffset.left - edgeOffset.left;
                    translate.y = nextNode.edgeOffset.top - edgeOffset.top;
                  }
                }
                if (this.newIndex === null) {
                  this.newIndex = index2;
                }
              } else if (mustShiftBackward || index2 > this.index && (sortingOffset.left + windowScrollDelta.left + offset2.width >= edgeOffset.left && sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top || sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top + height)) {
                translate.x = -(this.width + this.marginOffset.x);
                if (edgeOffset.left + translate.x < this.containerBoundingRect.left + offset2.width) {
                  if (prevNode) {
                    translate.x = prevNode.edgeOffset.left - edgeOffset.left;
                    translate.y = prevNode.edgeOffset.top - edgeOffset.top;
                  }
                }
                this.newIndex = index2;
              }
            } else {
              if (mustShiftBackward || index2 > this.index && sortingOffset.left + windowScrollDelta.left + offset2.width >= edgeOffset.left) {
                translate.x = -(this.width + this.marginOffset.x);
                this.newIndex = index2;
              } else if (mustShiftForward || index2 < this.index && sortingOffset.left + windowScrollDelta.left <= edgeOffset.left + offset2.width) {
                translate.x = this.width + this.marginOffset.x;
                if (this.newIndex == null) {
                  this.newIndex = index2;
                }
              }
            }
          } else if (this.axis.y) {
            if (mustShiftBackward || index2 > this.index && sortingOffset.top + windowScrollDelta.top + offset2.height >= edgeOffset.top) {
              translate.y = -(this.height + this.marginOffset.y);
              this.newIndex = index2;
            } else if (mustShiftForward || index2 < this.index && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset2.height) {
              translate.y = this.height + this.marginOffset.y;
              if (this.newIndex == null) {
                this.newIndex = index2;
              }
            }
          }
          setTranslate3d(_node3, translate);
          nodes[i2].translate = translate;
        }
        if (this.newIndex == null) {
          this.newIndex = this.index;
        }
        if (isKeySorting) {
          this.newIndex = prevIndex;
        }
        var oldIndex = isKeySorting ? this.prevIndex : prevIndex;
        if (onSortOver && this.newIndex !== oldIndex) {
          onSortOver({
            collection: this.manager.active.collection,
            index: this.index,
            newIndex: this.newIndex,
            oldIndex,
            isKeySorting,
            nodes,
            helper: this.helper
          });
        }
      }
    }, {
      key: "getWrappedInstance",
      value: function getWrappedInstance() {
        invariant$1(config2.withRef, "To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call");
        return this.wrappedInstance.current;
      }
    }, {
      key: "getContainer",
      value: function getContainer2() {
        var getContainer22 = this.props.getContainer;
        if (typeof getContainer22 !== "function") {
          return reactDomExports.findDOMNode(this);
        }
        return getContainer22(config2.withRef ? this.getWrappedInstance() : void 0);
      }
    }, {
      key: "render",
      value: function render3() {
        var ref = config2.withRef ? this.wrappedInstance : null;
        return reactExports.createElement(SortableContext.Provider, {
          value: this.sortableContextValue
        }, reactExports.createElement(WrappedComponent, _extends$j({
          ref
        }, omit(this.props, omittedProps))));
      }
    }, {
      key: "helperContainer",
      get: function get5() {
        var helperContainer = this.props.helperContainer;
        if (typeof helperContainer === "function") {
          return helperContainer();
        }
        return this.props.helperContainer || this.document.body;
      }
    }, {
      key: "containerScrollDelta",
      get: function get5() {
        var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer;
        if (useWindowAsScrollContainer) {
          return {
            left: 0,
            top: 0
          };
        }
        return {
          left: this.scrollContainer.scrollLeft - this.initialScroll.left,
          top: this.scrollContainer.scrollTop - this.initialScroll.top
        };
      }
    }, {
      key: "windowScrollDelta",
      get: function get5() {
        return {
          left: this.contentWindow.pageXOffset - this.initialWindowScroll.left,
          top: this.contentWindow.pageYOffset - this.initialWindowScroll.top
        };
      }
    }]);
    return WithSortableContainer;
  }(reactExports.Component), _defineProperty$4(_class, "displayName", provideDisplayName("sortableList", WrappedComponent)), _defineProperty$4(_class, "defaultProps", defaultProps), _defineProperty$4(_class, "propTypes", propTypes), _temp;
}
var propTypes$1 = {
  index: PropTypes$4.number.isRequired,
  collection: PropTypes$4.oneOfType([PropTypes$4.number, PropTypes$4.string]),
  disabled: PropTypes$4.bool
};
var omittedProps$1 = Object.keys(propTypes$1);
function sortableElement(WrappedComponent) {
  var _class, _temp;
  var config2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
    withRef: false
  };
  return _temp = _class = function(_React$Component) {
    _inherits$a(WithSortableElement, _React$Component);
    function WithSortableElement() {
      var _getPrototypeOf2;
      var _this;
      _classCallCheck$a(this, WithSortableElement);
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      _this = _possibleConstructorReturn$a(this, (_getPrototypeOf2 = _getPrototypeOf(WithSortableElement)).call.apply(_getPrototypeOf2, [this].concat(args)));
      _defineProperty$4(_assertThisInitialized(_assertThisInitialized(_this)), "wrappedInstance", reactExports.createRef());
      return _this;
    }
    _createClass$8(WithSortableElement, [{
      key: "componentDidMount",
      value: function componentDidMount() {
        this.register();
      }
    }, {
      key: "componentDidUpdate",
      value: function componentDidUpdate(prevProps) {
        if (this.node) {
          if (prevProps.index !== this.props.index) {
            this.node.sortableInfo.index = this.props.index;
          }
          if (prevProps.disabled !== this.props.disabled) {
            this.node.sortableInfo.disabled = this.props.disabled;
          }
        }
        if (prevProps.collection !== this.props.collection) {
          this.unregister(prevProps.collection);
          this.register();
        }
      }
    }, {
      key: "componentWillUnmount",
      value: function componentWillUnmount() {
        this.unregister();
      }
    }, {
      key: "register",
      value: function register2() {
        var _this$props = this.props, collection = _this$props.collection, disabled = _this$props.disabled, index2 = _this$props.index;
        var node2 = reactDomExports.findDOMNode(this);
        node2.sortableInfo = {
          collection,
          disabled,
          index: index2,
          manager: this.context.manager
        };
        this.node = node2;
        this.ref = {
          node: node2
        };
        this.context.manager.add(collection, this.ref);
      }
    }, {
      key: "unregister",
      value: function unregister() {
        var collection = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.collection;
        this.context.manager.remove(collection, this.ref);
      }
    }, {
      key: "getWrappedInstance",
      value: function getWrappedInstance() {
        invariant$1(config2.withRef, "To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call");
        return this.wrappedInstance.current;
      }
    }, {
      key: "render",
      value: function render3() {
        var ref = config2.withRef ? this.wrappedInstance : null;
        return reactExports.createElement(WrappedComponent, _extends$j({
          ref
        }, omit(this.props, omittedProps$1)));
      }
    }]);
    return WithSortableElement;
  }(reactExports.Component), _defineProperty$4(_class, "displayName", provideDisplayName("sortableElement", WrappedComponent)), _defineProperty$4(_class, "contextType", SortableContext), _defineProperty$4(_class, "propTypes", propTypes$1), _defineProperty$4(_class, "defaultProps", {
    collection: 0
  }), _temp;
}
const ItemTypeIcon = {
  [PlaylistItemType.Resource]: GrResources,
  [PlaylistItemType.Video]: MdVideoFile,
  [PlaylistItemType.Image]: MdImage,
  [PlaylistItemType.Audio]: MdAudiotrack
};
const renderDuration = (item) => {
  if (item.type === PlaylistItemType.Audio || item.type === PlaylistItemType.Video) {
    let duration2 = item.startTime ?? "";
    if (item.endTime) {
      duration2 += ` ~ ${item.endTime}`;
    }
    return duration2;
  }
  return "";
};
const SortableDragHandle = sortableHandle(() => /* @__PURE__ */ jsxRuntimeExports.jsx(DragHandle, {}));
const SortablePlaylistItem = sortableElement(
  ({ item, resource, onRemove }) => {
    const { t: t2 } = useTranslation();
    const renderResourceName = reactExports.useCallback(() => {
      if (resource == null ? void 0 : resource.displayName) {
        return resource.displayName;
      }
      return t2("playlist.label.unknownResource");
    }, [resource, t2]);
    const handleOpenFile = reactExports.useCallback(() => {
      if (resource) {
        BApi$1.tool.openFileOrDirectory({
          path: item.file ?? resource.path,
          openInDirectory: item.file ? true : resource.isFile
        });
      }
    }, [item.file, resource]);
    const handleRemove = reactExports.useCallback(() => {
      onRemove(item);
    }, [item, onRemove]);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "grid grid-cols-[auto_auto_1fr_auto_auto] gap-2 items-center px-2 border-b",
        style: {
          borderColor: "var(--theme-border-color)"
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SortableDragHandle, {}) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center text-gray-400 w-6", children: React$6.createElement(ItemTypeIcon[item.type], { className: "text-lg" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center min-w-0 gap-2 truncate", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: renderResourceName() }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                disabled: !resource && item.type === PlaylistItemType.Resource,
                variant: "light",
                size: "sm",
                onPress: handleOpenFile,
                isIconOnly: true,
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" })
              }
            ),
            item.file && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600 truncate", children: item.file })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end text-sm text-gray-500 min-w-[120px]", children: renderDuration(item) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center w-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: handleRemove,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
            }
          ) })
        ]
      }
    );
  }
);
const SortablePlaylistItemList = sortableContainer(
  ({ items, resources, onRemove }) => {
    const { t: t2 } = useTranslation();
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "grid grid-cols-[auto_auto_1fr_auto_auto] gap-2 items-center px-2 py-2 border-b text-sm font-medium",
          style: {
            backgroundColor: "var(--theme-table-header-background)",
            color: "var(--theme-text)",
            borderColor: "var(--theme-border-color)"
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-8" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-6" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Resource / File") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Duration") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-10" })
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[800px] overflow-y-auto", children: items.map((item, index2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          SortablePlaylistItem,
          {
            index: index2,
            item,
            resource: resources[item.resourceId],
            onRemove
          },
          item.id ?? index2
        );
      }) })
    ] });
  },
  {
    withRef: false,
    helperClass: "sortable-playlist-item-helper"
  }
);
const Detail = ({ id: id2, onChange }) => {
  const { t: t2 } = useTranslation();
  const [playlist, setPlaylist] = reactExports.useState(null);
  const [resourceMap, setResourceMap] = reactExports.useState({});
  const [loading, setLoading] = reactExports.useState(true);
  const [error2, setError] = reactExports.useState(null);
  reactExports.useEffect(() => {
    let isMounted = true;
    const loadPlaylistData = async () => {
      var _a2;
      try {
        setLoading(true);
        setError(null);
        const playlistResponse = await BApi$1.playlist.getPlaylist(id2);
        const pl2 = playlistResponse.data;
        if (!isMounted)
          return;
        if (!pl2) {
          setError("Playlist data is empty");
          return;
        }
        setPlaylist(pl2);
        const resourceIds = (((_a2 = pl2.items) == null ? void 0 : _a2.map((item) => item.resourceId)) ?? []).filter((resourceId) => resourceId != null);
        const distinctResourceIds = [...new Set(resourceIds)];
        if (distinctResourceIds.length > 0) {
          const resourcesResponse = await BApi$1.resource.getResourcesByKeys({
            ids: distinctResourceIds
          });
          if (!isMounted)
            return;
          const resourceMap2 = (resourcesResponse.data || []).reduce((acc, resource) => {
            acc[resource.id] = resource;
            return acc;
          }, {});
          setResourceMap(resourceMap2);
        }
      } catch (err) {
        if (!isMounted)
          return;
        setError(
          err instanceof Error ? err.message : "Failed to load playlist"
        );
      } finally {
        if (isMounted) {
          setLoading(false);
        }
      }
    };
    loadPlaylistData();
    return () => {
      isMounted = false;
    };
  }, [id2]);
  const patchPlaylist = reactExports.useCallback(
    (patches = {}) => {
      if (!playlist)
        return;
      const updatedPlaylist = {
        ...playlist,
        ...patches
      };
      setPlaylist(updatedPlaylist);
      onChange(updatedPlaylist);
    },
    [playlist, onChange]
  );
  const handleRemoveItem = reactExports.useCallback(
    (itemToRemove) => {
      if (!(playlist == null ? void 0 : playlist.items))
        return;
      patchPlaylist({
        items: playlist.items.filter((item) => item !== itemToRemove)
      });
    },
    [playlist == null ? void 0 : playlist.items, patchPlaylist]
  );
  const handleSortEnd = reactExports.useCallback(
    ({ newIndex, oldIndex }) => {
      if (!(playlist == null ? void 0 : playlist.items))
        return;
      const items = [...playlist.items];
      const [movedItem] = items.splice(oldIndex, 1);
      items.splice(newIndex, 0, movedItem);
      patchPlaylist({ items });
    },
    [playlist == null ? void 0 : playlist.items, patchPlaylist]
  );
  const handleNameChange = reactExports.useCallback(
    (name2) => {
      patchPlaylist({ name: name2 });
    },
    [patchPlaylist]
  );
  const handleIntervalChange = reactExports.useCallback(
    (interval) => {
      patchPlaylist({ interval });
    },
    [patchPlaylist]
  );
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-5 text-gray-500", children: "Loading playlist..." }) });
  }
  if (error2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-center items-center py-5 px-4 text-red-600 bg-red-50 rounded border border-red-200", children: [
      "Error: ",
      error2
    ] }) });
  }
  if (!playlist) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center py-5 px-4 text-red-600 bg-red-50 rounded border border-red-200", children: "Playlist not found" }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 space-y-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          fullWidth: false,
          label: t2("Name"),
          size: "sm",
          value: playlist.name || "",
          onValueChange: handleNameChange
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          endContent: instance.t("ms"),
          fullWidth: false,
          label: t2("Interval"),
          min: 0,
          size: "sm",
          value: playlist.interval || 0,
          onValueChange: handleIntervalChange
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      SortablePlaylistItemList,
      {
        useDragHandle: true,
        items: (playlist == null ? void 0 : playlist.items) ?? [],
        resources: resourceMap,
        onRemove: handleRemoveItem,
        onSortEnd: handleSortEnd
      }
    ) })
  ] });
};
Detail.displayName = "Detail";
const Collection = ({ addingResourceId }) => {
  const [playlists, setPlaylists] = reactExports.useState([]);
  const { t: t2 } = useTranslation();
  const { createPortal, createWindow } = useBakabaseContext();
  reactExports.useEffect(() => {
    loadPlaylists();
  }, []);
  const loadPlaylists = reactExports.useCallback(() => {
    BApi$1.playlist.getAllPlaylists().then((a2) => {
      setPlaylists(a2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full", children: [
    playlists.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-400 text-lg mb-2", children: t2("No playlists found") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-300 text-sm", children: t2("Create your first playlist to get started") })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: playlists.map((pl2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-between hover:bg-default-50 rounded-medium transition-colors", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              const dialog = createPortal(Modal, {
                defaultVisible: true,
                title: t2("Details of {{name}}", {
                  name: pl2.name
                }),
                size: "4xl",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Detail,
                  {
                    id: pl2.id,
                    onChange: (p2) => {
                      Object.assign(pl2, p2);
                      console.log(playlists, pl2, p2);
                      setPlaylists([...playlists]);
                    }
                  }
                ),
                onOk: () => BApi$1.playlist.putPlaylist(pl2.id, pl2).then((a2) => {
                  if (!a2.code) {
                    dialog.destroy();
                    return a2;
                  }
                  throw new Error(a2.message);
                })
              });
            },
            children: [
              pl2.name,
              " (",
              (pl2.items || []).length,
              ")"
            ]
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
          addingResourceId && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "bordered",
              onPress: () => {
                pl2.items ?? (pl2.items = []);
                pl2.items.push({
                  resourceId: addingResourceId,
                  type: PlaylistItemType.Resource
                });
                BApi$1.playlist.putPlaylist(pl2.id, pl2).then(() => {
                  loadPlaylists();
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
                t2("Add it here")
              ]
            }
          ),
          pl2.items && pl2.items.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "success",
              size: "sm",
              variant: "light",
              onPress: () => {
                BApi$1.playlist.getPlaylistFiles(pl2.id).then((a2) => {
                  if (a2.data) {
                    if (a2.data.length > 0) {
                      const entries = [];
                      for (let x2 = 0; x2 < pl2.items.length; x2++) {
                        pl2.items[x2];
                        const currentItemFiles = a2.data[x2];
                        if (currentItemFiles) {
                          for (const filePath of a2.data[x2]) {
                            const name2 = filePath.split(/[/\\]/).pop() || filePath;
                            const ext = name2.includes(".") ? name2.split(".").pop() : void 0;
                            entries.push({
                              path: filePath,
                              name: name2,
                              meaningfulName: name2,
                              ext,
                              type: IwFsType.Unknown,
                              passwordsForDecompressing: []
                            });
                          }
                        }
                      }
                      createWindow(MediaPlayer, {
                        entries,
                        interval: pl2.interval,
                        autoPlay: true
                      }, {
                        title: pl2.name,
                        persistent: true
                      });
                    } else {
                      toast.danger(t2("No playable contents"));
                    }
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-lg" })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Sure to delete?"),
                  children: t2(
                    "Are you sure you want to delete this playlist?"
                  ),
                  onOk: () => BApi$1.playlist.deletePlaylist(pl2.id).then((a2) => {
                    if (!a2.code) {
                      loadPlaylists();
                      return a2;
                    }
                    throw new Error(a2.message);
                  })
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
            }
          )
        ] })
      ] }) }, pl2.id || i2),
      i2 < playlists.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {})
    ] })) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "mt-1" }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "solid",
        onPress: () => {
          let name2;
          createPortal(Modal, {
            defaultVisible: true,
            title: t2("Creating playlist"),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("Playlist Name"),
                placeholder: t2("Enter playlist name"),
                onValueChange: (v2) => {
                  name2 = v2;
                }
              }
            ),
            onOk: async () => {
              if (!name2) {
                toast.danger(t2("Name can not be empty"));
                throw new Error("Name can not be empty");
              }
              const a2 = await BApi$1.playlist.addPlaylist({
                name: name2
              });
              if (!a2.code) {
                loadPlaylists();
              }
            }
          });
        },
        children: t2("Create")
      }
    ) })
  ] });
};
Collection.displayName = "Collection";
const Operations = ({ resource, coverRef, reload }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal, createWindow } = useBakabaseContext();
  const uiOptions = useUiOptionsStore((state) => state.data);
  const displayOperations = reactExports.useMemo(() => {
    var _a3;
    const ops = (_a3 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _a3.displayOperations;
    if (!ops || ops.length === 0) {
      return ["aggregate"];
    }
    return ops;
  }, [(_a2 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _a2.displayOperations]);
  const showResourceMediaPlayer = () => {
    BApi$1.file.getAllFiles({
      path: resource.path
    }).then((a2) => {
      if (!a2.code && a2.data) {
        if (a2.data.length == 0) {
          return toast.default(t2("No files to preview"));
        }
        const files = a2.data;
        const entries = files.map(
          (path) => {
            const name2 = path.split(/[/\\]/).pop() || path;
            const ext = name2.includes(".") ? name2.split(".").pop() : void 0;
            return {
              path,
              name: name2,
              meaningfulName: name2,
              ext,
              type: IwFsType.Unknown,
              passwordsForDecompressing: []
            };
          }
        );
        createWindow(
          MediaPlayer,
          {
            entries,
            defaultActiveIndex: 0,
            renderOperations: (filePath, mediaType, playing, reactPlayer, image2) => {
            }
          },
          {
            title: resource.displayName,
            persistent: true
          }
        );
      }
    });
  };
  const showAggregate = displayOperations.includes("aggregate");
  const showPin = displayOperations.includes("pin");
  const showOpenFolder = displayOperations.includes("openFolder");
  const showEnhancements = displayOperations.includes("enhancements");
  const showPreview = displayOperations.includes("preview");
  const showAddToPlaylist = displayOperations.includes("addToPlaylist");
  if (showAggregate) {
    const buttons = [];
    if (showPin) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: resource.pinned ? "warning" : "default",
            size: "sm",
            title: resource.pinned ? t2("Unpin") : t2("Pin"),
            onClick: () => {
              BApi$1.resource.pinResource(resource.id, { pin: !resource.pinned }).then((r2) => {
                reload == null ? void 0 : reload();
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: "text-lg" })
          },
          "pin"
        )
      );
    }
    if (showOpenFolder) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Open folder"),
            onClick: () => BApi$1.tool.openFileOrDirectory({
              path: resource.path,
              openInDirectory: resource.isFile
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-lg" })
          },
          "openFolder"
        )
      );
    }
    if (showEnhancements) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Enhancements"),
            onClick: () => {
              BApi$1.resource.getResourceEnhancements(resource.id, {
                additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
              }).then((t22) => {
                createPortal(ResourceEnhancementsModal, {
                  resourceId: resource.id,
                  // @ts-ignore
                  enhancements: t22.data || []
                });
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: "text-lg" })
          },
          "enhancements"
        )
      );
    }
    if (showPreview) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Preview"),
            onClick: showResourceMediaPlayer,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: "text-lg" })
          },
          "preview"
        )
      );
    }
    if (showAddToPlaylist) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Add to playlist"),
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Add to playlist"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, { addingResourceId: resource.id }),
                style: { minWidth: 600 },
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1, { className: "text-lg" })
          },
          "addToPlaylist"
        )
      );
    }
    if (buttons.length === 0) {
      buttons.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: resource.pinned ? "warning" : "default",
            size: "sm",
            title: resource.pinned ? t2("Unpin") : t2("Pin"),
            onClick: () => {
              BApi$1.resource.pinResource(resource.id, { pin: !resource.pinned }).then((r2) => {
                reload == null ? void 0 : reload();
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: "text-lg" })
          },
          "pin"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Open folder"),
            onClick: () => BApi$1.tool.openFileOrDirectory({
              path: resource.path,
              openInDirectory: resource.isFile
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-lg" })
          },
          "openFolder"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Enhancements"),
            onClick: () => {
              BApi$1.resource.getResourceEnhancements(resource.id, {
                additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
              }).then((t22) => {
                createPortal(ResourceEnhancementsModal, {
                  resourceId: resource.id,
                  // @ts-ignore
                  enhancements: t22.data || []
                });
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: "text-lg" })
          },
          "enhancements"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Preview"),
            onClick: showResourceMediaPlayer,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: "text-lg" })
          },
          "preview"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            title: t2("Add to playlist"),
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Add to playlist"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, { addingResourceId: resource.id }),
                style: { minWidth: 600 },
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1, { className: "text-lg" })
          },
          "addToPlaylist"
        )
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      PopoverComponent,
      {
        trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            className: "absolute top-1 right-1 z-10 opacity-0 group-hover/resource:opacity-100",
            size: "sm",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$i, { className: "text-lg" })
          }
        ),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-1 py-1 rounded", children: buttons })
      }
    );
  }
  const individualButtons = [];
  const buttonClassName = "min-w-6 w-6 h-6 bg-transparent hover:bg-white/20";
  const iconClassName = "text-sm";
  if (showPin) {
    individualButtons.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: buttonClassName,
          color: resource.pinned ? "warning" : "default",
          title: resource.pinned ? t2("Unpin") : t2("Pin"),
          onClick: () => {
            BApi$1.resource.pinResource(resource.id, { pin: !resource.pinned }).then((r2) => {
              reload == null ? void 0 : reload();
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: iconClassName })
        },
        "pin"
      )
    );
  }
  if (showOpenFolder) {
    individualButtons.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: buttonClassName,
          title: t2("Open folder"),
          onClick: () => BApi$1.tool.openFileOrDirectory({
            path: resource.path,
            openInDirectory: resource.isFile
          }),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: iconClassName })
        },
        "openFolder"
      )
    );
  }
  if (showEnhancements) {
    individualButtons.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: buttonClassName,
          title: t2("Enhancements"),
          onClick: () => {
            BApi$1.resource.getResourceEnhancements(resource.id, {
              additionalItem: EnhancementAdditionalItem.GeneratedPropertyValue
            }).then((t22) => {
              createPortal(ResourceEnhancementsModal, {
                resourceId: resource.id,
                // @ts-ignore
                enhancements: t22.data || []
              });
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: iconClassName })
        },
        "enhancements"
      )
    );
  }
  if (showPreview) {
    individualButtons.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: buttonClassName,
          title: t2("Preview"),
          onClick: showResourceMediaPlayer,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: iconClassName })
        },
        "preview"
      )
    );
  }
  if (showAddToPlaylist) {
    individualButtons.push(
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          className: buttonClassName,
          title: t2("Add to playlist"),
          onClick: () => {
            createPortal(Modal, {
              defaultVisible: true,
              title: t2("Add to playlist"),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, { addingResourceId: resource.id }),
              style: { minWidth: 600 },
              footer: {
                actions: ["cancel"]
              }
            });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1, { className: iconClassName })
        },
        "addToPlaylist"
      )
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      className: "absolute top-1 right-1 z-10 flex gap-0.5 p-0.5\n                 rounded-md bg-black/40 backdrop-blur-sm\n                 opacity-0 group-hover/resource:opacity-100 transition-opacity",
      children: individualButtons
    }
  );
};
Operations.displayName = "Operations";
buildLogger("MediaLibraryMultiSelector");
const MediaLibraryMultiSelector = (props) => {
  const { t: t2 } = useTranslation();
  const { resourceIds, onSubmit } = props;
  const [visible, setVisible] = reactExports.useState(true);
  const [loading, setLoading] = reactExports.useState(true);
  const [submitting, setSubmitting] = reactExports.useState(false);
  const [libraries, setLibraries] = reactExports.useState([]);
  const [originalMappings, setOriginalMappings] = reactExports.useState({});
  const [currentAssociations, setCurrentAssociations] = reactExports.useState({});
  const init2 = async () => {
    setLoading(true);
    try {
      const mlResponse = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
      const mls = mlResponse.data ?? [];
      setLibraries(
        mls.map((ml2) => ({
          id: ml2.id,
          name: ml2.name || `Library ${ml2.id}`
        }))
      );
      const mappingsResponse = await BApi$1.resource.getResourceMediaLibraryMappings(resourceIds);
      const rawMappings = mappingsResponse.data ?? {};
      const mappings = {};
      for (const [resourceIdStr, mlIds] of Object.entries(rawMappings)) {
        const resourceId = parseInt(resourceIdStr, 10);
        mappings[resourceId] = mlIds ?? [];
      }
      setOriginalMappings(mappings);
      const associations = {};
      for (const ml2 of mls) {
        associations[ml2.id] = /* @__PURE__ */ new Set();
      }
      for (const [resourceId, mlIds] of Object.entries(mappings)) {
        const resId = parseInt(resourceId.toString(), 10);
        for (const mlId of mlIds) {
          if (associations[mlId]) {
            associations[mlId].add(resId);
          }
        }
      }
      setCurrentAssociations(associations);
    } finally {
      setLoading(false);
    }
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const getAssociationState = (libraryId) => {
    const associatedResources = currentAssociations[libraryId];
    if (!associatedResources || associatedResources.size === 0) {
      return "none";
    }
    if (associatedResources.size === resourceIds.length) {
      return "full";
    }
    return "partial";
  };
  const handleLibraryClick = (libraryId) => {
    const state = getAssociationState(libraryId);
    setCurrentAssociations((prev2) => {
      const newAssociations = { ...prev2 };
      const newSet = new Set(prev2[libraryId]);
      switch (state) {
        case "none":
          for (const resourceId of resourceIds) {
            newSet.add(resourceId);
          }
          break;
        case "partial":
          for (const resourceId of resourceIds) {
            newSet.add(resourceId);
          }
          break;
        case "full":
          newSet.clear();
          break;
      }
      newAssociations[libraryId] = newSet;
      return newAssociations;
    });
  };
  const handleReset = () => {
    const associations = {};
    for (const lib2 of libraries) {
      associations[lib2.id] = /* @__PURE__ */ new Set();
    }
    for (const [resourceIdStr, mlIds] of Object.entries(originalMappings)) {
      const resourceId = parseInt(resourceIdStr, 10);
      for (const mlId of mlIds) {
        if (associations[mlId]) {
          associations[mlId].add(resourceId);
        }
      }
    }
    setCurrentAssociations(associations);
  };
  const hasChanges = reactExports.useMemo(() => {
    for (const lib2 of libraries) {
      const original = /* @__PURE__ */ new Set();
      for (const [resourceIdStr, mlIds] of Object.entries(originalMappings)) {
        const resourceId = parseInt(resourceIdStr, 10);
        if (mlIds.includes(lib2.id)) {
          original.add(resourceId);
        }
      }
      const current = currentAssociations[lib2.id] || /* @__PURE__ */ new Set();
      if (original.size !== current.size)
        return true;
      for (const id2 of original) {
        if (!current.has(id2))
          return true;
      }
    }
    return false;
  }, [libraries, originalMappings, currentAssociations]);
  const handleSubmit = async () => {
    setSubmitting(true);
    try {
      const mediaLibraryIds = libraries.filter((lib2) => {
        const state = getAssociationState(lib2.id);
        return state === "full";
      }).map((lib2) => lib2.id);
      await BApi$1.resource.setResourceMediaLibraries({
        ids: resourceIds,
        mediaLibraryIds
      });
      onSubmit == null ? void 0 : onSubmit();
      setVisible(false);
    } finally {
      setSubmitting(false);
    }
  };
  const renderLibraryButton = (lib2) => {
    const state = getAssociationState(lib2.id);
    let icon;
    let color2;
    let tooltipText;
    switch (state) {
      case "full":
        icon = /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1p, { className: "text-success" });
        color2 = "success";
        tooltipText = t2("All selected resources are in this library");
        break;
      case "partial":
        icon = /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$s, { className: "text-warning" });
        color2 = "warning";
        tooltipText = t2("Some selected resources are in this library");
        break;
      case "none":
      default:
        icon = /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-default-400" });
        color2 = "default";
        tooltipText = t2("No selected resources are in this library");
        break;
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tooltipText, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        className: "m-1",
        color: color2,
        size: "sm",
        startContent: icon,
        variant: state === "none" ? "flat" : "solid",
        onClick: () => handleLibraryClick(lib2.id),
        children: lib2.name
      }
    ) }, lib2.id);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      title: t2("Set media libraries for {{count}} resources", {
        count: resourceIds.length
      }),
      visible,
      onClose: () => setVisible(false),
      onDestroyed: props.onDestroyed,
      children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center py-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4 text-sm text-default-500", children: t2(
          "Click to toggle. Green = all associated, Yellow = partially associated, Gray = not associated"
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap", children: libraries.map((lib2) => renderLibraryButton(lib2)) }),
        libraries.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-4 text-center text-default-400", children: t2("No media libraries found") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-6 flex justify-end gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "default",
              disabled: !hasChanges,
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$4, {}),
              variant: "flat",
              onClick: handleReset,
              children: t2("Reset")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              disabled: !hasChanges,
              isLoading: submitting,
              onClick: handleSubmit,
              children: t2("Submit")
            }
          )
        ] })
      ] })
    }
  );
};
MediaLibraryMultiSelector.displayName = "MediaLibraryMultiSelector";
function $0d86e9c8f07f9a7b$export$79c0c687a5963b0a(opts2, dispatch) {
  let { cursor, getKey: getKey3 } = opts2;
  return {
    setSelectedKeys(selectedKeys) {
      dispatch((state) => ({
        ...state,
        selectedKeys
      }));
    },
    setFilterText(filterText) {
      dispatch((state) => ({
        ...state,
        filterText
      }));
    },
    insert(index2, ...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, index2, ...values));
    },
    insertBefore(key, ...values) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => (getKey3 === null || getKey3 === void 0 ? void 0 : getKey3(item)) === key);
        if (index2 === -1) {
          if (state.items.length === 0)
            index2 = 0;
          else
            return state;
        }
        return $0d86e9c8f07f9a7b$var$insert(state, index2, ...values);
      });
    },
    insertAfter(key, ...values) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => (getKey3 === null || getKey3 === void 0 ? void 0 : getKey3(item)) === key);
        if (index2 === -1) {
          if (state.items.length === 0)
            index2 = 0;
          else
            return state;
        }
        return $0d86e9c8f07f9a7b$var$insert(state, index2 + 1, ...values);
      });
    },
    prepend(...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, 0, ...values));
    },
    append(...values) {
      dispatch((state) => $0d86e9c8f07f9a7b$var$insert(state, state.items.length, ...values));
    },
    remove(...keys2) {
      dispatch((state) => {
        let keySet = new Set(keys2);
        let items = state.items.filter((item) => !keySet.has(getKey3(item)));
        let selection = "all";
        if (state.selectedKeys !== "all") {
          selection = new Set(state.selectedKeys);
          for (let key of keys2)
            selection.delete(key);
        }
        if (cursor == null && items.length === 0)
          selection = /* @__PURE__ */ new Set();
        return {
          ...state,
          items,
          selectedKeys: selection
        };
      });
    },
    removeSelectedItems() {
      dispatch((state) => {
        if (state.selectedKeys === "all")
          return {
            ...state,
            items: [],
            selectedKeys: /* @__PURE__ */ new Set()
          };
        let selectedKeys = state.selectedKeys;
        let items = state.items.filter((item) => !selectedKeys.has(getKey3(item)));
        return {
          ...state,
          items,
          selectedKeys: /* @__PURE__ */ new Set()
        };
      });
    },
    move(key, toIndex) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item2) => getKey3(item2) === key);
        if (index2 === -1)
          return state;
        let copy2 = state.items.slice();
        let [item] = copy2.splice(index2, 1);
        copy2.splice(toIndex, 0, item);
        return {
          ...state,
          items: copy2
        };
      });
    },
    moveBefore(key, keys2) {
      dispatch((state) => {
        let toIndex = state.items.findIndex((item) => getKey3(item) === key);
        if (toIndex === -1)
          return state;
        let keyArray = Array.isArray(keys2) ? keys2 : [
          ...keys2
        ];
        let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey3(item) === key2)).sort((a2, b2) => a2 - b2);
        return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex);
      });
    },
    moveAfter(key, keys2) {
      dispatch((state) => {
        let toIndex = state.items.findIndex((item) => getKey3(item) === key);
        if (toIndex === -1)
          return state;
        let keyArray = Array.isArray(keys2) ? keys2 : [
          ...keys2
        ];
        let indices = keyArray.map((key2) => state.items.findIndex((item) => getKey3(item) === key2)).sort((a2, b2) => a2 - b2);
        return $0d86e9c8f07f9a7b$var$move(state, indices, toIndex + 1);
      });
    },
    update(key, newValue) {
      dispatch((state) => {
        let index2 = state.items.findIndex((item) => getKey3(item) === key);
        if (index2 === -1)
          return state;
        return {
          ...state,
          items: [
            ...state.items.slice(0, index2),
            newValue,
            ...state.items.slice(index2 + 1)
          ]
        };
      });
    }
  };
}
function $0d86e9c8f07f9a7b$var$insert(state, index2, ...values) {
  return {
    ...state,
    items: [
      ...state.items.slice(0, index2),
      ...values,
      ...state.items.slice(index2)
    ]
  };
}
function $0d86e9c8f07f9a7b$var$move(state, indices, toIndex) {
  toIndex -= indices.filter((index2) => index2 < toIndex).length;
  let moves = indices.map((from2) => ({
    from: from2,
    to: toIndex++
  }));
  for (let i2 = 0; i2 < moves.length; i2++) {
    let a2 = moves[i2].from;
    for (let j2 = i2; j2 < moves.length; j2++) {
      let b2 = moves[j2].from;
      if (b2 > a2)
        moves[j2].from--;
    }
  }
  for (let i2 = 0; i2 < moves.length; i2++) {
    let a2 = moves[i2];
    for (let j2 = moves.length - 1; j2 > i2; j2--) {
      let b2 = moves[j2];
      if (b2.from < a2.to)
        a2.to++;
      else
        b2.from++;
    }
  }
  let copy2 = state.items.slice();
  for (let move2 of moves) {
    let [item] = copy2.splice(move2.from, 1);
    copy2.splice(move2.to, 0, item);
  }
  return {
    ...state,
    items: copy2
  };
}
function $f86e6c1ec7da6ebb$var$reducer(data, action) {
  let selectedKeys;
  switch (data.state) {
    case "idle":
    case "error":
      switch (action.type) {
        case "loading":
        case "loadingMore":
        case "sorting":
        case "filtering":
          var _action_filterText, _action_sortDescriptor;
          return {
            ...data,
            filterText: (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
            abortController: action.abortController
          };
        case "update":
          var _action_updater;
          return {
            ...data,
            ...(_action_updater = action.updater) === null || _action_updater === void 0 ? void 0 : _action_updater.call(action, data)
          };
        case "success":
        case "error":
          return data;
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    case "loading":
    case "sorting":
    case "filtering":
      switch (action.type) {
        case "success":
          if (action.abortController !== data.abortController)
            return data;
          var _action_selectedKeys;
          selectedKeys = (_action_selectedKeys = action.selectedKeys) !== null && _action_selectedKeys !== void 0 ? _action_selectedKeys : data.selectedKeys;
          var _action_filterText1, _action_items, _action_sortDescriptor1;
          return {
            ...data,
            filterText: (_action_filterText1 = action.filterText) !== null && _action_filterText1 !== void 0 ? _action_filterText1 : data.filterText,
            state: "idle",
            items: [
              ...(_action_items = action.items) !== null && _action_items !== void 0 ? _action_items : []
            ],
            selectedKeys: selectedKeys === "all" ? "all" : new Set(selectedKeys),
            sortDescriptor: (_action_sortDescriptor1 = action.sortDescriptor) !== null && _action_sortDescriptor1 !== void 0 ? _action_sortDescriptor1 : data.sortDescriptor,
            abortController: void 0,
            cursor: action.cursor
          };
        case "error":
          if (action.abortController !== data.abortController)
            return data;
          return {
            ...data,
            state: "error",
            error: action.error,
            abortController: void 0
          };
        case "loading":
        case "loadingMore":
        case "sorting":
        case "filtering":
          var _data_abortController;
          (_data_abortController = data.abortController) === null || _data_abortController === void 0 ? void 0 : _data_abortController.abort();
          var _action_filterText2;
          return {
            ...data,
            filterText: (_action_filterText2 = action.filterText) !== null && _action_filterText2 !== void 0 ? _action_filterText2 : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            abortController: action.abortController
          };
        case "update":
          var _action_updater1;
          return {
            ...data,
            ...(_action_updater1 = action.updater) === null || _action_updater1 === void 0 ? void 0 : _action_updater1.call(action, data)
          };
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    case "loadingMore":
      switch (action.type) {
        case "success":
          var _action_selectedKeys1;
          selectedKeys = data.selectedKeys === "all" || action.selectedKeys === "all" ? "all" : /* @__PURE__ */ new Set([
            ...data.selectedKeys,
            ...(_action_selectedKeys1 = action.selectedKeys) !== null && _action_selectedKeys1 !== void 0 ? _action_selectedKeys1 : []
          ]);
          var _action_items1, _action_sortDescriptor2;
          return {
            ...data,
            state: "idle",
            items: [
              ...data.items,
              ...(_action_items1 = action.items) !== null && _action_items1 !== void 0 ? _action_items1 : []
            ],
            selectedKeys,
            sortDescriptor: (_action_sortDescriptor2 = action.sortDescriptor) !== null && _action_sortDescriptor2 !== void 0 ? _action_sortDescriptor2 : data.sortDescriptor,
            abortController: void 0,
            cursor: action.cursor
          };
        case "error":
          if (action.abortController !== data.abortController)
            return data;
          return {
            ...data,
            state: "error",
            error: action.error
          };
        case "loading":
        case "sorting":
        case "filtering":
          var _data_abortController1;
          (_data_abortController1 = data.abortController) === null || _data_abortController1 === void 0 ? void 0 : _data_abortController1.abort();
          var _action_filterText3;
          return {
            ...data,
            filterText: (_action_filterText3 = action.filterText) !== null && _action_filterText3 !== void 0 ? _action_filterText3 : data.filterText,
            state: action.type,
            // Reset items to an empty list if loading, but not when sorting.
            items: action.type === "loading" ? [] : data.items,
            abortController: action.abortController
          };
        case "loadingMore":
          var _action_abortController;
          (_action_abortController = action.abortController) === null || _action_abortController === void 0 ? void 0 : _action_abortController.abort();
          return data;
        case "update":
          var _action_updater2;
          return {
            ...data,
            ...(_action_updater2 = action.updater) === null || _action_updater2 === void 0 ? void 0 : _action_updater2.call(action, data)
          };
        default:
          throw new Error(`Invalid action "${action.type}" in state "${data.state}"`);
      }
    default:
      throw new Error(`Invalid state "${data.state}"`);
  }
}
function $f86e6c1ec7da6ebb$export$bc3384a35de93d66(options) {
  const { load, sort, initialSelectedKeys, initialSortDescriptor, getKey: getKey3 = (item) => item.id || item.key, initialFilterText = "" } = options;
  let [data, dispatch] = reactExports.useReducer($f86e6c1ec7da6ebb$var$reducer, {
    state: "idle",
    error: void 0,
    items: [],
    selectedKeys: initialSelectedKeys === "all" ? "all" : new Set(initialSelectedKeys),
    sortDescriptor: initialSortDescriptor,
    filterText: initialFilterText
  });
  const dispatchFetch = async (action, fn) => {
    let abortController = new AbortController();
    try {
      dispatch({
        ...action,
        abortController
      });
      var _action_filterText;
      let previousFilterText = (_action_filterText = action.filterText) !== null && _action_filterText !== void 0 ? _action_filterText : data.filterText;
      var _action_sortDescriptor;
      let response = await fn({
        items: data.items.slice(),
        selectedKeys: data.selectedKeys,
        sortDescriptor: (_action_sortDescriptor = action.sortDescriptor) !== null && _action_sortDescriptor !== void 0 ? _action_sortDescriptor : data.sortDescriptor,
        signal: abortController.signal,
        cursor: action.type === "loadingMore" ? data.cursor : void 0,
        filterText: previousFilterText,
        loadingState: data.state
      });
      var _response_filterText;
      let filterText = (_response_filterText = response.filterText) !== null && _response_filterText !== void 0 ? _response_filterText : previousFilterText;
      dispatch({
        type: "success",
        ...response,
        abortController
      });
      if (filterText && filterText !== previousFilterText && !abortController.signal.aborted)
        dispatchFetch({
          type: "filtering",
          filterText
        }, load);
    } catch (e2) {
      dispatch({
        type: "error",
        error: e2,
        abortController
      });
    }
  };
  let didDispatchInitialFetch = reactExports.useRef(false);
  reactExports.useEffect(() => {
    if (!didDispatchInitialFetch.current) {
      dispatchFetch({
        type: "loading"
      }, load);
      didDispatchInitialFetch.current = true;
    }
  }, []);
  return {
    items: data.items,
    selectedKeys: data.selectedKeys,
    sortDescriptor: data.sortDescriptor,
    isLoading: data.state === "loading" || data.state === "loadingMore" || data.state === "sorting" || data.state === "filtering",
    loadingState: data.state,
    error: data.error,
    filterText: data.filterText,
    getItem(key) {
      return data.items.find((item) => getKey3(item) === key);
    },
    reload() {
      dispatchFetch({
        type: "loading"
      }, load);
    },
    loadMore() {
      if (data.state === "loading" || data.state === "loadingMore" || data.state === "filtering" || data.cursor == null)
        return;
      dispatchFetch({
        type: "loadingMore"
      }, load);
    },
    sort(sortDescriptor) {
      dispatchFetch({
        type: "sorting",
        sortDescriptor
      }, sort || load);
    },
    ...$0d86e9c8f07f9a7b$export$79c0c687a5963b0a({
      ...options,
      getKey: getKey3,
      cursor: data.cursor
    }, (fn) => {
      dispatch({
        type: "update",
        updater: fn
      });
    }),
    setFilterText(filterText) {
      dispatchFetch({
        type: "filtering",
        filterText
      }, load);
    }
  };
}
const log$h = buildLogger("ToResourceSelector");
const ToResourceSelector = ({ onSelect, fromResourcePath }) => {
  const { t: t2 } = useTranslation();
  const targetResourceCandidates = $f86e6c1ec7da6ebb$export$bc3384a35de93d66({
    async load({ signal, filterText }) {
      if (filterText != void 0 && filterText.length > 0) {
        const trim2 = filterText.trim();
        const res = await BApi$1.resource.searchResourcePaths(
          { keyword: trim2 },
          { signal }
        );
        const data = res.data || [];
        const isOverflow = data.length > 20;
        const listItems = data.slice(0, 20).map((d2) => ({
          id: d2.id,
          path: d2.path,
          fileName: d2.fileName
        }));
        if (isOverflow) {
          listItems.push({
            id: 0,
            fileName: t2(
              "20 results can be shown at most, please refine your search"
            )
          });
        }
        return {
          items: listItems
        };
      } else {
        return {
          items: []
        };
      }
    },
    initialFilterText: fromResourcePath
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      autocomplete_default,
      {
        fullWidth: true,
        isRequired: true,
        description: t2(
          "You may need modify the default keyword to search the expected resources"
        ),
        inputValue: targetResourceCandidates.filterText,
        isLoading: targetResourceCandidates.isLoading,
        items: targetResourceCandidates.items,
        label: t2(
          "Input keyword of the resource path to select the target resource"
        ),
        listboxProps: {
          emptyContent: t2("Can not find any resource")
        },
        radius: "none",
        size: "sm",
        onInputChange: targetResourceCandidates.setFilterText,
        onSelectionChange: (key) => {
          log$h(key);
          const id2 = parseInt(key, 10);
          if (id2) {
            onSelect(id2);
          }
        },
        children: (rc2) => {
          const isFromResource = fromResourcePath == rc2.path;
          const isDisabled = rc2.id == 0 || isFromResource;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            listbox_item_base_default,
            {
              className: `${isDisabled ? "opacity-60" : ""}`,
              isDisabled,
              startContent: isFromResource ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2("Current path") }) : void 0,
              title: rc2.path,
              children: rc2.fileName
            },
            rc2.id
          );
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        onClick: () => {
          targetResourceCandidates.setFilterText(fromResourcePath);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$f, { className: "text-base" }),
          t2("Reset keyword to path of from resource")
        ]
      }
    )
  ] });
};
ToResourceSelector.displayName = "ToResourceSelector";
const AnimatedArrow = ({
  color: color2 = "#999",
  direction = "right",
  className
}) => {
  const spans = [];
  let rotate2 = -90;
  switch (direction) {
    case "left":
      rotate2 = 90;
      break;
    case "right":
      break;
    case "up":
      rotate2 = 180;
      break;
    case "down":
      rotate2 = 0;
      break;
  }
  for (let i2 = 0; i2 < 3; i2++) {
    spans.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { borderColor: color2 } }, i2));
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `animated-arrow ${className}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "arrow", style: { transform: `rotate(${rotate2}deg)` }, children: spans }) });
};
AnimatedArrow.displayName = "AnimatedArrow";
const PageSize$1 = 100;
const defaultInputModelItem = {
  keepMediaLibrary: true,
  deleteSourceResource: false
};
const defaultInputModel = {
  items: [],
  keepMediaLibraryForAll: true,
  deleteAllSourceResources: false
};
const addItem = (inputModel, item) => {
  var _a2;
  if (!((_a2 = inputModel.items) == null ? void 0 : _a2.includes(item))) {
    inputModel.items ?? (inputModel.items = []);
    inputModel.items.push(item);
  }
};
const log$g = buildLogger("ResourceTransferModal");
const validateInputModel = (inputModel) => {
  const items = [];
  if (inputModel.items) {
    for (const item of inputModel.items) {
      if (item && item.fromId != void 0 && item.toId != void 0) {
        items.push({
          fromId: item.fromId,
          toId: item.toId,
          keepMediaLibrary: item.keepMediaLibrary ?? defaultInputModelItem.keepMediaLibrary,
          deleteSourceResource: item.deleteSourceResource ?? defaultInputModelItem.deleteSourceResource
        });
      }
    }
  }
  if (items.length > 0) {
    return {
      items,
      keepMediaLibraryForAll: inputModel.keepMediaLibraryForAll ?? defaultInputModel.keepMediaLibraryForAll,
      deleteAllSourceResources: inputModel.deleteAllSourceResources ?? defaultInputModel.deleteAllSourceResources
    };
  }
  return void 0;
};
const ResourceTransferModal = ({ fromResources, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [page, setPage] = reactExports.useState(1);
  const [resources, setResources] = reactExports.useState([]);
  const [inputModel, setInputModel] = reactExports.useState({
    ...defaultInputModel
  });
  const [resourcePool, setResourcePool] = reactExports.useState({});
  const [filterForm, setFilterForm] = reactExports.useState({});
  const [deletedSourceResourceIds, setDeletedSourceResourceIds] = reactExports.useState([]);
  reactExports.useEffect(() => {
    const resources2 = fromResources.filter(
      (x2) => {
        var _a2, _b2;
        return !deletedSourceResourceIds.includes(x2.id) && (!filterForm.showUnfinishedOnly || ((_b2 = (_a2 = inputModel.items) == null ? void 0 : _a2.find((i2) => i2.fromId == x2.id)) == null ? void 0 : _b2.toId) == void 0) && (filterForm.pathKeyword == void 0 || filterForm.pathKeyword.length == 0 || x2.path.toLowerCase().includes(filterForm.pathKeyword));
      }
    ).slice((page - 1) * PageSize$1, page * PageSize$1);
    setResources(resources2);
  }, [page, fromResources, filterForm, inputModel, deletedSourceResourceIds]);
  const TPagination = reactExports.useCallback(({ page: page2 }) => {
    const total = Math.ceil(fromResources.length / PageSize$1);
    if (total > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: page2,
          size: "sm",
          total,
          onChange: (page3) => setPage(page3)
        }
      );
    }
    return null;
  }, []);
  log$g(inputModel, !!validateInputModel(inputModel));
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      className: "max-h-[90%]",
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validateInputModel(inputModel)
        }
      },
      size: "full",
      title: t2("Transfer data of resources"),
      onDestroyed,
      onOk: async () => {
        log$g("Transferring resources", inputModel);
        const dto = validateInputModel(inputModel);
        if (dto) {
          const rsp = await BApi$1.resource.transferResourceData(dto);
          if (!rsp.code) {
            for (const item of dto.items) {
              if (dto.deleteAllSourceResources || item.deleteSourceResource) {
                deletedSourceResourceIds.push(item.fromId);
              }
            }
            setDeletedSourceResourceIds([...deletedSourceResourceIds]);
          }
        } else {
          Vt.error(t2("Invalid data"));
        }
        if (deletedSourceResourceIds.length != fromResources.length) {
          throw new Error("Prevent closing");
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 max-h-full grow overflow-hidden", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                className: "w-[360px]",
                placeholder: t2("Path keyword"),
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-base" }),
                value: filterForm.pathKeyword,
                onValueChange: (v2) => {
                  setFilterForm({
                    ...filterForm,
                    pathKeyword: standardizePath(v2 == null ? void 0 : v2.toLowerCase())
                  });
                }
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: filterForm.showUnfinishedOnly,
                size: "sm",
                onValueChange: (c2) => {
                  setFilterForm({
                    ...filterForm,
                    showUnfinishedOnly: c2
                  });
                },
                children: t2("Show unfinished only")
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: t2("Finished") }),
              fromResources.filter(
                (r2) => {
                  var _a2, _b2;
                  return ((_b2 = (_a2 = inputModel.items) == null ? void 0 : _a2.find((i2) => i2.fromId == r2.id)) == null ? void 0 : _b2.toId) != void 0;
                }
              ).length,
              "/",
              fromResources.length
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              color: "secondary",
              content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                t2(
                  "Following properties will not be transferred"
                ),
                [
                  "Parent association",
                  "Path",
                  "FileCreatedAt",
                  "FileModifiedAt"
                ].map((x2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: t2(`Property.${x2}`) }))
              ] }) }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
            }
          ) }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow overflow-y-auto", children: resources.length == 0 ? t2("No resources to be transferred") : /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 100, children: t2("#") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Source resource") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 60, children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("Resource will be overwritten") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("Operations") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: resources.map((x2, i2) => {
            var _a2;
            const item = ((_a2 = inputModel.items) == null ? void 0 : _a2.find(
              (y2) => (y2 == null ? void 0 : y2.fromId) == x2.id
            )) || {
              ...defaultInputModelItem,
              fromId: x2.id
            };
            const toResource = resourcePool[item.toId ?? 0];
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Chip,
                {
                  color: item.toId == void 0 ? "default" : "success",
                  radius: "sm",
                  children: i2 + 1
                }
              ) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { resource: x2 }),
                (inputModel.deleteAllSourceResources || item.deleteSourceResource) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-0 right-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  RefIcon$U,
                  {
                    className: "text-3xl text-danger"
                  }
                ) })
              ] }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AnimatedArrow, {}) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.toId ? toResource ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { resource: toResource }) : t2("Unknown resource") : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning", children: t2(
                "Please select a target resource on the right side"
              ) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ToResourceSelector,
                  {
                    fromResourcePath: x2.path,
                    onSelect: (id2) => {
                      item.toId = id2;
                      BApi$1.resource.getResourcesByKeys({
                        ids: [id2],
                        additionalItems: ResourceAdditionalItem.All
                      }).then((res) => {
                        var _a3;
                        const r2 = (_a3 = res.data) == null ? void 0 : _a3[0];
                        if (r2) {
                          setResourcePool({
                            ...resourcePool,
                            [id2]: r2
                          });
                        }
                      });
                      addItem(inputModel, item);
                      setInputModel({ ...inputModel });
                    }
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  checkbox_default,
                  {
                    isDisabled: inputModel.deleteAllSourceResources,
                    isSelected: inputModel.deleteAllSourceResources || item.deleteSourceResource,
                    onValueChange: (v2) => {
                      console.log(item);
                      item.deleteSourceResource = v2;
                      addItem(inputModel, item);
                      console.log(inputModel);
                      setInputModel({ ...inputModel });
                    },
                    children: t2("Delete source resource (data only)")
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  checkbox_default,
                  {
                    isDisabled: inputModel.keepMediaLibraryForAll,
                    isSelected: inputModel.keepMediaLibraryForAll || item.keepMediaLibrary,
                    onValueChange: (v2) => {
                      item.keepMediaLibrary = v2;
                      addItem(inputModel, item);
                      setInputModel({ ...inputModel });
                    },
                    children: t2(
                      "Keep associated media library information for target resource"
                    )
                  }
                )
              ] }) })
            ] });
          }) })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              checkbox_default,
              {
                isSelected: inputModel.deleteAllSourceResources,
                size: "sm",
                onValueChange: (v2) => {
                  setInputModel({
                    ...inputModel,
                    deleteAllSourceResources: v2
                  });
                },
                children: [
                  t2("Delete source resource (data only)"),
                  "(",
                  t2("For all {{count}} items", {
                    count: fromResources.length
                  }),
                  ")"
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                color: "secondary",
                content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "Category and media library of target resource will be remained by default."
                  ) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                    "By disable this options, the category and media library of target resource will be replaced with data from source resource."
                  ) })
                ] }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  checkbox_default,
                  {
                    isSelected: inputModel.keepMediaLibraryForAll,
                    size: "sm",
                    onValueChange: (v2) => {
                      setInputModel({
                        ...inputModel,
                        keepMediaLibraryForAll: v2
                      });
                    },
                    children: [
                      t2(
                        "Keep associated media library information for target resource"
                      ),
                      "(",
                      t2("For all {{count}} items", {
                        count: fromResources.length
                      }),
                      ")"
                    ]
                  }
                )
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, { page })
        ] })
      ] })
    }
  );
};
ResourceTransferModal.displayName = "ResourceTransferModal";
const makePropertyKey = (pool, id2) => `${pool}-${id2}`;
const PropertyChangeConfirmDialog = ({
  property: property2,
  affectedResources,
  newBizValue,
  onConfirm,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = reactExports.useState(true);
  const [confirming, setConfirming] = reactExports.useState(false);
  const handleConfirm = async () => {
    setConfirming(true);
    try {
      await onConfirm();
      setVisible(false);
    } finally {
      setConfirming(false);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      size: "lg",
      title: t2("property.modal.confirmPropertyChange"),
      visible,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          children: t2("common.action.confirm"),
          isLoading: confirming,
          color: "primary"
        }
      },
      onClose: () => setVisible(false),
      onDestroyed,
      onOk: handleConfirm,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t2("common.label.setting") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["pool", "name"], property: property2 }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t2("common.label.to") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "primary", variant: "flat", children: newBizValue || `(${t2("common.state.empty")})` })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-warning flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, {}),
          t2("property.warning.willOverrideValues", { count: affectedResources.length })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "max-h-[300px] overflow-auto border rounded p-3",
            style: { borderColor: "var(--bakaui-overlap-background)" },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
              affectedResources.slice(0, 20).map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "text-sm text-default-600 flex items-center gap-2",
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate max-w-[200px]", children: resource.resourceName }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: ":" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400 truncate max-w-[150px]", children: resource.oldBizValue || `(${t2("common.state.empty")})` }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "→" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-primary truncate max-w-[150px]", children: newBizValue || `(${t2("common.state.empty")})` })
                  ]
                },
                resource.resourceId
              )),
              affectedResources.length > 20 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-400", children: [
                "... ",
                t2("common.label.andCountMore", { count: affectedResources.length - 20 })
              ] })
            ] })
          }
        )
      ] })
    }
  );
};
PropertyChangeConfirmDialog.displayName = "PropertyChangeConfirmDialog";
const BulkPropertyEditor = ({
  resourceIds,
  initialResources,
  onSubmitted,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [loading, setLoading] = reactExports.useState(!initialResources);
  const [updatingProperty, setUpdatingProperty] = reactExports.useState(null);
  const [editingProperty, setEditingProperty] = reactExports.useState(null);
  const [gridColumns, setGridColumns] = reactExports.useState(6);
  const [hasAnyChanges, setHasAnyChanges] = reactExports.useState(false);
  const [resources, setResources] = reactExports.useState([]);
  const [propertyMap, setPropertyMap] = reactExports.useState(/* @__PURE__ */ new Map());
  const [aggregatedValues, setAggregatedValues] = reactExports.useState(/* @__PURE__ */ new Map());
  const loadData = reactExports.useCallback(async () => {
    setLoading(true);
    try {
      let loadedResources;
      if (initialResources && initialResources.length > 0) {
        loadedResources = initialResources;
        const [builtinPropsRsp, customPropsRsp] = await Promise.all([
          // @ts-ignore - PropertyPool flags combination
          BApi$1.property.getPropertiesByPool(PropertyPool.Reserved | PropertyPool.Internal),
          BApi$1.customProperty.getAllCustomProperties()
        ]);
        const builtinProps = builtinPropsRsp.data || [];
        const customProps = customPropsRsp.data || [];
        processLoadedData(loadedResources, builtinProps, customProps);
      } else {
        const [resourcesRsp, builtinPropsRsp, customPropsRsp] = await Promise.all([
          BApi$1.resource.getResourcesByKeys({
            ids: resourceIds,
            additionalItems: ResourceAdditionalItem.All
          }),
          // @ts-ignore - PropertyPool flags combination
          BApi$1.property.getPropertiesByPool(PropertyPool.Reserved | PropertyPool.Internal),
          BApi$1.customProperty.getAllCustomProperties()
        ]);
        loadedResources = resourcesRsp.data || [];
        const builtinProps = builtinPropsRsp.data || [];
        const customProps = customPropsRsp.data || [];
        processLoadedData(loadedResources, builtinProps, customProps);
      }
    } catch (error2) {
      console.error("Failed to load bulk editor data:", error2);
      toast.error(t2("common.error.failedToLoadData"));
    } finally {
      setLoading(false);
    }
  }, [resourceIds, initialResources, t2]);
  const processLoadedData = (loadedResources, builtinProps, customProps) => {
    try {
      loadedResources.forEach((r2) => {
        if (r2.properties) {
          Object.values(r2.properties).forEach((poolProps) => {
            Object.values(poolProps).forEach((prop) => {
              if (prop.values) {
                for (const v2 of prop.values) {
                  v2.bizValue = convertFromApiValue(v2.bizValue, prop.bizValueType);
                  v2.aliasAppliedBizValue = convertFromApiValue(v2.aliasAppliedBizValue, prop.bizValueType);
                  v2.value = convertFromApiValue(v2.value, prop.dbValueType);
                }
              }
            });
          });
        }
      });
      setResources(loadedResources);
      const propMap = /* @__PURE__ */ new Map();
      const mediaLibMultiProp = builtinProps.find(
        (p2) => p2.pool === PropertyPool.Internal && p2.id === ResourceProperty.MediaLibraryV2Multi
      );
      if (mediaLibMultiProp) {
        propMap.set(makePropertyKey(PropertyPool.Internal, mediaLibMultiProp.id), mediaLibMultiProp);
      }
      builtinProps.filter((p2) => p2.pool === PropertyPool.Reserved).forEach((p2) => {
        propMap.set(makePropertyKey(PropertyPool.Reserved, p2.id), p2);
      });
      customProps.forEach((p2) => {
        propMap.set(makePropertyKey(PropertyPool.Custom, p2.id), p2);
      });
      setPropertyMap(propMap);
      const aggValues = aggregatePropertyValues(loadedResources, propMap);
      setAggregatedValues(aggValues);
    } catch (error2) {
      console.error("Failed to process data:", error2);
      toast.error(t2("common.error.failedToProcessData"));
    }
  };
  const aggregatePropertyValues = (loadedResources, propMap) => {
    const aggValues = /* @__PURE__ */ new Map();
    propMap.forEach((property2, key) => {
      const originalValues = /* @__PURE__ */ new Map();
      const valueStrings = [];
      loadedResources.forEach((resource) => {
        var _a2, _b2;
        let dbValue = void 0;
        let bizValue = void 0;
        if (property2.pool === PropertyPool.Internal && property2.id === ResourceProperty.MediaLibraryV2Multi) {
          if (resource.mediaLibraries && resource.mediaLibraries.length > 0) {
            dbValue = resource.mediaLibraries.map((ml2) => String(ml2.id));
            bizValue = resource.mediaLibraries.map((ml2) => ml2.name);
          }
        } else {
          const resourceProp = (_b2 = (_a2 = resource.properties) == null ? void 0 : _a2[property2.pool]) == null ? void 0 : _b2[property2.id];
          if (resourceProp == null ? void 0 : resourceProp.values) {
            const manualValue = resourceProp.values.find((v2) => v2.scope === PropertyValueScope.Manual);
            if ((manualValue == null ? void 0 : manualValue.value) !== void 0) {
              dbValue = manualValue.value;
              bizValue = manualValue.bizValue ?? manualValue.aliasAppliedBizValue;
            } else {
              const firstValue = resourceProp.values.find((v2) => v2.value !== void 0);
              if (firstValue) {
                dbValue = firstValue.value;
                bizValue = firstValue.bizValue ?? firstValue.aliasAppliedBizValue;
              }
            }
          }
        }
        const serializedDb = serializeStandardValue(dbValue, property2.dbValueType);
        const serializedBiz = serializeStandardValue(bizValue, property2.bizValueType);
        originalValues.set(resource.id, {
          dbValue: serializedDb,
          bizValue: serializedBiz
        });
        valueStrings.push(serializedDb ?? "");
      });
      const nonEmptyValues = valueStrings.filter((v2) => v2 !== "" && v2 !== void 0 && v2 !== null);
      const emptyCount = valueStrings.length - nonEmptyValues.length;
      let state;
      let sharedDbValue;
      let sharedBizValue;
      if (nonEmptyValues.length === 0) {
        state = "empty";
      } else if (emptyCount > 0) {
        state = "partial";
      } else {
        const allSame = nonEmptyValues.every((v2) => v2 === nonEmptyValues[0]);
        if (allSame) {
          state = "consistent";
          const firstResource = loadedResources[0];
          const orig = originalValues.get(firstResource.id);
          sharedDbValue = orig == null ? void 0 : orig.dbValue;
          sharedBizValue = orig == null ? void 0 : orig.bizValue;
        } else {
          state = "mixed";
        }
      }
      aggValues.set(key, {
        state,
        dbValue: sharedDbValue,
        bizValue: sharedBizValue,
        originalValues
      });
    });
    return aggValues;
  };
  reactExports.useEffect(() => {
    loadData();
  }, [loadData]);
  const handleValueChange = async (property2, dbValue, bizValue) => {
    const key = makePropertyKey(property2.pool, property2.id);
    const aggValue = aggregatedValues.get(key);
    if (!aggValue)
      return;
    const affectedResources = [];
    resources.forEach((resource) => {
      const orig = aggValue.originalValues.get(resource.id);
      if ((orig == null ? void 0 : orig.dbValue) !== dbValue) {
        affectedResources.push({
          resourceId: resource.id,
          resourceName: resource.displayName || resource.fileName,
          oldBizValue: orig == null ? void 0 : orig.bizValue
        });
      }
    });
    if (affectedResources.length === 0) {
      return;
    }
    if (aggValue.state === "mixed") {
      createPortal(PropertyChangeConfirmDialog, {
        property: property2,
        affectedResources,
        newBizValue: bizValue,
        onConfirm: async () => {
          await applyPropertyChange(property2, dbValue, bizValue, affectedResources.map((r2) => r2.resourceId));
        }
      });
    } else {
      await applyPropertyChange(property2, dbValue, bizValue, affectedResources.map((r2) => r2.resourceId));
    }
  };
  const applyPropertyChange = async (property2, dbValue, bizValue, affectedResourceIds) => {
    const key = makePropertyKey(property2.pool, property2.id);
    setUpdatingProperty(key);
    try {
      const rsp = await BApi$1.resource.bulkPutResourcePropertyValue({
        resourceIds: affectedResourceIds,
        propertyId: property2.id,
        isCustomProperty: property2.pool === PropertyPool.Custom,
        value: dbValue
      });
      if (rsp.code) {
        return;
      }
      setAggregatedValues((prev2) => {
        const next2 = new Map(prev2);
        const oldAgg = prev2.get(key);
        if (oldAgg) {
          const newOriginalValues = new Map(oldAgg.originalValues);
          affectedResourceIds.forEach((id2) => {
            newOriginalValues.set(id2, { dbValue, bizValue });
          });
          const valueStrings = Array.from(newOriginalValues.values()).map((v2) => v2.dbValue ?? "");
          const nonEmptyValues = valueStrings.filter((v2) => v2 !== "" && v2 !== void 0 && v2 !== null);
          const emptyCount = valueStrings.length - nonEmptyValues.length;
          let newState;
          if (nonEmptyValues.length === 0) {
            newState = "empty";
          } else if (emptyCount > 0) {
            newState = "partial";
          } else {
            const allSame = nonEmptyValues.every((v2) => v2 === nonEmptyValues[0]);
            if (allSame) {
              newState = "consistent";
            } else {
              newState = "mixed";
            }
          }
          next2.set(key, {
            state: newState,
            dbValue: newState === "consistent" ? dbValue : void 0,
            bizValue: newState === "consistent" ? bizValue : void 0,
            originalValues: newOriginalValues
          });
        }
        return next2;
      });
      setHasAnyChanges(true);
      toast.success(t2("property.success.propertyUpdatedSuccessfully"));
    } catch (error2) {
      console.error("Failed to update property:", error2);
      toast.danger(t2("property.error.failedToUpdateProperty"));
    } finally {
      setUpdatingProperty(null);
    }
  };
  const handleClose = () => {
    if (hasAnyChanges) {
      onSubmitted == null ? void 0 : onSubmitted();
    }
    setVisible(false);
  };
  const handleNavigateToBulkModification = () => {
    createPortal(Modal, {
      title: t2("common.message.confirmLeave"),
      children: t2("bulkModification.message.navigateToPageConfirmation"),
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          children: t2("common.action.leave"),
          autoFocus: true
        },
        cancelProps: {
          children: t2("common.action.stay")
        }
      },
      defaultVisible: true,
      onOk: () => {
        setVisible(false);
        navigate("/bulk-modification");
      }
    });
  };
  const groupedProperties = reactExports.useMemo(() => {
    const internal = [];
    const reserved = [];
    const custom = [];
    propertyMap.forEach((prop) => {
      switch (prop.pool) {
        case PropertyPool.Internal:
          internal.push(prop);
          break;
        case PropertyPool.Reserved:
          reserved.push(prop);
          break;
        case PropertyPool.Custom:
          custom.push(prop);
          break;
      }
    });
    return { internal, reserved, custom };
  }, [propertyMap]);
  const renderPropertyRow = (property2) => {
    const key = makePropertyKey(property2.pool, property2.id);
    const aggValue = aggregatedValues.get(key);
    const isUpdating = updatingProperty === key;
    const isEditing = editingProperty === key;
    if (!aggValue)
      return null;
    const renderValue = () => {
      if (isUpdating) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" });
      }
      switch (aggValue.state) {
        case "consistent":
        case "empty":
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            PropertyValueRenderer,
            {
              property: property2,
              dbValue: aggValue.dbValue,
              bizValue: aggValue.bizValue,
              size: "sm",
              onValueChange: (newDbValue, newBizValue) => {
                handleValueChange(property2, newDbValue, newBizValue);
              }
            }
          );
        case "partial":
        case "mixed":
          if (isEditing) {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              PropertyValueRenderer,
              {
                property: property2,
                dbValue: void 0,
                bizValue: void 0,
                size: "sm",
                defaultEditing: true,
                onValueChange: (newDbValue, newBizValue) => {
                  setEditingProperty(null);
                  handleValueChange(property2, newDbValue, newBizValue);
                }
              }
            );
          }
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              variant: "light",
              color: aggValue.state === "mixed" ? "warning" : "default",
              onPress: () => setEditingProperty(key),
              children: aggValue.state === "mixed" ? t2("common.state.multipleValues") : t2("common.state.partiallySet")
            }
          );
      }
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `grid gap-2 items-center py-1 px-2 rounded transition-colors hover:bg-default-100 ${isUpdating ? "opacity-50 pointer-events-none" : ""}`,
        style: { gridTemplateColumns: "160px 1fr" },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["pool", "name"], property: property2 }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 min-w-0", children: renderValue() })
        ]
      },
      key
    );
  };
  const renderPropertySection = (_title, properties2) => {
    if (properties2.length === 0)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: properties2.map((prop) => renderPropertyRow(prop)) });
  };
  const columnOptions = [2, 4, 6, 8];
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      size: "5xl",
      title: t2("property.modal.bulkEditProperties"),
      visible,
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-500", children: [
          t2("bulkModification.tip.forMorePowerfulModification"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              variant: "light",
              color: "primary",
              className: "ml-1",
              onPress: handleNavigateToBulkModification,
              children: t2("bulkModification.action.goToBulkModificationPage")
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleClose, children: t2("common.action.close") })
      ] }),
      onClose: handleClose,
      onDestroyed,
      className: "max-w-7xl",
      children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 h-[60vh]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-2/3 overflow-hidden flex flex-col", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500", children: t2("resource.label.resourcesSelected", { count: resources.length }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$14, { className: "text-default-400" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                radio_group_default,
                {
                  orientation: "horizontal",
                  size: "sm",
                  value: String(gridColumns),
                  onValueChange: (v2) => setGridColumns(parseInt(v2, 10)),
                  children: columnOptions.map((col) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(col), children: col }, col))
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "flex-1 overflow-auto border rounded p-1",
              style: { borderColor: "var(--bakaui-overlap-background)" },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "grid gap-1",
                  style: { gridTemplateColumns: `repeat(${gridColumns}, 1fr)` },
                  children: resources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { resource }, resource.id))
                }
              )
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex flex-col min-w-0", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-1", children: t2("common.label.properties") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: "flex-1 overflow-auto border rounded",
              style: { borderColor: "var(--bakaui-overlap-background)" },
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-0.5 py-1", children: [
                renderPropertySection(t2("common.label.mediaLibrary"), groupedProperties.internal),
                groupedProperties.internal.length > 0 && groupedProperties.reserved.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-0.5" }),
                renderPropertySection(t2("common.label.reservedProperties"), groupedProperties.reserved),
                (groupedProperties.internal.length > 0 || groupedProperties.reserved.length > 0) && groupedProperties.custom.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-0.5" }),
                renderPropertySection(t2("common.label.customProperties"), groupedProperties.custom),
                propertyMap.size === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-default-400 py-4", children: t2("property.empty.noPropertiesAvailable") })
              ] })
            }
          )
        ] })
      ] })
    }
  );
};
BulkPropertyEditor.displayName = "BulkPropertyEditor";
const log$f = buildLogger("ResourceContextMenuItems");
const ContextMenuItems = ({
  selectedResourceIds,
  selectedResources,
  onSelectedResourcesChanged
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$f("inner", "click");
          createPortal(MediaLibraryMultiSelector, {
            resourceIds: selectedResourceIds,
            onSubmit: () => {
              onSelectedResourcesChanged == null ? void 0 : onSelectedResourcesChanged(selectedResourceIds);
            }
          });
        },
        onClickCapture: () => {
          log$f("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$16, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("resource.contextMenu.setMediaLibrariesForCount", {
            count: selectedResourceIds.length
          }) : t2("resource.contextMenu.setMediaLibraries")
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$f("inner", "click");
          if (selectedResources && selectedResources.length > 0) {
            createPortal(ResourceTransferModal, {
              fromResources: selectedResources
            });
          } else {
            BApi$1.resource.getResourcesByKeys({
              ids: selectedResourceIds,
              additionalItems: ResourceAdditionalItem.All
            }).then((r2) => {
              const resources = r2.data || [];
              createPortal(ResourceTransferModal, {
                fromResources: resources
              });
            });
          }
        },
        onClickCapture: () => {
          log$f("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$d, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("resource.contextMenu.transferDataOfCount", {
            count: selectedResourceIds.length
          }) : t2("resource.contextMenu.transferResourceData")
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$f("inner", "click");
          createPortal(BulkPropertyEditor, {
            resourceIds: selectedResourceIds,
            initialResources: selectedResources,
            onSubmitted: () => {
              onSelectedResourcesChanged == null ? void 0 : onSelectedResourcesChanged(selectedResourceIds);
            }
          });
        },
        onClickCapture: () => {
          log$f("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-secondary", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("resource.contextMenu.bulkEditProperties") : t2("resource.contextMenu.editProperties")
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MenuItem,
      {
        onClick: () => {
          log$f("inner", "click");
          createPortal(Modal, {
            defaultVisible: true,
            title: t2("resource.contextMenu.deleteCountResources", {
              count: selectedResourceIds.length
            }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: t2(
                "resource.contextMenu.confirmDeleteCount",
                { count: selectedResourceIds.length }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60 mt-2", children: t2("resource.contextMenu.filesWillNotBeDeleted") })
            ] }),
            onOk: async () => {
              await BApi$1.resource.deleteResourcesByKeys({
                ids: selectedResourceIds
              });
            }
          });
        },
        onClickCapture: () => {
          log$f("inner", "click capture");
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-danger", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" }),
          selectedResourceIds.length > 1 ? t2("resource.contextMenu.deleteCountResources", {
            count: selectedResourceIds.length
          }) : t2("resource.contextMenu.deleteResource")
        ] })
      }
    )
  ] });
};
ContextMenuItems.displayName = "ContextMenuItems";
const PlayButton = ({ status, onClick, tooltipContent, cacheEnabled }) => {
  const showTooltip = status === "loading" && cacheEnabled;
  const iconClass = "text-lg @[150px]:text-xl @[250px]:text-3xl";
  const buttonClass = "!w-[22cqw] !h-[22cqw] !min-w-8 !min-h-8 !max-w-16 !max-h-16 !p-0";
  const button2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      onPress: onClick,
      isIconOnly: true,
      isDisabled: status === "loading",
      className: buttonClass,
      children: status === "loading" ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: iconClass, spin: true }) : status === "not-found" ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: `${iconClass} text-warning` }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: iconClass })
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden group-hover/cover:flex absolute left-0 bottom-0 z-[1]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tooltipContent, isDisabled: !showTooltip, children: button2 }) });
};
const Resource = React$6.forwardRef((props, ref) => {
  var _a2, _b2, _c2, _d, _e, _f;
  const {
    resource,
    onTagClick = (propertyId, value2) => {
    },
    ct = new AbortController().signal,
    biggerCoverPlacement,
    style: propStyle = {},
    selected = false,
    selectionModeRef,
    onSelected = (id2, shiftKey) => {
    },
    selectedResourceIds: propsSelectedResourceIds,
    selectedResources,
    onSelectedResourcesChanged,
    debug,
    disableCoverClick = false
  } = props;
  const { createPortal } = useBakabaseContext();
  const { t: t2 } = useTranslation();
  const log3 = buildLogger(`Resource:${resource.id}|${resource.path}`);
  const renderedTimes = reactExports.useRef(0);
  renderedTimes.current += 1;
  const uiOptions = useUiOptionsStore((state) => state.data);
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  const [contextMenuIsOpen, setContextMenuIsOpen] = reactExports.useState(false);
  const [contextMenuAnchorPoint, setContextMenuAnchorPoint] = reactExports.useState({
    x: 0,
    y: 0
  });
  reactExports.useImperativeHandle(ref, () => {
    return {
      id: resource.id,
      reload,
      select: (selected2) => {
      }
    };
  }, []);
  useTraceUpdate(props, `[${resource.fileName}]`);
  const displayPropertyKeys = ((_a2 = uiOptions.resource) == null ? void 0 : _a2.displayProperties) ?? [];
  log3(`render #${renderedTimes.current}`, "displayPropertyKeys:", displayPropertyKeys.length, "hasProperties:", !!resource.properties, "propertyPools:", resource.properties ? Object.keys(resource.properties) : "(none)", "mediaLibraries:", resource.mediaLibraries, "category:", (_b2 = resource.category) == null ? void 0 : _b2.name);
  const coverRef = reactExports.useRef();
  const resourceRef = reactExports.useRef(resource);
  resourceRef.current = resource;
  const reload = reactExports.useCallback(async (ct2) => {
    var _a3;
    const currentResource = resourceRef.current;
    const newResourceRsp = await BApi$1.resource.getResourcesByKeys({
      ids: [currentResource.id],
      additionalItems: ResourceAdditionalItem.All
    });
    if (!newResourceRsp.code) {
      const nr = (newResourceRsp.data || [])[0];
      if (nr) {
        Object.keys(nr).forEach((k2) => {
          currentResource[k2] = nr[k2];
        });
        (_a3 = coverRef.current) == null ? void 0 : _a3.reload();
        forceUpdate();
      }
    } else {
      throw new Error(newResourceRsp.message);
    }
  }, [forceUpdate]);
  const onCoverClick = reactExports.useCallback(() => {
    if (disableCoverClick)
      return;
    createPortal(DetailModal, {
      id: resource.id,
      initialResource: resource,
      onDestroyed: () => {
        reload();
      }
    });
  }, [resource, disableCoverClick]);
  const renderCover = () => {
    var _a3, _b3, _c3, _d2, _e2, _f2, _g;
    const elementId = `resource-${resource.id}`;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "resource-cover-rectangle w-full max-w-full min-w-full pb-[100%] relative rounded group/cover @container [container-type:inline-size]",
        id: elementId,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            ResourceCoverMemo,
            {
              ref: coverRef,
              biggerCoverPlacement,
              coverFit: (_a3 = uiOptions.resource) == null ? void 0 : _a3.coverFit,
              disableCarousel: (_b3 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _b3.disableCoverCarousel,
              disableMediaPreviewer: (_c3 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _c3.disableMediaPreviewer,
              resource,
              showBiggerOnHover: (_d2 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _d2.showBiggerCoverWhileHover,
              onClick: onCoverClick
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-1 left-1 right-1 flex gap-1 items-center flex-wrap", children: [
            resource.tags.includes(ResourceTag.Pinned) && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, {}),
            resource.tags.includes(ResourceTag.IsParent) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.tip.isParentResource"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$17, { className: "" }) }),
            resource.tags.includes(ResourceTag.PathDoesNotExist) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.tip.fileNotExist"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$M, { className: "text-warning" }) }),
            resource.tags.includes(ResourceTag.UnknownMediaLibrary) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.tip.unknownMediaLibrary"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$T, { className: "text-warning" }) }),
            resource.playedAt && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", className: "whitespace-break-spaces h-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, {}),
              (() => {
                const playedMoment = hooks(resource.playedAt);
                const now2 = hooks();
                const diffMinutes = now2.diff(playedMoment, "minutes");
                const diffHours = now2.diff(playedMoment, "hours");
                const diffDays = now2.diff(playedMoment, "days");
                if (diffMinutes < 1) {
                  return t2("resource.label.playedJustNow");
                } else if (diffMinutes < 60) {
                  return t2("resource.label.playedMinutesAgo", { n: diffMinutes });
                } else if (diffHours < 24) {
                  return t2("resource.label.playedHoursAgo", { n: diffHours });
                } else {
                  return t2("resource.label.playedDaysAgo", { n: diffDays });
                }
              })()
            ] }) }),
            ((_e2 = uiOptions.resource) == null ? void 0 : _e2.displayResourceId) && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.label.resourceId"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: resource.id }) }),
            debug && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-base" }),
              renderedTimes.current
            ] }) })
          ] }),
          (displayPropertyKeys.length > 0 || ((_f2 = uiOptions.resource) == null ? void 0 : _f2.inlineDisplayName)) && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: "inline-flex flex-col gap-1 absolute bottom-0 right-0 items-end max-w-full max-h-full w-fit overflow-hidden",
              children: [
                displayPropertyKeys.flatMap((dpk) => {
                  var _a4, _b4, _c4, _d3, _e3;
                  const style22 = {};
                  let bizValue;
                  let bizValueType;
                  try {
                    switch (dpk.pool) {
                      case PropertyPool.Internal:
                        switch (dpk.id) {
                          case ResourceProperty.MediaLibrary:
                          case ResourceProperty.MediaLibraryV2:
                          case ResourceProperty.MediaLibraryV2Multi:
                            if (resource.mediaLibraries && resource.mediaLibraries.length > 0) {
                              return resource.mediaLibraries.map((ml2) => {
                                const mlStyle = {};
                                if (ml2.color) {
                                  mlStyle.color = ml2.color;
                                  mlStyle.backgroundColor = autoBackgroundColor(ml2.color);
                                }
                                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Chip,
                                  {
                                    className: "h-auto w-fit",
                                    radius: "sm",
                                    size: "sm",
                                    style: mlStyle,
                                    variant: "flat",
                                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      StandardValueRenderer,
                                      {
                                        type: StandardValueType.String,
                                        value: ml2.name,
                                        variant: "light"
                                      }
                                    )
                                  },
                                  `${dpk.pool}-${dpk.id}-${ml2.id}`
                                );
                              });
                            }
                            if (resource.mediaLibraryColor) {
                              style22.color = resource.mediaLibraryColor;
                              style22.backgroundColor = autoBackgroundColor(resource.mediaLibraryColor);
                            }
                            bizValue = resource.mediaLibraryName;
                            bizValueType = StandardValueType.String;
                            break;
                          case ResourceProperty.Category:
                            bizValue = (_a4 = resource.category) == null ? void 0 : _a4.name;
                            bizValueType = StandardValueType.String;
                            break;
                          case ResourceProperty.CreatedAt:
                            bizValue = hooks(resource.createdAt).format("YYYY-MM-DD");
                            bizValueType = StandardValueType.String;
                            break;
                          case ResourceProperty.PlayedAt:
                            if (resource.playedAt) {
                              bizValue = resource.playedAt;
                              bizValueType = StandardValueType.String;
                            }
                            break;
                          case ResourceProperty.FileCreatedAt:
                            bizValue = hooks(resource.fileCreatedAt).format("YYYY-MM-DD");
                            bizValueType = StandardValueType.String;
                            break;
                          case ResourceProperty.FileModifiedAt:
                            bizValue = hooks(resource.fileModifiedAt).format("YYYY-MM-DD");
                            bizValueType = StandardValueType.String;
                            break;
                        }
                        break;
                      case PropertyPool.Reserved:
                      case PropertyPool.Custom:
                        const property2 = (_c4 = (_b4 = resource.properties) == null ? void 0 : _b4[dpk.pool]) == null ? void 0 : _c4[dpk.id];
                        bizValue = (_e3 = (_d3 = property2 == null ? void 0 : property2.values) == null ? void 0 : _d3.find((x2) => x2.bizValue)) == null ? void 0 : _e3.bizValue;
                        bizValueType = property2 == null ? void 0 : property2.bizValueType;
                        break;
                    }
                  } catch (error2) {
                    log3("error occurred while rendering display property", error2);
                  }
                  log3(`displayProperty pool:${dpk.pool} id:${dpk.id} => bizValue:`, bizValue, "bizValueType:", bizValueType);
                  if (bizValue == void 0 || bizValueType == void 0) {
                    return [];
                  }
                  return [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        className: "h-auto w-fit",
                        radius: "sm",
                        size: "sm",
                        style: style22,
                        variant: "flat",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(StandardValueRenderer, { type: bizValueType, value: bizValue, variant: "light" })
                      },
                      `${dpk.pool}-${dpk.id}`
                    )
                  ];
                }),
                ((_g = uiOptions.resource) == null ? void 0 : _g.inlineDisplayName) && renderDisplayNameAndTags(true)
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            PlayControl,
            {
              PortalComponent: PlayButton,
              afterPlaying: reload,
              resource
            }
          )
        ]
      }
    );
  };
  let firstTagsValue;
  let firstTagsValuePropertyId;
  {
    const customPropertyValues = ((_c2 = resource.properties) == null ? void 0 : _c2[PropertyPool.Custom]) || {};
    Object.keys(customPropertyValues).find((idStr) => {
      var _a3;
      const id2 = parseInt(idStr, 10);
      const p2 = customPropertyValues[id2];
      if (p2.bizValueType == StandardValueType.ListTag) {
        const values = (_a3 = p2.values) == null ? void 0 : _a3.find((v2) => {
          var _a4;
          return ((_a4 = v2.aliasAppliedBizValue) == null ? void 0 : _a4.length) > 0;
        });
        if (values && displayPropertyKeys.some((dpk) => dpk.pool == PropertyPool.Custom && dpk.id == id2)) {
          firstTagsValue = values.aliasAppliedBizValue.map((id22, i2) => {
            const bvs = values.aliasAppliedBizValue;
            const bv = bvs == null ? void 0 : bvs[i2];
            return {
              value: id22,
              ...bv
            };
          });
          firstTagsValuePropertyId = id2;
          return true;
        }
      }
      return false;
    });
  }
  const style2 = {
    ...propStyle
  };
  const selectedResourceIds = (propsSelectedResourceIds ?? []).slice();
  if (!selectedResourceIds.includes(resource.id)) {
    selectedResourceIds.push(resource.id);
  }
  const renderDisplayNameAndTags = (highContrastBackground = false) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `rounded text-right ${highContrastBackground ? "" : "[container-type:inline-size]"}`,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: `${highContrastBackground ? "bg-default/70 backdrop-blur-sm text-default-700 px-1.5 py-0.5 rounded-md text-xs" : "mt-1 text-[clamp(11px,5cqw,22px)]"}`,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "select-text resource-limited-content", children: resource.displayName })
            }
          ),
          firstTagsValue && firstTagsValue.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            "div",
            {
              className: `${highContrastBackground ? "bg-default/70 backdrop-blur-sm text-default-700 px-1.5 py-0.5 rounded-md mt-1 text-xs" : "mt-1 text-[clamp(11px,5cqw,22px)]"}`,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "select-text resource-limited-content flex flex-wrap opacity-70 leading-3 gap-px", children: firstTagsValue.map((v2) => {
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  link_default,
                  {
                    className: "text-xs cursor-pointer",
                    color: "foreground",
                    underline: "none",
                    onPress: (e2) => {
                      onTagClick == null ? void 0 : onTagClick(firstTagsValuePropertyId, v2);
                    },
                    size: "sm",
                    children: [
                      "#",
                      v2.group == void 0 ? "" : `${v2.group}:`,
                      v2.name
                    ]
                  },
                  `${v2.group}:${v2.name}`
                );
              }) })
            }
          )
        ]
      }
    );
  };
  log3("render", resource);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex flex-col p-1 rounded relative group/resource resource ${props.className} ${((_d = uiOptions.resource) == null ? void 0 : _d.hideResourceBorder) ? "" : "border-2"} ${selected ? "border-primary ring-2 ring-primary/30 bg-primary/5" : ((_e = uiOptions.resource) == null ? void 0 : _e.hideResourceBorder) ? "" : "border-default-200"}`,
      "data-id": resource.id,
      role: "resource",
      style: style2,
      onClickCapture: (e2) => {
        if ((selectionModeRef == null ? void 0 : selectionModeRef.current) || e2.shiftKey) {
          onSelected(resource.id, e2.shiftKey);
          e2.preventDefault();
          e2.stopPropagation();
        }
      },
      children: [
        selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2 z-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1p, { className: "text-primary text-xl drop-shadow-md" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Operations, { coverRef: coverRef.current, reload, resource }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            onContextMenu: (e2) => {
              if (typeof document.hasFocus === "function" && !document.hasFocus())
                return;
              e2.preventDefault();
              setContextMenuAnchorPoint({
                x: e2.clientX,
                y: e2.clientY
              });
              setContextMenuIsOpen(true);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ControlledMenu,
                {
                  anchorPoint: contextMenuAnchorPoint,
                  direction: "right",
                  state: contextMenuIsOpen ? "open" : "closed",
                  onClick: (e2) => {
                    e2.preventDefault();
                    e2.stopPropagation();
                  },
                  onClose: () => setContextMenuIsOpen(false),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    ContextMenuItems,
                    {
                      selectedResourceIds,
                      selectedResources,
                      onSelectedResourcesChanged
                    }
                  )
                },
                resource.id
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
                renderCover(),
                !((_f = uiOptions.resource) == null ? void 0 : _f.inlineDisplayName) && renderDisplayNameAndTags(false)
              ] })
            ]
          }
        )
      ]
    },
    resource.id
  );
});
const ResourceMemo = React$6.memo(Resource);
ResourceMemo.displayName = "Resource";
const WelcomeSlide = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-24 h-24 mb-6 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAppstore, { className: "text-6xl text-primary" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-3xl font-bold mb-4", children: t2("onboarding.welcome.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-default-500 text-center max-w-md", children: t2("onboarding.welcome.description") })
  ] });
};
const PathMarkSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-xl" }),
      text: t2("onboarding.pathMark.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineTag, { className: "text-xl" }),
      text: t2("onboarding.pathMark.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDatabase, { className: "text-xl" }),
      text: t2("onboarding.pathMark.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-success/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-5xl text-success" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.pathMark.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.pathMark.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const ResourceProfileSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-xl" }),
      text: t2("onboarding.resourceProfile.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineThunderbolt, { className: "text-xl" }),
      text: t2("onboarding.resourceProfile.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-xl" }),
      text: t2("onboarding.resourceProfile.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-warning/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-5xl text-warning" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.resourceProfile.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.resourceProfile.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const ResourceBrowsingSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFilter, { className: "text-xl" }),
      text: t2("onboarding.resourceBrowsing.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineUnorderedList, { className: "text-xl" }),
      text: t2("onboarding.resourceBrowsing.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAppstore, { className: "text-xl" }),
      text: t2("onboarding.resourceBrowsing.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-secondary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-5xl text-secondary" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.resourceBrowsing.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.resourceBrowsing.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const FileProcessorSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileZip, { className: "text-xl" }),
      text: t2("onboarding.fileProcessor.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-xl" }),
      text: t2("onboarding.fileProcessor.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFile, { className: "text-xl" }),
      text: t2("onboarding.fileProcessor.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineThunderbolt, { className: "text-5xl text-primary" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.fileProcessor.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.fileProcessor.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const DownloaderSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlaySquare, { className: "text-xl" }),
      text: t2("onboarding.downloader.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: "text-xl" }),
      text: t2("onboarding.downloader.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCloudDownload, { className: "text-xl" }),
      text: t2("onboarding.downloader.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-danger/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDownload, { className: "text-5xl text-danger" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.downloader.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.downloader.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-danger/10 text-danger", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const FileMoverSlide = () => {
  const { t: t2 } = useTranslation();
  const features = [
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderAdd, { className: "text-xl" }),
      text: t2("onboarding.fileMover.point1")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-xl" }),
      text: t2("onboarding.fileMover.point2")
    },
    {
      icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineOrderedList, { className: "text-xl" }),
      text: t2("onboarding.fileMover.point3")
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-cyan-500/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSwap, { className: "text-5xl text-cyan-500" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2", children: t2("onboarding.fileMover.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("onboarding.fileMover.subtitle") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4 max-w-md w-full", children: features.map((feature, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "li",
      {
        className: "flex items-start gap-3 p-3 rounded-lg bg-default-100",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-cyan-500/10 text-cyan-500", children: feature.icon }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: feature.text })
        ]
      },
      index2
    )) })
  ] });
};
const CompletionSlide = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center p-8 min-h-[400px]", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-24 h-24 mb-6 flex items-center justify-center rounded-full bg-success/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-6xl text-success" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-3xl font-bold mb-4", children: t2("onboarding.completion.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-default-500 text-center max-w-md mb-6", children: t2("onboarding.completion.description") }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm text-default-400", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-base" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("onboarding.completion.hint") })
    ] })
  ] });
};
const TOTAL_SLIDES$3 = 8;
const OnboardingModal = ({ visible, onComplete }) => {
  const { t: t2 } = useTranslation();
  const carouselRef = reactExports.useRef(null);
  const [currentSlide, setCurrentSlide] = reactExports.useState(0);
  const isFirst = currentSlide === 0;
  const isLast = currentSlide === TOTAL_SLIDES$3 - 1;
  const handlePrev = () => {
    var _a2;
    (_a2 = carouselRef.current) == null ? void 0 : _a2.prev();
  };
  const handleNext = () => {
    var _a2;
    if (isLast) {
      onComplete();
    } else {
      (_a2 = carouselRef.current) == null ? void 0 : _a2.next();
    }
  };
  const handleSkip = () => {
    onComplete();
  };
  const handleSlideChange = (current) => {
    setCurrentSlide(current);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      hideCloseButton: true,
      classNames: {
        base: "max-w-[800px]"
      },
      footer: false,
      isDismissable: false,
      isKeyboardDismissDisabled: true,
      size: "4xl",
      visible,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Carousel, { ref: carouselRef, afterChange: handleSlideChange, dots: false, infinite: false, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(WelcomeSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceProfileSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceBrowsingSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileProcessorSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(DownloaderSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(FileMoverSlide, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsx(CompletionSlide, {})
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center gap-2 py-4", children: Array.from({ length: TOTAL_SLIDES$3 }).map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `w-2 h-2 rounded-full transition-all ${index2 === currentSlide ? "bg-primary w-6" : "bg-default-300"}`
          },
          index2
        )) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center px-6 pb-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onPress: handleSkip, children: t2("onboarding.skip") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isDisabled: isFirst, variant: "flat", onPress: handlePrev, children: t2("onboarding.previous") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleNext, children: isLast ? t2("onboarding.start") : t2("onboarding.next") })
          ] })
        ] })
      ] })
    }
  );
};
const ONBOARDING_KEY = "bakabase-onboarding-completed";
const useOnboarding = () => {
  const [showOnboarding, setShowOnboarding] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (typeof window === "undefined" || typeof localStorage === "undefined") {
      return;
    }
    const completed = localStorage.getItem(ONBOARDING_KEY);
    if (!completed) {
      setShowOnboarding(true);
    }
  }, []);
  const completeOnboarding = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.setItem(ONBOARDING_KEY, "true");
    }
    setShowOnboarding(false);
  }, []);
  const resetOnboarding = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.removeItem(ONBOARDING_KEY);
    }
    setShowOnboarding(true);
  }, []);
  return {
    showOnboarding,
    completeOnboarding,
    resetOnboarding
  };
};
Chart$1.register(
  CategoryScale,
  LinearScale,
  PointElement,
  LineElement,
  plugin_title,
  plugin_tooltip,
  plugin_legend,
  index$1
);
const DashboardPage = () => {
  var _a2, _b2, _c2, _d, _e;
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { showOnboarding, completeOnboarding } = useOnboarding();
  const [data, setData] = reactExports.useState(
    {}
  );
  const [property2, setProperty3] = reactExports.useState();
  const [activeTab, setActiveTab] = reactExports.useState("added");
  const [recentlyAdded, setRecentlyAdded] = reactExports.useState([]);
  const [recentlyPlayed, setRecentlyPlayed] = reactExports.useState([]);
  const [pinnedResources, setPinnedResources] = reactExports.useState([]);
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const initializedRef = reactExports.useRef(false);
  reactExports.useEffect(() => {
    BApi$1.dashboard.getStatistics().then((res) => {
      initializedRef.current = true;
      setData(res.data || {});
    });
    BApi$1.dashboard.getPropertyStatistics().then((r2) => {
      setProperty3(r2.data);
    });
    progressiveSearch(
      {
        page: 1,
        pageSize: 20,
        orders: [{ property: ResourceSearchSortableProperty.AddDt, asc: false }]
      },
      setRecentlyAdded
    );
    progressiveSearch(
      {
        page: 1,
        pageSize: 20,
        orders: [{ property: ResourceSearchSortableProperty.PlayedAt, asc: false }]
      },
      setRecentlyPlayed,
      (resources) => resources.filter((r2) => r2.playedAt)
    );
    progressiveSearch(
      {
        page: 1,
        pageSize: 20,
        tags: [ResourceTag.Pinned],
        orders: [{ property: ResourceSearchSortableProperty.AddDt, asc: false }]
      },
      setPinnedResources
    );
    BApi$1.mediaLibraryV2.getAllMediaLibraryV2().then((res) => {
      const libs = (res.data ?? []).map((lib2) => ({
        id: lib2.id,
        name: lib2.name ?? ""
      }));
      setMediaLibraries(libs);
    });
  }, []);
  const totalResources = (data.mediaLibraryResourceCounts ?? []).reduce(
    (sum, item) => sum + item.count,
    0
  );
  const libraryCount = (data.mediaLibraryResourceCounts ?? []).length;
  const thisWeekCount = ((_b2 = (_a2 = data.resourceTrending) == null ? void 0 : _a2.find((r2) => r2.offset === 0)) == null ? void 0 : _b2.count) ?? 0;
  const lastWeekCount = ((_d = (_c2 = data.resourceTrending) == null ? void 0 : _c2.find((r2) => r2.offset === -1)) == null ? void 0 : _d.count) ?? 0;
  const weekGrowth = lastWeekCount > 0 ? ((thisWeekCount - lastWeekCount) / lastWeekCount * 100).toFixed(0) : 0;
  const propertyCoverage = (property2 == null ? void 0 : property2.totalExpectedPropertyValueCount) > 0 ? (property2.totalFilledPropertyValueCount / property2.totalExpectedPropertyValueCount * 100).toFixed(1) : 0;
  const resourceScrollRef = reactExports.useRef(null);
  const handleWheelScroll = reactExports.useCallback((e2) => {
    if (resourceScrollRef.current && e2.deltaY !== 0) {
      e2.preventDefault();
      resourceScrollRef.current.scrollLeft += e2.deltaY;
    }
  }, []);
  const getCurrentResources = () => {
    switch (activeTab) {
      case "added":
        return recentlyAdded;
      case "played":
        return recentlyPlayed;
      case "pinned":
        return pinnedResources;
      default:
        return [];
    }
  };
  const currentResources = getCurrentResources();
  const StatCard = ({
    icon,
    label,
    value: value2,
    subValue,
    color: color2 = "primary"
  }) => {
    const colorClasses = {
      primary: "text-primary bg-primary/10",
      success: "text-success bg-success/10",
      warning: "text-warning bg-warning/10",
      secondary: "text-secondary bg-secondary/10"
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 p-5 bg-[var(--theme-block-background)] rounded-xl", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `p-3 rounded-lg ${colorClasses[color2]}`, children: icon }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-[var(--theme-text-subtle)]", children: label }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-2xl font-semibold", children: value2 }),
        subValue && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-[var(--theme-text-subtle)]", children: subValue })
      ] })
    ] });
  };
  const TrendChart = () => {
    var _a3;
    const getCssVariable = (variableName) => {
      if (typeof document === "undefined")
        return "";
      return getComputedStyle(document.documentElement).getPropertyValue(variableName);
    };
    const chartData = ((_a3 = data.resourceTrending) == null ? void 0 : _a3.slice().reverse()) ?? [];
    if (chartData.length === 0)
      return null;
    const primaryColor = getCssVariable("--theme-text-primary") || "#6366f1";
    const chartConfig = {
      labels: chartData.map((_24, i2) => i2.toString()),
      datasets: [
        {
          data: chartData.map((item) => item.count),
          borderColor: primaryColor,
          backgroundColor: `${primaryColor}20`,
          borderWidth: 2,
          fill: true,
          tension: 0.4,
          pointRadius: 0,
          pointHoverRadius: 4
        }
      ]
    };
    const options = {
      responsive: true,
      maintainAspectRatio: false,
      plugins: {
        legend: { display: false },
        tooltip: { enabled: false }
      },
      scales: {
        y: { display: false },
        x: { display: false }
      }
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-12 w-24", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data: chartConfig, options }) });
  };
  const TabButton = ({
    tab: tab2,
    icon,
    label,
    count
  }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "button",
    {
      className: `flex items-center gap-2 px-4 py-2 rounded-lg transition-all ${activeTab === tab2 ? "bg-primary text-primary-foreground" : "hover:bg-[var(--theme-block-background-accent)]"}`,
      onClick: () => setActiveTab(tab2),
      children: [
        icon,
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: label }),
        count > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "span",
          {
            className: `text-xs px-1.5 py-0.5 rounded-full ${activeTab === tab2 ? "bg-primary-foreground/20" : "bg-default-200"}`,
            children: count
          }
        )
      ]
    }
  );
  const handleRandomPlay = async () => {
    await BApi$1.resource.playRandomResource();
  };
  const handleBrowseLibrary = (libraryId, libraryName) => {
    const searchForm = {
      group: {
        combinator: 1,
        disabled: false,
        filters: [
          {
            propertyPool: PropertyPool.Internal,
            propertyId: InternalProperty.MediaLibraryV2Multi,
            operation: SearchOperation.In,
            dbValue: serializeStandardValue([libraryId.toString()], StandardValueType.ListString),
            bizValue: serializeStandardValue([libraryName], StandardValueType.ListString),
            disabled: false
          }
        ]
      },
      page: 1,
      pageSize: 100
    };
    navigate(`/resource?query=${encodeURIComponent(JSON.stringify(searchForm))}`);
  };
  if (!initializedRef.current) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col gap-5 p-5 overflow-auto", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(OnboardingModal, { visible: showOnboarding, onComplete: completeOnboarding }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        StatCard,
        {
          color: "primary",
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDatabase, { className: "text-2xl" }),
          label: t2("dashboard.stat.totalResources"),
          subValue: t2("dashboard.stat.libraryCount", { count: libraryCount }),
          value: totalResources.toLocaleString()
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        StatCard,
        {
          color: "success",
          icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-2xl" }),
          label: t2("dashboard.stat.thisWeek"),
          subValue: Number(weekGrowth) >= 0 ? `↑ ${weekGrowth}%` : `↓ ${Math.abs(Number(weekGrowth))}%`,
          value: `+${thisWeekCount}`
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 p-5 bg-[var(--theme-block-background)] rounded-xl", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 rounded-lg text-warning bg-warning/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRise, { className: "text-2xl" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col flex-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-[var(--theme-text-subtle)]", children: t2("dashboard.stat.trend") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-semibold", children: t2("dashboard.stat.weeks") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(TrendChart, {})
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        StatCard,
        {
          color: "secondary",
          icon: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xl font-bold", children: [
            propertyCoverage,
            "%"
          ] }),
          label: t2("dashboard.stat.dataCompleteness"),
          value: `${(property2 == null ? void 0 : property2.totalFilledPropertyValueCount) ?? 0} / ${(property2 == null ? void 0 : property2.totalExpectedPropertyValueCount) ?? 0}`
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "flex gap-3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { className: "flex-1", variant: "flat", onPress: () => navigate("/resource"), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-lg" }),
        t2("dashboard.action.search")
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { className: "flex-1", variant: "flat", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" }),
          t2("dashboard.action.browseLibraries")
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          dropdown_menu_default,
          {
            "aria-label": "Library selection",
            onAction: (key) => {
              const lib2 = mediaLibraries.find((l2) => l2.id === Number(key));
              if (lib2) {
                handleBrowseLibrary(lib2.id, lib2.name);
              }
            },
            children: mediaLibraries.map((lib2) => {
              var _a3, _b3;
              const count = ((_b3 = (_a3 = data.mediaLibraryResourceCounts) == null ? void 0 : _a3.find((c2) => c2.name === lib2.name)) == null ? void 0 : _b3.count) ?? 0;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(menu_item_base_default, { children: [
                lib2.name,
                " (",
                count,
                ")"
              ] }, lib2.id);
            })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { className: "flex-1", variant: "flat", onPress: () => navigate("/bulk-modification"), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-lg" }),
        t2("dashboard.action.bulkOperations")
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          className: "flex-1",
          color: "primary",
          isDisabled: totalResources === 0,
          variant: "flat",
          onPress: handleRandomPlay,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineThunderbolt, { className: "text-lg" }),
            t2("dashboard.action.randomPick")
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "bg-[var(--theme-block-background)] rounded-xl p-5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TabButton,
            {
              count: recentlyAdded.length,
              icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, {}),
              label: t2("dashboard.tab.recentlyAdded"),
              tab: "added"
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TabButton,
            {
              count: recentlyPlayed.length,
              icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, {}),
              label: t2("dashboard.tab.recentlyPlayed"),
              tab: "played"
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            TabButton,
            {
              count: pinnedResources.length,
              icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePushpin, {}),
              label: t2("dashboard.tab.pinned"),
              tab: "pinned"
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "light", onPress: () => navigate("/resource"), children: [
          t2("dashboard.action.viewAll"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineArrowRight, { className: "ml-1" })
        ] })
      ] }),
      currentResources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center gap-4 py-8 opacity-60", children: [
        activeTab === "added" && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, { className: "text-5xl" }),
        activeTab === "played" && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-5xl" }),
        activeTab === "pinned" && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePushpin, { className: "text-5xl" }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { children: [
          activeTab === "added" && t2("dashboard.empty.noResources"),
          activeTab === "played" && t2("dashboard.empty.noPlayHistory"),
          activeTab === "pinned" && t2("dashboard.empty.noPinned")
        ] }),
        activeTab === "added" && /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", variant: "flat", onPress: () => navigate("/media-library"), children: t2("dashboard.action.addResources") })
      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          ref: resourceScrollRef,
          className: "flex items-start gap-3 overflow-x-auto pb-2",
          style: {
            scrollbarWidth: "thin",
            scrollbarColor: "transparent transparent"
          },
          onMouseEnter: (e2) => {
            e2.currentTarget.style.scrollbarColor = "var(--theme-text-subtle) transparent";
          },
          onMouseLeave: (e2) => {
            e2.currentTarget.style.scrollbarColor = "transparent transparent";
          },
          onWheel: handleWheelScroll,
          children: currentResources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceMemo, { className: "flex-shrink-0 w-36", resource }, resource.id))
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: (data.mediaLibraryResourceCounts ?? []).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-[var(--theme-block-background)] rounded-xl p-5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold mb-3", children: t2("dashboard.section.libraryDistribution") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: (_e = data.mediaLibraryResourceCounts) == null ? void 0 : _e.map((lib2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "flex items-center gap-2 px-3 py-2 bg-[var(--theme-block-background-accent)] rounded-lg",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: lib2.name }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-semibold text-primary", children: lib2.count })
          ]
        },
        lib2.name
      )) })
    ] }) })
  ] });
};
DashboardPage.displayName = "DashboardPage";
const log$e = buildLogger("Resources");
const Resources = reactExports.forwardRef(
  ({ columnCount, loadMore, renderCell, cellCount, onScroll: onScroll6, onScrollToTop }, ref) => {
    reactExports.useRef(false);
    const gridRef = reactExports.useRef();
    const cacheRef = reactExports.useRef(
      new CellMeasurerCache({
        defaultHeight: 180,
        defaultWidth: 160,
        fixedWidth: true
      })
    );
    const verScrollbarWidthRef = reactExports.useRef(0);
    const prevContainerWidthRef = reactExports.useRef(void 0);
    const scrollTopRef = reactExports.useRef(0);
    log$e("rendering");
    reactExports.useEffect(() => {
      if (!containerRef.current)
        return;
      const resizeObserver2 = new ResizeObserver(() => {
        var _a2, _b2;
        const clearCache = prevContainerWidthRef.current != ((_a2 = containerRef.current) == null ? void 0 : _a2.clientWidth);
        prevContainerWidthRef.current = (_b2 = containerRef.current) == null ? void 0 : _b2.clientWidth;
        onResize4(clearCache);
      });
      resizeObserver2.observe(containerRef.current);
      return () => resizeObserver2.disconnect();
    }, []);
    const forceUpdate = useUpdate();
    const containerRef = reactExports.useRef(null);
    const cellRenderer = ({
      columnIndex,
      key,
      parent,
      rowIndex,
      style: style2,
      isScrolling,
      isVisible: isVisible2
    }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      CellMeasurer,
      {
        cache: cacheRef.current,
        columnIndex,
        parent,
        rowIndex,
        children: ({ measure }) => {
          return renderCell({
            columnIndex,
            key,
            parent,
            rowIndex,
            style: style2,
            measure,
            isScrolling,
            isVisible: isVisible2
          });
        }
      },
      key
    );
    useUpdateEffect(() => {
      onResize4(true);
    }, [columnCount]);
    const onResize4 = (clearCache = false) => {
      var _a2, _b2;
      log$e("on resize on scroll", gridRef, (_a2 = containerRef.current) == null ? void 0 : _a2.clientHeight, clearCache);
      if (clearCache) {
        cacheRef.current.clearAll();
      } else {
        (_b2 = gridRef.current) == null ? void 0 : _b2.measureAllCells();
      }
      forceUpdate();
    };
    reactExports.useImperativeHandle(ref, () => ({
      rearrange: () => {
        onResize4(true);
      }
    }));
    function renderGrid() {
      var _a2, _b2;
      const containerWidth = ((_a2 = containerRef.current) == null ? void 0 : _a2.clientWidth) ?? 0;
      const containerHeight = ((_b2 = containerRef.current) == null ? void 0 : _b2.clientHeight) ?? 0;
      const columnWidth = (containerWidth - verScrollbarWidthRef.current) / columnCount;
      log$e(containerWidth, containerHeight, columnWidth, columnCount, gridRef);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          ref: (r2) => {
            if (!containerRef.current) {
              containerRef.current = r2;
              forceUpdate();
            }
          },
          className: "grow min-h-[0] overflow-hidden",
          onWheel: (e2) => {
            if (e2.deltaY < 0 && scrollTopRef.current == 0) {
              onScrollToTop == null ? void 0 : onScrollToTop();
            }
          },
          children: containerRef.current && /* @__PURE__ */ jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Grid,
            {
              cellRenderer,
              ref: gridRef,
              columnCount,
              columnWidth,
              containerStyle: {
                overflow: "visible"
              },
              height,
              overscanIndicesGetter: ({
                cellCount: cellCount2,
                overscanCellsCount,
                startIndex,
                stopIndex
              }) => ({
                overscanStartIndex: Math.max(
                  0,
                  startIndex - overscanCellsCount
                ),
                overscanStopIndex: Math.min(
                  cellCount2 - 1,
                  stopIndex + overscanCellsCount
                )
              }),
              overscanRowCount: 4,
              rowCount: Math.ceil(cellCount / columnCount),
              rowHeight: cacheRef.current.rowHeight,
              width,
              onScroll: (e2) => {
                log$e("onScroll", e2);
                scrollTopRef.current = e2.scrollTop;
                onScroll6 == null ? void 0 : onScroll6(e2);
              },
              onScrollbarPresenceChange: (e2) => {
                const newWidth = e2.vertical ? e2.size : 0;
                log$e("onScrollbarPresenceChange", e2, newWidth, verScrollbarWidthRef.current);
                if (newWidth != verScrollbarWidthRef.current) {
                  verScrollbarWidthRef.current = newWidth;
                  onResize4(true);
                }
              }
            }
          ) })
        }
      );
    }
    return renderGrid();
  }
);
const styles$2 = {};
function FaSortAmountDownAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M240 96h64a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16h-64a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm0 128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm256 192H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h256a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-256-64h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm-64 0h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.37 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352z" }, "child": [] }] })(props);
}
function FaSortAmountUpAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M240 96h64a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16h-64a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm0 128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zm256 192H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h256a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-256-64h192a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16H240a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16zM16 160h48v304a16 16 0 0 0 16 16h32a16 16 0 0 0 16-16V160h48c14.21 0 21.39-17.24 11.31-27.31l-80-96a16 16 0 0 0-22.62 0l-80 96C-5.35 142.74 1.78 160 16 160z" }, "child": [] }] })(props);
}
function FaSort(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 320 512" }, "child": [{ "tag": "path", "attr": { "d": "M41 288h238c21.4 0 32.1 25.9 17 41L177 448c-9.4 9.4-24.6 9.4-33.9 0L24 329c-15.1-15.1-4.4-41 17-41zm255-105L177 64c-9.4-9.4-24.6-9.4-33.9 0L24 183c-15.1 15.1-4.4 41 17 41h238c21.4 0 32.1-25.9 17-41z" }, "child": [] }] })(props);
}
const sortPropertyIcons = {
  [ResourceSearchSortableProperty.FileCreateDt]: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineCreateNewFolder, { className: "text-base" }),
  [ResourceSearchSortableProperty.FileModifyDt]: /* @__PURE__ */ jsxRuntimeExports.jsx(MdEditNote, { className: "text-base" }),
  [ResourceSearchSortableProperty.Filename]: /* @__PURE__ */ jsxRuntimeExports.jsx(MdSortByAlpha, { className: "text-base" }),
  [ResourceSearchSortableProperty.AddDt]: /* @__PURE__ */ jsxRuntimeExports.jsx(MdLibraryAdd, { className: "text-base" }),
  [ResourceSearchSortableProperty.PlayedAt]: /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlayCircleOutline, { className: "text-base" })
};
const OrderSelector = ({ value: propsValue, onChange, ...otherProps }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [value2, setValue] = reactExports.useState(propsValue);
  useUpdateEffect(() => {
    setValue(propsValue);
  }, [propsValue]);
  const propertyDataSource = reactExports.useMemo(
    () => resourceSearchSortableProperties.map((x2) => ({
      label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        sortPropertyIcons[x2.value],
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2(`ResourceSearchSortableProperty.${x2.label}`) })
      ] }),
      value: x2.value.toString(),
      textValue: t2(`ResourceSearchSortableProperty.${x2.label}`)
    })),
    [t2]
  );
  const fallbackProperty = ((_a2 = resourceSearchSortableProperties[0]) == null ? void 0 : _a2.value) ?? 0;
  const current = value2 && value2.length > 0 ? value2[0] : void 0;
  const currentProperty = (current == null ? void 0 : current.property) ?? fallbackProperty;
  const currentAsc = (current == null ? void 0 : current.asc) ?? false;
  const commit = (next2) => {
    setValue(next2);
    onChange == null ? void 0 : onChange(next2);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex items-center gap-1 ${(otherProps == null ? void 0 : otherProps.className) ?? ""}`.trim(),
      style: otherProps == null ? void 0 : otherProps.style,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            "aria-label": t2("resource.order.label"),
            dataSource: propertyDataSource,
            placeholder: t2("resource.order.placeholder"),
            selectedKeys: [currentProperty.toString()],
            selectionMode: "single",
            size: "sm",
            style: {
              maxWidth: 320,
              minWidth: 180
            },
            renderValue: (items) => {
              const selected = items[0];
              if (!(selected == null ? void 0 : selected.data))
                return null;
              const data = selected.data;
              const prop = parseInt(data.value, 10);
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                sortPropertyIcons[prop],
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: data.textValue })
              ] });
            },
            onSelectionChange: (keys2) => {
              const first = Array.from(keys2 || [])[0];
              const property2 = parseInt(first, 10);
              if (Number.isNaN(property2)) {
                return;
              }
              commit([
                {
                  property: property2,
                  asc: currentAsc
                }
              ]);
            },
            ...(() => {
              const { className, style: style2, ...rest } = otherProps;
              return rest;
            })()
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(button_group_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.order.asc"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: currentAsc ? "primary" : "default",
              size: "sm",
              variant: currentAsc ? "solid" : "flat",
              onPress: () => commit([
                {
                  property: currentProperty,
                  asc: true
                }
              ]),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaSortAmountUpAlt, { className: "text-base" })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.order.desc"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: !currentAsc ? "primary" : "default",
              size: "sm",
              variant: !currentAsc ? "solid" : "flat",
              onPress: () => commit([
                {
                  property: currentProperty,
                  asc: false
                }
              ]),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaSortAmountDownAlt, { className: "text-base" })
            }
          ) })
        ] })
      ]
    }
  );
};
OrderSelector.displayName = "OrderSelector";
const shortcuts = [
  {
    labelKey: "Select multiple resources",
    keys: (mod2) => `${mod2} + Click`
  },
  {
    labelKey: "Select range of resources",
    keys: "Shift + Click"
  },
  {
    labelKey: "More actions",
    keys: "Right click"
  }
];
const ShortcutsButton = ({ className }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const modifierKey = reactExports.useMemo(() => {
    const isMac = typeof navigator !== "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0;
    return isMac ? "⌘" : "Ctrl";
  }, []);
  const openModal = () => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "sm",
      title: t2("resource.shortcut.title"),
      footer: { actions: ["cancel"] },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3", children: shortcuts.map((s2, idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2(s2.labelKey) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { children: typeof s2.keys === "function" ? s2.keys(modifierKey) : t2(s2.keys) })
      ] }, idx)) })
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.shortcut.title"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      isIconOnly: true,
      className,
      size: "sm",
      variant: "light",
      onPress: openModal,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RiKeyboardLine, { className: "text-lg" })
    }
  ) });
};
ShortcutsButton.displayName = "ShortcutsButton";
buildLogger("MiscellaneousOptions");
const MinResourceColCount = 3;
const DefaultResourceColCount = 6;
const MaxResourceColCount = 12;
const MiscellaneousOptions = ({ rearrangeResources }) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const uiOptionsStore = useUiOptionsStore();
  const resourceUiOptions = (_a2 = uiOptionsStore.data) == null ? void 0 : _a2.resource;
  const currentColCount = (resourceUiOptions == null ? void 0 : resourceUiOptions.colCount) ?? DefaultResourceColCount;
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [filterOptionsThreshold, setFilterOptionsThreshold2] = useFilterOptionsThreshold();
  const navigate = useNavigate();
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const [visible, setVisible] = reactExports.useState(false);
  const patchOptions = async (options) => {
    await uiOptionsStore.patch({ resource: { ...resourceUiOptions, ...options } });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", onPress: () => setVisible(true), children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-xl" }) }),
    visible && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        footer: false,
        size: "4xl",
        title: t2("resource.display.title"),
        visible,
        onClose: () => setVisible(false),
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("resource.display.columnCount") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { children: Array.from(
              { length: MaxResourceColCount - MinResourceColCount + 1 },
              (_24, idx) => idx + MinResourceColCount
            ).map((num) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: currentColCount === num ? "primary" : "default",
                size: "sm",
                onPress: () => patchOptions({ colCount: num }),
                children: num
              },
              num
            )) }) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: (resourceUiOptions == null ? void 0 : resourceUiOptions.coverFit) === CoverFit.Cover,
              onValueChange: (checked) => patchOptions({ coverFit: checked ? CoverFit.Cover : CoverFit.Contain }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$F, { className: "text-base" }),
                t2("resource.display.fillCover")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.showBiggerCoverWhileHover),
              onValueChange: (checked) => patchOptions({ showBiggerCoverWhileHover: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$19, { className: "text-base" }),
                t2("resource.display.hoverLargeCover")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableMediaPreviewer),
              onValueChange: (checked) => patchOptions({ disableMediaPreviewer: !checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: "text-base" }),
                t2("resource.display.previewFiles")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.autoSelectFirstPlayableFile),
              onValueChange: (checked) => patchOptions({ autoSelectFirstPlayableFile: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { className: "text-base" }),
                t2("resource.display.autoSelectFile")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                size: "sm",
                isSelected: resourceUiOptions == null ? void 0 : resourceUiOptions.inlineDisplayName,
                onValueChange: (checked) => patchOptions({ inlineDisplayName: checked }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ImEmbed, { className: "text-base" }),
                  t2("resource.display.inlineNameTags")
                ] })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60 text-sm", children: t2("resource.display.inlineNameTagsDesc") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                size: "sm",
                isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCache),
                onValueChange: (checked) => patchOptions({ disableCache: !checked }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$W, { className: "text-base" }),
                  t2("resource.display.useCache")
                ] })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60 text-sm", children: t2("resource.display.useCacheDesc") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    navigate("/cache");
                  },
                  children: t2("resource.display.manageCache")
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !(resourceUiOptions == null ? void 0 : resourceUiOptions.disableCoverCarousel),
              onValueChange: (checked) => patchOptions({ disableCoverCarousel: !checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(BiCarousel, { className: "text-base" }),
                t2("resource.display.coverCarousel")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.displayResourceId),
              onValueChange: (checked) => patchOptions({ displayResourceId: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldNumber, { className: "text-base" }),
                t2("resource.display.showResourceId")
              ] })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              size: "sm",
              isSelected: !!(resourceUiOptions == null ? void 0 : resourceUiOptions.hideResourceBorder),
              onValueChange: (checked) => patchOptions({ hideResourceBorder: checked }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: t2("resource.display.hideResourceBorder") })
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("resource.display.filterOptionsCollapseThreshold") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                type: "number",
                size: "sm",
                min: 1,
                className: "w-20",
                value: filterOptionsThreshold.toString(),
                onValueChange: (value2) => {
                  const num = parseInt(value2, 10);
                  if (!isNaN(num) && num > 0) {
                    setFilterOptionsThreshold2(num);
                  }
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: "flat",
                onPress: () => setFilterOptionsThreshold2(DEFAULT_FILTER_OPTIONS_THRESHOLD),
                children: t2("resource.display.reset")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("resource.display.filterOptionsCollapseThresholdDesc") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium", children: t2("resource.display.operations") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_b2 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _b2.includes("aggregate")) ?? ((resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) === void 0 || (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) === null || (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations.length) === 0),
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("aggregate")) {
                        patchOptions({ displayOperations: [...current, "aggregate"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "aggregate")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$i, { className: "text-base" }),
                    t2("resource.display.aggregateButton")
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_c2 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _c2.includes("pin")) ?? false,
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("pin")) {
                        patchOptions({ displayOperations: [...current, "pin"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "pin")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: "text-base" }),
                    t2("resource.display.pinUnpin")
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_d = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _d.includes("openFolder")) ?? false,
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("openFolder")) {
                        patchOptions({ displayOperations: [...current, "openFolder"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "openFolder")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" }),
                    t2("resource.display.openFolder")
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_e = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _e.includes("enhancements")) ?? false,
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("enhancements")) {
                        patchOptions({ displayOperations: [...current, "enhancements"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "enhancements")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$J, { className: "text-base" }),
                    t2("resource.display.enhancements")
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_f = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _f.includes("preview")) ?? false,
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("preview")) {
                        patchOptions({ displayOperations: [...current, "preview"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "preview")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePicture, { className: "text-base" }),
                    t2("resource.display.preview")
                  ] })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                checkbox_default,
                {
                  size: "sm",
                  isSelected: ((_g = resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) == null ? void 0 : _g.includes("addToPlaylist")) ?? false,
                  onValueChange: (checked) => {
                    const current = (resourceUiOptions == null ? void 0 : resourceUiOptions.displayOperations) ?? [];
                    if (checked) {
                      if (!current.includes("addToPlaylist")) {
                        patchOptions({ displayOperations: [...current, "addToPlaylist"] });
                      }
                    } else {
                      patchOptions({
                        displayOperations: current.filter((op) => op !== "addToPlaylist")
                      });
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1, { className: "text-base" }),
                    t2("resource.display.addToPlaylist")
                  ] })
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$15, { className: "text-base" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("resource.display.properties") }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-500", children: [
                t2("resource.display.selectedProperties"),
                ": ",
                ((_h = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _h.length) ?? 0
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  size: "sm",
                  variant: "flat",
                  onPress: () => {
                    const selection = ((resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) ?? []).map((k2) => ({
                      id: k2.id,
                      pool: k2.pool
                    }));
                    createPortal(PropertySelector, {
                      v2: true,
                      selection,
                      multiple: true,
                      pool: PropertyPool.All,
                      onSubmit: async (selected) => {
                        patchOptions({
                          displayProperties: selected.map((p2) => ({ id: p2.id, pool: p2.pool }))
                        });
                      }
                    });
                  },
                  children: t2("resource.display.selectProperties")
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center flex-wrap gap-1", children: (_i = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _i.map((p2) => {
              var _a3;
              const property2 = (_a3 = propertyMap[p2.pool]) == null ? void 0 : _a3[p2.id];
              if (!property2) {
                return null;
              }
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2, fields: ["pool", "name"], showPoolChip: false }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { children: t2("common.label.unknownProperty") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      var _a4;
                      patchOptions({
                        displayProperties: (_a4 = resourceUiOptions == null ? void 0 : resourceUiOptions.displayProperties) == null ? void 0 : _a4.filter(
                          (pp) => pp.id !== p2.id && pp.pool !== p2.pool
                        )
                      });
                    },
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1o, {})
                  }
                )
              ] }, `${p2.pool}-${p2.id}`);
            }) })
          ] })
        ] })
      }
    )
  ] });
};
MiscellaneousOptions.displayName = "MiscellaneousOptions";
const DefaultMaxResourceColCount = 10;
const defaultSearchForm = () => ({
  page: 1,
  pageSize: 0
});
const log$d = buildLogger("FilterPanel");
const FilterPanel = (props) => {
  const {
    maxResourceColCount = DefaultMaxResourceColCount,
    selectedResourceIds,
    onSearch,
    searchForm: propsSearchForm,
    rearrangeResources,
    onSelectAllChange,
    resourceCount,
    totalFilteredResourceCount,
    onOpenRecentlyPlayed
  } = props;
  useTraceUpdate(props, "FilterPanel");
  const isFirstRender = reactExports.useRef(true);
  reactExports.useEffect(() => {
    if (isFirstRender.current) {
      log$d("🔵 first time render");
      isFirstRender.current = false;
    } else {
      log$d("🟡 update render");
    }
  });
  const { t: t2 } = useTranslation();
  const [selectedAll, setSelectedAll] = reactExports.useState(false);
  const [searchForm, setSearchForm] = reactExports.useState(propsSearchForm || defaultSearchForm());
  const [searching, setSearching] = reactExports.useState(false);
  const [filterMode, setFilterMode] = reactExports.useState(FilterDisplayMode.Simple);
  const [selectingAllFilteredResources, setSelectingAllFilteredResources] = reactExports.useState(false);
  const handleModeChange = (newMode) => {
    if (newMode === FilterDisplayMode.Simple && filterMode === FilterDisplayMode.Advanced) {
      const currentGroup = searchForm.group;
      if (currentGroup) {
        const cleanedFilters = (currentGroup.filters || []).filter((f2) => !f2.disabled).map((f2) => ({ ...f2, disabled: false }));
        setSearchForm({
          ...searchForm,
          group: {
            ...currentGroup,
            filters: cleanedFilters,
            groups: [],
            // Remove all sub-groups in Simple mode
            combinator: GroupCombinator.And,
            // Reset to AND
            disabled: false
          }
        });
      }
    }
    setFilterMode(newMode);
  };
  useUpdateEffect(() => {
    setSearchForm(propsSearchForm || defaultSearchForm());
  }, [propsSearchForm]);
  useUpdateEffect(() => {
    console.log("Search form changed", searchForm);
  }, [searchForm]);
  const search2 = async (patches, newTab = false) => {
    if (onSearch) {
      setSearching(true);
      try {
        await onSearch(patches, newTab);
      } catch (e2) {
        console.error(e2);
      } finally {
        setSearching(false);
      }
    }
  };
  console.log("resource page filter panel rerender", searchForm);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles$2.filterPanel} flex flex-col h-full`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-3 flex-shrink-0", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(ShortcutsButton, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PopoverComponent,
          {
            className: "min-w-[160px]",
            trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "default",
                size: "sm",
                variant: "light",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlaylistPlay, { className: "text-xl" })
              }
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection, {})
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.search.recentlyPlayed"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "default",
            size: "sm",
            variant: "light",
            onPress: onOpenRecentlyPlayed,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, { className: "text-base" })
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(MiscellaneousOptions, { rearrangeResources })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-grow overflow-y-auto min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      ResourceFilterController,
      {
        keyword: searchForm.keyword,
        onKeywordChange: (keyword) => {
          setSearchForm({
            ...searchForm,
            keyword
          });
        },
        onSearch: () => {
          search2({
            ...searchForm,
            page: 1
          });
        },
        group: searchForm.group,
        onGroupChange: (group) => {
          const newSearchForm = {
            ...searchForm,
            group
          };
          setSearchForm(newSearchForm);
          search2({
            ...newSearchForm,
            page: 1
          });
        },
        tags: searchForm.tags,
        onTagsChange: (tags) => {
          setSearchForm({
            ...searchForm,
            tags: tags.length > 0 ? tags : void 0
          });
        },
        filterDisplayMode: filterMode,
        onFilterDisplayModeChange: handleModeChange,
        filterLayout: "vertical",
        showRecentFilters: true,
        showTags: true,
        keywordPlaceholder: t2("resource.search.placeholder"),
        autoCreateMediaLibraryFilter: true
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      OrderSelector,
      {
        value: searchForm.orders,
        onChange: (orders) => {
          const nf2 = {
            ...searchForm,
            orders
          };
          setSearchForm(nf2);
          search2(nf2);
        }
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 pt-3 mt-3 border-t border-divider space-y-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              t2("resource.search.loadedInPage"),
              selectingAllFilteredResources ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) : totalFilteredResourceCount != resourceCount && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: async () => {
                    setSelectedAll(true);
                    setSelectingAllFilteredResources(true);
                    try {
                      const ret = onSelectAllChange(true, true);
                      if (!!ret && typeof ret.then === "function") {
                        await ret;
                      }
                    } finally {
                      setSelectingAllFilteredResources(false);
                    }
                  },
                  children: t2(
                    "resource.search.selectAllFiltered",
                    { count: totalFilteredResourceCount }
                  )
                }
              )
            ] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                isSelected: selectedAll && selectedResourceIds && (selectedResourceIds == null ? void 0 : selectedResourceIds.length) > 0,
                size: "sm",
                onValueChange: (isSelected) => {
                  onSelectAllChange(isSelected);
                  setSelectedAll(isSelected);
                },
                children: selectedAll ? t2("resource.search.selectedCount", {
                  count: selectedResourceIds == null ? void 0 : selectedResourceIds.length
                }) : t2("resource.search.selectAll")
              }
            )
          }
        ),
        totalFilteredResourceCount && totalFilteredResourceCount > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.search.loadedResources"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: resourceCount }) }),
          "/",
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resource.search.allFiltered"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", size: "sm", variant: "light", children: totalFilteredResourceCount }) })
        ] }) : null
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            isLoading: searching,
            size: "sm",
            className: "flex-1",
            onPress: async () => {
              await search2({
                ...searchForm,
                page: 1
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
              t2("resource.search.button")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            isLoading: searching,
            size: "sm",
            onPress: async () => {
              await search2(
                {
                  ...searchForm,
                  page: 1
                },
                true
              );
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineExport, { className: "text-base" }),
              t2("resource.search.newTab")
            ]
          }
        )
      ] })
    ] })
  ] });
};
FilterPanel.displayName = "FilterPanel";
const ResizablePanelDivider = ({
  defaultWidth,
  minWidth = 200,
  maxWidth = 600,
  onWidthChange,
  leftPanel,
  rightPanel,
  className = "",
  storageKey,
  collapsible = false,
  collapsedStorageKey,
  onCollapsedChange
}) => {
  const [panelWidth, setPanelWidth] = reactExports.useState(() => {
    if (storageKey && typeof window !== "undefined") {
      const stored = localStorage.getItem(storageKey);
      if (stored) {
        const parsed = parseInt(stored, 10);
        if (!isNaN(parsed) && parsed >= minWidth && parsed <= maxWidth) {
          return parsed;
        }
      }
    }
    return defaultWidth;
  });
  const [collapsed2, setCollapsed] = reactExports.useState(() => {
    if (collapsedStorageKey && typeof window !== "undefined") {
      const stored = localStorage.getItem(collapsedStorageKey);
      return stored === "true";
    }
    return false;
  });
  const [overlayState, setOverlayState] = reactExports.useState(null);
  const containerRef = reactExports.useRef(null);
  const leftPanelRef = reactExports.useRef(null);
  const overlayRef = reactExports.useRef(null);
  const isDragging2 = reactExports.useRef(false);
  const startX = reactExports.useRef(0);
  const startWidth = reactExports.useRef(0);
  const isAnimating = reactExports.useRef(false);
  const targetCollapsed = reactExports.useRef(collapsed2);
  const handleMouseDown = reactExports.useCallback((e2) => {
    e2.preventDefault();
    isDragging2.current = true;
    startX.current = e2.clientX;
    startWidth.current = panelWidth;
    setOverlayState({
      active: true,
      width: panelWidth,
      placeholderWidth: panelWidth
    });
    document.body.style.cursor = "col-resize";
    document.body.style.userSelect = "none";
  }, [panelWidth]);
  const handleMouseMove = reactExports.useCallback((e2) => {
    if (!isDragging2.current || !overlayRef.current)
      return;
    const delta = e2.clientX - startX.current;
    let newWidth = startWidth.current + delta;
    newWidth = Math.max(minWidth, Math.min(maxWidth, newWidth));
    overlayRef.current.style.width = `${newWidth}px`;
  }, [minWidth, maxWidth]);
  const handleMouseUp = reactExports.useCallback(() => {
    if (!isDragging2.current)
      return;
    isDragging2.current = false;
    document.body.style.cursor = "";
    document.body.style.userSelect = "";
    const finalWidth = overlayRef.current ? parseInt(overlayRef.current.style.width, 10) || panelWidth : panelWidth;
    setOverlayState(null);
    setPanelWidth(finalWidth);
    if (storageKey) {
      localStorage.setItem(storageKey, finalWidth.toString());
    }
    onWidthChange == null ? void 0 : onWidthChange(finalWidth);
  }, [panelWidth, onWidthChange, storageKey]);
  const toggleCollapse = reactExports.useCallback(() => {
    if (isAnimating.current)
      return;
    const newCollapsed = !collapsed2;
    targetCollapsed.current = newCollapsed;
    isAnimating.current = true;
    if (collapsedStorageKey) {
      localStorage.setItem(collapsedStorageKey, newCollapsed.toString());
    }
    if (newCollapsed) {
      setOverlayState({
        active: true,
        width: panelWidth,
        placeholderWidth: panelWidth
      });
      requestAnimationFrame(() => {
        if (overlayRef.current) {
          overlayRef.current.style.width = "0px";
        }
      });
    } else {
      setOverlayState({
        active: true,
        width: 0,
        placeholderWidth: 0
      });
      requestAnimationFrame(() => {
        if (overlayRef.current) {
          overlayRef.current.offsetHeight;
          overlayRef.current.style.width = `${panelWidth}px`;
        }
      });
    }
  }, [collapsed2, panelWidth, collapsedStorageKey]);
  const handleOverlayTransitionEnd = reactExports.useCallback((e2) => {
    if (e2.propertyName !== "width" || !isAnimating.current)
      return;
    isAnimating.current = false;
    const newCollapsed = targetCollapsed.current;
    setOverlayState(null);
    setCollapsed(newCollapsed);
    onCollapsedChange == null ? void 0 : onCollapsedChange(newCollapsed);
  }, [onCollapsedChange]);
  reactExports.useEffect(() => {
    document.addEventListener("mousemove", handleMouseMove);
    document.addEventListener("mouseup", handleMouseUp);
    return () => {
      document.removeEventListener("mousemove", handleMouseMove);
      document.removeEventListener("mouseup", handleMouseUp);
    };
  }, [handleMouseMove, handleMouseUp]);
  const actualLeftWidth = collapsed2 ? 0 : panelWidth;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: `flex flex-row h-full ${className}`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: leftPanelRef,
        className: "flex-shrink-0 h-full overflow-hidden",
        style: {
          width: overlayState ? overlayState.placeholderWidth : actualLeftWidth
          // No transition on placeholder - it stays fixed
        },
        children: !collapsed2 && !overlayState && leftPanel
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 relative", children: [
      (!collapsed2 || overlayState) && /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          className: "w-1 h-full cursor-col-resize hover:bg-primary/30 active:bg-primary/50 transition-colors group",
          onMouseDown: handleMouseDown,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-y-0 -left-1 -right-1 group-hover:bg-primary/10" })
        }
      ),
      collapsible && /* @__PURE__ */ jsxRuntimeExports.jsx(
        "button",
        {
          type: "button",
          className: `absolute top-1/2 -translate-y-1/2 z-10 w-5 h-10 flex items-center justify-center bg-default-100 hover:bg-default-200 border border-default-300 rounded-r-md transition-colors ${collapsed2 && !overlayState ? "left-0" : "right-0"}`,
          onClick: toggleCollapse,
          title: collapsed2 ? "Expand panel" : "Collapse panel",
          children: collapsed2 && !overlayState ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1m, { className: "text-xs text-default-600" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1h, { className: "text-xs text-default-600" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-grow min-w-0 h-full overflow-hidden", children: rightPanel }),
    (overlayState == null ? void 0 : overlayState.active) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: overlayRef,
        className: "absolute top-0 left-0 h-full overflow-hidden bg-background z-20 transition-[width] duration-300",
        style: {
          width: overlayState.width,
          // Disable transition during drag
          transitionDuration: isDragging2.current ? "0ms" : "300ms"
        },
        onTransitionEnd: handleOverlayTransitionEnd,
        children: leftPanel
      }
    )
  ] });
};
ResizablePanelDivider.displayName = "ResizablePanelDivider";
const BasePageSize = 50;
const getPageSize = (cols) => cols > 0 ? Math.ceil(BasePageSize / cols) * cols : BasePageSize;
const log$c = buildLogger("ResourceTabContent");
const ResourceTabContent = React$6.forwardRef((props, ref) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const [pageable, setPageable] = reactExports.useState();
  const pageableRef = reactExports.useRef(pageable);
  const {
    resources,
    loading: searching,
    response: searchResponse,
    search: progressiveSearch2,
    reloadResources
  } = useResourceSearch();
  const resourcesRef = reactExports.useRef(resources);
  const uiOptionsStore = useUiOptionsStore();
  const uiOptions = uiOptionsStore.data;
  const resourceOptions = useResourceOptionsStore();
  const resourceOptionsInitializedRef = reactExports.useRef(false);
  const [columnCount, setColumnCount] = reactExports.useState(0);
  const [searchForm, setSearchForm] = reactExports.useState();
  const searchFormRef = reactExports.useRef(searchForm);
  const searchingRef = reactExports.useRef(false);
  const [selectedIds, setSelectedIds] = reactExports.useState([]);
  const selectedIdsRef = reactExports.useRef(selectedIds);
  const multiSelectionRef = reactExports.useRef(false);
  const lastSelectedIndexRef = reactExports.useRef(null);
  const containerRef = reactExports.useRef(null);
  const resourcesComponentRef = reactExports.useRef();
  const rearrangeResources = reactExports.useCallback(() => {
    var _a2;
    (_a2 = resourcesComponentRef.current) == null ? void 0 : _a2.rearrange();
  }, []);
  const onSearch = reactExports.useCallback(async (f2, newTab) => {
    var _a2;
    if (newTab) {
      (_a2 = props.searchInNewTab) == null ? void 0 : _a2.call(props, { page: 1, pageSize: 50, ...f2 });
    } else {
      search2(
        {
          ...f2,
          page: 1
        },
        "replace",
        false,
        true
      );
    }
  }, []);
  const onSelectAllChange = reactExports.useCallback(async (selected, includeNotLoaded) => {
    if (selected) {
      if (includeNotLoaded) {
        const r2 = await BApi$1.resource.searchAllResourceIds(
          searchFormRef.current ?? { page: 1, pageSize: 1e8 }
        );
        const ids2 = r2.data || [];
        setSelectedIds(ids2);
      } else {
        setSelectedIds(resourcesRef.current.map((r2) => r2.id));
      }
    } else {
      setSelectedIds([]);
    }
  }, []);
  const { createPortal } = useBakabaseContext();
  const initStartPageRef = reactExports.useRef(1);
  log$c("render");
  reactExports.useEffect(() => {
    if (resourceOptionsInitializedRef.current) {
      return;
    }
    if (resourceOptions.initialized) {
      BApi$1.resource.getSavedSearch({ id: props.searchId }).then((r2) => {
        const sf2 = r2.data;
        resourceOptionsInitializedRef.current = true;
        setSearchForm(sf2.search);
        log$c("Initial search form", sf2);
        search2(sf2.search, "replace");
      });
    }
  }, [resourceOptions.initialized]);
  const isMac = typeof navigator !== "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0;
  const selectionKey = isMac ? "Meta" : "Control";
  const onKeyDown = reactExports.useCallback((e2) => {
    var _a2;
    if (e2.key == selectionKey && !multiSelectionRef.current) {
      multiSelectionRef.current = true;
      (_a2 = containerRef.current) == null ? void 0 : _a2.setAttribute("data-selection-mode", "true");
    }
  }, [selectionKey]);
  const onKeyUp = reactExports.useCallback((e2) => {
    var _a2;
    if (e2.key == selectionKey && multiSelectionRef.current) {
      multiSelectionRef.current = false;
      (_a2 = containerRef.current) == null ? void 0 : _a2.removeAttribute("data-selection-mode");
    }
  }, [selectionKey]);
  const onWindowBlur = reactExports.useCallback(() => {
    var _a2;
    if (multiSelectionRef.current) {
      multiSelectionRef.current = false;
      (_a2 = containerRef.current) == null ? void 0 : _a2.removeAttribute("data-selection-mode");
    }
  }, []);
  const onClick = reactExports.useCallback((e2) => {
    if (!multiSelectionRef.current && !e2.shiftKey) {
      const target = e2.target;
      if (target.closest(".szh-menu, [role='dialog'], [role='menu'], .bakaui-modal")) {
        return;
      }
      if (selectedIdsRef.current.length != 0) {
        setSelectedIds([]);
        lastSelectedIndexRef.current = null;
      }
    }
  }, []);
  reactExports.useEffect(() => {
    return () => {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick, true);
      window.removeEventListener("blur", onWindowBlur);
      document.removeEventListener("visibilitychange", onWindowBlur);
    };
  }, []);
  const prevActivated = usePrevious$1(props.activated);
  reactExports.useEffect(() => {
    if (typeof window === "undefined") {
      return;
    }
    if (props.activated == prevActivated) {
      return;
    }
    if (props.activated) {
      window.addEventListener("keydown", onKeyDown);
      window.addEventListener("keyup", onKeyUp);
      window.addEventListener("click", onClick, true);
      window.addEventListener("blur", onWindowBlur);
      document.addEventListener("visibilitychange", onWindowBlur);
    } else {
      window.removeEventListener("keydown", onKeyDown);
      window.removeEventListener("keyup", onKeyUp);
      window.removeEventListener("click", onClick, true);
      window.removeEventListener("blur", onWindowBlur);
      document.removeEventListener("visibilitychange", onWindowBlur);
    }
  }, [props.activated]);
  reactExports.useEffect(() => {
    var _a2;
    if (uiOptionsStore.initialized) {
      const c2 = ((_a2 = uiOptions == null ? void 0 : uiOptions.resource) == null ? void 0 : _a2.colCount) ? uiOptions.resource.colCount : BusinessConstants.DefaultResourceColumnCount;
      if (!uiOptions.resource || uiOptions.resource.colCount == 0) {
        BApi$1.options.patchUiOptions({
          resource: {
            ...uiOptions.resource || {},
            colCount: c2
          }
        });
      }
      if (columnCount == 0 || columnCount != c2) {
        setColumnCount(c2);
      }
    }
  }, [uiOptions]);
  reactExports.useEffect(() => {
    searchFormRef.current = searchForm;
  }, [searchForm]);
  reactExports.useEffect(() => {
    searchingRef.current = searching;
  }, [searching]);
  reactExports.useEffect(() => {
    pageableRef.current = pageable;
  }, [pageable]);
  reactExports.useEffect(() => {
    resourcesRef.current = resources;
  }, [resources]);
  reactExports.useEffect(() => {
    if (searchResponse) {
      setPageable((prev2) => ({
        // Only update page on initial load (when prev is undefined) or when it's a replace search
        page: (prev2 == null ? void 0 : prev2.page) ?? searchResponse.pageIndex,
        pageSize: searchResponse.pageSize,
        totalCount: searchResponse.totalCount
      }));
    }
  }, [searchResponse]);
  reactExports.useEffect(() => {
    const pageSize = pageable == null ? void 0 : pageable.pageSize;
    if (pageable && pageSize && props.activated && !searching && resources.length > 0) {
      const timer = setTimeout(() => {
        var _a2;
        const gridElement = (_a2 = pageContainerRef.current) == null ? void 0 : _a2.querySelector(".ReactVirtualized__Grid");
        if (gridElement && gridElement.scrollHeight <= gridElement.clientHeight) {
          const totalPage = Math.ceil(pageable.totalCount / pageSize);
          const loadedPages = Math.ceil(resources.length / pageSize);
          if (loadedPages < totalPage) {
            search2({ page: loadedPages + 1 }, "append", false, false);
          }
        }
      }, 300);
      return () => clearTimeout(timer);
    }
  }, [pageable, props.activated, searching, resources.length]);
  if (selectedIdsRef.current !== selectedIds) {
    selectedIdsRef.current = selectedIds;
    log$c("SelectedIds", selectedIds);
  }
  const pageContainerRef = reactExports.useRef();
  const search2 = reactExports.useCallback(
    async (partialForm, renderMode, replaceSearchCriteria = false, save = true) => {
      console.trace();
      if (searchingRef.current) {
        log$c("Search already in progress, skipping");
        return;
      }
      searchingRef.current = true;
      const baseForm = replaceSearchCriteria ? {} : searchFormRef.current;
      const newForm = {
        ...baseForm,
        ...partialForm,
        pageSize: getPageSize(columnCount)
      };
      setSearchForm(newForm);
      log$c("Search resources", newForm);
      if (resourcesRef.current.length == 0 || renderMode == "replace") {
        initStartPageRef.current = newForm.page ?? 1;
      }
      if (renderMode == "replace") {
        lastSelectedIndexRef.current = null;
        setPageable(void 0);
      }
      try {
        return await progressiveSearch2(newForm, {
          saveSearch: save,
          searchId: props.searchId,
          mode: renderMode
        });
      } finally {
        searchingRef.current = false;
      }
    },
    [progressiveSearch2, props.searchId]
  );
  const onSelect = reactExports.useCallback((id2, shiftKey = false) => {
    const currentIndex = resourcesRef.current.findIndex((r2) => r2.id === id2);
    if (shiftKey && lastSelectedIndexRef.current !== null && currentIndex !== -1) {
      const start = Math.min(lastSelectedIndexRef.current, currentIndex);
      const end = Math.max(lastSelectedIndexRef.current, currentIndex);
      const rangeIds = resourcesRef.current.slice(start, end + 1).map((r2) => r2.id);
      const newSelectedIds = [.../* @__PURE__ */ new Set([...selectedIdsRef.current, ...rangeIds])];
      setSelectedIds(newSelectedIds);
      lastSelectedIndexRef.current = currentIndex;
    } else {
      const selected = selectedIdsRef.current.includes(id2);
      if (selected) {
        setSelectedIds(selectedIdsRef.current.filter((x2) => x2 != id2));
      } else {
        setSelectedIds([...selectedIdsRef.current, id2]);
      }
      if (currentIndex !== -1) {
        lastSelectedIndexRef.current = currentIndex;
      }
    }
  }, []);
  const onSelectedResourcesChanged = reactExports.useCallback((ids2) => {
    reloadResources(ids2);
  }, [reloadResources]);
  const renderCell = reactExports.useCallback(
    ({ columnIndex, key, parent, rowIndex, style: style2, measure }) => {
      const index2 = rowIndex * columnCount + columnIndex;
      if (index2 >= resources.length) {
        return null;
      }
      const resource = resources[index2];
      const selected = selectedIdsRef.current.includes(resource.id);
      const selectedResources = resources.filter((r2) => selectedIdsRef.current.includes(r2.id));
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          onLoad: measure,
          className: "relative p-0.5",
          style: {
            ...style2
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            ResourceMemo,
            {
              biggerCoverPlacement: index2 % columnCount < columnCount / 2 ? "right" : "left",
              selectionModeRef: multiSelectionRef,
              resource,
              selected,
              selectedResourceIds: selectedIdsRef.current,
              selectedResources,
              onSelected: onSelect,
              onSelectedResourcesChanged
            }
          )
        },
        resource.id
      );
    },
    [resources, columnCount]
  );
  reactExports.useImperativeHandle(ref, () => ({
    getCurrentSearch: () => searchFormRef.current
  }));
  log$c(searchForm == null ? void 0 : searchForm.page, pageable == null ? void 0 : pageable.page, `initialized: ${resourceOptionsInitializedRef.current}`);
  if (!resourceOptionsInitializedRef.current) {
    return null;
  }
  const leftPanelContent = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full pr-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    FilterPanel,
    {
      rearrangeResources,
      reloadResources,
      resourceCount: resources.length,
      searchForm,
      selectedResourceIds: selectedIds,
      totalFilteredResourceCount: pageable == null ? void 0 : pageable.totalCount,
      onOpenRecentlyPlayed: props.onOpenRecentlyPlayed,
      onSearch,
      onSelectAllChange
    }
  ) });
  const rightPanelContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [
    columnCount > 0 && resources.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      pageable && pageable.pageSize != void 0 && Math.ceil(pageable.totalCount / pageable.pageSize) > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          showControls: true,
          boundaries: 3,
          page: pageable.page,
          size: "sm",
          total: Math.ceil(pageable.totalCount / pageable.pageSize),
          onChange: (p2) => {
            search2(
              {
                page: p2
              },
              "replace"
            );
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Resources,
        {
          ref: (r2) => {
            resourcesComponentRef.current = r2;
          },
          cellCount: resources.length,
          columnCount,
          renderCell,
          onScroll: (e2) => {
            var _a2, _b2, _c2, _d;
            if (!props.activated) {
              return;
            }
            if (e2.scrollHeight < e2.scrollTop + e2.clientHeight + 200 && !searchingRef.current) {
              const totalPage = Math.ceil(((pageable == null ? void 0 : pageable.totalCount) ?? 0) / ((pageable == null ? void 0 : pageable.pageSize) ?? BasePageSize));
              if (((_a2 = searchFormRef.current) == null ? void 0 : _a2.page) != void 0 && searchFormRef.current.page < totalPage) {
                search2(
                  {
                    page: searchFormRef.current.page + 1
                  },
                  "append",
                  false,
                  false
                );
              }
            }
            const items = (_b2 = pageContainerRef.current) == null ? void 0 : _b2.querySelectorAll("div[role='resource']");
            if (items && items.length > 0) {
              const x2 = e2.clientWidth / 2;
              const y2 = e2.scrollTop + e2.clientHeight / 2;
              log$c("on Scroll", `center: ${x2},${y2}`);
              let closest2 = items[0];
              let minDis = Number.MAX_VALUE;
              for (const item of items) {
                const parent = item.parentElement;
                const ix = parent.offsetLeft + parent.clientWidth / 2;
                const iy = parent.offsetTop + parent.clientHeight / 2;
                const dis = Math.abs((ix - x2) ** 2 + (iy - y2) ** 2);
                if (dis < minDis) {
                  minDis = dis;
                  closest2 = item;
                }
              }
              const centerResourceId = parseInt(closest2.getAttribute("data-id"), 10);
              const pageOffset = Math.floor(
                resources.findIndex((r2) => r2.id == centerResourceId) / (((_c2 = searchFormRef.current) == null ? void 0 : _c2.pageSize) ?? BasePageSize)
              );
              const currentPage = pageOffset + initStartPageRef.current;
              log$c(
                "on Scroll",
                "center item",
                centerResourceId,
                closest2,
                "page offset",
                pageOffset,
                "active page",
                currentPage
              );
              if (currentPage != ((_d = pageableRef.current) == null ? void 0 : _d.page)) {
                setPageable({
                  ...pageableRef.current,
                  page: currentPage
                });
                BApi$1.options.patchResourceOptions({
                  searchCriteria: searchFormRef.current
                });
              }
            }
          },
          onScrollToTop: () => {
          }
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "mt-10 flex items-center gap-2 justify-center left-0 w-full bottom-0",
        style: { position: resources.length == 0 ? "relative" : "absolute" },
        children: searching ? /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "w-[120px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { label: t2("resource.search.searching") }) }) }) : resources.length == 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "w-[520px]", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "gap-5 p-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-2xl text-default-400" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg font-medium", children: t2("resource.empty.title") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-xl bg-default-100 hover:bg-default-200 transition-colors", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-xl text-primary" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: t2("resource.empty.checkCriteria") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 mb-3 ml-8", children: t2("resource.empty.checkCriteriaDesc") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "primary",
                  radius: "sm",
                  size: "sm",
                  variant: "flat",
                  onClick: () => {
                    search2({ page: 1 }, "replace", true);
                  },
                  children: t2("resource.empty.resetCriteria")
                }
              ) })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-xl bg-default-100 hover:bg-default-200 transition-colors", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdVideoLibrary, { className: "text-xl text-primary" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: t2("resource.empty.addToLibrary") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 mb-3 ml-8", children: t2("resource.empty.addToLibraryDesc") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(link_default, { href: "#/media-library", underline: "none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", radius: "sm", size: "sm", variant: "flat", children: t2("resource.empty.goToLibrary") }) }) })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4 rounded-xl bg-default-100 hover:bg-default-200 transition-colors", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineControl, { className: "text-xl text-primary" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: t2("resource.empty.configurePathMark") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 mb-3 ml-8", children: t2("resource.empty.configurePathMarkDesc") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(link_default, { href: "#/path-mark-config", underline: "none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", radius: "sm", size: "sm", variant: "flat", children: t2("resource.empty.goToPathMarkConfig") }) }) })
            ] })
          ] })
        ] }) })
      }
    )
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "div",
    {
      ref: (r2) => {
        containerRef.current = r2;
        pageContainerRef.current = r2 == null ? void 0 : r2.parentElement;
      },
      className: "h-full max-h-full relative",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        ResizablePanelDivider,
        {
          defaultWidth: 320,
          minWidth: 250,
          maxWidth: 500,
          storageKey: "resource-filter-panel-width",
          collapsible: true,
          collapsedStorageKey: "resource-filter-panel-collapsed",
          className: "h-full",
          leftPanel: leftPanelContent,
          rightPanel: rightPanelContent
        }
      )
    }
  );
});
ResourceTabContent.displayName = "ResourceTabContent";
const PAGE_SIZE$1 = 100;
const RecentlyPlayedDrawer = ({ isOpen, onClose }) => {
  const { t: t2 } = useTranslation();
  const { resources, loading, response, search: search2 } = useResourceSearch();
  const [page, setPage] = reactExports.useState(1);
  reactExports.useEffect(() => {
    if (isOpen) {
      search2({
        pageSize: PAGE_SIZE$1,
        page,
        orders: [
          {
            property: ResourceSearchSortableProperty.PlayedAt,
            asc: false
          }
        ],
        group: {
          combinator: SearchCombinator.And,
          filters: [
            {
              propertyPool: PropertyPool.Internal,
              propertyId: ResourceProperty.PlayedAt,
              operation: SearchOperation.IsNotNull,
              disabled: false
            }
          ],
          disabled: false
        }
      });
    }
  }, [isOpen, page]);
  const totalCount = (response == null ? void 0 : response.totalCount) ?? 0;
  const totalPages = Math.ceil(totalCount / PAGE_SIZE$1);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    drawer_default,
    {
      isOpen,
      placement: "right",
      size: "xl",
      onClose,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_content_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_header_default, { className: "flex flex-col gap-1", children: [
          t2("resource.recentlyPlayed.title"),
          totalCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("resource.recentlyPlayed.count", { count: totalCount }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_body_default, { children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : resources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center h-full text-default-500", children: t2("resource.recentlyPlayed.empty") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
          totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            pagination_default,
            {
              page,
              size: "sm",
              total: totalPages,
              onChange: (p2) => setPage(p2)
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-3 gap-2", children: resources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            ResourceMemo,
            {
              resource
            },
            resource.id
          )) }),
          totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            pagination_default,
            {
              page,
              size: "sm",
              total: totalPages,
              onChange: (p2) => setPage(p2)
            }
          ) })
        ] }) })
      ] })
    }
  );
};
RecentlyPlayedDrawer.displayName = "RecentlyPlayedDrawer";
const ResourcePage = () => {
  const { t: t2 } = useTranslation();
  const [savedSearches, setSavedSearches] = reactExports.useState([]);
  const [editingId, setEditingId] = reactExports.useState(null);
  const [editingName, setEditingName] = reactExports.useState("");
  const [activeSearchId, setActiveSearchId] = reactExports.useState();
  const [creatingTab, setCreatingTab] = reactExports.useState(false);
  const [removingTabId, setRemovingTabId] = reactExports.useState(null);
  const [recentlyPlayedOpen, setRecentlyPlayedOpen] = reactExports.useState(false);
  const resourceOptions = useResourceOptionsStore();
  const pendingSearch = usePendingSearchStore((s2) => s2.pendingSearch);
  const consumePendingSearch = usePendingSearchStore((s2) => s2.consumePendingSearch);
  const optionsInitialized = reactExports.useRef(false);
  const activatedSearchIds = reactExports.useRef(/* @__PURE__ */ new Set());
  const inputRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (editingId && inputRef.current) {
      inputRef.current.focus();
      inputRef.current.select();
    }
  }, [editingId]);
  const changeTab = reactExports.useCallback((searchId) => {
    activatedSearchIds.current.add(searchId);
    setActiveSearchId(searchId);
    localStorage.setItem("resource-active-tab-id", searchId);
  }, []);
  reactExports.useEffect(() => {
    if (optionsInitialized.current) {
      return;
    }
    if (resourceOptions.initialized) {
      const ss1 = resourceOptions.data.savedSearches ?? [];
      if (ss1.length == 0) {
        searchInNewTab({ page: 1, pageSize: 50 });
      } else {
        setSavedSearches(ss1);
        const savedActiveTabId = localStorage.getItem("resource-active-tab-id");
        const savedTabExists = savedActiveTabId && ss1.some((s2) => s2.id === savedActiveTabId);
        changeTab(savedTabExists ? savedActiveTabId : ss1[0].id);
      }
      optionsInitialized.current = true;
    }
  }, [resourceOptions.initialized]);
  reactExports.useEffect(() => {
    if (!optionsInitialized.current) {
      return;
    }
    if (pendingSearch) {
      consumePendingSearch();
      searchInNewTab(pendingSearch);
    }
  }, [pendingSearch]);
  const searchInNewTab = async (f2) => {
    if (creatingTab)
      return;
    setCreatingTab(true);
    try {
      const nrs = {
        search: f2
        // id: uuidv4().slice(0, 6),
      };
      const newSearch = (await BApi$1.resource.saveNewResourceSearch(nrs)).data;
      if (!newSearch)
        return;
      setSavedSearches((prev2) => [...prev2, newSearch]);
      changeTab(newSearch.id);
    } finally {
      setCreatingTab(false);
    }
  };
  const beginRename = (id2) => {
    const current = savedSearches.find((x2) => x2.id == id2);
    setEditingId(id2);
    setEditingName((current == null ? void 0 : current.name) ?? "");
  };
  const commitRename = async () => {
    if (editingId == null)
      return;
    const name2 = editingName.trim();
    if (!name2) {
      setEditingId(null);
      return;
    }
    setSavedSearches((prev2) => {
      const next2 = prev2.slice();
      const editingSearch = next2.find((x2) => x2.id == editingId);
      if (editingSearch) {
        editingSearch.name = name2;
      }
      return next2;
    });
    try {
      await BApi$1.resource.putSavedSearchName(name2, { id: editingId });
    } finally {
      setEditingId(null);
    }
  };
  const removeSaved = async (id2) => {
    var _a2;
    if (removingTabId)
      return;
    setRemovingTabId(id2);
    try {
      await BApi$1.resource.deleteSavedSearch({ id: id2 });
      const idx = savedSearches.findIndex((x2) => x2.id == id2);
      const prev2 = savedSearches[idx - 1];
      const next2 = savedSearches[idx + 1];
      setSavedSearches((prevSearches) => prevSearches.filter((s2) => s2.id != id2));
      const newActiveTab = (_a2 = prev2 ?? next2) == null ? void 0 : _a2.id;
      if (newActiveTab) {
        changeTab(newActiveTab);
      } else {
        localStorage.removeItem("resource-active-tab-id");
      }
    } finally {
      setRemovingTabId(null);
    }
  };
  console.log("saved searches", savedSearches);
  if (!resourceOptions.initialized) {
    return null;
  }
  const ss = savedSearches.slice();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full max-h-full gap-1", children: [
    ss.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1 py-2 border-b border-divider", children: ss.map((s2, i2) => {
      const isActive2 = activeSearchId == s2.id || activeSearchId == void 0 && i2 == 0;
      const isEditing = editingId == s2.id;
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          color: isActive2 ? "primary" : "default",
          className: "gap-1 pr-1",
          onPress: () => {
            if (!isActive2) {
              changeTab(s2.id);
            }
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(MdSavedSearch, { className: "text-lg" }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                "span",
                {
                  className: `text-sm font-medium max-w-[150px] truncate block ${isEditing ? "invisible" : ""}`,
                  onDoubleClick: (e2) => {
                    if (isActive2) {
                      e2.stopPropagation();
                      beginRename(s2.id);
                    }
                  },
                  children: s2.name
                }
              ),
              isEditing && /* @__PURE__ */ jsxRuntimeExports.jsx(
                input_default,
                {
                  ref: inputRef,
                  size: "sm",
                  className: "absolute inset-0",
                  classNames: {
                    input: "text-sm font-medium",
                    inputWrapper: "min-h-0 h-full px-0 bg-transparent shadow-none",
                    base: "h-full"
                  },
                  value: editingName,
                  onValueChange: (v2) => setEditingName(v2),
                  onBlur: () => {
                    if (editingId == s2.id)
                      commitRename();
                  },
                  onKeyDown: (e2) => {
                    if (e2.key === "Enter") {
                      e2.preventDefault();
                      commitRename();
                    }
                    if (e2.key === "Escape") {
                      e2.preventDefault();
                      setEditingId(null);
                    }
                  },
                  onClick: (e2) => e2.stopPropagation()
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: `
                      p-0.5 rounded transition-opacity
                      ${isActive2 ? "opacity-70 hover:opacity-100 hover:bg-primary/30" : "opacity-0 group-hover:opacity-60 hover:!opacity-100 hover:bg-default-300"}
                    `,
                onClick: (e2) => {
                  e2.stopPropagation();
                  removeSaved(s2.id);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-xs" })
              }
            )
          ]
        }
      ) }, s2.id);
    }) }),
    ss.map((s2) => {
      const isActive2 = s2.id == activeSearchId;
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `grow min-h-0 ${isActive2 ? "" : "hidden"}`, children: activatedSearchIds.current.has(s2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(
        ResourceTabContent,
        {
          activated: isActive2,
          searchId: s2.id,
          searchInNewTab,
          onOpenRecentlyPlayed: () => setRecentlyPlayedOpen(true)
        }
      ) }, s2.id);
    }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      RecentlyPlayedDrawer,
      {
        isOpen: recentlyPlayedOpen,
        onClose: () => setRecentlyPlayedOpen(false)
      }
    )
  ] });
};
const SyncTaskPrefix$1 = "SyncMediaLibrary_";
const BuildTaskId$1 = (id2) => `${SyncTaskPrefix$1}${id2}`;
const SyncStatus = ({ id: id2, onSyncCompleted }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bTasks = useBTasksStore((state) => state.tasks);
  const taskId = BuildTaskId$1(id2);
  const task = bTasks == null ? void 0 : bTasks.find((d2) => d2.id == taskId);
  const prevStatusRef = reactExports.useRef(task == null ? void 0 : task.status);
  const data = task == null ? void 0 : task.data;
  reactExports.useEffect(() => {
    if (prevStatusRef.current != void 0 && prevStatusRef.current != BTaskStatus.Completed && (task == null ? void 0 : task.status) == BTaskStatus.Completed) {
      onSyncCompleted == null ? void 0 : onSyncCompleted();
    }
    prevStatusRef.current = task == null ? void 0 : task.status;
  }, [onSyncCompleted, task]);
  const elementTypes = [];
  if (task) {
    switch (task.status) {
      case BTaskStatus.NotStarted:
      case BTaskStatus.Running:
        elementTypes.push("progress");
        elementTypes.push("pause");
        elementTypes.push("cancel");
        break;
      case BTaskStatus.Paused:
        elementTypes.push("progress");
        elementTypes.push("start");
        elementTypes.push("cancel");
        break;
      case BTaskStatus.Error:
        elementTypes.push("progress");
        elementTypes.push("error");
        elementTypes.push("start");
        break;
      case BTaskStatus.Completed:
        elementTypes.push("completed");
        elementTypes.push("start");
        elementTypes.push("result");
        break;
      case BTaskStatus.Cancelled:
        elementTypes.push("start");
        break;
    }
  } else {
    elementTypes.push("start");
  }
  const components2 = elementTypes.map((et) => {
    switch (et) {
      case "progress":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(circular_progress_default, { showValueLabel: true, size: "sm", value: task.percentage });
      case "cancel":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.stopBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineStopCircle, { className: "text-lg" })
          }
        );
      case "pause":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "warning",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.pauseBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaRegCirclePause, { className: "text-lg" })
          }
        );
      case "resume":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              await BApi$1.backgroundTask.resumeBackgroundTask(taskId);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(GrResume, { className: "text-lg" })
          }
        );
      case "start":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2(
              "Once synced, you can search for resources in the media library"
            ),
            placement: "top",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "secondary",
                size: "sm",
                variant: "light",
                onPress: async () => {
                  await BApi$1.mediaLibraryV2.syncMediaLibraryV2(id2);
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-lg" })
              }
            )
          }
        );
      case "error":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-lg" })
          }
        );
      case "completed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FaRegCircleCheck, { className: "text-lg" }) });
      case "result": {
        if (!data) {
          return null;
        }
        const items = [
          {
            value: dayjs.duration(
              Math.ceil(hooks.duration(task.elapsed).asSeconds()) * 1e3
            ).format("HH:mm:ss"),
            tip: void 0,
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.added,
            tip: "Added",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.deleted,
            tip: "Deleted",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineMinusCircle, { className: "text-base" })
          },
          {
            value: data == null ? void 0 : data.updated,
            tip: "Updated",
            icon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-base" })
          }
        ];
        return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: items.map((item, idx) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              radius: "sm",
              size: "sm",
              startContent: item.icon,
              title: item.tip,
              variant: "light",
              children: item.value
            },
            idx
          );
        }) });
      }
      default:
        return null;
    }
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: components2 });
};
SyncStatus.displayName = "SyncStatus";
function extractExtensions$1(text2) {
  return Array.from(
    new Set(
      text2.replace(/\n/g, " ").split(" ").map((x2) => {
        let trimmed = x2.trim();
        while (true) {
          const n2 = trimmed.replace(/^\.+|\.+$/g, "");
          if (n2.length == trimmed.length) {
            break;
          } else {
            trimmed = n2;
          }
        }
        return trimmed;
      }).filter((x2) => x2.length > 0).map((x2) => `.${x2}`)
    )
  );
}
const ExtensionsInput = ({
  label,
  placeholder,
  defaultValue: defaultValue2,
  onValueChange,
  minRows = 4,
  size: size2
}) => {
  const { t: t2 } = useTranslation();
  const [text2, setText] = reactExports.useState(defaultValue2 == null ? void 0 : defaultValue2.join(" "));
  const [extensions, setExtensions] = reactExports.useState(
    defaultValue2
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        fullWidth: true,
        isClearable: true,
        isMultiline: true,
        label: label ?? t2("common.label.extensions"),
        minRows,
        size: size2,
        placeholder: placeholder ?? t2("common.placeholder.separateBySpaceOrNewline"),
        value: text2,
        onValueChange: (v2) => {
          setText(v2);
          const newExtensions = extractExtensions$1(v2);
          setExtensions(newExtensions);
          onValueChange == null ? void 0 : onValueChange(newExtensions);
        }
      }
    ),
    extensions && extensions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: extensions.map((ext, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: ext }, i2)) })
  ] });
};
const PlayerSelectorModal$1 = ({ players: propPlayers, onSubmit }) => {
  const { t: t2 } = useTranslation();
  const [players, setPlayers] = reactExports.useState(
    (propPlayers ?? []).map((p2) => ({ ...p2, pathType: "file" }))
  );
  const addPlayer = () => {
    setPlayers([
      ...players,
      {
        executablePath: "",
        command: "{0}",
        extensions: []
      }
    ]);
  };
  const removePlayer = (index2) => {
    const newPlayers = [...players];
    newPlayers.splice(index2, 1);
    setPlayers(newPlayers);
  };
  const updatePlayer = (index2, updates) => {
    const newPlayers = [...players];
    newPlayers[index2] = { ...newPlayers[index2], ...updates };
    setPlayers(newPlayers);
  };
  const validatePlayers = () => {
    return players.every(
      (player) => player.executablePath.trim() !== "" && player.pathType == "file"
    );
  };
  const handleSubmit = () => {
    if (validatePlayers()) {
      onSubmit == null ? void 0 : onSubmit(players);
    }
  };
  const hasInvalidPlayers = players.some(
    (player) => player.executablePath.trim() === "" || player.pathType != "file"
  );
  console.log(players);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      okProps: {
        isDisabled: hasInvalidPlayers
      },
      size: "xl",
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold", children: t2("Configure Players") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlus, {}),
              onPress: addPlayer,
              children: t2("Add Player")
            }
          )
        ] }),
        players.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 py-8", children: t2(
          "No players configured. Click 'Add Player' to get started."
        ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4", children: players.map((player, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "border rounded-lg p-4 flex flex-col gap-3",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "font-medium", children: t2(`Player ${index2 + 1}`) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    color: "danger",
                    size: "sm",
                    variant: "light",
                    onPress: () => removePlayer(index2),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-1 gap-3", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PathAutocomplete,
                  {
                    isRequired: true,
                    errorMessage: player.executablePath.trim() === "" ? t2("Executable path is required") : "",
                    isInvalid: player.executablePath.trim() === "",
                    label: t2("Executable Path"),
                    pathType: "file",
                    placeholder: t2("Path to the player executable"),
                    value: player.executablePath,
                    onChange: (value2, type4) => updatePlayer(index2, {
                      executablePath: value2,
                      pathType: type4
                    })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  input_default,
                  {
                    description: t2(
                      "Use {0} as placeholder for the file path"
                    ),
                    label: t2("Command"),
                    placeholder: "{0}",
                    value: player.command,
                    onValueChange: (value2) => updatePlayer(index2, { command: value2 })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  ExtensionsInput,
                  {
                    defaultValue: player.extensions,
                    label: t2("Supported file extensions"),
                    onValueChange: (extensions) => updatePlayer(index2, { extensions })
                  }
                )
              ] })
            ]
          },
          index2
        )) }),
        hasInvalidPlayers && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-red-500 text-sm mt-2", children: t2("Please fill in all executable paths before saving.") })
      ] })
    }
  );
};
PlayerSelectorModal$1.displayName = "PlayerSelectorModal";
const SyncTaskPrefix = "SyncMediaLibrary_";
const BuildTaskId = (id2) => `${SyncTaskPrefix}${id2}`;
const OutdatedModal = reactExports.forwardRef(({}, ref) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const bTasks = useBTasksStore((state) => state.tasks);
  reactExports.useImperativeHandle(
    ref,
    () => ({
      check: async () => {
        var _a2;
        const data = ((_a2 = await BApi$1.mediaLibraryV2.getOutdatedMediaLibrariesV2()) == null ? void 0 : _a2.data) ?? [];
        setMediaLibraries(data);
      }
    }),
    []
  );
  const unhandledMediaLibraries = mediaLibraries.filter((ml2) => {
    const taskId = BuildTaskId(ml2.id);
    var hasUnfinishedTask = bTasks.some(
      (x2) => x2.id == taskId && (x2.status == BTaskStatus.Paused || x2.status == BTaskStatus.NotStarted || x2.status == BTaskStatus.Running)
    );
    return !hasUnfinishedTask;
  });
  const mlIds = unhandledMediaLibraries.map((ml2) => ml2.id);
  const close = reactExports.useCallback(() => {
    setMediaLibraries([]);
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            onPress: async () => {
              for (const uml of unhandledMediaLibraries) {
                await BApi$1.mediaLibraryV2.syncMediaLibraryV2(uml.id);
              }
              close();
            },
            children: t2("Sync now")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "default", onPress: close, children: t2("Later") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "warning",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Mark as synced"),
                children: t2("Are you sure you want to mark these libraries as synced?"),
                onOk: async () => {
                  await BApi$1.mediaLibraryV2.markMediaLibraryV2AsSynced(mlIds);
                  toast.success(t2("Marked as synced"));
                  close();
                }
              });
            },
            children: t2("Mark as synced")
          }
        )
      ] }),
      visible: unhandledMediaLibraries.length > 0,
      onClose: close,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Following media libraries may be outdated and should be synchronized:") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: unhandledMediaLibraries.map((ml2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { children: ml2.name }, ml2.id)) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Resource will be displayed only after synchronization is complete.") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Would you like to synchronize now, or do it later manually?") })
      ] })
    }
  );
});
const validate$c = (form2) => {
  if (!form2.name || form2.name.length == 0) {
    return;
  }
  if (!form2.resourceType || !form2.resourceLayer) {
    return;
  }
  return form2;
};
const PresetTemplateBuilder = ({ onDestroyed, onSubmitted }) => {
  const { t: t2 } = useTranslation();
  const [dataPool, setDataPool] = reactExports.useState();
  const [form2, setForm] = reactExports.useState({});
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryTemplate.getMediaLibraryTemplatePresetDataPool().then((r2) => {
      setDataPool(r2.data);
    });
  }, []);
  const propertyMap = _$2.keyBy((dataPool == null ? void 0 : dataPool.properties) ?? [], (x2) => x2.id);
  const resourceTypeGroups = _$2.groupBy(
    (dataPool == null ? void 0 : dataPool.resourceTypes) || [],
    (t22) => Math.floor(t22.type / 1e3)
  );
  const recommendProperties = (dataPool == null ? void 0 : dataPool.resourceTypePresetPropertyIds[form2.resourceType ?? 0]) || [];
  const recommendEnhancerIds = (dataPool == null ? void 0 : dataPool.resourceTypeEnhancerIds[form2.resourceType ?? 0]) || [];
  const validForm = validate$c(form2);
  console.log(form2, validForm, recommendProperties, recommendEnhancerIds);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validForm
        }
      },
      size: "full",
      title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Preset media library template builder") }) }),
      onDestroyed,
      onOk: async () => {
        const r2 = await BApi$1.mediaLibraryTemplate.addMediaLibraryTemplateFromPresetBuilder(
          // @ts-ignore
          validForm
        );
        if (!r2.code) {
          onSubmitted == null ? void 0 : onSubmitted(r2.data);
        }
      },
      children: dataPool ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "grid gap-x-4 gap-y-2 items-center",
          style: { gridTemplateColumns: "auto 1fr" },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Resource type") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: _$2.keys(resourceTypeGroups).map((type4) => {
              const resourceTypes = resourceTypeGroups[type4];
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "grid gap-2 items-center",
                  style: { gridTemplateColumns: "auto 1fr" },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDoubleRight, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: resourceTypes.map((tn2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: form2.resourceType == tn2.type ? "primary" : "default",
                        size: "sm",
                        onPress: () => {
                          if (form2.resourceType != tn2.type) {
                            setForm({
                              name: form2.name,
                              resourceType: tn2.type,
                              properties: dataPool.resourceTypePresetPropertyIds[tn2.type] || [],
                              enhancerIds: dataPool.resourceTypeEnhancerIds[tn2.type] || [],
                              resourceLayer: 1
                            });
                          }
                        },
                        children: [
                          tn2.name,
                          tn2.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tn2.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) })
                        ]
                      }
                    )) })
                  ]
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Properties") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: dataPool.properties.map((p2) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  color: ((_a2 = form2.properties) == null ? void 0 : _a2.includes(p2.id)) ? "primary" : "default",
                  size: "sm",
                  variant: recommendProperties.includes(p2.id) ? "solid" : "flat",
                  onPress: () => {
                    const newProperties = form2.properties ? [...form2.properties] : [];
                    if (newProperties.includes(p2.id)) {
                      _$2.remove(newProperties, (t22) => t22 === p2.id);
                    } else {
                      newProperties.push(p2.id);
                    }
                    setForm({
                      ...form2,
                      properties: newProperties
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      BriefProperty,
                      {
                        fields: ["type", "name"],
                        property: {
                          pool: PropertyPool.Custom,
                          name: p2.name,
                          type: p2.type
                        }
                      }
                    ),
                    recommendProperties.includes(p2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLike, { className: "text-base" })
                  ]
                }
              );
            }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              t2("Resource layer"),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  content: t2(
                    "You can configure how many levels deep the resource path should be under the media library path, and you can assign the intermediate directories as property values of the resource"
                  ),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: t2("Media library") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", variant: "light", children: "/" }),
              form2.resourceLayer && form2.resourceLayer > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: _$2.range(0, form2.resourceLayer - 1).map((lp, idx) => {
                var _a2;
                return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Select,
                    {
                      isClearable: true,
                      className: "min-w-[200px]",
                      dataSource: (_a2 = form2.properties) == null ? void 0 : _a2.map((p2) => ({
                        label: propertyMap == null ? void 0 : propertyMap[p2].name,
                        value: p2
                      })),
                      label: t2("The {{layer}}th layer", {
                        layer: idx + 1
                      }),
                      placeholder: t2("Not configured for now"),
                      size: "sm",
                      value: lp,
                      onSelectionChange: (keys2) => {
                        const keyStr = Array.from(keys2)[0];
                        form2.layeredProperties[idx] = keyStr ? parseInt(keyStr, 10) : void 0;
                        setForm({
                          ...form2,
                          layeredProperties: form2.layeredProperties.slice()
                        });
                      }
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        const lps = (form2.layeredProperties ?? []).slice();
                        lps.splice(idx, 1);
                        setForm({
                          ...form2,
                          layeredProperties: lps,
                          resourceLayer: lps.length + 1
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", variant: "light", children: "/" })
                ] });
              }) }) : null,
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    const lps = form2.layeredProperties ?? [];
                    lps.push(void 0);
                    setForm({
                      ...form2,
                      layeredProperties: lps,
                      resourceLayer: lps.length + 1
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", children: t2("Resource") })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Enhancers") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: dataPool.enhancers.map((e2) => {
              var _a2;
              return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  color: ((_a2 = form2.enhancerIds) == null ? void 0 : _a2.includes(e2.id)) ? "primary" : "default",
                  size: "sm",
                  variant: recommendEnhancerIds.includes(e2.id) ? "solid" : "flat",
                  onPress: () => {
                    const newEnhancerIds = form2.enhancerIds ? [...form2.enhancerIds] : [];
                    if (newEnhancerIds.includes(e2.id)) {
                      _$2.remove(newEnhancerIds, (p2) => p2 === e2.id);
                    } else {
                      newEnhancerIds.push(e2.id);
                    }
                    setForm({
                      ...form2,
                      enhancerIds: newEnhancerIds
                    });
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: e2.id }),
                    e2.name,
                    recommendEnhancerIds.includes(e2.id) && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLike, { className: "text-base" })
                  ]
                }
              );
            }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("Name") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                isRequired: true,
                className: "w-[320px]",
                fullWidth: false,
                placeholder: t2("Set a name for this template"),
                value: form2.name,
                onValueChange: (name2) => setForm({
                  ...form2,
                  name: name2
                })
              }
            ) })
          ]
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 text-lg grow", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "md" }),
        t2("Initializing")
      ] })
    }
  );
};
PresetTemplateBuilder.displayName = "PresetTemplateBuilder";
function VscDebugAll(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 16 16", "fill": "currentColor" }, "child": [{ "tag": "path", "attr": { "d": "M7.29333 9.00631L6.41333 9.88552C6.27949 9.34717 5.96917 8.86905 5.53181 8.52735C5.09445 8.18564 4.55521 8 4 8C3.44479 8 2.90555 8.18564 2.46819 8.52735C2.03083 8.86905 1.72051 9.34717 1.58667 9.88552L0.706667 9.00631L0 9.71234L1.14667 10.858L1 11.0045V12.0036H0V13.0027H1V13.056C1.051 13.3815 1.14283 13.6993 1.27333 14.0018L0 15.294L0.706667 16L1.80667 14.901C2.06838 15.2346 2.40078 15.5062 2.78001 15.6962C3.15924 15.8862 3.57587 15.99 4 16C4.42413 15.99 4.84076 15.8862 5.21999 15.6962C5.59922 15.5062 5.93162 15.2346 6.19333 14.901L7.29333 16L8 15.294L6.72667 14.0018C6.85879 13.6929 6.95065 13.3683 7 13.036V12.9694H8V12.0036H7V11.0045L6.85333 10.858L8 9.71234L7.29333 9.00631ZM4 9.00631C4.39782 9.00631 4.77936 9.16421 5.06066 9.44526C5.34196 9.72631 5.5 10.1075 5.5 10.505H2.5C2.5 10.1075 2.65804 9.72631 2.93934 9.44526C3.22064 9.16421 3.60218 9.00631 4 9.00631ZM6 13.0027C5.95116 13.5161 5.72476 13.9965 5.35974 14.3612C4.99472 14.7259 4.5139 14.9521 4 15.0009C3.4861 14.9521 3.00528 14.7259 2.64026 14.3612C2.27524 13.9965 2.04884 13.5161 2 13.0027V11.5041H6V13.0027Z" }, "child": [] }, { "tag": "path", "attr": { "fillRule": "evenodd", "clipRule": "evenodd", "d": "M3.77951 2L2.99951 2.41V7H3.99951V3.35L11.5995 8.42L9 10.1507V11.3497L12.7795 8.83V8L3.77951 2ZM9 13.3497V12.1482L14.5995 8.42006L6.99951 3.35006V2.14673L15.7795 8.00006V8.83006L9 13.3497Z" }, "child": [] }] })(props);
}
const Block2 = ({
  leftIcon,
  title,
  description,
  descriptionPlacement = "right",
  rightIcon,
  onRightIconPress,
  children
}) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        leftIcon ?? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineBlock, { className: "text-lg" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base", children: title }),
        rightIcon && onRightIconPress ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: onRightIconPress,
            children: rightIcon
          }
        ) : rightIcon,
        descriptionPlacement == "right" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: description })
      ] }),
      descriptionPlacement == "bottom" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: description })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "h-auto", orientation: "vertical" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow pl-4", children })
    ] })
  ] });
};
Block2.displayName = "Block";
var PathFilterFsType = /* @__PURE__ */ ((PathFilterFsType2) => {
  PathFilterFsType2[PathFilterFsType2["File"] = 1] = "File";
  PathFilterFsType2[PathFilterFsType2["Directory"] = 2] = "Directory";
  return PathFilterFsType2;
})(PathFilterFsType || {});
const PathFilterFsTypeBlock = ({ type: type4 }) => {
  const { t: t2 } = useTranslation();
  switch (type4) {
    case PathFilterFsType.File:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(BsFileEarmark, {}),
        t2(PathFilterFsType[type4])
      ] });
    case PathFilterFsType.Directory:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(BsFolder, {}),
        t2(PathFilterFsType[type4])
      ] });
  }
};
PathFilterFsTypeBlock.displayName = "PathFilterFsTypeBlock";
const Demonstrator$b = ({ filter: filter3 }) => {
  const { t: t2 } = useTranslation();
  const renderPositioner = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLayersOutline, { className: "text-base" }),
          t2("Layer")
        ] });
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" }),
          t2("Regex")
        ] });
      default:
        return t2("Not supported");
    }
  };
  const renderLayerOrRegex = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return filter3.layer == void 0 ? t2("Not set") : filter3.layer == 0 ? t2("Directory of media library") : t2("The {{layer}} layer", { layer: filter3.layer });
      case PathPositioner.Regex:
        return filter3.regex ?? t2("Not set");
      default:
        return t2("Not supported");
    }
  };
  const renderFsTypeBlocks = () => {
    if (filter3.fsType) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(PathFilterFsTypeBlock, { type: filter3.fsType });
    } else {
      return pathFilterFsTypes.map((t22) => /* @__PURE__ */ jsxRuntimeExports.jsx(PathFilterFsTypeBlock, { type: t22.value }));
    }
  };
  const renderExtensions = () => {
    var _a2;
    const texts = (((_a2 = filter3.extensionGroups) == null ? void 0 : _a2.map((x2) => x2.name)) ?? []).concat(
      filter3.extensions ?? []
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: texts.map((t22) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t22 });
    }) });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      t2("Through"),
      renderPositioner()
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderLayerOrRegex() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderFsTypeBlocks() }),
    filter3.fsType == PathFilterFsType.File && renderExtensions()
  ] });
};
Demonstrator$b.displayName = "Demonstrator";
const ExtensionGroupSelect = ({ value: value2 = [], onSelectionChange, size: size2, className }) => {
  const { t: t2 } = useTranslation();
  const [extensionGroups, setExtensionGroups] = reactExports.useState([]);
  reactExports.useEffect(() => {
    BApi$1.extensionGroup.getAllExtensionGroups().then((res) => {
      setExtensionGroups(res.data ?? []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Select,
    {
      dataSource: extensionGroups == null ? void 0 : extensionGroups.map((l2) => ({
        label: l2.name,
        value: l2.id.toString()
      })),
      label: t2("extensionGroupSelect.label"),
      placeholder: t2("extensionGroupSelect.placeholder"),
      selectedKeys: (value2 ?? []).map((x2) => x2.toString()),
      selectionMode: "multiple",
      size: size2,
      className,
      onSelectionChange: (keys2) => {
        onSelectionChange == null ? void 0 : onSelectionChange(
          Array.from(keys2).map((k2) => parseInt(k2, 10))
        );
      }
    }
  );
};
ExtensionGroupSelect.displayName = "ExtensionGroupSelect";
const PathFilterModal = ({ filter: propsFilter, onSubmit, onDestroyed }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [filter3, setFilter] = reactExports.useState(
    propsFilter ?? { positioner: PathPositioner.Layer }
  );
  const renderFsItem = (type4) => {
    switch (type4) {
      case PathFilterFsType.File:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsFileEarmark, {}),
          t2("File")
        ] });
      case PathFilterFsType.Directory:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsFolder, {}),
          t2("Folder")
        ] });
    }
  };
  const renderPositioner = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Select,
          {
            isRequired: true,
            dataSource: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map((l2) => ({
              label: l2,
              value: l2.toString()
            })),
            description: t2("Layer 0 is directory of media library"),
            label: t2("Layer"),
            selectedKeys: filter3.layer == void 0 ? void 0 : [filter3.layer.toString()],
            onSelectionChange: (keys2) => {
              const layer = parseInt(Array.from(keys2)[0], 10);
              setFilter({
                ...filter3,
                layer
              });
            }
          }
        );
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            label: t2("Regex"),
            placeholder: t2("Regex to match sub path"),
            value: filter3.regex,
            onValueChange: (v2) => {
              setFilter({
                ...filter3,
                regex: v2
              });
            }
          }
        );
      default:
        return t2("Not supported");
    }
  };
  const isValid3 = () => {
    switch (filter3.positioner) {
      case PathPositioner.Layer:
        return filter3.layer != void 0 && filter3.layer >= 0;
      case PathPositioner.Regex:
        return filter3.regex != void 0 && filter3.regex.length > 0;
      default:
        return false;
    }
  };
  console.log(
    filter3,
    pathFilterFsTypes.map((t22) => ({
      label: renderFsItem(t22.value),
      value: t22.value.toString(),
      textValue: t22.label
    }))
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !isValid3()
        }
      },
      size: "lg",
      onDestroyed,
      onOk: async () => await (onSubmit == null ? void 0 : onSubmit(filter3)),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            isRequired: true,
            label: t2("Positioning"),
            orientation: "horizontal",
            value: (_a2 = filter3.positioner) == null ? void 0 : _a2.toString(),
            onValueChange: (v2) => {
              const nv = parseInt(v2, 10);
              if (filter3.positioner != nv) {
                setFilter({
                  positioner: nv
                });
              }
            },
            children: pathPositioners.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: p2.value.toString(), children: t2(p2.label) }))
          }
        ),
        filter3.positioner && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          renderPositioner(),
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-4" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: pathFilterFsTypes.map((t22) => ({
                label: renderFsItem(t22.value),
                value: t22.value.toString(),
                textValue: t22.label
              })),
              disallowEmptySelection: false,
              endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    setFilter({
                      ...filter3,
                      fsType: void 0
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
                }
              ),
              label: t2("Limit path type"),
              placeholder: t2("No limited"),
              renderValue: (items) => {
                return items.map(
                  (t22) => renderFsItem(parseInt(t22.data.value, 10))
                );
              },
              selectedKeys: filter3.fsType ? [filter3.fsType.toString()] : [],
              selectionMode: "single",
              onSelectionChange: (keys2) => {
                const fsType = parseInt(Array.from(keys2)[0], 10);
                setFilter({
                  ...filter3,
                  fsType
                });
              }
            }
          ),
          (filter3.fsType == void 0 || filter3.fsType == PathFilterFsType.File) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ExtensionGroupSelect,
              {
                value: filter3.extensionGroupIds,
                onSelectionChange: (ids2) => {
                  setFilter({
                    ...filter3,
                    extensionGroupIds: ids2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ExtensionsInput,
              {
                defaultValue: filter3.extensions,
                label: t2("Limit file extensions"),
                onValueChange: (v2) => {
                  setFilter({
                    ...filter3,
                    extensions: v2
                  });
                }
              }
            )
          ] })
        ] })
      ] })
    }
  );
};
PathFilterModal.displayName = "PathFilterModal";
const PlayableFileSelectorModal$1 = ({ selection: propSelection, onSubmit }) => {
  const { t: t2 } = useTranslation();
  const [selection, setSelection] = reactExports.useState(propSelection ?? {});
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { defaultVisible: true, size: "xl", onOk: () => onSubmit == null ? void 0 : onSubmit(selection), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ExtensionGroupSelect,
      {
        value: selection.extensionGroupIds,
        onSelectionChange: (ids2) => {
          setSelection({
            ...selection,
            extensionGroupIds: ids2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ExtensionsInput,
      {
        defaultValue: selection.extensions,
        label: t2("Limit file extensions"),
        onValueChange: (v2) => {
          setSelection({
            ...selection,
            extensions: v2
          });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium", children: t2("Maximum file count") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          label: t2("Leave empty for no limit"),
          minValue: 1,
          value: selection.maxFileCount,
          onValueChange: (v2) => {
            setSelection({
              ...selection,
              maxFileCount: v2
            });
          }
        }
      )
    ] })
  ] }) });
};
PlayableFileSelectorModal$1.displayName = "PlayableFileSelectorModal";
const Demonstrator$a = ({ locator }) => {
  const { t: t2 } = useTranslation();
  const renderPositioner = () => {
    switch (locator.positioner) {
      case PathPositioner.Layer:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLayersOutline, { className: "text-base" }),
          t2("Layer")
        ] });
      case PathPositioner.Regex:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsRegex, { className: "text-base" }),
          t2("Regex")
        ] });
      default:
        return t2("Not supported");
    }
  };
  const renderLayerOrRegex = () => {
    switch (locator.positioner) {
      case PathPositioner.Layer:
        const basePathType = locator.basePathType ?? PathPropertyExtractorBasePathType.MediaLibrary;
        if (locator.layer == void 0) {
          return t2("Not set");
        }
        if (locator.layer === 0) {
          return t2("Self");
        }
        if (locator.layer > 0) {
          return t2("The {{n}}th layer after {{basePathType}}", {
            basePathType: t2(PathPropertyExtractorBasePathType[basePathType]),
            n: locator.layer
          });
        } else {
          return t2("The {{n}}th layer before {{basePathType}}", {
            basePathType: t2(PathPropertyExtractorBasePathType[basePathType]),
            n: Math.abs(locator.layer)
          });
        }
      case PathPositioner.Regex:
        return locator.regex ?? t2("Not set");
      default:
        return t2("Not supported");
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderPositioner() }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderLayerOrRegex() })
  ] });
};
Demonstrator$a.displayName = "Demonstrator";
const EnhancerSelectorModal$1 = ({ selectedIds: propSelectedIds, onSubmit }) => {
  const { t: t2 } = useTranslation();
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [selectedIds, setSelectedIds] = reactExports.useState(propSelectedIds ?? []);
  const MAX_VISIBLE_TARGETS = 5;
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancers(r2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      classNames: { base: "max-w-[80vw]" },
      size: "2xl",
      onOk: () => onSubmit == null ? void 0 : onSubmit(selectedIds),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: enhancers.map((e2) => {
        const isSelected = selectedIds.includes(e2.id);
        const visibleTargets = e2.targets.slice(0, MAX_VISIBLE_TARGETS);
        const hiddenTargets = e2.targets.slice(MAX_VISIBLE_TARGETS);
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          card_default,
          {
            isPressable: true,
            className: `relative ${isSelected ? "border-2 border-success bg-success/10" : ""}`,
            onPress: () => {
              if (isSelected) {
                setSelectedIds(selectedIds.filter((id2) => id2 !== e2.id));
              } else {
                setSelectedIds([...selectedIds, e2.id]);
              }
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: e2 }),
                  isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: e2.description }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-bold", children: [
                    t2("Enhance properties"),
                    ": "
                  ] }),
                  visibleTargets.map((target) => {
                    if (target.description) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                        target.name,
                        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                      ] }) }) }, `${e2.id}-${target.name}`);
                    }
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: "default",
                        radius: "sm",
                        size: "sm",
                        variant: "flat",
                        children: target.name
                      },
                      `${e2.id}-${target.name}`
                    );
                  }),
                  hiddenTargets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-[360px] flex flex-wrap gap-1", children: hiddenTargets.map((target) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "default",
                          radius: "sm",
                          size: "sm",
                          variant: "flat",
                          children: target.name
                        },
                        `${e2.id}-hidden-${target.name}`
                      )) }),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "primary", radius: "sm", size: "sm", variant: "flat", children: [
                        "+",
                        hiddenTargets.length,
                        " ",
                        t2("more")
                      ] })
                    }
                  )
                ] })
              ] }),
              isSelected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "solid", children: t2("Selected") }) })
            ]
          },
          e2.id
        );
      }) })
    }
  );
};
EnhancerSelectorModal$1.displayName = "EnhancerSelectorModal";
var reactDomServerLegacy_browser_production_min = {};
/**
 * @license React
 * react-dom-server-legacy.browser.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var aa$1 = reactExports;
function l$2(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var p$1 = Object.prototype.hasOwnProperty, fa$1 = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, ha$1 = {}, ia$1 = {};
function ja$1(a2) {
  if (p$1.call(ia$1, a2))
    return true;
  if (p$1.call(ha$1, a2))
    return false;
  if (fa$1.test(a2))
    return ia$1[a2] = true;
  ha$1[a2] = true;
  return false;
}
function r(a2, b2, c2, d2, f2, e2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = f2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = e2;
  this.removeEmptyString = g2;
}
var t$1 = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  t$1[a2] = new r(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  t$1[b2] = new r(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  t$1[a2] = new r(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  t$1[a2] = new r(a2, 2, false, a2, null, false, false);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a2) {
  t$1[a2] = new r(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  t$1[a2] = new r(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  t$1[a2] = new r(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  t$1[a2] = new r(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  t$1[a2] = new r(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ka$1 = /[\-:]([a-z])/g;
function la$1(a2) {
  return a2[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a2) {
  var b2 = a2.replace(
    ka$1,
    la$1
  );
  t$1[b2] = new r(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ka$1, la$1);
  t$1[b2] = new r(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ka$1, la$1);
  t$1[b2] = new r(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  t$1[a2] = new r(a2, 1, false, a2.toLowerCase(), null, false, false);
});
t$1.xlinkHref = new r("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  t$1[a2] = new r(a2, 1, false, a2.toLowerCase(), null, true, true);
});
var u$1 = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, ma = ["Webkit", "ms", "Moz", "O"];
Object.keys(u$1).forEach(function(a2) {
  ma.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    u$1[b2] = u$1[a2];
  });
});
var na = /["'&<>]/;
function v(a2) {
  if ("boolean" === typeof a2 || "number" === typeof a2)
    return "" + a2;
  a2 = "" + a2;
  var b2 = na.exec(a2);
  if (b2) {
    var c2 = "", d2, f2 = 0;
    for (d2 = b2.index; d2 < a2.length; d2++) {
      switch (a2.charCodeAt(d2)) {
        case 34:
          b2 = "&quot;";
          break;
        case 38:
          b2 = "&amp;";
          break;
        case 39:
          b2 = "&#x27;";
          break;
        case 60:
          b2 = "&lt;";
          break;
        case 62:
          b2 = "&gt;";
          break;
        default:
          continue;
      }
      f2 !== d2 && (c2 += a2.substring(f2, d2));
      f2 = d2 + 1;
      c2 += b2;
    }
    a2 = f2 !== d2 ? c2 + a2.substring(f2, d2) : c2;
  }
  return a2;
}
var oa$1 = /([A-Z])/g, pa$1 = /^ms-/, qa$1 = Array.isArray;
function w$1(a2, b2) {
  return { insertionMode: a2, selectedValue: b2 };
}
function ra$1(a2, b2, c2) {
  switch (b2) {
    case "select":
      return w$1(1, null != c2.value ? c2.value : c2.defaultValue);
    case "svg":
      return w$1(2, null);
    case "math":
      return w$1(3, null);
    case "foreignObject":
      return w$1(1, null);
    case "table":
      return w$1(4, null);
    case "thead":
    case "tbody":
    case "tfoot":
      return w$1(5, null);
    case "colgroup":
      return w$1(7, null);
    case "tr":
      return w$1(6, null);
  }
  return 4 <= a2.insertionMode || 0 === a2.insertionMode ? w$1(1, null) : a2;
}
var sa$1 = /* @__PURE__ */ new Map();
function ta$1(a2, b2, c2) {
  if ("object" !== typeof c2)
    throw Error(l$2(62));
  b2 = true;
  for (var d2 in c2)
    if (p$1.call(c2, d2)) {
      var f2 = c2[d2];
      if (null != f2 && "boolean" !== typeof f2 && "" !== f2) {
        if (0 === d2.indexOf("--")) {
          var e2 = v(d2);
          f2 = v(("" + f2).trim());
        } else {
          e2 = d2;
          var g2 = sa$1.get(e2);
          void 0 !== g2 ? e2 = g2 : (g2 = v(e2.replace(oa$1, "-$1").toLowerCase().replace(pa$1, "-ms-")), sa$1.set(e2, g2), e2 = g2);
          f2 = "number" === typeof f2 ? 0 === f2 || p$1.call(u$1, d2) ? "" + f2 : f2 + "px" : v(("" + f2).trim());
        }
        b2 ? (b2 = false, a2.push(' style="', e2, ":", f2)) : a2.push(";", e2, ":", f2);
      }
    }
  b2 || a2.push('"');
}
function x$1(a2, b2, c2, d2) {
  switch (c2) {
    case "style":
      ta$1(a2, b2, d2);
      return;
    case "defaultValue":
    case "defaultChecked":
    case "innerHTML":
    case "suppressContentEditableWarning":
    case "suppressHydrationWarning":
      return;
  }
  if (!(2 < c2.length) || "o" !== c2[0] && "O" !== c2[0] || "n" !== c2[1] && "N" !== c2[1]) {
    if (b2 = t$1.hasOwnProperty(c2) ? t$1[c2] : null, null !== b2) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (!b2.acceptsBooleans)
            return;
      }
      c2 = b2.attributeName;
      switch (b2.type) {
        case 3:
          d2 && a2.push(" ", c2, '=""');
          break;
        case 4:
          true === d2 ? a2.push(" ", c2, '=""') : false !== d2 && a2.push(" ", c2, '="', v(d2), '"');
          break;
        case 5:
          isNaN(d2) || a2.push(" ", c2, '="', v(d2), '"');
          break;
        case 6:
          !isNaN(d2) && 1 <= d2 && a2.push(" ", c2, '="', v(d2), '"');
          break;
        default:
          b2.sanitizeURL && (d2 = "" + d2), a2.push(" ", c2, '="', v(d2), '"');
      }
    } else if (ja$1(c2)) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (b2 = c2.toLowerCase().slice(0, 5), "data-" !== b2 && "aria-" !== b2)
            return;
      }
      a2.push(" ", c2, '="', v(d2), '"');
    }
  }
}
function y$1(a2, b2, c2) {
  if (null != b2) {
    if (null != c2)
      throw Error(l$2(60));
    if ("object" !== typeof b2 || !("__html" in b2))
      throw Error(l$2(61));
    b2 = b2.__html;
    null !== b2 && void 0 !== b2 && a2.push("" + b2);
  }
}
function ua$1(a2) {
  var b2 = "";
  aa$1.Children.forEach(a2, function(a3) {
    null != a3 && (b2 += a3);
  });
  return b2;
}
function va$1(a2, b2, c2, d2) {
  a2.push(A(c2));
  var f2 = c2 = null, e2;
  for (e2 in b2)
    if (p$1.call(b2, e2)) {
      var g2 = b2[e2];
      if (null != g2)
        switch (e2) {
          case "children":
            c2 = g2;
            break;
          case "dangerouslySetInnerHTML":
            f2 = g2;
            break;
          default:
            x$1(a2, d2, e2, g2);
        }
    }
  a2.push(">");
  y$1(a2, f2, c2);
  return "string" === typeof c2 ? (a2.push(v(c2)), null) : c2;
}
var wa$1 = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, xa$1 = /* @__PURE__ */ new Map();
function A(a2) {
  var b2 = xa$1.get(a2);
  if (void 0 === b2) {
    if (!wa$1.test(a2))
      throw Error(l$2(65, a2));
    b2 = "<" + a2;
    xa$1.set(a2, b2);
  }
  return b2;
}
function ya$1(a2, b2, c2, d2, f2) {
  switch (b2) {
    case "select":
      a2.push(A("select"));
      var e2 = null, g2 = null;
      for (n2 in c2)
        if (p$1.call(c2, n2)) {
          var h3 = c2[n2];
          if (null != h3)
            switch (n2) {
              case "children":
                e2 = h3;
                break;
              case "dangerouslySetInnerHTML":
                g2 = h3;
                break;
              case "defaultValue":
              case "value":
                break;
              default:
                x$1(a2, d2, n2, h3);
            }
        }
      a2.push(">");
      y$1(a2, g2, e2);
      return e2;
    case "option":
      g2 = f2.selectedValue;
      a2.push(A("option"));
      var k2 = h3 = null, m2 = null;
      var n2 = null;
      for (e2 in c2)
        if (p$1.call(c2, e2)) {
          var q2 = c2[e2];
          if (null != q2)
            switch (e2) {
              case "children":
                h3 = q2;
                break;
              case "selected":
                m2 = q2;
                break;
              case "dangerouslySetInnerHTML":
                n2 = q2;
                break;
              case "value":
                k2 = q2;
              default:
                x$1(a2, d2, e2, q2);
            }
        }
      if (null != g2)
        if (c2 = null !== k2 ? "" + k2 : ua$1(h3), qa$1(g2))
          for (d2 = 0; d2 < g2.length; d2++) {
            if ("" + g2[d2] === c2) {
              a2.push(' selected=""');
              break;
            }
          }
        else
          "" + g2 === c2 && a2.push(' selected=""');
      else
        m2 && a2.push(' selected=""');
      a2.push(">");
      y$1(a2, n2, h3);
      return h3;
    case "textarea":
      a2.push(A("textarea"));
      n2 = g2 = e2 = null;
      for (h3 in c2)
        if (p$1.call(c2, h3) && (k2 = c2[h3], null != k2))
          switch (h3) {
            case "children":
              n2 = k2;
              break;
            case "value":
              e2 = k2;
              break;
            case "defaultValue":
              g2 = k2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(l$2(91));
            default:
              x$1(
                a2,
                d2,
                h3,
                k2
              );
          }
      null === e2 && null !== g2 && (e2 = g2);
      a2.push(">");
      if (null != n2) {
        if (null != e2)
          throw Error(l$2(92));
        if (qa$1(n2) && 1 < n2.length)
          throw Error(l$2(93));
        e2 = "" + n2;
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push("\n");
      null !== e2 && a2.push(v("" + e2));
      return null;
    case "input":
      a2.push(A("input"));
      k2 = n2 = h3 = e2 = null;
      for (g2 in c2)
        if (p$1.call(c2, g2) && (m2 = c2[g2], null != m2))
          switch (g2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(399, "input"));
            case "defaultChecked":
              k2 = m2;
              break;
            case "defaultValue":
              h3 = m2;
              break;
            case "checked":
              n2 = m2;
              break;
            case "value":
              e2 = m2;
              break;
            default:
              x$1(a2, d2, g2, m2);
          }
      null !== n2 ? x$1(a2, d2, "checked", n2) : null !== k2 && x$1(a2, d2, "checked", k2);
      null !== e2 ? x$1(a2, d2, "value", e2) : null !== h3 && x$1(a2, d2, "value", h3);
      a2.push("/>");
      return null;
    case "menuitem":
      a2.push(A("menuitem"));
      for (var C2 in c2)
        if (p$1.call(c2, C2) && (e2 = c2[C2], null != e2))
          switch (C2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(400));
            default:
              x$1(a2, d2, C2, e2);
          }
      a2.push(">");
      return null;
    case "title":
      a2.push(A("title"));
      e2 = null;
      for (q2 in c2)
        if (p$1.call(c2, q2) && (g2 = c2[q2], null != g2))
          switch (q2) {
            case "children":
              e2 = g2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(l$2(434));
            default:
              x$1(a2, d2, q2, g2);
          }
      a2.push(">");
      return e2;
    case "listing":
    case "pre":
      a2.push(A(b2));
      g2 = e2 = null;
      for (k2 in c2)
        if (p$1.call(c2, k2) && (h3 = c2[k2], null != h3))
          switch (k2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            default:
              x$1(a2, d2, k2, h3);
          }
      a2.push(">");
      if (null != g2) {
        if (null != e2)
          throw Error(l$2(60));
        if ("object" !== typeof g2 || !("__html" in g2))
          throw Error(l$2(61));
        c2 = g2.__html;
        null !== c2 && void 0 !== c2 && ("string" === typeof c2 && 0 < c2.length && "\n" === c2[0] ? a2.push("\n", c2) : a2.push("" + c2));
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push("\n");
      return e2;
    case "area":
    case "base":
    case "br":
    case "col":
    case "embed":
    case "hr":
    case "img":
    case "keygen":
    case "link":
    case "meta":
    case "param":
    case "source":
    case "track":
    case "wbr":
      a2.push(A(b2));
      for (var D2 in c2)
        if (p$1.call(c2, D2) && (e2 = c2[D2], null != e2))
          switch (D2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(l$2(399, b2));
            default:
              x$1(a2, d2, D2, e2);
          }
      a2.push("/>");
      return null;
    case "annotation-xml":
    case "color-profile":
    case "font-face":
    case "font-face-src":
    case "font-face-uri":
    case "font-face-format":
    case "font-face-name":
    case "missing-glyph":
      return va$1(
        a2,
        c2,
        b2,
        d2
      );
    case "html":
      return 0 === f2.insertionMode && a2.push("<!DOCTYPE html>"), va$1(a2, c2, b2, d2);
    default:
      if (-1 === b2.indexOf("-") && "string" !== typeof c2.is)
        return va$1(a2, c2, b2, d2);
      a2.push(A(b2));
      g2 = e2 = null;
      for (m2 in c2)
        if (p$1.call(c2, m2) && (h3 = c2[m2], null != h3))
          switch (m2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            case "style":
              ta$1(a2, d2, h3);
              break;
            case "suppressContentEditableWarning":
            case "suppressHydrationWarning":
              break;
            default:
              ja$1(m2) && "function" !== typeof h3 && "symbol" !== typeof h3 && a2.push(" ", m2, '="', v(h3), '"');
          }
      a2.push(">");
      y$1(a2, g2, e2);
      return e2;
  }
}
function za$1(a2, b2, c2) {
  a2.push('<!--$?--><template id="');
  if (null === c2)
    throw Error(l$2(395));
  a2.push(c2);
  return a2.push('"></template>');
}
function Aa$1(a2, b2, c2, d2) {
  switch (c2.insertionMode) {
    case 0:
    case 1:
      return a2.push('<div hidden id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 2:
      return a2.push('<svg aria-hidden="true" style="display:none" id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 3:
      return a2.push('<math aria-hidden="true" style="display:none" id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 4:
      return a2.push('<table hidden id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 5:
      return a2.push('<table hidden><tbody id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 6:
      return a2.push('<table hidden><tr id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    case 7:
      return a2.push('<table hidden><colgroup id="'), a2.push(b2.segmentPrefix), b2 = d2.toString(16), a2.push(b2), a2.push('">');
    default:
      throw Error(l$2(397));
  }
}
function Ba$1(a2, b2) {
  switch (b2.insertionMode) {
    case 0:
    case 1:
      return a2.push("</div>");
    case 2:
      return a2.push("</svg>");
    case 3:
      return a2.push("</math>");
    case 4:
      return a2.push("</table>");
    case 5:
      return a2.push("</tbody></table>");
    case 6:
      return a2.push("</tr></table>");
    case 7:
      return a2.push("</colgroup></table>");
    default:
      throw Error(l$2(397));
  }
}
var Ca$1 = /[<\u2028\u2029]/g;
function Da$1(a2) {
  return JSON.stringify(a2).replace(Ca$1, function(a3) {
    switch (a3) {
      case "<":
        return "\\u003c";
      case "\u2028":
        return "\\u2028";
      case "\u2029":
        return "\\u2029";
      default:
        throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React");
    }
  });
}
function Ea$1(a2, b2) {
  b2 = void 0 === b2 ? "" : b2;
  return { bootstrapChunks: [], startInlineScript: "<script>", placeholderPrefix: b2 + "P:", segmentPrefix: b2 + "S:", boundaryPrefix: b2 + "B:", idPrefix: b2, nextSuspenseID: 0, sentCompleteSegmentFunction: false, sentCompleteBoundaryFunction: false, sentClientRenderFunction: false, generateStaticMarkup: a2 };
}
function Fa$1(a2, b2, c2, d2) {
  if (c2.generateStaticMarkup)
    return a2.push(v(b2)), false;
  "" === b2 ? a2 = d2 : (d2 && a2.push("<!-- -->"), a2.push(v(b2)), a2 = true);
  return a2;
}
var B$1 = Object.assign, Ga$1 = Symbol.for("react.element"), Ha$1 = Symbol.for("react.portal"), Ia$1 = Symbol.for("react.fragment"), Ja$1 = Symbol.for("react.strict_mode"), Ka$1 = Symbol.for("react.profiler"), La$1 = Symbol.for("react.provider"), Ma$1 = Symbol.for("react.context"), Na$1 = Symbol.for("react.forward_ref"), Oa$1 = Symbol.for("react.suspense"), Pa$1 = Symbol.for("react.suspense_list"), Qa$1 = Symbol.for("react.memo"), Ra$1 = Symbol.for("react.lazy"), Sa$1 = Symbol.for("react.scope"), Ta$1 = Symbol.for("react.debug_trace_mode"), Ua$1 = Symbol.for("react.legacy_hidden"), Va$1 = Symbol.for("react.default_value"), Wa$1 = Symbol.iterator;
function Xa$1(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case Ia$1:
      return "Fragment";
    case Ha$1:
      return "Portal";
    case Ka$1:
      return "Profiler";
    case Ja$1:
      return "StrictMode";
    case Oa$1:
      return "Suspense";
    case Pa$1:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Ma$1:
        return (a2.displayName || "Context") + ".Consumer";
      case La$1:
        return (a2._context.displayName || "Context") + ".Provider";
      case Na$1:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case Qa$1:
        return b2 = a2.displayName || null, null !== b2 ? b2 : Xa$1(a2.type) || "Memo";
      case Ra$1:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return Xa$1(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
var Ya$1 = {};
function Za$1(a2, b2) {
  a2 = a2.contextTypes;
  if (!a2)
    return Ya$1;
  var c2 = {}, d2;
  for (d2 in a2)
    c2[d2] = b2[d2];
  return c2;
}
var E$1 = null;
function F(a2, b2) {
  if (a2 !== b2) {
    a2.context._currentValue2 = a2.parentValue;
    a2 = a2.parent;
    var c2 = b2.parent;
    if (null === a2) {
      if (null !== c2)
        throw Error(l$2(401));
    } else {
      if (null === c2)
        throw Error(l$2(401));
      F(a2, c2);
    }
    b2.context._currentValue2 = b2.value;
  }
}
function $a$1(a2) {
  a2.context._currentValue2 = a2.parentValue;
  a2 = a2.parent;
  null !== a2 && $a$1(a2);
}
function ab$1(a2) {
  var b2 = a2.parent;
  null !== b2 && ab$1(b2);
  a2.context._currentValue2 = a2.value;
}
function bb$1(a2, b2) {
  a2.context._currentValue2 = a2.parentValue;
  a2 = a2.parent;
  if (null === a2)
    throw Error(l$2(402));
  a2.depth === b2.depth ? F(a2, b2) : bb$1(a2, b2);
}
function cb$1(a2, b2) {
  var c2 = b2.parent;
  if (null === c2)
    throw Error(l$2(402));
  a2.depth === c2.depth ? F(a2, c2) : cb$1(a2, c2);
  b2.context._currentValue2 = b2.value;
}
function G(a2) {
  var b2 = E$1;
  b2 !== a2 && (null === b2 ? ab$1(a2) : null === a2 ? $a$1(b2) : b2.depth === a2.depth ? F(b2, a2) : b2.depth > a2.depth ? bb$1(b2, a2) : cb$1(b2, a2), E$1 = a2);
}
var db$1 = { isMounted: function() {
  return false;
}, enqueueSetState: function(a2, b2) {
  a2 = a2._reactInternals;
  null !== a2.queue && a2.queue.push(b2);
}, enqueueReplaceState: function(a2, b2) {
  a2 = a2._reactInternals;
  a2.replace = true;
  a2.queue = [b2];
}, enqueueForceUpdate: function() {
} };
function eb$1(a2, b2, c2, d2) {
  var f2 = void 0 !== a2.state ? a2.state : null;
  a2.updater = db$1;
  a2.props = c2;
  a2.state = f2;
  var e2 = { queue: [], replace: false };
  a2._reactInternals = e2;
  var g2 = b2.contextType;
  a2.context = "object" === typeof g2 && null !== g2 ? g2._currentValue2 : d2;
  g2 = b2.getDerivedStateFromProps;
  "function" === typeof g2 && (g2 = g2(c2, f2), f2 = null === g2 || void 0 === g2 ? f2 : B$1({}, f2, g2), a2.state = f2);
  if ("function" !== typeof b2.getDerivedStateFromProps && "function" !== typeof a2.getSnapshotBeforeUpdate && ("function" === typeof a2.UNSAFE_componentWillMount || "function" === typeof a2.componentWillMount))
    if (b2 = a2.state, "function" === typeof a2.componentWillMount && a2.componentWillMount(), "function" === typeof a2.UNSAFE_componentWillMount && a2.UNSAFE_componentWillMount(), b2 !== a2.state && db$1.enqueueReplaceState(a2, a2.state, null), null !== e2.queue && 0 < e2.queue.length)
      if (b2 = e2.queue, g2 = e2.replace, e2.queue = null, e2.replace = false, g2 && 1 === b2.length)
        a2.state = b2[0];
      else {
        e2 = g2 ? b2[0] : a2.state;
        f2 = true;
        for (g2 = g2 ? 1 : 0; g2 < b2.length; g2++) {
          var h3 = b2[g2];
          h3 = "function" === typeof h3 ? h3.call(a2, e2, c2, d2) : h3;
          null != h3 && (f2 ? (f2 = false, e2 = B$1({}, e2, h3)) : B$1(e2, h3));
        }
        a2.state = e2;
      }
    else
      e2.queue = null;
}
var fb$1 = { id: 1, overflow: "" };
function gb$1(a2, b2, c2) {
  var d2 = a2.id;
  a2 = a2.overflow;
  var f2 = 32 - H$1(d2) - 1;
  d2 &= ~(1 << f2);
  c2 += 1;
  var e2 = 32 - H$1(b2) + f2;
  if (30 < e2) {
    var g2 = f2 - f2 % 5;
    e2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    f2 -= g2;
    return { id: 1 << 32 - H$1(b2) + f2 | c2 << f2 | d2, overflow: e2 + a2 };
  }
  return { id: 1 << e2 | c2 << f2 | d2, overflow: a2 };
}
var H$1 = Math.clz32 ? Math.clz32 : hb$1, ib$1 = Math.log, jb$1 = Math.LN2;
function hb$1(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (ib$1(a2) / jb$1 | 0) | 0;
}
function kb$1(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var lb$1 = "function" === typeof Object.is ? Object.is : kb$1, I$1 = null, ob$1 = null, J$1 = null, K$1 = null, L$1 = false, M$1 = false, N$1 = 0, O$1 = null, P$1 = 0;
function Q$1() {
  if (null === I$1)
    throw Error(l$2(321));
  return I$1;
}
function pb$1() {
  if (0 < P$1)
    throw Error(l$2(312));
  return { memoizedState: null, queue: null, next: null };
}
function qb$1() {
  null === K$1 ? null === J$1 ? (L$1 = false, J$1 = K$1 = pb$1()) : (L$1 = true, K$1 = J$1) : null === K$1.next ? (L$1 = false, K$1 = K$1.next = pb$1()) : (L$1 = true, K$1 = K$1.next);
  return K$1;
}
function rb$1() {
  ob$1 = I$1 = null;
  M$1 = false;
  J$1 = null;
  P$1 = 0;
  K$1 = O$1 = null;
}
function sb$1(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function tb$1(a2, b2, c2) {
  I$1 = Q$1();
  K$1 = qb$1();
  if (L$1) {
    var d2 = K$1.queue;
    b2 = d2.dispatch;
    if (null !== O$1 && (c2 = O$1.get(d2), void 0 !== c2)) {
      O$1.delete(d2);
      d2 = K$1.memoizedState;
      do
        d2 = a2(d2, c2.action), c2 = c2.next;
      while (null !== c2);
      K$1.memoizedState = d2;
      return [d2, b2];
    }
    return [K$1.memoizedState, b2];
  }
  a2 = a2 === sb$1 ? "function" === typeof b2 ? b2() : b2 : void 0 !== c2 ? c2(b2) : b2;
  K$1.memoizedState = a2;
  a2 = K$1.queue = { last: null, dispatch: null };
  a2 = a2.dispatch = ub$1.bind(null, I$1, a2);
  return [K$1.memoizedState, a2];
}
function vb$1(a2, b2) {
  I$1 = Q$1();
  K$1 = qb$1();
  b2 = void 0 === b2 ? null : b2;
  if (null !== K$1) {
    var c2 = K$1.memoizedState;
    if (null !== c2 && null !== b2) {
      var d2 = c2[1];
      a:
        if (null === d2)
          d2 = false;
        else {
          for (var f2 = 0; f2 < d2.length && f2 < b2.length; f2++)
            if (!lb$1(b2[f2], d2[f2])) {
              d2 = false;
              break a;
            }
          d2 = true;
        }
      if (d2)
        return c2[0];
    }
  }
  a2 = a2();
  K$1.memoizedState = [a2, b2];
  return a2;
}
function ub$1(a2, b2, c2) {
  if (25 <= P$1)
    throw Error(l$2(301));
  if (a2 === I$1)
    if (M$1 = true, a2 = { action: c2, next: null }, null === O$1 && (O$1 = /* @__PURE__ */ new Map()), c2 = O$1.get(b2), void 0 === c2)
      O$1.set(b2, a2);
    else {
      for (b2 = c2; null !== b2.next; )
        b2 = b2.next;
      b2.next = a2;
    }
}
function wb$1() {
  throw Error(l$2(394));
}
function R$1() {
}
var xb$1 = { readContext: function(a2) {
  return a2._currentValue2;
}, useContext: function(a2) {
  Q$1();
  return a2._currentValue2;
}, useMemo: vb$1, useReducer: tb$1, useRef: function(a2) {
  I$1 = Q$1();
  K$1 = qb$1();
  var b2 = K$1.memoizedState;
  return null === b2 ? (a2 = { current: a2 }, K$1.memoizedState = a2) : b2;
}, useState: function(a2) {
  return tb$1(sb$1, a2);
}, useInsertionEffect: R$1, useLayoutEffect: function() {
}, useCallback: function(a2, b2) {
  return vb$1(function() {
    return a2;
  }, b2);
}, useImperativeHandle: R$1, useEffect: R$1, useDebugValue: R$1, useDeferredValue: function(a2) {
  Q$1();
  return a2;
}, useTransition: function() {
  Q$1();
  return [
    false,
    wb$1
  ];
}, useId: function() {
  var a2 = ob$1.treeContext;
  var b2 = a2.overflow;
  a2 = a2.id;
  a2 = (a2 & ~(1 << 32 - H$1(a2) - 1)).toString(32) + b2;
  var c2 = S$1;
  if (null === c2)
    throw Error(l$2(404));
  b2 = N$1++;
  a2 = ":" + c2.idPrefix + "R" + a2;
  0 < b2 && (a2 += "H" + b2.toString(32));
  return a2 + ":";
}, useMutableSource: function(a2, b2) {
  Q$1();
  return b2(a2._source);
}, useSyncExternalStore: function(a2, b2, c2) {
  if (void 0 === c2)
    throw Error(l$2(407));
  return c2();
} }, S$1 = null, yb$1 = aa$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
function zb$1(a2) {
  console.error(a2);
  return null;
}
function T$1() {
}
function Ab$1(a2, b2, c2, d2, f2, e2, g2, h3, k2) {
  var m2 = [], n2 = /* @__PURE__ */ new Set();
  b2 = { destination: null, responseState: b2, progressiveChunkSize: void 0 === d2 ? 12800 : d2, status: 0, fatalError: null, nextSegmentId: 0, allPendingTasks: 0, pendingRootTasks: 0, completedRootSegment: null, abortableTasks: n2, pingedTasks: m2, clientRenderedBoundaries: [], completedBoundaries: [], partialBoundaries: [], onError: void 0 === f2 ? zb$1 : f2, onAllReady: T$1, onShellReady: void 0 === g2 ? T$1 : g2, onShellError: T$1, onFatalError: T$1 };
  c2 = U$1(b2, 0, null, c2, false, false);
  c2.parentFlushed = true;
  a2 = Bb$1(b2, a2, null, c2, n2, Ya$1, null, fb$1);
  m2.push(a2);
  return b2;
}
function Bb$1(a2, b2, c2, d2, f2, e2, g2, h3) {
  a2.allPendingTasks++;
  null === c2 ? a2.pendingRootTasks++ : c2.pendingTasks++;
  var k2 = { node: b2, ping: function() {
    var b3 = a2.pingedTasks;
    b3.push(k2);
    1 === b3.length && Cb$1(a2);
  }, blockedBoundary: c2, blockedSegment: d2, abortSet: f2, legacyContext: e2, context: g2, treeContext: h3 };
  f2.add(k2);
  return k2;
}
function U$1(a2, b2, c2, d2, f2, e2) {
  return { status: 0, id: -1, index: b2, parentFlushed: false, chunks: [], children: [], formatContext: d2, boundary: c2, lastPushedText: f2, textEmbedded: e2 };
}
function V$1(a2, b2) {
  a2 = a2.onError(b2);
  if (null != a2 && "string" !== typeof a2)
    throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + typeof a2 + '" instead');
  return a2;
}
function W$1(a2, b2) {
  var c2 = a2.onShellError;
  c2(b2);
  c2 = a2.onFatalError;
  c2(b2);
  null !== a2.destination ? (a2.status = 2, a2.destination.destroy(b2)) : (a2.status = 1, a2.fatalError = b2);
}
function Db$1(a2, b2, c2, d2, f2) {
  I$1 = {};
  ob$1 = b2;
  N$1 = 0;
  for (a2 = c2(d2, f2); M$1; )
    M$1 = false, N$1 = 0, P$1 += 1, K$1 = null, a2 = c2(d2, f2);
  rb$1();
  return a2;
}
function Eb$1(a2, b2, c2, d2) {
  var f2 = c2.render(), e2 = d2.childContextTypes;
  if (null !== e2 && void 0 !== e2) {
    var g2 = b2.legacyContext;
    if ("function" !== typeof c2.getChildContext)
      d2 = g2;
    else {
      c2 = c2.getChildContext();
      for (var h3 in c2)
        if (!(h3 in e2))
          throw Error(l$2(108, Xa$1(d2) || "Unknown", h3));
      d2 = B$1({}, g2, c2);
    }
    b2.legacyContext = d2;
    X$1(a2, b2, f2);
    b2.legacyContext = g2;
  } else
    X$1(a2, b2, f2);
}
function Fb(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = B$1({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Gb$1(a2, b2, c2, d2, f2) {
  if ("function" === typeof c2)
    if (c2.prototype && c2.prototype.isReactComponent) {
      f2 = Za$1(c2, b2.legacyContext);
      var e2 = c2.contextType;
      e2 = new c2(d2, "object" === typeof e2 && null !== e2 ? e2._currentValue2 : f2);
      eb$1(e2, c2, d2, f2);
      Eb$1(a2, b2, e2, c2);
    } else {
      e2 = Za$1(c2, b2.legacyContext);
      f2 = Db$1(a2, b2, c2, d2, e2);
      var g2 = 0 !== N$1;
      if ("object" === typeof f2 && null !== f2 && "function" === typeof f2.render && void 0 === f2.$$typeof)
        eb$1(f2, c2, d2, e2), Eb$1(a2, b2, f2, c2);
      else if (g2) {
        d2 = b2.treeContext;
        b2.treeContext = gb$1(d2, 1, 0);
        try {
          X$1(a2, b2, f2);
        } finally {
          b2.treeContext = d2;
        }
      } else
        X$1(a2, b2, f2);
    }
  else if ("string" === typeof c2) {
    f2 = b2.blockedSegment;
    e2 = ya$1(f2.chunks, c2, d2, a2.responseState, f2.formatContext);
    f2.lastPushedText = false;
    g2 = f2.formatContext;
    f2.formatContext = ra$1(g2, c2, d2);
    Hb$1(a2, b2, e2);
    f2.formatContext = g2;
    switch (c2) {
      case "area":
      case "base":
      case "br":
      case "col":
      case "embed":
      case "hr":
      case "img":
      case "input":
      case "keygen":
      case "link":
      case "meta":
      case "param":
      case "source":
      case "track":
      case "wbr":
        break;
      default:
        f2.chunks.push("</", c2, ">");
    }
    f2.lastPushedText = false;
  } else {
    switch (c2) {
      case Ua$1:
      case Ta$1:
      case Ja$1:
      case Ka$1:
      case Ia$1:
        X$1(a2, b2, d2.children);
        return;
      case Pa$1:
        X$1(a2, b2, d2.children);
        return;
      case Sa$1:
        throw Error(l$2(343));
      case Oa$1:
        a: {
          c2 = b2.blockedBoundary;
          f2 = b2.blockedSegment;
          e2 = d2.fallback;
          d2 = d2.children;
          g2 = /* @__PURE__ */ new Set();
          var h3 = { id: null, rootSegmentID: -1, parentFlushed: false, pendingTasks: 0, forceClientRender: false, completedSegments: [], byteSize: 0, fallbackAbortableTasks: g2, errorDigest: null }, k2 = U$1(a2, f2.chunks.length, h3, f2.formatContext, false, false);
          f2.children.push(k2);
          f2.lastPushedText = false;
          var m2 = U$1(a2, 0, null, f2.formatContext, false, false);
          m2.parentFlushed = true;
          b2.blockedBoundary = h3;
          b2.blockedSegment = m2;
          try {
            if (Hb$1(
              a2,
              b2,
              d2
            ), a2.responseState.generateStaticMarkup || m2.lastPushedText && m2.textEmbedded && m2.chunks.push("<!-- -->"), m2.status = 1, Y$1(h3, m2), 0 === h3.pendingTasks)
              break a;
          } catch (n2) {
            m2.status = 4, h3.forceClientRender = true, h3.errorDigest = V$1(a2, n2);
          } finally {
            b2.blockedBoundary = c2, b2.blockedSegment = f2;
          }
          b2 = Bb$1(a2, e2, c2, k2, g2, b2.legacyContext, b2.context, b2.treeContext);
          a2.pingedTasks.push(b2);
        }
        return;
    }
    if ("object" === typeof c2 && null !== c2)
      switch (c2.$$typeof) {
        case Na$1:
          d2 = Db$1(a2, b2, c2.render, d2, f2);
          if (0 !== N$1) {
            c2 = b2.treeContext;
            b2.treeContext = gb$1(c2, 1, 0);
            try {
              X$1(a2, b2, d2);
            } finally {
              b2.treeContext = c2;
            }
          } else
            X$1(a2, b2, d2);
          return;
        case Qa$1:
          c2 = c2.type;
          d2 = Fb(c2, d2);
          Gb$1(a2, b2, c2, d2, f2);
          return;
        case La$1:
          f2 = d2.children;
          c2 = c2._context;
          d2 = d2.value;
          e2 = c2._currentValue2;
          c2._currentValue2 = d2;
          g2 = E$1;
          E$1 = d2 = { parent: g2, depth: null === g2 ? 0 : g2.depth + 1, context: c2, parentValue: e2, value: d2 };
          b2.context = d2;
          X$1(a2, b2, f2);
          a2 = E$1;
          if (null === a2)
            throw Error(l$2(403));
          d2 = a2.parentValue;
          a2.context._currentValue2 = d2 === Va$1 ? a2.context._defaultValue : d2;
          a2 = E$1 = a2.parent;
          b2.context = a2;
          return;
        case Ma$1:
          d2 = d2.children;
          d2 = d2(c2._currentValue2);
          X$1(a2, b2, d2);
          return;
        case Ra$1:
          f2 = c2._init;
          c2 = f2(c2._payload);
          d2 = Fb(c2, d2);
          Gb$1(
            a2,
            b2,
            c2,
            d2,
            void 0
          );
          return;
      }
    throw Error(l$2(130, null == c2 ? c2 : typeof c2, ""));
  }
}
function X$1(a2, b2, c2) {
  b2.node = c2;
  if ("object" === typeof c2 && null !== c2) {
    switch (c2.$$typeof) {
      case Ga$1:
        Gb$1(a2, b2, c2.type, c2.props, c2.ref);
        return;
      case Ha$1:
        throw Error(l$2(257));
      case Ra$1:
        var d2 = c2._init;
        c2 = d2(c2._payload);
        X$1(a2, b2, c2);
        return;
    }
    if (qa$1(c2)) {
      Ib$1(a2, b2, c2);
      return;
    }
    null === c2 || "object" !== typeof c2 ? d2 = null : (d2 = Wa$1 && c2[Wa$1] || c2["@@iterator"], d2 = "function" === typeof d2 ? d2 : null);
    if (d2 && (d2 = d2.call(c2))) {
      c2 = d2.next();
      if (!c2.done) {
        var f2 = [];
        do
          f2.push(c2.value), c2 = d2.next();
        while (!c2.done);
        Ib$1(a2, b2, f2);
      }
      return;
    }
    a2 = Object.prototype.toString.call(c2);
    throw Error(l$2(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(c2).join(", ") + "}" : a2));
  }
  "string" === typeof c2 ? (d2 = b2.blockedSegment, d2.lastPushedText = Fa$1(b2.blockedSegment.chunks, c2, a2.responseState, d2.lastPushedText)) : "number" === typeof c2 && (d2 = b2.blockedSegment, d2.lastPushedText = Fa$1(b2.blockedSegment.chunks, "" + c2, a2.responseState, d2.lastPushedText));
}
function Ib$1(a2, b2, c2) {
  for (var d2 = c2.length, f2 = 0; f2 < d2; f2++) {
    var e2 = b2.treeContext;
    b2.treeContext = gb$1(e2, d2, f2);
    try {
      Hb$1(a2, b2, c2[f2]);
    } finally {
      b2.treeContext = e2;
    }
  }
}
function Hb$1(a2, b2, c2) {
  var d2 = b2.blockedSegment.formatContext, f2 = b2.legacyContext, e2 = b2.context;
  try {
    return X$1(a2, b2, c2);
  } catch (k2) {
    if (rb$1(), "object" === typeof k2 && null !== k2 && "function" === typeof k2.then) {
      c2 = k2;
      var g2 = b2.blockedSegment, h3 = U$1(a2, g2.chunks.length, null, g2.formatContext, g2.lastPushedText, true);
      g2.children.push(h3);
      g2.lastPushedText = false;
      a2 = Bb$1(a2, b2.node, b2.blockedBoundary, h3, b2.abortSet, b2.legacyContext, b2.context, b2.treeContext).ping;
      c2.then(a2, a2);
      b2.blockedSegment.formatContext = d2;
      b2.legacyContext = f2;
      b2.context = e2;
      G(e2);
    } else
      throw b2.blockedSegment.formatContext = d2, b2.legacyContext = f2, b2.context = e2, G(e2), k2;
  }
}
function Jb$1(a2) {
  var b2 = a2.blockedBoundary;
  a2 = a2.blockedSegment;
  a2.status = 3;
  Kb$1(this, b2, a2);
}
function Lb$1(a2, b2, c2) {
  var d2 = a2.blockedBoundary;
  a2.blockedSegment.status = 3;
  null === d2 ? (b2.allPendingTasks--, 2 !== b2.status && (b2.status = 2, null !== b2.destination && b2.destination.push(null))) : (d2.pendingTasks--, d2.forceClientRender || (d2.forceClientRender = true, a2 = void 0 === c2 ? Error(l$2(432)) : c2, d2.errorDigest = b2.onError(a2), d2.parentFlushed && b2.clientRenderedBoundaries.push(d2)), d2.fallbackAbortableTasks.forEach(function(a3) {
    return Lb$1(a3, b2, c2);
  }), d2.fallbackAbortableTasks.clear(), b2.allPendingTasks--, 0 === b2.allPendingTasks && (d2 = b2.onAllReady, d2()));
}
function Y$1(a2, b2) {
  if (0 === b2.chunks.length && 1 === b2.children.length && null === b2.children[0].boundary) {
    var c2 = b2.children[0];
    c2.id = b2.id;
    c2.parentFlushed = true;
    1 === c2.status && Y$1(a2, c2);
  } else
    a2.completedSegments.push(b2);
}
function Kb$1(a2, b2, c2) {
  if (null === b2) {
    if (c2.parentFlushed) {
      if (null !== a2.completedRootSegment)
        throw Error(l$2(389));
      a2.completedRootSegment = c2;
    }
    a2.pendingRootTasks--;
    0 === a2.pendingRootTasks && (a2.onShellError = T$1, b2 = a2.onShellReady, b2());
  } else
    b2.pendingTasks--, b2.forceClientRender || (0 === b2.pendingTasks ? (c2.parentFlushed && 1 === c2.status && Y$1(b2, c2), b2.parentFlushed && a2.completedBoundaries.push(b2), b2.fallbackAbortableTasks.forEach(Jb$1, a2), b2.fallbackAbortableTasks.clear()) : c2.parentFlushed && 1 === c2.status && (Y$1(b2, c2), 1 === b2.completedSegments.length && b2.parentFlushed && a2.partialBoundaries.push(b2)));
  a2.allPendingTasks--;
  0 === a2.allPendingTasks && (a2 = a2.onAllReady, a2());
}
function Cb$1(a2) {
  if (2 !== a2.status) {
    var b2 = E$1, c2 = yb$1.current;
    yb$1.current = xb$1;
    var d2 = S$1;
    S$1 = a2.responseState;
    try {
      var f2 = a2.pingedTasks, e2;
      for (e2 = 0; e2 < f2.length; e2++) {
        var g2 = f2[e2];
        var h3 = a2, k2 = g2.blockedSegment;
        if (0 === k2.status) {
          G(g2.context);
          try {
            X$1(h3, g2, g2.node), h3.responseState.generateStaticMarkup || k2.lastPushedText && k2.textEmbedded && k2.chunks.push("<!-- -->"), g2.abortSet.delete(g2), k2.status = 1, Kb$1(h3, g2.blockedBoundary, k2);
          } catch (z2) {
            if (rb$1(), "object" === typeof z2 && null !== z2 && "function" === typeof z2.then) {
              var m2 = g2.ping;
              z2.then(m2, m2);
            } else {
              g2.abortSet.delete(g2);
              k2.status = 4;
              var n2 = g2.blockedBoundary, q2 = z2, C2 = V$1(h3, q2);
              null === n2 ? W$1(h3, q2) : (n2.pendingTasks--, n2.forceClientRender || (n2.forceClientRender = true, n2.errorDigest = C2, n2.parentFlushed && h3.clientRenderedBoundaries.push(n2)));
              h3.allPendingTasks--;
              if (0 === h3.allPendingTasks) {
                var D2 = h3.onAllReady;
                D2();
              }
            }
          } finally {
          }
        }
      }
      f2.splice(0, e2);
      null !== a2.destination && Mb$1(a2, a2.destination);
    } catch (z2) {
      V$1(a2, z2), W$1(a2, z2);
    } finally {
      S$1 = d2, yb$1.current = c2, c2 === xb$1 && G(b2);
    }
  }
}
function Z$1(a2, b2, c2) {
  c2.parentFlushed = true;
  switch (c2.status) {
    case 0:
      var d2 = c2.id = a2.nextSegmentId++;
      c2.lastPushedText = false;
      c2.textEmbedded = false;
      a2 = a2.responseState;
      b2.push('<template id="');
      b2.push(a2.placeholderPrefix);
      a2 = d2.toString(16);
      b2.push(a2);
      return b2.push('"></template>');
    case 1:
      c2.status = 2;
      var f2 = true;
      d2 = c2.chunks;
      var e2 = 0;
      c2 = c2.children;
      for (var g2 = 0; g2 < c2.length; g2++) {
        for (f2 = c2[g2]; e2 < f2.index; e2++)
          b2.push(d2[e2]);
        f2 = Nb$1(a2, b2, f2);
      }
      for (; e2 < d2.length - 1; e2++)
        b2.push(d2[e2]);
      e2 < d2.length && (f2 = b2.push(d2[e2]));
      return f2;
    default:
      throw Error(l$2(390));
  }
}
function Nb$1(a2, b2, c2) {
  var d2 = c2.boundary;
  if (null === d2)
    return Z$1(a2, b2, c2);
  d2.parentFlushed = true;
  if (d2.forceClientRender)
    return a2.responseState.generateStaticMarkup || (d2 = d2.errorDigest, b2.push("<!--$!-->"), b2.push("<template"), d2 && (b2.push(' data-dgst="'), d2 = v(d2), b2.push(d2), b2.push('"')), b2.push("></template>")), Z$1(a2, b2, c2), a2 = a2.responseState.generateStaticMarkup ? true : b2.push("<!--/$-->"), a2;
  if (0 < d2.pendingTasks) {
    d2.rootSegmentID = a2.nextSegmentId++;
    0 < d2.completedSegments.length && a2.partialBoundaries.push(d2);
    var f2 = a2.responseState;
    var e2 = f2.nextSuspenseID++;
    f2 = f2.boundaryPrefix + e2.toString(16);
    d2 = d2.id = f2;
    za$1(b2, a2.responseState, d2);
    Z$1(a2, b2, c2);
    return b2.push("<!--/$-->");
  }
  if (d2.byteSize > a2.progressiveChunkSize)
    return d2.rootSegmentID = a2.nextSegmentId++, a2.completedBoundaries.push(d2), za$1(b2, a2.responseState, d2.id), Z$1(a2, b2, c2), b2.push("<!--/$-->");
  a2.responseState.generateStaticMarkup || b2.push("<!--$-->");
  c2 = d2.completedSegments;
  if (1 !== c2.length)
    throw Error(l$2(391));
  Nb$1(a2, b2, c2[0]);
  a2 = a2.responseState.generateStaticMarkup ? true : b2.push("<!--/$-->");
  return a2;
}
function Ob$1(a2, b2, c2) {
  Aa$1(b2, a2.responseState, c2.formatContext, c2.id);
  Nb$1(a2, b2, c2);
  return Ba$1(b2, c2.formatContext);
}
function Pb$1(a2, b2, c2) {
  for (var d2 = c2.completedSegments, f2 = 0; f2 < d2.length; f2++)
    Qb$1(a2, b2, c2, d2[f2]);
  d2.length = 0;
  a2 = a2.responseState;
  d2 = c2.id;
  c2 = c2.rootSegmentID;
  b2.push(a2.startInlineScript);
  a2.sentCompleteBoundaryFunction ? b2.push('$RC("') : (a2.sentCompleteBoundaryFunction = true, b2.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'));
  if (null === d2)
    throw Error(l$2(395));
  c2 = c2.toString(16);
  b2.push(d2);
  b2.push('","');
  b2.push(a2.segmentPrefix);
  b2.push(c2);
  return b2.push('")<\/script>');
}
function Qb$1(a2, b2, c2, d2) {
  if (2 === d2.status)
    return true;
  var f2 = d2.id;
  if (-1 === f2) {
    if (-1 === (d2.id = c2.rootSegmentID))
      throw Error(l$2(392));
    return Ob$1(a2, b2, d2);
  }
  Ob$1(a2, b2, d2);
  a2 = a2.responseState;
  b2.push(a2.startInlineScript);
  a2.sentCompleteSegmentFunction ? b2.push('$RS("') : (a2.sentCompleteSegmentFunction = true, b2.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'));
  b2.push(a2.segmentPrefix);
  f2 = f2.toString(16);
  b2.push(f2);
  b2.push('","');
  b2.push(a2.placeholderPrefix);
  b2.push(f2);
  return b2.push('")<\/script>');
}
function Mb$1(a2, b2) {
  try {
    var c2 = a2.completedRootSegment;
    if (null !== c2 && 0 === a2.pendingRootTasks) {
      Nb$1(a2, b2, c2);
      a2.completedRootSegment = null;
      var d2 = a2.responseState.bootstrapChunks;
      for (c2 = 0; c2 < d2.length - 1; c2++)
        b2.push(d2[c2]);
      c2 < d2.length && b2.push(d2[c2]);
    }
    var f2 = a2.clientRenderedBoundaries, e2;
    for (e2 = 0; e2 < f2.length; e2++) {
      var g2 = f2[e2];
      d2 = b2;
      var h3 = a2.responseState, k2 = g2.id, m2 = g2.errorDigest, n2 = g2.errorMessage, q2 = g2.errorComponentStack;
      d2.push(h3.startInlineScript);
      h3.sentClientRenderFunction ? d2.push('$RX("') : (h3.sentClientRenderFunction = true, d2.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'));
      if (null === k2)
        throw Error(l$2(395));
      d2.push(k2);
      d2.push('"');
      if (m2 || n2 || q2) {
        d2.push(",");
        var C2 = Da$1(m2 || "");
        d2.push(C2);
      }
      if (n2 || q2) {
        d2.push(",");
        var D2 = Da$1(n2 || "");
        d2.push(D2);
      }
      if (q2) {
        d2.push(",");
        var z2 = Da$1(q2);
        d2.push(z2);
      }
      if (!d2.push(")<\/script>")) {
        a2.destination = null;
        e2++;
        f2.splice(0, e2);
        return;
      }
    }
    f2.splice(0, e2);
    var ba2 = a2.completedBoundaries;
    for (e2 = 0; e2 < ba2.length; e2++)
      if (!Pb$1(a2, b2, ba2[e2])) {
        a2.destination = null;
        e2++;
        ba2.splice(0, e2);
        return;
      }
    ba2.splice(0, e2);
    var ca2 = a2.partialBoundaries;
    for (e2 = 0; e2 < ca2.length; e2++) {
      var mb2 = ca2[e2];
      a: {
        f2 = a2;
        g2 = b2;
        var da2 = mb2.completedSegments;
        for (h3 = 0; h3 < da2.length; h3++)
          if (!Qb$1(f2, g2, mb2, da2[h3])) {
            h3++;
            da2.splice(0, h3);
            var nb2 = false;
            break a;
          }
        da2.splice(0, h3);
        nb2 = true;
      }
      if (!nb2) {
        a2.destination = null;
        e2++;
        ca2.splice(0, e2);
        return;
      }
    }
    ca2.splice(0, e2);
    var ea2 = a2.completedBoundaries;
    for (e2 = 0; e2 < ea2.length; e2++)
      if (!Pb$1(a2, b2, ea2[e2])) {
        a2.destination = null;
        e2++;
        ea2.splice(0, e2);
        return;
      }
    ea2.splice(0, e2);
  } finally {
    0 === a2.allPendingTasks && 0 === a2.pingedTasks.length && 0 === a2.clientRenderedBoundaries.length && 0 === a2.completedBoundaries.length && b2.push(null);
  }
}
function Rb$1(a2, b2) {
  try {
    var c2 = a2.abortableTasks;
    c2.forEach(function(c3) {
      return Lb$1(c3, a2, b2);
    });
    c2.clear();
    null !== a2.destination && Mb$1(a2, a2.destination);
  } catch (d2) {
    V$1(a2, d2), W$1(a2, d2);
  }
}
function Sb$1() {
}
function Tb$1(a2, b2, c2, d2) {
  var f2 = false, e2 = null, g2 = "", h3 = { push: function(a3) {
    null !== a3 && (g2 += a3);
    return true;
  }, destroy: function(a3) {
    f2 = true;
    e2 = a3;
  } }, k2 = false;
  a2 = Ab$1(a2, Ea$1(c2, b2 ? b2.identifierPrefix : void 0), { insertionMode: 1, selectedValue: null }, Infinity, Sb$1, void 0, function() {
    k2 = true;
  });
  Cb$1(a2);
  Rb$1(a2, d2);
  if (1 === a2.status)
    a2.status = 2, h3.destroy(a2.fatalError);
  else if (2 !== a2.status && null === a2.destination) {
    a2.destination = h3;
    try {
      Mb$1(a2, h3);
    } catch (m2) {
      V$1(a2, m2), W$1(a2, m2);
    }
  }
  if (f2)
    throw e2;
  if (!k2)
    throw Error(l$2(426));
  return g2;
}
reactDomServerLegacy_browser_production_min.renderToNodeStream = function() {
  throw Error(l$2(207));
};
reactDomServerLegacy_browser_production_min.renderToStaticMarkup = function(a2, b2) {
  return Tb$1(a2, b2, true, 'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server');
};
reactDomServerLegacy_browser_production_min.renderToStaticNodeStream = function() {
  throw Error(l$2(208));
};
reactDomServerLegacy_browser_production_min.renderToString = function(a2, b2) {
  return Tb$1(a2, b2, false, 'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server');
};
reactDomServerLegacy_browser_production_min.version = "18.3.1";
var reactDomServer_browser_production_min = {};
/**
 * @license React
 * react-dom-server.browser.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var aa = reactExports;
function k(a2) {
  for (var b2 = "https://reactjs.org/docs/error-decoder.html?invariant=" + a2, c2 = 1; c2 < arguments.length; c2++)
    b2 += "&args[]=" + encodeURIComponent(arguments[c2]);
  return "Minified React error #" + a2 + "; visit " + b2 + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var l$1 = null, n = 0;
function p(a2, b2) {
  if (0 !== b2.length)
    if (512 < b2.length)
      0 < n && (a2.enqueue(new Uint8Array(l$1.buffer, 0, n)), l$1 = new Uint8Array(512), n = 0), a2.enqueue(b2);
    else {
      var c2 = l$1.length - n;
      c2 < b2.length && (0 === c2 ? a2.enqueue(l$1) : (l$1.set(b2.subarray(0, c2), n), a2.enqueue(l$1), b2 = b2.subarray(c2)), l$1 = new Uint8Array(512), n = 0);
      l$1.set(b2, n);
      n += b2.length;
    }
}
function t(a2, b2) {
  p(a2, b2);
  return true;
}
function ba(a2) {
  l$1 && 0 < n && (a2.enqueue(new Uint8Array(l$1.buffer, 0, n)), l$1 = null, n = 0);
}
var ca = new TextEncoder();
function u(a2) {
  return ca.encode(a2);
}
function w(a2) {
  return ca.encode(a2);
}
function da(a2, b2) {
  "function" === typeof a2.error ? a2.error(b2) : a2.close();
}
var x = Object.prototype.hasOwnProperty, ea = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/, fa = {}, ha = {};
function ia(a2) {
  if (x.call(ha, a2))
    return true;
  if (x.call(fa, a2))
    return false;
  if (ea.test(a2))
    return ha[a2] = true;
  fa[a2] = true;
  return false;
}
function y(a2, b2, c2, d2, f2, e2, g2) {
  this.acceptsBooleans = 2 === b2 || 3 === b2 || 4 === b2;
  this.attributeName = d2;
  this.attributeNamespace = f2;
  this.mustUseProperty = c2;
  this.propertyName = a2;
  this.type = b2;
  this.sanitizeURL = e2;
  this.removeEmptyString = g2;
}
var z = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a2) {
  z[a2] = new y(a2, 0, false, a2, null, false, false);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(a2) {
  var b2 = a2[0];
  z[b2] = new y(b2, 1, false, a2[1], null, false, false);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(a2) {
  z[a2] = new y(a2, 2, false, a2.toLowerCase(), null, false, false);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(a2) {
  z[a2] = new y(a2, 2, false, a2, null, false, false);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a2) {
  z[a2] = new y(a2, 3, false, a2.toLowerCase(), null, false, false);
});
["checked", "multiple", "muted", "selected"].forEach(function(a2) {
  z[a2] = new y(a2, 3, true, a2, null, false, false);
});
["capture", "download"].forEach(function(a2) {
  z[a2] = new y(a2, 4, false, a2, null, false, false);
});
["cols", "rows", "size", "span"].forEach(function(a2) {
  z[a2] = new y(a2, 6, false, a2, null, false, false);
});
["rowSpan", "start"].forEach(function(a2) {
  z[a2] = new y(a2, 5, false, a2.toLowerCase(), null, false, false);
});
var ja = /[\-:]([a-z])/g;
function ka(a2) {
  return a2[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a2) {
  var b2 = a2.replace(
    ja,
    ka
  );
  z[b2] = new y(b2, 1, false, a2, null, false, false);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a2) {
  var b2 = a2.replace(ja, ka);
  z[b2] = new y(b2, 1, false, a2, "http://www.w3.org/1999/xlink", false, false);
});
["xml:base", "xml:lang", "xml:space"].forEach(function(a2) {
  var b2 = a2.replace(ja, ka);
  z[b2] = new y(b2, 1, false, a2, "http://www.w3.org/XML/1998/namespace", false, false);
});
["tabIndex", "crossOrigin"].forEach(function(a2) {
  z[a2] = new y(a2, 1, false, a2.toLowerCase(), null, false, false);
});
z.xlinkHref = new y("xlinkHref", 1, false, "xlink:href", "http://www.w3.org/1999/xlink", true, false);
["src", "href", "action", "formAction"].forEach(function(a2) {
  z[a2] = new y(a2, 1, false, a2.toLowerCase(), null, true, true);
});
var B = {
  animationIterationCount: true,
  aspectRatio: true,
  borderImageOutset: true,
  borderImageSlice: true,
  borderImageWidth: true,
  boxFlex: true,
  boxFlexGroup: true,
  boxOrdinalGroup: true,
  columnCount: true,
  columns: true,
  flex: true,
  flexGrow: true,
  flexPositive: true,
  flexShrink: true,
  flexNegative: true,
  flexOrder: true,
  gridArea: true,
  gridRow: true,
  gridRowEnd: true,
  gridRowSpan: true,
  gridRowStart: true,
  gridColumn: true,
  gridColumnEnd: true,
  gridColumnSpan: true,
  gridColumnStart: true,
  fontWeight: true,
  lineClamp: true,
  lineHeight: true,
  opacity: true,
  order: true,
  orphans: true,
  tabSize: true,
  widows: true,
  zIndex: true,
  zoom: true,
  fillOpacity: true,
  floodOpacity: true,
  stopOpacity: true,
  strokeDasharray: true,
  strokeDashoffset: true,
  strokeMiterlimit: true,
  strokeOpacity: true,
  strokeWidth: true
}, la = ["Webkit", "ms", "Moz", "O"];
Object.keys(B).forEach(function(a2) {
  la.forEach(function(b2) {
    b2 = b2 + a2.charAt(0).toUpperCase() + a2.substring(1);
    B[b2] = B[a2];
  });
});
var oa = /["'&<>]/;
function C(a2) {
  if ("boolean" === typeof a2 || "number" === typeof a2)
    return "" + a2;
  a2 = "" + a2;
  var b2 = oa.exec(a2);
  if (b2) {
    var c2 = "", d2, f2 = 0;
    for (d2 = b2.index; d2 < a2.length; d2++) {
      switch (a2.charCodeAt(d2)) {
        case 34:
          b2 = "&quot;";
          break;
        case 38:
          b2 = "&amp;";
          break;
        case 39:
          b2 = "&#x27;";
          break;
        case 60:
          b2 = "&lt;";
          break;
        case 62:
          b2 = "&gt;";
          break;
        default:
          continue;
      }
      f2 !== d2 && (c2 += a2.substring(f2, d2));
      f2 = d2 + 1;
      c2 += b2;
    }
    a2 = f2 !== d2 ? c2 + a2.substring(f2, d2) : c2;
  }
  return a2;
}
var pa = /([A-Z])/g, qa = /^ms-/, ra = Array.isArray, sa = w("<script>"), ta = w("<\/script>"), ua = w('<script src="'), va = w('<script type="module" src="'), wa = w('" async=""><\/script>'), xa = /(<\/|<)(s)(cript)/gi;
function ya(a2, b2, c2, d2) {
  return "" + b2 + ("s" === c2 ? "\\u0073" : "\\u0053") + d2;
}
function za(a2, b2, c2, d2, f2) {
  a2 = void 0 === a2 ? "" : a2;
  b2 = void 0 === b2 ? sa : w('<script nonce="' + C(b2) + '">');
  var e2 = [];
  void 0 !== c2 && e2.push(b2, u(("" + c2).replace(xa, ya)), ta);
  if (void 0 !== d2)
    for (c2 = 0; c2 < d2.length; c2++)
      e2.push(ua, u(C(d2[c2])), wa);
  if (void 0 !== f2)
    for (d2 = 0; d2 < f2.length; d2++)
      e2.push(va, u(C(f2[d2])), wa);
  return { bootstrapChunks: e2, startInlineScript: b2, placeholderPrefix: w(a2 + "P:"), segmentPrefix: w(a2 + "S:"), boundaryPrefix: a2 + "B:", idPrefix: a2, nextSuspenseID: 0, sentCompleteSegmentFunction: false, sentCompleteBoundaryFunction: false, sentClientRenderFunction: false };
}
function D(a2, b2) {
  return { insertionMode: a2, selectedValue: b2 };
}
function Aa(a2) {
  return D("http://www.w3.org/2000/svg" === a2 ? 2 : "http://www.w3.org/1998/Math/MathML" === a2 ? 3 : 0, null);
}
function Ba(a2, b2, c2) {
  switch (b2) {
    case "select":
      return D(1, null != c2.value ? c2.value : c2.defaultValue);
    case "svg":
      return D(2, null);
    case "math":
      return D(3, null);
    case "foreignObject":
      return D(1, null);
    case "table":
      return D(4, null);
    case "thead":
    case "tbody":
    case "tfoot":
      return D(5, null);
    case "colgroup":
      return D(7, null);
    case "tr":
      return D(6, null);
  }
  return 4 <= a2.insertionMode || 0 === a2.insertionMode ? D(1, null) : a2;
}
var Ca = w("<!-- -->");
function Da(a2, b2, c2, d2) {
  if ("" === b2)
    return d2;
  d2 && a2.push(Ca);
  a2.push(u(C(b2)));
  return true;
}
var Ea = /* @__PURE__ */ new Map(), Fa = w(' style="'), Ga = w(":"), Ha = w(";");
function Ia(a2, b2, c2) {
  if ("object" !== typeof c2)
    throw Error(k(62));
  b2 = true;
  for (var d2 in c2)
    if (x.call(c2, d2)) {
      var f2 = c2[d2];
      if (null != f2 && "boolean" !== typeof f2 && "" !== f2) {
        if (0 === d2.indexOf("--")) {
          var e2 = u(C(d2));
          f2 = u(C(("" + f2).trim()));
        } else {
          e2 = d2;
          var g2 = Ea.get(e2);
          void 0 !== g2 ? e2 = g2 : (g2 = w(C(e2.replace(pa, "-$1").toLowerCase().replace(qa, "-ms-"))), Ea.set(e2, g2), e2 = g2);
          f2 = "number" === typeof f2 ? 0 === f2 || x.call(B, d2) ? u("" + f2) : u(f2 + "px") : u(C(("" + f2).trim()));
        }
        b2 ? (b2 = false, a2.push(Fa, e2, Ga, f2)) : a2.push(Ha, e2, Ga, f2);
      }
    }
  b2 || a2.push(E);
}
var H = w(" "), I = w('="'), E = w('"'), Ja = w('=""');
function J(a2, b2, c2, d2) {
  switch (c2) {
    case "style":
      Ia(a2, b2, d2);
      return;
    case "defaultValue":
    case "defaultChecked":
    case "innerHTML":
    case "suppressContentEditableWarning":
    case "suppressHydrationWarning":
      return;
  }
  if (!(2 < c2.length) || "o" !== c2[0] && "O" !== c2[0] || "n" !== c2[1] && "N" !== c2[1]) {
    if (b2 = z.hasOwnProperty(c2) ? z[c2] : null, null !== b2) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (!b2.acceptsBooleans)
            return;
      }
      c2 = u(b2.attributeName);
      switch (b2.type) {
        case 3:
          d2 && a2.push(H, c2, Ja);
          break;
        case 4:
          true === d2 ? a2.push(H, c2, Ja) : false !== d2 && a2.push(H, c2, I, u(C(d2)), E);
          break;
        case 5:
          isNaN(d2) || a2.push(H, c2, I, u(C(d2)), E);
          break;
        case 6:
          !isNaN(d2) && 1 <= d2 && a2.push(H, c2, I, u(C(d2)), E);
          break;
        default:
          b2.sanitizeURL && (d2 = "" + d2), a2.push(H, c2, I, u(C(d2)), E);
      }
    } else if (ia(c2)) {
      switch (typeof d2) {
        case "function":
        case "symbol":
          return;
        case "boolean":
          if (b2 = c2.toLowerCase().slice(0, 5), "data-" !== b2 && "aria-" !== b2)
            return;
      }
      a2.push(H, u(c2), I, u(C(d2)), E);
    }
  }
}
var K = w(">"), Ka = w("/>");
function L(a2, b2, c2) {
  if (null != b2) {
    if (null != c2)
      throw Error(k(60));
    if ("object" !== typeof b2 || !("__html" in b2))
      throw Error(k(61));
    b2 = b2.__html;
    null !== b2 && void 0 !== b2 && a2.push(u("" + b2));
  }
}
function La(a2) {
  var b2 = "";
  aa.Children.forEach(a2, function(a3) {
    null != a3 && (b2 += a3);
  });
  return b2;
}
var Ma = w(' selected=""');
function Na(a2, b2, c2, d2) {
  a2.push(M(c2));
  var f2 = c2 = null, e2;
  for (e2 in b2)
    if (x.call(b2, e2)) {
      var g2 = b2[e2];
      if (null != g2)
        switch (e2) {
          case "children":
            c2 = g2;
            break;
          case "dangerouslySetInnerHTML":
            f2 = g2;
            break;
          default:
            J(a2, d2, e2, g2);
        }
    }
  a2.push(K);
  L(a2, f2, c2);
  return "string" === typeof c2 ? (a2.push(u(C(c2))), null) : c2;
}
var Oa = w("\n"), Pa = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/, Qa = /* @__PURE__ */ new Map();
function M(a2) {
  var b2 = Qa.get(a2);
  if (void 0 === b2) {
    if (!Pa.test(a2))
      throw Error(k(65, a2));
    b2 = w("<" + a2);
    Qa.set(a2, b2);
  }
  return b2;
}
var Ra = w("<!DOCTYPE html>");
function Sa(a2, b2, c2, d2, f2) {
  switch (b2) {
    case "select":
      a2.push(M("select"));
      var e2 = null, g2 = null;
      for (r2 in c2)
        if (x.call(c2, r2)) {
          var h3 = c2[r2];
          if (null != h3)
            switch (r2) {
              case "children":
                e2 = h3;
                break;
              case "dangerouslySetInnerHTML":
                g2 = h3;
                break;
              case "defaultValue":
              case "value":
                break;
              default:
                J(a2, d2, r2, h3);
            }
        }
      a2.push(K);
      L(a2, g2, e2);
      return e2;
    case "option":
      g2 = f2.selectedValue;
      a2.push(M("option"));
      var m2 = h3 = null, q2 = null;
      var r2 = null;
      for (e2 in c2)
        if (x.call(c2, e2)) {
          var v2 = c2[e2];
          if (null != v2)
            switch (e2) {
              case "children":
                h3 = v2;
                break;
              case "selected":
                q2 = v2;
                break;
              case "dangerouslySetInnerHTML":
                r2 = v2;
                break;
              case "value":
                m2 = v2;
              default:
                J(a2, d2, e2, v2);
            }
        }
      if (null != g2)
        if (c2 = null !== m2 ? "" + m2 : La(h3), ra(g2))
          for (d2 = 0; d2 < g2.length; d2++) {
            if ("" + g2[d2] === c2) {
              a2.push(Ma);
              break;
            }
          }
        else
          "" + g2 === c2 && a2.push(Ma);
      else
        q2 && a2.push(Ma);
      a2.push(K);
      L(a2, r2, h3);
      return h3;
    case "textarea":
      a2.push(M("textarea"));
      r2 = g2 = e2 = null;
      for (h3 in c2)
        if (x.call(c2, h3) && (m2 = c2[h3], null != m2))
          switch (h3) {
            case "children":
              r2 = m2;
              break;
            case "value":
              e2 = m2;
              break;
            case "defaultValue":
              g2 = m2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(k(91));
            default:
              J(a2, d2, h3, m2);
          }
      null === e2 && null !== g2 && (e2 = g2);
      a2.push(K);
      if (null != r2) {
        if (null != e2)
          throw Error(k(92));
        if (ra(r2) && 1 < r2.length)
          throw Error(k(93));
        e2 = "" + r2;
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push(Oa);
      null !== e2 && a2.push(u(C("" + e2)));
      return null;
    case "input":
      a2.push(M("input"));
      m2 = r2 = h3 = e2 = null;
      for (g2 in c2)
        if (x.call(c2, g2) && (q2 = c2[g2], null != q2))
          switch (g2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(399, "input"));
            case "defaultChecked":
              m2 = q2;
              break;
            case "defaultValue":
              h3 = q2;
              break;
            case "checked":
              r2 = q2;
              break;
            case "value":
              e2 = q2;
              break;
            default:
              J(a2, d2, g2, q2);
          }
      null !== r2 ? J(
        a2,
        d2,
        "checked",
        r2
      ) : null !== m2 && J(a2, d2, "checked", m2);
      null !== e2 ? J(a2, d2, "value", e2) : null !== h3 && J(a2, d2, "value", h3);
      a2.push(Ka);
      return null;
    case "menuitem":
      a2.push(M("menuitem"));
      for (var A2 in c2)
        if (x.call(c2, A2) && (e2 = c2[A2], null != e2))
          switch (A2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(400));
            default:
              J(a2, d2, A2, e2);
          }
      a2.push(K);
      return null;
    case "title":
      a2.push(M("title"));
      e2 = null;
      for (v2 in c2)
        if (x.call(c2, v2) && (g2 = c2[v2], null != g2))
          switch (v2) {
            case "children":
              e2 = g2;
              break;
            case "dangerouslySetInnerHTML":
              throw Error(k(434));
            default:
              J(a2, d2, v2, g2);
          }
      a2.push(K);
      return e2;
    case "listing":
    case "pre":
      a2.push(M(b2));
      g2 = e2 = null;
      for (m2 in c2)
        if (x.call(c2, m2) && (h3 = c2[m2], null != h3))
          switch (m2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            default:
              J(a2, d2, m2, h3);
          }
      a2.push(K);
      if (null != g2) {
        if (null != e2)
          throw Error(k(60));
        if ("object" !== typeof g2 || !("__html" in g2))
          throw Error(k(61));
        c2 = g2.__html;
        null !== c2 && void 0 !== c2 && ("string" === typeof c2 && 0 < c2.length && "\n" === c2[0] ? a2.push(Oa, u(c2)) : a2.push(u("" + c2)));
      }
      "string" === typeof e2 && "\n" === e2[0] && a2.push(Oa);
      return e2;
    case "area":
    case "base":
    case "br":
    case "col":
    case "embed":
    case "hr":
    case "img":
    case "keygen":
    case "link":
    case "meta":
    case "param":
    case "source":
    case "track":
    case "wbr":
      a2.push(M(b2));
      for (var F2 in c2)
        if (x.call(c2, F2) && (e2 = c2[F2], null != e2))
          switch (F2) {
            case "children":
            case "dangerouslySetInnerHTML":
              throw Error(k(399, b2));
            default:
              J(a2, d2, F2, e2);
          }
      a2.push(Ka);
      return null;
    case "annotation-xml":
    case "color-profile":
    case "font-face":
    case "font-face-src":
    case "font-face-uri":
    case "font-face-format":
    case "font-face-name":
    case "missing-glyph":
      return Na(a2, c2, b2, d2);
    case "html":
      return 0 === f2.insertionMode && a2.push(Ra), Na(a2, c2, b2, d2);
    default:
      if (-1 === b2.indexOf("-") && "string" !== typeof c2.is)
        return Na(a2, c2, b2, d2);
      a2.push(M(b2));
      g2 = e2 = null;
      for (q2 in c2)
        if (x.call(c2, q2) && (h3 = c2[q2], null != h3))
          switch (q2) {
            case "children":
              e2 = h3;
              break;
            case "dangerouslySetInnerHTML":
              g2 = h3;
              break;
            case "style":
              Ia(a2, d2, h3);
              break;
            case "suppressContentEditableWarning":
            case "suppressHydrationWarning":
              break;
            default:
              ia(q2) && "function" !== typeof h3 && "symbol" !== typeof h3 && a2.push(H, u(q2), I, u(C(h3)), E);
          }
      a2.push(K);
      L(a2, g2, e2);
      return e2;
  }
}
var Ta = w("</"), Ua = w(">"), Va = w('<template id="'), Wa = w('"></template>'), Xa = w("<!--$-->"), Ya = w('<!--$?--><template id="'), Za = w('"></template>'), $a = w("<!--$!-->"), ab = w("<!--/$-->"), bb = w("<template"), cb = w('"'), db = w(' data-dgst="');
w(' data-msg="');
w(' data-stck="');
var eb = w("></template>");
function fb(a2, b2, c2) {
  p(a2, Ya);
  if (null === c2)
    throw Error(k(395));
  p(a2, c2);
  return t(a2, Za);
}
var gb = w('<div hidden id="'), hb = w('">'), ib = w("</div>"), jb = w('<svg aria-hidden="true" style="display:none" id="'), kb = w('">'), lb = w("</svg>"), mb = w('<math aria-hidden="true" style="display:none" id="'), nb = w('">'), ob = w("</math>"), pb = w('<table hidden id="'), qb = w('">'), rb = w("</table>"), sb = w('<table hidden><tbody id="'), tb = w('">'), ub = w("</tbody></table>"), vb = w('<table hidden><tr id="'), wb = w('">'), xb = w("</tr></table>"), yb = w('<table hidden><colgroup id="'), zb = w('">'), Ab = w("</colgroup></table>");
function Bb(a2, b2, c2, d2) {
  switch (c2.insertionMode) {
    case 0:
    case 1:
      return p(a2, gb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, hb);
    case 2:
      return p(a2, jb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, kb);
    case 3:
      return p(a2, mb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, nb);
    case 4:
      return p(a2, pb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, qb);
    case 5:
      return p(a2, sb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, tb);
    case 6:
      return p(a2, vb), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, wb);
    case 7:
      return p(
        a2,
        yb
      ), p(a2, b2.segmentPrefix), p(a2, u(d2.toString(16))), t(a2, zb);
    default:
      throw Error(k(397));
  }
}
function Cb(a2, b2) {
  switch (b2.insertionMode) {
    case 0:
    case 1:
      return t(a2, ib);
    case 2:
      return t(a2, lb);
    case 3:
      return t(a2, ob);
    case 4:
      return t(a2, rb);
    case 5:
      return t(a2, ub);
    case 6:
      return t(a2, xb);
    case 7:
      return t(a2, Ab);
    default:
      throw Error(k(397));
  }
}
var Db = w('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'), Eb = w('$RS("'), Gb = w('","'), Hb = w('")<\/script>'), Ib = w('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'), Jb = w('$RC("'), Kb = w('","'), Lb = w('")<\/script>'), Mb = w('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'), Nb = w('$RX("'), Ob = w('"'), Pb = w(")<\/script>"), Qb = w(","), Rb = /[<\u2028\u2029]/g;
function Sb(a2) {
  return JSON.stringify(a2).replace(Rb, function(a3) {
    switch (a3) {
      case "<":
        return "\\u003c";
      case "\u2028":
        return "\\u2028";
      case "\u2029":
        return "\\u2029";
      default:
        throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React");
    }
  });
}
var N = Object.assign, Tb = Symbol.for("react.element"), Ub = Symbol.for("react.portal"), Vb = Symbol.for("react.fragment"), Wb = Symbol.for("react.strict_mode"), Xb = Symbol.for("react.profiler"), Yb = Symbol.for("react.provider"), Zb = Symbol.for("react.context"), $b = Symbol.for("react.forward_ref"), ac = Symbol.for("react.suspense"), bc = Symbol.for("react.suspense_list"), cc = Symbol.for("react.memo"), dc = Symbol.for("react.lazy"), ec = Symbol.for("react.scope"), fc = Symbol.for("react.debug_trace_mode"), gc = Symbol.for("react.legacy_hidden"), hc = Symbol.for("react.default_value"), ic = Symbol.iterator;
function jc(a2) {
  if (null == a2)
    return null;
  if ("function" === typeof a2)
    return a2.displayName || a2.name || null;
  if ("string" === typeof a2)
    return a2;
  switch (a2) {
    case Vb:
      return "Fragment";
    case Ub:
      return "Portal";
    case Xb:
      return "Profiler";
    case Wb:
      return "StrictMode";
    case ac:
      return "Suspense";
    case bc:
      return "SuspenseList";
  }
  if ("object" === typeof a2)
    switch (a2.$$typeof) {
      case Zb:
        return (a2.displayName || "Context") + ".Consumer";
      case Yb:
        return (a2._context.displayName || "Context") + ".Provider";
      case $b:
        var b2 = a2.render;
        a2 = a2.displayName;
        a2 || (a2 = b2.displayName || b2.name || "", a2 = "" !== a2 ? "ForwardRef(" + a2 + ")" : "ForwardRef");
        return a2;
      case cc:
        return b2 = a2.displayName || null, null !== b2 ? b2 : jc(a2.type) || "Memo";
      case dc:
        b2 = a2._payload;
        a2 = a2._init;
        try {
          return jc(a2(b2));
        } catch (c2) {
        }
    }
  return null;
}
var kc = {};
function lc(a2, b2) {
  a2 = a2.contextTypes;
  if (!a2)
    return kc;
  var c2 = {}, d2;
  for (d2 in a2)
    c2[d2] = b2[d2];
  return c2;
}
var O = null;
function P(a2, b2) {
  if (a2 !== b2) {
    a2.context._currentValue = a2.parentValue;
    a2 = a2.parent;
    var c2 = b2.parent;
    if (null === a2) {
      if (null !== c2)
        throw Error(k(401));
    } else {
      if (null === c2)
        throw Error(k(401));
      P(a2, c2);
    }
    b2.context._currentValue = b2.value;
  }
}
function mc(a2) {
  a2.context._currentValue = a2.parentValue;
  a2 = a2.parent;
  null !== a2 && mc(a2);
}
function nc(a2) {
  var b2 = a2.parent;
  null !== b2 && nc(b2);
  a2.context._currentValue = a2.value;
}
function oc(a2, b2) {
  a2.context._currentValue = a2.parentValue;
  a2 = a2.parent;
  if (null === a2)
    throw Error(k(402));
  a2.depth === b2.depth ? P(a2, b2) : oc(a2, b2);
}
function pc(a2, b2) {
  var c2 = b2.parent;
  if (null === c2)
    throw Error(k(402));
  a2.depth === c2.depth ? P(a2, c2) : pc(a2, c2);
  b2.context._currentValue = b2.value;
}
function Q(a2) {
  var b2 = O;
  b2 !== a2 && (null === b2 ? nc(a2) : null === a2 ? mc(b2) : b2.depth === a2.depth ? P(b2, a2) : b2.depth > a2.depth ? oc(b2, a2) : pc(b2, a2), O = a2);
}
var qc = { isMounted: function() {
  return false;
}, enqueueSetState: function(a2, b2) {
  a2 = a2._reactInternals;
  null !== a2.queue && a2.queue.push(b2);
}, enqueueReplaceState: function(a2, b2) {
  a2 = a2._reactInternals;
  a2.replace = true;
  a2.queue = [b2];
}, enqueueForceUpdate: function() {
} };
function rc(a2, b2, c2, d2) {
  var f2 = void 0 !== a2.state ? a2.state : null;
  a2.updater = qc;
  a2.props = c2;
  a2.state = f2;
  var e2 = { queue: [], replace: false };
  a2._reactInternals = e2;
  var g2 = b2.contextType;
  a2.context = "object" === typeof g2 && null !== g2 ? g2._currentValue : d2;
  g2 = b2.getDerivedStateFromProps;
  "function" === typeof g2 && (g2 = g2(c2, f2), f2 = null === g2 || void 0 === g2 ? f2 : N({}, f2, g2), a2.state = f2);
  if ("function" !== typeof b2.getDerivedStateFromProps && "function" !== typeof a2.getSnapshotBeforeUpdate && ("function" === typeof a2.UNSAFE_componentWillMount || "function" === typeof a2.componentWillMount))
    if (b2 = a2.state, "function" === typeof a2.componentWillMount && a2.componentWillMount(), "function" === typeof a2.UNSAFE_componentWillMount && a2.UNSAFE_componentWillMount(), b2 !== a2.state && qc.enqueueReplaceState(a2, a2.state, null), null !== e2.queue && 0 < e2.queue.length)
      if (b2 = e2.queue, g2 = e2.replace, e2.queue = null, e2.replace = false, g2 && 1 === b2.length)
        a2.state = b2[0];
      else {
        e2 = g2 ? b2[0] : a2.state;
        f2 = true;
        for (g2 = g2 ? 1 : 0; g2 < b2.length; g2++) {
          var h3 = b2[g2];
          h3 = "function" === typeof h3 ? h3.call(a2, e2, c2, d2) : h3;
          null != h3 && (f2 ? (f2 = false, e2 = N({}, e2, h3)) : N(e2, h3));
        }
        a2.state = e2;
      }
    else
      e2.queue = null;
}
var sc = { id: 1, overflow: "" };
function tc(a2, b2, c2) {
  var d2 = a2.id;
  a2 = a2.overflow;
  var f2 = 32 - uc(d2) - 1;
  d2 &= ~(1 << f2);
  c2 += 1;
  var e2 = 32 - uc(b2) + f2;
  if (30 < e2) {
    var g2 = f2 - f2 % 5;
    e2 = (d2 & (1 << g2) - 1).toString(32);
    d2 >>= g2;
    f2 -= g2;
    return { id: 1 << 32 - uc(b2) + f2 | c2 << f2 | d2, overflow: e2 + a2 };
  }
  return { id: 1 << e2 | c2 << f2 | d2, overflow: a2 };
}
var uc = Math.clz32 ? Math.clz32 : vc, wc = Math.log, xc = Math.LN2;
function vc(a2) {
  a2 >>>= 0;
  return 0 === a2 ? 32 : 31 - (wc(a2) / xc | 0) | 0;
}
function yc(a2, b2) {
  return a2 === b2 && (0 !== a2 || 1 / a2 === 1 / b2) || a2 !== a2 && b2 !== b2;
}
var zc = "function" === typeof Object.is ? Object.is : yc, R = null, Ac = null, Bc = null, S = null, T = false, Cc = false, U = 0, V = null, Dc = 0;
function W() {
  if (null === R)
    throw Error(k(321));
  return R;
}
function Ec() {
  if (0 < Dc)
    throw Error(k(312));
  return { memoizedState: null, queue: null, next: null };
}
function Fc() {
  null === S ? null === Bc ? (T = false, Bc = S = Ec()) : (T = true, S = Bc) : null === S.next ? (T = false, S = S.next = Ec()) : (T = true, S = S.next);
  return S;
}
function Gc() {
  Ac = R = null;
  Cc = false;
  Bc = null;
  Dc = 0;
  S = V = null;
}
function Hc(a2, b2) {
  return "function" === typeof b2 ? b2(a2) : b2;
}
function Ic(a2, b2, c2) {
  R = W();
  S = Fc();
  if (T) {
    var d2 = S.queue;
    b2 = d2.dispatch;
    if (null !== V && (c2 = V.get(d2), void 0 !== c2)) {
      V.delete(d2);
      d2 = S.memoizedState;
      do
        d2 = a2(d2, c2.action), c2 = c2.next;
      while (null !== c2);
      S.memoizedState = d2;
      return [d2, b2];
    }
    return [S.memoizedState, b2];
  }
  a2 = a2 === Hc ? "function" === typeof b2 ? b2() : b2 : void 0 !== c2 ? c2(b2) : b2;
  S.memoizedState = a2;
  a2 = S.queue = { last: null, dispatch: null };
  a2 = a2.dispatch = Jc.bind(null, R, a2);
  return [S.memoizedState, a2];
}
function Kc(a2, b2) {
  R = W();
  S = Fc();
  b2 = void 0 === b2 ? null : b2;
  if (null !== S) {
    var c2 = S.memoizedState;
    if (null !== c2 && null !== b2) {
      var d2 = c2[1];
      a:
        if (null === d2)
          d2 = false;
        else {
          for (var f2 = 0; f2 < d2.length && f2 < b2.length; f2++)
            if (!zc(b2[f2], d2[f2])) {
              d2 = false;
              break a;
            }
          d2 = true;
        }
      if (d2)
        return c2[0];
    }
  }
  a2 = a2();
  S.memoizedState = [a2, b2];
  return a2;
}
function Jc(a2, b2, c2) {
  if (25 <= Dc)
    throw Error(k(301));
  if (a2 === R)
    if (Cc = true, a2 = { action: c2, next: null }, null === V && (V = /* @__PURE__ */ new Map()), c2 = V.get(b2), void 0 === c2)
      V.set(b2, a2);
    else {
      for (b2 = c2; null !== b2.next; )
        b2 = b2.next;
      b2.next = a2;
    }
}
function Lc() {
  throw Error(k(394));
}
function Mc() {
}
var Oc = { readContext: function(a2) {
  return a2._currentValue;
}, useContext: function(a2) {
  W();
  return a2._currentValue;
}, useMemo: Kc, useReducer: Ic, useRef: function(a2) {
  R = W();
  S = Fc();
  var b2 = S.memoizedState;
  return null === b2 ? (a2 = { current: a2 }, S.memoizedState = a2) : b2;
}, useState: function(a2) {
  return Ic(Hc, a2);
}, useInsertionEffect: Mc, useLayoutEffect: function() {
}, useCallback: function(a2, b2) {
  return Kc(function() {
    return a2;
  }, b2);
}, useImperativeHandle: Mc, useEffect: Mc, useDebugValue: Mc, useDeferredValue: function(a2) {
  W();
  return a2;
}, useTransition: function() {
  W();
  return [false, Lc];
}, useId: function() {
  var a2 = Ac.treeContext;
  var b2 = a2.overflow;
  a2 = a2.id;
  a2 = (a2 & ~(1 << 32 - uc(a2) - 1)).toString(32) + b2;
  var c2 = Nc;
  if (null === c2)
    throw Error(k(404));
  b2 = U++;
  a2 = ":" + c2.idPrefix + "R" + a2;
  0 < b2 && (a2 += "H" + b2.toString(32));
  return a2 + ":";
}, useMutableSource: function(a2, b2) {
  W();
  return b2(a2._source);
}, useSyncExternalStore: function(a2, b2, c2) {
  if (void 0 === c2)
    throw Error(k(407));
  return c2();
} }, Nc = null, Pc = aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;
function Qc(a2) {
  console.error(a2);
  return null;
}
function X() {
}
function Rc(a2, b2, c2, d2, f2, e2, g2, h3, m2) {
  var q2 = [], r2 = /* @__PURE__ */ new Set();
  b2 = { destination: null, responseState: b2, progressiveChunkSize: void 0 === d2 ? 12800 : d2, status: 0, fatalError: null, nextSegmentId: 0, allPendingTasks: 0, pendingRootTasks: 0, completedRootSegment: null, abortableTasks: r2, pingedTasks: q2, clientRenderedBoundaries: [], completedBoundaries: [], partialBoundaries: [], onError: void 0 === f2 ? Qc : f2, onAllReady: void 0 === e2 ? X : e2, onShellReady: void 0 === g2 ? X : g2, onShellError: void 0 === h3 ? X : h3, onFatalError: void 0 === m2 ? X : m2 };
  c2 = Sc(b2, 0, null, c2, false, false);
  c2.parentFlushed = true;
  a2 = Tc(b2, a2, null, c2, r2, kc, null, sc);
  q2.push(a2);
  return b2;
}
function Tc(a2, b2, c2, d2, f2, e2, g2, h3) {
  a2.allPendingTasks++;
  null === c2 ? a2.pendingRootTasks++ : c2.pendingTasks++;
  var m2 = { node: b2, ping: function() {
    var b3 = a2.pingedTasks;
    b3.push(m2);
    1 === b3.length && Uc(a2);
  }, blockedBoundary: c2, blockedSegment: d2, abortSet: f2, legacyContext: e2, context: g2, treeContext: h3 };
  f2.add(m2);
  return m2;
}
function Sc(a2, b2, c2, d2, f2, e2) {
  return { status: 0, id: -1, index: b2, parentFlushed: false, chunks: [], children: [], formatContext: d2, boundary: c2, lastPushedText: f2, textEmbedded: e2 };
}
function Y(a2, b2) {
  a2 = a2.onError(b2);
  if (null != a2 && "string" !== typeof a2)
    throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' + typeof a2 + '" instead');
  return a2;
}
function Vc(a2, b2) {
  var c2 = a2.onShellError;
  c2(b2);
  c2 = a2.onFatalError;
  c2(b2);
  null !== a2.destination ? (a2.status = 2, da(a2.destination, b2)) : (a2.status = 1, a2.fatalError = b2);
}
function Wc(a2, b2, c2, d2, f2) {
  R = {};
  Ac = b2;
  U = 0;
  for (a2 = c2(d2, f2); Cc; )
    Cc = false, U = 0, Dc += 1, S = null, a2 = c2(d2, f2);
  Gc();
  return a2;
}
function Xc(a2, b2, c2, d2) {
  var f2 = c2.render(), e2 = d2.childContextTypes;
  if (null !== e2 && void 0 !== e2) {
    var g2 = b2.legacyContext;
    if ("function" !== typeof c2.getChildContext)
      d2 = g2;
    else {
      c2 = c2.getChildContext();
      for (var h3 in c2)
        if (!(h3 in e2))
          throw Error(k(108, jc(d2) || "Unknown", h3));
      d2 = N({}, g2, c2);
    }
    b2.legacyContext = d2;
    Z(a2, b2, f2);
    b2.legacyContext = g2;
  } else
    Z(a2, b2, f2);
}
function Yc(a2, b2) {
  if (a2 && a2.defaultProps) {
    b2 = N({}, b2);
    a2 = a2.defaultProps;
    for (var c2 in a2)
      void 0 === b2[c2] && (b2[c2] = a2[c2]);
    return b2;
  }
  return b2;
}
function Zc(a2, b2, c2, d2, f2) {
  if ("function" === typeof c2)
    if (c2.prototype && c2.prototype.isReactComponent) {
      f2 = lc(c2, b2.legacyContext);
      var e2 = c2.contextType;
      e2 = new c2(d2, "object" === typeof e2 && null !== e2 ? e2._currentValue : f2);
      rc(e2, c2, d2, f2);
      Xc(a2, b2, e2, c2);
    } else {
      e2 = lc(c2, b2.legacyContext);
      f2 = Wc(a2, b2, c2, d2, e2);
      var g2 = 0 !== U;
      if ("object" === typeof f2 && null !== f2 && "function" === typeof f2.render && void 0 === f2.$$typeof)
        rc(f2, c2, d2, e2), Xc(a2, b2, f2, c2);
      else if (g2) {
        d2 = b2.treeContext;
        b2.treeContext = tc(d2, 1, 0);
        try {
          Z(a2, b2, f2);
        } finally {
          b2.treeContext = d2;
        }
      } else
        Z(a2, b2, f2);
    }
  else if ("string" === typeof c2) {
    f2 = b2.blockedSegment;
    e2 = Sa(f2.chunks, c2, d2, a2.responseState, f2.formatContext);
    f2.lastPushedText = false;
    g2 = f2.formatContext;
    f2.formatContext = Ba(g2, c2, d2);
    $c(a2, b2, e2);
    f2.formatContext = g2;
    switch (c2) {
      case "area":
      case "base":
      case "br":
      case "col":
      case "embed":
      case "hr":
      case "img":
      case "input":
      case "keygen":
      case "link":
      case "meta":
      case "param":
      case "source":
      case "track":
      case "wbr":
        break;
      default:
        f2.chunks.push(Ta, u(c2), Ua);
    }
    f2.lastPushedText = false;
  } else {
    switch (c2) {
      case gc:
      case fc:
      case Wb:
      case Xb:
      case Vb:
        Z(a2, b2, d2.children);
        return;
      case bc:
        Z(a2, b2, d2.children);
        return;
      case ec:
        throw Error(k(343));
      case ac:
        a: {
          c2 = b2.blockedBoundary;
          f2 = b2.blockedSegment;
          e2 = d2.fallback;
          d2 = d2.children;
          g2 = /* @__PURE__ */ new Set();
          var h3 = { id: null, rootSegmentID: -1, parentFlushed: false, pendingTasks: 0, forceClientRender: false, completedSegments: [], byteSize: 0, fallbackAbortableTasks: g2, errorDigest: null }, m2 = Sc(a2, f2.chunks.length, h3, f2.formatContext, false, false);
          f2.children.push(m2);
          f2.lastPushedText = false;
          var q2 = Sc(a2, 0, null, f2.formatContext, false, false);
          q2.parentFlushed = true;
          b2.blockedBoundary = h3;
          b2.blockedSegment = q2;
          try {
            if ($c(
              a2,
              b2,
              d2
            ), q2.lastPushedText && q2.textEmbedded && q2.chunks.push(Ca), q2.status = 1, ad(h3, q2), 0 === h3.pendingTasks)
              break a;
          } catch (r2) {
            q2.status = 4, h3.forceClientRender = true, h3.errorDigest = Y(a2, r2);
          } finally {
            b2.blockedBoundary = c2, b2.blockedSegment = f2;
          }
          b2 = Tc(a2, e2, c2, m2, g2, b2.legacyContext, b2.context, b2.treeContext);
          a2.pingedTasks.push(b2);
        }
        return;
    }
    if ("object" === typeof c2 && null !== c2)
      switch (c2.$$typeof) {
        case $b:
          d2 = Wc(a2, b2, c2.render, d2, f2);
          if (0 !== U) {
            c2 = b2.treeContext;
            b2.treeContext = tc(c2, 1, 0);
            try {
              Z(a2, b2, d2);
            } finally {
              b2.treeContext = c2;
            }
          } else
            Z(a2, b2, d2);
          return;
        case cc:
          c2 = c2.type;
          d2 = Yc(c2, d2);
          Zc(a2, b2, c2, d2, f2);
          return;
        case Yb:
          f2 = d2.children;
          c2 = c2._context;
          d2 = d2.value;
          e2 = c2._currentValue;
          c2._currentValue = d2;
          g2 = O;
          O = d2 = { parent: g2, depth: null === g2 ? 0 : g2.depth + 1, context: c2, parentValue: e2, value: d2 };
          b2.context = d2;
          Z(a2, b2, f2);
          a2 = O;
          if (null === a2)
            throw Error(k(403));
          d2 = a2.parentValue;
          a2.context._currentValue = d2 === hc ? a2.context._defaultValue : d2;
          a2 = O = a2.parent;
          b2.context = a2;
          return;
        case Zb:
          d2 = d2.children;
          d2 = d2(c2._currentValue);
          Z(a2, b2, d2);
          return;
        case dc:
          f2 = c2._init;
          c2 = f2(c2._payload);
          d2 = Yc(c2, d2);
          Zc(a2, b2, c2, d2, void 0);
          return;
      }
    throw Error(k(
      130,
      null == c2 ? c2 : typeof c2,
      ""
    ));
  }
}
function Z(a2, b2, c2) {
  b2.node = c2;
  if ("object" === typeof c2 && null !== c2) {
    switch (c2.$$typeof) {
      case Tb:
        Zc(a2, b2, c2.type, c2.props, c2.ref);
        return;
      case Ub:
        throw Error(k(257));
      case dc:
        var d2 = c2._init;
        c2 = d2(c2._payload);
        Z(a2, b2, c2);
        return;
    }
    if (ra(c2)) {
      bd(a2, b2, c2);
      return;
    }
    null === c2 || "object" !== typeof c2 ? d2 = null : (d2 = ic && c2[ic] || c2["@@iterator"], d2 = "function" === typeof d2 ? d2 : null);
    if (d2 && (d2 = d2.call(c2))) {
      c2 = d2.next();
      if (!c2.done) {
        var f2 = [];
        do
          f2.push(c2.value), c2 = d2.next();
        while (!c2.done);
        bd(a2, b2, f2);
      }
      return;
    }
    a2 = Object.prototype.toString.call(c2);
    throw Error(k(31, "[object Object]" === a2 ? "object with keys {" + Object.keys(c2).join(", ") + "}" : a2));
  }
  "string" === typeof c2 ? (d2 = b2.blockedSegment, d2.lastPushedText = Da(b2.blockedSegment.chunks, c2, a2.responseState, d2.lastPushedText)) : "number" === typeof c2 && (d2 = b2.blockedSegment, d2.lastPushedText = Da(b2.blockedSegment.chunks, "" + c2, a2.responseState, d2.lastPushedText));
}
function bd(a2, b2, c2) {
  for (var d2 = c2.length, f2 = 0; f2 < d2; f2++) {
    var e2 = b2.treeContext;
    b2.treeContext = tc(e2, d2, f2);
    try {
      $c(a2, b2, c2[f2]);
    } finally {
      b2.treeContext = e2;
    }
  }
}
function $c(a2, b2, c2) {
  var d2 = b2.blockedSegment.formatContext, f2 = b2.legacyContext, e2 = b2.context;
  try {
    return Z(a2, b2, c2);
  } catch (m2) {
    if (Gc(), "object" === typeof m2 && null !== m2 && "function" === typeof m2.then) {
      c2 = m2;
      var g2 = b2.blockedSegment, h3 = Sc(a2, g2.chunks.length, null, g2.formatContext, g2.lastPushedText, true);
      g2.children.push(h3);
      g2.lastPushedText = false;
      a2 = Tc(a2, b2.node, b2.blockedBoundary, h3, b2.abortSet, b2.legacyContext, b2.context, b2.treeContext).ping;
      c2.then(a2, a2);
      b2.blockedSegment.formatContext = d2;
      b2.legacyContext = f2;
      b2.context = e2;
      Q(e2);
    } else
      throw b2.blockedSegment.formatContext = d2, b2.legacyContext = f2, b2.context = e2, Q(e2), m2;
  }
}
function cd(a2) {
  var b2 = a2.blockedBoundary;
  a2 = a2.blockedSegment;
  a2.status = 3;
  dd(this, b2, a2);
}
function ed(a2, b2, c2) {
  var d2 = a2.blockedBoundary;
  a2.blockedSegment.status = 3;
  null === d2 ? (b2.allPendingTasks--, 2 !== b2.status && (b2.status = 2, null !== b2.destination && b2.destination.close())) : (d2.pendingTasks--, d2.forceClientRender || (d2.forceClientRender = true, a2 = void 0 === c2 ? Error(k(432)) : c2, d2.errorDigest = b2.onError(a2), d2.parentFlushed && b2.clientRenderedBoundaries.push(d2)), d2.fallbackAbortableTasks.forEach(function(a3) {
    return ed(a3, b2, c2);
  }), d2.fallbackAbortableTasks.clear(), b2.allPendingTasks--, 0 === b2.allPendingTasks && (d2 = b2.onAllReady, d2()));
}
function ad(a2, b2) {
  if (0 === b2.chunks.length && 1 === b2.children.length && null === b2.children[0].boundary) {
    var c2 = b2.children[0];
    c2.id = b2.id;
    c2.parentFlushed = true;
    1 === c2.status && ad(a2, c2);
  } else
    a2.completedSegments.push(b2);
}
function dd(a2, b2, c2) {
  if (null === b2) {
    if (c2.parentFlushed) {
      if (null !== a2.completedRootSegment)
        throw Error(k(389));
      a2.completedRootSegment = c2;
    }
    a2.pendingRootTasks--;
    0 === a2.pendingRootTasks && (a2.onShellError = X, b2 = a2.onShellReady, b2());
  } else
    b2.pendingTasks--, b2.forceClientRender || (0 === b2.pendingTasks ? (c2.parentFlushed && 1 === c2.status && ad(b2, c2), b2.parentFlushed && a2.completedBoundaries.push(b2), b2.fallbackAbortableTasks.forEach(cd, a2), b2.fallbackAbortableTasks.clear()) : c2.parentFlushed && 1 === c2.status && (ad(b2, c2), 1 === b2.completedSegments.length && b2.parentFlushed && a2.partialBoundaries.push(b2)));
  a2.allPendingTasks--;
  0 === a2.allPendingTasks && (a2 = a2.onAllReady, a2());
}
function Uc(a2) {
  if (2 !== a2.status) {
    var b2 = O, c2 = Pc.current;
    Pc.current = Oc;
    var d2 = Nc;
    Nc = a2.responseState;
    try {
      var f2 = a2.pingedTasks, e2;
      for (e2 = 0; e2 < f2.length; e2++) {
        var g2 = f2[e2];
        var h3 = a2, m2 = g2.blockedSegment;
        if (0 === m2.status) {
          Q(g2.context);
          try {
            Z(h3, g2, g2.node), m2.lastPushedText && m2.textEmbedded && m2.chunks.push(Ca), g2.abortSet.delete(g2), m2.status = 1, dd(h3, g2.blockedBoundary, m2);
          } catch (G2) {
            if (Gc(), "object" === typeof G2 && null !== G2 && "function" === typeof G2.then) {
              var q2 = g2.ping;
              G2.then(q2, q2);
            } else {
              g2.abortSet.delete(g2);
              m2.status = 4;
              var r2 = g2.blockedBoundary, v2 = G2, A2 = Y(h3, v2);
              null === r2 ? Vc(h3, v2) : (r2.pendingTasks--, r2.forceClientRender || (r2.forceClientRender = true, r2.errorDigest = A2, r2.parentFlushed && h3.clientRenderedBoundaries.push(r2)));
              h3.allPendingTasks--;
              if (0 === h3.allPendingTasks) {
                var F2 = h3.onAllReady;
                F2();
              }
            }
          } finally {
          }
        }
      }
      f2.splice(0, e2);
      null !== a2.destination && fd(a2, a2.destination);
    } catch (G2) {
      Y(a2, G2), Vc(a2, G2);
    } finally {
      Nc = d2, Pc.current = c2, c2 === Oc && Q(b2);
    }
  }
}
function gd(a2, b2, c2) {
  c2.parentFlushed = true;
  switch (c2.status) {
    case 0:
      var d2 = c2.id = a2.nextSegmentId++;
      c2.lastPushedText = false;
      c2.textEmbedded = false;
      a2 = a2.responseState;
      p(b2, Va);
      p(b2, a2.placeholderPrefix);
      a2 = u(d2.toString(16));
      p(b2, a2);
      return t(b2, Wa);
    case 1:
      c2.status = 2;
      var f2 = true;
      d2 = c2.chunks;
      var e2 = 0;
      c2 = c2.children;
      for (var g2 = 0; g2 < c2.length; g2++) {
        for (f2 = c2[g2]; e2 < f2.index; e2++)
          p(b2, d2[e2]);
        f2 = hd(a2, b2, f2);
      }
      for (; e2 < d2.length - 1; e2++)
        p(b2, d2[e2]);
      e2 < d2.length && (f2 = t(b2, d2[e2]));
      return f2;
    default:
      throw Error(k(390));
  }
}
function hd(a2, b2, c2) {
  var d2 = c2.boundary;
  if (null === d2)
    return gd(a2, b2, c2);
  d2.parentFlushed = true;
  if (d2.forceClientRender)
    d2 = d2.errorDigest, t(b2, $a), p(b2, bb), d2 && (p(b2, db), p(b2, u(C(d2))), p(b2, cb)), t(b2, eb), gd(a2, b2, c2);
  else if (0 < d2.pendingTasks) {
    d2.rootSegmentID = a2.nextSegmentId++;
    0 < d2.completedSegments.length && a2.partialBoundaries.push(d2);
    var f2 = a2.responseState;
    var e2 = f2.nextSuspenseID++;
    f2 = w(f2.boundaryPrefix + e2.toString(16));
    d2 = d2.id = f2;
    fb(b2, a2.responseState, d2);
    gd(a2, b2, c2);
  } else if (d2.byteSize > a2.progressiveChunkSize)
    d2.rootSegmentID = a2.nextSegmentId++, a2.completedBoundaries.push(d2), fb(b2, a2.responseState, d2.id), gd(a2, b2, c2);
  else {
    t(b2, Xa);
    c2 = d2.completedSegments;
    if (1 !== c2.length)
      throw Error(k(391));
    hd(a2, b2, c2[0]);
  }
  return t(b2, ab);
}
function id(a2, b2, c2) {
  Bb(b2, a2.responseState, c2.formatContext, c2.id);
  hd(a2, b2, c2);
  return Cb(b2, c2.formatContext);
}
function jd(a2, b2, c2) {
  for (var d2 = c2.completedSegments, f2 = 0; f2 < d2.length; f2++)
    kd(a2, b2, c2, d2[f2]);
  d2.length = 0;
  a2 = a2.responseState;
  d2 = c2.id;
  c2 = c2.rootSegmentID;
  p(b2, a2.startInlineScript);
  a2.sentCompleteBoundaryFunction ? p(b2, Jb) : (a2.sentCompleteBoundaryFunction = true, p(b2, Ib));
  if (null === d2)
    throw Error(k(395));
  c2 = u(c2.toString(16));
  p(b2, d2);
  p(b2, Kb);
  p(b2, a2.segmentPrefix);
  p(b2, c2);
  return t(b2, Lb);
}
function kd(a2, b2, c2, d2) {
  if (2 === d2.status)
    return true;
  var f2 = d2.id;
  if (-1 === f2) {
    if (-1 === (d2.id = c2.rootSegmentID))
      throw Error(k(392));
    return id(a2, b2, d2);
  }
  id(a2, b2, d2);
  a2 = a2.responseState;
  p(b2, a2.startInlineScript);
  a2.sentCompleteSegmentFunction ? p(b2, Eb) : (a2.sentCompleteSegmentFunction = true, p(b2, Db));
  p(b2, a2.segmentPrefix);
  f2 = u(f2.toString(16));
  p(b2, f2);
  p(b2, Gb);
  p(b2, a2.placeholderPrefix);
  p(b2, f2);
  return t(b2, Hb);
}
function fd(a2, b2) {
  l$1 = new Uint8Array(512);
  n = 0;
  try {
    var c2 = a2.completedRootSegment;
    if (null !== c2 && 0 === a2.pendingRootTasks) {
      hd(a2, b2, c2);
      a2.completedRootSegment = null;
      var d2 = a2.responseState.bootstrapChunks;
      for (c2 = 0; c2 < d2.length - 1; c2++)
        p(b2, d2[c2]);
      c2 < d2.length && t(b2, d2[c2]);
    }
    var f2 = a2.clientRenderedBoundaries, e2;
    for (e2 = 0; e2 < f2.length; e2++) {
      var g2 = f2[e2];
      d2 = b2;
      var h3 = a2.responseState, m2 = g2.id, q2 = g2.errorDigest, r2 = g2.errorMessage, v2 = g2.errorComponentStack;
      p(d2, h3.startInlineScript);
      h3.sentClientRenderFunction ? p(d2, Nb) : (h3.sentClientRenderFunction = true, p(
        d2,
        Mb
      ));
      if (null === m2)
        throw Error(k(395));
      p(d2, m2);
      p(d2, Ob);
      if (q2 || r2 || v2)
        p(d2, Qb), p(d2, u(Sb(q2 || "")));
      if (r2 || v2)
        p(d2, Qb), p(d2, u(Sb(r2 || "")));
      v2 && (p(d2, Qb), p(d2, u(Sb(v2))));
      if (!t(d2, Pb))
        ;
    }
    f2.splice(0, e2);
    var A2 = a2.completedBoundaries;
    for (e2 = 0; e2 < A2.length; e2++)
      if (!jd(a2, b2, A2[e2]))
        ;
    A2.splice(0, e2);
    ba(b2);
    l$1 = new Uint8Array(512);
    n = 0;
    var F2 = a2.partialBoundaries;
    for (e2 = 0; e2 < F2.length; e2++) {
      var G2 = F2[e2];
      a: {
        f2 = a2;
        g2 = b2;
        var ma2 = G2.completedSegments;
        for (h3 = 0; h3 < ma2.length; h3++)
          if (!kd(
            f2,
            g2,
            G2,
            ma2[h3]
          )) {
            h3++;
            ma2.splice(0, h3);
            var Fb2 = false;
            break a;
          }
        ma2.splice(0, h3);
        Fb2 = true;
      }
      if (!Fb2) {
        a2.destination = null;
        e2++;
        F2.splice(0, e2);
        return;
      }
    }
    F2.splice(0, e2);
    var na2 = a2.completedBoundaries;
    for (e2 = 0; e2 < na2.length; e2++)
      if (!jd(a2, b2, na2[e2]))
        ;
    na2.splice(0, e2);
  } finally {
    ba(b2), 0 === a2.allPendingTasks && 0 === a2.pingedTasks.length && 0 === a2.clientRenderedBoundaries.length && 0 === a2.completedBoundaries.length && b2.close();
  }
}
function ld(a2, b2) {
  try {
    var c2 = a2.abortableTasks;
    c2.forEach(function(c3) {
      return ed(c3, a2, b2);
    });
    c2.clear();
    null !== a2.destination && fd(a2, a2.destination);
  } catch (d2) {
    Y(a2, d2), Vc(a2, d2);
  }
}
reactDomServer_browser_production_min.renderToReadableStream = function(a2, b2) {
  return new Promise(function(c2, d2) {
    var f2, e2, g2 = new Promise(function(a3, b3) {
      e2 = a3;
      f2 = b3;
    }), h3 = Rc(a2, za(b2 ? b2.identifierPrefix : void 0, b2 ? b2.nonce : void 0, b2 ? b2.bootstrapScriptContent : void 0, b2 ? b2.bootstrapScripts : void 0, b2 ? b2.bootstrapModules : void 0), Aa(b2 ? b2.namespaceURI : void 0), b2 ? b2.progressiveChunkSize : void 0, b2 ? b2.onError : void 0, e2, function() {
      var a3 = new ReadableStream({ type: "bytes", pull: function(a4) {
        if (1 === h3.status)
          h3.status = 2, da(a4, h3.fatalError);
        else if (2 !== h3.status && null === h3.destination) {
          h3.destination = a4;
          try {
            fd(h3, a4);
          } catch (A2) {
            Y(h3, A2), Vc(h3, A2);
          }
        }
      }, cancel: function() {
        ld(h3);
      } }, { highWaterMark: 0 });
      a3.allReady = g2;
      c2(a3);
    }, function(a3) {
      g2.catch(function() {
      });
      d2(a3);
    }, f2);
    if (b2 && b2.signal) {
      var m2 = b2.signal, q2 = function() {
        ld(h3, m2.reason);
        m2.removeEventListener("abort", q2);
      };
      m2.addEventListener("abort", q2);
    }
    Uc(h3);
  });
};
reactDomServer_browser_production_min.version = "18.3.1";
var l, s;
{
  l = reactDomServerLegacy_browser_production_min;
  s = reactDomServer_browser_production_min;
}
l.version;
var renderToString = l.renderToString;
l.renderToStaticMarkup;
l.renderToNodeStream;
l.renderToStaticNodeStream;
s.renderToReadableStream;
var reactContenteditable = {};
var fastDeepEqual = function equal(a2, b2) {
  if (a2 === b2)
    return true;
  if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
    if (a2.constructor !== b2.constructor)
      return false;
    var length2, i2, keys2;
    if (Array.isArray(a2)) {
      length2 = a2.length;
      if (length2 != b2.length)
        return false;
      for (i2 = length2; i2-- !== 0; )
        if (!equal(a2[i2], b2[i2]))
          return false;
      return true;
    }
    if (a2.constructor === RegExp)
      return a2.source === b2.source && a2.flags === b2.flags;
    if (a2.valueOf !== Object.prototype.valueOf)
      return a2.valueOf() === b2.valueOf();
    if (a2.toString !== Object.prototype.toString)
      return a2.toString() === b2.toString();
    keys2 = Object.keys(a2);
    length2 = keys2.length;
    if (length2 !== Object.keys(b2).length)
      return false;
    for (i2 = length2; i2-- !== 0; )
      if (!Object.prototype.hasOwnProperty.call(b2, keys2[i2]))
        return false;
    for (i2 = length2; i2-- !== 0; ) {
      var key = keys2[i2];
      if (!equal(a2[key], b2[key]))
        return false;
    }
    return true;
  }
  return a2 !== a2 && b2 !== b2;
};
var __extends = commonjsGlobal && commonjsGlobal.__extends || /* @__PURE__ */ function() {
  var extendStatics2 = function(d2, b2) {
    extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
      d3.__proto__ = b3;
    } || function(d3, b3) {
      for (var p2 in b3)
        if (Object.prototype.hasOwnProperty.call(b3, p2))
          d3[p2] = b3[p2];
    };
    return extendStatics2(d2, b2);
  };
  return function(d2, b2) {
    if (typeof b2 !== "function" && b2 !== null)
      throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
    extendStatics2(d2, b2);
    function __() {
      this.constructor = d2;
    }
    d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __());
  };
}();
var __assign = commonjsGlobal && commonjsGlobal.__assign || function() {
  __assign = Object.assign || function(t2) {
    for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
      s2 = arguments[i2];
      for (var p2 in s2)
        if (Object.prototype.hasOwnProperty.call(s2, p2))
          t2[p2] = s2[p2];
    }
    return t2;
  };
  return __assign.apply(this, arguments);
};
var __createBinding = commonjsGlobal && commonjsGlobal.__createBinding || (Object.create ? function(o2, m2, k2, k22) {
  if (k22 === void 0)
    k22 = k2;
  var desc = Object.getOwnPropertyDescriptor(m2, k2);
  if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
    desc = { enumerable: true, get: function() {
      return m2[k2];
    } };
  }
  Object.defineProperty(o2, k22, desc);
} : function(o2, m2, k2, k22) {
  if (k22 === void 0)
    k22 = k2;
  o2[k22] = m2[k2];
});
var __setModuleDefault = commonjsGlobal && commonjsGlobal.__setModuleDefault || (Object.create ? function(o2, v2) {
  Object.defineProperty(o2, "default", { enumerable: true, value: v2 });
} : function(o2, v2) {
  o2["default"] = v2;
});
var __importStar = commonjsGlobal && commonjsGlobal.__importStar || function(mod2) {
  if (mod2 && mod2.__esModule)
    return mod2;
  var result = {};
  if (mod2 != null) {
    for (var k2 in mod2)
      if (k2 !== "default" && Object.prototype.hasOwnProperty.call(mod2, k2))
        __createBinding(result, mod2, k2);
  }
  __setModuleDefault(result, mod2);
  return result;
};
var __rest = commonjsGlobal && commonjsGlobal.__rest || function(s2, e2) {
  var t2 = {};
  for (var p2 in s2)
    if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
      t2[p2] = s2[p2];
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
      if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
        t2[p2[i2]] = s2[p2[i2]];
    }
  return t2;
};
var __importDefault$2 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
Object.defineProperty(reactContenteditable, "__esModule", { value: true });
var React = __importStar(reactExports);
var fast_deep_equal_1 = __importDefault$2(fastDeepEqual);
var PropTypes = __importStar(propTypesExports);
function normalizeHtml(str) {
  return str && str.replace(/&nbsp;|\u202F|\u00A0/g, " ").replace(/<br \/>/g, "<br>");
}
function replaceCaret(el2) {
  var target = document.createTextNode("");
  el2.appendChild(target);
  var isTargetFocused = document.activeElement === el2;
  if (target !== null && target.nodeValue !== null && isTargetFocused) {
    var sel = window.getSelection();
    if (sel !== null) {
      var range3 = document.createRange();
      range3.setStart(target, target.nodeValue.length);
      range3.collapse(true);
      sel.removeAllRanges();
      sel.addRange(range3);
    }
    if (el2 instanceof HTMLElement)
      el2.focus();
  }
}
var ContentEditable = (
  /** @class */
  function(_super) {
    __extends(ContentEditable2, _super);
    function ContentEditable2() {
      var _this = _super !== null && _super.apply(this, arguments) || this;
      _this.lastHtml = _this.props.html;
      _this.el = typeof _this.props.innerRef === "function" ? { current: null } : React.createRef();
      _this.getEl = function() {
        return (_this.props.innerRef && typeof _this.props.innerRef !== "function" ? _this.props.innerRef : _this.el).current;
      };
      _this.emitChange = function(originalEvt) {
        var el2 = _this.getEl();
        if (!el2)
          return;
        var html2 = el2.innerHTML;
        if (_this.props.onChange && html2 !== _this.lastHtml) {
          var evt = Object.assign({}, originalEvt, {
            target: {
              value: html2
            }
          });
          _this.props.onChange(evt);
        }
        _this.lastHtml = html2;
      };
      return _this;
    }
    ContentEditable2.prototype.render = function() {
      var _this = this;
      var _a2 = this.props, tagName = _a2.tagName, html2 = _a2.html, innerRef = _a2.innerRef, props = __rest(_a2, ["tagName", "html", "innerRef"]);
      return React.createElement(tagName || "div", __assign(__assign({}, props), { ref: typeof innerRef === "function" ? function(current) {
        innerRef(current);
        _this.el.current = current;
      } : innerRef || this.el, onInput: this.emitChange, onBlur: this.props.onBlur || this.emitChange, onKeyUp: this.props.onKeyUp || this.emitChange, onKeyDown: this.props.onKeyDown || this.emitChange, contentEditable: !this.props.disabled, dangerouslySetInnerHTML: { __html: html2 } }), this.props.children);
    };
    ContentEditable2.prototype.shouldComponentUpdate = function(nextProps) {
      var props = this.props;
      var el2 = this.getEl();
      if (!el2)
        return true;
      if (normalizeHtml(nextProps.html) !== normalizeHtml(el2.innerHTML)) {
        return true;
      }
      return props.disabled !== nextProps.disabled || props.tagName !== nextProps.tagName || props.className !== nextProps.className || props.innerRef !== nextProps.innerRef || props.placeholder !== nextProps.placeholder || !(0, fast_deep_equal_1.default)(props.style, nextProps.style);
    };
    ContentEditable2.prototype.componentDidUpdate = function() {
      var el2 = this.getEl();
      if (!el2)
        return;
      if (this.props.html !== el2.innerHTML) {
        el2.innerHTML = this.props.html;
      }
      this.lastHtml = this.props.html;
      replaceCaret(el2);
    };
    ContentEditable2.propTypes = {
      html: PropTypes.string.isRequired,
      onChange: PropTypes.func,
      disabled: PropTypes.bool,
      tagName: PropTypes.string,
      className: PropTypes.string,
      style: PropTypes.object,
      innerRef: PropTypes.oneOfType([
        PropTypes.object,
        PropTypes.func
      ])
    };
    return ContentEditable2;
  }(React.Component)
);
var _default = reactContenteditable.default = ContentEditable;
var ResourceDisplayNameTemplateSegmentType = /* @__PURE__ */ ((ResourceDisplayNameTemplateSegmentType2) => {
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Text"] = 1] = "Text";
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Wrapper"] = 2] = "Wrapper";
  ResourceDisplayNameTemplateSegmentType2[ResourceDisplayNameTemplateSegmentType2["Property"] = 3] = "Property";
  return ResourceDisplayNameTemplateSegmentType2;
})(ResourceDisplayNameTemplateSegmentType || {});
const VariableWrapper = {
  left: "{",
  right: "}"
};
const extractResourceDisplayNameTemplate = (template2, variables, wrappers) => {
  const wrappedVariables = variables.map(
    (v2) => `${VariableWrapper.left}${v2}${VariableWrapper.right}`
  );
  const segments = [];
  console.log(wrappedVariables, wrappers);
  for (let i2 = 0; i2 < template2.length; i2++) {
    const c2 = template2[i2];
    let matched = false;
    if (c2 == "{") {
      for (const wv of wrappedVariables) {
        if (template2.startsWith(wv, i2)) {
          segments.push({
            text: wv,
            type: ResourceDisplayNameTemplateSegmentType.Property
          });
          i2 += wv.length - 1;
          matched = true;
          break;
        }
      }
    }
    if (!matched) {
      if (wrappers.some((w2) => w2.left == c2 || w2.right == c2)) {
        segments.push({
          text: c2,
          type: ResourceDisplayNameTemplateSegmentType.Wrapper
        });
      } else {
        const prevPart = segments[segments.length - 1];
        if ((prevPart == null ? void 0 : prevPart.type) == ResourceDisplayNameTemplateSegmentType.Text) {
          prevPart.text += c2;
        } else {
          segments.push({
            text: c2,
            type: ResourceDisplayNameTemplateSegmentType.Text
          });
        }
      }
    }
  }
  return segments;
};
const renderDisplayNameSegment = (p2) => {
  switch (p2.type) {
    case ResourceDisplayNameTemplateSegmentType.Text:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p2.text });
    case ResourceDisplayNameTemplateSegmentType.Wrapper:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        "span",
        {
          style: { color: "var(--bakaui-secondary)" },
          children: p2.text
        }
      );
    case ResourceDisplayNameTemplateSegmentType.Property:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { color: "var(--bakaui-primary)" }, children: p2.text });
  }
};
const DisplayNameTemplateEditorModal$1 = ({ template: template2, properties: properties2, onSubmit, ...props }) => {
  const { t: t2 } = useTranslation();
  useUpdate();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [wrappers, setWrappers] = reactExports.useState([]);
  const [variables, setVariables] = reactExports.useState([]);
  const [templateHtml, setTemplateHtml] = reactExports.useState("");
  const templateRef = reactExports.useRef("");
  const init2 = reactExports.useCallback(async () => {
    var _a2;
    const tr = await BApi$1.specialText.getAllSpecialTexts();
    const texts = ((_a2 = tr.data) == null ? void 0 : _a2[SpecialTextType.Wrapper]) || [];
    const wrappers2 = texts.map((text2) => {
      return {
        left: text2.value1,
        right: text2.value2
      };
    });
    setWrappers(wrappers2);
    const builtinPropertyNames = builtinPropertyForDisplayNames.map(
      (v2) => t2(`BuiltinPropertyForDisplayName.${v2.label}`)
    );
    const customPropertyNames = (properties2 == null ? void 0 : properties2.map((cp) => cp.name)) ?? [];
    setVariables(builtinPropertyNames.concat(customPropertyNames));
    templateRef.current = template2 ?? "";
    setTemplateHtml(template2 ? buildTemplateHtml(template2) : "");
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  const close = () => {
    setVisible(false);
  };
  const buildTemplateHtml = (template22) => {
    const parts = extractResourceDisplayNameTemplate(template22, variables, wrappers);
    const components2 = parts.map((p2) => renderDisplayNameSegment(p2));
    const html2 = renderToString(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: components2 }));
    console.log(parts, html2);
    return html2;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("Edit display name template for resources"),
      onClose: close,
      onDestroyed: props.onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(templateRef.current),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "You can use any combination of text and following properties in template, and you can add more properties in category configuration."
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap items-center", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Trans,
                {
                  i18nKey: "category.displayNameTemplate.propertyExample",
                  values: {
                    // samplePropertyName: propertiesRef.current[0]?.name ?? t<string>('Name'),
                    samplePropertyName: (variables == null ? void 0 : variables[0]) ?? t2("Name")
                  },
                  children: [
                    "To add a property value as a variable in the template, you can use the following format: ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{name of property}" }),
                    ". For example,",
                    " ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "{samplePropertyName}" }),
                    " will be replaced with the value of the property named ",
                    /* @__PURE__ */ jsxRuntimeExports.jsx(code_default, { children: "sampleName" })
                  ]
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
              " ",
              t2(
                "Be careful if you have multiple properties with same name, only a random one will be replaced."
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: variables == null ? void 0 : variables.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              onClick: () => {
                templateRef.current += `{${p2}}`;
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              },
              children: p2
            },
            p2
          )) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
            " ",
            t2(
              "You can safely use any of following text wrappers to wrap the properties, and wrappers surrounding the property with empty value will be removed automatically."
            ),
            t2("You can check and set the wrappers in special text configuration.")
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mt-2", children: wrappers.map((w2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", children: [
            w2.left,
            " ",
            w2.right
          ] }, w2.left)) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-base" }),
          " ",
          t2(
            "If you leave the template with empty value, the file name will be the display name."
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Display name template") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            _default,
            {
              autoFocus: true,
              className: "border-1 rounded mt-1 p-2",
              html: templateHtml,
              tagName: "pre",
              onChange: (v2) => {
                templateRef.current = v2.currentTarget.textContent || "";
                setTemplateHtml(buildTemplateHtml(templateRef.current));
              }
            },
            "0"
          )
        ] })
      ]
    }
  );
};
DisplayNameTemplateEditorModal$1.displayName = "DisplayNameTemplateEditorModal";
const levelColorMap = {
  0: "default",
  // Trace
  1: "default",
  // Debug
  2: "default",
  // Information
  3: "warning",
  // Warning
  4: "danger",
  // Error
  5: "danger",
  // Critical
  6: "default"
  // None
};
const ValidateModal = ({ templateId, ...props }) => {
  const { t: t2 } = useTranslation();
  const [visible, setVisible] = React$6.useState(true);
  const [rootPath, setRootPath] = React$6.useState();
  const [limit2, setLimit] = React$6.useState(3);
  const [keyword, setKeyword] = React$6.useState("");
  const [running, setRunning] = React$6.useState(false);
  const [traces, setTraces] = React$6.useState([]);
  const abortRef = React$6.useRef(null);
  const close = reactExports.useCallback(() => {
    stop();
    setVisible(false);
  }, []);
  const start = async () => {
    if (!rootPath)
      return;
    setRunning(true);
    setTraces([]);
    const controller = new AbortController();
    abortRef.current = controller;
    try {
      const url2 = `${envConfig.apiEndpoint}/media-library-template/${templateId}/validate`;
      const resp = await fetch(url2, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({
          rootPath,
          limitResourcesCount: limit2,
          resourceKeyword: keyword || void 0
        }),
        signal: controller.signal
      });
      if (!resp.ok || !resp.body) {
        throw new Error(`Request failed: ${resp.status}`);
      }
      const reader = resp.body.getReader();
      const decoder = new TextDecoder();
      let buffer = "";
      while (true) {
        const { value: value2, done } = await reader.read();
        if (done)
          break;
        buffer += decoder.decode(value2, { stream: true });
        let idx;
        while ((idx = buffer.indexOf("\n")) >= 0) {
          const line2 = buffer.slice(0, idx).trim();
          buffer = buffer.slice(idx + 1);
          if (!line2)
            continue;
          try {
            const obj = JSON.parse(line2);
            setTraces((prev2) => [...prev2, obj]);
          } catch {
          }
        }
      }
      if (buffer.trim().length > 0) {
        try {
          const obj = JSON.parse(buffer.trim());
          setTraces((prev2) => [...prev2, obj]);
        } catch {
        }
      }
    } catch (e2) {
    } finally {
      setRunning(false);
      abortRef.current = null;
    }
  };
  const stop = () => {
    var _a2;
    (_a2 = abortRef.current) == null ? void 0 : _a2.abort();
    abortRef.current = null;
    setRunning(false);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      className: "max-w-[80vw]",
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        !running ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", isDisabled: !rootPath, onPress: start, children: t2("Start") }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "danger", variant: "light", onPress: stop, children: t2("Stop") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onPress: close, children: t2("Close") })
      ] }),
      size: "xl",
      title: t2("Validate media library template"),
      visible,
      onClose: close,
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2", style: { gridTemplateColumns: "160px 1fr" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Root path") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              placeholder: t2("Pick a directory or file path"),
              value: rootPath,
              onValueChange: setRootPath
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Limit resources count") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              type: "number",
              value: (limit2 ?? 0).toString(),
              onValueChange: (v2) => setLimit(v2 ? parseInt(v2, 10) : void 0)
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "self-center text-sm opacity-80", children: t2("Resource keyword") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { placeholder: t2("Optional"), value: keyword, onValueChange: setKeyword })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[420px] overflow-auto rounded border-small p-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-2", style: { gridTemplateColumns: "auto 1fr" }, children: [
          traces.map((tr, idx) => /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", size: "sm", variant: "flat", children: hooks(tr.time).format("HH:mm:ss.SSS") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: levelColorMap[tr.level] || "default", size: "sm", variant: "flat", children: tr.topic })
            ] }),
            tr.contexts && tr.contexts.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "grid gap-x-4 items-center text-xs",
                style: { gridTemplateColumns: "auto 1fr" },
                children: tr.contexts.map((c2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-70 break-all text-right", children: c2.key }, `${idx}-k-${i2}`),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all", children: c2.value != void 0 && JSON.stringify(c2.value) }, `${idx}-v-${i2}`)
                ] }))
              }
            ) || /* @__PURE__ */ jsxRuntimeExports.jsx("div", {})
          ] }, idx)),
          running && /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { color: "default", label: t2("Validating..."), size: "sm" })
        ] }) })
      ] })
    }
  );
};
ValidateModal.displayName = "ValidateModal";
const DeleteEnhancementsModal$1 = ({ title, description, onOk, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [deleteEmptyOnly, setDeleteEmptyOnly] = React$6.useState(false);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      title,
      onDestroyed,
      onOk: async () => await onOk(deleteEmptyOnly),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-warning", children: description }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { size: "sm", onValueChange: (v2) => setDeleteEmptyOnly(v2), children: t2("Delete empty records only") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tooltip$1,
            {
              className: "max-w-[600px]",
              color: "secondary",
              content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "When the enhancement is successfully executed but no data available for enhancement is retrieved, an empty enhancement record is generated."
                ) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                  "Enhancement will only be executed when there are no existing enhancement records, so in some cases, you may only need to delete the empty enhancement records."
                ) })
              ] }),
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "This operation cannot be undone. Would you like to proceed?"
        ) })
      ] })
    }
  );
};
DeleteEnhancementsModal$1.displayName = "DeleteEnhancementsModal";
const Template = ({
  template: template2,
  onChange,
  enhancersCache,
  propertyMapCache,
  templatesCache
}) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const navigate = useNavigate();
  const [enhancers, setEnhancers] = React$6.useState(enhancersCache ?? []);
  const [propertyMap, setPropertyMap] = React$6.useState(propertyMapCache ?? {});
  const [templates2, setTemplates] = React$6.useState(
    templatesCache ?? []
  );
  reactExports.useEffect(() => {
    if (!enhancersCache) {
      BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
        setEnhancers(r2.data ?? []);
      });
    }
    if (!propertyMapCache) {
      loadProperties();
    }
    if (!templatesCache) {
      BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates().then((r2) => {
        setTemplates(r2.data ?? []);
      });
    }
  }, []);
  useUpdateEffect(() => {
    setEnhancers(enhancersCache ?? []);
  }, [enhancersCache]);
  useUpdateEffect(() => {
    setPropertyMap(propertyMapCache ?? {});
  }, [propertyMapCache]);
  useUpdateEffect(() => {
    setTemplates(templatesCache ?? []);
  }, [templatesCache]);
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const putTemplate = async (tpl) => {
    const r2 = await BApi$1.mediaLibraryTemplate.putMediaLibraryTemplate(tpl.id, tpl);
    if (!r2.code) {
      toast.success(t2("Saved successfully"));
      onChange == null ? void 0 : onChange();
      forceUpdate();
      return;
    }
    throw new Error(r2.message);
  };
  const renderChildSelector = (tpl) => {
    const willCauseLoopKeys = new Set(
      templates2.filter((t1) => {
        return willCauseCircleReference(
          tpl,
          t1.id,
          templates2,
          (x2) => x2.id,
          (x2) => x2.childTemplateId,
          (x2, k2) => x2.childTemplateId = k2
        );
      }).map((x2) => x2.id.toString())
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "inline-flex items-center gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "min-w-[320px]",
          dataSource: templates2.map((t1) => {
            const hasLoop = willCauseLoopKeys.has(t1.id.toString());
            return {
              label: `[#${t1.id}] ${t1.name}${hasLoop ? ` (${t2("Loop detected")})` : ""}`,
              value: t1.id.toString()
            };
          }),
          disabledKeys: willCauseLoopKeys,
          fullWidth: false,
          label: `${t2("Child template")} (${t2("optional")})`,
          placeholder: t2("Select a child template"),
          selectedKeys: tpl.childTemplateId ? [tpl.childTemplateId.toString()] : [],
          size: "sm",
          onSelectionChange: (keys2) => {
            const id2 = parseInt(Array.from(keys2)[0], 10);
            tpl.childTemplateId = id2;
            putTemplate(tpl);
          }
        }
      ),
      tpl.childTemplateId && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "danger",
          variant: "light",
          onPress: () => {
            tpl.childTemplateId = void 0;
            tpl.child = void 0;
            putTemplate(tpl);
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
        }
      )
    ] });
  };
  console.log("template", template2);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Determine which files or folders will be considered as resources"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-large" }),
        title: `1. ${t2("Resource filter")}`,
        onRightIconPress: () => {
          createPortal(PathFilterModal, {
            onSubmit: async (f2) => {
              (template2.resourceFilters ?? (template2.resourceFilters = [])).push(f2);
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: (_a2 = template2.resourceFilters) == null ? void 0 : _a2.map((f2, i2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(CiFilter, { className: "text-base" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$b, { filter: f2 }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "default",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(PathFilterModal, {
                    filter: f2,
                    onSubmit: async (nf2) => {
                      Object.assign(f2, nf2);
                      await putTemplate(template2);
                      forceUpdate();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("Delete resource filter"),
                    children: t2("Sure to delete?"),
                    onOk: async () => {
                      var _a3;
                      (_a3 = template2.resourceFilters) == null ? void 0 : _a3.splice(i2, 1);
                      await putTemplate(template2);
                      forceUpdate();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
              }
            )
          ] });
        }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Determine which files be considered as playable files"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoPlayCircleOutline, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" }),
        title: `2. ${t2("Playable(Runnable) files")}`,
        onRightIconPress: () => {
          createPortal(PlayableFileSelectorModal$1, {
            selection: template2.playableFileLocator,
            onSubmit: async (selection) => {
              template2.playableFileLocator = selection;
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          (_c2 = (_b2 = template2.playableFileLocator) == null ? void 0 : _b2.extensionGroups) == null ? void 0 : _c2.map((group) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: group == null ? void 0 : group.name });
          }),
          (_e = (_d = template2.playableFileLocator) == null ? void 0 : _d.extensions) == null ? void 0 : _e.map((ext) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: ext });
          }),
          ((_f = template2.playableFileLocator) == null ? void 0 : _f.maxFileCount) && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "flat", children: t2("Max: {{count}}", {
            count: template2.playableFileLocator.maxFileCount
          }) })
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("This section is read-only. Use Resource Profile for new property configurations."),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(TbDatabase, { className: "text-large" }),
        title: `3. ${t2("Properties")} (${t2("Deprecated")})`,
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "flat", children: t2("Read-only - Use Resource Profile for new configurations") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: (_g = template2.properties) == null ? void 0 : _g.map((p2, i2) => {
            var _a3;
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["name", "pool", "type"], property: p2.property }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: (_a3 = p2.valueLocators) == null ? void 0 : _a3.map((v2) => {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "bordered", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$a, { locator: v2 }) });
                }) })
              ] }, `${p2.pool}-${p2.id}`),
              i2 < template2.properties.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-[12px] bg-divider" })
            ] });
          }) })
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2(
          "You can use enhancers to automatically populate resource information or files"
        ),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(IoRocketOutline, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-large" }),
        title: `4. ${t2("Enhancers")}`,
        onRightIconPress: () => {
          var _a3;
          createPortal(EnhancerSelectorModal$1, {
            selectedIds: (_a3 = template2.enhancers) == null ? void 0 : _a3.map((e2) => e2.enhancerId),
            onSubmit: async (ids2) => {
              template2.enhancers = ids2.map((id2) => {
                var _a4;
                return {
                  enhancerId: id2,
                  ...(_a4 = template2.enhancers) == null ? void 0 : _a4.find((x2) => x2.enhancerId == id2)
                };
              });
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: (_h = template2.enhancers) == null ? void 0 : _h.map((e2, i2) => {
          var _a3, _b3;
          const enhancer = enhancers.find((x2) => x2.id == e2.enhancerId);
          if (!enhancer) {
            return t2("Unknown enhancer");
          }
          const keywordProperty = e2.keywordProperty ? (_a3 = propertyMap[e2.keywordProperty.pool]) == null ? void 0 : _a3[e2.keywordProperty.id] : void 0;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  size: "sm",
                  variant: "light",
                  onPress: async () => {
                    createPortal(EnhancerOptionsModal, {
                      enhancer,
                      options: JSON.parse(JSON.stringify(e2)),
                      onSubmit: async (options) => {
                        const updatedTemplate = JSON.parse(JSON.stringify(template2));
                        Object.assign(updatedTemplate.enhancers[i2], options);
                        await putTemplate(updatedTemplate);
                        Object.assign(template2, updatedTemplate);
                        const referencedPairs = [];
                        (template2.enhancers ?? []).forEach((enh) => {
                          (enh.targetOptions ?? []).forEach((to2) => {
                            const targetDescriptor = enhancer.targets.find(
                              (x2) => x2.id == to2.target
                            );
                            if ((targetDescriptor == null ? void 0 : targetDescriptor.isDynamic) && to2.dynamicTarget == void 0) {
                              return;
                            }
                            if (to2 && !to2.autoBindProperty && to2.propertyPool != void 0 && to2.propertyPool > 0 && to2.propertyId != void 0) {
                              referencedPairs.push({
                                pool: to2.propertyPool,
                                id: to2.propertyId
                              });
                            }
                          });
                        });
                        const uniqPairs = _$2.uniqBy(referencedPairs, (p2) => `${p2.pool}:${p2.id}`);
                        const boundKeySet = new Set(
                          (template2.properties ?? []).map((p2) => `${p2.pool}:${p2.id}`)
                        );
                        const unboundPairs = uniqPairs.filter(
                          (p2) => !boundKeySet.has(`${p2.pool}:${p2.id}`)
                        );
                        if (unboundPairs.length > 0) {
                          const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
                          const ps = _$2.mapValues(
                            _$2.groupBy(psr, (x2) => x2.pool),
                            (v2) => _$2.keyBy(v2, (x2) => x2.id)
                          );
                          const propsToBind = unboundPairs.map((p2) => ps[p2.pool][p2.id]).filter((x2) => !!x2);
                          if (propsToBind.length > 0) {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("Bind referenced properties to current template?"),
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 flex-wrap", children: propsToBind.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: p2 }, `${p2.pool}:${p2.id}`)) }),
                              onOk: async () => {
                                template2.properties ?? (template2.properties = []);
                                propsToBind.forEach((pr) => {
                                  template2.properties.push({
                                    pool: pr.pool,
                                    id: pr.id,
                                    property: pr,
                                    valueLocators: []
                                  });
                                });
                                await putTemplate(template2);
                                setPropertyMap(ps);
                                forceUpdate();
                              }
                            });
                          } else {
                            setPropertyMap(ps);
                          }
                        }
                        forceUpdate();
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CiCircleMore, { className: "text-base" }) }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  dropdown_menu_default,
                  {
                    "aria-label": "Enhancer operations",
                    selectionMode: "single",
                    onSelectionChange: (keys2) => {
                      const key = Array.from(keys2 ?? [])[0];
                      if (key === "deleteEnhancements") {
                        createPortal(DeleteEnhancementsModal$1, {
                          title: t2("Enhancement.DeleteAllByEnhancerForTemplate", {
                            templateName: template2.name
                          }),
                          description: t2(
                            "Enhancement.DeleteAllByEnhancerForTemplate.ScopeWarning"
                          ),
                          onOk: async (deleteEmptyOnly) => {
                            toast.success(t2("Saved"));
                          }
                        });
                      } else if (key === "removeEnhancer") {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Delete resource filter"),
                          children: t2("Sure to delete?"),
                          onOk: async () => {
                            var _a4;
                            (_a4 = template2.enhancers) == null ? void 0 : _a4.splice(i2, 1);
                            await putTemplate(template2);
                            forceUpdate();
                          }
                        });
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          className: "text-warning",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                          children: t2("MediaLibrary.DeleteEnhancements")
                        },
                        "deleteEnhancements"
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        menu_item_base_default,
                        {
                          className: "text-danger",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                          children: t2("MediaLibraryTemplate.RemoveEnhancer")
                        },
                        "removeEnhancer"
                      )
                    ]
                  }
                )
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-x-2 text-xs opacity-100",
                style: { gridTemplateColumns: "auto 1fr" },
                children: [
                  e2.requirements && e2.requirements.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(IoGitBranchOutline, { className: "text-lg" }),
                      t2("Prerequisite enhancers")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: e2.requirements.map((r2) => /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: enhancers.find((x2) => x2.id == r2) })) })
                  ] }),
                  e2.keywordProperty && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2(
                          "The property used to generate the keyword for enhancers that need it. Default is file/folder name."
                        ),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(IoLocate, { className: "text-lg" }),
                          t2("Keyword property")
                        ] })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: keywordProperty }),
                      e2.keywordProperty.pool != PropertyPool.Internal && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: t2(
                        `PropertyValueScope.${PropertyValueScope[e2.keywordProperty.scope]}`
                      ) })
                    ] })
                  ] }),
                  e2.pretreatKeyword && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        color: "secondary",
                        content: t2("Whether to pretreat the keyword before using it."),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineCleaningServices, { className: "text-lg" }),
                          t2("Pretreat keyword")
                        ] })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { isSelected: true, size: "sm" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          color: "primary",
                          size: "sm",
                          variant: "light",
                          onPress: () => {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("About to leave current page"),
                              children: t2("Sure?"),
                              onOk: async () => {
                                navigate("/text");
                              }
                            });
                          },
                          children: t2("Configure special texts for pretreatment")
                        }
                      )
                    ] })
                  ] }),
                  e2.expressions && e2.expressions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(LuRegex, { className: "text-lg" }),
                      t2("Expressions")
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: e2.expressions.map((x2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: x2 })) })
                  ] })
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: e2.targetOptions ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap items-center gap-1", children: (_b3 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _b3.map((target, tIdx) => {
              var _a4, _b4, _c3;
              const tos = e2.targetOptions.filter((x2) => x2.target == target.id);
              if (!tos || tos.length == 0) {
                return null;
              }
              if (target.isDynamic) {
                const mainOptions = tos.find((x2) => x2.dynamicTarget == void 0);
                const otherOptions = tos.filter((x2) => x2 != mainOptions);
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }),
                    target.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) }),
                    (mainOptions == null ? void 0 : mainOptions.autoBindProperty) && t2("Auto bind property"),
                    (mainOptions == null ? void 0 : mainOptions.autoMatchMultilevelString) && t2("Auto match multilevel string")
                  ] }),
                  otherOptions.map((to2) => {
                    var _a5;
                    const property2 = to2.propertyPool != void 0 && to2.propertyId != void 0 ? (_a5 = propertyMap[to2.propertyPool]) == null ? void 0 : _a5[to2.propertyId] : void 0;
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSisternode, { className: "text-base" }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: to2.dynamicTarget }),
                      /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                      to2.autoBindProperty ? t2("Auto bind property") : property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 }) : t2("Unknown property"),
                      to2.autoMatchMultilevelString && t2("Auto match multilevel string")
                    ] });
                  }),
                  tIdx < ((_a4 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _a4.length) - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-full bg-divider" })
                ] });
              } else {
                const to2 = tos[0];
                const property2 = to2.propertyPool != void 0 && to2.propertyId != void 0 ? (_b4 = propertyMap[to2.propertyPool]) == null ? void 0 : _b4[to2.propertyId] : void 0;
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    target.description ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: target.name }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    to2.autoBindProperty ? t2("Auto bind property") : property2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: property2 }) : t2("Unknown property"),
                    to2.autoMatchMultilevelString && t2("Auto match multilevel string")
                  ] }),
                  tIdx < ((_c3 = enhancer == null ? void 0 : enhancer.targets) == null ? void 0 : _c3.length) - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[1px] h-[12px] bg-divider" })
                ] });
              }
            }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: t2(
              "This enhancer won't have any effect since no target property is mapped. You need to configure at least one target property to let enhancer save data to."
            ) }) })
          ] });
        }) })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("You can customize the display name of the resource"),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineSubtitles, { className: "text-large" }),
        rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-large" }),
        title: `5. ${t2("Display name template")}`,
        onRightIconPress: () => {
          var _a3;
          createPortal(DisplayNameTemplateEditorModal$1, {
            properties: ((_a3 = template2.properties) == null ? void 0 : _a3.map((p2) => p2.property)) ?? [],
            template: template2.displayNameTemplate,
            onSubmit: async (templateStr) => {
              template2.displayNameTemplate = templateStr;
              await putTemplate(template2);
              forceUpdate();
            }
          });
        },
        children: template2.displayNameTemplate
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2(
          "You can create cascading resources through sub-templates, where the rules of the sub-template will use the path of the resource determined by the current template as the root directory."
        ),
        descriptionPlacement: "bottom",
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(TiFlowChildren, { className: "text-large" }),
        title: `6. ${t2("Subresource")}`,
        children: renderChildSelector(template2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Block2,
      {
        description: t2("Validate your template on sample resources and see live traces."),
        leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineFactCheck, { className: "text-large" }),
        title: `7. ${t2("Validate")}`,
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "success",
              size: "sm",
              variant: "flat",
              onPress: () => createPortal(ValidateModal, { templateId: template2.id }),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(VscDebugAll, { className: "text-lg" }),
                t2("Validate")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs opacity-70", children: t2(
            "Run a quick validation to check resource discovery, properties, playable files, enhancers and display names."
          ) })
        ] })
      }
    )
  ] });
};
Template.displayName = "Template";
const TemplateModal = ({ id: id2, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  useUpdate();
  const [template2, setTemplate] = reactExports.useState();
  reactExports.useEffect(() => {
    BApi$1.mediaLibraryTemplate.getMediaLibraryTemplate(id2).then((r2) => {
      if (!r2.code) {
        setTemplate(r2.data);
      }
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: false,
      size: "full",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        t2("Editing media library template"),
        " ",
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "font-bold", color: "success", size: "lg", variant: "light", children: template2 == null ? void 0 : template2.name })
      ] }),
      onDestroyed,
      children: template2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Template, { template: template2 })
    }
  );
};
TemplateModal.displayName = "TemplateModal";
function EditableValue({
  onSubmit,
  Viewer,
  viewerProps,
  Editor: Editor2,
  editorProps,
  className,
  trigger = "edit-button",
  ...commonProps2
}) {
  const [editing, setEditing] = reactExports.useState(false);
  const [isSubmitting, setIsSubmitting] = reactExports.useState(false);
  const initValueRef = reactExports.useRef(commonProps2.value ?? commonProps2.defaultValue);
  const [value2, setValue] = reactExports.useState(initValueRef.current);
  console.log(viewerProps, commonProps2, value2);
  useUpdateEffect(() => {
    setValue(commonProps2.value);
  }, [commonProps2.value]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `flex items-center gap-2 ${className}`, children: editing ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor2,
      {
        ...editorProps,
        ...commonProps2,
        value: value2,
        onValueChange: (v2) => setValue(v2)
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "success",
        isLoading: isSubmitting,
        size: "sm",
        variant: "light",
        onPress: () => {
          const func = onSubmit == null ? void 0 : onSubmit(value2);
          if (isPromise(func)) {
            setIsSubmitting(true);
            func.finally(() => {
              setIsSubmitting(false);
              setEditing(false);
            });
          }
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-base" })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        color: "danger",
        size: "sm",
        variant: "light",
        onPress: () => {
          setValue(initValueRef.current);
          setEditing(false);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-base" })
      }
    )
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Viewer,
      {
        ...viewerProps,
        ...commonProps2,
        value: value2,
        isReadOnly: true,
        onClick: () => {
          if (trigger == "viewer") {
            setEditing(true);
          }
        }
      }
    ),
    trigger == "edit-button" && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        size: "sm",
        variant: "light",
        onPress: () => {
          setEditing(true);
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
      }
    )
  ] }) });
}
buildLogger("MediaLibrarySelectorV2");
const MediaLibrarySelectorV2 = (props) => {
  const { t: t2 } = useTranslation();
  const { onSelect, confirmation } = props;
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  const [categories, setCategories] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState();
  const resourceOptions = useResourceOptionsStore((state) => state.data);
  const init2 = async () => {
    const mlv2s = (await BApi$1.mediaLibraryV2.getAllMediaLibraryV2()).data ?? [];
    const data = [];
    if (mlv2s.length > 0) {
      data.push({
        id: 0,
        name: t2("common.label.mediaLibraries"),
        libraries: mlv2s.map((ml2) => ({
          id: ml2.id,
          name: ml2.name
        }))
      });
    }
    setCategories(data);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const recentlySelectedIds = (resourceOptions == null ? void 0 : resourceOptions.idsOfMediaLibraryRecentlyMovedTo) || [];
  const lowerCasedKeyword = (keyword == null ? void 0 : keyword.toLowerCase()) ?? "";
  const filteredCategories = keyword != void 0 && (keyword == null ? void 0 : keyword.length) > 0 ? categories.map((a2) => {
    if (a2.name.toLowerCase().indexOf(lowerCasedKeyword) > -1) {
      return a2;
    } else {
      const filteredLibraries = (a2.libraries || []).filter((b2) => {
        return b2.name.toLowerCase().includes(lowerCasedKeyword);
      });
      return {
        ...a2,
        libraries: filteredLibraries
      };
    }
  }).filter((c2) => c2.libraries.length > 0) : categories;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      footer: false,
      size: "lg",
      title: t2("Select a media library"),
      visible,
      onClose: () => {
        setVisible(false);
      },
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            placeholder: t2("Quick filter"),
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-base" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-2", children: filteredCategories.map((c2, ic2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "grid gap-12 items-center",
                style: { gridTemplateColumns: "30% auto" },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.name }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.libraries.map((l2, il2) => {
                    const selectedRecently = recentlySelectedIds.includes(
                      l2.id
                    );
                    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      Button,
                      {
                        color: selectedRecently ? "success" : "primary",
                        size: "sm",
                        variant: "light",
                        onClick: () => {
                          if (confirmation) {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2(
                                "Are you sure to select this media library?"
                              ),
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", children: l2.name }) }),
                              onOk: async () => {
                                onSelect == null ? void 0 : onSelect(l2.id);
                                setVisible(false);
                              }
                            });
                          } else {
                            onSelect == null ? void 0 : onSelect(l2.id);
                            setVisible(false);
                          }
                        },
                        children: [
                          l2.name,
                          selectedRecently && /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$B, { className: "text-sm" })
                        ]
                      }
                    );
                  }) })
                ]
              }
            ),
            ic2 != filteredCategories.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" })
          ] });
        }) })
      ] })
    }
  );
};
MediaLibrarySelectorV2.displayName = "MediaLibrarySelectorV2";
var SortBy = /* @__PURE__ */ ((SortBy2) => {
  SortBy2[SortBy2["Path"] = 1] = "Path";
  SortBy2[SortBy2["Template"] = 2] = "Template";
  return SortBy2;
})(SortBy || {});
const MediaLibraryPage$1 = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const navigate = useNavigate();
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const [templates2, setTemplates] = reactExports.useState([]);
  const templatesRef = reactExports.useRef({});
  const [sortBy, setSortBy] = reactExports.useState(
    1
    /* Path */
  );
  const forceUpdate = useUpdate();
  const outdatedModalRef = reactExports.useRef(null);
  const [unknownResourceCounts, setUnknownResourceCounts] = reactExports.useState();
  const resourceOptionsStore = useResourceOptionsStore();
  const resourceOptions = resourceOptionsStore.data;
  const loadMediaLibraries = async () => {
    const r2 = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
    const list2 = r2.data ?? [];
    setMediaLibraries(list2);
    return list2;
  };
  const loadTemplates = async () => {
    const r2 = await BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates();
    const tpls = r2.data ?? [];
    setTemplates(tpls);
    templatesRef.current = tpls.reduce((s2, t22) => {
      s2[t22.id] = t22;
      return s2;
    }, {});
  };
  reactExports.useEffect(() => {
    Promise.all([loadTemplates(), loadMediaLibraries()]).then(() => {
      var _a2;
      (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
    });
  }, []);
  useUpdateEffect(() => {
    switch (sortBy) {
      case 1:
        mediaLibraries.sort((a2, b2) => (a2.paths[0] ?? "").localeCompare(b2.paths[0] ?? ""));
        break;
      case 2:
        mediaLibraries.sort(
          (a2, b2) => {
            var _a2, _b2;
            return (((_a2 = templatesRef.current[a2.templateId ?? 0]) == null ? void 0 : _a2.name) ?? "").localeCompare(
              ((_b2 = templatesRef.current[b2.templateId ?? 0]) == null ? void 0 : _b2.name) ?? ""
            );
          }
        );
        break;
    }
    forceUpdate();
  }, [sortBy, mediaLibraries]);
  const renderPath = (ml2) => {
    const paths = ml2.paths ?? [];
    if (paths.length == 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "primary",
          size: "sm",
          variant: "light",
          onPress: () => {
            ml2.paths.push("");
            forceUpdate();
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" })
        }
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: paths.map((p2, idx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            Editor: ({ onValueChange, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              PathAutocomplete,
              {
                label: paths.length > 1 ? `${t2("MediaLibrary.Path")}${idx + 1}` : t2("MediaLibrary.Path"),
                maxResults: 100,
                pathType: "folder",
                placeholder: t2("MediaLibrary.PathPlaceholder"),
                size: "sm",
                onSelectionChange: onValueChange,
                ...props
              }
            ),
            Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                className: "justify-start",
                color: "default",
                size: "sm",
                variant: "flat",
                onPress: () => BApi$1.tool.openFileOrDirectory({ path: p2 }),
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" }),
                  value2
                ]
              },
              idx
            ) : null,
            className: "grow",
            defaultValue: p2,
            onSubmit: async (v2) => {
              var _a2;
              paths[idx] = v2 ?? "";
              ml2.paths = paths;
              await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                paths
              });
              (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
              forceUpdate();
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              ml2.paths.push("");
              forceUpdate();
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("Remove folder from media library?"),
                children: t2("This operation will not affect the files in the directory."),
                onOk: async () => {
                  var _a2;
                  const newPaths = (_a2 = ml2.paths) == null ? void 0 : _a2.filter((x2) => x2 != p2);
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    paths: newPaths
                  });
                  if (!rsp.code) {
                    ml2.paths = newPaths;
                    forceUpdate();
                  }
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" })
          }
        )
      ] }, p2);
    }) });
  };
  (unknownResourceCounts == null ? void 0 : unknownResourceCounts.unknownPathCountByMediaLibraryId) ?? {};
  const renderTable = () => {
    if (mediaLibraries.length === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 grow justify-center", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(PiEmpty, { className: "text-2xl" }),
        t2("MediaLibrary.NoMediaLibrariesFound")
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, className: "mt-2 overflow-x-auto", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Name") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Path") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Template") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("MediaLibrary.Players") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: "200", children: t2("Operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: mediaLibraries.map((row, i2) => {
        const ml2 = row;
        const template2 = templates2.find((t22) => t22.id == ml2.templateId);
        const getCssVariable = (variableName) => {
          if (typeof document === "undefined")
            return "";
          return getComputedStyle(document.documentElement).getPropertyValue(variableName);
        };
        const textColor = getCssVariable("--theme-text") || "#222";
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: input_default,
                Viewer: ({ value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    className: "whitespace-break-spaces h-auto text-left",
                    size: "sm",
                    style: { color: ml2.color ?? textColor },
                    variant: "light",
                    ...props,
                    children: value2
                  }
                ),
                editorProps: {
                  size: "sm",
                  isRequired: true
                },
                trigger: "viewer",
                value: ml2.name,
                onSubmit: async (v2) => {
                  if (v2 == void 0 || v2.length == 0) {
                    toast.danger(t2("Name cannot be empty"));
                    return;
                  }
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    name: v2
                  });
                  if (!rsp.code) {
                    ml2.name = v2;
                    forceUpdate();
                  }
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ColorPicker$1,
              {
                color: ml2.color ?? textColor,
                onChange: async (color2) => {
                  const strColor = buildColorValueString(color2);
                  await BApi$1.mediaLibraryV2.putMediaLibraryV2(ml2.id, {
                    ...ml2,
                    color: strColor
                  });
                  ml2.color = strColor;
                  forceUpdate();
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderPath(ml2) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            EditableValue,
            {
              Editor: ({ onValueChange, value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                Select,
                {
                  isRequired: true,
                  dataSource: templates2.map(
                    (t22) => ({
                      textValue: `#${t22.id} ${t22.name}`,
                      label: `#${t22.id} ${t22.name}`,
                      value: t22.id
                    })
                  ).concat([
                    {
                      label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineImport, { className: "text-lg" }),
                        t2("MediaLibrary.CreateNewTemplate")
                      ] }),
                      value: -1,
                      textValue: t2("MediaLibrary.CreateNewTemplate")
                    }
                  ]),
                  isInvalid: value2 == void 0 || value2 <= 0,
                  label: t2("MediaLibrary.Template"),
                  placeholder: t2("MediaLibrary.TemplatePlaceholder"),
                  selectedKeys: value2 ? [value2.toString()] : void 0,
                  size: "sm",
                  onSelectionChange: (keys2) => {
                    const arr = Array.from(keys2);
                    if (arr.length > 0) {
                      const idStr = arr[0];
                      const value22 = parseInt(idStr, 10);
                      if (value22 == -1) {
                        createPortal(PresetTemplateBuilder, {
                          onSubmitted: async (id2) => {
                            onValueChange == null ? void 0 : onValueChange(id2);
                            await loadTemplates();
                          }
                        });
                      } else {
                        onValueChange == null ? void 0 : onValueChange(value22);
                        forceUpdate();
                      }
                    }
                  }
                }
              ),
              Viewer: ({ value: value2 }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  className: "text-left",
                  isDisabled: !template2,
                  radius: "sm",
                  size: "sm",
                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(TbTemplate, { className: "text-base" }),
                  variant: "light",
                  onPress: () => {
                    if (ml2.templateId) {
                      createPortal(TemplateModal, {
                        id: ml2.templateId,
                        onDestroyed: loadTemplates
                      });
                    }
                  },
                  children: (template2 == null ? void 0 : template2.name) ?? t2("MediaLibrary.Unknown")
                }
              ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", variant: "light", children: t2("Media library template must be set") }),
              className: "grow",
              editorProps: {
                // size: "sm",
              },
              value: ml2.templateId,
              onSubmit: async (v2) => {
                var _a2;
                if (v2 == void 0 || v2 <= 0) {
                  toast.danger(t2("Template cannot be empty"));
                  return;
                }
                if (ml2.templateId != v2) {
                  ml2.templateId = v2;
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    templateId: v2
                  });
                  if (!rsp.code) {
                    (_a2 = outdatedModalRef.current) == null ? void 0 : _a2.check();
                    forceUpdate();
                  }
                }
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Setup custom players"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                radius: "sm",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(PlayerSelectorModal$1, {
                    players: ml2.players,
                    onSubmit: async (players) => {
                      await BApi$1.mediaLibraryV2.putMediaLibraryV2(ml2.id, {
                        ...ml2,
                        players
                      });
                      await loadMediaLibraries();
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: "text-lg" })
              }
            ) }),
            ml2.players && ml2.players.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: ml2.players.map((player, index2) => {
              var _a2;
              const executablePathSegments = splitPathIntoSegments(
                player.executablePath
              );
              return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-xs", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium truncate", children: executablePathSegments[executablePathSegments.length - 1] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-gray-500", children: [
                    t2("Command"),
                    ": ",
                    player.command
                  ] })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
                  (_a2 = player.extensions) == null ? void 0 : _a2.map((ext) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: ext }, ext)),
                  player.extensions && player.extensions.length > 3 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "secondary", size: "sm", variant: "flat", children: [
                    "+",
                    player.extensions.length - 3
                  ] })
                ] })
              ] }, index2);
            }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: ml2.resourceCount > 0 ? t2("{{count}} resource(s) loaded in this media library.", {
                  count: ml2.resourceCount
                }) : t2(
                  "No resource loaded in this media library, you can click the synchronize button to load resources."
                ),
                placement: "top",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Chip,
                  {
                    color: "success",
                    size: "sm",
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineProduct, { className: "text-lg" }),
                    variant: "light",
                    children: ml2.resourceCount
                  }
                )
              }
            ),
            ml2.resourceCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("MediaLibrary.SearchResources"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "",
                radius: "sm",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    title: t2("MediaLibrary.Confirm"),
                    children: t2("MediaLibrary.LeavePageConfirm"),
                    defaultVisible: true,
                    onOk: async () => {
                      const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
                        propertyPool: PropertyPool.Internal,
                        propertyId: InternalProperty.MediaLibraryV2,
                        operation: SearchOperation.Equals
                      });
                      const searchForm = {
                        group: {
                          combinator: 1,
                          disabled: false,
                          filters: [
                            {
                              propertyPool: PropertyPool.Internal,
                              propertyId: InternalProperty.MediaLibraryV2,
                              operation: SearchOperation.Equals,
                              dbValue: ml2.id.toString(),
                              bizValue: ml2.name,
                              valueProperty: valuePropertyResponse.data,
                              disabled: false
                            }
                          ]
                        },
                        page: 1,
                        pageSize: 100
                      };
                      const query = encodeURIComponent(JSON.stringify(searchForm));
                      navigate(`/resource2?query=${query}`);
                    },
                    footer: {
                      actions: ["ok", "cancel"],
                      okProps: {
                        children: t2("MediaLibrary.Continue")
                      },
                      cancelProps: {
                        children: t2("MediaLibrary.Cancel")
                      }
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-lg" })
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              SyncStatus,
              {
                id: ml2.id,
                onSyncCompleted: () => {
                  loadMediaLibraries();
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, radius: "sm", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CiCircleMore, { className: "text-lg" }) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                dropdown_menu_default,
                {
                  "aria-label": "More operations",
                  selectionMode: "single",
                  onSelectionChange: (keys2) => {
                    const key = Array.from(keys2 ?? [])[0];
                    if (key === "moveResourcesToOtherMediaLibrary") {
                      createPortal(MediaLibrarySelectorV2, {
                        confirmation: true,
                        onSelect: async (toId) => {
                          if (toId === ml2.id) {
                            toast.warning(
                              t2("Cannot move resources to the same media library")
                            );
                            return;
                          }
                          try {
                            const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
                              propertyPool: PropertyPool.Internal,
                              propertyId: InternalProperty.MediaLibraryV2,
                              operation: SearchOperation.Equals
                            });
                            const searchForm = {
                              group: {
                                combinator: 1,
                                disabled: false,
                                filters: [
                                  {
                                    propertyPool: PropertyPool.Internal,
                                    propertyId: InternalProperty.MediaLibraryV2,
                                    operation: SearchOperation.Equals,
                                    dbValue: ml2.id.toString(),
                                    bizValue: ml2.name,
                                    valueProperty: valuePropertyResponse.data,
                                    disabled: false
                                  }
                                ]
                              },
                              page: 1,
                              pageSize: 1e6
                            };
                            const idsResp = await BApi$1.resource.searchAllResourceIds(
                              searchForm
                            );
                            const ids2 = idsResp.data || [];
                            if (ids2.length > 0) {
                              await BApi$1.resource.setResourceMediaLibraries({
                                ids: ids2,
                                mediaLibraryIds: [toId]
                              });
                            }
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("MediaLibrary.Confirm"),
                              children: t2(
                                "Move resources completed. Delete the source media library?"
                              ),
                              onOk: async () => {
                                await BApi$1.mediaLibraryV2.deleteMediaLibraryV2(ml2.id);
                                await loadMediaLibraries();
                              },
                              onClose: async () => {
                                await loadMediaLibraries();
                              },
                              footer: {
                                actions: ["ok", "cancel"],
                                okProps: { children: t2("Delete"), color: "danger" },
                                cancelProps: {
                                  children: t2("Keep it"),
                                  color: "default"
                                }
                              }
                            });
                          } catch (e2) {
                            toast.danger(t2("Operation failed"));
                          }
                        }
                      });
                    } else if (key === "deleteMediaLibrary") {
                      createPortal(Modal, {
                        defaultVisible: true,
                        title: t2("MediaLibrary.Confirm"),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                          t2("MediaLibrary.DeleteConfirm"),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-danger", children: t2("Be careful, this operation can not be undone") })
                        ] }),
                        onOk: async () => {
                          await BApi$1.mediaLibraryV2.deleteMediaLibraryV2(ml2.id);
                          loadMediaLibraries();
                        },
                        footer: {
                          actions: ["ok", "cancel"],
                          okProps: {
                            children: t2("Delete"),
                            color: "danger",
                            autoFocus: true
                          },
                          cancelProps: {
                            children: t2("MediaLibrary.Cancel")
                          }
                        }
                      });
                    }
                  },
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-primary",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineImport, { className: "text-lg" }),
                        children: t2("Move resources to another media library")
                      },
                      "moveResourcesToOtherMediaLibrary"
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      menu_item_base_default,
                      {
                        className: "text-danger",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" }),
                        children: t2("Delete this media library")
                      },
                      "deleteMediaLibrary"
                    )
                  ]
                }
              )
            ] })
          ] }) })
        ] }, ml2.id);
      }) })
    ] });
  };
  (unknownResourceCounts == null ? void 0 : unknownResourceCounts.unknownMediaLibraryCount) ?? 0;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(OutdatedModal, { ref: (r2) => outdatedModalRef.current = r2 }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: async () => {
              const no = mediaLibraries.map((ml2) => ml2.name.split(" ")).filter((x2) => x2.length > 1).map((x2) => parseInt(x2[1], 10)).reduce((a2, b2) => Math.max(a2, b2), 0) + 1;
              const name2 = `${t2("Media library")} ${no}`;
              await BApi$1.mediaLibraryV2.addMediaLibraryV2({
                name: name2,
                paths: []
              });
              await loadMediaLibraries();
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
              t2("MediaLibrary.Add")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "sm",
            onPress: () => {
              BApi$1.mediaLibraryV2.syncAllMediaLibrariesV2();
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(IoIosSync, { className: "text-lg" }),
              t2("MediaLibrary.SynchronizeAll")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            closeDelay: 200,
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-md space-y-2 text-sm p-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "By default, when a folder path changes, the resource data will be created as a new resource."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "If you enable this feature, a hidden .bakabase.json file will be generated inside folder resources to store their resource IDs."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "During synchronization, if a folder path changes but contains a .bakabase.json with any matching resource IDs, the resource data will be preserved instead of creating a new resource."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Since a path can be added to multiple media libraries, resources under each path will be tracked per media library."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                "Only supports resources in new version (V2) media libraries. Legacy resources (category-based media libraries) are not supported."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning", children: t2(
                "Enabling this feature will increase synchronization time as marker files need to be generated and verified."
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold text-warning", children: t2(
                "This feature will work after a complete GenerateResourceMarker task finishes."
              ) })
            ] }),
            placement: "bottom-start",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm font-medium", children: [
                t2("Keep resources on path change"),
                /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                switch_default,
                {
                  isSelected: (resourceOptions == null ? void 0 : resourceOptions.keepResourcesOnPathChange) ?? false,
                  size: "sm",
                  onValueChange: async (v2) => {
                    if (!v2) {
                      const tasks = useBTasksStore.getState().tasks;
                      const keepResourcesTask = tasks.find(
                        (t22) => t22.id === "GenerateResourceMarker" && (t22.status === BTaskStatus.Running || t22.status === BTaskStatus.Paused)
                      );
                      if (keepResourcesTask) {
                        const shouldContinue = await new Promise((resolve2) => {
                          createPortal(Modal, {
                            defaultVisible: true,
                            title: t2("Confirm disabling resource markers"),
                            size: "md",
                            footer: {
                              actions: ["cancel", "ok"],
                              okProps: {
                                text: t2("Confirm and stop task"),
                                color: "danger"
                              },
                              cancelProps: {
                                text: t2("Cancel")
                              }
                            },
                            onOk: () => resolve2(true),
                            onClose: () => resolve2(false),
                            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("The GenerateResourceMarker task is currently running.") }),
                              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                "Disabling this feature will stop the task. Are you sure you want to continue?"
                              ) })
                            ] })
                          });
                        });
                        if (!shouldContinue) {
                          return;
                        }
                        try {
                          await BApi$1.backgroundTask.stopBackgroundTask("GenerateResourceMarker", {
                            confirm: true
                          });
                        } catch (e2) {
                          console.error("Failed to stop task:", e2);
                        }
                      }
                      const deleteMarkers = await new Promise((resolve2) => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Delete marker files?"),
                          size: "md",
                          footer: {
                            actions: ["cancel", "ok"],
                            okProps: {
                              text: t2("Delete markers"),
                              color: "warning"
                            },
                            cancelProps: {
                              text: t2("Keep markers")
                            }
                          },
                          onOk: () => resolve2(true),
                          onClose: () => resolve2(false),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Do you want to delete all .bakabase.json marker files?") }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm opacity-70", children: t2(
                              "If you keep them, existing markers will remain in the folders."
                            ) })
                          ] })
                        });
                      });
                      await BApi$1.options.patchResourceOptions({
                        keepResourcesOnPathChange: false
                      });
                      if (deleteMarkers) {
                        await new Promise((resolve2) => {
                          const DeletionProgressModal = () => {
                            const [progressState, setProgressState] = reactExports.useState({
                              percentage: 0,
                              total: 0,
                              processed: 0,
                              deleted: 0,
                              failed: 0,
                              currentPath: ""
                            });
                            const [visible, setVisible] = reactExports.useState(true);
                            const [showStopConfirm, setShowStopConfirm] = reactExports.useState(false);
                            const [isStopping, setIsStopping] = reactExports.useState(false);
                            const [isCancelled, setIsCancelled] = reactExports.useState(false);
                            const abortControllerRef = reactExports.useRef(null);
                            reactExports.useEffect(() => {
                              const abortController = new AbortController();
                              abortControllerRef.current = abortController;
                              const startDeletion = async () => {
                                try {
                                  const url2 = `${envConfig.apiEndpoint}/options/resource/delete-markers`;
                                  const resp = await fetch(url2, {
                                    method: "POST",
                                    signal: abortController.signal
                                  });
                                  if (!resp.ok || !resp.body) {
                                    throw new Error(`Request failed: ${resp.status}`);
                                  }
                                  const reader = resp.body.getReader();
                                  const decoder = new TextDecoder();
                                  let buffer = "";
                                  while (true) {
                                    const { value: value2, done } = await reader.read();
                                    if (done)
                                      break;
                                    buffer += decoder.decode(value2, { stream: true });
                                    let idx;
                                    while ((idx = buffer.indexOf("\n")) >= 0) {
                                      const line2 = buffer.slice(0, idx).trim();
                                      buffer = buffer.slice(idx + 1);
                                      if (!line2)
                                        continue;
                                      try {
                                        const obj = JSON.parse(line2);
                                        if (obj.type === "progress" || obj.type === "complete") {
                                          setProgressState({
                                            percentage: obj.percentage || 0,
                                            total: obj.total || 0,
                                            processed: obj.processed || obj.total || 0,
                                            deleted: obj.deleted || 0,
                                            failed: obj.failed || 0,
                                            currentPath: obj.currentResourcePath || ""
                                          });
                                        } else if (obj.type === "cancelled") {
                                          setIsCancelled(true);
                                          toast.warning(
                                            t2(
                                              "Operation stopped. Some marker files may remain and need to be deleted manually."
                                            )
                                          );
                                        } else if (obj.type === "error") {
                                          toast.danger(obj.message || "Error deleting markers");
                                        }
                                      } catch {
                                      }
                                    }
                                  }
                                } catch (e2) {
                                  if (e2.name !== "AbortError") {
                                    toast.danger(t2("Failed to delete markers"));
                                  } else if (isStopping) {
                                    setIsCancelled(true);
                                  }
                                } finally {
                                  setVisible(false);
                                  setTimeout(() => resolve2(), 500);
                                }
                              };
                              startDeletion();
                              return () => {
                                abortController.abort();
                              };
                            }, []);
                            const handleStopClick = () => {
                              setShowStopConfirm(true);
                            };
                            const handleConfirmStop = () => {
                              setIsStopping(true);
                              setShowStopConfirm(false);
                              if (abortControllerRef.current) {
                                abortControllerRef.current.abort();
                              }
                            };
                            return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                Modal,
                                {
                                  footer: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                    Button,
                                    {
                                      color: "danger",
                                      isDisabled: isStopping || isCancelled,
                                      variant: "light",
                                      onClick: handleStopClick,
                                      children: isStopping ? t2("Stopping...") : t2("Stop")
                                    }
                                  ) }),
                                  hideCloseButton: true,
                                  isDismissable: false,
                                  size: "md",
                                  title: t2("Deleting resource markers"),
                                  visible,
                                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
                                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                                        "div",
                                        {
                                          className: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary"
                                        }
                                      ),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2(
                                          "Processing {{processed}} of {{total}} resources",
                                          {
                                            processed: progressState.processed,
                                            total: progressState.total
                                          }
                                        ) }),
                                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-500", children: t2("Deleted: {{deleted}}, Failed: {{failed}}", {
                                          deleted: progressState.deleted,
                                          failed: progressState.failed
                                        }) })
                                      ] }),
                                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xl font-bold", children: [
                                        progressState.percentage,
                                        "%"
                                      ] })
                                    ] }),
                                    progressState.currentPath && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-gray-500 truncate", children: progressState.currentPath }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full bg-gray-200 rounded-full h-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      "div",
                                      {
                                        className: "bg-primary h-2 rounded-full transition-all duration-300",
                                        style: { width: `${progressState.percentage}%` }
                                      }
                                    ) })
                                  ] })
                                }
                              ),
                              /* @__PURE__ */ jsxRuntimeExports.jsx(
                                Modal,
                                {
                                  footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-2", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                                      Button,
                                      {
                                        variant: "light",
                                        onClick: () => setShowStopConfirm(false),
                                        children: t2("Cancel")
                                      }
                                    ),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "danger", onClick: handleConfirmStop, children: t2("Stop operation") })
                                  ] }),
                                  size: "md",
                                  title: t2("Stop deletion operation?"),
                                  visible: showStopConfirm,
                                  onClose: () => setShowStopConfirm(false),
                                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-warning font-semibold", children: t2("Warning") }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
                                      "If you stop this operation now, you will need to delete the remaining marker files manually."
                                    ) }),
                                    /* @__PURE__ */ jsxRuntimeExports.jsxs(
                                      "div",
                                      {
                                        className: "bg-[var(--bakaui-overlap-background)] p-3 rounded",
                                        children: [
                                          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("Marker file information:") }),
                                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm space-y-1", children: [
                                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("File name: {{filename}}", {
                                              filename: ".bakabase.json"
                                            }) }),
                                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Location: Inside folder resources") }),
                                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Attribute: Hidden file") })
                                          ] })
                                        ]
                                      }
                                    ),
                                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-gray-600", children: t2(
                                      "You can search for and delete these files using your file manager or terminal."
                                    ) })
                                  ] })
                                }
                              )
                            ] });
                          };
                          createPortal(DeletionProgressModal, {});
                        });
                      }
                    } else {
                      await BApi$1.options.patchResourceOptions({
                        keepResourcesOnPathChange: true
                      });
                    }
                    toast.success(t2("Saved"));
                  }
                }
              )
            ] })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "warning",
          size: "sm",
          variant: "flat",
          onPress: () => setSortBy(
            1 == sortBy ? 2 : 1
            /* Path */
          ),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(FaSort, { className: "text-base" }),
            t2("MediaLibrary.SortBy", {
              sortBy: t2(`MediaLibrary.SortBy.${SortBy[sortBy]}`)
            })
          ]
        }
      ) })
    ] }),
    renderTable()
  ] });
};
MediaLibraryPage$1.displayName = "MediaLibraryPage";
function HiOutlineCollection(props) {
  return GenIcon({ "attr": { "fill": "none", "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "strokeLinecap": "round", "strokeLinejoin": "round", "d": "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }, "child": [] }] })(props);
}
const MediaLibraryPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const navigate = useNavigate();
  const [mediaLibraries, setMediaLibraries] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const [highlightedId, setHighlightedId] = reactExports.useState(null);
  const highlightTimerRef = reactExports.useRef();
  const forceUpdate = useUpdate();
  const loadMediaLibraries = async () => {
    setLoading(true);
    try {
      const r2 = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
      const list2 = r2.data ?? [];
      setMediaLibraries(list2);
      return list2;
    } finally {
      setLoading(false);
    }
  };
  reactExports.useEffect(() => {
    loadMediaLibraries();
  }, []);
  const addMediaLibrary = async () => {
    const numbers2 = mediaLibraries.map((ml2) => {
      const match5 = ml2.name.match(/(\d+)$/);
      return match5 ? parseInt(match5[1], 10) : 0;
    }).filter((n2) => !isNaN(n2));
    const no = numbers2.length > 0 ? Math.max(...numbers2) + 1 : 1;
    const name2 = `${t2("mediaLibrary.title")} ${no}`;
    const oldIds = new Set(mediaLibraries.map((ml2) => ml2.id));
    await BApi$1.mediaLibraryV2.addMediaLibraryV2({
      name: name2,
      paths: []
    });
    const newList = await loadMediaLibraries();
    const newMl = newList.find((ml2) => !oldIds.has(ml2.id));
    if (newMl) {
      if (highlightTimerRef.current) {
        clearTimeout(highlightTimerRef.current);
      }
      setHighlightedId(newMl.id);
      highlightTimerRef.current = setTimeout(() => {
        setHighlightedId(null);
      }, 3e3);
      requestAnimationFrame(() => {
        var _a2;
        (_a2 = document.getElementById(`media-library-card-${newMl.id}`)) == null ? void 0 : _a2.scrollIntoView({
          behavior: "smooth",
          block: "nearest"
        });
      });
    }
  };
  const deleteMediaLibrary = (ml2) => {
    createPortal(Modal, {
      defaultVisible: true,
      title: t2("mediaLibrary.confirm.title"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        t2("mediaLibrary.confirm.delete"),
        /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-danger", children: t2("mediaLibrary.warning.irreversible") })
      ] }),
      onOk: async () => {
        await BApi$1.mediaLibraryV2.deleteMediaLibraryV2(ml2.id);
        loadMediaLibraries();
      },
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: t2("mediaLibrary.action.delete"),
          color: "danger",
          autoFocus: true
        },
        cancelProps: {
          children: t2("mediaLibrary.action.cancel")
        }
      }
    });
  };
  const searchResources = (ml2) => {
    createPortal(Modal, {
      title: t2("mediaLibrary.confirm.title"),
      children: t2("mediaLibrary.confirm.leavePage"),
      defaultVisible: true,
      onOk: async () => {
        const valuePropertyResponse = await BApi$1.resource.getFilterValueProperty({
          propertyPool: PropertyPool.Internal,
          propertyId: InternalProperty.MediaLibraryV2Multi,
          operation: SearchOperation.In
        });
        const searchForm = {
          group: {
            combinator: 1,
            disabled: false,
            filters: [
              {
                propertyPool: PropertyPool.Internal,
                propertyId: InternalProperty.MediaLibraryV2Multi,
                operation: SearchOperation.In,
                dbValue: serializeStandardValue([ml2.id.toString()], StandardValueType.ListString),
                bizValue: serializeStandardValue([ml2.name], StandardValueType.ListString),
                valueProperty: valuePropertyResponse.data,
                disabled: false
              }
            ]
          },
          page: 1,
          pageSize: 100
        };
        const query = encodeURIComponent(JSON.stringify(searchForm));
        navigate(`/resource?query=${query}`);
      },
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          children: t2("mediaLibrary.action.continue")
        },
        cancelProps: {
          children: t2("mediaLibrary.action.cancel")
        }
      }
    });
  };
  const renderEmptyState = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center grow py-16 px-8", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-6 max-w-lg text-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 rounded-full bg-secondary/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(HiOutlineCollection, { className: "text-4xl text-secondary" }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold flex items-center justify-center gap-2", children: t2("mediaLibrary.emptyState.title") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-500 text-sm leading-relaxed", children: t2("mediaLibrary.emptyState.description") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full bg-default-100 rounded-lg p-4 text-left space-y-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-6 h-6 rounded bg-secondary/20 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-secondary text-xs font-bold", children: "1" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-600", children: t2("mediaLibrary.emptyState.feature1") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-6 h-6 rounded bg-secondary/20 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-secondary text-xs font-bold", children: "2" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-600", children: t2("mediaLibrary.emptyState.feature2") })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-6 h-6 rounded bg-secondary/20 flex items-center justify-center flex-shrink-0 mt-0.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-secondary text-xs font-bold", children: "3" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-600", children: t2("mediaLibrary.emptyState.feature3") })
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-3 w-full", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "md",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
            onPress: addMediaLibrary,
            children: t2("mediaLibrary.action.createFirst")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "default",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(IoSettingsOutline, { className: "text-base" }),
            variant: "light",
            onPress: () => navigate("/path-mark-config"),
            children: t2("mediaLibrary.action.goToPathMarkConfig")
          }
        )
      ] })
    ] }) });
  };
  const renderMediaLibraryCard = (ml2) => {
    const getCssVariable = (variableName) => {
      if (typeof document === "undefined")
        return "";
      return getComputedStyle(document.documentElement).getPropertyValue(variableName);
    };
    const textColor = getCssVariable("--theme-text") || "#222";
    const libraryColor = ml2.color ?? textColor;
    const isHighlighted = highlightedId === ml2.id;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      card_default,
      {
        id: `media-library-card-${ml2.id}`,
        className: `group hover:shadow-md hover:scale-[1.02] transition-all duration-300 ${isHighlighted ? "ring-2 ring-primary shadow-md" : ""}`,
        shadow: "sm",
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "p-4 flex flex-col gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: input_default,
                Viewer: ({ value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    className: "whitespace-break-spaces h-auto text-left font-medium text-base px-2 min-w-0",
                    size: "sm",
                    style: { color: libraryColor },
                    variant: "light",
                    ...props,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: value2 })
                  }
                ),
                editorProps: {
                  size: "sm",
                  isRequired: true
                },
                trigger: "viewer",
                value: ml2.name,
                onSubmit: async (v2) => {
                  if (v2 == void 0 || v2.length == 0) {
                    toast.danger(t2("mediaLibrary.error.nameEmpty"));
                    return;
                  }
                  const rsp = await BApi$1.mediaLibraryV2.patchMediaLibraryV2(ml2.id, {
                    name: v2
                  });
                  if (!rsp.code) {
                    ml2.name = v2;
                    forceUpdate();
                  }
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ColorPicker$1,
              {
                color: libraryColor,
                onChange: async (color2) => {
                  const strColor = buildColorValueString(color2);
                  await BApi$1.mediaLibraryV2.putMediaLibraryV2(ml2.id, {
                    ...ml2,
                    color: strColor
                  });
                  ml2.color = strColor;
                  forceUpdate();
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-2 px-3 rounded-md bg-default-100/50", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineProduct, { className: "text-base text-default-400" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xl font-semibold text-foreground", children: ml2.resourceCount.toLocaleString() }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("mediaLibrary.label.resources") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between pt-2 mt-auto border-t border-default-100", children: [
            ml2.resourceCount > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("mediaLibrary.action.searchResources"), delay: 500, placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "default",
                size: "sm",
                variant: "flat",
                onPress: () => searchResources(ml2),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" })
              }
            ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("mediaLibrary.tooltip.delete"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "text-danger opacity-0 group-hover:opacity-100 transition-opacity",
                radius: "sm",
                size: "sm",
                variant: "light",
                onPress: () => deleteMediaLibrary(ml2),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdOutlineDelete, { className: "text-lg" })
              }
            ) })
          ] })
        ] })
      },
      ml2.id
    );
  };
  const renderContent = () => {
    if (loading) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center grow py-16", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) });
    }
    if (mediaLibraries.length === 0) {
      return renderEmptyState();
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 mt-4 grow", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm text-default-500", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(MediaLibraryTerm, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "·" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("mediaLibrary.label.listDescription") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-4", children: mediaLibraries.map((ml2) => renderMediaLibraryCard(ml2)) })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col p-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-lg font-semibold", children: t2("mediaLibrary.title") }),
      mediaLibraries.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-lg" }),
          onPress: addMediaLibrary,
          children: t2("mediaLibrary.action.add")
        }
      )
    ] }),
    renderContent(),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 p-3 bg-default-50 rounded-lg", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("mediaLibrary.label.pathMarkConfigHint") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "secondary",
          size: "sm",
          variant: "flat",
          onPress: () => navigate("/path-mark-config"),
          children: t2("mediaLibrary.action.goToPathMarkConfig")
        }
      )
    ] })
  ] });
};
MediaLibraryPage.displayName = "MediaLibraryPage";
function GoShareAndroid(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 5.5a3.498 3.498 0 0 1-6.062 2.385l-5.112 3.021a3.498 3.498 0 0 1 0 2.188l5.112 3.021a3.5 3.5 0 1 1-.764 1.29l-5.112-3.02a3.499 3.499 0 1 1-3.843-5.642 3.499 3.499 0 0 1 3.843.872l5.112-3.021A3.5 3.5 0 1 1 20 5.5Zm-1.5 13a2 2 0 1 0-3.999-.001 2 2 0 0 0 3.999.001Zm0-13a2 2 0 1 0-3.999-.001A2 2 0 0 0 18.5 5.5ZM5.5 14a2 2 0 1 0 .001-3.999A2 2 0 0 0 5.5 14Z" }, "child": [] }] })(props);
}
const MissingDataMessage = "The current template contains data missing from the application. Please configure how to handle this data before proceeding with the import.";
const findProperExtensionGroup = (extensionGroup, extensionGroups) => {
  const candidates = extensionGroups.filter(
    (eg2) => _$2.xor(extensionGroup.extensions, eg2.extensions).length === 0
  );
  const best = candidates.find((eg2) => eg2.name === extensionGroup.name);
  return best ?? candidates[0];
};
const validate$b = (propertyConversionMap, extensionGroupConversionMap, configuration) => {
  if (!configuration || !configuration.noNeedToConfigure) {
    return true;
  }
  if (configuration.uniqueExtensionGroups && configuration.uniqueExtensionGroups.length > _$2.keys(extensionGroupConversionMap).length) {
    return false;
  }
  if (configuration.uniqueCustomProperties && configuration.uniqueCustomProperties.length > _$2.keys(propertyConversionMap).length) {
    return false;
  }
  return true;
};
const ImportModal = ({ onImported }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [shareCode, setShareCode] = reactExports.useState();
  const [configuration, setConfiguration] = reactExports.useState();
  const [propertyConversionsMap, setPropertyConversionsMap] = reactExports.useState();
  const [extensionGroupConversionsMap, setExtensionGroupConversionsMap] = reactExports.useState();
  const [propertyMap, setPropertyMap] = reactExports.useState(void 0);
  const [extensionGroups, setExtensionGroups] = reactExports.useState(void 0);
  const initDataForImport = async () => {
    if (!propertyMap) {
      const pr = await BApi$1.property.getPropertiesByPool(
        PropertyPool.Custom | PropertyPool.Reserved
      );
      const pm = (pr.data ?? []).reduce((s2, t22) => {
        var _a2;
        const m2 = s2[_a2 = t22.pool] ?? (s2[_a2] = {});
        m2[t22.id] = t22;
        return s2;
      }, {});
      setPropertyMap(pm);
    }
    if (!extensionGroups) {
      const eg2 = await BApi$1.extensionGroup.getAllExtensionGroups();
      setExtensionGroups(eg2.data ?? []);
    }
  };
  const $import = async () => {
    const model = {
      shareCode,
      customPropertyConversionsMap: propertyConversionsMap,
      extensionGroupConversionsMap,
      automaticallyCreateMissingData: false
    };
    return await BApi$1.mediaLibraryTemplate.importMediaLibraryTemplate(model);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !shareCode && !validate$b(propertyConversionsMap, extensionGroupConversionsMap, configuration),
          children: t2("Import")
        }
      },
      size: "lg",
      title: t2("Import media library template"),
      onOk: async () => {
        if (!configuration) {
          const importConfigurationResp = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplateImportConfiguration(shareCode);
          if (importConfigurationResp.code) {
            const msg = `${t2("Failed to get media library template import configuration")}:${importConfigurationResp.message}`;
            Vt.error(msg);
            throw new Error(msg);
          } else {
            setConfiguration(importConfigurationResp.data);
            if (!importConfigurationResp.data.noNeedToConfigure) {
              await initDataForImport();
              throw new Error(t2(MissingDataMessage));
            }
          }
        }
        const importResult = await $import();
        if (importResult.code) {
          const msg = `${t2("Failed to import media library template")}:${importResult.message}`;
          Vt.error(msg);
          throw new Error(msg);
        } else {
          onImported == null ? void 0 : onImported();
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              isRequired: true,
              isDisabled: !!configuration,
              label: t2("Share code"),
              placeholder: t2("Paste share code here"),
              value: shareCode,
              onValueChange: setShareCode
            }
          ),
          configuration && /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              className: "mt-2",
              color: "default",
              size: "sm",
              onPress: () => {
                setShareCode("");
                setConfiguration(void 0);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(IoSync, {}),
                t2("Change share code")
              ]
            }
          )
        ] }),
        configuration && !configuration.noNeedToConfigure && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(alert_default, { color: "warning", title: t2(MissingDataMessage) }) }),
          configuration.uniqueCustomProperties && configuration.uniqueCustomProperties.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-lg font-bold", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbSectionSign, { className: "" }),
              t2("New properties"),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                PropertiesMatcher,
                {
                  properties: configuration.uniqueCustomProperties.map((p2) => ({
                    type: p2.type,
                    name: p2.name
                  })),
                  onValueChanged: (ps) => {
                    const pcm = propertyConversionsMap ?? {};
                    for (let i2 = 0; i2 < configuration.uniqueCustomProperties.length; i2++) {
                      const p2 = ps[i2];
                      if (p2) {
                        pcm[i2] = {
                          toPropertyId: p2.id,
                          toPropertyPool: p2.pool,
                          toProperty: p2
                        };
                      }
                    }
                    setPropertyConversionsMap(pcm);
                  }
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "inline-grid gap-1 items-center",
                style: { gridTemplateColumns: "auto auto auto auto" },
                children: configuration.uniqueCustomProperties.map((p2, pIdx) => {
                  var _a2, _b2;
                  const conversion = propertyConversionsMap == null ? void 0 : propertyConversionsMap[pIdx];
                  const property2 = (conversion == null ? void 0 : conversion.toPropertyPool) && (conversion == null ? void 0 : conversion.toPropertyId) ? (_a2 = propertyMap == null ? void 0 : propertyMap[conversion.toPropertyPool]) == null ? void 0 : _a2[conversion.toPropertyId] : void 0;
                  const isSet2 = !!property2;
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: isSet2 ? "success" : "danger",
                        size: "sm",
                        variant: "light",
                        children: isSet2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCloseCircle, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { fields: ["name", "type"], property: p2 }) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      PropertyMatcher,
                      {
                        matchedProperty: (_b2 = propertyConversionsMap == null ? void 0 : propertyConversionsMap[pIdx]) == null ? void 0 : _b2.toProperty,
                        name: p2.name,
                        options: p2.options,
                        type: p2.type,
                        onValueChanged: (property22) => {
                          if (!property22) {
                            throw new Error("Property should not be undefined");
                          }
                          setPropertyMap({
                            ...propertyMap,
                            [property22.pool]: {
                              ...propertyMap[property22.pool],
                              [property22.id]: property22
                            }
                          });
                          setPropertyConversionsMap({
                            ...propertyConversionsMap,
                            [pIdx]: {
                              toPropertyPool: property22.pool,
                              toPropertyId: property22.id
                            }
                          });
                        }
                      }
                    )
                  ] });
                })
              }
            ) })
          ] }),
          configuration.uniqueExtensionGroups && configuration.uniqueExtensionGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-lg font-bold", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TbSectionSign, { className: "" }),
              t2("New extension groups")
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "div",
              {
                className: "inline-grid gap-1 items-center",
                style: { gridTemplateColumns: "auto auto auto auto auto" },
                children: configuration.uniqueExtensionGroups.map((eg2, egIdx) => {
                  var _a2;
                  const conversion = extensionGroupConversionsMap == null ? void 0 : extensionGroupConversionsMap[egIdx];
                  const leg = (conversion == null ? void 0 : conversion.toExtensionGroupId) ? extensionGroups == null ? void 0 : extensionGroups.find((g2) => g2.id == conversion.toExtensionGroupId) : void 0;
                  const isSet2 = !!leg;
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: isSet2 ? "success" : "danger",
                        size: "sm",
                        variant: "light",
                        children: isSet2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-base" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCloseCircle, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center flex-wrap gap-1", children: [
                      eg2.name,
                      (_a2 = eg2.extensions) == null ? void 0 : _a2.map((e2) => {
                        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: e2 });
                      })
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(TiChevronRightOutline, { className: "text-base" }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Automatically process"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        isIconOnly: true,
                        color: "primary",
                        variant: "light",
                        onPress: async () => {
                          const candidate = findProperExtensionGroup(
                            eg2,
                            extensionGroups ?? []
                          );
                          if (candidate) {
                            setExtensionGroupConversionsMap({
                              ...extensionGroupConversionsMap,
                              [egIdx]: {
                                toExtensionGroupId: candidate.id
                              }
                            });
                          } else {
                            createPortal(Modal, {
                              defaultVisible: true,
                              title: t2("No proper extension group found"),
                              children: t2(
                                "Should we create a new extension group for this?"
                              ),
                              onOk: async () => {
                                const r2 = await BApi$1.extensionGroup.addExtensionGroup({
                                  name: eg2.name,
                                  extensions: eg2.extensions
                                });
                                if (r2.code) {
                                  throw new Error(r2.message);
                                } else {
                                  const newEg = r2.data;
                                  setExtensionGroups([...extensionGroups, newEg]);
                                  setExtensionGroupConversionsMap({
                                    ...extensionGroupConversionsMap,
                                    [egIdx]: {
                                      toExtensionGroupId: newEg.id
                                    }
                                  });
                                }
                              }
                            });
                          }
                        },
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdAutoFixHigh, { className: "text-base" })
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "min-w-[240px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Select,
                      {
                        fullWidth: true,
                        isMultiline: true,
                        dataSource: extensionGroups == null ? void 0 : extensionGroups.map((x2) => ({
                          label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: x2.name }),
                            x2.extensions && x2.extensions.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: x2.extensions.map((e2) => {
                              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: e2 });
                            }) })
                          ] }),
                          textValue: x2.name,
                          value: x2.id.toString()
                        })),
                        multiple: false,
                        placeholder: t2("Select an extension group manually"),
                        selectedKeys: (conversion == null ? void 0 : conversion.toExtensionGroupId) ? [conversion.toExtensionGroupId.toString()] : void 0,
                        size: "sm",
                        variant: "bordered",
                        onSelectionChange: (selection) => {
                          const id2 = parseInt(Array.from(selection)[0], 10);
                          setExtensionGroupConversionsMap({
                            ...extensionGroupConversionsMap,
                            [egIdx]: {
                              ...conversion,
                              toExtensionGroupId: id2
                            }
                          });
                        }
                      }
                    ) })
                  ] });
                })
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
ImportModal.displayName = "ImportModal";
const AddModal = ({ onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [name2, setName] = reactExports.useState();
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: name2 == void 0 || name2.length == 0
        }
      },
      size: "md",
      title: t2("Add a media library template"),
      visible,
      onDestroyed,
      onOk: async () => {
        const r2 = await BApi$1.mediaLibraryTemplate.addMediaLibraryTemplate({
          name: name2
        });
        if (r2.code) {
          throw new Error(r2.message);
        }
        setVisible(false);
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            label: t2("Template name"),
            placeholder: t2("Enter template name"),
            value: name2,
            onValueChange: setName
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "media-library-template.use-preset-template-builder", children: [
          "We recommend using our",
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onPress: () => {
                setVisible(false);
                createPortal(PresetTemplateBuilder, {
                  onSubmitted: onDestroyed
                });
              },
              children: t2("Preset template builder")
            }
          ),
          "the first time you create a media library template."
        ] }) })
      ] })
    }
  );
};
AddModal.displayName = "AddModal";
const MediaLibraryTemplatePage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const [templates2, setTemplates] = reactExports.useState([]);
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [propertyMap, setPropertyMap] = reactExports.useState({});
  const [searchForm, setSearchForm] = reactExports.useState({});
  const [expandedTemplateIds, setExpandedTemplateIds] = reactExports.useState([]);
  const loadProperties = async () => {
    const psr = (await BApi$1.property.getPropertiesByPool(PropertyPool.All)).data || [];
    const ps = _$2.mapValues(
      _$2.groupBy(psr, (x2) => x2.pool),
      (v2) => _$2.keyBy(v2, (x2) => x2.id)
    );
    setPropertyMap(ps);
  };
  const loadTemplates = async () => {
    const r2 = await BApi$1.mediaLibraryTemplate.getAllMediaLibraryTemplates();
    const templates22 = r2.data || [];
    if (!r2.code) {
      setTemplates(templates22);
      return templates22;
    }
    return [];
  };
  const loadTemplate = async (id2) => {
    const r2 = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplate(id2);
    if (!r2.code) {
      setTemplates(templates2.map((t22) => {
        var _a2;
        return t22.id == ((_a2 = r2.data) == null ? void 0 : _a2.id) ? r2.data : t22;
      }));
    }
  };
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancers(r2.data || []);
    });
    loadProperties();
    loadTemplates().then((tpls) => setExpandedTemplateIds(tpls.map((tpl) => tpl.id.toString())));
  }, []);
  const putTemplate = async (tpl) => {
    const r2 = await BApi$1.mediaLibraryTemplate.putMediaLibraryTemplate(tpl.id, tpl);
    if (!r2.code) {
      Vt.success(t2("Saved successfully"));
      await loadTemplate(tpl.id);
    }
  };
  const filteredTemplates = templates2.filter((tpl) => {
    if (!searchForm.keyword || searchForm.keyword.length == 0) {
      return true;
    }
    const keyword = searchForm.keyword.toLowerCase();
    return tpl.name.toLowerCase().includes(keyword) || tpl.author && tpl.author.toLowerCase().includes(keyword) || tpl.description && tpl.description.toLowerCase().includes(keyword);
  });
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => createPortal(AddModal, { onDestroyed: loadTemplates }),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("Create a template")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          autocomplete_default,
          {
            endContent: filteredTemplates.length == templates2.length ? filteredTemplates.length : `${filteredTemplates.length}/${templates2.length}`,
            fullWidth: false,
            inputValue: searchForm.keyword,
            placeholder: t2("Search templates"),
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
            onInputChange: (keyword) => setSearchForm({
              ...searchForm,
              keyword
            }),
            children: templates2 == null ? void 0 : templates2.map((tpl) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: tpl.name }, tpl.id))
          }
        ) }),
        templates2.length > 0 ? expandedTemplateIds.length < templates2.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "default",
            size: "sm",
            onPress: () => setExpandedTemplateIds(templates2.map((tpl) => tpl.id.toString())),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(BiExpandVertical, { className: "text-base" }),
              t2("Expand all")
            ]
          }
        ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { color: "default", size: "sm", onPress: () => setExpandedTemplateIds([]), children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BiCollapseVertical, { className: "text-base" }),
          t2("Collapse all")
        ] }) : null
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "default",
          size: "sm",
          onPress: () => {
            createPortal(ImportModal, {
              onImported: async () => {
                await loadProperties();
                await loadTemplates();
              }
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$z, {}),
            t2("Import a template")
          ]
        }
      ) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 grow", children: templates2.length == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 w-full h-full justify-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(PiEmpty, { className: "text-2xl" }),
      t2(
        "No templates found. You can create a template or import one from a share code."
      )
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      accordion_default,
      {
        className: "px-0",
        selectedKeys: expandedTemplateIds,
        variant: "splitted",
        onSelectionChange: (keys2) => {
          const ids2 = Array.from(keys2).map((k2) => k2);
          setExpandedTemplateIds(ids2);
        },
        children: filteredTemplates.map((tpl) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            accordion_item_base_default,
            {
              id: tpl.id.toString(),
              title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "", size: "sm", variant: "flat", children: [
                    "#",
                    tpl.id
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold", children: tpl.name }),
                  tpl.author && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: tpl.author }),
                  tpl.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tpl.description, placement: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        let { name: name2, author, description } = tpl;
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Edit template"),
                          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              input_default,
                              {
                                isRequired: true,
                                defaultValue: name2,
                                label: t2("Name"),
                                placeholder: t2("Enter template name"),
                                onValueChange: (v2) => {
                                  name2 = v2;
                                }
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              input_default,
                              {
                                defaultValue: author,
                                label: `${t2("Author")}${t2("(optional)")}`,
                                placeholder: t2("Enter author name"),
                                onValueChange: (v2) => {
                                  author = v2;
                                }
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              textarea_default,
                              {
                                defaultValue: description,
                                label: `${t2("Description")}${t2("(optional)")}`,
                                placeholder: t2("Enter description"),
                                onValueChange: (v2) => {
                                  description = v2;
                                }
                              }
                            )
                          ] }),
                          size: "lg",
                          onOk: async () => {
                            tpl.name = name2;
                            tpl.author = author;
                            tpl.description = description;
                            await putTemplate(tpl);
                            forceUpdate();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-base" })
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-60", variant: "light", children: tpl.createdAt }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      size: "sm",
                      variant: "light",
                      onPress: async () => {
                        const r2 = await BApi$1.mediaLibraryTemplate.getMediaLibraryTemplateShareCode(
                          tpl.id
                        );
                        if (!r2.code && r2.data) {
                          const shareText = r2.data;
                          await navigator.clipboard.writeText(shareText);
                          createPortal(Modal, {
                            defaultVisible: true,
                            title: t2("Share code has been copied"),
                            children: t2(
                              "Share code has been copied to your clipboard, you can send it to your friends. (ctrl+v)"
                            ),
                            footer: {
                              actions: ["ok"],
                              okProps: {
                                children: t2("I got it")
                              }
                            }
                          });
                        }
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(GoShareAndroid, { className: "text-large" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "default",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Duplicate current template"),
                          // children: (
                          //
                          // ),
                          onOk: async () => {
                            const r2 = await BApi$1.mediaLibraryTemplate.duplicateMediaLibraryTemplate(
                              tpl.id
                            );
                            if (!r2.code) {
                              loadTemplates();
                            }
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(IoDuplicateOutline, { className: "text-base" })
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onPress: () => {
                        createPortal(Modal, {
                          defaultVisible: true,
                          title: t2("Deleting template {{name}}", {
                            name: tpl.name
                          }),
                          children: t2(
                            "This action cannot be undone. Are you sure you want to delete this template?"
                          ),
                          onOk: async () => {
                            const r2 = await BApi$1.mediaLibraryTemplate.deleteMediaLibraryTemplate(
                              tpl.id
                            );
                            if (!r2.code) {
                              loadTemplates();
                            }
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdDeleteOutline, { className: "text-large" })
                    }
                  )
                ] })
              ] }),
              children: propertyMap && enhancers && templates2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Template,
                {
                  enhancersCache: enhancers,
                  propertyMapCache: propertyMap,
                  template: tpl,
                  templatesCache: templates2,
                  onChange: async () => {
                    await loadTemplate(tpl.id);
                  }
                }
              )
            },
            tpl.id
          );
        })
      }
    ) })
  ] });
};
MediaLibraryTemplatePage.displayName = "MediaLibraryTemplatePage";
const TypeConversionExampleDialog = () => {
  const { t: t2 } = useTranslation();
  const [results, setResults] = reactExports.useState([]);
  const columns = [
    // <TableColumn>{t<string>('typeConversion.sourceType')}</TableColumn>,
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("typeConversion.valueToBeConverted") }),
    ...propertyTypes.map((cpt) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2(getEnumKey("PropertyType", PropertyType[cpt.value])) });
    })
  ];
  reactExports.useEffect(() => {
    BApi$1.customProperty.testCustomPropertyTypeConversion().then((r2) => {
      var _a2;
      setResults(((_a2 = r2.data) == null ? void 0 : _a2.results) ?? []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          children: t2("common.action.close")
        }
      },
      size: "full",
      title: t2("typeConversion.examplesTitle"),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { isVertical: true, disableAnimation: true, disabledKeys: ["title"], children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("typeConversion.sourceType") }, "title"),
        propertyTypes.map((cpt) => {
          const filteredResults = (results == null ? void 0 : results.filter((x2) => x2.type == cpt.value)) || [];
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tab,
            {
              className: "w-full",
              title: t2(getEnumKey("PropertyType", PropertyType[cpt.value])),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, isHeaderSticky: true, isStriped: true, removeWrapper: true, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: columns }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: filteredResults.map((td2, i2) => {
                  const cells = [
                    // <TableCell>{t<string>(PropertyType[td.type])}</TableCell>,
                    /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      StandardValueRenderer,
                      {
                        propertyType: td2.type,
                        type: td2.bizValueType,
                        value: deserializeStandardValue(
                          td2.serializedBizValue ?? null,
                          td2.bizValueType
                        ),
                        variant: "default"
                      }
                    ) })
                  ];
                  propertyTypes.forEach((type4) => {
                    var _a2, _b2;
                    const o2 = (_b2 = (_a2 = filteredResults == null ? void 0 : filteredResults[i2]) == null ? void 0 : _a2.outputs) == null ? void 0 : _b2.find(
                      (o22) => o22.type == type4.value
                    );
                    if (o2) {
                      const deserializedValue = deserializeStandardValue(
                        o2.serializedBizValue ?? null,
                        o2.bizValueType
                      );
                      console.log(o2, deserializedValue);
                      cells.push(
                        /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          StandardValueRenderer,
                          {
                            propertyType: type4.value,
                            type: o2.bizValueType,
                            value: deserializedValue,
                            variant: "default"
                          }
                        ) })
                      );
                    } else {
                      cells.push(/* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: "/" }));
                    }
                  });
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(table_row_default, { children: cells }, i2);
                }) })
              ] })
            },
            cpt.value
          );
        })
      ] }) })
    }
  );
};
TypeConversionExampleDialog.displayName = "TypeConversionExampleDialog";
const TypeConversionRuleOverviewDialog = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [rules2, setRules] = reactExports.useState();
  const columns = [
    // <TableColumn>{t<string>('typeConversion.sourceType')}</TableColumn>,
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("typeConversion.targetType") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("typeConversion.rules") })
  ];
  reactExports.useEffect(() => {
    BApi$1.customProperty.getCustomPropertyConversionRules().then((r2) => {
      setRules(r2.data);
    });
  }, []);
  const renderRows = (fromType) => {
    if (!rules2) {
      return [];
    }
    const targetMap = rules2[fromType];
    if (!targetMap) {
      return [];
    }
    const rows = [];
    Object.keys(targetMap).forEach((toTypeStr) => {
      const toType = parseInt(toTypeStr, 10);
      const rules22 = targetMap[toType];
      rows.push(
        /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2(getEnumKey("PropertyType", PropertyType[toType])) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: rules22.map((r2) => {
            if (r2.description == null) {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: r2.name });
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: r2.description }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              r2.name,
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-sm" })
            ] }) }) });
          }) }) })
        ] }, fromType)
      );
    });
    return rows;
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"],
        cancelProps: {
          children: t2("common.action.close")
        }
      },
      size: "xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        t2("typeConversion.title"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "light",
            onClick: () => {
              createPortal(TypeConversionExampleDialog, {});
            },
            children: t2("typeConversion.checkExamples")
          }
        )
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { isVertical: true, disableAnimation: true, disabledKeys: ["title"], children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("typeConversion.sourceType") }, "title"),
        propertyTypes.map((cpt) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            Tab,
            {
              className: "w-full",
              title: t2(getEnumKey("PropertyType", PropertyType[cpt.value])),
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, isHeaderSticky: true, isStriped: true, removeWrapper: true, children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: columns }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: renderRows(cpt.value) })
              ] })
            },
            cpt.value
          );
        })
      ] }) })
    }
  );
};
TypeConversionRuleOverviewDialog.displayName = "TypeConversionRuleOverviewDialog";
const CustomPropertyPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [properties2, setProperties] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const loadProperties = async () => {
    const rsp = await BApi$1.customProperty.getAllCustomProperties({
      additionalItems: CustomPropertyAdditionalItem.Category | CustomPropertyAdditionalItem.ValueCount
    });
    setProperties((rsp.data || []).sort((a2, b2) => a2.order - b2.order));
  };
  reactExports.useEffect(() => {
    loadProperties();
  }, []);
  const filteredProperties = properties2.filter(
    (p2) => keyword == void 0 || keyword.length == 0 || p2.name.toLowerCase().includes(keyword.toLowerCase())
  );
  const groupedFilteredProperties = filteredProperties.reduce(
    (s2, t22) => {
      var _a2;
      (s2[_a2 = t22.type] ?? (s2[_a2] = [])).push(t22);
      return s2;
    },
    {}
  );
  console.log("[CustomProperty] render", groupedFilteredProperties);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              createPortal(PropertyModal, {
                onSaved: loadProperties
              });
            },
            children: t2("common.action.add")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
            value: keyword,
            onValueChange: (v2) => setKeyword(v2)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(TypeConversionRuleOverviewDialog, {});
            },
            children: t2("customProperty.action.checkTypeConversionRules")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "default",
            size: "sm",
            variant: "light",
            onPress: async () => {
              createPortal(CustomPropertySortModal, {
                properties: properties2,
                onDestroyed: loadProperties
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$b, { className: "text-base" }),
              t2("customProperty.action.adjustDisplayOrders")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", {})
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4 grid-cols-1 lg:grid-cols-2 xl:grid-cols-3", children: Object.keys(groupedFilteredProperties).map((k2) => {
      const ps = groupedFilteredProperties[k2].sort(
        (a2, b2) => a2.order - b2.order
      );
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "rounded-lg border border-default-200 bg-content1 overflow-hidden",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-4 py-3 bg-default-100 border-b border-default-200", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { textVariant: "default", type: ps[0].type }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-500 text-sm", children: [
                "(",
                ps.length,
                ")"
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: ps.map((p2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                V2,
                {
                  editable: true,
                  hidePool: true,
                  hideType: true,
                  removable: true,
                  property: p2,
                  onDialogDestroyed: loadProperties,
                  onRemoved: () => {
                    loadProperties();
                  },
                  onSaved: loadProperties
                },
                p2.id
              );
            }) }) })
          ]
        },
        k2
      );
    }) })
  ] });
};
CustomPropertyPage.displayName = "CustomPropertyPage";
const ExtensionGroupPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [groups, setGroups] = reactExports.useState([]);
  const [editingGroup, setEditingGroup] = reactExports.useState(
    void 0
  );
  const [editingExtensionsText, setEditingExtensionsText] = reactExports.useState("");
  reactExports.useEffect(() => {
    BApi$1.extensionGroup.getAllExtensionGroups().then((r2) => {
      setGroups(r2.data || []);
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Modal,
      {
        title: t2("extensionGroup.action.editGroup"),
        visible: !!editingGroup,
        onClose: () => setEditingGroup(void 0),
        onOk: async () => {
          let r2;
          if (editingGroup.id == 0) {
            r2 = await BApi$1.extensionGroup.addExtensionGroup(editingGroup);
            if (!r2.code) {
              groups.push(editingGroup);
            }
          } else {
            r2 = await BApi$1.extensionGroup.putExtensionGroup(
              editingGroup.id,
              editingGroup
            );
            groups.splice(
              groups.findIndex((x2) => x2 == editingGroup),
              1,
              editingGroup
            );
          }
          if (r2.code) {
            Vt.error(r2.message);
            throw new Error(r2.message);
          }
          setEditingGroup(void 0);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              isRequired: true,
              label: t2("common.label.name"),
              value: editingGroup == null ? void 0 : editingGroup.name,
              onValueChange: (v2) => {
                setEditingGroup({
                  ...editingGroup,
                  name: v2
                });
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                fullWidth: true,
                label: t2("extensionGroup.label.extensions"),
                minRows: 4,
                placeholder: t2("extensionGroup.input.separatePlaceholder"),
                value: editingExtensionsText,
                onValueChange: (v2) => {
                  setEditingExtensionsText(v2);
                  setEditingGroup({
                    ...editingGroup,
                    extensions: extractExtensions(v2)
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex flex-wrap gap-1", children: editingGroup == null ? void 0 : editingGroup.extensions.map((ext, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: ext });
            }) })
          ] })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        onPress: () => {
          setEditingExtensionsText("");
          setEditingGroup({
            id: 0,
            name: "",
            extensions: []
          });
        },
        children: t2("extensionGroup.action.addGroup")
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, className: "mt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.name") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("extensionGroup.label.extensions") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: groups.map((eg2, i2) => {
        var _a2;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: eg2.name }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (_a2 = eg2.extensions) == null ? void 0 : _a2.map((ext, j2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                isCloseable: true,
                size: "sm",
                variant: "flat",
                onClose: async () => {
                  var _a3;
                  (_a3 = eg2.extensions) == null ? void 0 : _a3.splice(j2, 1);
                  await BApi$1.extensionGroup.putExtensionGroup(
                    eg2.id,
                    eg2
                  );
                  setGroups([...groups]);
                },
                children: ext
              }
            );
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: () => {
                  setEditingExtensionsText(eg2.extensions.join(" "));
                  setEditingGroup(JSON.parse(JSON.stringify(eg2)));
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("extensionGroup.confirm.deleteTitle"),
                    children: t2("common.confirm.irreversibleWarning"),
                    onOk: async () => {
                      await BApi$1.extensionGroup.deleteExtensionGroup(
                        eg2.id
                      );
                      groups.splice(i2, 1);
                      setGroups(groups.slice());
                    }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
              }
            )
          ] }) })
        ] });
      }) })
    ] })
  ] });
};
ExtensionGroupPage.displayName = "ExtensionGroupPage";
function extractExtensions(text2) {
  const extensions = text2.replace(/\n/g, " ").split(" ").map((x2) => x2.trim().replace(/^\.+|\.+$/g, "")).filter((x2) => x2.length > 0).map((x2) => `.${x2}`);
  return Array.from(new Set(extensions));
}
const validate$a = (operation, options) => {
  if (operation == BulkModificationStringProcessOperation.Delete) {
    return;
  }
  if (!options) {
    return "bulkModification.validation.optionsRequired";
  }
  const {
    value: value2,
    count,
    index: index2,
    isPositioningDirectionReversed,
    isOperationDirectionReversed,
    find: find2
  } = options;
  switch (operation) {
    case BulkModificationStringProcessOperation.SetWithFixedValue:
    case BulkModificationStringProcessOperation.AddToStart:
    case BulkModificationStringProcessOperation.AddToEnd:
      if (!value2) {
        return "bulkModification.validation.valueRequired";
      }
      break;
    case BulkModificationStringProcessOperation.AddToAnyPosition:
      if (index2 == void 0 || index2 < 0 || !value2) {
        return "bulkModification.validation.valueAndIndexRequired";
      }
      break;
    case BulkModificationStringProcessOperation.RemoveFromStart:
    case BulkModificationStringProcessOperation.RemoveFromEnd:
      if (count == void 0 || count < 0) {
        return "bulkModification.validation.countRequired";
      }
      break;
    case BulkModificationStringProcessOperation.RemoveFromAnyPosition:
      if (count == void 0 || count < 0 || index2 == void 0 || index2 < 0) {
        return "bulkModification.validation.countAndIndexRequired";
      }
      break;
    case BulkModificationStringProcessOperation.ReplaceFromStart:
    case BulkModificationStringProcessOperation.ReplaceFromEnd:
    case BulkModificationStringProcessOperation.ReplaceFromAnyPosition:
    case BulkModificationStringProcessOperation.ReplaceWithRegex:
      if (!(find2 != void 0 && find2.length > 0) || !value2) {
        return "bulkModification.validation.findAndReplaceRequired";
      }
      break;
  }
  return;
};
const log$b = buildLogger("BulkModificationProcessValueDemonstrator");
const Demonstrator$9 = ({ variables, value: value2 }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  log$b(value2, variables);
  if (!value2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Chip,
      {
        isDisabled: true,
        size: "sm",
        radius: "sm",
        children: t2("No set")
      }
    );
  }
  switch (value2.type) {
    case BulkModificationProcessorValueType.ManuallyInput:
      if (!value2.property) {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { isDisabled: true, color: "danger", radius: "sm", size: "sm", children: t2("Unable to get property information") });
      }
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        PropertyValueRenderer,
        {
          bizValue: value2.followPropertyChanges ? void 0 : value2.value,
          dbValue: value2.followPropertyChanges ? value2.value : void 0,
          property: value2.property
        }
      );
    case BulkModificationProcessorValueType.Variable:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", radius: "sm", size: "sm", variant: "flat", children: t2(
          `BulkModificationProcessorValueType.${BulkModificationProcessorValueType[value2.type]}`
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: (_a2 = variables == null ? void 0 : variables.find((v2) => v2.key === value2.value)) == null ? void 0 : _a2.name })
      ] });
  }
};
Demonstrator$9.displayName = "Demonstrator";
const TypeMismatchTip = (props) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { toType, fromType } = props;
  if (toType == fromType) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
          "bulkModification.info.typeConversion",
          {
            fromType: t2(`PropertyType.${PropertyType[fromType]}`),
            toType: t2(`PropertyType.${PropertyType[toType]}`)
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(TypeConversionRuleOverviewDialog, {});
            },
            children: t2("bulkModification.info.checkTypeRules")
          }
        ) })
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Chip,
        {
          className: "ml-2",
          classNames: {
            content: "flex items-center gap-1"
          },
          color: "warning",
          radius: "sm",
          size: "sm",
          variant: "light",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, { className: "text-base" }),
            t2("bulkModification.label.typeTransformation")
          ]
        }
      )
    }
  );
};
TypeMismatchTip.displayName = "TypeMismatchTip";
const log$a = buildLogger("BulkModificationProcessValueEditor");
const Editor$9 = (props) => {
  const {
    onChange,
    variables,
    value: propsValue,
    baseValueType,
    preferredProperty,
    availableValueTypes
  } = props;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [propertyTypesForManuallySettingValue, setPropertyTypesForManuallySettingValue] = reactExports.useState([]);
  const [value2, setValue] = reactExports.useState(
    propsValue ?? {
      type: (availableValueTypes == null ? void 0 : availableValueTypes[0]) ?? BulkModificationProcessorValueType.ManuallyInput
    }
  );
  const valueRef = reactExports.useRef(value2);
  reactExports.useEffect(() => {
    valueRef.current = value2;
  }, [value2]);
  log$a(value2, preferredProperty, propertyTypesForManuallySettingValue);
  reactExports.useEffect(() => {
    BApi$1.property.getAvailablePropertyTypesForManuallySettingValue().then((r2) => {
      const pvs = r2.data || [];
      setPropertyTypesForManuallySettingValue(pvs);
    });
  }, []);
  const changeValue = reactExports.useCallback(
    (patches, triggerOnChange = true) => {
      var _a2, _b2, _c2;
      const nv = {
        ...valueRef.current,
        ...patches
      };
      switch (nv.type) {
        case BulkModificationProcessorValueType.ManuallyInput: {
          nv.editorPropertyType ?? (nv.editorPropertyType = (preferredProperty == null ? void 0 : preferredProperty.type) ?? ((_a2 = propertyTypesForManuallySettingValue == null ? void 0 : propertyTypesForManuallySettingValue[0]) == null ? void 0 : _a2.type) ?? baseValueType);
          if (!nv.property) {
            const pv = propertyTypesForManuallySettingValue.find(
              (pt) => pt.type == nv.editorPropertyType
            );
            const property2 = ((_b2 = pv == null ? void 0 : pv.properties) == null ? void 0 : _b2.find((p2) => p2.id == nv.propertyId && p2.pool == nv.propertyPool)) ?? (preferredProperty == null ? void 0 : preferredProperty.type) == nv.editorPropertyType ? preferredProperty : (_c2 = pv == null ? void 0 : pv.properties) == null ? void 0 : _c2[0];
            if (property2) {
              nv.property = property2;
              nv.propertyId = property2.id;
              nv.propertyPool = property2.pool;
            }
          }
          break;
        }
        case BulkModificationProcessorValueType.Variable: {
          break;
        }
      }
      setValue(nv);
      if (triggerOnChange) {
        onChange == null ? void 0 : onChange(nv);
      }
    },
    [preferredProperty, propertyTypesForManuallySettingValue, baseValueType, onChange]
  );
  reactExports.useEffect(() => {
    changeValue(valueRef.current, false);
  }, [changeValue, propertyTypesForManuallySettingValue]);
  const onFollowPropertyChanges = async (follow) => {
    var _a2, _b2;
    const { property: property2 } = value2;
    if (!property2) {
      return;
    }
    if (value2.value) {
      if (!value2.followPropertyChanges && follow) {
        value2.value = deserializeStandardValue(
          ((_a2 = await BApi$1.property.getPropertyDbValue(property2.pool, property2.id, {
            bizValue: value2.value
          })) == null ? void 0 : _a2.data) ?? null,
          property2.dbValueType
        );
      } else {
        if (value2.followPropertyChanges && !follow) {
          value2.value = deserializeStandardValue(
            ((_b2 = await BApi$1.property.getPropertyBizValue(property2.pool, property2.id, {
              dbValue: value2.value
            })) == null ? void 0 : _b2.data) ?? null,
            property2.bizValueType
          );
        }
      }
    }
    value2.followPropertyChanges = follow;
    changeValue({ ...value2 });
  };
  const valueTypes2 = availableValueTypes ?? bulkModificationProcessorValueTypes.map((x2) => x2.value);
  const currentPropertyTypeInfo = propertyTypesForManuallySettingValue.find(
    (pt) => pt.type == value2.editorPropertyType
  );
  const isReferenceType = (currentPropertyTypeInfo == null ? void 0 : currentPropertyTypeInfo.isReferenceValueType) ?? false;
  const openPropertySelector = () => {
    if (!(currentPropertyTypeInfo == null ? void 0 : currentPropertyTypeInfo.properties))
      return;
    const validPropertyIds = new Set(
      currentPropertyTypeInfo.properties.map((p2) => `${p2.pool}-${p2.id}`)
    );
    createPortal(PropertySelector, {
      v2: true,
      pool: 1 | 2 | 4,
      // All pools
      multiple: false,
      types: value2.editorPropertyType ? [value2.editorPropertyType] : void 0,
      selection: value2.propertyId && value2.propertyPool ? [{ id: value2.propertyId, pool: value2.propertyPool }] : void 0,
      isDisabled: (p2) => !validPropertyIds.has(`${p2.pool}-${p2.id}`),
      onSubmit: async (selectedProperties) => {
        const prop = selectedProperties[0];
        if (prop) {
          changeValue({
            propertyPool: prop.pool,
            propertyId: prop.id,
            property: prop,
            value: void 0,
            followPropertyChanges: currentPropertyTypeInfo == null ? void 0 : currentPropertyTypeInfo.isReferenceValueType
          });
        }
      }
    });
  };
  const getSelectedType = () => {
    var _a2;
    switch (value2.type) {
      case BulkModificationProcessorValueType.ManuallyInput:
        return value2.editorPropertyType;
      case BulkModificationProcessorValueType.Variable:
        return (_a2 = variables == null ? void 0 : variables.find((v2) => v2.key == value2.value)) == null ? void 0 : _a2.property.type;
    }
  };
  const selectedType = getSelectedType();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    valueTypes2.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
      radio_group_default,
      {
        label: t2("bulkModification.valueSource.label"),
        orientation: "horizontal",
        value: String(value2.type),
        onValueChange: (v2) => {
          const type4 = parseInt(v2, 10);
          changeValue({ type: type4 });
        },
        children: [
          valueTypes2.includes(BulkModificationProcessorValueType.ManuallyInput) && /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(BulkModificationProcessorValueType.ManuallyInput), children: t2("bulkModification.valueType.manuallyInput") }),
          valueTypes2.includes(BulkModificationProcessorValueType.Variable) && /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(BulkModificationProcessorValueType.Variable), children: t2("bulkModification.valueType.variable") })
        ]
      }
    ),
    value2.type === BulkModificationProcessorValueType.ManuallyInput ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "max-w-xs",
          label: t2("bulkModification.valueType.label"),
          dataSource: propertyTypesForManuallySettingValue.map((pt) => ({
            label: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              t2(`PropertyType.${PropertyType[pt.type]}`),
              !pt.isAvailable && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  className: "max-w-[400px]",
                  color: "warning",
                  content: pt.unavailableReason,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-base" })
                }
              )
            ] }),
            textValue: t2(`PropertyType.${PropertyType[pt.type]}`),
            value: String(pt.type),
            isDisabled: !pt.isAvailable
          })),
          selectedKeys: value2.editorPropertyType ? [value2.editorPropertyType.toString()] : [],
          selectionMode: "single",
          onSelectionChange: (keys2) => {
            const editorPropertyType = parseInt(
              Array.from(keys2)[0],
              10
            );
            changeValue({
              editorPropertyType,
              property: void 0,
              propertyId: void 0,
              propertyPool: void 0,
              value: void 0,
              followPropertyChanges: void 0
            });
          }
        }
      ),
      selectedType && /* @__PURE__ */ jsxRuntimeExports.jsx(TypeMismatchTip, { fromType: selectedType, toType: baseValueType })
    ] }) : !variables || variables.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("bulkModification.label.noVariablesAvailable") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          className: "max-w-xs",
          isRequired: true,
          label: t2("bulkModification.select.variable"),
          dataSource: variables.map((v2) => ({
            label: v2.name,
            value: v2.key
          })),
          placeholder: t2("bulkModification.select.variable"),
          selectedKeys: value2.value ? [value2.value] : [],
          selectionMode: "single",
          onSelectionChange: (keys2) => {
            const key = Array.from(keys2)[0];
            changeValue({
              value: key,
              editorPropertyType: void 0,
              property: void 0,
              propertyId: void 0,
              propertyPool: void 0,
              followPropertyChanges: void 0
            });
          }
        }
      ),
      selectedType && /* @__PURE__ */ jsxRuntimeExports.jsx(TypeMismatchTip, { fromType: selectedType, toType: baseValueType })
    ] }),
    value2.type === BulkModificationProcessorValueType.ManuallyInput && isReferenceType && (currentPropertyTypeInfo == null ? void 0 : currentPropertyTypeInfo.isAvailable) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("bulkModification.dataSource.label") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "bordered", onPress: openPropertySelector, children: value2.property ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { showPool: true, property: value2.property }) : t2("bulkModification.dataSource.clickToSelect") }),
      value2.property && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          color: "secondary",
          content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 max-w-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("bulkModification.label.followPropertyChangesDescription1") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("bulkModification.label.followPropertyChangesDescription2") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("bulkModification.label.followPropertyChangesDescription3") })
          ] }),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              defaultSelected: true,
              isSelected: value2.followPropertyChanges,
              onValueChange: onFollowPropertyChanges,
              children: t2("bulkModification.label.followPropertyChanges")
            }
          )
        }
      )
    ] }),
    value2.type === BulkModificationProcessorValueType.ManuallyInput && value2.property && (currentPropertyTypeInfo == null ? void 0 : currentPropertyTypeInfo.isAvailable) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("bulkModification.label.setValue") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        PropertyValueRenderer,
        {
          bizValue: value2.followPropertyChanges ? void 0 : value2.value,
          dbValue: value2.followPropertyChanges ? value2.value : void 0,
          isEditing: true,
          property: value2.property,
          variant: "light",
          onValueChange: (dv, bv) => {
            changeValue({
              value: value2.followPropertyChanges ? dv : bv
            });
          },
          size: "sm"
        }
      )
    ] })
  ] });
};
Editor$9.displayName = "Editor";
const I18NKeyMap = {
  operation: {
    backward: "Backward",
    forward: "Forward"
  },
  positioning: {
    backward: "Position.End",
    forward: "Position.Beginning"
  }
};
const DirectionSelector = ({ isReversed, onChange, subject }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      color: "secondary",
      variant: "light",
      onClick: () => {
        onChange == null ? void 0 : onChange(!isReversed);
      },
      children: t2(
        isReversed ? I18NKeyMap[subject]["backward"] : I18NKeyMap[subject]["forward"]
      )
    }
  );
};
DirectionSelector.displayName = "DirectionSelector";
const log$9 = buildLogger("StringProcessorEditor");
const Editor$8 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationStringProcessOperation.SetWithFixedValue
  );
  log$9("operation", operation, "options", options, typeof operation);
  reactExports.useEffect(() => {
    const error2 = validate$a(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    const newOptions = {};
    setOptions2(newOptions);
  };
  const renderValueCell = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor$9,
      {
        availableValueTypes,
        baseValueType: propertyType,
        value: options.value,
        variables,
        onChange: (value2) => {
          changeOptions({ value: value2 });
        }
      }
    );
  };
  const renderSubOptions = (options2) => {
    log$9("renderOptions", operation, options2);
    if (!operation) {
      return null;
    }
    const components2 = [];
    switch (operation) {
      case BulkModificationStringProcessOperation.SetWithFixedValue:
        components2.push({
          label: "",
          comp: renderValueCell()
        });
        break;
      case BulkModificationStringProcessOperation.Delete:
        break;
      case BulkModificationStringProcessOperation.AddToStart:
      case BulkModificationStringProcessOperation.AddToEnd:
        components2.push({
          label: "",
          comp: renderValueCell()
        });
        break;
      case BulkModificationStringProcessOperation.AddToAnyPosition:
        components2.push({
          label: "",
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "BulkModification.Processor.Editor.Operation.AddToAnyPosition",
              values: {
                value: options2.value
              },
              children: [
                "Add ",
                renderValueCell(),
                " to the ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    placeholder: t2("bulkModification.label.startsFromZero"),
                    style: { width: 100 },
                    value: options2.index,
                    onValueChange: (index2) => changeOptions({ index: index2 })
                  }
                ),
                "(th) character from ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "positioning",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                )
              ]
            }
          ) })
        });
        break;
      case BulkModificationStringProcessOperation.RemoveFromStart:
      case BulkModificationStringProcessOperation.RemoveFromEnd:
        components2.push({
          label: "",
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx(
            number_input_default,
            {
              className: "w-auto",
              label: t2("bulkModification.label.count"),
              style: { width: 100 },
              value: options2.count,
              onValueChange: (count) => changeOptions({ count })
            }
          )
        });
        break;
      case BulkModificationStringProcessOperation.RemoveFromAnyPosition:
        components2.push({
          label: "",
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Trans,
            {
              i18nKey: "BulkModification.Processor.Editor.Operation.RemoveFromAnyPosition",
              values: {
                value: options2.value
              },
              children: [
                "Delete ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    style: { width: 100 },
                    value: options2.count,
                    onValueChange: (count) => changeOptions({ count })
                  }
                ),
                " characters ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "operation",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                ),
                "from the  ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  number_input_default,
                  {
                    className: "w-auto",
                    placeholder: t2("bulkModification.label.startsFromZero"),
                    style: { width: 100 },
                    value: options2.index,
                    onValueChange: (index2) => changeOptions({ index: index2 })
                  }
                ),
                "(th) charater from ",
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DirectionSelector,
                  {
                    isReversed: options2.isPositioningDirectionReversed,
                    subject: "positioning",
                    onChange: (v2) => changeOptions({ isPositioningDirectionReversed: v2 })
                  }
                )
              ]
            }
          ) })
        });
        break;
      case BulkModificationStringProcessOperation.ReplaceFromStart:
      case BulkModificationStringProcessOperation.ReplaceFromEnd:
      case BulkModificationStringProcessOperation.ReplaceFromAnyPosition:
      case BulkModificationStringProcessOperation.ReplaceWithRegex:
        components2.push({
          label: "",
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 whitespace-nowrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "BulkModification.Processor.Editor.Operation.Replace", children: [
            "Replace ",
            /* @__PURE__ */ jsxRuntimeExports.jsx(input_default, { value: options2.find, onValueChange: (find2) => changeOptions({ find: find2 }) }),
            " with ",
            renderValueCell()
          ] }) })
        });
        break;
    }
    return components2.map((c2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      c2.label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: c2.label }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.comp })
    ] }, i2));
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationStringProcessOperations.map((tpo) => ({
          label: t2(getEnumKey("BulkModificationStringProcessOperation", tpo.label)),
          value: tpo.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(
              Array.from(keys2 || [])[0],
              10
            )
          );
        }
      }
    ),
    renderSubOptions(options)
  ] });
};
Editor$8.displayName = "Editor";
const log$8 = buildLogger("StringValueProcessDemonstrator");
const Demonstrator$8 = (props) => {
  const { operation, options, variables } = props;
  const { t: t2 } = useTranslation();
  log$8(props);
  switch (operation) {
    case TextProcessingOperation.SetWithFixedValue: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "BulkModification.Processor.Demonstrator.Operation.SetDirectly", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary" }),
          "with fixed value"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables })
      ] });
    }
    case TextProcessingOperation.AddToStart:
    case TextProcessingOperation.AddToEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd",
          values: {
            direction: operation == TextProcessingOperation.AddToStart ? t2("bulkModification.position.beginning") : t2("bulkModification.position.end"),
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables }),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      );
    case TextProcessingOperation.AddToAnyPosition:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition",
          values: {
            direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("bulkModification.position.end") : t2("bulkModification.position.beginning"),
            position: options == null ? void 0 : options.index,
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables }),
            "to the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.index }),
            "position from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "end" })
          ]
        }
      );
    case TextProcessingOperation.RemoveFromStart:
    case TextProcessingOperation.RemoveFromEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd",
          values: {
            direction: operation == TextProcessingOperation.RemoveFromStart ? t2("bulkModification.position.beginning") : t2("bulkModification.position.end"),
            count: options == null ? void 0 : options.count
          },
          children: [
            "Remove",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: options == null ? void 0 : options.count }),
            "characters from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      ) });
    case TextProcessingOperation.RemoveFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("bulkModification.position.end") : t2("bulkModification.position.beginning"),
        position: options == null ? void 0 : options.index,
        count: options == null ? void 0 : options.count,
        removeDirection: (options == null ? void 0 : options.isOperationDirectionReversed) ? t2("bulkModification.textOperation.backward") : t2("bulkModification.textOperation.forward")
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition",
          values: texts,
          children: [
            "Delete",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.count }),
            "characters",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.removeDirection }),
            "the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.position }),
            "character from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case TextProcessingOperation.ReplaceFromStart:
    case TextProcessingOperation.ReplaceFromEnd: {
      const texts = {
        direction: operation == TextProcessingOperation.ReplaceFromEnd ? t2("bulkModification.position.end") : t2("bulkModification.position.beginning"),
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables }),
            "from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case TextProcessingOperation.ReplaceFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("end") : t2("start"),
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "BulkModification.Processor.Demonstrator.Operation.Replace", values: texts, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
        "with",
        /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables })
      ] });
    }
    case TextProcessingOperation.ReplaceWithRegex: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex",
          values: {
            find: options == null ? void 0 : options.find
          },
          children: [
            "Use",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "regex" }),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options == null ? void 0 : options.value, variables })
          ]
        }
      );
    }
    case TextProcessingOperation.Delete: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: t2("common.action.delete") });
    }
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("bulkModification.error.unsupportedValue") });
  }
};
Demonstrator$8.displayName = "Demonstrator";
const validate$9 = (operation, options) => {
  if (operation == BulkModificationListStringProcessOperation.Delete) {
    return;
  }
  if (!options) {
    return "bulkModification.validation.optionsRequired";
  }
  const { value: value2, valueType, isOperationDirectionReversed, modifyOptions } = options;
  switch (operation) {
    case BulkModificationListStringProcessOperation.SetWithFixedValue:
    case BulkModificationListStringProcessOperation.Append:
    case BulkModificationListStringProcessOperation.Prepend:
      if (!value2) {
        return "bulkModification.validation.valueRequired";
      }
      break;
    case BulkModificationListStringProcessOperation.Modify:
      if (modifyOptions == void 0) {
        return "bulkModification.validation.modifyOptionsRequired";
      }
      if (modifyOptions.filterBy != BulkModificationProcessorOptionsItemsFilterBy.All && (modifyOptions.filterValue == void 0 || modifyOptions.filterValue.length == 0)) {
        return "bulkModification.validation.filterValueRequired";
      }
      if (modifyOptions.operation == void 0) {
        return "bulkModification.validation.operationRequired";
      }
      return validate$a(
        modifyOptions.operation,
        modifyOptions.options
      );
  }
  return;
};
const log$7 = buildLogger("ListProcessorEditor");
const Editor$7 = ({
  property: property2,
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationListStringProcessOperation.SetWithFixedValue
  );
  log$7("operation", operation, "options", options, typeof operation);
  reactExports.useEffect(() => {
    const error2 = validate$9(operation, options);
    onChange == null ? void 0 : onChange(
      operation,
      options,
      error2 == void 0 ? void 0 : t2(error2)
    );
  }, [options, operation]);
  const changeOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    setOptions2(newOptions);
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    const newOptions = {};
    setOptions2(newOptions);
  };
  const renderValueCell = (field = "value") => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Editor$9,
      {
        baseValueType: property2.type,
        preferredProperty: property2,
        value: options[field],
        variables,
        onChange: (value2) => changeOptions({
          value: value2
        })
      }
    );
  };
  const renderSubOptions = (options2) => {
    var _a2, _b2, _c2;
    log$7("renderOptions", operation, options2);
    if (!operation) {
      return null;
    }
    const components2 = [];
    switch (operation) {
      case BulkModificationListStringProcessOperation.SetWithFixedValue:
      case BulkModificationListStringProcessOperation.Append:
      case BulkModificationListStringProcessOperation.Prepend:
        components2.push({
          label: "",
          comp: renderValueCell()
        });
        break;
      case BulkModificationListStringProcessOperation.Modify: {
        const filterBy = (_a2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _a2.filterBy;
        components2.push({
          label: t2("bulkModification.filter.filterBy"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-2/5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Select,
              {
                dataSource: bulkModificationProcessorOptionsItemsFilterBies.map((fb2) => ({
                  label: t2(getEnumKey("BulkModificationProcessorOptionsItemsFilterBy", fb2.label)),
                  value: fb2.value
                })),
                selectionMode: "single",
                onSelectionChange: (keys2) => {
                  changeOptions({
                    modifyOptions: {
                      ...options2 == null ? void 0 : options2.modifyOptions,
                      filterBy: parseInt(
                        Array.from(keys2 || [])[0],
                        10
                      )
                    }
                  });
                }
              }
            ) }),
            filterBy != void 0 && (() => {
              switch (filterBy) {
                case BulkModificationProcessorOptionsItemsFilterBy.All:
                  return null;
                case BulkModificationProcessorOptionsItemsFilterBy.Containing:
                case BulkModificationProcessorOptionsItemsFilterBy.Matching:
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      placeholder: t2(
                        filterBy == BulkModificationProcessorOptionsItemsFilterBy.Containing ? "bulkModification.placeholder.inputKeyword" : "bulkModification.placeholder.inputRegex"
                      ),
                      onValueChange: (v2) => {
                        changeOptions({
                          modifyOptions: {
                            ...options2 == null ? void 0 : options2.modifyOptions,
                            filterValue: v2
                          }
                        });
                      }
                    }
                  );
              }
            })()
          ] })
        });
        components2.push({
          label: t2("bulkModification.filter.forEachItem"),
          comp: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Editor$8,
            {
              availableValueTypes,
              operation: (_b2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _b2.operation,
              propertyType: PropertyType.SingleLineText,
              options: (_c2 = options2 == null ? void 0 : options2.modifyOptions) == null ? void 0 : _c2.options,
              variables,
              onChange: (sOperation, sOptions, error2) => {
                changeOptions({
                  modifyOptions: {
                    ...options2 == null ? void 0 : options2.modifyOptions,
                    operation: sOperation,
                    options: sOptions
                  }
                });
              }
            }
          )
        });
        break;
      }
      case BulkModificationListStringProcessOperation.Delete:
        break;
    }
    return components2.map((c2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      c2.label && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: c2.label }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c2.comp })
    ] }, i2));
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationListStringProcessOperations.map((tpo) => ({
          label: t2(getEnumKey("BulkModificationListStringProcessOperation", tpo.label)),
          value: tpo.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(
              Array.from(keys2 || [])[0],
              10
            )
          );
        }
      }
    ),
    renderSubOptions(options)
  ] });
};
Editor$7.displayName = "Editor";
const log$6 = buildLogger("ListStringValueProcess");
const Demonstrator$7 = (props) => {
  const { operation, options, variables, property: property2 } = props;
  const { t: t2 } = useTranslation();
  log$6(props);
  switch (operation) {
    case BulkModificationListStringProcessOperation.SetWithFixedValue: {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "BulkModification.Processor.Demonstrator.Operation.SetDirectly", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary" }),
          "with fixed value"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$9,
          {
            property: property2,
            value: options == null ? void 0 : options.value,
            valueType: options == null ? void 0 : options.valueType,
            variables
          }
        )
      ] });
    }
    case BulkModificationListStringProcessOperation.AddToStart:
    case BulkModificationListStringProcessOperation.AddToEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToStartOrEnd",
          values: {
            direction: operation == BulkModificationListStringProcessOperation.AddToStart ? t2("Position.Beginning") : t2("Position.End"),
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$9,
              {
                property: property2,
                value: options == null ? void 0 : options.value,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      );
    case BulkModificationListStringProcessOperation.AddToAnyPosition:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.AddToAnyPosition",
          values: {
            direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
            position: options == null ? void 0 : options.index,
            value: options == null ? void 0 : options.value
          },
          children: [
            "Add",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$9,
              {
                property: property2,
                value: options == null ? void 0 : options.value,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "to the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: options == null ? void 0 : options.index }),
            "position from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "end" })
          ]
        }
      );
    case BulkModificationListStringProcessOperation.RemoveFromStart:
    case BulkModificationListStringProcessOperation.RemoveFromEnd:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromStartOrEnd",
          values: {
            direction: operation == BulkModificationListStringProcessOperation.RemoveFromStart ? t2("Position.Beginning") : t2("Position.End"),
            count: options == null ? void 0 : options.count
          },
          children: [
            "Remove",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: options == null ? void 0 : options.count }),
            "characters from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: "beginning or end" })
          ]
        }
      ) });
    case BulkModificationListStringProcessOperation.RemoveFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("Position.End") : t2("Position.Beginning"),
        position: options == null ? void 0 : options.index,
        count: options == null ? void 0 : options.count,
        removeDirection: (options == null ? void 0 : options.isOperationDirectionReversed) ? t2("TextOperation.Backward") : t2("TextOperation.Forward")
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.RemoveFromAnyPosition",
          values: texts,
          children: [
            "Delete",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.count }),
            "characters",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.removeDirection }),
            "the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "secondary", children: texts.position }),
            "character from the",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case BulkModificationListStringProcessOperation.ReplaceFromStart:
    case BulkModificationListStringProcessOperation.ReplaceFromEnd: {
      const texts = {
        direction: operation == BulkModificationListStringProcessOperation.ReplaceFromEnd ? t2("Position.End") : t2("Position.Beginning"),
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceFromStartOrEnd",
          values: texts,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$9,
              {
                property: property2,
                value: options == null ? void 0 : options.replace,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            ),
            "from",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: texts.direction })
          ]
        }
      ) });
    }
    case BulkModificationListStringProcessOperation.ReplaceFromAnyPosition: {
      const texts = {
        direction: (options == null ? void 0 : options.isPositioningDirectionReversed) ? t2("end") : t2("start"),
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(Trans, { i18nKey: "BulkModification.Processor.Demonstrator.Operation.Replace", values: texts, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "Replace" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
        "with",
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$9,
          {
            property: property2,
            value: options == null ? void 0 : options.replace,
            valueType: options == null ? void 0 : options.valueType,
            variables
          }
        )
      ] });
    }
    case BulkModificationListStringProcessOperation.ReplaceWithRegex: {
      const texts = {
        replace: options == null ? void 0 : options.replace,
        find: options == null ? void 0 : options.find
      };
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Trans,
        {
          i18nKey: "BulkModification.Processor.Demonstrator.Operation.ReplaceWithRegex",
          values: texts,
          children: [
            "Use",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "regex" }),
            "to",
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: "replace" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "secondary", children: texts.find }),
            "with",
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Demonstrator$9,
              {
                property: property2,
                value: options == null ? void 0 : options.replace,
                valueType: options == null ? void 0 : options.valueType,
                variables
              }
            )
          ]
        }
      );
    }
    case BulkModificationListStringProcessOperation.Delete: {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "primary", children: t2("Delete") });
    }
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("Unsupported value") });
  }
};
Demonstrator$7.displayName = "Demonstrator";
const validate$8 = (operation, options) => {
  switch (operation) {
    case BulkModificationDecimalProcessOperation.Delete:
    case BulkModificationDecimalProcessOperation.Ceil:
    case BulkModificationDecimalProcessOperation.Floor:
      return void 0;
    case BulkModificationDecimalProcessOperation.SetWithFixedValue:
    case BulkModificationDecimalProcessOperation.Add:
    case BulkModificationDecimalProcessOperation.Subtract:
    case BulkModificationDecimalProcessOperation.Multiply:
    case BulkModificationDecimalProcessOperation.Divide:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    case BulkModificationDecimalProcessOperation.Round:
      if (options.decimalPlaces === void 0 || options.decimalPlaces < 0) {
        return "bulkModification.validation.decimalPlacesRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor$6 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationDecimalProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$8(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationDecimalProcessOperation.Delete:
      case BulkModificationDecimalProcessOperation.Ceil:
      case BulkModificationDecimalProcessOperation.Floor:
        return null;
      case BulkModificationDecimalProcessOperation.SetWithFixedValue:
      case BulkModificationDecimalProcessOperation.Add:
      case BulkModificationDecimalProcessOperation.Subtract:
      case BulkModificationDecimalProcessOperation.Multiply:
      case BulkModificationDecimalProcessOperation.Divide:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      case BulkModificationDecimalProcessOperation.Round:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          number_input_default,
          {
            label: t2("bulkModification.label.decimalPlaces"),
            min: 0,
            value: options.decimalPlaces,
            onValueChange: (decimalPlaces) => changeOptions({ decimalPlaces })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationDecimalProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationDecimalProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$6.displayName = "DecimalValueProcessEditor";
const Demonstrator$6 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  const renderValue = () => {
    if (!(options == null ? void 0 : options.value))
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables });
  };
  switch (operation) {
    case BulkModificationDecimalProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.decimal.delete") });
    case BulkModificationDecimalProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.decimal.setWithFixedValue"),
        ": ",
        renderValue()
      ] });
    case BulkModificationDecimalProcessOperation.Add:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        renderValue()
      ] });
    case BulkModificationDecimalProcessOperation.Subtract:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        renderValue()
      ] });
    case BulkModificationDecimalProcessOperation.Multiply:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "× ",
        renderValue()
      ] });
    case BulkModificationDecimalProcessOperation.Divide:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "÷ ",
        renderValue()
      ] });
    case BulkModificationDecimalProcessOperation.Round:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.decimal.round"),
        " (",
        (options == null ? void 0 : options.decimalPlaces) ?? 0,
        ")"
      ] });
    case BulkModificationDecimalProcessOperation.Ceil:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("bulkModification.operation.decimal.ceil") });
    case BulkModificationDecimalProcessOperation.Floor:
      return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("bulkModification.operation.decimal.floor") });
    default:
      return null;
  }
};
Demonstrator$6.displayName = "DecimalValueProcessDemonstrator";
const validate$7 = (operation, options) => {
  switch (operation) {
    case BulkModificationBooleanProcessOperation.Delete:
    case BulkModificationBooleanProcessOperation.Toggle:
      return void 0;
    case BulkModificationBooleanProcessOperation.SetWithFixedValue:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor$5 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationBooleanProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$7(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationBooleanProcessOperation.Delete:
      case BulkModificationBooleanProcessOperation.Toggle:
        return null;
      case BulkModificationBooleanProcessOperation.SetWithFixedValue:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationBooleanProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationBooleanProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$5.displayName = "BooleanValueProcessEditor";
const Demonstrator$5 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case BulkModificationBooleanProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.boolean.delete") });
    case BulkModificationBooleanProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.boolean.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationBooleanProcessOperation.Toggle:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", children: t2("bulkModification.operation.boolean.toggle") });
    default:
      return null;
  }
};
Demonstrator$5.displayName = "BooleanValueProcessDemonstrator";
const validate$6 = (operation, options) => {
  switch (operation) {
    case BulkModificationDateTimeProcessOperation.Delete:
    case BulkModificationDateTimeProcessOperation.SetToNow:
      return void 0;
    case BulkModificationDateTimeProcessOperation.SetWithFixedValue:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    case BulkModificationDateTimeProcessOperation.AddDays:
    case BulkModificationDateTimeProcessOperation.SubtractDays:
    case BulkModificationDateTimeProcessOperation.AddMonths:
    case BulkModificationDateTimeProcessOperation.SubtractMonths:
    case BulkModificationDateTimeProcessOperation.AddYears:
    case BulkModificationDateTimeProcessOperation.SubtractYears:
      if (options.amount === void 0 || options.amount < 0) {
        return "bulkModification.validation.amountRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor$4 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationDateTimeProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$6(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationDateTimeProcessOperation.Delete:
      case BulkModificationDateTimeProcessOperation.SetToNow:
        return null;
      case BulkModificationDateTimeProcessOperation.SetWithFixedValue:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      case BulkModificationDateTimeProcessOperation.AddDays:
      case BulkModificationDateTimeProcessOperation.SubtractDays:
      case BulkModificationDateTimeProcessOperation.AddMonths:
      case BulkModificationDateTimeProcessOperation.SubtractMonths:
      case BulkModificationDateTimeProcessOperation.AddYears:
      case BulkModificationDateTimeProcessOperation.SubtractYears:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          number_input_default,
          {
            label: t2("bulkModification.label.amount"),
            min: 0,
            value: options.amount,
            onValueChange: (amount) => changeOptions({ amount })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationDateTimeProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationDateTimeProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$4.displayName = "DateTimeValueProcessEditor";
const Demonstrator$4 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case BulkModificationDateTimeProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.dateTime.delete") });
    case BulkModificationDateTimeProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.dateTime.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationDateTimeProcessOperation.AddDays:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.days")
      ] });
    case BulkModificationDateTimeProcessOperation.SubtractDays:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.days")
      ] });
    case BulkModificationDateTimeProcessOperation.AddMonths:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.months")
      ] });
    case BulkModificationDateTimeProcessOperation.SubtractMonths:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.months")
      ] });
    case BulkModificationDateTimeProcessOperation.AddYears:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.years")
      ] });
    case BulkModificationDateTimeProcessOperation.SubtractYears:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.years")
      ] });
    case BulkModificationDateTimeProcessOperation.SetToNow:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", children: t2("bulkModification.operation.dateTime.setToNow") });
    default:
      return null;
  }
};
Demonstrator$4.displayName = "DateTimeValueProcessDemonstrator";
const validate$5 = (operation, options) => {
  switch (operation) {
    case BulkModificationTimeProcessOperation.Delete:
      return void 0;
    case BulkModificationTimeProcessOperation.SetWithFixedValue:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    case BulkModificationTimeProcessOperation.AddHours:
    case BulkModificationTimeProcessOperation.SubtractHours:
    case BulkModificationTimeProcessOperation.AddMinutes:
    case BulkModificationTimeProcessOperation.SubtractMinutes:
    case BulkModificationTimeProcessOperation.AddSeconds:
    case BulkModificationTimeProcessOperation.SubtractSeconds:
      if (options.amount === void 0 || options.amount < 0) {
        return "bulkModification.validation.amountRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor$3 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationTimeProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$5(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationTimeProcessOperation.Delete:
        return null;
      case BulkModificationTimeProcessOperation.SetWithFixedValue:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      case BulkModificationTimeProcessOperation.AddHours:
      case BulkModificationTimeProcessOperation.SubtractHours:
      case BulkModificationTimeProcessOperation.AddMinutes:
      case BulkModificationTimeProcessOperation.SubtractMinutes:
      case BulkModificationTimeProcessOperation.AddSeconds:
      case BulkModificationTimeProcessOperation.SubtractSeconds:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          number_input_default,
          {
            label: t2("bulkModification.label.amount"),
            min: 0,
            value: options.amount,
            onValueChange: (amount) => changeOptions({ amount })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationTimeProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationTimeProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$3.displayName = "TimeValueProcessEditor";
const Demonstrator$3 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case BulkModificationTimeProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.time.delete") });
    case BulkModificationTimeProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.time.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationTimeProcessOperation.AddHours:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.hours")
      ] });
    case BulkModificationTimeProcessOperation.SubtractHours:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.hours")
      ] });
    case BulkModificationTimeProcessOperation.AddMinutes:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.minutes")
      ] });
    case BulkModificationTimeProcessOperation.SubtractMinutes:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.minutes")
      ] });
    case BulkModificationTimeProcessOperation.AddSeconds:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "+ ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.seconds")
      ] });
    case BulkModificationTimeProcessOperation.SubtractSeconds:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        "- ",
        options == null ? void 0 : options.amount,
        " ",
        t2("common.unit.seconds")
      ] });
    default:
      return null;
  }
};
Demonstrator$3.displayName = "TimeValueProcessDemonstrator";
const validate$4 = (operation, options) => {
  switch (operation) {
    case BulkModificationLinkProcessOperation.Delete:
      return void 0;
    case BulkModificationLinkProcessOperation.SetWithFixedValue:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    case BulkModificationLinkProcessOperation.SetText:
      if (!options.text) {
        return "bulkModification.validation.textRequired";
      }
      return void 0;
    case BulkModificationLinkProcessOperation.SetUrl:
      if (!options.url) {
        return "bulkModification.validation.urlRequired";
      }
      return void 0;
    case BulkModificationLinkProcessOperation.ModifyText:
    case BulkModificationLinkProcessOperation.ModifyUrl:
      if (options.stringOperation === void 0) {
        return "bulkModification.validation.stringOperationRequired";
      }
      return validate$a(options.stringOperation, options.stringOptions ?? {});
    default:
      return void 0;
  }
};
const Editor$2 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationLinkProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$4(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationLinkProcessOperation.Delete:
        return null;
      case BulkModificationLinkProcessOperation.SetWithFixedValue:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      case BulkModificationLinkProcessOperation.SetText:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("bulkModification.label.text") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Editor$9,
            {
              availableValueTypes,
              baseValueType: PropertyType.SingleLineText,
              value: options.text,
              variables,
              onChange: (text2) => changeOptions({ text: text2 })
            }
          )
        ] });
      case BulkModificationLinkProcessOperation.SetUrl:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("bulkModification.label.url") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Editor$9,
            {
              availableValueTypes,
              baseValueType: PropertyType.SingleLineText,
              value: options.url,
              variables,
              onChange: (url2) => changeOptions({ url: url2 })
            }
          )
        ] });
      case BulkModificationLinkProcessOperation.ModifyText:
      case BulkModificationLinkProcessOperation.ModifyUrl:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("bulkModification.label.stringOperation") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Editor$8,
            {
              availableValueTypes,
              operation: options.stringOperation,
              options: options.stringOptions,
              propertyType: PropertyType.SingleLineText,
              variables,
              onChange: (stringOperation, stringOptions) => {
                changeOptions({ stringOperation, stringOptions });
              }
            }
          )
        ] });
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationLinkProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationLinkProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$2.displayName = "LinkValueProcessEditor";
const Demonstrator$2 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case bulkModification.operation.link.delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.link.delete") });
    case bulkModification.operation.link.setWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.link.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case bulkModification.operation.link.setText:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.link.setText"),
        ":",
        " ",
        (options == null ? void 0 : options.text) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.text, variables })
      ] });
    case bulkModification.operation.link.setUrl:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.link.setUrl"),
        ":",
        " ",
        (options == null ? void 0 : options.url) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.url, variables })
      ] });
    case bulkModification.operation.link.modifyText:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.link.modifyText"),
        ":",
        " ",
        (options == null ? void 0 : options.stringOperation) !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$8,
          {
            operation: options.stringOperation,
            options: options.stringOptions,
            variables
          }
        )
      ] });
    case bulkModification.operation.link.modifyUrl:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.link.modifyUrl"),
        ":",
        " ",
        (options == null ? void 0 : options.stringOperation) !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Demonstrator$8,
          {
            operation: options.stringOperation,
            options: options.stringOptions,
            variables
          }
        )
      ] });
    default:
      return null;
  }
};
Demonstrator$2.displayName = "LinkValueProcessDemonstrator";
const validate$3 = (operation, options) => {
  switch (operation) {
    case BulkModificationListListStringProcessOperation.Delete:
      return void 0;
    case BulkModificationListListStringProcessOperation.SetWithFixedValue:
    case BulkModificationListListStringProcessOperation.Append:
    case BulkModificationListListStringProcessOperation.Prepend:
    case BulkModificationListListStringProcessOperation.Remove:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor$1 = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationListListStringProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$3(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationListListStringProcessOperation.Delete:
        return null;
      case BulkModificationListListStringProcessOperation.SetWithFixedValue:
      case BulkModificationListListStringProcessOperation.Append:
      case BulkModificationListListStringProcessOperation.Prepend:
      case BulkModificationListListStringProcessOperation.Remove:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationListListStringProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationListListStringProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor$1.displayName = "ListListStringValueProcessEditor";
const Demonstrator$1 = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case BulkModificationListListStringProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.listListString.delete") });
    case BulkModificationListListStringProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listListString.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListListStringProcessOperation.Append:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listListString.append"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListListStringProcessOperation.Prepend:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listListString.prepend"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListListStringProcessOperation.Remove:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listListString.remove"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    default:
      return null;
  }
};
Demonstrator$1.displayName = "ListListStringValueProcessDemonstrator";
const validate$2 = (operation, options) => {
  switch (operation) {
    case BulkModificationListTagProcessOperation.Delete:
      return void 0;
    case BulkModificationListTagProcessOperation.SetWithFixedValue:
    case BulkModificationListTagProcessOperation.Append:
    case BulkModificationListTagProcessOperation.Prepend:
    case BulkModificationListTagProcessOperation.Remove:
      if (!options.value) {
        return "bulkModification.validation.valueRequired";
      }
      return void 0;
    default:
      return void 0;
  }
};
const Editor = ({
  operation: propsOperation,
  options: propsOptions,
  onChange,
  variables,
  availableValueTypes,
  propertyType
}) => {
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propsOptions ?? {});
  const [operation, setOperation] = reactExports.useState(
    propsOperation ?? BulkModificationListTagProcessOperation.SetWithFixedValue
  );
  reactExports.useEffect(() => {
    const error2 = validate$2(operation, options);
    onChange == null ? void 0 : onChange(operation, options, error2 == void 0 ? void 0 : t2(error2));
  }, [options, operation]);
  const changeOptions = (patches) => {
    setOptions2({ ...options, ...patches });
  };
  const changeOperation = (newOperation) => {
    setOperation(newOperation);
    setOptions2({});
  };
  const renderSubOptions = () => {
    switch (operation) {
      case BulkModificationListTagProcessOperation.Delete:
        return null;
      case BulkModificationListTagProcessOperation.SetWithFixedValue:
      case BulkModificationListTagProcessOperation.Append:
      case BulkModificationListTagProcessOperation.Prepend:
      case BulkModificationListTagProcessOperation.Remove:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$9,
          {
            availableValueTypes,
            baseValueType: propertyType,
            value: options.value,
            variables,
            onChange: (value2) => changeOptions({ value: value2 })
          }
        );
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        label: t2("bulkModification.label.operation"),
        dataSource: bulkModificationListTagProcessOperations.map((op) => ({
          label: t2(getEnumKey("BulkModificationListTagProcessOperation", op.label)),
          value: op.value
        })),
        selectedKeys: operation == void 0 ? void 0 : [operation.toString()],
        selectionMode: "single",
        onSelectionChange: (keys2) => {
          changeOperation(
            parseInt(Array.from(keys2 || [])[0], 10)
          );
        }
      }
    ),
    renderSubOptions()
  ] });
};
Editor.displayName = "ListTagValueProcessEditor";
const Demonstrator = ({ operation, options, variables }) => {
  const { t: t2 } = useTranslation();
  switch (operation) {
    case BulkModificationListTagProcessOperation.Delete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "danger", size: "sm", children: t2("bulkModification.operation.listTag.delete") });
    case BulkModificationListTagProcessOperation.SetWithFixedValue:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listTag.setWithFixedValue"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListTagProcessOperation.Append:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listTag.append"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListTagProcessOperation.Prepend:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listTag.prepend"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    case BulkModificationListTagProcessOperation.Remove:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
        t2("bulkModification.operation.listTag.remove"),
        ":",
        " ",
        (options == null ? void 0 : options.value) && /* @__PURE__ */ jsxRuntimeExports.jsx(Demonstrator$9, { value: options.value, variables })
      ] });
    default:
      return null;
  }
};
Demonstrator.displayName = "ListTagValueProcessDemonstrator";
const StepDemonstrator = ({ property: property2, step, variables }) => {
  const { t: t2 } = useTranslation();
  switch (property2.type) {
    case PropertyType.SingleLineText:
    case PropertyType.MultilineText:
    case PropertyType.Formula:
    case PropertyType.SingleChoice:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$8,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.MultipleChoice:
    case PropertyType.Attachment:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$7,
        {
          operation: step.operation,
          options: step.options,
          property: property2,
          variables
        }
      );
    case PropertyType.Number:
    case PropertyType.Percentage:
    case PropertyType.Rating:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$6,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Boolean:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$5,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Link:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$2,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Date:
    case PropertyType.DateTime:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$4,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Time:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$3,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Multilevel:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator$1,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    case PropertyType.Tags:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Demonstrator,
        {
          operation: step.operation,
          options: step.options,
          variables
        }
      );
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: t2("bulkModification.empty.notSupported") });
  }
};
StepDemonstrator.displayName = "StepDemonstrator";
const log$5 = buildLogger("ProcessStepModal");
const ProcessStepModal = ({
  property: property2,
  operation: propsOperation,
  options: propsOptions,
  onDestroyed,
  onSubmit,
  variables,
  availableValueTypes = [BulkModificationProcessorValueType.ManuallyInput],
  isPreprocess = false
}) => {
  const { t: t2 } = useTranslation();
  const [operation, setOperation] = reactExports.useState(propsOperation);
  const [options, setOptions2] = reactExports.useState(propsOptions);
  const [error2, setError] = reactExports.useState();
  log$5("property", property2, "operation", operation, "options", options);
  const renderOptions = () => {
    switch (property2.type) {
      case PropertyType.SingleLineText:
      case PropertyType.MultilineText:
      case PropertyType.Formula:
      case PropertyType.SingleChoice:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$8,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.MultipleChoice:
      case PropertyType.Attachment:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$7,
          {
            availableValueTypes,
            operation,
            options,
            property: property2,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Number:
      case PropertyType.Percentage:
      case PropertyType.Rating:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$6,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Boolean:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$5,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Link:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$2,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Date:
      case PropertyType.DateTime:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$4,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Time:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$3,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Multilevel:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor$1,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      case PropertyType.Tags:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Editor,
          {
            availableValueTypes,
            operation,
            options,
            propertyType: property2.type,
            variables,
            onChange: (operation2, options2, error22) => {
              setOperation(operation2);
              setOptions2(options2);
              setError(error22);
            }
          }
        );
      default:
        return t2("bulkModification.empty.notSupported");
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !!error2
        }
      },
      size: "xl",
      title: isPreprocess ? t2("bulkModification.title.preprocessForProperty", { property: property2.name }) : t2("bulkModification.title.processForProperty", { property: property2.name }),
      onDestroyed,
      onOk: () => {
        if (operation != void 0) {
          log$5("onSubmit", "operation", operation, "options", options);
          onSubmit == null ? void 0 : onSubmit(operation, options);
        }
      },
      children: [
        renderOptions(),
        error2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "whitespace-break-spaces text-danger", children: [
          t2("bulkModification.error.title"),
          ": ",
          t2(error2)
        ] })
      ]
    }
  );
};
ProcessStepModal.displayName = "ProcessStepModal";
const ProcessStep = ({
  no,
  step: propsStep,
  property: property2,
  onChange,
  variables,
  editable,
  availableValueTypes,
  onDelete
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [step, setStep] = reactExports.useState(propsStep);
  useUpdateEffect(() => {
    setStep(propsStep);
  }, [propsStep]);
  const renderDemonstrator = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(StepDemonstrator, { property: property2, step, variables });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: `flex items-center flex-wrap gap-1 ${editable ? "cursor-pointer hover:bg-[var(--bakaui-overlap-background)] rounded" : ""}`,
      onClick: editable ? () => {
        createPortal(ProcessStepModal, {
          property: property2,
          availableValueTypes,
          onSubmit: (operation, options) => {
            const newStep = {
              ...step,
              operation,
              options
            };
            setStep(newStep);
            onChange == null ? void 0 : onChange(newStep);
          },
          variables,
          operation: step.operation,
          options: step.options
        });
      } : void 0,
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: no }),
        renderDemonstrator(),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "min-w-fit px-2",
            color: "danger",
            size: "sm",
            variant: "light",
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("bulkModification.action.deleteStep"),
                children: t2("bulkModification.confirm.deleteStep"),
                onOk: async () => {
                  onDelete();
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
          }
        )
      ]
    }
  );
};
ProcessStep.displayName = "ProcessStep";
const validate$1 = (v2) => {
  if (!v2 || !v2.name || !v2.propertyId || !v2.propertyPool) {
    return false;
  }
  if (v2.propertyPool === PropertyPool.Internal) {
    return true;
  }
  return v2.scope !== void 0;
};
const log$4 = buildLogger("VariableModal");
const VariableModal = ({ variable: propsVariable, onDestroyed, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bmInternals = useBulkModificationInternalsStore.getState();
  const [variable, setVariable] = reactExports.useState(propsVariable ?? {});
  useUpdateEffect(() => {
    setVariable(propsVariable ?? {});
  }, [propsVariable]);
  log$4(variable, propertyValueScopes);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: !validate$1(variable)
        }
      },
      size: "xl",
      title: (variable == null ? void 0 : variable.property) ? t2("bulkModification.title.preprocessForProperty", { property: variable.property.name }) : t2("bulkModification.label.settingVariable"),
      onDestroyed,
      onOk: () => {
        if (!validate$1(variable)) {
          throw new Error("Invalid variable");
        }
        const finalVariable = {
          ...variable,
          scope: variable.propertyPool === PropertyPool.Internal ? PropertyValueScope.Manual : variable.scope
        };
        onChange == null ? void 0 : onChange(finalVariable);
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: t2("bulkModification.label.property") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "flat",
                onClick: () => {
                  createPortal(PropertySelector, {
                    v2: true,
                    pool: PropertyPool.All,
                    multiple: false,
                    selection: (variable == null ? void 0 : variable.property) ? [
                      {
                        pool: variable.property.pool,
                        id: variable.property.id
                      }
                    ] : void 0,
                    isDisabled: (p2) => {
                      var _a2;
                      return !((_a2 = bmInternals.supportedStandardValueTypes) == null ? void 0 : _a2.includes(p2.bizValueType));
                    },
                    onSubmit: async (ps) => {
                      const p2 = ps[0];
                      setVariable({
                        ...variable,
                        propertyPool: p2.pool,
                        propertyId: p2.id,
                        property: p2,
                        // Auto-set scope to Default for Internal properties
                        scope: p2.pool === PropertyPool.Internal ? PropertyValueScope.Manual : variable == null ? void 0 : variable.scope
                      });
                    }
                  });
                },
                children: (variable == null ? void 0 : variable.property) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { showPool: true, property: variable.property }) : t2("bulkModification.select.property")
              }
            )
          ] }),
          (variable == null ? void 0 : variable.propertyPool) !== PropertyPool.Internal && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              disallowEmptySelection: true,
              dataSource: propertyValueScopes.map((s2) => ({
                label: t2(`PropertyValueScope.${s2.label}`),
                value: s2.value
              })),
              description: t2("bulkModification.label.scopeDescription"),
              label: t2("bulkModification.label.scope"),
              placeholder: t2("bulkModification.select.scope"),
              selectedKeys: (variable == null ? void 0 : variable.scope) == void 0 ? void 0 : [variable.scope.toString()],
              selectionMode: "single",
              size: "sm",
              onSelectionChange: (v2) => {
                const scope = Array.from(v2 ?? [])[0];
                setVariable({
                  ...variable,
                  scope
                });
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              isClearable: true,
              isRequired: true,
              label: t2("bulkModification.label.name"),
              placeholder: t2("bulkModification.input.setVariableName"),
              size: "sm",
              value: variable == null ? void 0 : variable.name,
              onValueChange: (v2) => {
                setVariable({
                  ...variable,
                  name: v2
                });
              }
            }
          )
        ] }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "flex-col items-start gap-0.5", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("bulkModification.label.preprocessing") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-400", children: t2("bulkModification.info.preprocessUsage") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            (variable == null ? void 0 : variable.preprocesses) && variable.preprocesses.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-2", children: variable.preprocesses.map((step, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                ProcessStep,
                {
                  editable: true,
                  no: i2 + 1,
                  property: variable.property,
                  step,
                  onChange: (newStep) => {
                    variable.preprocesses[i2] = newStep;
                    setVariable({
                      ...variable
                    });
                  },
                  onDelete: () => {
                    var _a2;
                    (_a2 = variable.preprocesses) == null ? void 0 : _a2.splice(i2, 1);
                    setVariable({
                      ...variable
                    });
                  }
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                isDisabled: !(variable == null ? void 0 : variable.property),
                size: "sm",
                variant: "ghost",
                onClick: () => {
                  if (variable == null ? void 0 : variable.property) {
                    createPortal(ProcessStepModal, {
                      property: variable.property,
                      isPreprocess: true,
                      onSubmit: (operation, options) => {
                        if (!variable.preprocesses) {
                          variable.preprocesses = [];
                        }
                        variable.preprocesses.push({
                          operation,
                          options
                        });
                        setVariable({
                          ...variable
                        });
                      }
                    });
                  }
                },
                children: t2("bulkModification.action.addPreprocess")
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
VariableModal.displayName = "VariableModal";
const Variables = ({ variables: propsVariable, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [variables, setVariables] = reactExports.useState(propsVariable ?? []);
  reactExports.useEffect(() => {
    setVariables(propsVariable ?? []);
  }, [propsVariable]);
  const renderVariable = (v2, index2) => {
    const hasPreprocesses = v2.preprocesses && v2.preprocesses.length > 0;
    const openEditModal = () => {
      createPortal(VariableModal, {
        variable: v2,
        onChange: (updatedVar) => {
          variables[index2] = updatedVar;
          const nvs = [...variables];
          setVariables(nvs);
          onChange == null ? void 0 : onChange(nvs);
        }
      });
    };
    const openDeleteModal = () => {
      createPortal(Modal, {
        defaultVisible: true,
        title: t2("bulkModification.action.deleteVariable"),
        children: t2("bulkModification.confirm.deleteVariable", {
          name: v2.name
        }),
        onOk: () => {
          const nvs = variables.filter((_24, idx) => idx != index2);
          setVariables(nvs);
          onChange == null ? void 0 : onChange(nvs);
        }
      });
    };
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      card_default,
      {
        isPressable: true,
        className: "cursor-pointer hover:bg-[var(--bakaui-overlap-background)]",
        radius: "sm",
        shadow: "none",
        onPress: openEditModal,
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "p-2 gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              isCloseable: true,
              radius: "sm",
              size: "sm",
              variant: "bordered",
              onClose: (e2) => {
                openDeleteModal();
              },
              children: v2.name
            }
          ) }),
          hasPreprocesses && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 pl-2", children: v2.preprocesses.map((step, stepIndex) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 flex-wrap", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: stepIndex + 1 }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(StepDemonstrator, { property: v2.property, step, variables })
          ] }, stepIndex)) })
        ] })
      }
    );
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bulk-modification-variables", children: [
    variables.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: variables.map((v2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(React$6.Fragment, { children: renderVariable(v2, i2) }, i2)) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "ghost",
        onPress: () => {
          createPortal(VariableModal, {
            onChange: (v2) => {
              const nvs = [...variables, v2];
              setVariables(nvs);
              onChange == null ? void 0 : onChange(nvs);
            }
          });
        },
        children: t2("common.action.add")
      }
    )
  ] });
};
Variables.displayName = "Variables";
const validate = (p2) => !(!p2 || !p2.propertyId || !p2.propertyPool);
const AllBulkModificationValueTypes = [
  BulkModificationProcessorValueType.ManuallyInput,
  BulkModificationProcessorValueType.Variable
];
const ProcessModal = ({ onDestroyed, process: propsProcess, onSubmit, variables }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bmInternals = useBulkModificationInternalsStore.getState();
  const [process2, setProcess] = reactExports.useState(propsProcess ?? {});
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          isDisabled: !validate(process2)
        }
      },
      size: "xl",
      title: (process2 == null ? void 0 : process2.property) ? t2("bulkModification.title.processForProperty", { property: process2.property.name }) : t2("bulkModification.label.settingProcess"),
      onDestroyed,
      onOk: () => {
        if (!validate(process2)) {
          throw new Error("Invalid process");
        }
        onSubmit == null ? void 0 : onSubmit(process2);
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid items-center gap-2", style: { gridTemplateColumns: "auto 1fr" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: t2("bulkModification.label.property") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => {
                createPortal(PropertySelector, {
                  v2: true,
                  pool: PropertyPool.All,
                  isDisabled: (p2) => {
                    var _a2, _b2, _c2;
                    return ((_b2 = (_a2 = bmInternals.disabledPropertyKeys) == null ? void 0 : _a2[p2.pool]) == null ? void 0 : _b2.includes(p2.id)) || !((_c2 = bmInternals.supportedStandardValueTypes) == null ? void 0 : _c2.includes(p2.bizValueType));
                  },
                  multiple: false,
                  onSubmit: async (ps) => {
                    const p2 = ps[0];
                    setProcess({
                      ...process2,
                      propertyPool: p2.pool,
                      propertyId: p2.id,
                      property: p2
                    });
                  }
                });
              },
              children: (process2 == null ? void 0 : process2.property) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { showPool: true, property: process2.property }) : t2("bulkModification.select.property")
            }
          ) })
        ] }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "flex-col items-start gap-0.5", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: t2("bulkModification.label.steps") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-400", children: t2("bulkModification.info.addProcessSteps") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            (process2 == null ? void 0 : process2.steps) && process2.steps.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 mb-2", children: process2.steps.map((step, i2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                ProcessStep,
                {
                  editable: true,
                  availableValueTypes: AllBulkModificationValueTypes,
                  no: `${i2 + 1}`,
                  property: process2.property,
                  step,
                  variables,
                  onChange: (newStep) => {
                    process2.steps[i2] = newStep;
                    setProcess({
                      ...process2
                    });
                  },
                  onDelete: () => {
                    var _a2;
                    (_a2 = process2.steps) == null ? void 0 : _a2.splice(i2, 1);
                    setProcess({
                      ...process2
                    });
                  }
                }
              );
            }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                isDisabled: !(process2 == null ? void 0 : process2.property),
                size: "sm",
                variant: "ghost",
                onClick: () => {
                  if (process2 == null ? void 0 : process2.property) {
                    createPortal(ProcessStepModal, {
                      property: process2.property,
                      variables,
                      availableValueTypes: AllBulkModificationValueTypes,
                      onSubmit: (operation, options) => {
                        if (!process2.steps) {
                          process2.steps = [];
                        }
                        process2.steps.push({
                          operation,
                          options
                        });
                        setProcess({
                          ...process2
                        });
                      }
                    });
                  }
                },
                children: t2("bulkModification.action.addStep")
              }
            ) })
          ] })
        ] })
      ]
    }
  );
};
ProcessModal.displayName = "ProcessModal";
const Processes = ({ processes: propsProcesses, onChange, variables }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [processes, setProcesses] = reactExports.useState(propsProcesses ?? []);
  reactExports.useEffect(() => {
    setProcesses(propsProcesses ?? []);
  }, [propsProcesses]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grow", children: [
    processes.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 mb-2", children: processes.map((process2, i2) => {
      var _a2, _b2;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        card_default,
        {
          isPressable: true,
          className: "cursor-pointer hover:bg-[var(--bakaui-overlap-background)]",
          radius: "sm",
          shadow: "none",
          onPress: () => {
            createPortal(ProcessModal, {
              process: process2,
              variables,
              onSubmit: (p2) => {
                processes[i2] = p2;
                const nps = [...processes];
                setProcesses(nps);
                onChange == null ? void 0 : onChange(nps);
              }
            });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "p-2 pb-0 gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", children: i2 + 1 }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 flex-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "secondary", radius: "sm", size: "sm", variant: "flat", children: (_a2 = process2.property) == null ? void 0 : _a2.poolName }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-small", children: "›" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", radius: "sm", size: "sm", variant: "light", children: (_b2 = process2.property) == null ? void 0 : _b2.name })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  className: "min-w-fit px-2",
                  color: "danger",
                  size: "sm",
                  variant: "light",
                  onPress: () => {
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("bulkModification.action.deleteProcess"),
                      children: t2("bulkModification.confirm.deleteProcess"),
                      onOk: async () => {
                        const nps = processes.filter((_24, j2) => j2 !== i2);
                        setProcesses(nps);
                        onChange == null ? void 0 : onChange(nps);
                      }
                    });
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
                }
              )
            ] }),
            process2.steps && process2.steps.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-1" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "p-2 pt-0 gap-1", children: process2.steps.map((step, j2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 flex-wrap", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { radius: "sm", size: "sm", variant: "flat", children: [
                  i2 + 1,
                  ".",
                  j2 + 1
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  StepDemonstrator,
                  {
                    property: process2.property,
                    step,
                    variables
                  }
                )
              ] }, j2)) })
            ] })
          ]
        },
        i2
      );
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "ghost",
        onPress: () => {
          createPortal(ProcessModal, {
            variables,
            onSubmit: (p2) => {
              const nps = [...processes, p2];
              setProcesses(nps);
              onChange == null ? void 0 : onChange(nps);
            }
          });
        },
        children: t2("common.action.add")
      }
    ) })
  ] });
};
Processes.displayName = "Processes";
const PageSize = 20;
const DiffsModal = ({ bmId, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [keyword, setKeyword] = reactExports.useState();
  const [pageable, setPageable] = reactExports.useState({
    page: 0,
    total: 0
  });
  const [data, setData] = reactExports.useState();
  reactExports.useEffect(() => {
    search2(void 0, 1);
  }, []);
  const TPagination = () => {
    if (pageable.total > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: pageable.page,
          size: "sm",
          total: pageable.total,
          onChange: (page) => {
            search2(keyword, page);
          }
        }
      ) });
    }
    return null;
  };
  const search2 = (keyword2, page) => {
    setPageable({
      ...pageable,
      page
    });
    BApi$1.bulkModification.searchBulkModificationDiffs(bmId, {
      path: keyword2,
      pageIndex: page,
      pageSize: PageSize
    }).then((r2) => {
      setData(r2.data || []);
      setPageable({
        ...pageable,
        total: Math.ceil(r2.totalCount / PageSize)
      });
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { defaultVisible: true, size: "xl", onDestroyed, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-8", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          endContent: /* @__PURE__ */ jsxRuntimeExports.jsx(kbd_default, { keys: ["enter"] }),
          placeholder: t2("common.action.search"),
          size: "sm",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-base" }),
          value: keyword,
          onKeyDown: (e2) => {
            if (e2.key == "Enter") {
              search2(keyword, 1);
            }
          },
          onValueChange: (e2) => setKeyword(e2)
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, {})
    ] }) }),
    data ? data.length == 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("bulkModification.empty.noData") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "1.",
        " ",
        t2("bulkModification.info.ensureCalculation")
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "2.",
        " ",
        t2("bulkModification.info.noResourcesToChange")
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        "3. ",
        t2("bulkModification.error.checkCriteria")
      ] })
    ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("bulkModification.label.resource") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("bulkModification.label.diffs") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: data.map((d2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-[600px] break-all", children: d2.resourcePath }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: d2.diffs.map((diff2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Chip,
                  {
                    color: "secondary",
                    size: "sm",
                    variant: "flat",
                    children: diff2.property.poolName
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", children: diff2.property.name })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PropertyValueRenderer,
                  {
                    bizValue: diff2.value1,
                    property: diff2.property
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$12, { className: "text-base" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PropertyValueRenderer,
                  {
                    bizValue: diff2.value2,
                    property: diff2.property
                  }
                )
              ] })
            ] });
          }) })
        ] });
      }) })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-12", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, {}) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(TPagination, {})
  ] });
};
DiffsModal.displayName = "DiffsModal";
const PAGE_SIZE = 50;
const ResourcesModal = ({ resourceIds, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [page, setPage] = reactExports.useState(1);
  const [resources, setResources] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const totalPages = Math.ceil(resourceIds.length / PAGE_SIZE);
  const loadResources = reactExports.useCallback(async (pageNum) => {
    const startIndex = (pageNum - 1) * PAGE_SIZE;
    const endIndex = startIndex + PAGE_SIZE;
    const pageIds = resourceIds.slice(startIndex, endIndex);
    if (pageIds.length === 0) {
      setResources([]);
      return;
    }
    setLoading(true);
    try {
      const rsp = await BApi$1.resource.getResourcesByKeys({
        ids: pageIds,
        additionalItems: ResourceAdditionalItem.All
      });
      setResources(rsp.data || []);
    } finally {
      setLoading(false);
    }
  }, [resourceIds]);
  reactExports.useEffect(() => {
    loadResources(page);
  }, [page, loadResources]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "7xl",
      title: t2("resourcesModal.title", { count: resourceIds.length }),
      onClose: onDestroyed,
      footer: null,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 min-h-[400px]", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : resources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center flex-1 text-default-400", children: t2("common.empty.noData") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          pagination_default,
          {
            page,
            total: totalPages,
            onChange: setPage
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-8 gap-2", children: resources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "flex flex-col gap-2 p-2 rounded-lg bg-default-50 hover:bg-default-100 transition-colors",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "aspect-[6/7] relative overflow-hidden rounded", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                ResourceCoverMemo,
                {
                  resource,
                  showBiggerOnHover: false
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium truncate", title: resource.displayName || resource.fileName, children: resource.displayName || resource.fileName })
            ]
          },
          resource.id
        )) }),
        totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          pagination_default,
          {
            page,
            total: totalPages,
            onChange: setPage
          }
        ) })
      ] }) })
    }
  );
};
ResourcesModal.displayName = "ResourcesModal";
const BlockConfigs = [
  { key: "Filters", i18nKey: "bulkModification.block.filters", tipKey: "bulkModification.tip.filters", stepNumber: 1 },
  { key: "Variables", i18nKey: "bulkModification.block.variables", tipKey: "bulkModification.tip.variables", stepNumber: 2 },
  { key: "Processes", i18nKey: "bulkModification.block.processes", tipKey: "bulkModification.tip.processes", stepNumber: 3 },
  { key: "Changes", i18nKey: "bulkModification.block.changes", tipKey: "bulkModification.tip.changes", stepNumber: 4 },
  { key: "FinalStep", i18nKey: "bulkModification.block.finalStep", stepNumber: 5 }
];
const BulkModification = ({ bm, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [calculatingDiffs, setCalculatingDiffs] = reactExports.useState(false);
  const [filtering, setFiltering] = reactExports.useState(false);
  const reload = reactExports.useCallback(async () => {
    const r2 = await BApi$1.bulkModification.getBulkModification(bm.id);
    onChange(r2.data);
  }, [onChange, bm.id]);
  const renderBlockContent = (blockKey) => {
    var _a2, _b2;
    switch (blockKey) {
      case "Filters":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            ResourceFilterController,
            {
              defaultFilterDisplayMode: FilterDisplayMode.Simple,
              autoCreateMediaLibraryFilter: true,
              group: (_a2 = bm.search) == null ? void 0 : _a2.group,
              onGroupChange: (group) => {
                var _a3;
                const updatedSearch = { ...bm.search, group };
                onChange({ ...bm, search: updatedSearch });
                BApi$1.bulkModification.patchBulkModification(bm.id, {
                  search: {
                    group,
                    tags: (_a3 = bm.search) == null ? void 0 : _a3.tags,
                    page: 1,
                    pageSize: 0
                  }
                });
              },
              tags: (_b2 = bm.search) == null ? void 0 : _b2.tags,
              onTagsChange: (tags) => {
                var _a3;
                const updatedSearch = { ...bm.search, tags };
                onChange({ ...bm, search: updatedSearch });
                BApi$1.bulkModification.patchBulkModification(bm.id, {
                  search: {
                    group: (_a3 = bm.search) == null ? void 0 : _a3.group,
                    tags,
                    page: 1,
                    pageSize: 0
                  }
                });
              },
              filterLayout: "vertical",
              showRecentFilters: true,
              showTags: true
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                isLoading: filtering,
                size: "sm",
                variant: "ghost",
                onPress: () => {
                  setFiltering(true);
                  BApi$1.bulkModification.filterResourcesInBulkModification(bm.id).then(() => {
                    reload();
                  }).finally(() => {
                    setFiltering(false);
                  });
                },
                children: t2(bm.filteredResourceIds && bm.filteredResourceIds.length > 0 ? "bulkModification.action.refilter" : "bulkModification.action.filter")
              }
            ),
            bm.filteredResourceIds && bm.filteredResourceIds.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: "flat",
                color: "success",
                onPress: () => {
                  createPortal(ResourcesModal, {
                    resourceIds: bm.filteredResourceIds
                  });
                },
                children: t2("bulkModification.action.viewFilteredResources", {
                  count: bm.filteredResourceIds.length
                })
              }
            )
          ] })
        ] });
      case "Variables":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Variables,
          {
            variables: bm.variables,
            onChange: (vs) => {
              onChange({ ...bm, variables: vs });
              BApi$1.bulkModification.patchBulkModification(bm.id, {
                variables: vs.map((v2) => ({
                  ...v2,
                  preprocesses: JSON.stringify(v2.preprocesses)
                }))
              });
            }
          }
        );
      case "Processes":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Processes,
          {
            processes: bm.processes,
            variables: bm.variables,
            onChange: (ps) => {
              onChange({ ...bm, processes: ps });
              BApi$1.bulkModification.patchBulkModification(bm.id, {
                processes: ps.map((v2) => ({
                  ...v2,
                  steps: JSON.stringify(v2.steps)
                }))
              });
            }
          }
        );
      case "Changes":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              isLoading: calculatingDiffs,
              size: "sm",
              variant: "bordered",
              onPress: () => {
                setCalculatingDiffs(true);
                BApi$1.bulkModification.previewBulkModification(bm.id).then(() => {
                  reload();
                }).finally(() => {
                  setCalculatingDiffs(false);
                });
              },
              children: t2("bulkModification.action.calculate")
            }
          ),
          bm.resourceDiffCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(DiffsModal, {
                  bmId: bm.id
                });
              },
              children: t2("bulkModification.action.checkDiffs", {
                count: bm.resourceDiffCount
              })
            }
          )
        ] });
      case "FinalStep":
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              isDisabled: !bm.processes || bm.processes.length === 0 || bm.resourceDiffCount === 0,
              size: "sm",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("bulkModification.action.apply"),
                  children: t2("bulkModification.confirm.apply"),
                  onOk: async () => {
                    await BApi$1.bulkModification.applyBulkModification(bm.id);
                    reload();
                  }
                });
              },
              children: t2("bulkModification.action.applyChanges")
            }
          ),
          bm.appliedAt && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "warning",
              size: "sm",
              variant: "flat",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("bulkModification.action.revert"),
                  children: t2("bulkModification.confirm.revert"),
                  onOk: async () => {
                    await BApi$1.bulkModification.revertBulkModification(bm.id);
                    reload();
                  }
                });
              },
              children: t2("bulkModification.action.revertChanges")
            }
          )
        ] });
      default:
        return null;
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: BlockConfigs.map((config2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "flex items-stretch gap-4 p-3 rounded-lg bg-default-50 hover:bg-default-100 transition-colors",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-7 h-7 rounded-full bg-primary/10 text-primary flex items-center justify-center text-sm font-medium", children: config2.stepNumber }),
          i2 < BlockConfigs.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineArrowDown, { className: "text-default-300 text-lg mt-2" })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-sm", children: t2(config2.i18nKey) }),
            config2.tipKey && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-400 mt-0.5", children: t2(config2.tipKey) })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: renderBlockContent(config2.key) })
        ] })
      ]
    },
    config2.key
  )) });
};
BulkModification.displayName = "BulkModification";
const TOTAL_SLIDES$2 = 5;
const BulkModificationGuideModal = ({ visible, onComplete }) => {
  const { t: t2 } = useTranslation();
  const carouselRef = reactExports.useRef(null);
  const [currentSlide, setCurrentSlide] = reactExports.useState(0);
  const isFirst = currentSlide === 0;
  const isLast = currentSlide === TOTAL_SLIDES$2 - 1;
  const handlePrev = () => {
    var _a2;
    (_a2 = carouselRef.current) == null ? void 0 : _a2.prev();
  };
  const handleNext = () => {
    var _a2;
    if (isLast) {
      onComplete();
    } else {
      (_a2 = carouselRef.current) == null ? void 0 : _a2.next();
    }
  };
  const handleSkip = () => {
    onComplete();
  };
  const handleSlideChange = (current) => {
    setCurrentSlide(current);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      hideCloseButton: true,
      classNames: {
        base: "max-w-[900px]"
      },
      footer: false,
      isDismissable: false,
      isKeyboardDismissDisabled: true,
      size: "4xl",
      visible,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Carousel, { ref: carouselRef, afterChange: handleSlideChange, dots: false, infinite: false, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdBatchPrediction, { className: "text-4xl text-primary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("bulkModificationGuide.welcome.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center max-w-lg", children: t2("bulkModificationGuide.welcome.description") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 py-2 rounded-lg bg-primary/5 border border-primary/20 max-w-lg w-full mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.welcome.highlight") }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-secondary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNodeIndex, { className: "text-4xl text-secondary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("bulkModificationGuide.workflow.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("bulkModificationGuide.workflow.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary font-bold text-sm", children: "1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.workflow.step1Title") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.workflow.step1Desc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary font-bold text-sm", children: "2" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.workflow.step2Title") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.workflow.step2Desc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning font-bold text-sm", children: "3" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.workflow.step3Title") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.workflow.step3Desc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "4" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.workflow.step4Title") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.workflow.step4Desc") })
                ] })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-warning/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-4xl text-warning" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("bulkModificationGuide.valueSources.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("bulkModificationGuide.valueSources.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-primary text-sm", children: t2("bulkModificationGuide.valueSources.fixedValue") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.valueSources.fixedValueDesc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFunction, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.valueSources.variable") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.valueSources.variableDesc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-danger/10 text-danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFilter, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("bulkModificationGuide.valueSources.delete") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500", children: t2("bulkModificationGuide.valueSources.deleteDesc") })
                ] })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-success/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNodeIndex, { className: "text-4xl text-success" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("bulkModificationGuide.pipeline.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("bulkModificationGuide.pipeline.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 py-2 rounded-lg bg-warning/5 border border-warning/20 max-w-lg w-full mb-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.pipeline.explanation") }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.pipeline.example1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "2" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.pipeline.example2") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "3" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.pipeline.example3") })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-4xl text-primary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("bulkModificationGuide.saveReuse.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("bulkModificationGuide.saveReuse.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary font-bold text-sm", children: "1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.saveReuse.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary font-bold text-sm", children: "2" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.saveReuse.point2") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary font-bold text-sm", children: "3" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.saveReuse.point3") })
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 py-2 rounded-lg bg-success/5 border border-success/20 max-w-lg w-full mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-700 text-sm", children: t2("bulkModificationGuide.saveReuse.tip") }) })
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center gap-2 py-3", children: Array.from({ length: TOTAL_SLIDES$2 }).map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `w-2 h-2 rounded-full transition-all ${index2 === currentSlide ? "bg-primary w-6" : "bg-default-300"}`
          },
          index2
        )) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center px-6 pb-5", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onPress: handleSkip, children: t2("bulkModificationGuide.skip") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isDisabled: isFirst, variant: "flat", onPress: handlePrev, children: t2("bulkModificationGuide.previous") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleNext, children: isLast ? t2("bulkModificationGuide.getStarted") : t2("bulkModificationGuide.next") })
          ] })
        ] })
      ] })
    }
  );
};
const GUIDE_KEY$2 = "bakabase-bulk-modification-guide-completed";
const useBulkModificationGuide = () => {
  const [showGuide, setShowGuide] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (typeof window === "undefined" || typeof localStorage === "undefined") {
      return;
    }
    const completed = localStorage.getItem(GUIDE_KEY$2);
    if (!completed) {
      setShowGuide(true);
    }
  }, []);
  const completeGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.setItem(GUIDE_KEY$2, "true");
    }
    setShowGuide(false);
  }, []);
  const resetGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.removeItem(GUIDE_KEY$2);
    }
    setShowGuide(true);
  }, []);
  return {
    showGuide,
    completeGuide,
    resetGuide
  };
};
const BulkModification2Page = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const forceUpdate = useUpdate();
  const { showGuide, completeGuide, resetGuide } = useBulkModificationGuide();
  const [expandedKeys, setExpandedKeys] = reactExports.useState([]);
  const [bulkModifications, setBulkModifications] = reactExports.useState();
  const isFirstLoad = reactExports.useRef(true);
  const loadAllBulkModifications = reactExports.useCallback(async () => {
    const r2 = await BApi$1.bulkModification.getAllBulkModifications();
    const bms = r2.data || [];
    setBulkModifications(bms);
    if (isFirstLoad.current) {
      setExpandedKeys(bms.map((bm) => bm.id.toString()));
      isFirstLoad.current = false;
    }
  }, []);
  reactExports.useEffect(() => {
    loadAllBulkModifications();
  }, []);
  const handleAdd = () => {
    BApi$1.bulkModification.addBulkModification().then(() => {
      loadAllBulkModifications();
    });
  };
  const renderEmptyState = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineInbox, { className: "text-6xl text-default-300" }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-default-500 text-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg mb-2", children: t2("bulkModification.empty.noData") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-400", children: t2("bulkModificationGuide.welcome.description") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}), onPress: handleAdd, children: t2("bulkModification.action.add") })
  ] });
  const renderAccordionTitle = (bm, isExpanded) => {
    var _a2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: bm.name }),
          isExpanded && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              size: "sm",
              variant: "light",
              onPress: () => {
                let newName = bm.name;
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "lg",
                  title: t2("bulkModification.action.editName"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      isRequired: true,
                      defaultValue: bm.name,
                      onValueChange: (v2) => newName = v2.trim()
                    }
                  ),
                  onOk: async () => {
                    if (newName.length === 0) {
                      Vt.error(t2("bulkModification.error.nameEmpty"));
                      throw new Error("Name cannot be empty");
                    }
                    BApi$1.bulkModification.patchBulkModification(bm.id, { name: newName }).then((r2) => {
                      if (!r2.code) {
                        bm.name = newName;
                        forceUpdate();
                      }
                    });
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" })
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: t2("bulkModification.label.resourceCount", {
          count: ((_a2 = bm.filteredResourceIds) == null ? void 0 : _a2.length) || 0
        }) }),
        bm.resourceDiffCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "warning", size: "sm", variant: "flat", children: [
          bm.resourceDiffCount,
          " ",
          t2("bulkModification.label.diffs")
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "text-default-400", size: "sm", variant: "light", children: bm.createdAt }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2(
              bm.isActive ? "bulkModification.action.clickToDisable" : "bulkModification.action.clickToEnable"
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "cursor-pointer",
                color: bm.isActive ? "success" : "default",
                size: "sm",
                variant: bm.isActive ? "flat" : "bordered",
                onClick: () => {
                  BApi$1.bulkModification.patchBulkModification(bm.id, { isActive: !bm.isActive }).then(() => loadAllBulkModifications());
                },
                children: t2(
                  bm.isActive ? "bulkModification.status.enabled" : "bulkModification.status.disabled"
                )
              }
            )
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "sm",
            variant: "light",
            onPress: () => {
              BApi$1.bulkModification.duplicateBulkModification(bm.id).then(() => {
                loadAllBulkModifications();
              });
            },
            children: t2("bulkModification.action.duplicate")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("bulkModification.action.delete"),
                children: t2("bulkModification.confirm.delete"),
                onOk: async () => {
                  await BApi$1.bulkModification.deleteBulkModification(bm.id);
                  loadAllBulkModifications();
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
          }
        )
      ] })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}), onPress: handleAdd, children: t2("bulkModification.action.add") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
        bulkModifications && bulkModifications.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-400", children: [
          t2("bulkModification.label.count"),
          ": ",
          bulkModifications.length
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }),
          variant: "light",
          onPress: resetGuide,
          children: t2("bulkModificationGuide.action.showGuide")
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(BulkModificationGuideModal, { visible: showGuide, onComplete: completeGuide }),
    bulkModifications ? bulkModifications.length === 0 ? renderEmptyState() : /* @__PURE__ */ jsxRuntimeExports.jsx(
      accordion_default,
      {
        className: "p-0",
        selectedKeys: expandedKeys,
        selectionMode: "multiple",
        variant: "splitted",
        onSelectionChange: (keys2) => {
          if (!keys2) {
            setExpandedKeys([]);
          }
          setExpandedKeys(Array.from(keys2).map((x2) => x2));
        },
        children: bulkModifications.map((bm) => {
          const isExpanded = expandedKeys.includes(bm.id.toString());
          return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: renderAccordionTitle(bm, isExpanded), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            BulkModification,
            {
              bm,
              onChange: (newBm) => setBulkModifications(
                bulkModifications.map((b2) => b2.id === newBm.id ? newBm : b2)
              )
            }
          ) }, bm.id.toString());
        })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) })
  ] });
};
BulkModification2Page.displayName = "BulkModification2Page";
const CachePage = () => {
  const { t: t2 } = useTranslation();
  const [cacheOverview, setCacheOverview] = reactExports.useState();
  const reload = async () => {
    const r2 = await BApi$1.cache.getCacheOverview();
    setCacheOverview(
      r2.data ?? {
        mediaLibraryCaches: []
      }
    );
  };
  reactExports.useEffect(() => {
    reload();
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    (cacheOverview == null ? void 0 : cacheOverview.mediaLibraryCaches) && cacheOverview.mediaLibraryCaches.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: cacheOverview.mediaLibraryCaches.map((item, idx) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-md", children: item.mediaLibraryName }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-small text-default-500", children: [
            t2("cache.label.resourceCount"),
            ": ",
            item.resourceCount
          ] })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: Object.keys(item.resourceCacheCountMap).map(
          (key, idx2) => {
            const type4 = parseInt(key, 10);
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "div",
              {
                className: "flex items-center gap-2",
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { radius: "sm", size: "sm", children: [
                    t2("cache.label.cached"),
                    " ",
                    t2(`cache.resourceCacheType.${ResourceCacheType[type4].toLowerCase()}`)
                  ] }),
                  item.resourceCacheCountMap[type4],
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      isIconOnly: true,
                      color: "danger",
                      size: "sm",
                      variant: "light",
                      onClick: () => {
                        BApi$1.cache.deleteResourceCacheByMediaLibraryIdAndCacheType(
                          item.mediaLibraryId,
                          parseInt(key, 10)
                        ).then((r2) => {
                          if (!r2.code) {
                            reload();
                          }
                        });
                      },
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
                    }
                  )
                ]
              },
              idx2
            );
          }
        ) })
      ] }, idx);
    }) }),
    (cacheOverview == null ? void 0 : cacheOverview.unassociatedCaches) && cacheOverview.unassociatedCaches.resourceCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-md", children: t2("cache.label.unassociatedResources") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-small text-default-500", children: [
          t2("cache.label.resourceCount"),
          ":",
          " ",
          cacheOverview.unassociatedCaches.resourceCount
        ] })
      ] }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: Object.keys(
        cacheOverview.unassociatedCaches.resourceCacheCountMap
      ).map((key, idx) => {
        const type4 = parseInt(key, 10);
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { radius: "sm", size: "sm", children: [
            t2("cache.label.cached"),
            " ",
            t2(`cache.resourceCacheType.${ResourceCacheType[type4].toLowerCase()}`)
          ] }),
          cacheOverview.unassociatedCaches.resourceCacheCountMap[type4],
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onClick: () => {
                BApi$1.cache.deleteUnassociatedResourceCacheByCacheType(
                  parseInt(key, 10)
                ).then((r2) => {
                  if (!r2.code) {
                    reload();
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
            }
          )
        ] }, idx);
      }) })
    ] }) })
  ] }) });
};
CachePage.displayName = "CachePage";
const AliasPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [form2, setForm] = reactExports.useState({
    pageSize: 20,
    pageIndex: 0,
    additionalItems: AliasAdditionalItem.Candidates
  });
  const [aliases2, setAliases] = reactExports.useState([]);
  const [bulkOperationContext, setBulkOperationContext] = reactExports.useState({
    preferredTexts: []
  });
  const [totalCount, setTotalCount] = reactExports.useState(0);
  const [, forceUpdate] = reactExports.useReducer((x2) => x2 + 1, 0);
  reactExports.useEffect(() => {
    search2();
  }, []);
  const search2 = (pForm) => {
    const nf2 = {
      ...form2,
      ...pForm
    };
    setForm(nf2);
    BApi$1.alias.searchAliasGroups(nf2).then((a2) => {
      var _a2;
      const data = ((_a2 = a2.data) == null ? void 0 : _a2.map((x2) => ({
        originalText: x2.text,
        text: x2.text,
        preferred: x2.preferred ?? void 0,
        candidates: x2.candidates ?? void 0
      }))) ?? [];
      setAliases(data);
      setTotalCount(a2.totalCount);
      if (data.length === 0 && nf2.pageIndex > 0 && a2.totalCount > 0) {
        const lastPage = Math.max(0, Math.ceil(a2.totalCount / nf2.pageSize) - 1);
        search2({ pageIndex: lastPage });
      }
    });
  };
  const renderPagination = () => {
    const pageCount = Math.ceil(totalCount / form2.pageSize);
    if (pageCount > 1) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page: form2.pageIndex,
          size: "sm",
          total: pageCount,
          onChange: (p2) => search2({ pageIndex: p2 })
        }
      ) });
    }
    return;
  };
  const resetBulkOperationContext = () => {
    setBulkOperationContext({
      preferredTexts: []
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            placeholder: t2("alias.input.searchPlaceholder"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-sm" }),
            value: form2.fuzzyText,
            onKeyDown: (e2) => {
              if (e2.key == "Enter") {
                search2();
              }
            },
            onValueChange: (v2) => setForm({
              ...form2,
              fuzzyText: v2
            })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500", children: t2("alias.info.description") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            size: "sm",
            onClick: () => {
              let value2;
              createPortal(Modal, {
                defaultVisible: true,
                size: "lg",
                title: t2("alias.action.add"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  input_default,
                  {
                    classNames: {
                      input: "break-all"
                    },
                    onValueChange: (v2) => value2 = v2
                  }
                ),
                onOk: async () => {
                  await BApi$1.alias.addAlias({
                    text: value2
                  });
                  search2();
                }
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-base" }),
              t2("alias.action.add")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "sm",
            onClick: () => {
              createPortal(FileSystemSelectorModal, {
                onSelected: (e2) => {
                  const modal2 = createPortal(Modal, {
                    visible: true,
                    title: t2("alias.label.importing"),
                    footer: false,
                    closeButton: false
                  });
                  BApi$1.alias.importAliases({ path: e2.path }).then((r2) => {
                    modal2.destroy();
                  });
                },
                targetType: "file",
                filter: (e2) => e2.isDirectoryOrDrive || e2.path.endsWith(".csv")
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$3, { className: "text-base" }),
              t2("alias.action.import")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onPress: () => {
              BApi$1.gui.openUrlInDefaultBrowser({
                url: `${envConfig.apiEndpoint}/alias/xlsx`
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$S, { className: "text-base" }),
              t2("alias.action.export")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-1" }),
    bulkOperationContext.preferredTexts.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-md flex items-center gap-2", children: [
        t2("alias.label.bulkOperations"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            classNames: {
              content: "max-w-md break-all whitespace-normal"
            },
            content: t2("alias.tip.preferredText", { text: bulkOperationContext.preferredTexts[0] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "secondary",
                size: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$t, { className: "text-sm" }),
                onClick: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("alias.confirm.mergeTitle", {
                      texts: bulkOperationContext.preferredTexts.join(", ")
                    }) }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("alias.confirm.mergeDescription", { preferred: bulkOperationContext.preferredTexts[0] }) }),
                    onOk: async () => {
                      await BApi$1.alias.mergeAliasGroups({
                        preferredTexts: bulkOperationContext.preferredTexts
                      });
                      resetBulkOperationContext();
                      search2();
                    }
                  });
                },
                children: t2("alias.action.merge")
              }
            )
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "danger",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-sm" }),
            onClick: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("alias.confirm.deleteTitle", {
                  texts: bulkOperationContext.preferredTexts.join(", ")
                }) }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "break-all whitespace-normal", children: t2("alias.confirm.deleteDescription") }),
                onOk: async () => {
                  await BApi$1.alias.deleteAliasGroups({
                    preferredTexts: bulkOperationContext.preferredTexts
                  });
                  resetBulkOperationContext();
                  search2();
                }
              });
            },
            children: t2("common.action.delete")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "default",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Q, { className: "text-sm" }),
            onClick: () => {
              resetBulkOperationContext();
            },
            children: t2("alias.action.exit")
          }
        )
      ] }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: bulkOperationContext.preferredTexts.map((t22, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            classNames: {
              base: "max-w-full",
              content: "break-all whitespace-normal"
            },
            color: i2 == 0 ? "primary" : "default",
            radius: "sm",
            size: "sm",
            className: "h-auto py-1",
            onClick: () => {
              bulkOperationContext.preferredTexts.splice(i2, 1);
              setBulkOperationContext({
                ...bulkOperationContext,
                preferredTexts: [t22, ...bulkOperationContext.preferredTexts]
              });
            },
            onClose: () => {
              const texts = bulkOperationContext.preferredTexts.filter((x2) => x2 != t22);
              if (texts.length == 0) {
                resetBulkOperationContext();
              } else {
                setBulkOperationContext({
                  ...bulkOperationContext,
                  preferredTexts: texts
                });
              }
            },
            children: t22
          },
          t22
        );
      }) }) })
    ] }) }),
    aliases2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      table_default,
      {
        isCompact: true,
        isStriped: true,
        removeWrapper: true,
        bottomContent: renderPagination(),
        color: "primary",
        selectedKeys: bulkOperationContext.preferredTexts.filter(
          (x2) => aliases2.some((a2) => a2.text == x2)
        ),
        selectionMode: "multiple",
        topContent: renderPagination(),
        onSelectionChange: (keys2) => {
          let selection;
          if (keys2 === "all") {
            selection = aliases2.map((a2) => a2.text);
          } else {
            selection = Array.from(keys2).map(String);
          }
          const notSelected = aliases2.map((x2) => x2.text).filter((x2) => !selection.includes(x2));
          const ns = Array.from(
            new Set(
              bulkOperationContext.preferredTexts.filter((x2) => !notSelected.includes(x2)).concat(selection)
            )
          );
          setBulkOperationContext({
            ...bulkOperationContext,
            preferredTexts: ns
          });
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("alias.label.preferred") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("alias.label.candidates") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: aliases2.map((a2) => {
            var _a2;
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "break-all max-w-xs", children: a2.originalText }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "max-w-md", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                "div",
                {
                  className: "flex flex-wrap gap-1",
                  onClick: (e2) => {
                    e2.cancelable = true;
                    e2.stopPropagation();
                    e2.preventDefault();
                  },
                  children: (_a2 = a2.candidates) == null ? void 0 : _a2.map((c2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Tooltip$1,
                      {
                        content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Button,
                          {
                            color: "success",
                            size: "sm",
                            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$5, { className: "text-sm" }),
                            variant: "light",
                            onClick: () => {
                              BApi$1.alias.patchAlias(
                                {
                                  isPreferred: true
                                },
                                { text: c2 }
                              ).then(() => {
                                search2();
                              });
                            },
                            children: t2("alias.action.setAsPreferred")
                          }
                        ) }),
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Chip,
                          {
                            classNames: {
                              base: "max-w-full",
                              content: "break-all whitespace-normal"
                            },
                            radius: "sm",
                            onClose: () => {
                              createPortal(Modal, {
                                defaultVisible: true,
                                title: t2("alias.confirm.deleteSingle"),
                                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "break-all whitespace-normal", children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("alias.confirm.weAreDeleting") }),
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold my-2", children: c2 }),
                                  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("alias.confirm.noWayBack") })
                                ] }),
                                onOk: async () => {
                                  var _a3;
                                  await BApi$1.alias.deleteAlias({ text: c2 });
                                  a2.candidates = (_a3 = a2.candidates) == null ? void 0 : _a3.filter((x2) => x2 != c2);
                                  forceUpdate();
                                }
                              });
                            },
                            children: c2
                          }
                        )
                      },
                      c2
                    );
                  })
                }
              ) })
            ] }, a2.text);
          }) })
        ]
      }
    ) })
  ] });
};
AliasPage.displayName = "AliasPage";
const DetailPage = ({ value: propsValue, onChange }) => {
  const { t: t2 } = useTranslation();
  const [value2, setValue] = reactExports.useState(
    JSON.parse(JSON.stringify(propsValue))
  );
  const change = (patches) => {
    const nv = {
      ...value2,
      ...patches
    };
    setValue(nv);
    onChange(nv);
  };
  switch (value2.type) {
    case SpecialTextType.DateTime:
    case SpecialTextType.Volume:
    case SpecialTextType.Useless:
    case SpecialTextType.Trim:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          required: true,
          className: "w-full",
          label: t2("text.label.text"),
          placeholder: t2("text.placeholder.text"),
          value: value2.value1,
          onValueChange: (value1) => {
            change({ value1 });
          }
        },
        "0"
      );
    case SpecialTextType.Language:
    case SpecialTextType.Standardization:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            label: t2("text.label.sourceText"),
            placeholder: t2("text.placeholder.sourceText"),
            value: value2.value1,
            onValueChange: (value1) => {
              change({ value1 });
            }
          },
          "0"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            label: t2("text.label.convertTo"),
            placeholder: t2("text.placeholder.convertTo"),
            value: value2.value2,
            onValueChange: (value22) => {
              change({ value2: value22 });
            }
          },
          "1"
        )
      ] });
    case SpecialTextType.Wrapper:
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            label: t2("text.label.leftWrapper"),
            placeholder: t2("text.placeholder.leftWrapper"),
            value: value2.value1,
            onValueChange: (value1) => {
              change({ value1 });
            }
          },
          "0"
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            required: true,
            label: t2("text.label.rightWrapper"),
            placeholder: t2("text.placeholder.rightWrapper"),
            value: value2.value2,
            onValueChange: (value22) => {
              change({ value2: value22 });
            }
          },
          "1"
        )
      ] });
    default:
      return null;
  }
};
DetailPage.displayName = "DetailPage";
const tagRenders = {
  Single: (t2) => t2.value1,
  Wrapper: (t2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2.value1,
    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-50", children: "..." }),
    t2.value2
  ] }),
  Value1ToValue2: (t2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1", children: [
    t2.value1,
    /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$12, { className: "text-small opacity-50" }),
    t2.value2
  ] })
};
const typeTagRendersMapping = {
  [SpecialTextType.Useless]: tagRenders.Single,
  [SpecialTextType.Language]: tagRenders.Value1ToValue2,
  [SpecialTextType.Wrapper]: tagRenders.Wrapper,
  [SpecialTextType.Standardization]: tagRenders.Value1ToValue2,
  [SpecialTextType.Volume]: tagRenders.Single,
  [SpecialTextType.Trim]: tagRenders.Single
};
const typeDescriptions = {
  [SpecialTextType.Useless]: "text.typeDescription.useless",
  [SpecialTextType.Language]: "text.typeDescription.language",
  [SpecialTextType.Wrapper]: "text.typeDescription.wrapper",
  [SpecialTextType.Standardization]: "text.typeDescription.standardization",
  [SpecialTextType.Volume]: "text.typeDescription.volume",
  [SpecialTextType.Trim]: "text.typeDescription.trim",
  [SpecialTextType.DateTime]: "text.typeDescription.dateTime"
};
const usedInMapping = {
  [SpecialTextType.Useless]: ["text.usedIn.textPretreatment"],
  [SpecialTextType.Language]: ["text.usedIn.bakabaseEnhancerAnalysis"],
  [SpecialTextType.Wrapper]: [
    "text.usedIn.textPretreatment",
    "text.usedIn.resourceDisplayNameTemplate",
    "text.usedIn.exhentaiEnhancerAnalysis"
  ],
  [SpecialTextType.Standardization]: ["text.usedIn.textPretreatment"],
  [SpecialTextType.Volume]: ["text.usedIn.bakabaseEnhancerAnalysis"],
  [SpecialTextType.Trim]: ["text.usedIn.textPretreatment"],
  [SpecialTextType.DateTime]: [
    "text.usedIn.bakabaseEnhancerAnalysis",
    "text.usedIn.parsingOrConvertingPropertyValue"
  ]
};
const TextPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [textsMap, setTextsMap] = reactExports.useState({});
  const [testInput, setTestInput] = reactExports.useState("");
  const [testResult, setTestResult] = reactExports.useState("");
  const [isRunning, setIsRunning] = reactExports.useState(false);
  const hasDiff = reactExports.useMemo(() => testInput !== testResult, [testInput, testResult]);
  const renderDiffChunks = (a2, b2) => {
    if (!a2 && !b2)
      return null;
    const dmp = new DiffMatchPatch$1();
    const diffs = dmp.diff_main(a2 || "", b2 || "");
    dmp.diff_cleanupSemantic(diffs);
    const left2 = [];
    const right = [];
    for (const [op, text2] of diffs) {
      if (op === 0) {
        left2.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: text2 }));
        right.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: text2 }));
      } else if (op === -1) {
        left2.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-danger-100 text-danger-600", children: text2 }));
      } else if (op === 1) {
        right.push(/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "bg-success-100 text-success-700", children: text2 }));
      }
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-md p-2 whitespace-pre-wrap break-words text-sm", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("text.label.original") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: left2 })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-md p-2 whitespace-pre-wrap break-words text-sm", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("text.label.pretreated") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: right })
      ] })
    ] });
  };
  reactExports.useEffect(() => {
    loadData();
  }, []);
  const loadData = () => {
    BApi$1.specialText.getAllSpecialTexts().then((t22) => {
      const data = t22.data || {};
      const ts = specialTextTypes.reduce((s2, t3) => {
        const list2 = data[t3.value] ?? [];
        list2.sort((a2, b2) => a2.value1.localeCompare(b2.value1));
        s2[t3.value] = list2.map((l2) => ({
          id: l2.id,
          value1: l2.value1,
          value2: l2.value2,
          type: l2.type
        }));
        return s2;
      }, {});
      setTextsMap(ts);
    });
  };
  const renderDetail = (c2) => {
    let text2 = c2;
    createPortal(Modal, {
      defaultVisible: true,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DetailPage, { value: c2, onChange: (t22) => text2 = t22 }) }),
      size: "lg",
      onOk: async () => {
        if (c2.id > 0) {
          await BApi$1.specialText.patchSpecialText(c2.id, text2);
        } else {
          await BApi$1.specialText.addSpecialText(text2);
        }
        await loadData();
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-page", title: "Text", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.type") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("text.label.appliedTo") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("text.label.texts") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("text.label.opt") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: Object.keys(textsMap).map((typeStr) => {
        const type4 = parseInt(typeStr, 10);
        const texts = textsMap[type4] ?? [];
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            t2(`SpecialTextType.${SpecialTextType[type4]}`),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2(typeDescriptions[type4]), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-1 flex-wrap", children: usedInMapping[type4].map((x2) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "default",
                radius: "sm",
                size: "sm",
                variant: "flat",
                children: t2(x2)
              }
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: texts.map((c2) => {
            const renderer = typeTagRendersMapping[c2.type] ?? tagRenders.Single;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                radius: "sm",
                variant: "bordered",
                onClose: () => {
                  createPortal(Modal, {
                    title: t2("text.confirm.deleteTitle"),
                    defaultVisible: true,
                    onOk: async () => {
                      await BApi$1.specialText.deleteSpecialText(c2.id);
                      await loadData();
                    }
                  });
                },
                onClick: () => {
                  renderDetail(c2);
                },
                children: renderer(c2)
              },
              c2.id
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              variant: "light",
              onClick: () => renderDetail({
                type: type4,
                id: 0,
                value1: ""
              }),
              children: t2("common.action.add")
            }
          ) })
        ] });
      }) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opt", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "light",
        onClick: () => {
          BApi$1.specialText.addSpecialTextPrefabs().then((a2) => {
            if (!a2.code) {
              loadData();
            }
          });
        },
        children: t2("text.action.addPrefabs")
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-4" }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium mb-2", children: t2("text.label.pretreatmentTest") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        textarea_default,
        {
          minRows: 3,
          placeholder: t2("text.input.enterText"),
          value: testInput,
          onValueChange: (v2) => {
            setTestInput(v2);
            setTestResult("");
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          isLoading: isRunning,
          onClick: async () => {
            setIsRunning(true);
            try {
              const r2 = await BApi$1.specialText.pretreatText({ text: testInput });
              setTestResult(r2.data ?? "");
            } finally {
              setIsRunning(false);
            }
          },
          children: t2("text.action.runPretreatment")
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-3", children: !testResult || !testInput ? null : hasDiff ? renderDiffChunks(testInput, testResult) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-500 text-sm", children: t2("text.label.noChanges") }) })
    ] })
  ] });
};
TextPage.displayName = "TextPage";
const OptionsCard = ({ header, children }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_header_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xl", children: header }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        className: "grid gap-2 items-center",
        style: { gridTemplateColumns: "repeat(2, auto)" },
        children
      }
    ) })
  ] });
};
OptionsCard.displayName = "OptionsCard";
const Options = [true, false];
const BooleanOptions = ({
  subject,
  isSelected,
  onSelect,
  isSecondary
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "inline-grid gap-2 items-center",
      style: { gridTemplateColumns: "1fr 50px 50px" },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `flex items-center justify-end gap-1 ${isSecondary ? "opacity-80" : ""}`,
            children: subject
          }
        ),
        Options.map((o2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              className: "justify-self-center",
              isSelected: isSelected === o2,
              size: "sm",
              onValueChange: (x2) => {
                if (x2) {
                  onSelect == null ? void 0 : onSelect(o2);
                } else {
                  onSelect == null ? void 0 : onSelect(void 0);
                }
              },
              children: t2(o2 ? "Yes" : "No")
            }
          );
        })
      ]
    }
  );
};
BooleanOptions.displayName = "BooleanOptions";
const SubjectLabels = {
  DeleteResourcesWithUnknownPath: "Delete resources with unknown path",
  DeleteResourcesWithUnknownMediaLibrary: "Delete resources with unknown media library",
  EnhancerReApply: "ReApply",
  EnhancerReEnhance: "ReEnhance"
};
const EnhancerOptions = ({ enhancer, options, onChange, subject, isSecondary }) => {
  const { t: t2 } = useTranslation();
  const enhancerChip = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
    t2("Enhancer"),
    /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerIcon, { id: enhancer.id }),
    t2(enhancer.name)
  ] }) });
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSecondary,
        isSelected: options == null ? void 0 : options.reApply,
        subject: subject ?? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          enhancerChip,
          t2(SubjectLabels.EnhancerReApply)
        ] }),
        onSelect: (isSelected) => {
          patchOptions({ reApply: isSelected });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSecondary,
        isSelected: options == null ? void 0 : options.reEnhance,
        subject: subject ?? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          enhancerChip,
          t2(SubjectLabels.EnhancerReEnhance)
        ] }),
        onSelect: (isSelected) => {
          patchOptions({ reEnhance: isSelected });
        }
      }
    )
  ] });
};
EnhancerOptions.displayName = "EnhancerOptions";
const GlobalOptions = ({ options, onChange }) => {
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(OptionsCard, { header: t2("Global"), children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isClearable: true,
        className: "w-[360px]",
        description: t2(
          "To reduce synchronization time, we will, by default, use 40% of your CPU's maximum thread count (rounded down) for syncing the media library"
        ),
        label: t2("Max threads"),
        minValue: 1,
        size: "sm",
        value: options == null ? void 0 : options.maxThreads,
        onClear: () => {
          patchOptions({ maxThreads: void 0 });
        },
        onValueChange: (maxThreads) => {
          patchOptions({ maxThreads });
        }
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownMediaLibrary,
        subject: t2(SubjectLabels.DeleteResourcesWithUnknownMediaLibrary),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownMediaLibrary: isSelected })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
        subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
      }
    ),
    enhancerIds.map((e2) => {
      var _a2;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        EnhancerOptions,
        {
          enhancer: {
            id: e2.value,
            name: e2.label
          },
          options: (_a2 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a2[e2.value],
          onChange: (o2) => patchOptions({
            enhancerOptionsMap: {
              ...options == null ? void 0 : options.enhancerOptionsMap,
              [e2.value]: o2
            }
          })
        }
      );
    })
  ] });
};
GlobalOptions.displayName = "GlobalOptions";
const DeprecatedChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "danger",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = t2(
    "This feature is deprecated and may be removed in future versions. Please consider using the recommended alternative."
  );
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Deprecated") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      delay: 2e3,
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
DeprecatedChip.displayName = "DeprecatedChip";
const CategoryOptions = ({ category, onChange, options }) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    OptionsCard,
    {
      header: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 opacity-60", children: [
        category.name,
        /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
      ] }),
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          BooleanOptions,
          {
            isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
            subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
            onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
        (_a2 = category.mediaLibraries) == null ? void 0 : _a2.map((l2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(
            BooleanOptions,
            {
              isSecondary: true,
              isSelected: (_b3 = (_a3 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a3[l2.id]) == null ? void 0 : _b3.deleteResourcesWithUnknownPath,
              subject: l2.name,
              onSelect: (isSelected) => {
                var _a4;
                return patchOptions({
                  mediaLibraryOptionsMap: {
                    ...options == null ? void 0 : options.mediaLibraryOptionsMap,
                    [l2.id]: {
                      ...(_a4 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a4[l2.id],
                      deleteResourcesWithUnknownPath: isSelected
                    }
                  }
                });
              }
            }
          );
        }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
        (_b2 = category.enhancers) == null ? void 0 : _b2.map((e2) => {
          var _a3, _b3;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              EnhancerOptions,
              {
                enhancer: e2,
                options: (_a3 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a3[e2.id],
                onChange: (o2) => patchOptions({
                  enhancerOptionsMap: {
                    ...options == null ? void 0 : options.enhancerOptionsMap,
                    [e2.id]: o2
                  }
                })
              }
            ),
            (_b3 = category.mediaLibraries) == null ? void 0 : _b3.map((l2) => {
              var _a4, _b4, _c2;
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                EnhancerOptions,
                {
                  isSecondary: true,
                  enhancer: e2,
                  options: (_c2 = (_b4 = (_a4 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a4[l2.id]) == null ? void 0 : _b4.enhancerOptionsMap) == null ? void 0 : _c2[e2.id],
                  subject: l2.name,
                  onChange: (o2) => {
                    var _a5, _b5, _c3;
                    return patchOptions({
                      mediaLibraryOptionsMap: {
                        ...options == null ? void 0 : options.mediaLibraryOptionsMap,
                        [l2.id]: {
                          ...(_a5 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a5[l2.id],
                          enhancerOptionsMap: {
                            ...(_c3 = (_b5 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _b5[l2.id]) == null ? void 0 : _c3.enhancerOptionsMap,
                            [e2.id]: o2
                          }
                        }
                      }
                    });
                  }
                }
              );
            })
          ] });
        })
      ]
    }
  );
};
const MediaLibraryOptions = ({ mediaLibrary, onChange, options }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const patchOptions = (patches) => {
    const newOptions = {
      ...options,
      ...patches
    };
    onChange == null ? void 0 : onChange(newOptions);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(OptionsCard, { header: mediaLibrary.name, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      BooleanOptions,
      {
        isSelected: options == null ? void 0 : options.deleteResourcesWithUnknownPath,
        subject: t2(SubjectLabels.DeleteResourcesWithUnknownPath),
        onSelect: (isSelected) => patchOptions({ deleteResourcesWithUnknownPath: isSelected })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
    (_a2 = mediaLibrary.enhancers) == null ? void 0 : _a2.map((e2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        EnhancerOptions,
        {
          enhancer: e2,
          options: (_a3 = options == null ? void 0 : options.enhancerOptionsMap) == null ? void 0 : _a3[e2.id],
          onChange: (o2) => patchOptions({
            enhancerOptionsMap: {
              ...options == null ? void 0 : options.enhancerOptionsMap,
              [e2.id]: o2
            }
          })
        }
      ) });
    })
  ] });
};
MediaLibraryOptions.displayName = "MediaLibraryOptions";
const SynchronizationOptionsPage = () => {
  var _a2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [categories, setCategories] = reactExports.useState([]);
  const synchronizationOptions = (_a2 = useResourceOptionsStore(
    (state) => state.data
  )) == null ? void 0 : _a2.synchronizationOptions;
  const [mediaLibraryV2s, setMediaLibraryV2s] = reactExports.useState([]);
  const [options, setOptions2] = reactExports.useState();
  reactExports.useEffect(() => {
    setOptions2(
      synchronizationOptions ? JSON.parse(JSON.stringify(synchronizationOptions)) : void 0
    );
  }, [synchronizationOptions]);
  const init2 = async () => {
    const enhancerName = enhancerIds.reduce((s2, t22) => {
      s2[t22.value] = t22.label;
      return s2;
    }, {});
    const categories2 = (await BApi$1.category.getAllCategories({
      additionalItems: CategoryAdditionalItem.EnhancerOptions
    })).data ?? [];
    const categoryMediaLibraryMap = _$2.groupBy(
      (await BApi$1.mediaLibrary.getAllMediaLibraries()).data ?? [],
      (x2) => x2.categoryId
    );
    const mediaLibrariesRsp = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2({
      additionalItems: MediaLibraryV2AdditionalItem.Template
    });
    const mediaLibraries = (mediaLibrariesRsp.data ?? []).map((ml2) => {
      var _a3, _b2;
      return {
        ...ml2,
        enhancers: (_b2 = (_a3 = ml2.template) == null ? void 0 : _a3.enhancers) == null ? void 0 : _b2.map((e2) => ({
          id: e2.enhancerId,
          name: enhancerName[e2.enhancerId]
        }))
      };
    });
    const simpleCategories = categories2.map((c2) => {
      var _a3;
      const eIds = (_a3 = c2.enhancerOptions) == null ? void 0 : _a3.filter((x2) => x2.active).map((x2) => x2.enhancerId);
      const nc2 = {
        id: c2.id,
        name: c2.name,
        order: c2.order,
        enhancers: eIds == null ? void 0 : eIds.map((e2) => ({
          id: e2,
          name: enhancerName[e2]
        })),
        mediaLibraries: categoryMediaLibraryMap[c2.id]
      };
      return nc2;
    });
    setMediaLibraryV2s(mediaLibraries);
    setCategories(simpleCategories);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  const saveOptions = async (options2) => {
    setOptions2(options2);
    await BApi$1.options.patchResourceOptions({
      synchronizationOptions: options2
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      alert_default,
      {
        color: "default",
        title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "You can customize media library synchronization behavior here. If you leave the option blank, we will attempt to apply the parent selection according to priority."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              radius: "sm",
              size: "sm",
              variant: "light",
              onPress: () => {
                const data = [
                  {
                    label: "Priority",
                    description: "Media library > Category(Deprecated) > Global"
                  },
                  {
                    label: "Resources with unknown path",
                    description: "The resource path becomes unknown, usually because the file has been moved or the file name or parent folder name has been modified."
                  },
                  {
                    label: "Resources with unknown media library",
                    description: 'The media library becoming "unknown" is usually due to the deletion of the media library or category, but its internal resources are still retained.'
                  },
                  {
                    label: "ReApply in enhancer",
                    description: "The enhancer will reapply the data it has already acquired to the resources based on the latest configuration. This step is relatively quick since it does not attempt to retrieve new data."
                  },
                  {
                    label: "ReEnhance in enhancer",
                    description: "It will delete all acquired enhanced data and applied enhanced data. Then, the enhancer will automatically attempt to reacquire and apply the data."
                  }
                ];
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("Configuration item instructions"),
                  size: "xl",
                  footer: {
                    actions: ["cancel"],
                    cancelProps: {
                      text: t2("Close")
                    }
                  },
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "div",
                    {
                      className: "grid gap-x-4 gap-y-2",
                      style: { gridTemplateColumns: "auto 1fr" },
                      children: data.map((d2) => {
                        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-bold text-right", children: t2(d2.label) }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-80", children: t2(d2.description) })
                        ] });
                      })
                    }
                  )
                });
              },
              children: t2("View configuration item instructions")
            }
          )
        ] })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalOptions, { options, onChange: saveOptions }),
    mediaLibraryV2s.map((ml2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        MediaLibraryOptions,
        {
          mediaLibrary: ml2,
          options: (_a3 = options == null ? void 0 : options.mediaLibraryOptionsMap) == null ? void 0 : _a3[ml2.id],
          onChange: (o2) => saveOptions({
            ...options,
            mediaLibraryOptionsMap: {
              ...options == null ? void 0 : options.mediaLibraryOptionsMap,
              [ml2.id]: o2
            }
          })
        }
      );
    }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
    categories.map((c2) => {
      var _a3;
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        CategoryOptions,
        {
          category: c2,
          options: (_a3 = options == null ? void 0 : options.categoryOptionsMap) == null ? void 0 : _a3[c2.id],
          onChange: (o2) => saveOptions({
            ...options,
            categoryOptionsMap: {
              ...options == null ? void 0 : options.categoryOptionsMap,
              [c2.id]: o2
            }
          })
        }
      );
    })
  ] });
};
SynchronizationOptionsPage.displayName = "SynchronizationOptionsPage";
const Component = ({ id: id2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const context = useDependentComponentContextsStore(
    (state) => state.contexts
  ).find((a2) => a2.id == id2);
  const [latestVersion, setLatestVersion] = reactExports.useState();
  const [discovering, setDiscovering] = reactExports.useState(true);
  const [findingNewVersion, setFindingNewVersion] = reactExports.useState(false);
  const prevStatus = usePrevious$1(context == null ? void 0 : context.status);
  reactExports.useEffect(() => {
    if ((context == null ? void 0 : context.status) == DependentComponentStatus.Installed && prevStatus == DependentComponentStatus.Installing) {
      init2();
    }
  }, [context]);
  const init2 = reactExports.useCallback(async () => {
    try {
      await BApi$1.component.discoverDependentComponent({ id: id2 });
    } finally {
      setDiscovering(false);
    }
    if ((context == null ? void 0 : context.isRequired) || (context == null ? void 0 : context.status) == DependentComponentStatus.NotInstalled) {
      setFindingNewVersion(true);
      try {
        const latestVersionRsp = await BApi$1.component.getDependentComponentLatestVersion({ id: id2 });
        if (!latestVersionRsp.code) {
          setLatestVersion(latestVersionRsp.data);
        } else {
          setLatestVersion({
            canUpdate: false,
            error: latestVersionRsp.message
          });
        }
      } catch (e2) {
        setLatestVersion({
          canUpdate: false,
          error: e2.toString()
        });
      } finally {
        setFindingNewVersion(false);
      }
    } else {
      setLatestVersion(void 0);
    }
  }, []);
  reactExports.useEffect(() => {
    init2();
  }, []);
  console.log(context == null ? void 0 : context.name, latestVersion, discovering, context);
  const renderNewVersionInner = reactExports.useCallback(() => {
    const elements = [];
    if (latestVersion) {
      if (latestVersion.error) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("configuration.dependency.failedToGetVersion"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: latestVersion.error }),
                  size: "lg"
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdError, { className: "text-base" })
            }
          )
        );
      } else {
        if (latestVersion.canUpdate) {
          if ((context == null ? void 0 : context.status) != DependentComponentStatus.Installing) {
            elements.push(
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                Button,
                {
                  size: "sm",
                  color: "primary",
                  variant: "light",
                  onClick: () => {
                    BApi$1.component.installDependentComponent({ id: id2 });
                  },
                  children: [
                    t2("configuration.dependency.clickToUpdate"),
                    ":",
                    " ",
                    latestVersion.version
                  ]
                }
              )
            );
          }
        } else {
          elements.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base text-success" })
          );
        }
      }
    } else {
      if (findingNewVersion) {
        elements.push(
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" })
        );
      }
    }
    if (context && context.status == DependentComponentStatus.Installing) {
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          t2("configuration.dependency.updating"),
          ": ",
          context.installationProgress,
          "%",
          /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" })
        ] })
      );
    }
    if (context == null ? void 0 : context.error) {
      elements.push(
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                title: t2("error.title"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: context.error }),
                size: "lg"
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdError, { className: "text-base" })
          }
        )
      );
    }
    return elements;
  }, [latestVersion, context, discovering]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "third-party-component",
      style: {
        display: "flex",
        gap: 10,
        alignItems: "center"
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "installed", children: discovering ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            radius: "sm",
            size: "sm",
            title: (context == null ? void 0 : context.location) ?? void 0,
            children: (context == null ? void 0 : context.version) ?? t2("configuration.dependency.notInstalled")
          }
        ) }),
        !discovering && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "new-version",
            style: {
              display: "flex",
              alignItems: "center",
              gap: 5
            },
            children: renderNewVersionInner()
          }
        )
      ]
    }
  );
};
Component.displayName = "Component";
const Dependency = () => {
  const { t: t2 } = useTranslation();
  const componentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const thirdPartyOptions = useThirdPartyOptionsStore((state) => state.data);
  const aiOptions = useAiOptionsStore((state) => state.data);
  reactExports.useEffect(() => {
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.dependency.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_body_default, { children: [
      componentContexts.map((c2, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          table_row_default,
          {
            className: "hover:bg-[var(--bakaui-overlap-background)]",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1 items-center", children: [
                c2.name,
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PopoverComponent,
                  {
                    showArrow: true,
                    placement: "right",
                    trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
                      "div",
                      {
                        className: "px-2 py-4 flex flex-col gap-2",
                        style: { userSelect: "text" },
                        children: [
                          c2.description && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: c2.description }),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                            t2("configuration.dependency.defaultLocation"),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              snippet_default,
                              {
                                hideSymbol: true,
                                size: "sm",
                                variant: "bordered",
                                children: c2.defaultLocation
                              }
                            )
                          ] })
                        ]
                      }
                    )
                  }
                )
              ] }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { id: c2.id }) })
            ]
          },
          i2
        );
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2("configuration.dependency.curlExecutable") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: ({ onValueChange, value: value2, ...props }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PathAutocomplete,
                  {
                    ...props,
                    pathType: "file",
                    value: value2,
                    onChange: onValueChange
                  }
                ),
                Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), ...props, size: "sm", children: value2 }) : null,
                editorProps: {
                  placeholder: t2("configuration.dependency.curlPlaceholder"),
                  size: "sm"
                },
                value: thirdPartyOptions.curlExecutable,
                onSubmit: async (v2) => await BApi$1.options.putThirdPartyOptions({
                  ...thirdPartyOptions,
                  curlExecutable: v2
                })
              }
            ) })
          ]
        },
        componentContexts.length
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2("configuration.dependency.ollamaEndpoint") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              EditableValue,
              {
                Editor: input_default,
                Viewer: ({ value: value2, ...props }) => value2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), ...props, size: "sm", children: value2 }) : null,
                editorProps: {
                  placeholder: "http://localhost:11434",
                  size: "sm"
                },
                value: aiOptions.ollamaEndpoint,
                onSubmit: async (v2) => await BApi$1.options.putAiOptions({
                  ...aiOptions,
                  ollamaEndpoint: v2
                })
              }
            ) })
          ]
        },
        componentContexts.length + 1
      )
    ] })
  ] }) }) });
};
Dependency.displayName = "Dependency";
function ok$1() {
}
function unreachable() {
}
function stringify$1(values, options) {
  const settings = {};
  const input2 = values[values.length - 1] === "" ? [...values, ""] : values;
  return input2.join(
    (settings.padRight ? " " : "") + "," + (settings.padLeft === false ? "" : " ")
  ).trim();
}
const nameRe = /^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
const nameReJsx = /^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u;
const emptyOptions$2 = {};
function name(name2, options) {
  const settings = emptyOptions$2;
  const re2 = settings.jsx ? nameReJsx : nameRe;
  return re2.test(name2);
}
const re = /[ \t\n\f\r]/g;
function whitespace2(thing) {
  return typeof thing === "object" ? thing.type === "text" ? empty$1(thing.value) : false : empty$1(thing);
}
function empty$1(value2) {
  return value2.replace(re, "") === "";
}
class Schema {
  /**
   * @param {SchemaType['property']} property
   *   Property.
   * @param {SchemaType['normal']} normal
   *   Normal.
   * @param {Space | undefined} [space]
   *   Space.
   * @returns
   *   Schema.
   */
  constructor(property2, normal, space2) {
    this.normal = normal;
    this.property = property2;
    if (space2) {
      this.space = space2;
    }
  }
}
Schema.prototype.normal = {};
Schema.prototype.property = {};
Schema.prototype.space = void 0;
function merge(definitions, space2) {
  const property2 = {};
  const normal = {};
  for (const definition2 of definitions) {
    Object.assign(property2, definition2.property);
    Object.assign(normal, definition2.normal);
  }
  return new Schema(property2, normal, space2);
}
function normalize$1(value2) {
  return value2.toLowerCase();
}
class Info {
  /**
   * @param {string} property
   *   Property.
   * @param {string} attribute
   *   Attribute.
   * @returns
   *   Info.
   */
  constructor(property2, attribute) {
    this.attribute = attribute;
    this.property = property2;
  }
}
Info.prototype.attribute = "";
Info.prototype.booleanish = false;
Info.prototype.boolean = false;
Info.prototype.commaOrSpaceSeparated = false;
Info.prototype.commaSeparated = false;
Info.prototype.defined = false;
Info.prototype.mustUseProperty = false;
Info.prototype.number = false;
Info.prototype.overloadedBoolean = false;
Info.prototype.property = "";
Info.prototype.spaceSeparated = false;
Info.prototype.space = void 0;
let powers = 0;
const boolean2 = increment();
const booleanish = increment();
const overloadedBoolean = increment();
const number3 = increment();
const spaceSeparated = increment();
const commaSeparated = increment();
const commaOrSpaceSeparated = increment();
function increment() {
  return 2 ** ++powers;
}
const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  boolean: boolean2,
  booleanish,
  commaOrSpaceSeparated,
  commaSeparated,
  number: number3,
  overloadedBoolean,
  spaceSeparated
}, Symbol.toStringTag, { value: "Module" }));
const checks = (
  /** @type {ReadonlyArray<keyof typeof types>} */
  Object.keys(types)
);
class DefinedInfo extends Info {
  /**
   * @constructor
   * @param {string} property
   *   Property.
   * @param {string} attribute
   *   Attribute.
   * @param {number | null | undefined} [mask]
   *   Mask.
   * @param {Space | undefined} [space]
   *   Space.
   * @returns
   *   Info.
   */
  constructor(property2, attribute, mask, space2) {
    let index2 = -1;
    super(property2, attribute);
    mark(this, "space", space2);
    if (typeof mask === "number") {
      while (++index2 < checks.length) {
        const check = checks[index2];
        mark(this, checks[index2], (mask & types[check]) === types[check]);
      }
    }
  }
}
DefinedInfo.prototype.defined = true;
function mark(values, key, value2) {
  if (value2) {
    values[key] = value2;
  }
}
function create(definition2) {
  const properties2 = {};
  const normals = {};
  for (const [property2, value2] of Object.entries(definition2.properties)) {
    const info = new DefinedInfo(
      property2,
      definition2.transform(definition2.attributes || {}, property2),
      value2,
      definition2.space
    );
    if (definition2.mustUseProperty && definition2.mustUseProperty.includes(property2)) {
      info.mustUseProperty = true;
    }
    properties2[property2] = info;
    normals[normalize$1(property2)] = property2;
    normals[normalize$1(info.attribute)] = property2;
  }
  return new Schema(properties2, normals, definition2.space);
}
const aria = create({
  properties: {
    ariaActiveDescendant: null,
    ariaAtomic: booleanish,
    ariaAutoComplete: null,
    ariaBusy: booleanish,
    ariaChecked: booleanish,
    ariaColCount: number3,
    ariaColIndex: number3,
    ariaColSpan: number3,
    ariaControls: spaceSeparated,
    ariaCurrent: null,
    ariaDescribedBy: spaceSeparated,
    ariaDetails: null,
    ariaDisabled: booleanish,
    ariaDropEffect: spaceSeparated,
    ariaErrorMessage: null,
    ariaExpanded: booleanish,
    ariaFlowTo: spaceSeparated,
    ariaGrabbed: booleanish,
    ariaHasPopup: null,
    ariaHidden: booleanish,
    ariaInvalid: null,
    ariaKeyShortcuts: null,
    ariaLabel: null,
    ariaLabelledBy: spaceSeparated,
    ariaLevel: number3,
    ariaLive: null,
    ariaModal: booleanish,
    ariaMultiLine: booleanish,
    ariaMultiSelectable: booleanish,
    ariaOrientation: null,
    ariaOwns: spaceSeparated,
    ariaPlaceholder: null,
    ariaPosInSet: number3,
    ariaPressed: booleanish,
    ariaReadOnly: booleanish,
    ariaRelevant: null,
    ariaRequired: booleanish,
    ariaRoleDescription: spaceSeparated,
    ariaRowCount: number3,
    ariaRowIndex: number3,
    ariaRowSpan: number3,
    ariaSelected: booleanish,
    ariaSetSize: number3,
    ariaSort: null,
    ariaValueMax: number3,
    ariaValueMin: number3,
    ariaValueNow: number3,
    ariaValueText: null,
    role: null
  },
  transform(_24, property2) {
    return property2 === "role" ? property2 : "aria-" + property2.slice(4).toLowerCase();
  }
});
function caseSensitiveTransform(attributes2, attribute) {
  return attribute in attributes2 ? attributes2[attribute] : attribute;
}
function caseInsensitiveTransform(attributes2, property2) {
  return caseSensitiveTransform(attributes2, property2.toLowerCase());
}
const html$2 = create({
  attributes: {
    acceptcharset: "accept-charset",
    classname: "class",
    htmlfor: "for",
    httpequiv: "http-equiv"
  },
  mustUseProperty: ["checked", "multiple", "muted", "selected"],
  properties: {
    // Standard Properties.
    abbr: null,
    accept: commaSeparated,
    acceptCharset: spaceSeparated,
    accessKey: spaceSeparated,
    action: null,
    allow: null,
    allowFullScreen: boolean2,
    allowPaymentRequest: boolean2,
    allowUserMedia: boolean2,
    alt: null,
    as: null,
    async: boolean2,
    autoCapitalize: null,
    autoComplete: spaceSeparated,
    autoFocus: boolean2,
    autoPlay: boolean2,
    blocking: spaceSeparated,
    capture: null,
    charSet: null,
    checked: boolean2,
    cite: null,
    className: spaceSeparated,
    cols: number3,
    colSpan: null,
    content: null,
    contentEditable: booleanish,
    controls: boolean2,
    controlsList: spaceSeparated,
    coords: number3 | commaSeparated,
    crossOrigin: null,
    data: null,
    dateTime: null,
    decoding: null,
    default: boolean2,
    defer: boolean2,
    dir: null,
    dirName: null,
    disabled: boolean2,
    download: overloadedBoolean,
    draggable: booleanish,
    encType: null,
    enterKeyHint: null,
    fetchPriority: null,
    form: null,
    formAction: null,
    formEncType: null,
    formMethod: null,
    formNoValidate: boolean2,
    formTarget: null,
    headers: spaceSeparated,
    height: number3,
    hidden: overloadedBoolean,
    high: number3,
    href: null,
    hrefLang: null,
    htmlFor: spaceSeparated,
    httpEquiv: spaceSeparated,
    id: null,
    imageSizes: null,
    imageSrcSet: null,
    inert: boolean2,
    inputMode: null,
    integrity: null,
    is: null,
    isMap: boolean2,
    itemId: null,
    itemProp: spaceSeparated,
    itemRef: spaceSeparated,
    itemScope: boolean2,
    itemType: spaceSeparated,
    kind: null,
    label: null,
    lang: null,
    language: null,
    list: null,
    loading: null,
    loop: boolean2,
    low: number3,
    manifest: null,
    max: null,
    maxLength: number3,
    media: null,
    method: null,
    min: null,
    minLength: number3,
    multiple: boolean2,
    muted: boolean2,
    name: null,
    nonce: null,
    noModule: boolean2,
    noValidate: boolean2,
    onAbort: null,
    onAfterPrint: null,
    onAuxClick: null,
    onBeforeMatch: null,
    onBeforePrint: null,
    onBeforeToggle: null,
    onBeforeUnload: null,
    onBlur: null,
    onCancel: null,
    onCanPlay: null,
    onCanPlayThrough: null,
    onChange: null,
    onClick: null,
    onClose: null,
    onContextLost: null,
    onContextMenu: null,
    onContextRestored: null,
    onCopy: null,
    onCueChange: null,
    onCut: null,
    onDblClick: null,
    onDrag: null,
    onDragEnd: null,
    onDragEnter: null,
    onDragExit: null,
    onDragLeave: null,
    onDragOver: null,
    onDragStart: null,
    onDrop: null,
    onDurationChange: null,
    onEmptied: null,
    onEnded: null,
    onError: null,
    onFocus: null,
    onFormData: null,
    onHashChange: null,
    onInput: null,
    onInvalid: null,
    onKeyDown: null,
    onKeyPress: null,
    onKeyUp: null,
    onLanguageChange: null,
    onLoad: null,
    onLoadedData: null,
    onLoadedMetadata: null,
    onLoadEnd: null,
    onLoadStart: null,
    onMessage: null,
    onMessageError: null,
    onMouseDown: null,
    onMouseEnter: null,
    onMouseLeave: null,
    onMouseMove: null,
    onMouseOut: null,
    onMouseOver: null,
    onMouseUp: null,
    onOffline: null,
    onOnline: null,
    onPageHide: null,
    onPageShow: null,
    onPaste: null,
    onPause: null,
    onPlay: null,
    onPlaying: null,
    onPopState: null,
    onProgress: null,
    onRateChange: null,
    onRejectionHandled: null,
    onReset: null,
    onResize: null,
    onScroll: null,
    onScrollEnd: null,
    onSecurityPolicyViolation: null,
    onSeeked: null,
    onSeeking: null,
    onSelect: null,
    onSlotChange: null,
    onStalled: null,
    onStorage: null,
    onSubmit: null,
    onSuspend: null,
    onTimeUpdate: null,
    onToggle: null,
    onUnhandledRejection: null,
    onUnload: null,
    onVolumeChange: null,
    onWaiting: null,
    onWheel: null,
    open: boolean2,
    optimum: number3,
    pattern: null,
    ping: spaceSeparated,
    placeholder: null,
    playsInline: boolean2,
    popover: null,
    popoverTarget: null,
    popoverTargetAction: null,
    poster: null,
    preload: null,
    readOnly: boolean2,
    referrerPolicy: null,
    rel: spaceSeparated,
    required: boolean2,
    reversed: boolean2,
    rows: number3,
    rowSpan: number3,
    sandbox: spaceSeparated,
    scope: null,
    scoped: boolean2,
    seamless: boolean2,
    selected: boolean2,
    shadowRootClonable: boolean2,
    shadowRootDelegatesFocus: boolean2,
    shadowRootMode: null,
    shape: null,
    size: number3,
    sizes: null,
    slot: null,
    span: number3,
    spellCheck: booleanish,
    src: null,
    srcDoc: null,
    srcLang: null,
    srcSet: null,
    start: number3,
    step: null,
    style: null,
    tabIndex: number3,
    target: null,
    title: null,
    translate: null,
    type: null,
    typeMustMatch: boolean2,
    useMap: null,
    value: booleanish,
    width: number3,
    wrap: null,
    writingSuggestions: null,
    // Legacy.
    // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
    align: null,
    // Several. Use CSS `text-align` instead,
    aLink: null,
    // `<body>`. Use CSS `a:active {color}` instead
    archive: spaceSeparated,
    // `<object>`. List of URIs to archives
    axis: null,
    // `<td>` and `<th>`. Use `scope` on `<th>`
    background: null,
    // `<body>`. Use CSS `background-image` instead
    bgColor: null,
    // `<body>` and table elements. Use CSS `background-color` instead
    border: number3,
    // `<table>`. Use CSS `border-width` instead,
    borderColor: null,
    // `<table>`. Use CSS `border-color` instead,
    bottomMargin: number3,
    // `<body>`
    cellPadding: null,
    // `<table>`
    cellSpacing: null,
    // `<table>`
    char: null,
    // Several table elements. When `align=char`, sets the character to align on
    charOff: null,
    // Several table elements. When `char`, offsets the alignment
    classId: null,
    // `<object>`
    clear: null,
    // `<br>`. Use CSS `clear` instead
    code: null,
    // `<object>`
    codeBase: null,
    // `<object>`
    codeType: null,
    // `<object>`
    color: null,
    // `<font>` and `<hr>`. Use CSS instead
    compact: boolean2,
    // Lists. Use CSS to reduce space between items instead
    declare: boolean2,
    // `<object>`
    event: null,
    // `<script>`
    face: null,
    // `<font>`. Use CSS instead
    frame: null,
    // `<table>`
    frameBorder: null,
    // `<iframe>`. Use CSS `border` instead
    hSpace: number3,
    // `<img>` and `<object>`
    leftMargin: number3,
    // `<body>`
    link: null,
    // `<body>`. Use CSS `a:link {color: *}` instead
    longDesc: null,
    // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
    lowSrc: null,
    // `<img>`. Use a `<picture>`
    marginHeight: number3,
    // `<body>`
    marginWidth: number3,
    // `<body>`
    noResize: boolean2,
    // `<frame>`
    noHref: boolean2,
    // `<area>`. Use no href instead of an explicit `nohref`
    noShade: boolean2,
    // `<hr>`. Use background-color and height instead of borders
    noWrap: boolean2,
    // `<td>` and `<th>`
    object: null,
    // `<applet>`
    profile: null,
    // `<head>`
    prompt: null,
    // `<isindex>`
    rev: null,
    // `<link>`
    rightMargin: number3,
    // `<body>`
    rules: null,
    // `<table>`
    scheme: null,
    // `<meta>`
    scrolling: booleanish,
    // `<frame>`. Use overflow in the child context
    standby: null,
    // `<object>`
    summary: null,
    // `<table>`
    text: null,
    // `<body>`. Use CSS `color` instead
    topMargin: number3,
    // `<body>`
    valueType: null,
    // `<param>`
    version: null,
    // `<html>`. Use a doctype.
    vAlign: null,
    // Several. Use CSS `vertical-align` instead
    vLink: null,
    // `<body>`. Use CSS `a:visited {color}` instead
    vSpace: number3,
    // `<img>` and `<object>`
    // Non-standard Properties.
    allowTransparency: null,
    autoCorrect: null,
    autoSave: null,
    disablePictureInPicture: boolean2,
    disableRemotePlayback: boolean2,
    prefix: null,
    property: null,
    results: number3,
    security: null,
    unselectable: null
  },
  space: "html",
  transform: caseInsensitiveTransform
});
const svg$1 = create({
  attributes: {
    accentHeight: "accent-height",
    alignmentBaseline: "alignment-baseline",
    arabicForm: "arabic-form",
    baselineShift: "baseline-shift",
    capHeight: "cap-height",
    className: "class",
    clipPath: "clip-path",
    clipRule: "clip-rule",
    colorInterpolation: "color-interpolation",
    colorInterpolationFilters: "color-interpolation-filters",
    colorProfile: "color-profile",
    colorRendering: "color-rendering",
    crossOrigin: "crossorigin",
    dataType: "datatype",
    dominantBaseline: "dominant-baseline",
    enableBackground: "enable-background",
    fillOpacity: "fill-opacity",
    fillRule: "fill-rule",
    floodColor: "flood-color",
    floodOpacity: "flood-opacity",
    fontFamily: "font-family",
    fontSize: "font-size",
    fontSizeAdjust: "font-size-adjust",
    fontStretch: "font-stretch",
    fontStyle: "font-style",
    fontVariant: "font-variant",
    fontWeight: "font-weight",
    glyphName: "glyph-name",
    glyphOrientationHorizontal: "glyph-orientation-horizontal",
    glyphOrientationVertical: "glyph-orientation-vertical",
    hrefLang: "hreflang",
    horizAdvX: "horiz-adv-x",
    horizOriginX: "horiz-origin-x",
    horizOriginY: "horiz-origin-y",
    imageRendering: "image-rendering",
    letterSpacing: "letter-spacing",
    lightingColor: "lighting-color",
    markerEnd: "marker-end",
    markerMid: "marker-mid",
    markerStart: "marker-start",
    navDown: "nav-down",
    navDownLeft: "nav-down-left",
    navDownRight: "nav-down-right",
    navLeft: "nav-left",
    navNext: "nav-next",
    navPrev: "nav-prev",
    navRight: "nav-right",
    navUp: "nav-up",
    navUpLeft: "nav-up-left",
    navUpRight: "nav-up-right",
    onAbort: "onabort",
    onActivate: "onactivate",
    onAfterPrint: "onafterprint",
    onBeforePrint: "onbeforeprint",
    onBegin: "onbegin",
    onCancel: "oncancel",
    onCanPlay: "oncanplay",
    onCanPlayThrough: "oncanplaythrough",
    onChange: "onchange",
    onClick: "onclick",
    onClose: "onclose",
    onCopy: "oncopy",
    onCueChange: "oncuechange",
    onCut: "oncut",
    onDblClick: "ondblclick",
    onDrag: "ondrag",
    onDragEnd: "ondragend",
    onDragEnter: "ondragenter",
    onDragExit: "ondragexit",
    onDragLeave: "ondragleave",
    onDragOver: "ondragover",
    onDragStart: "ondragstart",
    onDrop: "ondrop",
    onDurationChange: "ondurationchange",
    onEmptied: "onemptied",
    onEnd: "onend",
    onEnded: "onended",
    onError: "onerror",
    onFocus: "onfocus",
    onFocusIn: "onfocusin",
    onFocusOut: "onfocusout",
    onHashChange: "onhashchange",
    onInput: "oninput",
    onInvalid: "oninvalid",
    onKeyDown: "onkeydown",
    onKeyPress: "onkeypress",
    onKeyUp: "onkeyup",
    onLoad: "onload",
    onLoadedData: "onloadeddata",
    onLoadedMetadata: "onloadedmetadata",
    onLoadStart: "onloadstart",
    onMessage: "onmessage",
    onMouseDown: "onmousedown",
    onMouseEnter: "onmouseenter",
    onMouseLeave: "onmouseleave",
    onMouseMove: "onmousemove",
    onMouseOut: "onmouseout",
    onMouseOver: "onmouseover",
    onMouseUp: "onmouseup",
    onMouseWheel: "onmousewheel",
    onOffline: "onoffline",
    onOnline: "ononline",
    onPageHide: "onpagehide",
    onPageShow: "onpageshow",
    onPaste: "onpaste",
    onPause: "onpause",
    onPlay: "onplay",
    onPlaying: "onplaying",
    onPopState: "onpopstate",
    onProgress: "onprogress",
    onRateChange: "onratechange",
    onRepeat: "onrepeat",
    onReset: "onreset",
    onResize: "onresize",
    onScroll: "onscroll",
    onSeeked: "onseeked",
    onSeeking: "onseeking",
    onSelect: "onselect",
    onShow: "onshow",
    onStalled: "onstalled",
    onStorage: "onstorage",
    onSubmit: "onsubmit",
    onSuspend: "onsuspend",
    onTimeUpdate: "ontimeupdate",
    onToggle: "ontoggle",
    onUnload: "onunload",
    onVolumeChange: "onvolumechange",
    onWaiting: "onwaiting",
    onZoom: "onzoom",
    overlinePosition: "overline-position",
    overlineThickness: "overline-thickness",
    paintOrder: "paint-order",
    panose1: "panose-1",
    pointerEvents: "pointer-events",
    referrerPolicy: "referrerpolicy",
    renderingIntent: "rendering-intent",
    shapeRendering: "shape-rendering",
    stopColor: "stop-color",
    stopOpacity: "stop-opacity",
    strikethroughPosition: "strikethrough-position",
    strikethroughThickness: "strikethrough-thickness",
    strokeDashArray: "stroke-dasharray",
    strokeDashOffset: "stroke-dashoffset",
    strokeLineCap: "stroke-linecap",
    strokeLineJoin: "stroke-linejoin",
    strokeMiterLimit: "stroke-miterlimit",
    strokeOpacity: "stroke-opacity",
    strokeWidth: "stroke-width",
    tabIndex: "tabindex",
    textAnchor: "text-anchor",
    textDecoration: "text-decoration",
    textRendering: "text-rendering",
    transformOrigin: "transform-origin",
    typeOf: "typeof",
    underlinePosition: "underline-position",
    underlineThickness: "underline-thickness",
    unicodeBidi: "unicode-bidi",
    unicodeRange: "unicode-range",
    unitsPerEm: "units-per-em",
    vAlphabetic: "v-alphabetic",
    vHanging: "v-hanging",
    vIdeographic: "v-ideographic",
    vMathematical: "v-mathematical",
    vectorEffect: "vector-effect",
    vertAdvY: "vert-adv-y",
    vertOriginX: "vert-origin-x",
    vertOriginY: "vert-origin-y",
    wordSpacing: "word-spacing",
    writingMode: "writing-mode",
    xHeight: "x-height",
    // These were camelcased in Tiny. Now lowercased in SVG 2
    playbackOrder: "playbackorder",
    timelineBegin: "timelinebegin"
  },
  properties: {
    about: commaOrSpaceSeparated,
    accentHeight: number3,
    accumulate: null,
    additive: null,
    alignmentBaseline: null,
    alphabetic: number3,
    amplitude: number3,
    arabicForm: null,
    ascent: number3,
    attributeName: null,
    attributeType: null,
    azimuth: number3,
    bandwidth: null,
    baselineShift: null,
    baseFrequency: null,
    baseProfile: null,
    bbox: null,
    begin: null,
    bias: number3,
    by: null,
    calcMode: null,
    capHeight: number3,
    className: spaceSeparated,
    clip: null,
    clipPath: null,
    clipPathUnits: null,
    clipRule: null,
    color: null,
    colorInterpolation: null,
    colorInterpolationFilters: null,
    colorProfile: null,
    colorRendering: null,
    content: null,
    contentScriptType: null,
    contentStyleType: null,
    crossOrigin: null,
    cursor: null,
    cx: null,
    cy: null,
    d: null,
    dataType: null,
    defaultAction: null,
    descent: number3,
    diffuseConstant: number3,
    direction: null,
    display: null,
    dur: null,
    divisor: number3,
    dominantBaseline: null,
    download: boolean2,
    dx: null,
    dy: null,
    edgeMode: null,
    editable: null,
    elevation: number3,
    enableBackground: null,
    end: null,
    event: null,
    exponent: number3,
    externalResourcesRequired: null,
    fill: null,
    fillOpacity: number3,
    fillRule: null,
    filter: null,
    filterRes: null,
    filterUnits: null,
    floodColor: null,
    floodOpacity: null,
    focusable: null,
    focusHighlight: null,
    fontFamily: null,
    fontSize: null,
    fontSizeAdjust: null,
    fontStretch: null,
    fontStyle: null,
    fontVariant: null,
    fontWeight: null,
    format: null,
    fr: null,
    from: null,
    fx: null,
    fy: null,
    g1: commaSeparated,
    g2: commaSeparated,
    glyphName: commaSeparated,
    glyphOrientationHorizontal: null,
    glyphOrientationVertical: null,
    glyphRef: null,
    gradientTransform: null,
    gradientUnits: null,
    handler: null,
    hanging: number3,
    hatchContentUnits: null,
    hatchUnits: null,
    height: null,
    href: null,
    hrefLang: null,
    horizAdvX: number3,
    horizOriginX: number3,
    horizOriginY: number3,
    id: null,
    ideographic: number3,
    imageRendering: null,
    initialVisibility: null,
    in: null,
    in2: null,
    intercept: number3,
    k: number3,
    k1: number3,
    k2: number3,
    k3: number3,
    k4: number3,
    kernelMatrix: commaOrSpaceSeparated,
    kernelUnitLength: null,
    keyPoints: null,
    // SEMI_COLON_SEPARATED
    keySplines: null,
    // SEMI_COLON_SEPARATED
    keyTimes: null,
    // SEMI_COLON_SEPARATED
    kerning: null,
    lang: null,
    lengthAdjust: null,
    letterSpacing: null,
    lightingColor: null,
    limitingConeAngle: number3,
    local: null,
    markerEnd: null,
    markerMid: null,
    markerStart: null,
    markerHeight: null,
    markerUnits: null,
    markerWidth: null,
    mask: null,
    maskContentUnits: null,
    maskUnits: null,
    mathematical: null,
    max: null,
    media: null,
    mediaCharacterEncoding: null,
    mediaContentEncodings: null,
    mediaSize: number3,
    mediaTime: null,
    method: null,
    min: null,
    mode: null,
    name: null,
    navDown: null,
    navDownLeft: null,
    navDownRight: null,
    navLeft: null,
    navNext: null,
    navPrev: null,
    navRight: null,
    navUp: null,
    navUpLeft: null,
    navUpRight: null,
    numOctaves: null,
    observer: null,
    offset: null,
    onAbort: null,
    onActivate: null,
    onAfterPrint: null,
    onBeforePrint: null,
    onBegin: null,
    onCancel: null,
    onCanPlay: null,
    onCanPlayThrough: null,
    onChange: null,
    onClick: null,
    onClose: null,
    onCopy: null,
    onCueChange: null,
    onCut: null,
    onDblClick: null,
    onDrag: null,
    onDragEnd: null,
    onDragEnter: null,
    onDragExit: null,
    onDragLeave: null,
    onDragOver: null,
    onDragStart: null,
    onDrop: null,
    onDurationChange: null,
    onEmptied: null,
    onEnd: null,
    onEnded: null,
    onError: null,
    onFocus: null,
    onFocusIn: null,
    onFocusOut: null,
    onHashChange: null,
    onInput: null,
    onInvalid: null,
    onKeyDown: null,
    onKeyPress: null,
    onKeyUp: null,
    onLoad: null,
    onLoadedData: null,
    onLoadedMetadata: null,
    onLoadStart: null,
    onMessage: null,
    onMouseDown: null,
    onMouseEnter: null,
    onMouseLeave: null,
    onMouseMove: null,
    onMouseOut: null,
    onMouseOver: null,
    onMouseUp: null,
    onMouseWheel: null,
    onOffline: null,
    onOnline: null,
    onPageHide: null,
    onPageShow: null,
    onPaste: null,
    onPause: null,
    onPlay: null,
    onPlaying: null,
    onPopState: null,
    onProgress: null,
    onRateChange: null,
    onRepeat: null,
    onReset: null,
    onResize: null,
    onScroll: null,
    onSeeked: null,
    onSeeking: null,
    onSelect: null,
    onShow: null,
    onStalled: null,
    onStorage: null,
    onSubmit: null,
    onSuspend: null,
    onTimeUpdate: null,
    onToggle: null,
    onUnload: null,
    onVolumeChange: null,
    onWaiting: null,
    onZoom: null,
    opacity: null,
    operator: null,
    order: null,
    orient: null,
    orientation: null,
    origin: null,
    overflow: null,
    overlay: null,
    overlinePosition: number3,
    overlineThickness: number3,
    paintOrder: null,
    panose1: null,
    path: null,
    pathLength: number3,
    patternContentUnits: null,
    patternTransform: null,
    patternUnits: null,
    phase: null,
    ping: spaceSeparated,
    pitch: null,
    playbackOrder: null,
    pointerEvents: null,
    points: null,
    pointsAtX: number3,
    pointsAtY: number3,
    pointsAtZ: number3,
    preserveAlpha: null,
    preserveAspectRatio: null,
    primitiveUnits: null,
    propagate: null,
    property: commaOrSpaceSeparated,
    r: null,
    radius: null,
    referrerPolicy: null,
    refX: null,
    refY: null,
    rel: commaOrSpaceSeparated,
    rev: commaOrSpaceSeparated,
    renderingIntent: null,
    repeatCount: null,
    repeatDur: null,
    requiredExtensions: commaOrSpaceSeparated,
    requiredFeatures: commaOrSpaceSeparated,
    requiredFonts: commaOrSpaceSeparated,
    requiredFormats: commaOrSpaceSeparated,
    resource: null,
    restart: null,
    result: null,
    rotate: null,
    rx: null,
    ry: null,
    scale: null,
    seed: null,
    shapeRendering: null,
    side: null,
    slope: null,
    snapshotTime: null,
    specularConstant: number3,
    specularExponent: number3,
    spreadMethod: null,
    spacing: null,
    startOffset: null,
    stdDeviation: null,
    stemh: null,
    stemv: null,
    stitchTiles: null,
    stopColor: null,
    stopOpacity: null,
    strikethroughPosition: number3,
    strikethroughThickness: number3,
    string: null,
    stroke: null,
    strokeDashArray: commaOrSpaceSeparated,
    strokeDashOffset: null,
    strokeLineCap: null,
    strokeLineJoin: null,
    strokeMiterLimit: number3,
    strokeOpacity: number3,
    strokeWidth: null,
    style: null,
    surfaceScale: number3,
    syncBehavior: null,
    syncBehaviorDefault: null,
    syncMaster: null,
    syncTolerance: null,
    syncToleranceDefault: null,
    systemLanguage: commaOrSpaceSeparated,
    tabIndex: number3,
    tableValues: null,
    target: null,
    targetX: number3,
    targetY: number3,
    textAnchor: null,
    textDecoration: null,
    textRendering: null,
    textLength: null,
    timelineBegin: null,
    title: null,
    transformBehavior: null,
    type: null,
    typeOf: commaOrSpaceSeparated,
    to: null,
    transform: null,
    transformOrigin: null,
    u1: null,
    u2: null,
    underlinePosition: number3,
    underlineThickness: number3,
    unicode: null,
    unicodeBidi: null,
    unicodeRange: null,
    unitsPerEm: number3,
    values: null,
    vAlphabetic: number3,
    vMathematical: number3,
    vectorEffect: null,
    vHanging: number3,
    vIdeographic: number3,
    version: null,
    vertAdvY: number3,
    vertOriginX: number3,
    vertOriginY: number3,
    viewBox: null,
    viewTarget: null,
    visibility: null,
    width: null,
    widths: null,
    wordSpacing: null,
    writingMode: null,
    x: null,
    x1: null,
    x2: null,
    xChannelSelector: null,
    xHeight: number3,
    y: null,
    y1: null,
    y2: null,
    yChannelSelector: null,
    z: null,
    zoomAndPan: null
  },
  space: "svg",
  transform: caseSensitiveTransform
});
const xlink = create({
  properties: {
    xLinkActuate: null,
    xLinkArcRole: null,
    xLinkHref: null,
    xLinkRole: null,
    xLinkShow: null,
    xLinkTitle: null,
    xLinkType: null
  },
  space: "xlink",
  transform(_24, property2) {
    return "xlink:" + property2.slice(5).toLowerCase();
  }
});
const xmlns = create({
  attributes: { xmlnsxlink: "xmlns:xlink" },
  properties: { xmlnsXLink: null, xmlns: null },
  space: "xmlns",
  transform: caseInsensitiveTransform
});
const xml = create({
  properties: { xmlBase: null, xmlLang: null, xmlSpace: null },
  space: "xml",
  transform(_24, property2) {
    return "xml:" + property2.slice(3).toLowerCase();
  }
});
const hastToReact = {
  classId: "classID",
  dataType: "datatype",
  itemId: "itemID",
  strokeDashArray: "strokeDasharray",
  strokeDashOffset: "strokeDashoffset",
  strokeLineCap: "strokeLinecap",
  strokeLineJoin: "strokeLinejoin",
  strokeMiterLimit: "strokeMiterlimit",
  typeOf: "typeof",
  xLinkActuate: "xlinkActuate",
  xLinkArcRole: "xlinkArcrole",
  xLinkHref: "xlinkHref",
  xLinkRole: "xlinkRole",
  xLinkShow: "xlinkShow",
  xLinkTitle: "xlinkTitle",
  xLinkType: "xlinkType",
  xmlnsXLink: "xmlnsXlink"
};
const cap$1 = /[A-Z]/g;
const dash = /-[a-z]/g;
const valid = /^data[-\w.:]+$/i;
function find(schema, value2) {
  const normal = normalize$1(value2);
  let property2 = value2;
  let Type = Info;
  if (normal in schema.normal) {
    return schema.property[schema.normal[normal]];
  }
  if (normal.length > 4 && normal.slice(0, 4) === "data" && valid.test(value2)) {
    if (value2.charAt(4) === "-") {
      const rest = value2.slice(5).replace(dash, camelcase);
      property2 = "data" + rest.charAt(0).toUpperCase() + rest.slice(1);
    } else {
      const rest = value2.slice(4);
      if (!dash.test(rest)) {
        let dashes = rest.replace(cap$1, kebab);
        if (dashes.charAt(0) !== "-") {
          dashes = "-" + dashes;
        }
        value2 = "data" + dashes;
      }
    }
    Type = DefinedInfo;
  }
  return new Type(property2, value2);
}
function kebab($0) {
  return "-" + $0.toLowerCase();
}
function camelcase($0) {
  return $0.charAt(1).toUpperCase();
}
const html$1 = merge([aria, html$2, xlink, xmlns, xml], "html");
const svg = merge([aria, svg$1, xlink, xmlns, xml], "svg");
function stringify(values) {
  return values.join(" ").trim();
}
var cjs$1 = {};
var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
var NEWLINE_REGEX = /\n/g;
var WHITESPACE_REGEX = /^\s*/;
var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
var COLON_REGEX = /^:\s*/;
var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
var SEMICOLON_REGEX = /^[;\s]*/;
var TRIM_REGEX = /^\s+|\s+$/g;
var NEWLINE = "\n";
var FORWARD_SLASH = "/";
var ASTERISK = "*";
var EMPTY_STRING = "";
var TYPE_COMMENT = "comment";
var TYPE_DECLARATION = "declaration";
var inlineStyleParser = function(style2, options) {
  if (typeof style2 !== "string") {
    throw new TypeError("First argument must be a string");
  }
  if (!style2)
    return [];
  options = options || {};
  var lineno = 1;
  var column2 = 1;
  function updatePosition(str) {
    var lines = str.match(NEWLINE_REGEX);
    if (lines)
      lineno += lines.length;
    var i2 = str.lastIndexOf(NEWLINE);
    column2 = ~i2 ? str.length - i2 : column2 + str.length;
  }
  function position2() {
    var start = { line: lineno, column: column2 };
    return function(node2) {
      node2.position = new Position(start);
      whitespace3();
      return node2;
    };
  }
  function Position(start) {
    this.start = start;
    this.end = { line: lineno, column: column2 };
    this.source = options.source;
  }
  Position.prototype.content = style2;
  function error2(msg) {
    var err = new Error(
      options.source + ":" + lineno + ":" + column2 + ": " + msg
    );
    err.reason = msg;
    err.filename = options.source;
    err.line = lineno;
    err.column = column2;
    err.source = style2;
    if (options.silent)
      ;
    else {
      throw err;
    }
  }
  function match5(re2) {
    var m2 = re2.exec(style2);
    if (!m2)
      return;
    var str = m2[0];
    updatePosition(str);
    style2 = style2.slice(str.length);
    return m2;
  }
  function whitespace3() {
    match5(WHITESPACE_REGEX);
  }
  function comments(rules2) {
    var c2;
    rules2 = rules2 || [];
    while (c2 = comment2()) {
      if (c2 !== false) {
        rules2.push(c2);
      }
    }
    return rules2;
  }
  function comment2() {
    var pos = position2();
    if (FORWARD_SLASH != style2.charAt(0) || ASTERISK != style2.charAt(1))
      return;
    var i2 = 2;
    while (EMPTY_STRING != style2.charAt(i2) && (ASTERISK != style2.charAt(i2) || FORWARD_SLASH != style2.charAt(i2 + 1))) {
      ++i2;
    }
    i2 += 2;
    if (EMPTY_STRING === style2.charAt(i2 - 1)) {
      return error2("End of comment missing");
    }
    var str = style2.slice(2, i2 - 2);
    column2 += 2;
    updatePosition(str);
    style2 = style2.slice(i2);
    column2 += 2;
    return pos({
      type: TYPE_COMMENT,
      comment: str
    });
  }
  function declaration2() {
    var pos = position2();
    var prop = match5(PROPERTY_REGEX);
    if (!prop)
      return;
    comment2();
    if (!match5(COLON_REGEX))
      return error2("property missing ':'");
    var val = match5(VALUE_REGEX);
    var ret = pos({
      type: TYPE_DECLARATION,
      property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
      value: val ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING)) : EMPTY_STRING
    });
    match5(SEMICOLON_REGEX);
    return ret;
  }
  function declarations() {
    var decls = [];
    comments(decls);
    var decl;
    while (decl = declaration2()) {
      if (decl !== false) {
        decls.push(decl);
        comments(decls);
      }
    }
    return decls;
  }
  whitespace3();
  return declarations();
};
function trim(str) {
  return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
}
var __importDefault$1 = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
Object.defineProperty(cjs$1, "__esModule", { value: true });
cjs$1.default = StyleToObject;
var inline_style_parser_1 = __importDefault$1(inlineStyleParser);
function StyleToObject(style2, iterator2) {
  var styleObject = null;
  if (!style2 || typeof style2 !== "string") {
    return styleObject;
  }
  var declarations = (0, inline_style_parser_1.default)(style2);
  var hasIterator = typeof iterator2 === "function";
  declarations.forEach(function(declaration2) {
    if (declaration2.type !== "declaration") {
      return;
    }
    var property2 = declaration2.property, value2 = declaration2.value;
    if (hasIterator) {
      iterator2(property2, value2, declaration2);
    } else if (value2) {
      styleObject = styleObject || {};
      styleObject[property2] = value2;
    }
  });
  return styleObject;
}
var utilities = {};
Object.defineProperty(utilities, "__esModule", { value: true });
utilities.camelCase = void 0;
var CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9_-]+$/;
var HYPHEN_REGEX = /-([a-z])/g;
var NO_HYPHEN_REGEX = /^[^-]+$/;
var VENDOR_PREFIX_REGEX = /^-(webkit|moz|ms|o|khtml)-/;
var MS_VENDOR_PREFIX_REGEX = /^-(ms)-/;
var skipCamelCase = function(property2) {
  return !property2 || NO_HYPHEN_REGEX.test(property2) || CUSTOM_PROPERTY_REGEX.test(property2);
};
var capitalize = function(match5, character2) {
  return character2.toUpperCase();
};
var trimHyphen = function(match5, prefix) {
  return "".concat(prefix, "-");
};
var camelCase = function(property2, options) {
  if (options === void 0) {
    options = {};
  }
  if (skipCamelCase(property2)) {
    return property2;
  }
  property2 = property2.toLowerCase();
  if (options.reactCompat) {
    property2 = property2.replace(MS_VENDOR_PREFIX_REGEX, trimHyphen);
  } else {
    property2 = property2.replace(VENDOR_PREFIX_REGEX, trimHyphen);
  }
  return property2.replace(HYPHEN_REGEX, capitalize);
};
utilities.camelCase = camelCase;
var __importDefault = commonjsGlobal && commonjsGlobal.__importDefault || function(mod2) {
  return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
};
var style_to_object_1 = __importDefault(cjs$1);
var utilities_1 = utilities;
function StyleToJS(style2, options) {
  var output2 = {};
  if (!style2 || typeof style2 !== "string") {
    return output2;
  }
  (0, style_to_object_1.default)(style2, function(property2, value2) {
    if (property2 && value2) {
      output2[(0, utilities_1.camelCase)(property2, options)] = value2;
    }
  });
  return output2;
}
StyleToJS.default = StyleToJS;
var cjs = StyleToJS;
const styleToJs = /* @__PURE__ */ getDefaultExportFromCjs(cjs);
const pointEnd = point$2("end");
const pointStart = point$2("start");
function point$2(type4) {
  return point2;
  function point2(node2) {
    const point3 = node2 && node2.position && node2.position[type4] || {};
    if (typeof point3.line === "number" && point3.line > 0 && typeof point3.column === "number" && point3.column > 0) {
      return {
        line: point3.line,
        column: point3.column,
        offset: typeof point3.offset === "number" && point3.offset > -1 ? point3.offset : void 0
      };
    }
  }
}
function position$1(node2) {
  const start = pointStart(node2);
  const end = pointEnd(node2);
  if (start && end) {
    return { start, end };
  }
}
function stringifyPosition(value2) {
  if (!value2 || typeof value2 !== "object") {
    return "";
  }
  if ("position" in value2 || "type" in value2) {
    return position(value2.position);
  }
  if ("start" in value2 || "end" in value2) {
    return position(value2);
  }
  if ("line" in value2 || "column" in value2) {
    return point$1(value2);
  }
  return "";
}
function point$1(point2) {
  return index(point2 && point2.line) + ":" + index(point2 && point2.column);
}
function position(pos) {
  return point$1(pos && pos.start) + "-" + point$1(pos && pos.end);
}
function index(value2) {
  return value2 && typeof value2 === "number" ? value2 : 1;
}
class VFileMessage extends Error {
  /**
   * Create a message for `reason`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {Options | null | undefined} [options]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns
   *   Instance of `VFileMessage`.
   */
  // eslint-disable-next-line complexity
  constructor(causeOrReason, optionsOrParentOrPlace, origin2) {
    super();
    if (typeof optionsOrParentOrPlace === "string") {
      origin2 = optionsOrParentOrPlace;
      optionsOrParentOrPlace = void 0;
    }
    let reason = "";
    let options = {};
    let legacyCause = false;
    if (optionsOrParentOrPlace) {
      if ("line" in optionsOrParentOrPlace && "column" in optionsOrParentOrPlace) {
        options = { place: optionsOrParentOrPlace };
      } else if ("start" in optionsOrParentOrPlace && "end" in optionsOrParentOrPlace) {
        options = { place: optionsOrParentOrPlace };
      } else if ("type" in optionsOrParentOrPlace) {
        options = {
          ancestors: [optionsOrParentOrPlace],
          place: optionsOrParentOrPlace.position
        };
      } else {
        options = { ...optionsOrParentOrPlace };
      }
    }
    if (typeof causeOrReason === "string") {
      reason = causeOrReason;
    } else if (!options.cause && causeOrReason) {
      legacyCause = true;
      reason = causeOrReason.message;
      options.cause = causeOrReason;
    }
    if (!options.ruleId && !options.source && typeof origin2 === "string") {
      const index2 = origin2.indexOf(":");
      if (index2 === -1) {
        options.ruleId = origin2;
      } else {
        options.source = origin2.slice(0, index2);
        options.ruleId = origin2.slice(index2 + 1);
      }
    }
    if (!options.place && options.ancestors && options.ancestors) {
      const parent = options.ancestors[options.ancestors.length - 1];
      if (parent) {
        options.place = parent.position;
      }
    }
    const start = options.place && "start" in options.place ? options.place.start : options.place;
    this.ancestors = options.ancestors || void 0;
    this.cause = options.cause || void 0;
    this.column = start ? start.column : void 0;
    this.fatal = void 0;
    this.file = "";
    this.message = reason;
    this.line = start ? start.line : void 0;
    this.name = stringifyPosition(options.place) || "1:1";
    this.place = options.place || void 0;
    this.reason = this.message;
    this.ruleId = options.ruleId || void 0;
    this.source = options.source || void 0;
    this.stack = legacyCause && options.cause && typeof options.cause.stack === "string" ? options.cause.stack : "";
    this.actual = void 0;
    this.expected = void 0;
    this.note = void 0;
    this.url = void 0;
  }
}
VFileMessage.prototype.file = "";
VFileMessage.prototype.name = "";
VFileMessage.prototype.reason = "";
VFileMessage.prototype.message = "";
VFileMessage.prototype.stack = "";
VFileMessage.prototype.column = void 0;
VFileMessage.prototype.line = void 0;
VFileMessage.prototype.ancestors = void 0;
VFileMessage.prototype.cause = void 0;
VFileMessage.prototype.fatal = void 0;
VFileMessage.prototype.place = void 0;
VFileMessage.prototype.ruleId = void 0;
VFileMessage.prototype.source = void 0;
const own$3 = {}.hasOwnProperty;
const emptyMap = /* @__PURE__ */ new Map();
const cap = /[A-Z]/g;
const tableElements = /* @__PURE__ */ new Set(["table", "tbody", "thead", "tfoot", "tr"]);
const tableCellElement = /* @__PURE__ */ new Set(["td", "th"]);
const docs = "https://github.com/syntax-tree/hast-util-to-jsx-runtime";
function toJsxRuntime(tree, options) {
  if (!options || options.Fragment === void 0) {
    throw new TypeError("Expected `Fragment` in options");
  }
  const filePath = options.filePath || void 0;
  let create2;
  if (options.development) {
    if (typeof options.jsxDEV !== "function") {
      throw new TypeError(
        "Expected `jsxDEV` in options when `development: true`"
      );
    }
    create2 = developmentCreate(filePath, options.jsxDEV);
  } else {
    if (typeof options.jsx !== "function") {
      throw new TypeError("Expected `jsx` in production options");
    }
    if (typeof options.jsxs !== "function") {
      throw new TypeError("Expected `jsxs` in production options");
    }
    create2 = productionCreate(filePath, options.jsx, options.jsxs);
  }
  const state = {
    Fragment: options.Fragment,
    ancestors: [],
    components: options.components || {},
    create: create2,
    elementAttributeNameCase: options.elementAttributeNameCase || "react",
    evaluater: options.createEvaluater ? options.createEvaluater() : void 0,
    filePath,
    ignoreInvalidStyle: options.ignoreInvalidStyle || false,
    passKeys: options.passKeys !== false,
    passNode: options.passNode || false,
    schema: options.space === "svg" ? svg : html$1,
    stylePropertyNameCase: options.stylePropertyNameCase || "dom",
    tableCellAlignToStyle: options.tableCellAlignToStyle !== false
  };
  const result = one$1(state, tree, void 0);
  if (result && typeof result !== "string") {
    return result;
  }
  return state.create(
    tree,
    state.Fragment,
    { children: result || void 0 },
    void 0
  );
}
function one$1(state, node2, key) {
  if (node2.type === "element") {
    return element$1(state, node2, key);
  }
  if (node2.type === "mdxFlowExpression" || node2.type === "mdxTextExpression") {
    return mdxExpression(state, node2);
  }
  if (node2.type === "mdxJsxFlowElement" || node2.type === "mdxJsxTextElement") {
    return mdxJsxElement(state, node2, key);
  }
  if (node2.type === "mdxjsEsm") {
    return mdxEsm(state, node2);
  }
  if (node2.type === "root") {
    return root$1(state, node2, key);
  }
  if (node2.type === "text") {
    return text$3(state, node2);
  }
}
function element$1(state, node2, key) {
  const parentSchema = state.schema;
  let schema = parentSchema;
  if (node2.tagName.toLowerCase() === "svg" && parentSchema.space === "html") {
    schema = svg;
    state.schema = schema;
  }
  state.ancestors.push(node2);
  const type4 = findComponentFromName(state, node2.tagName, false);
  const props = createElementProps(state, node2);
  let children = createChildren(state, node2);
  if (tableElements.has(node2.tagName)) {
    children = children.filter(function(child) {
      return typeof child === "string" ? !whitespace2(child) : true;
    });
  }
  addNode(state, props, type4, node2);
  addChildren(props, children);
  state.ancestors.pop();
  state.schema = parentSchema;
  return state.create(node2, type4, props, key);
}
function mdxExpression(state, node2) {
  if (node2.data && node2.data.estree && state.evaluater) {
    const program = node2.data.estree;
    const expression = program.body[0];
    ok$1(expression.type === "ExpressionStatement");
    return (
      /** @type {Child | undefined} */
      state.evaluater.evaluateExpression(expression.expression)
    );
  }
  crashEstree(state, node2.position);
}
function mdxEsm(state, node2) {
  if (node2.data && node2.data.estree && state.evaluater) {
    return (
      /** @type {Child | undefined} */
      state.evaluater.evaluateProgram(node2.data.estree)
    );
  }
  crashEstree(state, node2.position);
}
function mdxJsxElement(state, node2, key) {
  const parentSchema = state.schema;
  let schema = parentSchema;
  if (node2.name === "svg" && parentSchema.space === "html") {
    schema = svg;
    state.schema = schema;
  }
  state.ancestors.push(node2);
  const type4 = node2.name === null ? state.Fragment : findComponentFromName(state, node2.name, true);
  const props = createJsxElementProps(state, node2);
  const children = createChildren(state, node2);
  addNode(state, props, type4, node2);
  addChildren(props, children);
  state.ancestors.pop();
  state.schema = parentSchema;
  return state.create(node2, type4, props, key);
}
function root$1(state, node2, key) {
  const props = {};
  addChildren(props, createChildren(state, node2));
  return state.create(node2, state.Fragment, props, key);
}
function text$3(_24, node2) {
  return node2.value;
}
function addNode(state, props, type4, node2) {
  if (typeof type4 !== "string" && type4 !== state.Fragment && state.passNode) {
    props.node = node2;
  }
}
function addChildren(props, children) {
  if (children.length > 0) {
    const value2 = children.length > 1 ? children : children[0];
    if (value2) {
      props.children = value2;
    }
  }
}
function productionCreate(_24, jsx, jsxs) {
  return create2;
  function create2(_25, type4, props, key) {
    const isStaticChildren = Array.isArray(props.children);
    const fn = isStaticChildren ? jsxs : jsx;
    return key ? fn(type4, props, key) : fn(type4, props);
  }
}
function developmentCreate(filePath, jsxDEV) {
  return create2;
  function create2(node2, type4, props, key) {
    const isStaticChildren = Array.isArray(props.children);
    const point2 = pointStart(node2);
    return jsxDEV(
      type4,
      props,
      key,
      isStaticChildren,
      {
        columnNumber: point2 ? point2.column - 1 : void 0,
        fileName: filePath,
        lineNumber: point2 ? point2.line : void 0
      },
      void 0
    );
  }
}
function createElementProps(state, node2) {
  const props = {};
  let alignValue;
  let prop;
  for (prop in node2.properties) {
    if (prop !== "children" && own$3.call(node2.properties, prop)) {
      const result = createProperty(state, prop, node2.properties[prop]);
      if (result) {
        const [key, value2] = result;
        if (state.tableCellAlignToStyle && key === "align" && typeof value2 === "string" && tableCellElement.has(node2.tagName)) {
          alignValue = value2;
        } else {
          props[key] = value2;
        }
      }
    }
  }
  if (alignValue) {
    const style2 = (
      /** @type {Style} */
      props.style || (props.style = {})
    );
    style2[state.stylePropertyNameCase === "css" ? "text-align" : "textAlign"] = alignValue;
  }
  return props;
}
function createJsxElementProps(state, node2) {
  const props = {};
  for (const attribute of node2.attributes) {
    if (attribute.type === "mdxJsxExpressionAttribute") {
      if (attribute.data && attribute.data.estree && state.evaluater) {
        const program = attribute.data.estree;
        const expression = program.body[0];
        ok$1(expression.type === "ExpressionStatement");
        const objectExpression = expression.expression;
        ok$1(objectExpression.type === "ObjectExpression");
        const property2 = objectExpression.properties[0];
        ok$1(property2.type === "SpreadElement");
        Object.assign(
          props,
          state.evaluater.evaluateExpression(property2.argument)
        );
      } else {
        crashEstree(state, node2.position);
      }
    } else {
      const name2 = attribute.name;
      let value2;
      if (attribute.value && typeof attribute.value === "object") {
        if (attribute.value.data && attribute.value.data.estree && state.evaluater) {
          const program = attribute.value.data.estree;
          const expression = program.body[0];
          ok$1(expression.type === "ExpressionStatement");
          value2 = state.evaluater.evaluateExpression(expression.expression);
        } else {
          crashEstree(state, node2.position);
        }
      } else {
        value2 = attribute.value === null ? true : attribute.value;
      }
      props[name2] = /** @type {Props[keyof Props]} */
      value2;
    }
  }
  return props;
}
function createChildren(state, node2) {
  const children = [];
  let index2 = -1;
  const countsByName = state.passKeys ? /* @__PURE__ */ new Map() : emptyMap;
  while (++index2 < node2.children.length) {
    const child = node2.children[index2];
    let key;
    if (state.passKeys) {
      const name2 = child.type === "element" ? child.tagName : child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement" ? child.name : void 0;
      if (name2) {
        const count = countsByName.get(name2) || 0;
        key = name2 + "-" + count;
        countsByName.set(name2, count + 1);
      }
    }
    const result = one$1(state, child, key);
    if (result !== void 0)
      children.push(result);
  }
  return children;
}
function createProperty(state, prop, value2) {
  const info = find(state.schema, prop);
  if (value2 === null || value2 === void 0 || typeof value2 === "number" && Number.isNaN(value2)) {
    return;
  }
  if (Array.isArray(value2)) {
    value2 = info.commaSeparated ? stringify$1(value2) : stringify(value2);
  }
  if (info.property === "style") {
    let styleObject = typeof value2 === "object" ? value2 : parseStyle(state, String(value2));
    if (state.stylePropertyNameCase === "css") {
      styleObject = transformStylesToCssCasing(styleObject);
    }
    return ["style", styleObject];
  }
  return [
    state.elementAttributeNameCase === "react" && info.space ? hastToReact[info.property] || info.property : info.attribute,
    value2
  ];
}
function parseStyle(state, value2) {
  try {
    return styleToJs(value2, { reactCompat: true });
  } catch (error2) {
    if (state.ignoreInvalidStyle) {
      return {};
    }
    const cause = (
      /** @type {Error} */
      error2
    );
    const message = new VFileMessage("Cannot parse `style` attribute", {
      ancestors: state.ancestors,
      cause,
      ruleId: "style",
      source: "hast-util-to-jsx-runtime"
    });
    message.file = state.filePath || void 0;
    message.url = docs + "#cannot-parse-style-attribute";
    throw message;
  }
}
function findComponentFromName(state, name$1, allowExpression) {
  let result;
  if (!allowExpression) {
    result = { type: "Literal", value: name$1 };
  } else if (name$1.includes(".")) {
    const identifiers = name$1.split(".");
    let index2 = -1;
    let node2;
    while (++index2 < identifiers.length) {
      const prop = name(identifiers[index2]) ? { type: "Identifier", name: identifiers[index2] } : { type: "Literal", value: identifiers[index2] };
      node2 = node2 ? {
        type: "MemberExpression",
        object: node2,
        property: prop,
        computed: Boolean(index2 && prop.type === "Literal"),
        optional: false
      } : prop;
    }
    result = node2;
  } else {
    result = name(name$1) && !/^[a-z]/.test(name$1) ? { type: "Identifier", name: name$1 } : { type: "Literal", value: name$1 };
  }
  if (result.type === "Literal") {
    const name2 = (
      /** @type {string | number} */
      result.value
    );
    return own$3.call(state.components, name2) ? state.components[name2] : name2;
  }
  if (state.evaluater) {
    return state.evaluater.evaluateExpression(result);
  }
  crashEstree(state);
}
function crashEstree(state, place) {
  const message = new VFileMessage(
    "Cannot handle MDX estrees without `createEvaluater`",
    {
      ancestors: state.ancestors,
      place,
      ruleId: "mdx-estree",
      source: "hast-util-to-jsx-runtime"
    }
  );
  message.file = state.filePath || void 0;
  message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
  throw message;
}
function transformStylesToCssCasing(domCasing) {
  const cssCasing = {};
  let from2;
  for (from2 in domCasing) {
    if (own$3.call(domCasing, from2)) {
      cssCasing[transformStyleToCssCasing(from2)] = domCasing[from2];
    }
  }
  return cssCasing;
}
function transformStyleToCssCasing(from2) {
  let to2 = from2.replace(cap, toDash);
  if (to2.slice(0, 3) === "ms-")
    to2 = "-" + to2;
  return to2;
}
function toDash($0) {
  return "-" + $0.toLowerCase();
}
const urlAttributes = {
  action: ["form"],
  cite: ["blockquote", "del", "ins", "q"],
  data: ["object"],
  formAction: ["button", "input"],
  href: ["a", "area", "base", "link"],
  icon: ["menuitem"],
  itemId: null,
  manifest: ["html"],
  ping: ["a", "area"],
  poster: ["video"],
  src: [
    "audio",
    "embed",
    "iframe",
    "img",
    "input",
    "script",
    "source",
    "track",
    "video"
  ]
};
const emptyOptions$1 = {};
function toString$1(value2, options) {
  const settings = emptyOptions$1;
  const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
  const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
  return one(value2, includeImageAlt, includeHtml);
}
function one(value2, includeImageAlt, includeHtml) {
  if (node(value2)) {
    if ("value" in value2) {
      return value2.type === "html" && !includeHtml ? "" : value2.value;
    }
    if (includeImageAlt && "alt" in value2 && value2.alt) {
      return value2.alt;
    }
    if ("children" in value2) {
      return all2(value2.children, includeImageAlt, includeHtml);
    }
  }
  if (Array.isArray(value2)) {
    return all2(value2, includeImageAlt, includeHtml);
  }
  return "";
}
function all2(values, includeImageAlt, includeHtml) {
  const result = [];
  let index2 = -1;
  while (++index2 < values.length) {
    result[index2] = one(values[index2], includeImageAlt, includeHtml);
  }
  return result.join("");
}
function node(value2) {
  return Boolean(value2 && typeof value2 === "object");
}
const element = document.createElement("i");
function decodeNamedCharacterReference(value2) {
  const characterReference2 = "&" + value2 + ";";
  element.innerHTML = characterReference2;
  const character2 = element.textContent;
  if (
    // @ts-expect-error: TypeScript is wrong that `textContent` on elements can
    // yield `null`.
    character2.charCodeAt(character2.length - 1) === 59 && value2 !== "semi"
  ) {
    return false;
  }
  return character2 === characterReference2 ? false : character2;
}
function splice(list2, start, remove, items) {
  const end = list2.length;
  let chunkStart = 0;
  let parameters;
  if (start < 0) {
    start = -start > end ? 0 : end + start;
  } else {
    start = start > end ? end : start;
  }
  remove = remove > 0 ? remove : 0;
  if (items.length < 1e4) {
    parameters = Array.from(items);
    parameters.unshift(start, remove);
    list2.splice(...parameters);
  } else {
    if (remove)
      list2.splice(start, remove);
    while (chunkStart < items.length) {
      parameters = items.slice(chunkStart, chunkStart + 1e4);
      parameters.unshift(start, 0);
      list2.splice(...parameters);
      chunkStart += 1e4;
      start += 1e4;
    }
  }
}
function push(list2, items) {
  if (list2.length > 0) {
    splice(list2, list2.length, 0, items);
    return list2;
  }
  return items;
}
const hasOwnProperty = {}.hasOwnProperty;
function combineExtensions(extensions) {
  const all3 = {};
  let index2 = -1;
  while (++index2 < extensions.length) {
    syntaxExtension(all3, extensions[index2]);
  }
  return all3;
}
function syntaxExtension(all3, extension2) {
  let hook;
  for (hook in extension2) {
    const maybe = hasOwnProperty.call(all3, hook) ? all3[hook] : void 0;
    const left2 = maybe || (all3[hook] = {});
    const right = extension2[hook];
    let code2;
    if (right) {
      for (code2 in right) {
        if (!hasOwnProperty.call(left2, code2))
          left2[code2] = [];
        const value2 = right[code2];
        constructs(
          // @ts-expect-error Looks like a list.
          left2[code2],
          Array.isArray(value2) ? value2 : value2 ? [value2] : []
        );
      }
    }
  }
}
function constructs(existing, list2) {
  let index2 = -1;
  const before = [];
  while (++index2 < list2.length) {
    (list2[index2].add === "after" ? existing : before).push(list2[index2]);
  }
  splice(existing, 0, 0, before);
}
function decodeNumericCharacterReference(value2, base) {
  const code2 = Number.parseInt(value2, base);
  if (
    // C0 except for HT, LF, FF, CR, space.
    code2 < 9 || code2 === 11 || code2 > 13 && code2 < 32 || // Control character (DEL) of C0, and C1 controls.
    code2 > 126 && code2 < 160 || // Lone high surrogates and low surrogates.
    code2 > 55295 && code2 < 57344 || // Noncharacters.
    code2 > 64975 && code2 < 65008 || /* eslint-disable no-bitwise */
    (code2 & 65535) === 65535 || (code2 & 65535) === 65534 || /* eslint-enable no-bitwise */
    // Out of range
    code2 > 1114111
  ) {
    return "�";
  }
  return String.fromCodePoint(code2);
}
function normalizeIdentifier(value2) {
  return value2.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
}
const asciiAlpha = regexCheck(/[A-Za-z]/);
const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
function asciiControl(code2) {
  return (
    // Special whitespace codes (which have negative values), C0 and Control
    // character DEL
    code2 !== null && (code2 < 32 || code2 === 127)
  );
}
const asciiDigit = regexCheck(/\d/);
const asciiHexDigit = regexCheck(/[\dA-Fa-f]/);
const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/);
function markdownLineEnding(code2) {
  return code2 !== null && code2 < -2;
}
function markdownLineEndingOrSpace(code2) {
  return code2 !== null && (code2 < 0 || code2 === 32);
}
function markdownSpace(code2) {
  return code2 === -2 || code2 === -1 || code2 === 32;
}
const unicodePunctuation = regexCheck(new RegExp("\\p{P}|\\p{S}", "u"));
const unicodeWhitespace = regexCheck(/\s/);
function regexCheck(regex2) {
  return check;
  function check(code2) {
    return code2 !== null && code2 > -1 && regex2.test(String.fromCharCode(code2));
  }
}
function normalizeUri(value2) {
  const result = [];
  let index2 = -1;
  let start = 0;
  let skip2 = 0;
  while (++index2 < value2.length) {
    const code2 = value2.charCodeAt(index2);
    let replace2 = "";
    if (code2 === 37 && asciiAlphanumeric(value2.charCodeAt(index2 + 1)) && asciiAlphanumeric(value2.charCodeAt(index2 + 2))) {
      skip2 = 2;
    } else if (code2 < 128) {
      if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code2))) {
        replace2 = String.fromCharCode(code2);
      }
    } else if (code2 > 55295 && code2 < 57344) {
      const next2 = value2.charCodeAt(index2 + 1);
      if (code2 < 56320 && next2 > 56319 && next2 < 57344) {
        replace2 = String.fromCharCode(code2, next2);
        skip2 = 1;
      } else {
        replace2 = "�";
      }
    } else {
      replace2 = String.fromCharCode(code2);
    }
    if (replace2) {
      result.push(value2.slice(start, index2), encodeURIComponent(replace2));
      start = index2 + skip2 + 1;
      replace2 = "";
    }
    if (skip2) {
      index2 += skip2;
      skip2 = 0;
    }
  }
  return result.join("") + value2.slice(start);
}
function factorySpace(effects2, ok2, type4, max2) {
  const limit2 = max2 ? max2 - 1 : Number.POSITIVE_INFINITY;
  let size2 = 0;
  return start;
  function start(code2) {
    if (markdownSpace(code2)) {
      effects2.enter(type4);
      return prefix(code2);
    }
    return ok2(code2);
  }
  function prefix(code2) {
    if (markdownSpace(code2) && size2++ < limit2) {
      effects2.consume(code2);
      return prefix;
    }
    effects2.exit(type4);
    return ok2(code2);
  }
}
const content$1 = {
  tokenize: initializeContent
};
function initializeContent(effects2) {
  const contentStart = effects2.attempt(this.parser.constructs.contentInitial, afterContentStartConstruct, paragraphInitial);
  let previous2;
  return contentStart;
  function afterContentStartConstruct(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, contentStart, "linePrefix");
  }
  function paragraphInitial(code2) {
    effects2.enter("paragraph");
    return lineStart(code2);
  }
  function lineStart(code2) {
    const token2 = effects2.enter("chunkText", {
      contentType: "text",
      previous: previous2
    });
    if (previous2) {
      previous2.next = token2;
    }
    previous2 = token2;
    return data(code2);
  }
  function data(code2) {
    if (code2 === null) {
      effects2.exit("chunkText");
      effects2.exit("paragraph");
      effects2.consume(code2);
      return;
    }
    if (markdownLineEnding(code2)) {
      effects2.consume(code2);
      effects2.exit("chunkText");
      return lineStart;
    }
    effects2.consume(code2);
    return data;
  }
}
const document$2 = {
  tokenize: initializeDocument
};
const containerConstruct = {
  tokenize: tokenizeContainer
};
function initializeDocument(effects2) {
  const self2 = this;
  const stack = [];
  let continued = 0;
  let childFlow;
  let childToken;
  let lineStartOffset;
  return start;
  function start(code2) {
    if (continued < stack.length) {
      const item = stack[continued];
      self2.containerState = item[1];
      return effects2.attempt(item[0].continuation, documentContinue, checkNewContainers)(code2);
    }
    return checkNewContainers(code2);
  }
  function documentContinue(code2) {
    continued++;
    if (self2.containerState._closeFlow) {
      self2.containerState._closeFlow = void 0;
      if (childFlow) {
        closeFlow();
      }
      const indexBeforeExits = self2.events.length;
      let indexBeforeFlow = indexBeforeExits;
      let point2;
      while (indexBeforeFlow--) {
        if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
          point2 = self2.events[indexBeforeFlow][1].end;
          break;
        }
      }
      exitContainers(continued);
      let index2 = indexBeforeExits;
      while (index2 < self2.events.length) {
        self2.events[index2][1].end = {
          ...point2
        };
        index2++;
      }
      splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
      self2.events.length = index2;
      return checkNewContainers(code2);
    }
    return start(code2);
  }
  function checkNewContainers(code2) {
    if (continued === stack.length) {
      if (!childFlow) {
        return documentContinued(code2);
      }
      if (childFlow.currentConstruct && childFlow.currentConstruct.concrete) {
        return flowStart(code2);
      }
      self2.interrupt = Boolean(childFlow.currentConstruct && !childFlow._gfmTableDynamicInterruptHack);
    }
    self2.containerState = {};
    return effects2.check(containerConstruct, thereIsANewContainer, thereIsNoNewContainer)(code2);
  }
  function thereIsANewContainer(code2) {
    if (childFlow)
      closeFlow();
    exitContainers(continued);
    return documentContinued(code2);
  }
  function thereIsNoNewContainer(code2) {
    self2.parser.lazy[self2.now().line] = continued !== stack.length;
    lineStartOffset = self2.now().offset;
    return flowStart(code2);
  }
  function documentContinued(code2) {
    self2.containerState = {};
    return effects2.attempt(containerConstruct, containerContinue, flowStart)(code2);
  }
  function containerContinue(code2) {
    continued++;
    stack.push([self2.currentConstruct, self2.containerState]);
    return documentContinued(code2);
  }
  function flowStart(code2) {
    if (code2 === null) {
      if (childFlow)
        closeFlow();
      exitContainers(0);
      effects2.consume(code2);
      return;
    }
    childFlow = childFlow || self2.parser.flow(self2.now());
    effects2.enter("chunkFlow", {
      _tokenizer: childFlow,
      contentType: "flow",
      previous: childToken
    });
    return flowContinue(code2);
  }
  function flowContinue(code2) {
    if (code2 === null) {
      writeToChild(effects2.exit("chunkFlow"), true);
      exitContainers(0);
      effects2.consume(code2);
      return;
    }
    if (markdownLineEnding(code2)) {
      effects2.consume(code2);
      writeToChild(effects2.exit("chunkFlow"));
      continued = 0;
      self2.interrupt = void 0;
      return start;
    }
    effects2.consume(code2);
    return flowContinue;
  }
  function writeToChild(token2, endOfFile) {
    const stream = self2.sliceStream(token2);
    if (endOfFile)
      stream.push(null);
    token2.previous = childToken;
    if (childToken)
      childToken.next = token2;
    childToken = token2;
    childFlow.defineSkip(token2.start);
    childFlow.write(stream);
    if (self2.parser.lazy[token2.start.line]) {
      let index2 = childFlow.events.length;
      while (index2--) {
        if (
          // The token starts before the line ending…
          childFlow.events[index2][1].start.offset < lineStartOffset && // …and either is not ended yet…
          (!childFlow.events[index2][1].end || // …or ends after it.
          childFlow.events[index2][1].end.offset > lineStartOffset)
        ) {
          return;
        }
      }
      const indexBeforeExits = self2.events.length;
      let indexBeforeFlow = indexBeforeExits;
      let seen2;
      let point2;
      while (indexBeforeFlow--) {
        if (self2.events[indexBeforeFlow][0] === "exit" && self2.events[indexBeforeFlow][1].type === "chunkFlow") {
          if (seen2) {
            point2 = self2.events[indexBeforeFlow][1].end;
            break;
          }
          seen2 = true;
        }
      }
      exitContainers(continued);
      index2 = indexBeforeExits;
      while (index2 < self2.events.length) {
        self2.events[index2][1].end = {
          ...point2
        };
        index2++;
      }
      splice(self2.events, indexBeforeFlow + 1, 0, self2.events.slice(indexBeforeExits));
      self2.events.length = index2;
    }
  }
  function exitContainers(size2) {
    let index2 = stack.length;
    while (index2-- > size2) {
      const entry = stack[index2];
      self2.containerState = entry[1];
      entry[0].exit.call(self2, effects2);
    }
    stack.length = size2;
  }
  function closeFlow() {
    childFlow.write([null]);
    childToken = void 0;
    childFlow = void 0;
    self2.containerState._closeFlow = void 0;
  }
}
function tokenizeContainer(effects2, ok2, nok) {
  return factorySpace(effects2, effects2.attempt(this.parser.constructs.document, ok2, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
}
function classifyCharacter(code2) {
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
    return 1;
  }
  if (unicodePunctuation(code2)) {
    return 2;
  }
}
function resolveAll(constructs2, events2, context) {
  const called = [];
  let index2 = -1;
  while (++index2 < constructs2.length) {
    const resolve2 = constructs2[index2].resolveAll;
    if (resolve2 && !called.includes(resolve2)) {
      events2 = resolve2(events2, context);
      called.push(resolve2);
    }
  }
  return events2;
}
const attention = {
  name: "attention",
  resolveAll: resolveAllAttention,
  tokenize: tokenizeAttention
};
function resolveAllAttention(events2, context) {
  let index2 = -1;
  let open;
  let group;
  let text2;
  let openingSequence;
  let closingSequence;
  let use;
  let nextEvents;
  let offset2;
  while (++index2 < events2.length) {
    if (events2[index2][0] === "enter" && events2[index2][1].type === "attentionSequence" && events2[index2][1]._close) {
      open = index2;
      while (open--) {
        if (events2[open][0] === "exit" && events2[open][1].type === "attentionSequence" && events2[open][1]._open && // If the markers are the same:
        context.sliceSerialize(events2[open][1]).charCodeAt(0) === context.sliceSerialize(events2[index2][1]).charCodeAt(0)) {
          if ((events2[open][1]._close || events2[index2][1]._open) && (events2[index2][1].end.offset - events2[index2][1].start.offset) % 3 && !((events2[open][1].end.offset - events2[open][1].start.offset + events2[index2][1].end.offset - events2[index2][1].start.offset) % 3)) {
            continue;
          }
          use = events2[open][1].end.offset - events2[open][1].start.offset > 1 && events2[index2][1].end.offset - events2[index2][1].start.offset > 1 ? 2 : 1;
          const start = {
            ...events2[open][1].end
          };
          const end = {
            ...events2[index2][1].start
          };
          movePoint(start, -use);
          movePoint(end, use);
          openingSequence = {
            type: use > 1 ? "strongSequence" : "emphasisSequence",
            start,
            end: {
              ...events2[open][1].end
            }
          };
          closingSequence = {
            type: use > 1 ? "strongSequence" : "emphasisSequence",
            start: {
              ...events2[index2][1].start
            },
            end
          };
          text2 = {
            type: use > 1 ? "strongText" : "emphasisText",
            start: {
              ...events2[open][1].end
            },
            end: {
              ...events2[index2][1].start
            }
          };
          group = {
            type: use > 1 ? "strong" : "emphasis",
            start: {
              ...openingSequence.start
            },
            end: {
              ...closingSequence.end
            }
          };
          events2[open][1].end = {
            ...openingSequence.start
          };
          events2[index2][1].start = {
            ...closingSequence.end
          };
          nextEvents = [];
          if (events2[open][1].end.offset - events2[open][1].start.offset) {
            nextEvents = push(nextEvents, [["enter", events2[open][1], context], ["exit", events2[open][1], context]]);
          }
          nextEvents = push(nextEvents, [["enter", group, context], ["enter", openingSequence, context], ["exit", openingSequence, context], ["enter", text2, context]]);
          nextEvents = push(nextEvents, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open + 1, index2), context));
          nextEvents = push(nextEvents, [["exit", text2, context], ["enter", closingSequence, context], ["exit", closingSequence, context], ["exit", group, context]]);
          if (events2[index2][1].end.offset - events2[index2][1].start.offset) {
            offset2 = 2;
            nextEvents = push(nextEvents, [["enter", events2[index2][1], context], ["exit", events2[index2][1], context]]);
          } else {
            offset2 = 0;
          }
          splice(events2, open - 1, index2 - open + 3, nextEvents);
          index2 = open + nextEvents.length - offset2 - 2;
          break;
        }
      }
    }
  }
  index2 = -1;
  while (++index2 < events2.length) {
    if (events2[index2][1].type === "attentionSequence") {
      events2[index2][1].type = "data";
    }
  }
  return events2;
}
function tokenizeAttention(effects2, ok2) {
  const attentionMarkers2 = this.parser.constructs.attentionMarkers.null;
  const previous2 = this.previous;
  const before = classifyCharacter(previous2);
  let marker;
  return start;
  function start(code2) {
    marker = code2;
    effects2.enter("attentionSequence");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      return inside;
    }
    const token2 = effects2.exit("attentionSequence");
    const after = classifyCharacter(code2);
    const open = !after || after === 2 && before || attentionMarkers2.includes(code2);
    const close = !before || before === 2 && after || attentionMarkers2.includes(previous2);
    token2._open = Boolean(marker === 42 ? open : open && (before || !close));
    token2._close = Boolean(marker === 42 ? close : close && (after || !open));
    return ok2(code2);
  }
}
function movePoint(point2, offset2) {
  point2.column += offset2;
  point2.offset += offset2;
  point2._bufferIndex += offset2;
}
const autolink = {
  name: "autolink",
  tokenize: tokenizeAutolink
};
function tokenizeAutolink(effects2, ok2, nok) {
  let size2 = 0;
  return start;
  function start(code2) {
    effects2.enter("autolink");
    effects2.enter("autolinkMarker");
    effects2.consume(code2);
    effects2.exit("autolinkMarker");
    effects2.enter("autolinkProtocol");
    return open;
  }
  function open(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return schemeOrEmailAtext;
    }
    if (code2 === 64) {
      return nok(code2);
    }
    return emailAtext(code2);
  }
  function schemeOrEmailAtext(code2) {
    if (code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) {
      size2 = 1;
      return schemeInsideOrEmailAtext(code2);
    }
    return emailAtext(code2);
  }
  function schemeInsideOrEmailAtext(code2) {
    if (code2 === 58) {
      effects2.consume(code2);
      size2 = 0;
      return urlInside;
    }
    if ((code2 === 43 || code2 === 45 || code2 === 46 || asciiAlphanumeric(code2)) && size2++ < 32) {
      effects2.consume(code2);
      return schemeInsideOrEmailAtext;
    }
    size2 = 0;
    return emailAtext(code2);
  }
  function urlInside(code2) {
    if (code2 === 62) {
      effects2.exit("autolinkProtocol");
      effects2.enter("autolinkMarker");
      effects2.consume(code2);
      effects2.exit("autolinkMarker");
      effects2.exit("autolink");
      return ok2;
    }
    if (code2 === null || code2 === 32 || code2 === 60 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return urlInside;
  }
  function emailAtext(code2) {
    if (code2 === 64) {
      effects2.consume(code2);
      return emailAtSignOrDot;
    }
    if (asciiAtext(code2)) {
      effects2.consume(code2);
      return emailAtext;
    }
    return nok(code2);
  }
  function emailAtSignOrDot(code2) {
    return asciiAlphanumeric(code2) ? emailLabel(code2) : nok(code2);
  }
  function emailLabel(code2) {
    if (code2 === 46) {
      effects2.consume(code2);
      size2 = 0;
      return emailAtSignOrDot;
    }
    if (code2 === 62) {
      effects2.exit("autolinkProtocol").type = "autolinkEmail";
      effects2.enter("autolinkMarker");
      effects2.consume(code2);
      effects2.exit("autolinkMarker");
      effects2.exit("autolink");
      return ok2;
    }
    return emailValue(code2);
  }
  function emailValue(code2) {
    if ((code2 === 45 || asciiAlphanumeric(code2)) && size2++ < 63) {
      const next2 = code2 === 45 ? emailValue : emailLabel;
      effects2.consume(code2);
      return next2;
    }
    return nok(code2);
  }
}
const blankLine = {
  partial: true,
  tokenize: tokenizeBlankLine
};
function tokenizeBlankLine(effects2, ok2, nok) {
  return start;
  function start(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, after, "linePrefix")(code2) : after(code2);
  }
  function after(code2) {
    return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  }
}
const blockQuote = {
  continuation: {
    tokenize: tokenizeBlockQuoteContinuation
  },
  exit,
  name: "blockQuote",
  tokenize: tokenizeBlockQuoteStart
};
function tokenizeBlockQuoteStart(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    if (code2 === 62) {
      const state = self2.containerState;
      if (!state.open) {
        effects2.enter("blockQuote", {
          _container: true
        });
        state.open = true;
      }
      effects2.enter("blockQuotePrefix");
      effects2.enter("blockQuoteMarker");
      effects2.consume(code2);
      effects2.exit("blockQuoteMarker");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    if (markdownSpace(code2)) {
      effects2.enter("blockQuotePrefixWhitespace");
      effects2.consume(code2);
      effects2.exit("blockQuotePrefixWhitespace");
      effects2.exit("blockQuotePrefix");
      return ok2;
    }
    effects2.exit("blockQuotePrefix");
    return ok2(code2);
  }
}
function tokenizeBlockQuoteContinuation(effects2, ok2, nok) {
  const self2 = this;
  return contStart;
  function contStart(code2) {
    if (markdownSpace(code2)) {
      return factorySpace(effects2, contBefore, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2);
    }
    return contBefore(code2);
  }
  function contBefore(code2) {
    return effects2.attempt(blockQuote, ok2, nok)(code2);
  }
}
function exit(effects2) {
  effects2.exit("blockQuote");
}
const characterEscape = {
  name: "characterEscape",
  tokenize: tokenizeCharacterEscape
};
function tokenizeCharacterEscape(effects2, ok2, nok) {
  return start;
  function start(code2) {
    effects2.enter("characterEscape");
    effects2.enter("escapeMarker");
    effects2.consume(code2);
    effects2.exit("escapeMarker");
    return inside;
  }
  function inside(code2) {
    if (asciiPunctuation(code2)) {
      effects2.enter("characterEscapeValue");
      effects2.consume(code2);
      effects2.exit("characterEscapeValue");
      effects2.exit("characterEscape");
      return ok2;
    }
    return nok(code2);
  }
}
const characterReference = {
  name: "characterReference",
  tokenize: tokenizeCharacterReference
};
function tokenizeCharacterReference(effects2, ok2, nok) {
  const self2 = this;
  let size2 = 0;
  let max2;
  let test2;
  return start;
  function start(code2) {
    effects2.enter("characterReference");
    effects2.enter("characterReferenceMarker");
    effects2.consume(code2);
    effects2.exit("characterReferenceMarker");
    return open;
  }
  function open(code2) {
    if (code2 === 35) {
      effects2.enter("characterReferenceMarkerNumeric");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarkerNumeric");
      return numeric;
    }
    effects2.enter("characterReferenceValue");
    max2 = 31;
    test2 = asciiAlphanumeric;
    return value2(code2);
  }
  function numeric(code2) {
    if (code2 === 88 || code2 === 120) {
      effects2.enter("characterReferenceMarkerHexadecimal");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarkerHexadecimal");
      effects2.enter("characterReferenceValue");
      max2 = 6;
      test2 = asciiHexDigit;
      return value2;
    }
    effects2.enter("characterReferenceValue");
    max2 = 7;
    test2 = asciiDigit;
    return value2(code2);
  }
  function value2(code2) {
    if (code2 === 59 && size2) {
      const token2 = effects2.exit("characterReferenceValue");
      if (test2 === asciiAlphanumeric && !decodeNamedCharacterReference(self2.sliceSerialize(token2))) {
        return nok(code2);
      }
      effects2.enter("characterReferenceMarker");
      effects2.consume(code2);
      effects2.exit("characterReferenceMarker");
      effects2.exit("characterReference");
      return ok2;
    }
    if (test2(code2) && size2++ < max2) {
      effects2.consume(code2);
      return value2;
    }
    return nok(code2);
  }
}
const nonLazyContinuation = {
  partial: true,
  tokenize: tokenizeNonLazyContinuation
};
const codeFenced = {
  concrete: true,
  name: "codeFenced",
  tokenize: tokenizeCodeFenced
};
function tokenizeCodeFenced(effects2, ok2, nok) {
  const self2 = this;
  const closeStart = {
    partial: true,
    tokenize: tokenizeCloseStart
  };
  let initialPrefix = 0;
  let sizeOpen = 0;
  let marker;
  return start;
  function start(code2) {
    return beforeSequenceOpen(code2);
  }
  function beforeSequenceOpen(code2) {
    const tail = self2.events[self2.events.length - 1];
    initialPrefix = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
    marker = code2;
    effects2.enter("codeFenced");
    effects2.enter("codeFencedFence");
    effects2.enter("codeFencedFenceSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === marker) {
      sizeOpen++;
      effects2.consume(code2);
      return sequenceOpen;
    }
    if (sizeOpen < 3) {
      return nok(code2);
    }
    effects2.exit("codeFencedFenceSequence");
    return markdownSpace(code2) ? factorySpace(effects2, infoBefore, "whitespace")(code2) : infoBefore(code2);
  }
  function infoBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFencedFence");
      return self2.interrupt ? ok2(code2) : effects2.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
    }
    effects2.enter("codeFencedFenceInfo");
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return info(code2);
  }
  function info(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceInfo");
      return infoBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceInfo");
      return factorySpace(effects2, metaBefore, "whitespace")(code2);
    }
    if (code2 === 96 && code2 === marker) {
      return nok(code2);
    }
    effects2.consume(code2);
    return info;
  }
  function metaBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return infoBefore(code2);
    }
    effects2.enter("codeFencedFenceMeta");
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return meta(code2);
  }
  function meta(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      effects2.exit("codeFencedFenceMeta");
      return infoBefore(code2);
    }
    if (code2 === 96 && code2 === marker) {
      return nok(code2);
    }
    effects2.consume(code2);
    return meta;
  }
  function atNonLazyBreak(code2) {
    return effects2.attempt(closeStart, after, contentBefore)(code2);
  }
  function contentBefore(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return contentStart;
  }
  function contentStart(code2) {
    return initialPrefix > 0 && markdownSpace(code2) ? factorySpace(effects2, beforeContentChunk, "linePrefix", initialPrefix + 1)(code2) : beforeContentChunk(code2);
  }
  function beforeContentChunk(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return effects2.check(nonLazyContinuation, atNonLazyBreak, after)(code2);
    }
    effects2.enter("codeFlowValue");
    return contentChunk(code2);
  }
  function contentChunk(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFlowValue");
      return beforeContentChunk(code2);
    }
    effects2.consume(code2);
    return contentChunk;
  }
  function after(code2) {
    effects2.exit("codeFenced");
    return ok2(code2);
  }
  function tokenizeCloseStart(effects3, ok3, nok2) {
    let size2 = 0;
    return startBefore;
    function startBefore(code2) {
      effects3.enter("lineEnding");
      effects3.consume(code2);
      effects3.exit("lineEnding");
      return start2;
    }
    function start2(code2) {
      effects3.enter("codeFencedFence");
      return markdownSpace(code2) ? factorySpace(effects3, beforeSequenceClose, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2) : beforeSequenceClose(code2);
    }
    function beforeSequenceClose(code2) {
      if (code2 === marker) {
        effects3.enter("codeFencedFenceSequence");
        return sequenceClose(code2);
      }
      return nok2(code2);
    }
    function sequenceClose(code2) {
      if (code2 === marker) {
        size2++;
        effects3.consume(code2);
        return sequenceClose;
      }
      if (size2 >= sizeOpen) {
        effects3.exit("codeFencedFenceSequence");
        return markdownSpace(code2) ? factorySpace(effects3, sequenceCloseAfter, "whitespace")(code2) : sequenceCloseAfter(code2);
      }
      return nok2(code2);
    }
    function sequenceCloseAfter(code2) {
      if (code2 === null || markdownLineEnding(code2)) {
        effects3.exit("codeFencedFence");
        return ok3(code2);
      }
      return nok2(code2);
    }
  }
}
function tokenizeNonLazyContinuation(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return lineStart;
  }
  function lineStart(code2) {
    return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  }
}
const codeIndented = {
  name: "codeIndented",
  tokenize: tokenizeCodeIndented
};
const furtherStart = {
  partial: true,
  tokenize: tokenizeFurtherStart
};
function tokenizeCodeIndented(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    effects2.enter("codeIndented");
    return factorySpace(effects2, afterPrefix, "linePrefix", 4 + 1)(code2);
  }
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code2) : nok(code2);
  }
  function atBreak(code2) {
    if (code2 === null) {
      return after(code2);
    }
    if (markdownLineEnding(code2)) {
      return effects2.attempt(furtherStart, atBreak, after)(code2);
    }
    effects2.enter("codeFlowValue");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("codeFlowValue");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return inside;
  }
  function after(code2) {
    effects2.exit("codeIndented");
    return ok2(code2);
  }
}
function tokenizeFurtherStart(effects2, ok2, nok) {
  const self2 = this;
  return furtherStart2;
  function furtherStart2(code2) {
    if (self2.parser.lazy[self2.now().line]) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return furtherStart2;
    }
    return factorySpace(effects2, afterPrefix, "linePrefix", 4 + 1)(code2);
  }
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok2(code2) : markdownLineEnding(code2) ? furtherStart2(code2) : nok(code2);
  }
}
const codeText = {
  name: "codeText",
  previous,
  resolve: resolveCodeText,
  tokenize: tokenizeCodeText
};
function resolveCodeText(events2) {
  let tailExitIndex = events2.length - 4;
  let headEnterIndex = 3;
  let index2;
  let enter;
  if ((events2[headEnterIndex][1].type === "lineEnding" || events2[headEnterIndex][1].type === "space") && (events2[tailExitIndex][1].type === "lineEnding" || events2[tailExitIndex][1].type === "space")) {
    index2 = headEnterIndex;
    while (++index2 < tailExitIndex) {
      if (events2[index2][1].type === "codeTextData") {
        events2[headEnterIndex][1].type = "codeTextPadding";
        events2[tailExitIndex][1].type = "codeTextPadding";
        headEnterIndex += 2;
        tailExitIndex -= 2;
        break;
      }
    }
  }
  index2 = headEnterIndex - 1;
  tailExitIndex++;
  while (++index2 <= tailExitIndex) {
    if (enter === void 0) {
      if (index2 !== tailExitIndex && events2[index2][1].type !== "lineEnding") {
        enter = index2;
      }
    } else if (index2 === tailExitIndex || events2[index2][1].type === "lineEnding") {
      events2[enter][1].type = "codeTextData";
      if (index2 !== enter + 2) {
        events2[enter][1].end = events2[index2 - 1][1].end;
        events2.splice(enter + 2, index2 - enter - 2);
        tailExitIndex -= index2 - enter - 2;
        index2 = enter + 2;
      }
      enter = void 0;
    }
  }
  return events2;
}
function previous(code2) {
  return code2 !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function tokenizeCodeText(effects2, ok2, nok) {
  let sizeOpen = 0;
  let size2;
  let token2;
  return start;
  function start(code2) {
    effects2.enter("codeText");
    effects2.enter("codeTextSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === 96) {
      effects2.consume(code2);
      sizeOpen++;
      return sequenceOpen;
    }
    effects2.exit("codeTextSequence");
    return between(code2);
  }
  function between(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 32) {
      effects2.enter("space");
      effects2.consume(code2);
      effects2.exit("space");
      return between;
    }
    if (code2 === 96) {
      token2 = effects2.enter("codeTextSequence");
      size2 = 0;
      return sequenceClose(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return between;
    }
    effects2.enter("codeTextData");
    return data(code2);
  }
  function data(code2) {
    if (code2 === null || code2 === 32 || code2 === 96 || markdownLineEnding(code2)) {
      effects2.exit("codeTextData");
      return between(code2);
    }
    effects2.consume(code2);
    return data;
  }
  function sequenceClose(code2) {
    if (code2 === 96) {
      effects2.consume(code2);
      size2++;
      return sequenceClose;
    }
    if (size2 === sizeOpen) {
      effects2.exit("codeTextSequence");
      effects2.exit("codeText");
      return ok2(code2);
    }
    token2.type = "codeTextData";
    return data(code2);
  }
}
class SpliceBuffer {
  /**
   * @param {ReadonlyArray<T> | null | undefined} [initial]
   *   Initial items (optional).
   * @returns
   *   Splice buffer.
   */
  constructor(initial) {
    this.left = initial ? [...initial] : [];
    this.right = [];
  }
  /**
   * Array access;
   * does not move the cursor.
   *
   * @param {number} index
   *   Index.
   * @return {T}
   *   Item.
   */
  get(index2) {
    if (index2 < 0 || index2 >= this.left.length + this.right.length) {
      throw new RangeError("Cannot access index `" + index2 + "` in a splice buffer of size `" + (this.left.length + this.right.length) + "`");
    }
    if (index2 < this.left.length)
      return this.left[index2];
    return this.right[this.right.length - index2 + this.left.length - 1];
  }
  /**
   * The length of the splice buffer, one greater than the largest index in the
   * array.
   */
  get length() {
    return this.left.length + this.right.length;
  }
  /**
   * Remove and return `list[0]`;
   * moves the cursor to `0`.
   *
   * @returns {T | undefined}
   *   Item, optional.
   */
  shift() {
    this.setCursor(0);
    return this.right.pop();
  }
  /**
   * Slice the buffer to get an array;
   * does not move the cursor.
   *
   * @param {number} start
   *   Start.
   * @param {number | null | undefined} [end]
   *   End (optional).
   * @returns {Array<T>}
   *   Array of items.
   */
  slice(start, end) {
    const stop = end === null || end === void 0 ? Number.POSITIVE_INFINITY : end;
    if (stop < this.left.length) {
      return this.left.slice(start, stop);
    }
    if (start > this.left.length) {
      return this.right.slice(this.right.length - stop + this.left.length, this.right.length - start + this.left.length).reverse();
    }
    return this.left.slice(start).concat(this.right.slice(this.right.length - stop + this.left.length).reverse());
  }
  /**
   * Mimics the behavior of Array.prototype.splice() except for the change of
   * interface necessary to avoid segfaults when patching in very large arrays.
   *
   * This operation moves cursor is moved to `start` and results in the cursor
   * placed after any inserted items.
   *
   * @param {number} start
   *   Start;
   *   zero-based index at which to start changing the array;
   *   negative numbers count backwards from the end of the array and values
   *   that are out-of bounds are clamped to the appropriate end of the array.
   * @param {number | null | undefined} [deleteCount=0]
   *   Delete count (default: `0`);
   *   maximum number of elements to delete, starting from start.
   * @param {Array<T> | null | undefined} [items=[]]
   *   Items to include in place of the deleted items (default: `[]`).
   * @return {Array<T>}
   *   Any removed items.
   */
  splice(start, deleteCount, items) {
    const count = deleteCount || 0;
    this.setCursor(Math.trunc(start));
    const removed = this.right.splice(this.right.length - count, Number.POSITIVE_INFINITY);
    if (items)
      chunkedPush(this.left, items);
    return removed.reverse();
  }
  /**
   * Remove and return the highest-numbered item in the array, so
   * `list[list.length - 1]`;
   * Moves the cursor to `length`.
   *
   * @returns {T | undefined}
   *   Item, optional.
   */
  pop() {
    this.setCursor(Number.POSITIVE_INFINITY);
    return this.left.pop();
  }
  /**
   * Inserts a single item to the high-numbered side of the array;
   * moves the cursor to `length`.
   *
   * @param {T} item
   *   Item.
   * @returns {undefined}
   *   Nothing.
   */
  push(item) {
    this.setCursor(Number.POSITIVE_INFINITY);
    this.left.push(item);
  }
  /**
   * Inserts many items to the high-numbered side of the array.
   * Moves the cursor to `length`.
   *
   * @param {Array<T>} items
   *   Items.
   * @returns {undefined}
   *   Nothing.
   */
  pushMany(items) {
    this.setCursor(Number.POSITIVE_INFINITY);
    chunkedPush(this.left, items);
  }
  /**
   * Inserts a single item to the low-numbered side of the array;
   * Moves the cursor to `0`.
   *
   * @param {T} item
   *   Item.
   * @returns {undefined}
   *   Nothing.
   */
  unshift(item) {
    this.setCursor(0);
    this.right.push(item);
  }
  /**
   * Inserts many items to the low-numbered side of the array;
   * moves the cursor to `0`.
   *
   * @param {Array<T>} items
   *   Items.
   * @returns {undefined}
   *   Nothing.
   */
  unshiftMany(items) {
    this.setCursor(0);
    chunkedPush(this.right, items.reverse());
  }
  /**
   * Move the cursor to a specific position in the array. Requires
   * time proportional to the distance moved.
   *
   * If `n < 0`, the cursor will end up at the beginning.
   * If `n > length`, the cursor will end up at the end.
   *
   * @param {number} n
   *   Position.
   * @return {undefined}
   *   Nothing.
   */
  setCursor(n2) {
    if (n2 === this.left.length || n2 > this.left.length && this.right.length === 0 || n2 < 0 && this.left.length === 0)
      return;
    if (n2 < this.left.length) {
      const removed = this.left.splice(n2, Number.POSITIVE_INFINITY);
      chunkedPush(this.right, removed.reverse());
    } else {
      const removed = this.right.splice(this.left.length + this.right.length - n2, Number.POSITIVE_INFINITY);
      chunkedPush(this.left, removed.reverse());
    }
  }
}
function chunkedPush(list2, right) {
  let chunkStart = 0;
  if (right.length < 1e4) {
    list2.push(...right);
  } else {
    while (chunkStart < right.length) {
      list2.push(...right.slice(chunkStart, chunkStart + 1e4));
      chunkStart += 1e4;
    }
  }
}
function subtokenize(eventsArray) {
  const jumps = {};
  let index2 = -1;
  let event;
  let lineIndex;
  let otherIndex;
  let otherEvent;
  let parameters;
  let subevents;
  let more;
  const events2 = new SpliceBuffer(eventsArray);
  while (++index2 < events2.length) {
    while (index2 in jumps) {
      index2 = jumps[index2];
    }
    event = events2.get(index2);
    if (index2 && event[1].type === "chunkFlow" && events2.get(index2 - 1)[1].type === "listItemPrefix") {
      subevents = event[1]._tokenizer.events;
      otherIndex = 0;
      if (otherIndex < subevents.length && subevents[otherIndex][1].type === "lineEndingBlank") {
        otherIndex += 2;
      }
      if (otherIndex < subevents.length && subevents[otherIndex][1].type === "content") {
        while (++otherIndex < subevents.length) {
          if (subevents[otherIndex][1].type === "content") {
            break;
          }
          if (subevents[otherIndex][1].type === "chunkText") {
            subevents[otherIndex][1]._isInFirstContentOfListItem = true;
            otherIndex++;
          }
        }
      }
    }
    if (event[0] === "enter") {
      if (event[1].contentType) {
        Object.assign(jumps, subcontent(events2, index2));
        index2 = jumps[index2];
        more = true;
      }
    } else if (event[1]._container) {
      otherIndex = index2;
      lineIndex = void 0;
      while (otherIndex--) {
        otherEvent = events2.get(otherIndex);
        if (otherEvent[1].type === "lineEnding" || otherEvent[1].type === "lineEndingBlank") {
          if (otherEvent[0] === "enter") {
            if (lineIndex) {
              events2.get(lineIndex)[1].type = "lineEndingBlank";
            }
            otherEvent[1].type = "lineEnding";
            lineIndex = otherIndex;
          }
        } else if (otherEvent[1].type === "linePrefix" || otherEvent[1].type === "listItemIndent")
          ;
        else {
          break;
        }
      }
      if (lineIndex) {
        event[1].end = {
          ...events2.get(lineIndex)[1].start
        };
        parameters = events2.slice(lineIndex, index2);
        parameters.unshift(event);
        events2.splice(lineIndex, index2 - lineIndex + 1, parameters);
      }
    }
  }
  splice(eventsArray, 0, Number.POSITIVE_INFINITY, events2.slice(0));
  return !more;
}
function subcontent(events2, eventIndex) {
  const token2 = events2.get(eventIndex)[1];
  const context = events2.get(eventIndex)[2];
  let startPosition = eventIndex - 1;
  const startPositions = [];
  let tokenizer = token2._tokenizer;
  if (!tokenizer) {
    tokenizer = context.parser[token2.contentType](token2.start);
    if (token2._contentTypeTextTrailing) {
      tokenizer._contentTypeTextTrailing = true;
    }
  }
  const childEvents = tokenizer.events;
  const jumps = [];
  const gaps = {};
  let stream;
  let previous2;
  let index2 = -1;
  let current = token2;
  let adjust = 0;
  let start = 0;
  const breaks = [start];
  while (current) {
    while (events2.get(++startPosition)[1] !== current) {
    }
    startPositions.push(startPosition);
    if (!current._tokenizer) {
      stream = context.sliceStream(current);
      if (!current.next) {
        stream.push(null);
      }
      if (previous2) {
        tokenizer.defineSkip(current.start);
      }
      if (current._isInFirstContentOfListItem) {
        tokenizer._gfmTasklistFirstContentOfListItem = true;
      }
      tokenizer.write(stream);
      if (current._isInFirstContentOfListItem) {
        tokenizer._gfmTasklistFirstContentOfListItem = void 0;
      }
    }
    previous2 = current;
    current = current.next;
  }
  current = token2;
  while (++index2 < childEvents.length) {
    if (
      // Find a void token that includes a break.
      childEvents[index2][0] === "exit" && childEvents[index2 - 1][0] === "enter" && childEvents[index2][1].type === childEvents[index2 - 1][1].type && childEvents[index2][1].start.line !== childEvents[index2][1].end.line
    ) {
      start = index2 + 1;
      breaks.push(start);
      current._tokenizer = void 0;
      current.previous = void 0;
      current = current.next;
    }
  }
  tokenizer.events = [];
  if (current) {
    current._tokenizer = void 0;
    current.previous = void 0;
  } else {
    breaks.pop();
  }
  index2 = breaks.length;
  while (index2--) {
    const slice2 = childEvents.slice(breaks[index2], breaks[index2 + 1]);
    const start2 = startPositions.pop();
    jumps.push([start2, start2 + slice2.length - 1]);
    events2.splice(start2, 2, slice2);
  }
  jumps.reverse();
  index2 = -1;
  while (++index2 < jumps.length) {
    gaps[adjust + jumps[index2][0]] = adjust + jumps[index2][1];
    adjust += jumps[index2][1] - jumps[index2][0] - 1;
  }
  return gaps;
}
const content = {
  resolve: resolveContent,
  tokenize: tokenizeContent
};
const continuationConstruct = {
  partial: true,
  tokenize: tokenizeContinuation
};
function resolveContent(events2) {
  subtokenize(events2);
  return events2;
}
function tokenizeContent(effects2, ok2) {
  let previous2;
  return chunkStart;
  function chunkStart(code2) {
    effects2.enter("content");
    previous2 = effects2.enter("chunkContent", {
      contentType: "content"
    });
    return chunkInside(code2);
  }
  function chunkInside(code2) {
    if (code2 === null) {
      return contentEnd(code2);
    }
    if (markdownLineEnding(code2)) {
      return effects2.check(continuationConstruct, contentContinue, contentEnd)(code2);
    }
    effects2.consume(code2);
    return chunkInside;
  }
  function contentEnd(code2) {
    effects2.exit("chunkContent");
    effects2.exit("content");
    return ok2(code2);
  }
  function contentContinue(code2) {
    effects2.consume(code2);
    effects2.exit("chunkContent");
    previous2.next = effects2.enter("chunkContent", {
      contentType: "content",
      previous: previous2
    });
    previous2 = previous2.next;
    return chunkInside;
  }
}
function tokenizeContinuation(effects2, ok2, nok) {
  const self2 = this;
  return startLookahead;
  function startLookahead(code2) {
    effects2.exit("chunkContent");
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, prefixed, "linePrefix");
  }
  function prefixed(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return nok(code2);
    }
    const tail = self2.events[self2.events.length - 1];
    if (!self2.parser.constructs.disable.null.includes("codeIndented") && tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4) {
      return ok2(code2);
    }
    return effects2.interrupt(self2.parser.constructs.flow, nok, ok2)(code2);
  }
}
function factoryDestination(effects2, ok2, nok, type4, literalType, literalMarkerType, rawType, stringType, max2) {
  const limit2 = max2 || Number.POSITIVE_INFINITY;
  let balance = 0;
  return start;
  function start(code2) {
    if (code2 === 60) {
      effects2.enter(type4);
      effects2.enter(literalType);
      effects2.enter(literalMarkerType);
      effects2.consume(code2);
      effects2.exit(literalMarkerType);
      return enclosedBefore;
    }
    if (code2 === null || code2 === 32 || code2 === 41 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.enter(type4);
    effects2.enter(rawType);
    effects2.enter(stringType);
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return raw(code2);
  }
  function enclosedBefore(code2) {
    if (code2 === 62) {
      effects2.enter(literalMarkerType);
      effects2.consume(code2);
      effects2.exit(literalMarkerType);
      effects2.exit(literalType);
      effects2.exit(type4);
      return ok2;
    }
    effects2.enter(stringType);
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return enclosed(code2);
  }
  function enclosed(code2) {
    if (code2 === 62) {
      effects2.exit("chunkString");
      effects2.exit(stringType);
      return enclosedBefore(code2);
    }
    if (code2 === null || code2 === 60 || markdownLineEnding(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? enclosedEscape : enclosed;
  }
  function enclosedEscape(code2) {
    if (code2 === 60 || code2 === 62 || code2 === 92) {
      effects2.consume(code2);
      return enclosed;
    }
    return enclosed(code2);
  }
  function raw(code2) {
    if (!balance && (code2 === null || code2 === 41 || markdownLineEndingOrSpace(code2))) {
      effects2.exit("chunkString");
      effects2.exit(stringType);
      effects2.exit(rawType);
      effects2.exit(type4);
      return ok2(code2);
    }
    if (balance < limit2 && code2 === 40) {
      effects2.consume(code2);
      balance++;
      return raw;
    }
    if (code2 === 41) {
      effects2.consume(code2);
      balance--;
      return raw;
    }
    if (code2 === null || code2 === 32 || code2 === 40 || asciiControl(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? rawEscape : raw;
  }
  function rawEscape(code2) {
    if (code2 === 40 || code2 === 41 || code2 === 92) {
      effects2.consume(code2);
      return raw;
    }
    return raw(code2);
  }
}
function factoryLabel(effects2, ok2, nok, type4, markerType, stringType) {
  const self2 = this;
  let size2 = 0;
  let seen2;
  return start;
  function start(code2) {
    effects2.enter(type4);
    effects2.enter(markerType);
    effects2.consume(code2);
    effects2.exit(markerType);
    effects2.enter(stringType);
    return atBreak;
  }
  function atBreak(code2) {
    if (size2 > 999 || code2 === null || code2 === 91 || code2 === 93 && !seen2 || // To do: remove in the future once we’ve switched from
    // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
    // which doesn’t need this.
    // Hidden footnotes hook.
    /* c8 ignore next 3 */
    code2 === 94 && !size2 && "_hiddenFootnoteSupport" in self2.parser.constructs) {
      return nok(code2);
    }
    if (code2 === 93) {
      effects2.exit(stringType);
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      effects2.exit(type4);
      return ok2;
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return atBreak;
    }
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return labelInside(code2);
  }
  function labelInside(code2) {
    if (code2 === null || code2 === 91 || code2 === 93 || markdownLineEnding(code2) || size2++ > 999) {
      effects2.exit("chunkString");
      return atBreak(code2);
    }
    effects2.consume(code2);
    if (!seen2)
      seen2 = !markdownSpace(code2);
    return code2 === 92 ? labelEscape : labelInside;
  }
  function labelEscape(code2) {
    if (code2 === 91 || code2 === 92 || code2 === 93) {
      effects2.consume(code2);
      size2++;
      return labelInside;
    }
    return labelInside(code2);
  }
}
function factoryTitle(effects2, ok2, nok, type4, markerType, stringType) {
  let marker;
  return start;
  function start(code2) {
    if (code2 === 34 || code2 === 39 || code2 === 40) {
      effects2.enter(type4);
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      marker = code2 === 40 ? 41 : code2;
      return begin;
    }
    return nok(code2);
  }
  function begin(code2) {
    if (code2 === marker) {
      effects2.enter(markerType);
      effects2.consume(code2);
      effects2.exit(markerType);
      effects2.exit(type4);
      return ok2;
    }
    effects2.enter(stringType);
    return atBreak(code2);
  }
  function atBreak(code2) {
    if (code2 === marker) {
      effects2.exit(stringType);
      return begin(marker);
    }
    if (code2 === null) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return factorySpace(effects2, atBreak, "linePrefix");
    }
    effects2.enter("chunkString", {
      contentType: "string"
    });
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker || code2 === null || markdownLineEnding(code2)) {
      effects2.exit("chunkString");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return code2 === 92 ? escape2 : inside;
  }
  function escape2(code2) {
    if (code2 === marker || code2 === 92) {
      effects2.consume(code2);
      return inside;
    }
    return inside(code2);
  }
}
function factoryWhitespace(effects2, ok2) {
  let seen2;
  return start;
  function start(code2) {
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      seen2 = true;
      return start;
    }
    if (markdownSpace(code2)) {
      return factorySpace(effects2, start, seen2 ? "linePrefix" : "lineSuffix")(code2);
    }
    return ok2(code2);
  }
}
const definition = {
  name: "definition",
  tokenize: tokenizeDefinition
};
const titleBefore = {
  partial: true,
  tokenize: tokenizeTitleBefore
};
function tokenizeDefinition(effects2, ok2, nok) {
  const self2 = this;
  let identifier2;
  return start;
  function start(code2) {
    effects2.enter("definition");
    return before(code2);
  }
  function before(code2) {
    return factoryLabel.call(
      self2,
      effects2,
      labelAfter,
      // Note: we don’t need to reset the way `markdown-rs` does.
      nok,
      "definitionLabel",
      "definitionLabelMarker",
      "definitionLabelString"
    )(code2);
  }
  function labelAfter(code2) {
    identifier2 = normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1));
    if (code2 === 58) {
      effects2.enter("definitionMarker");
      effects2.consume(code2);
      effects2.exit("definitionMarker");
      return markerAfter;
    }
    return nok(code2);
  }
  function markerAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, destinationBefore)(code2) : destinationBefore(code2);
  }
  function destinationBefore(code2) {
    return factoryDestination(
      effects2,
      destinationAfter,
      // Note: we don’t need to reset the way `markdown-rs` does.
      nok,
      "definitionDestination",
      "definitionDestinationLiteral",
      "definitionDestinationLiteralMarker",
      "definitionDestinationRaw",
      "definitionDestinationString"
    )(code2);
  }
  function destinationAfter(code2) {
    return effects2.attempt(titleBefore, after, after)(code2);
  }
  function after(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, afterWhitespace, "whitespace")(code2) : afterWhitespace(code2);
  }
  function afterWhitespace(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("definition");
      self2.parser.defined.push(identifier2);
      return ok2(code2);
    }
    return nok(code2);
  }
}
function tokenizeTitleBefore(effects2, ok2, nok) {
  return titleBefore2;
  function titleBefore2(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, beforeMarker)(code2) : nok(code2);
  }
  function beforeMarker(code2) {
    return factoryTitle(effects2, titleAfter, nok, "definitionTitle", "definitionTitleMarker", "definitionTitleString")(code2);
  }
  function titleAfter(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, titleAfterOptionalWhitespace, "whitespace")(code2) : titleAfterOptionalWhitespace(code2);
  }
  function titleAfterOptionalWhitespace(code2) {
    return code2 === null || markdownLineEnding(code2) ? ok2(code2) : nok(code2);
  }
}
const hardBreakEscape = {
  name: "hardBreakEscape",
  tokenize: tokenizeHardBreakEscape
};
function tokenizeHardBreakEscape(effects2, ok2, nok) {
  return start;
  function start(code2) {
    effects2.enter("hardBreakEscape");
    effects2.consume(code2);
    return after;
  }
  function after(code2) {
    if (markdownLineEnding(code2)) {
      effects2.exit("hardBreakEscape");
      return ok2(code2);
    }
    return nok(code2);
  }
}
const headingAtx = {
  name: "headingAtx",
  resolve: resolveHeadingAtx,
  tokenize: tokenizeHeadingAtx
};
function resolveHeadingAtx(events2, context) {
  let contentEnd = events2.length - 2;
  let contentStart = 3;
  let content2;
  let text2;
  if (events2[contentStart][1].type === "whitespace") {
    contentStart += 2;
  }
  if (contentEnd - 2 > contentStart && events2[contentEnd][1].type === "whitespace") {
    contentEnd -= 2;
  }
  if (events2[contentEnd][1].type === "atxHeadingSequence" && (contentStart === contentEnd - 1 || contentEnd - 4 > contentStart && events2[contentEnd - 2][1].type === "whitespace")) {
    contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
  }
  if (contentEnd > contentStart) {
    content2 = {
      type: "atxHeadingText",
      start: events2[contentStart][1].start,
      end: events2[contentEnd][1].end
    };
    text2 = {
      type: "chunkText",
      start: events2[contentStart][1].start,
      end: events2[contentEnd][1].end,
      contentType: "text"
    };
    splice(events2, contentStart, contentEnd - contentStart + 1, [["enter", content2, context], ["enter", text2, context], ["exit", text2, context], ["exit", content2, context]]);
  }
  return events2;
}
function tokenizeHeadingAtx(effects2, ok2, nok) {
  let size2 = 0;
  return start;
  function start(code2) {
    effects2.enter("atxHeading");
    return before(code2);
  }
  function before(code2) {
    effects2.enter("atxHeadingSequence");
    return sequenceOpen(code2);
  }
  function sequenceOpen(code2) {
    if (code2 === 35 && size2++ < 6) {
      effects2.consume(code2);
      return sequenceOpen;
    }
    if (code2 === null || markdownLineEndingOrSpace(code2)) {
      effects2.exit("atxHeadingSequence");
      return atBreak(code2);
    }
    return nok(code2);
  }
  function atBreak(code2) {
    if (code2 === 35) {
      effects2.enter("atxHeadingSequence");
      return sequenceFurther(code2);
    }
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("atxHeading");
      return ok2(code2);
    }
    if (markdownSpace(code2)) {
      return factorySpace(effects2, atBreak, "whitespace")(code2);
    }
    effects2.enter("atxHeadingText");
    return data(code2);
  }
  function sequenceFurther(code2) {
    if (code2 === 35) {
      effects2.consume(code2);
      return sequenceFurther;
    }
    effects2.exit("atxHeadingSequence");
    return atBreak(code2);
  }
  function data(code2) {
    if (code2 === null || code2 === 35 || markdownLineEndingOrSpace(code2)) {
      effects2.exit("atxHeadingText");
      return atBreak(code2);
    }
    effects2.consume(code2);
    return data;
  }
}
const htmlBlockNames = [
  "address",
  "article",
  "aside",
  "base",
  "basefont",
  "blockquote",
  "body",
  "caption",
  "center",
  "col",
  "colgroup",
  "dd",
  "details",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "frame",
  "frameset",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hr",
  "html",
  "iframe",
  "legend",
  "li",
  "link",
  "main",
  "menu",
  "menuitem",
  "nav",
  "noframes",
  "ol",
  "optgroup",
  "option",
  "p",
  "param",
  "search",
  "section",
  "summary",
  "table",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "title",
  "tr",
  "track",
  "ul"
];
const htmlRawNames = ["pre", "script", "style", "textarea"];
const htmlFlow = {
  concrete: true,
  name: "htmlFlow",
  resolveTo: resolveToHtmlFlow,
  tokenize: tokenizeHtmlFlow
};
const blankLineBefore = {
  partial: true,
  tokenize: tokenizeBlankLineBefore
};
const nonLazyContinuationStart = {
  partial: true,
  tokenize: tokenizeNonLazyContinuationStart
};
function resolveToHtmlFlow(events2) {
  let index2 = events2.length;
  while (index2--) {
    if (events2[index2][0] === "enter" && events2[index2][1].type === "htmlFlow") {
      break;
    }
  }
  if (index2 > 1 && events2[index2 - 2][1].type === "linePrefix") {
    events2[index2][1].start = events2[index2 - 2][1].start;
    events2[index2 + 1][1].start = events2[index2 - 2][1].start;
    events2.splice(index2 - 2, 2);
  }
  return events2;
}
function tokenizeHtmlFlow(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  let closingTag;
  let buffer;
  let index2;
  let markerB;
  return start;
  function start(code2) {
    return before(code2);
  }
  function before(code2) {
    effects2.enter("htmlFlow");
    effects2.enter("htmlFlowData");
    effects2.consume(code2);
    return open;
  }
  function open(code2) {
    if (code2 === 33) {
      effects2.consume(code2);
      return declarationOpen;
    }
    if (code2 === 47) {
      effects2.consume(code2);
      closingTag = true;
      return tagCloseStart;
    }
    if (code2 === 63) {
      effects2.consume(code2);
      marker = 3;
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      buffer = String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function declarationOpen(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      marker = 2;
      return commentOpenInside;
    }
    if (code2 === 91) {
      effects2.consume(code2);
      marker = 5;
      index2 = 0;
      return cdataOpenInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      marker = 4;
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    return nok(code2);
  }
  function commentOpenInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return self2.interrupt ? ok2 : continuationDeclarationInside;
    }
    return nok(code2);
  }
  function cdataOpenInside(code2) {
    const value2 = "CDATA[";
    if (code2 === value2.charCodeAt(index2++)) {
      effects2.consume(code2);
      if (index2 === value2.length) {
        return self2.interrupt ? ok2 : continuation;
      }
      return cdataOpenInside;
    }
    return nok(code2);
  }
  function tagCloseStart(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      buffer = String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function tagName(code2) {
    if (code2 === null || code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      const slash = code2 === 47;
      const name2 = buffer.toLowerCase();
      if (!slash && !closingTag && htmlRawNames.includes(name2)) {
        marker = 1;
        return self2.interrupt ? ok2(code2) : continuation(code2);
      }
      if (htmlBlockNames.includes(buffer.toLowerCase())) {
        marker = 6;
        if (slash) {
          effects2.consume(code2);
          return basicSelfClosing;
        }
        return self2.interrupt ? ok2(code2) : continuation(code2);
      }
      marker = 7;
      return self2.interrupt && !self2.parser.lazy[self2.now().line] ? nok(code2) : closingTag ? completeClosingTagAfter(code2) : completeAttributeNameBefore(code2);
    }
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      buffer += String.fromCharCode(code2);
      return tagName;
    }
    return nok(code2);
  }
  function basicSelfClosing(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return self2.interrupt ? ok2 : continuation;
    }
    return nok(code2);
  }
  function completeClosingTagAfter(code2) {
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeClosingTagAfter;
    }
    return completeEnd(code2);
  }
  function completeAttributeNameBefore(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      return completeEnd;
    }
    if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) {
      effects2.consume(code2);
      return completeAttributeName;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeNameBefore;
    }
    return completeEnd(code2);
  }
  function completeAttributeName(code2) {
    if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return completeAttributeName;
    }
    return completeAttributeNameAfter(code2);
  }
  function completeAttributeNameAfter(code2) {
    if (code2 === 61) {
      effects2.consume(code2);
      return completeAttributeValueBefore;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeNameAfter;
    }
    return completeAttributeNameBefore(code2);
  }
  function completeAttributeValueBefore(code2) {
    if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 34 || code2 === 39) {
      effects2.consume(code2);
      markerB = code2;
      return completeAttributeValueQuoted;
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAttributeValueBefore;
    }
    return completeAttributeValueUnquoted(code2);
  }
  function completeAttributeValueQuoted(code2) {
    if (code2 === markerB) {
      effects2.consume(code2);
      markerB = null;
      return completeAttributeValueQuotedAfter;
    }
    if (code2 === null || markdownLineEnding(code2)) {
      return nok(code2);
    }
    effects2.consume(code2);
    return completeAttributeValueQuoted;
  }
  function completeAttributeValueUnquoted(code2) {
    if (code2 === null || code2 === 34 || code2 === 39 || code2 === 47 || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96 || markdownLineEndingOrSpace(code2)) {
      return completeAttributeNameAfter(code2);
    }
    effects2.consume(code2);
    return completeAttributeValueUnquoted;
  }
  function completeAttributeValueQuotedAfter(code2) {
    if (code2 === 47 || code2 === 62 || markdownSpace(code2)) {
      return completeAttributeNameBefore(code2);
    }
    return nok(code2);
  }
  function completeEnd(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return completeAfter;
    }
    return nok(code2);
  }
  function completeAfter(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return continuation(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return completeAfter;
    }
    return nok(code2);
  }
  function continuation(code2) {
    if (code2 === 45 && marker === 2) {
      effects2.consume(code2);
      return continuationCommentInside;
    }
    if (code2 === 60 && marker === 1) {
      effects2.consume(code2);
      return continuationRawTagOpen;
    }
    if (code2 === 62 && marker === 4) {
      effects2.consume(code2);
      return continuationClose;
    }
    if (code2 === 63 && marker === 3) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    if (code2 === 93 && marker === 5) {
      effects2.consume(code2);
      return continuationCdataInside;
    }
    if (markdownLineEnding(code2) && (marker === 6 || marker === 7)) {
      effects2.exit("htmlFlowData");
      return effects2.check(blankLineBefore, continuationAfter, continuationStart)(code2);
    }
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("htmlFlowData");
      return continuationStart(code2);
    }
    effects2.consume(code2);
    return continuation;
  }
  function continuationStart(code2) {
    return effects2.check(nonLazyContinuationStart, continuationStartNonLazy, continuationAfter)(code2);
  }
  function continuationStartNonLazy(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return continuationBefore;
  }
  function continuationBefore(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      return continuationStart(code2);
    }
    effects2.enter("htmlFlowData");
    return continuation(code2);
  }
  function continuationCommentInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationRawTagOpen(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      buffer = "";
      return continuationRawEndTag;
    }
    return continuation(code2);
  }
  function continuationRawEndTag(code2) {
    if (code2 === 62) {
      const name2 = buffer.toLowerCase();
      if (htmlRawNames.includes(name2)) {
        effects2.consume(code2);
        return continuationClose;
      }
      return continuation(code2);
    }
    if (asciiAlpha(code2) && buffer.length < 8) {
      effects2.consume(code2);
      buffer += String.fromCharCode(code2);
      return continuationRawEndTag;
    }
    return continuation(code2);
  }
  function continuationCdataInside(code2) {
    if (code2 === 93) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationDeclarationInside(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      return continuationClose;
    }
    if (code2 === 45 && marker === 2) {
      effects2.consume(code2);
      return continuationDeclarationInside;
    }
    return continuation(code2);
  }
  function continuationClose(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("htmlFlowData");
      return continuationAfter(code2);
    }
    effects2.consume(code2);
    return continuationClose;
  }
  function continuationAfter(code2) {
    effects2.exit("htmlFlow");
    return ok2(code2);
  }
}
function tokenizeNonLazyContinuationStart(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    if (markdownLineEnding(code2)) {
      effects2.enter("lineEnding");
      effects2.consume(code2);
      effects2.exit("lineEnding");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    return self2.parser.lazy[self2.now().line] ? nok(code2) : ok2(code2);
  }
}
function tokenizeBlankLineBefore(effects2, ok2, nok) {
  return start;
  function start(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return effects2.attempt(blankLine, ok2, nok);
  }
}
const htmlText = {
  name: "htmlText",
  tokenize: tokenizeHtmlText
};
function tokenizeHtmlText(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  let index2;
  let returnState;
  return start;
  function start(code2) {
    effects2.enter("htmlText");
    effects2.enter("htmlTextData");
    effects2.consume(code2);
    return open;
  }
  function open(code2) {
    if (code2 === 33) {
      effects2.consume(code2);
      return declarationOpen;
    }
    if (code2 === 47) {
      effects2.consume(code2);
      return tagCloseStart;
    }
    if (code2 === 63) {
      effects2.consume(code2);
      return instruction;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagOpen;
    }
    return nok(code2);
  }
  function declarationOpen(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentOpenInside;
    }
    if (code2 === 91) {
      effects2.consume(code2);
      index2 = 0;
      return cdataOpenInside;
    }
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return declaration2;
    }
    return nok(code2);
  }
  function commentOpenInside(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentEnd;
    }
    return nok(code2);
  }
  function comment2(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 45) {
      effects2.consume(code2);
      return commentClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = comment2;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return comment2;
  }
  function commentClose(code2) {
    if (code2 === 45) {
      effects2.consume(code2);
      return commentEnd;
    }
    return comment2(code2);
  }
  function commentEnd(code2) {
    return code2 === 62 ? end(code2) : code2 === 45 ? commentClose(code2) : comment2(code2);
  }
  function cdataOpenInside(code2) {
    const value2 = "CDATA[";
    if (code2 === value2.charCodeAt(index2++)) {
      effects2.consume(code2);
      return index2 === value2.length ? cdata : cdataOpenInside;
    }
    return nok(code2);
  }
  function cdata(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = cdata;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return cdata;
  }
  function cdataClose(code2) {
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataEnd;
    }
    return cdata(code2);
  }
  function cdataEnd(code2) {
    if (code2 === 62) {
      return end(code2);
    }
    if (code2 === 93) {
      effects2.consume(code2);
      return cdataEnd;
    }
    return cdata(code2);
  }
  function declaration2(code2) {
    if (code2 === null || code2 === 62) {
      return end(code2);
    }
    if (markdownLineEnding(code2)) {
      returnState = declaration2;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return declaration2;
  }
  function instruction(code2) {
    if (code2 === null) {
      return nok(code2);
    }
    if (code2 === 63) {
      effects2.consume(code2);
      return instructionClose;
    }
    if (markdownLineEnding(code2)) {
      returnState = instruction;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return instruction;
  }
  function instructionClose(code2) {
    return code2 === 62 ? end(code2) : instruction(code2);
  }
  function tagCloseStart(code2) {
    if (asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagClose;
    }
    return nok(code2);
  }
  function tagClose(code2) {
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagClose;
    }
    return tagCloseBetween(code2);
  }
  function tagCloseBetween(code2) {
    if (markdownLineEnding(code2)) {
      returnState = tagCloseBetween;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagCloseBetween;
    }
    return end(code2);
  }
  function tagOpen(code2) {
    if (code2 === 45 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagOpen;
    }
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    return nok(code2);
  }
  function tagOpenBetween(code2) {
    if (code2 === 47) {
      effects2.consume(code2);
      return end;
    }
    if (code2 === 58 || code2 === 95 || asciiAlpha(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeName;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenBetween;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenBetween;
    }
    return end(code2);
  }
  function tagOpenAttributeName(code2) {
    if (code2 === 45 || code2 === 46 || code2 === 58 || code2 === 95 || asciiAlphanumeric(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeName;
    }
    return tagOpenAttributeNameAfter(code2);
  }
  function tagOpenAttributeNameAfter(code2) {
    if (code2 === 61) {
      effects2.consume(code2);
      return tagOpenAttributeValueBefore;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeNameAfter;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeNameAfter;
    }
    return tagOpenBetween(code2);
  }
  function tagOpenAttributeValueBefore(code2) {
    if (code2 === null || code2 === 60 || code2 === 61 || code2 === 62 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 34 || code2 === 39) {
      effects2.consume(code2);
      marker = code2;
      return tagOpenAttributeValueQuoted;
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeValueBefore;
      return lineEndingBefore(code2);
    }
    if (markdownSpace(code2)) {
      effects2.consume(code2);
      return tagOpenAttributeValueBefore;
    }
    effects2.consume(code2);
    return tagOpenAttributeValueUnquoted;
  }
  function tagOpenAttributeValueQuoted(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      marker = void 0;
      return tagOpenAttributeValueQuotedAfter;
    }
    if (code2 === null) {
      return nok(code2);
    }
    if (markdownLineEnding(code2)) {
      returnState = tagOpenAttributeValueQuoted;
      return lineEndingBefore(code2);
    }
    effects2.consume(code2);
    return tagOpenAttributeValueQuoted;
  }
  function tagOpenAttributeValueUnquoted(code2) {
    if (code2 === null || code2 === 34 || code2 === 39 || code2 === 60 || code2 === 61 || code2 === 96) {
      return nok(code2);
    }
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    effects2.consume(code2);
    return tagOpenAttributeValueUnquoted;
  }
  function tagOpenAttributeValueQuotedAfter(code2) {
    if (code2 === 47 || code2 === 62 || markdownLineEndingOrSpace(code2)) {
      return tagOpenBetween(code2);
    }
    return nok(code2);
  }
  function end(code2) {
    if (code2 === 62) {
      effects2.consume(code2);
      effects2.exit("htmlTextData");
      effects2.exit("htmlText");
      return ok2;
    }
    return nok(code2);
  }
  function lineEndingBefore(code2) {
    effects2.exit("htmlTextData");
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return lineEndingAfter;
  }
  function lineEndingAfter(code2) {
    return markdownSpace(code2) ? factorySpace(effects2, lineEndingAfterPrefix, "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2) : lineEndingAfterPrefix(code2);
  }
  function lineEndingAfterPrefix(code2) {
    effects2.enter("htmlTextData");
    return returnState(code2);
  }
}
const labelEnd = {
  name: "labelEnd",
  resolveAll: resolveAllLabelEnd,
  resolveTo: resolveToLabelEnd,
  tokenize: tokenizeLabelEnd
};
const resourceConstruct = {
  tokenize: tokenizeResource
};
const referenceFullConstruct = {
  tokenize: tokenizeReferenceFull
};
const referenceCollapsedConstruct = {
  tokenize: tokenizeReferenceCollapsed
};
function resolveAllLabelEnd(events2) {
  let index2 = -1;
  const newEvents = [];
  while (++index2 < events2.length) {
    const token2 = events2[index2][1];
    newEvents.push(events2[index2]);
    if (token2.type === "labelImage" || token2.type === "labelLink" || token2.type === "labelEnd") {
      const offset2 = token2.type === "labelImage" ? 4 : 2;
      token2.type = "data";
      index2 += offset2;
    }
  }
  if (events2.length !== newEvents.length) {
    splice(events2, 0, events2.length, newEvents);
  }
  return events2;
}
function resolveToLabelEnd(events2, context) {
  let index2 = events2.length;
  let offset2 = 0;
  let token2;
  let open;
  let close;
  let media;
  while (index2--) {
    token2 = events2[index2][1];
    if (open) {
      if (token2.type === "link" || token2.type === "labelLink" && token2._inactive) {
        break;
      }
      if (events2[index2][0] === "enter" && token2.type === "labelLink") {
        token2._inactive = true;
      }
    } else if (close) {
      if (events2[index2][0] === "enter" && (token2.type === "labelImage" || token2.type === "labelLink") && !token2._balanced) {
        open = index2;
        if (token2.type !== "labelLink") {
          offset2 = 2;
          break;
        }
      }
    } else if (token2.type === "labelEnd") {
      close = index2;
    }
  }
  const group = {
    type: events2[open][1].type === "labelLink" ? "link" : "image",
    start: {
      ...events2[open][1].start
    },
    end: {
      ...events2[events2.length - 1][1].end
    }
  };
  const label = {
    type: "label",
    start: {
      ...events2[open][1].start
    },
    end: {
      ...events2[close][1].end
    }
  };
  const text2 = {
    type: "labelText",
    start: {
      ...events2[open + offset2 + 2][1].end
    },
    end: {
      ...events2[close - 2][1].start
    }
  };
  media = [["enter", group, context], ["enter", label, context]];
  media = push(media, events2.slice(open + 1, open + offset2 + 3));
  media = push(media, [["enter", text2, context]]);
  media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events2.slice(open + offset2 + 4, close - 3), context));
  media = push(media, [["exit", text2, context], events2[close - 2], events2[close - 1], ["exit", label, context]]);
  media = push(media, events2.slice(close + 1));
  media = push(media, [["exit", group, context]]);
  splice(events2, open, events2.length, media);
  return events2;
}
function tokenizeLabelEnd(effects2, ok2, nok) {
  const self2 = this;
  let index2 = self2.events.length;
  let labelStart;
  let defined2;
  while (index2--) {
    if ((self2.events[index2][1].type === "labelImage" || self2.events[index2][1].type === "labelLink") && !self2.events[index2][1]._balanced) {
      labelStart = self2.events[index2][1];
      break;
    }
  }
  return start;
  function start(code2) {
    if (!labelStart) {
      return nok(code2);
    }
    if (labelStart._inactive) {
      return labelEndNok(code2);
    }
    defined2 = self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize({
      start: labelStart.end,
      end: self2.now()
    })));
    effects2.enter("labelEnd");
    effects2.enter("labelMarker");
    effects2.consume(code2);
    effects2.exit("labelMarker");
    effects2.exit("labelEnd");
    return after;
  }
  function after(code2) {
    if (code2 === 40) {
      return effects2.attempt(resourceConstruct, labelEndOk, defined2 ? labelEndOk : labelEndNok)(code2);
    }
    if (code2 === 91) {
      return effects2.attempt(referenceFullConstruct, labelEndOk, defined2 ? referenceNotFull : labelEndNok)(code2);
    }
    return defined2 ? labelEndOk(code2) : labelEndNok(code2);
  }
  function referenceNotFull(code2) {
    return effects2.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code2);
  }
  function labelEndOk(code2) {
    return ok2(code2);
  }
  function labelEndNok(code2) {
    labelStart._balanced = true;
    return nok(code2);
  }
}
function tokenizeResource(effects2, ok2, nok) {
  return resourceStart;
  function resourceStart(code2) {
    effects2.enter("resource");
    effects2.enter("resourceMarker");
    effects2.consume(code2);
    effects2.exit("resourceMarker");
    return resourceBefore;
  }
  function resourceBefore(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceOpen)(code2) : resourceOpen(code2);
  }
  function resourceOpen(code2) {
    if (code2 === 41) {
      return resourceEnd(code2);
    }
    return factoryDestination(effects2, resourceDestinationAfter, resourceDestinationMissing, "resourceDestination", "resourceDestinationLiteral", "resourceDestinationLiteralMarker", "resourceDestinationRaw", "resourceDestinationString", 32)(code2);
  }
  function resourceDestinationAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceBetween)(code2) : resourceEnd(code2);
  }
  function resourceDestinationMissing(code2) {
    return nok(code2);
  }
  function resourceBetween(code2) {
    if (code2 === 34 || code2 === 39 || code2 === 40) {
      return factoryTitle(effects2, resourceTitleAfter, nok, "resourceTitle", "resourceTitleMarker", "resourceTitleString")(code2);
    }
    return resourceEnd(code2);
  }
  function resourceTitleAfter(code2) {
    return markdownLineEndingOrSpace(code2) ? factoryWhitespace(effects2, resourceEnd)(code2) : resourceEnd(code2);
  }
  function resourceEnd(code2) {
    if (code2 === 41) {
      effects2.enter("resourceMarker");
      effects2.consume(code2);
      effects2.exit("resourceMarker");
      effects2.exit("resource");
      return ok2;
    }
    return nok(code2);
  }
}
function tokenizeReferenceFull(effects2, ok2, nok) {
  const self2 = this;
  return referenceFull;
  function referenceFull(code2) {
    return factoryLabel.call(self2, effects2, referenceFullAfter, referenceFullMissing, "reference", "referenceMarker", "referenceString")(code2);
  }
  function referenceFullAfter(code2) {
    return self2.parser.defined.includes(normalizeIdentifier(self2.sliceSerialize(self2.events[self2.events.length - 1][1]).slice(1, -1))) ? ok2(code2) : nok(code2);
  }
  function referenceFullMissing(code2) {
    return nok(code2);
  }
}
function tokenizeReferenceCollapsed(effects2, ok2, nok) {
  return referenceCollapsedStart;
  function referenceCollapsedStart(code2) {
    effects2.enter("reference");
    effects2.enter("referenceMarker");
    effects2.consume(code2);
    effects2.exit("referenceMarker");
    return referenceCollapsedOpen;
  }
  function referenceCollapsedOpen(code2) {
    if (code2 === 93) {
      effects2.enter("referenceMarker");
      effects2.consume(code2);
      effects2.exit("referenceMarker");
      effects2.exit("reference");
      return ok2;
    }
    return nok(code2);
  }
}
const labelStartImage = {
  name: "labelStartImage",
  resolveAll: labelEnd.resolveAll,
  tokenize: tokenizeLabelStartImage
};
function tokenizeLabelStartImage(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    effects2.enter("labelImage");
    effects2.enter("labelImageMarker");
    effects2.consume(code2);
    effects2.exit("labelImageMarker");
    return open;
  }
  function open(code2) {
    if (code2 === 91) {
      effects2.enter("labelMarker");
      effects2.consume(code2);
      effects2.exit("labelMarker");
      effects2.exit("labelImage");
      return after;
    }
    return nok(code2);
  }
  function after(code2) {
    return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  }
}
const labelStartLink = {
  name: "labelStartLink",
  resolveAll: labelEnd.resolveAll,
  tokenize: tokenizeLabelStartLink
};
function tokenizeLabelStartLink(effects2, ok2, nok) {
  const self2 = this;
  return start;
  function start(code2) {
    effects2.enter("labelLink");
    effects2.enter("labelMarker");
    effects2.consume(code2);
    effects2.exit("labelMarker");
    effects2.exit("labelLink");
    return after;
  }
  function after(code2) {
    return code2 === 94 && "_hiddenFootnoteSupport" in self2.parser.constructs ? nok(code2) : ok2(code2);
  }
}
const lineEnding = {
  name: "lineEnding",
  tokenize: tokenizeLineEnding
};
function tokenizeLineEnding(effects2, ok2) {
  return start;
  function start(code2) {
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    return factorySpace(effects2, ok2, "linePrefix");
  }
}
const thematicBreak$1 = {
  name: "thematicBreak",
  tokenize: tokenizeThematicBreak
};
function tokenizeThematicBreak(effects2, ok2, nok) {
  let size2 = 0;
  let marker;
  return start;
  function start(code2) {
    effects2.enter("thematicBreak");
    return before(code2);
  }
  function before(code2) {
    marker = code2;
    return atBreak(code2);
  }
  function atBreak(code2) {
    if (code2 === marker) {
      effects2.enter("thematicBreakSequence");
      return sequence(code2);
    }
    if (size2 >= 3 && (code2 === null || markdownLineEnding(code2))) {
      effects2.exit("thematicBreak");
      return ok2(code2);
    }
    return nok(code2);
  }
  function sequence(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      size2++;
      return sequence;
    }
    effects2.exit("thematicBreakSequence");
    return markdownSpace(code2) ? factorySpace(effects2, atBreak, "whitespace")(code2) : atBreak(code2);
  }
}
const list$1 = {
  continuation: {
    tokenize: tokenizeListContinuation
  },
  exit: tokenizeListEnd,
  name: "list",
  tokenize: tokenizeListStart
};
const listItemPrefixWhitespaceConstruct = {
  partial: true,
  tokenize: tokenizeListItemPrefixWhitespace
};
const indentConstruct = {
  partial: true,
  tokenize: tokenizeIndent
};
function tokenizeListStart(effects2, ok2, nok) {
  const self2 = this;
  const tail = self2.events[self2.events.length - 1];
  let initialSize = tail && tail[1].type === "linePrefix" ? tail[2].sliceSerialize(tail[1], true).length : 0;
  let size2 = 0;
  return start;
  function start(code2) {
    const kind = self2.containerState.type || (code2 === 42 || code2 === 43 || code2 === 45 ? "listUnordered" : "listOrdered");
    if (kind === "listUnordered" ? !self2.containerState.marker || code2 === self2.containerState.marker : asciiDigit(code2)) {
      if (!self2.containerState.type) {
        self2.containerState.type = kind;
        effects2.enter(kind, {
          _container: true
        });
      }
      if (kind === "listUnordered") {
        effects2.enter("listItemPrefix");
        return code2 === 42 || code2 === 45 ? effects2.check(thematicBreak$1, nok, atMarker)(code2) : atMarker(code2);
      }
      if (!self2.interrupt || code2 === 49) {
        effects2.enter("listItemPrefix");
        effects2.enter("listItemValue");
        return inside(code2);
      }
    }
    return nok(code2);
  }
  function inside(code2) {
    if (asciiDigit(code2) && ++size2 < 10) {
      effects2.consume(code2);
      return inside;
    }
    if ((!self2.interrupt || size2 < 2) && (self2.containerState.marker ? code2 === self2.containerState.marker : code2 === 41 || code2 === 46)) {
      effects2.exit("listItemValue");
      return atMarker(code2);
    }
    return nok(code2);
  }
  function atMarker(code2) {
    effects2.enter("listItemMarker");
    effects2.consume(code2);
    effects2.exit("listItemMarker");
    self2.containerState.marker = self2.containerState.marker || code2;
    return effects2.check(
      blankLine,
      // Can’t be empty when interrupting.
      self2.interrupt ? nok : onBlank,
      effects2.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix)
    );
  }
  function onBlank(code2) {
    self2.containerState.initialBlankLine = true;
    initialSize++;
    return endOfPrefix(code2);
  }
  function otherPrefix(code2) {
    if (markdownSpace(code2)) {
      effects2.enter("listItemPrefixWhitespace");
      effects2.consume(code2);
      effects2.exit("listItemPrefixWhitespace");
      return endOfPrefix;
    }
    return nok(code2);
  }
  function endOfPrefix(code2) {
    self2.containerState.size = initialSize + self2.sliceSerialize(effects2.exit("listItemPrefix"), true).length;
    return ok2(code2);
  }
}
function tokenizeListContinuation(effects2, ok2, nok) {
  const self2 = this;
  self2.containerState._closeFlow = void 0;
  return effects2.check(blankLine, onBlank, notBlank);
  function onBlank(code2) {
    self2.containerState.furtherBlankLines = self2.containerState.furtherBlankLines || self2.containerState.initialBlankLine;
    return factorySpace(effects2, ok2, "listItemIndent", self2.containerState.size + 1)(code2);
  }
  function notBlank(code2) {
    if (self2.containerState.furtherBlankLines || !markdownSpace(code2)) {
      self2.containerState.furtherBlankLines = void 0;
      self2.containerState.initialBlankLine = void 0;
      return notInCurrentItem(code2);
    }
    self2.containerState.furtherBlankLines = void 0;
    self2.containerState.initialBlankLine = void 0;
    return effects2.attempt(indentConstruct, ok2, notInCurrentItem)(code2);
  }
  function notInCurrentItem(code2) {
    self2.containerState._closeFlow = true;
    self2.interrupt = void 0;
    return factorySpace(effects2, effects2.attempt(list$1, ok2, nok), "linePrefix", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4)(code2);
  }
}
function tokenizeIndent(effects2, ok2, nok) {
  const self2 = this;
  return factorySpace(effects2, afterPrefix, "listItemIndent", self2.containerState.size + 1);
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return tail && tail[1].type === "listItemIndent" && tail[2].sliceSerialize(tail[1], true).length === self2.containerState.size ? ok2(code2) : nok(code2);
  }
}
function tokenizeListEnd(effects2) {
  effects2.exit(this.containerState.type);
}
function tokenizeListItemPrefixWhitespace(effects2, ok2, nok) {
  const self2 = this;
  return factorySpace(effects2, afterPrefix, "listItemPrefixWhitespace", self2.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4 + 1);
  function afterPrefix(code2) {
    const tail = self2.events[self2.events.length - 1];
    return !markdownSpace(code2) && tail && tail[1].type === "listItemPrefixWhitespace" ? ok2(code2) : nok(code2);
  }
}
const setextUnderline = {
  name: "setextUnderline",
  resolveTo: resolveToSetextUnderline,
  tokenize: tokenizeSetextUnderline
};
function resolveToSetextUnderline(events2, context) {
  let index2 = events2.length;
  let content2;
  let text2;
  let definition2;
  while (index2--) {
    if (events2[index2][0] === "enter") {
      if (events2[index2][1].type === "content") {
        content2 = index2;
        break;
      }
      if (events2[index2][1].type === "paragraph") {
        text2 = index2;
      }
    } else {
      if (events2[index2][1].type === "content") {
        events2.splice(index2, 1);
      }
      if (!definition2 && events2[index2][1].type === "definition") {
        definition2 = index2;
      }
    }
  }
  const heading2 = {
    type: "setextHeading",
    start: {
      ...events2[content2][1].start
    },
    end: {
      ...events2[events2.length - 1][1].end
    }
  };
  events2[text2][1].type = "setextHeadingText";
  if (definition2) {
    events2.splice(text2, 0, ["enter", heading2, context]);
    events2.splice(definition2 + 1, 0, ["exit", events2[content2][1], context]);
    events2[content2][1].end = {
      ...events2[definition2][1].end
    };
  } else {
    events2[content2][1] = heading2;
  }
  events2.push(["exit", heading2, context]);
  return events2;
}
function tokenizeSetextUnderline(effects2, ok2, nok) {
  const self2 = this;
  let marker;
  return start;
  function start(code2) {
    let index2 = self2.events.length;
    let paragraph2;
    while (index2--) {
      if (self2.events[index2][1].type !== "lineEnding" && self2.events[index2][1].type !== "linePrefix" && self2.events[index2][1].type !== "content") {
        paragraph2 = self2.events[index2][1].type === "paragraph";
        break;
      }
    }
    if (!self2.parser.lazy[self2.now().line] && (self2.interrupt || paragraph2)) {
      effects2.enter("setextHeadingLine");
      marker = code2;
      return before(code2);
    }
    return nok(code2);
  }
  function before(code2) {
    effects2.enter("setextHeadingLineSequence");
    return inside(code2);
  }
  function inside(code2) {
    if (code2 === marker) {
      effects2.consume(code2);
      return inside;
    }
    effects2.exit("setextHeadingLineSequence");
    return markdownSpace(code2) ? factorySpace(effects2, after, "lineSuffix")(code2) : after(code2);
  }
  function after(code2) {
    if (code2 === null || markdownLineEnding(code2)) {
      effects2.exit("setextHeadingLine");
      return ok2(code2);
    }
    return nok(code2);
  }
}
const flow$1 = {
  tokenize: initializeFlow
};
function initializeFlow(effects2) {
  const self2 = this;
  const initial = effects2.attempt(
    // Try to parse a blank line.
    blankLine,
    atBlankEnding,
    // Try to parse initial flow (essentially, only code).
    effects2.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects2, effects2.attempt(this.parser.constructs.flow, afterConstruct, effects2.attempt(content, afterConstruct)), "linePrefix"))
  );
  return initial;
  function atBlankEnding(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEndingBlank");
    effects2.consume(code2);
    effects2.exit("lineEndingBlank");
    self2.currentConstruct = void 0;
    return initial;
  }
  function afterConstruct(code2) {
    if (code2 === null) {
      effects2.consume(code2);
      return;
    }
    effects2.enter("lineEnding");
    effects2.consume(code2);
    effects2.exit("lineEnding");
    self2.currentConstruct = void 0;
    return initial;
  }
}
const resolver = {
  resolveAll: createResolver()
};
const string$1 = initializeFactory("string");
const text$2 = initializeFactory("text");
function initializeFactory(field) {
  return {
    resolveAll: createResolver(field === "text" ? resolveAllLineSuffixes : void 0),
    tokenize: initializeText
  };
  function initializeText(effects2) {
    const self2 = this;
    const constructs2 = this.parser.constructs[field];
    const text2 = effects2.attempt(constructs2, start, notText);
    return start;
    function start(code2) {
      return atBreak(code2) ? text2(code2) : notText(code2);
    }
    function notText(code2) {
      if (code2 === null) {
        effects2.consume(code2);
        return;
      }
      effects2.enter("data");
      effects2.consume(code2);
      return data;
    }
    function data(code2) {
      if (atBreak(code2)) {
        effects2.exit("data");
        return text2(code2);
      }
      effects2.consume(code2);
      return data;
    }
    function atBreak(code2) {
      if (code2 === null) {
        return true;
      }
      const list2 = constructs2[code2];
      let index2 = -1;
      if (list2) {
        while (++index2 < list2.length) {
          const item = list2[index2];
          if (!item.previous || item.previous.call(self2, self2.previous)) {
            return true;
          }
        }
      }
      return false;
    }
  }
}
function createResolver(extraResolver) {
  return resolveAllText;
  function resolveAllText(events2, context) {
    let index2 = -1;
    let enter;
    while (++index2 <= events2.length) {
      if (enter === void 0) {
        if (events2[index2] && events2[index2][1].type === "data") {
          enter = index2;
          index2++;
        }
      } else if (!events2[index2] || events2[index2][1].type !== "data") {
        if (index2 !== enter + 2) {
          events2[enter][1].end = events2[index2 - 1][1].end;
          events2.splice(enter + 2, index2 - enter - 2);
          index2 = enter + 2;
        }
        enter = void 0;
      }
    }
    return extraResolver ? extraResolver(events2, context) : events2;
  }
}
function resolveAllLineSuffixes(events2, context) {
  let eventIndex = 0;
  while (++eventIndex <= events2.length) {
    if ((eventIndex === events2.length || events2[eventIndex][1].type === "lineEnding") && events2[eventIndex - 1][1].type === "data") {
      const data = events2[eventIndex - 1][1];
      const chunks = context.sliceStream(data);
      let index2 = chunks.length;
      let bufferIndex = -1;
      let size2 = 0;
      let tabs2;
      while (index2--) {
        const chunk = chunks[index2];
        if (typeof chunk === "string") {
          bufferIndex = chunk.length;
          while (chunk.charCodeAt(bufferIndex - 1) === 32) {
            size2++;
            bufferIndex--;
          }
          if (bufferIndex)
            break;
          bufferIndex = -1;
        } else if (chunk === -2) {
          tabs2 = true;
          size2++;
        } else if (chunk === -1)
          ;
        else {
          index2++;
          break;
        }
      }
      if (context._contentTypeTextTrailing && eventIndex === events2.length) {
        size2 = 0;
      }
      if (size2) {
        const token2 = {
          type: eventIndex === events2.length || tabs2 || size2 < 2 ? "lineSuffix" : "hardBreakTrailing",
          start: {
            _bufferIndex: index2 ? bufferIndex : data.start._bufferIndex + bufferIndex,
            _index: data.start._index + index2,
            line: data.end.line,
            column: data.end.column - size2,
            offset: data.end.offset - size2
          },
          end: {
            ...data.end
          }
        };
        data.end = {
          ...token2.start
        };
        if (data.start.offset === data.end.offset) {
          Object.assign(data, token2);
        } else {
          events2.splice(eventIndex, 0, ["enter", token2, context], ["exit", token2, context]);
          eventIndex += 2;
        }
      }
      eventIndex++;
    }
  }
  return events2;
}
const document$1 = {
  [42]: list$1,
  [43]: list$1,
  [45]: list$1,
  [48]: list$1,
  [49]: list$1,
  [50]: list$1,
  [51]: list$1,
  [52]: list$1,
  [53]: list$1,
  [54]: list$1,
  [55]: list$1,
  [56]: list$1,
  [57]: list$1,
  [62]: blockQuote
};
const contentInitial = {
  [91]: definition
};
const flowInitial = {
  [-2]: codeIndented,
  [-1]: codeIndented,
  [32]: codeIndented
};
const flow = {
  [35]: headingAtx,
  [42]: thematicBreak$1,
  [45]: [setextUnderline, thematicBreak$1],
  [60]: htmlFlow,
  [61]: setextUnderline,
  [95]: thematicBreak$1,
  [96]: codeFenced,
  [126]: codeFenced
};
const string2 = {
  [38]: characterReference,
  [92]: characterEscape
};
const text$1 = {
  [-5]: lineEnding,
  [-4]: lineEnding,
  [-3]: lineEnding,
  [33]: labelStartImage,
  [38]: characterReference,
  [42]: attention,
  [60]: [autolink, htmlText],
  [91]: labelStartLink,
  [92]: [hardBreakEscape, characterEscape],
  [93]: labelEnd,
  [95]: attention,
  [96]: codeText
};
const insideSpan = {
  null: [attention, resolver]
};
const attentionMarkers = {
  null: [42, 95]
};
const disable = {
  null: []
};
const defaultConstructs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  attentionMarkers,
  contentInitial,
  disable,
  document: document$1,
  flow,
  flowInitial,
  insideSpan,
  string: string2,
  text: text$1
}, Symbol.toStringTag, { value: "Module" }));
function createTokenizer(parser, initialize, from2) {
  let point2 = {
    _bufferIndex: -1,
    _index: 0,
    line: from2 && from2.line || 1,
    column: from2 && from2.column || 1,
    offset: from2 && from2.offset || 0
  };
  const columnStart = {};
  const resolveAllConstructs = [];
  let chunks = [];
  let stack = [];
  const effects2 = {
    attempt: constructFactory(onsuccessfulconstruct),
    check: constructFactory(onsuccessfulcheck),
    consume,
    enter,
    exit: exit2,
    interrupt: constructFactory(onsuccessfulcheck, {
      interrupt: true
    })
  };
  const context = {
    code: null,
    containerState: {},
    defineSkip,
    events: [],
    now: now2,
    parser,
    previous: null,
    sliceSerialize,
    sliceStream,
    write
  };
  let state = initialize.tokenize.call(context, effects2);
  if (initialize.resolveAll) {
    resolveAllConstructs.push(initialize);
  }
  return context;
  function write(slice2) {
    chunks = push(chunks, slice2);
    main2();
    if (chunks[chunks.length - 1] !== null) {
      return [];
    }
    addResult(initialize, 0);
    context.events = resolveAll(resolveAllConstructs, context.events, context);
    return context.events;
  }
  function sliceSerialize(token2, expandTabs) {
    return serializeChunks(sliceStream(token2), expandTabs);
  }
  function sliceStream(token2) {
    return sliceChunks(chunks, token2);
  }
  function now2() {
    const {
      _bufferIndex,
      _index,
      line: line2,
      column: column2,
      offset: offset2
    } = point2;
    return {
      _bufferIndex,
      _index,
      line: line2,
      column: column2,
      offset: offset2
    };
  }
  function defineSkip(value2) {
    columnStart[value2.line] = value2.column;
    accountForPotentialSkip();
  }
  function main2() {
    let chunkIndex;
    while (point2._index < chunks.length) {
      const chunk = chunks[point2._index];
      if (typeof chunk === "string") {
        chunkIndex = point2._index;
        if (point2._bufferIndex < 0) {
          point2._bufferIndex = 0;
        }
        while (point2._index === chunkIndex && point2._bufferIndex < chunk.length) {
          go(chunk.charCodeAt(point2._bufferIndex));
        }
      } else {
        go(chunk);
      }
    }
  }
  function go(code2) {
    state = state(code2);
  }
  function consume(code2) {
    if (markdownLineEnding(code2)) {
      point2.line++;
      point2.column = 1;
      point2.offset += code2 === -3 ? 2 : 1;
      accountForPotentialSkip();
    } else if (code2 !== -1) {
      point2.column++;
      point2.offset++;
    }
    if (point2._bufferIndex < 0) {
      point2._index++;
    } else {
      point2._bufferIndex++;
      if (point2._bufferIndex === // Points w/ non-negative `_bufferIndex` reference
      // strings.
      /** @type {string} */
      chunks[point2._index].length) {
        point2._bufferIndex = -1;
        point2._index++;
      }
    }
    context.previous = code2;
  }
  function enter(type4, fields) {
    const token2 = fields || {};
    token2.type = type4;
    token2.start = now2();
    context.events.push(["enter", token2, context]);
    stack.push(token2);
    return token2;
  }
  function exit2(type4) {
    const token2 = stack.pop();
    token2.end = now2();
    context.events.push(["exit", token2, context]);
    return token2;
  }
  function onsuccessfulconstruct(construct, info) {
    addResult(construct, info.from);
  }
  function onsuccessfulcheck(_24, info) {
    info.restore();
  }
  function constructFactory(onreturn, fields) {
    return hook;
    function hook(constructs2, returnState, bogusState) {
      let listOfConstructs;
      let constructIndex;
      let currentConstruct;
      let info;
      return Array.isArray(constructs2) ? (
        /* c8 ignore next 1 */
        handleListOfConstructs(constructs2)
      ) : "tokenize" in constructs2 ? (
        // Looks like a construct.
        handleListOfConstructs([
          /** @type {Construct} */
          constructs2
        ])
      ) : handleMapOfConstructs(constructs2);
      function handleMapOfConstructs(map2) {
        return start;
        function start(code2) {
          const left2 = code2 !== null && map2[code2];
          const all3 = code2 !== null && map2.null;
          const list2 = [
            // To do: add more extension tests.
            /* c8 ignore next 2 */
            ...Array.isArray(left2) ? left2 : left2 ? [left2] : [],
            ...Array.isArray(all3) ? all3 : all3 ? [all3] : []
          ];
          return handleListOfConstructs(list2)(code2);
        }
      }
      function handleListOfConstructs(list2) {
        listOfConstructs = list2;
        constructIndex = 0;
        if (list2.length === 0) {
          return bogusState;
        }
        return handleConstruct(list2[constructIndex]);
      }
      function handleConstruct(construct) {
        return start;
        function start(code2) {
          info = store();
          currentConstruct = construct;
          if (!construct.partial) {
            context.currentConstruct = construct;
          }
          if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {
            return nok();
          }
          return construct.tokenize.call(
            // If we do have fields, create an object w/ `context` as its
            // prototype.
            // This allows a “live binding”, which is needed for `interrupt`.
            fields ? Object.assign(Object.create(context), fields) : context,
            effects2,
            ok2,
            nok
          )(code2);
        }
      }
      function ok2(code2) {
        onreturn(currentConstruct, info);
        return returnState;
      }
      function nok(code2) {
        info.restore();
        if (++constructIndex < listOfConstructs.length) {
          return handleConstruct(listOfConstructs[constructIndex]);
        }
        return bogusState;
      }
    }
  }
  function addResult(construct, from3) {
    if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {
      resolveAllConstructs.push(construct);
    }
    if (construct.resolve) {
      splice(context.events, from3, context.events.length - from3, construct.resolve(context.events.slice(from3), context));
    }
    if (construct.resolveTo) {
      context.events = construct.resolveTo(context.events, context);
    }
  }
  function store() {
    const startPoint = now2();
    const startPrevious = context.previous;
    const startCurrentConstruct = context.currentConstruct;
    const startEventsIndex = context.events.length;
    const startStack = Array.from(stack);
    return {
      from: startEventsIndex,
      restore
    };
    function restore() {
      point2 = startPoint;
      context.previous = startPrevious;
      context.currentConstruct = startCurrentConstruct;
      context.events.length = startEventsIndex;
      stack = startStack;
      accountForPotentialSkip();
    }
  }
  function accountForPotentialSkip() {
    if (point2.line in columnStart && point2.column < 2) {
      point2.column = columnStart[point2.line];
      point2.offset += columnStart[point2.line] - 1;
    }
  }
}
function sliceChunks(chunks, token2) {
  const startIndex = token2.start._index;
  const startBufferIndex = token2.start._bufferIndex;
  const endIndex = token2.end._index;
  const endBufferIndex = token2.end._bufferIndex;
  let view;
  if (startIndex === endIndex) {
    view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];
  } else {
    view = chunks.slice(startIndex, endIndex);
    if (startBufferIndex > -1) {
      const head = view[0];
      if (typeof head === "string") {
        view[0] = head.slice(startBufferIndex);
      } else {
        view.shift();
      }
    }
    if (endBufferIndex > 0) {
      view.push(chunks[endIndex].slice(0, endBufferIndex));
    }
  }
  return view;
}
function serializeChunks(chunks, expandTabs) {
  let index2 = -1;
  const result = [];
  let atTab;
  while (++index2 < chunks.length) {
    const chunk = chunks[index2];
    let value2;
    if (typeof chunk === "string") {
      value2 = chunk;
    } else
      switch (chunk) {
        case -5: {
          value2 = "\r";
          break;
        }
        case -4: {
          value2 = "\n";
          break;
        }
        case -3: {
          value2 = "\r\n";
          break;
        }
        case -2: {
          value2 = expandTabs ? " " : "	";
          break;
        }
        case -1: {
          if (!expandTabs && atTab)
            continue;
          value2 = " ";
          break;
        }
        default: {
          value2 = String.fromCharCode(chunk);
        }
      }
    atTab = chunk === -2;
    result.push(value2);
  }
  return result.join("");
}
function parse(options) {
  const settings = options || {};
  const constructs2 = (
    /** @type {FullNormalizedExtension} */
    combineExtensions([defaultConstructs, ...settings.extensions || []])
  );
  const parser = {
    constructs: constructs2,
    content: create2(content$1),
    defined: [],
    document: create2(document$2),
    flow: create2(flow$1),
    lazy: {},
    string: create2(string$1),
    text: create2(text$2)
  };
  return parser;
  function create2(initial) {
    return creator;
    function creator(from2) {
      return createTokenizer(parser, initial, from2);
    }
  }
}
function postprocess(events2) {
  while (!subtokenize(events2)) {
  }
  return events2;
}
const search = /[\0\t\n\r]/g;
function preprocess() {
  let column2 = 1;
  let buffer = "";
  let start = true;
  let atCarriageReturn;
  return preprocessor;
  function preprocessor(value2, encoding, end) {
    const chunks = [];
    let match5;
    let next2;
    let startPosition;
    let endPosition;
    let code2;
    value2 = buffer + (typeof value2 === "string" ? value2.toString() : new TextDecoder(encoding || void 0).decode(value2));
    startPosition = 0;
    buffer = "";
    if (start) {
      if (value2.charCodeAt(0) === 65279) {
        startPosition++;
      }
      start = void 0;
    }
    while (startPosition < value2.length) {
      search.lastIndex = startPosition;
      match5 = search.exec(value2);
      endPosition = match5 && match5.index !== void 0 ? match5.index : value2.length;
      code2 = value2.charCodeAt(endPosition);
      if (!match5) {
        buffer = value2.slice(startPosition);
        break;
      }
      if (code2 === 10 && startPosition === endPosition && atCarriageReturn) {
        chunks.push(-3);
        atCarriageReturn = void 0;
      } else {
        if (atCarriageReturn) {
          chunks.push(-5);
          atCarriageReturn = void 0;
        }
        if (startPosition < endPosition) {
          chunks.push(value2.slice(startPosition, endPosition));
          column2 += endPosition - startPosition;
        }
        switch (code2) {
          case 0: {
            chunks.push(65533);
            column2++;
            break;
          }
          case 9: {
            next2 = Math.ceil(column2 / 4) * 4;
            chunks.push(-2);
            while (column2++ < next2)
              chunks.push(-1);
            break;
          }
          case 10: {
            chunks.push(-4);
            column2 = 1;
            break;
          }
          default: {
            atCarriageReturn = true;
            column2 = 1;
          }
        }
      }
      startPosition = endPosition + 1;
    }
    if (end) {
      if (atCarriageReturn)
        chunks.push(-5);
      if (buffer)
        chunks.push(buffer);
      chunks.push(null);
    }
    return chunks;
  }
}
const characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function decodeString(value2) {
  return value2.replace(characterEscapeOrReference, decode);
}
function decode($0, $1, $2) {
  if ($1) {
    return $1;
  }
  const head = $2.charCodeAt(0);
  if (head === 35) {
    const head2 = $2.charCodeAt(1);
    const hex3 = head2 === 120 || head2 === 88;
    return decodeNumericCharacterReference($2.slice(hex3 ? 2 : 1), hex3 ? 16 : 10);
  }
  return decodeNamedCharacterReference($2) || $0;
}
const own$2 = {}.hasOwnProperty;
function fromMarkdown(value2, encoding, options) {
  if (typeof encoding !== "string") {
    options = encoding;
    encoding = void 0;
  }
  return compiler(options)(postprocess(parse(options).document().write(preprocess()(value2, encoding, true))));
}
function compiler(options) {
  const config2 = {
    transforms: [],
    canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
    enter: {
      autolink: opener(link2),
      autolinkProtocol: onenterdata,
      autolinkEmail: onenterdata,
      atxHeading: opener(heading2),
      blockQuote: opener(blockQuote2),
      characterEscape: onenterdata,
      characterReference: onenterdata,
      codeFenced: opener(codeFlow),
      codeFencedFenceInfo: buffer,
      codeFencedFenceMeta: buffer,
      codeIndented: opener(codeFlow, buffer),
      codeText: opener(codeText2, buffer),
      codeTextData: onenterdata,
      data: onenterdata,
      codeFlowValue: onenterdata,
      definition: opener(definition2),
      definitionDestinationString: buffer,
      definitionLabelString: buffer,
      definitionTitleString: buffer,
      emphasis: opener(emphasis2),
      hardBreakEscape: opener(hardBreak2),
      hardBreakTrailing: opener(hardBreak2),
      htmlFlow: opener(html2, buffer),
      htmlFlowData: onenterdata,
      htmlText: opener(html2, buffer),
      htmlTextData: onenterdata,
      image: opener(image2),
      label: buffer,
      link: opener(link2),
      listItem: opener(listItem2),
      listItemValue: onenterlistitemvalue,
      listOrdered: opener(list2, onenterlistordered),
      listUnordered: opener(list2),
      paragraph: opener(paragraph2),
      reference: onenterreference,
      referenceString: buffer,
      resourceDestinationString: buffer,
      resourceTitleString: buffer,
      setextHeading: opener(heading2),
      strong: opener(strong2),
      thematicBreak: opener(thematicBreak2)
    },
    exit: {
      atxHeading: closer(),
      atxHeadingSequence: onexitatxheadingsequence,
      autolink: closer(),
      autolinkEmail: onexitautolinkemail,
      autolinkProtocol: onexitautolinkprotocol,
      blockQuote: closer(),
      characterEscapeValue: onexitdata,
      characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,
      characterReferenceMarkerNumeric: onexitcharacterreferencemarker,
      characterReferenceValue: onexitcharacterreferencevalue,
      characterReference: onexitcharacterreference,
      codeFenced: closer(onexitcodefenced),
      codeFencedFence: onexitcodefencedfence,
      codeFencedFenceInfo: onexitcodefencedfenceinfo,
      codeFencedFenceMeta: onexitcodefencedfencemeta,
      codeFlowValue: onexitdata,
      codeIndented: closer(onexitcodeindented),
      codeText: closer(onexitcodetext),
      codeTextData: onexitdata,
      data: onexitdata,
      definition: closer(),
      definitionDestinationString: onexitdefinitiondestinationstring,
      definitionLabelString: onexitdefinitionlabelstring,
      definitionTitleString: onexitdefinitiontitlestring,
      emphasis: closer(),
      hardBreakEscape: closer(onexithardbreak),
      hardBreakTrailing: closer(onexithardbreak),
      htmlFlow: closer(onexithtmlflow),
      htmlFlowData: onexitdata,
      htmlText: closer(onexithtmltext),
      htmlTextData: onexitdata,
      image: closer(onexitimage),
      label: onexitlabel,
      labelText: onexitlabeltext,
      lineEnding: onexitlineending,
      link: closer(onexitlink),
      listItem: closer(),
      listOrdered: closer(),
      listUnordered: closer(),
      paragraph: closer(),
      referenceString: onexitreferencestring,
      resourceDestinationString: onexitresourcedestinationstring,
      resourceTitleString: onexitresourcetitlestring,
      resource: onexitresource,
      setextHeading: closer(onexitsetextheading),
      setextHeadingLineSequence: onexitsetextheadinglinesequence,
      setextHeadingText: onexitsetextheadingtext,
      strong: closer(),
      thematicBreak: closer()
    }
  };
  configure(config2, (options || {}).mdastExtensions || []);
  const data = {};
  return compile2;
  function compile2(events2) {
    let tree = {
      type: "root",
      children: []
    };
    const context = {
      stack: [tree],
      tokenStack: [],
      config: config2,
      enter,
      exit: exit2,
      buffer,
      resume,
      data
    };
    const listStack = [];
    let index2 = -1;
    while (++index2 < events2.length) {
      if (events2[index2][1].type === "listOrdered" || events2[index2][1].type === "listUnordered") {
        if (events2[index2][0] === "enter") {
          listStack.push(index2);
        } else {
          const tail = listStack.pop();
          index2 = prepareList(events2, tail, index2);
        }
      }
    }
    index2 = -1;
    while (++index2 < events2.length) {
      const handler = config2[events2[index2][0]];
      if (own$2.call(handler, events2[index2][1].type)) {
        handler[events2[index2][1].type].call(Object.assign({
          sliceSerialize: events2[index2][2].sliceSerialize
        }, context), events2[index2][1]);
      }
    }
    if (context.tokenStack.length > 0) {
      const tail = context.tokenStack[context.tokenStack.length - 1];
      const handler = tail[1] || defaultOnError;
      handler.call(context, void 0, tail[0]);
    }
    tree.position = {
      start: point(events2.length > 0 ? events2[0][1].start : {
        line: 1,
        column: 1,
        offset: 0
      }),
      end: point(events2.length > 0 ? events2[events2.length - 2][1].end : {
        line: 1,
        column: 1,
        offset: 0
      })
    };
    index2 = -1;
    while (++index2 < config2.transforms.length) {
      tree = config2.transforms[index2](tree) || tree;
    }
    return tree;
  }
  function prepareList(events2, start, length2) {
    let index2 = start - 1;
    let containerBalance = -1;
    let listSpread = false;
    let listItem3;
    let lineIndex;
    let firstBlankLineIndex;
    let atMarker;
    while (++index2 <= length2) {
      const event = events2[index2];
      switch (event[1].type) {
        case "listUnordered":
        case "listOrdered":
        case "blockQuote": {
          if (event[0] === "enter") {
            containerBalance++;
          } else {
            containerBalance--;
          }
          atMarker = void 0;
          break;
        }
        case "lineEndingBlank": {
          if (event[0] === "enter") {
            if (listItem3 && !atMarker && !containerBalance && !firstBlankLineIndex) {
              firstBlankLineIndex = index2;
            }
            atMarker = void 0;
          }
          break;
        }
        case "linePrefix":
        case "listItemValue":
        case "listItemMarker":
        case "listItemPrefix":
        case "listItemPrefixWhitespace": {
          break;
        }
        default: {
          atMarker = void 0;
        }
      }
      if (!containerBalance && event[0] === "enter" && event[1].type === "listItemPrefix" || containerBalance === -1 && event[0] === "exit" && (event[1].type === "listUnordered" || event[1].type === "listOrdered")) {
        if (listItem3) {
          let tailIndex = index2;
          lineIndex = void 0;
          while (tailIndex--) {
            const tailEvent = events2[tailIndex];
            if (tailEvent[1].type === "lineEnding" || tailEvent[1].type === "lineEndingBlank") {
              if (tailEvent[0] === "exit")
                continue;
              if (lineIndex) {
                events2[lineIndex][1].type = "lineEndingBlank";
                listSpread = true;
              }
              tailEvent[1].type = "lineEnding";
              lineIndex = tailIndex;
            } else if (tailEvent[1].type === "linePrefix" || tailEvent[1].type === "blockQuotePrefix" || tailEvent[1].type === "blockQuotePrefixWhitespace" || tailEvent[1].type === "blockQuoteMarker" || tailEvent[1].type === "listItemIndent")
              ;
            else {
              break;
            }
          }
          if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {
            listItem3._spread = true;
          }
          listItem3.end = Object.assign({}, lineIndex ? events2[lineIndex][1].start : event[1].end);
          events2.splice(lineIndex || index2, 0, ["exit", listItem3, event[2]]);
          index2++;
          length2++;
        }
        if (event[1].type === "listItemPrefix") {
          const item = {
            type: "listItem",
            _spread: false,
            start: Object.assign({}, event[1].start),
            // @ts-expect-error: we’ll add `end` in a second.
            end: void 0
          };
          listItem3 = item;
          events2.splice(index2, 0, ["enter", item, event[2]]);
          index2++;
          length2++;
          firstBlankLineIndex = void 0;
          atMarker = true;
        }
      }
    }
    events2[start][1]._spread = listSpread;
    return length2;
  }
  function opener(create2, and) {
    return open;
    function open(token2) {
      enter.call(this, create2(token2), token2);
      if (and)
        and.call(this, token2);
    }
  }
  function buffer() {
    this.stack.push({
      type: "fragment",
      children: []
    });
  }
  function enter(node2, token2, errorHandler) {
    const parent = this.stack[this.stack.length - 1];
    const siblings = parent.children;
    siblings.push(node2);
    this.stack.push(node2);
    this.tokenStack.push([token2, errorHandler || void 0]);
    node2.position = {
      start: point(token2.start),
      // @ts-expect-error: `end` will be patched later.
      end: void 0
    };
  }
  function closer(and) {
    return close;
    function close(token2) {
      if (and)
        and.call(this, token2);
      exit2.call(this, token2);
    }
  }
  function exit2(token2, onExitError) {
    const node2 = this.stack.pop();
    const open = this.tokenStack.pop();
    if (!open) {
      throw new Error("Cannot close `" + token2.type + "` (" + stringifyPosition({
        start: token2.start,
        end: token2.end
      }) + "): it’s not open");
    } else if (open[0].type !== token2.type) {
      if (onExitError) {
        onExitError.call(this, token2, open[0]);
      } else {
        const handler = open[1] || defaultOnError;
        handler.call(this, token2, open[0]);
      }
    }
    node2.position.end = point(token2.end);
  }
  function resume() {
    return toString$1(this.stack.pop());
  }
  function onenterlistordered() {
    this.data.expectingFirstListItemValue = true;
  }
  function onenterlistitemvalue(token2) {
    if (this.data.expectingFirstListItemValue) {
      const ancestor = this.stack[this.stack.length - 2];
      ancestor.start = Number.parseInt(this.sliceSerialize(token2), 10);
      this.data.expectingFirstListItemValue = void 0;
    }
  }
  function onexitcodefencedfenceinfo() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.lang = data2;
  }
  function onexitcodefencedfencemeta() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.meta = data2;
  }
  function onexitcodefencedfence() {
    if (this.data.flowCodeInside)
      return;
    this.buffer();
    this.data.flowCodeInside = true;
  }
  function onexitcodefenced() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, "");
    this.data.flowCodeInside = void 0;
  }
  function onexitcodeindented() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2.replace(/(\r?\n|\r)$/g, "");
  }
  function onexitdefinitionlabelstring(token2) {
    const label = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.label = label;
    node2.identifier = normalizeIdentifier(this.sliceSerialize(token2)).toLowerCase();
  }
  function onexitdefinitiontitlestring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.title = data2;
  }
  function onexitdefinitiondestinationstring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.url = data2;
  }
  function onexitatxheadingsequence(token2) {
    const node2 = this.stack[this.stack.length - 1];
    if (!node2.depth) {
      const depth = this.sliceSerialize(token2).length;
      node2.depth = depth;
    }
  }
  function onexitsetextheadingtext() {
    this.data.setextHeadingSlurpLineEnding = true;
  }
  function onexitsetextheadinglinesequence(token2) {
    const node2 = this.stack[this.stack.length - 1];
    node2.depth = this.sliceSerialize(token2).codePointAt(0) === 61 ? 1 : 2;
  }
  function onexitsetextheading() {
    this.data.setextHeadingSlurpLineEnding = void 0;
  }
  function onenterdata(token2) {
    const node2 = this.stack[this.stack.length - 1];
    const siblings = node2.children;
    let tail = siblings[siblings.length - 1];
    if (!tail || tail.type !== "text") {
      tail = text2();
      tail.position = {
        start: point(token2.start),
        // @ts-expect-error: we’ll add `end` later.
        end: void 0
      };
      siblings.push(tail);
    }
    this.stack.push(tail);
  }
  function onexitdata(token2) {
    const tail = this.stack.pop();
    tail.value += this.sliceSerialize(token2);
    tail.position.end = point(token2.end);
  }
  function onexitlineending(token2) {
    const context = this.stack[this.stack.length - 1];
    if (this.data.atHardBreak) {
      const tail = context.children[context.children.length - 1];
      tail.position.end = point(token2.end);
      this.data.atHardBreak = void 0;
      return;
    }
    if (!this.data.setextHeadingSlurpLineEnding && config2.canContainEols.includes(context.type)) {
      onenterdata.call(this, token2);
      onexitdata.call(this, token2);
    }
  }
  function onexithardbreak() {
    this.data.atHardBreak = true;
  }
  function onexithtmlflow() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexithtmltext() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexitcodetext() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.value = data2;
  }
  function onexitlink() {
    const node2 = this.stack[this.stack.length - 1];
    if (this.data.inReference) {
      const referenceType = this.data.referenceType || "shortcut";
      node2.type += "Reference";
      node2.referenceType = referenceType;
      delete node2.url;
      delete node2.title;
    } else {
      delete node2.identifier;
      delete node2.label;
    }
    this.data.referenceType = void 0;
  }
  function onexitimage() {
    const node2 = this.stack[this.stack.length - 1];
    if (this.data.inReference) {
      const referenceType = this.data.referenceType || "shortcut";
      node2.type += "Reference";
      node2.referenceType = referenceType;
      delete node2.url;
      delete node2.title;
    } else {
      delete node2.identifier;
      delete node2.label;
    }
    this.data.referenceType = void 0;
  }
  function onexitlabeltext(token2) {
    const string3 = this.sliceSerialize(token2);
    const ancestor = this.stack[this.stack.length - 2];
    ancestor.label = decodeString(string3);
    ancestor.identifier = normalizeIdentifier(string3).toLowerCase();
  }
  function onexitlabel() {
    const fragment = this.stack[this.stack.length - 1];
    const value2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    this.data.inReference = true;
    if (node2.type === "link") {
      const children = fragment.children;
      node2.children = children;
    } else {
      node2.alt = value2;
    }
  }
  function onexitresourcedestinationstring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.url = data2;
  }
  function onexitresourcetitlestring() {
    const data2 = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.title = data2;
  }
  function onexitresource() {
    this.data.inReference = void 0;
  }
  function onenterreference() {
    this.data.referenceType = "collapsed";
  }
  function onexitreferencestring(token2) {
    const label = this.resume();
    const node2 = this.stack[this.stack.length - 1];
    node2.label = label;
    node2.identifier = normalizeIdentifier(this.sliceSerialize(token2)).toLowerCase();
    this.data.referenceType = "full";
  }
  function onexitcharacterreferencemarker(token2) {
    this.data.characterReferenceType = token2.type;
  }
  function onexitcharacterreferencevalue(token2) {
    const data2 = this.sliceSerialize(token2);
    const type4 = this.data.characterReferenceType;
    let value2;
    if (type4) {
      value2 = decodeNumericCharacterReference(data2, type4 === "characterReferenceMarkerNumeric" ? 10 : 16);
      this.data.characterReferenceType = void 0;
    } else {
      const result = decodeNamedCharacterReference(data2);
      value2 = result;
    }
    const tail = this.stack[this.stack.length - 1];
    tail.value += value2;
  }
  function onexitcharacterreference(token2) {
    const tail = this.stack.pop();
    tail.position.end = point(token2.end);
  }
  function onexitautolinkprotocol(token2) {
    onexitdata.call(this, token2);
    const node2 = this.stack[this.stack.length - 1];
    node2.url = this.sliceSerialize(token2);
  }
  function onexitautolinkemail(token2) {
    onexitdata.call(this, token2);
    const node2 = this.stack[this.stack.length - 1];
    node2.url = "mailto:" + this.sliceSerialize(token2);
  }
  function blockQuote2() {
    return {
      type: "blockquote",
      children: []
    };
  }
  function codeFlow() {
    return {
      type: "code",
      lang: null,
      meta: null,
      value: ""
    };
  }
  function codeText2() {
    return {
      type: "inlineCode",
      value: ""
    };
  }
  function definition2() {
    return {
      type: "definition",
      identifier: "",
      label: null,
      title: null,
      url: ""
    };
  }
  function emphasis2() {
    return {
      type: "emphasis",
      children: []
    };
  }
  function heading2() {
    return {
      type: "heading",
      // @ts-expect-error `depth` will be set later.
      depth: 0,
      children: []
    };
  }
  function hardBreak2() {
    return {
      type: "break"
    };
  }
  function html2() {
    return {
      type: "html",
      value: ""
    };
  }
  function image2() {
    return {
      type: "image",
      title: null,
      url: "",
      alt: null
    };
  }
  function link2() {
    return {
      type: "link",
      title: null,
      url: "",
      children: []
    };
  }
  function list2(token2) {
    return {
      type: "list",
      ordered: token2.type === "listOrdered",
      start: null,
      spread: token2._spread,
      children: []
    };
  }
  function listItem2(token2) {
    return {
      type: "listItem",
      spread: token2._spread,
      checked: null,
      children: []
    };
  }
  function paragraph2() {
    return {
      type: "paragraph",
      children: []
    };
  }
  function strong2() {
    return {
      type: "strong",
      children: []
    };
  }
  function text2() {
    return {
      type: "text",
      value: ""
    };
  }
  function thematicBreak2() {
    return {
      type: "thematicBreak"
    };
  }
}
function point(d2) {
  return {
    line: d2.line,
    column: d2.column,
    offset: d2.offset
  };
}
function configure(combined, extensions) {
  let index2 = -1;
  while (++index2 < extensions.length) {
    const value2 = extensions[index2];
    if (Array.isArray(value2)) {
      configure(combined, value2);
    } else {
      extension(combined, value2);
    }
  }
}
function extension(combined, extension2) {
  let key;
  for (key in extension2) {
    if (own$2.call(extension2, key)) {
      switch (key) {
        case "canContainEols": {
          const right = extension2[key];
          if (right) {
            combined[key].push(...right);
          }
          break;
        }
        case "transforms": {
          const right = extension2[key];
          if (right) {
            combined[key].push(...right);
          }
          break;
        }
        case "enter":
        case "exit": {
          const right = extension2[key];
          if (right) {
            Object.assign(combined[key], right);
          }
          break;
        }
      }
    }
  }
}
function defaultOnError(left2, right) {
  if (left2) {
    throw new Error("Cannot close `" + left2.type + "` (" + stringifyPosition({
      start: left2.start,
      end: left2.end
    }) + "): a different token (`" + right.type + "`, " + stringifyPosition({
      start: right.start,
      end: right.end
    }) + ") is open");
  } else {
    throw new Error("Cannot close document, a token (`" + right.type + "`, " + stringifyPosition({
      start: right.start,
      end: right.end
    }) + ") is still open");
  }
}
function remarkParse(options) {
  const self2 = this;
  self2.parser = parser;
  function parser(doc) {
    return fromMarkdown(doc, {
      ...self2.data("settings"),
      ...options,
      // Note: these options are not in the readme.
      // The goal is for them to be set by plugins on `data` instead of being
      // passed by users.
      extensions: self2.data("micromarkExtensions") || [],
      mdastExtensions: self2.data("fromMarkdownExtensions") || []
    });
  }
}
function blockquote(state, node2) {
  const result = {
    type: "element",
    tagName: "blockquote",
    properties: {},
    children: state.wrap(state.all(node2), true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function hardBreak(state, node2) {
  const result = { type: "element", tagName: "br", properties: {}, children: [] };
  state.patch(node2, result);
  return [state.applyData(node2, result), { type: "text", value: "\n" }];
}
function code(state, node2) {
  const value2 = node2.value ? node2.value + "\n" : "";
  const properties2 = {};
  if (node2.lang) {
    properties2.className = ["language-" + node2.lang];
  }
  let result = {
    type: "element",
    tagName: "code",
    properties: properties2,
    children: [{ type: "text", value: value2 }]
  };
  if (node2.meta) {
    result.data = { meta: node2.meta };
  }
  state.patch(node2, result);
  result = state.applyData(node2, result);
  result = { type: "element", tagName: "pre", properties: {}, children: [result] };
  state.patch(node2, result);
  return result;
}
function strikethrough(state, node2) {
  const result = {
    type: "element",
    tagName: "del",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function emphasis(state, node2) {
  const result = {
    type: "element",
    tagName: "em",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function footnoteReference(state, node2) {
  const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  const id2 = String(node2.identifier).toUpperCase();
  const safeId = normalizeUri(id2.toLowerCase());
  const index2 = state.footnoteOrder.indexOf(id2);
  let counter;
  let reuseCounter = state.footnoteCounts.get(id2);
  if (reuseCounter === void 0) {
    reuseCounter = 0;
    state.footnoteOrder.push(id2);
    counter = state.footnoteOrder.length;
  } else {
    counter = index2 + 1;
  }
  reuseCounter += 1;
  state.footnoteCounts.set(id2, reuseCounter);
  const link2 = {
    type: "element",
    tagName: "a",
    properties: {
      href: "#" + clobberPrefix + "fn-" + safeId,
      id: clobberPrefix + "fnref-" + safeId + (reuseCounter > 1 ? "-" + reuseCounter : ""),
      dataFootnoteRef: true,
      ariaDescribedBy: ["footnote-label"]
    },
    children: [{ type: "text", value: String(counter) }]
  };
  state.patch(node2, link2);
  const sup = {
    type: "element",
    tagName: "sup",
    properties: {},
    children: [link2]
  };
  state.patch(node2, sup);
  return state.applyData(node2, sup);
}
function heading(state, node2) {
  const result = {
    type: "element",
    tagName: "h" + node2.depth,
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function html(state, node2) {
  if (state.options.allowDangerousHtml) {
    const result = { type: "raw", value: node2.value };
    state.patch(node2, result);
    return state.applyData(node2, result);
  }
  return void 0;
}
function revert(state, node2) {
  const subtype = node2.referenceType;
  let suffix = "]";
  if (subtype === "collapsed") {
    suffix += "[]";
  } else if (subtype === "full") {
    suffix += "[" + (node2.label || node2.identifier) + "]";
  }
  if (node2.type === "imageReference") {
    return [{ type: "text", value: "![" + node2.alt + suffix }];
  }
  const contents = state.all(node2);
  const head = contents[0];
  if (head && head.type === "text") {
    head.value = "[" + head.value;
  } else {
    contents.unshift({ type: "text", value: "[" });
  }
  const tail = contents[contents.length - 1];
  if (tail && tail.type === "text") {
    tail.value += suffix;
  } else {
    contents.push({ type: "text", value: suffix });
  }
  return contents;
}
function imageReference(state, node2) {
  const id2 = String(node2.identifier).toUpperCase();
  const definition2 = state.definitionById.get(id2);
  if (!definition2) {
    return revert(state, node2);
  }
  const properties2 = { src: normalizeUri(definition2.url || ""), alt: node2.alt };
  if (definition2.title !== null && definition2.title !== void 0) {
    properties2.title = definition2.title;
  }
  const result = { type: "element", tagName: "img", properties: properties2, children: [] };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function image(state, node2) {
  const properties2 = { src: normalizeUri(node2.url) };
  if (node2.alt !== null && node2.alt !== void 0) {
    properties2.alt = node2.alt;
  }
  if (node2.title !== null && node2.title !== void 0) {
    properties2.title = node2.title;
  }
  const result = { type: "element", tagName: "img", properties: properties2, children: [] };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function inlineCode(state, node2) {
  const text2 = { type: "text", value: node2.value.replace(/\r?\n|\r/g, " ") };
  state.patch(node2, text2);
  const result = {
    type: "element",
    tagName: "code",
    properties: {},
    children: [text2]
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function linkReference(state, node2) {
  const id2 = String(node2.identifier).toUpperCase();
  const definition2 = state.definitionById.get(id2);
  if (!definition2) {
    return revert(state, node2);
  }
  const properties2 = { href: normalizeUri(definition2.url || "") };
  if (definition2.title !== null && definition2.title !== void 0) {
    properties2.title = definition2.title;
  }
  const result = {
    type: "element",
    tagName: "a",
    properties: properties2,
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function link(state, node2) {
  const properties2 = { href: normalizeUri(node2.url) };
  if (node2.title !== null && node2.title !== void 0) {
    properties2.title = node2.title;
  }
  const result = {
    type: "element",
    tagName: "a",
    properties: properties2,
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function listItem(state, node2, parent) {
  const results = state.all(node2);
  const loose = parent ? listLoose(parent) : listItemLoose(node2);
  const properties2 = {};
  const children = [];
  if (typeof node2.checked === "boolean") {
    const head = results[0];
    let paragraph2;
    if (head && head.type === "element" && head.tagName === "p") {
      paragraph2 = head;
    } else {
      paragraph2 = { type: "element", tagName: "p", properties: {}, children: [] };
      results.unshift(paragraph2);
    }
    if (paragraph2.children.length > 0) {
      paragraph2.children.unshift({ type: "text", value: " " });
    }
    paragraph2.children.unshift({
      type: "element",
      tagName: "input",
      properties: { type: "checkbox", checked: node2.checked, disabled: true },
      children: []
    });
    properties2.className = ["task-list-item"];
  }
  let index2 = -1;
  while (++index2 < results.length) {
    const child = results[index2];
    if (loose || index2 !== 0 || child.type !== "element" || child.tagName !== "p") {
      children.push({ type: "text", value: "\n" });
    }
    if (child.type === "element" && child.tagName === "p" && !loose) {
      children.push(...child.children);
    } else {
      children.push(child);
    }
  }
  const tail = results[results.length - 1];
  if (tail && (loose || tail.type !== "element" || tail.tagName !== "p")) {
    children.push({ type: "text", value: "\n" });
  }
  const result = { type: "element", tagName: "li", properties: properties2, children };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function listLoose(node2) {
  let loose = false;
  if (node2.type === "list") {
    loose = node2.spread || false;
    const children = node2.children;
    let index2 = -1;
    while (!loose && ++index2 < children.length) {
      loose = listItemLoose(children[index2]);
    }
  }
  return loose;
}
function listItemLoose(node2) {
  const spread2 = node2.spread;
  return spread2 === null || spread2 === void 0 ? node2.children.length > 1 : spread2;
}
function list(state, node2) {
  const properties2 = {};
  const results = state.all(node2);
  let index2 = -1;
  if (typeof node2.start === "number" && node2.start !== 1) {
    properties2.start = node2.start;
  }
  while (++index2 < results.length) {
    const child = results[index2];
    if (child.type === "element" && child.tagName === "li" && child.properties && Array.isArray(child.properties.className) && child.properties.className.includes("task-list-item")) {
      properties2.className = ["contains-task-list"];
      break;
    }
  }
  const result = {
    type: "element",
    tagName: node2.ordered ? "ol" : "ul",
    properties: properties2,
    children: state.wrap(results, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function paragraph(state, node2) {
  const result = {
    type: "element",
    tagName: "p",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function root(state, node2) {
  const result = { type: "root", children: state.wrap(state.all(node2)) };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function strong(state, node2) {
  const result = {
    type: "element",
    tagName: "strong",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function table(state, node2) {
  const rows = state.all(node2);
  const firstRow = rows.shift();
  const tableContent = [];
  if (firstRow) {
    const head = {
      type: "element",
      tagName: "thead",
      properties: {},
      children: state.wrap([firstRow], true)
    };
    state.patch(node2.children[0], head);
    tableContent.push(head);
  }
  if (rows.length > 0) {
    const body = {
      type: "element",
      tagName: "tbody",
      properties: {},
      children: state.wrap(rows, true)
    };
    const start = pointStart(node2.children[1]);
    const end = pointEnd(node2.children[node2.children.length - 1]);
    if (start && end)
      body.position = { start, end };
    tableContent.push(body);
  }
  const result = {
    type: "element",
    tagName: "table",
    properties: {},
    children: state.wrap(tableContent, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function tableRow(state, node2, parent) {
  const siblings = parent ? parent.children : void 0;
  const rowIndex = siblings ? siblings.indexOf(node2) : 1;
  const tagName = rowIndex === 0 ? "th" : "td";
  const align = parent && parent.type === "table" ? parent.align : void 0;
  const length2 = align ? align.length : node2.children.length;
  let cellIndex = -1;
  const cells = [];
  while (++cellIndex < length2) {
    const cell = node2.children[cellIndex];
    const properties2 = {};
    const alignValue = align ? align[cellIndex] : void 0;
    if (alignValue) {
      properties2.align = alignValue;
    }
    let result2 = { type: "element", tagName, properties: properties2, children: [] };
    if (cell) {
      result2.children = state.all(cell);
      state.patch(cell, result2);
      result2 = state.applyData(cell, result2);
    }
    cells.push(result2);
  }
  const result = {
    type: "element",
    tagName: "tr",
    properties: {},
    children: state.wrap(cells, true)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function tableCell(state, node2) {
  const result = {
    type: "element",
    tagName: "td",
    // Assume body cell.
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
const tab = 9;
const space = 32;
function trimLines(value2) {
  const source2 = String(value2);
  const search2 = /\r?\n|\r/g;
  let match5 = search2.exec(source2);
  let last = 0;
  const lines = [];
  while (match5) {
    lines.push(
      trimLine(source2.slice(last, match5.index), last > 0, true),
      match5[0]
    );
    last = match5.index + match5[0].length;
    match5 = search2.exec(source2);
  }
  lines.push(trimLine(source2.slice(last), last > 0, false));
  return lines.join("");
}
function trimLine(value2, start, end) {
  let startIndex = 0;
  let endIndex = value2.length;
  if (start) {
    let code2 = value2.codePointAt(startIndex);
    while (code2 === tab || code2 === space) {
      startIndex++;
      code2 = value2.codePointAt(startIndex);
    }
  }
  if (end) {
    let code2 = value2.codePointAt(endIndex - 1);
    while (code2 === tab || code2 === space) {
      endIndex--;
      code2 = value2.codePointAt(endIndex - 1);
    }
  }
  return endIndex > startIndex ? value2.slice(startIndex, endIndex) : "";
}
function text(state, node2) {
  const result = { type: "text", value: trimLines(String(node2.value)) };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function thematicBreak(state, node2) {
  const result = {
    type: "element",
    tagName: "hr",
    properties: {},
    children: []
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
const handlers = {
  blockquote,
  break: hardBreak,
  code,
  delete: strikethrough,
  emphasis,
  footnoteReference,
  heading,
  html,
  imageReference,
  image,
  inlineCode,
  linkReference,
  link,
  listItem,
  list,
  paragraph,
  // @ts-expect-error: root is different, but hard to type.
  root,
  strong,
  table,
  tableCell,
  tableRow,
  text,
  thematicBreak,
  toml: ignore,
  yaml: ignore,
  definition: ignore,
  footnoteDefinition: ignore
};
function ignore() {
  return void 0;
}
const VOID = -1;
const PRIMITIVE = 0;
const ARRAY = 1;
const OBJECT = 2;
const DATE = 3;
const REGEXP = 4;
const MAP = 5;
const SET = 6;
const ERROR = 7;
const BIGINT = 8;
const env = typeof self === "object" ? self : globalThis;
const deserializer = ($, _24) => {
  const as2 = (out, index2) => {
    $.set(index2, out);
    return out;
  };
  const unpair = (index2) => {
    if ($.has(index2))
      return $.get(index2);
    const [type4, value2] = _24[index2];
    switch (type4) {
      case PRIMITIVE:
      case VOID:
        return as2(value2, index2);
      case ARRAY: {
        const arr = as2([], index2);
        for (const index3 of value2)
          arr.push(unpair(index3));
        return arr;
      }
      case OBJECT: {
        const object4 = as2({}, index2);
        for (const [key, index3] of value2)
          object4[unpair(key)] = unpair(index3);
        return object4;
      }
      case DATE:
        return as2(new Date(value2), index2);
      case REGEXP: {
        const { source: source2, flags } = value2;
        return as2(new RegExp(source2, flags), index2);
      }
      case MAP: {
        const map2 = as2(/* @__PURE__ */ new Map(), index2);
        for (const [key, index3] of value2)
          map2.set(unpair(key), unpair(index3));
        return map2;
      }
      case SET: {
        const set2 = as2(/* @__PURE__ */ new Set(), index2);
        for (const index3 of value2)
          set2.add(unpair(index3));
        return set2;
      }
      case ERROR: {
        const { name: name2, message } = value2;
        return as2(new env[name2](message), index2);
      }
      case BIGINT:
        return as2(BigInt(value2), index2);
      case "BigInt":
        return as2(Object(BigInt(value2)), index2);
      case "ArrayBuffer":
        return as2(new Uint8Array(value2).buffer, value2);
      case "DataView": {
        const { buffer } = new Uint8Array(value2);
        return as2(new DataView(buffer), value2);
      }
    }
    return as2(new env[type4](value2), index2);
  };
  return unpair;
};
const deserialize = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
const EMPTY = "";
const { toString: toString3 } = {};
const { keys } = Object;
const typeOf = (value2) => {
  const type4 = typeof value2;
  if (type4 !== "object" || !value2)
    return [PRIMITIVE, type4];
  const asString = toString3.call(value2).slice(8, -1);
  switch (asString) {
    case "Array":
      return [ARRAY, EMPTY];
    case "Object":
      return [OBJECT, EMPTY];
    case "Date":
      return [DATE, EMPTY];
    case "RegExp":
      return [REGEXP, EMPTY];
    case "Map":
      return [MAP, EMPTY];
    case "Set":
      return [SET, EMPTY];
    case "DataView":
      return [ARRAY, asString];
  }
  if (asString.includes("Array"))
    return [ARRAY, asString];
  if (asString.includes("Error"))
    return [ERROR, asString];
  return [OBJECT, asString];
};
const shouldSkip = ([TYPE, type4]) => TYPE === PRIMITIVE && (type4 === "function" || type4 === "symbol");
const serializer = (strict, json, $, _24) => {
  const as2 = (out, value2) => {
    const index2 = _24.push(out) - 1;
    $.set(value2, index2);
    return index2;
  };
  const pair = (value2) => {
    if ($.has(value2))
      return $.get(value2);
    let [TYPE, type4] = typeOf(value2);
    switch (TYPE) {
      case PRIMITIVE: {
        let entry = value2;
        switch (type4) {
          case "bigint":
            TYPE = BIGINT;
            entry = value2.toString();
            break;
          case "function":
          case "symbol":
            if (strict)
              throw new TypeError("unable to serialize " + type4);
            entry = null;
            break;
          case "undefined":
            return as2([VOID], value2);
        }
        return as2([TYPE, entry], value2);
      }
      case ARRAY: {
        if (type4) {
          let spread2 = value2;
          if (type4 === "DataView") {
            spread2 = new Uint8Array(value2.buffer);
          } else if (type4 === "ArrayBuffer") {
            spread2 = new Uint8Array(value2);
          }
          return as2([type4, [...spread2]], value2);
        }
        const arr = [];
        const index2 = as2([TYPE, arr], value2);
        for (const entry of value2)
          arr.push(pair(entry));
        return index2;
      }
      case OBJECT: {
        if (type4) {
          switch (type4) {
            case "BigInt":
              return as2([type4, value2.toString()], value2);
            case "Boolean":
            case "Number":
            case "String":
              return as2([type4, value2.valueOf()], value2);
          }
        }
        if (json && "toJSON" in value2)
          return pair(value2.toJSON());
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const key of keys(value2)) {
          if (strict || !shouldSkip(typeOf(value2[key])))
            entries.push([pair(key), pair(value2[key])]);
        }
        return index2;
      }
      case DATE:
        return as2([TYPE, value2.toISOString()], value2);
      case REGEXP: {
        const { source: source2, flags } = value2;
        return as2([TYPE, { source: source2, flags }], value2);
      }
      case MAP: {
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const [key, entry] of value2) {
          if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
            entries.push([pair(key), pair(entry)]);
        }
        return index2;
      }
      case SET: {
        const entries = [];
        const index2 = as2([TYPE, entries], value2);
        for (const entry of value2) {
          if (strict || !shouldSkip(typeOf(entry)))
            entries.push(pair(entry));
        }
        return index2;
      }
    }
    const { message } = value2;
    return as2([TYPE, { name: type4, message }], value2);
  };
  return pair;
};
const serialize = (value2, { json, lossy } = {}) => {
  const _24 = [];
  return serializer(!(json || lossy), !!json, /* @__PURE__ */ new Map(), _24)(value2), _24;
};
const structuredClone$1 = typeof structuredClone === "function" ? (
  /* c8 ignore start */
  (any3, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any3, options)) : structuredClone(any3)
) : (any3, options) => deserialize(serialize(any3, options));
function defaultFootnoteBackContent(_24, rereferenceIndex) {
  const result = [{ type: "text", value: "↩" }];
  if (rereferenceIndex > 1) {
    result.push({
      type: "element",
      tagName: "sup",
      properties: {},
      children: [{ type: "text", value: String(rereferenceIndex) }]
    });
  }
  return result;
}
function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
  return "Back to reference " + (referenceIndex + 1) + (rereferenceIndex > 1 ? "-" + rereferenceIndex : "");
}
function footer(state) {
  const clobberPrefix = typeof state.options.clobberPrefix === "string" ? state.options.clobberPrefix : "user-content-";
  const footnoteBackContent = state.options.footnoteBackContent || defaultFootnoteBackContent;
  const footnoteBackLabel = state.options.footnoteBackLabel || defaultFootnoteBackLabel;
  const footnoteLabel = state.options.footnoteLabel || "Footnotes";
  const footnoteLabelTagName = state.options.footnoteLabelTagName || "h2";
  const footnoteLabelProperties = state.options.footnoteLabelProperties || {
    className: ["sr-only"]
  };
  const listItems = [];
  let referenceIndex = -1;
  while (++referenceIndex < state.footnoteOrder.length) {
    const definition2 = state.footnoteById.get(
      state.footnoteOrder[referenceIndex]
    );
    if (!definition2) {
      continue;
    }
    const content2 = state.all(definition2);
    const id2 = String(definition2.identifier).toUpperCase();
    const safeId = normalizeUri(id2.toLowerCase());
    let rereferenceIndex = 0;
    const backReferences = [];
    const counts = state.footnoteCounts.get(id2);
    while (counts !== void 0 && ++rereferenceIndex <= counts) {
      if (backReferences.length > 0) {
        backReferences.push({ type: "text", value: " " });
      }
      let children = typeof footnoteBackContent === "string" ? footnoteBackContent : footnoteBackContent(referenceIndex, rereferenceIndex);
      if (typeof children === "string") {
        children = { type: "text", value: children };
      }
      backReferences.push({
        type: "element",
        tagName: "a",
        properties: {
          href: "#" + clobberPrefix + "fnref-" + safeId + (rereferenceIndex > 1 ? "-" + rereferenceIndex : ""),
          dataFootnoteBackref: "",
          ariaLabel: typeof footnoteBackLabel === "string" ? footnoteBackLabel : footnoteBackLabel(referenceIndex, rereferenceIndex),
          className: ["data-footnote-backref"]
        },
        children: Array.isArray(children) ? children : [children]
      });
    }
    const tail = content2[content2.length - 1];
    if (tail && tail.type === "element" && tail.tagName === "p") {
      const tailTail = tail.children[tail.children.length - 1];
      if (tailTail && tailTail.type === "text") {
        tailTail.value += " ";
      } else {
        tail.children.push({ type: "text", value: " " });
      }
      tail.children.push(...backReferences);
    } else {
      content2.push(...backReferences);
    }
    const listItem2 = {
      type: "element",
      tagName: "li",
      properties: { id: clobberPrefix + "fn-" + safeId },
      children: state.wrap(content2, true)
    };
    state.patch(definition2, listItem2);
    listItems.push(listItem2);
  }
  if (listItems.length === 0) {
    return;
  }
  return {
    type: "element",
    tagName: "section",
    properties: { dataFootnotes: true, className: ["footnotes"] },
    children: [
      {
        type: "element",
        tagName: footnoteLabelTagName,
        properties: {
          ...structuredClone$1(footnoteLabelProperties),
          id: "footnote-label"
        },
        children: [{ type: "text", value: footnoteLabel }]
      },
      { type: "text", value: "\n" },
      {
        type: "element",
        tagName: "ol",
        properties: {},
        children: state.wrap(listItems, true)
      },
      { type: "text", value: "\n" }
    ]
  };
}
const convert = (
  // Note: overloads in JSDoc can’t yet use different `@template`s.
  /**
   * @type {(
   *   (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
   *   (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
   *   (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
   *   ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
   *   ((test?: Test) => Check)
   * )}
   */
  /**
   * @param {Test} [test]
   * @returns {Check}
   */
  function(test2) {
    if (test2 === null || test2 === void 0) {
      return ok;
    }
    if (typeof test2 === "function") {
      return castFactory(test2);
    }
    if (typeof test2 === "object") {
      return Array.isArray(test2) ? anyFactory(test2) : propsFactory(test2);
    }
    if (typeof test2 === "string") {
      return typeFactory(test2);
    }
    throw new Error("Expected function, string, or object as test");
  }
);
function anyFactory(tests) {
  const checks2 = [];
  let index2 = -1;
  while (++index2 < tests.length) {
    checks2[index2] = convert(tests[index2]);
  }
  return castFactory(any3);
  function any3(...parameters) {
    let index3 = -1;
    while (++index3 < checks2.length) {
      if (checks2[index3].apply(this, parameters))
        return true;
    }
    return false;
  }
}
function propsFactory(check) {
  const checkAsRecord = (
    /** @type {Record<string, unknown>} */
    check
  );
  return castFactory(all3);
  function all3(node2) {
    const nodeAsRecord = (
      /** @type {Record<string, unknown>} */
      /** @type {unknown} */
      node2
    );
    let key;
    for (key in check) {
      if (nodeAsRecord[key] !== checkAsRecord[key])
        return false;
    }
    return true;
  }
}
function typeFactory(check) {
  return castFactory(type4);
  function type4(node2) {
    return node2 && node2.type === check;
  }
}
function castFactory(testFunction) {
  return check;
  function check(value2, index2, parent) {
    return Boolean(
      looksLikeANode(value2) && testFunction.call(
        this,
        value2,
        typeof index2 === "number" ? index2 : void 0,
        parent || void 0
      )
    );
  }
}
function ok() {
  return true;
}
function looksLikeANode(value2) {
  return value2 !== null && typeof value2 === "object" && "type" in value2;
}
function color(d2) {
  return d2;
}
const empty = [];
const CONTINUE = true;
const EXIT = false;
const SKIP = "skip";
function visitParents(tree, test2, visitor, reverse) {
  let check;
  if (typeof test2 === "function" && typeof visitor !== "function") {
    reverse = visitor;
    visitor = test2;
  } else {
    check = test2;
  }
  const is2 = convert(check);
  const step = reverse ? -1 : 1;
  factory(tree, void 0, [])();
  function factory(node2, index2, parents) {
    const value2 = (
      /** @type {Record<string, unknown>} */
      node2 && typeof node2 === "object" ? node2 : {}
    );
    if (typeof value2.type === "string") {
      const name2 = (
        // `hast`
        typeof value2.tagName === "string" ? value2.tagName : (
          // `xast`
          typeof value2.name === "string" ? value2.name : void 0
        )
      );
      Object.defineProperty(visit2, "name", {
        value: "node (" + color(node2.type + (name2 ? "<" + name2 + ">" : "")) + ")"
      });
    }
    return visit2;
    function visit2() {
      let result = empty;
      let subresult;
      let offset2;
      let grandparents;
      if (!test2 || is2(node2, index2, parents[parents.length - 1] || void 0)) {
        result = toResult(visitor(node2, parents));
        if (result[0] === EXIT) {
          return result;
        }
      }
      if ("children" in node2 && node2.children) {
        const nodeAsParent = (
          /** @type {UnistParent} */
          node2
        );
        if (nodeAsParent.children && result[0] !== SKIP) {
          offset2 = (reverse ? nodeAsParent.children.length : -1) + step;
          grandparents = parents.concat(nodeAsParent);
          while (offset2 > -1 && offset2 < nodeAsParent.children.length) {
            const child = nodeAsParent.children[offset2];
            subresult = factory(child, offset2, grandparents)();
            if (subresult[0] === EXIT) {
              return subresult;
            }
            offset2 = typeof subresult[1] === "number" ? subresult[1] : offset2 + step;
          }
        }
      }
      return result;
    }
  }
}
function toResult(value2) {
  if (Array.isArray(value2)) {
    return value2;
  }
  if (typeof value2 === "number") {
    return [CONTINUE, value2];
  }
  return value2 === null || value2 === void 0 ? empty : [value2];
}
function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
  let reverse;
  let test2;
  let visitor;
  if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
    test2 = void 0;
    visitor = testOrVisitor;
    reverse = visitorOrReverse;
  } else {
    test2 = testOrVisitor;
    visitor = visitorOrReverse;
    reverse = maybeReverse;
  }
  visitParents(tree, test2, overload, reverse);
  function overload(node2, parents) {
    const parent = parents[parents.length - 1];
    const index2 = parent ? parent.children.indexOf(node2) : void 0;
    return visitor(node2, index2, parent);
  }
}
const own$1 = {}.hasOwnProperty;
const emptyOptions = {};
function createState(tree, options) {
  const settings = options || emptyOptions;
  const definitionById = /* @__PURE__ */ new Map();
  const footnoteById = /* @__PURE__ */ new Map();
  const footnoteCounts = /* @__PURE__ */ new Map();
  const handlers$1 = { ...handlers, ...settings.handlers };
  const state = {
    all: all3,
    applyData,
    definitionById,
    footnoteById,
    footnoteCounts,
    footnoteOrder: [],
    handlers: handlers$1,
    one: one2,
    options: settings,
    patch,
    wrap: wrap$1
  };
  visit(tree, function(node2) {
    if (node2.type === "definition" || node2.type === "footnoteDefinition") {
      const map2 = node2.type === "definition" ? definitionById : footnoteById;
      const id2 = String(node2.identifier).toUpperCase();
      if (!map2.has(id2)) {
        map2.set(id2, node2);
      }
    }
  });
  return state;
  function one2(node2, parent) {
    const type4 = node2.type;
    const handle2 = state.handlers[type4];
    if (own$1.call(state.handlers, type4) && handle2) {
      return handle2(state, node2, parent);
    }
    if (state.options.passThrough && state.options.passThrough.includes(type4)) {
      if ("children" in node2) {
        const { children, ...shallow } = node2;
        const result = structuredClone$1(shallow);
        result.children = state.all(node2);
        return result;
      }
      return structuredClone$1(node2);
    }
    const unknown = state.options.unknownHandler || defaultUnknownHandler;
    return unknown(state, node2, parent);
  }
  function all3(parent) {
    const values = [];
    if ("children" in parent) {
      const nodes = parent.children;
      let index2 = -1;
      while (++index2 < nodes.length) {
        const result = state.one(nodes[index2], parent);
        if (result) {
          if (index2 && nodes[index2 - 1].type === "break") {
            if (!Array.isArray(result) && result.type === "text") {
              result.value = trimMarkdownSpaceStart(result.value);
            }
            if (!Array.isArray(result) && result.type === "element") {
              const head = result.children[0];
              if (head && head.type === "text") {
                head.value = trimMarkdownSpaceStart(head.value);
              }
            }
          }
          if (Array.isArray(result)) {
            values.push(...result);
          } else {
            values.push(result);
          }
        }
      }
    }
    return values;
  }
}
function patch(from2, to2) {
  if (from2.position)
    to2.position = position$1(from2);
}
function applyData(from2, to2) {
  let result = to2;
  if (from2 && from2.data) {
    const hName = from2.data.hName;
    const hChildren = from2.data.hChildren;
    const hProperties = from2.data.hProperties;
    if (typeof hName === "string") {
      if (result.type === "element") {
        result.tagName = hName;
      } else {
        const children = "children" in result ? result.children : [result];
        result = { type: "element", tagName: hName, properties: {}, children };
      }
    }
    if (result.type === "element" && hProperties) {
      Object.assign(result.properties, structuredClone$1(hProperties));
    }
    if ("children" in result && result.children && hChildren !== null && hChildren !== void 0) {
      result.children = hChildren;
    }
  }
  return result;
}
function defaultUnknownHandler(state, node2) {
  const data = node2.data || {};
  const result = "value" in node2 && !(own$1.call(data, "hProperties") || own$1.call(data, "hChildren")) ? { type: "text", value: node2.value } : {
    type: "element",
    tagName: "div",
    properties: {},
    children: state.all(node2)
  };
  state.patch(node2, result);
  return state.applyData(node2, result);
}
function wrap$1(nodes, loose) {
  const result = [];
  let index2 = -1;
  if (loose) {
    result.push({ type: "text", value: "\n" });
  }
  while (++index2 < nodes.length) {
    if (index2)
      result.push({ type: "text", value: "\n" });
    result.push(nodes[index2]);
  }
  if (loose && nodes.length > 0) {
    result.push({ type: "text", value: "\n" });
  }
  return result;
}
function trimMarkdownSpaceStart(value2) {
  let index2 = 0;
  let code2 = value2.charCodeAt(index2);
  while (code2 === 9 || code2 === 32) {
    index2++;
    code2 = value2.charCodeAt(index2);
  }
  return value2.slice(index2);
}
function toHast(tree, options) {
  const state = createState(tree, options);
  const node2 = state.one(tree, void 0);
  const foot = footer(state);
  const result = Array.isArray(node2) ? { type: "root", children: node2 } : node2 || { type: "root", children: [] };
  if (foot) {
    result.children.push({ type: "text", value: "\n" }, foot);
  }
  return result;
}
function remarkRehype(destination, options) {
  if (destination && "run" in destination) {
    return async function(tree, file) {
      const hastTree = (
        /** @type {HastRoot} */
        toHast(tree, { file, ...options })
      );
      await destination.run(hastTree, file);
    };
  }
  return function(tree, file) {
    return (
      /** @type {HastRoot} */
      toHast(tree, { file, ...destination || options })
    );
  };
}
function bail(error2) {
  if (error2) {
    throw error2;
  }
}
var hasOwn = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var defineProperty = Object.defineProperty;
var gOPD = Object.getOwnPropertyDescriptor;
var isArray = function isArray2(arr) {
  if (typeof Array.isArray === "function") {
    return Array.isArray(arr);
  }
  return toStr.call(arr) === "[object Array]";
};
var isPlainObject$1 = function isPlainObject(obj) {
  if (!obj || toStr.call(obj) !== "[object Object]") {
    return false;
  }
  var hasOwnConstructor = hasOwn.call(obj, "constructor");
  var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, "isPrototypeOf");
  if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
    return false;
  }
  var key;
  for (key in obj) {
  }
  return typeof key === "undefined" || hasOwn.call(obj, key);
};
var setProperty = function setProperty2(target, options) {
  if (defineProperty && options.name === "__proto__") {
    defineProperty(target, options.name, {
      enumerable: true,
      configurable: true,
      value: options.newValue,
      writable: true
    });
  } else {
    target[options.name] = options.newValue;
  }
};
var getProperty = function getProperty2(obj, name2) {
  if (name2 === "__proto__") {
    if (!hasOwn.call(obj, name2)) {
      return void 0;
    } else if (gOPD) {
      return gOPD(obj, name2).value;
    }
  }
  return obj[name2];
};
var extend2 = function extend3() {
  var options, name2, src, copy2, copyIsArray, clone3;
  var target = arguments[0];
  var i2 = 1;
  var length2 = arguments.length;
  var deep = false;
  if (typeof target === "boolean") {
    deep = target;
    target = arguments[1] || {};
    i2 = 2;
  }
  if (target == null || typeof target !== "object" && typeof target !== "function") {
    target = {};
  }
  for (; i2 < length2; ++i2) {
    options = arguments[i2];
    if (options != null) {
      for (name2 in options) {
        src = getProperty(target, name2);
        copy2 = getProperty(options, name2);
        if (target !== copy2) {
          if (deep && copy2 && (isPlainObject$1(copy2) || (copyIsArray = isArray(copy2)))) {
            if (copyIsArray) {
              copyIsArray = false;
              clone3 = src && isArray(src) ? src : [];
            } else {
              clone3 = src && isPlainObject$1(src) ? src : {};
            }
            setProperty(target, { name: name2, newValue: extend3(deep, clone3, copy2) });
          } else if (typeof copy2 !== "undefined") {
            setProperty(target, { name: name2, newValue: copy2 });
          }
        }
      }
    }
  }
  return target;
};
const extend$1 = /* @__PURE__ */ getDefaultExportFromCjs(extend2);
function isPlainObject2(value2) {
  if (typeof value2 !== "object" || value2 === null) {
    return false;
  }
  const prototype2 = Object.getPrototypeOf(value2);
  return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in value2) && !(Symbol.iterator in value2);
}
function trough() {
  const fns = [];
  const pipeline = { run, use };
  return pipeline;
  function run(...values) {
    let middlewareIndex = -1;
    const callback2 = values.pop();
    if (typeof callback2 !== "function") {
      throw new TypeError("Expected function as last argument, not " + callback2);
    }
    next2(null, ...values);
    function next2(error2, ...output2) {
      const fn = fns[++middlewareIndex];
      let index2 = -1;
      if (error2) {
        callback2(error2);
        return;
      }
      while (++index2 < values.length) {
        if (output2[index2] === null || output2[index2] === void 0) {
          output2[index2] = values[index2];
        }
      }
      values = output2;
      if (fn) {
        wrap(fn, next2)(...output2);
      } else {
        callback2(null, ...output2);
      }
    }
  }
  function use(middelware) {
    if (typeof middelware !== "function") {
      throw new TypeError(
        "Expected `middelware` to be a function, not " + middelware
      );
    }
    fns.push(middelware);
    return pipeline;
  }
}
function wrap(middleware, callback2) {
  let called;
  return wrapped;
  function wrapped(...parameters) {
    const fnExpectsCallback = middleware.length > parameters.length;
    let result;
    if (fnExpectsCallback) {
      parameters.push(done);
    }
    try {
      result = middleware.apply(this, parameters);
    } catch (error2) {
      const exception = (
        /** @type {Error} */
        error2
      );
      if (fnExpectsCallback && called) {
        throw exception;
      }
      return done(exception);
    }
    if (!fnExpectsCallback) {
      if (result && result.then && typeof result.then === "function") {
        result.then(then, done);
      } else if (result instanceof Error) {
        done(result);
      } else {
        then(result);
      }
    }
  }
  function done(error2, ...output2) {
    if (!called) {
      called = true;
      callback2(error2, ...output2);
    }
  }
  function then(value2) {
    done(null, value2);
  }
}
const minpath = { basename, dirname, extname, join, sep: "/" };
function basename(path, extname2) {
  if (extname2 !== void 0 && typeof extname2 !== "string") {
    throw new TypeError('"ext" argument must be a string');
  }
  assertPath$1(path);
  let start = 0;
  let end = -1;
  let index2 = path.length;
  let seenNonSlash;
  if (extname2 === void 0 || extname2.length === 0 || extname2.length > path.length) {
    while (index2--) {
      if (path.codePointAt(index2) === 47) {
        if (seenNonSlash) {
          start = index2 + 1;
          break;
        }
      } else if (end < 0) {
        seenNonSlash = true;
        end = index2 + 1;
      }
    }
    return end < 0 ? "" : path.slice(start, end);
  }
  if (extname2 === path) {
    return "";
  }
  let firstNonSlashEnd = -1;
  let extnameIndex = extname2.length - 1;
  while (index2--) {
    if (path.codePointAt(index2) === 47) {
      if (seenNonSlash) {
        start = index2 + 1;
        break;
      }
    } else {
      if (firstNonSlashEnd < 0) {
        seenNonSlash = true;
        firstNonSlashEnd = index2 + 1;
      }
      if (extnameIndex > -1) {
        if (path.codePointAt(index2) === extname2.codePointAt(extnameIndex--)) {
          if (extnameIndex < 0) {
            end = index2;
          }
        } else {
          extnameIndex = -1;
          end = firstNonSlashEnd;
        }
      }
    }
  }
  if (start === end) {
    end = firstNonSlashEnd;
  } else if (end < 0) {
    end = path.length;
  }
  return path.slice(start, end);
}
function dirname(path) {
  assertPath$1(path);
  if (path.length === 0) {
    return ".";
  }
  let end = -1;
  let index2 = path.length;
  let unmatchedSlash;
  while (--index2) {
    if (path.codePointAt(index2) === 47) {
      if (unmatchedSlash) {
        end = index2;
        break;
      }
    } else if (!unmatchedSlash) {
      unmatchedSlash = true;
    }
  }
  return end < 0 ? path.codePointAt(0) === 47 ? "/" : "." : end === 1 && path.codePointAt(0) === 47 ? "//" : path.slice(0, end);
}
function extname(path) {
  assertPath$1(path);
  let index2 = path.length;
  let end = -1;
  let startPart = 0;
  let startDot = -1;
  let preDotState = 0;
  let unmatchedSlash;
  while (index2--) {
    const code2 = path.codePointAt(index2);
    if (code2 === 47) {
      if (unmatchedSlash) {
        startPart = index2 + 1;
        break;
      }
      continue;
    }
    if (end < 0) {
      unmatchedSlash = true;
      end = index2 + 1;
    }
    if (code2 === 46) {
      if (startDot < 0) {
        startDot = index2;
      } else if (preDotState !== 1) {
        preDotState = 1;
      }
    } else if (startDot > -1) {
      preDotState = -1;
    }
  }
  if (startDot < 0 || end < 0 || // We saw a non-dot character immediately before the dot.
  preDotState === 0 || // The (right-most) trimmed path component is exactly `..`.
  preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
    return "";
  }
  return path.slice(startDot, end);
}
function join(...segments) {
  let index2 = -1;
  let joined;
  while (++index2 < segments.length) {
    assertPath$1(segments[index2]);
    if (segments[index2]) {
      joined = joined === void 0 ? segments[index2] : joined + "/" + segments[index2];
    }
  }
  return joined === void 0 ? "." : normalize(joined);
}
function normalize(path) {
  assertPath$1(path);
  const absolute2 = path.codePointAt(0) === 47;
  let value2 = normalizeString(path, !absolute2);
  if (value2.length === 0 && !absolute2) {
    value2 = ".";
  }
  if (value2.length > 0 && path.codePointAt(path.length - 1) === 47) {
    value2 += "/";
  }
  return absolute2 ? "/" + value2 : value2;
}
function normalizeString(path, allowAboveRoot) {
  let result = "";
  let lastSegmentLength = 0;
  let lastSlash = -1;
  let dots = 0;
  let index2 = -1;
  let code2;
  let lastSlashIndex;
  while (++index2 <= path.length) {
    if (index2 < path.length) {
      code2 = path.codePointAt(index2);
    } else if (code2 === 47) {
      break;
    } else {
      code2 = 47;
    }
    if (code2 === 47) {
      if (lastSlash === index2 - 1 || dots === 1)
        ;
      else if (lastSlash !== index2 - 1 && dots === 2) {
        if (result.length < 2 || lastSegmentLength !== 2 || result.codePointAt(result.length - 1) !== 46 || result.codePointAt(result.length - 2) !== 46) {
          if (result.length > 2) {
            lastSlashIndex = result.lastIndexOf("/");
            if (lastSlashIndex !== result.length - 1) {
              if (lastSlashIndex < 0) {
                result = "";
                lastSegmentLength = 0;
              } else {
                result = result.slice(0, lastSlashIndex);
                lastSegmentLength = result.length - 1 - result.lastIndexOf("/");
              }
              lastSlash = index2;
              dots = 0;
              continue;
            }
          } else if (result.length > 0) {
            result = "";
            lastSegmentLength = 0;
            lastSlash = index2;
            dots = 0;
            continue;
          }
        }
        if (allowAboveRoot) {
          result = result.length > 0 ? result + "/.." : "..";
          lastSegmentLength = 2;
        }
      } else {
        if (result.length > 0) {
          result += "/" + path.slice(lastSlash + 1, index2);
        } else {
          result = path.slice(lastSlash + 1, index2);
        }
        lastSegmentLength = index2 - lastSlash - 1;
      }
      lastSlash = index2;
      dots = 0;
    } else if (code2 === 46 && dots > -1) {
      dots++;
    } else {
      dots = -1;
    }
  }
  return result;
}
function assertPath$1(path) {
  if (typeof path !== "string") {
    throw new TypeError(
      "Path must be a string. Received " + JSON.stringify(path)
    );
  }
}
const minproc = { cwd };
function cwd() {
  return "/";
}
function isUrl(fileUrlOrPath) {
  return Boolean(
    fileUrlOrPath !== null && typeof fileUrlOrPath === "object" && "href" in fileUrlOrPath && fileUrlOrPath.href && "protocol" in fileUrlOrPath && fileUrlOrPath.protocol && // @ts-expect-error: indexing is fine.
    fileUrlOrPath.auth === void 0
  );
}
function urlToPath(path) {
  if (typeof path === "string") {
    path = new URL(path);
  } else if (!isUrl(path)) {
    const error2 = new TypeError(
      'The "path" argument must be of type string or an instance of URL. Received `' + path + "`"
    );
    error2.code = "ERR_INVALID_ARG_TYPE";
    throw error2;
  }
  if (path.protocol !== "file:") {
    const error2 = new TypeError("The URL must be of scheme file");
    error2.code = "ERR_INVALID_URL_SCHEME";
    throw error2;
  }
  return getPathFromURLPosix(path);
}
function getPathFromURLPosix(url2) {
  if (url2.hostname !== "") {
    const error2 = new TypeError(
      'File URL host must be "localhost" or empty on darwin'
    );
    error2.code = "ERR_INVALID_FILE_URL_HOST";
    throw error2;
  }
  const pathname = url2.pathname;
  let index2 = -1;
  while (++index2 < pathname.length) {
    if (pathname.codePointAt(index2) === 37 && pathname.codePointAt(index2 + 1) === 50) {
      const third = pathname.codePointAt(index2 + 2);
      if (third === 70 || third === 102) {
        const error2 = new TypeError(
          "File URL path must not include encoded / characters"
        );
        error2.code = "ERR_INVALID_FILE_URL_PATH";
        throw error2;
      }
    }
  }
  return decodeURIComponent(pathname);
}
const order = (
  /** @type {const} */
  [
    "history",
    "path",
    "basename",
    "stem",
    "extname",
    "dirname"
  ]
);
class VFile {
  /**
   * Create a new virtual file.
   *
   * `options` is treated as:
   *
   * *   `string` or `Uint8Array` — `{value: options}`
   * *   `URL` — `{path: options}`
   * *   `VFile` — shallow copies its data over to the new file
   * *   `object` — all fields are shallow copied over to the new file
   *
   * Path related fields are set in the following order (least specific to
   * most specific): `history`, `path`, `basename`, `stem`, `extname`,
   * `dirname`.
   *
   * You cannot set `dirname` or `extname` without setting either `history`,
   * `path`, `basename`, or `stem` too.
   *
   * @param {Compatible | null | undefined} [value]
   *   File value.
   * @returns
   *   New instance.
   */
  constructor(value2) {
    let options;
    if (!value2) {
      options = {};
    } else if (isUrl(value2)) {
      options = { path: value2 };
    } else if (typeof value2 === "string" || isUint8Array$1(value2)) {
      options = { value: value2 };
    } else {
      options = value2;
    }
    this.cwd = "cwd" in options ? "" : minproc.cwd();
    this.data = {};
    this.history = [];
    this.messages = [];
    this.value;
    this.map;
    this.result;
    this.stored;
    let index2 = -1;
    while (++index2 < order.length) {
      const field2 = order[index2];
      if (field2 in options && options[field2] !== void 0 && options[field2] !== null) {
        this[field2] = field2 === "history" ? [...options[field2]] : options[field2];
      }
    }
    let field;
    for (field in options) {
      if (!order.includes(field)) {
        this[field] = options[field];
      }
    }
  }
  /**
   * Get the basename (including extname) (example: `'index.min.js'`).
   *
   * @returns {string | undefined}
   *   Basename.
   */
  get basename() {
    return typeof this.path === "string" ? minpath.basename(this.path) : void 0;
  }
  /**
   * Set basename (including extname) (`'index.min.js'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be nullified (use `file.path = file.dirname` instead).
   *
   * @param {string} basename
   *   Basename.
   * @returns {undefined}
   *   Nothing.
   */
  set basename(basename2) {
    assertNonEmpty(basename2, "basename");
    assertPart(basename2, "basename");
    this.path = minpath.join(this.dirname || "", basename2);
  }
  /**
   * Get the parent path (example: `'~'`).
   *
   * @returns {string | undefined}
   *   Dirname.
   */
  get dirname() {
    return typeof this.path === "string" ? minpath.dirname(this.path) : void 0;
  }
  /**
   * Set the parent path (example: `'~'`).
   *
   * Cannot be set if there’s no `path` yet.
   *
   * @param {string | undefined} dirname
   *   Dirname.
   * @returns {undefined}
   *   Nothing.
   */
  set dirname(dirname2) {
    assertPath(this.basename, "dirname");
    this.path = minpath.join(dirname2 || "", this.basename);
  }
  /**
   * Get the extname (including dot) (example: `'.js'`).
   *
   * @returns {string | undefined}
   *   Extname.
   */
  get extname() {
    return typeof this.path === "string" ? minpath.extname(this.path) : void 0;
  }
  /**
   * Set the extname (including dot) (example: `'.js'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be set if there’s no `path` yet.
   *
   * @param {string | undefined} extname
   *   Extname.
   * @returns {undefined}
   *   Nothing.
   */
  set extname(extname2) {
    assertPart(extname2, "extname");
    assertPath(this.dirname, "extname");
    if (extname2) {
      if (extname2.codePointAt(0) !== 46) {
        throw new Error("`extname` must start with `.`");
      }
      if (extname2.includes(".", 1)) {
        throw new Error("`extname` cannot contain multiple dots");
      }
    }
    this.path = minpath.join(this.dirname, this.stem + (extname2 || ""));
  }
  /**
   * Get the full path (example: `'~/index.min.js'`).
   *
   * @returns {string}
   *   Path.
   */
  get path() {
    return this.history[this.history.length - 1];
  }
  /**
   * Set the full path (example: `'~/index.min.js'`).
   *
   * Cannot be nullified.
   * You can set a file URL (a `URL` object with a `file:` protocol) which will
   * be turned into a path with `url.fileURLToPath`.
   *
   * @param {URL | string} path
   *   Path.
   * @returns {undefined}
   *   Nothing.
   */
  set path(path) {
    if (isUrl(path)) {
      path = urlToPath(path);
    }
    assertNonEmpty(path, "path");
    if (this.path !== path) {
      this.history.push(path);
    }
  }
  /**
   * Get the stem (basename w/o extname) (example: `'index.min'`).
   *
   * @returns {string | undefined}
   *   Stem.
   */
  get stem() {
    return typeof this.path === "string" ? minpath.basename(this.path, this.extname) : void 0;
  }
  /**
   * Set the stem (basename w/o extname) (example: `'index.min'`).
   *
   * Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
   * on windows).
   * Cannot be nullified (use `file.path = file.dirname` instead).
   *
   * @param {string} stem
   *   Stem.
   * @returns {undefined}
   *   Nothing.
   */
  set stem(stem) {
    assertNonEmpty(stem, "stem");
    assertPart(stem, "stem");
    this.path = minpath.join(this.dirname || "", stem + (this.extname || ""));
  }
  // Normal prototypal methods.
  /**
   * Create a fatal message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `true` (error; file not usable)
   * and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {never}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {never}
   *   Never.
   * @throws {VFileMessage}
   *   Message.
   */
  fail(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin2);
    message.fatal = true;
    throw message;
  }
  /**
   * Create an info message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `undefined` (info; change
   * likely not needed) and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {VFileMessage}
   *   Message.
   */
  info(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = this.message(causeOrReason, optionsOrParentOrPlace, origin2);
    message.fatal = void 0;
    return message;
  }
  /**
   * Create a message for `reason` associated with the file.
   *
   * The `fatal` field of the message is set to `false` (warning; change may be
   * needed) and the `file` field is set to the current file path.
   * The message is added to the `messages` field on `file`.
   *
   * > 🪦 **Note**: also has obsolete signatures.
   *
   * @overload
   * @param {string} reason
   * @param {MessageOptions | null | undefined} [options]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {string} reason
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Node | NodeLike | null | undefined} parent
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {Point | Position | null | undefined} place
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @overload
   * @param {Error | VFileMessage} cause
   * @param {string | null | undefined} [origin]
   * @returns {VFileMessage}
   *
   * @param {Error | VFileMessage | string} causeOrReason
   *   Reason for message, should use markdown.
   * @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
   *   Configuration (optional).
   * @param {string | null | undefined} [origin]
   *   Place in code where the message originates (example:
   *   `'my-package:my-rule'` or `'my-rule'`).
   * @returns {VFileMessage}
   *   Message.
   */
  message(causeOrReason, optionsOrParentOrPlace, origin2) {
    const message = new VFileMessage(
      // @ts-expect-error: the overloads are fine.
      causeOrReason,
      optionsOrParentOrPlace,
      origin2
    );
    if (this.path) {
      message.name = this.path + ":" + message.name;
      message.file = this.path;
    }
    message.fatal = false;
    this.messages.push(message);
    return message;
  }
  /**
   * Serialize the file.
   *
   * > **Note**: which encodings are supported depends on the engine.
   * > For info on Node.js, see:
   * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
   *
   * @param {string | null | undefined} [encoding='utf8']
   *   Character encoding to understand `value` as when it’s a `Uint8Array`
   *   (default: `'utf-8'`).
   * @returns {string}
   *   Serialized file.
   */
  toString(encoding) {
    if (this.value === void 0) {
      return "";
    }
    if (typeof this.value === "string") {
      return this.value;
    }
    const decoder = new TextDecoder(encoding || void 0);
    return decoder.decode(this.value);
  }
}
function assertPart(part, name2) {
  if (part && part.includes(minpath.sep)) {
    throw new Error(
      "`" + name2 + "` cannot be a path: did not expect `" + minpath.sep + "`"
    );
  }
}
function assertNonEmpty(part, name2) {
  if (!part) {
    throw new Error("`" + name2 + "` cannot be empty");
  }
}
function assertPath(path, name2) {
  if (!path) {
    throw new Error("Setting `" + name2 + "` requires `path` to be set too");
  }
}
function isUint8Array$1(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "byteLength" in value2 && "byteOffset" in value2
  );
}
const CallableInstance = (
  /**
   * @type {new <Parameters extends Array<unknown>, Result>(property: string | symbol) => (...parameters: Parameters) => Result}
   */
  /** @type {unknown} */
  /**
   * @this {Function}
   * @param {string | symbol} property
   * @returns {(...parameters: Array<unknown>) => unknown}
   */
  function(property2) {
    const self2 = this;
    const constr = self2.constructor;
    const proto2 = (
      /** @type {Record<string | symbol, Function>} */
      // Prototypes do exist.
      // type-coverage:ignore-next-line
      constr.prototype
    );
    const value2 = proto2[property2];
    const apply2 = function() {
      return value2.apply(apply2, arguments);
    };
    Object.setPrototypeOf(apply2, proto2);
    return apply2;
  }
);
const own = {}.hasOwnProperty;
class Processor extends CallableInstance {
  /**
   * Create a processor.
   */
  constructor() {
    super("copy");
    this.Compiler = void 0;
    this.Parser = void 0;
    this.attachers = [];
    this.compiler = void 0;
    this.freezeIndex = -1;
    this.frozen = void 0;
    this.namespace = {};
    this.parser = void 0;
    this.transformers = trough();
  }
  /**
   * Copy a processor.
   *
   * @deprecated
   *   This is a private internal method and should not be used.
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   New *unfrozen* processor ({@linkcode Processor}) that is
   *   configured to work the same as its ancestor.
   *   When the descendant processor is configured in the future it does not
   *   affect the ancestral processor.
   */
  copy() {
    const destination = (
      /** @type {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>} */
      new Processor()
    );
    let index2 = -1;
    while (++index2 < this.attachers.length) {
      const attacher = this.attachers[index2];
      destination.use(...attacher);
    }
    destination.data(extend$1(true, {}, this.namespace));
    return destination;
  }
  /**
   * Configure the processor with info available to all plugins.
   * Information is stored in an object.
   *
   * Typically, options can be given to a specific plugin, but sometimes it
   * makes sense to have information shared with several plugins.
   * For example, a list of HTML elements that are self-closing, which is
   * needed during all phases.
   *
   * > **Note**: setting information cannot occur on *frozen* processors.
   * > Call the processor first to create a new unfrozen processor.
   *
   * > **Note**: to register custom data in TypeScript, augment the
   * > {@linkcode Data} interface.
   *
   * @example
   *   This example show how to get and set info:
   *
   *   ```js
   *   import {unified} from 'unified'
   *
   *   const processor = unified().data('alpha', 'bravo')
   *
   *   processor.data('alpha') // => 'bravo'
   *
   *   processor.data() // => {alpha: 'bravo'}
   *
   *   processor.data({charlie: 'delta'})
   *
   *   processor.data() // => {charlie: 'delta'}
   *   ```
   *
   * @template {keyof Data} Key
   *
   * @overload
   * @returns {Data}
   *
   * @overload
   * @param {Data} dataset
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {Key} key
   * @returns {Data[Key]}
   *
   * @overload
   * @param {Key} key
   * @param {Data[Key]} value
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @param {Data | Key} [key]
   *   Key to get or set, or entire dataset to set, or nothing to get the
   *   entire dataset (optional).
   * @param {Data[Key]} [value]
   *   Value to set (optional).
   * @returns {unknown}
   *   The current processor when setting, the value at `key` when getting, or
   *   the entire dataset when getting without key.
   */
  data(key, value2) {
    if (typeof key === "string") {
      if (arguments.length === 2) {
        assertUnfrozen("data", this.frozen);
        this.namespace[key] = value2;
        return this;
      }
      return own.call(this.namespace, key) && this.namespace[key] || void 0;
    }
    if (key) {
      assertUnfrozen("data", this.frozen);
      this.namespace = key;
      return this;
    }
    return this.namespace;
  }
  /**
   * Freeze a processor.
   *
   * Frozen processors are meant to be extended and not to be configured
   * directly.
   *
   * When a processor is frozen it cannot be unfrozen.
   * New processors working the same way can be created by calling the
   * processor.
   *
   * It’s possible to freeze processors explicitly by calling `.freeze()`.
   * Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
   * `.stringify()`, `.process()`, or `.processSync()` are called.
   *
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   The current processor.
   */
  freeze() {
    if (this.frozen) {
      return this;
    }
    const self2 = (
      /** @type {Processor} */
      /** @type {unknown} */
      this
    );
    while (++this.freezeIndex < this.attachers.length) {
      const [attacher, ...options] = this.attachers[this.freezeIndex];
      if (options[0] === false) {
        continue;
      }
      if (options[0] === true) {
        options[0] = void 0;
      }
      const transformer = attacher.call(self2, ...options);
      if (typeof transformer === "function") {
        this.transformers.use(transformer);
      }
    }
    this.frozen = true;
    this.freezeIndex = Number.POSITIVE_INFINITY;
    return this;
  }
  /**
   * Parse text to a syntax tree.
   *
   * > **Note**: `parse` freezes the processor if not already *frozen*.
   *
   * > **Note**: `parse` performs the parse phase, not the run phase or other
   * > phases.
   *
   * @param {Compatible | undefined} [file]
   *   file to parse (optional); typically `string` or `VFile`; any value
   *   accepted as `x` in `new VFile(x)`.
   * @returns {ParseTree extends undefined ? Node : ParseTree}
   *   Syntax tree representing `file`.
   */
  parse(file) {
    this.freeze();
    const realFile = vfile(file);
    const parser = this.parser || this.Parser;
    assertParser("parse", parser);
    return parser(String(realFile), realFile);
  }
  /**
   * Process the given file as configured on the processor.
   *
   * > **Note**: `process` freezes the processor if not already *frozen*.
   *
   * > **Note**: `process` performs the parse, run, and stringify phases.
   *
   * @overload
   * @param {Compatible | undefined} file
   * @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
   * @returns {undefined}
   *
   * @overload
   * @param {Compatible | undefined} [file]
   * @returns {Promise<VFileWithOutput<CompileResult>>}
   *
   * @param {Compatible | undefined} [file]
   *   File (optional); typically `string` or `VFile`]; any value accepted as
   *   `x` in `new VFile(x)`.
   * @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
   *   Callback (optional).
   * @returns {Promise<VFile> | undefined}
   *   Nothing if `done` is given.
   *   Otherwise a promise, rejected with a fatal error or resolved with the
   *   processed file.
   *
   *   The parsed, transformed, and compiled value is available at
   *   `file.value` (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most
   *   > compilers return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  process(file, done) {
    const self2 = this;
    this.freeze();
    assertParser("process", this.parser || this.Parser);
    assertCompiler("process", this.compiler || this.Compiler);
    return done ? executor(void 0, done) : new Promise(executor);
    function executor(resolve2, reject) {
      const realFile = vfile(file);
      const parseTree = (
        /** @type {HeadTree extends undefined ? Node : HeadTree} */
        /** @type {unknown} */
        self2.parse(realFile)
      );
      self2.run(parseTree, realFile, function(error2, tree, file2) {
        if (error2 || !tree || !file2) {
          return realDone(error2);
        }
        const compileTree = (
          /** @type {CompileTree extends undefined ? Node : CompileTree} */
          /** @type {unknown} */
          tree
        );
        const compileResult = self2.stringify(compileTree, file2);
        if (looksLikeAValue(compileResult)) {
          file2.value = compileResult;
        } else {
          file2.result = compileResult;
        }
        realDone(
          error2,
          /** @type {VFileWithOutput<CompileResult>} */
          file2
        );
      });
      function realDone(error2, file2) {
        if (error2 || !file2) {
          reject(error2);
        } else if (resolve2) {
          resolve2(file2);
        } else {
          done(void 0, file2);
        }
      }
    }
  }
  /**
   * Process the given file as configured on the processor.
   *
   * An error is thrown if asynchronous transforms are configured.
   *
   * > **Note**: `processSync` freezes the processor if not already *frozen*.
   *
   * > **Note**: `processSync` performs the parse, run, and stringify phases.
   *
   * @param {Compatible | undefined} [file]
   *   File (optional); typically `string` or `VFile`; any value accepted as
   *   `x` in `new VFile(x)`.
   * @returns {VFileWithOutput<CompileResult>}
   *   The processed file.
   *
   *   The parsed, transformed, and compiled value is available at
   *   `file.value` (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most
   *   > compilers return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  processSync(file) {
    let complete = false;
    let result;
    this.freeze();
    assertParser("processSync", this.parser || this.Parser);
    assertCompiler("processSync", this.compiler || this.Compiler);
    this.process(file, realDone);
    assertDone("processSync", "process", complete);
    return result;
    function realDone(error2, file2) {
      complete = true;
      bail(error2);
      result = file2;
    }
  }
  /**
   * Run *transformers* on a syntax tree.
   *
   * > **Note**: `run` freezes the processor if not already *frozen*.
   *
   * > **Note**: `run` performs the run phase, not other phases.
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
   * @returns {undefined}
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {Compatible | undefined} file
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
   * @returns {undefined}
   *
   * @overload
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   * @param {Compatible | undefined} [file]
   * @returns {Promise<TailTree extends undefined ? Node : TailTree>}
   *
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   *   Tree to transform and inspect.
   * @param {(
   *   RunCallback<TailTree extends undefined ? Node : TailTree> |
   *   Compatible
   * )} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
   *   Callback (optional).
   * @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
   *   Nothing if `done` is given.
   *   Otherwise, a promise rejected with a fatal error or resolved with the
   *   transformed tree.
   */
  run(tree, file, done) {
    assertNode(tree);
    this.freeze();
    const transformers = this.transformers;
    if (!done && typeof file === "function") {
      done = file;
      file = void 0;
    }
    return done ? executor(void 0, done) : new Promise(executor);
    function executor(resolve2, reject) {
      const realFile = vfile(file);
      transformers.run(tree, realFile, realDone);
      function realDone(error2, outputTree, file2) {
        const resultingTree = (
          /** @type {TailTree extends undefined ? Node : TailTree} */
          outputTree || tree
        );
        if (error2) {
          reject(error2);
        } else if (resolve2) {
          resolve2(resultingTree);
        } else {
          done(void 0, resultingTree, file2);
        }
      }
    }
  }
  /**
   * Run *transformers* on a syntax tree.
   *
   * An error is thrown if asynchronous transforms are configured.
   *
   * > **Note**: `runSync` freezes the processor if not already *frozen*.
   *
   * > **Note**: `runSync` performs the run phase, not other phases.
   *
   * @param {HeadTree extends undefined ? Node : HeadTree} tree
   *   Tree to transform and inspect.
   * @param {Compatible | undefined} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @returns {TailTree extends undefined ? Node : TailTree}
   *   Transformed tree.
   */
  runSync(tree, file) {
    let complete = false;
    let result;
    this.run(tree, file, realDone);
    assertDone("runSync", "run", complete);
    return result;
    function realDone(error2, tree2) {
      bail(error2);
      result = tree2;
      complete = true;
    }
  }
  /**
   * Compile a syntax tree.
   *
   * > **Note**: `stringify` freezes the processor if not already *frozen*.
   *
   * > **Note**: `stringify` performs the stringify phase, not the run phase
   * > or other phases.
   *
   * @param {CompileTree extends undefined ? Node : CompileTree} tree
   *   Tree to compile.
   * @param {Compatible | undefined} [file]
   *   File associated with `node` (optional); any value accepted as `x` in
   *   `new VFile(x)`.
   * @returns {CompileResult extends undefined ? Value : CompileResult}
   *   Textual representation of the tree (see note).
   *
   *   > **Note**: unified typically compiles by serializing: most compilers
   *   > return `string` (or `Uint8Array`).
   *   > Some compilers, such as the one configured with
   *   > [`rehype-react`][rehype-react], return other values (in this case, a
   *   > React tree).
   *   > If you’re using a compiler that doesn’t serialize, expect different
   *   > result values.
   *   >
   *   > To register custom results in TypeScript, add them to
   *   > {@linkcode CompileResultMap}.
   *
   *   [rehype-react]: https://github.com/rehypejs/rehype-react
   */
  stringify(tree, file) {
    this.freeze();
    const realFile = vfile(file);
    const compiler2 = this.compiler || this.Compiler;
    assertCompiler("stringify", compiler2);
    assertNode(tree);
    return compiler2(tree, realFile);
  }
  /**
   * Configure the processor to use a plugin, a list of usable values, or a
   * preset.
   *
   * If the processor is already using a plugin, the previous plugin
   * configuration is changed based on the options that are passed in.
   * In other words, the plugin is not added a second time.
   *
   * > **Note**: `use` cannot be called on *frozen* processors.
   * > Call the processor first to create a new unfrozen processor.
   *
   * @example
   *   There are many ways to pass plugins to `.use()`.
   *   This example gives an overview:
   *
   *   ```js
   *   import {unified} from 'unified'
   *
   *   unified()
   *     // Plugin with options:
   *     .use(pluginA, {x: true, y: true})
   *     // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
   *     .use(pluginA, {y: false, z: true})
   *     // Plugins:
   *     .use([pluginB, pluginC])
   *     // Two plugins, the second with options:
   *     .use([pluginD, [pluginE, {}]])
   *     // Preset with plugins and settings:
   *     .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
   *     // Settings only:
   *     .use({settings: {position: false}})
   *   ```
   *
   * @template {Array<unknown>} [Parameters=[]]
   * @template {Node | string | undefined} [Input=undefined]
   * @template [Output=Input]
   *
   * @overload
   * @param {Preset | null | undefined} [preset]
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {PluggableList} list
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *
   * @overload
   * @param {Plugin<Parameters, Input, Output>} plugin
   * @param {...(Parameters | [boolean])} parameters
   * @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
   *
   * @param {PluggableList | Plugin | Preset | null | undefined} value
   *   Usable value.
   * @param {...unknown} parameters
   *   Parameters, when a plugin is given as a usable value.
   * @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
   *   Current processor.
   */
  use(value2, ...parameters) {
    const attachers = this.attachers;
    const namespace = this.namespace;
    assertUnfrozen("use", this.frozen);
    if (value2 === null || value2 === void 0)
      ;
    else if (typeof value2 === "function") {
      addPlugin(value2, parameters);
    } else if (typeof value2 === "object") {
      if (Array.isArray(value2)) {
        addList(value2);
      } else {
        addPreset(value2);
      }
    } else {
      throw new TypeError("Expected usable value, not `" + value2 + "`");
    }
    return this;
    function add2(value3) {
      if (typeof value3 === "function") {
        addPlugin(value3, []);
      } else if (typeof value3 === "object") {
        if (Array.isArray(value3)) {
          const [plugin, ...parameters2] = (
            /** @type {PluginTuple<Array<unknown>>} */
            value3
          );
          addPlugin(plugin, parameters2);
        } else {
          addPreset(value3);
        }
      } else {
        throw new TypeError("Expected usable value, not `" + value3 + "`");
      }
    }
    function addPreset(result) {
      if (!("plugins" in result) && !("settings" in result)) {
        throw new Error(
          "Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither"
        );
      }
      addList(result.plugins);
      if (result.settings) {
        namespace.settings = extend$1(true, namespace.settings, result.settings);
      }
    }
    function addList(plugins) {
      let index2 = -1;
      if (plugins === null || plugins === void 0)
        ;
      else if (Array.isArray(plugins)) {
        while (++index2 < plugins.length) {
          const thing = plugins[index2];
          add2(thing);
        }
      } else {
        throw new TypeError("Expected a list of plugins, not `" + plugins + "`");
      }
    }
    function addPlugin(plugin, parameters2) {
      let index2 = -1;
      let entryIndex = -1;
      while (++index2 < attachers.length) {
        if (attachers[index2][0] === plugin) {
          entryIndex = index2;
          break;
        }
      }
      if (entryIndex === -1) {
        attachers.push([plugin, ...parameters2]);
      } else if (parameters2.length > 0) {
        let [primary, ...rest] = parameters2;
        const currentPrimary = attachers[entryIndex][1];
        if (isPlainObject2(currentPrimary) && isPlainObject2(primary)) {
          primary = extend$1(true, currentPrimary, primary);
        }
        attachers[entryIndex] = [plugin, primary, ...rest];
      }
    }
  }
}
const unified = new Processor().freeze();
function assertParser(name2, value2) {
  if (typeof value2 !== "function") {
    throw new TypeError("Cannot `" + name2 + "` without `parser`");
  }
}
function assertCompiler(name2, value2) {
  if (typeof value2 !== "function") {
    throw new TypeError("Cannot `" + name2 + "` without `compiler`");
  }
}
function assertUnfrozen(name2, frozen) {
  if (frozen) {
    throw new Error(
      "Cannot call `" + name2 + "` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`."
    );
  }
}
function assertNode(node2) {
  if (!isPlainObject2(node2) || typeof node2.type !== "string") {
    throw new TypeError("Expected node, got `" + node2 + "`");
  }
}
function assertDone(name2, asyncName, complete) {
  if (!complete) {
    throw new Error(
      "`" + name2 + "` finished async. Use `" + asyncName + "` instead"
    );
  }
}
function vfile(value2) {
  return looksLikeAVFile(value2) ? value2 : new VFile(value2);
}
function looksLikeAVFile(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "message" in value2 && "messages" in value2
  );
}
function looksLikeAValue(value2) {
  return typeof value2 === "string" || isUint8Array(value2);
}
function isUint8Array(value2) {
  return Boolean(
    value2 && typeof value2 === "object" && "byteLength" in value2 && "byteOffset" in value2
  );
}
const changelog = "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
const emptyPlugins = [];
const emptyRemarkRehypeOptions = { allowDangerousHtml: true };
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
const deprecations = [
  { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
  { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
  {
    from: "allowNode",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "allowElement"
  },
  {
    from: "allowedTypes",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "allowedElements"
  },
  { from: "className", id: "remove-classname" },
  {
    from: "disallowedTypes",
    id: "replace-allownode-allowedtypes-and-disallowedtypes",
    to: "disallowedElements"
  },
  { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
  { from: "includeElementIndex", id: "#remove-includeelementindex" },
  {
    from: "includeNodeIndex",
    id: "change-includenodeindex-to-includeelementindex"
  },
  { from: "linkTarget", id: "remove-linktarget" },
  { from: "plugins", id: "change-plugins-to-remarkplugins", to: "remarkPlugins" },
  { from: "rawSourcePos", id: "#remove-rawsourcepos" },
  { from: "renderers", id: "change-renderers-to-components", to: "components" },
  { from: "source", id: "change-source-to-children", to: "children" },
  { from: "sourcePos", id: "#remove-sourcepos" },
  { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
  { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" }
];
function Markdown(options) {
  const processor = createProcessor(options);
  const file = createFile(options);
  return post(processor.runSync(processor.parse(file), file), options);
}
function createProcessor(options) {
  const rehypePlugins = options.rehypePlugins || emptyPlugins;
  const remarkPlugins = options.remarkPlugins || emptyPlugins;
  const remarkRehypeOptions = options.remarkRehypeOptions ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions } : emptyRemarkRehypeOptions;
  const processor = unified().use(remarkParse).use(remarkPlugins).use(remarkRehype, remarkRehypeOptions).use(rehypePlugins);
  return processor;
}
function createFile(options) {
  const children = options.children || "";
  const file = new VFile();
  if (typeof children === "string") {
    file.value = children;
  }
  return file;
}
function post(tree, options) {
  const allowedElements = options.allowedElements;
  const allowElement = options.allowElement;
  const components2 = options.components;
  const disallowedElements = options.disallowedElements;
  const skipHtml = options.skipHtml;
  const unwrapDisallowed = options.unwrapDisallowed;
  const urlTransform = options.urlTransform || defaultUrlTransform;
  for (const deprecation of deprecations) {
    if (Object.hasOwn(options, deprecation.from)) {
      unreachable(
        "Unexpected `" + deprecation.from + "` prop, " + (deprecation.to ? "use `" + deprecation.to + "` instead" : "remove it") + " (see <" + changelog + "#" + deprecation.id + "> for more info)"
      );
    }
  }
  visit(tree, transform2);
  return toJsxRuntime(tree, {
    Fragment: jsxRuntimeExports.Fragment,
    components: components2,
    ignoreInvalidStyle: true,
    jsx: jsxRuntimeExports.jsx,
    jsxs: jsxRuntimeExports.jsxs,
    passKeys: true,
    passNode: true
  });
  function transform2(node2, index2, parent) {
    if (node2.type === "raw" && parent && typeof index2 === "number") {
      if (skipHtml) {
        parent.children.splice(index2, 1);
      } else {
        parent.children[index2] = { type: "text", value: node2.value };
      }
      return index2;
    }
    if (node2.type === "element") {
      let key;
      for (key in urlAttributes) {
        if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node2.properties, key)) {
          const value2 = node2.properties[key];
          const test2 = urlAttributes[key];
          if (test2 === null || test2.includes(node2.tagName)) {
            node2.properties[key] = urlTransform(String(value2 || ""), key, node2);
          }
        }
      }
    }
    if (node2.type === "element") {
      let remove = allowedElements ? !allowedElements.includes(node2.tagName) : disallowedElements ? disallowedElements.includes(node2.tagName) : false;
      if (!remove && allowElement && typeof index2 === "number") {
        remove = !allowElement(node2, index2, parent);
      }
      if (remove && parent && typeof index2 === "number") {
        if (unwrapDisallowed && node2.children) {
          parent.children.splice(index2, 1, ...node2.children);
        } else {
          parent.children.splice(index2, 1);
        }
        return index2;
      }
    }
  }
}
function defaultUrlTransform(value2) {
  const colon = value2.indexOf(":");
  const questionMark = value2.indexOf("?");
  const numberSign = value2.indexOf("#");
  const slash = value2.indexOf("/");
  if (
    // If there is no protocol, it’s relative.
    colon === -1 || // If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
    slash !== -1 && colon > slash || questionMark !== -1 && colon > questionMark || numberSign !== -1 && colon > numberSign || // It is a protocol, it should be allowed.
    safeProtocol.test(value2.slice(0, colon))
  ) {
    return value2;
  }
  return "";
}
const AppInfo = ({ appInfo }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [newVersion, setNewVersion] = reactExports.useState();
  const appUpdaterState = useAppUpdaterStateStore((state) => state);
  const checkNewAppVersion = () => {
    BApi$1.updater.getNewAppVersion().then((a2) => {
      setNewVersion(a2.data);
    });
  };
  reactExports.useEffect(() => {
    checkNewAppVersion();
    return () => {
    };
  }, []);
  const renderNewVersion = () => {
    var _a2;
    switch (appUpdaterState.status) {
      case UpdaterStatus.UpToDate:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", color: "default", children: t2("configuration.appInfo.upToDate") });
      case UpdaterStatus.Idle:
        if (newVersion) {
          if (newVersion.version) {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", children: newVersion.version }),
              newVersion.changelog && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "secondary",
                    size: "sm",
                    variant: "light",
                    onPress: () => {
                      createPortal(Modal, {
                        size: "xl",
                        title: newVersion.version,
                        defaultVisible: true,
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                          Markdown,
                          {
                            components: {
                              a: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { ...props, target: "_blank" })
                            },
                            children: newVersion.changelog
                          }
                        ),
                        footer: { actions: ["cancel"] }
                      });
                    },
                    children: t2("configuration.appInfo.changelog")
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  color: "success",
                  size: "sm",
                  variant: "light",
                  onClick: () => {
                    BApi$1.updater.startUpdatingApp();
                  },
                  children: t2("configuration.appInfo.clickToAutoUpdate")
                }
              ),
              ((_a2 = newVersion.installers) == null ? void 0 : _a2.length) > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "vertical" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  PopoverComponent,
                  {
                    trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", variant: "light", children: t2("configuration.appInfo.autoUpdateFails") }),
                    children: newVersion.installers.map((i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ExternalLink, { href: i2.url, children: [
                      i2.name,
                      "(",
                      bytesToSize(i2.size),
                      ")"
                    ] }) }, i2.url))
                  }
                )
              ] }) : void 0
            ] });
          } else {
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", color: "default", children: t2("configuration.appInfo.upToDate") });
          }
        } else {
          return t2("configuration.appInfo.failedToGetLatestVersion");
        }
      case UpdaterStatus.Running:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          progress_default,
          {
            showValueLabel: true,
            className: "w-[200px] pl-3",
            size: "sm",
            value: appUpdaterState.percentage,
            label: `${t2("configuration.appInfo.downloading")} ${(newVersion == null ? void 0 : newVersion.version) ?? ""}`
          }
        );
      case UpdaterStatus.PendingRestart:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "sm",
            color: "primary",
            onClick: () => {
              BApi$1.updater.restartAndUpdateApp();
            },
            children: t2("configuration.appInfo.restartToUpdate")
          }
        );
      case UpdaterStatus.Failed:
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          t2("configuration.appInfo.failedToUpdateApp"),
          ": ",
          t2(appUpdaterState.error),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              variant: "light",
              color: "primary",
              onClick: () => {
                BApi$1.updater.startUpdatingApp();
              },
              children: t2("configuration.appInfo.clickToRetry")
            }
          )
        ] });
      default:
        return /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { type: "loading" });
    }
  };
  const renderPathValue = (path, description) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { hideSymbol: true, size: "sm", variant: "bordered", children: path }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          color: "primary",
          onPress: () => BApi$1.tool.openFileOrDirectory({ path }),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" })
        }
      )
    ] }),
    description && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-foreground-400", children: description })
  ] });
  const buildAppInfoDataSource = () => {
    const items = [
      {
        label: "configuration.appInfo.appDataPath",
        value: renderPathValue(
          appInfo.appDataPath,
          t2("configuration.appInfo.tip.appDataPath")
        )
      },
      {
        label: "configuration.appInfo.dataPath",
        value: renderPathValue(
          appInfo.dataPath,
          t2("configuration.appInfo.tip.dataPath")
        )
      },
      {
        label: "configuration.appInfo.tempFilesPath",
        value: renderPathValue(
          appInfo.tempFilesPath,
          t2("configuration.appInfo.tip.tempFilesPath")
        )
      },
      {
        label: "configuration.appInfo.logPath",
        value: renderPathValue(
          appInfo.logPath,
          t2("configuration.appInfo.tip.logPath")
        )
      },
      {
        label: "configuration.appInfo.backupPath",
        value: renderPathValue(
          appInfo.backupPath,
          t2("configuration.appInfo.tip.backupPath")
        )
      },
      {
        label: "configuration.appInfo.coreVersion",
        value: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "light", children: appInfo.coreVersion })
      },
      {
        label: "configuration.appInfo.latestVersion",
        value: renderNewVersion()
      }
    ];
    return items.map((x2) => ({ ...x2, label: t2(x2.label) }));
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.appInfo.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: buildAppInfoDataSource().map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.label }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
AppInfo.displayName = "AppInfo";
const contacts = [
  {
    label: "Github",
    value: (
      // <ExternalLink to={Urls.Github}>
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          color: "default",
          size: "sm",
          onClick: () => {
            BApi$1.gui.openUrlInDefaultBrowser({ url: urls.Github });
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$E, { className: "text-lg" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: "Github" })
          ]
        }
      )
    )
  },
  {
    label: "QQ",
    value: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: qqGroupImg })
  }
  // {
  //   label: 'WeChat',
  //   value: <ExternalLink to={Urls.WeChatQrCode}>Github</ExternalLink>,
  // },
];
const ContactUs = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.contact.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: contacts.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: t2(c2.label) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
ContactUs.displayName = "ContactUs";
const Functional = ({ applyPatches }) => {
  const { t: t2 } = useTranslation();
  const appOptions = useAppOptionsStore((state) => state.data);
  const uiOptions = useUiOptionsStore((state) => state.data);
  const functionSettings = [
    {
      label: "configuration.functional.startupPage",
      renderCell: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            orientation: "horizontal",
            size: "sm",
            value: String(uiOptions.startupPage),
            onValueChange: (v2) => {
              applyPatches(BApi$1.options.patchUiOptions, {
                startupPage: Number(v2)
              });
            },
            children: startupPages.map((s2) => {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(s2.value), children: t2(s2.label) }, s2.value);
            })
          }
        );
      }
    },
    {
      label: "configuration.functional.exitBehavior",
      renderCell: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          radio_group_default,
          {
            orientation: "horizontal",
            size: "sm",
            value: String(appOptions.closeBehavior),
            onValueChange: (v2) => {
              applyPatches(BApi$1.options.patchAppOptions, {
                closeBehavior: Number(v2)
              });
            },
            children: [
              CloseBehavior.Minimize,
              CloseBehavior.Exit,
              CloseBehavior.Prompt
            ].map((c2) => /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(c2), children: t2(`configuration.functional.exitBehavior.${CloseBehavior[c2].toLowerCase()}`) }, c2))
          }
        );
      }
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.functional.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: functionSettings.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: t2(c2.label) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.renderCell() })
          ]
        },
        i2
      );
    }) })
  ] }) }) });
};
Functional.displayName = "Functional";
const Others = ({ applyPatches }) => {
  var _a2, _b2;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { showOnboarding, resetOnboarding, completeOnboarding } = useOnboarding();
  const appOptions = useAppOptionsStore((state) => state.data);
  const networkOptions = useNetworkOptionsStore((state) => state.data);
  const proxies = [
    {
      label: t2("configuration.others.proxy.doNotUse"),
      value: 0 .toString()
    },
    {
      label: t2("configuration.others.proxy.useSystem"),
      value: 1 .toString()
    },
    ...((_a2 = networkOptions.customProxies) == null ? void 0 : _a2.map((c2) => ({
      label: c2.address,
      value: c2.id
    }))) ?? []
  ];
  let selectedProxy;
  if (networkOptions == null ? void 0 : networkOptions.proxy) {
    const p2 = networkOptions.proxy;
    if (p2.mode === 2) {
      selectedProxy = p2.customProxyId;
    } else {
      selectedProxy = (_b2 = p2.mode) == null ? void 0 : _b2.toString();
    }
  }
  selectedProxy ?? (selectedProxy = 0 .toString());
  const otherSettings = [
    {
      label: "configuration.others.proxy",
      tip: "configuration.others.proxy.tip",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: 300 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              dataSource: proxies,
              multiple: false,
              selectedKeys: selectedProxy === void 0 ? void 0 : [selectedProxy],
              size: "sm",
              onSelectionChange: (keys2) => {
                const key = Array.from(keys2)[0];
                const patches = {};
                if (key === 0 .toString()) {
                  patches.proxy = {
                    mode: 0,
                    customProxyId: void 0
                  };
                } else {
                  if (key === 1 .toString()) {
                    patches.proxy = {
                      mode: 1,
                      customProxyId: void 0
                    };
                  } else {
                    patches.proxy = {
                      mode: 2,
                      customProxyId: key
                    };
                  }
                }
                BApi$1.options.patchNetworkOptions(patches).then((x2) => {
                  if (!x2.code) {
                    Vt.success(t2("common.success.saved"));
                  }
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              onClick: () => {
                let p2;
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "lg",
                  title: t2("configuration.others.proxy.addModal.title"),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    input_default,
                    {
                      placeholder: t2("configuration.others.proxy.tip"),
                      onValueChange: (v2) => p2 = v2
                    }
                  ),
                  onOk: async () => {
                    if (p2 === void 0 || p2.length === 0) {
                      Vt.error(t2("common.error.invalidData"));
                      throw new Error("Invalid data");
                    }
                    await BApi$1.options.patchNetworkOptions({
                      customProxies: [
                        ...networkOptions.customProxies ?? [],
                        { address: p2 }
                      ]
                    });
                  }
                });
              },
              children: t2("common.action.add")
            }
          )
        ] });
      }
    },
    {
      label: "configuration.others.enablePreRelease",
      tip: "configuration.others.enablePreRelease.tip",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: appOptions.enablePreReleaseChannel,
            size: "sm",
            onValueChange: (checked) => {
              applyPatches(
                BApi$1.options.patchAppOptions,
                { enablePreReleaseChannel: checked }
              );
            }
          }
        );
      }
    },
    {
      label: "configuration.others.enableTracking",
      tip: "configuration.others.enableTracking.tip",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: appOptions.enableAnonymousDataTracking,
            size: "sm",
            onValueChange: (checked) => {
              applyPatches(
                BApi$1.options.patchAppOptions,
                { enableAnonymousDataTracking: checked }
              );
            }
          }
        );
      }
    },
    {
      label: "configuration.others.maxParallelism",
      tip: "configuration.others.maxParallelism.tip",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            type: "number",
            size: "sm",
            min: 1,
            placeholder: String(appOptions.effectiveMaxParallelism),
            value: appOptions.maxParallelism !== void 0 && appOptions.maxParallelism !== null ? String(appOptions.maxParallelism) : "",
            className: "w-24",
            onValueChange: (v2) => {
              const value2 = v2 === "" ? void 0 : parseInt(v2, 10);
              if (value2 === void 0 || value2 >= 1 && !isNaN(value2)) {
                applyPatches(
                  BApi$1.options.patchAppOptions,
                  { maxParallelism: value2 }
                );
              }
            }
          }
        );
      }
    },
    {
      label: "onboarding.viewAgain",
      renderValue: () => {
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            variant: "flat",
            onPress: resetOnboarding,
            children: t2("onboarding.viewAgain")
          }
        );
      }
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(OnboardingModal, { visible: showOnboarding, onComplete: completeOnboarding }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "settings", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { removeWrapper: true, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.others.title") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: otherSettings.map((c2, i2) => {
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          table_row_default,
          {
            className: "hover:bg-[var(--bakaui-overlap-background)]",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: c2.tip ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  className: "max-w-[300px]",
                  color: "secondary",
                  content: t2(c2.tip),
                  placement: "top",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                    t2(c2.label),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                  ] })
                }
              ) : t2(c2.label) }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.renderValue() })
            ]
          },
          i2
        );
      }) })
    ] }) })
  ] });
};
Others.displayName = "Others";
const Development = () => {
  var _a2;
  const { t: t2 } = useTranslation();
  const appContext = useAppContextStore((state) => state);
  const appOptions = useAppOptionsStore((state) => state.data);
  const apiDocumentUrl = appContext.apiEndpoint ? `${appContext.apiEndpoint}/swagger` : void 0;
  const parsePorts = (text2) => {
    const raw = (text2 ?? "").split(/[，,\s]+/).map((s2) => s2.trim()).filter((s2) => s2.length > 0);
    const nums = raw.map((s2) => Number.parseInt(s2, 10)).filter((n2) => Number.isFinite(n2) && n2 > 0 && n2 <= 65535);
    const seen2 = /* @__PURE__ */ new Set();
    const unique = [];
    for (const n2 of nums) {
      if (!seen2.has(n2)) {
        seen2.add(n2);
        unique.push(n2);
      }
    }
    return unique;
  };
  const renderListeningPortCount = () => {
    const min2 = 0;
    const max2 = 3;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      EditableValue,
      {
        Editor: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          number_input_default,
          {
            isClearable: true,
            className: "max-w-[320px]",
            description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.currentListeningPortCount", {
                port: appOptions.autoListeningPortCount === 0 ? t2("configuration.development.auto") : appOptions.autoListeningPortCount
              }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.configurablePortRange", { min: min2, max: max2 }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.changesAfterRestart") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.portWarning") })
            ] }),
            formatOptions: { useGrouping: false },
            max: max2,
            min: min2,
            placeholder: t2("configuration.development.count"),
            ...props
          }
        ),
        Viewer: ({ value: value2, ...props }) => value2 !== void 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            radius: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNumber, { className: "text-base" }),
            variant: "flat",
            ...props,
            children: value2 === 0 ? t2("configuration.development.auto") : value2
          }
        ) : null,
        value: appOptions.autoListeningPortCount,
        onSubmit: async (v2) => {
          await BApi$1.options.patchAppOptions({ autoListeningPortCount: v2 });
          Vt.success(t2("common.success.saved"));
        }
      }
    );
  };
  const renderListeningPorts = () => {
    const toText = (ports) => (ports == null ? void 0 : ports.length) ? ports.join(", ") : "";
    const max2 = 6;
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      EditableValue,
      {
        Editor: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isClearable: true,
            className: "max-w-[420px]",
            description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.portsInput") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.changesAfterRestart") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("configuration.development.tip.portWarning") })
            ] }),
            placeholder: t2("configuration.development.input.portsPlaceholder"),
            ...props
          }
        ),
        Viewer: ({ value: value2 }) => {
          const ports = parsePorts(value2);
          if (ports && ports.length > 0) {
            return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: ports.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                radius: "sm",
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineNumber, { className: "text-base" }),
                variant: "flat",
                children: p2
              },
              p2
            )) });
          }
          return null;
        },
        value: toText(appOptions.listeningPorts),
        onSubmit: async (text2) => {
          const ports = parsePorts(text2);
          if (ports.length > max2) {
            Vt.error(t2("configuration.development.error.tooManyPorts", { max: max2 }));
            throw new Error("invalid");
          }
          await BApi$1.options.patchAppOptions({ listeningPorts: ports });
          Vt.success(t2("common.success.saved"));
        }
      }
    );
  };
  const items = [
    {
      label: "configuration.development.apiEndpoints",
      value: appContext.apiEndpoints && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 items-center", children: (_a2 = appContext.apiEndpoints) == null ? void 0 : _a2.map((x2, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { size: "sm", symbol: /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: " " }), variant: "flat", children: x2 }, idx)) })
    },
    {
      label: "configuration.development.apiDocument",
      value: apiDocumentUrl && /* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { href: apiDocumentUrl, children: apiDocumentUrl })
    }
  ];
  if (appContext.runtimeMode === RuntimeMode.Dev || appContext.runtimeMode === RuntimeMode.WinForms) {
    items.push(
      {
        label: "configuration.development.listeningPortCount",
        value: renderListeningPortCount()
      },
      {
        label: "configuration.development.listeningPorts",
        value: renderListeningPorts()
      }
    );
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, removeWrapper: true, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { width: 200, children: t2("configuration.development.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: " " })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: items.map((c2, i2) => {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: "hover:bg-[var(--bakaui-overlap-background)]",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: t2(c2.label) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: c2.value })
          ]
        },
        i2
      );
    }) })
  ] });
};
Development.displayName = "Development";
const ConfigurationPage = () => {
  const { t: t2 } = useTranslation();
  const [appInfo, setAppInfo] = reactExports.useState({});
  reactExports.useEffect(() => {
    BApi$1.app.getAppInfo().then((a2) => {
      setAppInfo(a2.data || {});
    });
  }, []);
  const applyPatches = (api, patches, success) => {
    api(patches).then((a2) => {
      if (!a2.code) {
        Vt.success(t2("common.success.saved"));
        success == null ? void 0 : success(a2);
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "configuration-page", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Dependency, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Functional, { applyPatches }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Others, { applyPatches }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(AppInfo, { appInfo }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Development, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(ContactUs, {})
  ] });
};
function ThirdPartyConfigurationPage() {
  const { t: t2 } = useTranslation();
  const applyPatches = (API, patches = {}, success = () => {
  }) => {
    API(patches).then((a2) => {
      if (!a2.code) {
        toast.success(t2("thirdPartyConfig.success.saved"));
        success(a2);
      }
    });
  };
  const bilibiliOptions = useBilibiliOptionsStore((state) => state.data);
  const exhentaiOptions = useExHentaiOptionsStore((state) => state.data);
  const pixivOptions = usePixivOptionsStore((state) => state.data);
  const soulPlusOptions = useSoulPlusOptionsStore((state) => state.data);
  const bangumiOptions = useBangumiOptionsStore((state) => state.data);
  const cienOptions = useCienOptionsStore((state) => state.data);
  const dlsiteOptions = useDLsiteOptionsStore((state) => state.data);
  const fanboxOptions = useFanboxOptionsStore((state) => state.data);
  const fantiaOptions = useFantiaOptionsStore((state) => state.data);
  const patreonOptions = usePatreonOptionsStore((state) => state.data);
  const tmdbOptions = useTmdbOptionsStore((state) => state.data);
  const [tmpBilibiliOptions, setTmpBilibiliOptions] = reactExports.useState(
    bilibiliOptions || {}
  );
  const [tmpExHentaiOptions, setTmpExHentaiOptions] = reactExports.useState(
    exhentaiOptions || {}
  );
  const [tmpPixivOptions, setTmpPixivOptions] = reactExports.useState(
    pixivOptions || {}
  );
  const [tmpSoulPlusOptions, setTmpSoulPlusOptions] = reactExports.useState(
    soulPlusOptions || {}
  );
  const [tmpBangumiOptions, setTmpBangumiOptions] = reactExports.useState(
    bangumiOptions || {}
  );
  const [tmpCienOptions, setTmpCienOptions] = reactExports.useState(cienOptions || {});
  const [tmpDLsiteOptions, setTmpDLsiteOptions] = reactExports.useState(
    dlsiteOptions || {}
  );
  const [tmpFanboxOptions, setTmpFanboxOptions] = reactExports.useState(
    fanboxOptions || {}
  );
  const [tmpFantiaOptions, setTmpFantiaOptions] = reactExports.useState(
    fantiaOptions || {}
  );
  const [tmpPatreonOptions, setTmpPatreonOptions] = reactExports.useState(
    patreonOptions || {}
  );
  const [tmpTmdbOptions, setTmpTmdbOptions] = reactExports.useState(tmdbOptions || {});
  const [validatingCookies, setValidatingCookies] = reactExports.useState({});
  reactExports.useEffect(() => {
    setTmpBilibiliOptions(JSON.parse(JSON.stringify(bilibiliOptions || {})));
  }, [bilibiliOptions]);
  reactExports.useEffect(() => {
    setTmpExHentaiOptions(JSON.parse(JSON.stringify(exhentaiOptions || {})));
  }, [exhentaiOptions]);
  reactExports.useEffect(() => {
    setTmpPixivOptions(JSON.parse(JSON.stringify(pixivOptions || {})));
  }, [pixivOptions]);
  reactExports.useEffect(() => {
    setTmpSoulPlusOptions(JSON.parse(JSON.stringify(soulPlusOptions || {})));
  }, [soulPlusOptions]);
  reactExports.useEffect(() => {
    setTmpBangumiOptions(JSON.parse(JSON.stringify(bangumiOptions || {})));
  }, [bangumiOptions]);
  reactExports.useEffect(() => {
    setTmpCienOptions(JSON.parse(JSON.stringify(cienOptions || {})));
  }, [cienOptions]);
  reactExports.useEffect(() => {
    setTmpDLsiteOptions(JSON.parse(JSON.stringify(dlsiteOptions || {})));
  }, [dlsiteOptions]);
  reactExports.useEffect(() => {
    setTmpFanboxOptions(JSON.parse(JSON.stringify(fanboxOptions || {})));
  }, [fanboxOptions]);
  reactExports.useEffect(() => {
    setTmpFantiaOptions(JSON.parse(JSON.stringify(fantiaOptions || {})));
  }, [fantiaOptions]);
  reactExports.useEffect(() => {
    setTmpPatreonOptions(JSON.parse(JSON.stringify(patreonOptions || {})));
  }, [patreonOptions]);
  reactExports.useEffect(() => {
    setTmpTmdbOptions(JSON.parse(JSON.stringify(tmdbOptions || {})));
  }, [tmdbOptions]);
  const validateCookie = (thirdParty, cookie, target) => {
    setValidatingCookies((prev2) => ({ ...prev2, [thirdParty]: true }));
    BApi$1.tool.validateCookie({ cookie, target }).then((r2) => {
      if (r2.code) {
        toast.danger(`${t2("thirdPartyConfig.error.invalidCookie")}:${r2.message}`);
      } else {
        toast.success(t2("thirdPartyConfig.success.cookieValid"));
      }
    }).finally(() => {
      setValidatingCookies((prev2) => ({ ...prev2, [thirdParty]: false }));
    });
  };
  const renderDownloaderOptions = (options, setOptions2, saveApi, thirdPartyName) => {
    var _a2;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        textarea_default,
        {
          label: t2("thirdPartyConfig.label.cookie"),
          size: "sm",
          value: options.cookie || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              cookie: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("thirdPartyConfig.label.maxConcurrency"),
            size: "sm",
            type: "number",
            value: String(options.maxConcurrency || 1),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                maxConcurrency: Number(v2) || 1
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("thirdPartyConfig.label.requestInterval"),
            size: "sm",
            type: "number",
            value: String(options.requestInterval || 1e3),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                requestInterval: Number(v2) || 1e3
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("thirdPartyConfig.label.defaultPath"),
          size: "sm",
          value: options.defaultPath || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              defaultPath: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("thirdPartyConfig.label.namingConvention"),
          size: "sm",
          value: options.namingConvention || "",
          onValueChange: (v2) => {
            setOptions2({
              ...options,
              namingConvention: v2
            });
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("thirdPartyConfig.label.maxRetries"),
            size: "sm",
            type: "number",
            value: String(options.maxRetries || 0),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                maxRetries: Number(v2) || 0
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("thirdPartyConfig.label.requestTimeout"),
            size: "sm",
            type: "number",
            value: String(options.requestTimeout || 0),
            onValueChange: (v2) => {
              setOptions2({
                ...options,
                requestTimeout: Number(v2) || 0
              });
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "operations flex gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            color: "primary",
            size: "sm",
            onPress: () => {
              applyPatches(saveApi, options);
            },
            children: t2("thirdPartyConfig.action.save")
          }
        ),
        options.cookie && /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            disabled: !((_a2 = options.cookie) == null ? void 0 : _a2.length) || validatingCookies[thirdPartyName],
            isLoading: validatingCookies[thirdPartyName],
            size: "sm",
            onPress: () => {
              const validatorMap = {
                bilibili: CookieValidatorTarget.BiliBili,
                exhentai: CookieValidatorTarget.ExHentai,
                pixiv: CookieValidatorTarget.Pixiv
              };
              const target = validatorMap[thirdPartyName.toLowerCase()];
              if (target) {
                validateCookie(thirdPartyName, options.cookie, target);
              }
            },
            children: t2("thirdPartyConfig.action.validateCookie")
          }
        )
      ] })
    ] });
  };
  const thirdPartySettings = reactExports.useMemo(
    () => [
      {
        key: "bilibili",
        label: "Bilibili",
        tip: "thirdPartyConfig.tip.bilibili",
        content: renderDownloaderOptions(
          tmpBilibiliOptions,
          setTmpBilibiliOptions,
          BApi$1.options.patchBilibiliOptions,
          "bilibili"
        )
      },
      {
        key: "exhentai",
        label: "ExHentai",
        tip: "thirdPartyConfig.tip.exhentai",
        content: renderDownloaderOptions(
          tmpExHentaiOptions,
          setTmpExHentaiOptions,
          BApi$1.options.patchExHentaiOptions,
          "exhentai"
        )
      },
      {
        key: "pixiv",
        label: "Pixiv",
        tip: "thirdPartyConfig.tip.pixiv",
        content: renderDownloaderOptions(
          tmpPixivOptions,
          setTmpPixivOptions,
          BApi$1.options.patchPixivOptions,
          "pixiv"
        )
      },
      {
        key: "soulplus",
        label: "SoulPlus",
        tip: "thirdPartyConfig.tip.soulplus",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("thirdPartyConfig.label.cookie"),
              size: "sm",
              value: tmpSoulPlusOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpSoulPlusOptions({
                  ...tmpSoulPlusOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("thirdPartyConfig.label.autoBuyThreshold"),
              size: "sm",
              type: "number",
              value: String(tmpSoulPlusOptions.autoBuyThreshold || 0),
              onValueChange: (v2) => {
                setTmpSoulPlusOptions({
                  ...tmpSoulPlusOptions,
                  autoBuyThreshold: Number(v2) || 0
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(
                  BApi$1.options.patchSoulPlusOptions,
                  tmpSoulPlusOptions
                );
              },
              children: t2("thirdPartyConfig.action.save")
            }
          ) })
        ] })
      },
      {
        key: "bangumi",
        label: "Bangumi",
        tip: "thirdPartyConfig.tip.bangumi",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.maxConcurrency"),
                size: "sm",
                type: "number",
                value: String(tmpBangumiOptions.maxConcurrency || 1),
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    maxConcurrency: Number(v2) || 1
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.requestInterval"),
                size: "sm",
                type: "number",
                value: String(tmpBangumiOptions.requestInterval || 1e3),
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    requestInterval: Number(v2) || 1e3
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("thirdPartyConfig.label.cookie"),
              size: "sm",
              value: tmpBangumiOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpBangumiOptions({
                  ...tmpBangumiOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.userAgent"),
                size: "sm",
                value: tmpBangumiOptions.userAgent || "",
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    userAgent: v2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.referer"),
                size: "sm",
                value: tmpBangumiOptions.referer || "",
                onValueChange: (v2) => {
                  setTmpBangumiOptions({
                    ...tmpBangumiOptions,
                    referer: v2
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(
                  BApi$1.options.patchBangumiOptions,
                  tmpBangumiOptions
                );
              },
              children: t2("thirdPartyConfig.action.save")
            }
          ) })
        ] })
      },
      {
        key: "cien",
        label: "Cien",
        tip: "thirdPartyConfig.tip.cien",
        content: renderDownloaderOptions(
          tmpCienOptions,
          setTmpCienOptions,
          BApi$1.options.patchCienOptions,
          "cien"
        )
      },
      {
        key: "dlsite",
        label: "DLsite",
        tip: "thirdPartyConfig.tip.dlsite",
        content: renderDownloaderOptions(
          tmpDLsiteOptions,
          setTmpDLsiteOptions,
          BApi$1.options.patchDLsiteOptions,
          "dlsite"
        )
      },
      {
        key: "fanbox",
        label: "Fanbox",
        tip: "thirdPartyConfig.tip.fanbox",
        content: renderDownloaderOptions(
          tmpFanboxOptions,
          setTmpFanboxOptions,
          BApi$1.options.patchFanboxOptions,
          "fanbox"
        )
      },
      {
        key: "fantia",
        label: "Fantia",
        tip: "thirdPartyConfig.tip.fantia",
        content: renderDownloaderOptions(
          tmpFantiaOptions,
          setTmpFantiaOptions,
          BApi$1.options.patchFantiaOptions,
          "fantia"
        )
      },
      {
        key: "patreon",
        label: "Patreon",
        tip: "thirdPartyConfig.tip.patreon",
        content: renderDownloaderOptions(
          tmpPatreonOptions,
          setTmpPatreonOptions,
          BApi$1.options.patchPatreonOptions,
          "patreon"
        )
      },
      {
        key: "tmdb",
        label: "TMDB",
        tip: "thirdPartyConfig.tip.tmdb",
        content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.maxConcurrency"),
                size: "sm",
                type: "number",
                value: String(tmpTmdbOptions.maxConcurrency || 1),
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    maxConcurrency: Number(v2) || 1
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.requestInterval"),
                size: "sm",
                type: "number",
                value: String(tmpTmdbOptions.requestInterval || 1e3),
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    requestInterval: Number(v2) || 1e3
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("thirdPartyConfig.label.apiKey"),
              size: "sm",
              value: tmpTmdbOptions.apiKey || "",
              onValueChange: (v2) => {
                setTmpTmdbOptions({
                  ...tmpTmdbOptions,
                  apiKey: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              label: t2("thirdPartyConfig.label.cookie"),
              size: "sm",
              value: tmpTmdbOptions.cookie || "",
              onValueChange: (v2) => {
                setTmpTmdbOptions({
                  ...tmpTmdbOptions,
                  cookie: v2
                });
              }
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.userAgent"),
                size: "sm",
                value: tmpTmdbOptions.userAgent || "",
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    userAgent: v2
                  });
                }
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                label: t2("thirdPartyConfig.label.referer"),
                size: "sm",
                value: tmpTmdbOptions.referer || "",
                onValueChange: (v2) => {
                  setTmpTmdbOptions({
                    ...tmpTmdbOptions,
                    referer: v2
                  });
                }
              }
            )
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "operations", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            button_default$1,
            {
              color: "primary",
              size: "sm",
              onPress: () => {
                applyPatches(BApi$1.options.patchTmdbOptions, tmpTmdbOptions);
              },
              children: t2("thirdPartyConfig.action.save")
            }
          ) })
        ] })
      }
    ],
    [
      tmpBilibiliOptions,
      tmpExHentaiOptions,
      tmpPixivOptions,
      tmpSoulPlusOptions,
      tmpBangumiOptions,
      tmpCienOptions,
      tmpDLsiteOptions,
      tmpFanboxOptions,
      tmpFantiaOptions,
      tmpPatreonOptions,
      tmpTmdbOptions
    ]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-6", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-32 shrink-0 sticky top-4 self-start border-small px-1 py-2 rounded-small border-default-200 dark:border-default-100", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      listbox_default,
      {
        "aria-label": "Third party list",
        selectionMode: "single",
        onAction: (key) => {
          const el2 = document.getElementById(`tp-${String(key)}`);
          if (el2) {
            el2.scrollIntoView({ behavior: "smooth", block: "start" });
          }
        },
        children: thirdPartySettings.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: s2.label }, s2.key))
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 space-y-8", children: thirdPartySettings.map((s2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "scroll-mt-16", id: `tp-${s2.key}`, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-2 text-lg font-semibold", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: s2.label }),
        s2.tip && /* @__PURE__ */ jsxRuntimeExports.jsx(
          tooltip_default,
          {
            color: "secondary",
            content: t2(s2.tip),
            placement: "top",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: s2.content })
    ] }, s2.key)) })
  ] });
}
const BackgroundTaskPage = () => {
  const { t: t2 } = useTranslation();
  useTaskOptionsStore((state) => state.data);
  const bTasks = useBTasksStore((state) => state.tasks);
  const [editingOptions, setEditingOptions] = reactExports.useState({});
  const columns = [
    {
      key: "name",
      label: t2("backgroundTask.column.name")
    },
    {
      key: "status",
      label: t2("backgroundTask.column.status")
    },
    {
      key: "progress",
      label: t2("backgroundTask.column.progress")
    },
    {
      key: "startedAt",
      label: t2("backgroundTask.column.startedAt")
    },
    {
      key: "interval",
      label: t2("backgroundTask.column.interval")
    },
    {
      key: "nextTimeStartAt",
      label: t2("backgroundTask.column.nextTimeStartAt")
    },
    {
      key: "elapsed",
      label: t2("backgroundTask.column.elapsed")
    },
    {
      key: "enableAfter",
      label: t2("backgroundTask.column.enableAfter")
    }
  ];
  reactExports.useEffect(() => {
  }, []);
  const patchOptions = async () => {
    await BApi.options.patchTaskOptions({
      tasks: bTasks.filter((t22) => t22.isPersistent).map((t22) => {
        var _a2, _b2;
        return {
          id: t22.id,
          interval: ((_a2 = editingOptions[t22.id]) == null ? void 0 : _a2.interval) ?? t22.interval,
          enableAfter: ((_b2 = editingOptions[t22.id]) == null ? void 0 : _b2.enableAfter) ?? t22.enableAfter
        };
      })
    });
    Vt.success(t2("common.state.saved"));
    setEditingOptions({});
  };
  const renderInterval = (task) => {
    var _a2;
    if (!task.isPersistent) {
      return t2("backgroundTask.label.notSupported");
    }
    const editingInterval = (_a2 = editingOptions[task.id]) == null ? void 0 : _a2.interval;
    if (editingInterval) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        TimeInput,
        {
          autoFocus: true,
          granularity: "second",
          size: "sm",
          value: dayjs.duration(
            hooks.duration(editingInterval).asMilliseconds()
          ),
          onBlur: () => {
            patchOptions();
          },
          onChange: (v2) => {
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                interval: v2.format("HH:mm:ss")
              }
            });
          }
        }
      );
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            onPress: () => {
              setEditingOptions({
                ...editingOptions,
                [task.id]: {
                  interval: task.interval ?? "00:05:00"
                }
              });
            },
            variant: "light",
            size: "sm",
            children: task.interval ? dayjs.duration(hooks.duration(task.interval).asMilliseconds()).format("HH:mm:ss") : t2("backgroundTask.label.notSet")
          }
        ) }),
        task.interval && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
              t2("backgroundTask.label.willStartAt"),
              " ",
              dayjs(task.nextTimeStartAt).format("YYYY-MM-DD HH:mm:ss")
            ] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1d, { className: "text-base" })
          }
        )
      ] });
    }
  };
  const renderEnableAfter = (task) => {
    var _a2;
    if (!task.isPersistent) {
      return t2("backgroundTask.label.notSupported");
    }
    const format2 = "YYYY-MM-DD HH:mm:ss";
    const editingEnableAfter = (_a2 = editingOptions[task.id]) == null ? void 0 : _a2.enableAfter;
    if (editingEnableAfter) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        DateInput,
        {
          autoFocus: true,
          granularity: "second",
          size: "sm",
          value: dayjs(editingEnableAfter),
          onBlur: () => {
            patchOptions();
          },
          onChange: (v2) => {
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                enableAfter: v2 == null ? void 0 : v2.format(format2)
              }
            });
          }
        }
      );
    } else {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          onPress: () => {
            const initValue = task.enableAfter ? dayjs(task.enableAfter) : dayjs().add(1, "h");
            setEditingOptions({
              ...editingOptions,
              [task.id]: {
                enableAfter: initValue.format(format2)
              }
            });
          },
          variant: task.enableAfter ? "light" : "flat",
          size: "sm",
          children: task.enableAfter ? dayjs(task.enableAfter).format(format2) : t2("backgroundTask.label.notSet")
        }
      );
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    table_default,
    {
      isStriped: true,
      removeWrapper: true,
      "aria-label": "Example table with dynamic content",
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { columns, children: (column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: column2.label }, column2.key) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: bTasks.map((task) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              task.name,
              task.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: task.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" }) })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(table_cell_default, { children: [
              t2(`backgroundTask.status.${BTaskStatus[task.status].toLowerCase()}`),
              task.error && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "danger", content: task.error, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, {}) }),
              task.reasonForUnableToStart && /* @__PURE__ */ jsxRuntimeExports.jsx(
                Tooltip$1,
                {
                  color: "warning",
                  content: task.reasonForUnableToStart,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(progress_default, { color: "primary", size: "sm", value: task.percentage }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "div",
                {
                  className: "absolute top-0 left-0 flex items-center justify-center w-full h-full",
                  children: [
                    task.percentage,
                    "%"
                  ]
                }
              )
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.startedAt && dayjs(task.startedAt).format("YYYY-MM-DD HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderInterval(task) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.nextTimeStartAt && dayjs(task.nextTimeStartAt).format("YYYY-MM-DD HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.elapsed && dayjs.duration(hooks.duration(task.elapsed).asMilliseconds()).format("HH:mm:ss") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: renderEnableAfter(task) })
          ] }, task.id);
        }) })
      ]
    }
  );
};
BackgroundTaskPage.displayName = "BackgroundTaskPage";
function LogPage() {
  const { t: t2 } = useTranslation();
  const [logs, setLogs] = reactExports.useState([]);
  const [form2, setForm] = reactExports.useState({
    pageIndex: 1,
    pageSize: 100,
    startDt: void 0,
    endDt: void 0,
    level: void 0,
    logger: void 0,
    event: void 0,
    message: void 0
  });
  const [pageable, setPageable] = reactExports.useState({
    pageIndex: 1,
    totalCount: 0
  });
  const [dateRange, setDateRange] = reactExports.useState(
    null
  );
  const [expandedMsg, setExpandedMsg] = reactExports.useState(null);
  const { createPortal } = useBakabaseContext();
  reactExports.useEffect(() => {
    search2();
  }, [form2.pageIndex, form2.pageSize, form2.startDt, form2.endDt, form2.level, form2.logger, form2.event, form2.message]);
  const search2 = async () => {
    const d2 = await BApi$1.log.searchLogs(form2);
    setLogs(d2.data || []);
    setPageable({
      pageIndex: d2.pageIndex,
      totalCount: d2.totalCount
    });
  };
  const patchForm = (patches) => {
    setPageable((prev2) => ({ ...prev2, pageIndex: 1 }));
    setForm((prev2) => ({ ...prev2, ...patches, pageIndex: 1 }));
  };
  const handleDateRangeChange = (range3) => {
    setDateRange(range3);
    patchForm({
      startDt: (range3 == null ? void 0 : range3.start) ? range3.start.toDate().toISOString().slice(0, 19).replace("T", " ") : void 0,
      endDt: (range3 == null ? void 0 : range3.end) ? range3.end.toDate().toISOString().slice(0, 19).replace("T", " ") : void 0
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-4 items-center mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[260px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("log.filter.time") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          date_range_picker_default,
          {
            className: "flex-1",
            value: dateRange,
            onChange: handleDateRangeChange
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[100px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("log.filter.level") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          select_default,
          {
            className: "min-w-[100px]",
            placeholder: t2("log.filter.all"),
            selectedKeys: form2.level !== void 0 ? /* @__PURE__ */ new Set([String(form2.level)]) : /* @__PURE__ */ new Set(),
            onSelectionChange: (keys2) => {
              const key = Array.from(keys2)[0];
              patchForm({ level: key ? Number(key) : void 0 });
            },
            children: Object.keys(LogLevel).filter((k2) => !isNaN(Number(k2))).map((k2) => /* @__PURE__ */ jsxRuntimeExports.jsx(listbox_item_base_default, { children: LogLevel[Number(k2)] }, k2))
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("log.filter.logger") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("log.filter.logger"),
            size: "sm",
            value: form2.logger,
            onChange: (e2) => patchForm({ logger: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("log.filter.event") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("log.filter.event"),
            size: "sm",
            value: form2.event,
            onChange: (e2) => patchForm({ event: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 min-w-[120px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium mr-2 min-w-[60px]", children: t2("log.filter.message") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            className: "min-w-[120px]",
            placeholder: t2("log.filter.message"),
            size: "sm",
            value: form2.message,
            onChange: (e2) => patchForm({ message: e2.target.value })
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 ml-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        button_default$1,
        {
          size: "sm",
          type: "button",
          onClick: () => BApi$1.log.clearAllLog().then(() => setLogs([])),
          children: t2("log.action.clearAll")
        }
      ) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      table_default,
      {
        removeWrapper: true,
        "aria-label": "logs",
        className: "mb-4",
        selectionMode: "none",
        size: "sm",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("log.filter.time") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("log.filter.level") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("log.filter.logger") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("log.filter.event") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("log.filter.message") })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { items: logs, children: (item) => /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.dateTime ? item.dateTime.slice(5, 16) : "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              "span",
              {
                className: item.level === LogLevel.Error || item.level === LogLevel.Critical || item.level === LogLevel.Warning ? "text-red-600" : "text-blue-600",
                children: item.level === LogLevel.Information ? "Info" : LogLevel[item.level]
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.logger }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: item.event }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { className: "max-w-[300px] truncate", children: item.message && item.message.length > 60 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: "inline", children: [
              item.message.slice(0, 60),
              "...",
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                button_default$1,
                {
                  color: "primary",
                  size: "sm",
                  variant: "light",
                  onPress: () => createPortal(Modal, {
                    size: "xl",
                    title: t2("log.label.log"),
                    defaultVisible: true,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap break-all", children: item.message })
                  }),
                  children: t2("log.action.expand")
                }
              )
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "inline", children: item.message }) })
          ] }, item.id || item.dateTime + item.logger + item.event) })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      pagination_default,
      {
        page: pageable.pageIndex,
        total: pageable.totalCount,
        onChange: (page) => setForm((prev2) => ({ ...prev2, pageIndex: page }))
      }
    ) }),
    expandedMsg && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        title: t2("log.label.fullMessage"),
        onClose: () => setExpandedMsg(null),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "whitespace-pre-wrap break-all", children: expandedMsg })
      }
    )
  ] });
}
const AfterFirstPlayOperationsModal = ({ entry, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [visible, setVisible] = reactExports.useState(true);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      visible,
      footer: false,
      onClose: () => setVisible(false),
      size: "lg",
      title: t2("fileProcessor.modal.afterFirstPlayTitle"),
      style: { maxWidth: "85vw" },
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { variant: "flat", children: t2("fileProcessor.label.currentPath") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(snippet_default, { symbol: false, size: "sm", children: entry.path })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-3", style: { gridTemplateColumns: "auto auto" }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "border border-default-200 dark:border-default-100 rounded-md", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-medium", children: t2("fileProcessor.tip.moveToAnotherPath") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              FolderSelectorInner,
              {
                sources: ["media library", "custom"],
                onSelect: async (path) => {
                  await BApi$1.file.moveEntries({ destDir: path, entryPaths: [entry.path] });
                  setVisible(false);
                }
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "border border-default-200 dark:border-default-100 rounded-md", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2 font-medium", children: t2("fileProcessor.tip.orDeleteIt") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "danger",
                onPress: async () => {
                  createPortal(Modal, {
                    title: t2("common.confirm.deleteFileTitle"),
                    defaultVisible: true,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("common.confirm.deleteFile") }),
                    footer: {
                      actions: ["ok", "cancel"],
                      okProps: {
                        color: "danger"
                      }
                    },
                    onOk: async () => {
                      await BApi$1.file.removeFiles({ paths: [entry.path] });
                      setVisible(false);
                    }
                  });
                },
                children: t2("common.action.delete")
              }
            )
          ] }) })
        ] })
      ] })
    }
  );
};
AfterFirstPlayOperationsModal.displayName = "AfterFirstPlayOperationsModal";
const FileProcessorPage = () => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const optionsStore = useFileSystemOptionsStore((state) => state);
  const [rootPath, setRootPath] = reactExports.useState();
  const [rootPathInitialized, setRootPathInitialized] = reactExports.useState(false);
  const fpOptionsRef = reactExports.useRef((_a2 = optionsStore.data) == null ? void 0 : _a2.fileProcessor);
  const { createPortal } = useBakabaseContext();
  reactExports.useEffect(() => {
    var _a3;
    if (!rootPathInitialized && optionsStore.initialized) {
      const p2 = (_a3 = optionsStore.data.fileProcessor) == null ? void 0 : _a3.workingDirectory;
      if (p2) {
        setRootPath(p2);
      }
      setRootPathInitialized(true);
    }
  }, [rootPathInitialized, optionsStore.initialized]);
  reactExports.useEffect(() => {
    var _a3;
    fpOptionsRef.current = (_a3 = optionsStore.data) == null ? void 0 : _a3.fileProcessor;
  }, [optionsStore]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "file-explorer-page", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file-explorer flex flex-col gap-0", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        rootPath && /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "flat", onPress: () => {
          createPortal(DetectCompressedFilesModal, { paths: [rootPath] });
        }, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(MdUnarchive, { className: "text-lg" }),
          t2("fileProcessor.action.bulkDecompression")
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: t2("fileProcessor.tip.operationsAfterPlay"),
            placement: "bottom",
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              checkbox_default,
              {
                size: "sm",
                isSelected: (_c2 = (_b2 = optionsStore.data) == null ? void 0 : _b2.fileProcessor) == null ? void 0 : _c2.showOperationsAfterPlayingFirstFile,
                onValueChange: (v2) => {
                  var _a3, _b3, _c3;
                  BApi$1.options.patchFileSystemOptions({
                    ...optionsStore.data,
                    fileProcessor: {
                      ...(_a3 = optionsStore.data) == null ? void 0 : _a3.fileProcessor,
                      showOperationsAfterPlayingFirstFile: v2,
                      workingDirectory: ((_c3 = (_b3 = optionsStore.data) == null ? void 0 : _b3.fileProcessor) == null ? void 0 : _c3.workingDirectory) ?? ""
                    }
                  });
                },
                children: t2("fileProcessor.label.showOperationsAfterPlay")
              }
            )
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "root relative overflow-hidden min-h-0 grow", tabIndex: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-0 left-0 w-full h-full flex flex-col", children: rootPathInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(
      FileExplorer,
      {
        expandable: true,
        afterPlayedFirstFile: (entry) => {
          var _a3;
          if ((_a3 = fpOptionsRef.current) == null ? void 0 : _a3.showOperationsAfterPlayingFirstFile) {
            createPortal(AfterFirstPlayOperationsModal, {
              entry
            });
          }
        },
        capabilities: [
          "select",
          "multi-select",
          "range-select",
          "decompress",
          "wrap",
          "move",
          "extract",
          "delete",
          "rename",
          "delete-all-same-name",
          "group",
          "play-first-file",
          "create-directory"
        ],
        rootPath,
        selectable: "multiple",
        onDoubleClick: (evt, en2) => {
          if (!en2.isDirectoryOrDrive) {
            BApi$1.tool.openFile({ path: en2.path });
            return false;
          }
          return true;
        },
        onInitialized: (v2) => {
          if (v2 != void 0) {
            BApi$1.options.patchFileSystemOptions({
              fileProcessor: {
                ...fpOptionsRef.current ?? { showOperationsAfterPlayingFirstFile: false },
                workingDirectory: v2
              }
            });
            setRootPath(v2);
          }
        }
      }
    ) }) })
  ] }) });
};
FileProcessorPage.displayName = "FileProcessorPage";
const developingThirdPartyIds = [
  ThirdPartyId.Fantia,
  ThirdPartyId.Fanbox,
  ThirdPartyId.Cien,
  ThirdPartyId.Patreon
];
const isThirdPartyDeveloping = (thirdPartyId) => {
  return developingThirdPartyIds.includes(thirdPartyId);
};
const DevelopingChip = ({
  className,
  size: size2 = "sm",
  variant = "flat",
  color: color2 = "secondary",
  tooltipContent,
  showTooltip = true
}) => {
  const { t: t2 } = useTranslation();
  const defaultTooltipContent = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    t2(
      "This feature is currently in development and may not be fully functional."
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
    t2("DevelopingFeature.ExpectChanges")
  ] });
  const chip2 = /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className, color: color2, size: size2, variant, children: t2("Developing") });
  if (!showTooltip) {
    return chip2;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      delay: 2e3,
      color: "foreground",
      content: tooltipContent || defaultTooltipContent,
      placement: "top",
      children: chip2
    }
  );
};
DevelopingChip.displayName = "DevelopingChip";
const CookieValidator = ({
  cookie,
  target,
  onChange = (v2) => {
  },
  description
}) => {
  const { t: t2 } = useTranslation();
  const [status, setStatus] = reactExports.useState();
  const renderStatus = () => {
    if (!status) {
      return null;
    }
    switch (status) {
      case "loading":
        return null;
      case "failed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-base text-danger" });
      case "succeed":
        return /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base text-success" });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "cookie-validator", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        description,
        label: t2("cookieValidator.label.cookieValidator"),
        size: "sm",
        value: cookie,
        onValueChange: (v2) => {
          onChange(v2);
        }
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mt-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          isDisabled: !cookie || !cookie.length,
          isLoading: status === "loading",
          size: "sm",
          variant: "flat",
          onClick: () => {
            if (cookie && cookie.length > 0) {
              setStatus("loading");
              BApi$1.tool.validateCookie({
                target,
                cookie
              }).then((a2) => {
                if (!a2.code) {
                  setStatus("succeed");
                } else {
                  setStatus("failed");
                }
              }).catch(() => {
                setStatus("failed");
              });
            }
          },
          children: t2("common.action.validate")
        }
      ),
      renderStatus()
    ] })
  ] });
};
CookieValidator.displayName = "CookieValidator";
const DownloaderOptions = ({
  thirdPartyId,
  options,
  namingDefinition,
  onChange
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      CookieValidator,
      {
        cookie: (options == null ? void 0 : options.cookie) || "",
        description: t2("Cookie required for authentication"),
        target: thirdPartyId,
        onChange: (cookie) => {
          onChange({ cookie });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-70", size: "sm", variant: "light", children: t2("Default download path") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: options && /* @__PURE__ */ jsxRuntimeExports.jsx(
        FileSystemSelectorButton,
        {
          fileSystemSelectorProps: {
            targetType: "folder",
            onSelected: (e2) => onChange({
              defaultPath: e2.path
            }),
            defaultSelectedPath: options == null ? void 0 : options.defaultPath
          }
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { className: "opacity-70", size: "sm", variant: "light", children: t2("Default path where downloads will be saved") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isRequired: true,
        description: t2("Maximum concurrent download threads"),
        label: t2("Max concurrency"),
        max: 100,
        min: 1,
        value: (options == null ? void 0 : options.maxConcurrency) || 1,
        onValueChange: (maxConcurrency) => {
          onChange({ maxConcurrency });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        isRequired: true,
        description: t2("Request interval help"),
        label: t2("Request interval (s)"),
        max: 60,
        min: 0,
        value: (options == null ? void 0 : options.requestInterval) || 0,
        onValueChange: (requestInterval) => {
          onChange({ requestInterval });
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      textarea_default,
      {
        isRequired: true,
        description: namingDefinition ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("Define how downloaded files should be named") }),
          namingDefinition.namingFields && namingDefinition.namingFields.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs mb-1", children: [
              t2("Available fields"),
              ":"
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: namingDefinition.namingFields.map((x2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                color: "secondary",
                size: "sm",
                variant: "flat",
                onClick: () => {
                  const currentConvention = (options == null ? void 0 : options.namingConvention) || "";
                  const newConvention = currentConvention + `{${x2.name || x2.key}}`;
                  onChange({ namingConvention: newConvention });
                },
                children: x2.name || x2.key
              },
              index2
            )) })
          ] })
        ] }) : t2("Define how downloaded files should be named"),
        label: t2("Naming convention"),
        placeholder: namingDefinition == null ? void 0 : namingDefinition.defaultConvention,
        value: (options == null ? void 0 : options.namingConvention) || "",
        onValueChange: (namingConvention) => {
          onChange({ namingConvention });
        }
      }
    ) })
  ] });
};
DownloaderOptions.displayName = "DownloaderOptions";
const Pixiv = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACi1BMVEUAAAAAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oAl/oBl/oCmPoEmPoEmfoDmPoAlvoAlPoAkPoAkvoBlvoAkfoDmfoAlfohpftWuvyFzv2t3v7N6/7a8P7Z8P7J6f6l2/15yf0/sfsKm/oBk/obo/tzxvzG6P74/P/////8/v/h8/6O0f0fpPsClvoBlfotqvuh2f3z+v/1+/+24f5xxfwoqPsZovsYofslpvtAsft5yfzO6/7+///2+/+Ezv0Hl/oCmfoaofuc1/37/f/g8v5wxfwaovsAk/oDl/pTufze8f4govsClfplwfzr9//6/f+74/4JmvoBlPoCl/oOm/qx4P73/P/d8v4io/sVnvqw3/7+/v+P0P0AjvoHmvq04f7T7v4Pm/oBmPoyq/vc8f644/79/v+U0/0UnPr5/P+Z1f1KtPz0+/92x/yS0/1hvfw7rvtKtvyBzP0AjPktqfv9//8Kmfrd8f5HtPyp3P0qqfuR0f3m9f8RnvoAj/o9rvspqPtPtvzn9v9SufwsqftpwvwqpvsPnvogpPt/y/2CzP0sqPtvxPxTuPxHtPvo9v8TnvoWnvqf2P0FmfqIzv0yqvuT0/0FmvpFsvv5/f+Jzv2Q0f0Imvo4rvvs+P+85P4Fl/oDkfpjwPzA5v4Qm/rC5v5owvwJm/oBkPrI6f6a1v0JmPqe2P2Q0v2Ay/2U1P224v7n9f9JtfwDlvqd1/3R7P6m2/1ItfwElvqR0v0AivkEkvobovtBsvtkwPyW1P0Pnfonofv6/v+Oz/0do/uX1f3U7v5CsvuJz/3e8v7f8v7t+P8UoPoGmvog9p7YAAAAFHRSTlMAAQMTbcHu/gJf5J79nfpi3vy97BUqMK0AAAABYktHRDM31XxeAAAAB3RJTUUH5gsRCDsh7XT9CgAAA11JREFUSMeVlvd7FEUYx+dSuJCEQGBmsnM7m7kVjYABIe+GFoJKW0A5ZVHQ0FswwCUcxQIEbBCOJl2NhCKhCNKiQsAKUpSigAr8Oc7FhNu9vWxy7w97z7P7fub7vu/cvO8ghHxpKD0js4sfe5i/S2ZGOkrzIWm+LNQ1G3u6tyA4uyvKkoTPl5aD/bm5HRAtHjlpPh/KQt1wXm5H68csNw93k+6oO87rMJ5WlTzcHaH0HrhT67do4B7pKAPnJ/1ICHG/zMcZqKdbgBYoTP4ECFMYSZDoiXolVJQqROVcK6SUFgquBYLUUdteyOnOmMr1p3o//UzRs3369O33XHF/rgbtKn7kWJ0NEM8PHFQC0gwj9oTSwUP4ULuIHQgOE8PLRgCUj3yh+MWXRo0eM3YcmDB+wkT15WQAZfyVSSGAV1+bbHHNUlVL41NefwNCUDRVC7qB4DTtzbegAqbP4DOpwmTOlCmz+Ow5MBfmzbdoIhDUFiyESqMCFr1dFQ+ZKPq0xVACS5bqYScQFNU1YCwrj8ByUeAom7piHqyEVYI6AMrfeRfgvfkRA97niqPQCl8NRgTWaNQGMG2trGLtuvUfuAGCP/xIplYmmAP4OAKfaOqGJApSYqME6jbpxBYSiy6HzZa+JRnAxFYwKqFYYzYgrC/dtl1TkwLU+tSUm7Gj9X1rlcLqzl0BKzmg7p4rY9rjBHB4ZoB6AnsTAExJe4C1LxbSZ4lA7Es7SX8e24gvBOskoPBVMqL6Lx1l9QDC+v56CTQ4Ns4LOBA9CCEzdMii7QCHHQD5KnrEgEY42ibgBo7x47TtEBOFRU98Lf/eJ09h0h7QEP3GClBWoCgFVBfq6fLKRjhz9slxSATANM+dH96kCs75t9au3t9BxITvL+jxM5UIgGEC1J282Hyp9vIPP0oexv0kfra1DVdIv1Q3/9oIrWbWXbn6m3C0Pxdw7fqNwpu//7H31qRbtadP3BaCMIy9gMOiiqiaTEHIPDSdOd2dgLpeApeFIluUrFGsUMzdwe0Av3M3BH9eV7CXxZtxWP/rHhhw/wEmHv7+eLtn4m/zn9J/H9Y8iu+Sy122e9tAYY+bmpqqHnsIxAaKbWQF/jePgGIjyz4USYt5CcihmPLYTXmwp3x1SPlykur15z/S+USr7Zl7DAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0xMS0xN1QwODo1OTozMyswMDowMIIwbsEAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMTEtMTdUMDg6NTk6MzMrMDA6MDDzbdZ9AAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDIyLTExLTE3VDA4OjU5OjMzKzAwOjAwpHj3ogAAAABJRU5ErkJggg==";
const Bilibili = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAdVBMVEX///8AodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodYAodb///8ZuLwtAAAAJXRSTlMAAASg6qgO61/FYmMGD27H8xvP0Adtthn5+Enm50rkGLXRb8v0WPWOwgAAAAFiS0dEAIgFHUgAAAAHdElNRQfmCxIDHg0pvwEBAAAA1UlEQVQ4y7WS6w6CMAxGNxAEHYw7ykUQ6Pu/otvMkqJjYozfj6XpOdmytIR8CpVx3IPnUxTfO7qOqp5CAAAhMvxQNAIknGBlKA5nJDDVCSPMQ4YE3YteayWwmCdgSMJjJoU0g81kKSXMwgHygpRgTUm4OKuaGlJXAnFyEaeRC0OgK5H30I1Itl9o2rbRQNcroQVotaDrlYCfwr39gri2Q090b0Lf3Xot6Pq7b/5RsAxrkGulxj0OJp6OatyxfWFiUuQ2fi/sS5unau2neTHRZZ7k2v+cBx/cQTG/EQOuAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTExLTE4VDAzOjMwOjEzKzAwOjAwvZZQrAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0xMS0xOFQwMzozMDoxMyswMDowMMzL6BAAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjItMTEtMThUMDM6MzA6MTMrMDA6MDCb3snPAAAAAElFTkSuQmCC";
const SoulPlus = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAGqUExURf///+6rq9k/P9Y0NNIfH9pHR9IeHtQmJtMjI+JsbOmPj+Jvb++xsfvp6fjb2/THx/CysumQkN9fX9c5OdEXF8wAANIcHPja2tAUFON0dONzc+FpafG3t/bU1Pvs7Pzx8dUvL9UsLOmTk/K9veuZmdMhIc8QEP339/TKyu2jo+aDg+JwcN9hYdtLS+2mpvG5ufG6uuaCguyhoeygoPPExPbT0+BjY/fZ2eqXl84ICNtKSv3z891UVPni4uNxcc8PD+qYmPzy8vK+vu6srPvq6vzv7/74+NxRUc0EBOaEhM4MDOqUlOFqauFnZ9UrK9xOTt5bW/XMzPPDw9AWFtc3N/K8vP75+fTJye6oqPro6PG4uPPCwtxSUvje3tpFRf329uiNjd5YWNtMTPCzs8wBAdc1NfPFxeeIiN5cXOyiouBlZfC1te6qqtYyMvfV1dAVFeBiYvjd3eR4eNYzM/C0tNpISO+vr88NDcwCAtEYGO+urtEaGvrn5+qWls8ODtxQUNg6OuiLi80FBeeFhfTGxtUuLttNTc0HB+mRkf77+9c2NuiOjuqVleFoaARArjoAAAABYktHRACIBR1IAAAAB3RJTUUH6QYHECcy4TxtZgAAAQpJREFUGNMVzQcjAgEYBuD3umQUiT7p5DKLuEg4JEdCUcloyIpKdrZkRcj8z3j+wAMwMhkrL1GUlpVXsEoVUFmlrtbU1GqJ6nRE9XpwDYyhkTc2Nbe0oq2dTDB3dFq6ugXOaOV7emEj9Nn78W9gUBwaHnGoMUrkHJPGJ1yTvBtT08CMx+ueJY15zufwB+ZdQHBhcUlLyyEeYjgSXYnBHDOtrhEJzvUNSb8Z3wK2rQmiqJ2NQ5EMUQph1U6advdo/wDsoUhH8B4jSLHMyenZuSF9cSnh6jqQvcmRz0W3d3TPPeAxSZR/omddgQovkcwr3op/hcWTlRIJmZyK7/iwfQa+vn+UQpFBLuXHL9oqOFMpSC1gAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTA2LTA3VDE2OjM5OjUwKzAwOjAwN80fUAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0wNi0wN1QxNjozOTo1MCswMDowMEaQp+wAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjUtMDYtMDdUMTY6Mzk6NTArMDA6MDARhYYzAAAAAElFTkSuQmCC";
const NameIcon = {
  [ThirdPartyId.ExHentai]: ExHentai,
  [ThirdPartyId.Pixiv]: Pixiv,
  [ThirdPartyId.Bilibili]: Bilibili,
  [ThirdPartyId.SoulPlus]: SoulPlus
};
const ThirdPartyIcon = ({ thirdPartyId, size: size2 }) => {
  const { t: t2 } = useTranslation();
  let sizeValue = 18;
  if (size2) {
    switch (size2) {
      case "sm":
        sizeValue = 18;
        break;
      case "md":
        sizeValue = 24;
        break;
      case "lg":
        sizeValue = 32;
        break;
    }
  }
  const style2 = {
    width: sizeValue,
    height: sizeValue,
    maxWidth: sizeValue,
    maxHeight: sizeValue
  };
  const img = NameIcon[thirdPartyId];
  if (!img) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { style: style2 });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    "img",
    {
      alt: t2(`ThirdPartyId.${ThirdPartyId[thirdPartyId]}`),
      src: img,
      style: style2
    }
  );
};
ThirdPartyIcon.displayName = "ThirdPartyIcon";
const ConfigurationsModal = ({ onSubmitted, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [thirdPartyGroups, setThirdPartyGroups] = reactExports.useState({});
  const [downloaderOptions, setDownloaderOptions] = reactExports.useState({});
  const [tmpOptions, setTmpOptions] = reactExports.useState({});
  const [allNamingDefinitions, setAllNamingDefinitions] = reactExports.useState({});
  const [selectedTab, setSelectedTab] = reactExports.useState("");
  const loadOptionsForThirdParty = async (thirdPartyId) => {
    try {
      const definitions = thirdPartyGroups[thirdPartyId];
      if (!definitions || definitions.length === 0) {
        return;
      }
      const firstDefinition = definitions[0];
      const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
        thirdPartyId,
        { taskType: firstDefinition.taskType }
      );
      if (optionsRes.data) {
        setDownloaderOptions((prev2) => ({
          ...prev2,
          [thirdPartyId]: optionsRes.data
        }));
      }
    } catch (error2) {
      console.error(
        `Failed to reload options for third party ${thirdPartyId}:`,
        error2
      );
    }
  };
  reactExports.useEffect(() => {
    const loadData = async () => {
      try {
        const definitionsRes = await BApi$1.downloadTask.getAllDownloaderDefinitions();
        const definitions = definitionsRes.data || [];
        const groups = {};
        const namingMap = {};
        definitions.forEach((def) => {
          var _a2;
          if (!groups[def.thirdPartyId]) {
            groups[def.thirdPartyId] = [];
          }
          groups[_a2 = def.thirdPartyId] ?? (groups[_a2] = []);
          groups[def.thirdPartyId].push(def);
          if (!namingMap[def.thirdPartyId]) {
            namingMap[def.thirdPartyId] = def;
          }
        });
        setThirdPartyGroups(groups);
        setAllNamingDefinitions(namingMap);
        const thirdPartyIds = Object.keys(groups).map(
          (id2) => parseInt(id2, 10)
        );
        if (thirdPartyIds.length > 0 && !selectedTab) {
          setSelectedTab(thirdPartyIds[0]);
        }
        const optionsPromises = thirdPartyIds.map(async (thirdPartyId) => {
          var _a2;
          try {
            const firstDefinition = (_a2 = groups[thirdPartyId]) == null ? void 0 : _a2[0];
            if (!firstDefinition) {
              return null;
            }
            const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
              thirdPartyId,
              { taskType: firstDefinition.taskType }
            );
            return {
              thirdPartyId,
              options: optionsRes.data
            };
          } catch (error2) {
            console.error(
              `Failed to load options for third party ${thirdPartyId}:`,
              error2
            );
            return null;
          }
        });
        const optionsResults = await Promise.all(optionsPromises);
        const optionsMap = {};
        optionsResults.forEach((result) => {
          if (result && result.options) {
            optionsMap[result.thirdPartyId] = result.options;
          }
        });
        setDownloaderOptions(optionsMap);
      } catch (error2) {
        console.error("Failed to load downloader data:", error2);
      }
    };
    loadData();
  }, []);
  const handleSubmit = async () => {
    try {
      const updatePromises = Object.entries(tmpOptions).filter(([, options]) => options && Object.keys(options).length > 0).map(async ([thirdPartyIdStr, patchOptions]) => {
        var _a2;
        const thirdPartyId = parseInt(thirdPartyIdStr, 10);
        const firstDefinition = (_a2 = thirdPartyGroups[thirdPartyId]) == null ? void 0 : _a2[0];
        if (!firstDefinition) {
          return;
        }
        const currentOptions = downloaderOptions[thirdPartyId];
        const updatedOptions = {
          ...currentOptions,
          ...patchOptions
        };
        return BApi$1.downloadTask.putDownloaderOptions(
          thirdPartyId,
          updatedOptions,
          { taskType: firstDefinition.taskType }
        );
      });
      await Promise.all(updatePromises);
      onSubmitted == null ? void 0 : onSubmitted();
    } catch (error2) {
      console.error("Failed to save downloader options:", error2);
    }
  };
  const handleTabChange = async (tabKey) => {
    const thirdPartyId = parseInt(tabKey, 10);
    setSelectedTab(thirdPartyId);
    await loadOptionsForThirdParty(thirdPartyId);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "5xl",
      title: t2("downloader.modal.configurations"),
      onDestroyed,
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tabs,
        {
          isVertical: true,
          disableAnimation: true,
          selectedKey: selectedTab == null ? void 0 : selectedTab.toString(),
          onSelectionChange: (key) => handleTabChange(key),
          classNames: {
            tab: "justify-start"
          },
          children: Object.entries(thirdPartyGroups).map(([thirdPartyIdStr]) => {
            const thirdPartyId = parseInt(thirdPartyIdStr, 10);
            const options = downloaderOptions[thirdPartyId];
            const mergedOptions = { ...options, ...tmpOptions[thirdPartyId] };
            const isDeveloping = isThirdPartyDeveloping(thirdPartyId);
            const thirdPartyName = ThirdPartyId[thirdPartyId] || `Third Party ${thirdPartyId}`;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tab,
              {
                title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 justify-start", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId }),
                  t2(thirdPartyName),
                  isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { size: "sm" })
                ] }),
                children: options && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DownloaderOptions,
                  {
                    namingDefinition: allNamingDefinitions[thirdPartyId],
                    options: mergedOptions,
                    thirdPartyId,
                    onChange: (patchOptions) => {
                      setTmpOptions({
                        ...tmpOptions,
                        [thirdPartyId]: {
                          ...tmpOptions[thirdPartyId],
                          ...patchOptions
                        }
                      });
                    }
                  }
                )
              },
              thirdPartyId
            );
          })
        }
      )
    }
  );
};
Chart$1.register(
  CategoryScale,
  LinearScale,
  BarElement,
  plugin_title,
  plugin_tooltip,
  plugin_legend
);
const RequestStatistics = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const requestStatistics = useThirdPartyRequestStatisticsStore(
    (state) => state.statistics
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      size: "sm",
      variant: "light",
      onPress: () => {
        const thirdPartyRequestCounts = (requestStatistics || []).reduce((s2, t22) => {
          Object.keys(t22.counts || {}).forEach((r2) => {
            var _a2;
            const resultTypeValue = parseInt(
              r2,
              10
            );
            s2.push({
              id: t22.id.toString(),
              name: ThirdPartyId[t22.id],
              result: resultTypeValue,
              // Use numeric value directly
              count: (_a2 = t22.counts) == null ? void 0 : _a2[r2]
            });
          });
          return s2;
        }, []);
        createPortal(Modal, {
          size: "xl",
          defaultVisible: true,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(BizChartsChart, { data: thirdPartyRequestCounts }),
          footer: {
            actions: ["ok"]
          },
          title: t2("downloader.label.requestsOverview")
        });
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineBarChart, { className: "text-base" }),
        t2("downloader.label.requestsOverview"),
        requestStatistics == null ? void 0 : requestStatistics.map((rs) => {
          let successCount = 0;
          let failureCount = 0;
          Object.keys(rs.counts || {}).forEach((r2) => {
            const rt = parseInt(r2, 10);
            switch (rt) {
              case ThirdPartyRequestResultType.Succeed:
                successCount += rs.counts[r2];
                break;
              default:
                failureCount += rs.counts[r2];
                break;
            }
          });
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { size: "sm", thirdPartyId: rs.id }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("downloader.label.success"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "p-0",
                color: "success",
                size: "sm",
                variant: "light",
                children: successCount
              }
            ) }),
            "/",
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("downloader.label.failure"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                className: "p-0",
                color: "danger",
                size: "sm",
                variant: "light",
                children: failureCount
              }
            ) })
          ] });
        })
      ] })
    }
  ) });
};
RequestStatistics.displayName = "RequestStatistics";
const BizChartsChart = ({
  data,
  height = 300
}) => {
  const { t: t2 } = useTranslation();
  const { isDarkMode } = useBakabaseContext();
  const getCssVariable = (variableName) => {
    if (typeof document === "undefined") {
      return "";
    }
    return getComputedStyle(document.documentElement).getPropertyValue(
      variableName
    );
  };
  const getRequestResultTypeColorMap = () => {
    const successColor = getCssVariable("--theme-color-success") || "#46bc15";
    const dangerColor = getCssVariable("--theme-text-error") || "#ff3000";
    const warningColor = getCssVariable("--theme-color-warning") || "#ff9300";
    const subtleColor2 = getCssVariable("--theme-text-subtle") || "#666";
    const bannedColor = "#993300";
    return {
      [ThirdPartyRequestResultType.Succeed]: successColor,
      [ThirdPartyRequestResultType.Failed]: dangerColor,
      [ThirdPartyRequestResultType.Banned]: bannedColor,
      [ThirdPartyRequestResultType.Canceled]: subtleColor2,
      [ThirdPartyRequestResultType.TimedOut]: warningColor
    };
  };
  if (!Array.isArray(data) || data.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center py-4 text-gray-500", children: t2("common.state.noData") });
  }
  const groupedData = data.reduce(
    (acc, item) => {
      if (!acc[item.id]) {
        acc[item.id] = {};
      }
      acc[item.id][item.result] = item.count;
      return acc;
    },
    {}
  );
  const thirdParties = Object.keys(groupedData);
  const resultTypes = Object.values(ThirdPartyRequestResultType).filter(
    (value2) => typeof value2 === "number"
  );
  const colorMap = getRequestResultTypeColorMap();
  const chartData = {
    labels: thirdParties.map(
      (id2) => ThirdPartyId[id2]
    ),
    datasets: resultTypes.map((resultType) => ({
      label: t2(ThirdPartyRequestResultType[resultType]),
      data: thirdParties.map((id2) => groupedData[id2][resultType] || 0),
      backgroundColor: colorMap[resultType],
      borderColor: colorMap[resultType],
      borderWidth: 1
    }))
  };
  const textColor = getCssVariable("--theme-text") || (isDarkMode ? "#e6e6e6" : "#000");
  const subtleColor = getCssVariable("--theme-text-subtle") || (isDarkMode ? "#c0c0c0" : "#666");
  const borderColor = getCssVariable("--theme-border-color") || (isDarkMode ? "rgb(48, 54, 61)" : "#f0f0f0");
  const tooltipBg = isDarkMode ? "rgba(0,0,0,0.9)" : "rgba(0,0,0,0.8)";
  const options = {
    responsive: true,
    maintainAspectRatio: false,
    plugins: {
      legend: {
        position: "top",
        labels: {
          color: textColor
        }
      },
      tooltip: {
        backgroundColor: tooltipBg,
        titleColor: "#fff",
        bodyColor: "#fff",
        borderColor: "rgba(0, 0, 0, 0.2)",
        borderWidth: 1
      }
    },
    scales: {
      x: {
        stacked: true,
        grid: {
          display: false
        },
        ticks: {
          color: subtleColor
        }
      },
      y: {
        stacked: true,
        beginAtZero: true,
        grid: {
          color: borderColor
        },
        ticks: {
          color: subtleColor
        }
      }
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data: chartData, options }) });
};
const NavigateButton = ({
  to: to2,
  children,
  confirmMessage,
  size: size2 = "sm",
  color: color2 = "primary",
  variant = "light",
  className
}) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      className,
      color: color2,
      size: size2,
      variant,
      onPress: () => {
        const modal2 = createPortal(Modal, {
          defaultVisible: true,
          title: t2("common.confirm.navigateAway"),
          children: confirmMessage ?? t2("common.confirm.navigateAwayMessage"),
          footer: {
            actions: ["cancel", "ok"]
          },
          onOk: () => {
            modal2.destroy();
            navigate(to2);
          }
        });
      },
      children
    }
  );
};
NavigateButton.displayName = "NavigateButton";
const DownloadTaskTypeIconMap = {
  [ThirdPartyId.Bilibili]: {
    [BilibiliDownloadTaskType.Favorites]: AiOutlineStar
  },
  [ThirdPartyId.ExHentai]: {
    [ExHentaiDownloadTaskType.List]: AiOutlineUnorderedList,
    [ExHentaiDownloadTaskType.Watched]: AiOutlineStar,
    [ExHentaiDownloadTaskType.SingleWork]: FaImages
  },
  [ThirdPartyId.Pixiv]: {
    [PixivDownloadTaskType.Following]: AiOutlineStar,
    [PixivDownloadTaskType.Ranking]: FaRankingStar,
    [PixivDownloadTaskType.Search]: AiOutlineSearch
  }
};
var DownloadTaskFieldType = /* @__PURE__ */ ((DownloadTaskFieldType2) => {
  DownloadTaskFieldType2[DownloadTaskFieldType2["BilibiliFavorites"] = 1] = "BilibiliFavorites";
  DownloadTaskFieldType2[DownloadTaskFieldType2["PageRange"] = 2] = "PageRange";
  DownloadTaskFieldType2[DownloadTaskFieldType2["FfMpegRequired"] = 3] = "FfMpegRequired";
  DownloadTaskFieldType2[DownloadTaskFieldType2["LuxRequired"] = 4] = "LuxRequired";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Key"] = 5] = "Key";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Keys"] = 6] = "Keys";
  DownloadTaskFieldType2[DownloadTaskFieldType2["DownloadPath"] = 7] = "DownloadPath";
  DownloadTaskFieldType2[DownloadTaskFieldType2["CheckInterval"] = 8] = "CheckInterval";
  DownloadTaskFieldType2[DownloadTaskFieldType2["Checkpoint"] = 9] = "Checkpoint";
  DownloadTaskFieldType2[DownloadTaskFieldType2["AutoRetry"] = 10] = "AutoRetry";
  DownloadTaskFieldType2[DownloadTaskFieldType2["AllowDuplicate"] = 11] = "AllowDuplicate";
  DownloadTaskFieldType2[DownloadTaskFieldType2["PreferTorrent"] = 12] = "PreferTorrent";
  return DownloadTaskFieldType2;
})(DownloadTaskFieldType || {});
const DownloadTaskFieldMap = {
  [ThirdPartyId.Bilibili]: {
    [BilibiliDownloadTaskType.Favorites]: [
      {
        type: 3
        /* FfMpegRequired */
      },
      {
        type: 4
        /* LuxRequired */
      },
      {
        type: 1
        /* BilibiliFavorites */
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  },
  [ThirdPartyId.ExHentai]: {
    [ExHentaiDownloadTaskType.List]: [
      {
        type: 6,
        placeholder: `https://exhentai.org/g/xxxxx/xxxxx/
https://exhentai.org/g/xxxxx/xxxxx/
...`,
        label: "Urls"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 12
        /* PreferTorrent */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [ExHentaiDownloadTaskType.Watched]: [
      {
        type: 5,
        defaultValue: "https://exhentai.org/watched",
        label: "Watch url"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 12
        /* PreferTorrent */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [ExHentaiDownloadTaskType.SingleWork]: [
      {
        type: 6,
        placeholder: `https://exhentai.org/g/xxxxx/xxxxx/`,
        label: "Url"
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 12
        /* PreferTorrent */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  },
  [ThirdPartyId.Pixiv]: {
    [PixivDownloadTaskType.Following]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/bookmark_new_illust.php
https://www.pixiv.net/bookmark_new_illust_r18.php
https://www.pixiv.net/bookmark_new_illust_r18.php?p=3`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [PixivDownloadTaskType.Ranking]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/ranking.php
https://www.pixiv.net/ranking.php?mode=daily_r18`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ],
    [PixivDownloadTaskType.Search]: [
      {
        type: 6,
        label: "Urls",
        placeholder: `https://www.pixiv.net/tags/azurlane
https://www.pixiv.net/tags/azurlane/top
https://www.pixiv.net/tags/azurlane/illustrations
https://www.pixiv.net/tags/azurlane/manga
https://www.pixiv.net/tags/azurlane/artworks?order=popular_male_d&mode=safe`
      },
      {
        type: 7
        /* DownloadPath */
      },
      {
        type: 8
        /* CheckInterval */
      },
      {
        type: 2
        /* PageRange */
      },
      {
        type: 9
        /* Checkpoint */
      },
      {
        type: 10
        /* AutoRetry */
      },
      {
        type: 11
        /* AllowDuplicate */
      }
    ]
  }
};
var DependentComponentIds = /* @__PURE__ */ ((DependentComponentIds2) => {
  DependentComponentIds2["FFMpeg"] = "364e3884-4c6f-446f-b72c-1ec84e8da2c2";
  DependentComponentIds2["Lux"] = "6cb4ac7f-f60d-45c9-86bc-a48918623654";
  DependentComponentIds2["BakabaseUpdater"] = "274f8ab5-a0a6-4415-8466-137d986d3ddb";
  return DependentComponentIds2;
})(DependentComponentIds || {});
function LuxRequired() {
  const { t: t2 } = useTranslation();
  const dependentComponentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const luxState = dependentComponentContexts == null ? void 0 : dependentComponentContexts.find(
    (d2) => d2.id === DependentComponentIds.Lux
  );
  const isLuxMissing = (luxState == null ? void 0 : luxState.status) !== DependentComponentStatus.Installed;
  if (!isLuxMissing) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    alert_default,
    {
      color: "danger",
      title: t2(
        "This function is not working because Lux is not found, check it in system configurations"
      )
    }
  );
}
function FfMpegRequired() {
  const { t: t2 } = useTranslation();
  const dependentComponentContexts = useDependentComponentContextsStore(
    (state) => state.contexts
  );
  const ffmpegState = dependentComponentContexts == null ? void 0 : dependentComponentContexts.find(
    (d2) => d2.id === DependentComponentIds.FFMpeg
  );
  const isFfmpegMissing = (ffmpegState == null ? void 0 : ffmpegState.status) !== DependentComponentStatus.Installed;
  if (!isFfmpegMissing) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    alert_default,
    {
      color: "danger",
      title: t2(
        "This function is not working because FFmpeg is not found, check it in system configurations"
      )
    }
  );
}
const PageRange = ({ start, end, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2(
            "Set a page range if you don't want to download them all."
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("The minimal page number is 1.") })
        ] }),
        label: t2("Start page"),
        min: 1,
        size: "sm",
        step: 1,
        value: start,
        onValueChange: (v2) => {
          onChange == null ? void 0 : onChange(v2, end);
        }
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        description: t2(
          "Set a page range if you don't want to download them all."
        ),
        label: t2("End page"),
        min: end ?? 1,
        size: "sm",
        step: 1,
        value: end,
        onValueChange: (v2) => {
          onChange == null ? void 0 : onChange(start, v2);
        }
      }
    )
  ] }) });
};
const BilibiliFavoritesSelector = ({ isDisabled, value: value2, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [loadingFavorites, setLoadingFavorites] = reactExports.useState(false);
  const [favorites, setFavorites] = reactExports.useState([]);
  reactExports.useEffect(() => {
    loadFavorites();
  }, []);
  const loadFavorites = async () => {
    setLoadingFavorites(true);
    try {
      const r2 = await BApi$1.bilibili.getBiliBiliFavorites();
      if (!r2.code) {
        setFavorites(r2.data || []);
      }
    } finally {
      setLoadingFavorites(false);
    }
  };
  const renderFavorites = () => {
    if (loadingFavorites) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" });
    }
    if (favorites.length === 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        t2(
          "Unable to retrieve Bilibili favorites. Please ensure your cookie is correctly set and that you have at least one favorite created."
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          button_default$1,
          {
            color: "primary",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(ConfigurationsModal, {
                onSubmitted: async () => {
                  await loadFavorites();
                }
              });
            },
            children: t2("Setup now")
          }
        )
      ] });
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      radio_group_default,
      {
        isDisabled,
        label: t2("Select favorites"),
        orientation: "horizontal",
        size: "sm",
        value: value2 == null ? void 0 : value2.toString(),
        onValueChange: (value22) => {
          onChange == null ? void 0 : onChange(parseInt(value22, 10));
        },
        children: favorites.map((f2) => {
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(radio_default, { value: f2.id.toString(), children: [
            f2.title,
            "(",
            f2.mediaCount,
            ")"
          ] }, f2.id);
        })
      }
    );
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(chip_default, { radius: "sm", children: t2("Select favorites") }),
    renderFavorites()
  ] });
};
const DownloadPathSelector = ({ downloadPath, onChange }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { radius: "sm", variant: "flat", children: t2("Download path") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        color: "primary",
        size: "sm",
        variant: "light",
        onPress: () => {
          createPortal(FileSystemSelectorModal, {
            onSelected: (e2) => {
              onChange == null ? void 0 : onChange(e2.path);
            },
            targetType: "folder",
            startPath: downloadPath,
            defaultSelectedPath: downloadPath
          });
        },
        children: downloadPath ?? t2("Select download path")
      }
    ) })
  ] });
};
const DownloadPathSelectorField = ({ downloadPath, onChange }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(DownloadPathSelector, { downloadPath, onChange });
};
DownloadPathSelectorField.displayName = "DownloadPathSelectorField";
const IntervalField = ({ interval, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    number_input_default,
    {
      description: t2("downloader.tip.checkIntervalDesc"),
      label: t2("downloader.label.checkInterval"),
      value: interval,
      onValueChange: (value2) => onChange(value2)
    }
  );
};
IntervalField.displayName = "IntervalField";
const CheckpointField = ({ checkpoint, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    textarea_default,
    {
      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.tip.checkpointManual") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.tip.checkpointAuto") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.tip.checkpointFormat") })
      ] }),
      label: t2("common.label.checkpoint"),
      size: "sm",
      value: checkpoint,
      onValueChange: onChange
    }
  );
};
CheckpointField.displayName = "CheckpointField";
const AutoRetryField = ({ autoRetry, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    checkbox_group_default,
    {
      description: t2("downloader.tip.autoRetryDesc"),
      label: t2("downloader.label.autoRetry"),
      orientation: "horizontal",
      size: "sm",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { defaultSelected: true, isSelected: autoRetry, onValueChange: onChange, children: t2("common.label.yes") })
    }
  );
};
AutoRetryField.displayName = "AutoRetryField";
const AllowDuplicateField = ({ isDuplicateAllowed, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    checkbox_group_default,
    {
      description: t2("downloader.tip.allowDuplicateDesc"),
      label: t2("downloader.label.allowDuplicate"),
      orientation: "horizontal",
      size: "sm",
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { isSelected: isDuplicateAllowed, onValueChange: onChange, children: t2("common.label.yes") })
    }
  );
};
AllowDuplicateField.displayName = "AllowDuplicateField";
const PreferTorrentField = ({ preferTorrent, onChange }) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    checkbox_group_default,
    {
      description: t2("downloader.tip.preferTorrentDesc"),
      label: t2("downloader.label.preferTorrent"),
      orientation: "horizontal",
      size: "sm",
      value: preferTorrent ? ["yes"] : [],
      onValueChange: (v2) => onChange(v2.includes("yes")),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(checkbox_default, { value: "yes", children: t2("common.label.yes") })
    }
  );
};
PreferTorrentField.displayName = "PreferTorrentField";
const DownloadTaskDetailModal = ({ onDestroyed, id: id2 }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const isAdding = !(id2 && id2 > 0);
  const [form2, setForm] = reactExports.useState({ autoRetry: true });
  const [taskDefinitions, setTaskDefinitions] = reactExports.useState([]);
  const [downloaderOptions, setDownloaderOptions] = reactExports.useState(
    null
  );
  const init2 = async () => {
    if (!isAdding) {
      const task = (await BApi$1.downloadTask.getDownloadTask(id2)).data;
      const form22 = {
        ...task,
        keys: [task.key],
        names: task.name === void 0 ? [] : [task.name]
      };
      setForm(form22);
    }
    const taskDefinitionsResponse = await BApi$1.downloadTask.getAllDownloaderDefinitions();
    setTaskDefinitions(taskDefinitionsResponse.data || []);
  };
  reactExports.useEffect(() => {
    init2();
  }, []);
  reactExports.useEffect(() => {
    const loadDownloaderOptions = async () => {
      if (form2.thirdPartyId && form2.type) {
        try {
          const optionsRes = await BApi$1.downloadTask.getDownloaderOptions(
            form2.thirdPartyId,
            { taskType: form2.type }
          );
          const options = optionsRes.data;
          setDownloaderOptions(options || null);
          if ((options == null ? void 0 : options.defaultPath) && !form2.downloadPath) {
            setForm((prev2) => ({
              ...prev2,
              downloadPath: options.defaultPath
            }));
          }
        } catch (error2) {
          console.error("Failed to load downloader options:", error2);
          setDownloaderOptions(null);
        }
      } else {
        setDownloaderOptions(null);
      }
    };
    loadDownloaderOptions();
  }, [form2.thirdPartyId, form2.type]);
  const availableThirdParties = React$6.useMemo(() => {
    const uniqueThirdParties = /* @__PURE__ */ new Map();
    taskDefinitions.forEach((def) => {
      if (!uniqueThirdParties.has(def.thirdPartyId)) {
        const thirdPartyName = ThirdPartyId[def.thirdPartyId] || def.name;
        uniqueThirdParties.set(def.thirdPartyId, thirdPartyName);
      }
    });
    return Array.from(uniqueThirdParties.entries()).map(([id22, name2]) => ({
      id: id22,
      name: name2
    })).sort((a2, b2) => a2.id - b2.id);
  }, [taskDefinitions]);
  const availableTaskTypes = React$6.useMemo(() => {
    if (!form2.thirdPartyId)
      return [];
    return taskDefinitions.filter((def) => def.thirdPartyId === form2.thirdPartyId).map((def) => ({
      value: def.taskType,
      label: def.name,
      description: def.description
    }));
  }, [taskDefinitions, form2.thirdPartyId]);
  const validateForm = (form22) => {
    if (form22.thirdPartyId && form22.downloadPath && form22.keys && form22.keys.length > 0 && form22.type) {
      return true;
    }
    return false;
  };
  const renderFields = () => {
    var _a2;
    if (form2.thirdPartyId && form2.type) {
      const fields = ((_a2 = DownloadTaskFieldMap[form2.thirdPartyId]) == null ? void 0 : _a2[form2.type]) ?? [];
      return fields.map((f2) => {
        var _a3, _b2, _c2;
        switch (f2.type) {
          case DownloadTaskFieldType.Key:
            if (!form2.keys || !form2.keys.length) {
              if (f2.defaultValue) {
                form2.keys = [f2.defaultValue];
              }
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              input_default,
              {
                defaultValue: f2.defaultValue,
                label: f2.label && t2(f2.label),
                placeholder: f2.placeholder,
                size: "sm",
                value: (_a3 = form2.keys) == null ? void 0 : _a3[0],
                onValueChange: (v2) => {
                  setForm({
                    ...form2,
                    keys: [v2]
                  });
                }
              }
            );
          case DownloadTaskFieldType.Keys:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              textarea_default,
              {
                label: f2.label && t2(f2.label),
                placeholder: f2.placeholder,
                size: "sm",
                value: (_b2 = form2.keys) == null ? void 0 : _b2.join("\n"),
                onValueChange: (v2) => {
                  setForm({
                    ...form2,
                    keys: v2.split("\n").map((k2) => k2.trim()).filter((k2) => k2)
                  });
                }
              }
            );
          case DownloadTaskFieldType.BilibiliFavorites:
            const key = (_c2 = form2.keys) == null ? void 0 : _c2[0];
            const numberKey = key ? parseInt(key, 10) : void 0;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              BilibiliFavoritesSelector,
              {
                isDisabled: !isAdding,
                value: numberKey,
                onChange: (v2) => setForm({
                  ...form2,
                  keys: [v2.toString()]
                })
              }
            );
          case DownloadTaskFieldType.PageRange:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              PageRange,
              {
                end: form2.endPage,
                start: form2.startPage,
                onChange: (start, end) => setForm({
                  ...form2,
                  startPage: start,
                  endPage: end
                })
              }
            );
          case DownloadTaskFieldType.FfMpegRequired:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(FfMpegRequired, {});
          case DownloadTaskFieldType.LuxRequired:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(LuxRequired, {});
          case DownloadTaskFieldType.DownloadPath:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              DownloadPathSelectorField,
              {
                downloadPath: form2.downloadPath,
                onChange: (downloadPath) => {
                  setForm({
                    ...form2,
                    downloadPath
                  });
                }
              }
            );
          case DownloadTaskFieldType.CheckInterval:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              IntervalField,
              {
                interval: form2.interval,
                onChange: (interval) => {
                  setForm({
                    ...form2,
                    interval
                  });
                }
              }
            );
          case DownloadTaskFieldType.Checkpoint:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              CheckpointField,
              {
                checkpoint: form2.checkpoint,
                onChange: (checkpoint) => {
                  setForm({
                    ...form2,
                    checkpoint
                  });
                }
              }
            );
          case DownloadTaskFieldType.AutoRetry:
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              AutoRetryField,
              {
                autoRetry: form2.autoRetry,
                onChange: (autoRetry) => {
                  setForm({
                    ...form2,
                    autoRetry
                  });
                }
              }
            );
          case DownloadTaskFieldType.AllowDuplicate:
            return isAdding ? /* @__PURE__ */ jsxRuntimeExports.jsx(
              AllowDuplicateField,
              {
                isDuplicateAllowed: form2.isDuplicateAllowed,
                onChange: (isDuplicateAllowed) => {
                  setForm({
                    ...form2,
                    isDuplicateAllowed
                  });
                }
              }
            ) : null;
          case DownloadTaskFieldType.PreferTorrent: {
            const parsedOptions = form2.options ? JSON.parse(form2.options) : {};
            if (parsedOptions.preferTorrent === void 0) {
              parsedOptions.preferTorrent = true;
              form2.options = JSON.stringify(parsedOptions);
            }
            const preferTorrent = parsedOptions.preferTorrent;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              PreferTorrentField,
              {
                preferTorrent,
                onChange: (value2) => {
                  const newOptions = { ...parsedOptions, preferTorrent: value2 };
                  setForm({
                    ...form2,
                    options: JSON.stringify(newOptions)
                  });
                }
              }
            );
          }
        }
      });
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["ok", "cancel"],
        okProps: {
          isDisabled: !validateForm(form2)
        }
      },
      size: "xl",
      title: isAdding ? t2("downloader.modal.creatingTask") : t2("downloader.modal.taskDetail"),
      onDestroyed,
      onOk: async () => {
        const validForm = form2;
        console.log(form2, validForm);
        if (isAdding) {
          const r2 = await BApi$1.downloadTask.addDownloadTask(validForm);
          if (r2.code) {
            throw new Error(r2.message);
          }
        } else {
          const r2 = await BApi$1.downloadTask.putDownloadTask(id2, validForm);
          if (r2.code) {
            throw new Error(r2.message);
          }
        }
      },
      children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "grid gap-2 items-center",
            style: { gridTemplateColumns: "auto 1fr" },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.label.site") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: availableThirdParties.map((thirdParty) => {
                const isSelected = form2.thirdPartyId === thirdParty.id;
                const isDeveloping = isThirdPartyDeveloping(thirdParty.id);
                return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                  Button,
                  {
                    color: isSelected ? "primary" : void 0,
                    isDisabled: !isAdding,
                    onPress: () => {
                      if (form2.thirdPartyId !== thirdParty.id) {
                        setForm({
                          thirdPartyId: thirdParty.id,
                          type: void 0
                          // Reset task type when changing third party
                        });
                      }
                    },
                    children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: thirdParty.id }),
                      t2(thirdParty.name),
                      isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { size: "sm" })
                    ]
                  }
                );
              }) }) }),
              form2.thirdPartyId && (availableTaskTypes.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.label.taskType") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: availableTaskTypes.map((taskType) => {
                  var _a2;
                  const isSelected = form2.type === taskType.value;
                  const Icon2 = (_a2 = DownloadTaskTypeIconMap[form2.thirdPartyId]) == null ? void 0 : _a2[taskType.value];
                  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
                    Button,
                    {
                      color: isSelected ? "primary" : void 0,
                      isDisabled: !isAdding,
                      title: taskType.description,
                      onPress: () => {
                        if (!isSelected) {
                          setForm({
                            ...form2,
                            type: taskType.value,
                            keys: void 0
                          });
                        }
                      },
                      children: [
                        Icon2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base" }),
                        t2(taskType.label)
                      ]
                    },
                    taskType.value
                  );
                }) }) })
              ] }) : t2("downloader.status.notAvailable"))
            ]
          }
        ),
        form2.thirdPartyId === ThirdPartyId.ExHentai && /* @__PURE__ */ jsxRuntimeExports.jsx(
          alert_default,
          {
            color: "primary",
            variant: "flat",
            description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 flex-wrap", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("downloader.tip.exHentaiUserscript") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(NavigateButton, { to: "/third-party-integration", children: t2("downloader.tip.goToThirdPartyIntegration") })
            ] })
          }
        ),
        form2.thirdPartyId && form2.type && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2", children: renderFields() })
      ]
    }
  ) });
};
const DownloaderPage = () => {
  const { t: t2 } = useTranslation();
  const forceUpdate = useUpdate();
  const [form2, setForm] = reactExports.useState({});
  const [downloaderDefinitions, setDownloaderDefinitions] = reactExports.useState([]);
  const tasks = useDownloadTasksStore((state) => state.tasks);
  const sortedThirdPartyIds = reactExports.useMemo(() => {
    const uniqueThirdParties = /* @__PURE__ */ new Map();
    downloaderDefinitions.forEach((def) => {
      if (!uniqueThirdParties.has(def.thirdPartyId)) {
        const thirdPartyName = ThirdPartyId[def.thirdPartyId] || def.name;
        uniqueThirdParties.set(def.thirdPartyId, thirdPartyName);
      }
    });
    return Array.from(uniqueThirdParties.entries()).map(([value2, label]) => ({ value: value2, label })).sort((a2, b2) => a2.value - b2.value);
  }, [downloaderDefinitions]);
  const [selectedTaskIds, setSelectedTaskIds] = reactExports.useState([]);
  const selectedTaskIdsRef = reactExports.useRef(selectedTaskIds);
  const selectionModeRef = reactExports.useRef(
    0
    /* Default */
  );
  const tasksRef = reactExports.useRef(tasks);
  const [menuProps, toggleMenu] = useMenuState();
  const { createPortal } = useBakabaseContext();
  const [taskListHeight, setTaskListHeight] = reactExports.useState(0);
  useTraceUpdate(
    {
      form: form2,
      tasks,
      selectedTaskIds,
      menuProps
    },
    "DownloaderPage"
  );
  log$3("Rendering");
  const startTasksManually = async (ids2, actionOnConflict = DownloadTaskActionOnConflict.NotSet) => {
    const rsp = await BApi$1.downloadTask.startDownloadTasks(
      {
        ids: ids2,
        actionOnConflict
      },
      {
        showErrorToast: (r2) => (r2.code >= 404 || r2.code < 200) && r2.code != ResponseCode.Conflict
      }
    );
    if (rsp.code == ResponseCode.Conflict) {
      createPortal(Modal, {
        defaultVisible: true,
        size: "lg",
        title: t2("downloader.confirm.conflictedTasks"),
        children: rsp.message,
        footer: {
          actions: ["ok", "cancel"],
          okProps: {
            children: t2("downloader.action.downloadSelectedFirst")
          },
          cancelProps: {
            children: t2("downloader.action.addToQueue")
          }
        },
        onOk: async () => {
          return await BApi$1.downloadTask.startDownloadTasks({
            ids: ids2,
            actionOnConflict: DownloadTaskActionOnConflict.StopOthers
          });
        },
        onClose: async () => await BApi$1.downloadTask.startDownloadTasks({
          ids: ids2,
          actionOnConflict: DownloadTaskActionOnConflict.Ignore
        })
      });
    }
  };
  useUpdateEffect(() => {
    selectedTaskIdsRef.current = selectedTaskIds;
  }, [selectedTaskIds]);
  const contextMenuAnchorPointRef = reactExports.useRef({
    x: 0,
    y: 0
  });
  const renderContextMenu = reactExports.useCallback(() => {
    if (selectedTaskIdsRef.current.length == 0) {
      return;
    }
    const moreThanOne = selectedTaskIdsRef.current.length > 1;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      ControlledMenu,
      {
        ...menuProps,
        anchorPoint: contextMenuAnchorPointRef.current,
        className: "downloader-page-context-menu",
        onClose: () => {
          toggleMenu(false);
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => {
                startTasksManually(selectedTaskIdsRef.current);
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdPlayCircle, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("downloader.action.bulk"),
                  " "
                ] }),
                t2("downloader.action.start")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => BApi$1.downloadTask.stopDownloadTasks(selectedTaskIdsRef.current),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdAccessTime, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("downloader.action.bulk"),
                  " "
                ] }),
                t2("downloader.action.stop")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2 danger",
              onClick: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("downloader.confirm.deleteTasks", {
                    count: selectedTaskIdsRef.current.length
                  }),
                  onOk: async () => {
                    await BApi$1.downloadTask.deleteDownloadTasks({
                      ids: selectedTaskIdsRef.current
                    });
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(MdDelete, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("downloader.action.bulk"),
                  " "
                ] }),
                t2("common.action.delete")
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            MenuItem,
            {
              className: "flex items-center gap-2",
              onClick: () => {
                const ids2 = selectedTaskIdsRef.current;
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2(
                    ids2.length > 1 ? "downloader.confirm.clearCheckpoints" : "downloader.confirm.clearCheckpoint",
                    { count: ids2.length }
                  ),
                  onOk: async () => {
                    await BApi$1.request({
                      path: "/download-task/checkpoint",
                      method: "DELETE",
                      body: ids2,
                      type: "application/json",
                      format: "json"
                    });
                  }
                });
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, {}),
                moreThanOne && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                  t2("downloader.action.bulk"),
                  " "
                ] }),
                t2("downloader.action.clearCheckpoints")
              ]
            }
          )
        ]
      }
    );
  }, [menuProps]);
  reactExports.useEffect(() => {
    tasksRef.current = tasks;
  }, [tasks]);
  reactExports.useEffect(() => {
    const loadDownloaderDefinitions = async () => {
      try {
        const response = await BApi$1.downloadTask.getAllDownloaderDefinitions();
        setDownloaderDefinitions(response.data || []);
      } catch (error2) {
        console.error("Failed to load downloader definitions:", error2);
      }
    };
    loadDownloaderDefinitions();
  }, []);
  console.log(selectedTaskIdsRef.current, SelectionMode[selectionModeRef.current]);
  const onTaskClick = (taskId, e2) => {
    const nextMode = e2 ? e2.shiftKey ? 2 : e2.ctrlKey || e2.metaKey ? 1 : 0 : 0;
    selectionModeRef.current = nextMode;
    console.log(SelectionMode[selectionModeRef.current]);
    switch (selectionModeRef.current) {
      case 0:
        if (selectedTaskIdsRef.current.includes(taskId) && selectedTaskIdsRef.current.length == 1) {
          setSelectedTaskIds([]);
        } else {
          setSelectedTaskIds([taskId]);
        }
        break;
      case 1:
        if (selectedTaskIdsRef.current.includes(taskId)) {
          setSelectedTaskIds(selectedTaskIdsRef.current.filter((id2) => id2 != taskId));
        } else {
          setSelectedTaskIds([...selectedTaskIdsRef.current, taskId]);
        }
        break;
      case 2:
        if (selectedTaskIdsRef.current.length == 0) {
          setSelectedTaskIds([taskId]);
        } else {
          const lastSelectedTaskId = selectedTaskIdsRef.current[selectedTaskIds.length - 1];
          const lastSelectedTaskIndex = filteredTasks.findIndex((t22) => t22.id == lastSelectedTaskId);
          const currentTaskIndex = filteredTasks.findIndex((t22) => t22.id == taskId);
          const start = Math.min(lastSelectedTaskIndex, currentTaskIndex);
          const end = Math.max(lastSelectedTaskIndex, currentTaskIndex);
          setSelectedTaskIds(filteredTasks.slice(start, end + 1).map((t22) => t22.id));
        }
        break;
    }
  };
  const taskFilters = [];
  if (form2.thirdPartyIds && form2.thirdPartyIds.length > 0) {
    taskFilters.push((t22) => form2.thirdPartyIds.includes(t22.thirdPartyId));
  }
  if (form2.statuses && form2.statuses.length > 0) {
    taskFilters.push((t22) => form2.statuses.includes(t22.status));
  }
  if (form2.keyword != void 0 && form2.keyword.length > 0) {
    const lowerCaseKeyword = form2.keyword.toLowerCase();
    taskFilters.push(
      (t22) => {
        var _a2;
        return ((_a2 = t22.name) == null ? void 0 : _a2.toLowerCase().includes(lowerCaseKeyword)) || t22.key.toLowerCase().includes(lowerCaseKeyword);
      }
    );
  }
  const filteredTasks = tasks.filter((x2) => taskFilters.every((f2) => f2(x2)));
  console.log(form2, filteredTasks);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col gap-1", children: [
    renderContextMenu(),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: "grid gap-x-4 gap-y-1 items-center",
        style: { gridTemplateColumns: "auto 1fr" },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.filter.source") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: sortedThirdPartyIds.map((s2) => {
            var _a2;
            const count = tasks.filter((t22) => t22.thirdPartyId == s2.value).length;
            const isDeveloping = isThirdPartyDeveloping(s2.value);
            const isSelected = (_a2 = form2.thirdPartyIds) == null ? void 0 : _a2.some((a2) => a2 == s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                variant: isSelected ? "solid" : "flat",
                onPress: () => {
                  let thirdPartyIds = form2.thirdPartyIds || [];
                  if (isSelected) {
                    thirdPartyIds = thirdPartyIds.filter((a2) => a2 != s2.value);
                  } else {
                    thirdPartyIds.push(s2.value);
                  }
                  setForm({
                    ...form2,
                    thirdPartyIds
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: s2.value }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: s2.label }),
                  isDeveloping && /* @__PURE__ */ jsxRuntimeExports.jsx(DevelopingChip, { showTooltip: false, size: "sm" }),
                  count > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: count })
                ] })
              },
              s2.value
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.filter.status") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(button_group_default, { size: "sm", children: downloadTaskStatuses.map((s2) => {
            var _a2;
            const count = tasks.filter((t22) => t22.status == s2.value).length;
            const chipColor = DownloadTaskStatusIceLabelStatusMap[s2.value];
            const isSelected = (_a2 = form2.statuses) == null ? void 0 : _a2.some((a2) => a2 == s2.value);
            return /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                variant: isSelected ? "solid" : "flat",
                onPress: () => {
                  let statuses = form2.statuses || [];
                  if (isSelected) {
                    statuses = statuses.filter((a2) => a2 != s2.value);
                  } else {
                    statuses.push(s2.value);
                  }
                  setForm({
                    ...form2,
                    statuses
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: isSelected ? "default" : chipColor, size: "sm", variant: "light", children: [
                  t2(s2.label),
                  count > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
                    " (",
                    count,
                    ")"
                  ] })
                ] }) })
              },
              s2.value
            );
          }) }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("downloader.filter.keyword") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              className: "w-[320px]",
              fullWidth: false,
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-base" }),
              onValueChange: (keyword) => setForm({
                ...form2,
                keyword
              })
            }
          ) })
        ]
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "small",
            onPress: () => {
              createPortal(DownloadTaskDetailModal, {});
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("downloader.action.createTask")
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "success",
            size: "small",
            variant: "flat",
            onPress: () => {
              startTasksManually([], DownloadTaskActionOnConflict.Ignore);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-base" }),
              t2("downloader.action.startAll")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "warning",
            size: "small",
            variant: "flat",
            onPress: () => {
              BApi$1.downloadTask.stopDownloadTasks([]);
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, { className: "text-base" }),
              t2("downloader.action.stopAll")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "flat", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
            t2("downloader.action.cleanup")
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            dropdown_menu_default,
            {
              onAction: (key) => {
                switch (key) {
                  case "delete_completed": {
                    const ids2 = tasks.filter((t22) => t22.status == DownloadTaskStatus.Complete).map((t22) => t22.id);
                    if (ids2.length === 0)
                      return;
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("downloader.confirm.deleteTasks", { count: ids2.length }),
                      onOk: async () => {
                        await BApi$1.downloadTask.deleteDownloadTasks({ ids: ids2 });
                      }
                    });
                    break;
                  }
                  case "delete_failed": {
                    const ids2 = tasks.filter((t22) => t22.status == DownloadTaskStatus.Failed).map((t22) => t22.id);
                    if (ids2.length === 0)
                      return;
                    createPortal(Modal, {
                      defaultVisible: true,
                      title: t2("downloader.confirm.deleteTasks", { count: ids2.length }),
                      onOk: async () => {
                        await BApi$1.downloadTask.deleteDownloadTasks({ ids: ids2 });
                      }
                    });
                    break;
                  }
                }
              },
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
                    children: t2("downloader.action.deleteCompleted")
                  },
                  "delete_completed"
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    color: "danger",
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" }),
                    children: t2("downloader.action.deleteFailed")
                  },
                  "delete_failed"
                )
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(RequestStatistics, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            variant: "flat",
            onPress: () => {
              BApi$1.gui.openUrlInDefaultBrowser({
                url: `${envConfig.apiEndpoint}/download-task/xlsx`
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineExport, { className: "text-base" }),
              t2("downloader.action.exportAll")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "secondary",
            size: "small",
            variant: "flat",
            onPress: () => {
              createPortal(ConfigurationsModal, {});
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-base" }),
              t2("downloader.action.configurations")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "div",
      {
        ref: (r2) => {
          if (r2 && taskListHeight == 0) {
            setTaskListHeight(r2.clientHeight);
          }
        },
        className: "grow overflow-hidden",
        children: taskListHeight > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          listbox_default,
          {
            isVirtualized: true,
            className: "p-0",
            emptyContent: t2("downloader.empty.noTasks"),
            label: "Select from 1000 items",
            variant: "flat",
            virtualization: {
              maxListboxHeight: taskListHeight,
              itemHeight: 75
            },
            children: filteredTasks.map((task) => {
              var _a2, _b2;
              const hasErrorMessage = task.status == DownloadTaskStatus.Failed && task.message;
              const selected = selectedTaskIds.indexOf(task.id) > -1;
              const Icon2 = (_a2 = DownloadTaskTypeIconMap[task.thirdPartyId]) == null ? void 0 : _a2[task.type];
              log$3("rendering task", task);
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                listbox_item_base_default,
                {
                  className: `${selected ? "bg-primary-50 dark:bg-primary-900/20" : ""}`,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "div",
                    {
                      onContextMenu: (e2) => {
                        console.log(`Opening context menu from ${task.id}:${task.name}`);
                        e2.preventDefault();
                        if (!selectedTaskIdsRef.current.includes(task.id)) {
                          setSelectedTaskIds([task.id]);
                        }
                        contextMenuAnchorPointRef.current = {
                          x: e2.clientX,
                          y: e2.clientY
                        };
                        toggleMenu(true);
                        forceUpdate();
                      },
                      className: `flex flex-col gap-1`,
                      onClick: (e2) => onTaskClick(task.id, e2),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(ThirdPartyIcon, { thirdPartyId: task.thirdPartyId }),
                            Icon2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "text-base" }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-lg", children: task.name ?? task.key })
                          ] }),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "opacity-60", children: task.name && task.key }),
                            task.nextStartDt && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "default", size: "sm", children: [
                              t2("downloader.label.nextStartTime"),
                              ":",
                              hooks(task.nextStartDt).format("YYYY-MM-DD HH:mm:ss")
                            ] }),
                            /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "default", size: "sm", children: [
                              t2("downloader.label.createdAt"),
                              " ",
                              hooks(task.createdAt).format("YYYY-MM-DD HH:mm:ss")
                            ] })
                          ] })
                        ] }),
                        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-8 flex items-center gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsxs(
                              Chip,
                              {
                                color: DownloadTaskStatusIceLabelStatusMap[task.status],
                                variant: "light",
                                children: [
                                  t2(DownloadTaskStatus[task.status]),
                                  task.current
                                ]
                              }
                            ),
                            task.status == DownloadTaskStatus.Failed && /* @__PURE__ */ jsxRuntimeExports.jsxs(
                              Button,
                              {
                                isIconOnly: true,
                                color: "danger",
                                variant: "light",
                                onPress: () => {
                                  if (hasErrorMessage) {
                                    createPortal(Modal, {
                                      defaultVisible: true,
                                      size: "xl",
                                      title: t2("common.label.error"),
                                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.message })
                                    });
                                  }
                                },
                                children: [
                                  /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-base" }),
                                  task.failureTimes
                                ]
                              }
                            ),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              circular_progress_default,
                              {
                                disableAnimation: true,
                                showValueLabel: true,
                                color: DownloadTaskStatusProgressBarColorMap[task.status],
                                size: "lg",
                                value: task.progress
                              }
                            )
                          ] }),
                          (_b2 = task.availableActions) == null ? void 0 : _b2.map((a2) => {
                            switch (a2) {
                              case DownloadTaskAction.StartManually:
                              case DownloadTaskAction.Restart:
                                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Button,
                                  {
                                    isIconOnly: true,
                                    size: "sm",
                                    variant: "light",
                                    onPress: () => {
                                      startTasksManually([task.id]);
                                    },
                                    children: a2 == DownloadTaskAction.Restart ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRedo, { className: "text-lg" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-lg" })
                                  },
                                  `start-${task.id}-${a2}`
                                );
                              case DownloadTaskAction.Disable:
                                return /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  Button,
                                  {
                                    isIconOnly: true,
                                    size: "sm",
                                    variant: "light",
                                    onPress: () => {
                                      BApi$1.downloadTask.stopDownloadTasks([task.id]);
                                    },
                                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, { className: "text-lg" })
                                  },
                                  `stop-${task.id}-${a2}`
                                );
                            }
                            return;
                          }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              isIconOnly: true,
                              size: "sm",
                              variant: "light",
                              onPress: () => {
                                createPortal(DownloadTaskDetailModal, {
                                  id: task.id
                                });
                              },
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-lg" })
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsx(
                            Button,
                            {
                              isIconOnly: true,
                              size: "sm",
                              variant: "light",
                              onPress: () => {
                                BApi$1.tool.openFileOrDirectory({
                                  path: task.downloadPath
                                });
                              },
                              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-lg" })
                            }
                          ),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEllipsis, { className: "text-lg" }) }) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(
                              dropdown_menu_default,
                              {
                                onAction: (key) => {
                                  switch (key) {
                                    case "delete":
                                      createPortal(Modal, {
                                        defaultVisible: true,
                                        title: t2("downloader.confirm.deleteTask"),
                                        onOk: () => BApi$1.downloadTask.deleteDownloadTasks({
                                          ids: [task.id]
                                        })
                                      });
                                      break;
                                  }
                                },
                                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                                  menu_item_base_default,
                                  {
                                    color: "danger",
                                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-lg" }),
                                    children: t2("common.action.delete")
                                  },
                                  "delete"
                                )
                              }
                            )
                          ] })
                        ] })
                      ] })
                    },
                    task.id
                  )
                },
                task.id
              );
            })
          }
        )
      }
    ),
    "ß"
  ] });
};
DownloaderPage.displayName = "DownloaderPage";
const DownloadTaskStatusIceLabelStatusMap = {
  [DownloadTaskStatus.Idle]: "default",
  [DownloadTaskStatus.InQueue]: "default",
  [DownloadTaskStatus.Downloading]: "primary",
  [DownloadTaskStatus.Failed]: "danger",
  [DownloadTaskStatus.Complete]: "success",
  [DownloadTaskStatus.Starting]: "warning",
  [DownloadTaskStatus.Stopping]: "warning",
  [DownloadTaskStatus.Disabled]: "default"
};
const DownloadTaskStatusProgressBarColorMap = {
  [DownloadTaskStatus.Idle]: "default",
  [DownloadTaskStatus.InQueue]: "default",
  [DownloadTaskStatus.Downloading]: "primary",
  [DownloadTaskStatus.Failed]: "danger",
  [DownloadTaskStatus.Complete]: "success",
  [DownloadTaskStatus.Starting]: "warning",
  [DownloadTaskStatus.Stopping]: "warning",
  [DownloadTaskStatus.Disabled]: "default"
};
var SelectionMode = /* @__PURE__ */ ((SelectionMode2) => {
  SelectionMode2[SelectionMode2["Default"] = 0] = "Default";
  SelectionMode2[SelectionMode2["Ctrl"] = 1] = "Ctrl";
  SelectionMode2[SelectionMode2["Shift"] = 2] = "Shift";
  return SelectionMode2;
})(SelectionMode || {});
const log$3 = buildLogger("DownloadPage");
class Value {
  constructor() {
    __publicField(this, "delay");
    __publicField(this, "enabled", false);
    __publicField(this, "targets", []);
  }
}
const FileMoverPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const fsOptionsStore = useFileSystemOptionsStore();
  const value2 = fsOptionsStore.data.fileMover ?? new Value();
  const enabled = value2.enabled ?? false;
  const targets = value2.targets ?? [];
  const progresses = useFileMovingProgressesStore((state) => state.progresses);
  reactExports.useEffect(() => {
  }, []);
  const save = (patches = {}, cb2) => {
    const options = {
      ...value2 || {},
      ...patches || {}
    };
    fsOptionsStore.patch({
      // @ts-ignore
      fileMover: options
    }).then(() => {
      toast.success(t2("common.state.saved"));
    });
  };
  const addTarget = (targetPath) => {
    if (!targets.some((t22) => t22.path == targetPath)) {
      targets.push({
        path: targetPath,
        sources: [],
        overwrite: false
      });
      save({ targets });
    }
  };
  const updateTarget = (targetPath, newTargetPath) => {
    const targetIndex = targets.findIndex((a2) => a2.path == targetPath);
    const target = targets[targetIndex];
    target.path = newTargetPath;
    targets.splice(targetIndex, 1, target);
    save({ targets });
  };
  const addSource = (targetPath, sourcePath) => {
    const target = targets.find((a2) => a2.path == targetPath);
    if (!target.sources) {
      target.sources = [];
    }
    if (target.sources.indexOf(sourcePath) == -1) {
      target.sources.push(sourcePath);
      save({ targets });
    }
  };
  const updateSource = (targetPath, sourcePath, newSourcePath) => {
    const target = targets.find((a2) => a2.path == targetPath);
    if (!target || !target.sources)
      return;
    const idx = target.sources.indexOf(sourcePath);
    if (idx > -1 && target.sources.indexOf(newSourcePath) == -1) {
      target.sources[idx] = newSourcePath;
      save({ targets });
    }
  };
  const renderCommonOperations = (path) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        size: "sm",
        variant: "light",
        onPress: () => {
          BApi$1.tool.openFileOrDirectory({
            path
          });
        },
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$H, { className: "text-base" })
      }
    ) });
  };
  const setOverwrite = (targetPath, overwrite) => {
    const targetIndex = targets.findIndex((a2) => a2.path == targetPath);
    const target = targets[targetIndex];
    target.overwrite = overwrite;
    targets.splice(targetIndex, 1, target);
    save({
      targets
    });
  };
  const renderSourceItem = (targetPath, sourcePath) => {
    const progress2 = progresses[sourcePath];
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          FileSystemSelectorButton,
          {
            fileSystemSelectorProps: {
              targetType: "folder",
              onSelected: (e2) => {
                updateSource(targetPath, sourcePath, e2.path);
              },
              defaultSelectedPath: sourcePath
            }
          }
        ),
        progress2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
          progress2.error && /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  title: t2("common.label.error"),
                  size: "lg",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: progress2.error }),
                  footer: { actions: ["ok"] }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdWarning, { className: "text-base" })
            }
          ),
          progress2.moving && /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { type: "loading" }),
          progress2.percentage > 0 && progress2.percentage < 100 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", color: "primary", variant: "flat", children: [
            progress2.percentage,
            "%"
          ] }),
          progress2.percentage === 100 && /* @__PURE__ */ jsxRuntimeExports.jsx(MdFolder, { style: { color: "var(--theme-color-success)" } })
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5", children: [
        renderCommonOperations(sourcePath),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => {
              var _a2;
              const target = targets.find((t22) => t22.path === targetPath);
              if (target) {
                target.sources = (_a2 = target.sources) == null ? void 0 : _a2.filter((a2) => a2 !== sourcePath);
              }
              save({ targets });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
          }
        )
      ] })
    ] }, sourcePath);
  };
  const renderTargetCard = (target) => {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "flex flex-col gap-1.5 p-2 px-3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between pb-1 border-b border-divider", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(MdFolder, { className: "text-base" }),
              variant: "light",
              onPress: () => {
                createPortal(FileSystemSelectorModal, {
                  targetType: "folder",
                  onSelected: (e2) => {
                    updateTarget(target.path, e2.path);
                  },
                  defaultSelectedPath: target.path
                });
              },
              children: target.path
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("fileMover.tip.overwrite"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: target.overwrite,
              size: "sm",
              onValueChange: (v2) => setOverwrite(target.path, v2),
              children: t2("fileMover.label.overwrite")
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5", children: [
          renderCommonOperations(target.path),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                save({ targets: targets.filter((a2) => a2.path !== target.path) });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center text-xs text-default-500", children: [
            t2("fileMover.label.sources"),
            (target.sources ?? []).length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", className: "ml-2", children: (target.sources ?? []).length })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              color: "primary",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-base" }),
              onPress: () => {
                createPortal(FileSystemSelectorModal, {
                  targetType: "folder",
                  onSelected: (e2) => {
                    addSource(target.path, e2.path);
                  }
                });
              },
              children: t2("fileMover.action.addSource")
            }
          )
        ] }),
        (target.sources ?? []).length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: (target.sources ?? []).map((sourcePath) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 p-1 px-1.5 bg-default-50 rounded-md", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$13, { className: "text-danger shrink-0" }),
          renderSourceItem(target.path, sourcePath)
        ] }, sourcePath)) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-2.5 text-center text-xs text-default-400 bg-default-50 rounded-md", children: t2("fileMover.empty.noSources") })
      ] })
    ] }) }, target.path);
  };
  const renderNormalEditMode = () => {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
      (targets ?? []).map((target) => renderTargetCard(target)),
      /* @__PURE__ */ jsxRuntimeExports.jsx(card_default, { className: "border-2 border-dashed border-default-200 bg-transparent hover:border-primary transition-colors", children: /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "flex items-center justify-center p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          variant: "flat",
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$k, { className: "text-lg" }),
          onPress: () => {
            createPortal(FileSystemSelectorModal, {
              targetType: "folder",
              onSelected: (e2) => {
                addTarget(e2.path);
              }
            });
          },
          children: t2("fileMover.action.addTarget")
        }
      ) }) })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "file-mover", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 p-2 px-3 mb-3 bg-default-50 rounded-lg", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        switch_default,
        {
          isSelected: enabled,
          size: "sm",
          color: enabled ? "success" : "default",
          onValueChange: (c2) => {
            save({ enabled: c2 });
          },
          children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-sm font-medium transition-colors ${enabled ? "text-success" : "text-default-500"}`, children: t2(enabled ? "fileMover.status.enabled" : "fileMover.status.disabled") })
        }
      ) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-px h-5 bg-default-200" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          content: t2("fileMover.tip.delay"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-600 whitespace-nowrap", children: t2("fileMover.label.delay") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              TimeInput,
              {
                size: "sm",
                hideTimeZone: true,
                granularity: "second",
                value: (value2 == null ? void 0 : value2.delay) ? dayjs.duration(hooks.duration(value2.delay).asMilliseconds()) : void 0,
                onChange: (c2) => {
                  save({
                    delay: (c2 == null ? void 0 : c2.format) && typeof c2.format === "function" ? c2.format("HH:mm:ss") : c2 ?? "00:05:00"
                  });
                }
              }
            )
          ] })
        }
      ) })
    ] }),
    renderNormalEditMode()
  ] });
};
FileMoverPage.displayName = "FileMoverPage";
const FileNameModifierPage = () => {
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FileNameModifier, { initialFilePaths: [] }) });
};
const ThirdPartyIntegrationPage = () => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(accordion_default, { defaultSelectedKeys: "all", selectionMode: "multiple", variant: "splitted", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: "SoulPlus", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("thirdPartyIntegration.label.tampermonkeyScript") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            variant: "light",
            onPress: () => {
              BApi$1.tampermonkey.installTampermonkeyScript({
                script: TampermonkeyScript.SoulPlus
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(GrInstallOption, { className: "text-base" }),
              t2("thirdPartyIntegration.action.oneClickInstall")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        alert_default,
        {
          color: "default",
          variant: "flat",
          title: t2("thirdPartyIntegration.tip.scriptModifies"),
          description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            "1. ",
            t2("thirdPartyIntegration.tip.soulPlusClick")
          ] }) })
        }
      )
    ] }) }, "SoulPlus"),
    /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: "ExHentai", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("thirdPartyIntegration.label.tampermonkeyScript") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "primary",
            variant: "light",
            onPress: () => {
              BApi$1.tampermonkey.installTampermonkeyScript({
                script: TampermonkeyScript.Bakabase
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(GrInstallOption, { className: "text-base" }),
              t2("thirdPartyIntegration.action.oneClickInstall")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        alert_default,
        {
          color: "default",
          variant: "flat",
          title: t2("thirdPartyIntegration.tip.scriptModifies"),
          description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            "1. ",
            t2("thirdPartyIntegration.tip.exHentaiClick")
          ] }) })
        }
      )
    ] }) }, "ExHentai")
  ] });
};
ThirdPartyIntegrationPage.displayName = "ThirdPartyIntegrationPage";
const ConfigurationModal = (props) => {
  const { t: t2 } = useTranslation();
  const soulPlusOptions = useSoulPlusOptionsStore((state) => state.data);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      footer: {
        actions: ["cancel"]
      },
      size: "xl",
      onDestroyed: props.onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs, { isVertical: true, "aria-label": "Options", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { title: t2("SoulPlus"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            Editor: textarea_default,
            Viewer: textarea_default,
            description: t2(
              "Cookie is used to access SoulPlus posts."
            ),
            label: t2("Cookie"),
            value: soulPlusOptions.cookie,
            onSubmit: async (v2) => {
              await BApi$1.options.patchSoulPlusOptions({
                cookie: v2
              });
            }
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          EditableValue,
          {
            Editor: number_input_default,
            Viewer: number_input_default,
            description: t2(
              "Items priced below this value will be bought automatically."
            ),
            editorProps: {
              min: 0,
              formatOptions: { useGrouping: false },
              hideStepper: true
            },
            label: t2("Auto buy threshold"),
            value: soulPlusOptions.autoBuyThreshold,
            viewerProps: {
              formatOptions: { useGrouping: false },
              hideStepper: true
            },
            onSubmit: async (v2) => {
              await BApi$1.options.patchSoulPlusOptions({
                autoBuyThreshold: v2
              });
            }
          }
        )
      ] }) }, "soulplus") })
    }
  );
};
ConfigurationModal.displayName = "ConfigurationModal";
const ThirdPartyMap = {
  [PostParserSource.SoulPlus]: ThirdPartyId.SoulPlus
};
const PostParserPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const thirdPartyOptions = useThirdPartyOptionsStore((state) => state.data);
  const tasks = usePostParserTasksStore((state) => state.tasks);
  reactExports.useEffect(() => {
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            onPress: () => {
              let linksTextMap = {};
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                title: t2("postParser.action.addTasks"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  postParserSources.map((s2) => {
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      textarea_default,
                      {
                        onValueChange: (v2) => {
                          linksTextMap[s2.value] = v2;
                        },
                        label: t2("postParser.input.postLinks", { source: s2.label }),
                        minRows: 10,
                        placeholder: `https://xxxxxxx
https://xxxxxxx
...`
                      }
                    );
                  }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(FeatureStatusTip, { status: "developing", name: t2("postParser.tip.otherSitesSupport") })
                ] }),
                onOk: async () => {
                  const linksMap = _$2.mapValues(linksTextMap, (value2) => value2.split("\n").map((x2) => x2.trim()).filter((x2) => x2));
                  await BApi$1.postParser.addPostParserTasks(linksMap);
                }
              });
            },
            size: "sm",
            color: "primary",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlusCircle, { className: "text-base" }),
              t2("postParser.action.addTasks")
            ]
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            size: "sm",
            onPress: () => {
              createPortal(ConfigurationModal, {});
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-base" }),
              t2("postParser.action.configuration")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          checkbox_default,
          {
            isSelected: thirdPartyOptions.automaticallyParsingPosts,
            onValueChange: async (v2) => {
              const r2 = await BApi$1.options.patchThirdPartyOptions({ automaticallyParsingPosts: v2 });
              if (v2 && !r2.code) {
                await BApi$1.postParser.startAllPostParserTasks();
              }
            },
            size: "sm",
            color: "secondary",
            children: t2("postParser.label.automaticallyParsing")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          Button,
          {
            color: "success",
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(Modal, {
                defaultVisible: true,
                size: "xl",
                title: t2("postParser.action.instructions"),
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.curlVersion") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.requestInterval") })
                      ] }),
                      title: t2("postParser.label.curl")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      description: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.ollamaRequired") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.ollamaModel") }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.ollamaTested") })
                      ] }),
                      title: t2("postParser.label.ollama")
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    alert_default,
                    {
                      color: "success",
                      description: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: t2("postParser.tip.browserIntegration") }) }),
                      title: t2("postParser.label.browserIntegrations"),
                      variant: "flat"
                    }
                  )
                ] }),
                footer: {
                  actions: ["cancel"]
                }
              });
            },
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" }),
              t2("postParser.action.instructions")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isStriped: true, removeWrapper: true, className: "break-all", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(table_header_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("postParser.table.id") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("postParser.table.target") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("postParser.table.items") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("postParser.table.parsedAt") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: t2("common.label.operations") })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { children: tasks.map((task) => {
        var _a2;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(table_row_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.id }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.title ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                ThirdPartyIcon,
                {
                  thirdPartyId: ThirdPartyMap[task.source]
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: task.title })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: (e2) => {
                  BApi$1.gui.openUrlInDefaultBrowser({
                    url: task.link
                  });
                },
                children: task.link
              }
            ) })
          ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ThirdPartyIcon,
              {
                thirdPartyId: ThirdPartyMap[task.source]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: (e2) => {
                  BApi$1.gui.openUrlInDefaultBrowser({
                    url: task.link
                  });
                },
                children: task.link
              }
            ) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (_a2 = task.items) == null ? void 0 : _a2.map((item, idx) => {
            return /* @__PURE__ */ jsxRuntimeExports.jsxs(React$6.Fragment, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
                item.link && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "primary",
                    size: "sm",
                    variant: "light",
                    onPress: (e2) => {
                      BApi$1.gui.openUrlInDefaultBrowser({
                        url: item.link
                      });
                    },
                    children: item.link
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                  item.accessCode && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    snippet_default,
                    {
                      size: "sm",
                      symbol: t2("postParser.label.accessCode"),
                      children: item.accessCode
                    }
                  ),
                  item.decompressionPassword && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    snippet_default,
                    {
                      size: "sm",
                      symbol: t2("postParser.label.decompressionPassword")
                    }
                  )
                ] })
              ] }),
              idx < task.items.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {})
            ] }, idx);
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: task.parsedAt ? task.parsedAt : task.error ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: () => {
                createPortal(Modal, {
                  defaultVisible: true,
                  size: "xl",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
                  footer: {
                    actions: ["cancel"]
                  }
                });
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-base" })
            }
          ) : null }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: async () => {
                await BApi$1.postParser.deletePostParserTask(task.id);
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-base" })
            }
          ) }) })
        ] });
      }) })
    ] }) })
  ] });
};
PostParserPage.displayName = "PostParserPage";
const generateDefaultName = (existingNames, t2) => {
  const baseNameKey = "resourceProfile.label.resourceProfile";
  const baseName = t2(baseNameKey);
  let n2 = 1;
  while (existingNames.includes(`${baseName} ${n2}`)) {
    n2++;
  }
  return `${baseName} ${n2}`;
};
const ResourceProfileModal = ({ profile, existingNames = [], onSaved, onUpdate, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const isEdit = !!(profile == null ? void 0 : profile.id);
  const [name2, setName] = reactExports.useState(
    (profile == null ? void 0 : profile.name) || (isEdit ? "" : generateDefaultName(existingNames, t2))
  );
  const [priority, setPriority] = reactExports.useState((profile == null ? void 0 : profile.priority) ?? 0);
  const [saving, setSaving] = reactExports.useState(false);
  const handleSubmit = async () => {
    if (!name2.trim()) {
      return;
    }
    setSaving(true);
    try {
      if (isEdit && (profile == null ? void 0 : profile.id) && onUpdate) {
        await onUpdate(profile.id, { name: name2, priority });
      } else {
        const inputModel = {
          name: name2,
          priority
        };
        await BApi$1.resourceProfile.addResourceProfile(inputModel);
      }
      onSaved == null ? void 0 : onSaved();
      onDestroyed == null ? void 0 : onDestroyed();
    } catch (e2) {
      console.error("Failed to save resource profile", e2);
    } finally {
      setSaving(false);
    }
  };
  const isValid3 = name2.trim() !== "";
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      okProps: {
        isDisabled: !isValid3,
        isLoading: saving
      },
      size: "md",
      title: isEdit ? t2("resourceProfile.modal.editResourceProfileTitle") : t2("resourceProfile.modal.addResourceProfileTitle"),
      onDestroyed,
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            isRequired: true,
            errorMessage: !name2.trim() ? t2("resourceProfile.error.nameRequired") : "",
            isInvalid: !name2.trim(),
            label: t2("resourceProfile.label.name"),
            placeholder: t2("resourceProfile.label.profileName"),
            value: name2,
            onValueChange: setName
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            description: t2("resourceProfile.tip.higherPriorityPrecedence"),
            label: t2("resourceProfile.label.priority"),
            placeholder: "0",
            type: "number",
            value: String(priority),
            onValueChange: (v2) => setPriority(parseInt(v2) || 0)
          }
        ),
        !isEdit && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-default-400", children: t2("resourceProfile.tip.otherSettingsAfterCreation") })
      ] })
    }
  );
};
ResourceProfileModal.displayName = "ResourceProfileModal";
const ResourceProfileTestModal = ({ profile, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [matchingResources, setMatchingResources] = reactExports.useState([]);
  const [matchCount, setMatchCount] = reactExports.useState(null);
  const [loading, setLoading] = reactExports.useState(true);
  const [keyword, setKeyword] = reactExports.useState("");
  const [limit2, setLimit] = reactExports.useState(50);
  reactExports.useEffect(() => {
    const loadMatchingResources = async () => {
      var _a2, _b2;
      setLoading(true);
      try {
        const searchParams = {
          group: (_a2 = profile.search) == null ? void 0 : _a2.group,
          tags: (_b2 = profile.search) == null ? void 0 : _b2.tags,
          pageSize: limit2,
          page: 1
        };
        const rsp = await BApi$1.resource.searchResources(searchParams);
        const resources = rsp.data || [];
        setMatchingResources(resources);
        setMatchCount(rsp.totalCount ?? resources.length);
      } catch (e2) {
        console.error("Failed to test criteria", e2);
      } finally {
        setLoading(false);
      }
    };
    loadMatchingResources();
  }, [profile, limit2]);
  const filteredResources = matchingResources.filter(
    (r2) => {
      var _a2, _b2, _c2;
      return keyword === "" || ((_a2 = r2.path) == null ? void 0 : _a2.toLowerCase().includes(keyword.toLowerCase())) || ((_b2 = r2.name) == null ? void 0 : _b2.toLowerCase().includes(keyword.toLowerCase())) || ((_c2 = r2.displayName) == null ? void 0 : _c2.toLowerCase().includes(keyword.toLowerCase()));
    }
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "3xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        t2("resourceProfile.modal.testSearchCriteriaTitle"),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", color: "primary", children: profile.name })
      ] }),
      footer: false,
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm", children: matchCount !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
            t2("resourceProfile.label.totalMatchingResources"),
            ": ",
            /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: matchCount })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500", children: [
              t2("resourceProfile.label.showLimit"),
              ":"
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: limit2 === 50 ? "solid" : "flat",
                onPress: () => setLimit(50),
                children: "50"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: limit2 === 100 ? "solid" : "flat",
                onPress: () => setLimit(100),
                children: "100"
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: limit2 === 200 ? "solid" : "flat",
                onPress: () => setLimit(200),
                children: "200"
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            placeholder: t2("resourceProfile.input.filterResults"),
            value: keyword,
            onValueChange: setKeyword,
            className: "max-w-sm"
          }
        ),
        loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center py-8", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-2xl mr-2" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("resourceProfile.status.testingCriteria") })
        ] }) : filteredResources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-default-400 py-8", children: keyword ? t2("resourceProfile.empty.noResourcesMatchFilter") : t2("resourceProfile.empty.noResourcesMatchedByCriteria") }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[400px] overflow-y-auto border-divider border rounded-lg", children: filteredResources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: "flex items-center gap-2 px-3 py-2 border-b border-b-divider last:border-b-0 hover:bg-default-100",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$N, { className: "text-default-400" }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium truncate", title: resource.name, children: resource.displayName || t2("resourceProfile.label.unnamed") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 font-mono truncate", title: resource.path, children: resource.path })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "flat", children: [
                "#",
                resource.id
              ] })
            ]
          },
          resource.id
        )) }),
        !loading && matchCount !== null && matchCount > limit2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-sm text-default-400", children: t2("resourceProfile.status.showingOfTotal", {
          shown: Math.min(limit2, matchCount),
          total: matchCount
        }) })
      ] })
    }
  );
};
ResourceProfileTestModal.displayName = "ResourceProfileTestModal";
const parseTemplateForPreview = (template2, validPropertyNames, wrappers) => {
  const segments = [];
  const regex2 = /\{([^}]+)\}/g;
  let lastIndex = 0;
  let match5;
  const wrapperChars = /* @__PURE__ */ new Set();
  wrappers.forEach((w2) => {
    wrapperChars.add(w2.left);
    wrapperChars.add(w2.right);
  });
  const processText = (text2) => {
    let i2 = 0;
    while (i2 < text2.length) {
      let foundWrapper = false;
      for (const w2 of wrapperChars) {
        if (text2.substring(i2, i2 + w2.length) === w2) {
          if (i2 > 0) {
            const before = text2.substring(0, i2);
            if (before)
              segments.push({ type: "text", content: before });
          }
          segments.push({ type: "wrapper", content: w2 });
          text2 = text2.substring(i2 + w2.length);
          i2 = 0;
          foundWrapper = true;
          break;
        }
      }
      if (!foundWrapper)
        i2++;
    }
    if (text2)
      segments.push({ type: "text", content: text2 });
  };
  while ((match5 = regex2.exec(template2)) !== null) {
    if (match5.index > lastIndex) {
      processText(template2.slice(lastIndex, match5.index));
    }
    const propName = match5[1];
    const isValid3 = validPropertyNames.has(propName);
    segments.push({ type: isValid3 ? "property" : "invalid", content: propName });
    lastIndex = regex2.lastIndex;
  }
  if (lastIndex < template2.length) {
    processText(template2.slice(lastIndex));
  }
  return segments;
};
const propertyTypeLabels = {
  [PropertyType.SingleLineText]: "SingleLineText",
  [PropertyType.MultilineText]: "MultilineText",
  [PropertyType.SingleChoice]: "SingleChoice",
  [PropertyType.MultipleChoice]: "MultipleChoice",
  [PropertyType.Number]: "Number",
  [PropertyType.Percentage]: "Percentage",
  [PropertyType.Rating]: "Rating",
  [PropertyType.Boolean]: "Boolean",
  [PropertyType.Link]: "Link",
  [PropertyType.Attachment]: "Attachment",
  [PropertyType.Date]: "Date",
  [PropertyType.DateTime]: "DateTime",
  [PropertyType.Time]: "Time",
  [PropertyType.Formula]: "Formula",
  [PropertyType.Multilevel]: "Multilevel",
  [PropertyType.Tags]: "Tags"
};
const DisplayNameTemplateEditorModal = ({ template: template2, properties: properties2, onSubmit, ...props }) => {
  const { t: t2 } = useTranslation();
  const [wrappers, setWrappers] = reactExports.useState([]);
  const [propertyItems, setPropertyItems] = reactExports.useState([]);
  const [templateValue, setTemplateValue] = reactExports.useState(template2 ?? "");
  const [selectedType, setSelectedType] = reactExports.useState("all");
  const textareaRef = reactExports.useRef(null);
  const init2 = reactExports.useCallback(async () => {
    var _a2;
    const tr = await BApi$1.specialText.getAllSpecialTexts();
    const texts = ((_a2 = tr.data) == null ? void 0 : _a2[SpecialTextType.Wrapper]) || [];
    const wrappersData = texts.map((text2) => ({
      left: text2.value1,
      right: text2.value2
    }));
    setWrappers(wrappersData);
    const items = [];
    builtinPropertyForDisplayNames.forEach((v2) => {
      items.push({
        name: t2(getEnumKey("BuiltinPropertyForDisplayName", v2.label)),
        type: "builtin"
      });
    });
    properties2 == null ? void 0 : properties2.filter((p2) => p2.pool != PropertyPool.Internal).forEach((cp) => {
      if (cp.name) {
        items.push({
          name: cp.name,
          type: cp.type
        });
      }
    });
    setPropertyItems(items);
  }, [properties2, t2]);
  reactExports.useEffect(() => {
    init2();
  }, [init2]);
  const insertAtCursor = (text2) => {
    const textarea = textareaRef.current;
    if (!textarea) {
      setTemplateValue((prev2) => prev2 + text2);
      return;
    }
    const start = textarea.selectionStart;
    const end = textarea.selectionEnd;
    const newValue = templateValue.slice(0, start) + text2 + templateValue.slice(end);
    setTemplateValue(newValue);
    setTimeout(() => {
      textarea.focus();
      textarea.setSelectionRange(start + text2.length, start + text2.length);
    }, 0);
  };
  const availableTypes = reactExports.useMemo(() => {
    const types2 = /* @__PURE__ */ new Set();
    propertyItems.forEach((item) => types2.add(item.type));
    return types2;
  }, [propertyItems]);
  const filteredProperties = reactExports.useMemo(() => {
    if (selectedType === "all")
      return propertyItems;
    return propertyItems.filter((item) => item.type === selectedType);
  }, [propertyItems, selectedType]);
  const validPropertyNames = new Set(propertyItems.map((p2) => p2.name));
  const previewSegments = parseTemplateForPreview(templateValue, validPropertyNames, wrappers);
  const typeFilters = reactExports.useMemo(() => {
    const filters = [
      { key: "all", label: t2("common.label.all") }
    ];
    if (availableTypes.has("builtin")) {
      filters.push({ key: "builtin", label: t2("common.label.builtin") });
    }
    Object.entries(propertyTypeLabels).forEach(([key, label]) => {
      const typeKey = Number(key);
      if (availableTypes.has(typeKey)) {
        filters.push({ key: typeKey, label: t2(getEnumKey("PropertyType", label)) });
      }
    });
    return filters;
  }, [availableTypes, t2]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "2xl",
      title: t2("resourceProfile.modal.editDisplayNameTemplateTitle"),
      onDestroyed: props.onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(templateValue),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium", children: t2("resourceProfile.label.availableProperties") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: typeFilters.map((filter3) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              size: "sm",
              color: selectedType === filter3.key ? "primary" : "default",
              variant: selectedType === filter3.key ? "solid" : "flat",
              className: "cursor-pointer",
              onClick: () => setSelectedType(filter3.key),
              children: filter3.label
            },
            String(filter3.key)
          )) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[240px] overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
            filteredProperties.map((p2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "primary",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => insertAtCursor(`{${p2.name}}`),
                children: p2.name
              },
              p2.name
            )),
            filteredProperties.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400 text-sm", children: t2("resourceProfile.empty.noPropertiesAvailable") })
          ] }) })
        ] }),
        wrappers.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-2", children: t2("resourceProfile.label.wrappers") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: wrappers.map((w2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Chip,
            {
              size: "sm",
              color: "secondary",
              variant: "flat",
              className: "cursor-pointer hover:opacity-80",
              onClick: () => insertAtCursor(`${w2.left}${w2.right}`),
              children: [
                w2.left,
                " ",
                w2.right
              ]
            },
            w2.left
          )) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
            t2("resourceProfile.tip.wrappersRemovedAutomatically")
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-2", children: t2("resourceProfile.label.template") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            textarea_default,
            {
              ref: textareaRef,
              placeholder: t2("resourceProfile.input.templatePlaceholder"),
              value: templateValue,
              onValueChange: setTemplateValue,
              minRows: 2,
              maxRows: 5,
              classNames: {
                input: "font-mono"
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
            t2("resourceProfile.tip.leaveEmptyForFilename")
          ] })
        ] }),
        templateValue && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-2", children: t2("resourceProfile.label.preview") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 bg-default-100 rounded-lg flex flex-wrap items-center gap-0.5", children: previewSegments.map((seg, idx) => {
            if (seg.type === "text") {
              return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: seg.content }, idx);
            }
            if (seg.type === "property") {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "primary", variant: "flat", className: "h-5", children: seg.content }, idx);
            }
            if (seg.type === "wrapper") {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "secondary", variant: "flat", className: "h-5", children: seg.content }, idx);
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "danger", variant: "flat", className: "h-5", children: seg.content }, idx);
          }) })
        ] })
      ] })
    }
  );
};
DisplayNameTemplateEditorModal.displayName = "DisplayNameTemplateEditorModal";
const EnhancerSelectorModal = ({ enhancerOptions: propEnhancerOptions, onSubmit, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [enhancers, setEnhancers] = reactExports.useState([]);
  const [enhancerOptions, setEnhancerOptions] = reactExports.useState(propEnhancerOptions ?? []);
  const MAX_VISIBLE_TARGETS = 5;
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancers(r2.data || []);
    });
  }, []);
  const getOptionsForEnhancer = (enhancerId) => {
    return enhancerOptions.find((o2) => o2.enhancerId === enhancerId);
  };
  const isSelected = (enhancerId) => {
    return enhancerOptions.some((o2) => o2.enhancerId === enhancerId);
  };
  const toggleEnhancer = (enhancerId) => {
    if (isSelected(enhancerId)) {
      setEnhancerOptions(enhancerOptions.filter((o2) => o2.enhancerId !== enhancerId));
    } else {
      setEnhancerOptions([...enhancerOptions, { enhancerId }]);
    }
  };
  const updateEnhancerOptions = (enhancerId, options) => {
    const newOptions = enhancerOptions.map((o2) => {
      if (o2.enhancerId === enhancerId) {
        return {
          enhancerId,
          targetOptions: options.targetOptions,
          expressions: options.expressions,
          requirements: options.requirements,
          keywordProperty: options.keywordProperty
        };
      }
      return o2;
    });
    setEnhancerOptions(newOptions);
  };
  const openEnhancerOptions = (enhancer) => {
    const currentOptions = getOptionsForEnhancer(enhancer.id);
    createPortal(EnhancerOptionsModal, {
      enhancer,
      options: currentOptions ? {
        targetOptions: currentOptions.targetOptions,
        expressions: currentOptions.expressions ?? void 0,
        requirements: currentOptions.requirements ?? void 0,
        keywordProperty: currentOptions.keywordProperty,
        pretreatKeyword: currentOptions.pretreatKeyword ?? void 0
      } : void 0,
      onSubmit: async (options) => {
        updateEnhancerOptions(enhancer.id, options);
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      classNames: { base: "max-w-[80vw]" },
      size: "2xl",
      title: t2("resourceProfile.modal.selectEnhancersTitle"),
      onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(enhancerOptions),
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-4 gap-2", children: enhancers.map((e2) => {
        const selected = isSelected(e2.id);
        const visibleTargets = e2.targets.slice(0, MAX_VISIBLE_TARGETS);
        const hiddenTargets = e2.targets.slice(MAX_VISIBLE_TARGETS);
        return /* @__PURE__ */ jsxRuntimeExports.jsxs(
          card_default,
          {
            isPressable: true,
            className: `relative ${selected ? "border-2 border-success bg-success/10" : ""}`,
            onPress: () => toggleEnhancer(e2.id),
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-base flex items-center gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer: e2 }),
                  selected && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheckCircle, { className: "text-lg" }) })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "opacity-60", children: e2.description }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-bold", children: [
                    t2("resourceProfile.label.enhanceProperties"),
                    ": "
                  ] }),
                  visibleTargets.map((target) => {
                    if (target.description) {
                      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: target.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "default", radius: "sm", size: "sm", variant: "flat", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
                        target.name,
                        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineQuestionCircle, { className: "text-base" })
                      ] }) }) }, `${e2.id}-${target.name}`);
                    }
                    return /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Chip,
                      {
                        color: "default",
                        radius: "sm",
                        size: "sm",
                        variant: "flat",
                        children: target.name
                      },
                      `${e2.id}-${target.name}`
                    );
                  }),
                  hiddenTargets.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-[360px] flex flex-wrap gap-1", children: hiddenTargets.map((target) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Chip,
                        {
                          color: "default",
                          radius: "sm",
                          size: "sm",
                          variant: "flat",
                          children: target.name
                        },
                        `${e2.id}-hidden-${target.name}`
                      )) }),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "primary", radius: "sm", size: "sm", variant: "flat", children: [
                        "+",
                        hiddenTargets.length,
                        " ",
                        t2("resourceProfile.label.more")
                      ] })
                    }
                  )
                ] }),
                selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "primary",
                    size: "sm",
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, {}),
                    variant: "flat",
                    onClick: (ev) => {
                      ev.stopPropagation();
                      openEnhancerOptions(e2);
                    },
                    children: t2("resourceProfile.action.configure")
                  }
                ) })
              ] }),
              selected && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", radius: "sm", size: "sm", variant: "solid", children: t2("resourceProfile.label.selected") }) })
            ]
          },
          e2.id
        );
      }) })
    }
  );
};
EnhancerSelectorModal.displayName = "EnhancerSelectorModal";
const extensionPresets = {
  video: ["mp4", "mkv", "avi", "wmv", "mov", "flv", "webm", "m4v", "rmvb", "rm"],
  audio: ["mp3", "flac", "wav", "aac", "ogg", "wma", "m4a", "ape"],
  image: ["jpg", "jpeg", "png", "gif", "bmp", "webp", "tiff", "svg"],
  document: ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt"],
  archive: ["zip", "rar", "7z", "tar", "gz"]
};
const PlayableFileSelectorModal = ({ options: propOptions, onSubmit, onDestroyed }) => {
  var _a2, _b2, _c2, _d, _e;
  const { t: t2 } = useTranslation();
  const [options, setOptions2] = reactExports.useState(propOptions ?? {});
  const addPresetExtensions = (preset) => {
    const currentExts = new Set(options.extensions ?? []);
    extensionPresets[preset].forEach((ext) => currentExts.add(ext));
    setOptions2({
      ...options,
      extensions: Array.from(currentExts)
    });
  };
  const clearExtensions = () => {
    setOptions2({
      ...options,
      extensions: []
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "xl",
      title: t2("resourceProfile.modal.playableFileOptionsTitle"),
      onDestroyed,
      onOk: () => onSubmit == null ? void 0 : onSubmit(options),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-2", children: t2("resourceProfile.label.quickAddPresets") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "primary",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => addPresetExtensions("video"),
                children: t2("resourceProfile.label.video")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "secondary",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => addPresetExtensions("audio"),
                children: t2("resourceProfile.label.audio")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "success",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => addPresetExtensions("image"),
                children: t2("resourceProfile.label.image")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "warning",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => addPresetExtensions("document"),
                children: t2("resourceProfile.label.document")
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "default",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: () => addPresetExtensions("archive"),
                children: t2("resourceProfile.label.archive")
              }
            ),
            (((_a2 = options.extensions) == null ? void 0 : _a2.length) ?? 0) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Chip,
              {
                size: "sm",
                color: "danger",
                variant: "flat",
                className: "cursor-pointer hover:opacity-80",
                onClick: clearExtensions,
                children: t2("resourceProfile.action.clearAll")
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            ExtensionsInput,
            {
              defaultValue: options.extensions,
              label: t2("resourceProfile.label.fileExtensions"),
              onValueChange: (v2) => {
                setOptions2({
                  ...options,
                  extensions: v2
                });
              }
            },
            ((_b2 = options.extensions) == null ? void 0 : _b2.join(",")) ?? ""
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
            t2("resourceProfile.tip.filesWithExtensionsPlayable")
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            input_default,
            {
              label: t2("resourceProfile.label.fileNamePattern"),
              placeholder: t2("resourceProfile.input.fileNamePatternPlaceholder"),
              value: options.fileNamePattern || "",
              onValueChange: (v2) => {
                setOptions2({
                  ...options,
                  fileNamePattern: v2 || void 0
                });
              }
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
            t2("resourceProfile.tip.regexPatternPlayable")
          ] })
        ] }),
        ((((_c2 = options.extensions) == null ? void 0 : _c2.length) ?? 0) > 0 || options.fileNamePattern) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-medium mb-2", children: t2("resourceProfile.label.currentConfiguration") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-3 bg-default-100 rounded-lg", children: [
              (((_d = options.extensions) == null ? void 0 : _d.length) ?? 0) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 mb-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500 mr-2", children: [
                  t2("resourceProfile.label.extensionsLabel"),
                  ":"
                ] }),
                (_e = options.extensions) == null ? void 0 : _e.map((ext) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", color: "secondary", variant: "flat", children: [
                  ".",
                  ext
                ] }, ext))
              ] }),
              options.fileNamePattern && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500", children: [
                  t2("resourceProfile.label.pattern"),
                  ":"
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "warning", variant: "flat", children: options.fileNamePattern })
              ] })
            ] })
          ] })
        ] })
      ] })
    }
  );
};
PlayableFileSelectorModal.displayName = "PlayableFileSelectorModal";
const generateCommand = (executablePath, commandTemplate, filePath) => {
  const template2 = commandTemplate || "{0}";
  const args = template2.replace(/\{0\}/g, `"${filePath}"`);
  return `"${executablePath}" ${args}`;
};
const PlayerSelectorModal = ({ players: propPlayers, onSubmit, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [players, setPlayers] = reactExports.useState(
    (propPlayers ?? []).map((p2) => ({ ...p2, pathType: "file", testFilePath: "", testFilePathType: void 0 }))
  );
  const [copiedIndex, setCopiedIndex] = reactExports.useState(null);
  const addPlayer = () => {
    setPlayers([
      ...players,
      {
        executablePath: "",
        command: "{0}",
        extensions: []
      }
    ]);
  };
  const removePlayer = (index2) => {
    const newPlayers = [...players];
    newPlayers.splice(index2, 1);
    setPlayers(newPlayers);
  };
  const updatePlayer = (index2, updates) => {
    const newPlayers = [...players];
    newPlayers[index2] = { ...newPlayers[index2], ...updates };
    setPlayers(newPlayers);
  };
  const validatePlayers = () => {
    return players.every(
      (player) => player.executablePath.trim() !== "" && player.pathType === "file"
    );
  };
  const handleSubmit = () => {
    if (validatePlayers()) {
      onSubmit == null ? void 0 : onSubmit(players.map(({ pathType, ...p2 }) => p2));
    }
  };
  const hasInvalidPlayers = players.some(
    (player) => player.executablePath.trim() === "" || player.pathType !== "file"
  );
  const getPlayerName = (path) => {
    if (!path)
      return t2("resourceProfile.label.newPlayer");
    const segments = splitPathIntoSegments(path);
    return segments[segments.length - 1] || t2("resourceProfile.label.newPlayer");
  };
  const copyCommand = async (index2, command) => {
    try {
      await navigator.clipboard.writeText(command);
      setCopiedIndex(index2);
      setTimeout(() => setCopiedIndex(null), 2e3);
    } catch (err) {
      console.error("Failed to copy command:", err);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      okProps: {
        isDisabled: hasInvalidPlayers
      },
      size: "2xl",
      title: t2("resourceProfile.modal.configurePlayersTitle"),
      onDestroyed,
      onOk: handleSubmit,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500", children: players.length > 0 ? t2("resourceProfile.status.playersConfigured", { count: players.length }) : t2("resourceProfile.status.noPlayersConfigured") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlus, {}),
              onPress: addPlayer,
              children: t2("resourceProfile.action.addPlayer")
            }
          )
        ] }),
        players.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center py-12 bg-default-50 rounded-lg", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: "text-4xl text-default-300 mx-auto mb-3" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-400", children: t2("resourceProfile.empty.noPlayersConfiguredGetStarted") })
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-h-[60vh] overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          accordion_default,
          {
            selectionMode: "multiple",
            variant: "splitted",
            defaultExpandedKeys: players.length === 1 ? ["0"] : [],
            children: players.map((player, index2) => {
              var _a2, _b2;
              const playerName = getPlayerName(player.executablePath);
              const isInvalid = player.executablePath.trim() === "" || player.pathType !== "file";
              return /* @__PURE__ */ jsxRuntimeExports.jsx(
                accordion_item_base_default,
                {
                  "aria-label": playerName,
                  classNames: {
                    base: isInvalid ? "border-danger border-2" : ""
                  },
                  startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: `text-lg ${isInvalid ? "text-danger" : "text-success"}` }),
                  title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: playerName }),
                    (((_a2 = player.extensions) == null ? void 0 : _a2.length) ?? 0) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "flat", color: "default", children: [
                      (_b2 = player.extensions) == null ? void 0 : _b2.length,
                      " ",
                      t2("resourceProfile.label.extensions")
                    ] }),
                    isInvalid && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", color: "danger", children: t2("resourceProfile.label.invalid") })
                  ] }),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 pb-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                      Button,
                      {
                        color: "danger",
                        size: "sm",
                        variant: "flat",
                        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, {}),
                        onPress: () => removePlayer(index2),
                        children: t2("common.action.delete")
                      }
                    ) }),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      PathAutocomplete,
                      {
                        isRequired: true,
                        errorMessage: player.executablePath.trim() === "" ? t2("resourceProfile.error.executablePathRequired") : player.pathType !== "file" ? t2("resourceProfile.error.selectFileNotFolder") : "",
                        isInvalid,
                        label: t2("resourceProfile.label.executablePath"),
                        pathType: "file",
                        placeholder: t2("resourceProfile.tip.pathToPlayerExecutable"),
                        value: player.executablePath,
                        onChange: (value2, type4) => updatePlayer(index2, {
                          executablePath: value2,
                          pathType: type4
                        })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        input_default,
                        {
                          label: t2("resourceProfile.label.commandTemplate"),
                          placeholder: "{0}",
                          value: player.command,
                          onValueChange: (value2) => updatePlayer(index2, { command: value2 })
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
                        t2("resourceProfile.tip.commandTemplatePlaceholder")
                      ] })
                    ] }),
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(
                        ExtensionsInput,
                        {
                          defaultValue: player.extensions,
                          label: t2("resourceProfile.label.supportedExtensions"),
                          onValueChange: (extensions) => updatePlayer(index2, { extensions }),
                          minRows: 1
                        }
                      ),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-400 mt-1", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
                        t2("resourceProfile.tip.playerExtensionUsage")
                      ] })
                    ] }),
                    player.executablePath.trim() && player.pathType === "file" && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
                      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, {}),
                      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
                        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsx(BsTerminal, { className: "text-lg text-primary" }),
                          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-sm", children: t2("resourceProfile.label.commandPreviewTest") })
                        ] }),
                        /* @__PURE__ */ jsxRuntimeExports.jsx(
                          PathAutocomplete,
                          {
                            label: t2("resourceProfile.label.testFilePath"),
                            placeholder: t2("resourceProfile.tip.enterFilePathPreview"),
                            value: player.testFilePath || "",
                            onChange: (value2, type4) => updatePlayer(index2, {
                              testFilePath: value2,
                              testFilePathType: type4
                            })
                          }
                        ),
                        player.testFilePath && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500", children: [
                            t2("resourceProfile.label.generatedCommand"),
                            ":"
                          ] }),
                          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "flex-1 p-2 bg-default-100 rounded text-xs font-mono break-all", children: generateCommand(
                              player.executablePath,
                              player.command || "{0}",
                              player.testFilePath
                            ) }),
                            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: copiedIndex === index2 ? t2("resourceProfile.action.copied") : t2("resourceProfile.action.copyToClipboard"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                              Button,
                              {
                                isIconOnly: true,
                                size: "sm",
                                variant: "flat",
                                color: copiedIndex === index2 ? "success" : "default",
                                onPress: () => copyCommand(
                                  index2,
                                  generateCommand(
                                    player.executablePath,
                                    player.command || "{0}",
                                    player.testFilePath || ""
                                  )
                                ),
                                children: copiedIndex === index2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1l, { className: "text-sm" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-sm" })
                              }
                            ) })
                          ] }),
                          player.testFilePathType === "folder" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-warning", children: [
                            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "mr-1" }),
                            t2("resourceProfile.tip.testPathIsFolder")
                          ] })
                        ] })
                      ] })
                    ] })
                  ] })
                },
                String(index2)
              );
            })
          }
        ) }),
        hasInvalidPlayers && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-danger text-sm flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, {}),
          t2("resourceProfile.error.fillAllExecutablePaths")
        ] })
      ] })
    }
  );
};
PlayerSelectorModal.displayName = "PlayerSelectorModal";
const DeleteEnhancementsModal = ({ profile, onDeleted, onDestroyed }) => {
  var _a2;
  const { t: t2 } = useTranslation();
  const [enhancerDescriptors, setEnhancerDescriptors] = reactExports.useState([]);
  const [selectedEnhancerId, setSelectedEnhancerId] = reactExports.useState("all");
  const [deleteEmptyOnly, setDeleteEmptyOnly] = reactExports.useState(false);
  const [isDeleting, setIsDeleting] = reactExports.useState(false);
  const enhancerOptions = ((_a2 = profile.enhancerOptions) == null ? void 0 : _a2.enhancers) ?? [];
  reactExports.useEffect(() => {
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancerDescriptors(r2.data || []);
    });
  }, []);
  const getEnhancerName = (enhancerId) => {
    const enhancer = enhancerDescriptors.find((e2) => e2.id === enhancerId);
    return (enhancer == null ? void 0 : enhancer.name) ?? `Enhancer ${enhancerId}`;
  };
  const selectDataSource = reactExports.useMemo(() => {
    const options = [
      { value: "all", label: t2("resourceProfile.label.allEnhancers") }
    ];
    enhancerOptions.forEach((opt) => {
      options.push({
        value: String(opt.enhancerId),
        label: getEnhancerName(opt.enhancerId)
      });
    });
    return options;
  }, [enhancerOptions, enhancerDescriptors, t2]);
  const handleDelete = async () => {
    setIsDeleting(true);
    try {
      const baseUrl = "";
      if (selectedEnhancerId === "all") {
        await fetch(
          `${baseUrl}/resource-profile/${profile.id}/enhancement?deleteEmptyOnly=${deleteEmptyOnly}`,
          { method: "DELETE" }
        );
      } else {
        await fetch(
          `${baseUrl}/resource-profile/${profile.id}/enhancer/${selectedEnhancerId}/enhancement?deleteEmptyOnly=${deleteEmptyOnly}`,
          { method: "DELETE" }
        );
      }
      onDeleted == null ? void 0 : onDeleted();
      onDestroyed == null ? void 0 : onDestroyed();
    } catch (e2) {
      console.error("Failed to delete enhancements", e2);
    } finally {
      setIsDeleting(false);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "md",
      title: t2("resourceProfile.modal.deleteEnhancementsTitle"),
      onDestroyed,
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onPress: () => onDestroyed == null ? void 0 : onDestroyed(), children: t2("common.action.cancel") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "danger",
            isLoading: isDeleting,
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, {}),
            onPress: handleDelete,
            children: t2("common.action.delete")
          }
        )
      ] }),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm", children: [
          t2("resourceProfile.tip.deleteEnhancementsForProfile"),
          ":",
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "primary", size: "sm", variant: "flat", children: profile.name })
        ] }),
        enhancerOptions.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm font-medium mb-2 block", children: t2("resourceProfile.label.selectEnhancer") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Select,
            {
              selectedKeys: [selectedEnhancerId],
              dataSource: selectDataSource,
              onSelectionChange: (keys2) => {
                const key = Array.from(keys2)[0];
                setSelectedEnhancerId(key);
              }
            }
          )
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-warning", children: t2("resourceProfile.tip.noEnhancersConfigured") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          checkbox_default,
          {
            isSelected: deleteEmptyOnly,
            onValueChange: setDeleteEmptyOnly,
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("resourceProfile.label.deleteEmptyRecordsOnly") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("resourceProfile.tip.deleteEmptyRecordsOnlyDescription") })
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-danger", children: t2("resourceProfile.warning.cannotBeUndone") })
      ] })
    }
  );
};
DeleteEnhancementsModal.displayName = "DeleteEnhancementsModal";
const TOTAL_SLIDES$1 = 5;
const ResourceProfileGuideModal = ({ visible, onComplete }) => {
  const { t: t2 } = useTranslation();
  const carouselRef = reactExports.useRef(null);
  const [currentSlide, setCurrentSlide] = reactExports.useState(0);
  const isFirst = currentSlide === 0;
  const isLast = currentSlide === TOTAL_SLIDES$1 - 1;
  const handlePrev = () => {
    var _a2;
    (_a2 = carouselRef.current) == null ? void 0 : _a2.prev();
  };
  const handleNext = () => {
    var _a2;
    if (isLast) {
      onComplete();
    } else {
      (_a2 = carouselRef.current) == null ? void 0 : _a2.next();
    }
  };
  const handleSkip = () => {
    onComplete();
  };
  const handleSlideChange = (current) => {
    setCurrentSlide(current);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      hideCloseButton: true,
      classNames: {
        base: "max-w-[800px]"
      },
      footer: false,
      isDismissable: false,
      isKeyboardDismissDisabled: true,
      size: "4xl",
      visible,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Carousel, { ref: carouselRef, afterChange: handleSlideChange, dots: false, infinite: false, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center p-8 min-h-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-24 h-24 mb-6 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-6xl text-primary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-3xl font-bold mb-4 text-center", children: t2("resourceProfileGuide.welcome.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-default-500 text-center max-w-lg", children: t2("resourceProfileGuide.welcome.description") })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-secondary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-5xl text-secondary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2 text-center", children: t2("resourceProfileGuide.matching.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("resourceProfileGuide.matching.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-4 max-w-md w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSearch, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.matching.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineOrderedList, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.matching.point2") })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-warning/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-5xl text-warning" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2 text-center", children: t2("resourceProfileGuide.display.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("resourceProfileGuide.display.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-4 max-w-md w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineEdit, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.display.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineThunderbolt, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.display.point2") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAppstore, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.display.point3") })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-success/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-5xl text-success" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2 text-center", children: t2("resourceProfileGuide.playback.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("resourceProfileGuide.playback.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-4 max-w-md w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.playback.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.playback.point2") })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center p-8 min-h-[400px]", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-20 h-20 mb-6 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLink, { className: "text-5xl text-primary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-2xl font-bold mb-2 text-center", children: t2("resourceProfileGuide.binding.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-500 text-center mb-6 max-w-md", children: t2("resourceProfileGuide.binding.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-4 max-w-md w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLink, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.binding.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-start gap-3 p-3 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePushpin, { className: "text-xl" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 pt-1", children: t2("resourceProfileGuide.binding.point2") })
              ] })
            ] })
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center gap-2 py-4", children: Array.from({ length: TOTAL_SLIDES$1 }).map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `w-2 h-2 rounded-full transition-all ${index2 === currentSlide ? "bg-primary w-6" : "bg-default-300"}`
          },
          index2
        )) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center px-6 pb-6", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onPress: handleSkip, children: t2("resourceProfileGuide.skip") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isDisabled: isFirst, variant: "flat", onPress: handlePrev, children: t2("resourceProfileGuide.previous") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleNext, children: isLast ? t2("resourceProfileGuide.getStarted") : t2("resourceProfileGuide.next") })
          ] })
        ] })
      ] })
    }
  );
};
const GUIDE_KEY$1 = "bakabase-resource-profile-guide-completed";
const useResourceProfileGuide = () => {
  const [showGuide, setShowGuide] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (typeof window === "undefined" || typeof localStorage === "undefined") {
      return;
    }
    const completed = localStorage.getItem(GUIDE_KEY$1);
    if (!completed) {
      setShowGuide(true);
    }
  }, []);
  const completeGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.setItem(GUIDE_KEY$1, "true");
    }
    setShowGuide(false);
  }, []);
  const resetGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.removeItem(GUIDE_KEY$1);
    }
    setShowGuide(true);
  }, []);
  return {
    showGuide,
    completeGuide,
    resetGuide
  };
};
const parseTemplateSegments = (template2, validPropertyNames) => {
  const segments = [];
  const regex2 = /\{([^}]+)\}/g;
  let lastIndex = 0;
  let match5;
  while ((match5 = regex2.exec(template2)) !== null) {
    if (match5.index > lastIndex) {
      segments.push({ type: "text", content: template2.slice(lastIndex, match5.index) });
    }
    const propName = match5[1];
    const isValid3 = validPropertyNames.has(propName);
    segments.push({ type: isValid3 ? "valid" : "invalid", content: propName });
    lastIndex = regex2.lastIndex;
  }
  if (lastIndex < template2.length) {
    segments.push({ type: "text", content: template2.slice(lastIndex) });
  }
  return segments;
};
const toProfileInputModel = (profile) => {
  return {
    name: profile.name ?? "",
    search: profile.search ? toSearchInputModel(profile.search) : null,
    nameTemplate: profile.nameTemplate ?? null,
    enhancerOptions: profile.enhancerOptions ?? null,
    playableFileOptions: profile.playableFileOptions ?? null,
    playerOptions: profile.playerOptions ?? null,
    propertyOptions: profile.propertyOptions ?? null,
    priority: profile.priority ?? 0
  };
};
const ResourceProfilePage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { showGuide, completeGuide, resetGuide } = useResourceProfileGuide();
  const [profiles, setProfiles] = reactExports.useState([]);
  const [keyword, setKeyword] = reactExports.useState("");
  const [loading, setLoading] = reactExports.useState(true);
  const [properties2, setProperties] = reactExports.useState([]);
  const [enhancerDescriptors, setEnhancerDescriptors] = reactExports.useState([]);
  const [editingProfileIds, setEditingProfileIds] = reactExports.useState(/* @__PURE__ */ new Set());
  const [pendingFilterGroups, setPendingFilterGroups] = reactExports.useState(/* @__PURE__ */ new Map());
  const profilesRef = reactExports.useRef(profiles);
  profilesRef.current = profiles;
  const loadProfiles = async () => {
    setLoading(true);
    try {
      const rsp = await BApi$1.resourceProfile.getAllResourceProfiles();
      setProfiles((rsp.data || []).sort((a2, b2) => b2.priority - a2.priority));
    } catch (e2) {
      console.error("Failed to load resource profiles", e2);
    } finally {
      setLoading(false);
    }
  };
  reactExports.useEffect(() => {
    loadProfiles();
    BApi$1.property.getPropertiesByPool(PropertyPool.All).then((r2) => {
      setProperties(r2.data || []);
    });
    BApi$1.enhancer.getAllEnhancerDescriptors().then((r2) => {
      setEnhancerDescriptors(r2.data || []);
    });
  }, []);
  const filteredProfiles = profiles.filter(
    (p2) => {
      var _a2;
      return keyword === "" || ((_a2 = p2.name) == null ? void 0 : _a2.toLowerCase().includes(keyword.toLowerCase()));
    }
  );
  const handleDelete = async (id2) => {
    if (!window.confirm(t2("resourceProfile.confirm.delete"))) {
      return;
    }
    try {
      await BApi$1.resourceProfile.deleteResourceProfile(id2);
      loadProfiles();
    } catch (e2) {
      console.error("Failed to delete resource profile", e2);
    }
  };
  const handleDuplicate = async (profile) => {
    try {
      const inputModel = toProfileInputModel({
        ...profile,
        name: `${profile.name} (Copy)`
      });
      await BApi$1.resourceProfile.addResourceProfile(inputModel);
      loadProfiles();
    } catch (e2) {
      console.error("Failed to duplicate resource profile", e2);
    }
  };
  const handleTest = (profile) => {
    createPortal(ResourceProfileTestModal, {
      profile
    });
  };
  const updateProfile = async (profileOrId, updates) => {
    try {
      const id2 = typeof profileOrId === "number" ? profileOrId : profileOrId.id;
      const currentProfile = profilesRef.current.find((p2) => p2.id === id2);
      if (!currentProfile) {
        console.error("Profile not found", id2);
        return;
      }
      const merged = { ...currentProfile, ...updates };
      const inputModel = toProfileInputModel(merged);
      await BApi$1.resourceProfile.updateResourceProfile(id2, inputModel);
      loadProfiles();
    } catch (e2) {
      console.error("Failed to update resource profile", e2);
    }
  };
  const renderNameTemplate = (profile) => {
    const hasTemplate = !!profile.nameTemplate;
    const openModal = () => {
      createPortal(DisplayNameTemplateEditorModal, {
        template: profile.nameTemplate,
        properties: properties2,
        onSubmit: (template2) => {
          updateProfile(profile, { nameTemplate: template2 || void 0 });
        }
      });
    };
    if (!hasTemplate) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          className: "min-w-0 px-2 h-auto py-1",
          onPress: openModal,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50 flex-shrink-0" })
          ]
        }
      );
    }
    const builtinNames = builtinPropertyForDisplayNames.map(
      (v2) => t2(getEnumKey("BuiltinPropertyForDisplayName", v2.label))
    );
    const customNames = properties2.map((p2) => p2.name);
    const validPropertyNames = /* @__PURE__ */ new Set([...builtinNames, ...customNames]);
    const segments = parseTemplateSegments(profile.nameTemplate, validPropertyNames);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(
      Button,
      {
        size: "sm",
        variant: "light",
        className: "min-w-0 px-2 h-auto py-1 flex-wrap",
        onPress: openModal,
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-left flex flex-wrap items-center gap-0.5", children: segments.map((seg, idx) => {
            if (seg.type === "text") {
              return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: seg.content }, idx);
            }
            if (seg.type === "valid") {
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "primary", variant: "flat", className: "h-5 px-1 text-xs", children: seg.content }, idx);
            }
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", color: "danger", variant: "flat", className: "h-5 px-1 text-xs", children: seg.content }, idx);
          }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50 flex-shrink-0" })
        ]
      }
    );
  };
  const renderEnhancers = (profile) => {
    var _a2;
    const enhancerOptions = ((_a2 = profile.enhancerOptions) == null ? void 0 : _a2.enhancers) ?? [];
    const hasEnhancers = enhancerOptions.length > 0;
    const openEnhancerModal = () => {
      createPortal(EnhancerSelectorModal, {
        enhancerOptions,
        onSubmit: (options) => {
          updateProfile(profile, {
            enhancerOptions: options.length > 0 ? { enhancers: options } : void 0
          });
        }
      });
    };
    if (!hasEnhancers) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resourceProfile.tip.configureEnhancers"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          className: "min-w-0",
          onPress: openEnhancerModal,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50" })
          ]
        }
      ) });
    }
    const selectedEnhancers = enhancerOptions.map((opt) => enhancerDescriptors.find((e2) => e2.id === opt.enhancerId)).filter((e2) => e2 != null);
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: selectedEnhancers.map((enhancer) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        size: "sm",
        variant: "light",
        className: "min-w-0 h-auto py-1 px-2",
        onPress: openEnhancerModal,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(BriefEnhancer, { enhancer })
      },
      enhancer.id
    )) });
  };
  const renderPlayableFiles = (profile) => {
    var _a2, _b2;
    const options = profile.playableFileOptions;
    const hasOptions = !!(((_a2 = options == null ? void 0 : options.extensions) == null ? void 0 : _a2.length) || (options == null ? void 0 : options.fileNamePattern));
    const openModal = () => {
      createPortal(PlayableFileSelectorModal, {
        options: profile.playableFileOptions,
        onSubmit: (opts2) => {
          var _a3;
          const hasOpts = !!(((_a3 = opts2.extensions) == null ? void 0 : _a3.length) || opts2.fileNamePattern);
          updateProfile(profile, {
            playableFileOptions: hasOpts ? opts2 : void 0
          });
        }
      });
    };
    if (!hasOptions) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          className: "min-w-0",
          onPress: openModal,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50" })
          ]
        }
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
      (_b2 = options == null ? void 0 : options.extensions) == null ? void 0 : _b2.map((ext) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          size: "sm",
          color: "secondary",
          variant: "flat",
          className: "cursor-pointer h-5 text-xs",
          onClick: openModal,
          children: ext
        },
        ext
      )),
      (options == null ? void 0 : options.fileNamePattern) && /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          size: "sm",
          color: "warning",
          variant: "flat",
          className: "cursor-pointer h-5 text-xs",
          onClick: openModal,
          children: options.fileNamePattern
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "min-w-0 w-6 h-6",
          onPress: openModal,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-xs opacity-50" })
        }
      )
    ] });
  };
  const renderPlayers = (profile) => {
    var _a2;
    const players = ((_a2 = profile.playerOptions) == null ? void 0 : _a2.players) ?? [];
    const hasPlayers = players.length > 0;
    const openModal = () => {
      createPortal(PlayerSelectorModal, {
        players,
        onSubmit: async (newPlayers) => {
          updateProfile(profile, {
            playerOptions: newPlayers.length > 0 ? { players: newPlayers } : void 0
          });
        }
      });
    };
    if (!hasPlayers) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          className: "min-w-0",
          onPress: openModal,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50" })
          ]
        }
      );
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
      players.map((player, index2) => {
        var _a3, _b2;
        const executablePathSegments = splitPathIntoSegments(player.executablePath);
        const playerName = executablePathSegments[executablePathSegments.length - 1];
        const extCount = ((_a3 = player.extensions) == null ? void 0 : _a3.length) ?? 0;
        return /* @__PURE__ */ jsxRuntimeExports.jsx(
          Tooltip$1,
          {
            content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium", children: playerName }),
              extCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: (_b2 = player.extensions) == null ? void 0 : _b2.map((ext) => /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: ext }, ext)) })
            ] }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Chip,
              {
                size: "sm",
                color: "success",
                variant: "flat",
                className: "cursor-pointer h-5 text-xs",
                onClick: openModal,
                startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(BsController, { className: "text-xs" }),
                children: [
                  playerName,
                  extCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "ml-1 opacity-60", children: [
                    "(",
                    extCount,
                    ")"
                  ] })
                ]
              }
            )
          },
          index2
        );
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "min-w-0 w-6 h-6",
          onPress: openModal,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-xs opacity-50" })
        }
      )
    ] });
  };
  const renderProperties = (profile) => {
    var _a2;
    const propertyRefs = ((_a2 = profile.propertyOptions) == null ? void 0 : _a2.properties) ?? [];
    const hasProperties = propertyRefs.length > 0;
    const openModal = () => {
      createPortal(PropertySelector, {
        v2: true,
        pool: PropertyPool.Reserved | PropertyPool.Custom,
        multiple: true,
        selection: propertyRefs.map((ref) => ({ pool: ref.pool, id: ref.id })),
        onSubmit: async (selectedProperties2) => {
          const newRefs = selectedProperties2.map((p2) => ({ pool: p2.pool, id: p2.id }));
          updateProfile(profile, {
            propertyOptions: newRefs.length > 0 ? { properties: newRefs } : void 0
          });
        }
      });
    };
    if (!hasProperties) {
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Button,
        {
          size: "sm",
          variant: "light",
          className: "min-w-0",
          onPress: openModal,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "-" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "ml-1 text-xs opacity-50" })
          ]
        }
      );
    }
    const selectedProperties = propertyRefs.map((ref) => properties2.find((p2) => p2.pool === ref.pool && p2.id === ref.id)).filter((p2) => p2 != null);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1 items-center", children: [
      selectedProperties.map((property2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        Chip,
        {
          size: "sm",
          color: "secondary",
          variant: "flat",
          className: "cursor-pointer h-5 text-xs",
          onClick: openModal,
          children: property2.name
        },
        `${property2.pool}-${property2.id}`
      )),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          className: "min-w-0 w-6 h-6",
          onPress: openModal,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-xs opacity-50" })
        }
      )
    ] });
  };
  const columns = [
    {
      key: "priority",
      label: t2("resourceProfile.label.priority"),
      description: t2("resourceProfile.tip.priority"),
      width: 80
    },
    {
      key: "name",
      label: t2("resourceProfile.label.name"),
      description: t2("resourceProfile.tip.name"),
      width: 150
    },
    {
      key: "search",
      label: t2("resourceProfile.label.searchCriteria"),
      description: t2("resourceProfile.tip.searchCriteria"),
      render: (profile) => {
        var _a2, _b2;
        const savedGroup = ((_a2 = profile.search) == null ? void 0 : _a2.group) ?? { combinator: 1, disabled: false };
        const isEditing = editingProfileIds.has(profile.id);
        const group = isEditing && pendingFilterGroups.has(profile.id) ? pendingFilterGroups.get(profile.id) : savedGroup;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              ResourceFilterController,
              {
                group,
                onGroupChange: (newGroup) => {
                  setPendingFilterGroups((prev2) => {
                    const next2 = new Map(prev2);
                    next2.set(profile.id, newGroup);
                    return next2;
                  });
                },
                defaultFilterDisplayMode: FilterDisplayMode.Simple,
                filterLayout: "horizontal",
                isReadonly: !isEditing,
                autoCreateMediaLibraryFilter: true
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: isEditing ? t2("common.action.save") : t2("common.action.edit"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                size: "sm",
                variant: "light",
                color: isEditing ? "success" : "default",
                onPress: () => {
                  if (isEditing) {
                    const pendingGroup = pendingFilterGroups.get(profile.id);
                    if (pendingGroup) {
                      updateProfile(profile, {
                        search: {
                          ...profile.search,
                          group: pendingGroup
                        }
                      });
                      setPendingFilterGroups((prev2) => {
                        const next2 = new Map(prev2);
                        next2.delete(profile.id);
                        return next2;
                      });
                    }
                    setEditingProfileIds((prev2) => {
                      const next2 = new Set(prev2);
                      next2.delete(profile.id);
                      return next2;
                    });
                  } else {
                    setEditingProfileIds((prev2) => {
                      const next2 = new Set(prev2);
                      next2.add(profile.id);
                      return next2;
                    });
                  }
                },
                children: isEditing ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1l, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, {})
              }
            ) })
          ] }),
          ((_b2 = profile.search) == null ? void 0 : _b2.tags) && profile.search.tags.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: profile.search.tags.map((tag) => {
            var _a3;
            return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", color: "warning", children: t2(getEnumKey("ResourceTag", (_a3 = resourceTags.find((rt) => rt.value === tag)) == null ? void 0 : _a3.label)) }, tag);
          }) })
        ] });
      }
    },
    {
      key: "nameTemplate",
      label: t2("resourceProfile.label.nameTemplate"),
      description: t2("resourceProfile.tip.nameTemplate"),
      render: renderNameTemplate
    },
    {
      key: "enhancers",
      label: t2("resourceProfile.label.enhancers"),
      description: /* @__PURE__ */ jsxRuntimeExports.jsx(EnhancerDescription, {}),
      width: 130,
      render: renderEnhancers
    },
    {
      key: "playableFiles",
      label: t2("resourceProfile.label.playableFiles"),
      description: t2("resourceProfile.tip.playableFiles"),
      width: 130,
      render: renderPlayableFiles
    },
    {
      key: "players",
      label: t2("resourceProfile.label.players"),
      description: t2("resourceProfile.tip.players"),
      width: 200,
      render: renderPlayers
    },
    {
      key: "properties",
      label: t2("resourceProfile.label.properties"),
      description: t2("resourceProfile.tip.properties"),
      width: 200,
      render: renderProperties
    },
    {
      key: "actions",
      label: t2("resourceProfile.label.actions"),
      width: 180,
      render: (profile) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resourceProfile.action.testCriteria"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => handleTest(profile),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$O, {})
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resourceProfile.action.editBasicInfo"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => {
              createPortal(ResourceProfileModal, {
                profile,
                onSaved: loadProfiles,
                onUpdate: updateProfile
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, {})
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resourceProfile.action.duplicate"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => handleDuplicate(profile),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, {})
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          PopoverComponent,
          {
            placement: "bottom-end",
            trigger: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$p, {}) }),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              listbox_default,
              {
                "aria-label": "More actions",
                onAction: (key) => {
                  switch (key) {
                    case "delete-enhancements":
                      createPortal(DeleteEnhancementsModal, {
                        profile
                      });
                      break;
                    case "delete":
                      handleDelete(profile.id);
                      break;
                  }
                },
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_base_default,
                    {
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, {}),
                      color: "warning",
                      children: t2("resourceProfile.action.deleteEnhancements")
                    },
                    "delete-enhancements"
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    listbox_item_base_default,
                    {
                      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, {}),
                      color: "danger",
                      className: "text-danger",
                      children: t2("common.action.delete")
                    },
                    "delete"
                  )
                ]
              }
            )
          }
        )
      ] })
    }
  ];
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ResourceProfileGuideModal,
      {
        visible: showGuide,
        onComplete: completeGuide
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}),
            className: "tour-add-profile",
            onPress: () => {
              createPortal(ResourceProfileModal, {
                existingNames: profiles.map((p2) => p2.name),
                onSaved: loadProfiles
              });
            },
            children: t2("resourceProfile.action.addProfile")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("resourceProfileGuide.viewAgain"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: resetGuide,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base" })
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            size: "sm",
            placeholder: t2("resourceProfile.action.searchByName"),
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1j, { className: "text-small" }),
            value: keyword,
            onValueChange: setKeyword,
            className: "w-64"
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-sm text-default-500", children: [
        t2("resourceProfile.label.total"),
        ": ",
        filteredProfiles.length
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      table_default,
      {
        "aria-label": "Resource Profiles Table",
        isHeaderSticky: true,
        removeWrapper: true,
        className: "tour-profile-table",
        classNames: {
          wrapper: "max-h-[calc(100vh-200px)]"
        },
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { children: columns.map((column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            table_column_default,
            {
              width: column2.width,
              "data-tour": column2.description ? `col-${column2.key}` : void 0,
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
                column2.label,
                column2.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: column2.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-xs opacity-50 cursor-help" }) })
              ] })
            },
            column2.key
          )) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { isLoading: loading, loadingContent: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { label: t2("resourceProfile.status.loading") }), emptyContent: t2("resourceProfile.empty.noProfiles"), children: filteredProfiles.map((profile) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_row_default, { children: columns.map((column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: column2.render ? column2.render(profile) : String(profile[column2.key] ?? "") }, column2.key)) }, profile.id)) })
        ]
      }
    )
  ] });
};
ResourceProfilePage.displayName = "ResourceProfilePage";
const parseMarkConfig = (configJson) => {
  try {
    const config2 = JSON.parse(configJson || "{}");
    return {
      matchMode: config2.matchMode ?? PathMatchMode.Layer,
      layer: config2.layer ?? 0,
      regex: config2.regex ?? "",
      applyScope: config2.applyScope ?? PathMarkApplyScope.MatchedOnly,
      propertyPool: config2.pool,
      propertyId: config2.propertyId,
      valueType: config2.valueType ?? PropertyValueType.Fixed,
      fixedValue: config2.fixedValue ?? "",
      valueMatchMode: config2.valueRegex ? PathMatchMode.Regex : PathMatchMode.Layer,
      valueLayer: config2.valueLayer ?? 0,
      valueRegex: config2.valueRegex ?? "",
      fsTypeFilter: config2.fsTypeFilter,
      extensions: config2.extensions ?? [],
      extensionGroupIds: config2.extensionGroupIds ?? [],
      isResourceBoundary: config2.isResourceBoundary ?? false,
      mediaLibraryId: config2.mediaLibraryId,
      mediaLibraryValueType: config2.valueType ?? PropertyValueType.Fixed,
      layerToMediaLibrary: config2.layerToMediaLibrary ?? 0,
      regexToMediaLibrary: config2.regexToMediaLibrary ?? ""
    };
  } catch {
    return {
      matchMode: PathMatchMode.Layer,
      layer: 0,
      applyScope: PathMarkApplyScope.MatchedOnly,
      valueType: PropertyValueType.Fixed,
      valueMatchMode: PathMatchMode.Layer,
      valueLayer: 0
    };
  }
};
const buildConfigJson = (config2, markType) => {
  if (markType === PathMarkType.Resource) {
    return JSON.stringify({
      matchMode: config2.matchMode,
      layer: config2.layer,
      regex: config2.regex,
      fsTypeFilter: config2.fsTypeFilter,
      extensions: config2.extensions,
      extensionGroupIds: config2.extensionGroupIds,
      applyScope: config2.applyScope ?? PathMarkApplyScope.MatchedOnly,
      isResourceBoundary: config2.isResourceBoundary ?? false
    });
  } else if (markType === PathMarkType.MediaLibrary) {
    return JSON.stringify({
      matchMode: config2.matchMode,
      layer: config2.layer,
      regex: config2.regex,
      valueType: config2.mediaLibraryValueType,
      mediaLibraryId: config2.mediaLibraryValueType === PropertyValueType.Fixed ? config2.mediaLibraryId : void 0,
      layerToMediaLibrary: config2.mediaLibraryValueType === PropertyValueType.Dynamic ? config2.layerToMediaLibrary : void 0,
      regexToMediaLibrary: config2.mediaLibraryValueType === PropertyValueType.Dynamic ? config2.regexToMediaLibrary : void 0,
      applyScope: config2.applyScope ?? PathMarkApplyScope.MatchedOnly
    });
  } else {
    return JSON.stringify({
      matchMode: config2.matchMode,
      layer: config2.layer,
      regex: config2.regex,
      pool: config2.propertyPool,
      propertyId: config2.propertyId,
      valueType: config2.valueType,
      fixedValue: config2.fixedValue,
      valueLayer: config2.valueLayer,
      valueRegex: config2.valueMatchMode === PathMatchMode.Regex ? config2.valueRegex : void 0,
      applyScope: config2.applyScope ?? PathMarkApplyScope.MatchedOnly
    });
  }
};
const markTypeKey = (markType) => {
  switch (markType) {
    case PathMarkType.Resource:
      return "resource";
    case PathMarkType.Property:
      return "property";
    case PathMarkType.MediaLibrary:
      return "mediaLibrary";
    default:
      return "resource";
  }
};
const MatchModeSelector = ({ config: config2, updateConfig, t: t2, markType }) => {
  const isLayerMode = config2.matchMode === PathMatchMode.Layer;
  const currentApplyScope = config2.applyScope ?? PathMarkApplyScope.MatchedOnly;
  const typeKey = markTypeKey(markType);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        radio_group_default,
        {
          value: String(config2.matchMode),
          onValueChange: (value2) => updateConfig({ matchMode: Number(value2) }),
          size: "sm",
          orientation: "horizontal",
          label: t2("pathMarkConfig.label.matchMode"),
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PathMatchMode.Layer), children: t2("pathMarkConfig.label.layer") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PathMatchMode.Regex), children: t2("pathMarkConfig.label.regex") })
          ]
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400", children: t2(`pathMark.${typeKey}.matchMode.description`) })
    ] }),
    isLayerMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        label: t2("pathMarkConfig.label.layer"),
        description: t2("pathMark.layer.description"),
        size: "sm",
        value: config2.layer ?? 0,
        onChange: (e2) => updateConfig({ layer: typeof e2 === "number" ? e2 : e2.target.value ? parseInt(e2.target.value, 10) : 0 })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        label: t2("pathMarkConfig.label.regexPattern"),
        description: t2("pathMark.regex.description"),
        size: "sm",
        value: config2.regex ?? "",
        onValueChange: (v2) => updateConfig({ regex: v2 })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
      radio_group_default,
      {
        value: String(currentApplyScope),
        onValueChange: (value2) => updateConfig({ applyScope: Number(value2) }),
        size: "sm",
        label: t2("pathMarkConfig.label.applyScope"),
        orientation: "horizontal",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            radio_default,
            {
              value: String(PathMarkApplyScope.MatchedOnly),
              description: t2(`pathMark.${typeKey}.applyScope.matchedOnly.description`),
              children: t2("pathMarkConfig.label.matchedOnly")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            radio_default,
            {
              value: String(PathMarkApplyScope.MatchedAndSubdirectories),
              description: t2(`pathMark.${typeKey}.applyScope.matchedAndSubdirectories.description`),
              children: t2("pathMarkConfig.label.matchedAndSubdirectories")
            }
          )
        ]
      }
    ) })
  ] });
};
MatchModeSelector.displayName = "MatchModeSelector";
const PreviewResults = ({ loading, results, resultsByPath, isMultiplePaths, error: error2, markType, t: t2, applyScope }) => {
  const showSubdirectoriesSuffix = applyScope === PathMarkApplyScope.MatchedAndSubdirectories;
  if (loading) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm text-default-500 py-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.status.loadingPreview") })
    ] });
  }
  if (error2) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-danger py-2", children: error2 });
  }
  if (results.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-warning-50 text-warning-600 rounded p-2 text-xs", children: t2("pathMarkConfig.warning.noMatches") });
  }
  const renderSubdirectoriesSuffix = () => {
    if (!showSubdirectoriesSuffix)
      return null;
    return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-primary-500 italic ml-1", children: t2("pathMarkConfig.label.andAllSubdirectories") });
  };
  const renderResult = (result, idx) => {
    const pathSegments = result.path.split(/[/\\]/).filter(Boolean);
    const separator = result.path.includes("/") ? "/" : "\\";
    if (markType === PathMarkType.Resource && result.resourceLayerIndex !== null && result.resourceLayerIndex !== void 0) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-600 break-all", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2 flex-wrap", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-0.5 flex-wrap", children: [
        pathSegments.map((segment, segIdx) => {
          const isResourceLayer = segIdx === result.resourceLayerIndex;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-0.5", children: [
            segIdx > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: separator }),
            isResourceLayer ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                Chip,
                {
                  size: "sm",
                  color: "success",
                  variant: "flat",
                  className: "font-semibold",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceTerm, { size: "sm" })
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: segment })
            ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: segment })
          ] }, segIdx);
        }),
        renderSubdirectoriesSuffix()
      ] }) }) }, idx);
    }
    if (markType === PathMarkType.Property) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-600 break-all", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "break-all", children: [
          result.path,
          renderSubdirectoriesSuffix()
        ] }),
        result.propertyValue !== null && result.propertyValue !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            size: "sm",
            color: "primary",
            variant: "flat",
            className: "flex-shrink-0",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-semibold", children: [
              t2("pathMarkConfig.label.propertyValue"),
              ": ",
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: result.propertyValue })
            ] })
          }
        )
      ] }) }, idx);
    }
    if (markType === PathMarkType.MediaLibrary) {
      return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-600 break-all", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "break-all", children: [
          result.path,
          renderSubdirectoriesSuffix()
        ] }),
        result.propertyValue !== null && result.propertyValue !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            size: "sm",
            color: "secondary",
            variant: "flat",
            className: "flex-shrink-0",
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-semibold", children: [
              t2("common.label.mediaLibrary"),
              ": ",
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold", children: result.propertyValue })
            ] })
          }
        )
      ] }) }, idx);
    }
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-600 break-all", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
      result.path,
      renderSubdirectoriesSuffix()
    ] }) }, idx);
  };
  if (isMultiplePaths && resultsByPath && resultsByPath.length > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-default-100 rounded p-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500 mb-1", children: [
        t2("pathMarkConfig.label.previewMatches"),
        ":"
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 max-h-48 overflow-y-auto", children: resultsByPath.map((group, groupIdx) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-l-2 border-primary-200 pl-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-primary-600 font-medium mb-1 break-all", children: group.path }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: group.results.map((result, idx) => renderResult(result, idx)) })
      ] }, groupIdx)) })
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-default-100 rounded p-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500 mb-1", children: [
      t2("pathMarkConfig.label.previewMatches"),
      ":"
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 max-h-32 overflow-y-auto", children: results.map((result, idx) => renderResult(result, idx)) })
  ] });
};
PreviewResults.displayName = "PreviewResults";
const ResourceMarkConfig = ({ config: config2, updateConfig, t: t2, priority, onPriorityChange, preview }) => {
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-primary-50 text-primary-700 rounded p-2 text-xs", children: t2("pathMark.resource.explanation") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MatchModeSelector,
      {
        config: config2,
        updateConfig,
        t: t2,
        markType: PathMarkType.Resource
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-default-600", children: t2("pathMarkConfig.label.resourceFilters") }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          label: t2("pathMarkConfig.label.fileTypeFilter"),
          size: "sm",
          className: "flex-1",
          dataSource: [
            { label: t2("common.label.all"), value: "" },
            ...pathFilterFsTypes.map((t22) => ({ label: t22.label, value: String(t22.value) }))
          ],
          selectedKeys: config2.fsTypeFilter ? [String(config2.fsTypeFilter)] : [""],
          onSelectionChange: (keys2) => {
            const key = Array.from(keys2)[0];
            updateConfig({ fsTypeFilter: key ? parseInt(key, 10) : void 0 });
          }
        }
      ),
      (config2.fsTypeFilter === void 0 || config2.fsTypeFilter === PathFilterFsType$1.File) && /* @__PURE__ */ jsxRuntimeExports.jsx(
        ExtensionGroupSelect,
        {
          value: config2.extensionGroupIds,
          onSelectionChange: (ids2) => updateConfig({ extensionGroupIds: ids2 }),
          size: "sm",
          className: "flex-1"
        }
      )
    ] }),
    (config2.fsTypeFilter === void 0 || config2.fsTypeFilter === PathFilterFsType$1.File) && /* @__PURE__ */ jsxRuntimeExports.jsx(
      ExtensionsInput,
      {
        defaultValue: config2.extensions,
        label: t2("pathMarkConfig.label.limitExtensions"),
        onValueChange: (v2) => updateConfig({ extensions: v2 }),
        minRows: 1,
        size: "sm"
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      PreviewResults,
      {
        loading: preview.loading,
        results: preview.results,
        resultsByPath: preview.resultsByPath,
        isMultiplePaths: preview.isMultiplePaths,
        error: preview.error,
        markType: PathMarkType.Resource,
        t: t2,
        applyScope: preview.applyScope
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      switch_default,
      {
        size: "sm",
        isSelected: config2.isResourceBoundary ?? false,
        onValueChange: (v2) => updateConfig({ isResourceBoundary: v2 }),
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t2("pathMark.resource.isResourceBoundary") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("pathMark.resource.isResourceBoundary.description") })
        ] })
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        label: t2("common.label.priority"),
        description: t2("pathMark.priority.description"),
        size: "sm",
        value: priority,
        onValueChange: (v2) => onPriorityChange(v2 ?? 10)
      }
    ) })
  ] });
};
ResourceMarkConfig.displayName = "ResourceMarkConfig";
const PropertyMarkConfig = ({ config: config2, updateConfig, t: t2, priority, onPriorityChange, preview }) => {
  const { createPortal } = useBakabaseContext();
  const [selectedProperty, setSelectedProperty] = reactExports.useState(null);
  reactExports.useEffect(() => {
    const loadProperty = async () => {
      if (config2.propertyId && config2.propertyPool) {
        try {
          const properties2 = (await BApi$1.property.getPropertiesByPool(config2.propertyPool)).data || [];
          const property2 = properties2.find((p2) => p2.id === config2.propertyId);
          if (property2) {
            setSelectedProperty(property2);
          }
        } catch (e2) {
          console.error("Failed to load property", e2);
        }
      }
    };
    loadProperty();
  }, []);
  const handleSelectProperty = () => {
    createPortal(PropertySelector, {
      v2: true,
      pool: PropertyPool.Custom | PropertyPool.Reserved,
      multiple: false,
      onSubmit: async (properties2) => {
        if (properties2.length > 0) {
          const property2 = properties2[0];
          setSelectedProperty(property2);
          updateConfig({
            propertyPool: property2.pool,
            propertyId: property2.id
          });
        }
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-primary-50 text-primary-700 rounded p-2 text-xs", children: t2("pathMark.property.explanation") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-warning-50 text-warning-700 rounded p-2 text-xs", children: t2("pathMark.property.importantNote") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MatchModeSelector,
      {
        config: config2,
        updateConfig,
        t: t2,
        markType: PathMarkType.Property
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      PreviewResults,
      {
        loading: preview.loading,
        results: preview.results,
        resultsByPath: preview.resultsByPath,
        isMultiplePaths: preview.isMultiplePaths,
        error: preview.error,
        markType: PathMarkType.Property,
        t: t2,
        applyScope: preview.applyScope
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-default-200 pt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-default-600", children: t2("pathMarkConfig.label.propertySettings") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 mt-1", children: t2("pathMark.property.configDescription") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t2("pathMarkConfig.label.targetProperty") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        selectedProperty ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          Chip,
          {
            color: "primary",
            variant: "flat",
            onClose: () => {
              setSelectedProperty(null);
              updateConfig({ propertyPool: void 0, propertyId: void 0 });
            },
            children: selectedProperty.name
          }
        ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400", children: t2("pathMarkConfig.empty.noPropertySelected") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "sm",
            variant: "flat",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, {}),
            onPress: handleSelectProperty,
            children: selectedProperty ? t2("common.action.change") : t2("pathMarkConfig.action.selectProperty")
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("pathMarkConfig.label.valueType") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        radio_group_default,
        {
          value: String(config2.valueType ?? PropertyValueType.Fixed),
          onValueChange: (value2) => updateConfig({ valueType: Number(value2) }),
          size: "sm",
          orientation: "horizontal",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PropertyValueType.Fixed), children: t2("pathMarkConfig.label.fixed") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PropertyValueType.Dynamic), children: t2("pathMarkConfig.label.dynamic") })
          ]
        }
      )
    ] }),
    config2.valueType === PropertyValueType.Fixed ? /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        label: t2("pathMarkConfig.label.fixedValue"),
        size: "sm",
        value: config2.fixedValue ?? "",
        onValueChange: (v2) => updateConfig({ fixedValue: v2 })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("pathMarkConfig.label.valueExtractionMode") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          radio_group_default,
          {
            value: String(config2.valueMatchMode ?? PathMatchMode.Layer),
            onValueChange: (value2) => updateConfig({ valueMatchMode: Number(value2) }),
            size: "sm",
            orientation: "horizontal",
            children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PathMatchMode.Layer), children: t2("pathMarkConfig.label.layer") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PathMatchMode.Regex), children: t2("pathMarkConfig.label.regex") })
            ]
          }
        )
      ] }),
      config2.valueMatchMode === PathMatchMode.Layer ? /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          label: t2("pathMarkConfig.label.valueLayer"),
          description: t2("pathMarkConfig.tip.zeroEqualsMatchedItem"),
          size: "sm",
          value: config2.valueLayer ?? 0,
          onValueChange: (v2) => updateConfig({ valueLayer: v2 })
        }
      ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("pathMarkConfig.label.valueRegex"),
          placeholder: t2("pathMarkConfig.tip.regexExample"),
          size: "sm",
          value: config2.valueRegex ?? "",
          onValueChange: (v2) => updateConfig({ valueRegex: v2 })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        label: t2("common.label.priority"),
        description: t2("pathMark.priority.description"),
        size: "sm",
        value: priority,
        onValueChange: (v2) => onPriorityChange(v2 ?? 10)
      }
    ) })
  ] });
};
PropertyMarkConfig.displayName = "PropertyMarkConfig";
const MediaLibraryMarkConfig = ({ config: config2, updateConfig, t: t2, priority, onPriorityChange, preview }) => {
  const { createPortal } = useBakabaseContext();
  const [selectedLibrary, setSelectedLibrary] = reactExports.useState(null);
  reactExports.useEffect(() => {
    const loadLibrary = async () => {
      if (config2.mediaLibraryId) {
        try {
          const response = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
          const libraries = (response == null ? void 0 : response.data) || [];
          const lib2 = libraries.find((l2) => l2.id === config2.mediaLibraryId);
          if (lib2) {
            setSelectedLibrary({ id: lib2.id, name: lib2.name || `Library ${lib2.id}` });
          }
        } catch (e2) {
          console.error("Failed to load media library", e2);
        }
      }
    };
    loadLibrary();
  }, []);
  const handleSelectLibrary = () => {
    createPortal(MediaLibrarySelectorV2, {
      onSelect: async (id2) => {
        var _a2;
        const response = await BApi$1.mediaLibraryV2.getAllMediaLibraryV2();
        const lib2 = (_a2 = response == null ? void 0 : response.data) == null ? void 0 : _a2.find((l2) => l2.id === id2);
        if (lib2) {
          setSelectedLibrary({ id: lib2.id, name: lib2.name || `Library ${lib2.id}` });
          updateConfig({ mediaLibraryId: lib2.id });
        }
      }
    });
  };
  const valueType = config2.mediaLibraryValueType ?? PropertyValueType.Fixed;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-primary-50 text-primary-700 rounded p-2 text-xs", children: t2("pathMark.mediaLibrary.explanation") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "bg-warning-50 text-warning-700 rounded p-2 text-xs", children: t2("pathMark.mediaLibrary.importantNote") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      MatchModeSelector,
      {
        config: config2,
        updateConfig,
        t: t2,
        markType: PathMarkType.MediaLibrary
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      PreviewResults,
      {
        loading: preview.loading,
        results: preview.results,
        resultsByPath: preview.resultsByPath,
        isMultiplePaths: preview.isMultiplePaths,
        error: preview.error,
        markType: PathMarkType.MediaLibrary,
        t: t2,
        applyScope: preview.applyScope
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-default-200 pt-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-default-600", children: t2("pathMarkConfig.label.mediaLibrarySettings") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 mt-1", children: t2("pathMark.mediaLibrary.configDescription") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("pathMarkConfig.label.valueType") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(
        radio_group_default,
        {
          value: String(valueType),
          onValueChange: (value2) => updateConfig({ mediaLibraryValueType: Number(value2) }),
          size: "sm",
          orientation: "horizontal",
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PropertyValueType.Fixed), children: t2("pathMarkConfig.label.fixed") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(radio_default, { value: String(PropertyValueType.Dynamic), children: t2("pathMarkConfig.label.dynamic") })
          ]
        }
      )
    ] }),
    valueType === PropertyValueType.Fixed ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm", children: t2("pathMarkConfig.label.targetMediaLibrary") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          selectedLibrary ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Chip,
            {
              color: "secondary",
              variant: "flat",
              onClose: () => {
                setSelectedLibrary(null);
                updateConfig({ mediaLibraryId: void 0 });
              },
              children: selectedLibrary.name
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-400", children: t2("pathMarkConfig.empty.noMediaLibrarySelected") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, {}),
              onPress: handleSelectLibrary,
              children: selectedLibrary ? t2("common.action.change") : t2("pathMarkConfig.action.selectMediaLibrary")
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 mt-2", children: t2("pathMarkConfig.tip.fixedMediaLibraryDescription") })
    ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400", children: t2("pathMarkConfig.tip.dynamicMediaLibraryDescription") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        number_input_default,
        {
          label: t2("pathMarkConfig.label.layerToMediaLibrary"),
          description: t2("pathMarkConfig.tip.layerToMediaLibraryDescription"),
          size: "sm",
          value: config2.layerToMediaLibrary ?? 0,
          onValueChange: (v2) => updateConfig({ layerToMediaLibrary: v2 })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("pathMarkConfig.label.regexToMediaLibrary"),
          description: t2("pathMarkConfig.tip.regexToMediaLibraryDescription"),
          placeholder: t2("pathMarkConfig.tip.regexExample"),
          size: "sm",
          value: config2.regexToMediaLibrary ?? "",
          onValueChange: (v2) => updateConfig({ regexToMediaLibrary: v2 })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border-t border-default-200 pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      number_input_default,
      {
        label: t2("common.label.priority"),
        description: t2("pathMark.priority.description"),
        size: "sm",
        value: priority,
        onValueChange: (v2) => onPriorityChange(v2 ?? 10)
      }
    ) })
  ] });
};
MediaLibraryMarkConfig.displayName = "MediaLibraryMarkConfig";
const usePreview = (rootPath, markType, config2, debounceMs = 500, rootPaths) => {
  const [loading, setLoading] = reactExports.useState(false);
  const [results, setResults] = reactExports.useState([]);
  const [resultsByPath, setResultsByPath] = reactExports.useState([]);
  const [error2, setError] = reactExports.useState(null);
  const timeoutRef = reactExports.useRef();
  const effectivePaths = reactExports.useMemo(() => {
    if (rootPaths && rootPaths.length > 0) {
      return rootPaths;
    }
    return rootPath ? [rootPath] : [];
  }, [rootPath, rootPaths]);
  reactExports.useEffect(() => {
    if (effectivePaths.length === 0) {
      setResults([]);
      setResultsByPath([]);
      return;
    }
    const hasValidConfig = config2.matchMode === PathMatchMode.Layer ? config2.layer !== void 0 : config2.regex && config2.regex.length > 0;
    if (!hasValidConfig) {
      setResults([]);
      setResultsByPath([]);
      return;
    }
    if (timeoutRef.current) {
      clearTimeout(timeoutRef.current);
    }
    setLoading(true);
    setError(null);
    timeoutRef.current = setTimeout(async () => {
      try {
        const allResults = [];
        const allResultsByPath = [];
        await Promise.all(
          effectivePaths.map(async (path) => {
            const rsp = await BApi$1.pathMark.previewPathMarkMatchedPaths({
              path,
              type: markType,
              configJson: buildConfigJson(config2, markType)
            });
            if (!rsp.code && rsp.data) {
              const pathResults = rsp.data.slice(0, 5);
              allResults.push(...pathResults);
              allResultsByPath.push({ path, results: pathResults });
            } else if (rsp.message) {
              setError(rsp.message);
            }
          })
        );
        setResults(allResults.slice(0, 10));
        setResultsByPath(allResultsByPath);
      } catch (err) {
        console.error("Preview failed:", err);
        setError("Preview failed");
        setResults([]);
        setResultsByPath([]);
      } finally {
        setLoading(false);
      }
    }, debounceMs);
    return () => {
      if (timeoutRef.current) {
        clearTimeout(timeoutRef.current);
      }
    };
  }, [
    effectivePaths,
    markType,
    config2.matchMode,
    config2.layer,
    config2.regex,
    config2.fsTypeFilter,
    config2.extensions,
    config2.extensionGroupIds,
    config2.applyScope,
    debounceMs
  ]);
  return { loading, results, resultsByPath, error: error2, isMultiplePaths: effectivePaths.length > 1, applyScope: config2.applyScope };
};
const DEFAULT_EXPIRES_IN_SECONDS = 3600;
const MarkConfigModal = ({ mark: mark2, markType, rootPath, rootPaths, onSave, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const initialConfig = parseMarkConfig(mark2 == null ? void 0 : mark2.configJson);
  if (!mark2 && markType === PathMarkType.MediaLibrary) {
    initialConfig.applyScope = PathMarkApplyScope.MatchedAndSubdirectories;
  }
  const [priority, setPriority] = reactExports.useState((mark2 == null ? void 0 : mark2.priority) ?? 10);
  const [config2, setConfig] = reactExports.useState(initialConfig);
  const [enableExpiration, setEnableExpiration] = reactExports.useState((mark2 == null ? void 0 : mark2.expiresInSeconds) != null && mark2.expiresInSeconds > 0);
  const [expiresInSeconds, setExpiresInSeconds] = reactExports.useState((mark2 == null ? void 0 : mark2.expiresInSeconds) ?? DEFAULT_EXPIRES_IN_SECONDS);
  const [syncing, setSyncing] = reactExports.useState(false);
  const [showScrollIndicator, setShowScrollIndicator] = reactExports.useState(false);
  const contentRef = reactExports.useRef(null);
  const preview = usePreview(rootPath, markType, config2, 500, rootPaths);
  reactExports.useEffect(() => {
    const checkScrollable = () => {
      const el22 = contentRef.current;
      if (el22) {
        const isScrollable2 = el22.scrollHeight > el22.clientHeight;
        const isAtBottom = el22.scrollHeight - el22.scrollTop - el22.clientHeight < 10;
        setShowScrollIndicator(isScrollable2 && !isAtBottom);
      }
    };
    checkScrollable();
    const el2 = contentRef.current;
    if (el2) {
      el2.addEventListener("scroll", checkScrollable);
      const resizeObserver2 = new ResizeObserver(checkScrollable);
      resizeObserver2.observe(el2);
      return () => {
        el2.removeEventListener("scroll", checkScrollable);
        resizeObserver2.disconnect();
      };
    }
  }, [config2, enableExpiration]);
  const handleSave = reactExports.useCallback(async () => {
    const newMark = {
      type: markType,
      priority,
      configJson: buildConfigJson(config2, markType),
      expiresInSeconds: enableExpiration ? expiresInSeconds : void 0
    };
    await (onSave == null ? void 0 : onSave(newMark));
    return true;
  }, [markType, priority, config2, enableExpiration, expiresInSeconds, onSave]);
  const handleSyncNow = reactExports.useCallback(async () => {
    if (!(mark2 == null ? void 0 : mark2.id))
      return;
    setSyncing(true);
    try {
      await BApi$1.pathMark.startPathMarkSync([mark2.id]);
      toast.success(t2("pathMarkConfig.success.syncStarted"));
    } catch (e2) {
      toast.danger(t2("pathMarkConfig.error.syncFailed"));
    } finally {
      setSyncing(false);
    }
  }, [mark2 == null ? void 0 : mark2.id, t2]);
  const updateConfig = reactExports.useCallback((updates) => {
    setConfig((prev2) => ({ ...prev2, ...updates }));
  }, []);
  const scrollToBottom = () => {
    var _a2;
    (_a2 = contentRef.current) == null ? void 0 : _a2.scrollTo({
      top: contentRef.current.scrollHeight,
      behavior: "smooth"
    });
  };
  const pathCount = (rootPaths == null ? void 0 : rootPaths.length) ?? (rootPath ? 1 : 0);
  const previewData = {
    loading: preview.loading,
    results: preview.results,
    resultsByPath: preview.resultsByPath,
    isMultiplePaths: preview.isMultiplePaths,
    error: preview.error,
    applyScope: preview.applyScope
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      defaultVisible: true,
      size: "3xl",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 whitespace-nowrap", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Trans,
          {
            i18nKey: mark2 ? "Edit <type></type> Mark" : "Add <type></type> Mark",
            components: {
              type: markType === PathMarkType.Resource ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceTerm, { size: "lg" }) : markType === PathMarkType.Property ? /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTerm, { size: "lg" }) : markType === PathMarkType.MediaLibrary ? /* @__PURE__ */ jsxRuntimeExports.jsx(MediaLibraryTerm, { size: "lg" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.status.unknown") })
            }
          }
        ),
        pathCount > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400 text-sm ml-2", children: [
          "(",
          t2("pathMarkConfig.label.pathCount", { count: pathCount }),
          ")"
        ] })
      ] }),
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          children: t2("common.action.save"),
          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$e, {})
        },
        startContent: (mark2 == null ? void 0 : mark2.id) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            variant: "flat",
            size: "sm",
            isLoading: syncing,
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$7, {}),
            onClick: handleSyncNow,
            children: t2("pathMarkConfig.action.syncNow")
          }
        ) : void 0
      },
      onOk: handleSave,
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            ref: contentRef,
            className: "flex flex-col gap-2 max-h-[60vh] overflow-y-auto overflow-x-hidden pr-1",
            children: [
              markType === PathMarkType.Resource ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                ResourceMarkConfig,
                {
                  config: config2,
                  updateConfig,
                  t: t2,
                  priority,
                  onPriorityChange: setPriority,
                  preview: previewData
                }
              ) : markType === PathMarkType.Property ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                PropertyMarkConfig,
                {
                  config: config2,
                  updateConfig,
                  t: t2,
                  priority,
                  onPriorityChange: setPriority,
                  preview: previewData
                }
              ) : markType === PathMarkType.MediaLibrary ? /* @__PURE__ */ jsxRuntimeExports.jsx(
                MediaLibraryMarkConfig,
                {
                  config: config2,
                  updateConfig,
                  t: t2,
                  priority,
                  onPriorityChange: setPriority,
                  preview: previewData
                }
              ) : null,
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-t border-default-200 pt-3 mt-2", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    switch_default,
                    {
                      size: "sm",
                      isSelected: enableExpiration,
                      onValueChange: (checked) => {
                        setEnableExpiration(checked);
                        if (checked && expiresInSeconds <= 0) {
                          setExpiresInSeconds(DEFAULT_EXPIRES_IN_SECONDS);
                        }
                      }
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("pathMarkConfig.label.scheduledSync") })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-400 ml-10 mb-2", children: t2("pathMarkConfig.tip.expirationDescription") }),
                enableExpiration && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  DurationInput,
                  {
                    value: expiresInSeconds,
                    onChange: setExpiresInSeconds,
                    minValue: 60,
                    size: "sm"
                  }
                ) })
              ] })
            ]
          }
        ),
        showScrollIndicator && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: "absolute bottom-0 left-0 right-0 flex justify-center items-center py-1 bg-gradient-to-t from-background to-transparent cursor-pointer hover:from-primary-50 transition-colors",
            onClick: scrollToBottom,
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-xs text-primary-500 animate-bounce", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1k, {}),
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.label.scrollForMore") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1k, {})
            ] })
          }
        )
      ] })
    }
  );
};
MarkConfigModal.displayName = "MarkConfigModal";
const MarkDescription = ({ mark: mark2, className, label, priority }) => {
  const { t: t2 } = useTranslation();
  const config2 = reactExports.useMemo(() => {
    try {
      return JSON.parse(mark2.configJson || "{}");
    } catch {
      return {};
    }
  }, [mark2.configJson]);
  const getDescription = () => {
    var _a2, _b2;
    try {
      const matchMode = config2.matchMode;
      const parts = [];
      let typeLabel = label || "";
      if (mark2.type === PathMarkType.Property && ((_a2 = mark2.property) == null ? void 0 : _a2.name)) {
        typeLabel = `${typeLabel}:${mark2.property.name}`;
      }
      if (mark2.type === PathMarkType.MediaLibrary) {
        const valueType = config2.valueType ?? PropertyValueType.Fixed;
        if (valueType === PropertyValueType.Fixed && ((_b2 = mark2.mediaLibrary) == null ? void 0 : _b2.name)) {
          typeLabel = `${typeLabel}:${mark2.mediaLibrary.name}`;
        }
      }
      if (typeLabel) {
        const prioritySuffix = priority && priority > 0 ? `₍${priority}₎` : "";
        parts.push(`[${typeLabel}]${prioritySuffix}`);
      }
      const applyScope = config2.applyScope ?? PathMarkApplyScope.MatchedOnly;
      const includesSubdirs = applyScope === PathMarkApplyScope.MatchedAndSubdirectories;
      if (matchMode === PathMatchMode.Layer) {
        const layer = config2.layer ?? 0;
        if (layer === 0) {
          if (includesSubdirs) {
            parts.push(t2("markDescription.layer.currentAndSubdirs"));
          } else {
            parts.push(t2("markDescription.layer.current"));
          }
        } else if (layer > 0) {
          const layerText = `+${layer}${t2("markDescription.layer.suffix")}`;
          parts.push(includesSubdirs ? `${layerText}${t2("markDescription.andSubdirs")}` : layerText);
        } else {
          const layerText = `${layer}${t2("markDescription.layer.suffix")}`;
          parts.push(includesSubdirs ? `${layerText}${t2("markDescription.andSubdirs")}` : layerText);
        }
      } else if (matchMode === PathMatchMode.Regex) {
        const regex2 = config2.regex ?? "";
        const regexText = t2("markDescription.regex", { regex: regex2 });
        parts.push(includesSubdirs ? `${regexText}${t2("markDescription.andSubdirs")}` : regexText);
      } else if (includesSubdirs) {
        parts.push(t2("markDescription.layer.currentAndSubdirs"));
      }
      if (mark2.type === PathMarkType.Property) {
        const valueType = config2.valueType;
        if (valueType === PropertyValueType.Fixed) {
          const fixedValue = config2.fixedValue;
          if (fixedValue !== void 0 && fixedValue !== null) {
            parts.push(`="${fixedValue}"`);
          }
        } else if (valueType === PropertyValueType.Dynamic) {
          const valueLayer = config2.valueLayer;
          const valueRegex = config2.valueRegex;
          if (valueLayer !== void 0 && valueLayer !== null) {
            if (valueLayer === 0) {
              parts.push(t2("markDescription.valueLayer.current"));
            } else if (valueLayer > 0) {
              parts.push(`${t2("markDescription.valueFrom")}+${valueLayer}${t2("markDescription.layer.suffix")}`);
            } else {
              parts.push(`${t2("markDescription.valueFrom")}${valueLayer}${t2("markDescription.layer.suffix")}`);
            }
          } else if (valueRegex) {
            parts.push(t2("markDescription.valueRegex", { regex: valueRegex }));
          }
        }
      }
      if (mark2.type === PathMarkType.MediaLibrary) {
        const valueType = config2.valueType ?? PropertyValueType.Fixed;
        if (valueType === PropertyValueType.Fixed) {
        } else if (valueType === PropertyValueType.Dynamic) {
          const layerToMediaLibrary = config2.layerToMediaLibrary;
          const regexToMediaLibrary = config2.regexToMediaLibrary;
          if (layerToMediaLibrary !== void 0 && layerToMediaLibrary !== null) {
            if (layerToMediaLibrary === 0) {
              parts.push(t2("markDescription.mediaLibraryLayer.current"));
            } else if (layerToMediaLibrary > 0) {
              parts.push(`${t2("markDescription.mediaLibraryFrom")}+${layerToMediaLibrary}${t2("markDescription.layer.suffix")}`);
            } else {
              parts.push(`${t2("markDescription.mediaLibraryFrom")}${layerToMediaLibrary}${t2("markDescription.layer.suffix")}`);
            }
          } else if (regexToMediaLibrary) {
            parts.push(t2("markDescription.mediaLibraryRegex", { regex: regexToMediaLibrary }));
          }
        }
      }
      if (mark2.type === PathMarkType.Resource) {
        const fsTypeFilter = config2.fsTypeFilter;
        if (fsTypeFilter === 1) {
          parts.push(t2("markDescription.fileOnly"));
        } else if (fsTypeFilter === 2) {
          parts.push(t2("markDescription.dirOnly"));
        }
        const extensions = config2.extensions;
        if (extensions && extensions.length > 0) {
          parts.push(extensions.join(","));
        }
      }
      return parts.length > 0 ? parts.join(" | ") : t2("markDescription.empty");
    } catch (error2) {
      console.error("Failed to parse mark config:", error2);
      return t2("markDescription.invalid");
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className, children: getDescription() });
};
MarkDescription.displayName = "MarkDescription";
const buildMarkTaskId$2 = (markId) => `SyncPathMark_${markId}`;
const getSyncStatusIcon$1 = (status, isTaskRunning, taskProgress) => {
  if (isTaskRunning) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      circular_progress_default,
      {
        "aria-label": "Syncing",
        classNames: {
          svg: "w-3.5 h-3.5"
        },
        size: "sm",
        value: taskProgress || 0
      }
    );
  }
  switch (status) {
    case PathMarkSyncStatus.Pending:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, { className: "text-warning" });
    case PathMarkSyncStatus.Syncing:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        circular_progress_default,
        {
          "aria-label": "Syncing",
          classNames: {
            svg: "w-3.5 h-3.5"
          },
          size: "sm",
          isIndeterminate: true
        }
      );
    case PathMarkSyncStatus.Synced:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-success" });
    case PathMarkSyncStatus.Failed:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-danger" });
    case PathMarkSyncStatus.PendingDelete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-danger" });
    default:
      return null;
  }
};
const getSyncStatusTooltip = (status, t2) => {
  const translate = t2 || ((key) => key);
  switch (status) {
    case PathMarkSyncStatus.Pending:
      return translate("pathMarkConfig.status.pending");
    case PathMarkSyncStatus.Syncing:
      return translate("pathMarkConfig.status.syncing");
    case PathMarkSyncStatus.Synced:
      return translate("pathMarkConfig.status.synced");
    case PathMarkSyncStatus.Failed:
      return translate("pathMarkConfig.status.failed");
    case PathMarkSyncStatus.PendingDelete:
      return translate("pathMarkConfig.status.pendingDelete");
    default:
      return "";
  }
};
const getMarkTypeLabel$1 = (type4, t2) => {
  const translate = t2 || ((key) => key);
  switch (type4) {
    case PathMarkType.Resource:
      return translate("common.label.resource");
    case PathMarkType.Property:
      return translate("common.label.property");
    case PathMarkType.MediaLibrary:
      return translate("common.label.mediaLibrary");
    default:
      return translate("pathMarkConfig.status.unknown");
  }
};
const getMarkTypeColor$1 = (type4) => {
  switch (type4) {
    case PathMarkType.Resource:
      return "success";
    case PathMarkType.Property:
      return "primary";
    case PathMarkType.MediaLibrary:
      return "secondary";
    default:
      return "default";
  }
};
const PathMarkChip = ({
  mark: propMark,
  onClick,
  onContextMenu,
  selectable,
  selected,
  onSelectionChange
}) => {
  const { t: t2 } = useTranslation();
  const [syncing, setSyncing] = reactExports.useState(false);
  const bTasks = useBTasksStore((state) => state.tasks);
  const storeMark = usePathMarksStore(
    (state) => propMark.id != null ? state.marks.get(propMark.id) : void 0
  );
  const mark2 = storeMark ?? propMark;
  const color2 = getMarkTypeColor$1(mark2.type);
  const label = getMarkTypeLabel$1(mark2.type, t2);
  const isPendingDelete = mark2.syncStatus === PathMarkSyncStatus.PendingDelete;
  const markTask = mark2.id ? bTasks == null ? void 0 : bTasks.find((task) => task.id === buildMarkTaskId$2(mark2.id)) : void 0;
  const isTaskRunning = (markTask == null ? void 0 : markTask.status) === BTaskStatus.Running || (markTask == null ? void 0 : markTask.status) === BTaskStatus.NotStarted;
  const taskProgress = (markTask == null ? void 0 : markTask.percentage) || 0;
  const handleSyncMark = reactExports.useCallback(async () => {
    if (!mark2.id || syncing || isTaskRunning)
      return;
    setSyncing(true);
    try {
      await BApi$1.pathMark.startPathMarkSync([mark2.id]);
      toast.success(t2("pathMarkConfig.success.syncStarted"));
    } catch (err) {
      toast.danger(t2("pathMarkConfig.error.syncFailed"));
    } finally {
      setSyncing(false);
    }
  }, [mark2.id, syncing, isTaskRunning, t2]);
  const chipContent = /* @__PURE__ */ jsxRuntimeExports.jsx(
    Chip,
    {
      className: `cursor-pointer hover:opacity-80 ${isPendingDelete ? "line-through opacity-50" : ""}`,
      color: color2,
      size: "sm",
      variant: "flat",
      onClick: () => {
        if (selectable) {
          onSelectionChange == null ? void 0 : onSelectionChange(!selected);
        } else if (!isPendingDelete && onClick) {
          onClick();
        }
      },
      onContextMenu: (e2) => {
        e2.preventDefault();
        if (!selectable && !isPendingDelete && onContextMenu) {
          onContextMenu();
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 text-xs", children: [
        getSyncStatusIcon$1(mark2.syncStatus, isTaskRunning, taskProgress),
        /* @__PURE__ */ jsxRuntimeExports.jsx(MarkDescription, { mark: mark2, label, priority: mark2.priority })
      ] })
    }
  );
  if (selectable) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          size: "sm",
          isSelected: selected,
          onValueChange: onSelectionChange
        }
      ),
      chipContent
    ] });
  }
  const canSync = mark2.id && !syncing && !isTaskRunning && !isPendingDelete;
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Tooltip$1,
    {
      content: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.tip.clickToEditRightClickDelete") }),
        mark2.syncStatus !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs opacity-80", children: [
          getSyncStatusTooltip(mark2.syncStatus, t2),
          mark2.syncError && `: ${mark2.syncError}`
        ] }),
        isTaskRunning && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs opacity-80", children: t2("pathMarkConfig.status.syncProgress", { progress: Math.round(taskProgress) }) }),
        mark2.expiresInSeconds != null && mark2.expiresInSeconds > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs opacity-80 flex items-center gap-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFieldTime, { className: "text-base" }),
          t2("pathMarkConfig.tip.recheckAfter"),
          " ",
          formatDuration(mark2.expiresInSeconds, t2)
        ] }),
        canSync && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            size: "sm",
            color: "success",
            variant: "flat",
            className: "mt-1",
            isLoading: syncing,
            startContent: !syncing && /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-base" }),
            onPress: handleSyncMark,
            children: t2("pathMarkConfig.action.syncNow")
          }
        )
      ] }),
      delay: 500,
      children: chipContent
    }
  );
};
PathMarkChip.displayName = "PathMarkChip";
const useCopyMarksStore = create$1((set2, get5) => ({
  copyModeEntryPath: null,
  selectedMarkIds: [],
  candidateGroups: [],
  selectedGroupId: null,
  sidebarCollapsed: true,
  enterCopyMode: (path) => set2({
    copyModeEntryPath: path,
    selectedMarkIds: []
  }),
  exitCopyMode: () => set2({
    copyModeEntryPath: null,
    selectedMarkIds: []
  }),
  toggleMarkSelection: (markId) => set2((state) => {
    const idx = state.selectedMarkIds.indexOf(markId);
    if (idx > -1) {
      return { selectedMarkIds: state.selectedMarkIds.filter((id2) => id2 !== markId) };
    } else {
      return { selectedMarkIds: [...state.selectedMarkIds, markId] };
    }
  }),
  selectAllMarks: (markIds) => set2({ selectedMarkIds: markIds }),
  deselectAllMarks: () => set2({ selectedMarkIds: [] }),
  confirmSelection: (sourcePath, marks) => {
    const selectedIds = get5().selectedMarkIds;
    const selectedMarks = marks.filter((m2) => m2.id !== void 0 && selectedIds.includes(m2.id));
    if (selectedMarks.length === 0)
      return;
    const newGroup = {
      id: v4(),
      sourcePath,
      marks: selectedMarks,
      createdAt: Date.now()
    };
    set2((state) => ({
      candidateGroups: [...state.candidateGroups, newGroup],
      selectedGroupId: newGroup.id,
      copyModeEntryPath: null,
      selectedMarkIds: [],
      sidebarCollapsed: false
    }));
  },
  removeGroup: (groupId) => set2((state) => {
    const newGroups = state.candidateGroups.filter((g2) => g2.id !== groupId);
    return {
      candidateGroups: newGroups,
      selectedGroupId: state.selectedGroupId === groupId ? null : state.selectedGroupId,
      sidebarCollapsed: newGroups.length === 0 ? true : state.sidebarCollapsed
    };
  }),
  removeMarkFromGroup: (groupId, markId) => set2((state) => {
    const newGroups = state.candidateGroups.map((g2) => {
      if (g2.id !== groupId)
        return g2;
      const newMarks = g2.marks.filter((m2) => m2.id !== markId);
      return { ...g2, marks: newMarks };
    }).filter((g2) => g2.marks.length > 0);
    return {
      candidateGroups: newGroups,
      selectedGroupId: newGroups.find((g2) => g2.id === state.selectedGroupId) ? state.selectedGroupId : null,
      sidebarCollapsed: newGroups.length === 0 ? true : state.sidebarCollapsed
    };
  }),
  selectGroup: (groupId) => set2({ selectedGroupId: groupId }),
  toggleSidebar: () => set2((state) => ({ sidebarCollapsed: !state.sidebarCollapsed })),
  setSidebarCollapsed: (collapsed2) => set2({ sidebarCollapsed: collapsed2 }),
  clearAllGroups: () => set2({
    candidateGroups: [],
    selectedGroupId: null,
    sidebarCollapsed: true
  })
}));
const buildMarkTaskId$1 = (markId) => `SyncPathMark_${markId}`;
const PathMarks = ({ entry, marks = [], onSaveMark, onDeleteMark, onTaskComplete }) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bTasks = useBTasksStore((state) => state.tasks);
  const {
    copyModeEntryPath,
    selectedMarkIds,
    enterCopyMode,
    exitCopyMode,
    toggleMarkSelection,
    selectAllMarks,
    confirmSelection
  } = useCopyMarksStore();
  const isInCopyMode = copyModeEntryPath === entry.path;
  const prevTaskStatusesRef = reactExports.useRef(/* @__PURE__ */ new Map());
  reactExports.useEffect(() => {
    if (!marks.length || !bTasks)
      return;
    const prevStatuses = prevTaskStatusesRef.current;
    let hasCompletedTask = false;
    for (const mark2 of marks) {
      if (!mark2.id)
        continue;
      const taskId = buildMarkTaskId$1(mark2.id);
      const task = bTasks.find((t22) => t22.id === taskId);
      const prevStatus = prevStatuses.get(taskId);
      if (task) {
        if (prevStatus !== void 0 && (prevStatus === BTaskStatus.Running || prevStatus === BTaskStatus.NotStarted) && task.status === BTaskStatus.Completed) {
          hasCompletedTask = true;
        }
        prevStatuses.set(taskId, task.status);
      } else if (prevStatus !== void 0 && (prevStatus === BTaskStatus.Running || prevStatus === BTaskStatus.NotStarted)) {
        hasCompletedTask = true;
        prevStatuses.delete(taskId);
      }
    }
    if (hasCompletedTask && onTaskComplete) {
      onTaskComplete();
    }
  }, [bTasks, marks, onTaskComplete]);
  const resourceMarks = marks.filter((m2) => m2.type === PathMarkType.Resource);
  const propertyMarks = marks.filter((m2) => m2.type === PathMarkType.Property);
  const mediaLibraryMarks = marks.filter((m2) => m2.type === PathMarkType.MediaLibrary);
  const allMarks = [...resourceMarks, ...propertyMarks, ...mediaLibraryMarks];
  const handleAddMark = reactExports.useCallback(
    (markType) => {
      createPortal(MarkConfigModal, {
        markType,
        rootPath: entry.path,
        onSave: async (mark2) => {
          if (onSaveMark) {
            onSaveMark(entry, mark2);
          }
        }
      });
    },
    [createPortal, entry, onSaveMark]
  );
  const handleEditMark = reactExports.useCallback(
    (mark2) => {
      createPortal(MarkConfigModal, {
        mark: mark2,
        markType: mark2.type,
        rootPath: entry.path,
        onSave: async (newMark) => {
          if (onSaveMark) {
            onSaveMark(entry, newMark, mark2);
          }
        }
      });
    },
    [createPortal, entry, onSaveMark]
  );
  const handleDeleteMark = reactExports.useCallback(
    (mark2) => {
      if (onDeleteMark) {
        onDeleteMark(entry, mark2);
      }
    },
    [entry, onDeleteMark]
  );
  const handleEnterCopyMode = reactExports.useCallback(() => {
    if (marks.length > 0) {
      enterCopyMode(entry.path);
      const markIds = marks.filter((m2) => m2.id !== void 0).map((m2) => m2.id);
      selectAllMarks(markIds);
    }
  }, [enterCopyMode, entry.path, marks, selectAllMarks]);
  const handleConfirmCopy = reactExports.useCallback(() => {
    confirmSelection(entry.path, marks);
  }, [confirmSelection, entry.path, marks]);
  const handleCancelCopy = reactExports.useCallback(() => {
    exitCopyMode();
  }, [exitCopyMode]);
  const renderMarkChip = (mark2, keyPrefix) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    PathMarkChip,
    {
      mark: mark2,
      selectable: isInCopyMode,
      selected: mark2.id !== void 0 && selectedMarkIds.includes(mark2.id),
      onClick: () => handleEditMark(mark2),
      onContextMenu: () => handleDeleteMark(mark2),
      onSelectionChange: () => {
        if (mark2.id !== void 0) {
          toggleMarkSelection(mark2.id);
        }
      }
    },
    `${keyPrefix}-${mark2.id}`
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    "div",
    {
      className: "flex items-center gap-2 ml-2",
      onClick: (e2) => e2.stopPropagation(),
      onMouseDown: (e2) => e2.stopPropagation(),
      children: [
        !isInCopyMode && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              className: "min-w-0 px-2 text-default-400 hover:text-primary transition-colors",
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAim, { className: "text-lg" }),
              variant: "light",
              children: t2("pathMarkConfig.action.addMark")
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            dropdown_menu_default,
            {
              "aria-label": "Mark type selection",
              className: "max-w-[600px]",
              onAction: (key) => handleAddMark(Number(key)),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    className: "text-success",
                    description: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceDescription, {}),
                    children: t2("common.label.resource")
                  },
                  PathMarkType.Resource
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    className: "text-primary",
                    description: /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyDescription, {}),
                    children: t2("common.label.property")
                  },
                  PathMarkType.Property
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  menu_item_base_default,
                  {
                    className: "text-secondary",
                    description: /* @__PURE__ */ jsxRuntimeExports.jsx(MediaLibraryDescription, {}),
                    children: t2("common.label.mediaLibrary")
                  },
                  PathMarkType.MediaLibrary
                )
              ]
            }
          )
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 flex-wrap", children: [
          resourceMarks.map((mark2) => renderMarkChip(mark2, "resource")),
          propertyMarks.map((mark2) => renderMarkChip(mark2, "property")),
          mediaLibraryMarks.map((mark2) => renderMarkChip(mark2, "mediaLibrary"))
        ] }),
        marks.length > 0 && !isInCopyMode && /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            className: "min-w-0 px-2 text-default-400 hover:text-warning transition-colors",
            size: "sm",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-lg" }),
            variant: "light",
            onPress: handleEnterCopyMode,
            children: t2("pathMarkConfig.action.copy")
          }
        ),
        isInCopyMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 ml-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              color: "primary",
              size: "sm",
              isDisabled: selectedMarkIds.length === 0,
              onPress: handleConfirmCopy,
              children: [
                t2("pathMarkConfig.action.confirmSelection"),
                " (",
                selectedMarkIds.length,
                "/",
                allMarks.length,
                ")"
              ]
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              variant: "light",
              onPress: handleCancelCopy,
              children: t2("common.action.cancel")
            }
          )
        ] })
      ]
    }
  );
};
PathMarks.displayName = "PathRuleMarks";
function areMarksEqual(markA, markB) {
  if (markA.type !== markB.type) {
    return false;
  }
  try {
    const configA = JSON.parse(markA.configJson || "{}");
    const configB = JSON.parse(markB.configJson || "{}");
    return _$2.isEqual(configA, configB);
  } catch {
    return markA.configJson === markB.configJson;
  }
}
function getNewMarks(sourceMarks, targetMarks) {
  return sourceMarks.filter(
    (sourceMark) => !targetMarks.some((targetMark) => areMarksEqual(sourceMark, targetMark))
  );
}
function getExistingMarksCount(sourceMarks, targetMarks) {
  return sourceMarks.filter(
    (sourceMark) => targetMarks.some((targetMark) => areMarksEqual(sourceMark, targetMark))
  ).length;
}
const PasteMarksButton = ({
  targetPath,
  existingMarks,
  onPaste
}) => {
  const { t: t2 } = useTranslation();
  const { candidateGroups, selectedGroupId } = useCopyMarksStore();
  const selectedGroup = reactExports.useMemo(
    () => candidateGroups.find((g2) => g2.id === selectedGroupId),
    [candidateGroups, selectedGroupId]
  );
  const { newMarks, existingCount, totalCount } = reactExports.useMemo(() => {
    if (!selectedGroup) {
      return { newMarks: [], existingCount: 0, totalCount: 0 };
    }
    const sourceMarks = selectedGroup.marks;
    const newMarksResult = getNewMarks(sourceMarks, existingMarks);
    const existingCountResult = getExistingMarksCount(sourceMarks, existingMarks);
    return {
      newMarks: newMarksResult,
      existingCount: existingCountResult,
      totalCount: sourceMarks.length
    };
  }, [selectedGroup, existingMarks]);
  if (!selectedGroup || newMarks.length === 0) {
    return null;
  }
  if (selectedGroup.sourcePath === targetPath) {
    return null;
  }
  const handlePaste = () => {
    onPaste(newMarks);
  };
  const button2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
    Button,
    {
      size: "sm",
      color: "warning",
      variant: "flat",
      startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSnippets, {}),
      onPress: handlePaste,
      children: t2("pathMarkConfig.action.pasteMarks", { count: newMarks.length })
    }
  );
  if (existingCount > 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx(
      Tooltip$1,
      {
        content: t2("pathMarkConfig.tip.marksAlreadyExist", { count: existingCount }),
        children: button2
      }
    );
  }
  return button2;
};
PasteMarksButton.displayName = "PasteMarksButton";
const CandidateGroupCard = ({
  group,
  isSelected,
  onSelect,
  onRemove
}) => {
  const { removeMarkFromGroup } = useCopyMarksStore();
  const displayPath = group.sourcePath.length > 40 ? `...${group.sourcePath.slice(-37)}` : group.sourcePath;
  const sortedMarks = [...group.marks].sort((a2, b2) => (a2.type ?? 0) - (b2.type ?? 0));
  const handleRemoveMark = reactExports.useCallback(
    (markId) => {
      removeMarkFromGroup(group.id, markId);
    },
    [group.id, removeMarkFromGroup]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    card_default,
    {
      className: `cursor-pointer transition-all ${isSelected ? "border-2 border-primary shadow-md" : "border border-default-200 hover:border-default-400"}`,
      isPressable: true,
      onPress: onSelect,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "p-3 gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "p",
            {
              className: "text-xs text-default-500 truncate",
              title: group.sourcePath,
              children: displayPath
            }
          ) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              size: "sm",
              variant: "light",
              className: "text-default-400 hover:text-danger min-w-6 w-6 h-6",
              onPress: (e2) => {
                onRemove();
              },
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClose, { className: "text-sm" })
            }
          )
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 flex-wrap", children: sortedMarks.map((mark2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          PathMarkChip,
          {
            mark: mark2,
            onContextMenu: mark2.id !== void 0 ? () => handleRemoveMark(mark2.id) : void 0
          },
          mark2.id
        )) })
      ] })
    }
  );
};
CandidateGroupCard.displayName = "CandidateGroupCard";
const CopyMarksSidebar = () => {
  const { t: t2 } = useTranslation();
  const {
    candidateGroups,
    selectedGroupId,
    sidebarCollapsed,
    selectGroup,
    removeGroup,
    toggleSidebar,
    clearAllGroups
  } = useCopyMarksStore();
  if (candidateGroups.length === 0 && sidebarCollapsed) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden" });
  }
  if (sidebarCollapsed) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 border-l border-default-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        variant: "light",
        className: "h-full rounded-none px-2",
        onPress: toggleSidebar,
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          badge_default,
          {
            content: candidateGroups.length,
            color: "primary",
            size: "sm",
            isInvisible: candidateGroups.length === 0,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineLeft, { className: "text-lg" })
          }
        )
      }
    ) });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 w-[280px] border-l border-default-200 flex flex-col bg-background", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-3 border-b border-default-200", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: t2("pathMarkConfig.label.copiedMarks") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          size: "sm",
          variant: "light",
          onPress: toggleSidebar,
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRight, { className: "text-lg" })
        }
      )
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto p-3 space-y-2", children: candidateGroups.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-center text-default-400 py-8", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: t2("pathMarkConfig.empty.noCopiedMarks") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs mt-1", children: t2("pathMarkConfig.tip.selectMarksToCopy") })
    ] }) : candidateGroups.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      CandidateGroupCard,
      {
        group,
        isSelected: selectedGroupId === group.id,
        onSelect: () => selectGroup(selectedGroupId === group.id ? null : group.id),
        onRemove: () => removeGroup(group.id)
      },
      group.id
    )) }),
    candidateGroups.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-3 border-t border-default-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        size: "sm",
        variant: "flat",
        color: "danger",
        startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, {}),
        className: "w-full",
        onPress: clearAllGroups,
        children: t2("common.action.clearAll")
      }
    ) })
  ] });
};
CopyMarksSidebar.displayName = "CopyMarksSidebar";
function usePathMarks() {
  const [allMarks, setAllMarks] = reactExports.useState([]);
  const [allPaths, setAllPaths] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(false);
  const [pathExistsMap, setPathExistsMap] = reactExports.useState(/* @__PURE__ */ new Map());
  const [checkingPaths, setCheckingPaths] = reactExports.useState(false);
  const isInitialLoad = reactExports.useRef(true);
  reactExports.useEffect(() => {
    loadAllMarks();
  }, []);
  const loadAllMarks = reactExports.useCallback(async () => {
    if (isInitialLoad.current) {
      setLoading(true);
    }
    try {
      const additionalItems = PathMarkAdditionalItem.Property | PathMarkAdditionalItem.MediaLibrary;
      const rsp = await BApi$1.pathMark.getAllPathMarks({ additionalItems });
      if (!rsp.code && rsp.data) {
        setAllMarks(rsp.data);
        usePathMarksStore.getState().setMarks(rsp.data);
        const paths = [...new Set(rsp.data.map((m2) => m2.path).filter(Boolean))];
        setAllPaths(paths);
      }
    } catch (error2) {
      console.error("Failed to load path marks:", error2);
    } finally {
      if (isInitialLoad.current) {
        setLoading(false);
        isInitialLoad.current = false;
      }
    }
  }, []);
  const checkPathsExistence = reactExports.useCallback(async (paths, existingMap) => {
    const newPaths = paths.filter((p2) => !existingMap.has(p2));
    if (newPaths.length === 0)
      return existingMap;
    setCheckingPaths(true);
    const results = await Promise.all(
      newPaths.map(async (path) => {
        try {
          const rsp = await BApi$1.file.getIwFsEntry({ path });
          const exists = !rsp.code && rsp.data != null && rsp.data.type !== IwFsType.Invalid;
          return { path, exists };
        } catch {
          return { path, exists: false };
        }
      })
    );
    const newMap = new Map(existingMap);
    for (const { path, exists } of results) {
      newMap.set(path, exists);
    }
    const pathSet = new Set(paths);
    for (const key of newMap.keys()) {
      if (!pathSet.has(key)) {
        newMap.delete(key);
      }
    }
    setPathExistsMap(newMap);
    setCheckingPaths(false);
    return newMap;
  }, []);
  reactExports.useEffect(() => {
    if (allPaths.length > 0) {
      checkPathsExistence(allPaths, pathExistsMap);
    }
  }, [allPaths]);
  const getInvalidPathsCount = reactExports.useCallback(() => {
    let count = 0;
    for (const path of allPaths) {
      if (pathExistsMap.has(path) && !pathExistsMap.get(path)) {
        count++;
      }
    }
    return count;
  }, [allPaths, pathExistsMap]);
  const getMarksForPath = reactExports.useCallback(
    (path) => {
      if (!path)
        return [];
      const normalizedPath = path.replace(/\\/g, "/").toLowerCase();
      return allMarks.filter((mark2) => {
        const markPath = (mark2.path || "").replace(/\\/g, "/").toLowerCase();
        return markPath === normalizedPath && mark2.syncStatus !== PathMarkSyncStatus.PendingDelete;
      });
    },
    [allMarks]
  );
  const getApplicableMarksGroup = reactExports.useCallback(
    (path) => {
      if (!path)
        return null;
      const normalizedPath = path.replace(/\\/g, "/").toLowerCase();
      let bestMatch = null;
      let bestMatchLength = 0;
      for (const markPath of allPaths) {
        const normalizedMarkPath = markPath.replace(/\\/g, "/").toLowerCase();
        if (normalizedPath.startsWith(normalizedMarkPath) || normalizedPath === normalizedMarkPath) {
          if (normalizedMarkPath.length > bestMatchLength) {
            bestMatch = markPath;
            bestMatchLength = normalizedMarkPath.length;
          }
        }
      }
      if (!bestMatch)
        return null;
      const marks = getMarksForPath(bestMatch);
      return marks.length > 0 ? { path: bestMatch, marks } : null;
    },
    [allPaths, getMarksForPath]
  );
  const hasMarks = reactExports.useCallback(
    (path) => {
      return getMarksForPath(path).length > 0;
    },
    [getMarksForPath]
  );
  const getGroupedMarks = reactExports.useCallback(() => {
    const groups = /* @__PURE__ */ new Map();
    for (const mark2 of allMarks) {
      if (mark2.syncStatus === PathMarkSyncStatus.PendingDelete)
        continue;
      const path = mark2.path || "Unknown";
      if (!groups.has(path)) {
        groups.set(path, []);
      }
      groups.get(path).push(mark2);
    }
    return Array.from(groups.entries()).map(([path, marks]) => ({
      path,
      marks: marks.sort((a2, b2) => (a2.priority || 0) - (b2.priority || 0)),
      exists: pathExistsMap.get(path)
    }));
  }, [allMarks, pathExistsMap]);
  const getGroupedMarksFiltered = reactExports.useCallback((showOnlyInvalid) => {
    const groups = getGroupedMarks();
    if (!showOnlyInvalid)
      return groups;
    return groups.filter((group) => group.exists === false);
  }, [getGroupedMarks]);
  return {
    allMarks,
    allPaths,
    loading,
    checkingPaths,
    pathExistsMap,
    loadAllMarks,
    getMarksForPath,
    getApplicableMarksGroup,
    hasMarks,
    getGroupedMarks,
    getGroupedMarksFiltered,
    getInvalidPathsCount
  };
}
const PathMarkTreeView = ({
  rootPath,
  onMarksChanged,
  onInitialized
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const { loadAllMarks, getMarksForPath } = usePathMarks();
  const { enterCopyMode, selectAllMarks } = useCopyMarksStore();
  const notifyMarksChanged = reactExports.useCallback(() => {
    loadAllMarks();
    onMarksChanged == null ? void 0 : onMarksChanged();
  }, [loadAllMarks, onMarksChanged]);
  const handleSaveMark = reactExports.useCallback(
    async (entry, newMark, oldMark) => {
      try {
        const oldMarkId = oldMark == null ? void 0 : oldMark.id;
        if (oldMarkId) {
          await BApi$1.pathMark.updatePathMark(oldMarkId, {
            ...newMark,
            path: entry.path
          });
        } else {
          await BApi$1.pathMark.addPathMark({
            ...newMark,
            path: entry.path
          });
        }
        toast.success(t2(oldMark ? "pathMarkConfig.success.markUpdated" : "pathMarkConfig.success.markAdded"));
        notifyMarksChanged();
      } catch (error2) {
        console.error("Failed to save mark", error2);
        toast.danger(t2("pathMarkConfig.error.saveMark"));
      }
    },
    [t2, notifyMarksChanged]
  );
  const handleDeleteMark = reactExports.useCallback(
    async (entry, mark2) => {
      const markId = mark2 == null ? void 0 : mark2.id;
      if (!markId) {
        console.error("Mark has no id, cannot delete");
        return;
      }
      const confirmed = await new Promise((resolve2) => {
        const modal2 = createPortal(Modal, {
          defaultVisible: true,
          title: t2("pathMarkConfig.confirm.deleteMarkTitle"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("pathMarkConfig.confirm.deleteMarkQuestion") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-default-500 mt-2", children: [
              t2("common.label.path"),
              ": ",
              entry.path
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-default-500", children: [
              t2("common.label.priority"),
              ": ",
              mark2.priority
            ] })
          ] }),
          footer: {
            actions: ["cancel", "ok"],
            okProps: {
              color: "danger",
              children: t2("common.action.delete")
            }
          },
          onOk: () => {
            resolve2(true);
            modal2.destroy();
          },
          onDestroyed: () => {
            resolve2(false);
          }
        });
      });
      if (confirmed) {
        try {
          await BApi$1.pathMark.softDeletePathMark(markId);
          toast.success(t2("pathMarkConfig.success.markDeleted"));
          notifyMarksChanged();
        } catch (error2) {
          console.error("Failed to delete mark", error2);
          toast.danger(t2("pathMarkConfig.error.deleteMark"));
        }
      }
    },
    [createPortal, t2, notifyMarksChanged]
  );
  const renderAfterName = reactExports.useCallback(
    (entry) => {
      const marks = getMarksForPath(entry.path);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        PathMarks,
        {
          entry,
          marks,
          onDeleteMark: handleDeleteMark,
          onSaveMark: handleSaveMark,
          onTaskComplete: notifyMarksChanged
        }
      );
    },
    [getMarksForPath, handleSaveMark, handleDeleteMark, notifyMarksChanged]
  );
  const handleAddMarksFromContextMenu = reactExports.useCallback(
    async (entries, newMark) => {
      try {
        for (const entry of entries) {
          await BApi$1.pathMark.addPathMark({
            ...newMark,
            path: entry.path
          });
        }
        toast.success(t2("pathMarkConfig.success.markAddedToCount", { count: entries.length }));
        notifyMarksChanged();
      } catch (error2) {
        console.error("Failed to add marks", error2);
        toast.danger(t2("pathMarkConfig.error.addMarks"));
      }
    },
    [t2, notifyMarksChanged]
  );
  const handlePasteMarks = reactExports.useCallback(
    async (targetPath, marks) => {
      try {
        for (const mark2 of marks) {
          await BApi$1.pathMark.addPathMark({
            path: targetPath,
            type: mark2.type,
            configJson: mark2.configJson,
            priority: mark2.priority,
            expiresInSeconds: mark2.expiresInSeconds
          });
        }
        toast.success(t2("pathMarkConfig.success.pastedCount", { count: marks.length }));
        notifyMarksChanged();
      } catch (error2) {
        console.error("Failed to paste marks", error2);
        toast.danger(t2("pathMarkConfig.error.pasteMarks"));
      }
    },
    [t2, notifyMarksChanged]
  );
  const renderBeforeRightOperations = reactExports.useCallback(
    (entry) => {
      const marks = getMarksForPath(entry.path);
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        PasteMarksButton,
        {
          targetPath: entry.path,
          existingMarks: marks,
          onPaste: (marksToPaste) => handlePasteMarks(entry.path, marksToPaste)
        }
      );
    },
    [getMarksForPath, handlePasteMarks]
  );
  const handleEnterCopyModeFromContextMenu = reactExports.useCallback(
    (entry) => {
      const marks = getMarksForPath(entry.path);
      if (marks.length > 0) {
        enterCopyMode(entry.path);
        const markIds = marks.filter((m2) => m2.id !== void 0).map((m2) => m2.id);
        selectAllMarks(markIds);
      }
    },
    [enterCopyMode, selectAllMarks, getMarksForPath]
  );
  const renderExtraContextMenuItems = reactExports.useCallback(
    (entries) => {
      if (entries.length === 0)
        return null;
      const singleEntry = entries.length === 1 ? entries[0] : null;
      const singleEntryMarks = singleEntry ? getMarksForPath(singleEntry.path) : [];
      const canCopyMarks = singleEntry && singleEntryMarks.length > 0;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          MenuItem,
          {
            onClick: () => {
              createPortal(MarkConfigModal, {
                markType: PathMarkType.Resource,
                rootPaths: entries.map((e2) => e2.path),
                onSave: async (mark2) => {
                  handleAddMarksFromContextMenu(entries, mark2);
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAim, { className: "text-base text-success" }),
              t2("pathMarkConfig.action.addResourceMark", { count: entries.length })
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          MenuItem,
          {
            onClick: () => {
              createPortal(MarkConfigModal, {
                markType: PathMarkType.Property,
                rootPaths: entries.map((e2) => e2.path),
                onSave: async (mark2) => {
                  handleAddMarksFromContextMenu(entries, mark2);
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAim, { className: "text-base text-primary" }),
              t2("pathMarkConfig.action.addPropertyMark", { count: entries.length })
            ] })
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          MenuItem,
          {
            onClick: () => {
              createPortal(MarkConfigModal, {
                markType: PathMarkType.MediaLibrary,
                rootPaths: entries.map((e2) => e2.path),
                onSave: async (mark2) => {
                  handleAddMarksFromContextMenu(entries, mark2);
                }
              });
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAim, { className: "text-base text-secondary" }),
              t2("pathMarkConfig.action.addMediaLibraryMark", { count: entries.length })
            ] })
          }
        ),
        canCopyMarks && /* @__PURE__ */ jsxRuntimeExports.jsx(
          MenuItem,
          {
            onClick: () => {
              handleEnterCopyModeFromContextMenu(singleEntry);
            },
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-base text-default-500" }),
              t2("pathMarkConfig.action.copyMarks")
            ] })
          }
        )
      ] });
    },
    [createPortal, t2, handleAddMarksFromContextMenu, getMarksForPath, handleEnterCopyModeFromContextMenu]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 overflow-hidden h-full flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      FileExplorer,
      {
        expandable: true,
        capabilities: ["select", "multi-select", "range-select"],
        renderAfterName,
        renderBeforeRightOperations,
        renderExtraContextMenuItems,
        rootPath,
        selectable: "multiple",
        onInitialized
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(CopyMarksSidebar, {})
  ] });
};
PathMarkTreeView.displayName = "PathMarkTreeView";
const PathMarkSettingsButton = ({
  buttonVariant = "light",
  buttonSize = "sm",
  className
}) => {
  var _a2, _b2, _c2, _d;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const resourceOptionsStore = useResourceOptionsStore((state) => state);
  const [visible, setVisible] = reactExports.useState(false);
  const syncMarksImmediately = ((_b2 = (_a2 = resourceOptionsStore.data) == null ? void 0 : _a2.synchronizationOptions) == null ? void 0 : _b2.syncMarksImmediately) ?? false;
  const keepResourcesOnPathChange = ((_c2 = resourceOptionsStore.data) == null ? void 0 : _c2.keepResourcesOnPathChange) ?? false;
  const handleToggleSyncImmediately = reactExports.useCallback(
    async (checked) => {
      var _a3;
      if (checked) {
        const confirmed = await new Promise((resolve2) => {
          const modal2 = createPortal(Modal, {
            defaultVisible: true,
            title: t2("pathMarkConfig.modal.enableSyncImmediatelyTitle"),
            children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("pathMarkConfig.tip.syncImmediately") }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-warning", children: t2("pathMarkConfig.warning.syncDataNote") })
            ] }),
            footer: {
              actions: ["cancel", "ok"],
              okProps: {
                children: t2("pathMarkConfig.action.enable")
              }
            },
            onOk: () => {
              resolve2(true);
              modal2.destroy();
            },
            onDestroyed: () => {
              resolve2(false);
            }
          });
        });
        if (!confirmed) {
          return;
        }
      }
      try {
        await BApi$1.options.patchResourceOptions({
          synchronizationOptions: {
            ...(_a3 = resourceOptionsStore.data) == null ? void 0 : _a3.synchronizationOptions,
            syncMarksImmediately: checked
          }
        });
      } catch (error2) {
        console.error("Failed to update sync option", error2);
        toast.danger(t2("pathMarkConfig.error.updateOption"));
      }
    },
    [createPortal, (_d = resourceOptionsStore.data) == null ? void 0 : _d.synchronizationOptions, t2]
  );
  const handleToggleKeepResourcesOnPathChange = reactExports.useCallback(
    async (checked) => {
      try {
        await BApi$1.options.patchResourceOptions({
          keepResourcesOnPathChange: checked
        });
      } catch (error2) {
        console.error("Failed to update option", error2);
        toast.danger(t2("pathMarkConfig.error.updateOption"));
      }
    },
    [t2]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      Button,
      {
        isIconOnly: true,
        className,
        size: buttonSize,
        variant: buttonVariant,
        onPress: () => setVisible(true),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-xl" })
      }
    ),
    visible && /* @__PURE__ */ jsxRuntimeExports.jsx(
      Modal,
      {
        footer: false,
        size: "md",
        title: t2("pathMarkConfig.modal.settingsTitle"),
        visible,
        onClose: () => setVisible(false),
        children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 py-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: syncMarksImmediately,
              size: "sm",
              onValueChange: handleToggleSyncImmediately,
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.label.syncImmediately") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: t2("pathMarkConfig.tip.syncImmediately") })
              ] })
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: keepResourcesOnPathChange,
              size: "sm",
              onValueChange: handleToggleKeepResourcesOnPathChange,
              children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.label.keepResourcesOnPathChange") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: t2("pathMarkConfig.tip.keepResourcesOnPathChange") })
              ] })
            }
          )
        ] })
      }
    )
  ] });
};
PathMarkSettingsButton.displayName = "PathMarkSettingsButton";
const SyncTaskId = "SyncPathMarks";
const SyncProgressModal = ({ visible = true, onClose, onComplete, onDestroyed }) => {
  const { t: t2 } = useTranslation();
  const [isOpen, setIsOpen] = reactExports.useState(visible);
  const bTasks = useBTasksStore((state) => state.tasks);
  const task = bTasks == null ? void 0 : bTasks.find((d2) => d2.id === SyncTaskId);
  const prevStatusRef = reactExports.useRef(task == null ? void 0 : task.status);
  const isSyncing = (task == null ? void 0 : task.status) === BTaskStatus.Running || (task == null ? void 0 : task.status) === BTaskStatus.NotStarted;
  const isPaused = (task == null ? void 0 : task.status) === BTaskStatus.Paused;
  const isCompleted = (task == null ? void 0 : task.status) === BTaskStatus.Completed;
  const isError = (task == null ? void 0 : task.status) === BTaskStatus.Error;
  const isCancelled = (task == null ? void 0 : task.status) === BTaskStatus.Cancelled;
  const progress2 = (task == null ? void 0 : task.percentage) || 0;
  const currentProcess = (task == null ? void 0 : task.process) || "";
  const error2 = task == null ? void 0 : task.error;
  const data = task == null ? void 0 : task.data;
  reactExports.useEffect(() => {
    if (visible) {
      BApi$1.pathMark.startPathMarkSyncAll().catch(console.error);
    }
  }, [visible]);
  reactExports.useEffect(() => {
    if (prevStatusRef.current !== void 0 && prevStatusRef.current !== BTaskStatus.Completed && (task == null ? void 0 : task.status) === BTaskStatus.Completed) {
      onComplete == null ? void 0 : onComplete();
    }
    prevStatusRef.current = task == null ? void 0 : task.status;
  }, [onComplete, task == null ? void 0 : task.status]);
  const handlePause = reactExports.useCallback(async () => {
    await BApi$1.backgroundTask.pauseBackgroundTask(SyncTaskId);
  }, []);
  const handleResume = reactExports.useCallback(async () => {
    await BApi$1.backgroundTask.resumeBackgroundTask(SyncTaskId);
  }, []);
  const handleStop = reactExports.useCallback(async () => {
    await BApi$1.pathMark.stopPathMarkSync();
  }, []);
  const handleClose = reactExports.useCallback(() => {
    if (!isSyncing && !isPaused) {
      setIsOpen(false);
      onClose == null ? void 0 : onClose();
    }
  }, [isSyncing, isPaused, onClose]);
  reactExports.useEffect(() => {
    setIsOpen(visible);
  }, [visible]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    modal_default,
    {
      isOpen,
      isDismissable: false,
      hideCloseButton: isSyncing || isPaused,
      isKeyboardDismissDisabled: isSyncing || isPaused,
      onClose: handleClose,
      onOpenChange: (open) => {
        if (!open && !isSyncing && !isPaused) {
          handleClose();
          onDestroyed == null ? void 0 : onDestroyed();
        }
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs(modal_content_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_header_default, { className: "flex flex-col gap-1", children: t2("pathMarkConfig.modal.syncProgress") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_body_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.label.progress") }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-500", children: [
                Math.round(progress2),
                "%"
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              progress_default,
              {
                "aria-label": "Sync progress",
                color: isError ? "danger" : isPaused ? "warning" : "primary",
                isIndeterminate: (isSyncing || isPaused) && progress2 === 0,
                value: progress2,
                className: "w-full"
              }
            )
          ] }),
          currentProcess && (isSyncing || isPaused) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500", children: [
              t2("pathMarkConfig.label.currentlySyncing"),
              ":"
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm truncate", title: currentProcess, children: currentProcess })
          ] }),
          isError && error2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-danger", children: [
              t2("pathMarkConfig.label.error"),
              ":"
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-danger truncate", title: error2, children: error2 })
          ] }),
          isPaused && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-warning", children: t2("pathMarkConfig.status.paused") }),
          isCancelled && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-warning", children: t2("pathMarkConfig.status.cancelled") }),
          isCompleted && data && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-success", children: t2("pathMarkConfig.status.completed") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 text-sm", children: [
              data.resourcesCreated !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "success", size: "sm", variant: "flat", children: [
                t2("pathMarkConfig.label.resources"),
                ": ",
                data.resourcesCreated
              ] }),
              data.propertiesApplied !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "primary", size: "sm", variant: "flat", children: [
                t2("pathMarkConfig.label.properties"),
                ": ",
                data.propertiesApplied
              ] }),
              (data.failedMarks || 0) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "danger", size: "sm", variant: "flat", children: [
                t2("pathMarkConfig.status.failed"),
                ": ",
                data.failedMarks
              ] })
            ] })
          ] })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(modal_footer_default, { children: isSyncing ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "warning",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePause, {}),
              onPress: handlePause,
              children: t2("pathMarkConfig.action.pause")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "danger",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, {}),
              onPress: handleStop,
              children: t2("pathMarkConfig.action.stop")
            }
          )
        ] }) : isPaused ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "primary",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlayCircle, {}),
              onPress: handleResume,
              children: t2("pathMarkConfig.action.resume")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              color: "danger",
              variant: "flat",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineStop, {}),
              onPress: handleStop,
              children: t2("pathMarkConfig.action.stop")
            }
          )
        ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleClose, children: t2("common.action.close") }) })
      ] })
    }
  );
};
SyncProgressModal.displayName = "SyncProgressModal";
const getSyncStatusIcon = (status) => {
  switch (status) {
    case PathMarkSyncStatus.Pending:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, { className: "text-warning" });
    case PathMarkSyncStatus.Syncing:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm", className: "w-3 h-3" });
    case PathMarkSyncStatus.Synced:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-success" });
    case PathMarkSyncStatus.Failed:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-danger" });
    case PathMarkSyncStatus.PendingDelete:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-danger" });
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, { className: "text-default-400" });
  }
};
const getSyncStatusLabel = (status, t2) => {
  const translate = t2 || ((key) => key);
  switch (status) {
    case PathMarkSyncStatus.Pending:
      return translate("pathMarkConfig.status.pending");
    case PathMarkSyncStatus.Syncing:
      return translate("pathMarkConfig.status.syncing");
    case PathMarkSyncStatus.Synced:
      return translate("pathMarkConfig.status.synced");
    case PathMarkSyncStatus.Failed:
      return translate("pathMarkConfig.status.failed");
    case PathMarkSyncStatus.PendingDelete:
      return translate("pathMarkConfig.status.pendingDelete");
    default:
      return translate("pathMarkConfig.status.unknown");
  }
};
const getMarkTypeLabel = (type4, t2) => {
  const translate = t2 || ((key) => key);
  switch (type4) {
    case PathMarkType.Resource:
      return translate("Resource");
    case PathMarkType.Property:
      return translate("Property");
    case PathMarkType.MediaLibrary:
      return translate("Media Library");
    default:
      return translate("Unknown");
  }
};
const getMarkTypeColor = (type4) => {
  switch (type4) {
    case PathMarkType.Resource:
      return "success";
    case PathMarkType.Property:
      return "primary";
    case PathMarkType.MediaLibrary:
      return "secondary";
    default:
      return "default";
  }
};
const buildMarkTaskId = (markId) => `SyncPathMark_${markId}`;
const PendingSyncListModal = ({
  visible = true,
  onClose,
  onSyncComplete,
  onDestroyed
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [isOpen, setIsOpen] = reactExports.useState(visible);
  const [loading, setLoading] = reactExports.useState(false);
  const [pendingMarks, setPendingMarks] = reactExports.useState([]);
  const bTasks = useBTasksStore((state) => state.tasks);
  const pathMarksStore = usePathMarksStore((state) => state.marks);
  const loadPendingMarks = reactExports.useCallback(async () => {
    setLoading(true);
    try {
      const response = await BApi$1.pathMark.getPendingPathMarks();
      setPendingMarks((response == null ? void 0 : response.data) || []);
    } catch (error2) {
      console.error("Failed to load pending marks", error2);
    } finally {
      setLoading(false);
    }
  }, []);
  reactExports.useEffect(() => {
    if (visible) {
      loadPendingMarks();
    }
  }, [visible, loadPendingMarks]);
  reactExports.useEffect(() => {
    setIsOpen(visible);
  }, [visible]);
  const handleClose = reactExports.useCallback(() => {
    setIsOpen(false);
    onClose == null ? void 0 : onClose();
  }, [onClose]);
  const groupedMarks = React$6.useMemo(() => {
    const groups = /* @__PURE__ */ new Map();
    for (const propMark of pendingMarks) {
      const storeMark = propMark.id != null ? pathMarksStore.get(propMark.id) : void 0;
      const mark2 = storeMark ?? propMark;
      const path = mark2.path || "Unknown";
      if (!groups.has(path)) {
        groups.set(path, []);
      }
      groups.get(path).push(mark2);
    }
    return Array.from(groups.entries()).map(([path, marks]) => ({
      path,
      marks: marks.sort((a2, b2) => (a2.priority || 0) - (b2.priority || 0))
    }));
  }, [pendingMarks, pathMarksStore]);
  const handleSyncMark = reactExports.useCallback(async (mark2) => {
    if (!mark2.id)
      return;
    try {
      await BApi$1.pathMark.startPathMarkSync([mark2.id]);
    } catch (error2) {
      console.error("Failed to start sync for mark", mark2.id, error2);
    }
  }, []);
  const handleSyncAll = reactExports.useCallback(() => {
    createPortal(SyncProgressModal, {
      visible: true,
      onComplete: () => {
        loadPendingMarks();
        onSyncComplete == null ? void 0 : onSyncComplete();
      }
    });
  }, [createPortal, loadPendingMarks, onSyncComplete]);
  const totalPending = React$6.useMemo(() => {
    return pendingMarks.filter((propMark) => {
      const storeMark = propMark.id != null ? pathMarksStore.get(propMark.id) : void 0;
      const mark2 = storeMark ?? propMark;
      return mark2.syncStatus === PathMarkSyncStatus.Pending || mark2.syncStatus === PathMarkSyncStatus.PendingDelete;
    }).length;
  }, [pendingMarks, pathMarksStore]);
  const getMarkTask = (markId) => {
    return bTasks == null ? void 0 : bTasks.find((t22) => t22.id === buildMarkTaskId(markId));
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      visible: isOpen,
      size: "lg",
      title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.modal.pendingSyncMarks") }),
        totalPending > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "flat", children: totalPending })
      ] }),
      footer: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "primary",
            startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, {}),
            isDisabled: pendingMarks.length === 0 || loading,
            onPress: handleSyncAll,
            children: t2("pathMarkConfig.action.syncAll")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "default", variant: "light", onPress: handleClose, children: t2("common.action.close") })
      ] }),
      onClose: handleClose,
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4 max-h-[60vh] overflow-y-auto", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : pendingMarks.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center py-8 text-default-500", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCheck, { className: "text-4xl text-success mb-2" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("pathMarkConfig.status.allSynced") })
      ] }) : groupedMarks.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-2 py-1 bg-default-100 rounded-lg", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium truncate flex-1", title: group.path, children: group.path }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: group.marks.length })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 pl-4", children: group.marks.map((mark2) => {
          const markTask = getMarkTask(mark2.id);
          const isTaskRunning = (markTask == null ? void 0 : markTask.status) === BTaskStatus.Running || (markTask == null ? void 0 : markTask.status) === BTaskStatus.NotStarted;
          const isPendingDelete = mark2.syncStatus === PathMarkSyncStatus.PendingDelete;
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: `flex items-center gap-2 p-2 rounded-lg border border-default-200 ${isPendingDelete ? "opacity-50 line-through" : ""}`,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: getSyncStatusLabel(mark2.syncStatus, t2), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center", children: isTaskRunning ? /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm", className: "w-4 h-4" }) : getSyncStatusIcon(mark2.syncStatus) }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Chip,
                  {
                    color: getMarkTypeColor(mark2.type),
                    size: "sm",
                    variant: "flat",
                    children: getMarkTypeLabel(mark2.type, t2)
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-default-500", children: [
                  "#",
                  mark2.priority
                ] }),
                isTaskRunning && markTask && /* @__PURE__ */ jsxRuntimeExports.jsx(
                  circular_progress_default,
                  {
                    size: "sm",
                    value: markTask.percentage || 0,
                    showValueLabel: true,
                    className: "w-8"
                  }
                ),
                mark2.syncError && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: mark2.syncError, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-danger text-xs truncate max-w-[150px]", children: mark2.syncError }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    size: "sm",
                    color: "primary",
                    variant: "light",
                    isIconOnly: true,
                    isLoading: isTaskRunning,
                    isDisabled: isPendingDelete || isTaskRunning,
                    onPress: () => handleSyncMark(mark2),
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, {})
                  }
                )
              ]
            },
            mark2.id
          );
        }) })
      ] }, group.path)) })
    }
  );
};
PendingSyncListModal.displayName = "PendingSyncListModal";
const isPathMarkSyncTask = (taskId) => taskId === "SyncPathMarks" || taskId.startsWith("SyncPathMark_");
const PendingSyncButton = reactExports.forwardRef(
  ({ buttonSize = "sm", className, onSyncComplete }, ref) => {
    const { t: t2 } = useTranslation();
    const [pendingSyncCount, setPendingSyncCount] = reactExports.useState(0);
    const [showPendingSyncModal, setShowPendingSyncModal] = reactExports.useState(false);
    const prevTaskStatusesRef = reactExports.useRef(/* @__PURE__ */ new Map());
    const bTasks = useBTasksStore((state) => state.tasks);
    const loadPendingSyncCount = reactExports.useCallback(async () => {
      try {
        const response = await BApi$1.pathMark.getPendingPathMarksCount();
        setPendingSyncCount((response == null ? void 0 : response.data) ?? 0);
      } catch (error2) {
        console.error("Failed to load pending sync count", error2);
      }
    }, []);
    reactExports.useEffect(() => {
      loadPendingSyncCount();
    }, [loadPendingSyncCount]);
    reactExports.useEffect(() => {
      if (!bTasks)
        return;
      const prevStatuses = prevTaskStatusesRef.current;
      let hasCompletedTask = false;
      for (const task of bTasks) {
        if (!isPathMarkSyncTask(task.id))
          continue;
        const prevStatus = prevStatuses.get(task.id);
        if (prevStatus !== void 0 && (prevStatus === BTaskStatus.Running || prevStatus === BTaskStatus.NotStarted) && task.status === BTaskStatus.Completed) {
          hasCompletedTask = true;
        }
        prevStatuses.set(task.id, task.status);
      }
      if (hasCompletedTask) {
        loadPendingSyncCount();
        onSyncComplete == null ? void 0 : onSyncComplete();
      }
    }, [bTasks, loadPendingSyncCount, onSyncComplete]);
    reactExports.useImperativeHandle(ref, () => ({
      refresh: loadPendingSyncCount
    }), [loadPendingSyncCount]);
    const handleSyncComplete = reactExports.useCallback(() => {
      loadPendingSyncCount();
      onSyncComplete == null ? void 0 : onSyncComplete();
    }, [loadPendingSyncCount, onSyncComplete]);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        badge_default,
        {
          color: "warning",
          content: pendingSyncCount,
          isInvisible: pendingSyncCount === 0,
          size: "sm",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              className,
              color: pendingSyncCount > 0 ? "warning" : "default",
              size: buttonSize,
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineClockCircle, {}),
              variant: "flat",
              onPress: () => setShowPendingSyncModal(true),
              children: t2("pathMarkConfig.action.pendingSync")
            }
          )
        }
      ),
      showPendingSyncModal && /* @__PURE__ */ jsxRuntimeExports.jsx(
        PendingSyncListModal,
        {
          visible: showPendingSyncModal,
          onClose: () => setShowPendingSyncModal(false),
          onSyncComplete: handleSyncComplete
        }
      )
    ] });
  }
);
PendingSyncButton.displayName = "PendingSyncButton";
const TOTAL_SLIDES = 4;
const PathMarkGuideModal = ({ visible, onComplete }) => {
  const { t: t2 } = useTranslation();
  const carouselRef = reactExports.useRef(null);
  const [currentSlide, setCurrentSlide] = reactExports.useState(0);
  const isFirst = currentSlide === 0;
  const isLast = currentSlide === TOTAL_SLIDES - 1;
  const handlePrev = () => {
    var _a2;
    (_a2 = carouselRef.current) == null ? void 0 : _a2.prev();
  };
  const handleNext = () => {
    var _a2;
    if (isLast) {
      onComplete();
    } else {
      (_a2 = carouselRef.current) == null ? void 0 : _a2.next();
    }
  };
  const handleSkip = () => {
    onComplete();
  };
  const handleSlideChange = (current) => {
    setCurrentSlide(current);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      hideCloseButton: true,
      classNames: {
        base: "max-w-[900px]"
      },
      footer: false,
      isDismissable: false,
      isKeyboardDismissDisabled: true,
      size: "4xl",
      visible,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Carousel, { ref: carouselRef, afterChange: handleSlideChange, dots: false, infinite: false, children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-primary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineTags, { className: "text-4xl text-primary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("pathMarkGuide.welcome.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center max-w-lg", children: t2("pathMarkGuide.welcome.description") })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-secondary/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineAppstore, { className: "text-4xl text-secondary" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("pathMarkGuide.markTypes.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("pathMarkGuide.markTypes.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-primary/10 text-primary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFileAdd, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-primary text-sm", children: t2("pathMarkGuide.markTypes.resource") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 truncate", children: t2("pathMarkGuide.markTypes.resourceDesc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineTags, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("pathMarkGuide.markTypes.property") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 truncate", children: t2("pathMarkGuide.markTypes.propertyDesc") })
                ] })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-secondary/10 text-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MdVideoLibrary, { className: "text-lg" }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-default-700 text-sm", children: t2("pathMarkGuide.markTypes.mediaLibrary") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 truncate", children: t2("pathMarkGuide.markTypes.mediaLibraryDesc") })
                ] })
              ] })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 py-2 rounded-lg bg-warning/5 border border-warning/20 max-w-lg w-full mt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.markTypes.resourceImportant") }) })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-warning/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-4xl text-warning" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("pathMarkGuide.configure.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("pathMarkGuide.configure.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning font-bold text-sm", children: "1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.configure.step1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning font-bold text-sm", children: "2" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.configure.step2") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-warning/10 text-warning font-bold text-sm", children: "3" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.configure.step3") })
              ] })
            ] })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center px-8 py-6", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-14 h-14 mb-4 flex items-center justify-center rounded-2xl bg-success/10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-4xl text-success" }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-bold mb-2 text-center", children: t2("pathMarkGuide.sync.title") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-500 text-center mb-4 max-w-lg", children: t2("pathMarkGuide.sync.subtitle") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-3 py-2 rounded-lg bg-warning/5 border border-warning/20 max-w-lg w-full mb-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.sync.explanation") }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-2 max-w-lg w-full", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "1" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.sync.point1") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "flex items-center gap-3 px-3 py-2 rounded-lg bg-default-100", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center rounded-full bg-success/10 text-success font-bold text-sm", children: "2" }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-700 text-sm", children: t2("pathMarkGuide.sync.point2") })
              ] })
            ] })
          ] }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center gap-2 py-3", children: Array.from({ length: TOTAL_SLIDES }).map((_24, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: `w-2 h-2 rounded-full transition-all ${index2 === currentSlide ? "bg-primary w-6" : "bg-default-300"}`
          },
          index2
        )) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between items-center px-6 pb-5", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "light", onPress: handleSkip, children: t2("pathMarkGuide.skip") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isDisabled: isFirst, variant: "flat", onPress: handlePrev, children: t2("pathMarkGuide.previous") }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", onPress: handleNext, children: isLast ? t2("pathMarkGuide.getStarted") : t2("pathMarkGuide.next") })
          ] })
        ] })
      ] })
    }
  );
};
const GUIDE_KEY = "bakabase-path-mark-guide-completed";
const usePathMarkGuide = () => {
  const [showGuide, setShowGuide] = reactExports.useState(false);
  reactExports.useEffect(() => {
    if (typeof window === "undefined" || typeof localStorage === "undefined") {
      return;
    }
    const completed = localStorage.getItem(GUIDE_KEY);
    if (!completed) {
      setShowGuide(true);
    }
  }, []);
  const completeGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.setItem(GUIDE_KEY, "true");
    }
    setShowGuide(false);
  }, []);
  const resetGuide = reactExports.useCallback(() => {
    if (typeof localStorage !== "undefined") {
      localStorage.removeItem(GUIDE_KEY);
    }
    setShowGuide(true);
  }, []);
  return {
    showGuide,
    completeGuide,
    resetGuide
  };
};
const PATH_MARK_ROOT_PATH_KEY = "pathMarkConfig.rootPath";
const PathRuleConfigPage = () => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const [searchParams] = useSearchParams();
  const { loadAllMarks } = usePathMarks();
  const { showGuide, completeGuide } = usePathMarkGuide();
  const [rootPath, setRootPath] = reactExports.useState();
  const [rootPathInitialized, setRootPathInitialized] = reactExports.useState(false);
  const pendingSyncButtonRef = reactExports.useRef(null);
  const refreshPendingSyncCount = () => {
    var _a2;
    (_a2 = pendingSyncButtonRef.current) == null ? void 0 : _a2.refresh();
  };
  reactExports.useEffect(() => {
    if (!rootPathInitialized) {
      const pathFromUrl = searchParams.get("path");
      if (pathFromUrl) {
        setRootPath(decodeURIComponent(pathFromUrl));
      } else {
        const savedPath = localStorage.getItem(PATH_MARK_ROOT_PATH_KEY);
        if (savedPath) {
          setRootPath(savedPath);
        }
      }
      setRootPathInitialized(true);
    }
  }, [rootPathInitialized, searchParams]);
  const handleRootPathInitialized = (v2) => {
    if (v2 != void 0) {
      localStorage.setItem(PATH_MARK_ROOT_PATH_KEY, v2);
    }
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "path-mark-config-page h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-2 flex-1 min-h-0", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold", children: t2("pathMarkConfig.title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineTags, {}),
              variant: "flat",
              onPress: () => navigate("/path-marks"),
              children: t2("pathMarkConfig.action.viewAllMarks")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(PendingSyncButton, { ref: pendingSyncButtonRef, onSyncComplete: loadAllMarks }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkSettingsButton, {})
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500", children: t2("pathMarkConfig.tip.description") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-400", children: t2("pathMarkConfig.tip.pathMemory") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-hidden flex-1 min-h-0 flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 overflow-hidden h-full", children: rootPathInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(
        PathMarkTreeView,
        {
          rootPath,
          onMarksChanged: refreshPendingSyncCount,
          onInitialized: handleRootPathInitialized
        }
      ) }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 p-3 bg-default-50 rounded-lg", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("pathMarkConfig.label.nextStepHint") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "flat",
            onPress: () => navigate("/path-marks"),
            children: t2("pathMarkConfig.action.viewAllMarks")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "flat",
            onPress: () => navigate("/resource-profile"),
            children: t2("pathMarkConfig.action.goToResourceProfile")
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkGuideModal, { visible: showGuide, onComplete: completeGuide })
  ] });
};
PathRuleConfigPage.displayName = "PathRuleConfigPage";
const TreeNodeComponent = ({
  node: node2,
  depth,
  onSaveMark,
  onDeleteMark,
  onConfigureSubPathMarks,
  onDeletePathMarks,
  onPasteMarks
}) => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const [expanded, setExpanded] = reactExports.useState(true);
  const {
    candidateGroups,
    selectedGroupId,
    copyModeEntryPath,
    selectedMarkIds,
    enterCopyMode,
    exitCopyMode,
    toggleMarkSelection,
    selectAllMarks,
    confirmSelection
  } = useCopyMarksStore();
  const isInCopyMode = copyModeEntryPath === node2.fullPath;
  const hasChildren2 = node2.children.size > 0;
  const hasMarks = node2.marks.length > 0;
  const children = Array.from(node2.children.values());
  const pasteInfo = reactExports.useMemo(() => {
    const selectedGroup = candidateGroups.find((g2) => g2.id === selectedGroupId);
    if (!selectedGroup || selectedGroup.sourcePath === node2.fullPath) {
      return { canPaste: false, newMarks: [], existingCount: 0 };
    }
    const newMarks = getNewMarks(selectedGroup.marks, node2.marks);
    const existingCount = getExistingMarksCount(selectedGroup.marks, node2.marks);
    return { canPaste: newMarks.length > 0, newMarks, existingCount };
  }, [candidateGroups, selectedGroupId, node2.fullPath, node2.marks]);
  const handleCopyPath = reactExports.useCallback(() => {
    navigator.clipboard.writeText(node2.fullPath);
    toast.success(t2("pathMarks.success.pathCopied"));
  }, [node2.fullPath, t2]);
  const handleConfigureSubPathMarks = reactExports.useCallback(() => {
    onConfigureSubPathMarks(node2.fullPath);
  }, [node2.fullPath, onConfigureSubPathMarks]);
  const handleDeletePathMarks = reactExports.useCallback(() => {
    onDeletePathMarks(node2.fullPath);
  }, [node2.fullPath, onDeletePathMarks]);
  const handleEnterCopyMode = reactExports.useCallback(() => {
    if (node2.marks.length > 0) {
      enterCopyMode(node2.fullPath);
      const markIds = node2.marks.filter((m2) => m2.id !== void 0).map((m2) => m2.id);
      selectAllMarks(markIds);
    }
  }, [enterCopyMode, node2.fullPath, node2.marks, selectAllMarks]);
  const handleConfirmCopy = reactExports.useCallback(() => {
    confirmSelection(node2.fullPath, node2.marks);
  }, [confirmSelection, node2.fullPath, node2.marks]);
  const handleCancelCopy = reactExports.useCallback(() => {
    exitCopyMode();
  }, [exitCopyMode]);
  const handlePasteMarks = reactExports.useCallback(() => {
    if (pasteInfo.canPaste) {
      onPasteMarks(node2.fullPath, pasteInfo.newMarks);
    }
  }, [node2.fullPath, pasteInfo, onPasteMarks]);
  const [syncing, setSyncing] = reactExports.useState(false);
  const handleSyncPath = reactExports.useCallback(async () => {
    setSyncing(true);
    try {
      await BApi$1.pathMark.startPathMarkSyncByPath({ path: node2.fullPath });
      toast.success(t2("pathMarks.success.syncStarted"));
    } catch (e2) {
      toast.danger(t2("pathMarks.error.failedToStartSync"));
    } finally {
      setSyncing(false);
    }
  }, [node2.fullPath, t2]);
  const handleEditMark = reactExports.useCallback(
    (mark2) => {
      createPortal(MarkConfigModal, {
        mark: mark2,
        markType: mark2.type,
        rootPath: node2.fullPath,
        onSave: async (newMark) => {
          onSaveMark(node2.fullPath, newMark, mark2);
        }
      });
    },
    [createPortal, node2.fullPath, onSaveMark]
  );
  const handleDeleteMark = reactExports.useCallback(
    (mark2) => {
      onDeleteMark(node2.fullPath, mark2);
    },
    [node2.fullPath, onDeleteMark]
  );
  const handleAddMark = reactExports.useCallback(
    (markType) => {
      createPortal(MarkConfigModal, {
        markType,
        rootPath: node2.fullPath,
        onSave: async (newMark) => {
          onSaveMark(node2.fullPath, newMark);
        }
      });
    },
    [createPortal, node2.fullPath, onSaveMark]
  );
  const isInvalid = node2.exists === false;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "div",
      {
        className: `flex items-center py-1.5 px-2 hover:bg-default-100 rounded-md group ${isInvalid ? "bg-danger-50" : ""}`,
        style: { paddingLeft: `${depth * 20 + 8}px` },
        children: [
          hasChildren2 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              className: "min-w-0 w-5 h-5 mr-1",
              size: "sm",
              variant: "light",
              onPress: () => setExpanded(!expanded),
              children: expanded ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDown, { className: "text-sm" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineRight, { className: "text-sm" })
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-6 mr-1" }),
          isInvalid ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-danger mr-2" }) : hasChildren2 || hasMarks ? expanded ? /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolderOpen, { className: "text-warning mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-warning mr-2" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-default-400 mr-2" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("pathMarks.tip.clickToCopyFullPath"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "span",
            {
              className: `font-mono text-sm cursor-pointer hover:text-primary ${isInvalid ? "text-danger line-through" : ""}`,
              onClick: handleCopyPath,
              children: node2.name
            }
          ) }),
          isInvalid && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-danger ml-2", children: [
            "(",
            t2("pathMarks.label.invalid"),
            ")"
          ] }),
          !isInCopyMode && !isInvalid && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5 ml-2", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                Button,
                {
                  isIconOnly: true,
                  className: "min-w-0 w-5 h-5",
                  color: "success",
                  size: "sm",
                  variant: "light",
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlinePlus, { className: "text-base" })
                }
              ) }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                dropdown_menu_default,
                {
                  "aria-label": "Add mark options",
                  onAction: (key) => handleAddMark(Number(key)),
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { className: "text-success", children: t2("pathMarks.label.resourceMark") }, PathMarkType.Resource),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { className: "text-primary", children: t2("pathMarks.label.propertyMark") }, PathMarkType.Property),
                    /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { className: "text-warning", children: t2("pathMarks.label.mediaLibraryMark") }, PathMarkType.MediaLibrary)
                  ]
                }
              )
            ] }),
            hasMarks && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("pathMarks.tip.copyMarksFromThisPath"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "min-w-0 w-5 h-5",
                color: "default",
                size: "sm",
                variant: "light",
                onPress: handleEnterCopyMode,
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineCopy, { className: "text-base" })
              }
            ) })
          ] }),
          hasMarks && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1 ml-3 flex-wrap", children: node2.marks.map((mark2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
            PathMarkChip,
            {
              mark: mark2,
              selectable: isInCopyMode,
              selected: mark2.id !== void 0 && selectedMarkIds.includes(mark2.id),
              onClick: isInCopyMode ? void 0 : () => handleEditMark(mark2),
              onContextMenu: isInCopyMode ? void 0 : () => handleDeleteMark(mark2),
              onSelectionChange: () => {
                if (mark2.id !== void 0) {
                  toggleMarkSelection(mark2.id);
                }
              }
            },
            `mark-${mark2.id}`
          )) }),
          isInCopyMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 ml-3", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(
              Button,
              {
                color: "primary",
                size: "sm",
                isDisabled: selectedMarkIds.length === 0,
                onPress: handleConfirmCopy,
                children: [
                  t2("pathMarks.action.confirmSelection"),
                  " (",
                  selectedMarkIds.length,
                  "/",
                  node2.marks.length,
                  ")"
                ]
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                size: "sm",
                variant: "light",
                onPress: handleCancelCopy,
                children: t2("common.action.cancel")
              }
            )
          ] }),
          !isInCopyMode && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 ml-auto opacity-0 group-hover:opacity-100 transition-opacity", children: [
            !isInvalid && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("pathMarks.tip.configureSubPathMarks"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "min-w-0 w-6 h-6",
                color: "primary",
                size: "sm",
                variant: "light",
                onPress: handleConfigureSubPathMarks,
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSetting, { className: "text-sm" })
              }
            ) }),
            hasMarks && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("pathMarks.tip.syncAllMarksOnThisPath"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "min-w-0 w-6 h-6",
                color: "success",
                size: "sm",
                variant: "light",
                isLoading: syncing,
                onPress: handleSyncPath,
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSync, { className: "text-sm" })
              }
            ) }),
            pasteInfo.canPaste && /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: pasteInfo.existingCount > 0 ? t2("pathMarks.action.pasteMarksWithExisting", {
                  count: pasteInfo.newMarks.length,
                  existing: pasteInfo.existingCount
                }) : t2("pathMarks.action.pasteMarks", { count: pasteInfo.newMarks.length }),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    isIconOnly: true,
                    className: "min-w-0 w-6 h-6",
                    color: "warning",
                    size: "sm",
                    variant: "flat",
                    onPress: handlePasteMarks,
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineSnippets, { className: "text-sm" })
                  }
                )
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("pathMarks.tip.deleteAllMarksOnThisPath"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                className: "min-w-0 w-6 h-6",
                color: "danger",
                size: "sm",
                variant: "light",
                onPress: handleDeletePathMarks,
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineDelete, { className: "text-sm" })
              }
            ) })
          ] })
        ]
      }
    ),
    expanded && hasChildren2 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: children.sort((a2, b2) => a2.name.localeCompare(b2.name)).map((child) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      TreeNodeComponent,
      {
        depth: depth + 1,
        node: child,
        onConfigureSubPathMarks,
        onDeleteMark,
        onDeletePathMarks,
        onPasteMarks,
        onSaveMark
      },
      child.fullPath
    )) })
  ] });
};
TreeNodeComponent.displayName = "TreeNodeComponent";
function buildPathTree(groups) {
  const roots = /* @__PURE__ */ new Map();
  for (const group of groups) {
    const path = group.path;
    const normalizedPath = path.replace(/\\/g, "/");
    const parts = normalizedPath.split("/").filter(Boolean);
    if (parts.length === 0)
      continue;
    let rootKey;
    let startIndex;
    if (parts[0].match(/^[A-Za-z]:$/)) {
      rootKey = parts[0];
      startIndex = 1;
    } else {
      rootKey = normalizedPath.startsWith("/") ? "/" + parts[0] : parts[0];
      startIndex = 1;
    }
    if (!roots.has(rootKey)) {
      roots.set(rootKey, {
        name: rootKey,
        fullPath: rootKey,
        marks: [],
        children: /* @__PURE__ */ new Map()
      });
    }
    let currentNode = roots.get(rootKey);
    let currentPath = rootKey;
    for (let i2 = startIndex; i2 < parts.length; i2++) {
      const part = parts[i2];
      currentPath = currentPath + "/" + part;
      if (!currentNode.children.has(part)) {
        currentNode.children.set(part, {
          name: part,
          fullPath: currentPath,
          marks: [],
          children: /* @__PURE__ */ new Map()
        });
      }
      currentNode = currentNode.children.get(part);
    }
    currentNode.marks = group.marks;
    currentNode.exists = group.exists;
  }
  return Array.from(roots.values());
}
function collapseSingleChildPaths(node2) {
  const children = Array.from(node2.children.values());
  const collapsedChildren = children.map(collapseSingleChildPaths);
  if (collapsedChildren.length === 1 && node2.marks.length === 0) {
    const child = collapsedChildren[0];
    return {
      name: node2.name + "/" + child.name,
      fullPath: child.fullPath,
      marks: child.marks,
      children: child.children,
      exists: child.exists
    };
  }
  const newChildren = /* @__PURE__ */ new Map();
  for (const child of collapsedChildren) {
    newChildren.set(child.name, child);
  }
  return {
    ...node2,
    children: newChildren
  };
}
const PathTree = ({
  groups,
  onSaveMark,
  onDeleteMark,
  onConfigureSubPathMarks,
  onDeletePathMarks,
  onPasteMarks
}) => {
  const { t: t2 } = useTranslation();
  const treeNodes = reactExports.useMemo(() => {
    const rawTree = buildPathTree(groups);
    return rawTree.map(collapseSingleChildPaths).sort((a2, b2) => a2.name.localeCompare(b2.name));
  }, [groups]);
  if (treeNodes.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center h-64 text-default-500", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineFolder, { className: "text-4xl mb-2" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("pathMarks.empty.noPathMarks") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: t2("pathMarks.empty.goToConfigPage") })
    ] });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: treeNodes.map((node2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
    TreeNodeComponent,
    {
      depth: 0,
      node: node2,
      onConfigureSubPathMarks,
      onDeleteMark,
      onDeletePathMarks,
      onPasteMarks,
      onSaveMark
    },
    node2.fullPath
  )) });
};
PathTree.displayName = "PathTree";
const PathConfigModal = ({
  path,
  onDestroyed,
  onMarksChanged
}) => {
  const { t: t2 } = useTranslation();
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      classNames: {
        base: "h-[80vh]",
        body: "p-0 overflow-hidden"
      },
      defaultVisible: true,
      footer: false,
      size: "5xl",
      title: t2("pathMarks.modal.configurePathMarksTitle"),
      onDestroyed,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full p-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 mb-4", children: t2("pathMarks.tip.clickOnFoldersToNavigate") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0 overflow-hidden border border-default-200 rounded-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          PathMarkTreeView,
          {
            rootPath: path,
            onMarksChanged
          }
        ) })
      ] })
    }
  );
};
PathConfigModal.displayName = "PathConfigModal";
const DeleteMarksConfirmationModal = ({
  path,
  marks,
  childPaths = [],
  onDestroyed,
  onConfirm
}) => {
  const { t: t2 } = useTranslation();
  const [includeChildPaths, setIncludeChildPaths] = reactExports.useState(false);
  const totalMarksCount = reactExports.useMemo(() => {
    let count = marks.length;
    if (includeChildPaths) {
      count += childPaths.reduce((sum, child) => sum + child.marks.length, 0);
    }
    return count;
  }, [marks, childPaths, includeChildPaths]);
  const childMarksCount = reactExports.useMemo(() => {
    return childPaths.reduce((sum, child) => sum + child.marks.length, 0);
  }, [childPaths]);
  const handleConfirm = reactExports.useCallback(() => {
    onConfirm(includeChildPaths);
    onDestroyed == null ? void 0 : onDestroyed();
  }, [onConfirm, includeChildPaths, onDestroyed]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      classNames: {
        base: "max-w-2xl max-h-[85vh]",
        body: "overflow-y-auto"
      },
      defaultVisible: true,
      footer: {
        actions: ["cancel", "ok"],
        okProps: {
          children: t2("common.action.delete"),
          color: "danger"
        }
      },
      title: t2("pathMarks.modal.confirmDeleteTitle"),
      onDestroyed,
      onOk: handleConfirm,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-3 p-3 bg-danger-50 border border-danger-200 rounded-lg", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-danger text-xl flex-shrink-0 mt-0.5" }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-danger-700 font-medium", children: t2("pathMarks.status.aboutToDeleteMarks", { count: totalMarksCount }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-danger-600 text-sm mt-1", children: t2("pathMarks.warning.cannotBeUndone") })
          ] })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-default-200 rounded-lg p-3", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium text-sm mb-2", children: t2("pathMarks.label.mainPath") }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 text-sm", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-mono text-xs break-all text-danger", children: path }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 flex-shrink-0", children: marks.map((mark2) => /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkChip, { mark: mark2 }, mark2.id)) })
          ] })
        ] }),
        childPaths.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border border-warning-200 rounded-lg p-3 bg-warning-50/50", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-start gap-2 mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            checkbox_default,
            {
              isSelected: includeChildPaths,
              onValueChange: setIncludeChildPaths,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("pathMarks.checkbox.alsoDeleteChildMarks", {
                count: childMarksCount,
                pathCount: childPaths.length
              }) })
            }
          ) }),
          includeChildPaths && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-2 max-h-48 overflow-y-auto ml-6", children: childPaths.map((child) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-2 text-sm bg-white/50 p-2 rounded", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-mono text-xs truncate text-danger", title: child.path, children: child.path }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1 flex-shrink-0", children: child.marks.map((mark2) => /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkChip, { mark: mark2 }, mark2.id)) })
          ] }, child.path)) })
        ] })
      ] })
    }
  );
};
DeleteMarksConfirmationModal.displayName = "DeleteMarksConfirmationModal";
const PathMarksPage = () => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { createPortal } = useBakabaseContext();
  const { showGuide, completeGuide } = usePathMarkGuide();
  const [showOnlyInvalid, setShowOnlyInvalid] = reactExports.useState(false);
  const { loading, checkingPaths, loadAllMarks, getGroupedMarksFiltered, getGroupedMarks, getInvalidPathsCount } = usePathMarks();
  const pendingSyncButtonRef = reactExports.useRef(null);
  const allGroups = reactExports.useMemo(() => getGroupedMarks(), [getGroupedMarks]);
  const groups = reactExports.useMemo(() => getGroupedMarksFiltered(showOnlyInvalid), [getGroupedMarksFiltered, showOnlyInvalid]);
  const invalidPathsCount = reactExports.useMemo(() => getInvalidPathsCount(), [getInvalidPathsCount]);
  const refreshPendingSyncCount = reactExports.useCallback(() => {
    var _a2;
    (_a2 = pendingSyncButtonRef.current) == null ? void 0 : _a2.refresh();
  }, []);
  const handleSaveMark = reactExports.useCallback(
    async (path, newMark, oldMark) => {
      try {
        const oldMarkId = oldMark == null ? void 0 : oldMark.id;
        if (oldMarkId) {
          await BApi$1.pathMark.updatePathMark(oldMarkId, {
            ...newMark,
            path
          });
        } else {
          await BApi$1.pathMark.addPathMark({
            ...newMark,
            path
          });
        }
        toast.success(t2(oldMark ? "pathMarks.success.markUpdated" : "pathMarks.success.markAdded"));
        loadAllMarks();
        refreshPendingSyncCount();
      } catch (error2) {
        console.error("Failed to save mark", error2);
        toast.danger(t2("pathMarks.error.saveMark"));
      }
    },
    [t2, loadAllMarks, refreshPendingSyncCount]
  );
  const handleDeleteMark = reactExports.useCallback(
    async (path, mark2) => {
      const markId = mark2 == null ? void 0 : mark2.id;
      if (!markId) {
        console.error("Mark has no id, cannot delete");
        return;
      }
      const confirmed = await new Promise((resolve2) => {
        const modal2 = createPortal(Modal, {
          defaultVisible: true,
          title: t2("pathMarks.confirm.deleteTitle"),
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: t2("pathMarks.confirm.deleteQuestion") }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-default-500 mt-2", children: [
              t2("common.label.path"),
              ": ",
              path
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-sm text-default-500", children: [
              t2("common.label.priority"),
              ": ",
              mark2.priority
            ] })
          ] }),
          footer: {
            actions: ["cancel", "ok"],
            okProps: {
              color: "danger",
              children: t2("common.action.delete")
            }
          },
          onOk: () => {
            resolve2(true);
            modal2.destroy();
          },
          onDestroyed: () => {
            resolve2(false);
          }
        });
      });
      if (confirmed) {
        try {
          await BApi$1.pathMark.softDeletePathMark(markId);
          toast.success(t2("pathMarks.success.markDeleted"));
          loadAllMarks();
          refreshPendingSyncCount();
        } catch (error2) {
          console.error("Failed to delete mark", error2);
          toast.danger(t2("pathMarks.error.deleteMark"));
        }
      }
    },
    [createPortal, t2, loadAllMarks, refreshPendingSyncCount]
  );
  const handleConfigureSubPathMarks = reactExports.useCallback(
    (path) => {
      createPortal(PathConfigModal, {
        path,
        onMarksChanged: () => {
          loadAllMarks();
          refreshPendingSyncCount();
        }
      });
    },
    [createPortal, loadAllMarks, refreshPendingSyncCount]
  );
  const handleDeletePathMarks = reactExports.useCallback(
    (path) => {
      const group = allGroups.find((g2) => g2.path === path);
      const marks = (group == null ? void 0 : group.marks) || [];
      if (marks.length === 0) {
        toast.warning(t2("pathMarks.warning.noMarksToDelete"));
        return;
      }
      const normalizedPath = path.replace(/\\/g, "/").toLowerCase();
      const childPaths = allGroups.filter((g2) => {
        if (g2.path === path)
          return false;
        const normalizedChildPath = g2.path.replace(/\\/g, "/").toLowerCase();
        return normalizedChildPath.startsWith(normalizedPath + "/");
      }).map((g2) => ({
        path: g2.path,
        marks: g2.marks
      }));
      createPortal(DeleteMarksConfirmationModal, {
        path,
        marks,
        childPaths,
        onConfirm: async (includeChildPaths) => {
          try {
            for (const mark2 of marks) {
              if (mark2.id) {
                await BApi$1.pathMark.softDeletePathMark(mark2.id);
              }
            }
            if (includeChildPaths && childPaths.length > 0) {
              for (const child of childPaths) {
                for (const mark2 of child.marks) {
                  if (mark2.id) {
                    await BApi$1.pathMark.softDeletePathMark(mark2.id);
                  }
                }
              }
            }
            const totalCount = marks.length + (includeChildPaths ? childPaths.reduce((sum, c2) => sum + c2.marks.length, 0) : 0);
            toast.success(t2("pathMarks.success.deletedCount", { count: totalCount }));
            loadAllMarks();
            refreshPendingSyncCount();
          } catch (error2) {
            console.error("Failed to delete marks", error2);
            toast.danger(t2("pathMarks.error.deleteMarks"));
          }
        }
      });
    },
    [createPortal, allGroups, t2, loadAllMarks, refreshPendingSyncCount]
  );
  const handlePasteMarks = reactExports.useCallback(
    async (path, marks) => {
      try {
        for (const mark2 of marks) {
          await BApi$1.pathMark.addPathMark({
            path,
            type: mark2.type,
            configJson: mark2.configJson,
            priority: mark2.priority,
            expiresInSeconds: mark2.expiresInSeconds
          });
        }
        toast.success(t2("pathMarks.success.pastedCount", { count: marks.length }));
        loadAllMarks();
        refreshPendingSyncCount();
      } catch (error2) {
        console.error("Failed to paste marks", error2);
        toast.danger(t2("pathMarks.error.pasteMarks"));
      }
    },
    [t2, loadAllMarks, refreshPendingSyncCount]
  );
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "path-marks-page h-full flex flex-col", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 p-2 flex-1 min-h-0", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold", children: t2("pathMarks.title") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {})
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              size: "sm",
              startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineControl, {}),
              variant: "flat",
              onPress: () => navigate("/path-mark-config"),
              children: t2("pathMarks.action.configureMarks")
            }
          ),
          /* @__PURE__ */ jsxRuntimeExports.jsx(PendingSyncButton, { ref: pendingSyncButtonRef, onSyncComplete: loadAllMarks }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkSettingsButton, {})
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500", children: t2("pathMarks.tip.description") }),
      !checkingPaths && invalidPathsCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3 p-3 bg-warning-50 border border-warning-200 rounded-lg", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineWarning, { className: "text-warning text-xl flex-shrink-0" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-warning-700", children: t2("pathMarks.warning.invalidPaths", { count: invalidPathsCount }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-600", children: t2("pathMarks.label.showOnlyInvalid") }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(
            switch_default,
            {
              isSelected: showOnlyInvalid,
              size: "sm",
              onValueChange: setShowOnlyInvalid
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-hidden flex-1 min-h-0 flex", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 overflow-auto border border-default-200 rounded-lg p-2", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
          PathTree,
          {
            groups,
            onConfigureSubPathMarks: handleConfigureSubPathMarks,
            onDeleteMark: handleDeleteMark,
            onDeletePathMarks: handleDeletePathMarks,
            onPasteMarks: handlePasteMarks,
            onSaveMark: handleSaveMark
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(CopyMarksSidebar, {})
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 p-3 bg-default-50 rounded-lg", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-default-500", children: t2("pathMarks.label.resourceProfileHint") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            color: "secondary",
            size: "sm",
            variant: "flat",
            onPress: () => navigate("/resource-profile"),
            children: t2("pathMarks.action.goToResourceProfile")
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(PathMarkGuideModal, { visible: showGuide, onComplete: completeGuide })
  ] });
};
PathMarksPage.displayName = "PathMarksPage";
function ProfilerPage() {
  const profilerUrl = `${envConfig.apiEndpoint}/profiler/results-index`;
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    "iframe",
    {
      src: profilerUrl,
      className: "w-full h-full border-0",
      title: "Performance Profiler"
    }
  ) });
}
const PAIR_LIMIT = 1e3;
const CANVAS_WIDTH = 1200;
const CANVAS_HEIGHT = 600;
const MIN_SCALE = 0.1;
const MAX_SCALE = 20;
const ZOOM_SENSITIVITY = 1e-3;
function computeForceLayout(nodes, edges, iterations = 300) {
  if (nodes.length === 0)
    return nodes;
  const width = CANVAS_WIDTH;
  const height = CANVAS_HEIGHT;
  const centerX = width / 2;
  const centerY = height / 2;
  const nodeMap = new Map(nodes.map((n2) => [n2.id, n2]));
  for (let i2 = 0; i2 < iterations; i2++) {
    const alpha2 = 0.1 * (1 - i2 / iterations);
    const repulsionStrength = 800;
    const attractionStrength = 0.02;
    const centerStrength = 0.01;
    nodes.forEach((node2) => {
      node2.vx = 0;
      node2.vy = 0;
    });
    for (let j2 = 0; j2 < nodes.length; j2++) {
      for (let k2 = j2 + 1; k2 < nodes.length; k2++) {
        const nodeA = nodes[j2];
        const nodeB = nodes[k2];
        const dx = nodeB.x - nodeA.x;
        const dy = nodeB.y - nodeA.y;
        const distance2 = Math.sqrt(dx * dx + dy * dy) || 1;
        const force = repulsionStrength / (distance2 * distance2);
        const fx = dx / distance2 * force;
        const fy = dy / distance2 * force;
        nodeA.vx -= fx;
        nodeA.vy -= fy;
        nodeB.vx += fx;
        nodeB.vy += fy;
      }
    }
    edges.forEach((edge) => {
      const sourceNode = nodeMap.get(edge.source);
      const targetNode = nodeMap.get(edge.target);
      if (sourceNode && targetNode) {
        const dx = targetNode.x - sourceNode.x;
        const dy = targetNode.y - sourceNode.y;
        const distance2 = Math.sqrt(dx * dx + dy * dy) || 1;
        const force = distance2 * attractionStrength * (edge.score / 100);
        const fx = dx / distance2 * force;
        const fy = dy / distance2 * force;
        sourceNode.vx += fx;
        sourceNode.vy += fy;
        targetNode.vx -= fx;
        targetNode.vy -= fy;
      }
    });
    nodes.forEach((node2) => {
      node2.vx += (centerX - node2.x) * centerStrength;
      node2.vy += (centerY - node2.y) * centerStrength;
    });
    nodes.forEach((node2) => {
      node2.x += node2.vx * alpha2;
      node2.y += node2.vy * alpha2;
      node2.x = Math.max(60, Math.min(width - 60, node2.x));
      node2.y = Math.max(60, Math.min(height - 60, node2.y));
    });
  }
  return nodes;
}
const ComparisonNetworkGraph = ({
  planId,
  groupId,
  threshold,
  isOpen,
  onClose
}) => {
  const { t: t2 } = useTranslation();
  const { isDarkMode } = useBakabaseContext();
  const canvasRef = reactExports.useRef(null);
  const containerRef = reactExports.useRef(null);
  const [loading, setLoading] = reactExports.useState(true);
  const [nodes, setNodes] = reactExports.useState([]);
  const [edges, setEdges] = reactExports.useState([]);
  const [rules2, setRules] = reactExports.useState([]);
  const [isTruncated, setIsTruncated] = reactExports.useState(false);
  const [totalCount, setTotalCount] = reactExports.useState(0);
  const [hoveredEdge, setHoveredEdge] = reactExports.useState(null);
  const [pinnedEdge, setPinnedEdge] = reactExports.useState(null);
  const [tooltipPosition, setTooltipPosition] = reactExports.useState({ x: 0, y: 0 });
  const [transform2, setTransform] = reactExports.useState({
    scale: 1,
    offsetX: 0,
    offsetY: 0
  });
  const [isDragging2, setIsDragging] = reactExports.useState(false);
  const [dragStart, setDragStart] = reactExports.useState({ x: 0, y: 0 });
  const activeEdge = pinnedEdge || hoveredEdge;
  const colors2 = {
    background: isDarkMode ? "#1a1a2e" : "#ffffff",
    nodeColor: isDarkMode ? "#60a5fa" : "#3b82f6",
    nodeStroke: isDarkMode ? "#93c5fd" : "#1d4ed8",
    edgeColor: isDarkMode ? "rgba(156, 163, 175, " : "rgba(100, 100, 100, ",
    edgeActiveColor: isDarkMode ? "rgba(96, 165, 250, " : "rgba(59, 130, 246, ",
    textColor: isDarkMode ? "#e5e7eb" : "#333333"
  };
  const getResourceDisplayName = reactExports.useCallback(
    (resourceId) => {
      const node2 = nodes.find((n2) => n2.id === resourceId);
      return (node2 == null ? void 0 : node2.displayName) || `Resource ${resourceId}`;
    },
    [nodes]
  );
  const resetTransform = reactExports.useCallback(() => {
    setTransform({ scale: 1, offsetX: 0, offsetY: 0 });
  }, []);
  const loadData = reactExports.useCallback(async () => {
    var _a2;
    setLoading(true);
    setPinnedEdge(null);
    setHoveredEdge(null);
    resetTransform();
    try {
      const planResponse = await BApi$1.comparison.getComparisonPlan(planId);
      const planRules = ((_a2 = planResponse.data) == null ? void 0 : _a2.rules) || [];
      setRules(planRules);
      const pairsResponse = await BApi$1.comparison.getComparisonResultGroupPairs(
        planId,
        groupId,
        { limit: PAIR_LIMIT }
      );
      const data = pairsResponse;
      const pairs = data.pairs || [];
      setIsTruncated(data.isTruncated);
      setTotalCount(data.totalCount);
      const resourceIds = await BApi$1.comparison.getComparisonResultGroupResourceIds(
        planId,
        groupId
      );
      const ids2 = resourceIds.data || [];
      const resourcesResponse = await BApi$1.resource.getResourcesByKeys({
        ids: ids2,
        additionalItems: 0
      });
      const resources = resourcesResponse.data || [];
      const edgeList = pairs.filter((pair) => pair.totalScore >= threshold).map((pair) => ({
        source: pair.resource1Id,
        target: pair.resource2Id,
        score: pair.totalScore,
        pair
      }));
      const resourceMap = new Map(resources.map((r2) => [r2.id, r2]));
      const centerX = CANVAS_WIDTH / 2;
      const centerY = CANVAS_HEIGHT / 2;
      const radius = Math.min(CANVAS_WIDTH, CANVAS_HEIGHT) / 2 - 100;
      const nodeList = ids2.map((id2, index2) => {
        const resource = resourceMap.get(id2);
        const angle = 2 * Math.PI * index2 / ids2.length - Math.PI / 2;
        return {
          id: id2,
          displayName: (resource == null ? void 0 : resource.displayName) || `Resource ${id2}`,
          x: centerX + radius * Math.cos(angle),
          y: centerY + radius * Math.sin(angle),
          vx: 0,
          vy: 0
        };
      });
      const layoutedNodes = computeForceLayout(nodeList, edgeList, 300);
      setNodes(layoutedNodes);
      setEdges(edgeList);
    } finally {
      setLoading(false);
    }
  }, [planId, groupId, threshold, resetTransform]);
  reactExports.useEffect(() => {
    if (isOpen) {
      loadData();
    }
  }, [isOpen, loadData]);
  reactExports.useEffect(() => {
    const canvas = canvasRef.current;
    if (!canvas || loading)
      return;
    const ctx = canvas.getContext("2d");
    if (!ctx)
      return;
    const nodeMap = new Map(nodes.map((n2) => [n2.id, n2]));
    ctx.fillStyle = colors2.background;
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    ctx.save();
    ctx.translate(transform2.offsetX, transform2.offsetY);
    ctx.scale(transform2.scale, transform2.scale);
    edges.forEach((edge) => {
      const sourceNode = nodeMap.get(edge.source);
      const targetNode = nodeMap.get(edge.target);
      if (!sourceNode || !targetNode)
        return;
      const isActive2 = activeEdge === edge;
      const opacity = Math.max(0.3, edge.score / 100);
      ctx.beginPath();
      ctx.moveTo(sourceNode.x, sourceNode.y);
      ctx.lineTo(targetNode.x, targetNode.y);
      ctx.strokeStyle = isActive2 ? `${colors2.edgeActiveColor}${opacity})` : `${colors2.edgeColor}${opacity})`;
      ctx.lineWidth = (isActive2 ? 3 : Math.max(1, edge.score / 100 * 3)) / transform2.scale;
      ctx.stroke();
    });
    nodes.forEach((node2) => {
      const nodeRadius = 8 / transform2.scale;
      ctx.beginPath();
      ctx.arc(node2.x, node2.y, nodeRadius, 0, 2 * Math.PI);
      ctx.fillStyle = colors2.nodeColor;
      ctx.fill();
      ctx.strokeStyle = colors2.nodeStroke;
      ctx.lineWidth = 2 / transform2.scale;
      ctx.stroke();
      ctx.font = `${11 / transform2.scale}px sans-serif`;
      ctx.fillStyle = colors2.textColor;
      ctx.textAlign = "center";
      const displayName = node2.displayName.length > 20 ? node2.displayName.substring(0, 20) + "..." : node2.displayName;
      ctx.fillText(displayName, node2.x, node2.y + 22 / transform2.scale);
    });
    ctx.restore();
  }, [nodes, edges, activeEdge, loading, transform2, colors2, isDarkMode]);
  const screenToWorld = reactExports.useCallback(
    (screenX, screenY) => {
      const canvas = canvasRef.current;
      if (!canvas)
        return { x: 0, y: 0 };
      const rect = canvas.getBoundingClientRect();
      const canvasX = (screenX - rect.left) * (canvas.width / rect.width);
      const canvasY = (screenY - rect.top) * (canvas.height / rect.height);
      const worldX = (canvasX - transform2.offsetX) / transform2.scale;
      const worldY = (canvasY - transform2.offsetY) / transform2.scale;
      return { x: worldX, y: worldY };
    },
    [transform2]
  );
  const findEdgeAtPosition = reactExports.useCallback(
    (x2, y2) => {
      const nodeMap = new Map(nodes.map((n2) => [n2.id, n2]));
      let closestEdge = null;
      let minDistance = 15 / transform2.scale;
      edges.forEach((edge) => {
        const sourceNode = nodeMap.get(edge.source);
        const targetNode = nodeMap.get(edge.target);
        if (!sourceNode || !targetNode)
          return;
        const dx = targetNode.x - sourceNode.x;
        const dy = targetNode.y - sourceNode.y;
        const lengthSq = dx * dx + dy * dy;
        if (lengthSq === 0)
          return;
        const t22 = Math.max(
          0,
          Math.min(
            1,
            ((x2 - sourceNode.x) * dx + (y2 - sourceNode.y) * dy) / lengthSq
          )
        );
        const nearestX = sourceNode.x + t22 * dx;
        const nearestY = sourceNode.y + t22 * dy;
        const distance2 = Math.sqrt((x2 - nearestX) ** 2 + (y2 - nearestY) ** 2);
        if (distance2 < minDistance) {
          minDistance = distance2;
          closestEdge = edge;
        }
      });
      return closestEdge;
    },
    [nodes, edges, transform2.scale]
  );
  const handleWheel = reactExports.useCallback(
    (e2) => {
      e2.preventDefault();
      const canvas = canvasRef.current;
      if (!canvas)
        return;
      const rect = canvas.getBoundingClientRect();
      const mouseX = (e2.clientX - rect.left) * (canvas.width / rect.width);
      const mouseY = (e2.clientY - rect.top) * (canvas.height / rect.height);
      const delta = -e2.deltaY * ZOOM_SENSITIVITY;
      const newScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, transform2.scale * (1 + delta)));
      const scaleRatio = newScale / transform2.scale;
      const newOffsetX = mouseX - (mouseX - transform2.offsetX) * scaleRatio;
      const newOffsetY = mouseY - (mouseY - transform2.offsetY) * scaleRatio;
      setTransform({
        scale: newScale,
        offsetX: newOffsetX,
        offsetY: newOffsetY
      });
    },
    [transform2]
  );
  const handleMouseDown = reactExports.useCallback(
    (e2) => {
      if (e2.button === 1 || e2.button === 0 && (e2.ctrlKey || e2.metaKey)) {
        e2.preventDefault();
        setIsDragging(true);
        setDragStart({ x: e2.clientX, y: e2.clientY });
      }
    },
    []
  );
  const handleMouseMove = reactExports.useCallback(
    (e2) => {
      if (isDragging2) {
        const canvas = canvasRef.current;
        if (!canvas)
          return;
        const rect = canvas.getBoundingClientRect();
        const scaleX = canvas.width / rect.width;
        const scaleY = canvas.height / rect.height;
        const dx = (e2.clientX - dragStart.x) * scaleX;
        const dy = (e2.clientY - dragStart.y) * scaleY;
        setTransform((prev2) => ({
          ...prev2,
          offsetX: prev2.offsetX + dx,
          offsetY: prev2.offsetY + dy
        }));
        setDragStart({ x: e2.clientX, y: e2.clientY });
        return;
      }
      if (pinnedEdge)
        return;
      const { x: x2, y: y2 } = screenToWorld(e2.clientX, e2.clientY);
      const edge = findEdgeAtPosition(x2, y2);
      setHoveredEdge(edge);
      if (edge) {
        setTooltipPosition({ x: e2.clientX, y: e2.clientY });
      }
    },
    [isDragging2, dragStart, pinnedEdge, screenToWorld, findEdgeAtPosition]
  );
  const handleMouseUp = reactExports.useCallback(() => {
    setIsDragging(false);
  }, []);
  const handleClick = reactExports.useCallback(
    (e2) => {
      if (isDragging2)
        return;
      if (e2.ctrlKey || e2.metaKey)
        return;
      const { x: x2, y: y2 } = screenToWorld(e2.clientX, e2.clientY);
      const edge = findEdgeAtPosition(x2, y2);
      if (edge) {
        setPinnedEdge(edge);
        setTooltipPosition({ x: e2.clientX, y: e2.clientY });
      } else {
        setPinnedEdge(null);
      }
    },
    [isDragging2, screenToWorld, findEdgeAtPosition]
  );
  const handleMouseLeave = reactExports.useCallback(() => {
    setIsDragging(false);
    if (!pinnedEdge) {
      setHoveredEdge(null);
    }
  }, [pinnedEdge]);
  const handleCloseTooltip = reactExports.useCallback(() => {
    setPinnedEdge(null);
  }, []);
  const renderTitle = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("comparison.networkGraph.title") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        isTruncated && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "flat", children: t2("comparison.networkGraph.truncatedWarning", {
          shown: PAIR_LIMIT,
          total: totalCount
        }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: t2("comparison.networkGraph.nodeCount", { count: nodes.length }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: t2("comparison.networkGraph.edgeCount", { count: edges.length }) })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-500 font-normal", children: t2("comparison.networkGraph.hint") })
  ] });
  const getRuleInfo = reactExports.useCallback(
    (ruleId) => {
      return rules2.find((r2) => r2.id === ruleId);
    },
    [rules2]
  );
  const renderTooltipContent = (edge) => {
    const ruleScores = edge.pair.ruleScores || [];
    const validRules = ruleScores.filter((rs) => !rs.isSkipped && !rs.isVetoed);
    const totalWeight = validRules.reduce((sum, rs) => sum + rs.weight, 0);
    const weightedSum = validRules.reduce((sum, rs) => sum + rs.score * rs.weight, 0);
    const formulaParts = validRules.map(
      (rs) => `${(rs.score * 100).toFixed(0)}%×${rs.weight}`
    );
    return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-medium mb-2 text-foreground break-words", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: getResourceDisplayName(edge.source) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400 mx-2 whitespace-nowrap", children: "vs" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: getResourceDisplayName(edge.target) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-lg font-bold text-primary mb-3", children: t2("comparison.networkGraph.pairScore", {
        score: edge.score.toFixed(1)
      }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-2" }),
      ruleScores.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs space-y-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-medium text-foreground", children: [
          t2("comparison.networkGraph.ruleDetails"),
          ":"
        ] }),
        ruleScores.map((rs, idx) => {
          const ruleInfo = getRuleInfo(rs.ruleId);
          return /* @__PURE__ */ jsxRuntimeExports.jsxs(
            "div",
            {
              className: `p-2 rounded ${rs.isSkipped ? "bg-default-100 text-default-400" : rs.isVetoed ? "bg-danger-50 text-danger" : "bg-default-50"}`,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2 mb-1 flex-wrap", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium", children: [
                      t2("comparison.label.rule"),
                      " ",
                      rs.order + 1
                    ] }),
                    (ruleInfo == null ? void 0 : ruleInfo.propertyName) && /* @__PURE__ */ jsxRuntimeExports.jsx(
                      BriefProperty,
                      {
                        property: {
                          name: ruleInfo.propertyName,
                          pool: ruleInfo.propertyPool
                        },
                        fields: ["pool", "name"],
                        showPoolChip: false,
                        chipProps: { size: "sm" }
                      }
                    )
                  ] }),
                  rs.isSkipped ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", color: "default", children: t2("comparison.networkGraph.skipped") }) : rs.isVetoed ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", color: "danger", children: t2("comparison.networkGraph.vetoed") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-primary font-medium", children: [
                    (rs.score * 100).toFixed(0),
                    "% × ",
                    rs.weight
                  ] })
                ] }),
                !rs.isSkipped && !rs.isVetoed && rs.value1 !== void 0 && rs.value2 !== void 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-default-500 mt-1", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: rs.value1 || "(empty)" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mx-2 text-default-300", children: "vs" }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "break-all", children: rs.value2 || "(empty)" })
                ] })
              ]
            },
            idx
          );
        })
      ] }),
      validRules.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { className: "my-2" }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-xs text-default-500 space-y-1", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-medium text-foreground", children: [
            t2("comparison.scoring.title"),
            ":"
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "font-mono bg-default-100 p-2 rounded overflow-x-auto", children: [
            "(",
            formulaParts.join(" + "),
            ") / ",
            totalWeight,
            " = ",
            (weightedSum / totalWeight * 100).toFixed(1),
            "%"
          ] })
        ] })
      ] })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      visible: isOpen,
      onClose,
      size: "7xl",
      title: renderTitle(),
      footer: false,
      className: "max-h-[100vh]",
      children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : nodes.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px] text-default-400", children: t2("comparison.networkGraph.noData") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: containerRef, className: "relative", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-2 right-2 z-10 flex items-center gap-2 bg-background/80 backdrop-blur-sm rounded-lg p-1 border border-default-200", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-default-500 px-2", children: [
            Math.round(transform2.scale * 100),
            "%"
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("Reset view"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              size: "sm",
              variant: "light",
              onPress: resetTransform,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$f, {})
            }
          ) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 left-2 z-10 text-xs text-default-400 bg-background/80 backdrop-blur-sm rounded px-2 py-1 border border-default-200", children: "Scroll to zoom | Ctrl+Drag to pan" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          "canvas",
          {
            ref: canvasRef,
            width: CANVAS_WIDTH,
            height: CANVAS_HEIGHT,
            className: `border border-default-200 rounded-lg w-full ${isDragging2 ? "cursor-grabbing" : "cursor-crosshair"}`,
            onWheel: handleWheel,
            onMouseDown: handleMouseDown,
            onMouseMove: handleMouseMove,
            onMouseUp: handleMouseUp,
            onMouseLeave: handleMouseLeave,
            onClick: handleClick
          }
        ),
        activeEdge && /* @__PURE__ */ jsxRuntimeExports.jsxs(
          "div",
          {
            className: `fixed z-50 bg-background border border-default-200 rounded-lg shadow-lg p-3 max-w-md max-h-96 overflow-y-auto ${pinnedEdge ? "ring-2 ring-primary" : ""}`,
            style: {
              left: Math.min(tooltipPosition.x + 10, window.innerWidth - 420),
              top: Math.min(tooltipPosition.y + 10, window.innerHeight - 400)
            },
            children: [
              pinnedEdge && /* @__PURE__ */ jsxRuntimeExports.jsx(
                "button",
                {
                  className: "absolute top-1 right-1 p-1 text-default-400 hover:text-default-600 rounded",
                  onClick: handleCloseTooltip,
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1o, { className: "text-xs" })
                }
              ),
              renderTooltipContent(activeEdge)
            ]
          }
        )
      ] })
    }
  );
};
const RESOURCES_PAGE_SIZE = 50;
const ComparisonResultGroup = ({ planId, group, threshold, onHiddenChange }) => {
  const { t: t2 } = useTranslation();
  const [resources, setResources] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const [page, setPage] = reactExports.useState(1);
  const [allResourceIds, setAllResourceIds] = reactExports.useState([]);
  const [primaryResourceId, setPrimaryResourceId] = reactExports.useState(null);
  const [showNetworkGraph, setShowNetworkGraph] = reactExports.useState(false);
  const loadResourceIds = reactExports.useCallback(async () => {
    var _a2;
    const r2 = await BApi$1.comparison.getComparisonResultGroupResourceIds(planId, group.id);
    const ids2 = r2.data || [];
    setAllResourceIds(ids2);
    const groupDetail = await BApi$1.comparison.getComparisonResultGroup(planId, group.id);
    const members = ((_a2 = groupDetail.data) == null ? void 0 : _a2.members) || [];
    const primary = members.find((m2) => m2.isSuggestedPrimary);
    if (primary) {
      setPrimaryResourceId(primary.resourceId);
    }
  }, [planId, group.id]);
  const loadResources = reactExports.useCallback(async () => {
    if (allResourceIds.length === 0)
      return;
    setLoading(true);
    try {
      const sortedIds = [...allResourceIds].sort((a2, b2) => {
        if (a2 === primaryResourceId)
          return -1;
        if (b2 === primaryResourceId)
          return 1;
        return 0;
      });
      const startIdx = (page - 1) * RESOURCES_PAGE_SIZE;
      const endIdx = Math.min(startIdx + RESOURCES_PAGE_SIZE, sortedIds.length);
      const pageIds = sortedIds.slice(startIdx, endIdx);
      if (pageIds.length === 0) {
        setResources([]);
        return;
      }
      const r2 = await BApi$1.resource.getResourcesByKeys({
        ids: pageIds,
        additionalItems: ResourceAdditionalItem.All
      });
      const resourceMap = new Map((r2.data || []).map((res) => [res.id, res]));
      const sortedResources = pageIds.map((id2) => resourceMap.get(id2)).filter((res) => res !== void 0);
      setResources(sortedResources);
    } finally {
      setLoading(false);
    }
  }, [allResourceIds, page, primaryResourceId]);
  reactExports.useEffect(() => {
    loadResourceIds();
  }, [loadResourceIds]);
  reactExports.useEffect(() => {
    if (allResourceIds.length > 0) {
      loadResources();
    }
  }, [allResourceIds, loadResources]);
  const totalPages = Math.ceil(allResourceIds.length / RESOURCES_PAGE_SIZE);
  const handleHide = async () => {
    await BApi$1.comparison.hideComparisonResultGroup(planId, group.id);
    onHiddenChange == null ? void 0 : onHiddenChange(true);
  };
  const handleUnhide = async () => {
    await BApi$1.comparison.unhideComparisonResultGroup(planId, group.id);
    onHiddenChange == null ? void 0 : onHiddenChange(false);
  };
  const isHidden = group.isHidden ?? false;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "bg-default-50", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "flex items-center justify-between pb-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-medium", children: [
          t2("comparison.label.group"),
          " #",
          group.id
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { color: "primary", size: "sm", variant: "flat", children: [
          group.memberCount,
          " ",
          t2("comparison.label.resources")
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.viewNetworkGraph"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => setShowNetworkGraph(true),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$o, { className: "text-lg" })
          }
        ) }),
        isHidden ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.unhideGroup"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: handleUnhide,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1a, { className: "text-lg" })
          }
        ) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.hideGroup"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: handleHide,
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$18, { className: "text-lg" })
          }
        ) })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "pt-0", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-32", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "sm" }) }) : resources.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-400 py-4", children: t2("comparison.empty.noResources") }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-10 gap-2", children: resources.map((resource) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: "relative",
          children: [
            resource.id === primaryResourceId && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.label.primaryResource"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 left-2 z-10 bg-warning-500 rounded-full w-5 h-5 flex items-center justify-center shadow-md", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$a, { className: "text-white text-[10px]" }) }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              ResourceMemo,
              {
                resource,
                disableCoverClick: false
              }
            )
          ]
        },
        resource.id
      )) }),
      totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          size: "sm",
          page,
          total: totalPages,
          onChange: setPage
        }
      ) })
    ] }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      ComparisonNetworkGraph,
      {
        planId,
        groupId: group.id,
        threshold,
        isOpen: showNetworkGraph,
        onClose: () => setShowNetworkGraph(false)
      }
    )
  ] });
};
const GROUPS_PAGE_SIZE = 10;
const ComparisonResults = ({ plan }) => {
  const { t: t2 } = useTranslation();
  const [groups, setGroups] = reactExports.useState([]);
  const [loading, setLoading] = reactExports.useState(true);
  const [page, setPage] = reactExports.useState(1);
  const [pageCount, setPageCount] = reactExports.useState(0);
  const [hiddenCount, setHiddenCount] = reactExports.useState(0);
  const [minMemberCount, setMinMemberCount] = reactExports.useState(2);
  const [includeHidden, setIncludeHidden] = reactExports.useState(false);
  const loadResults = reactExports.useCallback(async () => {
    setLoading(true);
    try {
      const r2 = await BApi$1.comparison.searchComparisonResults(plan.id, {
        pageIndex: page - 1,
        pageSize: GROUPS_PAGE_SIZE,
        minMemberCount,
        includeHidden
      });
      setGroups(r2.data || []);
      setPageCount(r2.totalCount || 0);
      setHiddenCount(r2.hiddenCount || 0);
    } finally {
      setLoading(false);
    }
  }, [plan.id, page, minMemberCount, includeHidden]);
  reactExports.useEffect(() => {
    loadResults();
  }, [loadResults]);
  const handleGroupHiddenChange = reactExports.useCallback((groupId, hidden) => {
    if (hidden) {
      if (!includeHidden) {
        setGroups((prev2) => prev2.filter((g2) => g2.id !== groupId));
        setPageCount((prev2) => Math.max(0, prev2 - 1));
      } else {
        setGroups((prev2) => prev2.map(
          (g2) => g2.id === groupId ? { ...g2, isHidden: true } : g2
        ));
      }
      setHiddenCount((prev2) => prev2 + 1);
    } else {
      setGroups((prev2) => prev2.map(
        (g2) => g2.id === groupId ? { ...g2, isHidden: false } : g2
      ));
      setHiddenCount((prev2) => Math.max(0, prev2 - 1));
    }
  }, [includeHidden]);
  const totalGroups = includeHidden ? pageCount : pageCount + hiddenCount;
  const totalPages = Math.ceil(pageCount / GROUPS_PAGE_SIZE);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 flex-wrap", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500", children: [
          t2("comparison.label.minMemberCount"),
          ":"
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          number_input_default,
          {
            className: "w-20",
            min: 1,
            size: "sm",
            value: minMemberCount,
            onValueChange: (v2) => {
              setMinMemberCount(v2 ?? 2);
              setPage(1);
            }
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        checkbox_default,
        {
          size: "sm",
          isSelected: includeHidden,
          onValueChange: (v2) => {
            setIncludeHidden(v2);
            setPage(1);
          },
          children: t2("comparison.label.includeHidden")
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "flat", children: [
        t2("comparison.label.totalGroups"),
        ": ",
        totalGroups
      ] }),
      hiddenCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "flat", color: "warning", children: [
        t2("comparison.label.hiddenGroups"),
        ": ",
        hiddenCount
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { size: "sm", variant: "flat", className: "text-default-400", children: [
        t2("comparison.label.threshold"),
        ": ",
        plan.threshold,
        "%"
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 text-sm text-default-500 bg-default-100 rounded-lg px-3 py-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$y, { className: "text-primary" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("comparison.hint.rerunAfterEdit") })
    ] }),
    loading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[300px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }) : groups.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col items-center justify-center min-h-[300px] text-default-400", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("comparison.empty.noResults") }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
      groups.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsx(
        ComparisonResultGroup,
        {
          planId: plan.id,
          group,
          threshold: plan.threshold,
          onHiddenChange: (hidden) => handleGroupHiddenChange(group.id, hidden)
        },
        group.id
      )),
      totalPages > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-center mt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        pagination_default,
        {
          page,
          total: totalPages,
          onChange: setPage
        }
      ) })
    ] })
  ] });
};
const ScoringExplanation = ({ mode = "tooltip", className }) => {
  const { t: t2 } = useTranslation();
  const content2 = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 text-xs max-w-md", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium text-sm", children: t2("comparison.scoring.title") }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-mono text-primary", children: t2("comparison.scoring.formula") }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "list-disc list-inside space-y-1 text-default-500", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("comparison.scoring.ruleScore") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("comparison.scoring.weightedSum") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("comparison.scoring.threshold") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-default-400 italic mt-1", children: t2("comparison.scoring.example") })
  ] });
  if (mode === "inline") {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className, children: content2 });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: content2, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-default-400 cursor-help ${className || ""}`, children: "ⓘ" }) });
};
ScoringExplanation.displayName = "ScoringExplanation";
const AllComparisonModes = [
  { value: ComparisonMode.StrictEqual, label: "comparison.mode.strictEqual", description: "comparison.mode.strictEqual.description" },
  { value: ComparisonMode.TextSimilarity, label: "comparison.mode.textSimilarity", description: "comparison.mode.textSimilarity.description" },
  { value: ComparisonMode.RegexExtractNumber, label: "comparison.mode.regexExtractNumber", description: "comparison.mode.regexExtractNumber.description" },
  { value: ComparisonMode.FixedTolerance, label: "comparison.mode.fixedTolerance", description: "comparison.mode.fixedTolerance.description" },
  { value: ComparisonMode.RelativeTolerance, label: "comparison.mode.relativeTolerance", description: "comparison.mode.relativeTolerance.description" },
  { value: ComparisonMode.SetIntersection, label: "comparison.mode.setIntersection", description: "comparison.mode.setIntersection.description" },
  { value: ComparisonMode.Subset, label: "comparison.mode.subset", description: "comparison.mode.subset.description" },
  { value: ComparisonMode.TimeWindow, label: "comparison.mode.timeWindow", description: "comparison.mode.timeWindow.description" },
  { value: ComparisonMode.SameDay, label: "comparison.mode.sameDay", description: "comparison.mode.sameDay.description" },
  { value: ComparisonMode.ExtensionMap, label: "comparison.mode.extensionMap", description: "comparison.mode.extensionMap.description" }
];
const getAvailableModesForPropertyType = (propertyType) => {
  switch (propertyType) {
    case PropertyType.SingleLineText:
    case PropertyType.MultilineText:
    case PropertyType.Link:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.TextSimilarity,
        ComparisonMode.RegexExtractNumber
      ];
    case PropertyType.Number:
    case PropertyType.Percentage:
    case PropertyType.Rating:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.FixedTolerance,
        ComparisonMode.RelativeTolerance
      ];
    case PropertyType.Boolean:
      return [ComparisonMode.StrictEqual];
    case PropertyType.SingleChoice:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.TextSimilarity,
        ComparisonMode.RegexExtractNumber
      ];
    case PropertyType.MultipleChoice:
    case PropertyType.Tags:
    case PropertyType.Multilevel:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.SetIntersection,
        ComparisonMode.Subset
      ];
    case PropertyType.Date:
    case PropertyType.DateTime:
    case PropertyType.Time:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.TimeWindow,
        ComparisonMode.SameDay
      ];
    case PropertyType.Attachment:
      return [
        ComparisonMode.StrictEqual,
        ComparisonMode.ExtensionMap
      ];
    case PropertyType.Formula:
      return [ComparisonMode.StrictEqual];
    default:
      return [ComparisonMode.StrictEqual];
  }
};
const NullValueBehaviors = [
  { value: NullValueBehavior.Skip, label: "comparison.nullBehavior.skip", description: "comparison.nullBehavior.skip.description" },
  { value: NullValueBehavior.Fail, label: "comparison.nullBehavior.fail", description: "comparison.nullBehavior.fail.description" },
  { value: NullValueBehavior.Pass, label: "comparison.nullBehavior.pass", description: "comparison.nullBehavior.pass.description" }
];
const getDefaultParameterForMode = (mode) => {
  switch (mode) {
    case ComparisonMode.FixedTolerance:
      return { tolerance: 1 };
    case ComparisonMode.RelativeTolerance:
      return { tolerancePercent: 0.1 };
    case ComparisonMode.TimeWindow:
      return { windowHours: 24 };
    case ComparisonMode.RegexExtractNumber:
      return { pattern: "" };
    default:
      return null;
  }
};
const validateRuleConfig = (config2, t2) => {
  var _a2;
  const errors = [];
  if (!config2.property) {
    errors.push({ field: "property", message: t2("comparison.validation.propertyRequired") });
  }
  if (config2.mode === ComparisonMode.RegexExtractNumber) {
    const pattern4 = (_a2 = config2.parameter) == null ? void 0 : _a2.pattern;
    if (!pattern4 || pattern4.trim() === "") {
      errors.push({ field: "parameter.pattern", message: t2("comparison.validation.regexPatternRequired") });
    }
  }
  if (config2.weight <= 0) {
    errors.push({ field: "weight", message: t2("comparison.validation.weightPositive") });
  }
  if (config2.isVeto && (config2.vetoThreshold < 0 || config2.vetoThreshold > 1)) {
    errors.push({ field: "vetoThreshold", message: t2("comparison.validation.vetoThresholdRange") });
  }
  return errors;
};
const RuleConfigPanel = ({ value: value2, onChange, showPropertySelector = true, validationErrors = [] }) => {
  var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const getError = (field) => validationErrors.find((e2) => e2.field === field);
  const hasError = (field) => !!getError(field);
  const navigate = useNavigate();
  const handleNavigateToSpecialText = () => {
    createPortal(Modal, {
      title: t2("Confirm"),
      children: t2("comparison.confirm.navigateToSpecialText"),
      footer: {
        actions: ["ok", "cancel"]
      },
      defaultVisible: true,
      onOk: () => {
        navigate("/text");
      }
    });
  };
  const availableModes = value2.property ? getAvailableModesForPropertyType(value2.property.type) : [ComparisonMode.StrictEqual];
  const filteredModes = AllComparisonModes.filter((m2) => availableModes.includes(m2.value));
  reactExports.useEffect(() => {
    if (value2.property && !availableModes.includes(value2.mode)) {
      onChange({ ...value2, mode: availableModes[0] });
    }
  }, [(_a2 = value2.property) == null ? void 0 : _a2.type]);
  const handleSelectProperty = () => {
    createPortal(PropertySelector, {
      pool: PropertyPool.All,
      multiple: false,
      onSubmit: async (selectedProperties) => {
        if (selectedProperties.length > 0) {
          const property2 = selectedProperties[0];
          const newAvailableModes = getAvailableModesForPropertyType(property2.type);
          onChange({
            ...value2,
            propertyPool: property2.pool,
            propertyId: property2.id,
            property: property2,
            mode: newAvailableModes.includes(value2.mode) ? value2.mode : newAvailableModes[0]
          });
        }
      }
    });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
    showPropertySelector && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-sm text-default-500", children: t2("comparison.label.property") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          color: "primary",
          size: "sm",
          variant: "flat",
          onPress: handleSelectProperty,
          children: value2.property ? /* @__PURE__ */ jsxRuntimeExports.jsx(BriefProperty, { property: value2.property, fields: ["pool", "type", "name"], showPoolChip: false }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: t2("comparison.action.selectProperty") })
        }
      ) })
    ] }),
    value2.property && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Select,
      {
        dataSource: filteredModes.map((mode) => ({
          value: String(mode.value),
          label: t2(mode.label),
          description: t2(mode.description)
        })),
        label: t2("comparison.label.mode"),
        selectedKeys: [String(value2.mode)],
        size: "sm",
        isRequired: true,
        onSelectionChange: (keys2) => {
          const key = Array.from(keys2)[0];
          const newMode = Number(key);
          onChange({
            ...value2,
            mode: newMode,
            parameter: getDefaultParameterForMode(newMode)
          });
        }
      }
    ) }),
    value2.property && value2.mode === ComparisonMode.FixedTolerance && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-48",
        label: t2("comparison.label.tolerance"),
        description: t2("comparison.description.tolerance"),
        size: "sm",
        type: "number",
        min: 0,
        step: 0.1,
        value: String(((_b2 = value2.parameter) == null ? void 0 : _b2.tolerance) ?? 1),
        onValueChange: (v2) => onChange({
          ...value2,
          parameter: { tolerance: Number(v2) }
        })
      }
    ) }),
    value2.property && value2.mode === ComparisonMode.RelativeTolerance && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-48",
        label: t2("comparison.label.tolerancePercent"),
        description: t2("comparison.description.tolerancePercent"),
        size: "sm",
        type: "number",
        min: 0,
        max: 1,
        step: 0.05,
        value: String(((_c2 = value2.parameter) == null ? void 0 : _c2.tolerancePercent) ?? 0.1),
        onValueChange: (v2) => onChange({
          ...value2,
          parameter: { tolerancePercent: Number(v2) }
        })
      }
    ) }),
    value2.property && value2.mode === ComparisonMode.TimeWindow && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-48",
        label: t2("comparison.label.windowHours"),
        description: t2("comparison.description.windowHours"),
        size: "sm",
        type: "number",
        min: 0,
        step: 1,
        value: String(((_d = value2.parameter) == null ? void 0 : _d.windowHours) ?? 24),
        onValueChange: (v2) => onChange({
          ...value2,
          parameter: { windowHours: Number(v2) }
        })
      }
    ) }),
    value2.property && value2.mode === ComparisonMode.RegexExtractNumber && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      input_default,
      {
        className: "w-full",
        label: t2("comparison.label.regexPattern"),
        description: t2("comparison.description.regexPattern"),
        size: "sm",
        placeholder: "(\\d+)",
        isRequired: true,
        isInvalid: hasError("parameter.pattern"),
        errorMessage: (_e = getError("parameter.pattern")) == null ? void 0 : _e.message,
        value: ((_f = value2.parameter) == null ? void 0 : _f.pattern) ?? "",
        onValueChange: (v2) => onChange({
          ...value2,
          parameter: { pattern: v2 }
        })
      }
    ) }),
    value2.property && [PropertyType.SingleLineText, PropertyType.MultilineText, PropertyType.Link, PropertyType.SingleChoice, PropertyType.MultipleChoice, PropertyType.Tags, PropertyType.Multilevel].includes(value2.property.type) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        switch_default,
        {
          isSelected: value2.normalize,
          size: "sm",
          onValueChange: (v2) => onChange({ ...value2, normalize: v2 }),
          children: t2("comparison.label.normalize")
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs text-default-400", children: [
        t2("comparison.description.normalize"),
        " ",
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          link_default,
          {
            className: "text-xs cursor-pointer",
            underline: "always",
            onPress: handleNavigateToSpecialText,
            children: t2("comparison.action.configureSpecialText")
          }
        )
      ] })
    ] }),
    value2.property && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          className: "w-32",
          label: t2("comparison.label.weight"),
          size: "sm",
          type: "number",
          isRequired: true,
          isInvalid: hasError("weight"),
          errorMessage: (_g = getError("weight")) == null ? void 0 : _g.message,
          value: String(value2.weight),
          onValueChange: (v2) => onChange({ ...value2, weight: Number(v2) })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(ScoringExplanation, { mode: "inline", className: "mt-2 p-3 bg-default-100 rounded-lg" })
    ] }),
    value2.property && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          switch_default,
          {
            isSelected: value2.isVeto,
            size: "sm",
            onValueChange: (v2) => onChange({ ...value2, isVeto: v2 }),
            children: t2("comparison.label.isVeto")
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("comparison.description.isVeto") })
      ] }),
      value2.isVeto && /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          className: "w-32",
          description: t2("comparison.description.vetoThreshold"),
          label: t2("comparison.label.vetoThreshold"),
          max: 1,
          min: 0,
          size: "sm",
          step: 0.1,
          type: "number",
          isInvalid: hasError("vetoThreshold"),
          errorMessage: (_h = getError("vetoThreshold")) == null ? void 0 : _h.message,
          value: String(value2.vetoThreshold),
          onValueChange: (v2) => onChange({ ...value2, vetoThreshold: Number(v2) })
        }
      )
    ] }),
    value2.property && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          dataSource: NullValueBehaviors.map((b2) => ({
            value: String(b2.value),
            label: t2(b2.label),
            description: t2(b2.description)
          })),
          description: t2("comparison.description.oneNullBehavior"),
          label: t2("comparison.label.oneNullBehavior"),
          selectedKeys: [String(value2.oneNullBehavior)],
          size: "sm",
          onSelectionChange: (keys2) => {
            const key = Array.from(keys2)[0];
            onChange({ ...value2, oneNullBehavior: Number(key) });
          }
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Select,
        {
          dataSource: NullValueBehaviors.map((b2) => ({
            value: String(b2.value),
            label: t2(b2.label),
            description: t2(b2.description)
          })),
          description: t2("comparison.description.bothNullBehavior"),
          label: t2("comparison.label.bothNullBehavior"),
          selectedKeys: [String(value2.bothNullBehavior)],
          size: "sm",
          onSelectionChange: (keys2) => {
            const key = Array.from(keys2)[0];
            onChange({ ...value2, bothNullBehavior: Number(key) });
          }
        }
      )
    ] }),
    hasError("property") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-danger text-sm", children: (_i = getError("property")) == null ? void 0 : _i.message })
  ] });
};
const RuleModal = ({ rule, isOpen, onClose, onSave }) => {
  const { t: t2 } = useTranslation();
  const isEditing = !!(rule == null ? void 0 : rule.property);
  const [config2, setConfig] = reactExports.useState({
    propertyPool: PropertyPool.Custom,
    propertyId: 0,
    mode: ComparisonMode.StrictEqual,
    parameter: null,
    normalize: false,
    weight: 1,
    isVeto: false,
    vetoThreshold: 1,
    oneNullBehavior: NullValueBehavior.Skip,
    bothNullBehavior: NullValueBehavior.Skip
  });
  const [validationErrors, setValidationErrors] = reactExports.useState([]);
  reactExports.useEffect(() => {
    if (rule) {
      const mode = rule.mode;
      setConfig({
        propertyPool: rule.propertyPool,
        propertyId: rule.propertyId,
        property: rule.property,
        mode,
        parameter: rule.parameter ?? getDefaultParameterForMode(mode),
        normalize: rule.normalize ?? false,
        weight: rule.weight ?? 1,
        isVeto: rule.isVeto ?? false,
        vetoThreshold: rule.vetoThreshold ?? 1,
        oneNullBehavior: rule.oneNullBehavior ?? NullValueBehavior.Skip,
        bothNullBehavior: rule.bothNullBehavior ?? NullValueBehavior.Skip
      });
    } else {
      setConfig({
        propertyPool: PropertyPool.Custom,
        propertyId: 0,
        mode: ComparisonMode.StrictEqual,
        parameter: null,
        normalize: false,
        weight: 1,
        isVeto: false,
        vetoThreshold: 1,
        oneNullBehavior: NullValueBehavior.Skip,
        bothNullBehavior: NullValueBehavior.Skip
      });
    }
    setValidationErrors([]);
  }, [rule, isOpen]);
  const handleSave = async () => {
    const errors = validateRuleConfig(config2, t2);
    if (errors.length > 0) {
      setValidationErrors(errors);
      return;
    }
    const result = {
      order: (rule == null ? void 0 : rule.order) ?? 0,
      propertyPool: config2.property.pool,
      propertyId: config2.property.id,
      property: config2.property,
      mode: config2.mode,
      parameter: config2.parameter,
      normalize: config2.normalize,
      weight: config2.weight,
      isVeto: config2.isVeto,
      vetoThreshold: config2.vetoThreshold,
      oneNullBehavior: config2.oneNullBehavior,
      bothNullBehavior: config2.bothNullBehavior
    };
    onSave(result);
    onClose();
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Modal,
    {
      size: "lg",
      title: isEditing ? t2("comparison.action.editRule") : t2("comparison.action.addRule"),
      visible: isOpen,
      footer: {
        actions: ["ok", "cancel"]
      },
      onClose,
      onOk: handleSave,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(RuleConfigPanel, { value: config2, onChange: setConfig, validationErrors })
    }
  );
};
const RuleDemonstrator = ({
  property: property2,
  propertyId,
  mode,
  parameter,
  normalize: normalize2,
  weight,
  isVeto,
  vetoThreshold,
  oneNullBehavior,
  bothNullBehavior,
  onClick,
  onDelete
}) => {
  var _a2, _b2, _c2;
  const { t: t2 } = useTranslation();
  const modeLabel = ((_a2 = AllComparisonModes.find((m2) => m2.value === mode)) == null ? void 0 : _a2.label) || "Unknown";
  const oneNullLabel = ((_b2 = NullValueBehaviors.find((b2) => b2.value === oneNullBehavior)) == null ? void 0 : _b2.label) || "Unknown";
  const bothNullLabel = ((_c2 = NullValueBehaviors.find((b2) => b2.value === bothNullBehavior)) == null ? void 0 : _c2.label) || "Unknown";
  const getParameterDisplay = () => {
    if (!parameter)
      return null;
    if (mode === ComparisonMode.FixedTolerance && "tolerance" in parameter) {
      return `${t2("comparison.label.tolerance")}: ${parameter.tolerance}`;
    }
    if (mode === ComparisonMode.RelativeTolerance && "tolerancePercent" in parameter) {
      return `${t2("comparison.label.tolerancePercent")}: ${(parameter.tolerancePercent * 100).toFixed(0)}%`;
    }
    if (mode === ComparisonMode.TimeWindow && "windowHours" in parameter) {
      return `${t2("comparison.label.windowHours")}: ${parameter.windowHours}h`;
    }
    if (mode === ComparisonMode.RegexExtractNumber && "pattern" in parameter) {
      const pattern4 = parameter.pattern;
      return pattern4 ? `${t2("comparison.label.regexPattern")}: ${pattern4}` : null;
    }
    return null;
  };
  const parameterDisplay = getParameterDisplay();
  const tooltipContent = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-1 text-xs p-1", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.mode"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2(modeLabel) })
    ] }),
    parameterDisplay && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: parameterDisplay }) }),
    normalize2 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.normalize"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("common.enabled") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.weight"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: weight })
    ] }),
    isVeto && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.vetoThreshold"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: vetoThreshold })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.oneNullBehavior"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2(oneNullLabel) })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-400", children: [
        t2("comparison.label.bothNullBehavior"),
        ":"
      ] }),
      " ",
      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2(bothNullLabel) })
    ] })
  ] });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: tooltipContent, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
    Chip,
    {
      className: onClick ? "cursor-pointer" : void 0,
      size: "sm",
      variant: "flat",
      color: isVeto ? "warning" : "default",
      onClick,
      onClose: onDelete,
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        property2 && /* @__PURE__ */ jsxRuntimeExports.jsx(PropertyTypeIcon, { type: property2.type }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (property2 == null ? void 0 : property2.name) || `${t2("comparison.label.property")} #${propertyId}` }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "|" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500 text-xs", children: t2(modeLabel) }),
        normalize2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-primary text-xs", children: "[N]" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "|" }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-default-500 text-xs", children: [
          "×",
          weight
        ] }),
        isVeto && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-danger text-xs", children: "(Veto)" })
      ] })
    }
  ) });
};
const ComparisonPage = () => {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const bTasks = useBTasksStore((state) => state.tasks);
  const [expandedKeys, setExpandedKeys] = reactExports.useState([]);
  const [plans, setPlans] = reactExports.useState();
  const isFirstLoad = reactExports.useRef(true);
  const getTaskForPlan = reactExports.useCallback((planId) => {
    const taskId = `Comparison:${planId}`;
    return bTasks.find((t22) => t22.id === taskId);
  }, [bTasks]);
  const [ruleModalOpen, setRuleModalOpen] = reactExports.useState(false);
  const [editingRule, setEditingRule] = reactExports.useState();
  const [editingRuleIndex, setEditingRuleIndex] = reactExports.useState(-1);
  const [editingPlanId, setEditingPlanId] = reactExports.useState(null);
  const [planRulesWithProperties, setPlanRulesWithProperties] = reactExports.useState(/* @__PURE__ */ new Map());
  const loadAllPlans = reactExports.useCallback(async () => {
    const r2 = await BApi$1.comparison.getAllComparisonPlans();
    const items = r2.data || [];
    setPlans(items);
    if (isFirstLoad.current) {
      setExpandedKeys(items.map((p2) => p2.id.toString()));
      isFirstLoad.current = false;
    }
  }, []);
  reactExports.useEffect(() => {
    loadAllPlans();
  }, []);
  const prevTasksRef = reactExports.useRef(/* @__PURE__ */ new Map());
  reactExports.useEffect(() => {
    const comparisonTasks = bTasks.filter((t22) => t22.id.startsWith("Comparison:"));
    const currentStatuses = new Map(comparisonTasks.map((t22) => [t22.id, t22.status]));
    const prevStatuses = prevTasksRef.current;
    const terminalStates = [BTaskStatus.Completed, BTaskStatus.Error, BTaskStatus.Cancelled];
    let shouldReload = false;
    for (const [taskId, status] of currentStatuses) {
      const prevStatus = prevStatuses.get(taskId);
      if (prevStatus !== void 0 && prevStatus !== status && terminalStates.includes(status)) {
        shouldReload = true;
        break;
      }
    }
    prevTasksRef.current = currentStatuses;
    if (shouldReload) {
      loadAllPlans();
    }
  }, [bTasks, loadAllPlans]);
  const handleAdd = () => {
    let nameInput = "";
    createPortal(Modal, {
      defaultVisible: true,
      size: "md",
      title: t2("comparison.action.createPlan"),
      onOk: async () => {
        var _a2;
        if (!nameInput.trim()) {
          Vt.error(t2("comparison.error.nameRequired"));
          throw new Error(t2("comparison.error.nameRequired"));
        }
        const r2 = await BApi$1.comparison.createComparisonPlan({
          name: nameInput.trim(),
          threshold: 80,
          rules: []
        });
        await loadAllPlans();
        if ((_a2 = r2.data) == null ? void 0 : _a2.id) {
          setExpandedKeys((prev2) => [...prev2, r2.data.id.toString()]);
        }
        Vt.success(t2("common.success.saved"));
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          input_default,
          {
            label: t2("comparison.label.name"),
            autoFocus: true,
            isRequired: true,
            defaultValue: "",
            onValueChange: (v2) => nameInput = v2
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-400", children: t2("comparison.hint.configureRulesAfterCreation") })
      ] })
    });
  };
  const handleEditBasicInfo = (plan) => {
    let nameInput = plan.name || "";
    createPortal(Modal, {
      defaultVisible: true,
      size: "md",
      title: t2("comparison.action.editPlan"),
      onOk: async () => {
        if (!nameInput.trim()) {
          Vt.error(t2("comparison.error.nameRequired"));
          throw new Error(t2("comparison.error.nameRequired"));
        }
        await BApi$1.comparison.updateComparisonPlan(plan.id, {
          name: nameInput.trim()
        });
        await loadAllPlans();
        Vt.success(t2("common.success.saved"));
      },
      children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
        input_default,
        {
          label: t2("comparison.label.name"),
          autoFocus: true,
          defaultValue: nameInput,
          isRequired: true,
          onValueChange: (v2) => nameInput = v2
        }
      ) }) })
    });
  };
  const loadRulesWithProperties = reactExports.useCallback(async (plan) => {
    if (!plan.rules || plan.rules.length === 0) {
      setPlanRulesWithProperties((prev2) => {
        const newMap = new Map(prev2);
        newMap.set(plan.id, []);
        return newMap;
      });
      return [];
    }
    const allPropertiesResponse = await BApi$1.property.getPropertiesByPool(PropertyPool.All);
    const allProperties = allPropertiesResponse.data || [];
    const rulesWithProperties = plan.rules.map((r2) => {
      const property2 = allProperties.find(
        (p2) => p2.id === r2.propertyId && p2.pool === r2.propertyPool
      );
      return {
        order: r2.order,
        propertyPool: r2.propertyPool,
        propertyId: r2.propertyId,
        propertyValueScope: r2.propertyValueScope,
        mode: r2.mode,
        normalize: r2.normalize ?? false,
        parameter: r2.parameter,
        weight: r2.weight,
        isVeto: r2.isVeto,
        vetoThreshold: r2.vetoThreshold,
        oneNullBehavior: r2.oneNullBehavior,
        bothNullBehavior: r2.bothNullBehavior,
        property: property2
      };
    });
    setPlanRulesWithProperties((prev2) => {
      const newMap = new Map(prev2);
      newMap.set(plan.id, rulesWithProperties);
      return newMap;
    });
    return rulesWithProperties;
  }, []);
  const handleAddRule = (plan) => {
    setEditingPlanId(plan.id);
    setEditingRule(void 0);
    setEditingRuleIndex(-1);
    setRuleModalOpen(true);
  };
  const handleEditRule = (plan, rule, index2) => {
    setEditingPlanId(plan.id);
    setEditingRule(rule);
    setEditingRuleIndex(index2);
    setRuleModalOpen(true);
  };
  const handleSaveRule = async (rule) => {
    var _a2;
    if (!editingPlanId)
      return;
    const plan = plans == null ? void 0 : plans.find((p2) => p2.id === editingPlanId);
    if (!plan)
      return;
    const currentRules = planRulesWithProperties.get(editingPlanId) || [];
    let newRules;
    if (editingRuleIndex >= 0) {
      newRules = [...currentRules];
      newRules[editingRuleIndex] = { ...rule, order: editingRuleIndex };
    } else {
      newRules = [...currentRules, { ...rule, order: currentRules.length }];
    }
    const inputRules = newRules.map(({ property: property2, ...rest }) => rest);
    await BApi$1.comparison.updateComparisonPlan(plan.id, {
      name: plan.name,
      threshold: plan.threshold,
      rules: inputRules,
      search: plan.search
    });
    await loadAllPlans();
    const updatedPlan = (_a2 = (await BApi$1.comparison.getAllComparisonPlans()).data) == null ? void 0 : _a2.find((p2) => p2.id === editingPlanId);
    if (updatedPlan) {
      await loadRulesWithProperties(updatedPlan);
    }
    Vt.success(t2("common.success.saved"));
  };
  const handleDeleteRule = async (plan, index2) => {
    var _a2;
    const currentRules = planRulesWithProperties.get(plan.id) || [];
    const newRules = currentRules.filter((_24, i2) => i2 !== index2);
    newRules.forEach((r2, i2) => r2.order = i2);
    const inputRules = newRules.map(({ property: property2, ...rest }) => rest);
    await BApi$1.comparison.updateComparisonPlan(plan.id, {
      name: plan.name,
      threshold: plan.threshold,
      rules: inputRules,
      search: plan.search
    });
    await loadAllPlans();
    const updatedPlan = (_a2 = (await BApi$1.comparison.getAllComparisonPlans()).data) == null ? void 0 : _a2.find((p2) => p2.id === plan.id);
    if (updatedPlan) {
      await loadRulesWithProperties(updatedPlan);
    }
    Vt.success(t2("common.success.saved"));
  };
  const handleFilterChange = reactExports.useCallback(async (plan, updatedSearch) => {
    setPlans(
      (prev2) => prev2 == null ? void 0 : prev2.map(
        (p2) => p2.id === plan.id ? { ...p2, search: updatedSearch } : p2
      )
    );
    await BApi$1.comparison.updateComparisonPlan(plan.id, {
      name: plan.name,
      threshold: plan.threshold,
      rules: plan.rules || [],
      search: updatedSearch
    });
  }, []);
  const handleThresholdChange = reactExports.useCallback(async (plan, newThreshold) => {
    setPlans(
      (prev2) => prev2 == null ? void 0 : prev2.map(
        (p2) => p2.id === plan.id ? { ...p2, threshold: newThreshold } : p2
      )
    );
    await BApi$1.comparison.updateComparisonPlan(plan.id, {
      name: plan.name,
      threshold: newThreshold,
      rules: plan.rules || [],
      search: plan.search
    });
  }, []);
  const handleDelete = (plan) => {
    createPortal(Modal, {
      defaultVisible: true,
      title: t2("comparison.action.delete"),
      children: t2("comparison.confirm.delete", { name: plan.name }),
      onOk: async () => {
        await BApi$1.comparison.deleteComparisonPlan(plan.id);
        loadAllPlans();
      }
    });
  };
  const handleDuplicate = async (plan) => {
    await BApi$1.comparison.duplicateComparisonPlan(plan.id);
    loadAllPlans();
    Vt.success(t2("comparison.success.duplicated"));
  };
  const handleExecute = async (plan) => {
    try {
      const r2 = await BApi$1.comparison.executeComparisonPlan(plan.id);
      if (r2.code === 0) {
        Vt.success(t2("comparison.success.taskStarted"));
      } else {
        Vt.error(r2.message || t2("comparison.error.taskFailed"));
      }
    } catch (e2) {
      Vt.error(e2.message || t2("comparison.error.taskFailed"));
    }
  };
  const handleClearResults = async (plan) => {
    createPortal(Modal, {
      defaultVisible: true,
      title: t2("comparison.action.clearResults"),
      children: t2("comparison.confirm.clearResults", { name: plan.name }),
      onOk: async () => {
        await BApi$1.comparison.clearComparisonResults(plan.id);
        loadAllPlans();
        Vt.success(t2("comparison.success.resultsCleared"));
      }
    });
  };
  const handleViewResults = (plan) => {
    createPortal(Modal, {
      defaultVisible: true,
      size: "7xl",
      title: plan.name,
      footer: false,
      children: /* @__PURE__ */ jsxRuntimeExports.jsx(ComparisonResults, { plan })
    });
  };
  const renderEmptyState = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center justify-center min-h-[400px] gap-4", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(AiOutlineInbox, { className: "text-6xl text-default-300" }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "text-default-500 text-center", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg mb-2", children: t2("comparison.empty.noPlans") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-default-400", children: t2("comparison.empty.description") })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}), onPress: handleAdd, children: t2("comparison.action.createPlan") })
  ] });
  const renderAccordionTitle = (plan) => {
    var _a2;
    const task = getTaskForPlan(plan.id);
    const isRunning = (task == null ? void 0 : task.status) === BTaskStatus.Running;
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between w-full", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: plan.name }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "flat", children: t2("comparison.label.ruleCount", { count: ((_a2 = plan.rules) == null ? void 0 : _a2.length) || 0 }) }),
        isRunning && /* @__PURE__ */ jsxRuntimeExports.jsx(
          progress_default,
          {
            className: "w-24",
            color: "primary",
            size: "sm",
            value: (task == null ? void 0 : task.percentage) || 0
          }
        ),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "text-default-400", size: "sm", variant: "light", children: [
          t2("comparison.label.createdAt"),
          ": ",
          plan.createdAt
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.edit"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => handleEditBasicInfo(plan),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$R, { className: "text-base" })
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
        plan.lastRunAt && /* @__PURE__ */ jsxRuntimeExports.jsxs(Chip, { className: "text-default-400", size: "sm", variant: "light", children: [
          t2("comparison.label.lastRun"),
          ": ",
          plan.lastRunAt
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.duplicate"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            size: "sm",
            variant: "light",
            onPress: () => handleDuplicate(plan),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$X, { className: "text-base" })
          }
        ) }),
        plan.resultGroupCount != null && plan.resultGroupCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.clearResults"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "warning",
            size: "sm",
            variant: "light",
            onPress: () => handleClearResults(plan),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" })
          }
        ) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("comparison.action.delete"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Button,
          {
            isIconOnly: true,
            color: "danger",
            size: "sm",
            variant: "light",
            onPress: () => handleDelete(plan),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$U, { className: "text-base" })
          }
        ) })
      ] })
    ] });
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { color: "primary", size: "sm", startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}), onPress: handleAdd, children: t2("comparison.action.createPlan") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
      plans && plans.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-400", children: [
        t2("comparison.label.planCount"),
        ": ",
        plans.length
      ] })
    ] }) }),
    plans ? plans.length === 0 ? renderEmptyState() : /* @__PURE__ */ jsxRuntimeExports.jsx(
      accordion_default,
      {
        className: "p-0",
        selectedKeys: expandedKeys,
        selectionMode: "multiple",
        variant: "splitted",
        onSelectionChange: (keys2) => {
          if (!keys2) {
            setExpandedKeys([]);
          }
          setExpandedKeys(Array.from(keys2).map((x2) => x2));
        },
        children: plans.map((plan) => {
          var _a2, _b2, _c2, _d, _e;
          const task = getTaskForPlan(plan.id);
          const isRunning = (task == null ? void 0 : task.status) === BTaskStatus.Running;
          return /* @__PURE__ */ jsxRuntimeExports.jsx(accordion_item_base_default, { title: renderAccordionTitle(plan), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-0 flex flex-col gap-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "bg-default-50", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "pb-2 flex items-center gap-4", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("comparison.label.filters") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("comparison.description.filters") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "pt-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                ResourceFilterController,
                {
                  defaultFilterDisplayMode: FilterDisplayMode.Simple,
                  autoCreateMediaLibraryFilter: true,
                  group: (_a2 = plan.search) == null ? void 0 : _a2.group,
                  onGroupChange: (group) => {
                    const updatedSearch = { ...plan.search, group };
                    handleFilterChange(plan, updatedSearch);
                  },
                  tags: (_b2 = plan.search) == null ? void 0 : _b2.tags,
                  onTagsChange: (tags) => {
                    const updatedSearch = { ...plan.search, tags };
                    handleFilterChange(plan, updatedSearch);
                  },
                  filterLayout: "vertical",
                  showRecentFilters: true,
                  showTags: true
                }
              ) })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "bg-default-50", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "pb-2 flex items-center gap-4", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("comparison.label.rules") }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("comparison.description.rules") })
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  Button,
                  {
                    color: "primary",
                    size: "sm",
                    startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1f, {}),
                    variant: "flat",
                    onPress: () => handleAddRule(plan),
                    children: t2("comparison.action.addRule")
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(card_body_default, { className: "pt-0", children: (() => {
                var _a3;
                const rulesWithProps = planRulesWithProperties.get(plan.id);
                if (rulesWithProps === void 0 && (((_a3 = plan.rules) == null ? void 0 : _a3.length) ?? 0) > 0) {
                  loadRulesWithProperties(plan);
                  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-400 py-2", children: t2("common.state.loading") });
                }
                if (!rulesWithProps || rulesWithProps.length === 0) {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm text-default-400 py-2", children: t2("comparison.empty.noRules") });
                }
                return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-2", children: rulesWithProps.map((rule, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                  RuleDemonstrator,
                  {
                    property: rule.property,
                    propertyId: rule.propertyId,
                    mode: rule.mode,
                    parameter: rule.parameter,
                    normalize: rule.normalize,
                    weight: rule.weight,
                    isVeto: rule.isVeto,
                    vetoThreshold: rule.vetoThreshold,
                    oneNullBehavior: rule.oneNullBehavior,
                    bothNullBehavior: rule.bothNullBehavior,
                    onClick: () => handleEditRule(plan, rule, index2),
                    onDelete: () => handleDeleteRule(plan, index2)
                  },
                  index2
                )) });
              })() })
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs(card_default, { className: "bg-default-50", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_header_default, { className: "pb-2 flex items-center gap-4", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium", children: t2("comparison.action.execute") }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-400", children: t2("comparison.description.execute") })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(card_body_default, { className: "pt-0 flex flex-col gap-3", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-default-500", children: [
                    t2("comparison.label.threshold"),
                    ":"
                  ] }),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    EditableValue,
                    {
                      value: plan.threshold ?? 80,
                      Viewer: ({ value: value2, onClick }) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
                        Chip,
                        {
                          className: "cursor-pointer hover:bg-default-200",
                          size: "sm",
                          variant: "flat",
                          onClick,
                          children: [
                            value2,
                            "%"
                          ]
                        }
                      ),
                      Editor: ({ value: value2, onValueChange }) => /* @__PURE__ */ jsxRuntimeExports.jsx(
                        number_input_default,
                        {
                          autoFocus: true,
                          className: "w-24",
                          endContent: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-400", children: "%" }),
                          max: 100,
                          min: 0,
                          size: "sm",
                          step: 1,
                          value: value2,
                          onValueChange: (v2) => onValueChange == null ? void 0 : onValueChange(v2 ?? 80)
                        }
                      ),
                      onSubmit: (v2) => handleThresholdChange(plan, v2 ?? 80),
                      trigger: "viewer"
                    }
                  )
                ] }) }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(ScoringExplanation, { mode: "inline", className: "p-3 bg-default-100 rounded-lg" }),
                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Tooltip$1,
                    {
                      content: !((_c2 = plan.rules) == null ? void 0 : _c2.length) ? t2("comparison.description.executeDisabledNoRules") : void 0,
                      isDisabled: !!((_d = plan.rules) == null ? void 0 : _d.length),
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                        Button,
                        {
                          color: "success",
                          isDisabled: isRunning || !((_e = plan.rules) == null ? void 0 : _e.length),
                          size: "sm",
                          startContent: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, {}),
                          onPress: () => handleExecute(plan),
                          children: plan.lastRunAt ? t2("comparison.action.reExecute") : t2("comparison.action.execute")
                        }
                      ) })
                    }
                  ),
                  (plan.resultGroupCount ?? 0) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
                    Button,
                    {
                      color: "warning",
                      size: "sm",
                      variant: "flat",
                      onPress: () => handleViewResults(plan),
                      children: t2("comparison.action.viewGroups", { count: plan.resultGroupCount })
                    }
                  ),
                  (plan.resultGroupCount ?? 0) === 0 && plan.lastRunAt != null && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "flat", children: t2("comparison.label.noResultsFound") })
                ] })
              ] })
            ] })
          ] }) }, plan.id.toString());
        })
      }
    ) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(spinner_default, { size: "lg" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      RuleModal,
      {
        isOpen: ruleModalOpen,
        rule: editingRule,
        onClose: () => setRuleModalOpen(false),
        onSave: handleSaveRule
      }
    )
  ] });
};
ComparisonPage.displayName = "ComparisonPage";
const Test = reactExports.lazy(() => __vitePreload(() => import("./index-BT-uvNHS.js"), true ? __vite__mapDeps([6,3,7]) : void 0));
const routesMenuConfig = [
  {
    name: "menu.dashboard",
    path: "/",
    component: DashboardPage,
    icon: AiOutlineDashboard,
    layout: "basic",
    menu: false
    // 首页不在菜单中
  },
  {
    name: "menu.resource",
    path: "/resource",
    component: ResourcePage,
    icon: AiOutlinePicture,
    layout: "basic",
    menu: true
  },
  {
    name: "menu.mediaLibrary",
    path: "/media-library",
    component: MediaLibraryPage,
    icon: MdVideoLibrary,
    layout: "basic",
    menu: true
  },
  {
    name: "menu.mediaLibraryConfiguration",
    path: "/path-mark-config",
    component: PathRuleConfigPage,
    icon: AiOutlineControl,
    layout: "basic",
    menu: true,
    isBeta: true
  },
  {
    name: "menu.pathMarks",
    path: "/path-marks",
    component: PathMarksPage,
    icon: AiOutlineTags,
    layout: "basic",
    menu: true,
    isBeta: true
  },
  {
    name: "menu.resourceProfile",
    path: "/resource-profile",
    component: ResourceProfilePage,
    icon: AiOutlineFilter,
    layout: "basic",
    menu: true,
    isBeta: true
  },
  {
    name: "menu.data",
    icon: AiOutlineDatabase,
    menu: true,
    children: [
      {
        name: "menu.customProperty",
        path: "/customproperty",
        component: CustomPropertyPage,
        icon: AiOutlineRadarChart,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.extensionGroup",
        path: "/extension-group",
        component: ExtensionGroupPage,
        icon: AiOutlineUngroup,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.cache",
        path: "/cache",
        component: CachePage,
        icon: AiOutlineHdd,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.specialText",
        path: "/text",
        component: TextPage,
        icon: AiOutlineFieldString,
        layout: "basic",
        menu: true
      },
      // {
      //   name: "menu.playHistory",
      //   path: "/play-history",
      //   component: PlayHistoryPage,
      //   icon: AiOutlineHistory,
      //   layout: "basic",
      //   menu: true,
      // },
      {
        name: "menu.bulkModification",
        path: "/bulk-modification",
        component: BulkModification2Page,
        icon: AiOutlineForm,
        layout: "basic",
        menu: true,
        isBeta: true
      },
      {
        name: "menu.comparison",
        path: "/comparison",
        component: ComparisonPage,
        icon: AiOutlineDiff,
        layout: "basic",
        menu: true,
        isBeta: true
      },
      {
        name: "menu.alias",
        path: "/alias",
        component: AliasPage,
        icon: AiOutlineBranches,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.mediaLibrary",
        path: "/media-library",
        isDeprecated: true,
        component: MediaLibraryPage$1,
        icon: AiOutlineProduct,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.mediaLibraryTemplate",
        path: "/media-library-template",
        component: MediaLibraryTemplatePage,
        icon: AiOutlineAppstoreAdd,
        layout: "basic",
        menu: true,
        isDeprecated: true
      },
      {
        name: "menu.synchronizationOptions",
        path: "/synchronization-options",
        component: SynchronizationOptionsPage,
        icon: AiOutlineSync,
        layout: "basic",
        menu: true,
        isDeprecated: true
      }
    ]
  },
  {
    name: "menu.tools",
    icon: AiOutlineTool,
    menu: true,
    children: [
      {
        name: "menu.fileProcessor",
        path: "/file-processor",
        component: FileProcessorPage,
        icon: AiOutlineCode,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.downloader",
        path: "/downloader",
        component: DownloaderPage,
        icon: AiOutlineDownload,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.fileMover",
        path: "/file-mover",
        component: FileMoverPage,
        icon: AiOutlineSwap,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.fileNameModifier",
        path: "/file-name-modifier",
        component: FileNameModifierPage,
        icon: AiOutlineEdit,
        layout: "basic",
        isBeta: true,
        menu: true
      },
      {
        name: "menu.migration",
        path: "/migration",
        // component: Migration,
        icon: AiOutlineExperiment,
        layout: "basic",
        menu: false
        // 不在菜单中
      }
    ]
  },
  {
    name: "menu.experimental",
    icon: AiOutlineExperiment,
    menu: true,
    children: [
      {
        name: "menu.thirdPartyIntegration",
        path: "/third-party-integration",
        component: ThirdPartyIntegrationPage,
        icon: TbToolsKitchen,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.postParser",
        path: "/post-parser",
        component: PostParserPage,
        icon: MdOutlineArticle,
        layout: "basic",
        menu: true
      }
    ]
  },
  {
    name: "menu.system",
    icon: AiOutlineSetting,
    menu: true,
    children: [
      {
        name: "menu.configuration",
        path: "/configuration",
        component: ConfigurationPage,
        icon: AiOutlineAppstore,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.thirdParty",
        path: "/third-party-configuration",
        component: ThirdPartyConfigurationPage,
        icon: TbToolsKitchen,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.backgroundTask",
        path: "/background-task",
        component: BackgroundTaskPage,
        icon: AiOutlineInteraction,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.performanceProfiler",
        path: "/profiler",
        component: ProfilerPage,
        icon: AiOutlineRadarChart,
        layout: "basic",
        menu: true
      },
      {
        name: "menu.log",
        path: "/log",
        component: LogPage,
        icon: AiOutlineFileText,
        layout: "basic",
        menu: true
      }
    ]
  },
  {
    name: "menu.test",
    path: "/test",
    component: Test,
    icon: AiOutlineBug,
    layout: "basic",
    menu: false
  }
];
var config = {
  attributes: true,
  characterData: true,
  subtree: true,
  childList: true
};
function useMutationObserver(ref, callback2, options = config) {
  reactExports.useEffect(() => {
    if (ref.current) {
      const observer = new MutationObserver(callback2);
      observer.observe(ref.current, options);
      return () => {
        observer.disconnect();
      };
    }
  }, [callback2, options]);
}
var Observables = ({
  mutationObservables,
  resizeObservables,
  refresh
}) => {
  const [mutationsCounter, setMutationsCounter] = reactExports.useState(0);
  const ref = reactExports.useRef(document.documentElement || document.body);
  function refreshHighlightedRegionIfObservable(nodes) {
    const posibleNodes = Array.from(nodes);
    for (const node2 of posibleNodes) {
      if (mutationObservables) {
        if (!node2.attributes) {
          continue;
        }
        const found = mutationObservables.find(
          (observable) => node2.matches(observable)
        );
        if (found) {
          refresh(true);
        }
      }
    }
  }
  function incrementMutationsCounterIfObservable(nodes) {
    const posibleNodes = Array.from(nodes);
    for (const node2 of posibleNodes) {
      if (resizeObservables) {
        if (!node2.attributes) {
          continue;
        }
        const found = resizeObservables.find(
          (observable) => node2.matches(observable)
        );
        if (found)
          setMutationsCounter(mutationsCounter + 1);
      }
    }
  }
  useMutationObserver(
    ref,
    (mutationList) => {
      for (const mutation of mutationList) {
        if (mutation.addedNodes.length !== 0) {
          refreshHighlightedRegionIfObservable(mutation.addedNodes);
          incrementMutationsCounterIfObservable(mutation.addedNodes);
        }
        if (mutation.removedNodes.length !== 0) {
          refreshHighlightedRegionIfObservable(mutation.removedNodes);
          incrementMutationsCounterIfObservable(mutation.removedNodes);
        }
      }
    },
    { childList: true, subtree: true }
  );
  reactExports.useEffect(() => {
    if (!resizeObservables) {
      return;
    }
    const resizeObserver2 = new index$2(() => {
      refresh();
    });
    for (const observable of resizeObservables) {
      const element2 = document.querySelector(observable);
      if (element2) {
        resizeObserver2.observe(element2);
      }
    }
    return () => {
      resizeObserver2.disconnect();
    };
  }, [resizeObservables, mutationsCounter]);
  return null;
};
var Observables_default = Observables;
function getRect(element2) {
  let rect = initialState$1;
  if (element2) {
    const domRect = element2.getBoundingClientRect();
    rect = domRect;
  }
  return rect;
}
function useRect(ref, refresher) {
  const [dimensions, setDimensions] = reactExports.useState(initialState$1);
  const handleResize = reactExports.useCallback(() => {
    if (!(ref == null ? void 0 : ref.current))
      return;
    setDimensions(getRect(ref == null ? void 0 : ref.current));
  }, [ref == null ? void 0 : ref.current]);
  reactExports.useEffect(() => {
    handleResize();
    window.addEventListener("resize", handleResize);
    return () => window.removeEventListener("resize", handleResize);
  }, [ref == null ? void 0 : ref.current, refresher]);
  return dimensions;
}
var initialState$1 = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  x: 0,
  y: 0
};
function smoothScroll(elem, options) {
  return new Promise((resolve2) => {
    if (!(elem instanceof Element)) {
      throw new TypeError("Argument 1 must be an Element");
    }
    let same = 0;
    let lastPos = null;
    const scrollOptions = Object.assign({ behavior: "smooth" }, options);
    elem.scrollIntoView(scrollOptions);
    requestAnimationFrame(check);
    function check() {
      const newPos = elem == null ? void 0 : elem.getBoundingClientRect().top;
      if (newPos === lastPos) {
        if (same++ > 2) {
          return resolve2(null);
        }
      } else {
        same = 0;
        lastPos = newPos;
      }
      requestAnimationFrame(check);
    }
  });
}
function safe(sum) {
  return sum < 0 ? 0 : sum;
}
function getInViewThreshold(threshold) {
  if (typeof threshold === "object" && threshold !== null) {
    return {
      thresholdX: threshold.x || 0,
      thresholdY: threshold.y || 0
    };
  }
  return {
    thresholdX: threshold || 0,
    thresholdY: threshold || 0
  };
}
function getWindow2() {
  const w2 = Math.max(
    document.documentElement.clientWidth,
    window.innerWidth || 0
  );
  const h3 = Math.max(
    document.documentElement.clientHeight,
    window.innerHeight || 0
  );
  return { w: w2, h: h3 };
}
function inView({
  top: top2,
  right,
  bottom: bottom2,
  left: left2,
  threshold
}) {
  const { w: windowWidth, h: windowHeight } = getWindow2();
  const { thresholdX, thresholdY } = getInViewThreshold(threshold);
  return top2 < 0 && bottom2 - top2 > windowHeight ? true : top2 >= 0 + thresholdY && left2 >= 0 + thresholdX && bottom2 <= windowHeight - thresholdY && right <= windowWidth - thresholdX;
}
var isOutsideX = (val, windowWidth) => {
  return val > windowWidth;
};
var isOutsideY = (val, windowHeight) => {
  return val > windowHeight;
};
function bestPositionOf(positions2, filters = []) {
  const compareFn = (a2, b2) => filters.includes(a2) ? 1 : filters.includes(b2) ? -1 : 0;
  return Object.keys(positions2).map((p2) => {
    return {
      position: p2,
      value: positions2[p2]
    };
  }).sort((a2, b2) => b2.value - a2.value).sort((a2, b2) => compareFn(a2.position, b2.position)).filter((p2) => p2.value > 0).map((p2) => p2.position);
}
var defaultPadding = 10;
function getPadding$1(padding = defaultPadding) {
  if (Array.isArray(padding)) {
    if (padding.length === 1) {
      return [padding[0], padding[0], padding[0], padding[0]];
    }
    if (padding.length === 2) {
      return [padding[1], padding[0], padding[1], padding[0]];
    }
    if (padding.length === 3) {
      return [padding[0], padding[1], padding[2], padding[1]];
    }
    if (padding.length > 3) {
      return [padding[0], padding[1], padding[2], padding[3]];
    }
    return [defaultPadding, defaultPadding];
  }
  return [padding, padding, padding, padding];
}
var defaultStyles$2 = {
  maskWrapper: () => ({
    opacity: 0.7,
    left: 0,
    top: 0,
    position: "fixed",
    zIndex: 99999,
    pointerEvents: "none",
    color: "#000"
  }),
  svgWrapper: ({ windowWidth, windowHeight, wpt, wpl }) => ({
    width: windowWidth,
    height: windowHeight,
    left: Number(wpl),
    top: Number(wpt),
    position: "fixed"
  }),
  maskArea: ({ x: x2, y: y2, width, height }) => ({
    x: x2,
    y: y2,
    width,
    height,
    fill: "black",
    rx: 0
  }),
  maskRect: ({ windowWidth, windowHeight, maskID }) => ({
    x: 0,
    y: 0,
    width: windowWidth,
    height: windowHeight,
    fill: "currentColor",
    mask: `url(#${maskID})`
  }),
  clickArea: ({ windowWidth, windowHeight, clipID }) => ({
    x: 0,
    y: 0,
    width: windowWidth,
    height: windowHeight,
    fill: "currentcolor",
    pointerEvents: "auto",
    clipPath: `url(#${clipID})`
  }),
  highlightedArea: ({ x: x2, y: y2, width, height }) => ({
    x: x2,
    y: y2,
    width,
    height,
    pointerEvents: "auto",
    fill: "transparent",
    display: "none"
  })
};
function stylesMatcher$2(styles2) {
  return (key, state) => {
    const base = defaultStyles$2[key](state);
    const custom = styles2[key];
    return custom ? custom(base, state) : base;
  };
}
var Mask = ({
  padding = 10,
  wrapperPadding = 0,
  onClick,
  onClickHighlighted,
  styles: styles2 = {},
  sizes,
  className,
  highlightedAreaClassName,
  maskId,
  clipId
}) => {
  const maskID = maskId || uniqueId("mask__");
  const clipID = clipId || uniqueId("clip__");
  const getStyles = stylesMatcher$2(styles2);
  const [pt, pr, pb2, pl2] = getPadding$1(padding);
  const [wpt, wpr, wpb, wpl] = getPadding$1(wrapperPadding);
  const { w: w2, h: h3 } = getWindow2();
  const width = safe((sizes == null ? void 0 : sizes.width) + pl2 + pr);
  const height = safe((sizes == null ? void 0 : sizes.height) + pt + pb2);
  const top2 = safe((sizes == null ? void 0 : sizes.top) - pt - wpt);
  const left2 = safe((sizes == null ? void 0 : sizes.left) - pl2 - wpl);
  const windowWidth = w2 - wpl - wpr;
  const windowHeight = h3 - wpt - wpb;
  const maskAreaStyles = getStyles("maskArea", {
    x: left2,
    y: top2,
    width,
    height
  });
  const highlightedAreaStyles = getStyles("highlightedArea", {
    x: left2,
    y: top2,
    width,
    height
  });
  return /* @__PURE__ */ React$6.createElement(
    "div",
    {
      style: getStyles("maskWrapper", {}),
      onClick,
      className
    },
    /* @__PURE__ */ React$6.createElement(
      "svg",
      {
        width: windowWidth,
        height: windowHeight,
        xmlns: "http://www.w3.org/2000/svg",
        style: getStyles("svgWrapper", {
          windowWidth,
          windowHeight,
          wpt,
          wpl
        })
      },
      /* @__PURE__ */ React$6.createElement("defs", null, /* @__PURE__ */ React$6.createElement("mask", { id: maskID }, /* @__PURE__ */ React$6.createElement(
        "rect",
        {
          x: 0,
          y: 0,
          width: windowWidth,
          height: windowHeight,
          fill: "white"
        }
      ), /* @__PURE__ */ React$6.createElement(
        "rect",
        {
          style: maskAreaStyles,
          rx: maskAreaStyles.rx ? 1 : void 0
        }
      )), /* @__PURE__ */ React$6.createElement("clipPath", { id: clipID }, /* @__PURE__ */ React$6.createElement(
        "polygon",
        {
          points: `0 0, 0 ${windowHeight}, ${left2} ${windowHeight}, ${left2} ${top2}, ${left2 + width} ${top2}, ${left2 + width} ${top2 + height}, ${left2} ${top2 + height}, ${left2} ${windowHeight}, ${windowWidth} ${windowHeight}, ${windowWidth} 0`
        }
      ))),
      /* @__PURE__ */ React$6.createElement(
        "rect",
        {
          style: getStyles("maskRect", {
            windowWidth,
            windowHeight,
            maskID
          })
        }
      ),
      /* @__PURE__ */ React$6.createElement(
        "rect",
        {
          style: getStyles("clickArea", {
            windowWidth,
            windowHeight,
            top: top2,
            left: left2,
            width,
            height,
            clipID
          })
        }
      ),
      /* @__PURE__ */ React$6.createElement(
        "rect",
        {
          style: highlightedAreaStyles,
          className: highlightedAreaClassName,
          onClick: onClickHighlighted,
          rx: highlightedAreaStyles.rx ? 1 : void 0
        }
      )
    )
  );
};
var Mask_default = Mask;
function uniqueId(prefix) {
  return prefix + Math.random().toString(36).substring(2, 16);
}
var __defProp$1 = Object.defineProperty;
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
var __defNormalProp$1 = (obj, key, value2) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues$1 = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp$1.call(b2, prop))
      __defNormalProp$1(a2, prop, b2[prop]);
  if (__getOwnPropSymbols$1)
    for (var prop of __getOwnPropSymbols$1(b2)) {
      if (__propIsEnum$1.call(b2, prop))
        __defNormalProp$1(a2, prop, b2[prop]);
    }
  return a2;
};
var __objRest$1 = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp$1.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols$1)
    for (var prop of __getOwnPropSymbols$1(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
var defaultStyles$1 = {
  popover: () => ({
    position: "fixed",
    maxWidth: 353,
    backgroundColor: "#fff",
    padding: "24px 30px",
    boxShadow: "0 0.5em 3em rgba(0, 0, 0, 0.3)",
    color: "inherit",
    zIndex: 1e5,
    transition: "transform 0.3s",
    top: 0,
    left: 0
  })
};
function stylesMatcher$1(styles2) {
  return (key, state) => {
    const base = defaultStyles$1[key](state);
    const custom = styles2[key];
    return custom ? custom(base, state) : base;
  };
}
var Popover = (_a2) => {
  var _b2 = _a2, {
    children,
    position: providedPosition = "bottom",
    padding = 10,
    styles: styles2 = {},
    sizes,
    refresher
  } = _b2, props = __objRest$1(_b2, [
    "children",
    "position",
    "padding",
    "styles",
    "sizes",
    "refresher"
  ]);
  const helperRef = reactExports.useRef(null);
  const positionRef = reactExports.useRef("");
  const verticalAlignRef = reactExports.useRef("");
  const horizontalAlignRef = reactExports.useRef("");
  const { w: windowWidth, h: windowHeight } = getWindow2();
  const getStyles = stylesMatcher$1(styles2);
  const helperRect = useRect(helperRef, refresher);
  const { width: helperWidth, height: helperHeight } = helperRect;
  const [pt, pr, pb2, pl2] = getPadding$1(padding);
  const targetLeft = (sizes == null ? void 0 : sizes.left) - pl2;
  const targetTop = (sizes == null ? void 0 : sizes.top) - pt;
  const targetRight = (sizes == null ? void 0 : sizes.right) + pr;
  const targetBottom = (sizes == null ? void 0 : sizes.bottom) + pb2;
  const position2 = providedPosition && typeof providedPosition === "function" ? providedPosition(
    {
      width: helperWidth,
      height: helperHeight,
      windowWidth,
      windowHeight,
      top: targetTop,
      left: targetLeft,
      right: targetRight,
      bottom: targetBottom,
      x: sizes.x,
      y: sizes.y
    },
    helperRect
  ) : providedPosition;
  const available = {
    left: targetLeft,
    right: windowWidth - targetRight,
    top: targetTop,
    bottom: windowHeight - targetBottom
  };
  const couldPositionAt = (position22, isOutsideX2, isOutsideY2) => {
    switch (position22) {
      case "top":
        return available.top > helperHeight + pb2;
      case "right":
        return isOutsideX2 ? false : available.right > helperWidth + pl2;
      case "bottom":
        return isOutsideY2 ? false : available.bottom > helperHeight + pt;
      case "left":
        return available.left > helperWidth + pr;
      default:
        return false;
    }
  };
  const autoPosition = (coords, outX, outY) => {
    const positionsOrder = bestPositionOf(
      available,
      outY ? ["right", "left"] : outX ? ["top", "bottom"] : []
    );
    for (let j2 = 0; j2 < positionsOrder.length; j2++) {
      if (couldPositionAt(positionsOrder[j2], outX, outY)) {
        positionRef.current = positionsOrder[j2];
        return coords[positionsOrder[j2]];
      }
    }
    positionRef.current = "center";
    return coords.center;
  };
  const pos = (helperPosition) => {
    if (Array.isArray(helperPosition)) {
      const isOutX = isOutsideX(helperPosition[0], windowWidth);
      const isOutY = isOutsideY(helperPosition[1], windowHeight);
      positionRef.current = "custom";
      return [
        isOutX ? windowWidth / 2 - helperWidth / 2 : helperPosition[0],
        isOutY ? windowHeight / 2 - helperHeight / 2 : helperPosition[1]
      ];
    }
    const isHelperOutsideX = isOutsideX(targetLeft + helperWidth, windowWidth);
    const isHelperOutsideY = isOutsideY(
      targetBottom + helperHeight,
      windowHeight
    );
    const x2 = isHelperOutsideX ? Math.min(targetLeft, windowWidth - helperWidth) : Math.max(targetLeft, 0);
    const y2 = isHelperOutsideY ? helperHeight > available.bottom ? Math.max(targetBottom - helperHeight, 0) : Math.max(targetTop, 0) : targetTop;
    if (isHelperOutsideY) {
      if (helperHeight > available.bottom) {
        verticalAlignRef.current = "bottom";
      } else {
        verticalAlignRef.current = "top";
      }
    } else {
      verticalAlignRef.current = "top";
    }
    if (isHelperOutsideX) {
      horizontalAlignRef.current = "left";
    } else {
      horizontalAlignRef.current = "right";
    }
    const coords = {
      top: [x2 - pl2, targetTop - helperHeight - pb2],
      right: [targetRight + pl2, y2 - pt],
      bottom: [x2 - pl2, targetBottom + pt],
      left: [targetLeft - helperWidth - pr, y2 - pt],
      center: [
        windowWidth / 2 - helperWidth / 2,
        windowHeight / 2 - helperHeight / 2
      ]
    };
    if (helperPosition === "center" || couldPositionAt(helperPosition, isHelperOutsideX, isHelperOutsideY) && !isHelperOutsideX && !isHelperOutsideY) {
      positionRef.current = helperPosition;
      return coords[helperPosition];
    }
    return autoPosition(coords, isHelperOutsideX, isHelperOutsideY);
  };
  const p2 = pos(position2);
  return /* @__PURE__ */ React$6.createElement(
    "div",
    __spreadValues$1({
      className: "reactour__popover",
      style: __spreadValues$1({
        transform: `translate(${Math.round(p2[0])}px, ${Math.round(p2[1])}px)`
      }, getStyles("popover", {
        position: positionRef.current,
        verticalAlign: verticalAlignRef.current,
        horizontalAlign: horizontalAlignRef.current,
        helperRect,
        targetRect: sizes
      })),
      ref: helperRef
    }, props),
    children
  );
};
var Popover_default = Popover;
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp2 = (obj, key, value2) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value: value2 }) : obj[key] = value2;
var __spreadValues = (a2, b2) => {
  for (var prop in b2 || (b2 = {}))
    if (__hasOwnProp.call(b2, prop))
      __defNormalProp2(a2, prop, b2[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b2)) {
      if (__propIsEnum.call(b2, prop))
        __defNormalProp2(a2, prop, b2[prop]);
    }
  return a2;
};
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
var __objRest = (source2, exclude) => {
  var target = {};
  for (var prop in source2)
    if (__hasOwnProp.call(source2, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source2[prop];
  if (source2 != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source2)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source2, prop))
        target[prop] = source2[prop];
    }
  return target;
};
var initialState = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  windowWidth: 0,
  windowHeight: 0,
  x: 0,
  y: 0
};
function useSizes(step, scrollOptions = {
  block: "center",
  behavior: "smooth",
  inViewThreshold: 0
}) {
  const [transition3, setTransition] = reactExports.useState(false);
  const [observing, setObserving] = reactExports.useState(false);
  const [isHighlightingObserved, setIsHighlightingObserved] = reactExports.useState(false);
  const [refresher, setRefresher] = reactExports.useState(null);
  const [dimensions, setDimensions] = reactExports.useState(initialState);
  const target = (step == null ? void 0 : step.selector) instanceof Element ? step == null ? void 0 : step.selector : document.querySelector(step == null ? void 0 : step.selector);
  const handleResize = reactExports.useCallback(() => {
    const _a2 = getHighlightedRect(
      target,
      step == null ? void 0 : step.highlightedSelectors,
      step == null ? void 0 : step.bypassElem
    ), { hasHighligtedElems } = _a2, newDimensions = __objRest(_a2, ["hasHighligtedElems"]);
    if (Object.entries(dimensions).some(
      ([key, value2]) => newDimensions[key] !== value2
    )) {
      setDimensions(newDimensions);
    }
  }, [target, step == null ? void 0 : step.highlightedSelectors, dimensions]);
  reactExports.useEffect(() => {
    handleResize();
    window.addEventListener("resize", handleResize);
    return () => window.removeEventListener("resize", handleResize);
  }, [target, step == null ? void 0 : step.highlightedSelectors, refresher]);
  reactExports.useEffect(() => {
    const isInView = inView(__spreadProps(__spreadValues({}, dimensions), {
      threshold: scrollOptions.inViewThreshold
    }));
    if (!isInView && target) {
      setTransition(true);
      smoothScroll(target, scrollOptions).then(() => {
        if (!observing)
          setRefresher(Date.now());
      }).finally(() => {
        setTransition(false);
      });
    }
  }, [dimensions]);
  const observableRefresher = reactExports.useCallback(() => {
    setObserving(true);
    const _a2 = getHighlightedRect(
      target,
      step == null ? void 0 : step.highlightedSelectors,
      step == null ? void 0 : step.bypassElem
    ), { hasHighligtedElems } = _a2, dimesions = __objRest(_a2, ["hasHighligtedElems"]);
    setIsHighlightingObserved(hasHighligtedElems);
    setDimensions(dimesions);
    setObserving(false);
  }, [target, step == null ? void 0 : step.highlightedSelectors, dimensions]);
  return {
    sizes: dimensions,
    transition: transition3,
    target,
    observableRefresher,
    isHighlightingObserved
  };
}
function getHighlightedRect(node2, highlightedSelectors = [], bypassElem = true) {
  let hasHighligtedElems = false;
  const { w: windowWidth, h: windowHeight } = getWindow2();
  if (!highlightedSelectors) {
    return __spreadProps(__spreadValues({}, getRect(node2)), {
      windowWidth,
      windowHeight,
      hasHighligtedElems: false
    });
  }
  let attrs = getRect(node2);
  let altAttrs = {
    bottom: 0,
    height: 0,
    left: windowWidth,
    right: 0,
    top: windowHeight,
    width: 0
  };
  for (const selector of highlightedSelectors) {
    const element2 = document.querySelector(selector);
    if (!element2 || element2.style.display === "none" || element2.style.visibility === "hidden") {
      continue;
    }
    const rect = getRect(element2);
    hasHighligtedElems = true;
    if (bypassElem || !node2) {
      if (rect.top < altAttrs.top) {
        altAttrs.top = rect.top;
      }
      if (rect.right > altAttrs.right) {
        altAttrs.right = rect.right;
      }
      if (rect.bottom > altAttrs.bottom) {
        altAttrs.bottom = rect.bottom;
      }
      if (rect.left < altAttrs.left) {
        altAttrs.left = rect.left;
      }
      altAttrs.width = altAttrs.right - altAttrs.left;
      altAttrs.height = altAttrs.bottom - altAttrs.top;
    } else {
      if (rect.top < attrs.top) {
        attrs.top = rect.top;
      }
      if (rect.right > attrs.right) {
        attrs.right = rect.right;
      }
      if (rect.bottom > attrs.bottom) {
        attrs.bottom = rect.bottom;
      }
      if (rect.left < attrs.left) {
        attrs.left = rect.left;
      }
      attrs.width = attrs.right - attrs.left;
      attrs.height = attrs.bottom - attrs.top;
    }
  }
  const bypassable = bypassElem || !node2 ? altAttrs.width > 0 && altAttrs.height > 0 : false;
  return {
    left: (bypassable ? altAttrs : attrs).left,
    top: (bypassable ? altAttrs : attrs).top,
    right: (bypassable ? altAttrs : attrs).right,
    bottom: (bypassable ? altAttrs : attrs).bottom,
    width: (bypassable ? altAttrs : attrs).width,
    height: (bypassable ? altAttrs : attrs).height,
    windowWidth,
    windowHeight,
    hasHighligtedElems,
    x: attrs.x,
    y: attrs.y
  };
}
var Keyboard = ({
  disableKeyboardNavigation,
  setCurrentStep,
  currentStep,
  setIsOpen,
  stepsLength,
  disable: disable2,
  rtl,
  clickProps,
  keyboardHandler
}) => {
  function keyDownHandler(e2) {
    e2.stopPropagation();
    if (disableKeyboardNavigation === true || disable2) {
      return;
    }
    let isEscDisabled, isRightDisabled, isLeftDisabled;
    if (disableKeyboardNavigation) {
      isEscDisabled = disableKeyboardNavigation.includes("esc");
      isRightDisabled = disableKeyboardNavigation.includes("right");
      isLeftDisabled = disableKeyboardNavigation.includes("left");
    }
    function next2() {
      setCurrentStep(Math.min(currentStep + 1, stepsLength - 1));
    }
    function prev2() {
      setCurrentStep(Math.max(currentStep - 1, 0));
    }
    if (keyboardHandler && typeof keyboardHandler === "function") {
      keyboardHandler(e2, clickProps, {
        isEscDisabled,
        isRightDisabled,
        isLeftDisabled
      });
    } else {
      if (e2.keyCode === 27 && !isEscDisabled) {
        e2.preventDefault();
        setIsOpen(false);
      }
      if (e2.keyCode === 39 && !isRightDisabled) {
        e2.preventDefault();
        if (rtl) {
          prev2();
        } else {
          next2();
        }
      }
      if (e2.keyCode === 37 && !isLeftDisabled) {
        e2.preventDefault();
        if (rtl) {
          next2();
        } else {
          prev2();
        }
      }
    }
  }
  reactExports.useEffect(() => {
    window.addEventListener("keydown", keyDownHandler, false);
    return () => {
      window.removeEventListener("keydown", keyDownHandler);
    };
  }, [disable2, setCurrentStep, currentStep]);
  return null;
};
var Keyboard_default = Keyboard;
var defaultStyles = {
  badge: () => ({
    position: "absolute",
    fontFamily: "monospace",
    background: "var(--reactour-accent,#007aff)",
    height: "1.875em",
    lineHeight: 2,
    paddingLeft: "0.8125em",
    paddingRight: "0.8125em",
    fontSize: "1em",
    borderRadius: "1.625em",
    color: "white",
    textAlign: "center",
    boxShadow: "0 0.25em 0.5em rgba(0, 0, 0, 0.3)",
    top: "-0.8125em",
    left: "-0.8125em"
  }),
  controls: () => ({
    display: "flex",
    marginTop: 24,
    alignItems: "center",
    justifyContent: "space-between"
  }),
  navigation: () => ({
    counterReset: "dot",
    display: "flex",
    justifyContent: "space-between",
    alignItems: "center",
    flexWrap: "wrap"
  }),
  button: ({ disabled }) => ({
    display: "block",
    padding: 0,
    border: 0,
    background: "none",
    cursor: disabled ? "not-allowed" : "pointer"
  }),
  arrow: ({ disabled }) => ({
    color: disabled ? "#caccce" : "#646464",
    width: 16,
    height: 12,
    flex: "0 0 16px"
    // '&:hover': {
    //   color: disabled ? '#caccce' : '#000',
    // },
  }),
  dot: ({ current, disabled, showNumber }) => ({
    counterIncrement: "dot",
    width: 8,
    height: 8,
    border: current ? "0" : "1px solid #caccce",
    borderRadius: "100%",
    padding: 0,
    display: "block",
    margin: 4,
    transition: "opacity 0.3s, transform 0.3s",
    cursor: disabled ? "not-allowed" : "pointer",
    transform: `scale(${current ? 1.25 : 1})`,
    color: current ? "var(--reactour-accent, #007aff)" : "#caccce",
    background: current ? "var(--reactour-accent, #007aff)" : "none"
    // '&:before': {
    //   content: 'counter(dot)',
    //   position: 'absolute',
    //   bottom: 'calc(100% + 0.25em)',
    //   left: '50%',
    //   opacity: 0,
    //   transform: 'translate(-50%, 1em)',
    //   transition: '0.3s',
    //   display: showNumber ? 'block' : 'none',
    // },
    // '&:hover': {
    //   backgroundColor: 'currentColor',
    //   '&:before': {
    //     opacity: 0.5,
    //     transform: 'translate(-50%, -2px)',
    //   },
    // },
  }),
  close: ({ disabled }) => ({
    position: "absolute",
    top: 22,
    right: 22,
    width: 9,
    height: 9,
    "--rt-close-btn": disabled ? "#caccce" : "#5e5e5e",
    "--rt-close-btn-disabled": disabled ? "#caccce" : "#000"
  }),
  svg: () => ({
    display: "block"
  })
};
function stylesMatcher(styles2) {
  return (key, state) => {
    const base = defaultStyles[key](state);
    const custom = styles2[key];
    return custom ? custom(base, state) : base;
  };
}
var Badge = ({
  styles: styles2 = {},
  children
}) => {
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$6.createElement("span", { style: getStyles("badge", {}) }, children);
};
var Badge_default = Badge;
var Close = (_a2) => {
  var _b2 = _a2, {
    styles: styles2 = {},
    onClick,
    disabled
  } = _b2, props = __objRest(_b2, [
    "styles",
    "onClick",
    "disabled"
  ]);
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$6.createElement(
    "button",
    __spreadValues({
      className: "reactour__close-button",
      style: __spreadValues(__spreadValues({}, getStyles("button", {})), getStyles("close", { disabled })),
      onClick
    }, props),
    /* @__PURE__ */ React$6.createElement(
      "svg",
      {
        viewBox: "0 0 9.1 9.1",
        "aria-hidden": true,
        role: "presentation",
        style: __spreadValues({}, getStyles("svg", {}))
      },
      /* @__PURE__ */ React$6.createElement(
        "path",
        {
          fill: "currentColor",
          d: "M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"
        }
      )
    )
  );
};
var Close_default = Close;
var Content = ({
  content: content2,
  setCurrentStep,
  transition: transition3,
  isHighlightingObserved,
  currentStep,
  setIsOpen
}) => {
  return typeof content2 === "function" ? content2({
    setCurrentStep,
    transition: transition3,
    isHighlightingObserved,
    currentStep,
    setIsOpen
  }) : content2;
};
var Content_default = Content;
var Navigation$1 = ({
  styles: styles2 = {},
  steps,
  setCurrentStep,
  currentStep,
  setIsOpen,
  nextButton,
  prevButton,
  disableDots,
  hideDots,
  hideButtons,
  disableAll,
  rtl,
  Arrow: Arrow2 = DefaultArrow
}) => {
  const stepsLength = steps.length;
  const getStyles = stylesMatcher(styles2);
  const Button2 = ({
    onClick,
    kind = "next",
    children,
    hideArrow
  }) => {
    function clickHandler() {
      if (!disableAll) {
        if (onClick && typeof onClick === "function") {
          onClick();
        } else {
          if (kind === "next") {
            setCurrentStep(Math.min(currentStep + 1, stepsLength - 1));
          } else {
            setCurrentStep(Math.max(currentStep - 1, 0));
          }
        }
      }
    }
    return /* @__PURE__ */ React$6.createElement(
      "button",
      {
        style: getStyles("button", {
          kind,
          disabled: disableAll ? disableAll : kind === "next" ? stepsLength - 1 === currentStep : currentStep === 0
        }),
        onClick: clickHandler,
        "aria-label": `Go to ${kind} step`
      },
      !hideArrow ? /* @__PURE__ */ React$6.createElement(
        Arrow2,
        {
          styles: styles2,
          inverted: rtl ? kind === "prev" : kind === "next",
          disabled: disableAll ? disableAll : kind === "next" ? stepsLength - 1 === currentStep : currentStep === 0
        }
      ) : null,
      children
    );
  };
  return /* @__PURE__ */ React$6.createElement("div", { style: getStyles("controls", {}), dir: rtl ? "rtl" : "ltr" }, !hideButtons ? prevButton && typeof prevButton === "function" ? prevButton({
    Button: Button2,
    setCurrentStep,
    currentStep,
    stepsLength,
    setIsOpen,
    steps
  }) : /* @__PURE__ */ React$6.createElement(Button2, { kind: "prev" }) : null, !hideDots ? /* @__PURE__ */ React$6.createElement("div", { style: getStyles("navigation", {}) }, Array.from({ length: stepsLength }, (_24, i2) => i2).map((index2) => {
    var _a2;
    return /* @__PURE__ */ React$6.createElement(
      "button",
      {
        style: getStyles("dot", {
          current: index2 === currentStep,
          disabled: disableDots || disableAll
        }),
        onClick: () => {
          if (!disableDots && !disableAll)
            setCurrentStep(index2);
        },
        key: `navigation_dot_${index2}`,
        "aria-label": ((_a2 = steps[index2]) == null ? void 0 : _a2.navDotAriaLabel) || `Go to step ${index2 + 1}`
      }
    );
  })) : null, !hideButtons ? nextButton && typeof nextButton === "function" ? nextButton({
    Button: Button2,
    setCurrentStep,
    currentStep,
    stepsLength,
    setIsOpen,
    steps
  }) : /* @__PURE__ */ React$6.createElement(Button2, null) : null);
};
var Navigation_default = Navigation$1;
var DefaultArrow = ({
  styles: styles2 = {},
  inverted = false,
  disabled
}) => {
  const getStyles = stylesMatcher(styles2);
  return /* @__PURE__ */ React$6.createElement(
    "svg",
    {
      viewBox: "0 0 18.4 14.4",
      style: getStyles("arrow", { inverted, disabled })
    },
    /* @__PURE__ */ React$6.createElement(
      "path",
      {
        d: inverted ? "M17 7.2H1M10.8 1L17 7.2l-6.2 6.2" : "M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",
        fill: "none",
        stroke: "currentColor",
        strokeWidth: "2",
        strokeLinecap: "round",
        strokeMiterlimit: "10"
      }
    )
  );
};
var components = {
  Badge: Badge_default,
  Close: Close_default,
  Content: Content_default,
  Navigation: Navigation_default,
  Arrow: DefaultArrow
};
var defaultComponents = (comps) => __spreadValues(__spreadValues({}, components), comps);
var PopoverContent = ({
  styles: styles2,
  components: components2 = {},
  badgeContent,
  accessibilityOptions,
  disabledActions,
  onClickClose,
  steps,
  setCurrentStep,
  currentStep,
  transition: transition3,
  isHighlightingObserved,
  setIsOpen,
  nextButton,
  prevButton,
  disableDotsNavigation,
  rtl,
  showPrevNextButtons = true,
  showCloseButton = true,
  showNavigation = true,
  showBadge = true,
  showDots = true,
  meta,
  setMeta,
  setSteps
}) => {
  const step = steps[currentStep];
  const { Badge: Badge2, Close: Close2, Content: Content2, Navigation: Navigation2, Arrow: Arrow2 } = defaultComponents(components2);
  const badge2 = badgeContent && typeof badgeContent === "function" ? badgeContent({
    currentStep,
    totalSteps: steps.length,
    transition: transition3
  }) : currentStep + 1;
  function closeClickHandler() {
    if (!disabledActions) {
      if (onClickClose && typeof onClickClose === "function") {
        onClickClose({
          setCurrentStep,
          setIsOpen,
          currentStep,
          steps,
          meta,
          setMeta,
          setSteps
        });
      } else {
        setIsOpen(false);
      }
    }
  }
  return /* @__PURE__ */ React$6.createElement(React$6.Fragment, null, showBadge ? /* @__PURE__ */ React$6.createElement(Badge2, { styles: styles2 }, badge2) : null, showCloseButton ? /* @__PURE__ */ React$6.createElement(
    Close2,
    {
      styles: styles2,
      "aria-label": accessibilityOptions == null ? void 0 : accessibilityOptions.closeButtonAriaLabel,
      disabled: disabledActions,
      onClick: closeClickHandler
    }
  ) : null, /* @__PURE__ */ React$6.createElement(
    Content2,
    {
      content: step == null ? void 0 : step.content,
      setCurrentStep,
      currentStep,
      transition: transition3,
      isHighlightingObserved,
      setIsOpen
    }
  ), showNavigation ? /* @__PURE__ */ React$6.createElement(
    Navigation2,
    {
      setCurrentStep,
      currentStep,
      setIsOpen,
      steps,
      styles: styles2,
      "aria-hidden": !(accessibilityOptions == null ? void 0 : accessibilityOptions.showNavigationScreenReaders),
      nextButton,
      prevButton,
      disableDots: disableDotsNavigation,
      hideButtons: !showPrevNextButtons,
      hideDots: !showDots,
      disableAll: disabledActions,
      rtl,
      Arrow: Arrow2
    }
  ) : null);
};
var PopoverContent_default = PopoverContent;
var Tour = (_a2) => {
  var _b2 = _a2, {
    currentStep,
    setCurrentStep,
    setIsOpen,
    steps = [],
    setSteps,
    styles: globalStyles = {},
    scrollSmooth,
    afterOpen,
    beforeClose,
    padding = 10,
    position: position2,
    onClickMask,
    onClickHighlighted,
    keyboardHandler,
    className = "reactour__popover",
    maskClassName = "reactour__mask",
    highlightedMaskClassName,
    clipId,
    maskId,
    disableInteraction,
    disableKeyboardNavigation,
    inViewThreshold,
    disabledActions,
    setDisabledActions,
    disableWhenSelectorFalsy,
    rtl,
    accessibilityOptions = {
      closeButtonAriaLabel: "Close Tour",
      showNavigationScreenReaders: true
    },
    ContentComponent,
    Wrapper,
    meta,
    setMeta,
    onTransition = () => {
      return "center";
    }
  } = _b2, popoverProps = __objRest(_b2, [
    "currentStep",
    "setCurrentStep",
    "setIsOpen",
    "steps",
    "setSteps",
    "styles",
    "scrollSmooth",
    "afterOpen",
    "beforeClose",
    "padding",
    "position",
    "onClickMask",
    "onClickHighlighted",
    "keyboardHandler",
    "className",
    "maskClassName",
    "highlightedMaskClassName",
    "clipId",
    "maskId",
    "disableInteraction",
    // disableFocusLock,
    "disableKeyboardNavigation",
    "inViewThreshold",
    "disabledActions",
    "setDisabledActions",
    "disableWhenSelectorFalsy",
    "rtl",
    "accessibilityOptions",
    "ContentComponent",
    "Wrapper",
    "meta",
    "setMeta",
    "onTransition"
  ]);
  var _a22;
  const step = steps[currentStep];
  const styles2 = __spreadValues(__spreadValues({}, globalStyles), step == null ? void 0 : step.styles);
  const {
    sizes,
    transition: transition3,
    observableRefresher,
    isHighlightingObserved,
    target
  } = useSizes(step, {
    block: "center",
    behavior: scrollSmooth ? "smooth" : "auto",
    inViewThreshold
  });
  reactExports.useEffect(() => {
    if (afterOpen && typeof afterOpen === "function") {
      afterOpen(target);
    }
    return () => {
      if (beforeClose && typeof beforeClose === "function") {
        beforeClose(target);
      }
    };
  }, []);
  const { maskPadding, popoverPadding, wrapperPadding } = getPadding(
    (_a22 = step == null ? void 0 : step.padding) != null ? _a22 : padding
  );
  const clickProps = {
    setCurrentStep,
    setIsOpen,
    currentStep,
    setSteps,
    steps,
    setMeta,
    meta
  };
  function maskClickHandler() {
    if (!disabledActions) {
      if (onClickMask && typeof onClickMask === "function") {
        onClickMask(clickProps);
      } else {
        setIsOpen(false);
      }
    }
  }
  const doDisableInteraction = typeof (step == null ? void 0 : step.stepInteraction) === "boolean" ? !(step == null ? void 0 : step.stepInteraction) : disableInteraction ? typeof disableInteraction === "boolean" ? disableInteraction : disableInteraction(clickProps) : false;
  reactExports.useEffect(() => {
    if ((step == null ? void 0 : step.action) && typeof (step == null ? void 0 : step.action) === "function") {
      step == null ? void 0 : step.action(target);
    }
    if ((step == null ? void 0 : step.disableActions) !== void 0) {
      setDisabledActions(step == null ? void 0 : step.disableActions);
    }
    return () => {
      if ((step == null ? void 0 : step.actionAfter) && typeof (step == null ? void 0 : step.actionAfter) === "function") {
        step == null ? void 0 : step.actionAfter(target);
      }
    };
  }, [step]);
  const popoverPosition = transition3 ? onTransition : (step == null ? void 0 : step.position) ? step == null ? void 0 : step.position : position2;
  const TourWrapper = Wrapper ? Wrapper : React$6.Fragment;
  return step ? /* @__PURE__ */ React$6.createElement(TourWrapper, null, /* @__PURE__ */ React$6.createElement(
    Observables_default,
    {
      mutationObservables: step == null ? void 0 : step.mutationObservables,
      resizeObservables: step == null ? void 0 : step.resizeObservables,
      refresh: observableRefresher
    }
  ), /* @__PURE__ */ React$6.createElement(
    Keyboard_default,
    {
      setCurrentStep,
      currentStep,
      setIsOpen,
      stepsLength: steps.length,
      disableKeyboardNavigation,
      disable: disabledActions,
      rtl,
      clickProps,
      keyboardHandler
    }
  ), (!disableWhenSelectorFalsy || target) && /* @__PURE__ */ React$6.createElement(
    Mask_default,
    {
      sizes: transition3 ? initialState2 : sizes,
      onClick: maskClickHandler,
      styles: __spreadValues({
        highlightedArea: (base) => __spreadProps(__spreadValues({}, base), {
          display: doDisableInteraction ? "block" : "none"
        })
      }, styles2),
      padding: transition3 ? 0 : maskPadding,
      highlightedAreaClassName: highlightedMaskClassName,
      className: maskClassName,
      onClickHighlighted: (e2) => {
        e2.preventDefault();
        e2.stopPropagation();
        if (onClickHighlighted)
          onClickHighlighted(e2, clickProps);
      },
      wrapperPadding,
      clipId,
      maskId
    }
  ), (!disableWhenSelectorFalsy || target) && /* @__PURE__ */ React$6.createElement(
    Popover_default,
    {
      sizes,
      styles: styles2,
      position: popoverPosition,
      padding: popoverPadding,
      "aria-labelledby": accessibilityOptions == null ? void 0 : accessibilityOptions.ariaLabelledBy,
      className,
      refresher: currentStep
    },
    ContentComponent ? /* @__PURE__ */ React$6.createElement(
      ContentComponent,
      __spreadValues({
        styles: styles2,
        setCurrentStep,
        currentStep,
        setIsOpen,
        steps,
        accessibilityOptions,
        disabledActions,
        transition: transition3,
        isHighlightingObserved,
        rtl
      }, popoverProps)
    ) : /* @__PURE__ */ React$6.createElement(
      PopoverContent_default,
      __spreadValues({
        styles: styles2,
        setCurrentStep,
        currentStep,
        setIsOpen,
        steps,
        setSteps,
        accessibilityOptions,
        disabledActions,
        transition: transition3,
        isHighlightingObserved,
        rtl,
        meta,
        setMeta
      }, popoverProps)
    )
  )) : null;
};
var Tour_default = Tour;
function getPadding(padding) {
  if (typeof padding === "object" && padding !== null) {
    return {
      maskPadding: padding.mask,
      popoverPadding: padding.popover,
      wrapperPadding: padding.wrapper
    };
  }
  return {
    maskPadding: padding,
    popoverPadding: padding,
    wrapperPadding: 0
  };
}
var initialState2 = {
  bottom: 0,
  height: 0,
  left: 0,
  right: 0,
  top: 0,
  width: 0,
  x: 0,
  y: 0
};
var defaultState = {
  isOpen: false,
  setIsOpen: () => false,
  currentStep: 0,
  setCurrentStep: () => 0,
  steps: [],
  setSteps: () => [],
  setMeta: () => "",
  disabledActions: false,
  setDisabledActions: () => false,
  components: {}
};
var TourContext = React$6.createContext(defaultState);
var TourProvider = (_a2) => {
  var _b2 = _a2, {
    children,
    defaultOpen = false,
    startAt = 0,
    steps: defaultSteps,
    setCurrentStep: customSetCurrentStep,
    currentStep: customCurrentStep
  } = _b2, props = __objRest(_b2, [
    "children",
    "defaultOpen",
    "startAt",
    "steps",
    "setCurrentStep",
    "currentStep"
  ]);
  const [isOpen, setIsOpen] = reactExports.useState(defaultOpen);
  const [currentStep, setCurrentStep] = reactExports.useState(startAt);
  const [steps, setSteps] = reactExports.useState(defaultSteps);
  const [meta, setMeta] = reactExports.useState("");
  const [disabledActions, setDisabledActions] = reactExports.useState(false);
  const value2 = __spreadValues({
    isOpen,
    setIsOpen,
    currentStep: customCurrentStep || currentStep,
    setCurrentStep: customSetCurrentStep && typeof customSetCurrentStep === "function" ? customSetCurrentStep : setCurrentStep,
    steps,
    setSteps,
    disabledActions,
    setDisabledActions,
    meta,
    setMeta
  }, props);
  return /* @__PURE__ */ React$6.createElement(TourContext.Provider, { value: value2 }, children, isOpen ? /* @__PURE__ */ React$6.createElement(Tour_default, __spreadValues({}, value2)) : null);
};
function useTour() {
  return reactExports.useContext(TourContext);
}
const insideWorld = "_insideWorld_wsqb0_1";
const main = "_main_wsqb0_7";
const styles$1 = {
  insideWorld,
  main
};
function extractMenu(config2) {
  return config2.filter((r2) => r2.menu !== false).map((r2) => {
    const item = {
      name: r2.name,
      path: r2.path,
      icon: r2.icon,
      isBeta: r2.isBeta,
      isDeprecated: r2.isDeprecated
    };
    if (r2.children)
      item.children = extractMenu(r2.children);
    return item;
  });
}
const asideMenuConfig = extractMenu(routesMenuConfig);
const Index = ({ collapsed: collapsed2 }) => {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { pathname } = useLocation();
  const onClick = (e2) => {
    navigate(e2.key);
  };
  function getItem(label, key, icon, children, type4) {
    return {
      key,
      icon,
      children,
      label,
      type: type4
    };
  }
  function convertItem(item) {
    var _a2;
    const Icon2 = item.icon ?? AiOutlineQuestionCircle;
    return getItem(
      collapsed2 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: item.isDeprecated ? "line-through" : "", children: t2(item.name) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-0.5", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: item.isDeprecated ? "line-through" : "", children: t2(item.name) }),
        item.isBeta && /* @__PURE__ */ jsxRuntimeExports.jsx(BetaChip, {}),
        item.isDeprecated && /* @__PURE__ */ jsxRuntimeExports.jsx(DeprecatedChip, {})
      ] }),
      item.path,
      /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "!text-lg" }),
      (_a2 = item.children) == null ? void 0 : _a2.map(convertItem)
    );
  }
  const items = asideMenuConfig.map(convertItem);
  const defaultOpenKeysRef = reactExports.useRef(
    asideMenuConfig.filter((m2) => {
      var _a2;
      return (_a2 = m2.children) == null ? void 0 : _a2.some((c2) => pathname.includes(c2.path));
    }).map((m2) => m2.path)
  );
  const defaultSelectedKeysRef = reactExports.useRef([
    (() => {
      for (const m2 of asideMenuConfig) {
        if (m2.path === pathname) {
          return pathname;
        }
        for (const c2 of m2.children || []) {
          if (pathname.includes(c2.path)) {
            return c2.path;
          }
        }
      }
      return "";
    })()
  ]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    Menu,
    {
      defaultOpenKeys: defaultOpenKeysRef.current,
      defaultSelectedKeys: defaultSelectedKeysRef.current,
      inlineCollapsed: collapsed2,
      inlineIndent: 12,
      mode: "inline",
      selectedKeys: [(() => {
        for (const m2 of asideMenuConfig) {
          if (m2.path === pathname) {
            return pathname;
          }
          for (const c2 of m2.children || []) {
            if (pathname.includes(c2.path)) {
              return c2.path;
            }
          }
        }
        return "";
      })()],
      style: {
        background: "none",
        border: "none",
        width: "100%"
      },
      onClick,
      forceSubMenuRender: true,
      items
    }
  );
};
const nav = "_nav_rpbvo_1";
const collapsed = "_collapsed_rpbvo_11";
const opts = "_opts_rpbvo_14";
const top = "_top_rpbvo_17";
const menu = "_menu_rpbvo_30";
const styles = {
  nav,
  collapsed,
  opts,
  top,
  menu
};
const OptIconStyle = { fontSize: 20 };
const SUPPORTED_LANGUAGES = [
  { code: "zh-CN", label: "简体中文", shortLabel: "中" },
  { code: "en-US", label: "English", shortLabel: "EN" }
];
const Navigation = () => {
  const { t: t2 } = useTranslation();
  const { pathname } = useLocation();
  const appOptions = useAppOptionsStore((state) => state.data);
  const uiOptionsStore = useUiOptionsStore();
  const isDarkMode = appOptions.uiTheme == UiTheme.Dark;
  const currentLanguage = SUPPORTED_LANGUAGES.find(
    (lang2) => {
      var _a2;
      return lang2.code === appOptions.language || lang2.code.toLowerCase() === ((_a2 = appOptions.language) == null ? void 0 : _a2.toLowerCase());
    }
  ) ?? SUPPORTED_LANGUAGES[1];
  const [loading, setLoading] = reactExports.useState(false);
  const prevPathRef = reactExports.useRef(pathname);
  const isCollapsed = uiOptionsStore.data.isMenuCollapsed;
  reactExports.useEffect(() => {
    if (pathname != prevPathRef.current) {
      setLoading(false);
      prevPathRef.current = pathname;
    }
  }, [pathname]);
  console.log("PageNav", pathname);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${styles.nav} ${isCollapsed ? `${styles.collapsed}` : ""}`, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.top, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Link$1, { to: "/", children: isCollapsed ? "B" : "Bakabase" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.menu, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Index, { collapsed: isCollapsed }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.opts, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "default",
          variant: "light",
          onPress: () => {
            setLoading(true);
            BApi$1.options.patchAppOptions({
              uiTheme: isDarkMode ? UiTheme.Light : UiTheme.Dark
            }).then(() => {
              location.reload();
            });
          },
          children: isDarkMode ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$8, { style: OptIconStyle }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$q, { style: OptIconStyle })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(dropdown_default, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(dropdown_trigger_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { isIconOnly: true, color: "default", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$D, { style: OptIconStyle }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(
          dropdown_menu_default,
          {
            "aria-label": "Language selection",
            selectionMode: "single",
            selectedKeys: /* @__PURE__ */ new Set([currentLanguage.code]),
            onSelectionChange: (keys2) => {
              const selected = Array.from(keys2)[0];
              if (selected && selected !== currentLanguage.code) {
                setLoading(true);
                BApi$1.options.patchAppOptions({ language: selected }).then(() => {
                  location.reload();
                });
              }
            },
            children: SUPPORTED_LANGUAGES.map((lang2) => /* @__PURE__ */ jsxRuntimeExports.jsx(menu_item_base_default, { children: lang2.label }, lang2.code))
          }
        )
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        Button,
        {
          isIconOnly: true,
          color: "default",
          variant: "light",
          onPress: () => {
            uiOptionsStore.patch({
              isMenuCollapsed: !isCollapsed
            });
          },
          children: isCollapsed ? /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$u, { style: OptIconStyle }) : /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$v, { style: OptIconStyle })
        }
      )
    ] })
  ] });
};
const AssistantStatus = {
  Idle: 0,
  Working: 1,
  AllDone: 2,
  Failed: 3
};
var TaskAction = /* @__PURE__ */ ((TaskAction2) => {
  TaskAction2[TaskAction2["Start"] = 1] = "Start";
  TaskAction2[TaskAction2["Pause"] = 2] = "Pause";
  TaskAction2[TaskAction2["Resume"] = 3] = "Resume";
  TaskAction2[TaskAction2["Stop"] = 4] = "Stop";
  TaskAction2[TaskAction2["Clean"] = 5] = "Clean";
  TaskAction2[TaskAction2["Config"] = 6] = "Config";
  return TaskAction2;
})(TaskAction || {});
const ActionsFilter = {
  [
    1
    /* Start */
  ]: (task) => task.isPersistent && (task.status === BTaskStatus.Cancelled || task.status === BTaskStatus.Error || task.status === BTaskStatus.Completed || task.status === BTaskStatus.NotStarted),
  [
    2
    /* Pause */
  ]: (task) => task.status === BTaskStatus.Running,
  [
    3
    /* Resume */
  ]: (task) => task.status === BTaskStatus.Paused,
  [
    4
    /* Stop */
  ]: (task) => task.status === BTaskStatus.Running,
  [
    5
    /* Clean */
  ]: (task) => !task.isPersistent && (task.status === BTaskStatus.Completed || task.status === BTaskStatus.Error || task.status === BTaskStatus.Cancelled),
  [
    6
    /* Config */
  ]: (task) => task.isPersistent
};
const POSITION_STORAGE_KEY = "floating-assistant-position";
const DEFAULT_POSITION = { x: 10, y: typeof window !== "undefined" ? window.innerHeight - 68 : 100 };
const POLLING_INTERVAL_MS = 2e3;
const DRAG_THRESHOLD = 8;
const getInitialPosition = () => {
  if (typeof window === "undefined")
    return DEFAULT_POSITION;
  try {
    const saved = localStorage.getItem(POSITION_STORAGE_KEY);
    if (saved) {
      const parsed = JSON.parse(saved);
      const maxX = window.innerWidth - 48;
      const maxY = window.innerHeight - 48;
      return {
        x: Math.max(0, Math.min(parsed.x ?? DEFAULT_POSITION.x, maxX)),
        y: Math.max(0, Math.min(parsed.y ?? DEFAULT_POSITION.y, maxY))
      };
    }
  } catch {
  }
  return DEFAULT_POSITION;
};
function useDraggable() {
  const [position2, setPosition] = reactExports.useState(getInitialPosition);
  const [isDraggingState, setIsDraggingState] = reactExports.useState(false);
  const isDraggingRef = reactExports.useRef(false);
  const dragStartRef = reactExports.useRef(null);
  reactExports.useEffect(() => {
    if (isDraggingState) {
      document.body.style.cursor = "grabbing";
      document.body.style.userSelect = "none";
    } else {
      document.body.style.cursor = "";
      document.body.style.userSelect = "";
    }
    return () => {
      document.body.style.cursor = "";
      document.body.style.userSelect = "";
    };
  }, [isDraggingState]);
  const handleMouseDown = reactExports.useCallback((e2) => {
    e2.preventDefault();
    dragStartRef.current = {
      x: e2.clientX,
      y: e2.clientY,
      posX: position2.x,
      posY: position2.y
    };
    isDraggingRef.current = false;
    const handleMouseMove = (moveEvent) => {
      if (!dragStartRef.current)
        return;
      const dx = moveEvent.clientX - dragStartRef.current.x;
      const dy = moveEvent.clientY - dragStartRef.current.y;
      if (!isDraggingRef.current && (Math.abs(dx) > DRAG_THRESHOLD || Math.abs(dy) > DRAG_THRESHOLD)) {
        isDraggingRef.current = true;
        setIsDraggingState(true);
      }
      if (isDraggingRef.current) {
        const newX = Math.max(0, Math.min(dragStartRef.current.posX + dx, window.innerWidth - 48));
        const newY = Math.max(0, Math.min(dragStartRef.current.posY + dy, window.innerHeight - 48));
        setPosition({ x: newX, y: newY });
      }
    };
    const handleMouseUp = () => {
      document.removeEventListener("mousemove", handleMouseMove);
      document.removeEventListener("mouseup", handleMouseUp);
      if (isDraggingRef.current) {
        try {
          localStorage.setItem(POSITION_STORAGE_KEY, JSON.stringify(position2));
        } catch {
        }
      }
      dragStartRef.current = null;
      if (isDraggingRef.current) {
        setIsDraggingState(false);
        setTimeout(() => {
          isDraggingRef.current = false;
        }, 100);
      }
    };
    document.addEventListener("mousemove", handleMouseMove);
    document.addEventListener("mouseup", handleMouseUp);
  }, [position2]);
  const isDragging2 = reactExports.useCallback(() => isDraggingRef.current, []);
  return {
    position: position2,
    handleMouseDown,
    isDragging: isDragging2,
    isDraggingState
  };
}
function useTaskTimingSimulation(tasks) {
  const simTimingRef = reactExports.useRef(/* @__PURE__ */ new Map());
  reactExports.useEffect(() => {
    const now2 = Date.now();
    const map2 = simTimingRef.current;
    const existingIds = new Set(map2.keys());
    tasks.forEach((task) => {
      const rawElapsedMs = task.elapsed ? hooks.duration(task.elapsed).asMilliseconds() : void 0;
      const rawRemainingMs = task.estimateRemainingTime ? hooks.duration(task.estimateRemainingTime).asMilliseconds() : void 0;
      const rec = map2.get(task.id);
      if (!rec) {
        map2.set(task.id, {
          baseElapsedMs: rawElapsedMs,
          baseRemainingMs: rawRemainingMs,
          lastSeenAt: now2,
          lastStatus: task.status,
          lastRawElapsedMs: rawElapsedMs,
          lastRawRemainingMs: rawRemainingMs
        });
      } else {
        const incomingChanged = rec.lastRawElapsedMs !== rawElapsedMs || rec.lastRawRemainingMs !== rawRemainingMs;
        if (incomingChanged) {
          rec.baseElapsedMs = rawElapsedMs;
          rec.baseRemainingMs = rawRemainingMs;
          rec.lastSeenAt = now2;
          rec.lastRawElapsedMs = rawElapsedMs;
          rec.lastRawRemainingMs = rawRemainingMs;
          rec.lastStatus = task.status;
        } else if (task.status !== rec.lastStatus) {
          const delta = Math.max(0, now2 - rec.lastSeenAt);
          if (rec.lastStatus === BTaskStatus.Running) {
            rec.baseElapsedMs = (rec.baseElapsedMs ?? 0) + delta;
            if (rec.baseRemainingMs != null) {
              rec.baseRemainingMs = Math.max(0, rec.baseRemainingMs - delta);
            }
          }
          rec.lastSeenAt = now2;
          rec.lastStatus = task.status;
        }
      }
      existingIds.delete(task.id);
    });
    existingIds.forEach((id2) => map2.delete(id2));
  }, [tasks]);
  const computeDisplayElapsedMs = (task) => {
    const rec = simTimingRef.current.get(task.id);
    const baseMs = rec == null ? void 0 : rec.baseElapsedMs;
    if (baseMs == null)
      return void 0;
    if (task.status === BTaskStatus.Running) {
      return baseMs + Math.max(0, Date.now() - ((rec == null ? void 0 : rec.lastSeenAt) ?? Date.now()));
    }
    return baseMs;
  };
  const computeDisplayRemainingMs = (task) => {
    const rec = simTimingRef.current.get(task.id);
    const baseMs = rec == null ? void 0 : rec.baseRemainingMs;
    if (baseMs == null)
      return void 0;
    if (task.status === BTaskStatus.Running) {
      const ms = baseMs - Math.max(0, Date.now() - ((rec == null ? void 0 : rec.lastSeenAt) ?? Date.now()));
      return Math.max(0, ms);
    }
    return baseMs;
  };
  return {
    computeDisplayElapsedMs,
    computeDisplayRemainingMs
  };
}
const TaskStatusIcon = ({ task, onShowError }) => {
  var _a2;
  switch (task.status) {
    case BTaskStatus.NotStarted:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1d, { className: "text-base" }) });
    case BTaskStatus.Cancelled:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1o, { className: "text-base" }) });
    case BTaskStatus.Paused:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "warning", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$n, { className: "text-base" }) });
    case BTaskStatus.Error:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(
        Tooltip$1,
        {
          color: "danger",
          content: task.briefError || ((_a2 = task.error) == null ? void 0 : _a2.substring(0, 100)) || "Error",
          placement: "top",
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            Button,
            {
              isIconOnly: true,
              color: "danger",
              size: "sm",
              variant: "light",
              onPress: onShowError,
              children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$P, { className: "text-base" })
            }
          )
        }
      );
    case BTaskStatus.Running:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1n, { className: "text-base" }) });
    case BTaskStatus.Completed:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$_, { className: "text-base" }) });
    default:
      return null;
  }
};
function TaskTable({ tasks }) {
  const { t: t2 } = useTranslation();
  const navigate = useNavigate();
  const { createPortal } = useBakabaseContext();
  const [cleaningTaskId, setCleaningTaskId] = reactExports.useState();
  const [loadingTasks, setLoadingTasks] = reactExports.useState(/* @__PURE__ */ new Map());
  const [filter3, setFilter] = reactExports.useState("all");
  const { computeDisplayElapsedMs, computeDisplayRemainingMs } = useTaskTimingSimulation(tasks);
  const taskCounts = reactExports.useMemo(() => {
    const counts = {
      all: tasks.length,
      running: 0,
      pending: 0,
      completed: 0,
      failed: 0
    };
    tasks.forEach((task) => {
      switch (task.status) {
        case BTaskStatus.Running:
          counts.running++;
          break;
        case BTaskStatus.NotStarted:
        case BTaskStatus.Paused:
          counts.pending++;
          break;
        case BTaskStatus.Completed:
          counts.completed++;
          break;
        case BTaskStatus.Error:
        case BTaskStatus.Cancelled:
          counts.failed++;
          break;
      }
    });
    return counts;
  }, [tasks]);
  const filteredTasks = reactExports.useMemo(() => {
    let result = tasks;
    if (filter3 !== "all") {
      result = tasks.filter((task) => {
        switch (filter3) {
          case "running":
            return task.status === BTaskStatus.Running;
          case "pending":
            return task.status === BTaskStatus.NotStarted || task.status === BTaskStatus.Paused;
          case "completed":
            return task.status === BTaskStatus.Completed;
          case "failed":
            return task.status === BTaskStatus.Error || task.status === BTaskStatus.Cancelled;
          default:
            return true;
        }
      });
    }
    return [...result].sort((a2, b2) => {
      const order2 = {
        [BTaskStatus.Running]: 0,
        [BTaskStatus.Error]: 1,
        [BTaskStatus.Paused]: 2,
        [BTaskStatus.NotStarted]: 3,
        [BTaskStatus.Completed]: 4,
        [BTaskStatus.Cancelled]: 5
      };
      return (order2[a2.status] ?? 99) - (order2[b2.status] ?? 99);
    });
  }, [tasks, filter3]);
  const columns = reactExports.useMemo(() => [
    { key: "name", label: t2("floatingAssistant.label.taskList") },
    { key: "status", label: t2("common.label.status") },
    { key: "progress", label: t2("common.label.progress") },
    { key: "time", label: t2("common.label.time") },
    { key: "remaining", label: t2("common.label.remaining") },
    { key: "operations", label: t2("common.label.operations") }
  ], [t2]);
  const handleShowError = (task) => {
    if (task.error) {
      createPortal(Modal, {
        defaultVisible: true,
        size: "xl",
        classNames: { wrapper: "floating-assistant-modal" },
        title: t2("common.label.error"),
        children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { children: task.error }),
        footer: { actions: ["cancel"] }
      });
    }
  };
  const setTaskLoading = (taskId, action) => {
    setLoadingTasks(new Map(loadingTasks.set(taskId, action)));
  };
  const clearTaskLoading = (taskId) => {
    setLoadingTasks((prev2) => {
      const next2 = new Map(prev2);
      next2.delete(taskId);
      return next2;
    });
  };
  const getActionLabel = (action) => {
    switch (action) {
      case TaskAction.Start:
        return t2("floatingAssistant.status.started");
      case TaskAction.Pause:
        return t2("floatingAssistant.status.paused");
      case TaskAction.Resume:
        return t2("floatingAssistant.status.resumed");
      case TaskAction.Stop:
        return t2("floatingAssistant.status.stopped");
      default:
        return "";
    }
  };
  const handleTaskAction = async (task, action) => {
    setTaskLoading(task.id, action);
    try {
      switch (action) {
        case TaskAction.Start:
          await BApi$1.backgroundTask.startBackgroundTask(task.id);
          break;
        case TaskAction.Pause:
          await BApi$1.backgroundTask.pauseBackgroundTask(task.id);
          break;
        case TaskAction.Resume:
          await BApi$1.backgroundTask.resumeBackgroundTask(task.id);
          break;
        case TaskAction.Stop:
          await BApi$1.backgroundTask.stopBackgroundTask(task.id);
          break;
      }
      toast.success({ title: `${task.name}: ${getActionLabel(action)}` });
    } catch (error2) {
      const message = error2 instanceof Error ? error2.message : t2("common.error.unknownError");
      toast.danger({ title: `${task.name}: ${message}` });
    } finally {
      clearTaskLoading(task.id);
    }
  };
  const renderTaskActions = (task) => {
    const actions = [];
    Object.entries(ActionsFilter).forEach(([key, filter22]) => {
      if (!filter22(task))
        return;
      const action = parseInt(key, 10);
      const isLoading = loadingTasks.get(task.id) === action;
      switch (action) {
        case TaskAction.Start:
        case TaskAction.Resume:
          actions.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: action === TaskAction.Start ? t2("common.action.start") : t2("common.action.resume"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "secondary",
                size: "sm",
                variant: "light",
                isLoading,
                onPress: () => handleTaskAction(task, action),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$$, { className: "text-base" })
              }
            ) }, `${action}-${task.id}`)
          );
          break;
        case TaskAction.Pause:
          actions.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.pause"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "warning",
                size: "sm",
                variant: "light",
                isLoading,
                onPress: () => handleTaskAction(task, action),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-base" })
              }
            ) }, `pause-${task.id}`)
          );
          break;
        case TaskAction.Stop:
          actions.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.stop"), placement: "top", color: "danger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                color: "danger",
                size: "sm",
                variant: "light",
                isLoading,
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("floatingAssistant.modal.stoppingTaskTitle", { taskName: task.name }),
                    children: task.messageOnInterruption ?? t2("common.confirm.stopTask"),
                    onOk: () => handleTaskAction(task, TaskAction.Stop),
                    classNames: { wrapper: "floating-assistant-modal" }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$9, { className: "text-base" })
              }
            ) }, `stop-${task.id}`)
          );
          break;
        case TaskAction.Clean:
          actions.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("floatingAssistant.tip.removeFromList"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                size: "sm",
                variant: "light",
                onPress: () => setCleaningTaskId(task.id),
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" })
              }
            ) }, `clean-${task.id}`)
          );
          break;
        case TaskAction.Config:
          actions.push(
            /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("common.action.configure"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
              Button,
              {
                isIconOnly: true,
                size: "sm",
                variant: "light",
                onPress: () => {
                  createPortal(Modal, {
                    defaultVisible: true,
                    title: t2("common.tip.leavePageWarning"),
                    children: t2("common.confirm.short"),
                    onOk: () => navigate("/background-task"),
                    classNames: { wrapper: "floating-assistant-modal" }
                  });
                },
                children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$c, { className: "text-base" })
              }
            ) }, `config-${task.id}`)
          );
          break;
      }
    });
    return actions;
  };
  const filterOptions = [
    { key: "all", label: t2("common.label.all") },
    { key: "running", label: t2("floatingAssistant.status.running"), color: "primary" },
    { key: "pending", label: t2("floatingAssistant.status.pending"), color: "warning" },
    { key: "completed", label: t2("floatingAssistant.status.completed"), color: "success" },
    { key: "failed", label: t2("floatingAssistant.status.failed"), color: "danger" }
  ];
  if (tasks.length === 0) {
    return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-[80px] flex items-center justify-center", children: t2("floatingAssistant.empty.noBackgroundTask") });
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1", children: filterOptions.map((option) => {
      const count = taskCounts[option.key];
      const isActive2 = filter3 === option.key;
      return /* @__PURE__ */ jsxRuntimeExports.jsxs(
        Chip,
        {
          size: "sm",
          variant: isActive2 ? "solid" : "flat",
          color: isActive2 ? option.color ?? "default" : "default",
          className: "cursor-pointer",
          onClick: () => setFilter(option.key),
          children: [
            option.label,
            " (",
            count,
            ")"
          ]
        },
        option.key
      );
    }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs(table_default, { isCompact: true, isStriped: true, removeWrapper: true, "aria-label": "Background tasks", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_header_default, { columns, children: (column2) => /* @__PURE__ */ jsxRuntimeExports.jsx(table_column_default, { children: column2.label }, column2.key) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(table_body_default, { emptyContent: t2("floatingAssistant.empty.noTasksMatchFilter"), children: filteredTasks.map((task) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
        table_row_default,
        {
          className: `transition-opacity ${task.id === cleaningTaskId ? "opacity-0" : ""} ${task.status === BTaskStatus.Error ? "task-row-error" : ""}`,
          onTransitionEnd: (evt) => {
            if (evt.propertyName === "opacity" && task.id === cleaningTaskId) {
              BApi$1.backgroundTask.cleanBackgroundTask(task.id);
            }
          },
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate max-w-[200px]", children: task.name }),
              task.isPersistent && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: t2("floatingAssistant.tip.persistentScheduledTask"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$g, { className: "text-base opacity-40" }) }),
              task.description && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { color: "secondary", content: task.description, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$1b, { className: "text-base opacity-60" }) }),
              task.process && /* @__PURE__ */ jsxRuntimeExports.jsx(Chip, { color: "success", variant: "light", size: "sm", children: task.process })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStatusIcon, { task, onShowError: () => handleShowError(task) }),
              task.status === BTaskStatus.Error && task.briefError && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-danger truncate max-w-[100px]", title: task.briefError, children: task.briefError })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative min-w-[60px]", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                progress_default,
                {
                  color: "primary",
                  size: "sm",
                  value: task.percentage,
                  className: task.status === BTaskStatus.Running ? "task-progress-animated" : "",
                  classNames: {
                    indicator: task.status === BTaskStatus.Running ? "progress-bar-indicator" : ""
                  }
                }
              ),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-0 left-0 flex items-center justify-center w-full h-full text-xs", children: [
                task.percentage,
                "%"
              ] })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-xs whitespace-nowrap", children: [
              task.startedAt && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-default-500", children: dayjs(task.startedAt).format("HH:mm:ss") }),
              (() => {
                const ms = computeDisplayElapsedMs(task);
                return ms != null ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: dayjs.duration(ms).format("HH:mm:ss") }) : null;
              })()
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: (() => {
              const ms = computeDisplayRemainingMs(task);
              if (ms == null) {
                if (task.nextTimeStartAt) {
                  return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("floatingAssistant.label.nextRun"), placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-default-500", children: dayjs(task.nextTimeStartAt).format("HH:mm") }) });
                }
                return null;
              }
              const remaining = dayjs.duration(ms).format("HH:mm:ss");
              const estimatedEndTime = dayjs().add(ms, "millisecond").format("HH:mm");
              return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: `${t2("floatingAssistant.tip.estimatedCompletion")}: ${estimatedEndTime}`, placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-help text-xs", children: remaining }) });
            })() }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(table_cell_default, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-1", children: renderTaskActions(task) }) })
          ]
        },
        task.id
      )) })
    ] })
  ] });
}
const log$2 = buildLogger("FloatingAssistant");
const FloatingAssistant = () => {
  const { t: t2 } = useTranslation();
  const [allDoneCircleDrawn, setAllDoneCircleDrawn] = reactExports.useState("");
  const [status, setStatus] = reactExports.useState(AssistantStatus.Working);
  const statusRef = reactExports.useRef(status);
  const [tasksVisible, setTasksVisible] = reactExports.useState(false);
  const { position: position2, handleMouseDown, isDragging: isDragging2, isDraggingState } = useDraggable();
  const bTasks = useBTasksStore(selectTasks);
  const [, setNowTick] = reactExports.useState(Date.now());
  reactExports.useEffect(() => {
    statusRef.current = status;
  }, [status]);
  reactExports.useEffect(() => {
    log$2("Initializing...");
    const queryTask = setInterval(() => {
      const tempTasks = useBTasksStore.getState().tasks;
      let newStatus = AssistantStatus.AllDone;
      if (tempTasks.length > 0) {
        const ongoingTasks = tempTasks.filter(
          (a2) => a2.status === BTaskStatus.Running
        );
        if (ongoingTasks.length > 0) {
          newStatus = AssistantStatus.Working;
        } else {
          const failedTasks = tempTasks.filter(
            (a2) => a2.status === BTaskStatus.Error
          );
          if (failedTasks.length > 0) {
            newStatus = AssistantStatus.Failed;
          } else {
            const doneTasks = tempTasks.filter(
              (a2) => a2.status === BTaskStatus.Completed
            );
            if (doneTasks.length > 0) {
              newStatus = AssistantStatus.AllDone;
            }
          }
        }
      }
      if (newStatus !== statusRef.current) {
        setStatus(newStatus);
        if (newStatus === AssistantStatus.AllDone) {
          setTimeout(() => {
            setAllDoneCircleDrawn("drawn");
          }, 300);
        }
      }
      setNowTick(Date.now());
    }, POLLING_INTERVAL_MS);
    return () => {
      log$2("Destroying...");
      clearInterval(queryTask);
    };
  }, []);
  const handleClick = reactExports.useCallback(() => {
    if (!isDragging2()) {
      setTasksVisible((v2) => !v2);
    }
  }, [isDragging2]);
  const clearableTasks = reactExports.useMemo(() => bTasks.filter(
    (task) => !task.isPersistent && (task.status === BTaskStatus.Completed || task.status === BTaskStatus.Error || task.status === BTaskStatus.Cancelled)
  ), [bTasks]);
  const runningTasks = reactExports.useMemo(
    () => bTasks.filter((task) => task.status === BTaskStatus.Running),
    [bTasks]
  );
  const pausedTasks = reactExports.useMemo(
    () => bTasks.filter((task) => task.status === BTaskStatus.Paused),
    [bTasks]
  );
  const handlePauseAll = reactExports.useCallback(async () => {
    for (const task of runningTasks) {
      await BApi$1.backgroundTask.pauseBackgroundTask(task.id);
    }
  }, [runningTasks]);
  const handleResumeAll = reactExports.useCallback(async () => {
    for (const task of pausedTasks) {
      await BApi$1.backgroundTask.resumeBackgroundTask(task.id);
    }
  }, [pausedTasks]);
  const overallProgress = reactExports.useMemo(() => {
    if (runningTasks.length === 0)
      return 0;
    const totalProgress = runningTasks.reduce(
      (sum, task) => sum + (task.percentage ?? 0),
      0
    );
    return Math.round(totalProgress / runningTasks.length);
  }, [runningTasks]);
  const statusClassName = reactExports.useMemo(() => Object.keys(AssistantStatus)[status], [status]);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
    PopoverComponent,
    {
      visible: tasksVisible,
      onOpenChange: (visible) => {
        if (!visible) {
          setTasksVisible(false);
        }
      },
      trigger: /* @__PURE__ */ jsxRuntimeExports.jsxs(
        "div",
        {
          className: `portal ${statusClassName} floating-assistant ${tasksVisible ? "" : "hide"} ${isDraggingState ? "cursor-grabbing" : "cursor-grab"}`,
          style: {
            left: position2.x,
            top: position2.y
          },
          onMouseDown: handleMouseDown,
          onClick: handleClick,
          children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: `${runningTasks.length} ${t2("floatingAssistant.status.tasksRunning")} (${overallProgress}%)`,
                placement: "right",
                className: "working-tooltip",
                children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "circular-progress-wrapper", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    circular_progress_default,
                    {
                      "aria-label": "Task progress",
                      value: overallProgress,
                      size: "lg",
                      color: "primary",
                      showValueLabel: false,
                      classNames: {
                        svg: "w-[44px] h-[44px]",
                        track: "stroke-default-200",
                        indicator: "stroke-primary"
                      }
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "task-count", children: runningTasks.length })
                ] })
              }
            ),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "tick", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
              "svg",
              {
                version: "1.1",
                viewBox: "0 0 37 37",
                x: "0px",
                y: "0px",
                enableBackground: "new 0 0 37 37",
                className: allDoneCircleDrawn,
                children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "path",
                    {
                      className: "circ path",
                      d: "M30.5,6.5L30.5,6.5c6.6,6.6,6.6,17.4,0,24l0,0c-6.6,6.6-17.4,6.6-24,0l0,0c-6.6-6.6-6.6-17.4,0-24l0,0C13.1-0.2,23.9-0.2,30.5,6.5z",
                      fill: "none",
                      stroke: "#08c29e",
                      strokeLinejoin: "round",
                      strokeMiterlimit: 10,
                      strokeWidth: 3
                    }
                  ),
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "polyline",
                    {
                      className: "tick path",
                      fill: "none",
                      points: "11.6,20 15.9,24.2 26.4,13.8",
                      stroke: "#08c29e",
                      strokeLinejoin: "round",
                      strokeMiterlimit: 10,
                      strokeWidth: 3
                    }
                  )
                ]
              }
            ) }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(
              Tooltip$1,
              {
                content: t2("floatingAssistant.status.someTasksFailed"),
                placement: "right",
                color: "danger",
                children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "failed flex items-center justify-center w-[48px] h-[48px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Y, { className: "text-4xl" }) })
              }
            )
          ]
        }
      ),
      children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-2 min-w-[300px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1 max-h-[600px] mt-2 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskTable, { tasks: bTasks }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(divider_default, { orientation: "horizontal" }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
          runningTasks.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("floatingAssistant.tip.pauseAllRunningTasks"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "ghost",
              color: "warning",
              onPress: handlePauseAll,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { className: "text-base" }),
                t2("common.action.pauseAll")
              ]
            }
          ) }),
          pausedTasks.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("floatingAssistant.tip.resumeAllPausedTasks"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "ghost",
              color: "secondary",
              onPress: handleResumeAll,
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$$, { className: "text-base" }),
                t2("common.action.resumeAll")
              ]
            }
          ) }),
          clearableTasks.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { content: t2("floatingAssistant.tip.clearInactiveTasks"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
            Button,
            {
              size: "sm",
              variant: "ghost",
              onPress: () => BApi$1.backgroundTask.cleanInactiveBackgroundTasks(),
              children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$Z, { className: "text-base" }),
                t2("floatingAssistant.action.clearInactiveTasks")
              ]
            }
          ) })
        ] })
      ] })
    }
  );
};
FloatingAssistant.displayName = "FloatingAssistant";
const log$1 = buildLogger("BasicLayout");
function BasicLayout({
  children
}) {
  const { t: t2 } = useTranslation();
  const { createPortal } = useBakabaseContext();
  const navigate = useNavigate();
  reactExports.useEffect(() => {
    log$1("Initializing...");
    BApi$1.app.checkAppInitialized().then((a2) => {
      switch (a2.data) {
        case InitializationContentType.NotAcceptTerms:
          navigate("/welcome");
          break;
        case InitializationContentType.NeedRestart:
          createPortal(Modal, {
            title: t2("Please restart app and try this later"),
            footer: false
          });
          break;
      }
    });
  }, []);
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TourProvider, { steps: [], children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles$1.insideWorld, children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingAssistant, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx(Navigation, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${styles$1.main} pt-1 pb-1 pr-1`, children })
  ] }) }) });
}
function BlankLayout({
  children
}) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
}
const log2 = buildLogger("App");
function getLayout(layout2, children) {
  switch (layout2) {
    case "blank":
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BlankLayout, { children });
    case "basic":
    default:
      return /* @__PURE__ */ jsxRuntimeExports.jsx(BasicLayout, { children });
  }
}
function isLazyComponent(component) {
  return component.$$typeof === Symbol.for("react.lazy");
}
function flattenRoutes(config2) {
  const result = [];
  for (const r2 of config2) {
    if (r2.children) {
      result.push(...flattenRoutes(r2.children));
    }
    if (r2.path && r2.component) {
      const componentElement = /* @__PURE__ */ jsxRuntimeExports.jsx(r2.component, {});
      result.push({
        path: r2.path,
        element: getLayout(
          r2.layout || "basic",
          isLazyComponent(r2.component) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            reactExports.Suspense,
            {
              fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-32", children: "Loading..." }),
              children: componentElement
            }
          ) : componentElement
        )
      });
    }
  }
  return result;
}
function AppRouter() {
  const location2 = useLocation();
  reactExports.useEffect(() => {
    log2("Current route:", location2.pathname);
  }, [location2]);
  const routes = flattenRoutes(routesMenuConfig);
  routes.push({ path: "*", element: /* @__PURE__ */ jsxRuntimeExports.jsx(Navigate, { replace: true, to: "/" }) });
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BakabaseContextProvider, { children: useRoutes(routes) });
}
client.createRoot(document.getElementById("root")).render(
  // <React.StrictMode>
  /* @__PURE__ */ jsxRuntimeExports.jsx(HashRouter, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(AppRouter, {}) })
  // </React.StrictMode>,
);
export {
  closestCenter as $,
  BApi$1 as A,
  Button as B,
  Chip as C,
  buildLayerBasedPathRegexString as D,
  badge_default as E,
  FileSystemEntryIcon as F,
  RefIcon$U as G,
  MdCheckCircle as H,
  Icon$2 as I,
  React$6 as J,
  useTraceUpdate as K,
  buildLogger as L,
  MatchResultType as M,
  useUpdate as N,
  useTour as O,
  PopoverComponent as P,
  useSortable as Q,
  RefIcon$1b as R,
  CSS$1 as S,
  Tooltip$1 as T,
  useSensors as U,
  useSensor as V,
  sortableKeyboardCoordinates as W,
  KeyboardSensor as X,
  PointerSensor as Y,
  DndContext as Z,
  _extends$j as _,
  ResourceMatcherValueType as a,
  Editor as a$,
  SortableContext$1 as a0,
  verticalListSortingStrategy as a1,
  arrayMove as a2,
  MediaPreviewer as a3,
  RefIcon$17 as a4,
  RefIcon$P as a5,
  PropertyType as a6,
  checkbox_default as a7,
  CoverSelectOrder$1 as a8,
  EnhancerTargetOptionsItem as a9,
  ResourceFilterController as aA,
  dayjs as aB,
  duration as aC,
  propertyTypes as aD,
  ModalContent as aE,
  PresetTemplateBuilder as aF,
  src_default as aG,
  FileNameModifierModal as aH,
  FolderSelector as aI,
  spinner_default as aJ,
  IwFsType as aK,
  toast as aL,
  MediaPlayer as aM,
  AfterFirstPlayOperationsModal as aN,
  AiOutlineWarning as aO,
  switch_default as aP,
  PathTree as aQ,
  PathMarkType as aR,
  Editor$8 as aS,
  BulkModificationProcessorValueType as aT,
  Editor$6 as aU,
  Editor$5 as aV,
  Editor$4 as aW,
  Editor$3 as aX,
  Editor$2 as aY,
  Editor$7 as aZ,
  Editor$1 as a_,
  SpecialTextType as aa,
  RefIcon$T as ab,
  RefIcon$R as ac,
  IntegrateWithSpecialTextLabel as ad,
  Label as ae,
  StandardValueType as af,
  table_default as ag,
  table_header_default as ah,
  table_column_default as ai,
  table_body_default as aj,
  divider_default as ak,
  RefIcon$k as al,
  useEnhancerOptionsStore as am,
  RegexEnhancerTarget as an,
  textarea_default as ao,
  Vt as ap,
  findCapturingGroupsInRegex as aq,
  EnhancerId as ar,
  CategoryAdditionalItem as as,
  createPortalOfComponent as at,
  serializeStandardValue as au,
  SearchOperation as av,
  GroupCombinator as aw,
  FilterDisplayMode as ax,
  Tabs as ay,
  Tab as az,
  RefIcon as b,
  fillOffset as b$,
  getAvailableModesForPropertyType as b0,
  NullValueBehavior as b1,
  BriefProperty as b2,
  ComparisonMode as b3,
  RuleConfigPanel as b4,
  PropertyPoolLabel as b5,
  PropertyTypeLabel as b6,
  getBizValueType as b7,
  getDbValueType as b8,
  PropertyValueRenderer as b9,
  createDOMMotionComponentProxy as bA,
  frame as bB,
  cancelFrame as bC,
  resolveElements as bD,
  progress$1 as bE,
  velocityPerSecond as bF,
  interpolate$2 as bG,
  defaultOffset as bH,
  clamp$2 as bI,
  frameData as bJ,
  supportsScrollTimeline as bK,
  useConstant as bL,
  motionValue as bM,
  useIsomorphicLayoutEffect$4 as bN,
  warning$3 as bO,
  MotionConfigContext as bP,
  isMotionValue as bQ,
  animateValue as bR,
  collectMotionValues as bS,
  hasReducedMotionListener as bT,
  initPrefersReducedMotion as bU,
  prefersReducedMotion as bV,
  animateVisualElement as bW,
  setTarget as bX,
  isEasingArray as bY,
  mixNumber$1 as bZ,
  removeItem as b_,
  spacer_default as ba,
  ErrorBoundary as bb,
  List as bc,
  ResourceTransferModal as bd,
  useLocalStorage as be,
  button_default$1 as bf,
  ChevronRightIcon$1 as bg,
  FileSystemSelectorButton as bh,
  Index as bi,
  OrderSelector as bj,
  Editor$9 as bk,
  DeprecatedChip as bl,
  BetaChip as bm,
  PropertyMatcher as bn,
  calcGeneratorDuration as bo,
  maxGeneratorDuration as bp,
  millisecondsToSeconds as bq,
  secondsToMilliseconds as br,
  attachTimeline as bs,
  noop$a as bt,
  createMotionComponentFactory as bu,
  animations as bv,
  createDomVisualElement as bw,
  layout as bx,
  drag as by,
  gestureAnimations as bz,
  commonjsGlobal as c,
  keyframes as c$,
  isGenerator as c0,
  VisualElement as c1,
  createBox as c2,
  isSVGElement$1 as c3,
  SVGVisualElement as c4,
  HTMLVisualElement as c5,
  visualElementStore as c6,
  animateSingleValue as c7,
  animateTarget as c8,
  spring as c9,
  m$3 as cA,
  domAnimation$8 as cB,
  domMax as cC,
  useWillChange as cD,
  resolveMotionValue as cE,
  AcceleratedAnimation as cF,
  useIsPresent as cG,
  usePresence as cH,
  createRendererMotionComponent as cI,
  isValidMotionProp as cJ,
  addScaleCorrector as cK,
  buildTransform as cL,
  MotionGlobalConfig as cM,
  color$2 as cN,
  complex as cO,
  px as cP,
  findSpring as cQ,
  optimizedAppearDataAttribute as cR,
  LayoutGroupContext as cS,
  PresenceContext as cT,
  SwitchLayoutGroupContext as cU,
  FlatTree as cV,
  DeprecatedLayoutGroupContext as cW,
  delay$1 as cX,
  isDragActive as cY,
  MotionValue as cZ,
  inertia as c_,
  GroupPlaybackControls as ca,
  memo$1 as cb,
  invariant$2 as cc,
  supportsLinearEasing as cd,
  supportsWaapi as ce,
  startWaapiAnimation as cf,
  getFinalKeyframe as cg,
  browserNumberValueTypes as ch,
  getValueTransition as ci,
  addDomEvent as cj,
  motionComponentSymbol as ck,
  rootProjectionNode as cl,
  instantAnimationState as cm,
  useForceUpdate as cn,
  transformProps as co,
  optimizedAppearDataId as cp,
  getOptimisedAppearId as cq,
  makeUseVisualState as cr,
  LayoutGroup as cs,
  MotionContext as ct,
  moveItem as cu,
  easingDefinitionToFunction as cv,
  stepsOrder as cw,
  AnimatePresence as cx,
  LazyMotion as cy,
  MotionConfig as cz,
  ResourceProperty as d,
  time as d0,
  mix as d1,
  pipe as d2,
  anticipate as d3,
  backIn as d4,
  backInOut as d5,
  backOut as d6,
  circIn as d7,
  circInOut as d8,
  circOut as d9,
  cubicBezier as da,
  easeIn as db,
  easeInOut as dc,
  easeOut as dd,
  mirrorEasing as de,
  reverseEasing as df,
  frameSteps as dg,
  distance as dh,
  distance2D as di,
  calcLength as dj,
  filterProps as dk,
  addPointerEvent as dl,
  addPointerInfo as dm,
  isBrowser$3 as dn,
  __vitePreload as dp,
  card_default as e,
  card_header_default as f,
  getDefaultExportFromCjs as g,
  radio_group_default as h,
  radio_default as i,
  jsxRuntimeExports as j,
  card_body_default as k,
  execAll as l,
  input_default as m,
  RefIcon$y as n,
  useUpdateEffect as o,
  Modal as p,
  useBakabaseContext as q,
  reactExports as r,
  splitPathIntoSegments as s,
  IconType as t,
  useTranslation as u,
  listbox_default as v,
  listbox_item_base_default as w,
  BusinessConstants as x,
  PropertySelector as y,
  PropertyPool as z
};
